aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2011-12-21 02:47:22 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-12-21 15:06:14 -0500
commit3aebee028aa8eb8ed49b7dbd52dfb841f6dc8dff (patch)
tree90cd0920dfed0e76ab161ee3cdf7a4649e9fc2da /drivers/net
parent21c3ba346486c3df39d23a2a085fcdfc7a59a853 (diff)
mwifiex: fix issues in band configuration code
Currently due to following issues in the code even if device is configured in B only, G only or BG mode using iw bitrates command, ibss is getting created in BGN mode. 1) mwifiex_channels_to_cfg80211_channel_type() routine gives channel type as NL80211_CHAN_HT20 for non-HT channel as well, because driver doesn't store HT information provided by stack for the channel. This issue is fixed by maintaining channel type information in 'adapter->channel_type'. 2) Band configuration is unnecessarily overwritten with BGN/AN while setting channel. This patch makes sure that "adapter->config_bands" correctly gets modified while setting channel. Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c49
-rw-r--r--drivers/net/wireless/mwifiex/main.h1
2 files changed, 20 insertions, 30 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 0723f610694f..c3b6c4652cd6 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -48,30 +48,6 @@ mwifiex_cfg80211_channel_type_to_sec_chan_offset(enum nl80211_channel_type
48} 48}
49 49
50/* 50/*
51 * This function maps the driver channel type into nl802.11 channel type.
52 *
53 * The mapping is as follows -
54 * IEEE80211_HT_PARAM_CHA_SEC_NONE -> NL80211_CHAN_HT20
55 * IEEE80211_HT_PARAM_CHA_SEC_ABOVE -> NL80211_CHAN_HT40PLUS
56 * IEEE80211_HT_PARAM_CHA_SEC_BELOW -> NL80211_CHAN_HT40MINUS
57 * Others -> NL80211_CHAN_HT20
58 */
59static enum nl80211_channel_type
60mwifiex_channels_to_cfg80211_channel_type(int channel_type)
61{
62 switch (channel_type) {
63 case IEEE80211_HT_PARAM_CHA_SEC_NONE:
64 return NL80211_CHAN_HT20;
65 case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
66 return NL80211_CHAN_HT40PLUS;
67 case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
68 return NL80211_CHAN_HT40MINUS;
69 default:
70 return NL80211_CHAN_HT20;
71 }
72}
73
74/*
75 * This function checks whether WEP is set. 51 * This function checks whether WEP is set.
76 */ 52 */
77static int 53static int
@@ -337,10 +313,22 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
337 313
338 if (chan) { 314 if (chan) {
339 /* Set appropriate bands */ 315 /* Set appropriate bands */
340 if (chan->band == IEEE80211_BAND_2GHZ) 316 if (chan->band == IEEE80211_BAND_2GHZ) {
341 config_bands = BAND_B | BAND_G | BAND_GN; 317 if (channel_type == NL80211_CHAN_NO_HT)
342 else 318 if (priv->adapter->config_bands == BAND_B ||
343 config_bands = BAND_AN | BAND_A; 319 priv->adapter->config_bands == BAND_G)
320 config_bands =
321 priv->adapter->config_bands;
322 else
323 config_bands = BAND_B | BAND_G;
324 else
325 config_bands = BAND_B | BAND_G | BAND_GN;
326 } else {
327 if (channel_type == NL80211_CHAN_NO_HT)
328 config_bands = BAND_A;
329 else
330 config_bands = BAND_AN | BAND_A;
331 }
344 332
345 if (!((config_bands | adapter->fw_bands) & 333 if (!((config_bands | adapter->fw_bands) &
346 ~adapter->fw_bands)) { 334 ~adapter->fw_bands)) {
@@ -357,6 +345,7 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
357 adapter->sec_chan_offset = 345 adapter->sec_chan_offset =
358 mwifiex_cfg80211_channel_type_to_sec_chan_offset 346 mwifiex_cfg80211_channel_type_to_sec_chan_offset
359 (channel_type); 347 (channel_type);
348 adapter->channel_type = channel_type;
360 349
361 mwifiex_send_domain_info_cmd_fw(wiphy); 350 mwifiex_send_domain_info_cmd_fw(wiphy);
362 } 351 }
@@ -730,6 +719,7 @@ static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy,
730 } 719 }
731 } 720 }
732 adapter->sec_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; 721 adapter->sec_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE;
722 adapter->channel_type = NL80211_CHAN_NO_HT;
733 723
734 wiphy_debug(wiphy, "info: device configured in 802.11%s%s mode\n", 724 wiphy_debug(wiphy, "info: device configured in 802.11%s%s mode\n",
735 (mode & BAND_B) ? "b" : "", 725 (mode & BAND_B) ? "b" : "",
@@ -849,8 +839,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
849 839
850 if (channel) 840 if (channel)
851 ret = mwifiex_set_rf_channel(priv, channel, 841 ret = mwifiex_set_rf_channel(priv, channel,
852 mwifiex_channels_to_cfg80211_channel_type 842 priv->adapter->channel_type);
853 (priv->adapter->sec_chan_offset));
854 843
855 ret = mwifiex_set_encode(priv, NULL, 0, 0, 1); /* Disable keys */ 844 ret = mwifiex_set_encode(priv, NULL, 0, 0, 1); /* Disable keys */
856 845
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 2287643b5f87..3186aa437f42 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -641,6 +641,7 @@ struct mwifiex_adapter {
641 u8 hw_dev_mcs_support; 641 u8 hw_dev_mcs_support;
642 u8 adhoc_11n_enabled; 642 u8 adhoc_11n_enabled;
643 u8 sec_chan_offset; 643 u8 sec_chan_offset;
644 enum nl80211_channel_type channel_type;
644 struct mwifiex_dbg dbg; 645 struct mwifiex_dbg dbg;
645 u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE]; 646 u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE];
646 u32 arp_filter_size; 647 u32 arp_filter_size;