Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[firefly-linux-kernel-4.4.55.git] / net / mac80211 / rc80211_minstrel_ht.c
index 749552bdcfe1eb2d21e1064999dbf08904a54cf6..d2b264d1311d25a337fc267b69f931b996e8e07a 100644 (file)
@@ -202,14 +202,23 @@ minstrel_ht_calc_tp(struct minstrel_ht_sta *mi, int group, int rate)
        struct minstrel_rate_stats *mr;
        unsigned int nsecs = 0;
        unsigned int tp;
+       unsigned int prob;
 
        mr = &mi->groups[group].rates[rate];
+       prob = mr->probability;
 
-       if (mr->probability < MINSTREL_FRAC(1, 10)) {
+       if (prob < MINSTREL_FRAC(1, 10)) {
                mr->cur_tp = 0;
                return;
        }
 
+       /*
+        * For the throughput calculation, limit the probability value to 90% to
+        * account for collision related packet error rate fluctuation
+        */
+       if (prob > MINSTREL_FRAC(9, 10))
+               prob = MINSTREL_FRAC(9, 10);
+
        if (group != MINSTREL_CCK_GROUP)
                nsecs = 1000 * mi->overhead / MINSTREL_TRUNC(mi->avg_ampdu_len);
 
@@ -639,15 +648,18 @@ minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
        /*
         * Sampling might add some overhead (RTS, no aggregation)
         * to the frame. Hence, don't use sampling for the currently
-        * used max TP rate.
+        * used rates.
         */
-       if (sample_idx == mi->max_tp_rate)
+       if (sample_idx == mi->max_tp_rate ||
+           sample_idx == mi->max_tp_rate2 ||
+           sample_idx == mi->max_prob_rate)
                return -1;
+
        /*
-        * When not using MRR, 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%
+        * to avoid wasting airtime.
         */
-       if (!mp->has_mrr && (mr->probability > MINSTREL_FRAC(95, 100)))
+       if (mr->probability > MINSTREL_FRAC(95, 100))
                return -1;
 
        /*