Date: Thu, 18 Sep 2008 23:58:57 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 150060 for review Message-ID: <200809182358.m8INwvSU075687@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=150060 Change 150060 by sam@sam_ebb on 2008/09/18 23:58:11 checkpoint new routine to compute duration for ht frames; needs cleanup Affected files ... .. //depot/projects/vap/sys/net80211/ieee80211_phy.c#11 edit .. //depot/projects/vap/sys/net80211/ieee80211_phy.h#8 edit Differences ... ==== //depot/projects/vap/sys/net80211/ieee80211_phy.c#11 (text+ko) ==== @@ -471,3 +471,43 @@ } return txTime; } + +#define OFDM_PLCP_BITS 22 +#define HT_L_STF 8 +#define HT_L_LTF 8 +#define HT_L_SIG 4 +#define HT_SIG 8 +#define HT_STF 4 +#define HT_LTF(n) ((n) * 4) + +uint32_t +ieee80211_compute_duration_ht(const struct ieee80211_rate_table *rt, + uint32_t frameLen, uint16_t rate, + int streams, int isht40, int 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)); + + if (isht40) + bitsPerSymbol = ht40_bps[rate & 0xf]; + else + bitsPerSymbol = ht20_bps[rate & 0xf]; + numBits = OFDM_PLCP_BITS + (frameLen << 3); + numSymbols = howmany(numBits, bitsPerSymbol); + if (isShortGI) + txTime = ((numSymbols * 18) + 4) / 5; /* 3.6us */ + else + txTime = numSymbols * 4; /* 4us */ + return txTime + HT_L_STF + HT_L_LTF + + HT_L_SIG + HT_SIG + HT_STF + HT_LTF(streams); +} ==== //depot/projects/vap/sys/net80211/ieee80211_phy.h#8 (text+ko) ==== @@ -138,6 +138,12 @@ uint16_t ieee80211_compute_duration(const struct ieee80211_rate_table *, uint32_t frameLen, uint16_t rate, int isShortPreamble); /* + * Like ieee80211_compute_duration but for HT phy's. + */ +uint32_t ieee80211_compute_duration_ht(const struct ieee80211_rate_table *, + uint32_t frameLen, uint16_t rate, + int streams, int isht40, int isShortGI); +/* * Convert PLCP signal/rate field to 802.11 rate code (.5Mbits/s) */ uint8_t ieee80211_plcp2rate(uint8_t, enum ieee80211_phytype);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809182358.m8INwvSU075687>