From owner-svn-src-user@FreeBSD.ORG Mon Sep 5 09:31:27 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2031B106564A; Mon, 5 Sep 2011 09:31:27 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E952F8FC0C; Mon, 5 Sep 2011 09:31:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p859VQsS029735; Mon, 5 Sep 2011 09:31:26 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p859VQil029733; Mon, 5 Sep 2011 09:31:26 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109050931.p859VQil029733@svn.freebsd.org> From: Adrian Chadd Date: Mon, 5 Sep 2011 09:31:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225390 - user/adrian/if_ath_tx/sys/dev/ath/ath_rate/sample X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2011 09:31:27 -0000 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; } } }