Search Linux Wireless

Re: [PATCH iw] add "channels" PHY command listing frequencies with more details

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 31 May 2016 at 17:58, Rafał Miłecki <zajec5@xxxxxxxxx> wrote:
> On 31 May 2016 at 15:14, Johannes Berg <johannes@xxxxxxxxxxxxxxxx> wrote:
>> On Tue, 2016-05-31 at 15:10 +0200, Rafał Miłecki wrote:
>>
>>> > Unfortunately, I get compiler warnings about width_* being possibly
>>> > used uninitialized. Can you address that please?
>>> It's nice your compiled got this mistake, my didn't. There were
>>> actually meant to be static. I'll fix that.
>>
>> I actually think the compiler is wrong, and there's no reason for them
>> to be static, is there?
>>
>> The first iteration of the loop should always initialize since -1 is
>> used for initialization?
>>
>> In any case, I'd prefer to avoid static, if necessary pass some kind of
>> context structure in to the function?
>
> I don't know if we can assume getting all three attributes:
> NL80211_BAND_ATTR_HT_CAPA
> NL80211_BAND_ATTR_VHT_CAPA
> NL80211_BAND_ATTR_FREQS
> at the same single handler call. I guess not. That's why I believe we
> need all width_* to be static, so they keep value across separated
> handler calls.

Yes, this is definitely the case. I did some debugging from user space
and printed one line per a single handler call:
[i:0] WIPHY_BANDS:0
[i:1] WIPHY_BANDS:0
[i:2] WIPHY_BANDS:0
[i:3] WIPHY_BANDS:1 ATTR_HT_CAPA:1 ATTR_VHT_CAPA:0 ATTR_FREQS:0
[i:4] WIPHY_BANDS:1 ATTR_HT_CAPA:1 ATTR_VHT_CAPA:1 ATTR_FREQS:0
[i:5] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
[i:6] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
[i:7] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
[i:8] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
[i:9] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
[i:10] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
[i:11] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
[i:12] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
[i:13] WIPHY_BANDS:1 ATTR_HT_CAPA:0 ATTR_VHT_CAPA:0 ATTR_FREQS:1
(...)

As you can see we have ATTR_HT_CAPA and ATTR_VHT_CAPA set only in few
early calls. It means we need to extract info from them and store it
in static variables.
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux