Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / rt2860 / mlme.h
CommitLineData
91980990
GKH
1/*
2 *************************************************************************
3 * Ralink Tech Inc.
4 * 5F., No.36, Taiyuan St., Jhubei City,
5 * Hsinchu County 302,
6 * Taiwan, R.O.C.
7 *
8 * (c) Copyright 2002-2007, Ralink Technology, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
19 * *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the *
22 * Free Software Foundation, Inc., *
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
24 * *
25 *************************************************************************
26
27 Module Name:
28 mlme.h
29
30 Abstract:
31
32 Revision History:
33 Who When What
34 -------- ---------- ----------------------------------------------
35 John Chang 2003-08-28 Created
36 John Chang 2004-09-06 modified for RT2600
37
38*/
39#ifndef __MLME_H__
40#define __MLME_H__
41
42// maximum supported capability information -
43// ESS, IBSS, Privacy, Short Preamble, Spectrum mgmt, Short Slot
44#define SUPPORTED_CAPABILITY_INFO 0x0533
45
46#define END_OF_ARGS -1
47#define LFSR_MASK 0x80000057
48#define MLME_TASK_EXEC_INTV 100/*200*/ //
49#define LEAD_TIME 5
50#define MLME_TASK_EXEC_MULTIPLE 10 /*5*/ // MLME_TASK_EXEC_MULTIPLE * MLME_TASK_EXEC_INTV = 1 sec
51#define REORDER_EXEC_INTV 100 // 0.1 sec
52
53// The definition of Radar detection duration region
54#define CE 0
55#define FCC 1
56#define JAP 2
57#define JAP_W53 3
58#define JAP_W56 4
59#define MAX_RD_REGION 5
60
61#ifdef NDIS51_MINIPORT
62#define BEACON_LOST_TIME 4000 // 2048 msec = 2 sec
63#else
64#define BEACON_LOST_TIME 4 * OS_HZ // 2048 msec = 2 sec
65#endif
66
67#define DLS_TIMEOUT 1200 // unit: msec
68#define AUTH_TIMEOUT 300 // unit: msec
69#define ASSOC_TIMEOUT 300 // unit: msec
70#define JOIN_TIMEOUT 2 * OS_HZ // unit: msec
71#define SHORT_CHANNEL_TIME 90 // unit: msec
72#define MIN_CHANNEL_TIME 110 // unit: msec, for dual band scan
73#define MAX_CHANNEL_TIME 140 // unit: msec, for single band scan
74#define FAST_ACTIVE_SCAN_TIME 30 // Active scan waiting for probe response time
75#define CW_MIN_IN_BITS 4 // actual CwMin = 2^CW_MIN_IN_BITS - 1
91980990 76#define CW_MAX_IN_BITS 10 // actual CwMax = 2^CW_MAX_IN_BITS - 1
91980990 77
91980990
GKH
78// Note: RSSI_TO_DBM_OFFSET has been changed to variable for new RF (2004-0720).
79// SHould not refer to this constant anymore
80//#define RSSI_TO_DBM_OFFSET 120 // for RT2530 RSSI-115 = dBm
81#define RSSI_FOR_MID_TX_POWER -55 // -55 db is considered mid-distance
82#define RSSI_FOR_LOW_TX_POWER -45 // -45 db is considered very short distance and
83 // eligible to use a lower TX power
84#define RSSI_FOR_LOWEST_TX_POWER -30
85//#define MID_TX_POWER_DELTA 0 // 0 db from full TX power upon mid-distance to AP
86#define LOW_TX_POWER_DELTA 6 // -3 db from full TX power upon very short distance. 1 grade is 0.5 db
87#define LOWEST_TX_POWER_DELTA 16 // -8 db from full TX power upon shortest distance. 1 grade is 0.5 db
88
89#define RSSI_TRIGGERED_UPON_BELOW_THRESHOLD 0
90#define RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD 1
91#define RSSI_THRESHOLD_FOR_ROAMING 25
92#define RSSI_DELTA 5
93
94// Channel Quality Indication
95#define CQI_IS_GOOD(cqi) ((cqi) >= 50)
96//#define CQI_IS_FAIR(cqi) (((cqi) >= 20) && ((cqi) < 50))
97#define CQI_IS_POOR(cqi) (cqi < 50) //(((cqi) >= 5) && ((cqi) < 20))
98#define CQI_IS_BAD(cqi) (cqi < 5)
99#define CQI_IS_DEAD(cqi) (cqi == 0)
100
101// weighting factor to calculate Channel quality, total should be 100%
102#define RSSI_WEIGHTING 50
103#define TX_WEIGHTING 30
104#define RX_WEIGHTING 20
105
106#define BSS_NOT_FOUND 0xFFFFFFFF
107
91980990 108#define MAX_LEN_OF_MLME_QUEUE 40 //10
91980990
GKH
109
110#define SCAN_PASSIVE 18 // scan with no probe request, only wait beacon and probe response
111#define SCAN_ACTIVE 19 // scan with probe request, and wait beacon and probe response
112#define SCAN_CISCO_PASSIVE 20 // Single channel passive scan
113#define SCAN_CISCO_ACTIVE 21 // Single channel active scan
114#define SCAN_CISCO_NOISE 22 // Single channel passive scan for noise histogram collection
115#define SCAN_CISCO_CHANNEL_LOAD 23 // Single channel passive scan for channel load collection
116#define FAST_SCAN_ACTIVE 24 // scan with probe request, and wait beacon and probe response
117
91980990
GKH
118#define MAC_ADDR_IS_GROUP(Addr) (((Addr[0]) & 0x01))
119#define MAC_ADDR_HASH(Addr) (Addr[0] ^ Addr[1] ^ Addr[2] ^ Addr[3] ^ Addr[4] ^ Addr[5])
120#define MAC_ADDR_HASH_INDEX(Addr) (MAC_ADDR_HASH(Addr) % HASH_TABLE_SIZE)
121#define TID_MAC_HASH(Addr,TID) (TID^Addr[0] ^ Addr[1] ^ Addr[2] ^ Addr[3] ^ Addr[4] ^ Addr[5])
122#define TID_MAC_HASH_INDEX(Addr,TID) (TID_MAC_HASH(Addr,TID) % HASH_TABLE_SIZE)
123
124// LED Control
125// assoiation ON. one LED ON. another blinking when TX, OFF when idle
126// no association, both LED off
127#define ASIC_LED_ACT_ON(pAd) RTMP_IO_WRITE32(pAd, MAC_CSR14, 0x00031e46)
128#define ASIC_LED_ACT_OFF(pAd) RTMP_IO_WRITE32(pAd, MAC_CSR14, 0x00001e46)
129
130// bit definition of the 2-byte pBEACON->Capability field
131#define CAP_IS_ESS_ON(x) (((x) & 0x0001) != 0)
132#define CAP_IS_IBSS_ON(x) (((x) & 0x0002) != 0)
133#define CAP_IS_CF_POLLABLE_ON(x) (((x) & 0x0004) != 0)
134#define CAP_IS_CF_POLL_REQ_ON(x) (((x) & 0x0008) != 0)
135#define CAP_IS_PRIVACY_ON(x) (((x) & 0x0010) != 0)
136#define CAP_IS_SHORT_PREAMBLE_ON(x) (((x) & 0x0020) != 0)
137#define CAP_IS_PBCC_ON(x) (((x) & 0x0040) != 0)
138#define CAP_IS_AGILITY_ON(x) (((x) & 0x0080) != 0)
139#define CAP_IS_SPECTRUM_MGMT(x) (((x) & 0x0100) != 0) // 802.11e d9
140#define CAP_IS_QOS(x) (((x) & 0x0200) != 0) // 802.11e d9
141#define CAP_IS_SHORT_SLOT(x) (((x) & 0x0400) != 0)
142#define CAP_IS_APSD(x) (((x) & 0x0800) != 0) // 802.11e d9
143#define CAP_IS_IMMED_BA(x) (((x) & 0x1000) != 0) // 802.11e d9
144#define CAP_IS_DSSS_OFDM(x) (((x) & 0x2000) != 0)
145#define CAP_IS_DELAY_BA(x) (((x) & 0x4000) != 0) // 802.11e d9
146
147#define CAP_GENERATE(ess,ibss,priv,s_pre,s_slot,spectrum) (((ess) ? 0x0001 : 0x0000) | ((ibss) ? 0x0002 : 0x0000) | ((priv) ? 0x0010 : 0x0000) | ((s_pre) ? 0x0020 : 0x0000) | ((s_slot) ? 0x0400 : 0x0000) | ((spectrum) ? 0x0100 : 0x0000))
148
149#define ERP_IS_NON_ERP_PRESENT(x) (((x) & 0x01) != 0) // 802.11g
150#define ERP_IS_USE_PROTECTION(x) (((x) & 0x02) != 0) // 802.11g
151#define ERP_IS_USE_BARKER_PREAMBLE(x) (((x) & 0x04) != 0) // 802.11g
152
153#define DRS_TX_QUALITY_WORST_BOUND 8// 3 // just test by gary
154#define DRS_PENALTY 8
155
156#define BA_NOTUSE 2
157//BA Policy subfiled value in ADDBA frame
158#define IMMED_BA 1
159#define DELAY_BA 0
160
161// BA Initiator subfield in DELBA frame
162#define ORIGINATOR 1
163#define RECIPIENT 0
164
165// ADDBA Status Code
166#define ADDBA_RESULTCODE_SUCCESS 0
167#define ADDBA_RESULTCODE_REFUSED 37
168#define ADDBA_RESULTCODE_INVALID_PARAMETERS 38
169
170// DELBA Reason Code
171#define DELBA_REASONCODE_QSTA_LEAVING 36
172#define DELBA_REASONCODE_END_BA 37
173#define DELBA_REASONCODE_UNKNOWN_BA 38
174#define DELBA_REASONCODE_TIMEOUT 39
175
176// reset all OneSecTx counters
177#define RESET_ONE_SEC_TX_CNT(__pEntry) \
178if (((__pEntry)) != NULL) \
179{ \
180 (__pEntry)->OneSecTxRetryOkCount = 0; \
181 (__pEntry)->OneSecTxFailCount = 0; \
182 (__pEntry)->OneSecTxNoRetryOkCount = 0; \
183}
184
185//
186// 802.11 frame formats
187//
188// HT Capability INFO field in HT Cap IE .
189typedef struct PACKED {
91980990
GKH
190 USHORT AdvCoding:1;
191 USHORT ChannelWidth:1;
192 USHORT MimoPs:2;//momi power safe
193 USHORT GF:1; //green field
194 USHORT ShortGIfor20:1;
195 USHORT ShortGIfor40:1; //for40MHz
196 USHORT TxSTBC:1;
197 USHORT RxSTBC:2;
198 USHORT DelayedBA:1; //rt2860c not support
199 USHORT AMsduSize:1; // only support as zero
200 USHORT CCKmodein40:1;
201 USHORT PSMP:1;
202 USHORT Forty_Mhz_Intolerant:1;
203 USHORT LSIGTxopProSup:1;
91980990
GKH
204} HT_CAP_INFO, *PHT_CAP_INFO;
205
206// HT Capability INFO field in HT Cap IE .
207typedef struct PACKED {
91980990
GKH
208 UCHAR MaxRAmpduFactor:2;
209 UCHAR MpduDensity:3;
210 UCHAR rsv:3;//momi power safe
91980990
GKH
211} HT_CAP_PARM, *PHT_CAP_PARM;
212
213// HT Capability INFO field in HT Cap IE .
214typedef struct PACKED {
215 UCHAR MCSSet[10];
216 UCHAR SupRate[2]; // unit : 1Mbps
91980990
GKH
217 UCHAR TxMCSSetDefined:1;
218 UCHAR TxRxNotEqual:1;
219 UCHAR TxStream:2;
220 UCHAR MpduDensity:1;
221 UCHAR rsv:3;
91980990
GKH
222 UCHAR rsv3[3];
223} HT_MCS_SET, *PHT_MCS_SET;
224
225// HT Capability INFO field in HT Cap IE .
226typedef struct PACKED {
91980990
GKH
227 USHORT Pco:1;
228 USHORT TranTime:2;
229 USHORT rsv:5;//momi power safe
230 USHORT MCSFeedback:2; //0:no MCS feedback, 2:unsolicited MCS feedback, 3:Full MCS feedback, 1:rsv.
231 USHORT PlusHTC:1; //+HTC control field support
232 USHORT RDGSupport:1; //reverse Direction Grant support
233 USHORT rsv2:4;
91980990
GKH
234} EXT_HT_CAP_INFO, *PEXT_HT_CAP_INFO;
235
236// HT Beamforming field in HT Cap IE .
237typedef struct PACKED _HT_BF_CAP{
91980990
GKH
238 ULONG TxBFRecCapable:1;
239 ULONG RxSoundCapable:1;
240 ULONG TxSoundCapable:1;
241 ULONG RxNDPCapable:1;
242 ULONG TxNDPCapable:1;
243 ULONG ImpTxBFCapable:1;
244 ULONG Calibration:2;
245 ULONG ExpCSICapable:1;
246 ULONG ExpNoComSteerCapable:1;
247 ULONG ExpComSteerCapable:1;
248 ULONG ExpCSIFbk:2;
249 ULONG ExpNoComBF:2;
250 ULONG ExpComBF:2;
251 ULONG MinGrouping:2;
252 ULONG CSIBFAntSup:2;
253 ULONG NoComSteerBFAntSup:2;
254 ULONG ComSteerBFAntSup:2;
255 ULONG CSIRowBFSup:2;
256 ULONG ChanEstimation:2;
257 ULONG rsv:3;
91980990
GKH
258} HT_BF_CAP, *PHT_BF_CAP;
259
260// HT antenna selection field in HT Cap IE .
261typedef struct PACKED _HT_AS_CAP{
91980990
GKH
262 UCHAR AntSelect:1;
263 UCHAR ExpCSIFbkTxASEL:1;
264 UCHAR AntIndFbkTxASEL:1;
265 UCHAR ExpCSIFbk:1;
266 UCHAR AntIndFbk:1;
267 UCHAR RxASel:1;
268 UCHAR TxSoundPPDU:1;
269 UCHAR rsv:1;
91980990
GKH
270} HT_AS_CAP, *PHT_AS_CAP;
271
272// Draft 1.0 set IE length 26, but is extensible..
273#define SIZE_HT_CAP_IE 26
274// The structure for HT Capability IE.
275typedef struct PACKED _HT_CAPABILITY_IE{
276 HT_CAP_INFO HtCapInfo;
277 HT_CAP_PARM HtCapParm;
278// HT_MCS_SET HtMCSSet;
279 UCHAR MCSSet[16];
280 EXT_HT_CAP_INFO ExtHtCapInfo;
281 HT_BF_CAP TxBFCap; // beamforming cap. rt2860c not support beamforming.
282 HT_AS_CAP ASCap; //antenna selection.
283} HT_CAPABILITY_IE, *PHT_CAPABILITY_IE;
284
285
286// 802.11n draft3 related structure definitions.
287// 7.3.2.60
288#define dot11OBSSScanPassiveDwell 20 // in TU. min amount of time that the STA continously scans each channel when performing an active OBSS scan.
289#define dot11OBSSScanActiveDwell 10 // in TU.min amount of time that the STA continously scans each channel when performing an passive OBSS scan.
290#define dot11BSSWidthTriggerScanInterval 300 // in sec. max interval between scan operations to be performed to detect BSS channel width trigger events.
291#define dot11OBSSScanPassiveTotalPerChannel 200 // in TU. min total amount of time that the STA scans each channel when performing a passive OBSS scan.
292#define dot11OBSSScanActiveTotalPerChannel 20 //in TU. min total amount of time that the STA scans each channel when performing a active OBSS scan
293#define dot11BSSWidthChannelTransactionDelayFactor 5 // min ratio between the delay time in performing a switch from 20MHz BSS to 20/40 BSS operation and the maxima
294 // interval between overlapping BSS scan operations.
295#define dot11BSSScanActivityThreshold 25 // in %%, max total time that a STA may be active on the medium during a period of
296 // (dot11BSSWidthChannelTransactionDelayFactor * dot11BSSWidthTriggerScanInterval) seconds without
297 // being obligated to perform OBSS Scan operations. default is 25(== 0.25%)
298
299typedef struct PACKED _OVERLAP_BSS_SCAN_IE{
300 USHORT ScanPassiveDwell;
301 USHORT ScanActiveDwell;
302 USHORT TriggerScanInt; // Trigger scan interval
303 USHORT PassiveTalPerChannel; // passive total per channel
304 USHORT ActiveTalPerChannel; // active total per channel
305 USHORT DelayFactor; // BSS width channel transition delay factor
306 USHORT ScanActThre; // Scan Activity threshold
307}OVERLAP_BSS_SCAN_IE, *POVERLAP_BSS_SCAN_IE;
308
309
310// 7.3.2.56. 20/40 Coexistence element used in Element ID = 72 = IE_2040_BSS_COEXIST
311typedef union PACKED _BSS_2040_COEXIST_IE{
312 struct PACKED {
91980990
GKH
313 UCHAR InfoReq:1;
314 UCHAR Intolerant40:1; // Inter-BSS. set 1 when prohibits a receiving BSS from operating as a 20/40 Mhz BSS.
315 UCHAR BSS20WidthReq:1; // Intra-BSS set 1 when prohibits a receiving AP from operating its BSS as a 20/40MHz BSS.
316 UCHAR rsv:5;
91980990
GKH
317 } field;
318 UCHAR word;
319} BSS_2040_COEXIST_IE, *PBSS_2040_COEXIST_IE;
320
321
322typedef struct _TRIGGER_EVENTA{
323 BOOLEAN bValid;
324 UCHAR BSSID[6];
325 UCHAR RegClass; // Regulatory Class
326 USHORT Channel;
327 ULONG CDCounter; // Maintain a seperate count down counter for each Event A.
328} TRIGGER_EVENTA, *PTRIGGER_EVENTA;
329
330// 20/40 trigger event table
331// If one Event A delete or created, or if Event B is detected or not detected, STA should send 2040BSSCoexistence to AP.
332#define MAX_TRIGGER_EVENT 64
333typedef struct _TRIGGER_EVENT_TAB{
334 UCHAR EventANo;
335 TRIGGER_EVENTA EventA[MAX_TRIGGER_EVENT];
336 ULONG EventBCountDown; // Count down counter for Event B.
337} TRIGGER_EVENT_TAB, *PTRIGGER_EVENT_TAB;
338
339// 7.3.27 20/40 Bss Coexistence Mgmt capability used in extended capabilities information IE( ID = 127 = IE_EXT_CAPABILITY).
340// This is the first octet and was defined in 802.11n D3.03 and 802.11yD9.0
341typedef struct PACKED _EXT_CAP_INFO_ELEMENT{
91980990
GKH
342 UCHAR BssCoexistMgmtSupport:1;
343 UCHAR rsv:1;
344 UCHAR ExtendChannelSwitch:1;
345 UCHAR rsv2:5;
91980990
GKH
346}EXT_CAP_INFO_ELEMENT, *PEXT_CAP_INFO_ELEMENT;
347
348
349// 802.11n 7.3.2.61
350typedef struct PACKED _BSS_2040_COEXIST_ELEMENT{
351 UCHAR ElementID; // ID = IE_2040_BSS_COEXIST = 72
352 UCHAR Len;
353 BSS_2040_COEXIST_IE BssCoexistIe;
354}BSS_2040_COEXIST_ELEMENT, *PBSS_2040_COEXIST_ELEMENT;
355
356
357//802.11n 7.3.2.59
358typedef struct PACKED _BSS_2040_INTOLERANT_CH_REPORT{
359 UCHAR ElementID; // ID = IE_2040_BSS_INTOLERANT_REPORT = 73
360 UCHAR Len;
361 UCHAR RegulatoryClass;
362 UCHAR ChList[0];
363}BSS_2040_INTOLERANT_CH_REPORT, *PBSS_2040_INTOLERANT_CH_REPORT;
364
365
366// The structure for channel switch annoucement IE. This is in 802.11n D3.03
367typedef struct PACKED _CHA_SWITCH_ANNOUNCE_IE{
368 UCHAR SwitchMode; //channel switch mode
369 UCHAR NewChannel; //
370 UCHAR SwitchCount; //
371} CHA_SWITCH_ANNOUNCE_IE, *PCHA_SWITCH_ANNOUNCE_IE;
372
373
374// The structure for channel switch annoucement IE. This is in 802.11n D3.03
375typedef struct PACKED _SEC_CHA_OFFSET_IE{
376 UCHAR SecondaryChannelOffset; // 1: Secondary above, 3: Secondary below, 0: no Secondary
377} SEC_CHA_OFFSET_IE, *PSEC_CHA_OFFSET_IE;
378
379
380// This structure is extracted from struct RT_HT_CAPABILITY
381typedef struct {
382 BOOLEAN bHtEnable; // If we should use ht rate.
383 BOOLEAN bPreNHt; // If we should use ht rate.
384 //Substract from HT Capability IE
385 UCHAR MCSSet[16]; //only supoort MCS=0-15,32 ,
386} RT_HT_PHY_INFO, *PRT_HT_PHY_INFO;
387
388//This structure substracts ralink supports from all 802.11n-related features.
389//Features not listed here but contained in 802.11n spec are not supported in rt2860.
390typedef struct {
91980990
GKH
391 USHORT ChannelWidth:1;
392 USHORT MimoPs:2;//mimo power safe MMPS_
393 USHORT GF:1; //green field
394 USHORT ShortGIfor20:1;
395 USHORT ShortGIfor40:1; //for40MHz
396 USHORT TxSTBC:1;
397 USHORT RxSTBC:2; // 2 bits
398 USHORT AmsduEnable:1; // Enable to transmit A-MSDU. Suggest disable. We should use A-MPDU to gain best benifit of 802.11n
399 USHORT AmsduSize:1; // Max receiving A-MSDU size
400 USHORT rsv:5;
91980990
GKH
401
402 //Substract from Addiont HT INFO IE
91980990
GKH
403 UCHAR MaxRAmpduFactor:2;
404 UCHAR MpduDensity:3;
405 UCHAR ExtChanOffset:2; // Please not the difference with following UCHAR NewExtChannelOffset; from 802.11n
406 UCHAR RecomWidth:1;
91980990 407
91980990
GKH
408 USHORT OperaionMode:2;
409 USHORT NonGfPresent:1;
410 USHORT rsv3:1;
411 USHORT OBSS_NonHTExist:1;
412 USHORT rsv2:11;
91980990
GKH
413
414 // New Extension Channel Offset IE
415 UCHAR NewExtChannelOffset;
416 // Extension Capability IE = 127
417 UCHAR BSSCoexist2040;
418} RT_HT_CAPABILITY, *PRT_HT_CAPABILITY;
419
420// field in Addtional HT Information IE .
421typedef struct PACKED {
91980990
GKH
422 UCHAR ExtChanOffset:2;
423 UCHAR RecomWidth:1;
424 UCHAR RifsMode:1;
425 UCHAR S_PSMPSup:1; //Indicate support for scheduled PSMP
426 UCHAR SerInterGranu:3; //service interval granularity
91980990
GKH
427} ADD_HTINFO, *PADD_HTINFO;
428
429typedef struct PACKED{
91980990
GKH
430 USHORT OperaionMode:2;
431 USHORT NonGfPresent:1;
432 USHORT rsv:1;
433 USHORT OBSS_NonHTExist:1;
434 USHORT rsv2:11;
91980990
GKH
435} ADD_HTINFO2, *PADD_HTINFO2;
436
437
438// TODO: Need sync with spec about the definition of StbcMcs. In Draft 3.03, it's reserved.
439typedef struct PACKED{
91980990
GKH
440 USHORT StbcMcs:6;
441 USHORT DualBeacon:1;
442 USHORT DualCTSProtect:1;
443 USHORT STBCBeacon:1;
444 USHORT LsigTxopProt:1; // L-SIG TXOP protection full support
445 USHORT PcoActive:1;
446 USHORT PcoPhase:1;
447 USHORT rsv:4;
91980990
GKH
448} ADD_HTINFO3, *PADD_HTINFO3;
449
450#define SIZE_ADD_HT_INFO_IE 22
451typedef struct PACKED{
452 UCHAR ControlChan;
453 ADD_HTINFO AddHtInfo;
454 ADD_HTINFO2 AddHtInfo2;
455 ADD_HTINFO3 AddHtInfo3;
456 UCHAR MCSSet[16]; // Basic MCS set
457} ADD_HT_INFO_IE, *PADD_HT_INFO_IE;
458
459typedef struct PACKED{
460 UCHAR NewExtChanOffset;
461} NEW_EXT_CHAN_IE, *PNEW_EXT_CHAN_IE;
462
463
464// 4-byte HTC field. maybe included in any frame except non-QOS data frame. The Order bit must set 1.
465typedef struct PACKED {
91980990
GKH
466 UINT32 MA:1; //management action payload exist in (QoS Null+HTC)
467 UINT32 TRQ:1; //sounding request
468 UINT32 MRQ:1; //MCS feedback. Request for a MCS feedback
469 UINT32 MRSorASI:3; // MRQ Sequence identifier. unchanged during entire procedure. 0x000-0x110.
470 UINT32 MFS:3; //SET to the received value of MRS. 0x111 for unsolicited MFB.
471 UINT32 MFBorASC:7; //Link adaptation feedback containing recommended MCS. 0x7f for no feedback or not available
472 UINT32 CalPos:2; // calibration position
473 UINT32 CalSeq:2; //calibration sequence
474 UINT32 FBKReq:2; //feedback request
475 UINT32 CSISTEERING:2; //CSI/ STEERING
476 UINT32 ZLFAnnouce:1; // ZLF announcement
477 UINT32 rsv:5; //calibration sequence
478 UINT32 ACConstraint:1; //feedback request
479 UINT32 RDG:1; //RDG / More PPDU
91980990
GKH
480} HT_CONTROL, *PHT_CONTROL;
481
482// 2-byte QOS CONTROL field
483typedef struct PACKED {
91980990
GKH
484 USHORT TID:4;
485 USHORT EOSP:1;
486 USHORT AckPolicy:2; //0: normal ACK 1:No ACK 2:scheduled under MTBA/PSMP 3: BA
487 USHORT AMsduPresent:1;
488 USHORT Txop_QueueSize:8;
91980990
GKH
489} QOS_CONTROL, *PQOS_CONTROL;
490
491// 2-byte Frame control field
492typedef struct PACKED {
91980990
GKH
493 USHORT Ver:2; // Protocol version
494 USHORT Type:2; // MSDU type
495 USHORT SubType:4; // MSDU subtype
496 USHORT ToDs:1; // To DS indication
497 USHORT FrDs:1; // From DS indication
498 USHORT MoreFrag:1; // More fragment bit
499 USHORT Retry:1; // Retry status bit
500 USHORT PwrMgmt:1; // Power management bit
501 USHORT MoreData:1; // More data bit
502 USHORT Wep:1; // Wep data
503 USHORT Order:1; // Strict order expected
91980990
GKH
504} FRAME_CONTROL, *PFRAME_CONTROL;
505
506typedef struct PACKED _HEADER_802_11 {
507 FRAME_CONTROL FC;
508 USHORT Duration;
509 UCHAR Addr1[MAC_ADDR_LEN];
510 UCHAR Addr2[MAC_ADDR_LEN];
511 UCHAR Addr3[MAC_ADDR_LEN];
91980990
GKH
512 USHORT Frag:4;
513 USHORT Sequence:12;
91980990
GKH
514 UCHAR Octet[0];
515} HEADER_802_11, *PHEADER_802_11;
516
517typedef struct PACKED _FRAME_802_11 {
518 HEADER_802_11 Hdr;
519 UCHAR Octet[1];
520} FRAME_802_11, *PFRAME_802_11;
521
522// QoSNull embedding of management action. When HT Control MA field set to 1.
523typedef struct PACKED _MA_BODY {
524 UCHAR Category;
525 UCHAR Action;
526 UCHAR Octet[1];
527} MA_BODY, *PMA_BODY;
528
529typedef struct PACKED _HEADER_802_3 {
530 UCHAR DAAddr1[MAC_ADDR_LEN];
531 UCHAR SAAddr2[MAC_ADDR_LEN];
532 UCHAR Octet[2];
533} HEADER_802_3, *PHEADER_802_3;
534////Block ACK related format
535// 2-byte BA Parameter field in DELBA frames to terminate an already set up bA
536typedef struct PACKED{
91980990
GKH
537 USHORT Rsv:11; // always set to 0
538 USHORT Initiator:1; // 1: originator 0:recipient
539 USHORT TID:4; // value of TC os TS
91980990
GKH
540} DELBA_PARM, *PDELBA_PARM;
541
542// 2-byte BA Parameter Set field in ADDBA frames to signal parm for setting up a BA
543typedef struct PACKED {
91980990
GKH
544 USHORT AMSDUSupported:1; // 0: not permitted 1: permitted
545 USHORT BAPolicy:1; // 1: immediately BA 0:delayed BA
546 USHORT TID:4; // value of TC os TS
547 USHORT BufSize:10; // number of buffe of size 2304 octetsr
91980990
GKH
548} BA_PARM, *PBA_PARM;
549
550// 2-byte BA Starting Seq CONTROL field
551typedef union PACKED {
552 struct PACKED {
91980990
GKH
553 USHORT FragNum:4; // always set to 0
554 USHORT StartSeq:12; // sequence number of the 1st MSDU for which this BAR is sent
91980990
GKH
555 } field;
556 USHORT word;
557} BASEQ_CONTROL, *PBASEQ_CONTROL;
558
559//BAControl and BARControl are the same
560// 2-byte BA CONTROL field in BA frame
561typedef struct PACKED {
91980990
GKH
562 USHORT ACKPolicy:1; // only related to N-Delayed BA. But not support in RT2860b. 0:NormalACK 1:No ACK
563 USHORT MTID:1; //EWC V1.24
564 USHORT Compressed:1;
565 USHORT Rsv:9;
566 USHORT TID:4;
91980990
GKH
567} BA_CONTROL, *PBA_CONTROL;
568
569// 2-byte BAR CONTROL field in BAR frame
570typedef struct PACKED {
91980990
GKH
571 USHORT ACKPolicy:1; // 0:normal ack, 1:no ack.
572 USHORT MTID:1; //if this bit1, use FRAME_MTBA_REQ, if 0, use FRAME_BA_REQ
573 USHORT Compressed:1;
574 USHORT Rsv1:9;
575 USHORT TID:4;
91980990
GKH
576} BAR_CONTROL, *PBAR_CONTROL;
577
578// BARControl in MTBAR frame
579typedef struct PACKED {
91980990
GKH
580 USHORT ACKPolicy:1;
581 USHORT MTID:1;
582 USHORT Compressed:1;
583 USHORT Rsv1:9;
584 USHORT NumTID:4;
91980990
GKH
585} MTBAR_CONTROL, *PMTBAR_CONTROL;
586
587typedef struct PACKED {
91980990
GKH
588 USHORT Rsv1:12;
589 USHORT TID:4;
91980990
GKH
590} PER_TID_INFO, *PPER_TID_INFO;
591
592typedef struct {
593 PER_TID_INFO PerTID;
594 BASEQ_CONTROL BAStartingSeq;
595} EACH_TID, *PEACH_TID;
596
597
598typedef struct PACKED _PSPOLL_FRAME {
599 FRAME_CONTROL FC;
600 USHORT Aid;
601 UCHAR Bssid[MAC_ADDR_LEN];
602 UCHAR Ta[MAC_ADDR_LEN];
603} PSPOLL_FRAME, *PPSPOLL_FRAME;
604
605typedef struct PACKED _RTS_FRAME {
606 FRAME_CONTROL FC;
607 USHORT Duration;
608 UCHAR Addr1[MAC_ADDR_LEN];
609 UCHAR Addr2[MAC_ADDR_LEN];
610}RTS_FRAME, *PRTS_FRAME;
611
612// BAREQ AND MTBAREQ have the same subtype BAR, 802.11n BAR use compressed bitmap.
613typedef struct PACKED _FRAME_BA_REQ {
614 FRAME_CONTROL FC;
615 USHORT Duration;
616 UCHAR Addr1[MAC_ADDR_LEN];
617 UCHAR Addr2[MAC_ADDR_LEN];
618 BAR_CONTROL BARControl;
619 BASEQ_CONTROL BAStartingSeq;
620} FRAME_BA_REQ, *PFRAME_BA_REQ;
621
622typedef struct PACKED _FRAME_MTBA_REQ {
623 FRAME_CONTROL FC;
624 USHORT Duration;
625 UCHAR Addr1[MAC_ADDR_LEN];
626 UCHAR Addr2[MAC_ADDR_LEN];
627 MTBAR_CONTROL MTBARControl;
628 PER_TID_INFO PerTIDInfo;
629 BASEQ_CONTROL BAStartingSeq;
630} FRAME_MTBA_REQ, *PFRAME_MTBA_REQ;
631
632// Compressed format is mandantory in HT STA
633typedef struct PACKED _FRAME_MTBA {
634 FRAME_CONTROL FC;
635 USHORT Duration;
636 UCHAR Addr1[MAC_ADDR_LEN];
637 UCHAR Addr2[MAC_ADDR_LEN];
638 BA_CONTROL BAControl;
639 BASEQ_CONTROL BAStartingSeq;
640 UCHAR BitMap[8];
641} FRAME_MTBA, *PFRAME_MTBA;
642
643typedef struct PACKED _FRAME_PSMP_ACTION {
644 HEADER_802_11 Hdr;
645 UCHAR Category;
646 UCHAR Action;
647 UCHAR Psmp; // 7.3.1.25
648} FRAME_PSMP_ACTION, *PFRAME_PSMP_ACTION;
649
650typedef struct PACKED _FRAME_ACTION_HDR {
651 HEADER_802_11 Hdr;
652 UCHAR Category;
653 UCHAR Action;
654} FRAME_ACTION_HDR, *PFRAME_ACTION_HDR;
655
656//Action Frame
657//Action Frame Category:Spectrum, Action:Channel Switch. 7.3.2.20
658typedef struct PACKED _CHAN_SWITCH_ANNOUNCE {
659 UCHAR ElementID; // ID = IE_CHANNEL_SWITCH_ANNOUNCEMENT = 37
660 UCHAR Len;
661 CHA_SWITCH_ANNOUNCE_IE CSAnnounceIe;
662} CHAN_SWITCH_ANNOUNCE, *PCHAN_SWITCH_ANNOUNCE;
663
664
665//802.11n : 7.3.2.20a
666typedef struct PACKED _SECOND_CHAN_OFFSET {
667 UCHAR ElementID; // ID = IE_SECONDARY_CH_OFFSET = 62
668 UCHAR Len;
669 SEC_CHA_OFFSET_IE SecChOffsetIe;
670} SECOND_CHAN_OFFSET, *PSECOND_CHAN_OFFSET;
671
672
673typedef struct PACKED _FRAME_SPETRUM_CS {
674 HEADER_802_11 Hdr;
675 UCHAR Category;
676 UCHAR Action;
677 CHAN_SWITCH_ANNOUNCE CSAnnounce;
678 SECOND_CHAN_OFFSET SecondChannel;
679} FRAME_SPETRUM_CS, *PFRAME_SPETRUM_CS;
680
681
682typedef struct PACKED _FRAME_ADDBA_REQ {
683 HEADER_802_11 Hdr;
684 UCHAR Category;
685 UCHAR Action;
686 UCHAR Token; // 1
687 BA_PARM BaParm; // 2 - 10
688 USHORT TimeOutValue; // 0 - 0
689 BASEQ_CONTROL BaStartSeq; // 0-0
690} FRAME_ADDBA_REQ, *PFRAME_ADDBA_REQ;
691
692typedef struct PACKED _FRAME_ADDBA_RSP {
693 HEADER_802_11 Hdr;
694 UCHAR Category;
695 UCHAR Action;
696 UCHAR Token;
697 USHORT StatusCode;
698 BA_PARM BaParm; //0 - 2
699 USHORT TimeOutValue;
700} FRAME_ADDBA_RSP, *PFRAME_ADDBA_RSP;
701
702typedef struct PACKED _FRAME_DELBA_REQ {
703 HEADER_802_11 Hdr;
704 UCHAR Category;
705 UCHAR Action;
706 DELBA_PARM DelbaParm;
707 USHORT ReasonCode;
708} FRAME_DELBA_REQ, *PFRAME_DELBA_REQ;
709
710
711//7.2.1.7
712typedef struct PACKED _FRAME_BAR {
713 FRAME_CONTROL FC;
714 USHORT Duration;
715 UCHAR Addr1[MAC_ADDR_LEN];
716 UCHAR Addr2[MAC_ADDR_LEN];
717 BAR_CONTROL BarControl;
718 BASEQ_CONTROL StartingSeq;
719} FRAME_BAR, *PFRAME_BAR;
720
721//7.2.1.7
722typedef struct PACKED _FRAME_BA {
723 FRAME_CONTROL FC;
724 USHORT Duration;
725 UCHAR Addr1[MAC_ADDR_LEN];
726 UCHAR Addr2[MAC_ADDR_LEN];
727 BAR_CONTROL BarControl;
728 BASEQ_CONTROL StartingSeq;
729 UCHAR bitmask[8];
730} FRAME_BA, *PFRAME_BA;
731
732
733// Radio Measuement Request Frame Format
734typedef struct PACKED _FRAME_RM_REQ_ACTION {
735 HEADER_802_11 Hdr;
736 UCHAR Category;
737 UCHAR Action;
738 UCHAR Token;
739 USHORT Repetition;
740 UCHAR data[0];
741} FRAME_RM_REQ_ACTION, *PFRAME_RM_REQ_ACTION;
742
743typedef struct PACKED {
744 UCHAR ID;
745 UCHAR Length;
746 UCHAR ChannelSwitchMode;
747 UCHAR NewRegClass;
748 UCHAR NewChannelNum;
749 UCHAR ChannelSwitchCount;
750} HT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE, *PHT_EXT_CHANNEL_SWITCH_ANNOUNCEMENT_IE;
751
752
753//
754// _Limit must be the 2**n - 1
755// _SEQ1 , _SEQ2 must be within 0 ~ _Limit
756//
757#define SEQ_STEPONE(_SEQ1, _SEQ2, _Limit) ((_SEQ1 == ((_SEQ2+1) & _Limit)))
758#define SEQ_SMALLER(_SEQ1, _SEQ2, _Limit) (((_SEQ1-_SEQ2) & ((_Limit+1)>>1)))
759#define SEQ_LARGER(_SEQ1, _SEQ2, _Limit) ((_SEQ1 != _SEQ2) && !(((_SEQ1-_SEQ2) & ((_Limit+1)>>1))))
760#define SEQ_WITHIN_WIN(_SEQ1, _SEQ2, _WIN, _Limit) (SEQ_LARGER(_SEQ1, _SEQ2, _Limit) && \
761 SEQ_SMALLER(_SEQ1, ((_SEQ2+_WIN+1)&_Limit), _Limit))
762
763//
764// Contention-free parameter (without ID and Length)
765//
766typedef struct PACKED {
767 BOOLEAN bValid; // 1: variable contains valid value
768 UCHAR CfpCount;
769 UCHAR CfpPeriod;
770 USHORT CfpMaxDuration;
771 USHORT CfpDurRemaining;
772} CF_PARM, *PCF_PARM;
773
774typedef struct _CIPHER_SUITE {
775 NDIS_802_11_ENCRYPTION_STATUS PairCipher; // Unicast cipher 1, this one has more secured cipher suite
776 NDIS_802_11_ENCRYPTION_STATUS PairCipherAux; // Unicast cipher 2 if AP announce two unicast cipher suite
777 NDIS_802_11_ENCRYPTION_STATUS GroupCipher; // Group cipher
778 USHORT RsnCapability; // RSN capability from beacon
779 BOOLEAN bMixMode; // Indicate Pair & Group cipher might be different
780} CIPHER_SUITE, *PCIPHER_SUITE;
781
782// EDCA configuration from AP's BEACON/ProbeRsp
783typedef struct {
784 BOOLEAN bValid; // 1: variable contains valid value
785 BOOLEAN bAdd; // 1: variable contains valid value
786 BOOLEAN bQAck;
787 BOOLEAN bQueueRequest;
788 BOOLEAN bTxopRequest;
789 BOOLEAN bAPSDCapable;
790// BOOLEAN bMoreDataAck;
791 UCHAR EdcaUpdateCount;
792 UCHAR Aifsn[4]; // 0:AC_BK, 1:AC_BE, 2:AC_VI, 3:AC_VO
793 UCHAR Cwmin[4];
794 UCHAR Cwmax[4];
795 USHORT Txop[4]; // in unit of 32-us
796 BOOLEAN bACM[4]; // 1: Admission Control of AC_BK is mandattory
797} EDCA_PARM, *PEDCA_PARM;
798
799// QBSS LOAD information from QAP's BEACON/ProbeRsp
800typedef struct {
801 BOOLEAN bValid; // 1: variable contains valid value
802 USHORT StaNum;
803 UCHAR ChannelUtilization;
804 USHORT RemainingAdmissionControl; // in unit of 32-us
805} QBSS_LOAD_PARM, *PQBSS_LOAD_PARM;
806
807// QBSS Info field in QSTA's assoc req
808typedef struct PACKED {
91980990
GKH
809 UCHAR UAPSD_AC_VO:1;
810 UCHAR UAPSD_AC_VI:1;
811 UCHAR UAPSD_AC_BK:1;
812 UCHAR UAPSD_AC_BE:1;
813 UCHAR Rsv1:1;
814 UCHAR MaxSPLength:2;
815 UCHAR Rsv2:1;
91980990
GKH
816} QBSS_STA_INFO_PARM, *PQBSS_STA_INFO_PARM;
817
818// QBSS Info field in QAP's Beacon/ProbeRsp
819typedef struct PACKED {
91980990
GKH
820 UCHAR ParamSetCount:4;
821 UCHAR Rsv:3;
822 UCHAR UAPSD:1;
91980990
GKH
823} QBSS_AP_INFO_PARM, *PQBSS_AP_INFO_PARM;
824
825// QOS Capability reported in QAP's BEACON/ProbeRsp
826// QOS Capability sent out in QSTA's AssociateReq/ReAssociateReq
827typedef struct {
828 BOOLEAN bValid; // 1: variable contains valid value
829 BOOLEAN bQAck;
830 BOOLEAN bQueueRequest;
831 BOOLEAN bTxopRequest;
832// BOOLEAN bMoreDataAck;
833 UCHAR EdcaUpdateCount;
834} QOS_CAPABILITY_PARM, *PQOS_CAPABILITY_PARM;
835
91980990
GKH
836typedef struct {
837 UCHAR IELen;
838 UCHAR IE[MAX_CUSTOM_LEN];
839} WPA_IE_;
91980990
GKH
840
841typedef struct {
842 UCHAR Bssid[MAC_ADDR_LEN];
843 UCHAR Channel;
844 UCHAR CentralChannel; //Store the wide-band central channel for 40MHz. .used in 40MHz AP. Or this is the same as Channel.
845 UCHAR BssType;
846 USHORT AtimWin;
847 USHORT BeaconPeriod;
848
849 UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES];
850 UCHAR SupRateLen;
851 UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
852 UCHAR ExtRateLen;
853 HT_CAPABILITY_IE HtCapability;
854 UCHAR HtCapabilityLen;
855 ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE
856 UCHAR AddHtInfoLen;
857 UCHAR NewExtChanOffset;
858 CHAR Rssi;
859 UCHAR Privacy; // Indicate security function ON/OFF. Don't mess up with auth mode.
860 UCHAR Hidden;
861
862 USHORT DtimPeriod;
863 USHORT CapabilityInfo;
864
865 USHORT CfpCount;
866 USHORT CfpPeriod;
867 USHORT CfpMaxDuration;
868 USHORT CfpDurRemaining;
869 UCHAR SsidLen;
870 CHAR Ssid[MAX_LEN_OF_SSID];
871
872 ULONG LastBeaconRxTime; // OS's timestamp
873
874 BOOLEAN bSES;
875
876 // New for WPA2
877 CIPHER_SUITE WPA; // AP announced WPA cipher suite
878 CIPHER_SUITE WPA2; // AP announced WPA2 cipher suite
879
880 // New for microsoft WPA support
881 NDIS_802_11_FIXED_IEs FixIEs;
882 NDIS_802_11_AUTHENTICATION_MODE AuthModeAux; // Addition mode for WPA2 / WPA capable AP
883 NDIS_802_11_AUTHENTICATION_MODE AuthMode;
884 NDIS_802_11_WEP_STATUS WepStatus; // Unicast Encryption Algorithm extract from VAR_IE
885 USHORT VarIELen; // Length of next VIE include EID & Length
886 UCHAR VarIEs[MAX_VIE_LEN];
887
888 // CCX Ckip information
889 UCHAR CkipFlag;
890
891 // CCX 2 TSF
892 UCHAR PTSF[4]; // Parent TSF
893 UCHAR TTSF[8]; // Target TSF
894
895 // 802.11e d9, and WMM
896 EDCA_PARM EdcaParm;
897 QOS_CAPABILITY_PARM QosCapability;
898 QBSS_LOAD_PARM QbssLoad;
91980990
GKH
899 WPA_IE_ WpaIE;
900 WPA_IE_ RsnIE;
91980990
GKH
901} BSS_ENTRY, *PBSS_ENTRY;
902
903typedef struct {
904 UCHAR BssNr;
905 UCHAR BssOverlapNr;
906 BSS_ENTRY BssEntry[MAX_LEN_OF_BSS_TABLE];
907} BSS_TABLE, *PBSS_TABLE;
908
909
910typedef struct _MLME_QUEUE_ELEM {
911 ULONG Machine;
912 ULONG MsgType;
913 ULONG MsgLen;
914 UCHAR Msg[MGMT_DMA_BUFFER_SIZE];
915 LARGE_INTEGER TimeStamp;
916 UCHAR Rssi0;
917 UCHAR Rssi1;
918 UCHAR Rssi2;
919 UCHAR Signal;
920 UCHAR Channel;
921 UCHAR Wcid;
922 BOOLEAN Occupied;
923} MLME_QUEUE_ELEM, *PMLME_QUEUE_ELEM;
924
925typedef struct _MLME_QUEUE {
926 ULONG Num;
927 ULONG Head;
928 ULONG Tail;
929 NDIS_SPIN_LOCK Lock;
930 MLME_QUEUE_ELEM Entry[MAX_LEN_OF_MLME_QUEUE];
931} MLME_QUEUE, *PMLME_QUEUE;
932
933typedef VOID (*STATE_MACHINE_FUNC)(VOID *Adaptor, MLME_QUEUE_ELEM *Elem);
934
935typedef struct _STATE_MACHINE {
936 ULONG Base;
937 ULONG NrState;
938 ULONG NrMsg;
939 ULONG CurrState;
940 STATE_MACHINE_FUNC *TransFunc;
941} STATE_MACHINE, *PSTATE_MACHINE;
942
943
944// MLME AUX data structure that hold temporarliy settings during a connection attempt.
945// Once this attemp succeeds, all settings will be copy to pAd->StaActive.
946// A connection attempt (user set OID, roaming, CCX fast roaming,..) consists of
947// several steps (JOIN, AUTH, ASSOC or REASSOC) and may fail at any step. We purposely
948// separate this under-trial settings away from pAd->StaActive so that once
949// this new attempt failed, driver can auto-recover back to the active settings.
950typedef struct _MLME_AUX {
951 UCHAR BssType;
952 UCHAR Ssid[MAX_LEN_OF_SSID];
953 UCHAR SsidLen;
954 UCHAR Bssid[MAC_ADDR_LEN];
955 UCHAR AutoReconnectSsid[MAX_LEN_OF_SSID];
956 UCHAR AutoReconnectSsidLen;
957 USHORT Alg;
958 UCHAR ScanType;
959 UCHAR Channel;
960 UCHAR CentralChannel;
961 USHORT Aid;
962 USHORT CapabilityInfo;
963 USHORT BeaconPeriod;
964 USHORT CfpMaxDuration;
965 USHORT CfpPeriod;
966 USHORT AtimWin;
967
968 // Copy supported rate from desired AP's beacon. We are trying to match
969 // AP's supported and extended rate settings.
970 UCHAR SupRate[MAX_LEN_OF_SUPPORTED_RATES];
971 UCHAR ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
972 UCHAR SupRateLen;
973 UCHAR ExtRateLen;
974 HT_CAPABILITY_IE HtCapability;
975 UCHAR HtCapabilityLen;
976 ADD_HT_INFO_IE AddHtInfo; // AP might use this additional ht info IE
977 UCHAR NewExtChannelOffset;
978 //RT_HT_CAPABILITY SupportedHtPhy;
979
980 // new for QOS
981 QOS_CAPABILITY_PARM APQosCapability; // QOS capability of the current associated AP
982 EDCA_PARM APEdcaParm; // EDCA parameters of the current associated AP
983 QBSS_LOAD_PARM APQbssLoad; // QBSS load of the current associated AP
984
985 // new to keep Ralink specific feature
986 ULONG APRalinkIe;
987
988 BSS_TABLE SsidBssTab; // AP list for the same SSID
989 BSS_TABLE RoamTab; // AP list eligible for roaming
990 ULONG BssIdx;
991 ULONG RoamIdx;
992
993 BOOLEAN CurrReqIsFromNdis;
994
995 RALINK_TIMER_STRUCT BeaconTimer, ScanTimer;
996 RALINK_TIMER_STRUCT AuthTimer;
997 RALINK_TIMER_STRUCT AssocTimer, ReassocTimer, DisassocTimer;
998} MLME_AUX, *PMLME_AUX;
999
1000typedef struct _MLME_ADDBA_REQ_STRUCT{
1001 UCHAR Wcid; //
1002 UCHAR pAddr[MAC_ADDR_LEN];
1003 UCHAR BaBufSize;
1004 USHORT TimeOutValue;
1005 UCHAR TID;
1006 UCHAR Token;
1007 USHORT BaStartSeq;
1008} MLME_ADDBA_REQ_STRUCT, *PMLME_ADDBA_REQ_STRUCT;
1009
1010
1011typedef struct _MLME_DELBA_REQ_STRUCT{
1012 UCHAR Wcid; //
1013 UCHAR Addr[MAC_ADDR_LEN];
1014 UCHAR TID;
1015 UCHAR Initiator;
1016} MLME_DELBA_REQ_STRUCT, *PMLME_DELBA_REQ_STRUCT;
1017
1018// assoc struct is equal to reassoc
1019typedef struct _MLME_ASSOC_REQ_STRUCT{
1020 UCHAR Addr[MAC_ADDR_LEN];
1021 USHORT CapabilityInfo;
1022 USHORT ListenIntv;
1023 ULONG Timeout;
1024} MLME_ASSOC_REQ_STRUCT, *PMLME_ASSOC_REQ_STRUCT, MLME_REASSOC_REQ_STRUCT, *PMLME_REASSOC_REQ_STRUCT;
1025
1026typedef struct _MLME_DISASSOC_REQ_STRUCT{
1027 UCHAR Addr[MAC_ADDR_LEN];
1028 USHORT Reason;
1029} MLME_DISASSOC_REQ_STRUCT, *PMLME_DISASSOC_REQ_STRUCT;
1030
1031typedef struct _MLME_AUTH_REQ_STRUCT {
1032 UCHAR Addr[MAC_ADDR_LEN];
1033 USHORT Alg;
1034 ULONG Timeout;
1035} MLME_AUTH_REQ_STRUCT, *PMLME_AUTH_REQ_STRUCT;
1036
1037typedef struct _MLME_DEAUTH_REQ_STRUCT {
1038 UCHAR Addr[MAC_ADDR_LEN];
1039 USHORT Reason;
1040} MLME_DEAUTH_REQ_STRUCT, *PMLME_DEAUTH_REQ_STRUCT;
1041
1042typedef struct {
1043 ULONG BssIdx;
1044} MLME_JOIN_REQ_STRUCT;
1045
1046typedef struct _MLME_SCAN_REQ_STRUCT {
1047 UCHAR Bssid[MAC_ADDR_LEN];
1048 UCHAR BssType;
1049 UCHAR ScanType;
1050 UCHAR SsidLen;
1051 CHAR Ssid[MAX_LEN_OF_SSID];
1052} MLME_SCAN_REQ_STRUCT, *PMLME_SCAN_REQ_STRUCT;
1053
1054typedef struct _MLME_START_REQ_STRUCT {
1055 CHAR Ssid[MAX_LEN_OF_SSID];
1056 UCHAR SsidLen;
1057} MLME_START_REQ_STRUCT, *PMLME_START_REQ_STRUCT;
1058
91980990
GKH
1059typedef struct PACKED {
1060 UCHAR Eid;
1061 UCHAR Len;
1062 CHAR Octet[1];
1063} EID_STRUCT,*PEID_STRUCT, BEACON_EID_STRUCT, *PBEACON_EID_STRUCT;
1064
1065typedef struct PACKED _RTMP_TX_RATE_SWITCH
1066{
1067 UCHAR ItemNo;
91980990
GKH
1068 UCHAR STBC:1;
1069 UCHAR ShortGI:1;
1070 UCHAR BW:1;
1071 UCHAR Rsv1:1;
1072 UCHAR Mode:2;
1073 UCHAR Rsv2:2;
91980990
GKH
1074 UCHAR CurrMCS;
1075 UCHAR TrainUp;
1076 UCHAR TrainDown;
1077} RRTMP_TX_RATE_SWITCH, *PRTMP_TX_RATE_SWITCH;
1078
1079// ========================== AP mlme.h ===============================
1080#define TBTT_PRELOAD_TIME 384 // usec. LomgPreamble + 24-byte at 1Mbps
1081#define DEFAULT_DTIM_PERIOD 1
1082
1083#define MAC_TABLE_AGEOUT_TIME 300 // unit: sec
1084#define MAC_TABLE_ASSOC_TIMEOUT 5 // unit: sec
1085#define MAC_TABLE_FULL(Tab) ((Tab).size == MAX_LEN_OF_MAC_TABLE)
1086
1087// AP shall drop the sta if contine Tx fail count reach it.
1088#define MAC_ENTRY_LIFE_CHECK_CNT 20 // packet cnt.
1089
1090// Value domain of pMacEntry->Sst
1091typedef enum _Sst {
1092 SST_NOT_AUTH, // 0: equivalent to IEEE 802.11/1999 state 1
1093 SST_AUTH, // 1: equivalent to IEEE 802.11/1999 state 2
1094 SST_ASSOC // 2: equivalent to IEEE 802.11/1999 state 3
1095} SST;
1096
1097// value domain of pMacEntry->AuthState
1098typedef enum _AuthState {
1099 AS_NOT_AUTH,
1100 AS_AUTH_OPEN, // STA has been authenticated using OPEN SYSTEM
1101 AS_AUTH_KEY, // STA has been authenticated using SHARED KEY
1102 AS_AUTHENTICATING // STA is waiting for AUTH seq#3 using SHARED KEY
1103} AUTH_STATE;
1104
1105//for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114
1106typedef enum _ApWpaState {
1107 AS_NOTUSE, // 0
1108 AS_DISCONNECT, // 1
1109 AS_DISCONNECTED, // 2
1110 AS_INITIALIZE, // 3
1111 AS_AUTHENTICATION, // 4
1112 AS_AUTHENTICATION2, // 5
1113 AS_INITPMK, // 6
1114 AS_INITPSK, // 7
1115 AS_PTKSTART, // 8
1116 AS_PTKINIT_NEGOTIATING, // 9
1117 AS_PTKINITDONE, // 10
1118 AS_UPDATEKEYS, // 11
1119 AS_INTEGRITY_FAILURE, // 12
1120 AS_KEYUPDATE, // 13
1121} AP_WPA_STATE;
1122
1123// for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114
1124typedef enum _GTKState {
1125 REKEY_NEGOTIATING,
1126 REKEY_ESTABLISHED,
1127 KEYERROR,
1128} GTK_STATE;
1129
1130// for-wpa value domain of pMacEntry->WpaState 802.1i D3 p.114
1131typedef enum _WpaGTKState {
1132 SETKEYS,
1133 SETKEYS_DONE,
1134} WPA_GTK_STATE;
1135// ====================== end of AP mlme.h ============================
1136
1137
1138#endif // MLME_H__