2
0

308-mac80211-minstrel_ht-fix-rounding-issue-in-MCS-durat.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. From: Felix Fietkau <[email protected]>
  2. Date: Fri, 13 Mar 2015 10:49:40 +0100
  3. Subject: [PATCH] mac80211: minstrel_ht: fix rounding issue in MCS duration
  4. calculation
  5. On very high MCS bitrates, the calculated duration of rates that are
  6. next to each other can be very imprecise, due to the small packet size
  7. used as reference (1200 bytes).
  8. This is most visible in VHT80 nss=2 MCS8/9, for which minstrel shows the
  9. same throughput when the probability is also the same. This leads to a
  10. bad rate selection for such rates.
  11. Fix this issue by introducing an average A-MPDU size factor into the
  12. calculation.
  13. Signed-off-by: Felix Fietkau <[email protected]>
  14. ---
  15. --- a/net/mac80211/rc80211_minstrel_ht.c
  16. +++ b/net/mac80211/rc80211_minstrel_ht.c
  17. @@ -17,10 +17,11 @@
  18. #include "rc80211_minstrel.h"
  19. #include "rc80211_minstrel_ht.h"
  20. +#define AVG_AMPDU_SIZE 16
  21. #define AVG_PKT_SIZE 1200
  22. /* Number of bits for an average sized packet */
  23. -#define MCS_NBITS (AVG_PKT_SIZE << 3)
  24. +#define MCS_NBITS ((AVG_PKT_SIZE * AVG_AMPDU_SIZE) << 3)
  25. /* Number of symbols for a packet with (bps) bits per symbol */
  26. #define MCS_NSYMS(bps) DIV_ROUND_UP(MCS_NBITS, (bps))
  27. @@ -33,7 +34,8 @@
  28. )
  29. /* Transmit duration for the raw data part of an average sized packet */
  30. -#define MCS_DURATION(streams, sgi, bps) MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps)))
  31. +#define MCS_DURATION(streams, sgi, bps) \
  32. + (MCS_SYMBOL_TIME(sgi, MCS_NSYMS((streams) * (bps))) / AVG_AMPDU_SIZE)
  33. #define BW_20 0
  34. #define BW_40 1