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