~ubuntu-branches/ubuntu/trusty/linux-linaro-omap/trusty

« back to all changes in this revision

Viewing changes to ubuntu/rtl8192se/rtllib/rtllib.h

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-57i0gl3v99b3lkfg
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Merged with mainline rtllib.h in Aug 2004.  Original ieee802_11
3
 
 * remains copyright by the original authors
4
 
 *
5
 
 * Portions of the merged code are based on Host AP (software wireless
6
 
 * LAN access point) driver for Intersil Prism2/2.5/3.
7
 
 *
8
 
 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
9
 
 * <jkmaline@cc.hut.fi>
10
 
 * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
11
 
 *
12
 
 * Adaption to a generic IEEE 802.11 stack by James Ketrenos
13
 
 * <jketreno@linux.intel.com>
14
 
 * Copyright (c) 2004, Intel Corporation
15
 
 *
16
 
 * Modified for Realtek's wi-fi cards by Andrea Merello
17
 
 * <andreamrl@tiscali.it>
18
 
 *
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
22
 
 * more details.
23
 
 */
24
 
#ifndef RTLLIB_H
25
 
#define RTLLIB_H
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>
32
 
#else
33
 
#include <linux/jffs.h>
34
 
#include <linux/tqueue.h>
35
 
#endif
36
 
#include <linux/timer.h>
37
 
#include <linux/sched.h>
38
 
 
39
 
#include <linux/delay.h>
40
 
#include <linux/wireless.h>
41
 
 
42
 
#ifdef CONFIG_CFG_80211 
43
 
#include <net/cfg80211.h>
44
 
#endif
45
 
 
46
 
#include "rtl819x_HT.h"
47
 
#include "rtl819x_BA.h"
48
 
#include "rtl819x_TS.h"
49
 
 
50
 
#include <linux/netdevice.h>
51
 
#include <linux/if_arp.h> /* ARPHRD_ETHER */
52
 
 
53
 
#ifndef WIRELESS_SPY
54
 
#define WIRELESS_SPY            
55
 
#endif
56
 
#include <net/iw_handler.h>     
57
 
 
58
 
#if defined (RTL8192S_WAPI_SUPPORT)
59
 
#include "wapi.h"
60
 
#include "wapi_interface.h"
61
 
#endif
62
 
 
63
 
#ifndef IEEE80211_RADIOTAP_F_BADFCS
64
 
#define IEEE80211_RADIOTAP_F_BADFCS     0x40    /* bad FCS */
65
 
#endif
66
 
 
67
 
#ifndef IW_MODE_MONITOR
68
 
#define IW_MODE_MONITOR 6
69
 
#endif
70
 
 
71
 
#ifndef IWEVCUSTOM
72
 
#define IWEVCUSTOM 0x8c02
73
 
#endif
74
 
 
75
 
#ifndef IW_CUSTOM_MAX
76
 
/* Max number of char in custom event - use multiple of them if needed */
77
 
#define IW_CUSTOM_MAX   256     /* In bytes */
78
 
#endif
79
 
 
80
 
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
81
 
#define jiffies_to_msecs(t)  ((t) * 1000 / HZ)
82
 
#ifndef __bitwise
83
 
#define __bitwise __attribute__((bitwise))
84
 
#endif
85
 
typedef __u16  __le16;
86
 
 
87
 
#if (WIRELESS_EXT < 16)
88
 
struct iw_spy_data{
89
 
        /* --- Standard spy support --- */
90
 
        int                     spy_number;
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];
97
 
}; 
98
 
#endif
99
 
#endif
100
 
 
101
 
#ifndef container_of
102
 
/**
103
 
 * container_of - cast a member of a structure out to the containing structure
104
 
 *
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.
108
 
 *
109
 
 */
110
 
#define container_of(ptr, type, member) ({                      \
111
 
        const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
112
 
        (type *)( (char *)__mptr - offsetof(type,member) );})
113
 
#endif
114
 
 
115
 
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18))
116
 
#define skb_tail_pointer_rsl(skb) skb_tail_pointer(skb)
117
 
#else
118
 
#define skb_tail_pointer_rsl(skb) skb->tail
119
 
#endif
120
 
 
121
 
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
122
 
        #define EXPORT_SYMBOL_RSL(x) EXPORT_SYMBOL(x)
123
 
#else
124
 
        #define EXPORT_SYMBOL_RSL(x) EXPORT_SYMBOL_NOVERS(x)
125
 
#endif
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)
128
 
{
129
 
        task->routine = func;
130
 
        task->data      = data;
131
 
        INIT_LIST_HEAD(&task->list);
132
 
        task->sync = 0;
133
 
}
134
 
#endif
135
 
 
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)
138
 
{
139
 
        timer->function = function;
140
 
        timer->data     = data;
141
 
}
142
 
#endif
143
 
 
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)
152
 
#else
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)
156
 
#endif
157
 
 
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)
166
 
#else
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)
170
 
#endif
171
 
 
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) 
175
 
#else
176
 
        #define container_of_work_rsl(x,y,z) (x)
177
 
        #define container_of_dwork_rsl(x,y,z) (x) 
178
 
#endif
179
 
 
180
 
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
181
 
static inline char *
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 */
187
 
{
188
 
        /* Check if it's possible */
189
 
        if((stream + event_len) < ends) {
190
 
                iwe->len = event_len;
191
 
                ndelay(1);   
192
 
                memcpy(stream, (char *) iwe, event_len);
193
 
                stream += event_len;
194
 
        }
195
 
        return stream;
196
 
}
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)
199
 
#else
200
 
        #define iwe_stream_add_event_rsl(info,start,stop,iwe,len) iwe_stream_add_event(start,stop,iwe,len)
201
 
#endif
202
 
 
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)
205
 
#else
206
 
        #define iwe_stream_add_point_rsl(info,start,stop,iwe,p) iwe_stream_add_point(start,stop,iwe,p)
207
 
#endif
208
 
 
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)
212
 
#else
213
 
        #define usb_alloc_urb_rsl(x,y) usb_alloc_urb(x)
214
 
        #define usb_submit_urb_rsl(x,y) usb_submit_urb(x)
215
 
#endif
216
 
 
217
 
static inline void *netdev_priv_rsl(struct net_device *dev)
218
 
{
219
 
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) 
220
 
        return netdev_priv(dev);
221
 
#else
222
 
        return dev->priv;
223
 
#endif
224
 
}
225
 
 
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
233
 
#endif
234
 
/* added for rtl819x tx procedure */
235
 
#define MAX_QUEUE_SIZE          0x10
236
 
 
237
 
#if defined(RTL8192SU) || defined(RTL8190P) ||defined(RTL8192U) ||defined(RTL8192E)
238
 
#define BK_QUEUE                               0
239
 
#define BE_QUEUE                               1
240
 
#define VI_QUEUE                               2
241
 
#define VO_QUEUE                               3
242
 
#define HCCA_QUEUE                             4
243
 
#define TXCMD_QUEUE                            5
244
 
#define MGNT_QUEUE                             6
245
 
#define HIGH_QUEUE                             7
246
 
#define BEACON_QUEUE                           8
247
 
#elif defined(RTL8192SE)
248
 
#define BK_QUEUE                               0
249
 
#define BE_QUEUE                               1
250
 
#define VI_QUEUE                               2
251
 
#define VO_QUEUE                               3
252
 
#define BEACON_QUEUE                          4
253
 
#define TXCMD_QUEUE                            5
254
 
#define MGNT_QUEUE                             6
255
 
#define HIGH_QUEUE                             7
256
 
#define HCCA_QUEUE                             8
257
 
 
258
 
#elif defined(RTL8192CE)
259
 
 
260
 
#define BK_QUEUE                                                0               
261
 
#define BE_QUEUE                                                1               
262
 
#define VI_QUEUE                                                2               
263
 
#define VO_QUEUE                                                3               
264
 
#define BEACON_QUEUE                            4               
265
 
#define TXCMD_QUEUE                                             5               
266
 
#define MGNT_QUEUE                                              6       
267
 
#define HIGH_QUEUE                                              7       
268
 
#define HCCA_QUEUE                                      8
269
 
#endif
270
 
 
271
 
#ifdef RTL8192CE
272
 
#define LOW_QUEUE                                               BE_QUEUE
273
 
#define NORMAL_QUEUE                                    MGNT_QUEUE
274
 
#else
275
 
#define LOW_QUEUE                              BE_QUEUE
276
 
#define NORMAL_QUEUE                           MGNT_QUEUE
277
 
#endif
278
 
 
279
 
#ifndef IW_MODE_MESH 
280
 
#define IW_MODE_MESH                    7       
281
 
#endif
282
 
#ifdef _RTL8192_EXT_PATCH_
283
 
#define WIFI_MESH_TYPE  RTLLIB_FTYPE_DATA
284
 
 
285
 
#define WLAN_MESH_HDR_LEN 6
286
 
#define WLAN_MESH_HDR_6ADDR_LEN 18                      
287
 
#define WLAN_MESH_HDR_4ADDR_LEN 6                       
288
 
#define MAX_MP                                          65                      
289
 
#define IEEE_MESH_MAC_HASH_SIZE 31
290
 
#define MAX_MESH_ID_LEN 33
291
 
#define MAX_HOST_NAME_LENGTH                    33
292
 
#endif
293
 
#define AMSDU_SUBHEADER_LEN 14
294
 
#define SWRF_TIMEOUT                            50
295
 
 
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)
311
 
 
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              
317
 
#endif
318
 
 
319
 
/* defined for skb cb field */
320
 
/* At most 28 byte */
321
 
typedef struct cb_desc {
322
 
        /* Tx Desc Related flags (8-9) */
323
 
        u8 bLastIniPkt:1;
324
 
        u8 bCmdOrInit:1;
325
 
        u8 bFirstSeg:1;
326
 
        u8 bLastSeg:1;
327
 
        u8 bEncrypt:1;
328
 
        u8 bTxDisableRateFallBack:1;
329
 
        u8 bTxUseDriverAssingedRate:1;
330
 
        u8 bHwSec:1; 
331
 
 
332
 
        u8 nStuckCount; 
333
 
 
334
 
        /* Tx Firmware Relaged flags (10-11)*/
335
 
        u8 bCTSEnable:1;
336
 
        u8 bRTSEnable:1;
337
 
        u8 bUseShortGI:1;
338
 
        u8 bUseShortPreamble:1;
339
 
        u8 bTxEnableFwCalcDur:1;
340
 
        u8 bAMPDUEnable:1;
341
 
        u8 bRTSSTBC:1;
342
 
        u8 RTSSC:1;
343
 
 
344
 
        u8 bRTSBW:1;
345
 
        u8 bPacketBW:1;
346
 
        u8 bRTSUseShortPreamble:1;
347
 
        u8 bRTSUseShortGI:1;
348
 
        u8 bMulticast:1;
349
 
        u8 bBroadcast:1;
350
 
        u8 drv_agg_enable:1;
351
 
#ifdef _RTL8192_EXT_PATCH_
352
 
        u8 mesh_pkt:1;
353
 
#else
354
 
        u8 reserved2:1;
355
 
#endif
356
 
 
357
 
        /* Tx Desc related element(12-19) */
358
 
        u8 rata_index;
359
 
        u8 queue_index;
360
 
        u16 txbuf_size;
361
 
        u8 RATRIndex;
362
 
#ifdef _RTL8192_EXT_PATCH_
363
 
        u8 mesh_type:2;
364
 
        u8 bFromAggrQ:1;
365
 
        u8 bAMSDU:1;
366
 
        u8 brelay_pkt:1;
367
 
        u8 badhoc:1;
368
 
        u8 bretry_pkt:1;
369
 
        u8 bFromRx:1;
370
 
#else
371
 
        u8 bAMSDU:1;
372
 
        u8 bFromAggrQ:1;
373
 
        u8 reserved6:6;
374
 
#endif
375
 
        u8 macId;
376
 
        u8 priority;
377
 
 
378
 
        /* Tx firmware related element(20-27) */
379
 
        u8 data_rate;
380
 
        u8 rts_rate;
381
 
        u8 ampdu_factor;
382
 
        u8 ampdu_density;
383
 
        u8 DrvAggrNum;
384
 
        u8 bdhcp;
385
 
        u16 pkt_size;
386
 
        u8 bIsSpecialDataFrame;
387
 
 
388
 
        u8 DescPktType;
389
 
 
390
 
        u8 bBTTxPacket;
391
 
        u8 bIsBTProbRsp;
392
 
        u8 bRxBTdata;
393
 
}cb_desc, *pcb_desc;
394
 
                        
395
 
/*--------------------------Define -------------------------------------------*/
396
 
#define MGN_1M                  0x02
397
 
#define MGN_2M                  0x04
398
 
#define MGN_5_5M                0x0b
399
 
#define MGN_11M                 0x16
400
 
 
401
 
#define MGN_6M                  0x0c
402
 
#define MGN_9M                  0x12
403
 
#define MGN_12M                 0x18
404
 
#define MGN_18M                 0x24
405
 
#define MGN_24M                 0x30
406
 
#define MGN_36M                 0x48
407
 
#define MGN_48M                 0x60
408
 
#define MGN_54M                 0x6c
409
 
 
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
442
 
 
443
 
 
444
 
enum    _ReasonCode{
445
 
        unspec_reason   = 0x1,
446
 
        auth_not_valid  = 0x2,
447
 
        deauth_lv_ss    = 0x3, 
448
 
        inactivity              = 0x4,
449
 
        ap_overload     = 0x5, 
450
 
        class2_err              = 0x6,
451
 
        class3_err              = 0x7, 
452
 
        disas_lv_ss     = 0x8,
453
 
        asoc_not_auth   = 0x9,
454
 
 
455
 
        mic_failure     = 0xe,
456
 
 
457
 
        invalid_IE              = 0x0d,
458
 
        four_way_tmout  = 0x0f,
459
 
        two_way_tmout   = 0x10,
460
 
        IE_dismatch     = 0x11,
461
 
        invalid_Gcipher = 0x12,
462
 
        invalid_Pcipher = 0x13,
463
 
        invalid_AKMP    = 0x14,
464
 
        unsup_RSNIEver = 0x15,
465
 
        invalid_RSNIE   = 0x16,
466
 
        auth_802_1x_fail= 0x17,
467
 
        ciper_reject            = 0x18,
468
 
 
469
 
        QoS_unspec              = 0x20, 
470
 
        QAP_bandwidth   = 0x21, 
471
 
        poor_condition  = 0x22, 
472
 
        no_facility     = 0x23, 
473
 
        req_declined    = 0x25, 
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, 
480
 
};
481
 
 
482
 
