mwifiex: correct paused tx data packet counter
authorZhaoyang Liu <liuzy@marvell.com>
Fri, 18 Sep 2015 13:32:11 +0000 (06:32 -0700)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 29 Sep 2015 07:47:38 +0000 (10:47 +0300)
This patch fixes observed issues while updating counter for
number of paused data packets in wmm queue when trying to
delete packet or delete station entry.

Signed-off-by: Zhaoyang Liu <liuzy@marvell.com>
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/mwifiex/uap_txrx.c
drivers/net/wireless/mwifiex/wmm.c

index 87667418af5ff528d2100f8674c293fc564067ab..74d5d7238633ede9ab43a6ca89d8cdfd1b798de8 100644 (file)
@@ -31,7 +31,8 @@
  */
 static bool
 mwifiex_uap_del_tx_pkts_in_ralist(struct mwifiex_private *priv,
-                                 struct list_head *ra_list_head)
+                                 struct list_head *ra_list_head,
+                                 int tid)
 {
        struct mwifiex_ra_list_tbl *ra_list;
        struct sk_buff *skb, *tmp;
@@ -49,7 +50,10 @@ mwifiex_uap_del_tx_pkts_in_ralist(struct mwifiex_private *priv,
                                __skb_unlink(skb, &ra_list->skb_head);
                                mwifiex_write_data_complete(adapter, skb, 0,
                                                            -1);
-                               atomic_dec(&priv->wmm.tx_pkts_queued);
+                               if (ra_list->tx_paused)
+                                       priv->wmm.pkts_paused[tid]--;
+                               else
+                                       atomic_dec(&priv->wmm.tx_pkts_queued);
                                pkt_deleted = true;
                        }
                        if ((atomic_read(&adapter->pending_bridged_pkts) <=
@@ -77,7 +81,7 @@ static void mwifiex_uap_cleanup_tx_queues(struct mwifiex_private *priv)
                if (priv->del_list_idx == MAX_NUM_TID)
                        priv->del_list_idx = 0;
                ra_list = &priv->wmm.tid_tbl_ptr[priv->del_list_idx].ra_list;
-               if (mwifiex_uap_del_tx_pkts_in_ralist(priv, ra_list)) {
+               if (mwifiex_uap_del_tx_pkts_in_ralist(priv, ra_list, i)) {
                        priv->del_list_idx++;
                        break;
                }
index 173d3663c2e042bfe44e680e04acf86cf43f7c30..8e30fb34c9a19f8f807eb5dcc8dda53f5d557928 100644 (file)
@@ -160,7 +160,6 @@ void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra)
                ra_list->tdls_link = false;
                ra_list->ba_status = BA_SETUP_NONE;
                ra_list->amsdu_in_ampdu = false;
-               ra_list->tx_paused = false;
                if (!mwifiex_queuing_ra_based(priv)) {
                        if (mwifiex_is_tdls_link_setup
                                (mwifiex_get_tdls_link_status(priv, ra))) {
@@ -173,6 +172,8 @@ void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra)
                } else {
                        spin_lock_irqsave(&priv->sta_list_spinlock, flags);
                        node = mwifiex_get_sta_entry(priv, ra);
+                       if (node)
+                               ra_list->tx_paused = node->tx_pause;
                        ra_list->is_11n_enabled =
                                      mwifiex_is_sta_11n_enabled(priv, node);
                        if (ra_list->is_11n_enabled)
@@ -737,7 +738,11 @@ mwifiex_wmm_del_peer_ra_list(struct mwifiex_private *priv, const u8 *ra_addr)
                if (!ra_list)
                        continue;
                mwifiex_wmm_del_pkts_in_ralist_node(priv, ra_list);
-               atomic_sub(ra_list->total_pkt_count, &priv->wmm.tx_pkts_queued);
+               if (ra_list->tx_paused)
+                       priv->wmm.pkts_paused[i] -= ra_list->total_pkt_count;
+               else
+                       atomic_sub(ra_list->total_pkt_count,
+                                  &priv->wmm.tx_pkts_queued);
                list_del(&ra_list->list);
                kfree(ra_list);
        }