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/version.h>
29
#include <linux/module.h>
30
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
31
#include <linux/jiffies.h>
33
#include <linux/jffs.h>
34
#include <linux/tqueue.h>
36
#include <linux/timer.h>
37
#include <linux/sched.h>
39
#include <linux/delay.h>
40
#include <linux/wireless.h>
42
#ifdef CONFIG_CFG_80211
43
#include <net/cfg80211.h>
46
#include "rtl819x_HT.h"
47
#include "rtl819x_BA.h"
48
#include "rtl819x_TS.h"
50
#include <linux/netdevice.h>
51
#include <linux/if_arp.h> /* ARPHRD_ETHER */
56
#include <net/iw_handler.h>
58
#if defined (RTL8192S_WAPI_SUPPORT)
60
#include "wapi_interface.h"
63
#ifndef IEEE80211_RADIOTAP_F_BADFCS
64
#define IEEE80211_RADIOTAP_F_BADFCS 0x40 /* bad FCS */
67
#ifndef IW_MODE_MONITOR
68
#define IW_MODE_MONITOR 6
72
#define IWEVCUSTOM 0x8c02
76
/* Max number of char in custom event - use multiple of them if needed */
77
#define IW_CUSTOM_MAX 256 /* In bytes */
80
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
81
#define jiffies_to_msecs(t) ((t) * 1000 / HZ)
83
#define __bitwise __attribute__((bitwise))
87
#if (WIRELESS_EXT < 16)
89
/* --- Standard spy support --- */
91
u_char spy_address[IW_MAX_SPY][ETH_ALEN];
92
struct iw_quality spy_stat[IW_MAX_SPY];
93
/* --- Enhanced spy support (event) */
94
struct iw_quality spy_thr_low; /* Low threshold */
95
struct iw_quality spy_thr_high; /* High threshold */
96
u_char spy_thr_under[IW_MAX_SPY];
103
* container_of - cast a member of a structure out to the containing structure
105
* @ptr: the pointer to the member.
106
* @type: the type of the container struct this is embedded in.
107
* @member: the name of the member within the struct.
110
#define container_of(ptr, type, member) ({ \
111
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
112
(type *)( (char *)__mptr - offsetof(type,member) );})
115
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18))
116
#define skb_tail_pointer_rsl(skb) skb_tail_pointer(skb)
118
#define skb_tail_pointer_rsl(skb) skb->tail
121
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
122
#define EXPORT_SYMBOL_RSL(x) EXPORT_SYMBOL(x)
124
#define EXPORT_SYMBOL_RSL(x) EXPORT_SYMBOL_NOVERS(x)
126
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
127
static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *data)
129
task->routine = func;
131
INIT_LIST_HEAD(&task->list);
136
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
137
static inline void setup_timer(struct timer_list * timer, void(*function)(unsigned long), unsigned long data)
139
timer->function = function;
144
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
145
typedef struct delayed_work delayed_work_struct_rsl;
146
#define queue_delayed_work_rsl(x,y,z) queue_delayed_work(x,y,z)
147
#define INIT_DELAYED_WORK_RSL(x,y,z) INIT_DELAYED_WORK(x,y)
148
#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,40)
149
typedef struct tq_struct delayed_work_struct_rsl;
150
#define queue_delayed_work_rsl(x,y,z) schedule_task(y)
151
#define INIT_DELAYED_WORK_RSL(x,y,z) tq_init(x,y,z)
153
typedef struct work_struct delayed_work_struct_rsl;
154
#define queue_delayed_work_rsl(x,y,z) queue_delayed_work(x,y,z)
155
#define INIT_DELAYED_WORK_RSL(x,y,z) INIT_WORK(x,y,z)
158
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
159
typedef struct work_struct work_struct_rsl;
160
#define queue_work_rsl(x,y) queue_work(x,y)
161
#define INIT_WORK_RSL(x,y,z) INIT_WORK(x,y)
162
#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,40)
163
typedef struct tq_struct work_struct_rsl;
164
#define queue_work_rsl(x,y) schedule_task(y)
165
#define INIT_WORK_RSL(x,y,z) tq_init(x,y,z)
167
typedef struct work_struct work_struct_rsl;
168
#define queue_work_rsl(x,y) queue_work(x,y)
169
#define INIT_WORK_RSL(x,y,z) INIT_WORK(x,y,z)
172
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
173
#define container_of_work_rsl(x,y,z) container_of(x,y,z)
174
#define container_of_dwork_rsl(x,y,z) container_of(container_of(x, struct delayed_work, work), y, z)
176
#define container_of_work_rsl(x,y,z) (x)
177
#define container_of_dwork_rsl(x,y,z) (x)
180
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
182
iwe_stream_add_event_rsl(struct iw_request_info *info,
183
char * stream, /* Stream of events */
184
char * ends, /* End of stream */
185
struct iw_event *iwe, /* Payload */
186
int event_len) /* Real size of payload */
188
/* Check if it's possible */
189
if((stream + event_len) < ends) {
190
iwe->len = event_len;
192
memcpy(stream, (char *) iwe, event_len);
197
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
198
#define iwe_stream_add_event_rsl(info,start,stop,iwe,len) iwe_stream_add_event(info,start,stop,iwe,len)
200
#define iwe_stream_add_event_rsl(info,start,stop,iwe,len) iwe_stream_add_event(start,stop,iwe,len)
203
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
204
#define iwe_stream_add_point_rsl(info,start,stop,iwe,p) iwe_stream_add_point(info,start,stop,iwe,p)
206
#define iwe_stream_add_point_rsl(info,start,stop,iwe,p) iwe_stream_add_point(start,stop,iwe,p)
209
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
210
#define usb_alloc_urb_rsl(x,y) usb_alloc_urb(x,y)
211
#define usb_submit_urb_rsl(x,y) usb_submit_urb(x,y)
213
#define usb_alloc_urb_rsl(x,y) usb_alloc_urb(x)
214
#define usb_submit_urb_rsl(x,y) usb_submit_urb(x)
217
static inline void *netdev_priv_rsl(struct net_device *dev)
219
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
220
return netdev_priv(dev);
226
#define KEY_TYPE_NA 0x0
227
#define KEY_TYPE_WEP40 0x1
228
#define KEY_TYPE_TKIP 0x2
229
#define KEY_TYPE_CCMP 0x4
230
#define KEY_TYPE_WEP104 0x5
231
#if defined (RTL8192S_WAPI_SUPPORT)
232
#define KEY_TYPE_SMS4 0x8
234
/* added for rtl819x tx procedure */
235
#define MAX_QUEUE_SIZE 0x10
237
#if defined(RTL8192SU) || defined(RTL8190P) ||defined(RTL8192U) ||defined(RTL8192E)
243
#define TXCMD_QUEUE 5
246
#define BEACON_QUEUE 8
247
#elif defined(RTL8192SE)
252
#define BEACON_QUEUE 4
253
#define TXCMD_QUEUE 5
258
#elif defined(RTL8192CE)
264
#define BEACON_QUEUE 4
265
#define TXCMD_QUEUE 5
272
#define LOW_QUEUE BE_QUEUE
273
#define NORMAL_QUEUE MGNT_QUEUE
275
#define LOW_QUEUE BE_QUEUE
276
#define NORMAL_QUEUE MGNT_QUEUE
280
#define IW_MODE_MESH 7
282
#ifdef _RTL8192_EXT_PATCH_
283
#define WIFI_MESH_TYPE RTLLIB_FTYPE_DATA
285
#define WLAN_MESH_HDR_LEN 6
286
#define WLAN_MESH_HDR_6ADDR_LEN 18
287
#define WLAN_MESH_HDR_4ADDR_LEN 6
289
#define IEEE_MESH_MAC_HASH_SIZE 31
290
#define MAX_MESH_ID_LEN 33
291
#define MAX_HOST_NAME_LENGTH 33
293
#define AMSDU_SUBHEADER_LEN 14
294
#define SWRF_TIMEOUT 50
296
#define IE_CISCO_FLAG_POSITION 0x08
297
#define SUPPORT_CKIP_MIC 0x08
298
#define SUPPORT_CKIP_PK 0x10
299
#define RT_RF_OFF_LEVL_ASPM BIT0
300
#define RT_RF_OFF_LEVL_CLK_REQ BIT1
301
#define RT_RF_OFF_LEVL_PCI_D3 BIT2
302
#define RT_RF_OFF_LEVL_HALT_NIC BIT3
303
#define RT_RF_OFF_LEVL_FREE_FW BIT4
304
#define RT_RF_OFF_LEVL_FW_32K BIT5
305
#define RT_RF_PS_LEVEL_ALWAYS_ASPM BIT6
306
#define RT_RF_LPS_DISALBE_2R BIT30
307
#define RT_RF_LPS_LEVEL_ASPM BIT31
308
#define RT_IN_PS_LEVEL(pPSC, _PS_FLAG) ((pPSC->CurPsLevel & _PS_FLAG) ? true : false)
309
#define RT_CLEAR_PS_LEVEL(pPSC, _PS_FLAG) (pPSC->CurPsLevel &= (~(_PS_FLAG)))
310
#define RT_SET_PS_LEVEL(pPSC, _PS_FLAG) (pPSC->CurPsLevel |= _PS_FLAG)
312
#if defined (RTL8192S_WAPI_SUPPORT)
313
#define SMS4_MIC_LEN 16
314
#define WAPI_EXT_LEN 18
315
#define MAX_WAPI_IE_LEN 255
316
#define sMacHdrLng 24
319
/* defined for skb cb field */
320
/* At most 28 byte */
321
typedef struct cb_desc {
322
/* Tx Desc Related flags (8-9) */
328
u8 bTxDisableRateFallBack:1;
329
u8 bTxUseDriverAssingedRate:1;
334
/* Tx Firmware Relaged flags (10-11)*/
338
u8 bUseShortPreamble:1;
339
u8 bTxEnableFwCalcDur:1;
346
u8 bRTSUseShortPreamble:1;
351
#ifdef _RTL8192_EXT_PATCH_
357
/* Tx Desc related element(12-19) */
362
#ifdef _RTL8192_EXT_PATCH_
378
/* Tx firmware related element(20-27) */
386
u8 bIsSpecialDataFrame;
395
/*--------------------------Define -------------------------------------------*/
398
#define MGN_5_5M 0x0b
410
#define MGN_MCS0 0x80
411
#define MGN_MCS1 0x81
412
#define MGN_MCS2 0x82
413
#define MGN_MCS3 0x83
414
#define MGN_MCS4 0x84
415
#define MGN_MCS5 0x85
416
#define MGN_MCS6 0x86
417
#define MGN_MCS7 0x87
418
#define MGN_MCS8 0x88
419
#define MGN_MCS9 0x89
420
#define MGN_MCS10 0x8a
421
#define MGN_MCS11 0x8b
422
#define MGN_MCS12 0x8c
423
#define MGN_MCS13 0x8d
424
#define MGN_MCS14 0x8e
425
#define MGN_MCS15 0x8f
426
#define MGN_MCS0_SG 0x90
427
#define MGN_MCS1_SG 0x91
428
#define MGN_MCS2_SG 0x92
429
#define MGN_MCS3_SG 0x93
430
#define MGN_MCS4_SG 0x94
431
#define MGN_MCS5_SG 0x95
432
#define MGN_MCS6_SG 0x96
433
#define MGN_MCS7_SG 0x97
434
#define MGN_MCS8_SG 0x98
435
#define MGN_MCS9_SG 0x99
436
#define MGN_MCS10_SG 0x9a
437
#define MGN_MCS11_SG 0x9b
438
#define MGN_MCS12_SG 0x9c
439
#define MGN_MCS13_SG 0x9d
440
#define MGN_MCS14_SG 0x9e
441
#define MGN_MCS15_SG 0x9f
446
auth_not_valid = 0x2,
458
four_way_tmout = 0x0f,
459
two_way_tmout = 0x10,
461
invalid_Gcipher = 0x12,
462
invalid_Pcipher = 0x13,
464
unsup_RSNIEver = 0x15,
465
invalid_RSNIE = 0x16,
466
auth_802_1x_fail= 0x17,
470
QAP_bandwidth = 0x21,
471
poor_condition = 0x22,
474
invalid_param = 0x26,
475
req_not_honored= 0x27,
476
TS_not_created = 0x2F,
477
DL_not_allowed = 0x30,
478
dest_not_exist = 0x31,
479
dest_not_QSTA = 0x32,
482
typedef enum _HAL_DEF_VARIABLE{
485
HAL_DEF_PROT_IMP_MODE,
486
HAL_DEF_HIGH_POWER_MECHANISM,
487
HAL_DEF_RATE_ADAPTIVE_MECHANISM,
488
HAL_DEF_ANTENNA_DIVERSITY_MECHANISM,
494
HAL_DEF_MIN_TX_POWER_DBM,
495
HAL_DEF_MAX_TX_POWER_DBM,
496
HW_DEF_EFUSE_REPG_SECTION1_FLAG,
497
HW_DEF_EFUSE_REPG_DATA,
499
HAL_DEF_PCI_SUPPORT_ASPM,
500
HAL_DEF_PCI_SUUPORT_L1_BACKDOOR,
501
HAL_DEF_THERMAL_VALUE,
502
HAL_DEF_USB_IN_TOKEN_REV,
506
typedef enum _HW_VARIABLES{
508
HW_VAR_MULTICAST_REG,
512
HW_VAR_SECURITY_CONF,
513
HW_VAR_BEACON_INTERVAL,
515
HW_VAR_LISTEN_INTERVAL,
528
HW_VAR_RATE_FALLBACK_CONTROL,
529
HW_VAR_CONTENTION_WINDOW,
534
HW_VAR_AMPDU_MIN_SPACE,
535
HW_VAR_SHORTGI_DENSITY,
537
HW_VAR_MCS_RATE_AVAILABLE,
540
HW_VAR_DIS_Req_Qsize,
541
HW_VAR_CCX_CHNL_LOAD,
542
HW_VAR_CCX_NOISE_HISTOGRAM,
549
HW_VAR_SET_DEV_POWER,
559
HW_VAR_USER_CONTROL_TURBO_MODE,
565
HW_VAR_AUTOLOAD_STATUS,
566
HW_VAR_RF_2R_DISABLE,
568
HW_VAR_H2C_FW_PWRMODE,
569
HW_VAR_H2C_FW_JOINBSSRPT,
570
HW_VAR_1X1_RECV_COMBINE,
571
HW_VAR_STOP_SEND_BEACON,
576
HW_VAR_H2C_FW_UPDATE_GTK,
579
HW_VAR_WF_IS_MAC_ADDR,
580
HW_VAR_H2C_FW_OFFLOAD,
583
HW_VAR_HANDLE_FW_C2H,
584
HW_VAR_DL_FW_RSVD_PAGE,
586
HW_VAR_HW_SEQ_ENABLE,
591
HW_VAR_SWITCH_EPHY_WoWLAN,
592
HW_VAR_INT_MIGRATION,
599
typedef enum _RT_OP_MODE{
601
RT_OP_MODE_INFRASTRUCTURE,
604
}RT_OP_MODE, *PRT_OP_MODE;
607
#define aSifsTime (((priv->rtllib->current_network.mode == IEEE_A)||(priv->rtllib->current_network.mode == IEEE_N_24G)||(priv->rtllib->current_network.mode == IEEE_N_5G))? 16 : 10)
609
#define MGMT_QUEUE_NUM 5
611
#define IEEE_CMD_SET_WPA_PARAM 1
612
#define IEEE_CMD_SET_WPA_IE 2
613
#define IEEE_CMD_SET_ENCRYPTION 3
614
#define IEEE_CMD_MLME 4
616
#define IEEE_PARAM_WPA_ENABLED 1
617
#define IEEE_PARAM_TKIP_COUNTERMEASURES 2
618
#define IEEE_PARAM_DROP_UNENCRYPTED 3
619
#define IEEE_PARAM_PRIVACY_INVOKED 4
620
#define IEEE_PARAM_AUTH_ALGS 5
621
#define IEEE_PARAM_IEEE_802_1X 6
622
#define IEEE_PARAM_WPAX_SELECT 7
623
#define IEEE_PROTO_WPA 1
624
#define IEEE_PROTO_RSN 2
625
#define IEEE_WPAX_USEGROUP 0
626
#define IEEE_WPAX_WEP40 1
627
#define IEEE_WPAX_TKIP 2
628
#define IEEE_WPAX_WRAP 3
629
#define IEEE_WPAX_CCMP 4
630
#define IEEE_WPAX_WEP104 5
632
#define IEEE_KEY_MGMT_IEEE8021X 1
633
#define IEEE_KEY_MGMT_PSK 2
635
#define IEEE_MLME_STA_DEAUTH 1
636
#define IEEE_MLME_STA_DISASSOC 2
639
#define IEEE_CRYPT_ERR_UNKNOWN_ALG 2
640
#define IEEE_CRYPT_ERR_UNKNOWN_ADDR 3
641
#define IEEE_CRYPT_ERR_CRYPT_INIT_FAILED 4
642
#define IEEE_CRYPT_ERR_KEY_SET_FAILED 5
643
#define IEEE_CRYPT_ERR_TX_KEY_SET_FAILED 6
644
#define IEEE_CRYPT_ERR_CARD_CONF_FAILED 7
645
#define IEEE_CRYPT_ALG_NAME_LEN 16
647
#define MAX_IE_LEN 0xff
648
#ifdef _RTL8192_EXT_PATCH_
649
#define ENABLE_NULL_PT_DEBUG
651
#ifdef ENABLE_NULL_PT_DEBUG
652
#define RT_ASSERT_RET(_Exp) \
655
printk("Rtl819x: "); \
656
printk( "Assertion failed! %s,%s,line=%d\n", \
657
#_Exp,__FUNCTION__,__LINE__); \
660
#define RT_ASSERT_RET_VALUE(_Exp,Ret) \
663
printk("Rtl819x: "); \
664
printk( "Assertion failed! %s,%s,line=%d\n", \
665
#_Exp,__FUNCTION__,__LINE__); \
669
#define RT_ASSERT_RET(_Exp) do {} while(0)
670
#define RT_ASSERT_RET_VALUE(_Exp,Ret) do {} while(0)
673
typedef struct ieee_param {
675
u8 sta_addr[ETH_ALEN];
691
u8 alg[IEEE_CRYPT_ALG_NAME_LEN];
695
u8 seq[8]; /* sequence counter (set: RX, get: TX) */
703
#if WIRELESS_EXT < 17
704
#define IW_QUAL_QUAL_INVALID 0x10
705
#define IW_QUAL_LEVEL_INVALID 0x20
706
#define IW_QUAL_NOISE_INVALID 0x40
707
#define IW_QUAL_QUAL_UPDATED 0x1
708
#define IW_QUAL_LEVEL_UPDATED 0x2
709
#define IW_QUAL_NOISE_UPDATED 0x4
712
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
713
#define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000)
714
static inline unsigned long msleep_interruptible_rsl(unsigned int msecs)
716
unsigned long timeout = MSECS(msecs) + 1;
719
set_current_state(TASK_INTERRUPTIBLE);
720
timeout = schedule_timeout(timeout);
725
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31))
726
static inline void msleep(unsigned int msecs)
728
unsigned long timeout = MSECS(msecs) + 1;
731
set_current_state(TASK_UNINTERRUPTIBLE);
732
timeout = schedule_timeout(timeout);
737
#define MSECS(t) msecs_to_jiffies(t)
738
#define msleep_interruptible_rsl msleep_interruptible
741
#define RTLLIB_DATA_LEN 2304
742
/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
745
The figure in section 7.1.2 suggests a body size of up to 2312
746
bytes is allowed, which is a bit confusing, I suspect this
747
represents the 2304 bytes of real data, plus a possible 8 bytes of
748
WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
749
#define RTLLIB_1ADDR_LEN 10
750
#define RTLLIB_2ADDR_LEN 16
751
#define RTLLIB_3ADDR_LEN 24
752
#define RTLLIB_4ADDR_LEN 30
753
#define RTLLIB_FCS_LEN 4
754
#define RTLLIB_HLEN (RTLLIB_4ADDR_LEN)
755
#define RTLLIB_FRAME_LEN (RTLLIB_DATA_LEN + RTLLIB_HLEN)
756
#define RTLLIB_MGMT_HDR_LEN 24
757
#define RTLLIB_DATA_HDR3_LEN 24
758
#define RTLLIB_DATA_HDR4_LEN 30
760
#define RTLLIB_SKBBUFFER_SIZE 2500
762
#define MIN_FRAG_THRESHOLD 256U
763
#define MAX_FRAG_THRESHOLD 2346U
764
#define MAX_HT_DATA_FRAG_THRESHOLD 0x2000
766
#define HT_AMSDU_SIZE_4K 3839
767
#define HT_AMSDU_SIZE_8K 7935
769
/* Frame control field constants */
770
#define RTLLIB_FCTL_VERS 0x0003
771
#define RTLLIB_FCTL_FTYPE 0x000c
772
#define RTLLIB_FCTL_STYPE 0x00f0
773
#define RTLLIB_FCTL_FRAMETYPE 0x00fc
774
#define RTLLIB_FCTL_TODS 0x0100
775
#define RTLLIB_FCTL_FROMDS 0x0200
776
#define RTLLIB_FCTL_DSTODS 0x0300
777
#define RTLLIB_FCTL_MOREFRAGS 0x0400
778
#define RTLLIB_FCTL_RETRY 0x0800
779
#define RTLLIB_FCTL_PM 0x1000
780
#define RTLLIB_FCTL_MOREDATA 0x2000
781
#define RTLLIB_FCTL_WEP 0x4000
782
#define RTLLIB_FCTL_ORDER 0x8000
784
#define RTLLIB_FTYPE_MGMT 0x0000
785
#define RTLLIB_FTYPE_CTL 0x0004
786
#define RTLLIB_FTYPE_DATA 0x0008
789
#define RTLLIB_STYPE_ASSOC_REQ 0x0000
790
#define RTLLIB_STYPE_ASSOC_RESP 0x0010
791
#define RTLLIB_STYPE_REASSOC_REQ 0x0020
792
#define RTLLIB_STYPE_REASSOC_RESP 0x0030
793
#define RTLLIB_STYPE_PROBE_REQ 0x0040
794
#define RTLLIB_STYPE_PROBE_RESP 0x0050
795
#define RTLLIB_STYPE_BEACON 0x0080
796
#define RTLLIB_STYPE_ATIM 0x0090
797
#define RTLLIB_STYPE_DISASSOC 0x00A0
798
#define RTLLIB_STYPE_AUTH 0x00B0
799
#define RTLLIB_STYPE_DEAUTH 0x00C0
800
#define RTLLIB_STYPE_MANAGE_ACT 0x00D0
801
#ifdef _RTL8192_EXT_PATCH_
802
/* added for mesh action frame type */
803
#ifdef COMPATIBLE_WITH_RALINK_MESH
804
#define RTLLIB_STYPE_MESH_ACT 0x00F0
806
#define RTLLIB_STYPE_MESH_ACT RTLLIB_STYPE_MANAGE_ACT
811
#define RTLLIB_STYPE_PSPOLL 0x00A0
812
#define RTLLIB_STYPE_RTS 0x00B0
813
#define RTLLIB_STYPE_CTS 0x00C0
814
#define RTLLIB_STYPE_ACK 0x00D0
815
#define RTLLIB_STYPE_CFEND 0x00E0
816
#define RTLLIB_STYPE_CFENDACK 0x00F0
817
#define RTLLIB_STYPE_BLOCKACK 0x0094
820
#define RTLLIB_STYPE_DATA 0x0000
821
#define RTLLIB_STYPE_DATA_CFACK 0x0010
822
#define RTLLIB_STYPE_DATA_CFPOLL 0x0020
823
#define RTLLIB_STYPE_DATA_CFACKPOLL 0x0030
824
#define RTLLIB_STYPE_NULLFUNC 0x0040
825
#define RTLLIB_STYPE_CFACK 0x0050
826
#define RTLLIB_STYPE_CFPOLL 0x0060
827
#define RTLLIB_STYPE_CFACKPOLL 0x0070
828
#define RTLLIB_STYPE_QOS_DATA 0x0080
829
#define RTLLIB_STYPE_QOS_NULL 0x00C0
831
#define RTLLIB_SCTL_FRAG 0x000F
832
#define RTLLIB_SCTL_SEQ 0xFFF0
835
#define RTLLIB_QCTL_TID 0x000F
837
#define FC_QOS_BIT BIT7
838
#define IsDataFrame(pdu) ( ((pdu[0] & 0x0C)==0x08) ? true : false )
839
#define IsLegacyDataFrame(pdu) (IsDataFrame(pdu) && (!(pdu[0]&FC_QOS_BIT)) )
840
#define IsQoSDataFrame(pframe) ((*(u16*)pframe&(RTLLIB_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA)) == (RTLLIB_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA))
841
#define Frame_Order(pframe) (*(u16*)pframe&RTLLIB_FCTL_ORDER)
842
#define SN_LESS(a, b) (((a-b)&0x800)!=0)
843
#define SN_EQUAL(a, b) (a == b)
844
#define MAX_DEV_ADDR_SIZE 8
846
typedef enum _ACT_CATEGORY{
852
#ifdef _RTL8192_EXT_PATCH_
853
ACT_CAT_MESH_PEERLINK_MGNT = 0x0f,
854
ACT_CAT_MESH_LINK_METRIC = 0x10,
855
ACT_CAT_MESH_PATH_SELECT = 0x11,
856
ACT_CAT_MESH_INTERWORKING = 0x12,
857
ACT_CAT_MESH_SECURITY_INFO = 35,
859
} ACT_CATEGORY, *PACT_CATEGORY;
861
typedef enum _TS_ACTION{
866
} TS_ACTION, *PTS_ACTION;
868
typedef enum _BA_ACTION{
872
} BA_ACTION, *PBA_ACTION;
873
#ifdef _RTL8192_EXT_PATCH_
874
typedef enum _PEERLINK_ACTION{
875
ACT_PEERLINK_OPEN = 0,
876
ACT_PEERLINK_CONFIRM = 1,
877
ACT_PEERLINK_CLOSE =2,
878
} PEERLINK_ACTION, *PPEERLINK_ACTION;
880
typedef enum _LINK_METRIC_ACTION{
881
ACT_LINKMETRIC_REQ = 0,
882
ACT_LINKMETRIC_RSP = 1,
883
} LINK_METRIC_ACTION, *PLINK_METRIC_ACTION;
885
typedef enum _PATH_SELECT_ACTION{
890
} PATH_SELECT_ACTION, *PPATH_SELECT_ACTION;
892
typedef enum _MESH_PEERING_PROTOCOL_VERSION_VALUE{
893
Mesh_Peering_Management_Protocol_V =42,
894
Abbreviated_Handshake_Protocol_V = 43,
895
}MESH_PEERING_PROTOCOL_VERSION_VALUE;
898
typedef enum _InitialGainOpType{
903
typedef enum _LED_CTL_MODE{
904
LED_CTL_POWER_ON = 1,
909
LED_CTL_SITE_SURVEY = 6,
910
LED_CTL_POWER_OFF = 7,
911
LED_CTL_START_TO_LINK = 8,
912
LED_CTL_START_WPS = 9,
913
LED_CTL_STOP_WPS = 10,
914
LED_CTL_START_WPS_BOTTON = 11,
915
LED_CTL_STOP_WPS_FAIL = 12,
916
LED_CTL_STOP_WPS_FAIL_OVERLAP = 13,
919
typedef enum _RT_RF_TYPE_DEF
929
typedef enum _WIRELESS_MODE {
930
WIRELESS_MODE_UNKNOWN = 0x00,
931
WIRELESS_MODE_A = 0x01,
932
WIRELESS_MODE_B = 0x02,
933
WIRELESS_MODE_G = 0x04,
934
WIRELESS_MODE_AUTO = 0x08,
935
WIRELESS_MODE_N_24G = 0x10,
936
WIRELESS_MODE_N_5G = 0x20
939
typedef enum _NETWORK_TYPE{
944
} WIRELESS_NETWORK_TYPE;
946
#define OUI_SUBTYPE_WMM_INFO 0
947
#define OUI_SUBTYPE_WMM_PARAM 1
948
#define OUI_SUBTYPE_QOS_CAPABI 5
951
#define CONFIG_RTLLIB_DEBUG
952
#ifdef CONFIG_RTLLIB_DEBUG
953
extern u32 rtllib_debug_level;
954
#define RTLLIB_DEBUG(level, fmt, args...) \
955
do { if (rtllib_debug_level & (level)) \
956
printk(KERN_DEBUG "rtllib: " fmt, ## args); } while (0)
957
#define RTLLIB_DEBUG_DATA(level, data, datalen) \
958
do{ if ((rtllib_debug_level & (level)) == (level)) \
961
u8* pdata = (u8*) data; \
962
printk(KERN_DEBUG "rtllib: %s()\n", __FUNCTION__); \
963
for(i=0; i<(int)(datalen); i++) \
965
printk("%2.2x ", pdata[i]); \
966
if ((i+1)%16 == 0) printk("\n"); \
972
#define RTLLIB_DEBUG(level, fmt, args...) do {} while (0)
973
#define RTLLIB_DEBUG_DATA(level, data, datalen) do {} while(0)
974
#endif /* CONFIG_RTLLIB_DEBUG */
976
/* debug macros not dependent on CONFIG_RTLLIB_DEBUG */
978
#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
979
#define MAC_ARG(x) ((u8*)(x))[0],((u8*)(x))[1],((u8*)(x))[2],((u8*)(x))[3],((u8*)(x))[4],((u8*)(x))[5]
982
* To use the debug system;
984
* If you are defining a new debug classification, simply add it to the #define
985
* list here in the form of:
987
* #define RTLLIB_DL_xxxx VALUE
989
* shifting value to the left one bit from the previous entry. xxxx should be
990
* the name of the classification (for example, WEP)
992
* You then need to either add a RTLLIB_xxxx_DEBUG() macro definition for your
993
* classification, or use RTLLIB_DEBUG(RTLLIB_DL_xxxx, ...) whenever you want
994
* to send output to that classification.
996
* To add your debug level to the list of levels seen when you perform
998
* % cat /proc/net/ipw/debug_level
1000
* you simply need to add your entry to the ipw_debug_levels array.
1002
* If you do not see debug_level in /proc/net/ipw then you do not have
1003
* CONFIG_RTLLIB_DEBUG defined in your kernel configuration
1007
#define RTLLIB_DL_INFO (1<<0)
1008
#define RTLLIB_DL_WX (1<<1)
1009
#define RTLLIB_DL_SCAN (1<<2)
1010
#define RTLLIB_DL_STATE (1<<3)
1011
#define RTLLIB_DL_MGMT (1<<4)
1012
#define RTLLIB_DL_FRAG (1<<5)
1013
#define RTLLIB_DL_EAP (1<<6)
1014
#define RTLLIB_DL_DROP (1<<7)
1016
#define RTLLIB_DL_TX (1<<8)
1017
#define RTLLIB_DL_RX (1<<9)
1019
#define RTLLIB_DL_HT (1<<10)
1020
#define RTLLIB_DL_BA (1<<11)
1021
#define RTLLIB_DL_TS (1<<12)
1022
#define RTLLIB_DL_QOS (1<<13)
1023
#define RTLLIB_DL_REORDER (1<<14)
1024
#define RTLLIB_DL_IOT (1<<15)
1025
#define RTLLIB_DL_IPS (1<<16)
1026
#define RTLLIB_DL_TRACE (1<<29)
1027
#define RTLLIB_DL_DATA (1<<30)
1028
#define RTLLIB_DL_ERR (1<<31)
1029
#define RTLLIB_ERROR(f, a...) printk(KERN_ERR "rtllib: " f, ## a)
1030
#define RTLLIB_WARNING(f, a...) printk(KERN_WARNING "rtllib: " f, ## a)
1031
#define RTLLIB_DEBUG_INFO(f, a...) RTLLIB_DEBUG(RTLLIB_DL_INFO, f, ## a)
1033
#define RTLLIB_DEBUG_WX(f, a...) RTLLIB_DEBUG(RTLLIB_DL_WX, f, ## a)
1034
#define RTLLIB_DEBUG_SCAN(f, a...) RTLLIB_DEBUG(RTLLIB_DL_SCAN, f, ## a)
1035
#define RTLLIB_DEBUG_STATE(f, a...) RTLLIB_DEBUG(RTLLIB_DL_STATE, f, ## a)
1036
#define RTLLIB_DEBUG_MGMT(f, a...) RTLLIB_DEBUG(RTLLIB_DL_MGMT, f, ## a)
1037
#define RTLLIB_DEBUG_FRAG(f, a...) RTLLIB_DEBUG(RTLLIB_DL_FRAG, f, ## a)
1038
#define RTLLIB_DEBUG_EAP(f, a...) RTLLIB_DEBUG(RTLLIB_DL_EAP, f, ## a)
1039
#define RTLLIB_DEBUG_DROP(f, a...) RTLLIB_DEBUG(RTLLIB_DL_DROP, f, ## a)
1040
#define RTLLIB_DEBUG_TX(f, a...) RTLLIB_DEBUG(RTLLIB_DL_TX, f, ## a)
1041
#define RTLLIB_DEBUG_RX(f, a...) RTLLIB_DEBUG(RTLLIB_DL_RX, f, ## a)
1042
#define RTLLIB_DEBUG_QOS(f, a...) RTLLIB_DEBUG(RTLLIB_DL_QOS, f, ## a)
1044
#ifdef CONFIG_RTLLIB_DEBUG
1045
/* Added by Annie, 2005-11-22. */
1046
#define MAX_STR_LEN 64
1047
/* I want to see ASCII 33 to 126 only. Otherwise, I print '?'. Annie, 2005-11-22.*/
1048
#define PRINTABLE(_ch) (_ch>'!' && _ch<'~')
1049
#define RTLLIB_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) \
1050
if((_Comp) & level) \
1053
u8 buffer[MAX_STR_LEN]; \
1054
int length = (_Len<MAX_STR_LEN)? _Len : (MAX_STR_LEN-1) ; \
1055
memset(buffer, 0, MAX_STR_LEN); \
1056
memcpy(buffer, (u8 *)_Ptr, length ); \
1057
for( __i=0; __i<MAX_STR_LEN; __i++ ) \
1059
if( !PRINTABLE(buffer[__i]) ) buffer[__i] = '?'; \
1061
buffer[length] = '\0'; \
1062
printk("Rtl819x: "); \
1063
printk(_TitleString); \
1064
printk(": %d, <%s>\n", _Len, buffer); \
1067
#define RTLLIB_PRINT_STR(_Comp, _TitleString, _Ptr, _Len) do {} while (0)
1071
#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
1072
#define ETH_P_IP 0x0800 /* Internet Protocol packet */
1073
#define ETH_P_ARP 0x0806 /* Address Resolution packet */
1074
#endif /* ETH_P_PAE */
1076
#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
1078
#ifndef ETH_P_80211_RAW
1079
#define ETH_P_80211_RAW (ETH_P_ECONET + 1)
1082
/* IEEE 802.11 defines */
1084
#define P80211_OUI_LEN 3
1086
struct rtllib_snap_hdr {
1088
u8 dsap; /* always 0xAA */
1089
u8 ssap; /* always 0xAA */
1090
u8 ctrl; /* always 0x03 */
1091
u8 oui[P80211_OUI_LEN]; /* organizational universal id */
1093
} __attribute__ ((packed));
1095
enum _REG_PREAMBLE_MODE{
1101
#define SNAP_SIZE sizeof(struct rtllib_snap_hdr)
1103
#define WLAN_FC_GET_VERS(fc) ((fc) & RTLLIB_FCTL_VERS)
1104
#define WLAN_FC_GET_TYPE(fc) ((fc) & RTLLIB_FCTL_FTYPE)
1105
#define WLAN_FC_GET_STYPE(fc) ((fc) & RTLLIB_FCTL_STYPE)
1106
#define WLAN_FC_MORE_DATA(fc) ((fc) & RTLLIB_FCTL_MOREDATA)
1108
#define WLAN_FC_GET_FRAMETYPE(fc) ((fc) & RTLLIB_FCTL_FRAMETYPE)
1109
#define WLAN_GET_SEQ_FRAG(seq) ((seq) & RTLLIB_SCTL_FRAG)
1110
#define WLAN_GET_SEQ_SEQ(seq) (((seq) & RTLLIB_SCTL_SEQ) >> 4)
1112
#ifndef CONFIG_CFG_80211
1113
/* Authentication algorithms */
1114
#define WLAN_AUTH_OPEN 0
1115
#define WLAN_AUTH_SHARED_KEY 1
1116
#define WLAN_AUTH_LEAP 128
1118
#define WLAN_AUTH_CHALLENGE_LEN 128
1120
#define WLAN_CAPABILITY_ESS (1<<0)
1121
#define WLAN_CAPABILITY_IBSS (1<<1)
1122
#define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
1123
#define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
1124
#define WLAN_CAPABILITY_PRIVACY (1<<4)
1125
#define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
1126
#define WLAN_CAPABILITY_PBCC (1<<6)
1127
#define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
1128
#define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
1129
#define WLAN_CAPABILITY_QOS (1<<9)
1130
#define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
1131
#define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
1133
/* 802.11g ERP information element */
1134
#define WLAN_ERP_NON_ERP_PRESENT (1<<0)
1135
#define WLAN_ERP_USE_PROTECTION (1<<1)
1136
#define WLAN_ERP_BARKER_PREAMBLE (1<<2)
1139
enum rtllib_statuscode {
1140
WLAN_STATUS_SUCCESS = 0,
1141
WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
1142
WLAN_STATUS_CAPS_UNSUPPORTED = 10,
1143
WLAN_STATUS_REASSOC_NO_ASSOC = 11,
1144
WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
1145
WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
1146
WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
1147
WLAN_STATUS_CHALLENGE_FAIL = 15,
1148
WLAN_STATUS_AUTH_TIMEOUT = 16,
1149
WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
1150
WLAN_STATUS_ASSOC_DENIED_RATES = 18,
1152
WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
1153
WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
1154
WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
1156
WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
1157
WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
1158
WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
1160
WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
1161
WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
1163
WLAN_STATUS_INVALID_IE = 40,
1164
WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
1165
WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
1166
WLAN_STATUS_INVALID_AKMP = 43,
1167
WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
1168
WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
1169
WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
1173
enum rtllib_reasoncode {
1174
WLAN_REASON_UNSPECIFIED = 1,
1175
WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
1176
WLAN_REASON_DEAUTH_LEAVING = 3,
1177
WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
1178
WLAN_REASON_DISASSOC_AP_BUSY = 5,
1179
WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
1180
WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
1181
WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
1182
WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
1184
WLAN_REASON_DISASSOC_BAD_POWER = 10,
1185
WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
1187
WLAN_REASON_INVALID_IE = 13,
1188
WLAN_REASON_MIC_FAILURE = 14,
1189
WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
1190
WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
1191
WLAN_REASON_IE_DIFFERENT = 17,
1192
WLAN_REASON_INVALID_GROUP_CIPHER = 18,
1193
WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
1194
WLAN_REASON_INVALID_AKMP = 20,
1195
WLAN_REASON_UNSUPP_RSN_VERSION = 21,
1196
WLAN_REASON_INVALID_RSN_IE_CAP = 22,
1197
WLAN_REASON_IEEE8021X_FAILED = 23,
1198
WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
1202
#define RTLLIB_STATMASK_SIGNAL (1<<0)
1203
#define RTLLIB_STATMASK_RSSI (1<<1)
1204
#define RTLLIB_STATMASK_NOISE (1<<2)
1205
#define RTLLIB_STATMASK_RATE (1<<3)
1206
#define RTLLIB_STATMASK_WEMASK 0x7
1208
#define RTLLIB_CCK_MODULATION (1<<0)
1209
#define RTLLIB_OFDM_MODULATION (1<<1)
1211
#define RTLLIB_24GHZ_BAND (1<<0)
1212
#define RTLLIB_52GHZ_BAND (1<<1)
1214
#define RTLLIB_CCK_RATE_LEN 4
1215
#define RTLLIB_CCK_RATE_1MB 0x02
1216
#define RTLLIB_CCK_RATE_2MB 0x04
1217
#define RTLLIB_CCK_RATE_5MB 0x0B
1218
#define RTLLIB_CCK_RATE_11MB 0x16
1219
#define RTLLIB_OFDM_RATE_LEN 8
1220
#define RTLLIB_OFDM_RATE_6MB 0x0C
1221
#define RTLLIB_OFDM_RATE_9MB 0x12
1222
#define RTLLIB_OFDM_RATE_12MB 0x18
1223
#define RTLLIB_OFDM_RATE_18MB 0x24
1224
#define RTLLIB_OFDM_RATE_24MB 0x30
1225
#define RTLLIB_OFDM_RATE_36MB 0x48
1226
#define RTLLIB_OFDM_RATE_48MB 0x60
1227
#define RTLLIB_OFDM_RATE_54MB 0x6C
1228
#define RTLLIB_BASIC_RATE_MASK 0x80
1230
#define RTLLIB_CCK_RATE_1MB_MASK (1<<0)
1231
#define RTLLIB_CCK_RATE_2MB_MASK (1<<1)
1232
#define RTLLIB_CCK_RATE_5MB_MASK (1<<2)
1233
#define RTLLIB_CCK_RATE_11MB_MASK (1<<3)
1234
#define RTLLIB_OFDM_RATE_6MB_MASK (1<<4)
1235
#define RTLLIB_OFDM_RATE_9MB_MASK (1<<5)
1236
#define RTLLIB_OFDM_RATE_12MB_MASK (1<<6)
1237
#define RTLLIB_OFDM_RATE_18MB_MASK (1<<7)
1238
#define RTLLIB_OFDM_RATE_24MB_MASK (1<<8)
1239
#define RTLLIB_OFDM_RATE_36MB_MASK (1<<9)
1240
#define RTLLIB_OFDM_RATE_48MB_MASK (1<<10)
1241
#define RTLLIB_OFDM_RATE_54MB_MASK (1<<11)
1243
#define RTLLIB_CCK_RATES_MASK 0x0000000F
1244
#define RTLLIB_CCK_BASIC_RATES_MASK (RTLLIB_CCK_RATE_1MB_MASK | \
1245
RTLLIB_CCK_RATE_2MB_MASK)
1246
#define RTLLIB_CCK_DEFAULT_RATES_MASK (RTLLIB_CCK_BASIC_RATES_MASK | \
1247
RTLLIB_CCK_RATE_5MB_MASK | \
1248
RTLLIB_CCK_RATE_11MB_MASK)
1250
#define RTLLIB_OFDM_RATES_MASK 0x00000FF0
1251
#define RTLLIB_OFDM_BASIC_RATES_MASK (RTLLIB_OFDM_RATE_6MB_MASK | \
1252
RTLLIB_OFDM_RATE_12MB_MASK | \
1253
RTLLIB_OFDM_RATE_24MB_MASK)
1254
#define RTLLIB_OFDM_DEFAULT_RATES_MASK (RTLLIB_OFDM_BASIC_RATES_MASK | \
1255
RTLLIB_OFDM_RATE_9MB_MASK | \
1256
RTLLIB_OFDM_RATE_18MB_MASK | \
1257
RTLLIB_OFDM_RATE_36MB_MASK | \
1258
RTLLIB_OFDM_RATE_48MB_MASK | \
1259
RTLLIB_OFDM_RATE_54MB_MASK)
1260
#define RTLLIB_DEFAULT_RATES_MASK (RTLLIB_OFDM_DEFAULT_RATES_MASK | \
1261
RTLLIB_CCK_DEFAULT_RATES_MASK)
1263
#define RTLLIB_NUM_OFDM_RATES 8
1264
#define RTLLIB_NUM_CCK_RATES 4
1265
#define RTLLIB_OFDM_SHIFT_MASK_A 4
1268
/* this is stolen and modified from the madwifi driver*/
1269
#define RTLLIB_FC0_TYPE_MASK 0x0c
1270
#define RTLLIB_FC0_TYPE_DATA 0x08
1271
#define RTLLIB_FC0_SUBTYPE_MASK 0xB0
1272
#define RTLLIB_FC0_SUBTYPE_QOS 0x80
1274
#define RTLLIB_QOS_HAS_SEQ(fc) \
1275
(((fc) & (RTLLIB_FC0_TYPE_MASK | RTLLIB_FC0_SUBTYPE_MASK)) == \
1276
(RTLLIB_FC0_TYPE_DATA | RTLLIB_FC0_SUBTYPE_QOS))
1278
/* this is stolen from ipw2200 driver */
1279
#define IEEE_IBSS_MAC_HASH_SIZE 31
1280
struct ieee_ibss_seq {
1284
unsigned long packet_time[17];
1285
struct list_head list;
1288
#ifdef _RTL8192_EXT_PATCH_
1289
struct ieee_mesh_seq {
1293
unsigned long packet_time[17];
1294
struct list_head list;
1297
/* NOTE: This data is for statistical purposes; not all hardware provides this
1298
* information for frames received. Not setting these will not cause
1299
* any adverse affects. */
1300
struct rtllib_rx_stats {
1306
u16 rate; /* in 100 kbps */
1307
u8 received_channel;
1317
s32 RecvSignalPower;
1323
u16 bShortPreamble:1;
1340
bool RxIs40MHzPacket;
1342
u8 RxMIMOSignalStrength[4];
1343
s8 RxMIMOSignalQuality[2];
1344
bool bPacketMatchBSSID;
1347
u8* virtual_address;
1352
bool bisrxaggrsubframe;
1355
char cck_adc_pwdb[4];
1358
#ifdef TCP_CSUM_OFFLOAD_RX
1361
#if defined (RTL8192S_WAPI_SUPPORT)
1364
u8 bWapiCheckPNInDecrypt;
1370
/* IEEE 802.11 requires that STA supports concurrent reception of at least
1371
* three fragmented frames. This define can be increased to support more
1372
* concurrent frames, but it should be noted that each entry can consume about
1373
* 2 kB of RAM and increasing cache size will slow down frame reassembly. */
1374
#define RTLLIB_FRAG_CACHE_LEN 4
1376
struct rtllib_frag_entry {
1377
unsigned long first_frag_time;
1379
unsigned int last_frag;
1380
struct sk_buff *skb;
1381
u8 src_addr[ETH_ALEN];
1382
u8 dst_addr[ETH_ALEN];
1385
struct rtllib_stats {
1386
unsigned int tx_unicast_frames;
1387
unsigned int tx_multicast_frames;
1388
unsigned int tx_fragments;
1389
unsigned int tx_unicast_octets;
1390
unsigned int tx_multicast_octets;
1391
unsigned int tx_deferred_transmissions;
1392
unsigned int tx_single_retry_frames;
1393
unsigned int tx_multiple_retry_frames;
1394
unsigned int tx_retry_limit_exceeded;
1395
unsigned int tx_discards;
1396
unsigned int rx_unicast_frames;
1397
unsigned int rx_multicast_frames;
1398
unsigned int rx_fragments;
1399
unsigned int rx_unicast_octets;
1400
unsigned int rx_multicast_octets;
1401
unsigned int rx_fcs_errors;
1402
unsigned int rx_discards_no_buffer;
1403
unsigned int tx_discards_wrong_sa;
1404
unsigned int rx_discards_undecryptable;
1405
unsigned int rx_message_in_msg_fragments;
1406
unsigned int rx_message_in_bad_msg_fragments;
1409
struct rtllib_device;
1411
#include "rtllib_crypt.h"
1413
#define SEC_KEY_1 (1<<0)
1414
#define SEC_KEY_2 (1<<1)
1415
#define SEC_KEY_3 (1<<2)
1416
#define SEC_KEY_4 (1<<3)
1417
#define SEC_ACTIVE_KEY (1<<4)
1418
#define SEC_AUTH_MODE (1<<5)
1419
#define SEC_UNICAST_GROUP (1<<6)
1420
#define SEC_LEVEL (1<<7)
1421
#define SEC_ENABLED (1<<8)
1422
#define SEC_ENCRYPT (1<<9)
1424
#define SEC_LEVEL_0 0 /* None */
1425
#define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */
1426
#define SEC_LEVEL_2 2 /* Level 1 + TKIP */
1427
#define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */
1428
#define SEC_LEVEL_3 4 /* Level 2 + CCMP */
1430
#define SEC_ALG_NONE 0
1431
#define SEC_ALG_WEP 1
1432
#define SEC_ALG_TKIP 2
1433
#define SEC_ALG_CCMP 4
1436
#define WEP_KEY_LEN 13
1437
#define SCM_KEY_LEN 32
1438
#define SCM_TEMPORAL_KEY_LENGTH 16
1440
struct rtllib_security {
1445
unicast_uses_group:1,
1447
u8 key_sizes[WEP_KEYS];
1448
u8 keys[WEP_KEYS][SCM_KEY_LEN];
1451
} __attribute__ ((packed));
1455
802.11 data frame from AP
1456
,-------------------------------------------------------------------.
1457
Bytes | 2 | 2 | 6 | 6 | 6 | 2 | 0..2312 | 4 |
1458
|------|------|---------|---------|---------|------|---------|------|
1459
Desc. | ctrl | dura | DA/RA | TA | SA | Sequ | frame | fcs |
1460
| | tion | (BSSID) | | | ence | data | |
1461
`-------------------------------------------------------------------'
1462
Total: 28-2340 bytes
1465
/* Management Frame Information Element Types */
1468
MFIE_TYPE_RATES = 1,
1469
MFIE_TYPE_FH_SET = 2,
1470
MFIE_TYPE_DS_SET = 3,
1471
MFIE_TYPE_CF_SET = 4,
1473
MFIE_TYPE_IBSS_SET = 6,
1474
MFIE_TYPE_COUNTRY = 7,
1475
MFIE_TYPE_HOP_PARAMS = 8,
1476
MFIE_TYPE_HOP_TABLE = 9,
1477
MFIE_TYPE_REQUEST = 10,
1478
MFIE_TYPE_CHALLENGE = 16,
1479
MFIE_TYPE_POWER_CONSTRAINT = 32,
1480
MFIE_TYPE_POWER_CAPABILITY = 33,
1481
MFIE_TYPE_TPC_REQUEST = 34,
1482
MFIE_TYPE_TPC_REPORT = 35,
1483
MFIE_TYPE_SUPP_CHANNELS = 36,
1485
MFIE_TYPE_MEASURE_REQUEST = 38,
1486
MFIE_TYPE_MEASURE_REPORT = 39,
1487
MFIE_TYPE_QUIET = 40,
1488
MFIE_TYPE_IBSS_DFS = 41,
1490
MFIE_TYPE_HT_CAP= 45,
1492
MFIE_TYPE_RATES_EX = 50,
1493
#ifdef _RTL8192_EXT_PATCH_
1494
MFIE_TYPE_MESH_PANN = 51,
1495
MFIE_TYPE_MESH_RANN = 52,
1496
MFIE_TYPE_MESH_PATH_REQ = 138,
1497
MFIE_TYPE_MESH_PATH_REP = 139,
1498
MFIE_TYPE_MESH_PATH_ERR = 140,
1500
MFIE_TYPE_HT_INFO= 61,
1501
#if defined (RTL8192S_WAPI_SUPPORT)
1502
MFIE_TYPE_WAPI = 68,
1504
MFIE_TYPE_AIRONET=133,
1505
#ifdef _RTL8192_EXT_PATCH_
1506
MFIE_TYPE_MESH_CONFIGURATION = 121,
1507
MFIE_TYPE_MESH_ID = 122,
1508
MFIE_TYPE_MESH_LOCAL_LINK_STATE_ANNOU = 138,
1509
MFIE_TYPE_MESH_ABBR_HANDSHAKE_IE_ =139,
1510
MFIE_TYPE_MESH_PEER_LINK_MGNT = 125,
1511
MFIE_TYPE_MESH_NEIGHBOR_LIST = 142,
1512
MFIE_TYPE_MESH_TIM = 143,
1513
MFIE_TYPE_MESH_ATIM_WINDOW = 144,
1514
MFIE_TYPE_MESH_BEACON_TIMING = 145,
1515
MFIE_TYPE_MESH_MDAOP_ADVERTISMENTS = 148,
1516
MFIE_TYPE_MESH_MSC = 149,
1517
MFIE_TYPE_MESH_MSA = 150,
1518
MFIE_TYPE_MESH_MOAOP_SET_TEARDOWN = 212,
1520
MFIE_TYPE_GENERIC = 221,
1521
MFIE_TYPE_QOS_PARAMETER = 222,
1524
/* Minimal header; can be used for passing 802.11 frames with sufficient
1525
* information to determine what type of underlying data type is actually
1526
* stored in the data. */
1527
struct rtllib_pspoll_hdr {
1532
} __attribute__ ((packed));
1538
} __attribute__ ((packed));
1540
struct rtllib_hdr_1addr {
1545
} __attribute__ ((packed));
1547
struct rtllib_hdr_2addr {
1553
} __attribute__ ((packed));
1555
struct rtllib_hdr_3addr {
1563
} __attribute__ ((packed));
1565
struct rtllib_hdr_4addr {
1574
} __attribute__ ((packed));
1576
struct rtllib_hdr_3addrqos {
1585
} __attribute__ ((packed));
1587
struct rtllib_hdr_4addrqos {
1597
} __attribute__ ((packed));
1599
struct rtllib_info_element {
1603
} __attribute__ ((packed));
1605
#ifdef _RTL8192_EXT_PATCH_
1607
struct mesh_peering_protocol_version_t{
1610
} __attribute__ ((packed));
1611
struct rtllib_plink_open {
1612
struct rtllib_hdr_3addr header;
1615
#ifndef COMPATIBLE_WITH_RALINK_MESH
1616
struct mesh_peering_protocol_version_t mesh_peering_protocol_version;
1619
/* SSID, supported rates, RSN */
1620
struct rtllib_info_element info_element[0];
1621
} __attribute__ ((packed));
1623
struct rtllib_plink_confirm {
1624
struct rtllib_hdr_3addr header;
1627
#ifndef COMPATIBLE_WITH_RALINK_MESH
1628
struct mesh_peering_protocol_version_t mesh_peering_protocol_version;
1631
#ifdef COMPATIBLE_WITH_RALINK_MESH
1635
/* SSID, supported rates, RSN */
1636
struct rtllib_info_element info_element[0];
1637
} __attribute__ ((packed));
1639
struct rtllib_plink_close {
1640
struct rtllib_hdr_3addr header;
1643
#ifndef COMPATIBLE_WITH_RALINK_MESH
1644
struct mesh_peering_protocol_version_t mesh_peering_protocol_version;
1646
/* SSID, supported rates, RSN */
1647
struct rtllib_info_element info_element[0];
1648
} __attribute__ ((packed));
1650
struct rtllib_linkmetric_report {
1651
struct rtllib_hdr_3addr header;
1654
struct rtllib_info_element info_element[0];
1655
} __attribute__ ((packed));
1657
struct rtllib_linkmetric_req {
1658
struct rtllib_hdr_3addr header;
1661
} __attribute__ ((packed));
1664
struct rtllib_authentication {
1665
struct rtllib_hdr_3addr header;
1670
struct rtllib_info_element info_element[0];
1671
} __attribute__ ((packed));
1673
struct rtllib_disauth {
1674
struct rtllib_hdr_3addr header;
1676
} __attribute__ ((packed));
1678
struct rtllib_disassoc {
1679
struct rtllib_hdr_3addr header;
1681
} __attribute__ ((packed));
1683
struct rtllib_probe_request {
1684
struct rtllib_hdr_3addr header;
1685
/* SSID, supported rates */
1686
struct rtllib_info_element info_element[0];
1687
} __attribute__ ((packed));
1689
struct rtllib_probe_response {
1690
struct rtllib_hdr_3addr header;
1692
__le16 beacon_interval;
1694
/* SSID, supported rates, FH params, DS params,
1695
* CF params, IBSS params, TIM (if beacon), RSN */
1696
struct rtllib_info_element info_element[0];
1697
} __attribute__ ((packed));
1699
/* Alias beacon for probe_response */
1700
#define rtllib_beacon rtllib_probe_response
1702
struct rtllib_assoc_request_frame {
1703
struct rtllib_hdr_3addr header;
1705
__le16 listen_interval;
1706
/* SSID, supported rates, RSN */
1707
struct rtllib_info_element info_element[0];
1708
} __attribute__ ((packed));
1710
struct rtllib_reassoc_request_frame {
1711
struct rtllib_hdr_3addr header;
1713
__le16 listen_interval;
1714
u8 current_ap[ETH_ALEN];
1715
/* SSID, supported rates, RSN */
1716
struct rtllib_info_element info_element[0];
1717
} __attribute__ ((packed));
1719
struct rtllib_assoc_response_frame {
1720
struct rtllib_hdr_3addr header;
1724
struct rtllib_info_element info_element[0]; /* supported rates */
1725
} __attribute__ ((packed));
1734
__le16 payload_size;
1735
struct sk_buff *fragments[0];
1738
#define MAX_TX_AGG_COUNT 16
1739
struct rtllib_drv_agg_txb {
1740
u8 nr_drv_agg_frames;
1741
struct sk_buff *tx_agg_frames[MAX_TX_AGG_COUNT];
1742
}__attribute__((packed));
1744
#define MAX_SUBFRAME_COUNT 64
1747
struct sk_buff *subframes[MAX_SUBFRAME_COUNT];
1750
#ifdef TCP_CSUM_OFFLOAD_RX
1753
#if defined (RTL8192S_WAPI_SUPPORT)
1757
u8 bWapiCheckPNInDecrypt;
1759
}__attribute__((packed));
1761
typedef union _frameqos {
1771
}frameqos,*pframeqos;
1773
/* SWEEP TABLE ENTRIES NUMBER*/
1774
#define MAX_SWEEP_TAB_ENTRIES 42
1775
#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7
1776
/* MAX_RATES_LENGTH needs to be 12. The spec says 8, and many APs
1777
* only use 8, and then use extended rates for the remaining supported
1778
* rates. Other APs, however, stick all of their supported rates on the
1779
* main rates information element... */
1780
#define MAX_RATES_LENGTH ((u8)12)
1781
#define MAX_RATES_EX_LENGTH ((u8)16)
1782
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
1783
#define MAX_NETWORK_COUNT 16
1785
#define MAX_NETWORK_COUNT 96
1788
#define MAX_CHANNEL_NUMBER 161
1789
#define RTLLIB_SOFTMAC_SCAN_TIME 100
1790
#define RTLLIB_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2)
1792
#define CRC_LENGTH 4U
1794
#define MAX_WPA_IE_LEN 64
1795
#define MAX_WZC_IE_LEN 256
1797
#define NETWORK_EMPTY_ESSID (1<<0)
1798
#define NETWORK_HAS_OFDM (1<<1)
1799
#define NETWORK_HAS_CCK (1<<2)
1802
#define NETWORK_HAS_QOS_PARAMETERS (1<<3)
1803
#define NETWORK_HAS_QOS_INFORMATION (1<<4)
1804
#define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | \
1805
NETWORK_HAS_QOS_INFORMATION)
1807
#define NETWORK_HAS_POWER_CONSTRAINT (1<<5)
1808
#define NETWORK_HAS_CSA (1<<6)
1809
#define NETWORK_HAS_QUIET (1<<7)
1810
#define NETWORK_HAS_IBSS_DFS (1<<8)
1811
#define NETWORK_HAS_TPC_REPORT (1<<9)
1813
#define NETWORK_HAS_ERP_VALUE (1<<10)
1815
#define QOS_QUEUE_NUM 4
1816
#define QOS_OUI_LEN 3
1817
#define QOS_OUI_TYPE 2
1818
#define QOS_ELEMENT_ID 221
1819
#define QOS_OUI_INFO_SUB_TYPE 0
1820
#define QOS_OUI_PARAM_SUB_TYPE 1
1821
#define QOS_VERSION_1 1
1822
#define QOS_AIFSN_MIN_VALUE 2
1824
struct rtllib_qos_information_element {
1827
u8 qui[QOS_OUI_LEN];
1832
} __attribute__ ((packed));
1834
struct rtllib_qos_ac_parameter {
1838
} __attribute__ ((packed));
1840
struct rtllib_qos_parameter_info {
1841
struct rtllib_qos_information_element info_element;
1843
struct rtllib_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
1844
} __attribute__ ((packed));
1846
struct rtllib_qos_parameters {
1847
__le16 cw_min[QOS_QUEUE_NUM];
1848
__le16 cw_max[QOS_QUEUE_NUM];
1849
u8 aifs[QOS_QUEUE_NUM];
1850
u8 flag[QOS_QUEUE_NUM];
1851
__le16 tx_op_limit[QOS_QUEUE_NUM];
1852
} __attribute__ ((packed));
1854
struct rtllib_qos_data {
1855
struct rtllib_qos_parameters parameters;
1856
unsigned int wmm_acm;
1863
struct rtllib_tim_parameters {
1866
} __attribute__ ((packed));
1868
struct rtllib_wmm_ac_param {
1869
u8 ac_aci_acm_aifsn;
1870
u8 ac_ecwmin_ecwmax;
1874
struct rtllib_wmm_ts_info {
1878
} __attribute__ ((packed));
1880
struct rtllib_wmm_tspec_elem {
1881
struct rtllib_wmm_ts_info ts_info;
1888
u32 serv_start_time;
1895
u16 surp_band_allow;
1897
}__attribute__((packed));
1904
EAPOL_ENCAP_ASF_ALERT
1907
static const char *eap_types[] = {
1908
[EAP_PACKET] = "EAP-Packet",
1909
[EAPOL_START] = "EAPOL-Start",
1910
[EAPOL_LOGOFF] = "EAPOL-Logoff",
1911
[EAPOL_KEY] = "EAPOL-Key",
1912
[EAPOL_ENCAP_ASF_ALERT] = "EAPOL-Encap-ASF-Alert"
1915
static inline const char *eap_get_type(int type)
1917
return ((u32)type >= ARRAY_SIZE(eap_types)) ? "Unknown" : eap_types[type];
1919
static inline u8 Frame_QoSTID(u8* buf)
1921
struct rtllib_hdr_3addr *hdr;
1923
hdr = (struct rtllib_hdr_3addr *)buf;
1924
fc = le16_to_cpu(hdr->frame_ctl);
1925
return (u8)((frameqos*)(buf + (((fc & RTLLIB_FCTL_TODS)&&(fc & RTLLIB_FCTL_FROMDS))? 30 : 24)))->field.tid;
1935
} __attribute__ ((packed));
1937
struct rtllib_softmac_stats{
1938
unsigned int rx_ass_ok;
1939
unsigned int rx_ass_err;
1940
unsigned int rx_probe_rq;
1941
unsigned int tx_probe_rs;
1942
unsigned int tx_beacons;
1943
unsigned int rx_auth_rq;
1944
unsigned int rx_auth_rs_ok;
1945
unsigned int rx_auth_rs_err;
1946
unsigned int tx_auth_rq;
1947
unsigned int no_auth_rs;
1948
unsigned int no_ass_rs;
1949
unsigned int tx_ass_rq;
1950
unsigned int rx_ass_rq;
1951
unsigned int tx_probe_rq;
1952
unsigned int reassoc;
1953
unsigned int swtxstop;
1954
unsigned int swtxawake;
1955
unsigned char CurrentShowTxate;
1956
unsigned char last_packet_rate;
1957
unsigned int txretrycount;
1960
#define BEACON_PROBE_SSID_ID_POSITION 12
1962
struct rtllib_info_element_hdr {
1965
} __attribute__ ((packed));
1968
* These are the data types that can make up management packets
1972
u16 beacon_interval;
1974
u8 current_ap[ETH_ALEN];
1975
u16 listen_interval;
1977
u16 association_id:14, reserved:2;
1978
} __attribute__ ((packed));
1984
#define RTLLIB_DEFAULT_TX_ESSID "Penguin"
1985
#define RTLLIB_DEFAULT_BASIC_RATE 2
1986
#ifdef _RTL8192_EXT_PATCH_
1987
#define RTLLIB_DEFAULT_MESHID "CMPC-mesh"
1988
#define RTLLIB_DEFAULT_MESH_CHAN 7
1991
enum {WMM_all_frame, WMM_two_frame, WMM_four_frame, WMM_six_frame};
1992
#define MAX_SP_Len (WMM_all_frame << 4)
1993
#define RTLLIB_QOS_TID 0x0f
1994
#define QOS_CTL_NOTCONTAIN_ACK (0x01 << 5)
1995
#define QOS_CTL_AMSDU_PRESENT (0x01 << 7)
1997
#define RTLLIB_DTIM_MBCAST 4
1998
#define RTLLIB_DTIM_UCAST 2
1999
#define RTLLIB_DTIM_VALID 1
2000
#define RTLLIB_DTIM_INVALID 0
2002
#define RTLLIB_PS_DISABLED 0
2003
#define RTLLIB_PS_UNICAST RTLLIB_DTIM_UCAST
2004
#define RTLLIB_PS_MBCAST RTLLIB_DTIM_MBCAST
2006
#ifdef WMM_Hang_8187
2007
#undef WMM_Hang_8187
2010
#define WME_AC_BK 0x00
2011
#define WME_AC_BE 0x01
2012
#define WME_AC_VI 0x02
2013
#define WME_AC_VO 0x03
2014
#define WME_ACI_MASK 0x03
2015
#define WME_AIFSN_MASK 0x03
2016
#define WME_AC_PRAM_LEN 16
2018
#define MAX_RECEIVE_BUFFER_SIZE 9100
2021
#define UP2AC(up) ( \
2022
((up) < 1) ? WME_AC_BE : \
2023
((up) < 3) ? WME_AC_BK : \
2024
((up) < 4) ? WME_AC_BE : \
2025
((up) < 6) ? WME_AC_VI : \
2028
#define AC2UP(_ac) ( \
2029
((_ac) == WME_AC_VO) ? 6 : \
2030
((_ac) == WME_AC_VI) ? 5 : \
2031
((_ac) == WME_AC_BK) ? 1 : \
2034
#define ETHER_ADDR_LEN 6 /* length of an Ethernet address */
2035
#define ETHERNET_HEADER_SIZE 14 /* length of two Ethernet address plus ether type*/
2037
struct ether_header {
2038
u8 ether_dhost[ETHER_ADDR_LEN];
2039
u8 ether_shost[ETHER_ADDR_LEN];
2041
} __attribute__((packed));
2043
#ifndef ETHERTYPE_PAE
2044
#define ETHERTYPE_PAE 0x888e /* EAPOL PAE/802.1x */
2046
#ifndef ETHERTYPE_IP
2047
#define ETHERTYPE_IP 0x0800 /* IP protocol */
2051
typedef enum _erp_t{
2052
ERP_NonERPpresent = 0x01,
2053
ERP_UseProtection = 0x02,
2054
ERP_BarkerPreambleMode = 0x04,
2057
#ifdef _RTL8192_EXT_PATCH_
2058
typedef struct _mesh_config_t {
2059
u8 path_proto_id[4];
2060
u8 path_metric_id[4];
2061
u8 congest_ctl_mode[4];
2062
u8 mesh_capability[2];
2064
#define MESH_CONF_TOTAL_LEN 19
2067
struct rtllib_network {
2068
/* These entries are used to identify a unique network */
2071
/* Ensure null-terminated for any debug msgs */
2072
u8 ssid[IW_ESSID_MAX_SIZE + 1];
2074
u8 hidden_ssid[IW_ESSID_MAX_SIZE + 1];
2076
struct rtllib_qos_data qos_data;
2078
bool bWithAironetIE;
2079
bool bCkipSupported;
2085
bool bWithCcxVerNum;
2087
/* These are network statistics */
2088
struct rtllib_rx_stats stats;
2090
u8 rates[MAX_RATES_LENGTH];
2092
u8 rates_ex[MAX_RATES_EX_LENGTH];
2094
unsigned long last_scanned;
2099
u16 beacon_interval;
2100
u16 listen_interval;
2103
u8 wpa_ie[MAX_WPA_IE_LEN];
2105
u8 rsn_ie[MAX_WPA_IE_LEN];
2107
#if defined RTL8192S_WAPI_SUPPORT
2108
u8 wapi_ie[MAX_WAPI_IE_LEN];
2111
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
2112
u8 wzc_ie[MAX_WZC_IE_LEN];
2116
struct rtllib_tim_parameters tim;
2119
u32 last_dtim_sta_time[2];
2122
struct rtllib_wmm_ac_param wmm_param[4];
2126
#ifdef ENABLE_DOT11D
2128
u8 CountryIeBuf[MAX_IE_LEN];
2131
bool broadcom_cap_exist;
2132
bool realtek_cap_exit;
2133
bool marvell_cap_exist;
2134
bool ralink_cap_exist;
2135
bool atheros_cap_exist;
2136
bool cisco_cap_exist;
2137
bool airgo_cap_exist;
2138
bool unknown_cap_exist;
2139
bool berp_info_valid;
2140
bool buseprotection;
2141
bool bIsNetgear854T;
2144
#ifdef _RTL8192_EXT_PATCH_
2145
u8 hostname[MAX_HOST_NAME_LENGTH];
2147
u8 mesh_id[MAX_MESH_ID_LEN];
2149
mesh_config_t mesh_config;
2154
struct list_head list;
2160
/* the card is not linked at all */
2163
/* RTLLIB_ASSOCIATING* are for BSS client mode
2164
* the driver shall not perform RX filtering unless
2165
* the state is LINKED.
2166
* The driver shall just check for the state LINKED and
2167
* defaults to NOLINK for ALL the other states (including
2171
/* the association procedure will start (wq scheduling)*/
2173
RTLLIB_ASSOCIATING_RETRY,
2175
/* the association procedure is sending AUTH request*/
2176
RTLLIB_ASSOCIATING_AUTHENTICATING,
2178
/* the association procedure has successfully authentcated
2179
* and is sending association request
2181
RTLLIB_ASSOCIATING_AUTHENTICATED,
2183
/* the link is ok. the card associated to a BSS or linked
2184
* to a ibss cell or acting as an AP and creating the bss
2188
/* same as LINKED, but the driver shall apply RX filter
2189
* rules as we are in NO_LINK mode. As the card is still
2190
* logically linked, but it is doing a syncro site survey
2191
* then it will be back to LINKED state.
2193
RTLLIB_LINKED_SCANNING,
2194
#ifdef _RTL8192_EXT_PATCH_
2195
RTLLIB_MESH_SCANNING,
2201
RTLLIB_UNINITIALIZED = 0,
2205
RTLLIB_AUTHENTICATING,
2206
RTLLIB_AUTHENTICATED,
2211
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
2212
#define DEFAULT_FTS 2346
2214
#define CFG_RTLLIB_RESERVE_FCS (1<<0)
2215
#define CFG_RTLLIB_COMPUTE_FCS (1<<1)
2216
#define CFG_RTLLIB_RTS (1<<2)
2218
#define RTLLIB_24GHZ_MIN_CHANNEL 1
2219
#define RTLLIB_24GHZ_MAX_CHANNEL 14
2220
#define RTLLIB_24GHZ_CHANNELS (RTLLIB_24GHZ_MAX_CHANNEL - \
2221
RTLLIB_24GHZ_MIN_CHANNEL + 1)
2223
#define RTLLIB_52GHZ_MIN_CHANNEL 34
2224
#define RTLLIB_52GHZ_MAX_CHANNEL 165
2225
#define RTLLIB_52GHZ_CHANNELS (RTLLIB_52GHZ_MAX_CHANNEL - \
2226
RTLLIB_52GHZ_MIN_CHANNEL + 1)
2228
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
2229
extern inline int is_multicast_ether_addr(const u8 *addr)
2231
return ((addr[0] != 0xff) && (0x01 & addr[0]));
2235
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
2236
extern inline int is_broadcast_ether_addr(const u8 *addr)
2238
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
2239
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
2243
#define eqMacAddr(a,b) ( ((a)[0]==(b)[0] && (a)[1]==(b)[1] && (a)[2]==(b)[2] && (a)[3]==(b)[3] && (a)[4]==(b)[4] && (a)[5]==(b)[5]) ? 1:0 )
2245
typedef struct tx_pending_t{
2247
struct rtllib_txb *txb;
2250
typedef struct _bandwidth_autoswitch
2252
long threshold_20Mhzto40Mhz;
2253
long threshold_40Mhzto20Mhz;
2254
bool bforced_tx20Mhz;
2255
bool bautoswitch_enable;
2256
}bandwidth_autoswitch,*pbandwidth_autoswitch;
2260
#define REORDER_WIN_SIZE 128
2261
#define REORDER_ENTRY_NUM 128
2262
typedef struct _RX_REORDER_ENTRY
2264
struct list_head List;
2266
struct rtllib_rxb* prxb;
2267
} RX_REORDER_ENTRY, *PRX_REORDER_ENTRY;
2268
typedef enum _Fsync_State{
2274
typedef enum _RT_PS_MODE
2282
typedef enum _IPS_CALLBACK_FUNCION
2284
IPS_CALLBACK_NONE = 0,
2285
IPS_CALLBACK_MGNT_LINK_REQUEST = 1,
2286
IPS_CALLBACK_JOIN_REQUEST = 2,
2287
}IPS_CALLBACK_FUNCION;
2289
typedef enum _RT_JOIN_ACTION{
2296
typedef struct _IbssParms{
2298
}IbssParms, *PIbssParms;
2299
#define MAX_NUM_RATES 264
2301
typedef enum _RT_RF_POWER_STATE
2308
#define MAX_SUPPORT_WOL_PATTERN_NUM 8
2310
#define MAX_WOL_BIT_MASK_SIZE 16
2311
#define MAX_WOL_PATTERN_SIZE 128
2313
typedef enum _WOLPATTERN_TYPE
2322
typedef struct _RT_PM_WOL_PATTERN_INFO
2328
WOLPATTERN_TYPE PatternType;
2329
}RT_PM_WOL_PATTERN_INFO, *PRT_PM_WOL_PATTERN_INFO;
2331
typedef struct _RT_POWER_SAVE_CONTROL
2335
bool bIPSModeBackup;
2336
bool bHaltAdapterClkRQ;
2337
bool bSwRfProcessing;
2338
RT_RF_POWER_STATE eInactivePowerState;
2339
work_struct_rsl InactivePsWorkItem;
2340
struct timer_list InactivePsTimer;
2342
IPS_CALLBACK_FUNCION ReturnPoint;
2345
RT_JOIN_ACTION tmpJoinAction;
2346
struct rtllib_network tmpBssDesc;
2349
bool bTmpActiveScan;
2350
bool bTmpFilterHiddenAP;
2351
bool bTmpUpdateParms;
2353
OCTET_STRING tmpSsid2Scan;
2356
u8 tmpChannelNumber;
2360
OCTET_STRING tmpSuppRateSet;
2361
u8 tmpSuppRateBuf[MAX_NUM_RATES];
2370
u8 RegMaxLPSAwakeIntvl;
2379
bool LinkReqInIPSRFOffPgs;
2380
bool BufConnectinfoBefore;
2388
RT_PM_WOL_PATTERN_INFO PmWoLPatternInfo[MAX_SUPPORT_WOL_PATTERN_NUM];
2390
}RT_POWER_SAVE_CONTROL,*PRT_POWER_SAVE_CONTROL;
2392
typedef u32 RT_RF_CHANGE_SOURCE;
2393
#define RF_CHANGE_BY_SW BIT31
2394
#define RF_CHANGE_BY_HW BIT30
2395
#define RF_CHANGE_BY_PS BIT29
2396
#define RF_CHANGE_BY_IPS BIT28
2397
#define RF_CHANGE_BY_INIT 0
2401
COUNTRY_CODE_FCC = 0,
2402
COUNTRY_CODE_IC = 1,
2403
COUNTRY_CODE_ETSI = 2,
2404
COUNTRY_CODE_SPAIN = 3,
2405
COUNTRY_CODE_FRANCE = 4,
2406
COUNTRY_CODE_MKK = 5,
2407
COUNTRY_CODE_MKK1 = 6,
2408
COUNTRY_CODE_ISRAEL = 7,
2409
COUNTRY_CODE_TELEC = 8,
2410
COUNTRY_CODE_MIC = 9,
2411
COUNTRY_CODE_GLOBAL_DOMAIN = 10,
2412
COUNTRY_CODE_WORLD_WIDE_13 = 11,
2413
COUNTRY_CODE_TELEC_NETGEAR = 12,
2415
}country_code_type_t;
2417
typedef enum _SCAN_OPERATION_BACKUP_OPT{
2421
}SCAN_OPERATION_BACKUP_OPT;
2423
typedef enum _FW_CMD_IO_TYPE{
2424
FW_CMD_DIG_ENABLE = 0,
2425
FW_CMD_DIG_DISABLE = 1,
2426
FW_CMD_DIG_HALT = 2,
2427
FW_CMD_DIG_RESUME = 3,
2428
FW_CMD_HIGH_PWR_ENABLE = 4,
2429
FW_CMD_HIGH_PWR_DISABLE = 5,
2430
FW_CMD_RA_RESET = 6,
2431
FW_CMD_RA_ACTIVE= 7,
2432
FW_CMD_RA_REFRESH_N= 8,
2433
FW_CMD_RA_REFRESH_BG= 9,
2435
FW_CMD_IQK_INIT = 11,
2436
FW_CMD_TXPWR_TRACK_ENABLE = 12,
2437
FW_CMD_TXPWR_TRACK_DISABLE = 13,
2438
FW_CMD_TXPWR_TRACK_THERMAL = 14,
2439
FW_CMD_PAUSE_DM_BY_SCAN = 15,
2440
FW_CMD_RESUME_DM_BY_SCAN = 16,
2441
FW_CMD_RA_REFRESH_N_COMB = 17,
2442
FW_CMD_RA_REFRESH_BG_COMB = 18,
2443
FW_CMD_ANTENNA_SW_ENABLE = 19,
2444
FW_CMD_ANTENNA_SW_DISABLE = 20,
2445
FW_CMD_TX_FEEDBACK_CCX_ENABLE = 21,
2446
FW_CMD_LPS_ENTER = 22,
2447
FW_CMD_LPS_LEAVE = 23,
2448
FW_CMD_DIG_MODE_SS = 24,
2449
FW_CMD_DIG_MODE_FA = 25,
2450
FW_CMD_ADD_A2_ENTRY = 26,
2451
FW_CMD_CTRL_DM_BY_DRIVER = 27,
2452
FW_CMD_CTRL_DM_BY_DRIVER_NEW = 28,
2453
FW_CMD_PAPE_CONTROL = 29,
2454
#ifdef CONFIG_FW_SETCHAN
2455
FW_CMD_CHAN_SET = 30,
2457
FW_CMD_IQK_ENABLE = 30,
2459
}FW_CMD_IO_TYPE,*PFW_CMD_IO_TYPE;
2461
#define RT_MAX_LD_SLOT_NUM 10
2462
typedef struct _RT_LINK_DETECT_T{
2464
u32 NumRecvBcnInPeriod;
2465
u32 NumRecvDataInPeriod;
2467
u32 RxBcnNum[RT_MAX_LD_SLOT_NUM];
2468
u32 RxDataNum[RT_MAX_LD_SLOT_NUM];
2472
u32 NumTxOkInPeriod;
2473
u32 NumRxOkInPeriod;
2474
u32 NumRxUnicastOkInPeriod;
2476
bool bHigherBusyTraffic;
2477
bool bHigherBusyRxTraffic;
2479
u32 NumTxUnicastOkInPeriod;
2480
u32 LastNumTxUnicast;
2481
u32 LastNumRxUnicast;
2482
}RT_LINK_DETECT_T, *PRT_LINK_DETECT_T;
2484
#ifdef _RTL8192_EXT_PATCH_
2485
struct rtllib_crypt_data_list{
2487
u8 mac_addr[ETH_ALEN];
2488
struct rtllib_crypt_data *crypt[WEP_KEYS];
2489
}__attribute__((packed));
2491
typedef struct _SW_RATR_TABLE{
2494
}SW_RATR_TABLE, *PSW_RATR_TABLE;
2497
typedef struct _SW_CAM_TABLE{
2506
}SW_CAM_TABLE,*PSW_CAM_TABLE;
2507
#define TOTAL_CAM_ENTRY 32
2508
typedef struct _rate_adaptive
2510
u8 rate_adaptive_disabled;
2514
u32 high_rssi_thresh_for_ra;
2515
u32 high2low_rssi_thresh_for_ra;
2516
u8 low2high_rssi_thresh_for_ra40M;
2517
u32 low_rssi_thresh_for_ra40M;
2518
u8 low2high_rssi_thresh_for_ra20M;
2519
u32 low_rssi_thresh_for_ra20M;
2520
u32 upper_rssi_threshold_ratr;
2521
u32 MiddleUpperRSSIThresholdRATR;
2522
u32 middle_rssi_threshold_ratr;
2523
u32 MiddleLowRSSIThresholdRATR;
2524
u32 low_rssi_threshold_ratr;
2525
u32 UltraLowRSSIThresholdRATR;
2526
u32 low_rssi_threshold_ratr_40M;
2527
u32 low_rssi_threshold_ratr_20M;
2528
u8 ping_rssi_enable;
2530
u32 ping_rssi_thresh_for_ra;
2534
} rate_adaptive, *prate_adaptive;
2535
typedef enum _RATR_TABLE_MODE_8192S{
2536
RATR_INX_WIRELESS_NGB = 0,
2537
RATR_INX_WIRELESS_NG = 1,
2538
RATR_INX_WIRELESS_NB = 2,
2539
RATR_INX_WIRELESS_N = 3,
2540
RATR_INX_WIRELESS_GB = 4,
2541
RATR_INX_WIRELESS_G = 5,
2542
RATR_INX_WIRELESS_B = 6,
2543
RATR_INX_WIRELESS_MC = 7,
2544
RATR_INX_WIRELESS_A = 8,
2545
}RATR_TABLE_MODE_8192S, *PRATR_TABLE_MODE_8192S;
2547
#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE) || defined RTL8192CE
2548
#define PEER_MAX_ASSOC 10
2549
typedef struct _RSSI_STA{
2550
long UndecoratedSmoothedPWDB;
2551
}RSSI_STA, *PRSSI_STA;
2554
u8 macaddr[ETH_ALEN];
2561
RT_HTINFO_STA_ENTRY htinfo;
2565
rate_adaptive rate_adaptive;
2567
struct sk_buff_head PsQueue;
2573
u16 NoRetryFrameCnt;
2580
} __attribute__ ((packed));
2582
#ifdef _RTL8192_EXT_PATCH_
2583
typedef struct _RT_PEERMP_HTINFO{
2585
u8 bCurrentHTSupport;
2590
u8 bRegShortGI40MHz;
2591
u8 bCurShortGI40MHz;
2593
u8 bRegShortGI20MHz;
2594
u8 bCurShortGI20MHz;
2601
u8 PeerHTCapBuf[32];
2602
u8 PeerHTInfoBuf[32];
2607
u8 bCurrent_Mesh_AMSDU_Support;
2611
u8 bCurrentMeshAMPDUEnable;
2613
u8 CurrentAMPDUFactor;
2615
u8 CurrentMPDUDensity;
2617
u8 ForcedAMPDUFactor;
2618
u8 ForcedMPDUDensity;
2620
HT_AGGRE_MODE_E ForcedAMSDUMode;
2621
u16 ForcedAMSDUMaxSize;
2629
HT_EXTCHNL_OFFSET CurSTAExtChnlOffset;
2637
u8 bRegRT2RTAggregation;
2638
u8 bCurrentRT2RTAggregation;
2639
u8 bCurrentRT2RTLongSlotTime;
2640
u8 szRT2RTAggBuffer[10];
2642
u8 bRegRxReorderEnable;
2643
u8 bCurRxReorderEnable;
2644
u8 RxReorderWinSize;
2645
u8 RxReorderPendingTime;
2646
u16 RxReorderDropCounter;
2648
#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
2651
#ifdef USB_RX_AGGREGATION_SUPPORT
2653
u8 UsbRxFwAggrPageNum;
2654
u8 UsbRxFwAggrPacketNum;
2655
u8 UsbRxFwAggrTimeout;
2661
u8 HTHighestOperaRate;
2664
} __attribute__ ((packed)) peerMP_htinfo, *ppeerMP_htinfo;
2667
#define NUM_PMKID_CACHE 16
2668
typedef struct _RT_PMKID_LIST
2676
} RT_PMKID_LIST, *PRT_PMKID_LIST;
2678
#ifdef CONFIG_CFG_80211
2680
LIBIPW_CH_PASSIVE_ONLY = (1 << 0),
2681
LIBIPW_CH_80211H_RULES = (1 << 1),
2682
LIBIPW_CH_B_ONLY = (1 << 2),
2683
LIBIPW_CH_NO_IBSS = (1 << 3),
2684
LIBIPW_CH_UNIFORM_SPREADING = (1 << 4),
2685
LIBIPW_CH_RADAR_DETECT = (1 << 5),
2686
LIBIPW_CH_INVALID = (1 << 6),
2688
struct rtllib_channel {
2695
#define RTLLIB_24GHZ_MIN_CHANNEL 1
2696
#define RTLLIB_24GHZ_MAX_CHANNEL 14
2697
#define RTLLIB_24GHZ_CHANNELS (RTLLIB_24GHZ_MAX_CHANNEL - \
2698
RTLLIB_24GHZ_MIN_CHANNEL + 1)
2700
struct reg_dmn_pair_mapping {
2706
struct rtl_regulatory {
2709
u16 max_power_level;
2713
int16_t power_limit;
2714
struct reg_dmn_pair_mapping *regpair;
2717
struct ieee80211_bss {
2718
/* Yes, this is a hack */
2719
struct cfg80211_bss cbss;
2721
/* don't want to look up all the time */
2723
u8 ssid[IEEE80211_MAX_SSID_LEN];
2729
unsigned long last_probe_resp;
2731
#ifdef CONFIG_MAC80211_MESH
2737
#define IEEE80211_MAX_SUPP_RATES 32
2738
u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
2739
size_t supp_rates_len;
2742
* During assocation, we save an ERP value from a probe response so
2743
* that we can feed ERP info to the driver when handling the
2744
* association completes. these fields probably won't be up-to-date
2745
* otherwise, you probably don't want to use them.
2751
/* Parsed Information Elements */
2752
struct ieee802_11_elems {
2756
/* pointers to IEs */
2762
struct ieee80211_tim_ie *tim;
2771
struct ieee80211_ht_cap *ht_cap_elem;
2772
struct ieee80211_ht_info *ht_info_elem;
2781
u8 *pwr_constr_elem;
2782
u8 *quiet_elem; /* first quite element */
2785
/* length of them, respectively */
2797
u8 ext_supp_rates_len;
2806
u8 ch_switch_elem_len;
2807
u8 country_elem_len;
2808
u8 pwr_constr_elem_len;
2810
u8 num_of_quiet_elem; /* can be more the one */
2817
typedef struct _RT_INTEL_PROMISCUOUS_MODE_INFO {
2818
bool bPromiscuousOn;
2819
bool bFilterSourceStationFrame;
2820
} RT_INTEL_PROMISCUOUS_MODE_INFO, *PRT_INTEL_PROMISCUOUS_MODE_INFO;
2822
typedef struct _WIRELESS_SETTING_BEFORE_SCAN
2824
/*WirelessModeScanInProgress is designed for driver to keep the previous band(2.4G/5G)
2825
during scan. It is only meaningful for a/b/g device which require to switch band twice
2826
during scan (either 2.4->5->2.4 or 5->2.4->5*/
2827
WIRELESS_MODE WirelessModeScanInProgress;
2829
/*WirelessMode is designed to keep the original wireless mode setting before scan*/
2830
WIRELESS_MODE WirelessMode;
2832
/*ChannelNumber is designd to keep the original channel number before scan*/
2835
/*ChannelBandwidth is designed to keep the original channel bandwidth(20/40MHz) before scan*/
2836
HT_CHANNEL_WIDTH ChannelBandwidth;
2838
/* Extension channel offset before scan. This is useful when channel bandwidth is 40MHz. */
2839
HT_EXTCHNL_OFFSET ExtChnlOffset;
2840
}WIRELESS_SETTING_BEFORE_SCAN, *PWIRELESS_SETTING_BEFORE_SCAN;
2843
/*************** DRIVER STATUS *****/
2844
#define STATUS_SCANNING 0
2845
#define STATUS_SCAN_HW 1
2846
#define STATUS_SCAN_ABORTING 2
2847
#define STATUS_SETTING_CHAN 3
2848
/*************** DRIVER STATUS *****/
2860
LPS_WAIT_NULL_DATA_SEND =2,
2863
struct rtllib_device {
2864
struct pci_dev *pdev;
2865
struct net_device *dev;
2866
struct rtllib_security sec;
2868
bool disable_mgnt_queue;
2870
unsigned long status;
2872
HT_EXTCHNL_OFFSET chan_offset_bk;
2873
HT_CHANNEL_WIDTH bandwidth_bk;
2875
#ifdef CONFIG_CFG_80211
2876
struct wireless_dev wdev;
2877
struct rtl_regulatory regulatory;
2882
WIRELESS_SETTING_BEFORE_SCAN SettingBeforeScan;
2885
/* The last AssocReq/Resp IEs */
2886
u8 *assocreq_ies, *assocresp_ies;
2887
size_t assocreq_ies_len, assocresp_ies_len;
2889
bool b_customer_lenovo_id;
2890
bool bForcedShowRxRate;
2891
bool bForcedShowRateStill;
2892
u8 SystemQueryDataRateCount;
2895
bool b1x1RecvCombine;
2900
bool is_silent_reset;
2901
bool force_mic_error;
2905
bool bSupportRemoteWakeUp;
2906
RT_PS_MODE dot11PowerSaveMode;
2908
bool FirstIe_InScan;
2909
bool be_scan_inprogress;
2911
RT_RF_POWER_STATE eRFPowerState;
2912
RT_RF_CHANGE_SOURCE RfOffReason;
2915
#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE) || defined RTL8192CE
2916
struct sta_info *peer_assoc_list[PEER_MAX_ASSOC];
2917
u8 AvailableAIDTable[PEER_MAX_ASSOC];
2918
atomic_t AsocEntryNum;
2922
bool Peer_bCurBW40M;
2924
PRT_HIGH_THROUGHPUT pHTInfo;
2925
spinlock_t bw_spinlock;
2927
spinlock_t reorder_spinlock;
2928
u8 Regdot11HTOperationalRateSet[16];
2929
u8 Regdot11TxHTOperationalRateSet[16];
2930
u8 dot11HTOperationalRateSet[16];
2931
u8 RegHTSuppRateSet[16];
2932
u8 HTCurrentOperaRate;
2933
u8 HTHighestOperaRate;
2936
u8 bTxDisableRateFallBack;
2937
u8 bTxUseDriverAssingedRate;
2938
u8 bTxEnableFwCalcDur;
2939
atomic_t atm_chnlop;
2942
struct list_head Tx_TS_Admit_List;
2943
struct list_head Tx_TS_Pending_List;
2944
struct list_head Tx_TS_Unused_List;
2945
TX_TS_RECORD TxTsRecord[TOTAL_TS_NUM];
2946
struct list_head Rx_TS_Admit_List;
2947
struct list_head Rx_TS_Pending_List;
2948
struct list_head Rx_TS_Unused_List;
2949
RX_TS_RECORD RxTsRecord[TOTAL_TS_NUM];
2950
RX_REORDER_ENTRY RxReorderEntry[128];
2951
struct list_head RxReorder_Unused_List;
2955
/* Bookkeeping structures */
2956
struct net_device_stats stats;
2957
struct rtllib_stats ieee_stats;
2958
struct rtllib_softmac_stats softmac_stats;
2960
/* Probe / Beacon management */
2961
struct list_head network_free_list;
2962
struct list_head network_list;
2964
struct list_head network_bssid_free_list;
2965
struct list_head network_bssid_list;
2967
struct rtllib_network *networks;
2971
int iw_mode; /* operating mode (IW_MODE_*) */
2972
bool bNetPromiscuousMode;
2973
RT_INTEL_PROMISCUOUS_MODE_INFO IntelPromiscuousModeInfo;
2975
struct iw_spy_data spy_data;
2978
spinlock_t wpax_suitlist_lock;
2980
int tx_headroom; /* Set to size of any additional room needed at front
2981
* of allocated Tx SKBs */
2984
/* WEP and other encryption related settings at the device level */
2985
int open_wep; /* Set to 1 to allow unencrypted frames */
2987
int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
2988
* WEP key changes */
2990
/* If the host performs {en,de}cryption, then set to 1 */
2992
int host_encrypt_msdu;
2994
/* host performs multicast decryption */
2995
int host_mc_decrypt;
2997
/* host should strip IV and ICV from protected frames */
2998
/* meaningful only when hardware decryption is being used */
2999
int host_strip_iv_icv;
3003
int ieee802_1x; /* is IEEE 802.1X used */
3007
bool bHalfWirelessN24GMode;
3009
int drop_unencrypted;
3010
int tkip_countermeasures;
3011
int privacy_invoked;
3017
u16 pairwise_key_type;
3019
struct list_head crypt_deinit_list;
3020
#ifdef _RTL8192_EXT_PATCH_
3021
struct rtllib_crypt_data_list* cryptlist[MAX_MP];
3022
struct rtllib_crypt_data *sta_crypt[WEP_KEYS];
3024
struct rtllib_crypt_data *crypt[WEP_KEYS];
3027
int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */
3028
SW_CAM_TABLE swcamtable[TOTAL_CAM_ENTRY];
3029
struct timer_list crypt_deinit_timer;
3032
int bcrx_sta_key; /* use individual keys to override default keys even
3033
* with RX of broad/multicast frames */
3035
RT_PMKID_LIST PMKIDList[NUM_PMKID_CACHE];
3037
/* Fragmentation structures */
3038
struct rtllib_frag_entry frag_cache[17][RTLLIB_FRAG_CACHE_LEN];
3039
unsigned int frag_next_idx[17];
3040
u16 fts; /* Fragmentation Threshold */
3041
#define DEFAULT_RTS_THRESHOLD 2346U
3042
#define MIN_RTS_THRESHOLD 1
3043
#define MAX_RTS_THRESHOLD 2346U
3044
u16 rts; /* RTS threshold */
3046
/* Association info */
3049
/* This stores infos for the current network.
3050
* Either the network we are associated in INFRASTRUCTURE
3051
* or the network that we are creating in MASTER mode.
3052
* ad-hoc is a mixture ;-).
3053
* Note that in infrastructure mode, even when not associated,
3054
* fields bssid and essid may be valid (if wpa_set and essid_set
3055
* are true) as thy carry the value set by the user via iwconfig
3057
struct rtllib_network current_network;
3059
enum rtllib_state state;
3063
int mode; /* A, B, G */
3064
int modulation; /* CCK, OFDM */
3065
int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */
3066
int abg_true; /* ABG flag */
3068
/* used for forcing the ibss workqueue to terminate
3069
* without wait for the syncro scan to terminate
3071
short sync_scan_hurryup;
3076
u16 prev_seq_ctl; /* used to drop duplicate frames */
3078
/* map of allowed channels. 0 is dummy */
3079
#ifdef ENABLE_DOT11D
3083
u8 channel_map[MAX_CHANNEL_NUMBER+1];
3085
u8 active_channel_map[MAX_CHANNEL_NUMBER+1];
3088
u8 ibss_maxjoin_chal;
3090
#ifdef _RTL8192_EXT_PATCH_
3093
bool bUseProtection;
3095
int rate; /* current rate */
3101
/* this contains flags for selectively enable softmac support */
3102
u16 softmac_features;
3104
/* if the sequence control field is not filled by HW */
3107
/* association procedure transaction sequence number */
3110
/* AID for RTXed association responses */
3113
/* power save mode related*/
3119
struct tasklet_struct ps_task;
3125
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
3127
short scanning_continue ;
3128
short proto_started;
3129
short proto_stoppping;
3131
struct semaphore wx_sem;
3132
struct semaphore scan_sem;
3133
struct semaphore ips_sem;
3135
spinlock_t mgmt_tx_lock;
3136
spinlock_t beacon_lock;
3143
/* set on initialization */
3145
unsigned int wmm_acm;
3147
/* for discarding duplicated packets in IBSS */
3148
struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
3150
/* for discarding duplicated packets in BSS */
3151
u16 last_rxseq_num[17]; /* rx seq previous per-tid */
3152
u16 last_rxfrag_num[17];/* tx frag previous per-tid */
3153
unsigned long last_packet_time[17];
3156
unsigned long last_rx_ps_time;
3160
/* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */
3161
struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM];
3162
int mgmt_queue_head;
3163
int mgmt_queue_tail;
3164
#define RTLLIB_QUEUE_LIMIT 128
3166
unsigned int hw_header;
3167
struct sk_buff_head skb_waitQ[MAX_QUEUE_SIZE];
3168
struct sk_buff_head skb_aggQ[MAX_QUEUE_SIZE];
3169
struct sk_buff_head skb_drv_aggQ[MAX_QUEUE_SIZE];
3170
u32 sta_edca_param[4];
3172
bool enable_rx_imm_BA;
3173
bool bibsscoordinator;
3175
bool bdynamic_txpower_enable;
3177
bool bCTSToSelfEnable;
3180
u32 fsync_time_interval;
3181
u32 fsync_rate_bitmap;
3182
u8 fsync_rssi_threshold;
3185
u8 fsync_multiple_timeinterval;
3186
u32 fsync_firstdiff_ratethreshold;
3187
u32 fsync_seconddiff_ratethreshold;
3188
Fsync_State fsync_state;
3189
bool bis_any_nonbepkts;
3190
bandwidth_autoswitch bandwidth_auto_switch;
3193
RT_LINK_DETECT_T LinkDetectInfo;
3194
bool bIsAggregateFrame;
3195
RT_POWER_SAVE_CONTROL PowerSaveControl;
3196
u8 amsdu_in_process;
3198
/* used if IEEE_SOFTMAC_TX_QUEUE is set */
3199
struct tx_pending_t tx_pending;
3201
/* used if IEEE_SOFTMAC_ASSOCIATE is set */
3202
struct timer_list associate_timer;
3204
/* used if IEEE_SOFTMAC_BEACONS is set */
3205
struct timer_list beacon_timer;
3206
#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
3207
struct timer_list ibss_wait_timer;
3210
#ifdef _RTL8192_EXT_PATCH_
3211
struct net_device *meshdev;
3212
struct net_device_stats *meshstats;
3214
u8 hostname[MAX_HOST_NAME_LENGTH];
3216
struct list_head mesh_network_free_list;
3217
struct list_head mesh_network_list;
3218
struct rtllib_network *mesh_networks;
3219
struct rtllib_network current_mesh_network;
3220
enum rtllib_state mesh_state;
3222
int mesh_security_setting;
3224
struct list_head mesh_mac_hash[IEEE_MESH_MAC_HASH_SIZE];
3225
u64 LinkingPeerBitMap;
3226
u8 LinkingPeerAddr[MAX_MP-1][ETH_ALEN];
3227
u8 LinkingPeerSecState[MAX_MP-1];
3228
u8 mesh_cached_PTK[MAX_MP-1][16];
3229
u32 peer_AID_bitmap;
3230
u8 peer_AID_Addr[30][ETH_ALEN];
3232
u16 mesh_pairwise_key_type;
3233
u16 mesh_group_key_type;
3235
u8 HwSecCamStaAddr[TOTAL_CAM_ENTRY][ETH_ALEN];
3236
SW_CAM_TABLE swmeshcamtable[TOTAL_CAM_ENTRY];
3237
SW_RATR_TABLE swmeshratrtable[8];
3240
u8 serverExtChlOffset;
3243
struct sk_buff_head skb_meshaggQ[MAX_QUEUE_SIZE];
3244
u8 mesh_amsdu_in_process;
3246
work_struct_rsl associate_complete_wq;
3248
work_struct_rsl ips_leave_wq;
3250
#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
3251
delayed_work_struct_rsl check_tsf_wq;
3252
delayed_work_struct_rsl update_assoc_sta_info_wq;
3254
delayed_work_struct_rsl associate_procedure_wq;
3255
delayed_work_struct_rsl softmac_scan_wq;
3256
delayed_work_struct_rsl softmac_hint11d_wq;
3257
delayed_work_struct_rsl associate_retry_wq;
3258
delayed_work_struct_rsl start_ibss_wq;
3260
delayed_work_struct_rsl hw_wakeup_wq;
3261
delayed_work_struct_rsl hw_sleep_wq;
3263
delayed_work_struct_rsl link_change_wq;
3264
work_struct_rsl wx_sync_scan_wq;
3265
#ifdef _RTL8192_EXT_PATCH_
3266
work_struct_rsl ext_stop_scan_wq;
3267
work_struct_rsl ext_send_beacon_wq;
3268
work_struct_rsl ext_create_crypt_for_peers_wq;
3269
work_struct_rsl ext_path_sel_ops_wq;
3270
work_struct_rsl ext_update_extchnloffset_wq;
3271
delayed_work_struct_rsl ext_wx_set_key_wq;
3272
work_struct_rsl ext_start_mesh_protocol_wq;
3275
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3276
struct workqueue_struct *wq;
3280
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,40)
3281
/* used for periodly scan */
3282
struct timer_list scan_timer;
3284
#if defined (RTL8192S_WAPI_SUPPORT)
3287
struct list_head cache_frag_list;
3288
spinlock_t wapi_queue_lock;
3289
WAPI_QUEUE *wapi_queue;
3292
#ifdef _RTL8192_EXT_PATCH_
3293
int (*set_mesh_key)(struct net_device *dev,
3294
struct iw_point *encoding, struct iw_encode_ext *ext, u8 *addr);
3296
/* Callback functions */
3297
void (*set_security)(struct net_device *dev,
3298
struct rtllib_security *sec);
3300
/* Used to TX data frame by using txb structs.
3301
* this is not used if in the softmac_features
3302
* is set the flag IEEE_SOFTMAC_TX_QUEUE
3304
int (*hard_start_xmit)(struct rtllib_txb *txb,
3305
struct net_device *dev);
3307
int (*reset_port)(struct net_device *dev);
3308
int (*is_queue_full) (struct net_device * dev, int pri);
3310
int (*handle_management) (struct net_device * dev,
3311
struct rtllib_network * network, u16 type);
3312
int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb);
3314
/* Softmac-generated frames (mamagement) are TXed via this
3315
* callback if the flag IEEE_SOFTMAC_SINGLE_QUEUE is
3316
* not set. As some cards may have different HW queues that
3317
* one might want to use for data and management frames
3318
* the option to have two callbacks might be useful.
3319
* This fucntion can't sleep.
3321
int (*softmac_hard_start_xmit)(struct sk_buff *skb,
3322
struct net_device *dev);
3324
/* used instead of hard_start_xmit (not softmac_hard_start_xmit)
3325
* if the IEEE_SOFTMAC_TX_QUEUE feature is used to TX data
3326
* frames. I the option IEEE_SOFTMAC_SINGLE_QUEUE is also set
3327
* then also management frames are sent via this callback.
3328
* This function can't sleep.
3330
void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
3331
struct net_device *dev,int rate);
3333
/* stops the HW queue for DATA frames. Useful to avoid
3334
* waste time to TX data frame when we are reassociating
3335
* This function can sleep.
3337
void (*data_hard_stop)(struct net_device *dev);
3339
/* OK this is complementar to data_poll_hard_stop */
3340
void (*data_hard_resume)(struct net_device *dev);
3342
/* ask to the driver to retune the radio .
3343
* This function can sleep. the driver should ensure
3344
* the radio has been swithced before return.
3346
void (*set_chan)(struct net_device *dev,short ch);
3348
/* These are not used if the ieee stack takes care of
3349
* scanning (IEEE_SOFTMAC_SCAN feature set).
3350
* In this case only the set_chan is used.
3352
* The syncro version is similar to the start_scan but
3353
* does not return until all channels has been scanned.
3354
* this is called in user context and should sleep,
3355
* it is called in a work_queue when swithcing to ad-hoc mode
3356
* or in behalf of iwlist scan when the card is associated
3357
* and root user ask for a scan.
3358
* the fucntion stop_scan should stop both the syncro and
3359
* background scanning and can sleep.
3360
* The fucntion start_scan should initiate the background
3361
* scanning and can't sleep.
3363
void (*scan_syncro)(struct net_device *dev);
3364
void (*start_scan)(struct net_device *dev);
3365
void (*stop_scan)(struct net_device *dev);
3367
void (*rtllib_start_hw_scan)(struct net_device *dev);
3368
void (*rtllib_stop_hw_scan)(struct net_device *dev);
3370
/* indicate the driver that the link state is changed
3371
* for example it may indicate the card is associated now.
3372
* Driver might be interested in this to apply RX filter
3373
* rules or simply light the LINK led
3375
void (*link_change)(struct net_device *dev);
3377
/* these two function indicates to the HW when to start
3378
* and stop to send beacons. This is used when the
3379
* IEEE_SOFTMAC_BEACONS is not set. For now the
3380
* stop_send_bacons is NOT guaranteed to be called only
3381
* after start_send_beacons.
3383
void (*start_send_beacons) (struct net_device *dev);
3384
void (*stop_send_beacons) (struct net_device *dev);
3386
/* power save mode related */
3387
void (*sta_wake_up) (struct net_device *dev);
3388
void (*enter_sleep_state) (struct net_device *dev, u32 th, u32 tl);
3389
short (*ps_is_queue_empty) (struct net_device *dev);
3391
/* Typical STA methods */
3392
int (*handle_auth) (struct net_device * dev,
3393
struct rtllib_auth * auth);
3394
int (*handle_deauth) (struct net_device * dev,
3395
struct rtllib_deauth * auth);
3396
int (*handle_action) (struct net_device * dev,
3397
struct rtllib_action * action,
3398
struct rtllib_rx_stats * stats);
3399
int (*handle_disassoc) (struct net_device * dev,
3400
struct rtllib_disassoc * assoc);
3402
int (*handle_beacon) (struct net_device * dev, struct rtllib_beacon * beacon, struct rtllib_network * network);
3404
int (*handle_probe_response) (struct net_device * dev,
3405
struct rtllib_probe_response * resp,
3406
struct rtllib_network * network);
3407
int (*handle_probe_request) (struct net_device * dev,
3408
struct rtllib_probe_request * req,
3409
struct rtllib_rx_stats * stats);
3411
int (*handle_assoc_response) (struct net_device * dev, struct rtllib_assoc_response_frame * resp, struct rtllib_network * network);
3414
/* Typical AP methods */
3415
int (*handle_assoc_request) (struct net_device * dev);
3416
int (*handle_reassoc_request) (struct net_device * dev,
3417
struct rtllib_reassoc_request * req);
3420
/* check whether Tx hw resouce available */
3421
short (*check_nic_enough_desc)(struct net_device *dev, int queue_index);
3422
short (*get_nic_desc_num)(struct net_device *dev, int queue_index);
3423
void (*SetBWModeHandler)(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset);
3424
bool (*GetNmodeSupportBySecCfg)(struct net_device* dev);
3425
void (*SetWirelessMode)(struct net_device* dev, u8 wireless_mode);
3426
bool (*GetHalfNmodeSupportByAPsHandler)(struct net_device* dev);
3427
u8 (*rtllib_ap_sec_type)(struct rtllib_device *ieee);
3428
void (*HalUsbRxAggrHandler)(struct net_device *dev, bool Value);
3429
void (*InitialGainHandler)(struct net_device *dev, u8 Operation);
3430
int (*softmac_process_bt_pkt)(struct sk_buff *skb, struct net_device *dev);
3432
#ifdef _RTL8192_EXT_PATCH_
3433
int (*set_key_for_AP)(struct rtllib_device *ieee);
3434
void (*del_hwsec_cam_entry)(struct rtllib_device *ieee, u8 *addr);
3435
int (*set_key_for_peer) (struct net_device *dev,u8 *Addr,u8 KeyIndex,u16 KeyType,u32 *KeyContent );
3436
int (*ext_patch_rtllib_start_protocol) (struct rtllib_device *ieee);
3438
short (*ext_patch_rtllib_probe_req_1) (struct rtllib_device *ieee);
3439
u8* (*ext_patch_rtllib_probe_req_2) (struct rtllib_device *ieee, struct sk_buff *skb, u8 *tag);
3441
void (*ext_patch_rtllib_stop_protocol) (struct rtllib_device *ieee,bool is_silent_reset);
3443
int (*ext_patch_rtllib_rx_frame_softmac_on_peerlink_open) (struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_rx_stats *rx_stats);
3444
int (*ext_patch_rtllib_rx_frame_softmac_on_peerlink_confirm) (struct rtllib_device *ieee, struct sk_buff *skb);
3445
int (*ext_patch_rtllib_rx_frame_softmac_on_peerlink_close) (struct rtllib_device *ieee, struct sk_buff *skb);
3446
void (*ext_patch_rtllib_close_all_peerlink) (struct rtllib_device *ieee, __le16 reason);
3448
int (*ext_patch_rtllib_rx_frame_softmac_on_linkmetric_report) (struct rtllib_device *ieee, struct sk_buff *skb);
3449
int (*ext_patch_rtllib_rx_frame_softmac_on_linkmetric_req) (struct rtllib_device *ieee, struct sk_buff *skb);
3451
int (*ext_patch_rtllib_rx_frame_softmac_on_pathselect_preq) (struct rtllib_device *ieee, struct sk_buff *skb,struct rtllib_rx_stats *rx_stats);
3452
int (*ext_patch_rtllib_rx_frame_softmac_on_pathselect_prep) (struct rtllib_device *ieee, struct sk_buff *skb,struct rtllib_rx_stats *rx_stats);
3453
int (*ext_patch_rtllib_rx_frame_softmac_on_pathselect_perr) (struct rtllib_device *ieee, struct sk_buff *skb,struct rtllib_rx_stats *rx_stats);
3454
int (*ext_patch_rtllib_rx_frame_softmac_on_pathselect_rann) (struct rtllib_device *ieee, struct sk_buff *skb,struct rtllib_rx_stats *rx_stats);
3455
int (*ext_patch_rtllib_rx_frame_softmac_on_pathselect_pann) (struct rtllib_device *ieee, struct sk_buff *skb,struct rtllib_rx_stats *rx_stats);
3457
int (*ext_patch_rtllib_ext_stop_scan_wq_set_channel) (struct rtllib_device *ieee);
3458
int (*ext_patch_r819x_wx_set_mesh_chan)(struct net_device *dev, unsigned char channel);
3459
void (*ext_patch_r819x_wx_set_channel) (struct rtllib_device *ieee, int ch);
3461
int (*ext_patch_rtllib_softmac_xmit_get_rate) (struct rtllib_device *ieee, struct sk_buff *skb);
3462
int (*ext_patch_rtllib_rx_frame_softmac_on_auth)(struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_rx_stats *rx_stats);
3463
int (*ext_patch_rtllib_rx_frame_softmac_on_deauth)(struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_rx_stats *rx_stats);
3464
int (*ext_patch_rtllib_tx_data)(struct rtllib_device *ieee, struct rtllib_hdr_4addrqos* header, u8* is_peer_n_mode, u8* is_peer_40M,
3465
u8* is_peer_shortGI_40M, u8* is_peer_shortGI_20M,u8* peer_highest_opra_rate,u8* peer_ratr_index, u8* AID);
3466
bool (*ext_patch_rtllib_is_mesh)(struct rtllib_device * ieee,u8 * addr);
3467
ppeerMP_htinfo (*ext_patch_rtllib_get_peermp_htinfo) (struct rtllib_device *ieee,u8 * daddr);
3468
int (* ext_patch_rtllib_create_crypt_for_peer)(struct rtllib_device * ieee);
3469
void (*ext_patch_rtllib_start_mesh)(struct rtllib_device *ieee);
3470
void (*ext_patch_rtllib_rx_mgt_on_probe_req) ( struct rtllib_device *ieee, struct rtllib_probe_request *beacon, struct rtllib_rx_stats *stats);
3471
unsigned int(*ext_patch_rtllib_process_probe_response_1)(struct rtllib_device *ieee, struct rtllib_probe_response *beacon, struct rtllib_rx_stats *stats);
3473
void (*ext_patch_rtllib_rx_mgt_update_expire) ( struct rtllib_device *ieee, struct sk_buff *skb);
3474
struct sk_buff* (*ext_patch_get_beacon_get_probersp)(struct rtllib_device *ieee, u8 *dest, struct rtllib_network *net);
3476
int (*ext_patch_rtllib_rx_on_rx) (struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_rx_stats *rx_stats, u16 type, u16 stype);
3478
int (*ext_patch_rtllib_rx_frame_get_hdrlen) (struct rtllib_device *ieee, struct sk_buff *skb);
3480
int (*ext_patch_rtllib_rx_frame_get_mac_hdrlen) (struct rtllib_device *ieee, struct sk_buff *skb);
3482
int (*ext_patch_rtllib_rx_frame_get_mesh_hdrlen_llc) (struct rtllib_device *ieee, struct sk_buff *skb);
3483
int (*ext_patch_rtllib_rx_is_valid_framectl) (struct rtllib_device *ieee, u16 fc, u16 type, u16 stype);
3486
/* added by david for setting acl dynamically */
3487
u8 (*ext_patch_rtllib_acl_query) (struct rtllib_device *ieee, u8 *sa);
3490
struct sk_buff* (*ext_patch_rtllib_send_ath_commit) (struct rtllib_device * ieee,u8 * addr);
3491
struct sk_buff* (*ext_patch_rtllib_send_ath_confirm) (struct rtllib_device * ieee,u8 * addr);
3492
int (*ext_patch_rtllib_rx_ath_commit) (struct rtllib_device * ieee,u8 * addr);
3493
u8 (*ext_patch_rtllib_rx_ath_confirm) (struct rtllib_device *ieee, u8* pframe,u16 strlen,u8 *addr);
3496
bool (*SetFwCmdHandler)(struct net_device *dev, FW_CMD_IO_TYPE FwCmdIO);
3497
void (*UpdateHalRAMaskHandler)(struct net_device* dev, bool bMulticast, u8 macId, u8 MimoPs, u8 WirelessMode, u8 bCurTxBW40MHz, u8 rssi_level);
3498
void (*UpdateBeaconInterruptHandler)(struct net_device* dev, bool start);
3499
void (*UpdateInterruptMaskHandler)(struct net_device* dev, u32 AddMSR, u32 RemoveMSR);
3500
u16 (*rtl_11n_user_show_rates)(struct net_device *dev);
3501
void (*ScanOperationBackupHandler)(struct net_device *dev, u8 Operation);
3502
void (*LedControlHandler)(struct net_device * dev, LED_CTL_MODE LedAction);
3503
void (*SetHwRegHandler)(struct net_device *dev,u8 variable,u8* val);
3504
void (*GetHwRegHandler)(struct net_device *dev,u8 variable,u8* val);
3506
void (*AllowAllDestAddrHandler)(struct net_device *dev, bool bAllowAllDA, bool WriteIntoReg);
3509
void (*rtllib_ips_leave_wq) (struct net_device *dev);
3510
void (*rtllib_ips_leave)(struct net_device *dev);
3513
void (*LeisurePSLeave)(struct net_device *dev);
3515
#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
3516
void (*SetBeaconRelatedRegistersHandler)(struct net_device* dev);
3517
bool (*check_ht_cap)(struct net_device* dev, struct sta_info *sta, struct rtllib_network* net);
3518
void (*Adhoc_InitRateAdaptive)(struct net_device *dev,struct sta_info *pEntry);
3520
void (*rtllib_rfkill_poll)(struct net_device *dev);
3522
/* This must be the last item so that it points to the data
3523
* allocated beyond this structure by alloc_rtllib */
3527
#define IEEE_A (1<<0)
3528
#define IEEE_B (1<<1)
3529
#define IEEE_G (1<<2)
3530
#define IEEE_N_24G (1<<4)
3531
#define IEEE_N_5G (1<<5)
3532
#define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G)
3534
/* Generate a 802.11 header */
3536
/* Uses the channel change callback directly
3537
* instead of [start/stop] scan callbacks
3539
#define IEEE_SOFTMAC_SCAN (1<<2)
3541
/* Perform authentication and association handshake */
3542
#define IEEE_SOFTMAC_ASSOCIATE (1<<3)
3544
/* Generate probe requests */
3545
#define IEEE_SOFTMAC_PROBERQ (1<<4)
3547
/* Generate respones to probe requests */
3548
#define IEEE_SOFTMAC_PROBERS (1<<5)
3550
/* The ieee802.11 stack will manages the netif queue
3551
* wake/stop for the driver, taking care of 802.11
3552
* fragmentation. See softmac.c for details. */
3553
#define IEEE_SOFTMAC_TX_QUEUE (1<<7)
3555
/* Uses only the softmac_data_hard_start_xmit
3556
* even for TX management frames.
3558
#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
3560
/* Generate beacons. The stack will enqueue beacons
3563
#define IEEE_SOFTMAC_BEACONS (1<<6)
3565
#ifdef _RTL8192_EXT_PATCH_
3566
static inline int rtllib_find_MP(struct rtllib_device* ieee, const u8* addr, u8 set)
3569
for (i=1; i<MAX_MP; i++) {
3570
if ((ieee->cryptlist[i]->used == 0) && set) {
3571
memcpy(ieee->cryptlist[i]->mac_addr, addr, ETH_ALEN);
3572
ieee->cryptlist[i]->used = 1;
3574
} else if (0 == memcmp(ieee->cryptlist[i]->mac_addr, addr, ETH_ALEN)) {
3582
static inline void *rtllib_priv(struct net_device *dev)
3584
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
3585
return ((struct rtllib_device *)netdev_priv(dev))->priv;
3587
return ((struct rtllib_device *)dev->priv)->priv;
3591
extern inline int rtllib_is_empty_essid(const char *essid, int essid_len)
3593
/* Single white space is for Linksys APs */
3594
if (essid_len == 1 && essid[0] == ' ')
3597
/* Otherwise, if the entire essid is 0, we assume it is hidden */
3600
if (essid[essid_len] != '\0')
3607
extern inline int rtllib_is_valid_mode(struct rtllib_device *ieee, int mode)
3610
* It is possible for both access points and our device to support
3611
* combinations of modes, so as long as there is one valid combination
3612
* of ap/device supported modes, then return success
3615
if ((mode & IEEE_A) &&
3616
(ieee->modulation & RTLLIB_OFDM_MODULATION) &&
3617
(ieee->freq_band & RTLLIB_52GHZ_BAND))
3620
if ((mode & IEEE_G) &&
3621
(ieee->modulation & RTLLIB_OFDM_MODULATION) &&
3622
(ieee->freq_band & RTLLIB_24GHZ_BAND))
3625
if ((mode & IEEE_B) &&
3626
(ieee->modulation & RTLLIB_CCK_MODULATION) &&
3627
(ieee->freq_band & RTLLIB_24GHZ_BAND))
3633
extern inline int rtllib_get_hdrlen(u16 fc)
3635
int hdrlen = RTLLIB_3ADDR_LEN;
3637
switch (WLAN_FC_GET_TYPE(fc)) {
3638
case RTLLIB_FTYPE_DATA:
3639
if ((fc & RTLLIB_FCTL_FROMDS) && (fc & RTLLIB_FCTL_TODS))
3640
hdrlen = RTLLIB_4ADDR_LEN; /* Addr4 */
3641
if(RTLLIB_QOS_HAS_SEQ(fc))
3642
hdrlen += 2; /* QOS ctrl*/
3644
case RTLLIB_FTYPE_CTL:
3645
switch (WLAN_FC_GET_STYPE(fc)) {
3646
case RTLLIB_STYPE_CTS:
3647
case RTLLIB_STYPE_ACK:
3648
hdrlen = RTLLIB_1ADDR_LEN;
3651
hdrlen = RTLLIB_2ADDR_LEN;
3660
static inline u8 *rtllib_get_payload(struct rtllib_hdr *hdr)
3662
switch (rtllib_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) {
3663
case RTLLIB_1ADDR_LEN:
3664
return ((struct rtllib_hdr_1addr *)hdr)->payload;
3665
case RTLLIB_2ADDR_LEN:
3666
return ((struct rtllib_hdr_2addr *)hdr)->payload;
3667
case RTLLIB_3ADDR_LEN:
3668
return ((struct rtllib_hdr_3addr *)hdr)->payload;
3669
case RTLLIB_4ADDR_LEN:
3670
return ((struct rtllib_hdr_4addr *)hdr)->payload;
3675
static inline int rtllib_is_ofdm_rate(u8 rate)
3677
switch (rate & ~RTLLIB_BASIC_RATE_MASK) {
3678
case RTLLIB_OFDM_RATE_6MB:
3679
case RTLLIB_OFDM_RATE_9MB:
3680
case RTLLIB_OFDM_RATE_12MB:
3681
case RTLLIB_OFDM_RATE_18MB:
3682
case RTLLIB_OFDM_RATE_24MB:
3683
case RTLLIB_OFDM_RATE_36MB:
3684
case RTLLIB_OFDM_RATE_48MB:
3685
case RTLLIB_OFDM_RATE_54MB:
3691
static inline int rtllib_is_cck_rate(u8 rate)
3693
switch (rate & ~RTLLIB_BASIC_RATE_MASK) {
3694
case RTLLIB_CCK_RATE_1MB:
3695
case RTLLIB_CCK_RATE_2MB:
3696
case RTLLIB_CCK_RATE_5MB:
3697
case RTLLIB_CCK_RATE_11MB:
3704
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
3705
static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
3707
const u16 *a = (const u16 *) addr1;
3708
const u16 *b = (const u16 *) addr2;
3710
BUILD_BUG_ON(ETH_ALEN != 6);
3711
return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
3716
extern void free_rtllib(struct net_device *dev);
3717
extern struct net_device *alloc_rtllib(int sizeof_priv);
3719
extern int rtllib_set_encryption(struct rtllib_device *ieee);
3723
#ifdef _RTL8192_EXT_PATCH_
3724
extern int rtllib_encrypt_fragment(
3725
struct rtllib_device *ieee,
3726
struct sk_buff *frag,
3727
int hdr_len, u8 is_mesh, u8 entry);
3729
extern int rtllib_encrypt_fragment(
3730
struct rtllib_device *ieee,
3731
struct sk_buff *frag,
3735
extern int rtllib_xmit(struct sk_buff *skb, struct net_device *dev);
3736
extern int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev);
3737
#ifdef _RTL8192_EXT_PATCH_
3738
extern int rtllib_classify(struct sk_buff *skb, u8 bIsAmsdu);
3739
extern int rtllib_mesh_xmit(struct sk_buff *skb, struct net_device *dev);
3740
extern inline int rtllib_put_snap(u8 *data, u16 h_proto);
3742
extern void rtllib_txb_free(struct rtllib_txb *);
3745
extern struct sk_buff *AMSDU_Aggregation(struct rtllib_device *ieee, struct sk_buff_head *pSendList);
3746
extern u8 AMSDU_GetAggregatibleList(struct rtllib_device *ieee, struct sk_buff *pCurSkb, struct sk_buff_head *pSendList, u8 queue_index);
3747
extern struct sk_buff *msh_AMSDU_Aggregation(struct rtllib_device *ieee, struct sk_buff_head *pSendList);
3748
extern u8 msh_AMSDU_GetAggregatibleList(struct rtllib_device *ieee, struct sk_buff *pCurSkb, struct sk_buff_head *pSendList, u8 queue_index);
3752
extern int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb,
3753
struct rtllib_rx_stats *rx_stats);
3754
extern void rtllib_rx_mgt(struct rtllib_device *ieee,
3755
struct sk_buff *skb,
3756
struct rtllib_rx_stats *stats);
3757
extern void rtllib_rx_probe_rq(struct rtllib_device *ieee,
3758
struct sk_buff *skb);
3759
extern int IsLegalChannel( struct rtllib_device *rtllib, u8 channel);
3762
extern int rtllib_wx_get_scan(struct rtllib_device *ieee,
3763
struct iw_request_info *info,
3764
union iwreq_data *wrqu, char *key);
3765
#ifdef _RTL8192_EXT_PATCH_
3766
extern int rtllib_wx_set_encode(struct rtllib_device *ieee,
3767
struct iw_request_info *info,
3768
union iwreq_data *wrqu, char *key, u8 is_mesh);
3769
extern int rtllib_wx_get_encode(struct rtllib_device *ieee,
3770
struct iw_request_info *info,
3771
union iwreq_data *wrqu, char *key, u8 is_mesh);
3772
extern int rtllib_mesh_set_encode_ext(struct rtllib_device *ieee,
3773
struct iw_point *encoding, struct iw_encode_ext *ext, int entry);
3774
#if WIRELESS_EXT >= 18
3775
extern int rtllib_wx_get_encode_ext(struct rtllib_device *ieee,
3776
struct iw_request_info *info,
3777
union iwreq_data* wrqu, char *extra, u8 is_mesh);
3778
extern int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
3779
struct iw_request_info *info,
3780
union iwreq_data* wrqu, char *extra, u8 is_mesh);
3783
extern int rtllib_wx_set_encode(struct rtllib_device *ieee,
3784
struct iw_request_info *info,
3785
union iwreq_data *wrqu, char *key);
3786
extern int rtllib_wx_get_encode(struct rtllib_device *ieee,
3787
struct iw_request_info *info,
3788
union iwreq_data *wrqu, char *key);
3789
#if WIRELESS_EXT >= 18
3790
extern int rtllib_wx_get_encode_ext(struct rtllib_device *ieee,
3791
struct iw_request_info *info,
3792
union iwreq_data* wrqu, char *extra);
3793
extern int rtllib_wx_set_encode_ext(struct rtllib_device *ieee,
3794
struct iw_request_info *info,
3795
union iwreq_data* wrqu, char *extra);
3798
extern int rtllib_wx_set_auth(struct rtllib_device *ieee,
3799
struct iw_request_info *info,
3800
struct iw_param *data, char *extra);
3801
extern int rtllib_wx_set_mlme(struct rtllib_device *ieee,
3802
struct iw_request_info *info,
3803
union iwreq_data *wrqu, char *extra);
3804
extern int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len);
3806
/* rtllib_softmac.c */
3807
extern short rtllib_is_54g(struct rtllib_network *net);
3808
extern short rtllib_is_shortslot(struct rtllib_network net);
3809
extern int rtllib_rx_frame_softmac(struct rtllib_device *ieee, struct sk_buff *skb,
3810
struct rtllib_rx_stats *rx_stats, u16 type,
3812
extern void rtllib_softmac_new_net(struct rtllib_device *ieee, struct rtllib_network *net);
3814
void SendDisassociation(struct rtllib_device *ieee, bool deauth, u16 asRsn);
3815
extern void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee);
3817
extern void rtllib_stop_send_beacons(struct rtllib_device *ieee);
3818
extern void notify_wx_assoc_event(struct rtllib_device *ieee);
3819
extern void rtllib_softmac_check_all_nets(struct rtllib_device *ieee);
3820
extern void rtllib_start_bss(struct rtllib_device *ieee);
3821
extern void rtllib_start_master_bss(struct rtllib_device *ieee);
3822
extern void rtllib_start_ibss(struct rtllib_device *ieee);
3823
extern void rtllib_softmac_init(struct rtllib_device *ieee);
3824
extern void rtllib_softmac_free(struct rtllib_device *ieee);
3825
extern void rtllib_associate_abort(struct rtllib_device *ieee);
3826
extern void rtllib_disassociate(struct rtllib_device *ieee);
3827
extern void rtllib_stop_scan(struct rtllib_device *ieee);
3828
extern bool rtllib_act_scanning(struct rtllib_device *ieee, bool sync_scan);
3829
extern void rtllib_stop_scan_syncro(struct rtllib_device *ieee);
3830
extern void rtllib_start_scan_syncro(struct rtllib_device *ieee, u8 is_mesh);
3831
extern inline struct sk_buff *rtllib_probe_req(struct rtllib_device *ieee);
3832
extern u8 MgntQuery_MgntFrameTxRate(struct rtllib_device *ieee);
3833
extern void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee, short pwr);
3834
extern void rtllib_sta_wakeup(struct rtllib_device *ieee, short nl);
3835
extern void rtllib_sta_ps_send_pspoll_frame(struct rtllib_device *ieee);
3836
extern void rtllib_check_all_nets(struct rtllib_device *ieee);
3837
extern void rtllib_start_protocol(struct rtllib_device *ieee);
3838
extern void rtllib_stop_protocol(struct rtllib_device *ieee, u8 shutdown);
3840
extern void rtllib_EnableNetMonitorMode(struct net_device* dev, bool bInitState);
3841
extern void rtllib_DisableNetMonitorMode(struct net_device* dev, bool bInitState);
3842
extern void rtllib_EnableIntelPromiscuousMode(struct net_device* dev, bool bInitState);
3843
extern void rtllib_DisableIntelPromiscuousMode(struct net_device* dev, bool bInitState);
3844
extern void rtllib_send_probe_requests(struct rtllib_device *ieee, u8 is_mesh);
3846
extern void rtllib_softmac_stop_protocol(struct rtllib_device *ieee, u8 mesh_flag, u8 shutdown);
3847
extern void rtllib_softmac_start_protocol(struct rtllib_device *ieee,u8 mesh_flag);
3849
#ifdef _RTL8192_EXT_PATCH_
3850
extern void rtllib_start_mesh_protocol(struct rtllib_device *ieee);
3851
extern void rtllib_stop_mesh_protocol(struct rtllib_device *ieee);
3853
extern void rtllib_reset_queue(struct rtllib_device *ieee);
3854
extern void rtllib_wake_queue(struct rtllib_device *ieee);
3855
extern void rtllib_stop_queue(struct rtllib_device *ieee);
3856
extern void rtllib_wake_all_queues(struct rtllib_device *ieee);
3857
extern void rtllib_stop_all_queues(struct rtllib_device *ieee);
3858
extern struct sk_buff *rtllib_get_beacon(struct rtllib_device *ieee);
3859
extern void rtllib_start_send_beacons(struct rtllib_device *ieee);
3860
extern void rtllib_stop_send_beacons(struct rtllib_device *ieee);
3861
extern int rtllib_wpa_supplicant_ioctl(struct rtllib_device *ieee, struct iw_point *p, u8 is_mesh);
3863
extern void notify_wx_assoc_event(struct rtllib_device *ieee);
3864
extern void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success);
3866
extern void softmac_mgmt_xmit(struct sk_buff *skb, struct rtllib_device *ieee);
3867
extern u16 rtllib_query_seqnum(struct rtllib_device*ieee, struct sk_buff* skb, u8* dst);
3868
extern u8 rtllib_ap_sec_type(struct rtllib_device *ieee);
3870
#ifdef _RTL8192_EXT_PATCH_
3871
extern void rtllib_resp_to_auth(struct rtllib_device *ieee, int s, u8* dest);
3872
extern void rtllib_associate_step1(struct rtllib_device *ieee,u8 * addr);
3873
extern bool rtllib_ext_prepare_to_joinmesh(struct rtllib_device *ieee, struct rtllib_network *pstat);
3874
extern u8 HTFilterMCSRate( struct rtllib_device* ieee, u8* pSupportMCS, u8* pOperateMCS);
3875
extern void HTUseDefaultSetting(struct rtllib_device* ieee);
3876
extern void rtllib_start_scan(struct rtllib_device *ieee);
3877
extern struct sk_buff* rtllib_ext_probe_resp_by_net(struct rtllib_device *ieee, u8 *dest, struct rtllib_network *net);
3878
extern int rtllib_network_init(struct rtllib_device *ieee, struct rtllib_probe_response *beacon, struct rtllib_network *network, struct rtllib_rx_stats *stats);
3879
extern struct rtllib_txb *rtllib_alloc_txb(int nr_frags, int txb_size, int gfp_mask);
3880
extern void rtllib_ext_send_11s_beacon(struct rtllib_device *ieee);
3883
/* rtllib_crypt_ccmp&tkip&wep.c */
3884
extern void rtllib_tkip_null(void);
3885
extern void rtllib_wep_null(void);
3886
extern void rtllib_ccmp_null(void);
3888
/* rtllib_softmac_wx.c */
3890
extern int rtllib_wx_get_wap(struct rtllib_device *ieee,
3891
struct iw_request_info *info,
3892
union iwreq_data *wrqu, char *ext);
3894
extern int rtllib_wx_set_wap(struct rtllib_device *ieee,
3895
struct iw_request_info *info,
3896
union iwreq_data *awrq,
3899
extern int rtllib_wx_get_essid(struct rtllib_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
3901
extern int rtllib_wx_set_rate(struct rtllib_device *ieee,
3902
struct iw_request_info *info,
3903
union iwreq_data *wrqu, char *extra);
3905
extern int rtllib_wx_get_rate(struct rtllib_device *ieee,
3906
struct iw_request_info *info,
3907
union iwreq_data *wrqu, char *extra);
3909
extern int rtllib_wx_set_mode(struct rtllib_device *ieee, struct iw_request_info *a,
3910
union iwreq_data *wrqu, char *b);
3912
extern int rtllib_wx_set_scan(struct rtllib_device *ieee, struct iw_request_info *a,
3913
union iwreq_data *wrqu, char *b);
3915
extern int rtllib_wx_set_essid(struct rtllib_device *ieee,
3916
struct iw_request_info *a,
3917
union iwreq_data *wrqu, char *extra);
3919
extern int rtllib_wx_get_mode(struct rtllib_device *ieee, struct iw_request_info *a,
3920
union iwreq_data *wrqu, char *b);
3922
extern int rtllib_wx_set_freq(struct rtllib_device *ieee, struct iw_request_info *a,
3923
union iwreq_data *wrqu, char *b);
3925
#ifdef _RTL8192_EXT_PATCH_
3926
extern int rtllib_wx_get_freq(struct rtllib_device *ieee, struct iw_request_info *a,
3927
union iwreq_data *wrqu, char *b, u8 is_mesh);
3929
extern int rtllib_wx_get_freq(struct rtllib_device *ieee, struct iw_request_info *a,
3930
union iwreq_data *wrqu, char *b);
3932
extern void rtllib_wx_sync_scan_wq(void *data);
3934
extern int rtllib_wx_set_rawtx(struct rtllib_device *ieee,
3935
struct iw_request_info *info,
3936
union iwreq_data *wrqu, char *extra);
3938
extern int rtllib_wx_get_name(struct rtllib_device *ieee,
3939
struct iw_request_info *info,
3940
union iwreq_data *wrqu, char *extra);
3942
extern int rtllib_wx_set_power(struct rtllib_device *ieee,
3943
struct iw_request_info *info,
3944
union iwreq_data *wrqu, char *extra);
3946
extern int rtllib_wx_get_power(struct rtllib_device *ieee,
3947
struct iw_request_info *info,
3948
union iwreq_data *wrqu, char *extra);
3950
extern int rtllib_wx_set_rts(struct rtllib_device *ieee,
3951
struct iw_request_info *info,
3952
union iwreq_data *wrqu, char *extra);
3954
extern int rtllib_wx_get_rts(struct rtllib_device *ieee,
3955
struct iw_request_info *info,
3956
union iwreq_data *wrqu, char *extra);
3957
#ifdef _RTL8192_EXT_PATCH_
3958
extern void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee, short pwr);
3960
#define MAX_RECEIVE_BUFFER_SIZE 9100
3961
extern void HTDebugHTCapability(u8* CapIE, u8* TitleString );
3962
extern void HTDebugHTInfo(u8* InfoIE, u8* TitleString);
3964
void HTSetConnectBwMode(struct rtllib_device* ieee, HT_CHANNEL_WIDTH Bandwidth, HT_EXTCHNL_OFFSET Offset);
3965
extern void HTUpdateDefaultSetting(struct rtllib_device* ieee);
3966
#ifdef _RTL8192_EXT_PATCH_
3967
extern void HTConstructCapabilityElement(struct rtllib_device* ieee, u8* posHTCap, u8* len, u8 isEncrypt, u8 bIsBcn,bool bAssoc);
3969
extern void HTConstructCapabilityElement(struct rtllib_device* ieee, u8* posHTCap, u8* len, u8 isEncrypt,bool bAssoc);
3971
extern void HTConstructInfoElement(struct rtllib_device* ieee, u8* posHTInfo, u8* len, u8 isEncrypt);
3972
extern void HTConstructRT2RTAggElement(struct rtllib_device* ieee, u8* posRT2RTAgg, u8* len);
3973
extern void HTOnAssocRsp(struct rtllib_device *ieee);
3974
extern void HTInitializeHTInfo(struct rtllib_device* ieee);
3975
extern void HTInitializeBssDesc(PBSS_HT pBssHT);
3976
extern void HTResetSelfAndSavePeerSetting(struct rtllib_device* ieee, struct rtllib_network * pNetwork);
3977
extern void HTUpdateSelfAndPeerSetting(struct rtllib_device* ieee, struct rtllib_network * pNetwork);
3978
extern u8 HTGetHighestMCSRate(struct rtllib_device* ieee, u8* pMCSRateSet, u8* pMCSFilter);
3979
extern u8 MCS_FILTER_ALL[];
3980
extern u16 MCS_DATA_RATE[2][2][77] ;
3981
extern u8 HTCCheck(struct rtllib_device* ieee, u8* pFrame);
3982
extern void HTResetIOTSetting(PRT_HIGH_THROUGHPUT pHTInfo);
3983
extern bool IsHTHalfNmodeAPs(struct rtllib_device* ieee);
3984
extern u16 HTHalfMcsToDataRate(struct rtllib_device* ieee, u8 nMcsRate);
3985
extern u16 HTMcsToDataRate( struct rtllib_device* ieee, u8 nMcsRate);
3986
extern u16 TxCountToDataRate( struct rtllib_device* ieee, u8 nDataRate);
3987
extern int rtllib_rx_ADDBAReq( struct rtllib_device* ieee, struct sk_buff *skb);
3988
extern int rtllib_rx_ADDBARsp( struct rtllib_device* ieee, struct sk_buff *skb);
3989
extern int rtllib_rx_DELBA(struct rtllib_device* ieee,struct sk_buff *skb);
3990
extern void TsInitAddBA( struct rtllib_device* ieee, PTX_TS_RECORD pTS, u8 Policy, u8 bOverwritePending);
3991
extern void TsInitDelBA( struct rtllib_device* ieee, PTS_COMMON_INFO pTsCommonInfo, TR_SELECT TxRxSelect);
3992
extern void BaSetupTimeOut(unsigned long data);
3993
extern void TxBaInactTimeout(unsigned long data);
3994
extern void RxBaInactTimeout(unsigned long data);
3995
extern void ResetBaEntry( PBA_RECORD pBA);
3997
struct rtllib_device* ieee,
3998
PTS_COMMON_INFO *ppTS,
4001
TR_SELECT TxRxSelect,
4004
extern void TSInitialize(struct rtllib_device *ieee);
4005
extern void TsStartAddBaProcess(struct rtllib_device* ieee, PTX_TS_RECORD pTxTS);
4006
extern void RemovePeerTS(struct rtllib_device* ieee, u8* Addr);
4007
extern void RemoveAllTS(struct rtllib_device* ieee);
4008
#ifdef _RTL8192_EXT_PATCH_
4009
extern void ResetAdmitTRStream(struct rtllib_device *ieee, u8 *Addr);
4011
void rtllib_softmac_scan_syncro(struct rtllib_device *ieee, u8 is_mesh);
4013
extern const long rtllib_wlan_frequencies[];
4015
extern inline void rtllib_increment_scans(struct rtllib_device *ieee)
4020
extern inline int rtllib_get_scans(struct rtllib_device *ieee)
4025
static inline const char *escape_essid(const char *essid, u8 essid_len) {
4026
static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
4027
const char *s = essid;
4030
if (rtllib_is_empty_essid(essid, essid_len)) {
4031
memcpy(escaped, "<hidden>", sizeof("<hidden>"));
4035
essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE);
4036
while (essid_len--) {
4049
#define CONVERT_RATE(_ieee, _MGN_RATE) (_MGN_RATE<MGN_MCS0)?(_MGN_RATE):(HTMcsToDataRate(_ieee, (u8)_MGN_RATE))
4051
#ifdef BUILT_IN_RTLLIB
4052
/* fun with the built-in rtllib stack... */
4053
int rtllib_init(void);
4054
void rtllib_exit(void);
4055
int rtllib_crypto_init(void);
4056
void rtllib_crypto_deinit(void);
4057
int rtllib_crypto_tkip_init(void);
4058
void rtllib_crypto_tkip_exit(void);
4059
int rtllib_crypto_ccmp_init(void);
4060
void rtllib_crypto_ccmp_exit(void);
4061
int rtllib_crypto_wep_init(void);
4062
void rtllib_crypto_wep_exit(void);
4065
void rtllib_MgntDisconnectIBSS(struct rtllib_device* rtllib);
4066
void rtllib_MlmeDisassociateRequest(struct rtllib_device* rtllib, u8* asSta,u8 asRsn);
4067
void rtllib_MgntDisconnectAP(struct rtllib_device* rtllib, u8 asRsn);
4068
bool rtllib_MgntDisconnect(struct rtllib_device* rtllib,u8 asRsn);
4071
void enqueue_mgmt(struct rtllib_device *ieee, struct sk_buff *skb);
4072
void rtllib_start_scan(struct rtllib_device *ieee);
4073
void constructWMMIE(u8* wmmie, u8* wmm_len,u8 oui_subtype);
4074
/* For the function is more related to hardware setting, it's better to use the
4075
* ieee handler to refer to it.
4077
extern void rtllib_update_active_chan_map(struct rtllib_device *ieee);
4078
extern void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, PRX_TS_RECORD pTS);
4079
extern int rtllib_data_xmit(struct sk_buff *skb, struct net_device *dev);
4080
extern int rtllib_parse_info_param(struct rtllib_device *ieee,
4081
struct rtllib_info_element *info_element,
4083
struct rtllib_network *network,
4084
struct rtllib_rx_stats *stats);
4086
void rtllib_indicate_packets(struct rtllib_device *ieee, struct rtllib_rxb** prxbIndicateArray,u8 index);
4087
#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE) || defined(RTL8192CE)
4088
extern void IbssAgeFunction(struct rtllib_device *ieee);
4089
extern struct sta_info *GetStaInfo(struct rtllib_device *ieee, u8 *addr);
4090
extern void DelStaInfoList(struct rtllib_device *ieee);
4091
extern void DelStaInfo(struct rtllib_device *ieee, u8 *addr);
4093
extern u8 HTFilterMCSRate( struct rtllib_device* ieee, u8* pSupportMCS, u8* pOperateMCS);
4094
extern void HTUseDefaultSetting(struct rtllib_device* ieee);
4095
#define RT_ASOC_RETRY_LIMIT 5
4096
u8 MgntQuery_TxRateExcludeCCKRates(struct rtllib_device *ieee);
4097
#ifdef _RTL8192_EXT_PATCH_
4098
extern unsigned int rtllib_MFIE_rate_len(struct rtllib_device *ieee);
4099
extern void rtllib_MFIE_Brate(struct rtllib_device *ieee, u8 **tag_p);
4100
extern void rtllib_MFIE_Grate(struct rtllib_device *ieee, u8 **tag_p);
4101
extern void rtllib_WMM_Info(struct rtllib_device *ieee, u8 **tag_p);
4104
extern void rtllib_TURBO_Info(struct rtllib_device *ieee, u8 **tag_p);
4106
#ifndef ENABLE_LOCK_DEBUG
4107
#define SPIN_LOCK_IEEE(plock) spin_lock_irqsave((plock), flags)
4108
#define SPIN_UNLOCK_IEEE(plock) spin_unlock_irqrestore((plock), flags)
4109
#define SPIN_LOCK_IEEE_REORDER(plock) spin_lock_irqsave((plock), flags)
4110
#define SPIN_UNLOCK_IEEE_REORDER(plock) spin_unlock_irqrestore((plock), flags)
4111
#define SPIN_LOCK_IEEE_WPAX(plock) spin_lock_irqsave((plock), flags)
4112
#define SPIN_UNLOCK_IEEE_WPAX(plock) spin_unlock_irqrestore((plock), flags)
4113
#define SPIN_LOCK_IEEE_MGNTTX(plock) spin_lock_irqsave((plock), flags)
4114
#define SPIN_UNLOCK_IEEE_MGNTTX(plock) spin_unlock_irqrestore((plock), flags)
4115
#define SPIN_LOCK_IEEE_BCN(plock) spin_lock_irqsave((plock), flags)
4116
#define SPIN_UNLOCK_IEEE_BCN(plock) spin_unlock_irqrestore((plock), flags)
4117
#define SPIN_LOCK_MSH_STAINFO(plock) spin_lock_irqsave((plock), flags)
4118
#define SPIN_UNLOCK_MSH_STAINFO(plock) spin_unlock_irqrestore((plock), flags)
4119
#define SPIN_LOCK_MSH_PREQ(plock) spin_lock_irqsave((plock), flags)
4120
#define SPIN_UNLOCK_MSH_PREQ(plock) spin_unlock_irqrestore((plock), flags)
4121
#define SPIN_LOCK_MSH_QUEUE(plock) spin_lock_irqsave((plock), flags)
4122
#define SPIN_UNLOCK_MSH_QUEUE(plock) spin_unlock_irqrestore((plock), flags)
4123
#define SPIN_LOCK_PRIV_RFPS(plock) spin_lock_irqsave((plock), flags)
4124
#define SPIN_UNLOCK_PRIV_RFPS(plock) spin_unlock_irqrestore((plock), flags)
4125
#define SPIN_LOCK_PRIV_IRQTH(plock) spin_lock_irqsave((plock), flags)
4126
#define SPIN_UNLOCK_PRIV_IRQTH(plock) spin_unlock_irqrestore((plock), flags)
4127
#define SPIN_LOCK_PRIV_TX(plock) spin_lock_irqsave((plock), flags)
4128
#define SPIN_UNLOCK_PRIV_TX(plock) spin_unlock_irqrestore((plock), flags)
4129
#define SPIN_LOCK_PRIV_D3(plock) spin_lock_irqsave((plock), flags)
4130
#define SPIN_UNLOCK_PRIV_D3(plock) spin_unlock_irqrestore((plock), flags)
4131
#define SPIN_LOCK_PRIV_RF(plock) spin_lock_irqsave((plock), flags)
4132
#define SPIN_UNLOCK_PRIV_RF(plock) spin_unlock_irqrestore((plock), flags)
4133
#define SPIN_LOCK_PRIV_PS(plock) spin_lock_irqsave((plock), flags)
4134
#define SPIN_UNLOCK_PRIV_PS(plock) spin_unlock_irqrestore((plock), flags)
4135
#define SEM_DOWN_IEEE_WX(psem) down(psem)
4136
#define SEM_UP_IEEE_WX(psem) up(psem)
4137
#define SEM_DOWN_IEEE_SCAN(psem) down(psem)
4138
#define SEM_UP_IEEE_SCAN(psem) up(psem)
4139
#define SEM_DOWN_IEEE_IPS(psem) down(psem)
4140
#define SEM_UP_IEEE_IPS(psem) up(psem)
4141
#define SEM_DOWN_PRIV_WX(psem) down(psem)
4142
#define SEM_UP_PRIV_WX(psem) up(psem)
4143
#define SEM_DOWN_PRIV_RF(psem) down(psem)
4144
#define SEM_UP_PRIV_RF(psem) up(psem)
4145
#define MUTEX_LOCK_PRIV(pmutex) mutex_lock(pmutex)
4146
#define MUTEX_UNLOCK_PRIV(pmutex) mutex_unlock(pmutex)
4148
#ifdef RTL8192S_WAPI_SUPPORT
4149
extern void WapiInit(struct rtllib_device *ieee);
4150
extern void WapiExit(struct rtllib_device *ieee);
4151
extern int WAPI_CreateEvent_Send(struct rtllib_device *ieee, u8 EventId, u8 *MacAddr, u8 *Buff, u16 BufLen);
4152
extern void WapiCreateAppEventAndSend(
4153
struct rtllib_device *ieee,
4162
extern void WapiReturnAllStaInfo(struct rtllib_device *ieee);
4163
extern void WapiReturnOneStaInfo(struct rtllib_device *ieee, u8 *MacAddr, u8 from_app);
4164
extern void WapiFreeAllStaInfo(struct rtllib_device *ieee);
4165
extern u8 SecIsWAIPacket(struct rtllib_device* ieee,struct sk_buff *skb);
4166
extern void WapiHandleRecvPacket(struct rtllib_device* ieee,struct sk_buff *skb,u8 WaiPkt);
4167
extern void WapiSetIE(struct rtllib_device *ieee);
4168
extern u32 WapiComparePN(u8 *PN1, u8 *PN2);
4169
extern u8 WapiIncreasePN(u8 *PN, u8 AddCount);
4170
extern void WapiGetLastRxUnicastPNForQoSData(
4172
PRT_WAPI_STA_INFO pWapiStaInfo,
4174
extern void WapiSetLastRxUnicastPNForQoSData(
4177
PRT_WAPI_STA_INFO pWapiStaInfo);
4178
extern u8 WapiCheckPnInSwDecrypt(
4179
struct rtllib_device *ieee,
4180
struct sk_buff *pskb);
4181
extern u8 WapiCheckDropForRxReorderCase(
4182
struct rtllib_device *ieee,
4183
struct rtllib_rxb* prxb);
4184
extern int SecSMS4HeaderFillIV(struct rtllib_device *ieee, struct sk_buff *pskb);
4185
extern void SecSWSMS4Encryption(
4186
struct rtllib_device *ieee,
4187
struct sk_buff *pskb);
4188
extern u8 SecSWSMS4Decryption(
4189
struct rtllib_device *ieee,
4190
struct sk_buff *pskb,
4191
struct rtllib_rx_stats *rx_stats);
4193
extern int WapiSendWaiPacket(struct rtllib_device *ieee, struct sk_buff *pskb);
4194
extern void ieee80211_disassociate_from_app(struct rtllib_device *ieee);
4195
extern void ConstructWapiIEForInit(struct rtllib_device* ieee);
4196
extern void wapi_test_init(struct rtllib_device *ieee);
4198
static inline void dump_buf(u8 *buf, u32 len)
4201
printk("-----------------Len %d----------------\n", len);
4202
for(i=0; i<len; i++)
4203
printk("%2.2x-", *(buf+i));
4206
#endif /* RTLLIB_H */