mwifiex: separate BA params for TDLS link if 11ac is supported
authorAvinash Patil <patila@marvell.com>
Sat, 8 Feb 2014 00:30:40 +0000 (16:30 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 12 Feb 2014 20:36:25 +0000 (15:36 -0500)
If TDLS link is 11ac enabled i.e. we as well as peer station
supports VHT, configure seprate TX & RX window sizes during
BA setup. So even if BSS does not support 11ac, we can use VHT
capabilities and higher window sizes on direct link.

Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/11n.c
drivers/net/wireless/mwifiex/11n_rxreorder.c

index 616b1d6221b96ee416d6199eb70ada05cb4aac28..37677af8d2fc308a77944ed52232382b4356638a 100644 (file)
@@ -537,16 +537,32 @@ void mwifiex_create_ba_tbl(struct mwifiex_private *priv, u8 *ra, int tid,
 int mwifiex_send_addba(struct mwifiex_private *priv, int tid, u8 *peer_mac)
 {
        struct host_cmd_ds_11n_addba_req add_ba_req;
+       struct mwifiex_sta_node *sta_ptr;
+       u32 tx_win_size = priv->add_ba_param.tx_win_size;
        static u8 dialog_tok;
        int ret;
 
        dev_dbg(priv->adapter->dev, "cmd: %s: tid %d\n", __func__, tid);
 
+       if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) &&
+           ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) &&
+           priv->adapter->is_hw_11ac_capable &&
+           memcmp(priv->cfg_bssid, peer_mac, ETH_ALEN)) {
+               sta_ptr = mwifiex_get_sta_entry(priv, peer_mac);
+               if (!sta_ptr) {
+                       dev_warn(priv->adapter->dev,
+                                "BA setup with unknown TDLS peer %pM!\n",
+                               peer_mac);
+                       return -1;
+               }
+               if (sta_ptr->is_11ac_enabled)
+                       tx_win_size = MWIFIEX_11AC_STA_AMPDU_DEF_TXWINSIZE;
+       }
+
        add_ba_req.block_ack_param_set = cpu_to_le16(
                (u16) ((tid << BLOCKACKPARAM_TID_POS) |
-                        (priv->add_ba_param.
-                         tx_win_size << BLOCKACKPARAM_WINSIZE_POS) |
-                        IMMEDIATE_BLOCK_ACK));
+                      tx_win_size << BLOCKACKPARAM_WINSIZE_POS |
+                      IMMEDIATE_BLOCK_ACK));
        add_ba_req.block_ack_tmo = cpu_to_le16((u16)priv->add_ba_param.timeout);
 
        ++dialog_tok;
index 3767399576b34f9650a6dde395d0ddf8af768e29..b361257fb65e7d358bf53ae25b7a8401c41dead6 100644 (file)
@@ -362,10 +362,28 @@ int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv,
                                  *cmd_addba_req)
 {
        struct host_cmd_ds_11n_addba_rsp *add_ba_rsp = &cmd->params.add_ba_rsp;
+       struct mwifiex_sta_node *sta_ptr;
+       u32 rx_win_size = priv->add_ba_param.rx_win_size;
        u8 tid;
        int win_size;
        uint16_t block_ack_param_set;
 
+       if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) &&
+           ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) &&
+           priv->adapter->is_hw_11ac_capable &&
+           memcmp(priv->cfg_bssid, cmd_addba_req->peer_mac_addr, ETH_ALEN)) {
+               sta_ptr = mwifiex_get_sta_entry(priv,
+                                               cmd_addba_req->peer_mac_addr);
+               if (!sta_ptr) {
+                       dev_warn(priv->adapter->dev,
+                                "BA setup with unknown TDLS peer %pM!\n",
+                                cmd_addba_req->peer_mac_addr);
+                       return -1;
+               }
+               if (sta_ptr->is_11ac_enabled)
+                       rx_win_size = MWIFIEX_11AC_STA_AMPDU_DEF_RXWINSIZE;
+       }
+
        cmd->command = cpu_to_le16(HostCmd_CMD_11N_ADDBA_RSP);
        cmd->size = cpu_to_le16(sizeof(*add_ba_rsp) + S_DS_GEN);
 
@@ -382,8 +400,7 @@ int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv,
        block_ack_param_set &= ~IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK;
        /* We donot support AMSDU inside AMPDU, hence reset the bit */
        block_ack_param_set &= ~BLOCKACKPARAM_AMSDU_SUPP_MASK;
-       block_ack_param_set |= (priv->add_ba_param.rx_win_size <<
-                                            BLOCKACKPARAM_WINSIZE_POS);
+       block_ack_param_set |= rx_win_size << BLOCKACKPARAM_WINSIZE_POS;
        add_ba_rsp->block_ack_param_set = cpu_to_le16(block_ack_param_set);
        win_size = (le16_to_cpu(add_ba_rsp->block_ack_param_set)
                                        & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK)