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