Skip to contentSkip to conversation

wifi: cfg80211: don't apply HT flags to S1G channels

PATCH In review Lachlan Hodges 2 participants 6 messages Jan 13 – Jan 20 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: cfg80211: don't apply HT flags to S1G channels

HT flags don't really make sense when applied to S1G channels especially given the bandwidths both used for calculations and conveyed (i.e 20MHz). Similarly with the 80/160/..MHz channels, each bonded subchannel is validated individually within cfg80211_s1g_usable(), so the regulatory validation is similarly redundant. Additionally, usermode application output (such as iwinfo below) doesn't particularly make sense when enumerating S1G channels:

before:

925.500 MHz (Band: 900 MHz, Channel 47) [NO_HT40+, NO_HT40-, NO_16MHZ] 926.500 MHz (Band: 900 MHz, Channel 49) [NO_HT40+, NO_HT40-, NO_16MHZ] 927.500 MHz (Band: 900 MHz, Channel 51) [NO_HT40+, NO_HT40-, NO_16MHZ, NO_PRIMARY]

after:

925.500 MHz (Band: 900 MHz, Channel 47) [NO_16MHZ] 926.500 MHz (Band: 900 MHz, Channel 49) [NO_16MHZ] 927.500 MHz (Band: 900 MHz, Channel 51) [NO_16MHZ, NO_PRIMARY]

Don't process the S1G band when applying HT flags as both the regulatory component is redundant and the flags don't make sense for S1G channels.

---
 net/wireless/reg.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
net/wireless/reg.c +10 -1
index a8ab0ab22d90..6cbfa3b78311 100644
@@ -2332,8 +2332,17 @@ static void reg_process_ht_flags(struct wiphy *wiphy)
 	if (!wiphy)
 		return;
 
-	for (band = 0; band < NUM_NL80211_BANDS; band++)
+	for (band = 0; band < NUM_NL80211_BANDS; band++) {
+		/*
+		 * Don't apply HT flags to channels within the S1G band.
+		 * Each bonded channel will instead be validated individually
+		 * within cfg80211_s1g_usable().
+		 */
+		if (band == NL80211_BAND_S1GHZ)
+			continue;
+
 		reg_process_ht_flags_band(wiphy, wiphy->bands[band]);
+	}
 }
 
 static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev)
Signature · 1 line
2.43.0
#1 lore raw
Quoted 3 lines

925.500 MHz (Band: 900 MHz, Channel 47) [NO_HT40+, NO_HT40-, NO_16MHZ] 926.500 MHz (Band: 900 MHz, Channel 49) [NO_HT40+, NO_HT40-, NO_16MHZ] 927.500 MHz (Band: 900 MHz, Channel 51) [NO_HT40+, NO_HT40-, NO_16MHZ, NO_PRIMARY]

So something we have been thinking about while we test the implementation against usermode software such as OpenWRT, and not just hostapd,
is that we don't have an equivalent to the [HT40+/-] flags. Now while S1G obviously isn't HT and while this doesn't affect the actual regulatory behaviour as mentioned in this patch, the information conveyed is still very useful to usermode as usermode itself can restrict what's allowed.

However looking at the regdb, it appears that the notion of HT40-/+ is more or less a "cfg80211 specific" regulatory componenet where the adjacent 20 MHz channels are validated to check if bonding in that direction is allowed (please do correct me if I'm wrong) which is more or less equivalent to what's done for wider VHT channels and S1G channels as per this comment aswell:

/*
* TODO: What if there are only certain 80/160/80+80 MHz channels
* allowed by the driver, or only certain combinations?
* For 40 MHz the driver can set the NO_HT40 flags, but for
* 80/160 MHz and in particular 80+80 MHz this isn't really
* feasible and we only have NO_80MHZ/NO_160MHZ so far but
* no way to cover 80+80 MHz or more complex restrictions.
* Note that such restrictions also need to be advertised to
* userspace, for example for P2P channel selection.
*/

(13 years ago!! :-))

Playing around with some 5 GHz configurations in OpenWRT it appears that only so much information can be conveyed and indeed there are configurations that will be rejected by cfg80211 (or maybe hostapd in some cases, not sure). I suppose what I'm asking is - how much do we need to protect usermode from this? Do you feel it's worth including a flag that somewhat emulates NOHT40+/-? I know much of that logic is quite old and S1G is "modern" ... ?

