On Tue, Nov 06, 2007 at 02:33:53AM -0800, akpm@linux-foundation.org wrote:
[mmotm.git] / drivers / staging / winbond / mto.h
blob4fe24b0f2791d2d58380186533ce40b57543c0ce
1 //==================================================================
2 // MTO.H
3 //
4 // Revision history
5 //=================================
6 // 20030110 UN20 Pete Chao
7 // Initial Release
8 //
9 // Copyright (c) 2003 Winbond Electronics Corp. All rights reserved.
10 //==================================================================
11 #ifndef __MTO_H__
12 #define __MTO_H__
14 #include <linux/types.h>
16 struct wbsoft_priv;
18 // LA20040210_DTO kevin
19 //#define MTO_PREAMBLE_LONG 0
20 //#define MTO_PREAMBLE_SHORT 1
21 #define MTO_PREAMBLE_LONG WLAN_PREAMBLE_TYPE_LONG
22 #define MTO_PREAMBLE_SHORT WLAN_PREAMBLE_TYPE_SHORT
24 //============================================================================
25 // struct _MTOParameters --
27 // Defines the parameters used in the MAC Throughput Optimization algorithm
28 //============================================================================
29 struct wb35_mto_params {
30 //--------- wkchen added -------------
31 u32 TxFlowCount; //to judge what kind the tx flow(sparse or busy) is
32 //------------------------------------------------
34 //--------- DTO threshold parameters -------------
35 u16 DTO_PeriodicCheckCycle;
36 u16 DTO_RssiThForAntDiv;
38 u16 DTO_TxCountThForCalcNewRate;
39 u16 DTO_TxRateIncTh;
41 u16 DTO_TxRateDecTh;
42 u16 DTO_TxRateEqTh;
44 u16 DTO_TxRateBackOff;
45 u16 DTO_TxRetryRateReduce;
47 u16 DTO_TxPowerIndex; //0 ~ 31
48 u16 reserved_1;
49 //------------------------------------------------
51 u8 PowerChangeEnable;
52 u8 AntDiversityEnable;
53 u8 CCA_Mode;
54 u8 CCA_Mode_Setup;
55 u8 Preamble_Type;
56 u8 PreambleChangeEnable;
58 u8 DataRateLevel;
59 u8 DataRateChangeEnable;
60 u8 FragThresholdLevel;
61 u8 FragThresholdChangeEnable;
63 u16 RTSThreshold;
64 u16 RTSThreshold_Setup;
66 u32 AvgIdleSlot;
67 u32 Pr_Interf;
68 u32 AvgGapBtwnInterf;
70 u8 RTSChangeEnable;
71 u8 Ant_sel;
72 u8 aging_timeout;
73 u8 reserved_2;
75 u32 Cnt_Ant[2];
76 u32 SQ_Ant[2];
78 // 20040510 remove from globe vairable
79 u8 FallbackRateLevel;
80 u8 OfdmRateLevel;
82 u8 RatePolicy;
83 u8 reserved_3[3];
85 // For RSSI turning
86 s32 RSSI_high;
87 s32 RSSI_low;
92 #define MTO_DATA() (adapter->sMtoPara)
93 #define MTO_HAL() (&adapter->sHwData)
94 #define MTO_SET_PREAMBLE_TYPE(x) // 20040511 Turbo mark LM_PREAMBLE_TYPE(&pcore_data->lm_data) = (x)
95 #define MTO_ENABLE (adapter->sLocalPara.TxRateMode == RATE_AUTO)
96 #define MTO_TXPOWER_FROM_EEPROM (adapter->sHwData.PowerIndexFromEEPROM)
97 #define LOCAL_ANTENNA_NO() (adapter->sLocalPara.bAntennaNo)
98 #define LOCAL_IS_CONNECTED() (adapter->sLocalPara.wConnectedSTAindex != 0)
99 #define MTO_INITTXRATE_MODE (adapter->sHwData.SoftwareSet&0x2) //bit 1
101 #define MTO_POWER_CHANGE_ENABLE() MTO_DATA().PowerChangeEnable
102 #define MTO_CCA_MODE() MTO_DATA().CCA_Mode
103 #define MTO_CCA_MODE_SETUP() MTO_DATA().CCA_Mode_Setup
104 #define MTO_PREAMBLE_TYPE() MTO_DATA().Preamble_Type
105 #define MTO_PREAMBLE_CHANGE_ENABLE() MTO_DATA().PreambleChangeEnable
107 #define MTO_RATE_LEVEL() MTO_DATA().DataRateLevel
108 #define MTO_OFDM_RATE_LEVEL() MTO_DATA().OfdmRateLevel
109 #define MTO_RATE_CHANGE_ENABLE() MTO_DATA().DataRateChangeEnable
110 #define MTO_FRAG_TH_LEVEL() MTO_DATA().FragThresholdLevel
111 #define MTO_FRAG_CHANGE_ENABLE() MTO_DATA().FragThresholdChangeEnable
112 #define MTO_RTS_THRESHOLD() MTO_DATA().RTSThreshold
113 #define MTO_RTS_CHANGE_ENABLE() MTO_DATA().RTSChangeEnable
114 #define MTO_RTS_THRESHOLD_SETUP() MTO_DATA().RTSThreshold_Setup
116 #define MTO_AVG_IDLE_SLOT() MTO_DATA().AvgIdleSlot
117 #define MTO_PR_INTERF() MTO_DATA().Pr_Interf
118 #define MTO_AVG_GAP_BTWN_INTERF() MTO_DATA().AvgGapBtwnInterf
120 #define MTO_CNT_ANT(x) MTO_DATA().Cnt_Ant[(x)]
121 #define MTO_SQ_ANT(x) MTO_DATA().SQ_Ant[(x)]
122 #define MTO_AGING_TIMEOUT() MTO_DATA().aging_timeout
125 #define MTO_TXFLOWCOUNT() MTO_DATA().TxFlowCount
126 //--------- DTO threshold parameters -------------
127 #define MTOPARA_PERIODIC_CHECK_CYCLE() MTO_DATA().DTO_PeriodicCheckCycle
128 #define MTOPARA_RSSI_TH_FOR_ANTDIV() MTO_DATA().DTO_RssiThForAntDiv
129 #define MTOPARA_TXCOUNT_TH_FOR_CALC_RATE() MTO_DATA().DTO_TxCountThForCalcNewRate
130 #define MTOPARA_TXRATE_INC_TH() MTO_DATA().DTO_TxRateIncTh
131 #define MTOPARA_TXRATE_DEC_TH() MTO_DATA().DTO_TxRateDecTh
132 #define MTOPARA_TXRATE_EQ_TH() MTO_DATA().DTO_TxRateEqTh
133 #define MTOPARA_TXRATE_BACKOFF() MTO_DATA().DTO_TxRateBackOff
134 #define MTOPARA_TXRETRYRATE_REDUCE() MTO_DATA().DTO_TxRetryRateReduce
135 #define MTOPARA_TXPOWER_INDEX() MTO_DATA().DTO_TxPowerIndex
136 //------------------------------------------------
139 extern u16 MTO_Frag_Th_Tbl[];
141 #define MTO_DATA_RATE() MTO_Data_Rate_Tbl[MTO_RATE_LEVEL()]
142 #define MTO_FRAG_TH() MTO_Frag_Th_Tbl[MTO_FRAG_TH_LEVEL()]
144 typedef struct {
145 u8 tx_rate;
146 u8 tx_retry_rate;
147 } TXRETRY_REC;
149 extern void MTO_Init(struct wbsoft_priv *);
150 extern void MTO_PeriodicTimerExpired(struct wbsoft_priv *);
151 extern void MTO_SetDTORateRange(struct wbsoft_priv *, u8 *, u8);
152 extern u8 MTO_GetTxRate(struct wbsoft_priv *adapter, u32 fpdu_len);
153 extern u8 MTO_GetTxFallbackRate(struct wbsoft_priv *adapter);
154 extern void MTO_SetTxCount(struct wbsoft_priv *adapter, u8 t0, u8 index);
156 #endif //__MTO_H__