Skip to contentSkip to conversation

Use the regulatory bandwidth and export HT40 stuff

PATCH In review Luis R. Rodriguez 2 participants 14 messages Mar 19, 2009 – Mar 20, 2009

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover Use the regulatory bandwidth and export HT40 stuff

This took a little more consideration than I thought. This is a redesign of the bandwidth regulatory stuff, it also keeps in mind preferences in the future to use alternative bandwidths like 10 MHz and 5 MHz for things like 802.11p.

Ultimately you'll now get proper interpretation of the regulatory bandwidth supported, we'll export the bandwidth allowed per channel, and we'll also export the channel HT40-/+ capabilities -- if they are allowed or not.

This should also help considerably with testing regulatory settings. And for users planning to use HT40 it'll give you a direct guide which channels to pick on your AP.

This second series completely abandons our old strategy to use the channel bandwidth to determine whether or not we support HT40, instead we use it for to determine the supported actual bandwidth _per_channel_, not per channel set (the pair of channels on an HT40 configuration).

Luis R. Rodriguez (6):
cfg80211: Process regulatory max bandwidth checks for HT40
wireless: rename IEEE80211_CHAN_NO_FAT_* to HT40-/+
mac80211: check if HT40+/- is allowed before sending assoc
cfg80211: check allowed channel type upon userspace requests
cfg80211: send channel max bandwidth to userspace
cfg80211: send to userspace if HT40-/+ is allowed on each channel

 drivers/net/wireless/ath9k/regd.c         |   10 +-
 drivers/net/wireless/iwlwifi/iwl-core.c   |    4 +-
 drivers/net/wireless/iwlwifi/iwl-eeprom.c |    8 +-
 include/linux/nl80211.h                   |   18 +++
 include/net/wireless.h                    |   23 +++--
 net/mac80211/ht.c                         |   11 ++-
 net/mac80211/mlme.c                       |    4 +-
 net/wireless/nl80211.c                    |   27 ++++-
 net/wireless/reg.c                        |  194 ++++++++++++++++++++++------
 9 files changed, 234 insertions(+), 65 deletions(-)
#1 lore raw

PATCH v2 1/6 cfg80211: Process regulatory max bandwidth checks for HT40

We are not correctly listening to the regulatory max bandwidth settings. To actually make use of it we need to redesign things a bit. This patch does the work for that. We do this to so we can obey to regulatory rules accordingly for use of HT40.

We end up dealing with HT40 by having two passes for each channel.

The first check will see if a 20 MHz channel fits into the channel's center freq on a given frequency range. We check for a 20 MHz banwidth channel as that is the maximum an individual channel will use, at least for now. The first pass will go ahead and check if the regulatory rule for that given center of frequency allows 40 MHz bandwidths and we use this to determine whether or not the channel supports HT40 or not. So to support HT40 you'll need at a regulatory rule that allows you to use 40 MHz channels but you're channel must also be enabled and support 20 MHz by itself.

The second pass is done after we do the regulatory checks over an device's supported channel list. On each channel we'll check if the control channel and the extension both:

o exist
o are enabled
o regulatory allows 40 MHz bandwidth on its frequency range

This work allows allows us to idependently check for HT40- and HT40+.

---
 drivers/net/wireless/ath9k/regd.c |   10 +-
 include/net/wireless.h            |   15 ++-
 net/wireless/reg.c                |  194 +++++++++++++++++++++++++++++--------
 3 files changed, 169 insertions(+), 50 deletions(-)
drivers/net/wireless/ath9k/regd.c +6 -4
index 4ca6251..db42198 100644
@@ -196,8 +196,10 @@ static void ath9k_reg_apply_beaconing_flags(
 				continue;
 
 			if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE) {
-				r = freq_reg_info(wiphy, ch->center_freq,
-					&bandwidth, &reg_rule);
+				r = freq_reg_info(wiphy,
+						  ch->center_freq,
+						  bandwidth,
+						  &reg_rule);
 				if (r)
 					continue;
 				/*
@@ -261,7 +263,7 @@ static void ath9k_reg_apply_active_scan_flags(
 	 */
 
 	ch = &sband->channels[11]; /* CH 12 */
-	r = freq_reg_info(wiphy, ch->center_freq, &bandwidth, &reg_rule);
+	r = freq_reg_info(wiphy, ch->center_freq, bandwidth, &reg_rule);
 	if (!r) {
 		if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN))
 			if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN)
