355-mac80211-run-late-dequeue-late-tx-handlers-without-h.patch 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From: Felix Fietkau <[email protected]>
  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. Reduces lock contention on enqueue/dequeue of iTXQ packets
  6. Signed-off-by: Felix Fietkau <[email protected]>
  7. ---
  8. --- a/net/mac80211/tx.c
  9. +++ b/net/mac80211/tx.c
  10. @@ -3507,6 +3507,7 @@ struct sk_buff *ieee80211_tx_dequeue(str
  11. ieee80211_tx_result r;
  12. struct ieee80211_vif *vif = txq->vif;
  13. +begin:
  14. spin_lock_bh(&fq->lock);
  15. if (test_bit(IEEE80211_TXQ_STOP, &txqi->flags) ||
  16. @@ -3523,11 +3524,12 @@ struct sk_buff *ieee80211_tx_dequeue(str
  17. if (skb)
  18. goto out;
  19. -begin:
  20. skb = fq_tin_dequeue(fq, tin, fq_tin_dequeue_func);
  21. if (!skb)
  22. goto out;
  23. + spin_unlock_bh(&fq->lock);
  24. +
  25. hdr = (struct ieee80211_hdr *)skb->data;
  26. info = IEEE80211_SKB_CB(skb);
  27. @@ -3573,8 +3575,11 @@ begin:
  28. skb = __skb_dequeue(&tx.skbs);
  29. - if (!skb_queue_empty(&tx.skbs))
  30. + if (!skb_queue_empty(&tx.skbs)) {
  31. + spin_lock_bh(&fq->lock);
  32. skb_queue_splice_tail(&tx.skbs, &txqi->frags);
  33. + spin_unlock_bh(&fq->lock);
  34. + }
  35. }
  36. if (skb && skb_has_frag_list(skb) &&
  37. @@ -3613,6 +3618,7 @@ begin:
  38. }
  39. IEEE80211_SKB_CB(skb)->control.vif = vif;
  40. + return skb;
  41. out:
  42. spin_unlock_bh(&fq->lock);