Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Aug 2011 07:28:07 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r225165 - user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample
Message-ID:  <201108250728.p7P7S7iT089953@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Thu Aug 25 07:28:07 2011
New Revision: 225165
URL: http://svn.freebsd.org/changeset/base/225165

Log:
  Begin teaching ath_rate_sample about aggregate packets.
  
  I'm hoping to (just) teach ath_rate_sample about the multiple packet
  attempt/success/failure as if the rate completion routine was called
  for each packet. (Which seems a bit over the top.)
  
  This still doesn't choose/stick to the fastest throughput, primarily because:
  
  * there's no probe/sounding frame support yet - ie, if ath_rate_sample
    decides to sample a higher rate to see if it's better, the aggregate
    code still aggregates;
  
  * .. and the rate API doesn't really get anywhere enough info to make
    aggregate decisions - primarily because the rate API gets called before
    any aggregate is formed. So it can't do things like choose a rate
    based on how long the potential aggregate is (eg, if higher MCS rates
    work fine for short bursts, but not for longer bursts); and
  
  * Rate assignment is only done once, it isn't recalculated in the software
    retry path. I think that'll be one of my next things to refactor out.

Modified:
  user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.c

Modified: user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.c
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.c	Thu Aug 25 07:24:49 2011	(r225164)
+++ user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.c	Thu Aug 25 07:28:07 2011	(r225165)
@@ -498,7 +498,8 @@ update_stats(struct ath_softc *sc, struc
 		  int rix1, int tries1,
 		  int rix2, int tries2,
 		  int rix3, int tries3,
-		  int short_tries, int tries, int status)
+		  int short_tries, int tries, int status,
+		  int nframes, int nbad)
 {
 	struct sample_node *sn = ATH_NODE_SAMPLE(an);
 	struct sample_softc *ssc = ATH_SOFTC_SAMPLE(sc);
@@ -540,7 +541,7 @@ update_stats(struct ath_softc *sc, struc
 		/* just average the first few packets */
 		int avg_tx = sn->stats[size_bin][rix0].average_tx_time;
 		int packets = sn->stats[size_bin][rix0].total_packets;
-		sn->stats[size_bin][rix0].average_tx_time = (tt+(avg_tx*packets))/(packets+1);
+		sn->stats[size_bin][rix0].average_tx_time = (tt+(avg_tx*packets))/(packets+nframes);
 	} else {
 		/* use a ewma */
 		sn->stats[size_bin][rix0].average_tx_time = 
@@ -550,36 +551,37 @@ update_stats(struct ath_softc *sc, struc
 	
 	if (status != 0) {
 		int y;
-		sn->stats[size_bin][rix0].successive_failures++;
+		sn->stats[size_bin][rix0].successive_failures += nbad;
 		for (y = size_bin+1; y < NUM_PACKET_SIZE_BINS; y++) {
 			/*
 			 * Also say larger packets failed since we
 			 * assume if a small packet fails at a
 			 * bit-rate then a larger one will also.
 			 */
-			sn->stats[y][rix0].successive_failures++;
+			sn->stats[y][rix0].successive_failures += nbad;
 			sn->stats[y][rix0].last_tx = ticks;
 			sn->stats[y][rix0].tries += tries;
-			sn->stats[y][rix0].total_packets++;
+			sn->stats[y][rix0].total_packets += nframes;
 		}
 	} else {
-		sn->stats[size_bin][rix0].packets_acked++;
+		sn->stats[size_bin][rix0].packets_acked += nframes;
 		sn->stats[size_bin][rix0].successive_failures = 0;
 	}
 	sn->stats[size_bin][rix0].tries += tries;
 	sn->stats[size_bin][rix0].last_tx = ticks;
-	sn->stats[size_bin][rix0].total_packets++;
+	sn->stats[size_bin][rix0].total_packets += nframes;
 
 	if (rix0 == sn->current_sample_rix[size_bin]) {
 		IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL,
 		   &an->an_node,
-"%s: size %d %s sample rate %d tries (%d/%d) tt %d avg_tt (%d/%d)", 
+"%s: size %d %s sample rate %d tries (%d/%d) tt %d avg_tt (%d/%d) nfrm %d nbad %d", 
 		    __func__, 
 		    size,
 		    status ? "FAIL" : "OK",
 		    rix0, short_tries, tries, tt, 
 		    sn->stats[size_bin][rix0].average_tx_time,
-		    sn->stats[size_bin][rix0].perfect_tx_time);
+		    sn->stats[size_bin][rix0].perfect_tx_time,
+		    nframes, nbad);
 		sn->sample_tt[size_bin] = tt;
 		sn->current_sample_rix[size_bin] = -1;
 	}
@@ -642,7 +644,8 @@ ath_rate_tx_complete(struct ath_softc *s
 			     0, 0,
 			     0, 0,
 			     0, 0,
-			     short_tries, long_tries, ts->ts_status);
+			     short_tries, long_tries, ts->ts_status,
+			     nframes, nbad);
 	} else {
 		int finalTSIdx = ts->ts_finaltsi;
 		int i;
@@ -689,7 +692,8 @@ ath_rate_tx_complete(struct ath_softc *s
 				     rc[2].rix, rc[2].tries,
 				     rc[3].rix, rc[3].tries,
 				     short_tries, long_tries,
-				     long_tries > rc[0].tries);
+				     long_tries > rc[0].tries,
+				     nframes, nbad);
 			long_tries -= rc[0].tries;
 		}
 		
@@ -700,7 +704,8 @@ ath_rate_tx_complete(struct ath_softc *s
 				     rc[3].rix, rc[3].tries,
 				     0, 0,
 				     short_tries, long_tries,
-				     ts->ts_status);
+				     ts->ts_status,
+				     nframes, nbad);
 			long_tries -= rc[1].tries;
 		}
 
@@ -711,7 +716,8 @@ ath_rate_tx_complete(struct ath_softc *s
 				     0, 0,
 				     0, 0,
 				     short_tries, long_tries,
-				     ts->ts_status);
+				     ts->ts_status,
+				     nframes, nbad);
 			long_tries -= rc[2].tries;
 		}
 
@@ -722,7 +728,8 @@ ath_rate_tx_complete(struct ath_softc *s
 				     0, 0,
 				     0, 0,
 				     short_tries, long_tries,
-				     ts->ts_status);
+				     ts->ts_status,
+				     nframes, nbad);
 		}
 	}
 }



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