1 /* 2 * ================================================================== 3 * MTO.H 4 * 5 * Copyright (c) 2003 Winbond Electronics Corp. All rights reserved. 6 * ================================================================== 7 */ 8 #ifndef __MTO_H__ 9 #define __MTO_H__ 10 11 #include <linux/types.h> 12 13 struct wbsoft_priv; 14 15 #define MTO_PREAMBLE_LONG WLAN_PREAMBLE_TYPE_LONG 16 #define MTO_PREAMBLE_SHORT WLAN_PREAMBLE_TYPE_SHORT 17 18 /* Defines the parameters used in the MAC Throughput Optimization algorithm */ 19 struct wb35_mto_params { 20 u32 TxFlowCount; /* to judge what kind the tx flow(sparse or busy) is */ 21 22 /* --------- DTO threshold parameters ------------- */ 23 u16 DTO_PeriodicCheckCycle; 24 u16 DTO_RssiThForAntDiv; 25 26 u16 DTO_TxCountThForCalcNewRate; 27 u16 DTO_TxRateIncTh; 28 29 u16 DTO_TxRateDecTh; 30 u16 DTO_TxRateEqTh; 31 32 u16 DTO_TxRateBackOff; 33 u16 DTO_TxRetryRateReduce; 34 35 u16 DTO_TxPowerIndex; /* 0 ~ 31 */ 36 u16 reserved_1; 37 /* ------------------------------------------------ */ 38 39 u8 PowerChangeEnable; 40 u8 AntDiversityEnable; 41 u8 CCA_Mode; 42 u8 CCA_Mode_Setup; 43 u8 Preamble_Type; 44 u8 PreambleChangeEnable; 45 46 u8 DataRateLevel; 47 u8 DataRateChangeEnable; 48 u8 FragThresholdLevel; 49 u8 FragThresholdChangeEnable; 50 51 u16 RTSThreshold; 52 u16 RTSThreshold_Setup; 53 54 u32 AvgIdleSlot; 55 u32 Pr_Interf; 56 u32 AvgGapBtwnInterf; 57 58 u8 RTSChangeEnable; 59 u8 Ant_sel; 60 u8 aging_timeout; 61 u8 reserved_2; 62 63 u32 Cnt_Ant[2]; 64 u32 SQ_Ant[2]; 65 66 u8 FallbackRateLevel; 67 u8 OfdmRateLevel; 68 69 u8 RatePolicy; 70 u8 reserved_3[3]; 71 72 /* For RSSI turning */ 73 s32 RSSI_high; 74 s32 RSSI_low; 75 }; 76 77 78 #define MTO_DATA() (adapter->sMtoPara) 79 #define MTO_HAL() (&adapter->sHwData) 80 #define MTO_SET_PREAMBLE_TYPE(x) /* Turbo mark LM_PREAMBLE_TYPE(&pcore_data->lm_data) = (x) */ 81 #define MTO_ENABLE (adapter->sLocalPara.TxRateMode == RATE_AUTO) 82 #define MTO_TXPOWER_FROM_EEPROM (adapter->sHwData.PowerIndexFromEEPROM) 83 #define LOCAL_ANTENNA_NO() (adapter->sLocalPara.bAntennaNo) 84 #define LOCAL_IS_CONNECTED() (adapter->sLocalPara.wConnectedSTAindex != 0) 85 #define MTO_INITTXRATE_MODE (adapter->sHwData.SoftwareSet&0x2) /* bit 1 */ 86 87 #define MTO_POWER_CHANGE_ENABLE() MTO_DATA().PowerChangeEnable 88 #define MTO_CCA_MODE() MTO_DATA().CCA_Mode 89 #define MTO_CCA_MODE_SETUP() MTO_DATA().CCA_Mode_Setup 90 #define MTO_PREAMBLE_TYPE() MTO_DATA().Preamble_Type 91 #define MTO_PREAMBLE_CHANGE_ENABLE() MTO_DATA().PreambleChangeEnable 92 93 #define MTO_RATE_LEVEL() MTO_DATA().DataRateLevel 94 #define MTO_OFDM_RATE_LEVEL() MTO_DATA().OfdmRateLevel 95 #define MTO_RATE_CHANGE_ENABLE() MTO_DATA().DataRateChangeEnable 96 #define MTO_FRAG_TH_LEVEL() MTO_DATA().FragThresholdLevel 97 #define MTO_FRAG_CHANGE_ENABLE() MTO_DATA().FragThresholdChangeEnable 98 #define MTO_RTS_THRESHOLD() MTO_DATA().RTSThreshold 99 #define MTO_RTS_CHANGE_ENABLE() MTO_DATA().RTSChangeEnable 100 #define MTO_RTS_THRESHOLD_SETUP() MTO_DATA().RTSThreshold_Setup 101 102 #define MTO_AVG_IDLE_SLOT() MTO_DATA().AvgIdleSlot 103 #define MTO_PR_INTERF() MTO_DATA().Pr_Interf 104 #define MTO_AVG_GAP_BTWN_INTERF() MTO_DATA().AvgGapBtwnInterf 105 106 #define MTO_CNT_ANT(x) MTO_DATA().Cnt_Ant[(x)] 107 #define MTO_SQ_ANT(x) MTO_DATA().SQ_Ant[(x)] 108 #define MTO_AGING_TIMEOUT() MTO_DATA().aging_timeout 109 110 #define MTO_TXFLOWCOUNT() MTO_DATA().TxFlowCount 111 112 /* --------- DTO threshold parameters ------------- */ 113 #define MTOPARA_PERIODIC_CHECK_CYCLE() MTO_DATA().DTO_PeriodicCheckCycle 114 #define MTOPARA_RSSI_TH_FOR_ANTDIV() MTO_DATA().DTO_RssiThForAntDiv 115 #define MTOPARA_TXCOUNT_TH_FOR_CALC_RATE() MTO_DATA().DTO_TxCountThForCalcNewRate 116 #define MTOPARA_TXRATE_INC_TH() MTO_DATA().DTO_TxRateIncTh 117 #define MTOPARA_TXRATE_DEC_TH() MTO_DATA().DTO_TxRateDecTh 118 #define MTOPARA_TXRATE_EQ_TH() MTO_DATA().DTO_TxRateEqTh 119 #define MTOPARA_TXRATE_BACKOFF() MTO_DATA().DTO_TxRateBackOff 120 #define MTOPARA_TXRETRYRATE_REDUCE() MTO_DATA().DTO_TxRetryRateReduce 121 #define MTOPARA_TXPOWER_INDEX() MTO_DATA().DTO_TxPowerIndex 122 /* ------------------------------------------------ */ 123 124 125 extern u16 MTO_Frag_Th_Tbl[]; 126 127 #define MTO_DATA_RATE() MTO_Data_Rate_Tbl[MTO_RATE_LEVEL()] 128 #define MTO_FRAG_TH() MTO_Frag_Th_Tbl[MTO_FRAG_TH_LEVEL()] 129 130 extern void MTO_Init(struct wbsoft_priv *); 131 extern void MTO_PeriodicTimerExpired(struct wbsoft_priv *); 132 extern void MTO_SetDTORateRange(struct wbsoft_priv *, u8 *, u8); 133 extern u8 MTO_GetTxRate(struct wbsoft_priv *adapter, u32 fpdu_len); 134 extern u8 MTO_GetTxFallbackRate(struct wbsoft_priv *adapter); 135 extern void MTO_SetTxCount(struct wbsoft_priv *adapter, u8 t0, u8 index); 136 137 #endif /* __MTO_H__ */ 138 139