From owner-svn-src-head@FreeBSD.ORG Wed May 18 07:20:31 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 928171065670; Wed, 18 May 2011 07:20:31 +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 784AC8FC08; Wed, 18 May 2011 07:20:31 +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 p4I7KVqr065763; Wed, 18 May 2011 07:20:31 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p4I7KVqb065761; Wed, 18 May 2011 07:20:31 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105180720.p4I7KVqb065761@svn.freebsd.org> From: Adrian Chadd Date: Wed, 18 May 2011 07:20:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r222049 - head/sys/dev/ath/ath_rate/sample X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 May 2011 07:20:31 -0000 Author: adrian Date: Wed May 18 07:20:30 2011 New Revision: 222049 URL: http://svn.freebsd.org/changeset/base/222049 Log: Modify the sample rate control algorithm to only select/sample HT rates for HT nodes. 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 Wed May 18 02:14:26 2011 (r222048) +++ head/sys/dev/ath/ath_rate/sample/sample.c Wed May 18 07:20:30 2011 (r222049) @@ -161,9 +161,10 @@ dot11rate_label(const HAL_RATE_TABLE *rt * or -1 if all the average_tx_times are 0. */ static __inline int -pick_best_rate(struct sample_node *sn, const HAL_RATE_TABLE *rt, +pick_best_rate(struct ath_node *an, const HAL_RATE_TABLE *rt, int size_bin, int require_acked_before) { + struct sample_node *sn = ATH_NODE_SAMPLE(an); int best_rate_rix, best_rate_tt; uint32_t mask; int rix, tt; @@ -174,6 +175,12 @@ pick_best_rate(struct sample_node *sn, c if ((mask & 1) == 0) /* not a supported rate */ continue; + /* Don't pick a non-HT rate for a HT node */ + if ((an->an_node.ni_flags & IEEE80211_NODE_HT) && + (rt->info[rix].phy != IEEE80211_T_HT)) { + continue; + } + tt = sn->stats[size_bin][rix].average_tx_time; if (tt <= 0 || (require_acked_before && @@ -196,11 +203,12 @@ pick_best_rate(struct sample_node *sn, c * Pick a good "random" bit-rate to sample other than the current one. */ static __inline int -pick_sample_rate(struct sample_softc *ssc , struct sample_node *sn, +pick_sample_rate(struct sample_softc *ssc , struct ath_node *an, const HAL_RATE_TABLE *rt, int size_bin) { #define DOT11RATE(ix) (rt->info[ix].dot11Rate & IEEE80211_RATE_VAL) #define MCS(ix) (rt->info[ix].dot11Rate | IEEE80211_RATE_MCS) + struct sample_node *sn = ATH_NODE_SAMPLE(an); int current_rix, rix; unsigned current_tt; uint32_t mask; @@ -208,6 +216,7 @@ pick_sample_rate(struct sample_softc *ss current_rix = sn->current_rix[size_bin]; if (current_rix < 0) { /* no successes yet, send at the lowest bit-rate */ + /* XXX should return MCS0 if HT */ return 0; } @@ -223,6 +232,13 @@ pick_sample_rate(struct sample_softc *ss continue; } + /* if the node is HT and the rate isn't HT, don't bother sample */ + if ((an->an_node.ni_flags & IEEE80211_NODE_HT) && + (rt->info[rix].phy != IEEE80211_T_HT)) { + mask &= ~(1<stats[size_bin][rix].perfect_tx_time > current_tt) { mask &= ~(1< 11M */ - if (DOT11RATE(rix) > 2*11 && rix > current_rix + 2) { - mask &= ~(1< 11M for non-HT rates */ + if (! (an->an_node.ni_flags & IEEE80211_NODE_HT)) { + if (DOT11RATE(rix) > 2*11 && rix > current_rix + 2) { + mask &= ~(1<last_sample_rix[size_bin] = rix; @@ -327,7 +345,7 @@ ath_rate_findrate(struct ath_softc *sc, /* XXX TODO: this doesn't know about 11gn vs 11g protection; teach it */ mrr = sc->sc_mrretry && !(ic->ic_flags & IEEE80211_F_USEPROT); - best_rix = pick_best_rate(sn, rt, size_bin, !mrr); + best_rix = pick_best_rate(an, rt, size_bin, !mrr); if (best_rix >= 0) { average_tx_time = sn->stats[size_bin][best_rix].average_tx_time; } else { @@ -338,7 +356,7 @@ ath_rate_findrate(struct ath_softc *sc, * rates to sample_rate% of the total transmission time. */ if (sn->sample_tt[size_bin] < average_tx_time * (sn->packets_since_sample[size_bin]*ssc->sample_rate/100)) { - rix = pick_sample_rate(ssc, sn, rt, size_bin); + rix = pick_sample_rate(ssc, an, rt, size_bin); IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL, &an->an_node, "size %u sample rate %d current rate %d", bin_to_size(size_bin), RATE(rix),