mac80211: improve AQL aggregation estimation for low data rates

Links with low data rates use much smaller aggregates and are much more
sensitive to latency added by bufferbloat.
Tune the assumed aggregation length based on the tx rate duration.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/r/20200821163045.62140-3-nbd@nbd.name
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Felix Fietkau 2020-08-21 18:30:45 +02:00 committed by Johannes Berg
parent 43cd72c589
commit f01cfbaf9b

View file

@ -647,27 +647,41 @@ u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw,
if (pubsta) { if (pubsta) {
struct sta_info *sta = container_of(pubsta, struct sta_info, struct sta_info *sta = container_of(pubsta, struct sta_info,
sta); sta);
struct ieee80211_rx_status stat;
struct ieee80211_tx_rate *rate = &sta->tx_stats.last_rate; struct ieee80211_tx_rate *rate = &sta->tx_stats.last_rate;
struct rate_info *ri = &sta->tx_stats.last_rate_info; struct rate_info *ri = &sta->tx_stats.last_rate_info;
u32 airtime; u32 duration, overhead;
u8 agg_shift;
if (!(rate->flags & (IEEE80211_TX_RC_VHT_MCS | if (ieee80211_fill_rx_status(&stat, hw, rate, ri, band, len))
IEEE80211_TX_RC_MCS))) return 0;
ampdu = false;
if (stat.encoding == RX_ENC_LEGACY || !ampdu)
return ieee80211_calc_rx_airtime(hw, &stat, len);
duration = ieee80211_get_rate_duration(hw, &stat, &overhead);
/* /*
* Assume that HT/VHT transmission on any AC except VO will * Assume that HT/VHT transmission on any AC except VO will
* use aggregation. Since we don't have reliable reporting * use aggregation. Since we don't have reliable reporting
* of aggregation length, assume an average of 16. * of aggregation length, assume an average size based on the
* tx rate.
* This will not be very accurate, but much better than simply * This will not be very accurate, but much better than simply
* assuming un-aggregated tx. * assuming un-aggregated tx in all cases.
*/ */
airtime = ieee80211_calc_tx_airtime_rate(hw, rate, ri, band, if (duration > 400) /* <= VHT20 MCS2 1S */
ampdu ? len * 16 : len); agg_shift = 1;
if (ampdu) else if (duration > 250) /* <= VHT20 MCS3 1S or MCS1 2S */
airtime /= 16; agg_shift = 2;
else if (duration > 150) /* <= VHT20 MCS5 1S or MCS3 2S */
agg_shift = 3;
else
agg_shift = 4;
return airtime; duration *= len;
duration /= AVG_PKT_SIZE;
duration /= 1024;
return duration + (overhead >> agg_shift);
} }
if (!conf) if (!conf)