diff options
author | Amitkumar Karwar <akarwar@marvell.com> | 2011-12-21 08:47:22 +0100 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-12-21 21:06:14 +0100 |
commit | 3aebee028aa8eb8ed49b7dbd52dfb841f6dc8dff (patch) | |
tree | 90cd0920dfed0e76ab161ee3cdf7a4649e9fc2da /drivers/net/wireless/mwifiex | |
parent | mwifiex: use IEEE80211_HT_PARAM_CHA_SEC_* macros (diff) | |
download | linux-3aebee028aa8eb8ed49b7dbd52dfb841f6dc8dff.tar.xz linux-3aebee028aa8eb8ed49b7dbd52dfb841f6dc8dff.zip |
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/wireless/mwifiex')
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 49 | ||||
-rw-r--r-- | drivers/net/wireless/mwifiex/main.h | 1 |
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 } /* - * This function maps the driver channel type into nl802.11 channel type. - * - * The mapping is as follows - - * IEEE80211_HT_PARAM_CHA_SEC_NONE -> NL80211_CHAN_HT20 - * IEEE80211_HT_PARAM_CHA_SEC_ABOVE -> NL80211_CHAN_HT40PLUS - * IEEE80211_HT_PARAM_CHA_SEC_BELOW -> NL80211_CHAN_HT40MINUS - * Others -> NL80211_CHAN_HT20 - */ -static enum nl80211_channel_type -mwifiex_channels_to_cfg80211_channel_type(int channel_type) -{ - switch (channel_type) { - case IEEE80211_HT_PARAM_CHA_SEC_NONE: - return NL80211_CHAN_HT20; - case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: - return NL80211_CHAN_HT40PLUS; - case IEEE80211_HT_PARAM_CHA_SEC_BELOW: - return NL80211_CHAN_HT40MINUS; - default: - return NL80211_CHAN_HT20; - } -} - -/* * This function checks whether WEP is set. */ static int @@ -337,10 +313,22 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv, if (chan) { /* Set appropriate bands */ - if (chan->band == IEEE80211_BAND_2GHZ) - config_bands = BAND_B | BAND_G | BAND_GN; - else - config_bands = BAND_AN | BAND_A; + if (chan->band == IEEE80211_BAND_2GHZ) { + if (channel_type == NL80211_CHAN_NO_HT) + if (priv->adapter->config_bands == BAND_B || + priv->adapter->config_bands == BAND_G) + config_bands = + priv->adapter->config_bands; + else + config_bands = BAND_B | BAND_G; + else + config_bands = BAND_B | BAND_G | BAND_GN; + } else { + if (channel_type == NL80211_CHAN_NO_HT) + config_bands = BAND_A; + else + config_bands = BAND_AN | BAND_A; + } if (!((config_bands | adapter->fw_bands) & ~adapter->fw_bands)) { @@ -357,6 +345,7 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv, adapter->sec_chan_offset = mwifiex_cfg80211_channel_type_to_sec_chan_offset (channel_type); + adapter->channel_type = channel_type; mwifiex_send_domain_info_cmd_fw(wiphy); } @@ -730,6 +719,7 @@ static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy, } } adapter->sec_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE; + adapter->channel_type = NL80211_CHAN_NO_HT; wiphy_debug(wiphy, "info: device configured in 802.11%s%s mode\n", (mode & BAND_B) ? "b" : "", @@ -849,8 +839,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid, if (channel) ret = mwifiex_set_rf_channel(priv, channel, - mwifiex_channels_to_cfg80211_channel_type - (priv->adapter->sec_chan_offset)); + priv->adapter->channel_type); ret = mwifiex_set_encode(priv, NULL, 0, 0, 1); /* Disable keys */ 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 { u8 hw_dev_mcs_support; u8 adhoc_11n_enabled; u8 sec_chan_offset; + enum nl80211_channel_type channel_type; struct mwifiex_dbg dbg; u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE]; u32 arp_filter_size; |