mac80211: Update to version 4.19.221
[librecmc/librecmc.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 @@ -3538,6 +3538,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 @@ -3554,11 +3555,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 @@ -3622,8 +3624,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 @@ -3662,6 +3667,7 @@ begin:
49         }
50  
51         IEEE80211_SKB_CB(skb)->control.vif = vif;
52 +       return skb;
53  
54  out:
55         spin_unlock_bh(&fq->lock);