typedef enum _HAL_DEF_VARIABLE{
483
 
        HAL_DEF_TPC_ENABLE,                             
484
 
        HAL_DEF_INIT_GAIN,                              
485
 
        HAL_DEF_PROT_IMP_MODE,                  
486
 
        HAL_DEF_HIGH_POWER_MECHANISM,   
487
 
        HAL_DEF_RATE_ADAPTIVE_MECHANISM,        
488
 
        HAL_DEF_ANTENNA_DIVERSITY_MECHANISM,    
489
 
        HAL_DEF_LED,                                    
490
 
        HAL_DEF_CW_MAX_MIN,                             
491
 
         
492
 
        HAL_DEF_WOWLAN,
493
 
        HAL_DEF_ENDPOINTS,                              
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, 
498
 
        HW_DEF_GPIO,
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, 
503
 
}HAL_DEF_VARIABLE;
504
 
 
505
 
 
506
 
typedef enum _HW_VARIABLES{
507
 
        HW_VAR_ETHER_ADDR,
508
 
        HW_VAR_MULTICAST_REG,           
509
 
        HW_VAR_BASIC_RATE,
510
 
        HW_VAR_BSSID,
511
 
        HW_VAR_MEDIA_STATUS,
512
 
        HW_VAR_SECURITY_CONF,
513
 
        HW_VAR_BEACON_INTERVAL,
514
 
        HW_VAR_ATIM_WINDOW,     
515
 
        HW_VAR_LISTEN_INTERVAL,
516
 
        HW_VAR_CS_COUNTER,
517
 
        HW_VAR_DEFAULTKEY0,
518
 
        HW_VAR_DEFAULTKEY1,
519
 
        HW_VAR_DEFAULTKEY2,
520
 
        HW_VAR_DEFAULTKEY3,
521
 
        HW_VAR_SIFS,
522
 
        HW_VAR_DIFS,
523
 
        HW_VAR_EIFS,
524
 
        HW_VAR_SLOT_TIME,
525
 
        HW_VAR_ACK_PREAMBLE,
526
 
        HW_VAR_CW_CONFIG,
527
 
        HW_VAR_CW_VALUES,
528
 
        HW_VAR_RATE_FALLBACK_CONTROL,
529
 
        HW_VAR_CONTENTION_WINDOW,
530
 
        HW_VAR_RETRY_COUNT,
531
 
        HW_VAR_TR_SWITCH,
532
 
        HW_VAR_COMMAND,                 
533
 
        HW_VAR_WPA_CONFIG,              
534
 
        HW_VAR_AMPDU_MIN_SPACE, 
535
 
        HW_VAR_SHORTGI_DENSITY, 
536
 
        HW_VAR_AMPDU_FACTOR,
537
 
        HW_VAR_MCS_RATE_AVAILABLE,
538
 
        HW_VAR_AC_PARAM,                        
539
 
        HW_VAR_ACM_CTRL,                        
540
 
        HW_VAR_DIS_Req_Qsize,           
541
 
        HW_VAR_CCX_CHNL_LOAD,           
542
 
        HW_VAR_CCX_NOISE_HISTOGRAM,     
543
 
        HW_VAR_CCX_CLM_NHM,                     
544
 
        HW_VAR_TxOPLimit,                               
545
 
        HW_VAR_TURBO_MODE,                      
546
 
        HW_VAR_RF_STATE,                        
547
 
        HW_VAR_RF_OFF_BY_HW,            
548
 
        HW_VAR_BUS_SPEED,               
549
 
        HW_VAR_SET_DEV_POWER,   
550
 
 
551
 
        HW_VAR_RCR,                             
552
 
        HW_VAR_RATR_0,
553
 
        HW_VAR_RRSR,
554
 
        HW_VAR_CPU_RST,
555
 
        HW_VAR_CECHK_BSSID,
556
 
        HW_VAR_LBK_MODE,                        
557
 
        HW_VAR_AES_11N_FIX,
558
 
        HW_VAR_USB_RX_AGGR,
559
 
        HW_VAR_USER_CONTROL_TURBO_MODE,
560
 
        HW_VAR_RETRY_LIMIT,
561
 
        HW_VAR_INIT_TX_RATE,  
562
 
        HW_VAR_TX_RATE_REG,  
563
 
        HW_VAR_EFUSE_USAGE, 
564
 
        HW_VAR_EFUSE_BYTES,
565
 
        HW_VAR_AUTOLOAD_STATUS, 
566
 
        HW_VAR_RF_2R_DISABLE, 
567
 
        HW_VAR_SET_RPWM,
568
 
        HW_VAR_H2C_FW_PWRMODE, 
569
 
        HW_VAR_H2C_FW_JOINBSSRPT, 
570
 
        HW_VAR_1X1_RECV_COMBINE,        
571
 
        HW_VAR_STOP_SEND_BEACON,
572
 
        HW_VAR_TSF_TIMER,                       
573
 
        HW_VAR_IO_CMD,
574
 
        
575
 
        HW_VAR_RF_RECOVERY,
576
 
        HW_VAR_H2C_FW_UPDATE_GTK, 
577
 
        HW_VAR_WF_MASK, 
578
 
        HW_VAR_WF_CRC,  
579
 
        HW_VAR_WF_IS_MAC_ADDR, 
580
 
        HW_VAR_H2C_FW_OFFLOAD, 
581
 
        HW_VAR_RESET_WFCRC, 
582
 
 
583
 
        HW_VAR_HANDLE_FW_C2H,           
584
 
        HW_VAR_DL_FW_RSVD_PAGE,                 
585
 
        HW_VAR_AID,                             
586
 
        HW_VAR_HW_SEQ_ENABLE,           
587
 
        HW_VAR_CORRECT_TSF,                     
588
 
        HW_VAR_BCN_VALID,                               
589
 
        HW_VAR_FWLPS_RF_ON,                     
590
 
        HW_VAR_DUAL_TSF_RST,                    
591
 
        HW_VAR_SWITCH_EPHY_WoWLAN, 
592
 
        HW_VAR_INT_MIGRATION, 
593
 
        HW_VAR_INT_AC, 
594
 
        HW_VAR_RF_TIMING,          
595
 
 
596
 
        HW_VAR_MRC,          
597
 
}HW_VARIABLES;
598
 
 
599
 
typedef enum _RT_OP_MODE{
600
 
        RT_OP_MODE_AP,
601
 
        RT_OP_MODE_INFRASTRUCTURE,
602
 
        RT_OP_MODE_IBSS,
603
 
        RT_OP_MODE_NO_LINK,
604
 
}RT_OP_MODE, *PRT_OP_MODE;
605
 
 
606
 
 
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)
608
 
 
609
 
#define MGMT_QUEUE_NUM 5
610
 
 
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
615
 
 
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
631
 
 
632
 
#define IEEE_KEY_MGMT_IEEE8021X                 1
633
 
#define IEEE_KEY_MGMT_PSK                       2
634
 
 
635
 
#define IEEE_MLME_STA_DEAUTH                    1
636
 
#define IEEE_MLME_STA_DISASSOC                  2
637
 
 
638
 
 
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
646
 
 
647
 
#define MAX_IE_LEN  0xff
648
 
#ifdef _RTL8192_EXT_PATCH_
649
 
#define ENABLE_NULL_PT_DEBUG
650
 
#endif
651
 
#ifdef ENABLE_NULL_PT_DEBUG
652
 
#define RT_ASSERT_RET(_Exp)                                                             \
653
 
                if(!(_Exp))                                                                     \
654
 
                {                                                                                       \
655
 
                        printk("Rtl819x: ");                                    \
656
 
                        printk( "Assertion failed! %s,%s,line=%d\n", \
657
 
                        #_Exp,__FUNCTION__,__LINE__);          \
658
 
                        return;                                         \
659
 
                }
660
 
#define RT_ASSERT_RET_VALUE(_Exp,Ret)                                                           \
661
 
                if(!(_Exp))                                                                     \
662
 
                {                                                                                       \
663
 
                        printk("Rtl819x: ");                                    \
664
 
                        printk( "Assertion failed! %s,%s,line=%d\n", \
665
 
                        #_Exp,__FUNCTION__,__LINE__);          \
666
 
                        return (Ret);                                           \
667
 
                }
668
 
#else
669
 
#define RT_ASSERT_RET(_Exp) do {} while(0)
670
 
#define RT_ASSERT_RET_VALUE(_Exp,Ret) do {} while(0)
671
 
#endif
672
 
 
673
 
typedef struct ieee_param {
674
 
        u32 cmd;
675
 
        u8 sta_addr[ETH_ALEN];
676
 
        union {
677
 
                struct {
678
 
                        u8 name;
679
 
                        u32 value;
680
 
                } wpa_param;
681
 
                struct {
682
 
                        u32 len;
683
 
                        u8 reserved[32];
684
 
                        u8 data[0];
685
 
                } wpa_ie;
686
 
                struct{
687
 
                        int command;
688
 
                        int reason_code;
689
 
                } mlme;
690
 
                struct {
691
 
                        u8 alg[IEEE_CRYPT_ALG_NAME_LEN];
692
 
                        u8 set_tx;
693
 
                        u32 err;
694
 
                        u8 idx;
695
 
                        u8 seq[8]; /* sequence counter (set: RX, get: TX) */
696
 
                        u16 key_len;
697
 
                        u8 key[0];
698
 
                } crypt;
699
 
        } u;
700
 
}ieee_param;
701
 
 
702
 
 
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
710
 
#endif
711
 
 
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)
715
 
{
716
 
         unsigned long timeout = MSECS(msecs) + 1;
717
 
 
718
 
         while (timeout) {
719
 
                 set_current_state(TASK_INTERRUPTIBLE);
720
 
                 timeout = schedule_timeout(timeout);
721
 
         }
722
 
         return timeout;
723
 
}
724
 
 
725
 
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31))
726
 
static inline void msleep(unsigned int msecs)
727
 
{
728
 
         unsigned long timeout = MSECS(msecs) + 1;
729
 
 
730
 
         while (timeout) {
731
 
                 set_current_state(TASK_UNINTERRUPTIBLE);
732
 
                 timeout = schedule_timeout(timeout);
733
 
         }
734
 
}
735
 
#endif
736
 
#else
737
 
#define MSECS(t) msecs_to_jiffies(t)
738
 
#define msleep_interruptible_rsl  msleep_interruptible
739
 
#endif
740
 
 
741
 
#define RTLLIB_DATA_LEN         2304
742
 
/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
743
 
   6.2.1.1.2.
744
 
 
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
759
 
 
760
 
#define RTLLIB_SKBBUFFER_SIZE 2500
761
 
 
762
 
#define MIN_FRAG_THRESHOLD     256U
763
 
#define MAX_FRAG_THRESHOLD     2346U
764
 
#define MAX_HT_DATA_FRAG_THRESHOLD 0x2000
765
 
 
766
 
#define HT_AMSDU_SIZE_4K 3839
767
 
#define HT_AMSDU_SIZE_8K 7935
768
 
 
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
783
 
 
784
 
#define RTLLIB_FTYPE_MGMT               0x0000
785
 
#define RTLLIB_FTYPE_CTL                0x0004
786
 
#define RTLLIB_FTYPE_DATA               0x0008
787
 
 
788
 
/* management */
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
805
 
#else
806
 
#define RTLLIB_STYPE_MESH_ACT        RTLLIB_STYPE_MANAGE_ACT
807
 
#endif
808
 
#endif
809
 
 
810
 
/* control */
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
818
 
 
819
 
/* data */
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
830
 
 
831
 
#define RTLLIB_SCTL_FRAG                0x000F
832
 
#define RTLLIB_SCTL_SEQ         0xFFF0
833
 
 
834
 
/* QOS control */
835
 
#define RTLLIB_QCTL_TID              0x000F
836
 
 
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
845
 
 
846
 
typedef enum _ACT_CATEGORY{
847
 
        ACT_CAT_QOS = 1,
848
 
        ACT_CAT_DLS = 2,
849
 
        ACT_CAT_BA  = 3,
850
 
        ACT_CAT_HT  = 7,
851
 
        ACT_CAT_WMM = 17,
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,
858
 
#endif
859
 
} ACT_CATEGORY, *PACT_CATEGORY;
860
 
 
861
 
typedef enum _TS_ACTION{
862
 
        ACT_ADDTSREQ = 0,
863
 
        ACT_ADDTSRSP = 1,
864
 
        ACT_DELTS    = 2,
865
 
        ACT_SCHEDULE = 3,
866
 
} TS_ACTION, *PTS_ACTION;
867
 
 
868
 
typedef enum _BA_ACTION{
869
 
        ACT_ADDBAREQ = 0,
870
 
        ACT_ADDBARSP = 1,
871
 
        ACT_DELBA    = 2,
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;
879
 
 
880
 
typedef enum _LINK_METRIC_ACTION{
881
 
        ACT_LINKMETRIC_REQ = 0,
882
 
        ACT_LINKMETRIC_RSP = 1,
883
 
} LINK_METRIC_ACTION, *PLINK_METRIC_ACTION;
884
 
 
885
 
typedef enum _PATH_SELECT_ACTION{
886
 
        ACT_PATH_REQ = 0,
887
 
        ACT_PATH_REPLY = 1,
888
 
        ACT_PATH_ERR =2,
889
 
        ACT_RANN =3,
890
 
} PATH_SELECT_ACTION, *PPATH_SELECT_ACTION;
891
 
 
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;
896
 
#endif
897
 
 
898
 
typedef enum _InitialGainOpType{
899
 
        IG_Backup=0,
900
 
        IG_Restore,
901
 
        IG_Max
902
 
}InitialGainOpType;
903
 
typedef enum _LED_CTL_MODE{
904
 
        LED_CTL_POWER_ON = 1,
905
 
        LED_CTL_LINK = 2,
906
 
        LED_CTL_NO_LINK = 3,
907
 
        LED_CTL_TX = 4,
908
 
        LED_CTL_RX = 5,
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, 
917
 
}LED_CTL_MODE;
918
 
 
919
 
typedef enum _RT_RF_TYPE_DEF
920
 
{
921
 
        RF_1T2R = 0,
922
 
        RF_2T4R,
923
 
        RF_2T2R,
924
 
        RF_1T1R,
925
 
        RF_2T2R_GREEN,
926
 
        RF_819X_MAX_TYPE
927
 
}RT_RF_TYPE_DEF;
928
 
 
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
937
 
} WIRELESS_MODE;
938
 
 
939
 
typedef enum _NETWORK_TYPE{
940
 
        WIRELESS_11B = 1,
941
 
        WIRELESS_11G = 2,
942
 
        WIRELESS_11A = 4,
943
 
        WIRELESS_11N = 8
944
 
} WIRELESS_NETWORK_TYPE;
945
 
 
946
 
#define OUI_SUBTYPE_WMM_INFO            0
947
 
#define OUI_SUBTYPE_WMM_PARAM   1
948
 
#define OUI_SUBTYPE_QOS_CAPABI  5
949
 
 
950
 
/* debug macros */
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))      \
959
 
                {       \
960
 
                        int i;                                  \
961
 
                        u8* pdata = (u8*) data;                 \
962
 
                        printk(KERN_DEBUG "rtllib: %s()\n", __FUNCTION__);      \
963
 
                        for(i=0; i<(int)(datalen); i++)                 \
964
 
                        {                                               \
965
 
                                printk("%2.2x ", pdata[i]);             \
966
 
                                if ((i+1)%16 == 0) printk("\n");        \
967
 
                        }                               \
968
 
                        printk("\n");                   \
969
 
                }                                       \
