mwifiex: update seq number correctly for packets from TDLS peer
authorAvinash Patil <patila@marvell.com>
Thu, 22 May 2014 05:02:31 +0000 (22:02 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 22 May 2014 18:04:38 +0000 (14:04 -0400)
This patch adds handling of updating rx sequence number for
packets received from TDLS peer. Current implementation of
mwifiex_queueing_ra_based assumes station would always receive
packets from AP which is not true in case of TDLS.
Fix this by adding this case.

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/fw.h
drivers/net/wireless/mwifiex/sta_rx.c

index ee59508307ccaa9ac5277c1c8660cdf5d9401c8d..42eaeda1dc823d1007d97111f46bda16a9d45ca8 100644 (file)
@@ -539,6 +539,7 @@ struct mwifiex_ie_types_data {
 #define MWIFIEX_TxPD_POWER_MGMT_NULL_PACKET 0x01
 #define MWIFIEX_TxPD_POWER_MGMT_LAST_PACKET 0x08
 #define MWIFIEX_TXPD_FLAGS_TDLS_PACKET      0x10
+#define MWIFIEX_RXPD_FLAGS_TDLS_PACKET      0x01
 
 struct txpd {
        u8 bss_type;
@@ -581,7 +582,7 @@ struct rxpd {
         * [Bit 7] Reserved
         */
        u8 ht_info;
-       u8 reserved;
+       u8 flags;
 } __packed;
 
 struct uap_txpd {
index ed26387eccf56db59bca98f7ed6fd7e6a4065aae..8b639d7fe6df263814901554a2c43363be6791e9 100644 (file)
@@ -183,6 +183,7 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_private *priv,
        struct rx_packet_hdr *rx_pkt_hdr;
        u8 ta[ETH_ALEN];
        u16 rx_pkt_type, rx_pkt_offset, rx_pkt_length, seq_num;
+       struct mwifiex_sta_node *sta_ptr;
 
        local_rx_pd = (struct rxpd *) (skb->data);
        rx_pkt_type = le16_to_cpu(local_rx_pd->rx_pkt_type);
@@ -213,14 +214,25 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_private *priv,
         * If the packet is not an unicast packet then send the packet
         * directly to os. Don't pass thru rx reordering
         */
-       if (!IS_11N_ENABLED(priv) ||
+       if ((!IS_11N_ENABLED(priv) &&
+            !(ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) &&
+              !(local_rx_pd->flags & MWIFIEX_RXPD_FLAGS_TDLS_PACKET))) ||
            !ether_addr_equal_unaligned(priv->curr_addr, rx_pkt_hdr->eth803_hdr.h_dest)) {
                mwifiex_process_rx_packet(priv, skb);
                return ret;
        }
 
-       if (mwifiex_queuing_ra_based(priv)) {
+       if (mwifiex_queuing_ra_based(priv) ||
+           (ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) &&
+            local_rx_pd->flags & MWIFIEX_RXPD_FLAGS_TDLS_PACKET)) {
                memcpy(ta, rx_pkt_hdr->eth803_hdr.h_source, ETH_ALEN);
+               if (local_rx_pd->flags & MWIFIEX_RXPD_FLAGS_TDLS_PACKET &&
+                   local_rx_pd->priority < MAX_NUM_TID) {
+                       sta_ptr = mwifiex_get_sta_entry(priv, ta);
+                       if (sta_ptr)
+                               sta_ptr->rx_seq[local_rx_pd->priority] =
+                                             le16_to_cpu(local_rx_pd->seq_num);
+               }
        } else {
                if (rx_pkt_type != PKT_TYPE_BAR)
                        priv->rx_seq[local_rx_pd->priority] = seq_num;