svn commit: r225390 -
user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample
Adrian Chadd
adrian at FreeBSD.org
Mon Sep 5 09:31:27 UTC 2011
Author: adrian
Date: Mon Sep 5 09:31:26 2011
New Revision: 225390
URL: http://svn.freebsd.org/changeset/base/225390
Log:
Add a work-around for 11n aggregation packet behaviour and the lack of
correct average tx time calculation.
The average tx time calculation doesn't take into account the
sub-frame success rate. This means that in some instances, the
success rate may be lower than useful (say, around 60-70%) but
because the A-MPDU frame was partially successful, the calculated
TX time is low.
I'm not sure what the correct behaviour should be, but for now,
just enforce that the packet TX success rate must be higher.
Note: this is NOT correct (ie, a slightly higher failure rate is
ok if the aggregate throughput/latency is better.)
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 Mon Sep 5 08:44:46 2011 (r225389)
+++ user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample/sample.c Mon Sep 5 09:31:26 2011 (r225390)
@@ -170,12 +170,13 @@ pick_best_rate(struct ath_node *an, cons
int size_bin, int require_acked_before)
{
struct sample_node *sn = ATH_NODE_SAMPLE(an);
- int best_rate_rix, best_rate_tt;
+ int best_rate_rix, best_rate_tt, best_rate_pct;
uint32_t mask;
- int rix, tt;
+ int rix, tt, pct;
best_rate_rix = 0;
best_rate_tt = 0;
+ best_rate_pct = 0;
for (mask = sn->ratemask, rix = 0; mask != 0; mask >>= 1, rix++) {
if ((mask & 1) == 0) /* not a supported rate */
continue;
@@ -192,14 +193,40 @@ pick_best_rate(struct ath_node *an, cons
!sn->stats[size_bin][rix].packets_acked))
continue;
+ /* Calculate percentage if possible */
+ if (sn->stats[size_bin][rix].total_packets > 0) {
+ pct =
+ (100 * sn->stats[size_bin][rix].packets_acked) /
+ sn->stats[size_bin][rix].total_packets;
+ } else {
+ /* XXX for now, assume 95% ok */
+ pct = 95;
+ }
+
/* don't use a bit-rate that has been failing */
if (sn->stats[size_bin][rix].successive_failures > 3)
continue;
+ /*
+ * For HT, Don't use a bit rate that has a higher failure
+ * rate than the current.
+ *
+ * XXX This isn't optimal!
+ */
+ if (an->an_node.ni_flags & IEEE80211_NODE_HT) {
+ if (best_rate_pct > pct)
+ continue;
+ }
+
+ /*
+ * For non-MCS rates, use the current average txtime for
+ * comparison.
+ */
if (! (an->an_node.ni_flags & IEEE80211_NODE_HT)) {
if (best_rate_tt == 0 || tt <= best_rate_tt) {
best_rate_tt = tt;
best_rate_rix = rix;
+ best_rate_pct = pct;
}
}
@@ -212,6 +239,7 @@ pick_best_rate(struct ath_node *an, cons
if (best_rate_tt == 0 || (tt * 8 <= best_rate_tt * 10)) {
best_rate_tt = tt;
best_rate_rix = rix;
+ best_rate_pct = pct;
}
}
}
More information about the svn-src-user
mailing list