From owner-svn-src-all@FreeBSD.ORG Tue Feb 8 18:31:28 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 B00841065675; Tue, 8 Feb 2011 18:31:28 +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 4BF2E8FC0A; Tue, 8 Feb 2011 18:31:28 +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 p18IVSER055714; Tue, 8 Feb 2011 18:31:28 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p18IVSor055712; Tue, 8 Feb 2011 18:31:28 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201102081831.p18IVSor055712@svn.freebsd.org> From: Adrian Chadd Date: Tue, 8 Feb 2011 18:31:28 +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: r218448 - 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: Tue, 08 Feb 2011 18:31:28 -0000 Author: adrian Date: Tue Feb 8 18:31:28 2011 New Revision: 218448 URL: http://svn.freebsd.org/changeset/base/218448 Log: Commit some missing bits to the sample rate module to (more) correctly calculate 802.11n packet duration. This doesn't yet take into account HT40 packet durations as the node info (needed to know if it's a HT20 or HT40 node) isn't available everywhere it needs to be. Modified: head/sys/dev/ath/ath_rate/sample/sample.h Modified: head/sys/dev/ath/ath_rate/sample/sample.h ============================================================================== --- head/sys/dev/ath/ath_rate/sample/sample.h Tue Feb 8 17:04:52 2011 (r218447) +++ head/sys/dev/ath/ath_rate/sample/sample.h Tue Feb 8 18:31:28 2011 (r218448) @@ -114,7 +114,7 @@ struct sample_node { * Calculate the transmit duration of a frame. */ static unsigned calc_usecs_unicast_packet(struct ath_softc *sc, - int length, + int length, int rix, int short_retries, int long_retries) { const HAL_RATE_TABLE *rt = sc->sc_currates; struct ifnet *ifp = sc->sc_ifp; @@ -153,6 +153,11 @@ static unsigned calc_usecs_unicast_packe t_sifs = 8; t_difs = 28; break; + case IEEE80211_T_HT: + t_slot = 9; + t_sifs = 8; + t_difs = 28; + break; case IEEE80211_T_DS: /* fall through to default */ default: @@ -172,7 +177,6 @@ static unsigned calc_usecs_unicast_packe cts = 1; cix = rt->info[sc->sc_protrix].controlRate; - } if (0 /*length > ic->ic_rtsthreshold */) { @@ -192,8 +196,9 @@ static unsigned calc_usecs_unicast_packe if (rts) /* SIFS + CTS */ ctsduration += rt->info[cix].spAckDuration; - ctsduration += ath_hal_computetxtime(sc->sc_ah, - rt, length, rix, AH_TRUE); + /* XXX assumes short preamble */ + /* XXX assumes HT/20; the node info isn't yet available here */ + ctsduration += ath_hal_pkt_txtime(sc->sc_ah, rt, length, rix, 0, AH_TRUE); if (cts) /* SIFS + ACK */ ctsduration += rt->info[cix].spAckDuration; @@ -201,9 +206,12 @@ static unsigned calc_usecs_unicast_packe tt += (short_retries + 1) * ctsduration; } tt += t_difs; + + /* XXX assumes short preamble */ + /* XXX assumes HT/20; the node info isn't yet available here */ + tt += (long_retries+1)*ath_hal_pkt_txtime(sc->sc_ah, rt, length, rix, 0, AH_TRUE); tt += (long_retries+1)*(t_sifs + rt->info[rix].spAckDuration); - tt += (long_retries+1)*ath_hal_computetxtime(sc->sc_ah, rt, length, - rix, AH_TRUE); + for (x = 0; x <= short_retries + long_retries; x++) { cw = MIN(WIFI_CW_MAX, (cw + 1) * 2); tt += (t_slot * cw/2);