970
 
        } while (0)             
971
 
#else
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 */
975
 
 
976
 
/* debug macros not dependent on CONFIG_RTLLIB_DEBUG */
977
 
 
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]
980
 
 
981
 
/*
982
 
 * To use the debug system;
983
 
 *
984
 
 * If you are defining a new debug classification, simply add it to the #define
985
 
 * list here in the form of:
986
 
 *
987
 
 * #define RTLLIB_DL_xxxx VALUE
988
 
 *
989
 
 * shifting value to the left one bit from the previous entry.  xxxx should be
990
 
 * the name of the classification (for example, WEP)
991
 
 *
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.
995
 
 *
996
 
 * To add your debug level to the list of levels seen when you perform
997
 
 *
998
 
 * % cat /proc/net/ipw/debug_level
999
 
 *
1000
 
 * you simply need to add your entry to the ipw_debug_levels array.
1001
 
 *
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
1004
 
 *
1005
 
 */
1006
 
 
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)
1015
 
 
1016
 
#define RTLLIB_DL_TX            (1<<8)
1017
 
#define RTLLIB_DL_RX            (1<<9)
1018
 
 
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)
1032
 
 
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)
1043
 
 
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)                                                     \
1051
 
                        {                                                                       \
1052
 
                                int             __i;                                            \
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++ )                            \
1058
 
                                {                                                               \
1059
 
                                     if( !PRINTABLE(buffer[__i]) )   buffer[__i] = '?';         \
1060
 
                                }                                                               \
1061
 
                                buffer[length] = '\0';                                          \
1062
 
                                printk("Rtl819x: ");                                            \
1063
 
                                printk(_TitleString);                                         \
1064
 
                                printk(": %d, <%s>\n", _Len, buffer);                         \
1065
 
                        }
1066
 
#else
1067
 
#define RTLLIB_PRINT_STR(_Comp, _TitleString, _Ptr, _Len)  do {} while (0)
1068
 
#endif
1069
 
 
1070
 
#ifndef ETH_P_PAE
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 */
1075
 
 
1076
 
#define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */
1077
 
 
1078
 
#ifndef ETH_P_80211_RAW
1079
 
#define ETH_P_80211_RAW (ETH_P_ECONET + 1)
1080
 
#endif
1081
 
 
1082
 
/* IEEE 802.11 defines */
1083
 
 
1084
 
#define P80211_OUI_LEN 3
1085
 
 
1086
 
struct rtllib_snap_hdr {
1087
 
 
1088
 
        u8    dsap;   /* always 0xAA */
1089
 
        u8    ssap;   /* always 0xAA */
1090
 
        u8    ctrl;   /* always 0x03 */
1091
 
        u8    oui[P80211_OUI_LEN];    /* organizational universal id */
1092
 
 
1093
 
} __attribute__ ((packed));
1094
 
 
1095
 
enum _REG_PREAMBLE_MODE{
1096
 
        PREAMBLE_LONG = 1,
1097
 
        PREAMBLE_AUTO = 2,
1098
 
        PREAMBLE_SHORT= 3,
1099
 
};
1100
 
 
1101
 
#define SNAP_SIZE sizeof(struct rtllib_snap_hdr)
1102
 
 
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)
1107
 
 
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)
1111
 
 
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
1117
 
 
1118
 
#define WLAN_AUTH_CHALLENGE_LEN 128
1119
 
 
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)
1132
 
 
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)
1137
 
 
1138
 
/* Status codes */
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,
1151
 
        /* 802.11b */
1152
 
        WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
1153
 
        WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
1154
 
        WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
1155
 
        /* 802.11h */
1156
 
        WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
1157
 
        WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
1158
 
        WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
1159
 
        /* 802.11g */
1160
 
        WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
1161
 
        WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
1162
 
        /* 802.11i */
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,
1170
 
};
1171
 
 
1172
 
/* Reason codes */
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,
1183
 
        /* 802.11h */
1184
 
        WLAN_REASON_DISASSOC_BAD_POWER = 10,
1185
 
        WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
1186
 
        /* 802.11i */
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,
1199
 
};
1200
 
#endif
1201
 
 
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
1207
 
 
1208
 
#define RTLLIB_CCK_MODULATION    (1<<0)
1209
 
#define RTLLIB_OFDM_MODULATION   (1<<1)
1210
 
 
1211
 
#define RTLLIB_24GHZ_BAND     (1<<0)
1212
 
#define RTLLIB_52GHZ_BAND     (1<<1)
1213
 
 
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
1229
 
 
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)
1242
 
 
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)
1249
 
 
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)
1262
 
 
1263
 
#define RTLLIB_NUM_OFDM_RATES       8
1264
 
#define RTLLIB_NUM_CCK_RATES                4
1265
 
#define RTLLIB_OFDM_SHIFT_MASK_A         4
1266
 
 
1267
 
 
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
1273
 
 
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))
1277
 
        
1278
 
/* this is stolen from ipw2200 driver */
1279
 
#define IEEE_IBSS_MAC_HASH_SIZE 31
1280
 
struct ieee_ibss_seq {
1281
 
        u8 mac[ETH_ALEN];
1282
 
        u16 seq_num[17];
1283
 
        u16 frag_num[17];
1284
 
        unsigned long packet_time[17];
1285
 
        struct list_head list;
1286
 
};
1287
 
 
1288
 
#ifdef _RTL8192_EXT_PATCH_
1289
 
struct ieee_mesh_seq {
1290
 
        u8 mac[ETH_ALEN];
1291
 
        u16 seq_num[17];
1292
 
        u16 frag_num[17];
1293
 
        unsigned long packet_time[17];
1294
 
        struct list_head list;
1295
 
};
1296
 
#endif
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 {
1301
 
#if 1
1302
 
        u32 mac_time[2];
1303
 
        s8  rssi;
1304
 
        u8  signal;
1305
 
        u8  noise;
1306
 
        u16 rate; /* in 100 kbps */
1307
 
        u8  received_channel;
1308
 
        u8  control;
1309
 
        u8  mask;
1310
 
        u8  freq;
1311
 
        u16 len;
1312
 
        u64 tsf;
1313
 
        u32 beacon_time;
1314
 
        u8  nic_type;
1315
 
        u16 Length;
1316
 
        u8  SignalQuality; 
1317
 
        s32 RecvSignalPower; 
1318
 
        s8  RxPower; 
1319
 
        u8  SignalStrength; 
1320
 
        u16 bHwError:1;
1321
 
        u16 bCRC:1;
1322
 
        u16 bICV:1;
1323
 
        u16 bShortPreamble:1;
1324
 
        u16 Antenna:1;      
1325
 
        u16 Decrypted:1;    
1326
 
        u16 Wakeup:1;       
1327
 
        u16 Reserved0:1;    
1328
 
        u8  AGC;
1329
 
        u32 TimeStampLow;
1330
 
        u32 TimeStampHigh;
1331
 
        bool bShift;
1332
 
        bool bIsQosData;             
1333
 
        u8   UserPriority;
1334
 
 
1335
 
        u8    RxDrvInfoSize;
1336
 
        u8    RxBufShift;
1337
 
        bool  bIsAMPDU;
1338
 
        bool  bFirstMPDU;
1339
 
        bool  bContainHTC;
1340
 
        bool  RxIs40MHzPacket;
1341
 
        u32   RxPWDBAll;
1342
 
        u8    RxMIMOSignalStrength[4];        
1343
 
        s8    RxMIMOSignalQuality[2];
1344
 
        bool  bPacketMatchBSSID;
1345
 
        bool  bIsCCK;
1346
 
        bool  bPacketToSelf;
1347
 
        u8*    virtual_address;
1348
 
        u16    packetlength;        
1349
 
        u16    fraglength;          
1350
 
        u16    fragoffset;          
1351
 
        u16    ntotalfrag;
1352
 
        bool   bisrxaggrsubframe;
1353
 
        bool   bPacketBeacon;       
1354
 
        bool   bToSelfBA;           
1355
 
        char   cck_adc_pwdb[4];     
1356
 
        u16    Seq_Num;
1357
 
        u8     nTotalAggPkt;        
1358
 
#ifdef TCP_CSUM_OFFLOAD_RX
1359
 
        u8      tcp_csum_valid;
1360
 
#endif
1361
 
#if defined (RTL8192S_WAPI_SUPPORT)
1362
 
        u8      WapiTempPN[16];
1363
 
        u8      WapiSrcAddr[6];
1364
 
        u8      bWapiCheckPNInDecrypt;
1365
 
#endif
1366
 
#endif
1367
 
 
1368
 
};
1369
 
 
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
1375
 
 
1376
 
struct rtllib_frag_entry {
1377
 
        unsigned long first_frag_time;
1378
 
        unsigned int seq;
1379
 
        unsigned int last_frag;
1380
 
        struct sk_buff *skb;
1381
 
        u8 src_addr[ETH_ALEN];
1382
 
        u8 dst_addr[ETH_ALEN];
1383
 
};
1384
 
 
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;
1407
 
};
1408
 
 
1409
 
struct rtllib_device;
1410
 
 
1411
 
#include "rtllib_crypt.h"
1412
 
 
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)
1423
 
 
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 */
1429
 
 
1430
 
#define SEC_ALG_NONE            0
1431
 
#define SEC_ALG_WEP             1
1432
 
#define SEC_ALG_TKIP            2
1433
 
#define SEC_ALG_CCMP            4
1434
 
 
1435
 
#define WEP_KEYS                4
1436
 
#define WEP_KEY_LEN             13
1437
 
#define SCM_KEY_LEN             32
1438
 
#define SCM_TEMPORAL_KEY_LENGTH 16
1439
 
 
1440
 
struct rtllib_security {
1441
 
        u16 active_key:2,
1442
 
            enabled:1,
1443
 
            auth_mode:2,
1444
 
            auth_algo:4,
1445
 
            unicast_uses_group:1,
1446
 
            encrypt:1;
1447
 
        u8 key_sizes[WEP_KEYS];
1448
 
        u8 keys[WEP_KEYS][SCM_KEY_LEN];
1449
 
        u8 level;
1450
 
        u16 flags;
1451
 
} __attribute__ ((packed));
1452
 
 
1453
 
 
1454
 
/*
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
1463
 
*/
1464
 
 
1465
 
/* Management Frame Information Element Types */
1466
 
enum rtllib_mfie {
1467
 
        MFIE_TYPE_SSID = 0,
1468
 
        MFIE_TYPE_RATES = 1,
1469
 
        MFIE_TYPE_FH_SET = 2,
1470
 
        MFIE_TYPE_DS_SET = 3,
1471
 
        MFIE_TYPE_CF_SET = 4,
1472
 
        MFIE_TYPE_TIM = 5,
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,
1484
 
        MFIE_TYPE_CSA = 37,
1485
 
        MFIE_TYPE_MEASURE_REQUEST = 38,
1486
 
        MFIE_TYPE_MEASURE_REPORT = 39,
1487
 
        MFIE_TYPE_QUIET = 40,
1488
 
        MFIE_TYPE_IBSS_DFS = 41,
1489
 
        MFIE_TYPE_ERP = 42,
1490
 
        MFIE_TYPE_HT_CAP= 45,
1491
 
        MFIE_TYPE_RSN = 48,
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, 
1499
 
#endif
1500
 
        MFIE_TYPE_HT_INFO= 61,
1501
 
#if defined (RTL8192S_WAPI_SUPPORT)
1502
 
        MFIE_TYPE_WAPI  = 68,
1503
 
#endif
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,   
1519
 
#endif
1520
 
        MFIE_TYPE_GENERIC = 221,
1521
 
        MFIE_TYPE_QOS_PARAMETER = 222,
1522
 
};
1523
 
 
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 {
1528
 
        __le16 frame_ctl;
1529
 
        __le16 aid;
1530
 
        u8 bssid[ETH_ALEN];
1531
 
        u8 ta[ETH_ALEN];
1532
 
} __attribute__ ((packed));
1533
 
 
1534
 
struct rtllib_hdr {
1535
 
        __le16 frame_ctl;
1536
 
        __le16 duration_id;
1537
 
        u8 payload[0];
1538
 
} __attribute__ ((packed));
1539
 
 
1540
 
struct rtllib_hdr_1addr {
1541
 
        __le16 frame_ctl;
1542
 
        __le16 duration_id;
1543
 
        u8 addr1[ETH_ALEN];
1544
 
        u8 payload[0];
1545
 
} __attribute__ ((packed));
1546
 
 
1547
 
struct rtllib_hdr_2addr {
1548
 
        __le16 frame_ctl;
1549
 
        __le16 duration_id;
1550
 
        u8 addr1[ETH_ALEN];
1551
 
        u8 addr2[ETH_ALEN];
1552
 
        u8 payload[0];
1553
 
} __attribute__ ((packed));
1554
 
 
1555
 
struct rtllib_hdr_3addr {
1556
 
        __le16 frame_ctl;
1557
 
        __le16 duration_id;
1558
 
        u8 addr1[ETH_ALEN];
1559
 
        u8 addr2[ETH_ALEN];
1560
 
        u8 addr3[ETH_ALEN];
1561
 
        __le16 seq_ctl;
1562
 
        u8 payload[0];
1563
 
} __attribute__ ((packed));
1564
 
 
1565
 
struct rtllib_hdr_4addr {
1566
 
        __le16 frame_ctl;
1567
 
        __le16 duration_id;
1568
 
        u8 addr1[ETH_ALEN];
1569
 
        u8 addr2[ETH_ALEN];
1570
 
        u8 addr3[ETH_ALEN];
1571
 
        __le16 seq_ctl;
1572
 
        u8 addr4[ETH_ALEN];
1573
 
        u8 payload[0];
1574
 
} __attribute__ ((packed));
1575
 
 
1576
 
struct rtllib_hdr_3addrqos {
1577
 
        __le16 frame_ctl;
1578
 
        __le16 duration_id;
1579
 
        u8 addr1[ETH_ALEN];
1580
 
        u8 addr2[ETH_ALEN];
1581
 
        u8 addr3[ETH_ALEN];
1582
 
        __le16 seq_ctl;
1583
 
        __le16 qos_ctl;
1584
 
        u8 payload[0];
1585
 
} __attribute__ ((packed));
1586
 
 
1587
 
struct rtllib_hdr_4addrqos {
1588
 
        __le16 frame_ctl;
1589
 
        __le16 duration_id;
1590
 
        u8 addr1[ETH_ALEN];
1591
 
        u8 addr2[ETH_ALEN];
1592
 
        u8 addr3[ETH_ALEN];
1593
 
        __le16 seq_ctl;
1594
 
        u8 addr4[ETH_ALEN];
1595
 
        __le16 qos_ctl;
1596
 
        u8 payload[0];
1597
 
} __attribute__ ((packed));
1598
 
 
1599
 
struct rtllib_info_element {
1600
 
        u8 id;
1601
 
        u8 len;
1602
 
        u8 data[0];
1603
 
} __attribute__ ((packed));
1604
 
 
1605
 
