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