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