#ifdef _RTL8192_EXT_PATCH_
1606
 
 
1607
 
struct mesh_peering_protocol_version_t{
1608
 
    u8 OUI[3]; 
1609
 
    u8 value;
1610
 
} __attribute__ ((packed));
1611
 
struct rtllib_plink_open {
1612
 
        struct rtllib_hdr_3addr header;
1613
 
        u8       category;
1614
 
        u8       action;
1615
 
#ifndef COMPATIBLE_WITH_RALINK_MESH
1616
 
        struct mesh_peering_protocol_version_t mesh_peering_protocol_version;
1617
 
#endif
1618
 
        __le16 capability;
1619
 
        /* SSID, supported rates, RSN */
1620
 
        struct rtllib_info_element info_element[0];
1621
 
} __attribute__ ((packed));
1622
 
 
1623
 
struct rtllib_plink_confirm {
1624
 
        struct rtllib_hdr_3addr header;
1625
 
        u8       category;
1626
 
        u8       action;
1627
 
#ifndef COMPATIBLE_WITH_RALINK_MESH
1628
 
        struct mesh_peering_protocol_version_t mesh_peering_protocol_version;
1629
 
#endif
1630
 
        __le16 capability;
1631
 
#ifdef COMPATIBLE_WITH_RALINK_MESH
1632
 
        __le16 status_code;
1633
 
#endif
1634
 
        __le16 aid;
1635
 
        /* SSID, supported rates, RSN */
1636
 
        struct rtllib_info_element info_element[0];
1637
 
} __attribute__ ((packed));
1638
 
 
1639
 
struct rtllib_plink_close {
1640
 
        struct rtllib_hdr_3addr header;
1641
 
        u8       category;
1642
 
        u8       action;
1643
 
#ifndef COMPATIBLE_WITH_RALINK_MESH
1644
 
        struct mesh_peering_protocol_version_t mesh_peering_protocol_version;
1645
 
#endif
1646
 
        /* SSID, supported rates, RSN */
1647
 
        struct rtllib_info_element info_element[0];
1648
 
} __attribute__ ((packed));
1649
 
 
1650
 
struct rtllib_linkmetric_report {
1651
 
        struct rtllib_hdr_3addr header;
1652
 
        u8       category;
1653
 
        u8       action;
1654
 
        struct rtllib_info_element info_element[0];
1655
 
} __attribute__ ((packed));
1656
 
 
1657
 
struct rtllib_linkmetric_req {
1658
 
        struct rtllib_hdr_3addr header;
1659
 
        u8       category;
1660
 
        u8       action;
1661
 
} __attribute__ ((packed));
1662
 
#endif
1663
 
 
1664
 
struct rtllib_authentication {
1665
 
        struct rtllib_hdr_3addr header;
1666
 
        __le16 algorithm;
1667
 
        __le16 transaction;
1668
 
        __le16 status;
1669
 
        /*challenge*/
1670
 
        struct rtllib_info_element info_element[0];
1671
 
} __attribute__ ((packed));
1672
 
 
1673
 
struct rtllib_disauth {
1674
 
        struct rtllib_hdr_3addr header;
1675
 
        __le16 reason;
1676
 
} __attribute__ ((packed));
1677
 
 
1678
 
struct rtllib_disassoc {
1679
 
        struct rtllib_hdr_3addr header;
1680
 
        __le16 reason;
1681
 
} __attribute__ ((packed));
1682
 
 
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));
1688
 
 
1689
 
struct rtllib_probe_response {
1690
 
        struct rtllib_hdr_3addr header;
1691
 
        u32 time_stamp[2];
1692
 
        __le16 beacon_interval;
1693
 
        __le16 capability;
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));
1698
 
 
1699
 
/* Alias beacon for probe_response */
1700
 
#define rtllib_beacon rtllib_probe_response
1701
 
 
1702
 
struct rtllib_assoc_request_frame {
1703
 
        struct rtllib_hdr_3addr header;
1704
 
        __le16 capability;
1705
 
        __le16 listen_interval;
1706
 
        /* SSID, supported rates, RSN */
1707
 
        struct rtllib_info_element info_element[0];
1708
 
} __attribute__ ((packed));
1709
 
 
1710
 
struct rtllib_reassoc_request_frame {
1711
 
        struct rtllib_hdr_3addr header;
1712
 
        __le16 capability;
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));
1718
 
 
1719
 
struct rtllib_assoc_response_frame {
1720
 
        struct rtllib_hdr_3addr header;
1721
 
        __le16 capability;
1722
 
        __le16 status;
1723
 
        __le16 aid;
1724
 
        struct rtllib_info_element info_element[0]; /* supported rates */
1725
 
} __attribute__ ((packed));
1726
 
 
1727
 
struct rtllib_txb {
1728
 
        u8 nr_frags;
1729
 
        u8 encrypted;
1730
 
        u8 queue_index;
1731
 
        u8 rts_included;
1732
 
        u16 reserved;
1733
 
        __le16 frag_size;
1734
 
        __le16 payload_size;
1735
 
        struct sk_buff *fragments[0];
1736
 
};
1737
 
 
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));
1743
 
 
1744
 
#define MAX_SUBFRAME_COUNT                64
1745
 
struct rtllib_rxb {
1746
 
        u8 nr_subframes;
1747
 
        struct sk_buff *subframes[MAX_SUBFRAME_COUNT];
1748
 
        u8 dst[ETH_ALEN];
1749
 
        u8 src[ETH_ALEN];
1750
 
#ifdef TCP_CSUM_OFFLOAD_RX
1751
 
        u8 tcp_csum_valid;
1752
 
#endif
1753
 
#if defined (RTL8192S_WAPI_SUPPORT)
1754
 
        u8 UserPriority;
1755
 
        u8 WapiTempPN[16];
1756
 
        u8 WapiSrcAddr[6];
1757
 
        u8 bWapiCheckPNInDecrypt;
1758
 
#endif
1759
 
}__attribute__((packed));
1760
 
 
1761
 
typedef union _frameqos {
1762
 
        u16 shortdata;
1763
 
        u8  chardata[2];
1764
 
        struct {
1765
 
                u16 tid:4;
1766
 
                u16 eosp:1;
1767
 
                u16 ack_policy:2;
1768
 
                u16 reserved:1;
1769
 
                u16 txop:8;
1770
 
        }field;
1771
 
}frameqos,*pframeqos;
1772
 
 
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 
1784
 
#else
1785
 
#define MAX_NETWORK_COUNT                  96 
1786
 
#endif                  
1787
 
 
1788
 
#define MAX_CHANNEL_NUMBER                 161
1789
 
#define RTLLIB_SOFTMAC_SCAN_TIME           100
1790
 
#define RTLLIB_SOFTMAC_ASSOC_RETRY_TIME (HZ * 2)
1791
 
 
1792
 
#define CRC_LENGTH                 4U
1793
 
 
1794
 
#define MAX_WPA_IE_LEN 64
1795
 
#define MAX_WZC_IE_LEN 256
1796
 
 
1797
 
#define NETWORK_EMPTY_ESSID (1<<0)
1798
 
#define NETWORK_HAS_OFDM    (1<<1)
1799
 
#define NETWORK_HAS_CCK     (1<<2)
1800
 
 
1801
 
/* QoS structure */
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)
1806
 
/* 802.11h */
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)
1812
 
 
1813
 
#define NETWORK_HAS_ERP_VALUE           (1<<10)
1814
 
 
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
1823
 
#if 1
1824
 
struct rtllib_qos_information_element {
1825
 
        u8 elementID;
1826
 
        u8 length;
1827
 
        u8 qui[QOS_OUI_LEN];
1828
 
        u8 qui_type;
1829
 
        u8 qui_subtype;
1830
 
        u8 version;
1831
 
        u8 ac_info;
1832
 
} __attribute__ ((packed));
1833
 
 
1834
 
struct rtllib_qos_ac_parameter {
1835
 
        u8 aci_aifsn;
1836
 
        u8 ecw_min_max;
1837
 
        __le16 tx_op_limit;
1838
 
} __attribute__ ((packed));
1839
 
 
1840
 
struct rtllib_qos_parameter_info {
1841
 
        struct rtllib_qos_information_element info_element;
1842
 
        u8 reserved;
1843
 
        struct rtllib_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
1844
 
} __attribute__ ((packed));
1845
 
 
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));
1853
 
 
1854
 
struct rtllib_qos_data {
1855
 
        struct rtllib_qos_parameters parameters;
1856
 
        unsigned int wmm_acm;
1857
 
        int active;
1858
 
        int supported;
1859
 
        u8 param_count;
1860
 
        u8 old_param_count;
1861
 
};
1862
 
 
1863
 
struct rtllib_tim_parameters {
1864
 
        u8 tim_count;
1865
 
        u8 tim_period;
1866
 
} __attribute__ ((packed));
1867
 
 
1868
 
struct rtllib_wmm_ac_param {
1869
 
        u8 ac_aci_acm_aifsn;
1870
 
        u8 ac_ecwmin_ecwmax;
1871
 
        u16 ac_txop_limit;
1872
 
};
1873
 
 
1874
 
struct rtllib_wmm_ts_info {
1875
 
        u8 ac_dir_tid;
1876
 
        u8 ac_up_psb;
1877
 
        u8 reserved;
1878
 
} __attribute__ ((packed));
1879
 
 
1880
 
struct rtllib_wmm_tspec_elem {
1881
 
        struct rtllib_wmm_ts_info ts_info;
1882
 
        u16 norm_msdu_size;
1883
 
        u16 max_msdu_size;
1884
 
        u32 min_serv_inter;
1885
 
        u32 max_serv_inter;
1886
 
        u32 inact_inter;
1887
 
        u32 suspen_inter;
1888
 
        u32 serv_start_time;
1889
 
        u32 min_data_rate;
1890
 
        u32 mean_data_rate;
1891
 
        u32 peak_data_rate;
1892
 
        u32 max_burst_size;
1893
 
        u32 delay_bound;
1894
 
        u32 min_phy_rate;
1895
 
        u16 surp_band_allow;
1896
 
        u16 medium_time;
1897
 
}__attribute__((packed));
1898
 
#endif
1899
 
enum eap_type {
1900
 
        EAP_PACKET = 0,
1901
 
        EAPOL_START,
1902
 
        EAPOL_LOGOFF,
1903
 
        EAPOL_KEY,
1904
 
        EAPOL_ENCAP_ASF_ALERT
1905
 
};
1906
 
 
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"
1913
 
};
1914
 
 
1915
 
static inline const char *eap_get_type(int type)
1916
 
{
1917
 
        return ((u32)type >= ARRAY_SIZE(eap_types)) ? "Unknown" : eap_types[type];
1918
 
}
1919
 
static inline u8 Frame_QoSTID(u8* buf)
1920
 
{
1921
 
        struct rtllib_hdr_3addr *hdr;
1922
 
        u16 fc;
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;
1926
 
}
1927
 
 
1928
 
 
1929
 
struct eapol {
1930
 
        u8 snap[6];
1931
 
        u16 ethertype;
1932
 
        u8 version;
1933
 
        u8 type;
1934
 
        u16 length;
1935
 
} __attribute__ ((packed));
1936
 
 
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;
1958
 
};
1959
 
 
1960
 
#define BEACON_PROBE_SSID_ID_POSITION 12
1961
 
 
1962
 
struct rtllib_info_element_hdr {
1963
 
        u8 id;
1964
 
        u8 len;
1965
 
} __attribute__ ((packed));
1966
 
 
1967
 
/*
1968
 
 * These are the data types that can make up management packets
1969
 
 *
1970
 
        u16 auth_algorithm;
1971
 
        u16 auth_sequence;
1972
 
        u16 beacon_interval;
1973
 
        u16 capability;
1974
 
        u8 current_ap[ETH_ALEN];
1975
 
        u16 listen_interval;
1976
 
        struct {
1977
 
                u16 association_id:14, reserved:2;
1978
 
        } __attribute__ ((packed));
1979
 
        u32 time_stamp[2];
1980
 
        u16 reason;
1981
 
        u16 status;
1982
 
*/
1983
 
 
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 
1989
 
#endif
1990
 
 
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)
1996
 
 
1997
 
#define RTLLIB_DTIM_MBCAST 4
1998
 
#define RTLLIB_DTIM_UCAST 2
1999
 
#define RTLLIB_DTIM_VALID 1
2000
 
#define RTLLIB_DTIM_INVALID 0
2001
 
 
2002
 
#define RTLLIB_PS_DISABLED 0
2003
 
#define RTLLIB_PS_UNICAST RTLLIB_DTIM_UCAST
2004
 
#define RTLLIB_PS_MBCAST RTLLIB_DTIM_MBCAST
2005
 
 
2006
 
#ifdef WMM_Hang_8187
2007
 
#undef WMM_Hang_8187
2008
 
#endif
2009
 
 
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
2017
 
 
2018
 
#define MAX_RECEIVE_BUFFER_SIZE 9100
2019
 
 
2020
 
#if 1
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 : \
2026
 
        WME_AC_VO)      
2027
 
#endif
2028
 
#define AC2UP(_ac)      (       \
2029
 
        ((_ac) == WME_AC_VO) ? 6 : \
2030
 
        ((_ac) == WME_AC_VI) ? 5 : \
2031
 
        ((_ac) == WME_AC_BK) ? 1 : \
2032
 
        0)
2033
 
 
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*/
2036
 
 
2037
 
struct  ether_header {
2038
 
        u8 ether_dhost[ETHER_ADDR_LEN];
2039
 
        u8 ether_shost[ETHER_ADDR_LEN];
2040
 
        u16 ether_type;
2041
 
} __attribute__((packed)); 
2042
 
 
2043
 
#ifndef ETHERTYPE_PAE
2044
 
#define ETHERTYPE_PAE   0x888e          /* EAPOL PAE/802.1x */
2045
 
#endif
2046
 
#ifndef ETHERTYPE_IP
2047
 
#define ETHERTYPE_IP    0x0800          /* IP protocol */
2048
 
#endif
2049
 
 
2050
 
 
2051
 
typedef enum _erp_t{
2052
 
        ERP_NonERPpresent       = 0x01,
2053
 
        ERP_UseProtection       = 0x02,
2054
 
        ERP_BarkerPreambleMode = 0x04,
2055
 
} erp_t;
2056
 
 
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];
2063
 
} mesh_config_t;
2064
 
#define MESH_CONF_TOTAL_LEN 19
2065
 
#endif
2066
 
 
2067
 
struct rtllib_network {
2068
 
        /* These entries are used to identify a unique network */
2069
 
        u8 bssid[ETH_ALEN];
2070
 
        u8 channel;
2071
 
        /* Ensure null-terminated for any debug msgs */
2072
 
        u8 ssid[IW_ESSID_MAX_SIZE + 1];
2073
 
        u8 ssid_len;
2074
 
        u8 hidden_ssid[IW_ESSID_MAX_SIZE + 1];
2075
 
        u8 hidden_ssid_len;
2076
 
        struct rtllib_qos_data qos_data;
2077
 
 
2078
 
        bool    bWithAironetIE;
2079
 
