2013-01-09 17:20:24

by Vladimir Kondratiev

[permalink] [raw]
Subject: Q: how to update platform power state for the network driver

Hi,

in 60g spec (802.11ad, references to this doc.), station should set "power source" bit in the:

8.4.2.130.3 DMG PCP/AP Capability Information field

This information used to construct "PCP factor" that used in:

10.1.4.3.4 PCP selection in a PBSS

This procedure replaces GO negotiation in P2P. "power source" bit above specified as:

The Power Source field is set to 0 if the STA is battery powered, and is set to 1 otherwise.

What is the best way to obtain this info in the network driver?

Thanks, Vladimir.


2013-01-13 07:34:55

by Vladimir Kondratiev

[permalink] [raw]
Subject: Re: Q: how to update platform power state for the network driver

On Friday, January 11, 2013 11:45:43 AM Julian Calaby wrote:
> > #include <linux/power_supply.h>
> > int power_supply_is_system_supplied(void);
> One minor point: you might want to add the ability to override this,
> even if it's only through debugfs so that people testing the code, or
> with unusual requirements can set this how they want / need it.

Sure, thanks for input

2013-01-11 00:53:44

by Julian Calaby

[permalink] [raw]
Subject: Re: Q: how to update platform power state for the network driver

Hi Vladimir,

On Thu, Jan 10, 2013 at 11:06 PM, Vladimir Kondratiev
<[email protected]> wrote:
> On Wednesday, January 09, 2013 07:20:06 PM Vladimir Kondratiev wrote:
>> What is the best way to obtain this info in the network driver?
>>
>
> Found:
>
> #include <linux/power_supply.h>
> int power_supply_is_system_supplied(void);
>
> returns:
> positive if system is AC supplied,
> 0 if battery supplied
> negative on error

One minor point: you might want to add the ability to override this,
even if it's only through debugfs so that people testing the code, or
with unusual requirements can set this how they want / need it.

Thanks,

--
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/

2013-01-14 07:01:12

by Kalle Valo

[permalink] [raw]
Subject: Re: Q: how to update platform power state for the network driver

Vladimir Kondratiev <[email protected]> writes:

> On Thursday, January 10, 2013 11:39:33 PM Kalle Valo wrote:
>> Vladimir Kondratiev <[email protected]> writes:
>>
>> > in 60g spec (802.11ad, references to this doc.), station should set "power source" bit in the:
> [skip]
>>
>> Scary! Just of curiosity, how is this bit supposed to be used in real life?
>>
>
> In 60g, you have new ah-hoc network type, PBSS, that should be used for P2P (spec mandates it)
> In PBSS, there is AP-like entity called PCP. Instead of P2P GO negotiation, GO choosen before,
> on lower layer, when selecting PCP. In this decision, "best suitable" candidate selected PCP,
> based on "PCP factor" calculated for each peer. Most significant bit there is "power" since
> one who is AC powered is better candidate.
>
> Bottom line - this is to elect as P2P GO AC-powered one (if there is such peer).

Ok, so it's just a sort of priority bit. That's not bad.

--
Kalle Valo

2013-01-10 12:07:04

by Vladimir Kondratiev

[permalink] [raw]
Subject: Re: Q: how to update platform power state for the network driver

On Wednesday, January 09, 2013 07:20:06 PM Vladimir Kondratiev wrote:
> What is the best way to obtain this info in the network driver?
>

Found:

#include <linux/power_supply.h>
int power_supply_is_system_supplied(void);

returns:
positive if system is AC supplied,
0 if battery supplied
negative on error



2013-01-13 07:33:58

by Vladimir Kondratiev

[permalink] [raw]
Subject: Re: Q: how to update platform power state for the network driver

On Thursday, January 10, 2013 11:39:33 PM Kalle Valo wrote:
> Vladimir Kondratiev <[email protected]> writes:
>
> > in 60g spec (802.11ad, references to this doc.), station should set "power source" bit in the:
[skip]
>
> Scary! Just of curiosity, how is this bit supposed to be used in real life?
>

In 60g, you have new ah-hoc network type, PBSS, that should be used for P2P (spec mandates it)
In PBSS, there is AP-like entity called PCP. Instead of P2P GO negotiation, GO choosen before,
on lower layer, when selecting PCP. In this decision, "best suitable" candidate selected PCP,
based on "PCP factor" calculated for each peer. Most significant bit there is "power" since
one who is AC powered is better candidate.

Bottom line - this is to elect as P2P GO AC-powered one (if there is such peer).

Thanks, Vladimir

2013-01-10 21:39:36

by Kalle Valo

[permalink] [raw]
Subject: Re: Q: how to update platform power state for the network driver

Vladimir Kondratiev <[email protected]> writes:

> in 60g spec (802.11ad, references to this doc.), station should set "power source" bit in the:
>
> 8.4.2.130.3 DMG PCP/AP Capability Information field
>
> This information used to construct "PCP factor" that used in:
>
> 10.1.4.3.4 PCP selection in a PBSS
>
> This procedure replaces GO negotiation in P2P. "power source" bit above specified as:
>
> The Power Source field is set to 0 if the STA is battery powered, and is set to 1 otherwise.

Scary! Just of curiosity, how is this bit supposed to be used in real life?

--
Kalle Valo

2013-01-14 07:07:37

by Kalle Valo

[permalink] [raw]
Subject: Re: Q: how to update platform power state for the network driver

Julian Calaby <[email protected]> writes:

>> #include <linux/power_supply.h>
>> int power_supply_is_system_supplied(void);
>>
>> returns:
>> positive if system is AC supplied,
>> 0 if battery supplied
>> negative on error
>
> One minor point: you might want to add the ability to override this,
> even if it's only through debugfs so that people testing the code, or
> with unusual requirements can set this how they want / need it.

I'm also worried that this power_supply interface is not supported in
all platforms. Does anyone know how widely it's used?

--
Kalle Valo

2013-01-09 17:31:01

by Johannes Berg

[permalink] [raw]
Subject: Re: Q: how to update platform power state for the network driver

On Wed, 2013-01-09 at 19:20 +0200, Vladimir Kondratiev wrote:
> Hi,
>
> in 60g spec (802.11ad, references to this doc.), station should set "power source" bit in the:
>
> 8.4.2.130.3 DMG PCP/AP Capability Information field
>
> This information used to construct "PCP factor" that used in:
>
> 10.1.4.3.4 PCP selection in a PBSS
>
> This procedure replaces GO negotiation in P2P. "power source" bit above specified as:
>
> The Power Source field is set to 0 if the STA is battery powered, and is set to 1 otherwise.
>
> What is the best way to obtain this info in the network driver?

You can't really do that very well. Set it in wpa_supplicant according
to the configuration. It might even query the power source on a laptop,
but I suspect this is a somewhat different use case anyway.

johannes