Under load, otherwise stable rates can easily fluctuate because of

collisions. In my tests on a clean channel, the success probability of

the max throughput rate often stays somewhere between 90% and 100% under

load. This can cause some unnecessary switching to lower rates.

This patch improves stability by treating success probability values

between 90% and 100% the same.

In my tests on a 3x3 HT20 link with lots of TCP traffic, it improves the

average throughput by a few mbit/s.

Signed-off-by: Felix Fietkau <[email protected]>

---

net/mac80211/rc80211_minstrel_ht.c | 11 ++++++++++-

1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c

index 749552b..90499c4 100644

--- a/net/mac80211/rc80211_minstrel_ht.c

+++ b/net/mac80211/rc80211_minstrel_ht.c

@@ -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);

--

1.8.0.2

max_tp_rate2 and max_prob_rate tend to get used occasionally during

retransmission, which is more useful for the statistics than probing

with individual probe packets.

Signed-off-by: Felix Fietkau <[email protected]>

---

net/mac80211/rc80211_minstrel_ht.c | 7 +++++--

1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c

index 0fc9449..d2b264d 100644

--- a/net/mac80211/rc80211_minstrel_ht.c

+++ b/net/mac80211/rc80211_minstrel_ht.c

@@ -648,10 +648,13 @@ 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;

+

/*

* Do not sample if the probability is already higher than 95%

* to avoid wasting airtime.

--

1.8.0.2

On Sat, 2013-03-16 at 17:00 +0100, Felix Fietkau wrote:

> Under load, otherwise stable rates can easily fluctuate because of

> collisions. In my tests on a clean channel, the success probability of

> the max throughput rate often stays somewhere between 90% and 100% under

> load. This can cause some unnecessary switching to lower rates.

> This patch improves stability by treating success probability values

> between 90% and 100% the same.

> In my tests on a 3x3 HT20 link with lots of TCP traffic, it improves the

> average throughput by a few mbit/s.

Applied all, thanks.

johannes

Slow rates that have >95% success probability do not need to be

monitored continuously. When the channel conditions change rapidly, the

slow sampling results are useless anyway. When conditions change slowly,

they will be monitored by gradual downgrading of the actively used

rates. This patch slightly improves throughput under good conditions.

Signed-off-by: Felix Fietkau <[email protected]>

---

net/mac80211/rc80211_minstrel_ht.c | 6 +++---

1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c

index 90499c4..0fc9449 100644

--- a/net/mac80211/rc80211_minstrel_ht.c

+++ b/net/mac80211/rc80211_minstrel_ht.c

@@ -653,10 +653,10 @@ minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)

if (sample_idx == mi->max_tp_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;

/*

--

1.8.0.2

Felix Fietkau wrote:

> Under load, otherwise stable rates can easily fluctuate because of

> collisions. In my tests on a clean channel, the success probability of

> the max throughput rate often stays somewhere between 90% and 100% under

> load. This can cause some unnecessary switching to lower rates.

> This patch improves stability by treating success probability values

> between 90% and 100% the same.

> In my tests on a 3x3 HT20 link with lots of TCP traffic, it improves the

> average throughput by a few mbit/s.

Some test results:

Sta: WB222 (2x2)

AP : DB120, AR9380 (3x3) (Channel 36, HT40+)

Distance: About a meter.

With ath9k RC:

[SUM] 0.0-60.0 sec 1.42 GBytes 203 Mbits/sec

With minstrel_ht, current HEAD:

[SUM] 0.0-60.0 sec 1.35 GBytes 193 Mbits/sec

with minstrel_ht, HEAD + these 3 patches:

[SUM] 0.0-60.1 sec 1.41 GBytes 202 Mbits/sec

Sujith