Skip to contentSkip to conversation

mac80211: allow disabling 40MHz on 2.4GHz

PATCH In review Johannes Berg 3 participants 7 messages Dec 1, 2009 – Dec 2, 2009 mac80211

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 mac80211: allow disabling 40MHz on 2.4GHz

In some situations it is required that a system be configured with no support for 40 MHz channels in the 2.4 GHz band. Rather than imposing any such restrictions on everybody, allow configuration a system like that with a module parameter. It is writable at runtime but only takes effect at the time of the next association.

---
 net/mac80211/ieee80211_i.h |    2 ++
 net/mac80211/main.c        |    6 ++++++
 net/mac80211/mlme.c        |    6 ++++++
 net/mac80211/util.c        |   14 +++++++++++---
 4 files changed, 25 insertions(+), 3 deletions(-)
net/mac80211/mlme.c +6 -0
@@ -400,6 +400,12 @@ static void ieee80211_send_assoc(struct 
 
 		/* determine capability flags */
 
+		if (ieee80211_disable_40mhz_24ghz &&
+		    sband->band == IEEE80211_BAND_2GHZ) {
+			cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
+			cap &= ~IEEE80211_HT_CAP_SGI_40;
+		}
+
 		switch (ht_info->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
 		case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
 			if (flags & IEEE80211_CHAN_NO_HT40PLUS) {
net/mac80211/util.c +11 -3
@@ -908,16 +908,24 @@ int ieee80211_build_preq_ies(struct ieee
 	}
 
 	if (sband->ht_cap.ht_supported) {
-		__le16 tmp = cpu_to_le16(sband->ht_cap.cap);
+		u16 cap = sband->ht_cap.cap;
+		__le16 tmp;
+
+		if (ieee80211_disable_40mhz_24ghz &&
+		    sband->band == IEEE80211_BAND_2GHZ) {
+			cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
+			cap &= ~IEEE80211_HT_CAP_SGI_40;
+		}
 
 		*pos++ = WLAN_EID_HT_CAPABILITY;
 		*pos++ = sizeof(struct ieee80211_ht_cap);
 		memset(pos, 0, sizeof(struct ieee80211_ht_cap));
+		tmp = cpu_to_le16(cap);
 		memcpy(pos, &tmp, sizeof(u16));
 		pos += sizeof(u16);
-		/* TODO: needs a define here for << 2 */
 		*pos++ = sband->ht_cap.ampdu_factor |
-			 (sband->ht_cap.ampdu_density << 2);
+			 (sband->ht_cap.ampdu_density <<
+				IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT);
 		memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));
 		pos += sizeof(sband->ht_cap.mcs);
 		pos += 2 + 4 + 1; /* ext info, BF cap, antsel */
net/mac80211/ieee80211_i.h +2 -0
@@ -881,6 +881,8 @@ void ieee80211_bss_info_change_notify(st
 void ieee80211_configure_filter(struct ieee80211_local *local);
 u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
 
+extern bool ieee80211_disable_40mhz_24ghz;
+
 /* STA code */
 void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
 int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
net/mac80211/main.c +6 -0
@@ -33,6 +33,12 @@
 #include "cfg.h"
 #include "debugfs.h"
 
+
+bool ieee80211_disable_40mhz_24ghz;
+module_param(ieee80211_disable_40mhz_24ghz, bool, 0644);
+MODULE_PARM_DESC(ieee80211_disable_40mhz_24ghz,
+		 "Disable 40MHz support in the 2.4GHz band");
+
 void ieee80211_configure_filter(struct ieee80211_local *local)
 {
 	u64 mc;
#1 lore raw
Quoted 7 lines · Johannes Berg

In some situations it is required that a system be configured with no support for 40 MHz channels in the 2.4 GHz band. Rather than imposing any such restrictions on everybody, allow configuration a system like that with a module parameter. It is writable at runtime but only takes effect at the time of the next association.

That looks like a hack to me.

Maybe it should be treated like other CRDA flags? In fact, you can find this in dbparse.py in the wireless-regdb sources:

    # hole at bit 9. FIXME: Where is NO-HT40 defined?
    'NO-HT40':          1<<10,

However, there are no other references to NO-HT40 in the wireless-regdb or CRDA sources. I assume it's not implemented.

Signature · 2 lines
Regards,
Pavel Roskin
author maintainer
#2 lore raw
Quoted 11 lines · Pavel Roskin
Quoted 7 lines · Johannes Berg

In some situations it is required that a system be configured with no support for 40 MHz channels in the 2.4 GHz band. Rather than imposing any such restrictions on everybody, allow configuration a system like that with a module parameter. It is writable at runtime but only takes effect at the time of the next association.

That looks like a hack to me.

Quoted 8 lines

Maybe it should be treated like other CRDA flags? In fact, you can find this in dbparse.py in the wireless-regdb sources:

    # hole at bit 9. FIXME: Where is NO-HT40 defined?
    'NO-HT40':          1<<10,

However, there are no other references to NO-HT40 in the wireless-regdb or CRDA sources. I assume it's not implemented.

It's not a regulatory requirement, it's a coexistence requirement.

johannes

#3 lore raw
Quoted 15 lines · Johannes Berg
Quoted 14 lines · Pavel Roskin
Quoted 7 lines · Johannes Berg

In some situations it is required that a system be configured with no support for 40 MHz channels in the 2.4 GHz band. Rather than imposing any such restrictions on everybody, allow configuration a system like that with a module parameter. It is writable at runtime but only takes effect at the time of the next association.

That looks like a hack to me.

Maybe it should be treated like other CRDA flags?  In fact, you can find this in dbparse.py in the wireless-regdb sources:

Quoted 7 lines
Quoted 5 lines
    # hole at bit 9. FIXME: Where is NO-HT40 defined?
    'NO-HT40':          1<<10,

However, there are no other references to NO-HT40 in the wireless-regdb or CRDA sources.  I assume it's not implemented.

It's not a regulatory requirement, it's a coexistence requirement.

To extend this text a little more, me and Johannes had reviewed usage of a NO-HT40 flag for regulatory purposes a while back. It was used mainly on the old Atheros HAL regulatory code and upon a lot of review even with our own regulatory folks determined that in fact there was no specific rules about disallowing 40 MHz, but that when this was disallowed it can be implied by the frequency range not fitting a 40 MHz channel. This is currently computed dynamically now on cfg80211 and its results are outputed through the file:

/sys/kernel/debug/ieee80211/phy0/ht40allow_map

Countries that do not allow HT40 were working on allowing it anyway so as of now I don't think there are countries that disallow it unless its implied by the frequency ranges allowed.

Luis

#4 lore raw
Quoted 22 lines · Luis R. Rodriguez
Quoted 5 lines
Quoted 5 lines

That looks like a hack to me.

Maybe it should be treated like other CRDA flags? In fact, you can find this in dbparse.py in the wireless-regdb sources:

Quoted 7 lines
Quoted 5 lines
    # hole at bit 9. FIXME: Where is NO-HT40 defined?
    'NO-HT40':          1<<10,

However, there are no other references to NO-HT40 in the wireless-regdb or CRDA sources. I assume it's not implemented.

It's not a regulatory requirement, it's a coexistence requirement.

To extend this text a little more, me and Johannes had reviewed usage of a NO-HT40 flag for regulatory purposes a while back. It was used mainly on the old Atheros HAL regulatory code and upon a lot of review even with our own regulatory folks determined that in fact there was no specific rules about disallowing 40 MHz, but that when this was disallowed it can be implied by the frequency range not fitting a 40 MHz channel. This is currently computed dynamically now on cfg80211 and its results are outputed through the file:

Quoted 1 line

/sys/kernel/debug/ieee80211/phy0/ht40allow_map

OK, good to know.

Anyway, I think that using module parameters for any configuration creates a bad precedent. Disabling HT40 in the 2.4GHz band is a "fine tuning" compared to other settings. But there may be many other such "knobs" (e.g. ACK timeout), and if they all are controlled by mac80211 parameters, it would be a maintenance nightmare.

If module parameters are discourages for the drivers, mac80211 should be held to the same standard.

Signature · 2 lines
Regards,
Pavel Roskin
author maintainer
#5 lore raw
Quoted 5 lines · Pavel Roskin

Anyway, I think that using module parameters for any configuration creates a bad precedent. Disabling HT40 in the 2.4GHz band is a "fine tuning" compared to other settings. But there may be many other such "knobs" (e.g. ACK timeout), and if they all are controlled by mac80211 parameters, it would be a maintenance nightmare.

ACK timeout is a quite different knob. This particular setting is mostly required for some interoperability testing, but otherwise serves no real purpose since the AP can always disable 40 MHz anyway, and if it doesn't then it's very likely that somebody will use 40 MHz with the AP.

In this case, the real solution to the interoperability problem would be using the frequency broker, but that can hardly be implemented in a reasonable time frame.

However, the real problem lies with interoperability testing and certification with a system based around mac80211. In that case, the frequency broker does not help even if it were implemented.

As such, I believe using a module parameter for a rarely used setting is a good trade-off, there's no real need to set this on the fly, but it does sometimes need to be set on boot (which is much easier to achieve this way) -- yet most of the time, apart from building complete systems based on the software, nobody cares.

Now, you could make a point that it could be an out-of-tree patch for those systems that actually do require this type of interoperability testing and certification that requires this setting, but that is not very maintainable.

Quoted 2 lines

If module parameters are discourages for the drivers, mac80211 should be held to the same standard.

And I would argue that it is -- module parameters are still discouraged, that doesn't change with adding one. We currently have one in mac80211 to chose the rate control algorithm, but it too is a special case and ought to not be required.

I don't see this parameter as configuration like ack timeout or 10mhz channels or ... I think this parameter solves a systems integration issue, not a configuration issue.

johannes

#6 lore raw
Quoted 8 lines · Johannes Berg

And I would argue that it is -- module parameters are still discouraged, that doesn't change with adding one. We currently have one in mac80211 to chose the rate control algorithm, but it too is a special case and ought to not be required.

I don't see this parameter as configuration like ack timeout or 10mhz channels or ... I think this parameter solves a systems integration issue, not a configuration issue.

OK, fair enough.

Signature · 2 lines
Regards,
Pavel Roskin