305-mac80211-improve-AQL-tx-airtime-estimation.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. From: Felix Fietkau <[email protected]>
  2. Date: Fri, 24 Jul 2020 20:25:07 +0200
  3. Subject: [PATCH] mac80211: improve AQL tx airtime estimation
  4. AQL does not take into account that most HT/VHT/HE traffic is A-MPDU aggregated.
  5. Because of that, the per-packet airtime overhead is vastly overestimated.
  6. Improve it by assuming an average aggregation length of 16 for non-legacy
  7. traffic if not using the VO AC queue.
  8. This should improve performance with high data rates, especially with multiple
  9. stations
  10. Signed-off-by: Felix Fietkau <[email protected]>
  11. ---
  12. --- a/net/mac80211/airtime.c
  13. +++ b/net/mac80211/airtime.c
  14. @@ -551,7 +551,7 @@ EXPORT_SYMBOL_GPL(ieee80211_calc_tx_airt
  15. u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw,
  16. struct ieee80211_vif *vif,
  17. struct ieee80211_sta *pubsta,
  18. - int len)
  19. + int len, bool ampdu)
  20. {
  21. struct ieee80211_supported_band *sband;
  22. struct ieee80211_chanctx_conf *conf;
  23. @@ -572,10 +572,26 @@ u32 ieee80211_calc_expected_tx_airtime(s
  24. if (pubsta) {
  25. struct sta_info *sta = container_of(pubsta, struct sta_info,
  26. sta);
  27. + struct ieee80211_tx_rate *rate = &sta->tx_stats.last_rate;
  28. + u32 airtime;
  29. - return ieee80211_calc_tx_airtime_rate(hw,
  30. - &sta->tx_stats.last_rate,
  31. - band, len);
  32. + if (!(rate->flags & (IEEE80211_TX_RC_VHT_MCS |
  33. + IEEE80211_TX_RC_MCS)))
  34. + ampdu = false;
  35. +
  36. + /*
  37. + * Assume that HT/VHT transmission on any AC except VO will
  38. + * use aggregation. Since we don't have reliable reporting
  39. + * of aggregation length, assume an average of 16.
  40. + * This will not be very accurate, but much better than simply
  41. + * assuming un-aggregated tx.
  42. + */
  43. + airtime = ieee80211_calc_tx_airtime_rate(hw, rate, band,
  44. + ampdu ? len * 16 : len);
  45. + if (ampdu)
  46. + airtime /= 16;
  47. +
  48. + return airtime;
  49. }
  50. if (!conf)
  51. --- a/net/mac80211/ieee80211_i.h
  52. +++ b/net/mac80211/ieee80211_i.h
  53. @@ -2294,7 +2294,7 @@ extern const struct ethtool_ops ieee8021
  54. u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw,
  55. struct ieee80211_vif *vif,
  56. struct ieee80211_sta *pubsta,
  57. - int len);
  58. + int len, bool ampdu);
  59. #ifdef CPTCFG_MAC80211_NOINLINE
  60. #define debug_noinline noinline
  61. #else
  62. --- a/net/mac80211/tx.c
  63. +++ b/net/mac80211/tx.c
  64. @@ -3707,10 +3707,11 @@ encap_out:
  65. if (vif &&
  66. wiphy_ext_feature_isset(local->hw.wiphy, NL80211_EXT_FEATURE_AQL)) {
  67. + bool ampdu = txq->ac != IEEE80211_AC_VO;
  68. u32 airtime;
  69. airtime = ieee80211_calc_expected_tx_airtime(hw, vif, txq->sta,
  70. - skb->len);
  71. + skb->len, ampdu);
  72. if (airtime) {
  73. airtime = ieee80211_info_set_tx_time_est(info, airtime);
  74. ieee80211_sta_update_pending_airtime(local, tx.sta,