linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bob Copeland <me@bobcopeland.com>
To: Thomas Huehn <thomas@net.t-labs.tu-berlin.de>
Cc: linville@tuxdriver.com, linux-wireless@vger.kernel.org,
	johannes.berg@intel.com, nbd@openwrt.org
Subject: Re: [PATCH 7/7] mac80211: improve minstrels rate sorting by means of throughput & probability
Date: Fri, 1 Mar 2013 13:41:05 -0500	[thread overview]
Message-ID: <20130301184105.GC16369@localhost> (raw)
In-Reply-To: <1362159456-39448-8-git-send-email-thomas@net.t-labs.tu-berlin.de>

On Fri, Mar 01, 2013 at 06:37:36PM +0100, Thomas Huehn wrote:
> +		//printk(KERN_ERR "before sort: max_tp_rate[0]= %i, [1]= %i, [2]= %i, [3]= %i,", mi->max_tp_rate[0], mi->max_tp_rate[1], mi->max_tp_rate[2], mi->max_tp_rate[3]);

Some leftover debugging there, and elsewhere.

I take it the changes to minstrel_update_stats fix the problem where
a rate might get used more than once?  A while ago I wrote the following
patch for that, but never found the time to test it.  It would be great
to know it's fixed.

From: Bob Copeland <me@bobcopeland.com>
Date: Fri, 18 May 2012 22:57:49 -0400
Subject: [PATCH] minstrel: avoid reusing max tp/max prob rates if they are the same

Some testing I did a while ago with mac80211_hwsim showed that
the MRR chain would frequently have the same rate included more
than once because it would be both the "max throughput" rate and
the "max success probability" rate.

If we truly cannot deliver packets with that rate due to changes
in radio conditions, we can waste a lot of airtime with unsuccessful
retransmissions.  So, compute both of the max throughput rates up
front, and then pick the max prob. rate from the leftovers.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
---
 net/mac80211/rc80211_minstrel.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index 79633ae..36255f1 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -73,7 +73,7 @@ rix_to_ndx(struct minstrel_sta_info *mi, int rix)
 static void
 minstrel_update_stats(struct minstrel_priv *mp, struct minstrel_sta_info *mi)
 {
-	u32 max_tp = 0, index_max_tp = 0, index_max_tp2 = 0;
+	u32 max_tp = 0, index_max_tp = 0, max_tp2 = 0, index_max_tp2 = 0;
 	u32 max_prob = 0, index_max_prob = 0;
 	u32 usecs;
 	u32 p;
@@ -123,25 +123,26 @@ minstrel_update_stats(struct minstrel_priv *mp, struct minstrel_sta_info *mi)
 	for (i = 0; i < mi->n_rates; i++) {
 		struct minstrel_rate *mr = &mi->r[i];
 		if (max_tp < mr->cur_tp) {
+			max_tp2 = max_tp;
+			index_max_tp2 = index_max_tp;
 			index_max_tp = i;
 			max_tp = mr->cur_tp;
-		}
-		if (max_prob < mr->probability) {
-			index_max_prob = i;
-			max_prob = mr->probability;
+		} else if (max_tp2 < mr->cur_tp) {
+			index_max_tp2 = i;
+			max_tp2 = mr->cur_tp;
 		}
 	}
 
-	max_tp = 0;
+	max_prob = 0;
 	for (i = 0; i < mi->n_rates; i++) {
 		struct minstrel_rate *mr = &mi->r[i];
 
-		if (i == index_max_tp)
+		if (i == index_max_tp || i == index_max_tp2)
 			continue;
 
-		if (max_tp < mr->cur_tp) {
-			index_max_tp2 = i;
-			max_tp = mr->cur_tp;
+		if (max_prob < mr->probability) {
+			index_max_prob = i;
+			max_prob = mr->probability;
 		}
 	}
 	mi->max_tp_rate = index_max_tp;
-- 
1.7.2.5

-- 
Bob Copeland %% www.bobcopeland.com

  reply	other threads:[~2013-03-01 18:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-01 17:37 [PATCH 0/7] mac80211: improve and consolidate minstrel rate control Thomas Huehn
2013-03-01 17:37 ` [PATCH 1/7] mac80211: merge EWMA calculation of minstrel_ht and minstrel Thomas Huehn
2013-03-01 17:37 ` [PATCH 2/7] mac80211: merge value scaling macros " Thomas Huehn
2013-03-01 17:37 ` [PATCH 3/7] mac80211: add documentation and verbose variable names in Thomas Huehn
2013-03-01 17:37 ` [PATCH 4/7] mac80211: extend minstrel's rate sampling to avoid unsampled rates Thomas Huehn
2013-03-01 17:37 ` [PATCH 5/7] mac80211: add lowest rate into minstrel's randmon rate sampling table Thomas Huehn
2013-03-01 17:37 ` [PATCH 6/7] mac80211: treat minstrel success probabilities below 10% as implausible Thomas Huehn
2013-03-01 17:37 ` [PATCH 7/7] mac80211: improve minstrels rate sorting by means of throughput & probability Thomas Huehn
2013-03-01 18:41   ` Bob Copeland [this message]
2013-03-02 11:01     ` Thomas Hühn
2013-03-04 15:02       ` Bob Copeland
2013-03-01 18:45 ` [PATCH 0/7] mac80211: improve and consolidate minstrel rate control Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130301184105.GC16369@localhost \
    --to=me@bobcopeland.com \
    --cc=johannes.berg@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=nbd@openwrt.org \
    --cc=thomas@net.t-labs.tu-berlin.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).