3d687f834117d4582fbf70dfd4a2bec42aaf41ef
[openwrt/staging/wigyori.git] / package / kernel / mac80211 / patches / subsys / 327-mac80211-extend-AQL-aggregation-estimation-to-HE-and.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Thu, 27 Aug 2020 12:44:36 +0200
3 Subject: [PATCH] mac80211: extend AQL aggregation estimation to HE and fix
4 unit mismatch
5
6 The unit of the return value of ieee80211_get_rate_duration is nanoseconds, not
7 milliseconds. Adjust the duration checks to account for that.
8 For higher data rates, allow larger estimated aggregation sizes, and add some
9 values for HE as well, which can use much larger aggregates.
10 Since small packets with high data rates can now lead to duration values too
11 small for info->tx_time_est, return a minimum of 4us.
12
13 Signed-off-by: Felix Fietkau <nbd@nbd.name>
14 ---
15
16 --- a/net/mac80211/airtime.c
17 +++ b/net/mac80211/airtime.c
18 @@ -668,20 +668,26 @@ u32 ieee80211_calc_expected_tx_airtime(s
19 * This will not be very accurate, but much better than simply
20 * assuming un-aggregated tx in all cases.
21 */
22 - if (duration > 400) /* <= VHT20 MCS2 1S */
23 + if (duration > 400 * 1024) /* <= VHT20 MCS2 1S */
24 agg_shift = 1;
25 - else if (duration > 250) /* <= VHT20 MCS3 1S or MCS1 2S */
26 + else if (duration > 250 * 1024) /* <= VHT20 MCS3 1S or MCS1 2S */
27 agg_shift = 2;
28 - else if (duration > 150) /* <= VHT20 MCS5 1S or MCS3 2S */
29 + else if (duration > 150 * 1024) /* <= VHT20 MCS5 1S or MCS2 2S */
30 agg_shift = 3;
31 - else
32 + else if (duration > 70 * 1024) /* <= VHT20 MCS5 2S */
33 agg_shift = 4;
34 + else if (stat.encoding != RX_ENC_HE ||
35 + duration > 20 * 1024) /* <= HE40 MCS6 2S */
36 + agg_shift = 5;
37 + else
38 + agg_shift = 6;
39
40 duration *= len;
41 duration /= AVG_PKT_SIZE;
42 duration /= 1024;
43 + duration += (overhead >> agg_shift);
44
45 - return duration + (overhead >> agg_shift);
46 + return max_t(u32, duration, 4);
47 }
48
49 if (!conf)