From owner-svn-src-all@FreeBSD.ORG Wed Aug 15 07:52:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 62446106566B; Wed, 15 Aug 2012 07:52:50 +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 33F3C8FC0C; Wed, 15 Aug 2012 07:52:50 +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 q7F7qoU6022294; Wed, 15 Aug 2012 07:52:50 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7F7qo52022292; Wed, 15 Aug 2012 07:52:50 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208150752.q7F7qo52022292@svn.freebsd.org> From: Adrian Chadd Date: Wed, 15 Aug 2012 07:52:49 +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: r239287 - head/sys/dev/ath/ath_hal 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: Wed, 15 Aug 2012 07:52:50 -0000 Author: adrian Date: Wed Aug 15 07:52:49 2012 New Revision: 239287 URL: http://svn.freebsd.org/changeset/base/239287 Log: Extend the duration calculations to work with three and four stream rates. Modified: head/sys/dev/ath/ath_hal/ah.c Modified: head/sys/dev/ath/ath_hal/ah.c ============================================================================== --- head/sys/dev/ath/ath_hal/ah.c Wed Aug 15 07:50:42 2012 (r239286) +++ head/sys/dev/ath/ath_hal/ah.c Wed Aug 15 07:52:49 2012 (r239287) @@ -275,31 +275,38 @@ ath_hal_pkt_txtime(struct ath_hal *ah, c /* 11n frame - extract out the number of spatial streams */ numStreams = HT_RC_2_STREAMS(rc); - KASSERT(numStreams == 1 || numStreams == 2, ("number of spatial streams needs to be 1 or 2: MCS rate 0x%x!", rateix)); + KASSERT(numStreams > 0 && numStreams <= 4, + ("number of spatial streams needs to be 1..3: MCS rate 0x%x!", + rateix)); return ath_computedur_ht(frameLen, rc, numStreams, isht40, shortPreamble); } +static const uint16_t ht20_bps[32] = { + 26, 52, 78, 104, 156, 208, 234, 260, + 52, 104, 156, 208, 312, 416, 468, 520, + 78, 156, 234, 312, 468, 624, 702, 780, + 104, 208, 312, 416, 624, 832, 936, 1040 +}; +static const uint16_t ht40_bps[32] = { + 54, 108, 162, 216, 324, 432, 486, 540, + 108, 216, 324, 432, 648, 864, 972, 1080, + 162, 324, 486, 648, 972, 1296, 1458, 1620, + 216, 432, 648, 864, 1296, 1728, 1944, 2160 +}; + /* * Calculate the transmit duration of an 11n frame. * This only works for MCS0->MCS15. */ uint32_t -ath_computedur_ht(uint32_t frameLen, uint16_t rate, int streams, HAL_BOOL isht40, - HAL_BOOL isShortGI) +ath_computedur_ht(uint32_t frameLen, uint16_t rate, int streams, + HAL_BOOL isht40, HAL_BOOL isShortGI) { - static const uint16_t ht20_bps[16] = { - 26, 52, 78, 104, 156, 208, 234, 260, - 52, 104, 156, 208, 312, 416, 468, 520 - }; - static const uint16_t ht40_bps[16] = { - 54, 108, 162, 216, 324, 432, 486, 540, - 108, 216, 324, 432, 648, 864, 972, 1080, - }; uint32_t bitsPerSymbol, numBits, numSymbols, txTime; KASSERT(rate & IEEE80211_RATE_MCS, ("not mcs %d", rate)); - KASSERT((rate &~ IEEE80211_RATE_MCS) < 16, ("bad mcs 0x%x", rate)); + KASSERT((rate &~ IEEE80211_RATE_MCS) < 31, ("bad mcs 0x%x", rate)); if (isht40) bitsPerSymbol = ht40_bps[rate & 0xf];