322-mac80211-fix-forwarded-mesh-frames-AC-queue-selectio.patch 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. From: Nicolas Escande <[email protected]>
  2. Date: Mon, 14 Feb 2022 18:32:14 +0100
  3. Subject: [PATCH] mac80211: fix forwarded mesh frames AC & queue selection
  4. There are two problems with the current code that have been highlighted
  5. with the AQL feature that is now enbaled by default.
  6. First problem is in ieee80211_rx_h_mesh_fwding(),
  7. ieee80211_select_queue_80211() is used on received packets to choose
  8. the sending AC queue of the forwarding packet although this function
  9. should only be called on TX packet (it uses ieee80211_tx_info).
  10. This ends with forwarded mesh packets been sent on unrelated random AC
  11. queue. To fix that, AC queue can directly be infered from skb->priority
  12. which has been extracted from QOS info (see ieee80211_parse_qos()).
  13. Second problem is the value of queue_mapping set on forwarded mesh
  14. frames via skb_set_queue_mapping() is not the AC of the packet but a
  15. hardware queue index. This may or may not work depending on AC to HW
  16. queue mapping which is driver specific.
  17. Both of these issues lead to improper AC selection while forwarding
  18. mesh packets but more importantly due to improper airtime accounting
  19. (which is done on a per STA, per AC basis) caused traffic stall with
  20. the introduction of AQL.
  21. Fixes: cf44012810cc ("mac80211: fix unnecessary frame drops in mesh fwding")
  22. Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping")
  23. Co-developed-by: Remi Pommarel <[email protected]>
  24. Signed-off-by: Remi Pommarel <[email protected]>
  25. Signed-off-by: Nicolas Escande <[email protected]>
  26. ---
  27. --- a/net/mac80211/rx.c
  28. +++ b/net/mac80211/rx.c
  29. @@ -2921,13 +2921,13 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  30. ether_addr_equal(sdata->vif.addr, hdr->addr3))
  31. return RX_CONTINUE;
  32. - ac = ieee80211_select_queue_80211(sdata, skb, hdr);
  33. + ac = ieee802_1d_to_ac[skb->priority];
  34. q = sdata->vif.hw_queue[ac];
  35. if (ieee80211_queue_stopped(&local->hw, q)) {
  36. IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
  37. return RX_DROP_MONITOR;
  38. }
  39. - skb_set_queue_mapping(skb, q);
  40. + skb_set_queue_mapping(skb, ac);
  41. if (!--mesh_hdr->ttl) {
  42. if (!is_multicast_ether_addr(hdr->addr1))