--

Now on an unrelated note while I'm sending this email, we've sent a few additional fixups / cleanups over the last 2 months as we hope to have a driver submitted for review in the coming weeks. There's still 2 small fixes that need to be done within hwsim before we can send up our hostapd patchset but I will wait until we have at least kicked of the driver review process before sending them.

lachlan

maintainer
#2 lore raw
Quoted 11 lines · Lachlan Hodges
Quoted 3 lines

925.500 MHz (Band: 900 MHz, Channel 47) [NO_HT40+, NO_HT40-, NO_16MHZ] 926.500 MHz (Band: 900 MHz, Channel 49) [NO_HT40+, NO_HT40-, NO_16MHZ] 927.500 MHz (Band: 900 MHz, Channel 51) [NO_HT40+, NO_HT40-, NO_16MHZ, NO_PRIMARY]

So something we have been thinking about while we test the implementation against usermode software such as OpenWRT, and not just hostapd,
is that we don't have an equivalent to the [HT40+/-] flags. Now while S1G obviously isn't HT and while this doesn't affect the actual regulatory behaviour as mentioned in this patch, the information conveyed is still very useful to usermode as usermode itself can restrict what's allowed.

Quoted 4 lines

However looking at the regdb, it appears that the notion of HT40-/+ is more or less a "cfg80211 specific" regulatory componenet where the adjacent 20 MHz channels are validated to check if bonding in that direction is allowed (please do correct me if I'm wrong)

You're not strictly wrong, but it is additionally possible for self- managed regulatory devices to have these flags, and I believe it was used for early Intel devices in some cases where the firmware doesn't "like" non-standard HT40 configurations.

Quoted 6 lines

which is more or less equivalent to what's done
for wider VHT channels and S1G channels as per this comment aswell:

        /*
         * TODO: What if there are only certain 80/160/80+80 MHz channels
         * allowed by the driver, or only certain combinations?

Yes we've basically ignored this, in part because drivers tend to support non-standard configurations too. For 6 GHz we've restricted this to only standard configurations, see cfg80211_valid_center_freq(), and then we don't really need the flags...

So overall we don't really need the flags - 2.4 GHz has the HT40 flags, 5 GHz doesn't typically matter in practice, and 6 GHz we just always limit to the channelisation the spec says.

Quoted 9 lines
         *       For 40 MHz the driver can set the NO_HT40 flags, but for
         *       80/160 MHz and in particular 80+80 MHz this isn't really
         *       feasible and we only have NO_80MHZ/NO_160MHZ so far but
         *       no way to cover 80+80 MHz or more complex restrictions.
         *       Note that such restrictions also need to be advertised to
         *       userspace, for example for P2P channel selection.

         */

(13 years ago!! :-))

:)

Quoted 3 lines

Playing around with some 5 GHz configurations in OpenWRT it appears that only so much information can be conveyed and indeed there are configurations that will be rejected by cfg80211 (or maybe hostapd in some cases, not sure).

Really? Got an example, perhaps even with hostapd log to see how it's rejected? That clearly contradicts what I wrote above which I really did believe to be true until this moment ;-)

Quoted 4 lines

I
suppose what I'm asking is - how much do we need to protect usermode from this? Do you feel it's worth including a flag that somewhat emulates NOHT40+/-? I know much of that logic is quite old and S1G is "modern" ... ?

It's always nice to have userspace be aware of things, but I guess if it's a configuration that's statically known to be invalid, it wouldn't matter so much? But I don't think I've understood the S1G angle - are you talking about primary 1 MHz? Primary 2 MHz?

Quoted 8 lines

--

Now on an unrelated note while I'm sending this email, we've sent a few additional fixups / cleanups over the last 2 months as we hope to have a driver submitted for review in the coming weeks. There's still 2 small fixes that need to be done within hwsim before we can send up our hostapd patchset but I will wait until we have at least kicked of the driver review process before sending them.

Very cool! :)

We just posted a lot of hwsim changes for NAN - better send yours sooner rather than later ;-)

johannes

#3 lore raw
Quoted 7 lines
Quoted 3 lines

