Linux wireless drivers development
 help / color / mirror / Atom feed
* [RFC] mac80211: connect with HT20 if HT40 is not permitted
@ 2012-10-01 14:02 Johannes Berg
  2012-10-01 14:17 ` Johannes Berg
  2012-10-16 18:19 ` Johannes Berg
  0 siblings, 2 replies; 3+ messages in thread
From: Johannes Berg @ 2012-10-01 14:02 UTC (permalink / raw)
  To: linux-wireless, Paul Stewart

From: Johannes Berg <johannes.berg@intel.com>

Some changes to fix issues with HT40 APs in Korea
and follow-up changes to allow using HT40 even if
the local regulatory database disallows it caused
issues with iwlwifi (and could cause issues with
other devices); iwlwifi firmware would assert if
you tried to connect to an AP that has an invalid
configuration (e.g. using HT40- on channel 140.)

Fix this, while avoiding the "Korean AP" issue by
disabling HT40 and advertising HT20 to the AP
when connecting.

Cc: stable@vger.kernel.org [3.6]
Reported-by: Florian Reitmeir <florian@reitmeir.org>
Tested-by: Florian Reitmeir <florian@reitmeir.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/mac80211/mlme.c |   40 ++++++++++++++++++++++++++--------------
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index fe4b744..3b05952 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3199,27 +3199,39 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
 				   ht_cfreq, ht_oper->primary_chan,
 				   cbss->channel->band);
 			ht_oper = NULL;
+		} else {
+			channel_type = NL80211_CHAN_HT20;
 		}
 	}
 
-	if (ht_oper) {
-		const u8 *ht_cap_ie;
-		const struct ieee80211_ht_cap *ht_cap;
-		u8 chains = 1;
-
-		channel_type = NL80211_CHAN_HT20;
+	if (ht_oper && sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) {
+		/*
+		 * cfg80211 already verified that the channel itself can
+		 * be used, but it didn't check that we can do the right
+		 * HT type, so do that here as well. If HT40 isn't allowed
+		 * on this channel, disable 40 MHz operation.
+		 */
 
-		if (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) {
-			switch (ht_oper->ht_param &
-					IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
-			case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
+		switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
+		case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
+			if (cbss->channel->flags & IEEE80211_CHAN_NO_HT40PLUS)
+				ifmgd->flags |= IEEE80211_STA_DISABLE_40MHZ;
+			else
 				channel_type = NL80211_CHAN_HT40PLUS;
-				break;
-			case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
+			break;
+		case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
+			if (cbss->channel->flags & IEEE80211_CHAN_NO_HT40MINUS)
+				ifmgd->flags |= IEEE80211_STA_DISABLE_40MHZ;
+			else
 				channel_type = NL80211_CHAN_HT40MINUS;
-				break;
-			}
+			break;
 		}
+	}
+
+	if (ht_oper) {
+		const u8 *ht_cap_ie;
+		const struct ieee80211_ht_cap *ht_cap;
+		u8 chains = 1;
 
 		ht_cap_ie = cfg80211_find_ie(WLAN_EID_HT_CAPABILITY,
 					     cbss->information_elements,
-- 
1.7.10.4




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

* Re: [RFC] mac80211: connect with HT20 if HT40 is not permitted
  2012-10-01 14:02 [RFC] mac80211: connect with HT20 if HT40 is not permitted Johannes Berg
@ 2012-10-01 14:17 ` Johannes Berg
  2012-10-16 18:19 ` Johannes Berg
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2012-10-01 14:17 UTC (permalink / raw)
  To: linux-wireless; +Cc: Paul Stewart

On Mon, 2012-10-01 at 16:02 +0200, Johannes Berg wrote:

> Fix this, while avoiding the "Korean AP" issue by
> disabling HT40 and advertising HT20 to the AP
> when connecting.

> +		case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
> +			if (cbss->channel->flags & IEEE80211_CHAN_NO_HT40PLUS)

What we *could* do instead is use "channel->orig_flags" here instead to
fix the iwlwifi issue, and allow HT40 RX for when the driver/device has
no limitations (and the HT40 restriction would be regulatory only), but
I'm not sure I see much value in that? That might enable HT40 RX (not
TX) for some devices on those Korean HT40 APs though, but it'd also be
somewhat tricky in the code and more or less relying on cfg80211
internals ... I'd prefer not to introduce these kinds of subtle
differences between devices but if somebody has strong objections to the
patch as is I'd be willing to change it.

johannes


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

* Re: [RFC] mac80211: connect with HT20 if HT40 is not permitted
  2012-10-01 14:02 [RFC] mac80211: connect with HT20 if HT40 is not permitted Johannes Berg
  2012-10-01 14:17 ` Johannes Berg
@ 2012-10-16 18:19 ` Johannes Berg
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2012-10-16 18:19 UTC (permalink / raw)
  To: linux-wireless; +Cc: Paul Stewart

On Mon, 2012-10-01 at 16:02 +0200, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> Some changes to fix issues with HT40 APs in Korea
> and follow-up changes to allow using HT40 even if
> the local regulatory database disallows it caused
> issues with iwlwifi (and could cause issues with
> other devices); iwlwifi firmware would assert if
> you tried to connect to an AP that has an invalid
> configuration (e.g. using HT40- on channel 140.)
> 
> Fix this, while avoiding the "Korean AP" issue by
> disabling HT40 and advertising HT20 to the AP
> when connecting.

No comments, so I'm applying this :)

johannes


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

end of thread, other threads:[~2012-10-16 18:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-01 14:02 [RFC] mac80211: connect with HT20 if HT40 is not permitted Johannes Berg
2012-10-01 14:17 ` Johannes Berg
2012-10-16 18:19 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox