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