Commit 1f38b8c5 authored by Felix Fietkau's avatar Felix Fietkau Committed by Johannes Berg

mac80211: extend AQL aggregation estimation to HE and fix unit mismatch

The unit of the return value of ieee80211_get_rate_duration is nanoseconds, not
microseconds. Adjust the duration checks to account for that.
For higher data rates, allow larger estimated aggregation sizes, and add some
values for HE as well, which can use much larger aggregates.
Since small packets with high data rates can now lead to duration values too
small for info->tx_time_est, return a minimum of 4us.

Fixes: f01cfbaf ("mac80211: improve AQL aggregation estimation for low data rates")
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
Acked-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/r/20200915085945.3782-1-nbd@nbd.nameSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 5f6857e8
......@@ -668,20 +668,26 @@ u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw,
* This will not be very accurate, but much better than simply
* assuming un-aggregated tx in all cases.
*/
if (duration > 400) /* <= VHT20 MCS2 1S */
if (duration > 400 * 1024) /* <= VHT20 MCS2 1S */
agg_shift = 1;
else if (duration > 250) /* <= VHT20 MCS3 1S or MCS1 2S */
else if (duration > 250 * 1024) /* <= VHT20 MCS3 1S or MCS1 2S */
agg_shift = 2;
else if (duration > 150) /* <= VHT20 MCS5 1S or MCS3 2S */
else if (duration > 150 * 1024) /* <= VHT20 MCS5 1S or MCS2 2S */
agg_shift = 3;
else
else if (duration > 70 * 1024) /* <= VHT20 MCS5 2S */
agg_shift = 4;
else if (stat.encoding != RX_ENC_HE ||
duration > 20 * 1024) /* <= HE40 MCS6 2S */
agg_shift = 5;
else
agg_shift = 6;
duration *= len;
duration /= AVG_PKT_SIZE;
duration /= 1024;
duration += (overhead >> agg_shift);
return duration + (overhead >> agg_shift);
return max_t(u32, duration, 4);
}
if (!conf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment