]>
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 | |
d3e23951 | 55 | /* please copy below macro to driver_event.c for API */ |
92b96797 FB |
56 | #define RT_INSMOD_EVENT_FLAG 0x0101 |
57 | #define RT_UPDEV_EVENT_FLAG 0x0102 | |
58 | #define RT_DISCONNECTED_EVENT_FLAG 0x0103 | |
59 | #define RT_WPACONNECTED_EVENT_FLAG 0x0104 | |
60 | #define RT_DOWNDEV_EVENT_FLAG 0x0105 | |
61 | #define RT_RMMOD_EVENT_FLAG 0x0106 | |
92b96797 | 62 | |
d3e23951 AM |
63 | /* |
64 | * device specific | |
65 | */ | |
92b96797 | 66 | |
92b96797 | 67 | #include "device_cfg.h" |
92b96797 | 68 | #include "80211hdr.h" |
92b96797 | 69 | #include "tether.h" |
92b96797 | 70 | #include "wmgr.h" |
92b96797 | 71 | #include "wcmd.h" |
92b96797 | 72 | #include "srom.h" |
92b96797 | 73 | #include "rc4.h" |
92b96797 | 74 | #include "desc.h" |
92b96797 | 75 | #include "key.h" |
92b96797 | 76 | #include "card.h" |
748bf69c | 77 | #include "rndis.h" |
92b96797 | 78 | |
5008c456 | 79 | #define VNT_USB_VENDOR_ID 0x160a |
92b96797 FB |
80 | #define VNT_USB_PRODUCT_ID 0x3184 |
81 | ||
82 | #define MAC_MAX_CONTEXT_REG (256+128) | |
83 | ||
84 | #define MAX_MULTICAST_ADDRESS_NUM 32 | |
9a0e756c | 85 | #define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN) |
92b96797 | 86 | |
92b96797 FB |
87 | #define DUPLICATE_RX_CACHE_LENGTH 5 |
88 | ||
89 | #define NUM_KEY_ENTRY 11 | |
90 | ||
91 | #define TX_WEP_NONE 0 | |
92 | #define TX_WEP_OTF 1 | |
93 | #define TX_WEP_SW 2 | |
94 | #define TX_WEP_SWOTP 3 | |
95 | #define TX_WEP_OTPSW 4 | |
96 | #define TX_WEP_SW232 5 | |
97 | ||
98 | #define KEYSEL_WEP40 0 | |
99 | #define KEYSEL_WEP104 1 | |
100 | #define KEYSEL_TKIP 2 | |
101 | #define KEYSEL_CCMP 3 | |
102 | ||
92b96797 FB |
103 | #define AUTO_FB_NONE 0 |
104 | #define AUTO_FB_0 1 | |
105 | #define AUTO_FB_1 2 | |
106 | ||
107 | #define FB_RATE0 0 | |
108 | #define FB_RATE1 1 | |
109 | ||
d3e23951 | 110 | /* Antenna Mode */ |
92b96797 FB |
111 | #define ANT_A 0 |
112 | #define ANT_B 1 | |
113 | #define ANT_DIVERSITY 2 | |
114 | #define ANT_RXD_TXA 3 | |
115 | #define ANT_RXD_TXB 4 | |
116 | #define ANT_UNKNOWN 0xFF | |
117 | #define ANT_TXA 0 | |
118 | #define ANT_TXB 1 | |
119 | #define ANT_RXA 2 | |
120 | #define ANT_RXB 3 | |
121 | ||
92b96797 FB |
122 | #define MAXCHECKHANGCNT 4 |
123 | ||
d3e23951 | 124 | /* Packet type */ |
92b96797 FB |
125 | #define TX_PKT_UNI 0x00 |
126 | #define TX_PKT_MULTI 0x01 | |
127 | #define TX_PKT_BROAD 0x02 | |
128 | ||
129 | #define BB_VGA_LEVEL 4 | |
130 | #define BB_VGA_CHANGE_THRESHOLD 3 | |
131 | ||
92b96797 FB |
132 | #ifndef RUN_AT |
133 | #define RUN_AT(x) (jiffies+(x)) | |
134 | #endif | |
135 | ||
d3e23951 | 136 | /* DMA related */ |
92b96797 FB |
137 | #define RESERV_AC0DMA 4 |
138 | ||
139 | #define PRIVATE_Message 0 | |
140 | ||
d9d1ccb5 AM |
141 | #define DBG_PRT(l, p, args...) { if (l <= msglevel) printk(p, ##args); } |
142 | #define PRINT_K(p, args...) { if (PRIVATE_Message) printk(p, ##args); } | |
92b96797 FB |
143 | |
144 | typedef enum __device_msg_level { | |
d9d1ccb5 AM |
145 | MSG_LEVEL_ERR = 0, /* Errors causing abnormal operation */ |
146 | MSG_LEVEL_NOTICE = 1, /* Errors needing user notification */ | |
147 | MSG_LEVEL_INFO = 2, /* Normal message. */ | |
148 | MSG_LEVEL_VERBOSE = 3, /* Will report all trival errors. */ | |
149 | MSG_LEVEL_DEBUG = 4 /* Only for debug purpose. */ | |
92b96797 FB |
150 | } DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL; |
151 | ||
302433da MP |
152 | #define DEVICE_INIT_COLD 0x0 /* cold init */ |
153 | #define DEVICE_INIT_RESET 0x1 /* reset init or Dx to D0 power remain */ | |
154 | #define DEVICE_INIT_DXPL 0x2 /* Dx to D0 power lost init */ | |
92b96797 | 155 | |
d3e23951 | 156 | /* USB */ |
92b96797 | 157 | |
d3e23951 AM |
158 | /* |
159 | * Enum of context types for SendPacket | |
160 | */ | |
1450ba62 MP |
161 | enum { |
162 | CONTEXT_DATA_PACKET = 1, | |
163 | CONTEXT_MGMT_PACKET | |
164 | }; | |
92b96797 | 165 | |
d3e23951 | 166 | /* RCB (Receive Control Block) */ |
115cac2e | 167 | struct vnt_rcb { |
dd0a774f MP |
168 | void *Next; |
169 | signed long Ref; | |
170 | void *pDevice; | |
171 | struct urb *pUrb; | |
172 | struct vnt_rx_mgmt sMngPacket; | |
173 | struct sk_buff *skb; | |
174 | int bBoolInUse; | |
115cac2e | 175 | }; |
92b96797 | 176 | |
d3e23951 | 177 | /* used to track bulk out irps */ |
dcdf1d03 MP |
178 | struct vnt_usb_send_context { |
179 | void *pDevice; | |
180 | struct sk_buff *pPacket; | |
181 | struct urb *pUrb; | |
182 | unsigned int uBufLen; | |
1450ba62 | 183 | u8 type; |
dcdf1d03 MP |
184 | bool bBoolInUse; |
185 | unsigned char Data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS]; | |
186 | }; | |
92b96797 | 187 | |
51934e7f MP |
188 | /* tx packet info for rxtx */ |
189 | struct vnt_tx_pkt_info { | |
190 | u16 fifo_ctl; | |
191 | u8 dest_addr[ETH_ALEN]; | |
192 | }; | |
193 | ||
213d2e93 AM |
194 | /* structure got from configuration file as user-desired default settings */ |
195 | typedef struct _DEFAULT_CONFIG { | |
196 | signed int ZoneType; | |
197 | signed int eConfigMode; | |
198 | signed int eAuthenMode; /* open/wep/wpa */ | |
199 | signed int bShareKeyAlgorithm; /* open-open/{open,wep}-sharekey */ | |
200 | signed int keyidx; /* wepkey index */ | |
201 | signed int eEncryptionStatus; | |
202 | } DEFAULT_CONFIG, *PDEFAULT_CONFIG; | |
92b96797 | 203 | |
d3e23951 AM |
204 | /* |
205 | * Structure to keep track of USB interrupt packets | |
206 | */ | |
f764e00d MP |
207 | struct vnt_interrupt_buffer { |
208 | u8 *data_buf; | |
209 | bool in_use; | |
210 | }; | |
92b96797 | 211 | |
d3e23951 | 212 | /*++ NDIS related */ |
92b96797 | 213 | |
92b96797 | 214 | typedef enum __DEVICE_NDIS_STATUS { |
d9d1ccb5 | 215 | STATUS_SUCCESS = 0, |
92b96797 FB |
216 | STATUS_FAILURE, |
217 | STATUS_RESOURCES, | |
218 | STATUS_PENDING, | |
219 | } DEVICE_NDIS_STATUS, *PDEVICE_NDIS_STATUS; | |
220 | ||
92b96797 FB |
221 | #define MAX_BSSIDINFO_4_PMKID 16 |
222 | #define MAX_PMKIDLIST 5 | |
d3e23951 | 223 | /* flags for PMKID Candidate list structure */ |
92b96797 FB |
224 | #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01 |
225 | ||
d3e23951 | 226 | /* PMKID Structures */ |
cc856e61 | 227 | typedef unsigned char NDIS_802_11_PMKID_VALUE[16]; |
92b96797 | 228 | |
92b96797 FB |
229 | typedef enum _NDIS_802_11_WEP_STATUS |
230 | { | |
231 | Ndis802_11WEPEnabled, | |
232 | Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled, | |
233 | Ndis802_11WEPDisabled, | |
234 | Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled, | |
235 | Ndis802_11WEPKeyAbsent, | |
236 | Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent, | |
237 | Ndis802_11WEPNotSupported, | |
238 | Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported, | |
239 | Ndis802_11Encryption2Enabled, | |
240 | Ndis802_11Encryption2KeyAbsent, | |
241 | Ndis802_11Encryption3Enabled, | |
242 | Ndis802_11Encryption3KeyAbsent | |
243 | } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS, | |
244 | NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS; | |
245 | ||
92b96797 FB |
246 | typedef enum _NDIS_802_11_STATUS_TYPE |
247 | { | |
d3e23951 AM |
248 | Ndis802_11StatusType_Authentication, |
249 | Ndis802_11StatusType_MediaStreamMode, | |
250 | Ndis802_11StatusType_PMKID_CandidateList, | |
251 | Ndis802_11StatusTypeMax, /* not a real type, defined as upper bound */ | |
92b96797 FB |
252 | } NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE; |
253 | ||
d3e23951 | 254 | /* added new types for PMKID Candidate lists */ |
92b96797 FB |
255 | typedef struct _PMKID_CANDIDATE { |
256 | NDIS_802_11_MAC_ADDRESS BSSID; | |
cc856e61 | 257 | unsigned long Flags; |
92b96797 FB |
258 | } PMKID_CANDIDATE, *PPMKID_CANDIDATE; |
259 | ||
92b96797 FB |
260 | typedef struct _BSSID_INFO |
261 | { | |
262 | NDIS_802_11_MAC_ADDRESS BSSID; | |
263 | NDIS_802_11_PMKID_VALUE PMKID; | |
264 | } BSSID_INFO, *PBSSID_INFO; | |
265 | ||
266 | typedef struct tagSPMKID { | |
cc856e61 AM |
267 | unsigned long Length; |
268 | unsigned long BSSIDInfoCount; | |
92b96797 FB |
269 | BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID]; |
270 | } SPMKID, *PSPMKID; | |
271 | ||
272 | typedef struct tagSPMKIDCandidateEvent { | |
273 | NDIS_802_11_STATUS_TYPE StatusType; | |
cc856e61 AM |
274 | unsigned long Version; /* Version of the structure */ |
275 | unsigned long NumCandidates; /* No. of pmkid candidates */ | |
92b96797 | 276 | PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST]; |
193a823c | 277 | } SPMKIDCandidateEvent, *PSPMKIDCandidateEvent; |
92b96797 | 278 | |
d3e23951 | 279 | /* The receive duplicate detection cache entry */ |
92b96797 | 280 | typedef struct tagSCacheEntry{ |
3eaca0d2 | 281 | u16 wFmSequence; |
b902fbfe | 282 | u8 abyAddr2[ETH_ALEN]; |
3eaca0d2 | 283 | u16 wFrameCtl; |
92b96797 FB |
284 | } SCacheEntry, *PSCacheEntry; |
285 | ||
286 | typedef struct tagSCache{ | |
287 | /* The receive cache is updated circularly. The next entry to be written is | |
288 | * indexed by the "InPtr". | |
d3e23951 | 289 | */ |
cc856e61 | 290 | unsigned int uInPtr; /* Place to use next */ |
92b96797 FB |
291 | SCacheEntry asCacheEntry[DUPLICATE_RX_CACHE_LENGTH]; |
292 | } SCache, *PSCache; | |
293 | ||
294 | #define CB_MAX_RX_FRAG 64 | |
d3e23951 AM |
295 | /* |
296 | * DeFragment Control Block, used for collecting fragments prior to reassembly | |
297 | */ | |
92b96797 FB |
298 | typedef struct tagSDeFragControlBlock |
299 | { | |
3eaca0d2 AM |
300 | u16 wSequence; |
301 | u16 wFragNum; | |
b902fbfe | 302 | u8 abyAddr2[ETH_ALEN]; |
cc856e61 | 303 | unsigned int uLifetime; |
92b96797 | 304 | struct sk_buff* skb; |
b902fbfe | 305 | u8 * pbyRxBuffer; |
cc856e61 | 306 | unsigned int cbFrameLength; |
dfdcc425 | 307 | bool bInUse; |
193a823c | 308 | } SDeFragControlBlock, *PSDeFragControlBlock; |
92b96797 | 309 | |
d3e23951 | 310 | /* flags for options */ |
92b96797 FB |
311 | #define DEVICE_FLAGS_UNPLUG 0x00000001UL |
312 | #define DEVICE_FLAGS_PREAMBLE_TYPE 0x00000002UL | |
313 | #define DEVICE_FLAGS_OP_MODE 0x00000004UL | |
314 | #define DEVICE_FLAGS_PS_MODE 0x00000008UL | |
315 | #define DEVICE_FLAGS_80211h_MODE 0x00000010UL | |
316 | ||
d3e23951 | 317 | /* flags for driver status */ |
92b96797 FB |
318 | #define DEVICE_FLAGS_OPENED 0x00010000UL |
319 | #define DEVICE_FLAGS_WOL_ENABLED 0x00080000UL | |
d3e23951 | 320 | /* flags for capabilities */ |
92b96797 FB |
321 | #define DEVICE_FLAGS_TX_ALIGN 0x01000000UL |
322 | #define DEVICE_FLAGS_HAVE_CAM 0x02000000UL | |
323 | #define DEVICE_FLAGS_FLOW_CTRL 0x04000000UL | |
324 | ||
d3e23951 | 325 | /* flags for MII status */ |
92b96797 FB |
326 | #define DEVICE_LINK_FAIL 0x00000001UL |
327 | #define DEVICE_SPEED_10 0x00000002UL | |
328 | #define DEVICE_SPEED_100 0x00000004UL | |
329 | #define DEVICE_SPEED_1000 0x00000008UL | |
330 | #define DEVICE_DUPLEX_FULL 0x00000010UL | |
331 | #define DEVICE_AUTONEG_ENABLE 0x00000020UL | |
332 | #define DEVICE_FORCED_BY_EEPROM 0x00000040UL | |
d3e23951 | 333 | /* for device_set_media_duplex */ |
92b96797 FB |
334 | #define DEVICE_LINK_CHANGE 0x00000001UL |
335 | ||
92b96797 | 336 | typedef struct __device_opt { |
d3e23951 AM |
337 | int nRxDescs0; /* number of RX descriptors 0 */ |
338 | int nTxDescs0; /* number of TX descriptors 0, 1, 2, 3 */ | |
339 | int rts_thresh; /* RTS threshold */ | |
92b96797 FB |
340 | int frag_thresh; |
341 | int OpMode; | |
342 | int data_rate; | |
343 | int channel_num; | |
344 | int short_retry; | |
345 | int long_retry; | |
346 | int bbp_type; | |
659770d4 | 347 | u32 flags; |
92b96797 FB |
348 | } OPTIONS, *POPTIONS; |
349 | ||
14c5ef57 | 350 | struct vnt_private { |
61462ab3 MP |
351 | /* netdev */ |
352 | struct usb_device *usb; | |
353 | struct net_device *dev; | |
354 | struct net_device_stats stats; | |
92b96797 | 355 | |
61462ab3 | 356 | OPTIONS sOpts; |
92b96797 | 357 | |
81d720d3 | 358 | struct work_struct read_work_item; |
a21fc2f5 | 359 | struct work_struct rx_mng_work_item; |
31d5bbf3 | 360 | |
61462ab3 MP |
361 | u32 rx_buf_sz; |
362 | int multicast_limit; | |
363 | u8 byRxMode; | |
92b96797 | 364 | |
61462ab3 | 365 | spinlock_t lock; |
92b96797 | 366 | |
61462ab3 | 367 | u32 rx_bytes; |
92b96797 | 368 | |
61462ab3 | 369 | u8 byRevId; |
92b96797 | 370 | |
61462ab3 MP |
371 | u32 flags; |
372 | unsigned long Flags; | |
92b96797 | 373 | |
61462ab3 | 374 | SCache sDupRxCache; |
92b96797 | 375 | |
61462ab3 MP |
376 | SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG]; |
377 | u32 cbDFCB; | |
378 | u32 cbFreeDFCB; | |
379 | u32 uCurrentDFCBIdx; | |
92b96797 | 380 | |
61462ab3 MP |
381 | /* USB */ |
382 | struct urb *pControlURB; | |
383 | struct urb *pInterruptURB; | |
384 | struct usb_ctrlrequest sUsbCtlRequest; | |
385 | u32 int_interval; | |
92b96797 | 386 | |
61462ab3 | 387 | /* Variables to track resources for the BULK In Pipe */ |
115cac2e MP |
388 | struct vnt_rcb *pRCBMem; |
389 | struct vnt_rcb *apRCB[CB_MAX_RX_DESC]; | |
61462ab3 | 390 | u32 cbRD; |
115cac2e MP |
391 | struct vnt_rcb *FirstRecvFreeList; |
392 | struct vnt_rcb *LastRecvFreeList; | |
61462ab3 | 393 | u32 NumRecvFreeList; |
115cac2e MP |
394 | struct vnt_rcb *FirstRecvMngList; |
395 | struct vnt_rcb *LastRecvMngList; | |
61462ab3 MP |
396 | u32 NumRecvMngList; |
397 | int bIsRxWorkItemQueued; | |
398 | int bIsRxMngWorkItemQueued; | |
cc856e61 | 399 | unsigned long ulRcvRefCount; /* packets that have not returned back */ |
92b96797 | 400 | |
61462ab3 | 401 | /* Variables to track resources for the BULK Out Pipe */ |
dcdf1d03 | 402 | struct vnt_usb_send_context *apTD[CB_MAX_TX_DESC]; |
61462ab3 | 403 | u32 cbTD; |
51934e7f | 404 | struct vnt_tx_pkt_info pkt_info[16]; |
92b96797 | 405 | |
61462ab3 | 406 | /* Variables to track resources for the Interrupt In Pipe */ |
f764e00d | 407 | struct vnt_interrupt_buffer int_buf; |
92b96797 | 408 | |
61462ab3 MP |
409 | /* default config from file by user setting */ |
410 | DEFAULT_CONFIG config_file; | |
92b96797 | 411 | |
61462ab3 MP |
412 | /* Version control */ |
413 | u16 wFirmwareVersion; | |
414 | u8 byLocalID; | |
415 | u8 byRFType; | |
416 | u8 byBBRxConf; | |
92b96797 | 417 | |
61462ab3 MP |
418 | u8 byZoneType; |
419 | int bZoneRegExist; | |
92b96797 | 420 | |
61462ab3 | 421 | u8 byOriginalZonetype; |
92b96797 | 422 | |
61462ab3 | 423 | int bLinkPass; /* link status: OK or fail */ |
748bf69c MP |
424 | struct vnt_cmd_card_init init_command; |
425 | struct vnt_rsp_card_init init_response; | |
61462ab3 MP |
426 | u8 abyCurrentNetAddr[ETH_ALEN]; |
427 | u8 abyPermanentNetAddr[ETH_ALEN]; | |
92b96797 | 428 | |
61462ab3 | 429 | int bExistSWNetAddr; |
92b96797 | 430 | |
61462ab3 | 431 | /* Maintain statistical debug info. */ |
61462ab3 MP |
432 | unsigned long SendContextsInUse; |
433 | unsigned long RcvBuffersInUse; | |
92b96797 | 434 | |
14c5ef57 | 435 | /* 802.11 management */ |
4f4a89c9 | 436 | struct vnt_manager vnt_mgmt; |
92b96797 | 437 | |
7c65fa2a | 438 | u64 qwCurrTSF; |
61462ab3 MP |
439 | u32 cbBulkInMax; |
440 | int bPSRxBeacon; | |
441 | ||
442 | /* 802.11 MAC specific */ | |
443 | u32 uCurrRSSI; | |
444 | u8 byCurrSQ; | |
445 | ||
446 | /* Antenna Diversity */ | |
447 | int bTxRxAntInv; | |
448 | u32 dwRxAntennaSel; | |
449 | u32 dwTxAntennaSel; | |
450 | u8 byAntennaCount; | |
451 | u8 byRxAntennaMode; | |
452 | u8 byTxAntennaMode; | |
453 | u8 byRadioCtl; | |
454 | u8 bHWRadioOff; | |
455 | ||
456 | /* SQ3 functions for antenna diversity */ | |
457 | struct timer_list TimerSQ3Tmax1; | |
458 | struct timer_list TimerSQ3Tmax2; | |
459 | struct timer_list TimerSQ3Tmax3; | |
460 | ||
461 | int bDiversityRegCtlON; | |
462 | int bDiversityEnable; | |
463 | unsigned long ulDiversityNValue; | |
464 | unsigned long ulDiversityMValue; | |
465 | u8 byTMax; | |
466 | u8 byTMax2; | |
467 | u8 byTMax3; | |
468 | unsigned long ulSQ3TH; | |
469 | ||
470 | unsigned long uDiversityCnt; | |
471 | u8 byAntennaState; | |
472 | unsigned long ulRatio_State0; | |
473 | unsigned long ulRatio_State1; | |
474 | unsigned long ulSQ3_State0; | |
475 | unsigned long ulSQ3_State1; | |
476 | ||
477 | unsigned long aulSQ3Val[MAX_RATE]; | |
478 | unsigned long aulPktNum[MAX_RATE]; | |
cc856e61 AM |
479 | |
480 | /* IFS & Cw */ | |
61462ab3 MP |
481 | u32 uSIFS; /* Current SIFS */ |
482 | u32 uDIFS; /* Current DIFS */ | |
483 | u32 uEIFS; /* Current EIFS */ | |
484 | u32 uSlot; /* Current SlotTime */ | |
485 | u32 uCwMin; /* Current CwMin */ | |
486 | u32 uCwMax; /* CwMax is fixed on 1023 */ | |
487 | ||
488 | /* PHY parameter */ | |
489 | u8 bySIFS; | |
490 | u8 byDIFS; | |
491 | u8 byEIFS; | |
492 | u8 bySlot; | |
493 | u8 byCWMaxMin; | |
494 | ||
495 | /* Rate */ | |
a9052bc9 | 496 | u8 byBBType; /* 0: 11A, 1:11B, 2:11G */ |
bf1c820f | 497 | u8 byPacketType; /* 0:11a 1:11b 2:11gb 3:11ga */ |
61462ab3 MP |
498 | u16 wBasicRate; |
499 | u8 byACKRate; | |
500 | u8 byTopOFDMBasicRate; | |
501 | u8 byTopCCKBasicRate; | |
502 | ||
61462ab3 MP |
503 | u32 dwAotoRateTxOkCnt; |
504 | u32 dwAotoRateTxFailCnt; | |
505 | u32 dwErrorRateThreshold[13]; | |
506 | u32 dwTPTable[MAX_RATE]; | |
507 | u8 abyEEPROM[EEP_MAX_CONTEXT_SIZE]; /*u32 alignment */ | |
508 | ||
509 | u8 byMinChannel; | |
510 | u8 byMaxChannel; | |
511 | u32 uConnectionRate; | |
512 | ||
513 | u8 byPreambleType; | |
514 | u8 byShortPreamble; | |
515 | /* CARD_PHY_TYPE */ | |
516 | u8 eConfigPHYMode; | |
517 | ||
518 | /* For RF Power table */ | |
519 | u8 byCCKPwr; | |
520 | u8 byOFDMPwrG; | |
521 | u8 byOFDMPwrA; | |
522 | u8 byCurPwr; | |
523 | u8 abyCCKPwrTbl[14]; | |
524 | u8 abyOFDMPwrTbl[14]; | |
525 | u8 abyOFDMAPwrTbl[42]; | |
526 | ||
527 | u16 wCurrentRate; | |
f84cdf65 MP |
528 | u16 tx_rate_fb0; |
529 | u16 tx_rate_fb1; | |
530 | ||
61462ab3 MP |
531 | u16 wRTSThreshold; |
532 | u16 wFragmentationThreshold; | |
533 | u8 byShortRetryLimit; | |
534 | u8 byLongRetryLimit; | |
a0ad2776 MP |
535 | |
536 | enum nl80211_iftype op_mode; | |
537 | ||
61462ab3 MP |
538 | int bBSSIDFilter; |
539 | u16 wMaxTransmitMSDULifetime; | |
540 | u8 abyBSSID[ETH_ALEN]; | |
541 | u8 abyDesireBSSID[ETH_ALEN]; | |
542 | ||
61462ab3 MP |
543 | u32 dwMaxReceiveLifetime; /* dot11MaxReceiveLifetime */ |
544 | ||
545 | int bCCK; | |
546 | int bEncryptionEnable; | |
61462ab3 MP |
547 | int bShortSlotTime; |
548 | int bProtectMode; | |
549 | int bNonERPPresent; | |
550 | int bBarkerPreambleMd; | |
551 | ||
552 | u8 byERPFlag; | |
553 | u16 wUseProtectCntDown; | |
554 | ||
555 | int bRadioControlOff; | |
556 | int bRadioOff; | |
557 | ||
558 | /* Power save */ | |
559 | int bEnablePSMode; | |
560 | u16 wListenInterval; | |
561 | int bPWBitOn; | |
562 | WMAC_POWER_MODE ePSMode; | |
563 | unsigned long ulPSModeWaitTx; | |
564 | int bPSModeTxBurst; | |
565 | ||
566 | /* Beacon releated */ | |
567 | u16 wSeqCounter; | |
568 | int bBeaconBufReady; | |
569 | int bBeaconSent; | |
570 | int bFixRate; | |
571 | u8 byCurrentCh; | |
572 | u32 uScanTime; | |
573 | ||
574 | CMD_STATE eCommandState; | |
575 | ||
576 | CMD_CODE eCommand; | |
577 | int bBeaconTx; | |
578 | u8 byScanBBType; | |
579 | ||
580 | int bStopBeacon; | |
581 | int bStopDataPkt; | |
582 | int bStopTx0Pkt; | |
583 | u32 uAutoReConnectTime; | |
584 | u32 uIsroamingTime; | |
585 | ||
586 | /* 802.11 counter */ | |
587 | ||
588 | CMD_ITEM eCmdQueue[CMD_Q_SIZE]; | |
589 | u32 uCmdDequeueIdx; | |
590 | u32 uCmdEnqueueIdx; | |
591 | u32 cbFreeCmdQueue; | |
592 | int bCmdRunning; | |
593 | int bCmdClear; | |
594 | int bNeedRadioOFF; | |
595 | ||
596 | int bEnableRoaming; | |
597 | int bIsRoaming; | |
598 | int bFastRoaming; | |
599 | u8 bSameBSSMaxNum; | |
600 | u8 bSameBSSCurNum; | |
601 | int bRoaming; | |
602 | int b11hEable; | |
603 | unsigned long ulTxPower; | |
604 | ||
605 | /* Encryption */ | |
606 | NDIS_802_11_WEP_STATUS eEncryptionStatus; | |
607 | int bTransmitKey; | |
608 | NDIS_802_11_WEP_STATUS eOldEncryptionStatus; | |
609 | SKeyManagement sKey; | |
610 | u32 dwIVCounter; | |
611 | ||
61462ab3 MP |
612 | RC4Ext SBox; |
613 | u8 abyPRNG[WLAN_WEPMAX_KEYLEN+3]; | |
614 | u8 byKeyIndex; | |
615 | ||
61462ab3 MP |
616 | u32 uKeyLength; |
617 | u8 abyKey[WLAN_WEP232_KEYLEN]; | |
618 | ||
619 | /* for AP mode */ | |
620 | u32 uAssocCount; | |
621 | int bMoreData; | |
622 | ||
623 | /* QoS */ | |
624 | int bGrpAckPolicy; | |
625 | ||
61462ab3 MP |
626 | u8 byAutoFBCtrl; |
627 | ||
628 | int bTxMICFail; | |
629 | int bRxMICFail; | |
630 | ||
61462ab3 MP |
631 | /* For Update BaseBand VGA Gain Offset */ |
632 | int bUpdateBBVGA; | |
633 | u32 uBBVGADiffCount; | |
634 | u8 byBBVGANew; | |
635 | u8 byBBVGACurrent; | |
636 | u8 abyBBVGA[BB_VGA_LEVEL]; | |
637 | signed long ldBmThreshold[BB_VGA_LEVEL]; | |
638 | ||
639 | u8 byBBPreEDRSSI; | |
640 | u8 byBBPreEDIndex; | |
641 | ||
61462ab3 | 642 | int bRadioCmd; |
61462ab3 MP |
643 | |
644 | /* For FOE Tuning */ | |
645 | u8 byFOETuning; | |
646 | ||
647 | /* For Auto Power Tunning */ | |
648 | u8 byAutoPwrTunning; | |
649 | ||
650 | /* BaseBand Loopback Use */ | |
651 | u8 byBBCR4d; | |
652 | u8 byBBCRc9; | |
653 | u8 byBBCR88; | |
654 | u8 byBBCR09; | |
655 | ||
656 | /* command timer */ | |
94488a7e | 657 | struct delayed_work run_command_work; |
bd9a6dba MP |
658 | /* One second callback */ |
659 | struct delayed_work second_callback_work; | |
92b96797 | 660 | |
60cc2747 MP |
661 | u8 tx_data_time_out; |
662 | bool tx_trigger; | |
61462ab3 MP |
663 | int fWPA_Authened; /*is WPA/WPA-PSK or WPA2/WPA2-PSK authen?? */ |
664 | u8 byReAssocCount; | |
665 | u8 byLinkWaitCount; | |
92b96797 | 666 | |
ceb8c5da AM |
667 | struct ethhdr sTxEthHeader; |
668 | struct ethhdr sRxEthHeader; | |
61462ab3 MP |
669 | u8 abyBroadcastAddr[ETH_ALEN]; |
670 | u8 abySNAP_RFC1042[ETH_ALEN]; | |
671 | u8 abySNAP_Bridgetunnel[ETH_ALEN]; | |
92b96797 | 672 | |
61462ab3 MP |
673 | /* Pre-Authentication & PMK cache */ |
674 | SPMKID gsPMKID; | |
675 | SPMKIDCandidateEvent gsPMKIDCandidate; | |
92b96797 | 676 | |
61462ab3 MP |
677 | /* for 802.11h */ |
678 | int b11hEnable; | |
92b96797 | 679 | |
61462ab3 MP |
680 | int bChannelSwitch; |
681 | u8 byNewChannel; | |
682 | u8 byChannelSwitchCount; | |
92b96797 | 683 | |
61462ab3 MP |
684 | /* WPA supplicant daemon */ |
685 | int bWPADEVUp; | |
686 | int bwextstep0; | |
687 | int bwextstep1; | |
688 | int bwextstep2; | |
689 | int bwextstep3; | |
690 | int bWPASuppWextEnabled; | |
92b96797 | 691 | |
61462ab3 MP |
692 | /* user space daemon: hostapd, is used for HOSTAP */ |
693 | int bEnableHostapd; | |
694 | int bEnable8021x; | |
695 | int bEnableHostWEP; | |
696 | struct net_device *apdev; | |
697 | int (*tx_80211)(struct sk_buff *skb, struct net_device *dev); | |
92b96797 | 698 | |
61462ab3 | 699 | u32 uChannel; |
92b96797 | 700 | |
61462ab3 | 701 | struct iw_statistics wstats; /* wireless stats */ |
92b96797 | 702 | |
61462ab3 | 703 | int bCommit; |
92b96797 | 704 | |
14c5ef57 | 705 | }; |
92b96797 | 706 | |
92b96797 FB |
707 | #define EnqueueRCB(_Head, _Tail, _RCB) \ |
708 | { \ | |
709 | if (!_Head) { \ | |
710 | _Head = _RCB; \ | |
711 | } \ | |
712 | else { \ | |
713 | _Tail->Next = _RCB; \ | |
714 | } \ | |
715 | _RCB->Next = NULL; \ | |
716 | _Tail = _RCB; \ | |
717 | } | |
718 | ||
719 | #define DequeueRCB(Head, Tail) \ | |
720 | { \ | |
115cac2e | 721 | struct vnt_rcb *RCB = Head; \ |
92b96797 FB |
722 | if (!RCB->Next) { \ |
723 | Tail = NULL; \ | |
724 | } \ | |
725 | Head = RCB->Next; \ | |
726 | } | |
727 | ||
92b96797 FB |
728 | #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \ |
729 | if ((uVar) >= ((uModulo) - 1)) \ | |
730 | (uVar) = 0; \ | |
731 | else \ | |
732 | (uVar)++; \ | |
733 | } | |
734 | ||
92b96797 FB |
735 | #define fMP_RESET_IN_PROGRESS 0x00000001 |
736 | #define fMP_DISCONNECTED 0x00000002 | |
737 | #define fMP_HALT_IN_PROGRESS 0x00000004 | |
738 | #define fMP_SURPRISE_REMOVED 0x00000008 | |
739 | #define fMP_RECV_LOOKASIDE 0x00000010 | |
740 | #define fMP_INIT_IN_PROGRESS 0x00000020 | |
741 | #define fMP_SEND_SIDE_RESOURCE_ALLOCATED 0x00000040 | |
742 | #define fMP_RECV_SIDE_RESOURCE_ALLOCATED 0x00000080 | |
743 | #define fMP_POST_READS 0x00000100 | |
744 | #define fMP_POST_WRITES 0x00000200 | |
745 | #define fMP_CONTROL_READS 0x00000400 | |
746 | #define fMP_CONTROL_WRITES 0x00000800 | |
747 | ||
92b96797 FB |
748 | #define MP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F)) |
749 | #define MP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F)) | |
92b96797 FB |
750 | #define MP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F)) |
751 | ||
752 | #define MP_IS_READY(_M) (((_M)->Flags & \ | |
753 | (fMP_DISCONNECTED | fMP_RESET_IN_PROGRESS | fMP_HALT_IN_PROGRESS | fMP_INIT_IN_PROGRESS | fMP_SURPRISE_REMOVED)) == 0) | |
754 | ||
dd0a774f | 755 | int device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF); |
edd20e96 | 756 | void vnt_configure_filter(struct vnt_private *); |
92b96797 FB |
757 | |
758 | #endif |