rt2x00: do not check for txstatus timeout every time on tasklet
authorStanislaw Gruszka <sgruszka@redhat.com>
Wed, 26 Sep 2018 10:24:55 +0000 (12:24 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 1 Oct 2018 15:37:31 +0000 (18:37 +0300)
Do not check for tx status timeout everytime we perform txstatus tasklet.
Perform check once per half a second.

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

index 9f2835729016e98efbd71e6ba342bcf84539eaad..0c56c7dca55fea74dec1e27ebbd828bf34497bd0 100644 (file)
@@ -1158,11 +1158,18 @@ bool rt2800_txstatus_timeout(struct rt2x00_dev *rt2x00dev)
        struct data_queue *queue;
        struct queue_entry *entry;
 
+       if (time_before(jiffies,
+                       rt2x00dev->last_nostatus_check + msecs_to_jiffies(500)))
+               return false;
+
+       rt2x00dev->last_nostatus_check = jiffies;
+
        tx_queue_for_each(rt2x00dev, queue) {
                entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
                if (rt2800_entry_txstatus_timeout(entry))
                        return true;
        }
+
        return false;
 }
 EXPORT_SYMBOL_GPL(rt2800_txstatus_timeout);
index aa8449a5e8fe63d837ef0969872545c5b469ff88..d0426314c2dfbc073e108ff129adf7085696ef8c 100644 (file)
@@ -197,7 +197,8 @@ void rt2800mmio_txstatus_tasklet(unsigned long data)
 
        rt2800_txdone(rt2x00dev);
 
-       rt2800_txdone_nostatus(rt2x00dev);
+       if (rt2800_txstatus_timeout(rt2x00dev))
+               rt2800_txdone_nostatus(rt2x00dev);
 
        if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
                rt2800mmio_enable_interrupt(rt2x00dev,
index a279a4363bc15a2e0f502dd2d0428291df59eba3..af062cda4a233f74125b4b6d3eb9a10fc42bd9af 100644 (file)
@@ -980,6 +980,8 @@ struct rt2x00_dev {
         */
        DECLARE_KFIFO_PTR(txstatus_fifo, u32);
 
+       unsigned long last_nostatus_check;
+
        /*
         * Timer to ensure tx status reports are read (rt2800usb).
         */
index 6e8beb7ea350ba0b4a03ee4721c0835d76585079..92ddc19e7bf747a23d0eb24c15b05ff111751754 100644 (file)
@@ -1039,6 +1039,7 @@ void rt2x00queue_start_queues(struct rt2x00_dev *rt2x00dev)
         */
        tx_queue_for_each(rt2x00dev, queue)
                rt2x00queue_start_queue(queue);
+       rt2x00dev->last_nostatus_check = jiffies;
 
        rt2x00queue_start_queue(rt2x00dev->rx);
 }