2015-03-18 10:26:01

by Arend van Spriel

[permalink] [raw]
Subject: wiphy band information

Hi Johannes,

Is it ok to update the wiphy band information after registration. In
brcmfmac the firmware is queried to obtain the supported channels.
However, it returns the channels for the current country set in
firmware. So after probe/registration iw shows:

Frequencies:
* 2412 MHz [1] (20.0 dBm)
* 2417 MHz [2] (20.0 dBm)
* 2422 MHz [3] (20.0 dBm)
* 2427 MHz [4] (20.0 dBm)
* 2432 MHz [5] (20.0 dBm)
* 2437 MHz [6] (20.0 dBm)
* 2442 MHz [7] (20.0 dBm)
* 2447 MHz [8] (20.0 dBm)
* 2452 MHz [9] (20.0 dBm)
* 2457 MHz [10] (20.0 dBm)
* 2462 MHz [11] (20.0 dBm)

Recently, I added a .reg_notifier() callback to brcmfmac which will
propagate country setting to firmware. This gave a crash during scan
because ieee80211_get_channel() returned NULL for bss on freq 2472. I
added code to update the channel info upon changing country code, but
when I do that iw shows:

Frequencies:
* 2412 MHz [1] (0.0 dBm)
* 2417 MHz [2] (0.0 dBm)
* 2422 MHz [3] (0.0 dBm)
* 2427 MHz [4] (0.0 dBm)
* 2432 MHz [5] (0.0 dBm)
* 2437 MHz [6] (0.0 dBm)
* 2442 MHz [7] (0.0 dBm)
* 2447 MHz [8] (0.0 dBm)
* 2452 MHz [9] (0.0 dBm)
* 2457 MHz [10] (0.0 dBm)
* 2462 MHz [11] (0.0 dBm)
* 2467 MHz [12] (0.0 dBm)
* 2472 MHz [13] (0.0 dBm)

Looks fine apart from the power levels so it made me wonder if what I am
doing is allowed. Any opinion on this?

I assume the supported band info is intended to show what hardware can
do regardless of the configured country, but I have no way to pull that
info from the device.

Regards,
Arend


2015-03-18 19:18:44

by Johannes Berg

[permalink] [raw]
Subject: Re: wiphy band information

Hi Arend,

> Is it ok to update the wiphy band information after registration.

I believe this will cause issues.

> In
> brcmfmac the firmware is queried to obtain the supported channels.
> However, it returns the channels for the current country set in
> firmware. So after probe/registration iw shows:

> Looks fine apart from the power levels so it made me wonder if what I am
> doing is allowed. Any opinion on this?

I think the regulatory flags will also break, since some are
pre-processed during wiphy registration.

> I assume the supported band info is intended to show what hardware can
> do regardless of the configured country, but I have no way to pull that
> info from the device.

I'd recommend finding (and hard-coding) a superset of all the channels
that the hardware could supported, and then dynamically setting the
disabled flag on those channels that the (current) regulatory
information cannot do.

This is something that needs to be handled throughout the code since
regulatory information can already change, but adding/removing channels
is something I'd really recommend against.

johannes


2015-03-19 08:57:59

by Arik Nemtsov

[permalink] [raw]
Subject: Re: wiphy band information

On Wed, Mar 18, 2015 at 9:28 PM, Arend van Spriel <[email protected]> wrote:
> On 03/18/15 20:18, Johannes Berg wrote:
>>
>> Hi Arend,
>>
>>> Is it ok to update the wiphy band information after registration.
>>
>>
>> I believe this will cause issues.
>>
>>> In
>>> brcmfmac the firmware is queried to obtain the supported channels.
>>> However, it returns the channels for the current country set in
>>> firmware. So after probe/registration iw shows:
>>
>>
>>> Looks fine apart from the power levels so it made me wonder if what I am
>>> doing is allowed. Any opinion on this?
>>
>>
>> I think the regulatory flags will also break, since some are
>> pre-processed during wiphy registration.
>>
>>> I assume the supported band info is intended to show what hardware can
>>> do regardless of the configured country, but I have no way to pull that
>>> info from the device.
>>
>>
>> I'd recommend finding (and hard-coding) a superset of all the channels
>> that the hardware could supported, and then dynamically setting the
>> disabled flag on those channels that the (current) regulatory
>> information cannot do.
>
>
> Depending on your reply that was the plan.

btw, this is what's done in iwlwifi (iwlmvm) - all supported channels
are registered with regulatory flags=0. Later on when specific
countries are set, some channels are disabled/limited.

Arik

2015-03-18 19:29:03

by Arend van Spriel

[permalink] [raw]
Subject: Re: wiphy band information

On 03/18/15 20:18, Johannes Berg wrote:
> Hi Arend,
>
>> Is it ok to update the wiphy band information after registration.
>
> I believe this will cause issues.
>
>> In
>> brcmfmac the firmware is queried to obtain the supported channels.
>> However, it returns the channels for the current country set in
>> firmware. So after probe/registration iw shows:
>
>> Looks fine apart from the power levels so it made me wonder if what I am
>> doing is allowed. Any opinion on this?
>
> I think the regulatory flags will also break, since some are
> pre-processed during wiphy registration.
>
>> I assume the supported band info is intended to show what hardware can
>> do regardless of the configured country, but I have no way to pull that
>> info from the device.
>
> I'd recommend finding (and hard-coding) a superset of all the channels
> that the hardware could supported, and then dynamically setting the
> disabled flag on those channels that the (current) regulatory
> information cannot do.

Depending on your reply that was the plan.

> This is something that needs to be handled throughout the code since
> regulatory information can already change, but adding/removing channels
> is something I'd really recommend against.

I had my suspicions. Thanks.

Gr. AvS