2 * Merged with mainline rtllib.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 * <andrea.merello@gmail.com>
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/module.h>
29 #include <linux/interrupt.h>
30 #include <linux/jiffies.h>
31 #include <linux/timer.h>
32 #include <linux/sched.h>
33 #include <linux/semaphore.h>
35 #include <linux/delay.h>
36 #include <linux/wireless.h>
38 #include "rtllib_debug.h"
39 #include "rtl819x_HT.h"
40 #include "rtl819x_BA.h"
41 #include "rtl819x_TS.h"
43 #include <linux/netdevice.h>
44 #include <linux/if_arp.h> /* ARPHRD_ETHER */
45 #include <net/lib80211.h>
47 #define MAX_PRECMD_CNT 16
48 #define MAX_RFDEPENDCMD_CNT 16
49 #define MAX_POSTCMD_CNT 16
54 #include <net/iw_handler.h>
56 #ifndef IW_MODE_MONITOR
57 #define IW_MODE_MONITOR 6
61 #define IWEVCUSTOM 0x8c02
65 /* Max number of char in custom event - use multiple of them if needed */
66 #define IW_CUSTOM_MAX 256 /* In bytes */
69 #define skb_tail_pointer_rsl(skb) skb_tail_pointer(skb)
71 #define queue_delayed_work_rsl(x, y, z) queue_delayed_work(x, y, z)
72 #define INIT_DELAYED_WORK_RSL(x, y, z) INIT_DELAYED_WORK(x, y)
74 #define queue_work_rsl(x, y) queue_work(x, y)
75 #define INIT_WORK_RSL(x, y, z) INIT_WORK(x, y)
77 #define container_of_work_rsl(x, y, z) container_of(x, y, z)
78 #define container_of_dwork_rsl(x, y, z) \
79 container_of(container_of(x, struct delayed_work, work), y, z)
81 #define iwe_stream_add_event_rsl(info, start, stop, iwe, len) \
82 iwe_stream_add_event(info, start, stop, iwe, len)
84 #define iwe_stream_add_point_rsl(info, start, stop, iwe, p) \
85 iwe_stream_add_point(info, start, stop, iwe, p)
87 #define usb_alloc_urb_rsl(x, y) usb_alloc_urb(x, y)
88 #define usb_submit_urb_rsl(x, y) usb_submit_urb(x, y)
90 static inline void *netdev_priv_rsl(struct net_device *dev)
92 return netdev_priv(dev);
95 #define KEY_TYPE_NA 0x0
96 #define KEY_TYPE_WEP40 0x1
97 #define KEY_TYPE_TKIP 0x2
98 #define KEY_TYPE_CCMP 0x4
99 #define KEY_TYPE_WEP104 0x5
100 /* added for rtl819x tx procedure */
101 #define MAX_QUEUE_SIZE 0x10
108 #define TXCMD_QUEUE 5
111 #define BEACON_QUEUE 8
113 #define LOW_QUEUE BE_QUEUE
114 #define NORMAL_QUEUE MGNT_QUEUE
117 #define IW_MODE_MESH 7
119 #define AMSDU_SUBHEADER_LEN 14
120 #define SWRF_TIMEOUT 50
122 #define IE_CISCO_FLAG_POSITION 0x08
123 #define SUPPORT_CKIP_MIC 0x08
124 #define SUPPORT_CKIP_PK 0x10
125 #define RT_RF_OFF_LEVL_ASPM BIT0
126 #define RT_RF_OFF_LEVL_CLK_REQ BIT1
127 #define RT_RF_OFF_LEVL_PCI_D3 BIT2
128 #define RT_RF_OFF_LEVL_HALT_NIC BIT3
129 #define RT_RF_OFF_LEVL_FREE_FW BIT4
130 #define RT_RF_OFF_LEVL_FW_32K BIT5
131 #define RT_RF_PS_LEVEL_ALWAYS_ASPM BIT6
132 #define RT_RF_LPS_DISALBE_2R BIT30
133 #define RT_RF_LPS_LEVEL_ASPM BIT31
134 #define RT_IN_PS_LEVEL(pPSC, _PS_FLAG) \
135 ((pPSC->CurPsLevel & _PS_FLAG) ? true : false)
136 #define RT_CLEAR_PS_LEVEL(pPSC, _PS_FLAG) \
137 (pPSC->CurPsLevel &= (~(_PS_FLAG)))
138 #define RT_SET_PS_LEVEL(pPSC, _PS_FLAG) (pPSC->CurPsLevel |= _PS_FLAG)
140 /* defined for skb cb field */
141 /* At most 28 byte */
143 /* Tx Desc Related flags (8-9) */
149 u8 bTxDisableRateFallBack:1;
150 u8 bTxUseDriverAssingedRate:1;
155 /* Tx Firmware Related flags (10-11)*/
159 u8 bUseShortPreamble:1;
160 u8 bTxEnableFwCalcDur:1;
167 u8 bRTSUseShortPreamble:1;
174 /* Tx Desc related element(12-19) */
185 /* Tx firmware related element(20-27) */
193 u8 bIsSpecialDataFrame;
199 enum sw_chnl_cmd_id {
201 CmdID_SetTxPowerLevel,
203 CmdID_WritePortUlong,
204 CmdID_WritePortUshort,
205 CmdID_WritePortUchar,
210 enum sw_chnl_cmd_id CmdID;
216 /*--------------------------Define -------------------------------------------*/
219 #define MGN_5_5M 0x0b
231 #define MGN_MCS0 0x80
232 #define MGN_MCS1 0x81
233 #define MGN_MCS2 0x82
234 #define MGN_MCS3 0x83
235 #define MGN_MCS4 0x84
236 #define MGN_MCS5 0x85
237 #define MGN_MCS6 0x86
238 #define MGN_MCS7 0x87
239 #define MGN_MCS8 0x88
240 #define MGN_MCS9 0x89
241 #define MGN_MCS10 0x8a
242 #define MGN_MCS11 0x8b
243 #define MGN_MCS12 0x8c
244 #define MGN_MCS13 0x8d
245 #define MGN_MCS14 0x8e
246 #define MGN_MCS15 0x8f
247 #define MGN_MCS0_SG 0x90
248 #define MGN_MCS1_SG 0x91
249 #define MGN_MCS2_SG 0x92
250 #define MGN_MCS3_SG 0x93
251 #define MGN_MCS4_SG 0x94
252 #define MGN_MCS5_SG 0x95
253 #define MGN_MCS6_SG 0x96
254 #define MGN_MCS7_SG 0x97
255 #define MGN_MCS8_SG 0x98
256 #define MGN_MCS9_SG 0x99
257 #define MGN_MCS10_SG 0x9a
258 #define MGN_MCS11_SG 0x9b
259 #define MGN_MCS12_SG 0x9c
260 #define MGN_MCS13_SG 0x9d
261 #define MGN_MCS14_SG 0x9e
262 #define MGN_MCS15_SG 0x9f
266 HW_VAR_MULTICAST_REG,
270 HW_VAR_SECURITY_CONF,
271 HW_VAR_BEACON_INTERVAL,
273 HW_VAR_LISTEN_INTERVAL,
286 HW_VAR_RATE_FALLBACK_CONTROL,
287 HW_VAR_CONTENTION_WINDOW,
292 HW_VAR_AMPDU_MIN_SPACE,
293 HW_VAR_SHORTGI_DENSITY,
295 HW_VAR_MCS_RATE_AVAILABLE,
298 HW_VAR_DIS_Req_Qsize,
299 HW_VAR_CCX_CHNL_LOAD,
300 HW_VAR_CCX_NOISE_HISTOGRAM,
307 HW_VAR_SET_DEV_POWER,
317 HW_VAR_USER_CONTROL_TURBO_MODE,
323 HW_VAR_AUTOLOAD_STATUS,
324 HW_VAR_RF_2R_DISABLE,
326 HW_VAR_H2C_FW_PWRMODE,
327 HW_VAR_H2C_FW_JOINBSSRPT,
328 HW_VAR_1X1_RECV_COMBINE,
329 HW_VAR_STOP_SEND_BEACON,
334 HW_VAR_H2C_FW_UPDATE_GTK,
337 HW_VAR_WF_IS_MAC_ADDR,
338 HW_VAR_H2C_FW_OFFLOAD,
341 HW_VAR_HANDLE_FW_C2H,
342 HW_VAR_DL_FW_RSVD_PAGE,
344 HW_VAR_HW_SEQ_ENABLE,
349 HW_VAR_SWITCH_EPHY_WoWLAN,
350 HW_VAR_INT_MIGRATION,
357 RT_OP_MODE_INFRASTRUCTURE,
364 (((priv->rtllib->current_network.mode == IEEE_A) \
365 || (priv->rtllib->current_network.mode == IEEE_N_24G) \
366 || (priv->rtllib->current_network.mode == IEEE_N_5G)) ? 16 : 10)
368 #define MGMT_QUEUE_NUM 5
370 #define IEEE_CMD_SET_WPA_PARAM 1
371 #define IEEE_CMD_SET_WPA_IE 2
372 #define IEEE_CMD_SET_ENCRYPTION 3
373 #define IEEE_CMD_MLME 4
375 #define IEEE_PARAM_WPA_ENABLED 1
376 #define IEEE_PARAM_TKIP_COUNTERMEASURES 2
377 #define IEEE_PARAM_DROP_UNENCRYPTED 3
378 #define IEEE_PARAM_PRIVACY_INVOKED 4
379 #define IEEE_PARAM_AUTH_ALGS 5
380 #define IEEE_PARAM_IEEE_802_1X 6
381 #define IEEE_PARAM_WPAX_SELECT 7
383 #define IEEE_MLME_STA_DEAUTH 1
384 #define IEEE_MLME_STA_DISASSOC 2
387 #define IEEE_CRYPT_ERR_UNKNOWN_ALG 2
388 #define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4
389 #define IEEE_CRYPT_ERR_KEY_SET_FAILED 5
390 #define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7
391 #define IEEE_CRYPT_ALG_NAME_LEN 16
393 #define MAX_IE_LEN 0xff
397 u8 sta_addr[ETH_ALEN];
413 u8 alg[IEEE_CRYPT_ALG_NAME_LEN];
417 u8 seq[8]; /* sequence counter (set: RX, get: TX) */
425 #if WIRELESS_EXT < 17
426 #define IW_QUAL_QUAL_INVALID 0x10
427 #define IW_QUAL_LEVEL_INVALID 0x20
428 #define IW_QUAL_NOISE_INVALID 0x40
429 #define IW_QUAL_QUAL_UPDATED 0x1
430 #define IW_QUAL_LEVEL_UPDATED 0x2
431 #define IW_QUAL_NOISE_UPDATED 0x4
434 #define msleep_interruptible_rsl msleep_interruptible
436 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
439 * The figure in section 7.1.2 suggests a body size of up to 2312
440 * bytes is allowed, which is a bit confusing, I suspect this
441 * represents the 2304 bytes of real data, plus a possible 8 bytes of
442 * WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro)
444 #define RTLLIB_1ADDR_LEN 10
445 #define RTLLIB_2ADDR_LEN 16
446 #define RTLLIB_3ADDR_LEN 24
447 #define RTLLIB_4ADDR_LEN 30
448 #define RTLLIB_FCS_LEN 4
450 #define RTLLIB_SKBBUFFER_SIZE 2500
452 #define MIN_FRAG_THRESHOLD 256U
453 #define MAX_FRAG_THRESHOLD 2346U
455 /* Frame control field constants */
456 #define RTLLIB_FCTL_FTYPE 0x000c
457 #define RTLLIB_FCTL_STYPE 0x00f0
458 #define RTLLIB_FCTL_FRAMETYPE 0x00fc
459 #define RTLLIB_FCTL_TODS 0x0100
460 #define RTLLIB_FCTL_FROMDS 0x0200
461 #define RTLLIB_FCTL_DSTODS 0x0300
462 #define RTLLIB_FCTL_MOREFRAGS 0x0400
463 #define RTLLIB_FCTL_RETRY 0x0800
464 #define RTLLIB_FCTL_PM 0x1000
465 #define RTLLIB_FCTL_MOREDATA 0x2000
466 #define RTLLIB_FCTL_WEP 0x4000
467 #define RTLLIB_FCTL_ORDER 0x8000
469 #define RTLLIB_FTYPE_MGMT 0x0000
470 #define RTLLIB_FTYPE_CTL 0x0004
471 #define RTLLIB_FTYPE_DATA 0x0008
474 #define RTLLIB_STYPE_ASSOC_REQ 0x0000
475 #define RTLLIB_STYPE_ASSOC_RESP 0x0010
476 #define RTLLIB_STYPE_REASSOC_REQ 0x0020
477 #define RTLLIB_STYPE_REASSOC_RESP 0x0030
478 #define RTLLIB_STYPE_PROBE_REQ 0x0040
479 #define RTLLIB_STYPE_PROBE_RESP 0x0050
480 #define RTLLIB_STYPE_BEACON 0x0080
481 #define RTLLIB_STYPE_ATIM 0x0090
482 #define RTLLIB_STYPE_DISASSOC 0x00A0
483 #define RTLLIB_STYPE_AUTH 0x00B0
484 #define RTLLIB_STYPE_DEAUTH 0x00C0
485 #define RTLLIB_STYPE_MANAGE_ACT 0x00D0
488 #define RTLLIB_STYPE_PSPOLL 0x00A0
489 #define RTLLIB_STYPE_RTS 0x00B0
490 #define RTLLIB_STYPE_CTS 0x00C0
491 #define RTLLIB_STYPE_ACK 0x00D0
494 #define RTLLIB_STYPE_DATA 0x0000
495 #define RTLLIB_STYPE_DATA_CFACK 0x0010
496 #define RTLLIB_STYPE_DATA_CFPOLL 0x0020
497 #define RTLLIB_STYPE_DATA_CFACKPOLL 0x0030
498 #define RTLLIB_STYPE_NULLFUNC 0x0040
499 #define RTLLIB_STYPE_QOS_DATA 0x0080
500 #define RTLLIB_STYPE_QOS_NULL 0x00C0
502 #define RTLLIB_SCTL_FRAG 0x000F
503 #define RTLLIB_SCTL_SEQ 0xFFF0
506 #define RTLLIB_QCTL_TID 0x000F
508 #define FC_QOS_BIT BIT7
509 #define IsDataFrame(pdu) (((pdu[0] & 0x0C) == 0x08) ? true : false)
510 #define IsLegacyDataFrame(pdu) (IsDataFrame(pdu) && (!(pdu[0]&FC_QOS_BIT)))
511 #define IsQoSDataFrame(pframe) \
512 ((*(u16 *)pframe&(RTLLIB_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA)) == \
513 (RTLLIB_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA))
514 #define Frame_Order(pframe) (*(u16 *)pframe&RTLLIB_FCTL_ORDER)
515 #define SN_LESS(a, b) (((a-b)&0x800) != 0)
516 #define SN_EQUAL(a, b) (a == b)
517 #define MAX_DEV_ADDR_SIZE 8
533 enum init_gain_op_type {
540 LED_CTL_POWER_ON = 1,
545 LED_CTL_SITE_SURVEY = 6,
546 LED_CTL_POWER_OFF = 7,
547 LED_CTL_START_TO_LINK = 8,
550 enum rt_rf_type_def {
556 WIRELESS_MODE_UNKNOWN = 0x00,
557 WIRELESS_MODE_A = 0x01,
558 WIRELESS_MODE_B = 0x02,
559 WIRELESS_MODE_G = 0x04,
560 WIRELESS_MODE_AUTO = 0x08,
561 WIRELESS_MODE_N_24G = 0x10,
562 WIRELESS_MODE_N_5G = 0x20
566 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
567 #define ETH_P_IP 0x0800 /* Internet Protocol packet */
568 #define ETH_P_ARP 0x0806 /* Address Resolution packet */
569 #endif /* ETH_P_PAE */
571 #ifndef ETH_P_80211_RAW
572 #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
575 /* IEEE 802.11 defines */
577 #define P80211_OUI_LEN 3
579 struct rtllib_snap_hdr {
581 u8 dsap; /* always 0xAA */
582 u8 ssap; /* always 0xAA */
583 u8 ctrl; /* always 0x03 */
584 u8 oui[P80211_OUI_LEN]; /* organizational universal id */
588 enum _REG_PREAMBLE_MODE {
594 #define SNAP_SIZE sizeof(struct rtllib_snap_hdr)
596 #define WLAN_FC_GET_TYPE(fc) ((fc) & RTLLIB_FCTL_FTYPE)
597 #define WLAN_FC_GET_STYPE(fc) ((fc) & RTLLIB_FCTL_STYPE)
598 #define WLAN_FC_MORE_DATA(fc) ((fc) & RTLLIB_FCTL_MOREDATA)
600 #define WLAN_FC_GET_FRAMETYPE(fc) ((fc) & RTLLIB_FCTL_FRAMETYPE)
601 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & RTLLIB_SCTL_FRAG)
602 #define WLAN_GET_SEQ_SEQ(seq) (((seq) & RTLLIB_SCTL_SEQ) >> 4)
604 /* Authentication algorithms */
605 #define WLAN_AUTH_OPEN 0
606 #define WLAN_AUTH_SHARED_KEY 1
607 #define WLAN_AUTH_LEAP 128
609 #define WLAN_CAPABILITY_ESS (1<<0)
610 #define WLAN_CAPABILITY_IBSS (1<<1)
611 #define WLAN_CAPABILITY_PRIVACY (1<<4)
612 #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
613 #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
615 #define RTLLIB_STATMASK_SIGNAL (1<<0)
616 #define RTLLIB_STATMASK_RSSI (1<<1)
617 #define RTLLIB_STATMASK_NOISE (1<<2)
618 #define RTLLIB_STATMASK_WEMASK 0x7
620 #define RTLLIB_CCK_MODULATION (1<<0)
621 #define RTLLIB_OFDM_MODULATION (1<<1)
623 #define RTLLIB_24GHZ_BAND (1<<0)
624 #define RTLLIB_52GHZ_BAND (1<<1)
626 #define RTLLIB_CCK_RATE_LEN 4
627 #define RTLLIB_CCK_RATE_1MB 0x02
628 #define RTLLIB_CCK_RATE_2MB 0x04
629 #define RTLLIB_CCK_RATE_5MB 0x0B
630 #define RTLLIB_CCK_RATE_11MB 0x16
631 #define RTLLIB_OFDM_RATE_LEN 8
632 #define RTLLIB_OFDM_RATE_6MB 0x0C
633 #define RTLLIB_OFDM_RATE_9MB 0x12
634 #define RTLLIB_OFDM_RATE_12MB 0x18
635 #define RTLLIB_OFDM_RATE_18MB 0x24
636 #define RTLLIB_OFDM_RATE_24MB 0x30
637 #define RTLLIB_OFDM_RATE_36MB 0x48
638 #define RTLLIB_OFDM_RATE_48MB 0x60
639 #define RTLLIB_OFDM_RATE_54MB 0x6C
640 #define RTLLIB_BASIC_RATE_MASK 0x80
642 /* this is stolen and modified from the madwifi driver*/
643 #define RTLLIB_FC0_TYPE_MASK 0x0c
644 #define RTLLIB_FC0_TYPE_DATA 0x08
645 #define RTLLIB_FC0_SUBTYPE_MASK 0xB0
646 #define RTLLIB_FC0_SUBTYPE_QOS 0x80
648 #define RTLLIB_QOS_HAS_SEQ(fc) \
649 (((fc) & (RTLLIB_FC0_TYPE_MASK | RTLLIB_FC0_SUBTYPE_MASK)) == \
650 (RTLLIB_FC0_TYPE_DATA | RTLLIB_FC0_SUBTYPE_QOS))
652 /* this is stolen from ipw2200 driver */
653 #define IEEE_IBSS_MAC_HASH_SIZE 31
654 struct ieee_ibss_seq {
658 unsigned long packet_time[17];
659 struct list_head list;
662 /* NOTE: This data is for statistical purposes; not all hardware provides this
663 * information for frames received. Not setting these will not cause
664 * any adverse affects. */
665 struct rtllib_rx_stats {
670 u16 rate; /* in 100 kbps */
687 u16 bShortPreamble:1;
703 bool RxIs40MHzPacket;
705 u8 RxMIMOSignalStrength[4];
706 s8 RxMIMOSignalQuality[2];
707 bool bPacketMatchBSSID;
719 /* IEEE 802.11 requires that STA supports concurrent reception of at least
720 * three fragmented frames. This define can be increased to support more
721 * concurrent frames, but it should be noted that each entry can consume about
722 * 2 kB of RAM and increasing cache size will slow down frame reassembly.
724 #define RTLLIB_FRAG_CACHE_LEN 4
726 struct rtllib_frag_entry {
727 unsigned long first_frag_time;
729 unsigned int last_frag;
731 u8 src_addr[ETH_ALEN];
732 u8 dst_addr[ETH_ALEN];
735 struct rtllib_stats {
736 unsigned int tx_unicast_frames;
737 unsigned int tx_multicast_frames;
738 unsigned int tx_fragments;
739 unsigned int tx_unicast_octets;
740 unsigned int tx_multicast_octets;
741 unsigned int tx_deferred_transmissions;
742 unsigned int tx_single_retry_frames;
743 unsigned int tx_multiple_retry_frames;
744 unsigned int tx_retry_limit_exceeded;
745 unsigned int tx_discards;
746 unsigned int rx_unicast_frames;
747 unsigned int rx_multicast_frames;
748 unsigned int rx_fragments;
749 unsigned int rx_unicast_octets;
750 unsigned int rx_multicast_octets;
751 unsigned int rx_fcs_errors;
752 unsigned int rx_discards_no_buffer;
753 unsigned int tx_discards_wrong_sa;
754 unsigned int rx_discards_undecryptable;
755 unsigned int rx_message_in_msg_fragments;
756 unsigned int rx_message_in_bad_msg_fragments;
759 struct rtllib_device;
761 #define SEC_KEY_1 (1<<0)
762 #define SEC_KEY_2 (1<<1)
763 #define SEC_KEY_3 (1<<2)
764 #define SEC_KEY_4 (1<<3)
765 #define SEC_ACTIVE_KEY (1<<4)
766 #define SEC_AUTH_MODE (1<<5)
767 #define SEC_UNICAST_GROUP (1<<6)
768 #define SEC_LEVEL (1<<7)
769 #define SEC_ENABLED (1<<8)
770 #define SEC_ENCRYPT (1<<9)
772 #define SEC_LEVEL_0 0 /* None */
773 #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
774 #define SEC_LEVEL_2 2 /* Level 1 + TKIP */
775 #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
776 #define SEC_LEVEL_3 4 /* Level 2 + CCMP */
778 #define SEC_ALG_NONE 0
779 #define SEC_ALG_WEP 1
780 #define SEC_ALG_TKIP 2
781 #define SEC_ALG_CCMP 4
783 #define WEP_KEY_LEN 13
784 #define SCM_KEY_LEN 32
785 #define SCM_TEMPORAL_KEY_LENGTH 16
787 struct rtllib_security {
792 unicast_uses_group:1,
794 u8 key_sizes[NUM_WEP_KEYS];
795 u8 keys[NUM_WEP_KEYS][SCM_KEY_LEN];
801 /* 802.11 data frame from AP
802 * ,-------------------------------------------------------------------.
803 * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
804 * |------|------|---------|---------|---------|------|---------|------|
805 * Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
806 * | | tion | (BSSID) | | | ence | data | |
807 * `-------------------------------------------------------------------'
808 * Total: 28-2340 bytes
811 /* Management Frame Information Element Types */
815 MFIE_TYPE_FH_SET = 2,
816 MFIE_TYPE_DS_SET = 3,
817 MFIE_TYPE_CF_SET = 4,
819 MFIE_TYPE_IBSS_SET = 6,
820 MFIE_TYPE_COUNTRY = 7,
821 MFIE_TYPE_HOP_PARAMS = 8,
822 MFIE_TYPE_HOP_TABLE = 9,
823 MFIE_TYPE_REQUEST = 10,
824 MFIE_TYPE_CHALLENGE = 16,
825 MFIE_TYPE_POWER_CONSTRAINT = 32,
826 MFIE_TYPE_POWER_CAPABILITY = 33,
827 MFIE_TYPE_TPC_REQUEST = 34,
828 MFIE_TYPE_TPC_REPORT = 35,
829 MFIE_TYPE_SUPP_CHANNELS = 36,
831 MFIE_TYPE_MEASURE_REQUEST = 38,
832 MFIE_TYPE_MEASURE_REPORT = 39,
833 MFIE_TYPE_QUIET = 40,
834 MFIE_TYPE_IBSS_DFS = 41,
836 MFIE_TYPE_HT_CAP = 45,
838 MFIE_TYPE_RATES_EX = 50,
839 MFIE_TYPE_HT_INFO = 61,
840 MFIE_TYPE_AIRONET = 133,
841 MFIE_TYPE_GENERIC = 221,
842 MFIE_TYPE_QOS_PARAMETER = 222,
845 /* Minimal header; can be used for passing 802.11 frames with sufficient
846 * information to determine what type of underlying data type is actually
847 * stored in the data.
849 struct rtllib_pspoll_hdr {
862 struct rtllib_hdr_1addr {
869 struct rtllib_hdr_2addr {
877 struct rtllib_hdr_3addr {
887 struct rtllib_hdr_4addr {
898 struct rtllib_hdr_3addrqos {
909 struct rtllib_hdr_4addrqos {
921 struct rtllib_info_element {
927 struct rtllib_authentication {
928 struct rtllib_hdr_3addr header;
933 struct rtllib_info_element info_element[0];
936 struct rtllib_disauth {
937 struct rtllib_hdr_3addr header;
941 struct rtllib_disassoc {
942 struct rtllib_hdr_3addr header;
946 struct rtllib_probe_request {
947 struct rtllib_hdr_3addr header;
948 /* SSID, supported rates */
949 struct rtllib_info_element info_element[0];
952 struct rtllib_probe_response {
953 struct rtllib_hdr_3addr header;
955 __le16 beacon_interval;
957 /* SSID, supported rates, FH params, DS params,
958 * CF params, IBSS params, TIM (if beacon), RSN
960 struct rtllib_info_element info_element[0];
963 /* Alias beacon for probe_response */
964 #define rtllib_beacon rtllib_probe_response
966 struct rtllib_assoc_request_frame {
967 struct rtllib_hdr_3addr header;
969 __le16 listen_interval;
970 /* SSID, supported rates, RSN */
971 struct rtllib_info_element info_element[0];
974 struct rtllib_assoc_response_frame {
975 struct rtllib_hdr_3addr header;
979 struct rtllib_info_element info_element[0]; /* supported rates */
990 struct sk_buff *fragments[0];
993 #define MAX_SUBFRAME_COUNT 64
996 struct sk_buff *subframes[MAX_SUBFRAME_COUNT];
1013 /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
1014 * only use 8, and then use extended rates for the remaining supported
1015 * rates. Other APs, however, stick all of their supported rates on the
1016 * main rates information element...
1018 #define MAX_RATES_LENGTH ((u8)12)
1019 #define MAX_RATES_EX_LENGTH ((u8)16)
1020 #define MAX_NETWORK_COUNT 96
1022 #define MAX_CHANNEL_NUMBER 161
1023 #define RTLLIB_SOFTMAC_SCAN_TIME 100
1024 #define RTLLIB_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2)
1026 #define MAX_WPA_IE_LEN 64
1027 #define MAX_WZC_IE_LEN 256
1029 #define NETWORK_EMPTY_ESSID (1<<0)
1030 #define NETWORK_HAS_OFDM (1<<1)
1031 #define NETWORK_HAS_CCK (1<<2)
1034 #define NETWORK_HAS_QOS_PARAMETERS (1<<3)
1035 #define NETWORK_HAS_QOS_INFORMATION (1<<4)
1036 #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \
1037 NETWORK_HAS_QOS_INFORMATION)
1039 #define NETWORK_HAS_ERP_VALUE (1<<10)
1041 #define QOS_QUEUE_NUM 4
1042 #define QOS_OUI_LEN 3
1043 #define QOS_OUI_TYPE 2
1044 #define QOS_ELEMENT_ID 221
1045 #define QOS_OUI_INFO_SUB_TYPE 0
1046 #define QOS_OUI_PARAM_SUB_TYPE 1
1047 #define QOS_VERSION_1 1
1049 struct rtllib_qos_information_element {
1052 u8 qui[QOS_OUI_LEN];
1059 struct rtllib_qos_ac_parameter {
1065 struct rtllib_qos_parameter_info {
1066 struct rtllib_qos_information_element info_element;
1068 struct rtllib_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
1071 struct rtllib_qos_parameters {
1072 __le16 cw_min[QOS_QUEUE_NUM];
1073 __le16 cw_max[QOS_QUEUE_NUM];
1074 u8 aifs[QOS_QUEUE_NUM];
1075 u8 flag[QOS_QUEUE_NUM];
1076 __le16 tx_op_limit[QOS_QUEUE_NUM];
1079 struct rtllib_qos_data {
1080 struct rtllib_qos_parameters parameters;
1081 unsigned int wmm_acm;
1088 struct rtllib_tim_parameters {
1093 struct rtllib_wmm_ac_param {
1094 u8 ac_aci_acm_aifsn;
1095 u8 ac_ecwmin_ecwmax;
1104 EAPOL_ENCAP_ASF_ALERT
1107 static const char * const eap_types[] = {
1108 [EAP_PACKET] = "EAP-Packet",
1109 [EAPOL_START] = "EAPOL-Start",
1110 [EAPOL_LOGOFF] = "EAPOL-Logoff",
1111 [EAPOL_KEY] = "EAPOL-Key",
1112 [EAPOL_ENCAP_ASF_ALERT] = "EAPOL-Encap-ASF-Alert"
1115 static inline const char *eap_get_type(int type)
1117 return ((u32)type >= ARRAY_SIZE(eap_types)) ? "Unknown" :
1120 static inline u8 Frame_QoSTID(u8 *buf)
1122 struct rtllib_hdr_3addr *hdr;
1125 hdr = (struct rtllib_hdr_3addr *)buf;
1126 fc = le16_to_cpu(hdr->frame_ctl);
1127 return (u8)((union frameqos *)(buf + (((fc & RTLLIB_FCTL_TODS) &&
1128 (fc & RTLLIB_FCTL_FROMDS)) ? 30 : 24)))->field.tid;
1140 struct rtllib_softmac_stats {
1141 unsigned int rx_ass_ok;
1142 unsigned int rx_ass_err;
1143 unsigned int rx_probe_rq;
1144 unsigned int tx_probe_rs;
1145 unsigned int tx_beacons;
1146 unsigned int rx_auth_rq;
1147 unsigned int rx_auth_rs_ok;
1148 unsigned int rx_auth_rs_err;
1149 unsigned int tx_auth_rq;
1150 unsigned int no_auth_rs;
1151 unsigned int no_ass_rs;
1152 unsigned int tx_ass_rq;
1153 unsigned int rx_ass_rq;
1154 unsigned int tx_probe_rq;
1155 unsigned int reassoc;
1156 unsigned int swtxstop;
1157 unsigned int swtxawake;
1158 unsigned char CurrentShowTxate;
1159 unsigned char last_packet_rate;
1160 unsigned int txretrycount;
1163 /* These are the data types that can make up management packets
1165 * u16 auth_algorithm;
1166 * u16 auth_sequence;
1167 * u16 beacon_interval;
1169 * u8 current_ap[ETH_ALEN];
1170 * u16 listen_interval;
1172 * u16 association_id:14, reserved:2;
1174 * u32 time_stamp[2];
1179 #define RTLLIB_DEFAULT_TX_ESSID "Penguin"
1180 #define RTLLIB_DEFAULT_BASIC_RATE 2
1182 enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame};
1183 #define MAX_SP_Len (WMM_all_frame << 4)
1184 #define RTLLIB_QOS_TID 0x0f
1185 #define QOS_CTL_NOTCONTAIN_ACK (0x01 << 5)
1187 #define RTLLIB_DTIM_MBCAST 4
1188 #define RTLLIB_DTIM_UCAST 2
1189 #define RTLLIB_DTIM_VALID 1
1190 #define RTLLIB_DTIM_INVALID 0
1192 #define RTLLIB_PS_DISABLED 0
1193 #define RTLLIB_PS_UNICAST RTLLIB_DTIM_UCAST
1194 #define RTLLIB_PS_MBCAST RTLLIB_DTIM_MBCAST
1196 #define WME_AC_BK 0x00
1197 #define WME_AC_BE 0x01
1198 #define WME_AC_VI 0x02
1199 #define WME_AC_VO 0x03
1200 #define WME_ACI_MASK 0x03
1201 #define WME_AIFSN_MASK 0x03
1202 #define WME_AC_PRAM_LEN 16
1204 #define MAX_RECEIVE_BUFFER_SIZE 9100
1206 #define UP2AC(up) ( \
1207 ((up) < 1) ? WME_AC_BE : \
1208 ((up) < 3) ? WME_AC_BK : \
1209 ((up) < 4) ? WME_AC_BE : \
1210 ((up) < 6) ? WME_AC_VI : \
1213 #define ETHER_ADDR_LEN 6 /* length of an Ethernet address */
1214 #define ETHERNET_HEADER_SIZE 14 /* length of two Ethernet address
1217 struct ether_header {
1218 u8 ether_dhost[ETHER_ADDR_LEN];
1219 u8 ether_shost[ETHER_ADDR_LEN];
1224 ERP_NonERPpresent = 0x01,
1225 ERP_UseProtection = 0x02,
1226 ERP_BarkerPreambleMode = 0x04,
1229 struct rtllib_network {
1230 /* These entries are used to identify a unique network */
1233 /* Ensure null-terminated for any debug msgs */
1234 u8 ssid[IW_ESSID_MAX_SIZE + 1];
1236 u8 hidden_ssid[IW_ESSID_MAX_SIZE + 1];
1238 struct rtllib_qos_data qos_data;
1240 bool bWithAironetIE;
1241 bool bCkipSupported;
1246 u8 MBssid[ETH_ALEN];
1247 bool bWithCcxVerNum;
1249 /* These are network statistics */
1250 struct rtllib_rx_stats stats;
1252 u8 rates[MAX_RATES_LENGTH];
1254 u8 rates_ex[MAX_RATES_EX_LENGTH];
1256 unsigned long last_scanned;
1261 u16 beacon_interval;
1262 u16 listen_interval;
1265 u8 wpa_ie[MAX_WPA_IE_LEN];
1267 u8 rsn_ie[MAX_WPA_IE_LEN];
1269 u8 wzc_ie[MAX_WZC_IE_LEN];
1272 struct rtllib_tim_parameters tim;
1275 u64 last_dtim_sta_time;
1278 struct rtllib_wmm_ac_param wmm_param[4];
1281 u8 CountryIeBuf[MAX_IE_LEN];
1282 struct bss_ht bssht;
1283 bool broadcom_cap_exist;
1284 bool realtek_cap_exit;
1285 bool marvell_cap_exist;
1286 bool ralink_cap_exist;
1287 bool atheros_cap_exist;
1288 bool cisco_cap_exist;
1289 bool airgo_cap_exist;
1290 bool unknown_cap_exist;
1291 bool berp_info_valid;
1292 bool buseprotection;
1295 struct list_head list;
1300 /* the card is not linked at all */
1303 /* RTLLIB_ASSOCIATING* are for BSS client mode
1304 * the driver shall not perform RX filtering unless
1305 * the state is LINKED.
1306 * The driver shall just check for the state LINKED and
1307 * defaults to NOLINK for ALL the other states (including
1311 /* the association procedure will start (wq scheduling)*/
1313 RTLLIB_ASSOCIATING_RETRY,
1315 /* the association procedure is sending AUTH request*/
1316 RTLLIB_ASSOCIATING_AUTHENTICATING,
1318 /* the association procedure has successfully authenticated
1319 * and is sending association request
1321 RTLLIB_ASSOCIATING_AUTHENTICATED,
1323 /* the link is ok. the card associated to a BSS or linked
1324 * to a ibss cell or acting as an AP and creating the bss
1328 /* same as LINKED, but the driver shall apply RX filter
1329 * rules as we are in NO_LINK mode. As the card is still
1330 * logically linked, but it is doing a syncro site survey
1331 * then it will be back to LINKED state.
1333 RTLLIB_LINKED_SCANNING,
1336 #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
1337 #define DEFAULT_FTS 2346
1339 #define CFG_RTLLIB_RESERVE_FCS (1<<0)
1340 #define CFG_RTLLIB_COMPUTE_FCS (1<<1)
1344 struct rtllib_txb *txb;
1347 struct bandwidth_autoswitch {
1348 long threshold_20Mhzto40Mhz;
1349 long threshold_40Mhzto20Mhz;
1350 bool bforced_tx20Mhz;
1351 bool bautoswitch_enable;
1356 #define REORDER_WIN_SIZE 128
1357 #define REORDER_ENTRY_NUM 128
1358 struct rx_reorder_entry {
1359 struct list_head List;
1361 struct rtllib_rxb *prxb;
1376 enum ips_callback_function {
1377 IPS_CALLBACK_NONE = 0,
1378 IPS_CALLBACK_MGNT_LINK_REQUEST = 1,
1379 IPS_CALLBACK_JOIN_REQUEST = 2,
1382 enum rt_join_action {
1392 #define MAX_NUM_RATES 264
1394 enum rt_rf_power_state {
1400 #define MAX_SUPPORT_WOL_PATTERN_NUM 8
1402 enum wol_pattern_type {
1410 struct rt_pm_wol_info {
1415 enum wol_pattern_type PatternType;
1418 struct rt_pwr_save_ctrl {
1421 bool bIPSModeBackup;
1422 bool bSwRfProcessing;
1423 enum rt_rf_power_state eInactivePowerState;
1424 enum ips_callback_function ReturnPoint;
1426 enum rt_join_action tmpJoinAction;
1427 u8 tmpSuppRateBuf[MAX_NUM_RATES];
1432 u8 RegMaxLPSAwakeIntvl;
1440 struct rt_pm_wol_info PmWoLPatternInfo[MAX_SUPPORT_WOL_PATTERN_NUM];
1444 #define RT_RF_CHANGE_SOURCE u32
1446 #define RF_CHANGE_BY_SW BIT31
1447 #define RF_CHANGE_BY_HW BIT30
1448 #define RF_CHANGE_BY_PS BIT29
1449 #define RF_CHANGE_BY_IPS BIT28
1450 #define RF_CHANGE_BY_INIT 0
1452 enum country_code_type {
1453 COUNTRY_CODE_FCC = 0,
1454 COUNTRY_CODE_IC = 1,
1455 COUNTRY_CODE_ETSI = 2,
1456 COUNTRY_CODE_SPAIN = 3,
1457 COUNTRY_CODE_FRANCE = 4,
1458 COUNTRY_CODE_MKK = 5,
1459 COUNTRY_CODE_MKK1 = 6,
1460 COUNTRY_CODE_ISRAEL = 7,
1461 COUNTRY_CODE_TELEC = 8,
1462 COUNTRY_CODE_MIC = 9,
1463 COUNTRY_CODE_GLOBAL_DOMAIN = 10,
1464 COUNTRY_CODE_WORLD_WIDE_13 = 11,
1465 COUNTRY_CODE_TELEC_NETGEAR = 12,
1469 enum scan_op_backup_opt {
1470 SCAN_OPT_BACKUP = 0,
1475 enum fw_cmd_io_type {
1476 FW_CMD_DIG_ENABLE = 0,
1477 FW_CMD_DIG_DISABLE = 1,
1478 FW_CMD_DIG_HALT = 2,
1479 FW_CMD_DIG_RESUME = 3,
1480 FW_CMD_HIGH_PWR_ENABLE = 4,
1481 FW_CMD_HIGH_PWR_DISABLE = 5,
1482 FW_CMD_RA_RESET = 6,
1483 FW_CMD_RA_ACTIVE = 7,
1484 FW_CMD_RA_REFRESH_N = 8,
1485 FW_CMD_RA_REFRESH_BG = 9,
1486 FW_CMD_RA_INIT = 10,
1487 FW_CMD_IQK_ENABLE = 11,
1488 FW_CMD_TXPWR_TRACK_ENABLE = 12,
1489 FW_CMD_TXPWR_TRACK_DISABLE = 13,
1490 FW_CMD_TXPWR_TRACK_THERMAL = 14,
1491 FW_CMD_PAUSE_DM_BY_SCAN = 15,
1492 FW_CMD_RESUME_DM_BY_SCAN = 16,
1493 FW_CMD_RA_REFRESH_N_COMB = 17,
1494 FW_CMD_RA_REFRESH_BG_COMB = 18,
1495 FW_CMD_ANTENNA_SW_ENABLE = 19,
1496 FW_CMD_ANTENNA_SW_DISABLE = 20,
1497 FW_CMD_TX_FEEDBACK_CCX_ENABLE = 21,
1498 FW_CMD_LPS_ENTER = 22,
1499 FW_CMD_LPS_LEAVE = 23,
1502 #define RT_MAX_LD_SLOT_NUM 10
1503 struct rt_link_detect {
1505 u32 NumRecvBcnInPeriod;
1506 u32 NumRecvDataInPeriod;
1508 u32 RxBcnNum[RT_MAX_LD_SLOT_NUM];
1509 u32 RxDataNum[RT_MAX_LD_SLOT_NUM];
1513 u32 NumTxOkInPeriod;
1514 u32 NumRxOkInPeriod;
1515 u32 NumRxUnicastOkInPeriod;
1517 bool bHigherBusyTraffic;
1518 bool bHigherBusyRxTraffic;
1521 struct sw_cam_table {
1523 u8 macaddr[ETH_ALEN];
1531 #define TOTAL_CAM_ENTRY 32
1532 struct rate_adaptive {
1533 u8 rate_adaptive_disabled;
1537 u32 high_rssi_thresh_for_ra;
1538 u32 high2low_rssi_thresh_for_ra;
1539 u8 low2high_rssi_thresh_for_ra40M;
1540 u32 low_rssi_thresh_for_ra40M;
1541 u8 low2high_rssi_thresh_for_ra20M;
1542 u32 low_rssi_thresh_for_ra20M;
1543 u32 upper_rssi_threshold_ratr;
1544 u32 middle_rssi_threshold_ratr;
1545 u32 low_rssi_threshold_ratr;
1546 u32 low_rssi_threshold_ratr_40M;
1547 u32 low_rssi_threshold_ratr_20M;
1548 u8 ping_rssi_enable;
1550 u32 ping_rssi_thresh_for_ra;
1556 #define NUM_PMKID_CACHE 16
1557 struct rt_pmkid_list {
1564 struct rt_intel_promisc_mode {
1565 bool bPromiscuousOn;
1566 bool bFilterSourceStationFrame;
1570 /*************** DRIVER STATUS *****/
1571 #define STATUS_SCANNING 0
1572 /*************** DRIVER STATUS *****/
1577 LPS_WAIT_NULL_DATA_SEND = 2,
1580 struct rtllib_device {
1581 struct pci_dev *pdev;
1582 struct net_device *dev;
1583 struct rtllib_security sec;
1585 bool disable_mgnt_queue;
1587 unsigned long status;
1592 enum rt_op_mode OpMode;
1594 /* The last AssocReq/Resp IEs */
1595 u8 *assocreq_ies, *assocresp_ies;
1596 size_t assocreq_ies_len, assocresp_ies_len;
1602 bool is_silent_reset;
1606 bool bSupportRemoteWakeUp;
1607 enum rt_ps_mode dot11PowerSaveMode;
1609 bool FirstIe_InScan;
1610 bool be_scan_inprogress;
1612 enum rt_rf_power_state eRFPowerState;
1613 RT_RF_CHANGE_SOURCE RfOffReason;
1616 struct rt_hi_throughput *pHTInfo;
1617 spinlock_t bw_spinlock;
1619 spinlock_t reorder_spinlock;
1620 u8 Regdot11HTOperationalRateSet[16];
1621 u8 Regdot11TxHTOperationalRateSet[16];
1622 u8 dot11HTOperationalRateSet[16];
1623 u8 RegHTSuppRateSet[16];
1624 u8 HTCurrentOperaRate;
1625 u8 HTHighestOperaRate;
1628 u8 bTxDisableRateFallBack;
1629 u8 bTxUseDriverAssingedRate;
1630 u8 bTxEnableFwCalcDur;
1631 atomic_t atm_chnlop;
1634 struct list_head Tx_TS_Admit_List;
1635 struct list_head Tx_TS_Pending_List;
1636 struct list_head Tx_TS_Unused_List;
1637 struct tx_ts_record TxTsRecord[TOTAL_TS_NUM];
1638 struct list_head Rx_TS_Admit_List;
1639 struct list_head Rx_TS_Pending_List;
1640 struct list_head Rx_TS_Unused_List;
1641 struct rx_ts_record RxTsRecord[TOTAL_TS_NUM];
1642 struct rx_reorder_entry RxReorderEntry[128];
1643 struct list_head RxReorder_Unused_List;
1646 /* Bookkeeping structures */
1647 struct net_device_stats stats;
1648 struct rtllib_stats ieee_stats;
1649 struct rtllib_softmac_stats softmac_stats;
1651 /* Probe / Beacon management */
1652 struct list_head network_free_list;
1653 struct list_head network_list;
1654 struct rtllib_network *networks;
1658 int iw_mode; /* operating mode (IW_MODE_*) */
1659 bool bNetPromiscuousMode;
1660 struct rt_intel_promisc_mode IntelPromiscuousModeInfo;
1663 spinlock_t wpax_suitlist_lock;
1665 int tx_headroom; /* Set to size of any additional room needed at front
1666 * of allocated Tx SKBs
1670 /* WEP and other encryption related settings at the device level */
1671 int open_wep; /* Set to 1 to allow unencrypted frames */
1673 int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
1677 /* If the host performs {en,de}cryption, then set to 1 */
1681 int ieee802_1x; /* is IEEE 802.1X used */
1685 bool bHalfWirelessN24GMode;
1687 int drop_unencrypted;
1688 int tkip_countermeasures;
1689 int privacy_invoked;
1694 u8 ap_mac_addr[ETH_ALEN];
1695 u16 pairwise_key_type;
1698 struct lib80211_crypt_info crypt_info;
1700 struct sw_cam_table swcamtable[TOTAL_CAM_ENTRY];
1702 struct rt_pmkid_list PMKIDList[NUM_PMKID_CACHE];
1704 /* Fragmentation structures */
1705 struct rtllib_frag_entry frag_cache[17][RTLLIB_FRAG_CACHE_LEN];
1706 unsigned int frag_next_idx[17];
1707 u16 fts; /* Fragmentation Threshold */
1708 #define DEFAULT_RTS_THRESHOLD 2346U
1709 #define MIN_RTS_THRESHOLD 1
1710 #define MAX_RTS_THRESHOLD 2346U
1711 u16 rts; /* RTS threshold */
1713 /* Association info */
1716 /* This stores infos for the current network.
1717 * Either the network we are associated in INFRASTRUCTURE
1718 * or the network that we are creating in MASTER mode.
1719 * ad-hoc is a mixture ;-).
1720 * Note that in infrastructure mode, even when not associated,
1721 * fields bssid and essid may be valid (if wpa_set and essid_set
1722 * are true) as thy carry the value set by the user via iwconfig
1724 struct rtllib_network current_network;
1726 enum rtllib_state state;
1729 int mode; /* A, B, G */
1730 int modulation; /* CCK, OFDM */
1731 int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
1733 /* used for forcing the ibss workqueue to terminate
1734 * without wait for the syncro scan to terminate
1736 short sync_scan_hurryup;
1739 /* map of allowed channels. 0 is dummy */
1742 u8 active_channel_map[MAX_CHANNEL_NUMBER+1];
1745 u8 ibss_maxjoin_chal;
1747 int rate; /* current rate */
1752 /* this contains flags for selectively enable softmac support */
1753 u16 softmac_features;
1755 /* if the sequence control field is not filled by HW */
1758 /* association procedure transaction sequence number */
1761 /* AID for RTXed association responses */
1764 /* power save mode related*/
1770 struct tasklet_struct ps_task;
1775 /* used if IEEE_SOFTMAC_TX_QUEUE is set */
1777 short scanning_continue;
1778 short proto_started;
1779 short proto_stoppping;
1781 struct semaphore wx_sem;
1782 struct semaphore scan_sem;
1783 struct semaphore ips_sem;
1785 spinlock_t mgmt_tx_lock;
1786 spinlock_t beacon_lock;
1793 /* set on initialization */
1794 unsigned int wmm_acm;
1796 /* for discarding duplicated packets in IBSS */
1797 struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
1799 /* for discarding duplicated packets in BSS */
1800 u16 last_rxseq_num[17]; /* rx seq previous per-tid */
1801 u16 last_rxfrag_num[17];/* tx frag previous per-tid */
1802 unsigned long last_packet_time[17];
1805 unsigned long last_rx_ps_time;
1809 /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
1810 struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
1811 int mgmt_queue_head;
1812 int mgmt_queue_tail;
1814 struct sk_buff_head skb_waitQ[MAX_QUEUE_SIZE];
1815 struct sk_buff_head skb_aggQ[MAX_QUEUE_SIZE];
1816 u32 sta_edca_param[4];
1818 bool enable_rx_imm_BA;
1820 bool bdynamic_txpower_enable;
1822 bool bCTSToSelfEnable;
1825 u32 fsync_time_interval;
1826 u32 fsync_rate_bitmap;
1827 u8 fsync_rssi_threshold;
1830 u8 fsync_multiple_timeinterval;
1831 u32 fsync_firstdiff_ratethreshold;
1832 u32 fsync_seconddiff_ratethreshold;
1833 enum fsync_state fsync_state;
1834 bool bis_any_nonbepkts;
1835 struct bandwidth_autoswitch bandwidth_auto_switch;
1838 struct rt_link_detect LinkDetectInfo;
1839 bool bIsAggregateFrame;
1840 struct rt_pwr_save_ctrl PowerSaveControl;
1842 /* used if IEEE_SOFTMAC_TX_QUEUE is set */
1843 struct tx_pending tx_pending;
1845 /* used if IEEE_SOFTMAC_ASSOCIATE is set */
1846 struct timer_list associate_timer;
1848 /* used if IEEE_SOFTMAC_BEACONS is set */
1849 struct timer_list beacon_timer;
1851 struct work_struct associate_complete_wq;
1852 struct work_struct ips_leave_wq;
1853 struct delayed_work associate_procedure_wq;
1854 struct delayed_work softmac_scan_wq;
1855 struct delayed_work softmac_hint11d_wq;
1856 struct delayed_work associate_retry_wq;
1857 struct delayed_work start_ibss_wq;
1858 struct delayed_work hw_wakeup_wq;
1859 struct delayed_work hw_sleep_wq;
1860 struct delayed_work link_change_wq;
1861 struct work_struct wx_sync_scan_wq;
1863 struct workqueue_struct *wq;
1865 struct rtllib_rxb *RfdArray[REORDER_WIN_SIZE];
1866 struct rtllib_rxb *stats_IndicateArray[REORDER_WIN_SIZE];
1867 struct rtllib_rxb *prxbIndicateArray[REORDER_WIN_SIZE];
1869 struct sw_chnl_cmd PreCommonCmd[MAX_PRECMD_CNT];
1870 struct sw_chnl_cmd PostCommonCmd[MAX_POSTCMD_CNT];
1871 struct sw_chnl_cmd RfDependCmd[MAX_RFDEPENDCMD_CNT];
1875 /* Callback functions */
1876 void (*set_security)(struct net_device *dev,
1877 struct rtllib_security *sec);
1879 /* Used to TX data frame by using txb structs.
1880 * this is not used if in the softmac_features
1881 * is set the flag IEEE_SOFTMAC_TX_QUEUE
1883 int (*hard_start_xmit)(struct rtllib_txb *txb,
1884 struct net_device *dev);
1886 int (*reset_port)(struct net_device *dev);
1888 /* Softmac-generated frames (management) are TXed via this
1889 * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
1890 * not set. As some cards may have different HW queues that
1891 * one might want to use for data and management frames
1892 * the option to have two callbacks might be useful.
1893 * This function can't sleep.
1895 int (*softmac_hard_start_xmit)(struct sk_buff *skb,
1896 struct net_device *dev);
1898 /* used instead of hard_start_xmit (not softmac_hard_start_xmit)
1899 * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
1900 * frames. If the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
1901 * then also management frames are sent via this callback.
1902 * This function can't sleep.
1904 void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
1905 struct net_device *dev, int rate);
1907 /* stops the HW queue for DATA frames. Useful to avoid
1908 * waste time to TX data frame when we are reassociating
1909 * This function can sleep.
1911 void (*data_hard_stop)(struct net_device *dev);
1913 /* OK this is complementing to data_poll_hard_stop */
1914 void (*data_hard_resume)(struct net_device *dev);
1916 /* ask to the driver to retune the radio.
1917 * This function can sleep. the driver should ensure
1918 * the radio has been switched before return.
1920 void (*set_chan)(struct net_device *dev, short ch);
1922 void (*rtllib_start_hw_scan)(struct net_device *dev);
1923 void (*rtllib_stop_hw_scan)(struct net_device *dev);
1925 /* indicate the driver that the link state is changed
1926 * for example it may indicate the card is associated now.
1927 * Driver might be interested in this to apply RX filter
1928 * rules or simply light the LINK led
1930 void (*link_change)(struct net_device *dev);
1932 /* these two function indicates to the HW when to start
1933 * and stop to send beacons. This is used when the
1934 * IEEE_SOFTMAC_BEACONS is not set. For now the
1935 * stop_send_bacons is NOT guaranteed to be called only
1936 * after start_send_beacons.
1938 void (*start_send_beacons)(struct net_device *dev);
1939 void (*stop_send_beacons)(struct net_device *dev);
1941 /* power save mode related */
1942 void (*sta_wake_up)(struct net_device *dev);
1943 void (*enter_sleep_state)(struct net_device *dev, u64 time);
1944 short (*ps_is_queue_empty)(struct net_device *dev);
1945 int (*handle_beacon)(struct net_device *dev,
1946 struct rtllib_beacon *beacon,
1947 struct rtllib_network *network);
1948 int (*handle_assoc_response)(struct net_device *dev,
1949 struct rtllib_assoc_response_frame *resp,
1950 struct rtllib_network *network);
1953 /* check whether Tx hw resource available */
1954 short (*check_nic_enough_desc)(struct net_device *dev, int queue_index);
1955 short (*get_nic_desc_num)(struct net_device *dev, int queue_index);
1956 void (*SetBWModeHandler)(struct net_device *dev,
1957 enum ht_channel_width Bandwidth,
1958 enum ht_extchnl_offset Offset);
1959 bool (*GetNmodeSupportBySecCfg)(struct net_device *dev);
1960 void (*SetWirelessMode)(struct net_device *dev, u8 wireless_mode);
1961 bool (*GetHalfNmodeSupportByAPsHandler)(struct net_device *dev);
1962 u8 (*rtllib_ap_sec_type)(struct rtllib_device *ieee);
1963 void (*InitialGainHandler)(struct net_device *dev, u8 Operation);
1964 bool (*SetFwCmdHandler)(struct net_device *dev,
1965 enum fw_cmd_io_type FwCmdIO);
1966 void (*UpdateBeaconInterruptHandler)(struct net_device *dev,
1968 void (*ScanOperationBackupHandler)(struct net_device *dev,
1970 void (*LedControlHandler)(struct net_device *dev,
1971 enum led_ctl_mode LedAction);
1972 void (*SetHwRegHandler)(struct net_device *dev, u8 variable, u8 *val);
1974 void (*AllowAllDestAddrHandler)(struct net_device *dev,
1975 bool bAllowAllDA, bool WriteIntoReg);
1977 void (*rtllib_ips_leave_wq)(struct net_device *dev);
1978 void (*rtllib_ips_leave)(struct net_device *dev);
1979 void (*LeisurePSLeave)(struct net_device *dev);
1980 void (*rtllib_rfkill_poll)(struct net_device *dev);
1982 /* This must be the last item so that it points to the data
1983 * allocated beyond this structure by alloc_rtllib
1988 #define IEEE_A (1<<0)
1989 #define IEEE_B (1<<1)
1990 #define IEEE_G (1<<2)
1991 #define IEEE_N_24G (1<<4)
1992 #define IEEE_N_5G (1<<5)
1993 #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G)
1995 /* Generate a 802.11 header */
1997 /* Uses the channel change callback directly
1998 * instead of [start/stop] scan callbacks
2000 #define IEEE_SOFTMAC_SCAN (1<<2)
2002 /* Perform authentication and association handshake */
2003 #define IEEE_SOFTMAC_ASSOCIATE (1<<3)
2005 /* Generate probe requests */
2006 #define IEEE_SOFTMAC_PROBERQ (1<<4)
2008 /* Generate response to probe requests */
2009 #define IEEE_SOFTMAC_PROBERS (1<<5)
2011 /* The ieee802.11 stack will manage the netif queue
2012 * wake/stop for the driver, taking care of 802.11
2013 * fragmentation. See softmac.c for details.
2015 #define IEEE_SOFTMAC_TX_QUEUE (1<<7)
2017 /* Uses only the softmac_data_hard_start_xmit
2018 * even for TX management frames.
2020 #define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
2022 /* Generate beacons. The stack will enqueue beacons
2025 #define IEEE_SOFTMAC_BEACONS (1<<6)
2028 static inline void *rtllib_priv(struct net_device *dev)
2030 return ((struct rtllib_device *)netdev_priv(dev))->priv;
2033 static inline int rtllib_is_empty_essid(const char *essid, int essid_len)
2035 /* Single white space is for Linksys APs */
2036 if (essid_len == 1 && essid[0] == ' ')
2039 /* Otherwise, if the entire essid is 0, we assume it is hidden */
2042 if (essid[essid_len] != '\0')
2049 static inline int rtllib_get_hdrlen(u16 fc)
2051 int hdrlen = RTLLIB_3ADDR_LEN;
2053 switch (WLAN_FC_GET_TYPE(fc)) {
2054 case RTLLIB_FTYPE_DATA:
2055 if ((fc & RTLLIB_FCTL_FROMDS) && (fc & RTLLIB_FCTL_TODS))
2056 hdrlen = RTLLIB_4ADDR_LEN; /* Addr4 */
2057 if (RTLLIB_QOS_HAS_SEQ(fc))
2058 hdrlen += 2; /* QOS ctrl*/
2060 case RTLLIB_FTYPE_CTL:
2061 switch (WLAN_FC_GET_STYPE(fc)) {
2062 case RTLLIB_STYPE_CTS:
2063 case RTLLIB_STYPE_ACK:
2064 hdrlen = RTLLIB_1ADDR_LEN;
2067 hdrlen = RTLLIB_2ADDR_LEN;
2076 static inline u8 *rtllib_get_payload(struct rtllib_hdr *hdr)
2078 switch (rtllib_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) {
2079 case RTLLIB_1ADDR_LEN:
2080 return ((struct rtllib_hdr_1addr *)hdr)->payload;
2081 case RTLLIB_2ADDR_LEN:
2082 return ((struct rtllib_hdr_2addr *)hdr)->payload;
2083 case RTLLIB_3ADDR_LEN:
2084 return ((struct rtllib_hdr_3addr *)hdr)->payload;
2085 case RTLLIB_4ADDR_LEN:
2086 return ((struct rtllib_hdr_4addr *)hdr)->payload;
2091 static inline int rtllib_is_ofdm_rate(u8 rate)
2093 switch (rate & ~RTLLIB_BASIC_RATE_MASK) {
2094 case RTLLIB_OFDM_RATE_6MB:
2095 case RTLLIB_OFDM_RATE_9MB:
2096 case RTLLIB_OFDM_RATE_12MB:
2097 case RTLLIB_OFDM_RATE_18MB:
2098 case RTLLIB_OFDM_RATE_24MB:
2099 case RTLLIB_OFDM_RATE_36MB:
2100 case RTLLIB_OFDM_RATE_48MB:
2101 case RTLLIB_OFDM_RATE_54MB:
2107 static inline int rtllib_is_cck_rate(u8 rate)
2109 switch (rate & ~RTLLIB_BASIC_RATE_MASK) {
2110 case RTLLIB_CCK_RATE_1MB:
2111 case RTLLIB_CCK_RATE_2MB:
2112 case RTLLIB_CCK_RATE_5MB:
2113 case RTLLIB_CCK_RATE_11MB:
2121 extern void free_rtllib(struct net_device *dev);
2122 extern struct net_device *alloc_rtllib(int sizeof_priv);
2126 extern int rtllib_encrypt_fragment(
2127 struct rtllib_device *ieee,
2128 struct sk_buff *frag,
2131 extern int rtllib_xmit(struct sk_buff *skb, struct net_device *dev);
2132 extern int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev);
2133 extern void rtllib_txb_free(struct rtllib_txb *);
2136 extern int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb,
2137 struct rtllib_rx_stats *rx_stats);
2138 extern void rtllib_rx_mgt(struct rtllib_device *ieee,
2139 struct sk_buff *skb,
2140 struct rtllib_rx_stats *stats);
2141 extern void rtllib_rx_probe_rq(struct rtllib_device *ieee,
2142 struct sk_buff *skb);
2143 extern int rtllib_legal_channel(struct rtllib_device *rtllib, u8 channel);
2146 extern int rtllib_wx_get_scan(struct rtllib_device *ieee,
2147 struct iw_request_info *info,
2148 union iwreq_data *wrqu, char *key);
2149 extern int rtllib_wx_set_encode(struct rtllib_device *ieee,
2150 struct iw_request_info *info,
2151 union iwreq_data *wrqu, char *key);
2152 extern int rtllib_wx_get_encode(struct rtllib_device *ieee,
2153 struct iw_request_info *info,
2154 union iwreq_data *wrqu, char *key);
2155 #if WIRELESS_EXT >= 18
2156 extern int rtllib_wx_get_encode_ext(struct rtllib_device *ieee,
2157 struct iw_request_info *info,
2158 union iwreq_data *wrqu, char *extra);
2159 extern int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
2160 struct iw_request_info *info,
2161 union iwreq_data *wrqu, char *extra);
2163 extern int rtllib_wx_set_auth(struct rtllib_device *ieee,
2164 struct iw_request_info *info,
2165 struct iw_param *data, char *extra);
2166 extern int rtllib_wx_set_mlme(struct rtllib_device *ieee,
2167 struct iw_request_info *info,
2168 union iwreq_data *wrqu, char *extra);
2169 extern int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len);
2171 /* rtllib_softmac.c */
2172 extern short rtllib_is_54g(struct rtllib_network *net);
2173 extern int rtllib_rx_frame_softmac(struct rtllib_device *ieee,
2174 struct sk_buff *skb,
2175 struct rtllib_rx_stats *rx_stats, u16 type,
2177 extern void rtllib_softmac_new_net(struct rtllib_device *ieee,
2178 struct rtllib_network *net);
2180 void SendDisassociation(struct rtllib_device *ieee, bool deauth, u16 asRsn);
2181 extern void rtllib_softmac_xmit(struct rtllib_txb *txb,
2182 struct rtllib_device *ieee);
2184 extern void rtllib_stop_send_beacons(struct rtllib_device *ieee);
2185 extern void notify_wx_assoc_event(struct rtllib_device *ieee);
2186 extern void rtllib_softmac_check_all_nets(struct rtllib_device *ieee);
2187 extern void rtllib_start_bss(struct rtllib_device *ieee);
2188 extern void rtllib_start_master_bss(struct rtllib_device *ieee);
2189 extern void rtllib_start_ibss(struct rtllib_device *ieee);
2190 extern void rtllib_softmac_init(struct rtllib_device *ieee);
2191 extern void rtllib_softmac_free(struct rtllib_device *ieee);
2192 extern void rtllib_associate_abort(struct rtllib_device *ieee);
2193 extern void rtllib_disassociate(struct rtllib_device *ieee);
2194 extern void rtllib_stop_scan(struct rtllib_device *ieee);
2195 extern bool rtllib_act_scanning(struct rtllib_device *ieee, bool sync_scan);
2196 extern void rtllib_stop_scan_syncro(struct rtllib_device *ieee);
2197 extern void rtllib_start_scan_syncro(struct rtllib_device *ieee, u8 is_mesh);
2198 extern void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee,
2200 extern void rtllib_sta_wakeup(struct rtllib_device *ieee, short nl);
2201 extern void rtllib_sta_ps_send_pspoll_frame(struct rtllib_device *ieee);
2202 extern void rtllib_start_protocol(struct rtllib_device *ieee);
2203 extern void rtllib_stop_protocol(struct rtllib_device *ieee, u8 shutdown);
2205 extern void rtllib_EnableNetMonitorMode(struct net_device *dev,
2207 extern void rtllib_DisableNetMonitorMode(struct net_device *dev,
2209 extern void rtllib_EnableIntelPromiscuousMode(struct net_device *dev,
2211 extern void rtllib_DisableIntelPromiscuousMode(struct net_device *dev,
2213 extern void rtllib_send_probe_requests(struct rtllib_device *ieee, u8 is_mesh);
2215 extern void rtllib_softmac_stop_protocol(struct rtllib_device *ieee,
2216 u8 mesh_flag, u8 shutdown);
2217 extern void rtllib_softmac_start_protocol(struct rtllib_device *ieee,
2220 extern void rtllib_reset_queue(struct rtllib_device *ieee);
2221 extern void rtllib_wake_all_queues(struct rtllib_device *ieee);
2222 extern void rtllib_stop_all_queues(struct rtllib_device *ieee);
2223 extern struct sk_buff *rtllib_get_beacon(struct rtllib_device *ieee);
2224 extern void rtllib_start_send_beacons(struct rtllib_device *ieee);
2225 extern void rtllib_stop_send_beacons(struct rtllib_device *ieee);
2226 extern int rtllib_wpa_supplicant_ioctl(struct rtllib_device *ieee,
2227 struct iw_point *p, u8 is_mesh);
2229 extern void notify_wx_assoc_event(struct rtllib_device *ieee);
2230 extern void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success);
2232 extern void softmac_mgmt_xmit(struct sk_buff *skb,
2233 struct rtllib_device *ieee);
2234 extern u16 rtllib_query_seqnum(struct rtllib_device *ieee,
2235 struct sk_buff *skb, u8 *dst);
2236 extern u8 rtllib_ap_sec_type(struct rtllib_device *ieee);
2238 /* rtllib_softmac_wx.c */
2240 extern int rtllib_wx_get_wap(struct rtllib_device *ieee,
2241 struct iw_request_info *info,
2242 union iwreq_data *wrqu, char *ext);
2244 extern int rtllib_wx_set_wap(struct rtllib_device *ieee,
2245 struct iw_request_info *info,
2246 union iwreq_data *awrq,
2249 extern int rtllib_wx_get_essid(struct rtllib_device *ieee,
2250 struct iw_request_info *a,
2251 union iwreq_data *wrqu, char *b);
2253 extern int rtllib_wx_set_rate(struct rtllib_device *ieee,
2254 struct iw_request_info *info,
2255 union iwreq_data *wrqu, char *extra);
2257 extern int rtllib_wx_get_rate(struct rtllib_device *ieee,
2258 struct iw_request_info *info,
2259 union iwreq_data *wrqu, char *extra);
2261 extern int rtllib_wx_set_mode(struct rtllib_device *ieee,
2262 struct iw_request_info *a,
2263 union iwreq_data *wrqu, char *b);
2265 extern int rtllib_wx_set_scan(struct rtllib_device *ieee,
2266 struct iw_request_info *a,
2267 union iwreq_data *wrqu, char *b);
2269 extern int rtllib_wx_set_essid(struct rtllib_device *ieee,
2270 struct iw_request_info *a,
2271 union iwreq_data *wrqu, char *extra);
2273 extern int rtllib_wx_get_mode(struct rtllib_device *ieee,
2274 struct iw_request_info *a,
2275 union iwreq_data *wrqu, char *b);
2277 extern int rtllib_wx_set_freq(struct rtllib_device *ieee,
2278 struct iw_request_info *a,
2279 union iwreq_data *wrqu, char *b);
2281 extern int rtllib_wx_get_freq(struct rtllib_device *ieee,
2282 struct iw_request_info *a,
2283 union iwreq_data *wrqu, char *b);
2284 extern void rtllib_wx_sync_scan_wq(void *data);
2286 extern int rtllib_wx_set_rawtx(struct rtllib_device *ieee,
2287 struct iw_request_info *info,
2288 union iwreq_data *wrqu, char *extra);
2290 extern int rtllib_wx_get_name(struct rtllib_device *ieee,
2291 struct iw_request_info *info,
2292 union iwreq_data *wrqu, char *extra);
2294 extern int rtllib_wx_set_power(struct rtllib_device *ieee,
2295 struct iw_request_info *info,
2296 union iwreq_data *wrqu, char *extra);
2298 extern int rtllib_wx_get_power(struct rtllib_device *ieee,
2299 struct iw_request_info *info,
2300 union iwreq_data *wrqu, char *extra);
2302 extern int rtllib_wx_set_rts(struct rtllib_device *ieee,
2303 struct iw_request_info *info,
2304 union iwreq_data *wrqu, char *extra);
2306 extern int rtllib_wx_get_rts(struct rtllib_device *ieee,
2307 struct iw_request_info *info,
2308 union iwreq_data *wrqu, char *extra);
2309 #define MAX_RECEIVE_BUFFER_SIZE 9100
2311 void HTSetConnectBwMode(struct rtllib_device *ieee,
2312 enum ht_channel_width Bandwidth,
2313 enum ht_extchnl_offset Offset);
2314 extern void HTUpdateDefaultSetting(struct rtllib_device *ieee);
2315 extern void HTConstructCapabilityElement(struct rtllib_device *ieee,
2316 u8 *posHTCap, u8 *len,
2317 u8 isEncrypt, bool bAssoc);
2318 extern void HTConstructInfoElement(struct rtllib_device *ieee,
2319 u8 *posHTInfo, u8 *len, u8 isEncrypt);
2320 extern void HTConstructRT2RTAggElement(struct rtllib_device *ieee,
2321 u8 *posRT2RTAgg, u8 *len);
2322 extern void HTOnAssocRsp(struct rtllib_device *ieee);
2323 extern void HTInitializeHTInfo(struct rtllib_device *ieee);
2324 extern void HTInitializeBssDesc(struct bss_ht *pBssHT);
2325 extern void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee,
2326 struct rtllib_network *pNetwork);
2327 extern void HT_update_self_and_peer_setting(struct rtllib_device *ieee,
2328 struct rtllib_network *pNetwork);
2329 extern u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet,
2331 extern u8 MCS_FILTER_ALL[];
2332 extern u16 MCS_DATA_RATE[2][2][77];
2333 extern u8 HTCCheck(struct rtllib_device *ieee, u8 *pFrame);
2334 extern void HTResetIOTSetting(struct rt_hi_throughput *pHTInfo);
2335 extern bool IsHTHalfNmodeAPs(struct rtllib_device *ieee);
2336 extern u16 HTMcsToDataRate(struct rtllib_device *ieee, u8 nMcsRate);
2337 extern u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate);
2338 extern int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb);
2339 extern int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb);
2340 extern int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb);
2341 extern void TsInitAddBA(struct rtllib_device *ieee, struct tx_ts_record *pTS,
2342 u8 Policy, u8 bOverwritePending);
2343 extern void TsInitDelBA(struct rtllib_device *ieee,
2344 struct ts_common_info *pTsCommonInfo,
2345 enum tr_select TxRxSelect);
2346 extern void BaSetupTimeOut(unsigned long data);
2347 extern void TxBaInactTimeout(unsigned long data);
2348 extern void RxBaInactTimeout(unsigned long data);
2349 extern void ResetBaEntry(struct ba_record *pBA);
2351 struct rtllib_device *ieee,
2352 struct ts_common_info **ppTS,
2355 enum tr_select TxRxSelect,
2358 extern void TSInitialize(struct rtllib_device *ieee);
2359 extern void TsStartAddBaProcess(struct rtllib_device *ieee,
2360 struct tx_ts_record *pTxTS);
2361 extern void RemovePeerTS(struct rtllib_device *ieee, u8 *Addr);
2362 extern void RemoveAllTS(struct rtllib_device *ieee);
2363 void rtllib_softmac_scan_syncro(struct rtllib_device *ieee, u8 is_mesh);
2365 extern const long rtllib_wlan_frequencies[];
2367 static inline const char *escape_essid(const char *essid, u8 essid_len)
2369 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
2371 if (rtllib_is_empty_essid(essid, essid_len)) {
2372 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
2376 snprintf(escaped, sizeof(escaped), "%*pEn", essid_len, essid);
2380 /* fun with the built-in rtllib stack... */
2381 bool rtllib_MgntDisconnect(struct rtllib_device *rtllib, u8 asRsn);
2384 /* For the function is more related to hardware setting, it's better to use the
2385 * ieee handler to refer to it.
2387 extern void rtllib_update_active_chan_map(struct rtllib_device *ieee);
2388 extern void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee,
2389 struct rx_ts_record *pTS);
2390 extern int rtllib_parse_info_param(struct rtllib_device *ieee,
2391 struct rtllib_info_element *info_element,
2393 struct rtllib_network *network,
2394 struct rtllib_rx_stats *stats);
2396 void rtllib_indicate_packets(struct rtllib_device *ieee,
2397 struct rtllib_rxb **prxbIndicateArray, u8 index);
2398 extern u8 HTFilterMCSRate(struct rtllib_device *ieee, u8 *pSupportMCS,
2400 extern void HTUseDefaultSetting(struct rtllib_device *ieee);
2401 #define RT_ASOC_RETRY_LIMIT 5
2402 u8 MgntQuery_TxRateExcludeCCKRates(struct rtllib_device *ieee);
2403 extern void rtllib_TURBO_Info(struct rtllib_device *ieee, u8 **tag_p);
2404 #define SEM_DOWN_IEEE_WX(psem) down(psem)
2405 #define SEM_UP_IEEE_WX(psem) up(psem)
2407 #endif /* RTLLIB_H */