]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/staging/vt6656/device.h
staging: vt6656: mac80211 conversion: add vnt_init to bScheduleCommand
[karo-tx-linux.git] / drivers / staging / vt6656 / device.h
1 /*
2  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3  * All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * File: device.h
20  *
21  * Purpose: MAC Data structure
22  *
23  * Author: Tevin Chen
24  *
25  * Date: Mar 17, 1997
26  *
27  */
28
29 #ifndef __DEVICE_H__
30 #define __DEVICE_H__
31
32 #include <linux/module.h>
33 #include <linux/kernel.h>
34 #include <linux/slab.h>
35 #include <linux/delay.h>
36 #include <linux/device.h>
37 #include <linux/firmware.h>
38 #include <linux/etherdevice.h>
39 #include <linux/suspend.h>
40 #include <linux/if_arp.h>
41 #include <linux/wireless.h>
42 #include <net/iw_handler.h>
43 #include <net/cfg80211.h>
44 #include <linux/timer.h>
45 #include <linux/usb.h>
46 #include <linux/crc32.h>
47 #include <net/mac80211.h>
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 #define MAX_RATE                        12
57
58 /*
59  * device specific
60  */
61
62 #include "80211hdr.h"
63 #include "tether.h"
64 #include "wmgr.h"
65 #include "wcmd.h"
66 #include "rc4.h"
67 #include "desc.h"
68 #include "key.h"
69 #include "card.h"
70
71 #define VNT_USB_VENDOR_ID                     0x160a
72 #define VNT_USB_PRODUCT_ID                    0x3184
73
74 #define DEVICE_NAME                     "vt6656"
75 #define DEVICE_FULL_DRV_NAM             "VIA Networking Wireless LAN USB Driver"
76
77 #define DEVICE_VERSION                  "1.19_12"
78
79 #define CONFIG_PATH                     "/etc/vntconfiguration.dat"
80
81 #define MAX_UINTS                       8
82 #define OPTION_DEFAULT                  { [0 ... MAX_UINTS-1] = -1}
83
84 #define DUPLICATE_RX_CACHE_LENGTH       5
85
86 #define AUTO_FB_NONE            0
87 #define AUTO_FB_0               1
88 #define AUTO_FB_1               2
89
90 #define FB_RATE0                0
91 #define FB_RATE1                1
92
93 /* Antenna Mode */
94 #define ANT_A                   0
95 #define ANT_B                   1
96 #define ANT_DIVERSITY           2
97 #define ANT_RXD_TXA             3
98 #define ANT_RXD_TXB             4
99 #define ANT_UNKNOWN             0xFF
100 #define ANT_TXA                 0
101 #define ANT_TXB                 1
102 #define ANT_RXA                 2
103 #define ANT_RXB                 3
104
105 #define BB_VGA_LEVEL            4
106 #define BB_VGA_CHANGE_THRESHOLD 3
107
108 #define EEP_MAX_CONTEXT_SIZE    256
109
110 /* Contents in the EEPROM */
111 #define EEP_OFS_PAR             0x0
112 #define EEP_OFS_ANTENNA         0x17
113 #define EEP_OFS_RADIOCTL        0x18
114 #define EEP_OFS_RFTYPE          0x1b
115 #define EEP_OFS_MINCHANNEL      0x1c
116 #define EEP_OFS_MAXCHANNEL      0x1d
117 #define EEP_OFS_SIGNATURE       0x1e
118 #define EEP_OFS_ZONETYPE        0x1f
119 #define EEP_OFS_RFTABLE         0x20
120 #define EEP_OFS_PWR_CCK         0x20
121 #define EEP_OFS_SETPT_CCK       0x21
122 #define EEP_OFS_PWR_OFDMG       0x23
123
124 #define EEP_OFS_CALIB_TX_IQ     0x24
125 #define EEP_OFS_CALIB_TX_DC     0x25
126 #define EEP_OFS_CALIB_RX_IQ     0x26
127
128 #define EEP_OFS_MAJOR_VER       0x2e
129 #define EEP_OFS_MINOR_VER       0x2f
130
131 #define EEP_OFS_CCK_PWR_TBL     0x30
132 #define EEP_OFS_OFDM_PWR_TBL    0x40
133 #define EEP_OFS_OFDMA_PWR_TBL   0x50
134
135 /* Bits in EEP_OFS_ANTENNA */
136 #define EEP_ANTENNA_MAIN        0x1
137 #define EEP_ANTENNA_AUX         0x2
138 #define EEP_ANTINV              0x4
139
140 /* Bits in EEP_OFS_RADIOCTL */
141 #define EEP_RADIOCTL_ENABLE     0x80
142
143 /* control commands */
144 #define MESSAGE_TYPE_READ               0x1
145 #define MESSAGE_TYPE_WRITE              0x0
146 #define MESSAGE_TYPE_LOCK_OR            0x2
147 #define MESSAGE_TYPE_LOCK_AND           0x3
148 #define MESSAGE_TYPE_WRITE_MASK         0x4
149 #define MESSAGE_TYPE_CARDINIT           0x5
150 #define MESSAGE_TYPE_INIT_RSP           0x6
151 #define MESSAGE_TYPE_MACSHUTDOWN        0x7
152 #define MESSAGE_TYPE_SETKEY             0x8
153 #define MESSAGE_TYPE_CLRKEYENTRY        0x9
154 #define MESSAGE_TYPE_WRITE_MISCFF       0xa
155 #define MESSAGE_TYPE_SET_ANTMD          0xb
156 #define MESSAGE_TYPE_SELECT_CHANNLE     0xc
157 #define MESSAGE_TYPE_SET_TSFTBTT        0xd
158 #define MESSAGE_TYPE_SET_SSTIFS         0xe
159 #define MESSAGE_TYPE_CHANGE_BBTYPE      0xf
160 #define MESSAGE_TYPE_DISABLE_PS         0x10
161 #define MESSAGE_TYPE_WRITE_IFRF         0x11
162
163 /* command read/write(index) */
164 #define MESSAGE_REQUEST_MEM             0x1
165 #define MESSAGE_REQUEST_BBREG           0x2
166 #define MESSAGE_REQUEST_MACREG          0x3
167 #define MESSAGE_REQUEST_EEPROM          0x4
168 #define MESSAGE_REQUEST_TSF             0x5
169 #define MESSAGE_REQUEST_TBTT            0x6
170 #define MESSAGE_REQUEST_BBAGC           0x7
171 #define MESSAGE_REQUEST_VERSION         0x8
172 #define MESSAGE_REQUEST_RF_INIT         0x9
173 #define MESSAGE_REQUEST_RF_INIT2        0xa
174 #define MESSAGE_REQUEST_RF_CH0          0xb
175 #define MESSAGE_REQUEST_RF_CH1          0xc
176 #define MESSAGE_REQUEST_RF_CH2          0xd
177
178 /* USB registers */
179 #define USB_REG4                        0x604
180
181 #ifndef RUN_AT
182 #define RUN_AT(x)                       (jiffies+(x))
183 #endif
184
185 #define PRIVATE_Message                 0
186
187 #define DBG_PRT(l, p, args...) { if (l <= msglevel) printk(p, ##args); }
188 #define PRINT_K(p, args...) { if (PRIVATE_Message) printk(p, ##args); }
189
190 typedef enum __device_msg_level {
191         MSG_LEVEL_ERR = 0,            /* Errors causing abnormal operation */
192         MSG_LEVEL_NOTICE = 1,         /* Errors needing user notification */
193         MSG_LEVEL_INFO = 2,           /* Normal message. */
194         MSG_LEVEL_VERBOSE = 3,        /* Will report all trival errors. */
195         MSG_LEVEL_DEBUG = 4           /* Only for debug purpose. */
196 } DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL;
197
198 #define DEVICE_INIT_COLD        0x0 /* cold init */
199 #define DEVICE_INIT_RESET       0x1 /* reset init or Dx to D0 power remain */
200 #define DEVICE_INIT_DXPL        0x2 /* Dx to D0 power lost init */
201
202 /* Device init */
203 struct vnt_cmd_card_init {
204         u8 init_class;
205         u8 exist_sw_net_addr;
206         u8 sw_net_addr[6];
207         u8 short_retry_limit;
208         u8 long_retry_limit;
209 };
210
211 struct vnt_rsp_card_init {
212         u8 status;
213         u8 net_addr[6];
214         u8 rf_type;
215         u8 min_channel;
216         u8 max_channel;
217 };
218
219 /* USB */
220
221 /*
222  * Enum of context types for SendPacket
223  */
224 enum {
225         CONTEXT_DATA_PACKET = 1,
226         CONTEXT_MGMT_PACKET,
227         CONTEXT_BEACON_PACKET
228 };
229
230 /* RCB (Receive Control Block) */
231 struct vnt_rcb {
232         void *Next;
233         signed long Ref;
234         void *pDevice;
235         struct urb *pUrb;
236         struct vnt_rx_mgmt sMngPacket;
237         struct sk_buff *skb;
238         int bBoolInUse;
239 };
240
241 /* used to track bulk out irps */
242 struct vnt_usb_send_context {
243         void *priv;
244         struct sk_buff *skb;
245         struct urb *urb;
246         struct ieee80211_hdr *hdr;
247         unsigned int buf_len;
248         u16 tx_hdr_size;
249         u8 type;
250         bool in_use;
251         unsigned char data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS];
252 };
253
254 /* tx packet info for rxtx */
255 struct vnt_tx_pkt_info {
256         u16 fifo_ctl;
257         u8 dest_addr[ETH_ALEN];
258 };
259
260 /* structure got from configuration file as user-desired default settings */
261 typedef struct _DEFAULT_CONFIG {
262         signed int    ZoneType;
263         signed int    eConfigMode;
264         signed int    eAuthenMode;        /* open/wep/wpa */
265         signed int    bShareKeyAlgorithm; /* open-open/{open,wep}-sharekey */
266         signed int    keyidx;             /* wepkey index */
267         signed int    eEncryptionStatus;
268 } DEFAULT_CONFIG, *PDEFAULT_CONFIG;
269
270 /*
271  * Structure to keep track of USB interrupt packets
272  */
273 struct vnt_interrupt_buffer {
274         u8 *data_buf;
275         bool in_use;
276 };
277
278 /*++ NDIS related */
279
280 typedef enum __DEVICE_NDIS_STATUS {
281     STATUS_SUCCESS = 0,
282     STATUS_FAILURE,
283     STATUS_RESOURCES,
284     STATUS_PENDING,
285 } DEVICE_NDIS_STATUS, *PDEVICE_NDIS_STATUS;
286
287 #define MAX_BSSIDINFO_4_PMKID   16
288 #define MAX_PMKIDLIST           5
289 /* flags for PMKID Candidate list structure */
290 #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED     0x01
291
292 /* PMKID Structures */
293 typedef unsigned char   NDIS_802_11_PMKID_VALUE[16];
294
295 typedef enum _NDIS_802_11_WEP_STATUS
296 {
297     Ndis802_11WEPEnabled,
298     Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
299     Ndis802_11WEPDisabled,
300     Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
301     Ndis802_11WEPKeyAbsent,
302     Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
303     Ndis802_11WEPNotSupported,
304     Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
305     Ndis802_11Encryption2Enabled,
306     Ndis802_11Encryption2KeyAbsent,
307     Ndis802_11Encryption3Enabled,
308     Ndis802_11Encryption3KeyAbsent
309 } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
310   NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
311
312 typedef enum _NDIS_802_11_STATUS_TYPE
313 {
314         Ndis802_11StatusType_Authentication,
315         Ndis802_11StatusType_MediaStreamMode,
316         Ndis802_11StatusType_PMKID_CandidateList,
317         Ndis802_11StatusTypeMax, /* not a real type, defined as upper bound */
318 } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
319
320 /* added new types for PMKID Candidate lists */
321 typedef struct _PMKID_CANDIDATE {
322     NDIS_802_11_MAC_ADDRESS BSSID;
323     unsigned long Flags;
324 } PMKID_CANDIDATE, *PPMKID_CANDIDATE;
325
326 typedef struct _BSSID_INFO
327 {
328     NDIS_802_11_MAC_ADDRESS BSSID;
329     NDIS_802_11_PMKID_VALUE PMKID;
330 } BSSID_INFO, *PBSSID_INFO;
331
332 typedef struct tagSPMKID {
333     unsigned long Length;
334     unsigned long BSSIDInfoCount;
335     BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID];
336 } SPMKID, *PSPMKID;
337
338 typedef struct tagSPMKIDCandidateEvent {
339     NDIS_802_11_STATUS_TYPE     StatusType;
340         unsigned long Version;       /* Version of the structure */
341         unsigned long NumCandidates; /* No. of pmkid candidates */
342     PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST];
343 } SPMKIDCandidateEvent, *PSPMKIDCandidateEvent;
344
345 /* The receive duplicate detection cache entry */
346 typedef struct tagSCacheEntry{
347         __le16 wFmSequence;
348         u8 abyAddr2[ETH_ALEN];
349         __le16 wFrameCtl;
350 } SCacheEntry, *PSCacheEntry;
351
352 typedef struct tagSCache{
353 /* The receive cache is updated circularly.  The next entry to be written is
354  * indexed by the "InPtr".
355  */
356         unsigned int uInPtr; /* Place to use next */
357     SCacheEntry     asCacheEntry[DUPLICATE_RX_CACHE_LENGTH];
358 } SCache, *PSCache;
359
360 #define CB_MAX_RX_FRAG                 64
361 /*
362  * DeFragment Control Block, used for collecting fragments prior to reassembly
363  */
364 typedef struct tagSDeFragControlBlock
365 {
366     u16            wSequence;
367     u16            wFragNum;
368     u8            abyAddr2[ETH_ALEN];
369         unsigned int            uLifetime;
370     struct sk_buff* skb;
371     u8 *           pbyRxBuffer;
372     unsigned int            cbFrameLength;
373     bool            bInUse;
374 } SDeFragControlBlock, *PSDeFragControlBlock;
375
376 /* flags for options */
377 #define     DEVICE_FLAGS_UNPLUG          0x00000001UL
378
379 /* flags for driver status */
380 #define     DEVICE_FLAGS_OPENED          0x00010000UL
381
382 typedef struct __device_opt {
383         int nRxDescs0;  /* number of RX descriptors 0 */
384         int nTxDescs0;  /* number of TX descriptors 0, 1, 2, 3 */
385         int rts_thresh; /* RTS threshold */
386     int         frag_thresh;
387     int         OpMode;
388     int         data_rate;
389     int         channel_num;
390     int         short_retry;
391     int         long_retry;
392     int         bbp_type;
393     u32         flags;
394 } OPTIONS, *POPTIONS;
395
396 struct vnt_private {
397         /* mac80211 */
398         struct ieee80211_hw *hw;
399         struct ieee80211_vif *vif;
400         u8 mac_hw;
401         /* netdev */
402         struct usb_device *usb;
403         struct net_device *dev;
404         struct net_device_stats stats;
405
406         OPTIONS sOpts;
407
408         struct work_struct read_work_item;
409         struct work_struct rx_mng_work_item;
410
411         u64 tsf_time;
412         u8 rx_rate;
413
414         u32 rx_buf_sz;
415         int mc_list_count;
416         int multicast_limit;
417         u8 byRxMode;
418
419         spinlock_t lock;
420         struct mutex usb_lock;
421
422         u32 rx_bytes;
423
424         u32 flags;
425         unsigned long Flags;
426
427         SCache sDupRxCache;
428
429         SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG];
430         u32 cbDFCB;
431         u32 cbFreeDFCB;
432         u32 uCurrentDFCBIdx;
433
434         /* USB */
435         struct urb *pInterruptURB;
436         u32 int_interval;
437
438         /* Variables to track resources for the BULK In Pipe */
439         struct vnt_rcb *pRCBMem;
440         struct vnt_rcb *apRCB[CB_MAX_RX_DESC];
441         u32 cbRD;
442         struct vnt_rcb *FirstRecvFreeList;
443         struct vnt_rcb *LastRecvFreeList;
444         u32 NumRecvFreeList;
445         struct vnt_rcb *FirstRecvMngList;
446         struct vnt_rcb *LastRecvMngList;
447         u32 NumRecvMngList;
448         int bIsRxWorkItemQueued;
449         int bIsRxMngWorkItemQueued;
450         unsigned long ulRcvRefCount; /* packets that have not returned back */
451
452         /* Variables to track resources for the BULK Out Pipe */
453         struct vnt_usb_send_context *apTD[CB_MAX_TX_DESC];
454         u32 cbTD;
455         struct vnt_tx_pkt_info pkt_info[16];
456
457         /* Variables to track resources for the Interrupt In Pipe */
458         struct vnt_interrupt_buffer int_buf;
459
460         /* default config from file by user setting */
461         DEFAULT_CONFIG config_file;
462
463         /* Version control */
464         u16 wFirmwareVersion;
465         u8 byLocalID;
466         u8 byRFType;
467         u8 byBBRxConf;
468
469         u8 byZoneType;
470         int bZoneRegExist;
471
472         u8 byOriginalZonetype;
473
474         int bLinkPass; /* link status: OK or fail */
475         struct vnt_cmd_card_init init_command;
476         struct vnt_rsp_card_init init_response;
477         u8 abyCurrentNetAddr[ETH_ALEN];
478         u8 abyPermanentNetAddr[ETH_ALEN];
479
480         int bExistSWNetAddr;
481
482         /* Maintain statistical debug info. */
483         unsigned long SendContextsInUse;
484         unsigned long RcvBuffersInUse;
485
486         /* 802.11 management */
487         struct vnt_manager vnt_mgmt;
488
489         u64 qwCurrTSF;
490         u32 cbBulkInMax;
491         int bPSRxBeacon;
492
493         /* 802.11 MAC specific */
494         u32 uCurrRSSI;
495         u8 byCurrSQ;
496
497         /* Antenna Diversity */
498         int bTxRxAntInv;
499         u32 dwRxAntennaSel;
500         u32 dwTxAntennaSel;
501         u8 byAntennaCount;
502         u8 byRxAntennaMode;
503         u8 byTxAntennaMode;
504         u8 byRadioCtl;
505         u8 bHWRadioOff;
506
507         /* IFS & Cw */
508         u32 uSIFS;  /* Current SIFS */
509         u32 uDIFS;  /* Current DIFS */
510         u32 uEIFS;  /* Current EIFS */
511         u32 uSlot;  /* Current SlotTime */
512         u32 uCwMin; /* Current CwMin */
513         u32 uCwMax; /* CwMax is fixed on 1023 */
514
515         /* PHY parameter */
516         u8  bySIFS;
517         u8  byDIFS;
518         u8  byEIFS;
519         u8  bySlot;
520         u8  byCWMaxMin;
521
522         /* Rate */
523         u8 byBBType; /* 0: 11A, 1:11B, 2:11G */
524         u8 byPacketType; /* 0:11a 1:11b 2:11gb 3:11ga */
525         u16 wBasicRate;
526         u8 byTopOFDMBasicRate;
527         u8 byTopCCKBasicRate;
528
529         u8 abyEEPROM[EEP_MAX_CONTEXT_SIZE];  /*u32 alignment */
530
531         u8 byMinChannel;
532         u8 byMaxChannel;
533         u32 uConnectionRate;
534
535         u8 byPreambleType;
536         u8 byShortPreamble;
537         /* CARD_PHY_TYPE */
538         u8 eConfigPHYMode;
539
540         /* For RF Power table */
541         u8 byCCKPwr;
542         u8 byOFDMPwrG;
543         u8 byOFDMPwrA;
544         u8 byCurPwr;
545         u8 abyCCKPwrTbl[14];
546         u8 abyOFDMPwrTbl[14];
547         u8 abyOFDMAPwrTbl[42];
548
549         u16 wCurrentRate;
550         u16 tx_rate_fb0;
551         u16 tx_rate_fb1;
552
553         u16 wRTSThreshold;
554         u16 wFragmentationThreshold;
555         u8 byShortRetryLimit;
556         u8 byLongRetryLimit;
557
558         enum nl80211_iftype op_mode;
559
560         int bBSSIDFilter;
561         u16 wMaxTransmitMSDULifetime;
562         u8 abyBSSID[ETH_ALEN];
563         u8 abyDesireBSSID[ETH_ALEN];
564
565         u32 dwMaxReceiveLifetime;  /* dot11MaxReceiveLifetime */
566
567         int bEncryptionEnable;
568         int bShortSlotTime;
569         int bProtectMode;
570         int bNonERPPresent;
571         int bBarkerPreambleMd;
572
573         u8 byERPFlag;
574         u16 wUseProtectCntDown;
575
576         int bRadioControlOff;
577         int bRadioOff;
578
579         /* Power save */
580         u16 current_aid;
581         int bEnablePSMode;
582         u16 wListenInterval;
583         int bPWBitOn;
584         WMAC_POWER_MODE ePSMode;
585         unsigned long ulPSModeWaitTx;
586         int bPSModeTxBurst;
587
588         /* Beacon releated */
589         u16 wSeqCounter;
590         int bBeaconBufReady;
591         int bBeaconSent;
592         int bFixRate;
593         u8 byCurrentCh;
594
595         CMD_STATE eCommandState;
596
597         CMD_CODE eCommand;
598         int bBeaconTx;
599         u8 byScanBBType;
600
601         int bStopBeacon;
602         int bStopDataPkt;
603         int bStopTx0Pkt;
604         u32 uAutoReConnectTime;
605         u32 uIsroamingTime;
606
607         /* 802.11 counter */
608
609         CMD_ITEM eCmdQueue[CMD_Q_SIZE];
610         u32 uCmdDequeueIdx;
611         u32 uCmdEnqueueIdx;
612         u32 cbFreeCmdQueue;
613         int bCmdRunning;
614         int bCmdClear;
615         int bNeedRadioOFF;
616
617         int bEnableRoaming;
618         int bIsRoaming;
619         int bFastRoaming;
620         u8 bSameBSSMaxNum;
621         u8 bSameBSSCurNum;
622         int bRoaming;
623         int b11hEable;
624
625         /* Encryption */
626         NDIS_802_11_WEP_STATUS eEncryptionStatus;
627         int  bTransmitKey;
628         NDIS_802_11_WEP_STATUS eOldEncryptionStatus;
629         SKeyManagement sKey;
630         u32 dwIVCounter;
631
632         RC4Ext SBox;
633         u8 abyPRNG[WLAN_WEPMAX_KEYLEN+3];
634         u8 byKeyIndex;
635
636         u32 uKeyLength;
637         u8 abyKey[WLAN_WEP232_KEYLEN];
638         unsigned long key_entry_inuse;
639
640         /* for AP mode */
641         u32 uAssocCount;
642         int bMoreData;
643
644         /* QoS */
645         int bGrpAckPolicy;
646
647         u8 byAutoFBCtrl;
648
649         int bTxMICFail;
650         int bRxMICFail;
651
652         /* For Update BaseBand VGA Gain Offset */
653         u32 uBBVGADiffCount;
654         u8 byBBVGANew;
655         u8 byBBVGACurrent;
656         u8 abyBBVGA[BB_VGA_LEVEL];
657         signed long ldBmThreshold[BB_VGA_LEVEL];
658
659         u8 byBBPreEDRSSI;
660         u8 byBBPreEDIndex;
661
662         int bRadioCmd;
663
664         /* command timer */
665         struct delayed_work run_command_work;
666         /* One second callback */
667         struct delayed_work second_callback_work;
668
669         u8 tx_data_time_out;
670         bool tx_trigger;
671         int fWPA_Authened; /*is WPA/WPA-PSK or WPA2/WPA2-PSK authen?? */
672         u8 byReAssocCount;
673         u8 byLinkWaitCount;
674
675         struct ethhdr sTxEthHeader;
676         struct ethhdr sRxEthHeader;
677         u8 abyBroadcastAddr[ETH_ALEN];
678         u8 abySNAP_RFC1042[ETH_ALEN];
679         u8 abySNAP_Bridgetunnel[ETH_ALEN];
680
681         /* Pre-Authentication & PMK cache */
682         SPMKID gsPMKID;
683         SPMKIDCandidateEvent gsPMKIDCandidate;
684
685         /* for 802.11h */
686         int b11hEnable;
687
688         int bChannelSwitch;
689         u8 byNewChannel;
690         u8 byChannelSwitchCount;
691
692         /* WPA supplicant daemon */
693         int bWPADEVUp;
694         int bwextstep0;
695         int bwextstep1;
696         int bwextstep2;
697         int bwextstep3;
698         int bWPASuppWextEnabled;
699
700         u32 uChannel;
701
702         struct iw_statistics wstats; /* wireless stats */
703
704         int bCommit;
705
706 };
707
708 #define EnqueueRCB(_Head, _Tail, _RCB)                  \
709 {                                                       \
710     if (!_Head) {                                       \
711         _Head = _RCB;                                   \
712     }                                                   \
713     else {                                              \
714         _Tail->Next = _RCB;                             \
715     }                                                   \
716     _RCB->Next = NULL;                                  \
717     _Tail = _RCB;                                       \
718 }
719
720 #define DequeueRCB(Head, Tail)                          \
721 {                                                       \
722     struct vnt_rcb *RCB = Head;                         \
723     if (!RCB->Next) {                                   \
724         Tail = NULL;                                    \
725     }                                                   \
726     Head = RCB->Next;                                   \
727 }
728
729 #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) {   \
730     if ((uVar) >= ((uModulo) - 1))                  \
731         (uVar) = 0;                                 \
732     else                                            \
733         (uVar)++;                                   \
734 }
735
736 #define fMP_DISCONNECTED                    0x00000002
737 #define fMP_POST_READS                      0x00000100
738 #define fMP_POST_WRITES                     0x00000200
739
740 #define MP_SET_FLAG(_M, _F)             ((_M)->Flags |= (_F))
741 #define MP_CLEAR_FLAG(_M, _F)            ((_M)->Flags &= ~(_F))
742 #define MP_TEST_FLAGS(_M, _F)            (((_M)->Flags & (_F)) == (_F))
743
744 #define MP_IS_READY(_M)        (((_M)->Flags & fMP_DISCONNECTED) == 0)
745
746 int device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF);
747 void vnt_configure_filter(struct vnt_private *);
748 int vnt_init(struct vnt_private *priv);
749
750 #endif