make broadcom-wl robust against implicit kernel config changes (e.g. netfilter),...
[openwrt.git] / package / broadcom-wl / src / 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 2006, 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: wlioctl.h,v 1.1.1.22 2006/04/15 01:29:08 michael Exp $
16  */
17
18 #ifndef _wlioctl_h_
19 #define _wlioctl_h_
20
21 #include <typedefs.h>
22 #include <proto/ethernet.h>
23 #include <proto/bcmeth.h>
24 #include <proto/bcmevent.h>
25 #include <proto/802.11.h>
26
27 #ifdef __NetBSD__
28 /* NetBSD 2.0 does not have SIOCDEVPRIVATE. This is NetBSD 2.0 specific */
29 #define SIOCDEVPRIVATE  _IOWR('i', 139, struct ifreq)
30 #endif
31
32 /* require default structure packing */
33 #if !defined(__GNUC__)
34 #pragma pack(push, 8)
35 #endif
36
37 /* A chanspec holds the channel number, band, bandwidth and control sideband */
38 typedef uint16 chanspec_t;
39 #define WL_CHANSPEC_CHAN_MASK           0x00ff
40
41 #define WL_CHANSPEC_CTL_SB_MASK         0x0300
42 #define WL_CHANSPEC_CTL_SB_SHIFT             8
43 #define WL_CHANSPEC_CTL_SB_LOWER        0x0100
44 #define WL_CHANSPEC_CTL_SB_UPPER        0x0200
45 #define WL_CHANSPEC_CTL_SB_NONE         0x0300
46
47 #define WL_CHANSPEC_BW_MASK             0x0C00
48 #define WL_CHANSPEC_BW_SHIFT                10
49 #define WL_CHANSPEC_BW_10               0x0400
50 #define WL_CHANSPEC_BW_20               0x0800
51 #define WL_CHANSPEC_BW_40               0x0C00
52
53 #define WL_CHANSPEC_BAND_MASK           0xf000
54 #define WL_CHANSPEC_BAND_SHIFT          12
55 #define WL_CHANSPEC_BAND_5G             0x1000
56 #define WL_CHANSPEC_BAND_2G             0x2000
57 #define INVCHANSPEC     255
58
59 /* Legacy structure to help keep backward compatible wl tool and tray app */
60
61 #define LEGACY_WL_BSS_INFO_VERSION      107     /* older version of wl_bss_info struct */
62
63 typedef struct wl_bss_info_107 {
64         uint32          version;                /* version field */
65         uint32          length;                 /* byte length of data in this record,
66                                                  * starting at version and including IEs
67                                                  */
68         struct ether_addr BSSID;
69         uint16          beacon_period;          /* units are Kusec */
70         uint16          capability;             /* Capability information */
71         uint8           SSID_len;
72         uint8           SSID[32];
73         struct {
74                 uint    count;                  /* # rates in this set */
75                 uint8   rates[16];              /* rates in 500kbps units w/hi bit set if basic */
76         } rateset;                              /* supported rates */
77         uint8           channel;                /* Channel no. */
78         uint16          atim_window;            /* units are Kusec */
79         uint8           dtim_period;            /* DTIM period */
80         int16           RSSI;                   /* receive signal strength (in dBm) */
81         int8            phy_noise;              /* noise (in dBm) */
82         uint32          ie_length;              /* byte length of Information Elements */
83         /* variable length Information Elements */
84 } wl_bss_info_107_t;
85
86 /*
87  * Per-bss information structure.
88  */
89
90 #define WL_BSS_INFO_VERSION     108             /* current version of wl_bss_info struct */
91
92 /* BSS info structure
93  * Applications MUST CHECK ie_offset field and length field to access IEs and
94  * next bss_info structure in a vector (in wl_scan_results_t)
95  */
96 typedef struct wl_bss_info {
97         uint32          version;                /* version field */
98         uint32          length;                 /* byte length of data in this record,
99                                                  * starting at version and including IEs
100                                                  */
101         struct ether_addr BSSID;
102         uint16          beacon_period;          /* units are Kusec */
103         uint16          capability;             /* Capability information */
104         uint8           SSID_len;
105         uint8           SSID[32];
106         struct {
107                 uint    count;                  /* # rates in this set */
108                 uint8   rates[16];              /* rates in 500kbps units w/hi bit set if basic */
109         } rateset;                              /* supported rates */
110         chanspec_t      chanspec;               /* chanspec for bss */
111         uint16          atim_window;            /* units are Kusec */
112         uint8           dtim_period;            /* DTIM period */
113         int16           RSSI;                   /* receive signal strength (in dBm) */
114         int8            phy_noise;              /* noise (in dBm) */
115
116         bool            n_cap;                  /* BSS is 802.11N Capable */
117         uint32          nbss_cap;               /* 802.11N BSS Capabilities (based on EWC_CAP_*) */
118         uint8           ctl_ch;                 /* 802.11N BSS control channel number */
119         uint32          reserved[2];            /* Reserved for expansion of BSS properties */
120         uint8           basic_mcs[MCSSET_LEN];  /* 802.11N BSS required MCS set */
121
122         uint16          ie_offset;              /* offset at which IEs start, from beginning */
123         uint32          ie_length;              /* byte length of Information Elements */
124         /* Add new fields here */
125         /* variable length Information Elements */
126 } wl_bss_info_t;
127
128 typedef struct wlc_ssid {
129         uint32          SSID_len;
130         uchar           SSID[32];
131 } wlc_ssid_t;
132
133 typedef struct wl_scan_params {
134         wlc_ssid_t ssid;                /* default: {0, ""} */
135         struct ether_addr bssid;        /* default: bcast */
136         int8 bss_type;                  /* default: any,
137                                          * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
138                                          */
139         int8 scan_type;                 /* -1 use default, DOT11_SCANTYPE_ACTIVE/PASSIVE */
140         int32 nprobes;                  /* -1 use default, number of probes per channel */
141         int32 active_time;              /* -1 use default, dwell time per channel for
142                                          * active scanning
143                                          */
144         int32 passive_time;             /* -1 use default, dwell time per channel
145                                          * for passive scanning
146                                          */
147         int32 home_time;                /* -1 use default, dwell time for the home channel
148                                          * between channel scans
149                                          */
150         int32 channel_num;              /* 0 use default (all available channels), count of
151                                          * channels in channel_list
152                                          */
153         uint16 channel_list[1];         /* list of chanspecs */
154 } wl_scan_params_t;
155 /* size of wl_scan_params not including variable length array */
156 #define WL_SCAN_PARAMS_FIXED_SIZE 64
157
158 typedef struct wl_scan_results {
159         uint32 buflen;
160         uint32 version;
161         uint32 count;
162         wl_bss_info_t bss_info[1];
163 } wl_scan_results_t;
164 /* size of wl_scan_results not including variable length array */
165 #define WL_SCAN_RESULTS_FIXED_SIZE 12
166
167
168 #define WL_NUMRATES             255     /* max # of rates in a rateset */
169 typedef struct wl_rateset {
170         uint32  count;                  /* # rates in this set */
171         uint8   rates[WL_NUMRATES];     /* rates in 500kbps units w/hi bit set if basic */
172 } wl_rateset_t;
173
174 /* uint32 list */
175 typedef struct wl_uint32_list {
176         /* in - # of elements, out - # of entries */
177         uint32 count;
178         /* variable length uint32 list */
179         uint32 element[1];
180 } wl_uint32_list_t;
181
182 #define WLC_CNTRY_BUF_SZ        4               /* Country string is 3 bytes + NULL */
183
184 /* defines used by the nrate iovar */
185 #define NRATE_MCS_INUSE 0x00000080      /* MSC in use,indicates b0-6 holds an mcs */
186 #define NRATE_RATE_MASK 0x0000007f      /* rate/mcs value */
187 #define NRATE_STF_MASK  0x0000ff00      /* stf mode mask: siso, cdd, stbc, sdm */
188 #define NRATE_STF_SHIFT 8               /* stf mode shift */
189
190 #define ANTENNA_NUM_1   1               /* total number of antennas to be used */
191 #define ANTENNA_NUM_2   2
192 #define ANTENNA_NUM_3   3
193 #define ANTENNA_NUM_4   4
194
195 typedef struct wl_channels_in_country {
196         uint32 buflen;
197         uint32 band;
198         char country_abbrev[WLC_CNTRY_BUF_SZ];
199         uint32 count;
200         uint32 channel[1];
201 } wl_channels_in_country_t;
202
203 typedef struct wl_country_list {
204         uint32 buflen;
205         uint32 band_set;
206         uint32 band;
207         uint32 count;
208         char country_abbrev[1];
209 } wl_country_list_t;
210
211 #define WL_RM_TYPE_BASIC        1
212 #define WL_RM_TYPE_CCA          2
213 #define WL_RM_TYPE_RPI          3
214
215 #define WL_RM_FLAG_PARALLEL     (1<<0)
216
217 #define WL_RM_FLAG_LATE         (1<<1)
218 #define WL_RM_FLAG_INCAPABLE    (1<<2)
219 #define WL_RM_FLAG_REFUSED      (1<<3)
220
221 typedef struct wl_rm_req_elt {
222         int8    type;
223         int8    flags;
224         chanspec_t      chanspec;
225         uint32  token;          /* token for this measurement */
226         uint32  tsf_h;          /* TSF high 32-bits of Measurement start time */
227         uint32  tsf_l;          /* TSF low 32-bits */
228         uint32  dur;            /* TUs */
229 } wl_rm_req_elt_t;
230
231 typedef struct wl_rm_req {
232         uint32  token;          /* overall measurement set token */
233         uint32  count;          /* number of measurement requests */
234         wl_rm_req_elt_t req[1]; /* variable length block of requests */
235 } wl_rm_req_t;
236 #define WL_RM_REQ_FIXED_LEN     8
237
238 typedef struct wl_rm_rep_elt {
239         int8    type;
240         int8    flags;
241         chanspec_t      chanspec;
242         uint32  token;          /* token for this measurement */
243         uint32  tsf_h;          /* TSF high 32-bits of Measurement start time */
244         uint32  tsf_l;          /* TSF low 32-bits */
245         uint32  dur;            /* TUs */
246         uint32  len;            /* byte length of data block */
247         uint8   data[1];        /* variable length data block */
248 } wl_rm_rep_elt_t;
249 #define WL_RM_REP_ELT_FIXED_LEN 24      /* length excluding data block */
250
251 #define WL_RPI_REP_BIN_NUM 8
252 typedef struct wl_rm_rpi_rep {
253         uint8   rpi[WL_RPI_REP_BIN_NUM];
254         int8    rpi_max[WL_RPI_REP_BIN_NUM];
255 } wl_rm_rpi_rep_t;
256
257 typedef struct wl_rm_rep {
258         uint32  token;          /* overall measurement set token */
259         uint32  len;            /* length of measurement report block */
260         wl_rm_rep_elt_t rep[1]; /* variable length block of reports */
261 } wl_rm_rep_t;
262 #define WL_RM_REP_FIXED_LEN     8
263
264
265 #if defined(BCMSUP_PSK)
266 typedef enum sup_auth_status {
267         WLC_SUP_DISCONNECTED = 0,
268         WLC_SUP_CONNECTING,
269         WLC_SUP_IDREQUIRED,
270         WLC_SUP_AUTHENTICATING,
271         WLC_SUP_AUTHENTICATED,
272         WLC_SUP_KEYXCHANGE,
273         WLC_SUP_KEYED,
274         WLC_SUP_TIMEOUT
275 } sup_auth_status_t;
276 #endif  /* BCMCCX | BCMSUP_PSK */
277
278 /* Enumerate crypto algorithms */
279 #define CRYPTO_ALGO_OFF                 0
280 #define CRYPTO_ALGO_WEP1                1
281 #define CRYPTO_ALGO_TKIP                2
282 #define CRYPTO_ALGO_WEP128              3
283 #define CRYPTO_ALGO_AES_CCM             4
284 #define CRYPTO_ALGO_AES_OCB_MSDU        5
285 #define CRYPTO_ALGO_AES_OCB_MPDU        6
286 #define CRYPTO_ALGO_NALG                7
287
288 #define WSEC_GEN_MIC_ERROR      0x0001
289 #define WSEC_GEN_REPLAY         0x0002
290
291 #define WL_SOFT_KEY     (1 << 0)        /* Indicates this key is using soft encrypt */
292 #define WL_PRIMARY_KEY  (1 << 1)        /* Indicates this key is the primary (ie tx) key */
293 #define WL_KF_RES_4     (1 << 4)        /* Reserved for backward compat */
294 #define WL_KF_RES_5     (1 << 5)        /* Reserved for backward compat */
295
296 typedef struct wl_wsec_key {
297         uint32          index;          /* key index */
298         uint32          len;            /* key length */
299         uint8           data[DOT11_MAX_KEY_SIZE];       /* key data */
300         uint32          pad_1[18];
301         uint32          algo;           /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
302         uint32          flags;          /* misc flags */
303         uint32          pad_2[2];
304         int             pad_3;
305         int             iv_initialized; /* has IV been initialized already? */
306         int             pad_4;
307         /* Rx IV */
308         struct {
309                 uint32  hi;             /* upper 32 bits of IV */
310                 uint16  lo;             /* lower 16 bits of IV */
311         } rxiv;
312         uint32          pad_5[2];
313         struct ether_addr ea;           /* per station */
314 } wl_wsec_key_t;
315
316 #define WSEC_MIN_PSK_LEN        8
317 #define WSEC_MAX_PSK_LEN        64
318
319 /* Flag for key material needing passhash'ing */
320 #define WSEC_PASSPHRASE         (1<<0)
321
322 /* receptacle for WLC_SET_WSEC_PMK parameter */
323 typedef struct {
324         ushort  key_len;                /* octets in key material */
325         ushort  flags;                  /* key handling qualification */
326         uint8   key[WSEC_MAX_PSK_LEN];  /* PMK material */
327 } wsec_pmk_t;
328
329 /* wireless security bitvec */
330 #define WEP_ENABLED             0x0001
331 #define TKIP_ENABLED            0x0002
332 #define AES_ENABLED             0x0004
333 #define WSEC_SWFLAG             0x0008
334 #define SES_OW_ENABLED          0x0040  /* to go into transition mode without setting wep */
335 #define FIPS_ENABLED    0x0080
336
337 /* WPA authentication mode bitvec */
338 #define WPA_AUTH_DISABLED       0x0000  /* Legacy (i.e., non-WPA) */
339 #define WPA_AUTH_NONE           0x0001  /* none (IBSS) */
340 #define WPA_AUTH_UNSPECIFIED    0x0002  /* over 802.1x */
341 #define WPA_AUTH_PSK            0x0004  /* Pre-shared key */
342 /* #define WPA_AUTH_8021X 0x0020 */     /* 802.1x, reserved */
343 #ifdef BCMWPA2
344 #define WPA2_AUTH_UNSPECIFIED   0x0040  /* over 802.1x */
345 #define WPA2_AUTH_PSK           0x0080  /* Pre-shared key */
346 #endif  /* BCMWPA2 */
347
348 #ifdef BCMWPA2
349 /* pmkid */
350 #define MAXPMKID                16      
351
352 typedef struct _pmkid
353 {
354         struct ether_addr       BSSID;
355         uint8                   PMKID[WPA2_PMKID_LEN];
356 } pmkid_t;
357
358 typedef struct _pmkid_list
359 {
360         uint32  npmkid;
361         pmkid_t pmkid[1];
362 } pmkid_list_t;
363
364 typedef struct _pmkid_cand {
365         struct ether_addr       BSSID;
366         uint8                   preauth;
367 } pmkid_cand_t;
368
369 typedef struct _pmkid_cand_list {
370         uint32  npmkid_cand;
371         pmkid_cand_t    pmkid_cand[1];
372 } pmkid_cand_list_t;
373 #endif  /* BCMWPA2 */
374
375 typedef struct wl_led_info {
376         uint32          index;          /* led index */
377         uint32          behavior;
378         bool            activehi;
379 } wl_led_info_t;
380
381 typedef struct wlc_assoc_info {
382         uint32          req_len;
383         uint32          resp_len;
384         uint32          flags;
385         struct dot11_assoc_req req;
386         struct ether_addr reassoc_bssid; /* used in reassoc's */
387         struct dot11_assoc_resp resp;
388 } wl_assoc_info_t;
389 /* flags */
390 #define WLC_ASSOC_REQ_IS_REASSOC 0x01 /* assoc req was actually a reassoc */
391 /* srom read/write struct passed through ioctl */
392 typedef struct {
393         uint    byteoff;                /* byte offset */
394         uint    nbytes;         /* number of bytes */
395         uint16 buf[1];
396 } srom_rw_t;
397
398 /* R_REG and W_REG struct passed through ioctl */
399 typedef struct {
400         uint32  byteoff;        /* byte offset of the field in d11regs_t */
401         uint32  val;            /* read/write value of the field */
402         uint32  size;           /* sizeof the field */
403         uint    band;           /* band (optional) */
404 } rw_reg_t;
405
406 /* Structure used by GET/SET_ATTEN ioctls - it controls power in b/g-band */
407 /* PCL - Power Control Loop */
408 /* current gain setting is replaced by user input */
409 #define WL_ATTEN_APP_INPUT_PCL_OFF      0       /* turn off PCL, apply supplied input */
410 #define WL_ATTEN_PCL_ON                 1       /* turn on PCL */
411 /* current gain setting is maintained */
412 #define WL_ATTEN_PCL_OFF                2       /* turn off PCL. */
413 typedef struct {
414         uint16  auto_ctrl;      /* WL_ATTEN_XX */
415         uint16  bb;             /* Baseband attenuation */
416         uint16  radio;          /* Radio attenuation */
417         uint16  txctl1;         /* Radio TX_CTL1 value */
418 } atten_t;
419
420 /* defines used by poweridx iovar - it controls power in a-band */
421 /* current gain setting is maintained */
422 #define WL_PWRIDX_PCL_OFF       -2      /* turn off PCL.  */
423 #define WL_PWRIDX_PCL_ON        -1      /* turn on PCL */
424 #define WL_PWRIDX_LOWER_LIMIT   -2      /* lower limit */
425 #define WL_PWRIDX_UPPER_LIMIT   63      /* upper limit */
426 /* value >= 0 causes
427  *      - input to be set to that value
428  *      - PCL to be off
429  */
430
431 /* Used to get specific STA parameters */
432 typedef struct {
433         uint32  val;
434         struct ether_addr ea;
435 } scb_val_t;
436
437
438 /* Event data type */
439 typedef struct wlc_event {
440         wl_event_msg_t event;           /* encapsulated event */
441         struct ether_addr *addr;        /* used to keep a trace of the potential present of
442                                          * an address in wlc_event_msg_t
443                                          */
444         void *data;                     /* used to hang additional data on an event */
445         struct wlc_event *next;         /* enables ordered list of pending events */
446 } wlc_event_t;
447
448 #define BCM_MAC_STATUS_INDICATION       (0x40010200L)
449
450 /* Please update the following when modifying this structure:
451  *    StaInfo Twiki page flags section - description of the sta_info_t struct
452  *    src/wl/exe/wlu.c - print of sta_info_t
453  * Pay attention to version if structure changes.
454  */
455 typedef struct {
456         uint16                  ver;            /* version of this struct */
457         uint16                  len;            /* length in bytes of this structure */
458         uint16                  cap;            /* sta's advertised capabilities */
459         uint32                  flags;          /* flags defined below */
460         uint32                  idle;           /* time since data pkt rx'd from sta */
461         struct ether_addr       ea;             /* Station address */
462         wl_rateset_t            rateset;        /* rateset in use */
463         uint32                  in;             /* seconds elapsed since associated */
464         uint32                  listen_interval_inms; /* Min Listen interval in ms for this STA */
465 } sta_info_t;
466
467 #define WL_STA_VER              2
468
469 /* Flags for sta_info_t indicating properties of STA */
470 #define WL_STA_BRCM             0x1             /* Running a Broadcom driver */
471 #define WL_STA_WME              0x2             /* WMM association */
472 #define WL_STA_ABCAP            0x4             /* Afterburner-capable */
473 #define WL_STA_AUTHE            0x8             /* Authenticated */
474 #define WL_STA_ASSOC            0x10            /* Associated */
475 #define WL_STA_AUTHO            0x20            /* Authorized */
476 #define WL_STA_WDS              0x40            /* Wireless Distribution System */
477 #define WL_STA_WDS_LINKUP       0x80            /* WDS traffic/probes flowing properly */
478 #define WL_STA_PS               0x100           /* STA is in power save mode from AP's viewpoint */
479 #define WL_STA_APSD_BE          0x200           /* APSD delv/trigger for AC_BE is default enabled */
480 #define WL_STA_APSD_BK          0x400           /* APSD delv/trigger for AC_BK is default enabled */
481 #define WL_STA_APSD_VI          0x800           /* APSD delv/trigger for AC_VI is default enabled */
482 #define WL_STA_APSD_VO          0x1000          /* APSD delv/trigger for AC_VO is default enabled */
483 #define WL_STA_N_CAP            0x2000          /* STA 802.11n capable */
484
485 #define WL_WDS_LINKUP           WL_STA_WDS_LINKUP       /* deprecated */
486
487 /*
488  * Country locale determines which channels are available to us.
489  */
490 typedef enum _wlc_locale {
491         WLC_WW = 0,     /* Worldwide */
492         WLC_THA,        /* Thailand */
493         WLC_ISR,        /* Israel */
494         WLC_JDN,        /* Jordan */
495         WLC_PRC,        /* China */
496         WLC_JPN,        /* Japan */
497         WLC_FCC,        /* USA */
498         WLC_EUR,        /* Europe */
499         WLC_USL,        /* US Low Band only */
500         WLC_JPH,        /* Japan High Band only */
501         WLC_ALL,        /* All the channels in this band */
502         WLC_11D,        /* Represents locale received by 11d beacons */
503         WLC_LAST_LOCALE,
504         WLC_UNDEFINED_LOCALE = 0xf
505 } wlc_locale_t;
506
507 /* channel encoding */
508 typedef struct channel_info {
509         int hw_channel;
510         int target_channel;
511         int scan_channel;
512 } channel_info_t;
513
514 /* For ioctls that take a list of MAC addresses */
515 struct maclist {
516         uint count;                     /* number of MAC addresses */
517         struct ether_addr ea[1];        /* variable length array of MAC addresses */
518 };
519
520 /* get pkt count struct passed through ioctl */
521 typedef struct get_pktcnt {
522         uint rx_good_pkt;
523         uint rx_bad_pkt;
524         uint tx_good_pkt;
525         uint tx_bad_pkt;
526 } get_pktcnt_t;
527
528 /* Linux network driver ioctl encoding */
529 typedef struct wl_ioctl {
530         uint cmd;       /* common ioctl definition */
531         void *buf;      /* pointer to user buffer */
532         uint len;       /* length of user buffer */
533         bool set;       /* get or set request (optional) */
534         uint used;      /* bytes read or written (optional) */
535         uint needed;    /* bytes needed (optional) */
536 } wl_ioctl_t;
537
538 /*
539  * Structure for passing hardware and software
540  * revision info up from the driver.
541  */
542 typedef struct wlc_rev_info {
543         uint            vendorid;       /* PCI vendor id */
544         uint            deviceid;       /* device id of chip */
545         uint            radiorev;       /* radio revision */
546         uint            chiprev;        /* chip revision */
547         uint            corerev;        /* core revision */
548         uint            boardid;        /* board identifier (usu. PCI sub-device id) */
549         uint            boardvendor;    /* board vendor (usu. PCI sub-vendor id) */
550         uint            boardrev;       /* board revision */
551         uint            driverrev;      /* driver version */
552         uint            ucoderev;       /* microcode version */
553         uint            bus;            /* bus type */
554         uint            chipnum;        /* chip number */
555 } wlc_rev_info_t;
556
557 #define WL_BRAND_MAX 10
558 typedef struct wl_instance_info {
559         uint instance;
560         char brand[WL_BRAND_MAX];
561 } wl_instance_info_t;
562
563 /* check this magic number */
564 #define WLC_IOCTL_MAGIC         0x14e46c77
565
566 /* bump this number if you change the ioctl interface */
567 #define WLC_IOCTL_VERSION       1
568
569 #define WLC_IOCTL_MAXLEN        8192            /* max length ioctl buffer required */
570 #define WLC_IOCTL_SMLEN         256             /* "small" length ioctl buffer required */
571
572 /* common ioctl definitions */
573 #define WLC_GET_MAGIC                           0
574 #define WLC_GET_VERSION                         1
575 #define WLC_UP                                  2
576 #define WLC_DOWN                                3
577 #define WLC_DUMP                                6
578 #define WLC_GET_MSGLEVEL                        7
579 #define WLC_SET_MSGLEVEL                        8
580 #define WLC_GET_PROMISC                         9
581 #define WLC_SET_PROMISC                         10
582 #define WLC_GET_RATE                            12
583 /* #define WLC_SET_RATE                         13 */ /* no longer supported */
584 #define WLC_GET_INSTANCE                        14
585 /* #define WLC_GET_FRAG                         15 */ /* no longer supported */
586 /* #define WLC_SET_FRAG                         16 */ /* no longer supported */
587 /* #define WLC_GET_RTS                          17 */ /* no longer supported */
588 /* #define WLC_SET_RTS                          18 */ /* no longer supported */
589 #define WLC_GET_INFRA                           19
590 #define WLC_SET_INFRA                           20
591 #define WLC_GET_AUTH                            21
592 #define WLC_SET_AUTH                            22
593 #define WLC_GET_BSSID                           23
594 #define WLC_SET_BSSID                           24
595 #define WLC_GET_SSID                            25
596 #define WLC_SET_SSID                            26
597 #define WLC_RESTART                             27
598 #define WLC_GET_CHANNEL                         29
599 #define WLC_SET_CHANNEL                         30
600 #define WLC_GET_SRL                             31
601 #define WLC_SET_SRL                             32
602 #define WLC_GET_LRL                             33
603 #define WLC_SET_LRL                             34
604 #define WLC_GET_PLCPHDR                         35
605 #define WLC_SET_PLCPHDR                         36
606 #define WLC_GET_RADIO                           37
607 #define WLC_SET_RADIO                           38
608 #define WLC_GET_PHYTYPE                         39
609 /* #define WLC_GET_WEP                          42 */ /* no longer supported */
610 /* #define WLC_SET_WEP                          43 */ /* no longer supported */
611 #define WLC_GET_KEY                             44
612 #define WLC_SET_KEY                             45
613 #define WLC_GET_REGULATORY                      46
614 #define WLC_SET_REGULATORY                      47
615 #define WLC_GET_PASSIVE                         48
616 #define WLC_SET_PASSIVE                         49
617 #define WLC_SCAN                                50
618 #define WLC_SCAN_RESULTS                        51
619 #define WLC_DISASSOC                            52
620 #define WLC_REASSOC                             53
621 #define WLC_GET_ROAM_TRIGGER                    54
622 #define WLC_SET_ROAM_TRIGGER                    55
623 #define WLC_GET_TXANT                           61
624 #define WLC_SET_TXANT                           62
625 #define WLC_GET_ANTDIV                          63
626 #define WLC_SET_ANTDIV                          64
627 /* #define WLC_GET_TXPWR                        65 */ /* no longer supported */
628 /* #define WLC_SET_TXPWR                        66 */ /* no longer supported */
629 #define WLC_GET_CLOSED                          67
630 #define WLC_SET_CLOSED                          68
631 #define WLC_GET_MACLIST                         69
632 #define WLC_SET_MACLIST                         70
633 #define WLC_GET_RATESET                         71
634 #define WLC_SET_RATESET                         72
635 #define WLC_GET_LOCALE                          73
636 #define WLC_LONGTRAIN                           74
637 #define WLC_GET_BCNPRD                          75
638 #define WLC_SET_BCNPRD                          76
639 #define WLC_GET_DTIMPRD                         77
640 #define WLC_SET_DTIMPRD                         78
641 #define WLC_GET_SROM                            79
642 #define WLC_SET_SROM                            80
643 #define WLC_GET_WEP_RESTRICT                    81
644 #define WLC_SET_WEP_RESTRICT                    82
645 #define WLC_GET_COUNTRY                         83
646 #define WLC_SET_COUNTRY                         84
647 #define WLC_GET_PM                              85
648 #define WLC_SET_PM                              86
649 #define WLC_GET_WAKE                            87
650 #define WLC_SET_WAKE                            88
651 #define WLC_GET_D11CNTS                         89
652 #define WLC_GET_FORCELINK                       90      /* ndis only */
653 #define WLC_SET_FORCELINK                       91      /* ndis only */
654 #define WLC_FREQ_ACCURACY                       92
655 #define WLC_CARRIER_SUPPRESS                    93
656 #define WLC_GET_PHYREG                          94
657 #define WLC_SET_PHYREG                          95
658 #define WLC_GET_RADIOREG                        96
659 #define WLC_SET_RADIOREG                        97
660 #define WLC_GET_REVINFO                         98
661 #define WLC_GET_UCANTDIV                        99
662 #define WLC_SET_UCANTDIV                        100
663 #define WLC_R_REG                               101
664 #define WLC_W_REG                               102
665 #define WLC_DIAG_LOOPBACK                       103
666 #define WLC_RESET_D11CNTS                       104
667 #define WLC_GET_MACMODE                         105
668 #define WLC_SET_MACMODE                         106
669 #define WLC_GET_MONITOR                         107
670 #define WLC_SET_MONITOR                         108
671 #define WLC_GET_GMODE                           109
672 #define WLC_SET_GMODE                           110
673 #define WLC_GET_LEGACY_ERP                      111
674 #define WLC_SET_LEGACY_ERP                      112
675 #define WLC_GET_RX_ANT                          113
676 #define WLC_GET_CURR_RATESET                    114     /* current rateset */
677 #define WLC_GET_SCANSUPPRESS                    115
678 #define WLC_SET_SCANSUPPRESS                    116
679 #define WLC_GET_AP                              117
680 #define WLC_SET_AP                              118
681 #define WLC_GET_EAP_RESTRICT                    119
682 #define WLC_SET_EAP_RESTRICT                    120
683 #define WLC_SCB_AUTHORIZE                       121
684 #define WLC_SCB_DEAUTHORIZE                     122
685 #define WLC_GET_WDSLIST                         123
686 #define WLC_SET_WDSLIST                         124
687 #define WLC_GET_ATIM                            125
688 #define WLC_SET_ATIM                            126
689 #define WLC_GET_RSSI                            127
690 #define WLC_GET_PHYANTDIV                       128
691 #define WLC_SET_PHYANTDIV                       129
692 #define WLC_AP_RX_ONLY                          130
693 #define WLC_GET_TX_PATH_PWR                     131
694 #define WLC_SET_TX_PATH_PWR                     132
695 #define WLC_GET_WSEC                            133
696 #define WLC_SET_WSEC                            134
697 #define WLC_GET_PHY_NOISE                       135
698 #define WLC_GET_BSS_INFO                        136
699 #define WLC_GET_PKTCNTS                         137
700 #define WLC_GET_LAZYWDS                         138
701 #define WLC_SET_LAZYWDS                         139
702 #define WLC_GET_BANDLIST                        140
703 #define WLC_GET_BAND                            141
704 #define WLC_SET_BAND                            142
705 #define WLC_SCB_DEAUTHENTICATE                  143
706 #define WLC_GET_SHORTSLOT                       144
707 #define WLC_GET_SHORTSLOT_OVERRIDE              145
708 #define WLC_SET_SHORTSLOT_OVERRIDE              146
709 #define WLC_GET_SHORTSLOT_RESTRICT              147
710 #define WLC_SET_SHORTSLOT_RESTRICT              148
711 #define WLC_GET_GMODE_PROTECTION                149
712 #define WLC_GET_GMODE_PROTECTION_OVERRIDE       150
713 #define WLC_SET_GMODE_PROTECTION_OVERRIDE       151
714 #define WLC_UPGRADE                             152
715 /* #define WLC_GET_MRATE                        153 */ /* no longer supported */
716 /* #define WLC_SET_MRATE                        154 */ /* no longer supported */
717 #define WLC_GET_ASSOCLIST                       159
718 #define WLC_GET_CLK                             160
719 #define WLC_SET_CLK                             161
720 #define WLC_GET_UP                              162
721 #define WLC_OUT                                 163
722 #define WLC_GET_WPA_AUTH                        164
723 #define WLC_SET_WPA_AUTH                        165
724 #define WLC_GET_PROTECTION_CONTROL              178
725 #define WLC_SET_PROTECTION_CONTROL              179
726 #define WLC_GET_PHYLIST                         180
727 #define WLC_GET_KEY_SEQ                         183
728 /* #define WLC_GET_GMODE_PROTECTION_CTS         198 */ /* no longer supported */
729 /* #define WLC_SET_GMODE_PROTECTION_CTS         199 */ /* no longer supported */
730 #define WLC_GET_PIOMODE                         203
731 #define WLC_SET_PIOMODE                         204
732 #define WLC_SET_LED                             209
733 #define WLC_GET_LED                             210
734 #define WLC_GET_CHANNEL_SEL                     215
735 #define WLC_START_CHANNEL_SEL                   216
736 #define WLC_GET_VALID_CHANNELS                  217
737 #define WLC_GET_FAKEFRAG                        218
738 #define WLC_SET_FAKEFRAG                        219
739 #define WLC_GET_WET                             230
740 #define WLC_SET_WET                             231
741 #define WLC_GET_KEY_PRIMARY                     235
742 #define WLC_SET_KEY_PRIMARY                     236
743 #define WLC_GET_RADAR                           242
744 #define WLC_SET_RADAR                           243
745 #define WLC_SET_SPECT_MANAGMENT                 244
746 #define WLC_GET_SPECT_MANAGMENT                 245
747 #define WLC_WDS_GET_REMOTE_HWADDR               246     /* handled in wl_linux.c/wl_vx.c */
748 #define WLC_SET_CS_SCAN_TIMER                   248
749 #define WLC_GET_CS_SCAN_TIMER                   249
750 #define WLC_SEND_PWR_CONSTRAINT                 254
751 #define WLC_CURRENT_PWR                         256
752 #define WLC_GET_CHANNELS_IN_COUNTRY             260
753 #define WLC_GET_COUNTRY_LIST                    261
754 #define WLC_GET_VAR                             262     /* get value of named variable */
755 #define WLC_SET_VAR                             263     /* set named variable to value */
756 #define WLC_NVRAM_GET                           264     /* deprecated */
757 #define WLC_NVRAM_SET                           265
758 #define WLC_SET_WSEC_PMK                        268
759 #define WLC_GET_AUTH_MODE                       269
760 #define WLC_SET_AUTH_MODE                       270
761 #define WLC_NDCONFIG_ITEM                       273     /* currently handled in wl_oid.c */
762 #define WLC_NVOTPW                              274
763 #define WLC_OTPW                                275
764 #define WLC_SET_LOCALE                          278
765 #define WLC_GET_ALLOW_MODE                      279
766 #define WLC_SET_ALLOW_MODE                      280
767 #define WLC_GET_DESIRED_BSSID                   281
768 #define WLC_SET_DESIRED_BSSID                   282
769 #define WLC_LAST                                283     /* do not change - use get_var/set_var */
770
771 /*
772  * Minor kludge alert:
773  * Duplicate a few definitions that irelay requires from epiioctl.h here
774  * so caller doesn't have to include this file and epiioctl.h .
775  * If this grows any more, it would be time to move these irelay-specific
776  * definitions out of the epiioctl.h and into a separate driver common file.
777  */
778 #ifndef EPICTRL_COOKIE
779 #define EPICTRL_COOKIE          0xABADCEDE
780 #endif
781
782 /* vx wlc ioctl's offset */
783 #define CMN_IOCTL_OFF 0x180
784
785 /*
786  * custom OID support
787  *
788  * 0xFF - implementation specific OID
789  * 0xE4 - first byte of Broadcom PCI vendor ID
790  * 0x14 - second byte of Broadcom PCI vendor ID
791  * 0xXX - the custom OID number
792  */
793
794 /* begin 0x1f values beyond the start of the ET driver range. */
795 #define WL_OID_BASE             0xFFE41420
796
797 /* NDIS overrides */
798 #define OID_WL_GETINSTANCE      (WL_OID_BASE + WLC_GET_INSTANCE)
799 #define OID_WL_NDCONFIG_ITEM (WL_OID_BASE + WLC_NDCONFIG_ITEM)
800
801 #define WL_DECRYPT_STATUS_SUCCESS       1
802 #define WL_DECRYPT_STATUS_FAILURE       2
803 #define WL_DECRYPT_STATUS_UNKNOWN       3
804
805 /* allows user-mode app to poll the status of USB image upgrade */
806 #define WLC_UPGRADE_SUCCESS                     0
807 #define WLC_UPGRADE_PENDING                     1
808
809 #ifdef CONFIG_USBRNDIS_RETAIL
810 /* struct passed in for WLC_NDCONFIG_ITEM */
811 typedef struct {
812         char *name;
813         void *param;
814 } ndconfig_item_t;
815 #endif
816
817 /* Bit masks for radio disabled status - returned by WL_GET_RADIO */
818 #define WL_RADIO_SW_DISABLE             (1<<0)
819 #define WL_RADIO_HW_DISABLE             (1<<1)
820 #define WL_RADIO_MPC_DISABLE            (1<<2)
821 #define WL_RADIO_COUNTRY_DISABLE        (1<<3)  /* some countries don't support any channel */
822
823 /* Override bit for WLC_SET_TXPWR.  if set, ignore other level limits */
824 #define WL_TXPWR_OVERRIDE       (1<<31)
825
826 /* "diag" iovar argument and error code */
827 #define WL_DIAG_INTERRUPT                       1       /* d11 loopback interrupt test */
828 #define WL_DIAG_MEMORY                          3       /* d11 memory test */
829 #define WL_DIAG_LED                             4       /* LED test */
830 #define WL_DIAG_REG                             5       /* d11/phy register test */
831 #define WL_DIAG_SROM                            6       /* srom read/crc test */
832 #define WL_DIAG_DMA                             7       /* DMA test */
833
834 #define WL_DIAGERR_SUCCESS                      0
835 #define WL_DIAGERR_FAIL_TO_RUN                  1       /* unable to run requested diag */
836 #define WL_DIAGERR_NOT_SUPPORTED                2       /* diag requested is not supported */
837 #define WL_DIAGERR_INTERRUPT_FAIL               3       /* loopback interrupt test failed */
838 #define WL_DIAGERR_LOOPBACK_FAIL                4       /* loopback data test failed */
839 #define WL_DIAGERR_SROM_FAIL                    5       /* srom read failed */
840 #define WL_DIAGERR_SROM_BADCRC                  6       /* srom crc failed */
841 #define WL_DIAGERR_REG_FAIL                     7       /* d11/phy register test failed */
842 #define WL_DIAGERR_MEMORY_FAIL                  8       /* d11 memory test failed */
843 #define WL_DIAGERR_NOMEM                        9       /* diag test failed due to no memory */
844 #define WL_DIAGERR_DMA_FAIL                     10      /* DMA test failed */
845
846 /* band types */
847 #define WLC_BAND_AUTO           0       /* auto-select */
848 #define WLC_BAND_5G             1       /* 5 Ghz */
849 #define WLC_BAND_2G             2       /* 2.4 Ghz */
850 #define WLC_BAND_ALL            3       /* all bands */
851
852 /* phy types (returned by WLC_GET_PHYTPE) */
853 #define WLC_PHY_TYPE_A          0
854 #define WLC_PHY_TYPE_B          1
855 #define WLC_PHY_TYPE_G          2
856 #define WLC_PHY_TYPE_N          4
857 #define WLC_PHY_TYPE_NULL       0xf
858
859 /* MAC list modes */
860 #define WLC_MACMODE_DISABLED    0       /* MAC list disabled */
861 #define WLC_MACMODE_DENY        1       /* Deny specified (i.e. allow unspecified) */
862 #define WLC_MACMODE_ALLOW       2       /* Allow specified (i.e. deny unspecified) */
863
864 /*
865  *
866  */
867 #define GMODE_LEGACY_B          0
868 #define GMODE_AUTO              1
869 #define GMODE_ONLY              2
870 #define GMODE_B_DEFERRED        3
871 #define GMODE_PERFORMANCE       4
872 #define GMODE_LRS               5
873 #define GMODE_MAX               6
874
875 /* values for PLCPHdr_override */
876 #define WLC_PLCP_AUTO   -1
877 #define WLC_PLCP_SHORT  0
878 #define WLC_PLCP_LONG   1
879
880 /* values for g_protection_override and n_protection_override */
881 #define WLC_PROTECTION_AUTO             -1
882 #define WLC_PROTECTION_OFF              0
883 #define WLC_PROTECTION_ON               1
884
885 /* values for g_protection_control and n_protection_control */
886 #define WLC_PROTECTION_CTL_OFF          0
887 #define WLC_PROTECTION_CTL_LOCAL        1
888 #define WLC_PROTECTION_CTL_OVERLAP      2
889
890 /* deprecated const names for g_protection_override */
891 #define WLC_G_PROTECTION_AUTO           WLC_PROTECTION_AUTO
892 #define WLC_G_PROTECTION_OFF            WLC_PROTECTION_OFF
893 #define WLC_G_PROTECTION_ON             WLC_PROTECTION_ON
894
895 /* deprecated const names for g_protection_control */
896 #define WLC_G_PROTECTION_CTL_OFF        WLC_PROTECTION_CTL_OFF
897 #define WLC_G_PROTECTION_CTL_LOCAL      WLC_PROTECTION_CTL_LOCAL
898 #define WLC_G_PROTECTION_CTL_OVERLAP    WLC_PROTECTION_CTL_OVERLAP
899
900 /* deprecated const names for get/set g_protection_control */
901 #define WLC_GET_GMODE_PROTECTION_CONTROL        WLC_GET_PROTECTION_CONTROL
902 #define WLC_SET_GMODE_PROTECTION_CONTROL        WLC_SET_PROTECTION_CONTROL
903
904 /* values for n_protection */
905 #define WLC_N_PROTECTION_OFF            0
906 #define WLC_N_PROTECTION_MIXEDMODE      1
907 #define WLC_N_PROTECTION_CTS            2
908
909 /* values for n_preamble_type */
910 #define WLC_N_PREAMBLE_MIXEDMODE        0
911 #define WLC_N_PREAMBLE_GF               1
912
913 /* Values for PM */
914 #define PM_OFF  0
915 #define PM_MAX  1
916 #define PM_FAST 2
917
918
919
920 typedef struct {
921         int npulses;    /* required number of pulses at n * t_int */
922         int ncontig;    /* required number of pulses at t_int */
923         int min_pw;     /* minimum pulse width (20 MHz clocks) */
924         int max_pw;     /* maximum pulse width (20 MHz clocks) */
925         uint16 thresh0; /* Radar detection, thresh 0 */
926         uint16 thresh1; /* Radar detection, thresh 1 */
927         int npulses_lp;  /* Radar detection, minimum long pulses */
928         int min_pw_lp; /* Minimum pulsewidth for long pulses */
929         int max_pw_lp; /* Maximum pulsewidth for long pulses */
930         int min_fm_lp; /* Minimum fm for long pulses */
931         int max_deltat_lp;  /* Maximum deltat for long pulses */
932         int min_deltat; /* Minimum spacing between pulses */
933 } wl_radar_args_t;
934
935 /* radar iovar SET defines */
936 #define WL_RADAR_DETECTOR_OFF           0       /* radar detector off */
937 #define WL_RADAR_DETECTOR_ON            1       /* radar detector on */
938 #define WL_RADAR_SIMULATED              2       /* force radar detector to declare
939                                                  * detection once
940                                                  */
941
942 /* dfs_status iovar-related defines */
943
944 /* cac - channel availability check,
945  * ism - in-service monitoring
946  * csa - channel switching announcement
947  */
948
949 /* cac state values */
950 #define WL_DFS_CACSTATE_IDLE            0       /* state for operating in non-radar channel */
951 #define WL_DFS_CACSTATE_PREISM_CAC      1       /* CAC in progress */
952 #define WL_DFS_CACSTATE_ISM             2       /* ISM in progress */
953 #define WL_DFS_CACSTATE_CSA             3       /* csa */
954 #define WL_DFS_CACSTATE_POSTISM_CAC     4       /* ISM CAC */
955 #define WL_DFS_CACSTATE_PREISM_OOC      5       /* PREISM OOC */
956 #define WL_DFS_CACSTATE_POSTISM_OOC     6       /* POSTISM OOC */
957 #define WL_DFS_CACSTATES                7       /* this many states exist */
958
959 /* data structure used in 'dfs_status' wl interface, which is used to query dfs status */
960 typedef struct {
961         uint state;             /* noted by WL_DFS_CACSTATE_XX. */
962         uint duration;          /* time spent in ms in state. */
963         /* as dfs enters ISM state, it removes the operational channel from quiet channel
964          * list and notes the channel in channel_cleared. set to 0 if no channel is cleared
965          */
966         chanspec_t chanspec_cleared;
967         /* chanspec cleared used to be a uint, add another to uint16 to maintain size */
968         uint16 pad;
969 } wl_dfs_status_t;
970
971 #define NUM_PWRCTRL_RATES 12
972
973 typedef struct tx_inst_power {
974 } tx_inst_power_t;
975
976
977 /* regulatory enforcement levels */
978 #define SPECT_MNGMT_OFF                 0               /* both 11h and 11d disabled */
979 #define SPECT_MNGMT_LOOSE_11H           1               /* allow non-11h APs in scan lists */
980 #define SPECT_MNGMT_STRICT_11H          2               /* prune out non-11h APs from scan list */
981 #define SPECT_MNGMT_STRICT_11D          3               /* switch to 802.11D mode */
982 /* SPECT_MNGMT_LOOSE_11H_D - same as SPECT_MNGMT_LOOSE with the exception that Country IE
983  * adoption is done irregardless of capability-spectrum_management
984  */
985 #define SPECT_MNGMT_LOOSE_11H_D         4               /* operation defined above */
986
987 #define WL_CHAN_VALID_HW        (1 << 0)        /* valid with current HW */
988 #define WL_CHAN_VALID_SW        (1 << 1)        /* valid with current country setting */
989 #define WL_CHAN_BAND_5G         (1 << 2)        /* 5GHz-band channel */
990 #define WL_CHAN_RADAR           (1 << 3)        /* radar sensitive  channel */
991 #define WL_CHAN_INACTIVE        (1 << 4)        /* temporarily inactive due to radar */
992 #define WL_CHAN_PASSIVE         (1 << 5)        /* channel is in passive mode */
993 #define WL_CHAN_RESTRICTED      (1 << 6)        /* restricted use channel */
994
995 /* BTC mode used by "btc_mode" iovar */
996 #define WL_BTC_DISABLE          0       /* disable BT coexistance */
997 #define WL_BTC_ENABLE           1       /* enable BT coexistance */
998 #define WL_BTC_PREMPT           2       /* enable BT coexistance and BT pre-emption */
999
1000 #define WL_MPC_VAL              0x00400000
1001 #define WL_APSTA_VAL            0x00800000
1002 #define WL_DFS_VAL              0x01000000
1003 #define WL_BA_VAL               0x02000000
1004 #define WL_NITRO_VAL            0x04000000
1005 #define WL_CAC_VAL              0x08000000
1006 #define WL_AMSDU_VAL            0x10000000
1007 #define WL_AMPDU_VAL            0x20000000
1008
1009 /* max # of leds supported by GPIO (gpio pin# == led index#) */
1010 #define WL_LED_NUMGPIO          16      /* gpio 0-15 */
1011
1012 /* led per-pin behaviors */
1013 #define WL_LED_OFF              0               /* always off */
1014 #define WL_LED_ON               1               /* always on */
1015 #define WL_LED_ACTIVITY         2               /* activity */
1016 #define WL_LED_RADIO            3               /* radio enabled */
1017 #define WL_LED_ARADIO           4               /* 5  Ghz radio enabled */
1018 #define WL_LED_BRADIO           5               /* 2.4Ghz radio enabled */
1019 #define WL_LED_BGMODE           6               /* on if gmode, off if bmode */
1020 #define WL_LED_WI1              7               
1021 #define WL_LED_WI2              8               
1022 #define WL_LED_WI3              9               
1023 #define WL_LED_ASSOC            10              /* associated state indicator */
1024 #define WL_LED_INACTIVE         11              /* null behavior (clears default behavior) */
1025 #define WL_LED_NUMBEHAVIOR      12
1026
1027 /* led behavior numeric value format */
1028 #define WL_LED_BEH_MASK         0x7f            /* behavior mask */
1029 #define WL_LED_AL_MASK          0x80            /* activelow (polarity) bit */
1030
1031 /* max # of channels returnd by the get valid channels iovar */
1032 #define WL_NUMCHANSPECS         100
1033
1034 /* WDS link local endpoint WPA role */
1035 #define WL_WDS_WPA_ROLE_AUTH    0       /* authenticator */
1036 #define WL_WDS_WPA_ROLE_SUP     1       /* supplicant */
1037 #define WL_WDS_WPA_ROLE_AUTO    255     /* auto, based on mac addr value */
1038
1039 /* number of bytes needed to define a 128-bit mask for MAC event reporting */
1040 #define WL_EVENTING_MASK_LEN    16
1041
1042 /* Structures and constants used for "vndr_ie" IOVar interface */
1043 #define VNDR_IE_CMD_LEN         4       /* length of the set command string:
1044                                          * "add", "del" (+ NULL)
1045                                          */
1046
1047 /* 802.11 Mgmt Packet flags */
1048 #define VNDR_IE_BEACON_FLAG     0x1
1049 #define VNDR_IE_PRBRSP_FLAG     0x2
1050 #define VNDR_IE_ASSOCRSP_FLAG   0x4
1051 #define VNDR_IE_AUTHRSP_FLAG    0x8
1052
1053 #define VNDR_IE_INFO_HDR_LEN    (sizeof(uint32))
1054
1055 typedef struct {
1056         uint32 pktflag;                 /* bitmask indicating which packet(s) contain this IE */
1057         vndr_ie_t vndr_ie_data;         /* vendor IE data */
1058 } vndr_ie_info_t;
1059
1060 typedef struct {
1061         int iecount;                    /* number of entries in the vndr_ie_list[] array */
1062         vndr_ie_info_t vndr_ie_list[1]; /* variable size list of vndr_ie_info_t structs */
1063 } vndr_ie_buf_t;
1064
1065 typedef struct {
1066         char cmd[VNDR_IE_CMD_LEN];      /* vndr_ie IOVar set command : "add", "del" + NULL */
1067         vndr_ie_buf_t vndr_ie_buffer;   /* buffer containing Vendor IE list information */
1068 } vndr_ie_setbuf_t;
1069
1070 /* join target preference types */
1071 #define WL_JOIN_PREF_RSSI       1       /* by RSSI, mandatory */
1072 #define WL_JOIN_PREF_WPA        2       /* by akm and ciphers, optional, RSN and WPA as values */
1073 #define WL_JOIN_PREF_BAND       3       /* by 802.11 band, optional, WLC_BAND_XXXX as values */
1074
1075 /* band preference */
1076 #define WLJP_BAND_ASSOC_PREF    255     /* use assoc preference settings */
1077                                         /* others use WLC_BAND_XXXX as values */
1078
1079 /* any multicast cipher suite */
1080 #define WL_WPA_ACP_MCS_ANY      "\x00\x00\x00\x00"
1081
1082 struct tsinfo_arg {
1083         uint8 octets[3];
1084 };
1085
1086 #if !defined(__GNUC__)
1087 #pragma pack(pop)
1088 #endif
1089
1090 #define NFIFO                   6       /* # tx/rx fifopairs */
1091
1092 #define WL_CNT_T_VERSION        1       /* current version of wl_cnt_t struct */
1093
1094 typedef struct {
1095         uint16  version;        /* see definition of WL_CNT_T_VERSION */
1096         uint16  length;         /* length of entire structure */
1097
1098         /* transmit stat counters */
1099         uint32  txframe;        /* tx data frames */
1100         uint32  txbyte;         /* tx data bytes */
1101         uint32  txretrans;      /* tx mac retransmits */
1102         uint32  txerror;        /* tx data errors (derived: sum of others) */
1103         uint32  txctl;          /* tx management frames */
1104         uint32  txprshort;      /* tx short preamble frames */
1105         uint32  txserr;         /* tx status errors */
1106         uint32  txnobuf;        /* tx out of buffers errors */
1107         uint32  txnoassoc;      /* tx discard because we're not associated */
1108         uint32  txrunt;         /* tx runt frames */
1109         uint32  txchit;         /* tx header cache hit (fastpath) */
1110         uint32  txcmiss;        /* tx header cache miss (slowpath) */
1111
1112         /* transmit chip error counters */
1113         uint32  txuflo;         /* tx fifo underflows */
1114         uint32  txphyerr;       /* tx phy errors (indicated in tx status) */
1115         uint32  txphycrs;       
1116
1117         /* receive stat counters */
1118         uint32  rxframe;        /* rx data frames */
1119         uint32  rxbyte;         /* rx data bytes */
1120         uint32  rxerror;        /* rx data errors (derived: sum of others) */
1121         uint32  rxctl;          /* rx management frames */
1122         uint32  rxnobuf;        /* rx out of buffers errors */
1123         uint32  rxnondata;      /* rx non data frames in the data channel errors */
1124         uint32  rxbadds;        /* rx bad DS errors */
1125         uint32  rxbadcm;        /* rx bad control or management frames */
1126         uint32  rxfragerr;      /* rx fragmentation errors */
1127         uint32  rxrunt;         /* rx runt frames */
1128         uint32  rxgiant;        /* rx giant frames */
1129         uint32  rxnoscb;        /* rx no scb error */
1130         uint32  rxbadproto;     /* rx invalid frames */
1131         uint32  rxbadsrcmac;    /* rx frames with Invalid Src Mac */
1132         uint32  rxbadda;        /* rx frames tossed for invalid da */
1133         uint32  rxfilter;       /* rx frames filtered out */
1134
1135         /* receive chip error counters */
1136         uint32  rxoflo;         /* rx fifo overflow errors */
1137         uint32  rxuflo[NFIFO];  /* rx dma descriptor underflow errors */
1138
1139         uint32  d11cnt_txrts_off;       /* d11cnt txrts value when reset d11cnt */
1140         uint32  d11cnt_rxcrc_off;       /* d11cnt rxcrc value when reset d11cnt */
1141         uint32  d11cnt_txnocts_off;     /* d11cnt txnocts value when reset d11cnt */
1142
1143         /* misc counters */
1144         uint32  dmade;          /* tx/rx dma descriptor errors */
1145         uint32  dmada;          /* tx/rx dma data errors */
1146         uint32  dmape;          /* tx/rx dma descriptor protocol errors */
1147         uint32  reset;          /* reset count */
1148         uint32  tbtt;           /* cnts the TBTT int's */
1149         uint32  txdmawar;       
1150         uint32  pkt_callback_reg_fail;  /* callbacks register failure */
1151
1152         /* MAC counters: 32-bit version of d11.h's macstat_t */
1153         uint32  txallfrm;       /* total number of frames sent, incl. Data, ACK, RTS, CTS,
1154                                  * Control Management (includes retransmissions)
1155                                  */
1156         uint32  txrtsfrm;       /* number of RTS sent out by the MAC */
1157         uint32  txctsfrm;       /* number of CTS sent out by the MAC */
1158         uint32  txackfrm;       /* number of ACK frames sent out */
1159         uint32  txdnlfrm;       /* Not used */
1160         uint32  txbcnfrm;       /* beacons transmitted */
1161         uint32  txfunfl[8];     /* per-fifo tx underflows */
1162         uint32  txtplunfl;      /* Template underflows (mac was too slow to transmit ACK/CTS
1163                                  * or BCN)
1164                                  */
1165         uint32  txphyerror;     /* Transmit phy error, type of error is reported in tx-status for
1166                                  * driver enqueued frames
1167                                  */
1168         uint32  rxfrmtoolong;   /* Received frame longer than legal limit (2346 bytes) */
1169         uint32  rxfrmtooshrt;   /* Received frame did not contain enough bytes for its frame type */
1170         uint32  rxinvmachdr;    /* Either the protocol version != 0 or frame type not
1171                                  * data/control/management
1172                                  */
1173         uint32  rxbadfcs;       /* number of frames for which the CRC check failed in the MAC */
1174         uint32  rxbadplcp;      /* parity check of the PLCP header failed */
1175         uint32  rxcrsglitch;    /* PHY was able to correlate the preamble but not the header */
1176         uint32  rxstrt;         /* Number of received frames with a good PLCP
1177                                  * (i.e. passing parity check)
1178                                  */
1179         uint32  rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */
1180         uint32  rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
1181         uint32  rxcfrmucast;    /* number of received CNTRL frames with good FCS and matching RA */
1182         uint32  rxrtsucast;     /* number of unicast RTS addressed to the MAC (good FCS) */
1183         uint32  rxctsucast;     /* number of unicast CTS addressed to the MAC (good FCS) */
1184         uint32  rxackucast;     /* number of ucast ACKS received (good FCS) */
1185         uint32  rxdfrmocast;    /* number of received DATA frames (good FCS and not matching RA) */
1186         uint32  rxmfrmocast;    /* number of received MGMT frames (good FCS and not matching RA) */
1187         uint32  rxcfrmocast;    /* number of received CNTRL frame (good FCS and not matching RA) */
1188         uint32  rxrtsocast;     /* number of received RTS not addressed to the MAC */
1189         uint32  rxctsocast;     /* number of received CTS not addressed to the MAC */
1190         uint32  rxdfrmmcast;    /* number of RX Data multicast frames received by the MAC */
1191         uint32  rxmfrmmcast;    /* number of RX Management multicast frames received by the MAC */
1192         uint32  rxcfrmmcast;    /* number of RX Control multicast frames received by the MAC
1193                                  * (unlikely to see these)
1194                                  */
1195         uint32  rxbeaconmbss;   /* beacons received from member of BSS */
1196         uint32  rxdfrmucastobss; /* number of unicast frames addressed to the MAC from
1197                                   * other BSS (WDS FRAME)
1198                                   */
1199         uint32  rxbeaconobss;   /* beacons received from other BSS */
1200         uint32  rxrsptmout;     /* Number of response timeouts for transmitted frames
1201                                  * expecting a response
1202                                  */
1203         uint32  bcntxcancl;     /* transmit beacons canceled due to receipt of beacon (IBSS) */
1204         uint32  rxf0ovfl;       /* Number of receive fifo 0 overflows */
1205         uint32  rxf1ovfl;       /* Number of receive fifo 1 overflows (obsolete) */
1206         uint32  rxf2ovfl;       /* Number of receive fifo 2 overflows (obsolete) */
1207         uint32  txsfovfl;       /* Number of transmit status fifo overflows (obsolete) */
1208         uint32  pmqovfl;        /* Number of PMQ overflows */
1209         uint32  rxcgprqfrm;     /* Number of received Probe requests that made it into
1210                                  * the PRQ fifo
1211                                  */
1212         uint32  rxcgprsqovfl;   /* Rx Probe Request Que overflow in the AP */
1213         uint32  txcgprsfail;    /* Tx Probe Response Fail. AP sent probe response but did
1214                                  * not get ACK
1215                                  */
1216         uint32  txcgprssuc;     /* Tx Probe Response Success (ACK was received) */
1217         uint32  prs_timeout;    /* Number of probe requests that were dropped from the PRQ
1218                                  * fifo because a probe response could not be sent out within
1219                                  * the time limit defined in M_PRS_MAXTIME
1220                                  */
1221         uint32  rxnack;         /* Number of NACKS received (Afterburner) */
1222         uint32  frmscons;       /* Number of frames completed without transmission because of an
1223                                  * Afterburner re-queue
1224                                  */
1225         uint32  txnack;         /* Number of NACKs transmitted (Afterburner) */
1226         uint32  txglitch_nack;  /* obsolete */
1227         uint32  txburst;        /* obsolete */
1228
1229         /* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
1230         uint32  txfrag;         /* dot11TransmittedFragmentCount */
1231         uint32  txmulti;        /* dot11MulticastTransmittedFrameCount */
1232         uint32  txfail;         /* dot11FailedCount */
1233         uint32  txretry;        /* dot11RetryCount */
1234         uint32  txretrie;       /* dot11MultipleRetryCount */
1235         uint32  rxdup;          /* dot11FrameduplicateCount */
1236         uint32  txrts;          /* dot11RTSSuccessCount */
1237         uint32  txnocts;        /* dot11RTSFailureCount */
1238         uint32  txnoack;        /* dot11ACKFailureCount */
1239         uint32  rxfrag;         /* dot11ReceivedFragmentCount */
1240         uint32  rxmulti;        /* dot11MulticastReceivedFrameCount */
1241         uint32  rxcrc;          /* dot11FCSErrorCount */
1242         uint32  txfrmsnt;       /* dot11TransmittedFrameCount (bogus MIB?) */
1243         uint32  rxundec;        /* dot11WEPUndecryptableCount */
1244
1245         /* WPA2 counters (see rxundec for DecryptFailureCount) */
1246         uint32  tkipmicfaill;   /* TKIPLocalMICFailures */
1247         uint32  tkipcntrmsr;    /* TKIPCounterMeasuresInvoked */
1248         uint32  tkipreplay;     /* TKIPReplays */
1249         uint32  ccmpfmterr;     /* CCMPFormatErrors */
1250         uint32  ccmpreplay;     /* CCMPReplays */
1251         uint32  ccmpundec;      /* CCMPDecryptErrors */
1252         uint32  fourwayfail;    /* FourWayHandshakeFailures */
1253         uint32  wepundec;       /* dot11WEPUndecryptableCount */
1254         uint32  wepicverr;      /* dot11WEPICVErrorCount */
1255         uint32  decsuccess;     /* DecryptSuccessCount */
1256         uint32  tkipicverr;     /* TKIPICVErrorCount */
1257         uint32  wepexcluded;    /* dot11WEPExcludedCount */
1258
1259         uint32  txchanrej;      /* Tx frames suppressed due to channel rejection */
1260         uint32  psmwds;         /* Count PSM watchdogs */
1261         uint32  phywatchdog;    /* Count Phy lockups */
1262 } wl_cnt_t;
1263
1264 #define WL_WME_CNT_VERSION      1       /* current version of wl_wme_cnt_t */
1265
1266 typedef struct {
1267         uint32 packets;
1268         uint32 bytes;
1269 } wl_traffic_stats_t;
1270
1271 typedef struct {
1272         uint16  version;        /* see definition of WL_CNT_T_VERSION */
1273         uint16  length;         /* length of entire structure */
1274
1275         wl_traffic_stats_t tx[AC_COUNT];        /* Packets transmitted */
1276         wl_traffic_stats_t tx_failed[AC_COUNT]; /* Packets dropped or failed to transmit */
1277         wl_traffic_stats_t rx[AC_COUNT];        /* Packets received */
1278         wl_traffic_stats_t rx_failed[AC_COUNT]; /* Packets failed to receive */
1279
1280         wl_traffic_stats_t forward[AC_COUNT];   /* Packets forwarded by AP */
1281
1282         wl_traffic_stats_t tx_expired[AC_COUNT];        /* packets dropped due to lifetime expiry */
1283
1284 } wl_wme_cnt_t;
1285
1286 #ifdef WLBA
1287
1288 #define WLC_BA_CNT_VERSION      1       /* current version of wlc_ba_cnt_t */
1289
1290 /* block ack related stats */
1291 typedef struct wlc_ba_cnt {
1292         uint16  version;        /* WLC_BA_CNT_VERSION */
1293         uint16  length;         /* length of entire structure */
1294
1295         /* transmit stat counters */
1296         uint32 txpdu;           /* pdus sent */
1297         uint32 txsdu;           /* sdus sent */
1298         uint32 txfc;            /* tx side flow controlled packets */
1299         uint32 txfci;           /* tx side flow control initiated */
1300         uint32 txretrans;       /* retransmitted pdus */
1301         uint32 txbatimer;       /* ba resend due to timer */
1302         uint32 txdrop;          /* dropped packets */
1303         uint32 txaddbareq;      /* addba req sent */
1304         uint32 txaddbaresp;     /* addba resp sent */
1305         uint32 txdelba;         /* delba sent */
1306         uint32 txba;            /* ba sent */
1307         uint32 txbar;           /* bar sent */
1308         uint32 txpad[4];        /* future */
1309
1310         /* receive side counters */
1311         uint32 rxpdu;           /* pdus recd */
1312         uint32 rxqed;           /* pdus buffered before sending up */
1313         uint32 rxdup;           /* duplicate pdus */
1314         uint32 rxnobuf;         /* pdus discarded due to no buf */
1315         uint32 rxaddbareq;      /* addba req recd */
1316         uint32 rxaddbaresp;     /* addba resp recd */
1317         uint32 rxdelba;         /* delba recd */
1318         uint32 rxba;            /* ba recd */
1319         uint32 rxbar;           /* bar recd */
1320         uint32 rxinvba;         /* invalid ba recd */
1321         uint32 rxbaholes;       /* ba recd with holes */
1322         uint32 rxunexp;         /* unexpected packets */
1323         uint32 rxpad[4];        /* future */
1324 } wlc_ba_cnt_t;
1325 #endif /* WLBA */
1326
1327 /* structure for per-tid ampdu control */
1328 struct ampdu_tid_control {
1329         uint8 tid;                      /* tid */
1330         uint8 enable;                   /* enable/disable */
1331 };
1332
1333 /* structure for addts arguments */
1334 /* For ioctls that take a list of TSPEC */
1335 struct tslist {
1336         int count;                      /* number of tspecs */
1337         struct tsinfo_arg tsinfo[1];    /* variable length array of tsinfo */
1338 };
1339
1340 /* structure for addts/delts arguments */
1341 typedef struct tspec_arg {
1342         uint16 version;                 /* see definition of TSPEC_ARG_VERSION */
1343         uint16 length;                  /* length of entire structure */
1344         uint flag;                      /* bit field */
1345         /* TSPEC Arguments */
1346         struct tsinfo_arg tsinfo;       /* TS Info bit field */
1347         uint16 nom_msdu_size;           /* (Nominal or fixed) MSDU Size (bytes) */
1348         uint16 max_msdu_size;           /* Maximum MSDU Size (bytes) */
1349         uint min_srv_interval;          /* Minimum Service Interval (us) */
1350         uint max_srv_interval;          /* Maximum Service Interval (us) */
1351         uint inactivity_interval;       /* Inactivity Interval (us) */
1352         uint suspension_interval;       /* Suspension Interval (us) */
1353         uint srv_start_time;            /* Service Start Time (us) */
1354         uint min_data_rate;             /* Minimum Data Rate (bps) */
1355         uint mean_data_rate;            /* Mean Data Rate (bps) */
1356         uint peak_data_rate;            /* Peak Data Rate (bps) */
1357         uint max_burst_size;            /* Maximum Burst Size (bytes) */
1358         uint delay_bound;               /* Delay Bound (us) */
1359         uint min_phy_rate;              /* Minimum PHY Rate (bps) */
1360         uint16 surplus_bw;              /* Surplus Bandwidth Allowance Factor */
1361         uint16 medium_time;             /* Medium Time (32 us/s periods) */
1362 } tspec_arg_t;
1363
1364 /* current version of wl_tspec_arg_t struct */
1365 #define TSPEC_ARG_VERSION       1       /* current version of wl_tspec_arg_t struct */
1366 #define TSPEC_ARG_LENGTH        55      /* argment length from tsinfo to medium_time */
1367
1368 /* define for flag */
1369 #define TSPEC_PENDING           0       /* TSPEC pending */
1370 #define TSPEC_ACCEPTED          1       /* TSPEC accepted */
1371 #define TSPEC_REJECTED          2       /* TSPEC rejected */
1372 #define TSPEC_UNKNOWN           3       /* TSPEC unknown */
1373 #define TSPEC_STATUS_MASK       7       /* TSPEC status mask */
1374
1375
1376 /* Software feature flag defines used by wlfeatureflag */
1377 #define WL_SWFL_ABBFL           0x0001 /* Allow Afterburner on systems w/o hardware BFL */
1378 #define WL_SWFL_ABENCORE        0x0002 /* Allow AB on non-4318E chips */
1379
1380 #define WL_LIFETIME_MAX 0xFFFF /* Max value in ms */
1381
1382 /* Packet lifetime configuration per ac */
1383 typedef struct wl_lifetime {
1384         uint32 ac;              /* access class */
1385         uint32 lifetime;    /* Packet lifetime value in ms */
1386 } wl_lifetime_t;
1387
1388 #endif /* _wlioctl_h_ */