Skip to contentSkip to conversation

mwifiex: update config_bands during infra association

PATCH New Bing Zhao 1 participant 2 messages Jan 9, 2013 Networking drivers (wireless)

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH 1/1 mwifiex: update config_bands during infra association

From: Amitkumar Karwar <[email protected]>

Currently "adapter->config_bands" is updated during infra association only if channel is provided by user in "iw connect" command. config_bands is used while preparing association request to calculate supported rates by intersecting our rates with the rates advertised by AP.

There is corner case in which we include zero rates in supported rates TLV based on previous IBSS network history, which leads to association failure.

This patch fixes the problem by correctly updating config_bands.

---
 drivers/net/wireless/mwifiex/cfg80211.c  |   15 +--------------
 drivers/net/wireless/mwifiex/sta_ioctl.c |   14 ++++++++++++++
 2 files changed, 15 insertions(+), 14 deletions(-)
drivers/net/wireless/mwifiex/cfg80211.c +1 -14
index a1f7fe0..b4dbe22 100644
@@ -1460,7 +1460,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
 	struct cfg80211_ssid req_ssid;
 	int ret, auth_type = 0;
 	struct cfg80211_bss *bss = NULL;
-	u8 is_scanning_required = 0, config_bands = 0;
+	u8 is_scanning_required = 0;
 
 	memset(&req_ssid, 0, sizeof(struct cfg80211_ssid));
 
@@ -1479,19 +1479,6 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
 	/* disconnect before try to associate */
 	mwifiex_deauthenticate(priv, NULL);
 
-	if (channel) {
-		if (mode == NL80211_IFTYPE_STATION) {
-			if (channel->band == IEEE80211_BAND_2GHZ)
-				config_bands = BAND_B | BAND_G | BAND_GN;
-			else
-				config_bands = BAND_A | BAND_AN;
-
-			if (!((config_bands | priv->adapter->fw_bands) &
-			      ~priv->adapter->fw_bands))
-				priv->adapter->config_bands = config_bands;
-		}
-	}
-
 	/* As this is new association, clear locally stored
 	 * keys and security related flags */
 	priv->sec_info.wpa_enabled = false;
drivers/net/wireless/mwifiex/sta_ioctl.c +14 -0
index 60e88b5..f542bb8 100644
@@ -283,6 +283,20 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,
 		if (ret)
 			goto done;
 
+		if (bss_desc) {
+			u8 config_bands = 0;
+
+			if (mwifiex_band_to_radio_type((u8) bss_desc->bss_band)
+			    == HostCmd_SCAN_RADIO_TYPE_BG)
+				config_bands = BAND_B | BAND_G | BAND_GN;
+			else
+				config_bands = BAND_A | BAND_AN;
+
+			if (!((config_bands | adapter->fw_bands) &
+			      ~adapter->fw_bands))
+				adapter->config_bands = config_bands;
+		}
+
 		ret = mwifiex_check_network_compatibility(priv, bss_desc);
 		if (ret)
 			goto done;
Signature · 1 line
1.7.0.2
author
#1 lore raw

PATCH 1/1 mwifiex: correct config_bands handling for ibss network

From: Amitkumar Karwar <[email protected]>

BAND_G is implicit when BAND_GN is present.

---
 drivers/net/wireless/mwifiex/cfg80211.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/mwifiex/cfg80211.c +1 -1
index b4dbe22..9eab21d 100644
@@ -1695,7 +1695,7 @@ static int mwifiex_set_ibss_params(struct mwifiex_private *priv,
 
 		if (cfg80211_get_chandef_type(&params->chandef) !=
 						NL80211_CHAN_NO_HT)
-			config_bands |= BAND_GN;
+			config_bands |= BAND_G | BAND_GN;
 	} else {
 		if (cfg80211_get_chandef_type(&params->chandef) ==
 						NL80211_CHAN_NO_HT)
Signature · 1 line
1.7.0.2