mwifiex: update MCS set as per RX-STBC bit from hostapd
authorMaithili Hinge <maithili@marvell.com>
Wed, 19 Mar 2014 05:24:10 +0000 (22:24 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 19 Mar 2014 19:15:47 +0000 (15:15 -0400)
To set AP in 1X1 or 2X2 mode through hostapd, we need to set
RX-STBC* in hostapd.conf file. Depending upon RX-STBC bit in
ht_cap IE received from hostapd, we need to update mcs set in
bss_cfg appropriately before starting AP.

Signed-off-by: Maithili Hinge <maithili@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/cfg80211.c
drivers/net/wireless/mwifiex/fw.h
drivers/net/wireless/mwifiex/uap_cmd.c

index ee45d626eedb0b812365e440d1eb84ab75e7da3b..21ee27ab7b745261f9a398bcaacc92b24ce7c8f7 100644 (file)
@@ -2100,10 +2100,10 @@ mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *ht_info,
        else
                ht_info->cap &= ~IEEE80211_HT_CAP_SGI_40;
 
-       if (ISSUPP_RXSTBC(adapter->hw_dot_11n_dev_cap))
-               ht_info->cap |= 1 << IEEE80211_HT_CAP_RX_STBC_SHIFT;
+       if (adapter->user_dev_mcs_support == HT_STREAM_2X2)
+               ht_info->cap |= 3 << IEEE80211_HT_CAP_RX_STBC_SHIFT;
        else
-               ht_info->cap &= ~(3 << IEEE80211_HT_CAP_RX_STBC_SHIFT);
+               ht_info->cap |= 1 << IEEE80211_HT_CAP_RX_STBC_SHIFT;
 
        if (ISSUPP_TXSTBC(adapter->hw_dot_11n_dev_cap))
                ht_info->cap |= IEEE80211_HT_CAP_TX_STBC;
index 341e41978ac672e0bad127a02c1c0fc5d6ae2af7..b485dc1ae5ebc42c5606e37723189d20e7d98b16 100644 (file)
@@ -202,6 +202,11 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {
 
 #define MWIFIEX_DEF_AMPDU      IEEE80211_HT_AMPDU_PARM_FACTOR
 
+#define GET_RXSTBC(x) (x & IEEE80211_HT_CAP_RX_STBC)
+#define MWIFIEX_RX_STBC1       0x0100
+#define MWIFIEX_RX_STBC12      0x0200
+#define MWIFIEX_RX_STBC123     0x0300
+
 /* dev_cap bitmap
  * BIT
  * 0-16                reserved
index a6a6a53cda40686bd0da8ba1bcdf32f100177723..9be6544bddedf9371e79fd468ebb0aa2dbcabe54 100644 (file)
@@ -159,6 +159,7 @@ mwifiex_set_ht_params(struct mwifiex_private *priv,
                      struct cfg80211_ap_settings *params)
 {
        const u8 *ht_ie;
+       u16 cap_info;
 
        if (!ISSUPP_11NENABLED(priv->adapter->fw_cap_info))
                return;
@@ -168,6 +169,25 @@ mwifiex_set_ht_params(struct mwifiex_private *priv,
        if (ht_ie) {
                memcpy(&bss_cfg->ht_cap, ht_ie + 2,
                       sizeof(struct ieee80211_ht_cap));
+               cap_info = le16_to_cpu(bss_cfg->ht_cap.cap_info);
+               memset(&bss_cfg->ht_cap.mcs, 0,
+                      priv->adapter->number_of_antenna);
+               switch (GET_RXSTBC(cap_info)) {
+               case MWIFIEX_RX_STBC1:
+                       /* HT_CAP 1X1 mode */
+                       memset(&bss_cfg->ht_cap.mcs, 0xff, 1);
+                       break;
+               case MWIFIEX_RX_STBC12: /* fall through */
+               case MWIFIEX_RX_STBC123:
+                       /* HT_CAP 2X2 mode */
+                       memset(&bss_cfg->ht_cap.mcs, 0xff, 2);
+                       break;
+               default:
+                       dev_warn(priv->adapter->dev,
+                                "Unsupported RX-STBC, default to 2x2\n");
+                       memset(&bss_cfg->ht_cap.mcs, 0xff, 2);
+                       break;
+               }
                priv->ap_11n_enabled = 1;
        } else {
                memset(&bss_cfg->ht_cap , 0, sizeof(struct ieee80211_ht_cap));