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