020-11-rt2x00-separte-clearing-entry-from-rt2x00lib_txdone.patch 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. From 56646adf9cd60b488ddc5633a2d9aa1f30efa5db Mon Sep 17 00:00:00 2001
  2. From: Stanislaw Gruszka <[email protected]>
  3. Date: Wed, 15 Feb 2017 10:25:07 +0100
  4. Subject: [PATCH 11/19] rt2x00: separte clearing entry from rt2x00lib_txdone
  5. This makes rt2x00lib_txdone a bit simpler and will allow to reuse
  6. code in different variant of txdone which I'm preparing.
  7. Signed-off-by: Stanislaw Gruszka <[email protected]>
  8. Signed-off-by: Kalle Valo <[email protected]>
  9. ---
  10. drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 51 +++++++++++++++-----------
  11. 1 file changed, 29 insertions(+), 22 deletions(-)
  12. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  13. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  14. @@ -391,6 +391,32 @@ static void rt2x00lib_fill_tx_status(str
  15. }
  16. }
  17. +static void rt2x00lib_clear_entry(struct rt2x00_dev *rt2x00dev,
  18. + struct queue_entry *entry)
  19. +{
  20. + /*
  21. + * Make this entry available for reuse.
  22. + */
  23. + entry->skb = NULL;
  24. + entry->flags = 0;
  25. +
  26. + rt2x00dev->ops->lib->clear_entry(entry);
  27. +
  28. + rt2x00queue_index_inc(entry, Q_INDEX_DONE);
  29. +
  30. + /*
  31. + * If the data queue was below the threshold before the txdone
  32. + * handler we must make sure the packet queue in the mac80211 stack
  33. + * is reenabled when the txdone handler has finished. This has to be
  34. + * serialized with rt2x00mac_tx(), otherwise we can wake up queue
  35. + * before it was stopped.
  36. + */
  37. + spin_lock_bh(&entry->queue->tx_lock);
  38. + if (!rt2x00queue_threshold(entry->queue))
  39. + rt2x00queue_unpause_queue(entry->queue);
  40. + spin_unlock_bh(&entry->queue->tx_lock);
  41. +}
  42. +
  43. void rt2x00lib_txdone(struct queue_entry *entry,
  44. struct txdone_entry_desc *txdesc)
  45. {
  46. @@ -471,30 +497,11 @@ void rt2x00lib_txdone(struct queue_entry
  47. ieee80211_tx_status(rt2x00dev->hw, entry->skb);
  48. else
  49. ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb);
  50. - } else
  51. + } else {
  52. dev_kfree_skb_any(entry->skb);
  53. + }
  54. - /*
  55. - * Make this entry available for reuse.
  56. - */
  57. - entry->skb = NULL;
  58. - entry->flags = 0;
  59. -
  60. - rt2x00dev->ops->lib->clear_entry(entry);
  61. -
  62. - rt2x00queue_index_inc(entry, Q_INDEX_DONE);
  63. -
  64. - /*
  65. - * If the data queue was below the threshold before the txdone
  66. - * handler we must make sure the packet queue in the mac80211 stack
  67. - * is reenabled when the txdone handler has finished. This has to be
  68. - * serialized with rt2x00mac_tx(), otherwise we can wake up queue
  69. - * before it was stopped.
  70. - */
  71. - spin_lock_bh(&entry->queue->tx_lock);
  72. - if (!rt2x00queue_threshold(entry->queue))
  73. - rt2x00queue_unpause_queue(entry->queue);
  74. - spin_unlock_bh(&entry->queue->tx_lock);
  75. + rt2x00lib_clear_entry(rt2x00dev, entry);
  76. }
  77. EXPORT_SYMBOL_GPL(rt2x00lib_txdone);