1 //==================================================================
5 //=================================
6 // 20030110 UN20 Pete Chao
9 // Copyright (c) 2003 Winbond Electronics Corp. All rights reserved.
10 //==================================================================
14 #include <linux/types.h>
18 #define MTO_DEFAULT_TH_CNT 5
19 #define MTO_DEFAULT_TH_SQ3 112 //OLD IS 13 reference JohnXu
20 #define MTO_DEFAULT_TH_IDLE_SLOT 15
21 #define MTO_DEFAULT_TH_PR_INTERF 30
22 #define MTO_DEFAULT_TMR_AGING 25 // unit: slot time 10 reference JohnXu
23 #define MTO_DEFAULT_TMR_PERIODIC 5 // unit: slot time
25 #define MTO_ANTENNA_DIVERSITY_OFF 0
26 #define MTO_ANTENNA_DIVERSITY_ON 1
28 // LA20040210_DTO kevin
29 //#define MTO_PREAMBLE_LONG 0
30 //#define MTO_PREAMBLE_SHORT 1
31 #define MTO_PREAMBLE_LONG WLAN_PREAMBLE_TYPE_LONG
32 #define MTO_PREAMBLE_SHORT WLAN_PREAMBLE_TYPE_SHORT
35 TOGGLE_STATE_IDLE
= 0,
36 TOGGLE_STATE_WAIT0
= 1,
37 TOGGLE_STATE_WAIT1
= 2,
38 TOGGLE_STATE_MAKEDESISION
= 3,
39 TOGGLE_STATE_BKOFF
= 4
43 RATE_CHGSTATE_IDLE
= 0,
44 RATE_CHGSTATE_CALCULATE
= 1,
45 RATE_CHGSTATE_BACKOFF
= 2
46 } TX_RATE_REDUCTION_STATE
;
48 //============================================================================
49 // struct _MTOParameters --
51 // Defines the parameters used in the MAC Throughput Optimization algorithm
52 //============================================================================
53 typedef struct _MTO_PARAMETERS
64 //--------- wkchen added -------------
65 u32 TxFlowCount
; //to judge what kind the tx flow(sparse or busy) is
66 //------------------------------------------------
68 //--------- DTO threshold parameters -------------
69 u16 DTO_PeriodicCheckCycle
;
70 u16 DTO_RssiThForAntDiv
;
72 u16 DTO_TxCountThForCalcNewRate
;
78 u16 DTO_TxRateBackOff
;
79 u16 DTO_TxRetryRateReduce
;
81 u16 DTO_TxPowerIndex
; //0 ~ 31
83 //------------------------------------------------
86 u8 AntDiversityEnable
;
93 u8 PreambleChangeEnable
;
96 u8 DataRateChangeEnable
;
97 u8 FragThresholdLevel
;
98 u8 FragThresholdChangeEnable
;
101 u16 RTSThreshold_Setup
;
105 u32 AvgGapBtwnInterf
;
115 // 20040510 remove from globe vairable
118 TOGGLE_STATE ToggleState
;
119 TX_RATE_REDUCTION_STATE TxRateReductionState
;
123 u8 FallbackRateLevel
;
133 } MTO_PARAMETERS
, *PMTO_PARAMETERS
;
136 #define MTO_DATA() (adapter->sMtoPara)
137 #define MTO_HAL() (&adapter->sHwData)
138 #define MTO_SET_PREAMBLE_TYPE(x) // 20040511 Turbo mark LM_PREAMBLE_TYPE(&pcore_data->lm_data) = (x)
139 #define MTO_ENABLE (adapter->sLocalPara.TxRateMode == RATE_AUTO)
140 #define MTO_TXPOWER_FROM_EEPROM (adapter->sHwData.PowerIndexFromEEPROM)
141 #define LOCAL_ANTENNA_NO() (adapter->sLocalPara.bAntennaNo)
142 #define LOCAL_IS_CONNECTED() (adapter->sLocalPara.wConnectedSTAindex != 0)
143 #define MTO_INITTXRATE_MODE (adapter->sHwData.SoftwareSet&0x2) //bit 1
144 // 20040510 Turbo add
145 #define MTO_TMR_CNT() MTO_DATA().TmrCnt
146 #define MTO_TOGGLE_STATE() MTO_DATA().ToggleState
147 #define MTO_TX_RATE_REDUCTION_STATE() MTO_DATA().TxRateReductionState
148 #define MTO_BACKOFF_TMR() MTO_DATA().BackoffTmr
149 #define MTO_LAST_RATE() MTO_DATA().Last_Rate
150 #define MTO_CO_EFFICENT() MTO_DATA().Co_efficent
152 #define MTO_TH_CNT() MTO_DATA().Th_Cnt
153 #define MTO_TH_SQ3() MTO_DATA().Th_SQ3
154 #define MTO_TH_IDLE_SLOT() MTO_DATA().Th_IdleSlot
155 #define MTO_TH_PR_INTERF() MTO_DATA().Th_PrInterf
157 #define MTO_TMR_AGING() MTO_DATA().Tmr_Aging
158 #define MTO_TMR_PERIODIC() MTO_DATA().Tmr_Periodic
160 #define MTO_POWER_CHANGE_ENABLE() MTO_DATA().PowerChangeEnable
161 #define MTO_ANT_DIVERSITY_ENABLE() adapter->sLocalPara.boAntennaDiversity
162 #define MTO_ANT_MAC() MTO_DATA().Ant_mac
163 #define MTO_ANT_DIVERSITY() MTO_DATA().Ant_div
164 #define MTO_CCA_MODE() MTO_DATA().CCA_Mode
165 #define MTO_CCA_MODE_SETUP() MTO_DATA().CCA_Mode_Setup
166 #define MTO_PREAMBLE_TYPE() MTO_DATA().Preamble_Type
167 #define MTO_PREAMBLE_CHANGE_ENABLE() MTO_DATA().PreambleChangeEnable
169 #define MTO_RATE_LEVEL() MTO_DATA().DataRateLevel
170 #define MTO_OFDM_RATE_LEVEL() MTO_DATA().OfdmRateLevel
171 #define MTO_RATE_CHANGE_ENABLE() MTO_DATA().DataRateChangeEnable
172 #define MTO_FRAG_TH_LEVEL() MTO_DATA().FragThresholdLevel
173 #define MTO_FRAG_CHANGE_ENABLE() MTO_DATA().FragThresholdChangeEnable
174 #define MTO_RTS_THRESHOLD() MTO_DATA().RTSThreshold
175 #define MTO_RTS_CHANGE_ENABLE() MTO_DATA().RTSChangeEnable
176 #define MTO_RTS_THRESHOLD_SETUP() MTO_DATA().RTSThreshold_Setup
178 #define MTO_AVG_IDLE_SLOT() MTO_DATA().AvgIdleSlot
179 #define MTO_PR_INTERF() MTO_DATA().Pr_Interf
180 #define MTO_AVG_GAP_BTWN_INTERF() MTO_DATA().AvgGapBtwnInterf
182 #define MTO_ANT_SEL() MTO_DATA().Ant_sel
183 #define MTO_CNT_ANT(x) MTO_DATA().Cnt_Ant[(x)]
184 #define MTO_SQ_ANT(x) MTO_DATA().SQ_Ant[(x)]
185 #define MTO_AGING_TIMEOUT() MTO_DATA().aging_timeout
188 #define MTO_TXFLOWCOUNT() MTO_DATA().TxFlowCount
189 //--------- DTO threshold parameters -------------
190 #define MTOPARA_PERIODIC_CHECK_CYCLE() MTO_DATA().DTO_PeriodicCheckCycle
191 #define MTOPARA_RSSI_TH_FOR_ANTDIV() MTO_DATA().DTO_RssiThForAntDiv
192 #define MTOPARA_TXCOUNT_TH_FOR_CALC_RATE() MTO_DATA().DTO_TxCountThForCalcNewRate
193 #define MTOPARA_TXRATE_INC_TH() MTO_DATA().DTO_TxRateIncTh
194 #define MTOPARA_TXRATE_DEC_TH() MTO_DATA().DTO_TxRateDecTh
195 #define MTOPARA_TXRATE_EQ_TH() MTO_DATA().DTO_TxRateEqTh
196 #define MTOPARA_TXRATE_BACKOFF() MTO_DATA().DTO_TxRateBackOff
197 #define MTOPARA_TXRETRYRATE_REDUCE() MTO_DATA().DTO_TxRetryRateReduce
198 #define MTOPARA_TXPOWER_INDEX() MTO_DATA().DTO_TxPowerIndex
199 //------------------------------------------------
202 extern u16 MTO_Frag_Th_Tbl
[];
204 #define MTO_DATA_RATE() MTO_Data_Rate_Tbl[MTO_RATE_LEVEL()]
205 #define MTO_FRAG_TH() MTO_Frag_Th_Tbl[MTO_FRAG_TH_LEVEL()]
212 typedef struct _STATISTICS_INFO
{
259 } STATISTICS_INFO
, *PSTATISTICS_INFO
;
261 extern void MTO_Init(struct wbsoft_priv
*);
262 extern void MTO_PeriodicTimerExpired(struct wbsoft_priv
*);
263 extern void MTO_SetDTORateRange(struct wbsoft_priv
*, u8
*, u8
);
264 extern u8
MTO_GetTxRate(struct wbsoft_priv
*adapter
, u32 fpdu_len
);
265 extern u8
MTO_GetTxFallbackRate(struct wbsoft_priv
*adapter
);
266 extern void MTO_SetTxCount(struct wbsoft_priv
*adapter
, u8 t0
, u8 index
);