diff options
author | adrian <adrian@FreeBSD.org> | 2012-08-15 07:52:49 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2012-08-15 07:52:49 +0000 |
commit | bfb736b884b668b78d5aed384eb96e0fb88d2aba (patch) | |
tree | 9d00e13b0fde6e7db74a4d1f1d3bab43325cf44c | |
parent | 6751f75569478320c23c99e458dda4d65b1467cd (diff) | |
download | FreeBSD-src-bfb736b884b668b78d5aed384eb96e0fb88d2aba.zip FreeBSD-src-bfb736b884b668b78d5aed384eb96e0fb88d2aba.tar.gz |
Extend the duration calculations to work with three and four stream
rates.
-rw-r--r-- | sys/dev/ath/ath_hal/ah.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/sys/dev/ath/ath_hal/ah.c b/sys/dev/ath/ath_hal/ah.c index 36815f1..5774694 100644 --- a/sys/dev/ath/ath_hal/ah.c +++ b/sys/dev/ath/ath_hal/ah.c @@ -275,31 +275,38 @@ ath_hal_pkt_txtime(struct ath_hal *ah, const HAL_RATE_TABLE *rates, uint32_t fra /* 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]; |