diff options
author | Felix Fietkau <nbd@nbd.name> | 2020-07-25 10:49:21 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2020-08-06 12:42:29 +0200 |
commit | b7727a8005635a46255518bdf19eb016e160278a (patch) | |
tree | 5df0e910da729a76c4001404945a5beb1094a93a | |
parent | 60f595daab45f1ffab2f422ba493a09b41e51ef4 (diff) | |
download | upstream-b7727a8005635a46255518bdf19eb016e160278a.tar.gz upstream-b7727a8005635a46255518bdf19eb016e160278a.tar.bz2 upstream-b7727a8005635a46255518bdf19eb016e160278a.zip |
mac80211: fix AQL issues
- Remove bogus STA txq pending airtime underflow warning
- Improve tx airtime estimation for A-MPDU traffic
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2 files changed, 112 insertions, 0 deletions
diff --git a/package/kernel/mac80211/patches/subsys/305-mac80211-improve-AQL-tx-airtime-estimation.patch b/package/kernel/mac80211/patches/subsys/305-mac80211-improve-AQL-tx-airtime-estimation.patch new file mode 100644 index 0000000000..f344281439 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/305-mac80211-improve-AQL-tx-airtime-estimation.patch @@ -0,0 +1,81 @@ +From: Felix Fietkau <nbd@nbd.name> +Date: Fri, 24 Jul 2020 20:25:07 +0200 +Subject: [PATCH] mac80211: improve AQL tx airtime estimation + +AQL does not take into account that most HT/VHT/HE traffic is A-MPDU aggregated. +Because of that, the per-packet airtime overhead is vastly overestimated. +Improve it by assuming an average aggregation length of 16 for non-legacy +traffic if not using the VO AC queue. +This should improve performance with high data rates, especially with multiple +stations + +Signed-off-by: Felix Fietkau <nbd@nbd.name> +--- + +--- a/net/mac80211/airtime.c ++++ b/net/mac80211/airtime.c +@@ -551,7 +551,7 @@ EXPORT_SYMBOL_GPL(ieee80211_calc_tx_airt + u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_sta *pubsta, +- int len) ++ int len, bool ampdu) + { + struct ieee80211_supported_band *sband; + struct ieee80211_chanctx_conf *conf; +@@ -572,10 +572,26 @@ u32 ieee80211_calc_expected_tx_airtime(s + if (pubsta) { + struct sta_info *sta = container_of(pubsta, struct sta_info, + sta); ++ struct ieee80211_tx_rate *rate = &sta->tx_stats.last_rate; ++ u32 airtime; + +- return ieee80211_calc_tx_airtime_rate(hw, +- &sta->tx_stats.last_rate, +- band, len); ++ if (!(rate->flags & (IEEE80211_TX_RC_VHT_MCS | ++ IEEE80211_TX_RC_MCS))) ++ ampdu = false; ++ ++ /* ++ * Assume that HT/VHT transmission on any AC except VO will ++ * use aggregation. Since we don't have reliable reporting ++ * of aggregation length, assume an average of 16. ++ * This will not be very accurate, but much better than simply ++ * assuming un-aggregated tx. ++ */ ++ airtime = ieee80211_calc_tx_airtime_rate(hw, rate, band, ++ ampdu ? len * 16 : len); ++ if (ampdu) ++ airtime /= 16; ++ ++ return airtime; + } + + if (!conf) +--- a/net/mac80211/ieee80211_i.h ++++ b/net/mac80211/ieee80211_i.h +@@ -2278,7 +2278,7 @@ extern const struct ethtool_ops ieee8021 + u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_sta *pubsta, +- int len); ++ int len, bool ampdu); + #ifdef CPTCFG_MAC80211_NOINLINE + #define debug_noinline noinline + #else +--- a/net/mac80211/tx.c ++++ b/net/mac80211/tx.c +@@ -3694,10 +3694,11 @@ encap_out: + + if (vif && + wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) { ++ bool ampdu = txq->ac != IEEE80211_AC_VO; + u32 airtime; + + airtime = ieee80211_calc_expected_tx_airtime(hw, vif, txq->sta, +- skb->len); ++ skb->len, ampdu); + if (airtime) { + airtime = ieee80211_info_set_tx_time_est(info, airtime); + ieee80211_sta_update_pending_airtime(local, tx.sta, diff --git a/package/kernel/mac80211/patches/subsys/306-mac80211-remove-STA-txq-pending-airtime-underflow-wa.patch b/package/kernel/mac80211/patches/subsys/306-mac80211-remove-STA-txq-pending-airtime-underflow-wa.patch new file mode 100644 index 0000000000..ab3a77e19b --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/306-mac80211-remove-STA-txq-pending-airtime-underflow-wa.patch @@ -0,0 +1,31 @@ +From: Felix Fietkau <nbd@nbd.name> +Date: Sat, 25 Jul 2020 10:42:30 +0200 +Subject: [PATCH] mac80211: remove STA txq pending airtime underflow + warning + +This warning can trigger if there is a mismatch between frames that were +sent with the sta pointer set vs tx status frames reported for the sta address. + +This can happen due to race conditions on re-creating stations, or even +in the case of .sta_add/remove being used instead of .sta_state, which can cause +frames to be sent to a station that has not been uploaded yet. + +If there is an actual underflow issue, it should show up in the device airtime +warning below, so it is better to remove this one. + +Signed-off-by: Felix Fietkau <nbd@nbd.name> +--- + +--- a/net/mac80211/sta_info.c ++++ b/net/mac80211/sta_info.c +@@ -1924,9 +1924,7 @@ void ieee80211_sta_update_pending_airtim + if (sta) { + tx_pending = atomic_sub_return(tx_airtime, + &sta->airtime[ac].aql_tx_pending); +- if (WARN_ONCE(tx_pending < 0, +- "STA %pM AC %d txq pending airtime underflow: %u, %u", +- sta->addr, ac, tx_pending, tx_airtime)) ++ if (tx_pending < 0) + atomic_cmpxchg(&sta->airtime[ac].aql_tx_pending, + tx_pending, 0); + } |