aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rtl8192u/r819xU_HTType.h
blob: 2cbb8e6584f893fb6ab714a8ad57dd4ef356e7cb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
#ifndef _R819XU_HTTYPE_H_
#define _R819XU_HTTYPE_H_


/*----------------------------------------------------------------------
 * The HT Capability element is present in beacons, association request,
 * reassociation request and probe response frames
 *----------------------------------------------------------------------*/

/* Operation mode value */
#define HT_OPMODE_NO_PROTECT		0
#define HT_OPMODE_OPTIONAL		1
#define HT_OPMODE_40MHZ_PROTECT		2
#define HT_OPMODE_MIXED			3

/* MIMO Power Save Settings */
#define MIMO_PS_STATIC			0
#define MIMO_PS_DYNAMIC			1
#define MIMO_PS_NOLIMIT			3


/* There should be 128 bits to cover all of the MCS rates. However, since
 * 8190 does not support too much rates, one integer is quite enough. */

#define sHTCLng				4


#define HT_SUPPORTED_MCS_1SS_BITMAP	0x000000ff
#define HT_SUPPORTED_MCS_2SS_BITMAP	0x0000ff00
#define HT_SUPPORTED_MCS_1SS_2SS_BITMAP	\
		(HT_MCS_1SS_BITMAP | HT_MCS_1SS_2SS_BITMAP)


typedef enum _HT_MCS_RATE {
	HT_MCS0   = 0x00000001,
	HT_MCS1   = 0x00000002,
	HT_MCS2   = 0x00000004,
	HT_MCS3   = 0x00000008,
	HT_MCS4   = 0x00000010,
	HT_MCS5   = 0x00000020,
	HT_MCS6   = 0x00000040,
	HT_MCS7   = 0x00000080,
	HT_MCS8   = 0x00000100,
	HT_MCS9   = 0x00000200,
	HT_MCS10  = 0x00000400,
	HT_MCS11  = 0x00000800,
	HT_MCS12  = 0x00001000,
	HT_MCS13  = 0x00002000,
	HT_MCS14  = 0x00004000,
	HT_MCS15  = 0x00008000,
	/* Do not define MCS32 here although 8190 support MCS32 */
} HT_MCS_RATE, *PHT_MCS_RATE;

/* Represent Channel Width in HT Capabilities */
typedef enum _HT_CHANNEL_WIDTH {
	HT_CHANNEL_WIDTH_20    = 0,
	HT_CHANNEL_WIDTH_20_40 = 1,
} HT_CHANNEL_WIDTH, *PHT_CHANNEL_WIDTH;

/* Represent Extension Channel Offset in HT Capabilities
 * This is available only in 40Mhz mode. */
typedef enum _HT_EXTCHNL_OFFSET {
	HT_EXTCHNL_OFFSET_NO_EXT = 0,
	HT_EXTCHNL_OFFSET_UPPER  = 1,
	HT_EXTCHNL_OFFSET_NO_DEF = 2,
	HT_EXTCHNL_OFFSET_LOWER  = 3,
} HT_EXTCHNL_OFFSET, *PHT_EXTCHNL_OFFSET;

typedef enum _CHNLOP {
	CHNLOP_NONE   = 0,	/* No Action now */
	CHNLOP_SCAN   = 1,	/* Scan in progress */
	CHNLOP_SWBW   = 2,	/* Bandwidth switching in progress */
	CHNLOP_SWCHNL = 3,	/* Software Channel switching in progress */
} CHNLOP, *PCHNLOP;

