mac80211: add a few performance improvement patches
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / subsys / 355-mac80211-run-late-dequeue-late-tx-handlers-without-h.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sat, 16 Mar 2019 18:00:12 +0100
3 Subject: [PATCH] mac80211: run late dequeue late tx handlers without
4 holding fq->lock
5
6 Reduces lock contention on enqueue/dequeue of iTXQ packets
7
8 Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 ---
10
11 --- a/net/mac80211/tx.c
12 +++ b/net/mac80211/tx.c
13 @@ -3507,6 +3507,7 @@ struct sk_buff *ieee80211_tx_dequeue(str
14 ieee80211_tx_result r;
15 struct ieee80211_vif *vif = txq->vif;
16
17 +begin:
18 spin_lock_bh(&fq->lock);
19
20 if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags) ||
21 @@ -3523,11 +3524,12 @@ struct sk_buff *ieee80211_tx_dequeue(str
22 if (skb)
23 goto out;
24
25 -begin:
26 skb = fq_tin_dequeue(fq, tin, fq_tin_dequeue_func);
27 if (!skb)
28 goto out;
29
30 + spin_unlock_bh(&fq->lock);
31 +
32 hdr = (struct ieee80211_hdr *)skb->data;
33 info = IEEE80211_SKB_CB(skb);
34
35 @@ -3573,8 +3575,11 @@ begin:
36
37 skb = __skb_dequeue(&tx.skbs);
38
39 - if (!skb_queue_empty(&tx.skbs))
40 + if (!skb_queue_empty(&tx.skbs)) {
41 + spin_lock_bh(&fq->lock);
42 skb_queue_splice_tail(&tx.skbs, &txqi->frags);
43 + spin_unlock_bh(&fq->lock);
44 + }
45 }
46
47 if (skb && skb_has_frag_list(skb) &&
48 @@ -3613,6 +3618,7 @@ begin:
49 }
50
51 IEEE80211_SKB_CB(skb)->control.vif = vif;
52 + return skb;
53
54 out:
55 spin_unlock_bh(&fq->lock);