device.h revision 115cac2e7a8d06aa347bf233b4cb94828eb0509a
192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond/*
292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * All rights reserved.
492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * This program is free software; you can redistribute it and/or modify
692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * it under the terms of the GNU General Public License as published by
792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * the Free Software Foundation; either version 2 of the License, or
892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * (at your option) any later version.
992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
1092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * This program is distributed in the hope that it will be useful,
1192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * but WITHOUT ANY WARRANTY; without even the implied warranty of
1292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * GNU General Public License for more details.
1492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
1592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * You should have received a copy of the GNU General Public License along
1692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * with this program; if not, write to the Free Software Foundation, Inc.,
1792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
1992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * File: device.h
2092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
2192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * Purpose: MAC Data structure
2292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
2392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * Author: Tevin Chen
2492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
2592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * Date: Mar 17, 1997
2692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond *
2792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond */
2892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
2992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#ifndef __DEVICE_H__
3092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define __DEVICE_H__
3192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
3292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include <linux/module.h>
3392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include <linux/kernel.h>
3492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include <linux/slab.h>
3511d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <linux/init.h>
3611d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <linux/delay.h>
3711d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <linux/device.h>
3811d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <linux/firmware.h>
3911d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <linux/etherdevice.h>
4011d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <linux/suspend.h>
4192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include <linux/if_arp.h>
4211d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <linux/wireless.h>
4311d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <net/iw_handler.h>
4411d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <net/cfg80211.h>
4511d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <linux/timer.h>
4692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include <linux/usb.h>
4711d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley
4892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#ifdef SIOCETHTOOL
4992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define DEVICE_ETHTOOL_IOCTL_SUPPORT
5092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include <linux/ethtool.h>
5192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#else
5292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#undef DEVICE_ETHTOOL_IOCTL_SUPPORT
5392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#endif
5492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
55d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* please copy below macro to driver_event.c for API */
5692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define RT_INSMOD_EVENT_FLAG                             0x0101
5792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define RT_UPDEV_EVENT_FLAG                               0x0102
5892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define RT_DISCONNECTED_EVENT_FLAG               0x0103
5992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define RT_WPACONNECTED_EVENT_FLAG             0x0104
6092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define RT_DOWNDEV_EVENT_FLAG                        0x0105
6192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define RT_RMMOD_EVENT_FLAG                              0x0106
6292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
63d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/*
64d3e2395154499a846b3210b45b046e9f0d3a5044Andres More * device specific
65d3e2395154499a846b3210b45b046e9f0d3a5044Andres More */
6692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
6792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include "device_cfg.h"
6892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include "80211hdr.h"
6992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include "tether.h"
7092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include "wmgr.h"
7192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include "wcmd.h"
7292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include "mib.h"
7392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include "srom.h"
7492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include "rc4.h"
7592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include "desc.h"
7692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include "key.h"
7792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include "card.h"
7892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
795008c456c1cdcb8ef7265dcb6d20317f54d3e8eeOtavio Salvador#define VNT_USB_VENDOR_ID                     0x160a
8092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define VNT_USB_PRODUCT_ID                    0x3184
8192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
8292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MAC_MAX_CONTEXT_REG     (256+128)
8392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
8492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MAX_MULTICAST_ADDRESS_NUM       32
859a0e756c5280750c23bd44d2b855a1f5442ea7b4Andres More#define MULTICAST_ADDRESS_LIST_SIZE     (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN)
8692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
8792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define DUPLICATE_RX_CACHE_LENGTH       5
8892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
8992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define NUM_KEY_ENTRY                   11
9092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
9192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TX_WEP_NONE                     0
9292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TX_WEP_OTF                      1
9392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TX_WEP_SW                       2
9492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TX_WEP_SWOTP                    3
9592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TX_WEP_OTPSW                    4
9692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TX_WEP_SW232                    5
9792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
9892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define KEYSEL_WEP40                    0
9992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define KEYSEL_WEP104                   1
10092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define KEYSEL_TKIP                     2
10192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define KEYSEL_CCMP                     3
10292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
10392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define AUTO_FB_NONE            0
10492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define AUTO_FB_0               1
10592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define AUTO_FB_1               2
10692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
10792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define FB_RATE0                0
10892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define FB_RATE1                1
10992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
110d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* Antenna Mode */
11192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define ANT_A                   0
11292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define ANT_B                   1
11392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define ANT_DIVERSITY           2
11492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define ANT_RXD_TXA             3
11592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define ANT_RXD_TXB             4
11692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define ANT_UNKNOWN             0xFF
11792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define ANT_TXA                 0
11892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define ANT_TXB                 1
11992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define ANT_RXA                 2
12092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define ANT_RXB                 3
12192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
12292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MAXCHECKHANGCNT         4
12392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
124d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* Packet type */
12592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TX_PKT_UNI              0x00
12692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TX_PKT_MULTI            0x01
12792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define TX_PKT_BROAD            0x02
12892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
12992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define BB_VGA_LEVEL            4
13092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define BB_VGA_CHANGE_THRESHOLD 3
13192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
13292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#ifndef RUN_AT
13392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define RUN_AT(x)                       (jiffies+(x))
13492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#endif
13592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
136d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* DMA related */
13792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define RESERV_AC0DMA                   4
13892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
13992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define PRIVATE_Message                 0
14092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
141d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More#define DBG_PRT(l, p, args...) { if (l <= msglevel) printk(p, ##args); }
142d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More#define PRINT_K(p, args...) { if (PRIVATE_Message) printk(p, ##args); }
14392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
14492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef enum __device_msg_level {
145d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More	MSG_LEVEL_ERR = 0,            /* Errors causing abnormal operation */
146d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More	MSG_LEVEL_NOTICE = 1,         /* Errors needing user notification */
147d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More	MSG_LEVEL_INFO = 2,           /* Normal message. */
148d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More	MSG_LEVEL_VERBOSE = 3,        /* Will report all trival errors. */
149d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More	MSG_LEVEL_DEBUG = 4           /* Only for debug purpose. */
15092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL;
15192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
15292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef enum __device_init_type {
153d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More	DEVICE_INIT_COLD = 0,       /* cold init */
154d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More	DEVICE_INIT_RESET,          /* reset init or Dx to D0 power remain */
155d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More	DEVICE_INIT_DXPL            /* Dx to D0 power lost init */
15692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} DEVICE_INIT_TYPE, *PDEVICE_INIT_TYPE;
15792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
158d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* USB */
15992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
160d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/*
161d3e2395154499a846b3210b45b046e9f0d3a5044Andres More * Enum of context types for SendPacket
162d3e2395154499a846b3210b45b046e9f0d3a5044Andres More */
16392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef enum _CONTEXT_TYPE {
16492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    CONTEXT_DATA_PACKET = 1,
16592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    CONTEXT_MGMT_PACKET
16692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} CONTEXT_TYPE;
16792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
168d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* RCB (Receive Control Block) */
169115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestleystruct vnt_rcb {
170dd0a774fc727ee793780197beb3f2cf80bfefa99Malcolm Priestley	void *Next;
171dd0a774fc727ee793780197beb3f2cf80bfefa99Malcolm Priestley	signed long Ref;
172dd0a774fc727ee793780197beb3f2cf80bfefa99Malcolm Priestley	void *pDevice;
173dd0a774fc727ee793780197beb3f2cf80bfefa99Malcolm Priestley	struct urb *pUrb;
174dd0a774fc727ee793780197beb3f2cf80bfefa99Malcolm Priestley	struct vnt_rx_mgmt sMngPacket;
175dd0a774fc727ee793780197beb3f2cf80bfefa99Malcolm Priestley	struct sk_buff *skb;
176dd0a774fc727ee793780197beb3f2cf80bfefa99Malcolm Priestley	int bBoolInUse;
177115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestley};
17892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
179d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* used to track bulk out irps */
180dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestleystruct vnt_usb_send_context {
181dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	void *pDevice;
182dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	struct sk_buff *pPacket;
183dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	struct urb *pUrb;
184dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	unsigned int uBufLen;
185dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	CONTEXT_TYPE Type;
186dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	struct ethhdr sEthHeader;
187dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	void *Next;
188dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	bool bBoolInUse;
189dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	unsigned char Data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS];
190dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley};
19192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
192213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres More/* structure got from configuration file as user-desired default settings */
193213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres Moretypedef struct _DEFAULT_CONFIG {
194213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres More	signed int    ZoneType;
195213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres More	signed int    eConfigMode;
196213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres More	signed int    eAuthenMode;        /* open/wep/wpa */
197213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres More	signed int    bShareKeyAlgorithm; /* open-open/{open,wep}-sharekey */
198213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres More	signed int    keyidx;             /* wepkey index */
199213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres More	signed int    eEncryptionStatus;
200213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres More} DEFAULT_CONFIG, *PDEFAULT_CONFIG;
20192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
202d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/*
203d3e2395154499a846b3210b45b046e9f0d3a5044Andres More * Structure to keep track of USB interrupt packets
204d3e2395154499a846b3210b45b046e9f0d3a5044Andres More */
20592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct {
206cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More    unsigned int            uDataLen;
207b902fbfebf2c80c3782e41eda24b487964a47fd1Andres More    u8 *           pDataBuf;
208d3e2395154499a846b3210b45b046e9f0d3a5044Andres More  /* struct urb *pUrb; */
209dfdcc425975d06cbfcc9b5c0fad2f3af5476cd05Andres More    bool            bInUse;
21092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} INT_BUFFER, *PINT_BUFFER;
21192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
212d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* 0:11A 1:11B 2:11G */
21392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef enum _VIA_BB_TYPE
21492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond{
215d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More    BB_TYPE_11A = 0,
21692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    BB_TYPE_11B,
21792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    BB_TYPE_11G
21892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} VIA_BB_TYPE, *PVIA_BB_TYPE;
21992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
220d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* 0:11a, 1:11b, 2:11gb (only CCK in BasicRate), 3:11ga(OFDM in BasicRate) */
22192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef enum _VIA_PKT_TYPE
22292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond{
223d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More    PK_TYPE_11A = 0,
22492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    PK_TYPE_11B,
22592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    PK_TYPE_11GB,
22692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    PK_TYPE_11GA
22792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} VIA_PKT_TYPE, *PVIA_PKT_TYPE;
22892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
229d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/*++ NDIS related */
23092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
23192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef enum __DEVICE_NDIS_STATUS {
232d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More    STATUS_SUCCESS = 0,
23392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    STATUS_FAILURE,
23492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    STATUS_RESOURCES,
23592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    STATUS_PENDING,
23692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} DEVICE_NDIS_STATUS, *PDEVICE_NDIS_STATUS;
23792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
23892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MAX_BSSIDINFO_4_PMKID   16
23992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MAX_PMKIDLIST           5
240d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* flags for PMKID Candidate list structure */
24192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED	0x01
24292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
243d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* PMKID Structures */
244cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres Moretypedef unsigned char   NDIS_802_11_PMKID_VALUE[16];
24592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
24692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef enum _NDIS_802_11_WEP_STATUS
24792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond{
24892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11WEPEnabled,
24992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
25092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11WEPDisabled,
25192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
25292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11WEPKeyAbsent,
25392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
25492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11WEPNotSupported,
25592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
25692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11Encryption2Enabled,
25792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11Encryption2KeyAbsent,
25892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11Encryption3Enabled,
25992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11Encryption3KeyAbsent
26092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
26192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond  NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
26292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
26392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef enum _NDIS_802_11_STATUS_TYPE
26492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond{
265d3e2395154499a846b3210b45b046e9f0d3a5044Andres More	Ndis802_11StatusType_Authentication,
266d3e2395154499a846b3210b45b046e9f0d3a5044Andres More	Ndis802_11StatusType_MediaStreamMode,
267d3e2395154499a846b3210b45b046e9f0d3a5044Andres More	Ndis802_11StatusType_PMKID_CandidateList,
268d3e2395154499a846b3210b45b046e9f0d3a5044Andres More	Ndis802_11StatusTypeMax, /* not a real type, defined as upper bound */
26992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
27092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
271d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* added new types for PMKID Candidate lists */
27292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct _PMKID_CANDIDATE {
27392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    NDIS_802_11_MAC_ADDRESS BSSID;
274cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More    unsigned long Flags;
27592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} PMKID_CANDIDATE, *PPMKID_CANDIDATE;
27692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
27792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct _BSSID_INFO
27892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond{
27992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    NDIS_802_11_MAC_ADDRESS BSSID;
28092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    NDIS_802_11_PMKID_VALUE PMKID;
28192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} BSSID_INFO, *PBSSID_INFO;
28292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
28392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct tagSPMKID {
284cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More    unsigned long Length;
285cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More    unsigned long BSSIDInfoCount;
28692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID];
28792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} SPMKID, *PSPMKID;
28892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
28992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct tagSPMKIDCandidateEvent {
29092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    NDIS_802_11_STATUS_TYPE     StatusType;
291cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More	unsigned long Version;       /* Version of the structure */
292cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More	unsigned long NumCandidates; /* No. of pmkid candidates */
29392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST];
294193a823caaf0e2a79a447014be00a6b70ed216a2Jim Lieb} SPMKIDCandidateEvent, *PSPMKIDCandidateEvent;
29592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
296d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/*++ 802.11h related */
29792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MAX_QUIET_COUNT     8
29892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
29992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct tagSQuietControl {
300dfdcc425975d06cbfcc9b5c0fad2f3af5476cd05Andres More    bool        bEnable;
30152a7e64b06f70404c2539e4462063a8df9e4ee13Andres More    u32       dwStartTime;
302b902fbfebf2c80c3782e41eda24b487964a47fd1Andres More    u8        byPeriod;
3033eaca0d2f5a4137d4a5ecf63cf34cdf13b499beeAndres More    u16        wDuration;
304193a823caaf0e2a79a447014be00a6b70ed216a2Jim Lieb} SQuietControl, *PSQuietControl;
30592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
306d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* The receive duplicate detection cache entry */
30792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct tagSCacheEntry{
3083eaca0d2f5a4137d4a5ecf63cf34cdf13b499beeAndres More    u16        wFmSequence;
309b902fbfebf2c80c3782e41eda24b487964a47fd1Andres More    u8        abyAddr2[ETH_ALEN];
3103eaca0d2f5a4137d4a5ecf63cf34cdf13b499beeAndres More    u16        wFrameCtl;
31192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} SCacheEntry, *PSCacheEntry;
31292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
31392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct tagSCache{
31492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond/* The receive cache is updated circularly.  The next entry to be written is
31592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * indexed by the "InPtr".
316d3e2395154499a846b3210b45b046e9f0d3a5044Andres More */
317cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More	unsigned int uInPtr; /* Place to use next */
31892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    SCacheEntry     asCacheEntry[DUPLICATE_RX_CACHE_LENGTH];
31992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} SCache, *PSCache;
32092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
32192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define CB_MAX_RX_FRAG                 64
322d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/*
323d3e2395154499a846b3210b45b046e9f0d3a5044Andres More * DeFragment Control Block, used for collecting fragments prior to reassembly
324d3e2395154499a846b3210b45b046e9f0d3a5044Andres More */
32592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct tagSDeFragControlBlock
32692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond{
3273eaca0d2f5a4137d4a5ecf63cf34cdf13b499beeAndres More    u16            wSequence;
3283eaca0d2f5a4137d4a5ecf63cf34cdf13b499beeAndres More    u16            wFragNum;
329b902fbfebf2c80c3782e41eda24b487964a47fd1Andres More    u8            abyAddr2[ETH_ALEN];
330cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More	unsigned int            uLifetime;
33192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    struct sk_buff* skb;
332b902fbfebf2c80c3782e41eda24b487964a47fd1Andres More    u8 *           pbyRxBuffer;
333cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More    unsigned int            cbFrameLength;
334dfdcc425975d06cbfcc9b5c0fad2f3af5476cd05Andres More    bool            bInUse;
335193a823caaf0e2a79a447014be00a6b70ed216a2Jim Lieb} SDeFragControlBlock, *PSDeFragControlBlock;
33692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
337d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* flags for options */
33892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_UNPLUG          0x00000001UL
33992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_PREAMBLE_TYPE   0x00000002UL
34092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_OP_MODE         0x00000004UL
34192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_PS_MODE         0x00000008UL
34292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define		DEVICE_FLAGS_80211h_MODE	 0x00000010UL
34392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
344d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* flags for driver status */
34592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_OPENED          0x00010000UL
34692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_WOL_ENABLED     0x00080000UL
347d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* flags for capabilities */
34892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_TX_ALIGN        0x01000000UL
34992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_HAVE_CAM        0x02000000UL
35092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_FLOW_CTRL       0x04000000UL
35192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
352d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* flags for MII status */
35392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_LINK_FAIL             0x00000001UL
35492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_SPEED_10              0x00000002UL
35592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_SPEED_100             0x00000004UL
35692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_SPEED_1000            0x00000008UL
35792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_DUPLEX_FULL           0x00000010UL
35892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_AUTONEG_ENABLE        0x00000020UL
35992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FORCED_BY_EEPROM      0x00000040UL
360d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* for device_set_media_duplex */
36192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_LINK_CHANGE           0x00000001UL
36292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
36392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct __device_opt {
364d3e2395154499a846b3210b45b046e9f0d3a5044Andres More	int nRxDescs0;  /* number of RX descriptors 0 */
365d3e2395154499a846b3210b45b046e9f0d3a5044Andres More	int nTxDescs0;  /* number of TX descriptors 0, 1, 2, 3 */
366d3e2395154499a846b3210b45b046e9f0d3a5044Andres More	int rts_thresh; /* RTS threshold */
36792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    int         frag_thresh;
36892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    int         OpMode;
36992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    int         data_rate;
37092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    int         channel_num;
37192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    int         short_retry;
37292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    int         long_retry;
37392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    int         bbp_type;
374659770d4033373340bc24fc125d1f3ba215e4669Andres More    u32         flags;
37592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} OPTIONS, *POPTIONS;
37692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
37714c5ef57714d21ff8234aa9a756765e9cb38f837Malcolm Priestleystruct vnt_private {
37861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* netdev */
37961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct usb_device *usb;
38061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct net_device *dev;
38161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct net_device_stats stats;
38292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
38361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	OPTIONS sOpts;
38492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
38561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct tasklet_struct CmdWorkItem;
38661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct tasklet_struct EventWorkItem;
38761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct tasklet_struct ReadWorkItem;
38861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct tasklet_struct RxMngWorkItem;
38931d5bbf3da8c3c9de5944f2c09cbc7ea5a72bdb4Ben Hutchings
39061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 rx_buf_sz;
39161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int multicast_limit;
39261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byRxMode;
39392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
39461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	spinlock_t lock;
39592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
39661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 rx_bytes;
39792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
39861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byRevId;
39992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
40061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 flags;
40161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long Flags;
40292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
40361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	SCache sDupRxCache;
40492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
40561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG];
40661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 cbDFCB;
40761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 cbFreeDFCB;
40861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uCurrentDFCBIdx;
40992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
41061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* USB */
41161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct urb *pControlURB;
41261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct urb *pInterruptURB;
41361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct usb_ctrlrequest sUsbCtlRequest;
41461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 int_interval;
41592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
41661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Variables to track resources for the BULK In Pipe */
417115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestley	struct vnt_rcb *pRCBMem;
418115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestley	struct vnt_rcb *apRCB[CB_MAX_RX_DESC];
41961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 cbRD;
420115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestley	struct vnt_rcb *FirstRecvFreeList;
421115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestley	struct vnt_rcb *LastRecvFreeList;
42261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 NumRecvFreeList;
423115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestley	struct vnt_rcb *FirstRecvMngList;
424115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestley	struct vnt_rcb *LastRecvMngList;
42561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 NumRecvMngList;
42661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bIsRxWorkItemQueued;
42761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bIsRxMngWorkItemQueued;
428cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More	unsigned long ulRcvRefCount; /* packets that have not returned back */
42992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
43061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Variables to track resources for the BULK Out Pipe */
431dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	struct vnt_usb_send_context *apTD[CB_MAX_TX_DESC];
43261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 cbTD;
43392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
43461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Variables to track resources for the Interrupt In Pipe */
43561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	INT_BUFFER intBuf;
43661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int fKillEventPollingThread;
43761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bEventAvailable;
43892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
43961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* default config from file by user setting */
44061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	DEFAULT_CONFIG config_file;
44192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
44261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Statistic for USB */
44361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulBulkInPosted;
44461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulBulkInError;
44561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulBulkInContCRCError;
44661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulBulkInBytesRead;
44792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
44861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulBulkOutPosted;
44961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulBulkOutError;
45061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulBulkOutContCRCError;
45161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulBulkOutBytesWrite;
45292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
45361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulIntInPosted;
45461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulIntInError;
45561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulIntInContCRCError;
45661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulIntInBytesRead;
45792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
45861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Version control */
45961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wFirmwareVersion;
46061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byLocalID;
46161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byRFType;
46261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBRxConf;
46392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
46461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byZoneType;
46561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bZoneRegExist;
46692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
46761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byOriginalZonetype;
46892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
46961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bLinkPass; /* link status: OK or fail */
47061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyCurrentNetAddr[ETH_ALEN];
47161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyPermanentNetAddr[ETH_ALEN];
47292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
47361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bExistSWNetAddr;
47492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
47561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Adapter statistics */
47661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	SStatCounter scStatistic;
47761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* 802.11 counter */
47861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	SDot11Counters s802_11Counter;
47992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
48061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Maintain statistical debug info. */
48161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long packetsReceived;
48261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long packetsReceivedDropped;
48361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long packetsReceivedOverflow;
48461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long packetsSent;
48561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long packetsSentDropped;
48661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long SendContextsInUse;
48761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long RcvBuffersInUse;
48892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
48914c5ef57714d21ff8234aa9a756765e9cb38f837Malcolm Priestley	/* 802.11 management */
4904f4a89c9cefeefa58006d02059b9fc7e078ae31aMalcolm Priestley	struct vnt_manager vnt_mgmt;
49192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
4927c65fa2a4c176c9bfab1ef954c4cef005dd9fb8bMalcolm Priestley	u64 qwCurrTSF;
49361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 cbBulkInMax;
49461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bPSRxBeacon;
49561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
49661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* 802.11 MAC specific */
49761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uCurrRSSI;
49861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byCurrSQ;
49961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
50061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Antenna Diversity */
50161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bTxRxAntInv;
50261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwRxAntennaSel;
50361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwTxAntennaSel;
50461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byAntennaCount;
50561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byRxAntennaMode;
50661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byTxAntennaMode;
50761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byRadioCtl;
50861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 bHWRadioOff;
50961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
51061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* SQ3 functions for antenna diversity */
51161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct timer_list TimerSQ3Tmax1;
51261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct timer_list TimerSQ3Tmax2;
51361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct timer_list TimerSQ3Tmax3;
51461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
51561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bDiversityRegCtlON;
51661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bDiversityEnable;
51761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulDiversityNValue;
51861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulDiversityMValue;
51961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byTMax;
52061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byTMax2;
52161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byTMax3;
52261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulSQ3TH;
52361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
52461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long uDiversityCnt;
52561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byAntennaState;
52661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulRatio_State0;
52761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulRatio_State1;
52861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulSQ3_State0;
52961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulSQ3_State1;
53061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
53161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long aulSQ3Val[MAX_RATE];
53261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long aulPktNum[MAX_RATE];
533cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More
534cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More	/* IFS & Cw */
53561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uSIFS;  /* Current SIFS */
53661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uDIFS;  /* Current DIFS */
53761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uEIFS;  /* Current EIFS */
53861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uSlot;  /* Current SlotTime */
53961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uCwMin; /* Current CwMin */
54061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uCwMax; /* CwMax is fixed on 1023 */
54161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
54261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* PHY parameter */
54361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8  bySIFS;
54461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8  byDIFS;
54561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8  byEIFS;
54661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8  bySlot;
54761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8  byCWMaxMin;
54861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
54961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Rate */
55061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	VIA_BB_TYPE byBBType; /* 0: 11A, 1:11B, 2:11G */
55161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	VIA_PKT_TYPE byPacketType; /* 0:11a 1:11b 2:11gb 3:11ga */
55261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wBasicRate;
55361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byACKRate;
55461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byTopOFDMBasicRate;
55561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byTopCCKBasicRate;
55661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
55761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwAotoRateTxOkCnt;
55861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwAotoRateTxFailCnt;
55961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwErrorRateThreshold[13];
56061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwTPTable[MAX_RATE];
56161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyEEPROM[EEP_MAX_CONTEXT_SIZE];  /*u32 alignment */
56261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
56361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byMinChannel;
56461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byMaxChannel;
56561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uConnectionRate;
56661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
56761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byPreambleType;
56861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byShortPreamble;
56961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* CARD_PHY_TYPE */
57061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 eConfigPHYMode;
57161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
57261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* For RF Power table */
57361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byCCKPwr;
57461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byOFDMPwrG;
57561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byOFDMPwrA;
57661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byCurPwr;
57761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyCCKPwrTbl[14];
57861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyOFDMPwrTbl[14];
57961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyOFDMAPwrTbl[42];
58061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
58161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wCurrentRate;
58261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wRTSThreshold;
58361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wFragmentationThreshold;
58461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byShortRetryLimit;
58561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byLongRetryLimit;
58661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	CARD_OP_MODE eOPMode;
58761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bBSSIDFilter;
58861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wMaxTransmitMSDULifetime;
58961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyBSSID[ETH_ALEN];
59061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyDesireBSSID[ETH_ALEN];
59161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
59261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwMaxReceiveLifetime;  /* dot11MaxReceiveLifetime */
59361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
59461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bCCK;
59561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bEncryptionEnable;
59661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bLongHeader;
59761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bShortSlotTime;
59861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bProtectMode;
59961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bNonERPPresent;
60061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bBarkerPreambleMd;
60161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
60261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byERPFlag;
60361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wUseProtectCntDown;
60461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
60561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bRadioControlOff;
60661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bRadioOff;
60761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
60861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Power save */
60961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bEnablePSMode;
61061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wListenInterval;
61161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bPWBitOn;
61261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	WMAC_POWER_MODE ePSMode;
61361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulPSModeWaitTx;
61461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bPSModeTxBurst;
61561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
61661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Beacon releated */
61761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wSeqCounter;
61861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bBeaconBufReady;
61961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bBeaconSent;
62061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bFixRate;
62161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byCurrentCh;
62261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uScanTime;
62361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
62461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	CMD_STATE eCommandState;
62561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
62661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	CMD_CODE eCommand;
62761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bBeaconTx;
62861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byScanBBType;
62961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
63061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bStopBeacon;
63161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bStopDataPkt;
63261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bStopTx0Pkt;
63361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uAutoReConnectTime;
63461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uIsroamingTime;
63561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
63661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* 802.11 counter */
63761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
63861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	CMD_ITEM eCmdQueue[CMD_Q_SIZE];
63961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uCmdDequeueIdx;
64061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uCmdEnqueueIdx;
64161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 cbFreeCmdQueue;
64261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bCmdRunning;
64361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bCmdClear;
64461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bNeedRadioOFF;
64561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
64661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bEnableRoaming;
64761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bIsRoaming;
64861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bFastRoaming;
64961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 bSameBSSMaxNum;
65061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 bSameBSSCurNum;
65161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bRoaming;
65261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int b11hEable;
65361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulTxPower;
65461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
65561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Encryption */
65661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	NDIS_802_11_WEP_STATUS eEncryptionStatus;
65761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int  bTransmitKey;
65861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	NDIS_802_11_WEP_STATUS eOldEncryptionStatus;
65961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	SKeyManagement sKey;
66061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwIVCounter;
66161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
66261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	RC4Ext SBox;
66361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyPRNG[WLAN_WEPMAX_KEYLEN+3];
66461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byKeyIndex;
66561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
66661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bAES;
66761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
66861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uKeyLength;
66961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyKey[WLAN_WEP232_KEYLEN];
67061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
67161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* for AP mode */
67261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uAssocCount;
67361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bMoreData;
67461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
67561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* QoS */
67661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bGrpAckPolicy;
67761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
67861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byAutoFBCtrl;
67961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
68061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bTxMICFail;
68161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bRxMICFail;
68261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
68361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* For Update BaseBand VGA Gain Offset */
68461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bUpdateBBVGA;
68561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uBBVGADiffCount;
68661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBVGANew;
68761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBVGACurrent;
68861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyBBVGA[BB_VGA_LEVEL];
68961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	signed long ldBmThreshold[BB_VGA_LEVEL];
69061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
69161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBPreEDRSSI;
69261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBPreEDIndex;
69361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
69461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bRadioCmd;
69561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwDiagRefCount;
69661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
69761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* For FOE Tuning */
69861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8  byFOETuning;
69961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
70061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* For Auto Power Tunning */
70161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8  byAutoPwrTunning;
70261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
70361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* BaseBand Loopback Use */
70461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBCR4d;
70561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBCRc9;
70661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBCR88;
70761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBCR09;
70861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
70961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* command timer */
71061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct timer_list sTimerCommand;
71192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
71261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct timer_list sTimerTxData;
71361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long nTxDataTimeCout;
71461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int fTxDataInSleep;
71561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int IsTxDataTrigger;
71692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
71761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int fWPA_Authened; /*is WPA/WPA-PSK or WPA2/WPA2-PSK authen?? */
71861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byReAssocCount;
71961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byLinkWaitCount;
72092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
721ceb8c5dabcfa586c7e87b9acc999f1c08d2f612aAndres More	struct ethhdr sTxEthHeader;
722ceb8c5dabcfa586c7e87b9acc999f1c08d2f612aAndres More	struct ethhdr sRxEthHeader;
72361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyBroadcastAddr[ETH_ALEN];
72461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abySNAP_RFC1042[ETH_ALEN];
72561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abySNAP_Bridgetunnel[ETH_ALEN];
72692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
72761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Pre-Authentication & PMK cache */
72861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	SPMKID gsPMKID;
72961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	SPMKIDCandidateEvent gsPMKIDCandidate;
73092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
73161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* for 802.11h */
73261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int b11hEnable;
73392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
73461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bChannelSwitch;
73561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byNewChannel;
73661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byChannelSwitchCount;
73792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
73861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* WPA supplicant daemon */
73961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bWPADEVUp;
74061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bwextstep0;
74161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bwextstep1;
74261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bwextstep2;
74361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bwextstep3;
74461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bWPASuppWextEnabled;
74592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
74661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* user space daemon: hostapd, is used for HOSTAP */
74761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bEnableHostapd;
74861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bEnable8021x;
74961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bEnableHostWEP;
75061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct net_device *apdev;
75161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int (*tx_80211)(struct sk_buff *skb, struct net_device *dev);
75292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
75361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uChannel;
75492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
75561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct iw_statistics wstats; /* wireless stats */
75692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
75761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bCommit;
75892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
75914c5ef57714d21ff8234aa9a756765e9cb38f837Malcolm Priestley};
76092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
76192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define EnqueueRCB(_Head, _Tail, _RCB)                  \
76292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond{                                                       \
76392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    if (!_Head) {                                       \
76492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond        _Head = _RCB;                                   \
76592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    }                                                   \
76692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    else {                                              \
76792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond        _Tail->Next = _RCB;                             \
76892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    }                                                   \
76992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    _RCB->Next = NULL;                                  \
77092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    _Tail = _RCB;                                       \
77192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond}
77292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
77392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define DequeueRCB(Head, Tail)                          \
77492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond{                                                       \
775115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestley    struct vnt_rcb *RCB = Head;                         \
77692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    if (!RCB->Next) {                                   \
77792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond        Tail = NULL;                                    \
77892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    }                                                   \
77992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Head = RCB->Next;                                   \
78092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond}
78192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
78292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) {   \
78392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    if ((uVar) >= ((uModulo) - 1))                  \
78492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond        (uVar) = 0;                                 \
78592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    else                                            \
78692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond        (uVar)++;                                   \
78792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond}
78892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
78992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_RESET_IN_PROGRESS               0x00000001
79092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_DISCONNECTED                    0x00000002
79192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_HALT_IN_PROGRESS                0x00000004
79292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_SURPRISE_REMOVED                0x00000008
79392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_RECV_LOOKASIDE                  0x00000010
79492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_INIT_IN_PROGRESS                0x00000020
79592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_SEND_SIDE_RESOURCE_ALLOCATED    0x00000040
79692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_RECV_SIDE_RESOURCE_ALLOCATED    0x00000080
79792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_POST_READS                      0x00000100
79892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_POST_WRITES                     0x00000200
79992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_CONTROL_READS                   0x00000400
80092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_CONTROL_WRITES                  0x00000800
80192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
80292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MP_SET_FLAG(_M, _F)             ((_M)->Flags |= (_F))
80392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MP_CLEAR_FLAG(_M, _F)            ((_M)->Flags &= ~(_F))
80492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MP_TEST_FLAGS(_M, _F)            (((_M)->Flags & (_F)) == (_F))
80592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
80692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MP_IS_READY(_M)        (((_M)->Flags & \
80792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond                                 (fMP_DISCONNECTED | fMP_RESET_IN_PROGRESS | fMP_HALT_IN_PROGRESS | fMP_INIT_IN_PROGRESS | fMP_SURPRISE_REMOVED)) == 0)
80892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
809dd0a774fc727ee793780197beb3f2cf80bfefa99Malcolm Priestleyint device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF);
81092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
81192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#endif
812