xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_indep_power/include/wlioctl.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Custom OID/ioctl definitions for
4  *
5  *
6  * Broadcom 802.11abg Networking Device Driver
7  *
8  * Definitions subject to change without notice.
9  *
10  * Copyright (C) 1999-2017, Broadcom Corporation
11  *
12  *      Unless you and Broadcom execute a separate written software license
13  * agreement governing use of this software, this software is licensed to you
14  * under the terms of the GNU General Public License version 2 (the "GPL"),
15  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
16  * following added to such license:
17  *
18  *      As a special exception, the copyright holders of this software give you
19  * permission to link this software with independent modules, and to copy and
20  * distribute the resulting executable under terms of your choice, provided that
21  * you also meet, for each linked independent module, the terms and conditions of
22  * the license of that module.  An independent module is a module which is not
23  * derived from this software.  The special exception does not apply to any
24  * modifications of the software.
25  *
26  *      Notwithstanding the above, under no circumstances may you combine this
27  * software in any way with any other Broadcom software provided under a license
28  * other than the GPL, without Broadcom's express prior written consent.
29  * <<Broadcom-WL-IPTag/Open:>>
30  *
31  * $Id: wlioctl.h 677952 2017-01-05 23:25:28Z $
32  */
33 
34 #ifndef _wlioctl_h_
35 #define	_wlioctl_h_
36 
37 #include <typedefs.h>
38 #include <ethernet.h>
39 #include <bcmip.h>
40 #include <bcmeth.h>
41 #include <bcmip.h>
42 #include <bcmipv6.h>
43 #include <bcmevent.h>
44 #include <802.11.h>
45 #include <802.11s.h>
46 #include <802.1d.h>
47 #include <bcmwifi_channels.h>
48 #include <bcmwifi_rates.h>
49 #include <wlioctl_defs.h>
50 #include <bcmipv6.h>
51 
52 #include <bcm_mpool_pub.h>
53 #include <bcmcdc.h>
54 
55 
56 typedef struct {
57 	uint32 num;
58 	chanspec_t list[1];
59 } chanspec_list_t;
60 
61 #define RSN_KCK_LENGTH	16
62 #define RSN_KEK_LENGTH	16
63 #define TPK_FTM_LEN		16
64 #ifndef INTF_NAME_SIZ
65 #define INTF_NAME_SIZ	16
66 #endif
67 
68 /**Used to send ioctls over the transport pipe */
69 typedef struct remote_ioctl {
70 	cdc_ioctl_t	msg;
71 	uint32		data_len;
72 	char           intf_name[INTF_NAME_SIZ];
73 } rem_ioctl_t;
74 #define REMOTE_SIZE	sizeof(rem_ioctl_t)
75 
76 #define BCM_IOV_XTLV_VERSION 0
77 
78 #define MAX_NUM_D11CORES 2
79 
80 /**DFS Forced param */
81 typedef struct wl_dfs_forced_params {
82 	chanspec_t chspec;
83 	uint16 version;
84 	chanspec_list_t chspec_list;
85 } wl_dfs_forced_t;
86 
87 #define DFS_PREFCHANLIST_VER 0x01
88 #define WL_CHSPEC_LIST_FIXED_SIZE	OFFSETOF(chanspec_list_t, list)
89 /* size of dfs forced param size given n channels are in the list */
90 #define WL_DFS_FORCED_PARAMS_SIZE(n) \
91 	(sizeof(wl_dfs_forced_t) + (((n) < 1) ? (0) : (((n) - 1)* sizeof(chanspec_t))))
92 #define WL_DFS_FORCED_PARAMS_FIXED_SIZE \
93 	(WL_CHSPEC_LIST_FIXED_SIZE + OFFSETOF(wl_dfs_forced_t, chspec_list))
94 #define WL_DFS_FORCED_PARAMS_MAX_SIZE \
95 	WL_DFS_FORCED_PARAMS_FIXED_SIZE + (WL_NUMCHANNELS * sizeof(chanspec_t))
96 
97 /**association decision information */
98 typedef struct {
99 	uint8		assoc_approved;		/**< (re)association approved */
100 	uint8		pad;
101 	uint16		reject_reason;		/**< reason code for rejecting association */
102 	struct		ether_addr   da;
103 	uint8		pad1[6];
104 	int64		sys_time;		/**< current system time */
105 } assoc_decision_t;
106 
107 #define DFS_SCAN_S_IDLE		-1
108 #define DFS_SCAN_S_RADAR_FREE 0
109 #define DFS_SCAN_S_RADAR_FOUND 1
110 #define DFS_SCAN_S_INPROGESS 2
111 #define DFS_SCAN_S_SCAN_ABORTED 3
112 #define DFS_SCAN_S_SCAN_MODESW_INPROGRESS 4
113 #define DFS_SCAN_S_MAX 5
114 
115 
116 #define ACTION_FRAME_SIZE 1800
117 
118 typedef struct wl_action_frame {
119 	struct ether_addr 	da;
120 	uint16 			len;
121 	uint32 			packetId;
122 	uint8			data[ACTION_FRAME_SIZE];
123 } wl_action_frame_t;
124 
125 #define WL_WIFI_ACTION_FRAME_SIZE sizeof(struct wl_action_frame)
126 
127 typedef struct ssid_info
128 {
129 	uint8		ssid_len;	/**< the length of SSID */
130 	uint8		ssid[32];	/**< SSID string */
131 } ssid_info_t;
132 
133 typedef struct wl_af_params {
134 	uint32			channel;
135 	int32			dwell_time;
136 	struct ether_addr	BSSID;
137 	uint8 PAD[2];
138 	wl_action_frame_t	action_frame;
139 } wl_af_params_t;
140 
141 #define WL_WIFI_AF_PARAMS_SIZE sizeof(struct wl_af_params)
142 
143 #define MFP_TEST_FLAG_NORMAL	0
144 #define MFP_TEST_FLAG_ANY_KEY	1
145 typedef struct wl_sa_query {
146 	uint32 flag;
147 	uint8  action;
148 	uint8  PAD;
149 	uint16 id;
150 	struct ether_addr da;
151 	uint16  PAD;
152 } wl_sa_query_t;
153 
154 /* EXT_STA */
155 /**association information */
156 typedef struct {
157 	uint32		assoc_req;	/**< offset to association request frame */
158 	uint32		assoc_req_len;	/**< association request frame length */
159 	uint32		assoc_rsp;	/**< offset to association response frame */
160 	uint32		assoc_rsp_len;	/**< association response frame length */
161 	uint32		bcn;		/**< offset to AP beacon */
162 	uint32		bcn_len;	/**< AP beacon length */
163 	uint32		wsec;		/**< ucast security algo */
164 	uint32		wpaie;		/**< offset to WPA ie */
165 	uint8		auth_alg;	/**< 802.11 authentication mode */
166 	uint8		WPA_auth;	/**< WPA: authenticated key management */
167 	uint8		ewc_cap;	/**< EWC (MIMO) capable */
168 	uint8		ofdm;		/**< OFDM */
169 } assoc_info_t;
170 /* defined(EXT_STA) */
171 
172 /* Flags for OBSS IOVAR Parameters */
173 #define WL_OBSS_DYN_BWSW_FLAG_ACTIVITY_PERIOD        (0x01)
174 #define WL_OBSS_DYN_BWSW_FLAG_NOACTIVITY_PERIOD      (0x02)
175 #define WL_OBSS_DYN_BWSW_FLAG_NOACTIVITY_INCR_PERIOD (0x04)
176 #define WL_OBSS_DYN_BWSW_FLAG_PSEUDO_SENSE_PERIOD    (0x08)
177 #define WL_OBSS_DYN_BWSW_FLAG_RX_CRS_PERIOD          (0x10)
178 #define WL_OBSS_DYN_BWSW_FLAG_DUR_THRESHOLD          (0x20)
179 #define WL_OBSS_DYN_BWSW_FLAG_TXOP_PERIOD            (0x40)
180 
181 /* OBSS IOVAR Version information */
182 #define WL_PROT_OBSS_CONFIG_PARAMS_VERSION 1
183 
184 #include <packed_section_start.h>
185 typedef BWL_PRE_PACKED_STRUCT struct {
186 	uint8 obss_bwsw_activity_cfm_count_cfg; /**< configurable count in
187 		* seconds before we confirm that OBSS is present and
188 		* dynamically activate dynamic bwswitch.
189 		*/
190 	uint8 obss_bwsw_no_activity_cfm_count_cfg; /**< configurable count in
191 		* seconds before we confirm that OBSS is GONE and
192 		* dynamically start pseudo upgrade. If in pseudo sense time, we
193 		* will see OBSS, [means that, we false detected that OBSS-is-gone
194 		* in watchdog] this count will be incremented in steps of
195 		* obss_bwsw_no_activity_cfm_count_incr_cfg for confirming OBSS
196 		* detection again. Note that, at present, max 30seconds is
197 		* allowed like this. [OBSS_BWSW_NO_ACTIVITY_MAX_INCR_DEFAULT]
198 		*/
199 	uint8 obss_bwsw_no_activity_cfm_count_incr_cfg; /* see above
200 		*/
201 	uint16 obss_bwsw_pseudo_sense_count_cfg; /**< number of msecs/cnt to be in
202 		* pseudo state. This is used to sense/measure the stats from lq.
203 		*/
204 	uint8 obss_bwsw_rx_crs_threshold_cfg; /**< RX CRS default threshold */
205 	uint8 obss_bwsw_dur_thres; /**< OBSS dyn bwsw trigger/RX CRS Sec */
206 	uint8 obss_bwsw_txop_threshold_cfg; /**< TXOP default threshold */
207 } BWL_POST_PACKED_STRUCT wlc_obss_dynbwsw_config_t;
208 #include <packed_section_end.h>
209 
210 #include <packed_section_start.h>
211 typedef BWL_PRE_PACKED_STRUCT struct {
212 	uint32 version;	/**< version field */
213 	uint32 config_mask;
214 	uint32 reset_mask;
215 	wlc_obss_dynbwsw_config_t config_params;
216 } BWL_POST_PACKED_STRUCT obss_config_params_t;
217 #include <packed_section_end.h>
218 
219 /**bsscfg type */
220 typedef enum bsscfg_type {
221 	BSSCFG_TYPE_GENERIC = 0,	/**< Generic AP/STA/IBSS BSS */
222 	BSSCFG_TYPE_P2P = 1,		/**< P2P BSS */
223 	/* index 2 earlier used for BTAMP */
224 	BSSCFG_TYPE_PSTA = 3,
225 	BSSCFG_TYPE_TDLS = 4,
226 	BSSCFG_TYPE_SLOTTED_BSS = 5,
227 	BSSCFG_TYPE_PROXD = 6,
228 	BSSCFG_TYPE_NAN = 7,
229 	BSSCFG_TYPE_MESH = 8,
230 	BSSCFG_TYPE_AIBSS = 9
231 } bsscfg_type_t;
232 
233 /* bsscfg subtype */
234 typedef enum bsscfg_subtype {
235 	BSSCFG_SUBTYPE_NONE = 0,
236 	BSSCFG_GENERIC_STA = 1,		/* GENERIC */
237 	BSSCFG_GENERIC_AP = 2,
238 	BSSCFG_GENERIC_IBSS = 6,
239 	BSSCFG_P2P_GC = 3,		/* P2P */
240 	BSSCFG_P2P_GO = 4,
241 	BSSCFG_P2P_DISC = 5,
242 	/* Index 7 & 8 earlier used for BTAMP */
243 	BSSCFG_SUBTYPE_AWDL = 9, /* SLOTTED_BSS_TYPE */
244 	BSSCFG_SUBTYPE_NAN_MGMT = 10,
245 	BSSCFG_SUBTYPE_NAN_DATA = 11,
246 	BSSCFG_SUBTYPE_NAN_MGMT_DATA = 12
247 } bsscfg_subtype_t;
248 
249 typedef struct wlc_bsscfg_info {
250 	uint32 type;
251 	uint32 subtype;
252 } wlc_bsscfg_info_t;
253 
254 /* ULP SHM Offsets info */
255 typedef struct ulp_shm_info {
256 	uint32 m_ulp_ctrl_sdio;
257 	uint32 m_ulp_wakeevt_ind;
258 	uint32 m_ulp_wakeind;
259 } ulp_shm_info_t;
260 
261 
262 /* Legacy structure to help keep backward compatible wl tool and tray app */
263 
264 #define	LEGACY_WL_BSS_INFO_VERSION	107	/**< older version of wl_bss_info struct */
265 
266 typedef struct wl_bss_info_107 {
267 	uint32		version;		/**< version field */
268 	uint32		length;			/**< byte length of data in this record,
269 						 * starting at version and including IEs
270 						 */
271 	struct ether_addr BSSID;
272 	uint16		beacon_period;		/**< units are Kusec */
273 	uint16		capability;		/**< Capability information */
274 	uint8		SSID_len;
275 	uint8		SSID[32];
276 	uint8		PAD;
277 	struct {
278 		uint32	count;			/**< # rates in this set */
279 		uint8	rates[16];		/**< rates in 500kbps units w/hi bit set if basic */
280 	} rateset;				/**< supported rates */
281 	uint8		channel;		/**< Channel no. */
282 	uint8		PAD;
283 	uint16		atim_window;		/**< units are Kusec */
284 	uint8		dtim_period;		/**< DTIM period */
285 	uint8		PAD;
286 	int16		RSSI;			/**< receive signal strength (in dBm) */
287 	int8		phy_noise;		/**< noise (in dBm) */
288 	uint8		PAD[3];
289 	uint32		ie_length;		/**< byte length of Information Elements */
290 	/* variable length Information Elements */
291 } wl_bss_info_107_t;
292 
293 /*
294  * Per-BSS information structure.
295  */
296 
297 #define	LEGACY2_WL_BSS_INFO_VERSION	108		/**< old version of wl_bss_info struct */
298 
299 /**
300  * BSS info structure
301  * Applications MUST CHECK ie_offset field and length field to access IEs and
302  * next bss_info structure in a vector (in wl_scan_results_t)
303  */
304 typedef struct wl_bss_info_108 {
305 	uint32		version;		/**< version field */
306 	uint32		length;			/**< byte length of data in this record,
307 						 * starting at version and including IEs
308 						 */
309 	struct ether_addr BSSID;
310 	uint16		beacon_period;		/**< units are Kusec */
311 	uint16		capability;		/**< Capability information */
312 	uint8		SSID_len;
313 	uint8		SSID[32];
314 	uint8		PAD[1];
315 	struct {
316 		uint32	count;			/**< # rates in this set */
317 		uint8	rates[16];		/**< rates in 500kbps units w/hi bit set if basic */
318 	} rateset;				/**< supported rates */
319 	chanspec_t	chanspec;		/**< chanspec for bss */
320 	uint16		atim_window;		/**< units are Kusec */
321 	uint8		dtim_period;		/**< DTIM period */
322 	uint8		PAD;
323 	int16		RSSI;			/**< receive signal strength (in dBm) */
324 	int8		phy_noise;		/**< noise (in dBm) */
325 
326 	uint8		n_cap;			/**< BSS is 802.11N Capable */
327 	uint8		PAD[2];
328 	uint32		nbss_cap;		/**< 802.11N BSS Capabilities (based on HT_CAP_*) */
329 	uint8		ctl_ch;			/**< 802.11N BSS control channel number */
330 	uint8		PAD[3];
331 	uint32		reserved32[1];		/**< Reserved for expansion of BSS properties */
332 	uint8		flags;			/**< flags */
333 	uint8		reserved[3];		/**< Reserved for expansion of BSS properties */
334 	uint8		basic_mcs[MCSSET_LEN];	/**< 802.11N BSS required MCS set */
335 
336 	uint16		ie_offset;		/**< offset at which IEs start, from beginning */
337 	uint8		PAD[2];
338 	uint32		ie_length;		/**< byte length of Information Elements */
339 	/* Add new fields here */
340 	/* variable length Information Elements */
341 } wl_bss_info_108_t;
342 
343 
344 #define	WL_BSS_INFO_VERSION	109		/**< current version of wl_bss_info struct */
345 
346 /**
347  * BSS info structure
348  * Applications MUST CHECK ie_offset field and length field to access IEs and
349  * next bss_info structure in a vector (in wl_scan_results_t)
350  */
351 typedef struct wl_bss_info {
352 	uint32		version;		/**< version field */
353 	uint32		length;			/**< byte length of data in this record,
354 						 * starting at version and including IEs
355 						 */
356 	struct ether_addr BSSID;
357 	uint16		beacon_period;		/**< units are Kusec */
358 	uint16		capability;		/**< Capability information */
359 	uint8		SSID_len;
360 	uint8		SSID[32];
361 	uint8		bcnflags;		/* additional flags w.r.t. beacon */
362 	struct {
363 		uint32	count;			/**< # rates in this set */
364 		uint8	rates[16];		/**< rates in 500kbps units w/hi bit set if basic */
365 	} rateset;				/**< supported rates */
366 	chanspec_t	chanspec;		/**< chanspec for bss */
367 	uint16		atim_window;		/**< units are Kusec */
368 	uint8		dtim_period;		/**< DTIM period */
369 	uint8		accessnet;		/* from beacon interwork IE (if bcnflags) */
370 	int16		RSSI;			/**< receive signal strength (in dBm) */
371 	int8		phy_noise;		/**< noise (in dBm) */
372 	uint8		n_cap;			/**< BSS is 802.11N Capable */
373 	uint16		freespace1;		/* make implicit padding explicit */
374 	uint32		nbss_cap;		/**< 802.11N+AC BSS Capabilities */
375 	uint8		ctl_ch;			/**< 802.11N BSS control channel number */
376 	uint8		padding1[3];		/**< explicit struct alignment padding */
377 	uint16		vht_rxmcsmap;	/**< VHT rx mcs map (802.11ac IE, VHT_CAP_MCS_MAP_*) */
378 	uint16		vht_txmcsmap;	/**< VHT tx mcs map (802.11ac IE, VHT_CAP_MCS_MAP_*) */
379 	uint8		flags;			/**< flags */
380 	uint8		vht_cap;		/**< BSS is vht capable */
381 	uint8		reserved[2];		/**< Reserved for expansion of BSS properties */
382 	uint8		basic_mcs[MCSSET_LEN];	/**< 802.11N BSS required MCS set */
383 
384 	uint16		ie_offset;		/**< offset at which IEs start, from beginning */
385 	uint16		freespace2;		/* making implicit padding explicit */
386 	uint32		ie_length;		/**< byte length of Information Elements */
387 	int16		SNR;			/**< average SNR of during frame reception */
388 	uint16		vht_mcsmap;		/**< STA's Associated vhtmcsmap */
389 	uint16		vht_mcsmap_prop;	/**< STA's Associated prop vhtmcsmap */
390 	uint16		vht_txmcsmap_prop;	/**< prop VHT tx mcs prop */
391 	/* Add new fields here */
392 	/* variable length Information Elements */
393 } wl_bss_info_t;
394 
395 #define	WL_GSCAN_FULL_RESULT_VERSION	2	/* current version of wl_gscan_result_t struct */
396 #define WL_GSCAN_INFO_FIXED_FIELD_SIZE   (sizeof(wl_gscan_bss_info_t) - sizeof(wl_bss_info_t))
397 
398 typedef struct wl_gscan_bss_info {
399 	uint32      timestamp[2];
400 	wl_bss_info_t info;
401 	/* Do not add any more members below, fixed  */
402 	/* and variable length Information Elements to follow */
403 } wl_gscan_bss_info_t;
404 
405 
406 typedef struct wl_bsscfg {
407 	uint32  bsscfg_idx;
408 	uint32  wsec;
409 	uint32  WPA_auth;
410 	uint32  wsec_index;
411 	uint32  associated;
412 	uint32  BSS;
413 	uint32  phytest_on;
414 	struct ether_addr   prev_BSSID;
415 	struct ether_addr   BSSID;
416 	uint32  targetbss_wpa2_flags;
417 	uint32 assoc_type;
418 	uint32 assoc_state;
419 } wl_bsscfg_t;
420 
421 typedef struct wl_if_add {
422 	uint32  bsscfg_flags;
423 	uint32  if_flags;
424 	uint32  ap;
425 	struct ether_addr   mac_addr;
426 	uint16  PAD;
427 	uint32  wlc_index;
428 } wl_if_add_t;
429 
430 typedef struct wl_bss_config {
431 	uint32	atim_window;
432 	uint32	beacon_period;
433 	uint32	chanspec;
434 } wl_bss_config_t;
435 
436 #define WL_BSS_USER_RADAR_CHAN_SELECT	0x1	/**< User application will randomly select
437 						 * radar channel.
438 						 */
439 
440 #define DLOAD_HANDLER_VER		1	/**< Downloader version */
441 #define DLOAD_FLAG_VER_MASK		0xf000	/**< Downloader version mask */
442 #define DLOAD_FLAG_VER_SHIFT		12	/**< Downloader version shift */
443 
444 #define DL_CRC_NOT_INUSE	0x0001
445 #define DL_BEGIN		0x0002
446 #define DL_END			0x0004
447 
448 /* Flags for Major/Minor/Date number shift and mask */
449 #define EPI_VER_SHIFT     16
450 #define EPI_VER_MASK      0xFFFF
451 /** generic download types & flags */
452 enum {
453 	DL_TYPE_UCODE = 1,
454 	DL_TYPE_CLM = 2
455 };
456 
457 /** ucode type values */
458 enum {
459 	UCODE_FW,
460 	INIT_VALS,
461 	BS_INIT_VALS
462 };
463 
464 struct wl_dload_data {
465 	uint16 flag;
466 	uint16 dload_type;
467 	uint32 len;
468 	uint32 crc;
469 	uint8  data[1];
470 };
471 typedef struct wl_dload_data wl_dload_data_t;
472 
473 struct wl_ucode_info {
474 	uint32 ucode_type;
475 	uint32 num_chunks;
476 	uint32 chunk_len;
477 	uint32 chunk_num;
478 	uint8  data_chunk[1];
479 };
480 typedef struct wl_ucode_info wl_ucode_info_t;
481 
482 struct wl_clm_dload_info {
483 	uint32 ds_id;
484 	uint32 clm_total_len;
485 	uint32 num_chunks;
486 	uint32 chunk_len;
487 	uint32 chunk_offset;
488 	uint8  data_chunk[1];
489 };
490 typedef struct wl_clm_dload_info wl_clm_dload_info_t;
491 
492 
493 typedef struct wlc_ssid {
494 	uint32		SSID_len;
495 	uint8		SSID[DOT11_MAX_SSID_LEN];
496 } wlc_ssid_t;
497 
498 typedef struct wlc_ssid_ext {
499 	uint8      hidden;
500 	uint8      PAD;
501 	uint16     flags;
502 	uint8      SSID_len;
503 	int8       rssi_thresh;
504 	uint8      SSID[DOT11_MAX_SSID_LEN];
505 } wlc_ssid_ext_t;
506 
507 #define MAX_PREFERRED_AP_NUM     5
508 typedef struct wlc_fastssidinfo {
509 	uint32			SSID_channel[MAX_PREFERRED_AP_NUM];
510 	wlc_ssid_t		SSID_info[MAX_PREFERRED_AP_NUM];
511 } wlc_fastssidinfo_t;
512 
513 typedef struct wnm_url {
514 	uint8   len;
515 	uint8   data[1];
516 } wnm_url_t;
517 
518 typedef struct chan_scandata {
519 	uint8		txpower;
520 	uint8		pad;
521 	chanspec_t	channel;		/**< Channel num, bw, ctrl_sb and band */
522 	uint32		channel_mintime;
523 	uint32		channel_maxtime;
524 } chan_scandata_t;
525 
526 typedef enum wl_scan_type {
527 	EXTDSCAN_FOREGROUND_SCAN,
528 	EXTDSCAN_BACKGROUND_SCAN,
529 	EXTDSCAN_FORCEDBACKGROUND_SCAN
530 } wl_scan_type_t;
531 
532 #define WLC_EXTDSCAN_MAX_SSID		5
533 
534 typedef struct wl_extdscan_params {
535 	int8 		nprobes;		/**< 0, passive, otherwise active */
536 	int8    	split_scan;		/**< split scan */
537 	int8		band;			/**< band */
538 	int8		pad;
539 	wlc_ssid_t 	ssid[WLC_EXTDSCAN_MAX_SSID]; /**< ssid list */
540 	uint32		tx_rate;		/**< in 500ksec units */
541 	wl_scan_type_t	scan_type;		/**< enum */
542 	int32 		channel_num;
543 	chan_scandata_t channel_list[1];	/**< list of chandata structs */
544 } wl_extdscan_params_t;
545 
546 #define WL_EXTDSCAN_PARAMS_FIXED_SIZE 	(sizeof(wl_extdscan_params_t) - sizeof(chan_scandata_t))
547 
548 #define WL_SCAN_PARAMS_SSID_MAX 	10
549 
550 typedef struct wl_scan_params {
551 	wlc_ssid_t ssid;		/**< default: {0, ""} */
552 	struct ether_addr bssid;	/**< default: bcast */
553 	int8 bss_type;			/**< default: any,
554 					 * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
555 					 */
556 	uint8 scan_type;		/**< flags, 0 use default */
557 	int32 nprobes;			/**< -1 use default, number of probes per channel */
558 	int32 active_time;		/**< -1 use default, dwell time per channel for
559 					 * active scanning
560 					 */
561 	int32 passive_time;		/**< -1 use default, dwell time per channel
562 					 * for passive scanning
563 					 */
564 	int32 home_time;		/**< -1 use default, dwell time for the home channel
565 					 * between channel scans
566 					 */
567 	int32 channel_num;		/**< count of channels and ssids that follow
568 					 *
569 					 * low half is count of channels in channel_list, 0
570 					 * means default (use all available channels)
571 					 *
572 					 * high half is entries in wlc_ssid_t array that
573 					 * follows channel_list, aligned for int32 (4 bytes)
574 					 * meaning an odd channel count implies a 2-byte pad
575 					 * between end of channel_list and first ssid
576 					 *
577 					 * if ssid count is zero, single ssid in the fixed
578 					 * parameter portion is assumed, otherwise ssid in
579 					 * the fixed portion is ignored
580 					 */
581 	uint16 channel_list[1];		/**< list of chanspecs */
582 } wl_scan_params_t;
583 
584 /** size of wl_scan_params not including variable length array */
585 #define WL_SCAN_PARAMS_FIXED_SIZE 64
586 #define WL_MAX_ROAMSCAN_DATSZ	(WL_SCAN_PARAMS_FIXED_SIZE + (WL_NUMCHANNELS * sizeof(uint16)))
587 
588 #define ISCAN_REQ_VERSION 1
589 
590 /** incremental scan struct */
591 typedef struct wl_iscan_params {
592 	uint32 version;
593 	uint16 action;
594 	uint16 scan_duration;
595 	wl_scan_params_t params;
596 } wl_iscan_params_t;
597 
598 /** 3 fields + size of wl_scan_params, not including variable length array */
599 #define WL_ISCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_iscan_params_t, params) + sizeof(wlc_ssid_t))
600 
601 typedef struct wl_scan_results {
602 	uint32 buflen;
603 	uint32 version;
604 	uint32 count;
605 	wl_bss_info_t bss_info[1];
606 } wl_scan_results_t;
607 
608 /** size of wl_scan_results not including variable length array */
609 #define WL_SCAN_RESULTS_FIXED_SIZE (sizeof(wl_scan_results_t) - sizeof(wl_bss_info_t))
610 #define ESCAN_REQ_VERSION 1
611 
612 /** event scan reduces amount of SOC memory needed to store scan results */
613 typedef struct wl_escan_params {
614 	uint32 version;
615 	uint16 action;
616 	uint16 sync_id;
617 	wl_scan_params_t params;
618 } wl_escan_params_t;
619 
620 #define WL_ESCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_escan_params_t, params) + sizeof(wlc_ssid_t))
621 
622 /** event scan reduces amount of SOC memory needed to store scan results */
623 typedef struct wl_escan_result {
624 	uint32 buflen;
625 	uint32 version;
626 	uint16 sync_id;
627 	uint16 bss_count;
628 	wl_bss_info_t bss_info[1];
629 } wl_escan_result_t;
630 
631 #define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(wl_escan_result_t) - sizeof(wl_bss_info_t))
632 typedef struct wl_gscan_result {
633 	uint32 buflen;
634 	uint32 version;
635 	uint32 scan_ch_bucket;
636 	wl_gscan_bss_info_t bss_info[1];
637 } wl_gscan_result_t;
638 
639 #define WL_GSCAN_RESULTS_FIXED_SIZE (sizeof(wl_gscan_result_t) - sizeof(wl_gscan_bss_info_t))
640 /** incremental scan results struct */
641 typedef struct wl_iscan_results {
642 	uint32 status;
643 	wl_scan_results_t results;
644 } wl_iscan_results_t;
645 
646 /** size of wl_iscan_results not including variable length array */
647 #define WL_ISCAN_RESULTS_FIXED_SIZE \
648 	(WL_SCAN_RESULTS_FIXED_SIZE + OFFSETOF(wl_iscan_results_t, results))
649 
650 typedef struct wl_probe_params {
651 	wlc_ssid_t ssid;
652 	struct ether_addr bssid;
653 	struct ether_addr mac;
654 } wl_probe_params_t;
655 
656 #define WL_MAXRATES_IN_SET		16	/**< max # of rates in a rateset */
657 typedef struct wl_rateset {
658 	uint32	count;				/**< # rates in this set */
659 	uint8	rates[WL_MAXRATES_IN_SET];	/**< rates in 500kbps units w/hi bit set if basic */
660 } wl_rateset_t;
661 
662 typedef struct wl_rateset_args {
663 	uint32	count;				/**< # rates in this set */
664 	uint8	rates[WL_MAXRATES_IN_SET];	/**< rates in 500kbps units w/hi bit set if basic */
665 	uint8   mcs[MCSSET_LEN];        	/**< supported mcs index bit map */
666 	uint16 vht_mcs[VHT_CAP_MCS_MAP_NSS_MAX]; /**< supported mcs index bit map per nss */
667 } wl_rateset_args_t;
668 
669 #define TXBF_RATE_MCS_ALL		4
670 #define TXBF_RATE_VHT_ALL		4
671 #define TXBF_RATE_OFDM_ALL		8
672 
673 typedef struct wl_txbf_rateset {
674 	uint8	txbf_rate_mcs[TXBF_RATE_MCS_ALL];	/**< one for each stream */
675 	uint8	txbf_rate_mcs_bcm[TXBF_RATE_MCS_ALL];	/**< one for each stream */
676 	uint16	txbf_rate_vht[TXBF_RATE_VHT_ALL];	/**< one for each stream */
677 	uint16	txbf_rate_vht_bcm[TXBF_RATE_VHT_ALL];	/**< one for each stream */
678 	uint8	txbf_rate_ofdm[TXBF_RATE_OFDM_ALL]; /**< bitmap of ofdm rates that enables txbf */
679 	uint8	txbf_rate_ofdm_bcm[TXBF_RATE_OFDM_ALL]; /* bitmap of ofdm rates that enables txbf */
680 	uint8	txbf_rate_ofdm_cnt;
681 	uint8	txbf_rate_ofdm_cnt_bcm;
682 } wl_txbf_rateset_t;
683 
684 #define NUM_BFGAIN_ARRAY_1RX	2
685 #define NUM_BFGAIN_ARRAY_2RX	3
686 #define NUM_BFGAIN_ARRAY_3RX	4
687 #define NUM_BFGAIN_ARRAY_4RX	5
688 
689 typedef struct wl_txbf_expgainset {
690 	/* bitmap for each element: B[4:0]=>c0, B[9:5]=>c1, B[14:10]=>c2, B[19:15]=>c[3-7]
691 	 * B[24:20]=>c[8-9], B[29:25]=>c[10-11]
692 	 */
693 	uint32	bfgain_2x1[NUM_BFGAIN_ARRAY_1RX]; /* exp     1ss, imp 1ss */
694 	uint32	bfgain_2x2[NUM_BFGAIN_ARRAY_2RX]; /* exp [1-2]ss, imp 1ss */
695 	uint32	bfgain_3x1[NUM_BFGAIN_ARRAY_1RX];
696 	uint32	bfgain_3x2[NUM_BFGAIN_ARRAY_2RX];
697 	uint32	bfgain_3x3[NUM_BFGAIN_ARRAY_3RX]; /* exp [1-3]ss, imp 1ss */
698 	uint32	bfgain_4x1[NUM_BFGAIN_ARRAY_1RX];
699 	uint32	bfgain_4x2[NUM_BFGAIN_ARRAY_2RX];
700 	uint32	bfgain_4x3[NUM_BFGAIN_ARRAY_3RX];
701 	uint32	bfgain_4x4[NUM_BFGAIN_ARRAY_4RX]; /* exp [1-4]ss, imp 1ss */
702 } wl_txbf_expgainset_t;
703 
704 #define OFDM_RATE_MASK			0x0000007f
705 typedef uint8 ofdm_rates_t;
706 
707 typedef struct wl_rates_info {
708 	wl_rateset_t rs_tgt;
709 	uint32 phy_type;
710 	int32 bandtype;
711 	uint8 cck_only;
712 	uint8 rate_mask;
713 	uint8 mcsallow;
714 	uint8 bw;
715 	uint8 txstreams;
716 	uint8 PAD[3];
717 } wl_rates_info_t;
718 
719 /**uint32 list */
720 typedef struct wl_uint32_list {
721 	/** in - # of elements, out - # of entries */
722 	uint32 count;
723 	/** variable length uint32 list */
724 	uint32 element[1];
725 } wl_uint32_list_t;
726 
727 /* WLC_SET_ALLOW_MODE values */
728 #define ALLOW_MODE_ANY_BSSID		0
729 #define ALLOW_MODE_ONLY_DESIRED_BSSID	1
730 #define ALLOW_MODE_NO_BSSID		2
731 
732 /** used for association with a specific BSSID and chanspec list */
733 typedef struct wl_assoc_params {
734 	struct ether_addr bssid;	/**< 00:00:00:00:00:00: broadcast scan */
735 	uint16 bssid_cnt;		/**< 0: use chanspec_num, and the single bssid,
736 					* otherwise count of chanspecs in chanspec_list
737 					* AND paired bssids following chanspec_list
738 					* also, chanspec_num has to be set to zero
739 					* for bssid list to be used
740 					*/
741 	int32 chanspec_num;		/**< 0: all available channels,
742 					* otherwise count of chanspecs in chanspec_list
743 					*/
744 	chanspec_t chanspec_list[1];	/**< list of chanspecs */
745 } wl_assoc_params_t;
746 
747 #define WL_ASSOC_PARAMS_FIXED_SIZE 	OFFSETOF(wl_assoc_params_t, chanspec_list)
748 
749 /** used for reassociation/roam to a specific BSSID and channel */
750 typedef wl_assoc_params_t wl_reassoc_params_t;
751 #define WL_REASSOC_PARAMS_FIXED_SIZE	WL_ASSOC_PARAMS_FIXED_SIZE
752 
753 /** used for association to a specific BSSID and channel */
754 typedef wl_assoc_params_t wl_join_assoc_params_t;
755 #define WL_JOIN_ASSOC_PARAMS_FIXED_SIZE	WL_ASSOC_PARAMS_FIXED_SIZE
756 
757 /** used for join with or without a specific bssid and channel list */
758 typedef struct wl_join_params {
759 	wlc_ssid_t ssid;
760 	wl_assoc_params_t params;	/**< optional field, but it must include the fixed portion
761 					 * of the wl_assoc_params_t struct when it does present.
762 					 */
763 } wl_join_params_t;
764 
765 #define WL_JOIN_PARAMS_FIXED_SIZE 	(OFFSETOF(wl_join_params_t, params) + \
766 					 WL_ASSOC_PARAMS_FIXED_SIZE)
767 
768 typedef struct wlc_roam_exp_params {
769 	int8 a_band_boost_threshold;
770 	int8 a_band_penalty_threshold;
771 	int8 a_band_boost_factor;
772 	int8 a_band_penalty_factor;
773 	int8 cur_bssid_boost;
774 	int8 alert_roam_trigger_threshold;
775 	int16 a_band_max_boost;
776 } wlc_roam_exp_params_t;
777 
778 #define ROAM_EXP_CFG_VERSION     1
779 
780 #define ROAM_EXP_ENABLE_FLAG             (1 << 0)
781 
782 #define ROAM_EXP_CFG_PRESENT             (1 << 1)
783 
784 typedef struct wl_roam_exp_cfg {
785 	uint16 version;
786 	uint16 flags;
787 	wlc_roam_exp_params_t params;
788 } wl_roam_exp_cfg_t;
789 
790 typedef struct wl_bssid_pref_list {
791 	struct ether_addr bssid;
792 	/* Add this to modify rssi */
793 	int8 rssi_factor;
794 	int8 flags;
795 } wl_bssid_pref_list_t;
796 
797 #define BSSID_PREF_LIST_VERSION        1
798 #define ROAM_EXP_CLEAR_BSSID_PREF        (1 << 0)
799 
800 typedef struct wl_bssid_pref_cfg {
801 	uint16 version;
802 	uint16 flags;
803 	uint16 count;
804 	uint16 reserved;
805 	wl_bssid_pref_list_t bssids[];
806 } wl_bssid_pref_cfg_t;
807 
808 #define SSID_WHITELIST_VERSION         1
809 
810 #define ROAM_EXP_CLEAR_SSID_WHITELIST    (1 << 0)
811 
812 /* Roam SSID whitelist, ssids in this list are ok to  */
813 /* be considered as targets to join when considering a roam */
814 
815 typedef struct wl_ssid_whitelist {
816 
817 	uint16 version;
818 	uint16 flags;
819 
820 	uint8 ssid_count;
821 	uint8 reserved[3];
822 	wlc_ssid_t ssids[];
823 } wl_ssid_whitelist_t;
824 
825 #define ROAM_EXP_EVENT_VERSION       1
826 
827 typedef struct wl_roam_exp_event {
828 
829 	uint16 version;
830 	uint16 flags;
831 	wlc_ssid_t cur_ssid;
832 } wl_roam_exp_event_t;
833 
834 /** scan params for extended join */
835 typedef struct wl_join_scan_params {
836 	uint8 scan_type;		/**< 0 use default, active or passive scan */
837 	uint8 PAD[3];
838 	int32 nprobes;			/**< -1 use default, number of probes per channel */
839 	int32 active_time;		/**< -1 use default, dwell time per channel for
840 					 * active scanning
841 					 */
842 	int32 passive_time;		/**< -1 use default, dwell time per channel
843 					 * for passive scanning
844 					 */
845 	int32 home_time;		/**< -1 use default, dwell time for the home channel
846 					 * between channel scans
847 					 */
848 } wl_join_scan_params_t;
849 
850 /** extended join params */
851 typedef struct wl_extjoin_params {
852 	wlc_ssid_t ssid;		/**< {0, ""}: wildcard scan */
853 	wl_join_scan_params_t scan;
854 	wl_join_assoc_params_t assoc;	/**< optional field, but it must include the fixed portion
855 					 * of the wl_join_assoc_params_t struct when it does
856 					 * present.
857 					 */
858 } wl_extjoin_params_t;
859 #define WL_EXTJOIN_PARAMS_FIXED_SIZE 	(OFFSETOF(wl_extjoin_params_t, assoc) + \
860 					 WL_JOIN_ASSOC_PARAMS_FIXED_SIZE)
861 
862 #define ANT_SELCFG_MAX		4	/**< max number of antenna configurations */
863 #define MAX_STREAMS_SUPPORTED	4	/**< max number of streams supported */
864 typedef struct {
865 	uint8 ant_config[ANT_SELCFG_MAX];	/**< antenna configuration */
866 	uint8 num_antcfg;			/**< number of available antenna configurations */
867 } wlc_antselcfg_t;
868 
869 typedef struct {
870 	uint32 duration;	/**< millisecs spent sampling this channel */
871 	uint32 congest_ibss;	/**< millisecs in our bss (presumably this traffic will */
872 				/**<  move if cur bss moves channels) */
873 	uint32 congest_obss;	/**< traffic not in our bss */
874 	uint32 interference;	/**< millisecs detecting a non 802.11 interferer. */
875 	uint32 timestamp;	/**< second timestamp */
876 } cca_congest_t;
877 
878 typedef struct {
879 	chanspec_t chanspec;	/**< Which channel? */
880 	uint16 num_secs;	/**< How many secs worth of data */
881 	cca_congest_t  secs[1];	/**< Data */
882 } cca_congest_channel_req_t;
883 typedef struct {
884 	uint32 duration;	/**< millisecs spent sampling this channel */
885 	uint32 congest;		/**< millisecs detecting busy CCA */
886 	uint32 timestamp;	/**< second timestamp */
887 } cca_congest_simple_t;
888 
889 typedef struct {
890 	uint16 status;
891 	uint16 id;
892 	chanspec_t chanspec;			/**< Which channel? */
893 	uint16 len;
894 	union {
895 		cca_congest_simple_t  cca_busy;	/**< CCA busy */
896 		int32 noise;			/**< noise floor */
897 	};
898 } cca_chan_qual_event_t;
899 
900 typedef struct {
901 	uint32 msrmnt_time;	/**< Time for Measurement (msec) */
902 	uint32 msrmnt_done;	/**< flag set when measurement complete */
903 	char buf[];
904 } cca_stats_n_flags;
905 
906 typedef struct {
907 	uint32 msrmnt_query;    /* host to driver query for measurement done */
908 	uint32 time_req;        /* time required for measurement */
909 	uint8 report_opt;       /* option to print different stats in report */
910 	uint8 PAD[3];
911 } cca_msrmnt_query;
912 
913 /* interference sources */
914 enum interference_source {
915 	ITFR_NONE = 0,			/**< interference */
916 	ITFR_PHONE,			/**< wireless phone */
917 	ITFR_VIDEO_CAMERA,		/**< wireless video camera */
918 	ITFR_MICROWAVE_OVEN,		/**< microwave oven */
919 	ITFR_BABY_MONITOR,		/**< wireless baby monitor */
920 	ITFR_BLUETOOTH,			/**< bluetooth */
921 	ITFR_VIDEO_CAMERA_OR_BABY_MONITOR,	/**< wireless camera or baby monitor */
922 	ITFR_BLUETOOTH_OR_BABY_MONITOR,	/**< bluetooth or baby monitor */
923 	ITFR_VIDEO_CAMERA_OR_PHONE,	/**< video camera or phone */
924 	ITFR_UNIDENTIFIED		/**< interference from unidentified source */
925 };
926 
927 /** structure for interference source report */
928 typedef struct {
929 	uint32 flags;		/**< flags.  bit definitions below */
930 	uint32 source;		/**< last detected interference source */
931 	uint32 timestamp;	/**< second timestamp on interferenced flag change */
932 } interference_source_rep_t;
933 
934 #define WLC_CNTRY_BUF_SZ	4		/**< Country string is 3 bytes + NUL */
935 
936 typedef struct wl_country {
937 	char country_abbrev[WLC_CNTRY_BUF_SZ];	/**< nul-terminated country code used in
938 						 * the Country IE
939 						 */
940 	int32 rev;				/**< revision specifier for ccode
941 						 * on set, -1 indicates unspecified.
942 						 * on get, rev >= 0
943 						 */
944 	char ccode[WLC_CNTRY_BUF_SZ];		/**< nul-terminated built-in country code.
945 						 * variable length, but fixed size in
946 						 * struct allows simple allocation for
947 						 * expected country strings <= 3 chars.
948 						 */
949 } wl_country_t;
950 
951 
952 #define CCODE_INFO_VERSION 1
953 
954 typedef enum wl_ccode_role {
955 	WLC_CCODE_ROLE_ACTIVE = 0,
956 	WLC_CCODE_ROLE_HOST,
957 	WLC_CCODE_ROLE_80211D_ASSOC,
958 	WLC_CCODE_ROLE_80211D_SCAN,
959 	WLC_CCODE_ROLE_DEFAULT,
960 	WLC_CCODE_LAST
961 } wl_ccode_role_t;
962 #define WLC_NUM_CCODE_INFO WLC_CCODE_LAST
963 
964 typedef struct wl_ccode_entry {
965 	uint16 reserved;
966 	uint8 band;
967 	uint8 role;
968 	char	ccode[WLC_CNTRY_BUF_SZ];
969 } wl_ccode_entry_t;
970 
971 typedef struct wl_ccode_info {
972 	uint16 version;
973 	uint16 count;   /**< Number of ccodes entries in the set */
974 	wl_ccode_entry_t ccodelist[1];
975 } wl_ccode_info_t;
976 #define WL_CCODE_INFO_FIXED_LEN	OFFSETOF(wl_ccode_info_t, ccodelist)
977 typedef struct wl_channels_in_country {
978 	uint32 buflen;
979 	uint32 band;
980 	char country_abbrev[WLC_CNTRY_BUF_SZ];
981 	uint32 count;
982 	uint32 channel[1];
983 } wl_channels_in_country_t;
984 
985 typedef struct wl_country_list {
986 	uint32 buflen;
987 	uint32 band_set;
988 	uint32 band;
989 	uint32 count;
990 	char country_abbrev[1];
991 } wl_country_list_t;
992 
993 typedef struct wl_rm_req_elt {
994 	int8	type;
995 	int8	flags;
996 	chanspec_t	chanspec;
997 	uint32	token;		/**< token for this measurement */
998 	uint32	tsf_h;		/**< TSF high 32-bits of Measurement start time */
999 	uint32	tsf_l;		/**< TSF low 32-bits */
1000 	uint32	dur;		/**< TUs */
1001 } wl_rm_req_elt_t;
1002 
1003 typedef struct wl_rm_req {
1004 	uint32	token;		/**< overall measurement set token */
1005 	uint32	count;		/**< number of measurement requests */
1006 	void	*cb;		/**< completion callback function: may be NULL */
1007 	void	*cb_arg;	/**< arg to completion callback function */
1008 	wl_rm_req_elt_t	req[1];	/**< variable length block of requests */
1009 } wl_rm_req_t;
1010 #define WL_RM_REQ_FIXED_LEN	OFFSETOF(wl_rm_req_t, req)
1011 
1012 typedef struct wl_rm_rep_elt {
1013 	int8	type;
1014 	int8	flags;
1015 	chanspec_t	chanspec;
1016 	uint32	token;		/**< token for this measurement */
1017 	uint32	tsf_h;		/**< TSF high 32-bits of Measurement start time */
1018 	uint32	tsf_l;		/**< TSF low 32-bits */
1019 	uint32	dur;		/**< TUs */
1020 	uint32	len;		/**< byte length of data block */
1021 	uint8	data[1];	/**< variable length data block */
1022 } wl_rm_rep_elt_t;
1023 #define WL_RM_REP_ELT_FIXED_LEN	24	/**< length excluding data block */
1024 
1025 #define WL_RPI_REP_BIN_NUM 8
1026 typedef struct wl_rm_rpi_rep {
1027 	uint8	rpi[WL_RPI_REP_BIN_NUM];
1028 	int8	rpi_max[WL_RPI_REP_BIN_NUM];
1029 } wl_rm_rpi_rep_t;
1030 
1031 typedef struct wl_rm_rep {
1032 	uint32	token;		/**< overall measurement set token */
1033 	uint32	len;		/**< length of measurement report block */
1034 	wl_rm_rep_elt_t	rep[1];	/**< variable length block of reports */
1035 } wl_rm_rep_t;
1036 #define WL_RM_REP_FIXED_LEN	8
1037 typedef enum sup_auth_status {
1038 	/* Basic supplicant authentication states */
1039 	WLC_SUP_DISCONNECTED = 0,
1040 	WLC_SUP_CONNECTING,
1041 	WLC_SUP_IDREQUIRED,
1042 	WLC_SUP_AUTHENTICATING,
1043 	WLC_SUP_AUTHENTICATED,
1044 	WLC_SUP_KEYXCHANGE,
1045 	WLC_SUP_KEYED,
1046 	WLC_SUP_TIMEOUT,
1047 	WLC_SUP_LAST_BASIC_STATE,
1048 
1049 	/* Extended supplicant authentication states */
1050 	/** Waiting to receive handshake msg M1 */
1051 	WLC_SUP_KEYXCHANGE_WAIT_M1 = WLC_SUP_AUTHENTICATED,
1052 	/** Preparing to send handshake msg M2 */
1053 	WLC_SUP_KEYXCHANGE_PREP_M2 = WLC_SUP_KEYXCHANGE,
1054 	/* Waiting to receive handshake msg M3 */
1055 	WLC_SUP_KEYXCHANGE_WAIT_M3 = WLC_SUP_LAST_BASIC_STATE,
1056 	WLC_SUP_KEYXCHANGE_PREP_M4,	/**< Preparing to send handshake msg M4 */
1057 	WLC_SUP_KEYXCHANGE_WAIT_G1,	/**< Waiting to receive handshake msg G1 */
1058 	WLC_SUP_KEYXCHANGE_PREP_G2	/**< Preparing to send handshake msg G2 */
1059 } sup_auth_status_t;
1060 
1061 typedef struct wl_wsec_key {
1062 	uint32		index;		/**< key index */
1063 	uint32		len;		/**< key length */
1064 	uint8		data[DOT11_MAX_KEY_SIZE];	/**< key data */
1065 	uint32		pad_1[18];
1066 	uint32		algo;		/**< CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
1067 	uint32		flags;		/**< misc flags */
1068 	uint32		pad_2[2];
1069 	int32		pad_3;
1070 	int32		iv_initialized;	/**< has IV been initialized already? */
1071 	int32		pad_4;
1072 	/* Rx IV */
1073 	struct {
1074 		uint32	hi;		/**< upper 32 bits of IV */
1075 		uint16	lo;		/**< lower 16 bits of IV */
1076 		uint16	PAD;
1077 	} rxiv;
1078 	uint32		pad_5[2];
1079 	struct ether_addr ea;		/**< per station */
1080 	uint16	PAD;
1081 } wl_wsec_key_t;
1082 
1083 #define WSEC_MIN_PSK_LEN	8
1084 #define WSEC_MAX_PSK_LEN	64
1085 /* Max length of supported passphrases for SAE */
1086 #define WSEC_MAX_PASSPHRASE_LEN 256u
1087 
1088 /** Flag for key material needing passhash'ing */
1089 #define WSEC_PASSPHRASE		(1<<0)
1090 
1091 /**receptacle for WLC_SET_WSEC_PMK parameter */
1092 typedef struct wsec_pmk {
1093 	ushort	key_len;		/**< octets in key material */
1094 	ushort	flags;			/**< key handling qualification */
1095 	uint8	key[WSEC_MAX_PSK_LEN];	/**< PMK material */
1096 } wsec_pmk_t;
1097 
1098 #define WL_AUTH_EVENT_DATA_V1		0x1
1099 
1100 /* tlv ids for auth event */
1101 #define WL_AUTH_PMK_TLV_ID	1
1102 #define WL_AUTH_PMKID_TLV_ID	2
1103 /* AUTH event data
1104 * pmk and pmkid in case of SAE auth
1105 * xtlvs will be 32 bit alligned
1106 */
1107 typedef struct wl_auth_event {
1108 	uint16 version;
1109 	uint16 length;
1110 	uint8 xtlvs[];
1111 } wl_auth_event_t;
1112 
1113 #define WL_AUTH_EVENT_FIXED_LEN_V1	OFFSETOF(wl_auth_event_t, xtlvs)
1114 
1115 #define WL_PMKSA_EVENT_DATA_V1	1u
1116 
1117 /* tlv ids for PMKSA event */
1118 #define WL_PMK_TLV_ID		1u
1119 #define WL_PMKID_TLV_ID		2u
1120 #define WL_PEER_ADDR_TLV_ID	3u
1121 
1122 /* PMKSA event data structure */
1123 typedef struct wl_pmksa_event {
1124 	uint16 version;
1125 	uint16 length;
1126 	uint8 xtlvs[];
1127 } wl_pmksa_event_t;
1128 
1129 #define WL_PMKSA_EVENT_FIXED_LEN_V1	OFFSETOF(wl_pmksa_event_t, xtlvs)
1130 
1131 #define FILS_CACHE_ID_LEN	2u
1132 #define PMK_LEN_MAX		48u
1133 
1134 typedef struct _pmkid_v1 {
1135 	struct ether_addr	BSSID;
1136 	uint8				PMKID[WPA2_PMKID_LEN];
1137 } pmkid_v1_t;
1138 
1139 #define PMKID_ELEM_V2_LENGTH (sizeof(struct ether_addr) + WPA2_PMKID_LEN + PMK_LEN_MAX + \
1140 	sizeof(ssid_info_t) + FILS_CACHE_ID_LEN)
1141 
1142 typedef struct _pmkid_v2 {
1143 	uint16				length; /* Should match PMKID_ELEM_VX_LENGTH */
1144 	struct ether_addr	BSSID;
1145 	uint8				PMKID[WPA2_PMKID_LEN];
1146 	uint8				pmk[PMK_LEN_MAX]; /* for FILS key deriviation */
1147 	uint16				pmk_len;
1148 	ssid_info_t			ssid;
1149 	uint8				fils_cache_id[FILS_CACHE_ID_LEN];
1150 } pmkid_v2_t;
1151 
1152 #define PMKID_LIST_VER_2	2
1153 
1154 typedef struct _pmkid_v3 {
1155 	struct ether_addr	bssid;
1156 	uint8			pmkid[WPA2_PMKID_LEN];
1157 	uint8			pmkid_len;
1158 	uint8			pmk[PMK_LEN_MAX];
1159 	uint8			pmk_len;
1160 	uint16			fils_cache_id; /* 2-byte length */
1161 	uint8			pad;
1162 	uint8			ssid_len;
1163 	uint8			ssid[DOT11_MAX_SSID_LEN]; /* For FILS, to save ESSID */
1164 							  /* one pmkid used in whole ESS */
1165 	uint32			time_left; /* remaining time until expirary in sec. */
1166 					   /* 0 means expired, all 0xFF means never expire */
1167 } pmkid_v3_t;
1168 
1169 #define PMKID_LIST_VER_3	3
1170 typedef struct _pmkid_list_v1 {
1171 	uint32	npmkid;
1172 	pmkid_v1_t	pmkid[1];
1173 } pmkid_list_v1_t;
1174 
1175 typedef struct _pmkid_list_v2 {
1176 	uint16  version;
1177 	uint16	length;
1178 	pmkid_v2_t	pmkid[1];
1179 } pmkid_list_v2_t;
1180 
1181 typedef struct _pmkid_list_v3 {
1182 	uint16		version;
1183 	uint16		length;
1184 	uint16		count;
1185 	uint16          pad;
1186 	pmkid_v3_t	pmkid[];
1187 } pmkid_list_v3_t;
1188 
1189 #ifndef PMKID_VERSION_ENABLED
1190 /* pmkid structure before versioning. legacy. DONOT update anymore here */
1191 typedef pmkid_v1_t pmkid_t;
1192 typedef pmkid_list_v1_t pmkid_list_t;
1193 #endif /* PMKID_VERSION_ENABLED */
1194 
1195 typedef struct _pmkid_cand {
1196 	struct ether_addr	BSSID;
1197 	uint8			preauth;
1198 } pmkid_cand_t;
1199 
1200 typedef struct _pmkid_cand_list {
1201 	uint32	npmkid_cand;
1202 	pmkid_cand_t	pmkid_cand[1];
1203 } pmkid_cand_list_t;
1204 
1205 #define WL_STA_ANT_MAX		4	/**< max possible rx antennas */
1206 
1207 typedef struct wl_assoc_info {
1208 	uint32		req_len;
1209 	uint32		resp_len;
1210 	uint32		flags;
1211 	struct dot11_assoc_req req;
1212 	struct ether_addr reassoc_bssid; /**< used in reassoc's */
1213 	struct dot11_assoc_resp resp;
1214 } wl_assoc_info_t;
1215 
1216 typedef struct wl_led_info {
1217 	uint32      index;      /**< led index */
1218 	uint32      behavior;
1219 	uint8       activehi;
1220 	uint8       PAD[3];
1221 } wl_led_info_t;
1222 
1223 
1224 /** srom read/write struct passed through ioctl */
1225 typedef struct {
1226 	uint32	byteoff;	/**< byte offset */
1227 	uint32	nbytes;		/**< number of bytes */
1228 	uint16	buf[];
1229 } srom_rw_t;
1230 
1231 #define CISH_FLAG_PCIECIS	(1 << 15)	/**< write CIS format bit for PCIe CIS */
1232 
1233 /** similar cis (srom or otp) struct [iovar: may not be aligned] */
1234 typedef struct {
1235 	uint16	source;		/**< cis source */
1236 	uint16	flags;		/**< flags */
1237 	uint32	byteoff;	/**< byte offset */
1238 	uint32	nbytes;		/**< number of bytes */
1239 	/* data follows here */
1240 } cis_rw_t;
1241 
1242 /** R_REG and W_REG struct passed through ioctl */
1243 typedef struct {
1244 	uint32	byteoff;	/**< byte offset of the field in d11regs_t */
1245 	uint32	val;		/**< read/write value of the field */
1246 	uint32	size;		/**< sizeof the field */
1247 	uint32	band;		/**< band (optional) */
1248 } rw_reg_t;
1249 
1250 /**
1251  * Structure used by GET/SET_ATTEN ioctls - it controls power in b/g-band
1252  * PCL - Power Control Loop
1253  */
1254 typedef struct {
1255 	uint16	auto_ctrl;	/**< WL_ATTEN_XX */
1256 	uint16	bb;		/**< Baseband attenuation */
1257 	uint16	radio;		/**< Radio attenuation */
1258 	uint16	txctl1;		/**< Radio TX_CTL1 value */
1259 } atten_t;
1260 
1261 /** Per-AC retry parameters */
1262 struct wme_tx_params_s {
1263 	uint8  short_retry;
1264 	uint8  short_fallback;
1265 	uint8  long_retry;
1266 	uint8  long_fallback;
1267 	uint16 max_rate;  /**< In units of 512 Kbps */
1268 };
1269 
1270 typedef struct wme_tx_params_s wme_tx_params_t;
1271 
1272 #define WL_WME_TX_PARAMS_IO_BYTES (sizeof(wme_tx_params_t) * AC_COUNT)
1273 
1274 /**Used to get specific link/ac parameters */
1275 typedef struct {
1276 	int32 ac;
1277 	uint8 val;
1278 	struct ether_addr ea;
1279 	uint8 PAD;
1280 } link_val_t;
1281 
1282 
1283 #define WL_PM_MUTE_TX_VER 1
1284 
1285 typedef struct wl_pm_mute_tx {
1286 	uint16 version;		/**< version */
1287 	uint16 len;		/**< length */
1288 	uint16 deadline;	/**< deadline timer (in milliseconds) */
1289 	uint8  enable;		/**< set to 1 to enable mode; set to 0 to disable it */
1290 	uint8 PAD;
1291 } wl_pm_mute_tx_t;
1292 
1293 
1294 /* sta_info_t version 4 */
1295 typedef struct {
1296 	uint16			ver;		/**< version of this struct */
1297 	uint16			len;		/**< length in bytes of this structure */
1298 	uint16			cap;		/**< sta's advertised capabilities */
1299 	uint16			PAD;
1300 	uint32			flags;		/**< flags defined below */
1301 	uint32			idle;		/**< time since data pkt rx'd from sta */
1302 	struct ether_addr	ea;		/**< Station address */
1303 	uint16			PAD;
1304 	wl_rateset_t	rateset;	/**< rateset in use */
1305 	uint32			in;		/**< seconds elapsed since associated */
1306 	uint32			listen_interval_inms; /**< Min Listen interval in ms for this STA */
1307 	uint32			tx_pkts;	/**< # of user packets transmitted (unicast) */
1308 	uint32			tx_failures;	/**< # of user packets failed */
1309 	uint32			rx_ucast_pkts;	/**< # of unicast packets received */
1310 	uint32			rx_mcast_pkts;	/**< # of multicast packets received */
1311 	uint32			tx_rate;	/**< Rate used by last tx frame */
1312 	uint32			rx_rate;	/**< Rate of last successful rx frame */
1313 	uint32			rx_decrypt_succeeds;	/**< # of packet decrypted successfully */
1314 	uint32			rx_decrypt_failures;	/**< # of packet decrypted unsuccessfully */
1315 	uint32			tx_tot_pkts;	/**< # of user tx pkts (ucast + mcast) */
1316 	uint32			rx_tot_pkts;	/**< # of data packets recvd (uni + mcast) */
1317 	uint32			tx_mcast_pkts;	/**< # of mcast pkts txed */
1318 	uint64			tx_tot_bytes;	/**< data bytes txed (ucast + mcast) */
1319 	uint64			rx_tot_bytes;	/**< data bytes recvd (ucast + mcast) */
1320 	uint64			tx_ucast_bytes;	/**< data bytes txed (ucast) */
1321 	uint64			tx_mcast_bytes;	/**< # data bytes txed (mcast) */
1322 	uint64			rx_ucast_bytes;	/**< data bytes recvd (ucast) */
1323 	uint64			rx_mcast_bytes;	/**< data bytes recvd (mcast) */
1324 	int8			rssi[WL_STA_ANT_MAX]; /**< average rssi per antenna
1325 							* of data frames
1326 							*/
1327 	int8			nf[WL_STA_ANT_MAX];	/**< per antenna noise floor */
1328 	uint16			aid;			/**< association ID */
1329 	uint16			ht_capabilities;	/**< advertised ht caps */
1330 	uint16			vht_flags;		/**< converted vht flags */
1331 	uint16			PAD;
1332 	uint32			tx_pkts_retried;	/**< # of frames where a retry was
1333 							 * necessary
1334 							 */
1335 	uint32			tx_pkts_retry_exhausted; /**< # of user frames where a retry
1336 							  * was exhausted
1337 							  */
1338 	int8			rx_lastpkt_rssi[WL_STA_ANT_MAX]; /**< Per antenna RSSI of last
1339 								  * received data frame.
1340 								  */
1341 	/* TX WLAN retry/failure statistics:
1342 	 * Separated for host requested frames and WLAN locally generated frames.
1343 	 * Include unicast frame only where the retries/failures can be counted.
1344 	 */
1345 	uint32			tx_pkts_total;		/**< # user frames sent successfully */
1346 	uint32			tx_pkts_retries;	/**< # user frames retries */
1347 	uint32			tx_pkts_fw_total;	/**< # FW generated sent successfully */
1348 	uint32			tx_pkts_fw_retries;	/**< # retries for FW generated frames */
1349 	uint32			tx_pkts_fw_retry_exhausted;	/**< # FW generated where a retry
1350 								 * was exhausted
1351 								 */
1352 	uint32			rx_pkts_retried;	/**< # rx with retry bit set */
1353 	uint32			tx_rate_fallback;	/**< lowest fallback TX rate */
1354 	/* Fields above this line are common to sta_info_t versions 4 and 5 */
1355 
1356 	uint32			rx_dur_total;	/* total user RX duration (estimated) */
1357 
1358 	chanspec_t		chanspec;       /** chanspec this sta is on */
1359 	uint16			PAD;
1360 	wl_rateset_args_t	rateset_adv;	/* rateset along with mcs index bitmap */
1361 	uint32			PAD;
1362 } sta_info_v4_t;
1363 
1364 /* Note: Version 4 is the latest version of sta_info_t.  Version 5 is abandoned.
1365  * Please add new fields to version 4, not version 5.
1366  */
1367 /* sta_info_t version 5 */
1368 typedef struct {
1369 	uint16			ver;		/**< version of this struct */
1370 	uint16			len;		/**< length in bytes of this structure */
1371 	uint16			cap;		/**< sta's advertised capabilities */
1372 	uint16			PAD;
1373 	uint32			flags;		/**< flags defined below */
1374 	uint32			idle;		/**< time since data pkt rx'd from sta */
1375 	struct ether_addr	ea;		/**< Station address */
1376 	uint16			PAD;
1377 	wl_rateset_t		rateset;	/**< rateset in use */
1378 	uint32			in;		/**< seconds elapsed since associated */
1379 	uint32			listen_interval_inms; /**< Min Listen interval in ms for this STA */
1380 	uint32			tx_pkts;	/**< # of user packets transmitted (unicast) */
1381 	uint32			tx_failures;	/**< # of user packets failed */
1382 	uint32			rx_ucast_pkts;	/**< # of unicast packets received */
1383 	uint32			rx_mcast_pkts;	/**< # of multicast packets received */
1384 	uint32			tx_rate;	/**< Rate used by last tx frame */
1385 	uint32			rx_rate;	/**< Rate of last successful rx frame */
1386 	uint32			rx_decrypt_succeeds;	/**< # of packet decrypted successfully */
1387 	uint32			rx_decrypt_failures;	/**< # of packet decrypted unsuccessfully */
1388 	uint32			tx_tot_pkts;	/**< # of user tx pkts (ucast + mcast) */
1389 	uint32			rx_tot_pkts;	/**< # of data packets recvd (uni + mcast) */
1390 	uint32			tx_mcast_pkts;	/**< # of mcast pkts txed */
1391 	uint64			tx_tot_bytes;	/**< data bytes txed (ucast + mcast) */
1392 	uint64			rx_tot_bytes;	/**< data bytes recvd (ucast + mcast) */
1393 	uint64			tx_ucast_bytes;	/**< data bytes txed (ucast) */
1394 	uint64			tx_mcast_bytes;	/**< # data bytes txed (mcast) */
1395 	uint64			rx_ucast_bytes;	/**< data bytes recvd (ucast) */
1396 	uint64			rx_mcast_bytes;	/**< data bytes recvd (mcast) */
1397 	int8			rssi[WL_STA_ANT_MAX]; /**< average rssi per antenna
1398 							* of data frames
1399 							*/
1400 	int8			nf[WL_STA_ANT_MAX];	/**< per antenna noise floor */
1401 	uint16			aid;			/**< association ID */
1402 	uint16			ht_capabilities;	/**< advertised ht caps */
1403 	uint16			vht_flags;		/**< converted vht flags */
1404 	uint16			PAD;
1405 	uint32			tx_pkts_retried;	/**< # of frames where a retry was
1406 							 * necessary
1407 							 */
1408 	uint32			tx_pkts_retry_exhausted; /**< # of user frames where a retry
1409 							  * was exhausted
1410 							  */
1411 	int8			rx_lastpkt_rssi[WL_STA_ANT_MAX]; /**< Per antenna RSSI of last
1412 								  * received data frame.
1413 								  */
1414 	/* TX WLAN retry/failure statistics:
1415 	 * Separated for host requested frames and WLAN locally generated frames.
1416 	 * Include unicast frame only where the retries/failures can be counted.
1417 	 */
1418 	uint32			tx_pkts_total;		/**< # user frames sent successfully */
1419 	uint32			tx_pkts_retries;	/**< # user frames retries */
1420 	uint32			tx_pkts_fw_total;	/**< # FW generated sent successfully */
1421 	uint32			tx_pkts_fw_retries;	/**< # retries for FW generated frames */
1422 	uint32			tx_pkts_fw_retry_exhausted;	/**< # FW generated where a retry
1423 								 * was exhausted
1424 								 */
1425 	uint32			rx_pkts_retried;	/**< # rx with retry bit set */
1426 	uint32			tx_rate_fallback;	/**< lowest fallback TX rate */
1427 	/* Fields above this line are common to sta_info_t versions 4 and 5 */
1428 
1429 	chanspec_t		chanspec;       /** chanspec this sta is on */
1430 	uint16			PAD;
1431 	wl_rateset_args_t	rateset_adv;	/* rateset along with mcs index bitmap */
1432 } sta_info_v5_t;
1433 
1434 #define WL_OLD_STAINFO_SIZE	OFFSETOF(sta_info_t, tx_tot_pkts)
1435 
1436 #define WL_STA_VER_4		4
1437 #define WL_STA_VER_5		5
1438 #define WL_STA_VER		WL_STA_VER_4
1439 
1440 #define SWDIV_STATS_VERSION_2 2
1441 #define SWDIV_STATS_CURRENT_VERSION SWDIV_STATS_VERSION_2
1442 
1443 struct wlc_swdiv_stats_v1 {
1444 	uint32 auto_en;
1445 	uint32 active_ant;
1446 	uint32 rxcount;
1447 	int32 avg_snr_per_ant0;
1448 	int32 avg_snr_per_ant1;
1449 	int32 avg_snr_per_ant2;
1450 	uint32 swap_ge_rxcount0;
1451 	uint32 swap_ge_rxcount1;
1452 	uint32 swap_ge_snrthresh0;
1453 	uint32 swap_ge_snrthresh1;
1454 	uint32 swap_txfail0;
1455 	uint32 swap_txfail1;
1456 	uint32 swap_timer0;
1457 	uint32 swap_timer1;
1458 	uint32 swap_alivecheck0;
1459 	uint32 swap_alivecheck1;
1460 	uint32 rxcount_per_ant0;
1461 	uint32 rxcount_per_ant1;
1462 	uint32 acc_rxcount;
1463 	uint32 acc_rxcount_per_ant0;
1464 	uint32 acc_rxcount_per_ant1;
1465 	uint32 tx_auto_en;
1466 	uint32 tx_active_ant;
1467 	uint32 rx_policy;
1468 	uint32 tx_policy;
1469 	uint32 cell_policy;
1470 	uint32 swap_snrdrop0;
1471 	uint32 swap_snrdrop1;
1472 	uint32 mws_antsel_ovr_tx;
1473 	uint32 mws_antsel_ovr_rx;
1474 	uint8 swap_trig_event_id;
1475 };
1476 
1477 struct wlc_swdiv_stats_v2 {
1478 	uint16	version;	/* version of the structure
1479 						* as defined by SWDIV_STATS_CURRENT_VERSION
1480 						*/
1481 	uint16	length;		/* length of the entire structure */
1482 	uint32 auto_en;
1483 	uint32 active_ant;
1484 	uint32 rxcount;
1485 	int32 avg_snr_per_ant0;
1486 	int32 avg_snr_per_ant1;
1487 	int32 avg_snr_per_ant2;
1488 	uint32 swap_ge_rxcount0;
1489 	uint32 swap_ge_rxcount1;
1490 	uint32 swap_ge_snrthresh0;
1491 	uint32 swap_ge_snrthresh1;
1492 	uint32 swap_txfail0;
1493 	uint32 swap_txfail1;
1494 	uint32 swap_timer0;
1495 	uint32 swap_timer1;
1496 	uint32 swap_alivecheck0;
1497 	uint32 swap_alivecheck1;
1498 	uint32 rxcount_per_ant0;
1499 	uint32 rxcount_per_ant1;
1500 	uint32 acc_rxcount;
1501 	uint32 acc_rxcount_per_ant0;
1502 	uint32 acc_rxcount_per_ant1;
1503 	uint32 tx_auto_en;
1504 	uint32 tx_active_ant;
1505 	uint32 rx_policy;
1506 	uint32 tx_policy;
1507 	uint32 cell_policy;
1508 	uint32 swap_snrdrop0;
1509 	uint32 swap_snrdrop1;
1510 	uint32 mws_antsel_ovr_tx;
1511 	uint32 mws_antsel_ovr_rx;
1512 	uint32 swap_trig_event_id;
1513 };
1514 
1515 #define	WLC_NUMRATES	16	/**< max # of rates in a rateset */
1516 
1517 /**Used to get specific STA parameters */
1518 typedef struct {
1519 	uint32	val;
1520 	struct ether_addr ea;
1521 	uint16	PAD;
1522 } scb_val_t;
1523 
1524 /**Used by iovar versions of some ioctls, i.e. WLC_SCB_AUTHORIZE et al */
1525 typedef struct {
1526 	uint32 code;
1527 	scb_val_t ioctl_args;
1528 } authops_t;
1529 
1530 /** channel encoding */
1531 typedef struct channel_info {
1532 	int32 hw_channel;
1533 	int32 target_channel;
1534 	int32 scan_channel;
1535 } channel_info_t;
1536 
1537 /** For ioctls that take a list of MAC addresses */
1538 typedef struct maclist {
1539 	uint32 count;			/**< number of MAC addresses */
1540 	struct ether_addr ea[1];	/**< variable length array of MAC addresses */
1541 } maclist_t;
1542 
1543 /**get pkt count struct passed through ioctl */
1544 typedef struct get_pktcnt {
1545 	uint32 rx_good_pkt;
1546 	uint32 rx_bad_pkt;
1547 	uint32 tx_good_pkt;
1548 	uint32 tx_bad_pkt;
1549 	uint32 rx_ocast_good_pkt; /**< unicast packets destined for others */
1550 } get_pktcnt_t;
1551 
1552 /* NINTENDO2 */
1553 #define LQ_IDX_MIN              0
1554 #define LQ_IDX_MAX              1
1555 #define LQ_IDX_AVG              2
1556 #define LQ_IDX_SUM              2
1557 #define LQ_IDX_LAST             3
1558 #define LQ_STOP_MONITOR         0
1559 #define LQ_START_MONITOR        1
1560 
1561 /** Get averages RSSI, Rx PHY rate and SNR values */
1562 /* Link Quality */
1563 typedef struct {
1564 	int32 rssi[LQ_IDX_LAST];  /**< Array to keep min, max, avg rssi */
1565 	int32 snr[LQ_IDX_LAST];   /**< Array to keep min, max, avg snr */
1566 	int32 isvalid;            /**< Flag indicating whether above data is valid */
1567 } wl_lq_t;
1568 
1569 typedef enum wl_wakeup_reason_type {
1570 	LCD_ON = 1,
1571 	LCD_OFF,
1572 	DRC1_WAKE,
1573 	DRC2_WAKE,
1574 	REASON_LAST
1575 } wl_wr_type_t;
1576 
1577 typedef struct {
1578 	/** Unique filter id */
1579 	uint32	id;
1580 	/** stores the reason for the last wake up */
1581 	uint8	reason;
1582 	uint8	PAD[3];
1583 } wl_wr_t;
1584 
1585 /** Get MAC specific rate histogram command */
1586 typedef struct {
1587 	struct	ether_addr ea;	/**< MAC Address */
1588 	uint8	ac_cat;	/**< Access Category */
1589 	uint8	num_pkts;	/**< Number of packet entries to be averaged */
1590 } wl_mac_ratehisto_cmd_t;
1591 /** Get MAC rate histogram response */
1592 typedef struct {
1593 	uint32	rate[DOT11_RATE_MAX + 1];	/**< Rates */
1594 	uint32	mcs[WL_RATESET_SZ_HT_IOCTL * WL_TX_CHAINS_MAX];	/**< MCS counts */
1595 	uint32	vht[WL_RATESET_SZ_VHT_MCS][WL_TX_CHAINS_MAX];	/**< VHT counts */
1596 	uint32	tsf_timer[2][2];	/**< Start and End time for 8bytes value */
1597 	uint32	prop11n_mcs[WLC_11N_LAST_PROP_MCS - WLC_11N_FIRST_PROP_MCS + 1]; /** MCS counts */
1598 } wl_mac_ratehisto_res_t;
1599 
1600 /* sta_info ecounters */
1601 typedef struct {
1602 	struct ether_addr   ea;				/* Station MAC addr */
1603 	struct ether_addr   BSSID;			/* BSSID of the BSS */
1604 	uint32              tx_pkts_fw_total;		/* # FW generated sent successfully */
1605 	uint32              tx_pkts_fw_retries;		/* # retries for FW generated frames */
1606 	uint32              tx_pkts_fw_retry_exhausted;	/* # FW generated which
1607 							 * failed after retry
1608 							 */
1609 } sta_info_ecounters_t;
1610 
1611 #define STAMON_MODULE_VER		1
1612 
1613 /**Linux network driver ioctl encoding */
1614 typedef struct wl_ioctl {
1615 	uint32 cmd;	/**< common ioctl definition */
1616 	void *buf;	/**< pointer to user buffer */
1617 	uint32 len;	/**< length of user buffer */
1618 	uint8 set;		/**< 1=set IOCTL; 0=query IOCTL */
1619 	uint32 used;	/**< bytes read or written (optional) */
1620 	uint32 needed;	/**< bytes needed (optional) */
1621 } wl_ioctl_t;
1622 
1623 #ifdef CONFIG_COMPAT
1624 typedef struct compat_wl_ioctl {
1625 	uint32 cmd;	/**< common ioctl definition */
1626 	uint32 buf;	/**< pointer to user buffer */
1627 	uint32 len;	/**< length of user buffer */
1628 	uint8 set;		/**< 1=set IOCTL; 0=query IOCTL */
1629 	uint32 used;	/**< bytes read or written (optional) */
1630 	uint32 needed;	/**< bytes needed (optional) */
1631 } compat_wl_ioctl_t;
1632 #endif /* CONFIG_COMPAT */
1633 
1634 #define WL_NUM_RATES_CCK		4 /**< 1, 2, 5.5, 11 Mbps */
1635 #define WL_NUM_RATES_OFDM		8 /**< 6, 9, 12, 18, 24, 36, 48, 54 Mbps SISO/CDD */
1636 #define WL_NUM_RATES_MCS_1STREAM	8 /**< MCS 0-7 1-stream rates - SISO/CDD/STBC/MCS */
1637 #define WL_NUM_RATES_EXTRA_VHT		2 /**< Additional VHT 11AC rates */
1638 #define WL_NUM_RATES_VHT		10
1639 #define WL_NUM_RATES_MCS32		1
1640 
1641 
1642 /*
1643  * Structure for passing hardware and software
1644  * revision info up from the driver.
1645  */
1646 typedef struct wlc_rev_info {
1647 	uint32		vendorid;	/**< PCI vendor id */
1648 	uint32		deviceid;	/**< device id of chip */
1649 	uint32		radiorev;	/**< radio revision */
1650 	uint32		chiprev;	/**< chip revision */
1651 	uint32		corerev;	/**< core revision */
1652 	uint32		boardid;	/**< board identifier (usu. PCI sub-device id) */
1653 	uint32		boardvendor;	/**< board vendor (usu. PCI sub-vendor id) */
1654 	uint32		boardrev;	/**< board revision */
1655 	uint32		driverrev;	/**< driver version */
1656 	uint32		ucoderev;	/**< microcode version */
1657 	uint32		bus;		/**< bus type */
1658 	uint32		chipnum;	/**< chip number */
1659 	uint32		phytype;	/**< phy type */
1660 	uint32		phyrev;		/**< phy revision */
1661 	uint32		anarev;		/**< anacore rev */
1662 	uint32		chippkg;	/**< chip package info */
1663 	uint32		nvramrev;	/**< nvram revision number */
1664 	uint32		phyminorrev;	/**< phy minor rev */
1665 	uint32		coreminorrev;	/**< core minor rev */
1666 	uint32		drvrev_major;	/**< driver version: major */
1667 	uint32		drvrev_minor;	/**< driver version: minor */
1668 	uint32		drvrev_rc;	/**< driver version: rc */
1669 	uint32		drvrev_rc_inc;	/**< driver version: rc incremental */
1670 } wlc_rev_info_t;
1671 
1672 #define WL_REV_INFO_LEGACY_LENGTH	48
1673 
1674 #define WL_BRAND_MAX 10
1675 typedef struct wl_instance_info {
1676 	uint32 instance;
1677 	int8 brand[WL_BRAND_MAX];
1678 	int8 PAD[4-(WL_BRAND_MAX%4)];
1679 } wl_instance_info_t;
1680 
1681 /** structure to change size of tx fifo */
1682 typedef struct wl_txfifo_sz {
1683 	uint16	magic;
1684 	uint16	fifo;
1685 	uint16	size;
1686 } wl_txfifo_sz_t;
1687 
1688 /* Transfer info about an IOVar from the driver */
1689 /**Max supported IOV name size in bytes, + 1 for nul termination */
1690 #define WLC_IOV_NAME_LEN	(32 + 1)
1691 
1692 typedef struct wlc_iov_trx_s {
1693 	uint8 module;
1694 	uint8 type;
1695 	char name[WLC_IOV_NAME_LEN];
1696 } wlc_iov_trx_t;
1697 
1698 /** bump this number if you change the ioctl interface */
1699 #define WLC_IOCTL_VERSION	2
1700 #define WLC_IOCTL_VERSION_LEGACY_IOTYPES	1
1701 /* ifdef EXT_STA */
1702 typedef struct _wl_assoc_result {
1703 	ulong associated;
1704 	ulong NDIS_auth;
1705 	ulong NDIS_infra;
1706 } wl_assoc_result_t;
1707 /* EXT_STA */
1708 
1709 #define WL_PHY_PAVARS_LEN	32	/**< Phytype, Bandrange, chain, a[0], b[0], c[0], d[0] .. */
1710 
1711 
1712 #define WL_PHY_PAVAR_VER	1	/**< pavars version */
1713 #define WL_PHY_PAVARS2_NUM	3	/**< a1, b0, b1 */
1714 typedef struct wl_pavars2 {
1715 	uint16 ver;		/**< version of this struct */
1716 	uint16 len;		/**< len of this structure */
1717 	uint16 inuse;		/**< driver return 1 for a1,b0,b1 in current band range */
1718 	uint16 phy_type;	/**< phy type */
1719 	uint16 bandrange;
1720 	uint16 chain;
1721 	uint16 inpa[WL_PHY_PAVARS2_NUM];	/**< phy pavars for one band range */
1722 } wl_pavars2_t;
1723 
1724 typedef struct wl_po {
1725 	uint16	phy_type;	/**< Phy type */
1726 	uint16	band;
1727 	uint16	cckpo;
1728 	uint16	PAD;
1729 	uint32	ofdmpo;
1730 	uint16	mcspo[8];
1731 } wl_po_t;
1732 
1733 #define WL_NUM_RPCALVARS 5	/**< number of rpcal vars */
1734 
1735 typedef struct wl_rpcal {
1736 	uint16 value;
1737 	uint16 update;
1738 } wl_rpcal_t;
1739 
1740 #define WL_NUM_RPCALPHASEVARS 5	/* number of rpcal phase vars */
1741 
1742 typedef struct wl_rpcal_phase {
1743 	uint16 value;
1744 	uint16 update;
1745 } wl_rpcal_phase_t;
1746 
1747 typedef struct wl_aci_args {
1748 	int32 enter_aci_thresh; /* Trigger level to start detecting ACI */
1749 	int32 exit_aci_thresh; /* Trigger level to exit ACI mode */
1750 	int32 usec_spin; /* microsecs to delay between rssi samples */
1751 	int32 glitch_delay; /* interval between ACI scans when glitch count is consistently high */
1752 	uint16 nphy_adcpwr_enter_thresh;	/**< ADC power to enter ACI mitigation mode */
1753 	uint16 nphy_adcpwr_exit_thresh;	/**< ADC power to exit ACI mitigation mode */
1754 	uint16 nphy_repeat_ctr;		/**< Number of tries per channel to compute power */
1755 	uint16 nphy_num_samples;	/**< Number of samples to compute power on one channel */
1756 	uint16 nphy_undetect_window_sz;	/**< num of undetects to exit ACI Mitigation mode */
1757 	uint16 nphy_b_energy_lo_aci;	/**< low ACI power energy threshold for bphy */
1758 	uint16 nphy_b_energy_md_aci;	/**< mid ACI power energy threshold for bphy */
1759 	uint16 nphy_b_energy_hi_aci;	/**< high ACI power energy threshold for bphy */
1760 	uint16 nphy_noise_noassoc_glitch_th_up; /**< wl interference 4 */
1761 	uint16 nphy_noise_noassoc_glitch_th_dn;
1762 	uint16 nphy_noise_assoc_glitch_th_up;
1763 	uint16 nphy_noise_assoc_glitch_th_dn;
1764 	uint16 nphy_noise_assoc_aci_glitch_th_up;
1765 	uint16 nphy_noise_assoc_aci_glitch_th_dn;
1766 	uint16 nphy_noise_assoc_enter_th;
1767 	uint16 nphy_noise_noassoc_enter_th;
1768 	uint16 nphy_noise_assoc_rx_glitch_badplcp_enter_th;
1769 	uint16 nphy_noise_noassoc_crsidx_incr;
1770 	uint16 nphy_noise_assoc_crsidx_incr;
1771 	uint16 nphy_noise_crsidx_decr;
1772 } wl_aci_args_t;
1773 
1774 #define WL_ACI_ARGS_LEGACY_LENGTH	16	/**< bytes of pre NPHY aci args */
1775 #define	WL_SAMPLECOLLECT_T_VERSION	2	/**< version of wl_samplecollect_args_t struct */
1776 typedef struct wl_samplecollect_args {
1777 	/* version 0 fields */
1778 	uint8 coll_us;
1779 	uint8 PAD[3];
1780 	int32 cores;
1781 	/* add'l version 1 fields */
1782 	uint16 version;     /**< see definition of WL_SAMPLECOLLECT_T_VERSION */
1783 	uint16 length;      /**< length of entire structure */
1784 	int8 trigger;
1785 	uint8 PAD;
1786 	uint16 timeout;
1787 	uint16 mode;
1788 	uint16 PAD;
1789 	uint32 pre_dur;
1790 	uint32 post_dur;
1791 	uint8 gpio_sel;
1792 	uint8 downsamp;
1793 	uint8 be_deaf;
1794 	uint8 agc;		/**< loop from init gain and going down */
1795 	uint8 filter;		/**< override high pass corners to lowest */
1796 	/* add'l version 2 fields */
1797 	uint8 trigger_state;
1798 	uint8 module_sel1;
1799 	uint8 module_sel2;
1800 	uint16 nsamps;
1801 	uint16 PAD;
1802 	int32 bitStart;
1803 	uint32 gpioCapMask;
1804 	uint8 gpio_collection;
1805 	uint8 PAD[3];
1806 } wl_samplecollect_args_t;
1807 
1808 #define	WL_SAMPLEDATA_T_VERSION		1	/**< version of wl_samplecollect_args_t struct */
1809 /* version for unpacked sample data, int16 {(I,Q),Core(0..N)} */
1810 #define	WL_SAMPLEDATA_T_VERSION_SPEC_AN 2
1811 
1812 typedef struct wl_sampledata {
1813 	uint16 version;	/**< structure version */
1814 	uint16 size;	/**< size of structure */
1815 	uint16 tag;	/**< Header/Data */
1816 	uint16 length;	/**< data length */
1817 	uint32 flag;	/**< bit def */
1818 } wl_sampledata_t;
1819 
1820 
1821 /* WL_OTA START */
1822 /* OTA Test Status */
1823 enum {
1824 	WL_OTA_TEST_IDLE = 0,		/**< Default Idle state */
1825 	WL_OTA_TEST_ACTIVE = 1,		/**< Test Running */
1826 	WL_OTA_TEST_SUCCESS = 2,	/**< Successfully Finished Test */
1827 	WL_OTA_TEST_FAIL = 3		/**< Test Failed in the Middle */
1828 };
1829 
1830 /* OTA SYNC Status */
1831 enum {
1832 	WL_OTA_SYNC_IDLE = 0,	/**< Idle state */
1833 	WL_OTA_SYNC_ACTIVE = 1,	/**< Waiting for Sync */
1834 	WL_OTA_SYNC_FAIL = 2	/**< Sync pkt not recieved */
1835 };
1836 
1837 /* Various error states dut can get stuck during test */
1838 enum {
1839 	WL_OTA_SKIP_TEST_CAL_FAIL = 1,		/**< Phy calibration failed */
1840 	WL_OTA_SKIP_TEST_SYNCH_FAIL = 2,	/**< Sync Packet not recieved */
1841 	WL_OTA_SKIP_TEST_FILE_DWNLD_FAIL = 3,	/**< Cmd flow file download failed */
1842 	WL_OTA_SKIP_TEST_NO_TEST_FOUND = 4,	/**< No test found in Flow file */
1843 	WL_OTA_SKIP_TEST_WL_NOT_UP = 5,		/**< WL UP failed */
1844 	WL_OTA_SKIP_TEST_UNKNOWN_CALL		/**< Unintentional scheduling on ota test */
1845 };
1846 
1847 /* Differentiator for ota_tx and ota_rx */
1848 enum {
1849 	WL_OTA_TEST_TX = 0,		/**< ota_tx */
1850 	WL_OTA_TEST_RX = 1,		/**< ota_rx */
1851 };
1852 
1853 /* Catch 3 modes of operation: 20Mhz, 40Mhz, 20 in 40 Mhz */
1854 enum {
1855 	WL_OTA_TEST_BW_20_IN_40MHZ = 0,		/**< 20 in 40 operation */
1856 	WL_OTA_TEST_BW_20MHZ = 1,		/**< 20 Mhz operation */
1857 	WL_OTA_TEST_BW_40MHZ = 2,		/**< full 40Mhz operation */
1858 	WL_OTA_TEST_BW_80MHZ = 3		/* full 80Mhz operation */
1859 };
1860 #define HT_MCS_INUSE	0x00000080	/* HT MCS in use,indicates b0-6 holds an mcs */
1861 #define VHT_MCS_INUSE	0x00000100	/* VHT MCS in use,indicates b0-6 holds an mcs */
1862 #define OTA_RATE_MASK 0x0000007f	/* rate/mcs value */
1863 #define OTA_STF_SISO	0
1864 #define OTA_STF_CDD		1
1865 #define OTA_STF_STBC	2
1866 #define OTA_STF_SDM		3
1867 
1868 typedef struct ota_rate_info {
1869 	uint8 rate_cnt;					/**< Total number of rates */
1870 	uint8 PAD;
1871 	uint16 rate_val_mbps[WL_OTA_TEST_MAX_NUM_RATE];	/**< array of rates from 1mbps to 130mbps */
1872 							/**< for legacy rates : ratein mbps * 2 */
1873 							/**< for HT rates : mcs index */
1874 } ota_rate_info_t;
1875 
1876 typedef struct ota_power_info {
1877 	int8 pwr_ctrl_on;	/**< power control on/off */
1878 	int8 start_pwr;		/**< starting power/index */
1879 	int8 delta_pwr;		/**< delta power/index */
1880 	int8 end_pwr;		/**< end power/index */
1881 } ota_power_info_t;
1882 
1883 typedef struct ota_packetengine {
1884 	uint16 delay;           /**< Inter-packet delay */
1885 				/**< for ota_tx, delay is tx ifs in micro seconds */
1886 				/* for ota_rx, delay is wait time in milliseconds */
1887 	uint16 nframes;         /**< Number of frames */
1888 	uint16 length;          /**< Packet length */
1889 } ota_packetengine_t;
1890 
1891 /*
1892  * OTA txant/rxant parameter
1893  *    bit7-4: 4 bits swdiv_tx/rx_policy bitmask, specify antenna-policy for SW diversity
1894  *    bit3-0: 4 bits TxCore bitmask, specify cores used for transmit frames
1895  *            (maximum spatial expansion)
1896  */
1897 #define WL_OTA_TEST_ANT_MASK	0xF0
1898 #define WL_OTA_TEST_CORE_MASK	0x0F
1899 
1900 /* OTA txant/rxant 'ant_mask' field; map to Tx/Rx antenna policy for SW diversity */
1901 enum {
1902 	WL_OTA_TEST_FORCE_ANT0 = 0x10,	/* force antenna to Ant 0 */
1903 	WL_OTA_TEST_FORCE_ANT1 = 0x20,	/* force antenna to Ant 1 */
1904 };
1905 
1906 /* antenna/core fields access */
1907 #define WL_OTA_TEST_GET_ANT(_txant) ((_txant) & WL_OTA_TEST_ANT_MASK)
1908 #define WL_OTA_TEST_GET_CORE(_txant) ((_txant) & WL_OTA_TEST_CORE_MASK)
1909 
1910 /** Test info vector */
1911 typedef struct wl_ota_test_args {
1912 	uint8 cur_test;			/**< test phase */
1913 	uint8 chan;			/**< channel */
1914 	uint8 bw;			/**< bandwidth */
1915 	uint8 control_band;		/**< control band */
1916 	uint8 stf_mode;			/**< stf mode */
1917 	uint8 PAD;
1918 	ota_rate_info_t rt_info;	/**< Rate info */
1919 	ota_packetengine_t pkteng;	/**< packeteng info */
1920 	uint8 txant;			/**< tx antenna */
1921 	uint8 rxant;			/**< rx antenna */
1922 	ota_power_info_t pwr_info;	/**< power sweep info */
1923 	uint8 wait_for_sync;		/**< wait for sync or not */
1924 	uint8 ldpc;
1925 	uint8 sgi;
1926 	uint8 PAD;
1927 	/* Update WL_OTA_TESTVEC_T_VERSION for adding new members to this structure */
1928 } wl_ota_test_args_t;
1929 
1930 #define WL_OTA_TESTVEC_T_VERSION		1	/* version of wl_ota_test_vector_t struct */
1931 typedef struct wl_ota_test_vector {
1932 	uint16 version;
1933 	wl_ota_test_args_t test_arg[WL_OTA_TEST_MAX_NUM_SEQ];	/**< Test argument struct */
1934 	uint16 test_cnt;					/**< Total no of test */
1935 	uint8 file_dwnld_valid;					/**< File successfully downloaded */
1936 	uint8 sync_timeout;					/**< sync packet timeout */
1937 	int8 sync_fail_action;					/**< sync fail action */
1938 	struct ether_addr sync_mac;				/**< macaddress for sync pkt */
1939 	struct ether_addr tx_mac;				/**< macaddress for tx */
1940 	struct ether_addr rx_mac;				/**< macaddress for rx */
1941 	int8 loop_test;					/**< dbg feature to loop the test */
1942 	uint16 test_rxcnt;
1943 	/* Update WL_OTA_TESTVEC_T_VERSION for adding new members to this structure */
1944 } wl_ota_test_vector_t;
1945 
1946 
1947 /** struct copied back form dongle to host to query the status */
1948 typedef struct wl_ota_test_status {
1949 	int16 cur_test_cnt;		/**< test phase */
1950 	int8 skip_test_reason;		/**< skip test reasoin */
1951 	uint8 PAD;
1952 	wl_ota_test_args_t test_arg;	/**< cur test arg details */
1953 	uint16 test_cnt;		/**< total no of test downloaded */
1954 	uint8 file_dwnld_valid;		/**< file successfully downloaded ? */
1955 	uint8 sync_timeout;		/**< sync timeout */
1956 	int8 sync_fail_action;		/**< sync fail action */
1957 	struct ether_addr sync_mac;	/**< macaddress for sync pkt */
1958 	struct ether_addr tx_mac;	/**< tx mac address */
1959 	struct ether_addr rx_mac;	/**< rx mac address */
1960 	uint8  test_stage;		/**< check the test status */
1961 	int8 loop_test;			/**< Debug feature to puts test enfine in a loop */
1962 	uint8 sync_status;		/**< sync status */
1963 } wl_ota_test_status_t;
1964 
1965 /* FOR ioctl that take the sta monitor information */
1966 typedef struct stamon_data {
1967 	struct ether_addr  ea;
1968 	uint8 PAD[2];
1969 	int32 rssi;
1970 } stamon_data_t;
1971 
1972 typedef struct stamon_info {
1973 	int32 version;
1974 	uint32 count;
1975 	stamon_data_t sta_data[1];
1976 } stamon_info_t;
1977 
1978 typedef struct wl_ota_rx_rssi {
1979 	uint16	pktcnt;		/* Pkt count used for this rx test */
1980 	chanspec_t chanspec;	/* Channel info on which the packets are received */
1981 	int16	rssi;		/* Average RSSI of the first 50% packets received */
1982 } wl_ota_rx_rssi_t;
1983 
1984 #define	WL_OTARSSI_T_VERSION		1	/* version of wl_ota_test_rssi_t struct */
1985 #define WL_OTA_TEST_RSSI_FIXED_SIZE	OFFSETOF(wl_ota_test_rssi_t, rx_rssi)
1986 
1987 typedef struct wl_ota_test_rssi {
1988 	uint8 version;
1989 	uint8	testcnt;		/* total measured RSSI values, valid on output only */
1990 	wl_ota_rx_rssi_t rx_rssi[1]; /* Variable length array of wl_ota_rx_rssi_t */
1991 } wl_ota_test_rssi_t;
1992 
1993 /* WL_OTA END */
1994 
1995 /**wl_radar_args_t */
1996 typedef struct {
1997 	int32 npulses;	/**< required number of pulses at n * t_int */
1998 	int32 ncontig;	/**< required number of pulses at t_int */
1999 	int32 min_pw;	/**< minimum pulse width (20 MHz clocks) */
2000 	int32 max_pw;	/**< maximum pulse width (20 MHz clocks) */
2001 	uint16 thresh0;	/**< Radar detection, thresh 0 */
2002 	uint16 thresh1;	/**< Radar detection, thresh 1 */
2003 	uint16 blank;	/**< Radar detection, blank control */
2004 	uint16 fmdemodcfg;	/**< Radar detection, fmdemod config */
2005 	int32 npulses_lp;  /**< Radar detection, minimum long pulses */
2006 	int32 min_pw_lp; /**< Minimum pulsewidth for long pulses */
2007 	int32 max_pw_lp; /**< Maximum pulsewidth for long pulses */
2008 	int32 min_fm_lp; /**< Minimum fm for long pulses */
2009 	int32 max_span_lp;  /**< Maximum deltat for long pulses */
2010 	int32 min_deltat; /**< Minimum spacing between pulses */
2011 	int32 max_deltat; /**< Maximum spacing between pulses */
2012 	uint16 autocorr;	/**< Radar detection, autocorr on or off */
2013 	uint16 st_level_time;	/**< Radar detection, start_timing level */
2014 	uint16 t2_min; /**< minimum clocks needed to remain in state 2 */
2015 	uint8 PAD[2];
2016 	uint32 version; /**< version */
2017 	uint32 fra_pulse_err;	/**< sample error margin for detecting French radar pulsed */
2018 	int32 npulses_fra;  /**< Radar detection, minimum French pulses set */
2019 	int32 npulses_stg2;  /**< Radar detection, minimum staggered-2 pulses set */
2020 	int32 npulses_stg3;  /**< Radar detection, minimum staggered-3 pulses set */
2021 	uint16 percal_mask;	/**< defines which period cal is masked from radar detection */
2022 	uint8 PAD[2];
2023 	int32 quant;	/**< quantization resolution to pulse positions */
2024 	uint32 min_burst_intv_lp;	/**< minimum burst to burst interval for bin3 radar */
2025 	uint32 max_burst_intv_lp;	/**< maximum burst to burst interval for bin3 radar */
2026 	int32 nskip_rst_lp;	/**< number of skipped pulses before resetting lp buffer */
2027 	int32 max_pw_tol; /* maximum tolerance allowd in detected pulse width for radar detection */
2028 	uint16 feature_mask; /**< 16-bit mask to specify enabled features */
2029 	uint16 thresh0_sc;	/**< Radar detection, thresh 0 */
2030 	uint16 thresh1_sc;	/**< Radar detection, thresh 1 */
2031 	uint8 PAD[2];
2032 } wl_radar_args_t;
2033 
2034 #define WL_RADAR_ARGS_VERSION 2
2035 
2036 typedef struct {
2037 	uint32 version; /**< version */
2038 	uint16 thresh0_20_lo;	/**< Radar detection, thresh 0 (range 5250-5350MHz) for BW 20MHz */
2039 	uint16 thresh1_20_lo;	/**< Radar detection, thresh 1 (range 5250-5350MHz) for BW 20MHz */
2040 	uint16 thresh0_40_lo;	/**< Radar detection, thresh 0 (range 5250-5350MHz) for BW 40MHz */
2041 	uint16 thresh1_40_lo;	/**< Radar detection, thresh 1 (range 5250-5350MHz) for BW 40MHz */
2042 	uint16 thresh0_80_lo;	/**< Radar detection, thresh 0 (range 5250-5350MHz) for BW 80MHz */
2043 	uint16 thresh1_80_lo;	/**< Radar detection, thresh 1 (range 5250-5350MHz) for BW 80MHz */
2044 	uint16 thresh0_20_hi;	/**< Radar detection, thresh 0 (range 5470-5725MHz) for BW 20MHz */
2045 	uint16 thresh1_20_hi;	/**< Radar detection, thresh 1 (range 5470-5725MHz) for BW 20MHz */
2046 	uint16 thresh0_40_hi;	/**< Radar detection, thresh 0 (range 5470-5725MHz) for BW 40MHz */
2047 	uint16 thresh1_40_hi;	/**< Radar detection, thresh 1 (range 5470-5725MHz) for BW 40MHz */
2048 	uint16 thresh0_80_hi;	/**< Radar detection, thresh 0 (range 5470-5725MHz) for BW 80MHz */
2049 	uint16 thresh1_80_hi;	/**< Radar detection, thresh 1 (range 5470-5725MHz) for BW 80MHz */
2050 	uint16 thresh0_160_lo;	/**< Radar detection, thresh 0 (range 5250-5350MHz) for BW 160MHz */
2051 	uint16 thresh1_160_lo;	/**< Radar detection, thresh 1 (range 5250-5350MHz) for BW 160MHz */
2052 	uint16 thresh0_160_hi;	/**< Radar detection, thresh 0 (range 5470-5725MHz) for BW 160MHz */
2053 	uint16 thresh1_160_hi;	/**< Radar detection, thresh 1 (range 5470-5725MHz) for BW 160MHz */
2054 } wl_radar_thr_t;
2055 
2056 typedef struct {
2057 	uint32 version; /* version */
2058 	uint16 thresh0_sc_20_lo;
2059 	uint16 thresh1_sc_20_lo;
2060 	uint16 thresh0_sc_40_lo;
2061 	uint16 thresh1_sc_40_lo;
2062 	uint16 thresh0_sc_80_lo;
2063 	uint16 thresh1_sc_80_lo;
2064 	uint16 thresh0_sc_20_hi;
2065 	uint16 thresh1_sc_20_hi;
2066 	uint16 thresh0_sc_40_hi;
2067 	uint16 thresh1_sc_40_hi;
2068 	uint16 thresh0_sc_80_hi;
2069 	uint16 thresh1_sc_80_hi;
2070 	uint16 fc_varth_sb;
2071 	uint16 fc_varth_bin5_sb;
2072 	uint16 notradar_enb;
2073 	uint16 max_notradar_lp;
2074 	uint16 max_notradar;
2075 	uint16 max_notradar_lp_sc;
2076 	uint16 max_notradar_sc;
2077 	uint16 highpow_war_enb;
2078 	uint16 highpow_sp_ratio;	//unit is 0.5
2079 } wl_radar_thr2_t;
2080 
2081 #define WL_RADAR_THR_VERSION	2
2082 
2083 typedef struct {
2084 	uint32 ver;
2085 	uint32 len;
2086 	int32  rssi_th[3];
2087 	uint8  rssi_gain_80[4];
2088 	uint8  rssi_gain_160[4];
2089 } wl_dyn_switch_th_t;
2090 
2091 #define WL_PHY_DYN_SWITCH_TH_VERSION	1
2092 
2093 /** RSSI per antenna */
2094 typedef struct {
2095 	uint32	version;		/**< version field */
2096 	uint32	count;			/**< number of valid antenna rssi */
2097 	int8 rssi_ant[WL_RSSI_ANT_MAX];	/**< rssi per antenna */
2098 } wl_rssi_ant_t;
2099 
2100 /* SNR per antenna */
2101 typedef struct {
2102 	uint32  version;				/* version field */
2103 	uint32  count;					/* number of valid antenna snr */
2104 	int8 snr_ant[WL_RSSI_ANT_MAX];	/* snr per antenna */
2105 } wl_snr_ant_t;
2106 
2107 
2108 /** data structure used in 'dfs_status' wl interface, which is used to query dfs status */
2109 typedef struct {
2110 	uint32 state;		/**< noted by WL_DFS_CACSTATE_XX. */
2111 	uint32 duration;		/**< time spent in ms in state. */
2112 	/**
2113 	 * as dfs enters ISM state, it removes the operational channel from quiet channel
2114 	 * list and notes the channel in channel_cleared. set to 0 if no channel is cleared
2115 	 */
2116 	chanspec_t chanspec_cleared;
2117 	/** chanspec cleared used to be a uint32, add another to uint16 to maintain size */
2118 	uint16 pad;
2119 } wl_dfs_status_t;
2120 
2121 typedef struct {
2122 	uint32 state;		/* noted by WL_DFS_CACSTATE_XX */
2123 	uint32 duration;		/* time spent in ms in state */
2124 	chanspec_t chanspec;	/* chanspec of this core */
2125 	chanspec_t chanspec_last_cleared; /* chanspec last cleared for operation by scanning */
2126 	uint16 sub_type;	/* currently just the index of the core or the respective PLL */
2127 	uint16 pad;
2128 } wl_dfs_sub_status_t;
2129 
2130 #define WL_DFS_STATUS_ALL_VERSION	(1)
2131 typedef struct {
2132 	uint16 version;		/* version field; current max version 1 */
2133 	uint16 num_sub_status;
2134 	wl_dfs_sub_status_t  dfs_sub_status[1]; /* struct array of length num_sub_status */
2135 } wl_dfs_status_all_t;
2136 
2137 #define WL_DFS_AP_MOVE_VERSION	(1)
2138 
2139 struct wl_dfs_ap_move_status_v1 {
2140 	int16 dfs_status;	/* DFS scan status */
2141 	chanspec_t chanspec;	/* New AP Chanspec */
2142 	wl_dfs_status_t cac_status;	/* CAC status */
2143 };
2144 
2145 typedef struct wl_dfs_ap_move_status_v2 {
2146 	int8 version;            /* version field; current max version 1 */
2147 	int8 move_status;        /* DFS move status */
2148 	chanspec_t chanspec;     /* New AP Chanspec */
2149 	wl_dfs_status_all_t scan_status; /* status; see dfs_status_all for wl_dfs_status_all_t */
2150 } wl_dfs_ap_move_status_v2_t;
2151 
2152 #define WL_DFS_AP_MOVE_ABORT -1		/* Abort any dfs_ap_move in progress immediately */
2153 #define WL_DFS_AP_MOVE_STUNT -2		/* Stunt move but continue background CSA if in progress */
2154 
2155 
2156 /** data structure used in 'radar_status' wl interface, which is use to query radar det status */
2157 typedef struct {
2158 	uint8 detected;
2159 	uint8 PAD[3];
2160 	int32 count;
2161 	uint8 pretended;
2162 	uint8 PAD[3];
2163 	uint32 radartype;
2164 	uint32 timenow;
2165 	uint32 timefromL;
2166 	int32  lp_csect_single;
2167 	int32  detected_pulse_index;
2168 	int32  nconsecq_pulses;
2169 	chanspec_t ch;
2170 	uint8 PAD[2];
2171 	int32  pw[10];
2172 	int32  intv[10];
2173 	int32  fm[10];
2174 } wl_radar_status_t;
2175 
2176 #define NUM_PWRCTRL_RATES 12
2177 
2178 typedef struct {
2179 	uint8 txpwr_band_max[NUM_PWRCTRL_RATES];	/**< User set target */
2180 	uint8 txpwr_limit[NUM_PWRCTRL_RATES];		/**< reg and local power limit */
2181 	uint8 txpwr_local_max;				/**< local max according to the AP */
2182 	uint8 txpwr_local_constraint;			/**< local constraint according to the AP */
2183 	uint8 txpwr_chan_reg_max;			/**< Regulatory max for this channel */
2184 	uint8 txpwr_target[2][NUM_PWRCTRL_RATES];	/**< Latest target for 2.4 and 5 Ghz */
2185 	uint8 txpwr_est_Pout[2];			/**< Latest estimate for 2.4 and 5 Ghz */
2186 	uint8 txpwr_opo[NUM_PWRCTRL_RATES];		/**< On G phy, OFDM power offset */
2187 	uint8 txpwr_bphy_cck_max[NUM_PWRCTRL_RATES];	/**< Max CCK power for this band (SROM) */
2188 	uint8 txpwr_bphy_ofdm_max;			/**< Max OFDM power for this band (SROM) */
2189 	uint8 txpwr_aphy_max[NUM_PWRCTRL_RATES];	/**< Max power for A band (SROM) */
2190 	int8  txpwr_antgain[2];				/**< Ant gain for each band - from SROM */
2191 	uint8 txpwr_est_Pout_gofdm;			/**< Pwr estimate for 2.4 OFDM */
2192 } tx_power_legacy_t;
2193 
2194 #define WL_TX_POWER_RATES_LEGACY    45
2195 #define WL_TX_POWER_MCS20_FIRST         12
2196 #define WL_TX_POWER_MCS20_NUM           16
2197 #define WL_TX_POWER_MCS40_FIRST         28
2198 #define WL_TX_POWER_MCS40_NUM           17
2199 
2200 typedef struct {
2201 	uint32 flags;
2202 	chanspec_t chanspec;                 /**< txpwr report for this channel */
2203 	chanspec_t local_chanspec;           /**< channel on which we are associated */
2204 	uint8 local_max;                 /**< local max according to the AP */
2205 	uint8 local_constraint;              /**< local constraint according to the AP */
2206 	int8  antgain[2];                /**< Ant gain for each band - from SROM */
2207 	uint8 rf_cores;                  /**< count of RF Cores being reported */
2208 	uint8 est_Pout[4];                           /**< Latest tx power out estimate per RF
2209 							  * chain without adjustment
2210 							  */
2211 	uint8 est_Pout_cck;                          /**< Latest CCK tx power out estimate */
2212 	uint8 user_limit[WL_TX_POWER_RATES_LEGACY];  /**< User limit */
2213 	uint8 reg_limit[WL_TX_POWER_RATES_LEGACY];   /**< Regulatory power limit */
2214 	uint8 board_limit[WL_TX_POWER_RATES_LEGACY]; /**< Max power board can support (SROM) */
2215 	uint8 target[WL_TX_POWER_RATES_LEGACY];      /**< Latest target power */
2216 	uint8 PAD[2];
2217 } tx_power_legacy2_t;
2218 
2219 #define WL_NUM_2x2_ELEMENTS		4
2220 #define WL_NUM_3x3_ELEMENTS		6
2221 #define WL_NUM_4x4_ELEMENTS		10
2222 
2223 typedef struct {
2224 	uint16 ver;				/**< version of this struct */
2225 	uint16 len;				/**< length in bytes of this structure */
2226 	uint32 flags;
2227 	chanspec_t chanspec;			/**< txpwr report for this channel */
2228 	chanspec_t local_chanspec;		/**< channel on which we are associated */
2229 	uint32     buflen;			/**< ppr buffer length */
2230 	uint8      pprbuf[1];			/**< Latest target power buffer */
2231 } wl_txppr_t;
2232 
2233 #define WL_TXPPR_VERSION	1
2234 #define WL_TXPPR_LENGTH	(sizeof(wl_txppr_t))
2235 #define TX_POWER_T_VERSION	45
2236 /** number of ppr serialization buffers, it should be reg, board and target */
2237 #define WL_TXPPR_SER_BUF_NUM	(3)
2238 
2239 typedef struct chanspec_txpwr_max {
2240 	chanspec_t chanspec;   /**< chanspec */
2241 	uint8 txpwr_max;       /**< max txpwr in all the rates */
2242 	uint8 padding;
2243 } chanspec_txpwr_max_t;
2244 
2245 typedef struct  wl_chanspec_txpwr_max {
2246 	uint16 ver;			/**< version of this struct */
2247 	uint16 len;			/**< length in bytes of this structure */
2248 	uint32 count;		/**< number of elements of (chanspec, txpwr_max) pair */
2249 	chanspec_txpwr_max_t txpwr[1];	/**< array of (chanspec, max_txpwr) pair */
2250 } wl_chanspec_txpwr_max_t;
2251 
2252 #define WL_CHANSPEC_TXPWR_MAX_VER	1
2253 #define WL_CHANSPEC_TXPWR_MAX_LEN	(sizeof(wl_chanspec_txpwr_max_t))
2254 
2255 typedef struct tx_inst_power {
2256 	uint8 txpwr_est_Pout[2];			/**< Latest estimate for 2.4 and 5 Ghz */
2257 	uint8 txpwr_est_Pout_gofdm;			/**< Pwr estimate for 2.4 OFDM */
2258 } tx_inst_power_t;
2259 
2260 #define WL_NUM_TXCHAIN_MAX	4
2261 typedef struct wl_txchain_pwr_offsets {
2262 	int8 offset[WL_NUM_TXCHAIN_MAX];	/**< quarter dBm signed offset for each chain */
2263 } wl_txchain_pwr_offsets_t;
2264 
2265 /** maximum channels returned by the get valid channels iovar */
2266 #define WL_NUMCHANNELS		64
2267 #define WL_NUMCHANNELS_MANY_CHAN 10
2268 #define WL_ITER_LIMIT_MANY_CHAN 5
2269 
2270 #define WL_MIMO_PS_CFG_VERSION_1 1
2271 
2272 typedef struct wl_mimops_cfg {
2273 	uint8 version;
2274 	/* active_chains: 0 for all, 1 for 1 chain. */
2275 	uint8 active_chains;
2276 	/* static (0) or dynamic (1).or disabled (3) Mode applies only when active_chains = 0. */
2277 	uint8 mode;
2278 	/* bandwidth = Full (0), 20M (1), 40M (2), 80M (3). */
2279 	uint8 bandwidth;
2280 	uint8 applychangesafterlearning;
2281 	uint8 pad[3];
2282 } wl_mimops_cfg_t;
2283 
2284 /* This event is for tracing MIMO PS metrics snapshot calls.
2285  * It is helpful to debug out-of-sync issue between
2286  * ucode SHM values and FW snapshot calculation.
2287  * It is part of the EVENT_LOG_TAG_MIMO_PS_TRACE.
2288  */
2289 #define WL_MIMO_PS_METRICS_SNAPSHOT_TRACE_TYPE	0
2290 typedef struct wl_mimo_ps_metrics_snapshot_trace {
2291 	/* type field for this TLV: */
2292 	uint16  type;
2293 	/* length field for this TLV */
2294 	uint16  len;
2295 	uint32  idle_slotcnt_mimo;	/* MIMO idle slotcnt raw SHM value */
2296 	uint32  last_idle_slotcnt_mimo;	/* stored value snapshot */
2297 	uint32  idle_slotcnt_siso;	/* SISO idle slotcnt raw SHM value */
2298 	uint32  last_idle_slotcnt_siso;	/* stored value snapshot */
2299 	uint32	rx_time_mimo;		/* Rx MIMO raw SHM value */
2300 	uint32	last_rx_time_mimo;	/* stored value snapshot */
2301 	uint32	rx_time_siso;		/* RX SISO raw SHM value */
2302 	uint32	last_rx_time_siso;	/* stored value snapshot */
2303 	uint32  tx_time_1chain;		/* Tx 1-chain raw SHM value */
2304 	uint32  last_tx_time_1chain;	/* stored value snapshot */
2305 	uint32	tx_time_2chain;		/* Tx 2-chain raw SHM value */
2306 	uint32	last_tx_time_2chain;	/* stored value snapshot */
2307 	uint32  tx_time_3chain;		/* Tx 3-chain raw SHM value */
2308 	uint32  last_tx_time_3chain;	/* stored value snapshot */
2309 	uint16	reason;			/* reason for snapshot call, see below */
2310 	/* Does the call reset last values after delta calculation */
2311 	uint16	reset_last;
2312 } wl_mimo_ps_metrics_snapshot_trace_t;
2313 /* reason codes for mimo ps metrics snapshot function calls */
2314 #define WL_MIMOPS_METRICS_SNAPSHOT_REPORT		1
2315 #define WL_MIMOPS_METRICS_SNAPSHOT_RXCHAIN_SET		2
2316 #define WL_MIMOPS_METRICS_SNAPSHOT_ARBI			3
2317 #define WL_MIMOPS_METRICS_SNAPSHOT_SLOTUPD		4
2318 #define WL_MIMOPS_METRICS_SNAPSHOT_PMBCNRX		5
2319 #define WL_MIMOPS_METRICS_SNAPSHOT_BMACINIT		6
2320 #define WL_MIMOPS_METRICS_SNAPSHOT_HT_COMPLETE		7
2321 #define WL_MIMOPS_METRICS_SNAPSHOT_OCL                  8
2322 
2323 #define WL_MIMO_PS_STATUS_VERSION_2	2
2324 typedef struct wl_mimo_ps_status {
2325 	uint8 version;
2326 	uint8 ap_cap;			/* The associated AP's capability (BW, MIMO/SISO). */
2327 	uint8 association_status;	/* How we are associated to the AP (MIMO/SISO). */
2328 	uint8 mimo_ps_state;		/* mimo_ps_cfg states: [0-5]. See below for values */
2329 	uint8 mrc_state;		/* MRC state: NONE (0), ACTIVE(1) */
2330 	uint8 bss_rxchain;		/* bss rxchain bitmask */
2331 	uint8 bss_txchain;		/* bss txchain bitmask */
2332 	uint8 bss_bw;			/* bandwidth: Full (0), 20M (1), 40M (2), 80M (3), etc */
2333 	uint16 hw_state;		/* bitmask of hw state. See below for values */
2334 	uint8 hw_rxchain;		/* actual HW rxchain bitmask */
2335 	uint8 hw_txchain;		/* actual HW txchain bitmask */
2336 	uint8 hw_bw;			/* bandwidth: Full (0), 20M (1), 40M (2), 80M (3), etc */
2337 	uint8 pm_bcnrx_state;		/* actual state of ucode flag */
2338 	uint8 basic_rates_present;	/* internal flag to trigger siso bcmc rx */
2339 	uint8 siso_bcmc_rx_state;	/* actual state of ucode flag */
2340 } wl_mimo_ps_status_t;
2341 
2342 #define WL_MIMO_PS_STATUS_VERSION_1	1
2343 typedef struct wl_mimo_ps_status_v1 {
2344 	uint8 version;
2345 	uint8 ap_cap;			/* The associated AP's capability (BW, MIMO/SISO). */
2346 	uint8 association_status;	/* How we are associated to the AP (MIMO/SISO). */
2347 	uint8 mimo_ps_state;		/* mimo_ps_cfg states: [0-5]. See below for values */
2348 	uint8 mrc_state;		/* MRC state: NONE (0), ACTIVE(1) */
2349 	uint8 bss_rxchain;		/* bss rxchain bitmask */
2350 	uint8 bss_txchain;		/* bss txchain bitmask */
2351 	uint8 bss_bw;			/* bandwidth: Full (0), 20M (1), 40M (2), 80M (3), etc */
2352 	uint16 hw_state;		/* bitmask of hw state. See below for values */
2353 	uint8 hw_rxchain;		/* actual HW rxchain bitmask */
2354 	uint8 hw_txchain;		/* actual HW txchain bitmask */
2355 	uint8 hw_bw;			/* bandwidth: Full (0), 20M (1), 40M (2), 80M (3), etc */
2356 	uint8 pad[3];
2357 } wl_mimo_ps_status_v1_t;
2358 
2359 #define WL_MIMO_PS_STATUS_AP_CAP(ap_cap)	(ap_cap & 0x0F)
2360 #define WL_MIMO_PS_STATUS_AP_CAP_BW(ap_cap)	(ap_cap >> 4)
2361 #define WL_MIMO_PS_STATUS_ASSOC_BW_SHIFT 4
2362 
2363 /* version 3: assoc status: low nibble is status enum, high other flags */
2364 #define WL_MIMO_PS_STATUS_VERSION_3			3
2365 #define WL_MIMO_PS_STATUS_ASSOC_STATUS_MASK		0x0F
2366 #define WL_MIMO_PS_STATUS_ASSOC_STATUS_VHT_WITHOUT_OMN	0x80
2367 
2368 /* mimo_ps_status: ap_cap/association status */
2369 enum {
2370 	WL_MIMO_PS_STATUS_ASSOC_NONE	= 0,
2371 	WL_MIMO_PS_STATUS_ASSOC_SISO	= 1,
2372 	WL_MIMO_PS_STATUS_ASSOC_MIMO	= 2,
2373 	WL_MIMO_PS_STATUS_ASSOC_LEGACY	= 3
2374 };
2375 
2376 /* mimo_ps_status: mimo_ps_cfg states */
2377 enum {
2378 	WL_MIMO_PS_CFG_STATE_NONE			= 0,
2379 	WL_MIMO_PS_CFG_STATE_INFORM_AP_INPROGRESS	= 1,
2380 	WL_MIMO_PS_CFG_STATE_INFORM_AP_DONE		= 2,
2381 	WL_MIMO_PS_CFG_STATE_LEARNING			= 3,
2382 	WL_MIMO_PS_CFG_STATE_HW_CONFIGURE		= 4,
2383 	WL_MIMO_PS_CFG_STATE_INFORM_AP_PENDING		= 5
2384 };
2385 
2386 /* mimo_ps_status: hw_state values */
2387 #define WL_MIMO_PS_STATUS_HW_STATE_NONE			0
2388 #define WL_MIMO_PS_STATUS_HW_STATE_LTECOEX		(0x1 << 0)
2389 #define WL_MIMO_PS_STATUS_HW_STATE_MIMOPS_BSS		(0x1 << 1)
2390 #define WL_MIMO_PS_STATUS_HW_STATE_AWDL_BSS		(0x1 << 2)
2391 #define WL_MIMO_PS_STATUS_HW_STATE_SCAN			(0x1 << 3)
2392 #define WL_MIMO_PS_STATUS_HW_STATE_TXPPR		(0x1 << 4)
2393 #define WL_MIMO_PS_STATUS_HW_STATE_PWRTHOTTLE		(0x1 << 5)
2394 #define WL_MIMO_PS_STATUS_HW_STATE_TMPSENSE		(0x1 << 6)
2395 #define WL_MIMO_PS_STATUS_HW_STATE_IOVAR		(0x1 << 7)
2396 #define WL_MIMO_PS_STATUS_HW_STATE_AP_BSS		(0x1 << 8)
2397 
2398 /* mimo_ps_status: mrc states */
2399 #define WL_MIMO_PS_STATUS_MRC_NONE	0
2400 #define WL_MIMO_PS_STATUS_MRC_ACTIVE	1
2401 
2402 /* mimo_ps_status: core flag states for single-core beacon and siso-bcmc rx */
2403 #define WL_MIMO_PS_STATUS_MHF_FLAG_NONE		0
2404 #define WL_MIMO_PS_STATUS_MHF_FLAG_ACTIVE	1
2405 #define WL_MIMO_PS_STATUS_MHF_FLAG_COREDOWN	2
2406 #define WL_MIMO_PS_STATUS_MHF_FLAG_INVALID	3
2407 
2408 /* Type values for the REASON */
2409 #define WL_MIMO_PS_PS_LEARNING_ABORTED          (1 << 0)
2410 #define WL_MIMO_PS_PS_LEARNING_COMPLETED        (1 << 1)
2411 #define WL_MIMO_PS_PS_LEARNING_ONGOING          (1 << 2)
2412 
2413 typedef struct wl_mimo_ps_learning_event_data {
2414 	uint32 startTimeStamp;
2415 	uint32 endTimeStamp;
2416 	uint16 reason;
2417 	struct ether_addr BSSID;
2418 	uint32 totalSISO_below_rssi_threshold;
2419 	uint32 totalMIMO_below_rssi_threshold;
2420 	uint32 totalSISO_above_rssi_threshold;
2421 	uint32 totalMIMO_above_rssi_threshold;
2422 } wl_mimo_ps_learning_event_data_t;
2423 
2424 #define WL_MIMO_PS_PS_LEARNING_CFG_ABORT	(1 << 0)
2425 #define WL_MIMO_PS_PS_LEARNING_CFG_STATUS	(1 << 1)
2426 #define WL_MIMO_PS_PS_LEARNING_CFG_CONFIG	(1 << 2)
2427 
2428 #define WL_MIMO_PS_PS_LEARNING_CFG_V1 1
2429 
2430 typedef struct wl_mimops_learning_cfg {
2431 	/* flag:  bit 0 for abort */
2432 	/* flag:  bit 1 for status */
2433 	/* flag:  bit 2 for configuring no of packets and rssi */
2434 	uint8                  flag;
2435 	/* mimo ps learning version, compatible version is 0 */
2436 	uint8                  version;
2437 	/* if version is 0 or rssi is 0, ignored */
2438 	int8                   learning_rssi_threshold;
2439 	uint8                  reserved;
2440 	uint32                 no_of_packets_for_learning;
2441 	wl_mimo_ps_learning_event_data_t mimops_learning_data;
2442 } wl_mimops_learning_cfg_t;
2443 
2444 
2445 #define WL_OCL_STATUS_VERSION 1
2446 typedef struct ocl_status_info {
2447 	uint8  version;
2448 	uint8  len;
2449 	uint16 fw_status;     /* Bits representing FW disable reasons */
2450 	uint8  hw_status;     /* Bits for actual HW config and SISO/MIMO coremask */
2451 	uint8  coremask;      /* The ocl core mask (indicating listening core) */
2452 } ocl_status_info_t;
2453 
2454 /* MWS OCL map */
2455 #define WL_MWS_OCL_OVERRIDE_VERSION 1
2456 typedef struct wl_mws_ocl_override {
2457 	uint16  version;    /* Structure version */
2458 	uint16	bitmap_2g; /* bitmap for 2.4G channels bits 1-13 */
2459 	uint16	bitmap_5g_lo;  /* bitmap for 5G low channels by 2:
2460 				*34-48, 52-56, 60-64, 100-102
2461 				*/
2462 	uint16	bitmap_5g_mid; /* bitmap for 5G mid channels by 2:
2463 				* 104, 108-112, 116-120, 124-128,
2464 				* 132-136, 140, 149-151
2465 				*/
2466 	uint16	bitmap_5g_high; /* bitmap for 5G high channels by 2
2467 				* 153, 157-161, 165
2468 				*/
2469 } wl_mws_ocl_override_t;
2470 
2471 /* Bits for fw_status */
2472 #define OCL_DISABLED_HOST		0x01   /* Host has disabled through ocl_enable */
2473 #define OCL_DISABLED_RSSI		0x02   /* Disabled because of ocl_rssi_threshold */
2474 #define OCL_DISABLED_LTEC		0x04   /* Disabled due to LTE Coex activity */
2475 #define OCL_DISABLED_SISO		0x08   /* Disabled while in SISO mode */
2476 #define OCL_DISABLED_CAL		0x10   /* Disabled during active calibration */
2477 #define OCL_DISABLED_CHANSWITCH		0x20   /* Disabled during active channel switch */
2478 #define OCL_DISABLED_ASPEND     0x40   /* Disabled due to assoc pending */
2479 
2480 /* Bits for hw_status */
2481 #define OCL_HWCFG			0x01   /* State of OCL config bit in phy HW */
2482 #define OCL_HWMIMO			0x02   /* Set if current coremask is > 1 bit */
2483 #define OCL_COREDOWN			0x80   /* Set if core is currently down */
2484 
2485 
2486 /*
2487  * Join preference iovar value is an array of tuples. Each tuple has a one-byte type,
2488  * a one-byte length, and a variable length value.  RSSI type tuple must be present
2489  * in the array.
2490  *
2491  * Types are defined in "join preference types" section.
2492  *
2493  * Length is the value size in octets. It is reserved for WL_JOIN_PREF_WPA type tuple
2494  * and must be set to zero.
2495  *
2496  * Values are defined below.
2497  *
2498  * 1. RSSI - 2 octets
2499  * offset 0: reserved
2500  * offset 1: reserved
2501  *
2502  * 2. WPA - 2 + 12 * n octets (n is # tuples defined below)
2503  * offset 0: reserved
2504  * offset 1: # of tuples
2505  * offset 2: tuple 1
2506  * offset 14: tuple 2
2507  * ...
2508  * offset 2 + 12 * (n - 1) octets: tuple n
2509  *
2510  * struct wpa_cfg_tuple {
2511  *   uint8 akm[DOT11_OUI_LEN+1];     akm suite
2512  *   uint8 ucipher[DOT11_OUI_LEN+1]; unicast cipher suite
2513  *   uint8 mcipher[DOT11_OUI_LEN+1]; multicast cipher suite
2514  * };
2515  *
2516  * multicast cipher suite can be specified as a specific cipher suite or WL_WPA_ACP_MCS_ANY.
2517  *
2518  * 3. BAND - 2 octets
2519  * offset 0: reserved
2520  * offset 1: see "band preference" and "band types"
2521  *
2522  * 4. BAND RSSI - 2 octets
2523  * offset 0: band types
2524  * offset 1: +ve RSSI boost value in dB
2525  */
2526 
2527 struct tsinfo_arg {
2528 	uint8 octets[3];
2529 };
2530 
2531 #define RATE_CCK_1MBPS 0
2532 #define RATE_CCK_2MBPS 1
2533 #define RATE_CCK_5_5MBPS 2
2534 #define RATE_CCK_11MBPS 3
2535 
2536 #define RATE_LEGACY_OFDM_6MBPS 0
2537 #define RATE_LEGACY_OFDM_9MBPS 1
2538 #define RATE_LEGACY_OFDM_12MBPS 2
2539 #define RATE_LEGACY_OFDM_18MBPS 3
2540 #define RATE_LEGACY_OFDM_24MBPS 4
2541 #define RATE_LEGACY_OFDM_36MBPS 5
2542 #define RATE_LEGACY_OFDM_48MBPS 6
2543 #define RATE_LEGACY_OFDM_54MBPS 7
2544 
2545 #define WL_BSSTRANS_RSSI_RATE_MAP_VERSION 1
2546 
2547 typedef struct wl_bsstrans_rssi {
2548 	int8 rssi_2g;	/**< RSSI in dbm for 2.4 G */
2549 	int8 rssi_5g;	/**< RSSI in dbm for 5G, unused for cck */
2550 } wl_bsstrans_rssi_t;
2551 
2552 #define RSSI_RATE_MAP_MAX_STREAMS 4	/**< max streams supported */
2553 
2554 /** RSSI to rate mapping, all 20Mhz, no SGI */
2555 typedef struct wl_bsstrans_rssi_rate_map {
2556 	uint16 ver;
2557 	uint16 len; /**< length of entire structure */
2558 	wl_bsstrans_rssi_t cck[WL_NUM_RATES_CCK]; /**< 2.4G only */
2559 	wl_bsstrans_rssi_t ofdm[WL_NUM_RATES_OFDM]; /**< 6 to 54mbps */
2560 	wl_bsstrans_rssi_t phy_n[RSSI_RATE_MAP_MAX_STREAMS][WL_NUM_RATES_MCS_1STREAM]; /* MCS0-7 */
2561 	wl_bsstrans_rssi_t phy_ac[RSSI_RATE_MAP_MAX_STREAMS][WL_NUM_RATES_VHT]; /**< MCS0-9 */
2562 } wl_bsstrans_rssi_rate_map_t;
2563 
2564 #define WL_BSSTRANS_ROAMTHROTTLE_VERSION 1
2565 
2566 /** Configure number of scans allowed per throttle period */
2567 typedef struct wl_bsstrans_roamthrottle {
2568 	uint16 ver;
2569 	uint16 period;
2570 	uint16 scans_allowed;
2571 } wl_bsstrans_roamthrottle_t;
2572 
2573 #define	NFIFO			6	/**< # tx/rx fifopairs */
2574 
2575 #if defined(BCM_DMA_CT) && !defined(BCM_DMA_CT_DISABLED)
2576 #define NFIFO_EXT		32		/* 6 traditional FIFOs + 2 rsvd + 24 MU FIFOs */
2577 #elif defined(WL11AX) && defined(WL11AX_TRIGGERQ_ENABLED)
2578 #define NFIFO_EXT		10
2579 #else
2580 #define NFIFO_EXT		NFIFO
2581 #endif
2582 
2583 /* Reinit reason codes */
2584 enum {
2585 	WL_REINIT_RC_NONE             = 0,
2586 	WL_REINIT_RC_PS_SYNC          = 1,
2587 	WL_REINIT_RC_PSM_WD           = 2,
2588 	WL_REINIT_RC_MAC_WAKE         = 3,
2589 	WL_REINIT_RC_MAC_SUSPEND      = 4,
2590 	WL_REINIT_RC_MAC_SPIN_WAIT    = 5,
2591 	WL_REINIT_RC_AXI_BUS_ERROR    = 6,
2592 	WL_REINIT_RC_DEVICE_REMOVED   = 7,
2593 	WL_REINIT_RC_PCIE_FATAL_ERROR = 8,
2594 	WL_REINIT_RC_OL_FW_TRAP       = 9,
2595 	WL_REINIT_RC_FIFO_ERR         = 10,
2596 	WL_REINIT_RC_INV_TX_STATUS    = 11,
2597 	WL_REINIT_RC_MQ_ERROR         = 12,
2598 	WL_REINIT_RC_PHYTXERR_THRESH  = 13,
2599 	WL_REINIT_RC_USER_FORCED      = 14,
2600 	WL_REINIT_RC_FULL_RESET       = 15,
2601 	WL_REINIT_RC_AP_BEACON        = 16,
2602 	WL_REINIT_RC_PM_EXCESSED      = 17,
2603 	WL_REINIT_RC_NO_CLK           = 18,
2604 	WL_REINIT_RC_SW_ASSERT        = 19,
2605 	WL_REINIT_RC_PSM_JMP0         = 20,
2606 	WL_REINIT_RC_PSM_RUN          = 21,
2607 	WL_REINIT_RC_ENABLE_MAC       = 22,
2608 	WL_REINIT_RC_SCAN_TIMEOUT     = 23,
2609 	WL_REINIT_RC_JOIN_TIMEOUT     = 24,
2610 	/* Below error codes are generated during D3 exit validation */
2611 	WL_REINIT_RC_LINK_NOT_ACTIVE  = 25,
2612 	WL_REINIT_RC_PCI_CFG_RD_FAIL  = 26,
2613 	WL_REINIT_RC_INV_VEN_ID       = 27,
2614 	WL_REINIT_RC_INV_DEV_ID       = 28,
2615 	WL_REINIT_RC_INV_BAR0         = 29,
2616 	WL_REINIT_RC_INV_BAR2         = 30,
2617 	WL_REINIT_RC_AER_UC_FATAL     = 31,
2618 	WL_REINIT_RC_AER_UC_NON_FATAL = 32,
2619 	WL_REINIT_RC_AER_CORR         = 33,
2620 	WL_REINIT_RC_AER_DEV_STS      = 34,
2621 	WL_REINIT_RC_PCIe_STS         = 35,
2622 	WL_REINIT_RC_MMIO_RD_FAIL     = 36,
2623 	WL_REINIT_RC_MMIO_RD_INVAL    = 37,
2624 	WL_REINIT_RC_MMIO_ARM_MEM_RD_FAIL = 38,
2625 	WL_REINIT_RC_MMIO_ARM_MEM_INVAL   = 39,
2626 	WL_REINIT_RC_SROM_LOAD_FAILED     = 40,
2627 	WL_REINIT_RC_PHY_CRASH            = 41,
2628 	WL_REINIT_TX_STALL                = 42,
2629 	WL_REINIT_RC_TX_FLOW_CONTROL_BLOCKED	= 43,
2630 	WL_REINIT_RC_RX_HC_FAIL           = 44,
2631 	WL_REINIT_RC_RX_DMA_STALL         = 45,
2632 	WL_REINIT_UTRACE_BUF_OVERLAP_SR	  = 46,
2633 	WL_REINIT_UTRACE_TPL_OUT_BOUNDS   = 47,
2634 	WL_REINIT_UTRACE_TPL_OSET_STRT0   = 48,
2635 	WL_REINIT_RC_PHYTXERR             = 49,
2636 	WL_REINIT_RC_PSM_FATAL_SUSP       = 50,
2637 	WL_REINIT_RC_TX_FIFO_SUSP         = 51,
2638 	WL_REINIT_RC_MAC_ENABLE           = 52,
2639 	WL_REINIT_RC_SCAN_STALLED         = 53,
2640 	WL_REINIT_RC_LAST	/* This must be the last entry */
2641 };
2642 
2643 #define NREINITREASONCOUNT	8
2644 
2645 #define REINITRSNIDX(_x)	(((_x) < WL_REINIT_RC_LAST) ? (_x) : 0)
2646 
2647 #define	WL_CNT_T_VERSION	30	/**< current version of wl_cnt_t struct */
2648 #define WL_CNT_VERSION_6	6
2649 #define WL_CNT_VERSION_11	11
2650 #define WL_CNT_VERSION_XTLV	30
2651 
2652 #define WL_COUNTERS_IOV_VERSION_1	1
2653 #define WL_SUBCNTR_IOV_VER		WL_COUNTERS_IOV_VERSION_1
2654 /* First two uint16 are version and lenght fields. So offset of the first counter will be 4 */
2655 #define FIRST_COUNTER_OFFSET		0x04
2656 
2657 #define WLC_WITH_XTLV_CNT
2658 
2659 /**
2660  * tlv IDs uniquely identifies counter component
2661  * packed into wl_cmd_t container
2662  */
2663 enum wl_cnt_xtlv_id {
2664 	WL_CNT_XTLV_SLICE_IDX = 0x1,		/**< Slice index */
2665 	WL_CNT_XTLV_WLC = 0x100,		/**< WLC layer counters */
2666 	WL_CNT_XTLV_WLC_RINIT_RSN = 0x101,	/**< WLC layer reinitreason extension */
2667 	WL_CNT_XTLV_CNTV_LE10_UCODE = 0x200,	/**< wl counter ver < 11 UCODE MACSTAT */
2668 	WL_CNT_XTLV_LT40_UCODE_V1 = 0x300,	/**< corerev < 40 UCODE MACSTAT */
2669 	WL_CNT_XTLV_GE40_UCODE_V1 = 0x400,	/**< corerev >= 40 UCODE MACSTAT */
2670 	WL_CNT_XTLV_GE64_UCODEX_V1 = 0x800	/* corerev >= 64 UCODEX MACSTAT */
2671 };
2672 
2673 /**
2674  * The number of variables in wl macstat cnt struct.
2675  * (wl_cnt_ge40mcst_v1_t, wl_cnt_lt40mcst_v1_t, wl_cnt_v_le10_mcst_t)
2676  */
2677 #define WL_CNT_MCST_VAR_NUM 64
2678 /* sizeof(wl_cnt_ge40mcst_v1_t), sizeof(wl_cnt_lt40mcst_v1_t), and sizeof(wl_cnt_v_le10_mcst_t) */
2679 #define WL_CNT_MCST_STRUCT_SZ ((uint32)sizeof(uint32) * WL_CNT_MCST_VAR_NUM)
2680 
2681 #define WL_CNT_MCXST_STRUCT_SZ ((uint32)sizeof(wl_cnt_ge64mcxst_v1_t))
2682 #define INVALID_CNT_VAL (uint32)(-1)
2683 
2684 #define WL_XTLV_CNTBUF_MAX_SIZE ((uint32)(OFFSETOF(wl_cnt_info_t, data)) +	\
2685 		(uint32)BCM_XTLV_HDR_SIZE + (uint32)sizeof(wl_cnt_wlc_t) +		\
2686 		(uint32)BCM_XTLV_HDR_SIZE + WL_CNT_MCST_STRUCT_SZ +              \
2687 		(uint32)BCM_XTLV_HDR_SIZE + WL_CNT_MCXST_STRUCT_SZ)
2688 
2689 #define WL_CNTBUF_MAX_SIZE MAX(WL_XTLV_CNTBUF_MAX_SIZE, (uint32)sizeof(wl_cnt_ver_11_t))
2690 
2691 
2692 /** Top structure of counters IOVar buffer */
2693 typedef struct {
2694 	uint16	version;	/**< see definition of WL_CNT_T_VERSION */
2695 	uint16	datalen;	/**< length of data including all paddings. */
2696 	uint8   data [];	/**< variable length payload:
2697 				 * 1 or more bcm_xtlv_t type of tuples.
2698 				 * each tuple is padded to multiple of 4 bytes.
2699 				 * 'datalen' field of this structure includes all paddings.
2700 				 */
2701 } wl_cnt_info_t;
2702 
2703 /* Top structure of subcounters IOVar buffer
2704  * Whenever we make any change in this structure
2705  * WL_SUBCNTR_IOV_VER should be updated accordingly
2706  * The structure definition should remain consistant b/w
2707  * FW and wl/WLM app.
2708  */
2709 typedef struct {
2710 	uint16	version;	  /* Version of IOVAR structure. Used for backward
2711 				   * compatibility in future. Whenever we make any
2712 				   * changes to this structure then value of WL_SUBCNTR_IOV_VER
2713 				   * needs to be updated properly.
2714 				   */
2715 	uint16	length;		  /* length in bytes of this structure */
2716 	uint16	counters_version; /* see definition of WL_CNT_T_VERSION
2717 				   * wl app will send the version of counters
2718 				   * which is used to calculate the offset of counters.
2719 				   * It must match the version of counters FW is using
2720 				   * else FW will return error with his version of counters
2721 				   * set in this field.
2722 				   */
2723 	uint16	num_subcounters;  /* Number of counter offset passed by wl app to FW. */
2724 	uint32	data[1];	  /* variable length payload:
2725 				   * Offsets to the counters will be passed to FW
2726 				   * throught this data field. FW will return the value of counters
2727 				   * at the offsets passed by wl app in this fiels itself.
2728 				   */
2729 } wl_subcnt_info_t;
2730 
2731 /** wlc layer counters */
2732 typedef struct {
2733 	/* transmit stat counters */
2734 	uint32	txframe;	/**< tx data frames */
2735 	uint32	txbyte;		/**< tx data bytes */
2736 	uint32	txretrans;	/**< tx mac retransmits */
2737 	uint32	txerror;	/**< tx data errors (derived: sum of others) */
2738 	uint32	txctl;		/**< tx management frames */
2739 	uint32	txprshort;	/**< tx short preamble frames */
2740 	uint32	txserr;		/**< tx status errors */
2741 	uint32	txnobuf;	/**< tx out of buffers errors */
2742 	uint32	txnoassoc;	/**< tx discard because we're not associated */
2743 	uint32	txrunt;		/**< tx runt frames */
2744 	uint32	txchit;		/**< tx header cache hit (fastpath) */
2745 	uint32	txcmiss;	/**< tx header cache miss (slowpath) */
2746 
2747 	/* transmit chip error counters */
2748 	uint32	txuflo;		/**< tx fifo underflows */
2749 	uint32	txphyerr;	/**< tx phy errors (indicated in tx status) */
2750 	uint32	txphycrs;
2751 
2752 	/* receive stat counters */
2753 	uint32	rxframe;	/**< rx data frames */
2754 	uint32	rxbyte;		/**< rx data bytes */
2755 	uint32	rxerror;	/**< rx data errors (derived: sum of others) */
2756 	uint32	rxctl;		/**< rx management frames */
2757 	uint32	rxnobuf;	/**< rx out of buffers errors */
2758 	uint32	rxnondata;	/**< rx non data frames in the data channel errors */
2759 	uint32	rxbadds;	/**< rx bad DS errors */
2760 	uint32	rxbadcm;	/**< rx bad control or management frames */
2761 	uint32	rxfragerr;	/**< rx fragmentation errors */
2762 	uint32	rxrunt;		/**< rx runt frames */
2763 	uint32	rxgiant;	/**< rx giant frames */
2764 	uint32	rxnoscb;	/**< rx no scb error */
2765 	uint32	rxbadproto;	/**< rx invalid frames */
2766 	uint32	rxbadsrcmac;	/**< rx frames with Invalid Src Mac */
2767 	uint32	rxbadda;	/**< rx frames tossed for invalid da */
2768 	uint32	rxfilter;	/**< rx frames filtered out */
2769 
2770 	/* receive chip error counters */
2771 	uint32	rxoflo;		/**< rx fifo overflow errors */
2772 	uint32	rxuflo[NFIFO];	/**< rx dma descriptor underflow errors */
2773 
2774 	uint32	d11cnt_txrts_off;	/**< d11cnt txrts value when reset d11cnt */
2775 	uint32	d11cnt_rxcrc_off;	/**< d11cnt rxcrc value when reset d11cnt */
2776 	uint32	d11cnt_txnocts_off;	/**< d11cnt txnocts value when reset d11cnt */
2777 
2778 	/* misc counters */
2779 	uint32	dmade;		/**< tx/rx dma descriptor errors */
2780 	uint32	dmada;		/**< tx/rx dma data errors */
2781 	uint32	dmape;		/**< tx/rx dma descriptor protocol errors */
2782 	uint32	reset;		/**< reset count */
2783 	uint32	tbtt;		/**< cnts the TBTT int's */
2784 	uint32	txdmawar;
2785 	uint32	pkt_callback_reg_fail;	/**< callbacks register failure */
2786 
2787 	/* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
2788 	uint32	txfrag;		/**< dot11TransmittedFragmentCount */
2789 	uint32	txmulti;	/**< dot11MulticastTransmittedFrameCount */
2790 	uint32	txfail;		/**< dot11FailedCount */
2791 	uint32	txretry;	/**< dot11RetryCount */
2792 	uint32	txretrie;	/**< dot11MultipleRetryCount */
2793 	uint32	rxdup;		/**< dot11FrameduplicateCount */
2794 	uint32	txrts;		/**< dot11RTSSuccessCount */
2795 	uint32	txnocts;	/**< dot11RTSFailureCount */
2796 	uint32	txnoack;	/**< dot11ACKFailureCount */
2797 	uint32	rxfrag;		/**< dot11ReceivedFragmentCount */
2798 	uint32	rxmulti;	/**< dot11MulticastReceivedFrameCount */
2799 	uint32	rxcrc;		/**< dot11FCSErrorCount */
2800 	uint32	txfrmsnt;	/**< dot11TransmittedFrameCount (bogus MIB?) */
2801 	uint32	rxundec;	/**< dot11WEPUndecryptableCount */
2802 
2803 	/* WPA2 counters (see rxundec for DecryptFailureCount) */
2804 	uint32	tkipmicfaill;	/**< TKIPLocalMICFailures */
2805 	uint32	tkipcntrmsr;	/**< TKIPCounterMeasuresInvoked */
2806 	uint32	tkipreplay;	/**< TKIPReplays */
2807 	uint32	ccmpfmterr;	/**< CCMPFormatErrors */
2808 	uint32	ccmpreplay;	/**< CCMPReplays */
2809 	uint32	ccmpundec;	/**< CCMPDecryptErrors */
2810 	uint32	fourwayfail;	/**< FourWayHandshakeFailures */
2811 	uint32	wepundec;	/**< dot11WEPUndecryptableCount */
2812 	uint32	wepicverr;	/**< dot11WEPICVErrorCount */
2813 	uint32	decsuccess;	/**< DecryptSuccessCount */
2814 	uint32	tkipicverr;	/**< TKIPICVErrorCount */
2815 	uint32	wepexcluded;	/**< dot11WEPExcludedCount */
2816 
2817 	uint32	txchanrej;	/**< Tx frames suppressed due to channel rejection */
2818 	uint32	psmwds;		/**< Count PSM watchdogs */
2819 	uint32	phywatchdog;	/**< Count Phy watchdogs (triggered by ucode) */
2820 
2821 	/* MBSS counters, AP only */
2822 	uint32	prq_entries_handled;	/**< PRQ entries read in */
2823 	uint32	prq_undirected_entries;	/**<    which were bcast bss & ssid */
2824 	uint32	prq_bad_entries;	/**<    which could not be translated to info */
2825 	uint32	atim_suppress_count;	/**< TX suppressions on ATIM fifo */
2826 	uint32	bcn_template_not_ready;	/**< Template marked in use on send bcn ... */
2827 	uint32	bcn_template_not_ready_done; /**< ...but "DMA done" interrupt rcvd */
2828 	uint32	late_tbtt_dpc;	/**< TBTT DPC did not happen in time */
2829 
2830 	/* per-rate receive stat counters */
2831 	uint32  rx1mbps;	/**< packets rx at 1Mbps */
2832 	uint32  rx2mbps;	/**< packets rx at 2Mbps */
2833 	uint32  rx5mbps5;	/**< packets rx at 5.5Mbps */
2834 	uint32  rx6mbps;	/**< packets rx at 6Mbps */
2835 	uint32  rx9mbps;	/**< packets rx at 9Mbps */
2836 	uint32  rx11mbps;	/**< packets rx at 11Mbps */
2837 	uint32  rx12mbps;	/**< packets rx at 12Mbps */
2838 	uint32  rx18mbps;	/**< packets rx at 18Mbps */
2839 	uint32  rx24mbps;	/**< packets rx at 24Mbps */
2840 	uint32  rx36mbps;	/**< packets rx at 36Mbps */
2841 	uint32  rx48mbps;	/**< packets rx at 48Mbps */
2842 	uint32  rx54mbps;	/**< packets rx at 54Mbps */
2843 	uint32  rx108mbps;	/**< packets rx at 108mbps */
2844 	uint32  rx162mbps;	/**< packets rx at 162mbps */
2845 	uint32  rx216mbps;	/**< packets rx at 216 mbps */
2846 	uint32  rx270mbps;	/**< packets rx at 270 mbps */
2847 	uint32  rx324mbps;	/**< packets rx at 324 mbps */
2848 	uint32  rx378mbps;	/**< packets rx at 378 mbps */
2849 	uint32  rx432mbps;	/**< packets rx at 432 mbps */
2850 	uint32  rx486mbps;	/**< packets rx at 486 mbps */
2851 	uint32  rx540mbps;	/**< packets rx at 540 mbps */
2852 
2853 	uint32	rfdisable;	/**< count of radio disables */
2854 
2855 	uint32	txexptime;	/**< Tx frames suppressed due to timer expiration */
2856 
2857 	uint32	txmpdu_sgi;	/**< count for sgi transmit */
2858 	uint32	rxmpdu_sgi;	/**< count for sgi received */
2859 	uint32	txmpdu_stbc;	/**< count for stbc transmit */
2860 	uint32	rxmpdu_stbc;	/**< count for stbc received */
2861 
2862 	uint32	rxundec_mcst;	/**< dot11WEPUndecryptableCount */
2863 
2864 	/* WPA2 counters (see rxundec for DecryptFailureCount) */
2865 	uint32	tkipmicfaill_mcst;	/**< TKIPLocalMICFailures */
2866 	uint32	tkipcntrmsr_mcst;	/**< TKIPCounterMeasuresInvoked */
2867 	uint32	tkipreplay_mcst;	/**< TKIPReplays */
2868 	uint32	ccmpfmterr_mcst;	/**< CCMPFormatErrors */
2869 	uint32	ccmpreplay_mcst;	/**< CCMPReplays */
2870 	uint32	ccmpundec_mcst;	/**< CCMPDecryptErrors */
2871 	uint32	fourwayfail_mcst;	/**< FourWayHandshakeFailures */
2872 	uint32	wepundec_mcst;	/**< dot11WEPUndecryptableCount */
2873 	uint32	wepicverr_mcst;	/**< dot11WEPICVErrorCount */
2874 	uint32	decsuccess_mcst;	/**< DecryptSuccessCount */
2875 	uint32	tkipicverr_mcst;	/**< TKIPICVErrorCount */
2876 	uint32	wepexcluded_mcst;	/**< dot11WEPExcludedCount */
2877 
2878 	uint32	dma_hang;	/**< count for dma hang */
2879 	uint32	reinit;		/**< count for reinit */
2880 
2881 	uint32  pstatxucast;	/**< count of ucast frames xmitted on all psta assoc */
2882 	uint32  pstatxnoassoc;	/**< count of txnoassoc frames xmitted on all psta assoc */
2883 	uint32  pstarxucast;	/**< count of ucast frames received on all psta assoc */
2884 	uint32  pstarxbcmc;	/**< count of bcmc frames received on all psta */
2885 	uint32  pstatxbcmc;	/**< count of bcmc frames transmitted on all psta */
2886 
2887 	uint32  cso_passthrough; /**< hw cso required but passthrough */
2888 	uint32	cso_normal;	/**< hw cso hdr for normal process */
2889 	uint32	chained;	/**< number of frames chained */
2890 	uint32	chainedsz1;	/**< number of chain size 1 frames */
2891 	uint32	unchained;	/**< number of frames not chained */
2892 	uint32	maxchainsz;	/**< max chain size so far */
2893 	uint32	currchainsz;	/**< current chain size */
2894 	uint32	pciereset;	/**< Secondary Bus Reset issued by driver */
2895 	uint32	cfgrestore;	/**< configspace restore by driver */
2896 	uint32	reinitreason[NREINITREASONCOUNT]; /**< reinitreason counters; 0: Unknown reason */
2897 	uint32	rxrtry;
2898 	uint32  rxmpdu_mu;      /**< Number of MU MPDUs received */
2899 
2900 	/* detailed control/management frames */
2901 	uint32	txbar;		/**< Number of TX BAR */
2902 	uint32	rxbar;		/**< Number of RX BAR */
2903 	uint32	txpspoll;	/**< Number of TX PS-poll */
2904 	uint32	rxpspoll;	/**< Number of RX PS-poll */
2905 	uint32	txnull;		/**< Number of TX NULL_DATA */
2906 	uint32	rxnull;		/**< Number of RX NULL_DATA */
2907 	uint32	txqosnull;	/**< Number of TX NULL_QoSDATA */
2908 	uint32	rxqosnull;	/**< Number of RX NULL_QoSDATA */
2909 	uint32	txassocreq;	/**< Number of TX ASSOC request */
2910 	uint32	rxassocreq;	/**< Number of RX ASSOC request */
2911 	uint32	txreassocreq;	/**< Number of TX REASSOC request */
2912 	uint32	rxreassocreq;	/**< Number of RX REASSOC request */
2913 	uint32	txdisassoc;	/**< Number of TX DISASSOC */
2914 	uint32	rxdisassoc;	/**< Number of RX DISASSOC */
2915 	uint32	txassocrsp;	/**< Number of TX ASSOC response */
2916 	uint32	rxassocrsp;	/**< Number of RX ASSOC response */
2917 	uint32	txreassocrsp;	/**< Number of TX REASSOC response */
2918 	uint32	rxreassocrsp;	/**< Number of RX REASSOC response */
2919 	uint32	txauth;		/**< Number of TX AUTH */
2920 	uint32	rxauth;		/**< Number of RX AUTH */
2921 	uint32	txdeauth;	/**< Number of TX DEAUTH */
2922 	uint32	rxdeauth;	/**< Number of RX DEAUTH */
2923 	uint32	txprobereq;	/**< Number of TX probe request */
2924 	uint32	rxprobereq;	/**< Number of RX probe request */
2925 	uint32	txprobersp;	/**< Number of TX probe response */
2926 	uint32	rxprobersp;	/**< Number of RX probe response */
2927 	uint32	txaction;	/**< Number of TX action frame */
2928 	uint32	rxaction;	/**< Number of RX action frame */
2929 	uint32  ampdu_wds;	/**< Number of AMPDU watchdogs */
2930 	uint32  txlost;		/**< Number of lost packets reported in txs */
2931 	uint32	txdatamcast;	/**< Number of TX multicast data packets */
2932 	uint32	txdatabcast;	/**< Number of TX broadcast data packets */
2933 	uint32	psmxwds;	/**< Number of PSMx watchdogs */
2934 	uint32  rxback;
2935 	uint32  txback;
2936 	uint32  p2p_tbtt;	/**< Number of P2P TBTT Events */
2937 	uint32  p2p_tbtt_miss;	/**< Number of P2P TBTT Events Miss */
2938 	uint32	txqueue_start;
2939 	uint32	txqueue_end;
2940 	uint32  txbcast;        /* Broadcast TransmittedFrameCount */
2941 	uint32  txdropped;      /* tx dropped pkts */
2942 	uint32  rxbcast;        /* BroadcastReceivedFrameCount */
2943 	uint32  rxdropped;      /* rx dropped pkts (derived: sum of others) */
2944 } wl_cnt_wlc_t;
2945 
2946 /* Reinit reasons - do not put anything else other than reinit reasons here */
2947 typedef struct {
2948 	uint32 rsn[WL_REINIT_RC_LAST];
2949 } reinit_rsns_t;
2950 
2951 /* MACXSTAT counters for ucodex (corerev >= 64) */
2952 typedef struct {
2953 	uint32 macxsusp;
2954 	uint32 m2vmsg;
2955 	uint32 v2mmsg;
2956 	uint32 mboxout;
2957 	uint32 musnd;
2958 	uint32 sfb2v;
2959 } wl_cnt_ge64mcxst_v1_t;
2960 
2961 /** MACSTAT counters for ucode (corerev >= 40) */
2962 typedef struct {
2963 	/* MAC counters: 32-bit version of d11.h's macstat_t */
2964 	uint32	txallfrm;	/**< total number of frames sent, incl. Data, ACK, RTS, CTS,
2965 				 * Control Management (includes retransmissions)
2966 				 */
2967 	uint32	txrtsfrm;	/**< number of RTS sent out by the MAC */
2968 	uint32	txctsfrm;	/**< number of CTS sent out by the MAC */
2969 	uint32	txackfrm;	/**< number of ACK frames sent out */
2970 	uint32	txdnlfrm;	/**< number of Null-Data transmission generated from template  */
2971 	uint32	txbcnfrm;	/**< beacons transmitted */
2972 	uint32	txfunfl[6];	/**< per-fifo tx underflows */
2973 	uint32	txampdu;	/**< number of AMPDUs transmitted */
2974 	uint32	txmpdu;		/**< number of MPDUs transmitted */
2975 	uint32	txtplunfl;	/**< Template underflows (mac was too slow to transmit ACK/CTS
2976 				 * or BCN)
2977 				 */
2978 	uint32	txphyerror;	/**< Transmit phy error, type of error is reported in tx-status for
2979 				 * driver enqueued frames
2980 				 */
2981 	uint32  pktengrxducast; /**< unicast frames rxed by the pkteng code */
2982 	uint32  pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
2983 	uint32	rxfrmtoolong;	/**< Received frame longer than legal limit (2346 bytes) */
2984 	uint32	rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
2985 	uint32	rxanyerr;	/**< Any RX error that is not counted by other counters. */
2986 	uint32	rxbadfcs;	/**< number of frames for which the CRC check failed in the MAC */
2987 	uint32	rxbadplcp;	/**< parity check of the PLCP header failed */
2988 	uint32	rxcrsglitch;	/**< PHY was able to correlate the preamble but not the header */
2989 	uint32	rxstrt;		/**< Number of received frames with a good PLCP
2990 				 * (i.e. passing parity check)
2991 				 */
2992 	uint32	rxdtucastmbss; /**< number of received DATA frames with good FCS and matching RA */
2993 	uint32	rxmgucastmbss; /**< number of received mgmt frames with good FCS and matching RA */
2994 	uint32	rxctlucast; /**< number of received CNTRL frames with good FCS and matching RA */
2995 	uint32	rxrtsucast;	/**< number of unicast RTS addressed to the MAC (good FCS) */
2996 	uint32	rxctsucast;	/**< number of unicast CTS addressed to the MAC (good FCS) */
2997 	uint32	rxackucast;	/**< number of ucast ACKS received (good FCS) */
2998 	uint32	rxdtocast; /**< number of received DATA frames (good FCS and not matching RA) */
2999 	uint32	rxmgocast; /**< number of received MGMT frames (good FCS and not matching RA) */
3000 	uint32	rxctlocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
3001 	uint32	rxrtsocast;	/**< number of received RTS not addressed to the MAC */
3002 	uint32	rxctsocast;	/**< number of received CTS not addressed to the MAC */
3003 	uint32	rxdtmcast;	/**< number of RX Data multicast frames received by the MAC */
3004 	uint32	rxmgmcast;	/**< number of RX Management multicast frames received by the MAC */
3005 	uint32	rxctlmcast;	/**< number of RX Control multicast frames received by the MAC
3006 				 * (unlikely to see these)
3007 				 */
3008 	uint32	rxbeaconmbss;	/**< beacons received from member of BSS */
3009 	uint32	rxdtucastobss; /**< number of unicast frames addressed to the MAC from
3010 				  * other BSS (WDS FRAME)
3011 				  */
3012 	uint32	rxbeaconobss;	/**< beacons received from other BSS */
3013 	uint32	rxrsptmout;	/**< number of response timeouts for transmitted frames
3014 				 * expecting a response
3015 				 */
3016 	uint32	bcntxcancl;	/**< transmit beacons canceled due to receipt of beacon (IBSS) */
3017 	uint32	rxnodelim;	/**< number of no valid delimiter detected by ampdu parser */
3018 	uint32	rxf0ovfl;	/**< number of receive fifo 0 overflows */
3019 	uint32	rxf1ovfl;	/**< number of receive fifo 1 overflows */
3020 	uint32	rxhlovfl;	/**< number of length / header fifo overflows */
3021 	uint32	missbcn_dbg;	/**< number of beacon missed to receive */
3022 	uint32	pmqovfl;	/**< number of PMQ overflows */
3023 	uint32	rxcgprqfrm;	/**< number of received Probe requests that made it into
3024 				 * the PRQ fifo
3025 				 */
3026 	uint32	rxcgprsqovfl;	/**< Rx Probe Request Que overflow in the AP */
3027 	uint32	txcgprsfail;	/**< Tx Probe Response Fail. AP sent probe response but did
3028 				 * not get ACK
3029 				 */
3030 	uint32	txcgprssuc;	/**< Tx Probe Response Success (ACK was received) */
3031 	uint32	prs_timeout;	/**< number of probe requests that were dropped from the PRQ
3032 				 * fifo because a probe response could not be sent out within
3033 				 * the time limit defined in M_PRS_MAXTIME
3034 				 */
3035 	uint32	txrtsfail;	/**< number of rts transmission failure that reach retry limit */
3036 	uint32	txucast;	/**< number of unicast tx expecting response other than cts/cwcts */
3037 	uint32  txinrtstxop;	/**< number of data frame transmissions during rts txop */
3038 	uint32	rxback;		/**< blockack rxcnt */
3039 	uint32	txback;		/**< blockack txcnt */
3040 	uint32	bphy_rxcrsglitch;	/**< PHY count of bphy glitches */
3041 	uint32	rxdrop20s;	/**< drop secondary cnt */
3042 	uint32	rxtoolate;	/**< receive too late */
3043 	uint32  bphy_badplcp;	/**< number of bad PLCP reception on BPHY rate */
3044 } wl_cnt_ge40mcst_v1_t;
3045 
3046 /** MACSTAT counters for ucode (corerev < 40) */
3047 typedef struct {
3048 	/* MAC counters: 32-bit version of d11.h's macstat_t */
3049 	uint32	txallfrm;	/**< total number of frames sent, incl. Data, ACK, RTS, CTS,
3050 				 * Control Management (includes retransmissions)
3051 				 */
3052 	uint32	txrtsfrm;	/**< number of RTS sent out by the MAC */
3053 	uint32	txctsfrm;	/**< number of CTS sent out by the MAC */
3054 	uint32	txackfrm;	/**< number of ACK frames sent out */
3055 	uint32	txdnlfrm;	/**< number of Null-Data transmission generated from template  */
3056 	uint32	txbcnfrm;	/**< beacons transmitted */
3057 	uint32	txfunfl[6];	/**< per-fifo tx underflows */
3058 	uint32	txampdu;	/**< number of AMPDUs transmitted */
3059 	uint32	txmpdu;		/**< number of MPDUs transmitted */
3060 	uint32	txtplunfl;	/**< Template underflows (mac was too slow to transmit ACK/CTS
3061 				 * or BCN)
3062 				 */
3063 	uint32	txphyerror;	/**< Transmit phy error, type of error is reported in tx-status for
3064 				 * driver enqueued frames
3065 				 */
3066 	uint32  pktengrxducast; /**< unicast frames rxed by the pkteng code */
3067 	uint32  pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
3068 	uint32	rxfrmtoolong;	/**< Received frame longer than legal limit (2346 bytes) */
3069 	uint32	rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
3070 	uint32	rxanyerr;	/**< Any RX error that is not counted by other counters. */
3071 	uint32	rxbadfcs;	/**< number of frames for which the CRC check failed in the MAC */
3072 	uint32	rxbadplcp;	/**< parity check of the PLCP header failed */
3073 	uint32	rxcrsglitch;	/**< PHY was able to correlate the preamble but not the header */
3074 	uint32	rxstrt;		/**< Number of received frames with a good PLCP
3075 				 * (i.e. passing parity check)
3076 				 */
3077 	uint32	rxdtucastmbss; /**< number of received DATA frames with good FCS and matching RA */
3078 	uint32	rxmgucastmbss; /**< number of received mgmt frames with good FCS and matching RA */
3079 	uint32	rxctlucast; /**< number of received CNTRL frames with good FCS and matching RA */
3080 	uint32	rxrtsucast;	/**< number of unicast RTS addressed to the MAC (good FCS) */
3081 	uint32	rxctsucast;	/**< number of unicast CTS addressed to the MAC (good FCS) */
3082 	uint32	rxackucast;	/**< number of ucast ACKS received (good FCS) */
3083 	uint32	rxdtocast;  /**< number of received DATA frames (good FCS and not matching RA) */
3084 	uint32	rxmgocast;  /**< number of received MGMT frames (good FCS and not matching RA) */
3085 	uint32	rxctlocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
3086 	uint32	rxrtsocast;	/**< number of received RTS not addressed to the MAC */
3087 	uint32	rxctsocast;	/**< number of received CTS not addressed to the MAC */
3088 	uint32	rxdtmcast;	/**< number of RX Data multicast frames received by the MAC */
3089 	uint32	rxmgmcast;	/**< number of RX Management multicast frames received by the MAC */
3090 	uint32	rxctlmcast;	/**< number of RX Control multicast frames received by the MAC
3091 				 * (unlikely to see these)
3092 				 */
3093 	uint32	rxbeaconmbss;	/**< beacons received from member of BSS */
3094 	uint32	rxdtucastobss; /**< number of unicast frames addressed to the MAC from
3095 				  * other BSS (WDS FRAME)
3096 				  */
3097 	uint32	rxbeaconobss;	/**< beacons received from other BSS */
3098 	uint32	rxrsptmout;	/**< number of response timeouts for transmitted frames
3099 				 * expecting a response
3100 				 */
3101 	uint32	bcntxcancl;	/**< transmit beacons canceled due to receipt of beacon (IBSS) */
3102 	uint32	rxnodelim;	/**< number of no valid delimiter detected by ampdu parser */
3103 	uint32	rxf0ovfl;	/**< number of receive fifo 0 overflows */
3104 	uint32	dbgoff46;
3105 	uint32	dbgoff47;
3106 	uint32	dbgoff48;	/**< Used for counting txstatus queue overflow (corerev <= 4)  */
3107 	uint32	pmqovfl;	/**< number of PMQ overflows */
3108 	uint32	rxcgprqfrm;	/**< number of received Probe requests that made it into
3109 				 * the PRQ fifo
3110 				 */
3111 	uint32	rxcgprsqovfl;	/**< Rx Probe Request Que overflow in the AP */
3112 	uint32	txcgprsfail;	/**< Tx Probe Response Fail. AP sent probe response but did
3113 				 * not get ACK
3114 				 */
3115 	uint32	txcgprssuc;	/**< Tx Probe Response Success (ACK was received) */
3116 	uint32	prs_timeout;	/**< number of probe requests that were dropped from the PRQ
3117 				 * fifo because a probe response could not be sent out within
3118 				 * the time limit defined in M_PRS_MAXTIME
3119 				 */
3120 	uint32	txrtsfail;	/**< number of rts transmission failure that reach retry limit */
3121 	uint32	txucast;	/**< number of unicast tx expecting response other than cts/cwcts */
3122 	uint32  txinrtstxop;	/**< number of data frame transmissions during rts txop */
3123 	uint32	rxback;		/**< blockack rxcnt */
3124 	uint32	txback;		/**< blockack txcnt */
3125 	uint32	bphy_rxcrsglitch;	/**< PHY count of bphy glitches */
3126 	uint32	phywatch;
3127 	uint32	rxtoolate;	/**< receive too late */
3128 	uint32  bphy_badplcp;	/**< number of bad PLCP reception on BPHY rate */
3129 } wl_cnt_lt40mcst_v1_t;
3130 
3131 /** MACSTAT counters for "wl counter" version <= 10 */
3132 typedef struct {
3133 	/* MAC counters: 32-bit version of d11.h's macstat_t */
3134 	uint32	txallfrm;	/**< total number of frames sent, incl. Data, ACK, RTS, CTS,
3135 				 * Control Management (includes retransmissions)
3136 				 */
3137 	uint32	txrtsfrm;	/**< number of RTS sent out by the MAC */
3138 	uint32	txctsfrm;	/**< number of CTS sent out by the MAC */
3139 	uint32	txackfrm;	/**< number of ACK frames sent out */
3140 	uint32	txdnlfrm;	/**< number of Null-Data transmission generated from template  */
3141 	uint32	txbcnfrm;	/**< beacons transmitted */
3142 	uint32	txfunfl[6];	/**< per-fifo tx underflows */
3143 	uint32	txfbw;		/**< transmit at fallback bw (dynamic bw) */
3144 	uint32	PAD0;		/**< number of MPDUs transmitted */
3145 	uint32	txtplunfl;	/**< Template underflows (mac was too slow to transmit ACK/CTS
3146 				 * or BCN)
3147 				 */
3148 	uint32	txphyerror;	/**< Transmit phy error, type of error is reported in tx-status for
3149 				 * driver enqueued frames
3150 				 */
3151 	uint32  pktengrxducast; /**< unicast frames rxed by the pkteng code */
3152 	uint32  pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
3153 	uint32	rxfrmtoolong;	/**< Received frame longer than legal limit (2346 bytes) */
3154 	uint32	rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
3155 	uint32	rxinvmachdr;	/**< Either the protocol version != 0 or frame type not
3156 				 * data/control/management
3157 				 */
3158 	uint32	rxbadfcs;	/**< number of frames for which the CRC check failed in the MAC */
3159 	uint32	rxbadplcp;	/**< parity check of the PLCP header failed */
3160 	uint32	rxcrsglitch;	/**< PHY was able to correlate the preamble but not the header */
3161 	uint32	rxstrt;		/**< Number of received frames with a good PLCP
3162 				 * (i.e. passing parity check)
3163 				 */
3164 	uint32	rxdfrmucastmbss; /* number of received DATA frames with good FCS and matching RA */
3165 	uint32	rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
3166 	uint32	rxcfrmucast; /**< number of received CNTRL frames with good FCS and matching RA */
3167 	uint32	rxrtsucast;  /**< number of unicast RTS addressed to the MAC (good FCS) */
3168 	uint32	rxctsucast;  /**< number of unicast CTS addressed to the MAC (good FCS) */
3169 	uint32	rxackucast;	/**< number of ucast ACKS received (good FCS) */
3170 	uint32	rxdfrmocast; /**< number of received DATA frames (good FCS and not matching RA) */
3171 	uint32	rxmfrmocast; /**< number of received MGMT frames (good FCS and not matching RA) */
3172 	uint32	rxcfrmocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
3173 	uint32	rxrtsocast;	/**< number of received RTS not addressed to the MAC */
3174 	uint32	rxctsocast;	/**< number of received CTS not addressed to the MAC */
3175 	uint32	rxdfrmmcast;	/**< number of RX Data multicast frames received by the MAC */
3176 	uint32	rxmfrmmcast;	/**< number of RX Management multicast frames received by the MAC */
3177 	uint32	rxcfrmmcast;	/**< number of RX Control multicast frames received by the MAC
3178 				 * (unlikely to see these)
3179 				 */
3180 	uint32	rxbeaconmbss;	/**< beacons received from member of BSS */
3181 	uint32	rxdfrmucastobss; /**< number of unicast frames addressed to the MAC from
3182 				  * other BSS (WDS FRAME)
3183 				  */
3184 	uint32	rxbeaconobss;	/**< beacons received from other BSS */
3185 	uint32	rxrsptmout;	/**< number of response timeouts for transmitted frames
3186 				 * expecting a response
3187 				 */
3188 	uint32	bcntxcancl;	/**< transmit beacons canceled due to receipt of beacon (IBSS) */
3189 	uint32	PAD1;
3190 	uint32	rxf0ovfl;	/**< number of receive fifo 0 overflows */
3191 	uint32	rxf1ovfl;	/**< Number of receive fifo 1 overflows (obsolete) */
3192 	uint32	rxf2ovfl;	/**< Number of receive fifo 2 overflows (obsolete) */
3193 	uint32	txsfovfl;	/**< Number of transmit status fifo overflows (obsolete) */
3194 	uint32	pmqovfl;	/**< number of PMQ overflows */
3195 	uint32	rxcgprqfrm;	/**< number of received Probe requests that made it into
3196 				 * the PRQ fifo
3197 				 */
3198 	uint32	rxcgprsqovfl;	/**< Rx Probe Request Que overflow in the AP */
3199 	uint32	txcgprsfail;	/**< Tx Probe Response Fail. AP sent probe response but did
3200 				 * not get ACK
3201 				 */
3202 	uint32	txcgprssuc;	/**< Tx Probe Response Success (ACK was received) */
3203 	uint32	prs_timeout;	/**< number of probe requests that were dropped from the PRQ
3204 				 * fifo because a probe response could not be sent out within
3205 				 * the time limit defined in M_PRS_MAXTIME
3206 				 */
3207 	uint32	rxnack;		/**< obsolete */
3208 	uint32	frmscons;	/**< obsolete */
3209 	uint32  txnack;		/**< obsolete */
3210 	uint32	rxback;		/**< blockack rxcnt */
3211 	uint32	txback;		/**< blockack txcnt */
3212 	uint32	bphy_rxcrsglitch;	/**< PHY count of bphy glitches */
3213 	uint32	rxdrop20s;	/**< drop secondary cnt */
3214 	uint32	rxtoolate;	/**< receive too late */
3215 	uint32  bphy_badplcp;	/**< number of bad PLCP reception on BPHY rate */
3216 } wl_cnt_v_le10_mcst_t;
3217 
3218 #define MAX_RX_FIFO 3
3219 #define WL_RXFIFO_CNT_VERSION  1   /* current version of wl_rxfifo_cnt_t */
3220 typedef struct {
3221 	/* Counters for frames received from rx fifos */
3222 	uint16	version;
3223 	uint16	length;		/* length of entire structure */
3224 	uint32	rxf_data[MAX_RX_FIFO];		/* data frames from rx fifo */
3225 	uint32	rxf_mgmtctl[MAX_RX_FIFO];	/* mgmt/ctl frames from rx fifo */
3226 } wl_rxfifo_cnt_t;
3227 
3228 typedef struct {
3229 	uint16	version;	/**< see definition of WL_CNT_T_VERSION */
3230 	uint16	length;		/**< length of entire structure */
3231 
3232 	/* transmit stat counters */
3233 	uint32	txframe;	/**< tx data frames */
3234 	uint32	txbyte;		/**< tx data bytes */
3235 	uint32	txretrans;	/**< tx mac retransmits */
3236 	uint32	txerror;	/**< tx data errors (derived: sum of others) */
3237 	uint32	txctl;		/**< tx management frames */
3238 	uint32	txprshort;	/**< tx short preamble frames */
3239 	uint32	txserr;		/**< tx status errors */
3240 	uint32	txnobuf;	/**< tx out of buffers errors */
3241 	uint32	txnoassoc;	/**< tx discard because we're not associated */
3242 	uint32	txrunt;		/**< tx runt frames */
3243 	uint32	txchit;		/**< tx header cache hit (fastpath) */
3244 	uint32	txcmiss;	/**< tx header cache miss (slowpath) */
3245 
3246 	/* transmit chip error counters */
3247 	uint32	txuflo;		/**< tx fifo underflows */
3248 	uint32	txphyerr;	/**< tx phy errors (indicated in tx status) */
3249 	uint32	txphycrs;
3250 
3251 	/* receive stat counters */
3252 	uint32	rxframe;	/**< rx data frames */
3253 	uint32	rxbyte;		/**< rx data bytes */
3254 	uint32	rxerror;	/**< rx data errors (derived: sum of others) */
3255 	uint32	rxctl;		/**< rx management frames */
3256 	uint32	rxnobuf;	/**< rx out of buffers errors */
3257 	uint32	rxnondata;	/**< rx non data frames in the data channel errors */
3258 	uint32	rxbadds;	/**< rx bad DS errors */
3259 	uint32	rxbadcm;	/**< rx bad control or management frames */
3260 	uint32	rxfragerr;	/**< rx fragmentation errors */
3261 	uint32	rxrunt;		/**< rx runt frames */
3262 	uint32	rxgiant;	/**< rx giant frames */
3263 	uint32	rxnoscb;	/**< rx no scb error */
3264 	uint32	rxbadproto;	/**< rx invalid frames */
3265 	uint32	rxbadsrcmac;	/**< rx frames with Invalid Src Mac */
3266 	uint32	rxbadda;	/**< rx frames tossed for invalid da */
3267 	uint32	rxfilter;	/**< rx frames filtered out */
3268 
3269 	/* receive chip error counters */
3270 	uint32	rxoflo;		/**< rx fifo overflow errors */
3271 	uint32	rxuflo[NFIFO];	/**< rx dma descriptor underflow errors */
3272 
3273 	uint32	d11cnt_txrts_off;	/**< d11cnt txrts value when reset d11cnt */
3274 	uint32	d11cnt_rxcrc_off;	/**< d11cnt rxcrc value when reset d11cnt */
3275 	uint32	d11cnt_txnocts_off;	/**< d11cnt txnocts value when reset d11cnt */
3276 
3277 	/* misc counters */
3278 	uint32	dmade;		/**< tx/rx dma descriptor errors */
3279 	uint32	dmada;		/**< tx/rx dma data errors */
3280 	uint32	dmape;		/**< tx/rx dma descriptor protocol errors */
3281 	uint32	reset;		/**< reset count */
3282 	uint32	tbtt;		/**< cnts the TBTT int's */
3283 	uint32	txdmawar;
3284 	uint32	pkt_callback_reg_fail;	/**< callbacks register failure */
3285 
3286 	/* MAC counters: 32-bit version of d11.h's macstat_t */
3287 	uint32	txallfrm;	/**< total number of frames sent, incl. Data, ACK, RTS, CTS,
3288 				 * Control Management (includes retransmissions)
3289 				 */
3290 	uint32	txrtsfrm;	/**< number of RTS sent out by the MAC */
3291 	uint32	txctsfrm;	/**< number of CTS sent out by the MAC */
3292 	uint32	txackfrm;	/**< number of ACK frames sent out */
3293 	uint32	txdnlfrm;	/**< Not used */
3294 	uint32	txbcnfrm;	/**< beacons transmitted */
3295 	uint32	txfunfl[6];	/**< per-fifo tx underflows */
3296 	uint32	rxtoolate;	/**< receive too late */
3297 	uint32  txfbw;		/**< transmit at fallback bw (dynamic bw) */
3298 	uint32	txtplunfl;	/**< Template underflows (mac was too slow to transmit ACK/CTS
3299 				 * or BCN)
3300 				 */
3301 	uint32	txphyerror;	/**< Transmit phy error, type of error is reported in tx-status for
3302 				 * driver enqueued frames
3303 				 */
3304 	uint32	rxfrmtoolong;	/**< Received frame longer than legal limit (2346 bytes) */
3305 	uint32	rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
3306 	uint32	rxinvmachdr;	/**< Either the protocol version != 0 or frame type not
3307 				 * data/control/management
3308 				 */
3309 	uint32	rxbadfcs;	/**< number of frames for which the CRC check failed in the MAC */
3310 	uint32	rxbadplcp;	/**< parity check of the PLCP header failed */
3311 	uint32	rxcrsglitch;	/**< PHY was able to correlate the preamble but not the header */
3312 	uint32	rxstrt;		/**< Number of received frames with a good PLCP
3313 				 * (i.e. passing parity check)
3314 				 */
3315 	uint32	rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */
3316 	uint32	rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
3317 	uint32	rxcfrmucast; /**< number of received CNTRL frames with good FCS and matching RA */
3318 	uint32	rxrtsucast;	/**< number of unicast RTS addressed to the MAC (good FCS) */
3319 	uint32	rxctsucast;	/**< number of unicast CTS addressed to the MAC (good FCS) */
3320 	uint32	rxackucast;	/**< number of ucast ACKS received (good FCS) */
3321 	uint32	rxdfrmocast; /**< number of received DATA frames (good FCS and not matching RA) */
3322 	uint32	rxmfrmocast; /**< number of received MGMT frames (good FCS and not matching RA) */
3323 	uint32	rxcfrmocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
3324 	uint32	rxrtsocast;	/**< number of received RTS not addressed to the MAC */
3325 	uint32	rxctsocast;	/**< number of received CTS not addressed to the MAC */
3326 	uint32	rxdfrmmcast;	/**< number of RX Data multicast frames received by the MAC */
3327 	uint32	rxmfrmmcast;	/**< number of RX Management multicast frames received by the MAC */
3328 	uint32	rxcfrmmcast;	/**< number of RX Control multicast frames received by the MAC
3329 				 * (unlikely to see these)
3330 				 */
3331 	uint32	rxbeaconmbss;	/**< beacons received from member of BSS */
3332 	uint32	rxdfrmucastobss; /**< number of unicast frames addressed to the MAC from
3333 				  * other BSS (WDS FRAME)
3334 				  */
3335 	uint32	rxbeaconobss;	/**< beacons received from other BSS */
3336 	uint32	rxrsptmout;	/**< Number of response timeouts for transmitted frames
3337 				 * expecting a response
3338 				 */
3339 	uint32	bcntxcancl;	/**< transmit beacons canceled due to receipt of beacon (IBSS) */
3340 	uint32	rxf0ovfl;	/**< Number of receive fifo 0 overflows */
3341 	uint32	rxf1ovfl;	/**< Number of receive fifo 1 overflows (obsolete) */
3342 	uint32	rxf2ovfl;	/**< Number of receive fifo 2 overflows (obsolete) */
3343 	uint32	txsfovfl;	/**< Number of transmit status fifo overflows (obsolete) */
3344 	uint32	pmqovfl;	/**< Number of PMQ overflows */
3345 	uint32	rxcgprqfrm;	/**< Number of received Probe requests that made it into
3346 				 * the PRQ fifo
3347 				 */
3348 	uint32	rxcgprsqovfl;	/**< Rx Probe Request Que overflow in the AP */
3349 	uint32	txcgprsfail;	/**< Tx Probe Response Fail. AP sent probe response but did
3350 				 * not get ACK
3351 				 */
3352 	uint32	txcgprssuc;	/**< Tx Probe Response Success (ACK was received) */
3353 	uint32	prs_timeout;	/**< Number of probe requests that were dropped from the PRQ
3354 				 * fifo because a probe response could not be sent out within
3355 				 * the time limit defined in M_PRS_MAXTIME
3356 				 */
3357 	uint32	rxnack;		/**< obsolete */
3358 	uint32	frmscons;	/**< obsolete */
3359 	uint32  txnack;		/**< obsolete */
3360 	uint32	rxback;		/**< blockack rxcnt */
3361 	uint32	txback;		/**< blockack txcnt */
3362 
3363 	/* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
3364 	uint32	txfrag;		/**< dot11TransmittedFragmentCount */
3365 	uint32	txmulti;	/**< dot11MulticastTransmittedFrameCount */
3366 	uint32	txfail;		/**< dot11FailedCount */
3367 	uint32	txretry;	/**< dot11RetryCount */
3368 	uint32	txretrie;	/**< dot11MultipleRetryCount */
3369 	uint32	rxdup;		/**< dot11FrameduplicateCount */
3370 	uint32	txrts;		/**< dot11RTSSuccessCount */
3371 	uint32	txnocts;	/**< dot11RTSFailureCount */
3372 	uint32	txnoack;	/**< dot11ACKFailureCount */
3373 	uint32	rxfrag;		/**< dot11ReceivedFragmentCount */
3374 	uint32	rxmulti;	/**< dot11MulticastReceivedFrameCount */
3375 	uint32	rxcrc;		/**< dot11FCSErrorCount */
3376 	uint32	txfrmsnt;	/**< dot11TransmittedFrameCount (bogus MIB?) */
3377 	uint32	rxundec;	/**< dot11WEPUndecryptableCount */
3378 
3379 	/* WPA2 counters (see rxundec for DecryptFailureCount) */
3380 	uint32	tkipmicfaill;	/**< TKIPLocalMICFailures */
3381 	uint32	tkipcntrmsr;	/**< TKIPCounterMeasuresInvoked */
3382 	uint32	tkipreplay;	/**< TKIPReplays */
3383 	uint32	ccmpfmterr;	/**< CCMPFormatErrors */
3384 	uint32	ccmpreplay;	/**< CCMPReplays */
3385 	uint32	ccmpundec;	/**< CCMPDecryptErrors */
3386 	uint32	fourwayfail;	/**< FourWayHandshakeFailures */
3387 	uint32	wepundec;	/**< dot11WEPUndecryptableCount */
3388 	uint32	wepicverr;	/**< dot11WEPICVErrorCount */
3389 	uint32	decsuccess;	/**< DecryptSuccessCount */
3390 	uint32	tkipicverr;	/**< TKIPICVErrorCount */
3391 	uint32	wepexcluded;	/**< dot11WEPExcludedCount */
3392 
3393 	uint32	txchanrej;	/**< Tx frames suppressed due to channel rejection */
3394 	uint32	psmwds;		/**< Count PSM watchdogs */
3395 	uint32	phywatchdog;	/**< Count Phy watchdogs (triggered by ucode) */
3396 
3397 	/* MBSS counters, AP only */
3398 	uint32	prq_entries_handled;	/**< PRQ entries read in */
3399 	uint32	prq_undirected_entries;	/**<    which were bcast bss & ssid */
3400 	uint32	prq_bad_entries;	/**<    which could not be translated to info */
3401 	uint32	atim_suppress_count;	/**< TX suppressions on ATIM fifo */
3402 	uint32	bcn_template_not_ready;	/**< Template marked in use on send bcn ... */
3403 	uint32	bcn_template_not_ready_done; /**< ...but "DMA done" interrupt rcvd */
3404 	uint32	late_tbtt_dpc;	/**< TBTT DPC did not happen in time */
3405 
3406 	/* per-rate receive stat counters */
3407 	uint32  rx1mbps;	/**< packets rx at 1Mbps */
3408 	uint32  rx2mbps;	/**< packets rx at 2Mbps */
3409 	uint32  rx5mbps5;	/**< packets rx at 5.5Mbps */
3410 	uint32  rx6mbps;	/**< packets rx at 6Mbps */
3411 	uint32  rx9mbps;	/**< packets rx at 9Mbps */
3412 	uint32  rx11mbps;	/**< packets rx at 11Mbps */
3413 	uint32  rx12mbps;	/**< packets rx at 12Mbps */
3414 	uint32  rx18mbps;	/**< packets rx at 18Mbps */
3415 	uint32  rx24mbps;	/**< packets rx at 24Mbps */
3416 	uint32  rx36mbps;	/**< packets rx at 36Mbps */
3417 	uint32  rx48mbps;	/**< packets rx at 48Mbps */
3418 	uint32  rx54mbps;	/**< packets rx at 54Mbps */
3419 	uint32  rx108mbps;	/**< packets rx at 108mbps */
3420 	uint32  rx162mbps;	/**< packets rx at 162mbps */
3421 	uint32  rx216mbps;	/**< packets rx at 216 mbps */
3422 	uint32  rx270mbps;	/**< packets rx at 270 mbps */
3423 	uint32  rx324mbps;	/**< packets rx at 324 mbps */
3424 	uint32  rx378mbps;	/**< packets rx at 378 mbps */
3425 	uint32  rx432mbps;	/**< packets rx at 432 mbps */
3426 	uint32  rx486mbps;	/**< packets rx at 486 mbps */
3427 	uint32  rx540mbps;	/**< packets rx at 540 mbps */
3428 
3429 	/* pkteng rx frame stats */
3430 	uint32	pktengrxducast; /**< unicast frames rxed by the pkteng code */
3431 	uint32	pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
3432 
3433 	uint32	rfdisable;	/**< count of radio disables */
3434 	uint32	bphy_rxcrsglitch;	/**< PHY count of bphy glitches */
3435 	uint32  bphy_badplcp;
3436 
3437 	uint32	txexptime;	/**< Tx frames suppressed due to timer expiration */
3438 
3439 	uint32	txmpdu_sgi;	/**< count for sgi transmit */
3440 	uint32	rxmpdu_sgi;	/**< count for sgi received */
3441 	uint32	txmpdu_stbc;	/**< count for stbc transmit */
3442 	uint32	rxmpdu_stbc;	/**< count for stbc received */
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	dma_hang;	/**< count for dma hang */
3461 	uint32	reinit;		/**< count for reinit */
3462 
3463 	uint32  pstatxucast;	/**< count of ucast frames xmitted on all psta assoc */
3464 	uint32  pstatxnoassoc;	/**< count of txnoassoc frames xmitted on all psta assoc */
3465 	uint32  pstarxucast;	/**< count of ucast frames received on all psta assoc */
3466 	uint32  pstarxbcmc;	/**< count of bcmc frames received on all psta */
3467 	uint32  pstatxbcmc;	/**< count of bcmc frames transmitted on all psta */
3468 
3469 	uint32  cso_passthrough; /**< hw cso required but passthrough */
3470 	uint32	cso_normal;	/**< hw cso hdr for normal process */
3471 	uint32	chained;	/**< number of frames chained */
3472 	uint32	chainedsz1;	/**< number of chain size 1 frames */
3473 	uint32	unchained;	/**< number of frames not chained */
3474 	uint32	maxchainsz;	/**< max chain size so far */
3475 	uint32	currchainsz;	/**< current chain size */
3476 	uint32	rxdrop20s;	/**< drop secondary cnt */
3477 	uint32	pciereset;	/**< Secondary Bus Reset issued by driver */
3478 	uint32	cfgrestore;	/**< configspace restore by driver */
3479 	uint32	reinitreason[NREINITREASONCOUNT]; /**< reinitreason counters; 0: Unknown reason */
3480 	uint32  rxrtry;		/**< num of received packets with retry bit on */
3481 	uint32	txmpdu;		/**< macstat cnt only valid in ver 11. number of MPDUs txed.  */
3482 	uint32	rxnodelim;	/**< macstat cnt only valid in ver 11.
3483 				 * number of occasions that no valid delimiter is detected
3484 				 * by ampdu parser.
3485 				 */
3486 	uint32  rxmpdu_mu;      /**< Number of MU MPDUs received */
3487 
3488 	/* detailed control/management frames */
3489 	uint32	txbar;		/**< Number of TX BAR */
3490 	uint32	rxbar;		/**< Number of RX BAR */
3491 	uint32	txpspoll;	/**< Number of TX PS-poll */
3492 	uint32	rxpspoll;	/**< Number of RX PS-poll */
3493 	uint32	txnull;		/**< Number of TX NULL_DATA */
3494 	uint32	rxnull;		/**< Number of RX NULL_DATA */
3495 	uint32	txqosnull;	/**< Number of TX NULL_QoSDATA */
3496 	uint32	rxqosnull;	/**< Number of RX NULL_QoSDATA */
3497 	uint32	txassocreq;	/**< Number of TX ASSOC request */
3498 	uint32	rxassocreq;	/**< Number of RX ASSOC request */
3499 	uint32	txreassocreq;	/**< Number of TX REASSOC request */
3500 	uint32	rxreassocreq;	/**< Number of RX REASSOC request */
3501 	uint32	txdisassoc;	/**< Number of TX DISASSOC */
3502 	uint32	rxdisassoc;	/**< Number of RX DISASSOC */
3503 	uint32	txassocrsp;	/**< Number of TX ASSOC response */
3504 	uint32	rxassocrsp;	/**< Number of RX ASSOC response */
3505 	uint32	txreassocrsp;	/**< Number of TX REASSOC response */
3506 	uint32	rxreassocrsp;	/**< Number of RX REASSOC response */
3507 	uint32	txauth;		/**< Number of TX AUTH */
3508 	uint32	rxauth;		/**< Number of RX AUTH */
3509 	uint32	txdeauth;	/**< Number of TX DEAUTH */
3510 	uint32	rxdeauth;	/**< Number of RX DEAUTH */
3511 	uint32	txprobereq;	/**< Number of TX probe request */
3512 	uint32	rxprobereq;	/**< Number of RX probe request */
3513 	uint32	txprobersp;	/**< Number of TX probe response */
3514 	uint32	rxprobersp;	/**< Number of RX probe response */
3515 	uint32	txaction;	/**< Number of TX action frame */
3516 	uint32	rxaction;	/**< Number of RX action frame */
3517 	uint32  ampdu_wds;      /**< Number of AMPDU watchdogs */
3518 	uint32  txlost;         /**< Number of lost packets reported in txs */
3519 	uint32  txdatamcast;	/**< Number of TX multicast data packets */
3520 	uint32  txdatabcast;	/**< Number of TX broadcast data packets */
3521 	uint32  txbcast;        /* Broadcast TransmittedFrameCount */
3522 	uint32  txdropped;      /* tx dropped pkts */
3523 	uint32  rxbcast;        /* BroadcastReceivedFrameCount */
3524 	uint32  rxdropped;      /* rx dropped pkts (derived: sum of others) */
3525 
3526 } wl_cnt_ver_11_t;
3527 
3528 typedef struct {
3529 	uint16  version;    /**< see definition of WL_CNT_T_VERSION */
3530 	uint16  length;     /**< length of entire structure */
3531 
3532 	/* transmit stat counters */
3533 	uint32  txframe;    /**< tx data frames */
3534 	uint32  txbyte;     /**< tx data bytes */
3535 	uint32  txretrans;  /**< tx mac retransmits */
3536 	uint32  txerror;    /**< tx data errors (derived: sum of others) */
3537 	uint32  txctl;      /**< tx management frames */
3538 	uint32  txprshort;  /**< tx short preamble frames */
3539 	uint32  txserr;     /**< tx status errors */
3540 	uint32  txnobuf;    /**< tx out of buffers errors */
3541 	uint32  txnoassoc;  /**< tx discard because we're not associated */
3542 	uint32  txrunt;     /**< tx runt frames */
3543 	uint32  txchit;     /**< tx header cache hit (fastpath) */
3544 	uint32  txcmiss;    /**< tx header cache miss (slowpath) */
3545 
3546 	/* transmit chip error counters */
3547 	uint32  txuflo;     /**< tx fifo underflows */
3548 	uint32  txphyerr;   /**< tx phy errors (indicated in tx status) */
3549 	uint32  txphycrs;
3550 
3551 	/* receive stat counters */
3552 	uint32  rxframe;    /**< rx data frames */
3553 	uint32  rxbyte;     /**< rx data bytes */
3554 	uint32  rxerror;    /**< rx data errors (derived: sum of others) */
3555 	uint32  rxctl;      /**< rx management frames */
3556 	uint32  rxnobuf;    /**< rx out of buffers errors */
3557 	uint32  rxnondata;  /**< rx non data frames in the data channel errors */
3558 	uint32  rxbadds;    /**< rx bad DS errors */
3559 	uint32  rxbadcm;    /**< rx bad control or management frames */
3560 	uint32  rxfragerr;  /**< rx fragmentation errors */
3561 	uint32  rxrunt;     /**< rx runt frames */
3562 	uint32  rxgiant;    /**< rx giant frames */
3563 	uint32  rxnoscb;    /**< rx no scb error */
3564 	uint32  rxbadproto; /**< rx invalid frames */
3565 	uint32  rxbadsrcmac;    /**< rx frames with Invalid Src Mac */
3566 	uint32  rxbadda;    /**< rx frames tossed for invalid da */
3567 	uint32  rxfilter;   /**< rx frames filtered out */
3568 
3569 	/* receive chip error counters */
3570 	uint32  rxoflo;     /**< rx fifo overflow errors */
3571 	uint32  rxuflo[NFIFO];  /**< rx dma descriptor underflow errors */
3572 
3573 	uint32  d11cnt_txrts_off;   /**< d11cnt txrts value when reset d11cnt */
3574 	uint32  d11cnt_rxcrc_off;   /**< d11cnt rxcrc value when reset d11cnt */
3575 	uint32  d11cnt_txnocts_off; /**< d11cnt txnocts value when reset d11cnt */
3576 
3577 	/* misc counters */
3578 	uint32  dmade;      /**< tx/rx dma descriptor errors */
3579 	uint32  dmada;      /**< tx/rx dma data errors */
3580 	uint32  dmape;      /**< tx/rx dma descriptor protocol errors */
3581 	uint32  reset;      /**< reset count */
3582 	uint32  tbtt;       /**< cnts the TBTT int's */
3583 	uint32  txdmawar;
3584 	uint32  pkt_callback_reg_fail;  /**< callbacks register failure */
3585 
3586 	/* MAC counters: 32-bit version of d11.h's macstat_t */
3587 	uint32  txallfrm;   /**< total number of frames sent, incl. Data, ACK, RTS, CTS,
3588 			     * Control Management (includes retransmissions)
3589 			     */
3590 	uint32  txrtsfrm;   /**< number of RTS sent out by the MAC */
3591 	uint32  txctsfrm;   /**< number of CTS sent out by the MAC */
3592 	uint32  txackfrm;   /**< number of ACK frames sent out */
3593 	uint32  txdnlfrm;   /**< Not used */
3594 	uint32  txbcnfrm;   /**< beacons transmitted */
3595 	uint32  txfunfl[6]; /**< per-fifo tx underflows */
3596 	uint32	rxtoolate;	/**< receive too late */
3597 	uint32  txfbw;	    /**< transmit at fallback bw (dynamic bw) */
3598 	uint32  txtplunfl;  /**< Template underflows (mac was too slow to transmit ACK/CTS
3599 			     * or BCN)
3600 			     */
3601 	uint32  txphyerror; /**< Transmit phy error, type of error is reported in tx-status for
3602 			     * driver enqueued frames
3603 			     */
3604 	uint32  rxfrmtoolong;   /**< Received frame longer than legal limit (2346 bytes) */
3605 	uint32  rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
3606 	uint32  rxinvmachdr;    /**< Either the protocol version != 0 or frame type not
3607 				 * data/control/management
3608 			   */
3609 	uint32  rxbadfcs;   /**< number of frames for which the CRC check failed in the MAC */
3610 	uint32  rxbadplcp;  /**< parity check of the PLCP header failed */
3611 	uint32  rxcrsglitch;    /**< PHY was able to correlate the preamble but not the header */
3612 	uint32  rxstrt;     /**< Number of received frames with a good PLCP
3613 			     * (i.e. passing parity check)
3614 			     */
3615 	uint32  rxdfrmucastmbss; /**< # of received DATA frames with good FCS and matching RA */
3616 	uint32  rxmfrmucastmbss; /**< # of received mgmt frames with good FCS and matching RA */
3617 	uint32  rxcfrmucast;     /**< # of received CNTRL frames with good FCS and matching RA */
3618 	uint32  rxrtsucast; /**< number of unicast RTS addressed to the MAC (good FCS) */
3619 	uint32  rxctsucast; /**< number of unicast CTS addressed to the MAC (good FCS) */
3620 	uint32  rxackucast; /**< number of ucast ACKS received (good FCS) */
3621 	uint32  rxdfrmocast;    /**< # of received DATA frames (good FCS and not matching RA) */
3622 	uint32  rxmfrmocast;    /**< # of received MGMT frames (good FCS and not matching RA) */
3623 	uint32  rxcfrmocast;    /**< # of received CNTRL frame (good FCS and not matching RA) */
3624 	uint32  rxrtsocast; /**< number of received RTS not addressed to the MAC */
3625 	uint32  rxctsocast; /**< number of received CTS not addressed to the MAC */
3626 	uint32  rxdfrmmcast;    /**< number of RX Data multicast frames received by the MAC */
3627 	uint32  rxmfrmmcast;    /**< number of RX Management multicast frames received by the MAC */
3628 	uint32  rxcfrmmcast;    /**< number of RX Control multicast frames received by the MAC
3629 				 * (unlikely to see these)
3630 				 */
3631 	uint32  rxbeaconmbss;   /**< beacons received from member of BSS */
3632 	uint32  rxdfrmucastobss; /**< number of unicast frames addressed to the MAC from
3633 				  * other BSS (WDS FRAME)
3634 				  */
3635 	uint32  rxbeaconobss;   /**< beacons received from other BSS */
3636 	uint32  rxrsptmout; /**< Number of response timeouts for transmitted frames
3637 			     * expecting a response
3638 			     */
3639 	uint32  bcntxcancl; /**< transmit beacons canceled due to receipt of beacon (IBSS) */
3640 	uint32  rxf0ovfl;   /**< Number of receive fifo 0 overflows */
3641 	uint32  rxf1ovfl;   /**< Number of receive fifo 1 overflows (obsolete) */
3642 	uint32  rxf2ovfl;   /**< Number of receive fifo 2 overflows (obsolete) */
3643 	uint32  txsfovfl;   /**< Number of transmit status fifo overflows (obsolete) */
3644 	uint32  pmqovfl;    /**< Number of PMQ overflows */
3645 	uint32  rxcgprqfrm; /**< Number of received Probe requests that made it into
3646 			     * the PRQ fifo
3647 			     */
3648 	uint32  rxcgprsqovfl;   /**< Rx Probe Request Que overflow in the AP */
3649 	uint32  txcgprsfail;    /**< Tx Probe Response Fail. AP sent probe response but did
3650 				 * not get ACK
3651 				 */
3652 	uint32  txcgprssuc; /**< Tx Probe Response Success (ACK was received) */
3653 	uint32  prs_timeout;    /**< Number of probe requests that were dropped from the PRQ
3654 				 * fifo because a probe response could not be sent out within
3655 				 * the time limit defined in M_PRS_MAXTIME
3656 				 */
3657 	uint32  rxnack;
3658 	uint32  frmscons;
3659 	uint32  txnack;		/**< obsolete */
3660 	uint32	rxback;		/**< blockack rxcnt */
3661 	uint32	txback;		/**< blockack txcnt */
3662 
3663 	/* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
3664 	uint32  txfrag;     /**< dot11TransmittedFragmentCount */
3665 	uint32  txmulti;    /**< dot11MulticastTransmittedFrameCount */
3666 	uint32  txfail;     /**< dot11FailedCount */
3667 	uint32  txretry;    /**< dot11RetryCount */
3668 	uint32  txretrie;   /**< dot11MultipleRetryCount */
3669 	uint32  rxdup;      /**< dot11FrameduplicateCount */
3670 	uint32  txrts;      /**< dot11RTSSuccessCount */
3671 	uint32  txnocts;    /**< dot11RTSFailureCount */
3672 	uint32  txnoack;    /**< dot11ACKFailureCount */
3673 	uint32  rxfrag;     /**< dot11ReceivedFragmentCount */
3674 	uint32  rxmulti;    /**< dot11MulticastReceivedFrameCount */
3675 	uint32  rxcrc;      /**< dot11FCSErrorCount */
3676 	uint32  txfrmsnt;   /**< dot11TransmittedFrameCount (bogus MIB?) */
3677 	uint32  rxundec;    /**< dot11WEPUndecryptableCount */
3678 
3679 	/* WPA2 counters (see rxundec for DecryptFailureCount) */
3680 	uint32  tkipmicfaill;   /**< TKIPLocalMICFailures */
3681 	uint32  tkipcntrmsr;    /**< TKIPCounterMeasuresInvoked */
3682 	uint32  tkipreplay; /**< TKIPReplays */
3683 	uint32  ccmpfmterr; /**< CCMPFormatErrors */
3684 	uint32  ccmpreplay; /**< CCMPReplays */
3685 	uint32  ccmpundec;  /**< CCMPDecryptErrors */
3686 	uint32  fourwayfail;    /**< FourWayHandshakeFailures */
3687 	uint32  wepundec;   /**< dot11WEPUndecryptableCount */
3688 	uint32  wepicverr;  /**< dot11WEPICVErrorCount */
3689 	uint32  decsuccess; /**< DecryptSuccessCount */
3690 	uint32  tkipicverr; /**< TKIPICVErrorCount */
3691 	uint32  wepexcluded;    /**< dot11WEPExcludedCount */
3692 
3693 	uint32  rxundec_mcst;   /**< dot11WEPUndecryptableCount */
3694 
3695 	/* WPA2 counters (see rxundec for DecryptFailureCount) */
3696 	uint32  tkipmicfaill_mcst;  /**< TKIPLocalMICFailures */
3697 	uint32  tkipcntrmsr_mcst;   /**< TKIPCounterMeasuresInvoked */
3698 	uint32  tkipreplay_mcst;    /**< TKIPReplays */
3699 	uint32  ccmpfmterr_mcst;    /**< CCMPFormatErrors */
3700 	uint32  ccmpreplay_mcst;    /**< CCMPReplays */
3701 	uint32  ccmpundec_mcst; /**< CCMPDecryptErrors */
3702 	uint32  fourwayfail_mcst;   /**< FourWayHandshakeFailures */
3703 	uint32  wepundec_mcst;  /**< dot11WEPUndecryptableCount */
3704 	uint32  wepicverr_mcst; /**< dot11WEPICVErrorCount */
3705 	uint32  decsuccess_mcst;    /**< DecryptSuccessCount */
3706 	uint32  tkipicverr_mcst;    /**< TKIPICVErrorCount */
3707 	uint32  wepexcluded_mcst;   /**< dot11WEPExcludedCount */
3708 
3709 	uint32  txchanrej;  /**< Tx frames suppressed due to channel rejection */
3710 	uint32  txexptime;  /**< Tx frames suppressed due to timer expiration */
3711 	uint32  psmwds;     /**< Count PSM watchdogs */
3712 	uint32  phywatchdog;    /**< Count Phy watchdogs (triggered by ucode) */
3713 
3714 	/* MBSS counters, AP only */
3715 	uint32  prq_entries_handled;    /**< PRQ entries read in */
3716 	uint32  prq_undirected_entries; /**<    which were bcast bss & ssid */
3717 	uint32  prq_bad_entries;    /**<    which could not be translated to info */
3718 	uint32  atim_suppress_count;    /**< TX suppressions on ATIM fifo */
3719 	uint32  bcn_template_not_ready; /**< Template marked in use on send bcn ... */
3720 	uint32  bcn_template_not_ready_done; /**< ...but "DMA done" interrupt rcvd */
3721 	uint32  late_tbtt_dpc;  /**< TBTT DPC did not happen in time */
3722 
3723 	/* per-rate receive stat counters */
3724 	uint32  rx1mbps;    /**< packets rx at 1Mbps */
3725 	uint32  rx2mbps;    /**< packets rx at 2Mbps */
3726 	uint32  rx5mbps5;   /**< packets rx at 5.5Mbps */
3727 	uint32  rx6mbps;    /**< packets rx at 6Mbps */
3728 	uint32  rx9mbps;    /**< packets rx at 9Mbps */
3729 	uint32  rx11mbps;   /**< packets rx at 11Mbps */
3730 	uint32  rx12mbps;   /**< packets rx at 12Mbps */
3731 	uint32  rx18mbps;   /**< packets rx at 18Mbps */
3732 	uint32  rx24mbps;   /**< packets rx at 24Mbps */
3733 	uint32  rx36mbps;   /**< packets rx at 36Mbps */
3734 	uint32  rx48mbps;   /**< packets rx at 48Mbps */
3735 	uint32  rx54mbps;   /**< packets rx at 54Mbps */
3736 	uint32  rx108mbps;  /**< packets rx at 108mbps */
3737 	uint32  rx162mbps;  /**< packets rx at 162mbps */
3738 	uint32  rx216mbps;  /**< packets rx at 216 mbps */
3739 	uint32  rx270mbps;  /**< packets rx at 270 mbps */
3740 	uint32  rx324mbps;  /**< packets rx at 324 mbps */
3741 	uint32  rx378mbps;  /**< packets rx at 378 mbps */
3742 	uint32  rx432mbps;  /**< packets rx at 432 mbps */
3743 	uint32  rx486mbps;  /**< packets rx at 486 mbps */
3744 	uint32  rx540mbps;  /**< packets rx at 540 mbps */
3745 
3746 	/* pkteng rx frame stats */
3747 	uint32  pktengrxducast; /**< unicast frames rxed by the pkteng code */
3748 	uint32  pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
3749 
3750 	uint32  rfdisable;  /**< count of radio disables */
3751 	uint32  bphy_rxcrsglitch;   /**< PHY count of bphy glitches */
3752 	uint32  bphy_badplcp;
3753 
3754 	uint32  txmpdu_sgi; /**< count for sgi transmit */
3755 	uint32  rxmpdu_sgi; /**< count for sgi received */
3756 	uint32  txmpdu_stbc;    /**< count for stbc transmit */
3757 	uint32  rxmpdu_stbc;    /**< count for stbc received */
3758 
3759 	uint32	rxdrop20s;	/**< drop secondary cnt */
3760 } wl_cnt_ver_6_t;
3761 
3762 #define	WL_DELTA_STATS_T_VERSION	2	/**< current version of wl_delta_stats_t struct */
3763 
3764 typedef struct {
3765 	uint16 version;     /**< see definition of WL_DELTA_STATS_T_VERSION */
3766 	uint16 length;      /**< length of entire structure */
3767 
3768 	/* transmit stat counters */
3769 	uint32 txframe;     /**< tx data frames */
3770 	uint32 txbyte;      /**< tx data bytes */
3771 	uint32 txretrans;   /**< tx mac retransmits */
3772 	uint32 txfail;      /**< tx failures */
3773 
3774 	/* receive stat counters */
3775 	uint32 rxframe;     /**< rx data frames */
3776 	uint32 rxbyte;      /**< rx data bytes */
3777 
3778 	/* per-rate receive stat counters */
3779 	uint32  rx1mbps;	/**< packets rx at 1Mbps */
3780 	uint32  rx2mbps;	/**< packets rx at 2Mbps */
3781 	uint32  rx5mbps5;	/**< packets rx at 5.5Mbps */
3782 	uint32  rx6mbps;	/**< packets rx at 6Mbps */
3783 	uint32  rx9mbps;	/**< packets rx at 9Mbps */
3784 	uint32  rx11mbps;	/**< packets rx at 11Mbps */
3785 	uint32  rx12mbps;	/**< packets rx at 12Mbps */
3786 	uint32  rx18mbps;	/**< packets rx at 18Mbps */
3787 	uint32  rx24mbps;	/**< packets rx at 24Mbps */
3788 	uint32  rx36mbps;	/**< packets rx at 36Mbps */
3789 	uint32  rx48mbps;	/**< packets rx at 48Mbps */
3790 	uint32  rx54mbps;	/**< packets rx at 54Mbps */
3791 	uint32  rx108mbps;	/**< packets rx at 108mbps */
3792 	uint32  rx162mbps;	/**< packets rx at 162mbps */
3793 	uint32  rx216mbps;	/**< packets rx at 216 mbps */
3794 	uint32  rx270mbps;	/**< packets rx at 270 mbps */
3795 	uint32  rx324mbps;	/**< packets rx at 324 mbps */
3796 	uint32  rx378mbps;	/**< packets rx at 378 mbps */
3797 	uint32  rx432mbps;	/**< packets rx at 432 mbps */
3798 	uint32  rx486mbps;	/**< packets rx at 486 mbps */
3799 	uint32  rx540mbps;	/**< packets rx at 540 mbps */
3800 
3801 	/* phy stats */
3802 	uint32 rxbadplcp;
3803 	uint32 rxcrsglitch;
3804 	uint32 bphy_rxcrsglitch;
3805 	uint32 bphy_badplcp;
3806 
3807 } wl_delta_stats_t;
3808 
3809 /* Partial statistics counter report */
3810 #define WL_CNT_CTL_MGT_FRAMES	0
3811 
3812 typedef struct {
3813 	uint16	type;
3814 	uint16	len;
3815 
3816 	/* detailed control/management frames */
3817 	uint32	txnull;
3818 	uint32	rxnull;
3819 	uint32	txqosnull;
3820 	uint32	rxqosnull;
3821 	uint32	txassocreq;
3822 	uint32	rxassocreq;
3823 	uint32	txreassocreq;
3824 	uint32	rxreassocreq;
3825 	uint32	txdisassoc;
3826 	uint32	rxdisassoc;
3827 	uint32	txassocrsp;
3828 	uint32	rxassocrsp;
3829 	uint32	txreassocrsp;
3830 	uint32	rxreassocrsp;
3831 	uint32	txauth;
3832 	uint32	rxauth;
3833 	uint32	txdeauth;
3834 	uint32	rxdeauth;
3835 	uint32	txprobereq;
3836 	uint32	rxprobereq;
3837 	uint32	txprobersp;
3838 	uint32	rxprobersp;
3839 	uint32	txaction;
3840 	uint32	rxaction;
3841 	uint32	txrts;
3842 	uint32	rxrts;
3843 	uint32	txcts;
3844 	uint32	rxcts;
3845 	uint32	txack;
3846 	uint32	rxack;
3847 	uint32	txbar;
3848 	uint32	rxbar;
3849 	uint32	txback;
3850 	uint32	rxback;
3851 	uint32	txpspoll;
3852 	uint32	rxpspoll;
3853 } wl_ctl_mgt_cnt_t;
3854 
3855 typedef struct {
3856 	uint32 packets;
3857 	uint32 bytes;
3858 } wl_traffic_stats_t;
3859 
3860 typedef struct {
3861 	uint16	version;	/**< see definition of WL_WME_CNT_VERSION */
3862 	uint16	length;		/**< length of entire structure */
3863 
3864 	wl_traffic_stats_t tx[AC_COUNT];	/**< Packets transmitted */
3865 	wl_traffic_stats_t tx_failed[AC_COUNT];	/**< Packets dropped or failed to transmit */
3866 	wl_traffic_stats_t rx[AC_COUNT];	/**< Packets received */
3867 	wl_traffic_stats_t rx_failed[AC_COUNT];	/**< Packets failed to receive */
3868 
3869 	wl_traffic_stats_t forward[AC_COUNT];	/**< Packets forwarded by AP */
3870 
3871 	wl_traffic_stats_t tx_expired[AC_COUNT]; /**< packets dropped due to lifetime expiry */
3872 
3873 } wl_wme_cnt_t;
3874 
3875 struct wl_msglevel2 {
3876 	uint32 low;
3877 	uint32 high;
3878 };
3879 
3880 #define WL_ICMP_IPV6_CFG_VERSION         1
3881 #define WL_ICMP_IPV6_CLEAR_ALL           (1 << 0)
3882 
3883 typedef struct wl_icmp_ipv6_cfg {
3884 	uint16 version;
3885 	uint16 length;
3886 	uint16 fixed_length;
3887 	uint16 flags;
3888 	uint32 num_ipv6;
3889 	/* num_ipv6 to follow */
3890 	struct ipv6_addr host_ipv6[];
3891 } wl_icmp_ipv6_cfg_t;
3892 
3893 #define WL_ICMP_CFG_IPV6_FIXED_LEN      OFFSETOF(wl_icmp_ipv6_cfg_t, host_ipv6)
3894 #define WL_ICMP_CFG_IPV6_LEN(count)    (WL_ICMP_CFG_IPV6_FIXED_LEN + \
3895 					((count) * sizeof(struct ipv6_addr)))
3896 
3897 typedef struct wl_mkeep_alive_pkt {
3898 	uint16	version; /* Version for mkeep_alive */
3899 	uint16	length; /* length of fixed parameters in the structure */
3900 	uint32	period_msec; /* high bit on means immediate send */
3901 	uint16	len_bytes;
3902 	uint8	keep_alive_id; /* 0 - 3 for N = 4 */
3903 	uint8	data[1];
3904 } wl_mkeep_alive_pkt_t;
3905 
3906 #define WL_MKEEP_ALIVE_VERSION		1
3907 #define WL_MKEEP_ALIVE_FIXED_LEN	OFFSETOF(wl_mkeep_alive_pkt_t, data)
3908 #define WL_MKEEP_ALIVE_PRECISION	500
3909 #define WL_MKEEP_ALIVE_PERIOD_MASK  0x7FFFFFFF
3910 #define WL_MKEEP_ALIVE_IMMEDIATE    0x80000000
3911 
3912 /** TCP Keep-Alive conn struct */
3913 typedef struct wl_mtcpkeep_alive_conn_pkt {
3914 	struct ether_addr saddr;		/**< src mac address */
3915 	struct ether_addr daddr;		/**< dst mac address */
3916 	struct ipv4_addr sipaddr;		/**< source IP addr */
3917 	struct ipv4_addr dipaddr;		/**< dest IP addr */
3918 	uint16 sport;				/**< src port */
3919 	uint16 dport;				/**< dest port */
3920 	uint32 seq;				/**< seq number */
3921 	uint32 ack;				/**< ACK number */
3922 	uint16 tcpwin;				/**< TCP window */
3923 	uint16 PAD;
3924 } wl_mtcpkeep_alive_conn_pkt_t;
3925 
3926 /** TCP Keep-Alive interval struct */
3927 typedef struct wl_mtcpkeep_alive_timers_pkt {
3928 	uint16 interval;		/**< interval timer */
3929 	uint16 retry_interval;		/**< retry_interval timer */
3930 	uint16 retry_count;		/**< retry_count */
3931 } wl_mtcpkeep_alive_timers_pkt_t;
3932 
3933 typedef struct wake_info {
3934 	uint32 wake_reason;
3935 	uint32 wake_info_len;		/**< size of packet */
3936 	uint8  packet[];
3937 } wake_info_t;
3938 
3939 typedef struct wake_pkt {
3940 	uint32 wake_pkt_len;		/**< size of packet */
3941 	uint8  packet[];
3942 } wake_pkt_t;
3943 
3944 
3945 #define WL_MTCPKEEP_ALIVE_VERSION		1
3946 
3947 /* #ifdef WLBA */
3948 
3949 #define WLC_BA_CNT_VERSION  1   /**< current version of wlc_ba_cnt_t */
3950 
3951 /** block ack related stats */
3952 typedef struct wlc_ba_cnt {
3953 	uint16  version;    /**< WLC_BA_CNT_VERSION */
3954 	uint16  length;     /**< length of entire structure */
3955 
3956 	/* transmit stat counters */
3957 	uint32 txpdu;       /**< pdus sent */
3958 	uint32 txsdu;       /**< sdus sent */
3959 	uint32 txfc;        /**< tx side flow controlled packets */
3960 	uint32 txfci;       /**< tx side flow control initiated */
3961 	uint32 txretrans;   /**< retransmitted pdus */
3962 	uint32 txbatimer;   /**< ba resend due to timer */
3963 	uint32 txdrop;      /**< dropped packets */
3964 	uint32 txaddbareq;  /**< addba req sent */
3965 	uint32 txaddbaresp; /**< addba resp sent */
3966 	uint32 txdelba;     /**< delba sent */
3967 	uint32 txba;        /**< ba sent */
3968 	uint32 txbar;       /**< bar sent */
3969 	uint32 txpad[4];    /**< future */
3970 
3971 	/* receive side counters */
3972 	uint32 rxpdu;       /**< pdus recd */
3973 	uint32 rxqed;       /**< pdus buffered before sending up */
3974 	uint32 rxdup;       /**< duplicate pdus */
3975 	uint32 rxnobuf;     /**< pdus discarded due to no buf */
3976 	uint32 rxaddbareq;  /**< addba req recd */
3977 	uint32 rxaddbaresp; /**< addba resp recd */
3978 	uint32 rxdelba;     /**< delba recd */
3979 	uint32 rxba;        /**< ba recd */
3980 	uint32 rxbar;       /**< bar recd */
3981 	uint32 rxinvba;     /**< invalid ba recd */
3982 	uint32 rxbaholes;   /**< ba recd with holes */
3983 	uint32 rxunexp;     /**< unexpected packets */
3984 	uint32 rxpad[4];    /**< future */
3985 } wlc_ba_cnt_t;
3986 /* #endif  WLBA */
3987 
3988 /** structure for per-tid ampdu control */
3989 struct ampdu_tid_control {
3990 	uint8 tid;			/* tid */
3991 	uint8 enable;			/* enable/disable */
3992 };
3993 
3994 /** struct for ampdu tx/rx aggregation control */
3995 struct ampdu_aggr {
3996 	int8 aggr_override;	/**< aggr overrided by dongle. Not to be set by host. */
3997 	uint16 conf_TID_bmap;	/**< bitmap of TIDs to configure */
3998 	uint16 enab_TID_bmap;	/**< enable/disable per TID */
3999 };
4000 
4001 /** structure for identifying ea/tid for sending addba/delba */
4002 struct ampdu_ea_tid {
4003 	struct ether_addr ea;		/**< Station address */
4004 	uint8 tid;			/**< tid */
4005 	uint8 initiator;	/**< 0 is recipient, 1 is originator */
4006 };
4007 
4008 /** structure for identifying retry/tid for retry_limit_tid/rr_retry_limit_tid */
4009 struct ampdu_retry_tid {
4010 	uint8 tid;	/**< tid */
4011 	uint8 retry;	/**< retry value */
4012 };
4013 
4014 #define BDD_FNAME_LEN       32  /**< Max length of friendly name */
4015 typedef struct bdd_fname {
4016 	uint8 len;          /**< length of friendly name */
4017 	uchar name[BDD_FNAME_LEN];  /**< friendly name */
4018 } bdd_fname_t;
4019 
4020 /* structure for addts arguments */
4021 /** For ioctls that take a list of TSPEC */
4022 struct tslist {
4023 	int32 count;			/**< number of tspecs */
4024 	struct tsinfo_arg tsinfo[];	/**< variable length array of tsinfo */
4025 };
4026 
4027 /* WLTDLS */
4028 /**structure for tdls iovars */
4029 typedef struct tdls_iovar {
4030 	struct ether_addr ea;		/**< Station address */
4031 	uint8 mode;			/**< mode: depends on iovar */
4032 	uint8 PAD;
4033 	chanspec_t chanspec;
4034 	uint16 PAD;
4035 	uint32 pad;			/**< future */
4036 } tdls_iovar_t;
4037 
4038 #define TDLS_WFD_IE_SIZE		512
4039 /**structure for tdls wfd ie */
4040 typedef struct tdls_wfd_ie_iovar {
4041 	struct ether_addr ea;		/**< Station address */
4042 	uint8 mode;
4043 	uint8 PAD;
4044 	uint16 length;
4045 	uint8 data[TDLS_WFD_IE_SIZE];
4046 } tdls_wfd_ie_iovar_t;
4047 /* #endif WLTDLS */
4048 
4049 /** structure for addts/delts arguments */
4050 typedef struct tspec_arg {
4051 	uint16 version;			/**< see definition of TSPEC_ARG_VERSION */
4052 	uint16 length;			/**< length of entire structure */
4053 	uint32 flag;			/**< bit field */
4054 	/* TSPEC Arguments */
4055 	struct tsinfo_arg tsinfo;	/**< TS Info bit field */
4056 	uint8  PAD;
4057 	uint16 nom_msdu_size;		/**< (Nominal or fixed) MSDU Size (bytes) */
4058 	uint16 max_msdu_size;		/**< Maximum MSDU Size (bytes) */
4059 	uint32 min_srv_interval;		/**< Minimum Service Interval (us) */
4060 	uint32 max_srv_interval;		/**< Maximum Service Interval (us) */
4061 	uint32 inactivity_interval;	/**< Inactivity Interval (us) */
4062 	uint32 suspension_interval;	/**< Suspension Interval (us) */
4063 	uint32 srv_start_time;		/**< Service Start Time (us) */
4064 	uint32 min_data_rate;		/**< Minimum Data Rate (bps) */
4065 	uint32 mean_data_rate;		/**< Mean Data Rate (bps) */
4066 	uint32 peak_data_rate;		/**< Peak Data Rate (bps) */
4067 	uint32 max_burst_size;		/**< Maximum Burst Size (bytes) */
4068 	uint32 delay_bound;		/**< Delay Bound (us) */
4069 	uint32 min_phy_rate;		/**< Minimum PHY Rate (bps) */
4070 	uint16 surplus_bw;		/**< Surplus Bandwidth Allowance (range 1.0 to 8.0) */
4071 	uint16 medium_time;		/**< Medium Time (32 us/s periods) */
4072 	uint8 dialog_token;		/**< dialog token */
4073 	uint8  PAD[3];
4074 } tspec_arg_t;
4075 
4076 /** tspec arg for desired station */
4077 typedef	struct tspec_per_sta_arg {
4078 	struct ether_addr ea;
4079 	uint8  PAD[2];
4080 	struct tspec_arg ts;
4081 } tspec_per_sta_arg_t;
4082 
4083 /** structure for max bandwidth for each access category */
4084 typedef	struct wme_max_bandwidth {
4085 	uint32	ac[AC_COUNT];	/**< max bandwidth for each access category */
4086 } wme_max_bandwidth_t;
4087 
4088 #define WL_WME_MBW_PARAMS_IO_BYTES (sizeof(wme_max_bandwidth_t))
4089 
4090 /* current version of wl_tspec_arg_t struct */
4091 #define	TSPEC_ARG_VERSION		2	/**< current version of wl_tspec_arg_t struct */
4092 #define TSPEC_ARG_LENGTH		55	/**< argument length from tsinfo to medium_time */
4093 #define TSPEC_DEFAULT_DIALOG_TOKEN	42	/**< default dialog token */
4094 #define TSPEC_DEFAULT_SBW_FACTOR	0x3000	/**< default surplus bw */
4095 
4096 
4097 #define WL_WOWL_KEEPALIVE_MAX_PACKET_SIZE  80
4098 #define WLC_WOWL_MAX_KEEPALIVE	2
4099 
4100 /** Packet lifetime configuration per ac */
4101 typedef struct wl_lifetime {
4102 	uint32 ac;	        /**< access class */
4103 	uint32 lifetime;    /**< Packet lifetime value in ms */
4104 } wl_lifetime_t;
4105 
4106 /** Management time configuration */
4107 typedef struct wl_lifetime_mg {
4108 	uint32 mgmt_bitmap;	/**< Mgmt subtype */
4109 	uint32 lifetime;    /**< Packet lifetime value in us */
4110 } wl_lifetime_mg_t;
4111 
4112 /* MAC Sample Capture related */
4113 #define	WL_MACCAPTR_DEFSTART_PTR	0xA00
4114 #define	WL_MACCAPTR_DEFSTOP_PTR		0xA3F
4115 #define	WL_MACCAPTR_DEFSZ		0x3F
4116 
4117 #define WL_MACCAPTR_DEF_MASK		0xFFFFFFFF
4118 
4119 typedef enum {
4120 	WL_MACCAPT_TRIG		= 0,
4121 	WL_MACCAPT_STORE	= 1,
4122 	WL_MACCAPT_TRANS	= 2,
4123 	WL_MACCAPT_MATCH	= 3
4124 } maccaptr_optn;
4125 
4126 typedef enum {
4127 	WL_MACCAPT_STRT	= 1,
4128 	WL_MACCAPT_STOP	= 2,
4129 	WL_MACCAPT_RST	= 3
4130 } maccaptr_cmd_t;
4131 
4132 /* MAC Sample Capture Set-up Paramters */
4133 typedef struct wl_maccapture_params {
4134 	uint8	gpio_sel;
4135 	uint8	la_mode;	/* TRUE: GPIO Out Enabled */
4136 	uint8 	PAD[2];
4137 	uint32	start_ptr;	/* Start address to store */
4138 	uint32	stop_ptr;	/* Stop address to store */
4139 	uint8	optn_bmp;	/* Options */
4140 	uint8 	PAD[3];
4141 	uint32	tr_mask;	/* Trigger Mask */
4142 	uint32	tr_val;		/* Trigger Value */
4143 	uint32	s_mask;		/* Store Mode Mask */
4144 	uint32	x_mask;		/* Trans. Mode Mask */
4145 	uint32	m_mask;		/* Match Mode Mask */
4146 	uint32	m_val;		/* Match Value */
4147 	maccaptr_cmd_t cmd;	/* Start / Stop */
4148 } wl_maccapture_params_t;
4149 
4150 /** Channel Switch Announcement param */
4151 typedef struct wl_chan_switch {
4152 	uint8 mode;		/**< value 0 or 1 */
4153 	uint8 count;		/**< count # of beacons before switching */
4154 	chanspec_t chspec;	/**< chanspec */
4155 	uint8 reg;		/**< regulatory class */
4156 	uint8 frame_type;		/**< csa frame type, unicast or broadcast */
4157 } wl_chan_switch_t;
4158 
4159 enum {
4160 	PFN_LIST_ORDER,
4161 	PFN_RSSI
4162 };
4163 
4164 enum {
4165 	DISABLE,
4166 	ENABLE
4167 };
4168 
4169 enum {
4170 	OFF_ADAPT,
4171 	SMART_ADAPT,
4172 	STRICT_ADAPT,
4173 	SLOW_ADAPT
4174 };
4175 
4176 #define SORT_CRITERIA_BIT		0
4177 #define AUTO_NET_SWITCH_BIT		1
4178 #define ENABLE_BKGRD_SCAN_BIT		2
4179 #define IMMEDIATE_SCAN_BIT		3
4180 #define	AUTO_CONNECT_BIT		4
4181 #define	ENABLE_BD_SCAN_BIT		5
4182 #define ENABLE_ADAPTSCAN_BIT		6
4183 #define IMMEDIATE_EVENT_BIT		8
4184 #define SUPPRESS_SSID_BIT		9
4185 #define ENABLE_NET_OFFLOAD_BIT		10
4186 /** report found/lost events for SSID and BSSID networks seperately */
4187 #define REPORT_SEPERATELY_BIT		11
4188 
4189 #define SORT_CRITERIA_MASK	0x0001
4190 #define AUTO_NET_SWITCH_MASK	0x0002
4191 #define ENABLE_BKGRD_SCAN_MASK	0x0004
4192 #define IMMEDIATE_SCAN_MASK	0x0008
4193 #define AUTO_CONNECT_MASK	0x0010
4194 
4195 #define ENABLE_BD_SCAN_MASK	0x0020
4196 #define ENABLE_ADAPTSCAN_MASK	0x00c0
4197 #define IMMEDIATE_EVENT_MASK	0x0100
4198 #define SUPPRESS_SSID_MASK	0x0200
4199 #define ENABLE_NET_OFFLOAD_MASK	0x0400
4200 /** report found/lost events for SSID and BSSID networks seperately */
4201 #define REPORT_SEPERATELY_MASK	0x0800
4202 
4203 #define PFN_VERSION			2
4204 
4205 #define PFN_COMPLETE			1
4206 #define PFN_INCOMPLETE			0
4207 
4208 #define DEFAULT_BESTN			2
4209 #define DEFAULT_MSCAN			0
4210 #define DEFAULT_REPEAT			10
4211 #define DEFAULT_EXP			2
4212 
4213 #define PFN_PARTIAL_SCAN_BIT		0
4214 #define PFN_PARTIAL_SCAN_MASK		1
4215 
4216 #define PFN_SWC_RSSI_WINDOW_MAX   8
4217 #define PFN_SWC_MAX_NUM_APS       16
4218 #define PFN_HOTLIST_MAX_NUM_APS   64
4219 
4220 #define MAX_EPNO_HIDDEN_SSID    8
4221 #define MAX_WHITELIST_SSID      2
4222 
4223 /* Version 1 and 2 for various scan results structures defined below */
4224 #define PFN_SCANRESULTS_VERSION_V1	1
4225 #define PFN_SCANRESULTS_VERSION_V2	2
4226 
4227 /** PFN network info structure */
4228 typedef struct wl_pfn_subnet_info_v1 {
4229 	struct ether_addr BSSID;
4230 	uint8	channel; /**< channel number only */
4231 	uint8	SSID_len;
4232 	uint8	SSID[32];
4233 } wl_pfn_subnet_info_v1_t;
4234 
4235 typedef struct wl_pfn_subnet_info_v2 {
4236 	struct ether_addr BSSID;
4237 	uint8   channel; /**< channel number only */
4238 	uint8   SSID_len;
4239 	union {
4240 		uint8   SSID[32];
4241 		uint16 index;
4242 	} u;
4243 } wl_pfn_subnet_info_v2_t;
4244 
4245 typedef struct wl_pfn_net_info_v1 {
4246 	wl_pfn_subnet_info_v1_t pfnsubnet;
4247 	int16	RSSI; /**< receive signal strength (in dBm) */
4248 	uint16	timestamp; /**< age in seconds */
4249 } wl_pfn_net_info_v1_t;
4250 
4251 typedef struct wl_pfn_net_info_v2 {
4252 	wl_pfn_subnet_info_v2_t pfnsubnet;
4253 	int16   RSSI; /**< receive signal strength (in dBm) */
4254 	uint16  timestamp; /**< age in seconds */
4255 } wl_pfn_net_info_v2_t;
4256 
4257 /* Version 1 and 2 for various lbest scan results structures below */
4258 #define PFN_LBEST_SCAN_RESULT_VERSION_V1 1
4259 #define PFN_LBEST_SCAN_RESULT_VERSION_V2 2
4260 
4261 #define MAX_CHBKT_PER_RESULT		4
4262 
4263 typedef struct wl_pfn_lnet_info_v1 {
4264 	wl_pfn_subnet_info_v1_t pfnsubnet; /**< BSSID + channel + SSID len + SSID */
4265 	uint16	flags; /**< partial scan, etc */
4266 	int16	RSSI; /**< receive signal strength (in dBm) */
4267 	uint32	timestamp; /**< age in miliseconds */
4268 	uint16	rtt0; /**< estimated distance to this AP in centimeters */
4269 	uint16	rtt1; /**< standard deviation of the distance to this AP in centimeters */
4270 } wl_pfn_lnet_info_v1_t;
4271 
4272 typedef struct wl_pfn_lnet_info_v2 {
4273 	wl_pfn_subnet_info_v2_t pfnsubnet; /**< BSSID + channel + SSID len + SSID */
4274 	uint16  flags; /**< partial scan, etc */
4275 	int16   RSSI; /**< receive signal strength (in dBm) */
4276 	uint32  timestamp; /**< age in miliseconds */
4277 	uint16  rtt0; /**< estimated distance to this AP in centimeters */
4278 	uint16  rtt1; /**< standard deviation of the distance to this AP in centimeters */
4279 } wl_pfn_lnet_info_v2_t;
4280 
4281 typedef struct wl_pfn_lscanresults_v1 {
4282 	uint32 version;
4283 	uint32 status;
4284 	uint32 count;
4285 	wl_pfn_lnet_info_v1_t netinfo[1];
4286 } wl_pfn_lscanresults_v1_t;
4287 
4288 typedef struct wl_pfn_lscanresults_v2 {
4289 	uint32 version;
4290 	uint16 status;
4291 	uint16 count;
4292 	uint32 scan_ch_buckets[MAX_CHBKT_PER_RESULT];
4293 	wl_pfn_lnet_info_v2_t netinfo[1];
4294 } wl_pfn_lscanresults_v2_t;
4295 
4296 /**this is used to report on 1-* pfn scan results */
4297 typedef struct wl_pfn_scanresults_v1 {
4298 	uint32 version;
4299 	uint32 status;
4300 	uint32 count;
4301 	wl_pfn_net_info_v1_t netinfo[1];
4302 } wl_pfn_scanresults_v1_t;
4303 
4304 typedef struct wl_pfn_scanresults_v2 {
4305 	uint32 version;
4306 	uint32 status;
4307 	uint32 count;
4308 	uint32 scan_ch_bucket;
4309 	wl_pfn_net_info_v2_t netinfo[1];
4310 } wl_pfn_scanresults_v2_t;
4311 
4312 typedef struct wl_pfn_significant_net {
4313 	uint16 flags;
4314 	uint16 channel;
4315 	struct ether_addr BSSID;
4316 	int8 rssi[PFN_SWC_RSSI_WINDOW_MAX];
4317 } wl_pfn_significant_net_t;
4318 
4319 #define PFN_SWC_SCANRESULT_VERSION     1
4320 
4321 typedef struct wl_pfn_swc_results {
4322 	uint32 version;
4323 	uint32 pkt_count;   /**< No. of results in current frame */
4324 	uint32 total_count; /**< Total expected results */
4325 	wl_pfn_significant_net_t list[];
4326 } wl_pfn_swc_results_t;
4327 typedef struct wl_pfn_net_info_bssid {
4328 	struct ether_addr BSSID;
4329 	uint8 channel;	/**< channel number only */
4330 	int8  RSSI;	/**< receive signal strength (in dBm) */
4331 	uint16 flags;	/**< (e.g. partial scan, off channel) */
4332 	uint16 timestamp; /**< age in seconds */
4333 } wl_pfn_net_info_bssid_t;
4334 
4335 typedef struct wl_pfn_scanhist_bssid {
4336 	uint32 version;
4337 	uint32 status;
4338 	uint32 count;
4339 	wl_pfn_net_info_bssid_t netinfo[1];
4340 } wl_pfn_scanhist_bssid_t;
4341 
4342 /* Version 1 and 2 for various single scan result */
4343 #define PFN_SCANRESULT_VERSION_V1	1
4344 #define PFN_SCANRESULT_VERSION_V2	2
4345 
4346 /* used to report exactly one scan result */
4347 /* plus reports detailed scan info in bss_info */
4348 typedef struct wl_pfn_scanresult_v1 {
4349 	uint32 version;
4350 	uint32 status;
4351 	uint32 count;
4352 	wl_pfn_net_info_v1_t netinfo;
4353 	wl_bss_info_t bss_info;
4354 } wl_pfn_scanresult_v1_t;
4355 
4356 typedef struct wl_pfn_scanresult_v2 {
4357 	uint32 version;
4358 	uint32 status;
4359 	uint32 count;
4360 	wl_pfn_net_info_v2_t netinfo;
4361 	wl_bss_info_t bss_info;
4362 } wl_pfn_scanresult_v2_t;
4363 
4364 /**PFN data structure */
4365 typedef struct wl_pfn_param {
4366 	int32 version;			/**< PNO parameters version */
4367 	int32 scan_freq;		/**< Scan frequency */
4368 	int32 lost_network_timeout;	/**< Timeout in sec. to declare
4369 								* discovered network as lost
4370 								*/
4371 	int16 flags;			/**< Bit field to control features
4372 							* of PFN such as sort criteria auto
4373 							* enable switch and background scan
4374 							*/
4375 	int16 rssi_margin;		/**< Margin to avoid jitter for choosing a
4376 							* PFN based on RSSI sort criteria
4377 							*/
4378 	uint8 bestn; /**< number of best networks in each scan */
4379 	uint8 mscan; /**< number of scans recorded */
4380 	uint8 repeat; /**< Minimum number of scan intervals
4381 				     *before scan frequency changes in adaptive scan
4382 				     */
4383 	uint8 exp; /**< Exponent of 2 for maximum scan interval */
4384 	int32 slow_freq; /**< slow scan period */
4385 } wl_pfn_param_t;
4386 
4387 typedef struct wl_pfn_bssid {
4388 	struct ether_addr  macaddr;
4389 	/* Bit4: suppress_lost, Bit3: suppress_found */
4390 	uint16             flags;
4391 } wl_pfn_bssid_t;
4392 typedef struct wl_pfn_significant_bssid {
4393 	struct ether_addr	macaddr;
4394 	int8    rssi_low_threshold;
4395 	int8    rssi_high_threshold;
4396 } wl_pfn_significant_bssid_t;
4397 #define WL_PFN_SUPPRESSFOUND_MASK	0x08
4398 #define WL_PFN_SUPPRESSLOST_MASK	0x10
4399 #define WL_PFN_SSID_IMPRECISE_MATCH	0x80
4400 #define WL_PFN_SSID_SAME_NETWORK	0x10000
4401 #define WL_PFN_SUPPRESS_AGING_MASK	0x20000
4402 #define WL_PFN_FLUSH_ALL_SSIDS		0x40000
4403 
4404 #define WL_PFN_IOVAR_FLAG_MASK		0xFFFF00FF
4405 #define WL_PFN_RSSI_MASK		0xff00
4406 #define WL_PFN_RSSI_SHIFT		8
4407 
4408 typedef struct wl_pfn_cfg {
4409 	uint32	reporttype;
4410 	int32	channel_num;
4411 	uint16	channel_list[WL_NUMCHANNELS];
4412 	uint32	flags;
4413 } wl_pfn_cfg_t;
4414 
4415 #define WL_PFN_SSID_CFG_VERSION		1
4416 #define WL_PFN_SSID_CFG_CLEAR		0x1
4417 
4418 typedef struct wl_pfn_ssid_params {
4419 	int8 min5G_rssi;           /* minimum 5GHz RSSI for a BSSID to be considered      */
4420 	int8 min2G_rssi;           /* minimum 2.4GHz RSSI for a BSSID to be considered   */
4421 	int16 init_score_max;     /* The maximum score that a network can have before bonuses  */
4422 
4423 	int16 cur_bssid_bonus;    /* Add to current bssid                                      */
4424 	int16 same_ssid_bonus;    /* score bonus for all networks with the same network flag   */
4425 	int16 secure_bonus;       /* score bonus for networks that are not open          */
4426 	int16 band_5g_bonus;
4427 } wl_pfn_ssid_params_t;
4428 
4429 typedef struct wl_ssid_ext_params {
4430 	int8 min5G_rssi;	/* minimum 5GHz RSSI for a BSSID to be considered      */
4431 	int8 min2G_rssi;	/* minimum 2.4GHz RSSI for a BSSID to be considered   */
4432 	int16 init_score_max;	/* The maximum score that a network can have before bonuses  */
4433 	int16 cur_bssid_bonus;	/* Add to current bssid                                      */
4434 	int16 same_ssid_bonus;	/* score bonus for all networks with the same network flag   */
4435 	int16 secure_bonus;	/* score bonus for networks that are not open                */
4436 	int16 band_5g_bonus;
4437 } wl_ssid_ext_params_t;
4438 
4439 typedef struct wl_pfn_ssid_cfg {
4440 	uint16 version;
4441 	uint16 flags;
4442 	wl_ssid_ext_params_t params;
4443 } wl_pfn_ssid_cfg_t;
4444 
4445 #define CH_BUCKET_REPORT_NONE                   0
4446 #define CH_BUCKET_REPORT_SCAN_COMPLETE_ONLY     1
4447 #define CH_BUCKET_REPORT_FULL_RESULT            2
4448 #define CH_BUCKET_REPORT_SCAN_COMPLETE    (CH_BUCKET_REPORT_SCAN_COMPLETE_ONLY | \
4449 								CH_BUCKET_REPORT_FULL_RESULT)
4450 #define CH_BUCKET_REPORT_REGULAR            0
4451 #define CH_BUCKET_GSCAN                     4
4452 
4453 typedef struct wl_pfn_gscan_ch_bucket_cfg {
4454 	uint8 bucket_end_index;
4455 	uint8 bucket_freq_multiple;
4456 	uint8 flag;
4457 	uint8 reserved;
4458 	uint16 repeat;
4459 	uint16 max_freq_multiple;
4460 } wl_pfn_gscan_ch_bucket_cfg_t;
4461 
4462 typedef struct wl_pfn_capabilities {
4463 	uint16 max_mscan;
4464 	uint16 max_bestn;
4465 	uint16 max_swc_bssid;
4466 	uint16 max_hotlist_bssid;
4467 } wl_pfn_capabilities_t;
4468 
4469 #define GSCAN_SEND_ALL_RESULTS_MASK          (1 << 0)
4470 #define GSCAN_ALL_BUCKETS_IN_FIRST_SCAN_MASK (1 << 3)
4471 #define GSCAN_CFG_FLAGS_ONLY_MASK            (1 << 7)
4472 #define WL_GSCAN_CFG_VERSION                     1
4473 typedef struct wl_pfn_gscan_cfg {
4474 	uint16 version;
4475 	/**
4476 	 * BIT0 1 = send probes/beacons to HOST
4477 	 * BIT1 Reserved
4478 	 * BIT2 Reserved
4479 	 * Add any future flags here
4480 	 * BIT7 1 = no other useful cfg sent
4481 	 */
4482 	uint8  flags;
4483 	/** Buffer filled threshold in % to generate an event */
4484 	uint8   buffer_threshold;
4485 	/**
4486 	 * No. of BSSIDs with "change" to generate an evt
4487 	 * change - crosses rssi threshold/lost
4488 	 */
4489 	uint8   swc_nbssid_threshold;
4490 	/* Max=8 (for now) Size of rssi cache buffer */
4491 	uint8  swc_rssi_window_size;
4492 	uint8  count_of_channel_buckets;
4493 	uint8  retry_threshold;
4494 	uint16  lost_ap_window;
4495 	wl_pfn_gscan_ch_bucket_cfg_t channel_bucket[1];
4496 } wl_pfn_gscan_cfg_t;
4497 
4498 #define WL_PFN_REPORT_ALLNET    0
4499 #define WL_PFN_REPORT_SSIDNET   1
4500 #define WL_PFN_REPORT_BSSIDNET  2
4501 
4502 #define WL_PFN_CFG_FLAGS_PROHIBITED	0x00000001	/* Accept and use prohibited channels */
4503 #define WL_PFN_CFG_FLAGS_RESERVED	0xfffffffe	/**< Remaining reserved for future use */
4504 
4505 typedef struct wl_pfn {
4506 	wlc_ssid_t		ssid;			/**< ssid name and its length */
4507 	int32			flags;			/**< bit2: hidden */
4508 	int32			infra;			/**< BSS Vs IBSS */
4509 	int32			auth;			/**< Open Vs Closed */
4510 	int32			wpa_auth;		/**< WPA type */
4511 	int32			wsec;			/**< wsec value */
4512 } wl_pfn_t;
4513 
4514 typedef struct wl_pfn_list {
4515 	uint32		version;
4516 	uint32		enabled;
4517 	uint32		count;
4518 	wl_pfn_t	pfn[1];
4519 } wl_pfn_list_t;
4520 
4521 #define PFN_SSID_EXT_VERSION   1
4522 
4523 typedef struct wl_pfn_ext {
4524 	uint8 flags;
4525 	int8 rssi_thresh; /* RSSI threshold, track only if RSSI > threshold */
4526 	uint16 wpa_auth; /* Match the wpa auth type defined in wlioctl_defs.h */
4527 	uint8 ssid[DOT11_MAX_SSID_LEN];
4528 	uint8 ssid_len;
4529 	uint8 pad;
4530 } wl_pfn_ext_t;
4531 typedef struct wl_pfn_ext_list {
4532 	uint16 version;
4533 	uint16 count;
4534 	wl_pfn_ext_t pfn_ext[1];
4535 } wl_pfn_ext_list_t;
4536 
4537 #define WL_PFN_SSID_EXT_FOUND   0x1
4538 #define WL_PFN_SSID_EXT_LOST    0x2
4539 typedef struct wl_pfn_result_ssid {
4540 	uint8 flags;
4541 	int8 rssi;
4542 	/* channel number */
4543 	uint16 channel;
4544 	/* Assume idx in order of cfg */
4545 	uint32 index;
4546 } wl_pfn_result_ssid_crc32_t;
4547 
4548 typedef struct wl_pfn_ssid_ext_result {
4549 	uint16 version;
4550 	uint16 count;
4551 	wl_pfn_result_ssid_crc32_t net[1];
4552 } wl_pfn_ssid_ext_result_t;
4553 
4554 #define PFN_EXT_AUTH_CODE_OPEN   1 /* open */
4555 #define PFN_EXT_AUTH_CODE_PSK   2 /* WPA_PSK or WPA2PSK */
4556 #define PFN_EXT_AUTH_CODE_EAPOL 4 /* any EAPOL  */
4557 
4558 #define WL_PFN_HIDDEN_BIT		2
4559 #define WL_PFN_HIDDEN_MASK		0x4
4560 
4561 #ifndef BESTN_MAX
4562 #define BESTN_MAX			10
4563 #endif
4564 
4565 #ifndef MSCAN_MAX
4566 #define MSCAN_MAX			90
4567 #endif
4568 
4569 /* Dynamic scan configuration for motion profiles */
4570 
4571 #define WL_PFN_MPF_VERSION 1
4572 
4573 /* Valid group IDs, may be expanded in the future */
4574 #define WL_PFN_MPF_GROUP_SSID 0
4575 #define WL_PFN_MPF_GROUP_BSSID 1
4576 #define WL_PFN_MPF_MAX_GROUPS 2
4577 
4578 /* Max number of MPF states supported in this time */
4579 #define WL_PFN_MPF_STATES_MAX 4
4580 
4581 /* Flags for the mpf-specific stuff */
4582 #define WL_PFN_MPF_ADAPT_ON_BIT		0
4583 #define WL_PFN_MPF_ADAPTSCAN_BIT	1
4584 
4585 #define WL_PFN_MPF_ADAPT_ON_MASK	0x0001
4586 #define WL_PFN_MPF_ADAPTSCAN_MASK 	0x0006
4587 
4588 /* Per-state timing values */
4589 typedef struct wl_pfn_mpf_state_params {
4590 	int32  scan_freq;	/* Scan frequency (secs) */
4591 	int32  lost_network_timeout; /* Timeout to declare net lost (secs) */
4592 	int16  flags;		/* Space for flags: ADAPT etc */
4593 	uint8  exp;		/* Exponent of 2 for max interval for SMART/STRICT_ADAPT */
4594 	uint8  repeat;		/* Number of scans before changing adaptation level */
4595 	int32  slow_freq;	/* Slow scan period for SLOW_ADAPT */
4596 } wl_pfn_mpf_state_params_t;
4597 
4598 typedef struct wl_pfn_mpf_param {
4599 	uint16 version;		/* Structure version */
4600 	uint16 groupid;		/* Group ID: 0 (SSID), 1 (BSSID), other: reserved */
4601 	wl_pfn_mpf_state_params_t state[WL_PFN_MPF_STATES_MAX];
4602 } wl_pfn_mpf_param_t;
4603 
4604 /* Structure for setting pfn_override iovar */
4605 typedef struct wl_pfn_override_param {
4606 	uint16 version;         /* Structure version */
4607 	uint16 start_offset;    /* Seconds from now to apply new params */
4608 	uint16 duration;        /* Seconds to keep new params applied */
4609 	uint16 reserved;
4610 	wl_pfn_mpf_state_params_t override;
4611 } wl_pfn_override_param_t;
4612 #define WL_PFN_OVERRIDE_VERSION	1
4613 
4614 /*
4615  * Definitions for base MPF configuration
4616  */
4617 
4618 #define WL_MPF_VERSION 1
4619 #define WL_MPF_MAX_BITS 3
4620 #define WL_MPF_MAX_STATES (1 << WL_MPF_MAX_BITS)
4621 
4622 #define WL_MPF_STATE_NAME_MAX 12
4623 
4624 typedef struct wl_mpf_val {
4625 	uint16 val;		/* Value of GPIO bits */
4626 	uint16 state;		/* State identifier */
4627 	char name[WL_MPF_STATE_NAME_MAX]; /* Optional name */
4628 } wl_mpf_val_t;
4629 
4630 typedef struct wl_mpf_map {
4631 	uint16 version;
4632 	uint16 type;
4633 	uint16 mask;		/* Which GPIO bits to use */
4634 	uint8  count;		/* Count of state/value mappings */
4635 	uint8  PAD;
4636 	wl_mpf_val_t vals[WL_MPF_MAX_STATES];
4637 } wl_mpf_map_t;
4638 
4639 #define WL_MPF_STATE_AUTO (0xFFFF) /* (uint16)-1) */
4640 
4641 typedef struct wl_mpf_state {
4642 	uint16 version;
4643 	uint16 type;
4644 	uint16 state;		/* Get/Set */
4645 	uint8 force;		/* 0 - auto (HW) state, 1 - forced state */
4646 	char name[WL_MPF_STATE_NAME_MAX]; /* Get/Set: Optional/actual name */
4647 	uint8  PAD;
4648 } wl_mpf_state_t;
4649 /*
4650  * WLFCTS definition
4651  */
4652 typedef struct wl_txstatus_additional_info {
4653 	uint32 rspec;
4654 	uint32 enq_ts;
4655 	uint32 last_ts;
4656 	uint32 entry_ts;
4657 	uint16 seq;
4658 	uint8  rts_cnt;
4659 	uint8  tx_cnt;
4660 } wl_txstatus_additional_info_t;
4661 
4662 /** Service discovery */
4663 typedef struct {
4664 	uint8	transaction_id;	/**< Transaction id */
4665 	uint8	protocol;	/**< Service protocol type */
4666 	uint16	query_len;	/**< Length of query */
4667 	uint16	response_len;	/**< Length of response */
4668 	uint8	qrbuf[];
4669 } wl_p2po_qr_t;
4670 
4671 typedef struct {
4672 	uint16			period;			/**< extended listen period */
4673 	uint16			interval;		/**< extended listen interval */
4674 	uint16                  count;                  /* count to repeat */
4675 	uint16                  pad;                    /* pad for 32bit align */
4676 } wl_p2po_listen_t;
4677 
4678 /** GAS state machine tunable parameters.  Structure field values of 0 means use the default. */
4679 typedef struct wl_gas_config {
4680 	uint16 max_retransmit;		/**< Max # of firmware/driver retransmits on no Ack
4681 					 * from peer (on top of the ucode retries).
4682 					 */
4683 	uint16 response_timeout;	/**< Max time to wait for a GAS-level response
4684 					 * after sending a packet.
4685 					 */
4686 	uint16 max_comeback_delay;	/**< Max GAS response comeback delay.
4687 					 * Exceeding this fails the GAS exchange.
4688 					 */
4689 	uint16 max_retries;		/**< Max # of GAS state machine retries on failure
4690 					 * of a GAS frame exchange.
4691 					 */
4692 } wl_gas_config_t;
4693 
4694 /** P2P Find Offload parameters */
4695 typedef struct wl_p2po_find_config {
4696 	uint16 version;			/**< Version of this struct */
4697 	uint16 length;			/**< sizeof(wl_p2po_find_config_t) */
4698 	int32 search_home_time;		/**< P2P search state home time when concurrent
4699 					 * connection exists.  -1 for default.
4700 					 */
4701 	uint8 num_social_channels;
4702 			/**< Number of social channels up to WL_P2P_SOCIAL_CHANNELS_MAX.
4703 			 * 0 means use default social channels.
4704 			 */
4705 	uint8 flags;
4706 	uint16 social_channels[1];	/**< Variable length array of social channels */
4707 } wl_p2po_find_config_t;
4708 #define WL_P2PO_FIND_CONFIG_VERSION 2	/**< value for version field */
4709 
4710 /** wl_p2po_find_config_t flags */
4711 #define P2PO_FIND_FLAG_SCAN_ALL_APS 0x01	/**< Whether to scan for all APs in the p2po_find
4712 						 * periodic scans of all channels.
4713 						 * 0 means scan for only P2P devices.
4714 						 * 1 means scan for P2P devices plus non-P2P APs.
4715 						 */
4716 
4717 
4718 /** For adding a WFDS service to seek */
4719 typedef struct {
4720 	uint32 seek_hdl;		/**< unique id chosen by host */
4721 	uint8 addr[6];			/**< Seek service from a specific device with this
4722 					 * MAC address, all 1's for any device.
4723 					 */
4724 	uint8 service_hash[P2P_WFDS_HASH_LEN];
4725 	uint8 service_name_len;
4726 	uint8 service_name[MAX_WFDS_SEEK_SVC_NAME_LEN];
4727 					/**< Service name to seek, not null terminated */
4728 	uint8 service_info_req_len;
4729 	uint8 service_info_req[1];	/**< Service info request, not null terminated.
4730 					 * Variable length specified by service_info_req_len.
4731 					 * Maximum length is MAX_WFDS_SEEK_SVC_INFO_LEN.
4732 					 */
4733 } wl_p2po_wfds_seek_add_t;
4734 
4735 /** For deleting a WFDS service to seek */
4736 typedef struct {
4737 	uint32 seek_hdl;		/**< delete service specified by id */
4738 } wl_p2po_wfds_seek_del_t;
4739 
4740 
4741 /** For adding a WFDS service to advertise */
4742 #include <packed_section_start.h>
4743 typedef BWL_PRE_PACKED_STRUCT struct {
4744 	uint32 advertise_hdl;		/**< unique id chosen by host */
4745 	uint8 service_hash[P2P_WFDS_HASH_LEN];
4746 	uint32 advertisement_id;
4747 	uint16 service_config_method;
4748 	uint8 service_name_len;
4749 	uint8 service_name[MAX_WFDS_SVC_NAME_LEN];
4750 					/**< Service name , not null terminated */
4751 	uint8 service_status;
4752 	uint16 service_info_len;
4753 	uint8 service_info[1];		/**< Service info, not null terminated.
4754 					 * Variable length specified by service_info_len.
4755 					 * Maximum length is MAX_WFDS_ADV_SVC_INFO_LEN.
4756 					 */
4757 } BWL_POST_PACKED_STRUCT wl_p2po_wfds_advertise_add_t;
4758 #include <packed_section_end.h>
4759 
4760 /** For deleting a WFDS service to advertise */
4761 typedef struct {
4762 	uint32 advertise_hdl;	/**< delete service specified by hdl */
4763 } wl_p2po_wfds_advertise_del_t;
4764 
4765 /** P2P Offload discovery mode for the p2po_state iovar */
4766 typedef enum {
4767 	WL_P2PO_DISC_STOP,
4768 	WL_P2PO_DISC_LISTEN,
4769 	WL_P2PO_DISC_DISCOVERY
4770 } disc_mode_t;
4771 
4772 /* ANQP offload */
4773 
4774 #define ANQPO_MAX_QUERY_SIZE		256
4775 typedef struct {
4776 	uint16 max_retransmit;		/**< ~0 use default, max retransmit on no ACK from peer */
4777 	uint16 response_timeout; /**< ~0 use default, msec to wait for resp after tx packet */
4778 	uint16 max_comeback_delay;	/**< ~0 use default, max comeback delay in resp else fail */
4779 	uint16 max_retries;		/**< ~0 use default, max retries on failure */
4780 	uint16 query_len;		/**< length of ANQP query */
4781 	uint8 query_data[1];		/**< ANQP encoded query (max ANQPO_MAX_QUERY_SIZE) */
4782 } wl_anqpo_set_t;
4783 
4784 typedef struct {
4785 	uint16 channel;			/**< channel of the peer */
4786 	struct ether_addr addr;		/**< addr of the peer */
4787 } wl_anqpo_peer_t;
4788 
4789 #define ANQPO_MAX_PEER_LIST			64
4790 typedef struct {
4791 	uint16 count;				/**< number of peers in list */
4792 	wl_anqpo_peer_t peer[1];	/**< max ANQPO_MAX_PEER_LIST */
4793 } wl_anqpo_peer_list_t;
4794 
4795 #define ANQPO_MAX_IGNORE_SSID		64
4796 typedef struct {
4797 	uint8 is_clear;				/**< set to clear list (not used on GET) */
4798 	uint8 PAD;
4799 	uint16 count;				/**< number of SSID in list */
4800 	wlc_ssid_t ssid[1];			/**< max ANQPO_MAX_IGNORE_SSID */
4801 } wl_anqpo_ignore_ssid_list_t;
4802 
4803 #define ANQPO_MAX_IGNORE_BSSID		64
4804 typedef struct {
4805 	uint8 is_clear;				/**< set to clear list (not used on GET) */
4806 	uint8 PAD;
4807 	uint16 count;				/**< number of addr in list */
4808 	struct ether_addr bssid[];	/**< max ANQPO_MAX_IGNORE_BSSID */
4809 } wl_anqpo_ignore_bssid_list_t;
4810 
4811 
4812 struct toe_ol_stats_t {
4813 	/** Num of tx packets that don't need to be checksummed */
4814 	uint32 tx_summed;
4815 
4816 	/* Num of tx packets where checksum is filled by offload engine */
4817 	uint32 tx_iph_fill;
4818 	uint32 tx_tcp_fill;
4819 	uint32 tx_udp_fill;
4820 	uint32 tx_icmp_fill;
4821 
4822 	/*  Num of rx packets where toe finds out if checksum is good or bad */
4823 	uint32 rx_iph_good;
4824 	uint32 rx_iph_bad;
4825 	uint32 rx_tcp_good;
4826 	uint32 rx_tcp_bad;
4827 	uint32 rx_udp_good;
4828 	uint32 rx_udp_bad;
4829 	uint32 rx_icmp_good;
4830 	uint32 rx_icmp_bad;
4831 
4832 	/* Num of tx packets in which csum error is injected */
4833 	uint32 tx_tcp_errinj;
4834 	uint32 tx_udp_errinj;
4835 	uint32 tx_icmp_errinj;
4836 
4837 	/* Num of rx packets in which csum error is injected */
4838 	uint32 rx_tcp_errinj;
4839 	uint32 rx_udp_errinj;
4840 	uint32 rx_icmp_errinj;
4841 };
4842 
4843 /** Arp offload statistic counts */
4844 struct arp_ol_stats_t {
4845 	uint32  host_ip_entries; /**< Host IP table addresses (more than one if multihomed) */
4846 	uint32  host_ip_overflow;	/**< Host IP table additions skipped due to overflow */
4847 
4848 	uint32  arp_table_entries;	/**< ARP table entries */
4849 	uint32  arp_table_overflow;	/**< ARP table additions skipped due to overflow */
4850 
4851 	uint32  host_request;		/**< ARP requests from host */
4852 	uint32  host_reply;		/**< ARP replies from host */
4853 	uint32  host_service;		/**< ARP requests from host serviced by ARP Agent */
4854 
4855 	uint32  peer_request;		/**< ARP requests received from network */
4856 	uint32  peer_request_drop;	/**< ARP requests from network that were dropped */
4857 	uint32  peer_reply;		/**< ARP replies received from network */
4858 	uint32  peer_reply_drop;	/**< ARP replies from network that were dropped */
4859 	uint32  peer_service;		/**< ARP request from host serviced by ARP Agent */
4860 };
4861 
4862 /** NS offload statistic counts */
4863 struct nd_ol_stats_t {
4864 	uint32  host_ip_entries;    /**< Host IP table addresses (more than one if multihomed) */
4865 	uint32  host_ip_overflow;   /**< Host IP table additions skipped due to overflow */
4866 	uint32  peer_request;       /**< NS requests received from network */
4867 	uint32  peer_request_drop;  /**< NS requests from network that were dropped */
4868 	uint32  peer_reply_drop;    /**< NA replies from network that were dropped */
4869 	uint32  peer_service;       /**< NS request from host serviced by firmware */
4870 };
4871 
4872 /*
4873  * Neighbor Discovery Offloading
4874  */
4875 enum {
4876 	WL_ND_IPV6_ADDR_TYPE_UNICAST = 0,
4877 	WL_ND_IPV6_ADDR_TYPE_ANYCAST
4878 };
4879 
4880 typedef struct wl_nd_host_ip_addr {
4881 	struct ipv6_addr ip_addr;	/* host ip address */
4882 	uint8 type;			/* type of address */
4883 	uint8 pad[3];
4884 } wl_nd_host_ip_addr_t;
4885 
4886 typedef struct wl_nd_host_ip_list {
4887 	uint32 count;
4888 	wl_nd_host_ip_addr_t host_ip[1];
4889 } wl_nd_host_ip_list_t;
4890 
4891 #define WL_ND_HOSTIP_IOV_VER    1
4892 
4893 enum {
4894 	WL_ND_HOSTIP_OP_VER = 0,	/* get version */
4895 	WL_ND_HOSTIP_OP_ADD,		/* add address */
4896 	WL_ND_HOSTIP_OP_DEL,		/* delete specified address */
4897 	WL_ND_HOSTIP_OP_DEL_UC,		/* delete all unicast address */
4898 	WL_ND_HOSTIP_OP_DEL_AC,		/* delete all anycast address */
4899 	WL_ND_HOSTIP_OP_DEL_ALL,	/* delete all addresses */
4900 	WL_ND_HOSTIP_OP_LIST,		/* get list of host ip address */
4901 	WL_ND_HOSTIP_OP_MAX
4902 };
4903 
4904 typedef struct wl_nd_hostip {
4905 	uint16 version;				/* version of iovar buf */
4906 	uint16 op_type;				/* operation type */
4907 	uint32 length;				/* length of entire structure */
4908 	union {
4909 		wl_nd_host_ip_addr_t host_ip;	/* set param for add */
4910 		uint16 version;			/* get return for ver */
4911 	} u;
4912 } wl_nd_hostip_t;
4913 
4914 #define WL_ND_HOSTIP_FIXED_LEN		OFFSETOF(wl_nd_hostip_t, u)
4915 #define WL_ND_HOSTIP_WITH_ADDR_LEN	(WL_ND_HOSTIP_FIXED_LEN + sizeof(wl_nd_host_ip_addr_t))
4916 
4917 /*
4918  * Keep-alive packet offloading.
4919  */
4920 
4921 /**
4922  * NAT keep-alive packets format: specifies the re-transmission period, the packet
4923  * length, and packet contents.
4924  */
4925 typedef struct wl_keep_alive_pkt {
4926 	uint32	period_msec;	/** Retransmission period (0 to disable packet re-transmits) */
4927 	uint16	len_bytes;	/* Size of packet to transmit (0 to disable packet re-transmits) */
4928 	uint8	data[1];	/** Variable length packet to transmit.  Contents should include
4929 				 * entire ethernet packet (enet header, IP header, UDP header,
4930 				 * and UDP payload) in network byte order.
4931 				 */
4932 } wl_keep_alive_pkt_t;
4933 
4934 #define WL_KEEP_ALIVE_FIXED_LEN		OFFSETOF(wl_keep_alive_pkt_t, data)
4935 
4936 #define MAX_RSSI_COUNT			8
4937 typedef struct rssi_struct {
4938 	int8	val[MAX_RSSI_COUNT];	/**< rssi values in AFs */
4939 	int16	sum;			/**< total rssi sum */
4940 	uint8	cnt;			/**< number rssi samples */
4941 	uint8	idx;			/**< next rssi location */
4942 } rssi_struct_t;
4943 
4944 
4945 /*
4946  * ptk_start: iovar to start 4-way handshake for secured ranging
4947 */
4948 
4949 /* ptk negotiation security type - determines negotiation parameters */
4950 typedef enum {
4951 	WL_PTK_START_SEC_TYPE_PMK = 1
4952 } wl_ptk_start_sec_type_t;
4953 
4954 /* ptk negotiation role */
4955 typedef enum {
4956 	ROLE_NONE	= 0x0,
4957 	ROLE_AUTH	= 0x1,
4958 	ROLE_SUP	= 0x2,
4959 	ROLE_STATIC	= 0x3,
4960 	ROLE_INVALID	= 0xff,
4961 	WL_PTK_START_ROLE_NONE = ROLE_NONE,
4962 	WL_PTK_START_ROLE_AUTH = ROLE_AUTH,
4963 	WL_PTK_START_ROLE_SUP = ROLE_SUP,
4964 	WL_PTK_START_ROLE_STATIC = ROLE_STATIC,
4965 	WL_PTK_START_ROLE_INVALID = ROLE_INVALID
4966 } wl_ptk_start_role_t;
4967 
4968 typedef struct wl_ptk_start_tlv {
4969 	uint16 id;
4970 	uint16 len;
4971 	uint8 data[1];
4972 } wl_ptk_start_tlv_t;
4973 
4974 typedef enum {
4975 	WL_PTK_START_TLV_PMK	= 1	/* uint8[] */
4976 } wl_ptk_start_tlv_type;
4977 
4978 typedef enum {
4979 	WL_PTK_START_FLAG_NO_DATA_PROT	= 1,	/* data frame protection disabled */
4980 	WL_PTK_START_FLAG_GEN_FTM_TPK	= 2	/* Generate FTM Toast/Seq Protection Key */
4981 } wl_ptk_start_flags_t;
4982 
4983 typedef struct wl_ptk_start_iov {
4984 	uint16 version;
4985 	uint16 len;				/* length of entire iov from version */
4986 	wl_ptk_start_flags_t flags;
4987 	wl_ptk_start_sec_type_t sec_type;
4988 	wl_ptk_start_role_t role;
4989 	struct ether_addr peer_addr;
4990 	uint16 pad;				/* reserved/32 bit alignment */
4991 	wl_ptk_start_tlv_t tlvs[1];
4992 } wl_ptk_start_iov_t;
4993 
4994 /*
4995  * Dongle pattern matching filter.
4996  */
4997 
4998 #define MAX_WAKE_PACKET_CACHE_BYTES 128 /**< Maximum cached wake packet */
4999 
5000 #define MAX_WAKE_PACKET_BYTES	    (DOT11_A3_HDR_LEN +			    \
5001 				     DOT11_QOS_LEN +			    \
5002 				     sizeof(struct dot11_llc_snap_header) + \
5003 				     ETHER_MAX_DATA)
5004 
5005 typedef struct pm_wake_packet {
5006 	uint32	status;		/**< Is the wake reason a packet (if all the other field's valid) */
5007 	uint32	pattern_id;	/**< Pattern ID that matched */
5008 	uint32	original_packet_size;
5009 	uint32	saved_packet_size;
5010 	uint8	packet[MAX_WAKE_PACKET_CACHE_BYTES];
5011 } pm_wake_packet_t;
5012 
5013 /* Packet filter types. Currently, only pattern matching is supported. */
5014 typedef enum wl_pkt_filter_type {
5015 	WL_PKT_FILTER_TYPE_PATTERN_MATCH=0,       /**< Pattern matching filter */
5016 	WL_PKT_FILTER_TYPE_MAGIC_PATTERN_MATCH=1, /**< Magic packet match */
5017 	WL_PKT_FILTER_TYPE_PATTERN_LIST_MATCH=2,  /**< A pattern list (match all to match filter) */
5018 	WL_PKT_FILTER_TYPE_ENCRYPTED_PATTERN_MATCH=3, /**< SECURE WOWL magic / net pattern match */
5019 	WL_PKT_FILTER_TYPE_APF_MATCH=4, /* Android packet filter match */
5020 	WL_PKT_FILTER_TYPE_PATTERN_MATCH_TIMEOUT=5, /* Pattern matching filter with timeout event */
5021 	WL_PKT_FILTER_TYPE_IMMEDIATE_PATTERN_MATCH=6, /* Immediately pattern matching filter */
5022 	WL_PKT_FILTYER_TYPE_MAX = 7,	/* Pkt filter type MAX */
5023 } wl_pkt_filter_type_t;
5024 
5025 #define WL_PKT_FILTER_TYPE wl_pkt_filter_type_t
5026 
5027 /* String mapping for types that may be used by applications or debug */
5028 #define WL_PKT_FILTER_TYPE_NAMES \
5029 	{ "PATTERN", WL_PKT_FILTER_TYPE_PATTERN_MATCH },	\
5030 	{ "MAGIC",   WL_PKT_FILTER_TYPE_MAGIC_PATTERN_MATCH },	\
5031 	{ "PATLIST", WL_PKT_FILTER_TYPE_PATTERN_LIST_MATCH },	\
5032 	{ "SECURE WOWL", WL_PKT_FILTER_TYPE_ENCRYPTED_PATTERN_MATCH },	\
5033 	{ "APF", WL_PKT_FILTER_TYPE_APF_MATCH }, \
5034 	{ "PATTERN TIMEOUT", WL_PKT_FILTER_TYPE_PATTERN_MATCH_TIMEOUT }, \
5035 	{ "IMMEDIATE", WL_PKT_FILTER_TYPE_IMMEDIATE_PATTERN_MATCH }
5036 
5037 /** Secured WOWL packet was encrypted, need decrypted before check filter match */
5038 typedef struct wl_pkt_decrypter {
5039 	uint8* (*dec_cb)(void* dec_ctx, const void *sdu, int sending);
5040 	void*  dec_ctx;
5041 } wl_pkt_decrypter_t;
5042 
5043 /**
5044  * Pattern matching filter. Specifies an offset within received packets to
5045  * start matching, the pattern to match, the size of the pattern, and a bitmask
5046  * that indicates which bits within the pattern should be matched.
5047  */
5048 typedef struct wl_pkt_filter_pattern {
5049 	uint32	offset;		/**< Offset within received packet to start pattern matching.
5050 				 * Offset '0' is the first byte of the ethernet header.
5051 				 */
5052 	uint32	size_bytes;	/**< Size of the pattern.  Bitmask must be the same size. */
5053 	uint8   mask_and_pattern[]; /**< Variable length mask and pattern data.  mask starts
5054 				      * at offset 0.  Pattern immediately follows mask. for
5055 				      * secured pattern, put the descrypter pointer to the
5056 				      * beginning, mask and pattern postponed correspondingly
5057 				      */
5058 } wl_pkt_filter_pattern_t;
5059 
5060 /** A pattern list is a numerically specified list of modified pattern structures. */
5061 typedef struct wl_pkt_filter_pattern_listel {
5062 	uint16 rel_offs;	/**< Offset to begin match (relative to 'base' below) */
5063 	uint16 base_offs;	/**< Base for offset (defined below) */
5064 	uint16 size_bytes;	/**< Size of mask/pattern */
5065 	uint16 match_flags;	/**< Addition flags controlling the match */
5066 	uint8  mask_and_data[1]; /**< Variable length mask followed by data, each size_bytes */
5067 } wl_pkt_filter_pattern_listel_t;
5068 
5069 typedef struct wl_pkt_filter_pattern_list {
5070 	uint8 list_cnt;		/**< Number of elements in the list */
5071 	uint8 PAD1[1];		/**< Reserved (possible version: reserved) */
5072 	uint16 totsize;		/**< Total size of this pattern list (includes this struct) */
5073 	wl_pkt_filter_pattern_listel_t patterns[]; /**< Variable number of list elements */
5074 } wl_pkt_filter_pattern_list_t;
5075 
5076 typedef struct wl_apf_program {
5077 	uint16 version;
5078 	uint16 instr_len;	/* number of instruction blocks */
5079 	uint32 inst_ts;		/* program installation timestamp */
5080 	uint8 instrs[];	/* variable length instructions */
5081 } wl_apf_program_t;
5082 
5083 typedef struct wl_pkt_filter_pattern_timeout {
5084 	uint32	offset;	/* Offset within received packet to start pattern matching.
5085 					 * Offset '0' is the first byte of the ethernet header.
5086 					 */
5087 	uint32	size_bytes;	/* Size of the pattern. Bitmask must be the same size. */
5088 	uint32	timeout;	/* Timeout(seconds) */
5089 	uint8	mask_and_pattern[1]; /* Variable length mask and pattern data.
5090 								 * mask starts at offset 0. Pattern
5091 								 * immediately follows mask.
5092 								*/
5093 } wl_pkt_filter_pattern_timeout_t;
5094 
5095 /** IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
5096 typedef struct wl_pkt_filter {
5097 	uint32	id;		/**< Unique filter id, specified by app. */
5098 	uint32	type;		/**< Filter type (WL_PKT_FILTER_TYPE_xxx). */
5099 	uint32	negate_match;	/**< Negate the result of filter matches */
5100 	union {			/* Filter definitions */
5101 		wl_pkt_filter_pattern_t pattern;	/**< Pattern matching filter */
5102 		wl_pkt_filter_pattern_list_t patlist; /**< List of patterns to match */
5103 		wl_apf_program_t apf_program; /* apf program */
5104 		wl_pkt_filter_pattern_timeout_t pattern_timeout; /* Pattern timeout event filter */
5105 	} u;
5106 } wl_pkt_filter_t;
5107 
5108 /** IOVAR "tcp_keep_set" parameter. Used to install tcp keep_alive stuff. */
5109 typedef struct wl_tcp_keep_set {
5110 	uint32	val1;
5111 	uint32	val2;
5112 } wl_tcp_keep_set_t;
5113 
5114 #define WL_PKT_FILTER_FIXED_LEN		  OFFSETOF(wl_pkt_filter_t, u)
5115 #define WL_PKT_FILTER_PATTERN_FIXED_LEN	  OFFSETOF(wl_pkt_filter_pattern_t, mask_and_pattern)
5116 #define WL_PKT_FILTER_PATTERN_LIST_FIXED_LEN OFFSETOF(wl_pkt_filter_pattern_list_t, patterns)
5117 #define WL_PKT_FILTER_PATTERN_LISTEL_FIXED_LEN	\
5118 			OFFSETOF(wl_pkt_filter_pattern_listel_t, mask_and_data)
5119 #define WL_PKT_FILTER_PATTERN_TIMEOUT_FIXED_LEN	\
5120 			OFFSETOF(wl_pkt_filter_pattern_timeout_t, mask_and_pattern)
5121 
5122 #define WL_APF_INTERNAL_VERSION	1
5123 #define WL_APF_PROGRAM_MAX_SIZE (2 * 1024)
5124 #define WL_APF_PROGRAM_FIXED_LEN	OFFSETOF(wl_apf_program_t, instrs)
5125 #define WL_APF_PROGRAM_LEN(apf_program)	\
5126 	((apf_program)->instr_len * sizeof((apf_program)->instrs[0]))
5127 #define WL_APF_PROGRAM_TOTAL_LEN(apf_program)	\
5128 	(WL_APF_PROGRAM_FIXED_LEN + WL_APF_PROGRAM_LEN(apf_program))
5129 
5130 /** IOVAR "pkt_filter_enable" parameter. */
5131 typedef struct wl_pkt_filter_enable {
5132 	uint32	id;		/**< Unique filter id */
5133 	uint32	enable;		/**< Enable/disable bool */
5134 } wl_pkt_filter_enable_t;
5135 
5136 /** IOVAR "pkt_filter_list" parameter. Used to retrieve a list of installed filters. */
5137 typedef struct wl_pkt_filter_list {
5138 	uint32	num;		/**< Number of installed packet filters */
5139 	wl_pkt_filter_t	filter[1];	/**< Variable array of packet filters. */
5140 } wl_pkt_filter_list_t;
5141 
5142 #define WL_PKT_FILTER_LIST_FIXED_LEN	  OFFSETOF(wl_pkt_filter_list_t, filter)
5143 
5144 /** IOVAR "pkt_filter_stats" parameter. Used to retrieve debug statistics. */
5145 typedef struct wl_pkt_filter_stats {
5146 	uint32	num_pkts_matched;	/**< # filter matches for specified filter id */
5147 	uint32	num_pkts_forwarded;	/**< # packets fwded from dongle to host for all filters */
5148 	uint32	num_pkts_discarded;	/**< # packets discarded by dongle for all filters */
5149 } wl_pkt_filter_stats_t;
5150 
5151 /** IOVAR "pkt_filter_ports" parameter.  Configure TCP/UDP port filters. */
5152 typedef struct wl_pkt_filter_ports {
5153 	uint8 version;		/**< Be proper */
5154 	uint8 reserved;		/**< Be really proper */
5155 	uint16 count;		/**< Number of ports following */
5156 	/* End of fixed data */
5157 	uint16 ports[1];	/**< Placeholder for ports[<count>] */
5158 } wl_pkt_filter_ports_t;
5159 
5160 #define WL_PKT_FILTER_PORTS_FIXED_LEN	OFFSETOF(wl_pkt_filter_ports_t, ports)
5161 
5162 #define WL_PKT_FILTER_PORTS_VERSION	0
5163 #define WL_PKT_FILTER_PORTS_MAX		128
5164 
5165 #define RSN_REPLAY_LEN 8
5166 typedef struct _gtkrefresh {
5167 	uint8	KCK[RSN_KCK_LENGTH];
5168 	uint8	KEK[RSN_KEK_LENGTH];
5169 	uint8	ReplayCounter[RSN_REPLAY_LEN];
5170 } gtk_keyinfo_t, *pgtk_keyinfo_t;
5171 
5172 /** Sequential Commands ioctl */
5173 typedef struct wl_seq_cmd_ioctl {
5174 	uint32 cmd;		/**< common ioctl definition */
5175 	uint32 len;		/**< length of user buffer */
5176 } wl_seq_cmd_ioctl_t;
5177 
5178 #define WL_SEQ_CMD_ALIGN_BYTES	4
5179 
5180 /**
5181  * These are the set of get IOCTLs that should be allowed when using
5182  * IOCTL sequence commands. These are issued implicitly by wl.exe each time
5183  * it is invoked. We never want to buffer these, or else wl.exe will stop working.
5184  */
5185 #define WL_SEQ_CMDS_GET_IOCTL_FILTER(cmd) \
5186 	(((cmd) == WLC_GET_MAGIC)		|| \
5187 	 ((cmd) == WLC_GET_VERSION)		|| \
5188 	 ((cmd) == WLC_GET_AP)			|| \
5189 	 ((cmd) == WLC_GET_INSTANCE))
5190 
5191 typedef struct wl_pkteng {
5192 	uint32 flags;
5193 	uint32 delay;			/**< Inter-packet delay */
5194 	uint32 nframes;			/**< Number of frames */
5195 	uint32 length;			/**< Packet length */
5196 	uint8  seqno;			/**< Enable/disable sequence no. */
5197 	struct ether_addr dest;		/**< Destination address */
5198 	struct ether_addr src;		/**< Source address */
5199 	uint8  PAD[3];
5200 } wl_pkteng_t;
5201 
5202 #define WL_PKTENG_RU_FILL_VER_1		1
5203 // struct for ru packet engine
5204 typedef struct wl_pkteng_ru {
5205 	uint16 version;		/* ver is 1 */
5206 	uint16 length;		/* size of complete structure */
5207 	uint8 bw;			/* bandwidth info */
5208 	uint8 ru_alloc_val;		/* ru allocation index number */
5209 	uint8 mcs_val;			/* mcs allocated value */
5210 	uint8 nss_val;			/* num of spatial streams */
5211 	uint32 num_bytes;		/* approx num of bytes to calculate other required params */
5212 	uint8 cp_ltf_val ;		/* GI and LTF symbol size */
5213 	uint8 he_ltf_symb ;		/* num of HE-LTF symbols */
5214 	uint8 stbc;			/* STBC support */
5215 	uint8 coding_val;		/* BCC/LDPC coding support */
5216 	uint8 pe_category;	/* PE duration 0/8/16usecs  */
5217 	uint8 dcm;			/* dual carrier modulation */
5218 	uint8 mumimo_ltfmode; /* ltf mode */
5219 	uint8 PAD[1];		/* pad bytes to make structure occupy 4 byte aligned */
5220 } wl_pkteng_ru_fill_t;
5221 
5222 typedef struct wl_pkteng_stats {
5223 	uint32 lostfrmcnt;		/**< RX PER test: no of frames lost (skip seqno) */
5224 	int32 rssi;			/**< RSSI */
5225 	int32 snr;			/**< signal to noise ratio */
5226 	uint16 rxpktcnt[NUM_80211_RATES+1];
5227 	uint8 rssi_qdb;			/**< qdB portion of the computed rssi */
5228 	uint8  PAD;
5229 } wl_pkteng_stats_t;
5230 
5231 typedef struct wl_txcal_params {
5232 	wl_pkteng_t pkteng;
5233 	uint8 gidx_start;
5234 	int8 gidx_step;
5235 	uint8 gidx_stop;
5236 	uint8  PAD;
5237 } wl_txcal_params_t;
5238 
5239 
5240 typedef struct wl_sslpnphy_papd_debug_data {
5241 	uint8 psat_pwr;
5242 	uint8 psat_indx;
5243 	uint8 final_idx;
5244 	uint8 start_idx;
5245 	int32 min_phase;
5246 	int32 voltage;
5247 	int8 temperature;
5248 	uint8  PAD[3];
5249 } wl_sslpnphy_papd_debug_data_t;
5250 typedef struct wl_sslpnphy_debug_data {
5251 	int16 papdcompRe [64];
5252 	int16 papdcompIm [64];
5253 } wl_sslpnphy_debug_data_t;
5254 typedef struct wl_sslpnphy_spbdump_data {
5255 	uint16 tbl_length;
5256 	int16 spbreal[256];
5257 	int16 spbimg[256];
5258 } wl_sslpnphy_spbdump_data_t;
5259 typedef struct wl_sslpnphy_percal_debug_data {
5260 	uint32 cur_idx;
5261 	uint32 tx_drift;
5262 	uint8 prev_cal_idx;
5263 	uint8  PAD[3];
5264 	uint32 percal_ctr;
5265 	int32 nxt_cal_idx;
5266 	uint32 force_1idxcal;
5267 	uint32 onedxacl_req;
5268 	int32 last_cal_volt;
5269 	int8 last_cal_temp;
5270 	uint8  PAD[3];
5271 	uint32 vbat_ripple;
5272 	uint32 exit_route;
5273 	int32 volt_winner;
5274 } wl_sslpnphy_percal_debug_data_t;
5275 
5276 typedef enum {
5277 	wowl_pattern_type_bitmap = 0,
5278 	wowl_pattern_type_arp,
5279 	wowl_pattern_type_na
5280 } wowl_pattern_type_t;
5281 
5282 typedef struct wl_wowl_pattern {
5283 	uint32		    masksize;		/**< Size of the mask in #of bytes */
5284 	uint32		    offset;		/**< Pattern byte offset in packet */
5285 	uint32		    patternoffset;	/**< Offset of start of pattern in the structure */
5286 	uint32		    patternsize;	/**< Size of the pattern itself in #of bytes */
5287 	uint32		    id;			/**< id */
5288 	uint32		    reasonsize;		/**< Size of the wakeup reason code */
5289 	wowl_pattern_type_t type;		/**< Type of pattern */
5290 	/* Mask follows the structure above */
5291 	/* Pattern follows the mask is at 'patternoffset' from the start */
5292 } wl_wowl_pattern_t;
5293 
5294 typedef struct wl_wowl_pattern_list {
5295 	uint32			count;
5296 	wl_wowl_pattern_t	pattern[1];
5297 } wl_wowl_pattern_list_t;
5298 
5299 typedef struct wl_wowl_wakeind {
5300 	uint8	pci_wakeind;	/**< Whether PCI PMECSR PMEStatus bit was set */
5301 	uint32	ucode_wakeind;	/**< What wakeup-event indication was set by ucode */
5302 } wl_wowl_wakeind_t;
5303 
5304 /** per AC rate control related data structure */
5305 typedef struct wl_txrate_class {
5306 	uint8		init_rate;
5307 	uint8		min_rate;
5308 	uint8		max_rate;
5309 } wl_txrate_class_t;
5310 
5311 /** structure for Overlap BSS scan arguments */
5312 typedef struct wl_obss_scan_arg {
5313 	int16	passive_dwell;
5314 	int16	active_dwell;
5315 	int16	bss_widthscan_interval;
5316 	int16	passive_total;
5317 	int16	active_total;
5318 	int16	chanwidth_transition_delay;
5319 	int16	activity_threshold;
5320 } wl_obss_scan_arg_t;
5321 
5322 #define WL_OBSS_SCAN_PARAM_LEN	sizeof(wl_obss_scan_arg_t)
5323 
5324 /** RSSI event notification configuration. */
5325 typedef struct wl_rssi_event {
5326 	uint32 rate_limit_msec;		/**< # of events posted to application will be limited to
5327 					 * one per specified period (0 to disable rate limit).
5328 					 */
5329 	uint8 num_rssi_levels;		/**< Number of entries in rssi_levels[] below */
5330 	int8 rssi_levels[MAX_RSSI_LEVELS];	/**< Variable number of RSSI levels. An event
5331 						 * will be posted each time the RSSI of received
5332 						 * beacons/packets crosses a level.
5333 						 */
5334 	int8 pad[3];
5335 } wl_rssi_event_t;
5336 
5337 #define RSSI_MONITOR_VERSION    1
5338 #define RSSI_MONITOR_STOP       (1 << 0)
5339 typedef struct wl_rssi_monitor_cfg {
5340 	uint8 version;
5341 	uint8 flags;
5342 	int8 max_rssi;
5343 	int8 min_rssi;
5344 } wl_rssi_monitor_cfg_t;
5345 
5346 typedef struct wl_rssi_monitor_evt {
5347 	uint8 version;
5348 	int8 cur_rssi;
5349 	uint16 pad;
5350 } wl_rssi_monitor_evt_t;
5351 
5352 /* CCA based channel quality event configuration */
5353 #define WL_CHAN_QUAL_CCA	0
5354 #define WL_CHAN_QUAL_NF		1
5355 #define WL_CHAN_QUAL_NF_LTE	2
5356 #define WL_CHAN_QUAL_TOTAL	3
5357 
5358 #define MAX_CHAN_QUAL_LEVELS	8
5359 
5360 typedef struct wl_chan_qual_metric {
5361 	uint8 id;				/**< metric ID */
5362 	uint8 num_levels;               	/**< Number of entries in rssi_levels[] below */
5363 	uint16 flags;
5364 	int16 htol[MAX_CHAN_QUAL_LEVELS];	/**< threshold level array: hi-to-lo */
5365 	int16 ltoh[MAX_CHAN_QUAL_LEVELS];	/**< threshold level array: lo-to-hi */
5366 } wl_chan_qual_metric_t;
5367 
5368 typedef struct wl_chan_qual_event {
5369 	uint32 rate_limit_msec;		/**< # of events posted to application will be limited to
5370 					 * one per specified period (0 to disable rate limit).
5371 					 */
5372 	uint16 flags;
5373 	uint16 num_metrics;
5374 	wl_chan_qual_metric_t metric[WL_CHAN_QUAL_TOTAL];	/**< metric array */
5375 } wl_chan_qual_event_t;
5376 typedef struct wl_action_obss_coex_req {
5377 	uint8 info;
5378 	uint8 num;
5379 	uint8 ch_list[1];
5380 } wl_action_obss_coex_req_t;
5381 
5382 
5383 /** IOVar parameter block for small MAC address array with type indicator */
5384 #define WL_IOV_MAC_PARAM_LEN  4
5385 
5386 #define WL_IOV_PKTQ_LOG_PRECS 16
5387 
5388 #include <packed_section_start.h>
5389 typedef BWL_PRE_PACKED_STRUCT struct {
5390 	uint32 num_addrs;
5391 	uint8   addr_type[WL_IOV_MAC_PARAM_LEN];
5392 	struct ether_addr ea[WL_IOV_MAC_PARAM_LEN];
5393 } BWL_POST_PACKED_STRUCT wl_iov_mac_params_t;
5394 #include <packed_section_end.h>
5395 
5396 /** This is extra info that follows wl_iov_mac_params_t */
5397 typedef struct {
5398 	uint32 addr_info[WL_IOV_MAC_PARAM_LEN];
5399 } wl_iov_mac_extra_params_t;
5400 
5401 /** Combined structure */
5402 typedef struct {
5403 	wl_iov_mac_params_t params;
5404 	wl_iov_mac_extra_params_t extra_params;
5405 } wl_iov_mac_full_params_t;
5406 
5407 /** Parameter block for PKTQ_LOG statistics */
5408 #define PKTQ_LOG_COUNTERS_V4 \
5409 	/* packets requested to be stored */ \
5410 	uint32 requested; \
5411 	/* packets stored */ \
5412 	uint32 stored; \
5413 	/* packets saved, because a lowest priority queue has given away one packet */ \
5414 	uint32 saved; \
5415 	/* packets saved, because an older packet from the same queue has been dropped */ \
5416 	uint32 selfsaved; \
5417 	/* packets dropped, because pktq is full with higher precedence packets */ \
5418 	uint32 full_dropped; \
5419 	 /* packets dropped because pktq per that precedence is full */ \
5420 	uint32 dropped; \
5421 	/* packets dropped, in order to save one from a queue of a highest priority */ \
5422 	uint32 sacrificed; \
5423 	/* packets droped because of hardware/transmission error */ \
5424 	uint32 busy; \
5425 	/* packets re-sent because they were not received */ \
5426 	uint32 retry; \
5427 	/* packets retried again (ps pretend) prior to moving power save mode */ \
5428 	uint32 ps_retry; \
5429 	 /* suppressed packet count */ \
5430 	uint32 suppress; \
5431 	/* packets finally dropped after retry limit */ \
5432 	uint32 retry_drop; \
5433 	/* the high-water mark of the queue capacity for packets - goes to zero as queue fills */ \
5434 	uint32 max_avail; \
5435 	/* the high-water mark of the queue utilisation for packets - ('inverse' of max_avail) */ \
5436 	uint32 max_used; \
5437 	 /* the maximum capacity of the queue */ \
5438 	uint32 queue_capacity; \
5439 	/* count of rts attempts that failed to receive cts */ \
5440 	uint32 rtsfail; \
5441 	/* count of packets sent (acked) successfully */ \
5442 	uint32 acked; \
5443 	/* running total of phy rate of packets sent successfully */ \
5444 	uint32 txrate_succ; \
5445 	/* running total of phy 'main' rate */ \
5446 	uint32 txrate_main; \
5447 	/* actual data transferred successfully */ \
5448 	uint32 throughput; \
5449 	/* time difference since last pktq_stats */ \
5450 	uint32 time_delta;
5451 
5452 typedef struct {
5453 	PKTQ_LOG_COUNTERS_V4
5454 } pktq_log_counters_v04_t;
5455 
5456 /** v5 is the same as V4 with extra parameter */
5457 typedef struct {
5458 	PKTQ_LOG_COUNTERS_V4
5459 	/** cumulative time to transmit */
5460 	uint32 airtime;
5461 } pktq_log_counters_v05_t;
5462 
5463 typedef struct {
5464 	uint8                num_prec[WL_IOV_MAC_PARAM_LEN];
5465 	pktq_log_counters_v04_t  counters[WL_IOV_MAC_PARAM_LEN][WL_IOV_PKTQ_LOG_PRECS];
5466 	uint32               counter_info[WL_IOV_MAC_PARAM_LEN];
5467 	uint32               pspretend_time_delta[WL_IOV_MAC_PARAM_LEN];
5468 	char                 headings[];
5469 } pktq_log_format_v04_t;
5470 
5471 typedef struct {
5472 	uint8                num_prec[WL_IOV_MAC_PARAM_LEN];
5473 	pktq_log_counters_v05_t  counters[WL_IOV_MAC_PARAM_LEN][WL_IOV_PKTQ_LOG_PRECS];
5474 	uint32               counter_info[WL_IOV_MAC_PARAM_LEN];
5475 	uint32               pspretend_time_delta[WL_IOV_MAC_PARAM_LEN];
5476 	char                 headings[];
5477 } pktq_log_format_v05_t;
5478 
5479 
5480 typedef struct {
5481 	uint32               version;
5482 	wl_iov_mac_params_t  params;
5483 	union {
5484 		pktq_log_format_v04_t v04;
5485 		pktq_log_format_v05_t v05;
5486 	} pktq_log;
5487 } wl_iov_pktq_log_t;
5488 
5489 /* PKTQ_LOG_AUTO, PKTQ_LOG_DEF_PREC flags introduced in v05, they are ignored by v04 */
5490 #define PKTQ_LOG_AUTO     (1 << 31)
5491 #define PKTQ_LOG_DEF_PREC (1 << 30)
5492 
5493 typedef struct wl_pfn_macaddr_cfg_0 {
5494 	uint8 version;
5495 	uint8 reserved;
5496 	struct ether_addr macaddr;
5497 } wl_pfn_macaddr_cfg_0_t;
5498 #define LEGACY1_WL_PFN_MACADDR_CFG_VER 0
5499 #define WL_PFN_MAC_OUI_ONLY_MASK      1
5500 #define WL_PFN_SET_MAC_UNASSOC_MASK   2
5501 #define WL_PFN_RESTRICT_LA_MAC_MASK   4
5502 #define WL_PFN_MACADDR_FLAG_MASK     0x7
5503 /** To configure pfn_macaddr */
5504 typedef struct wl_pfn_macaddr_cfg {
5505 	uint8 version;
5506 	uint8 flags;
5507 	struct ether_addr macaddr;
5508 } wl_pfn_macaddr_cfg_t;
5509 #define WL_PFN_MACADDR_CFG_VER 1
5510 
5511 /*
5512  * SCB_BS_DATA iovar definitions start.
5513  */
5514 #define SCB_BS_DATA_STRUCT_VERSION	1
5515 
5516 /** The actual counters maintained for each station */
5517 typedef struct {
5518 	/* The following counters are a subset of what pktq_stats provides per precedence. */
5519 	uint32 retry;          /**< packets re-sent because they were not received */
5520 	uint32 retry_drop;     /**< packets finally dropped after retry limit */
5521 	uint32 rtsfail;        /**< count of rts attempts that failed to receive cts */
5522 	uint32 acked;          /**< count of packets sent (acked) successfully */
5523 	uint32 txrate_succ;    /**< running total of phy rate of packets sent successfully */
5524 	uint32 txrate_main;    /**< running total of phy 'main' rate */
5525 	uint32 throughput;     /**< actual data transferred successfully */
5526 	uint32 time_delta;     /**< time difference since last pktq_stats */
5527 	uint32 airtime;        /**< cumulative total medium access delay in useconds */
5528 } iov_bs_data_counters_t;
5529 
5530 /** The structure for individual station information. */
5531 #include <packed_section_start.h>
5532 typedef BWL_PRE_PACKED_STRUCT struct {
5533 	struct ether_addr	station_address;	/**< The station MAC address */
5534 	uint16			station_flags;		/**< Bit mask of flags, for future use. */
5535 	iov_bs_data_counters_t	station_counters;	/**< The actual counter values */
5536 } BWL_POST_PACKED_STRUCT iov_bs_data_record_t;
5537 #include <packed_section_end.h>
5538 
5539 #include <packed_section_start.h>
5540 typedef BWL_PRE_PACKED_STRUCT struct {
5541 	uint16	structure_version;	/**< Structure version number (for wl/wlu matching) */
5542 	uint16	structure_count;	/**< Number of iov_bs_data_record_t records following */
5543 	iov_bs_data_record_t	structure_record[1];	/**< 0 - structure_count records */
5544 } BWL_POST_PACKED_STRUCT iov_bs_data_struct_t;
5545 #include <packed_section_end.h>
5546 
5547 /* Bitmask of options that can be passed in to the iovar. */
5548 enum {
5549 	SCB_BS_DATA_FLAG_NO_RESET = (1<<0)	/**< Do not clear the counters after reading */
5550 };
5551 /*
5552  * SCB_BS_DATA iovar definitions end.
5553  */
5554 
5555 typedef struct wlc_extlog_cfg {
5556 	int32 max_number;
5557 	uint16 module;	/**< bitmap */
5558 	uint8 level;
5559 	uint8 flag;
5560 	uint16 version;
5561 	uint16 PAD;
5562 } wlc_extlog_cfg_t;
5563 
5564 typedef struct log_record {
5565 	uint32 time;
5566 	uint16 module;
5567 	uint16 id;
5568 	uint8 level;
5569 	uint8 sub_unit;
5570 	uint8 seq_num;
5571 	uint8 pad;
5572 	int32 arg;
5573 	char  str[MAX_ARGSTR_LEN];
5574 	char  PAD[4-MAX_ARGSTR_LEN%4];
5575 } log_record_t;
5576 
5577 typedef struct wlc_extlog_req {
5578 	uint32 from_last;
5579 	uint32 num;
5580 } wlc_extlog_req_t;
5581 
5582 typedef struct wlc_extlog_results {
5583 	uint16 version;
5584 	uint16 record_len;
5585 	uint32 num;
5586 	log_record_t logs[1];
5587 } wlc_extlog_results_t;
5588 
5589 typedef struct log_idstr {
5590 	uint16	id;
5591 	uint16	flag;
5592 	uint8	arg_type;
5593 	const char	*fmt_str;
5594 } log_idstr_t;
5595 
5596 #define FMTSTRF_USER		1
5597 
5598 /* flat ID definitions
5599  * New definitions HAVE TO BE ADDED at the end of the table. Otherwise, it will
5600  * affect backward compatibility with pre-existing apps
5601  */
5602 typedef enum {
5603 	FMTSTR_DRIVER_UP_ID = 0,
5604 	FMTSTR_DRIVER_DOWN_ID = 1,
5605 	FMTSTR_SUSPEND_MAC_FAIL_ID = 2,
5606 	FMTSTR_NO_PROGRESS_ID = 3,
5607 	FMTSTR_RFDISABLE_ID = 4,
5608 	FMTSTR_REG_PRINT_ID = 5,
5609 	FMTSTR_EXPTIME_ID = 6,
5610 	FMTSTR_JOIN_START_ID = 7,
5611 	FMTSTR_JOIN_COMPLETE_ID = 8,
5612 	FMTSTR_NO_NETWORKS_ID = 9,
5613 	FMTSTR_SECURITY_MISMATCH_ID = 10,
5614 	FMTSTR_RATE_MISMATCH_ID = 11,
5615 	FMTSTR_AP_PRUNED_ID = 12,
5616 	FMTSTR_KEY_INSERTED_ID = 13,
5617 	FMTSTR_DEAUTH_ID = 14,
5618 	FMTSTR_DISASSOC_ID = 15,
5619 	FMTSTR_LINK_UP_ID = 16,
5620 	FMTSTR_LINK_DOWN_ID = 17,
5621 	FMTSTR_RADIO_HW_OFF_ID = 18,
5622 	FMTSTR_RADIO_HW_ON_ID = 19,
5623 	FMTSTR_EVENT_DESC_ID = 20,
5624 	FMTSTR_PNP_SET_POWER_ID = 21,
5625 	FMTSTR_RADIO_SW_OFF_ID = 22,
5626 	FMTSTR_RADIO_SW_ON_ID = 23,
5627 	FMTSTR_PWD_MISMATCH_ID = 24,
5628 	FMTSTR_FATAL_ERROR_ID = 25,
5629 	FMTSTR_AUTH_FAIL_ID = 26,
5630 	FMTSTR_ASSOC_FAIL_ID = 27,
5631 	FMTSTR_IBSS_FAIL_ID = 28,
5632 	FMTSTR_EXTAP_FAIL_ID = 29,
5633 	FMTSTR_MAX_ID
5634 } log_fmtstr_id_t;
5635 
5636 /** 11k Neighbor Report element (unversioned, deprecated) */
5637 typedef struct nbr_element {
5638 	uint8 id;
5639 	uint8 len;
5640 	struct ether_addr bssid;
5641 	uint32 bssid_info;
5642 	uint8 reg;
5643 	uint8 channel;
5644 	uint8 phytype;
5645 	uint8 pad;
5646 } nbr_element_t;
5647 
5648 #define WL_RRM_NBR_RPT_VER		1
5649 /** 11k Neighbor Report element */
5650 typedef struct nbr_rpt_elem {
5651 	uint8 version;
5652 	uint8 id;
5653 	uint8 len;
5654 	uint8 pad;
5655 	struct ether_addr bssid;
5656 	uint8 pad_1[2];
5657 	uint32 bssid_info;
5658 	uint8 reg;
5659 	uint8 channel;
5660 	uint8 phytype;
5661 	uint8 pad_2;
5662 	wlc_ssid_t ssid;
5663 	chanspec_t chanspec;
5664 	uint8 bss_trans_preference;
5665 	uint8 flags;
5666 } nbr_rpt_elem_t;
5667 
5668 typedef enum event_msgs_ext_command {
5669 	EVENTMSGS_NONE		=	0,
5670 	EVENTMSGS_SET_BIT	=	1,
5671 	EVENTMSGS_RESET_BIT	=	2,
5672 	EVENTMSGS_SET_MASK	=	3
5673 } event_msgs_ext_command_t;
5674 
5675 #define EVENTMSGS_VER 1
5676 #define EVENTMSGS_EXT_STRUCT_SIZE	OFFSETOF(eventmsgs_ext_t, mask[0])
5677 
5678 /* len-	for SET it would be mask size from the application to the firmware */
5679 /*		for GET it would be actual firmware mask size */
5680 /* maxgetsize -	is only used for GET. indicate max mask size that the */
5681 /*				application can read from the firmware */
5682 typedef struct eventmsgs_ext
5683 {
5684 	uint8	ver;
5685 	uint8	command;
5686 	uint8	len;
5687 	uint8	maxgetsize;
5688 	uint8	mask[1];
5689 } eventmsgs_ext_t;
5690 
5691 #include <packed_section_start.h>
5692 typedef BWL_PRE_PACKED_STRUCT struct pcie_bus_tput_params {
5693 	/** no of host dma descriptors programmed by the firmware before a commit */
5694 	uint16		max_dma_descriptors;
5695 
5696 	uint16		host_buf_len; /**< length of host buffer */
5697 	dmaaddr_t	host_buf_addr; /**< physical address for bus_throughput_buf */
5698 } BWL_POST_PACKED_STRUCT pcie_bus_tput_params_t;
5699 #include <packed_section_end.h>
5700 
5701 typedef struct pcie_bus_tput_stats {
5702 	uint16		time_taken; /**< no of secs the test is run */
5703 	uint16		nbytes_per_descriptor; /**< no of bytes of data dma ed per descriptor */
5704 
5705 	/** no of desciptors for which dma is sucessfully completed within the test time */
5706 	uint32		count;
5707 } pcie_bus_tput_stats_t;
5708 
5709 typedef struct keepalives_max_idle {
5710 	uint16  keepalive_count;        /**< nmbr of keepalives per bss_max_idle period */
5711 	uint8   mkeepalive_index;       /**< mkeepalive_index for keepalive frame to be used */
5712 	uint8   PAD;			/**< to align next field */
5713 	uint16  max_interval;           /**< seconds */
5714 } keepalives_max_idle_t;
5715 
5716 #define PM_IGNORE_BCMC_PROXY_ARP (1 << 0)
5717 #define PM_IGNORE_BCMC_ALL_DMS_ACCEPTED (1 << 1)
5718 
5719 /* ##### Power Stats section ##### */
5720 
5721 #define WL_PWRSTATS_VERSION	2
5722 
5723 /** Input structure for pwrstats IOVAR */
5724 typedef struct wl_pwrstats_query {
5725 	uint16 length;		/**< Number of entries in type array. */
5726 	uint16 type[1];		/**< Types (tags) to retrieve.
5727 				 * Length 0 (no types) means get all.
5728 				 */
5729 } wl_pwrstats_query_t;
5730 
5731 /** This structure is for version 2; version 1 will be deprecated in by FW */
5732 #include <packed_section_start.h>
5733 typedef BWL_PRE_PACKED_STRUCT struct wl_pwrstats {
5734 	uint16 version;		      /**< Version = 2 is TLV format */
5735 	uint16 length;		      /**< Length of entire structure */
5736 	uint8 data[1];		      /**< TLV data, a series of structures,
5737 				       * each starting with type and length.
5738 				       *
5739 				       * Padded as necessary so each section
5740 				       * starts on a 4-byte boundary.
5741 				       *
5742 				       * Both type and len are uint16, but the
5743 				       * upper nibble of length is reserved so
5744 				       * valid len values are 0-4095.
5745 				       */
5746 } BWL_POST_PACKED_STRUCT wl_pwrstats_t;
5747 #include <packed_section_end.h>
5748 #define WL_PWR_STATS_HDRLEN	OFFSETOF(wl_pwrstats_t, data)
5749 
5750 /* Bits for wake reasons */
5751 #define WLC_PMD_WAKE_SET		0x1
5752 #define WLC_PMD_PM_AWAKE_BCN		0x2
5753 /* BIT:3 is no longer being used */
5754 #define WLC_PMD_SCAN_IN_PROGRESS	0x8
5755 #define WLC_PMD_RM_IN_PROGRESS		0x10
5756 #define WLC_PMD_AS_IN_PROGRESS		0x20
5757 #define WLC_PMD_PM_PEND			0x40
5758 #define WLC_PMD_PS_POLL			0x80
5759 #define WLC_PMD_CHK_UNALIGN_TBTT	0x100
5760 #define WLC_PMD_APSD_STA_UP		0x200
5761 #define WLC_PMD_TX_PEND_WAR		0x400   /* obsolete, can be reused */
5762 #define WLC_PMD_GPTIMER_STAY_AWAKE	0x800
5763 #define WLC_PMD_PM2_RADIO_SOFF_PEND	0x2000
5764 #define WLC_PMD_NON_PRIM_STA_UP		0x4000
5765 #define WLC_PMD_AP_UP			0x8000
5766 
5767 typedef struct wlc_pm_debug {
5768 	uint32 timestamp;	     /**< timestamp in millisecond */
5769 	uint32 reason;		     /**< reason(s) for staying awake */
5770 } wlc_pm_debug_t;
5771 
5772 /** WL_PWRSTATS_TYPE_PM_AWAKE1 structures (for 6.25 firmware) */
5773 #define WLC_STA_AWAKE_STATES_MAX_V1	30
5774 #define WLC_PMD_EVENT_MAX_V1		32
5775 /** Data sent as part of pwrstats IOVAR (and EXCESS_PM_WAKE event) */
5776 #include <packed_section_start.h>
5777 typedef BWL_PRE_PACKED_STRUCT struct pm_awake_data_v1 {
5778 	uint32 curr_time;	/**< ms */
5779 	uint32 hw_macc;		/**< HW maccontrol */
5780 	uint32 sw_macc;		/**< SW maccontrol */
5781 	uint32 pm_dur;		/**< Total sleep time in PM, msecs */
5782 	uint32 mpc_dur;		/**< Total sleep time in MPC, msecs */
5783 
5784 	/* int32 drifts = remote - local; +ve drift => local-clk slow */
5785 	int32 last_drift;	/**< Most recent TSF drift from beacon */
5786 	int32 min_drift;	/**< Min TSF drift from beacon in magnitude */
5787 	int32 max_drift;	/**< Max TSF drift from beacon in magnitude */
5788 
5789 	uint32 avg_drift;	/**< Avg TSF drift from beacon */
5790 
5791 	/* Wake history tracking */
5792 	uint8  pmwake_idx;				   /**< for stepping through pm_state */
5793 	wlc_pm_debug_t pm_state[WLC_STA_AWAKE_STATES_MAX_V1]; /**< timestamped wake bits */
5794 	uint32 pmd_event_wake_dur[WLC_PMD_EVENT_MAX_V1];   /**< cumulative usecs per wake reason */
5795 	uint32 drift_cnt;	/**< Count of drift readings over which avg_drift was computed */
5796 } BWL_POST_PACKED_STRUCT pm_awake_data_v1_t;
5797 #include <packed_section_end.h>
5798 
5799 #include <packed_section_start.h>
5800 typedef BWL_PRE_PACKED_STRUCT struct wl_pwr_pm_awake_stats_v1 {
5801 	uint16 type;	     /**< WL_PWRSTATS_TYPE_PM_AWAKE */
5802 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
5803 
5804 	pm_awake_data_v1_t awake_data;
5805 	uint32 frts_time;	/**< Cumulative ms spent in frts since driver load */
5806 	uint32 frts_end_cnt;	/**< No of times frts ended since driver load */
5807 } BWL_POST_PACKED_STRUCT wl_pwr_pm_awake_stats_v1_t;
5808 #include <packed_section_end.h>
5809 
5810 /** WL_PWRSTATS_TYPE_PM_AWAKE2 structures. Data sent as part of pwrstats IOVAR */
5811 typedef struct pm_awake_data_v2 {
5812 	uint32 curr_time;	/**< ms */
5813 	uint32 hw_macc;		/**< HW maccontrol */
5814 	uint32 sw_macc;		/**< SW maccontrol */
5815 	uint32 pm_dur;		/**< Total sleep time in PM, msecs */
5816 	uint32 mpc_dur;		/**< Total sleep time in MPC, msecs */
5817 
5818 	/* int32 drifts = remote - local; +ve drift => local-clk slow */
5819 	int32 last_drift;	/**< Most recent TSF drift from beacon */
5820 	int32 min_drift;	/**< Min TSF drift from beacon in magnitude */
5821 	int32 max_drift;	/**< Max TSF drift from beacon in magnitude */
5822 
5823 	uint32 avg_drift;	/**< Avg TSF drift from beacon */
5824 
5825 	/* Wake history tracking */
5826 
5827 	/* pmstate array (type wlc_pm_debug_t) start offset */
5828 	uint16 pm_state_offset;
5829 	/** pmstate number of array entries */
5830 	uint16 pm_state_len;
5831 
5832 	/** array (type uint32) start offset */
5833 	uint16 pmd_event_wake_dur_offset;
5834 	/** pmd_event_wake_dur number of array entries */
5835 	uint16 pmd_event_wake_dur_len;
5836 
5837 	uint32 drift_cnt;	/**< Count of drift readings over which avg_drift was computed */
5838 	uint8  pmwake_idx;	/**< for stepping through pm_state */
5839 	uint8  flags;		/**< bit0: 1-sleep, 0- wake. bit1: 0-bit0 invlid, 1-bit0 valid */
5840 	uint8  pad[2];
5841 	uint32 frts_time;	/**< Cumulative ms spent in frts since driver load */
5842 	uint32 frts_end_cnt;	/**< No of times frts ended since driver load */
5843 } pm_awake_data_v2_t;
5844 
5845 typedef struct wl_pwr_pm_awake_stats_v2 {
5846 	uint16 type;	     /**< WL_PWRSTATS_TYPE_PM_AWAKE */
5847 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
5848 
5849 	pm_awake_data_v2_t awake_data;
5850 } wl_pwr_pm_awake_stats_v2_t;
5851 
5852 /* bit0: 1-sleep, 0- wake. bit1: 0-bit0 invlid, 1-bit0 valid */
5853 #define WL_PWR_PM_AWAKE_STATS_WAKE      0x02
5854 #define WL_PWR_PM_AWAKE_STATS_ASLEEP    0x03
5855 #define WL_PWR_PM_AWAKE_STATS_WAKE_MASK 0x03
5856 
5857 /* WL_PWRSTATS_TYPE_PM_AWAKE Version 2 structures taken from 4324/43342 */
5858 /* These structures are only to be used with 4324/43342 devices */
5859 
5860 #define WL_STA_AWAKE_STATES_MAX_V2	30
5861 #define WL_PMD_EVENT_MAX_V2		32
5862 #define MAX_P2P_BSS_DTIM_PRD		4
5863 
5864 #include <packed_section_start.h>
5865 typedef BWL_PRE_PACKED_STRUCT struct ucode_dbg_v2 {
5866 	uint32 macctrl;
5867 	uint16 m_p2p_hps;
5868 	uint16 m_p2p_bss_dtim_prd[MAX_P2P_BSS_DTIM_PRD];
5869 	uint32 psmdebug[20];
5870 	uint32 phydebug[20];
5871 	uint32 psm_brc;
5872 	uint32 ifsstat;
5873 } BWL_POST_PACKED_STRUCT ucode_dbg_v2_t;
5874 #include <packed_section_end.h>
5875 
5876 #include <packed_section_start.h>
5877 typedef BWL_PRE_PACKED_STRUCT struct pmalert_awake_data_v2 {
5878 	uint32 curr_time;	/* ms */
5879 	uint32 hw_macc;		/* HW maccontrol */
5880 	uint32 sw_macc;		/* SW maccontrol */
5881 	uint32 pm_dur;		/* Total sleep time in PM, msecs */
5882 	uint32 mpc_dur;		/* Total sleep time in MPC, msecs */
5883 
5884 	/* int32 drifts = remote - local; +ve drift => local-clk slow */
5885 	int32 last_drift;	/* Most recent TSF drift from beacon */
5886 	int32 min_drift;	/* Min TSF drift from beacon in magnitude */
5887 	int32 max_drift;	/* Max TSF drift from beacon in magnitude */
5888 
5889 	uint32 avg_drift;	/* Avg TSF drift from beacon */
5890 
5891 	/* Wake history tracking */
5892 	uint8  pmwake_idx;				   /* for stepping through pm_state */
5893 	wlc_pm_debug_t pm_state[WL_STA_AWAKE_STATES_MAX_V2]; /* timestamped wake bits */
5894 	uint32 pmd_event_wake_dur[WL_PMD_EVENT_MAX_V2];      /* cumulative usecs per wake reason */
5895 	uint32 drift_cnt;	/* Count of drift readings over which avg_drift was computed */
5896 	uint32	start_event_dur[WL_PMD_EVENT_MAX_V2]; /* start event-duration */
5897 	ucode_dbg_v2_t ud;
5898 	uint32 frts_time;	/* Cumulative ms spent in frts since driver load */
5899 	uint32 frts_end_cnt;	/* No of times frts ended since driver load */
5900 } BWL_POST_PACKED_STRUCT pmalert_awake_data_v2_t;
5901 #include <packed_section_end.h>
5902 
5903 #include <packed_section_start.h>
5904 typedef BWL_PRE_PACKED_STRUCT struct pm_alert_data_v2 {
5905 	uint32 version;
5906 	uint32 length; /* Length of entire structure */
5907 	uint32 reasons; /* reason(s) for pm_alert */
5908 	/* Following fields are present only for reasons
5909 	 * PM_DUR_EXCEEDED, MPC_DUR_EXCEEDED & CONST_AWAKE_DUR_EXCEEDED
5910 	 */
5911 	uint32 prev_stats_time;	/* msecs */
5912 	uint32 prev_pm_dur;	/* msecs */
5913 	uint32 prev_mpc_dur;	/* msecs */
5914 	pmalert_awake_data_v2_t awake_data;
5915 } BWL_POST_PACKED_STRUCT pm_alert_data_v2_t;
5916 #include <packed_section_end.h>
5917 
5918 #include <packed_section_start.h>
5919 typedef BWL_PRE_PACKED_STRUCT struct wl_pwr_pm_awake_status_v2 {
5920 	uint16 type;	     /* WL_PWRSTATS_TYPE_PM_AWAKE */
5921 	uint16 len;	     /* Up to 4K-1, top 4 bits are reserved */
5922 
5923 	pmalert_awake_data_v2_t awake_data;
5924 	uint32 frts_time;	/* Cumulative ms spent in frts since driver load */
5925 	uint32 frts_end_cnt;	/* No of times frts ended since driver load */
5926 } BWL_POST_PACKED_STRUCT wl_pwr_pm_awake_status_v2_t;
5927 #include <packed_section_end.h>
5928 
5929 /* Below are latest definitions from PHO25178RC100_BRANCH_6_50 */
5930 /* wl_pwr_pm_awake_stats_v1_t is used for WL_PWRSTATS_TYPE_PM_AWAKE */
5931 /* (at least) the chip independent registers */
5932 typedef struct ucode_dbg_ext {
5933 	uint32 x120;
5934 	uint32 x124;
5935 	uint32 x154;
5936 	uint32 x158;
5937 	uint32 x15c;
5938 	uint32 x180;
5939 	uint32 x184;
5940 	uint32 x188;
5941 	uint32 x18c;
5942 	uint32 x1a0;
5943 	uint32 x1a8;
5944 	uint32 x1e0;
5945 	uint32 scr_x14;
5946 	uint32 scr_x2b;
5947 	uint32 scr_x2c;
5948 	uint32 scr_x2d;
5949 	uint32 scr_x2e;
5950 
5951 	uint16 x40a;
5952 	uint16 x480;
5953 	uint16 x490;
5954 	uint16 x492;
5955 	uint16 x4d8;
5956 	uint16 x4b8;
5957 	uint16 x4ba;
5958 	uint16 x4bc;
5959 	uint16 x4be;
5960 	uint16 x500;
5961 	uint16 x50e;
5962 	uint16 x522;
5963 	uint16 x546;
5964 	uint16 x578;
5965 	uint16 x602;
5966 	uint16 x646;
5967 	uint16 x648;
5968 	uint16 x666;
5969 	uint16 x670;
5970 	uint16 x690;
5971 	uint16 x692;
5972 	uint16 x6a0;
5973 	uint16 x6a2;
5974 	uint16 x6a4;
5975 	uint16 x6b2;
5976 	uint16 x7c0;
5977 
5978 	uint16 shm_x20;
5979 	uint16 shm_x4a;
5980 	uint16 shm_x5e;
5981 	uint16 shm_x5f;
5982 	uint16 shm_xaab;
5983 	uint16 shm_x74a;
5984 	uint16 shm_x74b;
5985 	uint16 shm_x74c;
5986 	uint16 shm_x74e;
5987 	uint16 shm_x756;
5988 	uint16 shm_x75b;
5989 	uint16 shm_x7b9;
5990 	uint16 shm_x7d4;
5991 
5992 	uint16 shm_P2P_HPS;
5993 	uint16 shm_P2P_intr[16];
5994 	uint16 shm_P2P_perbss[48];
5995 } ucode_dbg_ext_t;
5996 
5997 #include <packed_section_start.h>
5998 typedef BWL_PRE_PACKED_STRUCT struct pm_alert_data_v1 {
5999 	uint32 version;
6000 	uint32 length; /**< Length of entire structure */
6001 	uint32 reasons; /**< reason(s) for pm_alert */
6002 	/* Following fields are present only for reasons
6003 	 * PM_DUR_EXCEEDED, MPC_DUR_EXCEEDED & CONST_AWAKE_DUR_EXCEEDED
6004 	 */
6005 	uint32 prev_stats_time;	/**< msecs */
6006 	uint32 prev_pm_dur;	/**< msecs */
6007 	uint32 prev_mpc_dur;	/**< msecs */
6008 	pm_awake_data_v1_t awake_data;
6009 	uint32	start_event_dur[WLC_PMD_EVENT_MAX_V1]; /**< start event-duration */
6010 	ucode_dbg_v2_t ud;
6011 	uint32 frts_time;	/**< Cumulative ms spent in frts since driver load */
6012 	uint32 frts_end_cnt;	/**< No of times frts ended since driver load */
6013 	ucode_dbg_ext_t ud_ext;
6014 	uint32 prev_frts_dur; /**< ms */
6015 } BWL_POST_PACKED_STRUCT pm_alert_data_v1_t;
6016 #include <packed_section_end.h>
6017 
6018 /* End of 43342/4324 v2 structure definitions */
6019 
6020 /* Original bus structure is for HSIC */
6021 
6022 typedef struct bus_metrics {
6023 	uint32 suspend_ct;	/**< suspend count */
6024 	uint32 resume_ct;	/**< resume count */
6025 	uint32 disconnect_ct;	/**< disconnect count */
6026 	uint32 reconnect_ct;	/**< reconnect count */
6027 	uint32 active_dur;	/**< msecs in bus, usecs for user */
6028 	uint32 suspend_dur;	/**< msecs in bus, usecs for user */
6029 	uint32 disconnect_dur;	/**< msecs in bus, usecs for user */
6030 } bus_metrics_t;
6031 
6032 /** Bus interface info for USB/HSIC */
6033 #include <packed_section_start.h>
6034 typedef BWL_PRE_PACKED_STRUCT struct wl_pwr_usb_hsic_stats {
6035 	uint16 type;	     /**< WL_PWRSTATS_TYPE_USB_HSIC */
6036 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
6037 
6038 	bus_metrics_t hsic;	/**< stats from hsic bus driver */
6039 } BWL_POST_PACKED_STRUCT wl_pwr_usb_hsic_stats_t;
6040 #include <packed_section_end.h>
6041 
6042 typedef struct pcie_bus_metrics {
6043 	uint32 d3_suspend_ct;	/**< suspend count */
6044 	uint32 d0_resume_ct;	/**< resume count */
6045 	uint32 perst_assrt_ct;	/**< PERST# assert count */
6046 	uint32 perst_deassrt_ct;	/**< PERST# de-assert count */
6047 	uint32 active_dur;	/**< msecs */
6048 	uint32 d3_suspend_dur;	/**< msecs */
6049 	uint32 perst_dur;	/**< msecs */
6050 	uint32 l0_cnt;		/**< L0 entry count */
6051 	uint32 l0_usecs;	/**< L0 duration in usecs */
6052 	uint32 l1_cnt;		/**< L1 entry count */
6053 	uint32 l1_usecs;	/**< L1 duration in usecs */
6054 	uint32 l1_1_cnt;	/**< L1_1ss entry count */
6055 	uint32 l1_1_usecs;	/**< L1_1ss duration in usecs */
6056 	uint32 l1_2_cnt;	/**< L1_2ss entry count */
6057 	uint32 l1_2_usecs;	/**< L1_2ss duration in usecs */
6058 	uint32 l2_cnt;		/**< L2 entry count */
6059 	uint32 l2_usecs;	/**< L2 duration in usecs */
6060 	uint32 timestamp;	/**< Timestamp on when stats are collected */
6061 	uint32 num_h2d_doorbell;	/**< # of doorbell interrupts - h2d */
6062 	uint32 num_d2h_doorbell;	/**< # of doorbell interrupts - d2h */
6063 	uint32 num_submissions; /**< # of submissions */
6064 	uint32 num_completions; /**< # of completions */
6065 	uint32 num_rxcmplt;	/**< # of rx completions */
6066 	uint32 num_rxcmplt_drbl;	/**< of drbl interrupts for rx complt. */
6067 	uint32 num_txstatus;	/**< # of tx completions */
6068 	uint32 num_txstatus_drbl;	/**< of drbl interrupts for tx complt. */
6069 	uint32 deepsleep_count; /**< # of times chip went to deepsleep */
6070 	uint32 deepsleep_dur;   /**< # of msecs chip was in deepsleep */
6071 	uint32 ltr_active_ct;	/**< # of times chip went to LTR ACTIVE */
6072 	uint32 ltr_active_dur;	/**< # of msecs chip was in LTR ACTIVE */
6073 	uint32 ltr_sleep_ct;	/**< # of times chip went to LTR SLEEP */
6074 	uint32 ltr_sleep_dur;	/**< # of msecs chip was in LTR SLEEP */
6075 } pcie_bus_metrics_t;
6076 
6077 /** Bus interface info for PCIE */
6078 typedef struct wl_pwr_pcie_stats {
6079 	uint16 type;	     /**< WL_PWRSTATS_TYPE_PCIE */
6080 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
6081 	pcie_bus_metrics_t pcie;	/**< stats from pcie bus driver */
6082 } wl_pwr_pcie_stats_t;
6083 
6084 /** Scan information history per category */
6085 typedef struct scan_data {
6086 	uint32 count;		/**< Number of scans performed */
6087 	uint32 dur;		/**< Total time (in us) used */
6088 } scan_data_t;
6089 
6090 typedef struct wl_pwr_scan_stats {
6091 	uint16 type;	     /**< WL_PWRSTATS_TYPE_SCAN */
6092 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
6093 
6094 	/* Scan history */
6095 	scan_data_t user_scans;	  /**< User-requested scans: (i/e/p)scan */
6096 	scan_data_t assoc_scans;  /**< Scans initiated by association requests */
6097 	scan_data_t roam_scans;	  /**< Scans initiated by the roam engine */
6098 	scan_data_t pno_scans[8]; /**< For future PNO bucketing (BSSID, SSID, etc) */
6099 	scan_data_t other_scans;  /**< Scan engine usage not assigned to the above */
6100 } wl_pwr_scan_stats_t;
6101 
6102 typedef struct wl_pwr_connect_stats {
6103 	uint16 type;	     /**< WL_PWRSTATS_TYPE_SCAN */
6104 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
6105 
6106 	/* Connection (Association + Key exchange) data */
6107 	uint32 count;	/**< Number of connections performed */
6108 	uint32 dur;		/**< Total time (in ms) used */
6109 } wl_pwr_connect_stats_t;
6110 
6111 typedef struct wl_pwr_phy_stats {
6112 	uint16 type;	    /**< WL_PWRSTATS_TYPE_PHY */
6113 	uint16 len;	    /**< Up to 4K-1, top 4 bits are reserved */
6114 	uint32 tx_dur;	    /**< TX Active duration in us */
6115 	uint32 rx_dur;	    /**< RX Active duration in us */
6116 } wl_pwr_phy_stats_t;
6117 
6118 
6119 typedef struct wl_mimo_meas_metrics_v1 {
6120 	uint16 type;
6121 	uint16 len;
6122 	/* Total time(us) idle in MIMO RX chain configuration */
6123 	uint32 total_idle_time_mimo;
6124 	/* Total time(us) idle in SISO  RX chain configuration */
6125 	uint32 total_idle_time_siso;
6126 	/* Total receive time (us) in SISO RX chain configuration */
6127 	uint32 total_rx_time_siso;
6128 	/* Total receive time (us) in MIMO RX chain configuration */
6129 	uint32 total_rx_time_mimo;
6130 	/* Total 1-chain transmit time(us) */
6131 	uint32 total_tx_time_1chain;
6132 	/* Total 2-chain transmit time(us) */
6133 	uint32 total_tx_time_2chain;
6134 	/* Total 3-chain transmit time(us) */
6135 	uint32 total_tx_time_3chain;
6136 } wl_mimo_meas_metrics_v1_t;
6137 
6138 typedef struct wl_mimo_meas_metrics {
6139 	uint16 type;
6140 	uint16 len;
6141 	/* Total time(us) idle in MIMO RX chain configuration */
6142 	uint32 total_idle_time_mimo;
6143 	/* Total time(us) idle in SISO  RX chain configuration */
6144 	uint32 total_idle_time_siso;
6145 	/* Total receive time (us) in SISO RX chain configuration */
6146 	uint32 total_rx_time_siso;
6147 	/* Total receive time (us) in MIMO RX chain configuration */
6148 	uint32 total_rx_time_mimo;
6149 	/* Total 1-chain transmit time(us) */
6150 	uint32 total_tx_time_1chain;
6151 	/* Total 2-chain transmit time(us) */
6152 	uint32 total_tx_time_2chain;
6153 	/* Total 3-chain transmit time(us) */
6154 	uint32 total_tx_time_3chain;
6155 	/* End of original, OCL fields start here */
6156 	/* Total time(us) idle in ocl mode */
6157 	uint32 total_idle_time_ocl;
6158 	/* Total receive time (us) in ocl mode */
6159 	uint32 total_rx_time_ocl;
6160 	/* End of OCL fields, internal adjustment fields here */
6161 	/* Total SIFS idle time in MIMO mode */
6162 	uint32 total_sifs_time_mimo;
6163 	/* Total SIFS idle time in SISO mode */
6164 	uint32 total_sifs_time_siso;
6165 } wl_mimo_meas_metrics_t;
6166 /* ##### End of Power Stats section ##### */
6167 
6168 /** IPV4 Arp offloads for ndis context */
6169 #include <packed_section_start.h>
6170 BWL_PRE_PACKED_STRUCT struct hostip_id {
6171 	struct ipv4_addr ipa;
6172 	uint8 id;
6173 } BWL_POST_PACKED_STRUCT;
6174 #include <packed_section_end.h>
6175 
6176 /* Return values */
6177 #define ND_REPLY_PEER		0x1	/**< Reply was sent to service NS request from peer */
6178 #define ND_REQ_SINK		0x2	/**< Input packet should be discarded */
6179 #define ND_FORCE_FORWARD	0X3	/**< For the dongle to forward req to HOST */
6180 
6181 /** Neighbor Solicitation Response Offload IOVAR param */
6182 #include <packed_section_start.h>
6183 typedef BWL_PRE_PACKED_STRUCT struct nd_param {
6184 	struct ipv6_addr	host_ip[2];
6185 	struct ipv6_addr	solicit_ip;
6186 	struct ipv6_addr	remote_ip;
6187 	uint8	host_mac[ETHER_ADDR_LEN];
6188 	uint32	offload_id;
6189 } BWL_POST_PACKED_STRUCT nd_param_t;
6190 #include <packed_section_end.h>
6191 
6192 typedef struct wl_pfn_roam_thresh {
6193 	uint32 pfn_alert_thresh; /**< time in ms */
6194 	uint32 roam_alert_thresh; /**< time in ms */
6195 } wl_pfn_roam_thresh_t;
6196 
6197 
6198 /* Reasons for wl_pmalert_t */
6199 #define PM_DUR_EXCEEDED			(1<<0)
6200 #define MPC_DUR_EXCEEDED		(1<<1)
6201 #define ROAM_ALERT_THRESH_EXCEEDED	(1<<2)
6202 #define PFN_ALERT_THRESH_EXCEEDED	(1<<3)
6203 #define CONST_AWAKE_DUR_ALERT		(1<<4)
6204 #define CONST_AWAKE_DUR_RECOVERY	(1<<5)
6205 
6206 #define MIN_PM_ALERT_LEN 9
6207 
6208 /** Data sent in EXCESS_PM_WAKE event */
6209 #define WL_PM_ALERT_VERSION 3
6210 
6211 /** This structure is for version 3; version 2 will be deprecated in by FW */
6212 #include <packed_section_start.h>
6213 typedef BWL_PRE_PACKED_STRUCT struct wl_pmalert {
6214 	uint16 version;		/**< Version = 3 is TLV format */
6215 	uint16 length;		/**< Length of entire structure */
6216 	uint32 reasons;		/**< reason(s) for pm_alert */
6217 	uint8 data[1];		/**< TLV data, a series of structures,
6218 				 * each starting with type and length.
6219 				 *
6220 				 * Padded as necessary so each section
6221 				 * starts on a 4-byte boundary.
6222 				 *
6223 				 * Both type and len are uint16, but the
6224 				 * upper nibble of length is reserved so
6225 				 * valid len values are 0-4095.
6226 				*/
6227 } BWL_POST_PACKED_STRUCT wl_pmalert_t;
6228 #include <packed_section_end.h>
6229 
6230 /* Type values for the data section */
6231 #define WL_PMALERT_FIXED	0	/**< struct wl_pmalert_fixed_t, fixed fields */
6232 #define WL_PMALERT_PMSTATE	1	/**< struct wl_pmalert_pmstate_t, variable */
6233 #define WL_PMALERT_EVENT_DUR	2	/**< struct wl_pmalert_event_dur_t, variable */
6234 #define WL_PMALERT_UCODE_DBG	3	/**< struct wl_pmalert_ucode_dbg_v1, variable */
6235 #define WL_PMALERT_PS_ALLOWED_HIST	4 /**< struct wl_pmalert_ps_allowed_history, variable */
6236 #define WL_PMALERT_EXT_UCODE_DBG	5 /**< struct wl_pmalert_ext_ucode_dbg_t, variable */
6237 #define WL_PMALERT_EPM_START_EVENT_DUR	6 /**< struct wl_pmalert_event_dur_t, variable */
6238 #define WL_PMALERT_UCODE_DBG_V2		7 /**< struct wl_pmalert_ucode_dbg_v2, variable */
6239 
6240 typedef struct wl_pmalert_fixed {
6241 	uint16 type;		/**< WL_PMALERT_FIXED */
6242 	uint16 len;		/**< Up to 4K-1, top 4 bits are reserved */
6243 	uint32 prev_stats_time;	/**< msecs */
6244 	uint32 curr_time;	/**< ms */
6245 	uint32 prev_pm_dur;	/**< msecs */
6246 	uint32 pm_dur;		/**< Total sleep time in PM, msecs */
6247 	uint32 prev_mpc_dur;	/**< msecs */
6248 	uint32 mpc_dur;		/**< Total sleep time in MPC, msecs */
6249 	uint32 hw_macc;		/**< HW maccontrol */
6250 	uint32 sw_macc;		/**< SW maccontrol */
6251 
6252 	/* int32 drifts = remote - local; +ve drift -> local-clk slow */
6253 	int32 last_drift;	/**< Most recent TSF drift from beacon */
6254 	int32 min_drift;	/**< Min TSF drift from beacon in magnitude */
6255 	int32 max_drift;	/**< Max TSF drift from beacon in magnitude */
6256 
6257 	uint32 avg_drift;	/**< Avg TSF drift from beacon */
6258 	uint32 drift_cnt;	/**< Count of drift readings over which avg_drift was computed */
6259 	uint32 frts_time;	/**< Cumulative ms spent in data frts since driver load */
6260 	uint32 frts_end_cnt;	/**< No of times frts ended since driver load */
6261 	uint32 prev_frts_dur;	/**< Data frts duration at start of pm-period */
6262 	uint32 cal_dur;		/**< Cumulative ms spent in calibration */
6263 	uint32 prev_cal_dur;	/**< cal duration at start of pm-period */
6264 } wl_pmalert_fixed_t;
6265 
6266 typedef struct wl_pmalert_pmstate {
6267 	uint16 type;	     /**< WL_PMALERT_PMSTATE */
6268 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
6269 
6270 	uint8 pmwake_idx;   /**< for stepping through pm_state */
6271 	uint8 pad[3];
6272 	/* Array of pmstate; len of array is based on tlv len */
6273 	wlc_pm_debug_t pmstate[1];
6274 } wl_pmalert_pmstate_t;
6275 
6276 typedef struct wl_pmalert_event_dur {
6277 	uint16 type;	     /**< WL_PMALERT_EVENT_DUR */
6278 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
6279 
6280 	/* Array of event_dur, len of array is based on tlv len */
6281 	uint32 event_dur[1];
6282 } wl_pmalert_event_dur_t;
6283 
6284 #include <packed_section_start.h>
6285 BWL_PRE_PACKED_STRUCT struct wl_pmalert_ucode_dbg_v1 {
6286 	uint16 type;         /* WL_PMALERT_UCODE_DBG */
6287 	uint16 len;      /* Up to 4K-1, top 4 bits are reserved */
6288 	uint32 macctrl;
6289 	uint16 m_p2p_hps;
6290 	uint32 psm_brc;
6291 	uint32 ifsstat;
6292 	uint16 m_p2p_bss_dtim_prd[MAX_P2P_BSS_DTIM_PRD];
6293 	uint32 psmdebug[20];
6294 	uint32 phydebug[20];
6295 	uint16 M_P2P_BSS[3][12];
6296 	uint16 M_P2P_PRE_TBTT[3];
6297 
6298 	/* Following is valid only for corerevs<40 */
6299 	uint16 xmtfifordy;
6300 
6301 	/* Following 3 are valid only for 11ac corerevs (>=40) */
6302 	uint16 psm_maccommand;
6303 	uint16 txe_status1;
6304 	uint16 AQMFifoReady;
6305 } BWL_POST_PACKED_STRUCT;
6306 #include <packed_section_end.h>
6307 
6308 #include <packed_section_start.h>
6309 BWL_PRE_PACKED_STRUCT struct wl_pmalert_ucode_dbg_v2 {
6310 	uint16 type;	     /**< WL_PMALERT_UCODE_DBG_V2 */
6311 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
6312 	uint32 macctrl;
6313 	uint16 m_p2p_hps;
6314 	uint32 psm_brc;
6315 	uint32 ifsstat;
6316 	uint16 m_p2p_bss_dtim_prd[MAX_P2P_BSS_DTIM_PRD];
6317 	uint32 psmdebug[20];
6318 	uint32 phydebug[20];
6319 	uint16 M_P2P_BSS[3][12];
6320 	uint16 M_P2P_PRE_TBTT[3];
6321 
6322 	/* Following is valid only for corerevs<40 */
6323 	uint16 xmtfifordy;
6324 
6325 	/* Following 3 are valid only for 11ac corerevs (>=40) */
6326 	uint16 psm_maccommand;
6327 	uint16 txe_status1;
6328 	uint32 AQMFifoReady;
6329 } BWL_POST_PACKED_STRUCT;
6330 #include <packed_section_end.h>
6331 
6332 typedef struct wlc_ps_debug {
6333 	uint32 timestamp;	     /**< timestamp in millisecond */
6334 	uint32 ps_mask;		     /**< reason(s) for disallowing ps */
6335 } wlc_ps_debug_t;
6336 
6337 typedef struct wl_pmalert_ps_allowed_hist {
6338 	uint16 type;	     /**< WL_PMALERT_PS_ALLOWED_HIST */
6339 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
6340 	uint32 ps_allowed_start_idx;
6341 	/* Array of ps_debug, len of array is based on tlv len */
6342 	wlc_ps_debug_t ps_debug[1];
6343 } wl_pmalert_ps_allowed_hist_t;
6344 
6345 /* Structures and constants used for "vndr_ie" IOVar interface */
6346 #define VNDR_IE_CMD_LEN		4	/**< length of the set command string:
6347 					 * "add", "del" (+ NUL)
6348 					 */
6349 
6350 #define VNDR_IE_INFO_HDR_LEN	(sizeof(uint32))
6351 
6352 #include <packed_section_start.h>
6353 typedef BWL_PRE_PACKED_STRUCT struct {
6354 	uint32 pktflag;			/**< bitmask indicating which packet(s) contain this IE */
6355 	vndr_ie_t vndr_ie_data;		/**< vendor IE data */
6356 } BWL_POST_PACKED_STRUCT vndr_ie_info_t;
6357 #include <packed_section_end.h>
6358 
6359 #include <packed_section_start.h>
6360 typedef BWL_PRE_PACKED_STRUCT struct {
6361 	int32 iecount;			/**< number of entries in the vndr_ie_list[] array */
6362 	vndr_ie_info_t vndr_ie_list[1];	/**< variable size list of vndr_ie_info_t structs */
6363 } BWL_POST_PACKED_STRUCT vndr_ie_buf_t;
6364 #include <packed_section_end.h>
6365 
6366 #include <packed_section_start.h>
6367 typedef BWL_PRE_PACKED_STRUCT struct {
6368 	char cmd[VNDR_IE_CMD_LEN];	/**< vndr_ie IOVar set command : "add", "del" + NUL */
6369 	vndr_ie_buf_t vndr_ie_buffer;	/**< buffer containing Vendor IE list information */
6370 } BWL_POST_PACKED_STRUCT vndr_ie_setbuf_t;
6371 #include <packed_section_end.h>
6372 
6373 /** tag_ID/length/value_buffer tuple */
6374 #include <packed_section_start.h>
6375 typedef BWL_PRE_PACKED_STRUCT struct {
6376 	uint8	id;
6377 	uint8	len;
6378 	uint8	data[1];
6379 } BWL_POST_PACKED_STRUCT tlv_t;
6380 #include <packed_section_end.h>
6381 
6382 #include <packed_section_start.h>
6383 typedef BWL_PRE_PACKED_STRUCT struct {
6384 	uint32 pktflag;			/**< bitmask indicating which packet(s) contain this IE */
6385 	tlv_t ie_data;		/**< IE data */
6386 } BWL_POST_PACKED_STRUCT ie_info_t;
6387 #include <packed_section_end.h>
6388 
6389 #include <packed_section_start.h>
6390 typedef BWL_PRE_PACKED_STRUCT struct {
6391 	int32 iecount;			/**< number of entries in the ie_list[] array */
6392 	ie_info_t ie_list[1];	/**< variable size list of ie_info_t structs */
6393 } BWL_POST_PACKED_STRUCT ie_buf_t;
6394 #include <packed_section_end.h>
6395 
6396 #include <packed_section_start.h>
6397 typedef BWL_PRE_PACKED_STRUCT struct {
6398 	char cmd[VNDR_IE_CMD_LEN];	/**< ie IOVar set command : "add" + NUL */
6399 	ie_buf_t ie_buffer;	/**< buffer containing IE list information */
6400 } BWL_POST_PACKED_STRUCT ie_setbuf_t;
6401 #include <packed_section_end.h>
6402 
6403 #include <packed_section_start.h>
6404 typedef BWL_PRE_PACKED_STRUCT struct {
6405 	uint32 pktflag;		/**< bitmask indicating which packet(s) contain this IE */
6406 	uint8 id;		/**< IE type */
6407 } BWL_POST_PACKED_STRUCT ie_getbuf_t;
6408 #include <packed_section_end.h>
6409 
6410 /* structures used to define format of wps ie data from probe requests */
6411 /* passed up to applications via iovar "prbreq_wpsie" */
6412 typedef struct sta_prbreq_wps_ie_hdr {
6413 	struct ether_addr staAddr;
6414 	uint16 ieLen;
6415 } sta_prbreq_wps_ie_hdr_t;
6416 
6417 #include <packed_section_start.h>
6418 typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_data {
6419 	sta_prbreq_wps_ie_hdr_t hdr;
6420 	uint8 ieData[1];
6421 } BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_data_t;
6422 #include <packed_section_end.h>
6423 
6424 #include <packed_section_start.h>
6425 typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_list {
6426 	uint32 totLen;
6427 	uint8 ieDataList[1];
6428 } BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_list_t;
6429 #include <packed_section_end.h>
6430 
6431 #include <packed_section_start.h>
6432 typedef BWL_PRE_PACKED_STRUCT struct {
6433 	uint32 flags;
6434 	chanspec_t chanspec;			/**< txpwr report for this channel */
6435 	chanspec_t local_chanspec;		/**< channel on which we are associated */
6436 	uint8 local_max;			/**< local max according to the AP */
6437 	uint8 local_constraint;			/**< local constraint according to the AP */
6438 	int8  antgain[2];			/**< Ant gain for each band - from SROM */
6439 	uint8 rf_cores;				/**< count of RF Cores being reported */
6440 	uint8 est_Pout[4];			/**< Latest tx power out estimate per RF chain */
6441 	uint8 est_Pout_act[4]; /**< Latest tx power out estimate per RF chain w/o adjustment */
6442 	uint8 est_Pout_cck;			/**< Latest CCK tx power out estimate */
6443 	uint8 tx_power_max[4];			/**< Maximum target power among all rates */
6444 	uint32 tx_power_max_rate_ind[4];  /**< Index of the rate with the max target power */
6445 	int8 sar;				/**< SAR limit for display by wl executable */
6446 	int8 channel_bandwidth;		/**< 20, 40 or 80 MHz bandwidth? */
6447 	uint8 version;				/**< Version of the data format wlu <--> driver */
6448 	uint8 display_core;			/**< Displayed curpower core */
6449 	int8 target_offsets[4];		/**< Target power offsets for current rate per core */
6450 	uint32 last_tx_ratespec;	/**< Ratespec for last transmition */
6451 	uint32 user_target;		/**< user limit */
6452 	uint32 ppr_len;		/**< length of each ppr serialization buffer */
6453 	int8 SARLIMIT[MAX_STREAMS_SUPPORTED];
6454 	uint8  pprdata[1];		/**< ppr serialization buffer */
6455 } BWL_POST_PACKED_STRUCT tx_pwr_rpt_t;
6456 #include <packed_section_end.h>
6457 
6458 #include <packed_section_start.h>
6459 typedef BWL_PRE_PACKED_STRUCT struct {
6460 	struct ipv4_addr	ipv4_addr;
6461 	struct ether_addr nexthop;
6462 } BWL_POST_PACKED_STRUCT ibss_route_entry_t;
6463 #include <packed_section_end.h>
6464 
6465 #include <packed_section_start.h>
6466 typedef BWL_PRE_PACKED_STRUCT struct {
6467 	uint32 num_entry;
6468 	ibss_route_entry_t route_entry[1];
6469 } BWL_POST_PACKED_STRUCT ibss_route_tbl_t;
6470 #include <packed_section_end.h>
6471 
6472 #define MAX_IBSS_ROUTE_TBL_ENTRY	64
6473 
6474 #define TXPWR_TARGET_VERSION  0
6475 #include <packed_section_start.h>
6476 typedef BWL_PRE_PACKED_STRUCT struct {
6477 	int32 version;		/**< version number */
6478 	chanspec_t chanspec;	/**< txpwr report for this channel */
6479 	int8 txpwr[WL_STA_ANT_MAX]; /**< Max tx target power, in qdb */
6480 	uint8 rf_cores;		/**< count of RF Cores being reported */
6481 } BWL_POST_PACKED_STRUCT txpwr_target_max_t;
6482 #include <packed_section_end.h>
6483 
6484 #define BSS_PEER_INFO_PARAM_CUR_VER	0
6485 /** Input structure for IOV_BSS_PEER_INFO */
6486 #include <packed_section_start.h>
6487 typedef BWL_PRE_PACKED_STRUCT	struct {
6488 	uint16			version;
6489 	struct	ether_addr ea;	/**< peer MAC address */
6490 } BWL_POST_PACKED_STRUCT bss_peer_info_param_t;
6491 #include <packed_section_end.h>
6492 
6493 #define BSS_PEER_INFO_CUR_VER		0
6494 
6495 #include <packed_section_start.h>
6496 typedef BWL_PRE_PACKED_STRUCT struct {
6497 	uint16			version;
6498 	struct ether_addr	ea;
6499 	int32			rssi;
6500 	uint32			tx_rate;	/**< current tx rate */
6501 	uint32			rx_rate;	/**< current rx rate */
6502 	wl_rateset_t		rateset;	/**< rateset in use */
6503 	uint32			age;		/**< age in seconds */
6504 } BWL_POST_PACKED_STRUCT bss_peer_info_t;
6505 #include <packed_section_end.h>
6506 
6507 #define BSS_PEER_LIST_INFO_CUR_VER	0
6508 
6509 #include <packed_section_start.h>
6510 typedef BWL_PRE_PACKED_STRUCT struct {
6511 	uint16			version;
6512 	uint16			bss_peer_info_len;	/**< length of bss_peer_info_t */
6513 	uint32			count;			/**< number of peer info */
6514 	bss_peer_info_t		peer_info[1];		/**< peer info */
6515 } BWL_POST_PACKED_STRUCT bss_peer_list_info_t;
6516 #include <packed_section_end.h>
6517 
6518 #define BSS_PEER_LIST_INFO_FIXED_LEN OFFSETOF(bss_peer_list_info_t, peer_info)
6519 
6520 #define AIBSS_BCN_FORCE_CONFIG_VER_0	0
6521 
6522 /** structure used to configure AIBSS beacon force xmit */
6523 #include <packed_section_start.h>
6524 typedef BWL_PRE_PACKED_STRUCT struct {
6525 	uint16  version;
6526 	uint16	len;
6527 	uint32 initial_min_bcn_dur;	/**< dur in ms to check a bcn in bcn_flood period */
6528 	uint32 min_bcn_dur;	/**< dur in ms to check a bcn after bcn_flood period */
6529 	uint32 bcn_flood_dur; /**< Initial bcn xmit period in ms */
6530 } BWL_POST_PACKED_STRUCT aibss_bcn_force_config_t;
6531 #include <packed_section_end.h>
6532 
6533 #define AIBSS_TXFAIL_CONFIG_VER_0    0
6534 #define AIBSS_TXFAIL_CONFIG_VER_1    1
6535 #define AIBSS_TXFAIL_CONFIG_CUR_VER		AIBSS_TXFAIL_CONFIG_VER_1
6536 
6537 /** structure used to configure aibss tx fail event */
6538 #include <packed_section_start.h>
6539 typedef BWL_PRE_PACKED_STRUCT struct {
6540 	uint16  version;
6541 	uint16  len;
6542 	uint32 bcn_timeout;     /**< dur in seconds to receive 1 bcn */
6543 	uint32 max_tx_retry;     /**< no of consecutive no acks to send txfail event */
6544 	uint32 max_atim_failure; /**< no of consecutive atim failure */
6545 } BWL_POST_PACKED_STRUCT aibss_txfail_config_t;
6546 #include <packed_section_end.h>
6547 
6548 #include <packed_section_start.h>
6549 typedef BWL_PRE_PACKED_STRUCT struct wl_aibss_if {
6550 	uint16 version;
6551 	uint16 len;
6552 	uint32 flags;
6553 	struct ether_addr addr;
6554 	chanspec_t chspec;
6555 } BWL_POST_PACKED_STRUCT wl_aibss_if_t;
6556 #include <packed_section_end.h>
6557 
6558 #include <packed_section_start.h>
6559 typedef BWL_PRE_PACKED_STRUCT struct wlc_ipfo_route_entry {
6560 	struct ipv4_addr ip_addr;
6561 	struct ether_addr nexthop;
6562 } BWL_POST_PACKED_STRUCT wlc_ipfo_route_entry_t;
6563 #include <packed_section_end.h>
6564 
6565 #include <packed_section_start.h>
6566 typedef BWL_PRE_PACKED_STRUCT struct wlc_ipfo_route_tbl {
6567 	uint32 num_entry;
6568 	wlc_ipfo_route_entry_t route_entry[1];
6569 } BWL_POST_PACKED_STRUCT wlc_ipfo_route_tbl_t;
6570 #include <packed_section_end.h>
6571 
6572 /* Version of wlc_btc_stats_t structure.
6573  * Increment whenever a change is made to wlc_btc_stats_t
6574  */
6575 #define BTCX_STATS_VER   2
6576 
6577 typedef struct wlc_btc_stats {
6578 	uint16 version; /* version number of struct */
6579 	uint16 valid; /* Size of this struct */
6580 	uint32 stats_update_timestamp;	/* tStamp when data is updated. */
6581 	uint32 btc_status; /* Hybrid/TDM indicator: Bit2:Hybrid, Bit1:TDM,Bit0:CoexEnabled */
6582 	uint32 bt_req_type_map; /* BT Antenna Req types since last stats sample */
6583 	uint32 bt_req_cnt; /* #BT antenna requests since last stats sampl */
6584 	uint32 bt_gnt_cnt; /* #BT antenna grants since last stats sample */
6585 	uint32 bt_gnt_dur; /* usec BT owns antenna since last stats sample */
6586 	uint16 bt_abort_cnt; /* #Times WL was preempted due to BT since WL up */
6587 	uint16 bt_rxf1ovfl_cnt; /* #Time PSNULL retry count exceeded since WL up */
6588 	uint16 bt_latency_cnt; /* #Time ucode high latency detected since WL up */
6589 	uint16 rsvd; /* pad to align struct to 32bit bndry	 */
6590 } wlc_btc_stats_t;
6591 
6592 #define WL_IPFO_ROUTE_TBL_FIXED_LEN 4
6593 #define WL_MAX_IPFO_ROUTE_TBL_ENTRY	64
6594 
6595 	/* Global ASSERT Logging */
6596 #define ASSERTLOG_CUR_VER	0x0100
6597 #define MAX_ASSRTSTR_LEN	64
6598 
6599 	typedef struct assert_record {
6600 		uint32 time;
6601 		uint8 seq_num;
6602 		int8 str[MAX_ASSRTSTR_LEN];
6603 	} assert_record_t;
6604 
6605 	typedef struct assertlog_results {
6606 		uint16 version;
6607 		uint16 record_len;
6608 		uint32 num;
6609 		assert_record_t logs[1];
6610 	} assertlog_results_t;
6611 
6612 #define LOGRRC_FIX_LEN	8
6613 #define IOBUF_ALLOWED_NUM_OF_LOGREC(type, len) ((len - LOGRRC_FIX_LEN)/sizeof(type))
6614 #ifdef BCMWAPI_WAI
6615 /* BCMWAPI_WAI */
6616 #define IV_LEN 16
6617 	struct wapi_sta_msg_t
6618 	{
6619 		uint16	msg_type;
6620 		uint16	datalen;
6621 		uint8	vap_mac[6];
6622 		uint8	reserve_data1[2];
6623 		uint8	sta_mac[6];
6624 		uint8	reserve_data2[2];
6625 		uint8	gsn[IV_LEN];
6626 		uint8	wie[256];
6627 	};
6628 #endif /* BCMWAPI_WAI */
6629 	/* chanim acs record */
6630 	typedef struct {
6631 		uint8 valid;
6632 		uint8 trigger;
6633 		chanspec_t selected_chspc;
6634 		int8 bgnoise;
6635 		uint32 glitch_cnt;
6636 		uint8 ccastats;
6637 		uint8 chan_idle;
6638 		uint32 timestamp;
6639 	} chanim_acs_record_t;
6640 
6641 	typedef struct {
6642 		chanim_acs_record_t acs_record[CHANIM_ACS_RECORD];
6643 		uint8 count;
6644 		uint32 timestamp;
6645 	} wl_acs_record_t;
6646 
6647 #define WL_CHANIM_STATS_V2 2
6648 #define CCASTATS_V2_MAX 9
6649 typedef struct chanim_stats_v2 {
6650 	uint32 glitchcnt;               /**< normalized as per second count */
6651 	uint32 badplcp;                 /**< normalized as per second count */
6652 	uint8 ccastats[CCASTATS_V2_MAX];   /**< normalized as 0-255 */
6653 	int8 bgnoise;                   /**< background noise level (in dBm) */
6654 	chanspec_t chanspec;            /**< ctrl chanspec of the interface */
6655 	uint32 timestamp;               /**< time stamp at which the stats are collected */
6656 	uint32 bphy_glitchcnt;          /**< normalized as per second count */
6657 	uint32 bphy_badplcp;            /**< normalized as per second count */
6658 	uint8 chan_idle;                /**< normalized as 0~255 */
6659 	uint8 PAD[3];
6660 } chanim_stats_v2_t;
6661 
6662 typedef struct chanim_stats {
6663 	uint32 glitchcnt;               /**< normalized as per second count */
6664 	uint32 badplcp;                 /**< normalized as per second count */
6665 	uint8 ccastats[CCASTATS_MAX];   /**< normalized as 0-255 */
6666 	int8 bgnoise;                   /**< background noise level (in dBm) */
6667 	uint8 pad_1[11 - CCASTATS_MAX];
6668 	chanspec_t chanspec;            /**< ctrl chanspec of the interface */
6669 	uint8 pad_2[2];
6670 	uint32 timestamp;               /**< time stamp at which the stats are collected */
6671 	uint32 bphy_glitchcnt;          /**< normalized as per second count */
6672 	uint32 bphy_badplcp;            /**< normalized as per second count */
6673 	uint8 chan_idle;                /**< normalized as 0~255 */
6674 	uint8 PAD[3];
6675 } chanim_stats_t;
6676 
6677 #define WL_CHANIM_STATS_VERSION 3
6678 typedef struct {
6679 	uint32 buflen;
6680 	uint32 version;
6681 	uint32 count;
6682 	chanim_stats_t stats[1];
6683 } wl_chanim_stats_t;
6684 
6685 #define WL_CHANIM_STATS_FIXED_LEN OFFSETOF(wl_chanim_stats_t, stats)
6686 
6687 /** Noise measurement metrics. */
6688 #define NOISE_MEASURE_KNOISE	0x1
6689 
6690 /** scb probe parameter */
6691 typedef struct {
6692 	uint32 scb_timeout;
6693 	uint32 scb_activity_time;
6694 	uint32 scb_max_probe;
6695 } wl_scb_probe_t;
6696 
6697 /* structure/defines for selective mgmt frame (smf) stats support */
6698 
6699 #define SMFS_VERSION 1
6700 /** selected mgmt frame (smf) stats element */
6701 typedef struct wl_smfs_elem {
6702 	uint32 count;
6703 	uint16 code;  /**< SC or RC code */
6704 	uint8 PAD[2];
6705 } wl_smfs_elem_t;
6706 
6707 typedef struct wl_smf_stats {
6708 	uint32 version;
6709 	uint16 length;	/**< reserved for future usage */
6710 	uint8 type;
6711 	uint8 codetype;
6712 	uint32 ignored_cnt;
6713 	uint32 malformed_cnt;
6714 	uint32 count_total; /**< count included the interested group */
6715 	wl_smfs_elem_t elem[1];
6716 } wl_smf_stats_t;
6717 
6718 #define WL_SMFSTATS_FIXED_LEN OFFSETOF(wl_smf_stats_t, elem);
6719 
6720 enum {
6721 	SMFS_CODETYPE_SC,
6722 	SMFS_CODETYPE_RC
6723 };
6724 
6725 typedef enum smfs_type {
6726 	SMFS_TYPE_AUTH,
6727 	SMFS_TYPE_ASSOC,
6728 	SMFS_TYPE_REASSOC,
6729 	SMFS_TYPE_DISASSOC_TX,
6730 	SMFS_TYPE_DISASSOC_RX,
6731 	SMFS_TYPE_DEAUTH_TX,
6732 	SMFS_TYPE_DEAUTH_RX,
6733 	SMFS_TYPE_MAX
6734 } smfs_type_t;
6735 
6736 /* #ifdef PHYMON */
6737 
6738 #define PHYMON_VERSION 1
6739 
6740 typedef struct wl_phycal_core_state {
6741 	/* Tx IQ/LO calibration coeffs */
6742 	int16 tx_iqlocal_a;
6743 	int16 tx_iqlocal_b;
6744 	int8 tx_iqlocal_ci;
6745 	int8 tx_iqlocal_cq;
6746 	int8 tx_iqlocal_di;
6747 	int8 tx_iqlocal_dq;
6748 	int8 tx_iqlocal_ei;
6749 	int8 tx_iqlocal_eq;
6750 	int8 tx_iqlocal_fi;
6751 	int8 tx_iqlocal_fq;
6752 
6753 	/** Rx IQ calibration coeffs */
6754 	int16 rx_iqcal_a;
6755 	int16 rx_iqcal_b;
6756 
6757 	uint8 tx_iqlocal_pwridx; /**< Tx Power Index for Tx IQ/LO calibration */
6758 	uint8 PAD[3];
6759 	uint32 papd_epsilon_table[64]; /**< PAPD epsilon table */
6760 	int16 papd_epsilon_offset; /**< PAPD epsilon offset */
6761 	uint8 curr_tx_pwrindex; /**< Tx power index */
6762 	int8 idle_tssi; /**< Idle TSSI */
6763 	int8 est_tx_pwr; /**< Estimated Tx Power (dB) */
6764 	int8 est_rx_pwr; /**< Estimated Rx Power (dB) from RSSI */
6765 	uint16 rx_gaininfo; /**< Rx gain applied on last Rx pkt */
6766 	uint16 init_gaincode; /**< initgain required for ACI */
6767 	int8 estirr_tx;
6768 	int8 estirr_rx;
6769 } wl_phycal_core_state_t;
6770 
6771 typedef struct wl_phycal_state {
6772 	int32 version;
6773 	int8 num_phy_cores; /**< number of cores */
6774 	int8 curr_temperature; /**< on-chip temperature sensor reading */
6775 	chanspec_t chspec; /**< channspec for this state */
6776 	uint8 aci_state; /**< ACI state: ON/OFF */
6777 	uint8 PAD;
6778 	uint16 crsminpower; /**< crsminpower required for ACI */
6779 	uint16 crsminpowerl; /**< crsminpowerl required for ACI */
6780 	uint16 crsminpoweru; /**< crsminpoweru required for ACI */
6781 	wl_phycal_core_state_t phycal_core[1];
6782 } wl_phycal_state_t;
6783 
6784 #define WL_PHYCAL_STAT_FIXED_LEN OFFSETOF(wl_phycal_state_t, phycal_core)
6785 /* endif PHYMON */
6786 
6787 /** discovery state */
6788 typedef struct wl_p2p_disc_st {
6789 	uint8 state;	/**< see state */
6790 	uint8 PAD;
6791 	chanspec_t chspec;	/**< valid in listen state */
6792 	uint16 dwell;	/**< valid in listen state, in ms */
6793 } wl_p2p_disc_st_t;
6794 
6795 /** scan request */
6796 typedef struct wl_p2p_scan {
6797 	uint8 type;		/**< 'S' for WLC_SCAN, 'E' for "escan" */
6798 	uint8 reserved[3];
6799 	/* scan or escan parms... */
6800 } wl_p2p_scan_t;
6801 
6802 /** i/f request */
6803 typedef struct wl_p2p_if {
6804 	struct ether_addr addr;
6805 	uint8 type;	/**< see i/f type */
6806 	uint8 PAD;
6807 	chanspec_t chspec;	/**< for p2p_ifadd GO */
6808 } wl_p2p_if_t;
6809 
6810 /** i/f query */
6811 typedef struct wl_p2p_ifq {
6812 	uint32 bsscfgidx;
6813 	char ifname[BCM_MSG_IFNAME_MAX];
6814 } wl_p2p_ifq_t;
6815 
6816 /** OppPS & CTWindow */
6817 typedef struct wl_p2p_ops {
6818 	uint8 ops;	/**< 0: disable 1: enable */
6819 	uint8 ctw;	/**< >= 10 */
6820 } wl_p2p_ops_t;
6821 
6822 /** absence and presence request */
6823 typedef struct wl_p2p_sched_desc {
6824 	uint32 start;
6825 	uint32 interval;
6826 	uint32 duration;
6827 	uint32 count;	/**< see count */
6828 } wl_p2p_sched_desc_t;
6829 
6830 typedef struct wl_p2p_sched {
6831 	uint8 type;	/**< see schedule type */
6832 	uint8 action;	/**< see schedule action */
6833 	uint8 option;	/**< see schedule option */
6834 	uint8 PAD;
6835 	wl_p2p_sched_desc_t desc[1];
6836 } wl_p2p_sched_t;
6837 
6838 typedef struct wl_p2p_wfds_hash {
6839 	uint32	advt_id;
6840 	uint16	nw_cfg_method;
6841 	uint8	wfds_hash[6];
6842 	uint8	name_len;
6843 	uint8	service_name[MAX_WFDS_SVC_NAME_LEN];
6844 	uint8	PAD[3];
6845 } wl_p2p_wfds_hash_t;
6846 
6847 typedef struct wl_bcmdcs_data {
6848 	uint32 reason;
6849 	chanspec_t chspec;
6850 	uint8	PAD[2];
6851 } wl_bcmdcs_data_t;
6852 /* ifdef EXT_STA */
6853 /**
6854  * Format of IHV data passed to OID_DOT11_NIC_SPECIFIC_EXTENSION.
6855  */
6856 typedef struct _IHV_NIC_SPECIFIC_EXTENSION {
6857 	uint8			oui[4];     /**< vendor specific OUI value */
6858 	uint32			event;      /**< event code */
6859 	uint8			ihvData[1];    /**< ihv data */
6860 } IHV_NIC_SPECIFIC_EXTENSION, *PIHV_NIC_SPECIFIC_EXTENSION;
6861 #define IHV_NIC_SPECIFIC_EXTENTION_HEADER	OFFSETOF(IHV_NIC_SPECIFIC_EXTENSION, ihvData[0])
6862 /* EXT_STA */
6863 /** NAT configuration */
6864 typedef struct {
6865 	uint32 ipaddr;		/**< interface ip address */
6866 	uint32 ipaddr_mask;	/**< interface ip address mask */
6867 	uint32 ipaddr_gateway;	/**< gateway ip address */
6868 	uint8 mac_gateway[6];	/**< gateway mac address */
6869 	uint8	PAD[2];
6870 	uint32 ipaddr_dns;	/**< DNS server ip address, valid only for public if */
6871 	uint8 mac_dns[6];	/**< DNS server mac address,  valid only for public if */
6872 	uint8 GUID[38];		/**< interface GUID */
6873 } nat_if_info_t;
6874 
6875 typedef struct {
6876 	uint32 op;		/**< operation code */
6877 	uint8 pub_if;		/**< set for public if, clear for private if */
6878 	uint8	PAD[3];
6879 	nat_if_info_t if_info;	/**< interface info */
6880 } nat_cfg_t;
6881 
6882 typedef struct {
6883 	int32 state;	/**< NAT state returned */
6884 } nat_state_t;
6885 
6886 typedef struct flush_txfifo {
6887 	uint32 txfifobmp;
6888 	uint32 hwtxfifoflush;
6889 	struct ether_addr ea;
6890 	uint8	PAD[2];
6891 } flush_txfifo_t;
6892 
6893 enum {
6894 	SPATIAL_MODE_2G_IDX = 0,
6895 	SPATIAL_MODE_5G_LOW_IDX,
6896 	SPATIAL_MODE_5G_MID_IDX,
6897 	SPATIAL_MODE_5G_HIGH_IDX,
6898 	SPATIAL_MODE_5G_UPPER_IDX,
6899 	SPATIAL_MODE_MAX_IDX
6900 };
6901 
6902 #define WLC_TXCORE_MAX		4	/**< max number of txcore supports */
6903 #define WLC_TXCORE_MAX_OLD	2	/**< backward compatibilty for TXCAL */
6904 #define WLC_SUBBAND_MAX		4	/**< max number of sub-band supports */
6905 typedef struct {
6906 	uint8	band2g[WLC_TXCORE_MAX];
6907 	uint8	band5g[WLC_SUBBAND_MAX][WLC_TXCORE_MAX];
6908 } sar_limit_t;
6909 
6910 #define MAX_NUM_TXCAL_MEAS 128
6911 #define MAX_NUM_PWR_STEP 40
6912 #define TXCAL_IOVAR_VERSION	0x1
6913 typedef struct wl_txcal_meas_percore {
6914 	uint16 tssi[MAX_NUM_TXCAL_MEAS];
6915 	int16 pwr[MAX_NUM_TXCAL_MEAS];
6916 } wl_txcal_meas_percore_t;
6917 
6918 typedef struct wl_txcal_meas_ncore {
6919 	uint16 version;
6920 	uint8 valid_cnt;
6921 	uint8 num_core;
6922 	wl_txcal_meas_percore_t txcal_percore[1];
6923 } wl_txcal_meas_ncore_t;
6924 
6925 typedef struct wl_txcal_power_tssi_percore {
6926 	int16 tempsense;
6927 	int16 pwr_start;
6928 	uint8 pwr_start_idx;
6929 	uint8 num_entries;
6930 	uint16 pad;
6931 	uint8 tssi[MAX_NUM_PWR_STEP];
6932 } wl_txcal_power_tssi_percore_t;
6933 
6934 typedef struct wl_txcal_power_tssi_ncore {
6935 	uint16 version;
6936 	uint8 set_core;
6937 	uint8 channel;
6938 	uint8 num_core;
6939 	uint8 gen_tbl;
6940 	uint16 pad;
6941 	wl_txcal_power_tssi_percore_t tssi_percore[1];
6942 } wl_txcal_power_tssi_ncore_t;
6943 
6944 typedef struct wl_txcal_meas {
6945 	uint16 tssi[WLC_TXCORE_MAX][MAX_NUM_TXCAL_MEAS];
6946 	int16 pwr[WLC_TXCORE_MAX][MAX_NUM_TXCAL_MEAS];
6947 	uint8 valid_cnt;
6948 	uint8 PAD;
6949 } wl_txcal_meas_t;
6950 
6951 typedef struct wl_txcal_meas_old {
6952 	uint16 tssi[WLC_TXCORE_MAX_OLD][MAX_NUM_TXCAL_MEAS];
6953 	int16 pwr[WLC_TXCORE_MAX_OLD][MAX_NUM_TXCAL_MEAS];
6954 	uint8 valid_cnt;
6955 	uint8 PAD;
6956 } wl_txcal_meas_old_t;
6957 
6958 typedef struct wl_txcal_power_tssi {
6959 	uint8 set_core;
6960 	uint8 channel;
6961 	int16 tempsense[WLC_TXCORE_MAX];
6962 	int16 pwr_start[WLC_TXCORE_MAX];
6963 	uint8 pwr_start_idx[WLC_TXCORE_MAX];
6964 	uint8 num_entries[WLC_TXCORE_MAX];
6965 	uint8 tssi[WLC_TXCORE_MAX][MAX_NUM_PWR_STEP];
6966 	uint8 gen_tbl;
6967 	uint8 PAD;
6968 } wl_txcal_power_tssi_t;
6969 
6970 typedef struct wl_txcal_power_tssi_old {
6971 	uint8 set_core;
6972 	uint8 channel;
6973 	int16 tempsense[WLC_TXCORE_MAX_OLD];
6974 	int16 pwr_start[WLC_TXCORE_MAX_OLD];
6975 	uint8 pwr_start_idx[WLC_TXCORE_MAX_OLD];
6976 	uint8 num_entries[WLC_TXCORE_MAX_OLD];
6977 	uint8 tssi[WLC_TXCORE_MAX_OLD][MAX_NUM_PWR_STEP];
6978 	uint8 gen_tbl;
6979 	uint8 PAD;
6980 } wl_txcal_power_tssi_old_t;
6981 
6982 typedef struct wl_olpc_pwr {
6983 	uint16 version;
6984 	uint8 core;
6985 	uint8 channel;
6986 	int16 tempsense;
6987 	uint8 olpc_idx;
6988 	uint8 pad;
6989 } wl_olpc_pwr_t;
6990 
6991 /** IOVAR "mempool" parameter. Used to retrieve a list of memory pool statistics. */
6992 typedef struct wl_mempool_stats {
6993 	int32 num;		/**< Number of memory pools */
6994 	bcm_mp_stats_t s[1];	/**< Variable array of memory pool stats. */
6995 } wl_mempool_stats_t;
6996 
6997 typedef struct {
6998 	uint32 ipaddr;
6999 	uint32 ipaddr_netmask;
7000 	uint32 ipaddr_gateway;
7001 } nwoe_ifconfig_t;
7002 
7003 /** Traffic management priority classes */
7004 typedef enum trf_mgmt_priority_class {
7005 	trf_mgmt_priority_low           = 0,        /**< Maps to 802.1p BK */
7006 	trf_mgmt_priority_medium        = 1,        /**< Maps to 802.1p BE */
7007 	trf_mgmt_priority_high          = 2,        /**< Maps to 802.1p VI */
7008 	trf_mgmt_priority_nochange	= 3,	    /**< do not update the priority */
7009 	trf_mgmt_priority_invalid       = (trf_mgmt_priority_nochange + 1)
7010 } trf_mgmt_priority_class_t;
7011 
7012 /** Traffic management configuration parameters */
7013 typedef struct trf_mgmt_config {
7014 	uint32  trf_mgmt_enabled;                           /**< 0 - disabled, 1 - enabled */
7015 	uint32  flags;                                      /**< See TRF_MGMT_FLAG_xxx defines */
7016 	uint32  host_ip_addr;                              /**< My IP address to determine subnet */
7017 	uint32  host_subnet_mask;                           /**< My subnet mask */
7018 	uint32  downlink_bandwidth;                         /**< In units of kbps */
7019 	uint32  uplink_bandwidth;                           /**< In units of kbps */
7020 	uint32  min_tx_bandwidth[TRF_MGMT_MAX_PRIORITIES];  /**< Minimum guaranteed tx bandwidth */
7021 	uint32  min_rx_bandwidth[TRF_MGMT_MAX_PRIORITIES];  /**< Minimum guaranteed rx bandwidth */
7022 } trf_mgmt_config_t;
7023 
7024 /** Traffic management filter */
7025 typedef struct trf_mgmt_filter {
7026 	struct ether_addr           dst_ether_addr;         /**< His L2 address */
7027 	uint8						PAD[2];
7028 	uint32                      dst_ip_addr;            /**< His IP address */
7029 	uint16                      dst_port;               /**< His L4 port */
7030 	uint16                      src_port;               /**< My L4 port */
7031 	uint16                      prot;                   /**< L4 protocol (only TCP or UDP) */
7032 	uint16                      flags;                  /**< TBD. For now, this must be zero. */
7033 	trf_mgmt_priority_class_t   priority;               /**< Priority for filtered packets */
7034 	uint32                      dscp;                   /**< DSCP */
7035 } trf_mgmt_filter_t;
7036 
7037 /** Traffic management filter list (variable length) */
7038 typedef struct trf_mgmt_filter_list     {
7039 	uint32              num_filters;
7040 	trf_mgmt_filter_t   filter[1];
7041 } trf_mgmt_filter_list_t;
7042 
7043 /** Traffic management global info used for all queues */
7044 typedef struct trf_mgmt_global_info {
7045 	uint32  maximum_bytes_per_second;
7046 	uint32  maximum_bytes_per_sampling_period;
7047 	uint32  total_bytes_consumed_per_second;
7048 	uint32  total_bytes_consumed_per_sampling_period;
7049 	uint32  total_unused_bytes_per_sampling_period;
7050 } trf_mgmt_global_info_t;
7051 
7052 /** Traffic management shaping info per priority queue */
7053 typedef struct trf_mgmt_shaping_info {
7054 	uint32  gauranteed_bandwidth_percentage;
7055 	uint32  guaranteed_bytes_per_second;
7056 	uint32  guaranteed_bytes_per_sampling_period;
7057 	uint32  num_bytes_produced_per_second;
7058 	uint32  num_bytes_consumed_per_second;
7059 	uint32  num_queued_packets;                         /**< Number of packets in queue */
7060 	uint32  num_queued_bytes;                           /**< Number of bytes in queue */
7061 } trf_mgmt_shaping_info_t;
7062 
7063 /** Traffic management shaping info array */
7064 typedef struct trf_mgmt_shaping_info_array {
7065 	trf_mgmt_global_info_t   tx_global_shaping_info;
7066 	trf_mgmt_shaping_info_t  tx_queue_shaping_info[TRF_MGMT_MAX_PRIORITIES];
7067 	trf_mgmt_global_info_t   rx_global_shaping_info;
7068 	trf_mgmt_shaping_info_t  rx_queue_shaping_info[TRF_MGMT_MAX_PRIORITIES];
7069 } trf_mgmt_shaping_info_array_t;
7070 
7071 
7072 /** Traffic management statistical counters */
7073 typedef struct trf_mgmt_stats {
7074 	uint32  num_processed_packets;      /**< Number of packets processed */
7075 	uint32  num_processed_bytes;        /**< Number of bytes processed */
7076 	uint32  num_discarded_packets;      /**< Number of packets discarded from queue */
7077 } trf_mgmt_stats_t;
7078 
7079 /** Traffic management statistics array */
7080 typedef struct trf_mgmt_stats_array {
7081 	trf_mgmt_stats_t  tx_queue_stats[TRF_MGMT_MAX_PRIORITIES];
7082 	trf_mgmt_stats_t  rx_queue_stats[TRF_MGMT_MAX_PRIORITIES];
7083 } trf_mgmt_stats_array_t;
7084 
7085 /* Both powersel_params and lpc_params are used by IOVAR lpc_params.
7086  * The powersel_params is replaced by lpc_params in later WLC versions.
7087  */
7088 typedef struct powersel_params {
7089 	/* LPC Params exposed via IOVAR */
7090 	int32		tp_ratio_thresh;  /**< Throughput ratio threshold */
7091 	uint8		rate_stab_thresh; /**< Thresh for rate stability based on nupd */
7092 	uint8		pwr_stab_thresh; /**< Number of successes before power step down */
7093 	uint8		pwr_sel_exp_time; /**< Time lapse for expiry of database */
7094 	uint8		PAD;
7095 } powersel_params_t;
7096 
7097 #define WL_LPC_PARAMS_VER_2	2
7098 #define WL_LPC_PARAMS_CURRENT_VERSION WL_LPC_PARAMS_VER_2
7099 
7100 typedef struct lpc_params {
7101 	uint16		version;
7102 	uint16		length;
7103 	/* LPC Params exposed via IOVAR */
7104 	uint8		rate_stab_thresh; /**< Thresh for rate stability based on nupd */
7105 	uint8		pwr_stab_thresh; /**< Number of successes before power step down */
7106 	uint8		lpc_exp_time; /**< Time lapse for expiry of database */
7107 	uint8		pwrup_slow_step; /**< Step size for slow step up */
7108 	uint8		pwrup_fast_step; /**< Step size for fast step up */
7109 	uint8		pwrdn_slow_step; /**< Step size for slow step down */
7110 } lpc_params_t;
7111 
7112 /* tx pkt delay statistics */
7113 #define	SCB_RETRY_SHORT_DEF	7	/**< Default Short retry Limit */
7114 #define WLPKTDLY_HIST_NBINS	16	/**< number of bins used in the Delay histogram */
7115 
7116 /** structure to store per-AC delay statistics */
7117 typedef struct scb_delay_stats {
7118 	uint32 txmpdu_lost;	/**< number of MPDUs lost */
7119 	uint32 txmpdu_cnt[SCB_RETRY_SHORT_DEF]; /**< retry times histogram */
7120 	uint32 delay_sum[SCB_RETRY_SHORT_DEF]; /**< cumulative packet latency */
7121 	uint32 delay_min;	/**< minimum packet latency observed */
7122 	uint32 delay_max;	/**< maximum packet latency observed */
7123 	uint32 delay_avg;	/**< packet latency average */
7124 	uint32 delay_hist[WLPKTDLY_HIST_NBINS];	/**< delay histogram */
7125 	uint32 delay_count;	/**< minimum number of time period units before
7126 				consequent packet delay events can be generated
7127 				*/
7128 	uint32 prev_txmpdu_cnt;	/**< Previous value of txmpdu_cnt[] during last iteration */
7129 	uint32 prev_delay_sum;	/**< Previous value of delay_sum[] during last iteration */
7130 } scb_delay_stats_t;
7131 
7132 /** structure for txdelay event */
7133 typedef struct txdelay_event {
7134 	uint8				status;
7135 	uint8				PAD[3];
7136 	int32				rssi;
7137 	chanim_stats_t		chanim_stats;
7138 	scb_delay_stats_t	delay_stats[AC_COUNT];
7139 } txdelay_event_t;
7140 
7141 /** structure for txdelay parameters */
7142 typedef struct txdelay_params {
7143 	uint16	ratio;	/**< Avg Txdelay Delta */
7144 	uint8	cnt;	/**< Sample cnt */
7145 	uint8	period;	/**< Sample period */
7146 	uint8	tune;	/**< Debug */
7147 	uint8	PAD;
7148 } txdelay_params_t;
7149 #define MAX_TXDELAY_STATS_SCBS 6
7150 #define TXDELAY_STATS_VERSION 1
7151 
7152 enum {
7153 	TXDELAY_STATS_PARTIAL_RESULT = 0,
7154 	TXDELAY_STATS_FULL_RESULT = 1
7155 };
7156 
7157 typedef struct scb_total_delay_stats {
7158 	struct  ether_addr ea;
7159 	uint8   pad[2];
7160 	scb_delay_stats_t dlystats[AC_COUNT];
7161 } scb_total_delay_stats_t;
7162 
7163 typedef struct txdelay_stats {
7164 	uint32  version;
7165 	uint32  full_result;    /* 0:Partial, 1:full */
7166 	uint32  scb_cnt;        /* in:requested, out:returned */
7167 	scb_total_delay_stats_t scb_delay_stats[1];
7168 } txdelay_stats_t;
7169 
7170 #define WL_TXDELAY_STATS_FIXED_SIZE \
7171 	(sizeof(txdelay_stats_t)+(MAX_TXDELAY_STATS_SCBS-1)*sizeof(scb_total_delay_stats_t))
7172 enum {
7173 	WNM_SERVICE_DMS = 1,
7174 	WNM_SERVICE_FMS = 2,
7175 	WNM_SERVICE_TFS = 3
7176 };
7177 
7178 /** Definitions for WNM/NPS TCLAS */
7179 typedef struct wl_tclas {
7180 	uint8 user_priority;
7181 	uint8 fc_len;
7182 	dot11_tclas_fc_t fc;
7183 } wl_tclas_t;
7184 
7185 #define WL_TCLAS_FIXED_SIZE	OFFSETOF(wl_tclas_t, fc)
7186 
7187 typedef struct wl_tclas_list {
7188 	uint32 num;
7189 	wl_tclas_t tclas[];
7190 } wl_tclas_list_t;
7191 
7192 /** Definitions for WNM/NPS Traffic Filter Service */
7193 typedef struct wl_tfs_req {
7194 	uint8 tfs_id;
7195 	uint8 tfs_actcode;
7196 	uint8 tfs_subelem_id;
7197 	uint8 send;
7198 } wl_tfs_req_t;
7199 
7200 typedef struct wl_tfs_filter {
7201 	uint8 status;			/**< Status returned by the AP */
7202 	uint8 tclas_proc;		/**< TCLAS processing value (0:and, 1:or)  */
7203 	uint8 tclas_cnt;		/**< count of all wl_tclas_t in tclas array */
7204 	uint8 tclas[1];			/**< VLA of wl_tclas_t */
7205 } wl_tfs_filter_t;
7206 #define WL_TFS_FILTER_FIXED_SIZE	OFFSETOF(wl_tfs_filter_t, tclas)
7207 
7208 typedef struct wl_tfs_fset {
7209 	struct ether_addr ea;		/**< Address of AP/STA involved with this filter set */
7210 	uint8 tfs_id;			/**< TFS ID field chosen by STA host */
7211 	uint8 status;			/**< Internal status TFS_STATUS_xxx */
7212 	uint8 actcode;			/**< Action code DOT11_TFS_ACTCODE_xxx */
7213 	uint8 token;			/**< Token used in last request frame */
7214 	uint8 notify;			/**< Notify frame sent/received because of this set */
7215 	uint8 filter_cnt;		/**< count of all wl_tfs_filter_t in filter array */
7216 	uint8 filter[1];		/**< VLA of wl_tfs_filter_t */
7217 } wl_tfs_fset_t;
7218 #define WL_TFS_FSET_FIXED_SIZE		OFFSETOF(wl_tfs_fset_t, filter)
7219 
7220 enum {
7221 	TFS_STATUS_DISABLED = 0,	/**< TFS filter set disabled by user */
7222 	TFS_STATUS_DISABLING = 1,	/**< Empty request just sent to AP */
7223 	TFS_STATUS_VALIDATED = 2,	/**< Filter set validated by AP (but maybe not enabled!) */
7224 	TFS_STATUS_VALIDATING = 3,	/**< Filter set just sent to AP */
7225 	TFS_STATUS_NOT_ASSOC = 4,	/**< STA not associated */
7226 	TFS_STATUS_NOT_SUPPORT = 5,	/**< TFS not supported by AP */
7227 	TFS_STATUS_DENIED = 6,		/**< Filter set refused by AP (=> all sets are disabled!) */
7228 };
7229 
7230 typedef struct wl_tfs_status {
7231 	uint8 fset_cnt;			/**< count of all wl_tfs_fset_t in fset array */
7232 	wl_tfs_fset_t fset[1];		/**< VLA of wl_tfs_fset_t */
7233 } wl_tfs_status_t;
7234 
7235 typedef struct wl_tfs_set {
7236 	uint8 send;		/**< Immediatly register registered sets on AP side */
7237 	uint8 tfs_id;		/**< ID of a specific set (existing or new), or nul for all */
7238 	uint8 actcode;		/**< Action code for this filter set */
7239 	uint8 tclas_proc;	/**< TCLAS processing operator for this filter set */
7240 } wl_tfs_set_t;
7241 
7242 typedef struct wl_tfs_term {
7243 	uint8 del;			/**< Delete internal set once confirmation received */
7244 	uint8 tfs_id;			/**< ID of a specific set (existing), or nul for all */
7245 } wl_tfs_term_t;
7246 
7247 
7248 #define DMS_DEP_PROXY_ARP (1 << 0)
7249 
7250 /* Definitions for WNM/NPS Directed Multicast Service */
7251 enum {
7252 	DMS_STATUS_DISABLED = 0,	/**< DMS desc disabled by user */
7253 	DMS_STATUS_ACCEPTED = 1,	/**< Request accepted by AP */
7254 	DMS_STATUS_NOT_ASSOC = 2,	/**< STA not associated */
7255 	DMS_STATUS_NOT_SUPPORT = 3,	/**< DMS not supported by AP */
7256 	DMS_STATUS_DENIED = 4,		/**< Request denied by AP */
7257 	DMS_STATUS_TERM = 5,		/**< Request terminated by AP */
7258 	DMS_STATUS_REMOVING = 6,	/**< Remove request just sent */
7259 	DMS_STATUS_ADDING = 7,		/**< Add request just sent */
7260 	DMS_STATUS_ERROR = 8,		/**< Non compliant AP behvior */
7261 	DMS_STATUS_IN_PROGRESS = 9,	/**< Request just sent */
7262 	DMS_STATUS_REQ_MISMATCH = 10	/**< Conditions for sending DMS req not met */
7263 };
7264 
7265 typedef struct wl_dms_desc {
7266 	uint8 user_id;
7267 	uint8 status;
7268 	uint8 token;
7269 	uint8 dms_id;
7270 	uint8 tclas_proc;
7271 	uint8 mac_len;		/**< length of all ether_addr in data array, 0 if STA */
7272 	uint8 tclas_len;	/**< length of all wl_tclas_t in data array */
7273 	uint8 data[1];		/**< VLA of 'ether_addr' and 'wl_tclas_t' (in this order ) */
7274 } wl_dms_desc_t;
7275 
7276 #define WL_DMS_DESC_FIXED_SIZE	OFFSETOF(wl_dms_desc_t, data)
7277 
7278 typedef struct wl_dms_status {
7279 	uint32 cnt;
7280 	wl_dms_desc_t desc[1];
7281 } wl_dms_status_t;
7282 
7283 typedef struct wl_dms_set {
7284 	uint8 send;
7285 	uint8 user_id;
7286 	uint8 tclas_proc;
7287 } wl_dms_set_t;
7288 
7289 typedef struct wl_dms_term {
7290 	uint8 del;
7291 	uint8 user_id;
7292 } wl_dms_term_t;
7293 
7294 typedef struct wl_service_term {
7295 	uint8 service;
7296 	union {
7297 		wl_dms_term_t dms;
7298 	} u;
7299 } wl_service_term_t;
7300 
7301 /** Definitions for WNM/NPS BSS Transistion */
7302 typedef struct wl_bsstrans_req {
7303 	uint16 tbtt;			/**< time of BSS to end of life, in unit of TBTT */
7304 	uint16 dur;			/**< time of BSS to keep off, in unit of minute */
7305 	uint8 reqmode;			/**< request mode of BSS transition request */
7306 	uint8 unicast;			/**< request by unicast or by broadcast */
7307 } wl_bsstrans_req_t;
7308 
7309 enum {
7310 	BSSTRANS_RESP_AUTO = 0,		/**< Currently equivalent to ENABLE */
7311 	BSSTRANS_RESP_DISABLE = 1,	/**< Never answer BSS Trans Req frames */
7312 	BSSTRANS_RESP_ENABLE = 2,	/**< Always answer Req frames with preset data */
7313 	BSSTRANS_RESP_WAIT = 3,		/**< Send ind, wait and/or send preset data (NOT IMPL) */
7314 	BSSTRANS_RESP_IMMEDIATE = 4	/**< After an ind, set data and send resp (NOT IMPL) */
7315 };
7316 
7317 typedef struct wl_bsstrans_resp {
7318 	uint8 policy;
7319 	uint8 status;
7320 	uint8 delay;
7321 	struct ether_addr target;
7322 } wl_bsstrans_resp_t;
7323 
7324 /* "wnm_bsstrans_policy" argument programs behavior after BSSTRANS Req reception.
7325  * BSS-Transition feature is used by multiple programs such as NPS-PF, VE-PF,
7326  * Band-steering, Hotspot 2.0 and customer requirements. Each PF and its test plan
7327  * mandates different behavior on receiving BSS-transition request. To accomodate
7328  * such divergent behaviors these policies have been created.
7329  */
7330 typedef enum {
7331 	WL_BSSTRANS_POLICY_ROAM_ALWAYS = 0,	/**< Roam (or disassociate) in all cases */
7332 	WL_BSSTRANS_POLICY_ROAM_IF_MODE = 1,	/**< Roam only if requested by Request Mode field */
7333 	WL_BSSTRANS_POLICY_ROAM_IF_PREF = 2,	/**< Roam only if Preferred BSS provided */
7334 	WL_BSSTRANS_POLICY_WAIT = 3,		/**< Wait for deauth and send Accepted status */
7335 	WL_BSSTRANS_POLICY_PRODUCT = 4,	/**< Policy for real product use cases (Olympic) */
7336 	WL_BSSTRANS_POLICY_PRODUCT_WBTEXT = 5,	/**< Policy for real product use cases (SS) */
7337 	WL_BSSTRANS_POLICY_MAX = 6
7338 } wnm_bsstrans_policy_type_t;
7339 
7340 /** Definitions for WNM/NPS TIM Broadcast */
7341 typedef struct wl_timbc_offset {
7342 	int16 offset;		/**< offset in us */
7343 	uint16 fix_intv;	/**< override interval sent from STA */
7344 	uint16 rate_override;	/**< use rate override to send high rate TIM broadcast frame */
7345 	uint8 tsf_present;	/**< show timestamp in TIM broadcast frame */
7346 	uint8 PAD;
7347 } wl_timbc_offset_t;
7348 
7349 typedef struct wl_timbc_set {
7350 	uint8 interval;		/**< Interval in DTIM wished or required. */
7351 	uint8 flags;		/**< Bitfield described below */
7352 	uint16 rate_min;	/**< Minimum rate required for High/Low TIM frames. Optionnal */
7353 	uint16 rate_max;	/**< Maximum rate required for High/Low TIM frames. Optionnal */
7354 } wl_timbc_set_t;
7355 
7356 enum {
7357 	WL_TIMBC_SET_TSF_REQUIRED = 1,	/**< Enable TIMBC only if TSF in TIM frames */
7358 	WL_TIMBC_SET_NO_OVERRIDE = 2,	/**< ... if AP does not override interval */
7359 	WL_TIMBC_SET_PROXY_ARP = 4,	/**< ... if AP support Proxy ARP */
7360 	WL_TIMBC_SET_DMS_ACCEPTED = 8	/**< ... if all DMS desc have been accepted */
7361 };
7362 
7363 typedef struct wl_timbc_status {
7364 	uint8 status_sta;		/**< Status from internal state machine (check below) */
7365 	uint8 status_ap;		/**< From AP response frame (check 8.4.2.86 from 802.11) */
7366 	uint8 interval;
7367 	uint8 pad;
7368 	int32 offset;
7369 	uint16 rate_high;
7370 	uint16 rate_low;
7371 } wl_timbc_status_t;
7372 
7373 enum {
7374 	WL_TIMBC_STATUS_DISABLE = 0,		/**< TIMBC disabled by user */
7375 	WL_TIMBC_STATUS_REQ_MISMATCH = 1,	/**< AP settings do no match user requirements */
7376 	WL_TIMBC_STATUS_NOT_ASSOC = 2,		/**< STA not associated */
7377 	WL_TIMBC_STATUS_NOT_SUPPORT = 3,	/**< TIMBC not supported by AP */
7378 	WL_TIMBC_STATUS_DENIED = 4,		/**< Req to disable TIMBC sent to AP */
7379 	WL_TIMBC_STATUS_ENABLE = 5		/**< TIMBC enabled */
7380 };
7381 
7382 /** Definitions for PM2 Dynamic Fast Return To Sleep */
7383 typedef struct wl_pm2_sleep_ret_ext {
7384 	uint8  logic;			/**< DFRTS logic: see WL_DFRTS_LOGIC_* below */
7385 	uint8  PAD;
7386 	uint16 low_ms;			/**< Low FRTS timeout */
7387 	uint16 high_ms;			/**< High FRTS timeout */
7388 	uint16 rx_pkts_threshold;	/**< switching threshold: # rx pkts */
7389 	uint16 tx_pkts_threshold;	/**< switching threshold: # tx pkts */
7390 	uint16 txrx_pkts_threshold;	/**< switching threshold: # (tx+rx) pkts */
7391 	uint32 rx_bytes_threshold;	/**< switching threshold: # rx bytes */
7392 	uint32 tx_bytes_threshold;	/**< switching threshold: # tx bytes */
7393 	uint32 txrx_bytes_threshold;	/**< switching threshold: # (tx+rx) bytes */
7394 } wl_pm2_sleep_ret_ext_t;
7395 
7396 #define WL_DFRTS_LOGIC_OFF	0	/**< Feature is disabled */
7397 #define WL_DFRTS_LOGIC_OR	1	/**< OR all non-zero threshold conditions */
7398 #define WL_DFRTS_LOGIC_AND	2	/**< AND all non-zero threshold conditions */
7399 
7400 /* Values for the passive_on_restricted_mode iovar.  When set to non-zero, this iovar
7401  * disables automatic conversions of a channel from passively scanned to
7402  * actively scanned.  These values only have an effect for country codes such
7403  * as XZ where some 5 GHz channels are defined to be passively scanned.
7404  */
7405 #define WL_PASSACTCONV_DISABLE_NONE	0	/**< Enable permanent and temporary conversions */
7406 #define WL_PASSACTCONV_DISABLE_ALL	1	/**< Disable permanent and temporary conversions */
7407 #define WL_PASSACTCONV_DISABLE_PERM	2	/**< Disable only permanent conversions */
7408 
7409 /* Definitions for Reliable Multicast */
7410 #define WL_RMC_CNT_VERSION	   1
7411 #define WL_RMC_TR_VERSION	   1
7412 #define WL_RMC_MAX_CLIENT	   32
7413 #define WL_RMC_FLAG_INBLACKLIST	   1
7414 #define WL_RMC_FLAG_ACTIVEACKER	   2
7415 #define WL_RMC_FLAG_RELMCAST	   4
7416 #define WL_RMC_MAX_TABLE_ENTRY     4
7417 
7418 #define WL_RMC_VER		   1
7419 #define WL_RMC_INDEX_ACK_ALL       255
7420 #define WL_RMC_NUM_OF_MC_STREAMS   4
7421 #define WL_RMC_MAX_TRS_PER_GROUP   1
7422 #define WL_RMC_MAX_TRS_IN_ACKALL   1
7423 #define WL_RMC_ACK_MCAST0          0x02
7424 #define WL_RMC_ACK_MCAST_ALL       0x01
7425 #define WL_RMC_ACTF_TIME_MIN       300		/**< time in ms */
7426 #define WL_RMC_ACTF_TIME_MAX       20000	/**< time in ms */
7427 #define WL_RMC_MAX_NUM_TRS	   32		/**< maximun transmitters allowed */
7428 #define WL_RMC_ARTMO_MIN           350		/**< time in ms */
7429 #define WL_RMC_ARTMO_MAX           40000	/**< time in ms */
7430 
7431 /* RMC events in action frames */
7432 enum rmc_opcodes {
7433 	RELMCAST_ENTRY_OP_DISABLE = 0,   /**< Disable multi-cast group */
7434 	RELMCAST_ENTRY_OP_DELETE  = 1,   /**< Delete multi-cast group */
7435 	RELMCAST_ENTRY_OP_ENABLE  = 2,   /**< Enable multi-cast group */
7436 	RELMCAST_ENTRY_OP_ACK_ALL = 3    /**< Enable ACK ALL bit in AMT */
7437 };
7438 
7439 /* RMC operational modes */
7440 enum rmc_modes {
7441 	WL_RMC_MODE_RECEIVER    = 0,	 /**< Receiver mode by default */
7442 	WL_RMC_MODE_TRANSMITTER = 1,	 /**< Transmitter mode using wl ackreq */
7443 	WL_RMC_MODE_INITIATOR   = 2	 /**< Initiator mode using wl ackreq */
7444 };
7445 
7446 /** Each RMC mcast client info */
7447 typedef struct wl_relmcast_client {
7448 	uint8 flag;			/**< status of client such as AR, R, or blacklisted */
7449 	uint8 PAD;
7450 	int16 rssi;			/**< rssi value of RMC client */
7451 	struct ether_addr addr;		/**< mac address of RMC client */
7452 } wl_relmcast_client_t;
7453 
7454 /** RMC Counters */
7455 typedef struct wl_rmc_cnts {
7456 	uint16  version;		/**< see definition of WL_CNT_T_VERSION */
7457 	uint16  length;			/**< length of entire structure */
7458 	uint16	dupcnt;			/**< counter for duplicate rmc MPDU */
7459 	uint16	ackreq_err;		/**< counter for wl ackreq error    */
7460 	uint16	af_tx_err;		/**< error count for action frame transmit   */
7461 	uint16	null_tx_err;		/**< error count for rmc null frame transmit */
7462 	uint16	af_unicast_tx_err;	/**< error count for rmc unicast frame transmit */
7463 	uint16	mc_no_amt_slot;		/**< No mcast AMT entry available */
7464 	/* Unused. Keep for rom compatibility */
7465 	uint16	mc_no_glb_slot;		/**< No mcast entry available in global table */
7466 	uint16	mc_not_mirrored;	/**< mcast group is not mirrored */
7467 	uint16	mc_existing_tr;		/**< mcast group is already taken by transmitter */
7468 	uint16	mc_exist_in_amt;	/**< mcast group is already programmed in amt */
7469 	/* Unused. Keep for rom compatibility */
7470 	uint16	mc_not_exist_in_gbl;	/**< mcast group is not in global table */
7471 	uint16	mc_not_exist_in_amt;	/**< mcast group is not in AMT table */
7472 	uint16	mc_utilized;		/**< mcast addressed is already taken */
7473 	uint16	mc_taken_other_tr;	/**< multi-cast addressed is already taken */
7474 	uint32	rmc_rx_frames_mac;      /**< no of mc frames received from mac */
7475 	uint32	rmc_tx_frames_mac;      /**< no of mc frames transmitted to mac */
7476 	uint32	mc_null_ar_cnt;         /**< no. of times NULL AR is received */
7477 	uint32	mc_ar_role_selected;	/**< no. of times took AR role */
7478 	uint32	mc_ar_role_deleted;	/**< no. of times AR role cancelled */
7479 	uint32	mc_noacktimer_expired;  /**< no. of times noack timer expired */
7480 	uint16  mc_no_wl_clk;           /**< no wl clk detected when trying to access amt */
7481 	uint16  mc_tr_cnt_exceeded;     /**< No of transmitters in the network exceeded */
7482 } wl_rmc_cnts_t;
7483 
7484 /** RMC Status */
7485 typedef struct wl_relmcast_st {
7486 	uint8         ver;		/**< version of RMC */
7487 	uint8         num;		/**< number of clients detected by transmitter */
7488 	wl_relmcast_client_t clients[WL_RMC_MAX_CLIENT];
7489 	uint16        err;		/**< error status (used in infra) */
7490 	uint16        actf_time;	/**< action frame time period */
7491 } wl_relmcast_status_t;
7492 
7493 /** Entry for each STA/node */
7494 typedef struct wl_rmc_entry {
7495 	/* operation on multi-cast entry such add,
7496 	 * delete, ack-all
7497 	 */
7498 	int8    flag;
7499 	struct ether_addr addr;		/**< multi-cast group mac address */
7500 } wl_rmc_entry_t;
7501 
7502 /** RMC table */
7503 typedef struct wl_rmc_entry_table {
7504 	uint8   index;			/**< index to a particular mac entry in table */
7505 	uint8   opcode;			/**< opcodes or operation on entry */
7506 	wl_rmc_entry_t entry[WL_RMC_MAX_TABLE_ENTRY];
7507 } wl_rmc_entry_table_t;
7508 
7509 typedef struct wl_rmc_trans_elem {
7510 	struct ether_addr tr_mac;	/**< transmitter mac */
7511 	struct ether_addr ar_mac;	/**< ar mac */
7512 	uint16 artmo;			/**< AR timeout */
7513 	uint8 amt_idx;			/**< amt table entry */
7514 	uint8 PAD;
7515 	uint16 flag;			/**< entry will be acked, not acked, programmed, full etc */
7516 } wl_rmc_trans_elem_t;
7517 
7518 /** RMC transmitters */
7519 typedef struct wl_rmc_trans_in_network {
7520 	uint8         ver;		/**< version of RMC */
7521 	uint8         num_tr;		/**< number of transmitters in the network */
7522 	wl_rmc_trans_elem_t trs[WL_RMC_MAX_NUM_TRS];
7523 } wl_rmc_trans_in_network_t;
7524 
7525 /** To update vendor specific ie for RMC */
7526 typedef struct wl_rmc_vsie {
7527 	uint8	oui[DOT11_OUI_LEN];
7528 	uint8	PAD;
7529 	uint16	payload;	/**< IE Data Payload */
7530 } wl_rmc_vsie_t;
7531 
7532 
7533 /* structures  & defines for proximity detection  */
7534 enum proxd_method {
7535 	PROXD_UNDEFINED_METHOD = 0,
7536 	PROXD_RSSI_METHOD = 1,
7537 	PROXD_TOF_METHOD = 2
7538 };
7539 
7540 /* structures for proximity detection device role */
7541 #define WL_PROXD_MODE_DISABLE	0
7542 #define WL_PROXD_MODE_NEUTRAL	1
7543 #define WL_PROXD_MODE_INITIATOR	2
7544 #define WL_PROXD_MODE_TARGET	3
7545 
7546 #define WL_PROXD_ACTION_STOP		0
7547 #define WL_PROXD_ACTION_START		1
7548 
7549 #define WL_PROXD_FLAG_TARGET_REPORT	0x1
7550 #define WL_PROXD_FLAG_REPORT_FAILURE	0x2
7551 #define WL_PROXD_FLAG_INITIATOR_REPORT	0x4
7552 #define WL_PROXD_FLAG_NOCHANSWT		0x8
7553 #define WL_PROXD_FLAG_NETRUAL		0x10
7554 #define WL_PROXD_FLAG_INITIATOR_RPTRTT	0x20
7555 #define WL_PROXD_FLAG_ONEWAY		0x40
7556 #define WL_PROXD_FLAG_SEQ_EN		0x80
7557 
7558 #define WL_PROXD_SETFLAG_K		0x1
7559 #define WL_PROXD_SETFLAG_N		0x2
7560 #define WL_PROXD_SETFLAG_S		0x4
7561 
7562 #define WL_PROXD_SETFLAG_K		0x1
7563 #define WL_PROXD_SETFLAG_N		0x2
7564 #define WL_PROXD_SETFLAG_S		0x4
7565 
7566 #define WL_PROXD_RANDOM_WAKEUP	0x8000
7567 #define WL_PROXD_MAXREPORT	8
7568 
7569 typedef struct wl_proxd_iovar {
7570 	uint16	method;		/**< Proximity Detection method */
7571 	uint16	mode;		/**< Mode (neutral, initiator, target) */
7572 } wl_proxd_iovar_t;
7573 
7574 /*
7575  * structures for proximity detection parameters
7576  * consists of two parts, common and method specific params
7577  * common params should be placed at the beginning
7578  */
7579 
7580 typedef struct wl_proxd_params_common	{
7581 	chanspec_t	chanspec;	/**< channel spec */
7582 	int16		tx_power;	/**< tx power of Proximity Detection(PD) frames (in dBm) */
7583 	uint16		tx_rate;	/**< tx rate of PD rames  (in 500kbps units) */
7584 	uint16		timeout;	/**< timeout value */
7585 	uint16		interval;	/**< interval between neighbor finding attempts (in TU) */
7586 	uint16		duration;	/**< duration of neighbor finding attempts (in ms) */
7587 } wl_proxd_params_common_t;
7588 
7589 typedef struct wl_proxd_params_rssi_method {
7590 	chanspec_t	chanspec;	/**< chanspec for home channel */
7591 	int16		tx_power;	/**< tx power of Proximity Detection frames (in dBm) */
7592 	uint16		tx_rate;	/**< tx rate of PD frames, 500kbps units */
7593 	uint16		timeout;	/**< state machine wait timeout of the frames (in ms) */
7594 	uint16		interval;	/**< interval between neighbor finding attempts (in TU) */
7595 	uint16		duration;	/**< duration of neighbor finding attempts (in ms) */
7596 					/* method specific ones go after this line */
7597 	int16		rssi_thresh;	/**< RSSI threshold (in dBm) */
7598 	uint16		maxconvergtmo;	/**< max wait converge timeout (in ms) */
7599 } wl_proxd_params_rssi_method_t;
7600 
7601 #define Q1_NS			25	/**< Q1 time units */
7602 
7603 #define TOF_BW_NUM		3	/**< number of bandwidth that the TOF can support */
7604 #define TOF_BW_SEQ_NUM		(TOF_BW_NUM+2)	/* number of total index */
7605 enum tof_bw_index {
7606 	TOF_BW_20MHZ_INDEX = 0,
7607 	TOF_BW_40MHZ_INDEX = 1,
7608 	TOF_BW_80MHZ_INDEX = 2,
7609 	TOF_BW_SEQTX_INDEX = 3,
7610 	TOF_BW_SEQRX_INDEX = 4
7611 };
7612 
7613 #define BANDWIDTH_BASE	20	/**< base value of bandwidth */
7614 #define TOF_BW_20MHZ    (BANDWIDTH_BASE << TOF_BW_20MHZ_INDEX)
7615 #define TOF_BW_40MHZ    (BANDWIDTH_BASE << TOF_BW_40MHZ_INDEX)
7616 #define TOF_BW_80MHZ    (BANDWIDTH_BASE << TOF_BW_80MHZ_INDEX)
7617 #define TOF_BW_10MHZ    10
7618 
7619 #define NFFT_BASE		64	/**< base size of fft */
7620 #define TOF_NFFT_20MHZ  (NFFT_BASE << TOF_BW_20MHZ_INDEX)
7621 #define TOF_NFFT_40MHZ  (NFFT_BASE << TOF_BW_40MHZ_INDEX)
7622 #define TOF_NFFT_80MHZ  (NFFT_BASE << TOF_BW_80MHZ_INDEX)
7623 
7624 typedef struct wl_proxd_params_tof_method {
7625 	chanspec_t	chanspec;	/**< chanspec for home channel */
7626 	int16		tx_power;	/**< tx power of Proximity Detection(PD) frames (in dBm) */
7627 	uint16		tx_rate;	/**< tx rate of PD rames  (in 500kbps units) */
7628 	uint16		timeout;	/**< state machine wait timeout of the frames (in ms) */
7629 	uint16		interval;	/**< interval between neighbor finding attempts (in TU) */
7630 	uint16		duration;	/**< duration of neighbor finding attempts (in ms) */
7631 	/* specific for the method go after this line */
7632 	struct ether_addr tgt_mac;	/**< target mac addr for TOF method */
7633 	uint16		ftm_cnt;	/**< number of the frames txed by initiator */
7634 	uint16		retry_cnt;	/**< number of retransmit attampts for ftm frames */
7635 	int16		vht_rate;	/**< ht or vht rate */
7636 	/* add more params required for other methods can be added here  */
7637 } wl_proxd_params_tof_method_t;
7638 
7639 typedef struct wl_proxd_seq_config
7640 {
7641 	int16 N_tx_log2;
7642 	int16 N_rx_log2;
7643 	int16 N_tx_scale;
7644 	int16 N_rx_scale;
7645 	int16 w_len;
7646 	int16 w_offset;
7647 } wl_proxd_seq_config_t;
7648 
7649 #define WL_PROXD_TUNE_VERSION_1		1
7650 #include <packed_section_start.h>
7651 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_params_tof_tune {
7652 	uint32		version;
7653 	uint32		Ki;			/**< h/w delay K factor for initiator */
7654 	uint32		Kt;			/**< h/w delay K factor for target */
7655 	int16		vhtack;			/**< enable/disable VHT ACK */
7656 	int16		N_log2[TOF_BW_SEQ_NUM]; /**< simple threshold crossing */
7657 	int16		w_offset[TOF_BW_NUM];	/**< offset of threshold crossing window(per BW) */
7658 	int16		w_len[TOF_BW_NUM];	/**< length of threshold crossing window(per BW) */
7659 	int32		maxDT;			/**< max time difference of T4/T1 or T3/T2 */
7660 	int32		minDT;			/**< min time difference of T4/T1 or T3/T2 */
7661 	uint8		totalfrmcnt;	/**< total count of transfered measurement frames */
7662 	uint16		rsv_media;		/**< reserve media value for TOF */
7663 	uint32		flags;			/**< flags */
7664 	uint8		core;			/**< core to use for tx */
7665 	uint8		setflags;		/* set flags of K, N. S values  */
7666 	int16		N_scale[TOF_BW_SEQ_NUM]; /**< simple threshold crossing */
7667 	uint8		sw_adj;			/**< enable sw assisted timestamp adjustment */
7668 	uint8		hw_adj;			/**< enable hw assisted timestamp adjustment */
7669 	uint8		seq_en;			/**< enable ranging sequence */
7670 	uint8		ftm_cnt[TOF_BW_SEQ_NUM]; /**< number of ftm frames based on bandwidth */
7671 	int16		N_log2_2g;		/**< simple threshold crossing for 2g channel */
7672 	int16		N_scale_2g;		/**< simple threshold crossing for 2g channel */
7673 	wl_proxd_seq_config_t seq_5g20;
7674 	wl_proxd_seq_config_t seq_2g20;		/* Thresh crossing params for 2G Sequence */
7675 	uint16          bitflip_thresh;		/* bitflip threshold */
7676 	uint16          snr_thresh;		/* SNR threshold */
7677 	int8            recv_2g_thresh;		/* 2g recieve sensitivity threshold */
7678 	uint32          acs_gdv_thresh;
7679 	int8            acs_rssi_thresh;
7680 	uint8           smooth_win_en;
7681 	int32		acs_gdmm_thresh;
7682 	int8		acs_delta_rssi_thresh;
7683 	int32		emu_delay;
7684 } BWL_POST_PACKED_STRUCT wl_proxd_params_tof_tune_t;
7685 #include <packed_section_end.h>
7686 
7687 typedef struct wl_proxd_params_iovar {
7688 	uint16	method;			/**< Proximity Detection method */
7689 	union {
7690 		/* common params for pdsvc */
7691 		wl_proxd_params_common_t	cmn_params;	/**< common parameters */
7692 		/*  method specific */
7693 		wl_proxd_params_rssi_method_t	rssi_params;	/**< RSSI method parameters */
7694 		wl_proxd_params_tof_method_t	tof_params;	/**< TOF method parameters */
7695 		/* tune parameters */
7696 		wl_proxd_params_tof_tune_t	tof_tune;	/**< TOF tune parameters */
7697 		uint8	PAD[sizeof(wl_proxd_params_tof_tune_t)+1];
7698 	} u;				/**< Method specific optional parameters */
7699 } wl_proxd_params_iovar_t;
7700 
7701 #define PROXD_COLLECT_GET_STATUS	0
7702 #define PROXD_COLLECT_SET_STATUS	1
7703 #define PROXD_COLLECT_QUERY_HEADER	2
7704 #define PROXD_COLLECT_QUERY_DATA	3
7705 #define PROXD_COLLECT_QUERY_DEBUG	4
7706 #define PROXD_COLLECT_REMOTE_REQUEST	5
7707 #define PROXD_COLLECT_DONE		6
7708 
7709 typedef enum {
7710 	WL_PROXD_COLLECT_METHOD_TYPE_DISABLE		= 0x0,
7711 	WL_PROXD_COLLECT_METHOD_TYPE_IOVAR		= 0x1,
7712 	WL_PROXD_COLLECT_METHOD_TYPE_EVENT		= 0x2,
7713 	WL_PROXD_COLLECT_METHOD_TYPE_EVENT_LOG		= 0x4
7714 } wl_proxd_collect_method_type_t;
7715 
7716 typedef uint16 wl_proxd_collect_method_t;	/* query status: method to send proxd collect */
7717 
7718 #include <packed_section_start.h>
7719 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_query {
7720 	uint32		method;		/**< method */
7721 	uint8		request;	/**< Query request. */
7722 	uint8		status;		/**< bitmask 0 -- disable, 0x1 -- enable collection, */
7723 					/* 0x2 -- Use generic event, 0x4 -- use event log */
7724 	uint16		index;		/**< The current frame index [0 to total_frames - 1]. */
7725 	uint16		mode;		/**< Initiator or Target */
7726 	uint8		busy;		/**< tof sm is busy */
7727 	uint8		remote;		/**< Remote collect data */
7728 } BWL_POST_PACKED_STRUCT wl_proxd_collect_query_t;
7729 #include <packed_section_end.h>
7730 
7731 #include <packed_section_start.h>
7732 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_header {
7733 	uint16		total_frames;			/**< The total frames for this collect. */
7734 	uint16		nfft;				/**< nfft value */
7735 	uint16		bandwidth;			/**< bandwidth */
7736 	uint16		channel;			/**< channel number */
7737 	uint32		chanspec;			/**< channel spec */
7738 	uint32		fpfactor;			/**< avb timer value factor */
7739 	uint16		fpfactor_shift;			/**< avb timer value shift bits */
7740 	int32		distance;			/**< distance calculated by fw */
7741 	uint32		meanrtt;			/**< mean of RTTs */
7742 	uint32		modertt;			/**< mode of RTTs */
7743 	uint32		medianrtt;			/**< median of RTTs */
7744 	uint32		sdrtt;				/**< standard deviation of RTTs */
7745 	uint32		clkdivisor;			/**< clock divisor */
7746 	uint16		chipnum;			/**< chip type */
7747 	uint8		chiprev;			/**< chip revision */
7748 	uint8		phyver;				/**< phy version */
7749 	struct ether_addr	localMacAddr;		/**< local mac address */
7750 	struct ether_addr	remoteMacAddr;		/**< remote mac address */
7751 	wl_proxd_params_tof_tune_t params;
7752 } BWL_POST_PACKED_STRUCT wl_proxd_collect_header_t;
7753 #include <packed_section_end.h>
7754 
7755 
7756 /* ifdef WL_NAN */
7757 /*  ********************** NAN wl interface struct types and defs ******************** */
7758 /*
7759  * Uses new common IOVAR batch processing mechanism
7760  */
7761 
7762 /*
7763  * NAN config control
7764  * Bits 0 - 23 can be set by host
7765  * Bits 24 - 31 - Internal use for firmware, host cannot set it
7766  */
7767 
7768 /*
7769  * Bit 0 : If set to 1, means event uses nan bsscfg,
7770  * otherwise uses infra bsscfg. Default is using infra bsscfg
7771  */
7772 #define WL_NAN_CTRL_ROUTE_EVENT_VIA_NAN_BSSCFG	0x1
7773 /* If set, discovery beacons are transmitted on 2G band */
7774 #define WL_NAN_CTRL_DISC_BEACON_TX_2G		0x2
7775 /* If set, sync beacons are transmitted on 2G band */
7776 #define WL_NAN_CTRL_SYNC_BEACON_TX_2G		0x4
7777 /* If set, discovery beacons are transmitted on 5G band */
7778 #define WL_NAN_CTRL_DISC_BEACON_TX_5G		0x8
7779 /* If set, sync beacons are transmitted on 5G band */
7780 #define WL_NAN_CTRL_SYNC_BEACON_TX_5G		0x10
7781 /* If set, auto datapath responses will be sent by FW */
7782 #define WL_NAN_CTRL_AUTO_DPRESP			0x20
7783 /* If set, auto datapath confirms will be sent by FW */
7784 #define WL_NAN_CTRL_AUTO_DPCONF			0x40
7785 
7786 /* Value when all host-configurable bits set */
7787 #define WL_NAN_CTRL_MAX_MASK			0xFFFFFF
7788 #define WL_NAN_CFG_CTRL_FW_BITS			8
7789 
7790 /* Bit 31:
7791  * If set - indicates that NAN initialization is successful
7792  * NOTE: This is a ready-only bit. All sets to this are masked off
7793  */
7794 #define WL_NAN_PROTO_INIT_DONE		0x80000000
7795 #define WL_NAN_GET_PROTO_INIT_STATUS(x) \
7796 		(((x) >> 31) & 1)
7797 #define WL_NAN_CLEAR_PROTO_INIT_STATUS(x) \
7798 		((x) &= ~WL_NAN_PROTO_INIT_DONE)
7799 #define WL_NAN_SET_PROTO_INIT_STATUS(x) \
7800 		((x) |= (1 << 31))
7801 
7802 #define WL_NAN_IOCTL_VERSION			0x2
7803 /* < some sufficient ioc buff size for our module */
7804 #define WL_NAN_IOC_BUFSZ			256
7805 /* some sufficient ioc buff size for dump commands */
7806 #define WL_NAN_IOC_BUFSZ_EXT			1024
7807 #define WL_NAN_MAX_SIDS_IN_BEACONS		127 /* Max allowed SIDs */
7808 #define WL_NAN_MASTER_RANK_LEN			8
7809 #define WL_NAN_RANGE_LIMITED			0x0040 /* Publish/Subscribe flags */
7810 
7811 /** The service hash (service id) is exactly this many bytes. */
7812 #define WL_NAN_SVC_HASH_LEN			6
7813 #define WL_NAN_HASHES_PER_BLOOM			4 /** Number of hash functions per bloom filter */
7814 
7815 /* no. of max last disc results */
7816 #define WL_NAN_MAX_DISC_RESULTS			3
7817 
7818 /* Max len of Rx and Tx filters */
7819 #define WL_NAN_MAX_SVC_MATCH_FILTER_LEN	255
7820 
7821 /* Max service name len */
7822 #define WL_NAN_MAX_SVC_NAME_LEN	32
7823 
7824 /* Type of Data path connection */
7825 #define WL_NAN_DP_TYPE_UNICAST			0
7826 #define WL_NAN_DP_TYPE_MULTICAST		1
7827 
7828 /* MAX security params length PMK field */
7829 #define WL_NAN_NCS_SK_PMK_LEN 32
7830 
7831 /* Post disc attr ID type */
7832 typedef uint8 wl_nan_post_disc_attr_id_t;
7833 
7834 /*
7835  * Component IDs
7836  */
7837 typedef enum {
7838 	WL_NAN_COMPID_CONFIG = 1,
7839 	WL_NAN_COMPID_ELECTION = 2,
7840 	WL_NAN_COMPID_SD = 3,
7841 	WL_NAN_COMPID_TIMESYNC = 4,
7842 	WL_NAN_COMPID_DATA_PATH = 5,
7843 	WL_NAN_COMPID_DEBUG = 15 /* Keep this at the end */
7844 } wl_nan_comp_id_t;
7845 
7846 #define WL_NAN_COMP_SHIFT	8
7847 #define WL_NAN_COMP_MASK(_c)	(0x0F & ((uint8)(_c)))
7848 #define WL_NAN_COMP_ID(_c)	(WL_NAN_COMP_MASK(_c) << WL_NAN_COMP_SHIFT)
7849 
7850 /* NAN Events */
7851 
7852 /** Instance ID type (unique identifier) */
7853 typedef uint8 wl_nan_instance_id_t;
7854 
7855 /* Publish sent for a subscribe */
7856 /* WL_NAN_EVENT_REPLIED */
7857 
7858 typedef struct wl_nan_ev_replied {
7859 	struct ether_addr	sub_mac; /* Subscriber MAC */
7860 	wl_nan_instance_id_t	pub_id; /* Publisher Instance ID */
7861 	uint8			sub_id; /* Subscriber ID */
7862 	int8			sub_rssi; /* Subscriber RSSI */
7863 	uint8			pad[3];
7864 } wl_nan_ev_replied_t;
7865 
7866 typedef struct wl_nan_event_replied {
7867 	struct ether_addr	sub_mac; /* Subscriber MAC */
7868 	wl_nan_instance_id_t	pub_id; /* Publisher Instance ID */
7869 	uint8			sub_id; /* Subscriber ID */
7870 	int8			sub_rssi; /* Subscriber RSSI */
7871 	uint8		attr_num;
7872 	uint16		attr_list_len;  /* sizeof attributes attached to payload */
7873 	uint8		attr_list[0];   /* attributes payload */
7874 } wl_nan_event_replied_t;
7875 
7876 /* Subscribe or Publish instance Terminated */
7877 
7878 /* WL_NAN_EVENT_TERMINATED */
7879 
7880 #define	NAN_SD_TERM_REASON_TIMEOUT	1
7881 #define	NAN_SD_TERM_REASON_HOSTREQ	2
7882 #define	NAN_SD_TERM_REASON_FWTERM	3
7883 #define	NAN_SD_TERM_REASON_FAIL		4
7884 
7885 typedef struct wl_nan_ev_terminated {
7886 	uint8 instance_id;	/* publish / subscribe instance id */
7887 	uint8 reason;		/* 1=timeout, 2=Host/IOVAR, 3=FW Terminated 4=Failure */
7888 	uint8 svctype;		/* 0 - Publish, 0x1 - Subscribe */
7889 	uint8 pad;		/* Align */
7890 } wl_nan_ev_terminated_t;
7891 
7892 /* Follow up received against a pub / subscr */
7893 /* WL_NAN_EVENT_RECEIVE */
7894 
7895 typedef struct wl_nan_ev_receive {
7896 	struct ether_addr remote_addr;	/* Peer NAN device MAC */
7897 	uint8	local_id;		/* Local subscribe or publish ID */
7898 	uint8	remote_id;		/* Remote subscribe or publish ID */
7899 	int8	fup_rssi;
7900 	uint8	attr_num;
7901 	uint16	attr_list_len;  /* sizeof attributes attached to payload */
7902 	uint8	attr_list[0];   /* attributes payload */
7903 } wl_nan_ev_receive_t;
7904 
7905 /*
7906  * TLVs - Below XTLV definitions will be deprecated
7907  * in due course (soon as all other branches update
7908  * to the comp ID based XTLVs listed below).
7909  */
7910 enum wl_nan_cmd_xtlv_id {
7911 	WL_NAN_XTLV_MAC_ADDR = 0x120,
7912 	WL_NAN_XTLV_MATCH_RX = 0x121,
7913 	WL_NAN_XTLV_MATCH_TX = 0x122,
7914 	WL_NAN_XTLV_SVC_INFO = 0x123,
7915 	WL_NAN_XTLV_SVC_NAME = 0x124,
7916 	WL_NAN_XTLV_SR_FILTER = 0x125,
7917 	WL_NAN_XTLV_FOLLOWUP = 0x126,
7918 	WL_NAN_XTLV_SVC_LIFE_COUNT = 0x127,
7919 	WL_NAN_XTLV_AVAIL = 0x128,
7920 	WL_NAN_XTLV_SDF_RX = 0x129,
7921 	WL_NAN_XTLV_SDE_CONTROL = 0x12a,
7922 	WL_NAN_XTLV_SDE_RANGE_LIMIT = 0x12b,
7923 	WL_NAN_XTLV_NAN_AF = 0x12c,
7924 	WL_NAN_XTLV_SD_TERMINATE = 0x12d,
7925 	WL_NAN_XTLV_CLUSTER_ID = 0x12e,
7926 	WL_NAN_XTLV_PEER_RSSI = 0x12f,
7927 	WL_NAN_XTLV_BCN_RX = 0x130,
7928 	WL_NAN_XTLV_REPLIED = 0x131, /* Publish sent for a subscribe */
7929 	WL_NAN_XTLV_RECEIVED = 0x132, /* FUP Received */
7930 	WL_NAN_XTLV_DISC_RESULTS = 0x133 /* Discovery results */
7931 };
7932 
7933 #define WL_NAN_CMD_GLOBAL		0x00
7934 #define WL_NAN_CMD_CFG_COMP_ID		0x01
7935 #define WL_NAN_CMD_ELECTION_COMP_ID	0x02
7936 #define WL_NAN_CMD_SD_COMP_ID		0x03
7937 #define WL_NAN_CMD_SYNC_COMP_ID		0x04
7938 #define WL_NAN_CMD_DATA_COMP_ID		0x05
7939 #define WL_NAN_CMD_DAM_COMP_ID		0x06
7940 #define WL_NAN_CMD_RANGE_COMP_ID	0x07
7941 #define WL_NAN_CMD_DBG_COMP_ID		0x0f
7942 
7943 #define WL_NAN_CMD_COMP_SHIFT		8
7944 #define NAN_CMD(x, y)  (((x) << WL_NAN_CMD_COMP_SHIFT) | (y))
7945 
7946 /*
7947  * Module based NAN TLV IDs
7948  */
7949 typedef enum wl_nan_tlv {
7950 
7951 	WL_NAN_XTLV_CFG_MATCH_RX	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x01),
7952 	WL_NAN_XTLV_CFG_MATCH_TX	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x02),
7953 	WL_NAN_XTLV_CFG_SR_FILTER	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x03),
7954 	WL_NAN_XTLV_CFG_SVC_NAME	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x04),
7955 	WL_NAN_XTLV_CFG_NAN_STATUS	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x05),
7956 	WL_NAN_XTLV_CFG_SVC_LIFE_COUNT	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x06),
7957 	WL_NAN_XTLV_CFG_SVC_HASH	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x07),
7958 	WL_NAN_XTLV_CFG_SEC_CSID	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x08), /* Security CSID */
7959 	WL_NAN_XTLV_CFG_SEC_PMK		= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x09), /* Security PMK */
7960 	WL_NAN_XTLV_CFG_SEC_PMKID	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0A),
7961 
7962 	WL_NAN_XTLV_SD_SVC_INFO		= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x01),
7963 	WL_NAN_XTLV_SD_FOLLOWUP		= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x02),
7964 	WL_NAN_XTLV_SD_SDF_RX		= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x03),
7965 	WL_NAN_XTLV_SD_SDE_CONTROL	= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x04),
7966 	WL_NAN_XTLV_SD_SDE_RANGE_LIMIT	= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x05),
7967 	WL_NAN_XTLV_SD_NAN_AF		= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x06),
7968 	WL_NAN_XTLV_SD_TERM		= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x07),
7969 	WL_NAN_XTLV_SD_REPLIED		= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x08), /* Pub sent */
7970 	WL_NAN_XTLV_SD_FUP_RECEIVED	= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x09), /* FUP Received */
7971 	WL_NAN_XTLV_SD_DISC_RESULTS	= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0A), /* Pub RX */
7972 
7973 	WL_NAN_XTLV_SYNC_BCN_RX		= NAN_CMD(WL_NAN_CMD_SYNC_COMP_ID, 0x01),
7974 
7975 	WL_NAN_XTLV_DATA_DP_END		= NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x01),
7976 	WL_NAN_XTLV_DATA_DP_INFO	= NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x02),
7977 	WL_NAN_XTLV_DATA_DP_SEC_INST	= NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x03),
7978 
7979 	WL_NAN_XTLV_RANGE_INFO		= NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x01)
7980 } wl_nan_tlv_t;
7981 
7982 enum wl_nan_sub_cmd_xtlv_id {
7983 
7984 	/* Special command - Tag zero */
7985 	WL_NAN_CMD_GLB_NAN_VER = NAN_CMD(WL_NAN_CMD_GLOBAL, 0x00),
7986 
7987 	 /* nan cfg sub-commands */
7988 
7989 	WL_NAN_CMD_CFG_NAN_INIT = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x01),
7990 	WL_NAN_CMD_CFG_ROLE = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x02),
7991 	WL_NAN_CMD_CFG_HOP_CNT = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x03),
7992 	WL_NAN_CMD_CFG_HOP_LIMIT = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x04),
7993 	WL_NAN_CMD_CFG_WARMUP_TIME = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x05),
7994 	WL_NAN_CMD_CFG_STATUS = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x06),
7995 	WL_NAN_CMD_CFG_OUI = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x07),
7996 	WL_NAN_CMD_CFG_COUNT = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x08),
7997 	WL_NAN_CMD_CFG_CLEARCOUNT = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x09),
7998 	WL_NAN_CMD_CFG_CHANNEL = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0A),
7999 	WL_NAN_CMD_CFG_BAND = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0B),
8000 	WL_NAN_CMD_CFG_CID = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0C),
8001 	WL_NAN_CMD_CFG_IF_ADDR = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0D),
8002 	WL_NAN_CMD_CFG_BCN_INTERVAL = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0E),
8003 	WL_NAN_CMD_CFG_SDF_TXTIME = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0F),
8004 	WL_NAN_CMD_CFG_SID_BEACON = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x10),
8005 	WL_NAN_CMD_CFG_DW_LEN = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x11),
8006 	WL_NAN_CMD_CFG_AVAIL = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x12),
8007 	WL_NAN_CMD_CFG_WFA_TM = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x13),
8008 	WL_NAN_CMD_CFG_EVENT_MASK =  NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x14),
8009 	WL_NAN_CMD_CFG_NAN_CONFIG = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x15),
8010 	WL_NAN_CMD_CFG_NAN_ENAB = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x16),
8011 	WL_NAN_CMD_CFG_ULW = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x17),
8012 	WL_NAN_CMD_CFG_MAX = WL_NAN_CMD_CFG_NAN_ENAB,
8013 	/* Add new commands before and update */
8014 
8015 	/* nan election sub-commands */
8016 	WL_NAN_CMD_ELECTION_JOIN = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x04), /* Deprecated */
8017 	WL_NAN_CMD_ELECTION_STOP = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x07), /* Deprecate */
8018 
8019 	WL_NAN_CMD_ELECTION_HOST_ENABLE = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x01),
8020 	WL_NAN_CMD_ELECTION_METRICS_CONFIG = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x02),
8021 	WL_NAN_CMD_ELECTION_METRICS_STATE = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x03),
8022 	WL_NAN_CMD_ELECTION_LEAVE = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x03),
8023 	WL_NAN_CMD_ELECTION_MERGE = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x04),
8024 	WL_NAN_CMD_ELECTION_ADVERTISERS = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x05),
8025 	WL_NAN_CMD_ELECTION_RSSI_THRESHOLD = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x06),
8026 	WL_NAN_CMD_ELECTION_MAX = WL_NAN_CMD_ELECTION_RSSI_THRESHOLD,
8027 	/* New commands go before and update */
8028 
8029 	/* nan SD sub-commands */
8030 	WL_NAN_CMD_SD_PARAMS = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x01),
8031 	WL_NAN_CMD_SD_PUBLISH = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x02),
8032 	WL_NAN_CMD_SD_PUBLISH_LIST = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x03),
8033 	WL_NAN_CMD_SD_CANCEL_PUBLISH = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x04),
8034 	WL_NAN_CMD_SD_SUBSCRIBE = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x05),
8035 	WL_NAN_CMD_SD_SUBSCRIBE_LIST = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x06),
8036 	WL_NAN_CMD_SD_CANCEL_SUBSCRIBE = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x07),
8037 	WL_NAN_CMD_SD_VND_INFO = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x08),
8038 	WL_NAN_CMD_SD_STATS = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x09),
8039 	WL_NAN_CMD_SD_TRANSMIT = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0A),
8040 	WL_NAN_CMD_SD_FUP_TRANSMIT = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0B),
8041 	WL_NAN_CMD_SD_CONNECTION = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0C),
8042 	WL_NAN_CMD_SD_SHOW = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0D),
8043 	WL_NAN_CMD_SD_MAX = WL_NAN_CMD_SD_SHOW,
8044 
8045 	/* nan time sync sub-commands */
8046 
8047 	WL_NAN_CMD_SYNC_SOCIAL_CHAN = NAN_CMD(WL_NAN_CMD_SYNC_COMP_ID, 0x01),
8048 	WL_NAN_CMD_SYNC_AWAKE_DWS = NAN_CMD(WL_NAN_CMD_SYNC_COMP_ID, 0x02),
8049 	WL_NAN_CMD_SYNC_BCN_RSSI_NOTIF_THRESHOLD = NAN_CMD(WL_NAN_CMD_SYNC_COMP_ID, 0x03),
8050 	WL_NAN_CMD_SYNC_MAX = WL_NAN_CMD_SYNC_BCN_RSSI_NOTIF_THRESHOLD,
8051 
8052 	/* nan2 commands */
8053 	WL_NAN_CMD_DATA_CONFIG = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x01),
8054 	WL_NAN_CMD_DATA_RSVD02 = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x02),
8055 	WL_NAN_CMD_DATA_RSVD03 = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x03),
8056 	WL_NAN_CMD_DATA_DATAREQ = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x04),
8057 	WL_NAN_CMD_DATA_DATARESP = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x05),
8058 	WL_NAN_CMD_DATA_DATAEND = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x06),
8059 	WL_NAN_CMD_DATA_SCHEDUPD = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x07),
8060 	WL_NAN_CMD_DATA_RSVD08 = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x08),
8061 	WL_NAN_CMD_DATA_CAP = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x9),
8062 	WL_NAN_CMD_DATA_STATUS = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0A),
8063 	WL_NAN_CMD_DATA_STATS = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0B),
8064 	WL_NAN_CMD_DATA_RSVD0C = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0C),
8065 	WL_NAN_CMD_DATA_NDP_SHOW = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0D),
8066 	WL_NAN_CMD_DATA_DATACONF = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0E),
8067 	WL_NAN_CMD_DATA_MIN_TX_RATE = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0F),
8068 	WL_NAN_CMD_DATA_MAX_PEERS = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x10),
8069 	WL_NAN_CMD_DATA_PATH_MAX = WL_NAN_CMD_DATA_MAX_PEERS, /* New ones before and update */
8070 
8071 	/* nan dam sub-commands */
8072 	WL_NAN_CMD_DAM_CFG = NAN_CMD(WL_NAN_CMD_DAM_COMP_ID, 0x01),
8073 	WL_NAN_CMD_DAM_MAX = WL_NAN_CMD_DAM_CFG,  /* New ones before and update */
8074 
8075 	/* nan2.0 ranging commands */
8076 	WL_NAN_CMD_RANGE_REQUEST = NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x01),
8077 	WL_NAN_CMD_RANGE_AUTO = NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x02),
8078 	WL_NAN_CMD_RANGE_RESPONSE = NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x03),
8079 	WL_NAN_CMD_RANGE_CANCEL = NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x04),
8080 
8081 	/*  nan debug sub-commands  */
8082 	WL_NAN_CMD_DBG_SCAN_PARAMS = NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x01),
8083 	WL_NAN_CMD_DBG_SCAN = NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x02),
8084 	WL_NAN_CMD_DBG_SCAN_RESULTS =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x03),
8085 	/* This is now moved under CFG */
8086 	WL_NAN_CMD_DBG_EVENT_MASK =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x04),
8087 	WL_NAN_CMD_DBG_EVENT_CHECK =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x05),
8088 	WL_NAN_CMD_DBG_DUMP =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x06),
8089 	WL_NAN_CMD_DBG_CLEAR =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x07),
8090 	WL_NAN_CMD_DBG_RSSI =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x08),
8091 	WL_NAN_CMD_DBG_DEBUG =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x09),
8092 	WL_NAN_CMD_DBG_TEST1 =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0A),
8093 	WL_NAN_CMD_DBG_TEST2 =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0B),
8094 	WL_NAN_CMD_DBG_TEST3 =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0C),
8095 	WL_NAN_CMD_DBG_DISC_RESULTS =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0D),
8096 	WL_NAN_CMD_DBG_STATS =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0E),
8097 	WL_NAN_CMD_DBG_LEVEL =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0F),
8098 	WL_NAN_CMD_DBG_MAX = WL_NAN_CMD_DBG_LEVEL /* New ones before and update */
8099 };
8100 
8101 /** status - TBD BCME_ vs NAN status - range reserved for BCME_ */
8102 enum {
8103 	/* add new status here... */
8104 	WL_NAN_E_SEC_SA_NOTFOUND	= -2076,
8105 	WL_NAN_E_BSSCFG_NOTFOUND	= -2075,
8106 	WL_NAN_E_SCB_NOTFOUND		= -2074,
8107 	WL_NAN_E_NCS_SK_KDESC_TYPE      = -2073,
8108 	WL_NAN_E_NCS_SK_KEY_DESC_VER    = -2072,	/* key descr ver */
8109 	WL_NAN_E_NCS_SK_KEY_TYPE        = -2071,	/* key descr type */
8110 	WL_NAN_E_NCS_SK_KEYINFO_FAIL    = -2070,	/* key info (generic) */
8111 	WL_NAN_E_NCS_SK_KEY_LEN         = -2069,	/* key len */
8112 	WL_NAN_E_NCS_SK_KDESC_NOT_FOUND = -2068,	/* key desc not found */
8113 	WL_NAN_E_NCS_SK_INVALID_PARAMS  = -2067,	/* invalid args */
8114 	WL_NAN_E_NCS_SK_KDESC_INVALID   = -2066,	/* key descr is not valid */
8115 	WL_NAN_E_NCS_SK_NONCE_MISMATCH  = -2065,
8116 	WL_NAN_E_NCS_SK_KDATA_SAVE_FAIL = -2064,	/* not able to save key data */
8117 	WL_NAN_E_NCS_SK_AUTH_TOKEN_CALC_FAIL = -2063,
8118 	WL_NAN_E_NCS_SK_PTK_CALC_FAIL   = -2062,
8119 	WL_NAN_E_INVALID_STARTOFFSET	= -2061,
8120 	WL_NAN_E_BAD_NA_ENTRY_TYPE	= -2060,
8121 	WL_NAN_E_INVALID_CHANBMP	= -2059,
8122 	WL_NAN_E_INVALID_OP_CLASS	= -2058,
8123 	WL_NAN_E_NO_IES			= -2057,
8124 	WL_NAN_E_NO_PEER_ENTRY_AVAIL	= -2056,
8125 	WL_NAN_E_INVALID_PEER		= -2055,
8126 	WL_NAN_E_PEER_EXISTS		= -2054,
8127 	WL_NAN_E_PEER_NOTFOUND		= -2053,
8128 	WL_NAN_E_NO_MEM			= -2052,
8129 	WL_NAN_E_INVALID_OPTION		= -2051,
8130 	WL_NAN_E_INVALID_BAND		= -2050,
8131 	WL_NAN_E_INVALID_MAC		= -2049,
8132 	WL_NAN_E_BAD_INSTANCE		= -2048,
8133 	WL_NAN_E_NDC_EXISTS		= -2047,
8134 	WL_NAN_E_NO_NDC_ENTRY_AVAIL	= -2046,
8135 	WL_NAN_E_INVALID_NDC_ENTRY      = -2045,
8136 	WL_NAN_E_ERROR			= -1,
8137 	WL_NAN_E_OK			= 0
8138 };
8139 
8140 typedef int32 wl_nan_status_t;
8141 
8142 /** nan cmd list entry  */
8143 enum wl_nan_sub_cmd_input_flags {
8144 	WL_NAN_SUB_CMD_FLAG_NONE = 0,
8145 	WL_NAN_SUB_CMD_FLAG_SKIP = 1, /* Skip to next sub-command on error */
8146 	WL_NAN_SUB_CMD_FLAG_TERMINATE = 2, /* Terminate processing and return */
8147 	WL_NAN_SUB_CMD_FLAG_LAST /* Keep this at the end */
8148 };
8149 
8150 /** container for nan events */
8151 typedef struct wl_nan_ioc {
8152 	uint16	version;	/**< interface command or event version */
8153 	uint16	id;			/**< nan ioctl cmd  ID  */
8154 	uint16	len;		/**< total length of all tlv records in data[]  */
8155 	uint16	pad;		/**< pad to be 32 bit aligment */
8156 	uint8	data [];	/**< var len payload of bcm_xtlv_t type */
8157 } wl_nan_ioc_t;
8158 
8159 /*
8160  * NAN sub-command data structures
8161  */
8162 
8163 /*
8164  * Config component WL_NAN_CMD_CFG_XXXX sub-commands
8165  * WL_NAN_CMD_CFG_ENABLE
8166  */
8167 enum wl_nan_config_state {
8168 	WL_NAN_CONFIG_STATE_DISABLE = 0,
8169 	WL_NAN_CONFIG_STATE_ENABLE = 1
8170 };
8171 
8172 typedef int8 wl_nan_config_state_t;
8173 
8174 /* WL_NAN_CMD_CFG_NAN_INIT */
8175 
8176 typedef uint8 wl_nan_init_t;
8177 
8178 /* WL_NAN_CMD_CFG_NAN_VERSION */
8179 typedef uint16 wl_nan_ver_t;
8180 
8181 /* WL_NAN_CMD_CFG_NAN_CONFIG  */
8182 typedef uint32 wl_nan_cfg_ctrl_t;
8183 
8184 /*
8185  * WL_NAN_CMD_CFG_BAND, WL_NAN_CMD_CFG_RSSI_THRESHOLD(Get only)
8186  */
8187 typedef uint8 wl_nan_band_t;
8188 
8189 /*
8190  * WL_NAN_CMD_CFG_ROLE
8191  */
8192 enum wl_nan_role {
8193 	WL_NAN_ROLE_AUTO = 0,
8194 	WL_NAN_ROLE_NON_MASTER_NON_SYNC = 1,
8195 	WL_NAN_ROLE_NON_MASTER_SYNC = 2,
8196 	WL_NAN_ROLE_MASTER = 3,
8197 	WL_NAN_ROLE_ANCHOR_MASTER = 4
8198 };
8199 
8200 typedef uint8 wl_nan_role_t;
8201 
8202 typedef struct wl_nan_device_state
8203 {
8204 	wl_nan_role_t role;		/* Sync Master, Non-Sync Master */
8205 	uint8 state;	/* TBD  */
8206 	uint8 hopcount;	/* Hops to the Anchor Master */
8207 	struct ether_addr immediate_master; /* Master MAC */
8208 	struct ether_addr anchor_master;	/* Anchor Master MAC */
8209 	struct ether_addr cluster_id; /* Cluster ID to which this device belongs to */
8210 	uint8 PAD[3];
8211 	uint32 tsf_high;  /* NAN Cluster TSFs */
8212 	uint32 tsf_low;
8213 } wl_nan_device_state_t;
8214 
8215 /*
8216  * WL_NAN_CMD_CFG_HOP_CNT, WL_NAN_CMD_CFG_HOP_LIMIT
8217  */
8218 typedef uint8 wl_nan_hop_count_t;
8219 
8220 /*
8221  * WL_NAN_CMD_CFG_WARMUP_TIME
8222  */
8223 typedef uint32 wl_nan_warmup_time_ticks_t;
8224 
8225 /*
8226  * WL_NAN_CMD_CFG_RSSI_THRESHOLD
8227  * rssi_close and rssi_mid are used to transition master to non-master
8228  * role by NAN state machine. rssi thresholds corresponding to the band
8229  * will be updated.
8230  */
8231 /* To be deprecated */
8232 typedef struct wl_nan_rssi_threshold {
8233 	wl_nan_band_t band;
8234 	int8 rssi_close;
8235 	int8 rssi_mid;
8236 	uint8 pad;
8237 } wl_nan_rssi_threshold_t;
8238 
8239 /* WL_NAN_CMD_ELECTION_RSSI_THRESHOLD */
8240 
8241 typedef struct wl_nan_rssi_thld {
8242 	int8 rssi_close_2g;
8243 	int8 rssi_mid_2g;
8244 	int8 rssi_close_5g;
8245 	int8 rssi_mid_5g;
8246 } wl_nan_rssi_thld_t;
8247 
8248 /* WL_NAN_CMD_DATA_MAX_PEERS */
8249 
8250 typedef uint8 wl_nan_max_peers_t;
8251 
8252 #define NAN_MAX_BANDS 2
8253 /*
8254  * WL_NAN_CMD_CFG_STATUS
8255  */
8256 /* Deprecated - Begin */
8257 typedef struct wl_nan_cfg_status {
8258 	uint8 enabled;
8259 	uint8 inited;
8260 	uint8 joined;
8261 	uint8 merged;
8262 	uint8 role;
8263 	uint8 PAD[3];
8264 	uint32 chspec[2];
8265 	uint8 mr[8];                    /**< Master Rank */
8266 	uint8 amr[8];			/**< Anchor Master Rank */
8267 	uint32 cnt_pend_txfrm;		/**< pending TX frames */
8268 	uint32 cnt_bcn_tx;		/**< TX disc/sync beacon count */
8269 	uint32 cnt_bcn_rx;		/**< RX disc/sync beacon count */
8270 	uint32 cnt_svc_disc_tx;		/**< TX svc disc frame count */
8271 	uint32 cnt_svc_disc_rx;		/**< RX svc disc frame count */
8272 	uint32 ambtt;                   /**< Anchor master beacon target time */
8273 	struct ether_addr cid;          /**< Cluster id */
8274 	uint8 hop_count;                /**< Hop count */
8275 	uint8 PAD;
8276 } wl_nan_cfg_status_t;
8277 
8278 typedef struct wl_nan_config_status {
8279 	struct ether_addr	def_cid;	/* Default Cluster id */
8280 	uint8			inited;		/* NAN Initialized successfully */
8281 	uint8			enabled;	/* NAN Enabled */
8282 	struct ether_addr	cur_cid;	/* Default Cluster id */
8283 	uint8			joined;		/* Joined or started own cluster */
8284 	uint8			role;		/* Master, Non Master, NM Sync & Non-Sync */
8285 	chanspec_t		chspec[NAN_MAX_BANDS]; /* Channel Spec 2.4G followed by 5G */
8286 	uint8			mr[WL_NAN_MASTER_RANK_LEN]; /* Master Rank */
8287 	uint8			amr[WL_NAN_MASTER_RANK_LEN]; /* Anchor Master Rank */
8288 	uint32			cnt_pend_txfrm;	/* Pending Tx Frames */
8289 	uint32			cnt_bcn_tx;	/* TX disc/sync beacon count */
8290 	uint32			cnt_bcn_rx;	/* RX disc/sync beacon count */
8291 	uint32			cnt_svc_disc_tx; /* TX svc disc frame count */
8292 	uint32			cnt_svc_disc_rx; /* RX svc disc frame count */
8293 	uint32			ambtt;	/* Anchor master beacon target time */
8294 	uint8			hop_count; /* Hop count */
8295 	uint8			pad[3];	/* Align */
8296 } wl_nan_config_status_t;
8297 /* Deprecated - End */
8298 
8299 typedef enum wl_nan_election_mode {
8300 	WL_NAN_ELECTION_RUN_BY_HOST = 1,
8301 	WL_NAN_ELECTION_RUN_BY_FW = 2
8302 } wl_nan_election_mode_t;
8303 
8304 typedef struct wl_nan_conf_status {
8305 	struct ether_addr	nmi;		/*  NAN mgmt interface address */
8306 	uint8			enabled;	/* NAN is enabled */
8307 	uint8			role;		/* Current nan sync role */
8308 	struct ether_addr	cid;		/*  Current Cluster id */
8309 	uint8			social_chans[2];	/* Social channels */
8310 	uint8			mr[8];		/* Master Rank */
8311 	uint8			amr[8];		/* Anchor Master Rank */
8312 	uint32			ambtt;		/* Anchor master beacon target time */
8313 	uint32			cluster_tsf_h;	/* Current Cluster TSF High */
8314 	uint32			cluster_tsf_l;	/* Current Cluster TSF Low */
8315 	uint8			election_mode; /* Election mode, host or firmware */
8316 	uint8			hop_count;	/* Current Hop count */
8317 	uint8			pad[2];
8318 } wl_nan_conf_status_t;
8319 
8320 /*
8321  * WL_NAN_CMD_CFG_OUI
8322  */
8323 typedef struct wl_nan_oui_type {
8324 	uint8 nan_oui[DOT11_OUI_LEN];
8325 	uint8 type;
8326 } wl_nan_oui_type_t;
8327 
8328 /*
8329  * WL_NAN_CMD_CFG_COUNT
8330  */
8331 typedef struct wl_nan_count {
8332 	uint32 cnt_bcn_tx;		/**< TX disc/sync beacon count */
8333 	uint32 cnt_bcn_rx;		/**< RX disc/sync beacon count */
8334 	uint32 cnt_svc_disc_tx;		/**< TX svc disc frame count */
8335 	uint32 cnt_svc_disc_rx;		/**< RX svc disc frame count */
8336 } wl_nan_count_t;
8337 /*
8338  * Election component WL_NAN_CMD_ELECTION_XXXX sub-commands
8339  * WL_NAN_CMD_ELECTION_HOST_ENABLE
8340  */
8341 enum wl_nan_enable_flags {
8342 	WL_NAN_DISABLE_FLAG_HOST_ELECTION = 0,
8343 	WL_NAN_ENABLE_FLAG_HOST_ELECTION = 1
8344 };
8345 
8346 /*
8347  * 0 - disable host based election
8348  * 1 - enable host based election
8349  */
8350 typedef uint8 wl_nan_host_enable_t;
8351 
8352 /*
8353  * WL_NAN_CMD_ELECTION_METRICS_CONFIG
8354  */
8355 /* Set only */
8356 typedef struct wl_nan_election_metric_config {
8357 	uint8 random_factor; /* Configured random factor */
8358 	uint8 master_pref;	/* configured master preference */
8359 	uint8 pad[2];
8360 } wl_nan_election_metric_config_t;
8361 
8362 /*
8363  * WL_NAN_CMD_ELECTION_METRICS_STATE
8364  */
8365 /* Get only */
8366 typedef struct wl_nan_election_metric_state {
8367 	uint8 random_factor; /* random factor used in MIs */
8368 	uint8 master_pref;	 /* Master advertised in MIs */
8369 	uint8 pad[2];
8370 } wl_nan_election_metric_state_t;
8371 
8372 /*
8373  * WL_NAN_CMD_ELECTION_LEAVE
8374  * WL_NAN_CMD_ELECTION_STOP
8375  */
8376 typedef struct ether_addr wl_nan_cluster_id_t;
8377 
8378 /*
8379  * WL_NAN_CMD_ELECTION_JOIN
8380  */
8381 typedef struct wl_nan_join {
8382 	uint8 start_cluster;	/* Start a cluster */
8383 	uint8 pad[3];
8384 	wl_nan_cluster_id_t cluster_id;	/* Cluster ID to join */
8385 } wl_nan_join_t;
8386 
8387 /*
8388  * WL_NAN_CMD_ELECTION_MERGE
8389  * 0 - disable cluster merge
8390  * 1 - enable cluster merge
8391  */
8392 typedef uint8 wl_nan_merge_enable_t;
8393 
8394 /*
8395  * WL_NAN_CMD_CFG_ROLE
8396  * role = 0 means configuration by firmware; otherwise by host
8397  * when host configures role, also need target master address to sync to
8398  */
8399 #define NAN_SYNC_MASTER_SELF	0
8400 #define NAN_SYNC_MASTER_AM		1
8401 #define NAN_SYNC_MASTER_INTERMEDIATE	2
8402 /* 	ltsf_h, ltsf_l:
8403 	The local TSF timestamp filled in by FW in the WL_NAN_EVENT_BCN_RX event;
8404 	rtsf_h, rtsf_l:
8405 	The timestamp in the Rx beacon frame, filled in by host
8406 	uint32 ambtt:
8407 	the amtt in the cluster ID attribute in the Rx beacon frame
8408 */
8409 typedef struct nan_sync_master {
8410 	uint8 flag;	/* 0: self, 1: anchor-master, 2: intermediate master */
8411 	uint8  hop_count;
8412 	struct ether_addr addr;
8413 	struct ether_addr cluster_id;
8414 	chanspec_t channel; /* bcn reception channel */
8415 	uint32 ltsf_h;
8416 	uint32 ltsf_l;
8417 	uint32 rtsf_h;
8418 	uint32 rtsf_l;
8419 	uint8 amr[WL_NAN_MASTER_RANK_LEN];
8420 	uint32 ambtt;
8421 } nan_sync_master_t;
8422 
8423 /* NAN advertiser structure */
8424 /* TODO RSDB: add chspec to indicates core corresponds correct core */
8425 typedef struct nan_adv_entry {
8426 	uint8 age;	/* used to remove stale entries */
8427 	uint8 hop_count;
8428 	struct ether_addr addr;
8429 	struct ether_addr cluster_id;
8430 	chanspec_t channel; /* bcn reception channel */
8431 	uint32 ltsf_h;
8432 	uint32 ltsf_l;
8433 	uint32 rtsf_h;
8434 	uint32 rtsf_l;
8435 	uint8 amr[WL_NAN_MASTER_RANK_LEN];
8436 	uint32 ambtt;
8437 	int8	rssi[NAN_MAX_BANDS];		/* rssi last af was received at */
8438 	int8	last_rssi[NAN_MAX_BANDS];	/* rssi in the last AF */
8439 } nan_adv_entry_t;
8440 
8441 typedef struct nan_adv_table {
8442 	uint8  num_adv;
8443 	uint8	adv_size;
8444 	uint8	pad[2];
8445 	nan_adv_entry_t adv_nodes[0];
8446 } nan_adv_table_t;
8447 
8448 typedef struct wl_nan_role_cfg {
8449 	wl_nan_role_t cfg_role;
8450 	wl_nan_role_t cur_role;
8451 	uint8 pad[2];
8452 	nan_sync_master_t target_master;
8453 } wl_nan_role_cfg_t;
8454 
8455 typedef struct wl_nan_role_config {
8456 	wl_nan_role_t role;
8457 	struct ether_addr target_master;
8458 	uint8 pad;
8459 } wl_nan_role_config_t;
8460 
8461 typedef int8 wl_nan_sd_optional_field_types_t;
8462 
8463 /* Flag bits for Publish and Subscribe (wl_nan_sd_params_t flags) */
8464 
8465 #define WL_NAN_RANGE_LIMITED		0x0040
8466 
8467 /* Event generation indicator (default is continuous) */
8468 
8469 #define WL_NAN_MATCH_ONCE		0x100000
8470 #define WL_NAN_MATCH_NEVER		0x200000
8471 
8472 /* Bits specific to Publish */
8473 
8474 #define WL_NAN_PUB_UNSOLICIT	0x1000	/* Unsolicited Tx */
8475 #define WL_NAN_PUB_SOLICIT		0x2000	/* Solicited Tx */
8476 #define WL_NAN_PUB_BOTH			0x3000	/* Both the above */
8477 
8478 #define WL_NAN_PUB_BCAST		0x4000	/* bcast solicited Tx only */
8479 #define WL_NAN_PUB_EVENT		0x8000	/* Event on each solicited Tx */
8480 #define WL_NAN_PUB_SOLICIT_PENDING	0x10000 /* Used for one-time solicited Publish */
8481 
8482 #define WL_NAN_FOLLOWUP			0x20000 /* Follow-up frames */
8483 
8484 /* Bits specific to Subscribe */
8485 
8486 #define WL_NAN_SUB_ACTIVE		0x1000 /* Active subscribe mode */
8487 #define WL_NAN_SUB_MATCH_IF_SVC_INFO	0x2000 /* Service info in publish */
8488 
8489 #define WL_NAN_TTL_UNTIL_CANCEL	0xFFFFFFFF /* Special values for time to live (ttl) parameter */
8490 
8491 /*
8492  * Publish -  runs until first transmission
8493  * Subscribe - runs until first  DiscoveryResult event
8494  */
8495 #define WL_NAN_TTL_FIRST	0
8496 
8497 /*
8498  * WL_NAN_CMD_SD_PARAMS
8499  */
8500 typedef struct wl_nan_sd_params
8501 {
8502 	uint16	length; /* length including options */
8503 	uint8	period; /* period of the unsolicited SDF xmission in DWs */
8504 	uint8   pad;
8505 	uint8	svc_hash[WL_NAN_SVC_HASH_LEN]; /* Hash for the service name */
8506 	uint8	instance_id; /* Instance of the current service */
8507 	int8	proximity_rssi; /* RSSI limit to Rx subscribe or pub SDF 0 no effect */
8508 	uint32	flags; /* bitmap representing aforesaid optional flags */
8509 	int32	ttl; /* TTL for this instance id, -1 will run till cancelled */
8510 	tlv_t	optional[1]; /* optional fields in the SDF  as appropriate */
8511 } wl_nan_sd_params_t;
8512 
8513 /*
8514  * WL_NAN_CMD_SD_PUBLISH_LIST
8515  * WL_NAN_CMD_SD_SUBSCRIBE_LIST
8516  */
8517 typedef struct wl_nan_service_info
8518 {
8519 	uint8 instance_id;	/* Publish instance ID */
8520 	uint8 service_hash[WL_NAN_SVC_HASH_LEN]; /* Hash for service name */
8521 } wl_nan_service_info_t;
8522 
8523 typedef struct wl_nan_service_list
8524 {
8525 	uint16 id_count; /* Number of registered publish/subscribe services */
8526 	wl_nan_service_info_t list[1]; /* service info defined by nan_service instance */
8527 } wl_nan_service_list_t;
8528 
8529 /*
8530  * WL_NAN_CMD_CFG_BCN_INTERVAL
8531  */
8532 typedef uint16 wl_nan_disc_bcn_interval_t;
8533 
8534 /*
8535  * WL_NAN_CMD_CFG_SDF_TXTIME
8536  */
8537 typedef uint16 wl_nan_svc_disc_txtime_t;
8538 
8539 /*
8540  * WL_NAN_CMD_CFG_STOP_BCN_TX
8541  */
8542 typedef uint16 wl_nan_stop_bcn_tx_t;
8543 
8544 /*
8545  * WL_NAN_CMD_CFG_SID_BEACON
8546  */
8547 typedef struct wl_nan_sid_beacon_control {
8548 	uint8 sid_enable;	/* Flag to indicate the inclusion of Service IDs in Beacons */
8549 	uint8 sid_count;	/* Limit for number of SIDs to be included in Beacons */
8550 	uint8 pad[2];
8551 } wl_nan_sid_beacon_control_t;
8552 
8553 /*
8554  * WL_NAN_CMD_CFG_DW_LEN
8555  */
8556 typedef uint16 wl_nan_dw_len_t;
8557 
8558 /*
8559  * WL_NAN_CMD_CFG_AWAKE_DW   Will be deprecated.
8560  */
8561 typedef struct wl_nan_awake_dw {
8562 	wl_nan_band_t band;	/* 0 - b mode 1- a mode */
8563 	uint8 interval;		/* 1 or 2 or 4 or 8 or 16 */
8564 	uint16 pad;
8565 } wl_nan_awake_dw_t;
8566 
8567 /*
8568  * WL_NAN_CMD_CFG_AWAKE_DWS
8569  */
8570 typedef struct wl_nan_awake_dws {
8571 	uint8 dw_interval_2g;	/* 2G DW interval */
8572 	uint8 dw_interval_5g;	/* 5G DW interval */
8573 	uint16 pad;
8574 } wl_nan_awake_dws_t;
8575 
8576 /* WL_NAN_CMD_SYNC_BCN_RSSI_NOTIF_THRESHOLD */
8577 
8578 typedef struct wl_nan_rssi_notif_thld {
8579 	int8 bcn_rssi_2g;
8580 	int8 bcn_rssi_5g;
8581 	int16 pad;
8582 } wl_nan_rssi_notif_thld_t;
8583 
8584 /*
8585  * WL_NAN_CMD_CFG_SOCIAL_CHAN
8586  */
8587 typedef struct wl_nan_social_channels {
8588 	uint8 soc_chan_2g;	/* 2G social channel */
8589 	uint8 soc_chan_5g;	/* 5G social channel */
8590 	uint16 pad;
8591 } wl_nan_social_channels_t;
8592 
8593 /*
8594  * WL_NAN_CMD_SD_CANCEL_PUBLISH
8595  * WL_NAN_CMD_SD_CANCEL_SUBSCRIBE
8596  */
8597 typedef uint8 wl_nan_instance_id; /* Instance ID of an active publish instance */
8598 
8599 /*
8600  * WL_NAN_CMD_SD_VND_INFO
8601  */
8602 typedef struct wl_nan_sd_vendor_info
8603 {
8604 	uint16 length; /* Size in bytes of the payload following this field */
8605 	uint8 data[];	/* Vendor Information */
8606 } wl_nan_sd_vendor_info_t;
8607 
8608 /*
8609  * WL_NAN_CMD_SD_STATS
8610  */
8611 typedef struct wl_nan_sd_stats {
8612 	uint32  sdftx;
8613 	uint32  sdfrx;
8614 	uint32  sdsrffail;
8615 	uint32  sdrejrssi;
8616 	uint32  sdfollowuprx;
8617 	uint32  sdsubmatch;
8618 	uint32  sdpubreplied;
8619 	uint32  sdmftfail1;
8620 	uint32  sdmftfail2;
8621 	uint32  sdmftfail3;
8622 	uint32  sdmftfail4;
8623 }  wl_nan_sd_stats_t;
8624 
8625 /*
8626  * WL_NAN_CMD_SD_TRANSMIT
8627  * WL_NAN_CMD_SD_FUP_TRANSMIT
8628  */
8629 typedef struct wl_nan_sd_transmit {
8630 	uint8 local_service_id; /* Sender Service ID */
8631 	uint8 requestor_service_id; /* Destination Service ID */
8632 	struct ether_addr destination_addr; /* Destination MAC */
8633 	uint16 token; /* follow_up_token when a follow-up msg is queued successfully */
8634 	uint8 priority; /* requested relative prio */
8635 	uint8 service_info_len; /* size in bytes of the service info payload */
8636 	uint8 service_info[]; /* Service Info payload */
8637 } wl_nan_sd_transmit_t;
8638 
8639 /*
8640  * WL_NAN_CMD_SYNC_TSRESERVE
8641  */
8642 /** time slot */
8643 #define NAN_MAX_TIMESLOT	32
8644 typedef struct wl_nan_timeslot {
8645 	uint32	abitmap; /**< available bitmap */
8646 	uint32 chanlist[NAN_MAX_TIMESLOT];
8647 } wl_nan_timeslot_t;
8648 
8649 /*
8650  * Deprecated
8651  *
8652  * WL_NAN_CMD_SYNC_TSRELEASE
8653  */
8654 typedef uint32 wl_nan_ts_bitmap_t;
8655 
8656 /* nan passive scan params */
8657 #define NAN_SCAN_MAX_CHCNT 8
8658 typedef struct wl_nan_scan_params {
8659 	uint16 scan_time;
8660 	uint16 home_time;
8661 	uint16 ms_intvl; /**< interval between merge scan */
8662 	uint16 ms_dur;  /**< duration of merge scan */
8663 	uint16 chspec_num;
8664 	uint8 pad[2];
8665 	chanspec_t chspec_list[NAN_SCAN_MAX_CHCNT]; /**< act. used 3, 5 rfu */
8666 } wl_nan_scan_params_t;
8667 
8668 /*
8669  * WL_NAN_CMD_DBG_SCAN
8670  */
8671 typedef struct wl_nan_dbg_scan {
8672 	struct ether_addr cid;
8673 	uint8 pad[2];
8674 } wl_nan_dbg_scan_t;
8675 
8676 /* NAN_DBG_LEVEL */
8677 typedef struct wl_nan_dbg_level {
8678 	uint32 nan_err_level; /* for Error levels */
8679 	uint32 nan_dbg_level; /* for bebug logs and trace */
8680 	uint32 nan_info_level; /* for dumps like prhex */
8681 } wl_nan_dbg_level_t;
8682 
8683 /*
8684  * WL_NAN_CMD_DBG_EVENT_MASK
8685  */
8686 typedef uint32 wl_nan_event_mask_t;
8687 
8688 /*
8689  * WL_NAN_CMD_DBG_EVENT_CHECK
8690  */
8691 typedef uint8 wl_nan_dbg_ifname[BCM_MSG_IFNAME_MAX];
8692 
8693 /*
8694  * WL_NAN_CMD_DBG_DUMP
8695  * WL_NAN_CMD_DBG_CLEAR
8696  */
8697 enum wl_nan_dbg_dump_type {
8698 	WL_NAN_DBG_DT_RSSI_DATA = 1,
8699 	WL_NAN_DBG_DT_STATS_DATA = 2,
8700 	/*
8701 	 * Additional enums before this line
8702 	 */
8703 	WL_NAN_DBG_DT_INVALID
8704 };
8705 typedef int8 wl_nan_dbg_dump_type_t;
8706 
8707 /** various params and ctl swithce for nan_debug instance  */
8708 /*
8709  * WL_NAN_CMD_DBG_DEBUG
8710  */
8711 typedef struct wl_nan_debug_params {
8712 	uint16	cmd;	/**< debug cmd to perform a debug action */
8713 	uint16	status;
8714 	uint32	msglevel; /**< msg level if enabled */
8715 	uint8	enabled; /**< runtime debuging enabled */
8716 	uint8 collect;
8717 	uint8 PAD[2];
8718 } wl_nan_debug_params_t;
8719 
8720 
8721 typedef struct wl_nan_sched_svc_timeslot_s {
8722 	uint32 abitmap; /* availability bitmap */
8723 	uint32 chanlist[NAN_MAX_TIMESLOT];
8724 	uint8  res; /* resolution: 0 = 16ms, 1 = 32ms, 2 = 64ms 3 = reserved. REfer NAN spec */
8725 	uint8  mapid; /* mapid from NAN spec. Used to differentiate 2G Vs 5G band */
8726 	uint8 PAD[2];
8727 } wl_nan_sched_svc_timeslot_t;
8728 
8729 
8730 /* nan passive scan params */
8731 #define NAN_SCAN_MAX_CHCNT 8
8732 typedef struct nan_scan_params {
8733 	uint16 scan_time;
8734 	uint16 home_time;
8735 	uint16 ms_intvl; /**< interval between merge scan */
8736 	uint16 ms_dur;  /**< duration of merge scan */
8737 	uint16 chspec_num;
8738 	uint8 pad[2];
8739 	chanspec_t chspec_list[NAN_SCAN_MAX_CHCNT]; /**< act. used 3, 5 rfu */
8740 } nan_scan_params_t;
8741 
8742 /* nan cmd IDs */
8743 enum wl_nan_cmds {
8744 	 /* nan cfg /disc & dbg ioctls */
8745 	WL_NAN_CMD_ENABLE = 1,
8746 	WL_NAN_CMD_ATTR = 2,
8747 	WL_NAN_CMD_NAN_JOIN = 3,
8748 	WL_NAN_CMD_LEAVE = 4,
8749 	WL_NAN_CMD_MERGE = 5,
8750 	WL_NAN_CMD_STATUS = 6,
8751 	WL_NAN_CMD_TSRESERVE = 7,
8752 	WL_NAN_CMD_TSSCHEDULE = 8,
8753 	WL_NAN_CMD_TSRELEASE = 9,
8754 	WL_NAN_CMD_OUI = 10,
8755 	WL_NAN_CMD_OOB_AF = 11,
8756 
8757 	WL_NAN_CMD_COUNT = 15,
8758 	WL_NAN_CMD_CLEARCOUNT = 16,
8759 
8760 	/*  discovery engine commands */
8761 	WL_NAN_CMD_PUBLISH = 20,
8762 	WL_NAN_CMD_SUBSCRIBE = 21,
8763 	WL_NAN_CMD_CANCEL_PUBLISH = 22,
8764 	WL_NAN_CMD_CANCEL_SUBSCRIBE = 23,
8765 	WL_NAN_CMD_TRANSMIT = 24,
8766 	WL_NAN_CMD_CONNECTION = 25,
8767 	WL_NAN_CMD_SHOW = 26,
8768 	WL_NAN_CMD_STOP = 27,	/* stop nan for a given cluster ID  */
8769 	/*  nan debug iovars & cmds  */
8770 	WL_NAN_CMD_SCAN_PARAMS = 46,
8771 	WL_NAN_CMD_SCAN = 47,
8772 	WL_NAN_CMD_SCAN_RESULTS = 48,
8773 	WL_NAN_CMD_EVENT_MASK = 49,
8774 	WL_NAN_CMD_EVENT_CHECK = 50,
8775 	WL_NAN_CMD_DUMP = 51,
8776 	WL_NAN_CMD_CLEAR = 52,
8777 	WL_NAN_CMD_RSSI = 53,
8778 
8779 	WL_NAN_CMD_DEBUG = 60,
8780 	WL_NAN_CMD_TEST1 = 61,
8781 	WL_NAN_CMD_TEST2 = 62,
8782 	WL_NAN_CMD_TEST3 = 63,
8783 	WL_NAN_CMD_DISC_RESULTS = 64,
8784 	/* nan 2.0 data path commands */
8785 	WL_NAN_CMD_DATAPATH = 65
8786 };
8787 
8788 /*   NAN DP interface commands  */
8789 enum wl_nan_dp_cmds {
8790 	/* nan 2.0 ioctls */
8791 	WL_NAN_CMD_DP_CAP = 1000,
8792 	WL_NAN_CMD_DP_CONFIG = 1001,
8793 	WL_NAN_CMD_DP_CREATE = 1002,
8794 	WL_NAN_CMD_DP_AUTO_CONNECT = 1003,
8795 	WL_NAN_CMD_DP_DATA_REQ = 1004,
8796 	WL_NAN_CMD_DP_DATA_RESP = 1005,
8797 	WL_NAN_CMD_DP_SCHED_UPD = 1006,
8798 	WL_NAN_CMD_DP_END = 1007,
8799 	WL_NAN_CMD_DP_CONNECT = 1008,
8800 	WL_NAN_CMD_DP_STATUS = 1009
8801 };
8802 
8803 /* TODO Should remove this fixed length */
8804 #define WL_NAN_DATA_SVC_SPEC_INFO_LEN 32 /* arbitrary */
8805 #define WL_NAN_DP_MAX_SVC_INFO	      0xFF
8806 #define WL_NAN_DATA_NDP_INST_SUPPORT 16
8807 
8808 /* Nan flags */
8809 #define WL_NAN_DP_FLAG_SVC_INFO	      (1 << 0)
8810 #define WL_NAN_DP_FLAG_CONFIRM	      (1 << 1)
8811 #define WL_NAN_DP_FLAG_EXPLICIT_CFM   (1 << 2)
8812 #define WL_NAN_DP_FLAG_SECURITY	      (1 << 3)
8813 
8814 /* NAN Datapath host status */
8815 #define WL_NAN_DP_STATUS_ACCEPTED     1
8816 #define WL_NAN_DP_STATUS_REJECTED     0
8817 
8818 /* to be done */
8819 typedef struct wl_nan_dp_cap {
8820 	uint8 tbd;
8821 } wl_nan_dp_cap_t;
8822 
8823 
8824 /** The service hash (service id) is exactly this many bytes. */
8825 #define WL_NAN_SVC_HASH_LEN	6
8826 /** Number of hash functions per bloom filter */
8827 #define WL_NAN_HASHES_PER_BLOOM 4
8828 /* no. of max last disc results */
8829 #define WL_NAN_MAX_DISC_RESULTS	3
8830 
8831 /* NAN security related defines */
8832 /* NCS-SK related */
8833 #define WL_NAN_NCS_SK_PMK_LEN	32
8834 #define WL_NAN_NCS_SK_PMKID_LEN	16
8835 
8836 /* recent discovery results */
8837 typedef struct wl_nan_disc_result_s
8838 {
8839 	wl_nan_instance_id_t instance_id;	/* instance id of pub/sub req */
8840 	wl_nan_instance_id_t peer_instance_id;	/* peer instance id of pub/sub req/resp */
8841 	uint8 svc_hash[WL_NAN_SVC_HASH_LEN];	/* service descp string */
8842 	struct ether_addr peer_mac;	/* peer mac address */
8843 } wl_nan_disc_result_t;
8844 
8845 /* list of recent discovery results */
8846 typedef struct wl_nan_disc_results_s
8847 {
8848 	wl_nan_disc_result_t disc_result[WL_NAN_MAX_DISC_RESULTS];
8849 } wl_nan_disc_results_list_t;
8850 
8851 /* nan 1.0 events */
8852 /* To be deprecated - will be replaced by event_disc_result */
8853 typedef struct wl_nan_ev_disc_result {
8854 	wl_nan_instance_id_t pub_id;
8855 	wl_nan_instance_id_t sub_id;
8856 	struct ether_addr pub_mac;
8857 	uint8 opt_tlvs[0];
8858 } wl_nan_ev_disc_result_t;
8859 
8860 typedef struct wl_nan_event_disc_result {
8861 	wl_nan_instance_id_t pub_id;
8862 	wl_nan_instance_id_t sub_id;
8863 	struct ether_addr pub_mac;
8864 	int8		publish_rssi;		/* publisher RSSI */
8865 	uint8		attr_num;
8866 	uint16		attr_list_len;	/* length of the all the attributes in the SDF */
8867 	uint8		attr_list[0];	/* list of NAN attributes */
8868 } wl_nan_event_disc_result_t;
8869 
8870 typedef struct wl_nan_ev_p2p_avail {
8871 	struct ether_addr sender;
8872 	struct ether_addr p2p_dev_addr;
8873 	uint8 dev_role;
8874 	uint8 resolution;
8875 	uint8 repeat;
8876 	uint8 pad[3];
8877 	chanspec_t chanspec;
8878 	uint32 avail_bmap;
8879 } wl_nan_ev_p2p_avail_t;
8880 
8881 /*
8882 * discovery interface event structures *
8883 */
8884 
8885 /* mandatory parameters for OOB action frame */
8886 /* single-shot when bitmap and offset are set to 0; periodic otherwise */
8887 typedef struct wl_nan_oob_af_params_s
8888 {
8889 	/* bitmap for the 32 timeslots in 512TU dw interval */
8890 	uint32 ts_map;
8891 	/* offset from start of dw, in us */
8892 	uint32 tx_offset;
8893 	struct ether_addr bssid;
8894 	struct ether_addr dest;
8895 	uint32 pkt_lifetime;
8896 	uint16 payload_len;
8897 	uint8 payload[1];
8898 } wl_nan_oob_af_params_t;
8899 
8900 /* NAN Ranging */
8901 
8902 /* Bit defines for global flags */
8903 #define WL_NAN_RANGING_ENABLE		1 /**< enable RTT */
8904 #define WL_NAN_RANGING_RANGED		2 /**< Report to host if ranged as target */
8905 typedef struct nan_ranging_config {
8906 	uint32 chanspec;		/**< Ranging chanspec */
8907 	uint16 timeslot;		/**< NAN RTT start time slot  1-511 */
8908 	uint16 duration;		/**< NAN RTT duration in ms */
8909 	struct ether_addr allow_mac;	/**< peer initiated ranging: the allowed peer mac
8910 					 * address, a unicast (for one peer) or
8911 					 * a broadcast for all. Setting it to all zeros
8912 					 * means responding to none,same as not setting
8913 					 * the flag bit NAN_RANGING_RESPOND
8914 					 */
8915 	uint16 flags;
8916 } wl_nan_ranging_config_t;
8917 
8918 /** list of peers for self initiated ranging */
8919 /** Bit defines for per peer flags */
8920 #define WL_NAN_RANGING_REPORT (1<<0)	/**< Enable reporting range to target */
8921 typedef struct nan_ranging_peer {
8922 	uint32 chanspec;		/**< desired chanspec for this peer */
8923 	uint32 abitmap;			/**< available bitmap */
8924 	struct ether_addr ea;		/**< peer MAC address */
8925 	uint8 frmcnt;			/**< frame count */
8926 	uint8 retrycnt;			/**< retry count */
8927 	uint16 flags;			/**< per peer flags, report or not */
8928 	uint16 PAD;
8929 } wl_nan_ranging_peer_t;
8930 typedef struct nan_ranging_list {
8931 	uint8 count;			/**< number of MAC addresses */
8932 	uint8 num_peers_done;		/**< host set to 0, when read, shows number of peers
8933 					 * completed, success or fail
8934 					 */
8935 	uint8 num_dws;			/**< time period to do the ranging, specified in dws */
8936 	uint8 reserve;			/**< reserved field */
8937 	wl_nan_ranging_peer_t rp[1];	/**< variable length array of peers */
8938 } wl_nan_ranging_list_t;
8939 
8940 /* ranging results, a list for self initiated ranging and one for peer initiated ranging */
8941 /* There will be one structure for each peer */
8942 #define WL_NAN_RANGING_STATUS_SUCCESS		1
8943 #define WL_NAN_RANGING_STATUS_FAIL		2
8944 #define WL_NAN_RANGING_STATUS_TIMEOUT		3
8945 #define WL_NAN_RANGING_STATUS_ABORT		4 /**< with partial results if sounding count > 0 */
8946 typedef struct nan_ranging_result {
8947 	uint8 status;			/**< 1: Success, 2: Fail 3: Timeout 4: Aborted */
8948 	uint8 sounding_count;		/**< number of measurements completed (0 = failure) */
8949 	struct ether_addr ea;		/**< initiator MAC address */
8950 	uint32 chanspec;		/**< Chanspec where the ranging was done */
8951 	uint32 timestamp;		/**< 32bits of the TSF timestamp ranging was completed at */
8952 	uint32 distance;		/**< mean distance in meters expressed as Q4 number.
8953 					 * Only valid when sounding_count > 0. Examples:
8954 					 * 0x08 = 0.5m
8955 					 * 0x10 = 1m
8956 					 * 0x18 = 1.5m
8957 					 * set to 0xffffffff to indicate invalid number
8958 					 */
8959 	int32 rtt_var;			/**< standard deviation in 10th of ns of RTTs measured.
8960 					 * Only valid when sounding_count > 0
8961 					 */
8962 	struct ether_addr tgtea;	/**< target MAC address */
8963 	uint8 PAD[2];
8964 } wl_nan_ranging_result_t;
8965 typedef struct nan_ranging_event_data {
8966 	uint8 mode;			/**< 1: Result of host initiated ranging */
8967 					/* 2: Result of peer initiated ranging */
8968 	uint8 reserved;
8969 	uint8 success_count;		/**< number of peers completed successfully */
8970 	uint8 count;			/**< number of peers in the list */
8971 	wl_nan_ranging_result_t rr[1];	/**< variable array of ranging peers */
8972 } wl_nan_ranging_event_data_t;
8973 
8974 enum {
8975 	WL_NAN_STATS_RSSI = 1,
8976 	WL_NAN_STATS_DATA = 2,
8977 	WL_NAN_STATS_DP = 3,
8978 /*
8979  * ***** ADD before this line ****
8980  */
8981 	WL_NAN_STATS_INVALID
8982 };
8983 typedef struct wl_nan_dp_stats {
8984 	uint32 tbd; /* TBD */
8985 } wl_nan_dp_stats_t;
8986 
8987 typedef struct wl_nan_stats {
8988 	/* general */
8989 	uint32 cnt_dw; /* DW slots */
8990 	uint32 cnt_disc_bcn_sch; /* disc beacon slots */
8991 	uint32 cnt_amr_exp; /* count of ambtt expiries resetting roles */
8992 	uint32 cnt_bcn_upd; /* count of beacon template updates */
8993 	uint32 cnt_bcn_tx; /* count of sync & disc bcn tx */
8994 	uint32 cnt_bcn_rx; /* count of sync & disc bcn rx */
8995 	uint32 cnt_sync_bcn_tx; /* count of sync bcn tx within DW */
8996 	uint32 cnt_disc_bcn_tx; /* count of disc bcn tx */
8997 	uint32 cnt_sdftx_bcmc; /* count of bcast/mcast sdf tx */
8998 	uint32 cnt_sdftx_uc; /* count of unicast sdf tx */
8999 	uint32 cnt_sdftx_fail; /* count of unicast sdf tx fails */
9000 	uint32 cnt_sdf_rx; /* count of  sdf rx */
9001 	/* NAN roles */
9002 	uint32 cnt_am; /* anchor master */
9003 	uint32 cnt_master; /* master */
9004 	uint32 cnt_nms; /* non master sync */
9005 	uint32 cnt_nmns; /* non master non sync */
9006 	/* TX */
9007 	uint32 cnt_err_txtime; /* txtime in sync bcn frame not a multiple of dw intv */
9008 	uint32 cnt_err_unsch_tx; /* tx while not in DW/ disc bcn slot */
9009 	uint32 cnt_err_bcn_tx; /*  beacon tx error */
9010 	uint32 cnt_sync_bcn_tx_miss; /* no. of times time delta between 2 cosequetive
9011 						* sync beacons is more than expected
9012 						*/
9013 	/* MSCH */
9014 	uint32 cnt_err_msch_reg; /* error is Dw/disc reg with msch */
9015 	uint32 cnt_err_wrong_ch_cb; /* count of msch calbacks in wrong channel */
9016 	uint32 cnt_dw_skip;	/* count of DW rejected */
9017 	uint32 cnt_disc_skip; /* count of disc bcn rejected */
9018 	uint32 cnt_dw_start_early; /* msch cb not at registered time */
9019 	uint32 cnt_dw_start_late; /* no. of delays in slot start */
9020 	/* SCANS */
9021 	uint32 cnt_mrg_scan; /* count of merge scans completed */
9022 	uint32 cnt_err_ms_rej; /* number of merge scan failed */
9023 	uint32 cnt_scan_results; /* no. of nan beacons scanned */
9024 	uint32 cnt_join_scan_rej; /* no. of join scans rejected */
9025 	uint32 cnt_nan_scan_abort; /* no. of join scans rejected */
9026 	/* enable/disable */
9027 	uint32 cnt_nan_enab; /* no. of times nan feature got enabled */
9028 	uint32 cnt_nan_disab; /* no. of times nan feature got disabled */
9029 	uint32 cnt_sync_bcn_rx; /* count of sync bcn rx within DW */
9030 } wl_nan_stats_t;
9031 
9032 #define WL_NAN_MAC_MAX_NAN_PEERS 6
9033 #define WL_NAN_MAC_MAX_RSSI_DATA_PER_PEER  10
9034 
9035 typedef struct wl_nan_nbr_rssi {
9036 	uint8 rx_chan; /* channel number on which bcn rcvd */
9037 	uint8 PAD[3];
9038 	int32 rssi_raw;  /* received rssi value */
9039 	int32 rssi_avg;  /* normalized rssi value */
9040 } wl_nan_peer_rssi_t;
9041 
9042 typedef struct wl_nan_peer_rssi_entry {
9043 	struct ether_addr mac;  /* peer mac address */
9044 	uint8 flags;   /* TODO:rssi data order: latest first, oldest first etc */
9045 	uint8 rssi_cnt;   /* rssi data sample present */
9046 	wl_nan_peer_rssi_t rssi[WL_NAN_MAC_MAX_RSSI_DATA_PER_PEER]; /* RSSI data frm peer */
9047 } wl_nan_peer_rssi_entry_t;
9048 
9049 #define WL_NAN_PEER_RSSI      0x1
9050 #define WL_NAN_PEER_RSSI_LIST 0x2
9051 
9052 typedef struct wl_nan_nbr_rssi_data {
9053 	uint8 flags;   /* this is a list or single rssi data */
9054 	uint8 peer_cnt; /* number of peers */
9055 	uint16 pad; /* padding */
9056 	wl_nan_peer_rssi_entry_t peers[1]; /* peers data list */
9057 } wl_nan_peer_rssi_data_t;
9058 
9059 /* WL_NAN_CMD_DBG_DUMP, GET Resp */
9060 typedef struct wl_nan_dbg_dump_rsp {
9061 	wl_nan_dbg_dump_type_t dump_type; /* dump data type */
9062 	uint8 pad[3];
9063 	union {
9064 		wl_nan_peer_rssi_data_t peer_rssi;
9065 		wl_nan_stats_t		nan_stats;
9066 	} u;
9067 } wl_nan_dbg_dump_rsp_t;
9068 
9069 enum nan_termination_status {
9070 	NAN_TERM_REASON_INVALID = 1,
9071 	NAN_TERM_REASON_TIMEOUT = 2,
9072 	NAN_TERM_REASON_USER_REQ = 3,
9073 	NAN_TERM_REASON_FAILURE = 4,
9074 	NAN_TERM_REASON_COUNT_REACHED = 5,
9075 	NAN_TERM_REASON_DE_SHUTDOWN = 6,
9076 	NAN_TERM_REASON_DISABLE_IN_PROGRESS = 7
9077 };
9078 
9079 /* nan2 data iovar */
9080 /* nan2 qos */
9081 typedef struct wl_nan_dp_qos
9082 {
9083 	uint8 tid;
9084 	uint8 pad;
9085 	uint16 pkt_size;
9086 	uint16 mean_rate;
9087 	uint16 svc_interval;
9088 } wl_nan_dp_qos_t;
9089 /* ndp config */
9090 typedef struct wl_nan_ndp_config
9091 {
9092 	uint8 ndp_id;
9093 	uint8 pub_id;
9094 	struct ether_addr pub_addr;
9095 	struct ether_addr data_addr;	/* configure local data addr */
9096 	struct ether_addr init_data_addr;	/* initiator data addr */
9097 	uint8 svc_spec_info[WL_NAN_DATA_SVC_SPEC_INFO_LEN];
9098 	wl_nan_dp_qos_t qos;
9099 	uint16 avail_len;
9100 	uint8 pad[3];
9101 	uint8 data[1];
9102 } wl_nan_ndp_config_t;
9103 
9104 /* nan2 device capabilities */
9105 typedef struct wl_nan_ndp_oper_cfg {
9106 	uint8 awake_dw_2g;
9107 	uint8 awake_dw_5g;
9108 	uint8 bands_supported;
9109 	uint8 op_mode;
9110 } wl_nan_ndp_oper_cfg_t;
9111 
9112 typedef uint8 wl_nan_ndp_ndpid_t;
9113 typedef uint8 wl_nan_ndp_conn_t;
9114 
9115 typedef struct wl_nan_dp_req {
9116 	uint8 type;		    /* 0- unicast 1 - multicast */
9117 	uint8 pub_id;		    /* Publisher ID */
9118 	uint16 flags;
9119 	struct ether_addr peer_mac; /* Peer's NMI addr */
9120 	struct ether_addr mcast_mac; /* Multicast addr */
9121 	wl_nan_dp_qos_t qos;
9122 	uint8 tlv_params[];	/* xtlv parameters for command */
9123 } wl_nan_dp_req_t;
9124 
9125 /* TODO  Need to replace ndp_id with lndp_id */
9126 /* Return structure to data req IOVAR */
9127 typedef struct wl_nan_dp_req_ret {
9128 	struct ether_addr indi;	    /* Initiators data mac addr */
9129 	uint8 ndp_id;		    /* Initiators ndpid */
9130 	uint8 pad;
9131 } wl_nan_dp_req_ret_t;
9132 
9133 typedef struct wl_nan_dp_resp {
9134 	uint8 type;		    /* 0- unicast 1 - multicast */
9135 	uint8 status;		    /* Accepted or Rejected */
9136 	uint8 reason_code;
9137 	/* Local NDP ID for unicast, mc_id for multicast, 0 for implicit NMSG */
9138 	uint8 ndp_id;
9139 	wl_nan_dp_qos_t qos;
9140 	/* Initiator data address for unicast or multicast address for multicast */
9141 	struct ether_addr mac_addr;
9142 	uint16 flags;
9143 	uint8 tlv_params[];	/* xtlv parameters for command */
9144 } wl_nan_dp_resp_t;
9145 
9146 /* Return structure to data resp IOVAR */
9147 typedef struct wl_nan_dp_resp_ret {
9148 	uint8 nmsgid;		    /* NMSG ID or for multicast else 0 */
9149 	uint8 pad[3];
9150 } wl_nan_dp_resp_ret_t;
9151 
9152 typedef struct wl_nan_dp_conf {
9153 	uint8 lndp_id;
9154 	uint8 status;		    /* Accepted or Rejected */
9155 	uint8 pad[2];
9156 } wl_nan_dp_conf_t;
9157 
9158 typedef struct wl_nan_dp_end
9159 {
9160 	uint8 lndp_id;
9161 	uint8 status;
9162 	uint8 pad[2];
9163 } wl_nan_dp_end_t;
9164 
9165 typedef struct wl_nan_dp_schedupd {
9166 	uint8 type;		/* 0: unicast, 1: multicast */
9167 	uint8 flags;
9168 	struct ether_addr addr;	/* peer NMI or multicast addr */
9169 	wl_nan_dp_qos_t qos;
9170 	uint8 map_id;
9171 	uint8 pad[3];
9172 } wl_nan_dp_schedupd_t;
9173 
9174 /* set: update with notification, unset: NDL setup handshake */
9175 #define WL_NAN_DP_SCHEDUPD_NOTIF (1 << 0)
9176 
9177 /* list ndp ids */
9178 typedef struct wl_nan_ndp_id_list {
9179 	uint16 ndp_count;
9180 	uint8 lndp_id[];
9181 } wl_nan_ndp_id_list_t;
9182 
9183 /* nan2 status */
9184 typedef struct ndp_session {
9185 	uint8 lndp_id;
9186 	uint8 state;
9187 	uint8 pub_id;
9188 	uint8 pad;
9189 } ndp_session_t;
9190 
9191 typedef struct wl_nan_ndp_status {
9192 	struct ether_addr peer_nmi;
9193 	struct ether_addr peer_ndi;
9194 	ndp_session_t session;
9195 	uint8 pad;
9196 } wl_nan_ndp_status_t;
9197 
9198 /* events */
9199 #define NAN_DP_SESSION_UNICAST         0
9200 #define NAN_DP_SESSION_MULTICAST       1
9201 #define NAN_DP_SECURITY_NONE           0
9202 #define NAN_DP_SECURITY_CSID           1
9203 #define NAN_DP_SECURITY_MK             2
9204 #define WL_NAN_DATA_NMSGID_LEN    8 /* 8 bytes as per nan spec */
9205 
9206 /* Common event structure for Nan Datapath
9207  * Used for sending NDP Indication, Response, Confirmation, Securty Install and Establish events
9208  */
9209 typedef struct wl_nan_ev_datapath_cmn {
9210 	uint8 type;
9211 	/* ndp_id is valid only if type is unicast */
9212 	uint8 ndp_id;
9213 	uint8 pub_id;
9214 	uint8 security;
9215 	/* Following two fields are valid only if type is unicast */
9216 	struct ether_addr initiator_ndi;
9217 	struct ether_addr responder_ndi;
9218 	struct ether_addr peer_nmi;
9219 	uint8 status;
9220 	uint8 role;
9221 	/* Following two fields are valid only if type is multicast */
9222 	uint8 nmsg_id[WL_NAN_DATA_NMSGID_LEN];
9223 	uint8 mc_id;
9224 	uint8 pad[1];
9225 	uint16 opt_tlv_len;
9226 	uint8 opt_tlvs[];
9227 } wl_nan_ev_datapath_cmn_t;
9228 
9229 typedef struct wl_nan_ev_datapath_end {
9230 	uint8 ndp_id;
9231 	uint8 status;
9232 	uint8 pad[2];
9233 	struct ether_addr peer_nmi;
9234 	struct ether_addr peer_ndi;
9235 } wl_nan_ev_datapath_end_t;
9236 
9237 /* NAN2.0 Ranging definitions */
9238 
9239 /* result indication bit map */
9240 #define NAN_RANGE_INDICATION_CONT		(1<<0)
9241 #define NAN_RANGE_INDICATION_INGRESS		(1<<1)
9242 #define NAN_RANGE_INIDICATION_EGRESS		(1<<2)
9243 
9244 /* responder flags */
9245 #define NAN_RANGE_FLAG_AUTO_ACCEPT	(1 << 0)
9246 #define NAN_RANGE_FLAG_RESULT_REQUIRED	(1 << 1)
9247 
9248 typedef struct wl_nan_range_req {
9249 	struct ether_addr peer;
9250 	uint8 publisher_id;
9251 	uint8 indication; /* bit map for result event */
9252 	uint32 resolution; /* default millimeters */
9253 	uint32 ingress; /* ingress limit in mm */
9254 	uint32 egress; /* egress limit in mm */
9255 	uint32 interval; /* max interval(in TU) b/w two ranging measurements */
9256 } wl_nan_range_req_t;
9257 
9258 #define NAN_RNG_REQ_IOV_LEN	24
9259 
9260 typedef uint8 wl_nan_range_id;
9261 
9262 typedef struct wl_nan_range_resp {
9263 	wl_nan_range_id range_id;
9264 	uint8 flags; /* auto response, range result required */
9265 	uint8 status; /* accept, reject */
9266 	uint8 indication; /* bit map for result event */
9267 	uint32 resolution; /* default millimeters */
9268 	uint32 ingress; /* ingress limit in mm */
9269 	uint32 egress; /* egress limit in mm */
9270 	uint32 interval; /* max interval(in TU) b/w two ranging measurements */
9271 } wl_nan_range_resp_t;
9272 
9273 #define NAN_RNG_RESP_IOV_LEN	20
9274 
9275 #define NAN_RNG_MAX_IOV_LEN	255
9276 
9277 typedef struct wl_nan_ev_rng_req_ind {
9278 	struct ether_addr peer_m_addr;
9279 	uint8 rng_id;
9280 	/* ftm parameters */
9281 	uint8 max_burst_dur;
9282 	uint8 min_ftm_delta;
9283 	uint8 max_num_ftm;
9284 	uint8 ftm_format_bw;
9285 	/* location info availability bit map */
9286 	uint8 lc_info_avail;
9287 	/* Last movement indication */
9288 	uint16 last_movement;
9289 	uint8 pad[2];
9290 } wl_nan_ev_rng_req_ind_t;
9291 
9292 #define NAN_RNG_REQ_IND_SIZE 14
9293 
9294 typedef struct wl_nan_ev_rng_rpt_ind {
9295 	uint32 dist_mm; /* in millimeter */
9296 	struct ether_addr peer_m_addr;
9297 	uint8 indication; /* indication definitions mentioned above */
9298 	uint8 pad;
9299 } wl_nan_ev_rng_rpt_ind_t;
9300 
9301 #define NAN_RNG_RPT_IND_SIZE 11
9302 
9303 typedef struct wl_nan_ev_rng_term_ind {
9304 	struct ether_addr peer_m_addr;
9305 	uint8 reason_code;
9306 	uint8 pad;
9307 } wl_nan_ev_rng_term_ind_t;
9308 
9309 #define NAN_RNG_TERM_IND_SIZE 7
9310 
9311 
9312 /* ********************* end of NAN section ******************************** */
9313 /* endif WL_NAN */
9314 
9315 #define P2P_NAN_IOC_BUFSZ  512 /* some sufficient ioc buff size */
9316 #define WL_P2P_NAN_IOCTL_VERSION    0x1
9317 
9318 /* container for p2p nan iovtls & events */
9319 typedef struct wl_p2p_nan_ioc {
9320 	uint16  version;    /* interface command or event version */
9321 	uint16  id;     /* p2p nan ioctl cmd  ID  */
9322 	uint16  len;        /* total length of data[]  */
9323 	uint16  pad;        /* padding */
9324 	uint8   data [];   /* var len payload of bcm_xtlv_t type */
9325 } wl_p2p_nan_ioc_t;
9326 
9327 /* p2p nan cmd IDs */
9328 enum wl_p2p_nan_cmds {
9329 	/* p2p nan cfg ioctls */
9330 	WL_P2P_NAN_CMD_ENABLE = 1,
9331 	WL_P2P_NAN_CMD_CONFIG = 2,
9332 	WL_P2P_NAN_CMD_DEL_CONFIG = 3,
9333 	WL_P2P_NAN_CMD_GET_INSTS = 4
9334 };
9335 
9336 #define WL_P2P_NAN_CONFIG_VERSION       1
9337 
9338 #define WL_P2P_NAN_DEVICE_P2P  0x0
9339 #define WL_P2P_NAN_DEVICE_GO   0x1
9340 #define WL_P2P_NAN_DEVICE_GC   0x2
9341 #define WL_P2P_NAN_DEVICE_INVAL   0xFF
9342 
9343 /* NAN P2P operation */
9344 typedef struct p2p_nan_config {
9345 	uint16 version;            /* wl_p2p_nan_config_t structure version */
9346 	uint16 len;                /* total length including version and variable IE */
9347 	uint32 flags;              /* 0x1 to NEW, 0x2 to ADD, 0x4 to DEL */
9348 	uint8  inst_id;            /* publisher/subscriber id */
9349 	uint8  inst_type;          /* publisher/subscriber */
9350 	uint8  dev_role;           /* P2P device role: 'P2P','GO' or 'GC' */
9351 	uint8  pad1;               /* padding */
9352 	uint8  resolution;         /* Availability bitmap resolution */
9353 	uint8  repeat;             /* Whether Availabilty repeat across DW */
9354 	uint16 ie_len;             /* variable ie len */
9355 	struct ether_addr dev_mac; /* P2P device addres */
9356 	uint16 pad2;               /* Padding */
9357 	uint32 avail_bmap;         /* availability interval bitmap */
9358 	uint32 chanspec;           /* Chanspec */
9359 	uint8  ie[];              /* hex ie data */
9360 } wl_p2p_nan_config_t;
9361 
9362 #define WL_P2P_NAN_SERVICE_LIST_VERSION 1
9363 typedef enum wl_nan_service_type {
9364 	WL_NAN_SVC_INST_PUBLISHER = 1,
9365 	WL_NAN_SVC_INST_SUBSCRIBER = 2
9366 } wl_nan_service_type_t;
9367 
9368 #define WL_P2P_NAN_CONFIG_NEW   0x1
9369 #define WL_P2P_NAN_CONFIG_ADD   0x2
9370 #define WL_P2P_NAN_CONFIG_DEL   0x4
9371 
9372 typedef struct wl_nan_svc_inst {
9373 	uint8  inst_id;      /* publisher/subscriber id */
9374 	uint8  inst_type;    /* publisher/subscriber */
9375 } wl_nan_svc_inst_t;
9376 
9377 typedef struct wl_nan_svc_inst_list {
9378 	uint16 version;           /* this structure version */
9379 	uint16 len;               /* total length including version and variable svc list */
9380 	uint16 count;             /* service instance count */
9381 	uint16 pad;               /* padding */
9382 	wl_nan_svc_inst_t svc[1]; /* service instance list */
9383 } wl_nan_svc_inst_list_t;
9384 
9385 #define NAN_POST_DISC_P2P_DATA_VER  1
9386 /* This structure will be used send peer p2p data with
9387  * NAN discovery result
9388  */
9389 typedef struct nan_post_disc_p2p_data {
9390 	uint8 ver;                 /* this structure version */
9391 	uint8 dev_role;            /* P2P Device role */
9392 	uint8 resolution;          /* Availability bitmap resolution */
9393 	uint8 repeat;              /* Whether Availabilty repeat across DW */
9394 	struct ether_addr dev_mac; /* P2P device addres */
9395 	uint16 pad1;               /* Padding */
9396 	uint32 chanspec;           /* Chanspec */
9397 	uint32 avl_bmp;				/* availability interval bitmap */
9398 } nan_post_disc_p2p_data_t;
9399 
9400 /* timeslot etc for NAN */
9401 enum {
9402 	WL_TMU_TU            = 0,
9403 	WL_TMU_SEC           = 1,
9404 	WL_TMU_MILLI_SEC     = 2,
9405 	WL_TMU_MICRO_SEC     = 3,
9406 	WL_TMU_NANO_SEC      = 4,
9407 	WL_TMU_PICO_SEC      = 5
9408 };
9409 typedef int16 wl_tmu_t;
9410 
9411 typedef struct {
9412 	uint32   intvl;               /* time interval */
9413 	wl_tmu_t tmu;                 /* time unit */
9414 	uint8    pad[2];              /* padding */
9415 } wl_time_interval_t;
9416 
9417 /* availabiloty slot flags */
9418 enum {
9419 	WL_AVAIL_SLOT_NONE		= 0x0000,
9420 	WL_AVAIL_SLOT_COM		= 0x0001,		/* committed */
9421 	WL_AVAIL_SLOT_POT		= 0x0002,		/* potential */
9422 	WL_AVAIL_SLOT_PROP		= 0x0004,	/* proposed -  note: not configurable */
9423 	WL_AVAIL_SLOT_PAGED		= 0x0008	/* P-NDL */
9424 	/* 0x0030 - resrved for NDC index */
9425 	/* 0x00c0 - resrved for usage preference */
9426 };
9427 typedef int16 wl_avail_slot_flags_t;
9428 
9429 #define WL_AVAIL_SLOT_NDC_MASK 0x0030 /* up to 4 NDCs */
9430 #define WL_AVAIL_SLOT_NDC_SHIFT 4
9431 #define WL_AVAIL_SLOT_NDC(_flags)  (((_flags) & WL_AVAIL_SLOT_NDC_MASK) \
9432 	 >> WL_AVAIL_SLOT_NDC_SHIFT)
9433 #define WL_AVAIL_SLOT_SET_NDC(_flags, _ndc_idx) (((_flags) & ~WL_AVAIL_SLOT_NDC_MASK) |\
9434 	((_ndc_idx) << WL_AVAIL_SLOT_NDC_SHIFT))
9435 
9436 #define WL_AVAIL_SLOT_UPREF_MASK 0x00c0 /* up to 4 usage preferences */
9437 #define WL_AVAIL_SLOT_UPREF_SHIFT 6
9438 #define WL_AVAIL_SLOT_UPREF(_flags)  (((_flags) & WL_AVAIL_SLOT_UPREF_MASK) \
9439 	 >> WL_AVAIL_SLOT_UPREF_SHIFT)
9440 #define WL_AVAIL_SLOT_SET_UPREF(_flags, _pref) (((_flags) & ~WL_AVAIL_SLOT_UPREF_MASK) |\
9441 	((_pref) << WL_AVAIL_SLOT_UPREF_SHIFT))
9442 
9443 typedef struct wl_avail_slot {
9444 	wl_avail_slot_flags_t flags;
9445 	uint16                PAD;
9446 	wl_time_interval_t    start;        /* from time ref */
9447 	wl_time_interval_t    duration;     /* from start */
9448 	uint32                chanspec;     /* channel spec */
9449 } wl_avail_slot_t;
9450 
9451 /* time reference */
9452 enum {
9453 	WL_TIME_REF_NONE        = 0,
9454 	WL_TIME_REF_DEV_TSF     = 1,
9455 	WL_TIME_REF_NAN_DW      = 2,
9456 	WL_TIME_REF_TBTT        = 3,
9457 	WL_TIME_REF_NAN_DW0     = 4
9458 };
9459 typedef int16 wl_time_ref_t;
9460 
9461 enum {
9462 	WL_AVAIL_NONE		= 0x0000,
9463 	WL_AVAIL_LOCAL		= 0x0001,
9464 	WL_AVAIL_PEER		= 0x0002,
9465 	WL_AVAIL_NDC		= 0x0003,
9466 	WL_AVAIL_IMMUTABLE	= 0x0004,
9467 	WL_AVAIL_RESPONSE	= 0x0005,
9468 	WL_AVAIL_COUNTER	= 0x0006,
9469 	WL_AVAIL_RANGING	= 0x0007,
9470 	WL_AVAIL_TYPE_MAX	= WL_AVAIL_RANGING	/* New ones before and update */
9471 };
9472 #define WL_AVAIL_TYPE_MASK	0x000F
9473 #define WL_AVAIL_FLAG_RAW_MODE	0x8000
9474 typedef int16 wl_avail_flags_t;
9475 
9476 /* availability entry flags */
9477 enum {
9478 	WL_AVAIL_ENTRY_NONE		= 0x0000,
9479 	WL_AVAIL_ENTRY_COM		= 0x0001,		/* committed */
9480 	WL_AVAIL_ENTRY_POT		= 0x0002,		/* potential */
9481 	WL_AVAIL_ENTRY_COND		= 0x0004,	/* conditional */
9482 	WL_AVAIL_ENTRY_PAGED		= 0x0008,	/* P-NDL */
9483 	WL_AVAIL_ENTRY_USAGE		= 0x0030,	/* usage preference */
9484 	WL_AVAIL_ENTRY_BIT_DUR		= 0x00c0,	/* bit duration */
9485 	WL_AVAIL_ENTRY_BAND_PRESENT	= 0x0100,	/* band present */
9486 	WL_AVAIL_ENTRY_CHAN_PRESENT	= 0x0200,	/* channel information present */
9487 	WL_AVAIL_ENTRY_CHAN_ENTRY_PRESENT	= 0x0400,	/* channel entry (opclass+bitmap) */
9488 };
9489 
9490 /* bit duration */
9491 enum {
9492 	WL_AVAIL_BIT_DUR_16	= 0,	/* 16TU */
9493 	WL_AVAIL_BIT_DUR_32	= 1,	/* 32TU */
9494 	WL_AVAIL_BIT_DUR_64	= 2,	/* 64TU */
9495 	WL_AVAIL_BIT_DUR_128	= 3,	/* 128TU */
9496 };
9497 
9498 /* period */
9499 enum {
9500 	WL_AVAIL_PERIOD_0	= 0,	/* 0TU */
9501 	WL_AVAIL_PERIOD_128	= 1,	/* 128TU */
9502 	WL_AVAIL_PERIOD_256	= 2,	/* 256TU */
9503 	WL_AVAIL_PERIOD_512	= 3,	/* 512TU */
9504 	WL_AVAIL_PERIOD_1024	= 4,	/* 1024TU */
9505 	WL_AVAIL_PERIOD_2048	= 5,	/* 2048TU */
9506 	WL_AVAIL_PERIOD_4096	= 6,	/* 4096TU */
9507 	WL_AVAIL_PERIOD_8192	= 7,	/* 8192TU */
9508 };
9509 
9510 /* band */
9511 enum {
9512 	WL_AVAIL_BAND_NONE	= 0,	/* reserved */
9513 	WL_AVAIL_BAND_SUB1G	= 1,	/* sub-1 GHz */
9514 	WL_AVAIL_BAND_2G	= 2,	/* 2.4 GHz */
9515 	WL_AVAIL_BAND_3G	= 3,	/* reserved (for 3.6 GHz) */
9516 	WL_AVAIL_BAND_5G	= 4,	/* 4.9 and 5 GHz */
9517 	WL_AVAIL_BAND_60G	= 5,	/* reserved (for 60 GHz) */
9518 };
9519 
9520 #define WL_AVAIL_ENTRY_TYPE_MASK 0x0F
9521 #define WL_AVAIL_ENTRY_USAGE_MASK 0x0030 /* up to 4 usage preferences */
9522 #define WL_AVAIL_ENTRY_USAGE_SHIFT 4
9523 #define WL_AVAIL_ENTRY_USAGE_VAL(_flags)  (((_flags) & WL_AVAIL_ENTRY_USAGE_MASK) \
9524 	>> WL_AVAIL_ENTRY_USAGE_SHIFT)
9525 
9526 #define WL_AVAIL_ENTRY_BIT_DUR_MASK 0x00c0 /* 0:16TU, 1:32TU, 2:64TU, 3:128TU */
9527 #define WL_AVAIL_ENTRY_BIT_DUR_SHIFT 6
9528 #define WL_AVAIL_ENTRY_BIT_DUR_VAL(_flags)  (((_flags) & WL_AVAIL_ENTRY_BIT_DUR_MASK) \
9529 	>> WL_AVAIL_ENTRY_BIT_DUR_SHIFT)
9530 
9531 #define WL_AVAIL_ENTRY_BAND_MASK 0x0100 /* 0=band not present, 1=present */
9532 #define WL_AVAIL_ENTRY_BAND_SHIFT 8
9533 
9534 #define WL_AVAIL_ENTRY_CHAN_MASK 0x0200 /* 0=channel info not present, 1=present */
9535 #define WL_AVAIL_ENTRY_CHAN_SHIFT 9
9536 
9537 #define WL_AVAIL_ENTRY_CHAN_ENTRY_MASK 0x0400 /* 0=chanspec, 1=hex channel entry */
9538 #define WL_AVAIL_ENTRY_CHAN_ENTRY_SHIFT 10
9539 
9540 #define WL_AVAIL_ENTRY_OPCLASS_MASK 0xFF
9541 #define WL_AVAIL_ENTRY_CHAN_BITMAP_MASK 0xFF00
9542 #define WL_AVAIL_ENTRY_CHAN_BITMAP_SHIFT 8
9543 #define WL_AVAIL_ENTRY_CHAN_BITMAP_VAL(_info) (((_info) & WL_AVAIL_ENTRY_CHAN_BITMAP_MASK) \
9544 	>> WL_AVAIL_ENTRY_CHAN_BITMAP_SHIFT)
9545 
9546 /* Used for raw channel entry field input */
9547 #define	MAX_CHAN_ENTRY_LEN 6
9548 
9549 typedef struct wl_avail_entry {
9550 	uint16		length;		/* total length */
9551 	uint16		start_offset;	/* in TUs, multiply by 16 for total offset */
9552 	union {
9553 		uint32 channel_info;	/* either chanspec or hex channel entry (opclass +
9554 					 * bitmap per NAN spec), as indicated by setting
9555 					 * WL_AVAIL_ENTRY_HEX_CHAN_ENTRY flag
9556 					 */
9557 		uint32 band;		/* defined by WL_BAND enum, 2=2.4GHz, 4=5GHz */
9558 		uint8	channel_entry[MAX_CHAN_ENTRY_LEN];
9559 	} u;				/* band or channel value, 0=all band/channels */
9560 	uint8		pad[2];
9561 	uint8		period;		/* in TUs, defined by WL_AVAIL_PERIOD enum
9562 					 * 1:128, 2:256, 3:512, 4:1024, 5:2048, 6:4096,
9563 					 * 7:8192
9564 					 */
9565 	uint8		bitmap_len;
9566 	uint16		flags;		/* defined by avail entry flags enum:
9567 					 * type, usage pref, bit duration, band, channel
9568 					 */
9569 	uint8		bitmap[];	/* time bitmap */
9570 } wl_avail_entry_t;
9571 
9572 typedef struct wl_avail {
9573 	uint16		length;		/* total length */
9574 	uint16		flags;		/* defined by WL_AVAIL enum
9575 					 * 1=local, 2=peer, 3=ndc, 4=immutable,
9576 					 * 5=response, 6=counter
9577 					 */
9578 	uint8		id;		/* id used for multiple maps/avail */
9579 	uint8		pad[3];
9580 	struct ether_addr addr;	/* peer mac address or ndc id */
9581 	uint8		num_entries;
9582 	uint8		entry_offset;
9583 	/* add additional fields above this line */
9584 	uint8		entry[];
9585 } wl_avail_t;
9586 
9587 #define WL_AVAIL_MIN_LEN(n) ((n) ? OFFSETOF(wl_avail_t, entry) + \
9588 		((n) * OFFSETOF(wl_avail_entry_t, bitmap)) : 0)
9589 
9590 /* unaligned schedule (window) */
9591 typedef struct wl_avail_ulw {
9592 	uint8	id;		/* schedule ID */
9593 	uint8	overwrite;	/* bit 0: overwrite all
9594 				 * 1-4: map ID if overwrite all is 0
9595 				 */
9596 	uint16	flags;
9597 	uint32	start;		/* start time of first ULW, in us */
9598 	uint32	dur;		/* duration of ULW, in us */
9599 	uint32	period;		/* time between consecutive ULWs, in us */
9600 	union {
9601 		uint32 chanspec;
9602 		uint32 band;
9603 		uint8 chan_entry[MAX_CHAN_ENTRY_LEN];
9604 		uint8 pad[8];
9605 	} u;
9606 	uint8	cntdwn;		/* remaining ULWs before schedule ends */
9607 	uint8	pad[3];
9608 } wl_avail_ulw_t;
9609 
9610 /* unset: NAN is not available during ULW, set: NAN is avail depending on ctrl flags */
9611 #define WL_NAN_ULW_CTRL_PRESENT		(1 << 0)
9612 /* unset: band, set: channel */
9613 #define WL_NAN_ULW_CTRL_TYPE		(1 << 1)
9614 /* set: NAN is availabile on specified band/channel */
9615 #define WL_NAN_ULW_CTRL_AVAIL		(1 << 2)
9616 /* channel is provided in raw attribute format */
9617 #define WL_NAN_ULW_CTRL_RAW_CHAN	(1 << 3)
9618 
9619 /* nan wfa testmode operations */
9620 enum {
9621 	WL_NAN_WFA_TM_IGNORE_TERMINATE_NAF		= 0x00000001,
9622 	WL_NAN_WFA_TM_IGNORE_RX_DATA_OUTSIDE_CRB	= 0x00000002,
9623 	WL_NAN_WFA_TM_ALLOW_TX_DATA_OUTSIDE_CRB		= 0x00000004,
9624 	WL_NAN_WFA_TM_ENFORCE_NDL_COUNTER		= 0x00000008,
9625 	WL_NAN_WFA_TM_BYPASS_NDL_PROPOSAL_VALIDATION	= 0x00000010,
9626 	/* allow data(pings) tx while ndp sec negotiation */
9627 	WL_NAN_WFA_TM_SEC_SEND_PINGS_BYPASS_NDP_SM	= 0x00000020,
9628 	/* generate and insert incorrect mic */
9629 	WL_NAN_WFA_TM_SEC_INCORRECT_MIC		        = 0x00000040,
9630 	/* send m4 reject deliberately */
9631 	WL_NAN_WFA_TM_SEC_REJECT_STATUS4M4		= 0x00000080,
9632 	/* send mgmt frame (for eg. ndp terminate) in clear txt (bypass security) */
9633 	WL_NAN_WFA_TM_SEC_SEND_MGMT_CLEAR	        = 0x00000100,
9634 	WL_NAN_WFA_TM_FLAG_MASK				= 0x000001ff /* add above & update mask */
9635 };
9636 typedef uint32 wl_nan_wfa_testmode_t;
9637 
9638 #define RSSI_THRESHOLD_SIZE 16
9639 #define MAX_IMP_RESP_SIZE 256
9640 
9641 typedef struct wl_proxd_rssi_bias {
9642 	int32		version;			/**< version */
9643 	int32		threshold[RSSI_THRESHOLD_SIZE];	/**< threshold */
9644 	int32		peak_offset;			/**< peak offset */
9645 	int32		bias;				/**< rssi bias */
9646 	int32		gd_delta;			/**< GD - GD_ADJ */
9647 	int32		imp_resp[MAX_IMP_RESP_SIZE];	/**< (Hi*Hi)+(Hr*Hr) */
9648 } wl_proxd_rssi_bias_t;
9649 
9650 typedef struct wl_proxd_rssi_bias_avg {
9651 	int32		avg_threshold[RSSI_THRESHOLD_SIZE];	/**< avg threshold */
9652 	int32		avg_peak_offset;			/**< avg peak offset */
9653 	int32		avg_rssi;				/**< avg rssi */
9654 	int32		avg_bias;				/**< avg bias */
9655 } wl_proxd_rssi_bias_avg_t;
9656 
9657 #include <packed_section_start.h>
9658 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_info {
9659 	uint16		type;  /**< type: 0 channel table, 1 channel smoothing table, 2 and 3 seq */
9660 	uint16		index;		/**< The current frame index, from 1 to total_frames. */
9661 	uint16		tof_cmd;	/**< M_TOF_CMD      */
9662 	uint16		tof_rsp;	/**< M_TOF_RSP      */
9663 	uint16		tof_avb_rxl;	/**< M_TOF_AVB_RX_L */
9664 	uint16		tof_avb_rxh;	/**< M_TOF_AVB_RX_H */
9665 	uint16		tof_avb_txl;	/**< M_TOF_AVB_TX_L */
9666 	uint16		tof_avb_txh;	/**< M_TOF_AVB_TX_H */
9667 	uint16		tof_id;		/**< M_TOF_ID */
9668 	uint8		tof_frame_type;
9669 	uint8		tof_frame_bw;
9670 	int8		tof_rssi;
9671 	int32		tof_cfo;
9672 	int32		gd_adj_ns;	/**< gound delay */
9673 	int32		gd_h_adj_ns;	/**< group delay + threshold crossing */
9674 	int16		nfft;		/**< number of samples stored in H */
9675 	uint8		num_max_cores;
9676 
9677 } BWL_POST_PACKED_STRUCT wl_proxd_collect_info_t;
9678 #include <packed_section_end.h>
9679 
9680 #define K_TOF_COLLECT_H_PAD 1
9681 #define K_TOF_COLLECT_SC_20MHZ (64)
9682 /* Maximum possible size of sample capture */
9683 #define K_TOF_COLLECT_SC_80MHZ (2*K_TOF_COLLECT_SC_20MHZ)
9684 /* Maximum possible size of channel dump */
9685 #define K_TOF_COLLECT_CHAN_SIZE (2*K_TOF_COLLECT_SC_80MHZ)
9686 
9687 /*
9688 A few extra samples are required to estimate frequency offset
9689 Right now 16 samples are being used. Can be changed in future.
9690 */
9691 #define K_TOF_COLLECT_SAMP_SIZE_20MHZ (2*(K_TOF_COLLECT_SC_20MHZ)+16+K_TOF_COLLECT_H_PAD)
9692 #define K_TOF_COLLECT_RAW_SAMP_SIZE_20MHZ (2*K_TOF_COLLECT_SAMP_SIZE_20MHZ)
9693 #define K_TOF_COLLECT_H_SIZE_20MHZ (K_TOF_COLLECT_SAMP_SIZE_20MHZ)
9694 #define K_TOF_COLLECT_HRAW_SIZE_20MHZ (K_TOF_COLLECT_RAW_SAMP_SIZE_20MHZ)
9695 
9696 #define K_TOF_COLLECT_SAMP_SIZE_80MHZ (2*(K_TOF_COLLECT_SC_80MHZ)+16+K_TOF_COLLECT_H_PAD)
9697 #define K_TOF_COLLECT_RAW_SAMP_SIZE_80MHZ (2*K_TOF_COLLECT_SAMP_SIZE_80MHZ)
9698 #define K_TOF_COLLECT_H_SIZE_80MHZ (K_TOF_COLLECT_SAMP_SIZE_80MHZ)
9699 #define K_TOF_COLLECT_HRAW_SIZE_80MHZ (K_TOF_COLLECT_RAW_SAMP_SIZE_80MHZ)
9700 
9701 #define WL_PROXD_COLLECT_DATA_VERSION_1		1
9702 #include <packed_section_start.h>
9703 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_data_v1 {
9704 	wl_proxd_collect_info_t  info;
9705 	uint8	ri_rr[FTM_TPK_RI_RR_LEN];
9706 	/**< raw data read from phy used to adjust timestamps */
9707 	uint32	H[K_TOF_COLLECT_H_SIZE_20MHZ];
9708 } BWL_POST_PACKED_STRUCT wl_proxd_collect_data_t_v1;
9709 #include <packed_section_end.h>
9710 
9711 #define WL_PROXD_COLLECT_DATA_VERSION_2		2
9712 typedef struct wl_proxd_collect_data_v2 {
9713 	uint16			version;
9714 	uint16			len;
9715 	wl_proxd_collect_info_t	info;
9716 	uint8			ri_rr[FTM_TPK_RI_RR_LEN];
9717 	uint8			pad[3]; /* should be based on FTM_TPK_RI_RR_LEN */
9718 	/**< raw data read from phy used to adjust timestamps */
9719 	uint32			H[K_TOF_COLLECT_H_SIZE_20MHZ];
9720 	uint32			chan[4 * K_TOF_COLLECT_CHAN_SIZE];
9721 } wl_proxd_collect_data_t_v2;
9722 #define WL_PROXD_COLLECT_DATA_VERSION_MAX	WL_PROXD_COLLECT_DATA_VERSION_2
9723 
9724 typedef struct wl_proxd_debug_data {
9725 	uint8		count;		/**< number of packets */
9726 	uint8		stage;		/**< state machone stage */
9727 	uint8		received;	/**< received or txed */
9728 	uint8		paket_type;	/**< packet type */
9729 	uint8		category;	/**< category field */
9730 	uint8		action;		/**< action field */
9731 	uint8		token;		/**< token number */
9732 	uint8		follow_token;	/**< following token number */
9733 	uint16		index;		/**< index of the packet */
9734 	uint16		tof_cmd;	/**< M_TOF_CMD */
9735 	uint16		tof_rsp;	/**< M_TOF_RSP */
9736 	uint16		tof_avb_rxl;	/**< M_TOF_AVB_RX_L */
9737 	uint16		tof_avb_rxh;	/**< M_TOF_AVB_RX_H */
9738 	uint16		tof_avb_txl;	/**< M_TOF_AVB_TX_L */
9739 	uint16		tof_avb_txh;	/**< M_TOF_AVB_TX_H */
9740 	uint16		tof_id;		/**< M_TOF_ID */
9741 	uint16		tof_status0;	/**< M_TOF_STATUS_0 */
9742 	uint16		tof_status2;	/**< M_TOF_STATUS_2 */
9743 	uint16		tof_chsm0;	/**< M_TOF_CHNSM_0 */
9744 	uint16		tof_phyctl0;	/**< M_TOF_PHYCTL0 */
9745 	uint16		tof_phyctl1;	/**< M_TOF_PHYCTL1 */
9746 	uint16		tof_phyctl2;	/**< M_TOF_PHYCTL2 */
9747 	uint16		tof_lsig;	/**< M_TOF_LSIG */
9748 	uint16		tof_vhta0;	/**< M_TOF_VHTA0 */
9749 	uint16		tof_vhta1;	/**< M_TOF_VHTA1 */
9750 	uint16		tof_vhta2;	/**< M_TOF_VHTA2 */
9751 	uint16		tof_vhtb0;	/**< M_TOF_VHTB0 */
9752 	uint16		tof_vhtb1;	/**< M_TOF_VHTB1 */
9753 	uint16		tof_apmductl;	/**< M_TOF_AMPDU_CTL */
9754 	uint16		tof_apmdudlim;	/**< M_TOF_AMPDU_DLIM */
9755 	uint16		tof_apmdulen;	/**< M_TOF_AMPDU_LEN */
9756 } wl_proxd_debug_data_t;
9757 
9758 /** version of the wl_wsec_info structure */
9759 #define WL_WSEC_INFO_VERSION 0x01
9760 
9761 /** start enum value for BSS properties */
9762 #define WL_WSEC_INFO_BSS_BASE 0x0100
9763 
9764 /** size of len and type fields of wl_wsec_info_tlv_t struct */
9765 #define WL_WSEC_INFO_TLV_HDR_LEN OFFSETOF(wl_wsec_info_tlv_t, data)
9766 
9767 /** Allowed wl_wsec_info properties; not all of them may be supported. */
9768 typedef enum {
9769 	WL_WSEC_INFO_NONE = 0,
9770 	WL_WSEC_INFO_MAX_KEYS = 1,
9771 	WL_WSEC_INFO_NUM_KEYS = 2,
9772 	WL_WSEC_INFO_NUM_HW_KEYS = 3,
9773 	WL_WSEC_INFO_MAX_KEY_IDX = 4,
9774 	WL_WSEC_INFO_NUM_REPLAY_CNTRS = 5,
9775 	WL_WSEC_INFO_SUPPORTED_ALGOS = 6,
9776 	WL_WSEC_INFO_MAX_KEY_LEN = 7,
9777 	WL_WSEC_INFO_FLAGS = 8,
9778 	/* add global/per-wlc properties above */
9779 	WL_WSEC_INFO_BSS_FLAGS = (WL_WSEC_INFO_BSS_BASE + 1),
9780 	WL_WSEC_INFO_BSS_WSEC = (WL_WSEC_INFO_BSS_BASE + 2),
9781 	WL_WSEC_INFO_BSS_TX_KEY_ID = (WL_WSEC_INFO_BSS_BASE + 3),
9782 	WL_WSEC_INFO_BSS_ALGO = (WL_WSEC_INFO_BSS_BASE + 4),
9783 	WL_WSEC_INFO_BSS_KEY_LEN = (WL_WSEC_INFO_BSS_BASE + 5),
9784 	WL_WSEC_INFO_BSS_ALGOS = (WL_WSEC_INFO_BSS_BASE + 6),
9785 	/* add per-BSS properties above */
9786 	WL_WSEC_INFO_MAX = 0xffff
9787 } wl_wsec_info_type_t;
9788 
9789 typedef struct {
9790 	uint32 algos; /* set algos to be enabled/disabled */
9791 	uint32 mask; /* algos outside mask unaltered */
9792 } wl_wsec_info_algos_t;
9793 
9794 /** tlv used to return wl_wsec_info properties */
9795 typedef struct {
9796 	uint16 type;
9797 	uint16 len;		/**< data length */
9798 	uint8 data[1];	/**< data follows */
9799 } wl_wsec_info_tlv_t;
9800 
9801 /** input/output data type for wsec_info iovar */
9802 typedef struct wl_wsec_info {
9803 	uint8 version; /**< structure version */
9804 	uint8 pad[2];
9805 	uint8 num_tlvs;
9806 	wl_wsec_info_tlv_t tlvs[1]; /**< tlv data follows */
9807 } wl_wsec_info_t;
9808 
9809 /*
9810  * randmac definitions
9811  */
9812 #define WL_RANDMAC_MODULE			"randmac"
9813 #define WL_RANDMAC_API_VERSION		0x0100 /**< version 1.0 */
9814 #define WL_RANDMAC_API_MIN_VERSION	0x0100 /**< version 1.0 */
9815 
9816 /** subcommands that can apply to randmac */
9817 enum {
9818 	WL_RANDMAC_SUBCMD_NONE				= 0,
9819 	WL_RANDMAC_SUBCMD_GET_VERSION			= 1,
9820 	WL_RANDMAC_SUBCMD_ENABLE			= 2,
9821 	WL_RANDMAC_SUBCMD_DISABLE			= 3,
9822 	WL_RANDMAC_SUBCMD_CONFIG			= 4,
9823 	WL_RANDMAC_SUBCMD_STATS				= 5,
9824 	WL_RANDMAC_SUBCMD_CLEAR_STATS			= 6,
9825 
9826 	WL_RANDMAC_SUBCMD_MAX
9827 };
9828 typedef int16 wl_randmac_subcmd_t;
9829 
9830 /* Common IOVAR struct */
9831 typedef struct wl_randmac {
9832 	uint16 version;
9833 	uint16 len;			/* total length */
9834 	wl_randmac_subcmd_t subcmd_id;	/* subcommand id */
9835 	uint8 data[0];			/* subcommand data */
9836 } wl_randmac_t;
9837 
9838 #define WL_RANDMAC_IOV_HDR_SIZE OFFSETOF(wl_randmac_t, data)
9839 
9840 /* randmac version subcommand */
9841 typedef struct wl_randmac_version {
9842 	uint16 version;  /* Randmac method version info */
9843 	uint8 pad[2];    /* Align on 4 byte boundary */
9844 } wl_randmac_version_t;
9845 
9846 /*
9847  * Bitmask for methods supporting MAC randomization feature
9848  */
9849 #define WL_RANDMAC_USER_NONE		0x0000
9850 #define WL_RANDMAC_USER_FTM		0x0001
9851 #define WL_RANDMAC_USER_NAN		0x0002
9852 #define WL_RANDMAC_USER_SCAN		0x0004
9853 #define WL_RANDMAC_USER_ALL		0xFFFF
9854 typedef uint16 wl_randmac_method_t;
9855 
9856 enum {
9857 	WL_RANDMAC_FLAGS_NONE	= 0x00,
9858 	WL_RANDMAC_FLAGS_ADDR	= 0x01,
9859 	WL_RANDMAC_FLAGS_MASK	= 0x02,
9860 	WL_RANDMAC_FLAGS_METHOD	= 0x04,
9861 	WL_RANDMAC_FLAGS_ALL	= 0xFF
9862 };
9863 typedef uint8 wl_randmac_flags_t;
9864 
9865 /* randmac statistics subcommand */
9866 typedef struct wl_randmac_stats {
9867 	uint32 set_ok;		/* Set random addr success count */
9868 	uint32 set_fail;	/* Set random addr failed count */
9869 	uint32 set_reqs;	/* Set random addr count */
9870 	uint32 reset_reqs;	/* Restore random addr count */
9871 	uint32 restore_ok;	/* Restore random addr succes count */
9872 	uint32 restore_fail;	/* Restore random addr failed count */
9873 	uint32 events_sent;	/* randmac module events count */
9874 	uint32 events_rcvd;	/* randmac events received count */
9875 } wl_randmac_stats_t;
9876 
9877 /* randmac config subcommand */
9878 typedef struct wl_randmac_config {
9879 	struct ether_addr addr;			/* Randomized MAC address */
9880 	struct ether_addr addr_mask;		/* bitmask for randomization */
9881 	wl_randmac_method_t method;		/* Enabled methods */
9882 	wl_randmac_flags_t flags;		/* What config info changed */
9883 	uint8	PAD;
9884 } wl_randmac_config_t;
9885 
9886 enum {
9887 	WL_RANDMAC_EVENT_NONE			= 0,	/**< not an event, reserved */
9888 	WL_RANDMAC_EVENT_BSSCFG_ADDR_SET	= 1,	/* bsscfg addr randomized */
9889 	WL_RANDMAC_EVENT_BSSCFG_ADDR_RESTORE	= 2,	/* bsscfg addr restored */
9890 	WL_RANDMAC_EVENT_ENABLED		= 3,	/* randmac module enabled */
9891 	WL_RANDMAC_EVENT_DISABLE		= 4,	/* randmac module disabled */
9892 	WL_RANDMAC_EVENT_BSSCFG_STATUS	= 5,	/* bsscfg enable/disable */
9893 
9894 	WL_RANDMAC_EVENT_MAX
9895 };
9896 typedef int16 wl_randmac_event_type_t;
9897 typedef int32 wl_randmac_status_t;
9898 typedef uint32 wl_randmac_event_mask_t;
9899 
9900 #define WL_RANDMAC_EVENT_MASK_ALL 0xfffffffe
9901 #define WL_RANDMAC_EVENT_MASK_EVENT(_event_type) (1 << (_event_type))
9902 #define WL_RANDMAC_EVENT_ENABLED(_mask, _event_type) (\
9903 	((_mask) & WL_RANDMAC_EVENT_MASK_EVENT(_event_type)) != 0)
9904 
9905 /** tlv IDs - data length 4 bytes unless overridden by type, alignment 32 bits */
9906 enum {
9907 	WL_RANDMAC_TLV_NONE		= 0,
9908 	WL_RANDMAC_TLV_METHOD		= 1,
9909 	WL_RANDMAC_TLV_ADDR		= 2,
9910 	WL_RANDMAC_TLV_MASK		= 3
9911 };
9912 typedef uint16 wl_randmac_tlv_id_t;
9913 
9914 typedef struct wl_randmac_tlv {
9915 	wl_randmac_tlv_id_t id;
9916 	uint16 len;		/* Length of variable */
9917 	uint8  data[1];
9918 } wl_randmac_tlv_t;
9919 
9920 /** randmac event */
9921 typedef struct wl_randmac_event {
9922 	uint16					version;
9923 	uint16					len;	/* Length of all variables */
9924 	wl_randmac_event_type_t			type;
9925 	wl_randmac_method_t			method;
9926 	uint8					pad[2];
9927 	wl_randmac_tlv_t			tlvs[1];	/**< variable */
9928 } wl_randmac_event_t;
9929 
9930 /*
9931  * scan MAC definitions
9932  */
9933 
9934 /** common iovar struct */
9935 typedef struct wl_scanmac {
9936 	uint16 subcmd_id;	/**< subcommand id */
9937 	uint16 len;		/**< total length of data[] */
9938 	uint8 data[];		/**< subcommand data */
9939 } wl_scanmac_t;
9940 
9941 /* subcommand ids */
9942 #define WL_SCANMAC_SUBCMD_ENABLE   0
9943 #define WL_SCANMAC_SUBCMD_BSSCFG   1   /**< only GET supported */
9944 #define WL_SCANMAC_SUBCMD_CONFIG   2
9945 
9946 /** scanmac enable data struct */
9947 typedef struct wl_scanmac_enable {
9948 	uint8 enable;	/**< 1 - enable, 0 - disable */
9949 	uint8 pad[3];	/**< 4-byte struct alignment */
9950 } wl_scanmac_enable_t;
9951 
9952 /** scanmac bsscfg data struct */
9953 typedef struct wl_scanmac_bsscfg {
9954 	uint32 bsscfg;	/**< bsscfg index */
9955 } wl_scanmac_bsscfg_t;
9956 
9957 /** scanmac config data struct */
9958 typedef struct wl_scanmac_config {
9959 	struct ether_addr mac;	/**< 6 bytes of MAC address or MAC prefix (i.e. OUI) */
9960 	struct ether_addr random_mask;	/**< randomized bits on each scan */
9961 	uint16 scan_bitmap;	/**< scans to use this MAC address */
9962 	uint8 pad[2];	/**< 4-byte struct alignment */
9963 } wl_scanmac_config_t;
9964 
9965 /* scan bitmap */
9966 #define WL_SCANMAC_SCAN_UNASSOC		(0x01 << 0)	/**< unassociated scans */
9967 #define WL_SCANMAC_SCAN_ASSOC_ROAM	(0x01 << 1)	/**< associated roam scans */
9968 #define WL_SCANMAC_SCAN_ASSOC_PNO	(0x01 << 2)	/**< associated PNO scans */
9969 #define WL_SCANMAC_SCAN_ASSOC_HOST	(0x01 << 3)	/**< associated host scans */
9970 /*
9971  * bonjour dongle offload definitions
9972  */
9973 
9974 /* common iovar struct */
9975 typedef struct wl_bdo {
9976 	uint16 subcmd_id;	/* subcommand id */
9977 	uint16 len;		/* total length of data[] */
9978 	uint8 data[];		/* subcommand data */
9979 } wl_bdo_t;
9980 
9981 /* subcommand ids */
9982 #define WL_BDO_SUBCMD_DOWNLOAD		0	/* Download flattened database  */
9983 #define WL_BDO_SUBCMD_ENABLE		1	/* Start bonjour after download */
9984 #define WL_BDO_SUBCMD_MAX_DOWNLOAD	2	/* Get the max download size    */
9985 
9986 /* maximum fragment size */
9987 #define BDO_MAX_FRAGMENT_SIZE	1024
9988 
9989 /* download flattened database
9990  *
9991  * BDO must be disabled before database download else fail.
9992  *
9993  * If database size is within BDO_MAX_FRAGMENT_SIZE then only a single fragment
9994  * is required (i.e. frag_num = 0, total_size = frag_size).
9995  * If database size exceeds BDO_MAX_FRAGMENT_SIZE then multiple fragments are required.
9996  */
9997 typedef struct wl_bdo_download {
9998 	uint16 total_size;	/* total database size */
9999 	uint16 frag_num;	/* fragment number, 0 for first fragment, N-1 for last fragment */
10000 	uint16 frag_size;	/* size of fragment (max BDO_MAX_FRAGMENT_SIZE) */
10001 	uint8 pad[2];		/* 4-byte struct alignment */
10002 	uint8 fragment[BDO_MAX_FRAGMENT_SIZE];  /* fragment data */
10003 } wl_bdo_download_t;
10004 
10005 /* enable
10006  *
10007  * Enable requires a downloaded database else fail.
10008  */
10009 typedef struct wl_bdo_enable {
10010 	uint8 enable;	/* 1 - enable, 0 - disable */
10011 	uint8 pad[3];	/* 4-byte struct alignment */
10012 } wl_bdo_enable_t;
10013 
10014 /*
10015  * Get the max download size for Bonjour Offload.
10016  */
10017 typedef struct wl_bdo_max_download {
10018 	uint16 size;	/* Max download size in bytes */
10019 	uint8 pad[2];	/* 4-byte struct alignment    */
10020 } wl_bdo_max_download_t;
10021 
10022 /*
10023  * TCP keepalive offload definitions
10024  */
10025 
10026 /* common iovar struct */
10027 typedef struct wl_tko {
10028 	uint16 subcmd_id;	/* subcommand id */
10029 	uint16 len;		/* total length of data[] */
10030 	uint8 data[];		/* subcommand data */
10031 } wl_tko_t;
10032 
10033 /* subcommand ids */
10034 #define WL_TKO_SUBCMD_MAX_TCP		0	/* max TCP connections supported */
10035 #define WL_TKO_SUBCMD_PARAM		1	/* configure offload common parameters  */
10036 #define WL_TKO_SUBCMD_CONNECT		2	/* TCP connection info */
10037 #define WL_TKO_SUBCMD_ENABLE		3	/* enable/disable */
10038 #define WL_TKO_SUBCMD_STATUS		4	/* TCP connection status */
10039 
10040 /* WL_TKO_SUBCMD_MAX_CONNECT subcommand data */
10041 typedef struct wl_tko_max_tcp {
10042 	uint8 max;	/* max TCP connections supported */
10043 	uint8 pad[3];	/* 4-byte struct alignment */
10044 } wl_tko_max_tcp_t;
10045 
10046 /* WL_TKO_SUBCMD_PARAM subcommand data */
10047 typedef struct wl_tko_param {
10048 	uint16 interval;	/* keepalive tx interval (secs) */
10049 	uint16 retry_interval;	/* keepalive retry interval (secs) */
10050 	uint16 retry_count;	/* retry_count */
10051 	uint8 pad[2];		/* 4-byte struct alignment */
10052 } wl_tko_param_t;
10053 
10054 /* WL_TKO_SUBCMD_CONNECT subcommand data
10055  * invoke with unique 'index' for each TCP connection
10056  */
10057 typedef struct wl_tko_connect {
10058 	uint8 index;		/* TCP connection index, 0 to max-1 */
10059 	uint8 ip_addr_type;	/* 0 - IPv4, 1 - IPv6 */
10060 	uint16 local_port;	/* local port */
10061 	uint16 remote_port;	/* remote port */
10062 	uint16 PAD;
10063 	uint32 local_seq;	/* local sequence number */
10064 	uint32 remote_seq;	/* remote sequence number */
10065 	uint16 request_len;	/* TCP keepalive request packet length */
10066 	uint16 response_len;	/* TCP keepalive response packet length */
10067 	uint8 data[];		/* variable length field containing local/remote IPv4/IPv6,
10068 				 * TCP keepalive request packet, TCP keepalive response packet
10069 				 *    For IPv4, length is 4 * 2 + request_length + response_length
10070 				 *       offset 0 - local IPv4
10071 				 *       offset 4 - remote IPv4
10072 				 *       offset 8 - TCP keepalive request packet
10073 				 *       offset 8+request_length - TCP keepalive response packet
10074 				 *    For IPv6, length is 16 * 2 + request_length + response_length
10075 				 *       offset 0 - local IPv6
10076 				 *       offset 16 - remote IPv6
10077 				 *       offset 32 - TCP keepalive request packet
10078 				 *       offset 32+request_length - TCP keepalive response packet
10079 				 */
10080 } wl_tko_connect_t;
10081 
10082 /* WL_TKO_SUBCMD_CONNECT subcommand data to GET configured info for specific index */
10083 typedef struct wl_tko_get_connect {
10084 	uint8 index;		/* TCP connection index, 0 to max-1 */
10085 	uint8 pad[3];		/* 4-byte struct alignment */
10086 } wl_tko_get_connect_t;
10087 
10088 typedef struct wl_tko_enable {
10089 	uint8 enable;	/* 1 - enable, 0 - disable */
10090 	uint8 pad[3];	/* 4-byte struct alignment */
10091 } wl_tko_enable_t;
10092 
10093 /* WL_TKO_SUBCMD_STATUS subcommand data */
10094 /* must be invoked before tko is disabled else status is unavailable */
10095 typedef struct wl_tko_status {
10096 	uint8 count;		/* number of status entries (i.e. equals
10097 				 * max TCP connections supported)
10098 	                         */
10099 	uint8 status[1];	/* variable length field contain status for
10100 				 * each TCP connection index
10101 				 */
10102 } wl_tko_status_t;
10103 
10104 typedef enum {
10105 	TKO_STATUS_NORMAL			= 0,	/* TCP connection normal, no error */
10106 	TKO_STATUS_NO_RESPONSE			= 1,	/* no response to TCP keepalive */
10107 	TKO_STATUS_NO_TCP_ACK_FLAG		= 2,	/* TCP ACK flag not set */
10108 	TKO_STATUS_UNEXPECT_TCP_FLAG		= 3,	/* unexpect TCP flags set other than ACK */
10109 	TKO_STATUS_SEQ_NUM_INVALID		= 4,	/* ACK != sequence number */
10110 	TKO_STATUS_REMOTE_SEQ_NUM_INVALID	= 5,	/* SEQ > remote sequence number */
10111 	TKO_STATUS_TCP_DATA			= 6,	/* TCP data available */
10112 	TKO_STATUS_UNAVAILABLE			= 255,	/* not used/configured */
10113 } tko_status_t;
10114 
10115 enum rssi_reason {
10116 	RSSI_REASON_UNKNOW = 0,
10117 	RSSI_REASON_LOWRSSI = 1,
10118 	RSSI_REASON_NSYC = 2,
10119 	RSSI_REASON_TIMEOUT = 3
10120 };
10121 
10122 enum tof_reason {
10123 	TOF_REASON_OK = 0,
10124 	TOF_REASON_REQEND = 1,
10125 	TOF_REASON_TIMEOUT = 2,
10126 	TOF_REASON_NOACK = 3,
10127 	TOF_REASON_INVALIDAVB = 4,
10128 	TOF_REASON_INITIAL = 5,
10129 	TOF_REASON_ABORT = 6
10130 };
10131 
10132 enum rssi_state {
10133 	RSSI_STATE_POLL = 0,
10134 	RSSI_STATE_TPAIRING = 1,
10135 	RSSI_STATE_IPAIRING = 2,
10136 	RSSI_STATE_THANDSHAKE = 3,
10137 	RSSI_STATE_IHANDSHAKE = 4,
10138 	RSSI_STATE_CONFIRMED = 5,
10139 	RSSI_STATE_PIPELINE = 6,
10140 	RSSI_STATE_NEGMODE = 7,
10141 	RSSI_STATE_MONITOR = 8,
10142 	RSSI_STATE_LAST = 9
10143 };
10144 
10145 enum tof_state {
10146 	TOF_STATE_IDLE	 = 0,
10147 	TOF_STATE_IWAITM = 1,
10148 	TOF_STATE_TWAITM = 2,
10149 	TOF_STATE_ILEGACY = 3,
10150 	TOF_STATE_IWAITCL = 4,
10151 	TOF_STATE_TWAITCL = 5,
10152 	TOF_STATE_ICONFIRM = 6,
10153 	TOF_STATE_IREPORT = 7
10154 };
10155 
10156 enum tof_mode_type {
10157 	TOF_LEGACY_UNKNOWN	= 0,
10158 	TOF_LEGACY_AP		= 1,
10159 	TOF_NONLEGACY_AP	= 2
10160 };
10161 
10162 enum tof_way_type {
10163 	TOF_TYPE_ONE_WAY = 0,
10164 	TOF_TYPE_TWO_WAY = 1,
10165 	TOF_TYPE_REPORT = 2
10166 };
10167 
10168 enum tof_rate_type {
10169 	TOF_FRAME_RATE_VHT = 0,
10170 	TOF_FRAME_RATE_LEGACY = 1
10171 };
10172 
10173 #define TOF_ADJ_TYPE_NUM	4	/**< number of assisted timestamp adjustment */
10174 enum tof_adj_mode {
10175 	TOF_ADJ_SOFTWARE = 0,
10176 	TOF_ADJ_HARDWARE = 1,
10177 	TOF_ADJ_SEQ = 2,
10178 	TOF_ADJ_NONE = 3
10179 };
10180 
10181 #define FRAME_TYPE_NUM		4	/**< number of frame type */
10182 enum frame_type {
10183 	FRAME_TYPE_CCK	= 0,
10184 	FRAME_TYPE_OFDM	= 1,
10185 	FRAME_TYPE_11N	= 2,
10186 	FRAME_TYPE_11AC	= 3
10187 };
10188 
10189 typedef struct wl_proxd_status_iovar {
10190 	uint16			method;				/**< method */
10191 	uint8			mode;				/**< mode */
10192 	uint8			peermode;			/**< peer mode */
10193 	uint8			state;				/**< state */
10194 	uint8			reason;				/**< reason code */
10195 	uint8			PAD[2];
10196 	uint32			distance;			/**< distance */
10197 	uint32			txcnt;				/**< tx pkt counter */
10198 	uint32			rxcnt;				/**< rx pkt counter */
10199 	struct ether_addr	peer;				/**< peer mac address */
10200 	int8			avg_rssi;			/**< average rssi */
10201 	int8			hi_rssi;			/**< highest rssi */
10202 	int8			low_rssi;			/**< lowest rssi */
10203 	uint8			PAD[3];
10204 	uint32			dbgstatus;			/**< debug status */
10205 	uint16			frame_type_cnt[FRAME_TYPE_NUM];	/**< frame types */
10206 	uint8			adj_type_cnt[TOF_ADJ_TYPE_NUM];	/**< adj types HW/SW */
10207 } wl_proxd_status_iovar_t;
10208 
10209 /* ifdef NET_DETECT */
10210 typedef struct net_detect_adapter_features {
10211 	uint8	wowl_enabled;
10212 	uint8	net_detect_enabled;
10213 	uint8	nlo_enabled;
10214 } net_detect_adapter_features_t;
10215 
10216 typedef enum net_detect_bss_type {
10217 	nd_bss_any = 0,
10218 	nd_ibss,
10219 	nd_ess
10220 } net_detect_bss_type_t;
10221 
10222 typedef struct net_detect_profile {
10223 	wlc_ssid_t		ssid;
10224 	net_detect_bss_type_t   bss_type;	/**< Ignore for now since Phase 1 is only for ESS */
10225 	uint32			cipher_type;	/**< DOT11_CIPHER_ALGORITHM enumeration values */
10226 	uint32			auth_type;	/**< DOT11_AUTH_ALGORITHM enumeration values */
10227 } net_detect_profile_t;
10228 
10229 typedef struct net_detect_profile_list {
10230 	uint32			num_nd_profiles;
10231 	net_detect_profile_t	nd_profile[];
10232 } net_detect_profile_list_t;
10233 
10234 typedef struct net_detect_config {
10235 	uint8			    nd_enabled;
10236 	uint8				PAD[3];
10237 	uint32			    scan_interval;
10238 	uint32			    wait_period;
10239 	uint8			    wake_if_connected;
10240 	uint8			    wake_if_disconnected;
10241 	uint8				PAD[2];
10242 	net_detect_profile_list_t   nd_profile_list;
10243 } net_detect_config_t;
10244 
10245 typedef enum net_detect_wake_reason {
10246 	nd_reason_unknown,
10247 	nd_net_detected,
10248 	nd_wowl_event,
10249 	nd_ucode_error
10250 } net_detect_wake_reason_t;
10251 
10252 typedef struct net_detect_wake_data {
10253 	net_detect_wake_reason_t    nd_wake_reason;
10254 	uint32			    nd_wake_date_length;
10255 	uint8			    nd_wake_data[0];	    /**< Wake data (currently unused) */
10256 } net_detect_wake_data_t;
10257 
10258 /* endif NET_DETECT */
10259 
10260 /* (unversioned, deprecated) */
10261 typedef struct bcnreq {
10262 	uint8 bcn_mode;
10263 	uint8 PAD[3];
10264 	int32 dur;
10265 	int32 channel;
10266 	struct ether_addr da;
10267 	uint16 random_int;
10268 	wlc_ssid_t ssid;
10269 	uint16 reps;
10270 	uint8 PAD[2];
10271 } bcnreq_t;
10272 
10273 #define WL_RRM_BCN_REQ_VER		1
10274 typedef struct bcn_req {
10275 	uint8 version;
10276 	uint8 bcn_mode;
10277 	uint8 pad_1[2];
10278 	int32 dur;
10279 	int32 channel;
10280 	struct ether_addr da;
10281 	uint16 random_int;
10282 	wlc_ssid_t ssid;
10283 	uint16 reps;
10284 	uint8 req_elements;
10285 	uint8 pad_2;
10286 	chanspec_list_t chspec_list;
10287 } bcn_req_t;
10288 
10289 typedef struct rrmreq {
10290 	struct ether_addr da;
10291 	uint8 reg;
10292 	uint8 chan;
10293 	uint16 random_int;
10294 	uint16 dur;
10295 	uint16 reps;
10296 } rrmreq_t;
10297 
10298 typedef struct framereq {
10299 	struct ether_addr da;
10300 	uint8 reg;
10301 	uint8 chan;
10302 	uint16 random_int;
10303 	uint16 dur;
10304 	struct ether_addr ta;
10305 	uint16 reps;
10306 } framereq_t;
10307 
10308 typedef struct statreq {
10309 	struct ether_addr da;
10310 	struct ether_addr peer;
10311 	uint16 random_int;
10312 	uint16 dur;
10313 	uint8 group_id;
10314 	uint8 PAD;
10315 	uint16 reps;
10316 } statreq_t;
10317 
10318 typedef struct wl_rrm_config_ioc {
10319 	uint16 version; /* command version */
10320 	uint16 id;      /* subiovar cmd ID */
10321 	uint16 len;     /* total length of all bytes in data[] */
10322 	uint16 pad;     /* 4-byte boundary padding */
10323 	uint8 data[1];  /* payload */
10324 } wl_rrm_config_ioc_t;
10325 
10326 enum {
10327 	WL_RRM_CONFIG_NONE	= 0,	/* reserved */
10328 	WL_RRM_CONFIG_GET_LCI	= 1,	/* get LCI */
10329 	WL_RRM_CONFIG_SET_LCI	= 2,	/* set LCI */
10330 	WL_RRM_CONFIG_GET_CIVIC	= 3,	/* get civic location */
10331 	WL_RRM_CONFIG_SET_CIVIC	= 4,	/* set civic location */
10332 	WL_RRM_CONFIG_MAX		= 5
10333 };
10334 
10335 #define WL_RRM_CONFIG_NAME "rrm_config"
10336 #define WL_RRM_CONFIG_MIN_LENGTH OFFSETOF(wl_rrm_config_ioc_t, data)
10337 
10338 enum {
10339 	WL_RRM_EVENT_NONE		= 0,	/* not an event, reserved */
10340 	WL_RRM_EVENT_FRNG_REQ	= 1,	/* Receipt of FRNG request frame */
10341 	WL_RRM_EVENT_FRNG_REP	= 2,	/* Receipt of FRNG report frame */
10342 
10343 	WL_RRM_EVENT_MAX
10344 };
10345 typedef int16 wl_rrm_event_type_t;
10346 
10347 typedef struct frngreq_target {
10348 	uint32 bssid_info;
10349 	uint8 channel;
10350 	uint8 phytype;
10351 	uint8 reg;
10352 	uint8 pad;
10353 	struct ether_addr bssid;
10354 	chanspec_t chanspec;
10355 	uint32 sid;
10356 } frngreq_target_t;
10357 
10358 typedef struct frngreq {
10359 	wl_rrm_event_type_t event;			/* RRM event type */
10360 	struct ether_addr da;
10361 	uint16 max_init_delay;	/* Upper bound of random delay, in TUs */
10362 	uint8 min_ap_count;		/* Min FTM ranges requested (1-15) */
10363 	uint8 num_aps;			/* Number of APs to range, at least min_ap_count */
10364 	uint16 max_age;			/* Max elapsed time before FTM request, 0xFFFF = any */
10365 	uint16 reps;			/* Number of repetitions of this measurement type */
10366 	frngreq_target_t targets[1];	/* Target BSSIDs to range */
10367 } frngreq_t;
10368 
10369 typedef struct frngrep_range {
10370 	uint32 start_tsf;		/* 4 lsb of tsf */
10371 	struct ether_addr bssid;
10372 	uint8 pad[2];
10373 	uint32 range;
10374 	uint32 max_err;
10375 	uint8  rsvd;
10376 	uint8 pad2[3];
10377 } frngrep_range_t;
10378 
10379 typedef struct frngrep_error {
10380 	uint32 start_tsf;		/* 4 lsb of tsf */
10381 	struct ether_addr bssid;
10382 	uint8  code;
10383 	uint8 pad[1];
10384 } frngrep_error_t;
10385 
10386 typedef struct frngrep {
10387 	wl_rrm_event_type_t event;			/* RRM event type */
10388 	struct ether_addr da;
10389 	uint8 range_entry_count;
10390 	uint8 error_entry_count;
10391 	uint16 dialog_token;				/* dialog token */
10392 	frngrep_range_t range_entries[DOT11_FTM_RANGE_ENTRY_MAX_COUNT];
10393 	frngrep_error_t error_entries[DOT11_FTM_RANGE_ERROR_ENTRY_MAX_COUNT];
10394 } frngrep_t;
10395 
10396 typedef struct wl_rrm_frng_ioc {
10397 	uint16 version; /* command version */
10398 	uint16 id;      /* subiovar cmd ID */
10399 	uint16 len;     /* total length of all bytes in data[] */
10400 	uint16 pad;     /* 4-byte boundary padding */
10401 	uint8 data[];  /* payload */
10402 } wl_rrm_frng_ioc_t;
10403 
10404 enum {
10405 	WL_RRM_FRNG_NONE	= 0,	/* reserved */
10406 	WL_RRM_FRNG_SET_REQ	= 1,	/* send ftm ranging request */
10407 	WL_RRM_FRNG_MAX		= 2
10408 };
10409 
10410 #define WL_RRM_FRNG_NAME "rrm_frng"
10411 #define WL_RRM_FRNG_MIN_LENGTH OFFSETOF(wl_rrm_frng_ioc_t, data)
10412 
10413 #define WL_RRM_RPT_VER		0
10414 #define WL_RRM_RPT_MAX_PAYLOAD	256
10415 #define WL_RRM_RPT_MIN_PAYLOAD	7
10416 #define WL_RRM_RPT_FALG_ERR	0
10417 #define WL_RRM_RPT_FALG_GRP_ID_PROPR	(1 << 0)
10418 #define WL_RRM_RPT_FALG_GRP_ID_0	(1 << 1)
10419 typedef struct {
10420 	uint16 ver;		/**< version */
10421 	struct ether_addr addr;	/**< STA MAC addr */
10422 	uint32 timestamp;	/**< timestamp of the report */
10423 	uint16 flag;		/**< flag */
10424 	uint16 len;		/**< length of payload data */
10425 	uint8 data[WL_RRM_RPT_MAX_PAYLOAD];
10426 } statrpt_t;
10427 
10428 typedef struct wlc_dwds_config {
10429 	uint32		enable;
10430 	uint32		mode; /**< STA/AP interface */
10431 	struct ether_addr ea;
10432 	uint8  PAD[2];
10433 } wlc_dwds_config_t;
10434 
10435 typedef struct wl_el_set_params_s {
10436 	uint8 set;	/**< Set number */
10437 	uint8  PAD[3];
10438 	uint32 size;	/**< Size to make/expand */
10439 } wl_el_set_params_t;
10440 
10441 typedef struct wl_el_tag_params_s {
10442 	uint16 tag;
10443 	uint8 set;
10444 	uint8 flags;
10445 } wl_el_tag_params_t;
10446 
10447 /** Video Traffic Interference Monitor config */
10448 #define INTFER_VERSION		1
10449 typedef struct wl_intfer_params {
10450 	uint16 version;			/**< version */
10451 	uint8 period;			/**< sample period */
10452 	uint8 cnt;			/**< sample cnt */
10453 	uint8 txfail_thresh;	/**< non-TCP txfail threshold */
10454 	uint8 tcptxfail_thresh;	/**< tcptxfail threshold */
10455 } wl_intfer_params_t;
10456 
10457 typedef struct wl_staprio_cfg {
10458 	struct ether_addr ea;	/**< mac addr */
10459 	uint8 prio;		/**< scb priority */
10460 } wl_staprio_cfg_t;
10461 
10462 typedef enum wl_stamon_cfg_cmd_type {
10463 	STAMON_CFG_CMD_DEL = 0,
10464 	STAMON_CFG_CMD_ADD = 1,
10465 	STAMON_CFG_CMD_ENB = 2,
10466 	STAMON_CFG_CMD_DSB = 3,
10467 	STAMON_CFG_CMD_CNT = 4,
10468 	STAMON_CFG_CMD_RSTCNT = 5,
10469 	STAMON_CFG_CMD_GET_STATS = 6
10470 } wl_stamon_cfg_cmd_type_t;
10471 
10472 typedef struct wlc_stamon_sta_config {
10473 	wl_stamon_cfg_cmd_type_t cmd; /**< 0 - delete, 1 - add */
10474 	struct ether_addr ea;
10475 	uint8  PAD[2];
10476 } wlc_stamon_sta_config_t;
10477 
10478 /* ifdef SR_DEBUG */
10479 typedef struct /* pmu_reg */{
10480 	uint32  pmu_control;
10481 	uint32  pmu_capabilities;
10482 	uint32  pmu_status;
10483 	uint32  res_state;
10484 	uint32  res_pending;
10485 	uint32  pmu_timer1;
10486 	uint32  min_res_mask;
10487 	uint32  max_res_mask;
10488 	uint32  pmu_chipcontrol1[4];
10489 	uint32  pmu_regcontrol[5];
10490 	uint32  pmu_pllcontrol[5];
10491 	uint32  pmu_rsrc_up_down_timer[31];
10492 	uint32  rsrc_dep_mask[31];
10493 } pmu_reg_t;
10494 /* endif SR_DEBUG */
10495 
10496 typedef struct wl_taf_define {
10497 	struct ether_addr ea;	/**< STA MAC or 0xFF... */
10498 	uint16 version;         /**< version */
10499 	uint32 sch;             /**< method index */
10500 	uint32 prio;            /**< priority */
10501 	uint32 misc;            /**< used for return value */
10502 	uint8  text[];         /**< used to pass and return ascii text */
10503 } wl_taf_define_t;
10504 
10505 /** Received Beacons lengths information */
10506 #define WL_LAST_BCNS_INFO_FIXED_LEN		OFFSETOF(wlc_bcn_len_hist_t, bcnlen_ring)
10507 typedef struct wlc_bcn_len_hist {
10508 	uint16	ver;				/**< version field */
10509 	uint16	cur_index;			/**< current pointed index in ring buffer */
10510 	uint32	max_bcnlen;		/**< Max beacon length received */
10511 	uint32	min_bcnlen;		/**< Min beacon length received */
10512 	uint32	ringbuff_len;		/**< Length of the ring buffer 'bcnlen_ring' */
10513 	uint32	bcnlen_ring[1];	/**< ring buffer storing received beacon lengths */
10514 } wlc_bcn_len_hist_t;
10515 
10516 /* WDS net interface types */
10517 #define WL_WDSIFTYPE_NONE  0x0 /**< The interface type is neither WDS nor DWDS. */
10518 #define WL_WDSIFTYPE_WDS   0x1 /**< The interface is WDS type. */
10519 #define WL_WDSIFTYPE_DWDS  0x2 /**< The interface is DWDS type. */
10520 
10521 typedef struct wl_bssload_static {
10522 	uint8 is_static;
10523 	uint8  PAD;
10524 	uint16 sta_count;
10525 	uint8 chan_util;
10526 	uint8  PAD;
10527 	uint16 aac;
10528 } wl_bssload_static_t;
10529 
10530 /* Buffer of size WLC_SAMPLECOLLECT_MAXLEN (=10240 for 4345a0 ACPHY)
10531  * gets copied to this, multiple times
10532  */
10533 typedef enum wl_gpaio_option {
10534 	GPAIO_PMU_AFELDO,
10535 	GPAIO_PMU_TXLDO,
10536 	GPAIO_PMU_VCOLDO,
10537 	GPAIO_PMU_LNALDO,
10538 	GPAIO_PMU_ADCLDO,
10539 	GPAIO_ICTAT_CAL,
10540 	GPAIO_PMU_CLEAR,
10541 	GPAIO_OFF,
10542 	GPAIO_PMU_LOGENLDO,
10543 	GPAIO_PMU_RXLDO2G,
10544 	GPAIO_PMU_RXLDO5G
10545 } wl_gpaio_option_t;
10546 
10547 /** IO Var Operations - the Value of iov_op In wlc_ap_doiovar */
10548 typedef enum wlc_ap_iov_bss_operation {
10549 	WLC_AP_IOV_OP_DELETE                   = -1,
10550 	WLC_AP_IOV_OP_DISABLE                  = 0,
10551 	WLC_AP_IOV_OP_ENABLE                   = 1,
10552 	WLC_AP_IOV_OP_MANUAL_AP_BSSCFG_CREATE  = 2,
10553 	WLC_AP_IOV_OP_MANUAL_STA_BSSCFG_CREATE = 3,
10554 	WLC_AP_IOV_OP_MOVE                     = 4
10555 } wlc_ap_iov_bss_oper_t;
10556 
10557 /* LTE coex info */
10558 /* Analogue of HCI Set MWS Signaling cmd */
10559 typedef struct {
10560 	int16	mws_rx_assert_offset;
10561 	int16	mws_rx_assert_jitter;
10562 	int16	mws_rx_deassert_offset;
10563 	int16	mws_rx_deassert_jitter;
10564 	int16	mws_tx_assert_offset;
10565 	int16	mws_tx_assert_jitter;
10566 	int16	mws_tx_deassert_offset;
10567 	int16	mws_tx_deassert_jitter;
10568 	int16	mws_pattern_assert_offset;
10569 	int16	mws_pattern_assert_jitter;
10570 	int16	mws_inact_dur_assert_offset;
10571 	int16	mws_inact_dur_assert_jitter;
10572 	int16	mws_scan_freq_assert_offset;
10573 	int16	mws_scan_freq_assert_jitter;
10574 	int16	mws_prio_assert_offset_req;
10575 } wci2_config_t;
10576 
10577 /** Analogue of HCI MWS Channel Params */
10578 typedef struct {
10579 	uint16	mws_rx_center_freq; /**< MHz */
10580 	uint16	mws_tx_center_freq;
10581 	uint16	mws_rx_channel_bw;  /**< KHz */
10582 	uint16	mws_tx_channel_bw;
10583 	uint8	mws_channel_en;
10584 	uint8	mws_channel_type;   /**< Don't care for WLAN? */
10585 } mws_params_t;
10586 
10587 #define LTECX_MAX_NUM_PERIOD_TYPES	7
10588 
10589 /* LTE Frame params */
10590 typedef struct {
10591 	uint16	mws_frame_dur;
10592 	int16	mws_framesync_assert_offset;
10593 	uint16	mws_framesync_assert_jitter;
10594 	uint16  mws_period_dur[LTECX_MAX_NUM_PERIOD_TYPES];
10595 	uint8	mws_period_type[LTECX_MAX_NUM_PERIOD_TYPES];
10596 	uint8	mws_num_periods;
10597 } mws_frame_config_t;
10598 
10599 /** MWS wci2 message */
10600 typedef struct {
10601 	uint8	mws_wci2_data; /**< BT-SIG msg */
10602 	uint8	PAD;
10603 	uint16	mws_wci2_interval; /**< Interval in us */
10604 	uint16	mws_wci2_repeat; /**< No of msgs to send */
10605 } mws_wci2_msg_t;
10606 /* MWS ANT map */
10607 typedef struct {
10608 	uint16	combo1; /* mws ant selection 1 */
10609 	uint16	combo2; /* mws ant selection 2 */
10610 	uint16	combo3; /* mws ant selection 3 */
10611 	uint16	combo4; /* mws ant selection 4 */
10612 } mws_ant_map_t;
10613 
10614 /* MWS SCAN_REQ Bitmap */
10615 typedef struct mws_scanreq_params {
10616 	uint16 idx;
10617 	uint16 bm_2g;
10618 	uint16 bm_5g_lo;
10619 	uint16 bm_5g_mid;
10620 	uint16 bm_5g_hi;
10621 } mws_scanreq_params_t;
10622 
10623 typedef struct {
10624 	uint32 config;	/**< MODE: AUTO (-1), Disable (0), Enable (1) */
10625 	uint32 status;	/**< Current state: Disabled (0), Enabled (1) */
10626 } wl_config_t;
10627 
10628 #define WLC_RSDB_MODE_AUTO_MASK 0x80
10629 #define WLC_RSDB_EXTRACT_MODE(val) ((int8)((val) & (~(WLC_RSDB_MODE_AUTO_MASK))))
10630 
10631 typedef struct {
10632 	uint16  request; /* type of sensor hub request */
10633 	uint16  enable; /* enable/disable response for specified request */
10634 	uint16  interval; /* interval between responses to the request */
10635 } shub_req_t;
10636 
10637 #define	WL_IF_STATS_T_VERSION 1	/**< current version of wl_if_stats structure */
10638 
10639 /** per interface counters */
10640 typedef struct wl_if_stats {
10641 	uint16	version;		/**< version of the structure */
10642 	uint16	length;			/**< length of the entire structure */
10643 	uint32	PAD;			/**< padding */
10644 
10645 	/* transmit stat counters */
10646 	uint64	txframe;		/**< tx data frames */
10647 	uint64	txbyte;			/**< tx data bytes */
10648 	uint64	txerror;		/**< tx data errors (derived: sum of others) */
10649 	uint64  txnobuf;		/**< tx out of buffer errors */
10650 	uint64  txrunt;			/**< tx runt frames */
10651 	uint64  txfail;			/**< tx failed frames */
10652 	uint64	txretry;		/**< tx retry frames */
10653 	uint64	txretrie;		/**< tx multiple retry frames */
10654 	uint64	txfrmsnt;		/**< tx sent frames */
10655 	uint64	txmulti;		/**< tx mulitcast sent frames */
10656 	uint64	txfrag;			/**< tx fragments sent */
10657 
10658 	/* receive stat counters */
10659 	uint64	rxframe;		/**< rx data frames */
10660 	uint64	rxbyte;			/**< rx data bytes */
10661 	uint64	rxerror;		/**< rx data errors (derived: sum of others) */
10662 	uint64	rxnobuf;		/**< rx out of buffer errors */
10663 	uint64  rxrunt;			/**< rx runt frames */
10664 	uint64  rxfragerr;		/**< rx fragment errors */
10665 	uint64	rxmulti;		/**< rx multicast frames */
10666 
10667 	uint64	txexptime;		/* DATA Tx frames suppressed due to timer expiration */
10668 	uint64	txrts;			/* RTS/CTS succeeeded count */
10669 	uint64	txnocts;		/* RTS/CTS faled count */
10670 
10671 	uint64	txretrans;		/* Number of frame retransmissions */
10672 }
10673 wl_if_stats_t;
10674 
10675 typedef struct wl_band {
10676 	uint16		bandtype;		/**< WL_BAND_2G, WL_BAND_5G */
10677 	uint16		bandunit;		/**< bandstate[] index */
10678 	uint16		phytype;		/**< phytype */
10679 	uint16		phyrev;
10680 }
10681 wl_band_t;
10682 
10683 #define	WL_WLC_VERSION_T_VERSION 1 /**< current version of wlc_version structure */
10684 
10685 /** wlc interface version */
10686 typedef struct wl_wlc_version {
10687 	uint16	version;		/**< version of the structure */
10688 	uint16	length;			/**< length of the entire structure */
10689 
10690 	/* epi version numbers */
10691 	uint16	epi_ver_major;		/**< epi major version number */
10692 	uint16	epi_ver_minor;		/**< epi minor version number */
10693 	uint16	epi_rc_num;		/**< epi RC number */
10694 	uint16	epi_incr_num;		/**< epi increment number */
10695 
10696 	/* wlc interface version numbers */
10697 	uint16	wlc_ver_major;		/**< wlc interface major version number */
10698 	uint16	wlc_ver_minor;		/**< wlc interface minor version number */
10699 }
10700 wl_wlc_version_t;
10701 
10702 /* Highest version of WLC_API_VERSION supported */
10703 #define WLC_API_VERSION_MAJOR_MAX	8
10704 #define WLC_API_VERSION_MINOR_MAX	0
10705 
10706 /* begin proxd definitions */
10707 #include <packed_section_start.h>
10708 
10709 #define WL_PROXD_API_VERSION 0x0300	/**< version 3.0 */
10710 
10711 /** Minimum supported API version */
10712 #define WL_PROXD_API_MIN_VERSION 0x0300
10713 
10714 /** proximity detection methods */
10715 enum {
10716 	WL_PROXD_METHOD_NONE	= 0,
10717 	WL_PROXD_METHOD_RSVD1	= 1, /**< backward compatibility - RSSI, not supported */
10718 	WL_PROXD_METHOD_TOF	= 2,
10719 	WL_PROXD_METHOD_RSVD2	= 3, /**< 11v only - if needed */
10720 	WL_PROXD_METHOD_FTM	= 4, /**< IEEE rev mc/2014 */
10721 	WL_PROXD_METHOD_MAX
10722 };
10723 typedef int16 wl_proxd_method_t;
10724 
10725 /** global and method configuration flags */
10726 enum {
10727 	WL_PROXD_FLAG_NONE			= 0x00000000,
10728 	WL_PROXD_FLAG_RX_ENABLED		= 0x00000001, /**< respond to requests, per bss */
10729 	WL_PROXD_FLAG_RX_RANGE_REQ		= 0x00000002, /**< 11mc range requests enabled */
10730 	WL_PROXD_FLAG_TX_LCI			= 0x00000004, /**< tx lci, if known */
10731 	WL_PROXD_FLAG_TX_CIVIC			= 0x00000008, /**< tx civic, if known */
10732 	WL_PROXD_FLAG_RX_AUTO_BURST		= 0x00000010, /**< auto respond w/o host action */
10733 	WL_PROXD_FLAG_TX_AUTO_BURST		= 0x00000020, /**< continue tx w/o host action */
10734 	WL_PROXD_FLAG_AVAIL_PUBLISH		= 0x00000040,     /**< publish availability */
10735 	WL_PROXD_FLAG_AVAIL_SCHEDULE		= 0x00000080,    /**< schedule using availability */
10736 	WL_PROXD_FLAG_ASAP_CAPABLE		= 0x00000100, /* ASAP capable */
10737 	WL_PROXD_FLAG_MBURST_FOLLOWUP		= 0x00000200, /* new multi-burst algorithm */
10738 	WL_PROXD_FLAG_SECURE			= 0x00000400, /* per bsscfg option */
10739 	WL_PROXD_FLAG_NO_TSF_SYNC		= 0x00000800, /* disable tsf sync */
10740 	WL_PROXD_FLAG_ALL			= 0xffffffff
10741 };
10742 typedef uint32 wl_proxd_flags_t;
10743 
10744 #define WL_PROXD_FLAGS_AVAIL (WL_PROXD_FLAG_AVAIL_PUBLISH | \
10745 	WL_PROXD_FLAG_AVAIL_SCHEDULE)
10746 
10747 /** session flags */
10748 enum {
10749 	WL_PROXD_SESSION_FLAG_NONE 		= 0x00000000,  /**< no flags */
10750 	WL_PROXD_SESSION_FLAG_INITIATOR 	= 0x00000001,  /**< local device is initiator */
10751 	WL_PROXD_SESSION_FLAG_TARGET 		= 0x00000002,  /**< local device is target */
10752 	WL_PROXD_SESSION_FLAG_ONE_WAY		= 0x00000004,  /**< (initiated) 1-way rtt */
10753 	WL_PROXD_SESSION_FLAG_AUTO_BURST	= 0x00000008,  /**< created w/ rx_auto_burst */
10754 	WL_PROXD_SESSION_FLAG_PERSIST		= 0x00000010,  /**< good until cancelled */
10755 	WL_PROXD_SESSION_FLAG_RTT_DETAIL	= 0x00000020,  /**< rtt detail in results */
10756 	WL_PROXD_SESSION_FLAG_SECURE		= 0x00000040,  /**< sessionis secure */
10757 	WL_PROXD_SESSION_FLAG_AOA		= 0x00000080,  /**< AOA along w/ RTT */
10758 	WL_PROXD_SESSION_FLAG_RX_AUTO_BURST	= 0x00000100,  /**< Same as proxd flags above */
10759 	WL_PROXD_SESSION_FLAG_TX_AUTO_BURST	= 0x00000200,  /**< Same as proxd flags above */
10760 	WL_PROXD_SESSION_FLAG_NAN_BSS		= 0x00000400,  /**< Use NAN BSS, if applicable */
10761 	WL_PROXD_SESSION_FLAG_TS1		= 0x00000800,  /**< e.g. FTM1 - ASAP-capable */
10762 	WL_PROXD_SESSION_FLAG_REPORT_FAILURE	= 0x00002000, /**< report failure to target */
10763 	WL_PROXD_SESSION_FLAG_INITIATOR_RPT	= 0x00004000, /**< report distance to target */
10764 	WL_PROXD_SESSION_FLAG_NOCHANSWT		= 0x00008000,
10765 	WL_PROXD_SESSION_FLAG_NETRUAL		= 0x00010000, /**< netrual mode */
10766 	WL_PROXD_SESSION_FLAG_SEQ_EN		= 0x00020000, /**< Toast */
10767 	WL_PROXD_SESSION_FLAG_NO_PARAM_OVRD	= 0x00040000, /**< no param override from target */
10768 	WL_PROXD_SESSION_FLAG_ASAP		= 0x00080000, /**< ASAP session */
10769 	WL_PROXD_SESSION_FLAG_REQ_LCI		= 0x00100000, /**< transmit LCI req */
10770 	WL_PROXD_SESSION_FLAG_REQ_CIV		= 0x00200000, /**< transmit civic loc req */
10771 	WL_PROXD_SESSION_FLAG_PRE_SCAN		= 0x00400000, /* enable pre-scan for asap=1 */
10772 	WL_PROXD_SESSION_FLAG_AUTO_VHTACK	= 0x00800000, /* use vhtack based on brcm ie */
10773 	WL_PROXD_SESSION_FLAG_VHTACK		= 0x01000000, /* vht ack is in use - output only */
10774 	WL_PROXD_SESSION_FLAG_BDUR_NOPREF	= 0x02000000, /* burst-duration: no preference */
10775 	WL_PROXD_SESSION_FLAG_NUM_FTM_NOPREF	= 0x04000000, /* num of FTM frames: no preference */
10776 	WL_PROXD_SESSION_FLAG_FTM_SEP_NOPREF	= 0x08000000, /* time btw FTM frams: no pref */
10777 	WL_PROXD_SESSION_FLAG_NUM_BURST_NOPREF	= 0x10000000, /* num of bursts: no pref */
10778 	WL_PROXD_SESSION_FLAG_BURST_PERIOD_NOPREF = 0x20000000, /* burst period: no pref */
10779 	WL_PROXD_SESSION_FLAG_MBURST_FOLLOWUP	= 0x40000000, /* new mburst algo  - reserved */
10780 	WL_PROXD_SESSION_FLAG_MBURST_NODELAY	= 0x80000000, /**< good until cancelled */
10781 	WL_PROXD_SESSION_FLAG_ALL		= 0xffffffff
10782 
10783 };
10784 typedef uint32 wl_proxd_session_flags_t;
10785 
10786 /** time units - mc supports up to 0.1ns resolution */
10787 enum {
10788 	WL_PROXD_TMU_TU			= 0,		/**< 1024us */
10789 	WL_PROXD_TMU_SEC		= 1,
10790 	WL_PROXD_TMU_MILLI_SEC	= 2,
10791 	WL_PROXD_TMU_MICRO_SEC	= 3,
10792 	WL_PROXD_TMU_NANO_SEC	= 4,
10793 	WL_PROXD_TMU_PICO_SEC	= 5
10794 };
10795 typedef int16 wl_proxd_tmu_t;
10796 
10797 /** time interval e.g. 10ns */
10798 typedef struct wl_proxd_intvl {
10799 	uint32 intvl;
10800 	wl_proxd_tmu_t tmu;
10801 	uint8	pad[2];
10802 } wl_proxd_intvl_t;
10803 
10804 /** commands that can apply to proxd, method or a session */
10805 enum {
10806 	WL_PROXD_CMD_NONE				= 0,
10807 	WL_PROXD_CMD_GET_VERSION		= 1,
10808 	WL_PROXD_CMD_ENABLE 			= 2,
10809 	WL_PROXD_CMD_DISABLE 			= 3,
10810 	WL_PROXD_CMD_CONFIG 			= 4,
10811 	WL_PROXD_CMD_START_SESSION 		= 5,
10812 	WL_PROXD_CMD_BURST_REQUEST 		= 6,
10813 	WL_PROXD_CMD_STOP_SESSION 		= 7,
10814 	WL_PROXD_CMD_DELETE_SESSION 	= 8,
10815 	WL_PROXD_CMD_GET_RESULT 		= 9,
10816 	WL_PROXD_CMD_GET_INFO 			= 10,
10817 	WL_PROXD_CMD_GET_STATUS 		= 11,
10818 	WL_PROXD_CMD_GET_SESSIONS 		= 12,
10819 	WL_PROXD_CMD_GET_COUNTERS 		= 13,
10820 	WL_PROXD_CMD_CLEAR_COUNTERS 	= 14,
10821 	WL_PROXD_CMD_COLLECT 			= 15,	/* not supported, see 'wl proxd_collect' */
10822 	WL_PROXD_CMD_TUNE 			= 16,	/* not supported, see 'wl proxd_tune' */
10823 	WL_PROXD_CMD_DUMP 				= 17,
10824 	WL_PROXD_CMD_START_RANGING		= 18,
10825 	WL_PROXD_CMD_STOP_RANGING		= 19,
10826 	WL_PROXD_CMD_GET_RANGING_INFO	= 20,
10827 	WL_PROXD_CMD_IS_TLV_SUPPORTED	= 21,
10828 
10829 	WL_PROXD_CMD_MAX
10830 };
10831 typedef int16 wl_proxd_cmd_t;
10832 
10833 /* session ids:
10834  * id 0 is reserved
10835  * ids 1..0x7fff - allocated by host/app
10836  * 0x8000-0xffff - allocated by firmware, used for auto/rx
10837  */
10838 enum {
10839 	 WL_PROXD_SESSION_ID_GLOBAL = 0
10840 };
10841 
10842 /* Externally allocated sids */
10843 #define WL_PROXD_SID_EXT_MAX 0x7fff
10844 #define WL_PROXD_SID_EXT_ALLOC(_sid) ((_sid) > 0 && (_sid) <= WL_PROXD_SID_EXT_MAX)
10845 
10846 /* block size for reserved sid blocks */
10847 #define WL_PROXD_SID_EXT_BLKSZ 256
10848 #define WL_PROXD_SID_EXT_BLK_START(_i) (WL_PROXD_SID_EXT_MAX - (_i) * WL_PROXD_SID_EXT_BLKSZ + 1)
10849 #define WL_PROXD_SID_EXT_BLK_END(_start) ((_start) + WL_PROXD_SID_EXT_BLKSZ - 1)
10850 
10851 /* rrm block */
10852 #define WL_PROXD_SID_RRM_START WL_PROXD_SID_EXT_BLK_START(1)
10853 #define WL_PROXD_SID_RRM_END WL_PROXD_SID_EXT_BLK_END(WL_PROXD_SID_RRM_START)
10854 
10855 /* nan block */
10856 #define WL_PROXD_SID_NAN_START WL_PROXD_SID_EXT_BLK_START(2)
10857 #define WL_PROXD_SID_NAN_END WL_PROXD_SID_EXT_BLK_END(WL_PROXD_SID_NAN_START)
10858 
10859 /** maximum number sessions that can be allocated, may be less if tunable */
10860 #define WL_PROXD_MAX_SESSIONS 16
10861 
10862 typedef uint16 wl_proxd_session_id_t;
10863 
10864 /** status - TBD BCME_ vs proxd status - range reserved for BCME_ */
10865 enum {
10866 	WL_PROXD_E_NOAVAIL		= -1056,
10867 	WL_PROXD_E_EXT_SCHED		= -1055,
10868 	WL_PROXD_E_NOT_BCM			= -1054,
10869 	WL_PROXD_E_FRAME_TYPE		= -1053,
10870 	WL_PROXD_E_VERNOSUPPORT		= -1052,
10871 	WL_PROXD_E_SEC_NOKEY		= -1051,
10872 	WL_PROXD_E_SEC_POLICY		= -1050,
10873 	WL_PROXD_E_SCAN_INPROCESS	= -1049,
10874 	WL_PROXD_E_BAD_PARTIAL_TSF	= -1048,
10875 	WL_PROXD_E_SCANFAIL			= -1047,
10876 	WL_PROXD_E_NOTSF			= -1046,
10877 	WL_PROXD_E_POLICY			= -1045,
10878 	WL_PROXD_E_INCOMPLETE		= -1044,
10879 	WL_PROXD_E_OVERRIDDEN		= -1043,
10880 	WL_PROXD_E_ASAP_FAILED		= -1042,
10881 	WL_PROXD_E_NOTSTARTED		= -1041,
10882 	WL_PROXD_E_INVALIDMEAS		= -1040,
10883 	WL_PROXD_E_INCAPABLE		= -1039,
10884 	WL_PROXD_E_MISMATCH			= -1038,
10885 	WL_PROXD_E_DUP_SESSION		= -1037,
10886 	WL_PROXD_E_REMOTE_FAIL		= -1036,
10887 	WL_PROXD_E_REMOTE_INCAPABLE = -1035,
10888 	WL_PROXD_E_SCHED_FAIL		= -1034,
10889 	WL_PROXD_E_PROTO			= -1033,
10890 	WL_PROXD_E_EXPIRED			= -1032,
10891 	WL_PROXD_E_TIMEOUT			= -1031,
10892 	WL_PROXD_E_NOACK			= -1030,
10893 	WL_PROXD_E_DEFERRED			= -1029,
10894 	WL_PROXD_E_INVALID_SID		= -1028,
10895 	WL_PROXD_E_REMOTE_CANCEL 	= -1027,
10896 	WL_PROXD_E_CANCELED			= -1026,	/**< local */
10897 	WL_PROXD_E_INVALID_SESSION	= -1025,
10898 	WL_PROXD_E_BAD_STATE		= -1024,
10899 	WL_PROXD_E_ERROR			= -1,
10900 	WL_PROXD_E_OK				= 0
10901 };
10902 typedef int32 wl_proxd_status_t;
10903 
10904 /* proxd errors from phy */
10905 #define PROXD_TOF_INIT_ERR_BITS 16
10906 
10907 enum {
10908 	WL_PROXD_PHY_ERR_LB_CORR_THRESH    = (1 << 0), /* Loopback Correlation threshold */
10909 	WL_PROXD_PHY_ERR_RX_CORR_THRESH    = (1 << 1), /* Received Correlation threshold */
10910 	WL_PROXD_PHY_ERR_LB_PEAK_POWER     = (1 << 2), /* Loopback Peak power   */
10911 	WL_PROXD_PHY_ERR_RX_PEAK_POWER     = (1 << 3), /* Received Peak power   */
10912 	WL_PROXD_PHY_ERR_BITFLIP           = (1 << 4), /* Bitflips */
10913 	WL_PROXD_PHY_ERR_SNR               = (1 << 5), /* SNR */
10914 	WL_PROXD_PHY_RX_STRT_WIN_OFF       = (1 << 6), /* Receive start window is off */
10915 	WL_PROXD_PHY_RX_END_WIN_OFF        = (1 << 7), /* Receive End window is off */
10916 	WL_PROXD_PHY_ERR_LOW_CONFIDENCE    = (1 << 15), /* Low confidence on meas distance */
10917 };
10918 typedef uint32 wl_proxd_phy_error_t;
10919 
10920 /** session states */
10921 enum {
10922 	WL_PROXD_SESSION_STATE_NONE				= 0,
10923 	WL_PROXD_SESSION_STATE_CREATED			= 1,
10924 	WL_PROXD_SESSION_STATE_CONFIGURED		= 2,
10925 	WL_PROXD_SESSION_STATE_STARTED			= 3,
10926 	WL_PROXD_SESSION_STATE_DELAY			= 4,
10927 	WL_PROXD_SESSION_STATE_USER_WAIT		= 5,
10928 	WL_PROXD_SESSION_STATE_SCHED_WAIT		= 6,
10929 	WL_PROXD_SESSION_STATE_BURST			= 7,
10930 	WL_PROXD_SESSION_STATE_STOPPING			= 8,
10931 	WL_PROXD_SESSION_STATE_ENDED			= 9,
10932 	WL_PROXD_SESSION_STATE_START_WAIT		= 10,
10933 	WL_PROXD_SESSION_STATE_DESTROYING		= -1
10934 };
10935 typedef int16 wl_proxd_session_state_t;
10936 
10937 /** RTT sample flags */
10938 enum {
10939 	WL_PROXD_RTT_SAMPLE_NONE = 0x00,
10940 	WL_PROXD_RTT_SAMPLE_DISCARD	= 0x01
10941 };
10942 typedef uint8 wl_proxd_rtt_sample_flags_t;
10943 typedef int16 wl_proxd_rssi_t;
10944 typedef uint16 wl_proxd_snr_t;
10945 typedef uint16 wl_proxd_bitflips_t;
10946 
10947 typedef struct wl_proxd_rtt_sample {
10948 	uint8				id;			/**< id for the sample - non-zero */
10949 	wl_proxd_rtt_sample_flags_t	flags;
10950 	wl_proxd_rssi_t			rssi;
10951 	wl_proxd_intvl_t			rtt;		/**< round trip time */
10952 	uint32				ratespec;
10953 	wl_proxd_snr_t                  snr;
10954 	wl_proxd_bitflips_t             bitflips;
10955 	wl_proxd_status_t               status;
10956 	int32                           distance;
10957 	wl_proxd_phy_error_t		tof_phy_error;
10958 	wl_proxd_phy_error_t		tof_tgt_phy_error; /* target phy error bit map */
10959 	wl_proxd_snr_t                  tof_tgt_snr;
10960 	wl_proxd_bitflips_t             tof_tgt_bitflips;
10961 	uint8                           coreid;
10962 	uint8                           pad[3];
10963 } wl_proxd_rtt_sample_t;
10964 
10965 /** result flags */
10966 enum {
10967 	WL_PRXOD_RESULT_FLAG_NONE	= 0x0000,
10968 	WL_PROXD_RESULT_FLAG_NLOS	= 0x0001,	/**< LOS - if available */
10969 	WL_PROXD_RESULT_FLAG_LOS	= 0x0002,	/**< NLOS - if available */
10970 	WL_PROXD_RESULT_FLAG_FATAL	= 0x0004,	/**< Fatal error during burst */
10971 	WL_PROXD_RESULT_FLAG_VHTACK	= 0x0008,	/* VHTACK or Legacy ACK used */
10972 	WL_PROXD_REQUEST_SENT		= 0x0010,	/* FTM request was sent */
10973 	WL_PROXD_REQUEST_ACKED		= 0x0020,	/* FTM request was acked */
10974 	WL_PROXD_LTFSEQ_STARTED		= 0x0040,	/* LTF sequence started */
10975 	WL_PROXD_RESULT_FLAG_ALL 	= 0xffff
10976 };
10977 typedef int16 wl_proxd_result_flags_t;
10978 
10979 /** rtt measurement result */
10980 typedef struct wl_proxd_rtt_result {
10981 	wl_proxd_session_id_t		sid;
10982 	wl_proxd_result_flags_t		flags;
10983 	wl_proxd_status_t		status;
10984 	struct ether_addr		peer;
10985 	wl_proxd_session_state_t	state;		/**< current state */
10986 	union {
10987 		wl_proxd_intvl_t		retry_after;	/* hint for errors */
10988 		wl_proxd_intvl_t		burst_duration; /* burst duration */
10989 	} u;
10990 	wl_proxd_rtt_sample_t		avg_rtt;
10991 	uint32				avg_dist;	/* 1/256m units */
10992 	uint16				sd_rtt;		/* RTT standard deviation */
10993 	uint8				num_valid_rtt;	/* valid rtt cnt */
10994 	uint8				num_ftm;	/* actual num of ftm cnt (Configured) */
10995 	uint16				burst_num;	/* in a session */
10996 	uint16				num_rtt;	/* 0 if no detail */
10997 	uint16				num_meas;	/* number of ftm frames seen OTA */
10998 	uint8                           pad[2];
10999 	wl_proxd_rtt_sample_t		rtt[1];		/* variable */
11000 } wl_proxd_rtt_result_t;
11001 
11002 /** aoa measurement result */
11003 typedef struct wl_proxd_aoa_result {
11004 	wl_proxd_session_id_t			sid;
11005 	wl_proxd_result_flags_t			flags;
11006 	wl_proxd_status_t				status;
11007 	struct ether_addr				peer;
11008 	wl_proxd_session_state_t		state;
11009 	uint16							burst_num;
11010 	uint8							pad[2];
11011 	/* wl_proxd_aoa_sample_t sample_avg; TBD */
11012 } BWL_POST_PACKED_STRUCT wl_proxd_aoa_result_t;
11013 #include <packed_section_end.h>
11014 
11015 /** global stats */
11016 typedef struct wl_proxd_counters {
11017 	uint32 tx;					/**< tx frame count */
11018 	uint32 rx;					/**< rx frame count */
11019 	uint32 burst;				/**< total number of burst */
11020 	uint32 sessions;			/**< total number of sessions */
11021 	uint32 max_sessions;		/**< max concurrency */
11022 	uint32 sched_fail;			/**< scheduling failures */
11023 	uint32 timeouts;			/**< timeouts */
11024 	uint32 protoerr;			/**< protocol errors */
11025 	uint32 noack;				/**< tx w/o ack */
11026 	uint32 txfail;				/**< any tx falure */
11027 	uint32 lci_req_tx;			/**< tx LCI requests */
11028 	uint32 lci_req_rx;			/**< rx LCI requests */
11029 	uint32 lci_rep_tx;			/**< tx LCI reports */
11030 	uint32 lci_rep_rx;			/**< rx LCI reports */
11031 	uint32 civic_req_tx;		/**< tx civic requests */
11032 	uint32 civic_req_rx;		/**< rx civic requests */
11033 	uint32 civic_rep_tx;		/**< tx civic reports */
11034 	uint32 civic_rep_rx;		/**< rx civic reports */
11035 	uint32 rctx;				/**< ranging contexts created */
11036 	uint32 rctx_done;			/**< count of ranging done */
11037 	uint32 publish_err;     /**< availability publishing errors */
11038 	uint32 on_chan;         /**< count of scheduler onchan */
11039 	uint32 off_chan;        /**< count of scheduler offchan */
11040 	uint32 tsf_lo;          /* local tsf or session tsf */
11041 	uint32 tsf_hi;
11042 	uint32 num_meas;
11043 } wl_proxd_counters_t;
11044 
11045 typedef struct wl_proxd_counters wl_proxd_session_counters_t;
11046 
11047 enum {
11048 	WL_PROXD_CAP_NONE 		= 0x0000,
11049 	WL_PROXD_CAP_ALL 		= 0xffff
11050 };
11051 typedef int16 wl_proxd_caps_t;
11052 
11053 /** method capabilities */
11054 enum {
11055 	WL_PROXD_FTM_CAP_NONE = 0x0000,
11056 	WL_PROXD_FTM_CAP_FTM1 = 0x0001
11057 };
11058 typedef uint16 wl_proxd_ftm_caps_t;
11059 
11060 typedef struct wl_proxd_tlv_id_list {
11061 	uint16			num_ids;
11062 	uint16			ids[1];
11063 } wl_proxd_tlv_id_list_t;
11064 
11065 typedef struct wl_proxd_session_id_list {
11066 	uint16 num_ids;
11067 	wl_proxd_session_id_t ids[1];
11068 } wl_proxd_session_id_list_t;
11069 
11070 typedef struct wl_proxd_tpk {
11071 	struct ether_addr	peer;
11072 	uint8 tpk[TPK_FTM_LEN];
11073 } wl_proxd_tpk_t;
11074 
11075 /* tlvs returned for get_info on ftm method
11076  *	configuration:
11077  *	proxd flags
11078  *	event mask
11079  *	debug mask
11080  *	session defaults (session tlvs)
11081  * status tlv - not supported for ftm method
11082  * info tlv
11083  */
11084 typedef struct wl_proxd_ftm_info {
11085 	wl_proxd_ftm_caps_t caps;
11086 	uint16 max_sessions;
11087 	uint16 num_sessions;
11088 	uint16 rx_max_burst;
11089 } wl_proxd_ftm_info_t;
11090 
11091 enum {
11092 	WL_PROXD_WAIT_NONE  = 0x0000,
11093 	WL_PROXD_WAIT_KEY	= 0x0001,
11094 	WL_PROXD_WAIT_SCHED	= 0x0002,
11095 	WL_PROXD_WAIT_TSF	= 0x0004
11096 };
11097 typedef int16 wl_proxd_wait_reason_t;
11098 
11099 /* tlvs returned for get_info on session
11100  * session config (tlvs)
11101  * session info tlv
11102  */
11103 typedef struct wl_proxd_ftm_session_info {
11104 	uint16 sid;
11105 	uint8 bss_index;
11106 	uint8 pad;
11107 	struct ether_addr bssid;
11108 	wl_proxd_session_state_t state;
11109 	wl_proxd_status_t status;
11110 	uint16	burst_num;
11111 	wl_proxd_wait_reason_t wait_reason;
11112 	uint32	meas_start_lo; /* sn tsf of 1st meas for cur/prev burst */
11113 	uint32	meas_start_hi;
11114 } wl_proxd_ftm_session_info_t;
11115 
11116 typedef struct wl_proxd_ftm_session_status {
11117 	uint16 sid;
11118 	wl_proxd_session_state_t state;
11119 	wl_proxd_status_t status;
11120 	uint16	burst_num;
11121 	uint16	pad;
11122 } wl_proxd_ftm_session_status_t;
11123 
11124 /** rrm range request */
11125 typedef struct wl_proxd_range_req {
11126 	uint16 			num_repeat;
11127 	uint16			init_delay_range;	/**< in TUs */
11128 	uint8			pad;
11129 	uint8			num_nbr;		/**< number of (possible) neighbors */
11130 	nbr_element_t		nbr[1];
11131 } wl_proxd_range_req_t;
11132 
11133 #define WL_PROXD_LCI_LAT_OFF 	0
11134 #define WL_PROXD_LCI_LONG_OFF 	5
11135 #define WL_PROXD_LCI_ALT_OFF 	10
11136 
11137 #define WL_PROXD_LCI_GET_LAT(_lci, _lat, _lat_err) { \
11138 	unsigned _off = WL_PROXD_LCI_LAT_OFF; \
11139 	_lat_err = (_lci)->data[(_off)] & 0x3f; \
11140 	_lat = (_lci)->data[(_off)+1]; \
11141 	_lat |= (_lci)->data[(_off)+2] << 8; \
11142 	_lat |= (_lci)->data[_(_off)+3] << 16; \
11143 	_lat |= (_lci)->data[(_off)+4] << 24; \
11144 	_lat <<= 2; \
11145 	_lat |= (_lci)->data[(_off)] >> 6; \
11146 }
11147 
11148 #define WL_PROXD_LCI_GET_LONG(_lci, _lcilong, _long_err) { \
11149 	unsigned _off = WL_PROXD_LCI_LONG_OFF; \
11150 	_long_err = (_lci)->data[(_off)] & 0x3f; \
11151 	_lcilong = (_lci)->data[(_off)+1]; \
11152 	_lcilong |= (_lci)->data[(_off)+2] << 8; \
11153 	_lcilong |= (_lci)->data[_(_off)+3] << 16; \
11154 	_lcilong |= (_lci)->data[(_off)+4] << 24; \
11155 	__lcilong <<= 2; \
11156 	_lcilong |= (_lci)->data[(_off)] >> 6; \
11157 }
11158 
11159 #define WL_PROXD_LCI_GET_ALT(_lci, _alt_type, _alt, _alt_err) { \
11160 	unsigned _off = WL_PROXD_LCI_ALT_OFF; \
11161 	_alt_type = (_lci)->data[_off] & 0x0f; \
11162 	_alt_err = (_lci)->data[(_off)] >> 4; \
11163 	_alt_err |= ((_lci)->data[(_off)+1] & 0x03) << 4; \
11164 	_alt = (_lci)->data[(_off)+2]; \
11165 	_alt |= (_lci)->data[(_off)+3] << 8; \
11166 	_alt |= (_lci)->data[_(_off)+4] << 16; \
11167 	_alt <<= 6; \
11168 	_alt |= (_lci)->data[(_off) + 1] >> 2; \
11169 }
11170 
11171 #define WL_PROXD_LCI_VERSION(_lci) ((_lci)->data[15] >> 6)
11172 
11173 /* availability. advertising mechanism bss specific */
11174 /** availablity flags */
11175 enum {
11176 	WL_PROXD_AVAIL_NONE = 0,
11177 	WL_PROXD_AVAIL_NAN_PUBLISHED = 0x0001,
11178 	WL_PROXD_AVAIL_SCHEDULED = 0x0002        /**< scheduled by proxd */
11179 };
11180 typedef int16 wl_proxd_avail_flags_t;
11181 
11182 /** time reference */
11183 enum {
11184 	WL_PROXD_TREF_NONE = 0,
11185 	WL_PROXD_TREF_DEV_TSF = 1,
11186 	WL_PROXD_TREF_NAN_DW = 2,
11187 	WL_PROXD_TREF_TBTT = 3,
11188 	WL_PROXD_TREF_MAX		/* last entry */
11189 };
11190 typedef int16 wl_proxd_time_ref_t;
11191 
11192 /** proxd channel-time slot */
11193 typedef struct {
11194 	wl_proxd_intvl_t start;         /**< from ref */
11195 	wl_proxd_intvl_t duration;      /**< from start */
11196 	uint32  chanspec;
11197 } wl_proxd_time_slot_t;
11198 
11199 typedef struct wl_proxd_avail24 {
11200 	wl_proxd_avail_flags_t flags; /**< for query only */
11201 	wl_proxd_time_ref_t time_ref;
11202 	uint16	max_slots; /**< for query only */
11203 	uint16  num_slots;
11204 	wl_proxd_time_slot_t slots[1];	/**< ROM compat - not used */
11205 	wl_proxd_intvl_t 	repeat;
11206 	wl_proxd_time_slot_t ts0[1];
11207 } wl_proxd_avail24_t;
11208 #define WL_PROXD_AVAIL24_TIMESLOT(_avail24, _i) (&(_avail24)->ts0[(_i)])
11209 #define WL_PROXD_AVAIL24_TIMESLOT_OFFSET(_avail24) OFFSETOF(wl_proxd_avail24_t, ts0)
11210 #define WL_PROXD_AVAIL24_TIMESLOTS(_avail24) WL_PROXD_AVAIL24_TIMESLOT(_avail24, 0)
11211 #define WL_PROXD_AVAIL24_SIZE(_avail24, _num_slots) (\
11212 	WL_PROXD_AVAIL24_TIMESLOT_OFFSET(_avail24) + \
11213 	(_num_slots) * sizeof(*WL_PROXD_AVAIL24_TIMESLOT(_avail24, 0)))
11214 
11215 typedef struct wl_proxd_avail {
11216 	wl_proxd_avail_flags_t flags; /**< for query only */
11217 	wl_proxd_time_ref_t time_ref;
11218 	uint16	max_slots; /**< for query only */
11219 	uint16  num_slots;
11220 	wl_proxd_intvl_t 	repeat;
11221 	wl_proxd_time_slot_t slots[1];
11222 } wl_proxd_avail_t;
11223 #define WL_PROXD_AVAIL_TIMESLOT(_avail, _i) (&(_avail)->slots[(_i)])
11224 #define WL_PROXD_AVAIL_TIMESLOT_OFFSET(_avail) OFFSETOF(wl_proxd_avail_t, slots)
11225 
11226 #define WL_PROXD_AVAIL_TIMESLOTS(_avail) WL_PROXD_AVAIL_TIMESLOT(_avail, 0)
11227 #define WL_PROXD_AVAIL_SIZE(_avail, _num_slots) (\
11228 	WL_PROXD_AVAIL_TIMESLOT_OFFSET(_avail) + \
11229 	(_num_slots) * sizeof(*WL_PROXD_AVAIL_TIMESLOT(_avail, 0)))
11230 
11231 /* collect support TBD */
11232 
11233 /** debugging */
11234 enum {
11235 	WL_PROXD_DEBUG_NONE		= 0x00000000,
11236 	WL_PROXD_DEBUG_LOG		= 0x00000001,
11237 	WL_PROXD_DEBUG_IOV		= 0x00000002,
11238 	WL_PROXD_DEBUG_EVENT		= 0x00000004,
11239 	WL_PROXD_DEBUG_SESSION		= 0x00000008,
11240 	WL_PROXD_DEBUG_PROTO		= 0x00000010,
11241 	WL_PROXD_DEBUG_SCHED		= 0x00000020,
11242 	WL_PROXD_DEBUG_RANGING		= 0x00000040,
11243 	WL_PROXD_DEBUG_NAN		= 0x00000080,
11244 	WL_PROXD_DEBUG_PKT		= 0x00000100,
11245 	WL_PROXD_DEBUG_SEC		= 0x00000200,
11246 	WL_PROXD_DEBUG_EVENTLOG		= 0x80000000,	/* map/enable EVNET_LOG_TAG_PROXD_INFO */
11247 	WL_PROXD_DEBUG_ALL		= 0xffffffff
11248 };
11249 typedef uint32 wl_proxd_debug_mask_t;
11250 
11251 /** tlv IDs - data length 4 bytes unless overridden by type, alignment 32 bits */
11252 enum {
11253 	WL_PROXD_TLV_ID_NONE			= 0,
11254 	WL_PROXD_TLV_ID_METHOD			= 1,
11255 	WL_PROXD_TLV_ID_FLAGS			= 2,
11256 	WL_PROXD_TLV_ID_CHANSPEC		= 3,	/**< note: uint32 */
11257 	WL_PROXD_TLV_ID_TX_POWER		= 4,
11258 	WL_PROXD_TLV_ID_RATESPEC		= 5,
11259 	WL_PROXD_TLV_ID_BURST_DURATION		= 6,	/**< intvl - length of burst */
11260 	WL_PROXD_TLV_ID_BURST_PERIOD		= 7,	/**< intvl - between bursts */
11261 	WL_PROXD_TLV_ID_BURST_FTM_SEP		= 8,	/**< intvl - between FTMs */
11262 	WL_PROXD_TLV_ID_BURST_NUM_FTM		= 9,	/**< uint16 - per burst */
11263 	WL_PROXD_TLV_ID_NUM_BURST		= 10,	/**< uint16 */
11264 	WL_PROXD_TLV_ID_FTM_RETRIES		= 11,	/**< uint16 at FTM level */
11265 	WL_PROXD_TLV_ID_BSS_INDEX		= 12,	/**< uint8 */
11266 	WL_PROXD_TLV_ID_BSSID			= 13,
11267 	WL_PROXD_TLV_ID_INIT_DELAY		= 14,	/**< intvl - optional,non-standalone only */
11268 	WL_PROXD_TLV_ID_BURST_TIMEOUT		= 15,	/**< expect response within - intvl */
11269 	WL_PROXD_TLV_ID_EVENT_MASK		= 16,	/**< interested events - in/out */
11270 	WL_PROXD_TLV_ID_FLAGS_MASK		= 17,	/**< interested flags - in only */
11271 	WL_PROXD_TLV_ID_PEER_MAC		= 18,	/**< mac address of peer */
11272 	WL_PROXD_TLV_ID_FTM_REQ			= 19,	/**< dot11_ftm_req */
11273 	WL_PROXD_TLV_ID_LCI_REQ			= 20,
11274 	WL_PROXD_TLV_ID_LCI			= 21,
11275 	WL_PROXD_TLV_ID_CIVIC_REQ		= 22,
11276 	WL_PROXD_TLV_ID_CIVIC			= 23,
11277 	WL_PROXD_TLV_ID_AVAIL24			= 24,	/**< ROM compatibility */
11278 	WL_PROXD_TLV_ID_SESSION_FLAGS		= 25,
11279 	WL_PROXD_TLV_ID_SESSION_FLAGS_MASK	= 26,	/**< in only */
11280 	WL_PROXD_TLV_ID_RX_MAX_BURST		= 27,	/**< uint16 - limit bursts per session */
11281 	WL_PROXD_TLV_ID_RANGING_INFO		= 28,	/**< ranging info */
11282 	WL_PROXD_TLV_ID_RANGING_FLAGS		= 29,	/**< uint16 */
11283 	WL_PROXD_TLV_ID_RANGING_FLAGS_MASK	= 30,	/**< uint16, in only */
11284 	WL_PROXD_TLV_ID_NAN_MAP_ID		= 31,
11285 	WL_PROXD_TLV_ID_DEV_ADDR		= 32,
11286 	WL_PROXD_TLV_ID_AVAIL			= 33,	/**< wl_proxd_avail_t  */
11287 	WL_PROXD_TLV_ID_TLV_ID			= 34,	/* uint16 tlv-id */
11288 	WL_PROXD_TLV_ID_FTM_REQ_RETRIES		= 35,	/* uint16 FTM request retries */
11289 	WL_PROXD_TLV_ID_TPK			= 36,	/* 32byte TPK  */
11290 	WL_PROXD_TLV_ID_RI_RR			= 36,	/* RI_RR */
11291 	WL_PROXD_TLV_ID_TUNE			= 37,	/* wl_proxd_pararms_tof_tune_t */
11292 
11293 	/* output - 512 + x */
11294 	WL_PROXD_TLV_ID_STATUS			= 512,
11295 	WL_PROXD_TLV_ID_COUNTERS		= 513,
11296 	WL_PROXD_TLV_ID_INFO			= 514,
11297 	WL_PROXD_TLV_ID_RTT_RESULT		= 515,
11298 	WL_PROXD_TLV_ID_AOA_RESULT		= 516,
11299 	WL_PROXD_TLV_ID_SESSION_INFO		= 517,
11300 	WL_PROXD_TLV_ID_SESSION_STATUS		= 518,
11301 	WL_PROXD_TLV_ID_SESSION_ID_LIST		= 519,
11302 
11303 	/* debug tlvs can be added starting 1024 */
11304 	WL_PROXD_TLV_ID_DEBUG_MASK		= 1024,
11305 	WL_PROXD_TLV_ID_COLLECT			= 1025,	/**< output only */
11306 	WL_PROXD_TLV_ID_STRBUF			= 1026,
11307 
11308 	WL_PROXD_TLV_ID_COLLECT_HEADER		= 1025,	/* wl_proxd_collect_header_t */
11309 	WL_PROXD_TLV_ID_COLLECT_INFO		= 1028,	/* wl_proxd_collect_info_t */
11310 	WL_PROXD_TLV_ID_COLLECT_DATA		= 1029,	/* wl_proxd_collect_data_t */
11311 	WL_PROXD_TLV_ID_COLLECT_CHAN_DATA	= 1030,	/* wl_proxd_collect_data_t */
11312 
11313 	WL_PROXD_TLV_ID_MAX
11314 };
11315 
11316 typedef struct wl_proxd_tlv {
11317 	uint16 id;
11318 	uint16 len;
11319 	uint8  data[1];
11320 } wl_proxd_tlv_t;
11321 
11322 /** proxd iovar - applies to proxd, method or session */
11323 typedef struct wl_proxd_iov {
11324 	uint16                  version;
11325 	uint16                  len;
11326 	wl_proxd_cmd_t          cmd;
11327 	wl_proxd_method_t       method;
11328 	wl_proxd_session_id_t   sid;
11329 	uint8                   PAD[2];
11330 	wl_proxd_tlv_t          tlvs[1];	/**< variable */
11331 } wl_proxd_iov_t;
11332 
11333 #define WL_PROXD_IOV_HDR_SIZE OFFSETOF(wl_proxd_iov_t, tlvs)
11334 
11335 /* The following event definitions may move to bcmevent.h, but sharing proxd types
11336  * across needs more invasive changes unrelated to proxd
11337  */
11338 enum {
11339 	WL_PROXD_EVENT_NONE			= 0,	/**< not an event, reserved */
11340 	WL_PROXD_EVENT_SESSION_CREATE		= 1,
11341 	WL_PROXD_EVENT_SESSION_START		= 2,
11342 	WL_PROXD_EVENT_FTM_REQ			= 3,
11343 	WL_PROXD_EVENT_BURST_START		= 4,
11344 	WL_PROXD_EVENT_BURST_END		= 5,
11345 	WL_PROXD_EVENT_SESSION_END		= 6,
11346 	WL_PROXD_EVENT_SESSION_RESTART		= 7,
11347 	WL_PROXD_EVENT_BURST_RESCHED		= 8,	/**< burst rescheduled-e.g. partial TSF */
11348 	WL_PROXD_EVENT_SESSION_DESTROY		= 9,
11349 	WL_PROXD_EVENT_RANGE_REQ		= 10,
11350 	WL_PROXD_EVENT_FTM_FRAME		= 11,
11351 	WL_PROXD_EVENT_DELAY			= 12,
11352 	WL_PROXD_EVENT_VS_INITIATOR_RPT		= 13,	/**< (target) rx initiator-report */
11353 	WL_PROXD_EVENT_RANGING			= 14,
11354 	WL_PROXD_EVENT_LCI_MEAS_REP		= 15,	/* LCI measurement report */
11355 	WL_PROXD_EVENT_CIVIC_MEAS_REP		= 16,	/* civic measurement report */
11356 	WL_PROXD_EVENT_COLLECT			= 17,
11357 	WL_PROXD_EVENT_START_WAIT		= 18,	/* waiting to start */
11358 
11359 	WL_PROXD_EVENT_MAX
11360 };
11361 typedef int16 wl_proxd_event_type_t;
11362 
11363 /** proxd event mask - upto 32 events for now */
11364 typedef uint32 wl_proxd_event_mask_t;
11365 
11366 #define WL_PROXD_EVENT_MASK_ALL 0xfffffffe
11367 #define WL_PROXD_EVENT_MASK_EVENT(_event_type) (1 << (_event_type))
11368 #define WL_PROXD_EVENT_ENABLED(_mask, _event_type) (\
11369 	((_mask) & WL_PROXD_EVENT_MASK_EVENT(_event_type)) != 0)
11370 
11371 /** proxd event - applies to proxd, method or session */
11372 typedef struct wl_proxd_event {
11373 	uint16					version;
11374 	uint16					len;
11375 	wl_proxd_event_type_t 	type;
11376 	wl_proxd_method_t 		method;
11377 	wl_proxd_session_id_t 	sid;
11378 	uint8					pad[2];
11379 	wl_proxd_tlv_t 			tlvs[1];	/**< variable */
11380 } wl_proxd_event_t;
11381 
11382 enum {
11383 	WL_PROXD_RANGING_STATE_NONE = 0,
11384 	WL_PROXD_RANGING_STATE_NOTSTARTED = 1,
11385 	WL_PROXD_RANGING_STATE_INPROGRESS = 2,
11386 	WL_PROXD_RANGING_STATE_DONE = 3
11387 };
11388 typedef int16 wl_proxd_ranging_state_t;
11389 
11390 /** proxd ranging flags */
11391 enum {
11392 	WL_PROXD_RANGING_FLAG_NONE = 0x0000,  /**< no flags */
11393 	WL_PROXD_RANGING_FLAG_DEL_SESSIONS_ON_STOP = 0x0001,
11394 	WL_PROXD_RANGING_FLAG_ALL = 0xffff
11395 };
11396 typedef uint16 wl_proxd_ranging_flags_t;
11397 
11398 struct wl_proxd_ranging_info {
11399 	wl_proxd_status_t   status;
11400 	wl_proxd_ranging_state_t state;
11401 	wl_proxd_ranging_flags_t flags;
11402 	uint16	num_sids;
11403 	uint16	num_done;
11404 };
11405 typedef struct wl_proxd_ranging_info wl_proxd_ranging_info_t;
11406 
11407 #include <packed_section_start.h>
11408 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_event_data {
11409 	uint32                  H_LB[K_TOF_COLLECT_H_SIZE_20MHZ];
11410 	uint32                  H_RX[K_TOF_COLLECT_H_SIZE_20MHZ];
11411 	uint8                   ri_rr[FTM_TPK_LEN];
11412 	wl_proxd_phy_error_t    phy_err_mask;
11413 } BWL_POST_PACKED_STRUCT wl_proxd_collect_event_data_t;
11414 #include <packed_section_end.h>
11415 
11416 /** Data returned by the bssload_report iovar. This is also the WLC_E_BSS_LOAD event data */
11417 #include <packed_section_start.h>
11418 typedef BWL_PRE_PACKED_STRUCT struct wl_bssload {
11419 	uint16 sta_count;		/**< station count */
11420 	uint16 aac;			/**< available admission capacity */
11421 	uint8 chan_util;		/**< channel utilization */
11422 } BWL_POST_PACKED_STRUCT wl_bssload_t;
11423 #include <packed_section_end.h>
11424 
11425 /**
11426  * Maximum number of configurable BSS Load levels.  The number of BSS Load
11427  * ranges is always 1 more than the number of configured levels.  eg. if
11428  * 3 levels of 10, 20, 30 are configured then this defines 4 load ranges:
11429  * 0-10, 11-20, 21-30, 31-255.  A WLC_E_BSS_LOAD event is generated each time
11430  * the utilization level crosses into another range, subject to the rate limit.
11431  */
11432 #define MAX_BSSLOAD_LEVELS 8
11433 #define MAX_BSSLOAD_RANGES (MAX_BSSLOAD_LEVELS + 1)
11434 
11435 /** BSS Load event notification configuration. */
11436 typedef struct wl_bssload_cfg {
11437 	uint32 rate_limit_msec;	/**< # of events posted to application will be limited to
11438 				 * one per specified period (0 to disable rate limit).
11439 				 */
11440 	uint8 num_util_levels;	/**< Number of entries in util_levels[] below */
11441 	uint8 util_levels[MAX_BSSLOAD_LEVELS];
11442 				/**< Variable number of BSS Load utilization levels in
11443 				 * low to high order.  An event will be posted each time
11444 				 * a received beacon's BSS Load IE channel utilization
11445 				 * value crosses a level.
11446 				 */
11447 	uint8 PAD[3];
11448 } wl_bssload_cfg_t;
11449 
11450 /** Multiple roaming profile suport */
11451 #define WL_MAX_ROAM_PROF_BRACKETS	4
11452 
11453 #define WL_ROAM_PROF_VER_0	0
11454 #define WL_ROAM_PROF_VER_1	1
11455 #define WL_MAX_ROAM_PROF_VER	WL_ROAM_PROF_VER_1
11456 
11457 #define WL_ROAM_PROF_NONE	(0 << 0)
11458 #define WL_ROAM_PROF_LAZY	(1 << 0)
11459 #define WL_ROAM_PROF_NO_CI	(1 << 1)
11460 #define WL_ROAM_PROF_SUSPEND	(1 << 2)
11461 #define WL_ROAM_PROF_SYNC_DTIM	(1 << 6)
11462 #define WL_ROAM_PROF_DEFAULT	(1 << 7)	/**< backward compatible single default profile */
11463 
11464 #define WL_FACTOR_TABLE_MAX_LIMIT 5
11465 
11466 #define WL_CU_2G_ROAM_TRIGGER (-60)
11467 #define WL_CU_5G_ROAM_TRIGGER (-70)
11468 
11469 #define WL_CU_SCORE_DELTA_DEFAULT 20
11470 
11471 #define WL_MAX_CHANNEL_USAGE 0x0FF
11472 #define WL_CU_PERCENTAGE_DISABLE 0
11473 #define WL_CU_PERCENTAGE_DEFAULT 70
11474 #define WL_CU_PERCENTAGE_MAX 100
11475 #define WL_CU_CALC_DURATION_DEFAULT 10 /* seconds */
11476 #define WL_CU_CALC_DURATION_MAX 60 /* seconds */
11477 
11478 typedef struct wl_roam_prof_v2 {
11479 	int8	roam_flags;		/**< bit flags */
11480 	int8	roam_trigger;		/**< RSSI trigger level per profile/RSSI bracket */
11481 	int8	rssi_lower;
11482 	int8	roam_delta;
11483 
11484 	/* if channel_usage if zero, roam_delta is rssi delta required for new AP */
11485 	/* if channel_usage if non-zero, roam_delta is score delta(%) required for new AP */
11486 	int8	rssi_boost_thresh;	/**< Min RSSI to qualify for RSSI boost */
11487 	int8	rssi_boost_delta;	/**< RSSI boost for AP in the other band */
11488 	uint16	nfscan;			/**< number of full scan to start with */
11489 	uint16	fullscan_period;
11490 	uint16	init_scan_period;
11491 	uint16	backoff_multiplier;
11492 	uint16	max_scan_period;
11493 	uint8	channel_usage;
11494 	uint8	cu_avg_calc_dur;
11495 	uint8	pad[2];
11496 } wl_roam_prof_v2_t;
11497 
11498 typedef struct wl_roam_prof_v1 {
11499 	int8	roam_flags;		/**< bit flags */
11500 	int8	roam_trigger;		/**< RSSI trigger level per profile/RSSI bracket */
11501 	int8	rssi_lower;
11502 	int8	roam_delta;
11503 
11504 	/* if channel_usage if zero, roam_delta is rssi delta required for new AP */
11505 	/* if channel_usage if non-zero, roam_delta is score delta(%) required for new AP */
11506 	int8	rssi_boost_thresh;	/**< Min RSSI to qualify for RSSI boost */
11507 	int8	rssi_boost_delta;	/**< RSSI boost for AP in the other band */
11508 	uint16	nfscan;			/**< number of full scan to start with */
11509 	uint16	fullscan_period;
11510 	uint16	init_scan_period;
11511 	uint16	backoff_multiplier;
11512 	uint16	max_scan_period;
11513 } wl_roam_prof_v1_t;
11514 
11515 typedef struct wl_roam_prof_band_v2 {
11516 	uint32	band;			/**< Must be just one band */
11517 	uint16	ver;			/**< version of this struct */
11518 	uint16	len;			/**< length in bytes of this structure */
11519 	wl_roam_prof_v2_t roam_prof[WL_MAX_ROAM_PROF_BRACKETS];
11520 } wl_roam_prof_band_v2_t;
11521 
11522 typedef struct wl_roam_prof_band_v1 {
11523 	uint32	band;			/**< Must be just one band */
11524 	uint16	ver;			/**< version of this struct */
11525 	uint16	len;			/**< length in bytes of this structure */
11526 	wl_roam_prof_v1_t roam_prof[WL_MAX_ROAM_PROF_BRACKETS];
11527 } wl_roam_prof_band_v1_t;
11528 
11529 #define BSS_MAXTABLE_SIZE 10
11530 #define WNM_BSS_SELECT_FACTOR_VERSION   1
11531 typedef struct wnm_bss_select_factor_params {
11532 	uint8 low;
11533 	uint8 high;
11534 	uint8 factor;
11535 	uint8 pad;
11536 } wnm_bss_select_factor_params_t;
11537 
11538 #define WNM_BSS_SELECT_FIXED_SIZE OFFSETOF(wnm_bss_select_factor_cfg_t, params)
11539 typedef struct wnm_bss_select_factor_cfg {
11540 	uint8 version;
11541 	uint8 band;
11542 	uint16 type;
11543 	uint16 pad;
11544 	uint16 count;
11545 	wnm_bss_select_factor_params_t params[1];
11546 } wnm_bss_select_factor_cfg_t;
11547 
11548 #define WNM_BSS_SELECT_WEIGHT_VERSION   1
11549 typedef struct wnm_bss_select_weight_cfg {
11550 	uint8 version;
11551 	uint8 band;
11552 	uint16 type;
11553 	uint16 weight; /* weightage for each type between 0 to 100 */
11554 } wnm_bss_select_weight_cfg_t;
11555 
11556 #define WNM_BSS_SELECT_TYPE_RSSI   0
11557 #define WNM_BSS_SELECT_TYPE_CU   1
11558 
11559 #define WNM_BSSLOAD_MONITOR_VERSION   1
11560 typedef struct wnm_bssload_monitor_cfg {
11561 	uint8 version;
11562 	uint8 band;
11563 	uint8 duration; /* duration between 1 to 20sec */
11564 } wnm_bssload_monitor_cfg_t;
11565 
11566 #define WNM_ROAM_TRIGGER_VERSION   1
11567 typedef struct wnm_roam_trigger_cfg {
11568 	uint8 version;
11569 	uint8 band;
11570 	uint16 type;
11571 	int16 trigger; /* trigger for each type in new roam algorithm */
11572 } wnm_roam_trigger_cfg_t;
11573 
11574 /* Data structures for Interface Create/Remove  */
11575 
11576 #define WL_INTERFACE_CREATE_VER	(0)
11577 #define WL_INTERFACE_CREATE_VER_1	1
11578 #define WL_INTERFACE_CREATE_VER_2	2
11579 #define WL_INTERFACE_CREATE_VER_3	3
11580 
11581 /*
11582  * The flags filed of the wl_interface_create is designed to be
11583  * a Bit Mask. As of now only Bit 0 and Bit 1 are used as mentioned below.
11584  * The rest of the bits can be used, incase we have to provide
11585  * more information to the dongle
11586  */
11587 
11588 /*
11589  * Bit 0 of flags field is used to inform whether the interface requested to
11590  * be created is STA or AP.
11591  * 0 - Create a STA interface
11592  * 1 - Create an AP interface
11593  * NOTE: This Bit 0 is applicable for the WL_INTERFACE_CREATE_VER < 2
11594  */
11595 #define WL_INTERFACE_CREATE_STA	(0 << 0)
11596 #define WL_INTERFACE_CREATE_AP	(1 << 0)
11597 
11598 /*
11599  * From revision >= 2 Bit 0 of flags field will not used be for STA or AP interface creation.
11600  * "iftype" field shall be used for identifying the interface type.
11601  */
11602 typedef enum wl_interface_type {
11603 	WL_INTERFACE_TYPE_STA = 0,
11604 	WL_INTERFACE_TYPE_AP = 1,
11605 	WL_INTERFACE_TYPE_AWDL = 2,
11606 	WL_INTERFACE_TYPE_NAN = 3,
11607 	WL_INTERFACE_TYPE_MAX
11608 } wl_interface_type_t;
11609 
11610 /*
11611  * Bit 1 of flags field is used to inform whether MAC is present in the
11612  * data structure or not.
11613  * 0 - Ignore mac_addr field
11614  * 1 - Use the mac_addr field
11615  */
11616 #define WL_INTERFACE_MAC_DONT_USE	(0 << 1)
11617 #define WL_INTERFACE_MAC_USE		(1 << 1)
11618 
11619 /*
11620  * Bit 2 of flags field is used to inform whether core or wlc index
11621  * is present in the data structure or not.
11622  * 0 - Ignore wlc_index field
11623  * 1 - Use the wlc_index field
11624  */
11625 #define WL_INTERFACE_WLC_INDEX_DONT_USE	(0 << 2)
11626 #define WL_INTERFACE_WLC_INDEX_USE	(1 << 2)
11627 
11628 /*
11629  * Bit 3 of flags field is used to create interface on the host requested interface index
11630  * 0 - Ignore if_index field
11631  * 1 - Use the if_index field
11632  */
11633 #define WL_INTERFACE_IF_INDEX_USE       (1 << 3)
11634 
11635 /*
11636  * Bit 4 of flags field is used to assign BSSID
11637  * 0 - Ignore bssid field
11638  * 1 - Use the bssid field
11639  */
11640 #define WL_INTERFACE_BSSID_INDEX_USE	(1 << 4)
11641 
11642 #ifdef WLMESH
11643 typedef struct wl_interface_info {
11644     uint16  ver;            /* version of this struct */
11645     struct ether_addr    mac_addr;  /* MAC address of the interface */
11646     char    ifname[BCM_MSG_IFNAME_MAX]; /* name of interface */
11647     uint8   bsscfgidx;      /* source bsscfg index */
11648 } wl_interface_info_t;
11649 #endif
11650 
11651 typedef struct wl_interface_create {
11652 	uint16	ver;			/* version of this struct */
11653 	uint32  flags;			/* flags that defines the operation */
11654 	struct	ether_addr   mac_addr;	/* Optional Mac address */
11655 } wl_interface_create_t;
11656 
11657 typedef struct wl_interface_create_v1 {
11658 	uint16  ver;                    /**< version of this struct */
11659 	uint8   pad1[2];                /**< Padding bytes */
11660 	uint32  flags;                  /**< flags that defines the operation */
11661 	struct  ether_addr   mac_addr;  /**< Optional Mac address */
11662 	uint8   pad2[2];                /**< Padding bytes */
11663 	uint32  wlc_index;              /**< Optional wlc index */
11664 } wl_interface_create_v1_t;
11665 
11666 typedef struct wl_interface_create_v2 {
11667 	uint16  ver;                    /**< version of this struct */
11668 	uint8   pad1[2];                /**< Padding bytes */
11669 	uint32  flags;                  /**< flags that defines the operation */
11670 	struct  ether_addr   mac_addr;  /**< Optional Mac address */
11671 	uint8   iftype;                 /**< Type of interface created */
11672 	uint8   pad2;                   /**< Padding bytes */
11673 	uint32  wlc_index;              /**< Optional wlc index */
11674 } wl_interface_create_v2_t;
11675 
11676 typedef struct wl_interface_create_v3 {
11677 	uint16	ver;			/**< version of this struct */
11678 	uint16	len;			/**< length of whole structure including variable length */
11679 	uint16	fixed_len;		/**< Fixed length of this structure excluding data[] */
11680 	uint8	iftype;			/**< Type of interface created */
11681 	uint8	wlc_index;		/**< Optional wlc index */
11682 	uint32  flags;			/**< flags that defines the operation */
11683 	struct	ether_addr   mac_addr;	/**< Optional Mac address */
11684 	struct	ether_addr   bssid;	/**< Optional BSSID */
11685 	uint8	if_index;		/**< interface index requested by Host */
11686 	uint8	pad[3];			/**< Padding bytes to ensure data[] is at 32 bit aligned */
11687 	uint8	data[];			/**< Optional application/Module specific data */
11688 } wl_interface_create_v3_t;
11689 
11690 #define WL_INTERFACE_INFO_VER_1		1
11691 #define WL_INTERFACE_INFO_VER_2		2
11692 
11693 typedef struct wl_interface_info_v1 {
11694 	uint16  ver;                    /**< version of this struct */
11695 	struct ether_addr    mac_addr;  /**< MAC address of the interface */
11696 	char    ifname[BCM_MSG_IFNAME_MAX]; /**< name of interface */
11697 	uint8   bsscfgidx;              /**< source bsscfg index */
11698 	uint8	PAD;
11699 } wl_interface_info_v1_t;
11700 
11701 typedef struct wl_interface_info_v2 {
11702 	uint16                  ver;                    /**< version of this struct */
11703 	uint16                  length;                 /**< length of the whole structure */
11704 	struct  ether_addr      mac_addr;               /**< MAC address of the interface */
11705 	uint8                   bsscfgidx;              /**< source bsscfg index */
11706 	uint8                   if_index;               /**< Interface index allocated by FW */
11707 	char                    ifname[BCM_MSG_IFNAME_MAX]; /**< name of interface */
11708 } wl_interface_info_v2_t;
11709 
11710 #define PHY_RXIQEST_AVERAGING_DELAY 10
11711 
11712 typedef struct wl_iqest_params {
11713 	uint32 rxiq;
11714 	uint8 niter;
11715 	uint8 delay;
11716 	uint8 PAD[2];
11717 } wl_iqest_params_t;
11718 
11719 typedef struct wl_iqest_sweep_params {
11720 	wl_iqest_params_t params;
11721 	uint8 nchannels;
11722 	uint8 channel[3];	/** variable */
11723 } wl_iqest_sweep_params_t;
11724 
11725 typedef struct wl_iqest_value {
11726 	uint8 channel;
11727 	uint8 PAD[3];
11728 	uint32 rxiq;
11729 } wl_iqest_value_t;
11730 
11731 typedef struct wl_iqest_result {
11732 	uint8 nvalues;
11733 	uint8 PAD[3];
11734 	wl_iqest_value_t value[1];
11735 } wl_iqest_result_t;
11736 
11737 /* BTCX AIBSS (Oxygen) Status */
11738 typedef struct wlc_btc_aibss_info {
11739 	uint32	prev_tsf_l;		// Lower 32 bits of last read of TSF
11740 	uint32	prev_tsf_h;		// Higher 32 bits of last read of TSF
11741 	uint32	last_btinfo;		// Last read of BT info
11742 	uint32	local_btinfo;		// Local BT INFO BitMap
11743 	uint8	bt_out_of_sync_cnt;	// BT not in sync with strobe
11744 	uint8	esco_off_cnt;		// Count incremented when ESCO is off
11745 	uint8	strobe_enabled;		// Set only in AIBSS mode
11746 	uint8	strobe_on;		// strobe to BT is on for Oxygen
11747 	uint8	local_bt_in_sync;	// Sync status of local BT when strobe is on
11748 	uint8	other_bt_in_sync;	// Sync state of BT in other devices in AIBSS
11749 	uint8	local_bt_is_master;	// Local BT is master
11750 	uint8	sco_prot_on;		// eSCO Protection on in local device
11751 	uint8	other_esco_present;	// eSCO status in other devices in AIBSS
11752 	uint8	rx_agg_change;		// Indicates Rx Agg size needs to change
11753 	uint8	rx_agg_modified;	// Rx Agg size modified
11754 	uint8	acl_grant_set;		// ACL grants on for speeding up sync
11755 	uint8	write_ie_err_cnt;	// BTCX Ie write error cnt
11756 	uint8	parse_ie_err_cnt;	// BTCX IE parse error cnt
11757 	uint8	wci2_fail_cnt;		// WCI2 init failure cnt
11758 	uint8	strobe_enable_err_cnt;	// Strobe enable err cnt
11759 	uint8	strobe_init_err_cnt;	// Strobe init err cnt
11760 	uint8	tsf_jump_cnt;		// TSF jump cnt
11761 	uint8	acl_grant_cnt;		// ALC grant cnt
11762 	uint8	pad1;
11763 	uint16	ibss_tsf_shm;		// SHM address of strobe TSF
11764 	uint16	pad2;
11765 } wlc_btc_aibss_info_t;
11766 
11767 #define WLC_BTC_AIBSS_STATUS_VER	1
11768 #define WLC_BTC_AIBSS_STATUS_LEN	(sizeof(wlc_btc_aibss_status_t) - 2 * (sizeof(uint16)))
11769 
11770 typedef struct wlc_btc_aibss_status {
11771 	uint16	version;		// Version #
11772 	uint16	len;			// Length of the structure(excluding len & version)
11773 	int32	mode;			// Current value of btc_mode
11774 	uint16	bth_period;             // bt coex period. read from shm.
11775 	uint16	agg_off_bm;		// AGG OFF BM read from SHM
11776 	uint8	bth_active;             // bt active session
11777 	uint8	pad[3];
11778 	wlc_btc_aibss_info_t aibss_info;	// Structure definition above
11779 } wlc_btc_aibss_status_t;
11780 
11781 typedef enum {
11782 	STATE_NONE = 0,
11783 
11784 	/* WLAN -> BT */
11785 	W2B_DATA_SET = 21,
11786 	B2W_ACK_SET = 22,
11787 	W2B_DATA_CLEAR = 23,
11788 	B2W_ACK_CLEAR = 24,
11789 
11790 	/* BT -> WLAN */
11791 	B2W_DATA_SET = 31,
11792 	W2B_ACK_SET = 32,
11793 	B2W_DATA_CLEAR = 33,
11794 	W2B_ACK_CLEAR = 34
11795 } bwte_gci_intstate_t;
11796 
11797 #define WL_BWTE_STATS_VERSION 1 /* version of bwte_stats_t */
11798 typedef struct {
11799 	uint32 version;
11800 
11801 	bwte_gci_intstate_t inttobt;
11802 	bwte_gci_intstate_t intfrombt;
11803 
11804 	uint32 bt2wl_intrcnt; /* bt->wlan interrrupt count */
11805 	uint32 wl2bt_intrcnt; /* wlan->bt interrupt count  */
11806 
11807 	uint32 wl2bt_dset_cnt;
11808 	uint32 wl2bt_dclear_cnt;
11809 	uint32 wl2bt_aset_cnt;
11810 	uint32 wl2bt_aclear_cnt;
11811 
11812 	uint32 bt2wl_dset_cnt;
11813 	uint32 bt2wl_dclear_cnt;
11814 	uint32 bt2wl_aset_cnt;
11815 	uint32 bt2wl_aclear_cnt;
11816 
11817 	uint32 state_error_1;
11818 	uint32 state_error_2;
11819 	uint32 state_error_3;
11820 	uint32 state_error_4;
11821 } bwte_stats_t;
11822 
11823 #define TBOW_MAX_SSID_LEN        32
11824 #define TBOW_MAX_PASSPHRASE_LEN  63
11825 
11826 #define WL_TBOW_SETUPINFO_T_VERSION 1 /* version of tbow_setup_netinfo_t */
11827 typedef struct tbow_setup_netinfo {
11828 	uint32 version;
11829 	uint8 opmode;
11830 	uint8 pad;
11831 	uint8 macaddr[ETHER_ADDR_LEN];
11832 	uint32 ssid_len;
11833 	uint8 ssid[TBOW_MAX_SSID_LEN];
11834 	uint8 passphrase_len;
11835 	uint8 passphrase[TBOW_MAX_PASSPHRASE_LEN];
11836 	chanspec_t chanspec;
11837 	uint8 PAD[2];
11838 	uint32 channel;
11839 } tbow_setup_netinfo_t;
11840 
11841 typedef enum tbow_ho_opmode {
11842 	TBOW_HO_MODE_START_GO = 0,
11843 	TBOW_HO_MODE_START_STA,
11844 	TBOW_HO_MODE_START_GC,
11845 	TBOW_HO_MODE_TEST_GO,
11846 	TBOW_HO_MODE_STOP_GO = 0x10,
11847 	TBOW_HO_MODE_STOP_STA,
11848 	TBOW_HO_MODE_STOP_GC,
11849 	TBOW_HO_MODE_TEARDOWN
11850 } tbow_ho_opmode_t;
11851 
11852 /* Beacon trim feature statistics */
11853 /* configuration */
11854 #define BCNTRIMST_PER			0	/* Number of beacons to trim (0: disable) */
11855 #define BCNTRIMST_TIMEND		1	/* Number of bytes till TIM IE */
11856 #define BCNTRIMST_TSFLMT		2	/* TSF tolerance value (usecs) */
11857 /* internal use */
11858 #define BCNTRIMST_CUR			3	/* PSM's local beacon trim counter */
11859 #define BCNTRIMST_PREVLEN		4	/* Beacon length excluding the TIM IE */
11860 #define BCNTRIMST_TIMLEN		5	/* TIM IE Length */
11861 #define BCNTRIMST_RSSI			6	/* Partial beacon RSSI */
11862 #define BCNTRIMST_CHAN			7	/* Partial beacon channel */
11863 /* debug stat (off by default) */
11864 #define BCNTRIMST_DUR			8	/* RX duration until beacon trimmed */
11865 #define BCNTRIMST_RXMBSS		9	/* MYBSSID beacon received */
11866 #define BCNTRIMST_CANTRIM		10	/* # beacons which were trimmed */
11867 #define BCNTRIMST_LENCHG		11	/* # beacons not trimmed due to length change */
11868 #define BCNTRIMST_TSFDRF		12	/* # beacons not trimmed due to large TSF delta */
11869 #define BCNTRIMST_NOTIM			13	/* # beacons not trimmed due to TIM missing */
11870 
11871 #define BCNTRIMST_NUM			14
11872 
11873 #define WL_BCNTRIM_STATUS_VERSION_1 1
11874 typedef struct wl_bcntrim_status_query_v1 {
11875 	uint16  version;
11876 	uint16  len;     /* Total length includes fixed fields */
11877 	uint8   reset;   /* reset after reading the stats */
11878 	uint8   pad[3];  /* 4-byte alignment */
11879 } wl_bcntrim_status_query_v1_t;
11880 
11881 typedef struct wl_bcntrim_status_v1 {
11882 	uint16  version;
11883 	uint16  len;            /* Total length includes fixed fields and variable data[] */
11884 	uint8   curr_slice_id;  /* slice index of the interface */
11885 	uint8   applied_cfg;    /* applied bcntrim N threshold */
11886 	uint8   pad[2];         /* 4-byte alignment */
11887 	uint32  fw_status;      /* Bits representing bcntrim disable reason in FW */
11888 	uint32  total_disable_dur;    /* total duration (msec) bcntrim remains
11889 	                                 disabled due to FW disable reasons
11890 	                               */
11891 	uint32  data[];         /* variable length data containing stats */
11892 } wl_bcntrim_status_v1_t;
11893 
11894 #define BCNTRIM_STATS_MAX            10      /* Total stats part of the status data[] */
11895 
11896 /* Bits for FW status */
11897 #define WL_BCNTRIM_DISABLE_HOST      0x1  /* Host disabled bcntrim through bcntrim IOVar */
11898 #define WL_BCNTRIM_DISABLE_PHY_RATE  0x2  /* bcntrim disabled because beacon rx rate is
11899 	                                     higher than phy_rate_thresh
11900 	                                   */
11901 #define WL_BCNTRIM_DISABLE_QUIET_IE  0x4  /* bcntrim disable when Quiet IE present */
11902 
11903 #define WL_BCNTRIM_CFG_VERSION_1     1
11904 /* Common IOVAR struct */
11905 typedef struct wl_bcntrim_cfg_v1 {
11906 	uint16  version;
11907 	uint16 len;          /* Total length includes fixed fields and variable data[] */
11908 	uint16 subcmd_id;    /* subcommand id */
11909 	uint16 pad;          /* pad/reserved */
11910 	uint8 data[];        /* subcommand data; could be empty */
11911 } wl_bcntrim_cfg_v1_t;
11912 
11913 /* subcommands ids */
11914 enum {
11915 	WL_BCNTRIM_CFG_SUBCMD_PHY_RATE_THRESH =       0,   /* PHY rate threshold above
11916 	                                                      which bcntrim is not applied
11917 	                                                    */
11918 	WL_BCNTRIM_CFG_SUBCMD_OVERRIDE_DISABLE_MASK = 1,   /* Override bcntrim disable reasons */
11919 	WL_BCNTRIM_CFG_SUBCMD_TSF_DRIFT_LIMIT =       2    /* TSF drift limit to consider bcntrim */
11920 };
11921 
11922 #define BCNTRIM_MAX_PHY_RATE	48     /* in 500Kbps */
11923 #define BCNTRIM_MAX_TSF_DRIFT   65535  /* in usec */
11924 #define WL_BCNTRIM_OVERRIDE_DISABLE_MASK  (WL_BCNTRIM_DISABLE_QUIET_IE)
11925 
11926 /* WL_BCNTRIM_CFG_SUBCMD_PHY_RATE_TRESH */
11927 typedef struct wl_bcntrim_cfg_phy_rate_thresh {
11928 	uint32 rate;      /* beacon rate (in 500kbps units)  */
11929 } wl_bcntrim_cfg_phy_rate_thresh_t;
11930 
11931 /* WL_BCNTRIM_CFG_SUBCMD_OVERRIDE_DISABLE_MASK */
11932 typedef struct wl_bcntrim_cfg_override_disable_mask {
11933 	uint32  mask;     /* bits representing individual disable reason to override */
11934 } wl_bcntrim_cfg_override_disable_mask_t;
11935 
11936 /* WL_BCNTRIM_CFG_SUBCMD_TSF_DRIFT_LIMIT */
11937 typedef struct wl_bcntrim_cfg_tsf_drift_limit {
11938 	uint16   drift;   /* tsf drift limit specified in usec */
11939 	uint8    pad[2];  /* 4-byte alignment */
11940 } wl_bcntrim_cfg_tsf_drift_limit_t;
11941 
11942 
11943 /* --------------  TX Power Cap --------------- */
11944 #define TXPWRCAP_MAX_NUM_CORES 8
11945 #define TXPWRCAP_MAX_NUM_ANTENNAS (TXPWRCAP_MAX_NUM_CORES * 2)
11946 
11947 #define TXPWRCAP_NUM_SUBBANDS 5
11948 
11949 /* IOVAR txcapconfig enum's */
11950 #define TXPWRCAPCONFIG_WCI2 0
11951 #define TXPWRCAPCONFIG_HOST 1
11952 #define TXPWRCAPCONFIG_WCI2_AND_HOST 2
11953 
11954 /* IOVAR txcapstate enum's */
11955 #define TXPWRCAPSTATE_LOW_CAP  0
11956 #define TXPWRCAPSTATE_HIGH_CAP 1
11957 #define TXPWRCAPSTATE_HOST_LOW_WCI2_LOW_CAP	0
11958 #define TXPWRCAPSTATE_HOST_LOW_WCI2_HIGH_CAP	1
11959 #define TXPWRCAPSTATE_HOST_HIGH_WCI2_LOW_CAP	2
11960 #define TXPWRCAPSTATE_HOST_HIGH_WCI2_HIGH_CAP	3
11961 
11962 /* IOVAR txcapconfig and txcapstate structure is shared: SET and GET */
11963 #define TXPWRCAPCTL_VERSION 2
11964 typedef struct wl_txpwrcap_ctl {
11965 	uint8   version;
11966 	uint8   ctl[TXPWRCAP_NUM_SUBBANDS];
11967 } wl_txpwrcap_ctl_t;
11968 
11969 /* IOVAR txcapdump structure: GET only */
11970 #define TXPWRCAP_DUMP_VERSION 2
11971 typedef struct wl_txpwrcap_dump {
11972 	uint8   version;
11973 	uint8	pad0;
11974 	uint8   current_country[2];
11975 	uint32	current_channel;
11976 	uint8   config[TXPWRCAP_NUM_SUBBANDS];
11977 	uint8   state[TXPWRCAP_NUM_SUBBANDS];
11978 	uint8	high_cap_state_enabled;
11979 	uint8	wci2_cell_status_last;
11980 	uint8   download_present;
11981 	uint8	num_subbands;
11982 	uint8	num_antennas;
11983 	uint8   num_antennas_per_core[TXPWRCAP_MAX_NUM_CORES];
11984 	uint8	num_cc_groups;
11985 	uint8   current_country_cc_group_info_index;
11986 	int8    low_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
11987 	int8    high_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
11988 	uint8	PAD[3];
11989 } wl_txpwrcap_dump_t;
11990 
11991 typedef struct wl_txpwrcap_dump_v3 {
11992 	uint8   version;
11993 	uint8	pad0;
11994 	uint8   current_country[2];
11995 	uint32	current_channel;
11996 	uint8   config[TXPWRCAP_NUM_SUBBANDS];
11997 	uint8   state[TXPWRCAP_NUM_SUBBANDS];
11998 	uint8	high_cap_state_enabled;
11999 	uint8	wci2_cell_status_last;
12000 	uint8   download_present;
12001 	uint8	num_subbands;
12002 	uint8	num_antennas;
12003 	uint8   num_antennas_per_core[TXPWRCAP_MAX_NUM_CORES];
12004 	uint8	num_cc_groups;
12005 	uint8   current_country_cc_group_info_index;
12006 	uint8	cap_states_per_cc_group;
12007 	int8    host_low_wci2_low_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
12008 	int8    host_low_wci2_high_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
12009 	int8    host_high_wci2_low_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
12010 	int8    host_high_wci2_high_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
12011 	uint8	PAD[2];
12012 } wl_txpwrcap_dump_v3_t;
12013 
12014 typedef struct wl_txpwrcap_tbl {
12015 	uint8 num_antennas_per_core[TXPWRCAP_MAX_NUM_CORES];
12016 	/* Stores values for valid antennas */
12017 	int8 pwrcap_cell_on[TXPWRCAP_MAX_NUM_ANTENNAS]; /* qdBm units */
12018 	int8 pwrcap_cell_off[TXPWRCAP_MAX_NUM_ANTENNAS]; /* qdBm units */
12019 } wl_txpwrcap_tbl_t;
12020 
12021 /* ##### Ecounters section ##### */
12022 #define ECOUNTERS_VERSION_1	1
12023 
12024 /* Input structure for ecounters IOVAR */
12025 typedef struct ecounters_config_request {
12026 	uint16 version;		/* config version */
12027 	uint16 set;		/* Set where data will go. */
12028 	uint16 size;		/* Size of the set. */
12029 	uint16 timeout;		/* timeout in seconds. */
12030 	uint16 num_events;	/* Number of events to report. */
12031 	uint16 ntypes;		/* Number of entries in type array. */
12032 	uint16 type[1];		/* Statistics Types (tags) to retrieve. */
12033 } ecounters_config_request_t;
12034 
12035 #define ECOUNTERS_EVENTMSGS_VERSION_1		1
12036 #define ECOUNTERS_TRIGGER_CONFIG_VERSION_1	1
12037 
12038 #define ECOUNTERS_EVENTMSGS_EXT_MASK_OFFSET	\
12039 		OFFSETOF(ecounters_eventmsgs_ext_t, mask[0])
12040 
12041 #define ECOUNTERS_TRIG_CONFIG_TYPE_OFFSET	\
12042 		OFFSETOF(ecounters_trigger_config_t, type[0])
12043 
12044 typedef struct ecounters_eventmsgs_ext {
12045 	uint8 version;
12046 	uint8 len;
12047 	uint8 mask[1];
12048 } ecounters_eventmsgs_ext_t;
12049 
12050 typedef struct ecounters_trigger_config {
12051 	uint16 version;		/* version */
12052 	uint16 set;		/* set where data should go */
12053 	uint16 rsvd;		/* reserved */
12054 	uint16 pad;		/* pad/reserved */
12055 	uint16 ntypes;		/* number of types/tags */
12056 	uint16 type[1];		/* list of types */
12057 } ecounters_trigger_config_t;
12058 
12059 #define ECOUNTERS_TRIGGER_REASON_VERSION_1	1
12060 /* Triggered due to timer based ecounters */
12061 #define ECOUNTERS_TRIGGER_REASON_TIMER		0
12062 /* Triggered due to event based configuration */
12063 #define ECOUNTERS_TRIGGER_REASON_EVENTS		1
12064 #define ECOUNTERS_TRIGGER_REASON_MAX		1
12065 
12066 typedef struct ecounters_trigger_reason {
12067 	uint16 version;			/* version */
12068 	uint16 trigger_reason;		/* trigger reason */
12069 	uint32 sub_reason_code;		/* sub reason code */
12070 	uint32 trigger_time_now;	/* time in ms  at trigger */
12071 	uint32 host_ref_time;		/* host ref time */
12072 } ecounters_trigger_reason_t;
12073 
12074 #define WL_LQM_VERSION_1 1
12075 
12076 /* For wl_lqm_t flags field */
12077 #define WL_LQM_CURRENT_BSS_VALID 0x1
12078 #define WL_LQM_TARGET_BSS_VALID 0x2
12079 
12080 typedef struct {
12081 	struct ether_addr BSSID;
12082 	chanspec_t chanspec;
12083 	int32 rssi;
12084 	int32 snr;
12085 } wl_rx_signal_metric_t;
12086 
12087 typedef struct {
12088 	uint8 version;
12089 	uint8 flags;
12090 	uint16 pad;
12091 	int32 noise_level; /* current noise level */
12092 	wl_rx_signal_metric_t current_bss;
12093 	wl_rx_signal_metric_t target_bss;
12094 } wl_lqm_t;
12095 
12096 /* ##### Ecounters v2 section ##### */
12097 
12098 #define ECOUNTERS_VERSION_2	2
12099 
12100 /* Enumeration of various ecounters request types. This namespace is different from
12101  * global reportable stats namespace.
12102 */
12103 enum {
12104 	WL_ECOUNTERS_XTLV_REPORT_REQ = 1
12105 };
12106 
12107 /* Input structure for ecounters IOVAR */
12108 typedef struct ecounters_config_request_v2 {
12109 	uint16 version;		/* config version */
12110 	uint16 len;		/* Length of this struct including variable len */
12111 	uint16 logset;		/* Set where data will go. */
12112 	uint16 reporting_period;	/* reporting_period */
12113 	uint16 num_reports;	/* Number of timer expirations to report on */
12114 	uint8 pad[2];		/* Reserved for future use */
12115 	uint8 ecounters_xtlvs[];	/* Statistics Types (tags) to retrieve. */
12116 } ecounters_config_request_v2_t;
12117 
12118 #define ECOUNTERS_STATS_TYPES_FLAG_SLICE	0x1
12119 #define ECOUNTERS_STATS_TYPES_FLAG_IFACE	0x2
12120 #define ECOUNTERS_STATS_TYPES_FLAG_GLOBAL	0x4
12121 
12122 /* Slice mask bits */
12123 #define ECOUNTERS_STATS_TYPES_SLICE_MASK_SLICE0	0x1
12124 #define ECOUNTERS_STATS_TYPES_SLICE_MASK_SLICE1	0x2
12125 
12126 typedef struct ecounters_stats_types_report_req {
12127 	/* flags: bit0 = slice, bit1 = iface, bit2 = global,
12128 	 * rest reserved
12129 	 */
12130 	uint16 flags;
12131 	uint16 if_index;	/* host interface index */
12132 	uint16 slice_mask;	/* bit0 = slice0, bit1=slice1, rest reserved */
12133 	uint8 pad[2];	/* padding */
12134 	uint8 stats_types_req[]; /* XTLVs of requested types */
12135 } ecounters_stats_types_report_req_t;
12136 
12137 /* -------------- dynamic BTCOEX --------------- */
12138 #define DCTL_TROWS	2			/**< currently practical number of rows  */
12139 #define DCTL_TROWS_MAX	4			/**<  2 extra rows RFU */
12140 /* DYNCTL profile flags */
12141 #define DCTL_FLAGS_DISABLED	0		/**< default value: all features disabled */
12142 #define DCTL_FLAGS_DYNCTL	(1 << 0)	/**<  1 - enabled, 0 - legacy only */
12143 #define DCTL_FLAGS_DESENSE	(1 << 1)	/**< auto desense is enabled */
12144 #define DCTL_FLAGS_MSWITCH	(1 << 2)	/**< mode switching is enabled */
12145 #define DCTL_FLAGS_PWRCTRL	(1 << 3)	/**< Tx power control is enabled */
12146 /* for now AGG on/off is handled separately  */
12147 #define DCTL_FLAGS_TX_AGG_OFF	(1 << 4)	/**< TBD: allow TX agg Off */
12148 #define DCTL_FLAGS_RX_AGG_OFF	(1 << 5)	/**< TBD: allow RX agg Off */
12149 /* used for dry run testing only */
12150 #define DCTL_FLAGS_DRYRUN	(1 << 7)	/**< Enables dynctl dry run mode  */
12151 #define IS_DYNCTL_ON(prof)	((prof->flags & DCTL_FLAGS_DYNCTL) != 0)
12152 #define IS_DESENSE_ON(prof)	((prof->flags & DCTL_FLAGS_DESENSE) != 0)
12153 #define IS_MSWITCH_ON(prof)	((prof->flags & DCTL_FLAGS_MSWITCH) != 0)
12154 #define IS_PWRCTRL_ON(prof)	((prof->flags & DCTL_FLAGS_PWRCTRL) != 0)
12155 /* desense level currently in use */
12156 #define DESENSE_OFF	0
12157 #define DFLT_DESENSE_MID	12
12158 #define DFLT_DESENSE_HIGH	2
12159 
12160 /**
12161  * dynctl data points(a set of btpwr & wlrssi thresholds)
12162  * for mode & desense switching
12163  */
12164 typedef struct btc_thr_data {
12165 	int8	mode;	/**< used by desense sw */
12166 	int8	bt_pwr;	/**< BT tx power threshold */
12167 	int8	bt_rssi;	/**< BT rssi threshold */
12168 	/* wl rssi range when mode or desense change may be needed */
12169 	int8	wl_rssi_high;
12170 	int8	wl_rssi_low;
12171 } btc_thr_data_t;
12172 
12173 /* dynctl. profile data structure  */
12174 #define DCTL_PROFILE_VER 0x01
12175 #include <packed_section_start.h>
12176 typedef BWL_PRE_PACKED_STRUCT struct  dctl_prof {
12177 	uint8 version;  /**< dynctl profile version */
12178 	/* dynctl profile flags bit:0 - dynctl On, bit:1 dsns On, bit:2 mode sw On, */
12179 	uint8 flags;  /**< bit[6:3] reserved, bit7 - Dryrun (sim) - On */
12180 	/**  wl desense levels to apply */
12181 	uint8	dflt_dsns_level;
12182 	uint8	low_dsns_level;
12183 	uint8	mid_dsns_level;
12184 	uint8	high_dsns_level;
12185 	/** mode switching hysteresis in dBm */
12186 	int8	msw_btrssi_hyster;
12187 	/** default btcoex mode */
12188 	uint8	default_btc_mode;
12189 	/** num of active rows in mode switching table */
12190 	uint8	msw_rows;
12191 	/** num of rows in desense table */
12192 	uint8	dsns_rows;
12193 	/** dynctl mode switching data table  */
12194 	btc_thr_data_t msw_data[DCTL_TROWS_MAX];
12195 	/** dynctl desense switching data table */
12196 	btc_thr_data_t dsns_data[DCTL_TROWS_MAX];
12197 } BWL_POST_PACKED_STRUCT dctl_prof_t;
12198 #include <packed_section_end.h>
12199 
12200 /**  dynctl status info */
12201 #include <packed_section_start.h>
12202 typedef BWL_PRE_PACKED_STRUCT struct  dynctl_status {
12203 	uint8 sim_on;	/**< true if simulation is On */
12204 	uint16	bt_pwr_shm; /**< BT per/task power as read from ucode  */
12205 	int8	bt_pwr;		/**< BT pwr extracted & converted to dBm */
12206 	int8	bt_rssi;	/**< BT rssi in dBm */
12207 	int8	wl_rssi;	/**< last wl rssi reading used by btcoex */
12208 	uint8	dsns_level; /**< current desense level */
12209 	uint8	btc_mode;   /**< current btcoex mode */
12210 	/* add more status items if needed,  pad to 4 BB if needed */
12211 } BWL_POST_PACKED_STRUCT dynctl_status_t;
12212 #include <packed_section_end.h>
12213 
12214 /**  dynctl simulation (dryrun data) */
12215 #include <packed_section_start.h>
12216 typedef BWL_PRE_PACKED_STRUCT struct  dynctl_sim {
12217 	uint8 sim_on;	/**< simulation mode on/off */
12218 	int8 btpwr;		/**< simulated BT power in dBm */
12219 	int8 btrssi;	/**< simulated BT rssi in dBm */
12220 	int8 wlrssi;	/**< simulated WL rssi in dBm */
12221 } BWL_POST_PACKED_STRUCT dynctl_sim_t;
12222 /* no default structure packing */
12223 #include <packed_section_end.h>
12224 
12225 /** PTK key maintained per SCB */
12226 #define RSN_TEMP_ENCR_KEY_LEN 16
12227 typedef struct wpa_ptk {
12228 	uint8 kck[RSN_KCK_LENGTH]; /**< EAPOL-Key Key Confirmation Key (KCK) */
12229 	uint8 kek[RSN_KEK_LENGTH]; /**< EAPOL-Key Key Encryption Key (KEK) */
12230 	uint8 tk1[RSN_TEMP_ENCR_KEY_LEN]; /**< Temporal Key 1 (TK1) */
12231 	uint8 tk2[RSN_TEMP_ENCR_KEY_LEN]; /**< Temporal Key 2 (TK2) */
12232 } wpa_ptk_t;
12233 
12234 /** GTK key maintained per SCB */
12235 typedef struct wpa_gtk {
12236 	uint32 idx;
12237 	uint32 key_len;
12238 	uint8  key[DOT11_MAX_KEY_SIZE];
12239 } wpa_gtk_t;
12240 
12241 /** FBT Auth Response Data structure */
12242 typedef struct wlc_fbt_auth_resp {
12243 	uint8 macaddr[ETHER_ADDR_LEN]; /**< station mac address */
12244 	uint8 pad[2];
12245 	uint8 pmk_r1_name[WPA2_PMKID_LEN];
12246 	wpa_ptk_t ptk; /**< pairwise key */
12247 	wpa_gtk_t gtk; /**< group key */
12248 	uint32 ie_len;
12249 	uint8 status;  /**< Status of parsing FBT authentication
12250 					Request in application
12251 					*/
12252 	uint8 ies[1]; /**< IEs contains MDIE, RSNIE,
12253 					FBTIE (ANonce, SNonce,R0KH-ID, R1KH-ID)
12254 					*/
12255 } wlc_fbt_auth_resp_t;
12256 
12257 /** FBT Action Response frame */
12258 typedef struct wlc_fbt_action_resp {
12259 	uint16 version; /**< structure version */
12260 	uint16 length; /**< length of structure */
12261 	uint8 macaddr[ETHER_ADDR_LEN]; /**< station mac address */
12262 	uint8 data_len;  /**< len of ie from Category */
12263 	uint8 data[1]; /**< data contains category, action, sta address, target ap,
12264 						status code,fbt response frame body
12265 						*/
12266 } wlc_fbt_action_resp_t;
12267 
12268 #define MACDBG_PMAC_ADDR_INPUT_MAXNUM 16
12269 #define MACDBG_PMAC_OBJ_TYPE_LEN 8
12270 
12271 typedef struct _wl_macdbg_pmac_param_t {
12272 	char type[MACDBG_PMAC_OBJ_TYPE_LEN];
12273 	uint8 step;
12274 	uint8 w_en;
12275 	uint16 num;
12276 	uint32 bitmap;
12277 	uint8 addr_raw;
12278 	uint8 addr_num;
12279 	uint16 addr[MACDBG_PMAC_ADDR_INPUT_MAXNUM];
12280 	uint8 pad0[2];
12281 	uint32 w_val;
12282 } wl_macdbg_pmac_param_t;
12283 
12284 /** IOVAR 'svmp_sampcol' parameter. Used to set and read SVMP_SAMPLE_COLLECT's setting */
12285 typedef struct wl_svmp_sampcol_param {
12286 	uint32 version;           /* version */
12287 	uint8  enable;
12288 	uint8  trigger_mode;      /* SVMP_SAMPCOL_TRIGGER */
12289 	uint8  trigger_mode_s[2]; /* SVMP_SAMPCOL_PKTPROC */
12290 	uint8  data_samplerate;   /* SVMP_SAMPCOL_SAMPLERATE */
12291 	uint8  data_sel_phy1;     /* SVMP_SAMPCOL_PHY1MUX */
12292 	uint8  data_sel_rx1;      /* SVMP_SAMPCOL_RX1MUX without iqCompOut */
12293 	uint8  data_sel_dualcap;  /* SVMP_SAMPCOL_RX1MUX */
12294 	uint8  pack_mode;         /* SVMP_SAMPCOL_PACK */
12295 	uint8  pack_order;
12296 	uint8  pack_cfix_fmt;
12297 	uint8  pack_1core_sel;
12298 	uint16 waitcnt;
12299 	uint16 caplen;
12300 	uint32 buff_addr_start;   /* in word-size (2-bytes) */
12301 	uint32 buff_addr_end;     /* note: Tcl in byte-size, HW in vector-size (8-bytes) */
12302 	uint8  int2vasip;
12303 	uint8  PAD;
12304 	uint16 status;
12305 } wl_svmp_sampcol_t;
12306 
12307 #define WL_SVMP_SAMPCOL_PARAMS_VERSION	1
12308 
12309 enum {
12310 	SVMP_SAMPCOL_TRIGGER_PKTPROC_TRANSITION = 0,
12311 	SVMP_SAMPCOL_TRIGGER_FORCE_IMMEDIATE,
12312 	SVMP_SAMPCOL_TRIGGER_RADAR_DET
12313 };
12314 
12315 enum {
12316 	SVMP_SAMPCOL_PHY1MUX_GPIOOUT = 0,
12317 	SVMP_SAMPCOL_PHY1MUX_FFT,
12318 	SVMP_SAMPCOL_PHY1MUX_DBGHX,
12319 	SVMP_SAMPCOL_PHY1MUX_RX1MUX
12320 };
12321 
12322 enum {
12323 	SVMP_SAMPCOL_RX1MUX_FARROWOUT = 4,
12324 	SVMP_SAMPCOL_RX1MUX_IQCOMPOUT,
12325 	SVMP_SAMPCOL_RX1MUX_DCFILTEROUT,
12326 	SVMP_SAMPCOL_RX1MUX_RXFILTEROUT,
12327 	SVMP_SAMPCOL_RX1MUX_ACIFILTEROUT
12328 };
12329 
12330 enum {
12331 	SVMP_SAMPCOL_SAMPLERATE_1XBW = 0,
12332 	SVMP_SAMPCOL_SAMPLERATE_2XBW
12333 };
12334 
12335 enum {
12336 	SVMP_SAMPCOL_PACK_DUALCAP = 0,
12337 	SVMP_SAMPCOL_PACK_4CORE,
12338 	SVMP_SAMPCOL_PACK_2CORE,
12339 	SVMP_SAMPCOL_PACK_1CORE
12340 };
12341 
12342 enum {
12343 	SVMP_SAMPCOL_PKTPROC_RESET = 0,
12344 	SVMP_SAMPCOL_PKTPROC_CARRIER_SEARCH,
12345 	SVMP_SAMPCOL_PKTPROC_WAIT_FOR_NB_PWR,
12346 	SVMP_SAMPCOL_PKTPROC_WAIT_FOR_W1_PWR,
12347 	SVMP_SAMPCOL_PKTPROC_WAIT_FOR_W2_PWR,
12348 	SVMP_SAMPCOL_PKTPROC_OFDM_PHY,
12349 	SVMP_SAMPCOL_PKTPROC_TIMING_SEARCH,
12350 	SVMP_SAMPCOL_PKTPROC_CHAN_EST_1,
12351 	SVMP_SAMPCOL_PKTPROC_LEG_SIG_DEC,
12352 	SVMP_SAMPCOL_PKTPROC_SIG_DECODE_1,
12353 	SVMP_SAMPCOL_PKTPROC_SIG_DECODE_2,
12354 	SVMP_SAMPCOL_PKTPROC_HT_AGC,
12355 	SVMP_SAMPCOL_PKTPROC_CHAN_EST_2,
12356 	SVMP_SAMPCOL_PKTPROC_PAY_DECODE,
12357 	SVMP_SAMPCOL_PKTPROC_DSSS_CCK_PHY,
12358 	SVMP_SAMPCOL_PKTPROC_WAIT_ENERGY_DROP,
12359 	SVMP_SAMPCOL_PKTPROC_WAIT_NCLKS,
12360 	SVMP_SAMPCOL_PKTPROC_PAY_DEC_EXT,
12361 	SVMP_SAMPCOL_PKTPROC_SIG_FAIL_DELAY,
12362 	SVMP_SAMPCOL_PKTPROC_RIFS_SEARCH,
12363 	SVMP_SAMPCOL_PKTPROC_BOARD_SWITCH_DIV_SEARCH,
12364 	SVMP_SAMPCOL_PKTPROC_DSSS_CCK_BOARD_SWITCH_DIV_SEARCH,
12365 	SVMP_SAMPCOL_PKTPROC_CHAN_EST_3,
12366 	SVMP_SAMPCOL_PKTPROC_CHAN_EST_4,
12367 	SVMP_SAMPCOL_PKTPROC_FINE_TIMING_SEARCH,
12368 	SVMP_SAMPCOL_PKTPROC_SET_CLIP_GAIN,
12369 	SVMP_SAMPCOL_PKTPROC_NAP,
12370 	SVMP_SAMPCOL_PKTPROC_VHT_SIGA_DEC,
12371 	SVMP_SAMPCOL_PKTPROC_VHT_SIGB_DEC,
12372 	SVMP_SAMPCOL_PKTPROC_PKT_ABORT,
12373 	SVMP_SAMPCOL_PKTPROC_DCCAL
12374 };
12375 
12376 /** IOVAR 'svmp_mem' parameter. Used to read/clear svmp memory */
12377 typedef struct svmp_mem {
12378 	uint32 addr;	/**< offset to read svmp memory from vasip base address */
12379 	uint16 len;	/**< length in count of uint16's */
12380 	uint16 val;	/**< set the range of addr/len with a value */
12381 } svmp_mem_t;
12382 
12383 /** IOVAR 'mu_rate' parameter. read/set mu rate for upto four users */
12384 #define MU_RATE_CFG_VERSION	1
12385 typedef struct mu_rate {
12386 	uint16	version;	/**< version of the structure as defined by MU_RATE_CFG_VERSION */
12387 	uint16	length;		/**< length of entire structure */
12388 	uint8	auto_rate;	/**< enable/disable auto rate */
12389 	uint8	PAD;
12390 	uint16	rate_user[4];	/**< rate per each of four users, set to -1 for no change */
12391 } mu_rate_t;
12392 
12393 /** IOVAR 'mu_group' parameter. Used to set and read MU group recommendation setting */
12394 #define WL_MU_GROUP_AUTO_COMMAND      -1
12395 #define WL_MU_GROUP_PARAMS_VERSION     3
12396 #define WL_MU_GROUP_METHOD_NAMELEN    64
12397 #define WL_MU_GROUP_NGROUP_MAX        15
12398 #define WL_MU_GROUP_NUSER_MAX          4
12399 #define WL_MU_GROUP_METHOD_MIN         0
12400 #define WL_MU_GROUP_NUMBER_AUTO_MIN    1
12401 #define WL_MU_GROUP_NUMBER_AUTO_MAX   15
12402 #define WL_MU_GROUP_NUMBER_FORCED_MAX  8
12403 #define WL_MU_GROUP_METHOD_OLD         0
12404 #define WL_MU_GROUP_MODE_AUTO          0
12405 #define WL_MU_GROUP_MODE_FORCED        1
12406 #define WL_MU_GROUP_FORCED_1GROUP      1
12407 #define WL_MU_GROUP_ENTRY_EMPTY       -1
12408 typedef struct mu_group {
12409 	uint32 version;          /* version */
12410 	int16  forced;           /* forced group recommendation */
12411 	int16  forced_group_mcs; /* forced group with mcs */
12412 	int16  forced_group_num; /* forced group number */
12413 	int16  group_option[WL_MU_GROUP_NGROUP_MAX][WL_MU_GROUP_NUSER_MAX];
12414 	                         /* set mode for forced grouping and read mode for auto grouping */
12415 	int16  group_GID[WL_MU_GROUP_NGROUP_MAX];
12416 	int16  group_method;     /* methof for VASIP group recommendation */
12417 	int16  group_number;     /* requested number for VASIP group recommendation */
12418 	int16  auto_group_num;   /* exact number from VASIP group recommendation */
12419 	int8   group_method_name[WL_MU_GROUP_METHOD_NAMELEN];
12420 	uint8  PAD[2];
12421 } mu_group_t;
12422 
12423 typedef struct mupkteng_sta {
12424     struct ether_addr ea;
12425 	uint8  PAD[2];
12426     int32 nrxchain;
12427     int32 idx;
12428 } mupkteng_sta_t;
12429 
12430 typedef struct mupkteng_client {
12431     int32 rspec;
12432     int32 idx;
12433     int32 flen;
12434     int32 nframes;
12435 } mupkteng_client_t;
12436 
12437 typedef struct mupkteng_tx {
12438     mupkteng_client_t client[8];
12439     int32 nclients;
12440     int32 ntx;
12441 } mupkteng_tx_t;
12442 
12443 /*
12444  * MU Packet engine interface.
12445  * The following two definitions will go into
12446  * wlioctl_defs.h
12447  * when wl utility changes are merged to EAGLE TOB & Trunk
12448  */
12449 
12450 #define WL_MUPKTENG_PER_TX_START		0x10
12451 #define WL_MUPKTENG_PER_TX_STOP		        0x20
12452 
12453 /** IOVAR 'mu_policy' parameter. Used to configure MU admission control policies */
12454 #define WL_MU_POLICY_PARAMS_VERSION     1
12455 #define WL_MU_POLICY_SCHED_DEFAULT	60
12456 #define WL_MU_POLICY_DISABLED		0
12457 #define WL_MU_POLICY_ENABLED		1
12458 #define WL_MU_POLICY_NRX_MIN		1
12459 #define WL_MU_POLICY_NRX_MAX		2
12460 typedef struct mu_policy {
12461 	uint16 version;
12462 	uint16 length;
12463 	uint32 sched_timer;
12464 	uint32 pfmon;
12465 	uint32 pfmon_gpos;
12466 	uint32 samebw;
12467 	uint32 nrx;
12468 	uint32 max_muclients;
12469 } mu_policy_t;
12470 
12471 #define WL_NAN_BAND_STR_SIZE 5       /* sizeof ("auto") */
12472 
12473 /** Definitions of different NAN Bands */
12474 /* do not change the order */
12475 enum {
12476 		NAN_BAND_B = 0,
12477 		NAN_BAND_A,
12478 		NAN_BAND_AUTO,
12479 		NAN_BAND_INVALID = 0xFF
12480 };
12481 
12482 /* ifdef WL11ULB */
12483 /* ULB Mode configured via "ulb_mode" IOVAR */
12484 enum {
12485     ULB_MODE_DISABLED = 0,
12486     ULB_MODE_STD_ALONE_MODE = 1,    /* Standalone ULB Mode */
12487     ULB_MODE_DYN_MODE = 2,      /* Dynamic ULB Mode */
12488 	/* Add all other enums before this */
12489     MAX_SUPP_ULB_MODES
12490 };
12491 
12492 /* ULB BWs configured via "ulb_bw" IOVAR during Standalone Mode Only.
12493  * Values of this enumeration are also used to specify 'Current Operational Bandwidth'
12494  * and 'Primary Operational Bandwidth' sub-fields in 'ULB Operations' field (used in
12495  * 'ULB Operations' Attribute or 'ULB Mode Switch' Attribute)
12496  */
12497 typedef enum {
12498     ULB_BW_DISABLED = 0,
12499     ULB_BW_10MHZ    = 1,    /* Standalone ULB BW in 10 MHz BW */
12500     ULB_BW_5MHZ = 2,    /* Standalone ULB BW in 5 MHz BW */
12501     ULB_BW_2P5MHZ   = 3,    /* Standalone ULB BW in 2.5 MHz BW */
12502 	/* Add all other enums before this */
12503     MAX_SUPP_ULB_BW
12504 } ulb_bw_type_t;
12505 /* endif WL11ULB */
12506 
12507 
12508 #define WL_MESH_IOCTL_VERSION     1
12509 #define MESH_IOC_BUFSZ            512 /* sufficient ioc buff size for mesh */
12510 /* container for mesh iovtls & events */
12511 typedef struct wl_mesh_ioc {
12512 	uint16  version;        /* interface command or event version */
12513 	uint16  id;             /* mesh ioctl cmd  ID  */
12514 	uint16  len;            /* total length of all tlv records in data[]  */
12515 	uint16  pad;            /* pad to be 32 bit aligment */
12516 	uint8   data[];       /* var len payload of bcm_xtlv_t type */
12517 } wl_mesh_ioc_t;
12518 
12519 enum wl_mesh_cmds {
12520 	WL_MESH_CMD_ENABLE = 1,
12521 	WL_MESH_CMD_JOIN = 2,
12522 	WL_MESH_CMD_PEER_STATUS = 3,
12523 	WL_MESH_CMD_ADD_ROUTE = 4,
12524 	WL_MESH_CMD_DEL_ROUTE = 5,
12525 	WL_MESH_CMD_ADD_FILTER = 6,
12526 	WL_MESH_CMD_ENAB_AL_METRIC = 7
12527 };
12528 
12529 enum wl_mesh_cmd_xtlv_id {
12530 	WL_MESH_XTLV_ENABLE = 1,
12531 	WL_MESH_XTLV_JOIN = 2,
12532 	WL_MESH_XTLV_STATUS = 3,
12533 	WL_MESH_XTLV_ADD_ROUTE = 4,
12534 	WL_MESH_XTLV_DEL_ROUTE = 5,
12535 	WL_MESH_XTLV_ADD_FILTER = 6,
12536 	WL_MESH_XTLV_ENAB_AIRLINK = 7
12537 };
12538 /* endif WLMESH */
12539 
12540 #ifdef WLMESH
12541 #ifndef SAE_MAX_PASSWD_LEN
12542 #define SAE_MAX_PASSWD_LEN	32
12543 #endif
12544 #endif
12545 
12546 /* Fast BSS Transition parameter configuration */
12547 #define FBT_PARAM_CURRENT_VERSION 0
12548 
12549 typedef struct _wl_fbt_params {
12550 	uint16	version;		/* version of the structure
12551 					* as defined by FBT_PARAM_CURRENT_VERSION
12552 					*/
12553 	uint16	length;			/* length of the entire structure */
12554 
12555 	uint16 param_type;		/* type of parameter defined below */
12556 	uint16 param_len;		/* length of the param_value */
12557 	uint8 param_value[1];		/* variable length */
12558 } wl_fbt_params_t;
12559 
12560 #define WL_FBT_PARAM_TYPE_RSNIE			0
12561 #define WL_FBT_PARAM_TYPE_FTIE			0x1
12562 #define WL_FBT_PARAM_TYPE_SNONCE		0x2
12563 #define WL_FBT_PARAM_TYPE_MDE			0x3
12564 #define WL_FBT_PARAM_TYPE_PMK_R0_NAME		0x4
12565 #define WL_FBT_PARAM_TYPE_R0_KHID		0x5
12566 #define WL_FBT_PARAM_TYPE_R1_KHID		0x6
12567 #define WL_FBT_PARAM_TYPE_FIRST_INVALID		0x7
12568 
12569 /* Assoc Mgr commands for fine control of assoc */
12570 #define WL_ASSOC_MGR_CURRENT_VERSION  0x0
12571 
12572 typedef struct {
12573 	uint16	version;		/* version of the structure as
12574 					 * defined by WL_ASSOC_MGR_CURRENT_VERSION
12575 					 */
12576 	uint16	length;			/* length of the entire structure */
12577 
12578 	uint16 cmd;
12579 	uint16 params;
12580 } wl_assoc_mgr_cmd_t;
12581 
12582 #define WL_ASSOC_MGR_CMD_PAUSE_ON_EVT		0 /* have assoc pause on certain events */
12583 #define WL_ASSOC_MGR_CMD_ABORT_ASSOC		1
12584 
12585 #define WL_ASSOC_MGR_PARAMS_EVENT_NONE			0 /* use this to resume as well as clear */
12586 #define WL_ASSOC_MGR_PARAMS_PAUSE_EVENT_AUTH_RESP	1
12587 
12588 #define WL_WINVER_STRUCT_VER_1 (1)
12589 
12590 typedef struct wl_winver {
12591 
12592 	/* Version and length of this structure. Length includes all fields in wl_winver_t */
12593 	uint16 struct_version;
12594 	uint16 struct_length;
12595 
12596 	/* Windows operating system version info (Microsoft provided) */
12597 	struct {
12598 		uint32 major_ver;
12599 		uint32 minor_ver;
12600 		uint32 build;
12601 	} os_runtime;
12602 
12603 	/* NDIS runtime version (Microsoft provided) */
12604 	struct {
12605 		uint16 major_ver;
12606 		uint16 minor_ver;
12607 	} ndis_runtime;
12608 
12609 	/* NDIS Driver version (Broadcom provided) */
12610 	struct {
12611 		uint16 major_ver;
12612 		uint16 minor_ver;
12613 	} ndis_driver;
12614 
12615 	/* WDI Upper Edge (UE) Driver version (Microsoft provided) */
12616 	struct {
12617 		uint8 major_ver;
12618 		uint8 minor_ver;
12619 		uint8 suffix;
12620 	} wdi_ue;
12621 
12622 	/* WDI Lower Edge (LE) Driver version (Broadcom provided) */
12623 	struct {
12624 		uint8 major_ver;
12625 		uint8 minor_ver;
12626 		uint8 suffix;
12627 	} wdi_le;
12628 	uint8 PAD[2];
12629 } wl_winver_t;
12630 
12631 /* defined(WLRCC) || defined(ROAM_CHANNEL_CACHE) */
12632 #define MAX_ROAM_CHANNEL      20
12633 typedef struct {
12634 	int32 n;
12635 	chanspec_t channels[MAX_ROAM_CHANNEL];
12636 } wl_roam_channel_list_t;
12637 /* endif RCC || ROAM_CHANNEL_CACHE */
12638 
12639 /* values for IOV_MFP arg */
12640 enum {
12641     WL_MFP_NONE = 0,
12642     WL_MFP_CAPABLE,
12643     WL_MFP_REQUIRED
12644 };
12645 
12646 typedef enum {
12647 	CHANSW_UNKNOWN = 0,	/* channel switch due to unknown reason */
12648 	CHANSW_SCAN = 1,	/* channel switch due to scan */
12649 	CHANSW_PHYCAL = 2,	/* channel switch due to phy calibration */
12650 	CHANSW_INIT = 3,	/* channel set at WLC up time */
12651 	CHANSW_ASSOC = 4,	/* channel switch due to association */
12652 	CHANSW_ROAM = 5,	/* channel switch due to roam */
12653 	CHANSW_MCHAN = 6,	/* channel switch triggered by mchan module */
12654 	CHANSW_IOVAR = 7,	/* channel switch due to IOVAR */
12655 	CHANSW_CSA_DFS = 8,	/* channel switch due to chan switch  announcement from AP */
12656 	CHANSW_APCS = 9,	/* Channel switch from AP channel select module */
12657 	CHANSW_AWDL = 10,	/* channel switch due to AWDL */
12658 	CHANSW_FBT = 11,	/* Channel switch from FBT module for action frame response */
12659 	CHANSW_UPDBW = 12,	/* channel switch at update bandwidth */
12660 	CHANSW_ULB = 13,	/* channel switch at ULB */
12661 	CHANSW_LAST = 14	/* last channel switch reason */
12662 } chansw_reason_t;
12663 
12664 /*
12665  * WOWL unassociated mode power svae pattern.
12666  */
12667 typedef struct wowl_radio_duty_cycle {
12668 	uint16 wake_interval;
12669 	uint16  sleep_interval;
12670 } wowl_radio_duty_cycle_t;
12671 
12672 typedef struct nd_ra_ol_limits {
12673 	uint16 version;         /* version of the iovar buffer */
12674 	uint16 type;            /* type of data provided */
12675 	uint16 length;          /* length of the entire structure */
12676 	uint16 pad1;            /* pad union to 4 byte boundary */
12677 	union {
12678 		struct {
12679 			uint16 min_time;         /* seconds, min time for RA offload hold */
12680 			uint16 lifetime_percent;
12681 			/* percent, lifetime percentage for offload hold time */
12682 		} lifetime_relative;
12683 		struct {
12684 			uint16 hold_time;        /* seconds, RA offload hold time */
12685 			uint16 pad2;             /* unused */
12686 		} fixed;
12687 	} limits;
12688 } nd_ra_ol_limits_t;
12689 
12690 #define ND_RA_OL_LIMITS_VER 1
12691 
12692 /* nd_ra_ol_limits sub-types */
12693 #define ND_RA_OL_LIMITS_REL_TYPE   0     /* relative, percent of RA lifetime */
12694 #define ND_RA_OL_LIMITS_FIXED_TYPE 1     /* fixed time */
12695 
12696 /* buffer lengths for the different nd_ra_ol_limits types */
12697 #define ND_RA_OL_LIMITS_REL_TYPE_LEN   12
12698 #define ND_RA_OL_LIMITS_FIXED_TYPE_LEN  10
12699 
12700 /*
12701  * Temperature Throttling control mode
12702  */
12703 typedef struct wl_temp_control {
12704 	uint8 enable;
12705 	uint8 PAD;
12706 	uint16 control_bit;
12707 } wl_temp_control_t;
12708 
12709 /* SensorHub Interworking mode */
12710 
12711 #define SHUB_CONTROL_VERSION    1
12712 #define SHUB_CONTROL_LEN    12
12713 
12714 typedef struct {
12715 	uint16  verison;
12716 	uint16  length;
12717 	uint16  cmd;
12718 	uint16  op_mode;
12719 	uint16  interval;
12720 	uint16  enable;
12721 } shub_control_t;
12722 
12723 /* WLC_MAJOR_VER <= 5 */
12724 /* Data structures for non-TLV format */
12725 
12726 /* Data structures for rsdb caps */
12727 /*
12728  * The flags field of the rsdb_caps_response is designed to be
12729  * a Bit Mask. As of now only Bit 0 is used as mentioned below.
12730  */
12731 
12732 /* Bit-0 in flags is used to indicate if the cores can operate synchronously
12733 * i.e either as 2x2 MIMO or 2(1x1 SISO). This is true only for 4349 variants
12734 * 0 - device can operate only in rsdb mode (eg: 4364)
12735 * 1 - device can operate in both rsdb and mimo (eg : 4359 variants)
12736 */
12737 
12738 #define WL_RSDB_CAPS_VER 2
12739 #define SYNCHRONOUS_OPERATION_TRUE	(1 << 0)
12740 #define WL_RSDB_CAPS_FIXED_LEN  OFFSETOF(rsdb_caps_response_t, num_chains)
12741 
12742 typedef struct rsdb_caps_response {
12743 	uint8 ver;		/* Version */
12744 	uint8 len;		/* length of this structure excluding ver and len */
12745 	uint8 rsdb;		/* TRUE for rsdb chip */
12746 	uint8 num_of_cores;	/* no of d11 cores */
12747 	uint16 flags;		/* Flags to indicate various capabilities */
12748 	uint8 num_chains[1];	/* Tx/Rx chains for each core */
12749 } rsdb_caps_response_t;
12750 
12751 /* Data structures for rsdb bands */
12752 
12753 #define WL_RSDB_BANDS_VER       2
12754 #define WL_RSDB_BANDS_FIXED_LEN  OFFSETOF(rsdb_bands_t, band)
12755 
12756 typedef struct rsdb_bands
12757 {
12758 	uint8 ver;
12759 	uint8 len;
12760 	uint16 num_cores;	/* num of D11 cores */
12761 	int16 band[1];		/* The band operating on each of the d11 cores */
12762 } rsdb_bands_t;
12763 
12764 /* rsdb config */
12765 
12766 #define WL_RSDB_CONFIG_VER 3
12767 #define ALLOW_SIB_PARALLEL_SCAN	(1 << 0)
12768 #define MAX_BANDS 2
12769 
12770 #define WL_RSDB_CONFIG_LEN sizeof(rsdb_config_t)
12771 
12772 
12773 typedef uint8 rsdb_opmode_t;
12774 typedef uint32 rsdb_flags_t;
12775 
12776 typedef enum rsdb_modes {
12777 	WLC_SDB_MODE_NOSDB_MAIN = 1, /* 2X2 or MIMO mode (applicable only for 4355) */
12778 	WLC_SDB_MODE_NOSDB_AUX = 2,
12779 	WLC_SDB_MODE_SDB_MAIN = 3, /* This is RSDB mode(default) applicable only for 4364 */
12780 	WLC_SDB_MODE_SDB_AUX = 4,
12781 	WLC_SDB_MODE_SDB_AUTO = 5, /* Same as WLC_RSDB_MODE_RSDB(1+1) mode above */
12782 } rsdb_modes_t;
12783 
12784 typedef struct rsdb_config {
12785 	uint8 ver;
12786 	uint8 len;
12787 	uint16 reserved;
12788 	rsdb_opmode_t non_infra_mode;
12789 	rsdb_opmode_t infra_mode[MAX_BANDS];
12790 	rsdb_flags_t flags[MAX_BANDS];
12791 	rsdb_opmode_t current_mode;   /* Valid only in GET, returns the current mode */
12792 	uint8  pad[3];
12793 } rsdb_config_t;
12794 
12795 /* WLC_MAJOR_VER > =5 */
12796 /* TLV definitions and data structures for rsdb subcmds */
12797 
12798 enum wl_rsdb_cmd_ids {
12799 	/* RSDB ioctls */
12800 	WL_RSDB_CMD_VER = 0,
12801 	WL_RSDB_CMD_CAPS = 1,
12802 	WL_RSDB_CMD_BANDS = 2,
12803 	WL_RSDB_CMD_CONFIG = 3,
12804 	/* Add before this !! */
12805 	WL_RSDB_CMD_LAST
12806 };
12807 #define WL_RSDB_IOV_VERSION	0x1
12808 
12809 typedef struct rsdb_caps_response_v1 {
12810 	uint8 rsdb;		/* TRUE for rsdb chip */
12811 	uint8 num_of_cores;	/* no of d11 cores */
12812 	uint16 flags;		/* Flags to indicate various capabilities */
12813 	uint8 num_chains[MAX_NUM_D11CORES];	/* Tx/Rx chains for each core */
12814 	uint8 band_cap[MAX_NUM_D11CORES]; /* band cap bitmask per slice */
12815 } rsdb_caps_response_v1_t;
12816 
12817 typedef struct rsdb_bands_v1
12818 {
12819 	uint8 num_cores;		/* num of D11 cores */
12820 	uint8 pad;			/* padding bytes for 4 byte alignment */
12821 	int8 band[MAX_NUM_D11CORES];	/* The band operating on each of the d11 cores */
12822 } rsdb_bands_v1_t;
12823 
12824 typedef struct rsdb_config_xtlv {
12825 	rsdb_opmode_t reserved1;	/* Non_infra mode is no more applicable */
12826 	rsdb_opmode_t infra_mode[MAX_BANDS]; /* Target mode for Infra association */
12827 	uint8 pad;	/* pad bytes for 4 byte alignment */
12828 	rsdb_flags_t  flags[MAX_BANDS];
12829 	rsdb_opmode_t current_mode; /* GET only; has current mode of operation */
12830 	uint8 pad1[3];
12831 } rsdb_config_xtlv_t;
12832 
12833 /* Definitions for slot_bss chanseq iovar */
12834 #define WL_SLOT_BSS_VERSION 1
12835 
12836 enum wl_slotted_bss_cmd_id {
12837 	WL_SLOTTED_BSS_CMD_VER = 0,
12838 	WL_SLOTTED_BSS_CMD_CHANSEQ = 1
12839 };
12840 typedef uint16 chan_seq_type_t;
12841 enum chan_seq_type {
12842 	CHAN_SEQ_TYPE_AWDL = 1,
12843 	CHAN_SEQ_TYPE_SLICE = 2,
12844 	CHAN_SEQ_TYPE_NAN = 3
12845 };
12846 typedef uint8 sched_flag_t;
12847 enum sched_flag {
12848 	NO_SDB_SCHED = 0x1,
12849 	SDB_TDM_SCHED = 0x2,
12850 	SDB_SPLIT_BAND_SCHED = 0x4, /* default mode for 4357 */
12851 	MAIN_ONLY = 0x8,
12852 	AUX_ONLY = 0x10,
12853 	SDB_DUAL_TIME = (MAIN_ONLY | AUX_ONLY),
12854 	NO_SDB_MAIN_ONLY = (NO_SDB_SCHED | MAIN_ONLY), /* default mode for 4364 */
12855 	SDB_TDM_SCHED_MAIN = (SDB_TDM_SCHED | MAIN_ONLY),
12856 	SDB_TDM_SCHED_AUX = (SDB_TDM_SCHED | AUX_ONLY),
12857 	SDB_TDM_SCHED_DUAL_TIME = (SDB_TDM_SCHED | SDB_DUAL_TIME),
12858 	SDB_SPLIT_BAND_SCHED_DUAL_TIME = (SDB_SPLIT_BAND_SCHED | SDB_DUAL_TIME)
12859 };
12860 
12861 typedef struct chan_seq_tlv_data {
12862 	uint32 flags;
12863 	uint8 data[1];
12864 } chan_seq_tlv_data_t;
12865 
12866 typedef struct chan_seq_tlv {
12867 	chan_seq_type_t type;
12868 	uint16 len;
12869 	chan_seq_tlv_data_t chanseq_data[1];
12870 } chan_seq_tlv_t;
12871 
12872 typedef struct sb_channel_sequence {
12873 	sched_flag_t sched_flags; /* (sdb-tdm or sdb-sb or Dual-Time) */
12874 	uint8 num_seq; /* number of chan_seq_tlv following */
12875 	uint16 pad;
12876 	chan_seq_tlv_t seq[1];
12877 } sb_channel_sequence_t;
12878 
12879 typedef struct slice_chan_seq {
12880 	uint8 slice_index;  /* 0(Main) or 1 (Aux) */
12881 	uint8 num_chanspecs;
12882 	uint16 pad;
12883 	chanspec_t chanspecs[1];
12884 } slice_chan_seq_t;
12885 
12886 #define WL_SLICE_CHAN_SEQ_FIXED_LEN   OFFSETOF(slice_chan_seq_t, chanspecs)
12887 
12888 typedef struct sim_pm_params {
12889 	uint32 enabled;
12890 	uint16 cycle;
12891 	uint16 up;
12892 } sim_pm_params_t;
12893 
12894 /* Bits for fw_status */
12895 #define NAP_DISABLED_HOST		0x01   /* Host has disabled through nap_enable */
12896 #define NAP_DISABLED_RSSI		0x02   /* Disabled because of nap_rssi_threshold */
12897 
12898 /* Bits for hw_status */
12899 #define NAP_HWCFG			0x01   /* State of NAP config bit in phy HW */
12900 
12901 /* ifdef WL_NATOE */
12902 #define WL_NATOE_IOCTL_VERSION		1
12903 #define WL_NATOE_IOC_BUFSZ		512	/* sufficient ioc buff size for natoe */
12904 #define WL_NATOE_DBG_STATS_BUFSZ	2048
12905 
12906 /* config natoe STA and AP IP's structure */
12907 typedef struct {
12908 	uint32 sta_ip;
12909 	uint32 sta_netmask;
12910 	uint32 sta_router_ip;
12911 	uint32 sta_dnsip;
12912 	uint32 ap_ip;
12913 	uint32 ap_netmask;
12914 } wl_natoe_config_ips_t;
12915 
12916 /* natoe ports config structure */
12917 typedef struct {
12918 	uint16 start_port_num;
12919 	uint16 no_of_ports;
12920 } wl_natoe_ports_config_t;
12921 
12922 /* natoe ports exception info */
12923 typedef struct {
12924 	uint16 sta_port_num;
12925 	uint16 dst_port_num;    /* for SIP type protocol, dst_port_num info can be ignored by FW */
12926 	uint32 ip;              /* for SIP ip is APcli_ip and for port clash it is dst_ip */
12927 	uint8  entry_type;      /* Create/Destroy */
12928 	uint8  pad[3];
12929 } wl_natoe_exception_port_t;
12930 
12931 /* container for natoe ioctls & events */
12932 typedef struct wl_natoe_ioc {
12933 	uint16  version;        /* interface command or event version */
12934 	uint16  id;             /* natoe ioctl cmd  ID  */
12935 	uint16  len;            /* total length of all tlv records in data[]  */
12936 	uint16  pad;            /* pad to be 32 bit aligment */
12937 	uint8   data[];       /* var len payload of bcm_xtlv_t type */
12938 } wl_natoe_ioc_t;
12939 
12940 enum wl_natoe_cmds {
12941 	WL_NATOE_CMD_ENABLE = 1,
12942 	WL_NATOE_CMD_CONFIG_IPS = 2,
12943 	WL_NATOE_CMD_CONFIG_PORTS = 3,
12944 	WL_NATOE_CMD_DBG_STATS = 4,
12945 	WL_NATOE_CMD_EXCEPTION_PORT = 5,
12946 	WL_NATOE_CMD_SKIP_PORT = 6,
12947 	WL_NATOE_CMD_TBL_CNT = 7
12948 };
12949 
12950 enum wl_natoe_cmd_xtlv_id {
12951 	WL_NATOE_XTLV_ENABLE = 1,
12952 	WL_NATOE_XTLV_CONFIG_IPS = 2,
12953 	WL_NATOE_XTLV_CONFIG_PORTS = 3,
12954 	WL_NATOE_XTLV_DBG_STATS = 4,
12955 	WL_NATOE_XTLV_EXCEPTION_PORT = 5,
12956 	WL_NATOE_XTLV_SKIP_PORT = 6,
12957 	WL_NATOE_XTLV_TBL_CNT = 7
12958 };
12959 
12960 /* endif WL_NATOE */
12961 
12962 enum wl_idauth_cmd_ids {
12963 	WL_IDAUTH_CMD_CONFIG				= 1,
12964 	WL_IDAUTH_CMD_PEER_INFO				= 2,
12965 	WL_IDAUTH_CMD_COUNTERS				= 3,
12966 	WL_IDAUTH_CMD_LAST
12967 };
12968 enum wl_idauth_xtlv_id {
12969 	WL_IDAUTH_XTLV_AUTH_ENAB			= 0x1,
12970 	WL_IDAUTH_XTLV_GTK_ROTATION			= 0x2,
12971 	WL_IDAUTH_XTLV_EAPOL_COUNT			= 0x3,
12972 	WL_IDAUTH_XTLV_EAPOL_INTRVL			= 0x4,
12973 	WL_IDAUTH_XTLV_BLKLIST_COUNT			= 0x5,
12974 	WL_IDAUTH_XTLV_BLKLIST_AGE			= 0x6,
12975 	WL_IDAUTH_XTLV_PEERS_INFO			= 0x7,
12976 	WL_IDAUTH_XTLV_COUNTERS				= 0x8
12977 };
12978 enum wl_idauth_stats {
12979 	WL_AUTH_PEER_STATE_AUTHORISED			= 0x01,
12980 	WL_AUTH_PEER_STATE_BLACKLISTED			= 0x02,
12981 	WL_AUTH_PEER_STATE_4WAY_HS_ONGOING		= 0x03,
12982 	WL_AUTH_PEER_STATE_LAST
12983 };
12984 typedef struct {
12985 	uint16 state;				/* Peer State: Authorised or Blacklisted */
12986 	struct ether_addr peer_addr;		/* peer Address */
12987 	uint32 blklist_end_time;		/* Time of blacklist end */
12988 } auth_peer_t;
12989 typedef struct wl_idauth_counters {
12990 	uint32 auth_reqs;			/* No of auth req recvd */
12991 	uint32 mic_fail;			/* No of mic fails */
12992 	uint32 four_way_hs_fail;		/* No of 4-way handshake fails */
12993 } wl_idauth_counters_t;
12994 
12995 #define WLC_UTRACE_LEN  512
12996 #define WLC_UTRACE_READ_END 0
12997 #define WLC_UTRACE_MORE_DATA 1
12998 typedef struct wl_utrace_capture_args_v1 {
12999 	uint32 length;
13000 	uint32 flag;
13001 } wl_utrace_capture_args_v1_t;
13002 
13003 #define UTRACE_CAPTURE_VER_2	2
13004 typedef struct wl_utrace_capture_args_v2 {
13005 	/* structure control */
13006 	uint16 version;		/**< structure version */
13007 	uint16 length;		/**< length of the response */
13008 	uint32 flag;		/* Indicates if there is more data or not */
13009 } wl_utrace_capture_args_v2_t;
13010 
13011 /* XTLV IDs for the Health Check "hc" iovar top level container */
13012 enum {
13013 	WL_HC_XTLV_ID_CAT_HC = 1,		/* category for HC as a whole */
13014 	WL_HC_XTLV_ID_CAT_DATAPATH_TX = 2,	/* Datapath Tx */
13015 	WL_HC_XTLV_ID_CAT_DATAPATH_RX = 3,	/* Datapath Rx */
13016 	WL_HC_XTLV_ID_CAT_SCAN	= 4,		/* Scan */
13017 };
13018 
13019 /* Health Check: Common XTLV IDs for sub-elements in the top level container
13020  * Number starts at 0x8000 to be out of the way for category specific IDs.
13021  */
13022 enum {
13023 	WL_HC_XTLV_ID_ERR       = 0x8000,       /* for sub-command  err return */
13024 	WL_HC_XTLV_ID_IDLIST    = 0x8001,       /* container for uint16 IDs */
13025 };
13026 
13027 /* Health Check: Datapath TX IDs */
13028 enum {
13029 	WL_HC_TX_XTLV_ID_VAL_STALL_THRESHOLD   = 1,     /* stall_threshold */
13030 	WL_HC_TX_XTLV_ID_VAL_STALL_SAMPLE_SIZE = 2,     /* stall_sample_size */
13031 	WL_HC_TX_XTLV_ID_VAL_STALL_TIMEOUT     = 3,     /* stall_timeout */
13032 	WL_HC_TX_XTLV_ID_VAL_STALL_FORCE       = 4,     /* stall_force */
13033 	WL_HC_TX_XTLV_ID_VAL_STALL_EXCLUDE     = 5,     /* stall_exclude */
13034 	WL_HC_TX_XTLV_ID_VAL_FC_TIMEOUT        = 6,     /* flow ctl timeout */
13035 	WL_HC_TX_XTLV_ID_VAL_FC_FORCE          = 7,     /* flow ctl force failure */
13036 	WL_HC_TX_XTLV_ID_VAL_DELAY_TO_TRAP     = 8,     /* delay threshold for forced trap */
13037 	WL_HC_TX_XTLV_ID_VAL_DELAY_TO_RPT      = 9,     /* delay threshold for event log report */
13038 };
13039 
13040 /* Health Check: Datapath RX IDs */
13041 enum {
13042 	WL_HC_RX_XTLV_ID_VAL_DMA_STALL_TIMEOUT = 1,     /* dma_stall_timeout */
13043 	WL_HC_RX_XTLV_ID_VAL_DMA_STALL_FORCE   = 2,     /* dma_stall test trigger */
13044 	WL_HC_RX_XTLV_ID_VAL_STALL_THRESHOLD   = 3,     /* stall_threshold */
13045 	WL_HC_RX_XTLV_ID_VAL_STALL_SAMPLE_SIZE = 4,     /* stall_sample_size */
13046 	WL_HC_RX_XTLV_ID_VAL_STALL_FORCE       = 5,     /* stall test trigger */
13047 };
13048 
13049 /* Health Check: Datapath SCAN IDs */
13050 enum {
13051 	WL_HC_XTLV_ID_VAL_SCAN_STALL_THRESHOLD	= 1,	/* scan stall threshold */
13052 };
13053 
13054 /* IDs of Health Check report structures for sub types of health checks within WL */
13055 enum {
13056 	WL_HC_DD_UNDEFINED = 0,		/* Undefined */
13057 	WL_HC_DD_RX_DMA_STALL = 1,	/* RX DMA stall check */
13058 	WL_HC_DD_RX_STALL = 2,		/* RX stall check */
13059 	WL_HC_DD_TX_STALL = 3,		/* TX stall check */
13060 	WL_HC_DD_SCAN_STALL = 4,	/* SCAN stall check */
13061 	WL_HC_DD_MAX
13062 };
13063 
13064 /*
13065  * Health Check report structures for sub types of health checks within WL
13066  */
13067 
13068 /* Health Check report structure for Rx DMA Stall check */
13069 typedef struct {
13070 	uint16 type;
13071 	uint16 length;
13072 	uint16 timeout;
13073 	uint16 stalled_dma_bitmap;
13074 } wl_rx_dma_hc_info_t;
13075 
13076 /* Health Check report structure for Tx packet failure check */
13077 typedef struct {
13078 	uint16 type;
13079 	uint16 length;
13080 	uint32 stall_bitmap;
13081 	uint32 stall_bitmap1;
13082 	uint32 failure_ac;
13083 	uint32 threshold;
13084 	uint32 tx_all;
13085 	uint32 tx_failure_all;
13086 } wl_tx_hc_info_t;
13087 
13088 /* Health Check report structure for Rx dropped packet failure check */
13089 typedef struct {
13090 	uint16 type;
13091 	uint16 length;
13092 	uint32 bsscfg_idx;
13093 	uint32 rx_hc_pkts;
13094 	uint32 rx_hc_dropped_all;
13095 	uint32 rx_hc_alert_th;
13096 } wl_rx_hc_info_t;
13097 
13098 /* HE top level command IDs */
13099 enum {
13100 	WL_HE_CMD_ENAB = 0,
13101 	WL_HE_CMD_FEATURES = 1,
13102 	WL_HE_CMD_TWT_SETUP = 2,
13103 	WL_HE_CMD_TWT_TEARDOWN = 3,
13104 	WL_HE_CMD_TWT_INFO = 4,
13105 	WL_HE_CMD_BSSCOLOR = 5,
13106 	WL_HE_CMD_PARTIAL_BSSCOLOR = 6,
13107 	WL_HE_CMD_LAST
13108 };
13109 
13110 #define WL_HEB_VERSION	0
13111 
13112 /* HEB top level command IDs */
13113 enum {
13114 	WL_HEB_CMD_ENAB = 0,
13115 	WL_HEB_CMD_NUM_HEB = 1,
13116 	WL_HEB_CMD_COUNTERS = 1,
13117 	WL_HEB_CMD_CLEAR_COUNTERS = 2,
13118 	WL_HEB_CMD_LAST
13119 };
13120 
13121 /* HEB counters structures */
13122 typedef struct {
13123 	uint16 pre_event;
13124 	uint16 start_event;
13125 	uint16 end_event;
13126 	uint16 missed;
13127 } wl_heb_int_cnt_t;
13128 
13129 typedef struct {
13130 	/* structure control */
13131 	uint16 version;	/* structure version */
13132 	uint16 length;	/* data length (starting after this field) */
13133 	wl_heb_int_cnt_t heb_int_cnt[1];
13134 } wl_heb_cnt_t;
13135 
13136 
13137 /* TWT Setup descriptor */
13138 typedef struct {
13139 	/* Setup Command. */
13140 	uint8 setup_cmd;	/* See TWT_SETUP_CMD_XXXX in 802.11ah.h,
13141 				 * valid when bcast_twt is FALSE.
13142 				 */
13143 	/* Flow attributes */
13144 	uint8 flow_flags;	/* See WL_TWT_FLOW_FLAG_XXXX below */
13145 	uint8 flow_id;		/* must be between 0 and 7 */
13146 	/* Target Wake Time */
13147 	uint8 wake_type;	/* See WL_TWT_TIME_TYPE_XXXX below */
13148 	uint32 wake_time_h;	/* target wake time - BSS TSF (us) */
13149 	uint32 wake_time_l;
13150 	uint32 wake_dur;	/* target wake duration in us units */
13151 	uint32 wake_int;	/* target wake interval */
13152 } wl_twt_sdesc_t;
13153 
13154 /* Flow flags */
13155 #define WL_TWT_FLOW_FLAG_BROADCAST	(1<<0)
13156 #define WL_TWT_FLOW_FLAG_IMPLICIT	(1<<1)
13157 #define WL_TWT_FLOW_FLAG_UNANNOUNCED	(1<<2)
13158 #define WL_TWT_FLOW_FLAG_TRIGGER	(1<<3)
13159 
13160 /* Flow id */
13161 #define WL_TWT_FLOW_ID_FID	0x07	/* flow id */
13162 #define WL_TWT_FLOW_ID_GID_MASK	0x70	/* group id - broadcast TWT only */
13163 #define WL_TWT_FLOW_ID_GID_SHIFT 4
13164 
13165 /* Wake type */
13166 /* TODO: not yet finalized */
13167 #define WL_TWT_TIME_TYPE_BSS	0	/* The time specified in wake_time_h/l is
13168 					 * the BSS TSF time.
13169 					 */
13170 #define WL_TWT_TIME_TYPE_OFFSET	1	/* The time specified in wake_time_h/l is an offset
13171 					 * of the TSF time when the iovar is processed.
13172 					 */
13173 
13174 #define WL_TWT_SETUP_VER	0
13175 
13176 /* HE TWT Setup command */
13177 typedef struct {
13178 	/* structure control */
13179 	uint16 version;	/* structure version */
13180 	uint16 length;	/* data length (starting after this field) */
13181 	/* peer address */
13182 	struct ether_addr peer;	/* leave it all 0s' for AP */
13183 	/* session id */
13184 	uint8 dialog;	/* an arbitrary number to identify the seesion */
13185 	uint8 pad;
13186 	/* setup descriptor */
13187 	wl_twt_sdesc_t desc;
13188 } wl_twt_setup_t;
13189 
13190 #define WL_TWT_TEARDOWN_VER	0
13191 
13192 /* HE TWT Teardown command */
13193 typedef struct {
13194 	/* structure control */
13195 	uint16 version;	/* structure version */
13196 	uint16 length;	/* data length (starting after this field) */
13197 	/* peer address */
13198 	struct ether_addr peer;	/* leave it all 0s' for AP */
13199 	/* flow attributes */
13200 	uint8 flow_flags;	/* See WL_TWT_FLOW_FLAG_XXXX above.
13201 				 * (only BORADCAST) is applicable)
13202 				 */
13203 	uint8 flow_id;		/* must be between 0 and 7 */
13204 } wl_twt_teardown_t;
13205 
13206 /* twt information descriptor */
13207 typedef struct {
13208 	uint8 flow_flags;	/* See WL_TWT_INFO_FLAG_XXX below */
13209 	uint8 flow_id;
13210 	uint8 pad[2];
13211 	uint32 next_twt_h;
13212 	uint32 next_twt_l;
13213 } wl_twt_idesc_t;
13214 
13215 /* Flow flags */
13216 #define WL_TWT_INFO_FLAG_RESP_REQ	(1<<0)	/* Request response */
13217 
13218 #define WL_TWT_INFO_VER	0
13219 
13220 /* HE TWT Information command */
13221 typedef struct {
13222 	/* structure control */
13223 	uint16 version;	/* structure version */
13224 	uint16 length;	/* data length (starting after this field) */
13225 	/* peer address */
13226 	struct ether_addr peer;	/* leave it all 0s' for AP */
13227 	uint8 pad[2];
13228 	/* information descriptor */
13229 	wl_twt_idesc_t desc;
13230 } wl_twt_info_t;
13231 
13232 /* Current version for wlc_clm_power_limits_req_t structure and flags */
13233 #define WLC_CLM_POWER_LIMITS_REQ_VERSION 1
13234 /* "clm_power_limits" iovar request structure */
13235 typedef struct wlc_clm_power_limits_req {
13236 	/* Input. Structure and flags version */
13237 	uint32 version;
13238 	/* Full length of buffer (includes this structure and space for TLV-encoded PPR) */
13239 	uint32 buflen;
13240 	/* Input. Flags (see WLC_CLM_POWER_LIMITS_INPUT_FLAG_... below) */
13241 	uint32 input_flags;
13242 	/* Input. CC of region whose data is being requested */
13243 	char cc[WLC_CNTRY_BUF_SZ];
13244 	/* Input. Channel/subchannel in chanspec_t format */
13245 	uint32 chanspec;
13246 	/* Subchannel encoded as clm_limits_type_t */
13247 	uint32 clm_subchannel;
13248 	/* Input. 0-based antenna index */
13249 	uint32 antenna_idx;
13250 	/* Output. General flags (see WLC_CLM_POWER_LIMITS_OUTPUT_FLAG_... below) */
13251 	uint32 output_flags;
13252 	/* Output. 2.4G country flags, encoded as clm_flags_t enum */
13253 	uint32 clm_country_flags_2g;
13254 	/* Output. 5G country flags, encoded as clm_flags_t enum */
13255 	uint32 clm_country_flags_5g;
13256 	/* Output. Length of TLV-encoded PPR data that follows this structure */
13257 	uint32 ppr_tlv_size;
13258 	/* Output. Beginning of buffer for TLV-encoded PPR data */
13259 	uint8 ppr_tlv[1];
13260 } wlc_clm_power_limits_req_t;
13261 
13262 /* Input. Do not apply SAR limits */
13263 #define WLC_CLM_POWER_LIMITS_INPUT_FLAG_NO_SAR				0x00000001
13264 /* Input. Do not apply board limits */
13265 #define WLC_CLM_POWER_LIMITS_INPUT_FLAG_NO_BOARD			0x00000002
13266 /* Output. Limits taken from product-specific country data */
13267 #define WLC_CLM_POWER_LIMITS_OUTPUT_FLAG_PRODUCT_LIMITS			0x00000001
13268 /* Output. Limits taken from product-specific worldwide data */
13269 #define WLC_CLM_POWER_LIMITS_OUTPUT_FLAG_WORLDWIDE_LIMITS		0x00000002
13270 /* Output. Limits taken from country-default (all-product) data */
13271 #define WLC_CLM_POWER_LIMITS_OUTPUT_FLAG_DEFAULT_COUNTRY_LIMITS		0x00000004
13272 
13273 /*
13274  * WOG (Wake On Googlecast)
13275  */
13276 
13277 #define MAX_GCAST_APPID_CNT_LIMIT 50
13278 #define MAX_DNS_LABEL 63
13279 
13280 typedef struct wog_appid {
13281 	uint8 appID[MAX_DNS_LABEL+1];
13282 } wog_appid_t;
13283 
13284 enum {
13285 	WOG_APPID_ADD,
13286 	WOG_APPID_DEL,
13287 	WOG_APPID_CLEAR,
13288 	WOG_APPID_LIST,
13289 	WOG_MAX_APPID_CNT
13290 };
13291 
13292 #define WOG_APPID_IOV_VER 1
13293 typedef struct wog_appid_iov {
13294 	/* version for iovar */
13295 	uint32 ver;
13296 	/* add/del/clear/list operation */
13297 	uint32 operation;
13298 	/* for adding or deleting multiple items */
13299 	/* for WOG_MAX_APPID_CNT, this value is used for max count for AppID */
13300 	uint32 cnt;
13301 	/* Application IDs */
13302 	/* If FW found an AppID from this list, FW will respond to discovery */
13303 	/* without wake up the host */
13304 	wog_appid_t appids[1];
13305 } wog_appid_iov_t;
13306 
13307 /* dns service record */
13308 /* service name : _googlecast */
13309 typedef struct wog_srv_record {
13310 	uint32 ttl;
13311 	uint16 port; /* tcp 8008 or 8009 */
13312 	uint8 PAD[2];
13313 } wog_srv_record_t;
13314 
13315 #define GCAST_MAX_MODEL_NAME_LEN 16
13316 #define GCAST_MAX_FNAME_LEN 64
13317 #define GCAST_MAX_RS_LEN 60
13318 
13319 #define GCAST_UUID_LEN 32
13320 #define GCAST_PUBLICKEY_ID_LEN 64
13321 #define GCAST_VER_LEN 2
13322 typedef struct wog_txt_record {
13323 	uint32 ttl;
13324 	/* id : UUID for the receiver */
13325 	char id[GCAST_UUID_LEN+1];
13326 
13327 	/* Cast protocol version supported. Begins at 2 */
13328 	/* and is incremented by 1 with each version */
13329 	char ver[GCAST_VER_LEN+1];
13330 
13331 	/* 256bit receiver Subject Public Key Identifier from the SSL cert */
13332 	char public_key[GCAST_PUBLICKEY_ID_LEN+1];
13333 
13334 	/* A bitfield of device capabilities. */
13335 	/* bit 0 : video_out (1:has video out, 0:no video) */
13336 	/* bit 1 : video_in */
13337 	/* bit 2 : audio_out */
13338 	/* bit 3 : audio_in */
13339 	/* bit 4 : dev_mode */
13340 	/*	 (1:dev mode enabled, 0: not enabled) */
13341 	char capability;
13342 
13343 	/* Receiver status flag 0:IDLE, 1(BUSY/JOIN) */
13344 	/* IDLE : The receiver is idle */
13345 	/*	   and doesn't need to be connected now. */
13346 	/* BUSY/JOIN : The receiver is hosting an activity */
13347 	/*	 and invites the sender to join */
13348 	char receiver_status_flag;
13349 
13350 	uint8 PAD0[1];
13351 
13352 	char friendly_name[GCAST_MAX_FNAME_LEN+1];
13353 	uint8 PAD1[3];
13354 
13355 	char model_name[GCAST_MAX_MODEL_NAME_LEN+1];
13356 	uint8 PAD2[3];
13357 
13358 	/* Receiver Status text for Cast Protocol v2 */
13359 	/* Spec says that if the status text exceeds 60 characters in length, */
13360 	/* it is truncated at 60 caracters and */
13361 	/* a UTF-8 ellipsis character is appended to indicate trucation. */
13362 	/* But our dongle won't use UTF-8 ellipsis. It's not a big deal. */
13363 	char receiver_status[GCAST_MAX_RS_LEN+1];
13364 	uint8 PAD3[3];
13365 } wog_txt_record_t;
13366 
13367 /* ip will be taken from the ip of wog_info_t */
13368 typedef struct wog_a_record {
13369 	uint32 ttl;
13370 } wog_a_record_t;
13371 
13372 /* Google Cast protocl uses mDNS SD for its discovery */
13373 #define WOG_SD_RESP_VER 1
13374 typedef struct wog_sd_resp {
13375 	/* version for iovar */
13376 	int32 ver;
13377 	/* device name of Google Cast receiver */
13378 	char device_name[MAX_DNS_LABEL+1];
13379 	/* IP address of Google Cast receiver */
13380 	uint8 ip[4];
13381 	/* ttl of PTR response */
13382 	uint32 ptr_ttl;
13383 	/* DNS TXT record */
13384 	wog_txt_record_t txt;
13385 	/* DNS SRV record */
13386 	wog_srv_record_t srv;
13387 	/* DNS A record */
13388 	wog_a_record_t a;
13389 } wog_sd_resp_t;
13390 
13391 enum wl_mbo_cmd_ids {
13392 	WL_MBO_CMD_ADD_CHAN_PREF = 1,
13393 	WL_MBO_CMD_DEL_CHAN_PREF = 2,
13394 	WL_MBO_CMD_LIST_CHAN_PREF = 3,
13395 	WL_MBO_CMD_CELLULAR_DATA_CAP = 4,
13396 	WL_MBO_CMD_DUMP_COUNTERS = 5,
13397 	WL_MBO_CMD_CLEAR_COUNTERS = 6,
13398 	WL_MBO_CMD_FORCE_ASSOC = 7,
13399 	WL_MBO_CMD_BSSTRANS_REJECT = 8,
13400 	WL_MBO_CMD_SEND_NOTIF = 9,
13401 	/* Add before this !! */
13402 	WL_MBO_CMD_LAST
13403 };
13404 
13405 enum wl_mbo_xtlv_id {
13406 	WL_MBO_XTLV_OPCLASS            = 0x1,
13407 	WL_MBO_XTLV_CHAN               = 0x2,
13408 	WL_MBO_XTLV_PREFERENCE         = 0x3,
13409 	WL_MBO_XTLV_REASON_CODE        = 0x4,
13410 	WL_MBO_XTLV_CELL_DATA_CAP      = 0x5,
13411 	WL_MBO_XTLV_COUNTERS           = 0x6,
13412 	WL_MBO_XTLV_ENABLE             = 0x7,
13413 	WL_MBO_XTLV_SUB_ELEM_TYPE      = 0x8
13414 };
13415 
13416 typedef struct wl_mbo_counters {
13417 	/* No of transition req recvd */
13418 	uint16 trans_req_rcvd;
13419 	/* No of transition req with disassoc imminent */
13420 	uint16 trans_req_disassoc;
13421 	/* No of transition req with BSS Termination */
13422 	uint16 trans_req_bss_term;
13423 	/* No of trans req w/ unspecified reason */
13424 	uint16 trans_resn_unspec;
13425 	/* No of trans req w/ reason frame loss */
13426 	uint16 trans_resn_frm_loss;
13427 	/* No of trans req w/ reason traffic delay */
13428 	uint16 trans_resn_traffic_delay;
13429 	/* No of trans req w/ reason insufficient buffer */
13430 	uint16 trans_resn_insuff_bw;
13431 	/* No of trans req w/ reason load balance */
13432 	uint16 trans_resn_load_bal;
13433 	/* No of trans req w/ reason low rssi */
13434 	uint16 trans_resn_low_rssi;
13435 	/* No of trans req w/ reason excessive retransmission */
13436 	uint16 trans_resn_xcess_retransmn;
13437 	/* No of trans req w/ reason gray zone */
13438 	uint16 trans_resn_gray_zone;
13439 	/* No of trans req w/ reason switch to premium AP */
13440 	uint16 trans_resn_prem_ap_sw;
13441 	/* No of transition rejection sent */
13442 	uint16 trans_rejn_sent;
13443 	/* No of trans rejn reason excessive frame loss */
13444 	uint16 trans_rejn_xcess_frm_loss;
13445 	/* No of trans rejn reason excessive traffic delay */
13446 	uint16 trans_rejn_xcess_traffic_delay;
13447 	/* No of trans rejn reason insufficient QoS capability */
13448 	uint16 trans_rejn_insuffic_qos_cap;
13449 	/* No of trans rejn reason low RSSI */
13450 	uint16 trans_rejn_low_rssi;
13451 	/* No of trans rejn reason high interference */
13452 	uint16 trans_rejn_high_interference;
13453 	/* No of trans rejn reason service unavilable */
13454 	uint16 trans_rejn_service_unavail;
13455 	/* No of beacon request rcvd */
13456 	uint16 bcn_req_rcvd;
13457 	/* No of beacon report sent */
13458 	uint16 bcn_rep_sent;
13459 	/* No of null beacon report sent */
13460 	uint16 null_bcn_rep_sent;
13461 	/* No of wifi to cell switch */
13462 	uint16 wifi_to_cell;
13463 } wl_mbo_counters_t;
13464 
13465 /* otpread command */
13466 #define WL_OTPREAD_VER 1
13467 
13468 typedef struct {
13469 	uint16 version;		/* cmd structure version */
13470 	uint16 cmd_len;		/* cmd struct len */
13471 	uint32 rdmode;		/* otp read mode */
13472 	uint32 rdoffset;	/* byte offset into otp to start read */
13473 	uint32 rdsize;		/* number of bytes to read */
13474 } wl_otpread_cmd_t;
13475 
13476 /* "otpecc_rows" command */
13477 typedef struct {
13478 	uint16 version;		/* version of this structure */
13479 	uint16 len;			/* len in bytes of this structure */
13480 	uint32 cmdtype;		/* command type : 0 : read row data, 1 : ECC lock  */
13481 	uint32 rowoffset;	/* start row offset */
13482 	uint32 numrows;		/* number of rows */
13483 	uint8  rowdata[];	/* read rows data */
13484 } wl_otpecc_rows_t;
13485 
13486 #define WL_OTPECC_ROWS_VER  1
13487 
13488 #define WL_OTPECC_ROWS_CMD_READ  0
13489 #define WL_OTPECC_ROWS_CMD_LOCK  1
13490 
13491 #define WL_OTPECC_ARGIDX_CMDTYPE		0	/* command type */
13492 #define WL_OTPECC_ARGIDX_ROWOFFSET		1	/* start row offset */
13493 #define WL_OTPECC_ARGIDX_NUMROWS		2	/* number of rows */
13494 
13495 /* "otpeccrows" raw data size per row */
13496 #define WL_ECCDUMP_ROW_SIZE_BYTE	6 /* 4 bytes row data + 2 bytes ECC status */
13497 #define WL_ECCDUMP_ROW_SIZE_WORD	3
13498 
13499 /* otpECCstatus */
13500 #define OTP_ECC_ENAB_SHIFT		13
13501 #define OTP_ECC_ENAB_MASK		0x7
13502 #define OTP_ECC_CORR_ST_SHIFT	12
13503 #define OTP_ECC_CORR_ST_MASK	0x1
13504 #define OTP_ECC_DBL_ERR_SHIFT	11
13505 #define OTP_ECC_DBL_ERR_MASK	0x1
13506 #define OTP_ECC_DED_ST_SHIFT	10
13507 #define OTP_ECC_DED_ST_MASK		0x1
13508 #define OTP_ECC_SEC_ST_SHIFT	9
13509 #define OTP_ECC_SEC_ST_MASK		0x1
13510 #define OTP_ECC_DATA_SHIFT		0
13511 #define OTP_ECC_DATA_MASK		0x7f
13512 
13513 /* OTP_ECC_CORR_ST field */
13514 #define OTP_ECC_MODE		1
13515 #define OTP_NO_ECC_MODE		0
13516 
13517 /* OTP_ECC_ENAB field (bit15:13) :
13518  * When 2 or 3 bits are set,
13519  * it indicates that OTP ECC is enabled on the last row read.
13520  * Otherwise, ECC is disabled
13521  */
13522 #define OTP_ECC_ENAB(val) \
13523 	(bcm_bitcount((uint8 *)&(val), sizeof(uint8)) > 1)
13524 
13525 #define WL_LEAKY_AP_STATS_GT_TYPE	0
13526 #define WL_LEAKY_AP_STATS_PKT_TYPE	1
13527 typedef struct wlc_leaked_infra_guard_marker {
13528 	/* type field for this TLV: WL_LEAKY_AP_STATS_GT_TYPE */
13529 	uint16  type;
13530 	/* length field for this TLV */
13531 	uint16  len;
13532 	/* guard sample sequence number; Updated by 1 on every guard sample */
13533 	uint32  seq_number;
13534 	/* Guard time start time (tsf; PS indicated and acked) */
13535 	uint32  start_time;
13536 	/* tsf timestamp for the GT end event */
13537 	uint32  gt_tsf_l;
13538 	/* Guard time period in ms */
13539 	uint16  guard_duration;
13540 	/* Number PPDUs in the notification */
13541 	uint16  num_pkts;
13542 	/* Flags to indicate some states see below */
13543 	uint8   flag;
13544 	/* pad for 32-bit alignment */
13545 	uint8   reserved[3];
13546 } wlc_leaked_infra_guard_marker_t;
13547 
13548 /* Flag information */
13549 #define WL_LEAKED_GUARD_TIME_NONE	0               /* Not in any guard time */
13550 #define WL_LEAKED_GUARD_TIME_FRTS	(0x01 << 0)     /* Normal FRTS power save */
13551 #define WL_LEAKED_GUARD_TIME_SCAN	(0x01 << 1)     /* Channel switch due to scanning */
13552 #define WL_LEAKED_GUARD_TIME_AWDL_PSF	(0x01 << 2)     /* Channel switch due to AWDL PSF */
13553 #define WL_LEAKED_GUARD_TIME_AWDL_AW	(0x01 << 3)     /* Channel switch due to AWDL AW */
13554 #define WL_LEAKED_GUARD_TIME_INFRA_STA	(0x01 << 4)	/* generic type infra sta channel switch */
13555 #define WL_LEAKED_GUARD_TIME_TERMINATED (0x01 << 7)     /* indicate a GT is terminated early */
13556 
13557 typedef struct wlc_leaked_infra_packet_stat {
13558 	uint16  type;			/* type field for this TLV: WL_LEAKY_AP_STATS_PKT_TYPE */
13559 	uint16  len;			/* length field for this TLV */
13560 	uint16  ppdu_len_bytes;		/* PPDU packet length in bytes */
13561 	uint16  num_mpdus;		/* number of the MPDUs in the PPDU */
13562 	uint32  ppdu_time;		/* PPDU arrival time at the begining of the guard time */
13563 	uint32  rate;			/* PPDU packet rate; Received packet's data rate */
13564 	uint16  seq_number;		/* sequence number */
13565 	int8    rssi;			/* RSSI */
13566 	uint8   tid;			/* tid */
13567 } wlc_leaked_infra_packet_stat_t;
13568 
13569 /* Wake timer structure definition */
13570 #define WAKE_TIMER_VERSION 1
13571 #define WAKE_TIMER_NOLIMIT 0xFFFF
13572 
13573 typedef struct wake_timer {
13574 	uint16 ver;
13575 	uint16 len;
13576 	uint16 limit;   /* number of events to deliver
13577 			* 0-disable, 0xffff-indefinite, num_events otherwise
13578 			*/
13579 	uint16 count;	/* number of events delivered since enable (get only) */
13580 	uint16 period;	/* timeout/period in milliseconds */
13581 } wake_timer_t;
13582 
13583 typedef struct wl_desense_restage_gain {
13584 	uint16 version;
13585 	uint16 length;
13586 	uint32 band;
13587 	uint8 num_cores;
13588 	uint8 desense_array[WL_TX_CHAINS_MAX];
13589 	uint8 PAD[3];
13590 } wl_desense_restage_gain_t;
13591 
13592 #define MAX_UCM_CHAINS 5
13593 #define MAX_UCM_PROFILES 4
13594 #define UCM_PROFILE_VERSION_1 1
13595 
13596 /* UCM per chain attribute struct */
13597 typedef struct wlc_btcx_chain_attr {
13598 	uint16 length;			/* chain attr length, version is same as profile version */
13599 	int8 desense_level;		/* per chain desense level */
13600 	int8 ack_pwr_strong_rssi;	/* per chain ack power at strong rssi */
13601 	int8 ack_pwr_weak_rssi;		/* per chain ack power at weak rssi */
13602 	int8 tx_pwr_strong_rssi;	/* per chain tx power at strong rssi */
13603 	int8 tx_pwr_weak_rssi;		/* per chain tx power at weak rssi */
13604 	uint8 PAD[1];			/* additional bytes for alignment */
13605 } wlc_btcx_chain_attr_t;
13606 
13607 typedef struct wlc_btcx_profile_v1 {
13608 	uint16 version;			/* UCM profile version */
13609 	uint16 length;			/* profile size */
13610 	uint16 fixed_length;		/* size of the fixed portion of the profile */
13611 	uint8 init;			/* profile initialized or not */
13612 	uint8 chain_attr_count;		/* Number of elements in chain_attr array */
13613 	uint8 profile_index;		/* profile index */
13614 	uint8 mode_strong_wl_bt;	/* Mode under strong WLAN and BT RSSI */
13615 	uint8 mode_weak_wl;		/* Mode under weak WLAN RSSI */
13616 	uint8 mode_weak_bt;		/* Mode under weak BT RSSI */
13617 	uint8 mode_weak_wl_bt;		/* Mode under weak BT and WLAN RSSI */
13618 	int8 mode_wl_hi_lo_rssi_thresh;	/* Strong to weak WLAN RSSI threshold for mode selection */
13619 	int8 mode_wl_lo_hi_rssi_thresh;	/* Weak to strong WLAN RSSI threshold for mode selection */
13620 	int8 mode_bt_hi_lo_rssi_thresh;	/* Strong to weak BT RSSI threshold for mode selection */
13621 	int8 mode_bt_lo_hi_rssi_thresh;	/* Weak to strong BT RSSI threshold for mode selection */
13622 	int8 desense_wl_hi_lo_rssi_thresh;	/* Strong to weak RSSI threshold for desense */
13623 	int8 desense_wl_lo_hi_rssi_thresh;	/* Weak to strong RSSI threshold for desense */
13624 	int8 ack_pwr_wl_hi_lo_rssi_thresh;	/* Strong to weak RSSI threshold for ACK power */
13625 	int8 ack_pwr_wl_lo_hi_rssi_thresh;	/* Weak to strong RSSI threshold for ACK power */
13626 	int8 tx_pwr_wl_hi_lo_rssi_thresh;	/* Strong to weak RSSI threshold for Tx power */
13627 	int8 tx_pwr_wl_lo_hi_rssi_thresh;	/* Weak to strong RSSI threshold for Tx power */
13628 	uint8 PAD[1];				/* additional bytes for 4 byte alignment */
13629 	wlc_btcx_chain_attr_t chain_attr[];	/* variable length array with chain attributes */
13630 } wlc_btcx_profile_v1_t;
13631 
13632 #define SSSR_D11_RESET_SEQ_STEPS   5
13633 #define SSSR_REG_INFO_VER   0
13634 
13635 typedef struct sssr_reg_info {
13636 	uint16 version;
13637 	uint16 length;  /* length of the structure validated at host */
13638 	struct {
13639 		struct {
13640 			uint32 pmuintmask0;
13641 			uint32 pmuintmask1;
13642 			uint32 resreqtimer;
13643 			uint32 macresreqtimer;
13644 			uint32 macresreqtimer1;
13645 		} base_regs;
13646 	} pmu_regs;
13647 	struct {
13648 		struct {
13649 			uint32 intmask;
13650 			uint32 powerctrl;
13651 			uint32 clockcontrolstatus;
13652 			uint32 powerctrl_mask;
13653 		} base_regs;
13654 	} chipcommon_regs;
13655 	struct {
13656 		struct {
13657 			uint32 clockcontrolstatus;
13658 			uint32 clockcontrolstatus_val;
13659 		} base_regs;
13660 		struct {
13661 			uint32 resetctrl;
13662 			uint32 itopoobb;
13663 		} wrapper_regs;
13664 	} arm_regs;
13665 	struct {
13666 		struct {
13667 			uint32 ltrstate;
13668 			uint32 clockcontrolstatus;
13669 			uint32 clockcontrolstatus_val;
13670 		} base_regs;
13671 		struct {
13672 			uint32 itopoobb;
13673 		} wrapper_regs;
13674 	} pcie_regs;
13675 	struct {
13676 		struct {
13677 			uint32 ioctrl;
13678 		} wrapper_regs;
13679 		uint32 vasip_sr_addr;
13680 		uint32 vasip_sr_size;
13681 	} vasip_regs;
13682 	struct {
13683 		struct {
13684 			uint32 xmtaddress;
13685 			uint32 xmtdata;
13686 			uint32 clockcontrolstatus;
13687 			uint32 clockcontrolstatus_val;
13688 		} base_regs;
13689 		struct {
13690 			uint32 resetctrl;
13691 			uint32 itopoobb;
13692 			uint32 ioctrl;
13693 			uint32 ioctrl_resetseq_val[SSSR_D11_RESET_SEQ_STEPS];
13694 		} wrapper_regs;
13695 		uint32 sr_size;
13696 	} mac_regs[MAX_NUM_D11CORES];
13697 } sssr_reg_info_t;
13698 
13699 /* ADaptive Power Save(ADPS) structure definition */
13700 #define WL_ADPS_IOV_MAJOR_VER	1
13701 #define WL_ADPS_IOV_MINOR_VER	0
13702 #define WL_ADPS_IOV_MAJOR_VER_SHIFT	8
13703 #define WL_ADPS_IOV_VER \
13704 	((WL_ADPS_IOV_MAJOR_VER << WL_ADPS_IOV_MAJOR_VER_SHIFT) | WL_ADPS_IOV_MINOR_VER)
13705 
13706 #define ADPS_NUM_DIR	2
13707 #define ADPS_RX		0
13708 #define ADPS_TX		1
13709 
13710 #define WL_ADPS_IOV_MODE	0x0001
13711 #define WL_ADPS_IOV_RSSI	0x0002
13712 #define WL_ADPS_IOV_DUMP	0x0003
13713 #define WL_ADPS_IOV_DUMP_CLEAR	0x0004
13714 
13715 #define ADPS_SUMMARY_STEP_NUM   2
13716 #define ADPS_SUMMARY_STEP_LOW	0
13717 #define ADPS_SUMMARY_STEP_HIGH	1
13718 
13719 #define ADPS_SUB_IOV_VERSION_1	1
13720 #define ADPS_SUB_IOV_VERSION_2	2
13721 
13722 typedef struct wl_adps_params_v1 {
13723 	uint16 version;
13724 	uint16 length;
13725 	uint8 band;		/* band - 2G or 5G */
13726 	uint8 mode;		/* operation mode, default = 0 (ADPS disable) */
13727 	uint16 padding;
13728 } wl_adps_params_v1_t;
13729 
13730 typedef struct wl_adps_rssi {
13731 	int32 thresh_hi;	/* rssi threshold to resume ADPS operation */
13732 	int32 thresh_lo;	/* rssi threshold to suspend ADPS operation */
13733 } wl_adps_rssi_t;
13734 
13735 typedef struct wl_adps_rssi_params_v1 {
13736 	uint16 version;
13737 	uint16 length;
13738 	uint8 band;
13739 	uint8 padding[3];
13740 	wl_adps_rssi_t rssi;
13741 } wl_adps_rssi_params_v1_t;
13742 
13743 typedef struct adps_stat_elem {
13744 	uint32 duration;	/* each step duration time (mSec) */
13745 	uint32 counts;		/* each step hit count number */
13746 } adps_stat_elem_t;
13747 
13748 typedef struct wl_adps_dump_summary_v1 {
13749 	uint16 version;
13750 	uint16 length;
13751 	uint8 mode;					/* operation mode: On/Off */
13752 	uint8 flags;					/* restrict flags */
13753 	uint8 current_step;				/* current step */
13754 	uint8 padding;
13755 	adps_stat_elem_t stat[ADPS_SUMMARY_STEP_NUM];	/* statistics */
13756 } wl_adps_dump_summary_v1_t;
13757 
13758 typedef struct wlc_btc_2gchain_dis {
13759 	uint16 ver;
13760 	uint16 len;
13761 	uint8 chain_dis;
13762 	uint8 flag;
13763 } wlc_btc_2gchain_dis_t;
13764 
13765 #define WLC_BTC_2GCHAIN_DIS_REASSOC	0x1
13766 #define WLC_BTC_2GCHAIN_DIS_VER1	0x1
13767 #define WLC_BTC_2GCHAIN_DIS_VER1_LEN	6
13768 
13769 enum wl_rpsnoa_cmd_ids {
13770 	WL_RPSNOA_CMD_ENABLE = 1,
13771 	WL_RPSNOA_CMD_STATUS,
13772 	WL_RPSNOA_CMD_PARAMS,
13773 	WL_RPSNOA_CMD_LAST
13774 };
13775 
13776 typedef struct rpsnoa_cmnhdr {
13777 	uint16 ver;		/* cmd structure version */
13778 	uint16 len;		/* cmd structure len */
13779 	uint32 subcmd;
13780 	uint32 cnt;
13781 } rpsnoa_cmnhdr_t;
13782 
13783 typedef struct rpsnoa_data {
13784 	int16 band;
13785 	int16 value;
13786 } rpsnoa_data_t;
13787 
13788 typedef struct rpsnoa_param {
13789 	uint16 band;
13790 	uint8 level;
13791 	uint8 stas_assoc_check;
13792 	uint32 pps;
13793 	uint32 quiet_time;
13794 } rpsnoa_param_t;
13795 
13796 typedef struct rpsnoa_iovar {
13797 	rpsnoa_cmnhdr_t hdr;
13798 	rpsnoa_data_t data[1];
13799 } rpsnoa_iovar_t;
13800 
13801 typedef struct rpsnoa_iovar_params {
13802 	rpsnoa_cmnhdr_t hdr;
13803 	rpsnoa_param_t param[1];
13804 } rpsnoa_iovar_params_t;
13805 
13806 /* Per-interface reportable stats types */
13807 enum wl_ifstats_xtlv_id {
13808 	/* global */
13809 	WL_IFSTATS_XTLV_SLICE_INDEX = 1,
13810 	WL_IFSTATS_XTLV_IF_INDEX = 2,
13811 	WL_IFSTATS_XTLV_MAC_ADDR = 3,
13812 	WL_IFSTATS_XTLV_REPORT_CMD = 4,	/* Comes in an iovar */
13813 	WL_IFSTATS_XTLV_BUS_PCIE = 5,
13814 
13815 	/* Report data across all SCBs using ecounters */
13816 	WL_IFSTATS_XTLV_WL_STA_INFO_ECOUNTERS = 0x100,
13817 
13818 	/* Per-slice information
13819 	 * Per-interface reporting could also include slice specific data
13820 	 */
13821 	/* xtlv container for reporting */
13822 	WL_IFSTATS_XTLV_WL_SLICE = 0x301,
13823 	/* Per-slice AMPDU stats */
13824 	WL_IFSTATS_XTLV_WL_SLICE_AMPDU_DUMP = 0x302,
13825 	/* Per-slice BTCOEX stats */
13826 	WL_IFSTATS_XTLV_WL_SLICE_BTCOEX = 0x303,
13827 	/* V11_WLCNTRS used in ecounters */
13828 	WL_IFSTATS_XTLV_WL_SLICE_V11_WLCNTRS = 0x304,
13829 	/* V30_WLCNTRS Used in ecounters */
13830 	WL_IFSTATS_XTLV_WL_SLICE_V30_WLCNTRS = 0x305,
13831 
13832 	/* Per-interface */
13833 	/* XTLV container for reporting */
13834 	WL_IFSTATS_XTLV_IF = 0x501,
13835 	/* Generic stats applicable to all IFs */
13836 	WL_IFSTATS_XTLV_GENERIC = 0x502,
13837 	/* Infra specific */
13838 	WL_IFSTATS_XTLV_INFRA_SPECIFIC = 0x503,
13839 	/* MGT counters infra and softAP */
13840 	WL_IFSTATS_XTLV_MGT_CNT = 0x504,
13841 	/* AMPDU stats on per-IF */
13842 	WL_IFSTATS_XTLV_AMPDU_DUMP = 0x505,
13843 	WL_IFSTATS_XTLV_IF_SPECIFIC = 0x506
13844 };
13845 
13846 /* interface specific mgt count */
13847 #define WL_MGT_STATS_VERSION_V1	1
13848 /* Associated stats type: WL_IFSTATS_MGT_CNT */
13849 typedef struct {
13850 	uint16	version;
13851 	uint8   pad[2];
13852 
13853 	/* detailed control/management frames */
13854 	uint32	txnull;
13855 	uint32	rxnull;
13856 	uint32	txqosnull;
13857 	uint32	rxqosnull;
13858 	uint32	txassocreq;
13859 	uint32	rxassocreq;
13860 	uint32	txreassocreq;
13861 	uint32	rxreassocreq;
13862 	uint32	txdisassoc;
13863 	uint32	rxdisassoc;
13864 	uint32	txassocrsp;
13865 	uint32	rxassocrsp;
13866 	uint32	txreassocrsp;
13867 	uint32	rxreassocrsp;
13868 	uint32	txauth;
13869 	uint32	rxauth;
13870 	uint32	txdeauth;
13871 	uint32	rxdeauth;
13872 	uint32	txprobereq;
13873 	uint32	rxprobereq;
13874 	uint32	txprobersp;
13875 	uint32	rxprobersp;
13876 	uint32	txaction;
13877 	uint32	rxaction;
13878 	uint32	txpspoll;
13879 	uint32	rxpspoll;
13880 } wl_if_mgt_stats_t;
13881 
13882 #define WL_INFRA_STATS_VERSION_V1	1
13883 /* Associated stats type: WL_IFSTATS_INFRA_SPECIFIC */
13884 typedef struct wl_infra_stats {
13885 	uint16 version;             /**< version of the structure */
13886 	uint8  pad[2];
13887 	uint32 rxbeaconmbss;
13888 	uint32 tbtt;
13889 } wl_if_infra_stats_t;
13890 
13891 typedef struct csa_event_data {
13892 	chanspec_t chan_old;
13893 	dot11_ext_csa_ie_t ecsa;
13894 	dot11_mesh_csp_ie_t mcsp;
13895 	dot11_wide_bw_chan_switch_ie_t wbcs;
13896 	uint8 PAD;
13897 } csa_event_data_t;
13898 
13899 typedef struct wl_ext_auth_evt {
13900 	wlc_ssid_t ssid;
13901 	struct ether_addr bssid;
13902 	unsigned int key_mgmt_suite;
13903 	int status;
13904 } wl_ext_auth_evt_t;
13905 
13906 #endif /* _wlioctl_h_ */
13907