mwifiex: fix rx_pending count imbalance
authorUjjal Roy <royujjal@gmail.com>
Tue, 3 Dec 2013 07:17:53 +0000 (23:17 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 9 Dec 2013 20:35:29 +0000 (15:35 -0500)
RX packets are handled in different paths. Not all paths have
decrement of rx_pending counter. This patch fixes the counter
imbalance.

Signed-off-by: Ujjal Roy <royujjal@gmail.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/mwifiex/init.c
drivers/net/wireless/mwifiex/main.h
drivers/net/wireless/mwifiex/sta_rx.c
drivers/net/wireless/mwifiex/txrx.c
drivers/net/wireless/mwifiex/uap_txrx.c
drivers/net/wireless/mwifiex/usb.c

index 6499117fce43a3a73f36836c8d91d4e27b51b0ba..1d0a817f2bf05de1c5c7873fad2eacaa6cb1838f 100644 (file)
@@ -643,7 +643,8 @@ mwifiex_shutdown_drv(struct mwifiex_adapter *adapter)
                        if (priv)
                                priv->stats.rx_dropped++;
 
-                       adapter->if_ops.data_complete(adapter, skb);
+                       dev_kfree_skb_any(skb);
+                       adapter->if_ops.data_complete(adapter);
                }
        }
 
index 1d72f13adb9dd5763187bde915fe0300eb5f4dd1..dc34457557f38452de46f47276d6194d4ff766e1 100644 (file)
@@ -615,7 +615,7 @@ struct mwifiex_if_ops {
        void (*cleanup_mpa_buf) (struct mwifiex_adapter *);
        int (*cmdrsp_complete) (struct mwifiex_adapter *, struct sk_buff *);
        int (*event_complete) (struct mwifiex_adapter *, struct sk_buff *);
-       int (*data_complete) (struct mwifiex_adapter *, struct sk_buff *);
+       int (*data_complete) (struct mwifiex_adapter *);
        int (*init_fw_port) (struct mwifiex_adapter *);
        int (*dnld_fw) (struct mwifiex_adapter *, struct mwifiex_fw_image *);
        void (*card_reset) (struct mwifiex_adapter *);
index d74192d62653b83cc2663e589171d508964f9600..0bb510de80710a1348c1743ca95fbe107ef223e7 100644 (file)
@@ -188,12 +188,7 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_private *priv,
                        "wrong rx packet: len=%d, rx_pkt_offset=%d, rx_pkt_length=%d\n",
                        skb->len, rx_pkt_offset, rx_pkt_length);
                priv->stats.rx_dropped++;
-
-               if (adapter->if_ops.data_complete)
-                       adapter->if_ops.data_complete(adapter, skb);
-               else
-                       dev_kfree_skb_any(skb);
-
+               dev_kfree_skb_any(skb);
                return ret;
        }
 
@@ -247,12 +242,8 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_private *priv,
        ret = mwifiex_11n_rx_reorder_pkt(priv, seq_num, local_rx_pd->priority,
                                         ta, (u8) rx_pkt_type, skb);
 
-       if (ret || (rx_pkt_type == PKT_TYPE_BAR)) {
-               if (adapter->if_ops.data_complete)
-                       adapter->if_ops.data_complete(adapter, skb);
-               else
-                       dev_kfree_skb_any(skb);
-       }
+       if (ret || (rx_pkt_type == PKT_TYPE_BAR))
+               dev_kfree_skb_any(skb);
 
        if (ret)
                priv->stats.rx_dropped++;
index 8f923d0d2ba657241c7634b26dc6f04697045e40..8dd145cf8030597e9e844909367f424b9054cb19 100644 (file)
@@ -40,6 +40,7 @@ int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter,
                mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
        struct rxpd *local_rx_pd;
        struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb);
+       int ret;
 
        local_rx_pd = (struct rxpd *) (skb->data);
        /* Get the BSS number from rxpd, get corresponding priv */
@@ -58,9 +59,15 @@ int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter,
        rx_info->bss_type = priv->bss_type;
 
        if (priv->bss_role == MWIFIEX_BSS_ROLE_UAP)
-               return mwifiex_process_uap_rx_packet(priv, skb);
+               ret = mwifiex_process_uap_rx_packet(priv, skb);
+       else
+               ret = mwifiex_process_sta_rx_packet(priv, skb);
+
+       /* Decrement RX pending counter for each packet */
+       if (adapter->if_ops.data_complete)
+               adapter->if_ops.data_complete(adapter);
 
-       return mwifiex_process_sta_rx_packet(priv, skb);
+       return ret;
 }
 EXPORT_SYMBOL_GPL(mwifiex_handle_rx_packet);
 
index a0bd954b3ab29185d24e7ef332255389a3f97ea1..6c0a31a8df915ea39ae4099a484c59e2f9f01d2e 100644 (file)
@@ -267,12 +267,7 @@ int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv,
                        skb->len, le16_to_cpu(uap_rx_pd->rx_pkt_offset),
                        le16_to_cpu(uap_rx_pd->rx_pkt_length));
                priv->stats.rx_dropped++;
-
-               if (adapter->if_ops.data_complete)
-                       adapter->if_ops.data_complete(adapter, skb);
-               else
-                       dev_kfree_skb_any(skb);
-
+               dev_kfree_skb_any(skb);
                return 0;
        }
 
@@ -326,12 +321,8 @@ int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv,
                                         uap_rx_pd->priority, ta, pkt_type,
                                         skb);
 
-       if (ret || (rx_pkt_type == PKT_TYPE_BAR)) {
-               if (adapter->if_ops.data_complete)
-                       adapter->if_ops.data_complete(adapter, skb);
-               else
-                       dev_kfree_skb_any(skb);
-       }
+       if (ret || (rx_pkt_type == PKT_TYPE_BAR))
+               dev_kfree_skb_any(skb);
 
        if (ret)
                priv->stats.rx_dropped++;
index edf5b7a24900ec1edf8d1fbb1e426b5268d2d3e2..a9240a2083f2c7f48405e9a2af4ab85729edb814 100644 (file)
@@ -938,11 +938,9 @@ static int mwifiex_usb_cmd_event_complete(struct mwifiex_adapter *adapter,
        return 0;
 }
 
-static int mwifiex_usb_data_complete(struct mwifiex_adapter *adapter,
-                                    struct sk_buff *skb)
+static int mwifiex_usb_data_complete(struct mwifiex_adapter *adapter)
 {
        atomic_dec(&adapter->rx_pending);
-       dev_kfree_skb_any(skb);
 
        return 0;
 }