313-mac80211-fix-unnecessary-frame-drops-in-mesh-fwding.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. From: Michal Kazior <michal.kazior@tieto.com>
  2. Date: Mon, 25 Jan 2016 14:43:24 +0100
  3. Subject: [PATCH] mac80211: fix unnecessary frame drops in mesh fwding
  4. The ieee80211_queue_stopped() expects hw queue
  5. number but it was given raw WMM AC number instead.
  6. This could cause frame drops and problems with
  7. traffic in some cases - most notably if driver
  8. doesn't map AC numbers to queue numbers 1:1 and
  9. uses ieee80211_stop_queues() and
  10. ieee80211_wake_queue() only without ever calling
  11. ieee80211_wake_queues().
  12. On ath10k it was possible to hit this problem in
  13. the following case:
  14. 1. wlan0 uses queue 0
  15. (ath10k maps queues per vif)
  16. 2. offchannel uses queue 15
  17. 3. queues 1-14 are unused
  18. 4. ieee80211_stop_queues()
  19. 5. ieee80211_wake_queue(q=0)
  20. 6. ieee80211_wake_queue(q=15)
  21. (other queues are not woken up because both
  22. driver and mac80211 know other queues are
  23. unused)
  24. 7. ieee80211_rx_h_mesh_fwding()
  25. 8. ieee80211_select_queue_80211() returns 2
  26. 9. ieee80211_queue_stopped(q=2) returns true
  27. 10. frame is dropped (oops!)
  28. Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping")
  29. Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
  30. ---
  31. --- a/net/mac80211/rx.c
  32. +++ b/net/mac80211/rx.c
  33. @@ -2235,7 +2235,7 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  34. struct ieee80211_local *local = rx->local;
  35. struct ieee80211_sub_if_data *sdata = rx->sdata;
  36. struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
  37. - u16 q, hdrlen;
  38. + u16 ac, q, hdrlen;
  39. hdr = (struct ieee80211_hdr *) skb->data;
  40. hdrlen = ieee80211_hdrlen(hdr->frame_control);
  41. @@ -2304,7 +2304,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80
  42. ether_addr_equal(sdata->vif.addr, hdr->addr3))
  43. return RX_CONTINUE;
  44. - q = ieee80211_select_queue_80211(sdata, skb, hdr);
  45. + ac = ieee80211_select_queue_80211(sdata, skb, hdr);
  46. + q = sdata->vif.hw_queue[ac];
  47. if (ieee80211_queue_stopped(&local->hw, q)) {
  48. IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion);
  49. return RX_DROP_MONITOR;