        bool    bCkipSupported;
2080
 
        bool    bCcxRmEnable;
2081
 
        u16     CcxRmState[2];
2082
 
        bool    bMBssidValid;
2083
 
        u8      MBssidMask;
2084
 
        u8      MBssid[6];
2085
 
        bool    bWithCcxVerNum;
2086
 
        u8      BssCcxVerNumber;
2087
 
        /* These are network statistics */
2088
 
        struct rtllib_rx_stats stats;
2089
 
        u16 capability;
2090
 
        u8  rates[MAX_RATES_LENGTH];
2091
 
        u8  rates_len;
2092
 
        u8  rates_ex[MAX_RATES_EX_LENGTH];
2093
 
        u8  rates_ex_len;
2094
 
        unsigned long last_scanned;
2095
 
        u8  mode;
2096
 
        u32 flags;
2097
 
        u32 last_associate;
2098
 
        u32 time_stamp[2];
2099
 
        u16 beacon_interval;
2100
 
        u16 listen_interval;
2101
 
        u16 atim_window;
2102
 
        u8  erp_value;
2103
 
        u8  wpa_ie[MAX_WPA_IE_LEN];
2104
 
        size_t wpa_ie_len;
2105
 
        u8  rsn_ie[MAX_WPA_IE_LEN];
2106
 
        size_t rsn_ie_len;
2107
 
#if defined RTL8192S_WAPI_SUPPORT
2108
 
        u8  wapi_ie[MAX_WAPI_IE_LEN];
2109
 
        size_t wapi_ie_len;
2110
 
#endif
2111
 
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)  
2112
 
        u8  wzc_ie[MAX_WZC_IE_LEN];
2113
 
        size_t wzc_ie_len;
2114
 
#endif
2115
 
 
2116
 
        struct rtllib_tim_parameters tim;
2117
 
        u8  dtim_period;
2118
 
        u8  dtim_data;
2119
 
        u32 last_dtim_sta_time[2];
2120
 
 
2121
 
        u8 wmm_info;
2122
 
        struct rtllib_wmm_ac_param wmm_param[4];
2123
 
#ifdef THOMAS_TURBO
2124
 
        u8 Turbo_Enable;
2125
 
#endif
2126
 
#ifdef ENABLE_DOT11D
2127
 
        u16 CountryIeLen;
2128
 
        u8 CountryIeBuf[MAX_IE_LEN];
2129
 
#endif
2130
 
        BSS_HT  bssht;
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;
2142
 
        u8 SignalStrength;
2143
 
        u8 RSSI; 
2144
 
#ifdef _RTL8192_EXT_PATCH_
2145
 
        u8 hostname[MAX_HOST_NAME_LENGTH];
2146
 
        u8 hostname_len;
2147
 
        u8 mesh_id[MAX_MESH_ID_LEN];
2148
 
        u8 mesh_id_len;
2149
 
        mesh_config_t mesh_config;
2150
 
        u8 mesh_config_len;
2151
 
        void *ext_entry;
2152
 
#endif
2153
 
 
2154
 
        struct list_head list;
2155
 
};
2156
 
 
2157
 
#if 1
2158
 
enum rtllib_state {
2159
 
 
2160
 
        /* the card is not linked at all */
2161
 
        RTLLIB_NOLINK = 0,
2162
 
        
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
2168
 
         * LINKED_SCANNING)
2169
 
         */
2170
 
        
2171
 
        /* the association procedure will start (wq scheduling)*/
2172
 
        RTLLIB_ASSOCIATING,
2173
 
        RTLLIB_ASSOCIATING_RETRY,
2174
 
        
2175
 
        /* the association procedure is sending AUTH request*/
2176
 
        RTLLIB_ASSOCIATING_AUTHENTICATING,
2177
 
        
2178
 
        /* the association procedure has successfully authentcated
2179
 
         * and is sending association request
2180
 
         */
2181
 
        RTLLIB_ASSOCIATING_AUTHENTICATED,
2182
 
        
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
2185
 
         */
2186
 
        RTLLIB_LINKED,
2187
 
        
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.
2192
 
         */
2193
 
        RTLLIB_LINKED_SCANNING,
2194
 
#ifdef _RTL8192_EXT_PATCH_
2195
 
        RTLLIB_MESH_SCANNING,
2196
 
        RTLLIB_MESH_LINKED,
2197
 
#endif
2198
 
};
2199
 
#else
2200
 
enum rtllib_state {
2201
 
        RTLLIB_UNINITIALIZED = 0,
2202
 
        RTLLIB_INITIALIZED,
2203
 
        RTLLIB_ASSOCIATING,
2204
 
        RTLLIB_ASSOCIATED,
2205
 
        RTLLIB_AUTHENTICATING,
2206
 
        RTLLIB_AUTHENTICATED,
2207
 
        RTLLIB_SHUTDOWN
2208
 
};
2209
 
#endif
2210
 
 
2211
 
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
2212
 
#define DEFAULT_FTS 2346
2213
 
 
2214
 
#define CFG_RTLLIB_RESERVE_FCS (1<<0)
2215
 
#define CFG_RTLLIB_COMPUTE_FCS (1<<1)
2216
 
#define CFG_RTLLIB_RTS (1<<2)
2217
 
 
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)
2222
 
 
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)
2227
 
 
2228
 
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
2229
 
extern inline int is_multicast_ether_addr(const u8 *addr)
2230
 
{
2231
 
        return ((addr[0] != 0xff) && (0x01 & addr[0]));
2232
 
}
2233
 
#endif
2234
 
 
2235
 
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
2236
 
extern inline int is_broadcast_ether_addr(const u8 *addr)
2237
 
{
2238
 
        return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) &&   \
2239
 
                (addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
2240
 
}
2241
 
#endif
2242
 
#ifndef eqMacAddr
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 )
2244
 
#endif
2245
 
typedef struct tx_pending_t{
2246
 
        int frag;
2247
 
        struct rtllib_txb *txb;
2248
 
}tx_pending_t;
2249
 
 
2250
 
typedef struct _bandwidth_autoswitch
2251
 
{
2252
 
        long threshold_20Mhzto40Mhz;
2253
 
        long    threshold_40Mhzto20Mhz; 
2254
 
        bool bforced_tx20Mhz;
2255
 
        bool bautoswitch_enable;        
2256
 
}bandwidth_autoswitch,*pbandwidth_autoswitch;
2257
 
 
2258
 
 
2259
 
 
2260
 
#define REORDER_WIN_SIZE        128
2261
 
#define REORDER_ENTRY_NUM       128
2262
 
typedef struct _RX_REORDER_ENTRY
2263
 
{
2264
 
        struct list_head        List;
2265
 
        u16                     SeqNum;
2266
 
        struct rtllib_rxb* prxb;
2267
 
} RX_REORDER_ENTRY, *PRX_REORDER_ENTRY;
2268
 
typedef enum _Fsync_State{
2269
 
        Default_Fsync,
2270
 
        HW_Fsync,
2271
 
        SW_Fsync
2272
 
}Fsync_State;   
2273
 
 
2274
 
typedef enum _RT_PS_MODE        
2275
 
{
2276
 
        eActive,        
2277
 
        eMaxPs,         
2278
 
        eFastPs,                
2279
 
        eAutoPs,        
2280
 
}RT_PS_MODE;
2281
 
 
2282
 
typedef enum _IPS_CALLBACK_FUNCION
2283
 
{
2284
 
        IPS_CALLBACK_NONE = 0,
2285
 
        IPS_CALLBACK_MGNT_LINK_REQUEST = 1,
2286
 
        IPS_CALLBACK_JOIN_REQUEST = 2,
2287
 
}IPS_CALLBACK_FUNCION;
2288
 
 
2289
 
typedef enum _RT_JOIN_ACTION{
2290
 
        RT_JOIN_INFRA   = 1,
2291
 
        RT_JOIN_IBSS  = 2,
2292
 
        RT_START_IBSS = 3,
2293
 
        RT_NO_ACTION  = 4,
2294
 
}RT_JOIN_ACTION;
2295
 
 
2296
 
typedef struct _IbssParms{
2297
 
        u16   atimWin;
2298
 
}IbssParms, *PIbssParms;
2299
 
#define MAX_NUM_RATES   264 
2300
 
 
2301
 
typedef enum _RT_RF_POWER_STATE
2302
 
{
2303
 
        eRfOn,
2304
 
        eRfSleep,
2305
 
        eRfOff
2306
 
}RT_RF_POWER_STATE;
2307
 
 
2308
 
#define MAX_SUPPORT_WOL_PATTERN_NUM             8
2309
 
 
2310
 
#define MAX_WOL_BIT_MASK_SIZE           16 
2311
 
#define MAX_WOL_PATTERN_SIZE            128
2312
 
 
2313
 
typedef enum _WOLPATTERN_TYPE
2314
 
{
2315
 
        eNetBIOS = 0,
2316
 
        eIPv4IPv6ARP,
2317
 
        eIPv4IPv6TCPSYN,
2318
 
        eMACIDOnly,
2319
 
        eNoDefined,
2320
 
}WOLPATTERN_TYPE;
2321
 
 
2322
 
typedef struct _RT_PM_WOL_PATTERN_INFO
2323
 
{
2324
 
        u32     PatternId; 
2325
 
        u32     Mask[4];
2326
 
        u16     CrcRemainder;
2327
 
        u8      WFMIndex; 
2328
 
        WOLPATTERN_TYPE PatternType;
2329
 
}RT_PM_WOL_PATTERN_INFO, *PRT_PM_WOL_PATTERN_INFO;
2330
 
 
2331
 
typedef struct _RT_POWER_SAVE_CONTROL
2332
 
{
2333
 
 
2334
 
        bool                            bInactivePs;
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;
2341
 
 
2342
 
        IPS_CALLBACK_FUNCION    ReturnPoint;
2343
 
        
2344
 
        bool                            bTmpBssDesc;
2345
 
        RT_JOIN_ACTION          tmpJoinAction;
2346
 
        struct rtllib_network tmpBssDesc;
2347
 
 
2348
 
        bool                            bTmpScanOnly;
2349
 
        bool                            bTmpActiveScan;
2350
 
        bool                            bTmpFilterHiddenAP;
2351
 
        bool                            bTmpUpdateParms;
2352
 
        u8                              tmpSsidBuf[33];
2353
 
        OCTET_STRING                    tmpSsid2Scan;
2354
 
        bool                            bTmpSsid2Scan;
2355
 
        u8                              tmpNetworkType;
2356
 
        u8                              tmpChannelNumber;
2357
 
        u16                             tmpBcnPeriod;
2358
 
        u8                              tmpDtimPeriod;
2359
 
        u16                             tmpmCap;
2360
 
        OCTET_STRING                    tmpSuppRateSet;
2361
 
        u8                              tmpSuppRateBuf[MAX_NUM_RATES];
2362
 
        bool                            bTmpSuppRate;
2363
 
        IbssParms                               tmpIbpm;
2364
 
        bool                            bTmpIbpm;
2365
 
 
2366
 
        bool                            bLeisurePs;
2367
 
        u32                             PowerProfile;
2368
 
        u8                              LpsIdleCount;
2369
 
        u8                              PowerMode;
2370
 
        u8                              RegMaxLPSAwakeIntvl;
2371
 
        u8                              LPSAwakeIntvl;
2372
 
 
2373
 
        u32                             CurPsLevel;
2374
 
        u32                             RegRfPsLevel;
2375
 
 
2376
 
        bool                            bFwCtrlLPS;
2377
 
        u8                              FWCtrlPSMode;
2378
 
 
2379
 
        bool                            LinkReqInIPSRFOffPgs;
2380
 
        bool                            BufConnectinfoBefore;
2381
 
        
2382
 
 
2383
 
        bool                            bGpioRfSw;
2384
 
 
2385
 
        u8                              RegAMDPciASPM;
2386
 
 
2387
 
        u8                              oWLANMode;
2388
 
        RT_PM_WOL_PATTERN_INFO          PmWoLPatternInfo[MAX_SUPPORT_WOL_PATTERN_NUM]; 
2389
 
 
2390
 
}RT_POWER_SAVE_CONTROL,*PRT_POWER_SAVE_CONTROL;
2391
 
 
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       
2398
 
 
2399
 
typedef enum 
2400
 
{
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,
2414
 
        COUNTRY_CODE_MAX
2415
 
}country_code_type_t;   
2416
 
 
2417
 
typedef enum _SCAN_OPERATION_BACKUP_OPT{
2418
 
        SCAN_OPT_BACKUP=0,
2419
 
        SCAN_OPT_RESTORE,
2420
 
        SCAN_OPT_MAX
2421
 
}SCAN_OPERATION_BACKUP_OPT;
2422
 
 
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,
2434
 
        FW_CMD_RA_INIT= 10,
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,
2456
 
#else
2457
 
        FW_CMD_IQK_ENABLE = 30,
2458
 
#endif
2459
 
}FW_CMD_IO_TYPE,*PFW_CMD_IO_TYPE;
2460
 
 
2461
 
#define RT_MAX_LD_SLOT_NUM      10
2462
 
typedef struct _RT_LINK_DETECT_T{
2463
 
 
2464
 
        u32                             NumRecvBcnInPeriod;
2465
 
        u32                             NumRecvDataInPeriod;
2466
 
 
2467
 
        u32                             RxBcnNum[RT_MAX_LD_SLOT_NUM];   
2468
 
        u32                             RxDataNum[RT_MAX_LD_SLOT_NUM];  
2469
 
        u16                             SlotNum;        
2470
 
        u16                             SlotIndex;
2471
 
 
2472
 
        u32                             NumTxOkInPeriod;
2473
 
        u32                             NumRxOkInPeriod;
2474
 
        u32                             NumRxUnicastOkInPeriod;
2475
 
        bool                            bBusyTraffic;
2476
 
        bool                            bHigherBusyTraffic; 
2477
 
        bool                            bHigherBusyRxTraffic; 
2478
 
        u8                              IdleCount;
2479
 
        u32                             NumTxUnicastOkInPeriod;
2480
 
        u32                             LastNumTxUnicast;
2481
 
        u32                             LastNumRxUnicast;
2482
 
}RT_LINK_DETECT_T, *PRT_LINK_DETECT_T;
2483
 
 
2484
 
#ifdef _RTL8192_EXT_PATCH_
2485
 
struct rtllib_crypt_data_list{
2486
 
        u8 used;
2487
 
        u8 mac_addr[ETH_ALEN];  
2488
 
        struct rtllib_crypt_data *crypt[WEP_KEYS];
2489
 
}__attribute__((packed));
2490
 
 
2491
 
typedef struct _SW_RATR_TABLE{
2492
 
        bool bused;
2493
 
        u32  ratr_value;
2494
 
}SW_RATR_TABLE, *PSW_RATR_TABLE;
2495
 
#endif
2496
 
 
2497
 
typedef struct _SW_CAM_TABLE{
2498
 
 
2499
 
        u8                              macaddr[6];
2500
 
        bool                            bused;
2501
 
        u8                              key_buf[16];
2502
 
        u16                             key_type;
2503
 
        u8                              useDK;
2504
 
        u8                              key_index;                              
2505
 
        
2506
 
}SW_CAM_TABLE,*PSW_CAM_TABLE;
2507
 
