device.h revision bf1c820fcbdf3bb23c4846bdb48a191e710cb841
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/delay.h>
3611d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <linux/device.h>
3711d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <linux/firmware.h>
3811d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <linux/etherdevice.h>
3911d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <linux/suspend.h>
4092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include <linux/if_arp.h>
4111d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <linux/wireless.h>
4211d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <net/iw_handler.h>
4311d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <net/cfg80211.h>
4411d404cb56ecd53bb23499897fbe7be1a9ac4827Malcolm Priestley#include <linux/timer.h>
4592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include <linux/usb.h>
46f0fde117c12692f76887e09944f4d923a5470bddMalcolm Priestley#include <linux/crc32.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 "srom.h"
7392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include "rc4.h"
7492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include "desc.h"
7592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include "key.h"
7692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#include "card.h"
77748bf69c155607b6413206fcbce4d90097bac723Malcolm Priestley#include "rndis.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
152302433daf47aeb7d21d66e55fb84d6a8fffd4aedMalcolm Priestley#define DEVICE_INIT_COLD	0x0 /* cold init */
153302433daf47aeb7d21d66e55fb84d6a8fffd4aedMalcolm Priestley#define DEVICE_INIT_RESET	0x1 /* reset init or Dx to D0 power remain */
154302433daf47aeb7d21d66e55fb84d6a8fffd4aedMalcolm Priestley#define DEVICE_INIT_DXPL	0x2 /* Dx to D0 power lost init */
15592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
156d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* USB */
15792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
158d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/*
159d3e2395154499a846b3210b45b046e9f0d3a5044Andres More * Enum of context types for SendPacket
160d3e2395154499a846b3210b45b046e9f0d3a5044Andres More */
16192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef enum _CONTEXT_TYPE {
16292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    CONTEXT_DATA_PACKET = 1,
16392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    CONTEXT_MGMT_PACKET
16492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} CONTEXT_TYPE;
16592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
166d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* RCB (Receive Control Block) */
167115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestleystruct vnt_rcb {
168dd0a774fc727ee793780197beb3f2cf80bfefa99Malcolm Priestley	void *Next;
169dd0a774fc727ee793780197beb3f2cf80bfefa99Malcolm Priestley	signed long Ref;
170dd0a774fc727ee793780197beb3f2cf80bfefa99Malcolm Priestley	void *pDevice;
171dd0a774fc727ee793780197beb3f2cf80bfefa99Malcolm Priestley	struct urb *pUrb;
172dd0a774fc727ee793780197beb3f2cf80bfefa99Malcolm Priestley	struct vnt_rx_mgmt sMngPacket;
173dd0a774fc727ee793780197beb3f2cf80bfefa99Malcolm Priestley	struct sk_buff *skb;
174dd0a774fc727ee793780197beb3f2cf80bfefa99Malcolm Priestley	int bBoolInUse;
175115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestley};
17692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
177d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* used to track bulk out irps */
178dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestleystruct vnt_usb_send_context {
179dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	void *pDevice;
180dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	struct sk_buff *pPacket;
181dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	struct urb *pUrb;
182dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	unsigned int uBufLen;
183dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	CONTEXT_TYPE Type;
184dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	struct ethhdr sEthHeader;
185dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	void *Next;
186dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	bool bBoolInUse;
187dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	unsigned char Data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS];
188dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley};
18992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
19051934e7f897b8b6da5f84a44022bf34737c21168Malcolm Priestley/* tx packet info for rxtx */
19151934e7f897b8b6da5f84a44022bf34737c21168Malcolm Priestleystruct vnt_tx_pkt_info {
19251934e7f897b8b6da5f84a44022bf34737c21168Malcolm Priestley	u16 fifo_ctl;
19351934e7f897b8b6da5f84a44022bf34737c21168Malcolm Priestley	u8 dest_addr[ETH_ALEN];
19451934e7f897b8b6da5f84a44022bf34737c21168Malcolm Priestley};
19551934e7f897b8b6da5f84a44022bf34737c21168Malcolm Priestley
196213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres More/* structure got from configuration file as user-desired default settings */
197213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres Moretypedef struct _DEFAULT_CONFIG {
198213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres More	signed int    ZoneType;
199213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres More	signed int    eConfigMode;
200213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres More	signed int    eAuthenMode;        /* open/wep/wpa */
201213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres More	signed int    bShareKeyAlgorithm; /* open-open/{open,wep}-sharekey */
202213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres More	signed int    keyidx;             /* wepkey index */
203213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres More	signed int    eEncryptionStatus;
204213d2e9322ed509c2f80b07d7feb4427ebcd7b0bAndres More} DEFAULT_CONFIG, *PDEFAULT_CONFIG;
20592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
206d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/*
207d3e2395154499a846b3210b45b046e9f0d3a5044Andres More * Structure to keep track of USB interrupt packets
208d3e2395154499a846b3210b45b046e9f0d3a5044Andres More */
20992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct {
210cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More    unsigned int            uDataLen;
211b902fbfebf2c80c3782e41eda24b487964a47fd1Andres More    u8 *           pDataBuf;
212d3e2395154499a846b3210b45b046e9f0d3a5044Andres More  /* struct urb *pUrb; */
213dfdcc425975d06cbfcc9b5c0fad2f3af5476cd05Andres More    bool            bInUse;
21492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} INT_BUFFER, *PINT_BUFFER;
21592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
216d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* 0:11A 1:11B 2:11G */
21792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef enum _VIA_BB_TYPE
21892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond{
219d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More    BB_TYPE_11A = 0,
22092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    BB_TYPE_11B,
22192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    BB_TYPE_11G
22292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} VIA_BB_TYPE, *PVIA_BB_TYPE;
22392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
224d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/*++ NDIS related */
22592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
22692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef enum __DEVICE_NDIS_STATUS {
227d9d1ccb51f60cc211e0aa8d132bc3487053b2b1dAndres More    STATUS_SUCCESS = 0,
22892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    STATUS_FAILURE,
22992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    STATUS_RESOURCES,
23092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    STATUS_PENDING,
23192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} DEVICE_NDIS_STATUS, *PDEVICE_NDIS_STATUS;
23292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
23392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MAX_BSSIDINFO_4_PMKID   16
23492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MAX_PMKIDLIST           5
235d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* flags for PMKID Candidate list structure */
23692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED	0x01
23792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
238d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* PMKID Structures */
239cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres Moretypedef unsigned char   NDIS_802_11_PMKID_VALUE[16];
24092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
24192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef enum _NDIS_802_11_WEP_STATUS
24292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond{
24392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11WEPEnabled,
24492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
24592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11WEPDisabled,
24692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
24792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11WEPKeyAbsent,
24892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
24992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11WEPNotSupported,
25092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
25192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11Encryption2Enabled,
25292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11Encryption2KeyAbsent,
25392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11Encryption3Enabled,
25492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Ndis802_11Encryption3KeyAbsent
25592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
25692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond  NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
25792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
25892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef enum _NDIS_802_11_STATUS_TYPE
25992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond{
260d3e2395154499a846b3210b45b046e9f0d3a5044Andres More	Ndis802_11StatusType_Authentication,
261d3e2395154499a846b3210b45b046e9f0d3a5044Andres More	Ndis802_11StatusType_MediaStreamMode,
262d3e2395154499a846b3210b45b046e9f0d3a5044Andres More	Ndis802_11StatusType_PMKID_CandidateList,
263d3e2395154499a846b3210b45b046e9f0d3a5044Andres More	Ndis802_11StatusTypeMax, /* not a real type, defined as upper bound */
26492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
26592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
266d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* added new types for PMKID Candidate lists */
26792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct _PMKID_CANDIDATE {
26892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    NDIS_802_11_MAC_ADDRESS BSSID;
269cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More    unsigned long Flags;
27092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} PMKID_CANDIDATE, *PPMKID_CANDIDATE;
27192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
27292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct _BSSID_INFO
27392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond{
27492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    NDIS_802_11_MAC_ADDRESS BSSID;
27592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    NDIS_802_11_PMKID_VALUE PMKID;
27692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} BSSID_INFO, *PBSSID_INFO;
27792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
27892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct tagSPMKID {
279cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More    unsigned long Length;
280cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More    unsigned long BSSIDInfoCount;
28192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID];
28292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} SPMKID, *PSPMKID;
28392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
28492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct tagSPMKIDCandidateEvent {
28592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    NDIS_802_11_STATUS_TYPE     StatusType;
286cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More	unsigned long Version;       /* Version of the structure */
287cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More	unsigned long NumCandidates; /* No. of pmkid candidates */
28892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST];
289193a823caaf0e2a79a447014be00a6b70ed216a2Jim Lieb} SPMKIDCandidateEvent, *PSPMKIDCandidateEvent;
29092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
291d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/*++ 802.11h related */
29292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MAX_QUIET_COUNT     8
29392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
29492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct tagSQuietControl {
295dfdcc425975d06cbfcc9b5c0fad2f3af5476cd05Andres More    bool        bEnable;
29652a7e64b06f70404c2539e4462063a8df9e4ee13Andres More    u32       dwStartTime;
297b902fbfebf2c80c3782e41eda24b487964a47fd1Andres More    u8        byPeriod;
2983eaca0d2f5a4137d4a5ecf63cf34cdf13b499beeAndres More    u16        wDuration;
299193a823caaf0e2a79a447014be00a6b70ed216a2Jim Lieb} SQuietControl, *PSQuietControl;
30092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
301d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* The receive duplicate detection cache entry */
30292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct tagSCacheEntry{
3033eaca0d2f5a4137d4a5ecf63cf34cdf13b499beeAndres More    u16        wFmSequence;
304b902fbfebf2c80c3782e41eda24b487964a47fd1Andres More    u8        abyAddr2[ETH_ALEN];
3053eaca0d2f5a4137d4a5ecf63cf34cdf13b499beeAndres More    u16        wFrameCtl;
30692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} SCacheEntry, *PSCacheEntry;
30792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
30892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct tagSCache{
30992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond/* The receive cache is updated circularly.  The next entry to be written is
31092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond * indexed by the "InPtr".
311d3e2395154499a846b3210b45b046e9f0d3a5044Andres More */
312cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More	unsigned int uInPtr; /* Place to use next */
31392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    SCacheEntry     asCacheEntry[DUPLICATE_RX_CACHE_LENGTH];
31492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} SCache, *PSCache;
31592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
31692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define CB_MAX_RX_FRAG                 64
317d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/*
318d3e2395154499a846b3210b45b046e9f0d3a5044Andres More * DeFragment Control Block, used for collecting fragments prior to reassembly
319d3e2395154499a846b3210b45b046e9f0d3a5044Andres More */
32092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct tagSDeFragControlBlock
32192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond{
3223eaca0d2f5a4137d4a5ecf63cf34cdf13b499beeAndres More    u16            wSequence;
3233eaca0d2f5a4137d4a5ecf63cf34cdf13b499beeAndres More    u16            wFragNum;
324b902fbfebf2c80c3782e41eda24b487964a47fd1Andres More    u8            abyAddr2[ETH_ALEN];
325cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More	unsigned int            uLifetime;
32692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    struct sk_buff* skb;
327b902fbfebf2c80c3782e41eda24b487964a47fd1Andres More    u8 *           pbyRxBuffer;
328cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More    unsigned int            cbFrameLength;
329dfdcc425975d06cbfcc9b5c0fad2f3af5476cd05Andres More    bool            bInUse;
330193a823caaf0e2a79a447014be00a6b70ed216a2Jim Lieb} SDeFragControlBlock, *PSDeFragControlBlock;
33192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
332d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* flags for options */
33392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_UNPLUG          0x00000001UL
33492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_PREAMBLE_TYPE   0x00000002UL
33592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_OP_MODE         0x00000004UL
33692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_PS_MODE         0x00000008UL
33792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define		DEVICE_FLAGS_80211h_MODE	 0x00000010UL
33892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
339d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* flags for driver status */
34092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_OPENED          0x00010000UL
34192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_WOL_ENABLED     0x00080000UL
342d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* flags for capabilities */
34392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_TX_ALIGN        0x01000000UL
34492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_HAVE_CAM        0x02000000UL
34592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FLAGS_FLOW_CTRL       0x04000000UL
34692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
347d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* flags for MII status */
34892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_LINK_FAIL             0x00000001UL
34992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_SPEED_10              0x00000002UL
35092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_SPEED_100             0x00000004UL
35192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_SPEED_1000            0x00000008UL
35292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_DUPLEX_FULL           0x00000010UL
35392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_AUTONEG_ENABLE        0x00000020UL
35492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_FORCED_BY_EEPROM      0x00000040UL
355d3e2395154499a846b3210b45b046e9f0d3a5044Andres More/* for device_set_media_duplex */
35692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define     DEVICE_LINK_CHANGE           0x00000001UL
35792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
35892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bondtypedef struct __device_opt {
359d3e2395154499a846b3210b45b046e9f0d3a5044Andres More	int nRxDescs0;  /* number of RX descriptors 0 */
360d3e2395154499a846b3210b45b046e9f0d3a5044Andres More	int nTxDescs0;  /* number of TX descriptors 0, 1, 2, 3 */
361d3e2395154499a846b3210b45b046e9f0d3a5044Andres More	int rts_thresh; /* RTS threshold */
36292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    int         frag_thresh;
36392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    int         OpMode;
36492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    int         data_rate;
36592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    int         channel_num;
36692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    int         short_retry;
36792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    int         long_retry;
36892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    int         bbp_type;
369659770d4033373340bc24fc125d1f3ba215e4669Andres More    u32         flags;
37092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond} OPTIONS, *POPTIONS;
37192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
37214c5ef57714d21ff8234aa9a756765e9cb38f837Malcolm Priestleystruct vnt_private {
37361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* netdev */
37461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct usb_device *usb;
37561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct net_device *dev;
37661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct net_device_stats stats;
37792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
37861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	OPTIONS sOpts;
37992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
38061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct tasklet_struct CmdWorkItem;
38161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct tasklet_struct EventWorkItem;
38281d720d3150dedebec423ac8efbdf6bc2055f1fcMalcolm Priestley	struct work_struct read_work_item;
383a21fc2f5bef9031d6c7ace224c7061b9e53596e4Malcolm Priestley	struct work_struct rx_mng_work_item;
38431d5bbf3da8c3c9de5944f2c09cbc7ea5a72bdb4Ben Hutchings
38561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 rx_buf_sz;
38661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int multicast_limit;
38761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byRxMode;
38892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
38961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	spinlock_t lock;
39092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
39161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 rx_bytes;
39292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
39361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byRevId;
39492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
39561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 flags;
39661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long Flags;
39792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
39861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	SCache sDupRxCache;
39992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
40061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG];
40161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 cbDFCB;
40261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 cbFreeDFCB;
40361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uCurrentDFCBIdx;
40492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
40561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* USB */
40661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct urb *pControlURB;
40761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct urb *pInterruptURB;
40861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct usb_ctrlrequest sUsbCtlRequest;
40961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 int_interval;
41092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
41161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Variables to track resources for the BULK In Pipe */
412115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestley	struct vnt_rcb *pRCBMem;
413115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestley	struct vnt_rcb *apRCB[CB_MAX_RX_DESC];
41461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 cbRD;
415115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestley	struct vnt_rcb *FirstRecvFreeList;
416115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestley	struct vnt_rcb *LastRecvFreeList;
41761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 NumRecvFreeList;
418115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestley	struct vnt_rcb *FirstRecvMngList;
419115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestley	struct vnt_rcb *LastRecvMngList;
42061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 NumRecvMngList;
42161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bIsRxWorkItemQueued;
42261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bIsRxMngWorkItemQueued;
423cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More	unsigned long ulRcvRefCount; /* packets that have not returned back */
42492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
42561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Variables to track resources for the BULK Out Pipe */
426dcdf1d0323a4eea3bc0a1131057f78234d082079Malcolm Priestley	struct vnt_usb_send_context *apTD[CB_MAX_TX_DESC];
42761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 cbTD;
42851934e7f897b8b6da5f84a44022bf34737c21168Malcolm Priestley	struct vnt_tx_pkt_info pkt_info[16];
42992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
43061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Variables to track resources for the Interrupt In Pipe */
43161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	INT_BUFFER intBuf;
43261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int fKillEventPollingThread;
43361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bEventAvailable;
43492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
43561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* default config from file by user setting */
43661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	DEFAULT_CONFIG config_file;
43792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
43861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Statistic for USB */
43961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulBulkInPosted;
44061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulBulkInError;
44161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulBulkInContCRCError;
44261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulBulkInBytesRead;
44392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
44461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulBulkOutPosted;
44561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulBulkOutError;
44661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulBulkOutContCRCError;
44761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulBulkOutBytesWrite;
44892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
44961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulIntInPosted;
45061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulIntInError;
45161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulIntInContCRCError;
45261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulIntInBytesRead;
45392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
45461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Version control */
45561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wFirmwareVersion;
45661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byLocalID;
45761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byRFType;
45861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBRxConf;
45992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
46061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byZoneType;
46161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bZoneRegExist;
46292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
46361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byOriginalZonetype;
46492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
46561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bLinkPass; /* link status: OK or fail */
466748bf69c155607b6413206fcbce4d90097bac723Malcolm Priestley	struct vnt_cmd_card_init init_command;
467748bf69c155607b6413206fcbce4d90097bac723Malcolm Priestley	struct vnt_rsp_card_init init_response;
46861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyCurrentNetAddr[ETH_ALEN];
46961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyPermanentNetAddr[ETH_ALEN];
47092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
47161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bExistSWNetAddr;
47292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
47361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Maintain statistical debug info. */
47461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long packetsReceived;
47561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long packetsReceivedDropped;
47661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long packetsReceivedOverflow;
47761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long packetsSent;
47861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long packetsSentDropped;
47961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long SendContextsInUse;
48061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long RcvBuffersInUse;
48192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
48214c5ef57714d21ff8234aa9a756765e9cb38f837Malcolm Priestley	/* 802.11 management */
4834f4a89c9cefeefa58006d02059b9fc7e078ae31aMalcolm Priestley	struct vnt_manager vnt_mgmt;
48492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
4857c65fa2a4c176c9bfab1ef954c4cef005dd9fb8bMalcolm Priestley	u64 qwCurrTSF;
48661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 cbBulkInMax;
48761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bPSRxBeacon;
48861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
48961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* 802.11 MAC specific */
49061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uCurrRSSI;
49161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byCurrSQ;
49261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
49361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Antenna Diversity */
49461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bTxRxAntInv;
49561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwRxAntennaSel;
49661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwTxAntennaSel;
49761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byAntennaCount;
49861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byRxAntennaMode;
49961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byTxAntennaMode;
50061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byRadioCtl;
50161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 bHWRadioOff;
50261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
50361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* SQ3 functions for antenna diversity */
50461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct timer_list TimerSQ3Tmax1;
50561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct timer_list TimerSQ3Tmax2;
50661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct timer_list TimerSQ3Tmax3;
50761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
50861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bDiversityRegCtlON;
50961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bDiversityEnable;
51061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulDiversityNValue;
51161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulDiversityMValue;
51261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byTMax;
51361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byTMax2;
51461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byTMax3;
51561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulSQ3TH;
51661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
51761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long uDiversityCnt;
51861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byAntennaState;
51961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulRatio_State0;
52061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulRatio_State1;
52161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulSQ3_State0;
52261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulSQ3_State1;
52361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
52461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long aulSQ3Val[MAX_RATE];
52561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long aulPktNum[MAX_RATE];
526cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More
527cc856e61ee4ffb150ff352e3d6940978a2f819e8Andres More	/* IFS & Cw */
52861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uSIFS;  /* Current SIFS */
52961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uDIFS;  /* Current DIFS */
53061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uEIFS;  /* Current EIFS */
53161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uSlot;  /* Current SlotTime */
53261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uCwMin; /* Current CwMin */
53361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uCwMax; /* CwMax is fixed on 1023 */
53461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
53561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* PHY parameter */
53661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8  bySIFS;
53761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8  byDIFS;
53861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8  byEIFS;
53961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8  bySlot;
54061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8  byCWMaxMin;
54161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
54261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Rate */
54361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	VIA_BB_TYPE byBBType; /* 0: 11A, 1:11B, 2:11G */
544bf1c820fcbdf3bb23c4846bdb48a191e710cb841Malcolm Priestley	u8 byPacketType; /* 0:11a 1:11b 2:11gb 3:11ga */
54561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wBasicRate;
54661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byACKRate;
54761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byTopOFDMBasicRate;
54861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byTopCCKBasicRate;
54961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
55061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwAotoRateTxOkCnt;
55161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwAotoRateTxFailCnt;
55261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwErrorRateThreshold[13];
55361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwTPTable[MAX_RATE];
55461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyEEPROM[EEP_MAX_CONTEXT_SIZE];  /*u32 alignment */
55561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
55661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byMinChannel;
55761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byMaxChannel;
55861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uConnectionRate;
55961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
56061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byPreambleType;
56161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byShortPreamble;
56261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* CARD_PHY_TYPE */
56361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 eConfigPHYMode;
56461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
56561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* For RF Power table */
56661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byCCKPwr;
56761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byOFDMPwrG;
56861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byOFDMPwrA;
56961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byCurPwr;
57061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyCCKPwrTbl[14];
57161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyOFDMPwrTbl[14];
57261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyOFDMAPwrTbl[42];
57361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
57461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wCurrentRate;
575f84cdf65a79b808217d9e8b82ea12d170cf66b3dMalcolm Priestley	u16 tx_rate_fb0;
576f84cdf65a79b808217d9e8b82ea12d170cf66b3dMalcolm Priestley	u16 tx_rate_fb1;
577f84cdf65a79b808217d9e8b82ea12d170cf66b3dMalcolm Priestley
57861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wRTSThreshold;
57961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wFragmentationThreshold;
58061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byShortRetryLimit;
58161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byLongRetryLimit;
582a0ad27765a5f4c9dc90fabe6a4b04a8656d7fae3Malcolm Priestley
583a0ad27765a5f4c9dc90fabe6a4b04a8656d7fae3Malcolm Priestley	enum nl80211_iftype op_mode;
584a0ad27765a5f4c9dc90fabe6a4b04a8656d7fae3Malcolm Priestley
58561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bBSSIDFilter;
58661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wMaxTransmitMSDULifetime;
58761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyBSSID[ETH_ALEN];
58861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyDesireBSSID[ETH_ALEN];
58961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
59061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwMaxReceiveLifetime;  /* dot11MaxReceiveLifetime */
59161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
59261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bCCK;
59361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bEncryptionEnable;
59461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bShortSlotTime;
59561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bProtectMode;
59661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bNonERPPresent;
59761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bBarkerPreambleMd;
59861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
59961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byERPFlag;
60061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wUseProtectCntDown;
60161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
60261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bRadioControlOff;
60361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bRadioOff;
60461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
60561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Power save */
60661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bEnablePSMode;
60761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wListenInterval;
60861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bPWBitOn;
60961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	WMAC_POWER_MODE ePSMode;
61061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulPSModeWaitTx;
61161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bPSModeTxBurst;
61261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
61361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Beacon releated */
61461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u16 wSeqCounter;
61561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bBeaconBufReady;
61661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bBeaconSent;
61761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bFixRate;
61861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byCurrentCh;
61961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uScanTime;
62061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
62161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	CMD_STATE eCommandState;
62261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
62361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	CMD_CODE eCommand;
62461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bBeaconTx;
62561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byScanBBType;
62661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
62761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bStopBeacon;
62861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bStopDataPkt;
62961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bStopTx0Pkt;
63061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uAutoReConnectTime;
63161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uIsroamingTime;
63261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
63361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* 802.11 counter */
63461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
63561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	CMD_ITEM eCmdQueue[CMD_Q_SIZE];
63661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uCmdDequeueIdx;
63761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uCmdEnqueueIdx;
63861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 cbFreeCmdQueue;
63961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bCmdRunning;
64061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bCmdClear;
64161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bNeedRadioOFF;
64261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
64361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bEnableRoaming;
64461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bIsRoaming;
64561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bFastRoaming;
64661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 bSameBSSMaxNum;
64761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 bSameBSSCurNum;
64861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bRoaming;
64961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int b11hEable;
65061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	unsigned long ulTxPower;
65161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
65261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Encryption */
65361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	NDIS_802_11_WEP_STATUS eEncryptionStatus;
65461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int  bTransmitKey;
65561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	NDIS_802_11_WEP_STATUS eOldEncryptionStatus;
65661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	SKeyManagement sKey;
65761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 dwIVCounter;
65861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
65961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	RC4Ext SBox;
66061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyPRNG[WLAN_WEPMAX_KEYLEN+3];
66161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byKeyIndex;
66261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
66361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uKeyLength;
66461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyKey[WLAN_WEP232_KEYLEN];
66561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
66661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* for AP mode */
66761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uAssocCount;
66861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bMoreData;
66961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
67061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* QoS */
67161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bGrpAckPolicy;
67261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
67361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byAutoFBCtrl;
67461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
67561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bTxMICFail;
67661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bRxMICFail;
67761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
67861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* For Update BaseBand VGA Gain Offset */
67961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bUpdateBBVGA;
68061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uBBVGADiffCount;
68161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBVGANew;
68261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBVGACurrent;
68361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyBBVGA[BB_VGA_LEVEL];
68461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	signed long ldBmThreshold[BB_VGA_LEVEL];
68561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
68661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBPreEDRSSI;
68761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBPreEDIndex;
68861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
68961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bRadioCmd;
69061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
69161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* For FOE Tuning */
69261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8  byFOETuning;
69361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
69461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* For Auto Power Tunning */
69561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8  byAutoPwrTunning;
69661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
69761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* BaseBand Loopback Use */
69861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBCR4d;
69961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBCRc9;
70061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBCR88;
70161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byBBCR09;
70261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley
70361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* command timer */
70494488a7ebfbc95c4b8fbfe39644e97b926a550a7Malcolm Priestley	struct delayed_work run_command_work;
705bd9a6dbada2263ffb26eef7a67283553092d2deeMalcolm Priestley	/* One second callback */
706bd9a6dbada2263ffb26eef7a67283553092d2deeMalcolm Priestley	struct delayed_work second_callback_work;
70792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
70860cc27472c9c4239cf6aec957fdb520510a5d93aMalcolm Priestley	u8 tx_data_time_out;
70960cc27472c9c4239cf6aec957fdb520510a5d93aMalcolm Priestley	bool tx_trigger;
71061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int fWPA_Authened; /*is WPA/WPA-PSK or WPA2/WPA2-PSK authen?? */
71161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byReAssocCount;
71261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byLinkWaitCount;
71392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
714ceb8c5dabcfa586c7e87b9acc999f1c08d2f612aAndres More	struct ethhdr sTxEthHeader;
715ceb8c5dabcfa586c7e87b9acc999f1c08d2f612aAndres More	struct ethhdr sRxEthHeader;
71661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abyBroadcastAddr[ETH_ALEN];
71761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abySNAP_RFC1042[ETH_ALEN];
71861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 abySNAP_Bridgetunnel[ETH_ALEN];
71992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
72061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* Pre-Authentication & PMK cache */
72161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	SPMKID gsPMKID;
72261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	SPMKIDCandidateEvent gsPMKIDCandidate;
72392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
72461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* for 802.11h */
72561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int b11hEnable;
72692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
72761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bChannelSwitch;
72861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byNewChannel;
72961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u8 byChannelSwitchCount;
73092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
73161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* WPA supplicant daemon */
73261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bWPADEVUp;
73361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bwextstep0;
73461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bwextstep1;
73561462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bwextstep2;
73661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bwextstep3;
73761462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bWPASuppWextEnabled;
73892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
73961462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	/* user space daemon: hostapd, is used for HOSTAP */
74061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bEnableHostapd;
74161462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bEnable8021x;
74261462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bEnableHostWEP;
74361462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct net_device *apdev;
74461462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int (*tx_80211)(struct sk_buff *skb, struct net_device *dev);
74592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
74661462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	u32 uChannel;
74792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
74861462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	struct iw_statistics wstats; /* wireless stats */
74992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
75061462ab32f8b5a3d133b734455c3a8d6b6d1de7cMalcolm Priestley	int bCommit;
75192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
75214c5ef57714d21ff8234aa9a756765e9cb38f837Malcolm Priestley};
75392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
75492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define EnqueueRCB(_Head, _Tail, _RCB)                  \
75592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond{                                                       \
75692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    if (!_Head) {                                       \
75792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond        _Head = _RCB;                                   \
75892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    }                                                   \
75992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    else {                                              \
76092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond        _Tail->Next = _RCB;                             \
76192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    }                                                   \
76292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    _RCB->Next = NULL;                                  \
76392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    _Tail = _RCB;                                       \
76492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond}
76592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
76692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define DequeueRCB(Head, Tail)                          \
76792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond{                                                       \
768115cac2e7a8d06aa347bf233b4cb94828eb0509aMalcolm Priestley    struct vnt_rcb *RCB = Head;                         \
76992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    if (!RCB->Next) {                                   \
77092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond        Tail = NULL;                                    \
77192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    }                                                   \
77292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    Head = RCB->Next;                                   \
77392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond}
77492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
77592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) {   \
77692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    if ((uVar) >= ((uModulo) - 1))                  \
77792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond        (uVar) = 0;                                 \
77892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond    else                                            \
77992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond        (uVar)++;                                   \
78092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond}
78192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
78292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_RESET_IN_PROGRESS               0x00000001
78392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_DISCONNECTED                    0x00000002
78492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_HALT_IN_PROGRESS                0x00000004
78592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_SURPRISE_REMOVED                0x00000008
78692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_RECV_LOOKASIDE                  0x00000010
78792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_INIT_IN_PROGRESS                0x00000020
78892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_SEND_SIDE_RESOURCE_ALLOCATED    0x00000040
78992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_RECV_SIDE_RESOURCE_ALLOCATED    0x00000080
79092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_POST_READS                      0x00000100
79192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_POST_WRITES                     0x00000200
79292b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_CONTROL_READS                   0x00000400
79392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define fMP_CONTROL_WRITES                  0x00000800
79492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
79592b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MP_SET_FLAG(_M, _F)             ((_M)->Flags |= (_F))
79692b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MP_CLEAR_FLAG(_M, _F)            ((_M)->Flags &= ~(_F))
79792b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MP_TEST_FLAGS(_M, _F)            (((_M)->Flags & (_F)) == (_F))
79892b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
79992b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#define MP_IS_READY(_M)        (((_M)->Flags & \
80092b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond                                 (fMP_DISCONNECTED | fMP_RESET_IN_PROGRESS | fMP_HALT_IN_PROGRESS | fMP_INIT_IN_PROGRESS | fMP_SURPRISE_REMOVED)) == 0)
80192b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
802dd0a774fc727ee793780197beb3f2cf80bfefa99Malcolm Priestleyint device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF);
80392b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond
80492b96797118e5836294a6d42a5a8e10b86f50e3fForest Bond#endif
805