mac80211: Expose ieee80211_schedule_txq() function
authorToke Høiland-Jørgensen <toke@redhat.com>
Tue, 22 Jan 2019 14:20:16 +0000 (15:20 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 25 Jan 2019 13:05:27 +0000 (14:05 +0100)
Since we reworked ieee80211_return_txq() so it assumes that the caller
takes care of logging, we need another function that can be called without
holding any locks. Introduce ieee80211_schedule_txq() which serves this
purpose.

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
include/net/mac80211.h
net/mac80211/driver-ops.h
net/mac80211/tx.c

index a285c2bfd14e1ef37731daf14e8edc86e4174af5..294a8a36012a7db3e5c5e02225952562eb842275 100644 (file)
@@ -6209,6 +6209,19 @@ void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac)
 void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac)
        __releases(txq_lock);
 
+/**
+ * ieee80211_schedule_txq - schedule a TXQ for transmission
+ *
+ * @hw: pointer as obtained from ieee80211_alloc_hw()
+ * @txq: pointer obtained from station or virtual interface
+ *
+ * Schedules a TXQ for transmission if it is not already scheduled. Takes a
+ * lock, which means it must *not* be called between
+ * ieee80211_txq_schedule_start() and ieee80211_txq_schedule_end()
+ */
+void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
+       __acquires(txq_lock) __releases(txq_lock);
+
 /**
  * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit
  *
index 1aab1734b26f7016d067928cdb2b609083d2933f..ba3c07b10cd005e10f8e1ac6da935ec1bc27c5d5 100644 (file)
@@ -1176,9 +1176,7 @@ static inline void drv_wake_tx_queue(struct ieee80211_local *local,
 static inline void schedule_and_wake_txq(struct ieee80211_local *local,
                                         struct txq_info *txqi)
 {
-       spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]);
-       ieee80211_return_txq(&local->hw, &txqi->txq);
-       spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]);
+       ieee80211_schedule_txq(&local->hw, &txqi->txq);
        drv_wake_tx_queue(local, txqi);
 }
 
index f46d8d822f86edfaf0ecf34157b56c4031baeed5..037f95e39a450d617afc68073fc2af3d1d93bb16 100644 (file)
@@ -3703,6 +3703,19 @@ void ieee80211_return_txq(struct ieee80211_hw *hw,
 }
 EXPORT_SYMBOL(ieee80211_return_txq);
 
+void ieee80211_schedule_txq(struct ieee80211_hw *hw,
+                           struct ieee80211_txq *txq)
+       __acquires(txq_lock) __releases(txq_lock)
+{
+       struct ieee80211_local *local = hw_to_local(hw);
+       struct txq_info *txqi = to_txq_info(txq);
+
+       spin_lock_bh(&local->active_txq_lock[txq->ac]);
+       ieee80211_return_txq(hw, txq);
+       spin_unlock_bh(&local->active_txq_lock[txq->ac]);
+}
+EXPORT_SYMBOL(ieee80211_schedule_txq);
+
 bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw,
                                struct ieee80211_txq *txq)
 {