mwifiex: enhance tdls link setup condition
authorXinming Hu <huxm@marvell.com>
Mon, 22 Jun 2015 13:36:14 +0000 (19:06 +0530)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 21 Jul 2015 13:40:25 +0000 (16:40 +0300)
TDLS link status - channel switching, off channel or base channel itself
indicates that TDLS link is setup.

Signed-off-by: Xinming Hu <huxm@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/mwifiex/main.h
drivers/net/wireless/mwifiex/sta_event.c
drivers/net/wireless/mwifiex/tdls.c
drivers/net/wireless/mwifiex/wmm.c

index da2275221c0374f43b4a89831b670b91f53ca510..0e6ebc9001c3bc318f26bfb138e698c2e4d6503b 100644 (file)
@@ -1333,6 +1333,21 @@ static inline u8 mwifiex_is_any_intf_active(struct mwifiex_private *priv)
        return 0;
 }
 
+static inline u8 mwifiex_is_tdls_link_setup(u8 status)
+{
+       switch (status) {
+       case TDLS_SETUP_COMPLETE:
+       case TDLS_CHAN_SWITCHING:
+       case TDLS_IN_BASE_CHAN:
+       case TDLS_IN_OFF_CHAN:
+               return true;
+       default:
+               break;
+       }
+
+       return false;
+}
+
 int mwifiex_init_shutdown_fw(struct mwifiex_private *priv,
                             u32 func_init_shutdown);
 int mwifiex_add_card(void *, struct semaphore *, struct mwifiex_if_ops *, u8);
index 0529b9a602d8eafa2fb904e0532aebeab82b64f6..f1045d41abee8348d5c72124abc7942726052564 100644 (file)
@@ -273,7 +273,7 @@ mwifiex_process_sta_tx_pause_event(struct mwifiex_private *priv,
                                    tp_tlv->pkt_cnt);
                        status = mwifiex_get_tdls_link_status
                                        (priv,  tp_tlv->peermac);
-                       if (status == TDLS_SETUP_COMPLETE) {
+                       if (mwifiex_is_tdls_link_setup(status)) {
                                spin_lock_irqsave(&priv->sta_list_spinlock,
                                                  flags);
                                sta_ptr = mwifiex_get_sta_entry
index f862ca63506ce14107d9cbe55690bd4ed1b7647d..aa3d3c5ed07b3671b8d9064ff020f8fab998efcd 100644 (file)
@@ -49,7 +49,7 @@ static void mwifiex_restore_tdls_packets(struct mwifiex_private *priv,
                tid = skb->priority;
                tid_down = mwifiex_wmm_downgrade_tid(priv, tid);
 
-               if (status == TDLS_SETUP_COMPLETE) {
+               if (mwifiex_is_tdls_link_setup(status)) {
                        ra_list = mwifiex_wmm_get_queue_raptr(priv, tid, mac);
                        ra_list->tdls_link = true;
                        tx_info->flags |= MWIFIEX_BUF_FLAG_TDLS_PKT;
@@ -1147,7 +1147,7 @@ int mwifiex_get_tdls_list(struct mwifiex_private *priv,
 
        spin_lock_irqsave(&priv->sta_list_spinlock, flags);
        list_for_each_entry(sta_ptr, &priv->sta_list, list) {
-               if (sta_ptr->tdls_status == TDLS_SETUP_COMPLETE) {
+               if (mwifiex_is_tdls_link_setup(sta_ptr->tdls_status)) {
                        ether_addr_copy(peer->peer_addr, sta_ptr->mac_addr);
                        peer++;
                        count++;
@@ -1301,7 +1301,7 @@ void mwifiex_auto_tdls_update_peer_status(struct mwifiex_private *priv,
                        if ((link_status == TDLS_NOT_SETUP) &&
                            (peer->tdls_status == TDLS_SETUP_INPROGRESS))
                                peer->failure_count++;
-                       else if (link_status == TDLS_SETUP_COMPLETE)
+                       else if (mwifiex_is_tdls_link_setup(link_status))
                                peer->failure_count = 0;
 
                        peer->tdls_status = link_status;
@@ -1373,7 +1373,7 @@ void mwifiex_check_auto_tdls(unsigned long context)
 
                if (((tdls_peer->rssi >= MWIFIEX_TDLS_RSSI_LOW) ||
                     !tdls_peer->rssi) &&
-                   tdls_peer->tdls_status == TDLS_SETUP_COMPLETE) {
+                   mwifiex_is_tdls_link_setup(tdls_peer->tdls_status)) {
                        tdls_peer->tdls_status = TDLS_LINK_TEARDOWN;
                        mwifiex_dbg(priv->adapter, MSG,
                                    "teardown TDLS link,peer=%pM rssi=%d\n",
index 21712cdcd95ad02985e5094680074938d983f55e..6196daad5a6120a6b9314a06cadd96fd636e211d 100644 (file)
@@ -162,8 +162,8 @@ void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra)
                ra_list->amsdu_in_ampdu = false;
                ra_list->tx_paused = false;
                if (!mwifiex_queuing_ra_based(priv)) {
-                       if (mwifiex_get_tdls_link_status(priv, ra) ==
-                           TDLS_SETUP_COMPLETE) {
+                       if (mwifiex_is_tdls_link_setup
+                               (mwifiex_get_tdls_link_status(priv, ra))) {
                                ra_list->tdls_link = true;
                                ra_list->is_11n_enabled =
                                        mwifiex_tdls_peer_11n_enabled(priv, ra);
@@ -806,6 +806,9 @@ mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv,
            !mwifiex_is_skb_mgmt_frame(skb)) {
                switch (tdls_status) {
                case TDLS_SETUP_COMPLETE:
+               case TDLS_CHAN_SWITCHING:
+               case TDLS_IN_BASE_CHAN:
+               case TDLS_IN_OFF_CHAN:
                        ra_list = mwifiex_wmm_get_queue_raptr(priv, tid_down,
                                                              ra);
                        tx_info->flags |= MWIFIEX_BUF_FLAG_TDLS_PKT;