]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/vt6656/device.h
Merge branch 'bcache-for-upstream' of git://evilpiepirate.org/~kent/linux-bcache...
[karo-tx-linux.git] / drivers / staging / vt6656 / device.h
1 /*
2  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3  * All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * File: device.h
20  *
21  * Purpose: MAC Data structure
22  *
23  * Author: Tevin Chen
24  *
25  * Date: Mar 17, 1997
26  *
27  */
28
29 #ifndef __DEVICE_H__
30 #define __DEVICE_H__
31
32 #include <linux/module.h>
33 #include <linux/kernel.h>
34 #include <linux/slab.h>
35 #include <linux/init.h>
36 #include <linux/delay.h>
37 #include <linux/device.h>
38 #include <linux/firmware.h>
39 #include <linux/etherdevice.h>
40 #include <linux/suspend.h>
41 #include <linux/if_arp.h>
42 #include <linux/wireless.h>
43 #include <net/iw_handler.h>
44 #include <net/cfg80211.h>
45 #include <linux/timer.h>
46 #include <linux/usb.h>
47
48 #ifdef SIOCETHTOOL
49 #define DEVICE_ETHTOOL_IOCTL_SUPPORT
50 #include <linux/ethtool.h>
51 #else
52 #undef DEVICE_ETHTOOL_IOCTL_SUPPORT
53 #endif
54
55 /* please copy below macro to driver_event.c for API */
56 #define RT_INSMOD_EVENT_FLAG                             0x0101
57 #define RT_UPDEV_EVENT_FLAG                               0x0102
58 #define RT_DISCONNECTED_EVENT_FLAG               0x0103
59 #define RT_WPACONNECTED_EVENT_FLAG             0x0104
60 #define RT_DOWNDEV_EVENT_FLAG                        0x0105
61 #define RT_RMMOD_EVENT_FLAG                              0x0106
62
63 /*
64  * device specific
65  */
66
67 #include "device_cfg.h"
68 #include "80211hdr.h"
69 #include "tether.h"
70 #include "wmgr.h"
71 #include "wcmd.h"
72 #include "mib.h"
73 #include "srom.h"
74 #include "rc4.h"
75 #include "desc.h"
76 #include "key.h"
77 #include "card.h"
78
79 #define VNT_USB_VENDOR_ID                     0x160a
80 #define VNT_USB_PRODUCT_ID                    0x3184
81
82 #define MAC_MAX_CONTEXT_REG     (256+128)
83
84 #define MAX_MULTICAST_ADDRESS_NUM       32
85 #define MULTICAST_ADDRESS_LIST_SIZE     (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN)
86
87 #define DUPLICATE_RX_CACHE_LENGTH       5
88
89 #define NUM_KEY_ENTRY                   11
90
91 #define TX_WEP_NONE                     0
92 #define TX_WEP_OTF                      1
93 #define TX_WEP_SW                       2
94 #define TX_WEP_SWOTP                    3
95 #define TX_WEP_OTPSW                    4
96 #define TX_WEP_SW232                    5
97
98 #define KEYSEL_WEP40                    0
99 #define KEYSEL_WEP104                   1
100 #define KEYSEL_TKIP                     2
101 #define KEYSEL_CCMP                     3
102
103 #define AUTO_FB_NONE            0
104 #define AUTO_FB_0               1
105 #define AUTO_FB_1               2
106
107 #define FB_RATE0                0
108 #define FB_RATE1                1
109
110 /* Antenna Mode */
111 #define ANT_A                   0
112 #define ANT_B                   1
113 #define ANT_DIVERSITY           2
114 #define ANT_RXD_TXA             3
115 #define ANT_RXD_TXB             4
116 #define ANT_UNKNOWN             0xFF
117 #define ANT_TXA                 0
118 #define ANT_TXB                 1
119 #define ANT_RXA                 2
120 #define ANT_RXB                 3
121
122 #define MAXCHECKHANGCNT         4
123
124 /* Packet type */
125 #define TX_PKT_UNI              0x00
126 #define TX_PKT_MULTI            0x01
127 #define TX_PKT_BROAD            0x02
128
129 #define BB_VGA_LEVEL            4
130 #define BB_VGA_CHANGE_THRESHOLD 3
131
132 #ifndef RUN_AT
133 #define RUN_AT(x)                       (jiffies+(x))
134 #endif
135
136 /* DMA related */
137 #define RESERV_AC0DMA                   4
138
139 #define PRIVATE_Message                 0
140
141 #define DBG_PRT(l, p, args...) { if (l <= msglevel) printk(p, ##args); }
142 #define PRINT_K(p, args...) { if (PRIVATE_Message) printk(p, ##args); }
143
144 typedef enum __device_msg_level {
145         MSG_LEVEL_ERR = 0,            /* Errors causing abnormal operation */
146         MSG_LEVEL_NOTICE = 1,         /* Errors needing user notification */
147         MSG_LEVEL_INFO = 2,           /* Normal message. */
148         MSG_LEVEL_VERBOSE = 3,        /* Will report all trival errors. */
149         MSG_LEVEL_DEBUG = 4           /* Only for debug purpose. */
150 } DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL;
151
152 typedef enum __device_init_type {
153         DEVICE_INIT_COLD = 0,       /* cold init */
154         DEVICE_INIT_RESET,          /* reset init or Dx to D0 power remain */
155         DEVICE_INIT_DXPL            /* Dx to D0 power lost init */
156 } DEVICE_INIT_TYPE, *PDEVICE_INIT_TYPE;
157
158 /* USB */
159
160 /*
161  * Enum of context types for SendPacket
162  */
163 typedef enum _CONTEXT_TYPE {
164     CONTEXT_DATA_PACKET = 1,
165     CONTEXT_MGMT_PACKET
166 } CONTEXT_TYPE;
167
168 /* RCB (Receive Control Block) */
169 typedef struct _RCB
170 {
171         void *Next;
172         signed long Ref;
173         void *pDevice;
174         struct urb *pUrb;
175         struct vnt_rx_mgmt sMngPacket;
176         struct sk_buff *skb;
177         int bBoolInUse;
178
179 } RCB, *PRCB;
180
181 /* used to track bulk out irps */
182 typedef struct _USB_SEND_CONTEXT {
183     void *pDevice;
184     struct sk_buff *pPacket;
185     struct urb      *pUrb;
186     unsigned int            uBufLen;
187     CONTEXT_TYPE    Type;
188     struct ethhdr sEthHeader;
189     void *Next;
190     bool            bBoolInUse;
191     unsigned char           Data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS];
192 } USB_SEND_CONTEXT, *PUSB_SEND_CONTEXT;
193
194 /* structure got from configuration file as user-desired default settings */
195 typedef struct _DEFAULT_CONFIG {
196         signed int    ZoneType;
197         signed int    eConfigMode;
198         signed int    eAuthenMode;        /* open/wep/wpa */
199         signed int    bShareKeyAlgorithm; /* open-open/{open,wep}-sharekey */
200         signed int    keyidx;             /* wepkey index */
201         signed int    eEncryptionStatus;
202 } DEFAULT_CONFIG, *PDEFAULT_CONFIG;
203
204 /*
205  * Structure to keep track of USB interrupt packets
206  */
207 typedef struct {
208     unsigned int            uDataLen;
209     u8 *           pDataBuf;
210   /* struct urb *pUrb; */
211     bool            bInUse;
212 } INT_BUFFER, *PINT_BUFFER;
213
214 /* 0:11A 1:11B 2:11G */
215 typedef enum _VIA_BB_TYPE
216 {
217     BB_TYPE_11A = 0,
218     BB_TYPE_11B,
219     BB_TYPE_11G
220 } VIA_BB_TYPE, *PVIA_BB_TYPE;
221
222 /* 0:11a, 1:11b, 2:11gb (only CCK in BasicRate), 3:11ga(OFDM in BasicRate) */
223 typedef enum _VIA_PKT_TYPE
224 {
225     PK_TYPE_11A = 0,
226     PK_TYPE_11B,
227     PK_TYPE_11GB,
228     PK_TYPE_11GA
229 } VIA_PKT_TYPE, *PVIA_PKT_TYPE;
230
231 /*++ NDIS related */
232
233 typedef enum __DEVICE_NDIS_STATUS {
234     STATUS_SUCCESS = 0,
235     STATUS_FAILURE,
236     STATUS_RESOURCES,
237     STATUS_PENDING,
238 } DEVICE_NDIS_STATUS, *PDEVICE_NDIS_STATUS;
239
240 #define MAX_BSSIDINFO_4_PMKID   16
241 #define MAX_PMKIDLIST           5
242 /* flags for PMKID Candidate list structure */
243 #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED     0x01
244
245 /* PMKID Structures */
246 typedef unsigned char   NDIS_802_11_PMKID_VALUE[16];
247
248 typedef enum _NDIS_802_11_WEP_STATUS
249 {
250     Ndis802_11WEPEnabled,
251     Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
252     Ndis802_11WEPDisabled,
253     Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
254     Ndis802_11WEPKeyAbsent,
255     Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
256     Ndis802_11WEPNotSupported,
257     Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
258     Ndis802_11Encryption2Enabled,
259     Ndis802_11Encryption2KeyAbsent,
260     Ndis802_11Encryption3Enabled,
261     Ndis802_11Encryption3KeyAbsent
262 } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
263   NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
264
265 typedef enum _NDIS_802_11_STATUS_TYPE
266 {
267         Ndis802_11StatusType_Authentication,
268         Ndis802_11StatusType_MediaStreamMode,
269         Ndis802_11StatusType_PMKID_CandidateList,
270         Ndis802_11StatusTypeMax, /* not a real type, defined as upper bound */
271 } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
272
273 /* added new types for PMKID Candidate lists */
274 typedef struct _PMKID_CANDIDATE {
275     NDIS_802_11_MAC_ADDRESS BSSID;
276     unsigned long Flags;
277 } PMKID_CANDIDATE, *PPMKID_CANDIDATE;
278
279 typedef struct _BSSID_INFO
280 {
281     NDIS_802_11_MAC_ADDRESS BSSID;
282     NDIS_802_11_PMKID_VALUE PMKID;
283 } BSSID_INFO, *PBSSID_INFO;
284
285 typedef struct tagSPMKID {
286     unsigned long Length;
287     unsigned long BSSIDInfoCount;
288     BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID];
289 } SPMKID, *PSPMKID;
290
291 typedef struct tagSPMKIDCandidateEvent {
292     NDIS_802_11_STATUS_TYPE     StatusType;
293         unsigned long Version;       /* Version of the structure */
294         unsigned long NumCandidates; /* No. of pmkid candidates */
295     PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST];
296 } SPMKIDCandidateEvent, *PSPMKIDCandidateEvent;
297
298 /*++ 802.11h related */
299 #define MAX_QUIET_COUNT     8
300
301 typedef struct tagSQuietControl {
302     bool        bEnable;
303     u32       dwStartTime;
304     u8        byPeriod;
305     u16        wDuration;
306 } SQuietControl, *PSQuietControl;
307
308 /* The receive duplicate detection cache entry */
309 typedef struct tagSCacheEntry{
310     u16        wFmSequence;
311     u8        abyAddr2[ETH_ALEN];
312     u16        wFrameCtl;
313 } SCacheEntry, *PSCacheEntry;
314
315 typedef struct tagSCache{
316 /* The receive cache is updated circularly.  The next entry to be written is
317  * indexed by the "InPtr".
318  */
319         unsigned int uInPtr; /* Place to use next */
320     SCacheEntry     asCacheEntry[DUPLICATE_RX_CACHE_LENGTH];
321 } SCache, *PSCache;
322
323 #define CB_MAX_RX_FRAG                 64
324 /*
325  * DeFragment Control Block, used for collecting fragments prior to reassembly
326  */
327 typedef struct tagSDeFragControlBlock
328 {
329     u16            wSequence;
330     u16            wFragNum;
331     u8            abyAddr2[ETH_ALEN];
332         unsigned int            uLifetime;
333     struct sk_buff* skb;
334     u8 *           pbyRxBuffer;
335     unsigned int            cbFrameLength;
336     bool            bInUse;
337 } SDeFragControlBlock, *PSDeFragControlBlock;
338
339 /* flags for options */
340 #define     DEVICE_FLAGS_UNPLUG          0x00000001UL
341 #define     DEVICE_FLAGS_PREAMBLE_TYPE   0x00000002UL
342 #define     DEVICE_FLAGS_OP_MODE         0x00000004UL
343 #define     DEVICE_FLAGS_PS_MODE         0x00000008UL
344 #define         DEVICE_FLAGS_80211h_MODE         0x00000010UL
345
346 /* flags for driver status */
347 #define     DEVICE_FLAGS_OPENED          0x00010000UL
348 #define     DEVICE_FLAGS_WOL_ENABLED     0x00080000UL
349 /* flags for capabilities */
350 #define     DEVICE_FLAGS_TX_ALIGN        0x01000000UL
351 #define     DEVICE_FLAGS_HAVE_CAM        0x02000000UL
352 #define     DEVICE_FLAGS_FLOW_CTRL       0x04000000UL
353
354 /* flags for MII status */
355 #define     DEVICE_LINK_FAIL             0x00000001UL
356 #define     DEVICE_SPEED_10              0x00000002UL
357 #define     DEVICE_SPEED_100             0x00000004UL
358 #define     DEVICE_SPEED_1000            0x00000008UL
359 #define     DEVICE_DUPLEX_FULL           0x00000010UL
360 #define     DEVICE_AUTONEG_ENABLE        0x00000020UL
361 #define     DEVICE_FORCED_BY_EEPROM      0x00000040UL
362 /* for device_set_media_duplex */
363 #define     DEVICE_LINK_CHANGE           0x00000001UL
364
365 typedef struct __device_opt {
366         int nRxDescs0;  /* number of RX descriptors 0 */
367         int nTxDescs0;  /* number of TX descriptors 0, 1, 2, 3 */
368         int rts_thresh; /* RTS threshold */
369     int         frag_thresh;
370     int         OpMode;
371     int         data_rate;
372     int         channel_num;
373     int         short_retry;
374     int         long_retry;
375     int         bbp_type;
376     u32         flags;
377 } OPTIONS, *POPTIONS;
378
379 struct vnt_private {
380         /* netdev */
381         struct usb_device *usb;
382         struct net_device *dev;
383         struct net_device_stats stats;
384
385         OPTIONS sOpts;
386
387         struct tasklet_struct CmdWorkItem;
388         struct tasklet_struct EventWorkItem;
389         struct tasklet_struct ReadWorkItem;
390         struct tasklet_struct RxMngWorkItem;
391
392         u32 rx_buf_sz;
393         int multicast_limit;
394         u8 byRxMode;
395
396         spinlock_t lock;
397
398         u32 rx_bytes;
399
400         u8 byRevId;
401
402         u32 flags;
403         unsigned long Flags;
404
405         SCache sDupRxCache;
406
407         SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG];
408         u32 cbDFCB;
409         u32 cbFreeDFCB;
410         u32 uCurrentDFCBIdx;
411
412         /* USB */
413         struct urb *pControlURB;
414         struct urb *pInterruptURB;
415         struct usb_ctrlrequest sUsbCtlRequest;
416         u32 int_interval;
417
418         /* Variables to track resources for the BULK In Pipe */
419         PRCB pRCBMem;
420         PRCB apRCB[CB_MAX_RX_DESC];
421         u32 cbRD;
422         PRCB FirstRecvFreeList;
423         PRCB LastRecvFreeList;
424         u32 NumRecvFreeList;
425         PRCB FirstRecvMngList;
426         PRCB LastRecvMngList;
427         u32 NumRecvMngList;
428         int bIsRxWorkItemQueued;
429         int bIsRxMngWorkItemQueued;
430         unsigned long ulRcvRefCount; /* packets that have not returned back */
431
432         /* Variables to track resources for the BULK Out Pipe */
433         PUSB_SEND_CONTEXT apTD[CB_MAX_TX_DESC];
434         u32 cbTD;
435
436         /* Variables to track resources for the Interrupt In Pipe */
437         INT_BUFFER intBuf;
438         int fKillEventPollingThread;
439         int bEventAvailable;
440
441         /* default config from file by user setting */
442         DEFAULT_CONFIG config_file;
443
444         /* Statistic for USB */
445         unsigned long ulBulkInPosted;
446         unsigned long ulBulkInError;
447         unsigned long ulBulkInContCRCError;
448         unsigned long ulBulkInBytesRead;
449
450         unsigned long ulBulkOutPosted;
451         unsigned long ulBulkOutError;
452         unsigned long ulBulkOutContCRCError;
453         unsigned long ulBulkOutBytesWrite;
454
455         unsigned long ulIntInPosted;
456         unsigned long ulIntInError;
457         unsigned long ulIntInContCRCError;
458         unsigned long ulIntInBytesRead;
459
460         /* Version control */
461         u16 wFirmwareVersion;
462         u8 byLocalID;
463         u8 byRFType;
464         u8 byBBRxConf;
465
466         u8 byZoneType;
467         int bZoneRegExist;
468
469         u8 byOriginalZonetype;
470
471         int bLinkPass; /* link status: OK or fail */
472         u8 abyCurrentNetAddr[ETH_ALEN];
473         u8 abyPermanentNetAddr[ETH_ALEN];
474
475         int bExistSWNetAddr;
476
477         /* Adapter statistics */
478         SStatCounter scStatistic;
479         /* 802.11 counter */
480         SDot11Counters s802_11Counter;
481
482         /* Maintain statistical debug info. */
483         unsigned long packetsReceived;
484         unsigned long packetsReceivedDropped;
485         unsigned long packetsReceivedOverflow;
486         unsigned long packetsSent;
487         unsigned long packetsSentDropped;
488         unsigned long SendContextsInUse;
489         unsigned long RcvBuffersInUse;
490
491         /* 802.11 management */
492         struct vnt_manager vnt_mgmt;
493
494         u64 qwCurrTSF;
495         u32 cbBulkInMax;
496         int bPSRxBeacon;
497
498         /* 802.11 MAC specific */
499         u32 uCurrRSSI;
500         u8 byCurrSQ;
501
502         /* Antenna Diversity */
503         int bTxRxAntInv;
504         u32 dwRxAntennaSel;
505         u32 dwTxAntennaSel;
506         u8 byAntennaCount;
507         u8 byRxAntennaMode;
508         u8 byTxAntennaMode;
509         u8 byRadioCtl;
510         u8 bHWRadioOff;
511
512         /* SQ3 functions for antenna diversity */
513         struct timer_list TimerSQ3Tmax1;
514         struct timer_list TimerSQ3Tmax2;
515         struct timer_list TimerSQ3Tmax3;
516
517         int bDiversityRegCtlON;
518         int bDiversityEnable;
519         unsigned long ulDiversityNValue;
520         unsigned long ulDiversityMValue;
521         u8 byTMax;
522         u8 byTMax2;
523         u8 byTMax3;
524         unsigned long ulSQ3TH;
525
526         unsigned long uDiversityCnt;
527         u8 byAntennaState;
528         unsigned long ulRatio_State0;
529         unsigned long ulRatio_State1;
530         unsigned long ulSQ3_State0;
531         unsigned long ulSQ3_State1;
532
533         unsigned long aulSQ3Val[MAX_RATE];
534         unsigned long aulPktNum[MAX_RATE];
535
536         /* IFS & Cw */
537         u32 uSIFS;  /* Current SIFS */
538         u32 uDIFS;  /* Current DIFS */
539         u32 uEIFS;  /* Current EIFS */
540         u32 uSlot;  /* Current SlotTime */
541         u32 uCwMin; /* Current CwMin */
542         u32 uCwMax; /* CwMax is fixed on 1023 */
543
544         /* PHY parameter */
545         u8  bySIFS;
546         u8  byDIFS;
547         u8  byEIFS;
548         u8  bySlot;
549         u8  byCWMaxMin;
550
551         /* Rate */
552         VIA_BB_TYPE byBBType; /* 0: 11A, 1:11B, 2:11G */
553         VIA_PKT_TYPE byPacketType; /* 0:11a 1:11b 2:11gb 3:11ga */
554         u16 wBasicRate;
555         u8 byACKRate;
556         u8 byTopOFDMBasicRate;
557         u8 byTopCCKBasicRate;
558
559         u32 dwAotoRateTxOkCnt;
560         u32 dwAotoRateTxFailCnt;
561         u32 dwErrorRateThreshold[13];
562         u32 dwTPTable[MAX_RATE];
563         u8 abyEEPROM[EEP_MAX_CONTEXT_SIZE];  /*u32 alignment */
564
565         u8 byMinChannel;
566         u8 byMaxChannel;
567         u32 uConnectionRate;
568
569         u8 byPreambleType;
570         u8 byShortPreamble;
571         /* CARD_PHY_TYPE */
572         u8 eConfigPHYMode;
573
574         /* For RF Power table */
575         u8 byCCKPwr;
576         u8 byOFDMPwrG;
577         u8 byOFDMPwrA;
578         u8 byCurPwr;
579         u8 abyCCKPwrTbl[14];
580         u8 abyOFDMPwrTbl[14];
581         u8 abyOFDMAPwrTbl[42];
582
583         u16 wCurrentRate;
584         u16 wRTSThreshold;
585         u16 wFragmentationThreshold;
586         u8 byShortRetryLimit;
587         u8 byLongRetryLimit;
588         CARD_OP_MODE eOPMode;
589         int bBSSIDFilter;
590         u16 wMaxTransmitMSDULifetime;
591         u8 abyBSSID[ETH_ALEN];
592         u8 abyDesireBSSID[ETH_ALEN];
593
594         u16 wCTSDuration;       /* update while speed change */
595         u16 wACKDuration;
596         u16 wRTSTransmitLen;
597         u8 byRTSServiceField;
598         u8 byRTSSignalField;
599
600         u32 dwMaxReceiveLifetime;  /* dot11MaxReceiveLifetime */
601
602         int bCCK;
603         int bEncryptionEnable;
604         int bLongHeader;
605         int bSoftwareGenCrcErr;
606         int bShortSlotTime;
607         int bProtectMode;
608         int bNonERPPresent;
609         int bBarkerPreambleMd;
610
611         u8 byERPFlag;
612         u16 wUseProtectCntDown;
613
614         int bRadioControlOff;
615         int bRadioOff;
616
617         /* Power save */
618         int bEnablePSMode;
619         u16 wListenInterval;
620         int bPWBitOn;
621         WMAC_POWER_MODE ePSMode;
622         unsigned long ulPSModeWaitTx;
623         int bPSModeTxBurst;
624
625         /* Beacon releated */
626         u16 wSeqCounter;
627         int bBeaconBufReady;
628         int bBeaconSent;
629         int bFixRate;
630         u8 byCurrentCh;
631         u32 uScanTime;
632
633         CMD_STATE eCommandState;
634
635         CMD_CODE eCommand;
636         int bBeaconTx;
637         u8 byScanBBType;
638
639         int bStopBeacon;
640         int bStopDataPkt;
641         int bStopTx0Pkt;
642         u32 uAutoReConnectTime;
643         u32 uIsroamingTime;
644
645         /* 802.11 counter */
646
647         CMD_ITEM eCmdQueue[CMD_Q_SIZE];
648         u32 uCmdDequeueIdx;
649         u32 uCmdEnqueueIdx;
650         u32 cbFreeCmdQueue;
651         int bCmdRunning;
652         int bCmdClear;
653         int bNeedRadioOFF;
654
655         int bEnableRoaming;
656         int bIsRoaming;
657         int bFastRoaming;
658         u8 bSameBSSMaxNum;
659         u8 bSameBSSCurNum;
660         int bRoaming;
661         int b11hEable;
662         unsigned long ulTxPower;
663
664         /* Encryption */
665         NDIS_802_11_WEP_STATUS eEncryptionStatus;
666         int  bTransmitKey;
667         NDIS_802_11_WEP_STATUS eOldEncryptionStatus;
668         SKeyManagement sKey;
669         u32 dwIVCounter;
670
671         RC4Ext SBox;
672         u8 abyPRNG[WLAN_WEPMAX_KEYLEN+3];
673         u8 byKeyIndex;
674
675         int bAES;
676
677         u32 uKeyLength;
678         u8 abyKey[WLAN_WEP232_KEYLEN];
679
680         /* for AP mode */
681         u32 uAssocCount;
682         int bMoreData;
683
684         /* QoS */
685         int bGrpAckPolicy;
686
687         u8 byAutoFBCtrl;
688
689         int bTxMICFail;
690         int bRxMICFail;
691
692         /* For Update BaseBand VGA Gain Offset */
693         int bUpdateBBVGA;
694         u32 uBBVGADiffCount;
695         u8 byBBVGANew;
696         u8 byBBVGACurrent;
697         u8 abyBBVGA[BB_VGA_LEVEL];
698         signed long ldBmThreshold[BB_VGA_LEVEL];
699
700         u8 byBBPreEDRSSI;
701         u8 byBBPreEDIndex;
702
703         int bRadioCmd;
704         u32 dwDiagRefCount;
705
706         /* For FOE Tuning */
707         u8  byFOETuning;
708
709         /* For Auto Power Tunning */
710         u8  byAutoPwrTunning;
711
712         /* BaseBand Loopback Use */
713         u8 byBBCR4d;
714         u8 byBBCRc9;
715         u8 byBBCR88;
716         u8 byBBCR09;
717
718         /* command timer */
719         struct timer_list sTimerCommand;
720
721         struct timer_list sTimerTxData;
722         unsigned long nTxDataTimeCout;
723         int fTxDataInSleep;
724         int IsTxDataTrigger;
725
726         int fWPA_Authened; /*is WPA/WPA-PSK or WPA2/WPA2-PSK authen?? */
727         u8 byReAssocCount;
728         u8 byLinkWaitCount;
729
730         struct ethhdr sTxEthHeader;
731         struct ethhdr sRxEthHeader;
732         u8 abyBroadcastAddr[ETH_ALEN];
733         u8 abySNAP_RFC1042[ETH_ALEN];
734         u8 abySNAP_Bridgetunnel[ETH_ALEN];
735
736         /* Pre-Authentication & PMK cache */
737         SPMKID gsPMKID;
738         SPMKIDCandidateEvent gsPMKIDCandidate;
739
740         /* for 802.11h */
741         int b11hEnable;
742
743         int bChannelSwitch;
744         u8 byNewChannel;
745         u8 byChannelSwitchCount;
746
747         /* WPA supplicant daemon */
748         int bWPADEVUp;
749         int bwextstep0;
750         int bwextstep1;
751         int bwextstep2;
752         int bwextstep3;
753         int bWPASuppWextEnabled;
754
755         /* user space daemon: hostapd, is used for HOSTAP */
756         int bEnableHostapd;
757         int bEnable8021x;
758         int bEnableHostWEP;
759         struct net_device *apdev;
760         int (*tx_80211)(struct sk_buff *skb, struct net_device *dev);
761
762         u32 uChannel;
763
764         struct iw_statistics wstats; /* wireless stats */
765
766         int bCommit;
767
768 };
769
770 #define EnqueueRCB(_Head, _Tail, _RCB)                  \
771 {                                                       \
772     if (!_Head) {                                       \
773         _Head = _RCB;                                   \
774     }                                                   \
775     else {                                              \
776         _Tail->Next = _RCB;                             \
777     }                                                   \
778     _RCB->Next = NULL;                                  \
779     _Tail = _RCB;                                       \
780 }
781
782 #define DequeueRCB(Head, Tail)                          \
783 {                                                       \
784     PRCB   RCB = Head;                                  \
785     if (!RCB->Next) {                                   \
786         Tail = NULL;                                    \
787     }                                                   \
788     Head = RCB->Next;                                   \
789 }
790
791 #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) {   \
792     if ((uVar) >= ((uModulo) - 1))                  \
793         (uVar) = 0;                                 \
794     else                                            \
795         (uVar)++;                                   \
796 }
797
798 #define fMP_RESET_IN_PROGRESS               0x00000001
799 #define fMP_DISCONNECTED                    0x00000002
800 #define fMP_HALT_IN_PROGRESS                0x00000004
801 #define fMP_SURPRISE_REMOVED                0x00000008
802 #define fMP_RECV_LOOKASIDE                  0x00000010
803 #define fMP_INIT_IN_PROGRESS                0x00000020
804 #define fMP_SEND_SIDE_RESOURCE_ALLOCATED    0x00000040
805 #define fMP_RECV_SIDE_RESOURCE_ALLOCATED    0x00000080
806 #define fMP_POST_READS                      0x00000100
807 #define fMP_POST_WRITES                     0x00000200
808 #define fMP_CONTROL_READS                   0x00000400
809 #define fMP_CONTROL_WRITES                  0x00000800
810
811 #define MP_SET_FLAG(_M, _F)             ((_M)->Flags |= (_F))
812 #define MP_CLEAR_FLAG(_M, _F)            ((_M)->Flags &= ~(_F))
813 #define MP_TEST_FLAGS(_M, _F)            (((_M)->Flags & (_F)) == (_F))
814
815 #define MP_IS_READY(_M)        (((_M)->Flags & \
816                                  (fMP_DISCONNECTED | fMP_RESET_IN_PROGRESS | fMP_HALT_IN_PROGRESS | fMP_INIT_IN_PROGRESS | fMP_SURPRISE_REMOVED)) == 0)
817
818 int device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF);
819
820 #endif