832768d0424d7cb0cbfe004c964cea4543cfdc0d
[librecmc/librecmc.git] /
1 From 5022efb50f625d11fdf18b1fee0f64ebb1863664 Mon Sep 17 00:00:00 2001
2 From: Stanislaw Gruszka <sgruszka@redhat.com>
3 Date: Wed, 26 Sep 2018 12:24:55 +0200
4 Subject: [PATCH 04/28] 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 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
12 ---
13  drivers/net/wireless/ralink/rt2x00/rt2800lib.c   | 7 +++++++
14  drivers/net/wireless/ralink/rt2x00/rt2800mmio.c  | 3 ++-
15  drivers/net/wireless/ralink/rt2x00/rt2x00.h      | 2 ++
16  drivers/net/wireless/ralink/rt2x00/rt2x00queue.c | 1 +
17  4 files changed, 12 insertions(+), 1 deletion(-)
18
19 --- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
20 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
21 @@ -1158,11 +1158,18 @@ bool rt2800_txstatus_timeout(struct rt2x
22         struct data_queue *queue;
23         struct queue_entry *entry;
24  
25 +       if (time_before(jiffies,
26 +                       rt2x00dev->last_nostatus_check + msecs_to_jiffies(500)))
27 +               return false;
28 +
29 +       rt2x00dev->last_nostatus_check = jiffies;
30 +
31         tx_queue_for_each(rt2x00dev, queue) {
32                 entry = rt2x00queue_get_entry(queue, Q_INDEX_DONE);
33                 if (rt2800_entry_txstatus_timeout(entry))
34                         return true;
35         }
36 +
37         return false;
38  }
39  EXPORT_SYMBOL_GPL(rt2800_txstatus_timeout);
40 --- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
41 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
42 @@ -197,7 +197,8 @@ void rt2800mmio_txstatus_tasklet(unsigne
43  
44         rt2800_txdone(rt2x00dev);
45  
46 -       rt2800_txdone_nostatus(rt2x00dev);
47 +       if (rt2800_txstatus_timeout(rt2x00dev))
48 +               rt2800_txdone_nostatus(rt2x00dev);
49  
50         if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
51                 rt2800mmio_enable_interrupt(rt2x00dev,
52 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00.h
53 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00.h
54 @@ -980,6 +980,8 @@ struct rt2x00_dev {
55          */
56         DECLARE_KFIFO_PTR(txstatus_fifo, u32);
57  
58 +       unsigned long last_nostatus_check;
59 +
60         /*
61          * Timer to ensure tx status reports are read (rt2800usb).
62          */
63 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
64 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00queue.c
65 @@ -1039,6 +1039,7 @@ void rt2x00queue_start_queues(struct rt2
66          */
67         tx_queue_for_each(rt2x00dev, queue)
68                 rt2x00queue_start_queue(queue);
69 +       rt2x00dev->last_nostatus_check = jiffies;
70  
71         rt2x00queue_start_queue(rt2x00dev->rx);
72  }