From owner-svn-src-head@FreeBSD.ORG Wed Aug 15 07:10:11 2012 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 49DC8106566C; Wed, 15 Aug 2012 07:10:11 +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 317FF8FC12; Wed, 15 Aug 2012 07:10:11 +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 q7F7AB44017662; Wed, 15 Aug 2012 07:10:11 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7F7AAv0017659; Wed, 15 Aug 2012 07:10:10 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208150710.q7F7AAv0017659@svn.freebsd.org> From: Adrian Chadd Date: Wed, 15 Aug 2012 07:10:10 +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: r239284 - 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, 15 Aug 2012 07:10:11 -0000 Author: adrian Date: Wed Aug 15 07:10:10 2012 New Revision: 239284 URL: http://svn.freebsd.org/changeset/base/239284 Log: Extend the sample mask from 32 bits to 64 bits. This is required to support > MCS15 as more than 32 bit rate entries are suddenly available. This is quite messy - instead of doing typecasts at each mask operation, this should be migrated to use a macro and have that do the typecast. Modified: head/sys/dev/ath/ath_rate/sample/sample.c head/sys/dev/ath/ath_rate/sample/sample.h Modified: head/sys/dev/ath/ath_rate/sample/sample.c ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.c Wed Aug 15 07:00:34 2012 (r239283) +++ head/sys/dev/ath/ath_rate/sample/sample.c Wed Aug 15 07:10:10 2012 (r239284) @@ -164,7 +164,7 @@ pick_best_rate(struct ath_node *an, cons { struct sample_node *sn = ATH_NODE_SAMPLE(an); int best_rate_rix, best_rate_tt, best_rate_pct; - uint32_t mask; + uint64_t mask; int rix, tt, pct; best_rate_rix = 0; @@ -251,7 +251,7 @@ pick_sample_rate(struct sample_softc *ss struct sample_node *sn = ATH_NODE_SAMPLE(an); int current_rix, rix; unsigned current_tt; - uint32_t mask; + uint64_t mask; current_rix = sn->current_rix[size_bin]; if (current_rix < 0) { @@ -263,9 +263,9 @@ pick_sample_rate(struct sample_softc *ss 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 &~ (1<ratemask &~ ((uint64_t) 1<= rt->rateCount) rix = 0; @@ -275,20 +275,20 @@ pick_sample_rate(struct sample_softc *ss /* 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<stats[size_bin][rix].successive_failures > ssc->max_successive_failures && ticks - sn->stats[size_bin][rix].last_tx < ssc->stale_failure_timeout) { - mask &= ~(1<stats[size_bin][rix].average_tx_time * 10 > sn->stats[size_bin][current_rix].average_tx_time * 9) && (ticks - sn->stats[size_bin][rix].last_tx < ssc->stale_failure_timeout)) { - 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<rateCount-1; rix > 0; rix--) { - if ((sn->ratemask & (1<ratemask & ((uint64_t) 1<rateCount-1; rix > 0; rix--) { /* Skip rates we can't use */ - if ((sn->ratemask & (1<ratemask & ((uint64_t) 1<sched[rix0]; - KASSERT(rix0 == sched->r0, ("rix0 (%x) != sched->r0 (%x)!\n", rix0, sched->r0)); + KASSERT(rix0 == sched->r0, ("rix0 (%x) != sched->r0 (%x)!\n", + rix0, sched->r0)); rc[0].flags = rc[1].flags = rc[2].flags = rc[3].flags = 0; @@ -919,6 +920,8 @@ ath_rate_tx_complete(struct ath_softc *s if (!mrr || ts->ts_finaltsi == 0) { if (!IS_RATE_DEFINED(sn, final_rix)) { + device_printf(sc->sc_dev, "%s: ts_rate=%d ts_finaltsi=%d\n", + __func__, ts->ts_rate, ts->ts_finaltsi); badrate(ifp, 0, ts->ts_rate, long_tries, status); return; } @@ -1087,6 +1090,7 @@ ath_rate_ctl_reset(struct ath_softc *sc, KASSERT(sc->sc_curmode < IEEE80211_MODE_MAX+2, ("curmode %u", sc->sc_curmode)); + sn->sched = mrr_schedules[sc->sc_curmode]; KASSERT(sn->sched != NULL, ("no mrr schedule for mode %u", sc->sc_curmode)); @@ -1113,7 +1117,7 @@ ath_rate_ctl_reset(struct ath_softc *sc, continue; KASSERT(rix < SAMPLE_MAXRATES, ("mcs %u has rix %d", MCS(x), rix)); - sn->ratemask |= 1<ratemask |= (uint64_t) 1<ratemask |= 1<ratemask |= (uint64_t) 1<ni_vap, IEEE80211_MSG_RATECTL)) { - uint32_t mask; + uint64_t mask; ieee80211_note(ni->ni_vap, "[%6D] %s: size 1600 rate/tt", ni->ni_macaddr, ":", __func__); @@ -1147,7 +1151,7 @@ ath_rate_ctl_reset(struct ath_softc *sc, #endif for (y = 0; y < NUM_PACKET_SIZE_BINS; y++) { int size = bin_to_size(y); - uint32_t mask; + uint64_t mask; sn->packets_sent[y] = 0; sn->current_sample_rix[y] = -1; @@ -1289,10 +1293,10 @@ sample_stats(void *arg, struct ieee80211 struct ath_softc *sc = arg; const HAL_RATE_TABLE *rt = sc->sc_currates; struct sample_node *sn = ATH_NODE_SAMPLE(ATH_NODE(ni)); - uint32_t mask; + uint64_t mask; int rix, y; - printf("\n[%s] refcnt %d static_rix (%d %s) ratemask 0x%x\n", + printf("\n[%s] refcnt %d static_rix (%d %s) ratemask 0x%qx\n", ether_sprintf(ni->ni_macaddr), ieee80211_node_refcnt(ni), dot11rate(rt, sn->static_rix), dot11rate_label(rt, sn->static_rix), Modified: head/sys/dev/ath/ath_rate/sample/sample.h ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.h Wed Aug 15 07:00:34 2012 (r239283) +++ head/sys/dev/ath/ath_rate/sample/sample.h Wed Aug 15 07:10:10 2012 (r239284) @@ -91,7 +91,7 @@ bin_to_size(int index) struct sample_node { int static_rix; /* rate index of fixed tx rate */ #define SAMPLE_MAXRATES 64 /* NB: corresponds to hal info[32] */ - uint32_t ratemask; /* bit mask of valid rate indices */ + uint64_t ratemask; /* bit mask of valid rate indices */ const struct txschedule *sched; /* tx schedule table */ const HAL_RATE_TABLE *currates;