328-mac80211-extend-AQL-aggregation-estimation-to-HE-and.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. From: Felix Fietkau <[email protected]>
  2. Date: Thu, 27 Aug 2020 12:44:36 +0200
  3. Subject: [PATCH] mac80211: extend AQL aggregation estimation to HE and fix
  4. unit mismatch
  5. The unit of the return value of ieee80211_get_rate_duration is nanoseconds, not
  6. milliseconds. Adjust the duration checks to account for that.
  7. For higher data rates, allow larger estimated aggregation sizes, and add some
  8. values for HE as well, which can use much larger aggregates.
  9. Since small packets with high data rates can now lead to duration values too
  10. small for info->tx_time_est, return a minimum of 4us.
  11. Signed-off-by: Felix Fietkau <[email protected]>
  12. ---
  13. --- a/net/mac80211/airtime.c
  14. +++ b/net/mac80211/airtime.c
  15. @@ -668,20 +668,26 @@ u32 ieee80211_calc_expected_tx_airtime(s
  16. * This will not be very accurate, but much better than simply
  17. * assuming un-aggregated tx in all cases.
  18. */
  19. - if (duration > 400) /* <= VHT20 MCS2 1S */
  20. + if (duration > 400 * 1024) /* <= VHT20 MCS2 1S */
  21. agg_shift = 1;
  22. - else if (duration > 250) /* <= VHT20 MCS3 1S or MCS1 2S */
  23. + else if (duration > 250 * 1024) /* <= VHT20 MCS3 1S or MCS1 2S */
  24. agg_shift = 2;
  25. - else if (duration > 150) /* <= VHT20 MCS5 1S or MCS3 2S */
  26. + else if (duration > 150 * 1024) /* <= VHT20 MCS5 1S or MCS2 2S */
  27. agg_shift = 3;
  28. - else
  29. + else if (duration > 70 * 1024) /* <= VHT20 MCS5 2S */
  30. agg_shift = 4;
  31. + else if (stat.encoding != RX_ENC_HE ||
  32. + duration > 20 * 1024) /* <= HE40 MCS6 2S */
  33. + agg_shift = 5;
  34. + else
  35. + agg_shift = 6;
  36. duration *= len;
  37. duration /= AVG_PKT_SIZE;
  38. duration /= 1024;
  39. + duration += (overhead >> agg_shift);
  40. - return duration + (overhead >> agg_shift);
  41. + return max_t(u32, duration, 4);
  42. }
  43. if (!conf)