43b4e02ea96723c1bc66644f24b21c12937d7ce3
[openwrt.git] / package / wificonf / include / wlioctl.h
1 /*
2  * Custom OID/ioctl definitions for
3  * Broadcom 802.11abg Networking Device Driver
4  *
5  * Definitions subject to change without notice.
6  *
7  * Copyright 2005, Broadcom Corporation
8  * All Rights Reserved.
9  * 
10  * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
11  * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
12  * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
13  * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
14  *
15  * $Id$
16  */
17
18 #ifndef _wlioctl_h_
19 #define _wlioctl_h_
20
21 #include "typedefs.h"
22 #include "proto/wpa.h"
23 #include "proto/ethernet.h"
24 #include "proto/bcmeth.h"
25 #include "proto/bcmevent.h"
26 #include "proto/802.11.h"
27
28 /* require default structure packing */
29 #if !defined(__GNUC__)
30 #pragma pack(push,8)
31 #endif
32
33 #define WL_NUMRATES             255     /* max # of rates in a rateset */
34
35 typedef struct wl_rateset {
36         uint32  count;                  /* # rates in this set */
37         uint8   rates[WL_NUMRATES];     /* rates in 500kbps units w/hi bit set if basic */
38 } wl_rateset_t;
39
40 #define WL_CHANSPEC_CHAN_MASK   0x0fff
41 #define WL_CHANSPEC_BAND_MASK   0xf000
42 #define WL_CHANSPEC_BAND_SHIFT  12
43 #define WL_CHANSPEC_BAND_A      0x1000
44 #define WL_CHANSPEC_BAND_B      0x2000
45
46 /*
47  * Per-bss information structure.
48  */
49
50 #define WL_BSS_INFO_VERSION             107     /* current version of wl_bss_info struct */
51
52 typedef struct wl_bss_info {
53         uint32          version;        /* version field */
54         uint32          length;         /* byte length of data in this record, starting at version and including IEs */
55         struct ether_addr BSSID;
56         uint16          beacon_period;  /* units are Kusec */
57         uint16          capability;     /* Capability information */
58         uint8           SSID_len;
59         uint8           SSID[32];
60         struct {
61                 uint    count;          /* # rates in this set */
62                 uint8   rates[16];      /* rates in 500kbps units w/hi bit set if basic */
63         } rateset;                      /* supported rates */
64         uint8           channel;        /* Channel no. */
65         uint16          atim_window;    /* units are Kusec */
66         uint8           dtim_period;    /* DTIM period */
67         int16           RSSI;           /* receive signal strength (in dBm) */
68         int8            phy_noise;      /* noise (in dBm) */
69         uint32          ie_length;      /* byte length of Information Elements */
70         /* variable length Information Elements */
71 } wl_bss_info_t;
72
73 typedef struct wlc_ssid {
74         uint32          SSID_len;
75         uchar           SSID[32];
76 } wlc_ssid_t;
77
78 typedef struct wl_scan_params {
79         wlc_ssid_t ssid;        /* default is {0, ""} */
80         struct ether_addr bssid;/* default is bcast */
81         int8 bss_type;          /* default is any, DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT */
82         int8 scan_type;         /* -1 use default, DOT11_SCANTYPE_ACTIVE/PASSIVE */
83         int32 nprobes;          /* -1 use default, number of probes per channel */
84         int32 active_time;      /* -1 use default, dwell time per channel for active scanning */
85         int32 passive_time;     /* -1 use default, dwell time per channel for passive scanning */
86         int32 home_time;        /* -1 use default, dwell time for the home channel between channel scans */
87         int32 channel_num;      /* 0 use default (all available channels), count of channels in channel_list */
88         uint16 channel_list[1]; /* list of chanspecs */
89 } wl_scan_params_t;
90 /* size of wl_scan_params not including variable length array */
91 #define WL_SCAN_PARAMS_FIXED_SIZE 64
92
93 typedef struct wl_scan_results {
94         uint32 buflen;
95         uint32 version;
96         uint32 count;
97         wl_bss_info_t bss_info[1];
98 } wl_scan_results_t;
99 /* size of wl_scan_results not including variable length array */
100 #define WL_SCAN_RESULTS_FIXED_SIZE 12
101
102 /* uint32 list */
103 typedef struct wl_uint32_list {
104         /* in - # of elements, out - # of entries */
105         uint32 count;
106         /* variable length uint32 list */
107         uint32 element[1];
108 } wl_uint32_list_t;
109
110 #define WLC_CNTRY_BUF_SZ        4               /* Country string is 3 bytes + NULL */
111
112 typedef struct wl_channels_in_country {
113         uint32 buflen;
114         uint32 band;
115         char country_abbrev[WLC_CNTRY_BUF_SZ];
116         uint32 count;
117         uint32 channel[1];
118 } wl_channels_in_country_t;
119
120 typedef struct wl_country_list {
121         uint32 buflen;
122         uint32 band_set;
123         uint32 band;
124         uint32 count;
125         char country_abbrev[1];
126 } wl_country_list_t;
127
128 #define WL_RM_TYPE_BASIC        1
129 #define WL_RM_TYPE_CCA          2
130 #define WL_RM_TYPE_RPI          3
131
132 #define WL_RM_FLAG_PARALLEL     (1<<0)
133
134 #define WL_RM_FLAG_LATE         (1<<1)
135 #define WL_RM_FLAG_INCAPABLE    (1<<2)
136 #define WL_RM_FLAG_REFUSED      (1<<3)
137
138 typedef struct wl_rm_req_elt {
139         int8    type;
140         int8    flags;
141         uint16  chanspec;
142         uint32  token;          /* token for this measurement */
143         uint32  tsf_h;          /* TSF high 32-bits of Measurement start time */
144         uint32  tsf_l;          /* TSF low 32-bits */
145         uint32  dur;            /* TUs */
146 } wl_rm_req_elt_t;
147
148 typedef struct wl_rm_req {
149         uint32  token;          /* overall measurement set token */
150         uint32  count;          /* number of measurement reqests */
151         wl_rm_req_elt_t req[1]; /* variable length block of requests */
152 } wl_rm_req_t;
153 #define WL_RM_REQ_FIXED_LEN     8
154
155 typedef struct wl_rm_rep_elt {
156         int8    type;
157         int8    flags;
158         uint16  chanspec;
159         uint32  token;          /* token for this measurement */
160         uint32  tsf_h;          /* TSF high 32-bits of Measurement start time */
161         uint32  tsf_l;          /* TSF low 32-bits */
162         uint32  dur;            /* TUs */
163         uint32  len;            /* byte length of data block */
164         uint8   data[1];        /* variable length data block */
165 } wl_rm_rep_elt_t;
166 #define WL_RM_REP_ELT_FIXED_LEN 24      /* length excluding data block */
167
168 #define WL_RPI_REP_BIN_NUM 8
169 typedef struct wl_rm_rpi_rep {
170         uint8   rpi[WL_RPI_REP_BIN_NUM];
171         int8    rpi_max[WL_RPI_REP_BIN_NUM];
172 } wl_rm_rpi_rep_t;
173
174 typedef struct wl_rm_rep {
175         uint32  token;          /* overall measurement set token */
176         uint32  len;            /* length of measurement report block */
177         wl_rm_rep_elt_t rep[1]; /* variable length block of reports */
178 } wl_rm_rep_t;
179 #define WL_RM_REP_FIXED_LEN     8
180
181
182 #define WLC_MAX_KEY_SIZE        32      /* max size of any key */
183 #define WLC_MAX_IV_SIZE         16      /* max size of any IV */
184 #define WLC_EXT_IV_FLAG         (1<<5)  /* flag to indicate IV is > 4 bytes */
185 #define WLC_MAX_DEFAULT_KEYS    4       /* # of default WEP keys */
186 #define WLC_MAX_KEYS            54      /* Max # of WEP keys */
187 #define WLC_WEP1_KEY_SIZE       5       /* max size of any WEP key */
188 #define WLC_WEP1_KEY_HEX_SIZE   10      /* size of WEP key in hex. */
189 #define WLC_WEP128_KEY_SIZE     13      /* max size of any WEP key */
190 #define WLC_WEP128_KEY_HEX_SIZE 26      /* size of WEP key in hex. */
191 #define WLC_TKIP_MIC_SIZE       8       /* size of TKIP MIC */
192 #define WLC_TKIP_EOM_SIZE       7       /* max size of TKIP EOM */
193 #define WLC_TKIP_EOM_FLAG       0x5a    /* TKIP EOM flag byte */
194 #define WLC_TKIP_KEY_SIZE       32      /* size of any TKIP key */
195 #define WLC_TKIP_MIC_AUTH_TX    16      /* offset to Authenticator MIC TX key */
196 #define WLC_TKIP_MIC_AUTH_RX    24      /* offset to Authenticator MIC RX key */
197 #define WLC_TKIP_MIC_SUP_RX     16      /* offset to Supplicant MIC RX key */
198 #define WLC_TKIP_MIC_SUP_TX     24      /* offset to Supplicant MIC TX key */
199 #define WLC_TKIP_P1_KEY_SIZE    10      /* size of TKHash Phase1 output, in bytes */
200 #define WLC_TKIP_P2_KEY_SIZE    16      /* size of TKHash Phase2 output */
201 #define WLC_AES_KEY_SIZE        16      /* size of AES key */
202
203
204 typedef enum sup_auth_status {
205         WLC_SUP_DISCONNECTED = 0,
206         WLC_SUP_CONNECTING,
207         WLC_SUP_IDREQUIRED,
208         WLC_SUP_AUTHENTICATING,
209         WLC_SUP_AUTHENTICATED,
210         WLC_SUP_KEYXCHANGE,
211         WLC_SUP_KEYED,
212         WLC_SUP_TIMEOUT
213 } sup_auth_status_t;
214
215
216 /* Enumerate crypto algorithms */
217 #define CRYPTO_ALGO_OFF                 0
218 #define CRYPTO_ALGO_WEP1                1
219 #define CRYPTO_ALGO_TKIP                2
220 #define CRYPTO_ALGO_WEP128              3
221 #define CRYPTO_ALGO_AES_CCM             4
222 #define CRYPTO_ALGO_AES_OCB_MSDU        5
223 #define CRYPTO_ALGO_AES_OCB_MPDU        6
224 #define CRYPTO_ALGO_NALG                7
225
226 #define WSEC_GEN_MIC_ERROR      0x0001
227 #define WSEC_GEN_REPLAY         0x0002
228
229 #define WL_SOFT_KEY     (1 << 0)        /* Indicates this key is using soft encrypt */
230 #define WL_PRIMARY_KEY  (1 << 1)        /* Indicates this key is the primary (ie tx) key */
231 #define WL_KF_RES_4     (1 << 4)        /* Reserved for backward compat */
232 #define WL_KF_RES_5     (1 << 5)        /* Reserved for backward compat */
233
234
235 typedef struct wlc_tkip_info {
236         uint16          phase1[WLC_TKIP_P1_KEY_SIZE/sizeof(uint16)];    /* tkhash phase1 result */
237         uint8           phase2[WLC_TKIP_P2_KEY_SIZE];   /* tkhash phase2 result */
238         uint32          micl;
239         uint32          micr;
240 } tkip_info_t;
241
242 typedef struct _wsec_iv {
243         uint32          hi;     /* upper 32 bits of IV */
244         uint16          lo;     /* lower 16 bits of IV */
245 } wsec_iv_t;
246
247 typedef struct wsec_key {
248         uint32          index;          /* key index */
249         uint32          len;            /* key length */
250         uint8           data[WLC_MAX_KEY_SIZE]; /* key data */
251         tkip_info_t     tkip_tx;        /* tkip transmit state */
252         tkip_info_t     tkip_rx;        /* tkip receive state */
253         uint32          algo;           /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
254         uint32          flags;          /* misc flags */
255         uint32          algo_hw;        /* cache for hw register*/
256         uint32          aes_mode;       /* cache for hw register*/
257         int             iv_len;         /* IV length */         
258         int             iv_initialized; /* has IV been initialized already? */          
259         int             icv_len;        /* ICV length */
260         wsec_iv_t       rxiv;           /* Rx IV */
261         wsec_iv_t       txiv;           /* Tx IV */
262         struct ether_addr ea;           /* per station */
263 } wsec_key_t;
264
265
266
267 typedef struct wl_wsec_key {
268         uint32          index;          /* key index */
269         uint32          len;            /* key length */
270         uint8           data[DOT11_MAX_KEY_SIZE];       /* key data */
271         uint32          pad_1[18];
272         uint32          algo;           /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
273         uint32          flags;          /* misc flags */
274         uint32          pad_2[2];
275         int             pad_3;
276         int             iv_initialized; /* has IV been initialized already? */
277         int             pad_4;
278         /* Rx IV */
279         struct {
280                 uint32  hi;             /* upper 32 bits of IV */
281                 uint16  lo;             /* lower 16 bits of IV */
282         } rxiv;
283         uint32          pad_5[2];
284         struct ether_addr ea;           /* per station */
285 } wl_wsec_key_t;
286
287
288 #define WSEC_MIN_PSK_LEN        8
289 #define WSEC_MAX_PSK_LEN        64
290
291 /* Flag for key material needing passhash'ing */
292 #define WSEC_PASSPHRASE         (1<<0)
293
294 /* recepticle for WLC_SET_WSEC_PMK parameter */
295 typedef struct {
296         ushort  key_len;                /* octets in key material */
297         ushort  flags;                  /* key handling qualification */
298         uint8   key[WSEC_MAX_PSK_LEN];  /* PMK material */
299 } wsec_pmk_t;
300
301 /* wireless security bitvec */
302 #define WEP_ENABLED             0x0001
303 #define TKIP_ENABLED            0x0002
304 #define AES_ENABLED             0x0004
305 #define WSEC_SWFLAG             0x0008
306 #define SES_OW_ENABLED          0x0040  /* to go into transition mode without setting wep */
307
308 /* WPA authentication mode bitvec */
309 #define WPA_AUTH_DISABLED       0x0000  /* Legacy (i.e., non-WPA) */
310 #define WPA_AUTH_NONE           0x0001  /* none (IBSS) */
311 #define WPA_AUTH_UNSPECIFIED    0x0002  /* over 802.1x */
312 #define WPA_AUTH_PSK            0x0004  /* Pre-shared key */
313 /*#define WPA_AUTH_8021X 0x0020*/       /* 802.1x, reserved */
314
315 #define WPA2_AUTH_UNSPECIFIED   0x0040  /* over 802.1x */
316 #define WPA2_AUTH_PSK           0x0080  /* Pre-shared key */
317
318
319
320 /* pmkid */
321 #define MAXPMKID                16      
322
323 typedef struct _pmkid
324 {
325         struct ether_addr       BSSID;
326         uint8                   PMKID[WPA2_PMKID_LEN];
327 } pmkid_t;
328
329 typedef struct _pmkid_list
330 {
331         uint32  npmkid;
332         pmkid_t pmkid[1];
333 } pmkid_list_t;
334
335 typedef struct _pmkid_cand {
336         struct ether_addr       BSSID;
337         uint8                   preauth;
338 } pmkid_cand_t;
339
340 typedef struct _pmkid_cand_list {
341         uint32  npmkid_cand;
342         pmkid_cand_t    pmkid_cand[1];
343 } pmkid_cand_list_t;
344
345
346 typedef struct wl_led_info {
347         uint32          index;          /* led index */
348         uint32          behavior;
349         bool            activehi;
350 } wl_led_info_t;
351
352 typedef struct wlc_assoc_info {
353         uint32          req_len;
354         uint32          resp_len;
355         uint32          flags;
356         struct dot11_assoc_req req;
357         struct ether_addr reassoc_bssid; /* used in reassoc's */
358         struct dot11_assoc_resp resp;
359 } wl_assoc_info_t;
360 /* flags */
361 #define WLC_ASSOC_REQ_IS_REASSOC 0x01 /* assoc req was actually a reassoc */
362 /* srom read/write struct passed through ioctl */
363 typedef struct {
364         uint    byteoff;                /* byte offset */
365         uint    nbytes;         /* number of bytes */
366         uint16 buf[1];
367 } srom_rw_t;
368
369 /* R_REG and W_REG struct passed through ioctl */
370 typedef struct {
371         uint32  byteoff;        /* byte offset of the field in d11regs_t */
372         uint32  val;            /* read/write value of the field */
373         uint32  size;           /* sizeof the field */
374         uint    band;           /* band (optional) */
375 } rw_reg_t;
376
377 /* Structure used by GET/SET_ATTEN ioctls */
378 typedef struct {
379         uint16  auto_ctrl;      /* 1: Automatic control, 0: overriden */
380         uint16  bb;             /* Baseband attenuation */
381         uint16  radio;          /* Radio attenuation */
382         uint16  txctl1;         /* Radio TX_CTL1 value */
383 } atten_t;
384
385 /* Used to get specific STA parameters */
386 typedef struct {
387         uint32  val;
388         struct ether_addr ea;
389 } scb_val_t;
390
391
392 /* Event data type */
393 typedef struct wlc_event {
394         wl_event_msg_t event; /* encapsulated event */  
395         struct ether_addr *addr; /* used to keep a trace of the potential present of
396                                                         an address in wlc_event_msg_t */
397         void *data;                     /* used to hang additional data on an event */
398         struct wlc_event *next; /* enables ordered list of pending events */
399 } wlc_event_t;
400
401 #define BCM_MAC_STATUS_INDICATION           (0x40010200L)
402
403 typedef struct {
404         uint16          ver;            /* version of this struct */
405         uint16          len;            /* length in bytes of this structure */
406         uint16          cap;            /* sta's advertized capabilities */
407         uint32          flags;          /* flags defined below */
408         uint32          idle;           /* time since data pkt rx'd from sta */
409         struct ether_addr       ea;     /* Station address */
410         wl_rateset_t    rateset;        /* rateset in use */
411         uint32          in;             /* seconds elapsed since associated */
412         uint32          listen_interval_inms; /* Min Listen interval in ms for this STA*/
413 } sta_info_t;
414
415 #define WL_STA_VER      2
416
417 /* flags fields */
418 #define WL_STA_BRCM     0x01
419 #define WL_STA_WME      0x02
420 #define WL_STA_ABCAP    0x04
421 #define WL_STA_AUTHE    0x08
422 #define WL_STA_ASSOC    0x10
423 #define WL_STA_AUTHO    0x20
424 #define WL_STA_WDS      0x40
425 #define WL_WDS_LINKUP   0x80
426
427 /*
428  * Country locale determines which channels are available to us.
429  */
430 typedef enum _wlc_locale {
431         WLC_WW = 0,     /* Worldwide */
432         WLC_THA,        /* Thailand */
433         WLC_ISR,        /* Israel */
434         WLC_JDN,        /* Jordan */
435         WLC_PRC,        /* China */
436         WLC_JPN,        /* Japan */
437         WLC_FCC,        /* USA */
438         WLC_EUR,        /* Europe */
439         WLC_USL,        /* US Low Band only */
440         WLC_JPH,        /* Japan High Band only */
441         WLC_ALL,        /* All the channels in this band */
442         WLC_11D,        /* Represents locale recieved by 11d beacons */
443         WLC_LAST_LOCALE,
444         WLC_UNDEFINED_LOCALE = 0xf
445 } wlc_locale_t;
446
447 /* channel encoding */
448 typedef struct channel_info {
449         int hw_channel;
450         int target_channel;
451         int scan_channel;
452 } channel_info_t;
453
454 /* For ioctls that take a list of MAC addresses */
455 struct maclist {
456         uint count;                     /* number of MAC addresses */
457         struct ether_addr ea[1];        /* variable length array of MAC addresses */
458 };
459
460 /* get pkt count struct passed through ioctl */
461 typedef struct get_pktcnt {
462         uint rx_good_pkt;
463         uint rx_bad_pkt;
464         uint tx_good_pkt;
465         uint tx_bad_pkt;
466 } get_pktcnt_t;
467
468 /* Linux network driver ioctl encoding */
469 typedef struct wl_ioctl {
470         uint cmd;       /* common ioctl definition */
471         void *buf;      /* pointer to user buffer */
472         uint len;       /* length of user buffer */
473         bool set;       /* get or set request (optional) */
474         uint used;      /* bytes read or written (optional) */
475         uint needed;    /* bytes needed (optional) */
476 } wl_ioctl_t;
477
478 /*
479  * Structure for passing hardware and software
480  * revision info up from the driver.
481  */
482 typedef struct wlc_rev_info {
483         uint            vendorid;       /* PCI vendor id */
484         uint            deviceid;       /* device id of chip */
485         uint            radiorev;       /* radio revision */
486         uint            chiprev;        /* chip revision */
487         uint            corerev;        /* core revision */
488         uint            boardid;        /* board identifier (usu. PCI sub-device id) */
489         uint            boardvendor;    /* board vendor (usu. PCI sub-vendor id) */
490         uint            boardrev;       /* board revision */
491         uint            driverrev;      /* driver version */
492         uint            ucoderev;       /* microcode version */
493         uint            bus;            /* bus type */
494         uint            chipnum;        /* chip number */
495 } wlc_rev_info_t;
496
497 #define WL_BRAND_MAX 10
498 typedef struct wl_instance_info {
499         uint instance;
500         char brand[WL_BRAND_MAX];
501 } wl_instance_info_t;
502
503 /* check this magic number */
504 #define WLC_IOCTL_MAGIC         0x14e46c77
505
506 /* bump this number if you change the ioctl interface */
507 #define WLC_IOCTL_VERSION       1
508
509 #define WLC_IOCTL_MAXLEN        8192            /* max length ioctl buffer required */
510 #define WLC_IOCTL_SMLEN         256             /* "small" length ioctl buffer required */
511
512 /* common ioctl definitions */
513 #define WLC_GET_MAGIC                           0
514 #define WLC_GET_VERSION                         1
515 #define WLC_UP                                          2
516 #define WLC_DOWN                                        3
517 #define WLC_DUMP                                        6
518 #define WLC_GET_MSGLEVEL                        7
519 #define WLC_SET_MSGLEVEL                        8
520 #define WLC_GET_PROMISC                         9
521 #define WLC_SET_PROMISC                         10
522 #define WLC_GET_RATE                            12
523 /* #define WLC_SET_RATE                         13 */ /* no longer supported */
524 #define WLC_GET_INSTANCE                        14
525 #define WLC_GET_FRAG                            15 /* no longer supported in the new driver */
526 #define WLC_SET_FRAG                            16 /* no longer supported in the new driver */
527 #define WLC_GET_RTS                             17 /* no longer supported in the new driver */
528 #define WLC_SET_RTS                             18 /* no longer supported in the new driver */
529 #define WLC_GET_INFRA                           19
530 #define WLC_SET_INFRA                           20
531 #define WLC_GET_AUTH                            21
532 #define WLC_SET_AUTH                            22
533 #define WLC_GET_BSSID                           23
534 #define WLC_SET_BSSID                           24
535 #define WLC_GET_SSID                            25
536 #define WLC_SET_SSID                            26
537 #define WLC_RESTART                             27
538 #define WLC_DUMP_SCB                            28 
539 #define WLC_GET_CHANNEL                         29
540 #define WLC_SET_CHANNEL                         30
541 #define WLC_GET_SRL                             31
542 #define WLC_SET_SRL                             32
543 #define WLC_GET_LRL                             33
544 #define WLC_SET_LRL                             34
545 #define WLC_GET_PLCPHDR                         35
546 #define WLC_SET_PLCPHDR                         36
547 #define WLC_GET_RADIO                           37
548 #define WLC_SET_RADIO                           38
549 #define WLC_GET_PHYTYPE                         39
550 #define WLC_DUMP_RATE                           40
551 #define WLC_SET_RATE_PARAMS                     41
552 #define WLC_GET_WEP                             42
553 #define WLC_SET_WEP                             43
554 #define WLC_GET_KEY                             44
555 #define WLC_SET_KEY                             45
556 #define WLC_GET_REGULATORY                      46
557 #define WLC_SET_REGULATORY                      47
558 #define WLC_GET_PASSIVE                         48
559 #define WLC_SET_PASSIVE                         49
560 #define WLC_SCAN                                50
561 #define WLC_SCAN_RESULTS                        51
562 #define WLC_DISASSOC                            52
563 #define WLC_REASSOC                             53
564 #define WLC_GET_ROAM_TRIGGER                    54
565 #define WLC_SET_ROAM_TRIGGER                    55
566 #define WLC_GET_ROAM_DELTA                      56
567 #define WLC_SET_ROAM_DELTA                      57
568 #define WLC_GET_ROAM_SCAN_PERIOD                58
569 #define WLC_SET_ROAM_SCAN_PERIOD                59
570 #define WLC_EVM                                 60
571 #define WLC_GET_TXANT                           61
572 #define WLC_SET_TXANT                           62
573 #define WLC_GET_ANTDIV                          63
574 #define WLC_SET_ANTDIV                          64
575 #define WLC_GET_TXPWR                           65
576 #define WLC_SET_TXPWR                           66
577 #define WLC_GET_CLOSED                          67
578 #define WLC_SET_CLOSED                          68
579 #define WLC_GET_MACLIST                         69
580 #define WLC_SET_MACLIST                         70
581 #define WLC_GET_RATESET                         71
582 #define WLC_SET_RATESET                         72
583 #define WLC_GET_LOCALE                          73
584 // #define WLC_SET_LOCALE                               74
585 #define WLC_GET_BCNPRD                          75
586 #define WLC_SET_BCNPRD                          76
587 #define WLC_GET_DTIMPRD                         77
588 #define WLC_SET_DTIMPRD                         78
589 #define WLC_GET_SROM                            79
590 #define WLC_SET_SROM                            80
591 #define WLC_GET_WEP_RESTRICT                    81
592 #define WLC_SET_WEP_RESTRICT                    82
593 #define WLC_GET_COUNTRY                         83
594 #define WLC_SET_COUNTRY                         84
595 #define WLC_GET_PM                              85
596 #define WLC_SET_PM                              86
597 #define WLC_GET_WAKE                            87
598 #define WLC_SET_WAKE                            88
599 #define WLC_GET_D11CNTS                         89
600 #define WLC_GET_FORCELINK                       90      /* ndis only */
601 #define WLC_SET_FORCELINK                       91      /* ndis only */
602 #define WLC_FREQ_ACCURACY                       92
603 #define WLC_CARRIER_SUPPRESS                    93
604 #define WLC_GET_PHYREG                          94
605 #define WLC_SET_PHYREG                          95
606 #define WLC_GET_RADIOREG                        96
607 #define WLC_SET_RADIOREG                        97
608 #define WLC_GET_REVINFO                         98
609 #define WLC_GET_UCANTDIV                        99
610 #define WLC_SET_UCANTDIV                        100
611 #define WLC_R_REG                               101
612 #define WLC_W_REG                               102
613 #define WLC_DIAG_LOOPBACK                       103
614 #define WLC_RESET_D11CNTS                       104
615 #define WLC_GET_MACMODE                         105
616 #define WLC_SET_MACMODE                         106
617 #define WLC_GET_MONITOR                         107
618 #define WLC_SET_MONITOR                         108
619 #define WLC_GET_GMODE                           109
620 #define WLC_SET_GMODE                           110
621 #define WLC_GET_LEGACY_ERP                      111
622 #define WLC_SET_LEGACY_ERP                      112
623 #define WLC_GET_RX_ANT                          113
624 #define WLC_GET_CURR_RATESET                    114     /* current rateset */
625 #define WLC_GET_SCANSUPPRESS                    115
626 #define WLC_SET_SCANSUPPRESS                    116
627 #define WLC_GET_AP                              117
628 #define WLC_SET_AP                              118
629 #define WLC_GET_EAP_RESTRICT                    119
630 #define WLC_SET_EAP_RESTRICT                    120
631 #define WLC_SCB_AUTHORIZE                       121
632 #define WLC_SCB_DEAUTHORIZE                     122
633 #define WLC_GET_WDSLIST                         123
634 #define WLC_SET_WDSLIST                         124
635 #define WLC_GET_ATIM                            125
636 #define WLC_SET_ATIM                            126
637 #define WLC_GET_RSSI                            127
638 #define WLC_GET_PHYANTDIV                       128
639 #define WLC_SET_PHYANTDIV                       129
640 #define WLC_AP_RX_ONLY                          130
641 #define WLC_GET_TX_PATH_PWR                     131
642 #define WLC_SET_TX_PATH_PWR                     132
643 #define WLC_GET_WSEC                            133
644 #define WLC_SET_WSEC                            134
645 #define WLC_GET_PHY_NOISE                       135
646 #define WLC_GET_BSS_INFO                        136
647 #define WLC_GET_PKTCNTS                         137
648 #define WLC_GET_LAZYWDS                         138
649 #define WLC_SET_LAZYWDS                         139
650 #define WLC_GET_BANDLIST                        140
651 #define WLC_GET_BAND                            141
652 #define WLC_SET_BAND                            142
653 #define WLC_SCB_DEAUTHENTICATE                  143
654 #define WLC_GET_SHORTSLOT                       144
655 #define WLC_GET_SHORTSLOT_OVERRIDE              145
656 #define WLC_SET_SHORTSLOT_OVERRIDE              146
657 #define WLC_GET_SHORTSLOT_RESTRICT              147
658 #define WLC_SET_SHORTSLOT_RESTRICT              148
659 #define WLC_GET_GMODE_PROTECTION                149
660 #define WLC_GET_GMODE_PROTECTION_OVERRIDE       150
661 #define WLC_SET_GMODE_PROTECTION_OVERRIDE       151
662 #define WLC_UPGRADE                             152
663 #define WLC_GET_MRATE                           153
664 #define WLC_SET_MRATE                           154
665 #define WLC_GET_IGNORE_BCNS                     155
666 #define WLC_SET_IGNORE_BCNS                     156
667 #define WLC_GET_SCB_TIMEOUT                     157
668 #define WLC_SET_SCB_TIMEOUT                     158
669 #define WLC_GET_ASSOCLIST                       159
670 #define WLC_GET_CLK                             160
671 #define WLC_SET_CLK                             161
672 #define WLC_GET_UP                              162
673 #define WLC_OUT                                 163
674 #define WLC_GET_WPA_AUTH                        164
675 #define WLC_SET_WPA_AUTH                        165
676 #define WLC_GET_UCFLAGS                         166
677 #define WLC_SET_UCFLAGS                         167
678 #define WLC_GET_PWRIDX                          168
679 #define WLC_SET_PWRIDX                          169
680 #define WLC_GET_TSSI                            170
681 #define WLC_GET_SUP_RATESET_OVERRIDE            171
682 #define WLC_SET_SUP_RATESET_OVERRIDE            172
683 #define WLC_SET_FAST_TIMER                      173
684 #define WLC_GET_FAST_TIMER                      174
685 #define WLC_SET_SLOW_TIMER                      175
686 #define WLC_GET_SLOW_TIMER                      176
687 #define WLC_DUMP_PHYREGS                        177
688 #define WLC_GET_GMODE_PROTECTION_CONTROL        178
689 #define WLC_SET_GMODE_PROTECTION_CONTROL        179
690 #define WLC_GET_PHYLIST                         180
691 #define WLC_ENCRYPT_STRENGTH                    181     /* ndis only */
692 #define WLC_DECRYPT_STATUS                      182     /* ndis only */
693 #define WLC_GET_KEY_SEQ                         183
694 #define WLC_GET_SCAN_CHANNEL_TIME               184
695 #define WLC_SET_SCAN_CHANNEL_TIME               185
696 #define WLC_GET_SCAN_UNASSOC_TIME               186
697 #define WLC_SET_SCAN_UNASSOC_TIME               187
698 #define WLC_GET_SCAN_HOME_TIME                  188
699 #define WLC_SET_SCAN_HOME_TIME                  189
700 #define WLC_GET_SCAN_PASSES                     190
701 #define WLC_SET_SCAN_PASSES                     191
702 #define WLC_GET_PRB_RESP_TIMEOUT                192
703 #define WLC_SET_PRB_RESP_TIMEOUT                193
704 #define WLC_GET_ATTEN                           194
705 #define WLC_SET_ATTEN                           195
706 #define WLC_GET_SHMEM                           196     /* diag */
707 #define WLC_SET_SHMEM                           197     /* diag */
708 #define WLC_GET_GMODE_PROTECTION_CTS            198
709 #define WLC_SET_GMODE_PROTECTION_CTS            199
710 #define WLC_SET_TKIP_MIC_FLAG                   200
711 #define WLC_SCB_DEAUTHENTICATE_FOR_REASON       201
712 #define WLC_TKIP_COUNTERMEASURES                202
713 #define WLC_GET_PIOMODE                         203
714 #define WLC_SET_PIOMODE                         204
715 #define WLC_SET_LED                             209
716 #define WLC_GET_LED                             210
717 #define WLC_GET_INTERFERENCE_MODE               211
718 #define WLC_SET_INTERFERENCE_MODE               212
719 #define WLC_GET_CHANNEL_QA                      213
720 #define WLC_START_CHANNEL_QA                    214
721 #define WLC_GET_CHANNEL_SEL                     215
722 #define WLC_START_CHANNEL_SEL                   216
723 #define WLC_GET_VALID_CHANNELS                  217
724 #define WLC_GET_FAKEFRAG                        218
725 #define WLC_SET_FAKEFRAG                        219
726 #define WLC_GET_PWROUT_PERCENTAGE               220
727 #define WLC_SET_PWROUT_PERCENTAGE               221
728 #define WLC_SET_BAD_FRAME_PREEMPT               222
729 #define WLC_GET_BAD_FRAME_PREEMPT               223
730 #define WLC_SET_LEAP_LIST                       224
731 #define WLC_GET_LEAP_LIST                       225
732 #define WLC_GET_CWMIN                           226
733 #define WLC_SET_CWMIN                           227
734 #define WLC_GET_CWMAX                           228
735 #define WLC_SET_CWMAX                           229
736 #define WLC_GET_WET                             230
737 #define WLC_SET_WET                             231
738 #define WLC_GET_KEY_PRIMARY                     235
739 #define WLC_SET_KEY_PRIMARY                     236
740 #define WLC_SCAN_WITH_CALLBACK                  240
741 #define WLC_GET_RADAR                           242
742 #define WLC_SET_RADAR                           243
743 #define WLC_SET_SPECT_MANAGMENT                 244
744 #define WLC_GET_SPECT_MANAGMENT                 245
745 #define WLC_WDS_GET_REMOTE_HWADDR               246     /* currently handled in wl_linux.c/wl_vx.c */
746 #define WLC_SET_CS_SCAN_TIMER                   248
747 #define WLC_GET_CS_SCAN_TIMER                   249
748 #define WLC_SEND_PWR_CONSTRAINT                 254
749 #define WLC_CURRENT_PWR                         256
750 #define WLC_GET_CHANNELS_IN_COUNTRY             260
751 #define WLC_GET_COUNTRY_LIST                    261
752 #define WLC_GET_VAR                             262     /* get value of named variable */
753 #define WLC_SET_VAR                             263     /* set named variable to value */
754 #define WLC_NVRAM_GET                           264
755 #define WLC_NVRAM_SET                           265
756 #define WLC_SET_WSEC_PMK                        268
757 #define WLC_GET_AUTH_MODE                       269
758 #define WLC_SET_AUTH_MODE                       270
759 #define WLC_NDCONFIG_ITEM                       273     /* currently handled in wl_oid.c */
760 #define WLC_NVOTPW                                      274
761 /* #define WLC_OTPW                                     275 */ /* no longer supported */
762 #define WLC_SET_LOCALE                          278
763 #define WLC_LAST                                279     /* do not change - use get_var/set_var */
764
765 /*
766  * Minor kludge alert:
767  * Duplicate a few definitions that irelay requires from epiioctl.h here
768  * so caller doesn't have to include this file and epiioctl.h .
769  * If this grows any more, it would be time to move these irelay-specific
770  * definitions out of the epiioctl.h and into a separate driver common file.
771  */
772 #ifndef EPICTRL_COOKIE
773 #define EPICTRL_COOKIE          0xABADCEDE
774 #endif
775
776 /* vx wlc ioctl's offset */
777 #define CMN_IOCTL_OFF 0x180
778
779 /*
780  * custom OID support
781  *
782  * 0xFF - implementation specific OID
783  * 0xE4 - first byte of Broadcom PCI vendor ID
784  * 0x14 - second byte of Broadcom PCI vendor ID
785  * 0xXX - the custom OID number
786  */
787
788 /* begin 0x1f values beyond the start of the ET driver range. */
789 #define WL_OID_BASE             0xFFE41420
790
791 /* NDIS overrides */
792 #define OID_WL_GETINSTANCE      (WL_OID_BASE + WLC_GET_INSTANCE)
793 #define OID_WL_NDCONFIG_ITEM (WL_OID_BASE + WLC_NDCONFIG_ITEM)
794
795 #define WL_DECRYPT_STATUS_SUCCESS       1
796 #define WL_DECRYPT_STATUS_FAILURE       2
797 #define WL_DECRYPT_STATUS_UNKNOWN       3
798
799 /* allows user-mode app to poll the status of USB image upgrade */
800 #define WLC_UPGRADE_SUCCESS                     0
801 #define WLC_UPGRADE_PENDING                     1
802
803 /* Bit masks for radio disabled status - returned by WL_GET_RADIO */
804 #define WL_RADIO_SW_DISABLE             (1<<0)
805 #define WL_RADIO_HW_DISABLE             (1<<1)
806 #define WL_RADIO_MPC_DISABLE            (1<<2)
807 #define WL_RADIO_COUNTRY_DISABLE        (1<<3)  /* some countries don't support any 802.11 channel */
808
809 /* Override bit for WLC_SET_TXPWR.  if set, ignore other level limits */
810 #define WL_TXPWR_OVERRIDE       (1<<31)
811
812 /* "diag" iovar argument and error code */
813 #define WL_DIAG_INTERRUPT                       1       /* d11 loopback interrupt test */
814 #define WL_DIAG_MEMORY                          3       /* d11 memory test */
815 #define WL_DIAG_LED                             4       /* LED test */
816 #define WL_DIAG_REG                             5       /* d11/phy register test */
817 #define WL_DIAG_SROM                            6       /* srom read/crc test */
818 #define WL_DIAG_DMA                             7       /* DMA test */
819
820 #define WL_DIAGERR_SUCCESS                      0
821 #define WL_DIAGERR_FAIL_TO_RUN                  1       /* unable to run requested diag */
822 #define WL_DIAGERR_NOT_SUPPORTED                2       /* diag requested is not supported */
823 #define WL_DIAGERR_INTERRUPT_FAIL               3       /* loopback interrupt test failed */
824 #define WL_DIAGERR_LOOPBACK_FAIL                4       /* loopback data test failed */
825 #define WL_DIAGERR_SROM_FAIL                    5       /* srom read failed */
826 #define WL_DIAGERR_SROM_BADCRC                  6       /* srom crc failed */
827 #define WL_DIAGERR_REG_FAIL                     7       /* d11/phy register test failed */
828 #define WL_DIAGERR_MEMORY_FAIL                  8       /* d11 memory test failed */
829 #define WL_DIAGERR_NOMEM                        9       /* diag test failed due to no memory */
830 #define WL_DIAGERR_DMA_FAIL                     10      /* DMA test failed */
831
832 /* Bus types */
833 #define WL_SB_BUS       0       /* Silicon Backplane */
834 #define WL_PCI_BUS      1       /* PCI target */
835 #define WL_PCMCIA_BUS   2       /* PCMCIA target */
836
837 /* band types */
838 #define WLC_BAND_AUTO           0       /* auto-select */
839 #define WLC_BAND_A              1       /* "a" band (5   Ghz) */
840 #define WLC_BAND_B              2       /* "b" band (2.4 Ghz) */
841
842 /* phy types (returned by WLC_GET_PHYTPE) */
843 #define WLC_PHY_TYPE_A          0
844 #define WLC_PHY_TYPE_B          1
845 #define WLC_PHY_TYPE_G          2
846 #define WLC_PHY_TYPE_NULL       0xf
847
848 /* MAC list modes */
849 #define WLC_MACMODE_DISABLED    0       /* MAC list disabled */
850 #define WLC_MACMODE_DENY        1       /* Deny specified (i.e. allow unspecified) */
851 #define WLC_MACMODE_ALLOW       2       /* Allow specified (i.e. deny unspecified) */   
852
853
854 /* 54g modes (basic bits may still be overridden) */
855 #define GMODE_LEGACY_B          0       /* Rateset: 1b, 2b, 5.5, 11 */
856                                         /* Preamble: Long */
857                                         /* Shortslot: Off */
858 #define GMODE_AUTO              1       /* Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54 */
859                                         /* Extended Rateset: 6, 9, 12, 48 */
860                                         /* Preamble: Long */
861                                         /* Shortslot: Auto */
862 #define GMODE_ONLY              2       /* Rateset: 1b, 2b, 5.5b, 11b, 18, 24b, 36, 54 */
863                                         /* Extended Rateset: 6b, 9, 12b, 48 */
864                                         /* Preamble: Short required */
865                                         /* Shortslot: Auto */
866 #define GMODE_B_DEFERRED        3       /* Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54 */
867                                         /* Extended Rateset: 6, 9, 12, 48 */
868                                         /* Preamble: Long */
869                                         /* Shortslot: On */
870 #define GMODE_PERFORMANCE       4       /* Rateset: 1b, 2b, 5.5b, 6b, 9, 11b, 12b, 18, 24b, 36, 48, 54 */
871                                         /* Preamble: Short required */
872                                         /* Shortslot: On and required */
873 #define GMODE_LRS               5       /* Rateset: 1b, 2b, 5.5b, 11b */
874                                         /* Extended Rateset: 6, 9, 12, 18, 24, 36, 48, 54 */
875                                         /* Preamble: Long */
876                                         /* Shortslot: Auto */
877 #define GMODE_MAX               6
878
879
880 /* values for PLCPHdr_override */
881 #define WLC_PLCP_AUTO   -1
882 #define WLC_PLCP_SHORT  0
883 #define WLC_PLCP_LONG   1
884
885 /* values for g_protection_override */
886 #define WLC_G_PROTECTION_AUTO   -1
887 #define WLC_G_PROTECTION_OFF    0
888 #define WLC_G_PROTECTION_ON     1
889
890 /* values for g_protection_control */
891 #define WLC_G_PROTECTION_CTL_OFF        0
892 #define WLC_G_PROTECTION_CTL_LOCAL      1
893 #define WLC_G_PROTECTION_CTL_OVERLAP    2
894
895 /* Values for PM */
896 #define PM_OFF  0
897 #define PM_MAX  1
898 #define PM_FAST 2
899
900 /* interference mitigation options */
901 #define INTERFERE_NONE  0       /* off */
902 #define NON_WLAN        1       /* foreign/non 802.11 interference, no auto detect */
903 #define WLAN_MANUAL     2       /* ACI: no auto detection */
904 #define WLAN_AUTO       3       /* ACI: auto - detact */
905
906 /* Message levels */
907 #define WL_ERROR_VAL            0x0001
908 #define WL_TRACE_VAL            0x0002
909 #define WL_PRHDRS_VAL           0x0004
910 #define WL_PRPKT_VAL            0x0008
911 #define WL_INFORM_VAL           0x0010
912 #define WL_TMP_VAL              0x0020
913 #define WL_OID_VAL              0x0040
914 #define WL_RATE_VAL             0x0080
915 #define WL_ASSOC_VAL            0x0100
916 #define WL_PRUSR_VAL            0x0200
917 #define WL_PS_VAL               0x0400
918 #define WL_TXPWR_VAL            0x0800
919 #define WL_GMODE_VAL            0x1000
920 #define WL_DUAL_VAL             0x2000
921 #define WL_WSEC_VAL             0x4000
922 #define WL_WSEC_DUMP_VAL        0x8000
923 #define WL_LOG_VAL              0x10000
924 #define WL_NRSSI_VAL            0x20000
925 #define WL_LOFT_VAL             0x40000
926 #define WL_REGULATORY_VAL       0x80000
927 #define WL_ACI_VAL              0x100000
928
929
930 /* 802.11h enforcement levels */
931 #define SPECT_MNGMT_OFF         0   /* 11h disabled */
932 #define SPECT_MNGMT_LOOSE       1   /* Allow scan lists to contain non-11h AP */
933                                     /* when 11h is enabled */
934 #define SPECT_MNGMT_STRICT      2   /* Prine out non-11h APs from scan list */
935
936 typedef struct {
937         int npulses;    /* required number of pulses at n * t_int */
938         int ncontig;    /* required number of pulses at t_int */
939         int min_pw;     /* minimum pulse width (20 MHz clocks) */
940         int max_pw;     /* maximum pulse width (20 MHz clocks) */       
941         uint16 thresh0; /* Radar detection, thresh 0 */
942         uint16 thresh1; /* Radar detection, thresh 1 */
943 } wl_radar_args_t;
944
945 /* radar iovar SET defines */
946 #define WL_RADRA_DETECTOR_OFF           0       /* radar dector off */
947 #define WL_RADAR_DETECTOR_ON            1       /* radar detector on */
948 #define WL_RADAR_SIMULATED              2       /* force radar detector to declare detection once */
949
950 /* dfs_status iovar-related defines */
951
952 /* cac - channel availability check,
953  * ism - in-service monitoring
954  * csa - channel switching anouncement
955  */
956
957 /* cac state values */
958 #define WL_DFS_CACSTATE_IDLE            0       /* state for operating in non-radar channel */
959 #define WL_DFS_CACSTATE_PREISM_CAC      1       /* CAC in progress */
960 #define WL_DFS_CACSTATE_ISM             2       /* ISM in progress */
961 #define WL_DFS_CACSTATE_CSA             3       /* csa */
962 #define WL_DFS_CACSTATE_POSTISM_CAC     4       /* ISM CAC */
963 #define WL_DFS_CACSTATE_PREISM_OOC      5       /* PREISM OOC */
964 #define WL_DFS_CACSTATE_POSTISM_OOC     6       /* POSTISM OOC */
965 #define WL_DFS_CACSTATES                7       /* this many states exist */
966
967 /* data structure used in 'dfs_status' wl interface, which is used to query dfs status */
968 typedef struct {
969         uint state;             /* noted by WL_DFS_CACSTATE_XX. */
970         uint duration;          /* time spent in ms in state. */
971         /* as dfs enters ISM state, it removes the operational channel from quiet channel list
972          * and notes the channel in channel_cleared. set to 0 if no channel is cleared
973          */
974         uint channel_cleared;
975 } wl_dfs_status_t;
976
977 #define NUM_PWRCTRL_RATES 12
978  
979  
980 /* 802.11h enforcement levels */
981 #define SPECT_MNGMT_OFF         0               /* 11h disabled */
982 #define SPECT_MNGMT_LOOSE       1               /* allow scan lists to contain non-11h AP */
983 #define SPECT_MNGMT_STRICT      2               /* prune out non-11h APs from scan list */
984 #define SPECT_MNGMT_11D         3               /* switch to 802.11D mode */
985
986 #define WL_CHAN_VALID_HW        (1 << 0)        /* valid with current HW */
987 #define WL_CHAN_VALID_SW        (1 << 1)        /* valid with current country setting */
988 #define WL_CHAN_BAND_A          (1 << 2)        /* A-band channel */
989 #define WL_CHAN_RADAR           (1 << 3)        /* radar sensitive  channel */
990 #define WL_CHAN_INACTIVE        (1 << 4)        /* temporarily out of service due to radar */
991 #define WL_CHAN_RADAR_PASSIVE   (1 << 5)        /* radar channel is in passive mode */
992
993 #define WL_MPC_VAL              0x00400000
994 #define WL_APSTA_VAL            0x00800000
995 #define WL_DFS_VAL              0x01000000
996
997
998 /* max # of leds supported by GPIO (gpio pin# == led index#) */
999 #define WL_LED_NUMGPIO          16      /* gpio 0-15 */
1000
1001 /* led per-pin behaviors */
1002 #define WL_LED_OFF              0               /* always off */
1003 #define WL_LED_ON               1               /* always on */
1004 #define WL_LED_ACTIVITY         2               /* activity */
1005 #define WL_LED_RADIO            3               /* radio enabled */
1006 #define WL_LED_ARADIO           4               /* 5  Ghz radio enabled */
1007 #define WL_LED_BRADIO           5               /* 2.4Ghz radio enabled */
1008 #define WL_LED_BGMODE           6               /* on if gmode, off if bmode */
1009 #define WL_LED_WI1              7               
1010 #define WL_LED_WI2              8               
1011 #define WL_LED_WI3              9               
1012 #define WL_LED_ASSOC            10              /* associated state indicator */
1013 #define WL_LED_INACTIVE         11              /* null behavior (clears default behavior) */
1014 #define WL_LED_NUMBEHAVIOR      12
1015
1016 /* led behavior numeric value format */
1017 #define WL_LED_BEH_MASK         0x7f            /* behavior mask */
1018 #define WL_LED_AL_MASK          0x80            /* activelow (polarity) bit */
1019
1020
1021 /* maximum channels */
1022 #define WL_NUMCHANNELS  64      /* max # of channels in the band */
1023
1024 /* rate check */
1025 #define WL_RATE_OFDM(r)         (((r) & 0x7f) == 12 || ((r) & 0x7f) == 18 || \
1026                                  ((r) & 0x7f) == 24 || ((r) & 0x7f) == 36 || \
1027                                  ((r) & 0x7f) == 48 || ((r) & 0x7f) == 72 || \
1028                                  ((r) & 0x7f) == 96 || ((r) & 0x7f) == 108)
1029
1030 /* WDS link local endpoint WPA role */
1031 #define WL_WDS_WPA_ROLE_AUTH    0       /* authenticator */
1032 #define WL_WDS_WPA_ROLE_SUP     1       /* supplicant */
1033 #define WL_WDS_WPA_ROLE_AUTO    255     /* auto, based on mac addr value */
1034
1035 /* afterburner_override */
1036 #define ABO_AUTO                -1      /* auto - no override */
1037 #define ABO_OFF                 0       /* force afterburner off */
1038 #define ABO_ON                  1       /* force afterburner on */
1039
1040 #define GMODE_AFTERBURNER 6
1041
1042 /* number of bytes needed to define a 128-bit mask for MAC event reporting */
1043 #define WL_EVENTING_MASK_LEN    16
1044
1045 /* Structures and constants used for "vndr_ie" IOVar interface */
1046 #define VNDR_IE_CMD_LEN         4       /* length of the set command string: "add", "del" (+ NULL) */
1047
1048 /* 802.11 Mgmt Packet flags */
1049 #define VNDR_IE_BEACON_FLAG     0x1
1050 #define VNDR_IE_PRBRSP_FLAG     0x2
1051 #define VNDR_IE_ASSOCRSP_FLAG   0x4
1052 #define VNDR_IE_AUTHRSP_FLAG    0x8
1053
1054 typedef struct {
1055         uint32 pktflag;                 /* bitmask indicating which packet(s) contain this IE */
1056         vndr_ie_t vndr_ie_data;         /* vendor IE data */
1057 } vndr_ie_info_t;
1058
1059 typedef struct {
1060         int iecount;                    /* number of entries in the vndr_ie_list[] array */
1061         vndr_ie_info_t vndr_ie_list[1]; /* variable size list of vndr_ie_info_t structs */
1062 } vndr_ie_buf_t;
1063
1064 typedef struct {
1065         char cmd[VNDR_IE_CMD_LEN];      /* vndr_ie IOVar set command : "add", "del" + NULL */
1066         vndr_ie_buf_t vndr_ie_buffer;   /* buffer containing Vendor IE list information */
1067 } vndr_ie_setbuf_t;
1068
1069 /* join target preference types */
1070 #define WL_JOIN_PREF_RSSI       1       /* by RSSI, mandatory */
1071 #define WL_JOIN_PREF_WPA        2       /* by akm and ciphers, optional, RSN and WPA as values */
1072 #define WL_JOIN_PREF_BAND       3       /* by 802.11 band, optional, WLC_BAND_XXXX as values */
1073
1074 /* band preference */
1075 #define WLJP_BAND_ASSOC_PREF    255     /* use assoc preference settings */
1076                                         /* others use WLC_BAND_XXXX as values */
1077
1078 /* any multicast cipher suite */
1079 #define WL_WPA_ACP_MCS_ANY      "\x00\x00\x00\x00"
1080
1081 #if !defined(__GNUC__)
1082 #pragma pack(pop)
1083 #endif
1084
1085 #define NFIFO                           6       /* # tx/rx fifopairs */
1086
1087 #define WL_CNT_T_VERSION                1       /* current version of wl_cnt_t struct */
1088
1089 typedef struct {
1090         uint16  version;        /* see definition of WL_CNT_T_VERSION */        
1091         uint16  length;         /* length of entire structure */
1092
1093         /* transmit stat counters */
1094         uint32  txframe;        /* tx data frames */
1095         uint32  txbyte;         /* tx data bytes */
1096         uint32  txretrans;      /* tx mac retransmits */
1097         uint32  txerror;        /* tx data errors */
1098         uint32  txctl;          /* tx management frames */
1099         uint32  txprshort;      /* tx short preamble frames */
1100         uint32  txserr;         /* tx status errors */
1101         uint32  txnobuf;        /* tx out of buffers errors */
1102         uint32  txnoassoc;      /* tx discard because we're not associated */
1103         uint32  txrunt;         /* tx runt frames */
1104         uint32  txchit;         /* tx header cache hit (fastpath) */
1105         uint32  txcmiss;        /* tx header cache miss (slowpath) */
1106
1107         /* transmit chip error counters */
1108         uint32  txuflo;         /* tx fifo underflows */
1109         uint32  txphyerr;       /* tx phy errors (indicated in tx status) */
1110         uint32  txphycrs;       
1111
1112         /* receive stat counters */
1113         uint32  rxframe;        /* rx data frames */
1114         uint32  rxbyte;         /* rx data bytes */
1115         uint32  rxerror;        /* rx data errors */
1116         uint32  rxctl;          /* rx management frames */
1117         uint32  rxnobuf;        /* rx out of buffers errors */
1118         uint32  rxnondata;      /* rx non data frames in the data channel errors */
1119         uint32  rxbadds;        /* rx bad DS errors */
1120         uint32  rxbadcm;        /* rx bad control or management frames */
1121         uint32  rxfragerr;      /* rx fragmentation errors */
1122         uint32  rxrunt;         /* rx runt frames */
1123         uint32  rxgiant;        /* rx giant frames */
1124         uint32  rxnoscb;        /* rx no scb error */
1125         uint32  rxbadproto;     /* rx invalid frames */
1126         uint32  rxbadsrcmac;    /* rx frames with Invalid Src Mac*/
1127         uint32  rxbadda;        /* rx frames tossed for invalid da */
1128         uint32  rxfilter;       /* rx frames filtered out */
1129
1130         /* receive chip error counters */
1131         uint32  rxoflo;         /* rx fifo overflow errors */
1132         uint32  rxuflo[NFIFO];  /* rx dma descriptor underflow errors */
1133
1134         uint32  d11cnt_txrts_off;       /* d11cnt txrts value when reset d11cnt */
1135         uint32  d11cnt_rxcrc_off;       /* d11cnt rxcrc value when reset d11cnt */
1136         uint32  d11cnt_txnocts_off;     /* d11cnt txnocts value when reset d11cnt */
1137
1138         /* misc counters */
1139         uint32  dmade;          /* tx/rx dma descriptor errors */
1140         uint32  dmada;          /* tx/rx dma data errors */
1141         uint32  dmape;          /* tx/rx dma descriptor protocol errors */
1142         uint32  reset;          /* reset count */
1143         uint32  tbtt;           /* cnts the TBTT int's */
1144         uint32  txdmawar;       
1145
1146         /* MAC counters: 32-bit version of d11.h's macstat_t */
1147         uint32  txallfrm;       /* total number of frames sent, incl. Data, ACK, RTS, CTS, 
1148                                    Control Management (includes retransmissions) */
1149         uint32  txrtsfrm;       /* number of RTS sent out by the MAC */
1150         uint32  txctsfrm;       /* number of CTS sent out by the MAC */
1151         uint32  txackfrm;       /* number of ACK frames sent out */
1152         uint32  txdnlfrm;       /* Not used */
1153         uint32  txbcnfrm;       /* beacons transmitted */
1154         uint32  txfunfl[8];     /* per-fifo tx underflows */
1155         uint32  txtplunfl;      /* Template underflows (mac was too slow to transmit ACK/CTS or BCN) */
1156         uint32  txphyerror;     /* Transmit phy error, type of error is reported in tx-status for
1157                                    driver enqueued frames*/
1158         uint32  rxfrmtoolong;   /* Received frame longer than legal limit (2346 bytes) */
1159         uint32  rxfrmtooshrt;   /* Received frame did not contain enough bytes for its frame type */
1160         uint32  rxinvmachdr;    /* Either the protocol version != 0 or frame type not
1161                                    data/control/management*/
1162         uint32  rxbadfcs;       /* number of frames for which the CRC check failed in the MAC */
1163         uint32  rxbadplcp;      /* parity check of the PLCP header failed */
1164         uint32  rxcrsglitch;    /* PHY was able to correlate the preamble but not the header */
1165         uint32  rxstrt;         /* Number of received frames with a good PLCP (i.e. passing parity check) */
1166         uint32  rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */
1167         uint32  rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
1168         uint32  rxcfrmucast;    /* number of received CNTRL frames with good FCS and matching RA */
1169         uint32  rxrtsucast;     /* number of unicast RTS addressed to the MAC (good FCS) */
1170         uint32  rxctsucast;     /* number of unicast CTS addressed to the MAC (good FCS)*/
1171         uint32  rxackucast;     /* number of ucast ACKS received (good FCS)*/
1172         uint32  rxdfrmocast;    /* number of received DATA frames with good FCS and not matching RA */
1173         uint32  rxmfrmocast;    /* number of received MGMT frames with good FCS and not matching RA */
1174         uint32  rxcfrmocast;    /* number of received CNTRL frame with good FCS and not matching RA */
1175         uint32  rxrtsocast;     /* number of received RTS not addressed to the MAC */
1176         uint32  rxctsocast;     /* number of received CTS not addressed to the MAC */
1177         uint32  rxdfrmmcast;    /* number of RX Data multicast frames received by the MAC */
1178         uint32  rxmfrmmcast;    /* number of RX Management multicast frames received by the MAC */
1179         uint32  rxcfrmmcast;    /* number of RX Control multicast frames received by the MAC (unlikely
1180                                    to see these) */
1181         uint32  rxbeaconmbss;   /* beacons received from member of BSS */
1182         uint32  rxdfrmucastobss; /* number of unicast frames addressed to the MAC from other BSS (WDS FRAME) */
1183         uint32  rxbeaconobss;   /* beacons received from other BSS */
1184         uint32  rxrsptmout;     /* Number of response timeouts for transmitted frames expecting a
1185                                    response */
1186         uint32  bcntxcancl;     /* transmit beacons cancelled due to receipt of beacon (IBSS) */
1187         uint32  rxf0ovfl;       /* Number of receive fifo 0 overflows */
1188         uint32  rxf1ovfl;       /* Number of receive fifo 1 overflows (obsolete) */
1189         uint32  rxf2ovfl;       /* Number of receive fifo 2 overflows (obsolete) */
1190         uint32  txsfovfl;       /* Number of transmit status fifo overflows (obsolete) */
1191         uint32  pmqovfl;        /* Number of PMQ overflows */
1192         uint32  rxcgprqfrm;     /* Number of received Probe requests that made it into the PRQ fifo */
1193         uint32  rxcgprsqovfl;   /* Rx Probe Request Que overflow in the AP */
1194         uint32  txcgprsfail;    /* Tx Probe Response Fail. AP sent probe response but did not get ACK */
1195         uint32  txcgprssuc;     /* Tx Probe Rresponse Success (ACK was received) */
1196         uint32  prs_timeout;    /* Number of probe requests that were dropped from the PRQ fifo because
1197                                    a probe response could not be sent out within the time limit defined
1198                                    in M_PRS_MAXTIME */
1199         uint32  rxnack;         /* Number of NACKS received (Afterburner) */
1200         uint32  frmscons;       /* Number of frames completed without transmission because of an
1201                                    Afterburner re-queue */
1202         uint32  txnack;         /* Number of NACKs transmtitted  (Afterburner) */
1203         uint32  txglitch_nack;  /* obsolete */
1204         uint32  txburst;        /* obsolete */
1205         uint32  rxburst;        /* obsolete */
1206
1207         /* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
1208         uint32  txfrag;         /* dot11TransmittedFragmentCount */
1209         uint32  txmulti;        /* dot11MulticastTransmittedFrameCount */
1210         uint32  txfail;         /* dot11FailedCount */
1211         uint32  txretry;        /* dot11RetryCount */
1212         uint32  txretrie;       /* dot11MultipleRetryCount */
1213         uint32  rxdup;          /* dot11FrameduplicateCount */
1214         uint32  txrts;          /* dot11RTSSuccessCount */
1215         uint32  txnocts;        /* dot11RTSFailureCount */
1216         uint32  txnoack;        /* dot11ACKFailureCount */
1217         uint32  rxfrag;         /* dot11ReceivedFragmentCount */
1218         uint32  rxmulti;        /* dot11MulticastReceivedFrameCount */
1219         uint32  rxcrc;          /* dot11FCSErrorCount */
1220         uint32  txfrmsnt;       /* dot11TransmittedFrameCount (bogus MIB?) */
1221         uint32  rxundec;        /* dot11WEPUndecryptableCount */
1222
1223         /* WPA2 counters (see rxundec for DecryptFailureCount) */
1224         uint32  tkipmicfaill;   /* TKIPLocalMICFailures */
1225         uint32  tkipcntrmsr;    /* TKIPCounterMeasuresInvoked */
1226         uint32  tkipreplay;     /* TKIPReplays */
1227         uint32  ccmpfmterr;     /* CCMPFormatErrors */
1228         uint32  ccmpreplay;     /* CCMPReplays */
1229         uint32  ccmpundec;      /* CCMPDecryptErrors */
1230         uint32  fourwayfail;    /* FourWayHandshakeFailures */
1231         uint32  wepundec;       /* dot11WEPUndecryptableCount */
1232         uint32  wepicverr;      /* dot11WEPICVErrorCount */
1233         uint32  decsuccess;     /* DecryptSuccessCount */
1234         uint32  tkipicverr;     /* TKIPICVErrorCount */
1235         uint32  wepexcluded;    /* dot11WEPExcludedCount */
1236 } wl_cnt_t;
1237
1238 #endif /* _wlioctl_h_ */