#define   TOTAL_CAM_ENTRY                               32
2508
 
typedef struct _rate_adaptive
2509
 
{
2510
 
        u8                              rate_adaptive_disabled;
2511
 
        u8                              ratr_state;
2512
 
        u16                             reserve;        
2513
 
        
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;       
2529
 
        u32                             ping_rssi_ratr; 
2530
 
        u32                             ping_rssi_thresh_for_ra;
2531
 
        u32                             last_ratr;
2532
 
        u8                              PreRATRState;
2533
 
        
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;
2546
 
 
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;
2552
 
 
2553
 
struct sta_info {
2554
 
        u8 macaddr[ETH_ALEN];
2555
 
        u16 aid;
2556
 
        u8 authentication;
2557
 
        u8 encryption;
2558
 
        u16 capability;
2559
 
        u8 ratr_index;
2560
 
        int wireless_mode;
2561
 
        RT_HTINFO_STA_ENTRY htinfo;
2562
 
        u8 wme_enable;
2563
 
        u32 CurDataRate;
2564
 
        RSSI_STA rssi_stat;
2565
 
        rate_adaptive     rate_adaptive;
2566
 
        u8 bPowerSave;          
2567
 
        struct sk_buff_head PsQueue;            
2568
 
        u32     LastActiveTime; 
2569
 
        u16                     StaDataRate;  
2570
 
        u32                     StaSS; 
2571
 
        u16                     RetryFrameCnt;
2572
 
        u16                     LastRetryCnt;
2573
 
        u16                     NoRetryFrameCnt;
2574
 
        u16                     LastNoRetryCnt;
2575
 
        int                     AvgRetryRate;
2576
 
        int                     LastRetryRate;
2577
 
        u8                      txRateIndex;
2578
 
        u16                     APDataRate;
2579
 
        u16                     ForcedDataRate; 
2580
 
} __attribute__ ((packed));
2581
 
#endif
2582
 
#ifdef _RTL8192_EXT_PATCH_
2583
 
typedef struct _RT_PEERMP_HTINFO{
2584
 
        u8                              bEnableHT;
2585
 
        u8                              bCurrentHTSupport;
2586
 
 
2587
 
        u8                              bRegBW40MHz;                            
2588
 
        u8                              bCurBW40MHz;                            
2589
 
 
2590
 
        u8                              bRegShortGI40MHz;                       
2591
 
        u8                              bCurShortGI40MHz;                       
2592
 
 
2593
 
        u8                              bRegShortGI20MHz;                       
2594
 
        u8                              bCurShortGI20MHz;                       
2595
 
 
2596
 
        u8                              bCurSuppCCK;                            
2597
 
 
2598
 
        
2599
 
 
2600
 
 
2601
 
        u8                              PeerHTCapBuf[32];
2602
 
        u8                              PeerHTInfoBuf[32];
2603
 
 
2604
 
 
2605
 
        u8                              bAMSDU_Support;                 
2606
 
        u16                             nAMSDU_MaxSize;                 
2607
 
        u8                              bCurrent_Mesh_AMSDU_Support;    
2608
 
        
2609
 
 
2610
 
        u8                              bAMPDUEnable;                           
2611
 
        u8                              bCurrentMeshAMPDUEnable;                
2612
 
        u8                              AMPDU_Factor;                           
2613
 
        u8                              CurrentAMPDUFactor;             
2614
 
        u8                              MPDU_Density;                           
2615
 
        u8                              CurrentMPDUDensity;                     
2616
 
 
2617
 
        u8                              ForcedAMPDUFactor;
2618
 
        u8                              ForcedMPDUDensity;
2619
 
 
2620
 
        HT_AGGRE_MODE_E ForcedAMSDUMode;
2621
 
        u16                             ForcedAMSDUMaxSize;
2622
 
 
2623
 
        u8                              bForcedShortGI;
2624
 
 
2625
 
        u8                              CurrentOpMode;
2626
 
 
2627
 
        u8                              MimoPs;
2628
 
        
2629
 
        HT_EXTCHNL_OFFSET       CurSTAExtChnlOffset;
2630
 
        u8                              bCurTxBW40MHz;  
2631
 
        u8                              PeerBandwidth;
2632
 
 
2633
 
        u8                              bSwBwInProgress;
2634
 
        CHNLOP                          ChnlOp; 
2635
 
        u8                              SwBwStep;
2636
 
 
2637
 
        u8                              bRegRT2RTAggregation;
2638
 
        u8                              bCurrentRT2RTAggregation;
2639
 
        u8                              bCurrentRT2RTLongSlotTime;
2640
 
        u8                              szRT2RTAggBuffer[10];
2641
 
 
2642
 
        u8                              bRegRxReorderEnable;
2643
 
        u8                              bCurRxReorderEnable;
2644
 
        u8                              RxReorderWinSize;
2645
 
        u8                              RxReorderPendingTime;
2646
 
        u16                             RxReorderDropCounter;
2647
 
 
2648
 
#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE
2649
 
        u8                              UsbTxAggrNum;
2650
 
#endif
2651
 
#ifdef USB_RX_AGGREGATION_SUPPORT
2652
 
        u8                              UsbRxFwAggrEn;
2653
 
        u8                              UsbRxFwAggrPageNum;
2654
 
        u8                              UsbRxFwAggrPacketNum;
2655
 
        u8                              UsbRxFwAggrTimeout;
2656
 
#endif
2657
 
 
2658
 
        u8                              bIsPeerBcm;
2659
 
 
2660
 
        u8                              McsRateSet[16];
2661
 
        u8                              HTHighestOperaRate;
2662
 
        u8                              IOTPeer;
2663
 
        u32                             IOTAction;
2664
 
} __attribute__ ((packed)) peerMP_htinfo, *ppeerMP_htinfo;
2665
 
#endif
2666
 
 
2667
 
#define NUM_PMKID_CACHE         16
2668
 
typedef struct _RT_PMKID_LIST
2669
 
{
2670
 
        u8                                              bUsed;
2671
 
        u8                                              Bssid[6];
2672
 
        u8                                              PMKID[16];
2673
 
        u8                                              SsidBuf[33];
2674
 
        u8*                                             ssid_octet;
2675
 
        u16                                     ssid_length;
2676
 
} RT_PMKID_LIST, *PRT_PMKID_LIST;
2677
 
 
2678
 
#ifdef CONFIG_CFG_80211 
2679
 
enum {
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),
2687
 
};
2688
 
struct rtllib_channel {
2689
 
        u32 freq;
2690
 
        u8 channel;
2691
 
        u8 flags;
2692
 
        u8 max_power;
2693
 
};
2694
 
 
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)
2699
 
 
2700
 
struct reg_dmn_pair_mapping {
2701
 
        u16 regDmnEnum;
2702
 
        u16 reg_5ghz_ctl;
2703
 
        u16 reg_2ghz_ctl;
2704
 
};
2705
 
 
2706
 
struct rtl_regulatory {
2707
 
        char alpha2[2];
2708
 
        u16 country_code;
2709
 
        u16 max_power_level;
2710
 
        u32 tp_scale;
2711
 
        u16 current_rd;
2712
 
        u16 current_rd_ext;
2713
 
        int16_t power_limit;
2714
 
        struct reg_dmn_pair_mapping *regpair;
2715
 
};
2716
 
 
2717
 
struct ieee80211_bss {
2718
 
        /* Yes, this is a hack */
2719
 
        struct cfg80211_bss cbss;
2720
 
 
2721
 
        /* don't want to look up all the time */
2722
 
        size_t ssid_len;
2723
 
        u8 ssid[IEEE80211_MAX_SSID_LEN];
2724
 
 
2725
 
        u8 dtim_period;
2726
 
 
2727
 
        bool wmm_used;
2728
 
 
2729
 
        unsigned long last_probe_resp;
2730
 
 
2731
 
#ifdef CONFIG_MAC80211_MESH
2732
 
        u8 *mesh_id;
2733
 
        size_t mesh_id_len;
2734
 
        u8 *mesh_cfg;
2735
 
#endif
2736
 
 
2737
 
        #define IEEE80211_MAX_SUPP_RATES 32
2738
 
        u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
2739
 
        size_t supp_rates_len;
2740
 
 
2741
 
        /*
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.
2746
 
         */
2747
 
        bool has_erp_value;
2748
 
        u8 erp_value;
2749
 
};
2750
 
 
2751
 
/* Parsed Information Elements */
2752
 
struct ieee802_11_elems {
2753
 
        u8 *ie_start;
2754
 
        size_t total_len;
2755
 
 
2756
 
        /* pointers to IEs */
2757
 
        u8 *ssid;
2758
 
        u8 *supp_rates;
2759
 
        u8 *fh_params;
2760
 
        u8 *ds_params;
2761
 
        u8 *cf_params;
2762
 
        struct ieee80211_tim_ie *tim;
2763
 
        u8 *ibss_params;
2764
 
        u8 *challenge;
2765
 
        u8 *wpa;
2766
 
        u8 *rsn;
2767
 
        u8 *erp_info;
2768
 
        u8 *ext_supp_rates;
2769
 
        u8 *wmm_info;
2770
 
        u8 *wmm_param;
2771
 
        struct ieee80211_ht_cap *ht_cap_elem;
2772
 
        struct ieee80211_ht_info *ht_info_elem;
2773
 
        u8 *mesh_config;
2774
 
        u8 *mesh_id;
2775
 
        u8 *peer_link;
2776
 
        u8 *preq;
2777
 
        u8 *prep;
2778
 
        u8 *perr;
2779
 
        u8 *ch_switch_elem;
2780
 
        u8 *country_elem;
2781
 
        u8 *pwr_constr_elem;
2782
 
        u8 *quiet_elem;         /* first quite element */
2783
 
        u8 *timeout_int;
2784
 
 
2785
 
        /* length of them, respectively */
2786
 
        u8 ssid_len;
2787
 
        u8 supp_rates_len;
2788
 
        u8 fh_params_len;
2789
 
        u8 ds_params_len;
2790
 
        u8 cf_params_len;
2791
 
        u8 tim_len;
2792
 
        u8 ibss_params_len;
2793
 
        u8 challenge_len;
2794
 
        u8 wpa_len;
2795
 
        u8 rsn_len;
2796
 
        u8 erp_info_len;
2797
 
        u8 ext_supp_rates_len;
2798
 
        u8 wmm_info_len;
2799
 
        u8 wmm_param_len;
2800
 
        u8 mesh_config_len;
2801
 
        u8 mesh_id_len;
2802
 
        u8 peer_link_len;
2803
 
        u8 preq_len;
2804
 
        u8 prep_len;
2805
 
        u8 perr_len;
2806
 
        u8 ch_switch_elem_len;
2807
 
        u8 country_elem_len;
2808
 
        u8 pwr_constr_elem_len;
2809
 
        u8 quiet_elem_len;
2810
 
        u8 num_of_quiet_elem;   /* can be more the one */
2811
 
        u8 timeout_int_len;
2812
 
};
2813
 
 
2814
 
#endif
2815
 
 
2816
 
 
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;
2821
 
 
2822
 
typedef struct _WIRELESS_SETTING_BEFORE_SCAN
2823
 
