Staging: brcm80211: s/uchar/unsigned char/
[pandora-kernel.git] / drivers / staging / brcm80211 / include / wlioctl.h
1 /*
2  * Copyright (c) 2010 Broadcom Corporation
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16
17 #ifndef _wlioctl_h_
18 #define _wlioctl_h_
19
20 #include <typedefs.h>
21 #include <proto/ethernet.h>
22 #ifdef BRCM_FULLMAC
23 #include <proto/bcmeth.h>
24 #endif
25 #include <proto/bcmevent.h>
26 #include <proto/802.11.h>
27 #include <bcmwifi.h>
28
29 #ifndef INTF_NAME_SIZ
30 #define INTF_NAME_SIZ   16
31 #endif
32
33 /* require default structure packing */
34 #define BWL_DEFAULT_PACKING
35 #include <packed_section_start.h>
36
37 /* Legacy structure to help keep backward compatible wl tool and tray app */
38
39 #define LEGACY_WL_BSS_INFO_VERSION      107     /* older version of wl_bss_info struct */
40
41 typedef struct wl_bss_info_107 {
42         uint32 version;         /* version field */
43         uint32 length;          /* byte length of data in this record,
44                                  * starting at version and including IEs
45                                  */
46         struct ether_addr BSSID;
47         uint16 beacon_period;   /* units are Kusec */
48         uint16 capability;      /* Capability information */
49         u8 SSID_len;
50         u8 SSID[32];
51         struct {
52                 uint count;     /* # rates in this set */
53                 u8 rates[16];   /* rates in 500kbps units w/hi bit set if basic */
54         } rateset;              /* supported rates */
55         u8 channel;             /* Channel no. */
56         uint16 atim_window;     /* units are Kusec */
57         u8 dtim_period; /* DTIM period */
58         int16 RSSI;             /* receive signal strength (in dBm) */
59         s8 phy_noise;           /* noise (in dBm) */
60         uint32 ie_length;       /* byte length of Information Elements */
61         /* variable length Information Elements */
62 } wl_bss_info_107_t;
63
64 /*
65  * Per-BSS information structure.
66  */
67
68 #define LEGACY2_WL_BSS_INFO_VERSION     108     /* old version of wl_bss_info struct */
69
70 /* BSS info structure
71  * Applications MUST CHECK ie_offset field and length field to access IEs and
72  * next bss_info structure in a vector (in wl_scan_results_t)
73  */
74 typedef struct wl_bss_info_108 {
75         uint32 version;         /* version field */
76         uint32 length;          /* byte length of data in this record,
77                                  * starting at version and including IEs
78                                  */
79         struct ether_addr BSSID;
80         uint16 beacon_period;   /* units are Kusec */
81         uint16 capability;      /* Capability information */
82         u8 SSID_len;
83         u8 SSID[32];
84         struct {
85                 uint count;     /* # rates in this set */
86                 u8 rates[16];   /* rates in 500kbps units w/hi bit set if basic */
87         } rateset;              /* supported rates */
88         chanspec_t chanspec;    /* chanspec for bss */
89         uint16 atim_window;     /* units are Kusec */
90         u8 dtim_period; /* DTIM period */
91         int16 RSSI;             /* receive signal strength (in dBm) */
92         s8 phy_noise;           /* noise (in dBm) */
93
94         u8 n_cap;               /* BSS is 802.11N Capable */
95         uint32 nbss_cap;        /* 802.11N BSS Capabilities (based on HT_CAP_*) */
96         u8 ctl_ch;              /* 802.11N BSS control channel number */
97         uint32 reserved32[1];   /* Reserved for expansion of BSS properties */
98         u8 flags;               /* flags */
99         u8 reserved[3]; /* Reserved for expansion of BSS properties */
100         u8 basic_mcs[MCSSET_LEN];       /* 802.11N BSS required MCS set */
101
102         uint16 ie_offset;       /* offset at which IEs start, from beginning */
103         uint32 ie_length;       /* byte length of Information Elements */
104         /* Add new fields here */
105         /* variable length Information Elements */
106 } wl_bss_info_108_t;
107
108 #ifdef BRCM_FULLMAC
109 #define WL_BSS_INFO_VERSION     108     /* current ver of wl_bss_info struct */
110 #else
111 #define WL_BSS_INFO_VERSION     109     /* current ver of wl_bss_info struct */
112 #endif
113
114 /* BSS info structure
115  * Applications MUST CHECK ie_offset field and length field to access IEs and
116  * next bss_info structure in a vector (in wl_scan_results_t)
117  */
118 typedef struct wl_bss_info {
119         uint32 version;         /* version field */
120         uint32 length;          /* byte length of data in this record,
121                                  * starting at version and including IEs
122                                  */
123         struct ether_addr BSSID;
124         uint16 beacon_period;   /* units are Kusec */
125         uint16 capability;      /* Capability information */
126         u8 SSID_len;
127         u8 SSID[32];
128         struct {
129                 uint count;     /* # rates in this set */
130                 u8 rates[16];   /* rates in 500kbps units w/hi bit set if basic */
131         } rateset;              /* supported rates */
132         chanspec_t chanspec;    /* chanspec for bss */
133         uint16 atim_window;     /* units are Kusec */
134         u8 dtim_period; /* DTIM period */
135         int16 RSSI;             /* receive signal strength (in dBm) */
136         s8 phy_noise;           /* noise (in dBm) */
137
138         u8 n_cap;               /* BSS is 802.11N Capable */
139         uint32 nbss_cap;        /* 802.11N BSS Capabilities (based on HT_CAP_*) */
140         u8 ctl_ch;              /* 802.11N BSS control channel number */
141         uint32 reserved32[1];   /* Reserved for expansion of BSS properties */
142         u8 flags;               /* flags */
143         u8 reserved[3]; /* Reserved for expansion of BSS properties */
144         u8 basic_mcs[MCSSET_LEN];       /* 802.11N BSS required MCS set */
145
146         uint16 ie_offset;       /* offset at which IEs start, from beginning */
147         uint32 ie_length;       /* byte length of Information Elements */
148         int16 SNR;              /* average SNR of during frame reception */
149         /* Add new fields here */
150         /* variable length Information Elements */
151 } wl_bss_info_t;
152
153 typedef struct wlc_ssid {
154         uint32 SSID_len;
155         unsigned char SSID[32];
156 } wlc_ssid_t;
157
158 typedef struct chan_scandata {
159         u8 txpower;
160         u8 pad;
161         chanspec_t channel;     /* Channel num, bw, ctrl_sb and band */
162         uint32 channel_mintime;
163         uint32 channel_maxtime;
164 } chan_scandata_t;
165
166 typedef enum wl_scan_type {
167         EXTDSCAN_FOREGROUND_SCAN,
168         EXTDSCAN_BACKGROUND_SCAN,
169         EXTDSCAN_FORCEDBACKGROUND_SCAN
170 } wl_scan_type_t;
171
172 #define WLC_EXTDSCAN_MAX_SSID           5
173
174 #define WL_BSS_FLAGS_FROM_BEACON        0x01    /* bss_info derived from beacon */
175 #define WL_BSS_FLAGS_FROM_CACHE         0x02    /* bss_info collected from cache */
176 #define WL_BSS_FLAGS_RSSI_ONCHANNEL     0x04    /* rssi info was received on channel (vs offchannel) */
177
178 typedef struct wl_extdscan_params {
179         s8 nprobes;             /* 0, passive, otherwise active */
180         s8 split_scan;  /* split scan */
181         s8 band;                /* band */
182         s8 pad;
183         wlc_ssid_t ssid[WLC_EXTDSCAN_MAX_SSID]; /* ssid list */
184         uint32 tx_rate;         /* in 500ksec units */
185         wl_scan_type_t scan_type;       /* enum */
186         int32 channel_num;
187         chan_scandata_t channel_list[1];        /* list of chandata structs */
188 } wl_extdscan_params_t;
189
190 #define WL_EXTDSCAN_PARAMS_FIXED_SIZE   (sizeof(wl_extdscan_params_t) - sizeof(chan_scandata_t))
191
192 #define WL_BSSTYPE_INFRA 1
193 #define WL_BSSTYPE_INDEP 0
194 #define WL_BSSTYPE_ANY   2
195
196 /* Bitmask for scan_type */
197 #define WL_SCANFLAGS_PASSIVE 0x01       /* force passive scan */
198 #define WL_SCANFLAGS_RESERVED 0x02      /* Reserved */
199 #define WL_SCANFLAGS_PROHIBITED 0x04    /* allow scanning prohibited channels */
200
201 typedef struct wl_scan_params {
202         wlc_ssid_t ssid;        /* default: {0, ""} */
203         struct ether_addr bssid;        /* default: bcast */
204         s8 bss_type;            /* default: any,
205                                  * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
206                                  */
207         u8 scan_type;   /* flags, 0 use default */
208         int32 nprobes;          /* -1 use default, number of probes per channel */
209         int32 active_time;      /* -1 use default, dwell time per channel for
210                                  * active scanning
211                                  */
212         int32 passive_time;     /* -1 use default, dwell time per channel
213                                  * for passive scanning
214                                  */
215         int32 home_time;        /* -1 use default, dwell time for the home channel
216                                  * between channel scans
217                                  */
218         int32 channel_num;      /* count of channels and ssids that follow
219                                  *
220                                  * low half is count of channels in channel_list, 0
221                                  * means default (use all available channels)
222                                  *
223                                  * high half is entries in wlc_ssid_t array that
224                                  * follows channel_list, aligned for int32 (4 bytes)
225                                  * meaning an odd channel count implies a 2-byte pad
226                                  * between end of channel_list and first ssid
227                                  *
228                                  * if ssid count is zero, single ssid in the fixed
229                                  * parameter portion is assumed, otherwise ssid in
230                                  * the fixed portion is ignored
231                                  */
232         uint16 channel_list[1]; /* list of chanspecs */
233 } wl_scan_params_t;
234
235 /* size of wl_scan_params not including variable length array */
236 #define WL_SCAN_PARAMS_FIXED_SIZE 64
237
238 /* masks for channel and ssid count */
239 #define WL_SCAN_PARAMS_COUNT_MASK 0x0000ffff
240 #define WL_SCAN_PARAMS_NSSID_SHIFT 16
241
242 #define WL_SCAN_ACTION_START      1
243 #define WL_SCAN_ACTION_CONTINUE   2
244 #define WL_SCAN_ACTION_ABORT      3
245
246 #define ISCAN_REQ_VERSION 1
247
248 /* incremental scan struct */
249 typedef struct wl_iscan_params {
250         uint32 version;
251         uint16 action;
252         uint16 scan_duration;
253         wl_scan_params_t params;
254 } wl_iscan_params_t;
255
256 /* 3 fields + size of wl_scan_params, not including variable length array */
257 #define WL_ISCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_iscan_params_t, params) + sizeof(wlc_ssid_t))
258
259 typedef struct wl_scan_results {
260         uint32 buflen;
261         uint32 version;
262         uint32 count;
263         wl_bss_info_t bss_info[1];
264 } wl_scan_results_t;
265
266 /* size of wl_scan_results not including variable length array */
267 #define WL_SCAN_RESULTS_FIXED_SIZE (sizeof(wl_scan_results_t) - sizeof(wl_bss_info_t))
268
269 /* wl_iscan_results status values */
270 #define WL_SCAN_RESULTS_SUCCESS 0
271 #define WL_SCAN_RESULTS_PARTIAL 1
272 #define WL_SCAN_RESULTS_PENDING 2
273 #define WL_SCAN_RESULTS_ABORTED 3
274 #define WL_SCAN_RESULTS_NO_MEM  4
275
276 #define ESCAN_REQ_VERSION 1
277
278 typedef struct wl_escan_params {
279         uint32 version;
280         uint16 action;
281         uint16 sync_id;
282         wl_scan_params_t params;
283 } wl_escan_params_t;
284
285 #define WL_ESCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_escan_params_t, params) + sizeof(wlc_ssid_t))
286
287 typedef struct wl_escan_result {
288         uint32 buflen;
289         uint32 version;
290         uint16 sync_id;
291         uint16 bss_count;
292         wl_bss_info_t bss_info[1];
293 } wl_escan_result_t;
294
295 #define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(wl_escan_result_t) - sizeof(wl_bss_info_t))
296
297 /* incremental scan results struct */
298 typedef struct wl_iscan_results {
299         uint32 status;
300         wl_scan_results_t results;
301 } wl_iscan_results_t;
302
303 /* size of wl_iscan_results not including variable length array */
304 #define WL_ISCAN_RESULTS_FIXED_SIZE \
305         (WL_SCAN_RESULTS_FIXED_SIZE + OFFSETOF(wl_iscan_results_t, results))
306
307 typedef struct wl_probe_params {
308         wlc_ssid_t ssid;
309         struct ether_addr bssid;
310         struct ether_addr mac;
311 } wl_probe_params_t;
312
313 #define WL_NUMRATES             16      /* max # of rates in a rateset */
314 typedef struct wl_rateset {
315         uint32 count;           /* # rates in this set */
316         u8 rates[WL_NUMRATES];  /* rates in 500kbps units w/hi bit set if basic */
317 } wl_rateset_t;
318
319 typedef struct wl_rateset_args {
320         uint32 count;           /* # rates in this set */
321         u8 rates[WL_NUMRATES];  /* rates in 500kbps units w/hi bit set if basic */
322         u8 mcs[MCSSET_LEN];     /* supported mcs index bit map */
323 } wl_rateset_args_t;
324
325 /* uint32 list */
326 typedef struct wl_uint32_list {
327         /* in - # of elements, out - # of entries */
328         uint32 count;
329         /* variable length uint32 list */
330         uint32 element[1];
331 } wl_uint32_list_t;
332
333 /* used for association with a specific BSSID and chanspec list */
334 typedef struct wl_assoc_params {
335         struct ether_addr bssid;        /* 00:00:00:00:00:00: broadcast scan */
336         int32 chanspec_num;     /* 0: all available channels,
337                                  * otherwise count of chanspecs in chanspec_list
338                                  */
339         chanspec_t chanspec_list[1];    /* list of chanspecs */
340 } wl_assoc_params_t;
341 #define WL_ASSOC_PARAMS_FIXED_SIZE      (sizeof(wl_assoc_params_t) - sizeof(chanspec_t))
342
343 /* used for reassociation/roam to a specific BSSID and channel */
344 typedef wl_assoc_params_t wl_reassoc_params_t;
345 #define WL_REASSOC_PARAMS_FIXED_SIZE    WL_ASSOC_PARAMS_FIXED_SIZE
346
347 /* used for join with or without a specific bssid and channel list */
348 typedef struct wl_join_params {
349         wlc_ssid_t ssid;
350         wl_assoc_params_t params;       /* optional field, but it must include the fixed portion
351                                          * of the wl_assoc_params_t struct when it does present.
352                                          */
353 } wl_join_params_t;
354 #define WL_JOIN_PARAMS_FIXED_SIZE       (sizeof(wl_join_params_t) - sizeof(chanspec_t))
355
356 /* defines used by the nrate iovar */
357 #define NRATE_MCS_INUSE 0x00000080      /* MSC in use,indicates b0-6 holds an mcs */
358 #define NRATE_RATE_MASK 0x0000007f      /* rate/mcs value */
359 #define NRATE_STF_MASK  0x0000ff00      /* stf mode mask: siso, cdd, stbc, sdm */
360 #define NRATE_STF_SHIFT 8       /* stf mode shift */
361 #define NRATE_OVERRIDE  0x80000000      /* bit indicates override both rate & mode */
362 #define NRATE_OVERRIDE_MCS_ONLY 0x40000000      /* bit indicate to override mcs only */
363 #define NRATE_SGI_MASK  0x00800000      /* sgi mode */
364 #define NRATE_SGI_SHIFT 23      /* sgi mode */
365 #define NRATE_LDPC_CODING 0x00400000    /* bit indicates adv coding in use */
366 #define NRATE_LDPC_SHIFT 22     /* ldpc shift */
367
368 #define NRATE_STF_SISO  0       /* stf mode SISO */
369 #define NRATE_STF_CDD   1       /* stf mode CDD */
370 #define NRATE_STF_STBC  2       /* stf mode STBC */
371 #define NRATE_STF_SDM   3       /* stf mode SDM */
372
373 #define ANTENNA_NUM_1   1       /* total number of antennas to be used */
374 #define ANTENNA_NUM_2   2
375 #define ANTENNA_NUM_3   3
376 #define ANTENNA_NUM_4   4
377
378 #define ANT_SELCFG_AUTO         0x80    /* bit indicates antenna sel AUTO */
379 #define ANT_SELCFG_MASK         0x33    /* antenna configuration mask */
380 #define ANT_SELCFG_MAX          4       /* max number of antenna configurations */
381 #define ANT_SELCFG_TX_UNICAST   0       /* unicast tx antenna configuration */
382 #define ANT_SELCFG_RX_UNICAST   1       /* unicast rx antenna configuration */
383 #define ANT_SELCFG_TX_DEF       2       /* default tx antenna configuration */
384 #define ANT_SELCFG_RX_DEF       3       /* default rx antenna configuration */
385
386 #define MAX_STREAMS_SUPPORTED   4       /* max number of streams supported */
387
388 typedef struct {
389         u8 ant_config[ANT_SELCFG_MAX];  /* antenna configuration */
390         u8 num_antcfg;  /* number of available antenna configurations */
391 } wlc_antselcfg_t;
392
393 #define HIGHEST_SINGLE_STREAM_MCS       7       /* MCS values greater than this enable multiple streams */
394
395 #define MAX_CCA_CHANNELS 38     /* Max number of 20 Mhz wide channels */
396 #define MAX_CCA_SECS     60     /* CCA keeps this many seconds history */
397
398 #define IBSS_MED        15      /* Mediom in-bss congestion percentage */
399 #define IBSS_HI         25      /* Hi in-bss congestion percentage */
400 #define OBSS_MED        12
401 #define OBSS_HI         25
402 #define INTERFER_MED    5
403 #define INTERFER_HI     10
404
405 #define  CCA_FLAG_2G_ONLY               0x01    /* Return a channel from 2.4 Ghz band */
406 #define  CCA_FLAG_5G_ONLY               0x02    /* Return a channel from 2.4 Ghz band */
407 #define  CCA_FLAG_IGNORE_DURATION       0x04    /* Ignore dwell time for each channel */
408 #define  CCA_FLAGS_PREFER_1_6_11        0x10
409 #define  CCA_FLAG_IGNORE_INTERFER       0x20    /* do not exlude channel based on interfer level */
410
411 #define CCA_ERRNO_BAND          1       /* After filtering for band pref, no choices left */
412 #define CCA_ERRNO_DURATION      2       /* After filtering for duration, no choices left */
413 #define CCA_ERRNO_PREF_CHAN     3       /* After filtering for chan pref, no choices left */
414 #define CCA_ERRNO_INTERFER      4       /* After filtering for interference, no choices left */
415 #define CCA_ERRNO_TOO_FEW       5       /* Only 1 channel was input */
416
417 typedef struct {
418         uint32 duration;        /* millisecs spent sampling this channel */
419         uint32 congest_ibss;    /* millisecs in our bss (presumably this traffic will */
420         /*  move if cur bss moves channels) */
421         uint32 congest_obss;    /* traffic not in our bss */
422         uint32 interference;    /* millisecs detecting a non 802.11 interferer. */
423         uint32 timestamp;       /* second timestamp */
424 } cca_congest_t;
425
426 typedef struct {
427         chanspec_t chanspec;    /* Which channel? */
428         u8 num_secs;            /* How many secs worth of data */
429         cca_congest_t secs[1];  /* Data */
430 } cca_congest_channel_req_t;
431
432 #define WLC_CNTRY_BUF_SZ        4       /* Country string is 3 bytes + NUL */
433
434 typedef struct wl_country {
435         char country_abbrev[WLC_CNTRY_BUF_SZ];  /* nul-terminated country code used in
436                                                  * the Country IE
437                                                  */
438         int32 rev;              /* revision specifier for ccode
439                                  * on set, -1 indicates unspecified.
440                                  * on get, rev >= 0
441                                  */
442         char ccode[WLC_CNTRY_BUF_SZ];   /* nul-terminated built-in country code.
443                                          * variable length, but fixed size in
444                                          * struct allows simple allocation for
445                                          * expected country strings <= 3 chars.
446                                          */
447 } wl_country_t;
448
449 typedef struct wl_channels_in_country {
450         uint32 buflen;
451         uint32 band;
452         char country_abbrev[WLC_CNTRY_BUF_SZ];
453         uint32 count;
454         uint32 channel[1];
455 } wl_channels_in_country_t;
456
457 typedef struct wl_country_list {
458         uint32 buflen;
459         uint32 band_set;
460         uint32 band;
461         uint32 count;
462         char country_abbrev[1];
463 } wl_country_list_t;
464
465 #define WL_NUM_RPI_BINS         8
466 #define WL_RM_TYPE_BASIC        1
467 #define WL_RM_TYPE_CCA          2
468 #define WL_RM_TYPE_RPI          3
469
470 #define WL_RM_FLAG_PARALLEL     (1<<0)
471
472 #define WL_RM_FLAG_LATE         (1<<1)
473 #define WL_RM_FLAG_INCAPABLE    (1<<2)
474 #define WL_RM_FLAG_REFUSED      (1<<3)
475
476 typedef struct wl_rm_req_elt {
477         s8 type;
478         s8 flags;
479         chanspec_t chanspec;
480         uint32 token;           /* token for this measurement */
481         uint32 tsf_h;           /* TSF high 32-bits of Measurement start time */
482         uint32 tsf_l;           /* TSF low 32-bits */
483         uint32 dur;             /* TUs */
484 } wl_rm_req_elt_t;
485
486 typedef struct wl_rm_req {
487         uint32 token;           /* overall measurement set token */
488         uint32 count;           /* number of measurement requests */
489         void *cb;               /* completion callback function: may be NULL */
490         void *cb_arg;           /* arg to completion callback function */
491         wl_rm_req_elt_t req[1]; /* variable length block of requests */
492 } wl_rm_req_t;
493 #define WL_RM_REQ_FIXED_LEN     OFFSETOF(wl_rm_req_t, req)
494
495 typedef struct wl_rm_rep_elt {
496         s8 type;
497         s8 flags;
498         chanspec_t chanspec;
499         uint32 token;           /* token for this measurement */
500         uint32 tsf_h;           /* TSF high 32-bits of Measurement start time */
501         uint32 tsf_l;           /* TSF low 32-bits */
502         uint32 dur;             /* TUs */
503         uint32 len;             /* byte length of data block */
504         u8 data[1];             /* variable length data block */
505 } wl_rm_rep_elt_t;
506 #define WL_RM_REP_ELT_FIXED_LEN 24      /* length excluding data block */
507
508 #define WL_RPI_REP_BIN_NUM 8
509 typedef struct wl_rm_rpi_rep {
510         u8 rpi[WL_RPI_REP_BIN_NUM];
511         s8 rpi_max[WL_RPI_REP_BIN_NUM];
512 } wl_rm_rpi_rep_t;
513
514 typedef struct wl_rm_rep {
515         uint32 token;           /* overall measurement set token */
516         uint32 len;             /* length of measurement report block */
517         wl_rm_rep_elt_t rep[1]; /* variable length block of reports */
518 } wl_rm_rep_t;
519 #define WL_RM_REP_FIXED_LEN     8
520
521 /* Enumerate crypto algorithms */
522 #define CRYPTO_ALGO_OFF                 0
523 #define CRYPTO_ALGO_WEP1                1
524 #define CRYPTO_ALGO_TKIP                2
525 #define CRYPTO_ALGO_WEP128              3
526 #define CRYPTO_ALGO_AES_CCM             4
527 #define CRYPTO_ALGO_AES_RESERVED1       5
528 #define CRYPTO_ALGO_AES_RESERVED2       6
529 #define CRYPTO_ALGO_NALG                7
530
531 #define WSEC_GEN_MIC_ERROR      0x0001
532 #define WSEC_GEN_REPLAY         0x0002
533 #define WSEC_GEN_ICV_ERROR      0x0004
534
535 #define WL_SOFT_KEY     (1 << 0)        /* Indicates this key is using soft encrypt */
536 #define WL_PRIMARY_KEY  (1 << 1)        /* Indicates this key is the primary (ie tx) key */
537 #define WL_KF_RES_4     (1 << 4)        /* Reserved for backward compat */
538 #define WL_KF_RES_5     (1 << 5)        /* Reserved for backward compat */
539 #define WL_IBSS_PEER_GROUP_KEY  (1 << 6)        /* Indicates a group key for a IBSS PEER */
540
541 typedef struct wl_wsec_key {
542         uint32 index;           /* key index */
543         uint32 len;             /* key length */
544         u8 data[DOT11_MAX_KEY_SIZE];    /* key data */
545         uint32 pad_1[18];
546         uint32 algo;            /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
547         uint32 flags;           /* misc flags */
548         uint32 pad_2[2];
549         int pad_3;
550         int iv_initialized;     /* has IV been initialized already? */
551         int pad_4;
552         /* Rx IV */
553         struct {
554                 uint32 hi;      /* upper 32 bits of IV */
555                 uint16 lo;      /* lower 16 bits of IV */
556         } rxiv;
557         uint32 pad_5[2];
558         struct ether_addr ea;   /* per station */
559 } wl_wsec_key_t;
560
561 #define WSEC_MIN_PSK_LEN        8
562 #define WSEC_MAX_PSK_LEN        64
563
564 /* Flag for key material needing passhash'ing */
565 #define WSEC_PASSPHRASE         (1<<0)
566
567 /* receptacle for WLC_SET_WSEC_PMK parameter */
568 typedef struct {
569         ushort key_len;         /* octets in key material */
570         ushort flags;           /* key handling qualification */
571         u8 key[WSEC_MAX_PSK_LEN];       /* PMK material */
572 } wsec_pmk_t;
573
574 /* wireless security bitvec */
575 #define WEP_ENABLED             0x0001
576 #define TKIP_ENABLED            0x0002
577 #define AES_ENABLED             0x0004
578 #define WSEC_SWFLAG             0x0008
579 #define SES_OW_ENABLED          0x0040  /* to go into transition mode without setting wep */
580
581 /* WPA authentication mode bitvec */
582 #define WPA_AUTH_DISABLED       0x0000  /* Legacy (i.e., non-WPA) */
583 #define WPA_AUTH_NONE           0x0001  /* none (IBSS) */
584 #define WPA_AUTH_UNSPECIFIED    0x0002  /* over 802.1x */
585 #define WPA_AUTH_PSK            0x0004  /* Pre-shared key */
586 #define WPA_AUTH_RESERVED1      0x0008
587 #define WPA_AUTH_RESERVED2      0x0010
588                                         /* #define WPA_AUTH_8021X 0x0020 *//* 802.1x, reserved */
589 #define WPA2_AUTH_RESERVED1     0x0020
590 #define WPA2_AUTH_UNSPECIFIED   0x0040  /* over 802.1x */
591 #define WPA2_AUTH_PSK           0x0080  /* Pre-shared key */
592 #define WPA2_AUTH_RESERVED3     0x0200
593 #define WPA2_AUTH_RESERVED4     0x0400
594 #define WPA2_AUTH_RESERVED5     0x0800
595
596 /* pmkid */
597 #define MAXPMKID                16
598
599 typedef struct _pmkid {
600         struct ether_addr BSSID;
601         u8 PMKID[WPA2_PMKID_LEN];
602 } pmkid_t;
603
604 typedef struct _pmkid_list {
605         uint32 npmkid;
606         pmkid_t pmkid[1];
607 } pmkid_list_t;
608
609 typedef struct _pmkid_cand {
610         struct ether_addr BSSID;
611         u8 preauth;
612 } pmkid_cand_t;
613
614 typedef struct _pmkid_cand_list {
615         uint32 npmkid_cand;
616         pmkid_cand_t pmkid_cand[1];
617 } pmkid_cand_list_t;
618
619 typedef struct wl_led_info {
620         uint32 index;           /* led index */
621         uint32 behavior;
622         u8 activehi;
623 } wl_led_info_t;
624
625 /* flags */
626 #define WLC_ASSOC_REQ_IS_REASSOC 0x01   /* assoc req was actually a reassoc */
627
628 /* srom read/write struct passed through ioctl */
629 typedef struct {
630         uint byteoff;           /* byte offset */
631         uint nbytes;            /* number of bytes */
632         uint16 buf[1];
633 } srom_rw_t;
634
635 /* similar cis (srom or otp) struct [iovar: may not be aligned] */
636 typedef struct {
637         uint32 source;          /* cis source */
638         uint32 byteoff;         /* byte offset */
639         uint32 nbytes;          /* number of bytes */
640         /* data follows here */
641 } cis_rw_t;
642
643 #define WLC_CIS_DEFAULT 0       /* built-in default */
644 #define WLC_CIS_SROM    1       /* source is sprom */
645 #define WLC_CIS_OTP     2       /* source is otp */
646
647 /* R_REG and W_REG struct passed through ioctl */
648 typedef struct {
649         uint32 byteoff;         /* byte offset of the field in d11regs_t */
650         uint32 val;             /* read/write value of the field */
651         uint32 size;            /* sizeof the field */
652         uint band;              /* band (optional) */
653 } rw_reg_t;
654
655 /* Structure used by GET/SET_ATTEN ioctls - it controls power in b/g-band */
656 /* PCL - Power Control Loop */
657 /* current gain setting is replaced by user input */
658 #define WL_ATTEN_APP_INPUT_PCL_OFF      0       /* turn off PCL, apply supplied input */
659 #define WL_ATTEN_PCL_ON                 1       /* turn on PCL */
660 /* current gain setting is maintained */
661 #define WL_ATTEN_PCL_OFF                2       /* turn off PCL. */
662
663 typedef struct {
664         uint16 auto_ctrl;       /* WL_ATTEN_XX */
665         uint16 bb;              /* Baseband attenuation */
666         uint16 radio;           /* Radio attenuation */
667         uint16 txctl1;          /* Radio TX_CTL1 value */
668 } atten_t;
669
670 /* Per-AC retry parameters */
671 struct wme_tx_params_s {
672         u8 short_retry;
673         u8 short_fallback;
674         u8 long_retry;
675         u8 long_fallback;
676         uint16 max_rate;        /* In units of 512 Kbps */
677 };
678
679 typedef struct wme_tx_params_s wme_tx_params_t;
680
681 #define WL_WME_TX_PARAMS_IO_BYTES (sizeof(wme_tx_params_t) * AC_COUNT)
682
683 /* defines used by poweridx iovar - it controls power in a-band */
684 /* current gain setting is maintained */
685 #define WL_PWRIDX_PCL_OFF       -2      /* turn off PCL.  */
686 #define WL_PWRIDX_PCL_ON        -1      /* turn on PCL */
687 #define WL_PWRIDX_LOWER_LIMIT   -2      /* lower limit */
688 #define WL_PWRIDX_UPPER_LIMIT   63      /* upper limit */
689 /* value >= 0 causes
690  *      - input to be set to that value
691  *      - PCL to be off
692  */
693
694 /* Used to get specific link/ac parameters */
695 typedef struct {
696         int ac;
697         u8 val;
698         struct ether_addr ea;
699 } link_val_t;
700
701 #define BCM_MAC_STATUS_INDICATION       (0x40010200L)
702
703 typedef struct {
704         uint16 ver;             /* version of this struct */
705         uint16 len;             /* length in bytes of this structure */
706         uint16 cap;             /* sta's advertised capabilities */
707         uint32 flags;           /* flags defined below */
708         uint32 idle;            /* time since data pkt rx'd from sta */
709         struct ether_addr ea;   /* Station address */
710         wl_rateset_t rateset;   /* rateset in use */
711         uint32 in;              /* seconds elapsed since associated */
712         uint32 listen_interval_inms;    /* Min Listen interval in ms for this STA */
713         uint32 tx_pkts;         /* # of packets transmitted */
714         uint32 tx_failures;     /* # of packets failed */
715         uint32 rx_ucast_pkts;   /* # of unicast packets received */
716         uint32 rx_mcast_pkts;   /* # of multicast packets received */
717         uint32 tx_rate;         /* Rate of last successful tx frame */
718         uint32 rx_rate;         /* Rate of last successful rx frame */
719         uint32 rx_decrypt_succeeds;     /* # of packet decrypted successfully */
720         uint32 rx_decrypt_failures;     /* # of packet decrypted unsuccessfully */
721 } sta_info_t;
722
723 #define WL_OLD_STAINFO_SIZE     OFFSETOF(sta_info_t, tx_pkts)
724
725 #define WL_STA_VER              3
726
727 /* Flags for sta_info_t indicating properties of STA */
728 #define WL_STA_BRCM             0x1     /* Running a Broadcom driver */
729 #define WL_STA_WME              0x2     /* WMM association */
730 #define WL_STA_ABCAP            0x4
731 #define WL_STA_AUTHE            0x8     /* Authenticated */
732 #define WL_STA_ASSOC            0x10    /* Associated */
733 #define WL_STA_AUTHO            0x20    /* Authorized */
734 #define WL_STA_WDS              0x40    /* Wireless Distribution System */
735 #define WL_STA_WDS_LINKUP       0x80    /* WDS traffic/probes flowing properly */
736 #define WL_STA_PS               0x100   /* STA is in power save mode from AP's viewpoint */
737 #define WL_STA_APSD_BE          0x200   /* APSD delv/trigger for AC_BE is default enabled */
738 #define WL_STA_APSD_BK          0x400   /* APSD delv/trigger for AC_BK is default enabled */
739 #define WL_STA_APSD_VI          0x800   /* APSD delv/trigger for AC_VI is default enabled */
740 #define WL_STA_APSD_VO          0x1000  /* APSD delv/trigger for AC_VO is default enabled */
741 #define WL_STA_N_CAP            0x2000  /* STA 802.11n capable */
742 #define WL_STA_SCBSTATS         0x4000  /* Per STA debug stats */
743
744 #define WL_WDS_LINKUP           WL_STA_WDS_LINKUP       /* deprecated */
745
746 /* Used to get specific STA parameters */
747 typedef struct {
748         uint32 val;
749         struct ether_addr ea;
750 } scb_val_t;
751
752 /* channel encoding */
753 typedef struct channel_info {
754         int hw_channel;
755         int target_channel;
756         int scan_channel;
757 } channel_info_t;
758
759 /* For ioctls that take a list of MAC addresses */
760 struct maclist {
761         uint count;             /* number of MAC addresses */
762         struct ether_addr ea[1];        /* variable length array of MAC addresses */
763 };
764
765 /* get pkt count struct passed through ioctl */
766 typedef struct get_pktcnt {
767         uint rx_good_pkt;
768         uint rx_bad_pkt;
769         uint tx_good_pkt;
770         uint tx_bad_pkt;
771         uint rx_ocast_good_pkt; /* unicast packets destined for others */
772 } get_pktcnt_t;
773
774 /* Linux network driver ioctl encoding */
775 typedef struct wl_ioctl {
776         uint cmd;               /* common ioctl definition */
777         void *buf;              /* pointer to user buffer */
778         uint len;               /* length of user buffer */
779         u8 set;         /* get or set request (optional) */
780         uint used;              /* bytes read or written (optional) */
781         uint needed;            /* bytes needed (optional) */
782 } wl_ioctl_t;
783
784 /* reference to wl_ioctl_t struct used by usermode driver */
785 #define ioctl_subtype   set     /* subtype param */
786 #define ioctl_pid       used    /* pid param */
787 #define ioctl_status    needed  /* status param */
788
789 /*
790  * Structure for passing hardware and software
791  * revision info up from the driver.
792  */
793 typedef struct wlc_rev_info {
794         uint vendorid;          /* PCI vendor id */
795         uint deviceid;          /* device id of chip */
796         uint radiorev;          /* radio revision */
797         uint chiprev;           /* chip revision */
798         uint corerev;           /* core revision */
799         uint boardid;           /* board identifier (usu. PCI sub-device id) */
800         uint boardvendor;       /* board vendor (usu. PCI sub-vendor id) */
801         uint boardrev;          /* board revision */
802         uint driverrev;         /* driver version */
803         uint ucoderev;          /* microcode version */
804         uint bus;               /* bus type */
805         uint chipnum;           /* chip number */
806         uint phytype;           /* phy type */
807         uint phyrev;            /* phy revision */
808         uint anarev;            /* anacore rev */
809         uint chippkg;           /* chip package info */
810 } wlc_rev_info_t;
811
812 #define WL_REV_INFO_LEGACY_LENGTH       48
813
814 #define WL_BRAND_MAX 10
815 typedef struct wl_instance_info {
816         uint instance;
817         char brand[WL_BRAND_MAX];
818 } wl_instance_info_t;
819
820 /* structure to change size of tx fifo */
821 typedef struct wl_txfifo_sz {
822         uint16 magic;
823         uint16 fifo;
824         uint16 size;
825 } wl_txfifo_sz_t;
826 /* magic pattern used for mismatch driver and wl */
827 #define WL_TXFIFO_SZ_MAGIC      0xa5a5
828
829 /* Transfer info about an IOVar from the driver */
830 /* Max supported IOV name size in bytes, + 1 for nul termination */
831 #define WLC_IOV_NAME_LEN 30
832 typedef struct wlc_iov_trx_s {
833         u8 module;
834         u8 type;
835         char name[WLC_IOV_NAME_LEN];
836 } wlc_iov_trx_t;
837
838 /* check this magic number */
839 #define WLC_IOCTL_MAGIC         0x14e46c77
840
841 #define PROC_ENTRY_NAME "brcm_debug"
842 /* bump this number if you change the ioctl interface */
843 #define WLC_IOCTL_VERSION       1
844
845 #ifdef BRCM_FULLMAC
846 #define WLC_IOCTL_MAXLEN        8192
847 #else
848 #define WLC_IOCTL_MAXLEN                3072    /* max length ioctl buffer required */
849 #endif
850 #define WLC_IOCTL_SMLEN                 256     /* "small" length ioctl buffer required */
851 #define WLC_IOCTL_MEDLEN                1536    /* "med" length ioctl buffer required */
852 #define WLC_SAMPLECOLLECT_MAXLEN        10240   /* Max Sample Collect buffer for two cores */
853
854 /* common ioctl definitions */
855 #define WLC_GET_MAGIC                           0
856 #define WLC_GET_VERSION                         1
857 #define WLC_UP                                  2
858 #define WLC_DOWN                                3
859 #define WLC_GET_LOOP                            4
860 #define WLC_SET_LOOP                            5
861 #define WLC_DUMP                                6
862 #define WLC_GET_MSGLEVEL                        7
863 #define WLC_SET_MSGLEVEL                        8
864 #define WLC_GET_PROMISC                         9
865 #define WLC_SET_PROMISC                         10
866 #define WLC_OVERLAY_IOCTL                       11
867 #define WLC_GET_RATE                            12
868                                                       /* #define WLC_SET_RATE                           13 *//* no longer supported */
869 #define WLC_GET_INSTANCE                        14
870                                                       /* #define WLC_GET_FRAG                           15 *//* no longer supported */
871                                                       /* #define WLC_SET_FRAG                           16 *//* no longer supported */
872                                                       /* #define WLC_GET_RTS                            17 *//* no longer supported */
873                                                       /* #define WLC_SET_RTS                            18 *//* no longer supported */
874 #define WLC_GET_INFRA                           19
875 #define WLC_SET_INFRA                           20
876 #define WLC_GET_AUTH                            21
877 #define WLC_SET_AUTH                            22
878 #define WLC_GET_BSSID                           23
879 #define WLC_SET_BSSID                           24
880 #define WLC_GET_SSID                            25
881 #define WLC_SET_SSID                            26
882 #define WLC_RESTART                             27
883                                                       /* #define WLC_DUMP_SCB                           28 *//* no longer supported */
884 #define WLC_GET_CHANNEL                         29
885 #define WLC_SET_CHANNEL                         30
886 #define WLC_GET_SRL                             31
887 #define WLC_SET_SRL                             32
888 #define WLC_GET_LRL                             33
889 #define WLC_SET_LRL                             34
890 #define WLC_GET_PLCPHDR                         35
891 #define WLC_SET_PLCPHDR                         36
892 #define WLC_GET_RADIO                           37
893 #define WLC_SET_RADIO                           38
894 #define WLC_GET_PHYTYPE                         39
895 #define WLC_DUMP_RATE                           40
896 #define WLC_SET_RATE_PARAMS                     41
897 #define WLC_GET_FIXRATE                         42
898 #define WLC_SET_FIXRATE                         43
899                                                       /* #define WLC_GET_WEP                            42 *//* no longer supported */
900                                                       /* #define WLC_SET_WEP                            43 *//* no longer supported */
901 #define WLC_GET_KEY                             44
902 #define WLC_SET_KEY                             45
903 #define WLC_GET_REGULATORY                      46
904 #define WLC_SET_REGULATORY                      47
905 #define WLC_GET_PASSIVE_SCAN                    48
906 #define WLC_SET_PASSIVE_SCAN                    49
907 #define WLC_SCAN                                50
908 #define WLC_SCAN_RESULTS                        51
909 #define WLC_DISASSOC                            52
910 #define WLC_REASSOC                             53
911 #define WLC_GET_ROAM_TRIGGER                    54
912 #define WLC_SET_ROAM_TRIGGER                    55
913 #define WLC_GET_ROAM_DELTA                      56
914 #define WLC_SET_ROAM_DELTA                      57
915 #define WLC_GET_ROAM_SCAN_PERIOD                58
916 #define WLC_SET_ROAM_SCAN_PERIOD                59
917 #define WLC_EVM                                 60      /* diag */
918 #define WLC_GET_TXANT                           61
919 #define WLC_SET_TXANT                           62
920 #define WLC_GET_ANTDIV                          63
921 #define WLC_SET_ANTDIV                          64
922                                                       /* #define WLC_GET_TXPWR                  65 *//* no longer supported */
923                                                       /* #define WLC_SET_TXPWR                  66 *//* no longer supported */
924 #define WLC_GET_CLOSED                          67
925 #define WLC_SET_CLOSED                          68
926 #define WLC_GET_MACLIST                         69
927 #define WLC_SET_MACLIST                         70
928 #define WLC_GET_RATESET                         71
929 #define WLC_SET_RATESET                         72
930                                                       /* #define WLC_GET_LOCALE                 73 *//* no longer supported */
931 #define WLC_LONGTRAIN                           74
932 #define WLC_GET_BCNPRD                          75
933 #define WLC_SET_BCNPRD                          76
934 #define WLC_GET_DTIMPRD                         77
935 #define WLC_SET_DTIMPRD                         78
936 #define WLC_GET_SROM                            79
937 #define WLC_SET_SROM                            80
938 #define WLC_GET_WEP_RESTRICT                    81
939 #define WLC_SET_WEP_RESTRICT                    82
940 #define WLC_GET_COUNTRY                         83
941 #define WLC_SET_COUNTRY                         84
942 #define WLC_GET_PM                              85
943 #define WLC_SET_PM                              86
944 #define WLC_GET_WAKE                            87
945 #define WLC_SET_WAKE                            88
946                                                       /* #define WLC_GET_D11CNTS                        89 *//* -> "counters" iovar */
947 #define WLC_GET_FORCELINK                       90      /* ndis only */
948 #define WLC_SET_FORCELINK                       91      /* ndis only */
949 #define WLC_FREQ_ACCURACY                       92      /* diag */
950 #define WLC_CARRIER_SUPPRESS                    93      /* diag */
951 #define WLC_GET_PHYREG                          94
952 #define WLC_SET_PHYREG                          95
953 #define WLC_GET_RADIOREG                        96
954 #define WLC_SET_RADIOREG                        97
955 #define WLC_GET_REVINFO                         98
956 #define WLC_GET_UCANTDIV                        99
957 #define WLC_SET_UCANTDIV                        100
958 #define WLC_R_REG                               101
959 #define WLC_W_REG                               102
960 /* #define WLC_DIAG_LOOPBACK                    103     old tray diag */
961                                                        /* #define WLC_RESET_D11CNTS                     104 *//* -> "reset_d11cnts" iovar */
962 #define WLC_GET_MACMODE                         105
963 #define WLC_SET_MACMODE                         106
964 #define WLC_GET_MONITOR                         107
965 #define WLC_SET_MONITOR                         108
966 #define WLC_GET_GMODE                           109
967 #define WLC_SET_GMODE                           110
968 #define WLC_GET_LEGACY_ERP                      111
969 #define WLC_SET_LEGACY_ERP                      112
970 #define WLC_GET_RX_ANT                          113
971 #define WLC_GET_CURR_RATESET                    114     /* current rateset */
972 #define WLC_GET_SCANSUPPRESS                    115
973 #define WLC_SET_SCANSUPPRESS                    116
974 #define WLC_GET_AP                              117
975 #define WLC_SET_AP                              118
976 #define WLC_GET_EAP_RESTRICT                    119
977 #define WLC_SET_EAP_RESTRICT                    120
978 #define WLC_SCB_AUTHORIZE                       121
979 #define WLC_SCB_DEAUTHORIZE                     122
980 #define WLC_GET_WDSLIST                         123
981 #define WLC_SET_WDSLIST                         124
982 #define WLC_GET_ATIM                            125
983 #define WLC_SET_ATIM                            126
984 #define WLC_GET_RSSI                            127
985 #define WLC_GET_PHYANTDIV                       128
986 #define WLC_SET_PHYANTDIV                       129
987 #define WLC_AP_RX_ONLY                          130
988 #define WLC_GET_TX_PATH_PWR                     131
989 #define WLC_SET_TX_PATH_PWR                     132
990 #define WLC_GET_WSEC                            133
991 #define WLC_SET_WSEC                            134
992 #define WLC_GET_PHY_NOISE                       135
993 #define WLC_GET_BSS_INFO                        136
994 #define WLC_GET_PKTCNTS                         137
995 #define WLC_GET_LAZYWDS                         138
996 #define WLC_SET_LAZYWDS                         139
997 #define WLC_GET_BANDLIST                        140
998 #define WLC_GET_BAND                            141
999 #define WLC_SET_BAND                            142
1000 #define WLC_SCB_DEAUTHENTICATE                  143
1001 #define WLC_GET_SHORTSLOT                       144
1002 #define WLC_GET_SHORTSLOT_OVERRIDE              145
1003 #define WLC_SET_SHORTSLOT_OVERRIDE              146
1004 #define WLC_GET_SHORTSLOT_RESTRICT              147
1005 #define WLC_SET_SHORTSLOT_RESTRICT              148
1006 #define WLC_GET_GMODE_PROTECTION                149
1007 #define WLC_GET_GMODE_PROTECTION_OVERRIDE       150
1008 #define WLC_SET_GMODE_PROTECTION_OVERRIDE       151
1009 #define WLC_UPGRADE                             152
1010                                                        /* #define WLC_GET_MRATE                 153 *//* no longer supported */
1011                                                        /* #define WLC_SET_MRATE                 154 *//* no longer supported */
1012 #define WLC_GET_IGNORE_BCNS                     155
1013 #define WLC_SET_IGNORE_BCNS                     156
1014 #define WLC_GET_SCB_TIMEOUT                     157
1015 #define WLC_SET_SCB_TIMEOUT                     158
1016 #define WLC_GET_ASSOCLIST                       159
1017 #define WLC_GET_CLK                             160
1018 #define WLC_SET_CLK                             161
1019 #define WLC_GET_UP                              162
1020 #define WLC_OUT                                 163
1021 #define WLC_GET_WPA_AUTH                        164
1022 #define WLC_SET_WPA_AUTH                        165
1023 #define WLC_GET_UCFLAGS                         166
1024 #define WLC_SET_UCFLAGS                         167
1025 #define WLC_GET_PWRIDX                          168
1026 #define WLC_SET_PWRIDX                          169
1027 #define WLC_GET_TSSI                            170
1028 #define WLC_GET_SUP_RATESET_OVERRIDE            171
1029 #define WLC_SET_SUP_RATESET_OVERRIDE            172
1030                                                        /* #define WLC_SET_FAST_TIMER                    173 *//* no longer supported */
1031                                                        /* #define WLC_GET_FAST_TIMER                    174 *//* no longer supported */
1032                                                        /* #define WLC_SET_SLOW_TIMER                    175 *//* no longer supported */
1033                                                        /* #define WLC_GET_SLOW_TIMER                    176 *//* no longer supported */
1034                                                        /* #define WLC_DUMP_PHYREGS                      177 *//* no longer supported */
1035 #define WLC_GET_PROTECTION_CONTROL              178
1036 #define WLC_SET_PROTECTION_CONTROL              179
1037 #define WLC_GET_PHYLIST                         180
1038 #define WLC_ENCRYPT_STRENGTH                    181     /* ndis only */
1039 #define WLC_DECRYPT_STATUS                      182     /* ndis only */
1040 #define WLC_GET_KEY_SEQ                         183
1041 #define WLC_GET_SCAN_CHANNEL_TIME               184
1042 #define WLC_SET_SCAN_CHANNEL_TIME               185
1043 #define WLC_GET_SCAN_UNASSOC_TIME               186
1044 #define WLC_SET_SCAN_UNASSOC_TIME               187
1045 #define WLC_GET_SCAN_HOME_TIME                  188
1046 #define WLC_SET_SCAN_HOME_TIME                  189
1047 #define WLC_GET_SCAN_NPROBES                    190
1048 #define WLC_SET_SCAN_NPROBES                    191
1049 #define WLC_GET_PRB_RESP_TIMEOUT                192
1050 #define WLC_SET_PRB_RESP_TIMEOUT                193
1051 #define WLC_GET_ATTEN                           194
1052 #define WLC_SET_ATTEN                           195
1053 #define WLC_GET_SHMEM                           196     /* diag */
1054 #define WLC_SET_SHMEM                           197     /* diag */
1055                                                        /* #define WLC_GET_GMODE_PROTECTION_CTS          198 *//* no longer supported */
1056                                                        /* #define WLC_SET_GMODE_PROTECTION_CTS          199 *//* no longer supported */
1057 #define WLC_SET_WSEC_TEST                       200
1058 #define WLC_SCB_DEAUTHENTICATE_FOR_REASON       201
1059 #define WLC_TKIP_COUNTERMEASURES                202
1060 #define WLC_GET_PIOMODE                         203
1061 #define WLC_SET_PIOMODE                         204
1062 #define WLC_SET_ASSOC_PREFER                    205
1063 #define WLC_GET_ASSOC_PREFER                    206
1064 #define WLC_SET_ROAM_PREFER                     207
1065 #define WLC_GET_ROAM_PREFER                     208
1066 #define WLC_SET_LED                             209
1067 #define WLC_GET_LED                             210
1068 #define WLC_RESERVED6                           211
1069 #define WLC_RESERVED7                           212
1070 #define WLC_GET_CHANNEL_QA                      213
1071 #define WLC_START_CHANNEL_QA                    214
1072 #define WLC_GET_CHANNEL_SEL                     215
1073 #define WLC_START_CHANNEL_SEL                   216
1074 #define WLC_GET_VALID_CHANNELS                  217
1075 #define WLC_GET_FAKEFRAG                        218
1076 #define WLC_SET_FAKEFRAG                        219
1077 #define WLC_GET_PWROUT_PERCENTAGE               220
1078 #define WLC_SET_PWROUT_PERCENTAGE               221
1079 #define WLC_SET_BAD_FRAME_PREEMPT               222
1080 #define WLC_GET_BAD_FRAME_PREEMPT               223
1081 #define WLC_SET_LEAP_LIST                       224
1082 #define WLC_GET_LEAP_LIST                       225
1083 #define WLC_GET_CWMIN                           226
1084 #define WLC_SET_CWMIN                           227
1085 #define WLC_GET_CWMAX                           228
1086 #define WLC_SET_CWMAX                           229
1087 #define WLC_GET_WET                             230
1088 #define WLC_SET_WET                             231
1089 #define WLC_GET_PUB                             232
1090                                                        /* #define WLC_SET_GLACIAL_TIMER         233 *//* no longer supported */
1091                                                        /* #define WLC_GET_GLACIAL_TIMER         234 *//* no longer supported */
1092 #define WLC_GET_KEY_PRIMARY                     235
1093 #define WLC_SET_KEY_PRIMARY                     236
1094                                                        /* #define WLC_DUMP_RADIOREGS                    237 *//* no longer supported */
1095 #define WLC_RESERVED4                           238
1096 #define WLC_RESERVED5                           239
1097 #define WLC_UNSET_CALLBACK                      240
1098 #define WLC_SET_CALLBACK                        241
1099 #define WLC_GET_RADAR                           242
1100 #define WLC_SET_RADAR                           243
1101 #define WLC_SET_SPECT_MANAGMENT                 244
1102 #define WLC_GET_SPECT_MANAGMENT                 245
1103 #define WLC_WDS_GET_REMOTE_HWADDR               246     /* handled in wl_linux.c/wl_vx.c */
1104 #define WLC_WDS_GET_WPA_SUP                     247
1105 #define WLC_SET_CS_SCAN_TIMER                   248
1106 #define WLC_GET_CS_SCAN_TIMER                   249
1107 #define WLC_MEASURE_REQUEST                     250
1108 #define WLC_INIT                                251
1109 #define WLC_SEND_QUIET                          252
1110 #define WLC_KEEPALIVE                   253
1111 #define WLC_SEND_PWR_CONSTRAINT                 254
1112 #define WLC_UPGRADE_STATUS                      255
1113 #define WLC_CURRENT_PWR                         256
1114 #define WLC_GET_SCAN_PASSIVE_TIME               257
1115 #define WLC_SET_SCAN_PASSIVE_TIME               258
1116 #define WLC_LEGACY_LINK_BEHAVIOR                259
1117 #define WLC_GET_CHANNELS_IN_COUNTRY             260
1118 #define WLC_GET_COUNTRY_LIST                    261
1119 #define WLC_GET_VAR                             262     /* get value of named variable */
1120 #define WLC_SET_VAR                             263     /* set named variable to value */
1121 #define WLC_NVRAM_GET                           264     /* deprecated */
1122 #define WLC_NVRAM_SET                           265
1123 #define WLC_NVRAM_DUMP                          266
1124 #define WLC_REBOOT                              267
1125 #define WLC_SET_WSEC_PMK                        268
1126 #define WLC_GET_AUTH_MODE                       269
1127 #define WLC_SET_AUTH_MODE                       270
1128 #define WLC_GET_WAKEENTRY                       271
1129 #define WLC_SET_WAKEENTRY                       272
1130 #define WLC_NDCONFIG_ITEM                       273     /* currently handled in wl_oid.c */
1131 #define WLC_NVOTPW                              274
1132 #define WLC_OTPW                                275
1133 #define WLC_IOV_BLOCK_GET                       276
1134 #define WLC_IOV_MODULES_GET                     277
1135 #define WLC_SOFT_RESET                          278
1136 #define WLC_GET_ALLOW_MODE                      279
1137 #define WLC_SET_ALLOW_MODE                      280
1138 #define WLC_GET_DESIRED_BSSID                   281
1139 #define WLC_SET_DESIRED_BSSID                   282
1140 #define WLC_DISASSOC_MYAP                       283
1141 #define WLC_GET_RESERVED10                      284
1142 #define WLC_GET_RESERVED11                      285
1143 #define WLC_GET_RESERVED12                      286
1144 #define WLC_GET_RESERVED13                      287
1145 #define WLC_GET_RESERVED14                      288
1146 #define WLC_SET_RESERVED15                      289
1147 #define WLC_SET_RESERVED16                      290
1148 #define WLC_GET_RESERVED17                      291
1149 #define WLC_GET_RESERVED18                      292
1150 #define WLC_GET_RESERVED19                      293
1151 #define WLC_SET_RESERVED1A                      294
1152 #define WLC_GET_RESERVED1B                      295
1153 #define WLC_GET_RESERVED1C                      296
1154 #define WLC_GET_RESERVED1D                      297
1155 #define WLC_SET_RESERVED1E                      298
1156 #define WLC_GET_RESERVED1F                      299
1157 #define WLC_GET_RESERVED20                      300
1158 #define WLC_GET_RESERVED21                      301
1159 #define WLC_GET_RESERVED22                      302
1160 #define WLC_GET_RESERVED23                      303
1161 #define WLC_GET_RESERVED24                      304
1162 #define WLC_SET_RESERVED25                      305
1163 #define WLC_GET_RESERVED26                      306
1164 #define WLC_NPHY_SAMPLE_COLLECT                 307     /* Nphy sample collect mode */
1165 #define WLC_UM_PRIV                             308     /* for usermode driver private ioctl */
1166 #define WLC_GET_CMD                             309
1167                                                         /* #define WLC_LAST                             310 *//* Never used - can be reused */
1168 #define WLC_RESERVED8                           311
1169 #define WLC_RESERVED9                           312
1170 #define WLC_RESERVED1                           313
1171 #define WLC_RESERVED2                           314
1172 #define WLC_RESERVED3                           315
1173 #define WLC_LAST                                316
1174
1175 #ifndef EPICTRL_COOKIE
1176 #define EPICTRL_COOKIE          0xABADCEDE
1177 #endif
1178
1179 #define WL_DECRYPT_STATUS_SUCCESS       1
1180 #define WL_DECRYPT_STATUS_FAILURE       2
1181 #define WL_DECRYPT_STATUS_UNKNOWN       3
1182
1183 /* allows user-mode app to poll the status of USB image upgrade */
1184 #define WLC_UPGRADE_SUCCESS                     0
1185 #define WLC_UPGRADE_PENDING                     1
1186
1187 /* WLC_GET_AUTH, WLC_SET_AUTH values */
1188 #define WL_AUTH_OPEN_SYSTEM             0       /* d11 open authentication */
1189 #define WL_AUTH_SHARED_KEY              1       /* d11 shared authentication */
1190 #define WL_AUTH_OPEN_SHARED             2       /* try open, then shared if open failed w/rc 13 */
1191
1192 /* Bit masks for radio disabled status - returned by WL_GET_RADIO */
1193 #define WL_RADIO_SW_DISABLE             (1<<0)
1194 #define WL_RADIO_HW_DISABLE             (1<<1)
1195 #define WL_RADIO_MPC_DISABLE            (1<<2)
1196 #define WL_RADIO_COUNTRY_DISABLE        (1<<3)  /* some countries don't support any channel */
1197
1198 #define WL_SPURAVOID_OFF        0
1199 #define WL_SPURAVOID_ON1        1
1200 #define WL_SPURAVOID_ON2        2
1201
1202 /* Override bit for WLC_SET_TXPWR.  if set, ignore other level limits */
1203 #define WL_TXPWR_OVERRIDE       (1U<<31)
1204
1205 #define WL_PHY_PAVARS_LEN       6       /* Phy type, Band range, chain, a1, b0, b1 */
1206
1207 typedef struct wl_po {
1208         uint16 phy_type;        /* Phy type */
1209         uint16 band;
1210         uint16 cckpo;
1211         uint32 ofdmpo;
1212         uint16 mcspo[8];
1213 } wl_po_t;
1214
1215 /* a large TX Power as an init value to factor out of MIN() calculations,
1216  * keep low enough to fit in an s8, units are .25 dBm
1217  */
1218 #define WLC_TXPWR_MAX           (127)   /* ~32 dBm = 1,500 mW */
1219
1220 /* "diag" iovar argument and error code */
1221 #define WL_DIAG_INTERRUPT                       1       /* d11 loopback interrupt test */
1222 #define WL_DIAG_LOOPBACK                        2       /* d11 loopback data test */
1223 #define WL_DIAG_MEMORY                          3       /* d11 memory test */
1224 #define WL_DIAG_LED                             4       /* LED test */
1225 #define WL_DIAG_REG                             5       /* d11/phy register test */
1226 #define WL_DIAG_SROM                            6       /* srom read/crc test */
1227 #define WL_DIAG_DMA                             7       /* DMA test */
1228
1229 #define WL_DIAGERR_SUCCESS                      0
1230 #define WL_DIAGERR_FAIL_TO_RUN                  1       /* unable to run requested diag */
1231 #define WL_DIAGERR_NOT_SUPPORTED                2       /* diag requested is not supported */
1232 #define WL_DIAGERR_INTERRUPT_FAIL               3       /* loopback interrupt test failed */
1233 #define WL_DIAGERR_LOOPBACK_FAIL                4       /* loopback data test failed */
1234 #define WL_DIAGERR_SROM_FAIL                    5       /* srom read failed */
1235 #define WL_DIAGERR_SROM_BADCRC                  6       /* srom crc failed */
1236 #define WL_DIAGERR_REG_FAIL                     7       /* d11/phy register test failed */
1237 #define WL_DIAGERR_MEMORY_FAIL                  8       /* d11 memory test failed */
1238 #define WL_DIAGERR_NOMEM                        9       /* diag test failed due to no memory */
1239 #define WL_DIAGERR_DMA_FAIL                     10      /* DMA test failed */
1240
1241 #define WL_DIAGERR_MEMORY_TIMEOUT               11      /* d11 memory test didn't finish in time */
1242 #define WL_DIAGERR_MEMORY_BADPATTERN            12      /* d11 memory test result in bad pattern */
1243
1244 /* band types */
1245 #define WLC_BAND_AUTO           0       /* auto-select */
1246 #define WLC_BAND_5G             1       /* 5 Ghz */
1247 #define WLC_BAND_2G             2       /* 2.4 Ghz */
1248 #define WLC_BAND_ALL            3       /* all bands */
1249
1250 /* band range returned by band_range iovar */
1251 #define WL_CHAN_FREQ_RANGE_2G      0
1252 #define WL_CHAN_FREQ_RANGE_5GL     1
1253 #define WL_CHAN_FREQ_RANGE_5GM     2
1254 #define WL_CHAN_FREQ_RANGE_5GH     3
1255
1256 /* phy types (returned by WLC_GET_PHYTPE) */
1257 #define WLC_PHY_TYPE_A          0
1258 #define WLC_PHY_TYPE_B          1
1259 #define WLC_PHY_TYPE_G          2
1260 #define WLC_PHY_TYPE_N          4
1261 #define WLC_PHY_TYPE_LP         5
1262 #define WLC_PHY_TYPE_SSN        6
1263 #define WLC_PHY_TYPE_HT         7
1264 #define WLC_PHY_TYPE_LCN        8
1265 #define WLC_PHY_TYPE_NULL       0xf
1266
1267 /* MAC list modes */
1268 #define WLC_MACMODE_DISABLED    0       /* MAC list disabled */
1269 #define WLC_MACMODE_DENY        1       /* Deny specified (i.e. allow unspecified) */
1270 #define WLC_MACMODE_ALLOW       2       /* Allow specified (i.e. deny unspecified) */
1271
1272 /*
1273  * 54g modes (basic bits may still be overridden)
1274  *
1275  * GMODE_LEGACY_B                       Rateset: 1b, 2b, 5.5, 11
1276  *                                      Preamble: Long
1277  *                                      Shortslot: Off
1278  * GMODE_AUTO                           Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
1279  *                                      Extended Rateset: 6, 9, 12, 48
1280  *                                      Preamble: Long
1281  *                                      Shortslot: Auto
1282  * GMODE_ONLY                           Rateset: 1b, 2b, 5.5b, 11b, 18, 24b, 36, 54
1283  *                                      Extended Rateset: 6b, 9, 12b, 48
1284  *                                      Preamble: Short required
1285  *                                      Shortslot: Auto
1286  * GMODE_B_DEFERRED                     Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
1287  *                                      Extended Rateset: 6, 9, 12, 48
1288  *                                      Preamble: Long
1289  *                                      Shortslot: On
1290  * GMODE_PERFORMANCE                    Rateset: 1b, 2b, 5.5b, 6b, 9, 11b, 12b, 18, 24b, 36, 48, 54
1291  *                                      Preamble: Short required
1292  *                                      Shortslot: On and required
1293  * GMODE_LRS                            Rateset: 1b, 2b, 5.5b, 11b
1294  *                                      Extended Rateset: 6, 9, 12, 18, 24, 36, 48, 54
1295  *                                      Preamble: Long
1296  *                                      Shortslot: Auto
1297  */
1298 #define GMODE_LEGACY_B          0
1299 #define GMODE_AUTO              1
1300 #define GMODE_ONLY              2
1301 #define GMODE_B_DEFERRED        3
1302 #define GMODE_PERFORMANCE       4
1303 #define GMODE_LRS               5
1304 #define GMODE_MAX               6
1305
1306 /* values for PLCPHdr_override */
1307 #define WLC_PLCP_AUTO   -1
1308 #define WLC_PLCP_SHORT  0
1309 #define WLC_PLCP_LONG   1
1310
1311 /* values for g_protection_override and n_protection_override */
1312 #define WLC_PROTECTION_AUTO             -1
1313 #define WLC_PROTECTION_OFF              0
1314 #define WLC_PROTECTION_ON               1
1315 #define WLC_PROTECTION_MMHDR_ONLY       2
1316 #define WLC_PROTECTION_CTS_ONLY         3
1317
1318 /* values for g_protection_control and n_protection_control */
1319 #define WLC_PROTECTION_CTL_OFF          0
1320 #define WLC_PROTECTION_CTL_LOCAL        1
1321 #define WLC_PROTECTION_CTL_OVERLAP      2
1322
1323 /* values for n_protection */
1324 #define WLC_N_PROTECTION_OFF            0
1325 #define WLC_N_PROTECTION_OPTIONAL       1
1326 #define WLC_N_PROTECTION_20IN40         2
1327 #define WLC_N_PROTECTION_MIXEDMODE      3
1328
1329 /* values for n_preamble_type */
1330 #define WLC_N_PREAMBLE_MIXEDMODE        0
1331 #define WLC_N_PREAMBLE_GF               1
1332 #define WLC_N_PREAMBLE_GF_BRCM          2
1333
1334 /* values for band specific 40MHz capabilities */
1335 #define WLC_N_BW_20ALL                  0
1336 #define WLC_N_BW_40ALL                  1
1337 #define WLC_N_BW_20IN2G_40IN5G          2
1338
1339 /* values to force tx/rx chain */
1340 #define WLC_N_TXRX_CHAIN0               0
1341 #define WLC_N_TXRX_CHAIN1               1
1342
1343 /* bitflags for SGI support (sgi_rx iovar) */
1344 #define WLC_N_SGI_20                    0x01
1345 #define WLC_N_SGI_40                    0x02
1346
1347 /* Values for PM */
1348 #define PM_OFF  0
1349 #define PM_MAX  1
1350
1351 /* interference mitigation options */
1352 #define INTERFERE_OVRRIDE_OFF   -1      /* interference override off */
1353 #define INTERFERE_NONE  0       /* off */
1354 #define NON_WLAN        1       /* foreign/non 802.11 interference, no auto detect */
1355 #define WLAN_MANUAL     2       /* ACI: no auto detection */
1356 #define WLAN_AUTO       3       /* ACI: auto detect */
1357 #define WLAN_AUTO_W_NOISE       4       /* ACI: auto - detect and non 802.11 interference */
1358 #define AUTO_ACTIVE     (1 << 7)        /* Auto is currently active */
1359
1360 #define WL_RSSI_ANT_VERSION     1       /* current version of wl_rssi_ant_t */
1361 #define WL_ANT_RX_MAX           2       /* max 2 receive antennas */
1362 #define WL_ANT_HT_RX_MAX        3       /* max 3 receive antennas/cores */
1363 #define WL_ANT_IDX_1            0       /* antenna index 1 */
1364 #define WL_ANT_IDX_2            1       /* antenna index 2 */
1365
1366 #ifndef WL_RSSI_ANT_MAX
1367 #define WL_RSSI_ANT_MAX         4       /* max possible rx antennas */
1368 #elif WL_RSSI_ANT_MAX != 4
1369 #error "WL_RSSI_ANT_MAX does not match"
1370 #endif
1371
1372 /* RSSI per antenna */
1373 typedef struct {
1374         uint32 version;         /* version field */
1375         uint32 count;           /* number of valid antenna rssi */
1376         s8 rssi_ant[WL_RSSI_ANT_MAX];   /* rssi per antenna */
1377 } wl_rssi_ant_t;
1378
1379 #define NUM_PWRCTRL_RATES 12
1380
1381 typedef struct {
1382         u8 txpwr_band_max[NUM_PWRCTRL_RATES];   /* User set target */
1383         u8 txpwr_limit[NUM_PWRCTRL_RATES];      /* reg and local power limit */
1384         u8 txpwr_local_max;     /* local max according to the AP */
1385         u8 txpwr_local_constraint;      /* local constraint according to the AP */
1386         u8 txpwr_chan_reg_max;  /* Regulatory max for this channel */
1387         u8 txpwr_target[2][NUM_PWRCTRL_RATES];  /* Latest target for 2.4 and 5 Ghz */
1388         u8 txpwr_est_Pout[2];   /* Latest estimate for 2.4 and 5 Ghz */
1389         u8 txpwr_opo[NUM_PWRCTRL_RATES];        /* On G phy, OFDM power offset */
1390         u8 txpwr_bphy_cck_max[NUM_PWRCTRL_RATES];       /* Max CCK power for this band (SROM) */
1391         u8 txpwr_bphy_ofdm_max; /* Max OFDM power for this band (SROM) */
1392         u8 txpwr_aphy_max[NUM_PWRCTRL_RATES];   /* Max power for A band (SROM) */
1393         s8 txpwr_antgain[2];    /* Ant gain for each band - from SROM */
1394         u8 txpwr_est_Pout_gofdm;        /* Pwr estimate for 2.4 OFDM */
1395 } tx_power_legacy_t;
1396
1397 #define WL_TX_POWER_RATES_LEGACY        45
1398 #define WL_TX_POWER_MCS20_FIRST         12
1399 #define WL_TX_POWER_MCS20_NUM           16
1400 #define WL_TX_POWER_MCS40_FIRST         28
1401 #define WL_TX_POWER_MCS40_NUM           17
1402
1403 typedef struct {
1404         uint32 flags;
1405         chanspec_t chanspec;    /* txpwr report for this channel */
1406         chanspec_t local_chanspec;      /* channel on which we are associated */
1407         u8 local_max;   /* local max according to the AP */
1408         u8 local_constraint;    /* local constraint according to the AP */
1409         s8 antgain[2];  /* Ant gain for each band - from SROM */
1410         u8 rf_cores;            /* count of RF Cores being reported */
1411         u8 est_Pout[4]; /* Latest tx power out estimate per RF
1412                                  * chain without adjustment
1413                                  */
1414         u8 est_Pout_cck;        /* Latest CCK tx power out estimate */
1415         u8 user_limit[WL_TX_POWER_RATES_LEGACY];        /* User limit */
1416         u8 reg_limit[WL_TX_POWER_RATES_LEGACY]; /* Regulatory power limit */
1417         u8 board_limit[WL_TX_POWER_RATES_LEGACY];       /* Max power board can support (SROM) */
1418         u8 target[WL_TX_POWER_RATES_LEGACY];    /* Latest target power */
1419 } tx_power_legacy2_t;
1420
1421 #define WL_TX_POWER_RATES              101
1422 #define WL_TX_POWER_CCK_FIRST          0
1423 #define WL_TX_POWER_CCK_NUM            4
1424 #define WL_TX_POWER_OFDM_FIRST         4        /* Index for first 20MHz OFDM SISO rate */
1425 #define WL_TX_POWER_OFDM20_CDD_FIRST   12       /* Index for first 20MHz OFDM CDD rate */
1426 #define WL_TX_POWER_OFDM40_SISO_FIRST  52       /* Index for first 40MHz OFDM SISO rate */
1427 #define WL_TX_POWER_OFDM40_CDD_FIRST   60       /* Index for first 40MHz OFDM CDD rate */
1428 #define WL_TX_POWER_OFDM_NUM           8
1429 #define WL_TX_POWER_MCS20_SISO_FIRST   20       /* Index for first 20MHz MCS SISO rate */
1430 #define WL_TX_POWER_MCS20_CDD_FIRST    28       /* Index for first 20MHz MCS CDD rate */
1431 #define WL_TX_POWER_MCS20_STBC_FIRST   36       /* Index for first 20MHz MCS STBC rate */
1432 #define WL_TX_POWER_MCS20_SDM_FIRST    44       /* Index for first 20MHz MCS SDM rate */
1433 #define WL_TX_POWER_MCS40_SISO_FIRST   68       /* Index for first 40MHz MCS SISO rate */
1434 #define WL_TX_POWER_MCS40_CDD_FIRST    76       /* Index for first 40MHz MCS CDD rate */
1435 #define WL_TX_POWER_MCS40_STBC_FIRST   84       /* Index for first 40MHz MCS STBC rate */
1436 #define WL_TX_POWER_MCS40_SDM_FIRST    92       /* Index for first 40MHz MCS SDM rate */
1437 #define WL_TX_POWER_MCS_1_STREAM_NUM   8
1438 #define WL_TX_POWER_MCS_2_STREAM_NUM   8
1439 #define WL_TX_POWER_MCS_32             100      /* Index for 40MHz rate MCS 32 */
1440 #define WL_TX_POWER_MCS_32_NUM         1
1441
1442 /* sslpnphy specifics */
1443 #define WL_TX_POWER_MCS20_SISO_FIRST_SSN   12   /* Index for first 20MHz MCS SISO rate */
1444
1445 /* tx_power_t.flags bits */
1446 #define WL_TX_POWER_F_ENABLED   1
1447 #define WL_TX_POWER_F_HW        2
1448 #define WL_TX_POWER_F_MIMO      4
1449 #define WL_TX_POWER_F_SISO      8
1450
1451 typedef struct {
1452         uint32 flags;
1453         chanspec_t chanspec;    /* txpwr report for this channel */
1454         chanspec_t local_chanspec;      /* channel on which we are associated */
1455         u8 local_max;   /* local max according to the AP */
1456         u8 local_constraint;    /* local constraint according to the AP */
1457         s8 antgain[2];  /* Ant gain for each band - from SROM */
1458         u8 rf_cores;            /* count of RF Cores being reported */
1459         u8 est_Pout[4]; /* Latest tx power out estimate per RF chain */
1460         u8 est_Pout_act[4];     /* Latest tx power out estimate per RF chain
1461                                  * without adjustment
1462                                  */
1463         u8 est_Pout_cck;        /* Latest CCK tx power out estimate */
1464         u8 tx_power_max[4];     /* Maximum target power among all rates */
1465         u8 tx_power_max_rate_ind[4];    /* Index of the rate with the max target power */
1466         u8 user_limit[WL_TX_POWER_RATES];       /* User limit */
1467         u8 reg_limit[WL_TX_POWER_RATES];        /* Regulatory power limit */
1468         u8 board_limit[WL_TX_POWER_RATES];      /* Max power board can support (SROM) */
1469         u8 target[WL_TX_POWER_RATES];   /* Latest target power */
1470 } tx_power_t;
1471
1472 typedef struct tx_inst_power {
1473         u8 txpwr_est_Pout[2];   /* Latest estimate for 2.4 and 5 Ghz */
1474         u8 txpwr_est_Pout_gofdm;        /* Pwr estimate for 2.4 OFDM */
1475 } tx_inst_power_t;
1476
1477 /* Message levels */
1478 #define WL_ERROR_VAL            0x00000001
1479 #define WL_TRACE_VAL            0x00000002
1480 #define WL_AMPDU_VAL            0x20000000
1481 #define WL_FFPLD_VAL            0x40000000
1482
1483 /* maximum channels returned by the get valid channels iovar */
1484 #define WL_NUMCHANNELS          64
1485 #define WL_NUMCHANSPECS         100
1486
1487 struct tsinfo_arg {
1488         u8 octets[3];
1489 };
1490
1491 #define NFIFO                   6       /* # tx/rx fifopairs */
1492
1493 #define WL_CNT_T_VERSION        7       /* current version of wl_cnt_t struct */
1494
1495 typedef struct {
1496         uint16 version;         /* see definition of WL_CNT_T_VERSION */
1497         uint16 length;          /* length of entire structure */
1498
1499         /* transmit stat counters */
1500         uint32 txframe;         /* tx data frames */
1501         uint32 txbyte;          /* tx data bytes */
1502         uint32 txretrans;       /* tx mac retransmits */
1503         uint32 txerror;         /* tx data errors (derived: sum of others) */
1504         uint32 txctl;           /* tx management frames */
1505         uint32 txprshort;       /* tx short preamble frames */
1506         uint32 txserr;          /* tx status errors */
1507         uint32 txnobuf;         /* tx out of buffers errors */
1508         uint32 txnoassoc;       /* tx discard because we're not associated */
1509         uint32 txrunt;          /* tx runt frames */
1510         uint32 txchit;          /* tx header cache hit (fastpath) */
1511         uint32 txcmiss;         /* tx header cache miss (slowpath) */
1512         uint32 ieee_tx_status;  /* calls to ieee80211_tx_status */
1513         uint32 ieee_tx;         /* tx calls frm mac0211 */
1514         uint32 ieee_rx;         /* calls to ieee_rx */
1515
1516         /* transmit chip error counters */
1517         uint32 txuflo;          /* tx fifo underflows */
1518         uint32 txphyerr;        /* tx phy errors (indicated in tx status) */
1519         uint32 txphycrs;
1520
1521         /* receive stat counters */
1522         uint32 rxframe;         /* rx data frames */
1523         uint32 rxbyte;          /* rx data bytes */
1524         uint32 rxerror;         /* rx data errors (derived: sum of others) */
1525         uint32 rxctl;           /* rx management frames */
1526         uint32 rxnobuf;         /* rx out of buffers errors */
1527         uint32 rxnondata;       /* rx non data frames in the data channel errors */
1528         uint32 rxbadds;         /* rx bad DS errors */
1529         uint32 rxbadcm;         /* rx bad control or management frames */
1530         uint32 rxfragerr;       /* rx fragmentation errors */
1531         uint32 rxrunt;          /* rx runt frames */
1532         uint32 rxgiant;         /* rx giant frames */
1533         uint32 rxnoscb;         /* rx no scb error */
1534         uint32 rxbadproto;      /* rx invalid frames */
1535         uint32 rxbadsrcmac;     /* rx frames with Invalid Src Mac */
1536         uint32 rxbadda;         /* rx frames tossed for invalid da */
1537         uint32 rxfilter;        /* rx frames filtered out */
1538
1539         /* receive chip error counters */
1540         uint32 rxoflo;          /* rx fifo overflow errors */
1541         uint32 rxuflo[NFIFO];   /* rx dma descriptor underflow errors */
1542
1543         uint32 d11cnt_txrts_off;        /* d11cnt txrts value when reset d11cnt */
1544         uint32 d11cnt_rxcrc_off;        /* d11cnt rxcrc value when reset d11cnt */
1545         uint32 d11cnt_txnocts_off;      /* d11cnt txnocts value when reset d11cnt */
1546
1547         /* misc counters */
1548         uint32 dmade;           /* tx/rx dma descriptor errors */
1549         uint32 dmada;           /* tx/rx dma data errors */
1550         uint32 dmape;           /* tx/rx dma descriptor protocol errors */
1551         uint32 reset;           /* reset count */
1552         uint32 tbtt;            /* cnts the TBTT int's */
1553         uint32 txdmawar;
1554         uint32 pkt_callback_reg_fail;   /* callbacks register failure */
1555
1556         /* MAC counters: 32-bit version of d11.h's macstat_t */
1557         uint32 txallfrm;        /* total number of frames sent, incl. Data, ACK, RTS, CTS,
1558                                  * Control Management (includes retransmissions)
1559                                  */
1560         uint32 txrtsfrm;        /* number of RTS sent out by the MAC */
1561         uint32 txctsfrm;        /* number of CTS sent out by the MAC */
1562         uint32 txackfrm;        /* number of ACK frames sent out */
1563         uint32 txdnlfrm;        /* Not used */
1564         uint32 txbcnfrm;        /* beacons transmitted */
1565         uint32 txfunfl[8];      /* per-fifo tx underflows */
1566         uint32 txtplunfl;       /* Template underflows (mac was too slow to transmit ACK/CTS
1567                                  * or BCN)
1568                                  */
1569         uint32 txphyerror;      /* Transmit phy error, type of error is reported in tx-status for
1570                                  * driver enqueued frames
1571                                  */
1572         uint32 rxfrmtoolong;    /* Received frame longer than legal limit (2346 bytes) */
1573         uint32 rxfrmtooshrt;    /* Received frame did not contain enough bytes for its frame type */
1574         uint32 rxinvmachdr;     /* Either the protocol version != 0 or frame type not
1575                                  * data/control/management
1576                                  */
1577         uint32 rxbadfcs;        /* number of frames for which the CRC check failed in the MAC */
1578         uint32 rxbadplcp;       /* parity check of the PLCP header failed */
1579         uint32 rxcrsglitch;     /* PHY was able to correlate the preamble but not the header */
1580         uint32 rxstrt;          /* Number of received frames with a good PLCP
1581                                  * (i.e. passing parity check)
1582                                  */
1583         uint32 rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */
1584         uint32 rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
1585         uint32 rxcfrmucast;     /* number of received CNTRL frames with good FCS and matching RA */
1586         uint32 rxrtsucast;      /* number of unicast RTS addressed to the MAC (good FCS) */
1587         uint32 rxctsucast;      /* number of unicast CTS addressed to the MAC (good FCS) */
1588         uint32 rxackucast;      /* number of ucast ACKS received (good FCS) */
1589         uint32 rxdfrmocast;     /* number of received DATA frames (good FCS and not matching RA) */
1590         uint32 rxmfrmocast;     /* number of received MGMT frames (good FCS and not matching RA) */
1591         uint32 rxcfrmocast;     /* number of received CNTRL frame (good FCS and not matching RA) */
1592         uint32 rxrtsocast;      /* number of received RTS not addressed to the MAC */
1593         uint32 rxctsocast;      /* number of received CTS not addressed to the MAC */
1594         uint32 rxdfrmmcast;     /* number of RX Data multicast frames received by the MAC */
1595         uint32 rxmfrmmcast;     /* number of RX Management multicast frames received by the MAC */
1596         uint32 rxcfrmmcast;     /* number of RX Control multicast frames received by the MAC
1597                                  * (unlikely to see these)
1598                                  */
1599         uint32 rxbeaconmbss;    /* beacons received from member of BSS */
1600         uint32 rxdfrmucastobss; /* number of unicast frames addressed to the MAC from
1601                                  * other BSS (WDS FRAME)
1602                                  */
1603         uint32 rxbeaconobss;    /* beacons received from other BSS */
1604         uint32 rxrsptmout;      /* Number of response timeouts for transmitted frames
1605                                  * expecting a response
1606                                  */
1607         uint32 bcntxcancl;      /* transmit beacons canceled due to receipt of beacon (IBSS) */
1608         uint32 rxf0ovfl;        /* Number of receive fifo 0 overflows */
1609         uint32 rxf1ovfl;        /* Number of receive fifo 1 overflows (obsolete) */
1610         uint32 rxf2ovfl;        /* Number of receive fifo 2 overflows (obsolete) */
1611         uint32 txsfovfl;        /* Number of transmit status fifo overflows (obsolete) */
1612         uint32 pmqovfl;         /* Number of PMQ overflows */
1613         uint32 rxcgprqfrm;      /* Number of received Probe requests that made it into
1614                                  * the PRQ fifo
1615                                  */
1616         uint32 rxcgprsqovfl;    /* Rx Probe Request Que overflow in the AP */
1617         uint32 txcgprsfail;     /* Tx Probe Response Fail. AP sent probe response but did
1618                                  * not get ACK
1619                                  */
1620         uint32 txcgprssuc;      /* Tx Probe Response Success (ACK was received) */
1621         uint32 prs_timeout;     /* Number of probe requests that were dropped from the PRQ
1622                                  * fifo because a probe response could not be sent out within
1623                                  * the time limit defined in M_PRS_MAXTIME
1624                                  */
1625         uint32 rxnack;
1626         uint32 frmscons;
1627         uint32 txnack;
1628         uint32 txglitch_nack;   /* obsolete */
1629         uint32 txburst;         /* obsolete */
1630
1631         /* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
1632         uint32 txfrag;          /* dot11TransmittedFragmentCount */
1633         uint32 txmulti;         /* dot11MulticastTransmittedFrameCount */
1634         uint32 txfail;          /* dot11FailedCount */
1635         uint32 txretry;         /* dot11RetryCount */
1636         uint32 txretrie;        /* dot11MultipleRetryCount */
1637         uint32 rxdup;           /* dot11FrameduplicateCount */
1638         uint32 txrts;           /* dot11RTSSuccessCount */
1639         uint32 txnocts;         /* dot11RTSFailureCount */
1640         uint32 txnoack;         /* dot11ACKFailureCount */
1641         uint32 rxfrag;          /* dot11ReceivedFragmentCount */
1642         uint32 rxmulti;         /* dot11MulticastReceivedFrameCount */
1643         uint32 rxcrc;           /* dot11FCSErrorCount */
1644         uint32 txfrmsnt;        /* dot11TransmittedFrameCount (bogus MIB?) */
1645         uint32 rxundec;         /* dot11WEPUndecryptableCount */
1646
1647         /* WPA2 counters (see rxundec for DecryptFailureCount) */
1648         uint32 tkipmicfaill;    /* TKIPLocalMICFailures */
1649         uint32 tkipcntrmsr;     /* TKIPCounterMeasuresInvoked */
1650         uint32 tkipreplay;      /* TKIPReplays */
1651         uint32 ccmpfmterr;      /* CCMPFormatErrors */
1652         uint32 ccmpreplay;      /* CCMPReplays */
1653         uint32 ccmpundec;       /* CCMPDecryptErrors */
1654         uint32 fourwayfail;     /* FourWayHandshakeFailures */
1655         uint32 wepundec;        /* dot11WEPUndecryptableCount */
1656         uint32 wepicverr;       /* dot11WEPICVErrorCount */
1657         uint32 decsuccess;      /* DecryptSuccessCount */
1658         uint32 tkipicverr;      /* TKIPICVErrorCount */
1659         uint32 wepexcluded;     /* dot11WEPExcludedCount */
1660
1661         uint32 rxundec_mcst;    /* dot11WEPUndecryptableCount */
1662
1663         /* WPA2 counters (see rxundec for DecryptFailureCount) */
1664         uint32 tkipmicfaill_mcst;       /* TKIPLocalMICFailures */
1665         uint32 tkipcntrmsr_mcst;        /* TKIPCounterMeasuresInvoked */
1666         uint32 tkipreplay_mcst; /* TKIPReplays */
1667         uint32 ccmpfmterr_mcst; /* CCMPFormatErrors */
1668         uint32 ccmpreplay_mcst; /* CCMPReplays */
1669         uint32 ccmpundec_mcst;  /* CCMPDecryptErrors */
1670         uint32 fourwayfail_mcst;        /* FourWayHandshakeFailures */
1671         uint32 wepundec_mcst;   /* dot11WEPUndecryptableCount */
1672         uint32 wepicverr_mcst;  /* dot11WEPICVErrorCount */
1673         uint32 decsuccess_mcst; /* DecryptSuccessCount */
1674         uint32 tkipicverr_mcst; /* TKIPICVErrorCount */
1675         uint32 wepexcluded_mcst;        /* dot11WEPExcludedCount */
1676
1677         uint32 txchanrej;       /* Tx frames suppressed due to channel rejection */
1678         uint32 txexptime;       /* Tx frames suppressed due to timer expiration */
1679         uint32 psmwds;          /* Count PSM watchdogs */
1680         uint32 phywatchdog;     /* Count Phy watchdogs (triggered by ucode) */
1681
1682         /* MBSS counters, AP only */
1683         uint32 prq_entries_handled;     /* PRQ entries read in */
1684         uint32 prq_undirected_entries;  /*    which were bcast bss & ssid */
1685         uint32 prq_bad_entries; /*    which could not be translated to info */
1686         uint32 atim_suppress_count;     /* TX suppressions on ATIM fifo */
1687         uint32 bcn_template_not_ready;  /* Template marked in use on send bcn ... */
1688         uint32 bcn_template_not_ready_done;     /* ...but "DMA done" interrupt rcvd */
1689         uint32 late_tbtt_dpc;   /* TBTT DPC did not happen in time */
1690
1691         /* per-rate receive stat counters */
1692         uint32 rx1mbps;         /* packets rx at 1Mbps */
1693         uint32 rx2mbps;         /* packets rx at 2Mbps */
1694         uint32 rx5mbps5;        /* packets rx at 5.5Mbps */
1695         uint32 rx6mbps;         /* packets rx at 6Mbps */
1696         uint32 rx9mbps;         /* packets rx at 9Mbps */
1697         uint32 rx11mbps;        /* packets rx at 11Mbps */
1698         uint32 rx12mbps;        /* packets rx at 12Mbps */
1699         uint32 rx18mbps;        /* packets rx at 18Mbps */
1700         uint32 rx24mbps;        /* packets rx at 24Mbps */
1701         uint32 rx36mbps;        /* packets rx at 36Mbps */
1702         uint32 rx48mbps;        /* packets rx at 48Mbps */
1703         uint32 rx54mbps;        /* packets rx at 54Mbps */
1704         uint32 rx108mbps;       /* packets rx at 108mbps */
1705         uint32 rx162mbps;       /* packets rx at 162mbps */
1706         uint32 rx216mbps;       /* packets rx at 216 mbps */
1707         uint32 rx270mbps;       /* packets rx at 270 mbps */
1708         uint32 rx324mbps;       /* packets rx at 324 mbps */
1709         uint32 rx378mbps;       /* packets rx at 378 mbps */
1710         uint32 rx432mbps;       /* packets rx at 432 mbps */
1711         uint32 rx486mbps;       /* packets rx at 486 mbps */
1712         uint32 rx540mbps;       /* packets rx at 540 mbps */
1713
1714         /* pkteng rx frame stats */
1715         uint32 pktengrxducast;  /* unicast frames rxed by the pkteng code */
1716         uint32 pktengrxdmcast;  /* multicast frames rxed by the pkteng code */
1717
1718         uint32 rfdisable;       /* count of radio disables */
1719         uint32 bphy_rxcrsglitch;        /* PHY count of bphy glitches */
1720
1721         uint32 txmpdu_sgi;      /* count for sgi transmit */
1722         uint32 rxmpdu_sgi;      /* count for sgi received */
1723         uint32 txmpdu_stbc;     /* count for stbc transmit */
1724         uint32 rxmpdu_stbc;     /* count for stbc received */
1725 } wl_cnt_t;
1726
1727 #define WL_DELTA_STATS_T_VERSION        1       /* current version of wl_delta_stats_t struct */
1728
1729 typedef struct {
1730         uint16 version;         /* see definition of WL_DELTA_STATS_T_VERSION */
1731         uint16 length;          /* length of entire structure */
1732
1733         /* transmit stat counters */
1734         uint32 txframe;         /* tx data frames */
1735         uint32 txbyte;          /* tx data bytes */
1736         uint32 txretrans;       /* tx mac retransmits */
1737         uint32 txfail;          /* tx failures */
1738
1739         /* receive stat counters */
1740         uint32 rxframe;         /* rx data frames */
1741         uint32 rxbyte;          /* rx data bytes */
1742
1743         /* per-rate receive stat counters */
1744         uint32 rx1mbps;         /* packets rx at 1Mbps */
1745         uint32 rx2mbps;         /* packets rx at 2Mbps */
1746         uint32 rx5mbps5;        /* packets rx at 5.5Mbps */
1747         uint32 rx6mbps;         /* packets rx at 6Mbps */
1748         uint32 rx9mbps;         /* packets rx at 9Mbps */
1749         uint32 rx11mbps;        /* packets rx at 11Mbps */
1750         uint32 rx12mbps;        /* packets rx at 12Mbps */
1751         uint32 rx18mbps;        /* packets rx at 18Mbps */
1752         uint32 rx24mbps;        /* packets rx at 24Mbps */
1753         uint32 rx36mbps;        /* packets rx at 36Mbps */
1754         uint32 rx48mbps;        /* packets rx at 48Mbps */
1755         uint32 rx54mbps;        /* packets rx at 54Mbps */
1756         uint32 rx108mbps;       /* packets rx at 108mbps */
1757         uint32 rx162mbps;       /* packets rx at 162mbps */
1758         uint32 rx216mbps;       /* packets rx at 216 mbps */
1759         uint32 rx270mbps;       /* packets rx at 270 mbps */
1760         uint32 rx324mbps;       /* packets rx at 324 mbps */
1761         uint32 rx378mbps;       /* packets rx at 378 mbps */
1762         uint32 rx432mbps;       /* packets rx at 432 mbps */
1763         uint32 rx486mbps;       /* packets rx at 486 mbps */
1764         uint32 rx540mbps;       /* packets rx at 540 mbps */
1765 } wl_delta_stats_t;
1766
1767 #define WL_WME_CNT_VERSION      1       /* current version of wl_wme_cnt_t */
1768
1769 typedef struct {
1770         uint32 packets;
1771         uint32 bytes;
1772 } wl_traffic_stats_t;
1773
1774 typedef struct {
1775         uint16 version;         /* see definition of WL_WME_CNT_VERSION */
1776         uint16 length;          /* length of entire structure */
1777
1778         wl_traffic_stats_t tx[AC_COUNT];        /* Packets transmitted */
1779         wl_traffic_stats_t tx_failed[AC_COUNT]; /* Packets dropped or failed to transmit */
1780         wl_traffic_stats_t rx[AC_COUNT];        /* Packets received */
1781         wl_traffic_stats_t rx_failed[AC_COUNT]; /* Packets failed to receive */
1782
1783         wl_traffic_stats_t forward[AC_COUNT];   /* Packets forwarded by AP */
1784
1785         wl_traffic_stats_t tx_expired[AC_COUNT];        /* packets dropped due to lifetime expiry */
1786
1787 } wl_wme_cnt_t;
1788
1789 struct wl_msglevel2 {
1790         uint32 low;
1791         uint32 high;
1792 };
1793
1794 #ifdef WLBA
1795
1796 #define WLC_BA_CNT_VERSION      1       /* current version of wlc_ba_cnt_t */
1797
1798 /* block ack related stats */
1799 typedef struct wlc_ba_cnt {
1800         uint16 version;         /* WLC_BA_CNT_VERSION */
1801         uint16 length;          /* length of entire structure */
1802
1803         /* transmit stat counters */
1804         uint32 txpdu;           /* pdus sent */
1805         uint32 txsdu;           /* sdus sent */
1806         uint32 txfc;            /* tx side flow controlled packets */
1807         uint32 txfci;           /* tx side flow control initiated */
1808         uint32 txretrans;       /* retransmitted pdus */
1809         uint32 txbatimer;       /* ba resend due to timer */
1810         uint32 txdrop;          /* dropped packets */
1811         uint32 txaddbareq;      /* addba req sent */
1812         uint32 txaddbaresp;     /* addba resp sent */
1813         uint32 txdelba;         /* delba sent */
1814         uint32 txba;            /* ba sent */
1815         uint32 txbar;           /* bar sent */
1816         uint32 txpad[4];        /* future */
1817
1818         /* receive side counters */
1819         uint32 rxpdu;           /* pdus recd */
1820         uint32 rxqed;           /* pdus buffered before sending up */
1821         uint32 rxdup;           /* duplicate pdus */
1822         uint32 rxnobuf;         /* pdus discarded due to no buf */
1823         uint32 rxaddbareq;      /* addba req recd */
1824         uint32 rxaddbaresp;     /* addba resp recd */
1825         uint32 rxdelba;         /* delba recd */
1826         uint32 rxba;            /* ba recd */
1827         uint32 rxbar;           /* bar recd */
1828         uint32 rxinvba;         /* invalid ba recd */
1829         uint32 rxbaholes;       /* ba recd with holes */
1830         uint32 rxunexp;         /* unexpected packets */
1831         uint32 rxpad[4];        /* future */
1832 } wlc_ba_cnt_t;
1833 #endif                          /* WLBA */
1834
1835 /* structure for per-tid ampdu control */
1836 struct ampdu_tid_control {
1837         u8 tid;         /* tid */
1838         u8 enable;              /* enable/disable */
1839 };
1840
1841 /* structure for identifying ea/tid for sending addba/delba */
1842 struct ampdu_ea_tid {
1843         struct ether_addr ea;   /* Station address */
1844         u8 tid;         /* tid */
1845 };
1846 /* structure for identifying retry/tid for retry_limit_tid/rr_retry_limit_tid */
1847 struct ampdu_retry_tid {
1848         u8 tid;         /* tid */
1849         u8 retry;               /* retry value */
1850 };
1851
1852 /* structure for addts arguments */
1853 /* For ioctls that take a list of TSPEC */
1854 struct tslist {
1855         int count;              /* number of tspecs */
1856         struct tsinfo_arg tsinfo[1];    /* variable length array of tsinfo */
1857 };
1858
1859 /* structure for addts/delts arguments */
1860 typedef struct tspec_arg {
1861         uint16 version;         /* see definition of TSPEC_ARG_VERSION */
1862         uint16 length;          /* length of entire structure */
1863         uint flag;              /* bit field */
1864         /* TSPEC Arguments */
1865         struct tsinfo_arg tsinfo;       /* TS Info bit field */
1866         uint16 nom_msdu_size;   /* (Nominal or fixed) MSDU Size (bytes) */
1867         uint16 max_msdu_size;   /* Maximum MSDU Size (bytes) */
1868         uint min_srv_interval;  /* Minimum Service Interval (us) */
1869         uint max_srv_interval;  /* Maximum Service Interval (us) */
1870         uint inactivity_interval;       /* Inactivity Interval (us) */
1871         uint suspension_interval;       /* Suspension Interval (us) */
1872         uint srv_start_time;    /* Service Start Time (us) */
1873         uint min_data_rate;     /* Minimum Data Rate (bps) */
1874         uint mean_data_rate;    /* Mean Data Rate (bps) */
1875         uint peak_data_rate;    /* Peak Data Rate (bps) */
1876         uint max_burst_size;    /* Maximum Burst Size (bytes) */
1877         uint delay_bound;       /* Delay Bound (us) */
1878         uint min_phy_rate;      /* Minimum PHY Rate (bps) */
1879         uint16 surplus_bw;      /* Surplus Bandwidth Allowance (range 1.0 to 8.0) */
1880         uint16 medium_time;     /* Medium Time (32 us/s periods) */
1881         u8 dialog_token;        /* dialog token */
1882 } tspec_arg_t;
1883
1884 /* tspec arg for desired station */
1885 typedef struct tspec_per_sta_arg {
1886         struct ether_addr ea;
1887         struct tspec_arg ts;
1888 } tspec_per_sta_arg_t;
1889
1890 /* structure for max bandwidth for each access category */
1891 typedef struct wme_max_bandwidth {
1892         uint32 ac[AC_COUNT];    /* max bandwidth for each access category */
1893 } wme_max_bandwidth_t;
1894
1895 #define WL_WME_MBW_PARAMS_IO_BYTES (sizeof(wme_max_bandwidth_t))
1896
1897 /* current version of wl_tspec_arg_t struct */
1898 #define TSPEC_ARG_VERSION               2       /* current version of wl_tspec_arg_t struct */
1899 #define TSPEC_ARG_LENGTH                55      /* argument length from tsinfo to medium_time */
1900 #define TSPEC_DEFAULT_DIALOG_TOKEN      42      /* default dialog token */
1901 #define TSPEC_DEFAULT_SBW_FACTOR        0x3000  /* default surplus bw */
1902
1903 /* define for flag */
1904 #define TSPEC_PENDING           0       /* TSPEC pending */
1905 #define TSPEC_ACCEPTED          1       /* TSPEC accepted */
1906 #define TSPEC_REJECTED          2       /* TSPEC rejected */
1907 #define TSPEC_UNKNOWN           3       /* TSPEC unknown */
1908 #define TSPEC_STATUS_MASK       7       /* TSPEC status mask */
1909
1910 /* Software feature flag defines used by wlfeatureflag */
1911 #define WL_SWFL_NOHWRADIO       0x0004
1912 #define WL_SWFL_FLOWCONTROL     0x0008  /* Enable backpressure to OS stack */
1913 #define WL_SWFL_WLBSSSORT       0x0010  /* Per-port supports sorting of BSS */
1914
1915 #define WL_LIFETIME_MAX 0xFFFF  /* Max value in ms */
1916
1917 /*
1918  * Dongle pattern matching filter.
1919  */
1920
1921 /* Packet filter types. Currently, only pattern matching is supported. */
1922 typedef enum wl_pkt_filter_type {
1923         WL_PKT_FILTER_TYPE_PATTERN_MATCH        /* Pattern matching filter */
1924 } wl_pkt_filter_type_t;
1925
1926 #define WL_PKT_FILTER_TYPE wl_pkt_filter_type_t
1927
1928 /* Pattern matching filter. Specifies an offset within received packets to
1929  * start matching, the pattern to match, the size of the pattern, and a bitmask
1930  * that indicates which bits within the pattern should be matched.
1931  */
1932 typedef struct wl_pkt_filter_pattern {
1933         uint32 offset;          /* Offset within received packet to start pattern matching.
1934                                  * Offset '0' is the first byte of the ethernet header.
1935                                  */
1936         uint32 size_bytes;      /* Size of the pattern.  Bitmask must be the same size. */
1937         u8 mask_and_pattern[1]; /* Variable length mask and pattern data.  mask starts
1938                                          * at offset 0.  Pattern immediately follows mask.
1939                                          */
1940 } wl_pkt_filter_pattern_t;
1941
1942 /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
1943 typedef struct wl_pkt_filter {
1944         uint32 id;              /* Unique filter id, specified by app. */
1945         uint32 type;            /* Filter type (WL_PKT_FILTER_TYPE_xxx). */
1946         uint32 negate_match;    /* Negate the result of filter matches */
1947         union {                 /* Filter definitions */
1948                 wl_pkt_filter_pattern_t pattern;        /* Pattern matching filter */
1949         } u;
1950 } wl_pkt_filter_t;
1951
1952 #define WL_PKT_FILTER_FIXED_LEN           OFFSETOF(wl_pkt_filter_t, u)
1953 #define WL_PKT_FILTER_PATTERN_FIXED_LEN   OFFSETOF(wl_pkt_filter_pattern_t, mask_and_pattern)
1954
1955 /* IOVAR "pkt_filter_enable" parameter. */
1956 typedef struct wl_pkt_filter_enable {
1957         uint32 id;              /* Unique filter id */
1958         uint32 enable;          /* Enable/disable bool */
1959 } wl_pkt_filter_enable_t;
1960
1961 /* IOVAR "pkt_filter_list" parameter. Used to retrieve a list of installed filters. */
1962 typedef struct wl_pkt_filter_list {
1963         uint32 num;             /* Number of installed packet filters */
1964         wl_pkt_filter_t filter[1];      /* Variable array of packet filters. */
1965 } wl_pkt_filter_list_t;
1966
1967 #define WL_PKT_FILTER_LIST_FIXED_LEN      OFFSETOF(wl_pkt_filter_list_t, filter)
1968
1969 /* IOVAR "pkt_filter_stats" parameter. Used to retrieve debug statistics. */
1970 typedef struct wl_pkt_filter_stats {
1971         uint32 num_pkts_matched;        /* # filter matches for specified filter id */
1972         uint32 num_pkts_forwarded;      /* # packets fwded from dongle to host for all filters */
1973         uint32 num_pkts_discarded;      /* # packets discarded by dongle for all filters */
1974 } wl_pkt_filter_stats_t;
1975
1976 typedef struct wl_pkteng {
1977         uint32 flags;
1978         uint32 delay;           /* Inter-packet delay */
1979         uint32 nframes;         /* Number of frames */
1980         uint32 length;          /* Packet length */
1981         u8 seqno;               /* Enable/disable sequence no. */
1982         struct ether_addr dest; /* Destination address */
1983         struct ether_addr src;  /* Source address */
1984 } wl_pkteng_t;
1985
1986 #define WLC_RSSI_INVALID         0      /* invalid RSSI value */
1987
1988 /* require default structure packing */
1989 #include <packed_section_end.h>
1990
1991 /* n-mode support capability */
1992 /* 2x2 includes both 1x1 & 2x2 devices
1993  * reserved #define 2 for future when we want to separate 1x1 & 2x2 and
1994  * control it independently
1995  */
1996 #define WL_11N_2x2                      1
1997 #define WL_11N_3x3                      3
1998 #define WL_11N_4x4                      4
1999
2000 /* define 11n feature disable flags */
2001 #define WLFEATURE_DISABLE_11N           0x00000001
2002 #define WLFEATURE_DISABLE_11N_STBC_TX   0x00000002
2003 #define WLFEATURE_DISABLE_11N_STBC_RX   0x00000004
2004 #define WLFEATURE_DISABLE_11N_SGI_TX    0x00000008
2005 #define WLFEATURE_DISABLE_11N_SGI_RX    0x00000010
2006 #define WLFEATURE_DISABLE_11N_AMPDU_TX  0x00000020
2007 #define WLFEATURE_DISABLE_11N_AMPDU_RX  0x00000040
2008 #define WLFEATURE_DISABLE_11N_GF        0x00000080
2009
2010 #define WL_EVENTING_MASK_LEN    16
2011
2012 #define TOE_TX_CSUM_OL          0x00000001
2013 #define TOE_RX_CSUM_OL          0x00000002
2014
2015 #define PM_OFF  0
2016 #define PM_MAX  1
2017 #define PM_FAST 2
2018
2019 typedef enum sup_auth_status {
2020         WLC_SUP_DISCONNECTED = 0,
2021         WLC_SUP_CONNECTING,
2022         WLC_SUP_IDREQUIRED,
2023         WLC_SUP_AUTHENTICATING,
2024         WLC_SUP_AUTHENTICATED,
2025         WLC_SUP_KEYXCHANGE,
2026         WLC_SUP_KEYED,
2027         WLC_SUP_TIMEOUT,
2028         WLC_SUP_LAST_BASIC_STATE,
2029         WLC_SUP_KEYXCHANGE_WAIT_M1 = WLC_SUP_AUTHENTICATED,
2030         WLC_SUP_KEYXCHANGE_PREP_M2 = WLC_SUP_KEYXCHANGE,
2031         WLC_SUP_KEYXCHANGE_WAIT_M3 = WLC_SUP_LAST_BASIC_STATE,
2032         WLC_SUP_KEYXCHANGE_PREP_M4,
2033         WLC_SUP_KEYXCHANGE_WAIT_G1,
2034         WLC_SUP_KEYXCHANGE_PREP_G2
2035 } sup_auth_status_t;
2036 #endif                          /* _wlioctl_h_ */