Merge tag 'for-v3.13/clock-fixes-a' of git://git.kernel.org/pub/scm/linux/kernel...
[cascardo/linux.git] / drivers / staging / rtl8192u / r819xU_HTType.h
1 #ifndef _R819XU_HTTYPE_H_
2 #define _R819XU_HTTYPE_H_
3
4
5 /*----------------------------------------------------------------------
6  * The HT Capability element is present in beacons, association request,
7  * reassociation request and probe response frames
8  *----------------------------------------------------------------------*/
9
10 /* Operation mode value */
11 #define HT_OPMODE_NO_PROTECT            0
12 #define HT_OPMODE_OPTIONAL              1
13 #define HT_OPMODE_40MHZ_PROTECT         2
14 #define HT_OPMODE_MIXED                 3
15
16 /* MIMO Power Save Settings */
17 #define MIMO_PS_STATIC                  0
18 #define MIMO_PS_DYNAMIC                 1
19 #define MIMO_PS_NOLIMIT                 3
20
21
22 /* There should be 128 bits to cover all of the MCS rates. However, since
23  * 8190 does not support too much rates, one integer is quite enough. */
24
25 #define sHTCLng                         4
26
27
28 #define HT_SUPPORTED_MCS_1SS_BITMAP     0x000000ff
29 #define HT_SUPPORTED_MCS_2SS_BITMAP     0x0000ff00
30 #define HT_SUPPORTED_MCS_1SS_2SS_BITMAP \
31                 (HT_MCS_1SS_BITMAP | HT_MCS_1SS_2SS_BITMAP)
32
33
34 typedef enum _HT_MCS_RATE {
35         HT_MCS0   = 0x00000001,
36         HT_MCS1   = 0x00000002,
37         HT_MCS2   = 0x00000004,
38         HT_MCS3   = 0x00000008,
39         HT_MCS4   = 0x00000010,
40         HT_MCS5   = 0x00000020,
41         HT_MCS6   = 0x00000040,
42         HT_MCS7   = 0x00000080,
43         HT_MCS8   = 0x00000100,
44         HT_MCS9   = 0x00000200,
45         HT_MCS10  = 0x00000400,
46         HT_MCS11  = 0x00000800,
47         HT_MCS12  = 0x00001000,
48         HT_MCS13  = 0x00002000,
49         HT_MCS14  = 0x00004000,
50         HT_MCS15  = 0x00008000,
51         /* Do not define MCS32 here although 8190 support MCS32 */
52 } HT_MCS_RATE, *PHT_MCS_RATE;
53
54 /* Represent Channel Width in HT Capabilities */
55 typedef enum _HT_CHANNEL_WIDTH {
56         HT_CHANNEL_WIDTH_20    = 0,
57         HT_CHANNEL_WIDTH_20_40 = 1,
58 } HT_CHANNEL_WIDTH, *PHT_CHANNEL_WIDTH;
59
60 /* Represent Extension Channel Offset in HT Capabilities
61  * This is available only in 40Mhz mode. */
62 typedef enum _HT_EXTCHNL_OFFSET {
63         HT_EXTCHNL_OFFSET_NO_EXT = 0,
64         HT_EXTCHNL_OFFSET_UPPER  = 1,
65         HT_EXTCHNL_OFFSET_NO_DEF = 2,
66         HT_EXTCHNL_OFFSET_LOWER  = 3,
67 } HT_EXTCHNL_OFFSET, *PHT_EXTCHNL_OFFSET;
68
69 typedef enum _CHNLOP {
70         CHNLOP_NONE   = 0,      /* No Action now */
71         CHNLOP_SCAN   = 1,      /* Scan in progress */
72         CHNLOP_SWBW   = 2,      /* Bandwidth switching in progress */
73         CHNLOP_SWCHNL = 3,      /* Software Channel switching in progress */
74 } CHNLOP, *PCHNLOP;
75
76 /* Determine if the Channel Operation is in progress */
77 #define CHHLOP_IN_PROGRESS(_pHTInfo)    \
78                 (((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? TRUE : FALSE)
79
80
81 typedef enum _HT_ACTION {
82         ACT_RECOMMAND_WIDTH             = 0,
83         ACT_MIMO_PWR_SAVE               = 1,
84         ACT_PSMP                        = 2,
85         ACT_SET_PCO_PHASE               = 3,
86         ACT_MIMO_CHL_MEASURE            = 4,
87         ACT_RECIPROCITY_CORRECT         = 5,
88         ACT_MIMO_CSI_MATRICS            = 6,
89         ACT_MIMO_NOCOMPR_STEER          = 7,
90         ACT_MIMO_COMPR_STEER            = 8,
91         ACT_ANTENNA_SELECT              = 9,
92 } HT_ACTION, *PHT_ACTION;
93
94
95 /* Define sub-carrier mode for 40MHZ. */
96 typedef enum _HT_Bandwidth_40MHZ_Sub_Carrier {
97         SC_MODE_DUPLICATE = 0,
98         SC_MODE_LOWER     = 1,
99         SC_MODE_UPPER     = 2,
100         SC_MODE_FULL40MHZ = 3,
101 } HT_BW40_SC_E;
102
103 typedef struct _HT_CAPABILITY_ELE {
104
105         /* HT capability info */
106         u8      AdvCoding:1;
107         u8      ChlWidth:1;
108         u8      MimoPwrSave:2;
109         u8      GreenField:1;
110         u8      ShortGI20Mhz:1;
111         u8      ShortGI40Mhz:1;
112         u8      TxSTBC:1;
113         u8      RxSTBC:2;
114         u8      DelayBA:1;
115         u8      MaxAMSDUSize:1;
116         u8      DssCCk:1;
117         u8      PSMP:1;
118         u8      Rsvd1:1;
119         u8      LSigTxopProtect:1;
120
121         /* MAC HT parameters info */
122         u8      MaxRxAMPDUFactor:2;
123         u8      MPDUDensity:3;
124         u8      Rsvd2:3;
125
126         /* Supported MCS set */
127         u8      MCS[16];
128
129
130         /* Extended HT Capability Info */
131         u16     ExtHTCapInfo;
132
133         /* TXBF Capabilities */
134         u8      TxBFCap[4];
135
136         /* Antenna Selection Capabilities */
137         u8      ASCap;
138
139 } __packed HT_CAPABILITY_ELE, *PHT_CAPABILITY_ELE;
140
141 /*------------------------------------------------------------
142  * The HT Information element is present in beacons
143  * Only AP is required to include this element
144  *------------------------------------------------------------*/
145
146 typedef struct _HT_INFORMATION_ELE {
147         u8      ControlChl;
148
149         u8      ExtChlOffset:2;
150         u8      RecommemdedTxWidth:1;
151         u8      RIFS:1;
152         u8      PSMPAccessOnly:1;
153         u8      SrvIntGranularity:3;
154
155         u8      OptMode:2;
156         u8      NonGFDevPresent:1;
157         u8      Revd1:5;
158         u8      Revd2:8;
159
160         u8      Rsvd3:6;
161         u8      DualBeacon:1;
162         u8      DualCTSProtect:1;
163
164         u8      SecondaryBeacon:1;
165         u8      LSigTxopProtectFull:1;
166         u8      PcoActive:1;
167         u8      PcoPhase:1;
168         u8      Rsvd4:4;
169
170         u8      BasicMSC[16];
171 } __packed HT_INFORMATION_ELE, *PHT_INFORMATION_ELE;
172
173 /* MIMO Power Save control field.
174  * This is appear in MIMO Power Save Action Frame */
175 typedef struct _MIMOPS_CTRL {
176         u8      MimoPsEnable:1;
177         u8      MimoPsMode:1;
178         u8      Reserved:6;
179 } MIMOPS_CTRL, *PMIMOPS_CTRL;
180
181 typedef enum _HT_SPEC_VER {
182         HT_SPEC_VER_IEEE = 0,
183         HT_SPEC_VER_EWC = 1,
184 } HT_SPEC_VER, *PHT_SPEC_VER;
185
186 typedef enum _HT_AGGRE_MODE_E {
187         HT_AGG_AUTO = 0,
188         HT_AGG_FORCE_ENABLE = 1,
189         HT_AGG_FORCE_DISABLE = 2,
190 } HT_AGGRE_MODE_E, *PHT_AGGRE_MODE_E;
191
192 /*----------------------------------------------------------------------------
193  *  The Data structure is used to keep HT related variables when card is
194  *  configured as non-AP STA mode.
195  *  **Note** Current_xxx should be set to default value in HTInitializeHTInfo()
196  *----------------------------------------------------------------------------*/
197
198 typedef struct _RT_HIGH_THROUGHPUT {
199         u8                      bEnableHT;
200         u8                      bCurrentHTSupport;
201         /* Tx 40MHz channel capability */
202         u8                      bRegBW40MHz;
203         u8                      bCurBW40MHz;
204         /* Tx Short GI for 40Mhz */
205         u8                      bRegShortGI40MHz;
206         u8                      bCurShortGI40MHz;
207         /* Tx Short GI for 20MHz */
208         u8                      bRegShortGI20MHz;
209         u8                      bCurShortGI20MHz;
210         /* Tx CCK rate capability */
211         u8                      bRegSuppCCK;
212         u8                      bCurSuppCCK;
213
214         /* 802.11n spec version for "peer" */
215         HT_SPEC_VER             ePeerHTSpecVer;
216
217
218         /* HT related information for "Self" */
219         /* This is HT cap element sent to peer STA, which also indicate
220          * HT Rx capabilities. */
221         HT_CAPABILITY_ELE       SelfHTCap;
222         HT_INFORMATION_ELE      SelfHTInfo;
223
224         /* HT related information for "Peer" */
225         u8                      PeerHTCapBuf[32];
226         u8                      PeerHTInfoBuf[32];
227
228
229         /* A-MSDU related */
230         /* This indicates Tx A-MSDU capability */
231         u8                      bAMSDU_Support;
232         u16                     nAMSDU_MaxSize;
233         u8                      bCurrent_AMSDU_Support;
234         u16                     nCurrent_AMSDU_MaxSize;
235
236
237         /* A-MPDU related */
238         /* This indicate Tx A-MPDU capability */
239         u8                      bAMPDUEnable;
240         u8                      bCurrentAMPDUEnable;
241         u8                      AMPDU_Factor;
242         u8                      CurrentAMPDUFactor;
243         u8                      MPDU_Density;
244         u8                      CurrentMPDUDensity;
245
246         /* Forced A-MPDU enable */
247         HT_AGGRE_MODE_E         ForcedAMPDUMode;
248         u8                      ForcedAMPDUFactor;
249         u8                      ForcedMPDUDensity;
250
251         /* Forced A-MSDU enable */
252         HT_AGGRE_MODE_E         ForcedAMSDUMode;
253         u16                     ForcedAMSDUMaxSize;
254
255         u8                      bForcedShortGI;
256
257         u8                      CurrentOpMode;
258
259         /* MIMO PS related */
260         u8                      SelfMimoPs;
261         u8                      PeerMimoPs;
262
263         /* 40MHz Channel Offset settings. */
264         HT_EXTCHNL_OFFSET       CurSTAExtChnlOffset;
265         u8                      bCurTxBW40MHz;  /* If we use 40 MHz to Tx */
266         u8                      PeerBandwidth;
267
268         /* For Bandwidth Switching */
269         u8                      bSwBwInProgress;
270         CHNLOP                  ChnlOp; /* sw switching channel in progress. */
271         u8                      SwBwStep;
272         struct timer_list       SwBwTimer;
273
274         /* For Realtek proprietary A-MPDU factor for aggregation */
275         u8                      bRegRT2RTAggregation;
276         u8                      bCurrentRT2RTAggregation;
277         u8                      bCurrentRT2RTLongSlotTime;
278         u8                      szRT2RTAggBuffer[10];
279
280         /* Rx Reorder control */
281         u8                      bRegRxReorderEnable;
282         u8                      bCurRxReorderEnable;
283         u8                      RxReorderWinSize;
284         u8                      RxReorderPendingTime;
285         u16                     RxReorderDropCounter;
286
287 #ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
288         u8                      UsbTxAggrNum;
289 #endif
290 #ifdef USB_RX_AGGREGATION_SUPPORT
291         u8                      UsbRxFwAggrEn;
292         u8                      UsbRxFwAggrPageNum;
293         u8                      UsbRxFwAggrPacketNum;
294         u8                      UsbRxFwAggrTimeout;
295 #endif
296
297         /* Add for Broadcom(Linksys) IOT. */
298         u8                      bIsPeerBcm;
299
300         /* For IOT issue. */
301         u32                     IOTAction;
302 } RT_HIGH_THROUGHPUT, *PRT_HIGH_THROUGHPUT;
303
304
305 /*----------------------------------------------------------------------
306  * The Data structure is used to keep HT related variable for "each Sta"
307  * when card is configured as "AP mode"
308  *----------------------------------------------------------------------*/
309
310 typedef struct _RT_HTINFO_STA_ENTRY {
311         u8                      bEnableHT;
312
313         u8                      bSupportCck;
314
315         u16                     AMSDU_MaxSize;
316
317         u8                      AMPDU_Factor;
318         u8                      MPDU_Density;
319
320         u8                      HTHighestOperaRate;
321
322         u8                      bBw40MHz;
323
324         u8                      MimoPs;
325
326         u8                      McsRateSet[16];
327
328
329 } RT_HTINFO_STA_ENTRY, *PRT_HTINFO_STA_ENTRY;
330
331
332
333
334
335 /*---------------------------------------------------------------------
336  * The Data structure is used to keep HT related variable for "each AP"
337  * when card is configured as "STA mode"
338  *---------------------------------------------------------------------*/
339
340 typedef struct _BSS_HT {
341
342         u8                              bdSupportHT;
343
344         /* HT related elements */
345         u8                              bdHTCapBuf[32];
346         u16                             bdHTCapLen;
347         u8                              bdHTInfoBuf[32];
348         u16                             bdHTInfoLen;
349
350         HT_SPEC_VER                     bdHTSpecVer;
351
352         u8                              bdRT2RTAggregation;
353         u8                              bdRT2RTLongSlotTime;
354 } BSS_HT, *PBSS_HT;
355
356 typedef struct _MIMO_RSSI {
357         u32     EnableAntenna;
358         u32     AntennaA;
359         u32     AntennaB;
360         u32     AntennaC;
361         u32     AntennaD;
362         u32     Average;
363 } MIMO_RSSI, *PMIMO_RSSI;
364
365 typedef struct _MIMO_EVM {
366         u32     EVM1;
367         u32     EVM2;
368 } MIMO_EVM, *PMIMO_EVM;
369
370 typedef struct _FALSE_ALARM_STATISTICS {
371         u32     Cnt_Parity_Fail;
372         u32     Cnt_Rate_Illegal;
373         u32     Cnt_Crc8_fail;
374         u32     Cnt_all;
375 } FALSE_ALARM_STATISTICS, *PFALSE_ALARM_STATISTICS;
376
377
378
379 #endif