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