staging: vt6656: clean up PIPEnsInterruptRead.
[linux-block.git] / drivers / staging / vt6656 / device.h
CommitLineData
92b96797
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
92b96797 32#include <linux/module.h>
92b96797 33#include <linux/kernel.h>
92b96797 34#include <linux/slab.h>
11d404cb
MP
35#include <linux/delay.h>
36#include <linux/device.h>
37#include <linux/firmware.h>
38#include <linux/etherdevice.h>
39#include <linux/suspend.h>
92b96797 40#include <linux/if_arp.h>
11d404cb
MP
41#include <linux/wireless.h>
42#include <net/iw_handler.h>
43#include <net/cfg80211.h>
44#include <linux/timer.h>
92b96797 45#include <linux/usb.h>
f0fde117 46#include <linux/crc32.h>
11d404cb 47
92b96797
FB
48#ifdef SIOCETHTOOL
49#define DEVICE_ETHTOOL_IOCTL_SUPPORT
50#include <linux/ethtool.h>
51#else
52#undef DEVICE_ETHTOOL_IOCTL_SUPPORT
53#endif
92b96797 54
d3e23951 55/* please copy below macro to driver_event.c for API */
92b96797
FB
56#define RT_INSMOD_EVENT_FLAG 0x0101
57#define RT_UPDEV_EVENT_FLAG 0x0102
58#define RT_DISCONNECTED_EVENT_FLAG 0x0103
59#define RT_WPACONNECTED_EVENT_FLAG 0x0104
60#define RT_DOWNDEV_EVENT_FLAG 0x0105
61#define RT_RMMOD_EVENT_FLAG 0x0106
92b96797 62
d3e23951
AM
63/*
64 * device specific
65 */
92b96797 66
92b96797 67#include "device_cfg.h"
92b96797 68#include "80211hdr.h"
92b96797 69#include "tether.h"
92b96797 70#include "wmgr.h"
92b96797 71#include "wcmd.h"
92b96797 72#include "srom.h"
92b96797 73#include "rc4.h"
92b96797 74#include "desc.h"
92b96797 75#include "key.h"
92b96797 76#include "card.h"
748bf69c 77#include "rndis.h"
92b96797 78
5008c456 79#define VNT_USB_VENDOR_ID 0x160a
92b96797
FB
80#define VNT_USB_PRODUCT_ID 0x3184
81
82#define MAC_MAX_CONTEXT_REG (256+128)
83
84#define MAX_MULTICAST_ADDRESS_NUM 32
9a0e756c 85#define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN)
92b96797 86
92b96797
FB
87#define DUPLICATE_RX_CACHE_LENGTH 5
88
89#define NUM_KEY_ENTRY 11
90
91#define TX_WEP_NONE 0
92#define TX_WEP_OTF 1
93#define TX_WEP_SW 2
94#define TX_WEP_SWOTP 3
95#define TX_WEP_OTPSW 4
96#define TX_WEP_SW232 5
97
98#define KEYSEL_WEP40 0
99#define KEYSEL_WEP104 1
100#define KEYSEL_TKIP 2
101#define KEYSEL_CCMP 3
102
92b96797
FB
103#define AUTO_FB_NONE 0
104#define AUTO_FB_0 1
105#define AUTO_FB_1 2
106
107#define FB_RATE0 0
108#define FB_RATE1 1
109
d3e23951 110/* Antenna Mode */
92b96797
FB
111#define ANT_A 0
112#define ANT_B 1
113#define ANT_DIVERSITY 2
114#define ANT_RXD_TXA 3
115#define ANT_RXD_TXB 4
116#define ANT_UNKNOWN 0xFF
117#define ANT_TXA 0
118#define ANT_TXB 1
119#define ANT_RXA 2
120#define ANT_RXB 3
121
92b96797
FB
122#define MAXCHECKHANGCNT 4
123
d3e23951 124/* Packet type */
92b96797
FB
125#define TX_PKT_UNI 0x00
126#define TX_PKT_MULTI 0x01
127#define TX_PKT_BROAD 0x02
128
129#define BB_VGA_LEVEL 4
130#define BB_VGA_CHANGE_THRESHOLD 3
131
92b96797
FB
132#ifndef RUN_AT
133#define RUN_AT(x) (jiffies+(x))
134#endif
135
d3e23951 136/* DMA related */
92b96797
FB
137#define RESERV_AC0DMA 4
138
139#define PRIVATE_Message 0
140
d9d1ccb5
AM
141#define DBG_PRT(l, p, args...) { if (l <= msglevel) printk(p, ##args); }
142#define PRINT_K(p, args...) { if (PRIVATE_Message) printk(p, ##args); }
92b96797
FB
143
144typedef enum __device_msg_level {
d9d1ccb5
AM
145 MSG_LEVEL_ERR = 0, /* Errors causing abnormal operation */
146 MSG_LEVEL_NOTICE = 1, /* Errors needing user notification */
147 MSG_LEVEL_INFO = 2, /* Normal message. */
148 MSG_LEVEL_VERBOSE = 3, /* Will report all trival errors. */
149 MSG_LEVEL_DEBUG = 4 /* Only for debug purpose. */
92b96797
FB
150} DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL;
151
302433da
MP
152#define DEVICE_INIT_COLD 0x0 /* cold init */
153#define DEVICE_INIT_RESET 0x1 /* reset init or Dx to D0 power remain */
154#define DEVICE_INIT_DXPL 0x2 /* Dx to D0 power lost init */
92b96797 155
d3e23951 156/* USB */
92b96797 157
d3e23951
AM
158/*
159 * Enum of context types for SendPacket
160 */
92b96797
FB
161typedef enum _CONTEXT_TYPE {
162 CONTEXT_DATA_PACKET = 1,
163 CONTEXT_MGMT_PACKET
164} CONTEXT_TYPE;
165
d3e23951 166/* RCB (Receive Control Block) */
115cac2e 167struct vnt_rcb {
dd0a774f
MP
168 void *Next;
169 signed long Ref;
170 void *pDevice;
171 struct urb *pUrb;
172 struct vnt_rx_mgmt sMngPacket;
173 struct sk_buff *skb;
174 int bBoolInUse;
115cac2e 175};
92b96797 176
d3e23951 177/* used to track bulk out irps */
dcdf1d03
MP
178struct vnt_usb_send_context {
179 void *pDevice;
180 struct sk_buff *pPacket;
181 struct urb *pUrb;
182 unsigned int uBufLen;
183 CONTEXT_TYPE Type;
184 struct ethhdr sEthHeader;
185 void *Next;
186 bool bBoolInUse;
187 unsigned char Data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS];
188};
92b96797 189
51934e7f
MP
190/* tx packet info for rxtx */
191struct vnt_tx_pkt_info {
192 u16 fifo_ctl;
193 u8 dest_addr[ETH_ALEN];
194};
195
213d2e93
AM
196/* structure got from configuration file as user-desired default settings */
197typedef struct _DEFAULT_CONFIG {
198 signed int ZoneType;
199 signed int eConfigMode;
200 signed int eAuthenMode; /* open/wep/wpa */
201 signed int bShareKeyAlgorithm; /* open-open/{open,wep}-sharekey */
202 signed int keyidx; /* wepkey index */
203 signed int eEncryptionStatus;
204} DEFAULT_CONFIG, *PDEFAULT_CONFIG;
92b96797 205
d3e23951
AM
206/*
207 * Structure to keep track of USB interrupt packets
208 */
92b96797 209typedef struct {
cc856e61 210 unsigned int uDataLen;
b902fbfe 211 u8 * pDataBuf;
d3e23951 212 /* struct urb *pUrb; */
dfdcc425 213 bool bInUse;
92b96797
FB
214} INT_BUFFER, *PINT_BUFFER;
215
d3e23951 216/*++ NDIS related */
92b96797 217
92b96797 218typedef enum __DEVICE_NDIS_STATUS {
d9d1ccb5 219 STATUS_SUCCESS = 0,
92b96797
FB
220 STATUS_FAILURE,
221 STATUS_RESOURCES,
222 STATUS_PENDING,
223} DEVICE_NDIS_STATUS, *PDEVICE_NDIS_STATUS;
224
92b96797
FB
225#define MAX_BSSIDINFO_4_PMKID 16
226#define MAX_PMKIDLIST 5
d3e23951 227/* flags for PMKID Candidate list structure */
92b96797
FB
228#define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01
229
d3e23951 230/* PMKID Structures */
cc856e61 231typedef unsigned char NDIS_802_11_PMKID_VALUE[16];
92b96797 232
92b96797
FB
233typedef enum _NDIS_802_11_WEP_STATUS
234{
235 Ndis802_11WEPEnabled,
236 Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
237 Ndis802_11WEPDisabled,
238 Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
239 Ndis802_11WEPKeyAbsent,
240 Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
241 Ndis802_11WEPNotSupported,
242 Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
243 Ndis802_11Encryption2Enabled,
244 Ndis802_11Encryption2KeyAbsent,
245 Ndis802_11Encryption3Enabled,
246 Ndis802_11Encryption3KeyAbsent
247} NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
248 NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
249
92b96797
FB
250typedef enum _NDIS_802_11_STATUS_TYPE
251{
d3e23951
AM
252 Ndis802_11StatusType_Authentication,
253 Ndis802_11StatusType_MediaStreamMode,
254 Ndis802_11StatusType_PMKID_CandidateList,
255 Ndis802_11StatusTypeMax, /* not a real type, defined as upper bound */
92b96797
FB
256} NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
257
d3e23951 258/* added new types for PMKID Candidate lists */
92b96797
FB
259typedef struct _PMKID_CANDIDATE {
260 NDIS_802_11_MAC_ADDRESS BSSID;
cc856e61 261 unsigned long Flags;
92b96797
FB
262} PMKID_CANDIDATE, *PPMKID_CANDIDATE;
263
92b96797
FB
264typedef struct _BSSID_INFO
265{
266 NDIS_802_11_MAC_ADDRESS BSSID;
267 NDIS_802_11_PMKID_VALUE PMKID;
268} BSSID_INFO, *PBSSID_INFO;
269
270typedef struct tagSPMKID {
cc856e61
AM
271 unsigned long Length;
272 unsigned long BSSIDInfoCount;
92b96797
FB
273 BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID];
274} SPMKID, *PSPMKID;
275
276typedef struct tagSPMKIDCandidateEvent {
277 NDIS_802_11_STATUS_TYPE StatusType;
cc856e61
AM
278 unsigned long Version; /* Version of the structure */
279 unsigned long NumCandidates; /* No. of pmkid candidates */
92b96797 280 PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST];
193a823c 281} SPMKIDCandidateEvent, *PSPMKIDCandidateEvent;
92b96797 282
d3e23951 283/*++ 802.11h related */
92b96797
FB
284#define MAX_QUIET_COUNT 8
285
286typedef struct tagSQuietControl {
dfdcc425 287 bool bEnable;
52a7e64b 288 u32 dwStartTime;
b902fbfe 289 u8 byPeriod;
3eaca0d2 290 u16 wDuration;
193a823c 291} SQuietControl, *PSQuietControl;
92b96797 292
d3e23951 293/* The receive duplicate detection cache entry */
92b96797 294typedef struct tagSCacheEntry{
3eaca0d2 295 u16 wFmSequence;
b902fbfe 296 u8 abyAddr2[ETH_ALEN];
3eaca0d2 297 u16 wFrameCtl;
92b96797
FB
298} SCacheEntry, *PSCacheEntry;
299
300typedef struct tagSCache{
301/* The receive cache is updated circularly. The next entry to be written is
302 * indexed by the "InPtr".
d3e23951 303 */
cc856e61 304 unsigned int uInPtr; /* Place to use next */
92b96797
FB
305 SCacheEntry asCacheEntry[DUPLICATE_RX_CACHE_LENGTH];
306} SCache, *PSCache;
307
308#define CB_MAX_RX_FRAG 64
d3e23951
AM
309/*
310 * DeFragment Control Block, used for collecting fragments prior to reassembly
311 */
92b96797
FB
312typedef struct tagSDeFragControlBlock
313{
3eaca0d2
AM
314 u16 wSequence;
315 u16 wFragNum;
b902fbfe 316 u8 abyAddr2[ETH_ALEN];
cc856e61 317 unsigned int uLifetime;
92b96797 318 struct sk_buff* skb;
b902fbfe 319 u8 * pbyRxBuffer;
cc856e61 320 unsigned int cbFrameLength;
dfdcc425 321 bool bInUse;
193a823c 322} SDeFragControlBlock, *PSDeFragControlBlock;
92b96797 323
d3e23951 324/* flags for options */
92b96797
FB
325#define DEVICE_FLAGS_UNPLUG 0x00000001UL
326#define DEVICE_FLAGS_PREAMBLE_TYPE 0x00000002UL
327#define DEVICE_FLAGS_OP_MODE 0x00000004UL
328#define DEVICE_FLAGS_PS_MODE 0x00000008UL
329#define DEVICE_FLAGS_80211h_MODE 0x00000010UL
330
d3e23951 331/* flags for driver status */
92b96797
FB
332#define DEVICE_FLAGS_OPENED 0x00010000UL
333#define DEVICE_FLAGS_WOL_ENABLED 0x00080000UL
d3e23951 334/* flags for capabilities */
92b96797
FB
335#define DEVICE_FLAGS_TX_ALIGN 0x01000000UL
336#define DEVICE_FLAGS_HAVE_CAM 0x02000000UL
337#define DEVICE_FLAGS_FLOW_CTRL 0x04000000UL
338
d3e23951 339/* flags for MII status */
92b96797
FB
340#define DEVICE_LINK_FAIL 0x00000001UL
341#define DEVICE_SPEED_10 0x00000002UL
342#define DEVICE_SPEED_100 0x00000004UL
343#define DEVICE_SPEED_1000 0x00000008UL
344#define DEVICE_DUPLEX_FULL 0x00000010UL
345#define DEVICE_AUTONEG_ENABLE 0x00000020UL
346#define DEVICE_FORCED_BY_EEPROM 0x00000040UL
d3e23951 347/* for device_set_media_duplex */
92b96797
FB
348#define DEVICE_LINK_CHANGE 0x00000001UL
349
92b96797 350typedef struct __device_opt {
d3e23951
AM
351 int nRxDescs0; /* number of RX descriptors 0 */
352 int nTxDescs0; /* number of TX descriptors 0, 1, 2, 3 */
353 int rts_thresh; /* RTS threshold */
92b96797
FB
354 int frag_thresh;
355 int OpMode;
356 int data_rate;
357 int channel_num;
358 int short_retry;
359 int long_retry;
360 int bbp_type;
659770d4 361 u32 flags;
92b96797
FB
362} OPTIONS, *POPTIONS;
363
14c5ef57 364struct vnt_private {
61462ab3
MP
365 /* netdev */
366 struct usb_device *usb;
367 struct net_device *dev;
368 struct net_device_stats stats;
92b96797 369
61462ab3 370 OPTIONS sOpts;
92b96797 371
61462ab3
MP
372 struct tasklet_struct CmdWorkItem;
373 struct tasklet_struct EventWorkItem;
81d720d3 374 struct work_struct read_work_item;
a21fc2f5 375 struct work_struct rx_mng_work_item;
31d5bbf3 376
61462ab3
MP
377 u32 rx_buf_sz;
378 int multicast_limit;
379 u8 byRxMode;
92b96797 380
61462ab3 381 spinlock_t lock;
92b96797 382
61462ab3 383 u32 rx_bytes;
92b96797 384
61462ab3 385 u8 byRevId;
92b96797 386
61462ab3
MP
387 u32 flags;
388 unsigned long Flags;
92b96797 389
61462ab3 390 SCache sDupRxCache;
92b96797 391
61462ab3
MP
392 SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG];
393 u32 cbDFCB;
394 u32 cbFreeDFCB;
395 u32 uCurrentDFCBIdx;
92b96797 396
61462ab3
MP
397 /* USB */
398 struct urb *pControlURB;
399 struct urb *pInterruptURB;
400 struct usb_ctrlrequest sUsbCtlRequest;
401 u32 int_interval;
92b96797 402
61462ab3 403 /* Variables to track resources for the BULK In Pipe */
115cac2e
MP
404 struct vnt_rcb *pRCBMem;
405 struct vnt_rcb *apRCB[CB_MAX_RX_DESC];
61462ab3 406 u32 cbRD;
115cac2e
MP
407 struct vnt_rcb *FirstRecvFreeList;
408 struct vnt_rcb *LastRecvFreeList;
61462ab3 409 u32 NumRecvFreeList;
115cac2e
MP
410 struct vnt_rcb *FirstRecvMngList;
411 struct vnt_rcb *LastRecvMngList;
61462ab3
MP
412 u32 NumRecvMngList;
413 int bIsRxWorkItemQueued;
414 int bIsRxMngWorkItemQueued;
cc856e61 415 unsigned long ulRcvRefCount; /* packets that have not returned back */
92b96797 416
61462ab3 417 /* Variables to track resources for the BULK Out Pipe */
dcdf1d03 418 struct vnt_usb_send_context *apTD[CB_MAX_TX_DESC];
61462ab3 419 u32 cbTD;
51934e7f 420 struct vnt_tx_pkt_info pkt_info[16];
92b96797 421
61462ab3
MP
422 /* Variables to track resources for the Interrupt In Pipe */
423 INT_BUFFER intBuf;
61462ab3 424 int bEventAvailable;
92b96797 425
61462ab3
MP
426 /* default config from file by user setting */
427 DEFAULT_CONFIG config_file;
92b96797 428
61462ab3
MP
429 /* Statistic for USB */
430 unsigned long ulBulkInPosted;
431 unsigned long ulBulkInError;
432 unsigned long ulBulkInContCRCError;
433 unsigned long ulBulkInBytesRead;
92b96797 434
61462ab3
MP
435 unsigned long ulBulkOutPosted;
436 unsigned long ulBulkOutError;
437 unsigned long ulBulkOutContCRCError;
438 unsigned long ulBulkOutBytesWrite;
92b96797 439
61462ab3
MP
440 unsigned long ulIntInPosted;
441 unsigned long ulIntInError;
442 unsigned long ulIntInContCRCError;
443 unsigned long ulIntInBytesRead;
92b96797 444
61462ab3
MP
445 /* Version control */
446 u16 wFirmwareVersion;
447 u8 byLocalID;
448 u8 byRFType;
449 u8 byBBRxConf;
92b96797 450
61462ab3
MP
451 u8 byZoneType;
452 int bZoneRegExist;
92b96797 453
61462ab3 454 u8 byOriginalZonetype;
92b96797 455
61462ab3 456 int bLinkPass; /* link status: OK or fail */
748bf69c
MP
457 struct vnt_cmd_card_init init_command;
458 struct vnt_rsp_card_init init_response;
61462ab3
MP
459 u8 abyCurrentNetAddr[ETH_ALEN];
460 u8 abyPermanentNetAddr[ETH_ALEN];
92b96797 461
61462ab3 462 int bExistSWNetAddr;
92b96797 463
61462ab3
MP
464 /* Maintain statistical debug info. */
465 unsigned long packetsReceived;
466 unsigned long packetsReceivedDropped;
467 unsigned long packetsReceivedOverflow;
468 unsigned long packetsSent;
469 unsigned long packetsSentDropped;
470 unsigned long SendContextsInUse;
471 unsigned long RcvBuffersInUse;
92b96797 472
14c5ef57 473 /* 802.11 management */
4f4a89c9 474 struct vnt_manager vnt_mgmt;
92b96797 475
7c65fa2a 476 u64 qwCurrTSF;
61462ab3
MP
477 u32 cbBulkInMax;
478 int bPSRxBeacon;
479
480 /* 802.11 MAC specific */
481 u32 uCurrRSSI;
482 u8 byCurrSQ;
483
484 /* Antenna Diversity */
485 int bTxRxAntInv;
486 u32 dwRxAntennaSel;
487 u32 dwTxAntennaSel;
488 u8 byAntennaCount;
489 u8 byRxAntennaMode;
490 u8 byTxAntennaMode;
491 u8 byRadioCtl;
492 u8 bHWRadioOff;
493
494 /* SQ3 functions for antenna diversity */
495 struct timer_list TimerSQ3Tmax1;
496 struct timer_list TimerSQ3Tmax2;
497 struct timer_list TimerSQ3Tmax3;
498
499 int bDiversityRegCtlON;
500 int bDiversityEnable;
501 unsigned long ulDiversityNValue;
502 unsigned long ulDiversityMValue;
503 u8 byTMax;
504 u8 byTMax2;
505 u8 byTMax3;
506 unsigned long ulSQ3TH;
507
508 unsigned long uDiversityCnt;
509 u8 byAntennaState;
510 unsigned long ulRatio_State0;
511 unsigned long ulRatio_State1;
512 unsigned long ulSQ3_State0;
513 unsigned long ulSQ3_State1;
514
515 unsigned long aulSQ3Val[MAX_RATE];
516 unsigned long aulPktNum[MAX_RATE];
cc856e61
AM
517
518 /* IFS & Cw */
61462ab3
MP
519 u32 uSIFS; /* Current SIFS */
520 u32 uDIFS; /* Current DIFS */
521 u32 uEIFS; /* Current EIFS */
522 u32 uSlot; /* Current SlotTime */
523 u32 uCwMin; /* Current CwMin */
524 u32 uCwMax; /* CwMax is fixed on 1023 */
525
526 /* PHY parameter */
527 u8 bySIFS;
528 u8 byDIFS;
529 u8 byEIFS;
530 u8 bySlot;
531 u8 byCWMaxMin;
532
533 /* Rate */
a9052bc9 534 u8 byBBType; /* 0: 11A, 1:11B, 2:11G */
bf1c820f 535 u8 byPacketType; /* 0:11a 1:11b 2:11gb 3:11ga */
61462ab3
MP
536 u16 wBasicRate;
537 u8 byACKRate;
538 u8 byTopOFDMBasicRate;
539 u8 byTopCCKBasicRate;
540
61462ab3
MP
541 u32 dwAotoRateTxOkCnt;
542 u32 dwAotoRateTxFailCnt;
543 u32 dwErrorRateThreshold[13];
544 u32 dwTPTable[MAX_RATE];
545 u8 abyEEPROM[EEP_MAX_CONTEXT_SIZE]; /*u32 alignment */
546
547 u8 byMinChannel;
548 u8 byMaxChannel;
549 u32 uConnectionRate;
550
551 u8 byPreambleType;
552 u8 byShortPreamble;
553 /* CARD_PHY_TYPE */
554 u8 eConfigPHYMode;
555
556 /* For RF Power table */
557 u8 byCCKPwr;
558 u8 byOFDMPwrG;
559 u8 byOFDMPwrA;
560 u8 byCurPwr;
561 u8 abyCCKPwrTbl[14];
562 u8 abyOFDMPwrTbl[14];
563 u8 abyOFDMAPwrTbl[42];
564
565 u16 wCurrentRate;
f84cdf65
MP
566 u16 tx_rate_fb0;
567 u16 tx_rate_fb1;
568
61462ab3
MP
569 u16 wRTSThreshold;
570 u16 wFragmentationThreshold;
571 u8 byShortRetryLimit;
572 u8 byLongRetryLimit;
a0ad2776
MP
573
574 enum nl80211_iftype op_mode;
575
61462ab3
MP
576 int bBSSIDFilter;
577 u16 wMaxTransmitMSDULifetime;
578 u8 abyBSSID[ETH_ALEN];
579 u8 abyDesireBSSID[ETH_ALEN];
580
61462ab3
MP
581 u32 dwMaxReceiveLifetime; /* dot11MaxReceiveLifetime */
582
583 int bCCK;
584 int bEncryptionEnable;
61462ab3
MP
585 int bShortSlotTime;
586 int bProtectMode;
587 int bNonERPPresent;
588 int bBarkerPreambleMd;
589
590 u8 byERPFlag;
591 u16 wUseProtectCntDown;
592
593 int bRadioControlOff;
594 int bRadioOff;
595
596 /* Power save */
597 int bEnablePSMode;
598 u16 wListenInterval;
599 int bPWBitOn;
600 WMAC_POWER_MODE ePSMode;
601 unsigned long ulPSModeWaitTx;
602 int bPSModeTxBurst;
603
604 /* Beacon releated */
605 u16 wSeqCounter;
606 int bBeaconBufReady;
607 int bBeaconSent;
608 int bFixRate;
609 u8 byCurrentCh;
610 u32 uScanTime;
611
612 CMD_STATE eCommandState;
613
614 CMD_CODE eCommand;
615 int bBeaconTx;
616 u8 byScanBBType;
617
618 int bStopBeacon;
619 int bStopDataPkt;
620 int bStopTx0Pkt;
621 u32 uAutoReConnectTime;
622 u32 uIsroamingTime;
623
624 /* 802.11 counter */
625
626 CMD_ITEM eCmdQueue[CMD_Q_SIZE];
627 u32 uCmdDequeueIdx;
628 u32 uCmdEnqueueIdx;
629 u32 cbFreeCmdQueue;
630 int bCmdRunning;
631 int bCmdClear;
632 int bNeedRadioOFF;
633
634 int bEnableRoaming;
635 int bIsRoaming;
636 int bFastRoaming;
637 u8 bSameBSSMaxNum;
638 u8 bSameBSSCurNum;
639 int bRoaming;
640 int b11hEable;
641 unsigned long ulTxPower;
642
643 /* Encryption */
644 NDIS_802_11_WEP_STATUS eEncryptionStatus;
645 int bTransmitKey;
646 NDIS_802_11_WEP_STATUS eOldEncryptionStatus;
647 SKeyManagement sKey;
648 u32 dwIVCounter;
649
61462ab3
MP
650 RC4Ext SBox;
651 u8 abyPRNG[WLAN_WEPMAX_KEYLEN+3];
652 u8 byKeyIndex;
653
61462ab3
MP
654 u32 uKeyLength;
655 u8 abyKey[WLAN_WEP232_KEYLEN];
656
657 /* for AP mode */
658 u32 uAssocCount;
659 int bMoreData;
660
661 /* QoS */
662 int bGrpAckPolicy;
663
61462ab3
MP
664 u8 byAutoFBCtrl;
665
666 int bTxMICFail;
667 int bRxMICFail;
668
61462ab3
MP
669 /* For Update BaseBand VGA Gain Offset */
670 int bUpdateBBVGA;
671 u32 uBBVGADiffCount;
672 u8 byBBVGANew;
673 u8 byBBVGACurrent;
674 u8 abyBBVGA[BB_VGA_LEVEL];
675 signed long ldBmThreshold[BB_VGA_LEVEL];
676
677 u8 byBBPreEDRSSI;
678 u8 byBBPreEDIndex;
679
61462ab3 680 int bRadioCmd;
61462ab3
MP
681
682 /* For FOE Tuning */
683 u8 byFOETuning;
684
685 /* For Auto Power Tunning */
686 u8 byAutoPwrTunning;
687
688 /* BaseBand Loopback Use */
689 u8 byBBCR4d;
690 u8 byBBCRc9;
691 u8 byBBCR88;
692 u8 byBBCR09;
693
694 /* command timer */
94488a7e 695 struct delayed_work run_command_work;
bd9a6dba
MP
696 /* One second callback */
697 struct delayed_work second_callback_work;
92b96797 698
60cc2747
MP
699 u8 tx_data_time_out;
700 bool tx_trigger;
61462ab3
MP
701 int fWPA_Authened; /*is WPA/WPA-PSK or WPA2/WPA2-PSK authen?? */
702 u8 byReAssocCount;
703 u8 byLinkWaitCount;
92b96797 704
ceb8c5da
AM
705 struct ethhdr sTxEthHeader;
706 struct ethhdr sRxEthHeader;
61462ab3
MP
707 u8 abyBroadcastAddr[ETH_ALEN];
708 u8 abySNAP_RFC1042[ETH_ALEN];
709 u8 abySNAP_Bridgetunnel[ETH_ALEN];
92b96797 710
61462ab3
MP
711 /* Pre-Authentication & PMK cache */
712 SPMKID gsPMKID;
713 SPMKIDCandidateEvent gsPMKIDCandidate;
92b96797 714
61462ab3
MP
715 /* for 802.11h */
716 int b11hEnable;
92b96797 717
61462ab3
MP
718 int bChannelSwitch;
719 u8 byNewChannel;
720 u8 byChannelSwitchCount;
92b96797 721
61462ab3
MP
722 /* WPA supplicant daemon */
723 int bWPADEVUp;
724 int bwextstep0;
725 int bwextstep1;
726 int bwextstep2;
727 int bwextstep3;
728 int bWPASuppWextEnabled;
92b96797 729
61462ab3
MP
730 /* user space daemon: hostapd, is used for HOSTAP */
731 int bEnableHostapd;
732 int bEnable8021x;
733 int bEnableHostWEP;
734 struct net_device *apdev;
735 int (*tx_80211)(struct sk_buff *skb, struct net_device *dev);
92b96797 736
61462ab3 737 u32 uChannel;
92b96797 738
61462ab3 739 struct iw_statistics wstats; /* wireless stats */
92b96797 740
61462ab3 741 int bCommit;
92b96797 742
14c5ef57 743};
92b96797 744
92b96797
FB
745#define EnqueueRCB(_Head, _Tail, _RCB) \
746{ \
747 if (!_Head) { \
748 _Head = _RCB; \
749 } \
750 else { \
751 _Tail->Next = _RCB; \
752 } \
753 _RCB->Next = NULL; \
754 _Tail = _RCB; \
755}
756
757#define DequeueRCB(Head, Tail) \
758{ \
115cac2e 759 struct vnt_rcb *RCB = Head; \
92b96797
FB
760 if (!RCB->Next) { \
761 Tail = NULL; \
762 } \
763 Head = RCB->Next; \
764}
765
92b96797
FB
766#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \
767 if ((uVar) >= ((uModulo) - 1)) \
768 (uVar) = 0; \
769 else \
770 (uVar)++; \
771}
772
92b96797
FB
773#define fMP_RESET_IN_PROGRESS 0x00000001
774#define fMP_DISCONNECTED 0x00000002
775#define fMP_HALT_IN_PROGRESS 0x00000004
776#define fMP_SURPRISE_REMOVED 0x00000008
777#define fMP_RECV_LOOKASIDE 0x00000010
778#define fMP_INIT_IN_PROGRESS 0x00000020
779#define fMP_SEND_SIDE_RESOURCE_ALLOCATED 0x00000040
780#define fMP_RECV_SIDE_RESOURCE_ALLOCATED 0x00000080
781#define fMP_POST_READS 0x00000100
782#define fMP_POST_WRITES 0x00000200
783#define fMP_CONTROL_READS 0x00000400
784#define fMP_CONTROL_WRITES 0x00000800
785
92b96797
FB
786#define MP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F))
787#define MP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F))
92b96797
FB
788#define MP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F))
789
790#define MP_IS_READY(_M) (((_M)->Flags & \
791 (fMP_DISCONNECTED | fMP_RESET_IN_PROGRESS | fMP_HALT_IN_PROGRESS | fMP_INIT_IN_PROGRESS | fMP_SURPRISE_REMOVED)) == 0)
792
dd0a774f 793int device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF);
92b96797
FB
794
795#endif