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