Playing around with some 5 GHz configurations in OpenWRT it appears that only so much information can be conveyed and indeed there are configurations that will be rejected by cfg80211 (or maybe hostapd in some cases, not sure).

Really? Got an example, perhaps even with hostapd log to see how it's rejected? That clearly contradicts what I wrote above which I really did believe to be true until this moment ;-)

Sorry, it is indeed cfg80211 that is not accepting the chandef configuration. Taking a look at the generated config:

country_code=AU
ieee80211d=1
ieee80211h=1
hw_mode=a
beacon_int=100
stationary_ap=1
channel=165
[...]
ieee80211n=1
ht_coex=0 ht_capab=[HT40+][LDPC][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][MAX-AMSDU-7935] ieee80211ac=1
vht_oper_chwidth=1
vht_oper_centr_freq_seg0_idx=171
[vht_caps..]
ieee80211ax=1
he_oper_chwidth=1
he_oper_centr_freq_seg0_idx=171

This is the result of selecting mode AX, channel 165 with a width of 80MHz. The GL-MT3000 using the mt76 driver with mt7915e driver (?)

cfg80211              299008  4 mt7915e,mt76_connac_lib,mt76,mac80211
compat                 12288  3 mt76,mac80211,cfg80211
mac80211              581632  3 mt7915e,mt76_connac_lib,mt76
mt76                   73728  2 mt7915e,mt76_connac_lib
mt76_connac_lib        45056  1 mt7915e

And for hostapd output (Sorry I don't have anything more verbose)

Tue Jan 20 04:10:43 2026 daemon.err hostapd: nl80211: kernel reports: (extension) channel is disabled Tue Jan 20 04:10:43 2026 daemon.err hostapd: Could not set channel for kernel driver Tue Jan 20 04:10:43 2026 daemon.err hostapd: Interface initialization failed

where _cfg80211_chandef_usable() is (rightfully) rejecting the configuration. This simply appears to be the logic to generate the config doesn't cover this case properly. Anyways, I don't think this is all that useful too be honest, it just comes down to ensuring the static configurations are known especially since this range is specified as AUTO-BW anyway as per the regdom.

Quoted 9 lines
Quoted 4 lines

I
suppose what I'm asking is - how much do we need to protect usermode from this? Do you feel it's worth including a flag that somewhat emulates NOHT40+/-? I know much of that logic is quite old and S1G is "modern" ... ?

It's always nice to have userspace be aware of things, but I guess if it's a configuration that's statically known to be invalid, it wouldn't matter so much? But I don't think I've understood the S1G angle - are you talking about primary 1 MHz? Primary 2 MHz?

Putting primaries aside and just thinking of operating - eventually we would need a NO_2MHZ flag as India for example only has 1MHz channels.. however this is well into the future .. we first need to add support for other countries :').

But yes as you said since these configurations are static it's not really a big deal and more up to userspace to be aware of it. I think what we have in cfg80211 now is good enough and seems to be working well when integrating into an actual userspace stack.

Quoted 11 lines
Quoted 6 lines

Now on an unrelated note while I'm sending this email, we've sent a few additional fixups / cleanups over the last 2 months as we hope to have a driver submitted for review in the coming weeks. There's still 2 small fixes that need to be done within hwsim before we can send up our hostapd patchset but I will wait until we have at least kicked of the driver review process before sending them.

Very cool! :)

We just posted a lot of hwsim changes for NAN - better send yours sooner rather than later ;-)

Yes I have seen, lots of Wi-Fi 8 documents aswell so I assume that will get busy soon too. Well see .. Lots to do!!

lachlan

maintainer
#4 lore raw
Quoted 9 lines · Lachlan Hodges
Quoted 7 lines
Quoted 3 lines

Playing around with some 5 GHz configurations in OpenWRT it appears that only so much information can be conveyed and indeed there are configurations that will be rejected by cfg80211 (or maybe hostapd in some cases, not sure).

Really? Got an example, perhaps even with hostapd log to see how it's rejected? That clearly contradicts what I wrote above which I really did believe to be true until this moment ;-)

Sorry, it is indeed cfg80211 that is not accepting the chandef configuration.

Maybe I still know something ;-)

