]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
rt2x00: check against flushing empty queue
authorStanislaw Gruszka <sgruszka@redhat.com>
Mon, 30 Apr 2018 13:19:17 +0000 (15:19 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Fri, 4 May 2018 12:34:20 +0000 (15:34 +0300)
We have check if queue is not empty when start flushing queues on
by mac80211 callback, but we also can start flushing queues by internal
driver calls. So move check into rt2x00queue_flush_queue() to assure
we do not flush empty queue anytime.

Additionally add warning if we start to kick empty queue as in such
situation we set wrong index in the HW queue, what can confuse the HW
and have various negative consequences.

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

index 1123e2bed8036e449035f1ccccd8fbec890840d9..e1a7ed7e4892efb62138268149228ad20cddc876 100644 (file)
@@ -600,6 +600,7 @@ void rt2800mmio_kick_queue(struct data_queue *queue)
        case QID_AC_VI:
        case QID_AC_BE:
        case QID_AC_BK:
+               WARN_ON_ONCE(rt2x00queue_empty(queue));
                entry = rt2x00queue_get_entry(queue, Q_INDEX);
                rt2x00mmio_register_write(rt2x00dev, TX_CTX_IDX(queue->qid),
                                          entry->entry_idx);
index a971bc7a6b63963bbacbd257164e3e157f51f7b5..c380c1f56ba6f1a9a8982d4a3543fc2eeb9e8f4e 100644 (file)
@@ -739,8 +739,7 @@ void rt2x00mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                return;
 
        tx_queue_for_each(rt2x00dev, queue)
-               if (!rt2x00queue_empty(queue))
-                       rt2x00queue_flush_queue(queue, drop);
+               rt2x00queue_flush_queue(queue, drop);
 }
 EXPORT_SYMBOL_GPL(rt2x00mac_flush);
 
index a6884e73d2abfb2228de1e83f91e2226c2b0b65c..7c1f8f561d4a909c694a486005df957aa0a4f3f0 100644 (file)
@@ -1000,6 +1000,8 @@ void rt2x00queue_flush_queue(struct data_queue *queue, bool drop)
                (queue->qid == QID_AC_BE) ||
                (queue->qid == QID_AC_BK);
 
+       if (rt2x00queue_empty(queue))
+               return;
 
        /*
         * If we are not supposed to drop any pending