mac80211: minstrel: do not sample rates 3 times slower than max_prob_rate
authorFelix Fietkau <nbd@nbd.name>
Sat, 6 Oct 2018 17:35:06 +0000 (19:35 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 11 Oct 2018 14:01:04 +0000 (16:01 +0200)
These rates are highly unlikely to be used quickly, even if the link
deteriorates rapidly. This improves throughput in cases where CCK rates
are not reliable enough to be skipped entirely during sampling.
Sampling these rates regularly can cost a lot of airtime.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/rc80211_minstrel_ht.c

index fdcb4e9b4560eb381e83be62f0f66f49934d9f25..f466ec37d161faf3aeaaf84fdf2f6b95788fb4ca 100644 (file)
@@ -1004,10 +1004,13 @@ minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
                return -1;
 
        /*
-        * Do not sample if the probability is already higher than 95%
-        * to avoid wasting airtime.
+        * Do not sample if the probability is already higher than 95%,
+        * or if the rate is 3 times slower than the current max probability
+        * rate, to avoid wasting airtime.
         */
-       if (mrs->prob_ewma > MINSTREL_FRAC(95, 100))
+       sample_dur = minstrel_get_duration(sample_idx);
+       if (mrs->prob_ewma > MINSTREL_FRAC(95, 100) ||
+           minstrel_get_duration(mi->max_prob_rate) * 3 < sample_dur)
                return -1;
 
        /*
@@ -1017,7 +1020,6 @@ minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
 
        cur_max_tp_streams = minstrel_mcs_groups[tp_rate1 /
                MCS_GROUP_RATES].streams;
-       sample_dur = minstrel_get_duration(sample_idx);
        if (sample_dur >= minstrel_get_duration(tp_rate2) &&
            (cur_max_tp_streams - 1 <
             minstrel_mcs_groups[sample_group].streams ||