Quoted 5 lines

channel=165

vht_oper_centr_freq_seg0_idx=171

This is the result of selecting mode AX, channel 165 with a width of 80MHz.

Well, I guess that could be done in some countries, U-NII-4 goes up to channel 177 inclusive? But not for Australia which only has up to 173 (according to Wikipedia, maybe it's changing, I didn't check better sources now.)

Quoted 11 lines

The GL-MT3000 using the mt76 driver with mt7915e driver (?)

cfg80211              299008  4 mt7915e,mt76_connac_lib,mt76,mac80211
compat                 12288  3 mt76,mac80211,cfg80211
mac80211              581632  3 mt7915e,mt76_connac_lib,mt76
mt76                   73728  2 mt7915e,mt76_connac_lib
mt76_connac_lib        45056  1 mt7915e

And for hostapd output (Sorry I don't have anything more verbose)

Tue Jan 20 04:10:43 2026 daemon.err hostapd: nl80211: kernel reports: (extension) channel is disabled

Right, makes sense, it's at least saying channel 177 doesn't exist or cannot be used, perhaps already on 169/173 depending on what the device knows about U-NII-4.

Quoted 6 lines

Tue Jan 20 04:10:43 2026 daemon.err hostapd: Could not set channel for kernel driver Tue Jan 20 04:10:43 2026 daemon.err hostapd: Interface initialization failed

where _cfg80211_chandef_usable() is (rightfully) rejecting the configuration. This simply appears to be the logic to generate the config doesn't cover this case properly.

Right.

Quoted 3 lines

Anyways, I don't think this is all that useful too be honest,
it just comes down to ensuring the static configurations are known especially since this range is specified as AUTO-BW anyway as per the regdom.

Yeah, or checking against the regulatory, or something ... but basically channel 165 + 80 MHz isn't _really_ possible then, since the channelization plan says then you should use 171 as it does now.

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

I
suppose what I'm asking is - how much do we need to protect usermode from this? Do you feel it's worth including a flag that somewhat emulates NOHT40+/-? I know much of that logic is quite old and S1G is "modern" ... ?

It's always nice to have userspace be aware of things, but I guess if it's a configuration that's statically known to be invalid, it wouldn't matter so much?

But I think in the case you describe above, userspace should well have been able to, at least in theory, predict that this would happen, based on the channel flags.

Quoted 7 lines
Quoted 2 lines

But I don't think I've understood the S1G angle - are you talking about primary 1 MHz? Primary 2 MHz?

Putting primaries aside and just thinking of operating - eventually we would need a NO_2MHZ flag as India for example only has 1MHz channels.. however this is well into the future .. we first need to add support for other countries :').

:)

Quoted 4 lines

But yes as you said since these configurations are static it's not really a big deal and more up to userspace to be aware of it. I think what we have in cfg80211 now is good enough and seems to be working well when integrating into an actual userspace stack.

OK, sounds good.

Quoted 5 lines
Quoted 2 lines

We just posted a lot of hwsim changes for NAN - better send yours sooner rather than later ;-)

Yes I have seen, lots of Wi-Fi 8 documents aswell so I assume that will get busy soon too. Well see .. Lots to do!!

I don't think hwsim will get too many wifi8 changes, but yeah there are a lot of things brewing now. Seems you (mostly?) got just ahead of it though, so it shouldn't be much of an issue, I'd think.

johannes

#5 lore raw
Quoted 10 lines
Quoted 5 lines

channel=165

vht_oper_centr_freq_seg0_idx=171

This is the result of selecting mode AX, channel 165 with a width of 80MHz.

Well, I guess that could be done in some countries, U-NII-4 goes up to channel 177 inclusive? But not for Australia which only has up to 173 (according to Wikipedia, maybe it's changing, I didn't check better sources now.)

Yea should've clarified that earlier.. kind of an important detail ^.^

Quoted 3 lines

I don't think hwsim will get too many wifi8 changes, but yeah there are a lot of things brewing now. Seems you (mostly?) got just ahead of it though, so it shouldn't be much of an issue, I'd think.

Yea I think we picked a good time to get the major stuff in, now I suppose it's just a driver .. and the fun challenge of getting S1G into hostapd ._.

lachlan