358-mac80211-make-ieee80211_schedule_txq-schedule-empty-.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. From: Felix Fietkau <nbd@nbd.name>
  2. Date: Sun, 17 Mar 2019 14:26:59 +0100
  3. Subject: [PATCH] mac80211: make ieee80211_schedule_txq schedule empty TXQs
  4. Currently there is no way for the driver to signal to mac80211 that it should
  5. schedule a TXQ even if there are no packets on the mac80211 part of that queue.
  6. This is problematic if the driver has an internal retry queue to deal with
  7. software A-MPDU retry.
  8. This patch changes the behavior of ieee80211_schedule_txq to always schedule
  9. the queue, as its only user (ath9k) seems to expect such behavior already:
  10. it calls this function on tx status and on powersave wakeup whenever its
  11. internal retry queue is not empty.
  12. Also add an extra argument to ieee80211_return_txq to get the same behavior.
  13. This fixes an issue on ath9k where tx queues with packets to retry (and no
  14. new packets in mac80211) would not get serviced.
  15. Fixes: 89cea7493a346 ("ath9k: Switch to mac80211 TXQ scheduling and airtime APIs")
  16. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  17. ---
  18. --- a/include/net/mac80211.h
  19. +++ b/include/net/mac80211.h
  20. @@ -6090,26 +6090,42 @@ static inline void ieee80211_txq_schedul
  21. {
  22. }
  23. +void __ieee80211_schedule_txq(struct ieee80211_hw *hw,
  24. + struct ieee80211_txq *txq, bool force);
  25. +
  26. /**
  27. * ieee80211_schedule_txq - schedule a TXQ for transmission
  28. *
  29. * @hw: pointer as obtained from ieee80211_alloc_hw()
  30. * @txq: pointer obtained from station or virtual interface
  31. *
  32. - * Schedules a TXQ for transmission if it is not already scheduled.
  33. + * Schedules a TXQ for transmission if it is not already scheduled,
  34. + * even if mac80211 does not have any packets buffered.
  35. + *
  36. + * The driver may call this function if it has buffered packets for
  37. + * this TXQ internally.
  38. */
  39. -void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq);
  40. +static inline void
  41. +ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
  42. +{
  43. + __ieee80211_schedule_txq(hw, txq, true);
  44. +}
  45. /**
  46. * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq()
  47. *
  48. * @hw: pointer as obtained from ieee80211_alloc_hw()
  49. * @txq: pointer obtained from station or virtual interface
  50. + * @force: schedule txq even if mac80211 does not have any buffered packets.
  51. + *
  52. + * The driver may set force=true if it has buffered packets for this TXQ
  53. + * internally.
  54. */
  55. static inline void
  56. -ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
  57. +ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq,
  58. + bool force)
  59. {
  60. - ieee80211_schedule_txq(hw, txq);
  61. + __ieee80211_schedule_txq(hw, txq, force);
  62. }
  63. /**
  64. --- a/net/mac80211/tx.c
  65. +++ b/net/mac80211/tx.c
  66. @@ -3673,8 +3673,9 @@ out:
  67. }
  68. EXPORT_SYMBOL(ieee80211_next_txq);
  69. -void ieee80211_schedule_txq(struct ieee80211_hw *hw,
  70. - struct ieee80211_txq *txq)
  71. +void __ieee80211_schedule_txq(struct ieee80211_hw *hw,
  72. + struct ieee80211_txq *txq,
  73. + bool force)
  74. {
  75. struct ieee80211_local *local = hw_to_local(hw);
  76. struct txq_info *txqi = to_txq_info(txq);
  77. @@ -3682,7 +3683,8 @@ void ieee80211_schedule_txq(struct ieee8
  78. spin_lock_bh(&local->active_txq_lock[txq->ac]);
  79. if (list_empty(&txqi->schedule_order) &&
  80. - (!skb_queue_empty(&txqi->frags) || txqi->tin.backlog_packets)) {
  81. + (force || !skb_queue_empty(&txqi->frags) ||
  82. + txqi->tin.backlog_packets)) {
  83. /* If airtime accounting is active, always enqueue STAs at the
  84. * head of the list to ensure that they only get moved to the
  85. * back by the airtime DRR scheduler once they have a negative
  86. @@ -3702,7 +3704,7 @@ void ieee80211_schedule_txq(struct ieee8
  87. spin_unlock_bh(&local->active_txq_lock[txq->ac]);
  88. }
  89. -EXPORT_SYMBOL(ieee80211_schedule_txq);
  90. +EXPORT_SYMBOL(__ieee80211_schedule_txq);
  91. bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw,
  92. struct ieee80211_txq *txq)