2 * Merged with mainline ieee80211.h in Aug 2004. Original ieee802_11
3 * remains copyright by the original authors
5 * Portions of the merged code are based on Host AP (software wireless
6 * LAN access point) driver for Intersil Prism2/2.5/3.
8 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
10 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
12 * Adaption to a generic IEEE 802.11 stack by James Ketrenos
13 * <jketreno@linux.intel.com>
14 * Copyright (c) 2004, Intel Corporation
16 * Modified for Realtek's wi-fi cards by Andrea Merello
17 * <andreamrl@tiscali.it>
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License version 2 as
21 * published by the Free Software Foundation. See README and COPYING for
26 #include <linux/if_ether.h> /* ETH_ALEN */
27 #include <linux/kernel.h> /* ARRAY_SIZE */
28 #include <linux/version.h>
29 #include <linux/module.h>
30 #include <linux/jiffies.h>
31 #include <linux/timer.h>
32 #include <linux/sched.h>
34 #include <linux/delay.h>
35 #include <linux/wireless.h>
36 #include <linux/ieee80211.h>
38 #include "rtl819x_HT.h"
39 #include "rtl819x_BA.h"
40 #include "rtl819x_TS.h"
42 #define KEY_TYPE_NA 0x0
43 #define KEY_TYPE_WEP40 0x1
44 #define KEY_TYPE_TKIP 0x2
45 #define KEY_TYPE_CCMP 0x4
46 #define KEY_TYPE_WEP104 0x5
48 /* added for rtl819x tx procedure */
49 #define MAX_QUEUE_SIZE 0x10
51 /* 8190 queue mapping */
64 NORMAL_QUEUE
= MGNT_QUEUE
67 #define SWRF_TIMEOUT 50
70 /* Flag byte: byte 8, numbered from 0. */
71 #define IE_CISCO_FLAG_POSITION 0x08
72 #define SUPPORT_CKIP_MIC 0x08 /* bit3 */
73 #define SUPPORT_CKIP_PK 0x10 /* bit4 */
75 /* defined for skb cb field, at most 28 byte */
76 typedef struct cb_desc
{
77 /* Tx Desc Related flags (8-9) */
83 u8 bTxDisableRateFallBack
:1;
84 u8 bTxUseDriverAssingedRate
:1;
85 u8 bHwSec
:1; /* indicate whether use Hw security */
89 /* Tx Firmware Relaged flags (10-11)*/
93 u8 bUseShortPreamble
:1;
94 u8 bTxEnableFwCalcDur
:1;
101 u8 bRTSUseShortPreamble
:1;
108 /* Tx Desc related element(12-19) */
117 /* Tx firmware related element(20-27) */
125 } cb_desc
, *pcb_desc
;
177 #define aSifsTime (((priv->ieee80211->current_network.mode == IEEE_A) || \
178 (priv->ieee80211->current_network.mode == IEEE_N_24G) || \
179 (priv->ieee80211->current_network.mode == IEEE_N_5G)) \
182 #define MGMT_QUEUE_NUM 5
184 #define IEEE_CMD_SET_WPA_PARAM 1
185 #define IEEE_CMD_SET_WPA_IE 2
186 #define IEEE_CMD_SET_ENCRYPTION 3
187 #define IEEE_CMD_MLME 4
189 #define IEEE_PARAM_WPA_ENABLED 1
190 #define IEEE_PARAM_TKIP_COUNTERMEASURES 2
191 #define IEEE_PARAM_DROP_UNENCRYPTED 3
192 #define IEEE_PARAM_PRIVACY_INVOKED 4
193 #define IEEE_PARAM_AUTH_ALGS 5
194 #define IEEE_PARAM_IEEE_802_1X 6
195 //It should consistent with the driver_XXX.c
197 #define IEEE_PARAM_WPAX_SELECT 7
198 //Added for notify the encryption type selection
200 #define IEEE_PROTO_WPA 1
201 #define IEEE_PROTO_RSN 2
202 //Added for notify the encryption type selection
204 #define IEEE_WPAX_USEGROUP 0
205 #define IEEE_WPAX_WEP40 1
206 #define IEEE_WPAX_TKIP 2
207 #define IEEE_WPAX_WRAP 3
208 #define IEEE_WPAX_CCMP 4
209 #define IEEE_WPAX_WEP104 5
211 #define IEEE_KEY_MGMT_IEEE8021X 1
212 #define IEEE_KEY_MGMT_PSK 2
214 #define IEEE_MLME_STA_DEAUTH 1
215 #define IEEE_MLME_STA_DISASSOC 2
218 #define IEEE_CRYPT_ERR_UNKNOWN_ALG 2
219 #define IEEE_CRYPT_ERR_UNKNOWN_ADDR 3
220 #define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4
221 #define IEEE_CRYPT_ERR_KEY_SET_FAILED 5
222 #define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6
223 #define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7
226 #define IEEE_CRYPT_ALG_NAME_LEN 16
228 #define MAX_IE_LEN 0xff
230 typedef struct ieee_param
{
232 u8 sta_addr
[ETH_ALEN
];
248 u8 alg
[IEEE_CRYPT_ALG_NAME_LEN
];
252 u8 seq
[8]; /* sequence counter (set: RX, get: TX) */
259 #define MSECS(t) msecs_to_jiffies(t)
260 #define msleep_interruptible_rsl msleep_interruptible
262 #define IEEE80211_DATA_LEN 2304
263 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
266 The figure in section 7.1.2 suggests a body size of up to 2312
267 bytes is allowed, which is a bit confusing, I suspect this
268 represents the 2304 bytes of real data, plus a possible 8 bytes of
269 WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
270 #define IEEE80211_1ADDR_LEN 10
271 #define IEEE80211_2ADDR_LEN 16
272 #define IEEE80211_3ADDR_LEN 24
273 #define IEEE80211_4ADDR_LEN 30
274 #define IEEE80211_FCS_LEN 4
275 #define IEEE80211_HLEN IEEE80211_4ADDR_LEN
276 #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
277 #define IEEE80211_MGMT_HDR_LEN 24
278 #define IEEE80211_DATA_HDR3_LEN 24
279 #define IEEE80211_DATA_HDR4_LEN 30
281 #define MIN_FRAG_THRESHOLD 256U
282 #define MAX_FRAG_THRESHOLD 2346U
285 /* Frame control field constants */
286 #define IEEE80211_FCTL_FRAMETYPE 0x00fc
287 #define IEEE80211_FCTL_DSTODS 0x0300 //added by david
288 #define IEEE80211_FCTL_WEP 0x4000
291 #define IEEE80211_STYPE_MANAGE_ACT 0x00D0
294 #define IEEE80211_STYPE_BLOCKACK 0x0094
297 #define IEEE80211_QCTL_TID 0x000F
299 #define FC_QOS_BIT BIT7
301 #define IsDataFrame(pdu) (((pdu[0] & 0x0C) == 0x08) ? true : false)
302 #define IsLegacyDataFrame(pdu) (IsDataFrame(pdu) && (!(pdu[0] & FC_QOS_BIT)))
303 #define IsQoSDataFrame(pframe) \
304 ((*(u16 *)pframe & (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA)) \
305 == (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA))
307 #define Frame_Order(pframe) (*(u16 *)pframe & IEEE80211_FCTL_ORDER)
309 #define SN_LESS(a, b) (((a - b) & 0x800) != 0)
310 #define SN_EQUAL(a, b) (a == b)
312 #define MAX_DEV_ADDR_SIZE 8
334 /* InitialGainOpType */
341 typedef enum _LED_CTL_MODE
{
342 LED_CTL_POWER_ON
= 1,
347 LED_CTL_SITE_SURVEY
= 6,
348 LED_CTL_POWER_OFF
= 7,
349 LED_CTL_START_TO_LINK
= 8,
350 LED_CTL_START_WPS
= 9,
351 LED_CTL_STOP_WPS
= 10,
352 LED_CTL_START_WPS_BOTTON
= 11,
356 #define CONFIG_IEEE80211_DEBUG
357 #ifdef CONFIG_IEEE80211_DEBUG
358 extern u32 ieee80211_debug_level
;
359 #define IEEE80211_DEBUG(level, fmt, args...) \
361 if (ieee80211_debug_level & (level)) \
362 printk(KERN_DEBUG "ieee80211: " fmt, ## args); \
364 #define IEEE80211_DEBUG_DATA(level, data, datalen) \
366 if ((ieee80211_debug_level & (level)) == (level)) { \
367 u8 *pdata = (u8 *)data; \
369 printk(KERN_DEBUG "ieee80211: %s()\n", __func__); \
370 for (i = 0; i < (int)(datalen); i++) { \
371 printk("%2x ", pdata[i]); \
372 if ((i + 1) % 16 == 0) \
379 #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0)
380 #define IEEE80211_DEBUG_DATA(level, data, datalen) do {} while(0)
381 #endif /* CONFIG_IEEE80211_DEBUG */
383 #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
384 #define MAC_ARG(x) ((u8 *)(x))[0], ((u8 *)(x))[1], ((u8 *)(x))[2], \
385 ((u8 *)(x))[3], ((u8 *)(x))[4], ((u8 *)(x))[5]
388 * To use the debug system;
390 * If you are defining a new debug classification, simply add it to the #define
391 * list here in the form of:
393 * #define IEEE80211_DL_xxxx VALUE
395 * shifting value to the left one bit from the previous entry. xxxx should be
396 * the name of the classification (for example, WEP)
398 * You then need to either add a IEEE80211_xxxx_DEBUG() macro definition for your
399 * classification, or use IEEE80211_DEBUG(IEEE80211_DL_xxxx, ...) whenever you want
400 * to send output to that classification.
402 * To add your debug level to the list of levels seen when you perform
404 * % cat /proc/net/ipw/debug_level
406 * you simply need to add your entry to the ipw_debug_levels array.
408 * If you do not see debug_level in /proc/net/ipw then you do not have
409 * CONFIG_IEEE80211_DEBUG defined in your kernel configuration
413 #define IEEE80211_DL_INFO (1<<0)
414 #define IEEE80211_DL_WX (1<<1)
415 #define IEEE80211_DL_SCAN (1<<2)
416 #define IEEE80211_DL_STATE (1<<3)
417 #define IEEE80211_DL_MGMT (1<<4)
418 #define IEEE80211_DL_FRAG (1<<5)
419 #define IEEE80211_DL_EAP (1<<6)
420 #define IEEE80211_DL_DROP (1<<7)
422 #define IEEE80211_DL_TX (1<<8)
423 #define IEEE80211_DL_RX (1<<9)
425 #define IEEE80211_DL_HT (1 << 10)
426 #define IEEE80211_DL_BA (1 << 11)
427 #define IEEE80211_DL_TS (1 << 12)
428 #define IEEE80211_DL_QOS (1 << 13)
429 #define IEEE80211_DL_REORDER (1 << 14)
430 #define IEEE80211_DL_IOT (1 << 15)
431 #define IEEE80211_DL_IPS (1 << 16)
432 #define IEEE80211_DL_TRACE (1 << 29)
433 #define IEEE80211_DL_DATA (1 << 30)
434 #define IEEE80211_DL_ERR (1 << 31)
436 #define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a)
437 #define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a)
438 #define IEEE80211_DEBUG_INFO(f, a...) IEEE80211_DEBUG(IEEE80211_DL_INFO, f, ## a)
440 #define IEEE80211_DEBUG_WX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_WX, f, ## a)
441 #define IEEE80211_DEBUG_SCAN(f, a...) IEEE80211_DEBUG(IEEE80211_DL_SCAN, f, ## a)
442 #define IEEE80211_DEBUG_STATE(f, a...) IEEE80211_DEBUG(IEEE80211_DL_STATE, f, ## a)
443 #define IEEE80211_DEBUG_MGMT(f, a...) IEEE80211_DEBUG(IEEE80211_DL_MGMT, f, ## a)
444 #define IEEE80211_DEBUG_FRAG(f, a...) IEEE80211_DEBUG(IEEE80211_DL_FRAG, f, ## a)
445 #define IEEE80211_DEBUG_EAP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_EAP, f, ## a)
446 #define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a)
447 #define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a)
448 #define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a)
449 #define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a)
451 #include <linux/netdevice.h>
452 #include <linux/if_arp.h> /* ARPHRD_ETHER */
455 #define WIRELESS_SPY // enable iwspy support
457 #include <net/iw_handler.h> // new driver API
460 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
461 #endif /* ETH_P_PAE */
463 #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
465 #ifndef ETH_P_80211_RAW
466 #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
469 /* IEEE 802.11 defines */
471 #define P80211_OUI_LEN 3
473 struct ieee80211_snap_hdr
{
475 u8 dsap
; /* always 0xAA */
476 u8 ssap
; /* always 0xAA */
477 u8 ctrl
; /* always 0x03 */
478 u8 oui
[P80211_OUI_LEN
]; /* organizational universal id */
480 } __attribute__ ((packed
));
482 #define SNAP_SIZE sizeof(struct ieee80211_snap_hdr)
484 #define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS)
485 #define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
486 #define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
488 #define WLAN_FC_GET_FRAMETYPE(fc) ((fc) & IEEE80211_FCTL_FRAMETYPE)
489 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
490 #define WLAN_GET_SEQ_SEQ(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
492 #define RTL_WLAN_AUTH_LEAP 2
494 #define WLAN_CAPABILITY_BSS (1<<0)
495 #define WLAN_CAPABILITY_SHORT_SLOT (1<<10)
497 #define IEEE80211_STATMASK_SIGNAL (1<<0)
498 #define IEEE80211_STATMASK_RSSI (1<<1)
499 #define IEEE80211_STATMASK_NOISE (1<<2)
500 #define IEEE80211_STATMASK_RATE (1<<3)
501 #define IEEE80211_STATMASK_WEMASK 0x7
503 #define IEEE80211_CCK_MODULATION (1<<0)
504 #define IEEE80211_OFDM_MODULATION (1<<1)
506 #define IEEE80211_24GHZ_BAND (1<<0)
507 #define IEEE80211_52GHZ_BAND (1<<1)
509 #define IEEE80211_CCK_RATE_LEN 4
510 #define IEEE80211_CCK_RATE_1MB 0x02
511 #define IEEE80211_CCK_RATE_2MB 0x04
512 #define IEEE80211_CCK_RATE_5MB 0x0B
513 #define IEEE80211_CCK_RATE_11MB 0x16
514 #define IEEE80211_OFDM_RATE_LEN 8
515 #define IEEE80211_OFDM_RATE_6MB 0x0C
516 #define IEEE80211_OFDM_RATE_9MB 0x12
517 #define IEEE80211_OFDM_RATE_12MB 0x18
518 #define IEEE80211_OFDM_RATE_18MB 0x24
519 #define IEEE80211_OFDM_RATE_24MB 0x30
520 #define IEEE80211_OFDM_RATE_36MB 0x48
521 #define IEEE80211_OFDM_RATE_48MB 0x60
522 #define IEEE80211_OFDM_RATE_54MB 0x6C
523 #define IEEE80211_BASIC_RATE_MASK 0x80
525 #define IEEE80211_CCK_RATE_1MB_MASK (1<<0)
526 #define IEEE80211_CCK_RATE_2MB_MASK (1<<1)
527 #define IEEE80211_CCK_RATE_5MB_MASK (1<<2)
528 #define IEEE80211_CCK_RATE_11MB_MASK (1<<3)
529 #define IEEE80211_OFDM_RATE_6MB_MASK (1<<4)
530 #define IEEE80211_OFDM_RATE_9MB_MASK (1<<5)
531 #define IEEE80211_OFDM_RATE_12MB_MASK (1<<6)
532 #define IEEE80211_OFDM_RATE_18MB_MASK (1<<7)
533 #define IEEE80211_OFDM_RATE_24MB_MASK (1<<8)
534 #define IEEE80211_OFDM_RATE_36MB_MASK (1<<9)
535 #define IEEE80211_OFDM_RATE_48MB_MASK (1<<10)
536 #define IEEE80211_OFDM_RATE_54MB_MASK (1<<11)
538 #define IEEE80211_CCK_RATES_MASK 0x0000000F
539 #define IEEE80211_CCK_BASIC_RATES_MASK (IEEE80211_CCK_RATE_1MB_MASK | \
540 IEEE80211_CCK_RATE_2MB_MASK)
541 #define IEEE80211_CCK_DEFAULT_RATES_MASK (IEEE80211_CCK_BASIC_RATES_MASK | \
542 IEEE80211_CCK_RATE_5MB_MASK | \
543 IEEE80211_CCK_RATE_11MB_MASK)
545 #define IEEE80211_OFDM_RATES_MASK 0x00000FF0
546 #define IEEE80211_OFDM_BASIC_RATES_MASK (IEEE80211_OFDM_RATE_6MB_MASK | \
547 IEEE80211_OFDM_RATE_12MB_MASK | \
548 IEEE80211_OFDM_RATE_24MB_MASK)
549 #define IEEE80211_OFDM_DEFAULT_RATES_MASK (IEEE80211_OFDM_BASIC_RATES_MASK | \
550 IEEE80211_OFDM_RATE_9MB_MASK | \
551 IEEE80211_OFDM_RATE_18MB_MASK | \
552 IEEE80211_OFDM_RATE_36MB_MASK | \
553 IEEE80211_OFDM_RATE_48MB_MASK | \
554 IEEE80211_OFDM_RATE_54MB_MASK)
555 #define IEEE80211_DEFAULT_RATES_MASK (IEEE80211_OFDM_DEFAULT_RATES_MASK | \
556 IEEE80211_CCK_DEFAULT_RATES_MASK)
558 #define IEEE80211_NUM_OFDM_RATES 8
559 #define IEEE80211_NUM_CCK_RATES 4
560 #define IEEE80211_OFDM_SHIFT_MASK_A 4
563 /* this is stolen and modified from the madwifi driver*/
564 #define IEEE80211_FC0_TYPE_MASK 0x0c
565 #define IEEE80211_FC0_TYPE_DATA 0x08
566 #define IEEE80211_FC0_SUBTYPE_MASK 0xB0
567 #define IEEE80211_FC0_SUBTYPE_QOS 0x80
569 #define IEEE80211_QOS_HAS_SEQ(fc) \
570 (((fc) & (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_MASK)) == \
571 (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
573 /* this is stolen from ipw2200 driver */
574 #define IEEE_IBSS_MAC_HASH_SIZE 31
575 struct ieee_ibss_seq
{
579 unsigned long packet_time
[17];
580 struct list_head list
;
583 /* NOTE: This data is for statistical purposes; not all hardware provides this
584 * information for frames received. Not setting these will not cause
585 * any adverse affects. */
586 struct ieee80211_rx_stats
{
591 u16 rate
; /* in 100 kbps */
602 u8 SignalQuality
; /* in 0-100 index */
603 /* real power in dBm for this packet, no beautification & aggregation */
605 s8 RxPower
; /* in dBm Translate from PWdB */
606 u8 SignalStrength
; /* in 0-100 index */
610 u16 bShortPreamble
:1;
611 u16 Antenna
:1; /* RTL8185 */
612 u16 Decrypted
:1; /* RTL8185, RTL8187 */
613 u16 Wakeup
:1; /* RTL8185 */
614 u16 Reserved0
:1; /* RTL8185 */
622 /* < 11n or 8190 specific code */
628 bool RxIs40MHzPacket
;
630 u8 RxMIMOSignalStrength
[4]; /* in 0~100 index */
631 s8 RxMIMOSignalQuality
[2];
632 bool bPacketMatchBSSID
;
637 /* total packet length: must equal to sum of all FragLength */
639 /* FragLength should equal to PacketLength in non-fragment case */
641 u16 fragoffset
; /* data offset for this fragment */
643 bool bisrxaggrsubframe
;
644 bool bPacketBeacon
; /* for rssi */
645 bool bToSelfBA
; /* for rssi */
646 char cck_adc_pwdb
[4]; /* for rx path selection */
648 u8 nTotalAggPkt
; /* number of aggregated packets */
651 /* IEEE 802.11 requires that STA supports concurrent reception of at least
652 * three fragmented frames. This define can be increased to support more
653 * concurrent frames, but it should be noted that each entry can consume about
654 * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
655 #define IEEE80211_FRAG_CACHE_LEN 4
657 struct ieee80211_frag_entry
{
658 unsigned long first_frag_time
;
660 unsigned int last_frag
;
662 u8 src_addr
[ETH_ALEN
];
663 u8 dst_addr
[ETH_ALEN
];
666 struct ieee80211_stats
{
667 unsigned int tx_unicast_frames
;
668 unsigned int tx_multicast_frames
;
669 unsigned int tx_fragments
;
670 unsigned int tx_unicast_octets
;
671 unsigned int tx_multicast_octets
;
672 unsigned int tx_deferred_transmissions
;
673 unsigned int tx_single_retry_frames
;
674 unsigned int tx_multiple_retry_frames
;
675 unsigned int tx_retry_limit_exceeded
;
676 unsigned int tx_discards
;
677 unsigned int rx_unicast_frames
;
678 unsigned int rx_multicast_frames
;
679 unsigned int rx_fragments
;
680 unsigned int rx_unicast_octets
;
681 unsigned int rx_multicast_octets
;
682 unsigned int rx_fcs_errors
;
683 unsigned int rx_discards_no_buffer
;
684 unsigned int tx_discards_wrong_sa
;
685 unsigned int rx_discards_undecryptable
;
686 unsigned int rx_message_in_msg_fragments
;
687 unsigned int rx_message_in_bad_msg_fragments
;
690 struct ieee80211_device
;
692 #include "ieee80211_crypt.h"
694 #define SEC_KEY_1 (1<<0)
695 #define SEC_KEY_2 (1<<1)
696 #define SEC_KEY_3 (1<<2)
697 #define SEC_KEY_4 (1<<3)
698 #define SEC_ACTIVE_KEY (1<<4)
699 #define SEC_AUTH_MODE (1<<5)
700 #define SEC_UNICAST_GROUP (1<<6)
701 #define SEC_LEVEL (1<<7)
702 #define SEC_ENABLED (1<<8)
704 #define SEC_LEVEL_0 0 /* None */
705 #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
706 #define SEC_LEVEL_2 2 /* Level 1 + TKIP */
707 #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
708 #define SEC_LEVEL_3 4 /* Level 2 + CCMP */
711 #define WEP_KEY_LEN 13
712 #define SCM_KEY_LEN 32
714 struct ieee80211_security
{
719 unicast_uses_group
:1,
721 u8 key_sizes
[WEP_KEYS
];
722 u8 keys
[WEP_KEYS
][SCM_KEY_LEN
];
725 } __attribute__ ((packed
));
729 802.11 data frame from AP
730 ,-------------------------------------------------------------------.
731 Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
732 |------|------|---------|---------|---------|------|---------|------|
733 Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
734 | | tion | (BSSID) | | | ence | data | |
735 `-------------------------------------------------------------------'
739 /* Management Frame Information Element Types */
743 MFIE_TYPE_FH_SET
= 2,
744 MFIE_TYPE_DS_SET
= 3,
745 MFIE_TYPE_CF_SET
= 4,
747 MFIE_TYPE_IBSS_SET
= 6,
748 MFIE_TYPE_COUNTRY
= 7,
749 MFIE_TYPE_HOP_PARAMS
= 8,
750 MFIE_TYPE_HOP_TABLE
= 9,
751 MFIE_TYPE_REQUEST
= 10,
752 MFIE_TYPE_CHALLENGE
= 16,
753 MFIE_TYPE_POWER_CONSTRAINT
= 32,
754 MFIE_TYPE_POWER_CAPABILITY
= 33,
755 MFIE_TYPE_TPC_REQUEST
= 34,
756 MFIE_TYPE_TPC_REPORT
= 35,
757 MFIE_TYPE_SUPP_CHANNELS
= 36,
759 MFIE_TYPE_MEASURE_REQUEST
= 38,
760 MFIE_TYPE_MEASURE_REPORT
= 39,
761 MFIE_TYPE_QUIET
= 40,
762 MFIE_TYPE_IBSS_DFS
= 41,
765 MFIE_TYPE_RATES_EX
= 50,
766 MFIE_TYPE_HT_CAP
= 45,
767 MFIE_TYPE_HT_INFO
= 61,
768 MFIE_TYPE_AIRONET
=133,
769 MFIE_TYPE_GENERIC
= 221,
770 MFIE_TYPE_QOS_PARAMETER
= 222,
773 /* Minimal header; can be used for passing 802.11 frames with sufficient
774 * information to determine what type of underlying data type is actually
775 * stored in the data. */
776 struct rtl_ieee80211_hdr
{
780 } __attribute__ ((packed
));
782 struct ieee80211_hdr_1addr
{
787 } __attribute__ ((packed
));
789 struct ieee80211_hdr_2addr
{
795 } __attribute__ ((packed
));
797 struct ieee80211_hdr_3addr
{
805 } __attribute__ ((packed
));
807 struct ieee80211_hdr_4addr
{
816 } __attribute__ ((packed
));
818 struct ieee80211_hdr_3addrqos
{
827 } __attribute__ ((packed
));
829 struct ieee80211_hdr_4addrqos
{
839 } __attribute__ ((packed
));
841 struct ieee80211_info_element
{
845 } __attribute__ ((packed
));
847 struct ieee80211_authentication
{
848 struct ieee80211_hdr_3addr header
;
853 struct ieee80211_info_element info_element
[0];
854 } __attribute__ ((packed
));
856 struct ieee80211_disassoc
{
857 struct ieee80211_hdr_3addr header
;
859 } __attribute__ ((packed
));
861 struct ieee80211_probe_request
{
862 struct ieee80211_hdr_3addr header
;
863 /* SSID, supported rates */
864 struct ieee80211_info_element info_element
[0];
865 } __attribute__ ((packed
));
867 struct ieee80211_probe_response
{
868 struct ieee80211_hdr_3addr header
;
870 __le16 beacon_interval
;
872 /* SSID, supported rates, FH params, DS params,
873 * CF params, IBSS params, TIM (if beacon), RSN */
874 struct ieee80211_info_element info_element
[0];
875 } __attribute__ ((packed
));
877 struct ieee80211_assoc_request_frame
{
878 struct ieee80211_hdr_3addr header
;
880 __le16 listen_interval
;
881 /* SSID, supported rates, RSN */
882 struct ieee80211_info_element info_element
[0];
883 } __attribute__ ((packed
));
885 struct ieee80211_reassoc_request_frame
{
886 struct ieee80211_hdr_3addr header
;
888 __le16 listen_interval
;
889 u8 current_ap
[ETH_ALEN
];
890 /* SSID, supported rates, RSN */
891 struct ieee80211_info_element info_element
[0];
892 } __attribute__ ((packed
));
894 struct ieee80211_assoc_response_frame
{
895 struct ieee80211_hdr_3addr header
;
899 struct ieee80211_info_element info_element
[0]; /* supported rates */
900 } __attribute__ ((packed
));
902 struct ieee80211_txb
{
910 struct sk_buff
*fragments
[0];
913 #define MAX_SUBFRAME_COUNT 64
914 struct ieee80211_rxb
{
916 struct sk_buff
*subframes
[MAX_SUBFRAME_COUNT
];
919 }__attribute__((packed
));
921 typedef union _frameqos
{
933 /* SWEEP TABLE ENTRIES NUMBER */
934 #define MAX_SWEEP_TAB_ENTRIES 42
935 #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
936 /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
937 * only use 8, and then use extended rates for the remaining supported
938 * rates. Other APs, however, stick all of their supported rates on the
939 * main rates information element... */
940 #define MAX_RATES_LENGTH ((u8)12)
941 #define MAX_RATES_EX_LENGTH ((u8)16)
942 #define MAX_NETWORK_COUNT 128
944 #define MAX_CHANNEL_NUMBER 161
946 #define IEEE80211_SOFTMAC_SCAN_TIME 100 /* (HZ / 2) */
947 #define IEEE80211_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2)
949 #define CRC_LENGTH 4U
951 #define MAX_WPA_IE_LEN 64
953 #define NETWORK_EMPTY_ESSID (1 << 0)
954 #define NETWORK_HAS_OFDM (1 << 1)
955 #define NETWORK_HAS_CCK (1 << 2)
958 #define NETWORK_HAS_QOS_PARAMETERS (1 << 3)
959 #define NETWORK_HAS_QOS_INFORMATION (1 << 4)
960 #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \
961 NETWORK_HAS_QOS_INFORMATION)
963 #define NETWORK_HAS_ERP_VALUE (1 << 10)
965 #define QOS_QUEUE_NUM 4
966 #define QOS_OUI_LEN 3
967 #define QOS_OUI_TYPE 2
968 #define QOS_ELEMENT_ID 221
969 #define QOS_OUI_INFO_SUB_TYPE 0
970 #define QOS_OUI_PARAM_SUB_TYPE 1
971 #define QOS_VERSION_1 1
972 #define QOS_AIFSN_MIN_VALUE 2
974 struct ieee80211_qos_information_element
{
982 } __attribute__ ((packed
));
984 struct ieee80211_qos_ac_parameter
{
988 } __attribute__ ((packed
));
990 struct ieee80211_qos_parameter_info
{
991 struct ieee80211_qos_information_element info_element
;
993 struct ieee80211_qos_ac_parameter ac_params_record
[QOS_QUEUE_NUM
];
994 } __attribute__ ((packed
));
996 struct ieee80211_qos_parameters
{
997 __le16 cw_min
[QOS_QUEUE_NUM
];
998 __le16 cw_max
[QOS_QUEUE_NUM
];
999 u8 aifs
[QOS_QUEUE_NUM
];
1000 u8 flag
[QOS_QUEUE_NUM
];
1001 __le16 tx_op_limit
[QOS_QUEUE_NUM
];
1002 } __attribute__ ((packed
));
1004 struct ieee80211_qos_data
{
1005 struct ieee80211_qos_parameters parameters
;
1012 struct ieee80211_tim_parameters
{
1015 } __attribute__ ((packed
));
1017 struct ieee80211_wmm_ac_param
{
1018 u8 ac_aci_acm_aifsn
;
1019 u8 ac_ecwmin_ecwmax
;
1023 struct ieee80211_wmm_ts_info
{
1027 } __attribute__ ((packed
));
1029 struct ieee80211_wmm_tspec_elem
{
1030 struct ieee80211_wmm_ts_info ts_info
;
1037 u32 serv_start_time
;
1044 u16 surp_band_allow
;
1046 }__attribute__((packed
));
1053 EAPOL_ENCAP_ASF_ALERT
1056 static const char *eap_types
[] = {
1057 [EAP_PACKET
] = "EAP-Packet",
1058 [EAPOL_START
] = "EAPOL-Start",
1059 [EAPOL_LOGOFF
] = "EAPOL-Logoff",
1060 [EAPOL_KEY
] = "EAPOL-Key",
1061 [EAPOL_ENCAP_ASF_ALERT
] = "EAPOL-Encap-ASF-Alert"
1064 static inline const char *eap_get_type(int type
)
1066 return ((u32
)type
>= ARRAY_SIZE(eap_types
)) ? "Unknown" : eap_types
[type
];
1069 static inline u8
Frame_QoSTID(u8
*buf
)
1071 struct ieee80211_hdr_3addr
*hdr
= (struct ieee80211_hdr_3addr
*)buf
;
1072 u16 fc
= le16_to_cpu(hdr
->frame_ctl
);
1074 return (u8
)((frameqos
*)(buf
+
1075 (((fc
& IEEE80211_FCTL_TODS
) &&
1076 (fc
& IEEE80211_FCTL_FROMDS
)) ? 30 : 24)))->field
.tid
;
1085 } __attribute__ ((packed
));
1087 struct ieee80211_softmac_stats
{
1088 unsigned int rx_ass_ok
;
1089 unsigned int rx_ass_err
;
1090 unsigned int rx_probe_rq
;
1091 unsigned int tx_probe_rs
;
1092 unsigned int tx_beacons
;
1093 unsigned int rx_auth_rq
;
1094 unsigned int rx_auth_rs_ok
;
1095 unsigned int rx_auth_rs_err
;
1096 unsigned int tx_auth_rq
;
1097 unsigned int no_auth_rs
;
1098 unsigned int no_ass_rs
;
1099 unsigned int tx_ass_rq
;
1100 unsigned int rx_ass_rq
;
1101 unsigned int tx_probe_rq
;
1102 unsigned int reassoc
;
1103 unsigned int swtxstop
;
1104 unsigned int swtxawake
;
1105 unsigned char CurrentShowTxate
;
1106 unsigned char last_packet_rate
;
1107 unsigned int txretrycount
;
1110 #define BEACON_PROBE_SSID_ID_POSITION 12
1112 struct ieee80211_info_element_hdr
{
1115 } __attribute__ ((packed
));
1118 * These are the data types that can make up management packets
1122 u16 beacon_interval;
1124 u8 current_ap[ETH_ALEN];
1125 u16 listen_interval;
1127 u16 association_id:14, reserved:2;
1128 } __attribute__ ((packed));
1134 #define IEEE80211_DEFAULT_TX_ESSID "Penguin"
1135 #define IEEE80211_DEFAULT_BASIC_RATE 2 /* 1Mbps */
1137 enum {WMM_all_frame
, WMM_two_frame
, WMM_four_frame
, WMM_six_frame
};
1138 #define MAX_SP_Len (WMM_all_frame << 4)
1139 #define IEEE80211_QOS_TID 0x0f
1140 #define QOS_CTL_NOTCONTAIN_ACK (0x01 << 5)
1142 #define IEEE80211_DTIM_MBCAST 4
1143 #define IEEE80211_DTIM_UCAST 2
1144 #define IEEE80211_DTIM_VALID 1
1145 #define IEEE80211_DTIM_INVALID 0
1147 #define IEEE80211_PS_DISABLED 0
1148 #define IEEE80211_PS_UNICAST IEEE80211_DTIM_UCAST
1149 #define IEEE80211_PS_MBCAST IEEE80211_DTIM_MBCAST
1151 //added by David for QoS 2006/6/30
1152 //#define WMM_Hang_8187
1153 #ifdef WMM_Hang_8187
1154 #undef WMM_Hang_8187
1157 #define WME_AC_BK 0x00
1158 #define WME_AC_BE 0x01
1159 #define WME_AC_VI 0x02
1160 #define WME_AC_VO 0x03
1161 #define WME_ACI_MASK 0x03
1162 #define WME_AIFSN_MASK 0x03
1163 #define WME_AC_PRAM_LEN 16
1165 //UP Mapping to AC, using in MgntQuery_SequenceNumber() and maybe for DSCP
1166 //#define UP2AC(up) ((up<3) ? ((up==0)?1:0) : (up>>1))
1167 #define UP2AC(up) ( \
1168 ((up) < 1) ? WME_AC_BE : \
1169 ((up) < 3) ? WME_AC_BK : \
1170 ((up) < 4) ? WME_AC_BE : \
1171 ((up) < 6) ? WME_AC_VI : \
1174 //AC Mapping to UP, using in Tx part for selecting the corresponding TX queue
1175 #define AC2UP(_ac) ( \
1176 ((_ac) == WME_AC_VO) ? 6 : \
1177 ((_ac) == WME_AC_VI) ? 5 : \
1178 ((_ac) == WME_AC_BK) ? 1 : \
1181 #define ETHER_ADDR_LEN 6 /* length of an Ethernet address */
1183 /* length of two Ethernet address plus ether type */
1184 #define ETHERNET_HEADER_SIZE 14
1186 struct ether_header
{
1187 u8 ether_dhost
[ETHER_ADDR_LEN
];
1188 u8 ether_shost
[ETHER_ADDR_LEN
];
1190 } __attribute__((packed
));
1192 #ifndef ETHERTYPE_PAE
1193 #define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */
1195 #ifndef ETHERTYPE_IP
1196 #define ETHERTYPE_IP 0x0800 /* IP protocol */
1200 ERP_NonERPpresent
= 1,
1201 ERP_UseProtection
= 2,
1202 ERP_BarkerPreambleMode
= 4,
1205 struct ieee80211_network
{
1206 /* These entries are used to identify a unique network */
1209 /* Ensure null-terminated for any debug msgs */
1210 u8 ssid
[IW_ESSID_MAX_SIZE
+ 1];
1213 struct ieee80211_qos_data qos_data
;
1216 bool bWithAironetIE
;
1217 bool bCkipSupported
;
1221 /* CCXv4 S59, MBSSID. */
1226 /* CCX 2 S38, WLAN Device Version Number element. */
1227 bool bWithCcxVerNum
;
1230 /* These are network statistics */
1231 struct ieee80211_rx_stats stats
;
1233 u8 rates
[MAX_RATES_LENGTH
];
1235 u8 rates_ex
[MAX_RATES_EX_LENGTH
];
1237 unsigned long last_scanned
;
1242 u16 beacon_interval
;
1243 u16 listen_interval
;
1246 u8 wpa_ie
[MAX_WPA_IE_LEN
];
1248 u8 rsn_ie
[MAX_WPA_IE_LEN
];
1251 struct ieee80211_tim_parameters tim
;
1254 u32 last_dtim_sta_time
[2];
1258 struct ieee80211_wmm_ac_param wmm_param
[4];
1260 u8 Turbo_Enable
;//enable turbo mode, added by thomas
1262 u8 CountryIeBuf
[MAX_IE_LEN
];
1266 /* Added to handle broadcom AP management frame CCK rate. */
1267 bool broadcom_cap_exist
;
1268 bool realtek_cap_exit
;
1269 bool marvell_cap_exist
;
1270 bool ralink_cap_exist
;
1271 bool atheros_cap_exist
;
1272 bool cisco_cap_exist
;
1273 bool unknown_cap_exist
;
1274 bool berp_info_valid
;
1275 bool buseprotection
;
1277 struct list_head list
; /* put at the end of the structure */
1280 enum ieee80211_state
{
1282 /* the card is not linked at all */
1283 IEEE80211_NOLINK
= 0,
1285 /* IEEE80211_ASSOCIATING* are for BSS client mode
1286 * the driver shall not perform RX filtering unless
1287 * the state is LINKED.
1288 * The driver shall just check for the state LINKED and
1289 * defaults to NOLINK for ALL the other states (including
1293 /* the association procedure will start (wq scheduling)*/
1294 IEEE80211_ASSOCIATING
,
1295 IEEE80211_ASSOCIATING_RETRY
,
1297 /* the association procedure is sending AUTH request*/
1298 IEEE80211_ASSOCIATING_AUTHENTICATING
,
1300 /* the association procedure has successfully authentcated
1301 * and is sending association request
1303 IEEE80211_ASSOCIATING_AUTHENTICATED
,
1305 /* the link is ok. the card associated to a BSS or linked
1306 * to a ibss cell or acting as an AP and creating the bss
1310 /* same as LINKED, but the driver shall apply RX filter
1311 * rules as we are in NO_LINK mode. As the card is still
1312 * logically linked, but it is doing a syncro site survey
1313 * then it will be back to LINKED state.
1315 IEEE80211_LINKED_SCANNING
,
1319 #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
1320 #define DEFAULT_FTS 2346
1322 #define CFG_IEEE80211_RESERVE_FCS (1<<0)
1323 #define CFG_IEEE80211_COMPUTE_FCS (1<<1)
1325 #define IEEE80211_24GHZ_MIN_CHANNEL 1
1326 #define IEEE80211_24GHZ_MAX_CHANNEL 14
1327 #define IEEE80211_24GHZ_CHANNELS (IEEE80211_24GHZ_MAX_CHANNEL - \
1328 IEEE80211_24GHZ_MIN_CHANNEL + 1)
1330 #define IEEE80211_52GHZ_MIN_CHANNEL 34
1331 #define IEEE80211_52GHZ_MAX_CHANNEL 165
1332 #define IEEE80211_52GHZ_CHANNELS (IEEE80211_52GHZ_MAX_CHANNEL - \
1333 IEEE80211_52GHZ_MIN_CHANNEL + 1)
1335 typedef struct tx_pending_t
{
1337 struct ieee80211_txb
*txb
;
1340 struct bandwidth_autoswitch
{
1341 long threshold_20Mhzto40Mhz
;
1342 long threshold_40Mhzto20Mhz
;
1343 bool bforced_tx20Mhz
;
1344 bool bautoswitch_enable
;
1347 #define REORDER_WIN_SIZE 128
1348 #define REORDER_ENTRY_NUM 128
1349 typedef struct _RX_REORDER_ENTRY
1351 struct list_head List
;
1353 struct ieee80211_rxb
* prxb
;
1354 } RX_REORDER_ENTRY
, *PRX_REORDER_ENTRY
;
1356 typedef enum _Fsync_State
{
1362 /* Power save mode configured. */
1363 typedef enum _RT_PS_MODE
{
1364 eActive
, /* Active/Continuous access. */
1365 eMaxPs
, /* Max power save mode. */
1366 eFastPs
/* Fast power save mode. */
1369 typedef enum _IPS_CALLBACK_FUNCION
{
1370 IPS_CALLBACK_NONE
= 0,
1371 IPS_CALLBACK_MGNT_LINK_REQUEST
= 1,
1372 IPS_CALLBACK_JOIN_REQUEST
= 2,
1373 } IPS_CALLBACK_FUNCION
;
1375 typedef enum _RT_JOIN_ACTION
{
1386 /* Max num of support rates element: 8, Max num of ext. support rate: 255. */
1387 #define MAX_NUM_RATES 264
1389 typedef enum _RT_RF_POWER_STATE
{
1393 } RT_RF_POWER_STATE
;
1395 struct rt_power_save_control
{
1396 /* Inactive Power Save (IPS): disable RF when disconnected */
1398 bool bIPSModeBackup
;
1399 bool bHaltAdapterClkRQ
;
1400 bool bSwRfProcessing
;
1401 RT_RF_POWER_STATE eInactivePowerState
;
1402 struct work_struct InactivePsWorkItem
;
1403 struct timer_list InactivePsTimer
;
1405 /* return point for join action */
1406 IPS_CALLBACK_FUNCION ReturnPoint
;
1408 /* Recored Parameters for rescheduled JoinRequest */
1410 RT_JOIN_ACTION tmpJoinAction
;
1411 struct ieee80211_network tmpBssDesc
;
1413 /* Recored Parameters for rescheduled MgntLinkRequest */
1415 bool bTmpActiveScan
;
1416 bool bTmpFilterHiddenAP
;
1417 bool bTmpUpdateParms
;
1419 OCTET_STRING tmpSsid2Scan
;
1422 u8 tmpChannelNumber
;
1426 OCTET_STRING tmpSuppRateSet
;
1427 u8 tmpSuppRateBuf
[MAX_NUM_RATES
];
1429 struct ibss_parms tmpIbpm
;
1432 /* Leisre Poswer Save: disable RF if connected but traffic isn't busy */
1436 u8 RegMaxLPSAwakeIntvl
;
1443 /* Fw Control LPS */
1447 /* Record if there is a link request in IPS RF off progress. */
1448 bool LinkReqInIPSRFOffPgs
;
1450 * To make sure that connect info should be executed, so we set the
1451 * bit to filter the link info which comes after the connect info.
1453 bool BufConnectinfoBefore
;
1457 RF_CHANGE_BY_SW
= BIT31
,
1458 RF_CHANGE_BY_HW
= BIT30
,
1459 RF_CHANGE_BY_PS
= BIT29
,
1460 RF_CHANGE_BY_IPS
= BIT28
,
1464 COUNTRY_CODE_FCC
= 0,
1465 COUNTRY_CODE_IC
= 1,
1466 COUNTRY_CODE_ETSI
= 2,
1467 COUNTRY_CODE_SPAIN
= 3,
1468 COUNTRY_CODE_FRANCE
= 4,
1469 COUNTRY_CODE_MKK
= 5,
1470 COUNTRY_CODE_MKK1
= 6,
1471 COUNTRY_CODE_ISRAEL
= 7,
1474 COUNTRY_CODE_GLOBAL_DOMAIN
1477 /* Firmware related CMD IO. */
1478 typedef enum _FW_CMD_IO_TYPE
{
1479 FW_CMD_DIG_ENABLE
= 0, /* for DIG DM */
1480 FW_CMD_DIG_DISABLE
= 1,
1481 FW_CMD_DIG_HALT
= 2,
1482 FW_CMD_DIG_RESUME
= 3,
1483 FW_CMD_HIGH_PWR_ENABLE
= 4, /* for High Power DM */
1484 FW_CMD_HIGH_PWR_DISABLE
= 5,
1485 FW_CMD_RA_RESET
= 6, /* for Rate adaptive DM */
1486 FW_CMD_RA_ACTIVE
= 7,
1487 FW_CMD_RA_REFRESH_N
= 8,
1488 FW_CMD_RA_REFRESH_BG
= 9,
1489 FW_CMD_IQK_ENABLE
= 10, /* for FW supported IQK */
1490 FW_CMD_TXPWR_TRACK_ENABLE
= 11, /* Tx power tracking switch */
1491 FW_CMD_TXPWR_TRACK_DISABLE
= 12,/* Tx power tracking switch */
1492 FW_CMD_PAUSE_DM_BY_SCAN
= 13,
1493 FW_CMD_RESUME_DM_BY_SCAN
= 14,
1494 FW_CMD_MID_HIGH_PWR_ENABLE
= 15,
1495 /* indicate firmware that driver enters LPS, for PS-Poll hardware bug */
1496 FW_CMD_LPS_ENTER
= 16,
1497 /* indicate firmware that driver leave LPS */
1498 FW_CMD_LPS_LEAVE
= 17,
1501 #define RT_MAX_LD_SLOT_NUM 10
1502 struct rt_link_detect
{
1503 u32 NumRecvBcnInPeriod
;
1504 u32 NumRecvDataInPeriod
;
1506 /* number of Rx beacon / CheckForHang_period to determine link status */
1507 u32 RxBcnNum
[RT_MAX_LD_SLOT_NUM
];
1508 /* number of Rx data / CheckForHang_period to determine link status */
1509 u32 RxDataNum
[RT_MAX_LD_SLOT_NUM
];
1510 /* number of CheckForHang period to determine link status */
1514 u32 NumTxOkInPeriod
;
1515 u32 NumRxOkInPeriod
;
1519 struct ieee80211_device
{
1520 struct net_device
*dev
;
1521 struct ieee80211_security sec
;
1523 /* hw security related */
1525 bool is_silent_reset
;
1528 bool bSupportRemoteWakeUp
;
1529 RT_PS_MODE dot11PowerSaveMode
;
1531 bool be_scan_inprogress
;
1533 RT_RF_POWER_STATE eRFPowerState
;
1538 PRT_HIGH_THROUGHPUT pHTInfo
;
1539 spinlock_t bw_spinlock
;
1541 spinlock_t reorder_spinlock
;
1543 * for HT operation rate set, we use this one for HT data rate to
1544 * seperate different descriptors the way fill this is the same as
1547 u8 Regdot11HTOperationalRateSet
[16]; /* use RATR format */
1548 u8 dot11HTOperationalRateSet
[16]; /* use RATR format */
1549 u8 RegHTSuppRateSet
[16];
1550 u8 HTCurrentOperaRate
;
1551 u8 HTHighestOperaRate
;
1552 /* for rate operation mode to firmware */
1553 u8 bTxDisableRateFallBack
;
1554 u8 bTxUseDriverAssingedRate
;
1555 atomic_t atm_chnlop
;
1558 /* 802.11e and WMM Traffic Stream Info (TX) */
1559 struct list_head Tx_TS_Admit_List
;
1560 struct list_head Tx_TS_Pending_List
;
1561 struct list_head Tx_TS_Unused_List
;
1562 TX_TS_RECORD TxTsRecord
[TOTAL_TS_NUM
];
1563 /* 802.11e and WMM Traffic Stream Info (RX) */
1564 struct list_head Rx_TS_Admit_List
;
1565 struct list_head Rx_TS_Pending_List
;
1566 struct list_head Rx_TS_Unused_List
;
1567 RX_TS_RECORD RxTsRecord
[TOTAL_TS_NUM
];
1569 RX_REORDER_ENTRY RxReorderEntry
[128];
1570 struct list_head RxReorder_Unused_List
;
1573 /* Force per-packet priority 1~7. (default: 0, not to force it.) */
1576 /* Bookkeeping structures */
1577 struct net_device_stats stats
;
1578 struct ieee80211_stats ieee_stats
;
1579 struct ieee80211_softmac_stats softmac_stats
;
1581 /* Probe / Beacon management */
1582 struct list_head network_free_list
;
1583 struct list_head network_list
;
1584 struct ieee80211_network
*networks
;
1588 int iw_mode
; /* operating mode (IW_MODE_*) */
1589 struct iw_spy_data spy_data
;
1592 spinlock_t wpax_suitlist_lock
;
1594 int tx_headroom
; /* Set to size of any additional room needed at front
1595 * of allocated Tx SKBs */
1598 /* WEP and other encryption related settings at the device level */
1599 int open_wep
; /* Set to 1 to allow unencrypted frames */
1601 int reset_on_keychange
; /* Set to 1 if the HW needs to be reset on
1602 * WEP key changes */
1604 /* If the host performs {en,de}cryption, then set to 1 */
1606 int host_encrypt_msdu
;
1608 /* host performs multicast decryption */
1609 int host_mc_decrypt
;
1611 /* host should strip IV and ICV from protected frames */
1612 /* meaningful only when hardware decryption is being used */
1613 int host_strip_iv_icv
;
1617 int ieee802_1x
; /* is IEEE 802.1X used */
1620 bool bHalfWirelessN24GMode
;
1622 int drop_unencrypted
;
1623 int tkip_countermeasures
;
1624 int privacy_invoked
;
1628 u16 pairwise_key_type
;
1630 struct list_head crypt_deinit_list
;
1631 struct ieee80211_crypt_data
*crypt
[WEP_KEYS
];
1632 int tx_keyidx
; /* default TX key index (crypt[tx_keyidx]) */
1633 struct timer_list crypt_deinit_timer
;
1636 int bcrx_sta_key
; /* use individual keys to override default keys even
1637 * with RX of broad/multicast frames */
1639 /* Fragmentation structures */
1640 // each streaming contain a entry
1641 struct ieee80211_frag_entry frag_cache
[17][IEEE80211_FRAG_CACHE_LEN
];
1642 unsigned int frag_next_idx
[17];
1643 u16 fts
; /* Fragmentation Threshold */
1644 #define DEFAULT_RTS_THRESHOLD 2346U
1645 #define MIN_RTS_THRESHOLD 1
1646 #define MAX_RTS_THRESHOLD 2346U
1647 u16 rts
; /* RTS threshold */
1649 /* Association info */
1652 /* This stores infos for the current network.
1653 * Either the network we are associated in INFRASTRUCTURE
1654 * or the network that we are creating in MASTER mode.
1655 * ad-hoc is a mixture ;-).
1656 * Note that in infrastructure mode, even when not associated,
1657 * fields bssid and essid may be valid (if wpa_set and essid_set
1658 * are true) as thy carry the value set by the user via iwconfig
1660 struct ieee80211_network current_network
;
1662 enum ieee80211_state state
;
1666 int mode
; /* A, B, G */
1667 int modulation
; /* CCK, OFDM */
1668 int freq_band
; /* 2.4Ghz, 5.2Ghz, Mixed */
1669 int abg_true
; /* ABG flag */
1671 /* used for forcing the ibss workqueue to terminate
1672 * without wait for the syncro scan to terminate
1674 short sync_scan_hurryup
;
1679 u16 prev_seq_ctl
; /* used to drop duplicate frames */
1682 * map of allowed channels. 0 is dummy, FIXME: remeber to default to
1683 * a basic channel plan depending of the PHY type
1687 int rate
; /* current rate */
1689 //FIXME: pleace callback, see if redundant with softmac_features
1692 /* this contains flags for selectively enable softmac support */
1693 u16 softmac_features
;
1695 /* if the sequence control field is not filled by HW */
1698 /* association procedure transaction sequence number */
1701 /* AID for RTXed association responses */
1704 /* power save mode related*/
1710 struct tasklet_struct ps_task
;
1715 /* used if IEEE_SOFTMAC_TX_QUEUE is set */
1718 short proto_started
;
1720 struct semaphore wx_sem
;
1721 struct semaphore scan_sem
;
1723 spinlock_t mgmt_tx_lock
;
1724 spinlock_t beacon_lock
;
1731 u8 wpax_type_set
; //{added by David, 2006.9.28}
1732 u32 wpax_type_notify
; //{added by David, 2006.9.26}
1734 /* QoS related flag */
1735 char init_wmmparam_flag
;
1736 /* set on initialization */
1739 /* for discarding duplicated packets in IBSS */
1740 struct list_head ibss_mac_hash
[IEEE_IBSS_MAC_HASH_SIZE
];
1742 /* for discarding duplicated packets in BSS */
1743 u16 last_rxseq_num
[17]; /* rx seq previous per-tid */
1744 u16 last_rxfrag_num
[17];/* tx frag previous per-tid */
1745 unsigned long last_packet_time
[17];
1748 unsigned long last_rx_ps_time
;
1750 /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
1751 struct sk_buff
*mgmt_queue_ring
[MGMT_QUEUE_NUM
];
1752 int mgmt_queue_head
;
1753 int mgmt_queue_tail
;
1757 unsigned int hw_header
;
1758 struct sk_buff_head skb_waitQ
[MAX_QUEUE_SIZE
];
1759 struct sk_buff_head skb_aggQ
[MAX_QUEUE_SIZE
];
1760 struct sk_buff_head skb_drv_aggQ
[MAX_QUEUE_SIZE
];
1761 u32 sta_edca_param
[4];
1763 /* Enable/Disable Rx immediate BA capability. */
1764 bool enable_rx_imm_BA
;
1765 bool bibsscoordinator
;
1767 /* Dynamic Tx power for near/far range enable/disable. */
1768 bool bdynamic_txpower_enable
;
1770 bool bCTSToSelfEnable
;
1773 u32 fsync_time_interval
;
1774 u32 fsync_rate_bitmap
;
1775 u8 fsync_rssi_threshold
;
1778 u8 fsync_multiple_timeinterval
; /* value * FsyncTimeInterval */
1779 u32 fsync_firstdiff_ratethreshold
; /* low threshold */
1780 u32 fsync_seconddiff_ratethreshold
; /* decrease threshold */
1781 Fsync_State fsync_state
;
1782 bool bis_any_nonbepkts
;
1783 /* 20Mhz 40Mhz AutoSwitch Threshold */
1784 struct bandwidth_autoswitch bandwidth_auto_switch
;
1785 /* for txpower tracking */
1788 /* for AP roaming */
1789 struct rt_link_detect LinkDetectInfo
;
1791 struct rt_power_save_control PowerSaveControl
;
1794 /* used if IEEE_SOFTMAC_TX_QUEUE is set */
1795 struct tx_pending_t tx_pending
;
1797 /* used if IEEE_SOFTMAC_ASSOCIATE is set */
1798 struct timer_list associate_timer
;
1800 /* used if IEEE_SOFTMAC_BEACONS is set */
1801 struct timer_list beacon_timer
;
1802 struct work_struct associate_complete_wq
;
1803 struct work_struct associate_procedure_wq
;
1804 struct delayed_work softmac_scan_wq
;
1805 struct delayed_work associate_retry_wq
;
1806 struct delayed_work start_ibss_wq
;
1807 struct delayed_work hw_wakeup_wq
;
1808 struct delayed_work hw_sleep_wq
;
1809 struct delayed_work link_change_wq
;
1810 struct work_struct wx_sync_scan_wq
;
1811 struct workqueue_struct
*wq
;
1813 /* Callback functions */
1814 void (*set_security
)(struct net_device
*dev
,
1815 struct ieee80211_security
*sec
);
1817 /* Used to TX data frame by using txb structs.
1818 * this is not used if in the softmac_features
1819 * is set the flag IEEE_SOFTMAC_TX_QUEUE
1821 int (*hard_start_xmit
)(struct ieee80211_txb
*txb
,
1822 struct net_device
*dev
);
1824 int (*reset_port
)(struct net_device
*dev
);
1825 int (*is_queue_full
)(struct net_device
*dev
, int pri
);
1827 int (*handle_management
)(struct net_device
*dev
,
1828 struct ieee80211_network
*network
, u16 type
);
1829 int (*is_qos_active
)(struct net_device
*dev
, struct sk_buff
*skb
);
1831 /* Softmac-generated frames (mamagement) are TXed via this
1832 * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
1833 * not set. As some cards may have different HW queues that
1834 * one might want to use for data and management frames
1835 * the option to have two callbacks might be useful.
1836 * This fucntion can't sleep.
1838 int (*softmac_hard_start_xmit
)(struct sk_buff
*skb
,
1839 struct net_device
*dev
);
1841 /* used instead of hard_start_xmit (not softmac_hard_start_xmit)
1842 * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
1843 * frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
1844 * then also management frames are sent via this callback.
1845 * This function can't sleep.
1847 void (*softmac_data_hard_start_xmit
)(struct sk_buff
*skb
,
1848 struct net_device
*dev
,int rate
);
1850 /* stops the HW queue for DATA frames. Useful to avoid
1851 * waste time to TX data frame when we are reassociating
1852 * This function can sleep.
1854 void (*data_hard_stop
)(struct net_device
*dev
);
1856 /* OK this is complementar to data_poll_hard_stop */
1857 void (*data_hard_resume
)(struct net_device
*dev
);
1859 /* ask to the driver to retune the radio .
1860 * This function can sleep. the driver should ensure
1861 * the radio has been swithced before return.
1863 void (*set_chan
)(struct net_device
*dev
,short ch
);
1865 /* These are not used if the ieee stack takes care of
1866 * scanning (IEEE_SOFTMAC_SCAN feature set).
1867 * In this case only the set_chan is used.
1869 * The syncro version is similar to the start_scan but
1870 * does not return until all channels has been scanned.
1871 * this is called in user context and should sleep,
1872 * it is called in a work_queue when swithcing to ad-hoc mode
1873 * or in behalf of iwlist scan when the card is associated
1874 * and root user ask for a scan.
1875 * the fucntion stop_scan should stop both the syncro and
1876 * background scanning and can sleep.
1877 * The fucntion start_scan should initiate the background
1878 * scanning and can't sleep.
1880 void (*scan_syncro
)(struct net_device
*dev
);
1881 void (*start_scan
)(struct net_device
*dev
);
1882 void (*stop_scan
)(struct net_device
*dev
);
1884 /* indicate the driver that the link state is changed
1885 * for example it may indicate the card is associated now.
1886 * Driver might be interested in this to apply RX filter
1887 * rules or simply light the LINK led
1889 void (*link_change
)(struct net_device
*dev
);
1891 /* these two function indicates to the HW when to start
1892 * and stop to send beacons. This is used when the
1893 * IEEE_SOFTMAC_BEACONS is not set. For now the
1894 * stop_send_bacons is NOT guaranteed to be called only
1895 * after start_send_beacons.
1897 void (*start_send_beacons
) (struct net_device
*dev
);
1898 void (*stop_send_beacons
) (struct net_device
*dev
);
1900 /* power save mode related */
1901 void (*sta_wake_up
) (struct net_device
*dev
);
1902 void (*enter_sleep_state
) (struct net_device
*dev
, u32 th
, u32 tl
);
1903 short (*ps_is_queue_empty
) (struct net_device
*dev
);
1905 int (*handle_beacon
)(struct net_device
*dev
,
1906 struct ieee80211_probe_response
*beacon
,
1907 struct ieee80211_network
*network
);
1908 int (*handle_assoc_response
)(struct net_device
*dev
,
1909 struct ieee80211_assoc_response_frame
*resp
,
1910 struct ieee80211_network
*network
);
1912 /* check whether Tx hw resouce available */
1913 short (*check_nic_enough_desc
)(struct net_device
*dev
, int queue_index
);
1915 void (*SetBWModeHandler
)(struct net_device
*dev
,
1916 HT_CHANNEL_WIDTH Bandwidth
,
1917 HT_EXTCHNL_OFFSET Offset
);
1918 bool (*GetNmodeSupportBySecCfg
)(struct net_device
* dev
);
1919 void (*SetWirelessMode
)(struct net_device
* dev
, u8 wireless_mode
);
1920 bool (*GetHalfNmodeSupportByAPsHandler
)(struct net_device
* dev
);
1921 bool (*is_ap_in_wep_tkip
)(struct net_device
* dev
);
1922 void (*InitialGainHandler
)(struct net_device
*dev
, u8 Operation
);
1923 bool (*SetFwCmdHandler
)(struct net_device
*dev
, FW_CMD_IO_TYPE FwCmdIO
);
1924 void (*LedControlHandler
)(struct net_device
*dev
,
1925 LED_CTL_MODE LedAction
);
1926 /* This must be the last item so that it points to the data
1927 * allocated beyond this structure by alloc_ieee80211 */
1931 #define IEEE_A (1<<0)
1932 #define IEEE_B (1<<1)
1933 #define IEEE_G (1<<2)
1934 #define IEEE_N_24G (1<<4)
1935 #define IEEE_N_5G (1<<5)
1936 #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G)
1938 /* Generate a 802.11 header */
1940 /* Uses the channel change callback directly
1941 * instead of [start/stop] scan callbacks
1943 #define IEEE_SOFTMAC_SCAN (1<<2)
1945 /* Perform authentication and association handshake */
1946 #define IEEE_SOFTMAC_ASSOCIATE (1<<3)
1948 /* Generate probe requests */
1949 #define IEEE_SOFTMAC_PROBERQ (1<<4)
1951 /* Generate respones to probe requests */
1952 #define IEEE_SOFTMAC_PROBERS (1<<5)
1954 /* The ieee802.11 stack will manages the netif queue
1955 * wake/stop for the driver, taking care of 802.11
1956 * fragmentation. See softmac.c for details. */
1957 #define IEEE_SOFTMAC_TX_QUEUE (1<<7)
1959 /* Uses only the softmac_data_hard_start_xmit
1960 * even for TX management frames.
1962 #define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
1964 /* Generate beacons. The stack will enqueue beacons
1967 #define IEEE_SOFTMAC_BEACONS (1<<6)
1969 static inline void *ieee80211_priv(struct net_device
*dev
)
1971 return ((struct ieee80211_device
*)netdev_priv(dev
))->priv
;
1974 extern inline int ieee80211_is_empty_essid(const char *essid
, int essid_len
)
1976 /* Single white space is for Linksys APs */
1977 if (essid_len
== 1 && essid
[0] == ' ')
1980 /* Otherwise, if the entire essid is 0, we assume it is hidden */
1983 if (essid
[essid_len
] != '\0')
1990 extern inline int ieee80211_is_valid_mode(struct ieee80211_device
*ieee
, int mode
)
1993 * It is possible for both access points and our device to support
1994 * combinations of modes, so as long as there is one valid combination
1995 * of ap/device supported modes, then return success
1998 if ((mode
& IEEE_A
) &&
1999 (ieee
->modulation
& IEEE80211_OFDM_MODULATION
) &&
2000 (ieee
->freq_band
& IEEE80211_52GHZ_BAND
))
2003 if ((mode
& IEEE_G
) &&
2004 (ieee
->modulation
& IEEE80211_OFDM_MODULATION
) &&
2005 (ieee
->freq_band
& IEEE80211_24GHZ_BAND
))
2008 if ((mode
& IEEE_B
) &&
2009 (ieee
->modulation
& IEEE80211_CCK_MODULATION
) &&
2010 (ieee
->freq_band
& IEEE80211_24GHZ_BAND
))
2016 extern inline int ieee80211_get_hdrlen(u16 fc
)
2018 int hdrlen
= IEEE80211_3ADDR_LEN
;
2020 switch (WLAN_FC_GET_TYPE(fc
)) {
2021 case IEEE80211_FTYPE_DATA
:
2022 if ((fc
& IEEE80211_FCTL_FROMDS
) && (fc
& IEEE80211_FCTL_TODS
))
2023 hdrlen
= IEEE80211_4ADDR_LEN
; /* Addr4 */
2024 if(IEEE80211_QOS_HAS_SEQ(fc
))
2025 hdrlen
+= 2; /* QOS ctrl*/
2027 case IEEE80211_FTYPE_CTL
:
2028 switch (WLAN_FC_GET_STYPE(fc
)) {
2029 case IEEE80211_STYPE_CTS
:
2030 case IEEE80211_STYPE_ACK
:
2031 hdrlen
= IEEE80211_1ADDR_LEN
;
2034 hdrlen
= IEEE80211_2ADDR_LEN
;
2043 static inline u8
*ieee80211_get_payload(struct rtl_ieee80211_hdr
*hdr
)
2045 switch (ieee80211_get_hdrlen(le16_to_cpu(hdr
->frame_ctl
))) {
2046 case IEEE80211_1ADDR_LEN
:
2047 return ((struct ieee80211_hdr_1addr
*)hdr
)->payload
;
2048 case IEEE80211_2ADDR_LEN
:
2049 return ((struct ieee80211_hdr_2addr
*)hdr
)->payload
;
2050 case IEEE80211_3ADDR_LEN
:
2051 return ((struct ieee80211_hdr_3addr
*)hdr
)->payload
;
2052 case IEEE80211_4ADDR_LEN
:
2053 return ((struct ieee80211_hdr_4addr
*)hdr
)->payload
;
2058 static inline int ieee80211_is_ofdm_rate(u8 rate
)
2060 switch (rate
& ~IEEE80211_BASIC_RATE_MASK
) {
2061 case IEEE80211_OFDM_RATE_6MB
:
2062 case IEEE80211_OFDM_RATE_9MB
:
2063 case IEEE80211_OFDM_RATE_12MB
:
2064 case IEEE80211_OFDM_RATE_18MB
:
2065 case IEEE80211_OFDM_RATE_24MB
:
2066 case IEEE80211_OFDM_RATE_36MB
:
2067 case IEEE80211_OFDM_RATE_48MB
:
2068 case IEEE80211_OFDM_RATE_54MB
:
2074 static inline int ieee80211_is_cck_rate(u8 rate
)
2076 switch (rate
& ~IEEE80211_BASIC_RATE_MASK
) {
2077 case IEEE80211_CCK_RATE_1MB
:
2078 case IEEE80211_CCK_RATE_2MB
:
2079 case IEEE80211_CCK_RATE_5MB
:
2080 case IEEE80211_CCK_RATE_11MB
:
2088 extern void free_ieee80211(struct net_device
*dev
);
2089 extern struct net_device
*alloc_ieee80211(int sizeof_priv
);
2091 extern int ieee80211_set_encryption(struct ieee80211_device
*ieee
);
2093 /* ieee80211_tx.c */
2095 extern int ieee80211_encrypt_fragment(
2096 struct ieee80211_device
*ieee
,
2097 struct sk_buff
*frag
,
2100 extern int rtl8192_ieee80211_xmit(struct sk_buff
*skb
,
2101 struct net_device
*dev
);
2102 extern void ieee80211_txb_free(struct ieee80211_txb
*);
2105 /* ieee80211_rx.c */
2106 extern int ieee80211_rx(struct ieee80211_device
*ieee
, struct sk_buff
*skb
,
2107 struct ieee80211_rx_stats
*rx_stats
);
2108 extern void ieee80211_rx_mgt(struct ieee80211_device
*ieee
,
2109 struct ieee80211_hdr_4addr
*header
,
2110 struct ieee80211_rx_stats
*stats
);
2112 /* ieee80211_wx.c */
2113 extern int ieee80211_wx_get_scan(struct ieee80211_device
*ieee
,
2114 struct iw_request_info
*info
,
2115 union iwreq_data
*wrqu
, char *key
);
2116 extern int ieee80211_wx_set_encode(struct ieee80211_device
*ieee
,
2117 struct iw_request_info
*info
,
2118 union iwreq_data
*wrqu
, char *key
);
2119 extern int ieee80211_wx_get_encode(struct ieee80211_device
*ieee
,
2120 struct iw_request_info
*info
,
2121 union iwreq_data
*wrqu
, char *key
);
2122 extern int ieee80211_wx_set_encode_ext(struct ieee80211_device
*ieee
,
2123 struct iw_request_info
*info
,
2124 union iwreq_data
* wrqu
, char *extra
);
2125 extern int ieee80211_wx_set_auth(struct ieee80211_device
*ieee
,
2126 struct iw_request_info
*info
,
2127 struct iw_param
*data
, char *extra
);
2128 extern int ieee80211_wx_set_mlme(struct ieee80211_device
*ieee
,
2129 struct iw_request_info
*info
,
2130 union iwreq_data
*wrqu
, char *extra
);
2131 extern int ieee80211_wx_set_gen_ie(struct ieee80211_device
*ieee
, u8
*ie
, size_t len
);
2133 /* ieee80211_softmac.c */
2134 extern short ieee80211_is_54g(struct ieee80211_network net
);
2135 extern short ieee80211_is_shortslot(struct ieee80211_network net
);
2136 extern int ieee80211_rx_frame_softmac(struct ieee80211_device
*ieee
, struct sk_buff
*skb
,
2137 struct ieee80211_rx_stats
*rx_stats
, u16 type
,
2139 extern void ieee80211_softmac_new_net(struct ieee80211_device
*ieee
, struct ieee80211_network
*net
);
2141 void SendDisassociation(struct ieee80211_device
*ieee
, u8
* asSta
, u8 asRsn
);
2142 extern void ieee80211_softmac_xmit(struct ieee80211_txb
*txb
, struct ieee80211_device
*ieee
);
2144 extern void ieee80211_stop_send_beacons(struct ieee80211_device
*ieee
);
2145 extern void notify_wx_assoc_event(struct ieee80211_device
*ieee
);
2146 extern void ieee80211_softmac_check_all_nets(struct ieee80211_device
*ieee
);
2147 extern void ieee80211_start_bss(struct ieee80211_device
*ieee
);
2148 extern void ieee80211_start_master_bss(struct ieee80211_device
*ieee
);
2149 extern void ieee80211_start_ibss(struct ieee80211_device
*ieee
);
2150 extern void ieee80211_softmac_init(struct ieee80211_device
*ieee
);
2151 extern void ieee80211_softmac_free(struct ieee80211_device
*ieee
);
2152 extern void ieee80211_associate_abort(struct ieee80211_device
*ieee
);
2153 extern void ieee80211_disassociate(struct ieee80211_device
*ieee
);
2154 extern void ieee80211_stop_scan(struct ieee80211_device
*ieee
);
2155 extern void ieee80211_start_scan_syncro(struct ieee80211_device
*ieee
);
2156 extern void ieee80211_check_all_nets(struct ieee80211_device
*ieee
);
2157 extern void ieee80211_start_protocol(struct ieee80211_device
*ieee
);
2158 extern void ieee80211_stop_protocol(struct ieee80211_device
*ieee
);
2159 extern void ieee80211_softmac_start_protocol(struct ieee80211_device
*ieee
);
2160 extern void ieee80211_softmac_stop_protocol(struct ieee80211_device
*ieee
);
2161 extern void ieee80211_reset_queue(struct ieee80211_device
*ieee
);
2162 extern void ieee80211_wake_queue(struct ieee80211_device
*ieee
);
2163 extern void ieee80211_stop_queue(struct ieee80211_device
*ieee
);
2164 extern struct sk_buff
*ieee80211_get_beacon(struct ieee80211_device
*ieee
);
2165 extern void ieee80211_start_send_beacons(struct ieee80211_device
*ieee
);
2166 extern void ieee80211_stop_send_beacons(struct ieee80211_device
*ieee
);
2167 extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device
*ieee
, struct iw_point
*p
);
2168 extern void notify_wx_assoc_event(struct ieee80211_device
*ieee
);
2169 extern void ieee80211_ps_tx_ack(struct ieee80211_device
*ieee
, short success
);
2171 extern void softmac_mgmt_xmit(struct sk_buff
*skb
, struct ieee80211_device
*ieee
);
2173 /* ieee80211_crypt_ccmp&tkip&wep.c */
2174 extern void ieee80211_tkip_null(void);
2175 extern void ieee80211_wep_null(void);
2176 extern void ieee80211_ccmp_null(void);
2178 /* ieee80211_softmac_wx.c */
2180 extern int ieee80211_wx_get_wap(struct ieee80211_device
*ieee
,
2181 struct iw_request_info
*info
,
2182 union iwreq_data
*wrqu
, char *ext
);
2184 extern int ieee80211_wx_set_wap(struct ieee80211_device
*ieee
,
2185 struct iw_request_info
*info
,
2186 union iwreq_data
*awrq
,
2189 extern int ieee80211_wx_get_essid(struct ieee80211_device
*ieee
, struct iw_request_info
*a
,union iwreq_data
*wrqu
,char *b
);
2191 extern int ieee80211_wx_set_rate(struct ieee80211_device
*ieee
,
2192 struct iw_request_info
*info
,
2193 union iwreq_data
*wrqu
, char *extra
);
2195 extern int ieee80211_wx_get_rate(struct ieee80211_device
*ieee
,
2196 struct iw_request_info
*info
,
2197 union iwreq_data
*wrqu
, char *extra
);
2199 extern int ieee80211_wx_set_mode(struct ieee80211_device
*ieee
, struct iw_request_info
*a
,
2200 union iwreq_data
*wrqu
, char *b
);
2202 extern int ieee80211_wx_set_scan(struct ieee80211_device
*ieee
, struct iw_request_info
*a
,
2203 union iwreq_data
*wrqu
, char *b
);
2205 extern int ieee80211_wx_set_essid(struct ieee80211_device
*ieee
,
2206 struct iw_request_info
*a
,
2207 union iwreq_data
*wrqu
, char *extra
);
2209 extern int ieee80211_wx_get_mode(struct ieee80211_device
*ieee
, struct iw_request_info
*a
,
2210 union iwreq_data
*wrqu
, char *b
);
2212 extern int ieee80211_wx_set_freq(struct ieee80211_device
*ieee
, struct iw_request_info
*a
,
2213 union iwreq_data
*wrqu
, char *b
);
2215 extern int ieee80211_wx_get_freq(struct ieee80211_device
*ieee
, struct iw_request_info
*a
,
2216 union iwreq_data
*wrqu
, char *b
);
2218 extern void ieee80211_wx_sync_scan_wq(struct work_struct
*work
);
2220 extern int ieee80211_wx_set_rawtx(struct ieee80211_device
*ieee
,
2221 struct iw_request_info
*info
,
2222 union iwreq_data
*wrqu
, char *extra
);
2224 extern int ieee80211_wx_get_name(struct ieee80211_device
*ieee
,
2225 struct iw_request_info
*info
,
2226 union iwreq_data
*wrqu
, char *extra
);
2228 extern int ieee80211_wx_set_power(struct ieee80211_device
*ieee
,
2229 struct iw_request_info
*info
,
2230 union iwreq_data
*wrqu
, char *extra
);
2232 extern int ieee80211_wx_get_power(struct ieee80211_device
*ieee
,
2233 struct iw_request_info
*info
,
2234 union iwreq_data
*wrqu
, char *extra
);
2236 extern int ieee80211_wx_set_rts(struct ieee80211_device
*ieee
,
2237 struct iw_request_info
*info
,
2238 union iwreq_data
*wrqu
, char *extra
);
2240 extern int ieee80211_wx_get_rts(struct ieee80211_device
*ieee
,
2241 struct iw_request_info
*info
,
2242 union iwreq_data
*wrqu
, char *extra
);
2245 #define MAX_RECEIVE_BUFFER_SIZE 9100
2246 extern void HTDebugHTCapability(u8
*CapIE
, u8
*TitleString
);
2247 extern void HTDebugHTInfo(u8
*InfoIE
, u8
*TitleString
);
2249 extern void HTSetConnectBwMode(struct ieee80211_device
*ieee
,
2250 HT_CHANNEL_WIDTH Bandwidth
,
2251 HT_EXTCHNL_OFFSET Offset
);
2252 extern void HTUpdateDefaultSetting(struct ieee80211_device
*ieee
);
2253 extern void HTConstructCapabilityElement(struct ieee80211_device
*ieee
,
2254 u8
*posHTCap
, u8
*len
, u8 isEncrypt
);
2255 extern void HTConstructInfoElement(struct ieee80211_device
*ieee
,
2256 u8
*posHTInfo
, u8
*len
, u8 isEncrypt
);
2257 extern void HTConstructRT2RTAggElement(struct ieee80211_device
*ieee
,
2258 u8
*posRT2RTAgg
, u8
*len
);
2259 extern void HTOnAssocRsp(struct ieee80211_device
*ieee
);
2260 extern void HTInitializeHTInfo(struct ieee80211_device
*ieee
);
2261 extern void HTInitializeBssDesc(PBSS_HT pBssHT
);
2262 extern void HTResetSelfAndSavePeerSetting(struct ieee80211_device
*ieee
,
2263 struct ieee80211_network
*pNetwork
);
2264 extern void HTUpdateSelfAndPeerSetting(struct ieee80211_device
*ieee
,
2265 struct ieee80211_network
*pNetwork
);
2266 extern u8
HTGetHighestMCSRate(struct ieee80211_device
*ieee
, u8
*pMCSRateSet
,
2268 extern u8 MCS_FILTER_ALL
[];
2269 extern u16 MCS_DATA_RATE
[2][2][77] ;
2270 extern u8
HTCCheck(struct ieee80211_device
*ieee
, u8
*pFrame
);
2271 extern void HTResetIOTSetting(PRT_HIGH_THROUGHPUT pHTInfo
);
2272 extern bool IsHTHalfNmodeAPs(struct ieee80211_device
*ieee
);
2273 extern u16
HTHalfMcsToDataRate(struct ieee80211_device
*ieee
, u8 nMcsRate
);
2274 extern u16
HTMcsToDataRate(struct ieee80211_device
*ieee
, u8 nMcsRate
);
2275 extern u16
TxCountToDataRate(struct ieee80211_device
*ieee
, u8 nDataRate
);
2276 extern int ieee80211_rx_ADDBAReq(struct ieee80211_device
*ieee
,
2277 struct sk_buff
*skb
);
2278 extern int ieee80211_rx_ADDBARsp(struct ieee80211_device
*ieee
,
2279 struct sk_buff
*skb
);
2280 extern int ieee80211_rx_DELBA(struct ieee80211_device
*ieee
,
2281 struct sk_buff
*skb
);
2282 extern void TsInitAddBA(struct ieee80211_device
*ieee
, PTX_TS_RECORD pTS
,
2283 u8 Policy
, u8 bOverwritePending
);
2284 extern void TsInitDelBA(struct ieee80211_device
*ieee
,
2285 PTS_COMMON_INFO pTsCommonInfo
, TR_SELECT TxRxSelect
);
2286 extern void BaSetupTimeOut(unsigned long data
);
2287 extern void TxBaInactTimeout(unsigned long data
);
2288 extern void RxBaInactTimeout(unsigned long data
);
2289 extern void ResetBaEntry( PBA_RECORD pBA
);
2290 extern bool GetTs(struct ieee80211_device
*ieee
, PTS_COMMON_INFO
*ppTS
,
2291 u8
*Addr
, u8 TID
, TR_SELECT TxRxSelect
, /* Rx:1, Tx:0 */
2293 extern void TSInitialize(struct ieee80211_device
*ieee
);
2294 extern void TsStartAddBaProcess(struct ieee80211_device
*ieee
,
2295 PTX_TS_RECORD pTxTS
);
2296 extern void RemovePeerTS(struct ieee80211_device
*ieee
, u8
*Addr
);
2297 extern void RemoveAllTS(struct ieee80211_device
*ieee
);
2299 extern void ieee80211_softmac_scan_syncro(struct ieee80211_device
*ieee
);
2301 extern const long ieee80211_wlan_frequencies
[];
2303 extern inline void ieee80211_increment_scans(struct ieee80211_device
*ieee
)
2308 extern inline int ieee80211_get_scans(struct ieee80211_device
*ieee
)
2313 static inline const char *escape_essid(const char *essid
, u8 essid_len
) {
2314 static char escaped
[IW_ESSID_MAX_SIZE
* 2 + 1];
2315 const char *s
= essid
;
2318 if (ieee80211_is_empty_essid(essid
, essid_len
)) {
2319 memcpy(escaped
, "<hidden>", sizeof("<hidden>"));
2323 essid_len
= min(essid_len
, (u8
)IW_ESSID_MAX_SIZE
);
2324 while (essid_len
--) {
2337 /* For the function is more related to hardware setting, it's better to use the
2338 * ieee handler to refer to it.
2340 extern short check_nic_enough_desc(struct net_device
*dev
, int queue_index
);
2341 extern int ieee80211_data_xmit(struct sk_buff
*skb
, struct net_device
*dev
);
2342 extern int ieee80211_parse_info_param(struct ieee80211_device
*ieee
,
2343 struct ieee80211_info_element
*info_element
,
2345 struct ieee80211_network
*network
,
2346 struct ieee80211_rx_stats
*stats
);
2348 extern void ieee80211_indicate_packets(struct ieee80211_device
*ieee
,
2349 struct ieee80211_rxb
**prxbIndicateArray
,
2351 #define RT_ASOC_RETRY_LIMIT 5
2352 #endif /* IEEE80211_H */