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