/* Determine if the Channel Operation is in progress */
#define CHHLOP_IN_PROGRESS(_pHTInfo)	\
		(((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? TRUE : FALSE)


typedef enum _HT_ACTION {
	ACT_RECOMMAND_WIDTH		= 0,
	ACT_MIMO_PWR_SAVE		= 1,
	ACT_PSMP			= 2,
	ACT_SET_PCO_PHASE		= 3,
	ACT_MIMO_CHL_MEASURE		= 4,
	ACT_RECIPROCITY_CORRECT		= 5,
	ACT_MIMO_CSI_MATRICS		= 6,
	ACT_MIMO_NOCOMPR_STEER		= 7,
	ACT_MIMO_COMPR_STEER		= 8,
	ACT_ANTENNA_SELECT		= 9,
} HT_ACTION, *PHT_ACTION;


/* Define sub-carrier mode for 40MHZ. */
typedef enum _HT_Bandwidth_40MHZ_Sub_Carrier {
	SC_MODE_DUPLICATE = 0,
	SC_MODE_LOWER     = 1,
	SC_MODE_UPPER     = 2,
	SC_MODE_FULL40MHZ = 3,
} HT_BW40_SC_E;

typedef	struct _HT_CAPABILITY_ELE {

	/* HT capability info */
	u8	AdvCoding:1;
	u8	ChlWidth:1;
	u8	MimoPwrSave:2;
	u8	GreenField:1;
	u8	ShortGI20Mhz:1;
	u8	ShortGI40Mhz:1;
	u8	TxSTBC:1;
	u8	RxSTBC:2;
	u8	DelayBA:1;
	u8	MaxAMSDUSize:1;
	u8	DssCCk:1;
	u8	PSMP:1;
	u8	Rsvd1:1;
	u8	LSigTxopProtect:1;

	/* MAC HT parameters info */
	u8	MaxRxAMPDUFactor:2;
	u8	MPDUDensity:3;
	u8	Rsvd2:3;

	/* Supported MCS set */
	u8	MCS[16];


	/* Extended HT Capability Info */
	u16	ExtHTCapInfo;

	/* TXBF Capabilities */
	u8	TxBFCap[4];

	/* Antenna Selection Capabilities */
	u8	ASCap;

} __packed HT_CAPABILITY_ELE, *PHT_CAPABILITY_ELE;

/*------------------------------------------------------------
 * The HT Information element is present in beacons
 * Only AP is required to include this element
 *------------------------------------------------------------*/

typedef struct _HT_INFORMATION_ELE {
	u8	ControlChl;

	u8	ExtChlOffset:2;
	u8	RecommemdedTxWidth:1;
	u8	RIFS:1;
	u8	PSMPAccessOnly:1;
	u8	SrvIntGranularity:3;

	u8	OptMode:2;
	u8	NonGFDevPresent:1;
	u8	Revd1:5;
	u8	Revd2:8;

	u8	Rsvd3:6;
	u8	DualBeacon:1;
	u8	DualCTSProtect:1;

	u8	SecondaryBeacon:1;
	u8	LSigTxopProtectFull:1;
	u8	PcoActive:1;
	u8	PcoPhase:1;
	u8	Rsvd4:4;

	u8	BasicMSC[16];
} __packed HT_INFORMATION_ELE, *PHT_INFORMATION_ELE;

/* MIMO Power Save control field.
 * This is appear in MIMO Power Save Action Frame */
typedef struct _MIMOPS_CTRL {
	u8	MimoPsEnable:1;
	u8	MimoPsMode:1;
	u8	Reserved:6;
} MIMOPS_CTRL, *PMIMOPS_CTRL;

typedef enum _HT_SPEC_VER {
	HT_SPEC_VER_IEEE = 0,
	HT_SPEC_VER_EWC = 1,
} HT_SPEC_VER, *PHT_SPEC_VER;

typedef enum _HT_AGGRE_MODE_E {
	HT_AGG_AUTO = 0,
	HT_AGG_FORCE_ENABLE = 1,
	HT_AGG_FORCE_DISABLE = 2,
} HT_AGGRE_MODE_E, *PHT_AGGRE_MODE_E;

/*----------------------------------------------------------------------------
 *  The Data structure is used to keep HT related variables when card is
 *  configured as non-AP STA mode.
 *  **Note** Current_xxx should be set to default value in HTInitializeHTInfo()
 *----------------------------------------------------------------------------*/

typedef struct _RT_HIGH_THROUGHPUT {
	u8			bEnableHT;
	u8			bCurrentHTSupport;
	/* Tx 40MHz channel capability */
	u8			bRegBW40MHz;
	u8			bCurBW40MHz;
	/* Tx Short GI for 40Mhz */
	u8			bRegShortGI40MHz;
	u8			bCurShortGI40MHz;
	/* Tx Short GI for 20MHz */
	u8			bRegShortGI20MHz;
	u8			bCurShortGI20MHz;
	/* Tx CCK rate capability */
	u8			bRegSuppCCK;
	u8			bCurSuppCCK;

	/* 802.11n spec version for "peer" */
	HT_SPEC_VER		ePeerHTSpecVer;


	/* HT related information for "Self" */
	/* This is HT cap element sent to peer STA, which also indicate
	 * HT Rx capabilities. */
	HT_CAPABILITY_ELE	SelfHTCap;
	HT_INFORMATION_ELE	SelfHTInfo;

	/* HT related information for "Peer" */
	u8			PeerHTCapBuf[32];
	u8			PeerHTInfoBuf[32];


	/* A-MSDU related */
	/* This indicates Tx A-MSDU capability */
	u8			bAMSDU_Support;
	u16			nAMSDU_MaxSize;
	u8			bCurrent_AMSDU_Support;
	u16			nCurrent_AMSDU_MaxSize;


	/* A-MPDU related */
	/* This indicate Tx A-MPDU capability */
	u8			bAMPDUEnable;
	u8			bCurrentAMPDUEnable;
	u8			AMPDU_Factor;
	u8			CurrentAMPDUFactor;
	u8			MPDU_Density;
	u8			CurrentMPDUDensity;

	/* Forced A-MPDU enable */
	HT_AGGRE_MODE_E		ForcedAMPDUMode;
	u8			ForcedAMPDUFactor;
	u8			ForcedMPDUDensity;

	/* Forced A-MSDU enable */
	HT_AGGRE_MODE_E		ForcedAMSDUMode;
	u16			ForcedAMSDUMaxSize;

	u8			bForcedShortGI;

	u8			CurrentOpMode;

	/* MIMO PS related */
	u8			SelfMimoPs;
	u8			PeerMimoPs;

	/* 40MHz Channel Offset settings. */
	HT_EXTCHNL_OFFSET	CurSTAExtChnlOffset;
	u8			bCurTxBW40MHz;	/* If we use 40 MHz to Tx */
	u8			PeerBandwidth;

	/* For Bandwidth Switching */
	u8			bSwBwInProgress;
	CHNLOP			ChnlOp; /* sw switching channel in progress. */
	u8			SwBwStep;
	struct timer_list	SwBwTimer;

	/* For Realtek proprietary A-MPDU factor for aggregation */
	u8			bRegRT2RTAggregation;
	u8			bCurrentRT2RTAggregation;
	u8			bCurrentRT2RTLongSlotTime;
	u8			szRT2RTAggBuffer[10];

	/* Rx Reorder control */
	u8			bRegRxReorderEnable;
	u8			bCurRxReorderEnable;
	u8			RxReorderWinSize;
	u8			RxReorderPendingTime;
	u16			RxReorderDropCounter;

#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
	u8			UsbTxAggrNum;
#endif
#ifdef USB_RX_AGGREGATION_SUPPORT
	u8			UsbRxFwAggrEn;
	u8			UsbRxFwAggrPageNum;
	u8			UsbRxFwAggrPacketNum;
	u8			UsbRxFwAggrTimeout;
#endif

	/* Add for Broadcom(Linksys) IOT. */
	u8			bIsPeerBcm;

	/* For IOT issue. */
	u32			IOTAction;
} RT_HIGH_THROUGHPUT, *PRT_HIGH_THROUGHPUT;


/*----------------------------------------------------------------------
 * The Data structure is used to keep HT related variable for "each Sta"
 * when card is configured as "AP mode"
 *----------------------------------------------------------------------*/

typedef struct _RT_HTINFO_STA_ENTRY {
	u8			bEnableHT;

	u8			bSupportCck;

	u16			AMSDU_MaxSize;

	u8			AMPDU_Factor;
	u8			MPDU_Density;

	u8			HTHighestOperaRate;

	u8			bBw40MHz;

	u8			MimoPs;

	u8			McsRateSet[16];


} RT_HTINFO_STA_ENTRY, *PRT_HTINFO_STA_ENTRY;





/*---------------------------------------------------------------------
 * The Data structure is used to keep HT related variable for "each AP"
 * when card is configured as "STA mode"
 *---------------------------------------------------------------------*/

typedef struct _BSS_HT {

	u8				bdSupportHT;

	/* HT related elements */
	u8				bdHTCapBuf[32];
	u16				bdHTCapLen;
	u8				bdHTInfoBuf[32];
	u16				bdHTInfoLen;

	HT_SPEC_VER			bdHTSpecVer;

	u8				bdRT2RTAggregation;
	u8				bdRT2RTLongSlotTime;
} BSS_HT, *PBSS_HT;

typedef struct _MIMO_RSSI {
	u32	EnableAntenna;
	u32	AntennaA;
	u32	AntennaB;
	u32	AntennaC;
	u32	AntennaD;
	u32	Average;
} MIMO_RSSI, *PMIMO_RSSI;

typedef struct _MIMO_EVM {
	u32	EVM1;
	u32	EVM2;
} MIMO_EVM, *PMIMO_EVM;

typedef struct _FALSE_ALARM_STATISTICS {
	u32	Cnt_Parity_Fail;
	u32	Cnt_Rate_Illegal;
	u32	Cnt_Crc8_fail;
	u32	Cnt_all;
} FALSE_ALARM_STATISTICS, *PFALSE_ALARM_STATISTICS;



#endif