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