Commit | Line | Data |
---|---|---|
92b96797 FB |
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 | ||
92b96797 | 32 | #include <linux/module.h> |
92b96797 | 33 | #include <linux/kernel.h> |
92b96797 | 34 | #include <linux/slab.h> |
11d404cb MP |
35 | #include <linux/delay.h> |
36 | #include <linux/device.h> | |
37 | #include <linux/firmware.h> | |
38 | #include <linux/etherdevice.h> | |
39 | #include <linux/suspend.h> | |
92b96797 | 40 | #include <linux/if_arp.h> |
11d404cb MP |
41 | #include <linux/wireless.h> |
42 | #include <net/iw_handler.h> | |
43 | #include <net/cfg80211.h> | |
44 | #include <linux/timer.h> | |
92b96797 | 45 | #include <linux/usb.h> |
f0fde117 | 46 | #include <linux/crc32.h> |
11d404cb | 47 | |
92b96797 FB |
48 | #ifdef SIOCETHTOOL |
49 | #define DEVICE_ETHTOOL_IOCTL_SUPPORT | |
50 | #include <linux/ethtool.h> | |
51 | #else | |
52 | #undef DEVICE_ETHTOOL_IOCTL_SUPPORT | |
53 | #endif | |
92b96797 | 54 | |
4aeaf153 MP |
55 | #define MAX_RATE 12 |
56 | ||
d3e23951 AM |
57 | /* |
58 | * device specific | |
59 | */ | |
92b96797 | 60 | |
92b96797 | 61 | #include "80211hdr.h" |
92b96797 | 62 | #include "tether.h" |
92b96797 | 63 | #include "wmgr.h" |
92b96797 | 64 | #include "wcmd.h" |
92b96797 | 65 | #include "rc4.h" |
92b96797 | 66 | #include "desc.h" |
92b96797 | 67 | #include "key.h" |
92b96797 | 68 | #include "card.h" |
92b96797 | 69 | |
5008c456 | 70 | #define VNT_USB_VENDOR_ID 0x160a |
92b96797 FB |
71 | #define VNT_USB_PRODUCT_ID 0x3184 |
72 | ||
4aeaf153 MP |
73 | #define DEVICE_NAME "vt6656" |
74 | #define DEVICE_FULL_DRV_NAM "VIA Networking Wireless LAN USB Driver" | |
75 | ||
76 | #define DEVICE_VERSION "1.19_12" | |
77 | ||
78 | #define CONFIG_PATH "/etc/vntconfiguration.dat" | |
79 | ||
80 | #define MAX_UINTS 8 | |
81 | #define OPTION_DEFAULT { [0 ... MAX_UINTS-1] = -1} | |
82 | ||
92b96797 FB |
83 | #define DUPLICATE_RX_CACHE_LENGTH 5 |
84 | ||
92b96797 FB |
85 | #define AUTO_FB_NONE 0 |
86 | #define AUTO_FB_0 1 | |
87 | #define AUTO_FB_1 2 | |
88 | ||
89 | #define FB_RATE0 0 | |
90 | #define FB_RATE1 1 | |
91 | ||
d3e23951 | 92 | /* Antenna Mode */ |
92b96797 FB |
93 | #define ANT_A 0 |
94 | #define ANT_B 1 | |
95 | #define ANT_DIVERSITY 2 | |
96 | #define ANT_RXD_TXA 3 | |
97 | #define ANT_RXD_TXB 4 | |
98 | #define ANT_UNKNOWN 0xFF | |
99 | #define ANT_TXA 0 | |
100 | #define ANT_TXB 1 | |
101 | #define ANT_RXA 2 | |
102 | #define ANT_RXB 3 | |
103 | ||
92b96797 FB |
104 | #define BB_VGA_LEVEL 4 |
105 | #define BB_VGA_CHANGE_THRESHOLD 3 | |
106 | ||
15baf4ff MP |
107 | #define EEP_MAX_CONTEXT_SIZE 256 |
108 | ||
109 | /* Contents in the EEPROM */ | |
110 | #define EEP_OFS_PAR 0x0 | |
111 | #define EEP_OFS_ANTENNA 0x17 | |
112 | #define EEP_OFS_RADIOCTL 0x18 | |
113 | #define EEP_OFS_RFTYPE 0x1b | |
114 | #define EEP_OFS_MINCHANNEL 0x1c | |
115 | #define EEP_OFS_MAXCHANNEL 0x1d | |
116 | #define EEP_OFS_SIGNATURE 0x1e | |
117 | #define EEP_OFS_ZONETYPE 0x1f | |
118 | #define EEP_OFS_RFTABLE 0x20 | |
119 | #define EEP_OFS_PWR_CCK 0x20 | |
120 | #define EEP_OFS_SETPT_CCK 0x21 | |
121 | #define EEP_OFS_PWR_OFDMG 0x23 | |
122 | ||
123 | #define EEP_OFS_CALIB_TX_IQ 0x24 | |
124 | #define EEP_OFS_CALIB_TX_DC 0x25 | |
125 | #define EEP_OFS_CALIB_RX_IQ 0x26 | |
126 | ||
127 | #define EEP_OFS_MAJOR_VER 0x2e | |
128 | #define EEP_OFS_MINOR_VER 0x2f | |
129 | ||
130 | #define EEP_OFS_CCK_PWR_TBL 0x30 | |
131 | #define EEP_OFS_OFDM_PWR_TBL 0x40 | |
132 | #define EEP_OFS_OFDMA_PWR_TBL 0x50 | |
133 | ||
134 | /* Bits in EEP_OFS_ANTENNA */ | |
135 | #define EEP_ANTENNA_MAIN 0x1 | |
136 | #define EEP_ANTENNA_AUX 0x2 | |
137 | #define EEP_ANTINV 0x4 | |
138 | ||
139 | /* Bits in EEP_OFS_RADIOCTL */ | |
140 | #define EEP_RADIOCTL_ENABLE 0x80 | |
141 | ||
60f8ce8d MP |
142 | /* control commands */ |
143 | #define MESSAGE_TYPE_READ 0x1 | |
144 | #define MESSAGE_TYPE_WRITE 0x0 | |
145 | #define MESSAGE_TYPE_LOCK_OR 0x2 | |
146 | #define MESSAGE_TYPE_LOCK_AND 0x3 | |
147 | #define MESSAGE_TYPE_WRITE_MASK 0x4 | |
148 | #define MESSAGE_TYPE_CARDINIT 0x5 | |
149 | #define MESSAGE_TYPE_INIT_RSP 0x6 | |
150 | #define MESSAGE_TYPE_MACSHUTDOWN 0x7 | |
151 | #define MESSAGE_TYPE_SETKEY 0x8 | |
152 | #define MESSAGE_TYPE_CLRKEYENTRY 0x9 | |
153 | #define MESSAGE_TYPE_WRITE_MISCFF 0xa | |
154 | #define MESSAGE_TYPE_SET_ANTMD 0xb | |
155 | #define MESSAGE_TYPE_SELECT_CHANNLE 0xc | |
156 | #define MESSAGE_TYPE_SET_TSFTBTT 0xd | |
157 | #define MESSAGE_TYPE_SET_SSTIFS 0xe | |
158 | #define MESSAGE_TYPE_CHANGE_BBTYPE 0xf | |
159 | #define MESSAGE_TYPE_DISABLE_PS 0x10 | |
160 | #define MESSAGE_TYPE_WRITE_IFRF 0x11 | |
161 | ||
162 | /* command read/write(index) */ | |
163 | #define MESSAGE_REQUEST_MEM 0x1 | |
164 | #define MESSAGE_REQUEST_BBREG 0x2 | |
165 | #define MESSAGE_REQUEST_MACREG 0x3 | |
166 | #define MESSAGE_REQUEST_EEPROM 0x4 | |
167 | #define MESSAGE_REQUEST_TSF 0x5 | |
168 | #define MESSAGE_REQUEST_TBTT 0x6 | |
169 | #define MESSAGE_REQUEST_BBAGC 0x7 | |
170 | #define MESSAGE_REQUEST_VERSION 0x8 | |
171 | #define MESSAGE_REQUEST_RF_INIT 0x9 | |
172 | #define MESSAGE_REQUEST_RF_INIT2 0xa | |
173 | #define MESSAGE_REQUEST_RF_CH0 0xb | |
174 | #define MESSAGE_REQUEST_RF_CH1 0xc | |
175 | #define MESSAGE_REQUEST_RF_CH2 0xd | |
176 | ||
177 | /* USB registers */ | |
178 | #define USB_REG4 0x604 | |
179 | ||
92b96797 FB |
180 | #ifndef RUN_AT |
181 | #define RUN_AT(x) (jiffies+(x)) | |
182 | #endif | |
183 | ||
92b96797 FB |
184 | #define PRIVATE_Message 0 |
185 | ||
d9d1ccb5 AM |
186 | #define DBG_PRT(l, p, args...) { if (l <= msglevel) printk(p, ##args); } |
187 | #define PRINT_K(p, args...) { if (PRIVATE_Message) printk(p, ##args); } | |
92b96797 FB |
188 | |
189 | typedef enum __device_msg_level { | |
d9d1ccb5 AM |
190 | MSG_LEVEL_ERR = 0, /* Errors causing abnormal operation */ |
191 | MSG_LEVEL_NOTICE = 1, /* Errors needing user notification */ | |
192 | MSG_LEVEL_INFO = 2, /* Normal message. */ | |
193 | MSG_LEVEL_VERBOSE = 3, /* Will report all trival errors. */ | |
194 | MSG_LEVEL_DEBUG = 4 /* Only for debug purpose. */ | |
92b96797 FB |
195 | } DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL; |
196 | ||
302433da MP |
197 | #define DEVICE_INIT_COLD 0x0 /* cold init */ |
198 | #define DEVICE_INIT_RESET 0x1 /* reset init or Dx to D0 power remain */ | |
199 | #define DEVICE_INIT_DXPL 0x2 /* Dx to D0 power lost init */ | |
92b96797 | 200 | |
60f8ce8d MP |
201 | /* Device init */ |
202 | struct vnt_cmd_card_init { | |
203 | u8 init_class; | |
204 | u8 exist_sw_net_addr; | |
205 | u8 sw_net_addr[6]; | |
206 | u8 short_retry_limit; | |
207 | u8 long_retry_limit; | |
208 | }; | |
209 | ||
210 | struct vnt_rsp_card_init { | |
211 | u8 status; | |
212 | u8 net_addr[6]; | |
213 | u8 rf_type; | |
214 | u8 min_channel; | |
215 | u8 max_channel; | |
216 | }; | |
217 | ||
d3e23951 | 218 | /* USB */ |
92b96797 | 219 | |
d3e23951 AM |
220 | /* |
221 | * Enum of context types for SendPacket | |
222 | */ | |
1450ba62 MP |
223 | enum { |
224 | CONTEXT_DATA_PACKET = 1, | |
225 | CONTEXT_MGMT_PACKET | |
226 | }; | |
92b96797 | 227 | |
d3e23951 | 228 | /* RCB (Receive Control Block) */ |
115cac2e | 229 | struct vnt_rcb { |
dd0a774f MP |
230 | void *Next; |
231 | signed long Ref; | |
232 | void *pDevice; | |
233 | struct urb *pUrb; | |
234 | struct vnt_rx_mgmt sMngPacket; | |
235 | struct sk_buff *skb; | |
236 | int bBoolInUse; | |
115cac2e | 237 | }; |
92b96797 | 238 | |
d3e23951 | 239 | /* used to track bulk out irps */ |
dcdf1d03 | 240 | struct vnt_usb_send_context { |
30a05b39 MP |
241 | void *priv; |
242 | struct sk_buff *skb; | |
243 | struct urb *urb; | |
244 | unsigned int buf_len; | |
1450ba62 | 245 | u8 type; |
30a05b39 MP |
246 | bool in_use; |
247 | unsigned char data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS]; | |
dcdf1d03 | 248 | }; |
92b96797 | 249 | |
51934e7f MP |
250 | /* tx packet info for rxtx */ |
251 | struct vnt_tx_pkt_info { | |
252 | u16 fifo_ctl; | |
253 | u8 dest_addr[ETH_ALEN]; | |
254 | }; | |
255 | ||
213d2e93 AM |
256 | /* structure got from configuration file as user-desired default settings */ |
257 | typedef struct _DEFAULT_CONFIG { | |
258 | signed int ZoneType; | |
259 | signed int eConfigMode; | |
260 | signed int eAuthenMode; /* open/wep/wpa */ | |
261 | signed int bShareKeyAlgorithm; /* open-open/{open,wep}-sharekey */ | |
262 | signed int keyidx; /* wepkey index */ | |
263 | signed int eEncryptionStatus; | |
264 | } DEFAULT_CONFIG, *PDEFAULT_CONFIG; | |
92b96797 | 265 | |
d3e23951 AM |
266 | /* |
267 | * Structure to keep track of USB interrupt packets | |
268 | */ | |
f764e00d MP |
269 | struct vnt_interrupt_buffer { |
270 | u8 *data_buf; | |
271 | bool in_use; | |
272 | }; | |
92b96797 | 273 | |
d3e23951 | 274 | /*++ NDIS related */ |
92b96797 | 275 | |
92b96797 | 276 | typedef enum __DEVICE_NDIS_STATUS { |
d9d1ccb5 | 277 | STATUS_SUCCESS = 0, |
92b96797 FB |
278 | STATUS_FAILURE, |
279 | STATUS_RESOURCES, | |
280 | STATUS_PENDING, | |
281 | } DEVICE_NDIS_STATUS, *PDEVICE_NDIS_STATUS; | |
282 | ||
92b96797 FB |
283 | #define MAX_BSSIDINFO_4_PMKID 16 |
284 | #define MAX_PMKIDLIST 5 | |
d3e23951 | 285 | /* flags for PMKID Candidate list structure */ |
92b96797 FB |
286 | #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01 |
287 | ||
d3e23951 | 288 | /* PMKID Structures */ |
cc856e61 | 289 | typedef unsigned char NDIS_802_11_PMKID_VALUE[16]; |
92b96797 | 290 | |
92b96797 FB |
291 | typedef enum _NDIS_802_11_WEP_STATUS |
292 | { | |
293 | Ndis802_11WEPEnabled, | |
294 | Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled, | |
295 | Ndis802_11WEPDisabled, | |
296 | Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled, | |
297 | Ndis802_11WEPKeyAbsent, | |
298 | Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent, | |
299 | Ndis802_11WEPNotSupported, | |
300 | Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported, | |
301 | Ndis802_11Encryption2Enabled, | |
302 | Ndis802_11Encryption2KeyAbsent, | |
303 | Ndis802_11Encryption3Enabled, | |
304 | Ndis802_11Encryption3KeyAbsent | |
305 | } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS, | |
306 | NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS; | |
307 | ||
92b96797 FB |
308 | typedef enum _NDIS_802_11_STATUS_TYPE |
309 | { | |
d3e23951 AM |
310 | Ndis802_11StatusType_Authentication, |
311 | Ndis802_11StatusType_MediaStreamMode, | |
312 | Ndis802_11StatusType_PMKID_CandidateList, | |
313 | Ndis802_11StatusTypeMax, /* not a real type, defined as upper bound */ | |
92b96797 FB |
314 | } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE; |
315 | ||
d3e23951 | 316 | /* added new types for PMKID Candidate lists */ |
92b96797 FB |
317 | typedef struct _PMKID_CANDIDATE { |
318 | NDIS_802_11_MAC_ADDRESS BSSID; | |
cc856e61 | 319 | unsigned long Flags; |
92b96797 FB |
320 | } PMKID_CANDIDATE, *PPMKID_CANDIDATE; |
321 | ||
92b96797 FB |
322 | typedef struct _BSSID_INFO |
323 | { | |
324 | NDIS_802_11_MAC_ADDRESS BSSID; | |
325 | NDIS_802_11_PMKID_VALUE PMKID; | |
326 | } BSSID_INFO, *PBSSID_INFO; | |
327 | ||
328 | typedef struct tagSPMKID { | |
cc856e61 AM |
329 | unsigned long Length; |
330 | unsigned long BSSIDInfoCount; | |
92b96797 FB |
331 | BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID]; |
332 | } SPMKID, *PSPMKID; | |
333 | ||
334 | typedef struct tagSPMKIDCandidateEvent { | |
335 | NDIS_802_11_STATUS_TYPE StatusType; | |
cc856e61 AM |
336 | unsigned long Version; /* Version of the structure */ |
337 | unsigned long NumCandidates; /* No. of pmkid candidates */ | |
92b96797 | 338 | PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST]; |
193a823c | 339 | } SPMKIDCandidateEvent, *PSPMKIDCandidateEvent; |
92b96797 | 340 | |
d3e23951 | 341 | /* The receive duplicate detection cache entry */ |
92b96797 | 342 | typedef struct tagSCacheEntry{ |
9046db51 MP |
343 | __le16 wFmSequence; |
344 | u8 abyAddr2[ETH_ALEN]; | |
345 | __le16 wFrameCtl; | |
92b96797 FB |
346 | } SCacheEntry, *PSCacheEntry; |
347 | ||
348 | typedef struct tagSCache{ | |
349 | /* The receive cache is updated circularly. The next entry to be written is | |
350 | * indexed by the "InPtr". | |
d3e23951 | 351 | */ |
cc856e61 | 352 | unsigned int uInPtr; /* Place to use next */ |
92b96797 FB |
353 | SCacheEntry asCacheEntry[DUPLICATE_RX_CACHE_LENGTH]; |
354 | } SCache, *PSCache; | |
355 | ||
356 | #define CB_MAX_RX_FRAG 64 | |
d3e23951 AM |
357 | /* |
358 | * DeFragment Control Block, used for collecting fragments prior to reassembly | |
359 | */ | |
92b96797 FB |
360 | typedef struct tagSDeFragControlBlock |
361 | { | |
3eaca0d2 AM |
362 | u16 wSequence; |
363 | u16 wFragNum; | |
b902fbfe | 364 | u8 abyAddr2[ETH_ALEN]; |
cc856e61 | 365 | unsigned int uLifetime; |
92b96797 | 366 | struct sk_buff* skb; |
b902fbfe | 367 | u8 * pbyRxBuffer; |
cc856e61 | 368 | unsigned int cbFrameLength; |
dfdcc425 | 369 | bool bInUse; |
193a823c | 370 | } SDeFragControlBlock, *PSDeFragControlBlock; |
92b96797 | 371 | |
d3e23951 | 372 | /* flags for options */ |
92b96797 | 373 | #define DEVICE_FLAGS_UNPLUG 0x00000001UL |
92b96797 | 374 | |
d3e23951 | 375 | /* flags for driver status */ |
92b96797 | 376 | #define DEVICE_FLAGS_OPENED 0x00010000UL |
92b96797 | 377 | |
92b96797 | 378 | typedef struct __device_opt { |
d3e23951 AM |
379 | int nRxDescs0; /* number of RX descriptors 0 */ |
380 | int nTxDescs0; /* number of TX descriptors 0, 1, 2, 3 */ | |
381 | int rts_thresh; /* RTS threshold */ | |
92b96797 FB |
382 | int frag_thresh; |
383 | int OpMode; | |
384 | int data_rate; | |
385 | int channel_num; | |
386 | int short_retry; | |
387 | int long_retry; | |
388 | int bbp_type; | |
659770d4 | 389 | u32 flags; |
92b96797 FB |
390 | } OPTIONS, *POPTIONS; |
391 | ||
14c5ef57 | 392 | struct vnt_private { |
61462ab3 MP |
393 | /* netdev */ |
394 | struct usb_device *usb; | |
395 | struct net_device *dev; | |
396 | struct net_device_stats stats; | |
92b96797 | 397 | |
61462ab3 | 398 | OPTIONS sOpts; |
92b96797 | 399 | |
81d720d3 | 400 | struct work_struct read_work_item; |
a21fc2f5 | 401 | struct work_struct rx_mng_work_item; |
31d5bbf3 | 402 | |
61462ab3 MP |
403 | u32 rx_buf_sz; |
404 | int multicast_limit; | |
405 | u8 byRxMode; | |
92b96797 | 406 | |
61462ab3 | 407 | spinlock_t lock; |
c91b1869 | 408 | struct mutex usb_lock; |
92b96797 | 409 | |
61462ab3 | 410 | u32 rx_bytes; |
92b96797 | 411 | |
61462ab3 MP |
412 | u32 flags; |
413 | unsigned long Flags; | |
92b96797 | 414 | |
61462ab3 | 415 | SCache sDupRxCache; |
92b96797 | 416 | |
61462ab3 MP |
417 | SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG]; |
418 | u32 cbDFCB; | |
419 | u32 cbFreeDFCB; | |
420 | u32 uCurrentDFCBIdx; | |
92b96797 | 421 | |
61462ab3 | 422 | /* USB */ |
61462ab3 | 423 | struct urb *pInterruptURB; |
61462ab3 | 424 | u32 int_interval; |
92b96797 | 425 | |
61462ab3 | 426 | /* Variables to track resources for the BULK In Pipe */ |
115cac2e MP |
427 | struct vnt_rcb *pRCBMem; |
428 | struct vnt_rcb *apRCB[CB_MAX_RX_DESC]; | |
61462ab3 | 429 | u32 cbRD; |
115cac2e MP |
430 | struct vnt_rcb *FirstRecvFreeList; |
431 | struct vnt_rcb *LastRecvFreeList; | |
61462ab3 | 432 | u32 NumRecvFreeList; |
115cac2e MP |
433 | struct vnt_rcb *FirstRecvMngList; |
434 | struct vnt_rcb *LastRecvMngList; | |
61462ab3 MP |
435 | u32 NumRecvMngList; |
436 | int bIsRxWorkItemQueued; | |
437 | int bIsRxMngWorkItemQueued; | |
cc856e61 | 438 | unsigned long ulRcvRefCount; /* packets that have not returned back */ |
92b96797 | 439 | |
61462ab3 | 440 | /* Variables to track resources for the BULK Out Pipe */ |
dcdf1d03 | 441 | struct vnt_usb_send_context *apTD[CB_MAX_TX_DESC]; |
61462ab3 | 442 | u32 cbTD; |
51934e7f | 443 | struct vnt_tx_pkt_info pkt_info[16]; |
92b96797 | 444 | |
61462ab3 | 445 | /* Variables to track resources for the Interrupt In Pipe */ |
f764e00d | 446 | struct vnt_interrupt_buffer int_buf; |
92b96797 | 447 | |
61462ab3 MP |
448 | /* default config from file by user setting */ |
449 | DEFAULT_CONFIG config_file; | |
92b96797 | 450 | |
61462ab3 MP |
451 | /* Version control */ |
452 | u16 wFirmwareVersion; | |
453 | u8 byLocalID; | |
454 | u8 byRFType; | |
455 | u8 byBBRxConf; | |
92b96797 | 456 | |
61462ab3 MP |
457 | u8 byZoneType; |
458 | int bZoneRegExist; | |
92b96797 | 459 | |
61462ab3 | 460 | u8 byOriginalZonetype; |
92b96797 | 461 | |
61462ab3 | 462 | int bLinkPass; /* link status: OK or fail */ |
748bf69c MP |
463 | struct vnt_cmd_card_init init_command; |
464 | struct vnt_rsp_card_init init_response; | |
61462ab3 MP |
465 | u8 abyCurrentNetAddr[ETH_ALEN]; |
466 | u8 abyPermanentNetAddr[ETH_ALEN]; | |
92b96797 | 467 | |
61462ab3 | 468 | int bExistSWNetAddr; |
92b96797 | 469 | |
61462ab3 | 470 | /* Maintain statistical debug info. */ |
61462ab3 MP |
471 | unsigned long SendContextsInUse; |
472 | unsigned long RcvBuffersInUse; | |
92b96797 | 473 | |
14c5ef57 | 474 | /* 802.11 management */ |
4f4a89c9 | 475 | struct vnt_manager vnt_mgmt; |
92b96797 | 476 | |
7c65fa2a | 477 | u64 qwCurrTSF; |
61462ab3 MP |
478 | u32 cbBulkInMax; |
479 | int bPSRxBeacon; | |
480 | ||
481 | /* 802.11 MAC specific */ | |
482 | u32 uCurrRSSI; | |
483 | u8 byCurrSQ; | |
484 | ||
485 | /* Antenna Diversity */ | |
486 | int bTxRxAntInv; | |
487 | u32 dwRxAntennaSel; | |
488 | u32 dwTxAntennaSel; | |
489 | u8 byAntennaCount; | |
490 | u8 byRxAntennaMode; | |
491 | u8 byTxAntennaMode; | |
492 | u8 byRadioCtl; | |
493 | u8 bHWRadioOff; | |
494 | ||
cc856e61 | 495 | /* IFS & Cw */ |
61462ab3 MP |
496 | u32 uSIFS; /* Current SIFS */ |
497 | u32 uDIFS; /* Current DIFS */ | |
498 | u32 uEIFS; /* Current EIFS */ | |
499 | u32 uSlot; /* Current SlotTime */ | |
500 | u32 uCwMin; /* Current CwMin */ | |
501 | u32 uCwMax; /* CwMax is fixed on 1023 */ | |
502 | ||
503 | /* PHY parameter */ | |
504 | u8 bySIFS; | |
505 | u8 byDIFS; | |
506 | u8 byEIFS; | |
507 | u8 bySlot; | |
508 | u8 byCWMaxMin; | |
509 | ||
510 | /* Rate */ | |
a9052bc9 | 511 | u8 byBBType; /* 0: 11A, 1:11B, 2:11G */ |
bf1c820f | 512 | u8 byPacketType; /* 0:11a 1:11b 2:11gb 3:11ga */ |
61462ab3 | 513 | u16 wBasicRate; |
61462ab3 MP |
514 | u8 byTopOFDMBasicRate; |
515 | u8 byTopCCKBasicRate; | |
516 | ||
61462ab3 MP |
517 | u8 abyEEPROM[EEP_MAX_CONTEXT_SIZE]; /*u32 alignment */ |
518 | ||
519 | u8 byMinChannel; | |
520 | u8 byMaxChannel; | |
521 | u32 uConnectionRate; | |
522 | ||
523 | u8 byPreambleType; | |
524 | u8 byShortPreamble; | |
525 | /* CARD_PHY_TYPE */ | |
526 | u8 eConfigPHYMode; | |
527 | ||
528 | /* For RF Power table */ | |
529 | u8 byCCKPwr; | |
530 | u8 byOFDMPwrG; | |
531 | u8 byOFDMPwrA; | |
532 | u8 byCurPwr; | |
533 | u8 abyCCKPwrTbl[14]; | |
534 | u8 abyOFDMPwrTbl[14]; | |
535 | u8 abyOFDMAPwrTbl[42]; | |
536 | ||
537 | u16 wCurrentRate; | |
f84cdf65 MP |
538 | u16 tx_rate_fb0; |
539 | u16 tx_rate_fb1; | |
540 | ||
61462ab3 MP |
541 | u16 wRTSThreshold; |
542 | u16 wFragmentationThreshold; | |
543 | u8 byShortRetryLimit; | |
544 | u8 byLongRetryLimit; | |
a0ad2776 MP |
545 | |
546 | enum nl80211_iftype op_mode; | |
547 | ||
61462ab3 MP |
548 | int bBSSIDFilter; |
549 | u16 wMaxTransmitMSDULifetime; | |
550 | u8 abyBSSID[ETH_ALEN]; | |
551 | u8 abyDesireBSSID[ETH_ALEN]; | |
552 | ||
61462ab3 MP |
553 | u32 dwMaxReceiveLifetime; /* dot11MaxReceiveLifetime */ |
554 | ||
61462ab3 | 555 | int bEncryptionEnable; |
61462ab3 MP |
556 | int bShortSlotTime; |
557 | int bProtectMode; | |
558 | int bNonERPPresent; | |
559 | int bBarkerPreambleMd; | |
560 | ||
561 | u8 byERPFlag; | |
562 | u16 wUseProtectCntDown; | |
563 | ||
564 | int bRadioControlOff; | |
565 | int bRadioOff; | |
566 | ||
567 | /* Power save */ | |
568 | int bEnablePSMode; | |
569 | u16 wListenInterval; | |
570 | int bPWBitOn; | |
571 | WMAC_POWER_MODE ePSMode; | |
572 | unsigned long ulPSModeWaitTx; | |
573 | int bPSModeTxBurst; | |
574 | ||
575 | /* Beacon releated */ | |
576 | u16 wSeqCounter; | |
577 | int bBeaconBufReady; | |
578 | int bBeaconSent; | |
579 | int bFixRate; | |
580 | u8 byCurrentCh; | |
61462ab3 MP |
581 | |
582 | CMD_STATE eCommandState; | |
583 | ||
584 | CMD_CODE eCommand; | |
585 | int bBeaconTx; | |
586 | u8 byScanBBType; | |
587 | ||
588 | int bStopBeacon; | |
589 | int bStopDataPkt; | |
590 | int bStopTx0Pkt; | |
591 | u32 uAutoReConnectTime; | |
592 | u32 uIsroamingTime; | |
593 | ||
594 | /* 802.11 counter */ | |
595 | ||
596 | CMD_ITEM eCmdQueue[CMD_Q_SIZE]; | |
597 | u32 uCmdDequeueIdx; | |
598 | u32 uCmdEnqueueIdx; | |
599 | u32 cbFreeCmdQueue; | |
600 | int bCmdRunning; | |
601 | int bCmdClear; | |
602 | int bNeedRadioOFF; | |
603 | ||
604 | int bEnableRoaming; | |
605 | int bIsRoaming; | |
606 | int bFastRoaming; | |
607 | u8 bSameBSSMaxNum; | |
608 | u8 bSameBSSCurNum; | |
609 | int bRoaming; | |
610 | int b11hEable; | |
61462ab3 MP |
611 | |
612 | /* Encryption */ | |
613 | NDIS_802_11_WEP_STATUS eEncryptionStatus; | |
614 | int bTransmitKey; | |
615 | NDIS_802_11_WEP_STATUS eOldEncryptionStatus; | |
616 | SKeyManagement sKey; | |
617 | u32 dwIVCounter; | |
618 | ||
61462ab3 MP |
619 | RC4Ext SBox; |
620 | u8 abyPRNG[WLAN_WEPMAX_KEYLEN+3]; | |
621 | u8 byKeyIndex; | |
622 | ||
61462ab3 MP |
623 | u32 uKeyLength; |
624 | u8 abyKey[WLAN_WEP232_KEYLEN]; | |
625 | ||
626 | /* for AP mode */ | |
627 | u32 uAssocCount; | |
628 | int bMoreData; | |
629 | ||
630 | /* QoS */ | |
631 | int bGrpAckPolicy; | |
632 | ||
61462ab3 MP |
633 | u8 byAutoFBCtrl; |
634 | ||
635 | int bTxMICFail; | |
636 | int bRxMICFail; | |
637 | ||
61462ab3 | 638 | /* For Update BaseBand VGA Gain Offset */ |
61462ab3 MP |
639 | u32 uBBVGADiffCount; |
640 | u8 byBBVGANew; | |
641 | u8 byBBVGACurrent; | |
642 | u8 abyBBVGA[BB_VGA_LEVEL]; | |
643 | signed long ldBmThreshold[BB_VGA_LEVEL]; | |
644 | ||
645 | u8 byBBPreEDRSSI; | |
646 | u8 byBBPreEDIndex; | |
647 | ||
61462ab3 | 648 | int bRadioCmd; |
61462ab3 | 649 | |
61462ab3 | 650 | /* command timer */ |
94488a7e | 651 | struct delayed_work run_command_work; |
bd9a6dba MP |
652 | /* One second callback */ |
653 | struct delayed_work second_callback_work; | |
92b96797 | 654 | |
60cc2747 MP |
655 | u8 tx_data_time_out; |
656 | bool tx_trigger; | |
61462ab3 MP |
657 | int fWPA_Authened; /*is WPA/WPA-PSK or WPA2/WPA2-PSK authen?? */ |
658 | u8 byReAssocCount; | |
659 | u8 byLinkWaitCount; | |
92b96797 | 660 | |
ceb8c5da AM |
661 | struct ethhdr sTxEthHeader; |
662 | struct ethhdr sRxEthHeader; | |
61462ab3 MP |
663 | u8 abyBroadcastAddr[ETH_ALEN]; |
664 | u8 abySNAP_RFC1042[ETH_ALEN]; | |
665 | u8 abySNAP_Bridgetunnel[ETH_ALEN]; | |
92b96797 | 666 | |
61462ab3 MP |
667 | /* Pre-Authentication & PMK cache */ |
668 | SPMKID gsPMKID; | |
669 | SPMKIDCandidateEvent gsPMKIDCandidate; | |
92b96797 | 670 | |
61462ab3 MP |
671 | /* for 802.11h */ |
672 | int b11hEnable; | |
92b96797 | 673 | |
61462ab3 MP |
674 | int bChannelSwitch; |
675 | u8 byNewChannel; | |
676 | u8 byChannelSwitchCount; | |
92b96797 | 677 | |
61462ab3 MP |
678 | /* WPA supplicant daemon */ |
679 | int bWPADEVUp; | |
680 | int bwextstep0; | |
681 | int bwextstep1; | |
682 | int bwextstep2; | |
683 | int bwextstep3; | |
684 | int bWPASuppWextEnabled; | |
92b96797 | 685 | |
61462ab3 | 686 | u32 uChannel; |
92b96797 | 687 | |
61462ab3 | 688 | struct iw_statistics wstats; /* wireless stats */ |
92b96797 | 689 | |
61462ab3 | 690 | int bCommit; |
92b96797 | 691 | |
14c5ef57 | 692 | }; |
92b96797 | 693 | |
92b96797 FB |
694 | #define EnqueueRCB(_Head, _Tail, _RCB) \ |
695 | { \ | |
696 | if (!_Head) { \ | |
697 | _Head = _RCB; \ | |
698 | } \ | |
699 | else { \ | |
700 | _Tail->Next = _RCB; \ | |
701 | } \ | |
702 | _RCB->Next = NULL; \ | |
703 | _Tail = _RCB; \ | |
704 | } | |
705 | ||
706 | #define DequeueRCB(Head, Tail) \ | |
707 | { \ | |
115cac2e | 708 | struct vnt_rcb *RCB = Head; \ |
92b96797 FB |
709 | if (!RCB->Next) { \ |
710 | Tail = NULL; \ | |
711 | } \ | |
712 | Head = RCB->Next; \ | |
713 | } | |
714 | ||
92b96797 FB |
715 | #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \ |
716 | if ((uVar) >= ((uModulo) - 1)) \ | |
717 | (uVar) = 0; \ | |
718 | else \ | |
719 | (uVar)++; \ | |
720 | } | |
721 | ||
92b96797 | 722 | #define fMP_DISCONNECTED 0x00000002 |
92b96797 FB |
723 | #define fMP_POST_READS 0x00000100 |
724 | #define fMP_POST_WRITES 0x00000200 | |
92b96797 | 725 | |
92b96797 FB |
726 | #define MP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F)) |
727 | #define MP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F)) | |
92b96797 FB |
728 | #define MP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F)) |
729 | ||
d4f376dd | 730 | #define MP_IS_READY(_M) (((_M)->Flags & fMP_DISCONNECTED) == 0) |
92b96797 | 731 | |
dd0a774f | 732 | int device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF); |
edd20e96 | 733 | void vnt_configure_filter(struct vnt_private *); |
92b96797 FB |
734 | |
735 | #endif |