@@ -269,7 +271,7 @@ static void ath9k_reg_apply_active_scan_flags(
 	}
 
 	ch = &sband->channels[12]; /* CH 13 */
-	r = freq_reg_info(wiphy, ch->center_freq, &bandwidth, &reg_rule);
+	r = freq_reg_info(wiphy, ch->center_freq, bandwidth, &reg_rule);
 	if (!r) {
 		if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN))
 			if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN)
include/net/wireless.h +11 -4
index 64a7620..e3077e1 100644
@@ -44,6 +44,9 @@ enum ieee80211_band {
  * 	is not permitted.
  * @IEEE80211_CHAN_NO_FAT_BELOW: extension channel below this channel
  * 	is not permitted.
+ * @IEEE80211_CHAN_NO_HT40: indicates no HT40 is allowed at all,
+ * 	when this is set %IEEE80211_CHAN_NO_FAT_ABOVE and
+ * 	%IEEE80211_CHAN_NO_FAT_BELOW will also be set.
  */
 enum ieee80211_channel_flags {
 	IEEE80211_CHAN_DISABLED		= 1<<0,
@@ -52,6 +55,7 @@ enum ieee80211_channel_flags {
 	IEEE80211_CHAN_RADAR		= 1<<3,
 	IEEE80211_CHAN_NO_FAT_ABOVE	= 1<<4,
 	IEEE80211_CHAN_NO_FAT_BELOW	= 1<<5,
+	IEEE80211_CHAN_NO_HT40		= 1<<6,
 };
 
 /**
@@ -449,9 +453,10 @@ extern void wiphy_apply_custom_regulatory(
  * freq_reg_info - get regulatory information for the given frequency
  * @wiphy: the wiphy for which we want to process this rule for
  * @center_freq: Frequency in KHz for which we want regulatory information for
- * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one
- * 	you can set this to 0. If this frequency is allowed we then set
- * 	this value to the maximum allowed bandwidth.
+ * @desired_bw_khz: the desired max bandwidth you want to use per
+ * 	channel. Note that this is still 20 MHz if you want to use HT40
+ * 	as HT40 makes use of two channels for its 40 MHz width bandwidth.
+ * 	If set to 0 we'll assume you want the standard 20 MHz.
  * @reg_rule: the regulatory rule which we have for this frequency
  *
  * Use this function to get the regulatory rule for a specific frequency on
@@ -466,7 +471,9 @@ extern void wiphy_apply_custom_regulatory(
  * freq_in_rule_band() for our current definition of a band -- this is purely
  * subjective and right now its 802.11 specific.
  */
-extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth,
+extern int freq_reg_info(struct wiphy *wiphy,
+			 u32 center_freq,
+			 u32 desired_bw_khz,
 			 const struct ieee80211_reg_rule **reg_rule);
 
 #endif /* __NET_WIRELESS_H */
net/wireless/reg.c +152 -42

306 lines not on this page · raw message

Signature · 1 line
1.6.0.6
#2 lore raw

PATCH v2 2/6 wireless: rename IEEE80211_CHAN_NO_FAT_* to HT40-/+

In reply to Luis R. Rodriguez

This is more consistent with our nl80211 stuff.

---
 drivers/net/wireless/iwlwifi/iwl-core.c   |    4 ++--
 drivers/net/wireless/iwlwifi/iwl-eeprom.c |    8 ++++----
 include/net/wireless.h                    |   12 ++++++------
 net/mac80211/mlme.c                       |    4 ++--
 net/wireless/reg.c                        |   16 ++++++++--------
 5 files changed, 22 insertions(+), 22 deletions(-)
drivers/net/wireless/iwlwifi/iwl-core.c +2 -2
index 085e9cf..0871efe 100644
@@ -591,10 +591,10 @@ static u8 iwl_is_channel_extension(struct iwl_priv *priv,
 
 	if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_ABOVE)
 		return !(ch_info->fat_extension_channel &
-					IEEE80211_CHAN_NO_FAT_ABOVE);
+					IEEE80211_CHAN_NO_HT40PLUS);
 	else if (extension_chan_offset == IEEE80211_HT_PARAM_CHA_SEC_BELOW)
 		return !(ch_info->fat_extension_channel &
-					IEEE80211_CHAN_NO_FAT_BELOW);
+					IEEE80211_CHAN_NO_HT40MINUS);
 
 	return 0;
 }
