On Tue, Nov 06, 2007 at 02:33:53AM -0800, akpm@linux-foundation.org wrote:
[mmotm.git] / drivers / staging / vt6656 / device.h
blobb02ca2d66feedb645817305d2d8268eaec89ecc0
1 /*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
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.
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.
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.
19 * File: device.h
21 * Purpose: MAC Data structure
23 * Author: Tevin Chen
25 * Date: Mar 17, 1997
29 #ifndef __DEVICE_H__
30 #define __DEVICE_H__
32 #include <linux/module.h>
33 #include <linux/types.h>
34 #include <linux/init.h>
35 #include <linux/mm.h>
36 #include <linux/errno.h>
37 #include <linux/ioport.h>
38 #include <linux/pci.h>
39 #include <linux/kernel.h>
40 #include <linux/netdevice.h>
41 #include <linux/etherdevice.h>
42 #include <linux/skbuff.h>
43 #include <linux/delay.h>
44 #include <linux/timer.h>
45 #include <linux/slab.h>
46 #include <linux/interrupt.h>
47 #include <linux/version.h>
48 #include <linux/string.h>
49 #include <linux/wait.h>
50 #include <linux/if_arp.h>
51 #include <linux/sched.h>
52 #include <linux/if.h>
53 #include <linux/rtnetlink.h>//James
54 #include <linux/proc_fs.h>
55 #include <linux/inetdevice.h>
56 #include <linux/reboot.h>
57 #include <linux/usb.h>
58 #include <linux/signal.h>
59 #include <asm/io.h>
60 #include <asm/uaccess.h>
61 #ifdef SIOCETHTOOL
62 #define DEVICE_ETHTOOL_IOCTL_SUPPORT
63 #include <linux/ethtool.h>
64 #else
65 #undef DEVICE_ETHTOOL_IOCTL_SUPPORT
66 #endif
67 /* Include Wireless Extension definition and check version - Jean II */
68 #include <linux/wireless.h>
69 #include <net/iw_handler.h> // New driver API
71 #ifndef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
72 #define WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
73 #endif
75 //2007-0920-01<Add>by MikeLiu
76 #ifndef SndEvt_ToAPI
77 #define SndEvt_ToAPI
78 //please copy below macro to driver_event.c for API
79 #define RT_INSMOD_EVENT_FLAG 0x0101
80 #define RT_UPDEV_EVENT_FLAG 0x0102
81 #define RT_DISCONNECTED_EVENT_FLAG 0x0103
82 #define RT_WPACONNECTED_EVENT_FLAG 0x0104
83 #define RT_DOWNDEV_EVENT_FLAG 0x0105
84 #define RT_RMMOD_EVENT_FLAG 0x0106
85 #endif
88 // device specific
91 #include "kcompat.h"
92 #include "device_cfg.h"
93 #include "ttype.h"
94 #include "80211hdr.h"
95 #include "tether.h"
96 #include "wmgr.h"
97 #include "wcmd.h"
98 #include "mib.h"
99 #include "srom.h"
100 #include "rc4.h"
101 #include "desc.h"
102 #include "key.h"
103 #include "card.h"
105 /*--------------------- Export Definitions -------------------------*/
106 #define VNT_USB_VENDOR_ID 0x160A
107 #define VNT_USB_PRODUCT_ID 0x3184
109 #define MAC_MAX_CONTEXT_REG (256+128)
111 #define MAX_MULTICAST_ADDRESS_NUM 32
112 #define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * U_ETHER_ADDR_LEN)
115 //#define OP_MODE_INFRASTRUCTURE 0
116 //#define OP_MODE_ADHOC 1
117 //#define OP_MODE_AP 2
119 #define DUPLICATE_RX_CACHE_LENGTH 5
121 #define NUM_KEY_ENTRY 11
123 #define TX_WEP_NONE 0
124 #define TX_WEP_OTF 1
125 #define TX_WEP_SW 2
126 #define TX_WEP_SWOTP 3
127 #define TX_WEP_OTPSW 4
128 #define TX_WEP_SW232 5
130 #define KEYSEL_WEP40 0
131 #define KEYSEL_WEP104 1
132 #define KEYSEL_TKIP 2
133 #define KEYSEL_CCMP 3
137 #define AUTO_FB_NONE 0
138 #define AUTO_FB_0 1
139 #define AUTO_FB_1 2
141 #define FB_RATE0 0
142 #define FB_RATE1 1
144 // Antenna Mode
145 #define ANT_A 0
146 #define ANT_B 1
147 #define ANT_DIVERSITY 2
148 #define ANT_RXD_TXA 3
149 #define ANT_RXD_TXB 4
150 #define ANT_UNKNOWN 0xFF
151 #define ANT_TXA 0
152 #define ANT_TXB 1
153 #define ANT_RXA 2
154 #define ANT_RXB 3
157 #define MAXCHECKHANGCNT 4
159 //Packet type
160 #define TX_PKT_UNI 0x00
161 #define TX_PKT_MULTI 0x01
162 #define TX_PKT_BROAD 0x02
164 #define BB_VGA_LEVEL 4
165 #define BB_VGA_CHANGE_THRESHOLD 3
169 #ifndef RUN_AT
170 #define RUN_AT(x) (jiffies+(x))
171 #endif
173 // DMA related
174 #define RESERV_AC0DMA 4
176 #define PRIVATE_Message 0
178 /*--------------------- Export Types ------------------------------*/
180 #define DBG_PRT(l, p, args...) {if (l<=msglevel) printk( p ,##args);}
181 #define PRINT_K(p, args...) {if (PRIVATE_Message) printk( p ,##args);}
183 typedef enum __device_msg_level {
184 MSG_LEVEL_ERR=0, //Errors that will cause abnormal operation.
185 MSG_LEVEL_NOTICE=1, //Some errors need users to be notified.
186 MSG_LEVEL_INFO=2, //Normal message.
187 MSG_LEVEL_VERBOSE=3, //Will report all trival errors.
188 MSG_LEVEL_DEBUG=4 //Only for debug purpose.
189 } DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL;
191 typedef enum __device_init_type {
192 DEVICE_INIT_COLD=0, // cold init
193 DEVICE_INIT_RESET, // reset init or Dx to D0 power remain init
194 DEVICE_INIT_DXPL // Dx to D0 power lost init
195 } DEVICE_INIT_TYPE, *PDEVICE_INIT_TYPE;
198 //USB
201 // Enum of context types for SendPacket
203 typedef enum _CONTEXT_TYPE {
204 CONTEXT_DATA_PACKET = 1,
205 CONTEXT_MGMT_PACKET
206 } CONTEXT_TYPE;
211 // RCB (Receive Control Block)
212 typedef struct _RCB
214 PVOID Next;
215 LONG Ref;
216 PVOID pDevice;
217 struct urb *pUrb;
218 SRxMgmtPacket sMngPacket;
219 struct sk_buff* skb;
220 BOOL bBoolInUse;
222 } RCB, *PRCB;
225 // used to track bulk out irps
226 typedef struct _USB_SEND_CONTEXT {
227 PVOID pDevice;
228 struct sk_buff *pPacket;
229 struct urb *pUrb;
230 UINT uBufLen;
231 CONTEXT_TYPE Type;
232 SEthernetHeader sEthHeader;
233 PVOID Next;
234 BOOL bBoolInUse;
235 UCHAR Data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS];
236 } USB_SEND_CONTEXT, *PUSB_SEND_CONTEXT;
239 //structure got from configuration file as user desired default setting.
240 typedef struct _DEFAULT_CONFIG{
241 INT ZoneType;
242 INT eConfigMode;
243 INT eAuthenMode; //open/wep/wpa
244 INT bShareKeyAlgorithm; //open-open/open-sharekey/wep-sharekey
245 INT keyidx; //wepkey index
246 INT eEncryptionStatus;
248 }DEFAULT_CONFIG,*PDEFAULT_CONFIG;
251 // Structure to keep track of usb interrupt packets
253 typedef struct {
254 UINT uDataLen;
255 PBYTE pDataBuf;
256 // struct urb *pUrb;
257 BOOL bInUse;
258 } INT_BUFFER, *PINT_BUFFER;
262 //0:11A 1:11B 2:11G
263 typedef enum _VIA_BB_TYPE
265 BB_TYPE_11A=0,
266 BB_TYPE_11B,
267 BB_TYPE_11G
268 } VIA_BB_TYPE, *PVIA_BB_TYPE;
270 //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
271 typedef enum _VIA_PKT_TYPE
273 PK_TYPE_11A=0,
274 PK_TYPE_11B,
275 PK_TYPE_11GB,
276 PK_TYPE_11GA
277 } VIA_PKT_TYPE, *PVIA_PKT_TYPE;
282 //++ NDIS related
284 #define NDIS_STATUS int
285 #define NTSTATUS int
287 typedef enum __DEVICE_NDIS_STATUS {
288 STATUS_SUCCESS=0,
289 STATUS_FAILURE,
290 STATUS_RESOURCES,
291 STATUS_PENDING,
292 } DEVICE_NDIS_STATUS, *PDEVICE_NDIS_STATUS;
295 #define MAX_BSSIDINFO_4_PMKID 16
296 #define MAX_PMKIDLIST 5
297 //Flags for PMKID Candidate list structure
298 #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01
300 // PMKID Structures
301 typedef UCHAR NDIS_802_11_PMKID_VALUE[16];
304 typedef enum _NDIS_802_11_WEP_STATUS
306 Ndis802_11WEPEnabled,
307 Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
308 Ndis802_11WEPDisabled,
309 Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
310 Ndis802_11WEPKeyAbsent,
311 Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
312 Ndis802_11WEPNotSupported,
313 Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
314 Ndis802_11Encryption2Enabled,
315 Ndis802_11Encryption2KeyAbsent,
316 Ndis802_11Encryption3Enabled,
317 Ndis802_11Encryption3KeyAbsent
318 } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
319 NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
322 typedef enum _NDIS_802_11_STATUS_TYPE
324 Ndis802_11StatusType_Authentication,
325 Ndis802_11StatusType_MediaStreamMode,
326 Ndis802_11StatusType_PMKID_CandidateList,
327 Ndis802_11StatusTypeMax // not a real type, defined as an upper bound
328 } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
330 //Added new types for PMKID Candidate lists.
331 typedef struct _PMKID_CANDIDATE {
332 NDIS_802_11_MAC_ADDRESS BSSID;
333 ULONG Flags;
334 } PMKID_CANDIDATE, *PPMKID_CANDIDATE;
337 typedef struct _BSSID_INFO
339 NDIS_802_11_MAC_ADDRESS BSSID;
340 NDIS_802_11_PMKID_VALUE PMKID;
341 } BSSID_INFO, *PBSSID_INFO;
343 typedef struct tagSPMKID {
344 ULONG Length;
345 ULONG BSSIDInfoCount;
346 BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID];
347 } SPMKID, *PSPMKID;
349 typedef struct tagSPMKIDCandidateEvent {
350 NDIS_802_11_STATUS_TYPE StatusType;
351 ULONG Version; // Version of the structure
352 ULONG NumCandidates; // No. of pmkid candidates
353 PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST];
354 } SPMKIDCandidateEvent, *PSPMKIDCandidateEvent;
356 //--
358 //++ 802.11h related
359 #define MAX_QUIET_COUNT 8
361 typedef struct tagSQuietControl {
362 BOOL bEnable;
363 DWORD dwStartTime;
364 BYTE byPeriod;
365 WORD wDuration;
366 } SQuietControl, *PSQuietControl;
368 //--
371 // The receive duplicate detection cache entry
372 typedef struct tagSCacheEntry{
373 WORD wFmSequence;
374 BYTE abyAddr2[U_ETHER_ADDR_LEN];
375 WORD wFrameCtl;
376 } SCacheEntry, *PSCacheEntry;
378 typedef struct tagSCache{
379 /* The receive cache is updated circularly. The next entry to be written is
380 * indexed by the "InPtr".
382 UINT uInPtr; // Place to use next
383 SCacheEntry asCacheEntry[DUPLICATE_RX_CACHE_LENGTH];
384 } SCache, *PSCache;
386 #define CB_MAX_RX_FRAG 64
387 // DeFragment Control Block, used for collecting fragments prior to reassembly
388 typedef struct tagSDeFragControlBlock
390 WORD wSequence;
391 WORD wFragNum;
392 BYTE abyAddr2[U_ETHER_ADDR_LEN];
393 UINT uLifetime;
394 struct sk_buff* skb;
395 PBYTE pbyRxBuffer;
396 UINT cbFrameLength;
397 BOOL bInUse;
398 } SDeFragControlBlock, *PSDeFragControlBlock;
402 //flags for options
403 #define DEVICE_FLAGS_UNPLUG 0x00000001UL
404 #define DEVICE_FLAGS_PREAMBLE_TYPE 0x00000002UL
405 #define DEVICE_FLAGS_OP_MODE 0x00000004UL
406 #define DEVICE_FLAGS_PS_MODE 0x00000008UL
407 #define DEVICE_FLAGS_80211h_MODE 0x00000010UL
409 //flags for driver status
410 #define DEVICE_FLAGS_OPENED 0x00010000UL
411 #define DEVICE_FLAGS_WOL_ENABLED 0x00080000UL
412 //flags for capbilities
413 #define DEVICE_FLAGS_TX_ALIGN 0x01000000UL
414 #define DEVICE_FLAGS_HAVE_CAM 0x02000000UL
415 #define DEVICE_FLAGS_FLOW_CTRL 0x04000000UL
417 //flags for MII status
418 #define DEVICE_LINK_FAIL 0x00000001UL
419 #define DEVICE_SPEED_10 0x00000002UL
420 #define DEVICE_SPEED_100 0x00000004UL
421 #define DEVICE_SPEED_1000 0x00000008UL
422 #define DEVICE_DUPLEX_FULL 0x00000010UL
423 #define DEVICE_AUTONEG_ENABLE 0x00000020UL
424 #define DEVICE_FORCED_BY_EEPROM 0x00000040UL
425 //for device_set_media_duplex
426 #define DEVICE_LINK_CHANGE 0x00000001UL
429 typedef struct __device_opt {
430 int nRxDescs0; //Number of RX descriptors0
431 int nTxDescs0; //Number of TX descriptors 0, 1, 2, 3
432 int rts_thresh; //rts threshold
433 int frag_thresh;
434 int OpMode;
435 int data_rate;
436 int channel_num;
437 int short_retry;
438 int long_retry;
439 int bbp_type;
440 U32 flags;
441 } OPTIONS, *POPTIONS;
444 typedef struct __device_info {
446 // netdev
447 struct usb_device* usb;
448 struct net_device* dev;
449 struct net_device_stats stats;
451 OPTIONS sOpts;
453 struct tasklet_struct CmdWorkItem;
454 struct tasklet_struct EventWorkItem;
455 struct tasklet_struct ReadWorkItem;
456 struct tasklet_struct RxMngWorkItem;
458 U32 rx_buf_sz;
459 int multicast_limit;
460 BYTE byRxMode;
462 spinlock_t lock;
464 U32 rx_bytes;
466 BYTE byRevId;
468 U32 flags;
469 ULONG Flags;
471 SCache sDupRxCache;
473 SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG];
474 UINT cbDFCB;
475 UINT cbFreeDFCB;
476 UINT uCurrentDFCBIdx;
478 // +++USB
480 struct urb *pControlURB;
481 struct urb *pInterruptURB;
482 struct usb_ctrlrequest sUsbCtlRequest;
484 UINT int_interval;
486 // Variables to track resources for the BULK In Pipe
488 PRCB pRCBMem;
489 PRCB apRCB[CB_MAX_RX_DESC];
490 UINT cbRD;
491 PRCB FirstRecvFreeList;
492 PRCB LastRecvFreeList;
493 UINT NumRecvFreeList;
494 PRCB FirstRecvMngList;
495 PRCB LastRecvMngList;
496 UINT NumRecvMngList;
497 BOOL bIsRxWorkItemQueued;
498 BOOL bIsRxMngWorkItemQueued;
499 ULONG ulRcvRefCount; // number of packets that have not been returned back
502 // Variables to track resources for the BULK Out Pipe
505 PUSB_SEND_CONTEXT apTD[CB_MAX_TX_DESC];
506 UINT cbTD;
509 // Variables to track resources for the Interript In Pipe
511 INT_BUFFER intBuf;
512 BOOL fKillEventPollingThread;
513 BOOL bEventAvailable;
516 //default config from file by user setting
517 DEFAULT_CONFIG config_file;
521 // Statistic for USB
522 // protect with spinlock
523 ULONG ulBulkInPosted;
524 ULONG ulBulkInError;
525 ULONG ulBulkInContCRCError;
526 ULONG ulBulkInBytesRead;
528 ULONG ulBulkOutPosted;
529 ULONG ulBulkOutError;
530 ULONG ulBulkOutContCRCError;
531 ULONG ulBulkOutBytesWrite;
533 ULONG ulIntInPosted;
534 ULONG ulIntInError;
535 ULONG ulIntInContCRCError;
536 ULONG ulIntInBytesRead;
539 // Version control
540 WORD wFirmwareVersion;
541 BYTE byLocalID;
542 BYTE byRFType;
543 BYTE byBBRxConf;
546 BYTE byZoneType;
547 BOOL bZoneRegExist;
549 BYTE byOriginalZonetype;
551 BOOL bLinkPass; // link status: OK or fail
552 BYTE abyCurrentNetAddr[U_ETHER_ADDR_LEN];
553 BYTE abyPermanentNetAddr[U_ETHER_ADDR_LEN];
554 // SW network address
555 // BYTE abySoftwareNetAddr[U_ETHER_ADDR_LEN];
556 BOOL bExistSWNetAddr;
558 // Adapter statistics
559 SStatCounter scStatistic;
560 // 802.11 counter
561 SDot11Counters s802_11Counter;
564 // Maintain statistical debug info.
566 ULONG packetsReceived;
567 ULONG packetsReceivedDropped;
568 ULONG packetsReceivedOverflow;
569 ULONG packetsSent;
570 ULONG packetsSentDropped;
571 ULONG SendContextsInUse;
572 ULONG RcvBuffersInUse;
575 // 802.11 management
576 SMgmtObject sMgmtObj;
578 QWORD qwCurrTSF;
579 UINT cbBulkInMax;
580 BOOL bPSRxBeacon;
582 // 802.11 MAC specific
583 UINT uCurrRSSI;
584 BYTE byCurrSQ;
587 //Antenna Diversity
588 BOOL bTxRxAntInv;
589 DWORD dwRxAntennaSel;
590 DWORD dwTxAntennaSel;
591 BYTE byAntennaCount;
592 BYTE byRxAntennaMode;
593 BYTE byTxAntennaMode;
594 BYTE byRadioCtl;
595 BYTE bHWRadioOff;
597 //SQ3 functions for antenna diversity
598 struct timer_list TimerSQ3Tmax1;
599 struct timer_list TimerSQ3Tmax2;
600 struct timer_list TimerSQ3Tmax3;
602 BOOL bDiversityRegCtlON;
603 BOOL bDiversityEnable;
604 ULONG ulDiversityNValue;
605 ULONG ulDiversityMValue;
606 BYTE byTMax;
607 BYTE byTMax2;
608 BYTE byTMax3;
609 ULONG ulSQ3TH;
611 ULONG uDiversityCnt;
612 BYTE byAntennaState;
613 ULONG ulRatio_State0;
614 ULONG ulRatio_State1;
615 ULONG ulSQ3_State0;
616 ULONG ulSQ3_State1;
618 ULONG aulSQ3Val[MAX_RATE];
619 ULONG aulPktNum[MAX_RATE];
621 // IFS & Cw
622 UINT uSIFS; //Current SIFS
623 UINT uDIFS; //Current DIFS
624 UINT uEIFS; //Current EIFS
625 UINT uSlot; //Current SlotTime
626 UINT uCwMin; //Current CwMin
627 UINT uCwMax; //CwMax is fixed on 1023.
628 // PHY parameter
629 BYTE bySIFS;
630 BYTE byDIFS;
631 BYTE byEIFS;
632 BYTE bySlot;
633 BYTE byCWMaxMin;
635 // Rate
636 VIA_BB_TYPE byBBType; //0: 11A, 1:11B, 2:11G
637 VIA_PKT_TYPE byPacketType; //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
638 WORD wBasicRate;
639 BYTE byACKRate;
640 BYTE byTopOFDMBasicRate;
641 BYTE byTopCCKBasicRate;
644 DWORD dwAotoRateTxOkCnt;
645 DWORD dwAotoRateTxFailCnt;
646 DWORD dwErrorRateThreshold[13];
647 DWORD dwTPTable[MAX_RATE];
648 BYTE abyEEPROM[EEP_MAX_CONTEXT_SIZE]; //DWORD alignment
650 BYTE byMinChannel;
651 BYTE byMaxChannel;
652 UINT uConnectionRate;
654 BYTE byPreambleType;
655 BYTE byShortPreamble;
656 // CARD_PHY_TYPE
657 BYTE eConfigPHYMode;
659 // For RF Power table
660 BYTE byCCKPwr;
661 BYTE byOFDMPwrG;
662 BYTE byOFDMPwrA;
663 BYTE byCurPwr;
664 BYTE abyCCKPwrTbl[14];
665 BYTE abyOFDMPwrTbl[14];
666 BYTE abyOFDMAPwrTbl[42];
668 WORD wCurrentRate;
669 WORD wRTSThreshold;
670 WORD wFragmentationThreshold;
671 BYTE byShortRetryLimit;
672 BYTE byLongRetryLimit;
673 CARD_OP_MODE eOPMode;
674 BOOL bBSSIDFilter;
675 WORD wMaxTransmitMSDULifetime;
676 BYTE abyBSSID[U_ETHER_ADDR_LEN];
677 BYTE abyDesireBSSID[U_ETHER_ADDR_LEN];
678 WORD wCTSDuration; // update while speed change
679 WORD wACKDuration; // update while speed change
680 WORD wRTSTransmitLen; // update while speed change
681 BYTE byRTSServiceField; // update while speed change
682 BYTE byRTSSignalField; // update while speed change
684 DWORD dwMaxReceiveLifetime; // dot11MaxReceiveLifetime
686 BOOL bCCK;
687 BOOL bEncryptionEnable;
688 BOOL bLongHeader;
689 BOOL bSoftwareGenCrcErr;
690 BOOL bShortSlotTime;
691 BOOL bProtectMode;
692 BOOL bNonERPPresent;
693 BOOL bBarkerPreambleMd;
695 BYTE byERPFlag;
696 WORD wUseProtectCntDown;
698 BOOL bRadioControlOff;
699 BOOL bRadioOff;
701 // Power save
702 BOOL bEnablePSMode;
703 WORD wListenInterval;
704 BOOL bPWBitOn;
705 WMAC_POWER_MODE ePSMode;
706 ULONG ulPSModeWaitTx;
707 BOOL bPSModeTxBurst;
709 // Beacon releated
710 WORD wSeqCounter;
711 BOOL bBeaconBufReady;
712 BOOL bBeaconSent;
713 BOOL bFixRate;
714 BYTE byCurrentCh;
715 UINT uScanTime;
717 CMD_STATE eCommandState;
719 CMD_CODE eCommand;
720 BOOL bBeaconTx;
721 BYTE byScanBBType;
723 BOOL bStopBeacon;
724 BOOL bStopDataPkt;
725 BOOL bStopTx0Pkt;
726 UINT uAutoReConnectTime;
727 UINT uIsroamingTime;
729 // 802.11 counter
731 CMD_ITEM eCmdQueue[CMD_Q_SIZE];
732 UINT uCmdDequeueIdx;
733 UINT uCmdEnqueueIdx;
734 UINT cbFreeCmdQueue;
735 BOOL bCmdRunning;
736 BOOL bCmdClear;
737 BOOL bNeedRadioOFF;
739 BOOL bEnableRoaming; //DavidWang
740 BOOL bIsRoaming; //DavidWang
741 BOOL bFastRoaming; //DavidWang
742 BYTE bSameBSSMaxNum; //Davidwang
743 BYTE bSameBSSCurNum; //DavidWang
744 BOOL bRoaming;
745 BOOL b11hEable;
746 ULONG ulTxPower;
748 // Encryption
749 NDIS_802_11_WEP_STATUS eEncryptionStatus;
750 BOOL bTransmitKey;
752 //2007-0925-01<Add>by MikeLiu
753 //mike add :save old Encryption
754 NDIS_802_11_WEP_STATUS eOldEncryptionStatus;
756 SKeyManagement sKey;
757 DWORD dwIVCounter;
760 RC4Ext SBox;
761 BYTE abyPRNG[WLAN_WEPMAX_KEYLEN+3];
762 BYTE byKeyIndex;
764 BOOL bAES;
765 BYTE byCntMeasure;
767 UINT uKeyLength;
768 BYTE abyKey[WLAN_WEP232_KEYLEN];
770 // for AP mode
771 UINT uAssocCount;
772 BOOL bMoreData;
774 // QoS
775 BOOL bGrpAckPolicy;
778 BYTE byAutoFBCtrl;
780 BOOL bTxMICFail;
781 BOOL bRxMICFail;
784 // For Update BaseBand VGA Gain Offset
785 BOOL bUpdateBBVGA;
786 UINT uBBVGADiffCount;
787 BYTE byBBVGANew;
788 BYTE byBBVGACurrent;
789 BYTE abyBBVGA[BB_VGA_LEVEL];
790 LONG ldBmThreshold[BB_VGA_LEVEL];
792 BYTE byBBPreEDRSSI;
793 BYTE byBBPreEDIndex;
796 BOOL bRadioCmd;
797 DWORD dwDiagRefCount;
799 // For FOE Tuning
800 BYTE byFOETuning;
802 // For Auto Power Tunning
804 BYTE byAutoPwrTunning;
806 // BaseBand Loopback Use
807 BYTE byBBCR4d;
808 BYTE byBBCRc9;
809 BYTE byBBCR88;
810 BYTE byBBCR09;
812 // command timer
813 struct timer_list sTimerCommand;
815 //2007-0115-01<Add>by MikeLiu
816 #ifdef TxInSleep
817 struct timer_list sTimerTxData;
818 ULONG nTxDataTimeCout;
819 BOOL fTxDataInSleep;
820 BOOL IsTxDataTrigger;
821 #endif
823 #ifdef WPA_SM_Transtatus
824 BOOL fWPA_Authened; //is WPA/WPA-PSK or WPA2/WPA2-PSK authen??
825 #endif
826 BYTE byReAssocCount; //mike add:re-association retry times!
827 BYTE byLinkWaitCount;
829 SEthernetHeader sTxEthHeader;
830 SEthernetHeader sRxEthHeader;
831 BYTE abyBroadcastAddr[U_ETHER_ADDR_LEN];
832 BYTE abySNAP_RFC1042[U_ETHER_ADDR_LEN];
833 BYTE abySNAP_Bridgetunnel[U_ETHER_ADDR_LEN];
835 // Pre-Authentication & PMK cache
836 SPMKID gsPMKID;
837 SPMKIDCandidateEvent gsPMKIDCandidate;
840 // for 802.11h
841 BOOL b11hEnable;
843 BOOL bChannelSwitch;
844 BYTE byNewChannel;
845 BYTE byChannelSwitchCount;
847 //WPA supplicant daemon
848 struct net_device *wpadev;
849 BOOL bWPADEVUp;
850 struct sk_buff *skb;
851 //--
853 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
854 BOOL bwextstep0;
855 BOOL bwextstep1;
856 BOOL bwextstep2;
857 BOOL bwextstep3;
858 BOOL bWPASuppWextEnabled;
859 #endif
861 #ifdef HOSTAP
862 // user space daemon: hostapd, is used for HOSTAP
863 BOOL bEnableHostapd;
864 BOOL bEnable8021x;
865 BOOL bEnableHostWEP;
866 struct net_device *apdev;
867 int (*tx_80211)(struct sk_buff *skb, struct net_device *dev);
868 #endif
869 UINT uChannel;
871 struct iw_statistics wstats; // wireless stats
872 BOOL bCommit;
874 } DEVICE_INFO, *PSDevice;
879 #define EnqueueRCB(_Head, _Tail, _RCB) \
881 if (!_Head) { \
882 _Head = _RCB; \
884 else { \
885 _Tail->Next = _RCB; \
887 _RCB->Next = NULL; \
888 _Tail = _RCB; \
891 #define DequeueRCB(Head, Tail) \
893 PRCB RCB = Head; \
894 if (!RCB->Next) { \
895 Tail = NULL; \
897 Head = RCB->Next; \
901 #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \
902 if ((uVar) >= ((uModulo) - 1)) \
903 (uVar) = 0; \
904 else \
905 (uVar)++; \
909 #define fMP_RESET_IN_PROGRESS 0x00000001
910 #define fMP_DISCONNECTED 0x00000002
911 #define fMP_HALT_IN_PROGRESS 0x00000004
912 #define fMP_SURPRISE_REMOVED 0x00000008
913 #define fMP_RECV_LOOKASIDE 0x00000010
914 #define fMP_INIT_IN_PROGRESS 0x00000020
915 #define fMP_SEND_SIDE_RESOURCE_ALLOCATED 0x00000040
916 #define fMP_RECV_SIDE_RESOURCE_ALLOCATED 0x00000080
917 #define fMP_POST_READS 0x00000100
918 #define fMP_POST_WRITES 0x00000200
919 #define fMP_CONTROL_READS 0x00000400
920 #define fMP_CONTROL_WRITES 0x00000800
924 #define MP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F))
925 #define MP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F))
926 #define MP_TEST_FLAG(_M, _F) (((_M)->Flags & (_F)) != 0)
927 #define MP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F))
929 #define MP_IS_READY(_M) (((_M)->Flags & \
930 (fMP_DISCONNECTED | fMP_RESET_IN_PROGRESS | fMP_HALT_IN_PROGRESS | fMP_INIT_IN_PROGRESS | fMP_SURPRISE_REMOVED)) == 0)
932 /*--------------------- Export Functions --------------------------*/
934 //BOOL device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, UINT uNodeIndex);
935 BOOL device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF);
937 #endif