wifi: renew patch drivers/net/wireless
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rtl8192cu / include / ieee80211.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
4  *                                        
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.
8  *
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
12  * more details.
13  *
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
17  *
18  *
19  ******************************************************************************/
20 #ifndef __IEEE80211_H
21 #define __IEEE80211_H
22
23
24 #ifndef CONFIG_RTL8711FW
25
26         #include <drv_conf.h>
27         #include <osdep_service.h>
28         #include <drv_types.h>
29         #include "wifi.h"
30
31         #if defined PLATFORM_OS_XP
32         #include <ntstrsafe.h>
33         #endif
34         #if defined PLATFORM_LINUX
35         #include <linux/wireless.h>
36         #endif
37 #else
38         
39         #include <list.h>
40
41 #endif
42
43 #define MGMT_QUEUE_NUM 5
44
45 #define ETH_ALEN        6
46 #define ETH_TYPE_LEN            2
47 #define PAYLOAD_TYPE_LEN        1
48
49 #ifdef CONFIG_AP_MODE
50
51 #define RTL_IOCTL_HOSTAPD (SIOCIWFIRSTPRIV + 28)
52
53 /* RTL871X_IOCTL_HOSTAPD ioctl() cmd: */
54 enum {
55         RTL871X_HOSTAPD_FLUSH = 1,
56         RTL871X_HOSTAPD_ADD_STA = 2,
57         RTL871X_HOSTAPD_REMOVE_STA = 3,
58         RTL871X_HOSTAPD_GET_INFO_STA = 4,
59         /* REMOVED: PRISM2_HOSTAPD_RESET_TXEXC_STA = 5, */
60         RTL871X_HOSTAPD_GET_WPAIE_STA = 5,
61         RTL871X_SET_ENCRYPTION = 6,
62         RTL871X_GET_ENCRYPTION = 7,
63         RTL871X_HOSTAPD_SET_FLAGS_STA = 8,
64         RTL871X_HOSTAPD_GET_RID = 9,
65         RTL871X_HOSTAPD_SET_RID = 10,
66         RTL871X_HOSTAPD_SET_ASSOC_AP_ADDR = 11,
67         RTL871X_HOSTAPD_SET_GENERIC_ELEMENT = 12,
68         RTL871X_HOSTAPD_MLME = 13,
69         RTL871X_HOSTAPD_SCAN_REQ = 14,
70         RTL871X_HOSTAPD_STA_CLEAR_STATS = 15,
71         RTL871X_HOSTAPD_SET_BEACON=16,
72         RTL871X_HOSTAPD_SET_WPS_BEACON = 17,
73         RTL871X_HOSTAPD_SET_WPS_PROBE_RESP = 18,
74         RTL871X_HOSTAPD_SET_WPS_ASSOC_RESP = 19,
75         RTL871X_HOSTAPD_SET_HIDDEN_SSID = 20,
76         RTL871X_HOSTAPD_SET_MACADDR_ACL = 21,
77         RTL871X_HOSTAPD_ACL_ADD_STA = 22,
78         RTL871X_HOSTAPD_ACL_REMOVE_STA = 23,
79 };
80
81 /* STA flags */
82 #define WLAN_STA_AUTH BIT(0)
83 #define WLAN_STA_ASSOC BIT(1)
84 #define WLAN_STA_PS BIT(2)
85 #define WLAN_STA_TIM BIT(3)
86 #define WLAN_STA_PERM BIT(4)
87 #define WLAN_STA_AUTHORIZED BIT(5)
88 #define WLAN_STA_PENDING_POLL BIT(6) /* pending activity poll not ACKed */
89 #define WLAN_STA_SHORT_PREAMBLE BIT(7)
90 #define WLAN_STA_PREAUTH BIT(8)
91 #define WLAN_STA_WME BIT(9)
92 #define WLAN_STA_MFP BIT(10)
93 #define WLAN_STA_HT BIT(11)
94 #define WLAN_STA_WPS BIT(12)
95 #define WLAN_STA_MAYBE_WPS BIT(13)
96 #define WLAN_STA_NONERP BIT(31)
97
98 #endif
99
100 #define IEEE_CMD_SET_WPA_PARAM                  1
101 #define IEEE_CMD_SET_WPA_IE                             2
102 #define IEEE_CMD_SET_ENCRYPTION                 3
103 #define IEEE_CMD_MLME                                           4
104
105 #define IEEE_PARAM_WPA_ENABLED                          1
106 #define IEEE_PARAM_TKIP_COUNTERMEASURES         2
107 #define IEEE_PARAM_DROP_UNENCRYPTED                     3
108 #define IEEE_PARAM_PRIVACY_INVOKED                      4
109 #define IEEE_PARAM_AUTH_ALGS                                    5
110 #define IEEE_PARAM_IEEE_802_1X                          6
111 #define IEEE_PARAM_WPAX_SELECT                          7
112
113 #define AUTH_ALG_OPEN_SYSTEM                    0x1
114 #define AUTH_ALG_SHARED_KEY                     0x2
115 #define AUTH_ALG_LEAP                           0x00000004
116
117 #define IEEE_MLME_STA_DEAUTH                            1
118 #define IEEE_MLME_STA_DISASSOC                  2
119
120 #define IEEE_CRYPT_ERR_UNKNOWN_ALG                      2
121 #define IEEE_CRYPT_ERR_UNKNOWN_ADDR                     3
122 #define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED                4
123 #define IEEE_CRYPT_ERR_KEY_SET_FAILED                   5
124 #define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED                6
125 #define IEEE_CRYPT_ERR_CARD_CONF_FAILED         7
126
127
128 #define IEEE_CRYPT_ALG_NAME_LEN                 16
129
130 #define WPA_CIPHER_NONE         BIT(0)
131 #define WPA_CIPHER_WEP40        BIT(1)
132 #define WPA_CIPHER_WEP104 BIT(2)
133 #define WPA_CIPHER_TKIP         BIT(3)
134 #define WPA_CIPHER_CCMP         BIT(4)
135
136
137
138 #define WPA_SELECTOR_LEN 4
139 extern u8 RTW_WPA_OUI_TYPE[] ;
140 extern u16 RTW_WPA_VERSION ;
141 extern u8 WPA_AUTH_KEY_MGMT_NONE[];
142 extern u8 WPA_AUTH_KEY_MGMT_UNSPEC_802_1X[];
143 extern u8 WPA_AUTH_KEY_MGMT_PSK_OVER_802_1X[];
144 extern u8 WPA_CIPHER_SUITE_NONE[];
145 extern u8 WPA_CIPHER_SUITE_WEP40[];
146 extern u8 WPA_CIPHER_SUITE_TKIP[];
147 extern u8 WPA_CIPHER_SUITE_WRAP[];
148 extern u8 WPA_CIPHER_SUITE_CCMP[];
149 extern u8 WPA_CIPHER_SUITE_WEP104[];
150
151
152 #define RSN_HEADER_LEN 4
153 #define RSN_SELECTOR_LEN 4
154
155 extern u16 RSN_VERSION_BSD;
156 extern u8 RSN_AUTH_KEY_MGMT_UNSPEC_802_1X[];
157 extern u8 RSN_AUTH_KEY_MGMT_PSK_OVER_802_1X[];
158 extern u8 RSN_CIPHER_SUITE_NONE[];
159 extern u8 RSN_CIPHER_SUITE_WEP40[];
160 extern u8 RSN_CIPHER_SUITE_TKIP[];
161 extern u8 RSN_CIPHER_SUITE_WRAP[];
162 extern u8 RSN_CIPHER_SUITE_CCMP[];
163 extern u8 RSN_CIPHER_SUITE_WEP104[];
164
165 typedef enum _RATR_TABLE_MODE{
166         RATR_INX_WIRELESS_NGB = 0,      // BGN 40 Mhz 2SS 1SS
167         RATR_INX_WIRELESS_NG = 1,               // GN or N
168         RATR_INX_WIRELESS_NB = 2,               // BGN 20 Mhz 2SS 1SS  or BN
169         RATR_INX_WIRELESS_N = 3,
170         RATR_INX_WIRELESS_GB = 4,
171         RATR_INX_WIRELESS_G = 5,
172         RATR_INX_WIRELESS_B = 6,
173         RATR_INX_WIRELESS_MC = 7,
174         RATR_INX_WIRELESS_AC_N = 8,
175 }RATR_TABLE_MODE, *PRATR_TABLE_MODE;
176
177 enum NETWORK_TYPE
178 {
179     WIRELESS_INVALID = 0,
180     //Sub-Element
181     WIRELESS_11B = BIT(0), // tx: cck only , rx: cck only, hw: cck
182     WIRELESS_11G = BIT(1), // tx: ofdm only, rx: ofdm & cck, hw: cck & ofdm
183     WIRELESS_11A = BIT(2), // tx: ofdm only, rx: ofdm only, hw: ofdm only
184     WIRELESS_11_24N = BIT(3), // tx: MCS only, rx: MCS & cck, hw: MCS & cck
185     WIRELESS_11_5N = BIT(4), // tx: MCS only, rx: MCS & ofdm, hw: ofdm only
186         //WIRELESS_AUTO         = BIT(5), 
187         WIRELESS_AC             = BIT(6), 
188
189     //Combination
190     WIRELESS_11BG = (WIRELESS_11B|WIRELESS_11G), // tx: cck & ofdm, rx: cck & ofdm & MCS, hw: cck & ofdm
191     WIRELESS_11G_24N = (WIRELESS_11G|WIRELESS_11_24N), // tx: ofdm & MCS, rx: ofdm & cck & MCS, hw: cck & ofdm
192     WIRELESS_11A_5N = (WIRELESS_11A|WIRELESS_11_5N), // tx: ofdm & MCS, rx: ofdm & MCS, hw: ofdm only
193     WIRELESS_11BG_24N = (WIRELESS_11B|WIRELESS_11G|WIRELESS_11_24N), // tx: ofdm & cck & MCS, rx: ofdm & cck & MCS, hw: ofdm & cck
194     WIRELESS_11AGN = (WIRELESS_11A|WIRELESS_11G|WIRELESS_11_24N|WIRELESS_11_5N), // tx: ofdm & MCS, rx: ofdm & MCS, hw: ofdm only
195     WIRELESS_11ABGN = (WIRELESS_11A|WIRELESS_11B|WIRELESS_11G|WIRELESS_11_24N|WIRELESS_11_5N),
196 };
197
198 #define SUPPORTED_24G_NETTYPE_MSK (WIRELESS_11B | WIRELESS_11G | WIRELESS_11_24N)
199 #define SUPPORTED_5G_NETTYPE_MSK (WIRELESS_11A | WIRELESS_11_5N)
200
201 #define IsSupported24G(NetType) ((NetType) & SUPPORTED_24G_NETTYPE_MSK ? _TRUE : _FALSE)
202 #define IsSupported5G(NetType) ((NetType) & SUPPORTED_5G_NETTYPE_MSK ? _TRUE : _FALSE)
203
204 #define IsEnableHWCCK(NetType) IsSupported24G(NetType)
205 #define IsEnableHWOFDM(NetType) ((NetType) & (WIRELESS_11G|WIRELESS_11_24N|SUPPORTED_5G_NETTYPE_MSK) ? _TRUE : _FALSE)
206
207 #define IsSupportedRxCCK(NetType) IsEnableHWCCK(NetType)
208 #define IsSupportedRxOFDM(NetType) IsEnableHWOFDM(NetType)
209 #define IsSupportedRxMCS(NetType) IsEnableHWOFDM(NetType)
210
211 #define IsSupportedTxCCK(NetType) ((NetType) & (WIRELESS_11B) ? _TRUE : _FALSE)
212 #define IsSupportedTxOFDM(NetType) ((NetType) & (WIRELESS_11G|WIRELESS_11A) ? _TRUE : _FALSE)
213 #define IsSupportedTxMCS(NetType) ((NetType) & (WIRELESS_11_24N|WIRELESS_11_5N) ? _TRUE : _FALSE) 
214
215
216 typedef struct ieee_param {
217         u32 cmd;
218         u8 sta_addr[ETH_ALEN];
219         union {
220                 struct {
221                         u8 name;
222                         u32 value;
223                 } wpa_param;
224                 struct {
225                         u32 len;
226                         u8 reserved[32];
227                         u8 data[0];
228                 } wpa_ie;
229                 struct{
230                         int command;
231                         int reason_code;
232                 } mlme;
233                 struct {
234                         u8 alg[IEEE_CRYPT_ALG_NAME_LEN];
235                         u8 set_tx;
236                         u32 err;
237                         u8 idx;
238                         u8 seq[8]; /* sequence counter (set: RX, get: TX) */
239                         u16 key_len;
240                         u8 key[0];
241                 } crypt;
242 #ifdef CONFIG_AP_MODE
243                 struct {
244                         u16 aid;
245                         u16 capability;
246                         int flags;
247                         u8 tx_supp_rates[16];           
248                         struct rtw_ieee80211_ht_cap ht_cap;
249                 } add_sta;
250                 struct {
251                         u8      reserved[2];//for set max_num_sta
252                         u8      buf[0];
253                 } bcn_ie;
254 #endif
255
256         } u;       
257 }ieee_param;
258
259 #ifdef CONFIG_AP_MODE
260 typedef struct ieee_param_ex {
261         u32 cmd;
262         u8 sta_addr[ETH_ALEN];
263         u8 data[0];
264 }ieee_param_ex;
265
266 struct sta_data{
267         u16 aid;
268         u16 capability;
269         int flags;
270         u32 sta_set;
271         u8 tx_supp_rates[16];   
272         u32 tx_supp_rates_len;
273         struct rtw_ieee80211_ht_cap ht_cap;
274         u64     rx_pkts;
275         u64     rx_bytes;
276         u64     rx_drops;
277         u64     tx_pkts;
278         u64     tx_bytes;
279         u64     tx_drops;
280 };
281 #endif
282
283
284 #if WIRELESS_EXT < 17
285 #define IW_QUAL_QUAL_INVALID   0x10
286 #define IW_QUAL_LEVEL_INVALID  0x20
287 #define IW_QUAL_NOISE_INVALID  0x40
288 #define IW_QUAL_QUAL_UPDATED   0x1
289 #define IW_QUAL_LEVEL_UPDATED  0x2
290 #define IW_QUAL_NOISE_UPDATED  0x4
291 #endif
292
293 #define IEEE80211_DATA_LEN              2304
294 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
295    6.2.1.1.2.
296
297    The figure in section 7.1.2 suggests a body size of up to 2312
298    bytes is allowed, which is a bit confusing, I suspect this
299    represents the 2304 bytes of real data, plus a possible 8 bytes of
300    WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
301
302
303 #define IEEE80211_HLEN                  30
304 #define IEEE80211_FRAME_LEN             (IEEE80211_DATA_LEN + IEEE80211_HLEN)
305
306
307 /* this is stolen from ipw2200 driver */
308 #define IEEE_IBSS_MAC_HASH_SIZE 31
309
310 struct ieee_ibss_seq {
311         u8 mac[ETH_ALEN];
312         u16 seq_num;
313         u16 frag_num;
314         unsigned long packet_time;
315         _list   list;
316 };
317
318 #if defined(PLATFORM_LINUX) || defined(CONFIG_RTL8711FW)||defined(PLATFORM_FREEBSD) 
319
320 struct rtw_ieee80211_hdr {
321         u16 frame_ctl;
322         u16 duration_id;
323         u8 addr1[ETH_ALEN];
324         u8 addr2[ETH_ALEN];
325         u8 addr3[ETH_ALEN];
326         u16 seq_ctl;
327         u8 addr4[ETH_ALEN];
328 } __attribute__ ((packed));
329
330 struct rtw_ieee80211_hdr_3addr {
331         u16 frame_ctl;
332         u16 duration_id;
333         u8 addr1[ETH_ALEN];
334         u8 addr2[ETH_ALEN];
335         u8 addr3[ETH_ALEN];
336         u16 seq_ctl;
337 } __attribute__ ((packed));
338
339
340 struct rtw_ieee80211_hdr_qos {
341         u16 frame_ctl;
342         u16 duration_id;
343         u8 addr1[ETH_ALEN];
344         u8 addr2[ETH_ALEN];
345         u8 addr3[ETH_ALEN];
346         u16 seq_ctl;
347         u8 addr4[ETH_ALEN];
348         u16     qc;
349 }  __attribute__ ((packed));
350
351 struct rtw_ieee80211_hdr_3addr_qos {
352         u16 frame_ctl;
353         u16 duration_id;
354         u8 addr1[ETH_ALEN];
355         u8 addr2[ETH_ALEN];
356         u8 addr3[ETH_ALEN];
357         u16 seq_ctl;
358        u16     qc;
359 }  __attribute__ ((packed));
360
361 struct eapol {
362         u8 snap[6];
363         u16 ethertype;
364         u8 version;
365         u8 type;
366         u16 length;
367 } __attribute__ ((packed));
368
369 #endif
370
371
372
373 #ifdef PLATFORM_WINDOWS
374
375 #pragma pack(1)
376 struct rtw_ieee80211_hdr {
377         u16 frame_ctl;
378         u16 duration_id;
379         u8 addr1[ETH_ALEN];
380         u8 addr2[ETH_ALEN];
381         u8 addr3[ETH_ALEN];
382         u16 seq_ctl;
383         u8 addr4[ETH_ALEN];
384 };
385
386 struct rtw_ieee80211_hdr_3addr {
387         u16 frame_ctl;
388         u16 duration_id;
389         u8 addr1[ETH_ALEN];
390         u8 addr2[ETH_ALEN];
391         u8 addr3[ETH_ALEN];
392         u16 seq_ctl;
393 };
394
395
396 struct rtw_ieee80211_hdr_qos {
397         struct rtw_ieee80211_hdr wlan_hdr;
398         u16     qc;
399 };
400
401 struct rtw_ieee80211_hdr_3addr_qos {
402         struct  rtw_ieee80211_hdr_3addr wlan_hdr;
403         u16     qc;
404 };
405
406 struct eapol {
407         u8 snap[6];
408         u16 ethertype;
409         u8 version;
410         u8 type;
411         u16 length;
412 };
413 #pragma pack()
414
415 #endif
416
417
418
419 enum eap_type {
420         EAP_PACKET = 0,
421         EAPOL_START,
422         EAPOL_LOGOFF,
423         EAPOL_KEY,
424         EAPOL_ENCAP_ASF_ALERT
425 };
426
427 #define IEEE80211_3ADDR_LEN 24
428 #define IEEE80211_4ADDR_LEN 30
429 #define IEEE80211_FCS_LEN    4
430
431 #define MIN_FRAG_THRESHOLD     256U
432 #define MAX_FRAG_THRESHOLD     2346U
433
434 /* Frame control field constants */
435 #define RTW_IEEE80211_FCTL_VERS         0x0003
436 #define RTW_IEEE80211_FCTL_FTYPE                0x000c
437 #define RTW_IEEE80211_FCTL_STYPE                0x00f0
438 #define RTW_IEEE80211_FCTL_TODS         0x0100
439 #define RTW_IEEE80211_FCTL_FROMDS       0x0200
440 #define RTW_IEEE80211_FCTL_MOREFRAGS    0x0400
441 #define RTW_IEEE80211_FCTL_RETRY                0x0800
442 #define RTW_IEEE80211_FCTL_PM           0x1000
443 #define RTW_IEEE80211_FCTL_MOREDATA     0x2000
444 #define RTW_IEEE80211_FCTL_PROTECTED    0x4000
445 #define RTW_IEEE80211_FCTL_ORDER                0x8000
446 #define RTW_IEEE80211_FCTL_CTL_EXT      0x0f00
447
448 #define RTW_IEEE80211_FTYPE_MGMT                0x0000
449 #define RTW_IEEE80211_FTYPE_CTL         0x0004
450 #define RTW_IEEE80211_FTYPE_DATA                0x0008
451 #define RTW_IEEE80211_FTYPE_EXT         0x000c
452
453 /* management */
454 #define RTW_IEEE80211_STYPE_ASSOC_REQ   0x0000
455 #define RTW_IEEE80211_STYPE_ASSOC_RESP  0x0010
456 #define RTW_IEEE80211_STYPE_REASSOC_REQ 0x0020
457 #define RTW_IEEE80211_STYPE_REASSOC_RESP        0x0030
458 #define RTW_IEEE80211_STYPE_PROBE_REQ   0x0040
459 #define RTW_IEEE80211_STYPE_PROBE_RESP  0x0050
460 #define RTW_IEEE80211_STYPE_BEACON              0x0080
461 #define RTW_IEEE80211_STYPE_ATIM                0x0090
462 #define RTW_IEEE80211_STYPE_DISASSOC    0x00A0
463 #define RTW_IEEE80211_STYPE_AUTH                0x00B0
464 #define RTW_IEEE80211_STYPE_DEAUTH              0x00C0
465 #define RTW_IEEE80211_STYPE_ACTION              0x00D0
466
467 /* control */
468 #define RTW_IEEE80211_STYPE_CTL_EXT             0x0060
469 #define RTW_IEEE80211_STYPE_BACK_REQ            0x0080
470 #define RTW_IEEE80211_STYPE_BACK                0x0090
471 #define RTW_IEEE80211_STYPE_PSPOLL              0x00A0
472 #define RTW_IEEE80211_STYPE_RTS         0x00B0
473 #define RTW_IEEE80211_STYPE_CTS         0x00C0
474 #define RTW_IEEE80211_STYPE_ACK         0x00D0
475 #define RTW_IEEE80211_STYPE_CFEND               0x00E0
476 #define RTW_IEEE80211_STYPE_CFENDACK            0x00F0
477
478 /* data */
479 #define RTW_IEEE80211_STYPE_DATA                0x0000
480 #define RTW_IEEE80211_STYPE_DATA_CFACK  0x0010
481 #define RTW_IEEE80211_STYPE_DATA_CFPOLL 0x0020
482 #define RTW_IEEE80211_STYPE_DATA_CFACKPOLL      0x0030
483 #define RTW_IEEE80211_STYPE_NULLFUNC    0x0040
484 #define RTW_IEEE80211_STYPE_CFACK               0x0050
485 #define RTW_IEEE80211_STYPE_CFPOLL              0x0060
486 #define RTW_IEEE80211_STYPE_CFACKPOLL   0x0070
487 #define RTW_IEEE80211_STYPE_QOS_DATA            0x0080
488 #define RTW_IEEE80211_STYPE_QOS_DATA_CFACK              0x0090
489 #define RTW_IEEE80211_STYPE_QOS_DATA_CFPOLL             0x00A0
490 #define RTW_IEEE80211_STYPE_QOS_DATA_CFACKPOLL  0x00B0
491 #define RTW_IEEE80211_STYPE_QOS_NULLFUNC        0x00C0
492 #define RTW_IEEE80211_STYPE_QOS_CFACK           0x00D0
493 #define RTW_IEEE80211_STYPE_QOS_CFPOLL          0x00E0
494 #define RTW_IEEE80211_STYPE_QOS_CFACKPOLL       0x00F0
495
496 /* sequence control field */
497 #define RTW_IEEE80211_SCTL_FRAG 0x000F
498 #define RTW_IEEE80211_SCTL_SEQ  0xFFF0
499
500
501 #define RTW_ERP_INFO_NON_ERP_PRESENT BIT(0)
502 #define RTW_ERP_INFO_USE_PROTECTION BIT(1)
503 #define RTW_ERP_INFO_BARKER_PREAMBLE_MODE BIT(2)
504
505 /* QoS,QOS */
506 #define NORMAL_ACK                      0
507 #define NO_ACK                          1
508 #define NON_EXPLICIT_ACK        2
509 #define BLOCK_ACK                       3
510
511 #ifndef ETH_P_PAE
512 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
513 #endif /* ETH_P_PAE */
514
515 #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
516
517 #define ETH_P_ECONET    0x0018
518
519 #ifndef ETH_P_80211_RAW
520 #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
521 #endif
522
523 /* IEEE 802.11 defines */
524
525 #define P80211_OUI_LEN 3
526
527 #if defined(PLATFORM_LINUX) || defined(CONFIG_RTL8711FW) || defined(PLATFORM_FREEBSD)
528
529 struct ieee80211_snap_hdr {
530
531         u8    dsap;   /* always 0xAA */
532         u8    ssap;   /* always 0xAA */
533         u8    ctrl;   /* always 0x03 */
534         u8    oui[P80211_OUI_LEN];    /* organizational universal id */
535
536 } __attribute__ ((packed));
537
538 #endif
539
540 #ifdef PLATFORM_WINDOWS
541
542 #pragma pack(1)
543 struct ieee80211_snap_hdr {
544
545         u8    dsap;   /* always 0xAA */
546         u8    ssap;   /* always 0xAA */
547         u8    ctrl;   /* always 0x03 */
548         u8    oui[P80211_OUI_LEN];    /* organizational universal id */
549
550 };
551 #pragma pack()
552
553 #endif
554
555
556 #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
557
558 #define WLAN_FC_GET_TYPE(fc) ((fc) & RTW_IEEE80211_FCTL_FTYPE)
559 #define WLAN_FC_GET_STYPE(fc) ((fc) & RTW_IEEE80211_FCTL_STYPE)
560
561 #define WLAN_QC_GET_TID(qc) ((qc) & 0x0f)
562
563 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & RTW_IEEE80211_SCTL_FRAG)
564 #define WLAN_GET_SEQ_SEQ(seq)  ((seq) & RTW_IEEE80211_SCTL_SEQ)
565
566 /* Authentication algorithms */
567 #define WLAN_AUTH_OPEN 0
568 #define WLAN_AUTH_SHARED_KEY 1
569
570 #define WLAN_AUTH_CHALLENGE_LEN 128
571
572 #define WLAN_CAPABILITY_BSS (1<<0)
573 #define WLAN_CAPABILITY_IBSS (1<<1)
574 #define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
575 #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
576 #define WLAN_CAPABILITY_PRIVACY (1<<4)
577 #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
578 #define WLAN_CAPABILITY_PBCC (1<<6)
579 #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
580 #define WLAN_CAPABILITY_SHORT_SLOT (1<<10)
581
582 /* Status codes */
583 #define WLAN_STATUS_SUCCESS 0
584 #define WLAN_STATUS_UNSPECIFIED_FAILURE 1
585 #define WLAN_STATUS_CAPS_UNSUPPORTED 10
586 #define WLAN_STATUS_REASSOC_NO_ASSOC 11
587 #define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
588 #define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
589 #define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
590 #define WLAN_STATUS_CHALLENGE_FAIL 15
591 #define WLAN_STATUS_AUTH_TIMEOUT 16
592 #define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
593 #define WLAN_STATUS_ASSOC_DENIED_RATES 18
594 /* 802.11b */
595 #define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
596 #define WLAN_STATUS_ASSOC_DENIED_NOPBCC 20
597 #define WLAN_STATUS_ASSOC_DENIED_NOAGILITY 21
598
599 /* Reason codes */
600 #define WLAN_REASON_UNSPECIFIED 1
601 #define WLAN_REASON_PREV_AUTH_NOT_VALID 2
602 #define WLAN_REASON_DEAUTH_LEAVING 3
603 #define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
604 #define WLAN_REASON_DISASSOC_AP_BUSY 5
605 #define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
606 #define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
607 #define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
608 #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
609 #define WLAN_REASON_JOIN_WRONG_CHANNEL       65534
610 #define WLAN_REASON_EXPIRATION_CHK 65535
611
612 /* Information Element IDs */
613 #define WLAN_EID_SSID 0
614 #define WLAN_EID_SUPP_RATES 1
615 #define WLAN_EID_FH_PARAMS 2
616 #define WLAN_EID_DS_PARAMS 3
617 #define WLAN_EID_CF_PARAMS 4
618 #define WLAN_EID_TIM 5
619 #define WLAN_EID_IBSS_PARAMS 6
620 #define WLAN_EID_CHALLENGE 16
621 /* EIDs defined by IEEE 802.11h - START */
622 #define WLAN_EID_PWR_CONSTRAINT 32
623 #define WLAN_EID_PWR_CAPABILITY 33
624 #define WLAN_EID_TPC_REQUEST 34
625 #define WLAN_EID_TPC_REPORT 35
626 #define WLAN_EID_SUPPORTED_CHANNELS 36
627 #define WLAN_EID_CHANNEL_SWITCH 37
628 #define WLAN_EID_MEASURE_REQUEST 38
629 #define WLAN_EID_MEASURE_REPORT 39
630 #define WLAN_EID_QUITE 40
631 #define WLAN_EID_IBSS_DFS 41
632 /* EIDs defined by IEEE 802.11h - END */
633 #define WLAN_EID_ERP_INFO 42
634 #define WLAN_EID_HT_CAP 45
635 #define WLAN_EID_RSN 48
636 #define WLAN_EID_EXT_SUPP_RATES 50
637 #define WLAN_EID_MOBILITY_DOMAIN 54
638 #define WLAN_EID_FAST_BSS_TRANSITION 55
639 #define WLAN_EID_TIMEOUT_INTERVAL 56
640 #define WLAN_EID_RIC_DATA 57
641 #define WLAN_EID_HT_OPERATION 61
642 #define WLAN_EID_SECONDARY_CHANNEL_OFFSET 62
643 #define WLAN_EID_20_40_BSS_COEXISTENCE 72
644 #define WLAN_EID_20_40_BSS_INTOLERANT 73
645 #define WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS 74
646 #define WLAN_EID_MMIE 76
647 #define WLAN_EID_VENDOR_SPECIFIC 221
648 #define WLAN_EID_GENERIC (WLAN_EID_VENDOR_SPECIFIC)
649
650 #define IEEE80211_MGMT_HDR_LEN 24
651 #define IEEE80211_DATA_HDR3_LEN 24
652 #define IEEE80211_DATA_HDR4_LEN 30
653
654
655 #define IEEE80211_STATMASK_SIGNAL (1<<0)
656 #define IEEE80211_STATMASK_RSSI (1<<1)
657 #define IEEE80211_STATMASK_NOISE (1<<2)
658 #define IEEE80211_STATMASK_RATE (1<<3)
659 #define IEEE80211_STATMASK_WEMASK 0x7
660
661
662 #define IEEE80211_CCK_MODULATION    (1<<0)
663 #define IEEE80211_OFDM_MODULATION   (1<<1)
664
665 #define IEEE80211_24GHZ_BAND     (1<<0)
666 #define IEEE80211_52GHZ_BAND     (1<<1)
667
668 #define IEEE80211_CCK_RATE_LEN                  4
669 #define IEEE80211_NUM_OFDM_RATESLEN     8
670
671
672 #define IEEE80211_CCK_RATE_1MB                  0x02
673 #define IEEE80211_CCK_RATE_2MB                  0x04
674 #define IEEE80211_CCK_RATE_5MB                  0x0B
675 #define IEEE80211_CCK_RATE_11MB                 0x16
676 #define IEEE80211_OFDM_RATE_LEN                 8
677 #define IEEE80211_OFDM_RATE_6MB                 0x0C
678 #define IEEE80211_OFDM_RATE_9MB                 0x12
679 #define IEEE80211_OFDM_RATE_12MB                0x18
680 #define IEEE80211_OFDM_RATE_18MB                0x24
681 #define IEEE80211_OFDM_RATE_24MB                0x30
682 #define IEEE80211_OFDM_RATE_36MB                0x48
683 #define IEEE80211_OFDM_RATE_48MB                0x60
684 #define IEEE80211_OFDM_RATE_54MB                0x6C
685 #define IEEE80211_BASIC_RATE_MASK               0x80
686
687 #define IEEE80211_CCK_RATE_1MB_MASK             (1<<0)
688 #define IEEE80211_CCK_RATE_2MB_MASK             (1<<1)
689 #define IEEE80211_CCK_RATE_5MB_MASK             (1<<2)
690 #define IEEE80211_CCK_RATE_11MB_MASK            (1<<3)
691 #define IEEE80211_OFDM_RATE_6MB_MASK            (1<<4)
692 #define IEEE80211_OFDM_RATE_9MB_MASK            (1<<5)
693 #define IEEE80211_OFDM_RATE_12MB_MASK           (1<<6)
694 #define IEEE80211_OFDM_RATE_18MB_MASK           (1<<7)
695 #define IEEE80211_OFDM_RATE_24MB_MASK           (1<<8)
696 #define IEEE80211_OFDM_RATE_36MB_MASK           (1<<9)
697 #define IEEE80211_OFDM_RATE_48MB_MASK           (1<<10)
698 #define IEEE80211_OFDM_RATE_54MB_MASK           (1<<11)
699
700 #define IEEE80211_CCK_RATES_MASK                0x0000000F
701 #define IEEE80211_CCK_BASIC_RATES_MASK  (IEEE80211_CCK_RATE_1MB_MASK | \
702         IEEE80211_CCK_RATE_2MB_MASK)
703 #define IEEE80211_CCK_DEFAULT_RATES_MASK        (IEEE80211_CCK_BASIC_RATES_MASK | \
704         IEEE80211_CCK_RATE_5MB_MASK | \
705         IEEE80211_CCK_RATE_11MB_MASK)
706
707 #define IEEE80211_OFDM_RATES_MASK               0x00000FF0
708 #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \
709         IEEE80211_OFDM_RATE_12MB_MASK | \
710         IEEE80211_OFDM_RATE_24MB_MASK)
711 #define IEEE80211_OFDM_DEFAULT_RATES_MASK       (IEEE80211_OFDM_BASIC_RATES_MASK | \
712         IEEE80211_OFDM_RATE_9MB_MASK  | \
713         IEEE80211_OFDM_RATE_18MB_MASK | \
714         IEEE80211_OFDM_RATE_36MB_MASK | \
715         IEEE80211_OFDM_RATE_48MB_MASK | \
716         IEEE80211_OFDM_RATE_54MB_MASK)
717 #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
718                                 IEEE80211_CCK_DEFAULT_RATES_MASK)
719
720 #define IEEE80211_NUM_OFDM_RATES            8
721 #define IEEE80211_NUM_CCK_RATES             4
722 #define IEEE80211_OFDM_SHIFT_MASK_A         4
723
724
725
726
727 /* NOTE: This data is for statistical purposes; not all hardware provides this
728  *       information for frames received.  Not setting these will not cause
729  *       any adverse affects. */
730 struct ieee80211_rx_stats {
731         //u32 mac_time[2];
732         s8 rssi;
733         u8 signal;
734         u8 noise;
735         u8 received_channel;
736         u16 rate; /* in 100 kbps */
737         //u8 control;
738         u8 mask;
739         u8 freq;
740         u16 len;
741 };
742
743 /* IEEE 802.11 requires that STA supports concurrent reception of at least
744  * three fragmented frames. This define can be increased to support more
745  * concurrent frames, but it should be noted that each entry can consume about
746  * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
747 #define IEEE80211_FRAG_CACHE_LEN 4
748
749 struct ieee80211_frag_entry {
750         u32 first_frag_time;
751         uint seq;
752         uint last_frag;
753         uint qos;   //jackson
754         uint tid;       //jackson
755         struct sk_buff *skb;
756         u8 src_addr[ETH_ALEN];
757         u8 dst_addr[ETH_ALEN];
758 };
759
760 #ifndef PLATFORM_FREEBSD //Baron BSD has already defined
761 struct ieee80211_stats {
762         uint tx_unicast_frames;
763         uint tx_multicast_frames;
764         uint tx_fragments;
765         uint tx_unicast_octets;
766         uint tx_multicast_octets;
767         uint tx_deferred_transmissions;
768         uint tx_single_retry_frames;
769         uint tx_multiple_retry_frames;
770         uint tx_retry_limit_exceeded;
771         uint tx_discards;
772         uint rx_unicast_frames;
773         uint rx_multicast_frames;
774         uint rx_fragments;
775         uint rx_unicast_octets;
776         uint rx_multicast_octets;
777         uint rx_fcs_errors;
778         uint rx_discards_no_buffer;
779         uint tx_discards_wrong_sa;
780         uint rx_discards_undecryptable;
781         uint rx_message_in_msg_fragments;
782         uint rx_message_in_bad_msg_fragments;
783 };
784 #endif //PLATFORM_FREEBSD
785 struct ieee80211_softmac_stats{
786         uint rx_ass_ok;
787         uint rx_ass_err;
788         uint rx_probe_rq;
789         uint tx_probe_rs;
790         uint tx_beacons;
791         uint rx_auth_rq;
792         uint rx_auth_rs_ok;
793         uint rx_auth_rs_err;
794         uint tx_auth_rq;
795         uint no_auth_rs;
796         uint no_ass_rs;
797         uint tx_ass_rq;
798         uint rx_ass_rq;
799         uint tx_probe_rq;
800         uint reassoc;
801         uint swtxstop;
802         uint swtxawake;
803 };
804
805 #define SEC_KEY_1         (1<<0)
806 #define SEC_KEY_2         (1<<1)
807 #define SEC_KEY_3         (1<<2)
808 #define SEC_KEY_4         (1<<3)
809 #define SEC_ACTIVE_KEY    (1<<4)
810 #define SEC_AUTH_MODE     (1<<5)
811 #define SEC_UNICAST_GROUP (1<<6)
812 #define SEC_LEVEL         (1<<7)
813 #define SEC_ENABLED       (1<<8)
814
815 #define SEC_LEVEL_0      0 /* None */
816 #define SEC_LEVEL_1      1 /* WEP 40 and 104 bit */
817 #define SEC_LEVEL_2      2 /* Level 1 + TKIP */
818 #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
819 #define SEC_LEVEL_3      4 /* Level 2 + CCMP */
820
821 #define WEP_KEYS 4
822 #define WEP_KEY_LEN 13
823
824 #ifdef CONFIG_IEEE80211W
825 #define BIP_MAX_KEYID 5
826 #define BIP_AAD_SIZE  20
827 #endif //CONFIG_IEEE80211W
828
829 #if defined(PLATFORM_LINUX) || defined(CONFIG_RTL8711FW)
830
831 struct ieee80211_security {
832         u16 active_key:2,
833             enabled:1,
834             auth_mode:2,
835             auth_algo:4,
836             unicast_uses_group:1;
837         u8 key_sizes[WEP_KEYS];
838         u8 keys[WEP_KEYS][WEP_KEY_LEN];
839         u8 level;
840         u16 flags;
841 } __attribute__ ((packed));
842
843 #endif
844
845 #ifdef PLATFORM_WINDOWS
846
847 #pragma pack(1)
848 struct ieee80211_security {
849         u16 active_key:2,
850             enabled:1,
851             auth_mode:2,
852             auth_algo:4,
853             unicast_uses_group:1;
854         u8 key_sizes[WEP_KEYS];
855         u8 keys[WEP_KEYS][WEP_KEY_LEN];
856         u8 level;
857         u16 flags;
858 } ;
859 #pragma pack()
860
861 #endif
862
863 /*
864
865  802.11 data frame from AP
866
867       ,-------------------------------------------------------------------.
868 Bytes |  2   |  2   |    6    |    6    |    6    |  2   | 0..2312 |   4  |
869       |------|------|---------|---------|---------|------|---------|------|
870 Desc. | ctrl | dura |  DA/RA  |   TA    |    SA   | Sequ |  frame  |  fcs |
871       |      | tion | (BSSID) |         |         | ence |  data   |      |
872       `-------------------------------------------------------------------'
873
874 Total: 28-2340 bytes
875
876 */
877
878 struct ieee80211_header_data {
879         u16 frame_ctl;
880         u16 duration_id;
881         u8 addr1[6];
882         u8 addr2[6];
883         u8 addr3[6];
884         u16 seq_ctrl;
885 };
886
887 #define BEACON_PROBE_SSID_ID_POSITION 12
888
889 /* Management Frame Information Element Types */
890 #define MFIE_TYPE_SSID       0
891 #define MFIE_TYPE_RATES      1
892 #define MFIE_TYPE_FH_SET     2
893 #define MFIE_TYPE_DS_SET     3
894 #define MFIE_TYPE_CF_SET     4
895 #define MFIE_TYPE_TIM        5
896 #define MFIE_TYPE_IBSS_SET   6
897 #define MFIE_TYPE_CHALLENGE  16
898 #define MFIE_TYPE_ERP        42
899 #define MFIE_TYPE_RSN        48
900 #define MFIE_TYPE_RATES_EX   50
901 #define MFIE_TYPE_GENERIC    221
902
903 #if defined(PLATFORM_LINUX) || defined(CONFIG_RTL8711FW)
904
905 struct ieee80211_info_element_hdr {
906         u8 id;
907         u8 len;
908 } __attribute__ ((packed));
909
910 struct ieee80211_info_element {
911         u8 id;
912         u8 len;
913         u8 data[0];
914 } __attribute__ ((packed));
915 #endif
916
917 #ifdef PLATFORM_WINDOWS
918
919 #pragma pack(1)
920 struct ieee80211_info_element_hdr {
921         u8 id;
922         u8 len;
923 } ;
924
925 struct ieee80211_info_element {
926         u8 id;
927         u8 len;
928         u8 data[0];
929 } ;
930 #pragma pack()
931
932 #endif
933
934
935 /*
936  * These are the data types that can make up management packets
937  *
938         u16 auth_algorithm;
939         u16 auth_sequence;
940         u16 beacon_interval;
941         u16 capability;
942         u8 current_ap[ETH_ALEN];
943         u16 listen_interval;
944         struct {
945                 u16 association_id:14, reserved:2;
946         } __attribute__ ((packed));
947         u32 time_stamp[2];
948         u16 reason;
949         u16 status;
950 */
951
952 #define IEEE80211_DEFAULT_TX_ESSID "Penguin"
953 #define IEEE80211_DEFAULT_BASIC_RATE 10
954
955
956 #if defined(PLATFORM_LINUX) || defined(CONFIG_RTL8711FW)
957
958
959 struct ieee80211_authentication {
960         struct ieee80211_header_data header;
961         u16 algorithm;
962         u16 transaction;
963         u16 status;
964         //struct ieee80211_info_element_hdr info_element;
965 } __attribute__ ((packed));
966
967
968 struct ieee80211_probe_response {
969         struct ieee80211_header_data header;
970         u32 time_stamp[2];
971         u16 beacon_interval;
972         u16 capability;
973         struct ieee80211_info_element info_element;
974 } __attribute__ ((packed));
975
976 struct ieee80211_probe_request {
977         struct ieee80211_header_data header;
978         /*struct ieee80211_info_element info_element;*/
979 } __attribute__ ((packed));
980
981 struct ieee80211_assoc_request_frame {
982         struct rtw_ieee80211_hdr_3addr header;
983         u16 capability;
984         u16 listen_interval;
985         //u8 current_ap[ETH_ALEN];
986         struct ieee80211_info_element_hdr info_element;
987 } __attribute__ ((packed));
988
989 struct ieee80211_assoc_response_frame {
990         struct rtw_ieee80211_hdr_3addr header;
991         u16 capability;
992         u16 status;
993         u16 aid;
994 //      struct ieee80211_info_element info_element; /* supported rates */
995 } __attribute__ ((packed));
996 #endif
997
998
999
1000 #ifdef PLATFORM_WINDOWS
1001
1002 #pragma pack(1)
1003
1004 struct ieee80211_authentication {
1005         struct ieee80211_header_data header;
1006         u16 algorithm;
1007         u16 transaction;
1008         u16 status;
1009         //struct ieee80211_info_element_hdr info_element;
1010 } ;
1011
1012
1013 struct ieee80211_probe_response {
1014         struct ieee80211_header_data header;
1015         u32 time_stamp[2];
1016         u16 beacon_interval;
1017         u16 capability;
1018         struct ieee80211_info_element info_element;
1019 } ;
1020
1021 struct ieee80211_probe_request {
1022         struct ieee80211_header_data header;
1023         /*struct ieee80211_info_element info_element;*/
1024 } ;
1025
1026 struct ieee80211_assoc_request_frame {
1027         struct rtw_ieee80211_hdr_3addr header;
1028         u16 capability;
1029         u16 listen_interval;
1030         //u8 current_ap[ETH_ALEN];
1031         struct ieee80211_info_element_hdr info_element;
1032 } ;
1033
1034 struct ieee80211_assoc_response_frame {
1035         struct rtw_ieee80211_hdr_3addr header;
1036         u16 capability;
1037         u16 status;
1038         u16 aid;
1039 //      struct ieee80211_info_element info_element; /* supported rates */
1040 };
1041
1042 #pragma pack()
1043
1044 #endif
1045
1046
1047
1048
1049 struct ieee80211_txb {
1050         u8 nr_frags;
1051         u8 encrypted;
1052         u16 reserved;
1053         u16 frag_size;
1054         u16 payload_size;
1055         struct sk_buff *fragments[0];
1056 };
1057
1058
1059 /* SWEEP TABLE ENTRIES NUMBER*/
1060 #define MAX_SWEEP_TAB_ENTRIES             42
1061 #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET  7
1062 /* MAX_RATES_LENGTH needs to be 12.  The spec says 8, and many APs
1063  * only use 8, and then use extended rates for the remaining supported
1064  * rates.  Other APs, however, stick all of their supported rates on the
1065  * main rates information element... */
1066 #define MAX_RATES_LENGTH                  ((u8)12)
1067 #define MAX_RATES_EX_LENGTH               ((u8)16)
1068 #define MAX_NETWORK_COUNT                  128
1069 #define MAX_CHANNEL_NUMBER                 161
1070 #define IEEE80211_SOFTMAC_SCAN_TIME       400
1071 //(HZ / 2)
1072 #define IEEE80211_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2)
1073
1074 #define CRC_LENGTH                 4U
1075
1076 #define MAX_WPA_IE_LEN (256)
1077 #define MAX_WPS_IE_LEN (512)
1078 #define MAX_P2P_IE_LEN (256)
1079 #define MAX_WFD_IE_LEN (128)
1080
1081 #define NETWORK_EMPTY_ESSID (1<<0)
1082 #define NETWORK_HAS_OFDM    (1<<1)
1083 #define NETWORK_HAS_CCK     (1<<2)
1084
1085 #define IEEE80211_DTIM_MBCAST 4
1086 #define IEEE80211_DTIM_UCAST 2
1087 #define IEEE80211_DTIM_VALID 1
1088 #define IEEE80211_DTIM_INVALID 0
1089
1090 #define IEEE80211_PS_DISABLED 0
1091 #define IEEE80211_PS_UNICAST IEEE80211_DTIM_UCAST
1092 #define IEEE80211_PS_MBCAST IEEE80211_DTIM_MBCAST
1093 #define IW_ESSID_MAX_SIZE 32
1094 #if 0
1095 struct ieee80211_network {
1096         /* These entries are used to identify a unique network */
1097         u8 bssid[ETH_ALEN];
1098         u8 channel;
1099         /* Ensure null-terminated for any debug msgs */
1100         u8 ssid[IW_ESSID_MAX_SIZE + 1];
1101         u8 ssid_len;
1102         u8      rssi;   //relative signal strength
1103         u8      sq;             //signal quality
1104
1105         /* These are network statistics */
1106         //struct ieee80211_rx_stats stats;
1107         u16 capability;
1108         u16     aid;
1109         u8 rates[MAX_RATES_LENGTH];
1110         u8 rates_len;
1111         u8 rates_ex[MAX_RATES_EX_LENGTH];
1112         u8 rates_ex_len;
1113         
1114         u8 edca_parmsets[18];
1115                 
1116         u8 mode;
1117         u8 flags;
1118         u8 time_stamp[8];
1119         u16 beacon_interval;
1120         u16 listen_interval;
1121         u16 atim_window;
1122         u8 wpa_ie[MAX_WPA_IE_LEN];
1123         size_t wpa_ie_len;
1124         u8 rsn_ie[MAX_WPA_IE_LEN];
1125         size_t rsn_ie_len;
1126         u8 country[6];
1127         u8 dtim_period;
1128         u8 dtim_data;
1129         u8 power_constraint;
1130         u8 qosinfo;
1131         u8 qbssload[5];
1132         u8 network_type;
1133         int join_res;
1134         unsigned long   last_scanned;   
1135 };
1136 #endif
1137 /*
1138 join_res:
1139 -1: authentication fail
1140 -2: association fail
1141 > 0: TID
1142 */
1143
1144 #ifndef PLATFORM_FREEBSD //Baron BSD has already defined
1145
1146 enum ieee80211_state {
1147
1148         /* the card is not linked at all */
1149         IEEE80211_NOLINK = 0,
1150         
1151         /* IEEE80211_ASSOCIATING* are for BSS client mode
1152          * the driver shall not perform RX filtering unless
1153          * the state is LINKED.
1154          * The driver shall just check for the state LINKED and
1155          * defaults to NOLINK for ALL the other states (including
1156          * LINKED_SCANNING)
1157          */
1158         
1159         /* the association procedure will start (wq scheduling)*/
1160         IEEE80211_ASSOCIATING,
1161         IEEE80211_ASSOCIATING_RETRY,
1162         
1163         /* the association procedure is sending AUTH request*/
1164         IEEE80211_ASSOCIATING_AUTHENTICATING,
1165         
1166         /* the association procedure has successfully authentcated
1167          * and is sending association request
1168          */
1169         IEEE80211_ASSOCIATING_AUTHENTICATED,
1170         
1171         /* the link is ok. the card associated to a BSS or linked
1172          * to a ibss cell or acting as an AP and creating the bss
1173          */
1174         IEEE80211_LINKED,
1175         
1176         /* same as LINKED, but the driver shall apply RX filter
1177          * rules as we are in NO_LINK mode. As the card is still
1178          * logically linked, but it is doing a syncro site survey
1179          * then it will be back to LINKED state.
1180          */
1181         IEEE80211_LINKED_SCANNING,
1182         
1183 };
1184 #endif //PLATFORM_FREEBSD
1185
1186 #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
1187 #define DEFAULT_FTS 2346
1188 #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
1189 #define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
1190
1191 #ifdef PLATFORM_FREEBSD //Baron change func to macro
1192 #define is_multicast_mac_addr(Addr) ((((Addr[0]) & 0x01) == 0x01) && ((Addr[0]) != 0xff))
1193 #define is_broadcast_mac_addr(Addr) ((((Addr[0]) & 0xff) == 0xff) && (((Addr[1]) & 0xff) == 0xff) && \
1194 (((Addr[2]) & 0xff) == 0xff) && (((Addr[3]) & 0xff) == 0xff) && (((Addr[4]) & 0xff) == 0xff) && \
1195 (((Addr[5]) & 0xff) == 0xff))
1196 #else
1197 extern __inline int is_multicast_mac_addr(const u8 *addr)
1198 {
1199         return ((addr[0] != 0xff) && (0x01 & addr[0]));
1200 }
1201
1202 extern __inline int is_broadcast_mac_addr(const u8 *addr)
1203 {
1204         return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) &&   \
1205                 (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
1206 }
1207
1208 extern __inline int is_zero_mac_addr(const u8 *addr)
1209 {
1210         return ((addr[0] == 0x00) && (addr[1] == 0x00) && (addr[2] == 0x00) &&   \
1211                 (addr[3] == 0x00) && (addr[4] == 0x00) && (addr[5] == 0x00));
1212 }
1213 #endif //PLATFORM_FREEBSD
1214
1215 #define CFG_IEEE80211_RESERVE_FCS (1<<0)
1216 #define CFG_IEEE80211_COMPUTE_FCS (1<<1)
1217
1218 typedef struct tx_pending_t{
1219         int frag;
1220         struct ieee80211_txb *txb;
1221 }tx_pending_t;
1222
1223
1224
1225 #define MAXTID  16
1226
1227 #define IEEE_A            (1<<0)
1228 #define IEEE_B            (1<<1)
1229 #define IEEE_G            (1<<2)
1230 #define IEEE_MODE_MASK    (IEEE_A|IEEE_B|IEEE_G)
1231
1232 //Baron move to ieee80211.c
1233 int ieee80211_is_empty_essid(const char *essid, int essid_len);
1234 int ieee80211_get_hdrlen(u16 fc);
1235
1236 #if 0
1237 /* Action frame categories (IEEE 802.11-2007, 7.3.1.11, Table 7-24) */
1238 #define WLAN_ACTION_SPECTRUM_MGMT 0
1239 #define WLAN_ACTION_QOS 1
1240 #define WLAN_ACTION_DLS 2
1241 #define WLAN_ACTION_BLOCK_ACK 3
1242 #define WLAN_ACTION_RADIO_MEASUREMENT 5
1243 #define WLAN_ACTION_FT 6
1244 #define WLAN_ACTION_SA_QUERY 8
1245 #define WLAN_ACTION_WMM 17
1246 #endif
1247
1248
1249 /* Action category code */
1250 enum rtw_ieee80211_category {
1251         RTW_WLAN_CATEGORY_SPECTRUM_MGMT = 0,
1252         RTW_WLAN_CATEGORY_QOS = 1,
1253         RTW_WLAN_CATEGORY_DLS = 2,
1254         RTW_WLAN_CATEGORY_BACK = 3,
1255         RTW_WLAN_CATEGORY_PUBLIC = 4, //IEEE 802.11 public action frames
1256         RTW_WLAN_CATEGORY_RADIO_MEASUREMENT  = 5,
1257         RTW_WLAN_CATEGORY_FT = 6,
1258         RTW_WLAN_CATEGORY_HT = 7,
1259         RTW_WLAN_CATEGORY_SA_QUERY = 8,
1260         RTW_WLAN_CATEGORY_UNPROTECTED_WNM = 11, // add for CONFIG_IEEE80211W, none 11w also can use
1261         RTW_WLAN_CATEGORY_TDLS = 12,
1262         RTW_WLAN_CATEGORY_SELF_PROTECTED = 15, // add for CONFIG_IEEE80211W, none 11w also can use
1263         RTW_WLAN_CATEGORY_WMM = 17,
1264         RTW_WLAN_CATEGORY_P2P = 0x7f,//P2P action frames
1265 };
1266
1267 /* SPECTRUM_MGMT action code */
1268 enum rtw_ieee80211_spectrum_mgmt_actioncode {
1269         RTW_WLAN_ACTION_SPCT_MSR_REQ = 0,
1270         RTW_WLAN_ACTION_SPCT_MSR_RPRT = 1,
1271         RTW_WLAN_ACTION_SPCT_TPC_REQ = 2,
1272         RTW_WLAN_ACTION_SPCT_TPC_RPRT = 3,
1273         RTW_WLAN_ACTION_SPCT_CHL_SWITCH = 4,
1274         RTW_WLAN_ACTION_SPCT_EXT_CHL_SWITCH = 5,
1275 };
1276
1277 enum _PUBLIC_ACTION{
1278         ACT_PUBLIC_BSSCOEXIST = 0, // 20/40 BSS Coexistence
1279         ACT_PUBLIC_DSE_ENABLE = 1,
1280         ACT_PUBLIC_DSE_DEENABLE = 2,
1281         ACT_PUBLIC_DSE_REG_LOCATION = 3,
1282         ACT_PUBLIC_EXT_CHL_SWITCH = 4,
1283         ACT_PUBLIC_DSE_MSR_REQ = 5,
1284         ACT_PUBLIC_DSE_MSR_RPRT = 6,
1285         ACT_PUBLIC_MP = 7, // Measurement Pilot
1286         ACT_PUBLIC_DSE_PWR_CONSTRAINT = 8,
1287         ACT_PUBLIC_VENDOR = 9, // for WIFI_DIRECT
1288         ACT_PUBLIC_GAS_INITIAL_REQ = 10,
1289         ACT_PUBLIC_GAS_INITIAL_RSP = 11,
1290         ACT_PUBLIC_GAS_COMEBACK_REQ = 12,
1291         ACT_PUBLIC_GAS_COMEBACK_RSP = 13,
1292         ACT_PUBLIC_TDLS_DISCOVERY_RSP = 14,
1293         ACT_PUBLIC_LOCATION_TRACK = 15,
1294         ACT_PUBLIC_MAX
1295 };
1296
1297 #ifdef CONFIG_TDLS
1298 enum TDLS_ACTION_FIELD{
1299         TDLS_SETUP_REQUEST = 0,
1300         TDLS_SETUP_RESPONSE = 1,
1301         TDLS_SETUP_CONFIRM = 2,
1302         TDLS_TEARDOWN = 3,
1303         TDLS_PEER_TRAFFIC_INDICATION = 4,
1304         TDLS_CHANNEL_SWITCH_REQUEST = 5,
1305         TDLS_CHANNEL_SWITCH_RESPONSE = 6,
1306         TDLS_PEER_PSM_REQUEST = 7,
1307         TDLS_PEER_PSM_RESPONSE = 8,
1308         TDLS_PEER_TRAFFIC_RESPONSE = 9,
1309         TDLS_DISCOVERY_REQUEST = 10,
1310         TDLS_DISCOVERY_RESPONSE = 14,   //it's used in public action frame
1311 };
1312
1313 #define TUNNELED_PROBE_REQ      15
1314 #define TUNNELED_PROBE_RSP      16
1315 #endif //CONFIG_TDLS
1316
1317 /* BACK action code */
1318 enum rtw_ieee80211_back_actioncode {
1319         RTW_WLAN_ACTION_ADDBA_REQ = 0,
1320         RTW_WLAN_ACTION_ADDBA_RESP = 1,
1321         RTW_WLAN_ACTION_DELBA = 2,
1322 };
1323
1324 /* HT features action code */
1325 enum rtw_ieee80211_ht_actioncode {
1326         RTW_WLAN_ACTION_NOTIFY_CH_WIDTH = 0,
1327        RTW_WLAN_ACTION_SM_PS = 1,
1328        RTW_WLAN_ACTION_PSPM = 2,
1329        RTW_WLAN_ACTION_PCO_PHASE = 3,
1330        RTW_WLAN_ACTION_MIMO_CSI_MX = 4,
1331        RTW_WLAN_ACTION_MIMO_NONCP_BF = 5,
1332        RTW_WLAN_ACTION_MIMP_CP_BF = 6,
1333        RTW_WLAN_ACTION_ASEL_INDICATES_FB = 7,
1334        RTW_WLAN_ACTION_HI_INFO_EXCHG = 8,
1335 };
1336
1337 /* BACK (block-ack) parties */
1338 enum rtw_ieee80211_back_parties {
1339         RTW_WLAN_BACK_RECIPIENT = 0,
1340         RTW_WLAN_BACK_INITIATOR = 1,
1341         RTW_WLAN_BACK_TIMER = 2,
1342 };
1343
1344
1345 #define OUI_MICROSOFT 0x0050f2 /* Microsoft (also used in Wi-Fi specs)
1346                                 * 00:50:F2 */
1347 #ifndef PLATFORM_FREEBSD //Baron BSD has defined
1348 #define WME_OUI_TYPE 2
1349 #endif //PLATFORM_FREEBSD
1350 #define WME_OUI_SUBTYPE_INFORMATION_ELEMENT 0
1351 #define WME_OUI_SUBTYPE_PARAMETER_ELEMENT 1
1352 #define WME_OUI_SUBTYPE_TSPEC_ELEMENT 2
1353 #define WME_VERSION 1
1354
1355 #define WME_ACTION_CODE_SETUP_REQUEST 0
1356 #define WME_ACTION_CODE_SETUP_RESPONSE 1
1357 #define WME_ACTION_CODE_TEARDOWN 2
1358
1359 #define WME_SETUP_RESPONSE_STATUS_ADMISSION_ACCEPTED 0
1360 #define WME_SETUP_RESPONSE_STATUS_INVALID_PARAMETERS 1
1361 #define WME_SETUP_RESPONSE_STATUS_REFUSED 3
1362
1363 #define WME_TSPEC_DIRECTION_UPLINK 0
1364 #define WME_TSPEC_DIRECTION_DOWNLINK 1
1365 #define WME_TSPEC_DIRECTION_BI_DIRECTIONAL 3
1366
1367
1368 #define OUI_BROADCOM 0x00904c /* Broadcom (Epigram) */
1369
1370 #define VENDOR_HT_CAPAB_OUI_TYPE 0x33 /* 00-90-4c:0x33 */
1371
1372 /**
1373  * enum rtw_ieee80211_channel_flags - channel flags
1374  *
1375  * Channel flags set by the regulatory control code.
1376  *
1377  * @RTW_IEEE80211_CHAN_DISABLED: This channel is disabled.
1378  * @RTW_IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
1379  *      on this channel.
1380  * @RTW_IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
1381  * @RTW_IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
1382  * @RTW_IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
1383  *      is not permitted.
1384  * @RTW_IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
1385  *      is not permitted.
1386  */
1387   enum rtw_ieee80211_channel_flags {
1388           RTW_IEEE80211_CHAN_DISABLED         = 1<<0,
1389           RTW_IEEE80211_CHAN_PASSIVE_SCAN     = 1<<1,
1390           RTW_IEEE80211_CHAN_NO_IBSS          = 1<<2,
1391           RTW_IEEE80211_CHAN_RADAR            = 1<<3,
1392           RTW_IEEE80211_CHAN_NO_HT40PLUS      = 1<<4,
1393           RTW_IEEE80211_CHAN_NO_HT40MINUS     = 1<<5,
1394   };
1395   
1396   #define RTW_IEEE80211_CHAN_NO_HT40 \
1397           (RTW_IEEE80211_CHAN_NO_HT40PLUS | RTW_IEEE80211_CHAN_NO_HT40MINUS)
1398
1399 /* Represent channel details, subset of ieee80211_channel */
1400 struct rtw_ieee80211_channel {
1401         //enum ieee80211_band band;
1402         //u16 center_freq;
1403         u16 hw_value;
1404         u32 flags;
1405         //int max_antenna_gain;
1406         //int max_power;
1407         //int max_reg_power;
1408         //bool beacon_found;
1409         //u32 orig_flags;
1410         //int orig_mag;
1411         //int orig_mpwr;
1412 }; 
1413
1414 #define CHAN_FMT \
1415         /*"band:%d, "*/ \
1416         /*"center_freq:%u, "*/ \
1417         "hw_value:%u, " \
1418         "flags:0x%08x" \
1419         /*"max_antenna_gain:%d\n"*/ \
1420         /*"max_power:%d\n"*/ \
1421         /*"max_reg_power:%d\n"*/ \
1422         /*"beacon_found:%u\n"*/ \
1423         /*"orig_flags:0x%08x\n"*/ \
1424         /*"orig_mag:%d\n"*/ \
1425         /*"orig_mpwr:%d\n"*/ 
1426
1427 #define CHAN_ARG(channel) \
1428         /*(channel)->band*/ \
1429         /*, (channel)->center_freq*/ \
1430         (channel)->hw_value \
1431         , (channel)->flags \
1432         /*, (channel)->max_antenna_gain*/ \
1433         /*, (channel)->max_power*/ \
1434         /*, (channel)->max_reg_power*/ \
1435         /*, (channel)->beacon_found*/ \
1436         /*, (channel)->orig_flags*/ \
1437         /*, (channel)->orig_mag*/ \
1438         /*, (channel)->orig_mpwr*/ \
1439
1440 /* Parsed Information Elements */
1441 struct rtw_ieee802_11_elems {
1442         u8 *ssid;
1443         u8 ssid_len;
1444         u8 *supp_rates;
1445         u8 supp_rates_len;
1446         u8 *fh_params;
1447         u8 fh_params_len;
1448         u8 *ds_params;
1449         u8 ds_params_len;
1450         u8 *cf_params;
1451         u8 cf_params_len;
1452         u8 *tim;
1453         u8 tim_len;
1454         u8 *ibss_params;
1455         u8 ibss_params_len;
1456         u8 *challenge;
1457         u8 challenge_len;
1458         u8 *erp_info;
1459         u8 erp_info_len;
1460         u8 *ext_supp_rates;
1461         u8 ext_supp_rates_len;
1462         u8 *wpa_ie;
1463         u8 wpa_ie_len;
1464         u8 *rsn_ie;
1465         u8 rsn_ie_len;
1466         u8 *wme;
1467         u8 wme_len;
1468         u8 *wme_tspec;
1469         u8 wme_tspec_len;
1470         u8 *wps_ie;
1471         u8 wps_ie_len;
1472         u8 *power_cap;
1473         u8 power_cap_len;
1474         u8 *supp_channels;
1475         u8 supp_channels_len;
1476         u8 *mdie;
1477         u8 mdie_len;
1478         u8 *ftie;
1479         u8 ftie_len;
1480         u8 *timeout_int;
1481         u8 timeout_int_len;
1482         u8 *ht_capabilities;
1483         u8 ht_capabilities_len;
1484         u8 *ht_operation;
1485         u8 ht_operation_len;
1486         u8 *vendor_ht_cap;
1487         u8 vendor_ht_cap_len;
1488 };
1489
1490 typedef enum { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 } ParseRes;
1491
1492 ParseRes rtw_ieee802_11_parse_elems(u8 *start, uint len,
1493                                 struct rtw_ieee802_11_elems *elems,
1494                                 int show_errors);
1495
1496 u8 *rtw_set_fixed_ie(unsigned char *pbuf, unsigned int len, unsigned char *source, unsigned int *frlen);
1497 u8 *rtw_set_ie(u8 *pbuf, sint index, uint len, u8 *source, uint *frlen);
1498
1499 enum secondary_ch_offset {
1500         SCN = 0, /* no secondary channel */
1501         SCA = 1, /* secondary channel above */
1502         SCB = 3,  /* secondary channel below */
1503 };
1504 u8 secondary_ch_offset_to_hal_ch_offset(u8 ch_offset);
1505 u8 hal_ch_offset_to_secondary_ch_offset(u8 ch_offset);
1506 u8 *rtw_set_ie_ch_switch(u8 *buf, u32 *buf_len, u8 ch_switch_mode, u8 new_ch, u8 ch_switch_cnt);
1507 u8 *rtw_set_ie_secondary_ch_offset(u8 *buf, u32 *buf_len, u8 secondary_ch_offset);
1508 u8 *rtw_set_ie_mesh_ch_switch_parm(u8 *buf, u32 *buf_len, u8 ttl, u8 flags, u16 reason, u16 precedence);
1509
1510 u8 *rtw_get_ie(u8*pbuf, sint index, sint *len, sint limit);
1511 u8 *rtw_get_ie_ex(u8 *in_ie, uint in_len, u8 eid, u8 *oui, u8 oui_len, u8 *ie, uint *ielen);
1512 int rtw_ies_remove_ie(u8 *ies, uint *ies_len, uint offset, u8 eid, u8 *oui, u8 oui_len);
1513
1514 void rtw_set_supported_rate(u8* SupportedRates, uint mode) ;
1515
1516 unsigned char *rtw_get_wpa_ie(unsigned char *pie, int *wpa_ie_len, int limit);
1517 unsigned char *rtw_get_wpa2_ie(unsigned char *pie, int *rsn_ie_len, int limit);
1518 int rtw_get_wpa_cipher_suite(u8 *s);
1519 int rtw_get_wpa2_cipher_suite(u8 *s);
1520 int rtw_parse_wpa_ie(u8* wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwise_cipher);
1521 int rtw_parse_wpa2_ie(u8* wpa_ie, int wpa_ie_len, int *group_cipher, int *pairwise_cipher);
1522
1523 int rtw_get_sec_ie(u8 *in_ie,uint in_len,u8 *rsn_ie,u16 *rsn_len,u8 *wpa_ie,u16 *wpa_len);
1524
1525 u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen);
1526 u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen);
1527 u8 *rtw_get_wps_attr(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_attr, u32 *len_attr);
1528 u8 *rtw_get_wps_attr_content(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_content, uint *len_content);
1529
1530 /**
1531  * for_each_ie - iterate over continuous IEs
1532  * @ie:
1533  * @buf:
1534  * @buf_len:
1535  */
1536 #define for_each_ie(ie, buf, buf_len) \
1537         for (ie = (void*)buf; (((u8*)ie) - ((u8*)buf) + 1) < buf_len; ie = (void*)(((u8*)ie) + *(((u8*)ie)+1) + 2))
1538
1539 void dump_ies(u8 *buf, u32 buf_len);
1540 void dump_wps_ie(u8 *ie, u32 ie_len);
1541
1542 #ifdef CONFIG_P2P
1543 u32 rtw_get_p2p_merged_ies_len(u8 *in_ie, u32 in_len);
1544 int rtw_p2p_merge_ies(u8 *in_ie, u32 in_len, u8 *merge_ie);
1545 void dump_p2p_ie(u8 *ie, u32 ie_len);
1546 u8 *rtw_get_p2p_ie(u8 *in_ie, int in_len, u8 *p2p_ie, uint *p2p_ielen);
1547 u8 *rtw_get_p2p_attr(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id ,u8 *buf_attr, u32 *len_attr);
1548 u8 *rtw_get_p2p_attr_content(u8 *p2p_ie, uint p2p_ielen, u8 target_attr_id ,u8 *buf_content, uint *len_content);
1549 u32 rtw_set_p2p_attr_content(u8 *pbuf, u8 attr_id, u16 attr_len, u8 *pdata_attr);
1550 void rtw_WLAN_BSSID_EX_remove_p2p_attr(WLAN_BSSID_EX *bss_ex, u8 attr_id);
1551 #endif
1552
1553 #ifdef CONFIG_WFD
1554 int rtw_get_wfd_ie(u8 *in_ie, int in_len, u8 *wfd_ie, uint *wfd_ielen);
1555 int rtw_get_wfd_attr_content(u8 *wfd_ie, uint wfd_ielen, u8 target_attr_id ,u8 *attr_content, uint *attr_contentlen);
1556 #endif // CONFIG_WFD
1557
1558 uint    rtw_get_rateset_len(u8  *rateset);
1559
1560 struct registry_priv;
1561 int rtw_generate_ie(struct registry_priv *pregistrypriv);
1562
1563
1564 int rtw_get_bit_value_from_ieee_value(u8 val);
1565
1566 uint    rtw_is_cckrates_included(u8 *rate);
1567
1568 uint    rtw_is_cckratesonly_included(u8 *rate);
1569
1570 int rtw_check_network_type(unsigned char *rate, int ratelen, int channel);
1571
1572 void rtw_macaddr_cfg(u8 *mac_addr);
1573
1574 u16 rtw_mcs_rate(u8 rf_type, u8 bw_40MHz, u8 short_GI_20, u8 short_GI_40, unsigned char * MCS_rate);
1575
1576 int rtw_action_frame_parse(const u8 *frame, u32 frame_len, u8* category, u8 *action);
1577 const char *action_public_str(u8 action);
1578
1579 #endif /* IEEE80211_H */
1580