2 * Copyright (c) 2000-2002 Atheros Communications, Inc., All Rights Reserved
4 * Definitions for core driver
5 * This is a common header file for all platforms and operating systems.
7 #ifndef _RATECTRL11N_H_
8 #define _RATECTRL11N_H_
10 /* HT 20/40 rates. If 20 bit is enabled then that rate is
11 * used only in 20 mode. If both 20/40 bits are enabled
12 * then that rate can be used for both 20 and 40 mode */
16 #define TRUE_2040 (TRUE_20|TRUE_40)
17 #define TRUE_ALL_11N (TRUE_2040|TRUE)
33 #define WLAN_RC_PHY_DS(_phy) ((_phy == WLAN_RC_PHY_HT_20_DS) \
34 || (_phy == WLAN_RC_PHY_HT_40_DS) \
35 || (_phy == WLAN_RC_PHY_HT_20_DS_HGI) \
36 || (_phy == WLAN_RC_PHY_HT_40_DS_HGI))
37 #define WLAN_RC_PHY_40(_phy) ((_phy == WLAN_RC_PHY_HT_40_SS) \
38 || (_phy == WLAN_RC_PHY_HT_40_DS) \
39 || (_phy == WLAN_RC_PHY_HT_40_SS_HGI) \
40 || (_phy == WLAN_RC_PHY_HT_40_DS_HGI))
41 #define WLAN_RC_PHY_20(_phy) ((_phy == WLAN_RC_PHY_HT_20_SS) \
42 || (_phy == WLAN_RC_PHY_HT_20_DS) \
43 || (_phy == WLAN_RC_PHY_HT_20_SS_HGI) \
44 || (_phy == WLAN_RC_PHY_HT_20_DS_HGI))
45 #define WLAN_RC_PHY_SGI(_phy) ((_phy == WLAN_RC_PHY_HT_20_SS_HGI) \
46 || (_phy == WLAN_RC_PHY_HT_20_DS_HGI) \
47 || (_phy == WLAN_RC_PHY_HT_40_SS_HGI) \
48 || (_phy == WLAN_RC_PHY_HT_40_DS_HGI))
50 #define WLAN_RC_PHY_HT(_phy) (_phy >= WLAN_RC_PHY_HT_20_SS)
52 /* Returns the capflag mode */
54 #define WLAN_RC_CAP_MODE(capflag) (((capflag & WLAN_RC_HT_FLAG)? \
55 (capflag & WLAN_RC_40_FLAG)?TRUE_40:TRUE_20: \
58 /* Return TRUE if flag supports HT20 && client supports HT20 or
59 * return TRUE if flag supports HT40 && client supports HT40.
60 * This is used becos some rates overlap between HT20/HT40.
63 #define WLAN_RC_PHY_HT_VALID(flag, capflag) (((flag & TRUE_20) && !(capflag \
64 & WLAN_RC_40_FLAG)) || ((flag & TRUE_40) && \
65 (capflag & WLAN_RC_40_FLAG)))
67 #define WLAN_RC_DS_FLAG (0x01)
68 #define WLAN_RC_40_FLAG (0x02)
69 #define WLAN_RC_HT40_SGI_FLAG (0x04)
70 #define WLAN_RC_HT_FLAG (0x08)
71 #define WLAN_RC_STBC_FLAG (0x30) /* 2 bits */
72 #define WLAN_RC_STBC_FLAG_S ( 4)
73 #define WLAN_RC_WEP_TKIP_FLAG (0x100)
75 /* Index into the rate table */
76 #define INIT_RATE_MAX_20 23
77 #define INIT_RATE_MAX_40 40
80 * Rate Table structure for various modes - 'b', 'a', 'g', 'xr';
81 * order of fields in info structure is important because hardcoded
82 * structures are initialized within the hal for these
85 #ifndef MAGPIE_MERLIN // K2
86 #define RATE_TABLE_11N_SIZE 54
88 #define RATE_TABLE_11N_SIZE 64
91 #define MAX_SUPPORTED_MCS 128
93 typedef struct regDataLenTable {
95 A_UINT16 frameLenRateIndex[RATE_TABLE_11N_SIZE];
99 A_BOOL valid; /* Valid for use in rate control */
100 A_BOOL validSingleStream;/* Valid for use in rate control for single stream operation */
102 A_BOOL validSTBC; /* Valid for use in rate control for single stream operation */
104 WLAN_PHY phy; /* CCK/OFDM/TURBO/XR */
105 A_UINT32 rateKbps; /* Rate in Kbits per second */
106 A_UINT32 userRateKbps; /* User rate in KBits per second */
107 A_UINT8 rateCode; /* rate that goes into hw descriptors */
108 A_UINT8 shortPreamble; /* Mask for enabling short preamble in rate code for CCK */
109 A_UINT8 dot11Rate; /* Value that goes into supported rates info element of MLME */
110 A_UINT8 controlRate; /* Index of next lower basic rate, used for duration computation */
111 A_RSSI rssiAckValidMin; /* Rate control related information */
112 A_RSSI rssiAckDeltaMin; /* Rate control related information */
113 A_UINT8 baseIndex; /* base rate index */
114 A_UINT8 cw40Index; /* 40cap rate index */
115 A_UINT8 sgiIndex; /* shortgi rate index */
116 A_UINT8 htIndex; /* shortgi rate index */
117 A_UINT8 txChainMask_2ch; /* transmit chain mask */
118 A_UINT8 txChainMask_3ch; /* transmit chain mask */
119 A_UINT32 max4msframelen; /* Maximum frame length(bytes) for 4ms tx duration */
120 A_BOOL uapsdvalid; /* Valid for UAPSD nodes */
125 A_UINT8 probeInterval; /* interval for ratectrl to probe for other rates */
126 A_UINT8 rssiReduceInterval; /* interval for ratectrl to reduce RSSI */
127 A_UINT8 initialRateMax; /* the initial rateMax value used in rcSibUpdate() */
132 * Update the SIB's rate control information
134 * This should be called when the supported rates change
135 * (e.g. SME operation, wireless mode change)
137 * It will determine which rates are valid for use.
139 void rcSibUpdate_11n(struct ath_softc_tgt *,
140 struct ath_node_target *,
143 struct ieee80211_rate *rs);
146 * Determines and returns the new Tx rate index.
148 void rcRateFind_11n(struct ath_softc_tgt *sc,
149 struct ath_node_target *an,
154 struct ath_rc_series series[],
158 * This routine is called by the Tx interrupt service routine to give
159 * the status of previous frames.
161 void rcUpdate_11n(struct ath_softc_tgt *sc,
162 struct ath_node_target *an,
166 struct ath_rc_series rcs[],
171 void ath_tx_status_update_rate(struct ath_softc_tgt *sc,
172 struct ath_rc_series rcs[],
174 WMI_TXSTATUS_EVENT *txs);
176 #endif /* _RATECTRL11N_H_ */