]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/staging/vt6655/device.h
e1a322fa9c024a83a5e27823238cccf242055af1
[karo-tx-linux.git] / drivers / staging / vt6655 / 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/types.h>
34 #include <linux/mm.h>
35 #include <linux/errno.h>
36 #include <linux/ioport.h>
37 #include <linux/pci.h>
38 #include <linux/kernel.h>
39 #include <linux/netdevice.h>
40 #include <linux/etherdevice.h>
41 #include <linux/skbuff.h>
42 #include <linux/delay.h>
43 #include <linux/timer.h>
44 #include <linux/slab.h>
45 #include <linux/interrupt.h>
46 #include <linux/string.h>
47 #include <linux/wait.h>
48 #include <linux/if_arp.h>
49 #include <linux/sched.h>
50 #include <linux/io.h>
51 #include <linux/if.h>
52 //#include <linux/config.h>
53 #include <linux/uaccess.h>
54 #include <linux/proc_fs.h>
55 #include <linux/inetdevice.h>
56 #include <linux/reboot.h>
57 #ifdef SIOCETHTOOL
58 #define DEVICE_ETHTOOL_IOCTL_SUPPORT
59 #include <linux/ethtool.h>
60 #else
61 #undef DEVICE_ETHTOOL_IOCTL_SUPPORT
62 #endif
63 /* Include Wireless Extension definition and check version - Jean II */
64 #include <linux/wireless.h>
65 #include <net/iw_handler.h>     // New driver API
66
67 //2008-0409-07, <Add> by Einsn Liu
68 #ifndef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
69 #define WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
70 #endif
71
72 //
73 // device specific
74 //
75
76 #include "device_cfg.h"
77 #include "ttype.h"
78 #include "80211hdr.h"
79 #include "tether.h"
80 #include "wmgr.h"
81 #include "wcmd.h"
82 #include "mib.h"
83 #include "srom.h"
84 #include "rc4.h"
85 #include "desc.h"
86 #include "key.h"
87 #include "mac.h"
88
89 /*---------------------  Export Definitions -------------------------*/
90
91 #define MAC_MAX_CONTEXT_REG     (256+128)
92
93 #define MAX_MULTICAST_ADDRESS_NUM       32
94 #define MULTICAST_ADDRESS_LIST_SIZE     (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN)
95
96 #define DUPLICATE_RX_CACHE_LENGTH       5
97
98 #define NUM_KEY_ENTRY                   11
99
100 #define TX_WEP_NONE                     0
101 #define TX_WEP_OTF                      1
102 #define TX_WEP_SW                       2
103 #define TX_WEP_SWOTP                    3
104 #define TX_WEP_OTPSW                    4
105 #define TX_WEP_SW232                    5
106
107 #define KEYSEL_WEP40                    0
108 #define KEYSEL_WEP104                   1
109 #define KEYSEL_TKIP                     2
110 #define KEYSEL_CCMP                     3
111
112 #define AUTO_FB_NONE            0
113 #define AUTO_FB_0               1
114 #define AUTO_FB_1               2
115
116 #define FB_RATE0                0
117 #define FB_RATE1                1
118
119 // Antenna Mode
120 #define ANT_A                   0
121 #define ANT_B                   1
122 #define ANT_DIVERSITY           2
123 #define ANT_RXD_TXA             3
124 #define ANT_RXD_TXB             4
125 #define ANT_UNKNOWN             0xFF
126
127 #define MAXCHECKHANGCNT         4
128
129 #define BB_VGA_LEVEL            4
130 #define BB_VGA_CHANGE_THRESHOLD 16
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 // BUILD OBJ mode
140
141 #define AVAIL_TD(p, q)  ((p)->sOpts.nTxDescs[(q)] - ((p)->iTDUsed[(q)]))
142
143 //PLICE_DEBUG ->
144 #define NUM                             64
145 //PLICE_DEUBG <-
146
147 #define PRIVATE_Message                 0
148
149 /*---------------------  Export Types  ------------------------------*/
150
151 #define DBG_PRT(l, p, args...)          \
152 do {                                    \
153         if (l <= msglevel)              \
154                 printk(p, ##args);      \
155 } while (0)
156
157 #define PRINT_K(p, args...)             \
158 do {                                    \
159         if (PRIVATE_Message)            \
160                 printk(p, ##args);      \
161 } while (0)
162
163 //0:11A 1:11B 2:11G
164 typedef enum _VIA_BB_TYPE
165 {
166         BB_TYPE_11A = 0,
167         BB_TYPE_11B,
168         BB_TYPE_11G
169 } VIA_BB_TYPE, *PVIA_BB_TYPE;
170
171 //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
172 typedef enum _VIA_PKT_TYPE
173 {
174         PK_TYPE_11A = 0,
175         PK_TYPE_11B,
176         PK_TYPE_11GB,
177         PK_TYPE_11GA
178 } VIA_PKT_TYPE, *PVIA_PKT_TYPE;
179
180 typedef enum __device_msg_level {
181         MSG_LEVEL_ERR = 0,            //Errors that will cause abnormal operation.
182         MSG_LEVEL_NOTICE = 1,         //Some errors need users to be notified.
183         MSG_LEVEL_INFO = 2,           //Normal message.
184         MSG_LEVEL_VERBOSE = 3,        //Will report all trival errors.
185         MSG_LEVEL_DEBUG = 4           //Only for debug purpose.
186 } DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL;
187
188 //++ NDIS related
189
190 #define MAX_BSSIDINFO_4_PMKID   16
191 #define MAX_PMKIDLIST           5
192 //Flags for PMKID Candidate list structure
193 #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED     0x01
194
195 // PMKID Structures
196 typedef unsigned char NDIS_802_11_PMKID_VALUE[16];
197
198 typedef enum _NDIS_802_11_WEP_STATUS {
199         Ndis802_11WEPEnabled,
200         Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
201         Ndis802_11WEPDisabled,
202         Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
203         Ndis802_11WEPKeyAbsent,
204         Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
205         Ndis802_11WEPNotSupported,
206         Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
207         Ndis802_11Encryption2Enabled,
208         Ndis802_11Encryption2KeyAbsent,
209         Ndis802_11Encryption3Enabled,
210         Ndis802_11Encryption3KeyAbsent
211 } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
212         NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
213
214 typedef enum _NDIS_802_11_STATUS_TYPE {
215         Ndis802_11StatusType_Authentication,
216         Ndis802_11StatusType_MediaStreamMode,
217         Ndis802_11StatusType_PMKID_CandidateList,
218         Ndis802_11StatusTypeMax    // not a real type, defined as an upper bound
219 } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
220
221 //Added new types for PMKID Candidate lists.
222 struct pmkid_candidate {
223         NDIS_802_11_MAC_ADDRESS BSSID;
224         unsigned long Flags;
225 };
226
227 typedef struct _BSSID_INFO {
228         NDIS_802_11_MAC_ADDRESS BSSID;
229         NDIS_802_11_PMKID_VALUE PMKID;
230 } BSSID_INFO, *PBSSID_INFO;
231
232 typedef struct tagSPMKID {
233         unsigned long Length;
234         unsigned long BSSIDInfoCount;
235         BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID];
236 } SPMKID, *PSPMKID;
237
238 typedef struct tagSPMKIDCandidateEvent {
239         NDIS_802_11_STATUS_TYPE     StatusType;
240         unsigned long Version;       // Version of the structure
241         unsigned long NumCandidates; // No. of pmkid candidates
242         struct pmkid_candidate CandidateList[MAX_PMKIDLIST];
243 } SPMKIDCandidateEvent, *PSPMKIDCandidateEvent;
244
245 //--
246
247 //++ 802.11h related
248 #define MAX_QUIET_COUNT     8
249
250 typedef struct tagSQuietControl {
251         bool bEnable;
252         unsigned long dwStartTime;
253         unsigned char byPeriod;
254         unsigned short wDuration;
255 } SQuietControl, *PSQuietControl;
256
257 //--
258 typedef struct __chip_info_tbl {
259         CHIP_TYPE   chip_id;
260         char *name;
261         int         io_size;
262         int         nTxQueue;
263         u32         flags;
264 } CHIP_INFO, *PCHIP_INFO;
265
266 typedef enum {
267         OWNED_BY_HOST = 0,
268         OWNED_BY_NIC = 1
269 } DEVICE_OWNER_TYPE, *PDEVICE_OWNER_TYPE;
270
271 // The receive duplicate detection cache entry
272 typedef struct tagSCacheEntry {
273         unsigned short wFmSequence;
274         unsigned char abyAddr2[ETH_ALEN];
275 } SCacheEntry, *PSCacheEntry;
276
277 typedef struct tagSCache {
278 /* The receive cache is updated circularly.  The next entry to be written is
279  * indexed by the "InPtr".
280  */
281         unsigned int uInPtr;         // Place to use next
282         SCacheEntry     asCacheEntry[DUPLICATE_RX_CACHE_LENGTH];
283 } SCache, *PSCache;
284
285 #define CB_MAX_RX_FRAG                 64
286 // DeFragment Control Block, used for collecting fragments prior to reassembly
287 typedef struct tagSDeFragControlBlock {
288         unsigned short wSequence;
289         unsigned short wFragNum;
290         unsigned char abyAddr2[ETH_ALEN];
291         unsigned int uLifetime;
292         struct sk_buff *skb;
293         unsigned char *pbyRxBuffer;
294         unsigned int cbFrameLength;
295         bool bInUse;
296 } SDeFragControlBlock, *PSDeFragControlBlock;
297
298 //flags for options
299 #define     DEVICE_FLAGS_IP_ALIGN        0x00000001UL
300 #define     DEVICE_FLAGS_PREAMBLE_TYPE   0x00000002UL
301 #define     DEVICE_FLAGS_OP_MODE         0x00000004UL
302 #define     DEVICE_FLAGS_PS_MODE         0x00000008UL
303 #define         DEVICE_FLAGS_80211h_MODE         0x00000010UL
304 #define         DEVICE_FLAGS_DiversityANT        0x00000020UL
305
306 //flags for driver status
307 #define     DEVICE_FLAGS_OPENED          0x00010000UL
308 #define     DEVICE_FLAGS_WOL_ENABLED     0x00080000UL
309 //flags for capabilities
310 #define     DEVICE_FLAGS_TX_ALIGN        0x01000000UL
311 #define     DEVICE_FLAGS_HAVE_CAM        0x02000000UL
312 #define     DEVICE_FLAGS_FLOW_CTRL       0x04000000UL
313
314 //flags for MII status
315 #define     DEVICE_LINK_FAIL             0x00000001UL
316 #define     DEVICE_SPEED_10              0x00000002UL
317 #define     DEVICE_SPEED_100             0x00000004UL
318 #define     DEVICE_SPEED_1000            0x00000008UL
319 #define     DEVICE_DUPLEX_FULL           0x00000010UL
320 #define     DEVICE_AUTONEG_ENABLE        0x00000020UL
321 #define     DEVICE_FORCED_BY_EEPROM      0x00000040UL
322 //for device_set_media_duplex
323 #define     DEVICE_LINK_CHANGE           0x00000001UL
324
325 typedef struct __device_opt {
326         int         nRxDescs0;    //Number of RX descriptors0
327         int         nRxDescs1;    //Number of RX descriptors1
328         int         nTxDescs[2];  //Number of TX descriptors 0, 1
329         int         int_works;    //interrupt limits
330         int         rts_thresh;   //rts threshold
331         int         frag_thresh;
332         int         data_rate;
333         int         channel_num;
334         int         short_retry;
335         int         long_retry;
336         int         bbp_type;
337         u32         flags;
338 } OPTIONS, *POPTIONS;
339
340 struct vnt_private {
341         struct vnt_private *next;
342         struct vnt_private *prev;
343
344         struct pci_dev *pcid;
345
346 #ifdef CONFIG_PM
347         u32                         pci_state[16];
348 #endif
349
350 // netdev
351         struct net_device *dev;
352         struct net_device *next_module;
353         struct net_device_stats     stats;
354
355 //dma addr, rx/tx pool
356         dma_addr_t                  pool_dma;
357         dma_addr_t                  rd0_pool_dma;
358         dma_addr_t                  rd1_pool_dma;
359
360         dma_addr_t                  td0_pool_dma;
361         dma_addr_t                  td1_pool_dma;
362
363         dma_addr_t                  tx_bufs_dma0;
364         dma_addr_t                  tx_bufs_dma1;
365         dma_addr_t                  tx_beacon_dma;
366
367         unsigned char *tx0_bufs;
368         unsigned char *tx1_bufs;
369         unsigned char *tx_beacon_bufs;
370
371         CHIP_TYPE                   chip_id;
372
373         void __iomem                *PortOffset;
374         unsigned long dwIsr;
375         u32                         memaddr;
376         u32                         ioaddr;
377         u32                         io_size;
378
379         unsigned char byRevId;
380         unsigned short SubSystemID;
381         unsigned short SubVendorID;
382
383         int                         nTxQueues;
384         volatile int                iTDUsed[TYPE_MAXTD];
385
386         volatile PSTxDesc           apCurrTD[TYPE_MAXTD];
387         volatile PSTxDesc           apTailTD[TYPE_MAXTD];
388
389         volatile PSTxDesc           apTD0Rings;
390         volatile PSTxDesc           apTD1Rings;
391
392         volatile PSRxDesc           aRD0Ring;
393         volatile PSRxDesc           aRD1Ring;
394         volatile PSRxDesc           pCurrRD[TYPE_MAXRD];
395         SCache                      sDupRxCache;
396
397         SDeFragControlBlock         sRxDFCB[CB_MAX_RX_FRAG];
398         unsigned int    cbDFCB;
399         unsigned int    cbFreeDFCB;
400         unsigned int    uCurrentDFCBIdx;
401
402         OPTIONS                     sOpts;
403
404         u32                         flags;
405
406         u32                         rx_buf_sz;
407         int                         multicast_limit;
408         unsigned char byRxMode;
409
410         spinlock_t                  lock;
411
412 //PLICE_DEBUG ->
413         pid_t                   MLMEThr_pid;
414         struct completion       notify;
415         struct semaphore        mlme_semaphore;
416 //PLICE_DEBUG <-
417
418         u32                         rx_bytes;
419
420         // Version control
421         unsigned char byLocalID;
422         unsigned char byRFType;
423
424         unsigned char byMaxPwrLevel;
425         unsigned char byZoneType;
426         bool bZoneRegExist;
427         unsigned char byOriginalZonetype;
428         unsigned char abyMacContext[MAC_MAX_CONTEXT_REG];
429         bool bLinkPass;          // link status: OK or fail
430         unsigned char abyCurrentNetAddr[ETH_ALEN];
431
432         // Adapter statistics
433         SStatCounter                scStatistic;
434         // 802.11 counter
435         SDot11Counters              s802_11Counter;
436
437         // 802.11 management
438         PSMgmtObject                pMgmt;
439         SMgmtObject                 sMgmtObj;
440
441         // 802.11 MAC specific
442         unsigned int    uCurrRSSI;
443         unsigned char byCurrSQ;
444
445         unsigned long dwTxAntennaSel;
446         unsigned long dwRxAntennaSel;
447         unsigned char byAntennaCount;
448         unsigned char byRxAntennaMode;
449         unsigned char byTxAntennaMode;
450         bool bTxRxAntInv;
451
452         unsigned char *pbyTmpBuff;
453         unsigned int    uSIFS;    //Current SIFS
454         unsigned int    uDIFS;    //Current DIFS
455         unsigned int    uEIFS;    //Current EIFS
456         unsigned int    uSlot;    //Current SlotTime
457         unsigned int    uCwMin;   //Current CwMin
458         unsigned int    uCwMax;   //CwMax is fixed on 1023.
459         // PHY parameter
460         unsigned char bySIFS;
461         unsigned char byDIFS;
462         unsigned char byEIFS;
463         unsigned char bySlot;
464         unsigned char byCWMaxMin;
465         CARD_PHY_TYPE               eCurrentPHYType;
466
467         VIA_BB_TYPE                 byBBType; //0: 11A, 1:11B, 2:11G
468         VIA_PKT_TYPE                byPacketType; //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
469         unsigned short wBasicRate;
470         unsigned char byACKRate;
471         unsigned char byTopOFDMBasicRate;
472         unsigned char byTopCCKBasicRate;
473
474         unsigned char byMinChannel;
475         unsigned char byMaxChannel;
476         unsigned int    uConnectionRate;
477
478         unsigned char byPreambleType;
479         unsigned char byShortPreamble;
480
481         unsigned short wCurrentRate;
482         unsigned short wRTSThreshold;
483         unsigned short wFragmentationThreshold;
484         unsigned char byShortRetryLimit;
485         unsigned char byLongRetryLimit;
486         CARD_OP_MODE                eOPMode;
487         unsigned char byOpMode;
488         bool bBSSIDFilter;
489         unsigned short wMaxTransmitMSDULifetime;
490         unsigned char abyBSSID[ETH_ALEN];
491         unsigned char abyDesireBSSID[ETH_ALEN];
492         unsigned short wCTSDuration;       // update while speed change
493         unsigned short wACKDuration;       // update while speed change
494         unsigned short wRTSTransmitLen;    // update while speed change
495         unsigned char byRTSServiceField;  // update while speed change
496         unsigned char byRTSSignalField;   // update while speed change
497
498         unsigned long dwMaxReceiveLifetime;       // dot11MaxReceiveLifetime
499
500         bool bCCK;
501         bool bEncryptionEnable;
502         bool bLongHeader;
503         bool bShortSlotTime;
504         bool bProtectMode;
505         bool bNonERPPresent;
506         bool bBarkerPreambleMd;
507
508         unsigned char byERPFlag;
509         unsigned short wUseProtectCntDown;
510
511         bool bRadioControlOff;
512         bool bRadioOff;
513         bool bEnablePSMode;
514         unsigned short wListenInterval;
515         bool bPWBitOn;
516         WMAC_POWER_MODE         ePSMode;
517
518         // GPIO Radio Control
519         unsigned char byRadioCtl;
520         unsigned char byGPIO;
521         bool bHWRadioOff;
522         bool bPrvActive4RadioOFF;
523         bool bGPIOBlockRead;
524
525         // Beacon related
526         unsigned short wSeqCounter;
527         unsigned short wBCNBufLen;
528         bool bBeaconBufReady;
529         bool bBeaconSent;
530         bool bIsBeaconBufReadySet;
531         unsigned int    cbBeaconBufReadySetCnt;
532         bool bFixRate;
533         unsigned char byCurrentCh;
534         unsigned int    uScanTime;
535
536         CMD_STATE               eCommandState;
537
538         CMD_CODE                eCommand;
539         bool bBeaconTx;
540
541         bool bStopBeacon;
542         bool bStopDataPkt;
543         bool bStopTx0Pkt;
544         unsigned int    uAutoReConnectTime;
545
546         // 802.11 counter
547
548         CMD_ITEM                eCmdQueue[CMD_Q_SIZE];
549         unsigned int    uCmdDequeueIdx;
550         unsigned int    uCmdEnqueueIdx;
551         unsigned int    cbFreeCmdQueue;
552         bool bCmdRunning;
553         bool bCmdClear;
554
555         bool bRoaming;
556         //WOW
557         unsigned char abyIPAddr[4];
558
559         unsigned long ulTxPower;
560         NDIS_802_11_WEP_STATUS  eEncryptionStatus;
561         bool bTransmitKey;
562 //2007-0925-01<Add>by MikeLiu
563 //mike add :save old Encryption
564         NDIS_802_11_WEP_STATUS  eOldEncryptionStatus;
565
566         SKeyManagement          sKey;
567         unsigned long dwIVCounter;
568
569         u64 qwPacketNumber; /* For CCMP and TKIP as TSC(6 bytes) */
570         unsigned int    uCurrentWEPMode;
571
572         RC4Ext                  SBox;
573         unsigned char abyPRNG[WLAN_WEPMAX_KEYLEN+3];
574         unsigned char byKeyIndex;
575         unsigned int    uKeyLength;
576         unsigned char abyKey[WLAN_WEP232_KEYLEN];
577
578         bool bAES;
579         unsigned char byCntMeasure;
580
581         // for AP mode
582         unsigned int    uAssocCount;
583         bool bMoreData;
584
585         // QoS
586         bool bGrpAckPolicy;
587
588         // for OID_802_11_ASSOCIATION_INFORMATION
589         bool bAssocInfoSet;
590
591         unsigned char byAutoFBCtrl;
592
593         bool bTxMICFail;
594         bool bRxMICFail;
595
596         unsigned int    uRATEIdx;
597
598         // For Update BaseBand VGA Gain Offset
599         bool bUpdateBBVGA;
600         unsigned int    uBBVGADiffCount;
601         unsigned char byBBVGANew;
602         unsigned char byBBVGACurrent;
603         unsigned char abyBBVGA[BB_VGA_LEVEL];
604         long                    ldBmThreshold[BB_VGA_LEVEL];
605
606         unsigned char byBBPreEDRSSI;
607         unsigned char byBBPreEDIndex;
608
609         bool bRadioCmd;
610         unsigned long dwDiagRefCount;
611
612         // For FOE Tuning
613         unsigned char byFOETuning;
614
615         // For Auto Power Tunning
616
617         unsigned char byAutoPwrTunning;
618         short                   sPSetPointCCK;
619         short                   sPSetPointOFDMG;
620         short                   sPSetPointOFDMA;
621         long                    lPFormulaOffset;
622         short                   sPThreshold;
623         char                    cAdjustStep;
624         char                    cMinTxAGC;
625
626         // For RF Power table
627         unsigned char byCCKPwr;
628         unsigned char byOFDMPwrG;
629         unsigned char byCurPwr;
630         char     byCurPwrdBm;
631         unsigned char abyCCKPwrTbl[CB_MAX_CHANNEL_24G+1];
632         unsigned char abyOFDMPwrTbl[CB_MAX_CHANNEL+1];
633         char    abyCCKDefaultPwr[CB_MAX_CHANNEL_24G+1];
634         char    abyOFDMDefaultPwr[CB_MAX_CHANNEL+1];
635         char    abyRegPwr[CB_MAX_CHANNEL+1];
636         char    abyLocalPwr[CB_MAX_CHANNEL+1];
637
638         // BaseBand Loopback Use
639         unsigned char byBBCR4d;
640         unsigned char byBBCRc9;
641         unsigned char byBBCR88;
642         unsigned char byBBCR09;
643
644         // command timer
645         struct timer_list       sTimerCommand;
646         struct timer_list       sTimerTxData;
647         unsigned long nTxDataTimeCout;
648         bool fTxDataInSleep;
649         bool IsTxDataTrigger;
650
651 #ifdef WPA_SM_Transtatus
652         bool fWPA_Authened;           //is WPA/WPA-PSK or WPA2/WPA2-PSK authen??
653 #endif
654         unsigned char byReAssocCount;   //mike add:re-association retry times!
655         unsigned char byLinkWaitCount;
656
657         unsigned char abyNodeName[17];
658
659         bool bDiversityRegCtlON;
660         bool bDiversityEnable;
661         unsigned long ulDiversityNValue;
662         unsigned long ulDiversityMValue;
663         unsigned char byTMax;
664         unsigned char byTMax2;
665         unsigned char byTMax3;
666         unsigned long ulSQ3TH;
667
668 // ANT diversity
669         unsigned long uDiversityCnt;
670         unsigned char byAntennaState;
671         unsigned long ulRatio_State0;
672         unsigned long ulRatio_State1;
673
674         //SQ3 functions for antenna diversity
675         struct timer_list           TimerSQ3Tmax1;
676         struct timer_list           TimerSQ3Tmax2;
677         struct timer_list           TimerSQ3Tmax3;
678
679         unsigned long uNumSQ3[MAX_RATE];
680         unsigned short wAntDiversityMaxRate;
681
682         SEthernetHeader         sTxEthHeader;
683         SEthernetHeader         sRxEthHeader;
684         unsigned char abyBroadcastAddr[ETH_ALEN];
685         unsigned char abySNAP_RFC1042[ETH_ALEN];
686         unsigned char abySNAP_Bridgetunnel[ETH_ALEN];
687         unsigned char abyEEPROM[EEP_MAX_CONTEXT_SIZE];  //unsigned long alignment
688         // Pre-Authentication & PMK cache
689         SPMKID                  gsPMKID;
690         SPMKIDCandidateEvent    gsPMKIDCandidate;
691
692         // for 802.11h
693         bool b11hEnable;
694         unsigned char abyCountryCode[3];
695         // for 802.11h DFS
696         unsigned int    uNumOfMeasureEIDs;
697         PWLAN_IE_MEASURE_REQ    pCurrMeasureEID;
698         bool bMeasureInProgress;
699         unsigned char byOrgChannel;
700         unsigned char byOrgRCR;
701         unsigned long dwOrgMAR0;
702         unsigned long dwOrgMAR4;
703         unsigned char byBasicMap;
704         unsigned char byCCAFraction;
705         unsigned char abyRPIs[8];
706         unsigned long dwRPIs[8];
707         bool bChannelSwitch;
708         unsigned char byNewChannel;
709         unsigned char byChannelSwitchCount;
710         bool bQuietEnable;
711         bool bEnableFirstQuiet;
712         unsigned char byQuietStartCount;
713         unsigned int    uQuietEnqueue;
714         unsigned long dwCurrentQuietEndTime;
715         SQuietControl           sQuiet[MAX_QUIET_COUNT];
716         // for 802.11h TPC
717         bool bCountryInfo5G;
718         bool bCountryInfo24G;
719
720         unsigned short wBeaconInterval;
721
722         //WPA supplicant deamon
723         struct net_device       *wpadev;
724         bool bWPADEVUp;
725         struct sk_buff          *skb;
726 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
727         unsigned int    bwextcount;
728         bool bWPASuppWextEnabled;
729 #endif
730
731         //--
732 #ifdef HOSTAP
733         // user space daemon: hostapd, is used for HOSTAP
734         bool bEnableHostapd;
735         bool bEnable8021x;
736         bool bEnableHostWEP;
737         struct net_device       *apdev;
738         int (*tx_80211)(struct sk_buff *skb, struct net_device *dev);
739 #endif
740         unsigned int    uChannel;
741         bool bMACSuspend;
742
743         struct iw_statistics    wstats;         // wireless stats
744         bool bCommit;
745 };
746
747 static inline bool device_get_ip(struct vnt_private *pInfo)
748 {
749         struct in_device *in_dev = (struct in_device *)pInfo->dev->ip_ptr;
750         struct in_ifaddr *ifa;
751
752         if (in_dev != NULL) {
753                 ifa = (struct in_ifaddr *)in_dev->ifa_list;
754                 if (ifa != NULL) {
755                         memcpy(pInfo->abyIPAddr, &ifa->ifa_address, 4);
756                         return true;
757                 }
758         }
759         return false;
760 }
761
762 static inline PDEVICE_RD_INFO alloc_rd_info(void)
763 {
764         return kzalloc(sizeof(DEVICE_RD_INFO), GFP_ATOMIC);
765 }
766
767 static inline PDEVICE_TD_INFO alloc_td_info(void)
768 {
769         return kzalloc(sizeof(DEVICE_TD_INFO), GFP_ATOMIC);
770 }
771
772 /*---------------------  Export Functions  --------------------------*/
773
774 bool device_dma0_xmit(struct vnt_private *pDevice,
775                       struct sk_buff *skb, unsigned int uNodeIndex);
776 bool device_alloc_frag_buf(struct vnt_private *pDevice,
777                            PSDeFragControlBlock pDeF);
778 int Config_FileOperation(struct vnt_private *pDevice,
779                          bool fwrite, unsigned char *Parameter);
780 #endif