Cleanup ath_hal_computetxtime's handling of 1/2 and 1/4-width channels:
o mark phy type to indicate 1/2 or 1/4-rate operation o use phy type instead of channel attributes to identify 1/2 and 1/4-rate operation o general cleanup of code including move phy constants to ah_internal.h Eventually this code should go away and we should use the net0211 equivalents.
This commit is contained in:
parent
544347253f
commit
17e45e1934
@ -166,11 +166,7 @@ ath_hal_computetxtime(struct ath_hal *ah,
|
||||
if (kbps == 0)
|
||||
return 0;
|
||||
switch (rates->info[rateix].phy) {
|
||||
|
||||
case IEEE80211_T_CCK:
|
||||
#define CCK_SIFS_TIME 10
|
||||
#define CCK_PREAMBLE_BITS 144
|
||||
#define CCK_PLCP_BITS 48
|
||||
phyTime = CCK_PREAMBLE_BITS + CCK_PLCP_BITS;
|
||||
if (shortPreamble && rates->info[rateix].shortPreamble)
|
||||
phyTime >>= 1;
|
||||
@ -178,81 +174,47 @@ ath_hal_computetxtime(struct ath_hal *ah,
|
||||
txTime = CCK_SIFS_TIME + phyTime
|
||||
+ ((numBits * 1000)/kbps);
|
||||
break;
|
||||
#undef CCK_SIFS_TIME
|
||||
#undef CCK_PREAMBLE_BITS
|
||||
#undef CCK_PLCP_BITS
|
||||
|
||||
case IEEE80211_T_OFDM:
|
||||
#define OFDM_SIFS_TIME 16
|
||||
#define OFDM_PREAMBLE_TIME 20
|
||||
#define OFDM_PLCP_BITS 22
|
||||
#define OFDM_SYMBOL_TIME 4
|
||||
bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME) / 1000;
|
||||
HALASSERT(bitsPerSymbol != 0);
|
||||
|
||||
#define OFDM_SIFS_TIME_HALF 32
|
||||
#define OFDM_PREAMBLE_TIME_HALF 40
|
||||
#define OFDM_PLCP_BITS_HALF 22
|
||||
#define OFDM_SYMBOL_TIME_HALF 8
|
||||
|
||||
#define OFDM_SIFS_TIME_QUARTER 64
|
||||
#define OFDM_PREAMBLE_TIME_QUARTER 80
|
||||
#define OFDM_PLCP_BITS_QUARTER 22
|
||||
#define OFDM_SYMBOL_TIME_QUARTER 16
|
||||
|
||||
if (AH_PRIVATE(ah)->ah_curchan != AH_NULL &&
|
||||
IEEE80211_IS_CHAN_QUARTER(AH_PRIVATE(ah)->ah_curchan)) {
|
||||
bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_QUARTER) / 1000;
|
||||
HALASSERT(bitsPerSymbol != 0);
|
||||
|
||||
numBits = OFDM_PLCP_BITS + (frameLen << 3);
|
||||
numSymbols = howmany(numBits, bitsPerSymbol);
|
||||
txTime = OFDM_SIFS_TIME_QUARTER
|
||||
+ OFDM_PREAMBLE_TIME_QUARTER
|
||||
+ (numSymbols * OFDM_SYMBOL_TIME_QUARTER);
|
||||
} else if (AH_PRIVATE(ah)->ah_curchan != AH_NULL &&
|
||||
IEEE80211_IS_CHAN_HALF(AH_PRIVATE(ah)->ah_curchan)) {
|
||||
bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_HALF) / 1000;
|
||||
HALASSERT(bitsPerSymbol != 0);
|
||||
|
||||
numBits = OFDM_PLCP_BITS + (frameLen << 3);
|
||||
numSymbols = howmany(numBits, bitsPerSymbol);
|
||||
txTime = OFDM_SIFS_TIME_HALF +
|
||||
OFDM_PREAMBLE_TIME_HALF
|
||||
+ (numSymbols * OFDM_SYMBOL_TIME_HALF);
|
||||
} else { /* full rate channel */
|
||||
bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME) / 1000;
|
||||
HALASSERT(bitsPerSymbol != 0);
|
||||
|
||||
numBits = OFDM_PLCP_BITS + (frameLen << 3);
|
||||
numSymbols = howmany(numBits, bitsPerSymbol);
|
||||
txTime = OFDM_SIFS_TIME + OFDM_PREAMBLE_TIME
|
||||
+ (numSymbols * OFDM_SYMBOL_TIME);
|
||||
}
|
||||
numBits = OFDM_PLCP_BITS + (frameLen << 3);
|
||||
numSymbols = howmany(numBits, bitsPerSymbol);
|
||||
txTime = OFDM_SIFS_TIME
|
||||
+ OFDM_PREAMBLE_TIME
|
||||
+ (numSymbols * OFDM_SYMBOL_TIME);
|
||||
break;
|
||||
case IEEE80211_T_OFDM_HALF:
|
||||
bitsPerSymbol = (kbps * OFDM_HALF_SYMBOL_TIME) / 1000;
|
||||
HALASSERT(bitsPerSymbol != 0);
|
||||
|
||||
#undef OFDM_SIFS_TIME
|
||||
#undef OFDM_PREAMBLE_TIME
|
||||
#undef OFDM_PLCP_BITS
|
||||
#undef OFDM_SYMBOL_TIME
|
||||
numBits = OFDM_HALF_PLCP_BITS + (frameLen << 3);
|
||||
numSymbols = howmany(numBits, bitsPerSymbol);
|
||||
txTime = OFDM_HALF_SIFS_TIME
|
||||
+ OFDM_HALF_PREAMBLE_TIME
|
||||
+ (numSymbols * OFDM_HALF_SYMBOL_TIME);
|
||||
break;
|
||||
case IEEE80211_T_OFDM_QUARTER:
|
||||
bitsPerSymbol = (kbps * OFDM_QUARTER_SYMBOL_TIME) / 1000;
|
||||
HALASSERT(bitsPerSymbol != 0);
|
||||
|
||||
numBits = OFDM_QUARTER_PLCP_BITS + (frameLen << 3);
|
||||
numSymbols = howmany(numBits, bitsPerSymbol);
|
||||
txTime = OFDM_QUARTER_SIFS_TIME
|
||||
+ OFDM_QUARTER_PREAMBLE_TIME
|
||||
+ (numSymbols * OFDM_QUARTER_SYMBOL_TIME);
|
||||
break;
|
||||
case IEEE80211_T_TURBO:
|
||||
#define TURBO_SIFS_TIME 8
|
||||
#define TURBO_PREAMBLE_TIME 14
|
||||
#define TURBO_PLCP_BITS 22
|
||||
#define TURBO_SYMBOL_TIME 4
|
||||
/* we still save OFDM rates in kbps - so double them */
|
||||
bitsPerSymbol = ((kbps << 1) * TURBO_SYMBOL_TIME) / 1000;
|
||||
HALASSERT(bitsPerSymbol != 0);
|
||||
|
||||
numBits = TURBO_PLCP_BITS + (frameLen << 3);
|
||||
numSymbols = howmany(numBits, bitsPerSymbol);
|
||||
txTime = TURBO_SIFS_TIME + TURBO_PREAMBLE_TIME
|
||||
+ (numSymbols * TURBO_SYMBOL_TIME);
|
||||
numBits = TURBO_PLCP_BITS + (frameLen << 3);
|
||||
numSymbols = howmany(numBits, bitsPerSymbol);
|
||||
txTime = TURBO_SIFS_TIME
|
||||
+ TURBO_PREAMBLE_TIME
|
||||
+ (numSymbols * TURBO_SYMBOL_TIME);
|
||||
break;
|
||||
#undef TURBO_SIFS_TIME
|
||||
#undef TURBO_PREAMBLE_TIME
|
||||
#undef TURBO_PLCP_BITS
|
||||
#undef TURBO_SYMBOL_TIME
|
||||
|
||||
default:
|
||||
HALDEBUG(ah, HAL_DEBUG_PHYIO,
|
||||
"%s: unknown phy %u (rate ix %u)\n",
|
||||
|
@ -773,5 +773,29 @@ extern void ath_hal_ini_bank_setup(uint32_t data[], const HAL_INI_ARRAY *ia,
|
||||
extern int ath_hal_ini_bank_write(struct ath_hal *ah, const HAL_INI_ARRAY *ia,
|
||||
const uint32_t data[], int regWr);
|
||||
|
||||
#define CCK_SIFS_TIME 10
|
||||
#define CCK_PREAMBLE_BITS 144
|
||||
#define CCK_PLCP_BITS 48
|
||||
|
||||
#define OFDM_SIFS_TIME 16
|
||||
#define OFDM_PREAMBLE_TIME 20
|
||||
#define OFDM_PLCP_BITS 22
|
||||
#define OFDM_SYMBOL_TIME 4
|
||||
|
||||
#define OFDM_HALF_SIFS_TIME 32
|
||||
#define OFDM_HALF_PREAMBLE_TIME 40
|
||||
#define OFDM_HALF_PLCP_BITS 22
|
||||
#define OFDM_HALF_SYMBOL_TIME 8
|
||||
|
||||
#define OFDM_QUARTER_SIFS_TIME 64
|
||||
#define OFDM_QUARTER_PREAMBLE_TIME 80
|
||||
#define OFDM_QUARTER_PLCP_BITS 22
|
||||
#define OFDM_QUARTER_SYMBOL_TIME 16
|
||||
|
||||
#define TURBO_SIFS_TIME 8
|
||||
#define TURBO_PREAMBLE_TIME 14
|
||||
#define TURBO_PLCP_BITS 22
|
||||
#define TURBO_SYMBOL_TIME 4
|
||||
|
||||
#define WLAN_CTRL_FRAME_SIZE (2+2+6+4) /* ACK+FCS */
|
||||
#endif /* _ATH_AH_INTERAL_H_ */
|
||||
|
@ -14,7 +14,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* $Id: ar5212_phy.c,v 1.5 2008/11/15 03:43:53 sam Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include "opt_ah.h"
|
||||
|
||||
@ -27,6 +27,8 @@
|
||||
#define OFDM IEEE80211_T_OFDM
|
||||
#define CCK IEEE80211_T_CCK
|
||||
#define TURBO IEEE80211_T_TURBO
|
||||
#define HALF IEEE80211_T_OFDM_HALF
|
||||
#define QUART IEEE80211_T_OFDM_QUARTER
|
||||
|
||||
HAL_RATE_TABLE ar5212_11a_table = {
|
||||
8, /* number of rates */
|
||||
@ -51,14 +53,14 @@ HAL_RATE_TABLE ar5212_half_table = {
|
||||
{
|
||||
/* short ctrl */
|
||||
/* valid rateCode Preamble dot11Rate Rate */
|
||||
/* 6 Mb */ { AH_TRUE, OFDM, 3000, 0x0b, 0x00, (0x80|6), 0 },
|
||||
/* 9 Mb */ { AH_TRUE, OFDM, 4500, 0x0f, 0x00, 9, 0 },
|
||||
/* 12 Mb */ { AH_TRUE, OFDM, 6000, 0x0a, 0x00, (0x80|12), 2 },
|
||||
/* 18 Mb */ { AH_TRUE, OFDM, 9000, 0x0e, 0x00, 18, 2 },
|
||||
/* 24 Mb */ { AH_TRUE, OFDM, 12000, 0x09, 0x00, (0x80|24), 4 },
|
||||
/* 36 Mb */ { AH_TRUE, OFDM, 18000, 0x0d, 0x00, 36, 4 },
|
||||
/* 48 Mb */ { AH_TRUE, OFDM, 24000, 0x08, 0x00, 48, 4 },
|
||||
/* 54 Mb */ { AH_TRUE, OFDM, 27000, 0x0c, 0x00, 54, 4 }
|
||||
/* 3 Mb */ { AH_TRUE, HALF, 3000, 0x0b, 0x00, (0x80|6), 0 },
|
||||
/* 4.5 Mb */ { AH_TRUE, HALF, 4500, 0x0f, 0x00, 9, 0 },
|
||||
/* 6 Mb */ { AH_TRUE, HALF, 6000, 0x0a, 0x00, (0x80|12), 2 },
|
||||
/* 9 Mb */ { AH_TRUE, HALF, 9000, 0x0e, 0x00, 18, 2 },
|
||||
/* 12 Mb */ { AH_TRUE, HALF, 12000, 0x09, 0x00, (0x80|24), 4 },
|
||||
/* 18 Mb */ { AH_TRUE, HALF, 18000, 0x0d, 0x00, 36, 4 },
|
||||
/* 24 Mb */ { AH_TRUE, HALF, 24000, 0x08, 0x00, 48, 4 },
|
||||
/* 27 Mb */ { AH_TRUE, HALF, 27000, 0x0c, 0x00, 54, 4 }
|
||||
},
|
||||
};
|
||||
|
||||
@ -68,14 +70,14 @@ HAL_RATE_TABLE ar5212_quarter_table = {
|
||||
{
|
||||
/* short ctrl */
|
||||
/* valid rateCode Preamble dot11Rate Rate */
|
||||
/* 6 Mb */ { AH_TRUE, OFDM, 1500, 0x0b, 0x00, (0x80|3), 0 },
|
||||
/* 9 Mb */ { AH_TRUE, OFDM, 2250, 0x0f, 0x00, 4, 0 },
|
||||
/* 12 Mb */ { AH_TRUE, OFDM, 3000, 0x0a, 0x00, (0x80|6), 2 },
|
||||
/* 18 Mb */ { AH_TRUE, OFDM, 4500, 0x0e, 0x00, 9, 2 },
|
||||
/* 24 Mb */ { AH_TRUE, OFDM, 6000, 0x09, 0x00, (0x80|12), 4 },
|
||||
/* 36 Mb */ { AH_TRUE, OFDM, 9000, 0x0d, 0x00, 18, 4 },
|
||||
/* 48 Mb */ { AH_TRUE, OFDM, 12000, 0x08, 0x00, 24, 4 },
|
||||
/* 54 Mb */ { AH_TRUE, OFDM, 13500, 0x0c, 0x00, 27, 4 }
|
||||
/* 1.5 Mb */ { AH_TRUE, QUART, 1500, 0x0b, 0x00, (0x80|3), 0 },
|
||||
/* 2 Mb */ { AH_TRUE, QUART, 2250, 0x0f, 0x00, 4, 0 },
|
||||
/* 3 Mb */ { AH_TRUE, QUART, 3000, 0x0a, 0x00, (0x80|6), 2 },
|
||||
/* 4.5 Mb */ { AH_TRUE, QUART, 4500, 0x0e, 0x00, 9, 2 },
|
||||
/* 6 Mb */ { AH_TRUE, QUART, 6000, 0x09, 0x00, (0x80|12), 4 },
|
||||
/* 9 Mb */ { AH_TRUE, QUART, 9000, 0x0d, 0x00, 18, 4 },
|
||||
/* 12 Mb */ { AH_TRUE, QUART, 12000, 0x08, 0x00, 24, 4 },
|
||||
/*13.5 Mb */ { AH_TRUE, QUART, 13500, 0x0c, 0x00, 27, 4 }
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user