1 /******************************************************************************
3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 ******************************************************************************/
24 #define MGMT_QUEUE_NUM 5
27 #define ETH_TYPE_LEN 2
28 #define PAYLOAD_TYPE_LEN 1
30 #define RTL_IOCTL_HOSTAPD (SIOCIWFIRSTPRIV + 28)
32 /* RTL871X_IOCTL_HOSTAPD ioctl() cmd: */
34 RTL871X_HOSTAPD_FLUSH = 1,
35 RTL871X_HOSTAPD_ADD_STA = 2,
36 RTL871X_HOSTAPD_REMOVE_STA = 3,
37 RTL871X_HOSTAPD_GET_INFO_STA = 4,
38 /* REMOVED: PRISM2_HOSTAPD_RESET_TXEXC_STA = 5, */
39 RTL871X_HOSTAPD_GET_WPAIE_STA = 5,
40 RTL871X_SET_ENCRYPTION = 6,
41 RTL871X_GET_ENCRYPTION = 7,
42 RTL871X_HOSTAPD_SET_FLAGS_STA = 8,
43 RTL871X_HOSTAPD_GET_RID = 9,
44 RTL871X_HOSTAPD_SET_RID = 10,
45 RTL871X_HOSTAPD_SET_ASSOC_AP_ADDR = 11,
46 RTL871X_HOSTAPD_SET_GENERIC_ELEMENT = 12,
47 RTL871X_HOSTAPD_MLME = 13,
48 RTL871X_HOSTAPD_SCAN_REQ = 14,
49 RTL871X_HOSTAPD_STA_CLEAR_STATS = 15,
50 RTL871X_HOSTAPD_SET_BEACON=16,
51 RTL871X_HOSTAPD_SET_WPS_BEACON = 17,
52 RTL871X_HOSTAPD_SET_WPS_PROBE_RESP = 18,
53 RTL871X_HOSTAPD_SET_WPS_ASSOC_RESP = 19,
54 RTL871X_HOSTAPD_SET_HIDDEN_SSID = 20,
55 RTL871X_HOSTAPD_SET_MACADDR_ACL = 21,
56 RTL871X_HOSTAPD_ACL_ADD_STA = 22,
57 RTL871X_HOSTAPD_ACL_REMOVE_STA = 23,
61 #define WLAN_STA_AUTH BIT(0)
62 #define WLAN_STA_ASSOC BIT(1)
63 #define WLAN_STA_PS BIT(2)
64 #define WLAN_STA_TIM BIT(3)
65 #define WLAN_STA_PERM BIT(4)
66 #define WLAN_STA_AUTHORIZED BIT(5)
67 #define WLAN_STA_PENDING_POLL BIT(6) /* pending activity poll not ACKed */
68 #define WLAN_STA_SHORT_PREAMBLE BIT(7)
69 #define WLAN_STA_PREAUTH BIT(8)
70 #define WLAN_STA_WME BIT(9)
71 #define WLAN_STA_MFP BIT(10)
72 #define WLAN_STA_HT BIT(11)
73 #define WLAN_STA_WPS BIT(12)
74 #define WLAN_STA_MAYBE_WPS BIT(13)
75 #define WLAN_STA_VHT BIT(14)
76 #define WLAN_STA_NONERP BIT(31)
78 #define IEEE_CMD_SET_WPA_PARAM 1
79 #define IEEE_CMD_SET_WPA_IE 2
80 #define IEEE_CMD_SET_ENCRYPTION 3
81 #define IEEE_CMD_MLME 4
83 #define IEEE_PARAM_WPA_ENABLED 1
84 #define IEEE_PARAM_TKIP_COUNTERMEASURES 2
85 #define IEEE_PARAM_DROP_UNENCRYPTED 3
86 #define IEEE_PARAM_PRIVACY_INVOKED 4
87 #define IEEE_PARAM_AUTH_ALGS 5
88 #define IEEE_PARAM_IEEE_802_1X 6
89 #define IEEE_PARAM_WPAX_SELECT 7
91 #define AUTH_ALG_OPEN_SYSTEM 0x1
92 #define AUTH_ALG_SHARED_KEY 0x2
93 #define AUTH_ALG_LEAP 0x00000004
95 #define IEEE_MLME_STA_DEAUTH 1
96 #define IEEE_MLME_STA_DISASSOC 2
98 #define IEEE_CRYPT_ERR_UNKNOWN_ALG 2
99 #define IEEE_CRYPT_ERR_UNKNOWN_ADDR 3
100 #define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4
101 #define IEEE_CRYPT_ERR_KEY_SET_FAILED 5
102 #define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6
103 #define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7
106 #define IEEE_CRYPT_ALG_NAME_LEN 16
108 #define WPA_CIPHER_NONE BIT(0)
109 #define WPA_CIPHER_WEP40 BIT(1)
110 #define WPA_CIPHER_WEP104 BIT(2)
111 #define WPA_CIPHER_TKIP BIT(3)
112 #define WPA_CIPHER_CCMP BIT(4)
116 #define WPA_SELECTOR_LEN 4
117 extern u8 RTW_WPA_OUI_TYPE[] ;
118 extern u16 RTW_WPA_VERSION ;
119 extern u8 WPA_AUTH_KEY_MGMT_NONE[];
120 extern u8 WPA_AUTH_KEY_MGMT_UNSPEC_802_1X[];
121 extern u8 WPA_AUTH_KEY_MGMT_PSK_OVER_802_1X[];
122 extern u8 WPA_CIPHER_SUITE_NONE[];
123 extern u8 WPA_CIPHER_SUITE_WEP40[];
124 extern u8 WPA_CIPHER_SUITE_TKIP[];
125 extern u8 WPA_CIPHER_SUITE_WRAP[];
126 extern u8 WPA_CIPHER_SUITE_CCMP[];
127 extern u8 WPA_CIPHER_SUITE_WEP104[];
130 #define RSN_HEADER_LEN 4
131 #define RSN_SELECTOR_LEN 4
133 extern u16 RSN_VERSION_BSD;
134 extern u8 RSN_AUTH_KEY_MGMT_UNSPEC_802_1X[];
135 extern u8 RSN_AUTH_KEY_MGMT_PSK_OVER_802_1X[];
136 extern u8 RSN_CIPHER_SUITE_NONE[];
137 extern u8 RSN_CIPHER_SUITE_WEP40[];
138 extern u8 RSN_CIPHER_SUITE_TKIP[];
139 extern u8 RSN_CIPHER_SUITE_WRAP[];
140 extern u8 RSN_CIPHER_SUITE_CCMP[];
141 extern u8 RSN_CIPHER_SUITE_WEP104[];
144 typedef enum _RATEID_IDX_ {
145 RATEID_IDX_BGN_40M_2SS = 0,
146 RATEID_IDX_BGN_40M_1SS = 1,
147 RATEID_IDX_BGN_20M_2SS_BN = 2,
148 RATEID_IDX_BGN_20M_1SS_BN = 3,
149 RATEID_IDX_GN_N2SS = 4,
150 RATEID_IDX_GN_N1SS = 5,
154 RATEID_IDX_VHT_2SS = 9,
155 RATEID_IDX_VHT_1SS = 10,
156 } RATEID_IDX, *PRATEID_IDX;
158 typedef enum _RATR_TABLE_MODE{
159 RATR_INX_WIRELESS_NGB = 0, // BGN 40 Mhz 2SS 1SS
160 RATR_INX_WIRELESS_NG = 1, // GN or N
161 RATR_INX_WIRELESS_NB = 2, // BGN 20 Mhz 2SS 1SS or BN
162 RATR_INX_WIRELESS_N = 3,
163 RATR_INX_WIRELESS_GB = 4,
164 RATR_INX_WIRELESS_G = 5,
165 RATR_INX_WIRELESS_B = 6,
166 RATR_INX_WIRELESS_MC = 7,
167 RATR_INX_WIRELESS_AC_N = 8,
168 }RATR_TABLE_MODE, *PRATR_TABLE_MODE;
173 WIRELESS_INVALID = 0,
175 WIRELESS_11B = BIT(0), // tx: cck only , rx: cck only, hw: cck
176 WIRELESS_11G = BIT(1), // tx: ofdm only, rx: ofdm & cck, hw: cck & ofdm
177 WIRELESS_11A = BIT(2), // tx: ofdm only, rx: ofdm only, hw: ofdm only
178 WIRELESS_11_24N = BIT(3), // tx: MCS only, rx: MCS & cck, hw: MCS & cck
179 WIRELESS_11_5N = BIT(4), // tx: MCS only, rx: MCS & ofdm, hw: ofdm only
180 WIRELESS_AUTO = BIT(5),
181 WIRELESS_11AC = BIT(6),
184 //Type for current wireless mode
185 WIRELESS_11BG = (WIRELESS_11B|WIRELESS_11G), // tx: cck & ofdm, rx: cck & ofdm & MCS, hw: cck & ofdm
186 WIRELESS_11G_24N = (WIRELESS_11G|WIRELESS_11_24N), // tx: ofdm & MCS, rx: ofdm & cck & MCS, hw: cck & ofdm
187 WIRELESS_11A_5N = (WIRELESS_11A|WIRELESS_11_5N), // tx: ofdm & MCS, rx: ofdm & MCS, hw: ofdm only
188 WIRELESS_11B_24N = (WIRELESS_11B|WIRELESS_11_24N), // tx: ofdm & cck & MCS, rx: ofdm & cck & MCS, hw: ofdm & cck
189 WIRELESS_11BG_24N = (WIRELESS_11B|WIRELESS_11G|WIRELESS_11_24N), // tx: ofdm & cck & MCS, rx: ofdm & cck & MCS, hw: ofdm & cck
190 WIRELESS_11_24AC = (WIRELESS_11G|WIRELESS_11AC),
191 WIRELESS_11_5AC = (WIRELESS_11A|WIRELESS_11AC),
194 //Type for registry default wireless mode
195 WIRELESS_11AGN = (WIRELESS_11A|WIRELESS_11G|WIRELESS_11_24N|WIRELESS_11_5N), // tx: ofdm & MCS, rx: ofdm & MCS, hw: ofdm only
196 WIRELESS_11ABGN = (WIRELESS_11A|WIRELESS_11B|WIRELESS_11G|WIRELESS_11_24N|WIRELESS_11_5N),
197 WIRELESS_MODE_24G = (WIRELESS_11B|WIRELESS_11G|WIRELESS_11_24N|WIRELESS_11AC),
198 WIRELESS_MODE_MAX = (WIRELESS_11A|WIRELESS_11B|WIRELESS_11G|WIRELESS_11_24N|WIRELESS_11_5N|WIRELESS_11AC),
201 #define SUPPORTED_24G_NETTYPE_MSK (WIRELESS_11B | WIRELESS_11G | WIRELESS_11_24N)
203 #define IsLegacyOnly(NetType) ((NetType) == ((NetType) & (WIRELESS_11BG|WIRELESS_11A)))
205 #define IsSupported24G(NetType) ((NetType) & SUPPORTED_24G_NETTYPE_MSK ? true : false)
207 #define IsEnableHWCCK(NetType) IsSupported24G(NetType)
208 #define IsEnableHWOFDM(NetType) (((NetType) & (WIRELESS_11G|WIRELESS_11_24N)) ? true : false)
210 #define IsSupportedRxCCK(NetType) IsEnableHWCCK(NetType)
211 #define IsSupportedRxOFDM(NetType) IsEnableHWOFDM(NetType)
212 #define IsSupportedRxHT(NetType) IsEnableHWOFDM(NetType)
214 #define IsSupportedTxCCK(NetType) (((NetType) & (WIRELESS_11B)) ? true : false)
215 #define IsSupportedTxOFDM(NetType) (((NetType) & (WIRELESS_11G|WIRELESS_11A)) ? true : false)
216 #define IsSupportedHT(NetType) (((NetType) & (WIRELESS_11_24N|WIRELESS_11_5N)) ? true : false)
218 #define IsSupportedVHT(NetType) (((NetType) & (WIRELESS_11AC)) ? true : false)
221 typedef struct ieee_param {
223 u8 sta_addr[ETH_ALEN];
239 u8 alg[IEEE_CRYPT_ALG_NAME_LEN];
243 u8 seq[8]; /* sequence counter (set: RX, get: TX) */
251 u8 tx_supp_rates[16];
252 struct rtw_ieee80211_ht_cap ht_cap;
255 u8 reserved[2];//for set max_num_sta
261 typedef struct ieee_param_ex {
263 u8 sta_addr[ETH_ALEN];
272 u8 tx_supp_rates[16];
273 u32 tx_supp_rates_len;
274 struct rtw_ieee80211_ht_cap ht_cap;
283 #define IEEE80211_DATA_LEN 2304
284 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
287 The figure in section 7.1.2 suggests a body size of up to 2312
288 bytes is allowed, which is a bit confusing, I suspect this
289 represents the 2304 bytes of real data, plus a possible 8 bytes of
290 WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
293 #define IEEE80211_HLEN 30
294 #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
297 /* this is stolen from ipw2200 driver */
298 #define IEEE_IBSS_MAC_HASH_SIZE 31
300 struct ieee_ibss_seq {
304 unsigned long packet_time;
308 struct rtw_ieee80211_hdr {
316 } __attribute__ ((packed));
318 struct rtw_ieee80211_hdr_3addr {
325 } __attribute__ ((packed));
328 struct rtw_ieee80211_hdr_qos {
337 } __attribute__ ((packed));
339 struct rtw_ieee80211_hdr_3addr_qos {
347 } __attribute__ ((packed));
355 } __attribute__ ((packed));
362 EAPOL_ENCAP_ASF_ALERT
365 #define IEEE80211_3ADDR_LEN 24
366 #define IEEE80211_4ADDR_LEN 30
367 #define IEEE80211_FCS_LEN 4
369 #define MIN_FRAG_THRESHOLD 256U
370 #define MAX_FRAG_THRESHOLD 2346U
372 /* Frame control field constants */
373 #define RTW_IEEE80211_FCTL_VERS 0x0003
374 #define RTW_IEEE80211_FCTL_FTYPE 0x000c
375 #define RTW_IEEE80211_FCTL_STYPE 0x00f0
376 #define RTW_IEEE80211_FCTL_TODS 0x0100
377 #define RTW_IEEE80211_FCTL_FROMDS 0x0200
378 #define RTW_IEEE80211_FCTL_MOREFRAGS 0x0400
379 #define RTW_IEEE80211_FCTL_RETRY 0x0800
380 #define RTW_IEEE80211_FCTL_PM 0x1000
381 #define RTW_IEEE80211_FCTL_MOREDATA 0x2000
382 #define RTW_IEEE80211_FCTL_PROTECTED 0x4000
383 #define RTW_IEEE80211_FCTL_ORDER 0x8000
384 #define RTW_IEEE80211_FCTL_CTL_EXT 0x0f00
386 #define RTW_IEEE80211_FTYPE_MGMT 0x0000
387 #define RTW_IEEE80211_FTYPE_CTL 0x0004
388 #define RTW_IEEE80211_FTYPE_DATA 0x0008
389 #define RTW_IEEE80211_FTYPE_EXT 0x000c
392 #define RTW_IEEE80211_STYPE_ASSOC_REQ 0x0000
393 #define RTW_IEEE80211_STYPE_ASSOC_RESP 0x0010
394 #define RTW_IEEE80211_STYPE_REASSOC_REQ 0x0020
395 #define RTW_IEEE80211_STYPE_REASSOC_RESP 0x0030
396 #define RTW_IEEE80211_STYPE_PROBE_REQ 0x0040
397 #define RTW_IEEE80211_STYPE_PROBE_RESP 0x0050
398 #define RTW_IEEE80211_STYPE_BEACON 0x0080
399 #define RTW_IEEE80211_STYPE_ATIM 0x0090
400 #define RTW_IEEE80211_STYPE_DISASSOC 0x00A0
401 #define RTW_IEEE80211_STYPE_AUTH 0x00B0
402 #define RTW_IEEE80211_STYPE_DEAUTH 0x00C0
403 #define RTW_IEEE80211_STYPE_ACTION 0x00D0
406 #define RTW_IEEE80211_STYPE_CTL_EXT 0x0060
407 #define RTW_IEEE80211_STYPE_BACK_REQ 0x0080
408 #define RTW_IEEE80211_STYPE_BACK 0x0090
409 #define RTW_IEEE80211_STYPE_PSPOLL 0x00A0
410 #define RTW_IEEE80211_STYPE_RTS 0x00B0
411 #define RTW_IEEE80211_STYPE_CTS 0x00C0
412 #define RTW_IEEE80211_STYPE_ACK 0x00D0
413 #define RTW_IEEE80211_STYPE_CFEND 0x00E0
414 #define RTW_IEEE80211_STYPE_CFENDACK 0x00F0
417 #define RTW_IEEE80211_STYPE_DATA 0x0000
418 #define RTW_IEEE80211_STYPE_DATA_CFACK 0x0010
419 #define RTW_IEEE80211_STYPE_DATA_CFPOLL 0x0020
420 #define RTW_IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
421 #define RTW_IEEE80211_STYPE_NULLFUNC 0x0040
422 #define RTW_IEEE80211_STYPE_CFACK 0x0050
423 #define RTW_IEEE80211_STYPE_CFPOLL 0x0060
424 #define RTW_IEEE80211_STYPE_CFACKPOLL 0x0070
425 #define RTW_IEEE80211_STYPE_QOS_DATA 0x0080
426 #define RTW_IEEE80211_STYPE_QOS_DATA_CFACK 0x0090
427 #define RTW_IEEE80211_STYPE_QOS_DATA_CFPOLL 0x00A0
428 #define RTW_IEEE80211_STYPE_QOS_DATA_CFACKPOLL 0x00B0
429 #define RTW_IEEE80211_STYPE_QOS_NULLFUNC 0x00C0
430 #define RTW_IEEE80211_STYPE_QOS_CFACK 0x00D0
431 #define RTW_IEEE80211_STYPE_QOS_CFPOLL 0x00E0
432 #define RTW_IEEE80211_STYPE_QOS_CFACKPOLL 0x00F0
434 /* sequence control field */
435 #define RTW_IEEE80211_SCTL_FRAG 0x000F
436 #define RTW_IEEE80211_SCTL_SEQ 0xFFF0
439 #define RTW_ERP_INFO_NON_ERP_PRESENT BIT(0)
440 #define RTW_ERP_INFO_USE_PROTECTION BIT(1)
441 #define RTW_ERP_INFO_BARKER_PREAMBLE_MODE BIT(2)
446 #define NON_EXPLICIT_ACK 2
450 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
451 #endif /* ETH_P_PAE */
453 #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
455 #define ETH_P_ECONET 0x0018
457 #ifndef ETH_P_80211_RAW
458 #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
461 /* IEEE 802.11 defines */
463 #define P80211_OUI_LEN 3
465 struct ieee80211_snap_hdr {
467 u8 dsap; /* always 0xAA */
468 u8 ssap; /* always 0xAA */
469 u8 ctrl; /* always 0x03 */
470 u8 oui[P80211_OUI_LEN]; /* organizational universal id */
472 } __attribute__ ((packed));
474 #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
476 #define WLAN_FC_GET_TYPE(fc) ((fc) & RTW_IEEE80211_FCTL_FTYPE)
477 #define WLAN_FC_GET_STYPE(fc) ((fc) & RTW_IEEE80211_FCTL_STYPE)
479 #define WLAN_QC_GET_TID(qc) ((qc) & 0x0f)
481 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & RTW_IEEE80211_SCTL_FRAG)
482 #define WLAN_GET_SEQ_SEQ(seq) ((seq) & RTW_IEEE80211_SCTL_SEQ)
484 /* Authentication algorithms */
485 #define WLAN_AUTH_OPEN 0
486 #define WLAN_AUTH_SHARED_KEY 1
488 #define WLAN_AUTH_CHALLENGE_LEN 128
490 #define WLAN_CAPABILITY_BSS (1<<0)
491 #define WLAN_CAPABILITY_IBSS (1<<1)
492 #define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
493 #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
494 #define WLAN_CAPABILITY_PRIVACY (1<<4)
495 #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
496 #define WLAN_CAPABILITY_PBCC (1<<6)
497 #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
498 #define WLAN_CAPABILITY_SHORT_SLOT (1<<10)
501 #define WLAN_STATUS_SUCCESS 0
502 #define WLAN_STATUS_UNSPECIFIED_FAILURE 1
503 #define WLAN_STATUS_CAPS_UNSUPPORTED 10
504 #define WLAN_STATUS_REASSOC_NO_ASSOC 11
505 #define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
506 #define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
507 #define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
508 #define WLAN_STATUS_CHALLENGE_FAIL 15
509 #define WLAN_STATUS_AUTH_TIMEOUT 16
510 #define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
511 #define WLAN_STATUS_ASSOC_DENIED_RATES 18
513 #define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
514 #define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
515 #define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
518 #define WLAN_REASON_UNSPECIFIED 1
519 #define WLAN_REASON_PREV_AUTH_NOT_VALID 2
520 #define WLAN_REASON_DEAUTH_LEAVING 3
521 #define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
522 #define WLAN_REASON_DISASSOC_AP_BUSY 5
523 #define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
524 #define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
525 #define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
526 #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
527 #define WLAN_REASON_ACTIVE_ROAM 65533
528 #define WLAN_REASON_JOIN_WRONG_CHANNEL 65534
529 #define WLAN_REASON_EXPIRATION_CHK 65535
531 /* Information Element IDs */
532 #define WLAN_EID_SSID 0
533 #define WLAN_EID_SUPP_RATES 1
534 #define WLAN_EID_FH_PARAMS 2
535 #define WLAN_EID_DS_PARAMS 3
536 #define WLAN_EID_CF_PARAMS 4
537 #define WLAN_EID_TIM 5
538 #define WLAN_EID_IBSS_PARAMS 6
539 #define WLAN_EID_CHALLENGE 16
540 /* EIDs defined by IEEE 802.11h - START */
541 #define WLAN_EID_PWR_CONSTRAINT 32
542 #define WLAN_EID_PWR_CAPABILITY 33
543 #define WLAN_EID_TPC_REQUEST 34
544 #define WLAN_EID_TPC_REPORT 35
545 #define WLAN_EID_SUPPORTED_CHANNELS 36
546 #define WLAN_EID_CHANNEL_SWITCH 37
547 #define WLAN_EID_MEASURE_REQUEST 38
548 #define WLAN_EID_MEASURE_REPORT 39
549 #define WLAN_EID_QUITE 40
550 #define WLAN_EID_IBSS_DFS 41
551 /* EIDs defined by IEEE 802.11h - END */
552 #define WLAN_EID_ERP_INFO 42
553 #define WLAN_EID_HT_CAP 45
554 #define WLAN_EID_RSN 48
555 #define WLAN_EID_EXT_SUPP_RATES 50
556 #define WLAN_EID_MOBILITY_DOMAIN 54
557 #define WLAN_EID_FAST_BSS_TRANSITION 55
558 #define WLAN_EID_TIMEOUT_INTERVAL 56
559 #define WLAN_EID_RIC_DATA 57
560 #define WLAN_EID_HT_OPERATION 61
561 #define WLAN_EID_SECONDARY_CHANNEL_OFFSET 62
562 #define WLAN_EID_20_40_BSS_COEXISTENCE 72
563 #define WLAN_EID_20_40_BSS_INTOLERANT 73
564 #define WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS 74
565 #define WLAN_EID_MMIE 76
566 #define WLAN_EID_VENDOR_SPECIFIC 221
567 #define WLAN_EID_GENERIC (WLAN_EID_VENDOR_SPECIFIC)
568 #define WLAN_EID_VHT_CAPABILITY 191
569 #define WLAN_EID_VHT_OPERATION 192
570 #define WLAN_EID_VHT_OP_MODE_NOTIFY 199
572 #define IEEE80211_MGMT_HDR_LEN 24
573 #define IEEE80211_DATA_HDR3_LEN 24
574 #define IEEE80211_DATA_HDR4_LEN 30
577 #define IEEE80211_STATMASK_SIGNAL (1<<0)
578 #define IEEE80211_STATMASK_RSSI (1<<1)
579 #define IEEE80211_STATMASK_NOISE (1<<2)
580 #define IEEE80211_STATMASK_RATE (1<<3)
581 #define IEEE80211_STATMASK_WEMASK 0x7
584 #define IEEE80211_CCK_MODULATION (1<<0)
585 #define IEEE80211_OFDM_MODULATION (1<<1)
587 #define IEEE80211_24GHZ_BAND (1<<0)
588 #define IEEE80211_52GHZ_BAND (1<<1)
590 #define IEEE80211_CCK_RATE_LEN 4
591 #define IEEE80211_NUM_OFDM_RATESLEN 8
594 #define IEEE80211_CCK_RATE_1MB 0x02
595 #define IEEE80211_CCK_RATE_2MB 0x04
596 #define IEEE80211_CCK_RATE_5MB 0x0B
597 #define IEEE80211_CCK_RATE_11MB 0x16
598 #define IEEE80211_OFDM_RATE_LEN 8
599 #define IEEE80211_OFDM_RATE_6MB 0x0C
600 #define IEEE80211_OFDM_RATE_9MB 0x12
601 #define IEEE80211_OFDM_RATE_12MB 0x18
602 #define IEEE80211_OFDM_RATE_18MB 0x24
603 #define IEEE80211_OFDM_RATE_24MB 0x30
604 #define IEEE80211_OFDM_RATE_36MB 0x48
605 #define IEEE80211_OFDM_RATE_48MB 0x60
606 #define IEEE80211_OFDM_RATE_54MB 0x6C
607 #define IEEE80211_BASIC_RATE_MASK 0x80
609 #define IEEE80211_CCK_RATE_1MB_MASK (1<<0)
610 #define IEEE80211_CCK_RATE_2MB_MASK (1<<1)
611 #define IEEE80211_CCK_RATE_5MB_MASK (1<<2)
612 #define IEEE80211_CCK_RATE_11MB_MASK (1<<3)
613 #define IEEE80211_OFDM_RATE_6MB_MASK (1<<4)
614 #define IEEE80211_OFDM_RATE_9MB_MASK (1<<5)
615 #define IEEE80211_OFDM_RATE_12MB_MASK (1<<6)
616 #define IEEE80211_OFDM_RATE_18MB_MASK (1<<7)
617 #define IEEE80211_OFDM_RATE_24MB_MASK (1<<8)
618 #define IEEE80211_OFDM_RATE_36MB_MASK (1<<9)
619 #define IEEE80211_OFDM_RATE_48MB_MASK (1<<10)
620 #define IEEE80211_OFDM_RATE_54MB_MASK (1<<11)
622 #define IEEE80211_CCK_RATES_MASK 0x0000000F
623 #define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \
624 IEEE80211_CCK_RATE_2MB_MASK)
625 #define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \
626 IEEE80211_CCK_RATE_5MB_MASK | \
627 IEEE80211_CCK_RATE_11MB_MASK)
629 #define IEEE80211_OFDM_RATES_MASK 0x00000FF0
630 #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \
631 IEEE80211_OFDM_RATE_12MB_MASK | \
632 IEEE80211_OFDM_RATE_24MB_MASK)
633 #define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \
634 IEEE80211_OFDM_RATE_9MB_MASK | \
635 IEEE80211_OFDM_RATE_18MB_MASK | \
636 IEEE80211_OFDM_RATE_36MB_MASK | \
637 IEEE80211_OFDM_RATE_48MB_MASK | \
638 IEEE80211_OFDM_RATE_54MB_MASK)
639 #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
640 IEEE80211_CCK_DEFAULT_RATES_MASK)
642 #define IEEE80211_NUM_OFDM_RATES 8
643 #define IEEE80211_NUM_CCK_RATES 4
644 #define IEEE80211_OFDM_SHIFT_MASK_A 4
736 #define IS_HT_RATE(_rate) (_rate >= MGN_MCS0 && _rate <= MGN_MCS31)
737 #define IS_VHT_RATE(_rate) (_rate >= MGN_VHT1SS_MCS0 && _rate <= MGN_VHT4SS_MCS9)
738 #define IS_CCK_RATE(_rate) (MGN_1M == _rate || _rate == MGN_2M || _rate == MGN_5_5M || _rate == MGN_11M )
739 #define IS_OFDM_RATE(_rate) (MGN_6M <= _rate && _rate <= MGN_54M && _rate != MGN_11M)
742 /* NOTE: This data is for statistical purposes; not all hardware provides this
743 * information for frames received. Not setting these will not cause
744 * any adverse affects. */
745 struct ieee80211_rx_stats {
751 u16 rate; /* in 100 kbps */
758 /* IEEE 802.11 requires that STA supports concurrent reception of at least
759 * three fragmented frames. This define can be increased to support more
760 * concurrent frames, but it should be noted that each entry can consume about
761 * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
762 #define IEEE80211_FRAG_CACHE_LEN 4
764 struct ieee80211_frag_entry {
771 u8 src_addr[ETH_ALEN];
772 u8 dst_addr[ETH_ALEN];
775 struct ieee80211_stats {
776 uint tx_unicast_frames;
777 uint tx_multicast_frames;
779 uint tx_unicast_octets;
780 uint tx_multicast_octets;
781 uint tx_deferred_transmissions;
782 uint tx_single_retry_frames;
783 uint tx_multiple_retry_frames;
784 uint tx_retry_limit_exceeded;
786 uint rx_unicast_frames;
787 uint rx_multicast_frames;
789 uint rx_unicast_octets;
790 uint rx_multicast_octets;
792 uint rx_discards_no_buffer;
793 uint tx_discards_wrong_sa;
794 uint rx_discards_undecryptable;
795 uint rx_message_in_msg_fragments;
796 uint rx_message_in_bad_msg_fragments;
799 struct ieee80211_softmac_stats{
819 #define SEC_KEY_1 (1<<0)
820 #define SEC_KEY_2 (1<<1)
821 #define SEC_KEY_3 (1<<2)
822 #define SEC_KEY_4 (1<<3)
823 #define SEC_ACTIVE_KEY (1<<4)
824 #define SEC_AUTH_MODE (1<<5)
825 #define SEC_UNICAST_GROUP (1<<6)
826 #define SEC_LEVEL (1<<7)
827 #define SEC_ENABLED (1<<8)
829 #define SEC_LEVEL_0 0 /* None */
830 #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
831 #define SEC_LEVEL_2 2 /* Level 1 + TKIP */
832 #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
833 #define SEC_LEVEL_3 4 /* Level 2 + CCMP */
836 #define WEP_KEY_LEN 13
838 #define BIP_MAX_KEYID 5
839 #define BIP_AAD_SIZE 20
841 struct ieee80211_security {
846 unicast_uses_group:1;
847 u8 key_sizes[WEP_KEYS];
848 u8 keys[WEP_KEYS][WEP_KEY_LEN];
851 } __attribute__ ((packed));
855 802.11 data frame from AP
857 ,-------------------------------------------------------------------.
858 Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
859 |------|------|---------|---------|---------|------|---------|------|
860 Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
861 | | tion | (BSSID) | | | ence | data | |
862 `-------------------------------------------------------------------'
868 struct ieee80211_header_data {
877 #define BEACON_PROBE_SSID_ID_POSITION 12
879 /* Management Frame Information Element Types */
880 #define MFIE_TYPE_SSID 0
881 #define MFIE_TYPE_RATES 1
882 #define MFIE_TYPE_FH_SET 2
883 #define MFIE_TYPE_DS_SET 3
884 #define MFIE_TYPE_CF_SET 4
885 #define MFIE_TYPE_TIM 5
886 #define MFIE_TYPE_IBSS_SET 6
887 #define MFIE_TYPE_CHALLENGE 16
888 #define MFIE_TYPE_ERP 42
889 #define MFIE_TYPE_RSN 48
890 #define MFIE_TYPE_RATES_EX 50
891 #define MFIE_TYPE_GENERIC 221
893 struct ieee80211_info_element_hdr {
896 } __attribute__ ((packed));
898 struct ieee80211_info_element {
902 } __attribute__ ((packed));
905 * These are the data types that can make up management packets
911 u8 current_ap[ETH_ALEN];
914 u16 association_id:14, reserved:2;
915 } __attribute__ ((packed));
921 #define IEEE80211_DEFAULT_TX_ESSID "Penguin"
922 #define IEEE80211_DEFAULT_BASIC_RATE 10
925 struct ieee80211_authentication {
926 struct ieee80211_header_data header;
930 //struct ieee80211_info_element_hdr info_element;
931 } __attribute__ ((packed));
934 struct ieee80211_probe_response {
935 struct ieee80211_header_data header;
939 struct ieee80211_info_element info_element;
940 } __attribute__ ((packed));
942 struct ieee80211_probe_request {
943 struct ieee80211_header_data header;
944 /*struct ieee80211_info_element info_element;*/
945 } __attribute__ ((packed));
947 struct ieee80211_assoc_request_frame {
948 struct rtw_ieee80211_hdr_3addr header;
951 //u8 current_ap[ETH_ALEN];
952 struct ieee80211_info_element_hdr info_element;
953 } __attribute__ ((packed));
955 struct ieee80211_assoc_response_frame {
956 struct rtw_ieee80211_hdr_3addr header;
960 // struct ieee80211_info_element info_element; /* supported rates */
961 } __attribute__ ((packed));
963 struct ieee80211_txb {
969 struct sk_buff *fragments[0];
973 /* SWEEP TABLE ENTRIES NUMBER*/
974 #define MAX_SWEEP_TAB_ENTRIES 42
975 #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
976 /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
977 * only use 8, and then use extended rates for the remaining supported
978 * rates. Other APs, however, stick all of their supported rates on the
979 * main rates information element... */
980 #define MAX_RATES_LENGTH ((u8)12)
981 #define MAX_RATES_EX_LENGTH ((u8)16)
982 #define MAX_NETWORK_COUNT 128
983 #define MAX_CHANNEL_NUMBER 161
984 #define IEEE80211_SOFTMAC_SCAN_TIME 400
986 #define IEEE80211_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2)
988 #define CRC_LENGTH 4U
990 #define MAX_WPA_IE_LEN (256)
991 #define MAX_WPS_IE_LEN (512)
992 #define MAX_P2P_IE_LEN (256)
993 #define MAX_WFD_IE_LEN (128)
995 #define NETWORK_EMPTY_ESSID (1<<0)
996 #define NETWORK_HAS_OFDM (1<<1)
997 #define NETWORK_HAS_CCK (1<<2)
999 #define IEEE80211_DTIM_MBCAST 4
1000 #define IEEE80211_DTIM_UCAST 2
1001 #define IEEE80211_DTIM_VALID 1
1002 #define IEEE80211_DTIM_INVALID 0
1004 #define IEEE80211_PS_DISABLED 0
1005 #define IEEE80211_PS_UNICAST IEEE80211_DTIM_UCAST
1006 #define IEEE80211_PS_MBCAST IEEE80211_DTIM_MBCAST
1007 #define IW_ESSID_MAX_SIZE 32
1010 -1: authentication fail
1011 -2: association fail
1015 enum ieee80211_state {
1017 /* the card is not linked at all */
1018 IEEE80211_NOLINK = 0,
1020 /* IEEE80211_ASSOCIATING* are for BSS client mode
1021 * the driver shall not perform RX filtering unless
1022 * the state is LINKED.
1023 * The driver shall just check for the state LINKED and
1024 * defaults to NOLINK for ALL the other states (including
1028 /* the association procedure will start (wq scheduling)*/
1029 IEEE80211_ASSOCIATING,
1030 IEEE80211_ASSOCIATING_RETRY,
1032 /* the association procedure is sending AUTH request*/
1033 IEEE80211_ASSOCIATING_AUTHENTICATING,
1035 /* the association procedure has successfully authentcated
1036 * and is sending association request
1038 IEEE80211_ASSOCIATING_AUTHENTICATED,
1040 /* the link is ok. the card associated to a BSS or linked
1041 * to a ibss cell or acting as an AP and creating the bss
1045 /* same as LINKED, but the driver shall apply RX filter
1046 * rules as we are in NO_LINK mode. As the card is still
1047 * logically linked, but it is doing a syncro site survey
1048 * then it will be back to LINKED state.
1050 IEEE80211_LINKED_SCANNING,
1054 #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
1055 #define DEFAULT_FTS 2346
1056 #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
1057 #define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
1058 #define IP_FMT "%d.%d.%d.%d"
1059 #define IP_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3]
1061 extern __inline int is_multicast_mac_addr(const u8 *addr)
1063 return ((addr[0] != 0xff) && (0x01 & addr[0]));
1066 extern __inline int is_broadcast_mac_addr(const u8 *addr)
1068 return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
1069 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
1072 extern __inline int is_zero_mac_addr(const u8 *addr)
1074 return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) && \
1075 (addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00));
1078 #define CFG_IEEE80211_RESERVE_FCS (1<<0)
1079 #define CFG_IEEE80211_COMPUTE_FCS (1<<1)
1081 typedef struct tx_pending_t{
1083 struct ieee80211_txb *txb;
1090 #define IEEE_A (1<<0)
1091 #define IEEE_B (1<<1)
1092 #define IEEE_G (1<<2)
1093 #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G)
1095 /* Action category code */
1096 enum rtw_ieee80211_category {
1097 RTW_WLAN_CATEGORY_SPECTRUM_MGMT = 0,
1098 RTW_WLAN_CATEGORY_QOS = 1,
1099 RTW_WLAN_CATEGORY_DLS = 2,
1100 RTW_WLAN_CATEGORY_BACK = 3,
1101 RTW_WLAN_CATEGORY_PUBLIC = 4, //IEEE 802.11 public action frames
1102 RTW_WLAN_CATEGORY_RADIO_MEASUREMENT = 5,
1103 RTW_WLAN_CATEGORY_FT = 6,
1104 RTW_WLAN_CATEGORY_HT = 7,
1105 RTW_WLAN_CATEGORY_SA_QUERY = 8,
1106 RTW_WLAN_CATEGORY_UNPROTECTED_WNM = 11, // add for CONFIG_IEEE80211W, none 11w also can use
1107 RTW_WLAN_CATEGORY_TDLS = 12,
1108 RTW_WLAN_CATEGORY_SELF_PROTECTED = 15, // add for CONFIG_IEEE80211W, none 11w also can use
1109 RTW_WLAN_CATEGORY_WMM = 17,
1110 RTW_WLAN_CATEGORY_VHT = 21,
1111 RTW_WLAN_CATEGORY_P2P = 0x7f,//P2P action frames
1114 /* SPECTRUM_MGMT action code */
1115 enum rtw_ieee80211_spectrum_mgmt_actioncode {
1116 RTW_WLAN_ACTION_SPCT_MSR_REQ = 0,
1117 RTW_WLAN_ACTION_SPCT_MSR_RPRT = 1,
1118 RTW_WLAN_ACTION_SPCT_TPC_REQ = 2,
1119 RTW_WLAN_ACTION_SPCT_TPC_RPRT = 3,
1120 RTW_WLAN_ACTION_SPCT_CHL_SWITCH = 4,
1121 RTW_WLAN_ACTION_SPCT_EXT_CHL_SWITCH = 5,
1124 enum _PUBLIC_ACTION{
1125 ACT_PUBLIC_BSSCOEXIST = 0, // 20/40 BSS Coexistence
1126 ACT_PUBLIC_DSE_ENABLE = 1,
1127 ACT_PUBLIC_DSE_DEENABLE = 2,
1128 ACT_PUBLIC_DSE_REG_LOCATION = 3,
1129 ACT_PUBLIC_EXT_CHL_SWITCH = 4,
1130 ACT_PUBLIC_DSE_MSR_REQ = 5,
1131 ACT_PUBLIC_DSE_MSR_RPRT = 6,
1132 ACT_PUBLIC_MP = 7, // Measurement Pilot
1133 ACT_PUBLIC_DSE_PWR_CONSTRAINT = 8,
1134 ACT_PUBLIC_VENDOR = 9, // for WIFI_DIRECT
1135 ACT_PUBLIC_GAS_INITIAL_REQ = 10,
1136 ACT_PUBLIC_GAS_INITIAL_RSP = 11,
1137 ACT_PUBLIC_GAS_COMEBACK_REQ = 12,
1138 ACT_PUBLIC_GAS_COMEBACK_RSP = 13,
1139 ACT_PUBLIC_TDLS_DISCOVERY_RSP = 14,
1140 ACT_PUBLIC_LOCATION_TRACK = 15,
1144 /* BACK action code */
1145 enum rtw_ieee80211_back_actioncode {
1146 RTW_WLAN_ACTION_ADDBA_REQ = 0,
1147 RTW_WLAN_ACTION_ADDBA_RESP = 1,
1148 RTW_WLAN_ACTION_DELBA = 2,
1151 /* HT features action code */
1152 enum rtw_ieee80211_ht_actioncode {
1153 RTW_WLAN_ACTION_HT_NOTI_CHNL_WIDTH = 0,
1154 RTW_WLAN_ACTION_HT_SM_PS = 1,
1155 RTW_WLAN_ACTION_HT_PSMP = 2,
1156 RTW_WLAN_ACTION_HT_SET_PCO_PHASE = 3,
1157 RTW_WLAN_ACTION_HT_CSI = 4,
1158 RTW_WLAN_ACTION_HT_NON_COMPRESS_BEAMFORMING = 5,
1159 RTW_WLAN_ACTION_HT_COMPRESS_BEAMFORMING = 6,
1160 RTW_WLAN_ACTION_HT_ASEL_FEEDBACK = 7,
1163 /* BACK (block-ack) parties */
1164 enum rtw_ieee80211_back_parties {
1165 RTW_WLAN_BACK_RECIPIENT = 0,
1166 RTW_WLAN_BACK_INITIATOR = 1,
1167 RTW_WLAN_BACK_TIMER = 2,
1170 /* VHT features action code */
1171 enum rtw_ieee80211_vht_actioncode{
1172 RTW_WLAN_ACTION_VHT_COMPRESSED_BEAMFORMING = 0,
1173 RTW_WLAN_ACTION_VHT_GROUPID_MANAGEMENT = 1,
1174 RTW_WLAN_ACTION_VHT_OPMODE_NOTIFICATION = 2,
1178 #define OUI_MICROSOFT 0x0050f2 /* Microsoft (also used in Wi-Fi specs)
1180 #define WME_OUI_TYPE 2
1181 #define WME_OUI_SUBTYPE_INFORMATION_ELEMENT 0
1182 #define WME_OUI_SUBTYPE_PARAMETER_ELEMENT 1
1183 #define WME_OUI_SUBTYPE_TSPEC_ELEMENT 2
1184 #define WME_VERSION 1
1186 #define WME_ACTION_CODE_SETUP_REQUEST 0
1187 #define WME_ACTION_CODE_SETUP_RESPONSE 1
1188 #define WME_ACTION_CODE_TEARDOWN 2
1190 #define WME_SETUP_RESPONSE_STATUS_ADMISSION_ACCEPTED 0
1191 #define WME_SETUP_RESPONSE_STATUS_INVALID_PARAMETERS 1
1192 #define WME_SETUP_RESPONSE_STATUS_REFUSED 3
1194 #define WME_TSPEC_DIRECTION_UPLINK 0
1195 #define WME_TSPEC_DIRECTION_DOWNLINK 1
1196 #define WME_TSPEC_DIRECTION_BI_DIRECTIONAL 3
1199 #define OUI_BROADCOM 0x00904c /* Broadcom (Epigram) */
1201 #define VENDOR_HT_CAPAB_OUI_TYPE 0x33 /* 00-90-4c:0x33 */
1204 * enum rtw_ieee80211_channel_flags - channel flags
1206 * Channel flags set by the regulatory control code.
1208 * @RTW_IEEE80211_CHAN_DISABLED: This channel is disabled.
1209 * @RTW_IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
1211 * @RTW_IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
1212 * @RTW_IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
1213 * @RTW_IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
1215 * @RTW_IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
1218 enum rtw_ieee80211_channel_flags {
1219 RTW_IEEE80211_CHAN_DISABLED = 1<<0,
1220 RTW_IEEE80211_CHAN_PASSIVE_SCAN = 1<<1,
1221 RTW_IEEE80211_CHAN_NO_IBSS = 1<<2,
1222 RTW_IEEE80211_CHAN_RADAR = 1<<3,
1223 RTW_IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
1224 RTW_IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
1227 #define RTW_IEEE80211_CHAN_NO_HT40 \
1228 (RTW_IEEE80211_CHAN_NO_HT40PLUS | RTW_IEEE80211_CHAN_NO_HT40MINUS)
1230 /* Represent channel details, subset of ieee80211_channel */
1231 struct rtw_ieee80211_channel {
1232 //enum ieee80211_band band;
1236 //int max_antenna_gain;
1238 //int max_reg_power;
1239 //bool beacon_found;
1247 /*"center_freq:%u, "*/ \
1250 /*"max_antenna_gain:%d\n"*/ \
1251 /*"max_power:%d\n"*/ \
1252 /*"max_reg_power:%d\n"*/ \
1253 /*"beacon_found:%u\n"*/ \
1254 /*"orig_flags:0x%08x\n"*/ \
1255 /*"orig_mag:%d\n"*/ \
1256 /*"orig_mpwr:%d\n"*/
1258 #define CHAN_ARG(channel) \
1259 /*(channel)->band*/ \
1260 /*, (channel)->center_freq*/ \
1261 (channel)->hw_value \
1262 , (channel)->flags \
1263 /*, (channel)->max_antenna_gain*/ \
1264 /*, (channel)->max_power*/ \
1265 /*, (channel)->max_reg_power*/ \
1266 /*, (channel)->beacon_found*/ \
1267 /*, (channel)->orig_flags*/ \
1268 /*, (channel)->orig_mag*/ \
1269 /*, (channel)->orig_mpwr*/ \
1271 /* Parsed Information Elements */
1272 struct rtw_ieee802_11_elems {
1292 u8 ext_supp_rates_len;
1306 u8 supp_channels_len;
1313 u8 *ht_capabilities;
1314 u8 ht_capabilities_len;
1316 u8 ht_operation_len;
1318 u8 vendor_ht_cap_len;
1319 u8 *vht_capabilities;
1320 u8 vht_capabilities_len;
1322 u8 vht_operation_len;
1323 u8 *vht_op_mode_notify;
1324 u8 vht_op_mode_notify_len;
1327 typedef enum { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 } ParseRes;
1329 ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
1330 struct rtw_ieee802_11_elems *elems,
1333 u8 *rtw_set_fixed_ie(unsigned char *pbuf, unsigned int len, unsigned char *source, unsigned int *frlen);
1334 u8 *rtw_set_ie(u8 *pbuf, sint index, uint len, u8 *source, uint *frlen);
1336 enum secondary_ch_offset {
1337 SCN = 0, /* no secondary channel */
1338 SCA = 1, /* secondary channel above */
1339 SCB = 3, /* secondary channel below */
1342 u8 *rtw_get_ie(u8*pbuf, sint index, sint *len, sint limit);
1343 u8 *rtw_get_ie_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui, u8 oui_len, u8 *ie, uint *ielen);
1344 int rtw_ies_remove_ie(u8 *ies, uint *ies_len, uint offset, u8 eid, u8 *oui, u8 oui_len);
1346 void rtw_set_supported_rate(u8* SupportedRates, uint mode) ;
1348 unsigned char *rtw_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit);
1349 unsigned char *rtw_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len, int limit);
1350 int rtw_get_wpa_cipher_suite(u8 *s);
1351 int rtw_get_wpa2_cipher_suite(u8 *s);
1352 int rtw_get_wapi_ie(u8 *in_ie,uint in_len,u8 *wapi_ie,u16 *wapi_len);
1353 int rtw_parse_wpa_ie(u8* wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwise_cipher, int *is_8021x);
1354 int rtw_parse_wpa2_ie(u8* wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwise_cipher, int *is_8021x);
1356 int rtw_get_sec_ie(u8 *in_ie,uint in_len,u8 *rsn_ie,u16 *rsn_len,u8 *wpa_ie,u16 *wpa_len);
1358 u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen);
1359 u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen);
1360 u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_attr, u32 *len_attr);
1361 u8 *rtw_get_wps_attr_content(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_content, uint *len_content);
1364 * for_each_ie - iterate over continuous IEs
1369 #define for_each_ie(ie, buf, buf_len) \
1370 for (ie = (void*)buf; (((u8*)ie) - ((u8*)buf) + 1) < buf_len; ie = (void*)(((u8*)ie) + *(((u8*)ie)+1) + 2))
1372 uint rtw_get_rateset_len(u8 *rateset);
1374 struct registry_priv;
1375 int rtw_generate_ie(struct registry_priv *pregistrypriv);
1378 int rtw_get_bit_value_from_ieee_value(u8 val);
1380 uint rtw_is_cckrates_included(u8 *rate);
1382 uint rtw_is_cckratesonly_included(u8 *rate);
1384 int rtw_check_network_type(unsigned char *rate, int ratelen, int channel);
1386 void rtw_get_bcn_info(struct wlan_network *pnetwork);
1388 void rtw_macaddr_cfg(u8 *mac_addr);
1390 u16 rtw_mcs_rate(u8 rf_type, u8 bw_40MHz, u8 short_GI, unsigned char * MCS_rate);
1392 int rtw_action_frame_parse(const u8 *frame, u32 frame_len, u8* category, u8 *action);
1393 const char *action_public_str(u8 action);
1395 #endif /* IEEE80211_H */