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> |
Malcolm Priestley | b39d60c | 2014-08-17 20:42:25 +0100 | [diff] [blame] | 52 | #include <linux/crc32.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> |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 57 | #include <linux/ethtool.h> |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 58 | /* Include Wireless Extension definition and check version - Jean II */ |
Malcolm Priestley | 33b1c8c | 2014-10-29 17:43:36 +0000 | [diff] [blame] | 59 | #include <net/mac80211.h> |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 60 | #include <linux/wireless.h> |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 61 | #include <net/iw_handler.h> /* New driver API */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 62 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 63 | #ifndef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT |
| 64 | #define WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT |
| 65 | #endif |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 66 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 67 | /* device specific */ |
Jim Lieb | 612822f | 2009-08-12 14:54:03 -0700 | [diff] [blame] | 68 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 69 | #include "device_cfg.h" |
Malcolm Priestley | 3378598 | 2014-10-29 17:56:05 +0000 | [diff] [blame] | 70 | #include "card.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 71 | #include "mib.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 72 | #include "srom.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 73 | #include "desc.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 74 | #include "key.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 75 | #include "mac.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 76 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 77 | /*--------------------- Export Definitions -------------------------*/ |
| 78 | |
Malcolm Priestley | b0437f2 | 2014-10-29 17:55:48 +0000 | [diff] [blame] | 79 | #define RATE_1M 0 |
| 80 | #define RATE_2M 1 |
| 81 | #define RATE_5M 2 |
| 82 | #define RATE_11M 3 |
| 83 | #define RATE_6M 4 |
| 84 | #define RATE_9M 5 |
| 85 | #define RATE_12M 6 |
| 86 | #define RATE_18M 7 |
| 87 | #define RATE_24M 8 |
| 88 | #define RATE_36M 9 |
| 89 | #define RATE_48M 10 |
| 90 | #define RATE_54M 11 |
| 91 | #define RATE_AUTO 12 |
| 92 | #define MAX_RATE 12 |
| 93 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 94 | #define MAC_MAX_CONTEXT_REG (256+128) |
| 95 | |
| 96 | #define MAX_MULTICAST_ADDRESS_NUM 32 |
Charles Clément | 078b078 | 2010-05-14 19:37:32 -0700 | [diff] [blame] | 97 | #define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 98 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 99 | #define DUPLICATE_RX_CACHE_LENGTH 5 |
| 100 | |
| 101 | #define NUM_KEY_ENTRY 11 |
| 102 | |
| 103 | #define TX_WEP_NONE 0 |
| 104 | #define TX_WEP_OTF 1 |
| 105 | #define TX_WEP_SW 2 |
| 106 | #define TX_WEP_SWOTP 3 |
| 107 | #define TX_WEP_OTPSW 4 |
| 108 | #define TX_WEP_SW232 5 |
| 109 | |
| 110 | #define KEYSEL_WEP40 0 |
| 111 | #define KEYSEL_WEP104 1 |
| 112 | #define KEYSEL_TKIP 2 |
| 113 | #define KEYSEL_CCMP 3 |
| 114 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 115 | #define AUTO_FB_NONE 0 |
| 116 | #define AUTO_FB_0 1 |
| 117 | #define AUTO_FB_1 2 |
| 118 | |
| 119 | #define FB_RATE0 0 |
| 120 | #define FB_RATE1 1 |
| 121 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 122 | /* Antenna Mode */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 123 | #define ANT_A 0 |
| 124 | #define ANT_B 1 |
| 125 | #define ANT_DIVERSITY 2 |
| 126 | #define ANT_RXD_TXA 3 |
| 127 | #define ANT_RXD_TXB 4 |
| 128 | #define ANT_UNKNOWN 0xFF |
| 129 | |
| 130 | #define MAXCHECKHANGCNT 4 |
| 131 | |
| 132 | #define BB_VGA_LEVEL 4 |
| 133 | #define BB_VGA_CHANGE_THRESHOLD 16 |
| 134 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 135 | #ifndef RUN_AT |
| 136 | #define RUN_AT(x) (jiffies+(x)) |
| 137 | #endif |
| 138 | |
Malcolm Priestley | c3fb464 | 2014-10-29 17:56:04 +0000 | [diff] [blame] | 139 | #define MAKE_BEACON_RESERVED 10 /* (us) */ |
| 140 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 141 | /* DMA related */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 142 | #define RESERV_AC0DMA 4 |
| 143 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 144 | /* BUILD OBJ mode */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 145 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 146 | #define AVAIL_TD(p, q) ((p)->sOpts.nTxDescs[(q)] - ((p)->iTDUsed[(q)])) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 147 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 148 | #define NUM 64 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 149 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 150 | /* 0:11A 1:11B 2:11G */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 151 | typedef enum _VIA_BB_TYPE |
| 152 | { |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 153 | BB_TYPE_11A = 0, |
| 154 | BB_TYPE_11B, |
| 155 | BB_TYPE_11G |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 156 | } VIA_BB_TYPE, *PVIA_BB_TYPE; |
| 157 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 158 | /* 0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate) */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 159 | typedef enum _VIA_PKT_TYPE |
| 160 | { |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 161 | PK_TYPE_11A = 0, |
| 162 | PK_TYPE_11B, |
| 163 | PK_TYPE_11GB, |
| 164 | PK_TYPE_11GA |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 165 | } VIA_PKT_TYPE, *PVIA_PKT_TYPE; |
| 166 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 167 | typedef struct __chip_info_tbl { |
| 168 | CHIP_TYPE chip_id; |
| 169 | char *name; |
| 170 | int io_size; |
| 171 | int nTxQueue; |
| 172 | u32 flags; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 173 | } CHIP_INFO, *PCHIP_INFO; |
| 174 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 175 | typedef enum { |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 176 | OWNED_BY_HOST = 0, |
| 177 | OWNED_BY_NIC = 1 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 178 | } DEVICE_OWNER_TYPE, *PDEVICE_OWNER_TYPE; |
| 179 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 180 | /* flags for options */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 181 | #define DEVICE_FLAGS_IP_ALIGN 0x00000001UL |
| 182 | #define DEVICE_FLAGS_PREAMBLE_TYPE 0x00000002UL |
| 183 | #define DEVICE_FLAGS_OP_MODE 0x00000004UL |
| 184 | #define DEVICE_FLAGS_PS_MODE 0x00000008UL |
| 185 | #define DEVICE_FLAGS_80211h_MODE 0x00000010UL |
| 186 | #define DEVICE_FLAGS_DiversityANT 0x00000020UL |
| 187 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 188 | /* flags for driver status */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 189 | #define DEVICE_FLAGS_OPENED 0x00010000UL |
| 190 | #define DEVICE_FLAGS_WOL_ENABLED 0x00080000UL |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 191 | /* flags for capabilities */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 192 | #define DEVICE_FLAGS_TX_ALIGN 0x01000000UL |
| 193 | #define DEVICE_FLAGS_HAVE_CAM 0x02000000UL |
| 194 | #define DEVICE_FLAGS_FLOW_CTRL 0x04000000UL |
| 195 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 196 | /* flags for MII status */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 197 | #define DEVICE_LINK_FAIL 0x00000001UL |
| 198 | #define DEVICE_SPEED_10 0x00000002UL |
| 199 | #define DEVICE_SPEED_100 0x00000004UL |
| 200 | #define DEVICE_SPEED_1000 0x00000008UL |
| 201 | #define DEVICE_DUPLEX_FULL 0x00000010UL |
| 202 | #define DEVICE_AUTONEG_ENABLE 0x00000020UL |
| 203 | #define DEVICE_FORCED_BY_EEPROM 0x00000040UL |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 204 | /* for device_set_media_duplex */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 205 | #define DEVICE_LINK_CHANGE 0x00000001UL |
| 206 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 207 | typedef struct __device_opt { |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 208 | int nRxDescs0; /* Number of RX descriptors0 */ |
| 209 | int nRxDescs1; /* Number of RX descriptors1 */ |
| 210 | int nTxDescs[2]; /* Number of TX descriptors 0, 1 */ |
| 211 | int int_works; /* interrupt limits */ |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 212 | int short_retry; |
| 213 | int long_retry; |
| 214 | int bbp_type; |
| 215 | u32 flags; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 216 | } OPTIONS, *POPTIONS; |
| 217 | |
Malcolm Priestley | 80f598a | 2014-08-10 15:47:03 +0100 | [diff] [blame] | 218 | struct vnt_private { |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 219 | struct pci_dev *pcid; |
Malcolm Priestley | 33b1c8c | 2014-10-29 17:43:36 +0000 | [diff] [blame] | 220 | /* mac80211 */ |
| 221 | struct ieee80211_hw *hw; |
| 222 | struct ieee80211_vif *vif; |
Malcolm Priestley | fee7506a1 | 2014-10-29 17:43:37 +0000 | [diff] [blame] | 223 | unsigned long key_entry_inuse; |
Malcolm Priestley | 67013f2 | 2014-10-29 17:43:43 +0000 | [diff] [blame] | 224 | u32 basic_rates; |
Malcolm Priestley | 89cf9be | 2014-10-29 17:43:42 +0000 | [diff] [blame] | 225 | u16 current_aid; |
Malcolm Priestley | 67013f2 | 2014-10-29 17:43:43 +0000 | [diff] [blame] | 226 | int mc_list_count; |
| 227 | u8 mac_hw; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 228 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 229 | /* dma addr, rx/tx pool */ |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 230 | dma_addr_t pool_dma; |
| 231 | dma_addr_t rd0_pool_dma; |
| 232 | dma_addr_t rd1_pool_dma; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 233 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 234 | dma_addr_t td0_pool_dma; |
| 235 | dma_addr_t td1_pool_dma; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 236 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 237 | dma_addr_t tx_bufs_dma0; |
| 238 | dma_addr_t tx_bufs_dma1; |
| 239 | dma_addr_t tx_beacon_dma; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 240 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 241 | unsigned char *tx0_bufs; |
| 242 | unsigned char *tx1_bufs; |
| 243 | unsigned char *tx_beacon_bufs; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 244 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 245 | CHIP_TYPE chip_id; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 246 | |
Guillaume Clement | 1683440 | 2014-07-22 22:08:26 +0200 | [diff] [blame] | 247 | void __iomem *PortOffset; |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 248 | unsigned long dwIsr; |
| 249 | u32 memaddr; |
| 250 | u32 ioaddr; |
| 251 | u32 io_size; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 252 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 253 | unsigned char byRevId; |
Aya Mahfouz | 2359b5c | 2014-10-11 02:42:45 +0200 | [diff] [blame] | 254 | unsigned char byRxMode; |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 255 | unsigned short SubSystemID; |
| 256 | unsigned short SubVendorID; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 257 | |
Aya Mahfouz | 2359b5c | 2014-10-11 02:42:45 +0200 | [diff] [blame] | 258 | spinlock_t lock; |
| 259 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 260 | int nTxQueues; |
| 261 | volatile int iTDUsed[TYPE_MAXTD]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 262 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 263 | volatile PSTxDesc apCurrTD[TYPE_MAXTD]; |
| 264 | volatile PSTxDesc apTailTD[TYPE_MAXTD]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 265 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 266 | volatile PSTxDesc apTD0Rings; |
| 267 | volatile PSTxDesc apTD1Rings; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 268 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 269 | volatile PSRxDesc aRD0Ring; |
| 270 | volatile PSRxDesc aRD1Ring; |
| 271 | volatile PSRxDesc pCurrRD[TYPE_MAXRD]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 272 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 273 | OPTIONS sOpts; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 274 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 275 | u32 flags; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 276 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 277 | u32 rx_buf_sz; |
Malcolm Priestley | 33b1c8c | 2014-10-29 17:43:36 +0000 | [diff] [blame] | 278 | u8 rx_rate; |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 279 | int multicast_limit; |
Malcolm Priestley | 9a802f2 | 2014-07-28 21:43:28 +0100 | [diff] [blame] | 280 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 281 | u32 rx_bytes; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 282 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 283 | /* Version control */ |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 284 | unsigned char byLocalID; |
| 285 | unsigned char byRFType; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 286 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 287 | unsigned char byMaxPwrLevel; |
| 288 | unsigned char byZoneType; |
| 289 | bool bZoneRegExist; |
| 290 | unsigned char byOriginalZonetype; |
Malcolm Priestley | 1467610 | 2014-10-29 17:55:59 +0000 | [diff] [blame] | 291 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 292 | unsigned char abyCurrentNetAddr[ETH_ALEN]; |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 293 | bool bLinkPass; /* link status: OK or fail */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 294 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 295 | /* Adapter statistics */ |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 296 | SStatCounter scStatistic; |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 297 | /* 802.11 counter */ |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 298 | SDot11Counters s802_11Counter; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 299 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 300 | unsigned int uCurrRSSI; |
| 301 | unsigned char byCurrSQ; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 302 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 303 | unsigned long dwTxAntennaSel; |
| 304 | unsigned long dwRxAntennaSel; |
| 305 | unsigned char byAntennaCount; |
| 306 | unsigned char byRxAntennaMode; |
| 307 | unsigned char byTxAntennaMode; |
| 308 | bool bTxRxAntInv; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 309 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 310 | unsigned char *pbyTmpBuff; |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 311 | unsigned int uSIFS; /* Current SIFS */ |
| 312 | unsigned int uDIFS; /* Current DIFS */ |
| 313 | unsigned int uEIFS; /* Current EIFS */ |
| 314 | unsigned int uSlot; /* Current SlotTime */ |
| 315 | unsigned int uCwMin; /* Current CwMin */ |
| 316 | unsigned int uCwMax; /* CwMax is fixed on 1023. */ |
| 317 | /* PHY parameter */ |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 318 | unsigned char bySIFS; |
| 319 | unsigned char byDIFS; |
| 320 | unsigned char byEIFS; |
| 321 | unsigned char bySlot; |
| 322 | unsigned char byCWMaxMin; |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 323 | CARD_PHY_TYPE eCurrentPHYType; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 324 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 325 | VIA_BB_TYPE byBBType; /* 0:11A, 1:11B, 2:11G */ |
| 326 | VIA_PKT_TYPE byPacketType; /* |
| 327 | * 0:11a,1:11b,2:11gb (only CCK |
| 328 | * in BasicRate), 3:11ga (OFDM in |
| 329 | * Basic Rate) |
| 330 | */ |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 331 | unsigned short wBasicRate; |
| 332 | unsigned char byACKRate; |
| 333 | unsigned char byTopOFDMBasicRate; |
| 334 | unsigned char byTopCCKBasicRate; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 335 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 336 | unsigned char byMinChannel; |
| 337 | unsigned char byMaxChannel; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 338 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 339 | unsigned char byPreambleType; |
| 340 | unsigned char byShortPreamble; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 341 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 342 | unsigned short wCurrentRate; |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 343 | unsigned char byShortRetryLimit; |
| 344 | unsigned char byLongRetryLimit; |
Malcolm Priestley | a987367 | 2014-08-30 22:25:49 +0100 | [diff] [blame] | 345 | enum nl80211_iftype op_mode; |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 346 | bool bBSSIDFilter; |
| 347 | unsigned short wMaxTransmitMSDULifetime; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 348 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 349 | bool bEncryptionEnable; |
| 350 | bool bLongHeader; |
| 351 | bool bShortSlotTime; |
| 352 | bool bProtectMode; |
| 353 | bool bNonERPPresent; |
| 354 | bool bBarkerPreambleMd; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 355 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 356 | bool bRadioControlOff; |
| 357 | bool bRadioOff; |
| 358 | bool bEnablePSMode; |
| 359 | unsigned short wListenInterval; |
| 360 | bool bPWBitOn; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 361 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 362 | /* GPIO Radio Control */ |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 363 | unsigned char byRadioCtl; |
| 364 | unsigned char byGPIO; |
| 365 | bool bHWRadioOff; |
| 366 | bool bPrvActive4RadioOFF; |
| 367 | bool bGPIOBlockRead; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 368 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 369 | /* Beacon related */ |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 370 | unsigned short wSeqCounter; |
| 371 | unsigned short wBCNBufLen; |
| 372 | bool bBeaconBufReady; |
| 373 | bool bBeaconSent; |
| 374 | bool bIsBeaconBufReadySet; |
| 375 | unsigned int cbBeaconBufReadySetCnt; |
| 376 | bool bFixRate; |
| 377 | unsigned char byCurrentCh; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 378 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 379 | bool bAES; |
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 | unsigned char byAutoFBCtrl; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 382 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 383 | /* For Update BaseBand VGA Gain Offset */ |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 384 | bool bUpdateBBVGA; |
| 385 | unsigned int uBBVGADiffCount; |
| 386 | unsigned char byBBVGANew; |
| 387 | unsigned char byBBVGACurrent; |
| 388 | unsigned char abyBBVGA[BB_VGA_LEVEL]; |
| 389 | long ldBmThreshold[BB_VGA_LEVEL]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 390 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 391 | unsigned char byBBPreEDRSSI; |
| 392 | unsigned char byBBPreEDIndex; |
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 dwDiagRefCount; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 395 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 396 | /* For FOE Tuning */ |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 397 | unsigned char byFOETuning; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 398 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 399 | /* For RF Power table */ |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 400 | unsigned char byCCKPwr; |
| 401 | unsigned char byOFDMPwrG; |
| 402 | unsigned char byCurPwr; |
| 403 | char byCurPwrdBm; |
| 404 | unsigned char abyCCKPwrTbl[CB_MAX_CHANNEL_24G+1]; |
| 405 | unsigned char abyOFDMPwrTbl[CB_MAX_CHANNEL+1]; |
| 406 | char abyCCKDefaultPwr[CB_MAX_CHANNEL_24G+1]; |
| 407 | char abyOFDMDefaultPwr[CB_MAX_CHANNEL+1]; |
| 408 | char abyRegPwr[CB_MAX_CHANNEL+1]; |
| 409 | char abyLocalPwr[CB_MAX_CHANNEL+1]; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 410 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 411 | /* BaseBand Loopback Use */ |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 412 | unsigned char byBBCR4d; |
| 413 | unsigned char byBBCRc9; |
| 414 | unsigned char byBBCR88; |
| 415 | unsigned char byBBCR09; |
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 | bool bDiversityRegCtlON; |
| 418 | bool bDiversityEnable; |
| 419 | unsigned long ulDiversityNValue; |
| 420 | unsigned long ulDiversityMValue; |
| 421 | unsigned char byTMax; |
| 422 | unsigned char byTMax2; |
| 423 | unsigned char byTMax3; |
| 424 | unsigned long ulSQ3TH; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 425 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 426 | /* ANT diversity */ |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 427 | unsigned long uDiversityCnt; |
| 428 | unsigned char byAntennaState; |
| 429 | unsigned long ulRatio_State0; |
| 430 | unsigned long ulRatio_State1; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 431 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 432 | /* SQ3 functions for antenna diversity */ |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 433 | struct timer_list TimerSQ3Tmax1; |
| 434 | struct timer_list TimerSQ3Tmax2; |
| 435 | struct timer_list TimerSQ3Tmax3; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 436 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 437 | unsigned long uNumSQ3[MAX_RATE]; |
| 438 | unsigned short wAntDiversityMaxRate; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 439 | |
Veronika Kabatova | 81a4e95 | 2014-10-25 22:26:56 +0200 | [diff] [blame] | 440 | unsigned char abyEEPROM[EEP_MAX_CONTEXT_SIZE]; /* unsigned long alignment */ |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 441 | |
Joe Perches | 4ec4aa4 | 2013-03-18 10:44:45 -0700 | [diff] [blame] | 442 | unsigned short wBeaconInterval; |
Malcolm Priestley | 80f598a | 2014-08-10 15:47:03 +0100 | [diff] [blame] | 443 | }; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 444 | |
Devendra Naga | 8473f65 | 2013-01-08 12:52:33 -0500 | [diff] [blame] | 445 | static inline PDEVICE_RD_INFO alloc_rd_info(void) |
| 446 | { |
| 447 | return kzalloc(sizeof(DEVICE_RD_INFO), GFP_ATOMIC); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 448 | } |
| 449 | |
Devendra Naga | d1b46e7 | 2013-01-08 12:52:34 -0500 | [diff] [blame] | 450 | static inline PDEVICE_TD_INFO alloc_td_info(void) |
| 451 | { |
| 452 | return kzalloc(sizeof(DEVICE_TD_INFO), GFP_ATOMIC); |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 453 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 454 | #endif |