Skip to contentSkip to conversation

mac80211/minstrel_ht: improve rate selection stability

PATCH Applied Felix Fietkau 3 participants 5 messages Mar 16, 2013 – Mar 18, 2013 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 mac80211/minstrel_ht: improve rate selection stability

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.

---
 net/mac80211/rc80211_minstrel_ht.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
net/mac80211/rc80211_minstrel_ht.c +10 -1
index 749552b..90499c4 100644
@@ -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);
 
Signature · 1 line
1.8.0.2
#1 lore raw

PATCH 2/3 mac80211/minstrel_ht: avoid useless sampling of high-probability slower rates

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.

---
 net/mac80211/rc80211_minstrel_ht.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
net/mac80211/rc80211_minstrel_ht.c +3 -3
index 90499c4..0fc9449 100644
@@ -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;
 
 	/*
Signature · 1 line
1.8.0.2
#2 lore raw

PATCH 3/3 mac80211/minstrel_ht: do not sample actively used rates

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.

---
 net/mac80211/rc80211_minstrel_ht.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
net/mac80211/rc80211_minstrel_ht.c +5 -2
index 0fc9449..d2b264d 100644
@@ -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.
Signature · 1 line
1.8.0.2
#3 lore raw
In reply to Felix Fietkau
Quoted 8 lines · Felix Fietkau

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

maintainer Applied
#4 lore raw
In reply to Felix Fietkau
Quoted 8 lines · Felix Fietkau

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