1 /*******************************************************************************
3 * Wireless device driver for Linux (wlags49).
5 * Copyright (c) 1998-2003 Agere Systems Inc.
9 * Initially developed by TriplePoint, Inc.
10 * http://www.triplepoint.com
12 *------------------------------------------------------------------------------
14 * Header for defintions and macros internal to the drvier.
16 *------------------------------------------------------------------------------
20 * This software is provided subject to the following terms and conditions,
21 * which you should read carefully before using the software. Using this
22 * software indicates your acceptance of these terms and conditions. If you do
23 * not agree with these terms and conditions, do not use the software.
25 * Copyright © 2003 Agere Systems Inc.
26 * All rights reserved.
28 * Redistribution and use in source or binary forms, with or without
29 * modifications, are permitted provided that the following conditions are met:
31 * . Redistributions of source code must retain the above copyright notice, this
32 * list of conditions and the following Disclaimer as comments in the code as
33 * well as in the documentation and/or other materials provided with the
36 * . Redistributions in binary form must reproduce the above copyright notice,
37 * this list of conditions and the following Disclaimer in the documentation
38 * and/or other materials provided with the distribution.
40 * . Neither the name of Agere Systems Inc. nor the names of the contributors
41 * may be used to endorse or promote products derived from this software
42 * without specific prior written permission.
46 * THIS SOFTWARE IS PROVIDED
\93AS IS
\94 AND ANY EXPRESS OR IMPLIED WARRANTIES,
47 * INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED WARRANTIES OF
48 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. ANY
49 * USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE IS SOLELY AT THE USERS OWN
50 * RISK. IN NO EVENT SHALL AGERE SYSTEMS INC. OR CONTRIBUTORS BE LIABLE FOR ANY
51 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
52 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
53 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
54 * ON ANY THEORY OF LIABILITY, INCLUDING, BUT NOT LIMITED TO, CONTRACT, STRICT
55 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
56 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
59 ******************************************************************************/
61 #ifndef __WAVELAN2_H__
62 #define __WAVELAN2_H__
67 /*******************************************************************************
69 ******************************************************************************/
70 #include <linux/version.h>
72 #include <pcmcia/cs_types.h>
73 #include <pcmcia/cs.h>
74 #include <pcmcia/cistpl.h>
75 #include <pcmcia/cisreg.h>
76 #include <pcmcia/ciscode.h>
77 #include <pcmcia/ds.h>
80 #ifdef HAS_WIRELESS_EXTENSIONS
81 #include <linux/wireless.h>
83 #include <net/iw_handler.h>
84 #endif // WIRELESS_EXT > 13
86 #define RETURN_CURRENT_NETWORKNAME
88 #endif // HAS_WIRELESS_EXTENSIONS/
90 #include <linux/list.h>
92 #include <linux/interrupt.h>
97 /*******************************************************************************
98 * constant definitions
99 ******************************************************************************/
108 #define MAX_KEY_LEN (2 + (13 * 2)) // 0x plus 13 hex digit pairs
110 #define MAX_ENC_LEN 104
112 #define MAX_SCAN_TIME_SEC 8
115 #define CFG_MB_INFO 0x0820 //Mail Box Info Block
117 #define NUM_WDS_PORTS 6
119 #define WVLAN_MAX_LOOKAHEAD (HCF_MAX_MSG+46) /* as per s0005MIC_4.doc */
122 /* Min/Max/Default Parameter Values */
123 #if 0 //;? (HCF_TYPE) & HCF_TYPE_AP
124 //;? why this difference depending on compile option, seems to me it should depend on runtime if anything
125 #define PARM_DEFAULT_SSID "LinuxAP"
127 #define PARM_DEFAULT_SSID "ANY"
128 #endif // HCF_TYPE_AP
130 #define PARM_MIN_NAME_LEN 1
131 #define PARM_MAX_NAME_LEN 32
134 /* The following definitions pertain to module and profile parameters */
135 // #define PARM_AP_MODE APMode
136 // #define PARM_NAME_AP_MODE TEXT("APMode")
137 // #define PARM_DEFAULT_AP_MODE FALSE
139 #define PARM_AUTHENTICATION Authentication
140 #define PARM_NAME_AUTHENTICATION TEXT("Authentication")
141 #define PARM_MIN_AUTHENTICATION 1
142 #define PARM_MAX_AUTHENTICATION 2
143 #define PARM_DEFAULT_AUTHENTICATION 1
145 #define PARM_AUTH_KEY_MGMT_SUITE AuthKeyMgmtSuite
146 #define PARM_NAME_AUTH_KEY_MGMT_SUITE TEXT("AuthKeyMgmtSuite")
147 #define PARM_MIN_AUTH_KEY_MGMT_SUITE 0
148 #define PARM_MAX_AUTH_KEY_MGMT_SUITE 4
149 #define PARM_DEFAULT_AUTH_KEY_MGMT_SUITE 0
151 #define PARM_BRSC_2GHZ BRSC2GHz
152 #define PARM_NAME_BRSC_2GHZ TEXT("BRSC2GHz")
153 #define PARM_MIN_BRSC 0x0000
154 #define PARM_MAX_BRSC 0x0FFF
155 #define PARM_DEFAULT_BRSC_2GHZ 0x000F
157 #define PARM_BRSC_5GHZ BRSC5GHz
158 #define PARM_NAME_BRSC_5GHZ TEXT("BRSC5GHz")
159 #define PARM_DEFAULT_BRSC_5GHZ 0x0150
161 #define PARM_COEXISTENCE Coexistence
162 #define PARM_NAME_COEXISTENCE TEXT("Coexistence")
163 #define PARM_MIN_COEXISTENCE 0x0000
164 #define PARM_MAX_COEXISTENCE 0x0007
165 #define PARM_DEFAULT_COEXISTENCE 0x0000
167 #define PARM_CONFIGURED Configured
168 #define PARM_NAME_CONFIGURED TEXT("Configured")
170 #define PARM_CONNECTION_CONTROL ConnectionControl
171 #define PARM_NAME_CONNECTION_CONTROL TEXT("ConnectionControl")
172 #define PARM_MIN_CONNECTION_CONTROL 0
173 #define PARM_MAX_CONNECTION_CONTROL 3
174 #define PARM_DEFAULT_CONNECTION_CONTROL 2
176 #define PARM_CREATE_IBSS CreateIBSS
177 #define PARM_NAME_CREATE_IBSS TEXT("CreateIBSS")
178 #define PARM_DEFAULT_CREATE_IBSS FALSE
179 #define PARM_DEFAULT_CREATE_IBSS_STR "N"
181 #define PARM_DEBUG_FLAG DebugFlag
182 #define PARM_NAME_DEBUG_FLAG TEXT("DebugFlag")
183 #define PARM_MIN_DEBUG_FLAG 0
184 #define PARM_MAX_DEBUG_FLAG 0xFFFF
185 #define PARM_DEFAULT_DEBUG_FLAG 0xFFFF
187 #define PARM_DESIRED_SSID DesiredSSID
188 #define PARM_NAME_DESIRED_SSID TEXT("DesiredSSID")
190 #define PARM_DOWNLOAD_FIRMWARE DownloadFirmware
191 #define PARM_NAME_DOWNLOAD_FIRMWARE TEXT("DownloadFirmware")
193 #define PARM_DRIVER_ENABLE DriverEnable
194 #define PARM_NAME_DRIVER_ENABLE TEXT("DriverEnable")
195 #define PARM_DEFAULT_DRIVER_ENABLE TRUE
197 #define PARM_ENABLE_ENCRYPTION EnableEncryption
198 #define PARM_NAME_ENABLE_ENCRYPTION TEXT("EnableEncryption")
199 #define PARM_MIN_ENABLE_ENCRYPTION 0
200 #define PARM_MAX_ENABLE_ENCRYPTION 7
201 #define PARM_DEFAULT_ENABLE_ENCRYPTION 0
203 #define PARM_ENCRYPTION Encryption
204 #define PARM_NAME_ENCRYPTION TEXT("Encryption")
206 #define PARM_EXCLUDE_UNENCRYPTED ExcludeUnencrypted
207 #define PARM_NAME_EXCLUDE_UNENCRYPTED TEXT("ExcludeUnencrypted")
208 #define PARM_DEFAULT_EXCLUDE_UNENCRYPTED TRUE
209 #define PARM_DEFAULT_EXCLUDE_UNENCRYPTED_STR "N"
211 #define PARM_INTRA_BSS_RELAY IntraBSSRelay
212 #define PARM_NAME_INTRA_BSS_RELAY TEXT("IntraBSSRelay")
213 #define PARM_DEFAULT_INTRA_BSS_RELAY TRUE
214 #define PARM_DEFAULT_INTRA_BSS_RELAY_STR "Y"
216 #define PARM_KEY1 Key1
217 #define PARM_NAME_KEY1 TEXT("Key1")
218 #define PARM_KEY2 Key2
219 #define PARM_NAME_KEY2 TEXT("Key2")
220 #define PARM_KEY3 Key3
221 #define PARM_NAME_KEY3 TEXT("Key3")
222 #define PARM_KEY4 Key4
223 #define PARM_NAME_KEY4 TEXT("Key4")
225 //;? #define PARM_KEY_FORMAT AsciiHex
226 //;? #define PARM_NAME_KEY_FORMAT TEXT("AsciiHex")
228 #define PARM_LOAD_BALANCING LoadBalancing
229 #define PARM_NAME_LOAD_BALANCING TEXT("LoadBalancing")
230 #define PARM_DEFAULT_LOAD_BALANCING TRUE
231 #define PARM_DEFAULT_LOAD_BALANCING_STR "Y"
233 #define PARM_MAX_DATA_LENGTH MaxDataLength
234 #define PARM_NAME_MAX_DATA_LENGTH TEXT("MaxDataLength")
236 #define PARM_MAX_SLEEP MaxSleepDuration
237 #define PARM_NAME_MAX_SLEEP TEXT("MaxSleepDuration")
238 #define PARM_MIN_MAX_PM_SLEEP 1 //;?names nearly right?
239 #define PARM_MAX_MAX_PM_SLEEP 65535
240 #define PARM_DEFAULT_MAX_PM_SLEEP 100
242 #define PARM_MEDIUM_DISTRIBUTION MediumDistribution
243 #define PARM_NAME_MEDIUM_DISTRIBUTION TEXT("MediumDistribution")
244 #define PARM_DEFAULT_MEDIUM_DISTRIBUTION TRUE
245 #define PARM_DEFAULT_MEDIUM_DISTRIBUTION_STR "Y"
247 #define PARM_MICROWAVE_ROBUSTNESS MicroWaveRobustness
248 #define PARM_NAME_MICROWAVE_ROBUSTNESS TEXT("MicroWaveRobustness")
249 #define PARM_DEFAULT_MICROWAVE_ROBUSTNESS FALSE
250 #define PARM_DEFAULT_MICROWAVE_ROBUSTNESS_STR "N"
252 #define PARM_MULTICAST_PM_BUFFERING MulticastPMBuffering
253 #define PARM_NAME_MULTICAST_PM_BUFFERING TEXT("MulticastPMBuffering")
254 #define PARM_DEFAULT_MULTICAST_PM_BUFFERING TRUE
255 #define PARM_DEFAULT_MULTICAST_PM_BUFFERING_STR "Y"
257 #define PARM_MULTICAST_RATE MulticastRate
258 #define PARM_NAME_MULTICAST_RATE TEXT("MulticastRate")
260 #define PARM_MIN_MULTICAST_RATE 0x0001
261 #define PARM_MAX_MULTICAST_RATE 0x0fff
262 #define PARM_DEFAULT_MULTICAST_RATE_2GHZ 0x0004
263 #define PARM_DEFAULT_MULTICAST_RATE_5GHZ 0x0010
265 #define PARM_MIN_MULTICAST_RATE 0x0001
266 #define PARM_MAX_MULTICAST_RATE 0x0004
267 #define PARM_DEFAULT_MULTICAST_RATE_2GHZ 0x0002
268 #define PARM_DEFAULT_MULTICAST_RATE_5GHZ 0x0000
271 #define PARM_MULTICAST_RX MulticastReceive
272 #define PARM_NAME_MULTICAST_RX TEXT("MulticastReceive")
273 #define PARM_DEFAULT_MULTICAST_RX TRUE
274 #define PARM_DEFAULT_MULTICAST_RX_STR "Y"
276 #define PARM_NETWORK_ADDR NetworkAddress
277 #define PARM_NAME_NETWORK_ADDR TEXT("NetworkAddress")
278 #define PARM_DEFAULT_NETWORK_ADDR { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
280 #define PARM_NETWORK_TYPE NetworkType
281 #define PARM_NAME_NETWORK_TYPE TEXT("NetworkType")
282 #define PARM_DEFAULT_NETWORK_TYPE 0
284 #define PARM_OWN_ATIM_WINDOW OwnATIMWindow
285 #define PARM_NAME_OWN_ATIM_WINDOW TEXT("OwnATIMWindow")
286 #define PARM_MIN_OWN_ATIM_WINDOW 0
287 #define PARM_MAX_OWN_ATIM_WINDOW 100
288 #define PARM_DEFAULT_OWN_ATIM_WINDOW 0
290 #define PARM_OWN_BEACON_INTERVAL OwnBeaconInterval
291 #define PARM_NAME_OWN_BEACON_INTERVAL TEXT("OwnBeaconInterval")
292 #define PARM_MIN_OWN_BEACON_INTERVAL 20
293 #define PARM_MAX_OWN_BEACON_INTERVAL 200
294 #define PARM_DEFAULT_OWN_BEACON_INTERVAL 100
296 #define PARM_OWN_CHANNEL OwnChannel
297 #define PARM_NAME_OWN_CHANNEL TEXT("OwnChannel")
298 #define PARM_MIN_OWN_CHANNEL 1
299 #define PARM_MAX_OWN_CHANNEL 161
300 #define PARM_DEFAULT_OWN_CHANNEL 10
302 #define PARM_OWN_DTIM_PERIOD OwnDTIMPeriod
303 #define PARM_NAME_OWN_DTIM_PERIOD TEXT("OwnDTIMPeriod")
304 #define PARM_MIN_OWN_DTIM_PERIOD 1
305 #define PARM_MAX_OWN_DTIM_PERIOD 65535
306 #define PARM_DEFAULT_OWN_DTIM_PERIOD 1
308 #define PARM_OWN_NAME OwnName
309 #define PARM_NAME_OWN_NAME TEXT("OwnName")
310 #define PARM_DEFAULT_OWN_NAME "Linux"
312 #define PARM_OWN_SSID OwnSSID
313 #define PARM_NAME_OWN_SSID TEXT("OwnSSID")
315 #define PARM_PM_ENABLED PMEnabled
316 #define PARM_NAME_PM_ENABLED TEXT("PMEnabled")
317 #define PARM_MAX_PM_ENABLED 3
319 #define PARM_PMEPS PMEPS
320 #define PARM_NAME_PMEPS TEXT("PMEPS")
322 #define PARM_PM_HOLDOVER_DURATION PMHoldoverDuration
323 #define PARM_NAME_PM_HOLDOVER_DURATION TEXT("PMHoldoverDuration")
324 #define PARM_MIN_PM_HOLDOVER_DURATION 1
325 #define PARM_MAX_PM_HOLDOVER_DURATION 1000
326 #define PARM_DEFAULT_PM_HOLDOVER_DURATION 100
328 #define PARM_PM_MODE PowerMode
329 #define PARM_NAME_PM_MODE TEXT("PowerMode")
331 #define PARM_PORT_TYPE PortType
332 #define PARM_NAME_PORT_TYPE TEXT("PortType")
333 #define PARM_MIN_PORT_TYPE 1
334 #define PARM_MAX_PORT_TYPE 3
335 #define PARM_DEFAULT_PORT_TYPE 1
337 #define PARM_PROMISCUOUS_MODE PromiscuousMode
338 #define PARM_NAME_PROMISCUOUS_MODE TEXT("PromiscuousMode")
339 #define PARM_DEFAULT_PROMISCUOUS_MODE FALSE
340 #define PARM_DEFAULT_PROMISCUOUS_MODE_STR "N"
342 #define PARM_REJECT_ANY RejectANY
343 #define PARM_NAME_REJECT_ANY TEXT("RejectANY")
344 #define PARM_DEFAULT_REJECT_ANY FALSE
345 #define PARM_DEFAULT_REJECT_ANY_STR "N"
347 #define PARM_RTS_THRESHOLD RTSThreshold
348 #define PARM_NAME_RTS_THRESHOLD TEXT("RTSThreshold")
349 #define PARM_MIN_RTS_THRESHOLD 0
350 #define PARM_MAX_RTS_THRESHOLD 2347
351 #define PARM_DEFAULT_RTS_THRESHOLD 2347
353 #define PARM_RTS_THRESHOLD1 RTSThreshold1
354 #define PARM_NAME_RTS_THRESHOLD1 TEXT("RTSThreshold1")
355 #define PARM_RTS_THRESHOLD2 RTSThreshold2
356 #define PARM_NAME_RTS_THRESHOLD2 TEXT("RTSThreshold2")
357 #define PARM_RTS_THRESHOLD3 RTSThreshold3
358 #define PARM_NAME_RTS_THRESHOLD3 TEXT("RTSThreshold3")
359 #define PARM_RTS_THRESHOLD4 RTSThreshold4
360 #define PARM_NAME_RTS_THRESHOLD4 TEXT("RTSThreshold4")
361 #define PARM_RTS_THRESHOLD5 RTSThreshold5
362 #define PARM_NAME_RTS_THRESHOLD5 TEXT("RTSThreshold5")
363 #define PARM_RTS_THRESHOLD6 RTSThreshold6
364 #define PARM_NAME_RTS_THRESHOLD6 TEXT("RTSThreshold6")
366 #define PARM_SRSC_2GHZ SRSC2GHz
367 #define PARM_NAME_SRSC_2GHZ TEXT("SRSC2GHz")
368 #define PARM_MIN_SRSC 0x0000
369 #define PARM_MAX_SRSC 0x0FFF
370 #define PARM_DEFAULT_SRSC_2GHZ 0x0FFF
372 #define PARM_SRSC_5GHZ SRSC5GHz
373 #define PARM_NAME_SRSC_5GHZ TEXT("SRSC5GHz")
374 #define PARM_DEFAULT_SRSC_5GHZ 0x0FF0
376 #define PARM_SYSTEM_SCALE SystemScale
377 #define PARM_NAME_SYSTEM_SCALE TEXT("SystemScale")
378 #define PARM_MIN_SYSTEM_SCALE 1
379 #define PARM_MAX_SYSTEM_SCALE 5
380 #define PARM_DEFAULT_SYSTEM_SCALE 1
382 #define PARM_TX_KEY TxKey
383 #define PARM_NAME_TX_KEY TEXT("TxKey")
384 #define PARM_MIN_TX_KEY 1
385 #define PARM_MAX_TX_KEY 4
386 #define PARM_DEFAULT_TX_KEY 1
388 #define PARM_TX_POW_LEVEL TxPowLevel
389 #define PARM_NAME_TX_POW_LEVEL TEXT("TxPowLevel")
390 #define PARM_MIN_TX_POW_LEVEL 1 // 20 dBm
391 #define PARM_MAX_TX_POW_LEVEL 6 // 8 dBm
392 #define PARM_DEFAULT_TX_POW_LEVEL 3 // 15 dBm
394 #define PARM_TX_RATE TxRateControl
395 #define PARM_NAME_TX_RATE TEXT("TxRateControl")
396 #define PARM_MIN_TX_RATE 0x0001
398 #define PARM_MAX_TX_RATE 0x0FFF
399 #define PARM_DEFAULT_TX_RATE_2GHZ 0x0FFF
400 #define PARM_DEFAULT_TX_RATE_5GHZ 0x0FF0
402 #define PARM_MAX_TX_RATE 0x0007
403 #define PARM_DEFAULT_TX_RATE_2GHZ 0x0003
404 #define PARM_DEFAULT_TX_RATE_5GHZ 0x0000
407 #define PARM_TX_RATE1 TxRateControl1
408 #define PARM_NAME_TX_RATE1 TEXT("TxRateControl1")
409 #define PARM_TX_RATE2 TxRateControl2
410 #define PARM_NAME_TX_RATE2 TEXT("TxRateControl2")
411 #define PARM_TX_RATE3 TxRateControl3
412 #define PARM_NAME_TX_RATE3 TEXT("TxRateControl3")
413 #define PARM_TX_RATE4 TxRateControl4
414 #define PARM_NAME_TX_RATE4 TEXT("TxRateControl4")
415 #define PARM_TX_RATE5 TxRateControl5
416 #define PARM_NAME_TX_RATE5 TEXT("TxRateControl5")
417 #define PARM_TX_RATE6 TxRateControl6
418 #define PARM_NAME_TX_RATE6 TEXT("TxRateControl6")
420 #define PARM_VENDORDESCRIPTION VendorDescription
421 #define PARM_NAME_VENDORDESCRIPTION TEXT("VendorDescription")
423 #define PARM_WDS_ADDRESS WDSAddress
424 #define PARM_NAME_WDS_ADDRESS TEXT("WDSAddress")
426 #define PARM_WDS_ADDRESS1 WDSAddress1
427 #define PARM_NAME_WDS_ADDRESS1 TEXT("WDSAddress1")
428 #define PARM_WDS_ADDRESS2 WDSAddress2
429 #define PARM_NAME_WDS_ADDRESS2 TEXT("WDSAddress2")
430 #define PARM_WDS_ADDRESS3 WDSAddress3
431 #define PARM_NAME_WDS_ADDRESS3 TEXT("WDSAddress3")
432 #define PARM_WDS_ADDRESS4 WDSAddress4
433 #define PARM_NAME_WDS_ADDRESS4 TEXT("WDSAddress4")
434 #define PARM_WDS_ADDRESS5 WDSAddress5
435 #define PARM_NAME_WDS_ADDRESS5 TEXT("WDSAddress5")
436 #define PARM_WDS_ADDRESS6 WDSAddress6
437 #define PARM_NAME_WDS_ADDRESS6 TEXT("WDSAddress6")
440 #define PARM_LONG_RETRY_LIMIT LongRetryLimit
441 #define PARM_NAME_LONG_RETRY_LIMIT TEXT("LongRetryLimit")
442 #define PARM_MIN_LONG_RETRY_LIMIT 1
443 #define PARM_MAX_LONG_RETRY_LIMIT 15
444 #define PARM_DEFAULT_LONG_RETRY_LIMIT 3
447 #define PARM_PROBE_DATA_RATES ProbeDataRates
448 #define PARM_NAME_PROBE_DATA_RATES TEXT("ProbeDataRates")
449 #define PARM_MIN_PROBE_DATA_RATES 0x0000
450 #define PARM_MAX_PROBE_DATA_RATES 0x0FFF
451 #define PARM_DEFAULT_PROBE_DATA_RATES_2GHZ 0x0002
452 #define PARM_DEFAULT_PROBE_DATA_RATES_5GHZ 0x0010
454 #define PARM_SHORT_RETRY_LIMIT ShortRetryLimit
455 #define PARM_NAME_SHORT_RETRY_LIMIT TEXT("ShortRetryLimit")
456 #define PARM_MIN_SHORT_RETRY_LIMIT 1
457 #define PARM_MAX_SHORT_RETRY_LIMIT 15
458 #define PARM_DEFAULT_SHORT_RETRY_LIMIT 7
463 /*******************************************************************************
465 ******************************************************************************/
466 /* The following constants are used to track state the device */
467 #define WL_FRIMWARE_PRESENT 1 // Download if needed
468 #define WL_FRIMWARE_NOT_PRESENT 0 // Skip over download, assume its already there
469 #define WL_HANDLING_INT 1 // Actually call the HCF to switch interrupts on/off
470 #define WL_NOT_HANDLING_INT 0 // Not yet handling interrupts, do not switch on/off
472 /*******************************************************************************
474 ******************************************************************************/
475 /* The following macro ensures that no symbols are exported, minimizing the
476 chance of a symbol collision in the kernel */
477 // EXPORT_NO_SYMBOLS;
479 #define NELEM(arr) (sizeof(arr) / sizeof(arr[0]))
481 #define WVLAN_VALID_MAC_ADDRESS( x ) \
482 ((x[0]!=0xFF) && (x[1]!=0xFF) && (x[2]!=0xFF) && (x[3]!=0xFF) && (x[4]!=0xFF) && (x[5]!=0xFF))
487 /*******************************************************************************
489 ******************************************************************************/
501 typedef struct _ScanResult
507 SCAN_RS_STRCT APTable [MAX_NAPS];
512 typedef struct _LINK_STATUS_STRCT
516 hcf_16 linkStatus; /* 1..5 */
521 typedef struct _ASSOC_STATUS_STRCT
525 hcf_16 assocStatus; /* 1..3 */
526 hcf_8 staAddr[ETH_ALEN];
527 hcf_8 oldApAddr[ETH_ALEN];
532 typedef struct _SECURITY_STATUS_STRCT
536 hcf_16 securityStatus; /* 1..3 */
537 hcf_8 staAddr[ETH_ALEN];
540 SECURITY_STATUS_STRCT;
542 #define WVLAN_WMP_PDU_TYPE_LT_REQ 0x00
543 #define WVLAN_WMP_PDU_TYPE_LT_RSP 0x01
544 #define WVLAN_WMP_PDU_TYPE_APL_REQ 0x02
545 #define WVLAN_WMP_PDU_TYPE_APL_RSP 0x03
547 typedef struct wvlan_eth_hdr
549 unsigned char dst[ETH_ALEN]; /* Destination address. */
550 unsigned char src[ETH_ALEN]; /* Source address. */
551 unsigned short len; /* Length of the PDU. */
553 WVLAN_ETH_HDR, *PWVLAN_ETH_HDR;
555 typedef struct wvlan_llc_snap
557 unsigned char dsap; /* DSAP (0xAA) */
558 unsigned char ssap; /* SSAP (0xAA) */
559 unsigned char ctrl; /* Control (0x03) */
560 unsigned char oui[3]; /* Organization Unique ID (00-60-1d). */
561 unsigned char specid[2]; /* Specific ID code (00-01). */
563 WVLAN_LLC_SNAP, *PWVLAN_LLC_SNAP;
566 typedef struct wvlan_lt_hdr
568 unsigned char version; /* Version (0x00) */
569 unsigned char type; /* PDU type: 0-req/1-resp. */
570 unsigned short id; /* Identifier to associate resp to req. */
572 WVLAN_LT_HDR, *PWVLAN_LT_HDR;
575 typedef struct wvlan_wmp_hdr
577 unsigned char version; /* Version */
578 unsigned char type; /* PDU type */
580 WVLAN_WMP_HDR, *PWVLAN_WMP_HDR;
583 #define FILLER_SIZE 1554
584 #define TEST_PATTERN_SIZE 54
587 typedef struct wvlan_lt_req
589 unsigned char Filler[TEST_PATTERN_SIZE]; /* minimal length of 54 bytes */
591 WVLAN_LT_REQ, *PWVLAN_LT_REQ;
594 typedef struct wvlan_lt_rsp
598 unsigned char signal;
600 unsigned char rxFlow;
601 unsigned char dataRate;
602 unsigned short protocol;
604 unsigned char station;
605 unsigned char dataRateCap;
606 unsigned char powerMgmt[4];
607 unsigned char robustness[4];
608 unsigned char scaling;
609 unsigned char reserved[5];
611 WVLAN_LT_RSP, *PWVLAN_LT_RSP;
614 typedef struct wvlan_rx_wmp_hdr
616 unsigned short status;
617 unsigned short reserved1[2];
618 unsigned char silence;
619 unsigned char signal;
621 unsigned char rxFlow;
622 unsigned short reserved2[2];
623 unsigned short frameControl;
624 unsigned short duration;
625 unsigned short address1[3];
626 unsigned short address2[3];
627 unsigned short address3[3];
628 unsigned short sequenceControl;
629 unsigned short address4[3];
630 #ifndef HERMES25 //;?just to be on the safe side of inherited but not comprehended code #ifdef HERMES2
631 unsigned short seems_to_be_unused_reserved3[5]; //;?
632 unsigned short seems_to_be_unused_reserved4; //;?
634 unsigned short HeaderDataLen;
636 WVLAN_RX_WMP_HDR, *PWVLAN_RX_WMP_HDR;
639 typedef struct wvlan_linktest_req_pdu
641 WVLAN_ETH_HDR ethHdr;
642 WVLAN_LLC_SNAP llcSnap;
646 WVLAN_LINKTEST_REQ_PDU, *PWVLAN_LINKTEST_REQ_PDU;
649 typedef struct wvlan_linktest_rsp_pdu
651 WVLAN_RX_WMP_HDR wmpRxHdr;
652 WVLAN_ETH_HDR ethHdr;
653 WVLAN_LLC_SNAP llcSnap;
657 WVLAN_LINKTEST_RSP_PDU, *PWVLAN_LINKTEST_RSP_PDU;
660 typedef struct _LINKTEST_RSP_STRCT
664 WVLAN_LINKTEST_RSP_PDU ltRsp;
669 typedef struct wvlan_wmp_rsp_pdu
671 WVLAN_RX_WMP_HDR wmpRxHdr;
672 WVLAN_ETH_HDR ethHdr;
673 WVLAN_LLC_SNAP llcSnap;
674 WVLAN_WMP_HDR wmpHdr;
676 WVLAN_WMP_RSP_PDU, *PWVLAN_WMP_RSP_PDU;
679 typedef struct _WMP_RSP_STRCT
683 WVLAN_WMP_RSP_PDU wmpRsp;
688 typedef struct _PROBE_RESP
690 // first part: 802.11
696 hcf_8 signal; // Moved signal here as signal/noise values were flipped
706 hcf_8 BSSID[6]; //! this is correct, right ?
715 // the information in the next 3 fields (DA/SA/LenType) is actually not filled in.
727 hcf_16 beaconInterval;
729 hcf_8 rawData[200]; //! <<< think about this number !
732 PROBE_RESP, *PPROBE_RESP;
735 typedef struct _ProbeResult
739 PROBE_RESP ProbeTable[MAX_NAPS];
743 /* Definitions used to parse capabilities out of the probe responses */
744 #define CAPABILITY_ESS 0x0001
745 #define CAPABILITY_IBSS 0x0002
746 #define CAPABILITY_PRIVACY 0x0010
748 /* Definitions used to parse the Information Elements out of probe responses */
749 #define DS_INFO_ELEM 0x03
750 #define GENERIC_INFO_ELEM 0xdd
751 #define WPA_MAX_IE_LEN 40
752 #define WPA_SELECTOR_LEN 4
753 #define WPA_OUI_TYPE { 0x00, 0x50, 0xf2, 1 }
754 #define WPA_VERSION 1
755 #define WPA_AUTH_KEY_MGMT_UNSPEC_802_1X { 0x00, 0x50, 0xf2, 1 }
756 #define WPA_AUTH_KEY_MGMT_PSK_OVER_802_1X { 0x00, 0x50, 0xf2, 2 }
757 #define WPA_CIPHER_SUITE_NONE { 0x00, 0x50, 0xf2, 0 }
758 #define WPA_CIPHER_SUITE_WEP40 { 0x00, 0x50, 0xf2, 1 }
759 #define WPA_CIPHER_SUITE_TKIP { 0x00, 0x50, 0xf2, 2 }
760 #define WPA_CIPHER_SUITE_WRAP { 0x00, 0x50, 0xf2, 3 }
761 #define WPA_CIPHER_SUITE_CCMP { 0x00, 0x50, 0xf2, 4 }
762 #define WPA_CIPHER_SUITE_WEP104 { 0x00, 0x50, 0xf2, 5 }
764 typedef enum wvlan_drv_mode
766 WVLAN_DRV_MODE_NO_DOWNLOAD, /* this is the same as STA for Hermes 1 */
767 /* it is also only applicable for Hermes 1 */
772 WVLAN_DRV_MODE, *PWVLAN_DRV_MODE;
775 typedef enum wvlan_port_state
777 WVLAN_PORT_STATE_ENABLED,
778 WVLAN_PORT_STATE_DISABLED,
779 WVLAN_PORT_STATE_CONNECTED
781 WVLAN_PORT_STATE, *PWVLAN_PORT_STATE;
784 typedef enum wvlan_connect_state
786 WVLAN_CONNECT_STATE_CONNECTED,
787 WVLAN_CONNECT_STATE_DISCONNECTED
789 WVLAN_CONNECT_STATE, *PWVLAN_CONNECT_STATE;
792 typedef enum wvlan_pm_state
794 WVLAN_PM_STATE_DISABLED,
795 WVLAN_PM_STATE_ENHANCED,
796 WVLAN_PM_STATE_STANDARD
798 WVLAN_PM_STATE, *PWVLAN_PM_STATE;
801 typedef struct wvlan_frame
803 struct sk_buff *skb; /* sk_buff for frame. */
804 hcf_16 port; /* MAC port for the frame. */
805 hcf_16 len; /* Length of the frame. */
807 WVLAN_FRAME, *PWVLAN_FRAME;
810 typedef struct wvlan_lframe
812 struct list_head node; /* Node in the list */
813 WVLAN_FRAME frame; /* Frame. */
815 WVLAN_LFRAME, *PWVLAN_LFRAME;
819 #define DEFAULT_NUM_TX_FRAMES 48
820 #define TX_Q_LOW_WATER_MARK (DEFAULT_NUM_TX_FRAMES/3)
822 #define WVLAN_MAX_TX_QUEUES 1
827 typedef struct wvlan_wds_if
829 struct net_device *dev;
832 struct net_device_stats stats;
835 hcf_8 wdsAddress[ETH_ALEN];
836 } WVLAN_WDS_IF, *PWVLAN_WDS_IF;
842 #define NUM_RX_DESC 5
843 #define NUM_TX_DESC 5
845 typedef struct dma_strct
847 DESC_STRCT *tx_packet[NUM_TX_DESC];
848 DESC_STRCT *rx_packet[NUM_RX_DESC];
849 DESC_STRCT *rx_reclaim_desc, *tx_reclaim_desc; // Descriptors for host-reclaim purposes (see HCF)
850 int tx_rsc_ind; // DMA Tx resource indicator is maintained in the MSF, not in the HCF
851 int rx_rsc_ind; // Also added rx rsource indicator so that cleanup can be performed if alloc fails
856 /* Macros used in DMA support */
857 /* get bus address of {rx,tx}dma structure member, in little-endian byte order */
858 #define WL_DMA_BUS_ADDR_LE(str, i, mem) \
859 cpu_to_le32(str##_dma_addr[(i)] + ((hcf_8 *)&str[(i)]->mem - (hcf_8 *)str[(i)]))
866 struct pcmcia_device *link;
870 struct net_device *dev;
871 // struct net_device *dev_next;
873 struct tasklet_struct task;
874 struct net_device_stats stats;
878 struct iw_statistics wstats;
880 // u_char spy_address[IW_MAX_SPY][ETH_ALEN];
881 // struct iw_quality spy_stat[IW_MAX_SPY];
882 struct iw_spy_data spy_data;
883 struct iw_public_data wireless_data;
884 #endif // WIRELESS_EXT
888 //;? struct timer_list timer_oor;
889 //;? hcf_16 timer_oor_cnt;
890 u_long wlags49_type; //controls output in /proc/wlags49
895 int firmware_present;
897 CFG_DRV_INFO_STRCT driverInfo;
898 CFG_IDENTITY_STRCT driverIdentity;
899 CFG_FW_IDENTITY_STRCT StationIdentity;
900 CFG_PRI_IDENTITY_STRCT PrimaryIdentity;
901 CFG_PRI_IDENTITY_STRCT NICIdentity;
905 hcf_16 maxPort; /* 0 for STA, 6 for AP */
907 /* Elements used for async notification from hardware */
908 RID_LOG_STRCT RidList[10];
910 PROBE_RESP ProbeResp;
911 ASSOC_STATUS_STRCT assoc_stat;
912 SECURITY_STATUS_STRCT sec_stat;
914 u_char lookAheadBuf[WVLAN_MAX_LOOKAHEAD];
916 hcf_8 PortType; // 1 - 3 (1 [Normal] | 3 [AdHoc])
917 hcf_16 Channel; // 0 - 14 (0)
918 hcf_16 TxRateControl[2];
919 hcf_8 DistanceBetweenAPs; // 1 - 3 (1)
920 hcf_16 RTSThreshold; // 0 - 2347 (2347)
921 hcf_16 PMEnabled; // 0 - 2, 8001 - 8002 (0)
922 hcf_8 MicrowaveRobustness;// 0 - 1 (0)
923 hcf_8 CreateIBSS; // 0 - 1 (0)
924 hcf_8 MulticastReceive; // 0 - 1 (1)
925 hcf_16 MaxSleepDuration; // 0 - 65535 (100)
926 hcf_8 MACAddress[ETH_ALEN];
927 char NetworkName[HCF_MAX_NAME_LEN+1];
928 char StationName[HCF_MAX_NAME_LEN+1];
929 hcf_8 EnableEncryption; // 0 - 1 (0)
930 char Key1[MAX_KEY_LEN+1];
931 char Key2[MAX_KEY_LEN+1];
932 char Key3[MAX_KEY_LEN+1];
933 char Key4[MAX_KEY_LEN+1];
934 hcf_8 TransmitKeyID; // 1 - 4 (1)
935 CFG_DEFAULT_KEYS_STRCT DefaultKeys;
936 u_char mailbox[MB_SIZE];
937 char szEncryption[MAX_ENC_LEN];
942 hcf_16 holdoverDuration;
943 hcf_16 MulticastRate[2];
945 hcf_16 authentication; // is this AP specific?
946 hcf_16 promiscuousMode;
947 WVLAN_DRV_MODE DownloadFirmware; // 0 - 2 (0 [None] | 1 [STA] | 2 [AP])
949 char fw_image_filename[MAX_LINE_SIZE+1];
951 hcf_16 AuthKeyMgmtSuite;
953 hcf_16 loadBalancing;
954 hcf_16 mediumDistribution;
956 //hcf_16 shortRetryLimit;
957 //hcf_16 longRetryLimit;
960 hcf_16 connectionControl;
961 //hcf_16 probeDataRates[2];
962 hcf_16 ownBeaconInterval;
966 WVLAN_LFRAME txList[DEFAULT_NUM_TX_FRAMES];
967 struct list_head txFree;
968 struct list_head txQ[WVLAN_MAX_TX_QUEUES];
974 WVLAN_PORT_STATE portState;
976 ScanResult scan_results;
977 ProbeResult probe_results;
985 hcf_8 DTIMPeriod; // 1 - 255 (1)
986 hcf_16 multicastPMBuffering;
987 hcf_8 RejectAny; // 0 - 1 (0)
988 hcf_8 ExcludeUnencrypted; // 0 - 1 (1)
989 hcf_16 intraBSSRelay;
991 WVLAN_WDS_IF wds_port[NUM_WDS_PORTS];
995 #ifdef HAVE_NETDEV_PRIV
996 #define wl_priv(dev) ((struct wl_private *) netdev_priv(dev))
998 extern inline struct wl_private *wl_priv(struct net_device *dev)
1004 /********************************************************************/
1005 /* Locking and synchronization functions */
1006 /********************************************************************/
1008 /* These functions *must* be inline or they will break horribly on
1009 * SPARC, due to its weird semantics for save/restore flags. extern
1010 * inline should prevent the kernel from linking or module from
1011 * loading if they are not inlined. */
1012 static inline void wl_lock(struct wl_private *lp,
1013 unsigned long *flags)
1015 spin_lock_irqsave(&lp->slock, *flags);
1018 static inline void wl_unlock(struct wl_private *lp,
1019 unsigned long *flags)
1021 spin_unlock_irqrestore(&lp->slock, *flags);
1024 /********************************************************************/
1025 /* Interrupt enable disable functions */
1026 /********************************************************************/
1028 extern inline void wl_act_int_on(struct wl_private *lp)
1031 * Only do something when the driver is handling
1032 * interrupts. Handling starts at wl_open and
1033 * ends at wl_close when not in RTS mode
1035 if(lp->is_handling_int == WL_HANDLING_INT) {
1036 hcf_action( &lp->hcfCtx, HCF_ACT_INT_ON );
1040 extern inline void wl_act_int_off(struct wl_private *lp)
1043 * Only do something when the driver is handling
1044 * interrupts. Handling starts at wl_open and
1045 * ends at wl_close when not in RTS mode
1047 if(lp->is_handling_int == WL_HANDLING_INT) {
1048 hcf_action( &lp->hcfCtx, HCF_ACT_INT_OFF );
1052 #endif // __WAVELAN2_H__