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
264 enum hal_def_variable {
267 HAL_DEF_PROT_IMP_MODE,
268 HAL_DEF_HIGH_POWER_MECHANISM,
269 HAL_DEF_RATE_ADAPTIVE_MECHANISM,
270 HAL_DEF_ANTENNA_DIVERSITY_MECHANISM,
276 HAL_DEF_MIN_TX_POWER_DBM,
277 HAL_DEF_MAX_TX_POWER_DBM,
278 HW_DEF_EFUSE_REPG_SECTION1_FLAG,
279 HW_DEF_EFUSE_REPG_DATA,
281 HAL_DEF_PCI_SUPPORT_ASPM,
282 HAL_DEF_THERMAL_VALUE,
283 HAL_DEF_USB_IN_TOKEN_REV,
288 HW_VAR_MULTICAST_REG,
292 HW_VAR_SECURITY_CONF,
293 HW_VAR_BEACON_INTERVAL,
295 HW_VAR_LISTEN_INTERVAL,
308 HW_VAR_RATE_FALLBACK_CONTROL,
309 HW_VAR_CONTENTION_WINDOW,
314 HW_VAR_AMPDU_MIN_SPACE,
315 HW_VAR_SHORTGI_DENSITY,
317 HW_VAR_MCS_RATE_AVAILABLE,
320 HW_VAR_DIS_Req_Qsize,
321 HW_VAR_CCX_CHNL_LOAD,
322 HW_VAR_CCX_NOISE_HISTOGRAM,
329 HW_VAR_SET_DEV_POWER,
339 HW_VAR_USER_CONTROL_TURBO_MODE,
345 HW_VAR_AUTOLOAD_STATUS,
346 HW_VAR_RF_2R_DISABLE,
348 HW_VAR_H2C_FW_PWRMODE,
349 HW_VAR_H2C_FW_JOINBSSRPT,
350 HW_VAR_1X1_RECV_COMBINE,
351 HW_VAR_STOP_SEND_BEACON,
356 HW_VAR_H2C_FW_UPDATE_GTK,
359 HW_VAR_WF_IS_MAC_ADDR,
360 HW_VAR_H2C_FW_OFFLOAD,
363 HW_VAR_HANDLE_FW_C2H,
364 HW_VAR_DL_FW_RSVD_PAGE,
366 HW_VAR_HW_SEQ_ENABLE,
371 HW_VAR_SWITCH_EPHY_WoWLAN,
372 HW_VAR_INT_MIGRATION,
379 RT_OP_MODE_INFRASTRUCTURE,
386 (((priv->rtllib->current_network.mode == IEEE_A) \
387 || (priv->rtllib->current_network.mode == IEEE_N_24G) \
388 || (priv->rtllib->current_network.mode == IEEE_N_5G)) ? 16 : 10)
390 #define MGMT_QUEUE_NUM 5
392 #define IEEE_CMD_SET_WPA_PARAM 1
393 #define IEEE_CMD_SET_WPA_IE 2
394 #define IEEE_CMD_SET_ENCRYPTION 3
395 #define IEEE_CMD_MLME 4
397 #define IEEE_PARAM_WPA_ENABLED 1
398 #define IEEE_PARAM_TKIP_COUNTERMEASURES 2
399 #define IEEE_PARAM_DROP_UNENCRYPTED 3
400 #define IEEE_PARAM_PRIVACY_INVOKED 4
401 #define IEEE_PARAM_AUTH_ALGS 5
402 #define IEEE_PARAM_IEEE_802_1X 6
403 #define IEEE_PARAM_WPAX_SELECT 7
404 #define IEEE_PROTO_WPA 1
405 #define IEEE_PROTO_RSN 2
406 #define IEEE_WPAX_USEGROUP 0
407 #define IEEE_WPAX_WEP40 1
408 #define IEEE_WPAX_TKIP 2
409 #define IEEE_WPAX_WRAP 3
410 #define IEEE_WPAX_CCMP 4
411 #define IEEE_WPAX_WEP104 5
413 #define IEEE_KEY_MGMT_IEEE8021X 1
414 #define IEEE_KEY_MGMT_PSK 2
416 #define IEEE_MLME_STA_DEAUTH 1
417 #define IEEE_MLME_STA_DISASSOC 2
420 #define IEEE_CRYPT_ERR_UNKNOWN_ALG 2
421 #define IEEE_CRYPT_ERR_UNKNOWN_ADDR 3
422 #define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4
423 #define IEEE_CRYPT_ERR_KEY_SET_FAILED 5
424 #define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6
425 #define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7
426 #define IEEE_CRYPT_ALG_NAME_LEN 16
428 #define MAX_IE_LEN 0xff
432 u8 sta_addr[ETH_ALEN];
448 u8 alg[IEEE_CRYPT_ALG_NAME_LEN];
452 u8 seq[8]; /* sequence counter (set: RX, get: TX) */
460 #if WIRELESS_EXT < 17
461 #define IW_QUAL_QUAL_INVALID 0x10
462 #define IW_QUAL_LEVEL_INVALID 0x20
463 #define IW_QUAL_NOISE_INVALID 0x40
464 #define IW_QUAL_QUAL_UPDATED 0x1
465 #define IW_QUAL_LEVEL_UPDATED 0x2
466 #define IW_QUAL_NOISE_UPDATED 0x4
469 #define msleep_interruptible_rsl msleep_interruptible
471 #define RTLLIB_DATA_LEN 2304
472 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
475 * The figure in section 7.1.2 suggests a body size of up to 2312
476 * bytes is allowed, which is a bit confusing, I suspect this
477 * represents the 2304 bytes of real data, plus a possible 8 bytes of
478 * WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro)
480 #define RTLLIB_1ADDR_LEN 10
481 #define RTLLIB_2ADDR_LEN 16
482 #define RTLLIB_3ADDR_LEN 24
483 #define RTLLIB_4ADDR_LEN 30
484 #define RTLLIB_FCS_LEN 4
485 #define RTLLIB_HLEN (RTLLIB_4ADDR_LEN)
486 #define RTLLIB_FRAME_LEN (RTLLIB_DATA_LEN + RTLLIB_HLEN)
487 #define RTLLIB_MGMT_HDR_LEN 24
488 #define RTLLIB_DATA_HDR3_LEN 24
489 #define RTLLIB_DATA_HDR4_LEN 30
491 #define RTLLIB_SKBBUFFER_SIZE 2500
493 #define MIN_FRAG_THRESHOLD 256U
494 #define MAX_FRAG_THRESHOLD 2346U
495 #define MAX_HT_DATA_FRAG_THRESHOLD 0x2000
497 #define HT_AMSDU_SIZE_4K 3839
498 #define HT_AMSDU_SIZE_8K 7935
500 /* Frame control field constants */
501 #define RTLLIB_FCTL_VERS 0x0003
502 #define RTLLIB_FCTL_FTYPE 0x000c
503 #define RTLLIB_FCTL_STYPE 0x00f0
504 #define RTLLIB_FCTL_FRAMETYPE 0x00fc
505 #define RTLLIB_FCTL_TODS 0x0100
506 #define RTLLIB_FCTL_FROMDS 0x0200
507 #define RTLLIB_FCTL_DSTODS 0x0300
508 #define RTLLIB_FCTL_MOREFRAGS 0x0400
509 #define RTLLIB_FCTL_RETRY 0x0800
510 #define RTLLIB_FCTL_PM 0x1000
511 #define RTLLIB_FCTL_MOREDATA 0x2000
512 #define RTLLIB_FCTL_WEP 0x4000
513 #define RTLLIB_FCTL_ORDER 0x8000
515 #define RTLLIB_FTYPE_MGMT 0x0000
516 #define RTLLIB_FTYPE_CTL 0x0004
517 #define RTLLIB_FTYPE_DATA 0x0008
520 #define RTLLIB_STYPE_ASSOC_REQ 0x0000
521 #define RTLLIB_STYPE_ASSOC_RESP 0x0010
522 #define RTLLIB_STYPE_REASSOC_REQ 0x0020
523 #define RTLLIB_STYPE_REASSOC_RESP 0x0030
524 #define RTLLIB_STYPE_PROBE_REQ 0x0040
525 #define RTLLIB_STYPE_PROBE_RESP 0x0050
526 #define RTLLIB_STYPE_BEACON 0x0080
527 #define RTLLIB_STYPE_ATIM 0x0090
528 #define RTLLIB_STYPE_DISASSOC 0x00A0
529 #define RTLLIB_STYPE_AUTH 0x00B0
530 #define RTLLIB_STYPE_DEAUTH 0x00C0
531 #define RTLLIB_STYPE_MANAGE_ACT 0x00D0
534 #define RTLLIB_STYPE_PSPOLL 0x00A0
535 #define RTLLIB_STYPE_RTS 0x00B0
536 #define RTLLIB_STYPE_CTS 0x00C0
537 #define RTLLIB_STYPE_ACK 0x00D0
538 #define RTLLIB_STYPE_CFEND 0x00E0
539 #define RTLLIB_STYPE_CFENDACK 0x00F0
540 #define RTLLIB_STYPE_BLOCKACK 0x0094
543 #define RTLLIB_STYPE_DATA 0x0000
544 #define RTLLIB_STYPE_DATA_CFACK 0x0010
545 #define RTLLIB_STYPE_DATA_CFPOLL 0x0020
546 #define RTLLIB_STYPE_DATA_CFACKPOLL 0x0030
547 #define RTLLIB_STYPE_NULLFUNC 0x0040
548 #define RTLLIB_STYPE_CFACK 0x0050
549 #define RTLLIB_STYPE_CFPOLL 0x0060
550 #define RTLLIB_STYPE_CFACKPOLL 0x0070
551 #define RTLLIB_STYPE_QOS_DATA 0x0080
552 #define RTLLIB_STYPE_QOS_NULL 0x00C0
554 #define RTLLIB_SCTL_FRAG 0x000F
555 #define RTLLIB_SCTL_SEQ 0xFFF0
558 #define RTLLIB_QCTL_TID 0x000F
560 #define FC_QOS_BIT BIT7
561 #define IsDataFrame(pdu) (((pdu[0] & 0x0C) == 0x08) ? true : false)
562 #define IsLegacyDataFrame(pdu) (IsDataFrame(pdu) && (!(pdu[0]&FC_QOS_BIT)))
563 #define IsQoSDataFrame(pframe) \
564 ((*(u16 *)pframe&(RTLLIB_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA)) == \
565 (RTLLIB_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA))
566 #define Frame_Order(pframe) (*(u16 *)pframe&RTLLIB_FCTL_ORDER)
567 #define SN_LESS(a, b) (((a-b)&0x800) != 0)
568 #define SN_EQUAL(a, b) (a == b)
569 #define MAX_DEV_ADDR_SIZE 8
592 enum init_gain_op_type {
599 LED_CTL_POWER_ON = 1,
604 LED_CTL_SITE_SURVEY = 6,
605 LED_CTL_POWER_OFF = 7,
606 LED_CTL_START_TO_LINK = 8,
607 LED_CTL_START_WPS = 9,
608 LED_CTL_STOP_WPS = 10,
609 LED_CTL_START_WPS_BOTTON = 11,
610 LED_CTL_STOP_WPS_FAIL = 12,
611 LED_CTL_STOP_WPS_FAIL_OVERLAP = 13,
614 enum rt_rf_type_def {
624 WIRELESS_MODE_UNKNOWN = 0x00,
625 WIRELESS_MODE_A = 0x01,
626 WIRELESS_MODE_B = 0x02,
627 WIRELESS_MODE_G = 0x04,
628 WIRELESS_MODE_AUTO = 0x08,
629 WIRELESS_MODE_N_24G = 0x10,
630 WIRELESS_MODE_N_5G = 0x20
633 enum wireless_network_type {
640 #define OUI_SUBTYPE_WMM_INFO 0
641 #define OUI_SUBTYPE_WMM_PARAM 1
642 #define OUI_SUBTYPE_QOS_CAPABI 5
645 extern u32 rtllib_debug_level;
646 #define RTLLIB_DEBUG(level, fmt, args...) \
648 if (rtllib_debug_level & (level)) \
649 printk(KERN_DEBUG "rtllib: " fmt, ## args); \
652 #define RTLLIB_DEBUG_DATA(level, data, datalen) \
654 if ((rtllib_debug_level & (level)) == (level)) { \
655 printk(KERN_DEBUG "rtllib: %s()\n", __func__); \
656 print_hex_dump_bytes(KERN_DEBUG, DUMP_PREFIX_NONE, \
661 /* To use the debug system;
663 * If you are defining a new debug classification, simply add it to the #define
664 * list here in the form of:
666 * #define RTLLIB_DL_xxxx VALUE
668 * shifting value to the left one bit from the previous entry. xxxx should be
669 * the name of the classification (for example, WEP)
671 * You then need to either add a RTLLIB_xxxx_DEBUG() macro definition for your
672 * classification, or use RTLLIB_DEBUG(RTLLIB_DL_xxxx, ...) whenever you want
673 * to send output to that classification.
675 * To add your debug level to the list of levels seen when you perform
677 * % cat /proc/net/ipw/debug_level
679 * you simply need to add your entry to the ipw_debug_levels array.
682 #define RTLLIB_DL_INFO (1<<0)
683 #define RTLLIB_DL_WX (1<<1)
684 #define RTLLIB_DL_SCAN (1<<2)
685 #define RTLLIB_DL_STATE (1<<3)
686 #define RTLLIB_DL_MGMT (1<<4)
687 #define RTLLIB_DL_FRAG (1<<5)
688 #define RTLLIB_DL_EAP (1<<6)
689 #define RTLLIB_DL_DROP (1<<7)
691 #define RTLLIB_DL_TX (1<<8)
692 #define RTLLIB_DL_RX (1<<9)
694 #define RTLLIB_DL_HT (1<<10)
695 #define RTLLIB_DL_BA (1<<11)
696 #define RTLLIB_DL_TS (1<<12)
697 #define RTLLIB_DL_QOS (1<<13)
698 #define RTLLIB_DL_REORDER (1<<14)
699 #define RTLLIB_DL_IOT (1<<15)
700 #define RTLLIB_DL_IPS (1<<16)
701 #define RTLLIB_DL_TRACE (1<<29)
702 #define RTLLIB_DL_DATA (1<<30)
703 #define RTLLIB_DL_ERR (1<<31)
706 #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
707 #define ETH_P_IP 0x0800 /* Internet Protocol packet */
708 #define ETH_P_ARP 0x0806 /* Address Resolution packet */
709 #endif /* ETH_P_PAE */
711 #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
713 #ifndef ETH_P_80211_RAW
714 #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
717 /* IEEE 802.11 defines */
719 #define P80211_OUI_LEN 3
721 struct rtllib_snap_hdr {
723 u8 dsap; /* always 0xAA */
724 u8 ssap; /* always 0xAA */
725 u8 ctrl; /* always 0x03 */
726 u8 oui[P80211_OUI_LEN]; /* organizational universal id */
730 enum _REG_PREAMBLE_MODE {
736 #define SNAP_SIZE sizeof(struct rtllib_snap_hdr)
738 #define WLAN_FC_GET_VERS(fc) ((fc) & RTLLIB_FCTL_VERS)
739 #define WLAN_FC_GET_TYPE(fc) ((fc) & RTLLIB_FCTL_FTYPE)
740 #define WLAN_FC_GET_STYPE(fc) ((fc) & RTLLIB_FCTL_STYPE)
741 #define WLAN_FC_MORE_DATA(fc) ((fc) & RTLLIB_FCTL_MOREDATA)
743 #define WLAN_FC_GET_FRAMETYPE(fc) ((fc) & RTLLIB_FCTL_FRAMETYPE)
744 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & RTLLIB_SCTL_FRAG)
745 #define WLAN_GET_SEQ_SEQ(seq) (((seq) & RTLLIB_SCTL_SEQ) >> 4)
747 /* Authentication algorithms */
748 #define WLAN_AUTH_OPEN 0
749 #define WLAN_AUTH_SHARED_KEY 1
750 #define WLAN_AUTH_LEAP 128
752 #define WLAN_AUTH_CHALLENGE_LEN 128
754 #define WLAN_CAPABILITY_ESS (1<<0)
755 #define WLAN_CAPABILITY_IBSS (1<<1)
756 #define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
757 #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
758 #define WLAN_CAPABILITY_PRIVACY (1<<4)
759 #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
760 #define WLAN_CAPABILITY_PBCC (1<<6)
761 #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
762 #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
763 #define WLAN_CAPABILITY_QOS (1<<9)
764 #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
765 #define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
767 /* 802.11g ERP information element */
768 #define WLAN_ERP_NON_ERP_PRESENT (1<<0)
769 #define WLAN_ERP_USE_PROTECTION (1<<1)
770 #define WLAN_ERP_BARKER_PREAMBLE (1<<2)
772 #define RTLLIB_STATMASK_SIGNAL (1<<0)
773 #define RTLLIB_STATMASK_RSSI (1<<1)
774 #define RTLLIB_STATMASK_NOISE (1<<2)
775 #define RTLLIB_STATMASK_RATE (1<<3)
776 #define RTLLIB_STATMASK_WEMASK 0x7
778 #define RTLLIB_CCK_MODULATION (1<<0)
779 #define RTLLIB_OFDM_MODULATION (1<<1)
781 #define RTLLIB_24GHZ_BAND (1<<0)
782 #define RTLLIB_52GHZ_BAND (1<<1)
784 #define RTLLIB_CCK_RATE_LEN 4
785 #define RTLLIB_CCK_RATE_1MB 0x02
786 #define RTLLIB_CCK_RATE_2MB 0x04
787 #define RTLLIB_CCK_RATE_5MB 0x0B
788 #define RTLLIB_CCK_RATE_11MB 0x16
789 #define RTLLIB_OFDM_RATE_LEN 8
790 #define RTLLIB_OFDM_RATE_6MB 0x0C
791 #define RTLLIB_OFDM_RATE_9MB 0x12
792 #define RTLLIB_OFDM_RATE_12MB 0x18
793 #define RTLLIB_OFDM_RATE_18MB 0x24
794 #define RTLLIB_OFDM_RATE_24MB 0x30
795 #define RTLLIB_OFDM_RATE_36MB 0x48
796 #define RTLLIB_OFDM_RATE_48MB 0x60
797 #define RTLLIB_OFDM_RATE_54MB 0x6C
798 #define RTLLIB_BASIC_RATE_MASK 0x80
800 #define RTLLIB_CCK_RATE_1MB_MASK (1<<0)
801 #define RTLLIB_CCK_RATE_2MB_MASK (1<<1)
802 #define RTLLIB_CCK_RATE_5MB_MASK (1<<2)
803 #define RTLLIB_CCK_RATE_11MB_MASK (1<<3)
804 #define RTLLIB_OFDM_RATE_6MB_MASK (1<<4)
805 #define RTLLIB_OFDM_RATE_9MB_MASK (1<<5)
806 #define RTLLIB_OFDM_RATE_12MB_MASK (1<<6)
807 #define RTLLIB_OFDM_RATE_18MB_MASK (1<<7)
808 #define RTLLIB_OFDM_RATE_24MB_MASK (1<<8)
809 #define RTLLIB_OFDM_RATE_36MB_MASK (1<<9)
810 #define RTLLIB_OFDM_RATE_48MB_MASK (1<<10)
811 #define RTLLIB_OFDM_RATE_54MB_MASK (1<<11)
813 #define RTLLIB_CCK_RATES_MASK 0x0000000F
814 #define RTLLIB_CCK_BASIC_RATES_MASK (RTLLIB_CCK_RATE_1MB_MASK | \
815 RTLLIB_CCK_RATE_2MB_MASK)
816 #define RTLLIB_CCK_DEFAULT_RATES_MASK (RTLLIB_CCK_BASIC_RATES_MASK | \
817 RTLLIB_CCK_RATE_5MB_MASK | \
818 RTLLIB_CCK_RATE_11MB_MASK)
820 #define RTLLIB_OFDM_RATES_MASK 0x00000FF0
821 #define RTLLIB_OFDM_BASIC_RATES_MASK (RTLLIB_OFDM_RATE_6MB_MASK | \
822 RTLLIB_OFDM_RATE_12MB_MASK | \
823 RTLLIB_OFDM_RATE_24MB_MASK)
824 #define RTLLIB_OFDM_DEFAULT_RATES_MASK (RTLLIB_OFDM_BASIC_RATES_MASK | \
825 RTLLIB_OFDM_RATE_9MB_MASK | \
826 RTLLIB_OFDM_RATE_18MB_MASK | \
827 RTLLIB_OFDM_RATE_36MB_MASK | \
828 RTLLIB_OFDM_RATE_48MB_MASK | \
829 RTLLIB_OFDM_RATE_54MB_MASK)
830 #define RTLLIB_DEFAULT_RATES_MASK (RTLLIB_OFDM_DEFAULT_RATES_MASK | \
831 RTLLIB_CCK_DEFAULT_RATES_MASK)
833 #define RTLLIB_NUM_OFDM_RATES 8
834 #define RTLLIB_NUM_CCK_RATES 4
835 #define RTLLIB_OFDM_SHIFT_MASK_A 4
838 /* this is stolen and modified from the madwifi driver*/
839 #define RTLLIB_FC0_TYPE_MASK 0x0c
840 #define RTLLIB_FC0_TYPE_DATA 0x08
841 #define RTLLIB_FC0_SUBTYPE_MASK 0xB0
842 #define RTLLIB_FC0_SUBTYPE_QOS 0x80
844 #define RTLLIB_QOS_HAS_SEQ(fc) \
845 (((fc) & (RTLLIB_FC0_TYPE_MASK | RTLLIB_FC0_SUBTYPE_MASK)) == \
846 (RTLLIB_FC0_TYPE_DATA | RTLLIB_FC0_SUBTYPE_QOS))
848 /* this is stolen from ipw2200 driver */
849 #define IEEE_IBSS_MAC_HASH_SIZE 31
850 struct ieee_ibss_seq {
854 unsigned long packet_time[17];
855 struct list_head list;
858 /* NOTE: This data is for statistical purposes; not all hardware provides this
859 * information for frames received. Not setting these will not cause
860 * any adverse affects. */
861 struct rtllib_rx_stats {
866 u16 rate; /* in 100 kbps */
883 u16 bShortPreamble:1;
900 bool RxIs40MHzPacket;
902 u8 RxMIMOSignalStrength[4];
903 s8 RxMIMOSignalQuality[2];
904 bool bPacketMatchBSSID;
912 bool bisrxaggrsubframe;
915 char cck_adc_pwdb[4];
920 /* IEEE 802.11 requires that STA supports concurrent reception of at least
921 * three fragmented frames. This define can be increased to support more
922 * concurrent frames, but it should be noted that each entry can consume about
923 * 2 kB of RAM and increasing cache size will slow down frame reassembly.
925 #define RTLLIB_FRAG_CACHE_LEN 4
927 struct rtllib_frag_entry {
928 unsigned long first_frag_time;
930 unsigned int last_frag;
932 u8 src_addr[ETH_ALEN];
933 u8 dst_addr[ETH_ALEN];
936 struct rtllib_stats {
937 unsigned int tx_unicast_frames;
938 unsigned int tx_multicast_frames;
939 unsigned int tx_fragments;
940 unsigned int tx_unicast_octets;
941 unsigned int tx_multicast_octets;
942 unsigned int tx_deferred_transmissions;
943 unsigned int tx_single_retry_frames;
944 unsigned int tx_multiple_retry_frames;
945 unsigned int tx_retry_limit_exceeded;
946 unsigned int tx_discards;
947 unsigned int rx_unicast_frames;
948 unsigned int rx_multicast_frames;
949 unsigned int rx_fragments;
950 unsigned int rx_unicast_octets;
951 unsigned int rx_multicast_octets;
952 unsigned int rx_fcs_errors;
953 unsigned int rx_discards_no_buffer;
954 unsigned int tx_discards_wrong_sa;
955 unsigned int rx_discards_undecryptable;
956 unsigned int rx_message_in_msg_fragments;
957 unsigned int rx_message_in_bad_msg_fragments;
960 struct rtllib_device;
962 #define SEC_KEY_1 (1<<0)
963 #define SEC_KEY_2 (1<<1)
964 #define SEC_KEY_3 (1<<2)
965 #define SEC_KEY_4 (1<<3)
966 #define SEC_ACTIVE_KEY (1<<4)
967 #define SEC_AUTH_MODE (1<<5)
968 #define SEC_UNICAST_GROUP (1<<6)
969 #define SEC_LEVEL (1<<7)
970 #define SEC_ENABLED (1<<8)
971 #define SEC_ENCRYPT (1<<9)
973 #define SEC_LEVEL_0 0 /* None */
974 #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
975 #define SEC_LEVEL_2 2 /* Level 1 + TKIP */
976 #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
977 #define SEC_LEVEL_3 4 /* Level 2 + CCMP */
979 #define SEC_ALG_NONE 0
980 #define SEC_ALG_WEP 1
981 #define SEC_ALG_TKIP 2
982 #define SEC_ALG_CCMP 4
984 #define WEP_KEY_LEN 13
985 #define SCM_KEY_LEN 32
986 #define SCM_TEMPORAL_KEY_LENGTH 16
988 struct rtllib_security {
993 unicast_uses_group:1,
995 u8 key_sizes[NUM_WEP_KEYS];
996 u8 keys[NUM_WEP_KEYS][SCM_KEY_LEN];
1002 /* 802.11 data frame from AP
1003 * ,-------------------------------------------------------------------.
1004 * Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
1005 * |------|------|---------|---------|---------|------|---------|------|
1006 * Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
1007 * | | tion | (BSSID) | | | ence | data | |
1008 * `-------------------------------------------------------------------'
1009 * Total: 28-2340 bytes
1012 /* Management Frame Information Element Types */
1015 MFIE_TYPE_RATES = 1,
1016 MFIE_TYPE_FH_SET = 2,
1017 MFIE_TYPE_DS_SET = 3,
1018 MFIE_TYPE_CF_SET = 4,
1020 MFIE_TYPE_IBSS_SET = 6,
1021 MFIE_TYPE_COUNTRY = 7,
1022 MFIE_TYPE_HOP_PARAMS = 8,
1023 MFIE_TYPE_HOP_TABLE = 9,
1024 MFIE_TYPE_REQUEST = 10,
1025 MFIE_TYPE_CHALLENGE = 16,
1026 MFIE_TYPE_POWER_CONSTRAINT = 32,
1027 MFIE_TYPE_POWER_CAPABILITY = 33,
1028 MFIE_TYPE_TPC_REQUEST = 34,
1029 MFIE_TYPE_TPC_REPORT = 35,
1030 MFIE_TYPE_SUPP_CHANNELS = 36,
1032 MFIE_TYPE_MEASURE_REQUEST = 38,
1033 MFIE_TYPE_MEASURE_REPORT = 39,
1034 MFIE_TYPE_QUIET = 40,
1035 MFIE_TYPE_IBSS_DFS = 41,
1037 MFIE_TYPE_HT_CAP = 45,
1039 MFIE_TYPE_RATES_EX = 50,
1040 MFIE_TYPE_HT_INFO = 61,
1041 MFIE_TYPE_AIRONET = 133,
1042 MFIE_TYPE_GENERIC = 221,
1043 MFIE_TYPE_QOS_PARAMETER = 222,
1046 /* Minimal header; can be used for passing 802.11 frames with sufficient
1047 * information to determine what type of underlying data type is actually
1048 * stored in the data.
1050 struct rtllib_pspoll_hdr {
1063 struct rtllib_hdr_1addr {
1070 struct rtllib_hdr_2addr {
1078 struct rtllib_hdr_3addr {
1088 struct rtllib_hdr_4addr {
1099 struct rtllib_hdr_3addrqos {
1110 struct rtllib_hdr_4addrqos {
1122 struct rtllib_info_element {
1128 struct rtllib_authentication {
1129 struct rtllib_hdr_3addr header;
1134 struct rtllib_info_element info_element[0];
1137 struct rtllib_disauth {
1138 struct rtllib_hdr_3addr header;
1142 struct rtllib_disassoc {
1143 struct rtllib_hdr_3addr header;
1147 struct rtllib_probe_request {
1148 struct rtllib_hdr_3addr header;
1149 /* SSID, supported rates */
1150 struct rtllib_info_element info_element[0];
1153 struct rtllib_probe_response {
1154 struct rtllib_hdr_3addr header;
1156 __le16 beacon_interval;
1158 /* SSID, supported rates, FH params, DS params,
1159 * CF params, IBSS params, TIM (if beacon), RSN
1161 struct rtllib_info_element info_element[0];
1164 /* Alias beacon for probe_response */
1165 #define rtllib_beacon rtllib_probe_response
1167 struct rtllib_assoc_request_frame {
1168 struct rtllib_hdr_3addr header;
1170 __le16 listen_interval;
1171 /* SSID, supported rates, RSN */
1172 struct rtllib_info_element info_element[0];
1175 struct rtllib_reassoc_request_frame {
1176 struct rtllib_hdr_3addr header;
1178 __le16 listen_interval;
1179 u8 current_ap[ETH_ALEN];
1180 /* SSID, supported rates, RSN */
1181 struct rtllib_info_element info_element[0];
1184 struct rtllib_assoc_response_frame {
1185 struct rtllib_hdr_3addr header;
1189 struct rtllib_info_element info_element[0]; /* supported rates */
1199 __le16 payload_size;
1200 struct sk_buff *fragments[0];
1203 #define MAX_TX_AGG_COUNT 16
1204 struct rtllib_drv_agg_txb {
1205 u8 nr_drv_agg_frames;
1206 struct sk_buff *tx_agg_frames[MAX_TX_AGG_COUNT];
1209 #define MAX_SUBFRAME_COUNT 64
1212 struct sk_buff *subframes[MAX_SUBFRAME_COUNT];
1229 /* SWEEP TABLE ENTRIES NUMBER*/
1230 #define MAX_SWEEP_TAB_ENTRIES 42
1231 #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
1232 /* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
1233 * only use 8, and then use extended rates for the remaining supported
1234 * rates. Other APs, however, stick all of their supported rates on the
1235 * main rates information element...
1237 #define MAX_RATES_LENGTH ((u8)12)
1238 #define MAX_RATES_EX_LENGTH ((u8)16)
1239 #define MAX_NETWORK_COUNT 96
1241 #define MAX_CHANNEL_NUMBER 161
1242 #define RTLLIB_SOFTMAC_SCAN_TIME 100
1243 #define RTLLIB_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2)
1245 #define CRC_LENGTH 4U
1247 #define MAX_WPA_IE_LEN 64
1248 #define MAX_WZC_IE_LEN 256
1250 #define NETWORK_EMPTY_ESSID (1<<0)
1251 #define NETWORK_HAS_OFDM (1<<1)
1252 #define NETWORK_HAS_CCK (1<<2)
1255 #define NETWORK_HAS_QOS_PARAMETERS (1<<3)
1256 #define NETWORK_HAS_QOS_INFORMATION (1<<4)
1257 #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \
1258 NETWORK_HAS_QOS_INFORMATION)
1260 #define NETWORK_HAS_POWER_CONSTRAINT (1<<5)
1261 #define NETWORK_HAS_CSA (1<<6)
1262 #define NETWORK_HAS_QUIET (1<<7)
1263 #define NETWORK_HAS_IBSS_DFS (1<<8)
1264 #define NETWORK_HAS_TPC_REPORT (1<<9)
1266 #define NETWORK_HAS_ERP_VALUE (1<<10)
1268 #define QOS_QUEUE_NUM 4
1269 #define QOS_OUI_LEN 3
1270 #define QOS_OUI_TYPE 2
1271 #define QOS_ELEMENT_ID 221
1272 #define QOS_OUI_INFO_SUB_TYPE 0
1273 #define QOS_OUI_PARAM_SUB_TYPE 1
1274 #define QOS_VERSION_1 1
1275 #define QOS_AIFSN_MIN_VALUE 2
1277 struct rtllib_qos_information_element {
1280 u8 qui[QOS_OUI_LEN];
1287 struct rtllib_qos_ac_parameter {
1293 struct rtllib_qos_parameter_info {
1294 struct rtllib_qos_information_element info_element;
1296 struct rtllib_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
1299 struct rtllib_qos_parameters {
1300 __le16 cw_min[QOS_QUEUE_NUM];
1301 __le16 cw_max[QOS_QUEUE_NUM];
1302 u8 aifs[QOS_QUEUE_NUM];
1303 u8 flag[QOS_QUEUE_NUM];
1304 __le16 tx_op_limit[QOS_QUEUE_NUM];
1307 struct rtllib_qos_data {
1308 struct rtllib_qos_parameters parameters;
1309 unsigned int wmm_acm;
1316 struct rtllib_tim_parameters {
1321 struct rtllib_wmm_ac_param {
1322 u8 ac_aci_acm_aifsn;
1323 u8 ac_ecwmin_ecwmax;
1327 struct rtllib_wmm_ts_info {
1333 struct rtllib_wmm_tspec_elem {
1334 struct rtllib_wmm_ts_info ts_info;
1341 u32 serv_start_time;
1348 u16 surp_band_allow;
1357 EAPOL_ENCAP_ASF_ALERT
1360 static const char * const eap_types[] = {
1361 [EAP_PACKET] = "EAP-Packet",
1362 [EAPOL_START] = "EAPOL-Start",
1363 [EAPOL_LOGOFF] = "EAPOL-Logoff",
1364 [EAPOL_KEY] = "EAPOL-Key",
1365 [EAPOL_ENCAP_ASF_ALERT] = "EAPOL-Encap-ASF-Alert"
1368 static inline const char *eap_get_type(int type)
1370 return ((u32)type >= ARRAY_SIZE(eap_types)) ? "Unknown" :
1373 static inline u8 Frame_QoSTID(u8 *buf)
1375 struct rtllib_hdr_3addr *hdr;
1378 hdr = (struct rtllib_hdr_3addr *)buf;
1379 fc = le16_to_cpu(hdr->frame_ctl);
1380 return (u8)((union frameqos *)(buf + (((fc & RTLLIB_FCTL_TODS) &&
1381 (fc & RTLLIB_FCTL_FROMDS)) ? 30 : 24)))->field.tid;
1393 struct rtllib_softmac_stats {
1394 unsigned int rx_ass_ok;
1395 unsigned int rx_ass_err;
1396 unsigned int rx_probe_rq;
1397 unsigned int tx_probe_rs;
1398 unsigned int tx_beacons;
1399 unsigned int rx_auth_rq;
1400 unsigned int rx_auth_rs_ok;
1401 unsigned int rx_auth_rs_err;
1402 unsigned int tx_auth_rq;
1403 unsigned int no_auth_rs;
1404 unsigned int no_ass_rs;
1405 unsigned int tx_ass_rq;
1406 unsigned int rx_ass_rq;
1407 unsigned int tx_probe_rq;
1408 unsigned int reassoc;
1409 unsigned int swtxstop;
1410 unsigned int swtxawake;
1411 unsigned char CurrentShowTxate;
1412 unsigned char last_packet_rate;
1413 unsigned int txretrycount;
1416 #define BEACON_PROBE_SSID_ID_POSITION 12
1418 struct rtllib_info_element_hdr {
1423 /* These are the data types that can make up management packets
1425 * u16 auth_algorithm;
1426 * u16 auth_sequence;
1427 * u16 beacon_interval;
1429 * u8 current_ap[ETH_ALEN];
1430 * u16 listen_interval;
1432 * u16 association_id:14, reserved:2;
1434 * u32 time_stamp[2];
1439 #define RTLLIB_DEFAULT_TX_ESSID "Penguin"
1440 #define RTLLIB_DEFAULT_BASIC_RATE 2
1442 enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame};
1443 #define MAX_SP_Len (WMM_all_frame << 4)
1444 #define RTLLIB_QOS_TID 0x0f
1445 #define QOS_CTL_NOTCONTAIN_ACK (0x01 << 5)
1447 #define RTLLIB_DTIM_MBCAST 4
1448 #define RTLLIB_DTIM_UCAST 2
1449 #define RTLLIB_DTIM_VALID 1
1450 #define RTLLIB_DTIM_INVALID 0
1452 #define RTLLIB_PS_DISABLED 0
1453 #define RTLLIB_PS_UNICAST RTLLIB_DTIM_UCAST
1454 #define RTLLIB_PS_MBCAST RTLLIB_DTIM_MBCAST
1456 #define WME_AC_BK 0x00
1457 #define WME_AC_BE 0x01
1458 #define WME_AC_VI 0x02
1459 #define WME_AC_VO 0x03
1460 #define WME_ACI_MASK 0x03
1461 #define WME_AIFSN_MASK 0x03
1462 #define WME_AC_PRAM_LEN 16
1464 #define MAX_RECEIVE_BUFFER_SIZE 9100
1466 #define UP2AC(up) ( \
1467 ((up) < 1) ? WME_AC_BE : \
1468 ((up) < 3) ? WME_AC_BK : \
1469 ((up) < 4) ? WME_AC_BE : \
1470 ((up) < 6) ? WME_AC_VI : \
1473 #define AC2UP(_ac) ( \
1474 ((_ac) == WME_AC_VO) ? 6 : \
1475 ((_ac) == WME_AC_VI) ? 5 : \
1476 ((_ac) == WME_AC_BK) ? 1 : \
1479 #define ETHER_ADDR_LEN 6 /* length of an Ethernet address */
1480 #define ETHERNET_HEADER_SIZE 14 /* length of two Ethernet address
1483 struct ether_header {
1484 u8 ether_dhost[ETHER_ADDR_LEN];
1485 u8 ether_shost[ETHER_ADDR_LEN];
1489 #ifndef ETHERTYPE_PAE
1490 #define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */
1492 #ifndef ETHERTYPE_IP
1493 #define ETHERTYPE_IP 0x0800 /* IP protocol */
1498 ERP_NonERPpresent = 0x01,
1499 ERP_UseProtection = 0x02,
1500 ERP_BarkerPreambleMode = 0x04,
1503 struct rtllib_network {
1504 /* These entries are used to identify a unique network */
1507 /* Ensure null-terminated for any debug msgs */
1508 u8 ssid[IW_ESSID_MAX_SIZE + 1];
1510 u8 hidden_ssid[IW_ESSID_MAX_SIZE + 1];
1512 struct rtllib_qos_data qos_data;
1514 bool bWithAironetIE;
1515 bool bCkipSupported;
1520 u8 MBssid[ETH_ALEN];
1521 bool bWithCcxVerNum;
1523 /* These are network statistics */
1524 struct rtllib_rx_stats stats;
1526 u8 rates[MAX_RATES_LENGTH];
1528 u8 rates_ex[MAX_RATES_EX_LENGTH];
1530 unsigned long last_scanned;
1535 u16 beacon_interval;
1536 u16 listen_interval;
1539 u8 wpa_ie[MAX_WPA_IE_LEN];
1541 u8 rsn_ie[MAX_WPA_IE_LEN];
1543 u8 wzc_ie[MAX_WZC_IE_LEN];
1546 struct rtllib_tim_parameters tim;
1549 u64 last_dtim_sta_time;
1552 struct rtllib_wmm_ac_param wmm_param[4];
1555 u8 CountryIeBuf[MAX_IE_LEN];
1556 struct bss_ht bssht;
1557 bool broadcom_cap_exist;
1558 bool realtek_cap_exit;
1559 bool marvell_cap_exist;
1560 bool ralink_cap_exist;
1561 bool atheros_cap_exist;
1562 bool cisco_cap_exist;
1563 bool airgo_cap_exist;
1564 bool unknown_cap_exist;
1565 bool berp_info_valid;
1566 bool buseprotection;
1567 bool bIsNetgear854T;
1570 struct list_head list;
1575 /* the card is not linked at all */
1578 /* RTLLIB_ASSOCIATING* are for BSS client mode
1579 * the driver shall not perform RX filtering unless
1580 * the state is LINKED.
1581 * The driver shall just check for the state LINKED and
1582 * defaults to NOLINK for ALL the other states (including
1586 /* the association procedure will start (wq scheduling)*/
1588 RTLLIB_ASSOCIATING_RETRY,
1590 /* the association procedure is sending AUTH request*/
1591 RTLLIB_ASSOCIATING_AUTHENTICATING,
1593 /* the association procedure has successfully authenticated
1594 * and is sending association request
1596 RTLLIB_ASSOCIATING_AUTHENTICATED,
1598 /* the link is ok. the card associated to a BSS or linked
1599 * to a ibss cell or acting as an AP and creating the bss
1603 /* same as LINKED, but the driver shall apply RX filter
1604 * rules as we are in NO_LINK mode. As the card is still
1605 * logically linked, but it is doing a syncro site survey
1606 * then it will be back to LINKED state.
1608 RTLLIB_LINKED_SCANNING,
1611 #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
1612 #define DEFAULT_FTS 2346
1614 #define CFG_RTLLIB_RESERVE_FCS (1<<0)
1615 #define CFG_RTLLIB_COMPUTE_FCS (1<<1)
1616 #define CFG_RTLLIB_RTS (1<<2)
1618 #define RTLLIB_24GHZ_MIN_CHANNEL 1
1619 #define RTLLIB_24GHZ_MAX_CHANNEL 14
1620 #define RTLLIB_24GHZ_CHANNELS (RTLLIB_24GHZ_MAX_CHANNEL - \
1621 RTLLIB_24GHZ_MIN_CHANNEL + 1)
1623 #define RTLLIB_52GHZ_MIN_CHANNEL 34
1624 #define RTLLIB_52GHZ_MAX_CHANNEL 165
1625 #define RTLLIB_52GHZ_CHANNELS (RTLLIB_52GHZ_MAX_CHANNEL - \
1626 RTLLIB_52GHZ_MIN_CHANNEL + 1)
1629 struct rtllib_txb *txb;
1632 struct bandwidth_autoswitch {
1633 long threshold_20Mhzto40Mhz;
1634 long threshold_40Mhzto20Mhz;
1635 bool bforced_tx20Mhz;
1636 bool bautoswitch_enable;
1641 #define REORDER_WIN_SIZE 128
1642 #define REORDER_ENTRY_NUM 128
1643 struct rx_reorder_entry {
1644 struct list_head List;
1646 struct rtllib_rxb *prxb;
1661 enum ips_callback_function {
1662 IPS_CALLBACK_NONE = 0,
1663 IPS_CALLBACK_MGNT_LINK_REQUEST = 1,
1664 IPS_CALLBACK_JOIN_REQUEST = 2,
1667 enum rt_join_action {
1677 #define MAX_NUM_RATES 264
1679 enum rt_rf_power_state {
1685 #define MAX_SUPPORT_WOL_PATTERN_NUM 8
1687 #define MAX_WOL_BIT_MASK_SIZE 16
1688 #define MAX_WOL_PATTERN_SIZE 128
1690 enum wol_pattern_type {
1698 struct rt_pm_wol_info {
1703 enum wol_pattern_type PatternType;
1706 struct rt_pwr_save_ctrl {
1709 bool bIPSModeBackup;
1710 bool bHaltAdapterClkRQ;
1711 bool bSwRfProcessing;
1712 enum rt_rf_power_state eInactivePowerState;
1713 struct work_struct InactivePsWorkItem;
1714 struct timer_list InactivePsTimer;
1716 enum ips_callback_function ReturnPoint;
1719 enum rt_join_action tmpJoinAction;
1720 struct rtllib_network tmpBssDesc;
1723 bool bTmpActiveScan;
1724 bool bTmpFilterHiddenAP;
1725 bool bTmpUpdateParms;
1727 struct octet_string tmpSsid2Scan;
1730 u8 tmpChannelNumber;
1734 struct octet_string tmpSuppRateSet;
1735 u8 tmpSuppRateBuf[MAX_NUM_RATES];
1737 struct ibss_parms tmpIbpm;
1743 u8 RegMaxLPSAwakeIntvl;
1752 bool LinkReqInIPSRFOffPgs;
1753 bool BufConnectinfoBefore;
1761 struct rt_pm_wol_info PmWoLPatternInfo[MAX_SUPPORT_WOL_PATTERN_NUM];
1765 #define RT_RF_CHANGE_SOURCE u32
1767 #define RF_CHANGE_BY_SW BIT31
1768 #define RF_CHANGE_BY_HW BIT30
1769 #define RF_CHANGE_BY_PS BIT29
1770 #define RF_CHANGE_BY_IPS BIT28
1771 #define RF_CHANGE_BY_INIT 0
1773 enum country_code_type {
1774 COUNTRY_CODE_FCC = 0,
1775 COUNTRY_CODE_IC = 1,
1776 COUNTRY_CODE_ETSI = 2,
1777 COUNTRY_CODE_SPAIN = 3,
1778 COUNTRY_CODE_FRANCE = 4,
1779 COUNTRY_CODE_MKK = 5,
1780 COUNTRY_CODE_MKK1 = 6,
1781 COUNTRY_CODE_ISRAEL = 7,
1782 COUNTRY_CODE_TELEC = 8,
1783 COUNTRY_CODE_MIC = 9,
1784 COUNTRY_CODE_GLOBAL_DOMAIN = 10,
1785 COUNTRY_CODE_WORLD_WIDE_13 = 11,
1786 COUNTRY_CODE_TELEC_NETGEAR = 12,
1790 enum scan_op_backup_opt {
1791 SCAN_OPT_BACKUP = 0,
1796 enum fw_cmd_io_type {
1797 FW_CMD_DIG_ENABLE = 0,
1798 FW_CMD_DIG_DISABLE = 1,
1799 FW_CMD_DIG_HALT = 2,
1800 FW_CMD_DIG_RESUME = 3,
1801 FW_CMD_HIGH_PWR_ENABLE = 4,
1802 FW_CMD_HIGH_PWR_DISABLE = 5,
1803 FW_CMD_RA_RESET = 6,
1804 FW_CMD_RA_ACTIVE = 7,
1805 FW_CMD_RA_REFRESH_N = 8,
1806 FW_CMD_RA_REFRESH_BG = 9,
1807 FW_CMD_RA_INIT = 10,
1808 FW_CMD_IQK_ENABLE = 11,
1809 FW_CMD_TXPWR_TRACK_ENABLE = 12,
1810 FW_CMD_TXPWR_TRACK_DISABLE = 13,
1811 FW_CMD_TXPWR_TRACK_THERMAL = 14,
1812 FW_CMD_PAUSE_DM_BY_SCAN = 15,
1813 FW_CMD_RESUME_DM_BY_SCAN = 16,
1814 FW_CMD_RA_REFRESH_N_COMB = 17,
1815 FW_CMD_RA_REFRESH_BG_COMB = 18,
1816 FW_CMD_ANTENNA_SW_ENABLE = 19,
1817 FW_CMD_ANTENNA_SW_DISABLE = 20,
1818 FW_CMD_TX_FEEDBACK_CCX_ENABLE = 21,
1819 FW_CMD_LPS_ENTER = 22,
1820 FW_CMD_LPS_LEAVE = 23,
1821 FW_CMD_DIG_MODE_SS = 24,
1822 FW_CMD_DIG_MODE_FA = 25,
1823 FW_CMD_ADD_A2_ENTRY = 26,
1824 FW_CMD_CTRL_DM_BY_DRIVER = 27,
1825 FW_CMD_CTRL_DM_BY_DRIVER_NEW = 28,
1826 FW_CMD_PAPE_CONTROL = 29,
1827 FW_CMD_CHAN_SET = 30,
1830 #define RT_MAX_LD_SLOT_NUM 10
1831 struct rt_link_detect {
1833 u32 NumRecvBcnInPeriod;
1834 u32 NumRecvDataInPeriod;
1836 u32 RxBcnNum[RT_MAX_LD_SLOT_NUM];
1837 u32 RxDataNum[RT_MAX_LD_SLOT_NUM];
1841 u32 NumTxOkInPeriod;
1842 u32 NumRxOkInPeriod;
1843 u32 NumRxUnicastOkInPeriod;
1845 bool bHigherBusyTraffic;
1846 bool bHigherBusyRxTraffic;
1848 u32 NumTxUnicastOkInPeriod;
1849 u32 LastNumTxUnicast;
1850 u32 LastNumRxUnicast;
1853 struct sw_cam_table {
1855 u8 macaddr[ETH_ALEN];
1863 #define TOTAL_CAM_ENTRY 32
1864 struct rate_adaptive {
1865 u8 rate_adaptive_disabled;
1869 u32 high_rssi_thresh_for_ra;
1870 u32 high2low_rssi_thresh_for_ra;
1871 u8 low2high_rssi_thresh_for_ra40M;
1872 u32 low_rssi_thresh_for_ra40M;
1873 u8 low2high_rssi_thresh_for_ra20M;
1874 u32 low_rssi_thresh_for_ra20M;
1875 u32 upper_rssi_threshold_ratr;
1876 u32 middle_rssi_threshold_ratr;
1877 u32 low_rssi_threshold_ratr;
1878 u32 low_rssi_threshold_ratr_40M;
1879 u32 low_rssi_threshold_ratr_20M;
1880 u8 ping_rssi_enable;
1882 u32 ping_rssi_thresh_for_ra;
1887 enum ratr_table_mode_8192s {
1888 RATR_INX_WIRELESS_NGB = 0,
1889 RATR_INX_WIRELESS_NG = 1,
1890 RATR_INX_WIRELESS_NB = 2,
1891 RATR_INX_WIRELESS_N = 3,
1892 RATR_INX_WIRELESS_GB = 4,
1893 RATR_INX_WIRELESS_G = 5,
1894 RATR_INX_WIRELESS_B = 6,
1895 RATR_INX_WIRELESS_MC = 7,
1896 RATR_INX_WIRELESS_A = 8,
1899 #define NUM_PMKID_CACHE 16
1900 struct rt_pmkid_list {
1909 struct rt_intel_promisc_mode {
1910 bool bPromiscuousOn;
1911 bool bFilterSourceStationFrame;
1915 /*************** DRIVER STATUS *****/
1916 #define STATUS_SCANNING 0
1917 #define STATUS_SCAN_HW 1
1918 #define STATUS_SCAN_ABORTING 2
1919 #define STATUS_SETTING_CHAN 3
1920 /*************** DRIVER STATUS *****/
1932 LPS_WAIT_NULL_DATA_SEND = 2,
1935 struct rtllib_device {
1936 struct pci_dev *pdev;
1937 struct net_device *dev;
1938 struct rtllib_security sec;
1940 bool disable_mgnt_queue;
1942 unsigned long status;
1944 enum ht_extchnl_offset chan_offset_bk;
1945 enum ht_channel_width bandwidth_bk;
1949 enum rt_op_mode OpMode;
1952 /* The last AssocReq/Resp IEs */
1953 u8 *assocreq_ies, *assocresp_ies;
1954 size_t assocreq_ies_len, assocresp_ies_len;
1956 bool b_customer_lenovo_id;
1957 bool bForcedShowRxRate;
1958 bool bForcedShowRateStill;
1959 u8 SystemQueryDataRateCount;
1962 bool b1x1RecvCombine;
1967 bool is_silent_reset;
1968 bool force_mic_error;
1972 bool bSupportRemoteWakeUp;
1973 enum rt_ps_mode dot11PowerSaveMode;
1975 bool FirstIe_InScan;
1976 bool be_scan_inprogress;
1978 enum rt_rf_power_state eRFPowerState;
1979 RT_RF_CHANGE_SOURCE RfOffReason;
1982 struct rt_hi_throughput *pHTInfo;
1983 spinlock_t bw_spinlock;
1985 spinlock_t reorder_spinlock;
1986 u8 Regdot11HTOperationalRateSet[16];
1987 u8 Regdot11TxHTOperationalRateSet[16];
1988 u8 dot11HTOperationalRateSet[16];
1989 u8 RegHTSuppRateSet[16];
1990 u8 HTCurrentOperaRate;
1991 u8 HTHighestOperaRate;
1994 u8 bTxDisableRateFallBack;
1995 u8 bTxUseDriverAssingedRate;
1996 u8 bTxEnableFwCalcDur;
1997 atomic_t atm_chnlop;
2000 struct list_head Tx_TS_Admit_List;
2001 struct list_head Tx_TS_Pending_List;
2002 struct list_head Tx_TS_Unused_List;
2003 struct tx_ts_record TxTsRecord[TOTAL_TS_NUM];
2004 struct list_head Rx_TS_Admit_List;
2005 struct list_head Rx_TS_Pending_List;
2006 struct list_head Rx_TS_Unused_List;
2007 struct rx_ts_record RxTsRecord[TOTAL_TS_NUM];
2008 struct rx_reorder_entry RxReorderEntry[128];
2009 struct list_head RxReorder_Unused_List;
2013 /* Bookkeeping structures */
2014 struct net_device_stats stats;
2015 struct rtllib_stats ieee_stats;
2016 struct rtllib_softmac_stats softmac_stats;
2018 /* Probe / Beacon management */
2019 struct list_head network_free_list;
2020 struct list_head network_list;
2021 struct rtllib_network *networks;
2025 int iw_mode; /* operating mode (IW_MODE_*) */
2026 bool bNetPromiscuousMode;
2027 struct rt_intel_promisc_mode IntelPromiscuousModeInfo;
2029 struct iw_spy_data spy_data;
2032 spinlock_t wpax_suitlist_lock;
2034 int tx_headroom; /* Set to size of any additional room needed at front
2035 * of allocated Tx SKBs
2039 /* WEP and other encryption related settings at the device level */
2040 int open_wep; /* Set to 1 to allow unencrypted frames */
2042 int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
2046 /* If the host performs {en,de}cryption, then set to 1 */
2048 int host_encrypt_msdu;
2050 /* host performs multicast decryption */
2051 int host_mc_decrypt;
2053 /* host should strip IV and ICV from protected frames */
2054 /* meaningful only when hardware decryption is being used */
2055 int host_strip_iv_icv;
2059 int ieee802_1x; /* is IEEE 802.1X used */
2063 bool bHalfWirelessN24GMode;
2065 int drop_unencrypted;
2066 int tkip_countermeasures;
2067 int privacy_invoked;
2072 u8 ap_mac_addr[ETH_ALEN];
2073 u16 pairwise_key_type;
2076 struct lib80211_crypt_info crypt_info;
2078 struct sw_cam_table swcamtable[TOTAL_CAM_ENTRY];
2079 int bcrx_sta_key; /* use individual keys to override default keys even
2080 * with RX of broad/multicast frames */
2082 struct rt_pmkid_list PMKIDList[NUM_PMKID_CACHE];
2084 /* Fragmentation structures */
2085 struct rtllib_frag_entry frag_cache[17][RTLLIB_FRAG_CACHE_LEN];
2086 unsigned int frag_next_idx[17];
2087 u16 fts; /* Fragmentation Threshold */
2088 #define DEFAULT_RTS_THRESHOLD 2346U
2089 #define MIN_RTS_THRESHOLD 1
2090 #define MAX_RTS_THRESHOLD 2346U
2091 u16 rts; /* RTS threshold */
2093 /* Association info */
2096 /* This stores infos for the current network.
2097 * Either the network we are associated in INFRASTRUCTURE
2098 * or the network that we are creating in MASTER mode.
2099 * ad-hoc is a mixture ;-).
2100 * Note that in infrastructure mode, even when not associated,
2101 * fields bssid and essid may be valid (if wpa_set and essid_set
2102 * are true) as thy carry the value set by the user via iwconfig
2104 struct rtllib_network current_network;
2106 enum rtllib_state state;
2110 int mode; /* A, B, G */
2111 int modulation; /* CCK, OFDM */
2112 int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
2113 int abg_true; /* ABG flag */
2115 /* used for forcing the ibss workqueue to terminate
2116 * without wait for the syncro scan to terminate
2118 short sync_scan_hurryup;
2123 u16 prev_seq_ctl; /* used to drop duplicate frames */
2125 /* map of allowed channels. 0 is dummy */
2128 u8 active_channel_map[MAX_CHANNEL_NUMBER+1];
2131 u8 ibss_maxjoin_chal;
2133 int rate; /* current rate */
2139 /* this contains flags for selectively enable softmac support */
2140 u16 softmac_features;
2142 /* if the sequence control field is not filled by HW */
2145 /* association procedure transaction sequence number */
2148 /* AID for RTXed association responses */
2151 /* power save mode related*/
2157 struct tasklet_struct ps_task;
2162 /* used if IEEE_SOFTMAC_TX_QUEUE is set */
2164 short scanning_continue;
2165 short proto_started;
2166 short proto_stoppping;
2168 struct semaphore wx_sem;
2169 struct semaphore scan_sem;
2170 struct semaphore ips_sem;
2172 spinlock_t mgmt_tx_lock;
2173 spinlock_t beacon_lock;
2180 /* set on initialization */
2182 unsigned int wmm_acm;
2184 /* for discarding duplicated packets in IBSS */
2185 struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
2187 /* for discarding duplicated packets in BSS */
2188 u16 last_rxseq_num[17]; /* rx seq previous per-tid */
2189 u16 last_rxfrag_num[17];/* tx frag previous per-tid */
2190 unsigned long last_packet_time[17];
2193 unsigned long last_rx_ps_time;
2197 /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
2198 struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
2199 int mgmt_queue_head;
2200 int mgmt_queue_tail;
2201 #define RTLLIB_QUEUE_LIMIT 128
2203 unsigned int hw_header;
2204 struct sk_buff_head skb_waitQ[MAX_QUEUE_SIZE];
2205 struct sk_buff_head skb_aggQ[MAX_QUEUE_SIZE];
2206 struct sk_buff_head skb_drv_aggQ[MAX_QUEUE_SIZE];
2207 u32 sta_edca_param[4];
2209 bool enable_rx_imm_BA;
2210 bool bibsscoordinator;
2212 bool bdynamic_txpower_enable;
2214 bool bCTSToSelfEnable;
2217 u32 fsync_time_interval;
2218 u32 fsync_rate_bitmap;
2219 u8 fsync_rssi_threshold;
2222 u8 fsync_multiple_timeinterval;
2223 u32 fsync_firstdiff_ratethreshold;
2224 u32 fsync_seconddiff_ratethreshold;
2225 enum fsync_state fsync_state;
2226 bool bis_any_nonbepkts;
2227 struct bandwidth_autoswitch bandwidth_auto_switch;
2230 struct rt_link_detect LinkDetectInfo;
2231 bool bIsAggregateFrame;
2232 struct rt_pwr_save_ctrl PowerSaveControl;
2233 u8 amsdu_in_process;
2235 /* used if IEEE_SOFTMAC_TX_QUEUE is set */
2236 struct tx_pending tx_pending;
2238 /* used if IEEE_SOFTMAC_ASSOCIATE is set */
2239 struct timer_list associate_timer;
2241 /* used if IEEE_SOFTMAC_BEACONS is set */
2242 struct timer_list beacon_timer;
2244 struct work_struct associate_complete_wq;
2245 struct work_struct ips_leave_wq;
2246 struct delayed_work associate_procedure_wq;
2247 struct delayed_work softmac_scan_wq;
2248 struct delayed_work softmac_hint11d_wq;
2249 struct delayed_work associate_retry_wq;
2250 struct delayed_work start_ibss_wq;
2251 struct delayed_work hw_wakeup_wq;
2252 struct delayed_work hw_sleep_wq;
2253 struct delayed_work link_change_wq;
2254 struct work_struct wx_sync_scan_wq;
2256 struct workqueue_struct *wq;
2258 struct rtllib_rxb *RfdArray[REORDER_WIN_SIZE];
2259 struct rtllib_rxb *stats_IndicateArray[REORDER_WIN_SIZE];
2260 struct rtllib_rxb *prxbIndicateArray[REORDER_WIN_SIZE];
2262 struct sw_chnl_cmd PreCommonCmd[MAX_PRECMD_CNT];
2263 struct sw_chnl_cmd PostCommonCmd[MAX_POSTCMD_CNT];
2264 struct sw_chnl_cmd RfDependCmd[MAX_RFDEPENDCMD_CNT];
2268 /* Callback functions */
2269 void (*set_security)(struct net_device *dev,
2270 struct rtllib_security *sec);
2272 /* Used to TX data frame by using txb structs.
2273 * this is not used if in the softmac_features
2274 * is set the flag IEEE_SOFTMAC_TX_QUEUE
2276 int (*hard_start_xmit)(struct rtllib_txb *txb,
2277 struct net_device *dev);
2279 int (*reset_port)(struct net_device *dev);
2280 int (*is_queue_full)(struct net_device *dev, int pri);
2282 int (*handle_management)(struct net_device *dev,
2283 struct rtllib_network *network, u16 type);
2284 int (*is_qos_active)(struct net_device *dev, struct sk_buff *skb);
2286 /* Softmac-generated frames (management) are TXed via this
2287 * callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
2288 * not set. As some cards may have different HW queues that
2289 * one might want to use for data and management frames
2290 * the option to have two callbacks might be useful.
2291 * This function can't sleep.
2293 int (*softmac_hard_start_xmit)(struct sk_buff *skb,
2294 struct net_device *dev);
2296 /* used instead of hard_start_xmit (not softmac_hard_start_xmit)
2297 * if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
2298 * frames. If the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
2299 * then also management frames are sent via this callback.
2300 * This function can't sleep.
2302 void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
2303 struct net_device *dev, int rate);
2305 /* stops the HW queue for DATA frames. Useful to avoid
2306 * waste time to TX data frame when we are reassociating
2307 * This function can sleep.
2309 void (*data_hard_stop)(struct net_device *dev);
2311 /* OK this is complementing to data_poll_hard_stop */
2312 void (*data_hard_resume)(struct net_device *dev);
2314 /* ask to the driver to retune the radio.
2315 * This function can sleep. the driver should ensure
2316 * the radio has been switched before return.
2318 void (*set_chan)(struct net_device *dev, short ch);
2320 /* These are not used if the ieee stack takes care of
2321 * scanning (IEEE_SOFTMAC_SCAN feature set).
2322 * In this case only the set_chan is used.
2324 * The syncro version is similar to the start_scan but
2325 * does not return until all channels has been scanned.
2326 * this is called in user context and should sleep,
2327 * it is called in a work_queue when switching to ad-hoc mode
2328 * or in behalf of iwlist scan when the card is associated
2329 * and root user ask for a scan.
2330 * the function stop_scan should stop both the syncro and
2331 * background scanning and can sleep.
2332 * The function start_scan should initiate the background
2333 * scanning and can't sleep.
2335 void (*scan_syncro)(struct net_device *dev);
2336 void (*start_scan)(struct net_device *dev);
2337 void (*stop_scan)(struct net_device *dev);
2339 void (*rtllib_start_hw_scan)(struct net_device *dev);
2340 void (*rtllib_stop_hw_scan)(struct net_device *dev);
2342 /* indicate the driver that the link state is changed
2343 * for example it may indicate the card is associated now.
2344 * Driver might be interested in this to apply RX filter
2345 * rules or simply light the LINK led
2347 void (*link_change)(struct net_device *dev);
2349 /* these two function indicates to the HW when to start
2350 * and stop to send beacons. This is used when the
2351 * IEEE_SOFTMAC_BEACONS is not set. For now the
2352 * stop_send_bacons is NOT guaranteed to be called only
2353 * after start_send_beacons.
2355 void (*start_send_beacons)(struct net_device *dev);
2356 void (*stop_send_beacons)(struct net_device *dev);
2358 /* power save mode related */
2359 void (*sta_wake_up)(struct net_device *dev);
2360 void (*enter_sleep_state)(struct net_device *dev, u64 time);
2361 short (*ps_is_queue_empty)(struct net_device *dev);
2362 int (*handle_beacon)(struct net_device *dev,
2363 struct rtllib_beacon *beacon,
2364 struct rtllib_network *network);
2365 int (*handle_assoc_response)(struct net_device *dev,
2366 struct rtllib_assoc_response_frame *resp,
2367 struct rtllib_network *network);
2370 /* check whether Tx hw resource available */
2371 short (*check_nic_enough_desc)(struct net_device *dev, int queue_index);
2372 short (*get_nic_desc_num)(struct net_device *dev, int queue_index);
2373 void (*SetBWModeHandler)(struct net_device *dev,
2374 enum ht_channel_width Bandwidth,
2375 enum ht_extchnl_offset Offset);
2376 bool (*GetNmodeSupportBySecCfg)(struct net_device *dev);
2377 void (*SetWirelessMode)(struct net_device *dev, u8 wireless_mode);
2378 bool (*GetHalfNmodeSupportByAPsHandler)(struct net_device *dev);
2379 u8 (*rtllib_ap_sec_type)(struct rtllib_device *ieee);
2380 void (*HalUsbRxAggrHandler)(struct net_device *dev, bool Value);
2381 void (*InitialGainHandler)(struct net_device *dev, u8 Operation);
2382 bool (*SetFwCmdHandler)(struct net_device *dev,
2383 enum fw_cmd_io_type FwCmdIO);
2384 void (*UpdateHalRAMaskHandler)(struct net_device *dev, bool bMulticast,
2385 u8 macId, u8 MimoPs, u8 WirelessMode,
2386 u8 bCurTxBW40MHz, u8 rssi_level);
2387 void (*UpdateBeaconInterruptHandler)(struct net_device *dev,
2389 void (*UpdateInterruptMaskHandler)(struct net_device *dev, u32 AddMSR,
2391 u16 (*rtl_11n_user_show_rates)(struct net_device *dev);
2392 void (*ScanOperationBackupHandler)(struct net_device *dev,
2394 void (*LedControlHandler)(struct net_device *dev,
2395 enum led_ctl_mode LedAction);
2396 void (*SetHwRegHandler)(struct net_device *dev, u8 variable, u8 *val);
2397 void (*GetHwRegHandler)(struct net_device *dev, u8 variable, u8 *val);
2399 void (*AllowAllDestAddrHandler)(struct net_device *dev,
2400 bool bAllowAllDA, bool WriteIntoReg);
2402 void (*rtllib_ips_leave_wq)(struct net_device *dev);
2403 void (*rtllib_ips_leave)(struct net_device *dev);
2404 void (*LeisurePSLeave)(struct net_device *dev);
2405 void (*rtllib_rfkill_poll)(struct net_device *dev);
2407 /* This must be the last item so that it points to the data
2408 * allocated beyond this structure by alloc_rtllib
2413 #define IEEE_A (1<<0)
2414 #define IEEE_B (1<<1)
2415 #define IEEE_G (1<<2)
2416 #define IEEE_N_24G (1<<4)
2417 #define IEEE_N_5G (1<<5)
2418 #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G)
2420 /* Generate a 802.11 header */
2422 /* Uses the channel change callback directly
2423 * instead of [start/stop] scan callbacks
2425 #define IEEE_SOFTMAC_SCAN (1<<2)
2427 /* Perform authentication and association handshake */
2428 #define IEEE_SOFTMAC_ASSOCIATE (1<<3)
2430 /* Generate probe requests */
2431 #define IEEE_SOFTMAC_PROBERQ (1<<4)
2433 /* Generate response to probe requests */
2434 #define IEEE_SOFTMAC_PROBERS (1<<5)
2436 /* The ieee802.11 stack will manage the netif queue
2437 * wake/stop for the driver, taking care of 802.11
2438 * fragmentation. See softmac.c for details.
2440 #define IEEE_SOFTMAC_TX_QUEUE (1<<7)
2442 /* Uses only the softmac_data_hard_start_xmit
2443 * even for TX management frames.
2445 #define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
2447 /* Generate beacons. The stack will enqueue beacons
2450 #define IEEE_SOFTMAC_BEACONS (1<<6)
2453 static inline void *rtllib_priv(struct net_device *dev)
2455 return ((struct rtllib_device *)netdev_priv(dev))->priv;
2458 static inline int rtllib_is_empty_essid(const char *essid, int essid_len)
2460 /* Single white space is for Linksys APs */
2461 if (essid_len == 1 && essid[0] == ' ')
2464 /* Otherwise, if the entire essid is 0, we assume it is hidden */
2467 if (essid[essid_len] != '\0')
2474 static inline int rtllib_is_valid_mode(struct rtllib_device *ieee, int mode)
2476 /* It is possible for both access points and our device to support
2477 * combinations of modes, so as long as there is one valid combination
2478 * of ap/device supported modes, then return success
2480 if ((mode & IEEE_A) &&
2481 (ieee->modulation & RTLLIB_OFDM_MODULATION) &&
2482 (ieee->freq_band & RTLLIB_52GHZ_BAND))
2485 if ((mode & IEEE_G) &&
2486 (ieee->modulation & RTLLIB_OFDM_MODULATION) &&
2487 (ieee->freq_band & RTLLIB_24GHZ_BAND))
2490 if ((mode & IEEE_B) &&
2491 (ieee->modulation & RTLLIB_CCK_MODULATION) &&
2492 (ieee->freq_band & RTLLIB_24GHZ_BAND))
2498 static inline int rtllib_get_hdrlen(u16 fc)
2500 int hdrlen = RTLLIB_3ADDR_LEN;
2502 switch (WLAN_FC_GET_TYPE(fc)) {
2503 case RTLLIB_FTYPE_DATA:
2504 if ((fc & RTLLIB_FCTL_FROMDS) && (fc & RTLLIB_FCTL_TODS))
2505 hdrlen = RTLLIB_4ADDR_LEN; /* Addr4 */
2506 if (RTLLIB_QOS_HAS_SEQ(fc))
2507 hdrlen += 2; /* QOS ctrl*/
2509 case RTLLIB_FTYPE_CTL:
2510 switch (WLAN_FC_GET_STYPE(fc)) {
2511 case RTLLIB_STYPE_CTS:
2512 case RTLLIB_STYPE_ACK:
2513 hdrlen = RTLLIB_1ADDR_LEN;
2516 hdrlen = RTLLIB_2ADDR_LEN;
2525 static inline u8 *rtllib_get_payload(struct rtllib_hdr *hdr)
2527 switch (rtllib_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) {
2528 case RTLLIB_1ADDR_LEN:
2529 return ((struct rtllib_hdr_1addr *)hdr)->payload;
2530 case RTLLIB_2ADDR_LEN:
2531 return ((struct rtllib_hdr_2addr *)hdr)->payload;
2532 case RTLLIB_3ADDR_LEN:
2533 return ((struct rtllib_hdr_3addr *)hdr)->payload;
2534 case RTLLIB_4ADDR_LEN:
2535 return ((struct rtllib_hdr_4addr *)hdr)->payload;
2540 static inline int rtllib_is_ofdm_rate(u8 rate)
2542 switch (rate & ~RTLLIB_BASIC_RATE_MASK) {
2543 case RTLLIB_OFDM_RATE_6MB:
2544 case RTLLIB_OFDM_RATE_9MB:
2545 case RTLLIB_OFDM_RATE_12MB:
2546 case RTLLIB_OFDM_RATE_18MB:
2547 case RTLLIB_OFDM_RATE_24MB:
2548 case RTLLIB_OFDM_RATE_36MB:
2549 case RTLLIB_OFDM_RATE_48MB:
2550 case RTLLIB_OFDM_RATE_54MB:
2556 static inline int rtllib_is_cck_rate(u8 rate)
2558 switch (rate & ~RTLLIB_BASIC_RATE_MASK) {
2559 case RTLLIB_CCK_RATE_1MB:
2560 case RTLLIB_CCK_RATE_2MB:
2561 case RTLLIB_CCK_RATE_5MB:
2562 case RTLLIB_CCK_RATE_11MB:
2570 extern void free_rtllib(struct net_device *dev);
2571 extern struct net_device *alloc_rtllib(int sizeof_priv);
2573 extern int rtllib_set_encryption(struct rtllib_device *ieee);
2577 extern int rtllib_encrypt_fragment(
2578 struct rtllib_device *ieee,
2579 struct sk_buff *frag,
2582 extern int rtllib_xmit(struct sk_buff *skb, struct net_device *dev);
2583 extern int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev);
2584 extern void rtllib_txb_free(struct rtllib_txb *);
2587 extern int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb,
2588 struct rtllib_rx_stats *rx_stats);
2589 extern void rtllib_rx_mgt(struct rtllib_device *ieee,
2590 struct sk_buff *skb,
2591 struct rtllib_rx_stats *stats);
2592 extern void rtllib_rx_probe_rq(struct rtllib_device *ieee,
2593 struct sk_buff *skb);
2594 extern int rtllib_legal_channel(struct rtllib_device *rtllib, u8 channel);
2597 extern int rtllib_wx_get_scan(struct rtllib_device *ieee,
2598 struct iw_request_info *info,
2599 union iwreq_data *wrqu, char *key);
2600 extern int rtllib_wx_set_encode(struct rtllib_device *ieee,
2601 struct iw_request_info *info,
2602 union iwreq_data *wrqu, char *key);
2603 extern int rtllib_wx_get_encode(struct rtllib_device *ieee,
2604 struct iw_request_info *info,
2605 union iwreq_data *wrqu, char *key);
2606 #if WIRELESS_EXT >= 18
2607 extern int rtllib_wx_get_encode_ext(struct rtllib_device *ieee,
2608 struct iw_request_info *info,
2609 union iwreq_data *wrqu, char *extra);
2610 extern int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
2611 struct iw_request_info *info,
2612 union iwreq_data *wrqu, char *extra);
2614 extern int rtllib_wx_set_auth(struct rtllib_device *ieee,
2615 struct iw_request_info *info,
2616 struct iw_param *data, char *extra);
2617 extern int rtllib_wx_set_mlme(struct rtllib_device *ieee,
2618 struct iw_request_info *info,
2619 union iwreq_data *wrqu, char *extra);
2620 extern int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len);
2622 /* rtllib_softmac.c */
2623 extern short rtllib_is_54g(struct rtllib_network *net);
2624 extern short rtllib_is_shortslot(const struct rtllib_network *net);
2625 extern int rtllib_rx_frame_softmac(struct rtllib_device *ieee,
2626 struct sk_buff *skb,
2627 struct rtllib_rx_stats *rx_stats, u16 type,
2629 extern void rtllib_softmac_new_net(struct rtllib_device *ieee,
2630 struct rtllib_network *net);
2632 void SendDisassociation(struct rtllib_device *ieee, bool deauth, u16 asRsn);
2633 extern void rtllib_softmac_xmit(struct rtllib_txb *txb,
2634 struct rtllib_device *ieee);
2636 extern void rtllib_stop_send_beacons(struct rtllib_device *ieee);
2637 extern void notify_wx_assoc_event(struct rtllib_device *ieee);
2638 extern void rtllib_softmac_check_all_nets(struct rtllib_device *ieee);
2639 extern void rtllib_start_bss(struct rtllib_device *ieee);
2640 extern void rtllib_start_master_bss(struct rtllib_device *ieee);
2641 extern void rtllib_start_ibss(struct rtllib_device *ieee);
2642 extern void rtllib_softmac_init(struct rtllib_device *ieee);
2643 extern void rtllib_softmac_free(struct rtllib_device *ieee);
2644 extern void rtllib_associate_abort(struct rtllib_device *ieee);
2645 extern void rtllib_disassociate(struct rtllib_device *ieee);
2646 extern void rtllib_stop_scan(struct rtllib_device *ieee);
2647 extern bool rtllib_act_scanning(struct rtllib_device *ieee, bool sync_scan);
2648 extern void rtllib_stop_scan_syncro(struct rtllib_device *ieee);
2649 extern void rtllib_start_scan_syncro(struct rtllib_device *ieee, u8 is_mesh);
2650 extern void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee,
2652 extern void rtllib_sta_wakeup(struct rtllib_device *ieee, short nl);
2653 extern void rtllib_sta_ps_send_pspoll_frame(struct rtllib_device *ieee);
2654 extern void rtllib_check_all_nets(struct rtllib_device *ieee);
2655 extern void rtllib_start_protocol(struct rtllib_device *ieee);
2656 extern void rtllib_stop_protocol(struct rtllib_device *ieee, u8 shutdown);
2658 extern void rtllib_EnableNetMonitorMode(struct net_device *dev,
2660 extern void rtllib_DisableNetMonitorMode(struct net_device *dev,
2662 extern void rtllib_EnableIntelPromiscuousMode(struct net_device *dev,
2664 extern void rtllib_DisableIntelPromiscuousMode(struct net_device *dev,
2666 extern void rtllib_send_probe_requests(struct rtllib_device *ieee, u8 is_mesh);
2668 extern void rtllib_softmac_stop_protocol(struct rtllib_device *ieee,
2669 u8 mesh_flag, u8 shutdown);
2670 extern void rtllib_softmac_start_protocol(struct rtllib_device *ieee,
2673 extern void rtllib_reset_queue(struct rtllib_device *ieee);
2674 extern void rtllib_wake_queue(struct rtllib_device *ieee);
2675 extern void rtllib_stop_queue(struct rtllib_device *ieee);
2676 extern void rtllib_wake_all_queues(struct rtllib_device *ieee);
2677 extern void rtllib_stop_all_queues(struct rtllib_device *ieee);
2678 extern struct sk_buff *rtllib_get_beacon(struct rtllib_device *ieee);
2679 extern void rtllib_start_send_beacons(struct rtllib_device *ieee);
2680 extern void rtllib_stop_send_beacons(struct rtllib_device *ieee);
2681 extern int rtllib_wpa_supplicant_ioctl(struct rtllib_device *ieee,
2682 struct iw_point *p, u8 is_mesh);
2684 extern void notify_wx_assoc_event(struct rtllib_device *ieee);
2685 extern void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success);
2687 extern void softmac_mgmt_xmit(struct sk_buff *skb,
2688 struct rtllib_device *ieee);
2689 extern u16 rtllib_query_seqnum(struct rtllib_device *ieee,
2690 struct sk_buff *skb, u8 *dst);
2691 extern u8 rtllib_ap_sec_type(struct rtllib_device *ieee);
2693 /* rtllib_crypt_ccmp&tkip&wep.c */
2694 extern void rtllib_tkip_null(void);
2695 extern void rtllib_wep_null(void);
2696 extern void rtllib_ccmp_null(void);
2698 /* rtllib_softmac_wx.c */
2700 extern int rtllib_wx_get_wap(struct rtllib_device *ieee,
2701 struct iw_request_info *info,
2702 union iwreq_data *wrqu, char *ext);
2704 extern int rtllib_wx_set_wap(struct rtllib_device *ieee,
2705 struct iw_request_info *info,
2706 union iwreq_data *awrq,
2709 extern int rtllib_wx_get_essid(struct rtllib_device *ieee,
2710 struct iw_request_info *a,
2711 union iwreq_data *wrqu, char *b);
2713 extern int rtllib_wx_set_rate(struct rtllib_device *ieee,
2714 struct iw_request_info *info,
2715 union iwreq_data *wrqu, char *extra);
2717 extern int rtllib_wx_get_rate(struct rtllib_device *ieee,
2718 struct iw_request_info *info,
2719 union iwreq_data *wrqu, char *extra);
2721 extern int rtllib_wx_set_mode(struct rtllib_device *ieee,
2722 struct iw_request_info *a,
2723 union iwreq_data *wrqu, char *b);
2725 extern int rtllib_wx_set_scan(struct rtllib_device *ieee,
2726 struct iw_request_info *a,
2727 union iwreq_data *wrqu, char *b);
2729 extern int rtllib_wx_set_essid(struct rtllib_device *ieee,
2730 struct iw_request_info *a,
2731 union iwreq_data *wrqu, char *extra);
2733 extern int rtllib_wx_get_mode(struct rtllib_device *ieee,
2734 struct iw_request_info *a,
2735 union iwreq_data *wrqu, char *b);
2737 extern int rtllib_wx_set_freq(struct rtllib_device *ieee,
2738 struct iw_request_info *a,
2739 union iwreq_data *wrqu, char *b);
2741 extern int rtllib_wx_get_freq(struct rtllib_device *ieee,
2742 struct iw_request_info *a,
2743 union iwreq_data *wrqu, char *b);
2744 extern void rtllib_wx_sync_scan_wq(void *data);
2746 extern int rtllib_wx_set_rawtx(struct rtllib_device *ieee,
2747 struct iw_request_info *info,
2748 union iwreq_data *wrqu, char *extra);
2750 extern int rtllib_wx_get_name(struct rtllib_device *ieee,
2751 struct iw_request_info *info,
2752 union iwreq_data *wrqu, char *extra);
2754 extern int rtllib_wx_set_power(struct rtllib_device *ieee,
2755 struct iw_request_info *info,
2756 union iwreq_data *wrqu, char *extra);
2758 extern int rtllib_wx_get_power(struct rtllib_device *ieee,
2759 struct iw_request_info *info,
2760 union iwreq_data *wrqu, char *extra);
2762 extern int rtllib_wx_set_rts(struct rtllib_device *ieee,
2763 struct iw_request_info *info,
2764 union iwreq_data *wrqu, char *extra);
2766 extern int rtllib_wx_get_rts(struct rtllib_device *ieee,
2767 struct iw_request_info *info,
2768 union iwreq_data *wrqu, char *extra);
2769 #define MAX_RECEIVE_BUFFER_SIZE 9100
2771 void HTSetConnectBwMode(struct rtllib_device *ieee,
2772 enum ht_channel_width Bandwidth,
2773 enum ht_extchnl_offset Offset);
2774 extern void HTUpdateDefaultSetting(struct rtllib_device *ieee);
2775 extern void HTConstructCapabilityElement(struct rtllib_device *ieee,
2776 u8 *posHTCap, u8 *len,
2777 u8 isEncrypt, bool bAssoc);
2778 extern void HTConstructInfoElement(struct rtllib_device *ieee,
2779 u8 *posHTInfo, u8 *len, u8 isEncrypt);
2780 extern void HTConstructRT2RTAggElement(struct rtllib_device *ieee,
2781 u8 *posRT2RTAgg, u8 *len);
2782 extern void HTOnAssocRsp(struct rtllib_device *ieee);
2783 extern void HTInitializeHTInfo(struct rtllib_device *ieee);
2784 extern void HTInitializeBssDesc(struct bss_ht *pBssHT);
2785 extern void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee,
2786 struct rtllib_network *pNetwork);
2787 extern void HT_update_self_and_peer_setting(struct rtllib_device *ieee,
2788 struct rtllib_network *pNetwork);
2789 extern u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet,
2791 extern u8 MCS_FILTER_ALL[];
2792 extern u16 MCS_DATA_RATE[2][2][77];
2793 extern u8 HTCCheck(struct rtllib_device *ieee, u8 *pFrame);
2794 extern void HTResetIOTSetting(struct rt_hi_throughput *pHTInfo);
2795 extern bool IsHTHalfNmodeAPs(struct rtllib_device *ieee);
2796 extern u16 HTMcsToDataRate(struct rtllib_device *ieee, u8 nMcsRate);
2797 extern u16 TxCountToDataRate(struct rtllib_device *ieee, u8 nDataRate);
2798 extern int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb);
2799 extern int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb);
2800 extern int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb);
2801 extern void TsInitAddBA(struct rtllib_device *ieee, struct tx_ts_record *pTS,
2802 u8 Policy, u8 bOverwritePending);
2803 extern void TsInitDelBA(struct rtllib_device *ieee,
2804 struct ts_common_info *pTsCommonInfo,
2805 enum tr_select TxRxSelect);
2806 extern void BaSetupTimeOut(unsigned long data);
2807 extern void TxBaInactTimeout(unsigned long data);
2808 extern void RxBaInactTimeout(unsigned long data);
2809 extern void ResetBaEntry(struct ba_record *pBA);
2811 struct rtllib_device *ieee,
2812 struct ts_common_info **ppTS,
2815 enum tr_select TxRxSelect,
2818 extern void TSInitialize(struct rtllib_device *ieee);
2819 extern void TsStartAddBaProcess(struct rtllib_device *ieee,
2820 struct tx_ts_record *pTxTS);
2821 extern void RemovePeerTS(struct rtllib_device *ieee, u8 *Addr);
2822 extern void RemoveAllTS(struct rtllib_device *ieee);
2823 void rtllib_softmac_scan_syncro(struct rtllib_device *ieee, u8 is_mesh);
2825 extern const long rtllib_wlan_frequencies[];
2827 static inline void rtllib_increment_scans(struct rtllib_device *ieee)
2832 static inline int rtllib_get_scans(struct rtllib_device *ieee)
2837 static inline const char *escape_essid(const char *essid, u8 essid_len)
2839 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
2841 if (rtllib_is_empty_essid(essid, essid_len)) {
2842 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
2846 snprintf(escaped, sizeof(escaped), "%*pEn", essid_len, essid);
2850 #define CONVERT_RATE(_ieee, _MGN_RATE) \
2851 ((_MGN_RATE < MGN_MCS0) ? (_MGN_RATE) : \
2852 (HTMcsToDataRate(_ieee, (u8)_MGN_RATE)))
2854 /* fun with the built-in rtllib stack... */
2855 bool rtllib_MgntDisconnect(struct rtllib_device *rtllib, u8 asRsn);
2858 /* For the function is more related to hardware setting, it's better to use the
2859 * ieee handler to refer to it.
2861 extern void rtllib_update_active_chan_map(struct rtllib_device *ieee);
2862 extern void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee,
2863 struct rx_ts_record *pTS);
2864 extern int rtllib_data_xmit(struct sk_buff *skb, struct net_device *dev);
2865 extern int rtllib_parse_info_param(struct rtllib_device *ieee,
2866 struct rtllib_info_element *info_element,
2868 struct rtllib_network *network,
2869 struct rtllib_rx_stats *stats);
2871 void rtllib_indicate_packets(struct rtllib_device *ieee,
2872 struct rtllib_rxb **prxbIndicateArray, u8 index);
2873 extern u8 HTFilterMCSRate(struct rtllib_device *ieee, u8 *pSupportMCS,
2875 extern void HTUseDefaultSetting(struct rtllib_device *ieee);
2876 #define RT_ASOC_RETRY_LIMIT 5
2877 u8 MgntQuery_TxRateExcludeCCKRates(struct rtllib_device *ieee);
2878 extern void rtllib_TURBO_Info(struct rtllib_device *ieee, u8 **tag_p);
2879 #ifndef ENABLE_LOCK_DEBUG
2880 #define SPIN_LOCK_IEEE(plock) spin_lock_irqsave((plock), flags)
2881 #define SPIN_UNLOCK_IEEE(plock) spin_unlock_irqrestore((plock), flags)
2882 #define SPIN_LOCK_IEEE_REORDER(plock) spin_lock_irqsave((plock), flags)
2883 #define SPIN_UNLOCK_IEEE_REORDER(plock) spin_unlock_irqrestore((plock), flags)
2884 #define SPIN_LOCK_IEEE_WPAX(plock) spin_lock_irqsave((plock), flags)
2885 #define SPIN_UNLOCK_IEEE_WPAX(plock) spin_unlock_irqrestore((plock), flags)
2886 #define SPIN_LOCK_IEEE_MGNTTX(plock) spin_lock_irqsave((plock), flags)
2887 #define SPIN_UNLOCK_IEEE_MGNTTX(plock) spin_unlock_irqrestore((plock), flags)
2888 #define SPIN_LOCK_IEEE_BCN(plock) spin_lock_irqsave((plock), flags)
2889 #define SPIN_UNLOCK_IEEE_BCN(plock) spin_unlock_irqrestore((plock), flags)
2890 #define SPIN_LOCK_MSH_STAINFO(plock) spin_lock_irqsave((plock), flags)
2891 #define SPIN_UNLOCK_MSH_STAINFO(plock) spin_unlock_irqrestore((plock), flags)
2892 #define SPIN_LOCK_MSH_PREQ(plock) spin_lock_irqsave((plock), flags)
2893 #define SPIN_UNLOCK_MSH_PREQ(plock) spin_unlock_irqrestore((plock), flags)
2894 #define SPIN_LOCK_MSH_QUEUE(plock) spin_lock_irqsave((plock), flags)
2895 #define SPIN_UNLOCK_MSH_QUEUE(plock) spin_unlock_irqrestore((plock), flags)
2896 #define SPIN_LOCK_PRIV_RFPS(plock) spin_lock_irqsave((plock), flags)
2897 #define SPIN_UNLOCK_PRIV_RFPS(plock) spin_unlock_irqrestore((plock), flags)
2898 #define SPIN_LOCK_PRIV_IRQTH(plock) spin_lock_irqsave((plock), flags)
2899 #define SPIN_UNLOCK_PRIV_IRQTH(plock) spin_unlock_irqrestore((plock), flags)
2900 #define SPIN_LOCK_PRIV_TX(plock) spin_lock_irqsave((plock), flags)
2901 #define SPIN_UNLOCK_PRIV_TX(plock) spin_unlock_irqrestore((plock), flags)
2902 #define SPIN_LOCK_PRIV_D3(plock) spin_lock_irqsave((plock), flags)
2903 #define SPIN_UNLOCK_PRIV_D3(plock) spin_unlock_irqrestore((plock), flags)
2904 #define SPIN_LOCK_PRIV_RF(plock) spin_lock_irqsave((plock), flags)
2905 #define SPIN_UNLOCK_PRIV_RF(plock) spin_unlock_irqrestore((plock), flags)
2906 #define SPIN_LOCK_PRIV_PS(plock) spin_lock_irqsave((plock), flags)
2907 #define SPIN_UNLOCK_PRIV_PS(plock) spin_unlock_irqrestore((plock), flags)
2908 #define SEM_DOWN_IEEE_WX(psem) down(psem)
2909 #define SEM_UP_IEEE_WX(psem) up(psem)
2910 #define SEM_DOWN_IEEE_SCAN(psem) down(psem)
2911 #define SEM_UP_IEEE_SCAN(psem) up(psem)
2912 #define SEM_DOWN_IEEE_IPS(psem) down(psem)
2913 #define SEM_UP_IEEE_IPS(psem) up(psem)
2914 #define SEM_DOWN_PRIV_WX(psem) down(psem)
2915 #define SEM_UP_PRIV_WX(psem) up(psem)
2916 #define SEM_DOWN_PRIV_RF(psem) down(psem)
2917 #define SEM_UP_PRIV_RF(psem) up(psem)
2918 #define MUTEX_LOCK_PRIV(pmutex) mutex_lock(pmutex)
2919 #define MUTEX_UNLOCK_PRIV(pmutex) mutex_unlock(pmutex)
2922 #endif /* RTLLIB_H */