From owner-svn-src-all@FreeBSD.ORG Thu Jan 20 08:19:23 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 847C4106564A; Thu, 20 Jan 2011 08:19:23 +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 71CFD8FC08; Thu, 20 Jan 2011 08:19:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p0K8JNZn006005; Thu, 20 Jan 2011 08:19:23 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p0K8JNWM006002; Thu, 20 Jan 2011 08:19:23 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201101200819.p0K8JNWM006002@svn.freebsd.org> From: Adrian Chadd Date: Thu, 20 Jan 2011 08:19:23 +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: r217628 - head/sys/dev/ath/ath_rate/sample X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Jan 2011 08:19:23 -0000 Author: adrian Date: Thu Jan 20 08:19:23 2011 New Revision: 217628 URL: http://svn.freebsd.org/changeset/base/217628 Log: Migrate the sample rate module to the new ath_hal_gettxcompletionrates() API. This removes the chipset-dependent TX DMA completion descriptor groveling. It should now be (more) portable to other, later atheros chipsets when the time comes. 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 Thu Jan 20 08:15:46 2011 (r217627) +++ head/sys/dev/ath/ath_rate/sample/sample.c Thu Jan 20 08:19:23 2011 (r217628) @@ -600,38 +600,16 @@ ath_rate_tx_complete(struct ath_softc *s 0, 0, short_tries, long_tries, ts->ts_status); } else { - int hwrate0, rix0, tries0; - int hwrate1, rix1, tries1; - int hwrate2, rix2, tries2; - int hwrate3, rix3, tries3; + int hwrates[4], tries[4], rix[4]; int finalTSIdx = ts->ts_finaltsi; + int i; /* * Process intermediate rates that failed. */ - if (sc->sc_ah->ah_magic != 0x20065416) { - hwrate0 = MS(ds0->ds_ctl3, AR_XmitRate0); - hwrate1 = MS(ds0->ds_ctl3, AR_XmitRate1); - hwrate2 = MS(ds0->ds_ctl3, AR_XmitRate2); - hwrate3 = MS(ds0->ds_ctl3, AR_XmitRate3); - } else { - hwrate0 = MS(ds0->ds_ctl3, AR5416_XmitRate0); - hwrate1 = MS(ds0->ds_ctl3, AR5416_XmitRate1); - hwrate2 = MS(ds0->ds_ctl3, AR5416_XmitRate2); - hwrate3 = MS(ds0->ds_ctl3, AR5416_XmitRate3); - } - - rix0 = rt->rateCodeToIndex[hwrate0]; - tries0 = MS(ds0->ds_ctl2, AR_XmitDataTries0); - - rix1 = rt->rateCodeToIndex[hwrate1]; - tries1 = MS(ds0->ds_ctl2, AR_XmitDataTries1); - - rix2 = rt->rateCodeToIndex[hwrate2]; - tries2 = MS(ds0->ds_ctl2, AR_XmitDataTries2); - - rix3 = rt->rateCodeToIndex[hwrate3]; - tries3 = MS(ds0->ds_ctl2, AR_XmitDataTries3); + ath_hal_gettxcompletionrates(sc->sc_ah, ds0, hwrates, tries); + for (i = 0; i < 4; i++) + rix[i] = rt->rateCodeToIndex[hwrates[i]]; IEEE80211_NOTE(an->an_node.ni_vap, IEEE80211_MSG_RATECTL, &an->an_node, @@ -641,19 +619,19 @@ ath_rate_tx_complete(struct ath_softc *s finalTSIdx, long_tries, ts->ts_status ? "FAIL" : "OK", - rix0, tries0, - rix1, tries1, - rix2, tries2, - rix3, tries3); - - if (tries0 && !IS_RATE_DEFINED(sn, rix0)) - badrate(ifp, 0, hwrate0, tries0, ts->ts_status); - if (tries1 && !IS_RATE_DEFINED(sn, rix1)) - badrate(ifp, 1, hwrate1, tries1, ts->ts_status); - if (tries2 && !IS_RATE_DEFINED(sn, rix2)) - badrate(ifp, 2, hwrate2, tries2, ts->ts_status); - if (tries3 && !IS_RATE_DEFINED(sn, rix3)) - badrate(ifp, 3, hwrate3, tries3, ts->ts_status); + rix[0], tries[0], + rix[1], tries[1], + rix[2], tries[2], + rix[3], tries[3]); + + if (tries[0] && !IS_RATE_DEFINED(sn, rix[0])) + badrate(ifp, 0, hwrates[0], tries[0], ts->ts_status); + if (tries[1] && !IS_RATE_DEFINED(sn, rix[1])) + badrate(ifp, 1, hwrates[1], tries[1], ts->ts_status); + if (tries[2] && !IS_RATE_DEFINED(sn, rix[2])) + badrate(ifp, 2, hwrates[2], tries[2], ts->ts_status); + if (tries[3] && !IS_RATE_DEFINED(sn, rix[3])) + badrate(ifp, 3, hwrates[3], tries[3], ts->ts_status); /* * NB: series > 0 are not penalized for failure @@ -662,42 +640,42 @@ ath_rate_tx_complete(struct ath_softc *s * sample higher rates 1 try at a time doing so * may unfairly penalize them. */ - if (tries0) { + if (tries[0]) { update_stats(sc, an, frame_size, - rix0, tries0, - rix1, tries1, - rix2, tries2, - rix3, tries3, + rix[0], tries[0], + rix[1], tries[1], + rix[2], tries[2], + rix[3], tries[3], short_tries, long_tries, - long_tries > tries0); - long_tries -= tries0; + long_tries > tries[0]); + long_tries -= tries[0]; } - if (tries1 && finalTSIdx > 0) { + if (tries[1] && finalTSIdx > 0) { update_stats(sc, an, frame_size, - rix1, tries1, - rix2, tries2, - rix3, tries3, + rix[1], tries[1], + rix[2], tries[2], + rix[3], tries[3], 0, 0, short_tries, long_tries, ts->ts_status); - long_tries -= tries1; + long_tries -= tries[1]; } - if (tries2 && finalTSIdx > 1) { + if (tries[2] && finalTSIdx > 1) { update_stats(sc, an, frame_size, - rix2, tries2, - rix3, tries3, + rix[2], tries[2], + rix[3], tries[3], 0, 0, 0, 0, short_tries, long_tries, ts->ts_status); - long_tries -= tries2; + long_tries -= tries[2]; } - if (tries3 && finalTSIdx > 2) { + if (tries[3] && finalTSIdx > 2) { update_stats(sc, an, frame_size, - rix3, tries3, + rix[3], tries[3], 0, 0, 0, 0, 0, 0, Modified: head/sys/dev/ath/ath_rate/sample/sample.h ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.h Thu Jan 20 08:15:46 2011 (r217627) +++ head/sys/dev/ath/ath_rate/sample/sample.h Thu Jan 20 08:19:23 2011 (r217628) @@ -111,47 +111,6 @@ struct sample_node { #define WIFI_CW_MAX 1023 /* - * Definitions for pulling the rate and trie counts from - * a 5212 h/w descriptor. These Don't belong here; the - * driver should record this information so the rate control - * code doesn't go groveling around in the descriptor bits. - */ -#define ds_ctl2 ds_hw[0] -#define ds_ctl3 ds_hw[1] - -/* TX ds_ctl2 */ -#define AR_XmitDataTries0 0x000f0000 /* series 0 max attempts */ -#define AR_XmitDataTries0_S 16 -#define AR_XmitDataTries1 0x00f00000 /* series 1 max attempts */ -#define AR_XmitDataTries1_S 20 -#define AR_XmitDataTries2 0x0f000000 /* series 2 max attempts */ -#define AR_XmitDataTries2_S 24 -#define AR_XmitDataTries3 0xf0000000 /* series 3 max attempts */ -#define AR_XmitDataTries3_S 28 - -/* TX ds_ctl3 */ -#define AR_XmitRate0 0x0000001f /* series 0 tx rate */ -#define AR_XmitRate0_S 0 -#define AR_XmitRate1 0x000003e0 /* series 1 tx rate */ -#define AR_XmitRate1_S 5 -#define AR_XmitRate2 0x00007c00 /* series 2 tx rate */ -#define AR_XmitRate2_S 10 -#define AR_XmitRate3 0x000f8000 /* series 3 tx rate */ -#define AR_XmitRate3_S 15 - -/* TX ds_ctl3 for 5416 */ -#define AR5416_XmitRate0 0x000000ff /* series 0 tx rate */ -#define AR5416_XmitRate0_S 0 -#define AR5416_XmitRate1 0x0000ff00 /* series 1 tx rate */ -#define AR5416_XmitRate1_S 8 -#define AR5416_XmitRate2 0x00ff0000 /* series 2 tx rate */ -#define AR5416_XmitRate2_S 16 -#define AR5416_XmitRate3 0xff000000 /* series 3 tx rate */ -#define AR5416_XmitRate3_S 24 - -#define MS(_v, _f) (((_v) & (_f)) >> _f##_S) - -/* * Calculate the transmit duration of a frame. */ static unsigned calc_usecs_unicast_packet(struct ath_softc *sc,