aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2012-07-13 23:09:33 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-07-17 15:11:33 -0400
commit433c3990a3595efe81e34a8c12ebf1746b94dc88 (patch)
treebe5b6584fe477cff143cefcf7f9d8031045c5463 /drivers
parent05910f4a222c602290a483f8fb2b0aa828d55c5b (diff)
mwifiex: improvement in cfg80211 set_bitrate_mask handler
This patch configures data rates to firmware using bitrate mask provided by cfg80211. Earlier we used to only update band information in this handler which will be used later for ibss network. Due to recent modifications in ibss join code we don't need to do that. Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Signed-off-by: Avinash Patil <patila@marvell.com> Signed-off-by: Kiran Divekar <dkiran@marvell.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c59
-rw-r--r--drivers/net/wireless/mwifiex/main.h1
2 files changed, 26 insertions, 34 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 5c5e885319b..2969f74faa4 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -753,8 +753,8 @@ static const u32 mwifiex_cipher_suites[] = {
753/* 753/*
754 * CFG802.11 operation handler for setting bit rates. 754 * CFG802.11 operation handler for setting bit rates.
755 * 755 *
756 * Function selects legacy bang B/G/BG from corresponding bitrates selection. 756 * Function configures data rates to firmware using bitrate mask
757 * Currently only 2.4GHz band is supported. 757 * provided by cfg80211.
758 */ 758 */
759static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy, 759static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy,
760 struct net_device *dev, 760 struct net_device *dev,
@@ -762,43 +762,36 @@ static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy,
762 const struct cfg80211_bitrate_mask *mask) 762 const struct cfg80211_bitrate_mask *mask)
763{ 763{
764 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 764 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
765 int index = 0, mode = 0, i; 765 u16 bitmap_rates[MAX_BITMAP_RATES_SIZE];
766 struct mwifiex_adapter *adapter = priv->adapter; 766 enum ieee80211_band band;
767 767
768 /* Currently only 2.4GHz is supported */ 768 if (!priv->media_connected) {
769 for (i = 0; i < mwifiex_band_2ghz.n_bitrates; i++) { 769 dev_err(priv->adapter->dev,
770 /* 770 "Can not set Tx data rate in disconnected state\n");
771 * Rates below 6 Mbps in the table are CCK rates; 802.11b 771 return -EINVAL;
772 * and from 6 they are OFDM; 802.11G
773 */
774 if (mwifiex_rates[i].bitrate == 60) {
775 index = 1 << i;
776 break;
777 }
778 } 772 }
779 773
780 if (mask->control[IEEE80211_BAND_2GHZ].legacy < index) { 774 band = mwifiex_band_to_radio_type(priv->curr_bss_params.band);
781 mode = BAND_B;
782 } else {
783 mode = BAND_G;
784 if (mask->control[IEEE80211_BAND_2GHZ].legacy % index)
785 mode |= BAND_B;
786 }
787 775
788 if (!((mode | adapter->fw_bands) & ~adapter->fw_bands)) { 776 memset(bitmap_rates, 0, sizeof(bitmap_rates));
789 adapter->config_bands = mode;
790 if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
791 adapter->adhoc_start_band = mode;
792 adapter->adhoc_11n_enabled = false;
793 }
794 }
795 adapter->sec_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE;
796 adapter->channel_type = NL80211_CHAN_NO_HT;
797 777
798 wiphy_debug(wiphy, "info: device configured in 802.11%s%s mode\n", 778 /* Fill HR/DSSS rates. */
799 (mode & BAND_B) ? "b" : "", (mode & BAND_G) ? "g" : ""); 779 if (band == IEEE80211_BAND_2GHZ)
780 bitmap_rates[0] = mask->control[band].legacy & 0x000f;
800 781
801 return 0; 782 /* Fill OFDM rates */
783 if (band == IEEE80211_BAND_2GHZ)
784 bitmap_rates[1] = (mask->control[band].legacy & 0x0ff0) >> 4;
785 else
786 bitmap_rates[1] = mask->control[band].legacy;
787
788 /* Fill MCS rates */
789 bitmap_rates[2] = mask->control[band].mcs[0];
790 if (priv->adapter->hw_dev_mcs_support == HT_STREAM_2X2)
791 bitmap_rates[2] |= mask->control[band].mcs[1] << 8;
792
793 return mwifiex_send_cmd_sync(priv, HostCmd_CMD_TX_RATE_CFG,
794 HostCmd_ACT_GEN_SET, 0, bitmap_rates);
802} 795}
803 796
804/* 797/*
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index 34705f5e46e..e7c2a82fd61 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -678,7 +678,6 @@ struct mwifiex_adapter {
678 u8 hw_dev_mcs_support; 678 u8 hw_dev_mcs_support;
679 u8 adhoc_11n_enabled; 679 u8 adhoc_11n_enabled;
680 u8 sec_chan_offset; 680 u8 sec_chan_offset;
681 enum nl80211_channel_type channel_type;
682 struct mwifiex_dbg dbg; 681 struct mwifiex_dbg dbg;
683 u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE]; 682 u8 arp_filter[ARP_FILTER_MAX_BUF_SIZE];
684 u32 arp_filter_size; 683 u32 arp_filter_size;