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