364-mac80211-minstrel_ht-reduce-unnecessary-rate-probing.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From: Felix Fietkau <[email protected]>
  2. Date: Wed, 5 Jun 2019 20:42:49 +0200
  3. Subject: [PATCH] mac80211: minstrel_ht: reduce unnecessary rate probing
  4. attempts
  5. On hardware with static fallback tables (e.g. mt76x2), rate probing attempts
  6. can be very expensive.
  7. On such devices, avoid sampling rates slower than the per-group max throughput
  8. rate, based on the assumption that the fallback table will take care of probing
  9. lower rates within that group if the higher rates fail.
  10. To make this work, this also fixes a wrong initialization in the previously
  11. unused per-group sorted rate array.
  12. To further reduce unnecessary probing attempts, skip duplicate attempts on
  13. rates slower than the max throughput rate.
  14. Signed-off-by: Felix Fietkau <[email protected]>
  15. ---
  16. --- a/net/mac80211/rc80211_minstrel_ht.c
  17. +++ b/net/mac80211/rc80211_minstrel_ht.c
  18. @@ -1062,6 +1062,21 @@ minstrel_get_sample_rate(struct minstrel
  19. minstrel_get_duration(mi->max_prob_rate) * 3 < sample_dur)
  20. return -1;
  21. +
  22. + /*
  23. + * For devices with no configurable multi-rate retry, skip sampling
  24. + * below the per-group max throughput rate, and only use one sampling
  25. + * attempt per rate
  26. + */
  27. + if (mp->hw->max_rates == 1 &&
  28. + (minstrel_get_duration(mg->max_group_tp_rate[0]) < sample_dur ||
  29. + mrs->attempts))
  30. + return -1;
  31. +
  32. + /* Skip already sampled slow rates */
  33. + if (sample_dur >= minstrel_get_duration(tp_rate1) && mrs->attempts)
  34. + return -1;
  35. +
  36. /*
  37. * Make sure that lower rates get sampled only occasionally,
  38. * if the link is working perfectly.