2
0

024-rt2800mmio-fetch-tx-status-changes.patch 2.0 KB

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