oxnas: also akitio,mycloud uses PCIe apparently
[openwrt/staging/xback.git] / package / kernel / mac80211 / patches / rt2x00 / 024-rt2800mmio-fetch-tx-status-changes.patch
1 From f6a9618198e190a2ba09ce3f0aa8e9ee1763bd38 Mon Sep 17 00:00:00 2001
2 From: Stanislaw Gruszka <sgruszka@redhat.com>
3 Date: Sat, 9 Feb 2019 12:08:34 +0100
4 X-Patchwork-Submitter: Stanislaw Gruszka <sgruszka@redhat.com>
5 X-Patchwork-Id: 10804443
6 X-Patchwork-Delegate: kvalo@adurom.com
7 Subject: [PATCH 24/28] rt2800mmio: fetch tx status changes
8
9 Prepare to use rt2800mmio_fetch_txstatus() in concurrent manner and drop
10 return value since is not longer needed.
11
12 Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
13 ---
14 drivers/net/wireless/ralink/rt2x00/rt2800mmio.c | 17 +++++++++--------
15 1 file changed, 9 insertions(+), 8 deletions(-)
16
17 --- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
18 +++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
19 @@ -255,12 +255,12 @@ void rt2800mmio_autowake_tasklet(unsigne
20 }
21 EXPORT_SYMBOL_GPL(rt2800mmio_autowake_tasklet);
22
23 -static bool rt2800mmio_fetch_txstatus(struct rt2x00_dev *rt2x00dev)
24 +static void rt2800mmio_fetch_txstatus(struct rt2x00_dev *rt2x00dev)
25 {
26 u32 status;
27 - bool more = false;
28 + unsigned long flags;
29
30 - /* FIXEME: rewrite this comment
31 + /*
32 * The TX_FIFO_STATUS interrupt needs special care. We should
33 * read TX_STA_FIFO but we should do it immediately as otherwise
34 * the register can overflow and we would lose status reports.
35 @@ -271,20 +271,21 @@ static bool rt2800mmio_fetch_txstatus(st
36 * because we can schedule the tasklet multiple times (when the
37 * interrupt fires again during tx status processing).
38 *
39 - * txstatus tasklet is called with INT_SOURCE_CSR_TX_FIFO_STATUS
40 - * disabled so have only one producer and one consumer - we don't
41 - * need to lock the kfifo.
42 + * We also read statuses from tx status timeout timer, use
43 + * lock to prevent concurent writes to fifo.
44 */
45 +
46 + spin_lock_irqsave(&rt2x00dev->irqmask_lock, flags);
47 +
48 while (!kfifo_is_full(&rt2x00dev->txstatus_fifo)) {
49 status = rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO);
50 if (!rt2x00_get_field32(status, TX_STA_FIFO_VALID))
51 break;
52
53 kfifo_put(&rt2x00dev->txstatus_fifo, status);
54 - more = true;
55 }
56
57 - return more;
58 + spin_unlock_irqrestore(&rt2x00dev->irqmask_lock, flags);
59 }
60
61 void rt2800mmio_txstatus_tasklet(unsigned long data)