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