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