e8b13f782c502189d92162bb02103437bcc447a7
[deliverable/linux.git] / drivers / staging / vt6655 / 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 #ifdef MODULE
33 #ifdef MODVERSIONS
34 #include <linux/modversions.h>
35 #endif /* MODVERSIONS */
36 #include <linux/module.h>
37 #endif /* MODULE */
38
39 #include <linux/types.h>
40 #include <linux/init.h>
41 #include <linux/mm.h>
42 #include <linux/errno.h>
43 #include <linux/ioport.h>
44 #include <linux/pci.h>
45 #include <linux/kernel.h>
46 #include <linux/netdevice.h>
47 #include <linux/etherdevice.h>
48 #include <linux/skbuff.h>
49 #include <linux/delay.h>
50 #include <linux/timer.h>
51 #include <linux/slab.h>
52 #include <linux/interrupt.h>
53 #include <linux/version.h>
54 #include <linux/string.h>
55 #include <linux/wait.h>
56 #include <linux/if_arp.h>
57 #include <linux/sched.h>
58 #include <asm/io.h>
59 #include <linux/if.h>
60 //#include <linux/config.h>
61 #include <asm/uaccess.h>
62 #include <linux/proc_fs.h>
63 #include <linux/inetdevice.h>
64 #include <linux/reboot.h>
65 #ifdef SIOCETHTOOL
66 #define DEVICE_ETHTOOL_IOCTL_SUPPORT
67 #include <linux/ethtool.h>
68 #else
69 #undef DEVICE_ETHTOOL_IOCTL_SUPPORT
70 #endif
71 /* Include Wireless Extension definition and check version - Jean II */
72 #include <linux/wireless.h>
73 #include <net/iw_handler.h> // New driver API
74
75 //2008-0409-07, <Add> by Einsn Liu
76 #ifndef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
77 #define WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
78 #endif
79 //2008-4-14<add> by chester for led issue
80 //#define FOR_LED_ON_NOTEBOOK
81 //
82
83
84 //
85 // device specific
86 //
87
88 #if !defined(_KCOMPAT_H)
89 #include "kcompat.h"
90 #endif
91
92 #if !defined(__DEVICE_CONFIG_H)
93 #include "device_cfg.h"
94 #endif
95
96 #if !defined(__TTYPE_H__)
97 #include "ttype.h"
98 #endif
99 #if !defined(__80211HDR_H__)
100 #include "80211hdr.h"
101 #endif
102 #if !defined(__TETHER_H__)
103 #include "tether.h"
104 #endif
105 #if !defined(__WMGR_H__)
106 #include "wmgr.h"
107 #endif
108 #if !defined(__WCMD_H__)
109 #include "wcmd.h"
110 #endif
111 #if !defined(__MIB_H__)
112 #include "mib.h"
113 #endif
114 #if !defined(__SROM_H__)
115 #include "srom.h"
116 #endif
117 #if !defined(__RC4_H__)
118 #include "rc4.h"
119 #endif
120 #if !defined(__TPCI_H__)
121 #include "tpci.h"
122 #endif
123 #if !defined(__DESC_H__)
124 #include "desc.h"
125 #endif
126 #if !defined(__KEY_H__)
127 #include "key.h"
128 #endif
129 #if !defined(__MAC_H__)
130 #include "mac.h"
131 #endif
132
133 //PLICE_DEBUG->
134 //#define THREAD
135
136 //#define TASK_LET
137 //PLICE_DEBUG<-
138
139
140 /*--------------------- Export Definitions -------------------------*/
141
142 #define MAC_MAX_CONTEXT_REG (256+128)
143
144 #define MAX_MULTICAST_ADDRESS_NUM 32
145 #define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * U_ETHER_ADDR_LEN)
146
147
148 //#define OP_MODE_INFRASTRUCTURE 0
149 //#define OP_MODE_ADHOC 1
150 //#define OP_MODE_AP 2
151
152 #define DUPLICATE_RX_CACHE_LENGTH 5
153
154 #define NUM_KEY_ENTRY 11
155
156 #define TX_WEP_NONE 0
157 #define TX_WEP_OTF 1
158 #define TX_WEP_SW 2
159 #define TX_WEP_SWOTP 3
160 #define TX_WEP_OTPSW 4
161 #define TX_WEP_SW232 5
162
163 #define KEYSEL_WEP40 0
164 #define KEYSEL_WEP104 1
165 #define KEYSEL_TKIP 2
166 #define KEYSEL_CCMP 3
167
168
169
170 #define AUTO_FB_NONE 0
171 #define AUTO_FB_0 1
172 #define AUTO_FB_1 2
173
174 #define FB_RATE0 0
175 #define FB_RATE1 1
176
177 // Antenna Mode
178 #define ANT_A 0
179 #define ANT_B 1
180 #define ANT_DIVERSITY 2
181 #define ANT_RXD_TXA 3
182 #define ANT_RXD_TXB 4
183 #define ANT_UNKNOWN 0xFF
184
185 #define MAXCHECKHANGCNT 4
186
187 #define BB_VGA_LEVEL 4
188 #define BB_VGA_CHANGE_THRESHOLD 16
189
190
191
192 #ifndef RUN_AT
193 #define RUN_AT(x) (jiffies+(x))
194 #endif
195
196 // DMA related
197 #define RESERV_AC0DMA 4
198
199
200 // BUILD OBJ mode
201
202
203 #define AVAIL_TD(p,q) ((p)->sOpts.nTxDescs[(q)]-((p)->iTDUsed[(q)]))
204
205 //PLICE_DEBUG ->
206 #define NUM 64
207 //PLICE_DEUBG <-
208
209
210
211 #define PRIVATE_Message 0
212
213 /*--------------------- Export Types ------------------------------*/
214
215
216 #define DBG_PRT(l, p, args...) {if (l<=msglevel) printk( p ,##args);}
217 #define PRINT_K(p, args...) {if (PRIVATE_Message) printk( p ,##args);}
218
219 //0:11A 1:11B 2:11G
220 typedef enum _VIA_BB_TYPE
221 {
222 BB_TYPE_11A=0,
223 BB_TYPE_11B,
224 BB_TYPE_11G
225 } VIA_BB_TYPE, *PVIA_BB_TYPE;
226
227 //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
228 typedef enum _VIA_PKT_TYPE
229 {
230 PK_TYPE_11A=0,
231 PK_TYPE_11B,
232 PK_TYPE_11GB,
233 PK_TYPE_11GA
234 } VIA_PKT_TYPE, *PVIA_PKT_TYPE;
235
236
237 typedef enum __device_msg_level {
238 MSG_LEVEL_ERR=0, //Errors that will cause abnormal operation.
239 MSG_LEVEL_NOTICE=1, //Some errors need users to be notified.
240 MSG_LEVEL_INFO=2, //Normal message.
241 MSG_LEVEL_VERBOSE=3, //Will report all trival errors.
242 MSG_LEVEL_DEBUG=4 //Only for debug purpose.
243 } DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL;
244
245 typedef enum __device_init_type {
246 DEVICE_INIT_COLD=0, // cold init
247 DEVICE_INIT_RESET, // reset init or Dx to D0 power remain init
248 DEVICE_INIT_DXPL // Dx to D0 power lost init
249 } DEVICE_INIT_TYPE, *PDEVICE_INIT_TYPE;
250
251
252 //++ NDIS related
253
254 #define MAX_BSSIDINFO_4_PMKID 16
255 #define MAX_PMKIDLIST 5
256 //Flags for PMKID Candidate list structure
257 #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01
258
259 // PMKID Structures
260 typedef UCHAR NDIS_802_11_PMKID_VALUE[16];
261
262
263 typedef enum _NDIS_802_11_WEP_STATUS
264 {
265 Ndis802_11WEPEnabled,
266 Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
267 Ndis802_11WEPDisabled,
268 Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
269 Ndis802_11WEPKeyAbsent,
270 Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
271 Ndis802_11WEPNotSupported,
272 Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
273 Ndis802_11Encryption2Enabled,
274 Ndis802_11Encryption2KeyAbsent,
275 Ndis802_11Encryption3Enabled,
276 Ndis802_11Encryption3KeyAbsent
277 } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
278 NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
279
280
281 typedef enum _NDIS_802_11_STATUS_TYPE
282 {
283 Ndis802_11StatusType_Authentication,
284 Ndis802_11StatusType_MediaStreamMode,
285 Ndis802_11StatusType_PMKID_CandidateList,
286 Ndis802_11StatusTypeMax // not a real type, defined as an upper bound
287 } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
288
289 //Added new types for PMKID Candidate lists.
290 typedef struct _PMKID_CANDIDATE {
291 NDIS_802_11_MAC_ADDRESS BSSID;
292 ULONG Flags;
293 } PMKID_CANDIDATE, *PPMKID_CANDIDATE;
294
295
296 typedef struct _BSSID_INFO
297 {
298 NDIS_802_11_MAC_ADDRESS BSSID;
299 NDIS_802_11_PMKID_VALUE PMKID;
300 } BSSID_INFO, *PBSSID_INFO;
301
302 typedef struct tagSPMKID {
303 ULONG Length;
304 ULONG BSSIDInfoCount;
305 BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID];
306 } SPMKID, *PSPMKID;
307
308 typedef struct tagSPMKIDCandidateEvent {
309 NDIS_802_11_STATUS_TYPE StatusType;
310 ULONG Version; // Version of the structure
311 ULONG NumCandidates; // No. of pmkid candidates
312 PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST];
313 } SPMKIDCandidateEvent, *PSPMKIDCandidateEvent;
314
315 //--
316
317 //++ 802.11h related
318 #define MAX_QUIET_COUNT 8
319
320 typedef struct tagSQuietControl {
321 BOOL bEnable;
322 DWORD dwStartTime;
323 BYTE byPeriod;
324 WORD wDuration;
325 } SQuietControl, *PSQuietControl;
326
327 //--
328 typedef struct __chip_info_tbl{
329 CHIP_TYPE chip_id;
330 char* name;
331 int io_size;
332 int nTxQueue;
333 U32 flags;
334 } CHIP_INFO, *PCHIP_INFO;
335
336
337 typedef enum {
338 OWNED_BY_HOST=0,
339 OWNED_BY_NIC=1
340 } DEVICE_OWNER_TYPE, *PDEVICE_OWNER_TYPE;
341
342
343 // The receive duplicate detection cache entry
344 typedef struct tagSCacheEntry{
345 WORD wFmSequence;
346 BYTE abyAddr2[U_ETHER_ADDR_LEN];
347 } SCacheEntry, *PSCacheEntry;
348
349 typedef struct tagSCache{
350 /* The receive cache is updated circularly. The next entry to be written is
351 * indexed by the "InPtr".
352 */
353 UINT uInPtr; // Place to use next
354 SCacheEntry asCacheEntry[DUPLICATE_RX_CACHE_LENGTH];
355 } SCache, *PSCache;
356
357 #define CB_MAX_RX_FRAG 64
358 // DeFragment Control Block, used for collecting fragments prior to reassembly
359 typedef struct tagSDeFragControlBlock
360 {
361 WORD wSequence;
362 WORD wFragNum;
363 BYTE abyAddr2[U_ETHER_ADDR_LEN];
364 UINT uLifetime;
365 struct sk_buff* skb;
366 PBYTE pbyRxBuffer;
367 UINT cbFrameLength;
368 BOOL bInUse;
369 } SDeFragControlBlock, *PSDeFragControlBlock;
370
371
372
373 //flags for options
374 #define DEVICE_FLAGS_IP_ALIGN 0x00000001UL
375 #define DEVICE_FLAGS_PREAMBLE_TYPE 0x00000002UL
376 #define DEVICE_FLAGS_OP_MODE 0x00000004UL
377 #define DEVICE_FLAGS_PS_MODE 0x00000008UL
378 #define DEVICE_FLAGS_80211h_MODE 0x00000010UL
379 #define DEVICE_FLAGS_DiversityANT 0x00000020UL
380
381 //flags for driver status
382 #define DEVICE_FLAGS_OPENED 0x00010000UL
383 #define DEVICE_FLAGS_WOL_ENABLED 0x00080000UL
384 //flags for capbilities
385 #define DEVICE_FLAGS_TX_ALIGN 0x01000000UL
386 #define DEVICE_FLAGS_HAVE_CAM 0x02000000UL
387 #define DEVICE_FLAGS_FLOW_CTRL 0x04000000UL
388
389 //flags for MII status
390 #define DEVICE_LINK_FAIL 0x00000001UL
391 #define DEVICE_SPEED_10 0x00000002UL
392 #define DEVICE_SPEED_100 0x00000004UL
393 #define DEVICE_SPEED_1000 0x00000008UL
394 #define DEVICE_DUPLEX_FULL 0x00000010UL
395 #define DEVICE_AUTONEG_ENABLE 0x00000020UL
396 #define DEVICE_FORCED_BY_EEPROM 0x00000040UL
397 //for device_set_media_duplex
398 #define DEVICE_LINK_CHANGE 0x00000001UL
399
400
401 //PLICE_DEBUG->
402
403
404 typedef struct _RxManagementQueue
405 {
406 int packet_num;
407 int head,tail;
408 PSRxMgmtPacket Q[NUM];
409 } RxManagementQueue,*PSRxManagementQueue;
410
411
412
413 //PLICE_DEBUG<-
414
415
416 typedef struct __device_opt {
417 int nRxDescs0; //Number of RX descriptors0
418 int nRxDescs1; //Number of RX descriptors1
419 int nTxDescs[2]; //Number of TX descriptors 0, 1
420 int int_works; //interrupt limits
421 int rts_thresh; //rts threshold
422 int frag_thresh;
423 int data_rate;
424 int channel_num;
425 int short_retry;
426 int long_retry;
427 int bbp_type;
428 U32 flags;
429 } OPTIONS, *POPTIONS;
430
431
432 typedef struct __device_info {
433 struct __device_info* next;
434 struct __device_info* prev;
435
436 struct pci_dev* pcid;
437
438 #if CONFIG_PM
439 u32 pci_state[16];
440 #endif
441
442 // netdev
443 struct net_device* dev;
444 struct net_device* next_module;
445 struct net_device_stats stats;
446
447 //dma addr, rx/tx pool
448 dma_addr_t pool_dma;
449 dma_addr_t rd0_pool_dma;
450 dma_addr_t rd1_pool_dma;
451
452 dma_addr_t td0_pool_dma;
453 dma_addr_t td1_pool_dma;
454
455 dma_addr_t tx_bufs_dma0;
456 dma_addr_t tx_bufs_dma1;
457 dma_addr_t tx_beacon_dma;
458
459 PBYTE tx0_bufs;
460 PBYTE tx1_bufs;
461 PBYTE tx_beacon_bufs;
462
463 CHIP_TYPE chip_id;
464
465 U32 PortOffset;
466 DWORD dwIsr;
467 U32 memaddr;
468 U32 ioaddr;
469 U32 io_size;
470
471 BYTE byRevId;
472 WORD SubSystemID;
473 WORD SubVendorID;
474
475 int nTxQueues;
476 volatile int iTDUsed[TYPE_MAXTD];
477
478 volatile PSTxDesc apCurrTD[TYPE_MAXTD];
479 volatile PSTxDesc apTailTD[TYPE_MAXTD];
480
481 volatile PSTxDesc apTD0Rings;
482 volatile PSTxDesc apTD1Rings;
483
484 volatile PSRxDesc aRD0Ring;
485 volatile PSRxDesc aRD1Ring;
486 volatile PSRxDesc pCurrRD[TYPE_MAXRD];
487 SCache sDupRxCache;
488
489 SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG];
490 UINT cbDFCB;
491 UINT cbFreeDFCB;
492 UINT uCurrentDFCBIdx;
493
494 OPTIONS sOpts;
495
496 U32 flags;
497
498 U32 rx_buf_sz;
499 int multicast_limit;
500 BYTE byRxMode;
501
502 spinlock_t lock;
503 //PLICE_DEBUG->
504 struct tasklet_struct RxMngWorkItem;
505 RxManagementQueue rxManeQueue;
506 //PLICE_DEBUG<-
507 //PLICE_DEBUG ->
508 pid_t MLMEThr_pid;
509 struct completion notify;
510 struct semaphore mlme_semaphore;
511 //PLICE_DEBUG <-
512
513
514 U32 rx_bytes;
515
516 // Version control
517 BYTE byLocalID;
518 BYTE byRFType;
519
520 BYTE byMaxPwrLevel;
521 BYTE byZoneType;
522 BOOL bZoneRegExist;
523 BYTE byOriginalZonetype;
524 BYTE abyMacContext[MAC_MAX_CONTEXT_REG];
525 BOOL bLinkPass; // link status: OK or fail
526 BYTE abyCurrentNetAddr[U_ETHER_ADDR_LEN];
527
528 // Adapter statistics
529 SStatCounter scStatistic;
530 // 802.11 counter
531 SDot11Counters s802_11Counter;
532
533
534 // 802.11 management
535 PSMgmtObject pMgmt;
536 SMgmtObject sMgmtObj;
537
538 // 802.11 MAC specific
539 UINT uCurrRSSI;
540 BYTE byCurrSQ;
541
542 DWORD dwTxAntennaSel;
543 DWORD dwRxAntennaSel;
544 BYTE byAntennaCount;
545 BYTE byRxAntennaMode;
546 BYTE byTxAntennaMode;
547 BOOL bTxRxAntInv;
548
549 PBYTE pbyTmpBuff;
550 UINT uSIFS; //Current SIFS
551 UINT uDIFS; //Current DIFS
552 UINT uEIFS; //Current EIFS
553 UINT uSlot; //Current SlotTime
554 UINT uCwMin; //Current CwMin
555 UINT uCwMax; //CwMax is fixed on 1023.
556 // PHY parameter
557 BYTE bySIFS;
558 BYTE byDIFS;
559 BYTE byEIFS;
560 BYTE bySlot;
561 BYTE byCWMaxMin;
562 CARD_PHY_TYPE eCurrentPHYType;
563
564
565 VIA_BB_TYPE byBBType; //0: 11A, 1:11B, 2:11G
566 VIA_PKT_TYPE byPacketType; //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
567 WORD wBasicRate;
568 BYTE byACKRate;
569 BYTE byTopOFDMBasicRate;
570 BYTE byTopCCKBasicRate;
571
572 BYTE byMinChannel;
573 BYTE byMaxChannel;
574 UINT uConnectionRate;
575
576 BYTE byPreambleType;
577 BYTE byShortPreamble;
578
579 WORD wCurrentRate;
580 WORD wRTSThreshold;
581 WORD wFragmentationThreshold;
582 BYTE byShortRetryLimit;
583 BYTE byLongRetryLimit;
584 CARD_OP_MODE eOPMode;
585 BYTE byOpMode;
586 BOOL bBSSIDFilter;
587 WORD wMaxTransmitMSDULifetime;
588 BYTE abyBSSID[U_ETHER_ADDR_LEN];
589 BYTE abyDesireBSSID[U_ETHER_ADDR_LEN];
590 WORD wCTSDuration; // update while speed change
591 WORD wACKDuration; // update while speed change
592 WORD wRTSTransmitLen; // update while speed change
593 BYTE byRTSServiceField; // update while speed change
594 BYTE byRTSSignalField; // update while speed change
595
596 DWORD dwMaxReceiveLifetime; // dot11MaxReceiveLifetime
597
598 BOOL bCCK;
599 BOOL bEncryptionEnable;
600 BOOL bLongHeader;
601 BOOL bShortSlotTime;
602 BOOL bProtectMode;
603 BOOL bNonERPPresent;
604 BOOL bBarkerPreambleMd;
605
606 BYTE byERPFlag;
607 WORD wUseProtectCntDown;
608
609 BOOL bRadioControlOff;
610 BOOL bRadioOff;
611 BOOL bEnablePSMode;
612 WORD wListenInterval;
613 BOOL bPWBitOn;
614 WMAC_POWER_MODE ePSMode;
615
616
617 // GPIO Radio Control
618 BYTE byRadioCtl;
619 BYTE byGPIO;
620 BOOL bHWRadioOff;
621 BOOL bPrvActive4RadioOFF;
622 BOOL bGPIOBlockRead;
623
624 // Beacon releated
625 WORD wSeqCounter;
626 WORD wBCNBufLen;
627 BOOL bBeaconBufReady;
628 BOOL bBeaconSent;
629 BOOL bIsBeaconBufReadySet;
630 UINT cbBeaconBufReadySetCnt;
631 BOOL bFixRate;
632 BYTE byCurrentCh;
633 UINT uScanTime;
634
635 CMD_STATE eCommandState;
636
637 CMD_CODE eCommand;
638 BOOL bBeaconTx;
639
640 BOOL bStopBeacon;
641 BOOL bStopDataPkt;
642 BOOL bStopTx0Pkt;
643 UINT uAutoReConnectTime;
644
645 // 802.11 counter
646
647 CMD_ITEM eCmdQueue[CMD_Q_SIZE];
648 UINT uCmdDequeueIdx;
649 UINT uCmdEnqueueIdx;
650 UINT cbFreeCmdQueue;
651 BOOL bCmdRunning;
652 BOOL bCmdClear;
653
654
655
656 BOOL bRoaming;
657 //WOW
658 BYTE abyIPAddr[4];
659
660 ULONG ulTxPower;
661 NDIS_802_11_WEP_STATUS eEncryptionStatus;
662 BOOL bTransmitKey;
663 //2007-0925-01<Add>by MikeLiu
664 //mike add :save old Encryption
665 NDIS_802_11_WEP_STATUS eOldEncryptionStatus;
666
667 SKeyManagement sKey;
668 DWORD dwIVCounter;
669
670 QWORD qwPacketNumber; //For CCMP and TKIP as TSC(6 bytes)
671 UINT uCurrentWEPMode;
672
673 RC4Ext SBox;
674 BYTE abyPRNG[WLAN_WEPMAX_KEYLEN+3];
675 BYTE byKeyIndex;
676 UINT uKeyLength;
677 BYTE abyKey[WLAN_WEP232_KEYLEN];
678
679 BOOL bAES;
680 BYTE byCntMeasure;
681
682 // for AP mode
683 UINT uAssocCount;
684 BOOL bMoreData;
685
686 // QoS
687 BOOL bGrpAckPolicy;
688
689 // for OID_802_11_ASSOCIATION_INFORMATION
690 BOOL bAssocInfoSet;
691
692
693 BYTE byAutoFBCtrl;
694
695 BOOL bTxMICFail;
696 BOOL bRxMICFail;
697
698
699 UINT uRATEIdx;
700
701
702 // For Update BaseBand VGA Gain Offset
703 BOOL bUpdateBBVGA;
704 UINT uBBVGADiffCount;
705 BYTE byBBVGANew;
706 BYTE byBBVGACurrent;
707 BYTE abyBBVGA[BB_VGA_LEVEL];
708 LONG ldBmThreshold[BB_VGA_LEVEL];
709
710 BYTE byBBPreEDRSSI;
711 BYTE byBBPreEDIndex;
712
713
714 BOOL bRadioCmd;
715 DWORD dwDiagRefCount;
716
717 // For FOE Tuning
718 BYTE byFOETuning;
719
720 // For Auto Power Tunning
721
722 BYTE byAutoPwrTunning;
723 SHORT sPSetPointCCK;
724 SHORT sPSetPointOFDMG;
725 SHORT sPSetPointOFDMA;
726 LONG lPFormulaOffset;
727 SHORT sPThreshold;
728 CHAR cAdjustStep;
729 CHAR cMinTxAGC;
730
731 // For RF Power table
732 BYTE byCCKPwr;
733 BYTE byOFDMPwrG;
734 BYTE byCurPwr;
735 I8 byCurPwrdBm;
736 BYTE abyCCKPwrTbl[CB_MAX_CHANNEL_24G+1];
737 BYTE abyOFDMPwrTbl[CB_MAX_CHANNEL+1];
738 I8 abyCCKDefaultPwr[CB_MAX_CHANNEL_24G+1];
739 I8 abyOFDMDefaultPwr[CB_MAX_CHANNEL+1];
740 I8 abyRegPwr[CB_MAX_CHANNEL+1];
741 I8 abyLocalPwr[CB_MAX_CHANNEL+1];
742
743
744 // BaseBand Loopback Use
745 BYTE byBBCR4d;
746 BYTE byBBCRc9;
747 BYTE byBBCR88;
748 BYTE byBBCR09;
749
750 // command timer
751 struct timer_list sTimerCommand;
752 #ifdef TxInSleep
753 struct timer_list sTimerTxData;
754 ULONG nTxDataTimeCout;
755 BOOL fTxDataInSleep;
756 BOOL IsTxDataTrigger;
757 #endif
758
759 #ifdef WPA_SM_Transtatus
760 BOOL fWPA_Authened; //is WPA/WPA-PSK or WPA2/WPA2-PSK authen??
761 #endif
762 BYTE byReAssocCount; //mike add:re-association retry times!
763 BYTE byLinkWaitCount;
764
765
766 BYTE abyNodeName[17];
767
768 BOOL bDiversityRegCtlON;
769 BOOL bDiversityEnable;
770 ULONG ulDiversityNValue;
771 ULONG ulDiversityMValue;
772 BYTE byTMax;
773 BYTE byTMax2;
774 BYTE byTMax3;
775 ULONG ulSQ3TH;
776
777 // ANT diversity
778 ULONG uDiversityCnt;
779 BYTE byAntennaState;
780 ULONG ulRatio_State0;
781 ULONG ulRatio_State1;
782
783 //SQ3 functions for antenna diversity
784 struct timer_list TimerSQ3Tmax1;
785 struct timer_list TimerSQ3Tmax2;
786 struct timer_list TimerSQ3Tmax3;
787
788
789 ULONG uNumSQ3[MAX_RATE];
790 WORD wAntDiversityMaxRate;
791
792
793 SEthernetHeader sTxEthHeader;
794 SEthernetHeader sRxEthHeader;
795 BYTE abyBroadcastAddr[U_ETHER_ADDR_LEN];
796 BYTE abySNAP_RFC1042[U_ETHER_ADDR_LEN];
797 BYTE abySNAP_Bridgetunnel[U_ETHER_ADDR_LEN];
798 BYTE abyEEPROM[EEP_MAX_CONTEXT_SIZE]; //DWORD alignment
799 // Pre-Authentication & PMK cache
800 SPMKID gsPMKID;
801 SPMKIDCandidateEvent gsPMKIDCandidate;
802
803
804 // for 802.11h
805 BOOL b11hEnable;
806 BYTE abyCountryCode[3];
807 // for 802.11h DFS
808 UINT uNumOfMeasureEIDs;
809 PWLAN_IE_MEASURE_REQ pCurrMeasureEID;
810 BOOL bMeasureInProgress;
811 BYTE byOrgChannel;
812 BYTE byOrgRCR;
813 DWORD dwOrgMAR0;
814 DWORD dwOrgMAR4;
815 BYTE byBasicMap;
816 BYTE byCCAFraction;
817 BYTE abyRPIs[8];
818 DWORD dwRPIs[8];
819 BOOL bChannelSwitch;
820 BYTE byNewChannel;
821 BYTE byChannelSwitchCount;
822 BOOL bQuietEnable;
823 BOOL bEnableFirstQuiet;
824 BYTE byQuietStartCount;
825 UINT uQuietEnqueue;
826 DWORD dwCurrentQuietEndTime;
827 SQuietControl sQuiet[MAX_QUIET_COUNT];
828 // for 802.11h TPC
829 BOOL bCountryInfo5G;
830 BOOL bCountryInfo24G;
831
832 WORD wBeaconInterval;
833
834 //WPA supplicant deamon
835 struct net_device *wpadev;
836 BOOL bWPADEVUp;
837 struct sk_buff *skb;
838 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
839 /*
840 BOOL bwextstep0;
841 BOOL bwextstep1;
842 BOOL bwextstep2;
843 BOOL bwextstep3;
844 */
845 UINT bwextcount;
846 BOOL bWPASuppWextEnabled;
847 #endif
848
849 //--
850 #ifdef HOSTAP
851 // user space daemon: hostapd, is used for HOSTAP
852 BOOL bEnableHostapd;
853 BOOL bEnable8021x;
854 BOOL bEnableHostWEP;
855 struct net_device *apdev;
856 int (*tx_80211)(struct sk_buff *skb, struct net_device *dev);
857 #endif
858 UINT uChannel;
859 BOOL bMACSuspend;
860
861 struct iw_statistics wstats; // wireless stats
862 BOOL bCommit;
863
864 } DEVICE_INFO, *PSDevice;
865
866
867 //PLICE_DEBUG->
868
869
870 inline static VOID EnQueue (PSDevice pDevice,PSRxMgmtPacket pRxMgmtPacket)
871 {
872 //printk("Enter EnQueue:tail is %d\n",pDevice->rxManeQueue.tail);
873 if ((pDevice->rxManeQueue.tail+1) % NUM == pDevice->rxManeQueue.head)
874 {
875 //printk("Queue is Full,tail is %d\n",pDevice->rxManeQueue.tail);
876 return ;
877 }
878 else
879 {
880 pDevice->rxManeQueue.tail = (pDevice->rxManeQueue.tail+1)% NUM;
881 pDevice->rxManeQueue.Q[pDevice->rxManeQueue.tail] = pRxMgmtPacket;
882 pDevice->rxManeQueue.packet_num++;
883 //printk("packet num is %d\n",pDevice->rxManeQueue.packet_num);
884 }
885 }
886
887
888
889
890 inline static PSRxMgmtPacket DeQueue (PSDevice pDevice)
891 {
892 PSRxMgmtPacket pRxMgmtPacket;
893 if (pDevice->rxManeQueue.tail == pDevice->rxManeQueue.head)
894 {
895 printk("Queue is Empty\n");
896 return NULL;
897 }
898 else
899 {
900 int x;
901 //x=pDevice->rxManeQueue.head = (pDevice->rxManeQueue.head+1)%NUM;
902 pDevice->rxManeQueue.head = (pDevice->rxManeQueue.head+1)%NUM;
903 x = pDevice->rxManeQueue.head;
904 //printk("Enter DeQueue:head is %d\n",x);
905 pRxMgmtPacket = pDevice->rxManeQueue.Q[x];
906 pDevice->rxManeQueue.packet_num--;
907 return pRxMgmtPacket;
908 }
909 }
910
911 VOID InitRxManagementQueue(PSDevice pDevice);
912
913
914
915 //PLICE_DEBUG<-
916
917
918
919
920
921
922 inline static BOOL device_get_ip(PSDevice pInfo) {
923 struct in_device* in_dev=(struct in_device*) pInfo->dev->ip_ptr;
924 struct in_ifaddr* ifa;
925
926 if (in_dev!=NULL) {
927 ifa=(struct in_ifaddr*) in_dev->ifa_list;
928 if (ifa!=NULL) {
929 memcpy(pInfo->abyIPAddr,&ifa->ifa_address,4);
930 return TRUE;
931 }
932 }
933 return FALSE;
934 }
935
936
937
938 static inline PDEVICE_RD_INFO alloc_rd_info(void) {
939 PDEVICE_RD_INFO ptr;
940 if ((ptr = (PDEVICE_RD_INFO)kmalloc((int)sizeof(DEVICE_RD_INFO), (int)GFP_ATOMIC)) == NULL)
941 return NULL;
942 else {
943 memset(ptr,0,sizeof(DEVICE_RD_INFO));
944 return ptr;
945 }
946 }
947
948 static inline PDEVICE_TD_INFO alloc_td_info(void) {
949 PDEVICE_TD_INFO ptr;
950 if ((ptr = (PDEVICE_TD_INFO)kmalloc((int)sizeof(DEVICE_TD_INFO), (int)GFP_ATOMIC))==NULL)
951 return NULL;
952 else {
953 memset(ptr,0,sizeof(DEVICE_TD_INFO));
954 return ptr;
955 }
956 }
957
958 /*--------------------- Export Functions --------------------------*/
959
960 BOOL device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, UINT uNodeIndex);
961 BOOL device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF);
962 int Config_FileOperation(PSDevice pDevice,BOOL fwrite,unsigned char *Parameter);
963 #endif
964
965
This page took 0.078988 seconds and 4 git commands to generate.