wlioctl.h revision 4a3a0faf9abf605caf9ff7b27755d867b9ac9403
1/*
2 * Custom OID/ioctl definitions for
3 * Broadcom 802.11abg Networking Device Driver
4 *
5 * Definitions subject to change without notice.
6 *
7 * Copyright (C) 1999-2012, Broadcom Corporation
8 *
9 *      Unless you and Broadcom execute a separate written software license
10 * agreement governing use of this software, this software is licensed to you
11 * under the terms of the GNU General Public License version 2 (the "GPL"),
12 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
13 * following added to such license:
14 *
15 *      As a special exception, the copyright holders of this software give you
16 * permission to link this software with independent modules, and to copy and
17 * distribute the resulting executable under terms of your choice, provided that
18 * you also meet, for each linked independent module, the terms and conditions of
19 * the license of that module.  An independent module is a module which is not
20 * derived from this software.  The special exception does not apply to any
21 * modifications of the software.
22 *
23 *      Notwithstanding the above, under no circumstances may you combine this
24 * software in any way with any other Broadcom software provided under a license
25 * other than the GPL, without Broadcom's express prior written consent.
26 *
27 * $Id: wlioctl.h 325538 2012-04-03 19:46:57Z $
28 */
29
30#ifndef _wlioctl_h_
31#define	_wlioctl_h_
32
33#include <typedefs.h>
34#include <proto/ethernet.h>
35#include <proto/bcmeth.h>
36#include <proto/bcmevent.h>
37#include <proto/802.11.h>
38#include <bcmwifi_channels.h>
39#include <bcmwifi_rates.h>
40
41#include <bcm_mpool_pub.h>
42#include <bcmcdc.h>
43
44#ifndef INTF_NAME_SIZ
45#define INTF_NAME_SIZ	16
46#endif
47
48/* Used to send ioctls over the transport pipe */
49typedef struct remote_ioctl {
50	cdc_ioctl_t 	msg;
51	uint		data_len;
52	char            intf_name[INTF_NAME_SIZ];
53} rem_ioctl_t;
54#define REMOTE_SIZE	sizeof(rem_ioctl_t)
55
56#define ACTION_FRAME_SIZE 1800
57
58typedef struct wl_action_frame {
59	struct ether_addr 	da;
60	uint16 			len;
61	uint32 			packetId;
62	uint8			data[ACTION_FRAME_SIZE];
63} wl_action_frame_t;
64
65#define WL_WIFI_ACTION_FRAME_SIZE sizeof(struct wl_action_frame)
66
67typedef struct ssid_info
68{
69	uint8		ssid_len;	/* the length of SSID */
70	uint8		ssid[32];	/* SSID string */
71} ssid_info_t;
72
73typedef struct wl_af_params {
74	uint32 			channel;
75	int32 			dwell_time;
76	struct ether_addr 	BSSID;
77	wl_action_frame_t	action_frame;
78} wl_af_params_t;
79
80#define WL_WIFI_AF_PARAMS_SIZE sizeof(struct wl_af_params)
81
82#define MFP_TEST_FLAG_NORMAL	0
83#define MFP_TEST_FLAG_ANY_KEY	1
84typedef struct wl_sa_query {
85	uint32			flag;
86	uint8 			action;
87	uint16 			id;
88	struct ether_addr 	da;
89} wl_sa_query_t;
90
91
92/* require default structure packing */
93#define BWL_DEFAULT_PACKING
94#include <packed_section_start.h>
95
96
97#ifndef LINUX_POSTMOGRIFY_REMOVAL
98/* Legacy structure to help keep backward compatible wl tool and tray app */
99
100#define	LEGACY_WL_BSS_INFO_VERSION	107	/* older version of wl_bss_info struct */
101
102typedef struct wl_bss_info_107 {
103	uint32		version;		/* version field */
104	uint32		length;			/* byte length of data in this record,
105						 * starting at version and including IEs
106						 */
107	struct ether_addr BSSID;
108	uint16		beacon_period;		/* units are Kusec */
109	uint16		capability;		/* Capability information */
110	uint8		SSID_len;
111	uint8		SSID[32];
112	struct {
113		uint	count;			/* # rates in this set */
114		uint8	rates[16];		/* rates in 500kbps units w/hi bit set if basic */
115	} rateset;				/* supported rates */
116	uint8		channel;		/* Channel no. */
117	uint16		atim_window;		/* units are Kusec */
118	uint8		dtim_period;		/* DTIM period */
119	int16		RSSI;			/* receive signal strength (in dBm) */
120	int8		phy_noise;		/* noise (in dBm) */
121	uint32		ie_length;		/* byte length of Information Elements */
122	/* variable length Information Elements */
123} wl_bss_info_107_t;
124#endif /* LINUX_POSTMOGRIFY_REMOVAL */
125
126/*
127 * Per-BSS information structure.
128 */
129
130#define	LEGACY2_WL_BSS_INFO_VERSION	108		/* old version of wl_bss_info struct */
131
132/* BSS info structure
133 * Applications MUST CHECK ie_offset field and length field to access IEs and
134 * next bss_info structure in a vector (in wl_scan_results_t)
135 */
136typedef struct wl_bss_info_108 {
137	uint32		version;		/* version field */
138	uint32		length;			/* byte length of data in this record,
139						 * starting at version and including IEs
140						 */
141	struct ether_addr BSSID;
142	uint16		beacon_period;		/* units are Kusec */
143	uint16		capability;		/* Capability information */
144	uint8		SSID_len;
145	uint8		SSID[32];
146	struct {
147		uint	count;			/* # rates in this set */
148		uint8	rates[16];		/* rates in 500kbps units w/hi bit set if basic */
149	} rateset;				/* supported rates */
150	chanspec_t	chanspec;		/* chanspec for bss */
151	uint16		atim_window;		/* units are Kusec */
152	uint8		dtim_period;		/* DTIM period */
153	int16		RSSI;			/* receive signal strength (in dBm) */
154	int8		phy_noise;		/* noise (in dBm) */
155
156	uint8		n_cap;			/* BSS is 802.11N Capable */
157	uint32		nbss_cap;		/* 802.11N BSS Capabilities (based on HT_CAP_*) */
158	uint8		ctl_ch;			/* 802.11N BSS control channel number */
159	uint32		reserved32[1];		/* Reserved for expansion of BSS properties */
160	uint8		flags;			/* flags */
161	uint8		reserved[3];		/* Reserved for expansion of BSS properties */
162	uint8		basic_mcs[MCSSET_LEN];	/* 802.11N BSS required MCS set */
163
164	uint16		ie_offset;		/* offset at which IEs start, from beginning */
165	uint32		ie_length;		/* byte length of Information Elements */
166	/* Add new fields here */
167	/* variable length Information Elements */
168} wl_bss_info_108_t;
169
170#define	WL_BSS_INFO_VERSION	109		/* current version of wl_bss_info struct */
171
172/* BSS info structure
173 * Applications MUST CHECK ie_offset field and length field to access IEs and
174 * next bss_info structure in a vector (in wl_scan_results_t)
175 */
176typedef struct wl_bss_info {
177	uint32		version;		/* version field */
178	uint32		length;			/* byte length of data in this record,
179						 * starting at version and including IEs
180						 */
181	struct ether_addr BSSID;
182	uint16		beacon_period;		/* units are Kusec */
183	uint16		capability;		/* Capability information */
184	uint8		SSID_len;
185	uint8		SSID[32];
186	struct {
187		uint	count;			/* # rates in this set */
188		uint8	rates[16];		/* rates in 500kbps units w/hi bit set if basic */
189	} rateset;				/* supported rates */
190	chanspec_t	chanspec;		/* chanspec for bss */
191	uint16		atim_window;		/* units are Kusec */
192	uint8		dtim_period;		/* DTIM period */
193	int16		RSSI;			/* receive signal strength (in dBm) */
194	int8		phy_noise;		/* noise (in dBm) */
195
196	uint8		n_cap;			/* BSS is 802.11N Capable */
197	uint32		nbss_cap;		/* 802.11N BSS Capabilities (based on HT_CAP_*) */
198	uint32		vbss_cap;		/* 802.11AC BSS Capabilities (based on VHT_CAP) */
199	uint8		ctl_ch;			/* 802.11N BSS control channel number */
200	uint8		padding1[3];		/* explicit struct alignment padding */
201	uint16		vht_rxmcsmap;		/* VHT rx mcs map */
202	uint16		vht_txmcsmap;		/* VHT tx mcs map */
203	uint8		flags;			/* flags */
204	uint8		vht_cap;		/* BSS is vht capable */
205	uint8		reserved[2];		/* Reserved for expansion of BSS properties */
206	uint8		basic_mcs[MCSSET_LEN];	/* 802.11N BSS required MCS set */
207
208	uint16		ie_offset;		/* offset at which IEs start, from beginning */
209	uint32		ie_length;		/* byte length of Information Elements */
210	int16		SNR;			/* average SNR of during frame reception */
211	/* Add new fields here */
212	/* variable length Information Elements */
213} wl_bss_info_t;
214
215typedef struct wl_bsscfg {
216	uint32	wsec;
217	uint32	WPA_auth;
218	uint32	wsec_index;
219	uint32	associated;
220	uint32	BSS;
221	uint32	phytest_on;
222	struct ether_addr	prev_BSSID;
223	struct ether_addr	BSSID;
224	uint32  targetbss_wpa2_flags;
225	uint32 assoc_type;
226	uint32 assoc_state;
227} wl_bsscfg_t;
228
229typedef struct wl_bss_config {
230	uint32	atim_window;
231	uint32	beacon_period;
232	uint32	chanspec;
233} wl_bss_config_t;
234
235#define DLOAD_HANDLER_VER			1	/* Downloader version */
236#define DLOAD_FLAG_VER_MASK		0xf000	/* Downloader version mask */
237#define DLOAD_FLAG_VER_SHIFT	12	/* Downloader version shift */
238
239#define DL_CRC_NOT_INUSE 			0x0001
240
241/* generic download types & flags */
242enum {
243	DL_TYPE_UCODE = 1,
244	DL_TYPE_CLM = 2
245};
246
247/* ucode type values */
248enum {
249	UCODE_FW,
250	INIT_VALS,
251	BS_INIT_VALS
252};
253
254struct wl_dload_data {
255	uint16 flag;
256	uint16 dload_type;
257	uint32 len;
258	uint32 crc;
259	uint8  data[1];
260};
261typedef struct wl_dload_data wl_dload_data_t;
262
263struct wl_ucode_info {
264	uint32 ucode_type;
265	uint32 num_chunks;
266	uint32 chunk_len;
267	uint32 chunk_num;
268	uint8  data_chunk[1];
269};
270typedef struct wl_ucode_info wl_ucode_info_t;
271
272struct wl_clm_dload_info {
273	uint32 ds_id;
274	uint32 clm_total_len;
275	uint32 num_chunks;
276	uint32 chunk_len;
277	uint32 chunk_offset;
278	uint8  data_chunk[1];
279};
280typedef struct wl_clm_dload_info wl_clm_dload_info_t;
281
282typedef struct wlc_ssid {
283	uint32		SSID_len;
284	uchar		SSID[32];
285} wlc_ssid_t;
286
287#define MAX_PREFERRED_AP_NUM     5
288typedef struct wlc_fastssidinfo {
289	uint32				SSID_channel[MAX_PREFERRED_AP_NUM];
290	wlc_ssid_t		SSID_info[MAX_PREFERRED_AP_NUM];
291} wlc_fastssidinfo_t;
292
293typedef BWL_PRE_PACKED_STRUCT struct wnm_url {
294	uint8   len;
295	uint8   data[1];
296} BWL_POST_PACKED_STRUCT wnm_url_t;
297
298#ifndef LINUX_POSTMOGRIFY_REMOVAL
299typedef struct chan_scandata {
300	uint8		txpower;
301	uint8		pad;
302	chanspec_t	channel;	/* Channel num, bw, ctrl_sb and band */
303	uint32		channel_mintime;
304	uint32		channel_maxtime;
305} chan_scandata_t;
306
307typedef enum wl_scan_type {
308	EXTDSCAN_FOREGROUND_SCAN,
309	EXTDSCAN_BACKGROUND_SCAN,
310	EXTDSCAN_FORCEDBACKGROUND_SCAN
311} wl_scan_type_t;
312
313#define WLC_EXTDSCAN_MAX_SSID		5
314
315#define WL_BSS_FLAGS_FROM_BEACON	0x01	/* bss_info derived from beacon */
316#define WL_BSS_FLAGS_FROM_CACHE		0x02	/* bss_info collected from cache */
317#define WL_BSS_FLAGS_RSSI_ONCHANNEL     0x04 /* rssi info was received on channel (vs offchannel) */
318
319typedef struct wl_extdscan_params {
320	int8 		nprobes;		/* 0, passive, otherwise active */
321	int8    	split_scan;		/* split scan */
322	int8		band;			/* band */
323	int8		pad;
324	wlc_ssid_t 	ssid[WLC_EXTDSCAN_MAX_SSID]; /* ssid list */
325	uint32		tx_rate;		/* in 500ksec units */
326	wl_scan_type_t	scan_type;		/* enum */
327	int32 		channel_num;
328	chan_scandata_t channel_list[1];	/* list of chandata structs */
329} wl_extdscan_params_t;
330
331#define WL_EXTDSCAN_PARAMS_FIXED_SIZE 	(sizeof(wl_extdscan_params_t) - sizeof(chan_scandata_t))
332#endif /* LINUX_POSTMOGRIFY_REMOVAL */
333
334#define WL_BSSTYPE_INFRA 1
335#define WL_BSSTYPE_INDEP 0
336#define WL_BSSTYPE_ANY   2
337
338/* Bitmask for scan_type */
339#define WL_SCANFLAGS_PASSIVE	0x01	/* force passive scan */
340#define WL_SCANFLAGS_RESERVED	0x02	/* Reserved */
341#define WL_SCANFLAGS_PROHIBITED	0x04	/* allow scanning prohibited channels */
342
343#define WL_SCAN_PARAMS_SSID_MAX 	10
344
345typedef struct wl_scan_params {
346	wlc_ssid_t ssid;		/* default: {0, ""} */
347	struct ether_addr bssid;	/* default: bcast */
348	int8 bss_type;			/* default: any,
349					 * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
350					 */
351	uint8 scan_type;		/* flags, 0 use default */
352	int32 nprobes;			/* -1 use default, number of probes per channel */
353	int32 active_time;		/* -1 use default, dwell time per channel for
354					 * active scanning
355					 */
356	int32 passive_time;		/* -1 use default, dwell time per channel
357					 * for passive scanning
358					 */
359	int32 home_time;		/* -1 use default, dwell time for the home channel
360					 * between channel scans
361					 */
362	int32 channel_num;		/* count of channels and ssids that follow
363					 *
364					 * low half is count of channels in channel_list, 0
365					 * means default (use all available channels)
366					 *
367					 * high half is entries in wlc_ssid_t array that
368					 * follows channel_list, aligned for int32 (4 bytes)
369					 * meaning an odd channel count implies a 2-byte pad
370					 * between end of channel_list and first ssid
371					 *
372					 * if ssid count is zero, single ssid in the fixed
373					 * parameter portion is assumed, otherwise ssid in
374					 * the fixed portion is ignored
375					 */
376	uint16 channel_list[1];		/* list of chanspecs */
377} wl_scan_params_t;
378
379/* size of wl_scan_params not including variable length array */
380#define WL_SCAN_PARAMS_FIXED_SIZE 64
381
382/* masks for channel and ssid count */
383#define WL_SCAN_PARAMS_COUNT_MASK 0x0000ffff
384#define WL_SCAN_PARAMS_NSSID_SHIFT 16
385
386#define WL_SCAN_ACTION_START      1
387#define WL_SCAN_ACTION_CONTINUE   2
388#define WL_SCAN_ACTION_ABORT      3
389
390#define ISCAN_REQ_VERSION 1
391
392/* incremental scan struct */
393typedef struct wl_iscan_params {
394	uint32 version;
395	uint16 action;
396	uint16 scan_duration;
397	wl_scan_params_t params;
398} wl_iscan_params_t;
399
400/* 3 fields + size of wl_scan_params, not including variable length array */
401#define WL_ISCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_iscan_params_t, params) + sizeof(wlc_ssid_t))
402
403typedef struct wl_scan_results {
404	uint32 buflen;
405	uint32 version;
406	uint32 count;
407	wl_bss_info_t bss_info[1];
408} wl_scan_results_t;
409
410/* size of wl_scan_results not including variable length array */
411#define WL_SCAN_RESULTS_FIXED_SIZE (sizeof(wl_scan_results_t) - sizeof(wl_bss_info_t))
412
413/* wl_iscan_results status values */
414#define WL_SCAN_RESULTS_SUCCESS	0
415#define WL_SCAN_RESULTS_PARTIAL	1
416#define WL_SCAN_RESULTS_PENDING	2
417#define WL_SCAN_RESULTS_ABORTED	3
418#define WL_SCAN_RESULTS_NO_MEM  4
419
420/* Used in EXT_STA */
421#define DNGL_RXCTXT_SIZE	45
422
423#if defined(SIMPLE_ISCAN)
424#define ISCAN_RETRY_CNT   5
425#define ISCAN_STATE_IDLE   0
426#define ISCAN_STATE_SCANING 1
427#define ISCAN_STATE_PENDING 2
428
429/* the buf lengh can be WLC_IOCTL_MAXLEN (8K) to reduce iteration */
430#define WLC_IW_ISCAN_MAXLEN   2048
431typedef struct iscan_buf {
432	struct iscan_buf * next;
433	char   iscan_buf[WLC_IW_ISCAN_MAXLEN];
434} iscan_buf_t;
435#endif /* SIMPLE_ISCAN */
436
437#define ESCAN_REQ_VERSION 1
438
439typedef struct wl_escan_params {
440	uint32 version;
441	uint16 action;
442	uint16 sync_id;
443	wl_scan_params_t params;
444} wl_escan_params_t;
445
446#define WL_ESCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_escan_params_t, params) + sizeof(wlc_ssid_t))
447
448typedef struct wl_escan_result {
449	uint32 buflen;
450	uint32 version;
451	uint16 sync_id;
452	uint16 bss_count;
453	wl_bss_info_t bss_info[1];
454} wl_escan_result_t;
455
456#define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(wl_escan_result_t) - sizeof(wl_bss_info_t))
457
458/* incremental scan results struct */
459typedef struct wl_iscan_results {
460	uint32 status;
461	wl_scan_results_t results;
462} wl_iscan_results_t;
463
464/* size of wl_iscan_results not including variable length array */
465#define WL_ISCAN_RESULTS_FIXED_SIZE \
466	(WL_SCAN_RESULTS_FIXED_SIZE + OFFSETOF(wl_iscan_results_t, results))
467
468typedef struct wl_probe_params {
469	wlc_ssid_t ssid;
470	struct ether_addr bssid;
471	struct ether_addr mac;
472} wl_probe_params_t;
473
474#define WL_MAXRATES_IN_SET		16	/* max # of rates in a rateset */
475typedef struct wl_rateset {
476	uint32	count;			/* # rates in this set */
477	uint8	rates[WL_MAXRATES_IN_SET];	/* rates in 500kbps units w/hi bit set if basic */
478} wl_rateset_t;
479
480typedef struct wl_rateset_args {
481	uint32	count;			/* # rates in this set */
482	uint8	rates[WL_MAXRATES_IN_SET];	/* rates in 500kbps units w/hi bit set if basic */
483	uint8   mcs[MCSSET_LEN];        /* supported mcs index bit map */
484} wl_rateset_args_t;
485
486/* uint32 list */
487typedef struct wl_uint32_list {
488	/* in - # of elements, out - # of entries */
489	uint32 count;
490	/* variable length uint32 list */
491	uint32 element[1];
492} wl_uint32_list_t;
493
494/* used for association with a specific BSSID and chanspec list */
495typedef struct wl_assoc_params {
496	struct ether_addr bssid;	/* 00:00:00:00:00:00: broadcast scan */
497	int32 chanspec_num;		/* 0: all available channels,
498					 * otherwise count of chanspecs in chanspec_list
499					 */
500	chanspec_t chanspec_list[1];	/* list of chanspecs */
501} wl_assoc_params_t;
502#define WL_ASSOC_PARAMS_FIXED_SIZE 	OFFSETOF(wl_assoc_params_t, chanspec_list)
503
504/* used for reassociation/roam to a specific BSSID and channel */
505typedef wl_assoc_params_t wl_reassoc_params_t;
506#define WL_REASSOC_PARAMS_FIXED_SIZE	WL_ASSOC_PARAMS_FIXED_SIZE
507
508/* used for association to a specific BSSID and channel */
509typedef wl_assoc_params_t wl_join_assoc_params_t;
510#define WL_JOIN_ASSOC_PARAMS_FIXED_SIZE	WL_ASSOC_PARAMS_FIXED_SIZE
511
512/* used for join with or without a specific bssid and channel list */
513typedef struct wl_join_params {
514	wlc_ssid_t ssid;
515	wl_assoc_params_t params;	/* optional field, but it must include the fixed portion
516					 * of the wl_assoc_params_t struct when it does present.
517					 */
518} wl_join_params_t;
519#define WL_JOIN_PARAMS_FIXED_SIZE 	(OFFSETOF(wl_join_params_t, params) + \
520					 WL_ASSOC_PARAMS_FIXED_SIZE)
521/* scan params for extended join */
522typedef struct wl_join_scan_params {
523	uint8 scan_type;		/* 0 use default, active or passive scan */
524	int32 nprobes;			/* -1 use default, number of probes per channel */
525	int32 active_time;		/* -1 use default, dwell time per channel for
526					 * active scanning
527					 */
528	int32 passive_time;		/* -1 use default, dwell time per channel
529					 * for passive scanning
530					 */
531	int32 home_time;		/* -1 use default, dwell time for the home channel
532					 * between channel scans
533					 */
534} wl_join_scan_params_t;
535
536/* extended join params */
537typedef struct wl_extjoin_params {
538	wlc_ssid_t ssid;		/* {0, ""}: wildcard scan */
539	wl_join_scan_params_t scan;
540	wl_join_assoc_params_t assoc;	/* optional field, but it must include the fixed portion
541					 * of the wl_join_assoc_params_t struct when it does
542					 * present.
543					 */
544} wl_extjoin_params_t;
545#define WL_EXTJOIN_PARAMS_FIXED_SIZE 	(OFFSETOF(wl_extjoin_params_t, assoc) + \
546					 WL_JOIN_ASSOC_PARAMS_FIXED_SIZE)
547
548/* All builds use the new 11ac ratespec/chanspec */
549#undef  D11AC_IOTYPES
550#define D11AC_IOTYPES
551
552#ifndef D11AC_IOTYPES
553
554/* defines used by the nrate iovar */
555#define NRATE_MCS_INUSE	0x00000080	/* MSC in use,indicates b0-6 holds an mcs */
556#define NRATE_RATE_MASK 0x0000007f	/* rate/mcs value */
557#define NRATE_STF_MASK	0x0000ff00	/* stf mode mask: siso, cdd, stbc, sdm */
558#define NRATE_STF_SHIFT	8			/* stf mode shift */
559#define NRATE_OVERRIDE	0x80000000	/* bit indicates override both rate & mode */
560#define NRATE_OVERRIDE_MCS_ONLY 0x40000000 /* bit indicate to override mcs only */
561#define NRATE_SGI_MASK  0x00800000      /* sgi mode */
562#define NRATE_SGI_SHIFT 23              /* sgi mode */
563#define NRATE_LDPC_CODING 0x00400000    /* bit indicates adv coding in use */
564#define NRATE_LDPC_SHIFT 22             /* ldpc shift */
565
566#define NRATE_STF_SISO	0		/* stf mode SISO */
567#define NRATE_STF_CDD	1		/* stf mode CDD */
568#define NRATE_STF_STBC	2		/* stf mode STBC */
569#define NRATE_STF_SDM	3		/* stf mode SDM */
570
571#else /* D11AC_IOTYPES */
572
573/* WL_RSPEC defines for rate information */
574#define WL_RSPEC_RATE_MASK      0x000000FF      /* rate or HT MCS value */
575#define WL_RSPEC_VHT_MCS_MASK   0x0000000F      /* VHT MCS value */
576#define WL_RSPEC_VHT_NSS_MASK   0x000000F0      /* VHT Nss value */
577#define WL_RSPEC_VHT_NSS_SHIFT  4               /* VHT Nss value shift */
578#define WL_RSPEC_TXEXP_MASK     0x00000300
579#define WL_RSPEC_TXEXP_SHIFT    8
580#define WL_RSPEC_BW_MASK        0x00070000      /* bandwidth mask */
581#define WL_RSPEC_BW_SHIFT       16              /* bandwidth shift */
582#define WL_RSPEC_STBC           0x00100000      /* STBC encoding, Nsts = 2 x Nss */
583#define WL_RSPEC_LDPC           0x00400000      /* bit indicates adv coding in use */
584#define WL_RSPEC_SGI            0x00800000      /* Short GI mode */
585#define WL_RSPEC_ENCODING_MASK  0x03000000      /* Encoding of Rate/MCS field */
586#define WL_RSPEC_OVERRIDE_RATE  0x40000000      /* bit indicate to override mcs only */
587#define WL_RSPEC_OVERRIDE_MODE  0x80000000      /* bit indicates override both rate & mode */
588
589/* WL_RSPEC_ENCODING field defs */
590#define WL_RSPEC_ENCODE_RATE    0x00000000      /* Legacy rate is stored in RSPEC_RATE_MASK */
591#define WL_RSPEC_ENCODE_HT      0x01000000      /* HT MCS is stored in RSPEC_RATE_MASK */
592#define WL_RSPEC_ENCODE_VHT     0x02000000      /* VHT MCS and Nss is stored in RSPEC_RATE_MASK */
593
594/* WL_RSPEC_BW field defs */
595#define WL_RSPEC_BW_UNSPECIFIED 0
596#define WL_RSPEC_BW_20MHZ       0x00010000
597#define WL_RSPEC_BW_40MHZ       0x00020000
598#define WL_RSPEC_BW_80MHZ       0x00030000
599#define WL_RSPEC_BW_160MHZ      0x00040000
600
601/* Legacy defines for the nrate iovar */
602#define OLD_NRATE_MCS_INUSE         0x00000080 /* MSC in use,indicates b0-6 holds an mcs */
603#define OLD_NRATE_RATE_MASK         0x0000007f /* rate/mcs value */
604#define OLD_NRATE_STF_MASK          0x0000ff00 /* stf mode mask: siso, cdd, stbc, sdm */
605#define OLD_NRATE_STF_SHIFT         8          /* stf mode shift */
606#define OLD_NRATE_OVERRIDE          0x80000000 /* bit indicates override both rate & mode */
607#define OLD_NRATE_OVERRIDE_MCS_ONLY 0x40000000 /* bit indicate to override mcs only */
608#define OLD_NRATE_SGI               0x00800000 /* sgi mode */
609#define OLD_NRATE_LDPC_CODING       0x00400000 /* bit indicates adv coding in use */
610
611#define OLD_NRATE_STF_SISO	0		/* stf mode SISO */
612#define OLD_NRATE_STF_CDD	1		/* stf mode CDD */
613#define OLD_NRATE_STF_STBC	2		/* stf mode STBC */
614#define OLD_NRATE_STF_SDM	3		/* stf mode SDM */
615
616#endif /* D11AC_IOTYPES */
617
618#define ANTENNA_NUM_1	1		/* total number of antennas to be used */
619#define ANTENNA_NUM_2	2
620#define ANTENNA_NUM_3	3
621#define ANTENNA_NUM_4	4
622
623#define ANT_SELCFG_AUTO		0x80	/* bit indicates antenna sel AUTO */
624#define ANT_SELCFG_MASK		0x33	/* antenna configuration mask */
625#define ANT_SELCFG_MAX		4	/* max number of antenna configurations */
626#define ANT_SELCFG_TX_UNICAST	0	/* unicast tx antenna configuration */
627#define ANT_SELCFG_RX_UNICAST	1	/* unicast rx antenna configuration */
628#define ANT_SELCFG_TX_DEF	2	/* default tx antenna configuration */
629#define ANT_SELCFG_RX_DEF	3	/* default rx antenna configuration */
630
631#define MAX_STREAMS_SUPPORTED	4	/* max number of streams supported */
632
633typedef struct {
634	uint8 ant_config[ANT_SELCFG_MAX];	/* antenna configuration */
635	uint8 num_antcfg;	/* number of available antenna configurations */
636} wlc_antselcfg_t;
637
638#define HIGHEST_SINGLE_STREAM_MCS	7 /* MCS values greater than this enable multiple streams */
639
640#define MAX_CCA_CHANNELS 38	/* Max number of 20 Mhz wide channels */
641#define MAX_CCA_SECS     60	/* CCA keeps this many seconds history */
642
643#define IBSS_MED        15	/* Mediom in-bss congestion percentage */
644#define IBSS_HI         25	/* Hi in-bss congestion percentage */
645#define OBSS_MED        12
646#define OBSS_HI         25
647#define INTERFER_MED    5
648#define INTERFER_HI     10
649
650#define  CCA_FLAG_2G_ONLY		0x01	/* Return a channel from 2.4 Ghz band */
651#define  CCA_FLAG_5G_ONLY		0x02	/* Return a channel from 2.4 Ghz band */
652#define  CCA_FLAG_IGNORE_DURATION	0x04	/* Ignore dwell time for each channel */
653#define  CCA_FLAGS_PREFER_1_6_11	0x10
654#define  CCA_FLAG_IGNORE_INTERFER 	0x20 /* do not exlude channel based on interfer level */
655
656#define CCA_ERRNO_BAND 		1	/* After filtering for band pref, no choices left */
657#define CCA_ERRNO_DURATION	2	/* After filtering for duration, no choices left */
658#define CCA_ERRNO_PREF_CHAN	3	/* After filtering for chan pref, no choices left */
659#define CCA_ERRNO_INTERFER	4	/* After filtering for interference, no choices left */
660#define CCA_ERRNO_TOO_FEW	5	/* Only 1 channel was input */
661
662typedef struct {
663	uint32 duration;	/* millisecs spent sampling this channel */
664	uint32 congest_ibss;	/* millisecs in our bss (presumably this traffic will */
665				/*  move if cur bss moves channels) */
666	uint32 congest_obss;	/* traffic not in our bss */
667	uint32 interference;	/* millisecs detecting a non 802.11 interferer. */
668	uint32 timestamp;	/* second timestamp */
669} cca_congest_t;
670
671typedef struct {
672	chanspec_t chanspec;	/* Which channel? */
673	uint8 num_secs;		/* How many secs worth of data */
674	cca_congest_t  secs[1];	/* Data */
675} cca_congest_channel_req_t;
676
677/* interference source detection and identification mode */
678#define ITFR_MODE_DISABLE	0	/* disable feature */
679#define ITFR_MODE_MANUAL_ENABLE	1	/* enable manual detection */
680#define ITFR_MODE_AUTO_ENABLE	2	/* enable auto detection */
681
682/* interference sources */
683enum interference_source {
684	ITFR_NONE = 0,		/* interference */
685	ITFR_PHONE,		/* wireless phone */
686	ITFR_VIDEO_CAMERA,	/* wireless video camera */
687	ITFR_MICROWAVE_OVEN,	/* microwave oven */
688	ITFR_BABY_MONITOR,	/* wireless baby monitor */
689	ITFR_BLUETOOTH,		/* bluetooth */
690	ITFR_VIDEO_CAMERA_OR_BABY_MONITOR,	/* wireless camera or baby monitor */
691	ITFR_BLUETOOTH_OR_BABY_MONITOR,	/* bluetooth or baby monitor */
692	ITFR_VIDEO_CAMERA_OR_PHONE,	/* video camera or phone */
693	ITFR_UNIDENTIFIED	/* interference from unidentified source */
694};
695
696/* structure for interference source report */
697typedef struct {
698	uint32 flags;	/* flags.  bit definitions below */
699	uint32 source;	/* last detected interference source */
700	uint32 timestamp;	/* second timestamp on interferenced flag change */
701} interference_source_rep_t;
702
703/* bit definitions for flags in interference source report */
704#define ITFR_INTERFERENCED	1	/* interference detected */
705#define ITFR_HOME_CHANNEL	2	/* home channel has interference */
706#define ITFR_NOISY_ENVIRONMENT	4	/* noisy environemnt so feature stopped */
707
708#define WLC_CNTRY_BUF_SZ	4		/* Country string is 3 bytes + NUL */
709
710typedef struct wl_country {
711	char country_abbrev[WLC_CNTRY_BUF_SZ];	/* nul-terminated country code used in
712						 * the Country IE
713						 */
714	int32 rev;				/* revision specifier for ccode
715						 * on set, -1 indicates unspecified.
716						 * on get, rev >= 0
717						 */
718	char ccode[WLC_CNTRY_BUF_SZ];		/* nul-terminated built-in country code.
719						 * variable length, but fixed size in
720						 * struct allows simple allocation for
721						 * expected country strings <= 3 chars.
722						 */
723} wl_country_t;
724
725typedef struct wl_channels_in_country {
726	uint32 buflen;
727	uint32 band;
728	char country_abbrev[WLC_CNTRY_BUF_SZ];
729	uint32 count;
730	uint32 channel[1];
731} wl_channels_in_country_t;
732
733typedef struct wl_country_list {
734	uint32 buflen;
735	uint32 band_set;
736	uint32 band;
737	uint32 count;
738	char country_abbrev[1];
739} wl_country_list_t;
740
741#define WL_NUM_RPI_BINS		8
742#define WL_RM_TYPE_BASIC	1
743#define WL_RM_TYPE_CCA		2
744#define WL_RM_TYPE_RPI		3
745
746#define WL_RM_FLAG_PARALLEL	(1<<0)
747
748#define WL_RM_FLAG_LATE		(1<<1)
749#define WL_RM_FLAG_INCAPABLE	(1<<2)
750#define WL_RM_FLAG_REFUSED	(1<<3)
751
752typedef struct wl_rm_req_elt {
753	int8	type;
754	int8	flags;
755	chanspec_t	chanspec;
756	uint32	token;		/* token for this measurement */
757	uint32	tsf_h;		/* TSF high 32-bits of Measurement start time */
758	uint32	tsf_l;		/* TSF low 32-bits */
759	uint32	dur;		/* TUs */
760} wl_rm_req_elt_t;
761
762typedef struct wl_rm_req {
763	uint32	token;		/* overall measurement set token */
764	uint32	count;		/* number of measurement requests */
765	void	*cb;		/* completion callback function: may be NULL */
766	void	*cb_arg;	/* arg to completion callback function */
767	wl_rm_req_elt_t	req[1];	/* variable length block of requests */
768} wl_rm_req_t;
769#define WL_RM_REQ_FIXED_LEN	OFFSETOF(wl_rm_req_t, req)
770
771typedef struct wl_rm_rep_elt {
772	int8	type;
773	int8	flags;
774	chanspec_t	chanspec;
775	uint32	token;		/* token for this measurement */
776	uint32	tsf_h;		/* TSF high 32-bits of Measurement start time */
777	uint32	tsf_l;		/* TSF low 32-bits */
778	uint32	dur;		/* TUs */
779	uint32	len;		/* byte length of data block */
780	uint8	data[1];	/* variable length data block */
781} wl_rm_rep_elt_t;
782#define WL_RM_REP_ELT_FIXED_LEN	24	/* length excluding data block */
783
784#define WL_RPI_REP_BIN_NUM 8
785typedef struct wl_rm_rpi_rep {
786	uint8	rpi[WL_RPI_REP_BIN_NUM];
787	int8	rpi_max[WL_RPI_REP_BIN_NUM];
788} wl_rm_rpi_rep_t;
789
790typedef struct wl_rm_rep {
791	uint32	token;		/* overall measurement set token */
792	uint32	len;		/* length of measurement report block */
793	wl_rm_rep_elt_t	rep[1];	/* variable length block of reports */
794} wl_rm_rep_t;
795#define WL_RM_REP_FIXED_LEN	8
796
797
798typedef enum sup_auth_status {
799	/* Basic supplicant authentication states */
800	WLC_SUP_DISCONNECTED = 0,
801	WLC_SUP_CONNECTING,
802	WLC_SUP_IDREQUIRED,
803	WLC_SUP_AUTHENTICATING,
804	WLC_SUP_AUTHENTICATED,
805	WLC_SUP_KEYXCHANGE,
806	WLC_SUP_KEYED,
807	WLC_SUP_TIMEOUT,
808	WLC_SUP_LAST_BASIC_STATE,
809
810	/* Extended supplicant authentication states */
811	/* Waiting to receive handshake msg M1 */
812	WLC_SUP_KEYXCHANGE_WAIT_M1 = WLC_SUP_AUTHENTICATED,
813	/* Preparing to send handshake msg M2 */
814	WLC_SUP_KEYXCHANGE_PREP_M2 = WLC_SUP_KEYXCHANGE,
815	/* Waiting to receive handshake msg M3 */
816	WLC_SUP_KEYXCHANGE_WAIT_M3 = WLC_SUP_LAST_BASIC_STATE,
817	WLC_SUP_KEYXCHANGE_PREP_M4,	/* Preparing to send handshake msg M4 */
818	WLC_SUP_KEYXCHANGE_WAIT_G1,	/* Waiting to receive handshake msg G1 */
819	WLC_SUP_KEYXCHANGE_PREP_G2	/* Preparing to send handshake msg G2 */
820} sup_auth_status_t;
821
822/* Enumerate crypto algorithms */
823#define	CRYPTO_ALGO_OFF			0
824#define	CRYPTO_ALGO_WEP1		1
825#define	CRYPTO_ALGO_TKIP		2
826#define	CRYPTO_ALGO_WEP128		3
827#define CRYPTO_ALGO_AES_CCM		4
828#define CRYPTO_ALGO_AES_OCB_MSDU	5
829#define CRYPTO_ALGO_AES_OCB_MPDU	6
830#define CRYPTO_ALGO_NALG		7
831#ifdef BCMWAPI_WPI
832#define CRYPTO_ALGO_SMS4		11
833#endif /* BCMWAPI_WPI */
834#define CRYPTO_ALGO_PMK			12	/* for 802.1x supp to set PMK before 4-way */
835
836#define WSEC_GEN_MIC_ERROR	0x0001
837#define WSEC_GEN_REPLAY		0x0002
838#define WSEC_GEN_ICV_ERROR	0x0004
839#define WSEC_GEN_MFP_ACT_ERROR	0x0008
840#define WSEC_GEN_MFP_DISASSOC_ERROR	0x0010
841#define WSEC_GEN_MFP_DEAUTH_ERROR	0x0020
842
843#define WL_SOFT_KEY	(1 << 0)	/* Indicates this key is using soft encrypt */
844#define WL_PRIMARY_KEY	(1 << 1)	/* Indicates this key is the primary (ie tx) key */
845#define WL_KF_RES_4	(1 << 4)	/* Reserved for backward compat */
846#define WL_KF_RES_5	(1 << 5)	/* Reserved for backward compat */
847#define WL_IBSS_PEER_GROUP_KEY	(1 << 6)	/* Indicates a group key for a IBSS PEER */
848
849typedef struct wl_wsec_key {
850	uint32		index;		/* key index */
851	uint32		len;		/* key length */
852	uint8		data[DOT11_MAX_KEY_SIZE];	/* key data */
853	uint32		pad_1[18];
854	uint32		algo;		/* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
855	uint32		flags;		/* misc flags */
856	uint32		pad_2[2];
857	int		pad_3;
858	int		iv_initialized;	/* has IV been initialized already? */
859	int		pad_4;
860	/* Rx IV */
861	struct {
862		uint32	hi;		/* upper 32 bits of IV */
863		uint16	lo;		/* lower 16 bits of IV */
864	} rxiv;
865	uint32		pad_5[2];
866	struct ether_addr ea;		/* per station */
867} wl_wsec_key_t;
868
869#define WSEC_MIN_PSK_LEN	8
870#define WSEC_MAX_PSK_LEN	64
871
872/* Flag for key material needing passhash'ing */
873#define WSEC_PASSPHRASE		(1<<0)
874
875/* receptacle for WLC_SET_WSEC_PMK parameter */
876typedef struct {
877	ushort	key_len;		/* octets in key material */
878	ushort	flags;			/* key handling qualification */
879	uint8	key[WSEC_MAX_PSK_LEN];	/* PMK material */
880} wsec_pmk_t;
881
882/* wireless security bitvec */
883#define WEP_ENABLED		0x0001
884#define TKIP_ENABLED		0x0002
885#define AES_ENABLED		0x0004
886#define WSEC_SWFLAG		0x0008
887#define SES_OW_ENABLED		0x0040	/* to go into transition mode without setting wep */
888#ifdef BCMWAPI_WPI
889#define SMS4_ENABLED		0x0100
890#endif /* BCMWAPI_WPI */
891
892/* wsec macros for operating on the above definitions */
893#define WSEC_WEP_ENABLED(wsec)	((wsec) & WEP_ENABLED)
894#define WSEC_TKIP_ENABLED(wsec)	((wsec) & TKIP_ENABLED)
895#define WSEC_AES_ENABLED(wsec)	((wsec) & AES_ENABLED)
896
897#ifdef BCMWAPI_WPI
898#define WSEC_ENABLED(wsec)	((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED | SMS4_ENABLED))
899#else /* BCMWAPI_WPI */
900#define WSEC_ENABLED(wsec)	((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED))
901#endif /* BCMWAPI_WPI */
902#define WSEC_SES_OW_ENABLED(wsec)	((wsec) & SES_OW_ENABLED)
903#ifdef BCMWAPI_WAI
904#define WSEC_SMS4_ENABLED(wsec)	((wsec) & SMS4_ENABLED)
905#endif /* BCMWAPI_WAI */
906
907#ifdef MFP
908#define MFP_CAPABLE		0x0200
909#define MFP_REQUIRED	0x0400
910#define MFP_SHA256		0x0800 /* a special configuration for STA for WIFI test tool */
911#endif /* MFP */
912
913#ifdef MFP
914#define MFP_CAPABLE		0x0200
915#define MFP_REQUIRED	0x0400
916#define MFP_SHA256		0x0800 /* a special configuration for STA for WIFI test tool */
917#endif /* MFP */
918
919/* WPA authentication mode bitvec */
920#define WPA_AUTH_DISABLED	0x0000	/* Legacy (i.e., non-WPA) */
921#define WPA_AUTH_NONE		0x0001	/* none (IBSS) */
922#define WPA_AUTH_UNSPECIFIED	0x0002	/* over 802.1x */
923#define WPA_AUTH_PSK		0x0004	/* Pre-shared key */
924/* #define WPA_AUTH_8021X 0x0020 */	/* 802.1x, reserved */
925#define WPA2_AUTH_UNSPECIFIED	0x0040	/* over 802.1x */
926#define WPA2_AUTH_PSK		0x0080	/* Pre-shared key */
927#define BRCM_AUTH_PSK           0x0100  /* BRCM specific PSK */
928#define BRCM_AUTH_DPT		0x0200	/* DPT PSK without group keys */
929#if defined(BCMWAPI_WAI) || defined(BCMWAPI_WPI)
930#define WPA_AUTH_WAPI           0x0400
931#define WAPI_AUTH_NONE		WPA_AUTH_NONE	/* none (IBSS) */
932#define WAPI_AUTH_UNSPECIFIED	0x0400	/* over AS */
933#define WAPI_AUTH_PSK		0x0800	/* Pre-shared key */
934#endif /* BCMWAPI_WAI || BCMWAPI_WPI */
935#define WPA2_AUTH_MFP           0x1000  /* MFP (11w) in contrast to CCX */
936#define WPA2_AUTH_TPK		0x2000 	/* TDLS Peer Key */
937#define WPA2_AUTH_FT		0x4000 	/* Fast Transition. */
938#define WPA_AUTH_PFN_ANY	0xffffffff	/* for PFN, match only ssid */
939
940/* pmkid */
941#define	MAXPMKID		16
942
943typedef struct _pmkid {
944	struct ether_addr	BSSID;
945	uint8			PMKID[WPA2_PMKID_LEN];
946} pmkid_t;
947
948typedef struct _pmkid_list {
949	uint32	npmkid;
950	pmkid_t	pmkid[1];
951} pmkid_list_t;
952
953typedef struct _pmkid_cand {
954	struct ether_addr	BSSID;
955	uint8			preauth;
956} pmkid_cand_t;
957
958typedef struct _pmkid_cand_list {
959	uint32	npmkid_cand;
960	pmkid_cand_t	pmkid_cand[1];
961} pmkid_cand_list_t;
962
963typedef struct wl_assoc_info {
964	uint32		req_len;
965	uint32		resp_len;
966	uint32		flags;
967	struct dot11_assoc_req req;
968	struct ether_addr reassoc_bssid; /* used in reassoc's */
969	struct dot11_assoc_resp resp;
970} wl_assoc_info_t;
971
972/* flags */
973#define WLC_ASSOC_REQ_IS_REASSOC 0x01 /* assoc req was actually a reassoc */
974
975#ifndef LINUX_POSTMOGRIFY_REMOVAL
976typedef struct wl_led_info {
977	uint32      index;      /* led index */
978	uint32      behavior;
979	uint8       activehi;
980} wl_led_info_t;
981
982
983/* srom read/write struct passed through ioctl */
984typedef struct {
985	uint	byteoff;	/* byte offset */
986	uint	nbytes;		/* number of bytes */
987	uint16	buf[1];
988} srom_rw_t;
989
990/* similar cis (srom or otp) struct [iovar: may not be aligned] */
991typedef struct {
992	uint32	source;		/* cis source */
993	uint32	byteoff;	/* byte offset */
994	uint32	nbytes;		/* number of bytes */
995	/* data follows here */
996} cis_rw_t;
997
998#define WLC_CIS_DEFAULT	0	/* built-in default */
999#define WLC_CIS_SROM	1	/* source is sprom */
1000#define WLC_CIS_OTP	2	/* source is otp */
1001
1002/* R_REG and W_REG struct passed through ioctl */
1003typedef struct {
1004	uint32	byteoff;	/* byte offset of the field in d11regs_t */
1005	uint32	val;		/* read/write value of the field */
1006	uint32	size;		/* sizeof the field */
1007	uint	band;		/* band (optional) */
1008} rw_reg_t;
1009
1010/* Structure used by GET/SET_ATTEN ioctls - it controls power in b/g-band */
1011/* PCL - Power Control Loop */
1012/* current gain setting is replaced by user input */
1013#define WL_ATTEN_APP_INPUT_PCL_OFF	0	/* turn off PCL, apply supplied input */
1014#define WL_ATTEN_PCL_ON			1	/* turn on PCL */
1015/* current gain setting is maintained */
1016#define WL_ATTEN_PCL_OFF		2	/* turn off PCL. */
1017
1018typedef struct {
1019	uint16	auto_ctrl;	/* WL_ATTEN_XX */
1020	uint16	bb;		/* Baseband attenuation */
1021	uint16	radio;		/* Radio attenuation */
1022	uint16	txctl1;		/* Radio TX_CTL1 value */
1023} atten_t;
1024
1025/* Per-AC retry parameters */
1026struct wme_tx_params_s {
1027	uint8  short_retry;
1028	uint8  short_fallback;
1029	uint8  long_retry;
1030	uint8  long_fallback;
1031	uint16 max_rate;  /* In units of 512 Kbps */
1032};
1033
1034typedef struct wme_tx_params_s wme_tx_params_t;
1035
1036#define WL_WME_TX_PARAMS_IO_BYTES (sizeof(wme_tx_params_t) * AC_COUNT)
1037
1038/* defines used by poweridx iovar - it controls power in a-band */
1039/* current gain setting is maintained */
1040#define WL_PWRIDX_PCL_OFF	-2	/* turn off PCL.  */
1041#define WL_PWRIDX_PCL_ON	-1	/* turn on PCL */
1042#define WL_PWRIDX_LOWER_LIMIT	-2	/* lower limit */
1043#define WL_PWRIDX_UPPER_LIMIT	63	/* upper limit */
1044/* value >= 0 causes
1045 *	- input to be set to that value
1046 *	- PCL to be off
1047 */
1048
1049/* Used to get specific link/ac parameters */
1050typedef struct {
1051	int ac;
1052	uint8 val;
1053	struct ether_addr ea;
1054} link_val_t;
1055
1056#define BCM_MAC_STATUS_INDICATION	(0x40010200L)
1057#endif /* LINUX_POSTMOGRIFY_REMOVAL */
1058
1059typedef struct {
1060	uint16			ver;		/* version of this struct */
1061	uint16			len;		/* length in bytes of this structure */
1062	uint16			cap;		/* sta's advertised capabilities */
1063	uint32			flags;		/* flags defined below */
1064	uint32			idle;		/* time since data pkt rx'd from sta */
1065	struct ether_addr	ea;		/* Station address */
1066	wl_rateset_t		rateset;	/* rateset in use */
1067	uint32			in;		/* seconds elapsed since associated */
1068	uint32			listen_interval_inms; /* Min Listen interval in ms for this STA */
1069	uint32			tx_pkts;	/* # of packets transmitted */
1070	uint32			tx_failures;	/* # of packets failed */
1071	uint32			rx_ucast_pkts;	/* # of unicast packets received */
1072	uint32			rx_mcast_pkts;	/* # of multicast packets received */
1073	uint32			tx_rate;	/* Rate of last successful tx frame */
1074	uint32			rx_rate;	/* Rate of last successful rx frame */
1075	uint32			rx_decrypt_succeeds;	/* # of packet decrypted successfully */
1076	uint32			rx_decrypt_failures;	/* # of packet decrypted unsuccessfully */
1077} sta_info_t;
1078
1079#define WL_OLD_STAINFO_SIZE	OFFSETOF(sta_info_t, tx_pkts)
1080
1081#define WL_STA_VER		3
1082
1083/* Flags for sta_info_t indicating properties of STA */
1084#define WL_STA_BRCM		0x1		/* Running a Broadcom driver */
1085#define WL_STA_WME		0x2		/* WMM association */
1086#define WL_STA_UNUSED		0x4
1087#define WL_STA_AUTHE		0x8		/* Authenticated */
1088#define WL_STA_ASSOC		0x10		/* Associated */
1089#define WL_STA_AUTHO		0x20		/* Authorized */
1090#define WL_STA_WDS		0x40		/* Wireless Distribution System */
1091#define WL_STA_WDS_LINKUP	0x80		/* WDS traffic/probes flowing properly */
1092#define WL_STA_PS		0x100		/* STA is in power save mode from AP's viewpoint */
1093#define WL_STA_APSD_BE		0x200		/* APSD delv/trigger for AC_BE is default enabled */
1094#define WL_STA_APSD_BK		0x400		/* APSD delv/trigger for AC_BK is default enabled */
1095#define WL_STA_APSD_VI		0x800		/* APSD delv/trigger for AC_VI is default enabled */
1096#define WL_STA_APSD_VO		0x1000		/* APSD delv/trigger for AC_VO is default enabled */
1097#define WL_STA_N_CAP		0x2000		/* STA 802.11n capable */
1098#define WL_STA_SCBSTATS		0x4000		/* Per STA debug stats */
1099
1100#define WL_WDS_LINKUP		WL_STA_WDS_LINKUP	/* deprecated */
1101
1102/* Values for TX Filter override mode */
1103#define WLC_TXFILTER_OVERRIDE_DISABLED  0
1104#define WLC_TXFILTER_OVERRIDE_ENABLED   1
1105
1106/* Used to get specific STA parameters */
1107typedef struct {
1108	uint32	val;
1109	struct ether_addr ea;
1110} scb_val_t;
1111
1112/* Used by iovar versions of some ioctls, i.e. WLC_SCB_AUTHORIZE et al */
1113typedef struct {
1114	uint32 code;
1115	scb_val_t ioctl_args;
1116} authops_t;
1117
1118/* channel encoding */
1119typedef struct channel_info {
1120	int hw_channel;
1121	int target_channel;
1122	int scan_channel;
1123} channel_info_t;
1124
1125/* For ioctls that take a list of MAC addresses */
1126struct maclist {
1127	uint count;			/* number of MAC addresses */
1128	struct ether_addr ea[1];	/* variable length array of MAC addresses */
1129};
1130
1131/* get pkt count struct passed through ioctl */
1132typedef struct get_pktcnt {
1133	uint rx_good_pkt;
1134	uint rx_bad_pkt;
1135	uint tx_good_pkt;
1136	uint tx_bad_pkt;
1137	uint rx_ocast_good_pkt; /* unicast packets destined for others */
1138} get_pktcnt_t;
1139
1140/* NINTENDO2 */
1141#define LQ_IDX_MIN              0
1142#define LQ_IDX_MAX              1
1143#define LQ_IDX_AVG              2
1144#define LQ_IDX_SUM              2
1145#define LQ_IDX_LAST             3
1146#define LQ_STOP_MONITOR         0
1147#define LQ_START_MONITOR        1
1148
1149/* Get averages RSSI, Rx PHY rate and SNR values */
1150typedef struct {
1151	int rssi[LQ_IDX_LAST];  /* Array to keep min, max, avg rssi */
1152	int snr[LQ_IDX_LAST];   /* Array to keep min, max, avg snr */
1153	int isvalid;            /* Flag indicating whether above data is valid */
1154} wl_lq_t; /* Link Quality */
1155
1156typedef enum wl_wakeup_reason_type {
1157	LCD_ON = 1,
1158	LCD_OFF,
1159	DRC1_WAKE,
1160	DRC2_WAKE,
1161	REASON_LAST
1162} wl_wr_type_t;
1163
1164typedef struct {
1165/* Unique filter id */
1166	uint32	id;
1167
1168/* stores the reason for the last wake up */
1169	uint8	reason;
1170} wl_wr_t;
1171
1172/* Get MAC specific rate histogram command */
1173typedef struct {
1174	struct	ether_addr ea;	/* MAC Address */
1175	uint8	ac_cat;	/* Access Category */
1176	uint8	num_pkts;	/* Number of packet entries to be averaged */
1177} wl_mac_ratehisto_cmd_t;	/* MAC Specific Rate Histogram command */
1178
1179/* Get MAC rate histogram response */
1180typedef struct {
1181	uint32	rate[WLC_MAXRATE + 1];	/* Rates */
1182	uint32	mcs[WL_RATESET_SZ_HT_MCS * WL_TX_CHAINS_MAX];	/* MCS counts */
1183	uint32	vht[WL_RATESET_SZ_VHT_MCS][WL_TX_CHAINS_MAX];	/* VHT counts */
1184	uint32	tsf_timer[2][2];	/* Start and End time for 8bytes value */
1185} wl_mac_ratehisto_res_t;	/* MAC Specific Rate Histogram Response */
1186
1187/* Values for TX Filter override mode */
1188#define WLC_TXFILTER_OVERRIDE_DISABLED  0
1189#define WLC_TXFILTER_OVERRIDE_ENABLED   1
1190
1191#define WL_IOCTL_ACTION_GET				0x0
1192#define WL_IOCTL_ACTION_SET				0x1
1193#define WL_IOCTL_ACTION_OVL_IDX_MASK	0x1e
1194#define WL_IOCTL_ACTION_OVL_RSV			0x20
1195#define WL_IOCTL_ACTION_OVL				0x40
1196#define WL_IOCTL_ACTION_MASK			0x7e
1197#define WL_IOCTL_ACTION_OVL_SHIFT		1
1198
1199/* Linux network driver ioctl encoding */
1200typedef struct wl_ioctl {
1201	uint cmd;	/* common ioctl definition */
1202	void *buf;	/* pointer to user buffer */
1203	uint len;	/* length of user buffer */
1204	uint8 set;		/* 1=set IOCTL; 0=query IOCTL */
1205	uint used;	/* bytes read or written (optional) */
1206	uint needed;	/* bytes needed (optional) */
1207} wl_ioctl_t;
1208
1209/* reference to wl_ioctl_t struct used by usermode driver */
1210#define ioctl_subtype	set		/* subtype param */
1211#define ioctl_pid	used		/* pid param */
1212#define ioctl_status	needed		/* status param */
1213
1214/*
1215 * Structure for passing hardware and software
1216 * revision info up from the driver.
1217 */
1218typedef struct wlc_rev_info {
1219	uint		vendorid;	/* PCI vendor id */
1220	uint		deviceid;	/* device id of chip */
1221	uint		radiorev;	/* radio revision */
1222	uint		chiprev;	/* chip revision */
1223	uint		corerev;	/* core revision */
1224	uint		boardid;	/* board identifier (usu. PCI sub-device id) */
1225	uint		boardvendor;	/* board vendor (usu. PCI sub-vendor id) */
1226	uint		boardrev;	/* board revision */
1227	uint		driverrev;	/* driver version */
1228	uint		ucoderev;	/* microcode version */
1229	uint		bus;		/* bus type */
1230	uint		chipnum;	/* chip number */
1231	uint		phytype;	/* phy type */
1232	uint		phyrev;		/* phy revision */
1233	uint		anarev;		/* anacore rev */
1234	uint		chippkg;	/* chip package info */
1235} wlc_rev_info_t;
1236
1237#define WL_REV_INFO_LEGACY_LENGTH	48
1238
1239#define WL_BRAND_MAX 10
1240typedef struct wl_instance_info {
1241	uint instance;
1242	char brand[WL_BRAND_MAX];
1243} wl_instance_info_t;
1244
1245/* structure to change size of tx fifo */
1246typedef struct wl_txfifo_sz {
1247	uint16	magic;
1248	uint16	fifo;
1249	uint16	size;
1250} wl_txfifo_sz_t;
1251/* magic pattern used for mismatch driver and wl */
1252#define WL_TXFIFO_SZ_MAGIC	0xa5a5
1253
1254/* Transfer info about an IOVar from the driver */
1255/* Max supported IOV name size in bytes, + 1 for nul termination */
1256#define WLC_IOV_NAME_LEN 30
1257typedef struct wlc_iov_trx_s {
1258	uint8 module;
1259	uint8 type;
1260	char name[WLC_IOV_NAME_LEN];
1261} wlc_iov_trx_t;
1262
1263/* check this magic number */
1264#define WLC_IOCTL_MAGIC		0x14e46c77
1265
1266/* bump this number if you change the ioctl interface */
1267#ifdef D11AC_IOTYPES
1268#define WLC_IOCTL_VERSION	2
1269#define WLC_IOCTL_VERSION_LEGACY_IOTYPES	1
1270#else
1271#define WLC_IOCTL_VERSION	1
1272#endif /* D11AC_IOTYPES */
1273
1274#define	WLC_IOCTL_MAXLEN		8192	/* max length ioctl buffer required */
1275#define	WLC_IOCTL_SMLEN			256	/* "small" length ioctl buffer required */
1276#define WLC_IOCTL_MEDLEN		1536    /* "med" length ioctl buffer required */
1277#if defined(LCNCONF) || defined(LCN40CONF)
1278#define WLC_SAMPLECOLLECT_MAXLEN	8192	/* Max Sample Collect buffer */
1279#else
1280#define WLC_SAMPLECOLLECT_MAXLEN	10240	/* Max Sample Collect buffer for two cores */
1281#endif
1282
1283/* common ioctl definitions */
1284#define WLC_GET_MAGIC				0
1285#define WLC_GET_VERSION				1
1286#define WLC_UP					2
1287#define WLC_DOWN				3
1288#define WLC_GET_LOOP				4
1289#define WLC_SET_LOOP				5
1290#define WLC_DUMP				6
1291#define WLC_GET_MSGLEVEL			7
1292#define WLC_SET_MSGLEVEL			8
1293#define WLC_GET_PROMISC				9
1294#define WLC_SET_PROMISC				10
1295/* #define WLC_OVERLAY_IOCTL			11 */ /* not supported */
1296#define WLC_GET_RATE				12
1297#define WLC_GET_MAX_RATE			13
1298#define WLC_GET_INSTANCE			14
1299/* #define WLC_GET_FRAG				15 */ /* no longer supported */
1300/* #define WLC_SET_FRAG				16 */ /* no longer supported */
1301/* #define WLC_GET_RTS				17 */ /* no longer supported */
1302/* #define WLC_SET_RTS				18 */ /* no longer supported */
1303#define WLC_GET_INFRA				19
1304#define WLC_SET_INFRA				20
1305#define WLC_GET_AUTH				21
1306#define WLC_SET_AUTH				22
1307#define WLC_GET_BSSID				23
1308#define WLC_SET_BSSID				24
1309#define WLC_GET_SSID				25
1310#define WLC_SET_SSID				26
1311#define WLC_RESTART				27
1312#define WLC_TERMINATED             		28
1313/* #define WLC_DUMP_SCB				28 */ /* no longer supported */
1314#define WLC_GET_CHANNEL				29
1315#define WLC_SET_CHANNEL				30
1316#define WLC_GET_SRL				31
1317#define WLC_SET_SRL				32
1318#define WLC_GET_LRL				33
1319#define WLC_SET_LRL				34
1320#define WLC_GET_PLCPHDR				35
1321#define WLC_SET_PLCPHDR				36
1322#define WLC_GET_RADIO				37
1323#define WLC_SET_RADIO				38
1324#define WLC_GET_PHYTYPE				39
1325#define WLC_DUMP_RATE				40
1326#define WLC_SET_RATE_PARAMS			41
1327#define WLC_GET_FIXRATE				42
1328#define WLC_SET_FIXRATE				43
1329/* #define WLC_GET_WEP				42 */ /* no longer supported */
1330/* #define WLC_SET_WEP				43 */ /* no longer supported */
1331#define WLC_GET_KEY				44
1332#define WLC_SET_KEY				45
1333#define WLC_GET_REGULATORY			46
1334#define WLC_SET_REGULATORY			47
1335#define WLC_GET_PASSIVE_SCAN			48
1336#define WLC_SET_PASSIVE_SCAN			49
1337#define WLC_SCAN				50
1338#define WLC_SCAN_RESULTS			51
1339#define WLC_DISASSOC				52
1340#define WLC_REASSOC				53
1341#define WLC_GET_ROAM_TRIGGER			54
1342#define WLC_SET_ROAM_TRIGGER			55
1343#define WLC_GET_ROAM_DELTA			56
1344#define WLC_SET_ROAM_DELTA			57
1345#define WLC_GET_ROAM_SCAN_PERIOD		58
1346#define WLC_SET_ROAM_SCAN_PERIOD		59
1347#define WLC_EVM					60	/* diag */
1348#define WLC_GET_TXANT				61
1349#define WLC_SET_TXANT				62
1350#define WLC_GET_ANTDIV				63
1351#define WLC_SET_ANTDIV				64
1352/* #define WLC_GET_TXPWR			65 */ /* no longer supported */
1353/* #define WLC_SET_TXPWR			66 */ /* no longer supported */
1354#define WLC_GET_CLOSED				67
1355#define WLC_SET_CLOSED				68
1356#define WLC_GET_MACLIST				69
1357#define WLC_SET_MACLIST				70
1358#define WLC_GET_RATESET				71
1359#define WLC_SET_RATESET				72
1360/* #define WLC_GET_LOCALE			73 */ /* no longer supported */
1361#define WLC_LONGTRAIN				74
1362#define WLC_GET_BCNPRD				75
1363#define WLC_SET_BCNPRD				76
1364#define WLC_GET_DTIMPRD				77
1365#define WLC_SET_DTIMPRD				78
1366#define WLC_GET_SROM				79
1367#define WLC_SET_SROM				80
1368#define WLC_GET_WEP_RESTRICT			81
1369#define WLC_SET_WEP_RESTRICT			82
1370#define WLC_GET_COUNTRY				83
1371#define WLC_SET_COUNTRY				84
1372#define WLC_GET_PM				85
1373#define WLC_SET_PM				86
1374#define WLC_GET_WAKE				87
1375#define WLC_SET_WAKE				88
1376/* #define WLC_GET_D11CNTS			89 */ /* -> "counters" iovar */
1377#define WLC_GET_FORCELINK			90	/* ndis only */
1378#define WLC_SET_FORCELINK			91	/* ndis only */
1379#define WLC_FREQ_ACCURACY			92	/* diag */
1380#define WLC_CARRIER_SUPPRESS			93	/* diag */
1381#define WLC_GET_PHYREG				94
1382#define WLC_SET_PHYREG				95
1383#define WLC_GET_RADIOREG			96
1384#define WLC_SET_RADIOREG			97
1385#define WLC_GET_REVINFO				98
1386#define WLC_GET_UCANTDIV			99
1387#define WLC_SET_UCANTDIV			100
1388#define WLC_R_REG				101
1389#define WLC_W_REG				102
1390/* #define WLC_DIAG_LOOPBACK			103	old tray diag */
1391/* #define WLC_RESET_D11CNTS			104 */ /* -> "reset_d11cnts" iovar */
1392#define WLC_GET_MACMODE				105
1393#define WLC_SET_MACMODE				106
1394#define WLC_GET_MONITOR				107
1395#define WLC_SET_MONITOR				108
1396#define WLC_GET_GMODE				109
1397#define WLC_SET_GMODE				110
1398#define WLC_GET_LEGACY_ERP			111
1399#define WLC_SET_LEGACY_ERP			112
1400#define WLC_GET_RX_ANT				113
1401#define WLC_GET_CURR_RATESET			114	/* current rateset */
1402#define WLC_GET_SCANSUPPRESS			115
1403#define WLC_SET_SCANSUPPRESS			116
1404#define WLC_GET_AP				117
1405#define WLC_SET_AP				118
1406#define WLC_GET_EAP_RESTRICT			119
1407#define WLC_SET_EAP_RESTRICT			120
1408#define WLC_SCB_AUTHORIZE			121
1409#define WLC_SCB_DEAUTHORIZE			122
1410#define WLC_GET_WDSLIST				123
1411#define WLC_SET_WDSLIST				124
1412#define WLC_GET_ATIM				125
1413#define WLC_SET_ATIM				126
1414#define WLC_GET_RSSI				127
1415#define WLC_GET_PHYANTDIV			128
1416#define WLC_SET_PHYANTDIV			129
1417#define WLC_AP_RX_ONLY				130
1418#define WLC_GET_TX_PATH_PWR			131
1419#define WLC_SET_TX_PATH_PWR			132
1420#define WLC_GET_WSEC				133
1421#define WLC_SET_WSEC				134
1422#define WLC_GET_PHY_NOISE			135
1423#define WLC_GET_BSS_INFO			136
1424#define WLC_GET_PKTCNTS				137
1425#define WLC_GET_LAZYWDS				138
1426#define WLC_SET_LAZYWDS				139
1427#define WLC_GET_BANDLIST			140
1428#define WLC_GET_BAND				141
1429#define WLC_SET_BAND				142
1430#define WLC_SCB_DEAUTHENTICATE			143
1431#define WLC_GET_SHORTSLOT			144
1432#define WLC_GET_SHORTSLOT_OVERRIDE		145
1433#define WLC_SET_SHORTSLOT_OVERRIDE		146
1434#define WLC_GET_SHORTSLOT_RESTRICT		147
1435#define WLC_SET_SHORTSLOT_RESTRICT		148
1436#define WLC_GET_GMODE_PROTECTION		149
1437#define WLC_GET_GMODE_PROTECTION_OVERRIDE	150
1438#define WLC_SET_GMODE_PROTECTION_OVERRIDE	151
1439#define WLC_UPGRADE				152
1440/* #define WLC_GET_MRATE			153 */ /* no longer supported */
1441/* #define WLC_SET_MRATE			154 */ /* no longer supported */
1442#define WLC_GET_IGNORE_BCNS			155
1443#define WLC_SET_IGNORE_BCNS			156
1444#define WLC_GET_SCB_TIMEOUT			157
1445#define WLC_SET_SCB_TIMEOUT			158
1446#define WLC_GET_ASSOCLIST			159
1447#define WLC_GET_CLK				160
1448#define WLC_SET_CLK				161
1449#define WLC_GET_UP				162
1450#define WLC_OUT					163
1451#define WLC_GET_WPA_AUTH			164
1452#define WLC_SET_WPA_AUTH			165
1453#define WLC_GET_UCFLAGS				166
1454#define WLC_SET_UCFLAGS				167
1455#define WLC_GET_PWRIDX				168
1456#define WLC_SET_PWRIDX				169
1457#define WLC_GET_TSSI				170
1458#define WLC_GET_SUP_RATESET_OVERRIDE		171
1459#define WLC_SET_SUP_RATESET_OVERRIDE		172
1460/* #define WLC_SET_FAST_TIMER			173 */ /* no longer supported */
1461/* #define WLC_GET_FAST_TIMER			174 */ /* no longer supported */
1462/* #define WLC_SET_SLOW_TIMER			175 */ /* no longer supported */
1463/* #define WLC_GET_SLOW_TIMER			176 */ /* no longer supported */
1464/* #define WLC_DUMP_PHYREGS			177 */ /* no longer supported */
1465#define WLC_GET_PROTECTION_CONTROL		178
1466#define WLC_SET_PROTECTION_CONTROL		179
1467#define WLC_GET_PHYLIST				180
1468#define WLC_ENCRYPT_STRENGTH			181	/* ndis only */
1469#define WLC_DECRYPT_STATUS			182	/* ndis only */
1470#define WLC_GET_KEY_SEQ				183
1471#define WLC_GET_SCAN_CHANNEL_TIME		184
1472#define WLC_SET_SCAN_CHANNEL_TIME		185
1473#define WLC_GET_SCAN_UNASSOC_TIME		186
1474#define WLC_SET_SCAN_UNASSOC_TIME		187
1475#define WLC_GET_SCAN_HOME_TIME			188
1476#define WLC_SET_SCAN_HOME_TIME			189
1477#define WLC_GET_SCAN_NPROBES			190
1478#define WLC_SET_SCAN_NPROBES			191
1479#define WLC_GET_PRB_RESP_TIMEOUT		192
1480#define WLC_SET_PRB_RESP_TIMEOUT		193
1481#define WLC_GET_ATTEN				194
1482#define WLC_SET_ATTEN				195
1483#define WLC_GET_SHMEM				196	/* diag */
1484#define WLC_SET_SHMEM				197	/* diag */
1485/* #define WLC_GET_GMODE_PROTECTION_CTS		198 */ /* no longer supported */
1486/* #define WLC_SET_GMODE_PROTECTION_CTS		199 */ /* no longer supported */
1487#define WLC_SET_WSEC_TEST			200
1488#define WLC_SCB_DEAUTHENTICATE_FOR_REASON	201
1489#define WLC_TKIP_COUNTERMEASURES		202
1490#define WLC_GET_PIOMODE				203
1491#define WLC_SET_PIOMODE				204
1492#define WLC_SET_ASSOC_PREFER			205
1493#define WLC_GET_ASSOC_PREFER			206
1494#define WLC_SET_ROAM_PREFER			207
1495#define WLC_GET_ROAM_PREFER			208
1496#define WLC_SET_LED				209
1497#define WLC_GET_LED				210
1498#define WLC_GET_INTERFERENCE_MODE		211
1499#define WLC_SET_INTERFERENCE_MODE		212
1500#define WLC_GET_CHANNEL_QA			213
1501#define WLC_START_CHANNEL_QA			214
1502#define WLC_GET_CHANNEL_SEL			215
1503#define WLC_START_CHANNEL_SEL			216
1504#define WLC_GET_VALID_CHANNELS			217
1505#define WLC_GET_FAKEFRAG			218
1506#define WLC_SET_FAKEFRAG			219
1507#define WLC_GET_PWROUT_PERCENTAGE		220
1508#define WLC_SET_PWROUT_PERCENTAGE		221
1509#define WLC_SET_BAD_FRAME_PREEMPT		222
1510#define WLC_GET_BAD_FRAME_PREEMPT		223
1511#define WLC_SET_LEAP_LIST			224
1512#define WLC_GET_LEAP_LIST			225
1513#define WLC_GET_CWMIN				226
1514#define WLC_SET_CWMIN				227
1515#define WLC_GET_CWMAX				228
1516#define WLC_SET_CWMAX				229
1517#define WLC_GET_WET				230
1518#define WLC_SET_WET				231
1519#define WLC_GET_PUB				232
1520/* #define WLC_SET_GLACIAL_TIMER		233 */ /* no longer supported */
1521/* #define WLC_GET_GLACIAL_TIMER		234 */ /* no longer supported */
1522#define WLC_GET_KEY_PRIMARY			235
1523#define WLC_SET_KEY_PRIMARY			236
1524/* #define WLC_DUMP_RADIOREGS			237 */ /* no longer supported */
1525#define WLC_GET_ACI_ARGS			238
1526#define WLC_SET_ACI_ARGS			239
1527#define WLC_UNSET_CALLBACK			240
1528#define WLC_SET_CALLBACK			241
1529#define WLC_GET_RADAR				242
1530#define WLC_SET_RADAR				243
1531#define WLC_SET_SPECT_MANAGMENT			244
1532#define WLC_GET_SPECT_MANAGMENT			245
1533#define WLC_WDS_GET_REMOTE_HWADDR		246	/* handled in wl_linux.c/wl_vx.c */
1534#define WLC_WDS_GET_WPA_SUP			247
1535#define WLC_SET_CS_SCAN_TIMER			248
1536#define WLC_GET_CS_SCAN_TIMER			249
1537#define WLC_MEASURE_REQUEST			250
1538#define WLC_INIT				251
1539#define WLC_SEND_QUIET				252
1540#define WLC_KEEPALIVE			253
1541#define WLC_SEND_PWR_CONSTRAINT			254
1542#define WLC_UPGRADE_STATUS			255
1543#define WLC_CURRENT_PWR				256
1544#define WLC_GET_SCAN_PASSIVE_TIME		257
1545#define WLC_SET_SCAN_PASSIVE_TIME		258
1546#define WLC_LEGACY_LINK_BEHAVIOR		259
1547#define WLC_GET_CHANNELS_IN_COUNTRY		260
1548#define WLC_GET_COUNTRY_LIST			261
1549#define WLC_GET_VAR				262	/* get value of named variable */
1550#define WLC_SET_VAR				263	/* set named variable to value */
1551#define WLC_NVRAM_GET				264	/* deprecated */
1552#define WLC_NVRAM_SET				265
1553#define WLC_NVRAM_DUMP				266
1554#define WLC_REBOOT				267
1555#define WLC_SET_WSEC_PMK			268
1556#define WLC_GET_AUTH_MODE			269
1557#define WLC_SET_AUTH_MODE			270
1558#define WLC_GET_WAKEENTRY			271
1559#define WLC_SET_WAKEENTRY			272
1560#define WLC_NDCONFIG_ITEM			273	/* currently handled in wl_oid.c */
1561#define WLC_NVOTPW				274
1562#define WLC_OTPW				275
1563#define WLC_IOV_BLOCK_GET			276
1564#define WLC_IOV_MODULES_GET			277
1565#define WLC_SOFT_RESET				278
1566#define WLC_GET_ALLOW_MODE			279
1567#define WLC_SET_ALLOW_MODE			280
1568#define WLC_GET_DESIRED_BSSID			281
1569#define WLC_SET_DESIRED_BSSID			282
1570#define	WLC_DISASSOC_MYAP			283
1571#define WLC_GET_NBANDS				284	/* for Dongle EXT_STA support */
1572#define WLC_GET_BANDSTATES			285	/* for Dongle EXT_STA support */
1573#define WLC_GET_WLC_BSS_INFO			286	/* for Dongle EXT_STA support */
1574#define WLC_GET_ASSOC_INFO			287	/* for Dongle EXT_STA support */
1575#define WLC_GET_OID_PHY				288	/* for Dongle EXT_STA support */
1576#define WLC_SET_OID_PHY				289	/* for Dongle EXT_STA support */
1577#define WLC_SET_ASSOC_TIME			290	/* for Dongle EXT_STA support */
1578#define WLC_GET_DESIRED_SSID			291	/* for Dongle EXT_STA support */
1579#define WLC_GET_CHANSPEC			292	/* for Dongle EXT_STA support */
1580#define WLC_GET_ASSOC_STATE			293	/* for Dongle EXT_STA support */
1581#define WLC_SET_PHY_STATE			294	/* for Dongle EXT_STA support */
1582#define WLC_GET_SCAN_PENDING			295	/* for Dongle EXT_STA support */
1583#define WLC_GET_SCANREQ_PENDING			296	/* for Dongle EXT_STA support */
1584#define WLC_GET_PREV_ROAM_REASON		297	/* for Dongle EXT_STA support */
1585#define WLC_SET_PREV_ROAM_REASON		298	/* for Dongle EXT_STA support */
1586#define WLC_GET_BANDSTATES_PI			299	/* for Dongle EXT_STA support */
1587#define WLC_GET_PHY_STATE			300	/* for Dongle EXT_STA support */
1588#define WLC_GET_BSS_WPA_RSN			301	/* for Dongle EXT_STA support */
1589#define WLC_GET_BSS_WPA2_RSN			302	/* for Dongle EXT_STA support */
1590#define WLC_GET_BSS_BCN_TS			303	/* for Dongle EXT_STA support */
1591#define WLC_GET_INT_DISASSOC			304	/* for Dongle EXT_STA support */
1592#define WLC_SET_NUM_PEERS			305     /* for Dongle EXT_STA support */
1593#define WLC_GET_NUM_BSS				306	/* for Dongle EXT_STA support */
1594#define WLC_PHY_SAMPLE_COLLECT			307	/* phy sample collect mode */
1595/* #define WLC_UM_PRIV				308 */	/* Deprecated: usermode driver */
1596#define WLC_GET_CMD				309
1597/* #define WLC_LAST				310 */	/* Never used - can be reused */
1598#define WLC_SET_INTERFERENCE_OVERRIDE_MODE	311	/* set inter mode override */
1599#define WLC_GET_INTERFERENCE_OVERRIDE_MODE	312	/* get inter mode override */
1600/* #define WLC_GET_WAI_RESTRICT			313 */	/* for WAPI, deprecated use iovar instead */
1601/* #define WLC_SET_WAI_RESTRICT			314 */	/* for WAPI, deprecated use iovar instead */
1602/* #define WLC_SET_WAI_REKEY			315 */	/* for WAPI, deprecated use iovar instead */
1603#define WLC_SET_NAT_CONFIG			316	/* for configuring NAT filter driver */
1604#define WLC_GET_NAT_STATE			317
1605#define WLC_LAST				318
1606
1607#ifndef EPICTRL_COOKIE
1608#define EPICTRL_COOKIE		0xABADCEDE
1609#endif
1610
1611/* vx wlc ioctl's offset */
1612#define CMN_IOCTL_OFF 0x180
1613
1614/*
1615 * custom OID support
1616 *
1617 * 0xFF - implementation specific OID
1618 * 0xE4 - first byte of Broadcom PCI vendor ID
1619 * 0x14 - second byte of Broadcom PCI vendor ID
1620 * 0xXX - the custom OID number
1621 */
1622
1623/* begin 0x1f values beyond the start of the ET driver range. */
1624#define WL_OID_BASE		0xFFE41420
1625
1626/* NDIS overrides */
1627#define OID_WL_GETINSTANCE	(WL_OID_BASE + WLC_GET_INSTANCE)
1628#define OID_WL_GET_FORCELINK	(WL_OID_BASE + WLC_GET_FORCELINK)
1629#define OID_WL_SET_FORCELINK	(WL_OID_BASE + WLC_SET_FORCELINK)
1630#define	OID_WL_ENCRYPT_STRENGTH	(WL_OID_BASE + WLC_ENCRYPT_STRENGTH)
1631#define OID_WL_DECRYPT_STATUS	(WL_OID_BASE + WLC_DECRYPT_STATUS)
1632#define OID_LEGACY_LINK_BEHAVIOR (WL_OID_BASE + WLC_LEGACY_LINK_BEHAVIOR)
1633#define OID_WL_NDCONFIG_ITEM	(WL_OID_BASE + WLC_NDCONFIG_ITEM)
1634
1635/* EXT_STA Dongle suuport */
1636#define OID_STA_CHANSPEC	(WL_OID_BASE + WLC_GET_CHANSPEC)
1637#define OID_STA_NBANDS		(WL_OID_BASE + WLC_GET_NBANDS)
1638#define OID_STA_GET_PHY		(WL_OID_BASE + WLC_GET_OID_PHY)
1639#define OID_STA_SET_PHY		(WL_OID_BASE + WLC_SET_OID_PHY)
1640#define OID_STA_ASSOC_TIME	(WL_OID_BASE + WLC_SET_ASSOC_TIME)
1641#define OID_STA_DESIRED_SSID	(WL_OID_BASE + WLC_GET_DESIRED_SSID)
1642#define OID_STA_SET_PHY_STATE	(WL_OID_BASE + WLC_SET_PHY_STATE)
1643#define OID_STA_SCAN_PENDING	(WL_OID_BASE + WLC_GET_SCAN_PENDING)
1644#define OID_STA_SCANREQ_PENDING (WL_OID_BASE + WLC_GET_SCANREQ_PENDING)
1645#define OID_STA_GET_ROAM_REASON (WL_OID_BASE + WLC_GET_PREV_ROAM_REASON)
1646#define OID_STA_SET_ROAM_REASON (WL_OID_BASE + WLC_SET_PREV_ROAM_REASON)
1647#define OID_STA_GET_PHY_STATE	(WL_OID_BASE + WLC_GET_PHY_STATE)
1648#define OID_STA_INT_DISASSOC	(WL_OID_BASE + WLC_GET_INT_DISASSOC)
1649#define OID_STA_SET_NUM_PEERS	(WL_OID_BASE + WLC_SET_NUM_PEERS)
1650#define OID_STA_GET_NUM_BSS	(WL_OID_BASE + WLC_GET_NUM_BSS)
1651
1652/* NAT filter driver support */
1653#define OID_NAT_SET_CONFIG	(WL_OID_BASE + WLC_SET_NAT_CONFIG)
1654#define OID_NAT_GET_STATE	(WL_OID_BASE + WLC_GET_NAT_STATE)
1655
1656#define WL_DECRYPT_STATUS_SUCCESS	1
1657#define WL_DECRYPT_STATUS_FAILURE	2
1658#define WL_DECRYPT_STATUS_UNKNOWN	3
1659
1660/* allows user-mode app to poll the status of USB image upgrade */
1661#define WLC_UPGRADE_SUCCESS			0
1662#define WLC_UPGRADE_PENDING			1
1663
1664#ifdef CONFIG_USBRNDIS_RETAIL
1665/* struct passed in for WLC_NDCONFIG_ITEM */
1666typedef struct {
1667	char *name;
1668	void *param;
1669} ndconfig_item_t;
1670#endif
1671
1672
1673/* WLC_GET_AUTH, WLC_SET_AUTH values */
1674#define WL_AUTH_OPEN_SYSTEM		0	/* d11 open authentication */
1675#define WL_AUTH_SHARED_KEY		1	/* d11 shared authentication */
1676#define WL_AUTH_OPEN_SHARED     	2   /* try open, then shared if open failed w/rc 13 */
1677
1678/* Bit masks for radio disabled status - returned by WL_GET_RADIO */
1679#define WL_RADIO_SW_DISABLE		(1<<0)
1680#define WL_RADIO_HW_DISABLE		(1<<1)
1681#define WL_RADIO_MPC_DISABLE		(1<<2)
1682#define WL_RADIO_COUNTRY_DISABLE	(1<<3)	/* some countries don't support any channel */
1683
1684#define	WL_SPURAVOID_OFF	0
1685#define	WL_SPURAVOID_ON1	1
1686#define	WL_SPURAVOID_ON2	2
1687
1688/* Override bit for WLC_SET_TXPWR.  if set, ignore other level limits */
1689#define WL_TXPWR_OVERRIDE	(1U<<31)
1690#define WL_TXPWR_NEG   (1U<<30)
1691
1692#define WL_PHY_PAVARS_LEN	32	/* Phy type, Band range, chain, a1[0], b0[0], b1[0] ... */
1693
1694#define WL_PHY_PAVAR_VER	1	/* pavars version */
1695
1696typedef struct wl_po {
1697	uint16	phy_type;	/* Phy type */
1698	uint16	band;
1699	uint16	cckpo;
1700	uint32	ofdmpo;
1701	uint16	mcspo[8];
1702} wl_po_t;
1703
1704/* a large TX Power as an init value to factor out of MIN() calculations,
1705 * keep low enough to fit in an int8, units are .25 dBm
1706 */
1707#define WLC_TXPWR_MAX		(127)	/* ~32 dBm = 1,500 mW */
1708
1709/* "diag" iovar argument and error code */
1710#define WL_DIAG_INTERRUPT			1	/* d11 loopback interrupt test */
1711#define WL_DIAG_LOOPBACK			2	/* d11 loopback data test */
1712#define WL_DIAG_MEMORY				3	/* d11 memory test */
1713#define WL_DIAG_LED				4	/* LED test */
1714#define WL_DIAG_REG				5	/* d11/phy register test */
1715#define WL_DIAG_SROM				6	/* srom read/crc test */
1716#define WL_DIAG_DMA				7	/* DMA test */
1717#define WL_DIAG_LOOPBACK_EXT			8	/* enhenced d11 loopback data test */
1718
1719#define WL_DIAGERR_SUCCESS			0
1720#define WL_DIAGERR_FAIL_TO_RUN			1	/* unable to run requested diag */
1721#define WL_DIAGERR_NOT_SUPPORTED		2	/* diag requested is not supported */
1722#define WL_DIAGERR_INTERRUPT_FAIL		3	/* loopback interrupt test failed */
1723#define WL_DIAGERR_LOOPBACK_FAIL		4	/* loopback data test failed */
1724#define WL_DIAGERR_SROM_FAIL			5	/* srom read failed */
1725#define WL_DIAGERR_SROM_BADCRC			6	/* srom crc failed */
1726#define WL_DIAGERR_REG_FAIL			7	/* d11/phy register test failed */
1727#define WL_DIAGERR_MEMORY_FAIL			8	/* d11 memory test failed */
1728#define WL_DIAGERR_NOMEM			9	/* diag test failed due to no memory */
1729#define WL_DIAGERR_DMA_FAIL			10	/* DMA test failed */
1730
1731#define WL_DIAGERR_MEMORY_TIMEOUT		11	/* d11 memory test didn't finish in time */
1732#define WL_DIAGERR_MEMORY_BADPATTERN		12	/* d11 memory test result in bad pattern */
1733
1734/* band types */
1735#define	WLC_BAND_AUTO		0	/* auto-select */
1736#define	WLC_BAND_5G		1	/* 5 Ghz */
1737#define	WLC_BAND_2G		2	/* 2.4 Ghz */
1738#define	WLC_BAND_ALL		3	/* all bands */
1739
1740/* band range returned by band_range iovar */
1741#define WL_CHAN_FREQ_RANGE_2G      0
1742#define WL_CHAN_FREQ_RANGE_5GL     1
1743#define WL_CHAN_FREQ_RANGE_5GM     2
1744#define WL_CHAN_FREQ_RANGE_5GH     3
1745
1746#define WL_CHAN_FREQ_RANGE_5G_BAND0     1
1747#define WL_CHAN_FREQ_RANGE_5G_BAND1     2
1748#define WL_CHAN_FREQ_RANGE_5G_BAND2     3
1749#define WL_CHAN_FREQ_RANGE_5G_BAND3     4
1750
1751#define WL_CHAN_FREQ_RANGE_5G_4BAND    	5
1752
1753/* phy types (returned by WLC_GET_PHYTPE) */
1754#define	WLC_PHY_TYPE_A		0
1755#define	WLC_PHY_TYPE_B		1
1756#define	WLC_PHY_TYPE_G		2
1757#define	WLC_PHY_TYPE_N		4
1758#define	WLC_PHY_TYPE_LP		5
1759#define	WLC_PHY_TYPE_SSN	6
1760#define	WLC_PHY_TYPE_HT		7
1761#define	WLC_PHY_TYPE_LCN	8
1762#define	WLC_PHY_TYPE_LCN40	10
1763#define WLC_PHY_TYPE_AC		11
1764#define	WLC_PHY_TYPE_NULL	0xf
1765
1766/* MAC list modes */
1767#define WLC_MACMODE_DISABLED	0	/* MAC list disabled */
1768#define WLC_MACMODE_DENY	1	/* Deny specified (i.e. allow unspecified) */
1769#define WLC_MACMODE_ALLOW	2	/* Allow specified (i.e. deny unspecified) */
1770
1771/*
1772 * 54g modes (basic bits may still be overridden)
1773 *
1774 * GMODE_LEGACY_B			Rateset: 1b, 2b, 5.5, 11
1775 *					Preamble: Long
1776 *					Shortslot: Off
1777 * GMODE_AUTO				Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
1778 *					Extended Rateset: 6, 9, 12, 48
1779 *					Preamble: Long
1780 *					Shortslot: Auto
1781 * GMODE_ONLY				Rateset: 1b, 2b, 5.5b, 11b, 18, 24b, 36, 54
1782 *					Extended Rateset: 6b, 9, 12b, 48
1783 *					Preamble: Short required
1784 *					Shortslot: Auto
1785 * GMODE_B_DEFERRED			Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54
1786 *					Extended Rateset: 6, 9, 12, 48
1787 *					Preamble: Long
1788 *					Shortslot: On
1789 * GMODE_PERFORMANCE			Rateset: 1b, 2b, 5.5b, 6b, 9, 11b, 12b, 18, 24b, 36, 48, 54
1790 *					Preamble: Short required
1791 *					Shortslot: On and required
1792 * GMODE_LRS				Rateset: 1b, 2b, 5.5b, 11b
1793 *					Extended Rateset: 6, 9, 12, 18, 24, 36, 48, 54
1794 *					Preamble: Long
1795 *					Shortslot: Auto
1796 */
1797#define GMODE_LEGACY_B		0
1798#define GMODE_AUTO		1
1799#define GMODE_ONLY		2
1800#define GMODE_B_DEFERRED	3
1801#define GMODE_PERFORMANCE	4
1802#define GMODE_LRS		5
1803#define GMODE_MAX		6
1804
1805/* values for PLCPHdr_override */
1806#define WLC_PLCP_AUTO	-1
1807#define WLC_PLCP_SHORT	0
1808#define WLC_PLCP_LONG	1
1809
1810/* values for g_protection_override and n_protection_override */
1811#define WLC_PROTECTION_AUTO		-1
1812#define WLC_PROTECTION_OFF		0
1813#define WLC_PROTECTION_ON		1
1814#define WLC_PROTECTION_MMHDR_ONLY	2
1815#define WLC_PROTECTION_CTS_ONLY		3
1816
1817/* values for g_protection_control and n_protection_control */
1818#define WLC_PROTECTION_CTL_OFF		0
1819#define WLC_PROTECTION_CTL_LOCAL	1
1820#define WLC_PROTECTION_CTL_OVERLAP	2
1821
1822/* values for n_protection */
1823#define WLC_N_PROTECTION_OFF		0
1824#define WLC_N_PROTECTION_OPTIONAL	1
1825#define WLC_N_PROTECTION_20IN40		2
1826#define WLC_N_PROTECTION_MIXEDMODE	3
1827
1828/* values for n_preamble_type */
1829#define WLC_N_PREAMBLE_MIXEDMODE	0
1830#define WLC_N_PREAMBLE_GF		1
1831#define WLC_N_PREAMBLE_GF_BRCM          2
1832
1833/* values for band specific 40MHz capabilities (deprecated) */
1834#define WLC_N_BW_20ALL			0
1835#define WLC_N_BW_40ALL			1
1836#define WLC_N_BW_20IN2G_40IN5G		2
1837
1838#define WLC_BW_20MHZ_BIT		(1<<0)
1839#define WLC_BW_40MHZ_BIT		(1<<1)
1840#define WLC_BW_80MHZ_BIT		(1<<2)
1841
1842/* Bandwidth capabilities */
1843#define WLC_BW_CAP_20MHZ		(WLC_BW_20MHZ_BIT)
1844#define WLC_BW_CAP_40MHZ		(WLC_BW_40MHZ_BIT|WLC_BW_20MHZ_BIT)
1845#define WLC_BW_CAP_80MHZ		(WLC_BW_80MHZ_BIT|WLC_BW_40MHZ_BIT|WLC_BW_20MHZ_BIT)
1846#define WLC_BW_CAP_UNRESTRICTED		0xFF
1847
1848#define WL_BW_CAP_20MHZ(bw_cap)	(((bw_cap) & WLC_BW_20MHZ_BIT) ? TRUE : FALSE)
1849#define WL_BW_CAP_40MHZ(bw_cap)	(((bw_cap) & WLC_BW_40MHZ_BIT) ? TRUE : FALSE)
1850#define WL_BW_CAP_80MHZ(bw_cap)	(((bw_cap) & WLC_BW_80MHZ_BIT) ? TRUE : FALSE)
1851
1852/* values to force tx/rx chain */
1853#define WLC_N_TXRX_CHAIN0		0
1854#define WLC_N_TXRX_CHAIN1		1
1855
1856/* bitflags for SGI support (sgi_rx iovar) */
1857#define WLC_N_SGI_20			0x01
1858#define WLC_N_SGI_40			0x02
1859#define WLC_AC_SGI_80			0x04
1860
1861/* when sgi_tx==WLC_SGI_ALL, bypass rate selection, enable sgi for all mcs */
1862#define WLC_SGI_ALL				0x02
1863
1864/* Values for PM */
1865#define PM_OFF	0
1866#define PM_MAX	1
1867#define PM_FAST 2
1868#define PM_FORCE_OFF 3 		/* use this bit to force PM off even bt is active */
1869
1870#define LISTEN_INTERVAL			10
1871/* interference mitigation options */
1872#define	INTERFERE_OVRRIDE_OFF	-1	/* interference override off */
1873#define	INTERFERE_NONE	0	/* off */
1874#define	NON_WLAN	1	/* foreign/non 802.11 interference, no auto detect */
1875#define	WLAN_MANUAL	2	/* ACI: no auto detection */
1876#define	WLAN_AUTO	3	/* ACI: auto detect */
1877#define	WLAN_AUTO_W_NOISE	4	/* ACI: auto - detect and non 802.11 interference */
1878#define AUTO_ACTIVE	(1 << 7) /* Auto is currently active */
1879
1880typedef struct wl_aci_args {
1881	int enter_aci_thresh; /* Trigger level to start detecting ACI */
1882	int exit_aci_thresh; /* Trigger level to exit ACI mode */
1883	int usec_spin; /* microsecs to delay between rssi samples */
1884	int glitch_delay; /* interval between ACI scans when glitch count is consistently high */
1885	uint16 nphy_adcpwr_enter_thresh;	/* ADC power to enter ACI mitigation mode */
1886	uint16 nphy_adcpwr_exit_thresh;	/* ADC power to exit ACI mitigation mode */
1887	uint16 nphy_repeat_ctr;		/* Number of tries per channel to compute power */
1888	uint16 nphy_num_samples;	/* Number of samples to compute power on one channel */
1889	uint16 nphy_undetect_window_sz;	/* num of undetects to exit ACI Mitigation mode */
1890	uint16 nphy_b_energy_lo_aci;	/* low ACI power energy threshold for bphy */
1891	uint16 nphy_b_energy_md_aci;	/* mid ACI power energy threshold for bphy */
1892	uint16 nphy_b_energy_hi_aci;	/* high ACI power energy threshold for bphy */
1893	uint16 nphy_noise_noassoc_glitch_th_up; /* wl interference 4 */
1894	uint16 nphy_noise_noassoc_glitch_th_dn;
1895	uint16 nphy_noise_assoc_glitch_th_up;
1896	uint16 nphy_noise_assoc_glitch_th_dn;
1897	uint16 nphy_noise_assoc_aci_glitch_th_up;
1898	uint16 nphy_noise_assoc_aci_glitch_th_dn;
1899	uint16 nphy_noise_assoc_enter_th;
1900	uint16 nphy_noise_noassoc_enter_th;
1901	uint16 nphy_noise_assoc_rx_glitch_badplcp_enter_th;
1902	uint16 nphy_noise_noassoc_crsidx_incr;
1903	uint16 nphy_noise_assoc_crsidx_incr;
1904	uint16 nphy_noise_crsidx_decr;
1905} wl_aci_args_t;
1906
1907#define TRIGGER_NOW				0
1908#define TRIGGER_CRS				0x01
1909#define TRIGGER_CRSDEASSERT			0x02
1910#define TRIGGER_GOODFCS				0x04
1911#define TRIGGER_BADFCS				0x08
1912#define TRIGGER_BADPLCP				0x10
1913#define TRIGGER_CRSGLITCH			0x20
1914#define WL_ACI_ARGS_LEGACY_LENGTH	16	/* bytes of pre NPHY aci args */
1915#define	WL_SAMPLECOLLECT_T_VERSION	2	/* version of wl_samplecollect_args_t struct */
1916typedef struct wl_samplecollect_args {
1917	/* version 0 fields */
1918	uint8 coll_us;
1919	int cores;
1920	/* add'l version 1 fields */
1921	uint16 version;     /* see definition of WL_SAMPLECOLLECT_T_VERSION */
1922	uint16 length;      /* length of entire structure */
1923	int8 trigger;
1924	uint16 timeout;
1925	uint16 mode;
1926	uint32 pre_dur;
1927	uint32 post_dur;
1928	uint8 gpio_sel;
1929	bool downsamp;
1930	bool be_deaf;
1931	bool agc;		/* loop from init gain and going down */
1932	bool filter;		/* override high pass corners to lowest */
1933	/* add'l version 2 fields */
1934	uint8 trigger_state;
1935	uint8 module_sel1;
1936	uint8 module_sel2;
1937	uint16 nsamps;
1938} wl_samplecollect_args_t;
1939
1940#define	WL_SAMPLEDATA_HEADER_TYPE	1
1941#define WL_SAMPLEDATA_HEADER_SIZE	80	/* sample collect header size (bytes) */
1942#define	WL_SAMPLEDATA_TYPE		2
1943#define	WL_SAMPLEDATA_SEQ		0xff	/* sequence # */
1944#define	WL_SAMPLEDATA_MORE_DATA		0x100	/* more data mask */
1945#define	WL_SAMPLEDATA_T_VERSION		1	/* version of wl_samplecollect_args_t struct */
1946/* version for unpacked sample data, int16 {(I,Q),Core(0..N)} */
1947#define	WL_SAMPLEDATA_T_VERSION_SPEC_AN 2
1948
1949typedef struct wl_sampledata {
1950	uint16 version;	/* structure version */
1951	uint16 size;	/* size of structure */
1952	uint16 tag;	/* Header/Data */
1953	uint16 length;	/* data length */
1954	uint32 flag;	/* bit def */
1955} wl_sampledata_t;
1956
1957#ifndef LINUX_POSTMOGRIFY_REMOVAL
1958/* wl_radar_args_t */
1959typedef struct {
1960	int npulses; 	/* required number of pulses at n * t_int */
1961	int ncontig; 	/* required number of pulses at t_int */
1962	int min_pw; 	/* minimum pulse width (20 MHz clocks) */
1963	int max_pw; 	/* maximum pulse width (20 MHz clocks) */
1964	uint16 thresh0;	/* Radar detection, thresh 0 */
1965	uint16 thresh1;	/* Radar detection, thresh 1 */
1966	uint16 blank;	/* Radar detection, blank control */
1967	uint16 fmdemodcfg;	/* Radar detection, fmdemod config */
1968	int npulses_lp;  /* Radar detection, minimum long pulses */
1969	int min_pw_lp; /* Minimum pulsewidth for long pulses */
1970	int max_pw_lp; /* Maximum pulsewidth for long pulses */
1971	int min_fm_lp; /* Minimum fm for long pulses */
1972	int max_span_lp;  /* Maximum deltat for long pulses */
1973	int min_deltat; /* Minimum spacing between pulses */
1974	int max_deltat; /* Maximum spacing between pulses */
1975	uint16 autocorr;	/* Radar detection, autocorr on or off */
1976	uint16 st_level_time;	/* Radar detection, start_timing level */
1977	uint16 t2_min; /* minimum clocks needed to remain in state 2 */
1978	uint32 version; /* version */
1979	uint32 fra_pulse_err;	/* sample error margin for detecting French radar pulsed */
1980	int npulses_fra;  /* Radar detection, minimum French pulses set */
1981	int npulses_stg2;  /* Radar detection, minimum staggered-2 pulses set */
1982	int npulses_stg3;  /* Radar detection, minimum staggered-3 pulses set */
1983	uint16 percal_mask;	/* defines which period cal is masked from radar detection */
1984	int quant;	/* quantization resolution to pulse positions */
1985	uint32 min_burst_intv_lp;	/* minimum burst to burst interval for bin3 radar */
1986	uint32 max_burst_intv_lp;	/* maximum burst to burst interval for bin3 radar */
1987	int nskip_rst_lp;	/* number of skipped pulses before resetting lp buffer */
1988	int max_pw_tol;	/* maximum tollerance allowed in detected pulse width for radar detection */
1989	uint16 feature_mask; /* 16-bit mask to specify enabled features */
1990} wl_radar_args_t;
1991
1992#define WL_RADAR_ARGS_VERSION 2
1993
1994typedef struct {
1995	uint32 version; /* version */
1996	uint16 thresh0_20_lo;	/* Radar detection, thresh 0 (range 5250-5350MHz) for BW 20MHz */
1997	uint16 thresh1_20_lo;	/* Radar detection, thresh 1 (range 5250-5350MHz) for BW 20MHz */
1998	uint16 thresh0_40_lo;	/* Radar detection, thresh 0 (range 5250-5350MHz) for BW 40MHz */
1999	uint16 thresh1_40_lo;	/* Radar detection, thresh 1 (range 5250-5350MHz) for BW 40MHz */
2000	uint16 thresh0_80_lo;	/* Radar detection, thresh 0 (range 5250-5350MHz) for BW 80MHz */
2001	uint16 thresh1_80_lo;	/* Radar detection, thresh 1 (range 5250-5350MHz) for BW 80MHz */
2002	uint16 thresh0_160_lo;	/* Radar detection, thresh 0 (range 5250-5350MHz) for BW 160MHz */
2003	uint16 thresh1_160_lo;	/* Radar detection, thresh 1 (range 5250-5350MHz) for BW 160MHz */
2004	uint16 thresh0_20_hi;	/* Radar detection, thresh 0 (range 5470-5725MHz) for BW 20MHz */
2005	uint16 thresh1_20_hi;	/* Radar detection, thresh 1 (range 5470-5725MHz) for BW 20MHz */
2006	uint16 thresh0_40_hi;	/* Radar detection, thresh 0 (range 5470-5725MHz) for BW 40MHz */
2007	uint16 thresh1_40_hi;	/* Radar detection, thresh 1 (range 5470-5725MHz) for BW 40MHz */
2008	uint16 thresh0_80_hi;	/* Radar detection, thresh 0 (range 5470-5725MHz) for BW 80MHz */
2009	uint16 thresh1_80_hi;	/* Radar detection, thresh 1 (range 5470-5725MHz) for BW 80MHz */
2010	uint16 thresh0_160_hi;	/* Radar detection, thresh 0 (range 5470-5725MHz) for BW 160MHz */
2011	uint16 thresh1_160_hi;	/* Radar detection, thresh 1 (range 5470-5725MHz) for BW 160MHz */
2012} wl_radar_thr_t;
2013
2014#define WL_RADAR_THR_VERSION	2
2015#define WL_THRESHOLD_LO_BAND	70	/* range from 5250MHz - 5350MHz */
2016
2017/* radar iovar SET defines */
2018#define WL_RADAR_DETECTOR_OFF		0	/* radar detector off */
2019#define WL_RADAR_DETECTOR_ON		1	/* radar detector on */
2020#define WL_RADAR_SIMULATED		2	/* force radar detector to declare
2021						 * detection once
2022						 */
2023#define WL_RSSI_ANT_VERSION	1	/* current version of wl_rssi_ant_t */
2024#define WL_ANT_RX_MAX		2	/* max 2 receive antennas */
2025#define WL_ANT_HT_RX_MAX	3	/* max 3 receive antennas/cores */
2026#define WL_ANT_IDX_1		0	/* antenna index 1 */
2027#define WL_ANT_IDX_2		1	/* antenna index 2 */
2028
2029#ifndef WL_RSSI_ANT_MAX
2030#define WL_RSSI_ANT_MAX		4	/* max possible rx antennas */
2031#elif WL_RSSI_ANT_MAX != 4
2032#error "WL_RSSI_ANT_MAX does not match"
2033#endif
2034
2035/* RSSI per antenna */
2036typedef struct {
2037	uint32	version;		/* version field */
2038	uint32	count;			/* number of valid antenna rssi */
2039	int8 rssi_ant[WL_RSSI_ANT_MAX];	/* rssi per antenna */
2040} wl_rssi_ant_t;
2041
2042/* dfs_status iovar-related defines */
2043
2044/* cac - channel availability check,
2045 * ism - in-service monitoring
2046 * csa - channel switching announcement
2047 */
2048
2049/* cac state values */
2050#define WL_DFS_CACSTATE_IDLE		0	/* state for operating in non-radar channel */
2051#define	WL_DFS_CACSTATE_PREISM_CAC	1	/* CAC in progress */
2052#define WL_DFS_CACSTATE_ISM		2	/* ISM in progress */
2053#define WL_DFS_CACSTATE_CSA		3	/* csa */
2054#define WL_DFS_CACSTATE_POSTISM_CAC	4	/* ISM CAC */
2055#define WL_DFS_CACSTATE_PREISM_OOC	5	/* PREISM OOC */
2056#define WL_DFS_CACSTATE_POSTISM_OOC	6	/* POSTISM OOC */
2057#define WL_DFS_CACSTATES		7	/* this many states exist */
2058
2059/* data structure used in 'dfs_status' wl interface, which is used to query dfs status */
2060typedef struct {
2061	uint state;		/* noted by WL_DFS_CACSTATE_XX. */
2062	uint duration;		/* time spent in ms in state. */
2063	/* as dfs enters ISM state, it removes the operational channel from quiet channel
2064	 * list and notes the channel in channel_cleared. set to 0 if no channel is cleared
2065	 */
2066	chanspec_t chanspec_cleared;
2067	/* chanspec cleared used to be a uint, add another to uint16 to maintain size */
2068	uint16 pad;
2069} wl_dfs_status_t;
2070
2071#define NUM_PWRCTRL_RATES 12
2072
2073typedef struct {
2074	uint8 txpwr_band_max[NUM_PWRCTRL_RATES];	/* User set target */
2075	uint8 txpwr_limit[NUM_PWRCTRL_RATES];		/* reg and local power limit */
2076	uint8 txpwr_local_max;				/* local max according to the AP */
2077	uint8 txpwr_local_constraint;			/* local constraint according to the AP */
2078	uint8 txpwr_chan_reg_max;			/* Regulatory max for this channel */
2079	uint8 txpwr_target[2][NUM_PWRCTRL_RATES];	/* Latest target for 2.4 and 5 Ghz */
2080	uint8 txpwr_est_Pout[2];			/* Latest estimate for 2.4 and 5 Ghz */
2081	uint8 txpwr_opo[NUM_PWRCTRL_RATES];		/* On G phy, OFDM power offset */
2082	uint8 txpwr_bphy_cck_max[NUM_PWRCTRL_RATES];	/* Max CCK power for this band (SROM) */
2083	uint8 txpwr_bphy_ofdm_max;			/* Max OFDM power for this band (SROM) */
2084	uint8 txpwr_aphy_max[NUM_PWRCTRL_RATES];	/* Max power for A band (SROM) */
2085	int8  txpwr_antgain[2];				/* Ant gain for each band - from SROM */
2086	uint8 txpwr_est_Pout_gofdm;			/* Pwr estimate for 2.4 OFDM */
2087} tx_power_legacy_t;
2088
2089#define WL_TX_POWER_RATES_LEGACY    45
2090#define WL_TX_POWER_MCS20_FIRST         12
2091#define WL_TX_POWER_MCS20_NUM           16
2092#define WL_TX_POWER_MCS40_FIRST         28
2093#define WL_TX_POWER_MCS40_NUM           17
2094
2095typedef struct {
2096	uint32 flags;
2097	chanspec_t chanspec;                 /* txpwr report for this channel */
2098	chanspec_t local_chanspec;           /* channel on which we are associated */
2099	uint8 local_max;                 /* local max according to the AP */
2100	uint8 local_constraint;              /* local constraint according to the AP */
2101	int8  antgain[2];                /* Ant gain for each band - from SROM */
2102	uint8 rf_cores;                  /* count of RF Cores being reported */
2103	uint8 est_Pout[4];                           /* Latest tx power out estimate per RF
2104							  * chain without adjustment
2105							  */
2106	uint8 est_Pout_cck;                          /* Latest CCK tx power out estimate */
2107	uint8 user_limit[WL_TX_POWER_RATES_LEGACY];  /* User limit */
2108	uint8 reg_limit[WL_TX_POWER_RATES_LEGACY];   /* Regulatory power limit */
2109	uint8 board_limit[WL_TX_POWER_RATES_LEGACY]; /* Max power board can support (SROM) */
2110	uint8 target[WL_TX_POWER_RATES_LEGACY];      /* Latest target power */
2111} tx_power_legacy2_t;
2112
2113/* TX Power index defines */
2114#define WL_NUM_RATES_CCK			4 /* 1, 2, 5.5, 11 Mbps */
2115#define WL_NUM_RATES_OFDM			8 /* 6, 9, 12, 18, 24, 36, 48, 54 Mbps SISO/CDD */
2116#define WL_NUM_RATES_MCS_1STREAM	8 /* MCS 0-7 1-stream rates - SISO/CDD/STBC/MCS */
2117#define WL_NUM_RATES_EXTRA_VHT		2 /* Additional VHT 11AC rates */
2118#define WL_NUM_RATES_VHT			10
2119#define WL_NUM_RATES_MCS32			1
2120
2121#define WLC_NUM_RATES_CCK       WL_NUM_RATES_CCK
2122#define WLC_NUM_RATES_OFDM      WL_NUM_RATES_OFDM
2123#define WLC_NUM_RATES_MCS_1_STREAM  WL_NUM_RATES_MCS_1STREAM
2124#define WLC_NUM_RATES_MCS_2_STREAM  WL_NUM_RATES_MCS_1STREAM
2125#define WLC_NUM_RATES_MCS32     WL_NUM_RATES_MCS32
2126#define WL_TX_POWER_CCK_NUM     WL_NUM_RATES_CCK
2127#define WL_TX_POWER_OFDM_NUM        WL_NUM_RATES_OFDM
2128#define WL_TX_POWER_MCS_1_STREAM_NUM    WL_NUM_RATES_MCS_1STREAM
2129#define WL_TX_POWER_MCS_2_STREAM_NUM    WL_NUM_RATES_MCS_1STREAM
2130#define WL_TX_POWER_MCS_32_NUM      WL_NUM_RATES_MCS32
2131
2132#define WL_NUM_2x2_ELEMENTS		4
2133#define WL_NUM_3x3_ELEMENTS		6
2134
2135typedef struct txppr {
2136	/* start of 20MHz tx power limits */
2137	uint8 b20_1x1dsss[WL_NUM_RATES_CCK];		/* Legacy CCK/DSSS */
2138	uint8 b20_1x1ofdm[WL_NUM_RATES_OFDM];		/* Legacy OFDM transmission */
2139	uint8 b20_1x1mcs0[WL_NUM_RATES_MCS_1STREAM];		/* SISO MCS 0-7 */
2140
2141	uint8 b20_1x2dsss[WL_NUM_RATES_CCK];		/* Legacy CCK/DSSS */
2142	uint8 b20_1x2cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
2143	uint8 b20_1x2cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* CDD MCS 0-7 */
2144	uint8 b20_2x2stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
2145	uint8 b20_2x2sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* MCS 8-15 */
2146
2147	uint8 b20_1x3dsss[WL_NUM_RATES_CCK];		/* Legacy CCK/DSSS */
2148	uint8 b20_1x3cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
2149	uint8 b20_1x3cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* 1 Nsts to 3 Tx Chain */
2150	uint8 b20_2x3stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
2151	uint8 b20_2x3sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* 2 Nsts to 3 Tx Chain */
2152	uint8 b20_3x3sdm_mcs16[WL_NUM_RATES_MCS_1STREAM];	/* 3 Nsts to 3 Tx Chain */
2153
2154	uint8 b20_1x1vht[WL_NUM_RATES_EXTRA_VHT];		/* VHT8_9SS1 */
2155	uint8 b20_1x2cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD1 */
2156	uint8 b20_2x2stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC */
2157	uint8 b20_2x2sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2 */
2158	uint8 b20_1x3cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD2 */
2159	uint8 b20_2x3stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC_SPEXP1 */
2160	uint8 b20_2x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2_SPEXP1 */
2161	uint8 b20_3x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS3 */
2162
2163	/* start of 40MHz tx power limits */
2164	uint8 b40_dummy1x1dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
2165	uint8 b40_1x1ofdm[WL_NUM_RATES_OFDM];		/* Legacy OFDM transmission */
2166	uint8 b40_1x1mcs0[WL_NUM_RATES_MCS_1STREAM];		/* SISO MCS 0-7 */
2167
2168	uint8 b40_dummy1x2dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
2169	uint8 b40_1x2cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
2170	uint8 b40_1x2cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* CDD MCS 0-7 */
2171	uint8 b40_2x2stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
2172	uint8 b40_2x2sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* MCS 8-15 */
2173
2174	uint8 b40_dummy1x3dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
2175	uint8 b40_1x3cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
2176	uint8 b40_1x3cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* 1 Nsts to 3 Tx Chain */
2177	uint8 b40_2x3stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
2178	uint8 b40_2x3sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* 2 Nsts to 3 Tx Chain */
2179	uint8 b40_3x3sdm_mcs16[WL_NUM_RATES_MCS_1STREAM];	/* 3 Nsts to 3 Tx Chain */
2180
2181	uint8 b40_1x1vht[WL_NUM_RATES_EXTRA_VHT];		/* VHT8_9SS1 */
2182	uint8 b40_1x2cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD1 */
2183	uint8 b40_2x2stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC */
2184	uint8 b40_2x2sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2 */
2185	uint8 b40_1x3cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD2 */
2186	uint8 b40_2x3stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC_SPEXP1 */
2187	uint8 b40_2x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2_SPEXP1 */
2188	uint8 b40_3x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS3 */
2189
2190	/* start of 20in40MHz tx power limits */
2191	uint8 b20in40_1x1dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
2192	uint8 b20in40_1x1ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM transmission */
2193	uint8 b20in40_1x1mcs0[WL_NUM_RATES_MCS_1STREAM];	/* SISO MCS 0-7 */
2194
2195	uint8 b20in40_1x2dsss[WL_NUM_RATES_CCK];		/* Legacy CCK/DSSS */
2196	uint8 b20in40_1x2cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
2197	uint8 b20in40_1x2cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* CDD MCS 0-7 */
2198	uint8 b20in40_2x2stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
2199	uint8 b20in40_2x2sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* MCS 8-15 */
2200
2201	uint8 b20in40_1x3dsss[WL_NUM_RATES_CCK];		/* Legacy CCK/DSSS */
2202	uint8 b20in40_1x3cdd_ofdm[WL_NUM_RATES_OFDM];	/* 20 in 40 MHz Legacy OFDM CDD */
2203	uint8 b20in40_1x3cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* 1 Nsts to 3 Tx Chain */
2204	uint8 b20in40_2x3stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
2205	uint8 b20in40_2x3sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* 2 Nsts to 3 Tx Chain */
2206	uint8 b20in40_3x3sdm_mcs16[WL_NUM_RATES_MCS_1STREAM];	/* 3 Nsts to 3 Tx Chain */
2207
2208	uint8 b20in40_1x1vht[WL_NUM_RATES_EXTRA_VHT];		/* VHT8_9SS1 */
2209	uint8 b20in40_1x2cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD1 */
2210	uint8 b20in40_2x2stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC */
2211	uint8 b20in40_2x2sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2 */
2212	uint8 b20in40_1x3cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD2 */
2213	uint8 b20in40_2x3stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC_SPEXP1 */
2214	uint8 b20in40_2x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2_SPEXP1 */
2215	uint8 b20in40_3x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS3 */
2216
2217	/* start of 80MHz tx power limits */
2218	uint8 b80_dummy1x1dsss[WL_NUM_RATES_CCK];		/* Legacy CCK/DSSS */
2219	uint8 b80_1x1ofdm[WL_NUM_RATES_OFDM];			/* Legacy OFDM transmission */
2220	uint8 b80_1x1mcs0[WL_NUM_RATES_MCS_1STREAM];	/* SISO MCS 0-7 */
2221
2222	uint8 b80_dummy1x2dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
2223	uint8 b80_1x2cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
2224	uint8 b80_1x2cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* CDD MCS 0-7 */
2225	uint8 b80_2x2stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
2226	uint8 b80_2x2sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* MCS 8-15 */
2227
2228	uint8 b80_dummy1x3dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
2229	uint8 b80_1x3cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
2230	uint8 b80_1x3cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* 1 Nsts to 3 Tx Chain */
2231	uint8 b80_2x3stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
2232	uint8 b80_2x3sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* 2 Nsts to 3 Tx Chain */
2233	uint8 b80_3x3sdm_mcs16[WL_NUM_RATES_MCS_1STREAM];	/* 3 Nsts to 3 Tx Chain */
2234
2235	uint8 b80_1x1vht[WL_NUM_RATES_EXTRA_VHT];		/* VHT8_9SS1 */
2236	uint8 b80_1x2cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD1 */
2237	uint8 b80_2x2stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC */
2238	uint8 b80_2x2sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2 */
2239	uint8 b80_1x3cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD2 */
2240	uint8 b80_2x3stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC_SPEXP1 */
2241	uint8 b80_2x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2_SPEXP1 */
2242	uint8 b80_3x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS3 */
2243
2244	/* start of 20in80MHz tx power limits */
2245	uint8 b20in80_1x1dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
2246	uint8 b20in80_1x1ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM transmission */
2247	uint8 b20in80_1x1mcs0[WL_NUM_RATES_MCS_1STREAM];	/* SISO MCS 0-7 */
2248
2249	uint8 b20in80_1x2dsss[WL_NUM_RATES_CCK];		/* Legacy CCK/DSSS */
2250	uint8 b20in80_1x2cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
2251	uint8 b20in80_1x2cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* CDD MCS 0-7 */
2252	uint8 b20in80_2x2stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
2253	uint8 b20in80_2x2sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* MCS 8-15 */
2254
2255	uint8 b20in80_1x3dsss[WL_NUM_RATES_CCK];		/* Legacy CCK/DSSS */
2256	uint8 b20in80_1x3cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
2257	uint8 b20in80_1x3cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* 1 Nsts to 3 Tx Chain */
2258	uint8 b20in80_2x3stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
2259	uint8 b20in80_2x3sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* 2 Nsts to 3 Tx Chain */
2260	uint8 b20in80_3x3sdm_mcs16[WL_NUM_RATES_MCS_1STREAM];	/* 3 Nsts to 3 Tx Chain */
2261
2262	uint8 b20in80_1x1vht[WL_NUM_RATES_EXTRA_VHT];		/* VHT8_9SS1 */
2263	uint8 b20in80_1x2cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD1 */
2264	uint8 b20in80_2x2stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC */
2265	uint8 b20in80_2x2sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2 */
2266	uint8 b20in80_1x3cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD2 */
2267	uint8 b20in80_2x3stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC_SPEXP1 */
2268	uint8 b20in80_2x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2_SPEXP1 */
2269	uint8 b20in80_3x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS3 */
2270
2271	/* start of 40in80MHz tx power limits */
2272	uint8 b40in80_dummy1x1dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
2273	uint8 b40in80_1x1ofdm[WL_NUM_RATES_OFDM];		/* Legacy OFDM transmission */
2274	uint8 b40in80_1x1mcs0[WL_NUM_RATES_MCS_1STREAM];	/* SISO MCS 0-7 */
2275
2276	uint8 b40in80_dummy1x2dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
2277	uint8 b40in80_1x2cdd_ofdm[WL_NUM_RATES_OFDM];	/* Legacy OFDM CDD transmission */
2278	uint8 b40in80_1x2cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* CDD MCS 0-7 */
2279	uint8 b40in80_2x2stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
2280	uint8 b40in80_2x2sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* MCS 8-15 */
2281
2282	uint8 b40in80_dummy1x3dsss[WL_NUM_RATES_CCK];	/* Legacy CCK/DSSS */
2283	uint8 b40in80_1x3cdd_ofdm[WL_NUM_RATES_OFDM];	/* MHz Legacy OFDM CDD */
2284	uint8 b40in80_1x3cdd_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* 1 Nsts to 3 Tx Chain */
2285	uint8 b40in80_2x3stbc_mcs0[WL_NUM_RATES_MCS_1STREAM];	/* STBC MCS 0-7 */
2286	uint8 b40in80_2x3sdm_mcs8[WL_NUM_RATES_MCS_1STREAM];	/* 2 Nsts to 3 Tx Chain */
2287	uint8 b40in80_3x3sdm_mcs16[WL_NUM_RATES_MCS_1STREAM];	/* 3 Nsts to 3 Tx Chain */
2288
2289	uint8 b40in80_1x1vht[WL_NUM_RATES_EXTRA_VHT];		/* VHT8_9SS1 */
2290	uint8 b40in80_1x2cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD1 */
2291	uint8 b40in80_2x2stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC */
2292	uint8 b40in80_2x2sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2 */
2293	uint8 b40in80_1x3cdd_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_CDD2 */
2294	uint8 b40in80_2x3stbc_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS1_STBC_SPEXP1 */
2295	uint8 b40in80_2x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS2_SPEXP1 */
2296	uint8 b40in80_3x3sdm_vht[WL_NUM_RATES_EXTRA_VHT];	/* VHT8_9SS3 */
2297
2298	uint8 mcs32; /* C_CHECK - THIS NEEDS TO BE REMOVED THROUGHOUT THE CODE */
2299} txppr_t;
2300
2301/* 20MHz */
2302#define WL_TX_POWER_CCK_FIRST					OFFSETOF(txppr_t, b20_1x1dsss)
2303#define WL_TX_POWER_OFDM20_FIRST				OFFSETOF(txppr_t, b20_1x1ofdm)
2304#define WL_TX_POWER_MCS20_SISO_FIRST			OFFSETOF(txppr_t, b20_1x1mcs0)
2305#define WL_TX_POWER_20_S1x1_FIRST				OFFSETOF(txppr_t, b20_1x1mcs0)
2306
2307#define WL_TX_POWER_CCK_CDD_S1x2_FIRST			OFFSETOF(txppr_t, b20_1x2dsss)
2308#define WL_TX_POWER_OFDM20_CDD_FIRST			OFFSETOF(txppr_t, b20_1x2cdd_ofdm)
2309#define WL_TX_POWER_MCS20_CDD_FIRST				OFFSETOF(txppr_t, b20_1x2cdd_mcs0)
2310#define WL_TX_POWER_20_S1x2_FIRST				OFFSETOF(txppr_t, b20_1x2cdd_mcs0)
2311#define WL_TX_POWER_MCS20_STBC_FIRST			OFFSETOF(txppr_t, b20_2x2stbc_mcs0)
2312#define WL_TX_POWER_MCS20_SDM_FIRST				OFFSETOF(txppr_t, b20_2x2sdm_mcs8)
2313#define WL_TX_POWER_20_S2x2_FIRST				OFFSETOF(txppr_t, b20_2x2sdm_mcs8)
2314
2315#define WL_TX_POWER_CCK_CDD_S1x3_FIRST			OFFSETOF(txppr_t, b20_1x3dsss)
2316#define WL_TX_POWER_OFDM20_CDD_S1x3_FIRST		OFFSETOF(txppr_t, b20_1x3cdd_ofdm)
2317#define WL_TX_POWER_20_S1x3_FIRST				OFFSETOF(txppr_t, b20_1x3cdd_mcs0)
2318#define WL_TX_POWER_20_STBC_S2x3_FIRST			OFFSETOF(txppr_t, b20_2x3stbc_mcs0)
2319#define WL_TX_POWER_20_S2x3_FIRST				OFFSETOF(txppr_t, b20_2x3sdm_mcs8)
2320#define WL_TX_POWER_20_S3x3_FIRST				OFFSETOF(txppr_t, b20_3x3sdm_mcs16)
2321
2322#define WL_TX_POWER_20_S1X1_VHT					OFFSETOF(txppr_t, b20_1x1vht)
2323#define WL_TX_POWER_20_S1X2_CDD_VHT				OFFSETOF(txppr_t, b20_1x2cdd_vht)
2324#define WL_TX_POWER_20_S2X2_STBC_VHT			OFFSETOF(txppr_t, b20_2x2stbc_vht)
2325#define WL_TX_POWER_20_S2X2_VHT					OFFSETOF(txppr_t, b20_2x2sdm_vht)
2326#define WL_TX_POWER_20_S1X3_CDD_VHT				OFFSETOF(txppr_t, b20_1x3cdd_vht)
2327#define WL_TX_POWER_20_S2X3_STBC_VHT			OFFSETOF(txppr_t, b20_2x3stbc_vht)
2328#define WL_TX_POWER_20_S2X3_VHT					OFFSETOF(txppr_t, b20_2x3sdm_vht)
2329#define WL_TX_POWER_20_S3X3_VHT					OFFSETOF(txppr_t, b20_3x3sdm_vht)
2330
2331/* 40MHz */
2332#define WL_TX_POWER_40_DUMMY_CCK_FIRST			OFFSETOF(txppr_t, b40_dummy1x1dsss)
2333#define WL_TX_POWER_OFDM40_FIRST				OFFSETOF(txppr_t, b40_1x1ofdm)
2334#define WL_TX_POWER_MCS40_SISO_FIRST			OFFSETOF(txppr_t, b40_1x1mcs0)
2335#define WL_TX_POWER_40_S1x1_FIRST				OFFSETOF(txppr_t, b40_1x1mcs0)
2336
2337#define WL_TX_POWER_40_DUMMY_CCK_CDD_S1x2_FIRST	OFFSETOF(txppr_t, b40_dummy1x2dsss)
2338#define WL_TX_POWER_OFDM40_CDD_FIRST			OFFSETOF(txppr_t, b40_1x2cdd_ofdm)
2339#define WL_TX_POWER_MCS40_CDD_FIRST				OFFSETOF(txppr_t, b40_1x2cdd_mcs0)
2340#define WL_TX_POWER_40_S1x2_FIRST				OFFSETOF(txppr_t, b40_1x2cdd_mcs0)
2341#define WL_TX_POWER_MCS40_STBC_FIRST			OFFSETOF(txppr_t, b40_2x2stbc_mcs0)
2342#define WL_TX_POWER_MCS40_SDM_FIRST				OFFSETOF(txppr_t, b40_2x2sdm_mcs8)
2343#define WL_TX_POWER_40_S2x2_FIRST				OFFSETOF(txppr_t, b40_2x2sdm_mcs8)
2344
2345#define WL_TX_POWER_40_DUMMY_CCK_CDD_S1x3_FIRST	OFFSETOF(txppr_t, b40_dummy1x3dsss)
2346#define WL_TX_POWER_OFDM40_CDD_S1x3_FIRST		OFFSETOF(txppr_t, b40_1x3cdd_ofdm)
2347#define WL_TX_POWER_40_S1x3_FIRST				OFFSETOF(txppr_t, b40_1x3cdd_mcs0)
2348#define WL_TX_POWER_40_STBC_S2x3_FIRST			OFFSETOF(txppr_t, b40_2x3stbc_mcs0)
2349#define WL_TX_POWER_40_S2x3_FIRST				OFFSETOF(txppr_t, b40_2x3sdm_mcs8)
2350#define WL_TX_POWER_40_S3x3_FIRST				OFFSETOF(txppr_t, b40_3x3sdm_mcs16)
2351
2352#define WL_TX_POWER_40_S1X1_VHT					OFFSETOF(txppr_t, b40_1x1vht)
2353#define WL_TX_POWER_40_S1X2_CDD_VHT				OFFSETOF(txppr_t, b40_1x2cdd_vht)
2354#define WL_TX_POWER_40_S2X2_STBC_VHT			OFFSETOF(txppr_t, b40_2x2stbc_vht)
2355#define WL_TX_POWER_40_S2X2_VHT					OFFSETOF(txppr_t, b40_2x2sdm_vht)
2356#define WL_TX_POWER_40_S1X3_CDD_VHT				OFFSETOF(txppr_t, b40_1x3cdd_vht)
2357#define WL_TX_POWER_40_S2X3_STBC_VHT			OFFSETOF(txppr_t, b40_2x3stbc_vht)
2358#define WL_TX_POWER_40_S2X3_VHT					OFFSETOF(txppr_t, b40_2x3sdm_vht)
2359#define WL_TX_POWER_40_S3X3_VHT					OFFSETOF(txppr_t, b40_3x3sdm_vht)
2360
2361/* 20 in 40MHz */
2362#define WL_TX_POWER_20UL_CCK_FIRST				OFFSETOF(txppr_t, b20in40_1x1dsss)
2363#define WL_TX_POWER_20UL_OFDM_FIRST				OFFSETOF(txppr_t, b20in40_1x1ofdm)
2364#define WL_TX_POWER_20UL_S1x1_FIRST				OFFSETOF(txppr_t, b20in40_1x1mcs0)
2365
2366#define WL_TX_POWER_CCK_20U_CDD_S1x2_FIRST	OFFSETOF(txppr_t, b20in40_1x2dsss)
2367#define WL_TX_POWER_20UL_OFDM_CDD_FIRST		OFFSETOF(txppr_t, b20in40_1x2cdd_ofdm)
2368#define WL_TX_POWER_20UL_S1x2_FIRST			OFFSETOF(txppr_t, b20in40_1x2cdd_mcs0)
2369#define WL_TX_POWER_20UL_STBC_S2x2_FIRST	OFFSETOF(txppr_t, b20in40_2x2stbc_mcs0)
2370#define WL_TX_POWER_20UL_S2x2_FIRST			OFFSETOF(txppr_t, b20in40_2x2sdm_mcs8)
2371
2372#define WL_TX_POWER_CCK_20U_CDD_S1x3_FIRST	OFFSETOF(txppr_t, b20in40_1x3dsss)
2373#define WL_TX_POWER_20UL_OFDM_CDD_S1x3_FIRST OFFSETOF(txppr_t, b20in40_1x3cdd_ofdm)
2374#define WL_TX_POWER_20UL_S1x3_FIRST			OFFSETOF(txppr_t, b20in40_1x3cdd_mcs0)
2375#define WL_TX_POWER_20UL_STBC_S2x3_FIRST	OFFSETOF(txppr_t, b20in40_2x3stbc_mcs0)
2376#define WL_TX_POWER_20UL_S2x3_FIRST			OFFSETOF(txppr_t, b20in40_2x3sdm_mcs8)
2377#define WL_TX_POWER_20UL_S3x3_FIRST			OFFSETOF(txppr_t, b20in40_3x3sdm_mcs16)
2378
2379#define WL_TX_POWER_20UL_S1X1_VHT			OFFSETOF(txppr_t, b20in40_1x1vht)
2380#define WL_TX_POWER_20UL_S1X2_CDD_VHT		OFFSETOF(txppr_t, b20in40_1x2cdd_vht)
2381#define WL_TX_POWER_20UL_S2X2_STBC_VHT		OFFSETOF(txppr_t, b20in40_2x2stbc_vht)
2382#define WL_TX_POWER_20UL_S2X2_VHT			OFFSETOF(txppr_t, b20in40_2x2sdm_vht)
2383#define WL_TX_POWER_20UL_S1X3_CDD_VHT		OFFSETOF(txppr_t, b20in40_1x3cdd_vht)
2384#define WL_TX_POWER_20UL_S2X3_STBC_VHT		OFFSETOF(txppr_t, b20in40_2x3stbc_vht)
2385#define WL_TX_POWER_20UL_S2X3_VHT			OFFSETOF(txppr_t, b20in40_2x3sdm_vht)
2386#define WL_TX_POWER_20UL_S3X3_VHT			OFFSETOF(txppr_t, b20in40_3x3sdm_vht)
2387
2388/* 80MHz */
2389#define WL_TX_POWER_80_DUMMY_CCK_FIRST		OFFSETOF(txppr_t, b80_dummy1x1dsss)
2390#define WL_TX_POWER_OFDM80_FIRST			OFFSETOF(txppr_t, b80_1x1ofdm)
2391#define WL_TX_POWER_MCS80_SISO_FIRST		OFFSETOF(txppr_t, b80_1x1mcs0)
2392#define WL_TX_POWER_80_S1x1_FIRST			OFFSETOF(txppr_t, b80_1x1mcs0)
2393
2394#define WL_TX_POWER_80_DUMMY_CCK_CDD_S1x2_FIRST	OFFSETOF(txppr_t, b80_dummy1x2dsss)
2395#define WL_TX_POWER_OFDM80_CDD_FIRST			OFFSETOF(txppr_t, b80_1x2cdd_ofdm)
2396#define WL_TX_POWER_MCS80_CDD_FIRST				OFFSETOF(txppr_t, b80_1x2cdd_mcs0)
2397#define WL_TX_POWER_80_S1x2_FIRST				OFFSETOF(txppr_t, b80_1x2cdd_mcs0)
2398#define WL_TX_POWER_MCS80_STBC_FIRST			OFFSETOF(txppr_t, b80_2x2stbc_mcs0)
2399#define WL_TX_POWER_MCS80_SDM_FIRST				OFFSETOF(txppr_t, b80_2x2sdm_mcs8)
2400#define WL_TX_POWER_80_S2x2_FIRST				OFFSETOF(txppr_t, b80_2x2sdm_mcs8)
2401
2402#define WL_TX_POWER_80_DUMMY_CCK_CDD_S1x3_FIRST	OFFSETOF(txppr_t, b80_dummy1x3dsss)
2403#define WL_TX_POWER_OFDM80_CDD_S1x3_FIRST		OFFSETOF(txppr_t, b80_1x3cdd_ofdm)
2404#define WL_TX_POWER_80_S1x3_FIRST				OFFSETOF(txppr_t, b80_1x3cdd_mcs0)
2405#define WL_TX_POWER_80_STBC_S2x3_FIRST			OFFSETOF(txppr_t, b80_2x3stbc_mcs0)
2406#define WL_TX_POWER_80_S2x3_FIRST				OFFSETOF(txppr_t, b80_2x3sdm_mcs8)
2407#define WL_TX_POWER_80_S3x3_FIRST				OFFSETOF(txppr_t, b80_3x3sdm_mcs16)
2408
2409#define WL_TX_POWER_80_S1X1_VHT					OFFSETOF(txppr_t, b80_1x1vht)
2410#define WL_TX_POWER_80_S1X2_CDD_VHT				OFFSETOF(txppr_t, b80_1x2cdd_vht)
2411#define WL_TX_POWER_80_S2X2_STBC_VHT			OFFSETOF(txppr_t, b80_2x2stbc_vht)
2412#define WL_TX_POWER_80_S2X2_VHT					OFFSETOF(txppr_t, b80_2x2sdm_vht)
2413#define WL_TX_POWER_80_S1X3_CDD_VHT				OFFSETOF(txppr_t, b80_1x3cdd_vht)
2414#define WL_TX_POWER_80_S2X3_STBC_VHT			OFFSETOF(txppr_t, b80_2x3stbc_vht)
2415#define WL_TX_POWER_80_S2X3_VHT					OFFSETOF(txppr_t, b80_2x3sdm_vht)
2416#define WL_TX_POWER_80_S3X3_VHT					OFFSETOF(txppr_t, b80_3x3sdm_vht)
2417
2418/* 20 in 80MHz */
2419#define WL_TX_POWER_20UUL_CCK_FIRST				OFFSETOF(txppr_t, b20in80_1x1dsss)
2420#define WL_TX_POWER_20UUL_OFDM_FIRST			OFFSETOF(txppr_t, b20in80_1x1ofdm)
2421#define WL_TX_POWER_20UUL_S1x1_FIRST			OFFSETOF(txppr_t, b20in80_1x1mcs0)
2422
2423#define WL_TX_POWER_CCK_20UU_CDD_S1x2_FIRST		OFFSETOF(txppr_t, b20in80_1x2dsss)
2424#define WL_TX_POWER_20UUL_OFDM_CDD_FIRST		OFFSETOF(txppr_t, b20in80_1x2cdd_ofdm)
2425#define WL_TX_POWER_20UUL_S1x2_FIRST			OFFSETOF(txppr_t, b20in80_1x2cdd_mcs0)
2426#define WL_TX_POWER_20UUL_STBC_S2x2_FIRST		OFFSETOF(txppr_t, b20in80_2x2stbc_mcs0)
2427#define WL_TX_POWER_20UUL_S2x2_FIRST			OFFSETOF(txppr_t, b20in80_2x2sdm_mcs8)
2428
2429#define WL_TX_POWER_CCK_20UU_CDD_S1x3_FIRST		OFFSETOF(txppr_t, b20in80_1x3dsss)
2430#define WL_TX_POWER_20UUL_OFDM_CDD_S1x3_FIRST	OFFSETOF(txppr_t, b20in80_1x3cdd_ofdm)
2431#define WL_TX_POWER_20UUL_S1x3_FIRST			OFFSETOF(txppr_t, b20in80_1x3cdd_mcs0)
2432#define WL_TX_POWER_20UUL_STBC_S2x3_FIRST		OFFSETOF(txppr_t, b20in80_2x3stbc_mcs0)
2433#define WL_TX_POWER_20UUL_S2x3_FIRST			OFFSETOF(txppr_t, b20in80_2x3sdm_mcs8)
2434#define WL_TX_POWER_20UUL_S3x3_FIRST			OFFSETOF(txppr_t, b20in80_3x3sdm_mcs16)
2435
2436#define WL_TX_POWER_20UUL_S1X1_VHT			OFFSETOF(txppr_t, b20in80_1x1vht)
2437#define WL_TX_POWER_20UUL_S1X2_CDD_VHT		OFFSETOF(txppr_t, b20in80_1x2cdd_vht)
2438#define WL_TX_POWER_20UUL_S2X2_STBC_VHT		OFFSETOF(txppr_t, b20in80_2x2stbc_vht)
2439#define WL_TX_POWER_20UUL_S2X2_VHT			OFFSETOF(txppr_t, b20in80_2x2sdm_vht)
2440#define WL_TX_POWER_20UUL_S1X3_CDD_VHT		OFFSETOF(txppr_t, b20in80_1x3cdd_vht)
2441#define WL_TX_POWER_20UUL_S2X3_STBC_VHT		OFFSETOF(txppr_t, b20in80_2x3stbc_vht)
2442#define WL_TX_POWER_20UUL_S2X3_VHT			OFFSETOF(txppr_t, b20in80_2x3sdm_vht)
2443#define WL_TX_POWER_20UUL_S3X3_VHT			OFFSETOF(txppr_t, b20in80_3x3sdm_vht)
2444
2445/* 40 in 80MHz */
2446#define WL_TX_POWER_40UUL_DUMMY_CCK_FIRST		OFFSETOF(txppr_t, b40in80_dummy1x1dsss)
2447#define WL_TX_POWER_40UUL_OFDM_FIRST			OFFSETOF(txppr_t, b40in80_1x1ofdm)
2448#define WL_TX_POWER_40UUL_S1x1_FIRST			OFFSETOF(txppr_t, b40in80_1x1mcs0)
2449
2450#define WL_TX_POWER_CCK_40UU_DUMMY_CDD_S1x2_FIRST OFFSETOF(txppr_t, b40in80_dummy1x2dsss)
2451#define WL_TX_POWER_40UUL_OFDM_CDD_FIRST		OFFSETOF(txppr_t, b40in80_1x2cdd_ofdm)
2452#define WL_TX_POWER_40UUL_S1x2_FIRST			OFFSETOF(txppr_t, b40in80_1x2cdd_mcs0)
2453#define WL_TX_POWER_40UUL_STBC_S2x2_FIRST		OFFSETOF(txppr_t, b40in80_2x2stbc_mcs0)
2454#define WL_TX_POWER_40UUL_S2x2_FIRST			OFFSETOF(txppr_t, b40in80_2x2sdm_mcs8)
2455
2456#define WL_TX_POWER_CCK_40UU_DUMMY_CDD_S1x3_FIRST OFFSETOF(txppr_t, b40in80_dummy1x3dsss)
2457#define WL_TX_POWER_40UUL_OFDM_CDD_S1x3_FIRST	OFFSETOF(txppr_t, b40in80_1x3cdd_ofdm)
2458#define WL_TX_POWER_40UUL_S1x3_FIRST			OFFSETOF(txppr_t, b40in80_1x3cdd_mcs0)
2459#define WL_TX_POWER_40UUL_STBC_S2x3_FIRST		OFFSETOF(txppr_t, b40in80_2x3stbc_mcs0)
2460#define WL_TX_POWER_40UUL_S2x3_FIRST			OFFSETOF(txppr_t, b40in80_2x3sdm_mcs8)
2461#define WL_TX_POWER_40UUL_S3x3_FIRST			OFFSETOF(txppr_t, b40in80_3x3sdm_mcs16)
2462
2463#define WL_TX_POWER_40UUL_S1X1_VHT			OFFSETOF(txppr_t, b40in80_1x1vht)
2464#define WL_TX_POWER_40UUL_S1X2_CDD_VHT		OFFSETOF(txppr_t, b40in80_1x2cdd_vht)
2465#define WL_TX_POWER_40UUL_S2X2_STBC_VHT		OFFSETOF(txppr_t, b40in80_2x2stbc_vht)
2466#define WL_TX_POWER_40UUL_S2X2_VHT			OFFSETOF(txppr_t, b40in80_2x2sdm_vht)
2467#define WL_TX_POWER_40UUL_S1X3_CDD_VHT		OFFSETOF(txppr_t, b40in80_1x3cdd_vht)
2468#define WL_TX_POWER_40UUL_S2X3_STBC_VHT		OFFSETOF(txppr_t, b40in80_2x3stbc_vht)
2469#define WL_TX_POWER_40UUL_S2X3_VHT			OFFSETOF(txppr_t, b40in80_2x3sdm_vht)
2470#define WL_TX_POWER_40UUL_S3X3_VHT			OFFSETOF(txppr_t, b40in80_3x3sdm_vht)
2471
2472#define WL_TX_POWER_MCS_32			OFFSETOF(txppr_t, mcs32) /* C_CHECK remove later */
2473
2474#define WL_TX_POWER_RATES			sizeof(struct txppr)
2475
2476/* sslpnphy specifics */
2477#define WL_TX_POWER_MCS20_SISO_FIRST_SSN	WL_TX_POWER_MCS20_SISO_FIRST
2478#define WL_TX_POWER_MCS40_SISO_FIRST_SSN	WL_TX_POWER_MCS40_SISO_FIRST
2479
2480/* tx_power_t.flags bits */
2481#define WL_TX_POWER_F_ENABLED	1
2482#define WL_TX_POWER_F_HW	2
2483#define WL_TX_POWER_F_MIMO	4
2484#define WL_TX_POWER_F_SISO	8
2485#define WL_TX_POWER_F_HT	0x10
2486
2487typedef struct {
2488	uint16 ver;				/* version of this struct */
2489	uint16 len;				/* length in bytes of this structure */
2490	uint32 flags;
2491	chanspec_t chanspec;			/* txpwr report for this channel */
2492	chanspec_t local_chanspec;		/* channel on which we are associated */
2493	uint8 ppr[WL_TX_POWER_RATES];		/* Latest target power */
2494} wl_txppr_t;
2495
2496#define WL_TXPPR_VERSION	0
2497#define WL_TXPPR_LENGTH	(sizeof(wl_txppr_t))
2498#define TX_POWER_T_VERSION	43
2499
2500/* Defines used with channel_bandwidth for curpower */
2501#define WL_BW_20MHZ 		0
2502#define WL_BW_40MHZ 		1
2503#define WL_BW_80MHZ 		2
2504
2505/* tx_power_t.flags bits */
2506#ifdef PPR_API
2507#define WL_TX_POWER2_F_ENABLED	1
2508#define WL_TX_POWER2_F_HW		2
2509#define WL_TX_POWER2_F_MIMO		4
2510#define WL_TX_POWER2_F_SISO		8
2511#define WL_TX_POWER2_F_HT		0x10
2512#else
2513#define WL_TX_POWER_F_ENABLED	1
2514#define WL_TX_POWER_F_HW		2
2515#define WL_TX_POWER_F_MIMO		4
2516#define WL_TX_POWER_F_SISO		8
2517#define WL_TX_POWER_F_HT		0x10
2518#endif
2519typedef struct {
2520	uint32 flags;
2521	chanspec_t chanspec;			/* txpwr report for this channel */
2522	chanspec_t local_chanspec;		/* channel on which we are associated */
2523	uint8 local_max;			/* local max according to the AP */
2524	uint8 local_constraint;			/* local constraint according to the AP */
2525	int8  antgain[2];			/* Ant gain for each band - from SROM */
2526	uint8 rf_cores;				/* count of RF Cores being reported */
2527	uint8 est_Pout[4];			/* Latest tx power out estimate per RF chain */
2528	uint8 est_Pout_act[4];		/* Latest tx power out estimate per RF chain
2529	* without adjustment
2530	*/
2531	uint8 est_Pout_cck;			/* Latest CCK tx power out estimate */
2532	uint8 tx_power_max[4];		/* Maximum target power among all rates */
2533	uint tx_power_max_rate_ind[4];		/* Index of the rate with the max target power */
2534	uint8 user_limit[WL_TX_POWER_RATES];	/* User limit */
2535	int8 board_limit[WL_TX_POWER_RATES];	/* Max power board can support (SROM) */
2536	int8 target[WL_TX_POWER_RATES];			/* Latest target power */
2537	int8 clm_limits[WL_NUMRATES];		/* regulatory limits - 20, 40 or 80MHz */
2538	int8 clm_limits_subchan1[WL_NUMRATES];	/* regulatory limits - 20in40 or 40in80 */
2539	int8 clm_limits_subchan2[WL_NUMRATES];	/* regulatory limits - 20in80MHz */
2540	int8 sar;					/* SAR limit for display by wl executable */
2541	int8 channel_bandwidth;		/* 20, 40 or 80 MHz bandwidth? */
2542	uint8 version;				/* Version of the data format wlu <--> driver */
2543	uint8 display_core;			/* Displayed curpower core */
2544#ifdef PPR_API
2545} tx_power_new_t;
2546#else
2547} tx_power_t;
2548#endif
2549
2550typedef struct tx_inst_power {
2551	uint8 txpwr_est_Pout[2];			/* Latest estimate for 2.4 and 5 Ghz */
2552	uint8 txpwr_est_Pout_gofdm;			/* Pwr estimate for 2.4 OFDM */
2553} tx_inst_power_t;
2554
2555
2556typedef struct {
2557	uint32 flags;
2558	chanspec_t chanspec;			/* txpwr report for this channel */
2559	chanspec_t local_chanspec;		/* channel on which we are associated */
2560	uint8 local_max;			/* local max according to the AP */
2561	uint8 local_constraint;			/* local constraint according to the AP */
2562	int8  antgain[2];			/* Ant gain for each band - from SROM */
2563	uint8 rf_cores;				/* count of RF Cores being reported */
2564	uint8 est_Pout[4];			/* Latest tx power out estimate per RF chain */
2565	uint8 est_Pout_act[4];                  /* Latest tx power out estimate per RF chain
2566						 * without adjustment
2567						 */
2568	uint8 est_Pout_cck;			/* Latest CCK tx power out estimate */
2569	uint8 tx_power_max[4];                  /* Maximum target power among all rates */
2570	uint tx_power_max_rate_ind[4];         /* Index of the rate with the max target power */
2571	txppr_t user_limit;			/* User limit */
2572	txppr_t reg_limit;			/* Regulatory power limit */
2573	txppr_t board_limit;			/* Max power board can support (SROM) */
2574	txppr_t target;				/* Latest target power */
2575} wl_txpwr_t;
2576
2577#define WL_NUM_TXCHAIN_MAX	4
2578typedef struct wl_txchain_pwr_offsets {
2579	int8 offset[WL_NUM_TXCHAIN_MAX];	/* quarter dBm signed offset for each chain */
2580} wl_txchain_pwr_offsets_t;
2581
2582/* 802.11h measurement types */
2583#define WLC_MEASURE_TPC			1
2584#define WLC_MEASURE_CHANNEL_BASIC	2
2585#define WLC_MEASURE_CHANNEL_CCA		3
2586#define WLC_MEASURE_CHANNEL_RPI		4
2587
2588/* regulatory enforcement levels */
2589#define SPECT_MNGMT_OFF			0		/* both 11h and 11d disabled */
2590#define SPECT_MNGMT_LOOSE_11H		1		/* allow non-11h APs in scan lists */
2591#define SPECT_MNGMT_STRICT_11H		2		/* prune out non-11h APs from scan list */
2592#define SPECT_MNGMT_STRICT_11D		3		/* switch to 802.11D mode */
2593/* SPECT_MNGMT_LOOSE_11H_D - same as SPECT_MNGMT_LOOSE with the exception that Country IE
2594 * adoption is done regardless of capability spectrum_management
2595 */
2596#define SPECT_MNGMT_LOOSE_11H_D		4		/* operation defined above */
2597
2598#define WL_CHAN_VALID_HW	(1 << 0)	/* valid with current HW */
2599#define WL_CHAN_VALID_SW	(1 << 1)	/* valid with current country setting */
2600#define WL_CHAN_BAND_5G		(1 << 2)	/* 5GHz-band channel */
2601#define WL_CHAN_RADAR		(1 << 3)	/* radar sensitive  channel */
2602#define WL_CHAN_INACTIVE	(1 << 4)	/* temporarily inactive due to radar */
2603#define WL_CHAN_PASSIVE		(1 << 5)	/* channel is in passive mode */
2604#define WL_CHAN_RESTRICTED	(1 << 6)	/* restricted use channel */
2605
2606/* BTC mode used by "btc_mode" iovar */
2607#define	WL_BTC_DISABLE		0	/* disable BT coexistence */
2608#define WL_BTC_FULLTDM      1	/* full TDM COEX */
2609#define WL_BTC_ENABLE       1	/* full TDM COEX to maintain backward compatiblity */
2610#define WL_BTC_PREMPT      2    /* full TDM COEX with preemption */
2611#define WL_BTC_LITE        3	/* light weight coex for large isolation platform */
2612#define WL_BTC_PARALLEL		4   /* BT and WLAN run in parallel with separate antenna  */
2613#define WL_BTC_HYBRID		5   /* hybrid coex, only ack is allowed to transmit in BT slot */
2614#define WL_BTC_DEFAULT		8	/* set the default mode for the device */
2615#define WL_INF_BTC_DISABLE      0
2616#define WL_INF_BTC_ENABLE       1
2617#define WL_INF_BTC_AUTO         3
2618
2619/* BTC wire used by "btc_wire" iovar */
2620#define	WL_BTC_DEFWIRE		0	/* use default wire setting */
2621#define WL_BTC_2WIRE		2	/* use 2-wire BTC */
2622#define WL_BTC_3WIRE		3	/* use 3-wire BTC */
2623#define WL_BTC_4WIRE		4	/* use 4-wire BTC */
2624
2625/* BTC flags: BTC configuration that can be set by host */
2626#define WL_BTC_FLAG_PREMPT               (1 << 0)
2627#define WL_BTC_FLAG_BT_DEF               (1 << 1)
2628#define WL_BTC_FLAG_ACTIVE_PROT          (1 << 2)
2629#define WL_BTC_FLAG_SIM_RSP              (1 << 3)
2630#define WL_BTC_FLAG_PS_PROTECT           (1 << 4)
2631#define WL_BTC_FLAG_SIM_TX_LP	         (1 << 5)
2632#define WL_BTC_FLAG_ECI                  (1 << 6)
2633#define WL_BTC_FLAG_LIGHT                (1 << 7)
2634#define WL_BTC_FLAG_PARALLEL             (1 << 8)
2635#endif /* !defined(LINUX_POSTMOGRIFY_REMOVAL) */
2636
2637/* Message levels */
2638#define WL_ERROR_VAL		0x00000001
2639#define WL_TRACE_VAL		0x00000002
2640#define WL_PRHDRS_VAL		0x00000004
2641#define WL_PRPKT_VAL		0x00000008
2642#define WL_INFORM_VAL		0x00000010
2643#define WL_TMP_VAL		0x00000020
2644#define WL_OID_VAL		0x00000040
2645#define WL_RATE_VAL		0x00000080
2646#define WL_ASSOC_VAL		0x00000100
2647#define WL_PRUSR_VAL		0x00000200
2648#define WL_PS_VAL		0x00000400
2649#define WL_TXPWR_VAL		0x00000800	/* retired in TOT on 6/10/2009 */
2650#define WL_PORT_VAL		0x00001000
2651#define WL_DUAL_VAL		0x00002000
2652#define WL_WSEC_VAL		0x00004000
2653#define WL_WSEC_DUMP_VAL	0x00008000
2654#define WL_LOG_VAL		0x00010000
2655#define WL_NRSSI_VAL		0x00020000	/* retired in TOT on 6/10/2009 */
2656#define WL_LOFT_VAL		0x00040000	/* retired in TOT on 6/10/2009 */
2657#define WL_REGULATORY_VAL	0x00080000
2658#define WL_PHYCAL_VAL		0x00100000	/* retired in TOT on 6/10/2009 */
2659#define WL_RADAR_VAL		0x00200000	/* retired in TOT on 6/10/2009 */
2660#define WL_MPC_VAL		0x00400000
2661#define WL_APSTA_VAL		0x00800000
2662#define WL_DFS_VAL		0x01000000
2663#define WL_BA_VAL		0x02000000	/* retired in TOT on 6/14/2010 */
2664#define WL_ACI_VAL		0x04000000
2665#define WL_MBSS_VAL		0x04000000
2666#define WL_CAC_VAL		0x08000000
2667#define WL_AMSDU_VAL		0x10000000
2668#define WL_AMPDU_VAL		0x20000000
2669#define WL_FFPLD_VAL		0x40000000
2670
2671/* wl_msg_level is full. For new bits take the next one and AND with
2672 * wl_msg_level2 in wl_dbg.h
2673 */
2674#define WL_DPT_VAL 		0x00000001
2675#define WL_SCAN_VAL		0x00000002
2676#define WL_WOWL_VAL		0x00000004
2677#define WL_COEX_VAL		0x00000008
2678#define WL_RTDC_VAL		0x00000010
2679#define WL_PROTO_VAL		0x00000020
2680#define WL_BTA_VAL		0x00000040
2681#define WL_CHANINT_VAL		0x00000080
2682#define WL_THERMAL_VAL		0x00000100	/* retired in TOT on 6/10/2009 */
2683#define WL_P2P_VAL		0x00000200
2684#define WL_ITFR_VAL		0x00000400
2685#define WL_MCHAN_VAL		0x00000800
2686#define WL_TDLS_VAL		0x00001000
2687#define WL_MCNX_VAL		0x00002000
2688#define WL_PROT_VAL		0x00004000
2689#define WL_PSTA_VAL		0x00008000
2690#define WL_TBTT_VAL		0x00010000
2691#define WL_NIC_VAL		0x00020000
2692/* use top-bit for WL_TIME_STAMP_VAL because this is a modifier
2693 * rather than a message-type of its own
2694 */
2695#define WL_TIMESTAMP_VAL        0x80000000
2696
2697/* max # of leds supported by GPIO (gpio pin# == led index#) */
2698#define	WL_LED_NUMGPIO		32	/* gpio 0-31 */
2699
2700/* led per-pin behaviors */
2701#define	WL_LED_OFF		0		/* always off */
2702#define	WL_LED_ON		1		/* always on */
2703#define	WL_LED_ACTIVITY		2		/* activity */
2704#define	WL_LED_RADIO		3		/* radio enabled */
2705#define	WL_LED_ARADIO		4		/* 5  Ghz radio enabled */
2706#define	WL_LED_BRADIO		5		/* 2.4Ghz radio enabled */
2707#define	WL_LED_BGMODE		6		/* on if gmode, off if bmode */
2708#define	WL_LED_WI1		7
2709#define	WL_LED_WI2		8
2710#define	WL_LED_WI3		9
2711#define	WL_LED_ASSOC		10		/* associated state indicator */
2712#define	WL_LED_INACTIVE		11		/* null behavior (clears default behavior) */
2713#define	WL_LED_ASSOCACT		12		/* on when associated; blink fast for activity */
2714#define WL_LED_WI4		13
2715#define WL_LED_WI5		14
2716#define	WL_LED_BLINKSLOW	15		/* blink slow */
2717#define	WL_LED_BLINKMED		16		/* blink med */
2718#define	WL_LED_BLINKFAST	17		/* blink fast */
2719#define	WL_LED_BLINKCUSTOM	18		/* blink custom */
2720#define	WL_LED_BLINKPERIODIC	19		/* blink periodic (custom 1000ms / off 400ms) */
2721#define WL_LED_ASSOC_WITH_SEC 	20		/* when connected with security */
2722						/* keep on for 300 sec */
2723#define WL_LED_START_OFF 	21		/* off upon boot, could be turned on later */
2724#define	WL_LED_NUMBEHAVIOR	22
2725
2726/* led behavior numeric value format */
2727#define	WL_LED_BEH_MASK		0x7f		/* behavior mask */
2728#define	WL_LED_AL_MASK		0x80		/* activelow (polarity) bit */
2729
2730/* maximum channels returned by the get valid channels iovar */
2731#define WL_NUMCHANNELS		64
2732
2733/* max number of chanspecs (used by the iovar to calc. buf space) */
2734#define WL_NUMCHANSPECS 110
2735
2736/* WDS link local endpoint WPA role */
2737#define WL_WDS_WPA_ROLE_AUTH	0	/* authenticator */
2738#define WL_WDS_WPA_ROLE_SUP	1	/* supplicant */
2739#define WL_WDS_WPA_ROLE_AUTO	255	/* auto, based on mac addr value */
2740
2741/* number of bytes needed to define a 128-bit mask for MAC event reporting */
2742#define WL_EVENTING_MASK_LEN	16
2743
2744/*
2745 * Join preference iovar value is an array of tuples. Each tuple has a one-byte type,
2746 * a one-byte length, and a variable length value.  RSSI type tuple must be present
2747 * in the array.
2748 *
2749 * Types are defined in "join preference types" section.
2750 *
2751 * Length is the value size in octets. It is reserved for WL_JOIN_PREF_WPA type tuple
2752 * and must be set to zero.
2753 *
2754 * Values are defined below.
2755 *
2756 * 1. RSSI - 2 octets
2757 * offset 0: reserved
2758 * offset 1: reserved
2759 *
2760 * 2. WPA - 2 + 12 * n octets (n is # tuples defined below)
2761 * offset 0: reserved
2762 * offset 1: # of tuples
2763 * offset 2: tuple 1
2764 * offset 14: tuple 2
2765 * ...
2766 * offset 2 + 12 * (n - 1) octets: tuple n
2767 *
2768 * struct wpa_cfg_tuple {
2769 *   uint8 akm[DOT11_OUI_LEN+1];     akm suite
2770 *   uint8 ucipher[DOT11_OUI_LEN+1]; unicast cipher suite
2771 *   uint8 mcipher[DOT11_OUI_LEN+1]; multicast cipher suite
2772 * };
2773 *
2774 * multicast cipher suite can be specified as a specific cipher suite or WL_WPA_ACP_MCS_ANY.
2775 *
2776 * 3. BAND - 2 octets
2777 * offset 0: reserved
2778 * offset 1: see "band preference" and "band types"
2779 *
2780 * 4. BAND RSSI - 2 octets
2781 * offset 0: band types
2782 * offset 1: +ve RSSI boost balue in dB
2783 */
2784
2785/* join preference types */
2786#define WL_JOIN_PREF_RSSI	1	/* by RSSI */
2787#define WL_JOIN_PREF_WPA	2	/* by akm and ciphers */
2788#define WL_JOIN_PREF_BAND	3	/* by 802.11 band */
2789#define WL_JOIN_PREF_RSSI_DELTA	4	/* by 802.11 band only if RSSI delta condition matches */
2790#define WL_JOIN_PREF_TRANS_PREF	5	/* defined by requesting AP */
2791
2792/* band preference */
2793#define WLJP_BAND_ASSOC_PREF	255	/* use what WLC_SET_ASSOC_PREFER ioctl specifies */
2794
2795/* any multicast cipher suite */
2796#define WL_WPA_ACP_MCS_ANY	"\x00\x00\x00\x00"
2797
2798struct tsinfo_arg {
2799	uint8 octets[3];
2800};
2801
2802#define	NFIFO			6	/* # tx/rx fifopairs */
2803
2804#define	WL_CNT_T_VERSION	8	/* current version of wl_cnt_t struct */
2805
2806typedef struct {
2807	uint16	version;	/* see definition of WL_CNT_T_VERSION */
2808	uint16	length;		/* length of entire structure */
2809
2810	/* transmit stat counters */
2811	uint32	txframe;	/* tx data frames */
2812	uint32	txbyte;		/* tx data bytes */
2813	uint32	txretrans;	/* tx mac retransmits */
2814	uint32	txerror;	/* tx data errors (derived: sum of others) */
2815	uint32	txctl;		/* tx management frames */
2816	uint32	txprshort;	/* tx short preamble frames */
2817	uint32	txserr;		/* tx status errors */
2818	uint32	txnobuf;	/* tx out of buffers errors */
2819	uint32	txnoassoc;	/* tx discard because we're not associated */
2820	uint32	txrunt;		/* tx runt frames */
2821	uint32	txchit;		/* tx header cache hit (fastpath) */
2822	uint32	txcmiss;	/* tx header cache miss (slowpath) */
2823
2824	/* transmit chip error counters */
2825	uint32	txuflo;		/* tx fifo underflows */
2826	uint32	txphyerr;	/* tx phy errors (indicated in tx status) */
2827	uint32	txphycrs;
2828
2829	/* receive stat counters */
2830	uint32	rxframe;	/* rx data frames */
2831	uint32	rxbyte;		/* rx data bytes */
2832	uint32	rxerror;	/* rx data errors (derived: sum of others) */
2833	uint32	rxctl;		/* rx management frames */
2834	uint32	rxnobuf;	/* rx out of buffers errors */
2835	uint32	rxnondata;	/* rx non data frames in the data channel errors */
2836	uint32	rxbadds;	/* rx bad DS errors */
2837	uint32	rxbadcm;	/* rx bad control or management frames */
2838	uint32	rxfragerr;	/* rx fragmentation errors */
2839	uint32	rxrunt;		/* rx runt frames */
2840	uint32	rxgiant;	/* rx giant frames */
2841	uint32	rxnoscb;	/* rx no scb error */
2842	uint32	rxbadproto;	/* rx invalid frames */
2843	uint32	rxbadsrcmac;	/* rx frames with Invalid Src Mac */
2844	uint32	rxbadda;	/* rx frames tossed for invalid da */
2845	uint32	rxfilter;	/* rx frames filtered out */
2846
2847	/* receive chip error counters */
2848	uint32	rxoflo;		/* rx fifo overflow errors */
2849	uint32	rxuflo[NFIFO];	/* rx dma descriptor underflow errors */
2850
2851	uint32	d11cnt_txrts_off;	/* d11cnt txrts value when reset d11cnt */
2852	uint32	d11cnt_rxcrc_off;	/* d11cnt rxcrc value when reset d11cnt */
2853	uint32	d11cnt_txnocts_off;	/* d11cnt txnocts value when reset d11cnt */
2854
2855	/* misc counters */
2856	uint32	dmade;		/* tx/rx dma descriptor errors */
2857	uint32	dmada;		/* tx/rx dma data errors */
2858	uint32	dmape;		/* tx/rx dma descriptor protocol errors */
2859	uint32	reset;		/* reset count */
2860	uint32	tbtt;		/* cnts the TBTT int's */
2861	uint32	txdmawar;
2862	uint32	pkt_callback_reg_fail;	/* callbacks register failure */
2863
2864	/* MAC counters: 32-bit version of d11.h's macstat_t */
2865	uint32	txallfrm;	/* total number of frames sent, incl. Data, ACK, RTS, CTS,
2866				 * Control Management (includes retransmissions)
2867				 */
2868	uint32	txrtsfrm;	/* number of RTS sent out by the MAC */
2869	uint32	txctsfrm;	/* number of CTS sent out by the MAC */
2870	uint32	txackfrm;	/* number of ACK frames sent out */
2871	uint32	txdnlfrm;	/* Not used */
2872	uint32	txbcnfrm;	/* beacons transmitted */
2873	uint32	txfunfl[8];	/* per-fifo tx underflows */
2874	uint32	txtplunfl;	/* Template underflows (mac was too slow to transmit ACK/CTS
2875				 * or BCN)
2876				 */
2877	uint32	txphyerror;	/* Transmit phy error, type of error is reported in tx-status for
2878				 * driver enqueued frames
2879				 */
2880	uint32	rxfrmtoolong;	/* Received frame longer than legal limit (2346 bytes) */
2881	uint32	rxfrmtooshrt;	/* Received frame did not contain enough bytes for its frame type */
2882	uint32	rxinvmachdr;	/* Either the protocol version != 0 or frame type not
2883				 * data/control/management
2884				 */
2885	uint32	rxbadfcs;	/* number of frames for which the CRC check failed in the MAC */
2886	uint32	rxbadplcp;	/* parity check of the PLCP header failed */
2887	uint32	rxcrsglitch;	/* PHY was able to correlate the preamble but not the header */
2888	uint32	rxstrt;		/* Number of received frames with a good PLCP
2889				 * (i.e. passing parity check)
2890				 */
2891	uint32	rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */
2892	uint32	rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
2893	uint32	rxcfrmucast;	/* number of received CNTRL frames with good FCS and matching RA */
2894	uint32	rxrtsucast;	/* number of unicast RTS addressed to the MAC (good FCS) */
2895	uint32	rxctsucast;	/* number of unicast CTS addressed to the MAC (good FCS) */
2896	uint32	rxackucast;	/* number of ucast ACKS received (good FCS) */
2897	uint32	rxdfrmocast;	/* number of received DATA frames (good FCS and not matching RA) */
2898	uint32	rxmfrmocast;	/* number of received MGMT frames (good FCS and not matching RA) */
2899	uint32	rxcfrmocast;	/* number of received CNTRL frame (good FCS and not matching RA) */
2900	uint32	rxrtsocast;	/* number of received RTS not addressed to the MAC */
2901	uint32	rxctsocast;	/* number of received CTS not addressed to the MAC */
2902	uint32	rxdfrmmcast;	/* number of RX Data multicast frames received by the MAC */
2903	uint32	rxmfrmmcast;	/* number of RX Management multicast frames received by the MAC */
2904	uint32	rxcfrmmcast;	/* number of RX Control multicast frames received by the MAC
2905				 * (unlikely to see these)
2906				 */
2907	uint32	rxbeaconmbss;	/* beacons received from member of BSS */
2908	uint32	rxdfrmucastobss; /* number of unicast frames addressed to the MAC from
2909				  * other BSS (WDS FRAME)
2910				  */
2911	uint32	rxbeaconobss;	/* beacons received from other BSS */
2912	uint32	rxrsptmout;	/* Number of response timeouts for transmitted frames
2913				 * expecting a response
2914				 */
2915	uint32	bcntxcancl;	/* transmit beacons canceled due to receipt of beacon (IBSS) */
2916	uint32	rxf0ovfl;	/* Number of receive fifo 0 overflows */
2917	uint32	rxf1ovfl;	/* Number of receive fifo 1 overflows (obsolete) */
2918	uint32	rxf2ovfl;	/* Number of receive fifo 2 overflows (obsolete) */
2919	uint32	txsfovfl;	/* Number of transmit status fifo overflows (obsolete) */
2920	uint32	pmqovfl;	/* Number of PMQ overflows */
2921	uint32	rxcgprqfrm;	/* Number of received Probe requests that made it into
2922				 * the PRQ fifo
2923				 */
2924	uint32	rxcgprsqovfl;	/* Rx Probe Request Que overflow in the AP */
2925	uint32	txcgprsfail;	/* Tx Probe Response Fail. AP sent probe response but did
2926				 * not get ACK
2927				 */
2928	uint32	txcgprssuc;	/* Tx Probe Response Success (ACK was received) */
2929	uint32	prs_timeout;	/* Number of probe requests that were dropped from the PRQ
2930				 * fifo because a probe response could not be sent out within
2931				 * the time limit defined in M_PRS_MAXTIME
2932				 */
2933	uint32	rxnack;		/* obsolete */
2934	uint32	frmscons;	/* obsolete */
2935	uint32	txnack;		/* obsolete */
2936	uint32	txglitch_nack;	/* obsolete */
2937	uint32	txburst;	/* obsolete */
2938
2939	/* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
2940	uint32	txfrag;		/* dot11TransmittedFragmentCount */
2941	uint32	txmulti;	/* dot11MulticastTransmittedFrameCount */
2942	uint32	txfail;		/* dot11FailedCount */
2943	uint32	txretry;	/* dot11RetryCount */
2944	uint32	txretrie;	/* dot11MultipleRetryCount */
2945	uint32	rxdup;		/* dot11FrameduplicateCount */
2946	uint32	txrts;		/* dot11RTSSuccessCount */
2947	uint32	txnocts;	/* dot11RTSFailureCount */
2948	uint32	txnoack;	/* dot11ACKFailureCount */
2949	uint32	rxfrag;		/* dot11ReceivedFragmentCount */
2950	uint32	rxmulti;	/* dot11MulticastReceivedFrameCount */
2951	uint32	rxcrc;		/* dot11FCSErrorCount */
2952	uint32	txfrmsnt;	/* dot11TransmittedFrameCount (bogus MIB?) */
2953	uint32	rxundec;	/* dot11WEPUndecryptableCount */
2954
2955	/* WPA2 counters (see rxundec for DecryptFailureCount) */
2956	uint32	tkipmicfaill;	/* TKIPLocalMICFailures */
2957	uint32	tkipcntrmsr;	/* TKIPCounterMeasuresInvoked */
2958	uint32	tkipreplay;	/* TKIPReplays */
2959	uint32	ccmpfmterr;	/* CCMPFormatErrors */
2960	uint32	ccmpreplay;	/* CCMPReplays */
2961	uint32	ccmpundec;	/* CCMPDecryptErrors */
2962	uint32	fourwayfail;	/* FourWayHandshakeFailures */
2963	uint32	wepundec;	/* dot11WEPUndecryptableCount */
2964	uint32	wepicverr;	/* dot11WEPICVErrorCount */
2965	uint32	decsuccess;	/* DecryptSuccessCount */
2966	uint32	tkipicverr;	/* TKIPICVErrorCount */
2967	uint32	wepexcluded;	/* dot11WEPExcludedCount */
2968
2969	uint32	txchanrej;	/* Tx frames suppressed due to channel rejection */
2970	uint32	psmwds;		/* Count PSM watchdogs */
2971	uint32	phywatchdog;	/* Count Phy watchdogs (triggered by ucode) */
2972
2973	/* MBSS counters, AP only */
2974	uint32	prq_entries_handled;	/* PRQ entries read in */
2975	uint32	prq_undirected_entries;	/*    which were bcast bss & ssid */
2976	uint32	prq_bad_entries;	/*    which could not be translated to info */
2977	uint32	atim_suppress_count;	/* TX suppressions on ATIM fifo */
2978	uint32	bcn_template_not_ready;	/* Template marked in use on send bcn ... */
2979	uint32	bcn_template_not_ready_done; /* ...but "DMA done" interrupt rcvd */
2980	uint32	late_tbtt_dpc;	/* TBTT DPC did not happen in time */
2981
2982	/* per-rate receive stat counters */
2983	uint32  rx1mbps;	/* packets rx at 1Mbps */
2984	uint32  rx2mbps;	/* packets rx at 2Mbps */
2985	uint32  rx5mbps5;	/* packets rx at 5.5Mbps */
2986	uint32  rx6mbps;	/* packets rx at 6Mbps */
2987	uint32  rx9mbps;	/* packets rx at 9Mbps */
2988	uint32  rx11mbps;	/* packets rx at 11Mbps */
2989	uint32  rx12mbps;	/* packets rx at 12Mbps */
2990	uint32  rx18mbps;	/* packets rx at 18Mbps */
2991	uint32  rx24mbps;	/* packets rx at 24Mbps */
2992	uint32  rx36mbps;	/* packets rx at 36Mbps */
2993	uint32  rx48mbps;	/* packets rx at 48Mbps */
2994	uint32  rx54mbps;	/* packets rx at 54Mbps */
2995	uint32  rx108mbps; 	/* packets rx at 108mbps */
2996	uint32  rx162mbps;	/* packets rx at 162mbps */
2997	uint32  rx216mbps;	/* packets rx at 216 mbps */
2998	uint32  rx270mbps;	/* packets rx at 270 mbps */
2999	uint32  rx324mbps;	/* packets rx at 324 mbps */
3000	uint32  rx378mbps;	/* packets rx at 378 mbps */
3001	uint32  rx432mbps;	/* packets rx at 432 mbps */
3002	uint32  rx486mbps;	/* packets rx at 486 mbps */
3003	uint32  rx540mbps;	/* packets rx at 540 mbps */
3004
3005	/* pkteng rx frame stats */
3006	uint32	pktengrxducast; /* unicast frames rxed by the pkteng code */
3007	uint32	pktengrxdmcast; /* multicast frames rxed by the pkteng code */
3008
3009	uint32	rfdisable;	/* count of radio disables */
3010	uint32	bphy_rxcrsglitch;	/* PHY count of bphy glitches */
3011
3012	uint32	txexptime;	/* Tx frames suppressed due to timer expiration */
3013
3014	uint32	txmpdu_sgi;	/* count for sgi transmit */
3015	uint32	rxmpdu_sgi;	/* count for sgi received */
3016	uint32	txmpdu_stbc;	/* count for stbc transmit */
3017	uint32	rxmpdu_stbc;	/* count for stbc received */
3018
3019	uint32	rxundec_mcst;	/* dot11WEPUndecryptableCount */
3020
3021	/* WPA2 counters (see rxundec for DecryptFailureCount) */
3022	uint32	tkipmicfaill_mcst;	/* TKIPLocalMICFailures */
3023	uint32	tkipcntrmsr_mcst;	/* TKIPCounterMeasuresInvoked */
3024	uint32	tkipreplay_mcst;	/* TKIPReplays */
3025	uint32	ccmpfmterr_mcst;	/* CCMPFormatErrors */
3026	uint32	ccmpreplay_mcst;	/* CCMPReplays */
3027	uint32	ccmpundec_mcst;	/* CCMPDecryptErrors */
3028	uint32	fourwayfail_mcst;	/* FourWayHandshakeFailures */
3029	uint32	wepundec_mcst;	/* dot11WEPUndecryptableCount */
3030	uint32	wepicverr_mcst;	/* dot11WEPICVErrorCount */
3031	uint32	decsuccess_mcst;	/* DecryptSuccessCount */
3032	uint32	tkipicverr_mcst;	/* TKIPICVErrorCount */
3033	uint32	wepexcluded_mcst;	/* dot11WEPExcludedCount */
3034
3035	uint32	dma_hang;	/* count for dma hang */
3036	uint32	reinit;		/* count for reinit */
3037
3038	uint32  pstatxucast;	/* count of ucast frames xmitted on all psta assoc */
3039	uint32  pstatxnoassoc;	/* count of txnoassoc frames xmitted on all psta assoc */
3040	uint32  pstarxucast;	/* count of ucast frames received on all psta assoc */
3041	uint32  pstarxbcmc;	/* count of bcmc frames received on all psta */
3042	uint32  pstatxbcmc;	/* count of bcmc frames transmitted on all psta */
3043
3044	uint32  cso_passthrough; /* hw cso required but passthrough */
3045} wl_cnt_t;
3046
3047typedef struct {
3048	uint16  version;    /* see definition of WL_CNT_T_VERSION */
3049	uint16  length;     /* length of entire structure */
3050
3051	/* transmit stat counters */
3052	uint32  txframe;    /* tx data frames */
3053	uint32  txbyte;     /* tx data bytes */
3054	uint32  txretrans;  /* tx mac retransmits */
3055	uint32  txerror;    /* tx data errors (derived: sum of others) */
3056	uint32  txctl;      /* tx management frames */
3057	uint32  txprshort;  /* tx short preamble frames */
3058	uint32  txserr;     /* tx status errors */
3059	uint32  txnobuf;    /* tx out of buffers errors */
3060	uint32  txnoassoc;  /* tx discard because we're not associated */
3061	uint32  txrunt;     /* tx runt frames */
3062	uint32  txchit;     /* tx header cache hit (fastpath) */
3063	uint32  txcmiss;    /* tx header cache miss (slowpath) */
3064
3065	/* transmit chip error counters */
3066	uint32  txuflo;     /* tx fifo underflows */
3067	uint32  txphyerr;   /* tx phy errors (indicated in tx status) */
3068	uint32  txphycrs;
3069
3070	/* receive stat counters */
3071	uint32  rxframe;    /* rx data frames */
3072	uint32  rxbyte;     /* rx data bytes */
3073	uint32  rxerror;    /* rx data errors (derived: sum of others) */
3074	uint32  rxctl;      /* rx management frames */
3075	uint32  rxnobuf;    /* rx out of buffers errors */
3076	uint32  rxnondata;  /* rx non data frames in the data channel errors */
3077	uint32  rxbadds;    /* rx bad DS errors */
3078	uint32  rxbadcm;    /* rx bad control or management frames */
3079	uint32  rxfragerr;  /* rx fragmentation errors */
3080	uint32  rxrunt;     /* rx runt frames */
3081	uint32  rxgiant;    /* rx giant frames */
3082	uint32  rxnoscb;    /* rx no scb error */
3083	uint32  rxbadproto; /* rx invalid frames */
3084	uint32  rxbadsrcmac;    /* rx frames with Invalid Src Mac */
3085	uint32  rxbadda;    /* rx frames tossed for invalid da */
3086	uint32  rxfilter;   /* rx frames filtered out */
3087
3088	/* receive chip error counters */
3089	uint32  rxoflo;     /* rx fifo overflow errors */
3090	uint32  rxuflo[NFIFO];  /* rx dma descriptor underflow errors */
3091
3092	uint32  d11cnt_txrts_off;   /* d11cnt txrts value when reset d11cnt */
3093	uint32  d11cnt_rxcrc_off;   /* d11cnt rxcrc value when reset d11cnt */
3094	uint32  d11cnt_txnocts_off; /* d11cnt txnocts value when reset d11cnt */
3095
3096	/* misc counters */
3097	uint32  dmade;      /* tx/rx dma descriptor errors */
3098	uint32  dmada;      /* tx/rx dma data errors */
3099	uint32  dmape;      /* tx/rx dma descriptor protocol errors */
3100	uint32  reset;      /* reset count */
3101	uint32  tbtt;       /* cnts the TBTT int's */
3102	uint32  txdmawar;
3103	uint32  pkt_callback_reg_fail;  /* callbacks register failure */
3104
3105	/* MAC counters: 32-bit version of d11.h's macstat_t */
3106	uint32  txallfrm;   /* total number of frames sent, incl. Data, ACK, RTS, CTS,
3107			     * Control Management (includes retransmissions)
3108			     */
3109	uint32  txrtsfrm;   /* number of RTS sent out by the MAC */
3110	uint32  txctsfrm;   /* number of CTS sent out by the MAC */
3111	uint32  txackfrm;   /* number of ACK frames sent out */
3112	uint32  txdnlfrm;   /* Not used */
3113	uint32  txbcnfrm;   /* beacons transmitted */
3114	uint32  txfunfl[8]; /* per-fifo tx underflows */
3115	uint32  txtplunfl;  /* Template underflows (mac was too slow to transmit ACK/CTS
3116			     * or BCN)
3117			     */
3118	uint32  txphyerror; /* Transmit phy error, type of error is reported in tx-status for
3119			     * driver enqueued frames
3120			     */
3121	uint32  rxfrmtoolong;   /* Received frame longer than legal limit (2346 bytes) */
3122	uint32  rxfrmtooshrt;   /* Received frame did not contain enough bytes for its frame type */
3123	uint32  rxinvmachdr;    /* Either the protocol version != 0 or frame type not
3124				 * data/control/management
3125			   */
3126	uint32  rxbadfcs;   /* number of frames for which the CRC check failed in the MAC */
3127	uint32  rxbadplcp;  /* parity check of the PLCP header failed */
3128	uint32  rxcrsglitch;    /* PHY was able to correlate the preamble but not the header */
3129	uint32  rxstrt;     /* Number of received frames with a good PLCP
3130			     * (i.e. passing parity check)
3131			     */
3132	uint32  rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */
3133	uint32  rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
3134	uint32  rxcfrmucast;    /* number of received CNTRL frames with good FCS and matching RA */
3135	uint32  rxrtsucast; /* number of unicast RTS addressed to the MAC (good FCS) */
3136	uint32  rxctsucast; /* number of unicast CTS addressed to the MAC (good FCS) */
3137	uint32  rxackucast; /* number of ucast ACKS received (good FCS) */
3138	uint32  rxdfrmocast;    /* number of received DATA frames (good FCS and not matching RA) */
3139	uint32  rxmfrmocast;    /* number of received MGMT frames (good FCS and not matching RA) */
3140	uint32  rxcfrmocast;    /* number of received CNTRL frame (good FCS and not matching RA) */
3141	uint32  rxrtsocast; /* number of received RTS not addressed to the MAC */
3142	uint32  rxctsocast; /* number of received CTS not addressed to the MAC */
3143	uint32  rxdfrmmcast;    /* number of RX Data multicast frames received by the MAC */
3144	uint32  rxmfrmmcast;    /* number of RX Management multicast frames received by the MAC */
3145	uint32  rxcfrmmcast;    /* number of RX Control multicast frames received by the MAC
3146				 * (unlikely to see these)
3147				 */
3148	uint32  rxbeaconmbss;   /* beacons received from member of BSS */
3149	uint32  rxdfrmucastobss; /* number of unicast frames addressed to the MAC from
3150				  * other BSS (WDS FRAME)
3151				  */
3152	uint32  rxbeaconobss;   /* beacons received from other BSS */
3153	uint32  rxrsptmout; /* Number of response timeouts for transmitted frames
3154			     * expecting a response
3155			     */
3156	uint32  bcntxcancl; /* transmit beacons canceled due to receipt of beacon (IBSS) */
3157	uint32  rxf0ovfl;   /* Number of receive fifo 0 overflows */
3158	uint32  rxf1ovfl;   /* Number of receive fifo 1 overflows (obsolete) */
3159	uint32  rxf2ovfl;   /* Number of receive fifo 2 overflows (obsolete) */
3160	uint32  txsfovfl;   /* Number of transmit status fifo overflows (obsolete) */
3161	uint32  pmqovfl;    /* Number of PMQ overflows */
3162	uint32  rxcgprqfrm; /* Number of received Probe requests that made it into
3163			     * the PRQ fifo
3164			     */
3165	uint32  rxcgprsqovfl;   /* Rx Probe Request Que overflow in the AP */
3166	uint32  txcgprsfail;    /* Tx Probe Response Fail. AP sent probe response but did
3167				 * not get ACK
3168				 */
3169	uint32  txcgprssuc; /* Tx Probe Response Success (ACK was received) */
3170	uint32  prs_timeout;    /* Number of probe requests that were dropped from the PRQ
3171				 * fifo because a probe response could not be sent out within
3172				 * the time limit defined in M_PRS_MAXTIME
3173				 */
3174	uint32  rxnack;
3175	uint32  frmscons;
3176	uint32  txnack;
3177	uint32  txglitch_nack;  /* obsolete */
3178	uint32  txburst;    /* obsolete */
3179
3180	/* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
3181	uint32  txfrag;     /* dot11TransmittedFragmentCount */
3182	uint32  txmulti;    /* dot11MulticastTransmittedFrameCount */
3183	uint32  txfail;     /* dot11FailedCount */
3184	uint32  txretry;    /* dot11RetryCount */
3185	uint32  txretrie;   /* dot11MultipleRetryCount */
3186	uint32  rxdup;      /* dot11FrameduplicateCount */
3187	uint32  txrts;      /* dot11RTSSuccessCount */
3188	uint32  txnocts;    /* dot11RTSFailureCount */
3189	uint32  txnoack;    /* dot11ACKFailureCount */
3190	uint32  rxfrag;     /* dot11ReceivedFragmentCount */
3191	uint32  rxmulti;    /* dot11MulticastReceivedFrameCount */
3192	uint32  rxcrc;      /* dot11FCSErrorCount */
3193	uint32  txfrmsnt;   /* dot11TransmittedFrameCount (bogus MIB?) */
3194	uint32  rxundec;    /* dot11WEPUndecryptableCount */
3195
3196	/* WPA2 counters (see rxundec for DecryptFailureCount) */
3197	uint32  tkipmicfaill;   /* TKIPLocalMICFailures */
3198	uint32  tkipcntrmsr;    /* TKIPCounterMeasuresInvoked */
3199	uint32  tkipreplay; /* TKIPReplays */
3200	uint32  ccmpfmterr; /* CCMPFormatErrors */
3201	uint32  ccmpreplay; /* CCMPReplays */
3202	uint32  ccmpundec;  /* CCMPDecryptErrors */
3203	uint32  fourwayfail;    /* FourWayHandshakeFailures */
3204	uint32  wepundec;   /* dot11WEPUndecryptableCount */
3205	uint32  wepicverr;  /* dot11WEPICVErrorCount */
3206	uint32  decsuccess; /* DecryptSuccessCount */
3207	uint32  tkipicverr; /* TKIPICVErrorCount */
3208	uint32  wepexcluded;    /* dot11WEPExcludedCount */
3209
3210	uint32  rxundec_mcst;   /* dot11WEPUndecryptableCount */
3211
3212	/* WPA2 counters (see rxundec for DecryptFailureCount) */
3213	uint32  tkipmicfaill_mcst;  /* TKIPLocalMICFailures */
3214	uint32  tkipcntrmsr_mcst;   /* TKIPCounterMeasuresInvoked */
3215	uint32  tkipreplay_mcst;    /* TKIPReplays */
3216	uint32  ccmpfmterr_mcst;    /* CCMPFormatErrors */
3217	uint32  ccmpreplay_mcst;    /* CCMPReplays */
3218	uint32  ccmpundec_mcst; /* CCMPDecryptErrors */
3219	uint32  fourwayfail_mcst;   /* FourWayHandshakeFailures */
3220	uint32  wepundec_mcst;  /* dot11WEPUndecryptableCount */
3221	uint32  wepicverr_mcst; /* dot11WEPICVErrorCount */
3222	uint32  decsuccess_mcst;    /* DecryptSuccessCount */
3223	uint32  tkipicverr_mcst;    /* TKIPICVErrorCount */
3224	uint32  wepexcluded_mcst;   /* dot11WEPExcludedCount */
3225
3226	uint32  txchanrej;  /* Tx frames suppressed due to channel rejection */
3227	uint32  txexptime;  /* Tx frames suppressed due to timer expiration */
3228	uint32  psmwds;     /* Count PSM watchdogs */
3229	uint32  phywatchdog;    /* Count Phy watchdogs (triggered by ucode) */
3230
3231	/* MBSS counters, AP only */
3232	uint32  prq_entries_handled;    /* PRQ entries read in */
3233	uint32  prq_undirected_entries; /*    which were bcast bss & ssid */
3234	uint32  prq_bad_entries;    /*    which could not be translated to info */
3235	uint32  atim_suppress_count;    /* TX suppressions on ATIM fifo */
3236	uint32  bcn_template_not_ready; /* Template marked in use on send bcn ... */
3237	uint32  bcn_template_not_ready_done; /* ...but "DMA done" interrupt rcvd */
3238	uint32  late_tbtt_dpc;  /* TBTT DPC did not happen in time */
3239
3240	/* per-rate receive stat counters */
3241	uint32  rx1mbps;    /* packets rx at 1Mbps */
3242	uint32  rx2mbps;    /* packets rx at 2Mbps */
3243	uint32  rx5mbps5;   /* packets rx at 5.5Mbps */
3244	uint32  rx6mbps;    /* packets rx at 6Mbps */
3245	uint32  rx9mbps;    /* packets rx at 9Mbps */
3246	uint32  rx11mbps;   /* packets rx at 11Mbps */
3247	uint32  rx12mbps;   /* packets rx at 12Mbps */
3248	uint32  rx18mbps;   /* packets rx at 18Mbps */
3249	uint32  rx24mbps;   /* packets rx at 24Mbps */
3250	uint32  rx36mbps;   /* packets rx at 36Mbps */
3251	uint32  rx48mbps;   /* packets rx at 48Mbps */
3252	uint32  rx54mbps;   /* packets rx at 54Mbps */
3253	uint32  rx108mbps;  /* packets rx at 108mbps */
3254	uint32  rx162mbps;  /* packets rx at 162mbps */
3255	uint32  rx216mbps;  /* packets rx at 216 mbps */
3256	uint32  rx270mbps;  /* packets rx at 270 mbps */
3257	uint32  rx324mbps;  /* packets rx at 324 mbps */
3258	uint32  rx378mbps;  /* packets rx at 378 mbps */
3259	uint32  rx432mbps;  /* packets rx at 432 mbps */
3260	uint32  rx486mbps;  /* packets rx at 486 mbps */
3261	uint32  rx540mbps;  /* packets rx at 540 mbps */
3262
3263	/* pkteng rx frame stats */
3264	uint32  pktengrxducast; /* unicast frames rxed by the pkteng code */
3265	uint32  pktengrxdmcast; /* multicast frames rxed by the pkteng code */
3266
3267	uint32  rfdisable;  /* count of radio disables */
3268	uint32  bphy_rxcrsglitch;   /* PHY count of bphy glitches */
3269
3270	uint32  txmpdu_sgi; /* count for sgi transmit */
3271	uint32  rxmpdu_sgi; /* count for sgi received */
3272	uint32  txmpdu_stbc;    /* count for stbc transmit */
3273	uint32  rxmpdu_stbc;    /* count for stbc received */
3274} wl_cnt_ver_six_t;
3275
3276
3277#ifndef LINUX_POSTMOGRIFY_REMOVAL
3278#define	WL_DELTA_STATS_T_VERSION	1	/* current version of wl_delta_stats_t struct */
3279
3280typedef struct {
3281	uint16 version;     /* see definition of WL_DELTA_STATS_T_VERSION */
3282	uint16 length;      /* length of entire structure */
3283
3284	/* transmit stat counters */
3285	uint32 txframe;     /* tx data frames */
3286	uint32 txbyte;      /* tx data bytes */
3287	uint32 txretrans;   /* tx mac retransmits */
3288	uint32 txfail;      /* tx failures */
3289
3290	/* receive stat counters */
3291	uint32 rxframe;     /* rx data frames */
3292	uint32 rxbyte;      /* rx data bytes */
3293
3294	/* per-rate receive stat counters */
3295	uint32  rx1mbps;	/* packets rx at 1Mbps */
3296	uint32  rx2mbps;	/* packets rx at 2Mbps */
3297	uint32  rx5mbps5;	/* packets rx at 5.5Mbps */
3298	uint32  rx6mbps;	/* packets rx at 6Mbps */
3299	uint32  rx9mbps;	/* packets rx at 9Mbps */
3300	uint32  rx11mbps;	/* packets rx at 11Mbps */
3301	uint32  rx12mbps;	/* packets rx at 12Mbps */
3302	uint32  rx18mbps;	/* packets rx at 18Mbps */
3303	uint32  rx24mbps;	/* packets rx at 24Mbps */
3304	uint32  rx36mbps;	/* packets rx at 36Mbps */
3305	uint32  rx48mbps;	/* packets rx at 48Mbps */
3306	uint32  rx54mbps;	/* packets rx at 54Mbps */
3307	uint32  rx108mbps; 	/* packets rx at 108mbps */
3308	uint32  rx162mbps;	/* packets rx at 162mbps */
3309	uint32  rx216mbps;	/* packets rx at 216 mbps */
3310	uint32  rx270mbps;	/* packets rx at 270 mbps */
3311	uint32  rx324mbps;	/* packets rx at 324 mbps */
3312	uint32  rx378mbps;	/* packets rx at 378 mbps */
3313	uint32  rx432mbps;	/* packets rx at 432 mbps */
3314	uint32  rx486mbps;	/* packets rx at 486 mbps */
3315	uint32  rx540mbps;	/* packets rx at 540 mbps */
3316} wl_delta_stats_t;
3317#endif /* LINUX_POSTMOGRIFY_REMOVAL */
3318
3319#define WL_WME_CNT_VERSION	1	/* current version of wl_wme_cnt_t */
3320
3321typedef struct {
3322	uint32 packets;
3323	uint32 bytes;
3324} wl_traffic_stats_t;
3325
3326typedef struct {
3327	uint16	version;	/* see definition of WL_WME_CNT_VERSION */
3328	uint16	length;		/* length of entire structure */
3329
3330	wl_traffic_stats_t tx[AC_COUNT];	/* Packets transmitted */
3331	wl_traffic_stats_t tx_failed[AC_COUNT];	/* Packets dropped or failed to transmit */
3332	wl_traffic_stats_t rx[AC_COUNT];	/* Packets received */
3333	wl_traffic_stats_t rx_failed[AC_COUNT];	/* Packets failed to receive */
3334
3335	wl_traffic_stats_t forward[AC_COUNT];	/* Packets forwarded by AP */
3336
3337	wl_traffic_stats_t tx_expired[AC_COUNT];	/* packets dropped due to lifetime expiry */
3338
3339} wl_wme_cnt_t;
3340
3341struct wl_msglevel2 {
3342	uint32 low;
3343	uint32 high;
3344};
3345
3346typedef struct wl_mkeep_alive_pkt {
3347	uint16	version; /* Version for mkeep_alive */
3348	uint16	length; /* length of fixed parameters in the structure */
3349	uint32	period_msec;
3350	uint16	len_bytes;
3351	uint8	keep_alive_id; /* 0 - 3 for N = 4 */
3352	uint8	data[1];
3353} wl_mkeep_alive_pkt_t;
3354
3355#define WL_MKEEP_ALIVE_VERSION		1
3356#define WL_MKEEP_ALIVE_FIXED_LEN	OFFSETOF(wl_mkeep_alive_pkt_t, data)
3357#define WL_MKEEP_ALIVE_PRECISION	500
3358
3359#ifndef LINUX_POSTMOGRIFY_REMOVAL
3360#ifdef WLBA
3361
3362#define WLC_BA_CNT_VERSION  1   /* current version of wlc_ba_cnt_t */
3363
3364/* block ack related stats */
3365typedef struct wlc_ba_cnt {
3366	uint16  version;    /* WLC_BA_CNT_VERSION */
3367	uint16  length;     /* length of entire structure */
3368
3369	/* transmit stat counters */
3370	uint32 txpdu;       /* pdus sent */
3371	uint32 txsdu;       /* sdus sent */
3372	uint32 txfc;        /* tx side flow controlled packets */
3373	uint32 txfci;       /* tx side flow control initiated */
3374	uint32 txretrans;   /* retransmitted pdus */
3375	uint32 txbatimer;   /* ba resend due to timer */
3376	uint32 txdrop;      /* dropped packets */
3377	uint32 txaddbareq;  /* addba req sent */
3378	uint32 txaddbaresp; /* addba resp sent */
3379	uint32 txdelba;     /* delba sent */
3380	uint32 txba;        /* ba sent */
3381	uint32 txbar;       /* bar sent */
3382	uint32 txpad[4];    /* future */
3383
3384	/* receive side counters */
3385	uint32 rxpdu;       /* pdus recd */
3386	uint32 rxqed;       /* pdus buffered before sending up */
3387	uint32 rxdup;       /* duplicate pdus */
3388	uint32 rxnobuf;     /* pdus discarded due to no buf */
3389	uint32 rxaddbareq;  /* addba req recd */
3390	uint32 rxaddbaresp; /* addba resp recd */
3391	uint32 rxdelba;     /* delba recd */
3392	uint32 rxba;        /* ba recd */
3393	uint32 rxbar;       /* bar recd */
3394	uint32 rxinvba;     /* invalid ba recd */
3395	uint32 rxbaholes;   /* ba recd with holes */
3396	uint32 rxunexp;     /* unexpected packets */
3397	uint32 rxpad[4];    /* future */
3398} wlc_ba_cnt_t;
3399#endif /* WLBA */
3400
3401/* structure for per-tid ampdu control */
3402struct ampdu_tid_control {
3403	uint8 tid;			/* tid */
3404	uint8 enable;			/* enable/disable */
3405};
3406
3407/* structure for identifying ea/tid for sending addba/delba */
3408struct ampdu_ea_tid {
3409	struct ether_addr ea;		/* Station address */
3410	uint8 tid;			/* tid */
3411};
3412/* structure for identifying retry/tid for retry_limit_tid/rr_retry_limit_tid */
3413struct ampdu_retry_tid {
3414	uint8 tid;	/* tid */
3415	uint8 retry;	/* retry value */
3416};
3417
3418/* Different discovery modes for dpt */
3419#define	DPT_DISCOVERY_MANUAL	0x01	/* manual discovery mode */
3420#define	DPT_DISCOVERY_AUTO	0x02	/* auto discovery mode */
3421#define	DPT_DISCOVERY_SCAN	0x04	/* scan-based discovery mode */
3422
3423/* different path selection values */
3424#define DPT_PATHSEL_AUTO	0	/* auto mode for path selection */
3425#define DPT_PATHSEL_DIRECT	1	/* always use direct DPT path */
3426#define DPT_PATHSEL_APPATH	2	/* always use AP path */
3427
3428/* different ops for deny list */
3429#define DPT_DENY_LIST_ADD 	1	/* add to dpt deny list */
3430#define DPT_DENY_LIST_REMOVE 	2	/* remove from dpt deny list */
3431
3432/* different ops for manual end point */
3433#define DPT_MANUAL_EP_CREATE	1	/* create manual dpt endpoint */
3434#define DPT_MANUAL_EP_MODIFY	2	/* modify manual dpt endpoint */
3435#define DPT_MANUAL_EP_DELETE	3	/* delete manual dpt endpoint */
3436
3437/* structure for dpt iovars */
3438typedef struct dpt_iovar {
3439	struct ether_addr ea;		/* Station address */
3440	uint8 mode;			/* mode: depends on iovar */
3441	uint32 pad;			/* future */
3442} dpt_iovar_t;
3443
3444/* flags to indicate DPT status */
3445#define	DPT_STATUS_ACTIVE	0x01	/* link active (though may be suspended) */
3446#define	DPT_STATUS_AES		0x02	/* link secured through AES encryption */
3447#define	DPT_STATUS_FAILED	0x04	/* DPT link failed */
3448
3449#define	DPT_FNAME_LEN		48	/* Max length of friendly name */
3450
3451typedef struct dpt_status {
3452	uint8 status;			/* flags to indicate status */
3453	uint8 fnlen;			/* length of friendly name */
3454	uchar name[DPT_FNAME_LEN];	/* friendly name */
3455	uint32 rssi;			/* RSSI of the link */
3456	sta_info_t sta;			/* sta info */
3457} dpt_status_t;
3458
3459/* structure for dpt list */
3460typedef struct dpt_list {
3461	uint32 num;			/* number of entries in struct */
3462	dpt_status_t status[1];		/* per station info */
3463} dpt_list_t;
3464
3465/* structure for dpt friendly name */
3466typedef struct dpt_fname {
3467	uint8 len;			/* length of friendly name */
3468	uchar name[DPT_FNAME_LEN];	/* friendly name */
3469} dpt_fname_t;
3470
3471#define BDD_FNAME_LEN       32  /* Max length of friendly name */
3472typedef struct bdd_fname {
3473	uint8 len;          /* length of friendly name */
3474	uchar name[BDD_FNAME_LEN];  /* friendly name */
3475} bdd_fname_t;
3476
3477/* structure for addts arguments */
3478/* For ioctls that take a list of TSPEC */
3479struct tslist {
3480	int count;			/* number of tspecs */
3481	struct tsinfo_arg tsinfo[1];	/* variable length array of tsinfo */
3482};
3483
3484#ifdef WLTDLS
3485/* different ops for manual end point */
3486#define TDLS_MANUAL_EP_CREATE	1	/* create manual dpt endpoint */
3487#define TDLS_MANUAL_EP_MODIFY	2	/* modify manual dpt endpoint */
3488#define TDLS_MANUAL_EP_DELETE	3	/* delete manual dpt endpoint */
3489#define TDLS_MANUAL_EP_PM		4	/*  put dpt endpoint in PM mode */
3490#define TDLS_MANUAL_EP_WAKE		5	/* wake up dpt endpoint from PM */
3491#define TDLS_MANUAL_EP_DISCOVERY	6	/* discover if endpoint is TDLS capable */
3492#define TDLS_MANUAL_EP_CHSW		7	/* channel switch */
3493
3494/* structure for tdls iovars */
3495typedef struct tdls_iovar {
3496	struct ether_addr ea;		/* Station address */
3497	uint8 mode;			/* mode: depends on iovar */
3498	chanspec_t chanspec;
3499	uint32 pad;			/* future */
3500} tdls_iovar_t;
3501
3502/* modes */
3503#define TDLS_WFD_IE_TX 0
3504#define TDLS_WFD_IE_RX 1
3505#define TDLS_WFD_IE_SIZE 255
3506/* structure for tdls wfd ie */
3507typedef struct tdls_wfd_ie_iovar {
3508	struct ether_addr ea;		/* Station address */
3509	uint8 mode;
3510	uint8 length;
3511	uint8 data[TDLS_WFD_IE_SIZE];
3512} tdls_wfd_ie_iovar_t;
3513#endif /* WLTDLS */
3514
3515/* structure for addts/delts arguments */
3516typedef struct tspec_arg {
3517	uint16 version;			/* see definition of TSPEC_ARG_VERSION */
3518	uint16 length;			/* length of entire structure */
3519	uint flag;			/* bit field */
3520	/* TSPEC Arguments */
3521	struct tsinfo_arg tsinfo;	/* TS Info bit field */
3522	uint16 nom_msdu_size;		/* (Nominal or fixed) MSDU Size (bytes) */
3523	uint16 max_msdu_size;		/* Maximum MSDU Size (bytes) */
3524	uint min_srv_interval;		/* Minimum Service Interval (us) */
3525	uint max_srv_interval;		/* Maximum Service Interval (us) */
3526	uint inactivity_interval;	/* Inactivity Interval (us) */
3527	uint suspension_interval;	/* Suspension Interval (us) */
3528	uint srv_start_time;		/* Service Start Time (us) */
3529	uint min_data_rate;		/* Minimum Data Rate (bps) */
3530	uint mean_data_rate;		/* Mean Data Rate (bps) */
3531	uint peak_data_rate;		/* Peak Data Rate (bps) */
3532	uint max_burst_size;		/* Maximum Burst Size (bytes) */
3533	uint delay_bound;		/* Delay Bound (us) */
3534	uint min_phy_rate;		/* Minimum PHY Rate (bps) */
3535	uint16 surplus_bw;		/* Surplus Bandwidth Allowance (range 1.0 to 8.0) */
3536	uint16 medium_time;		/* Medium Time (32 us/s periods) */
3537	uint8 dialog_token;		/* dialog token */
3538} tspec_arg_t;
3539
3540/* tspec arg for desired station */
3541typedef	struct tspec_per_sta_arg {
3542	struct ether_addr ea;
3543	struct tspec_arg ts;
3544} tspec_per_sta_arg_t;
3545
3546/* structure for max bandwidth for each access category */
3547typedef	struct wme_max_bandwidth {
3548	uint32	ac[AC_COUNT];	/* max bandwidth for each access category */
3549} wme_max_bandwidth_t;
3550
3551#define WL_WME_MBW_PARAMS_IO_BYTES (sizeof(wme_max_bandwidth_t))
3552
3553/* current version of wl_tspec_arg_t struct */
3554#define	TSPEC_ARG_VERSION		2	/* current version of wl_tspec_arg_t struct */
3555#define TSPEC_ARG_LENGTH		55	/* argument length from tsinfo to medium_time */
3556#define TSPEC_DEFAULT_DIALOG_TOKEN	42	/* default dialog token */
3557#define TSPEC_DEFAULT_SBW_FACTOR	0x3000	/* default surplus bw */
3558
3559
3560#define WL_WOWL_KEEPALIVE_MAX_PACKET_SIZE  80
3561#define WLC_WOWL_MAX_KEEPALIVE	2
3562
3563/* define for flag */
3564#define TSPEC_PENDING		0	/* TSPEC pending */
3565#define TSPEC_ACCEPTED		1	/* TSPEC accepted */
3566#define TSPEC_REJECTED		2	/* TSPEC rejected */
3567#define TSPEC_UNKNOWN		3	/* TSPEC unknown */
3568#define TSPEC_STATUS_MASK	7	/* TSPEC status mask */
3569
3570
3571/* Software feature flag defines used by wlfeatureflag */
3572#ifdef WLAFTERBURNER
3573#define WL_SWFL_ABBFL       0x0001 /* Allow Afterburner on systems w/o hardware BFL */
3574#define WL_SWFL_ABENCORE    0x0002 /* Allow AB on non-4318E chips */
3575#endif /* WLAFTERBURNER */
3576#define WL_SWFL_NOHWRADIO	0x0004
3577#define WL_SWFL_FLOWCONTROL     0x0008 /* Enable backpressure to OS stack */
3578#define WL_SWFL_WLBSSSORT	0x0010 /* Per-port supports sorting of BSS */
3579
3580#define WL_LIFETIME_MAX 0xFFFF /* Max value in ms */
3581
3582/* Packet lifetime configuration per ac */
3583typedef struct wl_lifetime {
3584	uint32 ac;	        /* access class */
3585	uint32 lifetime;    /* Packet lifetime value in ms */
3586} wl_lifetime_t;
3587
3588/* Channel Switch Announcement param */
3589typedef struct wl_chan_switch {
3590	uint8 mode;		/* value 0 or 1 */
3591	uint8 count;		/* count # of beacons before switching */
3592	chanspec_t chspec;	/* chanspec */
3593	uint8 reg;		/* regulatory class */
3594} wl_chan_switch_t;
3595#endif /* LINUX_POSTMOGRIFY_REMOVAL */
3596
3597/* Roaming trigger definitions for WLC_SET_ROAM_TRIGGER.
3598 *
3599 * (-100 < value < 0)   value is used directly as a roaming trigger in dBm
3600 * (0 <= value) value specifies a logical roaming trigger level from
3601 *                      the list below
3602 *
3603 * WLC_GET_ROAM_TRIGGER always returns roaming trigger value in dBm, never
3604 * the logical roam trigger value.
3605 */
3606#define WLC_ROAM_TRIGGER_DEFAULT	0 /* default roaming trigger */
3607#define WLC_ROAM_TRIGGER_BANDWIDTH	1 /* optimize for bandwidth roaming trigger */
3608#define WLC_ROAM_TRIGGER_DISTANCE	2 /* optimize for distance roaming trigger */
3609#define WLC_ROAM_TRIGGER_AUTO		3 /* auto-detect environment */
3610#define WLC_ROAM_TRIGGER_MAX_VALUE	3 /* max. valid value */
3611
3612#define WLC_ROAM_NEVER_ROAM_TRIGGER	(-100) /* Avoid Roaming by setting a large value */
3613
3614/* Preferred Network Offload (PNO, formerly PFN) defines */
3615#define WPA_AUTH_PFN_ANY	0xffffffff	/* for PFN, match only ssid */
3616
3617enum {
3618	PFN_LIST_ORDER,
3619	PFN_RSSI
3620};
3621
3622enum {
3623	DISABLE,
3624	ENABLE
3625};
3626
3627enum {
3628	OFF_ADAPT,
3629	SMART_ADAPT,
3630	STRICT_ADAPT,
3631	SLOW_ADAPT
3632};
3633
3634#define SORT_CRITERIA_BIT		0
3635#define AUTO_NET_SWITCH_BIT		1
3636#define ENABLE_BKGRD_SCAN_BIT		2
3637#define IMMEDIATE_SCAN_BIT		3
3638#define	AUTO_CONNECT_BIT		4
3639#define	ENABLE_BD_SCAN_BIT		5
3640#define ENABLE_ADAPTSCAN_BIT		6
3641#define IMMEDIATE_EVENT_BIT		8
3642
3643#define SORT_CRITERIA_MASK		0x0001
3644#define AUTO_NET_SWITCH_MASK	0x0002
3645#define ENABLE_BKGRD_SCAN_MASK	0x0004
3646#define IMMEDIATE_SCAN_MASK		0x0008
3647#define	AUTO_CONNECT_MASK		0x0010
3648
3649#define ENABLE_BD_SCAN_MASK		0x0020
3650#define ENABLE_ADAPTSCAN_MASK	0x00c0
3651#define IMMEDIATE_EVENT_MASK	0x0100
3652
3653#define PFN_VERSION				2
3654#define PFN_SCANRESULT_VERSION	1
3655#define MAX_PFN_LIST_COUNT	16
3656
3657#define PFN_COMPLETE			1
3658#define PFN_INCOMPLETE			0
3659
3660#define DEFAULT_BESTN			2
3661#define DEFAULT_MSCAN			0
3662#define DEFAULT_REPEAT			10
3663#define DEFAULT_EXP				2
3664
3665/* PFN network info structure */
3666typedef struct wl_pfn_subnet_info {
3667	struct ether_addr BSSID;
3668	uint8	channel; /* channel number only */
3669	uint8	SSID_len;
3670	uint8	SSID[32];
3671} wl_pfn_subnet_info_t;
3672
3673typedef struct wl_pfn_net_info {
3674	wl_pfn_subnet_info_t pfnsubnet;
3675	int16	RSSI; /* receive signal strength (in dBm) */
3676	uint16	timestamp; /* age in seconds */
3677} wl_pfn_net_info_t;
3678
3679typedef struct wl_pfn_scanresults {
3680	uint32 version;
3681	uint32 status;
3682	uint32 count;
3683	wl_pfn_net_info_t netinfo[1];
3684} wl_pfn_scanresults_t;
3685
3686/* PFN data structure */
3687typedef struct wl_pfn_param {
3688	int32 version;			/* PNO parameters version */
3689	int32 scan_freq;		/* Scan frequency */
3690	int32 lost_network_timeout;	/* Timeout in sec. to declare
3691					 * discovered network as lost
3692					 */
3693	int16 flags;			/* Bit field to control features
3694					 * of PFN such as sort criteria auto
3695					 * enable switch and background scan
3696					 */
3697	int16 rssi_margin;		/* Margin to avoid jitter for choosing a
3698					 * PFN based on RSSI sort criteria
3699					 */
3700	uint8 bestn; /* number of best networks in each scan */
3701	uint8 mscan; /* number of scans recorded */
3702	uint8 repeat; /* Minimum number of scan intervals
3703				     *before scan frequency changes in adaptive scan
3704				     */
3705	uint8 exp; /* Exponent of 2 for maximum scan interval */
3706	int32 slow_freq; /* slow scan period */
3707} wl_pfn_param_t;
3708
3709typedef struct wl_pfn_bssid {
3710	struct ether_addr 	macaddr;
3711	/* Bit4: suppress_lost, Bit3: suppress_found */
3712	uint16				flags;
3713} wl_pfn_bssid_t;
3714#define WL_PFN_SUPPRESSFOUND_MASK	0x08
3715#define WL_PFN_SUPPRESSLOST_MASK	0x10
3716
3717typedef struct wl_pfn_cfg {
3718	uint32				reporttype;
3719	int32				channel_num;
3720	uint16				channel_list[WL_NUMCHANNELS];
3721} wl_pfn_cfg_t;
3722#define WL_PFN_REPORT_ALLNET 	0
3723#define WL_PFN_REPORT_SSIDNET 	1
3724#define WL_PFN_REPORT_BSSIDNET 	2
3725
3726typedef struct wl_pfn {
3727	wlc_ssid_t		ssid;			/* ssid name and its length */
3728	int32			flags;			/* bit2: hidden */
3729	int32			infra;			/* BSS Vs IBSS */
3730	int32			auth;			/* Open Vs Closed */
3731	int32			wpa_auth;		/* WPA type */
3732	int32			wsec;			/* wsec value */
3733} wl_pfn_t;
3734#define WL_PFN_HIDDEN_BIT		2
3735#define PNO_SCAN_MAX_FW		508*1000	/* max time scan time in msec */
3736#define PNO_SCAN_MAX_FW_SEC	PNO_SCAN_MAX_FW/1000 /* max time scan time in SEC */
3737#define PNO_SCAN_MIN_FW_SEC	10			/* min time scan time in SEC */
3738#define WL_PFN_HIDDEN_MASK		0x4
3739
3740/* TCP Checksum Offload defines */
3741#define TOE_TX_CSUM_OL		0x00000001
3742#define TOE_RX_CSUM_OL		0x00000002
3743
3744/* TCP Checksum Offload error injection for testing */
3745#define TOE_ERRTEST_TX_CSUM	0x00000001
3746#define TOE_ERRTEST_RX_CSUM	0x00000002
3747#define TOE_ERRTEST_RX_CSUM2	0x00000004
3748
3749struct toe_ol_stats_t {
3750	/* Num of tx packets that don't need to be checksummed */
3751	uint32 tx_summed;
3752
3753	/* Num of tx packets where checksum is filled by offload engine */
3754	uint32 tx_iph_fill;
3755	uint32 tx_tcp_fill;
3756	uint32 tx_udp_fill;
3757	uint32 tx_icmp_fill;
3758
3759	/*  Num of rx packets where toe finds out if checksum is good or bad */
3760	uint32 rx_iph_good;
3761	uint32 rx_iph_bad;
3762	uint32 rx_tcp_good;
3763	uint32 rx_tcp_bad;
3764	uint32 rx_udp_good;
3765	uint32 rx_udp_bad;
3766	uint32 rx_icmp_good;
3767	uint32 rx_icmp_bad;
3768
3769	/* Num of tx packets in which csum error is injected */
3770	uint32 tx_tcp_errinj;
3771	uint32 tx_udp_errinj;
3772	uint32 tx_icmp_errinj;
3773
3774	/* Num of rx packets in which csum error is injected */
3775	uint32 rx_tcp_errinj;
3776	uint32 rx_udp_errinj;
3777	uint32 rx_icmp_errinj;
3778};
3779
3780/* ARP Offload feature flags for arp_ol iovar */
3781#define ARP_OL_AGENT		0x00000001
3782#define ARP_OL_SNOOP		0x00000002
3783#define ARP_OL_HOST_AUTO_REPLY	0x00000004
3784#define ARP_OL_PEER_AUTO_REPLY	0x00000008
3785
3786/* ARP Offload error injection */
3787#define ARP_ERRTEST_REPLY_PEER	0x1
3788#define ARP_ERRTEST_REPLY_HOST	0x2
3789
3790#define ARP_MULTIHOMING_MAX	8	/* Maximum local host IP addresses */
3791#define ND_MULTIHOMING_MAX 8	/* Maximum local host IP addresses */
3792
3793/* Arp offload statistic counts */
3794struct arp_ol_stats_t {
3795	uint32  host_ip_entries;	/* Host IP table addresses (more than one if multihomed) */
3796	uint32  host_ip_overflow;	/* Host IP table additions skipped due to overflow */
3797
3798	uint32  arp_table_entries;	/* ARP table entries */
3799	uint32  arp_table_overflow;	/* ARP table additions skipped due to overflow */
3800
3801	uint32  host_request;		/* ARP requests from host */
3802	uint32  host_reply;		/* ARP replies from host */
3803	uint32  host_service;		/* ARP requests from host serviced by ARP Agent */
3804
3805	uint32  peer_request;		/* ARP requests received from network */
3806	uint32  peer_request_drop;	/* ARP requests from network that were dropped */
3807	uint32  peer_reply;		/* ARP replies received from network */
3808	uint32  peer_reply_drop;	/* ARP replies from network that were dropped */
3809	uint32  peer_service;		/* ARP request from host serviced by ARP Agent */
3810};
3811
3812/* NS offload statistic counts */
3813struct nd_ol_stats_t {
3814	uint32  host_ip_entries;    /* Host IP table addresses (more than one if multihomed) */
3815	uint32  host_ip_overflow;   /* Host IP table additions skipped due to overflow */
3816	uint32  peer_request;       /* NS requests received from network */
3817	uint32  peer_request_drop;  /* NS requests from network that were dropped */
3818	uint32  peer_reply_drop;    /* NA replies from network that were dropped */
3819	uint32  peer_service;       /* NS request from host serviced by firmware */
3820};
3821
3822/*
3823 * Keep-alive packet offloading.
3824 */
3825
3826/* NAT keep-alive packets format: specifies the re-transmission period, the packet
3827 * length, and packet contents.
3828 */
3829typedef struct wl_keep_alive_pkt {
3830	uint32	period_msec;	/* Retransmission period (0 to disable packet re-transmits) */
3831	uint16	len_bytes;	/* Size of packet to transmit (0 to disable packet re-transmits) */
3832	uint8	data[1];	/* Variable length packet to transmit.  Contents should include
3833				 * entire ethernet packet (enet header, IP header, UDP header,
3834				 * and UDP payload) in network byte order.
3835				 */
3836} wl_keep_alive_pkt_t;
3837
3838#define WL_KEEP_ALIVE_FIXED_LEN		OFFSETOF(wl_keep_alive_pkt_t, data)
3839
3840/*
3841 * Dongle pattern matching filter.
3842 */
3843
3844/* Packet filter types. Currently, only pattern matching is supported. */
3845typedef enum wl_pkt_filter_type {
3846	WL_PKT_FILTER_TYPE_PATTERN_MATCH	/* Pattern matching filter */
3847} wl_pkt_filter_type_t;
3848
3849#define WL_PKT_FILTER_TYPE wl_pkt_filter_type_t
3850
3851/* Pattern matching filter. Specifies an offset within received packets to
3852 * start matching, the pattern to match, the size of the pattern, and a bitmask
3853 * that indicates which bits within the pattern should be matched.
3854 */
3855typedef struct wl_pkt_filter_pattern {
3856	uint32	offset;		/* Offset within received packet to start pattern matching.
3857				 * Offset '0' is the first byte of the ethernet header.
3858				 */
3859	uint32	size_bytes;	/* Size of the pattern.  Bitmask must be the same size. */
3860	uint8   mask_and_pattern[1]; /* Variable length mask and pattern data.  mask starts
3861				      * at offset 0.  Pattern immediately follows mask.
3862				      */
3863} wl_pkt_filter_pattern_t;
3864
3865/* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
3866typedef struct wl_pkt_filter {
3867	uint32	id;		/* Unique filter id, specified by app. */
3868	uint32	type;		/* Filter type (WL_PKT_FILTER_TYPE_xxx). */
3869	uint32	negate_match;	/* Negate the result of filter matches */
3870	union {			/* Filter definitions */
3871		wl_pkt_filter_pattern_t pattern;	/* Pattern matching filter */
3872	} u;
3873} wl_pkt_filter_t;
3874
3875#define WL_PKT_FILTER_FIXED_LEN		  OFFSETOF(wl_pkt_filter_t, u)
3876#define WL_PKT_FILTER_PATTERN_FIXED_LEN	  OFFSETOF(wl_pkt_filter_pattern_t, mask_and_pattern)
3877
3878/* IOVAR "pkt_filter_enable" parameter. */
3879typedef struct wl_pkt_filter_enable {
3880	uint32	id;		/* Unique filter id */
3881	uint32	enable;		/* Enable/disable bool */
3882} wl_pkt_filter_enable_t;
3883
3884/* IOVAR "pkt_filter_list" parameter. Used to retrieve a list of installed filters. */
3885typedef struct wl_pkt_filter_list {
3886	uint32	num;		/* Number of installed packet filters */
3887	wl_pkt_filter_t	filter[1];	/* Variable array of packet filters. */
3888} wl_pkt_filter_list_t;
3889
3890#define WL_PKT_FILTER_LIST_FIXED_LEN	  OFFSETOF(wl_pkt_filter_list_t, filter)
3891
3892/* IOVAR "pkt_filter_stats" parameter. Used to retrieve debug statistics. */
3893typedef struct wl_pkt_filter_stats {
3894	uint32	num_pkts_matched;	/* # filter matches for specified filter id */
3895	uint32	num_pkts_forwarded;	/* # packets fwded from dongle to host for all filters */
3896	uint32	num_pkts_discarded;	/* # packets discarded by dongle for all filters */
3897} wl_pkt_filter_stats_t;
3898
3899/* Sequential Commands ioctl */
3900typedef struct wl_seq_cmd_ioctl {
3901	uint32 cmd;		/* common ioctl definition */
3902	uint32 len;		/* length of user buffer */
3903} wl_seq_cmd_ioctl_t;
3904
3905#define WL_SEQ_CMD_ALIGN_BYTES	4
3906
3907/* These are the set of get IOCTLs that should be allowed when using
3908 * IOCTL sequence commands. These are issued implicitly by wl.exe each time
3909 * it is invoked. We never want to buffer these, or else wl.exe will stop working.
3910 */
3911#define WL_SEQ_CMDS_GET_IOCTL_FILTER(cmd) \
3912	(((cmd) == WLC_GET_MAGIC)		|| \
3913	 ((cmd) == WLC_GET_VERSION)		|| \
3914	 ((cmd) == WLC_GET_AP)			|| \
3915	 ((cmd) == WLC_GET_INSTANCE))
3916
3917/*
3918 * Packet engine interface
3919 */
3920
3921#define WL_PKTENG_PER_TX_START			0x01
3922#define WL_PKTENG_PER_TX_STOP			0x02
3923#define WL_PKTENG_PER_RX_START			0x04
3924#define WL_PKTENG_PER_RX_WITH_ACK_START 	0x05
3925#define WL_PKTENG_PER_TX_WITH_ACK_START 	0x06
3926#define WL_PKTENG_PER_RX_STOP			0x08
3927#define WL_PKTENG_PER_MASK			0xff
3928
3929#define WL_PKTENG_SYNCHRONOUS			0x100	/* synchronous flag */
3930
3931typedef struct wl_pkteng {
3932	uint32 flags;
3933	uint32 delay;			/* Inter-packet delay */
3934	uint32 nframes;			/* Number of frames */
3935	uint32 length;			/* Packet length */
3936	uint8  seqno;			/* Enable/disable sequence no. */
3937	struct ether_addr dest;		/* Destination address */
3938	struct ether_addr src;		/* Source address */
3939} wl_pkteng_t;
3940
3941#define NUM_80211b_RATES	4
3942#define NUM_80211ag_RATES	8
3943#define NUM_80211n_RATES	32
3944#define NUM_80211_RATES		(NUM_80211b_RATES+NUM_80211ag_RATES+NUM_80211n_RATES)
3945typedef struct wl_pkteng_stats {
3946	uint32 lostfrmcnt;		/* RX PER test: no of frames lost (skip seqno) */
3947	int32 rssi;			/* RSSI */
3948	int32 snr;			/* signal to noise ratio */
3949	uint16 rxpktcnt[NUM_80211_RATES+1];
3950} wl_pkteng_stats_t;
3951
3952
3953#define WL_WOWL_MAGIC       (1 << 0)    /* Wakeup on Magic packet */
3954#define WL_WOWL_NET         (1 << 1)    /* Wakeup on Netpattern */
3955#define WL_WOWL_DIS         (1 << 2)    /* Wakeup on loss-of-link due to Disassoc/Deauth */
3956#define WL_WOWL_RETR        (1 << 3)    /* Wakeup on retrograde TSF */
3957#define WL_WOWL_BCN         (1 << 4)    /* Wakeup on loss of beacon */
3958#define WL_WOWL_TST         (1 << 5)    /* Wakeup after test */
3959#define WL_WOWL_M1          (1 << 6)    /* Wakeup after PTK refresh */
3960#define WL_WOWL_EAPID       (1 << 7)    /* Wakeup after receipt of EAP-Identity Req */
3961#define WL_WOWL_PME_GPIO    (1 << 8)    /* Wakeind via PME(0) or GPIO(1) */
3962#define WL_WOWL_NEEDTKIP1   (1 << 9)    /* need tkip phase 1 key to be updated by the driver */
3963#define WL_WOWL_GTK_FAILURE (1 << 10)   /* enable wakeup if GTK fails */
3964#define WL_WOWL_EXTMAGPAT   (1 << 11)   /* support extended magic packets */
3965#define WL_WOWL_ARPOFFLOAD  (1 << 12)   /* support ARP/NS/keepalive offloading */
3966#define WL_WOWL_WPA2        (1 << 13)   /* read protocol version for EAPOL frames */
3967#define WL_WOWL_KEYROT      (1 << 14)   /* If the bit is set, use key rotaton */
3968#define WL_WOWL_BCAST       (1 << 15)   /* If the bit is set, frm received was bcast frame */
3969
3970#define MAGIC_PKT_MINLEN 102    /* Magic pkt min length is 6 * 0xFF + 16 * ETHER_ADDR_LEN */
3971
3972#define WOWL_PATTEN_TYPE_ARP	(1 << 0)	/* ARP offload Pattern */
3973#define WOWL_PATTEN_TYPE_NA		(1 << 1)	/* NA offload Pattern */
3974
3975typedef struct {
3976	uint32 masksize;		/* Size of the mask in #of bytes */
3977	uint32 offset;			/* Offset to start looking for the packet in # of bytes */
3978	uint32 patternoffset;	/* Offset of start of pattern in the structure */
3979	uint32 patternsize;		/* Size of the pattern itself in #of bytes */
3980	uint32 id;				/* id */
3981	uint32 reasonsize;		/* Size of the wakeup reason code */
3982	uint32 flags;			/* Flags to tell the pattern type and other properties */
3983	/* Mask follows the structure above */
3984	/* Pattern follows the mask is at 'patternoffset' from the start */
3985} wl_wowl_pattern_t;
3986
3987typedef struct {
3988	uint			count;
3989	wl_wowl_pattern_t	pattern[1];
3990} wl_wowl_pattern_list_t;
3991
3992typedef struct {
3993	uint8	pci_wakeind;	/* Whether PCI PMECSR PMEStatus bit was set */
3994	uint16	ucode_wakeind;	/* What wakeup-event indication was set by ucode */
3995} wl_wowl_wakeind_t;
3996
3997
3998/* per AC rate control related data structure */
3999typedef struct wl_txrate_class {
4000	uint8		init_rate;
4001	uint8		min_rate;
4002	uint8		max_rate;
4003} wl_txrate_class_t;
4004
4005
4006
4007/* Overlap BSS Scan parameters default, minimum, maximum */
4008#define WLC_OBSS_SCAN_PASSIVE_DWELL_DEFAULT		20	/* unit TU */
4009#define WLC_OBSS_SCAN_PASSIVE_DWELL_MIN			5	/* unit TU */
4010#define WLC_OBSS_SCAN_PASSIVE_DWELL_MAX			1000	/* unit TU */
4011#define WLC_OBSS_SCAN_ACTIVE_DWELL_DEFAULT		10	/* unit TU */
4012#define WLC_OBSS_SCAN_ACTIVE_DWELL_MIN			10	/* unit TU */
4013#define WLC_OBSS_SCAN_ACTIVE_DWELL_MAX			1000	/* unit TU */
4014#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_DEFAULT	300	/* unit Sec */
4015#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_MIN		10	/* unit Sec */
4016#define WLC_OBSS_SCAN_WIDTHSCAN_INTERVAL_MAX		900	/* unit Sec */
4017#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_DEFAULT	5
4018#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_MIN	5
4019#define WLC_OBSS_SCAN_CHANWIDTH_TRANSITION_DLY_MAX	100
4020#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_DEFAULT	200	/* unit TU */
4021#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_MIN	200	/* unit TU */
4022#define WLC_OBSS_SCAN_PASSIVE_TOTAL_PER_CHANNEL_MAX	10000	/* unit TU */
4023#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_DEFAULT	20	/* unit TU */
4024#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_MIN	20	/* unit TU */
4025#define WLC_OBSS_SCAN_ACTIVE_TOTAL_PER_CHANNEL_MAX	10000	/* unit TU */
4026#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_DEFAULT	25	/* unit percent */
4027#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_MIN		0	/* unit percent */
4028#define WLC_OBSS_SCAN_ACTIVITY_THRESHOLD_MAX		100	/* unit percent */
4029
4030/* structure for Overlap BSS scan arguments */
4031typedef struct wl_obss_scan_arg {
4032	int16	passive_dwell;
4033	int16	active_dwell;
4034	int16	bss_widthscan_interval;
4035	int16	passive_total;
4036	int16	active_total;
4037	int16	chanwidth_transition_delay;
4038	int16	activity_threshold;
4039} wl_obss_scan_arg_t;
4040
4041#define WL_OBSS_SCAN_PARAM_LEN	sizeof(wl_obss_scan_arg_t)
4042#define WL_MIN_NUM_OBSS_SCAN_ARG 7	/* minimum number of arguments required for OBSS Scan */
4043
4044#define WL_COEX_INFO_MASK		0x07
4045#define WL_COEX_INFO_REQ		0x01
4046#define	WL_COEX_40MHZ_INTOLERANT	0x02
4047#define	WL_COEX_WIDTH20			0x04
4048
4049#define	WLC_RSSI_INVALID	 0	/* invalid RSSI value */
4050
4051#define MAX_RSSI_LEVELS 8
4052
4053/* RSSI event notification configuration. */
4054typedef struct wl_rssi_event {
4055	uint32 rate_limit_msec;		/* # of events posted to application will be limited to
4056					 * one per specified period (0 to disable rate limit).
4057					 */
4058	uint8 num_rssi_levels;		/* Number of entries in rssi_levels[] below */
4059	int8 rssi_levels[MAX_RSSI_LEVELS];	/* Variable number of RSSI levels. An event
4060						 * will be posted each time the RSSI of received
4061						 * beacons/packets crosses a level.
4062						 */
4063} wl_rssi_event_t;
4064
4065typedef struct wl_action_obss_coex_req {
4066	uint8 info;
4067	uint8 num;
4068	uint8 ch_list[1];
4069} wl_action_obss_coex_req_t;
4070
4071
4072/* IOVar parameter block for small MAC address array with type indicator */
4073#define WL_IOV_MAC_PARAM_LEN  4
4074
4075#define WL_IOV_PKTQ_LOG_PRECS 16
4076
4077typedef struct {
4078	uint32 num_addrs;
4079	char   addr_type[WL_IOV_MAC_PARAM_LEN];
4080	struct ether_addr ea[WL_IOV_MAC_PARAM_LEN];
4081} wl_iov_mac_params_t;
4082
4083
4084/* Parameter block for PKTQ_LOG statistics */
4085typedef struct {
4086	uint32 requested;      /* packets requested to be stored */
4087	uint32 stored;         /* packets stored */
4088	uint32 saved;          /* packets saved,
4089	                          because a lowest priority queue has given away one packet
4090	                       */
4091	uint32 selfsaved;      /* packets saved,
4092	                          because an older packet from the same queue has been dropped
4093	                       */
4094	uint32 full_dropped;   /* packets dropped,
4095	                          because pktq is full with higher precedence packets
4096	                       */
4097	uint32 dropped;        /* packets dropped because pktq per that precedence is full */
4098	uint32 sacrificed;     /* packets dropped,
4099	                          in order to save one from a queue of a highest priority
4100	                       */
4101	uint32 busy;           /* packets droped because of hardware/transmission error */
4102	uint32 retry;          /* packets re-sent because they were not received */
4103	uint32 ps_retry;       /* packets retried again prior to moving power save mode */
4104	uint32 retry_drop;     /* packets finally dropped after retry limit */
4105	uint32 max_avail;      /* the high-water mark of the queue capacity for packets -
4106	                          goes to zero as queue fills
4107	                       */
4108	uint32 max_used;       /* the high-water mark of the queue utilisation for packets -
4109	                          increases with use ('inverse' of max_avail)
4110	                       */
4111	uint32 queue_capacity; /* the maximum capacity of the queue */
4112} pktq_log_counters_v01_t;
4113
4114#define sacrified sacrificed
4115
4116typedef struct {
4117	uint8                num_prec[WL_IOV_MAC_PARAM_LEN];
4118	pktq_log_counters_v01_t  counters[WL_IOV_MAC_PARAM_LEN][WL_IOV_PKTQ_LOG_PRECS];
4119	char                 headings[1];
4120} pktq_log_format_v01_t;
4121
4122
4123typedef struct {
4124	uint32               version;
4125	wl_iov_mac_params_t  params;
4126	union {
4127		pktq_log_format_v01_t v01;
4128	} pktq_log;
4129} wl_iov_pktq_log_t;
4130
4131
4132/* **** EXTLOG **** */
4133#define EXTLOG_CUR_VER		0x0100
4134
4135#define MAX_ARGSTR_LEN		18 /* At least big enough for storing ETHER_ADDR_STR_LEN */
4136
4137/* log modules (bitmap) */
4138#define LOG_MODULE_COMMON	0x0001
4139#define LOG_MODULE_ASSOC	0x0002
4140#define LOG_MODULE_EVENT	0x0004
4141#define LOG_MODULE_MAX		3			/* Update when adding module */
4142
4143/* log levels */
4144#define WL_LOG_LEVEL_DISABLE	0
4145#define WL_LOG_LEVEL_ERR	1
4146#define WL_LOG_LEVEL_WARN	2
4147#define WL_LOG_LEVEL_INFO	3
4148#define WL_LOG_LEVEL_MAX	WL_LOG_LEVEL_INFO	/* Update when adding level */
4149
4150/* flag */
4151#define LOG_FLAG_EVENT		1
4152
4153/* log arg_type */
4154#define LOG_ARGTYPE_NULL	0
4155#define LOG_ARGTYPE_STR		1	/* %s */
4156#define LOG_ARGTYPE_INT		2	/* %d */
4157#define LOG_ARGTYPE_INT_STR	3	/* %d...%s */
4158#define LOG_ARGTYPE_STR_INT	4	/* %s...%d */
4159
4160typedef struct wlc_extlog_cfg {
4161	int max_number;
4162	uint16 module;	/* bitmap */
4163	uint8 level;
4164	uint8 flag;
4165	uint16 version;
4166} wlc_extlog_cfg_t;
4167
4168typedef struct log_record {
4169	uint32 time;
4170	uint16 module;
4171	uint16 id;
4172	uint8 level;
4173	uint8 sub_unit;
4174	uint8 seq_num;
4175	int32 arg;
4176	char str[MAX_ARGSTR_LEN];
4177} log_record_t;
4178
4179typedef struct wlc_extlog_req {
4180	uint32 from_last;
4181	uint32 num;
4182} wlc_extlog_req_t;
4183
4184typedef struct wlc_extlog_results {
4185	uint16 version;
4186	uint16 record_len;
4187	uint32 num;
4188	log_record_t logs[1];
4189} wlc_extlog_results_t;
4190
4191typedef struct log_idstr {
4192	uint16	id;
4193	uint16	flag;
4194	uint8	arg_type;
4195	const char	*fmt_str;
4196} log_idstr_t;
4197
4198#define FMTSTRF_USER		1
4199
4200/* flat ID definitions
4201 * New definitions HAVE TO BE ADDED at the end of the table. Otherwise, it will
4202 * affect backward compatibility with pre-existing apps
4203 */
4204typedef enum {
4205	FMTSTR_DRIVER_UP_ID = 0,
4206	FMTSTR_DRIVER_DOWN_ID = 1,
4207	FMTSTR_SUSPEND_MAC_FAIL_ID = 2,
4208	FMTSTR_NO_PROGRESS_ID = 3,
4209	FMTSTR_RFDISABLE_ID = 4,
4210	FMTSTR_REG_PRINT_ID = 5,
4211	FMTSTR_EXPTIME_ID = 6,
4212	FMTSTR_JOIN_START_ID = 7,
4213	FMTSTR_JOIN_COMPLETE_ID = 8,
4214	FMTSTR_NO_NETWORKS_ID = 9,
4215	FMTSTR_SECURITY_MISMATCH_ID = 10,
4216	FMTSTR_RATE_MISMATCH_ID = 11,
4217	FMTSTR_AP_PRUNED_ID = 12,
4218	FMTSTR_KEY_INSERTED_ID = 13,
4219	FMTSTR_DEAUTH_ID = 14,
4220	FMTSTR_DISASSOC_ID = 15,
4221	FMTSTR_LINK_UP_ID = 16,
4222	FMTSTR_LINK_DOWN_ID = 17,
4223	FMTSTR_RADIO_HW_OFF_ID = 18,
4224	FMTSTR_RADIO_HW_ON_ID = 19,
4225	FMTSTR_EVENT_DESC_ID = 20,
4226	FMTSTR_PNP_SET_POWER_ID = 21,
4227	FMTSTR_RADIO_SW_OFF_ID = 22,
4228	FMTSTR_RADIO_SW_ON_ID = 23,
4229	FMTSTR_PWD_MISMATCH_ID = 24,
4230	FMTSTR_FATAL_ERROR_ID = 25,
4231	FMTSTR_AUTH_FAIL_ID = 26,
4232	FMTSTR_ASSOC_FAIL_ID = 27,
4233	FMTSTR_IBSS_FAIL_ID = 28,
4234	FMTSTR_EXTAP_FAIL_ID = 29,
4235	FMTSTR_MAX_ID
4236} log_fmtstr_id_t;
4237
4238#ifdef DONGLEOVERLAYS
4239typedef struct {
4240	uint32 flags_idx;	/* lower 8 bits: overlay index; upper 24 bits: flags */
4241	uint32 offset;		/* offset into overlay region to write code */
4242	uint32 len;			/* overlay code len */
4243	/* overlay code follows this struct */
4244} wl_ioctl_overlay_t;
4245
4246#define OVERLAY_IDX_MASK		0x000000ff
4247#define OVERLAY_IDX_SHIFT		0
4248#define OVERLAY_FLAGS_MASK		0xffffff00
4249#define OVERLAY_FLAGS_SHIFT		8
4250/* overlay written to device memory immediately after loading the base image */
4251#define OVERLAY_FLAG_POSTLOAD	0x100
4252/* defer overlay download until the device responds w/WLC_E_OVL_DOWNLOAD event */
4253#define OVERLAY_FLAG_DEFER_DL	0x200
4254/* overlay downloaded prior to the host going to sleep */
4255#define OVERLAY_FLAG_PRESLEEP	0x400
4256
4257#define OVERLAY_DOWNLOAD_CHUNKSIZE	1024
4258#endif /* DONGLEOVERLAYS */
4259
4260/* no default structure packing */
4261#include <packed_section_end.h>
4262
4263/* require strict packing */
4264#include <packed_section_start.h>
4265/* Structures and constants used for "vndr_ie" IOVar interface */
4266#define VNDR_IE_CMD_LEN		4	/* length of the set command string:
4267					 * "add", "del" (+ NUL)
4268					 */
4269
4270/* 802.11 Mgmt Packet flags */
4271#define VNDR_IE_BEACON_FLAG	0x1
4272#define VNDR_IE_PRBRSP_FLAG	0x2
4273#define VNDR_IE_ASSOCRSP_FLAG	0x4
4274#define VNDR_IE_AUTHRSP_FLAG	0x8
4275#define VNDR_IE_PRBREQ_FLAG	0x10
4276#define VNDR_IE_ASSOCREQ_FLAG	0x20
4277#define VNDR_IE_IWAPID_FLAG	0x40 /* vendor IE in IW advertisement protocol ID field */
4278#define VNDR_IE_CUSTOM_FLAG	0x100 /* allow custom IE id */
4279
4280#define VNDR_IE_INFO_HDR_LEN	(sizeof(uint32))
4281
4282typedef BWL_PRE_PACKED_STRUCT struct {
4283	uint32 pktflag;			/* bitmask indicating which packet(s) contain this IE */
4284	vndr_ie_t vndr_ie_data;		/* vendor IE data */
4285} BWL_POST_PACKED_STRUCT vndr_ie_info_t;
4286
4287typedef BWL_PRE_PACKED_STRUCT struct {
4288	int iecount;			/* number of entries in the vndr_ie_list[] array */
4289	vndr_ie_info_t vndr_ie_list[1];	/* variable size list of vndr_ie_info_t structs */
4290} BWL_POST_PACKED_STRUCT vndr_ie_buf_t;
4291
4292typedef BWL_PRE_PACKED_STRUCT struct {
4293	char cmd[VNDR_IE_CMD_LEN];	/* vndr_ie IOVar set command : "add", "del" + NUL */
4294	vndr_ie_buf_t vndr_ie_buffer;	/* buffer containing Vendor IE list information */
4295} BWL_POST_PACKED_STRUCT vndr_ie_setbuf_t;
4296
4297/* tag_ID/length/value_buffer tuple */
4298typedef BWL_PRE_PACKED_STRUCT struct {
4299	uint8	id;
4300	uint8	len;
4301	uint8	data[1];
4302} BWL_POST_PACKED_STRUCT tlv_t;
4303
4304typedef BWL_PRE_PACKED_STRUCT struct {
4305	uint32 pktflag;			/* bitmask indicating which packet(s) contain this IE */
4306	tlv_t ie_data;		/* IE data */
4307} BWL_POST_PACKED_STRUCT ie_info_t;
4308
4309typedef BWL_PRE_PACKED_STRUCT struct {
4310	int iecount;			/* number of entries in the ie_list[] array */
4311	ie_info_t ie_list[1];	/* variable size list of ie_info_t structs */
4312} BWL_POST_PACKED_STRUCT ie_buf_t;
4313
4314typedef BWL_PRE_PACKED_STRUCT struct {
4315	char cmd[VNDR_IE_CMD_LEN];	/* ie IOVar set command : "add" + NUL */
4316	ie_buf_t ie_buffer;	/* buffer containing IE list information */
4317} BWL_POST_PACKED_STRUCT ie_setbuf_t;
4318
4319typedef BWL_PRE_PACKED_STRUCT struct {
4320	uint32 pktflag;		/* bitmask indicating which packet(s) contain this IE */
4321	uint8 id;		/* IE type */
4322} BWL_POST_PACKED_STRUCT ie_getbuf_t;
4323
4324/* structures used to define format of wps ie data from probe requests */
4325/* passed up to applications via iovar "prbreq_wpsie" */
4326typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_hdr {
4327	struct ether_addr staAddr;
4328	uint16 ieLen;
4329} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_hdr_t;
4330
4331typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_data {
4332	sta_prbreq_wps_ie_hdr_t hdr;
4333	uint8 ieData[1];
4334} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_data_t;
4335
4336typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_list {
4337	uint32 totLen;
4338	uint8 ieDataList[1];
4339} BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_list_t;
4340
4341
4342#ifdef WLMEDIA_TXFAILEVENT
4343typedef BWL_PRE_PACKED_STRUCT struct {
4344	char   dest[ETHER_ADDR_LEN]; /* destination MAC */
4345	uint8  prio;            /* Packet Priority */
4346	uint8  flags;           /* Flags           */
4347	uint32 tsf_l;           /* TSF timer low   */
4348	uint32 tsf_h;           /* TSF timer high  */
4349	uint16 rates;           /* Main Rates      */
4350	uint16 txstatus;        /* TX Status       */
4351} BWL_POST_PACKED_STRUCT txfailinfo_t;
4352#endif /* WLMEDIA_TXFAILEVENT */
4353
4354/* no strict structure packing */
4355#include <packed_section_end.h>
4356
4357/* Global ASSERT Logging */
4358#define ASSERTLOG_CUR_VER	0x0100
4359#define MAX_ASSRTSTR_LEN	64
4360
4361typedef struct assert_record {
4362	uint32 time;
4363	uint8 seq_num;
4364	char str[MAX_ASSRTSTR_LEN];
4365} assert_record_t;
4366
4367typedef struct assertlog_results {
4368	uint16 version;
4369	uint16 record_len;
4370	uint32 num;
4371	assert_record_t logs[1];
4372} assertlog_results_t;
4373
4374#define LOGRRC_FIX_LEN	8
4375#define IOBUF_ALLOWED_NUM_OF_LOGREC(type, len) ((len - LOGRRC_FIX_LEN)/sizeof(type))
4376
4377#ifdef BCMWAPI_WAI
4378#define IV_LEN 16
4379struct wapi_sta_msg_t
4380{
4381	uint16	msg_type;
4382	uint16	datalen;
4383	uint8	vap_mac[6];
4384	uint8	reserve_data1[2];
4385	uint8	sta_mac[6];
4386	uint8	reserve_data2[2];
4387	uint8	gsn[IV_LEN];
4388	uint8	wie[256];
4389};
4390#endif /* BCMWAPI_WAI */
4391
4392/* channel interference measurement (chanim) related defines */
4393
4394/* chanim mode */
4395#define CHANIM_DISABLE	0	/* disabled */
4396#define CHANIM_DETECT	1	/* detection only */
4397#define CHANIM_EXT		2 	/* external state machine */
4398#define CHANIM_ACT		3	/* full internal state machine, detect + act */
4399#define CHANIM_MODE_MAX 4
4400
4401/* define for apcs reason code */
4402#define APCS_INIT		0
4403#define APCS_IOCTL 		1
4404#define APCS_CHANIM 	2
4405#define APCS_CSTIMER	3
4406#define APCS_BTA		4
4407
4408/* number of ACS record entries */
4409#define CHANIM_ACS_RECORD			10
4410
4411/* CHANIM */
4412#define CCASTATS_TXDUR  0
4413#define CCASTATS_INBSS  1
4414#define CCASTATS_OBSS   2
4415#define CCASTATS_NOCTG  3
4416#define CCASTATS_NOPKT  4
4417#define CCASTATS_DOZE   5
4418#define CCASTATS_TXOP	6
4419#define CCASTATS_GDTXDUR        7
4420#define CCASTATS_BDTXDUR        8
4421#define CCASTATS_MAX    9
4422
4423/* chanim acs record */
4424typedef struct {
4425	bool valid;
4426	uint8 trigger;
4427	chanspec_t selected_chspc;
4428	int8 bgnoise;
4429	uint32 glitch_cnt;
4430	uint8 ccastats;
4431	uint timestamp;
4432} chanim_acs_record_t;
4433
4434typedef struct {
4435	chanim_acs_record_t acs_record[CHANIM_ACS_RECORD];
4436	uint8 count;
4437	uint timestamp;
4438} wl_acs_record_t;
4439
4440typedef struct chanim_stats {
4441	uint32 glitchcnt;               /* normalized as per second count */
4442	uint32 badplcp;                 /* normalized as per second count */
4443	uint8 ccastats[CCASTATS_MAX]; 	/* normalized as 0-255 */
4444	int8 bgnoise;					/* background noise level (in dBm) */
4445	chanspec_t chanspec;
4446	uint32 timestamp;
4447} chanim_stats_t;
4448
4449#define WL_CHANIM_STATS_VERSION 1
4450#define WL_CHANIM_COUNT_ALL	0xff
4451#define WL_CHANIM_COUNT_ONE	0x1
4452
4453typedef struct {
4454	uint32 buflen;
4455	uint32 version;
4456	uint32 count;
4457	chanim_stats_t stats[1];
4458} wl_chanim_stats_t;
4459
4460#define WL_CHANIM_STATS_FIXED_LEN OFFSETOF(wl_chanim_stats_t, stats)
4461
4462/* Noise measurement metrics. */
4463#define NOISE_MEASURE_KNOISE	0x1
4464
4465/* scb probe parameter */
4466typedef struct {
4467	uint32 scb_timeout;
4468	uint32 scb_activity_time;
4469	uint32 scb_max_probe;
4470} wl_scb_probe_t;
4471
4472/* ap tpc modes */
4473#define	AP_TPC_OFF		0
4474#define	AP_TPC_BSS_PWR		1	/* BSS power control */
4475#define AP_TPC_AP_PWR		2	/* AP power control */
4476#define	AP_TPC_AP_BSS_PWR	3	/* Both AP and BSS power control */
4477#define AP_TPC_MAX_LINK_MARGIN	127
4478
4479/* ap tpc modes */
4480#define	AP_TPC_OFF		0
4481#define	AP_TPC_BSS_PWR		1	/* BSS power control */
4482#define AP_TPC_AP_PWR		2	/* AP power control */
4483#define	AP_TPC_AP_BSS_PWR	3	/* Both AP and BSS power control */
4484#define AP_TPC_MAX_LINK_MARGIN	127
4485
4486/* structure/defines for selective mgmt frame (smf) stats support */
4487
4488#define SMFS_VERSION 1
4489/* selected mgmt frame (smf) stats element */
4490typedef struct wl_smfs_elem {
4491	uint32 count;
4492	uint16 code;  /* SC or RC code */
4493} wl_smfs_elem_t;
4494
4495typedef struct wl_smf_stats {
4496	uint32 version;
4497	uint16 length;	/* reserved for future usage */
4498	uint8 type;
4499	uint8 codetype;
4500	uint32 ignored_cnt;
4501	uint32 malformed_cnt;
4502	uint32 count_total; /* count included the interested group */
4503	wl_smfs_elem_t elem[1];
4504} wl_smf_stats_t;
4505
4506#define WL_SMFSTATS_FIXED_LEN OFFSETOF(wl_smf_stats_t, elem);
4507
4508enum {
4509	SMFS_CODETYPE_SC,
4510	SMFS_CODETYPE_RC
4511};
4512
4513/* reuse two number in the sc/rc space */
4514#define	SMFS_CODE_MALFORMED 0xFFFE
4515#define SMFS_CODE_IGNORED 	0xFFFD
4516
4517typedef enum smfs_type {
4518	SMFS_TYPE_AUTH,
4519	SMFS_TYPE_ASSOC,
4520	SMFS_TYPE_REASSOC,
4521	SMFS_TYPE_DISASSOC_TX,
4522	SMFS_TYPE_DISASSOC_RX,
4523	SMFS_TYPE_DEAUTH_TX,
4524	SMFS_TYPE_DEAUTH_RX,
4525	SMFS_TYPE_MAX
4526} smfs_type_t;
4527
4528#ifdef PHYMON
4529
4530#define PHYMON_VERSION 1
4531
4532typedef struct wl_phycal_core_state {
4533	/* Tx IQ/LO calibration coeffs */
4534	int16 tx_iqlocal_a;
4535	int16 tx_iqlocal_b;
4536	int8 tx_iqlocal_ci;
4537	int8 tx_iqlocal_cq;
4538	int8 tx_iqlocal_di;
4539	int8 tx_iqlocal_dq;
4540	int8 tx_iqlocal_ei;
4541	int8 tx_iqlocal_eq;
4542	int8 tx_iqlocal_fi;
4543	int8 tx_iqlocal_fq;
4544
4545	/* Rx IQ calibration coeffs */
4546	int16 rx_iqcal_a;
4547	int16 rx_iqcal_b;
4548
4549	uint8 tx_iqlocal_pwridx; /* Tx Power Index for Tx IQ/LO calibration */
4550	uint32 papd_epsilon_table[64]; /* PAPD epsilon table */
4551	int16 papd_epsilon_offset; /* PAPD epsilon offset */
4552	uint8 curr_tx_pwrindex; /* Tx power index */
4553	int8 idle_tssi; /* Idle TSSI */
4554	int8 est_tx_pwr; /* Estimated Tx Power (dB) */
4555	int8 est_rx_pwr; /* Estimated Rx Power (dB) from RSSI */
4556	uint16 rx_gaininfo; /* Rx gain applied on last Rx pkt */
4557	uint16 init_gaincode; /* initgain required for ACI */
4558	int8 estirr_tx;
4559	int8 estirr_rx;
4560
4561} wl_phycal_core_state_t;
4562
4563typedef struct wl_phycal_state {
4564	int version;
4565	int8 num_phy_cores; /* number of cores */
4566	int8 curr_temperature; /* on-chip temperature sensor reading */
4567	chanspec_t chspec; /* channspec for this state */
4568	bool aci_state; /* ACI state: ON/OFF */
4569	uint16 crsminpower; /* crsminpower required for ACI */
4570	uint16 crsminpowerl; /* crsminpowerl required for ACI */
4571	uint16 crsminpoweru; /* crsminpoweru required for ACI */
4572	wl_phycal_core_state_t phycal_core[1];
4573} wl_phycal_state_t;
4574
4575#define WL_PHYCAL_STAT_FIXED_LEN OFFSETOF(wl_phycal_state_t, phycal_core)
4576#endif /* PHYMON */
4577
4578/* discovery state */
4579typedef struct wl_p2p_disc_st {
4580	uint8 state;	/* see state */
4581	chanspec_t chspec;	/* valid in listen state */
4582	uint16 dwell;	/* valid in listen state, in ms */
4583} wl_p2p_disc_st_t;
4584
4585/* state */
4586#define WL_P2P_DISC_ST_SCAN	0
4587#define WL_P2P_DISC_ST_LISTEN	1
4588#define WL_P2P_DISC_ST_SEARCH	2
4589
4590/* scan request */
4591typedef struct wl_p2p_scan {
4592	uint8 type;		/* 'S' for WLC_SCAN, 'E' for "escan" */
4593	uint8 reserved[3];
4594	/* scan or escan parms... */
4595} wl_p2p_scan_t;
4596
4597/* i/f request */
4598typedef struct wl_p2p_if {
4599	struct ether_addr addr;
4600	uint8 type;	/* see i/f type */
4601	chanspec_t chspec;	/* for p2p_ifadd GO */
4602} wl_p2p_if_t;
4603
4604/* i/f type */
4605#define WL_P2P_IF_CLIENT	0
4606#define WL_P2P_IF_GO		1
4607#define WL_P2P_IF_DYNBCN_GO	2
4608#define WL_P2P_IF_DEV		3
4609
4610/* i/f query */
4611typedef struct wl_p2p_ifq {
4612	uint bsscfgidx;
4613	char ifname[BCM_MSG_IFNAME_MAX];
4614} wl_p2p_ifq_t;
4615
4616/* OppPS & CTWindow */
4617typedef struct wl_p2p_ops {
4618	uint8 ops;	/* 0: disable 1: enable */
4619	uint8 ctw;	/* >= 10 */
4620} wl_p2p_ops_t;
4621
4622/* absence and presence request */
4623typedef struct wl_p2p_sched_desc {
4624	uint32 start;
4625	uint32 interval;
4626	uint32 duration;
4627	uint32 count;	/* see count */
4628} wl_p2p_sched_desc_t;
4629
4630/* count */
4631#define WL_P2P_SCHED_RSVD	0
4632#define WL_P2P_SCHED_REPEAT	255	/* anything > 255 will be treated as 255 */
4633
4634typedef struct wl_p2p_sched {
4635	uint8 type;	/* see schedule type */
4636	uint8 action;	/* see schedule action */
4637	uint8 option;	/* see schedule option */
4638	wl_p2p_sched_desc_t desc[1];
4639} wl_p2p_sched_t;
4640#define WL_P2P_SCHED_FIXED_LEN		3
4641
4642/* schedule type */
4643#define WL_P2P_SCHED_TYPE_ABS		0	/* Scheduled Absence */
4644#define WL_P2P_SCHED_TYPE_REQ_ABS	1	/* Requested Absence */
4645
4646/* schedule action during absence periods (for WL_P2P_SCHED_ABS type) */
4647#define WL_P2P_SCHED_ACTION_NONE	0	/* no action */
4648#define WL_P2P_SCHED_ACTION_DOZE	1	/* doze */
4649/* schedule option - WL_P2P_SCHED_TYPE_REQ_ABS */
4650#define WL_P2P_SCHED_ACTION_GOOFF	2	/* turn off GO beacon/prbrsp functions */
4651/* schedule option - WL_P2P_SCHED_TYPE_XXX */
4652#define WL_P2P_SCHED_ACTION_RESET	255	/* reset */
4653
4654/* schedule option - WL_P2P_SCHED_TYPE_ABS */
4655#define WL_P2P_SCHED_OPTION_NORMAL	0	/* normal start/interval/duration/count */
4656#define WL_P2P_SCHED_OPTION_BCNPCT	1	/* percentage of beacon interval */
4657/* schedule option - WL_P2P_SCHED_TYPE_REQ_ABS */
4658#define WL_P2P_SCHED_OPTION_TSFOFS	2	/* normal start/internal/duration/count with
4659						 * start being an offset of the 'current' TSF
4660						 */
4661
4662/* feature flags */
4663#define WL_P2P_FEAT_GO_CSA	(1 << 0)	/* GO moves with the STA using CSA method */
4664#define WL_P2P_FEAT_GO_NOLEGACY	(1 << 1)	/* GO does not probe respond to non-p2p probe
4665						 * requests
4666						 */
4667#define WL_P2P_FEAT_RESTRICT_DEV_RESP (1 << 2)	/* Restrict p2p dev interface from responding */
4668
4669#ifdef WLNIC
4670/* nic_cnx iovar */
4671typedef struct wl_nic_cnx {
4672	uint8 opcode;
4673	struct ether_addr addr;
4674	/* the following are valid for WL_NIC_CNX_CONN */
4675	uint8 SSID_len;
4676	uint8 SSID[32];
4677	struct ether_addr abssid;
4678	uint8 join_period;
4679} wl_nic_cnx_t;
4680
4681/* opcode */
4682#define WL_NIC_CNX_ADD	0	/* add NIC connection */
4683#define WL_NIC_CNX_DEL	1	/* delete NIC connection */
4684#define WL_NIC_CNX_IDX	2	/* query NIC connection index */
4685#define WL_NIC_CNX_CONN	3	/* join/create network */
4686#define WL_NIC_CNX_DIS	4	/* disconnect from network */
4687
4688/* nic_cfg iovar */
4689typedef struct wl_nic_cfg {
4690	uint8 version;
4691	uint8 beacon_mode;
4692	uint16 beacon_interval;
4693	uint8 diluted_beacon_period;
4694	uint8 repeat_EQC;
4695	uint8 scan_length;
4696	uint8 scan_interval;
4697	uint8 scan_probability;
4698	uint8 awake_window_length;
4699	int8 TSF_correction;
4700	uint8 ASID;
4701	uint8 channel_usage_mode;
4702} wl_nic_cfg_t;
4703
4704/* version */
4705#define WL_NIC_CFG_VER	1
4706
4707/* beacon_mode */
4708#define WL_NIC_BCN_NORM		0
4709#define WL_NIC_BCN_DILUTED	1
4710
4711/* channel_usage_mode */
4712#define WL_NIC_CHAN_STATIC	0
4713#define WL_NIC_CHAN_CYCLE	1
4714
4715/* nic_cfg iovar */
4716typedef struct wl_nic_frm {
4717	uint8 type;
4718	struct ether_addr da;
4719	uint8 body[1];
4720} wl_nic_frm_t;
4721
4722/* type */
4723#define WL_NIC_FRM_MYNET	1
4724#define WL_NIC_FRM_ACTION	2
4725
4726/* i/f query */
4727typedef struct wl_nic_ifq {
4728	uint bsscfgidx;
4729	char ifname[BCM_MSG_IFNAME_MAX];
4730} wl_nic_ifq_t;
4731#endif /* WLNIC */
4732
4733/* RFAWARE def */
4734#define BCM_ACTION_RFAWARE		0x77
4735#define BCM_ACTION_RFAWARE_DCS  0x01
4736
4737/* DCS reason code define */
4738#define BCM_DCS_IOVAR		0x1
4739#define BCM_DCS_UNKNOWN		0xFF
4740
4741typedef struct wl_bcmdcs_data {
4742	uint reason;
4743	chanspec_t chspec;
4744} wl_bcmdcs_data_t;
4745
4746/* n-mode support capability */
4747/* 2x2 includes both 1x1 & 2x2 devices
4748 * reserved #define 2 for future when we want to separate 1x1 & 2x2 and
4749 * control it independently
4750 */
4751#define WL_11N_2x2			1
4752#define WL_11N_3x3			3
4753#define WL_11N_4x4			4
4754
4755/* define 11n feature disable flags */
4756#define WLFEATURE_DISABLE_11N		0x00000001
4757#define WLFEATURE_DISABLE_11N_STBC_TX	0x00000002
4758#define WLFEATURE_DISABLE_11N_STBC_RX	0x00000004
4759#define WLFEATURE_DISABLE_11N_SGI_TX	0x00000008
4760#define WLFEATURE_DISABLE_11N_SGI_RX	0x00000010
4761#define WLFEATURE_DISABLE_11N_AMPDU_TX	0x00000020
4762#define WLFEATURE_DISABLE_11N_AMPDU_RX	0x00000040
4763#define WLFEATURE_DISABLE_11N_GF	0x00000080
4764
4765/* Proxy STA modes */
4766#define PSTA_MODE_DISABLED		0
4767#define PSTA_MODE_PROXY			1
4768#define PSTA_MODE_REPEATER		2
4769
4770
4771/* NAT configuration */
4772typedef struct {
4773	uint32 ipaddr;		/* interface ip address */
4774	uint32 ipaddr_mask;	/* interface ip address mask */
4775	uint32 ipaddr_gateway;	/* gateway ip address */
4776	uint8 mac_gateway[6];	/* gateway mac address */
4777	uint32 ipaddr_dns;	/* DNS server ip address, valid only for public if */
4778	uint8 mac_dns[6];	/* DNS server mac address,  valid only for public if */
4779	uint8 GUID[38];		/* interface GUID */
4780} nat_if_info_t;
4781
4782typedef struct {
4783	uint op;		/* operation code */
4784	bool pub_if;		/* set for public if, clear for private if */
4785	nat_if_info_t if_info;	/* interface info */
4786} nat_cfg_t;
4787
4788/* op code in nat_cfg */
4789#define NAT_OP_ENABLE		1	/* enable NAT on given interface */
4790#define NAT_OP_DISABLE		2	/* disable NAT on given interface */
4791#define NAT_OP_DISABLE_ALL	3	/* disable NAT on all interfaces */
4792
4793/* NAT state */
4794#define NAT_STATE_ENABLED	1	/* NAT is enabled */
4795#define NAT_STATE_DISABLED	2	/* NAT is disabled */
4796
4797typedef struct {
4798	int state;	/* NAT state returned */
4799} nat_state_t;
4800
4801#ifdef PROP_TXSTATUS
4802/* Bit definitions for tlv iovar */
4803/*
4804 * enable RSSI signals:
4805 * WLFC_CTL_TYPE_RSSI
4806 */
4807#define WLFC_FLAGS_RSSI_SIGNALS		0x0001
4808
4809/* enable (if/mac_open, if/mac_close,, mac_add, mac_del) signals:
4810 *
4811 * WLFC_CTL_TYPE_MAC_OPEN
4812 * WLFC_CTL_TYPE_MAC_CLOSE
4813 *
4814 * WLFC_CTL_TYPE_INTERFACE_OPEN
4815 * WLFC_CTL_TYPE_INTERFACE_CLOSE
4816 *
4817 * WLFC_CTL_TYPE_MACDESC_ADD
4818 * WLFC_CTL_TYPE_MACDESC_DEL
4819 *
4820 */
4821#define WLFC_FLAGS_XONXOFF_SIGNALS	0x0002
4822
4823/* enable (status, fifo_credit, mac_credit) signals
4824 * WLFC_CTL_TYPE_MAC_REQUEST_CREDIT
4825 * WLFC_CTL_TYPE_TXSTATUS
4826 * WLFC_CTL_TYPE_FIFO_CREDITBACK
4827 */
4828#define WLFC_FLAGS_CREDIT_STATUS_SIGNALS	0x0004
4829
4830#define WLFC_FLAGS_HOST_PROPTXSTATUS_ACTIVE	0x0008
4831#define WLFC_FLAGS_PSQ_GENERATIONFSM_ENABLE	0x0010
4832#define WLFC_FLAGS_PSQ_ZERO_BUFFER_ENABLE	0x0020
4833#define WLFC_FLAGS_HOST_RXRERODER_ACTIVE	0x0040
4834#endif /* PROP_TXSTATUS */
4835
4836#define BTA_STATE_LOG_SZ	64
4837
4838/* BTAMP Statemachine states */
4839enum {
4840	HCIReset = 1,
4841	HCIReadLocalAMPInfo,
4842	HCIReadLocalAMPASSOC,
4843	HCIWriteRemoteAMPASSOC,
4844	HCICreatePhysicalLink,
4845	HCIAcceptPhysicalLinkRequest,
4846	HCIDisconnectPhysicalLink,
4847	HCICreateLogicalLink,
4848	HCIAcceptLogicalLink,
4849	HCIDisconnectLogicalLink,
4850	HCILogicalLinkCancel,
4851	HCIAmpStateChange,
4852	HCIWriteLogicalLinkAcceptTimeout
4853};
4854
4855typedef struct flush_txfifo {
4856	uint32 txfifobmp;
4857	uint32 hwtxfifoflush;
4858	struct ether_addr ea;
4859} flush_txfifo_t;
4860
4861#define CHANNEL_5G_LOW_START	36	/* 5G low (36..48) CDD enable/disable bit mask */
4862#define CHANNEL_5G_MID_START	52	/* 5G mid (52..64) CDD enable/disable bit mask */
4863#define CHANNEL_5G_HIGH_START	100	/* 5G high (100..140) CDD enable/disable bit mask */
4864#define CHANNEL_5G_UPPER_START	149	/* 5G upper (149..161) CDD enable/disable bit mask */
4865
4866enum {
4867	SPATIAL_MODE_2G_IDX = 0,
4868	SPATIAL_MODE_5G_LOW_IDX,
4869	SPATIAL_MODE_5G_MID_IDX,
4870	SPATIAL_MODE_5G_HIGH_IDX,
4871	SPATIAL_MODE_5G_UPPER_IDX,
4872	SPATIAL_MODE_MAX_IDX
4873};
4874
4875/* IOVAR "mempool" parameter. Used to retrieve a list of memory pool statistics. */
4876typedef struct wl_mempool_stats {
4877	int	num;		/* Number of memory pools */
4878	bcm_mp_stats_t s[1];	/* Variable array of memory pool stats. */
4879} wl_mempool_stats_t;
4880
4881
4882/* D0 Coalescing */
4883#define IPV4_ARP_FILTER		0x0001
4884#define IPV4_NETBT_FILTER	0x0002
4885#define IPV4_LLMNR_FILTER	0x0004
4886#define IPV4_SSDP_FILTER	0x0008
4887#define IPV4_WSD_FILTER		0x0010
4888#define IPV6_NETBT_FILTER	0x0200
4889#define IPV6_LLMNR_FILTER	0x0400
4890#define IPV6_SSDP_FILTER	0x0800
4891#define IPV6_WSD_FILTER		0x1000
4892
4893/* Network Offload Engine */
4894#define NWOE_OL_ENABLE		0x00000001
4895
4896typedef struct {
4897	uint32 ipaddr;
4898	uint32 ipaddr_netmask;
4899	uint32 ipaddr_gateway;
4900} nwoe_ifconfig_t;
4901
4902/*
4903 * Traffic management structures/defines.
4904 */
4905
4906/* Traffic management bandwidth	parameters */
4907#define	TRF_MGMT_MAX_PRIORITIES		3
4908
4909#define	TRF_MGMT_FLAG_ADD_DSCP		0x0001	/* Add DSCP	to IP TOS field	*/
4910#define	TRF_MGMT_FLAG_DISABLE_SHAPING	0x0002	/* Only	support	traffic	clasification */
4911
4912
4913/* Traffic management priority classes */
4914typedef	enum trf_mgmt_priority_class {
4915	trf_mgmt_priority_low		= 0,	/* Maps	to 802.1p BK */
4916	trf_mgmt_priority_medium	= 1,	/* Maps	to 802.1p BE */
4917	trf_mgmt_priority_high		= 2,	/* Maps	to 802.1p VI */
4918	trf_mgmt_priority_invalid	= (trf_mgmt_priority_high + 1)
4919} trf_mgmt_priority_class_t;
4920
4921/* Traffic management configuration parameters */
4922typedef	struct trf_mgmt_config {
4923	uint32	trf_mgmt_enabled;				/* 0 - disabled, 1 - enabled */
4924	uint32	flags;						/* See TRF_MGMT_FLAG_xxx defines */
4925	uint32	host_ip_addr;
4926	uint32	host_subnet_mask;
4927	uint32	downlink_bandwidth;				/* In units of kbps */
4928	uint32	uplink_bandwidth;				/* In units of kbps */
4929	uint32	min_tx_bandwidth[TRF_MGMT_MAX_PRIORITIES];
4930	uint32	min_rx_bandwidth[TRF_MGMT_MAX_PRIORITIES];
4931} trf_mgmt_config_t;
4932
4933/* Traffic management filter */
4934typedef	struct trf_mgmt_filter {
4935	uint32	dst_ip_addr;	/* His IP address */
4936	uint16	dst_port;	/* His L4 port */
4937	uint16	src_port;	/* My L4 port */
4938	uint16	prot;		/* L4 protocol (only TCP or UDP protocols) */
4939	uint16	flags;		/* TBD.	For	now, this must be zero.	*/
4940	trf_mgmt_priority_class_t priority;	/* 802.1p priority for filtered	packets	*/
4941} trf_mgmt_filter_t;
4942
4943/* Traffic management filter list (variable length)	*/
4944typedef	struct trf_mgmt_filter_list	{
4945	uint32		    num_filters;
4946	trf_mgmt_filter_t   filter[1];
4947} trf_mgmt_filter_list_t;
4948
4949/* Traffic management shaping info */
4950typedef	struct trf_mgmt_shaping_info {
4951	uint32	max_bps;			/* Max bytes consumed or produced per second */
4952	uint32	max_bytes_per_sampling_period;	/* Max bytes consumed or produced per sample */
4953	uint32	shaping_delay_threshold;	/* Theshold for starting traffic delays	 */
4954	uint32	num_bytes_produced_per_sec;	/* Bytes produced over the sampling period */
4955	uint32	num_bytes_consumed_per_sec;	/* Bytes consumed over the sampling period */
4956} trf_mgmt_shaping_info_t;
4957
4958/* Traffic management shaping info array */
4959typedef	struct trf_mgmt_shaping_info_array {
4960	trf_mgmt_shaping_info_t	   tx_queue_shaping_info[TRF_MGMT_MAX_PRIORITIES];
4961	trf_mgmt_shaping_info_t	   rx_queue_shaping_info[TRF_MGMT_MAX_PRIORITIES];
4962} trf_mgmt_shaping_info_array_t;
4963
4964
4965/* Traffic management statistical counters */
4966typedef	struct trf_mgmt_stats {
4967	uint32	num_processed_packets;	/* Number of packets processed */
4968	uint32	num_processed_bytes;	/* Number of bytes processed */
4969	uint32	num_queued_packets;	/* Number of packets in	queue */
4970	uint32	num_queued_bytes;	/* Number of bytes in queue	*/
4971	uint32	num_discarded_packets;	/* Number of packets discarded from queue */
4972} trf_mgmt_stats_t;
4973
4974/* Traffic management statisics	array */
4975typedef	struct trf_mgmt_stats_array	{
4976	trf_mgmt_stats_t    tx_queue_stats[TRF_MGMT_MAX_PRIORITIES];
4977	trf_mgmt_stats_t    rx_queue_stats[TRF_MGMT_MAX_PRIORITIES];
4978} trf_mgmt_stats_array_t;
4979
4980#endif /* _wlioctl_h_ */
4981