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