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