Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Sep 2012 01:09:17 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r240583 - head/sys/dev/ath/ath_rate/sample
Message-ID:  <201209170109.q8H19HJD020106@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Mon Sep 17 01:09:17 2012
New Revision: 240583
URL: http://svn.freebsd.org/changeset/base/240583

Log:
  Improve performance of the Sample rate algorithm on 802.11n networks.
  
  * Don't treat high percentage failures as "sucessive failures" - high
    MCS rates are very picky and will quite happily "fade" from low
    to high failure % and back again within a few seconds.  If they really
    don't work, the aggregate will just plain fail.
  
  * Only sample MCS rates +/- 3 from the current MCS.  Sample will back off
    quite quickly, so there's no need to sample _all_ MCS rates between
    a high MCS rate and MCS0; there may be a lot of them.
  
  * Modify the smoothing rate to be 75% rather than 95% - it's more adaptive
    but it comes with a cost of being slightly less stable at times.
    A per-node, hysterisis behaviour would be nicer.

Modified:
  head/sys/dev/ath/ath_rate/sample/sample.c

Modified: head/sys/dev/ath/ath_rate/sample/sample.c
==============================================================================
--- head/sys/dev/ath/ath_rate/sample/sample.c	Mon Sep 17 00:56:10 2012	(r240582)
+++ head/sys/dev/ath/ath_rate/sample/sample.c	Mon Sep 17 01:09:17 2012	(r240583)
@@ -293,27 +293,17 @@ pick_sample_rate(struct sample_softc *ss
 		}
 
 		/*
-		 * When doing aggregation, successive failures don't happen
-		 * as often, as sometimes some of the sub-frames get through.
-		 *
-		 * If the sample rix average tx time is greater than the
-		 * average tx time of the current rix, don't immediately use
-		 * the rate for sampling.
+		 * For HT, only sample a few rates on either side of the
+		 * current rix; there's quite likely a lot of them.
 		 */
 		if (an->an_node.ni_flags & IEEE80211_NODE_HT) {
-			if ((sn->stats[size_bin][rix].average_tx_time * 10 >
-			    sn->stats[size_bin][current_rix].average_tx_time * 9) &&
-			    (ticks - sn->stats[size_bin][rix].last_tx < ssc->stale_failure_timeout)) {
+			if (rix < (current_rix - 3) ||
+			    rix > (current_rix + 3)) {
 				mask &= ~((uint64_t) 1<<rix);
 				goto nextrate;
 			}
 		}
 
-		/*
-		 * XXX TODO
-		 * For HT, limit sample somehow?
-		 */
-
 		/* Don't sample more than 2 rates higher for rates > 11M for non-HT rates */
 		if (! (an->an_node.ni_flags & IEEE80211_NODE_HT)) {
 			if (DOT11RATE(rix) > 2*11 && rix > current_rix + 2) {
@@ -1420,7 +1410,7 @@ ath_rate_attach(struct ath_softc *sc)
 	if (ssc == NULL)
 		return NULL;
 	ssc->arc.arc_space = sizeof(struct sample_node);
-	ssc->smoothing_rate = 95;		/* ewma percentage ([0..99]) */
+	ssc->smoothing_rate = 75;		/* ewma percentage ([0..99]) */
 	ssc->smoothing_minpackets = 100 / (100 - ssc->smoothing_rate);
 	ssc->sample_rate = 10;			/* %time to try diff tx rates */
 	ssc->max_successive_failures = 3;	/* threshold for rate sampling*/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209170109.q8H19HJD020106>