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