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