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