1 From b5d6e37ea15949a126907050d8cfa4408153a0cd Mon Sep 17 00:00:00 2001
2 From: Stanislaw Gruszka <sgruszka@redhat.com>
3 Date: Fri, 18 May 2018 12:25:10 +0200
4 Subject: [PATCH 3/5] rt2x00: do not check for txstatus timeout every time on
7 Do not check for tx status timeout everytime we perform txstatus tasklet.
8 Perform check once per half a second.
10 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
12 drivers/net/wireless/ralink/rt2x00/rt2800lib.c | 7 +++++++
13 drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 3 ++-
14 drivers/net/wireless/ralink/rt2x00/rt2x00.h | 2 ++
15 drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 1 +
16 4 files changed, 12 insertions(+), 1 deletion(-)
18 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
19 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
20 @@ -1161,11 +1161,18 @@ bool rt2800_txstatus_timeout(struct rt2x
21 struct data_queue *queue;
22 struct queue_entry *entry;
24 + if (time_before(jiffies,
25 + rt2x00dev->last_nostatus_check + msecs_to_jiffies(500)))
28 + rt2x00dev->last_nostatus_check = jiffies;
30 tx_queue_for_each(rt2x00dev, queue) {
31 entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
32 if (rt2800_entry_txstatus_timeout(entry))
38 EXPORT_SYMBOL_GPL(rt2800_txstatus_timeout);
39 --- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
40 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
41 @@ -197,7 +197,8 @@ void rt2800mmio_txstatus_tasklet(unsigne
43 rt2800_txdone(rt2x00dev);
45 - rt2800_txdone_nostatus(rt2x00dev);
46 + if (rt2800_txstatus_timeout(rt2x00dev))
47 + rt2800_txdone_nostatus(rt2x00dev);
49 if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
50 rt2800mmio_enable_interrupt(rt2x00dev,
51 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
52 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
53 @@ -988,6 +988,8 @@ struct rt2x00_dev {
55 DECLARE_KFIFO_PTR(txstatus_fifo, u32);
57 + unsigned long last_nostatus_check;
60 * Timer to ensure tx status reports are read (rt2800usb).
62 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
63 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
64 @@ -1039,6 +1039,7 @@ void rt2x00queue_start_queues(struct rt2
66 tx_queue_for_each(rt2x00dev, queue)
67 rt2x00queue_start_queue(queue);
68 + rt2x00dev->last_nostatus_check = jiffies;
70 rt2x00queue_start_queue(rt2x00dev->rx);