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