mwifiex: tdls related handling for data packets addressed to TDLS peer
authorAvinash Patil <patila@marvell.com>
Sat, 8 Feb 2014 00:30:36 +0000 (16:30 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 12 Feb 2014 20:36:22 +0000 (15:36 -0500)
1. If data packet is addressed to TDLS peer for which link is
established, mark these packets with TDLS flag so that FW can
send them on direct link instead of sending via AP.
2. If data packet is addressed to TDLS peer and TDLS setup is
underway, move these packets to TDLS queue.
3. If this packet is TDLS setup packet, do not block it.

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/main.h
drivers/net/wireless/mwifiex/tdls.c
drivers/net/wireless/mwifiex/wmm.c

index bce65f5f0046248f1ce3f3c0dee5ffd15b1a13db..3001332191a3fa9ea0a8e6ff625914ed8c8f0968 100644 (file)
@@ -1213,6 +1213,7 @@ int mwifiex_send_tdls_action_frame(struct mwifiex_private *priv,
 void mwifiex_process_tdls_action_frame(struct mwifiex_private *priv,
                                       u8 *buf, int len);
 int mwifiex_tdls_oper(struct mwifiex_private *priv, u8 *peer, u8 action);
+int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, u8 *mac);
 
 #ifdef CONFIG_DEBUG_FS
 void mwifiex_debugfs_init(void);
index 3198739c133e58925282b169fb895655303db094..7ef3593e2c4403abb86165c73fc4999e439adfe8 100644 (file)
@@ -782,3 +782,14 @@ int mwifiex_tdls_oper(struct mwifiex_private *priv, u8 *peer, u8 action)
        }
        return 0;
 }
+
+int mwifiex_get_tdls_link_status(struct mwifiex_private *priv, u8 *mac)
+{
+       struct mwifiex_sta_node *sta_ptr;
+
+       sta_ptr = mwifiex_get_sta_entry(priv, mac);
+       if (sta_ptr)
+               return sta_ptr->tdls_status;
+
+       return TDLS_NOT_SETUP;
+}
index e9f7628684ce8470adc31592c52b7a8c54a81824..63496ed10272c09a09aca06be6bed68d65a58a00 100644 (file)
@@ -631,6 +631,21 @@ mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv,
        struct mwifiex_ra_list_tbl *ra_list;
        u8 ra[ETH_ALEN], tid_down;
        unsigned long flags;
+       struct list_head list_head;
+       int tdls_status = TDLS_NOT_SETUP;
+       struct ethhdr *eth_hdr = (struct ethhdr *)skb->data;
+       struct mwifiex_txinfo *tx_info = MWIFIEX_SKB_TXCB(skb);
+
+       memcpy(ra, eth_hdr->h_dest, ETH_ALEN);
+
+       if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA &&
+           ISSUPP_TDLS_ENABLED(adapter->fw_cap_info)) {
+               if (ntohs(eth_hdr->h_proto) == ETH_P_TDLS)
+                       dev_dbg(adapter->dev,
+                               "TDLS setup packet for %pM. Don't block\n", ra);
+               else
+                       tdls_status = mwifiex_get_tdls_link_status(priv, ra);
+       }
 
        if (!priv->media_connected && !mwifiex_is_skb_mgmt_frame(skb)) {
                dev_dbg(adapter->dev, "data: drop packet in disconnect\n");
@@ -649,12 +664,27 @@ mwifiex_wmm_add_buf_txqueue(struct mwifiex_private *priv,
           have only 1 raptr for a tid in case of infra */
        if (!mwifiex_queuing_ra_based(priv) &&
            !mwifiex_is_skb_mgmt_frame(skb)) {
-               if (!list_empty(&priv->wmm.tid_tbl_ptr[tid_down].ra_list))
-                       ra_list = list_first_entry(
-                               &priv->wmm.tid_tbl_ptr[tid_down].ra_list,
-                               struct mwifiex_ra_list_tbl, list);
-               else
-                       ra_list = NULL;
+               switch (tdls_status) {
+               case TDLS_SETUP_COMPLETE:
+                       ra_list = mwifiex_wmm_get_queue_raptr(priv, tid_down,
+                                                             ra);
+                       tx_info->flags |= MWIFIEX_BUF_FLAG_TDLS_PKT;
+                       break;
+               case TDLS_SETUP_INPROGRESS:
+                       skb_queue_tail(&priv->tdls_txq, skb);
+                       spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock,
+                                              flags);
+                       return;
+               default:
+                       list_head = priv->wmm.tid_tbl_ptr[tid_down].ra_list;
+                       if (!list_empty(&list_head))
+                               ra_list = list_first_entry(
+                                       &list_head, struct mwifiex_ra_list_tbl,
+                                       list);
+                       else
+                               ra_list = NULL;
+                       break;
+               }
        } else {
                memcpy(ra, skb->data, ETH_ALEN);
                if (ra[0] & 0x01 || mwifiex_is_skb_mgmt_frame(skb))