377-mac80211-minstrel-do-not-sample-rates-3-times-slower.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. From: Felix Fietkau <nbd@nbd.name>
  2. Date: Sat, 3 Mar 2018 18:48:58 +0100
  3. Subject: [PATCH] mac80211: minstrel: do not sample rates 3 times slower than
  4. max_prob_rate
  5. These rates are highly unlikely to be used quickly, even if the link
  6. deteriorates rapidly. This improves throughput in cases where CCK rates
  7. are not reliable enough to be skipped entirely during sampling.
  8. Sampling these rates regularly can cost a lot of airtime.
  9. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10. ---
  11. --- a/net/mac80211/rc80211_minstrel_ht.c
  12. +++ b/net/mac80211/rc80211_minstrel_ht.c
  13. @@ -1004,10 +1004,13 @@ minstrel_get_sample_rate(struct minstrel
  14. return -1;
  15. /*
  16. - * Do not sample if the probability is already higher than 95%
  17. - * to avoid wasting airtime.
  18. + * Do not sample if the probability is already higher than 95%,
  19. + * or if the rate is 3 times slower than the current max probability
  20. + * rate, to avoid wasting airtime.
  21. */
  22. - if (mrs->prob_ewma > MINSTREL_FRAC(95, 100))
  23. + sample_dur = minstrel_get_duration(sample_idx);
  24. + if (mrs->prob_ewma > MINSTREL_FRAC(95, 100) ||
  25. + minstrel_get_duration(mi->max_prob_rate) * 3 < sample_dur)
  26. return -1;
  27. /*
  28. @@ -1017,7 +1020,6 @@ minstrel_get_sample_rate(struct minstrel
  29. cur_max_tp_streams = minstrel_mcs_groups[tp_rate1 /
  30. MCS_GROUP_RATES].streams;
  31. - sample_dur = minstrel_get_duration(sample_idx);
  32. if (sample_dur >= minstrel_get_duration(tp_rate2) &&
  33. (cur_max_tp_streams - 1 <
  34. minstrel_mcs_groups[sample_group].streams ||