1
0

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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. From 56646adf9cd60b488ddc5633a2d9aa1f30efa5db Mon Sep 17 00:00:00 2001
  2. From: Stanislaw Gruszka <sgruszka@redhat.com>
  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 <sgruszka@redhat.com>
  8. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  9. ---
  10. drivers/net/wireless/ralink/rt2x00/rt2x00dev.c | 51 +++++++++++++++-----------
  11. 1 file changed, 29 insertions(+), 22 deletions(-)
  12. diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  13. index b5d90fefc96b..03b368ac9cb6 100644
  14. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  15. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
  16. @@ -391,6 +391,32 @@ static void rt2x00lib_fill_tx_status(struct rt2x00_dev *rt2x00dev,
  17. }
  18. }
  19. +static void rt2x00lib_clear_entry(struct rt2x00_dev *rt2x00dev,
  20. + struct queue_entry *entry)
  21. +{
  22. + /*
  23. + * Make this entry available for reuse.
  24. + */
  25. + entry->skb = NULL;
  26. + entry->flags = 0;
  27. +
  28. + rt2x00dev->ops->lib->clear_entry(entry);
  29. +
  30. + rt2x00queue_index_inc(entry, Q_INDEX_DONE);
  31. +
  32. + /*
  33. + * If the data queue was below the threshold before the txdone
  34. + * handler we must make sure the packet queue in the mac80211 stack
  35. + * is reenabled when the txdone handler has finished. This has to be
  36. + * serialized with rt2x00mac_tx(), otherwise we can wake up queue
  37. + * before it was stopped.
  38. + */
  39. + spin_lock_bh(&entry->queue->tx_lock);
  40. + if (!rt2x00queue_threshold(entry->queue))
  41. + rt2x00queue_unpause_queue(entry->queue);
  42. + spin_unlock_bh(&entry->queue->tx_lock);
  43. +}
  44. +
  45. void rt2x00lib_txdone(struct queue_entry *entry,
  46. struct txdone_entry_desc *txdesc)
  47. {
  48. @@ -471,30 +497,11 @@ void rt2x00lib_txdone(struct queue_entry *entry,
  49. ieee80211_tx_status(rt2x00dev->hw, entry->skb);
  50. else
  51. ieee80211_tx_status_ni(rt2x00dev->hw, entry->skb);
  52. - } else
  53. + } else {
  54. dev_kfree_skb_any(entry->skb);
  55. + }
  56. - /*
  57. - * Make this entry available for reuse.
  58. - */
  59. - entry->skb = NULL;
  60. - entry->flags = 0;
  61. -
  62. - rt2x00dev->ops->lib->clear_entry(entry);
  63. -
  64. - rt2x00queue_index_inc(entry, Q_INDEX_DONE);
  65. -
  66. - /*
  67. - * If the data queue was below the threshold before the txdone
  68. - * handler we must make sure the packet queue in the mac80211 stack
  69. - * is reenabled when the txdone handler has finished. This has to be
  70. - * serialized with rt2x00mac_tx(), otherwise we can wake up queue
  71. - * before it was stopped.
  72. - */
  73. - spin_lock_bh(&entry->queue->tx_lock);
  74. - if (!rt2x00queue_threshold(entry->queue))
  75. - rt2x00queue_unpause_queue(entry->queue);
  76. - spin_unlock_bh(&entry->queue->tx_lock);
  77. + rt2x00lib_clear_entry(rt2x00dev, entry);
  78. }
  79. EXPORT_SYMBOL_GPL(rt2x00lib_txdone);
  80. --
  81. 2.12.1