111f4c7e83c5b257a2125c3d26c5dc33425f68c1
[openwrt/staging/ynezz.git] /
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
5 tasklet
6
7 Do not check for tx status timeout everytime we perform txstatus tasklet.
8 Perform check once per half a second.
9
10 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
11 ---
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(-)
17
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;
23
24 + if (time_before(jiffies,
25 + rt2x00dev->last_nostatus_check + msecs_to_jiffies(500)))
26 + return false;
27 +
28 + rt2x00dev->last_nostatus_check = jiffies;
29 +
30 tx_queue_for_each(rt2x00dev, queue) {
31 entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
32 if (rt2800_entry_txstatus_timeout(entry))
33 return true;
34 }
35 +
36 return false;
37 }
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
42
43 rt2800_txdone(rt2x00dev);
44
45 - rt2800_txdone_nostatus(rt2x00dev);
46 + if (rt2800_txstatus_timeout(rt2x00dev))
47 + rt2800_txdone_nostatus(rt2x00dev);
48
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 {
54 */
55 DECLARE_KFIFO_PTR(txstatus_fifo, u32);
56
57 + unsigned long last_nostatus_check;
58 +
59 /*
60 * Timer to ensure tx status reports are read (rt2800usb).
61 */
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
65 */
66 tx_queue_for_each(rt2x00dev, queue)
67 rt2x00queue_start_queue(queue);
68 + rt2x00dev->last_nostatus_check = jiffies;
69
70 rt2x00queue_start_queue(rt2x00dev->rx);
71 }