diff options
author | Daniel Golle <daniel@makrotopia.org> | 2019-02-13 19:47:18 +0100 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2019-02-19 09:05:34 +0100 |
commit | d4c999bb891725b71ae38416cc6d5cfa99938ae4 (patch) | |
tree | 092236b7f1a2b7c2de42af33619b290c3ea088ec /package/kernel/mac80211/patches/rt2x00/006-rt2800-flush-and-txstatus-rework-for-rt2800mmio.patch | |
parent | 331963717bf4781ead1ff03b56de2802b9e05164 (diff) | |
download | upstream-d4c999bb891725b71ae38416cc6d5cfa99938ae4.tar.gz upstream-d4c999bb891725b71ae38416cc6d5cfa99938ae4.tar.bz2 upstream-d4c999bb891725b71ae38416cc6d5cfa99938ae4.zip |
mac80211: rt2x00: backport accepted and pending patches from upstream
backport from wireless-drivers-next, replacing some existing patches in
our tree (marked with '=' are those which were already present):
f483039cf51a rt2x00: use simple_read_from_buffer()
=5c656c71b1bf rt2800: move usb specific txdone/txstatus routines to rt2800lib
=0b0d556e0ebb rt2800mmio: use txdone/txstatus routines from lib
=5022efb50f62 rt2x00: do not check for txstatus timeout every time on tasklet
=adf26a356f13 rt2x00: use different txstatus timeouts when flushing
=0240564430c0 rt2800: flush and txstatus rework for rt2800mmio
6eba8fd22352 rt2x00: rt2400pci: mark expected switch fall-through
10bb92217747 rt2x00: rt2500pci: mark expected switch fall-through
916e6bbcfcff rt2x00: rt2800lib: mark expected switch fall-throughs
641dd8068ecb rt2x00: rt61pci: mark expected switch fall-through
750afb08ca71 cross-tree: phase out dma_zalloc_coherent()
=c2e28ef7711f rt2x00: reduce tx power to nominal level on RT6352
a4296994eb80 rt2x00: Work around a firmware bug with shared keys
2587791d5758 rt2x00: no need to check return value of debugfs_create functions
pending on linux-wireless:
rt2x00: remove unneeded check
rt2x00: remove confusing AGC register
rt2800: enable TX_PIN_CFG_LNA_PE_ bits per band
rt2800: enable TX_PIN_CFG_RFRX_EN only for MT7620
rt2800: comment and simplify AGC init for RT6352
rt2x00: do not print error when queue is full
rt2800: partially restore old mmio txstatus behaviour
rt2800: new flush implementation for SoC devices
rt2800: move txstatus pending routine
rt2800mmio: fetch tx status changes
rt2800mmio: use timer and work for handling tx statuses timeouts
rt2x00: remove last_nostatus_check
rt2x00: remove not used entry field
rt2x00mmio: remove legacy comment
While at it also rename some existing patches now that there are
separate folders with patches for each driver to make things a bit
nicer to handle.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'package/kernel/mac80211/patches/rt2x00/006-rt2800-flush-and-txstatus-rework-for-rt2800mmio.patch')
-rw-r--r-- | package/kernel/mac80211/patches/rt2x00/006-rt2800-flush-and-txstatus-rework-for-rt2800mmio.patch | 238 |
1 files changed, 238 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/rt2x00/006-rt2800-flush-and-txstatus-rework-for-rt2800mmio.patch b/package/kernel/mac80211/patches/rt2x00/006-rt2800-flush-and-txstatus-rework-for-rt2800mmio.patch new file mode 100644 index 0000000000..784fbb16f1 --- /dev/null +++ b/package/kernel/mac80211/patches/rt2x00/006-rt2800-flush-and-txstatus-rework-for-rt2800mmio.patch @@ -0,0 +1,238 @@ +From 0240564430c0697d8fde3743d70346a922466b36 Mon Sep 17 00:00:00 2001 +From: Stanislaw Gruszka <sgruszka@redhat.com> +Date: Wed, 26 Sep 2018 12:24:57 +0200 +Subject: [PATCH 06/28] rt2800: flush and txstatus rework for rt2800mmio + +Implement custom rt2800mmio flush routine and change txstatus +routine to read TX_STA_FIFO also in the tasklet. + +Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> +Signed-off-by: Kalle Valo <kvalo@codeaurora.org> +--- + .../net/wireless/ralink/rt2x00/rt2800lib.c | 14 +-- + .../net/wireless/ralink/rt2x00/rt2800mmio.c | 118 +++++++++++++----- + .../net/wireless/ralink/rt2x00/rt2800mmio.h | 1 + + .../net/wireless/ralink/rt2x00/rt2800pci.c | 2 +- + 4 files changed, 97 insertions(+), 38 deletions(-) + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c +@@ -1147,7 +1147,7 @@ static inline bool rt2800_entry_txstatus + return false; + + if (test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags)) +- tout = msecs_to_jiffies(100); ++ tout = msecs_to_jiffies(50); + else + tout = msecs_to_jiffies(2000); + +@@ -1163,15 +1163,13 @@ bool rt2800_txstatus_timeout(struct rt2x + { + struct data_queue *queue; + struct queue_entry *entry; +- unsigned long tout; + +- if (test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags)) +- tout = msecs_to_jiffies(50); +- else +- tout = msecs_to_jiffies(1000); ++ if (!test_bit(DEVICE_STATE_FLUSHING, &rt2x00dev->flags)) { ++ unsigned long tout = msecs_to_jiffies(1000); + +- if (time_before(jiffies, rt2x00dev->last_nostatus_check + tout)) +- return false; ++ if (time_before(jiffies, rt2x00dev->last_nostatus_check + tout)) ++ return false; ++ } + + rt2x00dev->last_nostatus_check = jiffies; + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.c +@@ -191,21 +191,6 @@ static inline void rt2800mmio_enable_int + spin_unlock_irq(&rt2x00dev->irqmask_lock); + } + +-void rt2800mmio_txstatus_tasklet(unsigned long data) +-{ +- struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; +- +- rt2800_txdone(rt2x00dev); +- +- if (rt2800_txstatus_timeout(rt2x00dev)) +- rt2800_txdone_nostatus(rt2x00dev); +- +- if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) +- rt2800mmio_enable_interrupt(rt2x00dev, +- INT_SOURCE_CSR_TX_FIFO_STATUS); +-} +-EXPORT_SYMBOL_GPL(rt2800mmio_txstatus_tasklet); +- + void rt2800mmio_pretbtt_tasklet(unsigned long data) + { + struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; +@@ -270,12 +255,26 @@ void rt2800mmio_autowake_tasklet(unsigne + } + EXPORT_SYMBOL_GPL(rt2800mmio_autowake_tasklet); + +-static void rt2800mmio_txstatus_interrupt(struct rt2x00_dev *rt2x00dev) ++static void rt2800mmio_txdone(struct rt2x00_dev *rt2x00dev) ++{ ++ bool timeout = false; ++ ++ while (!kfifo_is_empty(&rt2x00dev->txstatus_fifo) || ++ (timeout = rt2800_txstatus_timeout(rt2x00dev))) { ++ ++ rt2800_txdone(rt2x00dev); ++ ++ if (timeout) ++ rt2800_txdone_nostatus(rt2x00dev); ++ } ++} ++ ++static bool rt2800mmio_fetch_txstatus(struct rt2x00_dev *rt2x00dev) + { + u32 status; +- int i; ++ bool more = false; + +- /* ++ /* FIXEME: rewrite this comment + * The TX_FIFO_STATUS interrupt needs special care. We should + * read TX_STA_FIFO but we should do it immediately as otherwise + * the register can overflow and we would lose status reports. +@@ -286,25 +285,37 @@ static void rt2800mmio_txstatus_interrup + * because we can schedule the tasklet multiple times (when the + * interrupt fires again during tx status processing). + * +- * Since we have only one producer and one consumer we don't ++ * txstatus tasklet is called with INT_SOURCE_CSR_TX_FIFO_STATUS ++ * disabled so have only one producer and one consumer - we don't + * need to lock the kfifo. + */ +- for (i = 0; i < rt2x00dev->tx->limit; i++) { ++ while (!kfifo_is_full(&rt2x00dev->txstatus_fifo)) { + status = rt2x00mmio_register_read(rt2x00dev, TX_STA_FIFO); +- + if (!rt2x00_get_field32(status, TX_STA_FIFO_VALID)) + break; + +- if (!kfifo_put(&rt2x00dev->txstatus_fifo, status)) { +- rt2x00_warn(rt2x00dev, "TX status FIFO overrun, drop tx status report\n"); +- break; +- } ++ kfifo_put(&rt2x00dev->txstatus_fifo, status); ++ more = true; + } + +- /* Schedule the tasklet for processing the tx status. */ +- tasklet_schedule(&rt2x00dev->txstatus_tasklet); ++ return more; + } + ++void rt2800mmio_txstatus_tasklet(unsigned long data) ++{ ++ struct rt2x00_dev *rt2x00dev = (struct rt2x00_dev *)data; ++ ++ do { ++ rt2800mmio_txdone(rt2x00dev); ++ ++ } while (rt2800mmio_fetch_txstatus(rt2x00dev)); ++ ++ if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) ++ rt2800mmio_enable_interrupt(rt2x00dev, ++ INT_SOURCE_CSR_TX_FIFO_STATUS); ++} ++EXPORT_SYMBOL_GPL(rt2800mmio_txstatus_tasklet); ++ + irqreturn_t rt2800mmio_interrupt(int irq, void *dev_instance) + { + struct rt2x00_dev *rt2x00dev = dev_instance; +@@ -327,8 +338,10 @@ irqreturn_t rt2800mmio_interrupt(int irq + */ + mask = ~reg; + +- if (rt2x00_get_field32(reg, INT_SOURCE_CSR_TX_FIFO_STATUS)) +- rt2800mmio_txstatus_interrupt(rt2x00dev); ++ if (rt2x00_get_field32(reg, INT_SOURCE_CSR_TX_FIFO_STATUS)) { ++ rt2800mmio_fetch_txstatus(rt2x00dev); ++ tasklet_schedule(&rt2x00dev->txstatus_tasklet); ++ } + + if (rt2x00_get_field32(reg, INT_SOURCE_CSR_PRE_TBTT)) + tasklet_hi_schedule(&rt2x00dev->pretbtt_tasklet); +@@ -453,6 +466,53 @@ void rt2800mmio_kick_queue(struct data_q + } + EXPORT_SYMBOL_GPL(rt2800mmio_kick_queue); + ++void rt2800mmio_flush_queue(struct data_queue *queue, bool drop) ++{ ++ struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; ++ bool tx_queue = false; ++ unsigned int i; ++ ++ switch (queue->qid) { ++ case QID_AC_VO: ++ case QID_AC_VI: ++ case QID_AC_BE: ++ case QID_AC_BK: ++ tx_queue = true; ++ break; ++ case QID_RX: ++ break; ++ default: ++ return; ++ } ++ ++ for (i = 0; i < 5; i++) { ++ /* ++ * Check if the driver is already done, otherwise we ++ * have to sleep a little while to give the driver/hw ++ * the oppurtunity to complete interrupt process itself. ++ */ ++ if (rt2x00queue_empty(queue)) ++ break; ++ ++ /* ++ * For TX queues schedule completion tasklet to catch ++ * tx status timeouts, othewise just wait. ++ */ ++ if (tx_queue) { ++ tasklet_disable(&rt2x00dev->txstatus_tasklet); ++ rt2800mmio_txdone(rt2x00dev); ++ tasklet_enable(&rt2x00dev->txstatus_tasklet); ++ } ++ ++ /* ++ * Wait for a little while to give the driver ++ * the oppurtunity to recover itself. ++ */ ++ msleep(50); ++ } ++} ++EXPORT_SYMBOL_GPL(rt2800mmio_flush_queue); ++ + void rt2800mmio_stop_queue(struct data_queue *queue) + { + struct rt2x00_dev *rt2x00dev = queue->rt2x00dev; +--- a/drivers/net/wireless/ralink/rt2x00/rt2800mmio.h ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800mmio.h +@@ -148,6 +148,7 @@ void rt2800mmio_toggle_irq(struct rt2x00 + /* Queue handlers */ + void rt2800mmio_start_queue(struct data_queue *queue); + void rt2800mmio_kick_queue(struct data_queue *queue); ++void rt2800mmio_flush_queue(struct data_queue *queue, bool drop); + void rt2800mmio_stop_queue(struct data_queue *queue); + void rt2800mmio_queue_init(struct data_queue *queue); + +--- a/drivers/net/wireless/ralink/rt2x00/rt2800pci.c ++++ b/drivers/net/wireless/ralink/rt2x00/rt2800pci.c +@@ -364,7 +364,7 @@ static const struct rt2x00lib_ops rt2800 + .start_queue = rt2800mmio_start_queue, + .kick_queue = rt2800mmio_kick_queue, + .stop_queue = rt2800mmio_stop_queue, +- .flush_queue = rt2x00mmio_flush_queue, ++ .flush_queue = rt2800mmio_flush_queue, + .write_tx_desc = rt2800mmio_write_tx_desc, + .write_tx_data = rt2800_write_tx_data, + .write_beacon = rt2800_write_beacon, |