mac80211: backport airtime queue limits support
[openwrt/staging/wigyori.git] / package / kernel / mac80211 / patches / subsys / 353-mac80211-use-more-bits-for-ack_frame_id.patch
1 From: Johannes Berg <johannes.berg@intel.com>
2 Date: Wed, 15 Jan 2020 12:25:50 +0100
3 Subject: [PATCH] mac80211: use more bits for ack_frame_id
4 MIME-Version: 1.0
5 Content-Type: text/plain; charset=UTF-8
6 Content-Transfer-Encoding: 8bit
7
8 It turns out that this wasn't a good idea, I hit a test failure in
9 hwsim due to this. That particular failure was easily worked around,
10 but it raised questions: if an AP needs to, for example, send action
11 frames to each connected station, the current limit is nowhere near
12 enough (especially if those stations are sleeping and the frames are
13 queued for a while.)
14
15 Shuffle around some bits to make more room for ack_frame_id to allow
16 up to 8192 queued up frames, that's enough for queueing 4 frames to
17 each connected station, even at the maximum of 2007 stations on a
18 single AP.
19
20 We take the bits from band (which currently only 2 but I leave 3 in
21 case we add another band) and from the hw_queue, which can only need
22 4 since it has a limit of 16 queues.
23
24 Fixes: 6912daed05e1 ("mac80211: Shrink the size of ack_frame_id to make room for tx_time_est")
25 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
26 Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
27 ---
28
29 --- a/include/net/mac80211.h
30 +++ b/include/net/mac80211.h
31 @@ -1004,12 +1004,11 @@ ieee80211_rate_get_vht_nss(const struct
32 struct ieee80211_tx_info {
33 /* common information */
34 u32 flags;
35 - u8 band;
36 -
37 - u8 hw_queue;
38 -
39 - u16 ack_frame_id:6;
40 - u16 tx_time_est:10;
41 + u32 band:3,
42 + ack_frame_id:13,
43 + hw_queue:4,
44 + tx_time_est:10;
45 + /* 2 free bits */
46
47 union {
48 struct {
49 --- a/net/mac80211/cfg.c
50 +++ b/net/mac80211/cfg.c
51 @@ -3427,7 +3427,7 @@ int ieee80211_attach_ack_skb(struct ieee
52
53 spin_lock_irqsave(&local->ack_status_lock, spin_flags);
54 id = idr_alloc(&local->ack_status_frames, ack_skb,
55 - 1, 0x40, GFP_ATOMIC);
56 + 1, 0x2000, GFP_ATOMIC);
57 spin_unlock_irqrestore(&local->ack_status_lock, spin_flags);
58
59 if (id < 0) {
60 --- a/net/mac80211/tx.c
61 +++ b/net/mac80211/tx.c
62 @@ -2443,7 +2443,7 @@ static int ieee80211_store_ack_skb(struc
63
64 spin_lock_irqsave(&local->ack_status_lock, flags);
65 id = idr_alloc(&local->ack_status_frames, ack_skb,
66 - 1, 0x40, GFP_ATOMIC);
67 + 1, 0x2000, GFP_ATOMIC);
68 spin_unlock_irqrestore(&local->ack_status_lock, flags);
69
70 if (id >= 0) {