drivers/net/wireless/iwlwifi/iwl-eeprom.c +4 -4
index 75517d0..9d73f19 100644
@@ -481,8 +481,8 @@ int iwl_init_channel_map(struct iwl_priv *priv)
 			/* First write that fat is not enabled, and then enable
 			 * one by one */
 			ch_info->fat_extension_channel =
-				(IEEE80211_CHAN_NO_FAT_ABOVE |
-				 IEEE80211_CHAN_NO_FAT_BELOW);
+				(IEEE80211_CHAN_NO_HT40PLUS |
+				 IEEE80211_CHAN_NO_HT40MINUS);
 
 			if (!(is_channel_valid(ch_info))) {
 				IWL_DEBUG_INFO(priv, "Ch. %d Flags %x [%sGHz] - "
@@ -561,7 +561,7 @@ int iwl_init_channel_map(struct iwl_priv *priv)
 				fat_extension_chan = 0;
 			else
 				fat_extension_chan =
-					IEEE80211_CHAN_NO_FAT_BELOW;
+					IEEE80211_CHAN_NO_HT40MINUS;
 
 			/* Set up driver's info for lower half */
 			iwl_set_fat_chan_info(priv, ieeeband,
@@ -573,7 +573,7 @@ int iwl_init_channel_map(struct iwl_priv *priv)
 			iwl_set_fat_chan_info(priv, ieeeband,
 						(eeprom_ch_index[ch] + 4),
 						&(eeprom_ch_info[ch]),
-						IEEE80211_CHAN_NO_FAT_ABOVE);
+						IEEE80211_CHAN_NO_HT40PLUS);
 		}
 	}
 
