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 * <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/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 */
71 * container_of - cast a member of a structure out to the containing structure
73 * @ptr: the pointer to the member.
74 * @type: the type of the container struct this is embedded in.
75 * @member: the name of the member within the struct.
78 #define container_of(ptr, type, member) ({ \
79 const typeof(((type *)0)->member)*__mptr = (ptr); \
80 (type *)((char *)__mptr - offsetof(type, member)); })
83 #define skb_tail_pointer_rsl(skb) skb_tail_pointer(skb)
85 #define EXPORT_SYMBOL_RSL(x) EXPORT_SYMBOL(x)
88 #define queue_delayed_work_rsl(x, y, z) queue_delayed_work(x, y, z)
89 #define INIT_DELAYED_WORK_RSL(x, y, z) INIT_DELAYED_WORK(x, y)
91 #define queue_work_rsl(x, y) queue_work(x, y)
92 #define INIT_WORK_RSL(x, y, z) INIT_WORK(x, y)
94 #define container_of_work_rsl(x, y, z) container_of(x, y, z)
95 #define container_of_dwork_rsl(x, y, z) \
96 container_of(container_of(x, struct delayed_work, work), y, z)
98 #define iwe_stream_add_event_rsl(info, start, stop, iwe, len) \
99 iwe_stream_add_event(info, start, stop, iwe, len)
101 #define iwe_stream_add_point_rsl(info, start, stop, iwe, p) \
102 iwe_stream_add_point(info, start, stop, iwe, p)
104 #define usb_alloc_urb_rsl(x, y) usb_alloc_urb(x, y)
105 #define usb_submit_urb_rsl(x, y) usb_submit_urb(x, y)
107 static inline void *netdev_priv_rsl(struct net_device
*dev
)
109 return netdev_priv(dev
);
112 #define KEY_TYPE_NA 0x0
113 #define KEY_TYPE_WEP40 0x1
114 #define KEY_TYPE_TKIP 0x2
115 #define KEY_TYPE_CCMP 0x4
116 #define KEY_TYPE_WEP104 0x5
117 /* added for rtl819x tx procedure */
118 #define MAX_QUEUE_SIZE 0x10
125 #define TXCMD_QUEUE 5
128 #define BEACON_QUEUE 8
130 #define LOW_QUEUE BE_QUEUE
131 #define NORMAL_QUEUE MGNT_QUEUE
134 #define IW_MODE_MESH 7
136 #define AMSDU_SUBHEADER_LEN 14
137 #define SWRF_TIMEOUT 50
139 #define IE_CISCO_FLAG_POSITION 0x08
140 #define SUPPORT_CKIP_MIC 0x08
141 #define SUPPORT_CKIP_PK 0x10
142 #define RT_RF_OFF_LEVL_ASPM BIT0
143 #define RT_RF_OFF_LEVL_CLK_REQ BIT1
144 #define RT_RF_OFF_LEVL_PCI_D3 BIT2
145 #define RT_RF_OFF_LEVL_HALT_NIC BIT3
146 #define RT_RF_OFF_LEVL_FREE_FW BIT4
147 #define RT_RF_OFF_LEVL_FW_32K BIT5
148 #define RT_RF_PS_LEVEL_ALWAYS_ASPM BIT6
149 #define RT_RF_LPS_DISALBE_2R BIT30
150 #define RT_RF_LPS_LEVEL_ASPM BIT31
151 #define RT_IN_PS_LEVEL(pPSC, _PS_FLAG) \
152 ((pPSC->CurPsLevel & _PS_FLAG) ? true : false)
153 #define RT_CLEAR_PS_LEVEL(pPSC, _PS_FLAG) \
154 (pPSC->CurPsLevel &= (~(_PS_FLAG)))
155 #define RT_SET_PS_LEVEL(pPSC, _PS_FLAG) (pPSC->CurPsLevel |= _PS_FLAG)
157 /* defined for skb cb field */
158 /* At most 28 byte */
160 /* Tx Desc Related flags (8-9) */
166 u8 bTxDisableRateFallBack
:1;
167 u8 bTxUseDriverAssingedRate
:1;
172 /* Tx Firmware Relaged flags (10-11)*/
176 u8 bUseShortPreamble
:1;
177 u8 bTxEnableFwCalcDur
:1;
184 u8 bRTSUseShortPreamble
:1;
191 /* Tx Desc related element(12-19) */
202 /* Tx firmware related element(20-27) */
210 u8 bIsSpecialDataFrame
;
216 enum sw_chnl_cmd_id
{
218 CmdID_SetTxPowerLevel
,
220 CmdID_WritePortUlong
,
221 CmdID_WritePortUshort
,
222 CmdID_WritePortUchar
,
227 enum sw_chnl_cmd_id CmdID
;
233 /*--------------------------Define -------------------------------------------*/
236 #define MGN_5_5M 0x0b
248 #define MGN_MCS0 0x80
249 #define MGN_MCS1 0x81
250 #define MGN_MCS2 0x82
251 #define MGN_MCS3 0x83
252 #define MGN_MCS4 0x84
253 #define MGN_MCS5 0x85
254 #define MGN_MCS6 0x86
255 #define MGN_MCS7 0x87
256 #define MGN_MCS8 0x88
257 #define MGN_MCS9 0x89
258 #define MGN_MCS10 0x8a
259 #define MGN_MCS11 0x8b
260 #define MGN_MCS12 0x8c
261 #define MGN_MCS13 0x8d
262 #define MGN_MCS14 0x8e
263 #define MGN_MCS15 0x8f
264 #define MGN_MCS0_SG 0x90
265 #define MGN_MCS1_SG 0x91
266 #define MGN_MCS2_SG 0x92
267 #define MGN_MCS3_SG 0x93
268 #define MGN_MCS4_SG 0x94
269 #define MGN_MCS5_SG 0x95
270 #define MGN_MCS6_SG 0x96
271 #define MGN_MCS7_SG 0x97
272 #define MGN_MCS8_SG 0x98
273 #define MGN_MCS9_SG 0x99
274 #define MGN_MCS10_SG 0x9a
275 #define MGN_MCS11_SG 0x9b
276 #define MGN_MCS12_SG 0x9c
277 #define MGN_MCS13_SG 0x9d
278 #define MGN_MCS14_SG 0x9e
279 #define MGN_MCS15_SG 0x9f
284 auth_not_valid
= 0x2,
296 four_way_tmout
= 0x0f,
297 two_way_tmout
= 0x10,
299 invalid_Gcipher
= 0x12,
300 invalid_Pcipher
= 0x13,
302 unsup_RSNIEver
= 0x15,
303 invalid_RSNIE
= 0x16,
304 auth_802_1x_fail
= 0x17,
308 QAP_bandwidth
= 0x21,
309 poor_condition
= 0x22,
312 invalid_param
= 0x26,
313 req_not_honored
= 0x27,
314 TS_not_created
= 0x2F,
315 DL_not_allowed
= 0x30,
316 dest_not_exist
= 0x31,
317 dest_not_QSTA
= 0x32,
320 enum hal_def_variable
{
323 HAL_DEF_PROT_IMP_MODE
,
324 HAL_DEF_HIGH_POWER_MECHANISM
,
325 HAL_DEF_RATE_ADAPTIVE_MECHANISM
,
326 HAL_DEF_ANTENNA_DIVERSITY_MECHANISM
,
332 HAL_DEF_MIN_TX_POWER_DBM
,
333 HAL_DEF_MAX_TX_POWER_DBM
,
334 HW_DEF_EFUSE_REPG_SECTION1_FLAG
,
335 HW_DEF_EFUSE_REPG_DATA
,
337 HAL_DEF_PCI_SUPPORT_ASPM
,
338 HAL_DEF_THERMAL_VALUE
,
339 HAL_DEF_USB_IN_TOKEN_REV
,
344 HW_VAR_MULTICAST_REG
,
348 HW_VAR_SECURITY_CONF
,
349 HW_VAR_BEACON_INTERVAL
,
351 HW_VAR_LISTEN_INTERVAL
,
364 HW_VAR_RATE_FALLBACK_CONTROL
,
365 HW_VAR_CONTENTION_WINDOW
,
370 HW_VAR_AMPDU_MIN_SPACE
,
371 HW_VAR_SHORTGI_DENSITY
,
373 HW_VAR_MCS_RATE_AVAILABLE
,
376 HW_VAR_DIS_Req_Qsize
,
377 HW_VAR_CCX_CHNL_LOAD
,
378 HW_VAR_CCX_NOISE_HISTOGRAM
,
385 HW_VAR_SET_DEV_POWER
,
395 HW_VAR_USER_CONTROL_TURBO_MODE
,
401 HW_VAR_AUTOLOAD_STATUS
,
402 HW_VAR_RF_2R_DISABLE
,
404 HW_VAR_H2C_FW_PWRMODE
,
405 HW_VAR_H2C_FW_JOINBSSRPT
,
406 HW_VAR_1X1_RECV_COMBINE
,
407 HW_VAR_STOP_SEND_BEACON
,
412 HW_VAR_H2C_FW_UPDATE_GTK
,
415 HW_VAR_WF_IS_MAC_ADDR
,
416 HW_VAR_H2C_FW_OFFLOAD
,
419 HW_VAR_HANDLE_FW_C2H
,
420 HW_VAR_DL_FW_RSVD_PAGE
,
422 HW_VAR_HW_SEQ_ENABLE
,
427 HW_VAR_SWITCH_EPHY_WoWLAN
,
428 HW_VAR_INT_MIGRATION
,
435 RT_OP_MODE_INFRASTRUCTURE
,
442 (((priv->rtllib->current_network.mode == IEEE_A) \
443 || (priv->rtllib->current_network.mode == IEEE_N_24G) \
444 || (priv->rtllib->current_network.mode == IEEE_N_5G)) ? 16 : 10)
446 #define MGMT_QUEUE_NUM 5
448 #define IEEE_CMD_SET_WPA_PARAM 1
449 #define IEEE_CMD_SET_WPA_IE 2
450 #define IEEE_CMD_SET_ENCRYPTION 3
451 #define IEEE_CMD_MLME 4
453 #define IEEE_PARAM_WPA_ENABLED 1
454 #define IEEE_PARAM_TKIP_COUNTERMEASURES 2
455 #define IEEE_PARAM_DROP_UNENCRYPTED 3
456 #define IEEE_PARAM_PRIVACY_INVOKED 4
457 #define IEEE_PARAM_AUTH_ALGS 5
458 #define IEEE_PARAM_IEEE_802_1X 6
459 #define IEEE_PARAM_WPAX_SELECT 7
460 #define IEEE_PROTO_WPA 1
461 #define IEEE_PROTO_RSN 2
462 #define IEEE_WPAX_USEGROUP 0
463 #define IEEE_WPAX_WEP40 1
464 #define IEEE_WPAX_TKIP 2
465 #define IEEE_WPAX_WRAP 3
466 #define IEEE_WPAX_CCMP 4
467 #define IEEE_WPAX_WEP104 5
469 #define IEEE_KEY_MGMT_IEEE8021X 1
470 #define IEEE_KEY_MGMT_PSK 2
472 #define IEEE_MLME_STA_DEAUTH 1
473 #define IEEE_MLME_STA_DISASSOC 2
476 #define IEEE_CRYPT_ERR_UNKNOWN_ALG 2
477 #define IEEE_CRYPT_ERR_UNKNOWN_ADDR 3
478 #define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4
479 #define IEEE_CRYPT_ERR_KEY_SET_FAILED 5
480 #define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6
481 #define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7
482 #define IEEE_CRYPT_ALG_NAME_LEN 16
484 #define MAX_IE_LEN 0xff
485 #define RT_ASSERT_RET(_Exp) do {} while (0)
486 #define RT_ASSERT_RET_VALUE(_Exp, Ret) \
491 u8 sta_addr
[ETH_ALEN
];
507 u8 alg
[IEEE_CRYPT_ALG_NAME_LEN
];
511 u8 seq
[8]; /* sequence counter (set: RX, get: TX) */
519 #if WIRELESS_EXT < 17
520 #define IW_QUAL_QUAL_INVALID 0x10
521 #define IW_QUAL_LEVEL_INVALID 0x20
522 #define IW_QUAL_NOISE_INVALID 0x40
523 #define IW_QUAL_QUAL_UPDATED 0x1
524 #define IW_QUAL_LEVEL_UPDATED 0x2
525 #define IW_QUAL_NOISE_UPDATED 0x4
528 #define MSECS(t) msecs_to_jiffies(t)
529 #define msleep_interruptible_rsl msleep_interruptible
531 #define RTLLIB_DATA_LEN 2304
532 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
535 The figure in section 7.1.2 suggests a body size of up to 2312
536 bytes is allowed, which is a bit confusing, I suspect this
537 represents the 2304 bytes of real data, plus a possible 8 bytes of
538 WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
539 #define RTLLIB_1ADDR_LEN 10
540 #define RTLLIB_2ADDR_LEN 16
541 #define RTLLIB_3ADDR_LEN 24
542 #define RTLLIB_4ADDR_LEN 30
543 #define RTLLIB_FCS_LEN 4
544 #define RTLLIB_HLEN (RTLLIB_4ADDR_LEN)
545 #define RTLLIB_FRAME_LEN (RTLLIB_DATA_LEN + RTLLIB_HLEN)
546 #define RTLLIB_MGMT_HDR_LEN 24
547 #define RTLLIB_DATA_HDR3_LEN 24
548 #define RTLLIB_DATA_HDR4_LEN 30
550 #define RTLLIB_SKBBUFFER_SIZE 2500
552 #define MIN_FRAG_THRESHOLD 256U
553 #define MAX_FRAG_THRESHOLD 2346U
554 #define MAX_HT_DATA_FRAG_THRESHOLD 0x2000
556 #define HT_AMSDU_SIZE_4K 3839
557 #define HT_AMSDU_SIZE_8K 7935
559 /* Frame control field constants */
560 #define RTLLIB_FCTL_VERS 0x0003
561 #define RTLLIB_FCTL_FTYPE 0x000c
562 #define RTLLIB_FCTL_STYPE 0x00f0
563 #define RTLLIB_FCTL_FRAMETYPE 0x00fc
564 #define RTLLIB_FCTL_TODS 0x0100
565 #define RTLLIB_FCTL_FROMDS 0x0200
566 #define RTLLIB_FCTL_DSTODS 0x0300
567 #define RTLLIB_FCTL_MOREFRAGS 0x0400
568 #define RTLLIB_FCTL_RETRY 0x0800
569 #define RTLLIB_FCTL_PM 0x1000
570 #define RTLLIB_FCTL_MOREDATA 0x2000
571 #define RTLLIB_FCTL_WEP 0x4000
572 #define RTLLIB_FCTL_ORDER 0x8000
574 #define RTLLIB_FTYPE_MGMT 0x0000
575 #define RTLLIB_FTYPE_CTL 0x0004
576 #define RTLLIB_FTYPE_DATA 0x0008
579 #define RTLLIB_STYPE_ASSOC_REQ 0x0000
580 #define RTLLIB_STYPE_ASSOC_RESP 0x0010
581 #define RTLLIB_STYPE_REASSOC_REQ 0x0020
582 #define RTLLIB_STYPE_REASSOC_RESP 0x0030
583 #define RTLLIB_STYPE_PROBE_REQ 0x0040
584 #define RTLLIB_STYPE_PROBE_RESP 0x0050
585 #define RTLLIB_STYPE_BEACON 0x0080
586 #define RTLLIB_STYPE_ATIM 0x0090
587 #define RTLLIB_STYPE_DISASSOC 0x00A0
588 #define RTLLIB_STYPE_AUTH 0x00B0
589 #define RTLLIB_STYPE_DEAUTH 0x00C0
590 #define RTLLIB_STYPE_MANAGE_ACT 0x00D0
593 #define RTLLIB_STYPE_PSPOLL 0x00A0
594 #define RTLLIB_STYPE_RTS 0x00B0
595 #define RTLLIB_STYPE_CTS 0x00C0
596 #define RTLLIB_STYPE_ACK 0x00D0
597 #define RTLLIB_STYPE_CFEND 0x00E0
598 #define RTLLIB_STYPE_CFENDACK 0x00F0
599 #define RTLLIB_STYPE_BLOCKACK 0x0094
602 #define RTLLIB_STYPE_DATA 0x0000
603 #define RTLLIB_STYPE_DATA_CFACK 0x0010
604 #define RTLLIB_STYPE_DATA_CFPOLL 0x0020
605 #define RTLLIB_STYPE_DATA_CFACKPOLL 0x0030
606 #define RTLLIB_STYPE_NULLFUNC 0x0040
607 #define RTLLIB_STYPE_CFACK 0x0050
608 #define RTLLIB_STYPE_CFPOLL 0x0060
609 #define RTLLIB_STYPE_CFACKPOLL 0x0070
610 #define RTLLIB_STYPE_QOS_DATA 0x0080
611 #define RTLLIB_STYPE_QOS_NULL 0x00C0
613 #define RTLLIB_SCTL_FRAG 0x000F
614 #define RTLLIB_SCTL_SEQ 0xFFF0
617 #define RTLLIB_QCTL_TID 0x000F
619 #define FC_QOS_BIT BIT7
620 #define IsDataFrame(pdu) (((pdu[0] & 0x0C) == 0x08) ? true : false)
621 #define IsLegacyDataFrame(pdu) (IsDataFrame(pdu) && (!(pdu[0]&FC_QOS_BIT)))
622 #define IsQoSDataFrame(pframe) \
623 ((*(u16 *)pframe&(RTLLIB_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA)) == \
624 (RTLLIB_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA))
625 #define Frame_Order(pframe) (*(u16 *)pframe&RTLLIB_FCTL_ORDER)
626 #define SN_LESS(a, b) (((a-b)&0x800) != 0)
627 #define SN_EQUAL(a, b) (a == b)
628 #define MAX_DEV_ADDR_SIZE 8
651 enum init_gain_op_type
{
658 LED_CTL_POWER_ON
= 1,
663 LED_CTL_SITE_SURVEY
= 6,
664 LED_CTL_POWER_OFF
= 7,
665 LED_CTL_START_TO_LINK
= 8,
666 LED_CTL_START_WPS
= 9,
667 LED_CTL_STOP_WPS
= 10,
668 LED_CTL_START_WPS_BOTTON
= 11,
669 LED_CTL_STOP_WPS_FAIL
= 12,
670 LED_CTL_STOP_WPS_FAIL_OVERLAP
= 13,
673 enum rt_rf_type_def
{
683 WIRELESS_MODE_UNKNOWN
= 0x00,
684 WIRELESS_MODE_A
= 0x01,
685 WIRELESS_MODE_B
= 0x02,
686 WIRELESS_MODE_G
= 0x04,
687 WIRELESS_MODE_AUTO
= 0x08,
688 WIRELESS_MODE_N_24G
= 0x10,
689 WIRELESS_MODE_N_5G
= 0x20
692 enum wireless_network_type
{
699 #define OUI_SUBTYPE_WMM_INFO 0
700 #define OUI_SUBTYPE_WMM_PARAM 1
701 #define OUI_SUBTYPE_QOS_CAPABI 5
704 extern u32 rtllib_debug_level
;
705 #define RTLLIB_DEBUG(level, fmt, args...) \
707 if (rtllib_debug_level & (level)) \
708 printk(KERN_DEBUG "rtllib: " fmt, ## args); \
711 #define RTLLIB_DEBUG_DATA(level, data, datalen) \
713 if ((rtllib_debug_level & (level)) == (level)) { \
715 u8 *pdata = (u8 *)data; \
716 printk(KERN_DEBUG "rtllib: %s()\n", __func__); \
717 for (i = 0; i < (int)(datalen); i++) { \
718 printk("%2.2x ", pdata[i]); \
727 * To use the debug system;
729 * If you are defining a new debug classification, simply add it to the #define
730 * list here in the form of:
732 * #define RTLLIB_DL_xxxx VALUE
734 * shifting value to the left one bit from the previous entry. xxxx should be
735 * the name of the classification (for example, WEP)
737 * You then need to either add a RTLLIB_xxxx_DEBUG() macro definition for your
738 * classification, or use RTLLIB_DEBUG(RTLLIB_DL_xxxx, ...) whenever you want
739 * to send output to that classification.
741 * To add your debug level to the list of levels seen when you perform
743 * % cat /proc/net/ipw/debug_level
745 * you simply need to add your entry to the ipw_debug_levels array.
750 #define RTLLIB_DL_INFO (1<<0)
751 #define RTLLIB_DL_WX (1<<1)
752 #define RTLLIB_DL_SCAN (1<<2)
753 #define RTLLIB_DL_STATE (1<<3)
754 #define RTLLIB_DL_MGMT (1<<4)
755 #define RTLLIB_DL_FRAG (1<<5)
756 #define RTLLIB_DL_EAP (1<<6)
757 #define RTLLIB_DL_DROP (1<<7)
759 #define RTLLIB_DL_TX (1<<8)
760 #define RTLLIB_DL_RX (1<<9)
762 #define RTLLIB_DL_HT (1<<10)
763 #define RTLLIB_DL_BA (1<<11)
764 #define RTLLIB_DL_TS (1<<12)
765 #define RTLLIB_DL_QOS (1<<13)
766 #define RTLLIB_DL_REORDER (1<<14)
767 #define RTLLIB_DL_IOT (1<<15)
768 #define RTLLIB_DL_IPS (1<<16)
769 #define RTLLIB_DL_TRACE (1<<29)
770 #define RTLLIB_DL_DATA (1<<30)
771 #define RTLLIB_DL_ERR (1<<31)
772 #define RTLLIB_ERROR(f, a...) printk(KERN_ERR "rtllib: " f, ## a)
773 #define RTLLIB_WARNING(f, a...) printk(KERN_WARNING "rtllib: " f, ## a)
774 #define RTLLIB_DEBUG_INFO(f, a...) RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a)
776 #define RTLLIB_DEBUG_WX(f, a...) RTLLIB_DEBUG(RTLLIB_DL_WX, f, ## a)
777 #define RTLLIB_DEBUG_SCAN(f, a...) RTLLIB_DEBUG(RTLLIB_DL_SCAN, f, ## a)
778 #define RTLLIB_DEBUG_STATE(f, a...) RTLLIB_DEBUG(RTLLIB_DL_STATE, f, ## a)
779 #define RTLLIB_DEBUG_MGMT(f, a...) RTLLIB_DEBUG(RTLLIB_DL_MGMT, f, ## a)
780 #define RTLLIB_DEBUG_FRAG(f, a...) RTLLIB_DEBUG(RTLLIB_DL_FRAG, f, ## a)
781 #define RTLLIB_DEBUG_EAP(f, a...) RTLLIB_DEBUG(RTLLIB_DL_EAP, f, ## a)
782 #define RTLLIB_DEBUG_DROP(f, a...) RTLLIB_DEBUG(RTLLIB_DL_DROP, f, ## a)
783 #define RTLLIB_DEBUG_TX(f, a...) RTLLIB_DEBUG(RTLLIB_DL_TX, f, ## a)
784 #define RTLLIB_DEBUG_RX(f, a...) RTLLIB_DEBUG(RTLLIB_DL_RX, f, ## a)
785 #define RTLLIB_DEBUG_QOS(f, a...) RTLLIB_DEBUG(RTLLIB_DL_QOS, f, ## a)
787 /* Added by Annie, 2005-11-22. */
788 #define MAX_STR_LEN 64
789 /* I want to see ASCII 33 to 126 only. Otherwise, I print '?'. */
790 #define PRINTABLE(_ch) (_ch > '!' && _ch < '~')
791 #define RTLLIB_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) \
792 if ((_Comp) & level) { \
794 u8 struct buffer[MAX_STR_LEN]; \
795 int length = (_Len < MAX_STR_LEN) ? _Len : (MAX_STR_LEN-1) ;\
796 memset(struct buffer, 0, MAX_STR_LEN); \
797 memcpy(struct buffer, (u8 *)_Ptr, length); \
798 for (__i = 0; __i < MAX_STR_LEN; __i++) { \
799 if (!PRINTABLE(struct buffer[__i])) \
800 struct buffer[__i] = '?'; \
802 struct buffer[length] = '\0'; \
803 printk(KERN_INFO "Rtl819x: "); \
804 printk(_TitleString); \
805 printk(": %d, <%s>\n", _Len, struct buffer); \
808 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
809 #define ETH_P_IP 0x0800 /* Internet Protocol packet */
810 #define ETH_P_ARP 0x0806 /* Address Resolution packet */
811 #endif /* ETH_P_PAE */
813 #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
815 #ifndef ETH_P_80211_RAW
816 #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
819 /* IEEE 802.11 defines */
821 #define P80211_OUI_LEN 3
823 struct rtllib_snap_hdr
{
825 u8 dsap
; /* always 0xAA */
826 u8 ssap
; /* always 0xAA */
827 u8 ctrl
; /* always 0x03 */
828 u8 oui
[P80211_OUI_LEN
]; /* organizational universal id */
832 enum _REG_PREAMBLE_MODE
{
838 #define SNAP_SIZE sizeof(struct rtllib_snap_hdr)
840 #define WLAN_FC_GET_VERS(fc) ((fc) & RTLLIB_FCTL_VERS)
841 #define WLAN_FC_GET_TYPE(fc) ((fc) & RTLLIB_FCTL_FTYPE)
842 #define WLAN_FC_GET_STYPE(fc) ((fc) & RTLLIB_FCTL_STYPE)
843 #define WLAN_FC_MORE_DATA(fc) ((fc) & RTLLIB_FCTL_MOREDATA)
845 #define WLAN_FC_GET_FRAMETYPE(fc) ((fc) & RTLLIB_FCTL_FRAMETYPE)
846 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & RTLLIB_SCTL_FRAG)
847 #define WLAN_GET_SEQ_SEQ(seq) (((seq) & RTLLIB_SCTL_SEQ) >> 4)
849 /* Authentication algorithms */
850 #define WLAN_AUTH_OPEN 0
851 #define WLAN_AUTH_SHARED_KEY 1
852 #define WLAN_AUTH_LEAP 128
854 #define WLAN_AUTH_CHALLENGE_LEN 128
856 #define WLAN_CAPABILITY_ESS (1<<0)
857 #define WLAN_CAPABILITY_IBSS (1<<1)
858 #define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
859 #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
860 #define WLAN_CAPABILITY_PRIVACY (1<<4)
861 #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
862 #define WLAN_CAPABILITY_PBCC (1<<6)
863 #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
864 #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
865 #define WLAN_CAPABILITY_QOS (1<<9)
866 #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
867 #define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
869 /* 802.11g ERP information element */
870 #define WLAN_ERP_NON_ERP_PRESENT (1<<0)
871 #define WLAN_ERP_USE_PROTECTION (1<<1)
872 #define WLAN_ERP_BARKER_PREAMBLE (1<<2)
874 #define RTLLIB_STATMASK_SIGNAL (1<<0)
875 #define RTLLIB_STATMASK_RSSI (1<<1)
876 #define RTLLIB_STATMASK_NOISE (1<<2)
877 #define RTLLIB_STATMASK_RATE (1<<3)
878 #define RTLLIB_STATMASK_WEMASK 0x7
880 #define RTLLIB_CCK_MODULATION (1<<0)
881 #define RTLLIB_OFDM_MODULATION (1<<1)
883 #define RTLLIB_24GHZ_BAND (1<<0)
884 #define RTLLIB_52GHZ_BAND (1<<1)
886 #define RTLLIB_CCK_RATE_LEN 4
887 #define RTLLIB_CCK_RATE_1MB 0x02
888 #define RTLLIB_CCK_RATE_2MB 0x04
889 #define RTLLIB_CCK_RATE_5MB 0x0B
890 #define RTLLIB_CCK_RATE_11MB 0x16
891 #define RTLLIB_OFDM_RATE_LEN 8
892 #define RTLLIB_OFDM_RATE_6MB 0x0C
893 #define RTLLIB_OFDM_RATE_9MB 0x12
894 #define RTLLIB_OFDM_RATE_12MB 0x18
895 #define RTLLIB_OFDM_RATE_18MB 0x24
896 #define RTLLIB_OFDM_RATE_24MB 0x30
897 #define RTLLIB_OFDM_RATE_36MB 0x48
898 #define RTLLIB_OFDM_RATE_48MB 0x60
899 #define RTLLIB_OFDM_RATE_54MB 0x6C
900 #define RTLLIB_BASIC_RATE_MASK 0x80
902 #define RTLLIB_CCK_RATE_1MB_MASK (1<<0)
903 #define RTLLIB_CCK_RATE_2MB_MASK (1<<1)
904 #define RTLLIB_CCK_RATE_5MB_MASK (1<<2)
905 #define RTLLIB_CCK_RATE_11MB_MASK (1<<3)
906 #define RTLLIB_OFDM_RATE_6MB_MASK (1<<4)
907 #define RTLLIB_OFDM_RATE_9MB_MASK (1<<5)
908 #define RTLLIB_OFDM_RATE_12MB_MASK (1<<6)
909 #define RTLLIB_OFDM_RATE_18MB_MASK (1<<7)
910 #define RTLLIB_OFDM_RATE_24MB_MASK (1<<8)
911 #define RTLLIB_OFDM_RATE_36MB_MASK (1<<9)
912 #define RTLLIB_OFDM_RATE_48MB_MASK (1<<10)
913 #define RTLLIB_OFDM_RATE_54MB_MASK (1<<11)
915 #define RTLLIB_CCK_RATES_MASK 0x0000000F
916 #define RTLLIB_CCK_BASIC_RATES_MASK (RTLLIB_CCK_RATE_1MB_MASK | \
917 RTLLIB_CCK_RATE_2MB_MASK)
918 #define RTLLIB_CCK_DEFAULT_RATES_MASK (RTLLIB_CCK_BASIC_RATES_MASK | \
919 RTLLIB_CCK_RATE_5MB_MASK | \
920 RTLLIB_CCK_RATE_11MB_MASK)
922 #define RTLLIB_OFDM_RATES_MASK 0x00000FF0
923 #define RTLLIB_OFDM_BASIC_RATES_MASK (RTLLIB_OFDM_RATE_6MB_MASK | \
924 RTLLIB_OFDM_RATE_12MB_MASK | \
925 RTLLIB_OFDM_RATE_24MB_MASK)
926 #define RTLLIB_OFDM_DEFAULT_RATES_MASK (RTLLIB_OFDM_BASIC_RATES_MASK | \
927 RTLLIB_OFDM_RATE_9MB_MASK | \
928 RTLLIB_OFDM_RATE_18MB_MASK | \
929 RTLLIB_OFDM_RATE_36MB_MASK | \
930 RTLLIB_OFDM_RATE_48MB_MASK | \
931 RTLLIB_OFDM_RATE_54MB_MASK)
932 #define RTLLIB_DEFAULT_RATES_MASK (RTLLIB_OFDM_DEFAULT_RATES_MASK | \
933 RTLLIB_CCK_DEFAULT_RATES_MASK)
935 #define RTLLIB_NUM_OFDM_RATES 8
936 #define RTLLIB_NUM_CCK_RATES 4
937 #define RTLLIB_OFDM_SHIFT_MASK_A 4
940 /* this is stolen and modified from the madwifi driver*/
941 #define RTLLIB_FC0_TYPE_MASK 0x0c
942 #define RTLLIB_FC0_TYPE_DATA 0x08
943 #define RTLLIB_FC0_SUBTYPE_MASK 0xB0
944 #define RTLLIB_FC0_SUBTYPE_QOS 0x80
946 #define RTLLIB_QOS_HAS_SEQ(fc) \
947 (((fc) & (RTLLIB_FC0_TYPE_MASK | RTLLIB_FC0_SUBTYPE_MASK)) == \
948 (RTLLIB_FC0_TYPE_DATA | RTLLIB_FC0_SUBTYPE_QOS))
950 /* this is stolen from ipw2200 driver */
951 #define IEEE_IBSS_MAC_HASH_SIZE 31
952 struct ieee_ibss_seq
{
956 unsigned long packet_time
[17];
957 struct list_head list
;
960 /* NOTE: This data is for statistical purposes; not all hardware provides this
961 * information for frames received. Not setting these will not cause
962 * any adverse affects. */
963 struct rtllib_rx_stats
{
968 u16 rate
; /* in 100 kbps */
985 u16 bShortPreamble
:1;
1002 bool RxIs40MHzPacket
;
1004 u8 RxMIMOSignalStrength
[4];
1005 s8 RxMIMOSignalQuality
[2];
1006 bool bPacketMatchBSSID
;
1009 u8
*virtual_address
;
1014 bool bisrxaggrsubframe
;
1017 char cck_adc_pwdb
[4];
1022 /* IEEE 802.11 requires that STA supports concurrent reception of at least
1023 * three fragmented frames. This define can be increased to support more
1024 * concurrent frames, but it should be noted that each entry can consume about
1025 * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
1026 #define RTLLIB_FRAG_CACHE_LEN 4
1028 struct rtllib_frag_entry
{
1029 unsigned long first_frag_time
;
1031 unsigned int last_frag
;
1032 struct sk_buff
*skb
;
1033 u8 src_addr
[ETH_ALEN
];
1034 u8 dst_addr
[ETH_ALEN
];
1037 struct rtllib_stats
{
1038 unsigned int tx_unicast_frames
;
1039 unsigned int tx_multicast_frames
;
1040 unsigned int tx_fragments
;
1041 unsigned int tx_unicast_octets
;
1042 unsigned int tx_multicast_octets
;
1043 unsigned int tx_deferred_transmissions
;
1044 unsigned int tx_single_retry_frames
;
1045 unsigned int tx_multiple_retry_frames
;
1046 unsigned int tx_retry_limit_exceeded
;
1047 unsigned int tx_discards
;
1048 unsigned int rx_unicast_frames
;
1049 unsigned int rx_multicast_frames
;
1050 unsigned int rx_fragments
;
1051 unsigned int rx_unicast_octets
;
1052 unsigned int rx_multicast_octets
;
1053 unsigned int rx_fcs_errors
;
1054 unsigned int rx_discards_no_buffer
;
1055 unsigned int tx_discards_wrong_sa
;
1056 unsigned int rx_discards_undecryptable
;
1057 unsigned int rx_message_in_msg_fragments
;
1058 unsigned int rx_message_in_bad_msg_fragments
;
1061 struct rtllib_device
;
1063 #define SEC_KEY_1 (1<<0)
1064 #define SEC_KEY_2 (1<<1)
1065 #define SEC_KEY_3 (1<<2)
1066 #define SEC_KEY_4 (1<<3)
1067 #define SEC_ACTIVE_KEY (1<<4)
1068 #define SEC_AUTH_MODE (1<<5)
1069 #define SEC_UNICAST_GROUP (1<<6)
1070 #define SEC_LEVEL (1<<7)
1071 #define SEC_ENABLED (1<<8)
1072 #define SEC_ENCRYPT (1<<9)
1074 #define SEC_LEVEL_0 0 /* None */
1075 #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
1076 #define SEC_LEVEL_2 2 /* Level 1 + TKIP */
1077 #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
1078 #define SEC_LEVEL_3 4 /* Level 2 + CCMP */
1080 #define SEC_ALG_NONE 0
1081 #define SEC_ALG_WEP 1
1082 #define SEC_ALG_TKIP 2
1083 #define SEC_ALG_CCMP 4
1085 #define WEP_KEY_LEN 13
1086 #define SCM_KEY_LEN 32
1087 #define SCM_TEMPORAL_KEY_LENGTH 16
1089 struct rtllib_security
{
1094 unicast_uses_group
:1,
1096 u8 key_sizes
[NUM_WEP_KEYS
];
1097 u8 keys
[NUM_WEP_KEYS
][SCM_KEY_LEN
];
1104 802.11 data frame from AP
1105 ,-------------------------------------------------------------------.
1106 Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
1107 |------|------|---------|---------|---------|------|---------|------|
1108 Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
1109 | | tion | (BSSID) | | | ence | data | |
1110 `-------------------------------------------------------------------'
1111 Total: 28-2340 bytes
1114 /* Management Frame Information Element Types */
1117 MFIE_TYPE_RATES
= 1,
1118 MFIE_TYPE_FH_SET
= 2,
1119 MFIE_TYPE_DS_SET
= 3,
1120 MFIE_TYPE_CF_SET
= 4,
1122 MFIE_TYPE_IBSS_SET
= 6,
1123 MFIE_TYPE_COUNTRY
= 7,
1124 MFIE_TYPE_HOP_PARAMS
= 8,
1125 MFIE_TYPE_HOP_TABLE
= 9,
1126 MFIE_TYPE_REQUEST
= 10,
1127 MFIE_TYPE_CHALLENGE
= 16,
1128 MFIE_TYPE_POWER_CONSTRAINT
= 32,
1129 MFIE_TYPE_POWER_CAPABILITY
= 33,
1130 MFIE_TYPE_TPC_REQUEST
= 34,
1131 MFIE_TYPE_TPC_REPORT
= 35,
1132 MFIE_TYPE_SUPP_CHANNELS
= 36,
1134 MFIE_TYPE_MEASURE_REQUEST
= 38,
1135 MFIE_TYPE_MEASURE_REPORT
= 39,
1136 MFIE_TYPE_QUIET
= 40,
1137 MFIE_TYPE_IBSS_DFS
= 41,
1139 MFIE_TYPE_HT_CAP
= 45,
1141 MFIE_TYPE_RATES_EX
= 50,
1142 MFIE_TYPE_HT_INFO
= 61,
1143 MFIE_TYPE_AIRONET
= 133,
1144 MFIE_TYPE_GENERIC
= 221,
1145 MFIE_TYPE_QOS_PARAMETER
= 222,
1148 /* Minimal header; can be used for passing 802.11 frames with sufficient
1149 * information to determine what type of underlying data type is actually
1150 * stored in the data. */
1151 struct rtllib_pspoll_hdr
{
1164 struct rtllib_hdr_1addr
{
1171 struct rtllib_hdr_2addr
{
1179 struct rtllib_hdr_3addr
{
1189 struct rtllib_hdr_4addr
{
1200 struct rtllib_hdr_3addrqos
{
1211 struct rtllib_hdr_4addrqos
{
1223 struct rtllib_info_element
{
1229 struct rtllib_authentication
{
1230 struct rtllib_hdr_3addr header
;
1235 struct rtllib_info_element info_element
[0];
1238 struct rtllib_disauth
{
1239 struct rtllib_hdr_3addr header
;
1243 struct rtllib_disassoc
{
1244 struct rtllib_hdr_3addr header
;
1248 struct rtllib_probe_request
{
1249 struct rtllib_hdr_3addr header
;
1250 /* SSID, supported rates */
1251 struct rtllib_info_element info_element
[0];
1254 struct rtllib_probe_response
{
1255 struct rtllib_hdr_3addr header
;
1257 __le16 beacon_interval
;
1259 /* SSID, supported rates, FH params, DS params,
1260 * CF params, IBSS params, TIM (if beacon), RSN */
1261 struct rtllib_info_element info_element
[0];
1264 /* Alias beacon for probe_response */
1265 #define rtllib_beacon rtllib_probe_response
1267 struct rtllib_assoc_request_frame
{
1268 struct rtllib_hdr_3addr header
;
1270 __le16 listen_interval
;
1271 /* SSID, supported rates, RSN */
1272 struct rtllib_info_element info_element
[0];
1275 struct rtllib_reassoc_request_frame
{
1276 struct rtllib_hdr_3addr header
;
1278 __le16 listen_interval
;
1279 u8 current_ap
[ETH_ALEN
];
1280 /* SSID, supported rates, RSN */
1281 struct rtllib_info_element info_element
[0];
1284 struct rtllib_assoc_response_frame
{
1285 struct rtllib_hdr_3addr header
;
1289 struct rtllib_info_element info_element
[0]; /* supported rates */
1299 __le16 payload_size
;
1300 struct sk_buff
*fragments
[0];
1303 #define MAX_TX_AGG_COUNT 16
1304 struct rtllib_drv_agg_txb
{
1305 u8 nr_drv_agg_frames
;
1306 struct sk_buff
*tx_agg_frames
[MAX_TX_AGG_COUNT
];
1309 #define MAX_SUBFRAME_COUNT 64
1312 struct sk_buff
*subframes
[MAX_SUBFRAME_COUNT
];
1329 /* SWEEP TABLE ENTRIES NUMBER*/
1330 #define MAX_SWEEP_TAB_ENTRIES 42
1331 #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
1332 /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
1333 * only use 8, and then use extended rates for the remaining supported
1334 * rates. Other APs, however, stick all of their supported rates on the
1335 * main rates information element... */
1336 #define MAX_RATES_LENGTH ((u8)12)
1337 #define MAX_RATES_EX_LENGTH ((u8)16)
1338 #define MAX_NETWORK_COUNT 96
1340 #define MAX_CHANNEL_NUMBER 161
1341 #define RTLLIB_SOFTMAC_SCAN_TIME 100
1342 #define RTLLIB_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2)
1344 #define CRC_LENGTH 4U
1346 #define MAX_WPA_IE_LEN 64
1347 #define MAX_WZC_IE_LEN 256
1349 #define NETWORK_EMPTY_ESSID (1<<0)
1350 #define NETWORK_HAS_OFDM (1<<1)
1351 #define NETWORK_HAS_CCK (1<<2)
1354 #define NETWORK_HAS_QOS_PARAMETERS (1<<3)
1355 #define NETWORK_HAS_QOS_INFORMATION (1<<4)
1356 #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \
1357 NETWORK_HAS_QOS_INFORMATION)
1359 #define NETWORK_HAS_POWER_CONSTRAINT (1<<5)
1360 #define NETWORK_HAS_CSA (1<<6)
1361 #define NETWORK_HAS_QUIET (1<<7)
1362 #define NETWORK_HAS_IBSS_DFS (1<<8)
1363 #define NETWORK_HAS_TPC_REPORT (1<<9)
1365 #define NETWORK_HAS_ERP_VALUE (1<<10)
1367 #define QOS_QUEUE_NUM 4
1368 #define QOS_OUI_LEN 3
1369 #define QOS_OUI_TYPE 2
1370 #define QOS_ELEMENT_ID 221
1371 #define QOS_OUI_INFO_SUB_TYPE 0
1372 #define QOS_OUI_PARAM_SUB_TYPE 1
1373 #define QOS_VERSION_1 1
1374 #define QOS_AIFSN_MIN_VALUE 2
1376 struct rtllib_qos_information_element
{
1379 u8 qui
[QOS_OUI_LEN
];
1386 struct rtllib_qos_ac_parameter
{
1392 struct rtllib_qos_parameter_info
{
1393 struct rtllib_qos_information_element info_element
;
1395 struct rtllib_qos_ac_parameter ac_params_record
[QOS_QUEUE_NUM
];
1398 struct rtllib_qos_parameters
{
1399 __le16 cw_min
[QOS_QUEUE_NUM
];
1400 __le16 cw_max
[QOS_QUEUE_NUM
];
1401 u8 aifs
[QOS_QUEUE_NUM
];
1402 u8 flag
[QOS_QUEUE_NUM
];
1403 __le16 tx_op_limit
[QOS_QUEUE_NUM
];
1406 struct rtllib_qos_data
{
1407 struct rtllib_qos_parameters parameters
;
1408 unsigned int wmm_acm
;
1415 struct rtllib_tim_parameters
{
1420 struct rtllib_wmm_ac_param
{
1421 u8 ac_aci_acm_aifsn
;
1422 u8 ac_ecwmin_ecwmax
;
1426 struct rtllib_wmm_ts_info
{
1432 struct rtllib_wmm_tspec_elem
{
1433 struct rtllib_wmm_ts_info ts_info
;
1440 u32 serv_start_time
;
1447 u16 surp_band_allow
;
1456 EAPOL_ENCAP_ASF_ALERT
1459 static const char *eap_types
[] = {
1460 [EAP_PACKET
] = "EAP-Packet",
1461 [EAPOL_START
] = "EAPOL-Start",
1462 [EAPOL_LOGOFF
] = "EAPOL-Logoff",
1463 [EAPOL_KEY
] = "EAPOL-Key",
1464 [EAPOL_ENCAP_ASF_ALERT
] = "EAPOL-Encap-ASF-Alert"
1467 static inline const char *eap_get_type(int type
)
1469 return ((u32
)type
>= ARRAY_SIZE(eap_types
)) ? "Unknown" :
1472 static inline u8
Frame_QoSTID(u8
*buf
)
1474 struct rtllib_hdr_3addr
*hdr
;
1476 hdr
= (struct rtllib_hdr_3addr
*)buf
;
1477 fc
= le16_to_cpu(hdr
->frame_ctl
);
1478 return (u8
)((union frameqos
*)(buf
+ (((fc
& RTLLIB_FCTL_TODS
) &&
1479 (fc
& RTLLIB_FCTL_FROMDS
)) ? 30 : 24)))->field
.tid
;
1491 struct rtllib_softmac_stats
{
1492 unsigned int rx_ass_ok
;
1493 unsigned int rx_ass_err
;
1494 unsigned int rx_probe_rq
;
1495 unsigned int tx_probe_rs
;
1496 unsigned int tx_beacons
;
1497 unsigned int rx_auth_rq
;
1498 unsigned int rx_auth_rs_ok
;
1499 unsigned int rx_auth_rs_err
;
1500 unsigned int tx_auth_rq
;
1501 unsigned int no_auth_rs
;
1502 unsigned int no_ass_rs
;
1503 unsigned int tx_ass_rq
;
1504 unsigned int rx_ass_rq
;
1505 unsigned int tx_probe_rq
;
1506 unsigned int reassoc
;
1507 unsigned int swtxstop
;
1508 unsigned int swtxawake
;
1509 unsigned char CurrentShowTxate
;
1510 unsigned char last_packet_rate
;
1511 unsigned int txretrycount
;
1514 #define BEACON_PROBE_SSID_ID_POSITION 12
1516 struct rtllib_info_element_hdr
{
1522 * These are the data types that can make up management packets
1526 u16 beacon_interval;
1528 u8 current_ap[ETH_ALEN];
1529 u16 listen_interval;
1531 u16 association_id:14, reserved:2;
1538 #define RTLLIB_DEFAULT_TX_ESSID "Penguin"
1539 #define RTLLIB_DEFAULT_BASIC_RATE 2
1541 enum {WMM_all_frame
, WMM_two_frame
, WMM_four_frame
, WMM_six_frame
};
1542 #define MAX_SP_Len (WMM_all_frame << 4)
1543 #define RTLLIB_QOS_TID 0x0f
1544 #define QOS_CTL_NOTCONTAIN_ACK (0x01 << 5)
1546 #define RTLLIB_DTIM_MBCAST 4
1547 #define RTLLIB_DTIM_UCAST 2
1548 #define RTLLIB_DTIM_VALID 1
1549 #define RTLLIB_DTIM_INVALID 0
1551 #define RTLLIB_PS_DISABLED 0
1552 #define RTLLIB_PS_UNICAST RTLLIB_DTIM_UCAST
1553 #define RTLLIB_PS_MBCAST RTLLIB_DTIM_MBCAST
1555 #define WME_AC_BK 0x00
1556 #define WME_AC_BE 0x01
1557 #define WME_AC_VI 0x02
1558 #define WME_AC_VO 0x03
1559 #define WME_ACI_MASK 0x03
1560 #define WME_AIFSN_MASK 0x03
1561 #define WME_AC_PRAM_LEN 16
1563 #define MAX_RECEIVE_BUFFER_SIZE 9100
1565 #define UP2AC(up) ( \
1566 ((up) < 1) ? WME_AC_BE : \
1567 ((up) < 3) ? WME_AC_BK : \
1568 ((up) < 4) ? WME_AC_BE : \
1569 ((up) < 6) ? WME_AC_VI : \
1572 #define AC2UP(_ac) ( \
1573 ((_ac) == WME_AC_VO) ? 6 : \
1574 ((_ac) == WME_AC_VI) ? 5 : \
1575 ((_ac) == WME_AC_BK) ? 1 : \
1578 #define ETHER_ADDR_LEN 6 /* length of an Ethernet address */
1579 #define ETHERNET_HEADER_SIZE 14 /* length of two Ethernet address
1582 struct ether_header
{
1583 u8 ether_dhost
[ETHER_ADDR_LEN
];
1584 u8 ether_shost
[ETHER_ADDR_LEN
];
1588 #ifndef ETHERTYPE_PAE
1589 #define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */
1591 #ifndef ETHERTYPE_IP
1592 #define ETHERTYPE_IP 0x0800 /* IP protocol */
1597 ERP_NonERPpresent
= 0x01,
1598 ERP_UseProtection
= 0x02,
1599 ERP_BarkerPreambleMode
= 0x04,
1602 struct rtllib_network
{
1603 /* These entries are used to identify a unique network */
1606 /* Ensure null-terminated for any debug msgs */
1607 u8 ssid
[IW_ESSID_MAX_SIZE
+ 1];
1609 u8 hidden_ssid
[IW_ESSID_MAX_SIZE
+ 1];
1611 struct rtllib_qos_data qos_data
;
1613 bool bWithAironetIE
;
1614 bool bCkipSupported
;
1620 bool bWithCcxVerNum
;
1622 /* These are network statistics */
1623 struct rtllib_rx_stats stats
;
1625 u8 rates
[MAX_RATES_LENGTH
];
1627 u8 rates_ex
[MAX_RATES_EX_LENGTH
];
1629 unsigned long last_scanned
;
1634 u16 beacon_interval
;
1635 u16 listen_interval
;
1638 u8 wpa_ie
[MAX_WPA_IE_LEN
];
1640 u8 rsn_ie
[MAX_WPA_IE_LEN
];
1642 u8 wzc_ie
[MAX_WZC_IE_LEN
];
1645 struct rtllib_tim_parameters tim
;
1648 u64 last_dtim_sta_time
;
1651 struct rtllib_wmm_ac_param wmm_param
[4];
1654 u8 CountryIeBuf
[MAX_IE_LEN
];
1655 struct bss_ht bssht
;
1656 bool broadcom_cap_exist
;
1657 bool realtek_cap_exit
;
1658 bool marvell_cap_exist
;
1659 bool ralink_cap_exist
;
1660 bool atheros_cap_exist
;
1661 bool cisco_cap_exist
;
1662 bool airgo_cap_exist
;
1663 bool unknown_cap_exist
;
1664 bool berp_info_valid
;
1665 bool buseprotection
;
1666 bool bIsNetgear854T
;
1669 struct list_head list
;
1675 /* the card is not linked at all */
1678 /* RTLLIB_ASSOCIATING* are for BSS client mode
1679 * the driver shall not perform RX filtering unless
1680 * the state is LINKED.
1681 * The driver shall just check for the state LINKED and
1682 * defaults to NOLINK for ALL the other states (including
1686 /* the association procedure will start (wq scheduling)*/
1688 RTLLIB_ASSOCIATING_RETRY
,
1690 /* the association procedure is sending AUTH request*/
1691 RTLLIB_ASSOCIATING_AUTHENTICATING
,
1693 /* the association procedure has successfully authentcated
1694 * and is sending association request
1696 RTLLIB_ASSOCIATING_AUTHENTICATED
,
1698 /* the link is ok. the card associated to a BSS or linked
1699 * to a ibss cell or acting as an AP and creating the bss
1703 /* same as LINKED, but the driver shall apply RX filter
1704 * rules as we are in NO_LINK mode. As the card is still
1705 * logically linked, but it is doing a syncro site survey
1706 * then it will be back to LINKED state.
1708 RTLLIB_LINKED_SCANNING
,
1712 RTLLIB_UNINITIALIZED
= 0,
1716 RTLLIB_AUTHENTICATING
,
1717 RTLLIB_AUTHENTICATED
,
1722 #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
1723 #define DEFAULT_FTS 2346
1725 #define CFG_RTLLIB_RESERVE_FCS (1<<0)
1726 #define CFG_RTLLIB_COMPUTE_FCS (1<<1)
1727 #define CFG_RTLLIB_RTS (1<<2)
1729 #define RTLLIB_24GHZ_MIN_CHANNEL 1
1730 #define RTLLIB_24GHZ_MAX_CHANNEL 14
1731 #define RTLLIB_24GHZ_CHANNELS (RTLLIB_24GHZ_MAX_CHANNEL - \
1732 RTLLIB_24GHZ_MIN_CHANNEL + 1)
1734 #define RTLLIB_52GHZ_MIN_CHANNEL 34
1735 #define RTLLIB_52GHZ_MAX_CHANNEL 165
1736 #define RTLLIB_52GHZ_CHANNELS (RTLLIB_52GHZ_MAX_CHANNEL - \
1737 RTLLIB_52GHZ_MIN_CHANNEL + 1)
1739 #define eqMacAddr(a, b) \
1740 (((a)[0] == (b)[0] && (a)[1] == (b)[1] && (a)[2] == (b)[2] && \
1741 (a)[3] == (b)[3] && (a)[4] == (b)[4] && (a)[5] == (b)[5]) ? 1 : 0)
1745 struct rtllib_txb
*txb
;
1748 struct bandwidth_autoswitch
{
1749 long threshold_20Mhzto40Mhz
;
1750 long threshold_40Mhzto20Mhz
;
1751 bool bforced_tx20Mhz
;
1752 bool bautoswitch_enable
;
1757 #define REORDER_WIN_SIZE 128
1758 #define REORDER_ENTRY_NUM 128
1759 struct rx_reorder_entry
{
1760 struct list_head List
;
1762 struct rtllib_rxb
*prxb
;
1777 enum ips_callback_function
{
1778 IPS_CALLBACK_NONE
= 0,
1779 IPS_CALLBACK_MGNT_LINK_REQUEST
= 1,
1780 IPS_CALLBACK_JOIN_REQUEST
= 2,
1783 enum rt_join_action
{
1793 #define MAX_NUM_RATES 264
1795 enum rt_rf_power_state
{
1801 #define MAX_SUPPORT_WOL_PATTERN_NUM 8
1803 #define MAX_WOL_BIT_MASK_SIZE 16
1804 #define MAX_WOL_PATTERN_SIZE 128
1806 enum wol_pattern_type
{
1814 struct rt_pm_wol_info
{
1819 enum wol_pattern_type PatternType
;
1822 struct rt_pwr_save_ctrl
{
1825 bool bIPSModeBackup
;
1826 bool bHaltAdapterClkRQ
;
1827 bool bSwRfProcessing
;
1828 enum rt_rf_power_state eInactivePowerState
;
1829 struct work_struct InactivePsWorkItem
;
1830 struct timer_list InactivePsTimer
;
1832 enum ips_callback_function ReturnPoint
;
1835 enum rt_join_action tmpJoinAction
;
1836 struct rtllib_network tmpBssDesc
;
1839 bool bTmpActiveScan
;
1840 bool bTmpFilterHiddenAP
;
1841 bool bTmpUpdateParms
;
1843 struct octet_string tmpSsid2Scan
;
1846 u8 tmpChannelNumber
;
1850 struct octet_string tmpSuppRateSet
;
1851 u8 tmpSuppRateBuf
[MAX_NUM_RATES
];
1853 struct ibss_parms tmpIbpm
;
1859 u8 RegMaxLPSAwakeIntvl
;
1868 bool LinkReqInIPSRFOffPgs
;
1869 bool BufConnectinfoBefore
;
1877 struct rt_pm_wol_info PmWoLPatternInfo
[MAX_SUPPORT_WOL_PATTERN_NUM
];
1881 #define RT_RF_CHANGE_SOURCE u32
1883 #define RF_CHANGE_BY_SW BIT31
1884 #define RF_CHANGE_BY_HW BIT30
1885 #define RF_CHANGE_BY_PS BIT29
1886 #define RF_CHANGE_BY_IPS BIT28
1887 #define RF_CHANGE_BY_INIT 0
1889 enum country_code_type
{
1890 COUNTRY_CODE_FCC
= 0,
1891 COUNTRY_CODE_IC
= 1,
1892 COUNTRY_CODE_ETSI
= 2,
1893 COUNTRY_CODE_SPAIN
= 3,
1894 COUNTRY_CODE_FRANCE
= 4,
1895 COUNTRY_CODE_MKK
= 5,
1896 COUNTRY_CODE_MKK1
= 6,
1897 COUNTRY_CODE_ISRAEL
= 7,
1898 COUNTRY_CODE_TELEC
= 8,
1899 COUNTRY_CODE_MIC
= 9,
1900 COUNTRY_CODE_GLOBAL_DOMAIN
= 10,
1901 COUNTRY_CODE_WORLD_WIDE_13
= 11,
1902 COUNTRY_CODE_TELEC_NETGEAR
= 12,
1906 enum scan_op_backup_opt
{
1907 SCAN_OPT_BACKUP
= 0,
1912 enum fw_cmd_io_type
{
1913 FW_CMD_DIG_ENABLE
= 0,
1914 FW_CMD_DIG_DISABLE
= 1,
1915 FW_CMD_DIG_HALT
= 2,
1916 FW_CMD_DIG_RESUME
= 3,
1917 FW_CMD_HIGH_PWR_ENABLE
= 4,
1918 FW_CMD_HIGH_PWR_DISABLE
= 5,
1919 FW_CMD_RA_RESET
= 6,
1920 FW_CMD_RA_ACTIVE
= 7,
1921 FW_CMD_RA_REFRESH_N
= 8,
1922 FW_CMD_RA_REFRESH_BG
= 9,
1923 FW_CMD_RA_INIT
= 10,
1924 FW_CMD_IQK_ENABLE
= 11,
1925 FW_CMD_TXPWR_TRACK_ENABLE
= 12,
1926 FW_CMD_TXPWR_TRACK_DISABLE
= 13,
1927 FW_CMD_TXPWR_TRACK_THERMAL
= 14,
1928 FW_CMD_PAUSE_DM_BY_SCAN
= 15,
1929 FW_CMD_RESUME_DM_BY_SCAN
= 16,
1930 FW_CMD_RA_REFRESH_N_COMB
= 17,
1931 FW_CMD_RA_REFRESH_BG_COMB
= 18,
1932 FW_CMD_ANTENNA_SW_ENABLE
= 19,
1933 FW_CMD_ANTENNA_SW_DISABLE
= 20,
1934 FW_CMD_TX_FEEDBACK_CCX_ENABLE
= 21,
1935 FW_CMD_LPS_ENTER
= 22,
1936 FW_CMD_LPS_LEAVE
= 23,
1937 FW_CMD_DIG_MODE_SS
= 24,
1938 FW_CMD_DIG_MODE_FA
= 25,
1939 FW_CMD_ADD_A2_ENTRY
= 26,
1940 FW_CMD_CTRL_DM_BY_DRIVER
= 27,
1941 FW_CMD_CTRL_DM_BY_DRIVER_NEW
= 28,
1942 FW_CMD_PAPE_CONTROL
= 29,
1943 FW_CMD_CHAN_SET
= 30,
1946 #define RT_MAX_LD_SLOT_NUM 10
1947 struct rt_link_detect
{
1949 u32 NumRecvBcnInPeriod
;
1950 u32 NumRecvDataInPeriod
;
1952 u32 RxBcnNum
[RT_MAX_LD_SLOT_NUM
];
1953 u32 RxDataNum
[RT_MAX_LD_SLOT_NUM
];
1957 u32 NumTxOkInPeriod
;
1958 u32 NumRxOkInPeriod
;
1959 u32 NumRxUnicastOkInPeriod
;
1961 bool bHigherBusyTraffic
;
1962 bool bHigherBusyRxTraffic
;
1964 u32 NumTxUnicastOkInPeriod
;
1965 u32 LastNumTxUnicast
;
1966 u32 LastNumRxUnicast
;
1969 struct sw_cam_table
{
1979 #define TOTAL_CAM_ENTRY 32
1980 struct rate_adaptive
{
1981 u8 rate_adaptive_disabled
;
1985 u32 high_rssi_thresh_for_ra
;
1986 u32 high2low_rssi_thresh_for_ra
;
1987 u8 low2high_rssi_thresh_for_ra40M
;
1988 u32 low_rssi_thresh_for_ra40M
;
1989 u8 low2high_rssi_thresh_for_ra20M
;
1990 u32 low_rssi_thresh_for_ra20M
;
1991 u32 upper_rssi_threshold_ratr
;
1992 u32 middle_rssi_threshold_ratr
;
1993 u32 low_rssi_threshold_ratr
;
1994 u32 low_rssi_threshold_ratr_40M
;
1995 u32 low_rssi_threshold_ratr_20M
;
1996 u8 ping_rssi_enable
;
1998 u32 ping_rssi_thresh_for_ra
;
2003 enum ratr_table_mode_8192s
{
2004 RATR_INX_WIRELESS_NGB
= 0,
2005 RATR_INX_WIRELESS_NG
= 1,
2006 RATR_INX_WIRELESS_NB
= 2,
2007 RATR_INX_WIRELESS_N
= 3,
2008 RATR_INX_WIRELESS_GB
= 4,
2009 RATR_INX_WIRELESS_G
= 5,
2010 RATR_INX_WIRELESS_B
= 6,
2011 RATR_INX_WIRELESS_MC
= 7,
2012 RATR_INX_WIRELESS_A
= 8,
2015 #define NUM_PMKID_CACHE 16
2016 struct rt_pmkid_list
{
2025 struct rt_intel_promisc_mode
{
2026 bool bPromiscuousOn
;
2027 bool bFilterSourceStationFrame
;
2031 /*************** DRIVER STATUS *****/
2032 #define STATUS_SCANNING 0
2033 #define STATUS_SCAN_HW 1
2034 #define STATUS_SCAN_ABORTING 2
2035 #define STATUS_SETTING_CHAN 3
2036 /*************** DRIVER STATUS *****/
2048 LPS_WAIT_NULL_DATA_SEND
= 2,
2051 struct rtllib_device
{
2052 struct pci_dev
*pdev
;
2053 struct net_device
*dev
;
2054 struct rtllib_security sec
;
2056 bool disable_mgnt_queue
;
2058 unsigned long status
;
2060 enum ht_extchnl_offset chan_offset_bk
;
2061 enum ht_channel_width bandwidth_bk
;
2065 enum rt_op_mode OpMode
;
2068 /* The last AssocReq/Resp IEs */
2069 u8
*assocreq_ies
, *assocresp_ies
;
2070 size_t assocreq_ies_len
, assocresp_ies_len
;
2072 bool b_customer_lenovo_id
;
2073 bool bForcedShowRxRate
;
2074 bool bForcedShowRateStill
;
2075 u8 SystemQueryDataRateCount
;
2078 bool b1x1RecvCombine
;
2083 bool is_silent_reset
;
2084 bool force_mic_error
;
2088 bool bSupportRemoteWakeUp
;
2089 enum rt_ps_mode dot11PowerSaveMode
;
2091 bool FirstIe_InScan
;
2092 bool be_scan_inprogress
;
2094 enum rt_rf_power_state eRFPowerState
;
2095 RT_RF_CHANGE_SOURCE RfOffReason
;
2098 struct rt_hi_throughput
*pHTInfo
;
2099 spinlock_t bw_spinlock
;
2101 spinlock_t reorder_spinlock
;
2102 u8 Regdot11HTOperationalRateSet
[16];
2103 u8 Regdot11TxHTOperationalRateSet
[16];
2104 u8 dot11HTOperationalRateSet
[16];
2105 u8 RegHTSuppRateSet
[16];
2106 u8 HTCurrentOperaRate
;
2107 u8 HTHighestOperaRate
;
2110 u8 bTxDisableRateFallBack
;
2111 u8 bTxUseDriverAssingedRate
;
2112 u8 bTxEnableFwCalcDur
;
2113 atomic_t atm_chnlop
;
2116 struct list_head Tx_TS_Admit_List
;
2117 struct list_head Tx_TS_Pending_List
;
2118 struct list_head Tx_TS_Unused_List
;
2119 struct tx_ts_record TxTsRecord
[TOTAL_TS_NUM
];
2120 struct list_head Rx_TS_Admit_List
;
2121 struct list_head Rx_TS_Pending_List
;
2122 struct list_head Rx_TS_Unused_List
;
2123 struct rx_ts_record RxTsRecord
[TOTAL_TS_NUM
];
2124 struct rx_reorder_entry RxReorderEntry
[128];
2125 struct list_head RxReorder_Unused_List
;
2129 /* Bookkeeping structures */
2130 struct net_device_stats stats
;
2131 struct rtllib_stats ieee_stats
;
2132 struct rtllib_softmac_stats softmac_stats
;
2134 /* Probe / Beacon management */
2135 struct list_head network_free_list
;
2136 struct list_head network_list
;
2137 struct rtllib_network
*networks
;
2141 int iw_mode
; /* operating mode (IW_MODE_*) */
2142 bool bNetPromiscuousMode
;
2143 struct rt_intel_promisc_mode IntelPromiscuousModeInfo
;
2145 struct iw_spy_data spy_data
;
2148 spinlock_t wpax_suitlist_lock
;
2150 int tx_headroom
; /* Set to size of any additional room needed at front
2151 * of allocated Tx SKBs */
2154 /* WEP and other encryption related settings at the device level */
2155 int open_wep
; /* Set to 1 to allow unencrypted frames */
2157 int reset_on_keychange
; /* Set to 1 if the HW needs to be reset on
2158 * WEP key changes */
2160 /* If the host performs {en,de}cryption, then set to 1 */
2162 int host_encrypt_msdu
;
2164 /* host performs multicast decryption */
2165 int host_mc_decrypt
;
2167 /* host should strip IV and ICV from protected frames */
2168 /* meaningful only when hardware decryption is being used */
2169 int host_strip_iv_icv
;
2173 int ieee802_1x
; /* is IEEE 802.1X used */
2177 bool bHalfWirelessN24GMode
;
2179 int drop_unencrypted
;
2180 int tkip_countermeasures
;
2181 int privacy_invoked
;
2187 u16 pairwise_key_type
;
2190 struct lib80211_crypt_info crypt_info
;
2192 struct sw_cam_table swcamtable
[TOTAL_CAM_ENTRY
];
2193 int bcrx_sta_key
; /* use individual keys to override default keys even
2194 * with RX of broad/multicast frames */
2196 struct rt_pmkid_list PMKIDList
[NUM_PMKID_CACHE
];
2198 /* Fragmentation structures */
2199 struct rtllib_frag_entry frag_cache
[17][RTLLIB_FRAG_CACHE_LEN
];
2200 unsigned int frag_next_idx
[17];
2201 u16 fts
; /* Fragmentation Threshold */
2202 #define DEFAULT_RTS_THRESHOLD 2346U
2203 #define MIN_RTS_THRESHOLD 1
2204 #define MAX_RTS_THRESHOLD 2346U
2205 u16 rts
; /* RTS threshold */
2207 /* Association info */
2210 /* This stores infos for the current network.
2211 * Either the network we are associated in INFRASTRUCTURE
2212 * or the network that we are creating in MASTER mode.
2213 * ad-hoc is a mixture ;-).
2214 * Note that in infrastructure mode, even when not associated,
2215 * fields bssid and essid may be valid (if wpa_set and essid_set
2216 * are true) as thy carry the value set by the user via iwconfig
2218 struct rtllib_network current_network
;
2220 enum rtllib_state state
;
2224 int mode
; /* A, B, G */
2225 int modulation
; /* CCK, OFDM */
2226 int freq_band
; /* 2.4Ghz, 5.2Ghz, Mixed */
2227 int abg_true
; /* ABG flag */
2229 /* used for forcing the ibss workqueue to terminate
2230 * without wait for the syncro scan to terminate
2232 short sync_scan_hurryup
;
2237 u16 prev_seq_ctl
; /* used to drop duplicate frames */
2239 /* map of allowed channels. 0 is dummy */
2242 u8 active_channel_map
[MAX_CHANNEL_NUMBER
+1];
2245 u8 ibss_maxjoin_chal
;
2247 int rate
; /* current rate */
2253 /* this contains flags for selectively enable softmac support */
2254 u16 softmac_features
;
2256 /* if the sequence control field is not filled by HW */
2259 /* association procedure transaction sequence number */
2262 /* AID for RTXed association responses */
2265 /* power save mode related*/
2271 struct tasklet_struct ps_task
;
2276 /* used if IEEE_SOFTMAC_TX_QUEUE is set */
2278 short scanning_continue
;
2279 short proto_started
;
2280 short proto_stoppping
;
2282 struct semaphore wx_sem
;
2283 struct semaphore scan_sem
;
2284 struct semaphore ips_sem
;
2286 spinlock_t mgmt_tx_lock
;
2287 spinlock_t beacon_lock
;
2294 /* set on initialization */
2296 unsigned int wmm_acm
;
2298 /* for discarding duplicated packets in IBSS */
2299 struct list_head ibss_mac_hash
[IEEE_IBSS_MAC_HASH_SIZE
];
2301 /* for discarding duplicated packets in BSS */
2302 u16 last_rxseq_num
[17]; /* rx seq previous per-tid */
2303 u16 last_rxfrag_num
[17];/* tx frag previous per-tid */
2304 unsigned long last_packet_time
[17];
2307 unsigned long last_rx_ps_time
;
2311 /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
2312 struct sk_buff
*mgmt_queue_ring
[MGMT_QUEUE_NUM
];
2313 int mgmt_queue_head
;
2314 int mgmt_queue_tail
;
2315 #define RTLLIB_QUEUE_LIMIT 128
2317 unsigned int hw_header
;
2318 struct sk_buff_head skb_waitQ
[MAX_QUEUE_SIZE
];
2319 struct sk_buff_head skb_aggQ
[MAX_QUEUE_SIZE
];
2320 struct sk_buff_head skb_drv_aggQ
[MAX_QUEUE_SIZE
];
2321 u32 sta_edca_param
[4];
2323 bool enable_rx_imm_BA
;
2324 bool bibsscoordinator
;
2326 bool bdynamic_txpower_enable
;
2328 bool bCTSToSelfEnable
;
2331 u32 fsync_time_interval
;
2332 u32 fsync_rate_bitmap
;
2333 u8 fsync_rssi_threshold
;
2336 u8 fsync_multiple_timeinterval
;
2337 u32 fsync_firstdiff_ratethreshold
;
2338 u32 fsync_seconddiff_ratethreshold
;
2339 enum fsync_state fsync_state
;
2340 bool bis_any_nonbepkts
;
2341 struct bandwidth_autoswitch bandwidth_auto_switch
;
2344 struct rt_link_detect LinkDetectInfo
;
2345 bool bIsAggregateFrame
;
2346 struct rt_pwr_save_ctrl PowerSaveControl
;
2347 u8 amsdu_in_process
;
2349 /* used if IEEE_SOFTMAC_TX_QUEUE is set */
2350 struct tx_pending tx_pending
;
2352 /* used if IEEE_SOFTMAC_ASSOCIATE is set */
2353 struct timer_list associate_timer
;
2355 /* used if IEEE_SOFTMAC_BEACONS is set */
2356 struct timer_list beacon_timer
;
2358 struct work_struct associate_complete_wq
;
2359 struct work_struct ips_leave_wq
;
2360 struct delayed_work associate_procedure_wq
;
2361 struct delayed_work softmac_scan_wq
;
2362 struct delayed_work softmac_hint11d_wq
;
2363 struct delayed_work associate_retry_wq
;
2364 struct delayed_work start_ibss_wq
;
2365 struct delayed_work hw_wakeup_wq
;
2366 struct delayed_work hw_sleep_wq
;
2367 struct delayed_work link_change_wq
;
2368 struct work_struct wx_sync_scan_wq
;
2370 struct workqueue_struct
*wq
;
2372 struct rtllib_rxb
*RfdArray
[REORDER_WIN_SIZE
];
2373 struct rtllib_rxb
*stats_IndicateArray
[REORDER_WIN_SIZE
];
2374 struct rtllib_rxb
*prxbIndicateArray
[REORDER_WIN_SIZE
];
2376 struct sw_chnl_cmd PreCommonCmd
[MAX_PRECMD_CNT
];
2377 struct sw_chnl_cmd PostCommonCmd
[MAX_POSTCMD_CNT
];
2378 struct sw_chnl_cmd RfDependCmd
[MAX_RFDEPENDCMD_CNT
];
2382 /* Callback functions */
2383 void (*set_security
)(struct net_device
*dev
,
2384 struct rtllib_security
*sec
);
2386 /* Used to TX data frame by using txb structs.
2387 * this is not used if in the softmac_features
2388 * is set the flag IEEE_SOFTMAC_TX_QUEUE
2390 int (*hard_start_xmit
)(struct rtllib_txb
*txb
,
2391 struct net_device
*dev
);
2393 int (*reset_port
)(struct net_device
*dev
);
2394 int (*is_queue_full
)(struct net_device
*dev
, int pri
);
2396 int (*handle_management
)(struct net_device
*dev
,
2397 struct rtllib_network
*network
, u16 type
);
2398 int (*is_qos_active
)(struct net_device
*dev
, struct sk_buff
*skb
);
2400 /* Softmac-generated frames (mamagement) are TXed via this
2401 * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
2402 * not set. As some cards may have different HW queues that
2403 * one might want to use for data and management frames
2404 * the option to have two callbacks might be useful.
2405 * This fucntion can't sleep.
2407 int (*softmac_hard_start_xmit
)(struct sk_buff
*skb
,
2408 struct net_device
*dev
);
2410 /* used instead of hard_start_xmit (not softmac_hard_start_xmit)
2411 * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
2412 * frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
2413 * then also management frames are sent via this callback.
2414 * This function can't sleep.
2416 void (*softmac_data_hard_start_xmit
)(struct sk_buff
*skb
,
2417 struct net_device
*dev
, int rate
);
2419 /* stops the HW queue for DATA frames. Useful to avoid
2420 * waste time to TX data frame when we are reassociating
2421 * This function can sleep.
2423 void (*data_hard_stop
)(struct net_device
*dev
);
2425 /* OK this is complementar to data_poll_hard_stop */
2426 void (*data_hard_resume
)(struct net_device
*dev
);
2428 /* ask to the driver to retune the radio .
2429 * This function can sleep. the driver should ensure
2430 * the radio has been swithced before return.
2432 void (*set_chan
)(struct net_device
*dev
, short ch
);
2434 /* These are not used if the ieee stack takes care of
2435 * scanning (IEEE_SOFTMAC_SCAN feature set).
2436 * In this case only the set_chan is used.
2438 * The syncro version is similar to the start_scan but
2439 * does not return until all channels has been scanned.
2440 * this is called in user context and should sleep,
2441 * it is called in a work_queue when swithcing to ad-hoc mode
2442 * or in behalf of iwlist scan when the card is associated
2443 * and root user ask for a scan.
2444 * the fucntion stop_scan should stop both the syncro and
2445 * background scanning and can sleep.
2446 * The fucntion start_scan should initiate the background
2447 * scanning and can't sleep.
2449 void (*scan_syncro
)(struct net_device
*dev
);
2450 void (*start_scan
)(struct net_device
*dev
);
2451 void (*stop_scan
)(struct net_device
*dev
);
2453 void (*rtllib_start_hw_scan
)(struct net_device
*dev
);
2454 void (*rtllib_stop_hw_scan
)(struct net_device
*dev
);
2456 /* indicate the driver that the link state is changed
2457 * for example it may indicate the card is associated now.
2458 * Driver might be interested in this to apply RX filter
2459 * rules or simply light the LINK led
2461 void (*link_change
)(struct net_device
*dev
);
2463 /* these two function indicates to the HW when to start
2464 * and stop to send beacons. This is used when the
2465 * IEEE_SOFTMAC_BEACONS is not set. For now the
2466 * stop_send_bacons is NOT guaranteed to be called only
2467 * after start_send_beacons.
2469 void (*start_send_beacons
)(struct net_device
*dev
);
2470 void (*stop_send_beacons
)(struct net_device
*dev
);
2472 /* power save mode related */
2473 void (*sta_wake_up
)(struct net_device
*dev
);
2474 void (*enter_sleep_state
)(struct net_device
*dev
, u64 time
);
2475 short (*ps_is_queue_empty
)(struct net_device
*dev
);
2476 int (*handle_beacon
)(struct net_device
*dev
,
2477 struct rtllib_beacon
*beacon
,
2478 struct rtllib_network
*network
);
2479 int (*handle_assoc_response
)(struct net_device
*dev
,
2480 struct rtllib_assoc_response_frame
*resp
,
2481 struct rtllib_network
*network
);
2484 /* check whether Tx hw resouce available */
2485 short (*check_nic_enough_desc
)(struct net_device
*dev
, int queue_index
);
2486 short (*get_nic_desc_num
)(struct net_device
*dev
, int queue_index
);
2487 void (*SetBWModeHandler
)(struct net_device
*dev
,
2488 enum ht_channel_width Bandwidth
,
2489 enum ht_extchnl_offset Offset
);
2490 bool (*GetNmodeSupportBySecCfg
)(struct net_device
*dev
);
2491 void (*SetWirelessMode
)(struct net_device
*dev
, u8 wireless_mode
);
2492 bool (*GetHalfNmodeSupportByAPsHandler
)(struct net_device
*dev
);
2493 u8 (*rtllib_ap_sec_type
)(struct rtllib_device
*ieee
);
2494 void (*HalUsbRxAggrHandler
)(struct net_device
*dev
, bool Value
);
2495 void (*InitialGainHandler
)(struct net_device
*dev
, u8 Operation
);
2496 bool (*SetFwCmdHandler
)(struct net_device
*dev
,
2497 enum fw_cmd_io_type FwCmdIO
);
2498 void (*UpdateHalRAMaskHandler
)(struct net_device
*dev
, bool bMulticast
,
2499 u8 macId
, u8 MimoPs
, u8 WirelessMode
,
2500 u8 bCurTxBW40MHz
, u8 rssi_level
);
2501 void (*UpdateBeaconInterruptHandler
)(struct net_device
*dev
,
2503 void (*UpdateInterruptMaskHandler
)(struct net_device
*dev
, u32 AddMSR
,
2505 u16 (*rtl_11n_user_show_rates
)(struct net_device
*dev
);
2506 void (*ScanOperationBackupHandler
)(struct net_device
*dev
,
2508 void (*LedControlHandler
)(struct net_device
*dev
,
2509 enum led_ctl_mode LedAction
);
2510 void (*SetHwRegHandler
)(struct net_device
*dev
, u8 variable
, u8
*val
);
2511 void (*GetHwRegHandler
)(struct net_device
*dev
, u8 variable
, u8
*val
);
2513 void (*AllowAllDestAddrHandler
)(struct net_device
*dev
,
2514 bool bAllowAllDA
, bool WriteIntoReg
);
2516 void (*rtllib_ips_leave_wq
) (struct net_device
*dev
);
2517 void (*rtllib_ips_leave
)(struct net_device
*dev
);
2518 void (*LeisurePSLeave
)(struct net_device
*dev
);
2519 void (*rtllib_rfkill_poll
)(struct net_device
*dev
);
2521 /* This must be the last item so that it points to the data
2522 * allocated beyond this structure by alloc_rtllib */
2526 #define IEEE_A (1<<0)
2527 #define IEEE_B (1<<1)
2528 #define IEEE_G (1<<2)
2529 #define IEEE_N_24G (1<<4)
2530 #define IEEE_N_5G (1<<5)
2531 #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G)
2533 /* Generate a 802.11 header */
2535 /* Uses the channel change callback directly
2536 * instead of [start/stop] scan callbacks
2538 #define IEEE_SOFTMAC_SCAN (1<<2)
2540 /* Perform authentication and association handshake */
2541 #define IEEE_SOFTMAC_ASSOCIATE (1<<3)
2543 /* Generate probe requests */
2544 #define IEEE_SOFTMAC_PROBERQ (1<<4)
2546 /* Generate respones to probe requests */
2547 #define IEEE_SOFTMAC_PROBERS (1<<5)
2549 /* The ieee802.11 stack will manages the netif queue
2550 * wake/stop for the driver, taking care of 802.11
2551 * fragmentation. See softmac.c for details. */
2552 #define IEEE_SOFTMAC_TX_QUEUE (1<<7)
2554 /* Uses only the softmac_data_hard_start_xmit
2555 * even for TX management frames.
2557 #define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
2559 /* Generate beacons. The stack will enqueue beacons
2562 #define IEEE_SOFTMAC_BEACONS (1<<6)
2565 static inline void *rtllib_priv(struct net_device
*dev
)
2567 return ((struct rtllib_device
*)netdev_priv(dev
))->priv
;
2570 extern inline int rtllib_is_empty_essid(const char *essid
, int essid_len
)
2572 /* Single white space is for Linksys APs */
2573 if (essid_len
== 1 && essid
[0] == ' ')
2576 /* Otherwise, if the entire essid is 0, we assume it is hidden */
2579 if (essid
[essid_len
] != '\0')
2586 extern inline int rtllib_is_valid_mode(struct rtllib_device
*ieee
, int mode
)
2589 * It is possible for both access points and our device to support
2590 * combinations of modes, so as long as there is one valid combination
2591 * of ap/device supported modes, then return success
2594 if ((mode
& IEEE_A
) &&
2595 (ieee
->modulation
& RTLLIB_OFDM_MODULATION
) &&
2596 (ieee
->freq_band
& RTLLIB_52GHZ_BAND
))
2599 if ((mode
& IEEE_G
) &&
2600 (ieee
->modulation
& RTLLIB_OFDM_MODULATION
) &&
2601 (ieee
->freq_band
& RTLLIB_24GHZ_BAND
))
2604 if ((mode
& IEEE_B
) &&
2605 (ieee
->modulation
& RTLLIB_CCK_MODULATION
) &&
2606 (ieee
->freq_band
& RTLLIB_24GHZ_BAND
))
2612 extern inline int rtllib_get_hdrlen(u16 fc
)
2614 int hdrlen
= RTLLIB_3ADDR_LEN
;
2616 switch (WLAN_FC_GET_TYPE(fc
)) {
2617 case RTLLIB_FTYPE_DATA
:
2618 if ((fc
& RTLLIB_FCTL_FROMDS
) && (fc
& RTLLIB_FCTL_TODS
))
2619 hdrlen
= RTLLIB_4ADDR_LEN
; /* Addr4 */
2620 if (RTLLIB_QOS_HAS_SEQ(fc
))
2621 hdrlen
+= 2; /* QOS ctrl*/
2623 case RTLLIB_FTYPE_CTL
:
2624 switch (WLAN_FC_GET_STYPE(fc
)) {
2625 case RTLLIB_STYPE_CTS
:
2626 case RTLLIB_STYPE_ACK
:
2627 hdrlen
= RTLLIB_1ADDR_LEN
;
2630 hdrlen
= RTLLIB_2ADDR_LEN
;
2639 static inline u8
*rtllib_get_payload(struct rtllib_hdr
*hdr
)
2641 switch (rtllib_get_hdrlen(le16_to_cpu(hdr
->frame_ctl
))) {
2642 case RTLLIB_1ADDR_LEN
:
2643 return ((struct rtllib_hdr_1addr
*)hdr
)->payload
;
2644 case RTLLIB_2ADDR_LEN
:
2645 return ((struct rtllib_hdr_2addr
*)hdr
)->payload
;
2646 case RTLLIB_3ADDR_LEN
:
2647 return ((struct rtllib_hdr_3addr
*)hdr
)->payload
;
2648 case RTLLIB_4ADDR_LEN
:
2649 return ((struct rtllib_hdr_4addr
*)hdr
)->payload
;
2654 static inline int rtllib_is_ofdm_rate(u8 rate
)
2656 switch (rate
& ~RTLLIB_BASIC_RATE_MASK
) {
2657 case RTLLIB_OFDM_RATE_6MB
:
2658 case RTLLIB_OFDM_RATE_9MB
:
2659 case RTLLIB_OFDM_RATE_12MB
:
2660 case RTLLIB_OFDM_RATE_18MB
:
2661 case RTLLIB_OFDM_RATE_24MB
:
2662 case RTLLIB_OFDM_RATE_36MB
:
2663 case RTLLIB_OFDM_RATE_48MB
:
2664 case RTLLIB_OFDM_RATE_54MB
:
2670 static inline int rtllib_is_cck_rate(u8 rate
)
2672 switch (rate
& ~RTLLIB_BASIC_RATE_MASK
) {
2673 case RTLLIB_CCK_RATE_1MB
:
2674 case RTLLIB_CCK_RATE_2MB
:
2675 case RTLLIB_CCK_RATE_5MB
:
2676 case RTLLIB_CCK_RATE_11MB
:
2684 extern void free_rtllib(struct net_device
*dev
);
2685 extern struct net_device
*alloc_rtllib(int sizeof_priv
);
2687 extern int rtllib_set_encryption(struct rtllib_device
*ieee
);
2691 extern int rtllib_encrypt_fragment(
2692 struct rtllib_device
*ieee
,
2693 struct sk_buff
*frag
,
2696 extern int rtllib_xmit(struct sk_buff
*skb
, struct net_device
*dev
);
2697 extern int rtllib_xmit_inter(struct sk_buff
*skb
, struct net_device
*dev
);
2698 extern void rtllib_txb_free(struct rtllib_txb
*);
2701 extern int rtllib_rx(struct rtllib_device
*ieee
, struct sk_buff
*skb
,
2702 struct rtllib_rx_stats
*rx_stats
);
2703 extern void rtllib_rx_mgt(struct rtllib_device
*ieee
,
2704 struct sk_buff
*skb
,
2705 struct rtllib_rx_stats
*stats
);
2706 extern void rtllib_rx_probe_rq(struct rtllib_device
*ieee
,
2707 struct sk_buff
*skb
);
2708 extern int rtllib_legal_channel(struct rtllib_device
*rtllib
, u8 channel
);
2711 extern int rtllib_wx_get_scan(struct rtllib_device
*ieee
,
2712 struct iw_request_info
*info
,
2713 union iwreq_data
*wrqu
, char *key
);
2714 extern int rtllib_wx_set_encode(struct rtllib_device
*ieee
,
2715 struct iw_request_info
*info
,
2716 union iwreq_data
*wrqu
, char *key
);
2717 extern int rtllib_wx_get_encode(struct rtllib_device
*ieee
,
2718 struct iw_request_info
*info
,
2719 union iwreq_data
*wrqu
, char *key
);
2720 #if WIRELESS_EXT >= 18
2721 extern int rtllib_wx_get_encode_ext(struct rtllib_device
*ieee
,
2722 struct iw_request_info
*info
,
2723 union iwreq_data
*wrqu
, char *extra
);
2724 extern int rtllib_wx_set_encode_ext(struct rtllib_device
*ieee
,
2725 struct iw_request_info
*info
,
2726 union iwreq_data
*wrqu
, char *extra
);
2728 extern int rtllib_wx_set_auth(struct rtllib_device
*ieee
,
2729 struct iw_request_info
*info
,
2730 struct iw_param
*data
, char *extra
);
2731 extern int rtllib_wx_set_mlme(struct rtllib_device
*ieee
,
2732 struct iw_request_info
*info
,
2733 union iwreq_data
*wrqu
, char *extra
);
2734 extern int rtllib_wx_set_gen_ie(struct rtllib_device
*ieee
, u8
*ie
, size_t len
);
2736 /* rtllib_softmac.c */
2737 extern short rtllib_is_54g(struct rtllib_network
*net
);
2738 extern short rtllib_is_shortslot(const struct rtllib_network
*net
);
2739 extern int rtllib_rx_frame_softmac(struct rtllib_device
*ieee
,
2740 struct sk_buff
*skb
,
2741 struct rtllib_rx_stats
*rx_stats
, u16 type
,
2743 extern void rtllib_softmac_new_net(struct rtllib_device
*ieee
,
2744 struct rtllib_network
*net
);
2746 void SendDisassociation(struct rtllib_device
*ieee
, bool deauth
, u16 asRsn
);
2747 extern void rtllib_softmac_xmit(struct rtllib_txb
*txb
,
2748 struct rtllib_device
*ieee
);
2750 extern void rtllib_stop_send_beacons(struct rtllib_device
*ieee
);
2751 extern void notify_wx_assoc_event(struct rtllib_device
*ieee
);
2752 extern void rtllib_softmac_check_all_nets(struct rtllib_device
*ieee
);
2753 extern void rtllib_start_bss(struct rtllib_device
*ieee
);
2754 extern void rtllib_start_master_bss(struct rtllib_device
*ieee
);
2755 extern void rtllib_start_ibss(struct rtllib_device
*ieee
);
2756 extern void rtllib_softmac_init(struct rtllib_device
*ieee
);
2757 extern void rtllib_softmac_free(struct rtllib_device
*ieee
);
2758 extern void rtllib_associate_abort(struct rtllib_device
*ieee
);
2759 extern void rtllib_disassociate(struct rtllib_device
*ieee
);
2760 extern void rtllib_stop_scan(struct rtllib_device
*ieee
);
2761 extern bool rtllib_act_scanning(struct rtllib_device
*ieee
, bool sync_scan
);
2762 extern void rtllib_stop_scan_syncro(struct rtllib_device
*ieee
);
2763 extern void rtllib_start_scan_syncro(struct rtllib_device
*ieee
, u8 is_mesh
);
2764 extern inline struct sk_buff
*rtllib_probe_req(struct rtllib_device
*ieee
);
2765 extern u8
MgntQuery_MgntFrameTxRate(struct rtllib_device
*ieee
);
2766 extern void rtllib_sta_ps_send_null_frame(struct rtllib_device
*ieee
,
2768 extern void rtllib_sta_wakeup(struct rtllib_device
*ieee
, short nl
);
2769 extern void rtllib_sta_ps_send_pspoll_frame(struct rtllib_device
*ieee
);
2770 extern void rtllib_check_all_nets(struct rtllib_device
*ieee
);
2771 extern void rtllib_start_protocol(struct rtllib_device
*ieee
);
2772 extern void rtllib_stop_protocol(struct rtllib_device
*ieee
, u8 shutdown
);
2774 extern void rtllib_EnableNetMonitorMode(struct net_device
*dev
,
2776 extern void rtllib_DisableNetMonitorMode(struct net_device
*dev
,
2778 extern void rtllib_EnableIntelPromiscuousMode(struct net_device
*dev
,
2780 extern void rtllib_DisableIntelPromiscuousMode(struct net_device
*dev
,
2782 extern void rtllib_send_probe_requests(struct rtllib_device
*ieee
, u8 is_mesh
);
2784 extern void rtllib_softmac_stop_protocol(struct rtllib_device
*ieee
,
2785 u8 mesh_flag
, u8 shutdown
);
2786 extern void rtllib_softmac_start_protocol(struct rtllib_device
*ieee
,
2789 extern void rtllib_reset_queue(struct rtllib_device
*ieee
);
2790 extern void rtllib_wake_queue(struct rtllib_device
*ieee
);
2791 extern void rtllib_stop_queue(struct rtllib_device
*ieee
);
2792 extern void rtllib_wake_all_queues(struct rtllib_device
*ieee
);
2793 extern void rtllib_stop_all_queues(struct rtllib_device
*ieee
);
2794 extern struct sk_buff
*rtllib_get_beacon(struct rtllib_device
*ieee
);
2795 extern void rtllib_start_send_beacons(struct rtllib_device
*ieee
);
2796 extern void rtllib_stop_send_beacons(struct rtllib_device
*ieee
);
2797 extern int rtllib_wpa_supplicant_ioctl(struct rtllib_device
*ieee
,
2798 struct iw_point
*p
, u8 is_mesh
);
2800 extern void notify_wx_assoc_event(struct rtllib_device
*ieee
);
2801 extern void rtllib_ps_tx_ack(struct rtllib_device
*ieee
, short success
);
2803 extern void softmac_mgmt_xmit(struct sk_buff
*skb
,
2804 struct rtllib_device
*ieee
);
2805 extern u16
rtllib_query_seqnum(struct rtllib_device
*ieee
,
2806 struct sk_buff
*skb
, u8
*dst
);
2807 extern u8
rtllib_ap_sec_type(struct rtllib_device
*ieee
);
2809 /* rtllib_crypt_ccmp&tkip&wep.c */
2810 extern void rtllib_tkip_null(void);
2811 extern void rtllib_wep_null(void);
2812 extern void rtllib_ccmp_null(void);
2814 /* rtllib_softmac_wx.c */
2816 extern int rtllib_wx_get_wap(struct rtllib_device
*ieee
,
2817 struct iw_request_info
*info
,
2818 union iwreq_data
*wrqu
, char *ext
);
2820 extern int rtllib_wx_set_wap(struct rtllib_device
*ieee
,
2821 struct iw_request_info
*info
,
2822 union iwreq_data
*awrq
,
2825 extern int rtllib_wx_get_essid(struct rtllib_device
*ieee
,
2826 struct iw_request_info
*a
,
2827 union iwreq_data
*wrqu
, char *b
);
2829 extern int rtllib_wx_set_rate(struct rtllib_device
*ieee
,
2830 struct iw_request_info
*info
,
2831 union iwreq_data
*wrqu
, char *extra
);
2833 extern int rtllib_wx_get_rate(struct rtllib_device
*ieee
,
2834 struct iw_request_info
*info
,
2835 union iwreq_data
*wrqu
, char *extra
);
2837 extern int rtllib_wx_set_mode(struct rtllib_device
*ieee
,
2838 struct iw_request_info
*a
,
2839 union iwreq_data
*wrqu
, char *b
);
2841 extern int rtllib_wx_set_scan(struct rtllib_device
*ieee
,
2842 struct iw_request_info
*a
,
2843 union iwreq_data
*wrqu
, char *b
);
2845 extern int rtllib_wx_set_essid(struct rtllib_device
*ieee
,
2846 struct iw_request_info
*a
,
2847 union iwreq_data
*wrqu
, char *extra
);
2849 extern int rtllib_wx_get_mode(struct rtllib_device
*ieee
,
2850 struct iw_request_info
*a
,
2851 union iwreq_data
*wrqu
, char *b
);
2853 extern int rtllib_wx_set_freq(struct rtllib_device
*ieee
,
2854 struct iw_request_info
*a
,
2855 union iwreq_data
*wrqu
, char *b
);
2857 extern int rtllib_wx_get_freq(struct rtllib_device
*ieee
,
2858 struct iw_request_info
*a
,
2859 union iwreq_data
*wrqu
, char *b
);
2860 extern void rtllib_wx_sync_scan_wq(void *data
);
2862 extern int rtllib_wx_set_rawtx(struct rtllib_device
*ieee
,
2863 struct iw_request_info
*info
,
2864 union iwreq_data
*wrqu
, char *extra
);
2866 extern int rtllib_wx_get_name(struct rtllib_device
*ieee
,
2867 struct iw_request_info
*info
,
2868 union iwreq_data
*wrqu
, char *extra
);
2870 extern int rtllib_wx_set_power(struct rtllib_device
*ieee
,
2871 struct iw_request_info
*info
,
2872 union iwreq_data
*wrqu
, char *extra
);
2874 extern int rtllib_wx_get_power(struct rtllib_device
*ieee
,
2875 struct iw_request_info
*info
,
2876 union iwreq_data
*wrqu
, char *extra
);
2878 extern int rtllib_wx_set_rts(struct rtllib_device
*ieee
,
2879 struct iw_request_info
*info
,
2880 union iwreq_data
*wrqu
, char *extra
);
2882 extern int rtllib_wx_get_rts(struct rtllib_device
*ieee
,
2883 struct iw_request_info
*info
,
2884 union iwreq_data
*wrqu
, char *extra
);
2885 #define MAX_RECEIVE_BUFFER_SIZE 9100
2886 extern void HTDebugHTCapability(u8
*CapIE
, u8
*TitleString
);
2887 extern void HTDebugHTInfo(u8
*InfoIE
, u8
*TitleString
);
2889 void HTSetConnectBwMode(struct rtllib_device
*ieee
,
2890 enum ht_channel_width Bandwidth
,
2891 enum ht_extchnl_offset Offset
);
2892 extern void HTUpdateDefaultSetting(struct rtllib_device
*ieee
);
2893 extern void HTConstructCapabilityElement(struct rtllib_device
*ieee
,
2894 u8
*posHTCap
, u8
*len
,
2895 u8 isEncrypt
, bool bAssoc
);
2896 extern void HTConstructInfoElement(struct rtllib_device
*ieee
,
2897 u8
*posHTInfo
, u8
*len
, u8 isEncrypt
);
2898 extern void HTConstructRT2RTAggElement(struct rtllib_device
*ieee
,
2899 u8
*posRT2RTAgg
, u8
* len
);
2900 extern void HTOnAssocRsp(struct rtllib_device
*ieee
);
2901 extern void HTInitializeHTInfo(struct rtllib_device
*ieee
);
2902 extern void HTInitializeBssDesc(struct bss_ht
*pBssHT
);
2903 extern void HTResetSelfAndSavePeerSetting(struct rtllib_device
*ieee
,
2904 struct rtllib_network
*pNetwork
);
2905 extern void HT_update_self_and_peer_setting(struct rtllib_device
*ieee
,
2906 struct rtllib_network
*pNetwork
);
2907 extern u8
HTGetHighestMCSRate(struct rtllib_device
*ieee
, u8
*pMCSRateSet
,
2909 extern u8 MCS_FILTER_ALL
[];
2910 extern u16 MCS_DATA_RATE
[2][2][77] ;
2911 extern u8
HTCCheck(struct rtllib_device
*ieee
, u8
*pFrame
);
2912 extern void HTResetIOTSetting(struct rt_hi_throughput
*pHTInfo
);
2913 extern bool IsHTHalfNmodeAPs(struct rtllib_device
*ieee
);
2914 extern u16
HTHalfMcsToDataRate(struct rtllib_device
*ieee
, u8 nMcsRate
);
2915 extern u16
HTMcsToDataRate(struct rtllib_device
*ieee
, u8 nMcsRate
);
2916 extern u16
TxCountToDataRate(struct rtllib_device
*ieee
, u8 nDataRate
);
2917 extern int rtllib_rx_ADDBAReq(struct rtllib_device
*ieee
, struct sk_buff
*skb
);
2918 extern int rtllib_rx_ADDBARsp(struct rtllib_device
*ieee
, struct sk_buff
*skb
);
2919 extern int rtllib_rx_DELBA(struct rtllib_device
*ieee
, struct sk_buff
*skb
);
2920 extern void TsInitAddBA(struct rtllib_device
*ieee
, struct tx_ts_record
*pTS
,
2921 u8 Policy
, u8 bOverwritePending
);
2922 extern void TsInitDelBA(struct rtllib_device
*ieee
,
2923 struct ts_common_info
*pTsCommonInfo
,
2924 enum tr_select TxRxSelect
);
2925 extern void BaSetupTimeOut(unsigned long data
);
2926 extern void TxBaInactTimeout(unsigned long data
);
2927 extern void RxBaInactTimeout(unsigned long data
);
2928 extern void ResetBaEntry(struct ba_record
*pBA
);
2930 struct rtllib_device
*ieee
,
2931 struct ts_common_info
**ppTS
,
2934 enum tr_select TxRxSelect
,
2937 extern void TSInitialize(struct rtllib_device
*ieee
);
2938 extern void TsStartAddBaProcess(struct rtllib_device
*ieee
,
2939 struct tx_ts_record
*pTxTS
);
2940 extern void RemovePeerTS(struct rtllib_device
*ieee
, u8
*Addr
);
2941 extern void RemoveAllTS(struct rtllib_device
*ieee
);
2942 void rtllib_softmac_scan_syncro(struct rtllib_device
*ieee
, u8 is_mesh
);
2944 extern const long rtllib_wlan_frequencies
[];
2946 extern inline void rtllib_increment_scans(struct rtllib_device
*ieee
)
2951 extern inline int rtllib_get_scans(struct rtllib_device
*ieee
)
2956 static inline const char *escape_essid(const char *essid
, u8 essid_len
)
2958 static char escaped
[IW_ESSID_MAX_SIZE
* 2 + 1];
2959 const char *s
= essid
;
2962 if (rtllib_is_empty_essid(essid
, essid_len
)) {
2963 memcpy(escaped
, "<hidden>", sizeof("<hidden>"));
2967 essid_len
= min(essid_len
, (u8
)IW_ESSID_MAX_SIZE
);
2968 while (essid_len
--) {
2981 #define CONVERT_RATE(_ieee, _MGN_RATE) \
2982 ((_MGN_RATE < MGN_MCS0) ? (_MGN_RATE) : \
2983 (HTMcsToDataRate(_ieee, (u8)_MGN_RATE)))
2985 /* fun with the built-in rtllib stack... */
2986 bool rtllib_MgntDisconnect(struct rtllib_device
*rtllib
, u8 asRsn
);
2989 /* For the function is more related to hardware setting, it's better to use the
2990 * ieee handler to refer to it.
2992 extern void rtllib_update_active_chan_map(struct rtllib_device
*ieee
);
2993 extern void rtllib_FlushRxTsPendingPkts(struct rtllib_device
*ieee
,
2994 struct rx_ts_record
*pTS
);
2995 extern int rtllib_data_xmit(struct sk_buff
*skb
, struct net_device
*dev
);
2996 extern int rtllib_parse_info_param(struct rtllib_device
*ieee
,
2997 struct rtllib_info_element
*info_element
,
2999 struct rtllib_network
*network
,
3000 struct rtllib_rx_stats
*stats
);
3002 void rtllib_indicate_packets(struct rtllib_device
*ieee
,
3003 struct rtllib_rxb
**prxbIndicateArray
, u8 index
);
3004 extern u8
HTFilterMCSRate(struct rtllib_device
*ieee
, u8
*pSupportMCS
,
3006 extern void HTUseDefaultSetting(struct rtllib_device
*ieee
);
3007 #define RT_ASOC_RETRY_LIMIT 5
3008 u8
MgntQuery_TxRateExcludeCCKRates(struct rtllib_device
*ieee
);
3009 extern void rtllib_TURBO_Info(struct rtllib_device
*ieee
, u8
**tag_p
);
3010 #ifndef ENABLE_LOCK_DEBUG
3011 #define SPIN_LOCK_IEEE(plock) spin_lock_irqsave((plock), flags)
3012 #define SPIN_UNLOCK_IEEE(plock) spin_unlock_irqrestore((plock), flags)
3013 #define SPIN_LOCK_IEEE_REORDER(plock) spin_lock_irqsave((plock), flags)
3014 #define SPIN_UNLOCK_IEEE_REORDER(plock) spin_unlock_irqrestore((plock), flags)
3015 #define SPIN_LOCK_IEEE_WPAX(plock) spin_lock_irqsave((plock), flags)
3016 #define SPIN_UNLOCK_IEEE_WPAX(plock) spin_unlock_irqrestore((plock), flags)
3017 #define SPIN_LOCK_IEEE_MGNTTX(plock) spin_lock_irqsave((plock), flags)
3018 #define SPIN_UNLOCK_IEEE_MGNTTX(plock) spin_unlock_irqrestore((plock), flags)
3019 #define SPIN_LOCK_IEEE_BCN(plock) spin_lock_irqsave((plock), flags)
3020 #define SPIN_UNLOCK_IEEE_BCN(plock) spin_unlock_irqrestore((plock), flags)
3021 #define SPIN_LOCK_MSH_STAINFO(plock) spin_lock_irqsave((plock), flags)
3022 #define SPIN_UNLOCK_MSH_STAINFO(plock) spin_unlock_irqrestore((plock), flags)
3023 #define SPIN_LOCK_MSH_PREQ(plock) spin_lock_irqsave((plock), flags)
3024 #define SPIN_UNLOCK_MSH_PREQ(plock) spin_unlock_irqrestore((plock), flags)
3025 #define SPIN_LOCK_MSH_QUEUE(plock) spin_lock_irqsave((plock), flags)
3026 #define SPIN_UNLOCK_MSH_QUEUE(plock) spin_unlock_irqrestore((plock), flags)
3027 #define SPIN_LOCK_PRIV_RFPS(plock) spin_lock_irqsave((plock), flags)
3028 #define SPIN_UNLOCK_PRIV_RFPS(plock) spin_unlock_irqrestore((plock), flags)
3029 #define SPIN_LOCK_PRIV_IRQTH(plock) spin_lock_irqsave((plock), flags)
3030 #define SPIN_UNLOCK_PRIV_IRQTH(plock) spin_unlock_irqrestore((plock), flags)
3031 #define SPIN_LOCK_PRIV_TX(plock) spin_lock_irqsave((plock), flags)
3032 #define SPIN_UNLOCK_PRIV_TX(plock) spin_unlock_irqrestore((plock), flags)
3033 #define SPIN_LOCK_PRIV_D3(plock) spin_lock_irqsave((plock), flags)
3034 #define SPIN_UNLOCK_PRIV_D3(plock) spin_unlock_irqrestore((plock), flags)
3035 #define SPIN_LOCK_PRIV_RF(plock) spin_lock_irqsave((plock), flags)
3036 #define SPIN_UNLOCK_PRIV_RF(plock) spin_unlock_irqrestore((plock), flags)
3037 #define SPIN_LOCK_PRIV_PS(plock) spin_lock_irqsave((plock), flags)
3038 #define SPIN_UNLOCK_PRIV_PS(plock) spin_unlock_irqrestore((plock), flags)
3039 #define SEM_DOWN_IEEE_WX(psem) down(psem)
3040 #define SEM_UP_IEEE_WX(psem) up(psem)
3041 #define SEM_DOWN_IEEE_SCAN(psem) down(psem)
3042 #define SEM_UP_IEEE_SCAN(psem) up(psem)
3043 #define SEM_DOWN_IEEE_IPS(psem) down(psem)
3044 #define SEM_UP_IEEE_IPS(psem) up(psem)
3045 #define SEM_DOWN_PRIV_WX(psem) down(psem)
3046 #define SEM_UP_PRIV_WX(psem) up(psem)
3047 #define SEM_DOWN_PRIV_RF(psem) down(psem)
3048 #define SEM_UP_PRIV_RF(psem) up(psem)
3049 #define MUTEX_LOCK_PRIV(pmutex) mutex_lock(pmutex)
3050 #define MUTEX_UNLOCK_PRIV(pmutex) mutex_unlock(pmutex)
3053 #endif /* RTLLIB_H */