Skip to content

Commit fb0e76a

Browse files
erstromjmberg-intel
authored andcommitted
mac80211: add tx dequeue function for process context
Since ieee80211_tx_dequeue() must not be called with softirqs enabled (i.e. from process context without proper disable of bottom halves), we add a wrapper that disables bottom halves before calling ieee80211_tx_dequeue() The new function is named ieee80211_tx_dequeue_ni() just as all other from-process-context versions found in mac80211. The documentation of ieee80211_tx_dequeue() is also updated so it mentions that the function should not be called from process context. Signed-off-by: Erik Stromdahl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent a11e2f8 commit fb0e76a

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

include/net/mac80211.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6234,10 +6234,36 @@ void ieee80211_unreserve_tid(struct ieee80211_sta *sta, u8 tid);
62346234
* but for the duration of the frame handling.
62356235
* However, also note that while in the wake_tx_queue() method,
62366236
* rcu_read_lock() is already held.
6237+
*
6238+
* softirqs must also be disabled when this function is called.
6239+
* In process context, use ieee80211_tx_dequeue_ni() instead.
62376240
*/
62386241
struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
62396242
struct ieee80211_txq *txq);
62406243

6244+
/**
6245+
* ieee80211_tx_dequeue_ni - dequeue a packet from a software tx queue
6246+
* (in process context)
6247+
*
6248+
* Like ieee80211_tx_dequeue() but can be called in process context
6249+
* (internally disables bottom halves).
6250+
*
6251+
* @hw: pointer as obtained from ieee80211_alloc_hw()
6252+
* @txq: pointer obtained from station or virtual interface, or from
6253+
* ieee80211_next_txq()
6254+
*/
6255+
static inline struct sk_buff *ieee80211_tx_dequeue_ni(struct ieee80211_hw *hw,
6256+
struct ieee80211_txq *txq)
6257+
{
6258+
struct sk_buff *skb;
6259+
6260+
local_bh_disable();
6261+
skb = ieee80211_tx_dequeue(hw, txq);
6262+
local_bh_enable();
6263+
6264+
return skb;
6265+
}
6266+
62416267
/**
62426268
* ieee80211_next_txq - get next tx queue to pull packets from
62436269
*

net/mac80211/tx.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3546,6 +3546,8 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
35463546
ieee80211_tx_result r;
35473547
struct ieee80211_vif *vif = txq->vif;
35483548

3549+
WARN_ON_ONCE(softirq_count() == 0);
3550+
35493551
begin:
35503552
spin_lock_bh(&fq->lock);
35513553

0 commit comments

Comments
 (0)