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