All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff
@ 2009-03-19  5:54 Luis R. Rodriguez
  2009-03-19  5:54 ` [PATCH v2 1/6] cfg80211: Process regulatory max bandwidth checks for HT40 Luis R. Rodriguez
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Luis R. Rodriguez @ 2009-03-19  5:54 UTC (permalink / raw)
  To: johannes, linville; +Cc: linux-wireless, 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(-)


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2 1/6] cfg80211: Process regulatory max bandwidth checks for HT40
  2009-03-19  5:54 [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff Luis R. Rodriguez
@ 2009-03-19  5:54 ` Luis R. Rodriguez
  2009-03-19  5:54 ` [PATCH v2 2/6] wireless: rename IEEE80211_CHAN_NO_FAT_* to HT40-/+ Luis R. Rodriguez
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Luis R. Rodriguez @ 2009-03-19  5:54 UTC (permalink / raw)
  To: johannes, linville; +Cc: linux-wireless, Luis R. Rodriguez

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+.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 drivers/net/wireless/ath9k/regd.c |   10 +-
 include/net/wireless.h            |   15 ++-
 net/wireless/reg.c                |  194 +++++++++++++++++++++++++++++--------
 3 files changed, 169 insertions(+), 50 deletions(-)

diff --git a/drivers/net/wireless/ath9k/regd.c b/drivers/net/wireless/ath9k/regd.c
index 4ca6251..db42198 100644
--- a/drivers/net/wireless/ath9k/regd.c
+++ b/drivers/net/wireless/ath9k/regd.c
@@ -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)
diff --git a/include/net/wireless.h b/include/net/wireless.h
index 64a7620..e3077e1 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -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 */
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index eb8b8ed..29646b6 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -49,12 +49,6 @@ static struct regulatory_request *last_request;
 /* To trigger userspace events */
 static struct platform_device *reg_pdev;
 
-/* Keep the ordering from large to small */
-static u32 supported_bandwidths[] = {
-	MHZ_TO_KHZ(40),
-	MHZ_TO_KHZ(20),
-};
-
 /*
  * Central wireless core regulatory domains, we only need two,
  * the current one and a world regulatory domain in case we have no
@@ -431,19 +425,20 @@ static bool is_valid_rd(const struct ieee80211_regdomain *rd)
 	return true;
 }
 
-/* Returns value in KHz */
-static u32 freq_max_bandwidth(const struct ieee80211_freq_range *freq_range,
-	u32 freq)
+static bool reg_does_bw_fit(const struct ieee80211_freq_range *freq_range,
+			    u32 center_freq_khz,
+			    u32 bw_khz)
 {
-	unsigned int i;
-	for (i = 0; i < ARRAY_SIZE(supported_bandwidths); i++) {
-		u32 start_freq_khz = freq - supported_bandwidths[i]/2;
-		u32 end_freq_khz = freq + supported_bandwidths[i]/2;
-		if (start_freq_khz >= freq_range->start_freq_khz &&
-			end_freq_khz <= freq_range->end_freq_khz)
-			return supported_bandwidths[i];
-	}
-	return 0;
+	u32 start_freq_khz, end_freq_khz;
+
+	start_freq_khz = center_freq_khz - (bw_khz/2);
+	end_freq_khz = center_freq_khz + (bw_khz/2);
+
+	if (start_freq_khz >= freq_range->start_freq_khz &&
+	    end_freq_khz <= freq_range->end_freq_khz)
+		return true;
+
+	return false;
 }
 
 /**
@@ -843,14 +838,17 @@ static u32 map_regdom_flags(u32 rd_flags)
 
 static int freq_reg_info_regd(struct wiphy *wiphy,
 			      u32 center_freq,
-			      u32 *bandwidth,
+			      u32 desired_bw_khz,
 			      const struct ieee80211_reg_rule **reg_rule,
 			      const struct ieee80211_regdomain *custom_regd)
 {
 	int i;
 	bool band_rule_found = false;
 	const struct ieee80211_regdomain *regd;
-	u32 max_bandwidth = 0;
+	bool bw_fits = false;
+
+	if (!desired_bw_khz)
+		desired_bw_khz = MHZ_TO_KHZ(20);
 
 	regd = custom_regd ? custom_regd : cfg80211_regdomain;
 
@@ -883,37 +881,53 @@ static int freq_reg_info_regd(struct wiphy *wiphy,
 		if (!band_rule_found)
 			band_rule_found = freq_in_rule_band(fr, center_freq);
 
-		max_bandwidth = freq_max_bandwidth(fr, center_freq);
+		bw_fits = reg_does_bw_fit(fr,
+					  center_freq,
+					  desired_bw_khz);
 
-		if (max_bandwidth && *bandwidth <= max_bandwidth) {
+		if (band_rule_found && bw_fits) {
 			*reg_rule = rr;
-			*bandwidth = max_bandwidth;
-			break;
+			return 0;
 		}
 	}
 
 	if (!band_rule_found)
 		return -ERANGE;
 
-	return !max_bandwidth;
+	return -EINVAL;
 }
 EXPORT_SYMBOL(freq_reg_info);
 
-int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth,
-			 const struct ieee80211_reg_rule **reg_rule)
+int freq_reg_info(struct wiphy *wiphy,
+		  u32 center_freq,
+		  u32 desired_bw_khz,
+		  const struct ieee80211_reg_rule **reg_rule)
 {
-	return freq_reg_info_regd(wiphy, center_freq,
-		bandwidth, reg_rule, NULL);
+	return freq_reg_info_regd(wiphy,
+				  center_freq,
+				  desired_bw_khz,
+				  reg_rule,
+				  NULL);
 }
 
+/*
+ * Note that right now we assume the desired channel bandwidth
+ * is always 20 MHz for each individual channel (HT40 uses 20 MHz
+ * per channel, the primary and the extension channel). To support
+ * smaller custom bandwidths such as 5 MHz or 10 MHz we'll need a
+ * new ieee80211_channel.target_bw and re run the regulatory check
+ * on the wiphy with the target_bw specified. Then we can simply use
+ * that below for the desired_bw_khz below.
+ */
 static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
 			   unsigned int chan_idx)
 {
 	int r;
-	u32 flags;
-	u32 max_bandwidth = 0;
+	u32 flags, bw_flags = 0;
+	u32 desired_bw_khz = MHZ_TO_KHZ(20);
 	const struct ieee80211_reg_rule *reg_rule = NULL;
 	const struct ieee80211_power_rule *power_rule = NULL;
+	const struct ieee80211_freq_range *freq_range = NULL;
 	struct ieee80211_supported_band *sband;
 	struct ieee80211_channel *chan;
 	struct wiphy *request_wiphy = NULL;
@@ -928,8 +942,10 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
 
 	flags = chan->orig_flags;
 
-	r = freq_reg_info(wiphy, MHZ_TO_KHZ(chan->center_freq),
-		&max_bandwidth, &reg_rule);
+	r = freq_reg_info(wiphy,
+			  MHZ_TO_KHZ(chan->center_freq),
+			  desired_bw_khz,
+			  &reg_rule);
 
 	if (r) {
 		/*
@@ -972,6 +988,10 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
 	}
 
 	power_rule = &reg_rule->power_rule;
+	freq_range = &reg_rule->freq_range;
+
+	if (freq_range->max_bandwidth_khz < MHZ_TO_KHZ(40))
+		bw_flags = IEEE80211_CHAN_NO_HT40;
 
 	if (last_request->initiator == NL80211_REGDOM_SET_BY_DRIVER &&
 	    request_wiphy && request_wiphy == wiphy &&
@@ -982,19 +1002,19 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
 		 * settings
 		 */
 		chan->flags = chan->orig_flags =
-			map_regdom_flags(reg_rule->flags);
+			map_regdom_flags(reg_rule->flags) | bw_flags;
 		chan->max_antenna_gain = chan->orig_mag =
 			(int) MBI_TO_DBI(power_rule->max_antenna_gain);
-		chan->max_bandwidth = KHZ_TO_MHZ(max_bandwidth);
+		chan->max_bandwidth = KHZ_TO_MHZ(desired_bw_khz);
 		chan->max_power = chan->orig_mpwr =
 			(int) MBM_TO_DBM(power_rule->max_eirp);
 		return;
 	}
 
-	chan->flags = flags | map_regdom_flags(reg_rule->flags);
+	chan->flags = flags | bw_flags | map_regdom_flags(reg_rule->flags);
 	chan->max_antenna_gain = min(chan->orig_mag,
 		(int) MBI_TO_DBI(power_rule->max_antenna_gain));
-	chan->max_bandwidth = KHZ_TO_MHZ(max_bandwidth);
+	chan->max_bandwidth = KHZ_TO_MHZ(desired_bw_khz);
 	if (chan->orig_mpwr)
 		chan->max_power = min(chan->orig_mpwr,
 			(int) MBM_TO_DBM(power_rule->max_eirp));
@@ -1142,6 +1162,84 @@ static void reg_process_beacons(struct wiphy *wiphy)
 	wiphy_update_beacon_reg(wiphy);
 }
 
+static void reg_process_ht_flags_channel(struct wiphy *wiphy,
+					 enum ieee80211_band band,
+					 unsigned int chan_idx)
+{
+	struct ieee80211_supported_band *sband;
+	struct ieee80211_channel *channel, *channel_before, *channel_after;
+	unsigned int i;
+
+	assert_cfg80211_lock();
+
+	sband = wiphy->bands[band];
+	BUG_ON(chan_idx >= sband->n_channels);
+	channel = &sband->channels[chan_idx];
+
+	if (channel->flags &
+	    (IEEE80211_CHAN_DISABLED | IEEE80211_CHAN_NO_HT40)) {
+		channel->flags |= IEEE80211_CHAN_NO_FAT_ABOVE |
+				  IEEE80211_CHAN_NO_FAT_BELOW;
+		return;
+	}
+
+	/*
+	 * We need to ensure the extension channels exist to
+	 * be able to use HT40- or HT40+, this finds them (or not)
+	 */
+	for (i = 0; i < sband->n_channels; i++) {
+		struct ieee80211_channel *c = &sband->channels[i];
+		if (c->center_freq == (channel->center_freq - 20))
+			channel_before = c;
+		if (c->center_freq == (channel->center_freq + 20))
+			channel_after = c;
+	}
+
+	/*
+	 * Please note that this assumes target bandwidth is 20 MHz,
+	 * if that ever changes we also need to change the below logic
+	 * to include that as well.
+	 */
+	if (!channel_before || (channel_before->flags &
+	    (IEEE80211_CHAN_DISABLED | IEEE80211_CHAN_NO_HT40)))
+		channel->flags |= IEEE80211_CHAN_NO_FAT_BELOW;
+	else
+		channel->flags &= ~IEEE80211_CHAN_NO_FAT_BELOW;
+
+	if (!channel_after || (channel_after->flags &
+	    (IEEE80211_CHAN_DISABLED | IEEE80211_CHAN_NO_HT40)))
+		channel->flags |= IEEE80211_CHAN_NO_FAT_ABOVE;
+	else
+		channel->flags &= ~IEEE80211_CHAN_NO_FAT_ABOVE;
+}
+
+static void reg_process_ht_flags_band(struct wiphy *wiphy,
+				      enum ieee80211_band band)
+{
+	unsigned int i;
+	struct ieee80211_supported_band *sband;
+
+	BUG_ON(!wiphy->bands[band]);
+	sband = wiphy->bands[band];
+
+	for (i = 0; i < sband->n_channels; i++)
+		reg_process_ht_flags_channel(wiphy, band, i);
+}
+
+static void reg_process_ht_flags(struct wiphy *wiphy)
+{
+	enum ieee80211_band band;
+
+	if (!wiphy)
+		return;
+
+	for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+		if (wiphy->bands[band])
+			reg_process_ht_flags_band(wiphy, band);
+	}
+
+}
+
 void wiphy_update_regulatory(struct wiphy *wiphy,
 			     enum nl80211_reg_initiator initiator)
 {
@@ -1155,6 +1253,7 @@ void wiphy_update_regulatory(struct wiphy *wiphy,
 	}
 out:
 	reg_process_beacons(wiphy);
+	reg_process_ht_flags(wiphy);
 	if (wiphy->reg_notifier)
 		wiphy->reg_notifier(wiphy, last_request);
 }
@@ -1165,9 +1264,11 @@ static void handle_channel_custom(struct wiphy *wiphy,
 				  const struct ieee80211_regdomain *regd)
 {
 	int r;
-	u32 max_bandwidth = 0;
+	u32 desired_bw_khz = MHZ_TO_KHZ(20);
+	u32 bw_flags = 0;
 	const struct ieee80211_reg_rule *reg_rule = NULL;
 	const struct ieee80211_power_rule *power_rule = NULL;
+	const struct ieee80211_freq_range *freq_range = NULL;
 	struct ieee80211_supported_band *sband;
 	struct ieee80211_channel *chan;
 
@@ -1175,8 +1276,11 @@ static void handle_channel_custom(struct wiphy *wiphy,
 	BUG_ON(chan_idx >= sband->n_channels);
 	chan = &sband->channels[chan_idx];
 
-	r = freq_reg_info_regd(wiphy, MHZ_TO_KHZ(chan->center_freq),
-		&max_bandwidth, &reg_rule, regd);
+	r = freq_reg_info_regd(wiphy,
+			       MHZ_TO_KHZ(chan->center_freq),
+			       desired_bw_khz,
+			       &reg_rule,
+			       regd);
 
 	if (r) {
 		chan->flags = IEEE80211_CHAN_DISABLED;
@@ -1184,10 +1288,16 @@ static void handle_channel_custom(struct wiphy *wiphy,
 	}
 
 	power_rule = &reg_rule->power_rule;
+	freq_range = &reg_rule->freq_range;
+
+	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;
 
-	chan->flags |= map_regdom_flags(reg_rule->flags);
+	chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags;
 	chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain);
-	chan->max_bandwidth = KHZ_TO_MHZ(max_bandwidth);
+	chan->max_bandwidth = KHZ_TO_MHZ(desired_bw_khz);
 	chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp);
 }
 
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 2/6] wireless: rename IEEE80211_CHAN_NO_FAT_* to HT40-/+
  2009-03-19  5:54 [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff Luis R. Rodriguez
  2009-03-19  5:54 ` [PATCH v2 1/6] cfg80211: Process regulatory max bandwidth checks for HT40 Luis R. Rodriguez
