b5b06cdde95faeab8f1e74c573e484654de1609f
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / subsys / 323-mac80211-Expose-ieee80211_schedule_txq-function.patch
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
8 Since we reworked ieee80211_return_txq() so it assumes that the caller
9 takes care of logging, we need another function that can be called without
10 holding any locks. Introduce ieee80211_schedule_txq() which serves this
11 purpose.
12
13 Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
14 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
15 ---
16
17 --- a/include/net/mac80211.h
18 +++ b/include/net/mac80211.h
19 @@ -6074,6 +6074,19 @@ void ieee80211_txq_schedule_end(struct i
20 __releases(txq_lock);
21
22 /**
23 + * ieee80211_schedule_txq - schedule a TXQ for transmission
24 + *
25 + * @hw: pointer as obtained from ieee80211_alloc_hw()
26 + * @txq: pointer obtained from station or virtual interface
27 + *
28 + * Schedules a TXQ for transmission if it is not already scheduled. Takes a
29 + * lock, which means it must *not* be called between
30 + * ieee80211_txq_schedule_start() and ieee80211_txq_schedule_end()
31 + */
32 +void ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
33 + __acquires(txq_lock) __releases(txq_lock);
34 +
35 +/**
36 * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit
37 *
38 * This function is used to check whether given txq is allowed to transmit by
39 --- a/net/mac80211/driver-ops.h
40 +++ b/net/mac80211/driver-ops.h
41 @@ -1179,9 +1179,7 @@ static inline void drv_wake_tx_queue(str
42 static inline void schedule_and_wake_txq(struct ieee80211_local *local,
43 struct txq_info *txqi)
44 {
45 - spin_lock_bh(&local->active_txq_lock[txqi->txq.ac]);
46 - ieee80211_return_txq(&local->hw, &txqi->txq);
47 - spin_unlock_bh(&local->active_txq_lock[txqi->txq.ac]);
48 + ieee80211_schedule_txq(&local->hw, &txqi->txq);
49 drv_wake_tx_queue(local, txqi);
50 }
51
52 --- a/net/mac80211/tx.c
53 +++ b/net/mac80211/tx.c
54 @@ -3673,6 +3673,19 @@ void ieee80211_return_txq(struct ieee802
55 }
56 EXPORT_SYMBOL(ieee80211_return_txq);
57
58 +void ieee80211_schedule_txq(struct ieee80211_hw *hw,
59 + struct ieee80211_txq *txq)
60 + __acquires(txq_lock) __releases(txq_lock)
61 +{
62 + struct ieee80211_local *local = hw_to_local(hw);
63 + struct txq_info *txqi = to_txq_info(txq);
64 +
65 + spin_lock_bh(&local->active_txq_lock[txq->ac]);
66 + ieee80211_return_txq(hw, txq);
67 + spin_unlock_bh(&local->active_txq_lock[txq->ac]);
68 +}
69 +EXPORT_SYMBOL(ieee80211_schedule_txq);
70 +
71 bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw,
72 struct ieee80211_txq *txq)
73 {