{
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;     
2828
 
 
2829
 
        /*WirelessMode is designed to keep the original wireless mode setting before scan*/
2830
 
        WIRELESS_MODE           WirelessMode;           
2831
 
 
2832
 
        /*ChannelNumber is designd to keep the original channel number before scan*/
2833
 
        u8                                      ChannelNumber;
2834
 
 
2835
 
        /*ChannelBandwidth is designed to keep the original channel bandwidth(20/40MHz) before scan*/
2836
 
        HT_CHANNEL_WIDTH        ChannelBandwidth;
2837
 
 
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;
2841
 
 
2842
 
 
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   *****/
2849
 
 
2850
 
enum {
2851
 
        NO_USE          = 0,
2852
 
        USED            = 1,
2853
 
        HW_SEC  = 2,
2854
 
        SW_SEC          = 3,
2855
 
};
2856
 
 
2857
 
enum {
2858
 
        LPS_IS_WAKE = 0,
2859
 
        LPS_IS_SLEEP = 1,
2860
 
        LPS_WAIT_NULL_DATA_SEND =2,
2861
 
};
2862
 
 
2863
 
struct rtllib_device {
2864
 
        struct pci_dev *pdev;
2865
 
        struct net_device *dev;
2866
 
        struct rtllib_security sec;
2867
 
 
2868
 
        bool disable_mgnt_queue;
2869
 
 
2870
 
        unsigned long status;
2871
 
        short hwscan_ch_bk;
2872
 
        HT_EXTCHNL_OFFSET chan_offset_bk;
2873
 
        HT_CHANNEL_WIDTH bandwidth_bk;
2874
 
        u8 hwscan_sem_up;
2875
 
#ifdef CONFIG_CFG_80211
2876
 
        struct wireless_dev wdev;
2877
 
        struct rtl_regulatory regulatory;
2878
 
#endif
2879
 
        u8      CntAfterLink;
2880
 
 
2881
 
        RT_OP_MODE      OpMode;
2882
 
        WIRELESS_SETTING_BEFORE_SCAN    SettingBeforeScan;
2883
 
        
2884
 
        u8 VersionID;
2885
 
        /* The last AssocReq/Resp IEs */
2886
 
        u8 *assocreq_ies, *assocresp_ies;
2887
 
        size_t assocreq_ies_len, assocresp_ies_len;
2888
 
        
2889
 
        bool b_customer_lenovo_id;
2890
 
        bool    bForcedShowRxRate;
2891
 
        bool    bForcedShowRateStill;
2892
 
        u8      SystemQueryDataRateCount;
2893
 
        bool    bForcedBgMode;
2894
 
        bool bUseRAMask;
2895
 
        bool b1x1RecvCombine;
2896
 
        u8 RF_Type; 
2897
 
        bool b1SSSupport;
2898
 
        
2899
 
        u8 hwsec_active;  
2900
 
        bool is_silent_reset;
2901
 
      bool force_mic_error;
2902
 
        bool is_roaming;
2903
 
        bool ieee_up;   
2904
 
        bool cannot_notify;     
2905
 
        bool bSupportRemoteWakeUp;
2906
 
        RT_PS_MODE      dot11PowerSaveMode; 
2907
 
        bool actscanning;
2908
 
        bool FirstIe_InScan;
2909
 
        bool be_scan_inprogress;
2910
 
        bool beinretry;
2911
 
        RT_RF_POWER_STATE               eRFPowerState;
2912
 
        RT_RF_CHANGE_SOURCE     RfOffReason;
2913
 
        bool is_set_key;
2914
 
        bool wx_set_enc; 
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;
2919
 
        u64     CurrTsf;
2920
 
        u64     TargetTsf;
2921
 
        u64     bdTstamp;
2922
 
        bool    Peer_bCurBW40M;
2923
 
#endif
2924
 
        PRT_HIGH_THROUGHPUT     pHTInfo;
2925
 
        spinlock_t bw_spinlock;
2926
 
 
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;
2934
 
       u8               MinSpaceCfg;
2935
 
        u8              MaxMssDensity;
2936
 
        u8      bTxDisableRateFallBack;
2937
 
        u8      bTxUseDriverAssingedRate;
2938
 
        u8      bTxEnableFwCalcDur;
2939
 
        atomic_t        atm_chnlop;
2940
 
        atomic_t        atm_swbw;
2941
 
 
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;
2952
 
        u8                              ForcedPriority;         
2953
 
        
2954
 
 
2955
 
        /* Bookkeeping structures */
2956
 
        struct net_device_stats stats;
2957
 
        struct rtllib_stats ieee_stats;
2958
 
        struct rtllib_softmac_stats softmac_stats;
2959
 
        
2960
 
        /* Probe / Beacon management */
2961
 
        struct list_head network_free_list;
2962
 
        struct list_head network_list;
2963
 
#ifdef RTL8192U
2964
 
        struct list_head network_bssid_free_list;
2965
 
        struct list_head network_bssid_list;
2966
 
#endif
2967
 
        struct rtllib_network *networks;
2968
 
        int scans;
2969
 
        int scan_age;
2970
 
 
2971
 
        int iw_mode; /* operating mode (IW_MODE_*) */
2972
 
        bool bNetPromiscuousMode; 
2973
 
        RT_INTEL_PROMISCUOUS_MODE_INFO IntelPromiscuousModeInfo;
2974
 
        
2975
 
        struct iw_spy_data spy_data; 
2976
 
 
2977
 
        spinlock_t lock;
2978
 
        spinlock_t wpax_suitlist_lock;
2979
 
        
2980
 
        int tx_headroom; /* Set to size of any additional room needed at front
2981
 
                          * of allocated Tx SKBs */
2982
 
        u32 config;
2983
 
 
2984
 
        /* WEP and other encryption related settings at the device level */
2985
 
        int open_wep; /* Set to 1 to allow unencrypted frames */
2986
 
        int auth_mode;
2987
 
        int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
2988
 
                                 * WEP key changes */
2989
 
 
2990
 
        /* If the host performs {en,de}cryption, then set to 1 */
2991
 
        int host_encrypt;
2992
 
        int host_encrypt_msdu;
2993
 
        int host_decrypt;
2994
 
        /* host performs multicast decryption */
2995
 
        int host_mc_decrypt;
2996
 
 
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;
3000
 
 
3001
 
        int host_open_frag;
3002
 
        int host_build_iv;
3003
 
        int ieee802_1x; /* is IEEE 802.1X used */
3004
 
 
3005
 
        /* WPA data */
3006
 
        bool bHalfNMode;
3007
 
        bool bHalfWirelessN24GMode;
3008
 
        int wpa_enabled;
3009
 
        int drop_unencrypted;
3010
 
        int tkip_countermeasures;
3011
 
        int privacy_invoked;
3012
 
        size_t wpa_ie_len;
3013
 
        u8 *wpa_ie;
3014
 
        size_t wps_ie_len;
3015
 
        u8 *wps_ie;
3016
 
        u8 ap_mac_addr[6];
3017
 
        u16 pairwise_key_type;
3018
 
        u16 group_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];
3023
 
#else
3024
 
        struct rtllib_crypt_data *crypt[WEP_KEYS];
3025
 
#endif
3026
 
 
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;
3030
 
        int crypt_quiesced;
3031
 
 
3032
 
        int bcrx_sta_key; /* use individual keys to override default keys even
3033
 
                           * with RX of broad/multicast frames */
3034
 
        
3035
 
        RT_PMKID_LIST           PMKIDList[NUM_PMKID_CACHE];
3036
 
 
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 */
3045
 
 
3046
 
        /* Association info */
3047
 
        u8 bssid[ETH_ALEN];
3048
 
 
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  
3056
 
         */
3057
 
        struct rtllib_network current_network;
3058
 
 
3059
 
        enum rtllib_state state;
3060
 
 
3061
 
        int short_slot;
3062
 
        int reg_mode;
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              */
3067
 
        
3068
 
        /* used for forcing the ibss workqueue to terminate 
3069
 
         * without wait for the syncro scan to terminate
3070
 
         */
3071
 
        short sync_scan_hurryup; 
3072
 
        u16 scan_watch_dog;
3073
 
        int perfect_rssi;
3074
 
        int worst_rssi;
3075
 
 
3076
 
        u16 prev_seq_ctl;       /* used to drop duplicate frames */
3077
 
 
3078
 
        /* map of allowed channels. 0 is dummy */
3079
 
#ifdef ENABLE_DOT11D
3080
 
        void* pDot11dInfo;
3081
 
        bool bGlobalDomain;
3082
 
#else
3083
 
        u8 channel_map[MAX_CHANNEL_NUMBER+1];
3084
 
#endif  
3085
 
        u8 active_channel_map[MAX_CHANNEL_NUMBER+1];
3086
 
 
3087
 
        u8   IbssStartChnl;
3088
 
        u8   ibss_maxjoin_chal;
3089
 
 
3090
 
#ifdef _RTL8192_EXT_PATCH_
3091
 
        u8 backup_channel;
3092
 
#endif  
3093
 
        bool bUseProtection;
3094
 
 
3095
 
        int rate;       /* current rate */
3096
 
        int basic_rate;
3097
 
        u32     currentRate;
3098
 
        
3099
 
        short active_scan;
3100
 
        
3101
 
        /* this contains flags for selectively enable softmac support */
3102
 
        u16 softmac_features;
3103
 
        
3104
 
        /* if the sequence control field is not filled by HW */
3105
 
        u16 seq_ctrl[5];
3106
 
        
3107
 
        /* association procedure transaction sequence number */
3108
 
        u16 associate_seq;
3109
 
        
3110
 
        /* AID for RTXed association responses */
3111
 
        u16 assoc_id;
3112
 
        
3113
 
        /* power save mode related*/
3114
 
        u8 ack_tx_to_ieee;
3115
 
        short ps;
3116
 
        short sta_sleep;
3117
 
        int ps_timeout;
3118
 
        int ps_period;
3119
 
        struct tasklet_struct ps_task;
3120
 
        u32 ps_th;
3121
 
        u32 ps_tl;
3122
 
        bool polling;
3123
 
        
3124
 
        short raw_tx;
3125
 
        /* used if IEEE_SOFTMAC_TX_QUEUE is set */
3126
 
        short queue_stop;
3127
 
        short scanning_continue ;
3128
 
        short proto_started;
3129
 
        short proto_stoppping;
3130
 
        
3131
 
        struct semaphore wx_sem;
3132
 
        struct semaphore scan_sem;
3133
 
        struct semaphore ips_sem;
3134
 
        
3135
 
        spinlock_t mgmt_tx_lock;        
3136
 
        spinlock_t beacon_lock;
3137
 
 
3138
 
        short beacon_txing;
3139
 
 
3140
 
        short wap_set;
3141
 
        short ssid_set;
3142
 
        
3143
 
        /* set on initialization */
3144
 
        u8  qos_support;
3145
 
        unsigned int wmm_acm;
3146
 
        
3147
 
        /* for discarding duplicated packets in IBSS */
3148
 
        struct list_head ibss_mac_hash[IEEE_IBSS_MAC_HASH_SIZE];
3149
 
        
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];
3154
 
        
3155
 
        /* for PS mode */
3156
 
        unsigned long last_rx_ps_time;
3157
 
        bool                    bAwakePktSent; 
3158
 
        u8                      LPSDelayCnt;
3159
 
        
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
3165
 
        u8 AsocRetryCount;
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];
3171
 
        bool aggregation;
3172
 
        bool enable_rx_imm_BA;
3173
 
        bool bibsscoordinator;
3174
 
 
3175
 
        bool    bdynamic_txpower_enable; 
3176
 
 
3177
 
        bool bCTSToSelfEnable;
3178
 
        u8      CTSToSelfTH;
3179
 
        
3180
 
        u32     fsync_time_interval;
3181
 
        u32     fsync_rate_bitmap;
3182
 
        u8      fsync_rssi_threshold;
3183
 
        bool    bfsync_enable;
3184
 
 
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;
3191
 
        bool FwRWRF;
3192
 
 
3193
 
        RT_LINK_DETECT_T        LinkDetectInfo;
3194
 
        bool bIsAggregateFrame;
3195
 
        RT_POWER_SAVE_CONTROL   PowerSaveControl;
3196
 
        u8 amsdu_in_process;
3197
 
 
3198
 
        /* used if IEEE_SOFTMAC_TX_QUEUE is set */
3199
 
        struct  tx_pending_t tx_pending;
3200
 
        
3201
 
        /* used if IEEE_SOFTMAC_ASSOCIATE is set */
3202
 
        struct timer_list associate_timer;
3203
 
 
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;
3208
 
#endif
3209
 
        u8 need_sw_enc;
3210
 
#ifdef _RTL8192_EXT_PATCH_
3211
 
        struct net_device *meshdev;
3212
 
        struct net_device_stats *meshstats;
3213
 
        u8 only_mesh;  
3214
 
        u8 hostname[MAX_HOST_NAME_LENGTH];
3215
 
        u8 hostname_len;
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;
3221
 
        short mesh_started;
3222
 
        int mesh_security_setting;
3223
 
        int mesh_sec_type;
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];
3231
 
        int mesh_txkeyidx;
3232
 
        u16 mesh_pairwise_key_type;
3233
 
        u16 mesh_group_key_type;
3234
 
        u32 HwSecCamBitMap; 
3235
 
        u8 HwSecCamStaAddr[TOTAL_CAM_ENTRY][ETH_ALEN]; 
3236
 
        SW_CAM_TABLE swmeshcamtable[TOTAL_CAM_ENTRY];
3237
 
        SW_RATR_TABLE swmeshratrtable[8];
3238
 
        short meshid_set;
3239
 
        u8 p2pmode;
3240
 
        u8 serverExtChlOffset;
3241
 
        u8 APExtChlOffset;
3242
 
        short meshScanMode;
3243
 
        struct sk_buff_head  skb_meshaggQ[MAX_QUEUE_SIZE]; 
3244
 
        u8 mesh_amsdu_in_process;
3245
 
#endif
3246
 
        work_struct_rsl associate_complete_wq;
3247
 
#ifdef ENABLE_IPS
3248
 
        work_struct_rsl ips_leave_wq;
3249
 
#endif    
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;
3253
 
#endif
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;
3259
 
#ifndef RTL8190P
3260
 
        delayed_work_struct_rsl hw_wakeup_wq;
3261
 
        delayed_work_struct_rsl hw_sleep_wq;
3262
 
#endif
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;  
3273
 
#endif
3274
 
 
3275
 
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)  
3276
 
        struct workqueue_struct *wq;
3277
 
#else
3278
 
        u32 *wq;
3279
 
#endif
3280
 
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,40)  
3281
 
        /* used for periodly scan */
3282
 
        struct timer_list scan_timer;
3283
 
#endif
3284
 
#if defined (RTL8192S_WAPI_SUPPORT)
3285
 
        u8      WapiSupport;    
3286
 
        RT_WAPI_T       wapiInfo;
3287
 
        struct list_head cache_frag_list;
3288
 
        spinlock_t wapi_queue_lock; 
3289
 
        WAPI_QUEUE *wapi_queue; 
3290
 
#endif
3291
 
 
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);
3295
 
#endif
3296
 
        /* Callback functions */
3297
 
        void (*set_security)(struct net_device *dev,
3298
 
                             struct rtllib_security *sec);
3299
 
        
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
3303
 
         */
3304
 
        int (*hard_start_xmit)(struct rtllib_txb *txb,
3305
 
                               struct net_device *dev);
3306
 
        
3307
 
        int (*reset_port)(struct net_device *dev);
3308
 
        int (*is_queue_full) (struct net_device * dev, int pri);
3309
 
 
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);
3313
 
 
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.
3320
 
         */
3321
 
        int (*softmac_hard_start_xmit)(struct sk_buff *skb,
3322
 
                               struct net_device *dev);
3323
 
        
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.
3329
 
         */    
3330
 
        void (*softmac_data_hard_start_xmit)(struct sk_buff *skb,
3331
 
                               struct net_device *dev,int rate);
3332
 
 
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.
3336
 
         */      
3337
 
        void (*data_hard_stop)(struct net_device *dev);
3338
 
        
3339
 
        /* OK this is complementar to data_poll_hard_stop */
3340
 
        void (*data_hard_resume)(struct net_device *dev);
3341
 
        
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.
3345
 
         */
3346
 
        void (*set_chan)(struct net_device *dev,short ch);
3347
 
        
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.
3351
 
         *
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.
3362
 
         */ 
3363
 
        void (*scan_syncro)(struct net_device *dev);
3364
 
        void (*start_scan)(struct net_device *dev);
3365
 
        void (*stop_scan)(struct net_device *dev);
3366
 
        
3367
 
        void (*rtllib_start_hw_scan)(struct net_device *dev);
3368
 
        void (*rtllib_stop_hw_scan)(struct net_device *dev);
3369
 
        
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 
3374
 
         */
3375
 
        void (*link_change)(struct net_device *dev);
3376
 
        
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.
3382
 
         */
3383
 
        void (*start_send_beacons) (struct net_device *dev);
3384
 
        void (*stop_send_beacons) (struct net_device *dev);
3385
 
        
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);
3390
 
#if 0
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);
3401
 
#endif
3402
 
        int (*handle_beacon) (struct net_device * dev, struct rtllib_beacon * beacon, struct rtllib_network * network);
3403
 
#if 0
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);
3410
 
#endif
3411
 
        int (*handle_assoc_response) (struct net_device * dev, struct rtllib_assoc_response_frame * resp, struct rtllib_network * network);
3412
 
 
3413
 
#if 0
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);
3418
 
#endif
3419
 
 
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);
3431
 
        
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); 
3437
 
 
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); 
3440
 
 
3441
 
        void (*ext_patch_rtllib_stop_protocol) (struct rtllib_device *ieee,bool is_silent_reset); 
3442
 
        
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);
3447
 
 
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);
3450
 
 
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);
3456
 
 
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);
3460
 
        
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);
3472
 
        
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);
3475
 
 
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);
3477
 
        
3478
 
        int (*ext_patch_rtllib_rx_frame_get_hdrlen) (struct rtllib_device *ieee, struct sk_buff *skb);
3479
 
        
3480
 
        int (*ext_patch_rtllib_rx_frame_get_mac_hdrlen) (struct rtllib_device *ieee, struct sk_buff *skb);
3481
 
        
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);
3484
 
        
3485
 
        
3486
 
        /* added by david for setting acl dynamically */
3487
 
        u8 (*ext_patch_rtllib_acl_query) (struct rtllib_device *ieee, u8 *sa);
3488
 
 
3489
 
        
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);
3494
 
 
3495
 
#endif 
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);
3505
 
 
3506
 
        void (*AllowAllDestAddrHandler)(struct net_device *dev, bool bAllowAllDA, bool WriteIntoReg);
