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