From owner-p4-projects@FreeBSD.ORG Thu Sep 18 23:58:57 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 786B31065673; Thu, 18 Sep 2008 23:58:57 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C65E106564A for ; Thu, 18 Sep 2008 23:58:57 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 2922C8FC0C for ; Thu, 18 Sep 2008 23:58:57 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id m8INwvFv075693 for ; Thu, 18 Sep 2008 23:58:57 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id m8INwvSU075687 for perforce@freebsd.org; Thu, 18 Sep 2008 23:58:57 GMT (envelope-from sam@freebsd.org) Date: Thu, 18 Sep 2008 23:58:57 GMT Message-Id: <200809182358.m8INwvSU075687@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 150060 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Sep 2008 23:58:57 -0000 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);