linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] mac80211/minstrel_ht: improve rate selection stability
@ 2013-03-16 16:00 Felix Fietkau
  2013-03-16 16:00 ` [PATCH 2/3] mac80211/minstrel_ht: avoid useless sampling of high-probability slower rates Felix Fietkau
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Felix Fietkau @ 2013-03-16 16:00 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes

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 <nbd@openwrt.org>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] mac80211/minstrel_ht: avoid useless sampling of high-probability slower rates
  2013-03-16 16:00 [PATCH 1/3] mac80211/minstrel_ht: improve rate selection stability Felix Fietkau
@ 2013-03-16 16:00 ` Felix Fietkau
  2013-03-16 16:00   ` [PATCH 3/3] mac80211/minstrel_ht: do not sample actively used rates Felix Fietkau
  2013-03-18 15:10 ` [PATCH 1/3] mac80211/minstrel_ht: improve rate selection stability Sujith Manoharan
  2013-03-18 19:12 ` Johannes Berg
  2 siblings, 1 reply; 5+ messages in thread
From: Felix Fietkau @ 2013-03-16 16:00 UTC (permalink / raw)
  To: linux-wireless; +Cc: 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 <nbd@openwrt.org>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] mac80211/minstrel_ht: do not sample actively used rates
  2013-03-16 16:00 ` [PATCH 2/3] mac80211/minstrel_ht: avoid useless sampling of high-probability slower rates Felix Fietkau
@ 2013-03-16 16:00   ` Felix Fietkau
  0 siblings, 0 replies; 5+ messages in thread
From: Felix Fietkau @ 2013-03-16 16:00 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes

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 <nbd@openwrt.org>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] mac80211/minstrel_ht: improve rate selection stability
  2013-03-16 16:00 [PATCH 1/3] mac80211/minstrel_ht: improve rate selection stability Felix Fietkau
  2013-03-16 16:00 ` [PATCH 2/3] mac80211/minstrel_ht: avoid useless sampling of high-probability slower rates Felix Fietkau
@ 2013-03-18 15:10 ` Sujith Manoharan
  2013-03-18 19:12 ` Johannes Berg
  2 siblings, 0 replies; 5+ messages in thread
From: Sujith Manoharan @ 2013-03-18 15:10 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless, johannes

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/3] mac80211/minstrel_ht: improve rate selection stability
  2013-03-16 16:00 [PATCH 1/3] mac80211/minstrel_ht: improve rate selection stability Felix Fietkau
  2013-03-16 16:00 ` [PATCH 2/3] mac80211/minstrel_ht: avoid useless sampling of high-probability slower rates Felix Fietkau
  2013-03-18 15:10 ` [PATCH 1/3] mac80211/minstrel_ht: improve rate selection stability Sujith Manoharan
@ 2013-03-18 19:12 ` Johannes Berg
  2 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2013-03-18 19:12 UTC (permalink / raw)
  To: Felix Fietkau; +Cc: linux-wireless

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-03-18 19:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-16 16:00 [PATCH 1/3] mac80211/minstrel_ht: improve rate selection stability Felix Fietkau
2013-03-16 16:00 ` [PATCH 2/3] mac80211/minstrel_ht: avoid useless sampling of high-probability slower rates Felix Fietkau
2013-03-16 16:00   ` [PATCH 3/3] mac80211/minstrel_ht: do not sample actively used rates Felix Fietkau
2013-03-18 15:10 ` [PATCH 1/3] mac80211/minstrel_ht: improve rate selection stability Sujith Manoharan
2013-03-18 19:12 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).