Forest Bond | 5449c68 | 2009-04-25 10:30:44 -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 | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 32 | #include <linux/module.h> |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -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 | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 47 | #include <linux/string.h> |
| 48 | #include <linux/wait.h> |
| 49 | #include <linux/if_arp.h> |
| 50 | #include <linux/sched.h> |
Charles Clément | cf160bc | 2010-06-03 09:15:54 -0700 | [diff] [blame] | 51 | #include <linux/io.h> |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 52 | #include <linux/if.h> |
| 53 | //#include <linux/config.h> |
Charles Clément | cf160bc | 2010-06-03 09:15:54 -0700 | [diff] [blame] | 54 | #include <linux/uaccess.h> |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 55 | #include <linux/proc_fs.h> |
| 56 | #include <linux/inetdevice.h> |
| 57 | #include <linux/reboot.h> |
| 58 | #ifdef SIOCETHTOOL |
| 59 | #define DEVICE_ETHTOOL_IOCTL_SUPPORT |
| 60 | #include <linux/ethtool.h> |
| 61 | #else |
| 62 | #undef DEVICE_ETHTOOL_IOCTL_SUPPORT |
| 63 | #endif |
| 64 | /* Include Wireless Extension definition and check version - Jean II */ |
| 65 | #include <linux/wireless.h> |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 66 | #include <net/iw_handler.h> // New driver API |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 67 | |
| 68 | //2008-0409-07, <Add> by Einsn Liu |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 69 | #ifndef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT |
| 70 | #define WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT |
| 71 | #endif |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 72 | //2008-4-14<add> by chester for led issue |
| 73 | //#define FOR_LED_ON_NOTEBOOK |
| 74 | // |
| 75 | |
| 76 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 77 | // |
Jim Lieb | 612822f | 2009-08-12 14:54:03 -0700 | [diff] [blame] | 78 | // device specific |
| 79 | // |
| 80 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 81 | #include "device_cfg.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 82 | #include "ttype.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 83 | #include "80211hdr.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 84 | #include "tether.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 85 | #include "wmgr.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 86 | #include "wcmd.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 87 | #include "mib.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 88 | #include "srom.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 89 | #include "rc4.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 90 | #include "desc.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 91 | #include "key.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 92 | #include "mac.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 93 | |
| 94 | //PLICE_DEBUG-> |
| 95 | //#define THREAD |
| 96 | |
| 97 | //#define TASK_LET |
| 98 | //PLICE_DEBUG<- |
| 99 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 100 | |
| 101 | /*--------------------- Export Definitions -------------------------*/ |
| 102 | |
| 103 | #define MAC_MAX_CONTEXT_REG (256+128) |
| 104 | |
| 105 | #define MAX_MULTICAST_ADDRESS_NUM 32 |
Charles Clément | 078b078 | 2010-05-14 19:37:32 -0700 | [diff] [blame] | 106 | #define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 107 | |
| 108 | |
| 109 | //#define OP_MODE_INFRASTRUCTURE 0 |
| 110 | //#define OP_MODE_ADHOC 1 |
| 111 | //#define OP_MODE_AP 2 |
| 112 | |
| 113 | #define DUPLICATE_RX_CACHE_LENGTH 5 |
| 114 | |
| 115 | #define NUM_KEY_ENTRY 11 |
| 116 | |
| 117 | #define TX_WEP_NONE 0 |
| 118 | #define TX_WEP_OTF 1 |
| 119 | #define TX_WEP_SW 2 |
| 120 | #define TX_WEP_SWOTP 3 |
| 121 | #define TX_WEP_OTPSW 4 |
| 122 | #define TX_WEP_SW232 5 |
| 123 | |
| 124 | #define KEYSEL_WEP40 0 |
| 125 | #define KEYSEL_WEP104 1 |
| 126 | #define KEYSEL_TKIP 2 |
| 127 | #define KEYSEL_CCMP 3 |
| 128 | |
| 129 | |
| 130 | |
| 131 | #define AUTO_FB_NONE 0 |
| 132 | #define AUTO_FB_0 1 |
| 133 | #define AUTO_FB_1 2 |
| 134 | |
| 135 | #define FB_RATE0 0 |
| 136 | #define FB_RATE1 1 |
| 137 | |
| 138 | // Antenna Mode |
| 139 | #define ANT_A 0 |
| 140 | #define ANT_B 1 |
| 141 | #define ANT_DIVERSITY 2 |
| 142 | #define ANT_RXD_TXA 3 |
| 143 | #define ANT_RXD_TXB 4 |
| 144 | #define ANT_UNKNOWN 0xFF |
| 145 | |
| 146 | #define MAXCHECKHANGCNT 4 |
| 147 | |
| 148 | #define BB_VGA_LEVEL 4 |
| 149 | #define BB_VGA_CHANGE_THRESHOLD 16 |
| 150 | |
| 151 | |
Jim Lieb | 612822f | 2009-08-12 14:54:03 -0700 | [diff] [blame] | 152 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 153 | #ifndef RUN_AT |
| 154 | #define RUN_AT(x) (jiffies+(x)) |
| 155 | #endif |
| 156 | |
| 157 | // DMA related |
| 158 | #define RESERV_AC0DMA 4 |
| 159 | |
| 160 | |
| 161 | // BUILD OBJ mode |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 162 | |
| 163 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 164 | #define AVAIL_TD(p,q) ((p)->sOpts.nTxDescs[(q)]-((p)->iTDUsed[(q)])) |
| 165 | |
| 166 | //PLICE_DEBUG -> |
| 167 | #define NUM 64 |
| 168 | //PLICE_DEUBG <- |
| 169 | |
| 170 | |
| 171 | |
Jim Lieb | 7e809a9 | 2009-07-30 10:27:21 -0700 | [diff] [blame] | 172 | #define PRIVATE_Message 0 |
| 173 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 174 | /*--------------------- Export Types ------------------------------*/ |
| 175 | |
| 176 | |
Jim Lieb | 7e809a9 | 2009-07-30 10:27:21 -0700 | [diff] [blame] | 177 | #define DBG_PRT(l, p, args...) {if (l<=msglevel) printk( p ,##args);} |
| 178 | #define PRINT_K(p, args...) {if (PRIVATE_Message) printk( p ,##args);} |
| 179 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 180 | //0:11A 1:11B 2:11G |
| 181 | typedef enum _VIA_BB_TYPE |
| 182 | { |
| 183 | BB_TYPE_11A=0, |
| 184 | BB_TYPE_11B, |
| 185 | BB_TYPE_11G |
| 186 | } VIA_BB_TYPE, *PVIA_BB_TYPE; |
| 187 | |
| 188 | //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate) |
| 189 | typedef enum _VIA_PKT_TYPE |
| 190 | { |
| 191 | PK_TYPE_11A=0, |
| 192 | PK_TYPE_11B, |
| 193 | PK_TYPE_11GB, |
| 194 | PK_TYPE_11GA |
| 195 | } VIA_PKT_TYPE, *PVIA_PKT_TYPE; |
| 196 | |
| 197 | |
| 198 | typedef enum __device_msg_level { |
| 199 | MSG_LEVEL_ERR=0, //Errors that will cause abnormal operation. |
| 200 | MSG_LEVEL_NOTICE=1, //Some errors need users to be notified. |
| 201 | MSG_LEVEL_INFO=2, //Normal message. |
| 202 | MSG_LEVEL_VERBOSE=3, //Will report all trival errors. |
| 203 | MSG_LEVEL_DEBUG=4 //Only for debug purpose. |
| 204 | } DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL; |
| 205 | |
| 206 | typedef enum __device_init_type { |
| 207 | DEVICE_INIT_COLD=0, // cold init |
| 208 | DEVICE_INIT_RESET, // reset init or Dx to D0 power remain init |
| 209 | DEVICE_INIT_DXPL // Dx to D0 power lost init |
| 210 | } DEVICE_INIT_TYPE, *PDEVICE_INIT_TYPE; |
| 211 | |
| 212 | |
| 213 | //++ NDIS related |
| 214 | |
| 215 | #define MAX_BSSIDINFO_4_PMKID 16 |
| 216 | #define MAX_PMKIDLIST 5 |
| 217 | //Flags for PMKID Candidate list structure |
| 218 | #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01 |
| 219 | |
| 220 | // PMKID Structures |
Charles Clément | 5c9824e | 2010-06-02 09:51:59 -0700 | [diff] [blame] | 221 | typedef unsigned char NDIS_802_11_PMKID_VALUE[16]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 222 | |
| 223 | |
| 224 | typedef enum _NDIS_802_11_WEP_STATUS |
| 225 | { |
| 226 | Ndis802_11WEPEnabled, |
| 227 | Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled, |
| 228 | Ndis802_11WEPDisabled, |
| 229 | Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled, |
| 230 | Ndis802_11WEPKeyAbsent, |
| 231 | Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent, |
| 232 | Ndis802_11WEPNotSupported, |
| 233 | Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported, |
| 234 | Ndis802_11Encryption2Enabled, |
| 235 | Ndis802_11Encryption2KeyAbsent, |
| 236 | Ndis802_11Encryption3Enabled, |
| 237 | Ndis802_11Encryption3KeyAbsent |
| 238 | } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS, |
| 239 | NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS; |
| 240 | |
| 241 | |
| 242 | typedef enum _NDIS_802_11_STATUS_TYPE |
| 243 | { |
| 244 | Ndis802_11StatusType_Authentication, |
| 245 | Ndis802_11StatusType_MediaStreamMode, |
| 246 | Ndis802_11StatusType_PMKID_CandidateList, |
| 247 | Ndis802_11StatusTypeMax // not a real type, defined as an upper bound |
| 248 | } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE; |
| 249 | |
| 250 | //Added new types for PMKID Candidate lists. |
| 251 | typedef struct _PMKID_CANDIDATE { |
| 252 | NDIS_802_11_MAC_ADDRESS BSSID; |
Charles Clément | e3fd16d | 2010-06-02 09:52:02 -0700 | [diff] [blame] | 253 | unsigned long Flags; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 254 | } PMKID_CANDIDATE, *PPMKID_CANDIDATE; |
| 255 | |
| 256 | |
| 257 | typedef struct _BSSID_INFO |
| 258 | { |
| 259 | NDIS_802_11_MAC_ADDRESS BSSID; |
| 260 | NDIS_802_11_PMKID_VALUE PMKID; |
| 261 | } BSSID_INFO, *PBSSID_INFO; |
| 262 | |
| 263 | typedef struct tagSPMKID { |
Charles Clément | e3fd16d | 2010-06-02 09:52:02 -0700 | [diff] [blame] | 264 | unsigned long Length; |
| 265 | unsigned long BSSIDInfoCount; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 266 | BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID]; |
| 267 | } SPMKID, *PSPMKID; |
| 268 | |
| 269 | typedef struct tagSPMKIDCandidateEvent { |
| 270 | NDIS_802_11_STATUS_TYPE StatusType; |
Charles Clément | e3fd16d | 2010-06-02 09:52:02 -0700 | [diff] [blame] | 271 | unsigned long Version; // Version of the structure |
| 272 | unsigned long NumCandidates; // No. of pmkid candidates |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 273 | PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST]; |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 274 | } SPMKIDCandidateEvent, *PSPMKIDCandidateEvent; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 275 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 276 | //-- |
| 277 | |
| 278 | //++ 802.11h related |
| 279 | #define MAX_QUIET_COUNT 8 |
| 280 | |
| 281 | typedef struct tagSQuietControl { |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 282 | bool bEnable; |
Charles Clément | 0f4c60d | 2010-06-24 11:02:25 -0700 | [diff] [blame] | 283 | unsigned long dwStartTime; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 284 | unsigned char byPeriod; |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 285 | unsigned short wDuration; |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 286 | } SQuietControl, *PSQuietControl; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 287 | |
| 288 | //-- |
| 289 | typedef struct __chip_info_tbl{ |
| 290 | CHIP_TYPE chip_id; |
| 291 | char* name; |
| 292 | int io_size; |
| 293 | int nTxQueue; |
Charles Clément | 902d241 | 2010-05-28 12:34:21 -0700 | [diff] [blame] | 294 | u32 flags; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 295 | } CHIP_INFO, *PCHIP_INFO; |
| 296 | |
| 297 | |
| 298 | typedef enum { |
| 299 | OWNED_BY_HOST=0, |
| 300 | OWNED_BY_NIC=1 |
| 301 | } DEVICE_OWNER_TYPE, *PDEVICE_OWNER_TYPE; |
| 302 | |
| 303 | |
| 304 | // The receive duplicate detection cache entry |
| 305 | typedef struct tagSCacheEntry{ |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 306 | unsigned short wFmSequence; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 307 | unsigned char abyAddr2[ETH_ALEN]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 308 | } SCacheEntry, *PSCacheEntry; |
| 309 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 310 | typedef struct tagSCache{ |
| 311 | /* The receive cache is updated circularly. The next entry to be written is |
| 312 | * indexed by the "InPtr". |
| 313 | */ |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 314 | unsigned int uInPtr; // Place to use next |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 315 | SCacheEntry asCacheEntry[DUPLICATE_RX_CACHE_LENGTH]; |
| 316 | } SCache, *PSCache; |
| 317 | |
| 318 | #define CB_MAX_RX_FRAG 64 |
| 319 | // DeFragment Control Block, used for collecting fragments prior to reassembly |
| 320 | typedef struct tagSDeFragControlBlock |
| 321 | { |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 322 | unsigned short wSequence; |
| 323 | unsigned short wFragNum; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 324 | unsigned char abyAddr2[ETH_ALEN]; |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 325 | unsigned int uLifetime; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 326 | struct sk_buff* skb; |
Charles Clément | 2989e96 | 2010-06-05 15:13:47 -0700 | [diff] [blame] | 327 | unsigned char *pbyRxBuffer; |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 328 | unsigned int cbFrameLength; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 329 | bool bInUse; |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 330 | } SDeFragControlBlock, *PSDeFragControlBlock; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 331 | |
| 332 | |
| 333 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 334 | //flags for options |
| 335 | #define DEVICE_FLAGS_IP_ALIGN 0x00000001UL |
| 336 | #define DEVICE_FLAGS_PREAMBLE_TYPE 0x00000002UL |
| 337 | #define DEVICE_FLAGS_OP_MODE 0x00000004UL |
| 338 | #define DEVICE_FLAGS_PS_MODE 0x00000008UL |
| 339 | #define DEVICE_FLAGS_80211h_MODE 0x00000010UL |
| 340 | #define DEVICE_FLAGS_DiversityANT 0x00000020UL |
| 341 | |
| 342 | //flags for driver status |
| 343 | #define DEVICE_FLAGS_OPENED 0x00010000UL |
| 344 | #define DEVICE_FLAGS_WOL_ENABLED 0x00080000UL |
| 345 | //flags for capbilities |
| 346 | #define DEVICE_FLAGS_TX_ALIGN 0x01000000UL |
| 347 | #define DEVICE_FLAGS_HAVE_CAM 0x02000000UL |
| 348 | #define DEVICE_FLAGS_FLOW_CTRL 0x04000000UL |
| 349 | |
| 350 | //flags for MII status |
| 351 | #define DEVICE_LINK_FAIL 0x00000001UL |
| 352 | #define DEVICE_SPEED_10 0x00000002UL |
| 353 | #define DEVICE_SPEED_100 0x00000004UL |
| 354 | #define DEVICE_SPEED_1000 0x00000008UL |
| 355 | #define DEVICE_DUPLEX_FULL 0x00000010UL |
| 356 | #define DEVICE_AUTONEG_ENABLE 0x00000020UL |
| 357 | #define DEVICE_FORCED_BY_EEPROM 0x00000040UL |
| 358 | //for device_set_media_duplex |
| 359 | #define DEVICE_LINK_CHANGE 0x00000001UL |
| 360 | |
| 361 | |
| 362 | //PLICE_DEBUG-> |
| 363 | |
| 364 | |
| 365 | typedef struct _RxManagementQueue |
| 366 | { |
| 367 | int packet_num; |
| 368 | int head,tail; |
| 369 | PSRxMgmtPacket Q[NUM]; |
| 370 | } RxManagementQueue,*PSRxManagementQueue; |
| 371 | |
| 372 | |
| 373 | |
| 374 | //PLICE_DEBUG<- |
| 375 | |
| 376 | |
| 377 | typedef struct __device_opt { |
Jim Lieb | 612822f | 2009-08-12 14:54:03 -0700 | [diff] [blame] | 378 | int nRxDescs0; //Number of RX descriptors0 |
| 379 | int nRxDescs1; //Number of RX descriptors1 |
| 380 | int nTxDescs[2]; //Number of TX descriptors 0, 1 |
| 381 | int int_works; //interrupt limits |
| 382 | int rts_thresh; //rts threshold |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 383 | int frag_thresh; |
| 384 | int data_rate; |
| 385 | int channel_num; |
| 386 | int short_retry; |
| 387 | int long_retry; |
| 388 | int bbp_type; |
Charles Clément | 902d241 | 2010-05-28 12:34:21 -0700 | [diff] [blame] | 389 | u32 flags; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 390 | } OPTIONS, *POPTIONS; |
| 391 | |
| 392 | |
| 393 | typedef struct __device_info { |
| 394 | struct __device_info* next; |
| 395 | struct __device_info* prev; |
| 396 | |
| 397 | struct pci_dev* pcid; |
| 398 | |
Larry Finger | 9fada0a | 2011-05-05 18:52:56 -0500 | [diff] [blame] | 399 | #ifdef CONFIG_PM |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 400 | u32 pci_state[16]; |
| 401 | #endif |
| 402 | |
| 403 | // netdev |
| 404 | struct net_device* dev; |
| 405 | struct net_device* next_module; |
| 406 | struct net_device_stats stats; |
| 407 | |
| 408 | //dma addr, rx/tx pool |
| 409 | dma_addr_t pool_dma; |
| 410 | dma_addr_t rd0_pool_dma; |
| 411 | dma_addr_t rd1_pool_dma; |
| 412 | |
| 413 | dma_addr_t td0_pool_dma; |
| 414 | dma_addr_t td1_pool_dma; |
| 415 | |
| 416 | dma_addr_t tx_bufs_dma0; |
| 417 | dma_addr_t tx_bufs_dma1; |
| 418 | dma_addr_t tx_beacon_dma; |
| 419 | |
Charles Clément | 2989e96 | 2010-06-05 15:13:47 -0700 | [diff] [blame] | 420 | unsigned char *tx0_bufs; |
| 421 | unsigned char *tx1_bufs; |
| 422 | unsigned char *tx_beacon_bufs; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 423 | |
| 424 | CHIP_TYPE chip_id; |
| 425 | |
Greg Kroah-Hartman | afb97d9 | 2010-06-18 10:30:21 -0700 | [diff] [blame] | 426 | unsigned long PortOffset; |
Charles Clément | 0f4c60d | 2010-06-24 11:02:25 -0700 | [diff] [blame] | 427 | unsigned long dwIsr; |
Charles Clément | 902d241 | 2010-05-28 12:34:21 -0700 | [diff] [blame] | 428 | u32 memaddr; |
| 429 | u32 ioaddr; |
| 430 | u32 io_size; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 431 | |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 432 | unsigned char byRevId; |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 433 | unsigned short SubSystemID; |
| 434 | unsigned short SubVendorID; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 435 | |
| 436 | int nTxQueues; |
| 437 | volatile int iTDUsed[TYPE_MAXTD]; |
| 438 | |
| 439 | volatile PSTxDesc apCurrTD[TYPE_MAXTD]; |
| 440 | volatile PSTxDesc apTailTD[TYPE_MAXTD]; |
| 441 | |
| 442 | volatile PSTxDesc apTD0Rings; |
| 443 | volatile PSTxDesc apTD1Rings; |
| 444 | |
| 445 | volatile PSRxDesc aRD0Ring; |
| 446 | volatile PSRxDesc aRD1Ring; |
| 447 | volatile PSRxDesc pCurrRD[TYPE_MAXRD]; |
| 448 | SCache sDupRxCache; |
| 449 | |
| 450 | SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG]; |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 451 | unsigned int cbDFCB; |
| 452 | unsigned int cbFreeDFCB; |
| 453 | unsigned int uCurrentDFCBIdx; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 454 | |
| 455 | OPTIONS sOpts; |
| 456 | |
Charles Clément | 902d241 | 2010-05-28 12:34:21 -0700 | [diff] [blame] | 457 | u32 flags; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 458 | |
Charles Clément | 902d241 | 2010-05-28 12:34:21 -0700 | [diff] [blame] | 459 | u32 rx_buf_sz; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 460 | int multicast_limit; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 461 | unsigned char byRxMode; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 462 | |
| 463 | spinlock_t lock; |
| 464 | //PLICE_DEBUG-> |
| 465 | struct tasklet_struct RxMngWorkItem; |
| 466 | RxManagementQueue rxManeQueue; |
| 467 | //PLICE_DEBUG<- |
| 468 | //PLICE_DEBUG -> |
| 469 | pid_t MLMEThr_pid; |
| 470 | struct completion notify; |
| 471 | struct semaphore mlme_semaphore; |
| 472 | //PLICE_DEBUG <- |
| 473 | |
| 474 | |
Charles Clément | 902d241 | 2010-05-28 12:34:21 -0700 | [diff] [blame] | 475 | u32 rx_bytes; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 476 | |
| 477 | // Version control |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 478 | unsigned char byLocalID; |
| 479 | unsigned char byRFType; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 480 | |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 481 | unsigned char byMaxPwrLevel; |
| 482 | unsigned char byZoneType; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 483 | bool bZoneRegExist; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 484 | unsigned char byOriginalZonetype; |
| 485 | unsigned char abyMacContext[MAC_MAX_CONTEXT_REG]; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 486 | bool bLinkPass; // link status: OK or fail |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 487 | unsigned char abyCurrentNetAddr[ETH_ALEN]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 488 | |
| 489 | // Adapter statistics |
| 490 | SStatCounter scStatistic; |
| 491 | // 802.11 counter |
| 492 | SDot11Counters s802_11Counter; |
| 493 | |
| 494 | |
| 495 | // 802.11 management |
| 496 | PSMgmtObject pMgmt; |
| 497 | SMgmtObject sMgmtObj; |
| 498 | |
| 499 | // 802.11 MAC specific |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 500 | unsigned int uCurrRSSI; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 501 | unsigned char byCurrSQ; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 502 | |
Charles Clément | 0f4c60d | 2010-06-24 11:02:25 -0700 | [diff] [blame] | 503 | unsigned long dwTxAntennaSel; |
| 504 | unsigned long dwRxAntennaSel; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 505 | unsigned char byAntennaCount; |
| 506 | unsigned char byRxAntennaMode; |
| 507 | unsigned char byTxAntennaMode; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 508 | bool bTxRxAntInv; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 509 | |
Charles Clément | 2989e96 | 2010-06-05 15:13:47 -0700 | [diff] [blame] | 510 | unsigned char *pbyTmpBuff; |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 511 | unsigned int uSIFS; //Current SIFS |
| 512 | unsigned int uDIFS; //Current DIFS |
| 513 | unsigned int uEIFS; //Current EIFS |
| 514 | unsigned int uSlot; //Current SlotTime |
| 515 | unsigned int uCwMin; //Current CwMin |
| 516 | unsigned int uCwMax; //CwMax is fixed on 1023. |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 517 | // PHY parameter |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 518 | unsigned char bySIFS; |
| 519 | unsigned char byDIFS; |
| 520 | unsigned char byEIFS; |
| 521 | unsigned char bySlot; |
| 522 | unsigned char byCWMaxMin; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 523 | CARD_PHY_TYPE eCurrentPHYType; |
| 524 | |
| 525 | |
| 526 | VIA_BB_TYPE byBBType; //0: 11A, 1:11B, 2:11G |
| 527 | VIA_PKT_TYPE byPacketType; //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate) |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 528 | unsigned short wBasicRate; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 529 | unsigned char byACKRate; |
| 530 | unsigned char byTopOFDMBasicRate; |
| 531 | unsigned char byTopCCKBasicRate; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 532 | |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 533 | unsigned char byMinChannel; |
| 534 | unsigned char byMaxChannel; |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 535 | unsigned int uConnectionRate; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 536 | |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 537 | unsigned char byPreambleType; |
| 538 | unsigned char byShortPreamble; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 539 | |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 540 | unsigned short wCurrentRate; |
| 541 | unsigned short wRTSThreshold; |
| 542 | unsigned short wFragmentationThreshold; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 543 | unsigned char byShortRetryLimit; |
| 544 | unsigned char byLongRetryLimit; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 545 | CARD_OP_MODE eOPMode; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 546 | unsigned char byOpMode; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 547 | bool bBSSIDFilter; |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 548 | unsigned short wMaxTransmitMSDULifetime; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 549 | unsigned char abyBSSID[ETH_ALEN]; |
| 550 | unsigned char abyDesireBSSID[ETH_ALEN]; |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 551 | unsigned short wCTSDuration; // update while speed change |
| 552 | unsigned short wACKDuration; // update while speed change |
| 553 | unsigned short wRTSTransmitLen; // update while speed change |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 554 | unsigned char byRTSServiceField; // update while speed change |
| 555 | unsigned char byRTSSignalField; // update while speed change |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 556 | |
Charles Clément | 0f4c60d | 2010-06-24 11:02:25 -0700 | [diff] [blame] | 557 | unsigned long dwMaxReceiveLifetime; // dot11MaxReceiveLifetime |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 558 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 559 | bool bCCK; |
| 560 | bool bEncryptionEnable; |
| 561 | bool bLongHeader; |
| 562 | bool bShortSlotTime; |
| 563 | bool bProtectMode; |
| 564 | bool bNonERPPresent; |
| 565 | bool bBarkerPreambleMd; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 566 | |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 567 | unsigned char byERPFlag; |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 568 | unsigned short wUseProtectCntDown; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 569 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 570 | bool bRadioControlOff; |
| 571 | bool bRadioOff; |
| 572 | bool bEnablePSMode; |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 573 | unsigned short wListenInterval; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 574 | bool bPWBitOn; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 575 | WMAC_POWER_MODE ePSMode; |
| 576 | |
| 577 | |
| 578 | // GPIO Radio Control |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 579 | unsigned char byRadioCtl; |
| 580 | unsigned char byGPIO; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 581 | bool bHWRadioOff; |
| 582 | bool bPrvActive4RadioOFF; |
| 583 | bool bGPIOBlockRead; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 584 | |
| 585 | // Beacon releated |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 586 | unsigned short wSeqCounter; |
| 587 | unsigned short wBCNBufLen; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 588 | bool bBeaconBufReady; |
| 589 | bool bBeaconSent; |
| 590 | bool bIsBeaconBufReadySet; |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 591 | unsigned int cbBeaconBufReadySetCnt; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 592 | bool bFixRate; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 593 | unsigned char byCurrentCh; |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 594 | unsigned int uScanTime; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 595 | |
| 596 | CMD_STATE eCommandState; |
| 597 | |
| 598 | CMD_CODE eCommand; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 599 | bool bBeaconTx; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 600 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 601 | bool bStopBeacon; |
| 602 | bool bStopDataPkt; |
| 603 | bool bStopTx0Pkt; |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 604 | unsigned int uAutoReConnectTime; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 605 | |
| 606 | // 802.11 counter |
| 607 | |
| 608 | CMD_ITEM eCmdQueue[CMD_Q_SIZE]; |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 609 | unsigned int uCmdDequeueIdx; |
| 610 | unsigned int uCmdEnqueueIdx; |
| 611 | unsigned int cbFreeCmdQueue; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 612 | bool bCmdRunning; |
| 613 | bool bCmdClear; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 614 | |
| 615 | |
| 616 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 617 | bool bRoaming; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 618 | //WOW |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 619 | unsigned char abyIPAddr[4]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 620 | |
Charles Clément | e3fd16d | 2010-06-02 09:52:02 -0700 | [diff] [blame] | 621 | unsigned long ulTxPower; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 622 | NDIS_802_11_WEP_STATUS eEncryptionStatus; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 623 | bool bTransmitKey; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 624 | //2007-0925-01<Add>by MikeLiu |
| 625 | //mike add :save old Encryption |
| 626 | NDIS_802_11_WEP_STATUS eOldEncryptionStatus; |
Jim Lieb | 612822f | 2009-08-12 14:54:03 -0700 | [diff] [blame] | 627 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 628 | SKeyManagement sKey; |
Charles Clément | 0f4c60d | 2010-06-24 11:02:25 -0700 | [diff] [blame] | 629 | unsigned long dwIVCounter; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 630 | |
| 631 | QWORD qwPacketNumber; //For CCMP and TKIP as TSC(6 bytes) |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 632 | unsigned int uCurrentWEPMode; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 633 | |
| 634 | RC4Ext SBox; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 635 | unsigned char abyPRNG[WLAN_WEPMAX_KEYLEN+3]; |
| 636 | unsigned char byKeyIndex; |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 637 | unsigned int uKeyLength; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 638 | unsigned char abyKey[WLAN_WEP232_KEYLEN]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 639 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 640 | bool bAES; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 641 | unsigned char byCntMeasure; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 642 | |
| 643 | // for AP mode |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 644 | unsigned int uAssocCount; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 645 | bool bMoreData; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 646 | |
| 647 | // QoS |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 648 | bool bGrpAckPolicy; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 649 | |
| 650 | // for OID_802_11_ASSOCIATION_INFORMATION |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 651 | bool bAssocInfoSet; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 652 | |
| 653 | |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 654 | unsigned char byAutoFBCtrl; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 655 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 656 | bool bTxMICFail; |
| 657 | bool bRxMICFail; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 658 | |
| 659 | |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 660 | unsigned int uRATEIdx; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 661 | |
| 662 | |
| 663 | // For Update BaseBand VGA Gain Offset |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 664 | bool bUpdateBBVGA; |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 665 | unsigned int uBBVGADiffCount; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 666 | unsigned char byBBVGANew; |
| 667 | unsigned char byBBVGACurrent; |
| 668 | unsigned char abyBBVGA[BB_VGA_LEVEL]; |
Charles Clément | b83cc2ed | 2010-06-01 12:38:57 -0700 | [diff] [blame] | 669 | long ldBmThreshold[BB_VGA_LEVEL]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 670 | |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 671 | unsigned char byBBPreEDRSSI; |
| 672 | unsigned char byBBPreEDIndex; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 673 | |
Jim Lieb | 612822f | 2009-08-12 14:54:03 -0700 | [diff] [blame] | 674 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 675 | bool bRadioCmd; |
Charles Clément | 0f4c60d | 2010-06-24 11:02:25 -0700 | [diff] [blame] | 676 | unsigned long dwDiagRefCount; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 677 | |
| 678 | // For FOE Tuning |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 679 | unsigned char byFOETuning; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 680 | |
| 681 | // For Auto Power Tunning |
| 682 | |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 683 | unsigned char byAutoPwrTunning; |
Charles Clément | 0c93a98 | 2010-06-01 12:38:55 -0700 | [diff] [blame] | 684 | short sPSetPointCCK; |
| 685 | short sPSetPointOFDMG; |
| 686 | short sPSetPointOFDMA; |
Charles Clément | b83cc2ed | 2010-06-01 12:38:57 -0700 | [diff] [blame] | 687 | long lPFormulaOffset; |
Charles Clément | 0c93a98 | 2010-06-01 12:38:55 -0700 | [diff] [blame] | 688 | short sPThreshold; |
Charles Clément | 5a4197b | 2010-06-01 12:38:54 -0700 | [diff] [blame] | 689 | char cAdjustStep; |
| 690 | char cMinTxAGC; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 691 | |
| 692 | // For RF Power table |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 693 | unsigned char byCCKPwr; |
| 694 | unsigned char byOFDMPwrG; |
| 695 | unsigned char byCurPwr; |
Charles Clément | ec28c7f | 2010-05-28 12:34:18 -0700 | [diff] [blame] | 696 | char byCurPwrdBm; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 697 | unsigned char abyCCKPwrTbl[CB_MAX_CHANNEL_24G+1]; |
| 698 | unsigned char abyOFDMPwrTbl[CB_MAX_CHANNEL+1]; |
Charles Clément | ec28c7f | 2010-05-28 12:34:18 -0700 | [diff] [blame] | 699 | char abyCCKDefaultPwr[CB_MAX_CHANNEL_24G+1]; |
| 700 | char abyOFDMDefaultPwr[CB_MAX_CHANNEL+1]; |
| 701 | char abyRegPwr[CB_MAX_CHANNEL+1]; |
| 702 | char abyLocalPwr[CB_MAX_CHANNEL+1]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 703 | |
| 704 | |
| 705 | // BaseBand Loopback Use |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 706 | unsigned char byBBCR4d; |
| 707 | unsigned char byBBCRc9; |
| 708 | unsigned char byBBCR88; |
| 709 | unsigned char byBBCR09; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 710 | |
| 711 | // command timer |
| 712 | struct timer_list sTimerCommand; |
| 713 | #ifdef TxInSleep |
| 714 | struct timer_list sTimerTxData; |
Charles Clément | e3fd16d | 2010-06-02 09:52:02 -0700 | [diff] [blame] | 715 | unsigned long nTxDataTimeCout; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 716 | bool fTxDataInSleep; |
| 717 | bool IsTxDataTrigger; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 718 | #endif |
| 719 | |
| 720 | #ifdef WPA_SM_Transtatus |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 721 | bool fWPA_Authened; //is WPA/WPA-PSK or WPA2/WPA2-PSK authen?? |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 722 | #endif |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 723 | unsigned char byReAssocCount; //mike add:re-association retry times! |
| 724 | unsigned char byLinkWaitCount; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 725 | |
| 726 | |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 727 | unsigned char abyNodeName[17]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 728 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 729 | bool bDiversityRegCtlON; |
| 730 | bool bDiversityEnable; |
Charles Clément | e3fd16d | 2010-06-02 09:52:02 -0700 | [diff] [blame] | 731 | unsigned long ulDiversityNValue; |
| 732 | unsigned long ulDiversityMValue; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 733 | unsigned char byTMax; |
| 734 | unsigned char byTMax2; |
| 735 | unsigned char byTMax3; |
Charles Clément | e3fd16d | 2010-06-02 09:52:02 -0700 | [diff] [blame] | 736 | unsigned long ulSQ3TH; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 737 | |
| 738 | // ANT diversity |
Charles Clément | e3fd16d | 2010-06-02 09:52:02 -0700 | [diff] [blame] | 739 | unsigned long uDiversityCnt; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 740 | unsigned char byAntennaState; |
Charles Clément | e3fd16d | 2010-06-02 09:52:02 -0700 | [diff] [blame] | 741 | unsigned long ulRatio_State0; |
| 742 | unsigned long ulRatio_State1; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 743 | |
| 744 | //SQ3 functions for antenna diversity |
| 745 | struct timer_list TimerSQ3Tmax1; |
| 746 | struct timer_list TimerSQ3Tmax2; |
| 747 | struct timer_list TimerSQ3Tmax3; |
| 748 | |
| 749 | |
Charles Clément | e3fd16d | 2010-06-02 09:52:02 -0700 | [diff] [blame] | 750 | unsigned long uNumSQ3[MAX_RATE]; |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 751 | unsigned short wAntDiversityMaxRate; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 752 | |
| 753 | |
| 754 | SEthernetHeader sTxEthHeader; |
| 755 | SEthernetHeader sRxEthHeader; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 756 | unsigned char abyBroadcastAddr[ETH_ALEN]; |
| 757 | unsigned char abySNAP_RFC1042[ETH_ALEN]; |
| 758 | unsigned char abySNAP_Bridgetunnel[ETH_ALEN]; |
| 759 | unsigned char abyEEPROM[EEP_MAX_CONTEXT_SIZE]; //unsigned long alignment |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 760 | // Pre-Authentication & PMK cache |
| 761 | SPMKID gsPMKID; |
| 762 | SPMKIDCandidateEvent gsPMKIDCandidate; |
| 763 | |
| 764 | |
| 765 | // for 802.11h |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 766 | bool b11hEnable; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 767 | unsigned char abyCountryCode[3]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 768 | // for 802.11h DFS |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 769 | unsigned int uNumOfMeasureEIDs; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 770 | PWLAN_IE_MEASURE_REQ pCurrMeasureEID; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 771 | bool bMeasureInProgress; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 772 | unsigned char byOrgChannel; |
| 773 | unsigned char byOrgRCR; |
Charles Clément | 0f4c60d | 2010-06-24 11:02:25 -0700 | [diff] [blame] | 774 | unsigned long dwOrgMAR0; |
| 775 | unsigned long dwOrgMAR4; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 776 | unsigned char byBasicMap; |
| 777 | unsigned char byCCAFraction; |
| 778 | unsigned char abyRPIs[8]; |
Charles Clément | 0f4c60d | 2010-06-24 11:02:25 -0700 | [diff] [blame] | 779 | unsigned long dwRPIs[8]; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 780 | bool bChannelSwitch; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 781 | unsigned char byNewChannel; |
| 782 | unsigned char byChannelSwitchCount; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 783 | bool bQuietEnable; |
| 784 | bool bEnableFirstQuiet; |
Charles Clément | 3fc9b58 | 2010-06-24 11:02:27 -0700 | [diff] [blame] | 785 | unsigned char byQuietStartCount; |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 786 | unsigned int uQuietEnqueue; |
Charles Clément | 0f4c60d | 2010-06-24 11:02:25 -0700 | [diff] [blame] | 787 | unsigned long dwCurrentQuietEndTime; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 788 | SQuietControl sQuiet[MAX_QUIET_COUNT]; |
| 789 | // for 802.11h TPC |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 790 | bool bCountryInfo5G; |
| 791 | bool bCountryInfo24G; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 792 | |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 793 | unsigned short wBeaconInterval; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 794 | |
| 795 | //WPA supplicant deamon |
| 796 | struct net_device *wpadev; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 797 | bool bWPADEVUp; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 798 | struct sk_buff *skb; |
| 799 | #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT |
| 800 | /* |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 801 | bool bwextstep0; |
| 802 | bool bwextstep1; |
| 803 | bool bwextstep2; |
| 804 | bool bwextstep3; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 805 | */ |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 806 | unsigned int bwextcount; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 807 | bool bWPASuppWextEnabled; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 808 | #endif |
| 809 | |
| 810 | //-- |
| 811 | #ifdef HOSTAP |
| 812 | // user space daemon: hostapd, is used for HOSTAP |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 813 | bool bEnableHostapd; |
| 814 | bool bEnable8021x; |
| 815 | bool bEnableHostWEP; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 816 | struct net_device *apdev; |
| 817 | int (*tx_80211)(struct sk_buff *skb, struct net_device *dev); |
| 818 | #endif |
Charles Clément | b6e95cd | 2010-06-02 09:52:01 -0700 | [diff] [blame] | 819 | unsigned int uChannel; |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 820 | bool bMACSuspend; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 821 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 822 | struct iw_statistics wstats; // wireless stats |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 823 | bool bCommit; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 824 | |
| 825 | } DEVICE_INFO, *PSDevice; |
| 826 | |
| 827 | |
| 828 | //PLICE_DEBUG-> |
| 829 | |
| 830 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 831 | inline static void EnQueue (PSDevice pDevice,PSRxMgmtPacket pRxMgmtPacket) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 832 | { |
| 833 | //printk("Enter EnQueue:tail is %d\n",pDevice->rxManeQueue.tail); |
| 834 | if ((pDevice->rxManeQueue.tail+1) % NUM == pDevice->rxManeQueue.head) |
| 835 | { |
| 836 | //printk("Queue is Full,tail is %d\n",pDevice->rxManeQueue.tail); |
| 837 | return ; |
| 838 | } |
| 839 | else |
| 840 | { |
| 841 | pDevice->rxManeQueue.tail = (pDevice->rxManeQueue.tail+1)% NUM; |
| 842 | pDevice->rxManeQueue.Q[pDevice->rxManeQueue.tail] = pRxMgmtPacket; |
| 843 | pDevice->rxManeQueue.packet_num++; |
| 844 | //printk("packet num is %d\n",pDevice->rxManeQueue.packet_num); |
| 845 | } |
| 846 | } |
| 847 | |
| 848 | |
| 849 | |
| 850 | |
| 851 | inline static PSRxMgmtPacket DeQueue (PSDevice pDevice) |
| 852 | { |
| 853 | PSRxMgmtPacket pRxMgmtPacket; |
| 854 | if (pDevice->rxManeQueue.tail == pDevice->rxManeQueue.head) |
| 855 | { |
| 856 | printk("Queue is Empty\n"); |
| 857 | return NULL; |
| 858 | } |
| 859 | else |
| 860 | { |
| 861 | int x; |
| 862 | //x=pDevice->rxManeQueue.head = (pDevice->rxManeQueue.head+1)%NUM; |
| 863 | pDevice->rxManeQueue.head = (pDevice->rxManeQueue.head+1)%NUM; |
| 864 | x = pDevice->rxManeQueue.head; |
| 865 | //printk("Enter DeQueue:head is %d\n",x); |
| 866 | pRxMgmtPacket = pDevice->rxManeQueue.Q[x]; |
| 867 | pDevice->rxManeQueue.packet_num--; |
| 868 | return pRxMgmtPacket; |
| 869 | } |
| 870 | } |
| 871 | |
Charles Clément | 6b35b7b | 2010-05-07 12:30:19 -0700 | [diff] [blame] | 872 | void InitRxManagementQueue(PSDevice pDevice); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 873 | |
| 874 | |
| 875 | |
| 876 | //PLICE_DEBUG<- |
| 877 | |
| 878 | |
| 879 | |
| 880 | |
| 881 | |
| 882 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 883 | inline static bool device_get_ip(PSDevice pInfo) { |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 884 | struct in_device* in_dev=(struct in_device*) pInfo->dev->ip_ptr; |
| 885 | struct in_ifaddr* ifa; |
| 886 | |
| 887 | if (in_dev!=NULL) { |
| 888 | ifa=(struct in_ifaddr*) in_dev->ifa_list; |
| 889 | if (ifa!=NULL) { |
| 890 | memcpy(pInfo->abyIPAddr,&ifa->ifa_address,4); |
Charles Clément | 1b12068 | 2010-08-01 17:15:48 +0200 | [diff] [blame] | 891 | return true; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 892 | } |
| 893 | } |
Charles Clément | 5a5a2a6 | 2010-08-01 17:15:49 +0200 | [diff] [blame] | 894 | return false; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 895 | } |
| 896 | |
| 897 | |
| 898 | |
| 899 | static inline PDEVICE_RD_INFO alloc_rd_info(void) { |
| 900 | PDEVICE_RD_INFO ptr; |
Joe Perches | d2c6170 | 2010-03-24 22:17:05 -0700 | [diff] [blame] | 901 | ptr = (PDEVICE_RD_INFO)kmalloc((int)sizeof(DEVICE_RD_INFO), (int)GFP_ATOMIC); |
| 902 | if (ptr == NULL) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 903 | return NULL; |
| 904 | else { |
| 905 | memset(ptr,0,sizeof(DEVICE_RD_INFO)); |
| 906 | return ptr; |
| 907 | } |
| 908 | } |
| 909 | |
| 910 | static inline PDEVICE_TD_INFO alloc_td_info(void) { |
| 911 | PDEVICE_TD_INFO ptr; |
Joe Perches | d2c6170 | 2010-03-24 22:17:05 -0700 | [diff] [blame] | 912 | ptr = (PDEVICE_TD_INFO)kmalloc((int)sizeof(DEVICE_TD_INFO), (int)GFP_ATOMIC); |
| 913 | if (ptr == NULL) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 914 | return NULL; |
| 915 | else { |
| 916 | memset(ptr,0,sizeof(DEVICE_TD_INFO)); |
| 917 | return ptr; |
| 918 | } |
| 919 | } |
| 920 | |
| 921 | /*--------------------- Export Functions --------------------------*/ |
| 922 | |
Charles Clément | 7b6a001 | 2010-08-01 17:15:50 +0200 | [diff] [blame] | 923 | bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeIndex); |
| 924 | bool device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF); |
| 925 | int Config_FileOperation(PSDevice pDevice, bool fwrite, unsigned char *Parameter); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 926 | #endif |
| 927 | |
| 928 | |