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