- supported.conf: Added sparse_keymap (eeepc_laptop depends on it)
[linux-flexiantxendom0-3.2.10.git] / drivers / staging / rt3090 / rtmp_def.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     rtmp_def.h
29
30     Abstract:
31     Miniport related definition header
32
33     Revision History:
34     Who         When          What
35     --------    ----------    ----------------------------------------------
36     Paul Lin    08-01-2002    created
37     John Chang  08-05-2003    add definition for 11g & other drafts
38 */
39 #ifndef __RTMP_DEF_H__
40 #define __RTMP_DEF_H__
41
42 #include "oid.h"
43
44 #undef AP_WSC_INCLUDED
45 #undef STA_WSC_INCLUDED
46 #undef WSC_INCLUDED
47
48
49 #ifdef CONFIG_STA_SUPPORT
50 #endif // CONFIG_STA_SUPPORT //
51
52 #if defined(AP_WSC_INCLUDED) || defined(STA_WSC_INCLUDED)
53 #define WSC_INCLUDED
54 #endif
55 //
56 //  Debug information verbosity: lower values indicate higher urgency
57 //
58 #define RT_DEBUG_OFF        0
59 #define RT_DEBUG_ERROR      1
60 #define RT_DEBUG_WARN       2
61 #define RT_DEBUG_TRACE      3
62 #define RT_DEBUG_INFO       4
63 #define RT_DEBUG_LOUD       5
64
65 #define NIC_TAG             ((ULONG)'0682')
66 #define NIC_DBG_STRING      ("**RT28xx**")
67
68 #ifdef SNMP_SUPPORT
69 // for snmp
70 // to get manufacturer OUI, kathy, 2008_0220
71 #define ManufacturerOUI_LEN                     3
72 #define ManufacturerNAME                        ("Ralink Technology Company.")
73 #define ResourceTypeIdName                      ("Ralink_ID")
74 #endif
75
76
77 //#define PACKED
78
79 #define RALINK_2883_VERSION             ((UINT32)0x28830300)
80 #define RALINK_2880E_VERSION    ((UINT32)0x28720200)
81 #define RALINK_3070_VERSION             ((UINT32)0x30700200)
82
83 #define MAX_RX_PKT_LEN  1520
84
85 //
86 // Entry number for each DMA descriptor ring
87 //
88
89 #ifdef RTMP_MAC_PCI
90 #define TX_RING_SIZE            64 //64
91 #define MGMT_RING_SIZE          128
92 #define RX_RING_SIZE            128 //64
93 #define MAX_TX_PROCESS          TX_RING_SIZE //8
94 #define MAX_DMA_DONE_PROCESS    TX_RING_SIZE
95 #define MAX_TX_DONE_PROCESS     TX_RING_SIZE //8
96 #define LOCAL_TXBUF_SIZE        2
97 #endif // RTMP_MAC_PCI //
98
99 #define PCI_VIRT_TO_PHYS(__Addr)        (((UINT32)(__Addr)) & 0x0FFFFFFF)
100
101
102 #ifdef MULTIPLE_CARD_SUPPORT
103 // MC: Multple Cards
104 #define MAX_NUM_OF_MULTIPLE_CARD                32
105 #endif // MULTIPLE_CARD_SUPPORT //
106
107 #define MAX_RX_PROCESS          128 //64 //32
108 #define NUM_OF_LOCAL_TXBUF      2
109 #define TXD_SIZE                16
110 #define TXWI_SIZE               16
111 #define RXD_SIZE                16
112 #define RXWI_SIZE               16
113 // TXINFO_SIZE + TXWI_SIZE + 802.11 Header Size + AMSDU sub frame header
114 #define TX_DMA_1ST_BUFFER_SIZE  96    // only the 1st physical buffer is pre-allocated
115 #define MGMT_DMA_BUFFER_SIZE    1536 //2048
116 #define RX_BUFFER_AGGRESIZE     3840 //3904 //3968 //4096 //2048 //4096
117 #define RX_BUFFER_NORMSIZE      3840 //3904 //3968 //4096 //2048 //4096
118 #define TX_BUFFER_NORMSIZE              RX_BUFFER_NORMSIZE
119 #define MAX_FRAME_SIZE          2346                    // Maximum 802.11 frame size
120 #define MAX_AGGREGATION_SIZE    3840 //3904 //3968 //4096
121 #define MAX_NUM_OF_TUPLE_CACHE  2
122 #define MAX_MCAST_LIST_SIZE     32
123 #define MAX_LEN_OF_VENDOR_DESC  64
124 //#define MAX_SIZE_OF_MCAST_PSQ   (NUM_OF_LOCAL_TXBUF >> 2) // AP won't spend more than 1/4 of total buffers on M/BCAST PSQ
125 #define MAX_SIZE_OF_MCAST_PSQ               32
126
127 #define MAX_RX_PROCESS_CNT      (RX_RING_SIZE)
128
129
130 /*
131         WMM Note: If memory of your system is not much, please reduce the definition;
132         or when you do WMM test, the queue for low priority AC will be full, i.e.
133         TX_RING_SIZE + MAX_PACKETS_IN_QUEUE packets for the AC will be buffered in
134         WLAN, maybe no any packet buffer can be got in Ethernet driver.
135
136         Sometimes no packet buffer can be got in Ethernet driver, the system will
137         send flow control packet to the sender to slow down its sending rate.
138         So no WMM can be saw in the air.
139 */
140
141 /*
142         Need to use 64 in vxworks for test case WMM A5-T07
143         Two dnlink (10Mbps) from a WMM station to a non-WMM station.
144         If use 256, queue is not enough.
145         And in rt_main_end.c, clConfig.clNum = RX_RING_SIZE * 3; is changed to
146         clConfig.clNum = RX_RING_SIZE * 4;
147 */
148 // TODO: For VxWorks the size is 256. Shall we cahnge the value as 256 for all OS?????
149 #define MAX_PACKETS_IN_QUEUE                            (512) //(512)    // to pass WMM A5-WPAPSK
150
151 #define MAX_PACKETS_IN_MCAST_PS_QUEUE           32
152 #define MAX_PACKETS_IN_PS_QUEUE                         128     //32
153 #define WMM_NUM_OF_AC                       4  /* AC0, AC1, AC2, and AC3 */
154
155
156 #ifdef RTMP_EFUSE_SUPPORT
157 //2008/09/11:KH add to support efuse<--
158 #define MAX_EEPROM_BIN_FILE_SIZE                                1024
159 #define EFUSE_BUFFER_PATH                                               "/tmp/RT30xxEEPROM.bin"
160 //2008/09/11:KH add to support efuse-->
161 #endif // RTMP_EFUSE_SUPPORT //
162
163 // RxFilter
164 #define STANORMAL        0x17f97
165 #define APNORMAL         0x15f97
166 #define PSPXLINK         0x17f93
167 //
168 //  RTMP_ADAPTER flags
169 //
170 #define fRTMP_ADAPTER_MAP_REGISTER          0x00000001
171 #define fRTMP_ADAPTER_INTERRUPT_IN_USE      0x00000002
172 #define fRTMP_ADAPTER_HARDWARE_ERROR        0x00000004
173 #define fRTMP_ADAPTER_SCATTER_GATHER        0x00000008
174 #define fRTMP_ADAPTER_SEND_PACKET_ERROR     0x00000010
175 #define fRTMP_ADAPTER_MLME_RESET_IN_PROGRESS 0x00000020
176 #define fRTMP_ADAPTER_HALT_IN_PROGRESS      0x00000040
177 #define fRTMP_ADAPTER_RESET_IN_PROGRESS     0x00000080
178 #define fRTMP_ADAPTER_NIC_NOT_EXIST         0x00000100
179 #define fRTMP_ADAPTER_TX_RING_ALLOCATED     0x00000200
180 #define fRTMP_ADAPTER_REMOVE_IN_PROGRESS    0x00000400
181 #define fRTMP_ADAPTER_MIMORATE_INUSED       0x00000800
182 #define fRTMP_ADAPTER_RX_RING_ALLOCATED     0x00001000
183 #define fRTMP_ADAPTER_INTERRUPT_ACTIVE      0x00002000
184 #define fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS  0x00004000
185 #define fRTMP_ADAPTER_REASSOC_IN_PROGRESS       0x00008000
186 #define fRTMP_ADAPTER_MEDIA_STATE_PENDING       0x00010000
187 #define fRTMP_ADAPTER_RADIO_OFF                         0x00020000
188 #define fRTMP_ADAPTER_BULKOUT_RESET                     0x00040000
189 #define fRTMP_ADAPTER_BULKIN_RESET                      0x00080000
190 #define fRTMP_ADAPTER_RDG_ACTIVE                        0x00100000
191 #define fRTMP_ADAPTER_DYNAMIC_BE_TXOP_ACTIVE 0x00200000
192 #define fRTMP_ADAPTER_SCAN_2040                         0x04000000
193 #define fRTMP_ADAPTER_RADIO_MEASUREMENT         0x08000000
194
195 #define fRTMP_ADAPTER_START_UP                  0x10000000      //Devive already initialized and enabled Tx/Rx.
196 #define fRTMP_ADAPTER_MEDIA_STATE_CHANGE    0x20000000
197 #define fRTMP_ADAPTER_IDLE_RADIO_OFF        0x40000000
198
199 // Lock bit for accessing different ring buffers
200 //#define fRTMP_ADAPTER_TX_RING_BUSY        0x80000000
201 //#define fRTMP_ADAPTER_MGMT_RING_BUSY      0x40000000
202 //#define fRTMP_ADAPTER_ATIM_RING_BUSY      0x20000000
203 //#define fRTMP_ADAPTER_RX_RING_BUSY        0x10000000
204
205 // Lock bit for accessing different queue
206 //#define   fRTMP_ADAPTER_TX_QUEUE_BUSY     0x08000000
207 //#define   fRTMP_ADAPTER_MGMT_QUEUE_BUSY   0x04000000
208
209 //
210 //  STA operation status flags
211 //
212 #define fOP_STATUS_INFRA_ON                 0x00000001
213 #define fOP_STATUS_ADHOC_ON                 0x00000002
214 #define fOP_STATUS_BG_PROTECTION_INUSED     0x00000004
215 #define fOP_STATUS_SHORT_SLOT_INUSED        0x00000008
216 #define fOP_STATUS_SHORT_PREAMBLE_INUSED    0x00000010
217 #define fOP_STATUS_RECEIVE_DTIM             0x00000020
218 //#define fOP_STATUS_TX_RATE_SWITCH_ENABLED   0x00000040
219 #define fOP_STATUS_MEDIA_STATE_CONNECTED    0x00000080
220 #define fOP_STATUS_WMM_INUSED               0x00000100
221 #define fOP_STATUS_AGGREGATION_INUSED       0x00000200
222 #define fOP_STATUS_DOZE                     0x00000400  // debug purpose
223 #define fOP_STATUS_PIGGYBACK_INUSED         0x00000800  // piggy-back, and aggregation
224 #define fOP_STATUS_APSD_INUSED                          0x00001000
225 #define fOP_STATUS_TX_AMSDU_INUSED                      0x00002000
226 #define fOP_STATUS_MAX_RETRY_ENABLED            0x00004000
227 #define fOP_STATUS_WAKEUP_NOW               0x00008000
228 #define fOP_STATUS_PCIE_DEVICE       0x00020000
229
230 //
231 //  RTMP_ADAPTER PSFlags : related to advanced power save.
232 //
233 // Indicate whether driver can go to sleep mode from now. This flag is useful AFTER link up
234 #define fRTMP_PS_CAN_GO_SLEEP          0x00000001
235 // Indicate whether driver has issue a LinkControl command to PCIe L1
236 #define fRTMP_PS_SET_PCI_CLK_OFF_COMMAND          0x00000002
237 // Indicate driver should disable kick off hardware to send packets from now.
238 #define fRTMP_PS_DISABLE_TX         0x00000004
239 // Indicate driver should IMMEDIATELY fo to sleep after receiving AP's beacon in which  doesn't indicate unicate nor multicast packets for me
240 //. This flag is used ONLY in RTMPHandleRxDoneInterrupt routine.
241 #define fRTMP_PS_GO_TO_SLEEP_NOW         0x00000008
242 #define fRTMP_PS_TOGGLE_L1              0x00000010      // Use Toggle L1 mechanism for rt28xx PCIe
243 #ifdef RT3090
244 #define WAKE_MCU_CMD                            0x31
245 #define SLEEP_MCU_CMD                                   0x30
246 #define RFOFF_MCU_CMD                           0x35
247 #endif // RT3090 //
248 #ifdef DOT11N_DRAFT3
249 #define fOP_STATUS_SCAN_2040                        0x00040000
250 #endif // DOT11N_DRAFT3 //
251
252 #define CCKSETPROTECT           0x1
253 #define OFDMSETPROTECT          0x2
254 #define MM20SETPROTECT          0x4
255 #define MM40SETPROTECT          0x8
256 #define GF20SETPROTECT          0x10
257 #define GR40SETPROTECT          0x20
258 #define ALLN_SETPROTECT         (GR40SETPROTECT | GF20SETPROTECT | MM40SETPROTECT | MM20SETPROTECT)
259
260 //
261 //  AP's client table operation status flags
262 //
263 #define fCLIENT_STATUS_WMM_CAPABLE          0x00000001  // CLIENT can parse QOS DATA frame
264 #define fCLIENT_STATUS_AGGREGATION_CAPABLE  0x00000002  // CLIENT can receive Ralink's proprietary TX aggregation frame
265 #define fCLIENT_STATUS_PIGGYBACK_CAPABLE    0x00000004  // CLIENT support piggy-back
266 #define fCLIENT_STATUS_AMSDU_INUSED                     0x00000008
267 #define fCLIENT_STATUS_SGI20_CAPABLE            0x00000010
268 #define fCLIENT_STATUS_SGI40_CAPABLE            0x00000020
269 #define fCLIENT_STATUS_TxSTBC_CAPABLE           0x00000040
270 #define fCLIENT_STATUS_RxSTBC_CAPABLE           0x00000080
271 #define fCLIENT_STATUS_HTC_CAPABLE                      0x00000100
272 #define fCLIENT_STATUS_RDG_CAPABLE                      0x00000200
273 #define fCLIENT_STATUS_MCSFEEDBACK_CAPABLE  0x00000400
274 #define fCLIENT_STATUS_APSD_CAPABLE         0x00000800  /* UAPSD STATION */
275
276 #ifdef DOT11N_DRAFT3
277 #define fCLIENT_STATUS_BSSCOEXIST_CAPABLE       0x00001000
278 #endif // DOT11N_DRAFT3 //
279
280 #define fCLIENT_STATUS_RALINK_CHIPSET           0x00100000
281 //
282 //  STA configuration flags
283 //
284 //#define fSTA_CFG_ENABLE_TX_BURST          0x00000001
285
286 // 802.11n Operating Mode Definition. 0-3 also used in ASICUPdateProtect switch case
287 #define HT_NO_PROTECT   0
288 #define HT_LEGACY_PROTECT       1
289 #define HT_40_PROTECT   2
290 #define HT_2040_PROTECT 3
291 #define HT_RTSCTS_6M    7
292 //following is our own definition in order to turn on our ASIC protection register in INFRASTRUCTURE.
293 #define HT_ATHEROS      8       // rt2860c has problem with atheros chip. we need to turn on RTS/CTS .
294 #define HT_FORCERTSCTS  9       // Force turn on RTS/CTS first. then go to evaluate if this force RTS is necessary.
295
296 //
297 // RX Packet Filter control flags. Apply on pAd->PacketFilter
298 //
299 #define fRX_FILTER_ACCEPT_DIRECT            NDIS_PACKET_TYPE_DIRECTED
300 #define fRX_FILTER_ACCEPT_MULTICAST         NDIS_PACKET_TYPE_MULTICAST
301 #define fRX_FILTER_ACCEPT_BROADCAST         NDIS_PACKET_TYPE_BROADCAST
302 #define fRX_FILTER_ACCEPT_ALL_MULTICAST     NDIS_PACKET_TYPE_ALL_MULTICAST
303 #define fRX_FILTER_ACCEPT_PROMISCUOUS       NDIS_PACKET_TYPE_PROMISCUOUS
304
305 //
306 // Error code section
307 //
308 // NDIS_ERROR_CODE_ADAPTER_NOT_FOUND
309 #define ERRLOG_READ_PCI_SLOT_FAILED     0x00000101L
310 #define ERRLOG_WRITE_PCI_SLOT_FAILED    0x00000102L
311 #define ERRLOG_VENDOR_DEVICE_NOMATCH    0x00000103L
312
313 // NDIS_ERROR_CODE_ADAPTER_DISABLED
314 #define ERRLOG_BUS_MASTER_DISABLED      0x00000201L
315
316 // NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION
317 #define ERRLOG_INVALID_SPEED_DUPLEX     0x00000301L
318 #define ERRLOG_SET_SECONDARY_FAILED     0x00000302L
319
320 // NDIS_ERROR_CODE_OUT_OF_RESOURCES
321 #define ERRLOG_OUT_OF_MEMORY            0x00000401L
322 #define ERRLOG_OUT_OF_SHARED_MEMORY     0x00000402L
323 #define ERRLOG_OUT_OF_MAP_REGISTERS     0x00000403L
324 #define ERRLOG_OUT_OF_BUFFER_POOL       0x00000404L
325 #define ERRLOG_OUT_OF_NDIS_BUFFER       0x00000405L
326 #define ERRLOG_OUT_OF_PACKET_POOL       0x00000406L
327 #define ERRLOG_OUT_OF_NDIS_PACKET       0x00000407L
328 #define ERRLOG_OUT_OF_LOOKASIDE_MEMORY  0x00000408L
329
330 // NDIS_ERROR_CODE_HARDWARE_FAILURE
331 #define ERRLOG_SELFTEST_FAILED          0x00000501L
332 #define ERRLOG_INITIALIZE_ADAPTER       0x00000502L
333 #define ERRLOG_REMOVE_MINIPORT          0x00000503L
334
335 // NDIS_ERROR_CODE_RESOURCE_CONFLICT
336 #define ERRLOG_MAP_IO_SPACE             0x00000601L
337 #define ERRLOG_QUERY_ADAPTER_RESOURCES  0x00000602L
338 #define ERRLOG_NO_IO_RESOURCE           0x00000603L
339 #define ERRLOG_NO_INTERRUPT_RESOURCE    0x00000604L
340 #define ERRLOG_NO_MEMORY_RESOURCE       0x00000605L
341
342
343 // WDS definition
344 #define MAX_WDS_ENTRY               4
345 #define WDS_PAIRWISE_KEY_OFFSET     60    // WDS links uses pairwise key#60 ~ 63 in ASIC pairwise key table
346
347 #define WDS_DISABLE_MODE            0
348 #define WDS_RESTRICT_MODE           1
349 #define WDS_BRIDGE_MODE             2
350 #define WDS_REPEATER_MODE           3
351 #define WDS_LAZY_MODE               4
352
353
354 #define MAX_MESH_NUM                            0
355
356 #define MAX_APCLI_NUM                           0
357 #ifdef APCLI_SUPPORT
358 #undef  MAX_APCLI_NUM
359 #define MAX_APCLI_NUM                           1
360 #endif // APCLI_SUPPORT //
361
362 #define MAX_MBSSID_NUM                          1
363 #ifdef MBSS_SUPPORT
364 #undef  MAX_MBSSID_NUM
365 #define MAX_MBSSID_NUM                          (8 - MAX_MESH_NUM - MAX_APCLI_NUM)
366 #endif // MBSS_SUPPORT //
367
368 /* sanity check for apidx */
369 #define MBSS_MR_APIDX_SANITY_CHECK(apidx) \
370     { if (apidx > MAX_MBSSID_NUM) { \
371           DBGPRINT(RT_DEBUG_ERROR, ("%s> Error! apidx = %d > MAX_MBSSID_NUM!\n", __FUNCTION__, apidx)); \
372           apidx = MAIN_MBSSID; } }
373
374 #define VALID_WCID(_wcid)       ((_wcid) > 0 && (_wcid) < MAX_LEN_OF_MAC_TABLE )
375
376 #define MAIN_MBSSID                 0
377 #define FIRST_MBSSID                1
378
379
380 #define MAX_BEACON_SIZE                         512
381 // If the MAX_MBSSID_NUM is larger than 6,
382 // it shall reserve some WCID space(wcid 222~253) for beacon frames.
383 // -    these wcid 238~253 are reserved for beacon#6(ra6).
384 // -    these wcid 222~237 are reserved for beacon#7(ra7).
385 #if defined(MAX_MBSSID_NUM) && (MAX_MBSSID_NUM == 8)
386 #define HW_RESERVED_WCID        222
387 #elif defined(MAX_MBSSID_NUM) && (MAX_MBSSID_NUM == 7)
388 #define HW_RESERVED_WCID        238
389 #else
390 #define HW_RESERVED_WCID        255
391 #endif
392
393 // Then dedicate wcid of DFS and Carrier-Sense.
394 #define DFS_CTS_WCID            (HW_RESERVED_WCID - 1)
395 #define CS_CTS_WCID             (HW_RESERVED_WCID - 2)
396 #define LAST_SPECIFIC_WCID      (HW_RESERVED_WCID - 2)
397
398 // If MAX_MBSSID_NUM is 8, the maximum available wcid for the associated STA is 211.
399 // If MAX_MBSSID_NUM is 7, the maximum available wcid for the associated STA is 228.
400 #define MAX_AVAILABLE_CLIENT_WCID       (LAST_SPECIFIC_WCID - MAX_MBSSID_NUM - 1)
401
402 // TX need WCID to find Cipher Key
403 // these wcid 212 ~ 219 are reserved for bc/mc packets if MAX_MBSSID_NUM is 8.
404 #define GET_GroupKey_WCID(__wcid, __bssidx) \
405         {                                                                               \
406                 __wcid = LAST_SPECIFIC_WCID - (MAX_MBSSID_NUM) + __bssidx;      \
407         }
408
409 #define IsGroupKeyWCID(__wcid) (((__wcid) < LAST_SPECIFIC_WCID) && ((__wcid) >= (LAST_SPECIFIC_WCID - (MAX_MBSSID_NUM))))
410
411
412 // definition to support multiple BSSID
413 #define BSS0                            0
414 #define BSS1                            1
415 #define BSS2                            2
416 #define BSS3                            3
417 #define BSS4                            4
418 #define BSS5                            5
419 #define BSS6                            6
420 #define BSS7                            7
421
422
423 //============================================================
424 // Length definitions
425 #define PEER_KEY_NO                     2
426 #define MAC_ADDR_LEN                    6
427 #define TIMESTAMP_LEN                   8
428 #define MAX_LEN_OF_SUPPORTED_RATES      MAX_LENGTH_OF_SUPPORT_RATES // 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54
429 #define MAX_NUM_OF_REGULATORY_CLASS             16
430 #define MAX_LEN_OF_KEY                  32      // 32 octets == 256 bits, Redefine for WPA
431 #define MAX_NUM_OF_CHANNELS             MAX_NUM_OF_CHS      // 14 channels @2.4G +  12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL termination
432 #define MAX_NUM_OF_11JCHANNELS             20      // 14 channels @2.4G +  12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL termination
433 #define MAX_LEN_OF_SSID                 32
434 #define CIPHER_TEXT_LEN                 128
435 #define HASH_TABLE_SIZE                 256
436 #define MAX_VIE_LEN                     1024   // New for WPA cipher suite variable IE sizes.
437 #define MAX_SUPPORT_MCS             32
438 #define MAX_NUM_OF_BBP_LATCH             140
439 //============================================================
440 // ASIC WCID Table definition.
441 //============================================================
442 #define BSSID_WCID              1       // in infra mode, always put bssid with this WCID
443 #define MCAST_WCID      0x0
444 #define BSS0Mcast_WCID  0x0
445 #define BSS1Mcast_WCID  0xf8
446 #define BSS2Mcast_WCID  0xf9
447 #define BSS3Mcast_WCID  0xfa
448 #define BSS4Mcast_WCID  0xfb
449 #define BSS5Mcast_WCID  0xfc
450 #define BSS6Mcast_WCID  0xfd
451 #define BSS7Mcast_WCID  0xfe
452 #define RESERVED_WCID           0xff
453
454 #define MAX_NUM_OF_ACL_LIST                             MAX_NUMBER_OF_ACL
455
456 #define MAX_LEN_OF_MAC_TABLE            MAX_NUMBER_OF_MAC // if MAX_MBSSID_NUM is 8, this value can't be larger than 211
457
458 #if MAX_LEN_OF_MAC_TABLE>MAX_AVAILABLE_CLIENT_WCID
459 #error MAX_LEN_OF_MAC_TABLE can not be larger than MAX_AVAILABLE_CLIENT_WCID!!!!
460 #endif
461
462 #define MAX_NUM_OF_WDS_LINK_PERBSSID                3
463 #define MAX_NUM_OF_WDS_LINK                 (MAX_NUM_OF_WDS_LINK_PERBSSID*MAX_MBSSID_NUM)
464 #define MAX_NUM_OF_EVENT                MAX_NUMBER_OF_EVENT
465 #define WDS_LINK_START_WCID                             (MAX_LEN_OF_MAC_TABLE-1)
466
467 #define NUM_OF_TID                      8
468 #define MAX_AID_BA                    4
469 #define MAX_LEN_OF_BA_REC_TABLE          ((NUM_OF_TID * MAX_LEN_OF_MAC_TABLE)/2)//   (NUM_OF_TID*MAX_AID_BA + 32)        //Block ACK recipient
470 #define MAX_LEN_OF_BA_ORI_TABLE          ((NUM_OF_TID * MAX_LEN_OF_MAC_TABLE)/2)//   (NUM_OF_TID*MAX_AID_BA + 32)   // Block ACK originator
471 #define MAX_LEN_OF_BSS_TABLE             64
472 #define MAX_REORDERING_MPDU_NUM                  512
473
474 // key related definitions
475 #define SHARE_KEY_NUM                   4
476 #define MAX_LEN_OF_SHARE_KEY            16    // byte count
477 #define MAX_LEN_OF_PEER_KEY             16    // byte count
478 #define PAIRWISE_KEY_NUM                64    // in MAC ASIC pairwise key table
479 #define GROUP_KEY_NUM                   4
480 #define PMK_LEN                         32
481 #define WDS_PAIRWISE_KEY_OFFSET         60    // WDS links uses pairwise key#60 ~ 63 in ASIC pairwise key table
482 #define PMKID_NO                        4     // Number of PMKID saved supported
483 #define MAX_LEN_OF_MLME_BUFFER          2048
484
485 // power status related definitions
486 #define PWR_ACTIVE                      0
487 #define PWR_SAVE                        1
488 #define PWR_MMPS                        2                       //MIMO power save
489 //#define PWR_UNKNOWN                   2
490
491 // Auth and Assoc mode related definitions
492 #define AUTH_MODE_OPEN                  0x00
493 #define AUTH_MODE_KEY                   0x01
494 //#define AUTH_MODE_AUTO_SWITCH         0x03
495 //#define AUTH_MODE_DEAUTH              0x04
496 //#define AUTH_MODE_UPLAYER             0x05 // reserved for 802.11i use
497
498 // BSS Type definitions
499 #define BSS_ADHOC                       0  // = Ndis802_11IBSS
500 #define BSS_INFRA                       1  // = Ndis802_11Infrastructure
501 #define BSS_ANY                         2  // = Ndis802_11AutoUnknown
502 #define BSS_MONITOR                                 3  // = Ndis802_11Monitor
503
504
505 // Reason code definitions
506 #define REASON_RESERVED                 0
507 #define REASON_UNSPECIFY                1
508 #define REASON_NO_LONGER_VALID          2
509 #define REASON_DEAUTH_STA_LEAVING       3
510 #define REASON_DISASSOC_INACTIVE        4
511 #define REASON_DISASSPC_AP_UNABLE       5
512 #define REASON_CLS2ERR                  6
513 #define REASON_CLS3ERR                  7
514 #define REASON_DISASSOC_STA_LEAVING     8
515 #define REASON_STA_REQ_ASSOC_NOT_AUTH   9
516 #define REASON_INVALID_IE               13
517 #define REASON_MIC_FAILURE              14
518 #define REASON_4_WAY_TIMEOUT            15
519 #define REASON_GROUP_KEY_HS_TIMEOUT     16
520 #define REASON_IE_DIFFERENT             17
521 #define REASON_MCIPHER_NOT_VALID        18
522 #define REASON_UCIPHER_NOT_VALID        19
523 #define REASON_AKMP_NOT_VALID           20
524 #define REASON_UNSUPPORT_RSNE_VER       21
525 #define REASON_INVALID_RSNE_CAP         22
526 #define REASON_8021X_AUTH_FAIL          23
527 #define REASON_CIPHER_SUITE_REJECTED    24
528 #define REASON_DECLINED                 37
529
530 #define REASON_QOS_UNSPECIFY              32
531 #define REASON_QOS_LACK_BANDWIDTH         33
532 #define REASON_POOR_CHANNEL_CONDITION     34
533 #define REASON_QOS_OUTSIDE_TXOP_LIMITION  35
534 #define REASON_QOS_QSTA_LEAVING_QBSS      36
535 #define REASON_QOS_UNWANTED_MECHANISM     37
536 #define REASON_QOS_MECH_SETUP_REQUIRED    38
537 #define REASON_QOS_REQUEST_TIMEOUT        39
538 #define REASON_QOS_CIPHER_NOT_SUPPORT     45
539
540 // Status code definitions
541 #define MLME_SUCCESS                    0
542 #define MLME_UNSPECIFY_FAIL             1
543 #define MLME_CANNOT_SUPPORT_CAP         10
544 #define MLME_REASSOC_DENY_ASSOC_EXIST   11
545 #define MLME_ASSOC_DENY_OUT_SCOPE       12
546 #define MLME_ALG_NOT_SUPPORT            13
547 #define MLME_SEQ_NR_OUT_OF_SEQUENCE     14
548 #define MLME_REJ_CHALLENGE_FAILURE      15
549 #define MLME_REJ_TIMEOUT                  16
550 #define MLME_ASSOC_REJ_UNABLE_HANDLE_STA  17
551 #define MLME_ASSOC_REJ_DATA_RATE          18
552
553 #define MLME_ASSOC_REJ_NO_EXT_RATE        22
554 #define MLME_ASSOC_REJ_NO_EXT_RATE_PBCC   23
555 #define MLME_ASSOC_REJ_NO_CCK_OFDM        24
556
557 #define MLME_QOS_UNSPECIFY                32
558 #define MLME_REQUEST_DECLINED             37
559 #define MLME_REQUEST_WITH_INVALID_PARAM   38
560 #define MLME_INVALID_GROUP_CIPHER         41
561 #define MLME_INVALID_PAIRWISE_CIPHER      42
562 #define MLME_INVALID_AKMP                         43
563 #define MLME_DLS_NOT_ALLOW_IN_QBSS        48
564 #define MLME_DEST_STA_NOT_IN_QBSS         49
565 #define MLME_DEST_STA_IS_NOT_A_QSTA       50
566
567 #define MLME_INVALID_FORMAT             0x51
568 #define MLME_FAIL_NO_RESOURCE           0x52
569 #define MLME_STATE_MACHINE_REJECT       0x53
570 #define MLME_MAC_TABLE_FAIL             0x54
571
572 // IE code
573 #define IE_SSID                         0
574 #define IE_SUPP_RATES                   1
575 #define IE_FH_PARM                      2
576 #define IE_DS_PARM                      3
577 #define IE_CF_PARM                      4
578 #define IE_TIM                          5
579 #define IE_IBSS_PARM                    6
580 #define IE_COUNTRY                      7     // 802.11d
581 #define IE_802_11D_REQUEST              10    // 802.11d
582 #define IE_QBSS_LOAD                    11    // 802.11e d9
583 #define IE_EDCA_PARAMETER               12    // 802.11e d9
584 #define IE_TSPEC                        13    // 802.11e d9
585 #define IE_TCLAS                        14    // 802.11e d9
586 #define IE_SCHEDULE                     15    // 802.11e d9
587 #define IE_CHALLENGE_TEXT               16
588 #define IE_POWER_CONSTRAINT             32    // 802.11h d3.3
589 #define IE_POWER_CAPABILITY             33    // 802.11h d3.3
590 #define IE_TPC_REQUEST                  34    // 802.11h d3.3
591 #define IE_TPC_REPORT                   35    // 802.11h d3.3
592 #define IE_SUPP_CHANNELS                36    // 802.11h d3.3
593 #define IE_CHANNEL_SWITCH_ANNOUNCEMENT  37    // 802.11h d3.3
594 #define IE_MEASUREMENT_REQUEST          38    // 802.11h d3.3
595 #define IE_MEASUREMENT_REPORT           39    // 802.11h d3.3
596 #define IE_QUIET                        40    // 802.11h d3.3
597 #define IE_IBSS_DFS                     41    // 802.11h d3.3
598 #define IE_ERP                          42    // 802.11g
599 #define IE_TS_DELAY                     43    // 802.11e d9
600 #define IE_TCLAS_PROCESSING             44    // 802.11e d9
601 #define IE_QOS_CAPABILITY               46    // 802.11e d6
602 #define IE_HT_CAP                       45    // 802.11n d1. HT CAPABILITY. ELEMENT ID TBD
603 #define IE_AP_CHANNEL_REPORT                    51    // 802.11k d6
604 #define IE_HT_CAP2                         52    // 802.11n d1. HT CAPABILITY. ELEMENT ID TBD
605 #define IE_RSN                          48    // 802.11i d3.0
606 #define IE_WPA2                         48    // WPA2
607 #define IE_EXT_SUPP_RATES               50    // 802.11g
608 #define IE_SUPP_REG_CLASS               59    // 802.11y. Supported regulatory classes.
609 #define IE_EXT_CHANNEL_SWITCH_ANNOUNCEMENT      60      // 802.11n
610 #define IE_ADD_HT                         61    // 802.11n d1. ADDITIONAL HT CAPABILITY. ELEMENT ID TBD
611 #define IE_ADD_HT2                        53    // 802.11n d1. ADDITIONAL HT CAPABILITY. ELEMENT ID TBD
612
613
614 // For 802.11n D3.03
615 //#define IE_NEW_EXT_CHA_OFFSET             62    // 802.11n d1. New extension channel offset elemet
616 #define IE_SECONDARY_CH_OFFSET          62      // 802.11n D3.03        Secondary Channel Offset element
617 #define IE_WAPI                                                 68              // WAPI information element
618 #define IE_2040_BSS_COEXIST               72    // 802.11n D3.0.3
619 #define IE_2040_BSS_INTOLERANT_REPORT     73    // 802.11n D3.03
620 #define IE_OVERLAPBSS_SCAN_PARM           74    // 802.11n D3.03
621 #define IE_EXT_CAPABILITY                127   // 802.11n D3.03
622
623
624 #define IE_WPA                          221   // WPA
625 #define IE_VENDOR_SPECIFIC              221   // Wifi WMM (WME)
626
627 #define OUI_BROADCOM_HT              51   //
628 #define OUI_BROADCOM_HTADD              52   //
629 #define OUI_PREN_HT_CAP              51   //
630 #define OUI_PREN_ADD_HT              52   //
631
632 // CCX information
633 #define IE_AIRONET_CKIP                 133   // CCX1.0 ID 85H for CKIP
634 #define IE_AP_TX_POWER                  150   // CCX 2.0 for AP transmit power
635 #define IE_MEASUREMENT_CAPABILITY       221   // CCX 2.0
636 #define IE_CCX_V2                       221
637 #define IE_AIRONET_IPADDRESS            149   // CCX ID 95H for IP Address
638 #define IE_AIRONET_CCKMREASSOC          156   // CCX ID 9CH for CCKM Reassociation Request element
639 #define CKIP_NEGOTIATION_LENGTH         30
640 #define AIRONET_IPADDRESS_LENGTH        10
641 #define AIRONET_CCKMREASSOC_LENGTH      24
642
643 // ========================================================
644 // MLME state machine definition
645 // ========================================================
646
647 // STA MLME state mahcines
648 #define ASSOC_STATE_MACHINE             1
649 #define AUTH_STATE_MACHINE              2
650 #define AUTH_RSP_STATE_MACHINE          3
651 #define SYNC_STATE_MACHINE              4
652 #define MLME_CNTL_STATE_MACHINE         5
653 #define WPA_PSK_STATE_MACHINE           6
654 //#define LEAP_STATE_MACHINE              7
655 #define AIRONET_STATE_MACHINE           8
656 #define ACTION_STATE_MACHINE           9
657
658 // AP MLME state machines
659 #define AP_ASSOC_STATE_MACHINE          11
660 #define AP_AUTH_STATE_MACHINE           12
661 #define AP_SYNC_STATE_MACHINE           14
662 #define AP_CNTL_STATE_MACHINE           15
663 #define WSC_STATE_MACHINE            17
664 #define WSC_UPNP_STATE_MACHINE              18
665
666
667 #define WPA_STATE_MACHINE                       23
668
669
670 #ifdef QOS_DLS_SUPPORT
671 #define DLS_STATE_MACHINE               26
672 #endif // QOS_DLS_SUPPORT //
673
674 //
675 // STA's CONTROL/CONNECT state machine: states, events, total function #
676 //
677 #define CNTL_IDLE                       0
678 #define CNTL_WAIT_DISASSOC              1
679 #define CNTL_WAIT_JOIN                  2
680 #define CNTL_WAIT_REASSOC               3
681 #define CNTL_WAIT_START                 4
682 #define CNTL_WAIT_AUTH                  5
683 #define CNTL_WAIT_ASSOC                 6
684 #define CNTL_WAIT_AUTH2                 7
685 #define CNTL_WAIT_OID_LIST_SCAN         8
686 #define CNTL_WAIT_OID_DISASSOC          9
687
688 #define MT2_ASSOC_CONF                  34
689 #define MT2_AUTH_CONF                   35
690 #define MT2_DEAUTH_CONF                 36
691 #define MT2_DISASSOC_CONF               37
692 #define MT2_REASSOC_CONF                38
693 #define MT2_PWR_MGMT_CONF               39
694 #define MT2_JOIN_CONF                   40
695 #define MT2_SCAN_CONF                   41
696 #define MT2_START_CONF                  42
697 #define MT2_GET_CONF                    43
698 #define MT2_SET_CONF                    44
699 #define MT2_RESET_CONF                  45
700 #define MT2_FT_OTD_CONF                                 46
701 #define MT2_MLME_ROAMING_REQ            52
702
703 #define CNTL_FUNC_SIZE                  1
704
705 //
706 // STA's ASSOC state machine: states, events, total function #
707 //
708 #define ASSOC_IDLE                      0
709 #define ASSOC_WAIT_RSP                  1
710 #define REASSOC_WAIT_RSP                2
711 #define DISASSOC_WAIT_RSP               3
712 #define MAX_ASSOC_STATE                 4
713
714 #define ASSOC_MACHINE_BASE              0
715 #define MT2_MLME_ASSOC_REQ              0
716 #define MT2_MLME_REASSOC_REQ            1
717 #define MT2_MLME_DISASSOC_REQ           2
718 #define MT2_PEER_DISASSOC_REQ           3
719 #define MT2_PEER_ASSOC_REQ              4
720 #define MT2_PEER_ASSOC_RSP              5
721 #define MT2_PEER_REASSOC_REQ            6
722 #define MT2_PEER_REASSOC_RSP            7
723 #define MT2_DISASSOC_TIMEOUT            8
724 #define MT2_ASSOC_TIMEOUT               9
725 #define MT2_REASSOC_TIMEOUT             10
726 #define MAX_ASSOC_MSG                   11
727
728 #define ASSOC_FUNC_SIZE                 (MAX_ASSOC_STATE * MAX_ASSOC_MSG)
729
730 //
731 // ACT state machine: states, events, total function #
732 //
733 #define ACT_IDLE                      0
734 #define MAX_ACT_STATE                 1
735
736 #define ACT_MACHINE_BASE              0
737
738 //Those PEER_xx_CATE number is based on real Categary value in IEEE spec. Please don'es modify it by your self.
739 //Category
740 #define MT2_PEER_SPECTRUM_CATE              0
741 #define MT2_PEER_QOS_CATE              1
742 #define MT2_PEER_DLS_CATE             2
743 #define MT2_PEER_BA_CATE             3
744 #define MT2_PEER_PUBLIC_CATE             4
745 #define MT2_PEER_RM_CATE             5
746 /* "FT_CATEGORY_BSS_TRANSITION equal to 6" is defined file of "dot11r_ft.h" */
747 #define MT2_PEER_HT_CATE             7  //      7.4.7
748 #define MAX_PEER_CATE_MSG                   7
749
750
751 #define MT2_MLME_ADD_BA_CATE             8
752 #define MT2_MLME_ORI_DELBA_CATE             9
753 #define MT2_MLME_REC_DELBA_CATE             10
754 #define MT2_MLME_QOS_CATE              11
755 #define MT2_MLME_DLS_CATE             12
756 #define MT2_ACT_INVALID             13
757
758 #define MAX_ACT_MSG                   14
759
760
761 //Category field
762 #define CATEGORY_SPECTRUM               0
763 #define CATEGORY_QOS                    1
764 #define CATEGORY_DLS                    2
765 #define CATEGORY_BA                     3
766 #define CATEGORY_PUBLIC         4
767 #define CATEGORY_RM                     5
768 #define CATEGORY_HT                     7
769
770
771 // DLS Action frame definition
772 #define ACTION_DLS_REQUEST                      0
773 #define ACTION_DLS_RESPONSE                     1
774 #define ACTION_DLS_TEARDOWN                     2
775
776 //Spectrum  Action field value 802.11h 7.4.1
777 #define SPEC_MRQ        0       // Request
778 #define SPEC_MRP        1       //Report
779 #define SPEC_TPCRQ      2
780 #define SPEC_TPCRP      3
781 #define SPEC_CHANNEL_SWITCH     4
782
783
784 //BA  Action field value
785 #define ADDBA_REQ       0
786 #define ADDBA_RESP      1
787 #define DELBA   2
788
789 //Public's  Action field value in Public Category.  Some in 802.11y and some in 11n
790 #define ACTION_BSS_2040_COEXIST                         0       // 11n
791 #define ACTION_DSE_ENABLEMENT                                   1       // 11y D9.0
792 #define ACTION_DSE_DEENABLEMENT                         2       // 11y D9.0
793 #define ACTION_DSE_REG_LOCATION_ANNOUNCE        3       // 11y D9.0
794 #define ACTION_EXT_CH_SWITCH_ANNOUNCE           4       // 11y D9.0
795 #define ACTION_DSE_MEASUREMENT_REQ                      5       // 11y D9.0
796 #define ACTION_DSE_MEASUREMENT_REPORT           6       // 11y D9.0
797 #define ACTION_MEASUREMENT_PILOT_ACTION         7       // 11y D9.0
798 #define ACTION_DSE_POWER_CONSTRAINT                     8       // 11y D9.0
799
800
801 //HT  Action field value
802 #define NOTIFY_BW_ACTION                                0
803 #define SMPS_ACTION                                             1
804 #define PSMP_ACTION                                     2
805 #define SETPCO_ACTION                                   3
806 #define MIMO_CHA_MEASURE_ACTION                 4
807 #define MIMO_N_BEACONFORM                               5
808 #define MIMO_BEACONFORM                                 6
809 #define ANTENNA_SELECT                                  7
810 #define HT_INFO_EXCHANGE                                8
811
812 #define ACT_FUNC_SIZE                 (MAX_ACT_STATE * MAX_ACT_MSG)
813 //
814 // STA's AUTHENTICATION state machine: states, evvents, total function #
815 //
816 #define AUTH_REQ_IDLE                   0
817 #define AUTH_WAIT_SEQ2                  1
818 #define AUTH_WAIT_SEQ4                  2
819 #define MAX_AUTH_STATE                  3
820
821 #define AUTH_MACHINE_BASE               0
822 #define MT2_MLME_AUTH_REQ               0
823 #define MT2_PEER_AUTH_EVEN              1
824 #define MT2_AUTH_TIMEOUT                2
825 #define MAX_AUTH_MSG                    3
826
827 #define AUTH_FUNC_SIZE                  (MAX_AUTH_STATE * MAX_AUTH_MSG)
828
829 //
830 // STA's AUTH_RSP state machine: states, events, total function #
831 //
832 #define AUTH_RSP_IDLE                   0
833 #define AUTH_RSP_WAIT_CHAL              1
834 #define MAX_AUTH_RSP_STATE              2
835
836 #define AUTH_RSP_MACHINE_BASE           0
837 #define MT2_AUTH_CHALLENGE_TIMEOUT      0
838 #define MT2_PEER_AUTH_ODD               1
839 #define MT2_PEER_DEAUTH                 2
840 #define MAX_AUTH_RSP_MSG                3
841
842 #define AUTH_RSP_FUNC_SIZE              (MAX_AUTH_RSP_STATE * MAX_AUTH_RSP_MSG)
843
844 //
845 // STA's SYNC state machine: states, events, total function #
846 //
847 #define SYNC_IDLE                       0  // merge NO_BSS,IBSS_IDLE,IBSS_ACTIVE and BSS in to 1 state
848 #define JOIN_WAIT_BEACON                1
849 #define SCAN_LISTEN                     2
850 #define MAX_SYNC_STATE                  3
851
852 #define SYNC_MACHINE_BASE               0
853 #define MT2_MLME_SCAN_REQ               0
854 #define MT2_MLME_JOIN_REQ               1
855 #define MT2_MLME_START_REQ              2
856 #define MT2_PEER_BEACON                 3
857 #define MT2_PEER_PROBE_RSP              4
858 #define MT2_PEER_ATIM                   5
859 #define MT2_SCAN_TIMEOUT                6
860 #define MT2_BEACON_TIMEOUT              7
861 #define MT2_ATIM_TIMEOUT                8
862 #define MT2_PEER_PROBE_REQ              9
863 #define MAX_SYNC_MSG                    10
864
865 #define SYNC_FUNC_SIZE                  (MAX_SYNC_STATE * MAX_SYNC_MSG)
866
867 //Messages for the DLS state machine
868 #define DLS_IDLE                                                0
869 #define MAX_DLS_STATE                                   1
870
871 #define DLS_MACHINE_BASE                                0
872 #define MT2_MLME_DLS_REQ                            0
873 #define MT2_PEER_DLS_REQ                            1
874 #define MT2_PEER_DLS_RSP                            2
875 #define MT2_MLME_DLS_TEAR_DOWN              3
876 #define MT2_PEER_DLS_TEAR_DOWN              4
877 #define MAX_DLS_MSG                                     5
878
879 #define DLS_FUNC_SIZE                                   (MAX_DLS_STATE * MAX_DLS_MSG)
880
881 //
882 // WSC State machine: states, events, total function #
883 //
884
885 //
886 // AP's CONTROL/CONNECT state machine: states, events, total function #
887 //
888 #define AP_CNTL_FUNC_SIZE               1
889
890 //
891 // AP's ASSOC state machine: states, events, total function #
892 //
893 #define AP_ASSOC_IDLE                   0
894 #define AP_MAX_ASSOC_STATE              1
895
896 #define AP_ASSOC_MACHINE_BASE           0
897 #define APMT2_MLME_DISASSOC_REQ         0
898 #define APMT2_PEER_DISASSOC_REQ         1
899 #define APMT2_PEER_ASSOC_REQ            2
900 #define APMT2_PEER_REASSOC_REQ          3
901 #define APMT2_CLS3ERR                   4
902 #define AP_MAX_ASSOC_MSG                5
903
904 #define AP_ASSOC_FUNC_SIZE              (AP_MAX_ASSOC_STATE * AP_MAX_ASSOC_MSG)
905
906 //
907 // AP's AUTHENTICATION state machine: states, events, total function #
908 //
909 #define AP_AUTH_REQ_IDLE                0
910 #define AP_MAX_AUTH_STATE               1
911
912 #define AP_AUTH_MACHINE_BASE            0
913 #define APMT2_MLME_DEAUTH_REQ           0
914 #define APMT2_CLS2ERR                   1
915 #define APMT2_PEER_DEAUTH                               2
916 #define APMT2_PEER_AUTH_REQ                             3
917 #define APMT2_PEER_AUTH_CONFIRM                 4
918 #define AP_MAX_AUTH_MSG                 5
919
920 #define AP_AUTH_FUNC_SIZE               (AP_MAX_AUTH_STATE * AP_MAX_AUTH_MSG)
921
922 //
923 // AP's SYNC state machine: states, events, total function #
924 //
925 #define AP_SYNC_IDLE                    0
926 #define AP_SCAN_LISTEN                                  1
927 #define AP_MAX_SYNC_STATE               2
928
929 #define AP_SYNC_MACHINE_BASE            0
930 #define APMT2_PEER_PROBE_REQ            0
931 #define APMT2_PEER_BEACON               1
932 #define APMT2_MLME_SCAN_REQ                             2
933 #define APMT2_PEER_PROBE_RSP                    3
934 #define APMT2_SCAN_TIMEOUT                              4
935 #define APMT2_MLME_SCAN_CNCL                    5
936 #define AP_MAX_SYNC_MSG                 6
937
938 #define AP_SYNC_FUNC_SIZE               (AP_MAX_SYNC_STATE * AP_MAX_SYNC_MSG)
939
940 //
941 // Common WPA state machine: states, events, total function #
942 //
943 #define WPA_PTK                      0
944 #define MAX_WPA_PTK_STATE            1
945
946 #define WPA_MACHINE_BASE             0
947 #define MT2_EAPPacket                0
948 #define MT2_EAPOLStart               1
949 #define MT2_EAPOLLogoff              2
950 #define MT2_EAPOLKey                 3
951 #define MT2_EAPOLASFAlert            4
952 #define MAX_WPA_MSG                  5
953
954 #define WPA_FUNC_SIZE                (MAX_WPA_PTK_STATE * MAX_WPA_MSG)
955
956 #ifdef APCLI_SUPPORT
957 //ApCli authentication state machine
958 #define APCLI_AUTH_REQ_IDLE                0
959 #define APCLI_AUTH_WAIT_SEQ2               1
960 #define APCLI_AUTH_WAIT_SEQ4               2
961 #define APCLI_MAX_AUTH_STATE               3
962
963 #define APCLI_AUTH_MACHINE_BASE            0
964 #define APCLI_MT2_MLME_AUTH_REQ            0
965 #define APCLI_MT2_MLME_DEAUTH_REQ          1
966 #define APCLI_MT2_PEER_AUTH_EVEN           2
967 #define APCLI_MT2_PEER_DEAUTH              3
968 #define APCLI_MT2_AUTH_TIMEOUT             4
969 #define APCLI_MAX_AUTH_MSG                 5
970
971 #define APCLI_AUTH_FUNC_SIZE               (APCLI_MAX_AUTH_STATE * APCLI_MAX_AUTH_MSG)
972
973 //ApCli association state machine
974 #define APCLI_ASSOC_IDLE                   0
975 #define APCLI_ASSOC_WAIT_RSP               1
976 #define APCLI_MAX_ASSOC_STATE              2
977
978 #define APCLI_ASSOC_MACHINE_BASE           0
979 #define APCLI_MT2_MLME_ASSOC_REQ           0
980 #define APCLI_MT2_MLME_DISASSOC_REQ        1
981 #define APCLI_MT2_PEER_DISASSOC_REQ        2
982 #define APCLI_MT2_PEER_ASSOC_RSP           3
983 #define APCLI_MT2_ASSOC_TIMEOUT            4
984 #define APCLI_MAX_ASSOC_MSG                5
985
986 #define APCLI_ASSOC_FUNC_SIZE              (APCLI_MAX_ASSOC_STATE * APCLI_MAX_ASSOC_MSG)
987
988 //ApCli sync state machine
989 #define APCLI_SYNC_IDLE                   0  // merge NO_BSS,IBSS_IDLE,IBSS_ACTIVE and BSS in to 1 state
990 #define APCLI_JOIN_WAIT_PROBE_RSP         1
991 #define APCLI_MAX_SYNC_STATE              2
992
993 #define APCLI_SYNC_MACHINE_BASE           0
994 #define APCLI_MT2_MLME_PROBE_REQ          0
995 #define APCLI_MT2_PEER_PROBE_RSP          1
996 #define APCLI_MT2_PROBE_TIMEOUT           2
997 #define APCLI_MAX_SYNC_MSG                3
998
999 #define APCLI_SYNC_FUNC_SIZE              (APCLI_MAX_SYNC_STATE * APCLI_MAX_SYNC_MSG)
1000
1001 //ApCli ctrl state machine
1002 #define APCLI_CTRL_DISCONNECTED           0  // merge NO_BSS,IBSS_IDLE,IBSS_ACTIVE and BSS in to 1 state
1003 #define APCLI_CTRL_PROBE                  1
1004 #define APCLI_CTRL_AUTH                   2
1005 #define APCLI_CTRL_AUTH_2                 3
1006 #define APCLI_CTRL_ASSOC                  4
1007 #define APCLI_CTRL_DEASSOC                5
1008 #define APCLI_CTRL_CONNECTED              6
1009 #define APCLI_MAX_CTRL_STATE              7
1010
1011 #define APCLI_CTRL_MACHINE_BASE           0
1012 #define APCLI_CTRL_JOIN_REQ               0
1013 #define APCLI_CTRL_PROBE_RSP              1
1014 #define APCLI_CTRL_AUTH_RSP               2
1015 #define APCLI_CTRL_DISCONNECT_REQ         3
1016 #define APCLI_CTRL_PEER_DISCONNECT_REQ    4
1017 #define APCLI_CTRL_ASSOC_RSP              5
1018 #define APCLI_CTRL_DEASSOC_RSP            6
1019 #define APCLI_CTRL_JOIN_REQ_TIMEOUT       7
1020 #define APCLI_CTRL_AUTH_REQ_TIMEOUT       8
1021 #define APCLI_CTRL_ASSOC_REQ_TIMEOUT      9
1022 #define APCLI_MAX_CTRL_MSG                10
1023
1024 #define APCLI_CTRL_FUNC_SIZE              (APCLI_MAX_CTRL_STATE * APCLI_MAX_CTRL_MSG)
1025
1026
1027 #endif // APCLI_SUPPORT //
1028
1029
1030 // =============================================================================
1031
1032 // value domain of 802.11 header FC.Tyte, which is b3..b2 of the 1st-byte of MAC header
1033 #define BTYPE_MGMT                  0
1034 #define BTYPE_CNTL                  1
1035 #define BTYPE_DATA                  2
1036
1037 // value domain of 802.11 MGMT frame's FC.subtype, which is b7..4 of the 1st-byte of MAC header
1038 #define SUBTYPE_ASSOC_REQ           0
1039 #define SUBTYPE_ASSOC_RSP           1
1040 #define SUBTYPE_REASSOC_REQ         2
1041 #define SUBTYPE_REASSOC_RSP         3
1042 #define SUBTYPE_PROBE_REQ           4
1043 #define SUBTYPE_PROBE_RSP           5
1044 #define SUBTYPE_BEACON              8
1045 #define SUBTYPE_ATIM                9
1046 #define SUBTYPE_DISASSOC            10
1047 #define SUBTYPE_AUTH                11
1048 #define SUBTYPE_DEAUTH              12
1049 #define SUBTYPE_ACTION              13
1050 #define SUBTYPE_ACTION_NO_ACK              14
1051
1052 // value domain of 802.11 CNTL frame's FC.subtype, which is b7..4 of the 1st-byte of MAC header
1053 #define SUBTYPE_WRAPPER         7
1054 #define SUBTYPE_BLOCK_ACK_REQ       8
1055 #define SUBTYPE_BLOCK_ACK           9
1056 #define SUBTYPE_PS_POLL             10
1057 #define SUBTYPE_RTS                 11
1058 #define SUBTYPE_CTS                 12
1059 #define SUBTYPE_ACK                 13
1060 #define SUBTYPE_CFEND               14
1061 #define SUBTYPE_CFEND_CFACK         15
1062
1063 // value domain of 802.11 DATA frame's FC.subtype, which is b7..4 of the 1st-byte of MAC header
1064 #define SUBTYPE_DATA                0
1065 #define SUBTYPE_DATA_CFACK          1
1066 #define SUBTYPE_DATA_CFPOLL         2
1067 #define SUBTYPE_DATA_CFACK_CFPOLL   3
1068 #define SUBTYPE_NULL_FUNC           4
1069 #define SUBTYPE_CFACK               5
1070 #define SUBTYPE_CFPOLL              6
1071 #define SUBTYPE_CFACK_CFPOLL        7
1072 #define SUBTYPE_QDATA               8
1073 #define SUBTYPE_QDATA_CFACK         9
1074 #define SUBTYPE_QDATA_CFPOLL        10
1075 #define SUBTYPE_QDATA_CFACK_CFPOLL  11
1076 #define SUBTYPE_QOS_NULL            12
1077 #define SUBTYPE_QOS_CFACK           13
1078 #define SUBTYPE_QOS_CFPOLL          14
1079 #define SUBTYPE_QOS_CFACK_CFPOLL    15
1080
1081 // ACK policy of QOS Control field bit 6:5
1082 #define NORMAL_ACK                  0x00  // b6:5 = 00
1083 #define NO_ACK                      0x20  // b6:5 = 01
1084 #define NO_EXPLICIT_ACK             0x40  // b6:5 = 10
1085 #define BLOCK_ACK                   0x60  // b6:5 = 11
1086
1087 //
1088 // rtmp_data.c use these definition
1089 //
1090 #define LENGTH_802_11               24
1091 #define LENGTH_802_11_AND_H         30
1092 #define LENGTH_802_11_CRC_H         34
1093 #define LENGTH_802_11_CRC           28
1094 #define LENGTH_802_11_WITH_ADDR4    30
1095 #define LENGTH_802_3                14
1096 #define LENGTH_802_3_TYPE           2
1097 #define LENGTH_802_1_H              8
1098 #define LENGTH_EAPOL_H              4
1099 #define LENGTH_WMMQOS_H                         2
1100 #define LENGTH_CRC                  4
1101 #define MAX_SEQ_NUMBER              0x0fff
1102 #define LENGTH_802_3_NO_TYPE            12
1103 #define LENGTH_802_1Q                           4 /* VLAN related */
1104
1105 // STA_CSR4.field.TxResult
1106 #define TX_RESULT_SUCCESS           0
1107 #define TX_RESULT_ZERO_LENGTH       1
1108 #define TX_RESULT_UNDER_RUN         2
1109 #define TX_RESULT_OHY_ERROR         4
1110 #define TX_RESULT_RETRY_FAIL        6
1111
1112 // All PHY rate summary in TXD
1113 // Preamble MODE in TxD
1114 #define MODE_CCK        0
1115 #define MODE_OFDM   1
1116 #ifdef DOT11_N_SUPPORT
1117 #define MODE_HTMIX      2
1118 #define MODE_HTGREENFIELD       3
1119 #endif // DOT11_N_SUPPORT //
1120 // MCS for CCK.  BW.SGI.STBC are reserved
1121 #define MCS_LONGP_RATE_1                      0  // long preamble CCK 1Mbps
1122 #define MCS_LONGP_RATE_2                      1 // long preamble CCK 1Mbps
1123 #define MCS_LONGP_RATE_5_5                    2
1124 #define MCS_LONGP_RATE_11                     3
1125 #define MCS_SHORTP_RATE_1                      4         // long preamble CCK 1Mbps. short is forbidden in 1Mbps
1126 #define MCS_SHORTP_RATE_2                      5        // short preamble CCK 2Mbps
1127 #define MCS_SHORTP_RATE_5_5                    6
1128 #define MCS_SHORTP_RATE_11                     7
1129 // To send duplicate legacy OFDM. set BW=BW_40.  SGI.STBC are reserved
1130 #define MCS_RATE_6                      0   // legacy OFDM
1131 #define MCS_RATE_9                      1   // OFDM
1132 #define MCS_RATE_12                     2   // OFDM
1133 #define MCS_RATE_18                     3   // OFDM
1134 #define MCS_RATE_24                     4  // OFDM
1135 #define MCS_RATE_36                     5   // OFDM
1136 #define MCS_RATE_48                     6  // OFDM
1137 #define MCS_RATE_54                     7 // OFDM
1138 // HT
1139 #define MCS_0           0       // 1S
1140 #define MCS_1           1
1141 #define MCS_2           2
1142 #define MCS_3           3
1143 #define MCS_4           4
1144 #define MCS_5           5
1145 #define MCS_6           6
1146 #define MCS_7           7
1147 #define MCS_8           8       // 2S
1148 #define MCS_9           9
1149 #define MCS_10          10
1150 #define MCS_11          11
1151 #define MCS_12          12
1152 #define MCS_13          13
1153 #define MCS_14          14
1154 #define MCS_15          15
1155 #define MCS_16          16      // 3*3
1156 #define MCS_17          17
1157 #define MCS_18          18
1158 #define MCS_19          19
1159 #define MCS_20          20
1160 #define MCS_21          21
1161 #define MCS_22          22
1162 #define MCS_23          23
1163 #define MCS_32          32
1164 #define MCS_AUTO                33
1165
1166 #ifdef DOT11_N_SUPPORT
1167 // OID_HTPHYMODE
1168 // MODE
1169 #define HTMODE_MM       0
1170 #define HTMODE_GF       1
1171 #endif // DOT11_N_SUPPORT //
1172
1173 // Fixed Tx MODE - HT, CCK or OFDM
1174 #define FIXED_TXMODE_HT         0
1175 #define FIXED_TXMODE_CCK        1
1176 #define FIXED_TXMODE_OFDM       2
1177 // BW
1178 #define BW_20           BAND_WIDTH_20
1179 #define BW_40           BAND_WIDTH_40
1180 #define BW_BOTH         BAND_WIDTH_BOTH
1181 #define BW_10           BAND_WIDTH_10   // 802.11j has 10MHz. This definition is for internal usage. doesn't fill in the IE or other field.
1182
1183 #ifdef DOT11_N_SUPPORT
1184 // SHORTGI
1185 #define GI_400          GAP_INTERVAL_400        // only support in HT mode
1186 #define GI_BOTH         GAP_INTERVAL_BOTH
1187 #endif // DOT11_N_SUPPORT //
1188 #define GI_800          GAP_INTERVAL_800
1189 // STBC
1190 #define STBC_NONE       0
1191 #ifdef DOT11_N_SUPPORT
1192 #define STBC_USE        1       // limited use in rt2860b phy
1193 #define RXSTBC_ONE      1       // rx support of one spatial stream
1194 #define RXSTBC_TWO      2       // rx support of 1 and 2 spatial stream
1195 #define RXSTBC_THR      3       // rx support of 1~3 spatial stream
1196 // MCS FEEDBACK
1197 #define MCSFBK_NONE     0  // not support mcs feedback /
1198 #define MCSFBK_RSV      1       // reserved
1199 #define MCSFBK_UNSOLICIT        2       // only support unsolict mcs feedback
1200 #define MCSFBK_MRQ      3       // response to both MRQ and unsolict mcs feedback
1201
1202 // MIMO power safe
1203 #define MMPS_STATIC     0
1204 #define MMPS_DYNAMIC            1
1205 #define   MMPS_RSV              2
1206 #define MMPS_ENABLE             3
1207
1208
1209 // A-MSDU size
1210 #define AMSDU_0 0
1211 #define AMSDU_1         1
1212
1213 #endif // DOT11_N_SUPPORT //
1214
1215 // MCS use 7 bits
1216 #define TXRATEMIMO              0x80
1217 #define TXRATEMCS               0x7F
1218 #define TXRATEOFDM              0x7F
1219 #define RATE_1                      0
1220 #define RATE_2                      1
1221 #define RATE_5_5                    2
1222 #define RATE_11                     3
1223 #define RATE_6                      4   // OFDM
1224 #define RATE_9                      5   // OFDM
1225 #define RATE_12                     6   // OFDM
1226 #define RATE_18                     7   // OFDM
1227 #define RATE_24                     8   // OFDM
1228 #define RATE_36                     9   // OFDM
1229 #define RATE_48                     10  // OFDM
1230 #define RATE_54                     11  // OFDM
1231 #define RATE_FIRST_OFDM_RATE        RATE_6
1232 #define RATE_LAST_OFDM_RATE             RATE_54
1233 #define RATE_6_5                    12  // HT mix
1234 #define RATE_13                     13  // HT mix
1235 #define RATE_19_5                   14  // HT mix
1236 #define RATE_26                     15  // HT mix
1237 #define RATE_39                     16  // HT mix
1238 #define RATE_52                     17  // HT mix
1239 #define RATE_58_5                   18  // HT mix
1240 #define RATE_65                     19  // HT mix
1241 #define RATE_78                     20  // HT mix
1242 #define RATE_104                    21  // HT mix
1243 #define RATE_117                    22  // HT mix
1244 #define RATE_130                    23  // HT mix
1245 //#define RATE_AUTO_SWITCH            255 // for StaCfg.FixedTxRate only
1246 #define HTRATE_0                      12
1247 #define RATE_FIRST_MM_RATE        HTRATE_0
1248 #define RATE_FIRST_HT_RATE        HTRATE_0
1249 #define RATE_LAST_HT_RATE        HTRATE_0
1250
1251 // pTxWI->txop
1252 #define IFS_HTTXOP                 0    // The txop will be handles by ASIC.
1253 #define IFS_PIFS                    1
1254 #define IFS_SIFS                    2
1255 #define IFS_BACKOFF                 3
1256
1257 // pTxD->RetryMode
1258 #define LONG_RETRY                  1
1259 #define SHORT_RETRY                 0
1260
1261 // Country Region definition
1262 #define REGION_MINIMUM_BG_BAND            0
1263 #define REGION_0_BG_BAND                  0       // 1-11
1264 #define REGION_1_BG_BAND                  1       // 1-13
1265 #define REGION_2_BG_BAND                  2       // 10-11
1266 #define REGION_3_BG_BAND                  3       // 10-13
1267 #define REGION_4_BG_BAND                  4       // 14
1268 #define REGION_5_BG_BAND                  5       // 1-14
1269 #define REGION_6_BG_BAND                  6       // 3-9
1270 #define REGION_7_BG_BAND                  7       // 5-13
1271 #define REGION_31_BG_BAND                 31       // 5-13
1272 #define REGION_MAXIMUM_BG_BAND            7
1273
1274 #define REGION_MINIMUM_A_BAND             0
1275 #define REGION_0_A_BAND                   0       // 36, 40, 44, 48, 52, 56, 60, 64, 149, 153, 157, 161, 165
1276 #define REGION_1_A_BAND                   1       // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
1277 #define REGION_2_A_BAND                   2       // 36, 40, 44, 48, 52, 56, 60, 64
1278 #define REGION_3_A_BAND                   3       // 52, 56, 60, 64, 149, 153, 157, 161
1279 #define REGION_4_A_BAND                   4       // 149, 153, 157, 161, 165
1280 #define REGION_5_A_BAND                   5       // 149, 153, 157, 161
1281 #define REGION_6_A_BAND                   6       // 36, 40, 44, 48
1282 #define REGION_7_A_BAND                   7       // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161, 165, 169, 173
1283 #define REGION_8_A_BAND                   8       // 52, 56, 60, 64
1284 #define REGION_9_A_BAND                   9       // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 132, 136, 140, 149, 153, 157, 161, 165
1285 #define REGION_10_A_BAND                  10      // 36, 40, 44, 48, 149, 153, 157, 161, 165
1286 #define REGION_11_A_BAND                  11      // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 149, 153, 157, 161
1287 #define REGION_12_A_BAND                  12       // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
1288 #define REGION_13_A_BAND                  13       // 52, 56, 60, 64, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 149, 153, 157, 161
1289 #define REGION_14_A_BAND                  14       // 36, 40, 44, 48, 52, 56, 60, 64, 100, 104, 108, 112, 116, 136, 140, 149, 153, 157, 161, 165
1290 #define REGION_15_A_BAND                  15       // 149, 153, 157, 161, 165, 169, 173
1291 #define REGION_MAXIMUM_A_BAND             15
1292
1293 // pTxD->CipherAlg
1294 #define CIPHER_NONE                 0
1295 #define CIPHER_WEP64                1
1296 #define CIPHER_WEP128               2
1297 #define CIPHER_TKIP                 3
1298 #define CIPHER_AES                  4
1299 #define CIPHER_CKIP64               5
1300 #define CIPHER_CKIP128              6
1301 #define CIPHER_TKIP_NO_MIC          7       // MIC appended by driver: not a valid value in hardware key table
1302 #define CIPHER_SMS4                                     8
1303
1304
1305 // LED Status.
1306 #define LED_LINK_DOWN               0
1307 #define LED_LINK_UP                 1
1308 #define LED_RADIO_OFF               2
1309 #define LED_RADIO_ON                3
1310 #define LED_HALT                    4
1311 #define LED_WPS                     5
1312 #define LED_ON_SITE_SURVEY          6
1313 #define LED_POWER_UP                7
1314
1315
1316 // value domain of pAd->LedCntl.LedMode and E2PROM
1317 #define LED_MODE_DEFAULT            0
1318 #define LED_MODE_TWO_LED                        1
1319 //#define LED_MODE_SIGNAL_STREGTH               8  // EEPROM define =8
1320 #define LED_MODE_SIGNAL_STREGTH         0x40 // EEPROM define = 64
1321
1322 // RC4 init value, used fro WEP & TKIP
1323 #define PPPINITFCS32                0xffffffff   /* Initial FCS value */
1324
1325 // value domain of pAd->StaCfg.PortSecured. 802.1X controlled port definition
1326 #define WPA_802_1X_PORT_SECURED     1
1327 #define WPA_802_1X_PORT_NOT_SECURED 2
1328
1329 #define PAIRWISE_KEY                1
1330 #define GROUP_KEY                   2
1331
1332 //definition of DRS
1333 #define MAX_STEP_OF_TX_RATE_SWITCH      32
1334
1335
1336 // pre-allocated free NDIS PACKET/BUFFER poll for internal usage
1337 #define MAX_NUM_OF_FREE_NDIS_PACKET 128
1338
1339 //Block ACK
1340 #define MAX_TX_REORDERBUF   64
1341 #define MAX_RX_REORDERBUF   64
1342 #define DEFAULT_TX_TIMEOUT   30
1343 #define DEFAULT_RX_TIMEOUT   30
1344
1345 // definition of Recipient or Originator
1346 #define I_RECIPIENT                  TRUE
1347 #define I_ORIGINATOR                   FALSE
1348
1349 #define DEFAULT_BBP_TX_POWER        0
1350 #define DEFAULT_RF_TX_POWER         5
1351
1352 #define MAX_INI_BUFFER_SIZE             4096
1353 #define MAX_PARAM_BUFFER_SIZE           (2048) // enough for ACL (18*64)
1354                                                                                         //18 : the length of Mac address acceptable format "01:02:03:04:05:06;")
1355                                                                                         //64 : MAX_NUM_OF_ACL_LIST
1356 // definition of pAd->OpMode
1357 #define OPMODE_STA                  0
1358 #define OPMODE_AP                   1
1359 //#define OPMODE_L3_BRG               2       // as AP and STA at the same time
1360
1361 #ifdef RT_BIG_ENDIAN
1362 #define DIR_READ                    0
1363 #define DIR_WRITE                   1
1364 #define TYPE_TXD                    0
1365 #define TYPE_RXD                    1
1366 #define TYPE_TXINFO                                     0
1367 #define TYPE_RXINFO                                     1
1368 #define TYPE_TXWI                                       0
1369 #define TYPE_RXWI                                       1
1370 #endif
1371
1372 // ========================= AP rtmp_def.h ===========================
1373 // value domain for pAd->EventTab.Log[].Event
1374 #define EVENT_RESET_ACCESS_POINT    0 // Log = "hh:mm:ss   Restart Access Point"
1375 #define EVENT_ASSOCIATED            1 // Log = "hh:mm:ss   STA 00:01:02:03:04:05 associated"
1376 #define EVENT_DISASSOCIATED         2 // Log = "hh:mm:ss   STA 00:01:02:03:04:05 left this BSS"
1377 #define EVENT_AGED_OUT              3 // Log = "hh:mm:ss   STA 00:01:02:03:04:05 was aged-out and removed from this BSS"
1378 #define EVENT_COUNTER_M             4
1379 #define EVENT_INVALID_PSK           5
1380 #define EVENT_MAX_EVENT_TYPE        6
1381 // ==== end of AP rtmp_def.h ============
1382
1383 // definition RSSI Number
1384 #define RSSI_0                                  0
1385 #define RSSI_1                                  1
1386 #define RSSI_2                                  2
1387
1388 // definition of radar detection
1389 #define RD_NORMAL_MODE                          0       // Not found radar signal
1390 #define RD_SWITCHING_MODE                       1       // Found radar signal, and doing channel switch
1391 #define RD_SILENCE_MODE                         2       // After channel switch, need to be silence a while to ensure radar not found
1392
1393 //Driver defined cid for mapping status and command.
1394 #define  SLEEPCID       0x11
1395 #define  WAKECID        0x22
1396 #define  QUERYPOWERCID  0x33
1397 #define  OWNERMCU       0x1
1398 #define  OWNERCPU       0x0
1399
1400 // MBSSID definition
1401 #define ENTRY_NOT_FOUND             0xFF
1402
1403
1404 /* After Linux 2.6.9,
1405  * VLAN module use Private (from user) interface flags (netdevice->priv_flags).
1406  * #define IFF_802_1Q_VLAN 0x1         --    802.1Q VLAN device.  in if.h
1407  * ref to ip_sabotage_out() [ out->priv_flags & IFF_802_1Q_VLAN ] in br_netfilter.c
1408  *
1409  * For this reason, we MUST use EVEN value in priv_flags
1410  */
1411 #define INT_MAIN                        0x0100
1412 #define INT_MBSSID                      0x0200
1413 #define INT_WDS                         0x0300
1414 #define INT_APCLI                       0x0400
1415 #define INT_MESH                        0x0500
1416
1417 #define INF_MAIN_DEV_NAME               "wlan"
1418 #define INF_MBSSID_DEV_NAME             "wlan"
1419 #define INF_WDS_DEV_NAME                "wds"
1420 #define INF_APCLI_DEV_NAME              "apcli"
1421 #define INF_MESH_DEV_NAME               "mesh"
1422
1423 // Use bitmap to allow coexist of ATE_TXFRAME and ATE_RXFRAME(i.e.,to support LoopBack mode).
1424 #ifdef RALINK_ATE
1425 #define ATE_START                   0x00   // Start ATE
1426 #define ATE_STOP                    0x80   // Stop ATE
1427 #define ATE_TXCONT                  0x05   // Continuous Transmit
1428 #define ATE_TXCARR                  0x09   // Transmit Carrier
1429 #define ATE_TXCARRSUPP              0x11   // Transmit Carrier Suppression
1430 #define ATE_TXFRAME                 0x01   // Transmit Frames
1431 #define ATE_RXFRAME                 0x02   // Receive Frames
1432 #ifdef RALINK_28xx_QA
1433 #define ATE_TXSTOP                  0xe2   // Stop Transmition(i.e., TXCONT, TXCARR, TXCARRSUPP, and TXFRAME)
1434 #define ATE_RXSTOP                                      0xfd   // Stop receiving Frames
1435 #define BBP22_TXFRAME                           0x00   // Transmit Frames
1436 #define BBP22_TXCONT_OR_CARRSUPP    0x80   // Continuous Transmit or Carrier Suppression
1437 #define BBP22_TXCARR                0xc1   // Transmit Carrier
1438 #define BBP24_TXCONT                0x00   // Continuous Transmit
1439 #define BBP24_CARRSUPP              0x01   // Carrier Suppression
1440 #endif // RALINK_28xx_QA //
1441 #endif // RALINK_ATE //
1442
1443 // WEP Key TYPE
1444 #define WEP_HEXADECIMAL_TYPE    0
1445 #define WEP_ASCII_TYPE          1
1446
1447
1448
1449 // WIRELESS EVENTS definition
1450 /* Max number of char in custom event, refer to wireless_tools.28/wireless.20.h */
1451 #define IW_CUSTOM_MAX_LEN                                                       255     /* In bytes */
1452
1453 // For system event - start
1454 #define IW_SYS_EVENT_FLAG_START                     0x0200
1455 #define IW_ASSOC_EVENT_FLAG                         0x0200
1456 #define IW_DISASSOC_EVENT_FLAG                      0x0201
1457 #define IW_DEAUTH_EVENT_FLAG                            0x0202
1458 #define IW_AGEOUT_EVENT_FLAG                            0x0203
1459 #define IW_COUNTER_MEASURES_EVENT_FLAG              0x0204
1460 #define IW_REPLAY_COUNTER_DIFF_EVENT_FLAG           0x0205
1461 #define IW_RSNIE_DIFF_EVENT_FLAG                                0x0206
1462 #define IW_MIC_DIFF_EVENT_FLAG                                  0x0207
1463 #define IW_ICV_ERROR_EVENT_FLAG                                         0x0208
1464 #define IW_MIC_ERROR_EVENT_FLAG                                         0x0209
1465 #define IW_GROUP_HS_TIMEOUT_EVENT_FLAG                          0x020A
1466 #define IW_PAIRWISE_HS_TIMEOUT_EVENT_FLAG                       0x020B
1467 #define IW_RSNIE_SANITY_FAIL_EVENT_FLAG                         0x020C
1468 #define IW_SET_KEY_DONE_WPA1_EVENT_FLAG                         0x020D
1469 #define IW_SET_KEY_DONE_WPA2_EVENT_FLAG                         0x020E
1470 #define IW_STA_LINKUP_EVENT_FLAG                                        0x020F
1471 #define IW_STA_LINKDOWN_EVENT_FLAG                                      0x0210
1472 #define IW_SCAN_COMPLETED_EVENT_FLAG                            0x0211
1473 #define IW_SCAN_ENQUEUE_FAIL_EVENT_FLAG                         0x0212
1474 // if add new system event flag, please upadte the IW_SYS_EVENT_FLAG_END
1475 #define IW_SYS_EVENT_FLAG_END                       0x0212
1476 #define IW_SYS_EVENT_TYPE_NUM                                           (IW_SYS_EVENT_FLAG_END - IW_SYS_EVENT_FLAG_START + 1)
1477 // For system event - end
1478
1479 // For spoof attack event - start
1480 #define IW_SPOOF_EVENT_FLAG_START                   0x0300
1481 #define IW_CONFLICT_SSID_EVENT_FLAG                                     0x0300
1482 #define IW_SPOOF_ASSOC_RESP_EVENT_FLAG                          0x0301
1483 #define IW_SPOOF_REASSOC_RESP_EVENT_FLAG                        0x0302
1484 #define IW_SPOOF_PROBE_RESP_EVENT_FLAG                          0x0303
1485 #define IW_SPOOF_BEACON_EVENT_FLAG                                      0x0304
1486 #define IW_SPOOF_DISASSOC_EVENT_FLAG                            0x0305
1487 #define IW_SPOOF_AUTH_EVENT_FLAG                                        0x0306
1488 #define IW_SPOOF_DEAUTH_EVENT_FLAG                                      0x0307
1489 #define IW_SPOOF_UNKNOWN_MGMT_EVENT_FLAG                        0x0308
1490 #define IW_REPLAY_ATTACK_EVENT_FLAG                                     0x0309
1491 // if add new spoof attack event flag, please upadte the IW_SPOOF_EVENT_FLAG_END
1492 #define IW_SPOOF_EVENT_FLAG_END                     0x0309
1493 #define IW_SPOOF_EVENT_TYPE_NUM                                         (IW_SPOOF_EVENT_FLAG_END - IW_SPOOF_EVENT_FLAG_START + 1)
1494 // For spoof attack event - end
1495
1496 // For flooding attack event - start
1497 #define IW_FLOOD_EVENT_FLAG_START                   0x0400
1498 #define IW_FLOOD_AUTH_EVENT_FLAG                                        0x0400
1499 #define IW_FLOOD_ASSOC_REQ_EVENT_FLAG                           0x0401
1500 #define IW_FLOOD_REASSOC_REQ_EVENT_FLAG                         0x0402
1501 #define IW_FLOOD_PROBE_REQ_EVENT_FLAG                           0x0403
1502 #define IW_FLOOD_DISASSOC_EVENT_FLAG                            0x0404
1503 #define IW_FLOOD_DEAUTH_EVENT_FLAG                                      0x0405
1504 #define IW_FLOOD_EAP_REQ_EVENT_FLAG                                     0x0406
1505 // if add new flooding attack event flag, please upadte the IW_FLOOD_EVENT_FLAG_END
1506 #define IW_FLOOD_EVENT_FLAG_END                         0x0406
1507 #define IW_FLOOD_EVENT_TYPE_NUM                                         (IW_FLOOD_EVENT_FLAG_END - IW_FLOOD_EVENT_FLAG_START + 1)
1508 // For flooding attack - end
1509
1510 // End - WIRELESS EVENTS definition
1511
1512 #ifdef CONFIG_STA_SUPPORT
1513 // definition for DLS, kathy
1514 #define MAX_NUM_OF_INIT_DLS_ENTRY   1
1515 #define MAX_NUM_OF_DLS_ENTRY        MAX_NUMBER_OF_DLS_ENTRY
1516
1517 //Block ACK, kathy
1518 #define MAX_TX_REORDERBUF               64
1519 #define MAX_RX_REORDERBUF               64
1520 #define DEFAULT_TX_TIMEOUT              30
1521 #define DEFAULT_RX_TIMEOUT              30
1522 #define MAX_BARECI_SESSION              8
1523
1524 #ifndef IW_ESSID_MAX_SIZE
1525 /* Maximum size of the ESSID and pAd->nickname strings */
1526 #define IW_ESSID_MAX_SIZE               32
1527 #endif
1528 #endif // CONFIG_STA_SUPPORT //
1529
1530 #ifdef MCAST_RATE_SPECIFIC
1531 #define MCAST_DISABLE   0
1532 #define MCAST_CCK               1
1533 #define MCAST_OFDM              2
1534 #define MCAST_HTMIX             3
1535 #endif // MCAST_RATE_SPECIFIC //
1536
1537 // For AsicRadioOff/AsicRadioOn function
1538 #define DOT11POWERSAVE          0
1539 #define GUIRADIO_OFF            1
1540 #define RTMP_HALT                   2
1541 #define GUI_IDLE_POWER_SAVE             3
1542 // --
1543
1544
1545 // definition for WpaSupport flag
1546 #define WPA_SUPPLICANT_DISABLE                          0
1547 #define WPA_SUPPLICANT_ENABLE                           1
1548 #define WPA_SUPPLICANT_ENABLE_WITH_WEB_UI       2
1549
1550 // definition for Antenna Diversity flag
1551 #ifdef ANT_DIVERSITY_SUPPORT
1552 enum ANT_DIVERSITY_TYPE {
1553     ANT_DIVERSITY_DISABLE = 0,
1554     ANT_DIVERSITY_ENABLE = 1,
1555     ANT_FIX_ANT1 = 2,
1556     ANT_FIX_ANT2 = 3
1557 };
1558 #endif // ANT_DIVERSITY_SUPPORT //
1559
1560 // Endian byte swapping codes
1561 #define SWAP16(x) \
1562     ((UINT16)( \
1563     (((UINT16)(x) & (UINT16) 0x00ffU) << 8) | \
1564     (((UINT16)(x) & (UINT16) 0xff00U) >> 8) ))
1565
1566 #define SWAP32(x) \
1567     ((UINT32)( \
1568     (((UINT32)(x) & (UINT32) 0x000000ffUL) << 24) | \
1569     (((UINT32)(x) & (UINT32) 0x0000ff00UL) <<  8) | \
1570     (((UINT32)(x) & (UINT32) 0x00ff0000UL) >>  8) | \
1571     (((UINT32)(x) & (UINT32) 0xff000000UL) >> 24) ))
1572
1573 #define SWAP64(x) \
1574     ((UINT64)( \
1575     (UINT64)(((UINT64)(x) & (UINT64) 0x00000000000000ffULL) << 56) | \
1576     (UINT64)(((UINT64)(x) & (UINT64) 0x000000000000ff00ULL) << 40) | \
1577     (UINT64)(((UINT64)(x) & (UINT64) 0x0000000000ff0000ULL) << 24) | \
1578     (UINT64)(((UINT64)(x) & (UINT64) 0x00000000ff000000ULL) <<  8) | \
1579     (UINT64)(((UINT64)(x) & (UINT64) 0x000000ff00000000ULL) >>  8) | \
1580     (UINT64)(((UINT64)(x) & (UINT64) 0x0000ff0000000000ULL) >> 24) | \
1581     (UINT64)(((UINT64)(x) & (UINT64) 0x00ff000000000000ULL) >> 40) | \
1582     (UINT64)(((UINT64)(x) & (UINT64) 0xff00000000000000ULL) >> 56) ))
1583
1584 #ifdef RT_BIG_ENDIAN
1585
1586 #define cpu2le64(x) SWAP64((x))
1587 #define le2cpu64(x) SWAP64((x))
1588 #define cpu2le32(x) SWAP32((x))
1589 #define le2cpu32(x) SWAP32((x))
1590 #define cpu2le16(x) SWAP16((x))
1591 #define le2cpu16(x) SWAP16((x))
1592 #define cpu2be64(x) ((UINT64)(x))
1593 #define be2cpu64(x) ((UINT64)(x))
1594 #define cpu2be32(x) ((UINT32)(x))
1595 #define be2cpu32(x) ((UINT32)(x))
1596 #define cpu2be16(x) ((UINT16)(x))
1597 #define be2cpu16(x) ((UINT16)(x))
1598
1599 #else   // Little_Endian
1600
1601 #define cpu2le64(x) ((UINT64)(x))
1602 #define le2cpu64(x) ((UINT64)(x))
1603 #define cpu2le32(x) ((UINT32)(x))
1604 #define le2cpu32(x) ((UINT32)(x))
1605 #define cpu2le16(x) ((UINT16)(x))
1606 #define le2cpu16(x) ((UINT16)(x))
1607 #define cpu2be64(x) SWAP64((x))
1608 #define be2cpu64(x) SWAP64((x))
1609 #define cpu2be32(x) SWAP32((x))
1610 #define be2cpu32(x) SWAP32((x))
1611 #define cpu2be16(x) SWAP16((x))
1612 #define be2cpu16(x) SWAP16((x))
1613
1614 #endif  // RT_BIG_ENDIAN
1615
1616 #define ABS(_x, _y) ((_x) > (_y)) ? ((_x) -(_y)) : ((_y) -(_x))
1617
1618
1619 #define A2Dec(_X, _p)                           \
1620 {                                                                       \
1621         UCHAR *p;                                               \
1622         _X = 0;                                                 \
1623         p = _p;                                                 \
1624         while (((*p >= '0') && (*p <= '9')))            \
1625         {                                                                                               \
1626                 if ((*p >= '0') && (*p <= '9'))         \
1627                         _X = _X * 10 + *p - 48;                                 \
1628                 p++;                                                                            \
1629         }                                                                                               \
1630 }
1631
1632
1633 #define A2Hex(_X, _p)                           \
1634 do{                                                                     \
1635         char *__p;                                              \
1636         (_X) = 0;                                                       \
1637         __p = (char *)(_p);                                                     \
1638         while (((*__p >= 'a') && (*__p <= 'f')) || ((*__p >= 'A') && (*__p <= 'F')) || ((*__p >= '0') && (*__p <= '9')))                \
1639         {                                                                                               \
1640                 if ((*__p >= 'a') && (*__p <= 'f'))                             \
1641                         (_X) = (_X) * 16 + *__p - 87;                                   \
1642                 else if ((*__p >= 'A') && (*__p <= 'F'))                \
1643                         (_X) = (_X) * 16 + *__p - 55;                                   \
1644                 else if ((*__p >= '0') && (*__p <= '9'))                \
1645                         (_X) = (_X) * 16 + *__p - 48;                                   \
1646                 __p++;                                                                          \
1647         }                                                                                               \
1648 }while(0)
1649
1650 #endif  // __RTMP_DEF_H__