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
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.
13 Signed-off-by: Felix Fietkau <nbd@nbd.name>
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.
22 - if (duration > 400) /* <= VHT20 MCS2 1S */
23 + if (duration > 400 * 1024) /* <= VHT20 MCS2 1S */
25 - else if (duration > 250) /* <= VHT20 MCS3 1S or MCS1 2S */
26 + else if (duration > 250 * 1024) /* <= VHT20 MCS3 1S or MCS1 2S */
28 - else if (duration > 150) /* <= VHT20 MCS5 1S or MCS3 2S */
29 + else if (duration > 150 * 1024) /* <= VHT20 MCS5 1S or MCS2 2S */
32 + else if (duration > 70 * 1024) /* <= VHT20 MCS5 2S */
34 + else if (stat.encoding != RX_ENC_HE ||
35 + duration > 20 * 1024) /* <= HE40 MCS6 2S */
41 duration /= AVG_PKT_SIZE;
43 + duration += (overhead >> agg_shift);
45 - return duration + (overhead >> agg_shift);
46 + return max_t(u32, duration, 4);