ath9k: fix queue depth accounting in ath_tx_txqaddbuf
authorFelix Fietkau <nbd@openwrt.org>
Thu, 20 Jun 2013 13:11:31 +0000 (15:11 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 24 Jun 2013 18:44:23 +0000 (14:44 -0400)
ath_tx_txqaddbuf assumes that all the linked buffers in the queue passed
to it are part of the same A-MPDU or MPDU. The CAB queue rework violates
this assumption, which can cause the internal queue depth to go
negative.
Fix this by increasing the counter for all slots of [bf, bf->bf_lastbf]

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/xmit.c

index 7e19d9b5214eb7be1b75cf4cd1055fc8d0ee746f..bfb58a5f2fd00fa6e055a6633146647e5f5fae58 100644 (file)
@@ -1778,9 +1778,13 @@ static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
        }
 
        if (!internal) {
-               txq->axq_depth++;
-               if (bf_is_ampdu_not_probing(bf))
-                       txq->axq_ampdu_depth++;
+               while (bf) {
+                       txq->axq_depth++;
+                       if (bf_is_ampdu_not_probing(bf))
+                               txq->axq_ampdu_depth++;
+
+                       bf = bf->bf_lastbf->bf_next;
+               }
        }
 }