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