Merge branch 'next/drivers' into HEAD
[deliverable/linux.git] / drivers / staging / wlags49_h2 / wl_internal.h
CommitLineData
68c0bdff
HG
1/*******************************************************************************
2 * Agere Systems Inc.
3 * Wireless device driver for Linux (wlags49).
4 *
5 * Copyright (c) 1998-2003 Agere Systems Inc.
6 * All rights reserved.
7 * http://www.agere.com
8 *
9 * Initially developed by TriplePoint, Inc.
10 * http://www.triplepoint.com
11 *
12 *------------------------------------------------------------------------------
13 *
cb154c18 14 * Header for definitions and macros internal to the drvier.
68c0bdff
HG
15 *
16 *------------------------------------------------------------------------------
17 *
18 * SOFTWARE LICENSE
19 *
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.
24 *
d36b6910 25 * Copyright © 2003 Agere Systems Inc.
68c0bdff
HG
26 * All rights reserved.
27 *
28 * Redistribution and use in source or binary forms, with or without
29 * modifications, are permitted provided that the following conditions are met:
30 *
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
34 * distribution.
35 *
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.
39 *
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.
43 *
44 * Disclaimer
45 *
d36b6910 46 * THIS SOFTWARE IS PROVIDED \93AS IS\94 AND ANY EXPRESS OR IMPLIED WARRANTIES,
68c0bdff
HG
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
57 * DAMAGE.
58 *
59 ******************************************************************************/
60
68c0bdff
HG
61#ifndef __WAVELAN2_H__
62#define __WAVELAN2_H__
63
64
65
66
67/*******************************************************************************
68 * include files
69 ******************************************************************************/
68c0bdff 70#ifdef BUS_PCMCIA
68c0bdff
HG
71#include <pcmcia/cistpl.h>
72#include <pcmcia/cisreg.h>
73#include <pcmcia/ciscode.h>
74#include <pcmcia/ds.h>
75#endif // BUS_PCMCIA
76
68c0bdff 77#include <linux/wireless.h>
68c0bdff 78#include <net/iw_handler.h>
68c0bdff
HG
79
80#include <linux/list.h>
81
82#include <linux/interrupt.h>
83
84
85
86
87/*******************************************************************************
88 * constant definitions
89 ******************************************************************************/
90#define p_u8 __u8
91#define p_s8 __s8
92#define p_u16 __u16
93#define p_s16 __s16
94#define p_u32 __u32
95#define p_s32 __s32
96#define p_char char
97
98#define MAX_KEY_LEN (2 + (13 * 2)) // 0x plus 13 hex digit pairs
99#define MB_SIZE 1024
100#define MAX_ENC_LEN 104
101
102#define MAX_SCAN_TIME_SEC 8
103#define MAX_NAPS 32
104
105#define CFG_MB_INFO 0x0820 //Mail Box Info Block
106
107#define NUM_WDS_PORTS 6
108
109#define WVLAN_MAX_LOOKAHEAD (HCF_MAX_MSG+46) /* as per s0005MIC_4.doc */
110
111
112/* Min/Max/Default Parameter Values */
113#if 0 //;? (HCF_TYPE) & HCF_TYPE_AP
114//;? why this difference depending on compile option, seems to me it should depend on runtime if anything
115#define PARM_DEFAULT_SSID "LinuxAP"
116#else
117#define PARM_DEFAULT_SSID "ANY"
118#endif // HCF_TYPE_AP
119
120#define PARM_MIN_NAME_LEN 1
121#define PARM_MAX_NAME_LEN 32
122
123
124/* The following definitions pertain to module and profile parameters */
125// #define PARM_AP_MODE APMode
126// #define PARM_NAME_AP_MODE TEXT("APMode")
127// #define PARM_DEFAULT_AP_MODE FALSE
128
129#define PARM_AUTHENTICATION Authentication
130#define PARM_NAME_AUTHENTICATION TEXT("Authentication")
131#define PARM_MIN_AUTHENTICATION 1
132#define PARM_MAX_AUTHENTICATION 2
133#define PARM_DEFAULT_AUTHENTICATION 1
134
135#define PARM_AUTH_KEY_MGMT_SUITE AuthKeyMgmtSuite
136#define PARM_NAME_AUTH_KEY_MGMT_SUITE TEXT("AuthKeyMgmtSuite")
137#define PARM_MIN_AUTH_KEY_MGMT_SUITE 0
138#define PARM_MAX_AUTH_KEY_MGMT_SUITE 4
139#define PARM_DEFAULT_AUTH_KEY_MGMT_SUITE 0
140
141#define PARM_BRSC_2GHZ BRSC2GHz
142#define PARM_NAME_BRSC_2GHZ TEXT("BRSC2GHz")
143#define PARM_MIN_BRSC 0x0000
144#define PARM_MAX_BRSC 0x0FFF
145#define PARM_DEFAULT_BRSC_2GHZ 0x000F
146
147#define PARM_BRSC_5GHZ BRSC5GHz
148#define PARM_NAME_BRSC_5GHZ TEXT("BRSC5GHz")
149#define PARM_DEFAULT_BRSC_5GHZ 0x0150
150
151#define PARM_COEXISTENCE Coexistence
152#define PARM_NAME_COEXISTENCE TEXT("Coexistence")
153#define PARM_MIN_COEXISTENCE 0x0000
154#define PARM_MAX_COEXISTENCE 0x0007
155#define PARM_DEFAULT_COEXISTENCE 0x0000
156
157#define PARM_CONFIGURED Configured
158#define PARM_NAME_CONFIGURED TEXT("Configured")
159
160#define PARM_CONNECTION_CONTROL ConnectionControl
161#define PARM_NAME_CONNECTION_CONTROL TEXT("ConnectionControl")
162#define PARM_MIN_CONNECTION_CONTROL 0
163#define PARM_MAX_CONNECTION_CONTROL 3
164#define PARM_DEFAULT_CONNECTION_CONTROL 2
165
166#define PARM_CREATE_IBSS CreateIBSS
167#define PARM_NAME_CREATE_IBSS TEXT("CreateIBSS")
168#define PARM_DEFAULT_CREATE_IBSS FALSE
169#define PARM_DEFAULT_CREATE_IBSS_STR "N"
170
171#define PARM_DEBUG_FLAG DebugFlag
172#define PARM_NAME_DEBUG_FLAG TEXT("DebugFlag")
173#define PARM_MIN_DEBUG_FLAG 0
174#define PARM_MAX_DEBUG_FLAG 0xFFFF
175#define PARM_DEFAULT_DEBUG_FLAG 0xFFFF
176
177#define PARM_DESIRED_SSID DesiredSSID
178#define PARM_NAME_DESIRED_SSID TEXT("DesiredSSID")
179
180#define PARM_DOWNLOAD_FIRMWARE DownloadFirmware
181#define PARM_NAME_DOWNLOAD_FIRMWARE TEXT("DownloadFirmware")
182
183#define PARM_DRIVER_ENABLE DriverEnable
184#define PARM_NAME_DRIVER_ENABLE TEXT("DriverEnable")
185#define PARM_DEFAULT_DRIVER_ENABLE TRUE
186
187#define PARM_ENABLE_ENCRYPTION EnableEncryption
188#define PARM_NAME_ENABLE_ENCRYPTION TEXT("EnableEncryption")
189#define PARM_MIN_ENABLE_ENCRYPTION 0
190#define PARM_MAX_ENABLE_ENCRYPTION 7
191#define PARM_DEFAULT_ENABLE_ENCRYPTION 0
192
193#define PARM_ENCRYPTION Encryption
194#define PARM_NAME_ENCRYPTION TEXT("Encryption")
195
196#define PARM_EXCLUDE_UNENCRYPTED ExcludeUnencrypted
197#define PARM_NAME_EXCLUDE_UNENCRYPTED TEXT("ExcludeUnencrypted")
198#define PARM_DEFAULT_EXCLUDE_UNENCRYPTED TRUE
199#define PARM_DEFAULT_EXCLUDE_UNENCRYPTED_STR "N"
200
201#define PARM_INTRA_BSS_RELAY IntraBSSRelay
202#define PARM_NAME_INTRA_BSS_RELAY TEXT("IntraBSSRelay")
203#define PARM_DEFAULT_INTRA_BSS_RELAY TRUE
204#define PARM_DEFAULT_INTRA_BSS_RELAY_STR "Y"
205
206#define PARM_KEY1 Key1
207#define PARM_NAME_KEY1 TEXT("Key1")
208#define PARM_KEY2 Key2
209#define PARM_NAME_KEY2 TEXT("Key2")
210#define PARM_KEY3 Key3
211#define PARM_NAME_KEY3 TEXT("Key3")
212#define PARM_KEY4 Key4
213#define PARM_NAME_KEY4 TEXT("Key4")
214
215//;? #define PARM_KEY_FORMAT AsciiHex
216//;? #define PARM_NAME_KEY_FORMAT TEXT("AsciiHex")
217
218#define PARM_LOAD_BALANCING LoadBalancing
219#define PARM_NAME_LOAD_BALANCING TEXT("LoadBalancing")
220#define PARM_DEFAULT_LOAD_BALANCING TRUE
221#define PARM_DEFAULT_LOAD_BALANCING_STR "Y"
222
223#define PARM_MAX_DATA_LENGTH MaxDataLength
224#define PARM_NAME_MAX_DATA_LENGTH TEXT("MaxDataLength")
225
226#define PARM_MAX_SLEEP MaxSleepDuration
227#define PARM_NAME_MAX_SLEEP TEXT("MaxSleepDuration")
228#define PARM_MIN_MAX_PM_SLEEP 1 //;?names nearly right?
229#define PARM_MAX_MAX_PM_SLEEP 65535
230#define PARM_DEFAULT_MAX_PM_SLEEP 100
231
232#define PARM_MEDIUM_DISTRIBUTION MediumDistribution
233#define PARM_NAME_MEDIUM_DISTRIBUTION TEXT("MediumDistribution")
234#define PARM_DEFAULT_MEDIUM_DISTRIBUTION TRUE
235#define PARM_DEFAULT_MEDIUM_DISTRIBUTION_STR "Y"
236
237#define PARM_MICROWAVE_ROBUSTNESS MicroWaveRobustness
238#define PARM_NAME_MICROWAVE_ROBUSTNESS TEXT("MicroWaveRobustness")
239#define PARM_DEFAULT_MICROWAVE_ROBUSTNESS FALSE
240#define PARM_DEFAULT_MICROWAVE_ROBUSTNESS_STR "N"
241
242#define PARM_MULTICAST_PM_BUFFERING MulticastPMBuffering
243#define PARM_NAME_MULTICAST_PM_BUFFERING TEXT("MulticastPMBuffering")
244#define PARM_DEFAULT_MULTICAST_PM_BUFFERING TRUE
245#define PARM_DEFAULT_MULTICAST_PM_BUFFERING_STR "Y"
246
247#define PARM_MULTICAST_RATE MulticastRate
248#define PARM_NAME_MULTICAST_RATE TEXT("MulticastRate")
249#ifdef WARP
250#define PARM_MIN_MULTICAST_RATE 0x0001
251#define PARM_MAX_MULTICAST_RATE 0x0fff
252#define PARM_DEFAULT_MULTICAST_RATE_2GHZ 0x0004
253#define PARM_DEFAULT_MULTICAST_RATE_5GHZ 0x0010
254#else
255#define PARM_MIN_MULTICAST_RATE 0x0001
256#define PARM_MAX_MULTICAST_RATE 0x0004
257#define PARM_DEFAULT_MULTICAST_RATE_2GHZ 0x0002
258#define PARM_DEFAULT_MULTICAST_RATE_5GHZ 0x0000
259#endif // WARP
260
261#define PARM_MULTICAST_RX MulticastReceive
262#define PARM_NAME_MULTICAST_RX TEXT("MulticastReceive")
263#define PARM_DEFAULT_MULTICAST_RX TRUE
264#define PARM_DEFAULT_MULTICAST_RX_STR "Y"
265
266#define PARM_NETWORK_ADDR NetworkAddress
267#define PARM_NAME_NETWORK_ADDR TEXT("NetworkAddress")
268#define PARM_DEFAULT_NETWORK_ADDR { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
269
270#define PARM_NETWORK_TYPE NetworkType
271#define PARM_NAME_NETWORK_TYPE TEXT("NetworkType")
272#define PARM_DEFAULT_NETWORK_TYPE 0
273
274#define PARM_OWN_ATIM_WINDOW OwnATIMWindow
275#define PARM_NAME_OWN_ATIM_WINDOW TEXT("OwnATIMWindow")
276#define PARM_MIN_OWN_ATIM_WINDOW 0
277#define PARM_MAX_OWN_ATIM_WINDOW 100
278#define PARM_DEFAULT_OWN_ATIM_WINDOW 0
279
280#define PARM_OWN_BEACON_INTERVAL OwnBeaconInterval
281#define PARM_NAME_OWN_BEACON_INTERVAL TEXT("OwnBeaconInterval")
282#define PARM_MIN_OWN_BEACON_INTERVAL 20
283#define PARM_MAX_OWN_BEACON_INTERVAL 200
284#define PARM_DEFAULT_OWN_BEACON_INTERVAL 100
285
286#define PARM_OWN_CHANNEL OwnChannel
287#define PARM_NAME_OWN_CHANNEL TEXT("OwnChannel")
288#define PARM_MIN_OWN_CHANNEL 1
289#define PARM_MAX_OWN_CHANNEL 161
290#define PARM_DEFAULT_OWN_CHANNEL 10
291
292#define PARM_OWN_DTIM_PERIOD OwnDTIMPeriod
293#define PARM_NAME_OWN_DTIM_PERIOD TEXT("OwnDTIMPeriod")
294#define PARM_MIN_OWN_DTIM_PERIOD 1
295#define PARM_MAX_OWN_DTIM_PERIOD 65535
296#define PARM_DEFAULT_OWN_DTIM_PERIOD 1
297
298#define PARM_OWN_NAME OwnName
299#define PARM_NAME_OWN_NAME TEXT("OwnName")
300#define PARM_DEFAULT_OWN_NAME "Linux"
301
302#define PARM_OWN_SSID OwnSSID
303#define PARM_NAME_OWN_SSID TEXT("OwnSSID")
304
305#define PARM_PM_ENABLED PMEnabled
306#define PARM_NAME_PM_ENABLED TEXT("PMEnabled")
307#define PARM_MAX_PM_ENABLED 3
308
309#define PARM_PMEPS PMEPS
310#define PARM_NAME_PMEPS TEXT("PMEPS")
311
312#define PARM_PM_HOLDOVER_DURATION PMHoldoverDuration
313#define PARM_NAME_PM_HOLDOVER_DURATION TEXT("PMHoldoverDuration")
314#define PARM_MIN_PM_HOLDOVER_DURATION 1
315#define PARM_MAX_PM_HOLDOVER_DURATION 1000
316#define PARM_DEFAULT_PM_HOLDOVER_DURATION 100
317
318#define PARM_PM_MODE PowerMode
319#define PARM_NAME_PM_MODE TEXT("PowerMode")
320
321#define PARM_PORT_TYPE PortType
322#define PARM_NAME_PORT_TYPE TEXT("PortType")
323#define PARM_MIN_PORT_TYPE 1
324#define PARM_MAX_PORT_TYPE 3
325#define PARM_DEFAULT_PORT_TYPE 1
326
327#define PARM_PROMISCUOUS_MODE PromiscuousMode
328#define PARM_NAME_PROMISCUOUS_MODE TEXT("PromiscuousMode")
329#define PARM_DEFAULT_PROMISCUOUS_MODE FALSE
330#define PARM_DEFAULT_PROMISCUOUS_MODE_STR "N"
331
332#define PARM_REJECT_ANY RejectANY
333#define PARM_NAME_REJECT_ANY TEXT("RejectANY")
334#define PARM_DEFAULT_REJECT_ANY FALSE
335#define PARM_DEFAULT_REJECT_ANY_STR "N"
336
337#define PARM_RTS_THRESHOLD RTSThreshold
338#define PARM_NAME_RTS_THRESHOLD TEXT("RTSThreshold")
339#define PARM_MIN_RTS_THRESHOLD 0
340#define PARM_MAX_RTS_THRESHOLD 2347
341#define PARM_DEFAULT_RTS_THRESHOLD 2347
342
343#define PARM_RTS_THRESHOLD1 RTSThreshold1
344#define PARM_NAME_RTS_THRESHOLD1 TEXT("RTSThreshold1")
345#define PARM_RTS_THRESHOLD2 RTSThreshold2
346#define PARM_NAME_RTS_THRESHOLD2 TEXT("RTSThreshold2")
347#define PARM_RTS_THRESHOLD3 RTSThreshold3
348#define PARM_NAME_RTS_THRESHOLD3 TEXT("RTSThreshold3")
349#define PARM_RTS_THRESHOLD4 RTSThreshold4
350#define PARM_NAME_RTS_THRESHOLD4 TEXT("RTSThreshold4")
351#define PARM_RTS_THRESHOLD5 RTSThreshold5
352#define PARM_NAME_RTS_THRESHOLD5 TEXT("RTSThreshold5")
353#define PARM_RTS_THRESHOLD6 RTSThreshold6
354#define PARM_NAME_RTS_THRESHOLD6 TEXT("RTSThreshold6")
355
356#define PARM_SRSC_2GHZ SRSC2GHz
357#define PARM_NAME_SRSC_2GHZ TEXT("SRSC2GHz")
358#define PARM_MIN_SRSC 0x0000
359#define PARM_MAX_SRSC 0x0FFF
360#define PARM_DEFAULT_SRSC_2GHZ 0x0FFF
361
362#define PARM_SRSC_5GHZ SRSC5GHz
363#define PARM_NAME_SRSC_5GHZ TEXT("SRSC5GHz")
364#define PARM_DEFAULT_SRSC_5GHZ 0x0FF0
365
366#define PARM_SYSTEM_SCALE SystemScale
367#define PARM_NAME_SYSTEM_SCALE TEXT("SystemScale")
368#define PARM_MIN_SYSTEM_SCALE 1
369#define PARM_MAX_SYSTEM_SCALE 5
370#define PARM_DEFAULT_SYSTEM_SCALE 1
371
372#define PARM_TX_KEY TxKey
373#define PARM_NAME_TX_KEY TEXT("TxKey")
374#define PARM_MIN_TX_KEY 1
375#define PARM_MAX_TX_KEY 4
376#define PARM_DEFAULT_TX_KEY 1
377
378#define PARM_TX_POW_LEVEL TxPowLevel
379#define PARM_NAME_TX_POW_LEVEL TEXT("TxPowLevel")
380#define PARM_MIN_TX_POW_LEVEL 1 // 20 dBm
381#define PARM_MAX_TX_POW_LEVEL 6 // 8 dBm
382#define PARM_DEFAULT_TX_POW_LEVEL 3 // 15 dBm
383
384#define PARM_TX_RATE TxRateControl
385#define PARM_NAME_TX_RATE TEXT("TxRateControl")
386#define PARM_MIN_TX_RATE 0x0001
387#ifdef WARP
388#define PARM_MAX_TX_RATE 0x0FFF
389#define PARM_DEFAULT_TX_RATE_2GHZ 0x0FFF
390#define PARM_DEFAULT_TX_RATE_5GHZ 0x0FF0
391#else
392#define PARM_MAX_TX_RATE 0x0007
393#define PARM_DEFAULT_TX_RATE_2GHZ 0x0003
394#define PARM_DEFAULT_TX_RATE_5GHZ 0x0000
395#endif // WARP
396
397#define PARM_TX_RATE1 TxRateControl1
398#define PARM_NAME_TX_RATE1 TEXT("TxRateControl1")
399#define PARM_TX_RATE2 TxRateControl2
400#define PARM_NAME_TX_RATE2 TEXT("TxRateControl2")
401#define PARM_TX_RATE3 TxRateControl3
402#define PARM_NAME_TX_RATE3 TEXT("TxRateControl3")
403#define PARM_TX_RATE4 TxRateControl4
404#define PARM_NAME_TX_RATE4 TEXT("TxRateControl4")
405#define PARM_TX_RATE5 TxRateControl5
406#define PARM_NAME_TX_RATE5 TEXT("TxRateControl5")
407#define PARM_TX_RATE6 TxRateControl6
408#define PARM_NAME_TX_RATE6 TEXT("TxRateControl6")
409
410#define PARM_VENDORDESCRIPTION VendorDescription
411#define PARM_NAME_VENDORDESCRIPTION TEXT("VendorDescription")
412
413#define PARM_WDS_ADDRESS WDSAddress
414#define PARM_NAME_WDS_ADDRESS TEXT("WDSAddress")
415
416#define PARM_WDS_ADDRESS1 WDSAddress1
417#define PARM_NAME_WDS_ADDRESS1 TEXT("WDSAddress1")
418#define PARM_WDS_ADDRESS2 WDSAddress2
419#define PARM_NAME_WDS_ADDRESS2 TEXT("WDSAddress2")
420#define PARM_WDS_ADDRESS3 WDSAddress3
421#define PARM_NAME_WDS_ADDRESS3 TEXT("WDSAddress3")
422#define PARM_WDS_ADDRESS4 WDSAddress4
423#define PARM_NAME_WDS_ADDRESS4 TEXT("WDSAddress4")
424#define PARM_WDS_ADDRESS5 WDSAddress5
425#define PARM_NAME_WDS_ADDRESS5 TEXT("WDSAddress5")
426#define PARM_WDS_ADDRESS6 WDSAddress6
427#define PARM_NAME_WDS_ADDRESS6 TEXT("WDSAddress6")
428
429/*
430#define PARM_LONG_RETRY_LIMIT LongRetryLimit
431#define PARM_NAME_LONG_RETRY_LIMIT TEXT("LongRetryLimit")
432#define PARM_MIN_LONG_RETRY_LIMIT 1
433#define PARM_MAX_LONG_RETRY_LIMIT 15
434#define PARM_DEFAULT_LONG_RETRY_LIMIT 3
435
436
437#define PARM_PROBE_DATA_RATES ProbeDataRates
438#define PARM_NAME_PROBE_DATA_RATES TEXT("ProbeDataRates")
439#define PARM_MIN_PROBE_DATA_RATES 0x0000
440#define PARM_MAX_PROBE_DATA_RATES 0x0FFF
441#define PARM_DEFAULT_PROBE_DATA_RATES_2GHZ 0x0002
442#define PARM_DEFAULT_PROBE_DATA_RATES_5GHZ 0x0010
443
444#define PARM_SHORT_RETRY_LIMIT ShortRetryLimit
445#define PARM_NAME_SHORT_RETRY_LIMIT TEXT("ShortRetryLimit")
446#define PARM_MIN_SHORT_RETRY_LIMIT 1
447#define PARM_MAX_SHORT_RETRY_LIMIT 15
448#define PARM_DEFAULT_SHORT_RETRY_LIMIT 7
449
450
451*/
452
453/*******************************************************************************
454 * state definitions
455 ******************************************************************************/
456/* The following constants are used to track state the device */
457#define WL_FRIMWARE_PRESENT 1 // Download if needed
458#define WL_FRIMWARE_NOT_PRESENT 0 // Skip over download, assume its already there
459#define WL_HANDLING_INT 1 // Actually call the HCF to switch interrupts on/off
460#define WL_NOT_HANDLING_INT 0 // Not yet handling interrupts, do not switch on/off
461
462/*******************************************************************************
463 * macro definitions
464 ******************************************************************************/
465/* The following macro ensures that no symbols are exported, minimizing the
466 chance of a symbol collision in the kernel */
467// EXPORT_NO_SYMBOLS;
468
469#define NELEM(arr) (sizeof(arr) / sizeof(arr[0]))
470
471#define WVLAN_VALID_MAC_ADDRESS( x ) \
472((x[0]!=0xFF) && (x[1]!=0xFF) && (x[2]!=0xFF) && (x[3]!=0xFF) && (x[4]!=0xFF) && (x[5]!=0xFF))
473
474
475
476
477/*******************************************************************************
478 * type definitions
479 ******************************************************************************/
480#undef FALSE
481#undef TRUE
482
483typedef enum
484{
485 FALSE = 0,
486 TRUE = 1
487}
488bool_t;
489
490
491typedef struct _ScanResult
492{
493 //hcf_16 len;
494 //hcf_16 typ;
495 int scan_complete;
496 int num_aps;
497 SCAN_RS_STRCT APTable [MAX_NAPS];
498}
499ScanResult;
500
501
502typedef struct _LINK_STATUS_STRCT
503{
504 hcf_16 len;
505 hcf_16 typ;
506 hcf_16 linkStatus; /* 1..5 */
507}
508LINK_STATUS_STRCT;
509
510
511typedef struct _ASSOC_STATUS_STRCT
512{
513 hcf_16 len;
514 hcf_16 typ;
515 hcf_16 assocStatus; /* 1..3 */
516 hcf_8 staAddr[ETH_ALEN];
517 hcf_8 oldApAddr[ETH_ALEN];
518}
519ASSOC_STATUS_STRCT;
520
521
522typedef struct _SECURITY_STATUS_STRCT
523{
524 hcf_16 len;
525 hcf_16 typ;
526 hcf_16 securityStatus; /* 1..3 */
527 hcf_8 staAddr[ETH_ALEN];
528 hcf_16 reason;
529}
530SECURITY_STATUS_STRCT;
531
532#define WVLAN_WMP_PDU_TYPE_LT_REQ 0x00
533#define WVLAN_WMP_PDU_TYPE_LT_RSP 0x01
534#define WVLAN_WMP_PDU_TYPE_APL_REQ 0x02
535#define WVLAN_WMP_PDU_TYPE_APL_RSP 0x03
536
537typedef struct wvlan_eth_hdr
538{
539 unsigned char dst[ETH_ALEN]; /* Destination address. */
540 unsigned char src[ETH_ALEN]; /* Source address. */
541 unsigned short len; /* Length of the PDU. */
542}
543WVLAN_ETH_HDR, *PWVLAN_ETH_HDR;
544
545typedef struct wvlan_llc_snap
546{
547 unsigned char dsap; /* DSAP (0xAA) */
548 unsigned char ssap; /* SSAP (0xAA) */
549 unsigned char ctrl; /* Control (0x03) */
550 unsigned char oui[3]; /* Organization Unique ID (00-60-1d). */
551 unsigned char specid[2]; /* Specific ID code (00-01). */
552}
553WVLAN_LLC_SNAP, *PWVLAN_LLC_SNAP;
554
555
556typedef struct wvlan_lt_hdr
557{
558 unsigned char version; /* Version (0x00) */
559 unsigned char type; /* PDU type: 0-req/1-resp. */
560 unsigned short id; /* Identifier to associate resp to req. */
561}
562WVLAN_LT_HDR, *PWVLAN_LT_HDR;
563
564
565typedef struct wvlan_wmp_hdr
566{
567 unsigned char version; /* Version */
568 unsigned char type; /* PDU type */
569}
570WVLAN_WMP_HDR, *PWVLAN_WMP_HDR;
571
572
573#define FILLER_SIZE 1554
574#define TEST_PATTERN_SIZE 54
575
576
577typedef struct wvlan_lt_req
578{
579 unsigned char Filler[TEST_PATTERN_SIZE]; /* minimal length of 54 bytes */
580}
581WVLAN_LT_REQ, *PWVLAN_LT_REQ;
582
583
584typedef struct wvlan_lt_rsp
585{
586 char name[32];
587 /* Measured Data */
588 unsigned char signal;
589 unsigned char noise;
590 unsigned char rxFlow;
591 unsigned char dataRate;
592 unsigned short protocol;
593 /* Capabilities */
594 unsigned char station;
595 unsigned char dataRateCap;
596 unsigned char powerMgmt[4];
597 unsigned char robustness[4];
598 unsigned char scaling;
599 unsigned char reserved[5];
600}
601WVLAN_LT_RSP, *PWVLAN_LT_RSP;
602
603
604typedef struct wvlan_rx_wmp_hdr
605{
606 unsigned short status;
607 unsigned short reserved1[2];
608 unsigned char silence;
609 unsigned char signal;
610 unsigned char rate;
611 unsigned char rxFlow;
612 unsigned short reserved2[2];
613 unsigned short frameControl;
614 unsigned short duration;
615 unsigned short address1[3];
616 unsigned short address2[3];
617 unsigned short address3[3];
618 unsigned short sequenceControl;
619 unsigned short address4[3];
620#ifndef HERMES25 //;?just to be on the safe side of inherited but not comprehended code #ifdef HERMES2
621 unsigned short seems_to_be_unused_reserved3[5]; //;?
622 unsigned short seems_to_be_unused_reserved4; //;?
623#endif // HERMES25
624 unsigned short HeaderDataLen;
625}
626WVLAN_RX_WMP_HDR, *PWVLAN_RX_WMP_HDR;
627
628
629typedef struct wvlan_linktest_req_pdu
630{
631 WVLAN_ETH_HDR ethHdr;
632 WVLAN_LLC_SNAP llcSnap;
633 WVLAN_LT_HDR ltHdr;
634 WVLAN_LT_REQ ltReq;
635}
636WVLAN_LINKTEST_REQ_PDU, *PWVLAN_LINKTEST_REQ_PDU;
637
638
639typedef struct wvlan_linktest_rsp_pdu
640{
641 WVLAN_RX_WMP_HDR wmpRxHdr;
642 WVLAN_ETH_HDR ethHdr;
643 WVLAN_LLC_SNAP llcSnap;
644 WVLAN_LT_HDR ltHdr;
645 WVLAN_LT_RSP ltRsp;
646}
647WVLAN_LINKTEST_RSP_PDU, *PWVLAN_LINKTEST_RSP_PDU;
648
649
650typedef struct _LINKTEST_RSP_STRCT
651{
652 hcf_16 len;
653 hcf_16 typ;
654 WVLAN_LINKTEST_RSP_PDU ltRsp;
655}
656LINKTEST_RSP_STRCT;
657
658
659typedef struct wvlan_wmp_rsp_pdu
660{
661 WVLAN_RX_WMP_HDR wmpRxHdr;
662 WVLAN_ETH_HDR ethHdr;
663 WVLAN_LLC_SNAP llcSnap;
664 WVLAN_WMP_HDR wmpHdr;
665}
666WVLAN_WMP_RSP_PDU, *PWVLAN_WMP_RSP_PDU;
667
668
669typedef struct _WMP_RSP_STRCT
670{
671 hcf_16 len;
672 hcf_16 typ;
673 WVLAN_WMP_RSP_PDU wmpRsp;
674}
675WMP_RSP_STRCT;
676
677
678typedef struct _PROBE_RESP
679{
680 // first part: 802.11
681 hcf_16 length;
682 hcf_16 infoType;
683 hcf_16 reserved0;
684 //hcf_8 signal;
685 hcf_8 silence;
686 hcf_8 signal; // Moved signal here as signal/noise values were flipped
687 hcf_8 rxFlow;
688 hcf_8 rate;
689 hcf_16 reserved1[2];
690
691 // second part:
692 hcf_16 frameControl;
693 hcf_16 durID;
694 hcf_8 address1[6];
695 hcf_8 address2[6];
696 hcf_8 BSSID[6]; //! this is correct, right ?
697 hcf_16 sequence;
698 hcf_8 address4[6];
699
700#ifndef WARP
701 hcf_8 reserved2[12];
702#endif // WARP
703
704 hcf_16 dataLength;
705 // the information in the next 3 fields (DA/SA/LenType) is actually not filled in.
706 hcf_8 DA[6];
707 hcf_8 SA[6];
708
709#ifdef WARP
710 hcf_8 channel;
711 hcf_8 band;
712#else
713 hcf_16 lenType;
714#endif // WARP
715
716 hcf_8 timeStamp[8];
717 hcf_16 beaconInterval;
718 hcf_16 capability;
719 hcf_8 rawData[200]; //! <<< think about this number !
720 hcf_16 flags;
721}
722PROBE_RESP, *PPROBE_RESP;
723
724
725typedef struct _ProbeResult
726{
727 int scan_complete;
728 int num_aps;
729 PROBE_RESP ProbeTable[MAX_NAPS];
730}
731ProbeResult;
732
733/* Definitions used to parse capabilities out of the probe responses */
734#define CAPABILITY_ESS 0x0001
735#define CAPABILITY_IBSS 0x0002
736#define CAPABILITY_PRIVACY 0x0010
737
738/* Definitions used to parse the Information Elements out of probe responses */
739#define DS_INFO_ELEM 0x03
740#define GENERIC_INFO_ELEM 0xdd
741#define WPA_MAX_IE_LEN 40
742#define WPA_SELECTOR_LEN 4
743#define WPA_OUI_TYPE { 0x00, 0x50, 0xf2, 1 }
744#define WPA_VERSION 1
745#define WPA_AUTH_KEY_MGMT_UNSPEC_802_1X { 0x00, 0x50, 0xf2, 1 }
746#define WPA_AUTH_KEY_MGMT_PSK_OVER_802_1X { 0x00, 0x50, 0xf2, 2 }
747#define WPA_CIPHER_SUITE_NONE { 0x00, 0x50, 0xf2, 0 }
748#define WPA_CIPHER_SUITE_WEP40 { 0x00, 0x50, 0xf2, 1 }
749#define WPA_CIPHER_SUITE_TKIP { 0x00, 0x50, 0xf2, 2 }
750#define WPA_CIPHER_SUITE_WRAP { 0x00, 0x50, 0xf2, 3 }
751#define WPA_CIPHER_SUITE_CCMP { 0x00, 0x50, 0xf2, 4 }
752#define WPA_CIPHER_SUITE_WEP104 { 0x00, 0x50, 0xf2, 5 }
753
754typedef enum wvlan_drv_mode
755{
756 WVLAN_DRV_MODE_NO_DOWNLOAD, /* this is the same as STA for Hermes 1 */
757 /* it is also only applicable for Hermes 1 */
758 WVLAN_DRV_MODE_STA,
759 WVLAN_DRV_MODE_AP,
760 WVLAN_DRV_MODE_MAX
761}
762WVLAN_DRV_MODE, *PWVLAN_DRV_MODE;
763
764
765typedef enum wvlan_port_state
766{
767 WVLAN_PORT_STATE_ENABLED,
768 WVLAN_PORT_STATE_DISABLED,
769 WVLAN_PORT_STATE_CONNECTED
770}
771WVLAN_PORT_STATE, *PWVLAN_PORT_STATE;
772
773/*
774typedef enum wvlan_connect_state
775{
776 WVLAN_CONNECT_STATE_CONNECTED,
777 WVLAN_CONNECT_STATE_DISCONNECTED
778}
779WVLAN_CONNECT_STATE, *PWVLAN_CONNECT_STATE;
780*/
781
782typedef enum wvlan_pm_state
783{
784 WVLAN_PM_STATE_DISABLED,
785 WVLAN_PM_STATE_ENHANCED,
786 WVLAN_PM_STATE_STANDARD
787}
788WVLAN_PM_STATE, *PWVLAN_PM_STATE;
789
790
791typedef struct wvlan_frame
792{
793 struct sk_buff *skb; /* sk_buff for frame. */
794 hcf_16 port; /* MAC port for the frame. */
795 hcf_16 len; /* Length of the frame. */
796}
797WVLAN_FRAME, *PWVLAN_FRAME;
798
799
800typedef struct wvlan_lframe
801{
802 struct list_head node; /* Node in the list */
803 WVLAN_FRAME frame; /* Frame. */
804}
805WVLAN_LFRAME, *PWVLAN_LFRAME;
806
807
808
809#define DEFAULT_NUM_TX_FRAMES 48
810#define TX_Q_LOW_WATER_MARK (DEFAULT_NUM_TX_FRAMES/3)
811
812#define WVLAN_MAX_TX_QUEUES 1
813
814
815#ifdef USE_WDS
816
817typedef struct wvlan_wds_if
818{
819 struct net_device *dev;
820 int is_registered;
821 int netif_queue_on;
822 struct net_device_stats stats;
823 hcf_16 rtsThreshold;
824 hcf_16 txRateCntl;
825 hcf_8 wdsAddress[ETH_ALEN];
826} WVLAN_WDS_IF, *PWVLAN_WDS_IF;
827
828#endif // USE_WDS
829
830
831
832#define NUM_RX_DESC 5
833#define NUM_TX_DESC 5
834
835typedef struct dma_strct
836{
837 DESC_STRCT *tx_packet[NUM_TX_DESC];
838 DESC_STRCT *rx_packet[NUM_RX_DESC];
839 DESC_STRCT *rx_reclaim_desc, *tx_reclaim_desc; // Descriptors for host-reclaim purposes (see HCF)
840 int tx_rsc_ind; // DMA Tx resource indicator is maintained in the MSF, not in the HCF
86f9150c 841 int rx_rsc_ind; // Also added rx resource indicator so that cleanup can be performed if alloc fails
68c0bdff
HG
842 int status;
843} DMA_STRCT;
844
845
846/* Macros used in DMA support */
847/* get bus address of {rx,tx}dma structure member, in little-endian byte order */
848#define WL_DMA_BUS_ADDR_LE(str, i, mem) \
849 cpu_to_le32(str##_dma_addr[(i)] + ((hcf_8 *)&str[(i)]->mem - (hcf_8 *)str[(i)]))
850
851
852struct wl_private
853{
854
855#ifdef BUS_PCMCIA
68c0bdff
HG
856 struct pcmcia_device *link;
857#endif // BUS_PCMCIA
858
859
860 struct net_device *dev;
861// struct net_device *dev_next;
862 spinlock_t slock;
863 struct tasklet_struct task;
864 struct net_device_stats stats;
865
866
867#ifdef WIRELESS_EXT
868 struct iw_statistics wstats;
869// int spy_number;
870// u_char spy_address[IW_MAX_SPY][ETH_ALEN];
871// struct iw_quality spy_stat[IW_MAX_SPY];
872 struct iw_spy_data spy_data;
873 struct iw_public_data wireless_data;
874#endif // WIRELESS_EXT
875
876
877 IFB_STRCT hcfCtx;
878//;? struct timer_list timer_oor;
879//;? hcf_16 timer_oor_cnt;
880 u_long wlags49_type; //controls output in /proc/wlags49
881 u_long flags;
882 hcf_16 DebugFlag;
883 int is_registered;
884 int is_handling_int;
885 int firmware_present;
1ca61671 886 bool sysfsCreated;
68c0bdff
HG
887 CFG_DRV_INFO_STRCT driverInfo;
888 CFG_IDENTITY_STRCT driverIdentity;
889 CFG_FW_IDENTITY_STRCT StationIdentity;
890 CFG_PRI_IDENTITY_STRCT PrimaryIdentity;
891 CFG_PRI_IDENTITY_STRCT NICIdentity;
892
893 ltv_t ltvRecord;
894 u_long txBytes;
895 hcf_16 maxPort; /* 0 for STA, 6 for AP */
896
897 /* Elements used for async notification from hardware */
898 RID_LOG_STRCT RidList[10];
899 ltv_t updatedRecord;
900 PROBE_RESP ProbeResp;
901 ASSOC_STATUS_STRCT assoc_stat;
902 SECURITY_STATUS_STRCT sec_stat;
903
904 u_char lookAheadBuf[WVLAN_MAX_LOOKAHEAD];
905
906 hcf_8 PortType; // 1 - 3 (1 [Normal] | 3 [AdHoc])
907 hcf_16 Channel; // 0 - 14 (0)
908 hcf_16 TxRateControl[2];
909 hcf_8 DistanceBetweenAPs; // 1 - 3 (1)
910 hcf_16 RTSThreshold; // 0 - 2347 (2347)
911 hcf_16 PMEnabled; // 0 - 2, 8001 - 8002 (0)
912 hcf_8 MicrowaveRobustness;// 0 - 1 (0)
913 hcf_8 CreateIBSS; // 0 - 1 (0)
914 hcf_8 MulticastReceive; // 0 - 1 (1)
915 hcf_16 MaxSleepDuration; // 0 - 65535 (100)
916 hcf_8 MACAddress[ETH_ALEN];
917 char NetworkName[HCF_MAX_NAME_LEN+1];
918 char StationName[HCF_MAX_NAME_LEN+1];
919 hcf_8 EnableEncryption; // 0 - 1 (0)
920 char Key1[MAX_KEY_LEN+1];
921 char Key2[MAX_KEY_LEN+1];
922 char Key3[MAX_KEY_LEN+1];
923 char Key4[MAX_KEY_LEN+1];
924 hcf_8 TransmitKeyID; // 1 - 4 (1)
925 CFG_DEFAULT_KEYS_STRCT DefaultKeys;
926 u_char mailbox[MB_SIZE];
927 char szEncryption[MAX_ENC_LEN];
928
929 hcf_16 driverEnable;
930 hcf_16 wolasEnable;
931 hcf_16 atimWindow;
932 hcf_16 holdoverDuration;
933 hcf_16 MulticastRate[2];
934
935 hcf_16 authentication; // is this AP specific?
936 hcf_16 promiscuousMode;
937 WVLAN_DRV_MODE DownloadFirmware; // 0 - 2 (0 [None] | 1 [STA] | 2 [AP])
938
939 char fw_image_filename[MAX_LINE_SIZE+1];
940
941 hcf_16 AuthKeyMgmtSuite;
942
943 hcf_16 loadBalancing;
944 hcf_16 mediumDistribution;
945 hcf_16 txPowLevel;
946 //hcf_16 shortRetryLimit;
947 //hcf_16 longRetryLimit;
948 hcf_16 srsc[2];
949 hcf_16 brsc[2];
950 hcf_16 connectionControl;
951 //hcf_16 probeDataRates[2];
952 hcf_16 ownBeaconInterval;
953 hcf_16 coexistence;
954
955 WVLAN_FRAME txF;
956 WVLAN_LFRAME txList[DEFAULT_NUM_TX_FRAMES];
957 struct list_head txFree;
958 struct list_head txQ[WVLAN_MAX_TX_QUEUES];
959 int netif_queue_on;
960 int txQ_count;
961 DESC_STRCT desc_rx;
962 DESC_STRCT desc_tx;
963
964 WVLAN_PORT_STATE portState;
965
966 ScanResult scan_results;
967 ProbeResult probe_results;
968 int probe_num_aps;
969
970 int use_dma;
971 DMA_STRCT dma;
972#ifdef USE_RTS
973 int useRTS;
974#endif // USE_RTS
975 hcf_8 DTIMPeriod; // 1 - 255 (1)
976 hcf_16 multicastPMBuffering;
977 hcf_8 RejectAny; // 0 - 1 (0)
978 hcf_8 ExcludeUnencrypted; // 0 - 1 (1)
979 hcf_16 intraBSSRelay;
980#ifdef USE_WDS
981 WVLAN_WDS_IF wds_port[NUM_WDS_PORTS];
982#endif // USE_WDS
05df482e
DK
983
984 /* Track whether the card is using WEP encryption or WPA
985 * so we know what to disable next time through.
986 * IW_ENCODE_ALG_NONE, IW_ENCODE_ALG_WEP, IW_ENCODE_ALG_TKIP
987 */
988 int wext_enc;
68c0bdff
HG
989}; // wl_private
990
68c0bdff 991#define wl_priv(dev) ((struct wl_private *) netdev_priv(dev))
68c0bdff
HG
992
993/********************************************************************/
994/* Locking and synchronization functions */
995/********************************************************************/
996
997/* These functions *must* be inline or they will break horribly on
998 * SPARC, due to its weird semantics for save/restore flags. extern
999 * inline should prevent the kernel from linking or module from
1000 * loading if they are not inlined. */
93822ad1 1001static inline void wl_lock(struct wl_private *lp,
68c0bdff
HG
1002 unsigned long *flags)
1003{
1004 spin_lock_irqsave(&lp->slock, *flags);
1005}
1006
93822ad1 1007static inline void wl_unlock(struct wl_private *lp,
68c0bdff
HG
1008 unsigned long *flags)
1009{
1010 spin_unlock_irqrestore(&lp->slock, *flags);
1011}
1012
1013/********************************************************************/
1014/* Interrupt enable disable functions */
1015/********************************************************************/
1016
1017extern inline void wl_act_int_on(struct wl_private *lp)
1018{
1019 /*
1020 * Only do something when the driver is handling
1021 * interrupts. Handling starts at wl_open and
1022 * ends at wl_close when not in RTS mode
1023 */
1024 if(lp->is_handling_int == WL_HANDLING_INT) {
1025 hcf_action( &lp->hcfCtx, HCF_ACT_INT_ON );
1026 }
1027}
1028
1029extern inline void wl_act_int_off(struct wl_private *lp)
1030{
1031 /*
1032 * Only do something when the driver is handling
1033 * interrupts. Handling starts at wl_open and
1034 * ends at wl_close when not in RTS mode
1035 */
1036 if(lp->is_handling_int == WL_HANDLING_INT) {
1037 hcf_action( &lp->hcfCtx, HCF_ACT_INT_OFF );
1038 }
1039}
1040
1041#endif // __WAVELAN2_H__
This page took 0.266118 seconds and 5 git commands to generate.