@ 2009-03-19  5:54 ` Luis R. Rodriguez
  2009-03-19  5:54 ` [PATCH v2 3/6] mac80211: check if HT40+/- is allowed before sending assoc Luis R. Rodriguez
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Luis R. Rodriguez @ 2009-03-19  5:54 UTC (permalink / raw)
  To: johannes, linville; +Cc: linux-wireless, Luis R. Rodriguez

This is more consistent with our nl80211 stuff.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 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(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index 085e9cf..0871efe 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -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;
 }
diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
index 75517d0..9d73f19 100644
--- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
@@ -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);
 		}
 	}
 
diff --git a/include/net/wireless.h b/include/net/wireless.h
index e3077e1..0331d26 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -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,
 };
 
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index a558796..9543eea 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -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;
 			}
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 29646b6..b4c002f 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -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);
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 3/6] mac80211: check if HT40+/- is allowed before sending assoc
  2009-03-19  5:54 [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff Luis R. Rodriguez
  2009-03-19  5:54 ` [PATCH v2 1/6] cfg80211: Process regulatory max bandwidth checks for HT40 Luis R. Rodriguez
  2009-03-19  5:54 ` [PATCH v2 2/6] wireless: rename IEEE80211_CHAN_NO_FAT_* to HT40-/+ Luis R. Rodriguez
@ 2009-03-19  5:54 ` Luis R. Rodriguez
  2009-03-19  5:54 ` [PATCH v2 4/6] cfg80211: check allowed channel type upon userspace requests Luis R. Rodriguez
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Luis R. Rodriguez @ 2009-03-19  5:54 UTC (permalink / raw)
  To: johannes, linville; +Cc: linux-wireless, Luis R. Rodriguez

We weren't checking this at all.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 net/mac80211/ht.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c
index 4e3c72f..01010e0 100644
--- a/net/mac80211/ht.c
+++ b/net/mac80211/ht.c
@@ -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;
 			}
 		}
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 4/6] cfg80211: check allowed channel type upon userspace requests
  2009-03-19  5:54 [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff Luis R. Rodriguez
                   ` (2 preceding siblings ...)
  2009-03-19  5:54 ` [PATCH v2 3/6] mac80211: check if HT40+/- is allowed before sending assoc Luis R. Rodriguez
@ 2009-03-19  5:54 ` Luis R. Rodriguez
  2009-03-20 10:45   ` Johannes Berg
  2009-03-19  5:54 ` [PATCH v2 5/6] cfg80211: send channel max bandwidth to userspace Luis R. Rodriguez
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Luis R. Rodriguez @ 2009-03-19  5:54 UTC (permalink / raw)
  To: johannes, linville; +Cc: linux-wireless, 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.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 net/wireless/nl80211.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 53fe209..e03c9a2 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -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)
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 5/6] cfg80211: send channel max bandwidth to userspace
  2009-03-19  5:54 [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff Luis R. Rodriguez
                   ` (3 preceding siblings ...)
  2009-03-19  5:54 ` [PATCH v2 4/6] cfg80211: check allowed channel type upon userspace requests Luis R. Rodriguez
@ 2009-03-19  5:54 ` Luis R. Rodriguez
  2009-03-19  5:54 ` [PATCH v2 6/6] cfg80211: send to userspace if HT40-/+ is allowed on each channel Luis R. Rodriguez
  2009-03-19 19:40 ` [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff Johannes Berg
  6 siblings, 0 replies; 14+ messages in thread
From: Luis R. Rodriguez @ 2009-03-19  5:54 UTC (permalink / raw)
  To: johannes, linville; +Cc: linux-wireless, Luis R. Rodriguez

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 include/linux/nl80211.h |    3 +++
 net/wireless/nl80211.c  |    3 ++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 3700d92..3924fe4 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -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
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e03c9a2..e2727ee 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -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);
 		}
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v2 6/6] cfg80211: send to userspace if HT40-/+ is allowed on each channel
  2009-03-19  5:54 [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff Luis R. Rodriguez
                   ` (4 preceding siblings ...)
  2009-03-19  5:54 ` [PATCH v2 5/6] cfg80211: send channel max bandwidth to userspace Luis R. Rodriguez
@ 2009-03-19  5:54 ` Luis R. Rodriguez
  2009-03-19 19:40 ` [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff Johannes Berg
  6 siblings, 0 replies; 14+ messages in thread
From: Luis R. Rodriguez @ 2009-03-19  5:54 UTC (permalink / raw)
  To: johannes, linville; +Cc: linux-wireless, Luis R. Rodriguez

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
---
 include/linux/nl80211.h |   15 +++++++++++++++
 net/wireless/nl80211.c  |    6 ++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 3924fe4..f00ebff 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -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
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index e2727ee..108e1ee 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -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,
-- 
1.6.0.6


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff
  2009-03-19  5:54 [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff Luis R. Rodriguez
                   ` (5 preceding siblings ...)
  2009-03-19  5:54 ` [PATCH v2 6/6] cfg80211: send to userspace if HT40-/+ is allowed on each channel Luis R. Rodriguez
@ 2009-03-19 19:40 ` Johannes Berg
  2009-03-19 20:28   ` Luis R. Rodriguez
  6 siblings, 1 reply; 14+ messages in thread
From: Johannes Berg @ 2009-03-19 19:40 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 2191 bytes --]

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

On Thu, 2009-03-19 at 01:54 -0400, Luis R. Rodriguez wrote:
> 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(-)
> 
> 

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff
  2009-03-19 19:40 ` [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff Johannes Berg
@ 2009-03-19 20:28   ` Luis R. Rodriguez
  2009-03-19 21:40     ` Johannes Berg
  0 siblings, 1 reply; 14+ messages in thread
From: Luis R. Rodriguez @ 2009-03-19 20:28 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linville, linux-wireless

On Thu, Mar 19, 2009 at 12:40 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> 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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff
  2009-03-19 21:40     ` Johannes Berg
@ 2009-03-19 20:44       ` Luis R. Rodriguez
  2009-03-19 21:46         ` Johannes Berg
  0 siblings, 1 reply; 14+ messages in thread
From: Luis R. Rodriguez @ 2009-03-19 20:44 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Luis Rodriguez, linville, linux-wireless

On Thu, Mar 19, 2009 at 02:40:52PM -0700, Johannes Berg wrote:
> On Thu, 2009-03-19 at 13:28 -0700, Luis R. Rodriguez wrote:
> > On Thu, Mar 19, 2009 at 12:40 PM, Johannes Berg
> > <johannes@sipsolutions.net> wrote:
> > > 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.

I can fix that, two lines.

  Luis

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff
  2009-03-19 21:46         ` Johannes Berg
@ 2009-03-19 20:56           ` Luis R. Rodriguez
  0 siblings, 0 replies; 14+ messages in thread
From: Luis R. Rodriguez @ 2009-03-19 20:56 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Luis Rodriguez, linville, linux-wireless

On Thu, Mar 19, 2009 at 02:46:51PM -0700, Johannes Berg wrote:
> On Thu, 2009-03-19 at 13:44 -0700, Luis R. Rodriguez wrote:
> > On Thu, Mar 19, 2009 at 02:40:52PM -0700, Johannes Berg wrote:
> > > On Thu, 2009-03-19 at 13:28 -0700, Luis R. Rodriguez wrote:
> > > > On Thu, Mar 19, 2009 at 12:40 PM, Johannes Berg
> > > > <johannes@sipsolutions.net> wrote:
> > > > > 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.
> > 
> > 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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff
  2009-03-19 20:28   ` Luis R. Rodriguez
@ 2009-03-19 21:40     ` Johannes Berg
  2009-03-19 20:44       ` Luis R. Rodriguez
  0 siblings, 1 reply; 14+ messages in thread
From: Johannes Berg @ 2009-03-19 21:40 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 440 bytes --]

On Thu, 2009-03-19 at 13:28 -0700, Luis R. Rodriguez wrote:
> On Thu, Mar 19, 2009 at 12:40 PM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
> > 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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff
  2009-03-19 20:44       ` Luis R. Rodriguez
@ 2009-03-19 21:46         ` Johannes Berg
  2009-03-19 20:56           ` Luis R. Rodriguez
  0 siblings, 1 reply; 14+ messages in thread
From: Johannes Berg @ 2009-03-19 21:46 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: Luis Rodriguez, linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 751 bytes --]

On Thu, 2009-03-19 at 13:44 -0700, Luis R. Rodriguez wrote:
> On Thu, Mar 19, 2009 at 02:40:52PM -0700, Johannes Berg wrote:
> > On Thu, 2009-03-19 at 13:28 -0700, Luis R. Rodriguez wrote:
> > > On Thu, Mar 19, 2009 at 12:40 PM, Johannes Berg
> > > <johannes@sipsolutions.net> wrote:
> > > > 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.
> 
> 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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2 4/6] cfg80211: check allowed channel type upon userspace requests
  2009-03-19  5:54 ` [PATCH v2 4/6] cfg80211: check allowed channel type upon userspace requests Luis R. Rodriguez
@ 2009-03-20 10:45   ` Johannes Berg
  0 siblings, 0 replies; 14+ messages in thread
