diff options
author | Yogesh Ashok Powar <yogeshp@marvell.com> | 2011-07-11 23:04:44 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-07-13 14:49:42 -0400 |
commit | 5d82c53a380ca96421a714481c9113ba54ede609 (patch) | |
tree | c2b59f6cc00e8de68d7154ec9e0bd27c3e253723 | |
parent | 4e868796bbcbae2f2ea3a828c803686787392b71 (diff) |
mwifiex: add cfg80211 handler for set_bitrate_mask
Currently, setting only legacy bitrates on 2.4GHz band
are supported. Mode 802.11b/g/bg is enabled based on
bitrates selection. If only CCK bitrates selected then
802.11b mode is enabled. If only OFDM bitrates are
selected then 802.11g mode is enabled. For both: CCK
and OFDM rates 802.11bg mixed mode is enabled.
Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 4487d935654e..352d2c5da1fc 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -672,6 +672,59 @@ static const u32 mwifiex_cipher_suites[] = { | |||
672 | }; | 672 | }; |
673 | 673 | ||
674 | /* | 674 | /* |
675 | * CFG802.11 operation handler for setting bit rates. | ||
676 | * | ||
677 | * Function selects legacy bang B/G/BG from corresponding bitrates selection. | ||
678 | * Currently only 2.4GHz band is supported. | ||
679 | */ | ||
680 | static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy, | ||
681 | struct net_device *dev, | ||
682 | const u8 *peer, | ||
683 | const struct cfg80211_bitrate_mask *mask) | ||
684 | { | ||
685 | struct mwifiex_ds_band_cfg band_cfg; | ||
686 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | ||
687 | int index = 0, mode = 0, i; | ||
688 | |||
689 | /* Currently only 2.4GHz is supported */ | ||
690 | for (i = 0; i < mwifiex_band_2ghz.n_bitrates; i++) { | ||
691 | /* | ||
692 | * Rates below 6 Mbps in the table are CCK rates; 802.11b | ||
693 | * and from 6 they are OFDM; 802.11G | ||
694 | */ | ||
695 | if (mwifiex_rates[i].bitrate == 60) { | ||
696 | index = 1 << i; | ||
697 | break; | ||
698 | } | ||
699 | } | ||
700 | |||
701 | if (mask->control[IEEE80211_BAND_2GHZ].legacy < index) { | ||
702 | mode = BAND_B; | ||
703 | } else { | ||
704 | mode = BAND_G; | ||
705 | if (mask->control[IEEE80211_BAND_2GHZ].legacy % index) | ||
706 | mode |= BAND_B; | ||
707 | } | ||
708 | |||
709 | memset(&band_cfg, 0, sizeof(band_cfg)); | ||
710 | band_cfg.config_bands = mode; | ||
711 | |||
712 | if (priv->bss_mode == NL80211_IFTYPE_ADHOC) | ||
713 | band_cfg.adhoc_start_band = mode; | ||
714 | |||
715 | band_cfg.sec_chan_offset = NO_SEC_CHANNEL; | ||
716 | |||
717 | if (mwifiex_set_radio_band_cfg(priv, &band_cfg)) | ||
718 | return -EFAULT; | ||
719 | |||
720 | wiphy_debug(wiphy, "info: device configured in 802.11%s%s mode\n", | ||
721 | (mode & BAND_B) ? "b" : "", | ||
722 | (mode & BAND_G) ? "g" : ""); | ||
723 | |||
724 | return 0; | ||
725 | } | ||
726 | |||
727 | /* | ||
675 | * CFG802.11 operation handler for disconnection request. | 728 | * CFG802.11 operation handler for disconnection request. |
676 | * | 729 | * |
677 | * This function does not work when there is already a disconnection | 730 | * This function does not work when there is already a disconnection |
@@ -1225,6 +1278,7 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = { | |||
1225 | .set_default_key = mwifiex_cfg80211_set_default_key, | 1278 | .set_default_key = mwifiex_cfg80211_set_default_key, |
1226 | .set_power_mgmt = mwifiex_cfg80211_set_power_mgmt, | 1279 | .set_power_mgmt = mwifiex_cfg80211_set_power_mgmt, |
1227 | .set_tx_power = mwifiex_cfg80211_set_tx_power, | 1280 | .set_tx_power = mwifiex_cfg80211_set_tx_power, |
1281 | .set_bitrate_mask = mwifiex_cfg80211_set_bitrate_mask, | ||
1228 | }; | 1282 | }; |
1229 | 1283 | ||
1230 | /* | 1284 | /* |