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