From owner-p4-projects@FreeBSD.ORG Fri Nov 21 22:58:45 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 98B65106575F; Fri, 21 Nov 2008 22:58:45 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5B706106574F for ; Fri, 21 Nov 2008 22:58:45 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 470558FC1D for ; Fri, 21 Nov 2008 22:58:45 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id mALMwjf1006024 for ; Fri, 21 Nov 2008 22:58:45 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id mALMwjlf006022 for perforce@freebsd.org; Fri, 21 Nov 2008 22:58:45 GMT (envelope-from sam@freebsd.org) Date: Fri, 21 Nov 2008 22:58:45 GMT Message-Id: <200811212258.mALMwjlf006022@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 153311 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Nov 2008 22:58:45 -0000 http://perforce.freebsd.org/chv.cgi?CH=153311 Change 153311 by sam@sam_ebb on 2008/11/21 22:58:40 Unbreak sample rate selection: o use the old algorithm of cycling through all possible rates instead of just checking from the last sample rate to the end of the rate table; this broke upshifting once the highest possible rate was tried as we walked off the end of the table and so never tried sampling again (which meant there were not enough samples to cause the sampled rate to be selected as best) o remove the hack to never sample past 12M when operating at 11M; aside from being a very dubious heuristic it means it's impossible to upshift once you land on 11M (not sure what John's intent was here but I can think of no reason to ever do this so it goes) Affected files ... .. //depot/projects/vap/sys/dev/ath/ath_rate/sample/sample.c#22 edit Differences ... ==== //depot/projects/vap/sys/dev/ath/ath_rate/sample/sample.c#22 (text+ko) ==== @@ -187,7 +187,7 @@ static __inline int pick_sample_rate(struct sample_node *sn, const HAL_RATE_TABLE *rt, int size_bin) { -#define RATE(ix) (rt->info[ix].dot11Rate & IEEE80211_RATE_VAL) +#define DOT11RATE(ix) (rt->info[ix].dot11Rate & IEEE80211_RATE_VAL) int current_rix, rix; unsigned current_tt; uint32_t mask; @@ -197,39 +197,43 @@ /* no successes yet, send at the lowest bit-rate */ return 0; } - + current_tt = sn->stats[size_bin][current_rix].average_tx_time; - + rix = sn->last_sample_rix[size_bin]+1; /* next sample rate */ - mask = sn->ratemask >> rix; /* clear all rates below */ - for (; mask != 0; mask >>= 1, rix++) { - if ((mask & 1) == 0) /* not a supported rate */ + mask = sn->ratemask &~ (1<= rt->rateCount) + rix = 0; continue; + } /* this bit-rate is always worse than the current one */ - if (sn->stats[size_bin][rix].perfect_tx_time > current_tt) - continue; + if (sn->stats[size_bin][rix].perfect_tx_time > current_tt) { + mask &= ~(1<stats[size_bin][rix].last_tx < ((hz * STALE_FAILURE_TIMEOUT_MS)/1000) && - sn->stats[size_bin][rix].successive_failures > 3) - continue; + if (sn->stats[size_bin][rix].successive_failures > 3 && + ticks - sn->stats[size_bin][rix].last_tx < ((hz * STALE_FAILURE_TIMEOUT_MS)/1000)) { + mask &= ~(1< 2*11 && rix > current_rix + 2) - continue; + /* don't sample more than 2 rates higher for rates > 11M */ + if (DOT11RATE(rix) > 2*11 && rix > current_rix + 2) { + mask &= ~(1< current_rix + 1) - continue; - sn->last_sample_rix[size_bin] = rix; return rix; } return current_rix; -#undef RATE +#undef DOT11RATE } void