include/net/wireless.h +6 -6
index e3077e1..0331d26 100644
@@ -40,21 +40,21 @@ enum ieee80211_band {
  *	on this channel.
  * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
  * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
- * @IEEE80211_CHAN_NO_FAT_ABOVE: extension channel above this channel
+ * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
  * 	is not permitted.
- * @IEEE80211_CHAN_NO_FAT_BELOW: extension channel below this channel
+ * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
  * 	is not permitted.
  * @IEEE80211_CHAN_NO_HT40: indicates no HT40 is allowed at all,
- * 	when this is set %IEEE80211_CHAN_NO_FAT_ABOVE and
- * 	%IEEE80211_CHAN_NO_FAT_BELOW will also be set.
+ * 	when this is set %IEEE80211_CHAN_NO_HT40PLUS and
+ * 	%IEEE80211_CHAN_NO_HT40MINUS will also be set.
  */
 enum ieee80211_channel_flags {
 	IEEE80211_CHAN_DISABLED		= 1<<0,
 	IEEE80211_CHAN_PASSIVE_SCAN	= 1<<1,
 	IEEE80211_CHAN_NO_IBSS		= 1<<2,
 	IEEE80211_CHAN_RADAR		= 1<<3,
-	IEEE80211_CHAN_NO_FAT_ABOVE	= 1<<4,
-	IEEE80211_CHAN_NO_FAT_BELOW	= 1<<5,
+	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
+	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
 	IEEE80211_CHAN_NO_HT40		= 1<<6,
 };
 
net/mac80211/mlme.c +2 -2
index a558796..9543eea 100644
@@ -278,13 +278,13 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata)
 
 		switch (ht_info->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
 		case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
-			if (flags & IEEE80211_CHAN_NO_FAT_ABOVE) {
+			if (flags & IEEE80211_CHAN_NO_HT40PLUS) {
 				cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
 				cap &= ~IEEE80211_HT_CAP_SGI_40;
 			}
 			break;
 		case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
-			if (flags & IEEE80211_CHAN_NO_FAT_BELOW) {
+			if (flags & IEEE80211_CHAN_NO_HT40MINUS) {
 				cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40;
 				cap &= ~IEEE80211_HT_CAP_SGI_40;
 			}
net/wireless/reg.c +8 -8
index 29646b6..b4c002f 100644
@@ -1178,8 +1178,8 @@ static void reg_process_ht_flags_channel(struct wiphy *wiphy,
 
 	if (channel->flags &
 	    (IEEE80211_CHAN_DISABLED | IEEE80211_CHAN_NO_HT40)) {
-		channel->flags |= IEEE80211_CHAN_NO_FAT_ABOVE |
-				  IEEE80211_CHAN_NO_FAT_BELOW;
+		channel->flags |= IEEE80211_CHAN_NO_HT40PLUS |
+				  IEEE80211_CHAN_NO_HT40MINUS;
 		return;
 	}
 
@@ -1202,15 +1202,15 @@ static void reg_process_ht_flags_channel(struct wiphy *wiphy,
 	 */
 	if (!channel_before || (channel_before->flags &
 	    (IEEE80211_CHAN_DISABLED | IEEE80211_CHAN_NO_HT40)))
-		channel->flags |= IEEE80211_CHAN_NO_FAT_BELOW;
+		channel->flags |= IEEE80211_CHAN_NO_HT40MINUS;
 	else
-		channel->flags &= ~IEEE80211_CHAN_NO_FAT_BELOW;
+		channel->flags &= ~IEEE80211_CHAN_NO_HT40MINUS;
 
 	if (!channel_after || (channel_after->flags &
 	    (IEEE80211_CHAN_DISABLED | IEEE80211_CHAN_NO_HT40)))
-		channel->flags |= IEEE80211_CHAN_NO_FAT_ABOVE;
+		channel->flags |= IEEE80211_CHAN_NO_HT40PLUS;
 	else
-		channel->flags &= ~IEEE80211_CHAN_NO_FAT_ABOVE;
+		channel->flags &= ~IEEE80211_CHAN_NO_HT40PLUS;
 }
 
 static void reg_process_ht_flags_band(struct wiphy *wiphy,
@@ -1292,8 +1292,8 @@ static void handle_channel_custom(struct wiphy *wiphy,
 
 	if (freq_range->max_bandwidth_khz < MHZ_TO_KHZ(40))
 		bw_flags = IEEE80211_CHAN_NO_HT40 |
-			   IEEE80211_CHAN_NO_FAT_BELOW |
-			   IEEE80211_CHAN_NO_FAT_ABOVE;
+			   IEEE80211_CHAN_NO_HT40MINUS |
+			   IEEE80211_CHAN_NO_HT40PLUS;
 
 	chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags;
 	chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain);
Signature · 1 line
1.6.0.6
#3 lore raw

PATCH v2 3/6 mac80211: check if HT40+/- is allowed before sending assoc

In reply to Luis R. Rodriguez

We weren't checking this at all.

---
 net/mac80211/ht.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
net/mac80211/ht.c +9 -2
index 4e3c72f..01010e0 100644
@@ -114,6 +114,9 @@ u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
 	    ieee80211_channel_to_frequency(hti->control_chan))
 		enable_ht = false;
 
+	if (local->hw.conf.channel->flags & IEEE80211_CHAN_NO_HT40)
+		enable_ht = false;
+
 	if (enable_ht) {
 		channel_type = NL80211_CHAN_HT20;
 
@@ -122,10 +125,14 @@ u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
 		    (hti->ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) {
 			switch(hti->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
 			case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
-				channel_type = NL80211_CHAN_HT40PLUS;
+				if (local->hw.conf.channel->flags &
+				    IEEE80211_CHAN_NO_HT40PLUS)
+					channel_type = NL80211_CHAN_HT40PLUS;
 				break;
 			case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
-				channel_type = NL80211_CHAN_HT40MINUS;
+				if (local->hw.conf.channel->flags &
+				    IEEE80211_CHAN_NO_HT40MINUS)
+					channel_type = NL80211_CHAN_HT40MINUS;
 				break;
 			}
 		}
Signature · 1 line
1.6.0.6
#4 lore raw

PATCH v2 4/6 cfg80211: check allowed channel type upon userspace requests

In reply to Luis R. Rodriguez

Thanks to nl80211 userspace can be verify specific upon device configuration. Before processing the request for the new HT40 channel types (HT40- or HT40+) we need to ensure we can use them regulatory-wise. This wasn't required with wireless extensions as specifying the channel type wasn't not available and configuration was done towards the end implicitly upon association or reception of beacons from the AP. For the new nl80211 we have to check this when configuring the interfaces explicitly.

---
 net/wireless/nl80211.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
net/wireless/nl80211.c +18 -0
index 53fe209..e03c9a2 100644
@@ -426,6 +426,24 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
 		if (!chan || chan->flags & IEEE80211_CHAN_DISABLED)
 			goto bad_res;
 
+		if (channel_type == NL80211_CHAN_HT40MINUS ||
+		    channel_type == NL80211_CHAN_HT40PLUS)
+			if (chan->flags & IEEE80211_CHAN_NO_HT40)
+				goto bad_res;
+
+		if (channel_type == NL80211_CHAN_HT40MINUS &&
+		    (chan->flags & IEEE80211_CHAN_NO_HT40MINUS))
+			goto bad_res;
+		else if (channel_type == NL80211_CHAN_HT40PLUS &&
+			 (chan->flags & IEEE80211_CHAN_NO_HT40PLUS))
+			goto bad_res;
+
+		/*
+		 * At this point we know if that if HT40 was requested
+		 * we are allowed to use it and the extension channel
+		 * exists.
+		 */
+
 		if (channel_type == NL80211_CHAN_HT40MINUS)
 			sec_freq = freq - 20;
 		else if (channel_type == NL80211_CHAN_HT40PLUS)
Signature · 1 line
1.6.0.6
maintainer
#5 lore raw

Re: [PATCH v2 4/6] cfg80211: check allowed channel type upon userspace requests

Quoted 16 lines · Luis R. Rodriguez

Thanks to nl80211 userspace can be verify specific upon device configuration. Before processing the request for the new HT40 channel types (HT40- or HT40+) we need to ensure we can use them regulatory-wise. This wasn't required with wireless extensions as specifying the channel type wasn't not available and configuration was done towards the end implicitly upon association or reception of beacons from the AP. For the new nl80211 we have to check this when configuring the interfaces explicitly.

net/wireless/nl80211.c +6 -0
+		if (channel_type == NL80211_CHAN_HT40MINUS &&
+		    (chan->flags & IEEE80211_CHAN_NO_HT40MINUS))
+			goto bad_res;
+		else if (channel_type == NL80211_CHAN_HT40PLUS &&
+			 (chan->flags & IEEE80211_CHAN_NO_HT40PLUS))
+			goto bad_res;

net/wireless/nl80211.c static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) · line 449

Quoted 10 lines
net/wireless/nl80211.c +7 -0
+
+		/*
+		 * At this point we know if that if HT40 was requested
+		 * we are allowed to use it and the extension channel
+		 * exists.
+		 */
+
 		if (channel_type == NL80211_CHAN_HT40MINUS)
 			sec_freq = freq - 20;
 		else if (channel_type == NL80211_CHAN_HT40PLUS)

These checks are _already_ there. That's what I mean with duplicate information ;)

I'm working on a replacement, and it's looking nice so far.

johannes

#6 lore raw

PATCH v2 5/6 cfg80211: send channel max bandwidth to userspace

In reply to Luis R. Rodriguez
---
 include/linux/nl80211.h |    3 +++
 net/wireless/nl80211.c  |    3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)
include/linux/nl80211.h +3 -0
index 3700d92..3924fe4 100644
@@ -670,6 +670,7 @@ enum nl80211_band_attr {
  *	on this channel in current regulatory domain.
  * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm
  *	(100 * dBm).
+ * @NL80211_FREQUENCY_ATTR_MAX_BANDWIDTH: max bandwidth allowed, given in MHz
  */
 enum nl80211_frequency_attr {
 	__NL80211_FREQUENCY_ATTR_INVALID,
@@ -679,6 +680,7 @@ enum nl80211_frequency_attr {
 	NL80211_FREQUENCY_ATTR_NO_IBSS,
 	NL80211_FREQUENCY_ATTR_RADAR,
 	NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
+	NL80211_FREQUENCY_ATTR_MAX_BANDWIDTH,
 
 	/* keep last */
 	__NL80211_FREQUENCY_ATTR_AFTER_LAST,
@@ -686,6 +688,7 @@ enum nl80211_frequency_attr {
 };
 
 #define NL80211_FREQUENCY_ATTR_MAX_TX_POWER NL80211_FREQUENCY_ATTR_MAX_TX_POWER
+#define NL80211_FREQUENCY_ATTR_MAX_BANDWIDTH NL80211_FREQUENCY_ATTR_MAX_BANDWIDTH
 
 /**
  * enum nl80211_bitrate_attr - bitrate attributes
net/wireless/nl80211.c +2 -1
index e03c9a2..e2727ee 100644
@@ -208,9 +208,10 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
 				NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_NO_IBSS);
 			if (chan->flags & IEEE80211_CHAN_RADAR)
 				NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_RADAR);
-
 			NLA_PUT_U32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
 				    DBM_TO_MBM(chan->max_power));
+			NLA_PUT_U32(msg, NL80211_FREQUENCY_ATTR_MAX_BANDWIDTH,
+				    chan->max_bandwidth);
 
 			nla_nest_end(msg, nl_freq);
 		}
Signature · 1 line
1.6.0.6
#7 lore raw

PATCH v2 6/6 cfg80211: send to userspace if HT40-/+ is allowed on each channel

In reply to Luis R. Rodriguez
---
 include/linux/nl80211.h |   15 +++++++++++++++
 net/wireless/nl80211.c  |    6 ++++++
 2 files changed, 21 insertions(+), 0 deletions(-)
include/linux/nl80211.h +15 -0
index 3924fe4..f00ebff 100644
@@ -671,6 +671,15 @@ enum nl80211_band_attr {
  * @NL80211_FREQUENCY_ATTR_MAX_TX_POWER: Maximum transmission power in mBm
  *	(100 * dBm).
  * @NL80211_FREQUENCY_ATTR_MAX_BANDWIDTH: max bandwidth allowed, given in MHz
+ * @NL80211_FREQUENCY_ATTR_NOHT40: HT40 operation is not permitted on
+ * 	this channel, this is would indicate the regulatory domain did
+ * 	not allow for HT40 operation.
+ * @NL80211_FREQUENCY_ATTR_NO_HT40MINUS: HT40- operation is not permitted on
+ * 	this channel. This could be due to regulatory domain restrictions or
+ * 	when the channel is on a band edge, towards the beginning.
+ * @NL80211_FREQUENCY_ATTR_NO_HT40PLUS: HT40+ operation is not permitted on
+ * 	this channel. This could be due to regulatory domain restrictions or
+ * 	when the channel is on a band edge, towards the end.
  */
 enum nl80211_frequency_attr {
 	__NL80211_FREQUENCY_ATTR_INVALID,
@@ -681,6 +690,9 @@ enum nl80211_frequency_attr {
 	NL80211_FREQUENCY_ATTR_RADAR,
 	NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
 	NL80211_FREQUENCY_ATTR_MAX_BANDWIDTH,
+	NL80211_FREQUENCY_ATTR_NO_HT40,
+	NL80211_FREQUENCY_ATTR_NO_HT40MINUS,
+	NL80211_FREQUENCY_ATTR_NO_HT40PLUS,
 
 	/* keep last */
 	__NL80211_FREQUENCY_ATTR_AFTER_LAST,
@@ -689,6 +701,9 @@ enum nl80211_frequency_attr {
 
 #define NL80211_FREQUENCY_ATTR_MAX_TX_POWER NL80211_FREQUENCY_ATTR_MAX_TX_POWER
 #define NL80211_FREQUENCY_ATTR_MAX_BANDWIDTH NL80211_FREQUENCY_ATTR_MAX_BANDWIDTH
+#define NL80211_FREQUENCY_ATTR_NO_HT40 NL80211_FREQUENCY_ATTR_NO_HT40
+#define NL80211_FREQUENCY_ATTR_NO_HT40MINUS NL80211_FREQUENCY_ATTR_NO_HT40MINUS
+#define NL80211_FREQUENCY_ATTR_NO_HT40PLUS NL80211_FREQUENCY_ATTR_NO_HT40PLUS
 
 /**
  * enum nl80211_bitrate_attr - bitrate attributes
net/wireless/nl80211.c +6 -0
index e2727ee..108e1ee 100644
@@ -208,6 +208,12 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
 				NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_NO_IBSS);
 			if (chan->flags & IEEE80211_CHAN_RADAR)
 				NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_RADAR);
+			if (chan->flags & IEEE80211_CHAN_NO_HT40)
+				NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_NO_HT40);
+			if (chan->flags & IEEE80211_CHAN_NO_HT40MINUS)
+				NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_NO_HT40MINUS);
+			if (chan->flags & IEEE80211_CHAN_NO_HT40PLUS)
+				NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_NO_HT40PLUS);
 			NLA_PUT_U32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
 				    DBM_TO_MBM(chan->max_power));
 			NLA_PUT_U32(msg, NL80211_FREQUENCY_ATTR_MAX_BANDWIDTH,
Signature · 1 line
1.6.0.6
maintainer
#8 lore raw
In reply to Luis R. Rodriguez

John,

please back out this series, I'm not sure I agree with the concept and I'm sure there are potential bugs that can make it segfault.

johannes

Quoted 39 lines · Luis R. Rodriguez

This took a little more consideration than I thought. This is a redesign of the bandwidth regulatory stuff, it also keeps in mind preferences in the future to use alternative bandwidths like 10 MHz and 5 MHz for things like 802.11p.

Ultimately you'll now get proper interpretation of the regulatory bandwidth supported, we'll export the bandwidth allowed per channel, and we'll also export the channel HT40-/+ capabilities -- if they are allowed or not.

This should also help considerably with testing regulatory settings. And for users planning to use HT40 it'll give you a direct guide which channels to pick on your AP.

This second series completely abandons our old strategy to use the channel bandwidth to determine whether or not we support HT40, instead we use it for to determine the supported actual bandwidth _per_channel_, not per channel set (the pair of channels on an HT40 configuration).

Luis R. Rodriguez (6):
cfg80211: Process regulatory max bandwidth checks for HT40
wireless: rename IEEE80211_CHAN_NO_FAT_* to HT40-/+
mac80211: check if HT40+/- is allowed before sending assoc
cfg80211: check allowed channel type upon userspace requests
cfg80211: send channel max bandwidth to userspace
cfg80211: send to userspace if HT40-/+ is allowed on each channel

 drivers/net/wireless/ath9k/regd.c         |   10 +-
 drivers/net/wireless/iwlwifi/iwl-core.c   |    4 +-
 drivers/net/wireless/iwlwifi/iwl-eeprom.c |    8 +-
 include/linux/nl80211.h                   |   18 +++
 include/net/wireless.h                    |   23 +++--
 net/mac80211/ht.c                         |   11 ++-
 net/mac80211/mlme.c                       |    4 +-
 net/wireless/nl80211.c                    |   27 ++++-
 net/wireless/reg.c                        |  194 ++++++++++++++++++++++------
 9 files changed, 234 insertions(+), 65 deletions(-)
#9 lore raw
Quoted 4 lines · Johannes Berg

John,

please back out this series, I'm not sure I agree with the concept and I'm sure there are potential bugs that can make it segfault.

Can you be more elaborate?

Luis

maintainer
#10 lore raw
Quoted 8 lines · Luis R. Rodriguez
Quoted 4 lines · Johannes Berg

John,

please back out this series, I'm not sure I agree with the concept and I'm sure there are potential bugs that can make it segfault.

Can you be more elaborate?

reg_process_ht_flags_channel doesn't initialise channel_before and channel_after.

johannes

#11 lore raw
Quoted 5 lines · Johannes Berg
Quoted 4 lines · Luis R. Rodriguez
Quoted 2 lines · Johannes Berg

John,

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

please back out this series, I'm not sure I agree with the concept and I'm sure there are potential bugs that can make it segfault.

Can you be more elaborate?

reg_process_ht_flags_channel doesn't initialise channel_before and channel_after.

I can fix that, two lines.

Luis

maintainer
#12 lore raw
Quoted 9 lines · Luis R. Rodriguez
Quoted 8 lines · Johannes Berg
Quoted 7 lines · Luis R. Rodriguez
Quoted 4 lines · Johannes Berg

John,

please back out this series, I'm not sure I agree with the concept and I'm sure there are potential bugs that can make it segfault.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Can you be more elaborate?

reg_process_ht_flags_channel doesn't initialise channel_before and channel_after.

I can fix that, two lines.

I know, but I wouldn't want having bug reports from this code until John gets to merging again :)

johannes

#13 lore raw
Quoted 12 lines · Johannes Berg
Quoted 11 lines · Luis R. Rodriguez
Quoted 10 lines · Johannes Berg
Quoted 8 lines · Luis R. Rodriguez
Quoted 4 lines · Johannes Berg

John,

please back out this series, I'm not sure I agree with the concept and I'm sure there are potential bugs that can make it segfault.

Can you be more elaborate?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

reg_process_ht_flags_channel doesn't initialise channel_before and channel_after.

I can fix that, two lines.

I know, but I wouldn't want having bug reports from this code until John gets to merging again :)

Absolutely.

Luis