323-mac80211-Expose-ieee80211_schedule_txq-function.patch 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@redhat.com>
  2. Date: Tue, 22 Jan 2019 15:20:16 +0100
  3. Subject: [PATCH] mac80211: Expose ieee80211_schedule_txq() function
  4. MIME-Version: 1.0
  5. Content-Type: text/plain; charset=UTF-8
  6. Content-Transfer-Encoding: 8bit
  7. Since we reworked ieee80211_return_txq() so it assumes that the caller
  8. takes care of logging, we need another function that can be called without
  9. holding any locks. Introduce ieee80211_schedule_txq() which serves this
  10. purpose.
  11. Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
  12. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  13. ---
  14. --- a/include/net/mac80211.h
  15. +++ b/include/net/mac80211.h
  16. @@ -6074,6 +6074,19 @@ void ieee80211_txq_schedule_end(struct i
  17. __releases(txq_lock);
  18. /**
  19. + * ieee80211_schedule_txq - schedule a TXQ for transmission
  20. + *
  21. + * @hw: pointer as obtained from ieee80211_alloc_hw()
  22. + * @txq: pointer obtained from station or virtual interface
  23. + *
  24. + * Schedules a TXQ for transmission if it is not already scheduled. Takes a
  25. + * lock, which means it must *not* be called between
  26. + * ieee80211_txq_schedule_start() and ieee80211_txq_schedule_end()
  27. + */
  28. +void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
  29. + __acquires(txq_lock) __releases(txq_lock);
  30. +
  31. +/**
  32. * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit
  33. *
  34. * This function is used to check whether given txq is allowed to transmit by
  35. --- a/net/mac80211/driver-ops.h
  36. +++ b/net/mac80211/driver-ops.h
  37. @@ -1179,9 +1179,7 @@ static inline void drv_wake_tx_queue(str
  38. static inline void schedule_and_wake_txq(struct ieee80211_local *local,
  39. struct txq_info *txqi)
  40. {
  41. - spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]);
  42. - ieee80211_return_txq(&local->hw, &txqi->txq);
  43. - spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]);
  44. + ieee80211_schedule_txq(&local->hw, &txqi->txq);
  45. drv_wake_tx_queue(local, txqi);
  46. }
  47. --- a/net/mac80211/tx.c
  48. +++ b/net/mac80211/tx.c
  49. @@ -3693,6 +3693,19 @@ void ieee80211_return_txq(struct ieee802
  50. }
  51. EXPORT_SYMBOL(ieee80211_return_txq);
  52. +void ieee80211_schedule_txq(struct ieee80211_hw *hw,
  53. + struct ieee80211_txq *txq)
  54. + __acquires(txq_lock) __releases(txq_lock)
  55. +{
  56. + struct ieee80211_local *local = hw_to_local(hw);
  57. + struct txq_info *txqi = to_txq_info(txq);
  58. +
  59. + spin_lock_bh(&local->active_txq_lock[txq->ac]);
  60. + ieee80211_return_txq(hw, txq);
  61. + spin_unlock_bh(&local->active_txq_lock[txq->ac]);
  62. +}
  63. +EXPORT_SYMBOL(ieee80211_schedule_txq);
  64. +
  65. bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw,
  66. struct ieee80211_txq *txq)
  67. {