rt2x00: pause almost full queue early
authorStanislaw Gruszka <sgruszka@redhat.com>
Tue, 19 Dec 2017 11:33:55 +0000 (12:33 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 8 Jan 2018 17:39:06 +0000 (19:39 +0200)
Do not drop &queue->tx_lock and acquire it again to pause queue when
available entries are below the threshold.

Patch should mitigate problem of frequently printed errors:
"Error - Dropping frame due to full tx queue"

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Tested-by: Enrico Mioso@gmail.com
Tested-by: Enrico Mioso <mrkiko.rs@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ralink/rt2x00/rt2x00mac.c
drivers/net/wireless/ralink/rt2x00/rt2x00queue.c

index ecc9631..c8a6f16 100644 (file)
@@ -152,16 +152,6 @@ void rt2x00mac_tx(struct ieee80211_hw *hw,
        if (unlikely(rt2x00queue_write_tx_frame(queue, skb, control->sta, false)))
                goto exit_fail;
 
-       /*
-        * Pausing queue has to be serialized with rt2x00lib_txdone(). Note
-        * we should not use spin_lock_bh variant as bottom halve was already
-        * disabled before ieee80211_xmit() call.
-        */
-       spin_lock(&queue->tx_lock);
-       if (rt2x00queue_threshold(queue))
-               rt2x00queue_pause_queue(queue);
-       spin_unlock(&queue->tx_lock);
-
        return;
 
  exit_fail:
index 6598cef..a6884e7 100644 (file)
@@ -715,6 +715,14 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb,
        rt2x00queue_kick_tx_queue(queue, &txdesc);
 
 out:
+       /*
+        * Pausing queue has to be serialized with rt2x00lib_txdone(), so we
+        * do this under queue->tx_lock. Bottom halve was already disabled
+        * before ieee80211_xmit() call.
+        */
+       if (rt2x00queue_threshold(queue))
+               rt2x00queue_pause_queue(queue);
+
        spin_unlock(&queue->tx_lock);
        return ret;
 }