3507
 
        
3508
 
#ifdef ENABLE_IPS
3509
 
        void (*rtllib_ips_leave_wq) (struct net_device *dev);
3510
 
        void (*rtllib_ips_leave)(struct net_device *dev);
3511
 
#endif
3512
 
#ifdef ENABLE_LPS
3513
 
        void (*LeisurePSLeave)(struct net_device *dev);
3514
 
#endif
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);
3519
 
#endif
3520
 
        void (*rtllib_rfkill_poll)(struct net_device *dev);
3521
 
 
3522
 
        /* This must be the last item so that it points to the data
3523
 
         * allocated beyond this structure by alloc_rtllib */
3524
 
        u8 priv[0];
3525
 
};
3526
 
 
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)
3533
 
 
3534
 
/* Generate a 802.11 header */
3535
 
 
3536
 
/* Uses the channel change callback directly
3537
 
 * instead of [start/stop] scan callbacks
3538
 
 */
3539
 
#define IEEE_SOFTMAC_SCAN (1<<2)
3540
 
 
3541
 
/* Perform authentication and association handshake */
3542
 
#define IEEE_SOFTMAC_ASSOCIATE (1<<3)
3543
 
 
3544
 
/* Generate probe requests */
3545
 
#define IEEE_SOFTMAC_PROBERQ (1<<4)
3546
 
 
3547
 
/* Generate respones to probe requests */
3548
 
#define IEEE_SOFTMAC_PROBERS (1<<5)
3549
 
 
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)
3554
 
 
3555
 
/* Uses only the softmac_data_hard_start_xmit
3556
 
 * even for TX management frames.
3557
 
 */
3558
 
#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
3559
 
 
3560
 
/* Generate beacons.  The stack will enqueue beacons
3561
 
 * to the card 
3562
 
 */ 
3563
 
#define IEEE_SOFTMAC_BEACONS (1<<6)
3564
 
 
3565
 
#ifdef _RTL8192_EXT_PATCH_
3566
 
static inline int rtllib_find_MP(struct rtllib_device* ieee, const u8* addr, u8 set)
3567
 
{
3568
 
        int i=0;
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;
3573
 
                        return i;
3574
 
                } else if (0 == memcmp(ieee->cryptlist[i]->mac_addr, addr, ETH_ALEN)) {
3575
 
                        return i;
3576
 
                }
3577
 
        }
3578
 
        return -1;
3579
 
}
3580
 
#endif
3581
 
 
3582
 
static inline void *rtllib_priv(struct net_device *dev)
3583
 
{
3584
 
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) 
3585
 
        return ((struct rtllib_device *)netdev_priv(dev))->priv;
3586
 
#else
3587
 
        return ((struct rtllib_device *)dev->priv)->priv;
3588
 
#endif
3589
 
}
3590
 
 
3591
 
extern inline int rtllib_is_empty_essid(const char *essid, int essid_len)
3592
 
{
3593
 
        /* Single white space is for Linksys APs */
3594
 
        if (essid_len == 1 && essid[0] == ' ')
3595
 
                return 1;
3596
 
 
3597
 
        /* Otherwise, if the entire essid is 0, we assume it is hidden */
3598
 
        while (essid_len) {
3599
 
                essid_len--;
3600
 
                if (essid[essid_len] != '\0')
3601
 
                        return 0;
3602
 
        }
3603
 
 
3604
 
        return 1;
3605
 
}
3606
 
 
3607
 
extern inline int rtllib_is_valid_mode(struct rtllib_device *ieee, int mode)
3608
 
{
3609
 
        /*
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
3613
 
         *
3614
 
         */
3615
 
        if ((mode & IEEE_A) &&
3616
 
            (ieee->modulation & RTLLIB_OFDM_MODULATION) &&
3617
 
            (ieee->freq_band & RTLLIB_52GHZ_BAND))
3618
 
                return 1;
3619
 
 
3620
 
        if ((mode & IEEE_G) &&
3621
 
            (ieee->modulation & RTLLIB_OFDM_MODULATION) &&
3622
 
            (ieee->freq_band & RTLLIB_24GHZ_BAND))
3623
 
                return 1;
3624
 
 
3625
 
        if ((mode & IEEE_B) &&
3626
 
            (ieee->modulation & RTLLIB_CCK_MODULATION) &&
3627
 
            (ieee->freq_band & RTLLIB_24GHZ_BAND))
3628
 
                return 1;
3629
 
 
3630
 
        return 0;
3631
 
}
3632
 
 
3633
 
extern inline int rtllib_get_hdrlen(u16 fc)
3634
 
{
3635
 
        int hdrlen = RTLLIB_3ADDR_LEN;
3636
 
 
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*/
3643
 
                break;
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;
3649
 
                        break;
3650
 
                default:
3651
 
                        hdrlen = RTLLIB_2ADDR_LEN;
3652
 
                        break;
3653
 
                }
3654
 
                break;
3655
 
        }
3656
 
 
3657
 
        return hdrlen;
3658
 
}
3659
 
 
3660
 
static inline u8 *rtllib_get_payload(struct rtllib_hdr *hdr)
3661
 
{
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;
3671
 
        }
3672
 
        return NULL;
3673
 
}
3674
 
 
3675
 
static inline int rtllib_is_ofdm_rate(u8 rate)
3676
 
{
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:
3686
 
                return 1;
3687
 
        }
3688
 
        return 0;
3689
 
}
3690
 
 
3691
 
static inline int rtllib_is_cck_rate(u8 rate)
3692
 
{
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:
3698
 
                return 1;
3699
 
        }
3700
 
        return 0;
3701
 
}
3702
 
 
3703
 
 
3704
 
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
3705
 
static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
3706
 
{
3707
 
        const u16 *a = (const u16 *) addr1;
3708
 
        const u16 *b = (const u16 *) addr2;
3709
 
 
3710
 
        BUILD_BUG_ON(ETH_ALEN != 6);
3711
 
        return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
3712
 
}
3713
 
#endif
3714
 
 
3715
 
/* rtllib.c */
3716
 
extern void free_rtllib(struct net_device *dev);
3717
 
extern struct net_device *alloc_rtllib(int sizeof_priv);
3718
 
 
3719
 
extern int rtllib_set_encryption(struct rtllib_device *ieee);
3720
 
 
3721
 
/* rtllib_tx.c */
3722
 
 
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);
3728
 
#else
3729
 
extern int rtllib_encrypt_fragment(
3730
 
        struct rtllib_device *ieee,
3731
 
        struct sk_buff *frag,
3732
 
        int hdr_len);
3733
 
#endif
3734
 
 
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);
3741
 
#endif
3742
 
extern void rtllib_txb_free(struct rtllib_txb *);
3743
 
 
3744
 
#ifdef ENABLE_AMSDU
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);
3749
 
#endif
3750
 
 
3751
 
/* rtllib_rx.c */
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);
3760
 
 
3761
 
/* rtllib_wx.c */
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);
3781
 
#endif
3782
 
#else
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);
3796
 
#endif
3797
 
#endif
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);
3805
 
 
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,
3811
 
                        u16 stype);
3812
 
extern void rtllib_softmac_new_net(struct rtllib_device *ieee, struct rtllib_network *net);
3813
 
 
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);
3816
 
 
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);
3839
 
 
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);
3845
 
 
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);
3848
 
 
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);
3852
 
#endif
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);
3862
 
 
3863
 
extern void notify_wx_assoc_event(struct rtllib_device *ieee);
3864
 
extern void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success);
3865
 
 
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);
3869
 
 
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);
3881
 
#endif
3882
 
 
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);
3887
 
 
3888
 
/* rtllib_softmac_wx.c */
3889
 
 
3890
 
extern int rtllib_wx_get_wap(struct rtllib_device *ieee, 
3891
 
                            struct iw_request_info *info, 
3892
 
                            union iwreq_data *wrqu, char *ext);
3893
 
                            
3894
 
extern int rtllib_wx_set_wap(struct rtllib_device *ieee,
3895
 
                         struct iw_request_info *info,
3896
 
                         union iwreq_data *awrq,
3897
 
                         char *extra);
3898
 
                         
3899
 
extern int rtllib_wx_get_essid(struct rtllib_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b);
3900
 
 
3901
 
extern int rtllib_wx_set_rate(struct rtllib_device *ieee, 
3902
 
                             struct iw_request_info *info,
3903
 
                             union iwreq_data *wrqu, char *extra);
3904
 
                             
3905
 
extern int rtllib_wx_get_rate(struct rtllib_device *ieee, 
3906
 
                             struct iw_request_info *info, 
3907
 
                             union iwreq_data *wrqu, char *extra);
3908
 
                             
3909
 
extern int rtllib_wx_set_mode(struct rtllib_device *ieee, struct iw_request_info *a,
3910
 
                             union iwreq_data *wrqu, char *b);
3911
 
                             
3912
 
extern int rtllib_wx_set_scan(struct rtllib_device *ieee, struct iw_request_info *a,
3913
 
                             union iwreq_data *wrqu, char *b);
3914
 
                             
3915
 
extern int rtllib_wx_set_essid(struct rtllib_device *ieee, 
3916
 
                              struct iw_request_info *a,
3917
 
                              union iwreq_data *wrqu, char *extra);
3918
 
                              
3919
 
extern int rtllib_wx_get_mode(struct rtllib_device *ieee, struct iw_request_info *a,
3920
 
                             union iwreq_data *wrqu, char *b);
3921
 
 
3922
 
extern int rtllib_wx_set_freq(struct rtllib_device *ieee, struct iw_request_info *a,
3923
 
                             union iwreq_data *wrqu, char *b);
3924
 
 
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);
3928
 
#else
3929
 
extern int rtllib_wx_get_freq(struct rtllib_device *ieee, struct iw_request_info *a,
3930
 
                             union iwreq_data *wrqu, char *b);
3931
 
#endif
3932
 
extern void rtllib_wx_sync_scan_wq(void *data);
3933
 
 
3934
 
extern int rtllib_wx_set_rawtx(struct rtllib_device *ieee, 
3935
 
                               struct iw_request_info *info, 
3936
 
                               union iwreq_data *wrqu, char *extra);
3937
 
                               
3938
 
extern int rtllib_wx_get_name(struct rtllib_device *ieee, 
3939
 
                             struct iw_request_info *info, 
3940
 
                             union iwreq_data *wrqu, char *extra);
3941
 
 
3942
 
extern int rtllib_wx_set_power(struct rtllib_device *ieee,
3943
 
                                 struct iw_request_info *info,
3944
 
                                 union iwreq_data *wrqu, char *extra);
3945
 
 
3946
 
extern int rtllib_wx_get_power(struct rtllib_device *ieee,
3947
 
                                 struct iw_request_info *info,
3948
 
                                 union iwreq_data *wrqu, char *extra);
3949
 
 
3950
 
extern int rtllib_wx_set_rts(struct rtllib_device *ieee, 
3951
 
                             struct iw_request_info *info,
3952
 
                             union iwreq_data *wrqu, char *extra);
3953
 
 
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);
3959
 
#endif
3960
 
#define MAX_RECEIVE_BUFFER_SIZE 9100  
3961
 
extern void HTDebugHTCapability(u8* CapIE, u8* TitleString );
3962
 
extern void HTDebugHTInfo(u8*  InfoIE, u8* TitleString);
3963
 
 
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);
3968
 
#else
3969
 
extern void HTConstructCapabilityElement(struct rtllib_device* ieee, u8* posHTCap, u8* len, u8 isEncrypt,bool bAssoc);
3970
 
#endif
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);
3996
 
extern bool GetTs(
3997
 
        struct rtllib_device*        ieee,
3998
 
        PTS_COMMON_INFO                 *ppTS,
3999
 
        u8*                             Addr,
4000
 
        u8                              TID,
4001
 
        TR_SELECT                       TxRxSelect,  
4002
 
        bool                            bAddNewTs
4003
 
        );
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);
4010
 
#endif
4011
 
void rtllib_softmac_scan_syncro(struct rtllib_device *ieee, u8 is_mesh);
4012
 
 
4013
 
extern const long rtllib_wlan_frequencies[];
4014
 
 
4015
 
extern inline void rtllib_increment_scans(struct rtllib_device *ieee)
4016
 
{
4017
 
        ieee->scans++;
4018
 
}
4019
 
 
4020
 
extern inline int rtllib_get_scans(struct rtllib_device *ieee)
4021
 
{
4022
 
        return ieee->scans;
4023
 
}
4024
 
 
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;
4028
 
        char *d = escaped;
4029
 
 
4030
 
        if (rtllib_is_empty_essid(essid, essid_len)) {
4031
 
                memcpy(escaped, "<hidden>", sizeof("<hidden>"));
4032
 
                return escaped;
4033
 
        }
4034
 
 
4035
 
        essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE);
4036
 
        while (essid_len--) {
4037
 
                if (*s == '\0') {
4038
 
                        *d++ = '\\';
4039
 
                        *d++ = '0';
4040
 
                        s++;
4041
 
                } else {
4042
 
                        *d++ = *s++;
4043
 
                }
4044
 
        }
4045
 
        *d = '\0';
4046
 
        return escaped;
4047
 
}
4048
 
 
4049
 
#define CONVERT_RATE(_ieee, _MGN_RATE)  (_MGN_RATE<MGN_MCS0)?(_MGN_RATE):(HTMcsToDataRate(_ieee, (u8)_MGN_RATE))
4050
 
 
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);
4063
 
#endif
4064
 
 
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);
4069
 
 
4070
 
 
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.
4076
 
 */
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, 
4082
 
                u16 length,
4083
 
                struct rtllib_network *network,
4084
 
                struct rtllib_rx_stats *stats);
4085
 
 
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);
4092
 
#endif
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);
4102
 
#endif
4103
 
#ifdef THOMAS_TURBO
4104
 
extern void rtllib_TURBO_Info(struct rtllib_device *ieee, u8 **tag_p);
4105
 
#endif
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)
4147
 
#endif
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,
4154
 
        u8              *pbuffer,
4155
 
        u16             buf_len,
4156
 
        u8              *DestAddr,
4157
 
        u8              bUpdateBK,
4158
 
        u8              bUpdateUSK,
4159
 
        u8              bUpdateMSK,
4160
 
        u8              RcvPktType,
4161
 
        u8              bDisconnect);
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(
4171
 
        u8                      UserPriority,
4172
 
        PRT_WAPI_STA_INFO    pWapiStaInfo,
4173
 
        u8 *PNOut);
4174
 
extern void WapiSetLastRxUnicastPNForQoSData(
4175
 
        u8              UserPriority,
4176
 
        u8           *PNIn,
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);
4192
 
 
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);
4197
 
#endif
4198
 
static inline void dump_buf(u8 *buf, u32 len)
4199
 
{
4200
 
        u32 i;
4201
 
        printk("-----------------Len %d----------------\n", len);
4202
 
        for(i=0; i<len; i++)
4203
 
                printk("%2.2x-", *(buf+i));
4204
 
        printk("\n");
4205
 
}
4206
 
#endif /* RTLLIB_H */