From: Johannes Berg @ 2009-03-20 10:45 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: linville, linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1309 bytes --]

On Thu, 2009-03-19 at 01:54 -0400, Luis R. Rodriguez wrote:
> 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.
> 

> +		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)

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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-03-20 10:45 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-19  5:54 [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff Luis R. Rodriguez
2009-03-19  5:54 ` [PATCH v2 1/6] cfg80211: Process regulatory max bandwidth checks for HT40 Luis R. Rodriguez
2009-03-19  5:54 ` [PATCH v2 2/6] wireless: rename IEEE80211_CHAN_NO_FAT_* to HT40-/+ Luis R. Rodriguez
2009-03-19  5:54 ` [PATCH v2 3/6] mac80211: check if HT40+/- is allowed before sending assoc Luis R. Rodriguez
2009-03-19  5:54 ` [PATCH v2 4/6] cfg80211: check allowed channel type upon userspace requests Luis R. Rodriguez
2009-03-20 10:45   ` Johannes Berg
2009-03-19  5:54 ` [PATCH v2 5/6] cfg80211: send channel max bandwidth to userspace Luis R. Rodriguez
2009-03-19  5:54 ` [PATCH v2 6/6] cfg80211: send to userspace if HT40-/+ is allowed on each channel Luis R. Rodriguez
2009-03-19 19:40 ` [PATCH v2 0/6] Use the regulatory bandwidth and export HT40 stuff Johannes Berg
2009-03-19 20:28   ` Luis R. Rodriguez
2009-03-19 21:40     ` Johannes Berg
2009-03-19 20:44       ` Luis R. Rodriguez
2009-03-19 21:46         ` Johannes Berg
2009-03-19 20:56           ` Luis R. Rodriguez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.