Merge branch 'sa1100' into devel
[deliverable/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/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
70
71 #ifndef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
72 #define WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
73 #endif
74
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
86
87 //
88 // device specific
89 //
90
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"
104
105 /*--------------------- Export Definitions -------------------------*/
106 #define VNT_USB_VENDOR_ID 0x160A
107 #define VNT_USB_PRODUCT_ID 0x3184
108
109 #define MAC_MAX_CONTEXT_REG (256+128)
110
111 #define MAX_MULTICAST_ADDRESS_NUM 32
112 #define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * U_ETHER_ADDR_LEN)
113
114
115 //#define OP_MODE_INFRASTRUCTURE 0
116 //#define OP_MODE_ADHOC 1
117 //#define OP_MODE_AP 2
118
119 #define DUPLICATE_RX_CACHE_LENGTH 5
120
121 #define NUM_KEY_ENTRY 11
122
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
129
130 #define KEYSEL_WEP40 0
131 #define KEYSEL_WEP104 1
132 #define KEYSEL_TKIP 2
133 #define KEYSEL_CCMP 3
134
135
136
137 #define AUTO_FB_NONE 0
138 #define AUTO_FB_0 1
139 #define AUTO_FB_1 2
140
141 #define FB_RATE0 0
142 #define FB_RATE1 1
143
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
155
156
157 #define MAXCHECKHANGCNT 4
158
159 //Packet type
160 #define TX_PKT_UNI 0x00
161 #define TX_PKT_MULTI 0x01
162 #define TX_PKT_BROAD 0x02
163
164 #define BB_VGA_LEVEL 4
165 #define BB_VGA_CHANGE_THRESHOLD 3
166
167
168
169 #ifndef RUN_AT
170 #define RUN_AT(x) (jiffies+(x))
171 #endif
172
173 // DMA related
174 #define RESERV_AC0DMA 4
175
176 #define PRIVATE_Message 0
177
178 /*--------------------- Export Types ------------------------------*/
179
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);}
182
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;
190
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;
196
197
198 //USB
199
200 //
201 // Enum of context types for SendPacket
202 //
203 typedef enum _CONTEXT_TYPE {
204 CONTEXT_DATA_PACKET = 1,
205 CONTEXT_MGMT_PACKET
206 } CONTEXT_TYPE;
207
208
209
210
211 // RCB (Receive Control Block)
212 typedef struct _RCB
213 {
214 PVOID Next;
215 LONG Ref;
216 PVOID pDevice;
217 struct urb *pUrb;
218 SRxMgmtPacket sMngPacket;
219 struct sk_buff* skb;
220 BOOL bBoolInUse;
221
222 } RCB, *PRCB;
223
224
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;
237
238
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;
247
248 }DEFAULT_CONFIG,*PDEFAULT_CONFIG;
249
250 //
251 // Structure to keep track of usb interrupt packets
252 //
253 typedef struct {
254 UINT uDataLen;
255 PBYTE pDataBuf;
256 // struct urb *pUrb;
257 BOOL bInUse;
258 } INT_BUFFER, *PINT_BUFFER;
259
260
261
262 //0:11A 1:11B 2:11G
263 typedef enum _VIA_BB_TYPE
264 {
265 BB_TYPE_11A=0,
266 BB_TYPE_11B,
267 BB_TYPE_11G
268 } VIA_BB_TYPE, *PVIA_BB_TYPE;
269
270 //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
271 typedef enum _VIA_PKT_TYPE
272 {
273 PK_TYPE_11A=0,
274 PK_TYPE_11B,
275 PK_TYPE_11GB,
276 PK_TYPE_11GA
277 } VIA_PKT_TYPE, *PVIA_PKT_TYPE;
278
279
280
281
282 //++ NDIS related
283
284 #define NDIS_STATUS int
285 #define NTSTATUS int
286
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;
293
294
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
299
300 // PMKID Structures
301 typedef UCHAR NDIS_802_11_PMKID_VALUE[16];
302
303
304 typedef enum _NDIS_802_11_WEP_STATUS
305 {
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;
320
321
322 typedef enum _NDIS_802_11_STATUS_TYPE
323 {
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;
329
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;
335
336
337 typedef struct _BSSID_INFO
338 {
339 NDIS_802_11_MAC_ADDRESS BSSID;
340 NDIS_802_11_PMKID_VALUE PMKID;
341 } BSSID_INFO, *PBSSID_INFO;
342
343 typedef struct tagSPMKID {
344 ULONG Length;
345 ULONG BSSIDInfoCount;
346 BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID];
347 } SPMKID, *PSPMKID;
348
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;
355
356 //--
357
358 //++ 802.11h related
359 #define MAX_QUIET_COUNT 8
360
361 typedef struct tagSQuietControl {
362 BOOL bEnable;
363 DWORD dwStartTime;
364 BYTE byPeriod;
365 WORD wDuration;
366 } SQuietControl, *PSQuietControl;
367
368 //--
369
370
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;
377
378 typedef struct tagSCache{
379 /* The receive cache is updated circularly. The next entry to be written is
380 * indexed by the "InPtr".
381 */
382 UINT uInPtr; // Place to use next
383 SCacheEntry asCacheEntry[DUPLICATE_RX_CACHE_LENGTH];
384 } SCache, *PSCache;
385
386 #define CB_MAX_RX_FRAG 64
387 // DeFragment Control Block, used for collecting fragments prior to reassembly
388 typedef struct tagSDeFragControlBlock
389 {
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;
399
400
401
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
408
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
416
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
427
428
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;
442
443
444 typedef struct __device_info {
445
446 // netdev
447 struct usb_device* usb;
448 struct net_device* dev;
449 struct net_device_stats stats;
450
451 OPTIONS sOpts;
452
453 struct tasklet_struct CmdWorkItem;
454 struct tasklet_struct EventWorkItem;
455 struct tasklet_struct ReadWorkItem;
456 struct tasklet_struct RxMngWorkItem;
457
458 U32 rx_buf_sz;
459 int multicast_limit;
460 BYTE byRxMode;
461
462 spinlock_t lock;
463
464 U32 rx_bytes;
465
466 BYTE byRevId;
467
468 U32 flags;
469 ULONG Flags;
470
471 SCache sDupRxCache;
472
473 SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG];
474 UINT cbDFCB;
475 UINT cbFreeDFCB;
476 UINT uCurrentDFCBIdx;
477
478 // +++USB
479
480 struct urb *pControlURB;
481 struct urb *pInterruptURB;
482 struct usb_ctrlrequest sUsbCtlRequest;
483
484 UINT int_interval;
485 //
486 // Variables to track resources for the BULK In Pipe
487 //
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
500
501 //
502 // Variables to track resources for the BULK Out Pipe
503 //
504
505 PUSB_SEND_CONTEXT apTD[CB_MAX_TX_DESC];
506 UINT cbTD;
507
508 //
509 // Variables to track resources for the Interript In Pipe
510 //
511 INT_BUFFER intBuf;
512 BOOL fKillEventPollingThread;
513 BOOL bEventAvailable;
514
515
516 //default config from file by user setting
517 DEFAULT_CONFIG config_file;
518
519
520 //
521 // Statistic for USB
522 // protect with spinlock
523 ULONG ulBulkInPosted;
524 ULONG ulBulkInError;
525 ULONG ulBulkInContCRCError;
526 ULONG ulBulkInBytesRead;
527
528 ULONG ulBulkOutPosted;
529 ULONG ulBulkOutError;
530 ULONG ulBulkOutContCRCError;
531 ULONG ulBulkOutBytesWrite;
532
533 ULONG ulIntInPosted;
534 ULONG ulIntInError;
535 ULONG ulIntInContCRCError;
536 ULONG ulIntInBytesRead;
537
538
539 // Version control
540 WORD wFirmwareVersion;
541 BYTE byLocalID;
542 BYTE byRFType;
543 BYTE byBBRxConf;
544
545
546 BYTE byZoneType;
547 BOOL bZoneRegExist;
548
549 BYTE byOriginalZonetype;
550
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;
557
558 // Adapter statistics
559 SStatCounter scStatistic;
560 // 802.11 counter
561 SDot11Counters s802_11Counter;
562
563 //
564 // Maintain statistical debug info.
565 //
566 ULONG packetsReceived;
567 ULONG packetsReceivedDropped;
568 ULONG packetsReceivedOverflow;
569 ULONG packetsSent;
570 ULONG packetsSentDropped;
571 ULONG SendContextsInUse;
572 ULONG RcvBuffersInUse;
573
574
575 // 802.11 management
576 SMgmtObject sMgmtObj;
577
578 QWORD qwCurrTSF;
579 UINT cbBulkInMax;
580 BOOL bPSRxBeacon;
581
582 // 802.11 MAC specific
583 UINT uCurrRSSI;
584 BYTE byCurrSQ;
585
586
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;
596
597 //SQ3 functions for antenna diversity
598 struct timer_list TimerSQ3Tmax1;
599 struct timer_list TimerSQ3Tmax2;
600 struct timer_list TimerSQ3Tmax3;
601
602 BOOL bDiversityRegCtlON;
603 BOOL bDiversityEnable;
604 ULONG ulDiversityNValue;
605 ULONG ulDiversityMValue;
606 BYTE byTMax;
607 BYTE byTMax2;
608 BYTE byTMax3;
609 ULONG ulSQ3TH;
610
611 ULONG uDiversityCnt;
612 BYTE byAntennaState;
613 ULONG ulRatio_State0;
614 ULONG ulRatio_State1;
615 ULONG ulSQ3_State0;
616 ULONG ulSQ3_State1;
617
618 ULONG aulSQ3Val[MAX_RATE];
619 ULONG aulPktNum[MAX_RATE];
620
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;
634
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;
642
643
644 DWORD dwAotoRateTxOkCnt;
645 DWORD dwAotoRateTxFailCnt;
646 DWORD dwErrorRateThreshold[13];
647 DWORD dwTPTable[MAX_RATE];
648 BYTE abyEEPROM[EEP_MAX_CONTEXT_SIZE]; //DWORD alignment
649
650 BYTE byMinChannel;
651 BYTE byMaxChannel;
652 UINT uConnectionRate;
653
654 BYTE byPreambleType;
655 BYTE byShortPreamble;
656 // CARD_PHY_TYPE
657 BYTE eConfigPHYMode;
658
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];
667
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
683
684 DWORD dwMaxReceiveLifetime; // dot11MaxReceiveLifetime
685
686 BOOL bCCK;
687 BOOL bEncryptionEnable;
688 BOOL bLongHeader;
689 BOOL bSoftwareGenCrcErr;
690 BOOL bShortSlotTime;
691 BOOL bProtectMode;
692 BOOL bNonERPPresent;
693 BOOL bBarkerPreambleMd;
694
695 BYTE byERPFlag;
696 WORD wUseProtectCntDown;
697
698 BOOL bRadioControlOff;
699 BOOL bRadioOff;
700
701 // Power save
702 BOOL bEnablePSMode;
703 WORD wListenInterval;
704 BOOL bPWBitOn;
705 WMAC_POWER_MODE ePSMode;
706 ULONG ulPSModeWaitTx;
707 BOOL bPSModeTxBurst;
708
709 // Beacon releated
710 WORD wSeqCounter;
711 BOOL bBeaconBufReady;
712 BOOL bBeaconSent;
713 BOOL bFixRate;
714 BYTE byCurrentCh;
715 UINT uScanTime;
716
717 CMD_STATE eCommandState;
718
719 CMD_CODE eCommand;
720 BOOL bBeaconTx;
721 BYTE byScanBBType;
722
723 BOOL bStopBeacon;
724 BOOL bStopDataPkt;
725 BOOL bStopTx0Pkt;
726 UINT uAutoReConnectTime;
727 UINT uIsroamingTime;
728
729 // 802.11 counter
730
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;
738
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;
747
748 // Encryption
749 NDIS_802_11_WEP_STATUS eEncryptionStatus;
750 BOOL bTransmitKey;
751
752 //2007-0925-01<Add>by MikeLiu
753 //mike add :save old Encryption
754 NDIS_802_11_WEP_STATUS eOldEncryptionStatus;
755
756 SKeyManagement sKey;
757 DWORD dwIVCounter;
758
759
760 RC4Ext SBox;
761 BYTE abyPRNG[WLAN_WEPMAX_KEYLEN+3];
762 BYTE byKeyIndex;
763
764 BOOL bAES;
765 BYTE byCntMeasure;
766
767 UINT uKeyLength;
768 BYTE abyKey[WLAN_WEP232_KEYLEN];
769
770 // for AP mode
771 UINT uAssocCount;
772 BOOL bMoreData;
773
774 // QoS
775 BOOL bGrpAckPolicy;
776
777
778 BYTE byAutoFBCtrl;
779
780 BOOL bTxMICFail;
781 BOOL bRxMICFail;
782
783
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];
791
792 BYTE byBBPreEDRSSI;
793 BYTE byBBPreEDIndex;
794
795
796 BOOL bRadioCmd;
797 DWORD dwDiagRefCount;
798
799 // For FOE Tuning
800 BYTE byFOETuning;
801
802 // For Auto Power Tunning
803
804 BYTE byAutoPwrTunning;
805
806 // BaseBand Loopback Use
807 BYTE byBBCR4d;
808 BYTE byBBCRc9;
809 BYTE byBBCR88;
810 BYTE byBBCR09;
811
812 // command timer
813 struct timer_list sTimerCommand;
814
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
822
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;
828
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];
834
835 // Pre-Authentication & PMK cache
836 SPMKID gsPMKID;
837 SPMKIDCandidateEvent gsPMKIDCandidate;
838
839
840 // for 802.11h
841 BOOL b11hEnable;
842
843 BOOL bChannelSwitch;
844 BYTE byNewChannel;
845 BYTE byChannelSwitchCount;
846
847 //WPA supplicant daemon
848 struct net_device *wpadev;
849 BOOL bWPADEVUp;
850 struct sk_buff *skb;
851 //--
852
853 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
854 BOOL bwextstep0;
855 BOOL bwextstep1;
856 BOOL bwextstep2;
857 BOOL bwextstep3;
858 BOOL bWPASuppWextEnabled;
859 #endif
860
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;
870
871 struct iw_statistics wstats; // wireless stats
872 BOOL bCommit;
873
874 } DEVICE_INFO, *PSDevice;
875
876
877
878
879 #define EnqueueRCB(_Head, _Tail, _RCB) \
880 { \
881 if (!_Head) { \
882 _Head = _RCB; \
883 } \
884 else { \
885 _Tail->Next = _RCB; \
886 } \
887 _RCB->Next = NULL; \
888 _Tail = _RCB; \
889 }
890
891 #define DequeueRCB(Head, Tail) \
892 { \
893 PRCB RCB = Head; \
894 if (!RCB->Next) { \
895 Tail = NULL; \
896 } \
897 Head = RCB->Next; \
898 }
899
900
901 #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \
902 if ((uVar) >= ((uModulo) - 1)) \
903 (uVar) = 0; \
904 else \
905 (uVar)++; \
906 }
907
908
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
921
922
923
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))
928
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)
931
932 /*--------------------- Export Functions --------------------------*/
933
934 //BOOL device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, UINT uNodeIndex);
935 BOOL device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF);
936
937 #endif
938
939
This page took 0.064886 seconds and 5 git commands to generate.