xref: /OK3568_Linux_fs/external/rkwifibt/drivers/infineon/include/wlioctl.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Custom OID/ioctl definitions for
3  *
4  *
5  * Broadcom 802.11abg Networking Device Driver
6  *
7  * Definitions subject to change without notice.
8  *
9  * Portions of this code are copyright (c) 2021 Cypress Semiconductor Corporation
10  *
11  * Copyright (C) 1999-2017, Broadcom Corporation
12  *
13  *      Unless you and Broadcom execute a separate written software license
14  * agreement governing use of this software, this software is licensed to you
15  * under the terms of the GNU General Public License version 2 (the "GPL"),
16  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
17  * following added to such license:
18  *
19  *      As a special exception, the copyright holders of this software give you
20  * permission to link this software with independent modules, and to copy and
21  * distribute the resulting executable under terms of your choice, provided that
22  * you also meet, for each linked independent module, the terms and conditions of
23  * the license of that module.  An independent module is a module which is not
24  * derived from this software.  The special exception does not apply to any
25  * modifications of the software.
26  *
27  *      Notwithstanding the above, under no circumstances may you combine this
28  * software in any way with any other Broadcom software provided under a license
29  * other than the GPL, without Broadcom's express prior written consent.
30  *
31  *
32  * <<Broadcom-WL-IPTag/Open:>>
33  *
34  * $Id$
35  */
36 
37 #ifndef _wlioctl_h_
38 #define	_wlioctl_h_
39 
40 #include <typedefs.h>
41 #include <ethernet.h>
42 #include <bcmip.h>
43 #include <bcmeth.h>
44 #include <bcmip.h>
45 #include <bcmipv6.h>
46 #include <bcmevent.h>
47 #include <802.11.h>
48 #include <802.11s.h>
49 #include <802.1d.h>
50 #include <bcmwifi_channels.h>
51 #include <802.11ax.h>
52 #include <bcmwifi_rates.h>
53 #include <wlioctl_defs.h>
54 #include <bcmipv6.h>
55 
56 #include <bcm_mpool_pub.h>
57 #include <bcmcdc.h>
58 
59 /* NOTE re: Module specific error codes.
60  *
61  * BCME_.. error codes are extended by various features - e.g. FTM, NAN, SAE etc.
62  * The current process is to allocate a range of 1024 negative 32 bit integers to
63  * each module that extends the error codes to indicate a module specific status.
64  *
65  * The next range to use is below. If that range is used for a new feature, please
66  * update the range to be used by the next feature.
67  *
68  * The error codes -4096 ... -5119 are reserved for firmware signing.
69  *
70  * Next available (inclusive) range: [-6*1024 + 1, -5*1024]
71  *
72  * End Note
73  */
74 
75 /* 11ax trigger frame format - versioning info */
76 #define TRIG_FRAME_FORMAT_11AX_DRAFT_1P1 0
77 
78 typedef struct {
79 	uint32 num;
80 	chanspec_t list[1];
81 } chanspec_list_t;
82 
83 #define RSN_KCK_LENGTH	16
84 #define RSN_KEK_LENGTH	16
85 #define TPK_FTM_LEN		16
86 #ifndef INTF_NAME_SIZ
87 #define INTF_NAME_SIZ	16
88 #endif // endif
89 
90 #define WL_ASSOC_START_EVT_DATA_VERSION      1
91 #define WSEC_MAX_SAE_PASSWORD_LEN           128
92 
93 typedef struct assoc_event_data {
94 	uint32 version;
95 	uint32 flags;
96 	chanspec_t join_chspec;
97 } assoc_event_data_t;
98 
99 /**Used to send ioctls over the transport pipe */
100 typedef struct remote_ioctl {
101 	cdc_ioctl_t	msg;
102 	uint32		data_len;
103 	char           intf_name[INTF_NAME_SIZ];
104 } rem_ioctl_t;
105 #define REMOTE_SIZE	sizeof(rem_ioctl_t)
106 
107 #define BCM_IOV_XTLV_VERSION 0
108 
109 #define MAX_NUM_D11CORES 2
110 
111 /**DFS Forced param */
112 typedef struct wl_dfs_forced_params {
113 	chanspec_t chspec;
114 	uint16 version;
115 	chanspec_list_t chspec_list;
116 } wl_dfs_forced_t;
117 
118 #define DFS_PREFCHANLIST_VER 0x01
119 #define WL_CHSPEC_LIST_FIXED_SIZE	OFFSETOF(chanspec_list_t, list)
120 /* size of dfs forced param size given n channels are in the list */
121 #define WL_DFS_FORCED_PARAMS_SIZE(n) \
122 	(sizeof(wl_dfs_forced_t) + (((n) < 1) ? (0) : (((n) - 1)* sizeof(chanspec_t))))
123 #define WL_DFS_FORCED_PARAMS_FIXED_SIZE \
124 	(WL_CHSPEC_LIST_FIXED_SIZE + OFFSETOF(wl_dfs_forced_t, chspec_list))
125 #define WL_DFS_FORCED_PARAMS_MAX_SIZE \
126 	WL_DFS_FORCED_PARAMS_FIXED_SIZE + (WL_NUMCHANNELS * sizeof(chanspec_t))
127 
128 /**association decision information */
129 typedef struct {
130 	uint8		assoc_approved;		/**< (re)association approved */
131 	uint8		pad;
132 	uint16		reject_reason;		/**< reason code for rejecting association */
133 	struct		ether_addr   da;
134 	uint8		pad1[6];
135 	int64		sys_time;		/**< current system time */
136 } assoc_decision_t;
137 
138 #define DFS_SCAN_S_IDLE		-1
139 #define DFS_SCAN_S_RADAR_FREE 0
140 #define DFS_SCAN_S_RADAR_FOUND 1
141 #define DFS_SCAN_S_INPROGESS 2
142 #define DFS_SCAN_S_SCAN_ABORTED 3
143 #define DFS_SCAN_S_SCAN_MODESW_INPROGRESS 4
144 #define DFS_SCAN_S_MAX 5
145 
146 #define ACTION_FRAME_SIZE 1800
147 
148 typedef struct wl_action_frame {
149 	struct ether_addr 	da;
150 	uint16 			len;
151 	uint32 			packetId;
152 	uint8			data[ACTION_FRAME_SIZE];
153 } wl_action_frame_t;
154 
155 #define WL_WIFI_ACTION_FRAME_SIZE sizeof(struct wl_action_frame)
156 
157 typedef struct ssid_info
158 {
159 	uint8		ssid_len;	/**< the length of SSID */
160 	uint8		ssid[32];	/**< SSID string */
161 } ssid_info_t;
162 
163 typedef struct wl_af_params {
164 	uint32			channel;
165 	int32			dwell_time;
166 	struct ether_addr	BSSID;
167 	uint8 PAD[2];
168 	wl_action_frame_t	action_frame;
169 } wl_af_params_t;
170 
171 #define WL_WIFI_AF_PARAMS_SIZE sizeof(struct wl_af_params)
172 
173 #define WL_EXTAUTH_START      1
174 #define WL_EXTAUTH_ABORT      2
175 #define WL_EXTAUTH_FAIL       3
176 #define WL_EXTAUTH_SUCCESS    4
177 
178 #ifdef WL_FW_ARCH_MSCH
179 /**
180  * Used by both dongle and host
181  * dongle asks host to start auth(SAE)
182  * host updates auth status to dongle
183  */
184 typedef struct wl_auth_req_status {
185 	uint16  flags;
186 	struct  ether_addr peer_mac; /**< peer mac address */
187 	uint32  ssid_len;
188 	uint8   ssid[DOT11_MAX_SSID_LEN];
189 	uint8   pmkid[WPA2_PMKID_LEN];
190 } wl_auth_req_status_t;
191 #else /* WL_FW_ARCH_MSCH */
192 typedef struct wl_wifi_external_auth_event {
193 	uint8 akm_suite[4];		        /* AKM Suite */
194 	uint32 external_auth_act;	    /* action: start / abort */
195 	uint8 bssid[ETHER_ADDR_LEN];	/* bssid */
196 	uint32 SSID_len;
197 	uint8 SSID[DOT11_MAX_SSID_LEN];
198 	uint32 status;
199 } wl_wifi_external_auth_event_t;
200 #endif /* WL_FW_ARCH_MSCH */
201 
202 typedef struct wl_mf_params {
203 	uint32 version;
204 	uint32 dwell_time;
205 	uint16 len;
206 	uint16 fc;
207 	uint16 channel;
208 	struct ether_addr da;
209 	struct ether_addr bssid;
210 	uint32 packetId;
211 	uint8  data[1];
212 } wl_mf_params_t;
213 
214 #define MFP_TEST_FLAG_NORMAL	0
215 #define MFP_TEST_FLAG_ANY_KEY	1
216 typedef struct wl_sa_query {
217 	uint32 flag;
218 	uint8  action;
219 	uint8  PAD;
220 	uint16 id;
221 	struct ether_addr da;
222 	uint16  PAD;
223 } wl_sa_query_t;
224 
225 /* EXT_STA */
226 /**association information */
227 typedef struct {
228 	uint32		assoc_req;	/**< offset to association request frame */
229 	uint32		assoc_req_len;	/**< association request frame length */
230 	uint32		assoc_rsp;	/**< offset to association response frame */
231 	uint32		assoc_rsp_len;	/**< association response frame length */
232 	uint32		bcn;		/**< offset to AP beacon */
233 	uint32		bcn_len;	/**< AP beacon length */
234 	uint32		wsec;		/**< ucast security algo */
235 	uint32		wpaie;		/**< offset to WPA ie */
236 	uint8		auth_alg;	/**< 802.11 authentication mode */
237 	uint8		WPA_auth;	/**< WPA: authenticated key management */
238 	uint8		ewc_cap;	/**< EWC (MIMO) capable */
239 	uint8		ofdm;		/**< OFDM */
240 } assoc_info_t;
241 /* defined(EXT_STA) */
242 
243 /* Flags for OBSS IOVAR Parameters */
244 #define WL_OBSS_DYN_BWSW_FLAG_ACTIVITY_PERIOD        (0x01)
245 #define WL_OBSS_DYN_BWSW_FLAG_NOACTIVITY_PERIOD      (0x02)
246 #define WL_OBSS_DYN_BWSW_FLAG_NOACTIVITY_INCR_PERIOD (0x04)
247 #define WL_OBSS_DYN_BWSW_FLAG_PSEUDO_SENSE_PERIOD    (0x08)
248 #define WL_OBSS_DYN_BWSW_FLAG_RX_CRS_PERIOD          (0x10)
249 #define WL_OBSS_DYN_BWSW_FLAG_DUR_THRESHOLD          (0x20)
250 #define WL_OBSS_DYN_BWSW_FLAG_TXOP_PERIOD            (0x40)
251 
252 /* OBSS IOVAR Version information */
253 #define WL_PROT_OBSS_CONFIG_PARAMS_VERSION 1
254 
255 #include <packed_section_start.h>
256 typedef BWL_PRE_PACKED_STRUCT struct {
257 	uint8 obss_bwsw_activity_cfm_count_cfg; /**< configurable count in
258 		* seconds before we confirm that OBSS is present and
259 		* dynamically activate dynamic bwswitch.
260 		*/
261 	uint8 obss_bwsw_no_activity_cfm_count_cfg; /**< configurable count in
262 		* seconds before we confirm that OBSS is GONE and
263 		* dynamically start pseudo upgrade. If in pseudo sense time, we
264 		* will see OBSS, [means that, we false detected that OBSS-is-gone
265 		* in watchdog] this count will be incremented in steps of
266 		* obss_bwsw_no_activity_cfm_count_incr_cfg for confirming OBSS
267 		* detection again. Note that, at present, max 30seconds is
268 		* allowed like this. [OBSS_BWSW_NO_ACTIVITY_MAX_INCR_DEFAULT]
269 		*/
270 	uint8 obss_bwsw_no_activity_cfm_count_incr_cfg; /* see above
271 		*/
272 	uint16 obss_bwsw_pseudo_sense_count_cfg; /**< number of msecs/cnt to be in
273 		* pseudo state. This is used to sense/measure the stats from lq.
274 		*/
275 	uint8 obss_bwsw_rx_crs_threshold_cfg; /**< RX CRS default threshold */
276 	uint8 obss_bwsw_dur_thres; /**< OBSS dyn bwsw trigger/RX CRS Sec */
277 	uint8 obss_bwsw_txop_threshold_cfg; /**< TXOP default threshold */
278 } BWL_POST_PACKED_STRUCT wlc_obss_dynbwsw_config_t;
279 #include <packed_section_end.h>
280 
281 #include <packed_section_start.h>
282 typedef BWL_PRE_PACKED_STRUCT struct {
283 	uint32 version;	/**< version field */
284 	uint32 config_mask;
285 	uint32 reset_mask;
286 	wlc_obss_dynbwsw_config_t config_params;
287 } BWL_POST_PACKED_STRUCT obss_config_params_t;
288 #include <packed_section_end.h>
289 
290 /**bsscfg type */
291 typedef enum bsscfg_type {
292 	BSSCFG_TYPE_GENERIC = 0,	/**< Generic AP/STA/IBSS BSS */
293 	BSSCFG_TYPE_P2P = 1,		/**< P2P BSS */
294 	/* index 2 earlier used for BTAMP */
295 	BSSCFG_TYPE_PSTA = 3,
296 	BSSCFG_TYPE_TDLS = 4,
297 	BSSCFG_TYPE_SLOTTED_BSS = 5,
298 	BSSCFG_TYPE_PROXD = 6,
299 	BSSCFG_TYPE_NAN = 7,
300 	BSSCFG_TYPE_MESH = 8,
301 	BSSCFG_TYPE_AIBSS = 9
302 } bsscfg_type_t;
303 
304 /* bsscfg subtype */
305 typedef enum bsscfg_subtype {
306 	BSSCFG_SUBTYPE_NONE = 0,
307 	BSSCFG_GENERIC_STA = 1,		/* GENERIC */
308 	BSSCFG_GENERIC_AP = 2,
309 	BSSCFG_GENERIC_IBSS = 6,
310 	BSSCFG_P2P_GC = 3,		/* P2P */
311 	BSSCFG_P2P_GO = 4,
312 	BSSCFG_P2P_DISC = 5,
313 	/* Index 7 & 8 earlier used for BTAMP */
314 	BSSCFG_SUBTYPE_AWDL = 9, /* SLOTTED_BSS_TYPE */
315 	BSSCFG_SUBTYPE_NAN_MGMT = 10,
316 	BSSCFG_SUBTYPE_NAN_DATA = 11,
317 	BSSCFG_SUBTYPE_NAN_MGMT_DATA = 12
318 } bsscfg_subtype_t;
319 
320 typedef struct wlc_bsscfg_info {
321 	uint32 type;
322 	uint32 subtype;
323 } wlc_bsscfg_info_t;
324 
325 /* ULP SHM Offsets info */
326 typedef struct ulp_shm_info {
327 	uint32 m_ulp_ctrl_sdio;
328 	uint32 m_ulp_wakeevt_ind;
329 	uint32 m_ulp_wakeind;
330 } ulp_shm_info_t;
331 
332 /* Legacy structure to help keep backward compatible wl tool and tray app */
333 
334 #define	LEGACY_WL_BSS_INFO_VERSION	107	/**< older version of wl_bss_info struct */
335 
336 typedef struct wl_bss_info_107 {
337 	uint32		version;		/**< version field */
338 	uint32		length;			/**< byte length of data in this record,
339 						 * starting at version and including IEs
340 						 */
341 	struct ether_addr BSSID;
342 	uint16		beacon_period;		/**< units are Kusec */
343 	uint16		capability;		/**< Capability information */
344 	uint8		SSID_len;
345 	uint8		SSID[32];
346 	uint8		PAD;
347 	struct {
348 		uint32	count;			/**< # rates in this set */
349 		uint8	rates[16];		/**< rates in 500kbps units w/hi bit set if basic */
350 	} rateset;				/**< supported rates */
351 	uint8		channel;		/**< Channel no. */
352 	uint8		PAD;
353 	uint16		atim_window;		/**< units are Kusec */
354 	uint8		dtim_period;		/**< DTIM period */
355 	uint8		PAD;
356 	int16		RSSI;			/**< receive signal strength (in dBm) */
357 	int8		phy_noise;		/**< noise (in dBm) */
358 	uint8		PAD[3];
359 	uint32		ie_length;		/**< byte length of Information Elements */
360 	/* variable length Information Elements */
361 } wl_bss_info_107_t;
362 
363 /*
364  * Per-BSS information structure.
365  */
366 
367 #define	LEGACY2_WL_BSS_INFO_VERSION	108		/**< old version of wl_bss_info struct */
368 
369 /**
370  * BSS info structure
371  * Applications MUST CHECK ie_offset field and length field to access IEs and
372  * next bss_info structure in a vector (in wl_scan_results_t)
373  */
374 typedef struct wl_bss_info_108 {
375 	uint32		version;		/**< version field */
376 	uint32		length;			/**< byte length of data in this record,
377 						 * starting at version and including IEs
378 						 */
379 	struct ether_addr BSSID;
380 	uint16		beacon_period;		/**< units are Kusec */
381 	uint16		capability;		/**< Capability information */
382 	uint8		SSID_len;
383 	uint8		SSID[32];
384 	uint8		PAD[1];
385 	struct {
386 		uint32	count;			/**< # rates in this set */
387 		uint8	rates[16];		/**< rates in 500kbps units w/hi bit set if basic */
388 	} rateset;				/**< supported rates */
389 	chanspec_t	chanspec;		/**< chanspec for bss */
390 	uint16		atim_window;		/**< units are Kusec */
391 	uint8		dtim_period;		/**< DTIM period */
392 	uint8		PAD;
393 	int16		RSSI;			/**< receive signal strength (in dBm) */
394 	int8		phy_noise;		/**< noise (in dBm) */
395 
396 	uint8		n_cap;			/**< BSS is 802.11N Capable */
397 	uint8		PAD[2];
398 	uint32		nbss_cap;		/**< 802.11N BSS Capabilities (based on HT_CAP_*) */
399 	uint8		ctl_ch;			/**< 802.11N BSS control channel number */
400 	uint8		PAD[3];
401 	uint32		reserved32[1];		/**< Reserved for expansion of BSS properties */
402 	uint8		flags;			/**< flags */
403 	uint8		reserved[3];		/**< Reserved for expansion of BSS properties */
404 	uint8		basic_mcs[MCSSET_LEN];	/**< 802.11N BSS required MCS set */
405 
406 	uint16		ie_offset;		/**< offset at which IEs start, from beginning */
407 	uint8		PAD[2];
408 	uint32		ie_length;		/**< byte length of Information Elements */
409 	/* Add new fields here */
410 	/* variable length Information Elements */
411 } wl_bss_info_108_t;
412 
413 #define	WL_BSS_INFO_VERSION	109		/**< current version of wl_bss_info struct */
414 
415 /**
416  * BSS info structure
417  * Applications MUST CHECK ie_offset field and length field to access IEs and
418  * next bss_info structure in a vector (in wl_scan_results_t)
419  */
420 typedef struct wl_bss_info {
421 	uint32		version;		/**< version field */
422 	uint32		length;			/**< byte length of data in this record,
423 						 * starting at version and including IEs
424 						 */
425 	struct ether_addr BSSID;
426 	uint16		beacon_period;		/**< units are Kusec */
427 	uint16		capability;		/**< Capability information */
428 	uint8		SSID_len;
429 	uint8		SSID[32];
430 	uint8		bcnflags;		/* additional flags w.r.t. beacon */
431 	struct {
432 		uint32	count;			/**< # rates in this set */
433 		uint8	rates[16];		/**< rates in 500kbps units w/hi bit set if basic */
434 	} rateset;				/**< supported rates */
435 	chanspec_t	chanspec;		/**< chanspec for bss */
436 	uint16		atim_window;		/**< units are Kusec */
437 	uint8		dtim_period;		/**< DTIM period */
438 	uint8		accessnet;		/* from beacon interwork IE (if bcnflags) */
439 	int16		RSSI;			/**< receive signal strength (in dBm) */
440 	int8		phy_noise;		/**< noise (in dBm) */
441 	uint8		n_cap;			/**< BSS is 802.11N Capable */
442 	uint16		freespace1;		/* make implicit padding explicit */
443 	uint32		nbss_cap;		/**< 802.11N+AC BSS Capabilities */
444 	uint8		ctl_ch;			/**< 802.11N BSS control channel number */
445 	uint8		padding1[3];		/**< explicit struct alignment padding */
446 	uint16		vht_rxmcsmap;	/**< VHT rx mcs map (802.11ac IE, VHT_CAP_MCS_MAP_*) */
447 	uint16		vht_txmcsmap;	/**< VHT tx mcs map (802.11ac IE, VHT_CAP_MCS_MAP_*) */
448 	uint8		flags;			/**< flags */
449 	uint8		vht_cap;		/**< BSS is vht capable */
450 	uint8		reserved[2];		/**< Reserved for expansion of BSS properties */
451 	uint8		basic_mcs[MCSSET_LEN];	/**< 802.11N BSS required MCS set */
452 
453 	uint16		ie_offset;		/**< offset at which IEs start, from beginning */
454 	uint16		freespace2;		/* making implicit padding explicit */
455 	uint32		ie_length;		/**< byte length of Information Elements */
456 	int16		SNR;			/**< average SNR of during frame reception */
457 	uint16		vht_mcsmap;		/**< STA's Associated vhtmcsmap */
458 	uint16		vht_mcsmap_prop;	/**< STA's Associated prop vhtmcsmap */
459 	uint16		vht_txmcsmap_prop;	/**< prop VHT tx mcs prop */
460 } wl_bss_info_v109_t;
461 
462 /**
463  * BSS info structure
464  * Applications MUST CHECK ie_offset field and length field to access IEs and
465  * next bss_info structure in a vector (in wl_scan_results_t)
466  */
467 typedef struct wl_bss_info_v109_1 {
468 	uint32		version;		/**< version field */
469 	uint32		length;			/**< byte length of data in this record,
470 						 * starting at version and including IEs
471 						 */
472 	struct ether_addr BSSID;
473 	uint16		beacon_period;		/**< units are Kusec */
474 	uint16		capability;		/**< Capability information */
475 	uint8		SSID_len;
476 	uint8		SSID[32];
477 	uint8		bcnflags;		/* additional flags w.r.t. beacon */
478 	struct {
479 		uint32	count;			/**< # rates in this set */
480 		uint8	rates[16];		/**< rates in 500kbps units w/hi bit set if basic */
481 	} rateset;				/**< supported rates */
482 	chanspec_t	chanspec;		/**< chanspec for bss */
483 	uint16		atim_window;		/**< units are Kusec */
484 	uint8		dtim_period;		/**< DTIM period */
485 	uint8		accessnet;		/* from beacon interwork IE (if bcnflags) */
486 	int16		RSSI;			/**< receive signal strength (in dBm) */
487 	int8		phy_noise;		/**< noise (in dBm) */
488 	uint8		n_cap;			/**< BSS is 802.11N Capable */
489 	uint8		he_cap;			/**< BSS is he capable */
490 	uint8		freespace1;		/* make implicit padding explicit */
491 	uint32		nbss_cap;		/**< 802.11N+AC BSS Capabilities */
492 	uint8		ctl_ch;			/**< 802.11N BSS control channel number */
493 	uint8		padding1[3];		/**< explicit struct alignment padding */
494 	uint16		vht_rxmcsmap;	/**< VHT rx mcs map (802.11ac IE, VHT_CAP_MCS_MAP_*) */
495 	uint16		vht_txmcsmap;	/**< VHT tx mcs map (802.11ac IE, VHT_CAP_MCS_MAP_*) */
496 	uint8		flags;			/**< flags */
497 	uint8		vht_cap;		/**< BSS is vht capable */
498 	uint8		reserved[2];		/**< Reserved for expansion of BSS properties */
499 	uint8		basic_mcs[MCSSET_LEN];	/**< 802.11N BSS required MCS set */
500 
501 	uint16		ie_offset;		/**< offset at which IEs start, from beginning */
502 	uint16		freespace2;		/* making implicit padding explicit */
503 	uint32		ie_length;		/**< byte length of Information Elements */
504 	int16		SNR;			/**< average SNR of during frame reception */
505 	uint16		vht_mcsmap;		/**< STA's Associated vhtmcsmap */
506 	uint16		vht_mcsmap_prop;	/**< STA's Associated prop vhtmcsmap */
507 	uint16		vht_txmcsmap_prop;	/**< prop VHT tx mcs prop */
508 	uint32		he_mcsmap;	/**< STA's Associated hemcsmap */
509 	uint32		he_rxmcsmap;	/**< HE rx mcs map (802.11ax IE, HE_CAP_MCS_MAP_*) */
510 	uint32		he_txmcsmap;	/**< HE tx mcs map (802.11ax IE, HE_CAP_MCS_MAP_*) */
511 } wl_bss_info_v109_1_t;
512 
513 /**
514  * BSS info structure
515  * Applications MUST CHECK ie_offset field and length field to access IEs and
516  * next bss_info structure in a vector (in wl_scan_results_t)
517  */
518 typedef struct wl_bss_info_v109_2 {
519 	uint32		version;		/**< version field */
520 	uint32		length;			/**< byte length of data in this record,
521 						 * starting at version and including IEs
522 						 */
523 	struct ether_addr BSSID;
524 	uint16		beacon_period;		/**< units are Kusec */
525 	uint16		capability;		/**< Capability information */
526 	uint8		SSID_len;
527 	uint8		SSID[32];
528 	uint8		bcnflags;		/* additional flags w.r.t. beacon */
529 	struct {
530 		uint32	count;			/**< # rates in this set */
531 		uint8	rates[16];		/**< rates in 500kbps units w/hi bit set if basic */
532 	} rateset;				/**< supported rates */
533 	chanspec_t	chanspec;		/**< chanspec for bss */
534 	uint16		atim_window;		/**< units are Kusec */
535 	uint8		dtim_period;		/**< DTIM period */
536 	uint8		accessnet;		/* from beacon interwork IE (if bcnflags) */
537 	int16		RSSI;			/**< receive signal strength (in dBm) */
538 	int8		phy_noise;		/**< noise (in dBm) */
539 	uint8		n_cap;			/**< BSS is 802.11N Capable */
540 	uint8		he_cap;			/**< BSS is he capable */
541 	uint8		freespace1;		/* make implicit padding explicit */
542 	uint32		nbss_cap;		/**< 802.11N+AC BSS Capabilities */
543 	uint8		ctl_ch;			/**< 802.11N BSS control channel number */
544 	uint8		padding1[3];		/**< explicit struct alignment padding */
545 	uint16		vht_rxmcsmap;	/**< VHT rx mcs map (802.11ac IE, VHT_CAP_MCS_MAP_*) */
546 	uint16		vht_txmcsmap;	/**< VHT tx mcs map (802.11ac IE, VHT_CAP_MCS_MAP_*) */
547 	uint8		flags;			/**< flags */
548 	uint8		vht_cap;		/**< BSS is vht capable */
549 	uint8		reserved[2];		/**< Reserved for expansion of BSS properties */
550 	uint8		basic_mcs[MCSSET_LEN];	/**< 802.11N BSS required MCS set */
551 
552 	uint16		ie_offset;		/**< offset at which IEs start, from beginning */
553 	uint16		freespace2;		/* making implicit padding explicit */
554 	uint32		ie_length;		/**< byte length of Information Elements */
555 	int16		SNR;			/**< average SNR of during frame reception */
556 	uint16		vht_mcsmap;		/**< STA's Associated vhtmcsmap */
557 	uint16		vht_mcsmap_prop;	/**< STA's Associated prop vhtmcsmap */
558 	uint16		vht_txmcsmap_prop;	/**< prop VHT tx mcs prop */
559 	uint32		he_mcsmap;	/**< STA's Associated hemcsmap */
560 	uint32		he_rxmcsmap;	/**< HE rx mcs map (802.11ax IE, HE_CAP_MCS_MAP_*) */
561 	uint32		he_txmcsmap;	/**< HE tx mcs map (802.11ax IE, HE_CAP_MCS_MAP_*) */
562 	uint32		timestamp[2];  /* Beacon Timestamp for FAKEAP req */
563 } wl_bss_info_v109_2_t;
564 
565 #ifndef WL_BSS_INFO_TYPEDEF_HAS_ALIAS
566 typedef wl_bss_info_v109_t wl_bss_info_t;
567 #endif // endif
568 
569 #define WL_GSCAN_FULL_RESULT_VERSION	2	/* current version of wl_gscan_result_t struct */
570 
571 typedef struct wl_gscan_bss_info {
572 	uint32      timestamp[2];
573 	wl_bss_info_v109_t info;
574 	/* Do not add any more members below, fixed  */
575 	/* and variable length Information Elements to follow */
576 } wl_gscan_bss_info_v2_t;
577 
578 typedef struct wl_gscan_bss_info_v3 {
579 	uint32      timestamp[2];
580 	uint8 info[];	/* var length wl_bss_info_X structures */
581 	/* Do not add any more members below, fixed  */
582 	/* and variable length Information Elements to follow */
583 } wl_gscan_bss_info_v3_t;
584 
585 #ifndef WL_BSS_INFO_TYPEDEF_HAS_ALIAS
586 typedef wl_gscan_bss_info_v2_t wl_gscan_bss_info_t;
587 #define WL_GSCAN_INFO_FIXED_FIELD_SIZE   (sizeof(wl_gscan_bss_info_t) - sizeof(wl_bss_info_t))
588 #endif // endif
589 
590 typedef struct wl_bsscfg {
591 	uint32  bsscfg_idx;
592 	uint32  wsec;
593 	uint32  WPA_auth;
594 	uint32  wsec_index;
595 	uint32  associated;
596 	uint32  BSS;
597 	uint32  phytest_on;
598 	struct ether_addr   prev_BSSID;
599 	struct ether_addr   BSSID;
600 	uint32  targetbss_wpa2_flags;
601 	uint32 assoc_type;
602 	uint32 assoc_state;
603 } wl_bsscfg_t;
604 
605 typedef struct wl_if_add {
606 	uint32  bsscfg_flags;
607 	uint32  if_flags;
608 	uint32  ap;
609 	struct ether_addr   mac_addr;
610 	uint16  PAD;
611 	uint32  wlc_index;
612 } wl_if_add_t;
613 
614 typedef struct wl_bss_config {
615 	uint32	atim_window;
616 	uint32	beacon_period;
617 	uint32	chanspec;
618 } wl_bss_config_t;
619 
620 #define INVALID_HE_OMI_ARG 255
621 
622 #define WL_HE_OMI_V1 1
623 typedef struct wl_he_omi_v1 {
624 	uint8 version;
625 	uint8 length;
626 	uint8 rx_nss;
627 	uint8 chnl_wdth;
628 	uint8 ul_mu_dis;
629 	uint8 tx_nsts;
630 	uint8 er_su_dis;
631 	uint8 dl_mu_resound;
632 	uint8 ul_mu_data_dis;
633 } wl_he_omi_v1_t;
634 
635 #ifndef HE_OMI_VER_ENABLED
636 #define WL_HE_OMI_VER (WL_HE_OMI_V1)
637 typedef wl_he_omi_v1_t wl_he_omi_t;
638 #endif // endif
639 
640 /* HE PPE Thresholds field description (variable length) support */
641 typedef struct wl_he_ppe_ths_params {
642 	uint8 ppe_ths_len;		/* data length (starting after this field) */
643 	uint8 ppe_ths_field[1]; /* field data with variable length */
644 } wl_he_ppe_ths_params_t;
645 
646 /* MU EDCA override support for testbed STA configuration */
647 struct he_muedca_params {
648 	bool override_enabled;
649 	uint8 muedca_upd_cnt;
650 	he_mu_ac_param_record_t param_ac[AC_COUNT];
651 };
652 
653 typedef struct he_muedca_params he_muedca_params_t;
654 
655 /* MUEDCA Timer range */
656 #define HE_MUEDCA_TIMER_MIN	1u
657 #define HE_MUEDCA_TIMER_MAX	255u
658 
659 /* AIFSN=0 indicates that EDCA is disabled for the duration
660  * specified by the MUEDCATimer for the corresponding AC
661  */
662 #define HE_MUEDCA_AIFSN_MIN	0
663 
664 /* HE OFDMA TX DEMO support */
665 typedef struct he_ofdmatx_demo_params {
666 	bool demo_mode_enabled;
667 	uint32 twt_wake_dur;	/* target wake duration in unit of microseconds */
668 	uint32 twt_wake_int;	/* target wake interval in unit of microseconds */
669 } he_ofdmatx_demo_params_t;
670 
671 /* Number of Bsscolor supported per core */
672 #ifndef HE_MAX_BSSCOLOR_RES
673 #define HE_MAX_BSSCOLOR_RES		2
674 #endif // endif
675 
676 #ifndef HE_MAX_STAID_PER_BSSCOLOR
677 #define HE_MAX_STAID_PER_BSSCOLOR	4
678 #endif // endif
679 
680 /* BSSColor indices */
681 #define BSSCOLOR0_IDX	0
682 #define BSSCOLOR1_IDX	1
683 #define HE_BSSCOLOR0	0
684 #define HE_BSSCOLOR_MAX_VAL 63
685 
686 /* STAID indices */
687 #define STAID0_IDX	0
688 #define STAID1_IDX	1
689 #define STAID2_IDX	2
690 #define STAID3_IDX	3
691 #define HE_STAID_MAX_VAL	0x07FF
692 
693 typedef struct wl_bsscolor_info {
694 	uint16 version;		/**< structure version */
695 	uint16 length;		/**< length of the bsscolor info */
696 	uint8	bsscolor_index;	/**< bsscolor index 0-1 */
697 	uint8	bsscolor;	/**<bsscolor value from 0 to 63 */
698 	uint8	partial_bsscolor_ind;
699 	uint8	disable_bsscolor_ind;	/**< To disable particular bsscolor */
700 	uint16	staid_info[HE_MAX_STAID_PER_BSSCOLOR];	/**< 0-3 staid info of each bsscolor */
701 } wl_bsscolor_info_t;
702 
703 #define WL_BSS_USER_RADAR_CHAN_SELECT	0x1	/**< User application will randomly select
704 						 * radar channel.
705 						 */
706 
707 #define DLOAD_HANDLER_VER		1	/**< Downloader version */
708 #define DLOAD_FLAG_VER_MASK		0xf000	/**< Downloader version mask */
709 #define DLOAD_FLAG_VER_SHIFT		12	/**< Downloader version shift */
710 
711 #define DL_CRC_NOT_INUSE	0x0001
712 #define DL_BEGIN		0x0002
713 #define DL_END			0x0004
714 
715 /* Flags for Major/Minor/Date number shift and mask */
716 #define EPI_VER_SHIFT     16
717 #define EPI_VER_MASK      0xFFFF
718 /** generic download types & flags */
719 enum {
720 	DL_TYPE_UCODE = 1,
721 	DL_TYPE_CLM = 2
722 };
723 
724 /** ucode type values */
725 enum {
726 	UCODE_FW,
727 	INIT_VALS,
728 	BS_INIT_VALS
729 };
730 
731 struct wl_dload_data {
732 	uint16 flag;
733 	uint16 dload_type;
734 	uint32 len;
735 	uint32 crc;
736 	uint8  data[1];
737 };
738 typedef struct wl_dload_data wl_dload_data_t;
739 
740 struct wl_ucode_info {
741 	uint32 ucode_type;
742 	uint32 num_chunks;
743 	uint32 chunk_len;
744 	uint32 chunk_num;
745 	uint8  data_chunk[1];
746 };
747 typedef struct wl_ucode_info wl_ucode_info_t;
748 
749 struct wl_clm_dload_info {
750 	uint32 ds_id;
751 	uint32 clm_total_len;
752 	uint32 num_chunks;
753 	uint32 chunk_len;
754 	uint32 chunk_offset;
755 	uint8  data_chunk[1];
756 };
757 typedef struct wl_clm_dload_info wl_clm_dload_info_t;
758 
759 typedef struct wlc_ssid {
760 	uint32		SSID_len;
761 	uint8		SSID[DOT11_MAX_SSID_LEN];
762 } wlc_ssid_t;
763 
764 typedef struct wlc_ssid_ext {
765 	uint8      hidden;
766 	uint8      PAD;
767 	uint16     flags;
768 	uint8      SSID_len;
769 	int8       rssi_thresh;
770 	uint8      SSID[DOT11_MAX_SSID_LEN];
771 } wlc_ssid_ext_t;
772 
773 #define MAX_PREFERRED_AP_NUM     5
774 typedef struct wlc_fastssidinfo {
775 	uint32			SSID_channel[MAX_PREFERRED_AP_NUM];
776 	wlc_ssid_t		SSID_info[MAX_PREFERRED_AP_NUM];
777 } wlc_fastssidinfo_t;
778 
779 typedef struct wnm_url {
780 	uint8   len;
781 	uint8   data[1];
782 } wnm_url_t;
783 
784 typedef struct chan_scandata {
785 	uint8		txpower;
786 	uint8		pad;
787 	chanspec_t	channel;		/**< Channel num, bw, ctrl_sb and band */
788 	uint32		channel_mintime;
789 	uint32		channel_maxtime;
790 } chan_scandata_t;
791 
792 typedef enum wl_scan_type {
793 	EXTDSCAN_FOREGROUND_SCAN,
794 	EXTDSCAN_BACKGROUND_SCAN,
795 	EXTDSCAN_FORCEDBACKGROUND_SCAN
796 } wl_scan_type_t;
797 
798 #define WLC_EXTDSCAN_MAX_SSID		5
799 
800 typedef struct wl_extdscan_params {
801 	int8 		nprobes;		/**< 0, passive, otherwise active */
802 	int8    	split_scan;		/**< split scan */
803 	int8		band;			/**< band */
804 	int8		pad;
805 	wlc_ssid_t 	ssid[WLC_EXTDSCAN_MAX_SSID]; /**< ssid list */
806 	uint32		tx_rate;		/**< in 500ksec units */
807 	wl_scan_type_t	scan_type;		/**< enum */
808 	int32 		channel_num;
809 	chan_scandata_t channel_list[1];	/**< list of chandata structs */
810 } wl_extdscan_params_t;
811 
812 #define WL_EXTDSCAN_PARAMS_FIXED_SIZE 	(sizeof(wl_extdscan_params_t) - sizeof(chan_scandata_t))
813 
814 #define WL_SCAN_PARAMS_SSID_MAX 	10
815 
816 typedef struct wl_scan_params {
817 	wlc_ssid_t ssid;		/**< default: {0, ""} */
818 	struct ether_addr bssid;	/**< default: bcast */
819 	int8 bss_type;			/**< default: any,
820 					 * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
821 					 */
822 	uint8 scan_type;		/**< flags, 0 use default */
823 	int32 nprobes;			/**< -1 use default, number of probes per channel */
824 	int32 active_time;		/**< -1 use default, dwell time per channel for
825 					 * active scanning
826 					 */
827 	int32 passive_time;		/**< -1 use default, dwell time per channel
828 					 * for passive scanning
829 					 */
830 	int32 home_time;		/**< -1 use default, dwell time for the home channel
831 					 * between channel scans
832 					 */
833 	int32 channel_num;		/**< count of channels and ssids that follow
834 					 *
835 					 * low half is count of channels in channel_list, 0
836 					 * means default (use all available channels)
837 					 *
838 					 * high half is entries in wlc_ssid_t array that
839 					 * follows channel_list, aligned for int32 (4 bytes)
840 					 * meaning an odd channel count implies a 2-byte pad
841 					 * between end of channel_list and first ssid
842 					 *
843 					 * if ssid count is zero, single ssid in the fixed
844 					 * parameter portion is assumed, otherwise ssid in
845 					 * the fixed portion is ignored
846 					 */
847 	uint16 channel_list[1];		/**< list of chanspecs */
848 } wl_scan_params_t;
849 
850 /* changes in wl_scan_params_v2 as comapred to wl_scan_params (v1)
851  * * unit8 scantype to uint32
852  */
853 typedef struct wl_scan_params_v2 {
854 	uint16 version;                 /* Version of wl_scan_params, change value of
855 					 * WL_SCAN_PARAM_VERSION on version update
856 					 */
857 	uint16 length;                  /* length of structure wl_scan_params_v1_t
858 					 * without implicit pad
859 					 */
860 	wlc_ssid_t ssid;                /**< default: {0, ""} */
861 	struct ether_addr bssid;        /**< default: bcast */
862 	int8 bss_type;                  /**< default: any,
863 					 * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
864 					*/
865 	uint8 PAD;
866 	uint32 scan_type;               /**< flags, 0 use default, and flags specified in
867 					 * WL_SCANFLAGS_XXX
868 					 */
869 	int32 nprobes;                  /**< -1 use default, number of probes per channel */
870 	int32 active_time;              /**< -1 use default, dwell time per channel for
871 					 * active scanning
872 					 */
873 	int32 passive_time;             /**< -1 use default, dwell time per channel
874 					 * for passive scanning
875 					 */
876 	int32 home_time;                /**< -1 use default, dwell time for the home channel
877 					 * between channel scans
878 					 */
879 	int32 channel_num;              /**< count of channels and ssids that follow
880 					 *
881 					 * low half is count of channels in channel_list, 0
882 					 * means default (use all available channels)
883 					 *
884 					 * high half is entries in wlc_ssid_t array that
885 					 * follows channel_list, aligned for int32 (4 bytes)
886 					 * meaning an odd channel count implies a 2-byte pad
887 					 * between end of channel_list and first ssid
888 					 *
889 					 * if ssid count is zero, single ssid in the fixed
890 					 * parameter portion is assumed, otherwise ssid in
891 					 * the fixed portion is ignored
892 					 */
893 	uint16 channel_list[1];         /**< list of chanspecs */
894 } wl_scan_params_v2_t;
895 
896 #define WL_SCAN_PARAMS_VERSION_V2               2
897 
898 /** size of wl_scan_params not including variable length array */
899 #define WL_SCAN_PARAMS_FIXED_SIZE 64
900 #define WL_MAX_ROAMSCAN_DATSZ	(WL_SCAN_PARAMS_FIXED_SIZE + (WL_NUMCHANNELS * sizeof(uint16)))
901 #define WL_SCAN_PARAMS_V2_FIXED_SIZE    (OFFSETOF(wl_scan_params_v2_t, channel_list))
902 #define WL_MAX_ROAMSCAN_V2_DATSZ \
903 	(WL_SCAN_PARAMS_V2_FIXED_SIZE + (WL_NUMCHANNELS * sizeof(uint16)))
904 
905 #define ISCAN_REQ_VERSION 1
906 
907 /** incremental scan struct */
908 typedef struct wl_iscan_params {
909 	uint32 version;
910 	uint16 action;
911 	uint16 scan_duration;
912 	wl_scan_params_t params;
913 } wl_iscan_params_t;
914 
915 /** 3 fields + size of wl_scan_params, not including variable length array */
916 #define WL_ISCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_iscan_params_t, params) + sizeof(wlc_ssid_t))
917 
918 typedef struct wl_scan_results {
919 	uint32 buflen;
920 	uint32 version;
921 	uint32 count;
922 	wl_bss_info_v109_t bss_info[1];
923 } wl_scan_results_v109_t;
924 
925 typedef struct wl_scan_results_v2 {
926 	uint32 buflen;
927 	uint32 version;
928 	uint32 count;
929 	uint8 bss_info[];	/* var length wl_bss_info_X structures */
930 } wl_scan_results_v2_t;
931 
932 #ifndef WL_BSS_INFO_TYPEDEF_HAS_ALIAS
933 typedef wl_scan_results_v109_t wl_scan_results_t;
934 /** size of wl_scan_results not including variable length array */
935 #define WL_SCAN_RESULTS_FIXED_SIZE (sizeof(wl_scan_results_t) - sizeof(wl_bss_info_t))
936 #endif // endif
937 
938 #if defined(SIMPLE_ISCAN)
939 /** the buf lengh can be WLC_IOCTL_MAXLEN (8K) to reduce iteration */
940 #define WLC_IW_ISCAN_MAXLEN   2048
941 typedef struct iscan_buf {
942 	struct iscan_buf * next;
943 	int8   iscan_buf[WLC_IW_ISCAN_MAXLEN];
944 } iscan_buf_t;
945 #endif /* SIMPLE_ISCAN */
946 #define ESCAN_REQ_VERSION 1
947 #define ESCAN_REQ_VERSION_V2 2
948 
949 /** event scan reduces amount of SOC memory needed to store scan results */
950 typedef struct wl_escan_params {
951 	uint32 version;
952 	uint16 action;
953 	uint16 sync_id;
954 	wl_scan_params_t params;
955 } wl_escan_params_t;
956 
957 typedef struct wl_escan_params_v2 {
958 	uint32 version;
959 	uint16 action;
960 	uint16 sync_id;
961 	wl_scan_params_v2_t params;
962 } wl_escan_params_v2_t;
963 
964 #define WL_ESCAN_PARAMS_FIXED_SIZE (OFFSETOF(wl_escan_params_t, params) + sizeof(wlc_ssid_t))
965 #define WL_ESCAN_PARAMS_V2_FIXED_SIZE (OFFSETOF(wl_escan_params_v2_t, params) + sizeof(wlc_ssid_t))
966 
967 /** event scan reduces amount of SOC memory needed to store scan results */
968 typedef struct wl_escan_result {
969 	uint32 buflen;
970 	uint32 version;
971 	uint16 sync_id;
972 	uint16 bss_count;
973 	wl_bss_info_v109_t bss_info[1];
974 } wl_escan_result_v109_t;
975 
976 /** event scan reduces amount of SOC memory needed to store scan results */
977 typedef struct wl_escan_result_v2 {
978 	uint32 buflen;
979 	uint32 version;
980 	uint16 sync_id;
981 	uint16 bss_count;
982 	uint8 bss_info[];	/* var length wl_bss_info_X structures */
983 } wl_escan_result_v2_t;
984 
985 #ifndef WL_BSS_INFO_TYPEDEF_HAS_ALIAS
986 typedef wl_escan_result_v109_t wl_escan_result_t;
987 #define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(wl_escan_result_t) - sizeof(wl_bss_info_t))
988 #endif // endif
989 
990 typedef struct wl_gscan_result {
991 	uint32 buflen;
992 	uint32 version;
993 	uint32 scan_ch_bucket;
994 	wl_gscan_bss_info_v2_t bss_info[1];
995 } wl_gscan_result_v2_t;
996 
997 typedef struct wl_gscan_result_v2_1 {
998 	uint32 buflen;
999 	uint32 version;
1000 	uint32 scan_ch_bucket;
1001 	uint8 bss_info[];	/* var length wl_bss_info_X structures */
1002 } wl_gscan_result_v2_1_t;
1003 
1004 #ifndef WL_BSS_INFO_TYPEDEF_HAS_ALIAS
1005 typedef wl_gscan_result_v2_t wl_gscan_result_t;
1006 #define WL_GSCAN_RESULTS_FIXED_SIZE (sizeof(wl_gscan_result_t) - sizeof(wl_gscan_bss_info_t))
1007 #endif // endif
1008 
1009 /** incremental scan results struct */
1010 typedef struct wl_iscan_results {
1011 	uint32 status;
1012 	wl_scan_results_v109_t results;
1013 } wl_iscan_results_v109_t;
1014 
1015 /** incremental scan results struct */
1016 typedef struct wl_iscan_results_v2 {
1017 	uint32 status;
1018 	wl_scan_results_v2_t results;
1019 } wl_iscan_results_v2_t;
1020 
1021 #ifndef WL_BSS_INFO_TYPEDEF_HAS_ALIAS
1022 typedef wl_iscan_results_v109_t wl_iscan_results_t;
1023 /** size of wl_iscan_results not including variable length array */
1024 #define WL_ISCAN_RESULTS_FIXED_SIZE \
1025 	(WL_SCAN_RESULTS_FIXED_SIZE + OFFSETOF(wl_iscan_results_t, results))
1026 #endif // endif
1027 
1028 typedef struct wl_probe_params {
1029 	wlc_ssid_t ssid;
1030 	struct ether_addr bssid;
1031 	struct ether_addr mac;
1032 } wl_probe_params_t;
1033 
1034 #define WL_MAXRATES_IN_SET		16	/**< max # of rates in a rateset */
1035 
1036 typedef struct wl_rateset {
1037 	uint32	count;				/**< # rates in this set */
1038 	uint8	rates[WL_MAXRATES_IN_SET];	/**< rates in 500kbps units w/hi bit set if basic */
1039 } wl_rateset_t;
1040 
1041 #define WL_VHT_CAP_MCS_MAP_NSS_MAX	8
1042 
1043 typedef struct wl_rateset_args_v1 {
1044 	uint32	count;				/**< # rates in this set */
1045 	uint8	rates[WL_MAXRATES_IN_SET];	/**< rates in 500kbps units w/hi bit set if basic */
1046 	uint8   mcs[MCSSET_LEN];	/**< supported mcs index bit map */
1047 	uint16 vht_mcs[WL_VHT_CAP_MCS_MAP_NSS_MAX]; /**< supported mcs index bit map per nss */
1048 } wl_rateset_args_v1_t;
1049 
1050 #define RATESET_ARGS_V1		(1)
1051 #define RATESET_ARGS_V2		(2)
1052 
1053 #ifndef RATESET_VERSION_ENABLED
1054 /* rateset structure before versioning. legacy. DONOT update anymore here */
1055 #define RATESET_ARGS_VERSION	(RATESET_ARGS_V1)
1056 typedef wl_rateset_args_v1_t wl_rateset_args_t;
1057 #endif /* RATESET_VERSION_ENABLED */
1058 
1059 /* Note: dependent structures: sta_info_vX_t. When any update to this structure happens,
1060  *	update sta_info_vX_t also.
1061  */
1062 #define WL_HE_CAP_MCS_MAP_NSS_MAX	8
1063 
1064 typedef struct wl_rateset_args_v2 {
1065 	uint16 version;		/**< version. */
1066 	uint16 len;		/**< length */
1067 	uint32	count;		/**< # rates in this set */
1068 	uint8	rates[WL_MAXRATES_IN_SET];	/**< rates in 500kbps units w/hi bit set if basic */
1069 	uint8   mcs[MCSSET_LEN];		/**< supported mcs index bit map */
1070 	uint16 vht_mcs[WL_VHT_CAP_MCS_MAP_NSS_MAX]; /**< supported mcs index bit map per nss */
1071 	uint16 he_mcs[WL_HE_CAP_MCS_MAP_NSS_MAX]; /**< supported he mcs index bit map per nss */
1072 } wl_rateset_args_v2_t;
1073 
1074 /* HE Rates BITMAP */
1075 #define WL_HE_CAP_MCS_0_7_MAP		0x00ff
1076 #define WL_HE_CAP_MCS_0_8_MAP		0x01ff
1077 #define WL_HE_CAP_MCS_0_9_MAP		0x03ff
1078 #define WL_HE_CAP_MCS_0_10_MAP		0x07ff
1079 #define WL_HE_CAP_MCS_0_11_MAP		0x0fff
1080 
1081 #define TXBF_RATE_MCS_ALL		4
1082 #define TXBF_RATE_VHT_ALL		4
1083 #define TXBF_RATE_OFDM_ALL		8
1084 
1085 typedef struct wl_txbf_rateset {
1086 	uint8	txbf_rate_mcs[TXBF_RATE_MCS_ALL];	/**< one for each stream */
1087 	uint8	txbf_rate_mcs_bcm[TXBF_RATE_MCS_ALL];	/**< one for each stream */
1088 	uint16	txbf_rate_vht[TXBF_RATE_VHT_ALL];	/**< one for each stream */
1089 	uint16	txbf_rate_vht_bcm[TXBF_RATE_VHT_ALL];	/**< one for each stream */
1090 	uint8	txbf_rate_ofdm[TXBF_RATE_OFDM_ALL]; /**< bitmap of ofdm rates that enables txbf */
1091 	uint8	txbf_rate_ofdm_bcm[TXBF_RATE_OFDM_ALL]; /* bitmap of ofdm rates that enables txbf */
1092 	uint8	txbf_rate_ofdm_cnt;
1093 	uint8	txbf_rate_ofdm_cnt_bcm;
1094 } wl_txbf_rateset_t;
1095 
1096 #define NUM_BFGAIN_ARRAY_1RX	2
1097 #define NUM_BFGAIN_ARRAY_2RX	3
1098 #define NUM_BFGAIN_ARRAY_3RX	4
1099 #define NUM_BFGAIN_ARRAY_4RX	5
1100 
1101 typedef struct wl_txbf_expgainset {
1102 	/* bitmap for each element: B[4:0]=>c0, B[9:5]=>c1, B[14:10]=>c2, B[19:15]=>c[3-7]
1103 	 * B[24:20]=>c[8-9], B[29:25]=>c[10-11]
1104 	 */
1105 	uint32	bfgain_2x1[NUM_BFGAIN_ARRAY_1RX]; /* exp     1ss, imp 1ss */
1106 	uint32	bfgain_2x2[NUM_BFGAIN_ARRAY_2RX]; /* exp [1-2]ss, imp 1ss */
1107 	uint32	bfgain_3x1[NUM_BFGAIN_ARRAY_1RX];
1108 	uint32	bfgain_3x2[NUM_BFGAIN_ARRAY_2RX];
1109 	uint32	bfgain_3x3[NUM_BFGAIN_ARRAY_3RX]; /* exp [1-3]ss, imp 1ss */
1110 	uint32	bfgain_4x1[NUM_BFGAIN_ARRAY_1RX];
1111 	uint32	bfgain_4x2[NUM_BFGAIN_ARRAY_2RX];
1112 	uint32	bfgain_4x3[NUM_BFGAIN_ARRAY_3RX];
1113 	uint32	bfgain_4x4[NUM_BFGAIN_ARRAY_4RX]; /* exp [1-4]ss, imp 1ss */
1114 } wl_txbf_expgainset_t;
1115 
1116 #define OFDM_RATE_MASK			0x0000007f
1117 typedef uint8 ofdm_rates_t;
1118 
1119 typedef struct wl_rates_info {
1120 	wl_rateset_t rs_tgt;
1121 	uint32 phy_type;
1122 	int32 bandtype;
1123 	uint8 cck_only;
1124 	uint8 rate_mask;
1125 	uint8 mcsallow;
1126 	uint8 bw;
1127 	uint8 txstreams;
1128 	uint8 PAD[3];
1129 } wl_rates_info_t;
1130 
1131 /**uint32 list */
1132 typedef struct wl_uint32_list {
1133 	/** in - # of elements, out - # of entries */
1134 	uint32 count;
1135 	/** variable length uint32 list */
1136 	uint32 element[1];
1137 } wl_uint32_list_t;
1138 
1139 /* WLC_SET_ALLOW_MODE values */
1140 #define ALLOW_MODE_ANY_BSSID		0
1141 #define ALLOW_MODE_ONLY_DESIRED_BSSID	1
1142 #define ALLOW_MODE_NO_BSSID		2
1143 
1144 /** used for association with a specific BSSID and chanspec list */
1145 typedef struct wl_assoc_params {
1146 	struct ether_addr bssid;	/**< 00:00:00:00:00:00: broadcast scan */
1147 	uint16 bssid_cnt;		/**< 0: use chanspec_num, and the single bssid,
1148 					* otherwise count of chanspecs in chanspec_list
1149 					* AND paired bssids following chanspec_list
1150 					* also, chanspec_num has to be set to zero
1151 					* for bssid list to be used
1152 					*/
1153 	int32 chanspec_num;		/**< 0: all available channels,
1154 					* otherwise count of chanspecs in chanspec_list
1155 					*/
1156 	chanspec_t chanspec_list[1];	/**< list of chanspecs */
1157 } wl_assoc_params_t;
1158 
1159 #define WL_ASSOC_PARAMS_FIXED_SIZE 	OFFSETOF(wl_assoc_params_t, chanspec_list)
1160 
1161 /** used for reassociation/roam to a specific BSSID and channel */
1162 typedef wl_assoc_params_t wl_reassoc_params_t;
1163 #define WL_REASSOC_PARAMS_FIXED_SIZE	WL_ASSOC_PARAMS_FIXED_SIZE
1164 
1165 /** used for association to a specific BSSID and channel */
1166 typedef wl_assoc_params_t wl_join_assoc_params_t;
1167 #define WL_JOIN_ASSOC_PARAMS_FIXED_SIZE	WL_ASSOC_PARAMS_FIXED_SIZE
1168 
1169 /** used for join with or without a specific bssid and channel list */
1170 typedef struct wl_join_params {
1171 	wlc_ssid_t ssid;
1172 	wl_assoc_params_t params;	/**< optional field, but it must include the fixed portion
1173 					 * of the wl_assoc_params_t struct when it does present.
1174 					 */
1175 } wl_join_params_t;
1176 
1177 #define WL_JOIN_PARAMS_FIXED_SIZE 	(OFFSETOF(wl_join_params_t, params) + \
1178 					 WL_ASSOC_PARAMS_FIXED_SIZE)
1179 
1180 typedef struct wlc_roam_exp_params {
1181 	int8 a_band_boost_threshold;
1182 	int8 a_band_penalty_threshold;
1183 	int8 a_band_boost_factor;
1184 	int8 a_band_penalty_factor;
1185 	int8 cur_bssid_boost;
1186 	int8 alert_roam_trigger_threshold;
1187 	int16 a_band_max_boost;
1188 } wlc_roam_exp_params_t;
1189 
1190 #define ROAM_EXP_CFG_VERSION     1
1191 
1192 #define ROAM_EXP_ENABLE_FLAG             (1 << 0)
1193 
1194 #define ROAM_EXP_CFG_PRESENT             (1 << 1)
1195 
1196 typedef struct wl_roam_exp_cfg {
1197 	uint16 version;
1198 	uint16 flags;
1199 	wlc_roam_exp_params_t params;
1200 } wl_roam_exp_cfg_t;
1201 
1202 typedef struct wl_bssid_pref_list {
1203 	struct ether_addr bssid;
1204 	/* Add this to modify rssi */
1205 	int8 rssi_factor;
1206 	int8 flags;
1207 } wl_bssid_pref_list_t;
1208 
1209 #define BSSID_PREF_LIST_VERSION        1
1210 #define ROAM_EXP_CLEAR_BSSID_PREF        (1 << 0)
1211 
1212 typedef struct wl_bssid_pref_cfg {
1213 	uint16 version;
1214 	uint16 flags;
1215 	uint16 count;
1216 	uint16 reserved;
1217 	wl_bssid_pref_list_t bssids[];
1218 } wl_bssid_pref_cfg_t;
1219 
1220 #define SSID_WHITELIST_VERSION         1
1221 
1222 #define ROAM_EXP_CLEAR_SSID_WHITELIST    (1 << 0)
1223 
1224 /* Roam SSID whitelist, ssids in this list are ok to  */
1225 /* be considered as targets to join when considering a roam */
1226 
1227 typedef struct wl_ssid_whitelist {
1228 
1229 	uint16 version;
1230 	uint16 flags;
1231 
1232 	uint8 ssid_count;
1233 	uint8 reserved[3];
1234 	wlc_ssid_t ssids[];
1235 } wl_ssid_whitelist_t;
1236 
1237 #define ROAM_EXP_EVENT_VERSION       1
1238 
1239 typedef struct wl_roam_exp_event {
1240 
1241 	uint16 version;
1242 	uint16 flags;
1243 	wlc_ssid_t cur_ssid;
1244 } wl_roam_exp_event_t;
1245 
1246 /** scan params for extended join */
1247 typedef struct wl_join_scan_params {
1248 	uint8 scan_type;		/**< 0 use default, active or passive scan */
1249 	uint8 PAD[3];
1250 	int32 nprobes;			/**< -1 use default, number of probes per channel */
1251 	int32 active_time;		/**< -1 use default, dwell time per channel for
1252 					 * active scanning
1253 					 */
1254 	int32 passive_time;		/**< -1 use default, dwell time per channel
1255 					 * for passive scanning
1256 					 */
1257 	int32 home_time;		/**< -1 use default, dwell time for the home channel
1258 					 * between channel scans
1259 					 */
1260 } wl_join_scan_params_t;
1261 
1262 /** extended join params */
1263 typedef struct wl_extjoin_params {
1264 	wlc_ssid_t ssid;		/**< {0, ""}: wildcard scan */
1265 	wl_join_scan_params_t scan;
1266 	wl_join_assoc_params_t assoc;	/**< optional field, but it must include the fixed portion
1267 					 * of the wl_join_assoc_params_t struct when it does
1268 					 * present.
1269 					 */
1270 } wl_extjoin_params_t;
1271 #define WL_EXTJOIN_PARAMS_FIXED_SIZE 	(OFFSETOF(wl_extjoin_params_t, assoc) + \
1272 					 WL_JOIN_ASSOC_PARAMS_FIXED_SIZE)
1273 
1274 #define ANT_SELCFG_MAX		4	/**< max number of antenna configurations */
1275 #define MAX_STREAMS_SUPPORTED	4	/**< max number of streams supported */
1276 typedef struct {
1277 	uint8 ant_config[ANT_SELCFG_MAX];	/**< antenna configuration */
1278 	uint8 num_antcfg;			/**< number of available antenna configurations */
1279 } wlc_antselcfg_t;
1280 
1281 typedef struct {
1282 	uint32 duration;	/**< millisecs spent sampling this channel */
1283 	uint32 congest_ibss;	/**< millisecs in our bss (presumably this traffic will */
1284 				/**<  move if cur bss moves channels) */
1285 	uint32 congest_obss;	/**< traffic not in our bss */
1286 	uint32 interference;	/**< millisecs detecting a non 802.11 interferer. */
1287 	uint32 timestamp;	/**< second timestamp */
1288 } cca_congest_t;
1289 
1290 typedef struct {
1291 	chanspec_t chanspec;	/**< Which channel? */
1292 	uint16 num_secs;	/**< How many secs worth of data */
1293 	cca_congest_t  secs[1];	/**< Data */
1294 } cca_congest_channel_req_t;
1295 typedef struct {
1296 	uint32 duration;	/**< millisecs spent sampling this channel */
1297 	uint32 congest;		/**< millisecs detecting busy CCA */
1298 	uint32 timestamp;	/**< second timestamp */
1299 } cca_congest_simple_t;
1300 
1301 typedef struct {
1302 	uint16 status;
1303 	uint16 id;
1304 	chanspec_t chanspec;			/**< Which channel? */
1305 	uint16 len;
1306 	union {
1307 		cca_congest_simple_t  cca_busy;	/**< CCA busy */
1308 		cca_congest_t cca_busy_ext;	/**< Extended CCA report */
1309 		int32 noise;			/**< noise floor */
1310 	};
1311 } cca_chan_qual_event_t;
1312 
1313 typedef struct {
1314 	uint16 status;
1315 	uint16 id;
1316 	chanspec_t chanspec;                            /**< Which channel? */
1317 	uint16 len;
1318 	union {
1319 		cca_congest_simple_t  cca_busy;         /**< CCA busy */
1320 		struct {
1321 			cca_congest_t cca_busy_ext;     /**< Extended CCA report */
1322 			cca_congest_t cca_busy_nopm;    /**< Extedned CCA report (PM awake time) */
1323 			cca_congest_t cca_busy_pm;      /**< Extedned CCA report (PM sleep time) */
1324 		};
1325 	};
1326 } cca_only_chan_qual_event_t;
1327 
1328 typedef struct {
1329 	uint32 msrmnt_time;	/**< Time for Measurement (msec) */
1330 	uint32 msrmnt_done;	/**< flag set when measurement complete */
1331 	char buf[];
1332 } cca_stats_n_flags;
1333 
1334 typedef struct {
1335 	uint32 msrmnt_query;    /* host to driver query for measurement done */
1336 	uint32 time_req;        /* time required for measurement */
1337 	uint8 report_opt;       /* option to print different stats in report */
1338 	uint8 PAD[3];
1339 } cca_msrmnt_query;
1340 
1341 /* interference sources */
1342 enum interference_source {
1343 	ITFR_NONE = 0,			/**< interference */
1344 	ITFR_PHONE,			/**< wireless phone */
1345 	ITFR_VIDEO_CAMERA,		/**< wireless video camera */
1346 	ITFR_MICROWAVE_OVEN,		/**< microwave oven */
1347 	ITFR_BABY_MONITOR,		/**< wireless baby monitor */
1348 	ITFR_BLUETOOTH,			/**< bluetooth */
1349 	ITFR_VIDEO_CAMERA_OR_BABY_MONITOR,	/**< wireless camera or baby monitor */
1350 	ITFR_BLUETOOTH_OR_BABY_MONITOR,	/**< bluetooth or baby monitor */
1351 	ITFR_VIDEO_CAMERA_OR_PHONE,	/**< video camera or phone */
1352 	ITFR_UNIDENTIFIED		/**< interference from unidentified source */
1353 };
1354 
1355 /** structure for interference source report */
1356 typedef struct {
1357 	uint32 flags;		/**< flags.  bit definitions below */
1358 	uint32 source;		/**< last detected interference source */
1359 	uint32 timestamp;	/**< second timestamp on interferenced flag change */
1360 } interference_source_rep_t;
1361 
1362 #define WLC_CNTRY_BUF_SZ	4		/**< Country string is 3 bytes + NUL */
1363 
1364 typedef struct wl_country {
1365 	char country_abbrev[WLC_CNTRY_BUF_SZ];	/**< nul-terminated country code used in
1366 						 * the Country IE
1367 						 */
1368 	int32 rev;				/**< revision specifier for ccode
1369 						 * on set, -1 indicates unspecified.
1370 						 * on get, rev >= 0
1371 						 */
1372 	char ccode[WLC_CNTRY_BUF_SZ];		/**< nul-terminated built-in country code.
1373 						 * variable length, but fixed size in
1374 						 * struct allows simple allocation for
1375 						 * expected country strings <= 3 chars.
1376 						 */
1377 } wl_country_t;
1378 
1379 #define CCODE_INFO_VERSION 1
1380 
1381 typedef enum wl_ccode_role {
1382 	WLC_CCODE_ROLE_ACTIVE = 0,
1383 	WLC_CCODE_ROLE_HOST,
1384 	WLC_CCODE_ROLE_80211D_ASSOC,
1385 	WLC_CCODE_ROLE_80211D_SCAN,
1386 	WLC_CCODE_ROLE_DEFAULT,
1387 	WLC_CCODE_ROLE_DEFAULT_SROM_BKUP,
1388 	WLC_CCODE_LAST
1389 } wl_ccode_role_t;
1390 #define WLC_NUM_CCODE_INFO WLC_CCODE_LAST
1391 
1392 typedef struct wl_ccode_entry {
1393 	uint16 reserved;
1394 	uint8 band;
1395 	uint8 role;
1396 	char	ccode[WLC_CNTRY_BUF_SZ];
1397 } wl_ccode_entry_t;
1398 
1399 typedef struct wl_ccode_info {
1400 	uint16 version;
1401 	uint16 count;   /**< Number of ccodes entries in the set */
1402 	wl_ccode_entry_t ccodelist[1];
1403 } wl_ccode_info_t;
1404 #define WL_CCODE_INFO_FIXED_LEN	OFFSETOF(wl_ccode_info_t, ccodelist)
1405 typedef struct wl_channels_in_country {
1406 	uint32 buflen;
1407 	uint32 band;
1408 	char country_abbrev[WLC_CNTRY_BUF_SZ];
1409 	uint32 count;
1410 	uint32 channel[1];
1411 } wl_channels_in_country_t;
1412 
1413 typedef struct wl_country_list {
1414 	uint32 buflen;
1415 	uint32 band_set;
1416 	uint32 band;
1417 	uint32 count;
1418 	char country_abbrev[1];
1419 } wl_country_list_t;
1420 
1421 typedef struct wl_rm_req_elt {
1422 	int8	type;
1423 	int8	flags;
1424 	chanspec_t	chanspec;
1425 	uint32	token;		/**< token for this measurement */
1426 	uint32	tsf_h;		/**< TSF high 32-bits of Measurement start time */
1427 	uint32	tsf_l;		/**< TSF low 32-bits */
1428 	uint32	dur;		/**< TUs */
1429 } wl_rm_req_elt_t;
1430 
1431 typedef struct wl_rm_req {
1432 	uint32	token;		/**< overall measurement set token */
1433 	uint32	count;		/**< number of measurement requests */
1434 	void	*cb;		/**< completion callback function: may be NULL */
1435 	void	*cb_arg;	/**< arg to completion callback function */
1436 	wl_rm_req_elt_t	req[1];	/**< variable length block of requests */
1437 } wl_rm_req_t;
1438 #define WL_RM_REQ_FIXED_LEN	OFFSETOF(wl_rm_req_t, req)
1439 
1440 typedef struct wl_rm_rep_elt {
1441 	int8	type;
1442 	int8	flags;
1443 	chanspec_t	chanspec;
1444 	uint32	token;		/**< token for this measurement */
1445 	uint32	tsf_h;		/**< TSF high 32-bits of Measurement start time */
1446 	uint32	tsf_l;		/**< TSF low 32-bits */
1447 	uint32	dur;		/**< TUs */
1448 	uint32	len;		/**< byte length of data block */
1449 	uint8	data[1];	/**< variable length data block */
1450 } wl_rm_rep_elt_t;
1451 #define WL_RM_REP_ELT_FIXED_LEN	24	/**< length excluding data block */
1452 
1453 #define WL_RPI_REP_BIN_NUM 8
1454 typedef struct wl_rm_rpi_rep {
1455 	uint8	rpi[WL_RPI_REP_BIN_NUM];
1456 	int8	rpi_max[WL_RPI_REP_BIN_NUM];
1457 } wl_rm_rpi_rep_t;
1458 
1459 typedef struct wl_rm_rep {
1460 	uint32	token;		/**< overall measurement set token */
1461 	uint32	len;		/**< length of measurement report block */
1462 	wl_rm_rep_elt_t	rep[1];	/**< variable length block of reports */
1463 } wl_rm_rep_t;
1464 #define WL_RM_REP_FIXED_LEN	8
1465 #ifdef BCMCCX
1466 
1467 #define LEAP_USER_MAX		32
1468 #define LEAP_DOMAIN_MAX		32
1469 #define LEAP_PASSWORD_MAX	32
1470 
1471 typedef struct wl_leap_info {
1472 	wlc_ssid_t ssid;
1473 	uint8 user_len;
1474 	uint8 user[LEAP_USER_MAX];
1475 	uint8 password_len;
1476 	uint8 password[LEAP_PASSWORD_MAX];
1477 	uint8 domain_len;
1478 	uint8 domain[LEAP_DOMAIN_MAX];
1479 	uint8 PAD;
1480 } wl_leap_info_t;
1481 
1482 typedef struct wl_leap_list {
1483 	uint32 buflen;
1484 	uint32 version;
1485 	uint32 count;
1486 	wl_leap_info_t leap_info[1];
1487 } wl_leap_list_t;
1488 #endif	/* BCMCCX */
1489 typedef enum sup_auth_status {
1490 	/* Basic supplicant authentication states */
1491 	WLC_SUP_DISCONNECTED = 0,
1492 	WLC_SUP_CONNECTING,
1493 	WLC_SUP_IDREQUIRED,
1494 	WLC_SUP_AUTHENTICATING,
1495 	WLC_SUP_AUTHENTICATED,
1496 	WLC_SUP_KEYXCHANGE,
1497 	WLC_SUP_KEYED,
1498 	WLC_SUP_TIMEOUT,
1499 	WLC_SUP_LAST_BASIC_STATE,
1500 
1501 	/* Extended supplicant authentication states */
1502 	/** Waiting to receive handshake msg M1 */
1503 	WLC_SUP_KEYXCHANGE_WAIT_M1 = WLC_SUP_AUTHENTICATED,
1504 	/** Preparing to send handshake msg M2 */
1505 	WLC_SUP_KEYXCHANGE_PREP_M2 = WLC_SUP_KEYXCHANGE,
1506 	/* Waiting to receive handshake msg M3 */
1507 	WLC_SUP_KEYXCHANGE_WAIT_M3 = WLC_SUP_LAST_BASIC_STATE,
1508 	WLC_SUP_KEYXCHANGE_PREP_M4,	/**< Preparing to send handshake msg M4 */
1509 	WLC_SUP_KEYXCHANGE_WAIT_G1,	/**< Waiting to receive handshake msg G1 */
1510 	WLC_SUP_KEYXCHANGE_PREP_G2	/**< Preparing to send handshake msg G2 */
1511 } sup_auth_status_t;
1512 
1513 typedef struct wl_wsec_key {
1514 	uint32		index;		/**< key index */
1515 	uint32		len;		/**< key length */
1516 	uint8		data[DOT11_MAX_KEY_SIZE];	/**< key data */
1517 	uint32		pad_1[18];
1518 	uint32		algo;		/**< CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
1519 	uint32		flags;		/**< misc flags */
1520 	uint32		pad_2[2];
1521 	int32		pad_3;
1522 	int32		iv_initialized;	/**< has IV been initialized already? */
1523 	int32		pad_4;
1524 	/* Rx IV */
1525 	struct {
1526 		uint32	hi;		/**< upper 32 bits of IV */
1527 		uint16	lo;		/**< lower 16 bits of IV */
1528 		uint16	PAD;
1529 	} rxiv;
1530 	uint32		pad_5[2];
1531 	struct ether_addr ea;		/**< per station */
1532 	uint16	PAD;
1533 } wl_wsec_key_t;
1534 
1535 #define WSEC_MIN_PSK_LEN	8
1536 #define WSEC_MAX_PSK_LEN	64
1537 
1538 /** Flag for key material needing passhash'ing */
1539 #define WSEC_PASSPHRASE		(1<<0)
1540 
1541 /**receptacle for WLC_SET_WSEC_PMK parameter */
1542 typedef struct wsec_pmk {
1543 	ushort	key_len;		/**< octets in key material */
1544 	ushort	flags;			/**< key handling qualification */
1545 	uint8	key[WSEC_MAX_PSK_LEN];	/**< PMK material */
1546 } wsec_pmk_t;
1547 
1548 #define WL_AUTH_EVENT_DATA_V1		0x1
1549 
1550 /* tlv ids for auth event */
1551 #define WL_AUTH_PMK_TLV_ID	1
1552 #define WL_AUTH_PMKID_TLV_ID	2
1553 /* AUTH event data
1554 * pmk and pmkid in case of SAE auth
1555 * xtlvs will be 32 bit alligned
1556 */
1557 typedef struct wl_auth_event {
1558 	uint16 version;
1559 	uint16 length;
1560 	uint8 xtlvs[];
1561 } wl_auth_event_t;
1562 
1563 #define WL_AUTH_EVENT_FIXED_LEN_V1	OFFSETOF(wl_auth_event_t, xtlvs)
1564 
1565 #define FILS_CACHE_ID_LEN	2
1566 #define PMK_LEN_MAX	48
1567 
1568 typedef struct _pmkid_v1 {
1569 	struct ether_addr	BSSID;
1570 	uint8				PMKID[WPA2_PMKID_LEN];
1571 } pmkid_v1_t;
1572 
1573 #define PMKID_ELEM_V2_LENGTH (sizeof(struct ether_addr) + WPA2_PMKID_LEN + PMK_LEN_MAX + \
1574 	sizeof(ssid_info_t) + FILS_CACHE_ID_LEN)
1575 
1576 typedef struct _pmkid_v2 {
1577 	uint16				length; /* Should match PMKID_ELEM_VX_LENGTH */
1578 	struct ether_addr	BSSID;
1579 	uint8				PMKID[WPA2_PMKID_LEN];
1580 	uint8				pmk[PMK_LEN_MAX]; /* for FILS key deriviation */
1581 	uint16				pmk_len;
1582 	ssid_info_t			ssid;
1583 	uint8				fils_cache_id[FILS_CACHE_ID_LEN];
1584 } pmkid_v2_t;
1585 
1586 typedef struct _pmkid_v3 {
1587 	struct ether_addr       bssid;
1588 	uint8                   pmkid[WPA2_PMKID_LEN];
1589 	uint8                   pmkid_len;
1590 	uint8                   pmk[PMK_LEN_MAX];
1591 	uint8                   pmk_len;
1592 	uint16                  fils_cache_id; /* 2-byte length */
1593 	uint8                   pad;
1594 	uint8                   ssid_len;
1595 	uint8                   ssid[DOT11_MAX_SSID_LEN]; /* For FILS, to save ESSID */
1596 							/* one pmkid used in whole ESS */
1597 	uint32                  time_left; /* remaining time until expirary in sec. */
1598 					/* 0 means expired, all 0xFF means never expire */
1599 } pmkid_v3_t;
1600 
1601 #define PMKID_LIST_VER_2	2
1602 #define PMKID_LIST_VER_3        3
1603 
1604 typedef struct _pmkid_list_v1 {
1605 	uint32	npmkid;
1606 	pmkid_v1_t	pmkid[1];
1607 } pmkid_list_v1_t;
1608 
1609 typedef struct _pmkid_list_v2 {
1610 	uint16  version;
1611 	uint16	length;
1612 	pmkid_v2_t	pmkid[1];
1613 } pmkid_list_v2_t;
1614 
1615 typedef struct _pmkid_list_v3 {
1616 	uint16          version;
1617 	uint16          length;
1618 	uint16          count;
1619 	uint16          pad;
1620 	pmkid_v3_t      pmkid[];
1621 } pmkid_list_v3_t;
1622 
1623 #ifndef PMKID_VERSION_ENABLED
1624 /* pmkid structure before versioning. legacy. DONOT update anymore here */
1625 typedef pmkid_v1_t pmkid_t;
1626 typedef pmkid_list_v1_t pmkid_list_t;
1627 #endif /* PMKID_VERSION_ENABLED */
1628 
1629 typedef struct _pmkid_cand {
1630 	struct ether_addr	BSSID;
1631 	uint8			preauth;
1632 } pmkid_cand_t;
1633 
1634 typedef struct _pmkid_cand_list {
1635 	uint32	npmkid_cand;
1636 	pmkid_cand_t	pmkid_cand[1];
1637 } pmkid_cand_list_t;
1638 
1639 #define WL_STA_ANT_MAX		4	/**< max possible rx antennas */
1640 
1641 typedef struct wl_assoc_info {
1642 	uint32		req_len;
1643 	uint32		resp_len;
1644 	uint32		flags;
1645 	struct dot11_assoc_req req;
1646 	struct ether_addr reassoc_bssid; /**< used in reassoc's */
1647 	struct dot11_assoc_resp resp;
1648 	uint32		state;
1649 } wl_assoc_info_t;
1650 
1651 typedef struct wl_led_info {
1652 	uint32      index;      /**< led index */
1653 	uint32      behavior;
1654 	uint8       activehi;
1655 	uint8       PAD[3];
1656 } wl_led_info_t;
1657 
1658 /** srom read/write struct passed through ioctl */
1659 typedef struct {
1660 	uint32	byteoff;	/**< byte offset */
1661 	uint32	nbytes;		/**< number of bytes */
1662 	uint16	buf[];
1663 } srom_rw_t;
1664 
1665 #define CISH_FLAG_PCIECIS	(1 << 15)	/**< write CIS format bit for PCIe CIS */
1666 
1667 /** similar cis (srom or otp) struct [iovar: may not be aligned] */
1668 typedef struct {
1669 	uint16	source;		/**< cis source */
1670 	uint16	flags;		/**< flags */
1671 	uint32	byteoff;	/**< byte offset */
1672 	uint32	nbytes;		/**< number of bytes */
1673 	/* data follows here */
1674 } cis_rw_t;
1675 
1676 /** R_REG and W_REG struct passed through ioctl */
1677 typedef struct {
1678 	uint32	byteoff;	/**< byte offset of the field in d11regs_t */
1679 	uint32	val;		/**< read/write value of the field */
1680 	uint32	size;		/**< sizeof the field */
1681 	uint32	band;		/**< band (optional) */
1682 } rw_reg_t;
1683 
1684 /**
1685  * Structure used by GET/SET_ATTEN ioctls - it controls power in b/g-band
1686  * PCL - Power Control Loop
1687  */
1688 typedef struct {
1689 	uint16	auto_ctrl;	/**< WL_ATTEN_XX */
1690 	uint16	bb;		/**< Baseband attenuation */
1691 	uint16	radio;		/**< Radio attenuation */
1692 	uint16	txctl1;		/**< Radio TX_CTL1 value */
1693 } atten_t;
1694 
1695 /** Per-AC retry parameters */
1696 struct wme_tx_params_s {
1697 	uint8  short_retry;
1698 	uint8  short_fallback;
1699 	uint8  long_retry;
1700 	uint8  long_fallback;
1701 	uint16 max_rate;  /**< In units of 512 Kbps */
1702 };
1703 
1704 typedef struct wme_tx_params_s wme_tx_params_t;
1705 
1706 #define WL_WME_TX_PARAMS_IO_BYTES (sizeof(wme_tx_params_t) * AC_COUNT)
1707 
1708 /**Used to get specific link/ac parameters */
1709 typedef struct {
1710 	int32 ac;
1711 	uint8 val;
1712 	struct ether_addr ea;
1713 	uint8 PAD;
1714 } link_val_t;
1715 
1716 #define WL_PM_MUTE_TX_VER 1
1717 
1718 typedef struct wl_pm_mute_tx {
1719 	uint16 version;		/**< version */
1720 	uint16 len;		/**< length */
1721 	uint16 deadline;	/**< deadline timer (in milliseconds) */
1722 	uint8  enable;		/**< set to 1 to enable mode; set to 0 to disable it */
1723 	uint8 PAD;
1724 } wl_pm_mute_tx_t;
1725 
1726 /* sta_info_t version 4 */
1727 typedef struct {
1728 	uint16			ver;		/**< version of this struct */
1729 	uint16			len;		/**< length in bytes of this structure */
1730 	uint16			cap;		/**< sta's advertised capabilities */
1731 	uint16			PAD;
1732 	uint32			flags;		/**< flags defined below */
1733 	uint32			idle;		/**< time since data pkt rx'd from sta */
1734 	struct ether_addr	ea;		/**< Station address */
1735 	uint16			PAD;
1736 	wl_rateset_t	rateset;	/**< rateset in use */
1737 	uint32			in;		/**< seconds elapsed since associated */
1738 	uint32			listen_interval_inms; /**< Min Listen interval in ms for this STA */
1739 	uint32			tx_pkts;	/**< # of user packets transmitted (unicast) */
1740 	uint32			tx_failures;	/**< # of user packets failed */
1741 	uint32			rx_ucast_pkts;	/**< # of unicast packets received */
1742 	uint32			rx_mcast_pkts;	/**< # of multicast packets received */
1743 	uint32			tx_rate;	/**< Rate used by last tx frame */
1744 	uint32			rx_rate;	/**< Rate of last successful rx frame */
1745 	uint32			rx_decrypt_succeeds;	/**< # of packet decrypted successfully */
1746 	uint32			rx_decrypt_failures;	/**< # of packet decrypted unsuccessfully */
1747 	uint32			tx_tot_pkts;	/**< # of user tx pkts (ucast + mcast) */
1748 	uint32			rx_tot_pkts;	/**< # of data packets recvd (uni + mcast) */
1749 	uint32			tx_mcast_pkts;	/**< # of mcast pkts txed */
1750 	uint64			tx_tot_bytes;	/**< data bytes txed (ucast + mcast) */
1751 	uint64			rx_tot_bytes;	/**< data bytes recvd (ucast + mcast) */
1752 	uint64			tx_ucast_bytes;	/**< data bytes txed (ucast) */
1753 	uint64			tx_mcast_bytes;	/**< # data bytes txed (mcast) */
1754 	uint64			rx_ucast_bytes;	/**< data bytes recvd (ucast) */
1755 	uint64			rx_mcast_bytes;	/**< data bytes recvd (mcast) */
1756 	int8			rssi[WL_STA_ANT_MAX]; /**< average rssi per antenna
1757 							* of data frames
1758 							*/
1759 	int8			nf[WL_STA_ANT_MAX];	/**< per antenna noise floor */
1760 	uint16			aid;			/**< association ID */
1761 	uint16			ht_capabilities;	/**< advertised ht caps */
1762 	uint16			vht_flags;		/**< converted vht flags */
1763 	uint16			PAD;
1764 	uint32			tx_pkts_retried;	/**< # of frames where a retry was
1765 							 * necessary
1766 							 */
1767 	uint32			tx_pkts_retry_exhausted; /**< # of user frames where a retry
1768 							  * was exhausted
1769 							  */
1770 	int8			rx_lastpkt_rssi[WL_STA_ANT_MAX]; /**< Per antenna RSSI of last
1771 								  * received data frame.
1772 								  */
1773 	/* TX WLAN retry/failure statistics:
1774 	 * Separated for host requested frames and WLAN locally generated frames.
1775 	 * Include unicast frame only where the retries/failures can be counted.
1776 	 */
1777 	uint32			tx_pkts_total;		/**< # user frames sent successfully */
1778 	uint32			tx_pkts_retries;	/**< # user frames retries */
1779 	uint32			tx_pkts_fw_total;	/**< # FW generated sent successfully */
1780 	uint32			tx_pkts_fw_retries;	/**< # retries for FW generated frames */
1781 	uint32			tx_pkts_fw_retry_exhausted;	/**< # FW generated where a retry
1782 								 * was exhausted
1783 								 */
1784 	uint32			rx_pkts_retried;	/**< # rx with retry bit set */
1785 	uint32			tx_rate_fallback;	/**< lowest fallback TX rate */
1786 	/* Fields above this line are common to sta_info_t versions 4 and 5 */
1787 
1788 	uint32			rx_dur_total;	/* total user RX duration (estimated) */
1789 
1790 	chanspec_t		chanspec;       /** chanspec this sta is on */
1791 	uint16			PAD;
1792 	wl_rateset_args_v1_t	rateset_adv;	/* rateset along with mcs index bitmap */
1793 	uint32			PAD;
1794 } sta_info_v4_t;
1795 
1796 /* Note: Version 4 is the latest version of sta_info_t.  Version 5 is abandoned.
1797  * Please add new fields to version 4, not version 5.
1798  */
1799 /* sta_info_t version 5 */
1800 typedef struct {
1801 	uint16			ver;		/**< version of this struct */
1802 	uint16			len;		/**< length in bytes of this structure */
1803 	uint16			cap;		/**< sta's advertised capabilities */
1804 	uint16			PAD;
1805 	uint32			flags;		/**< flags defined below */
1806 	uint32			idle;		/**< time since data pkt rx'd from sta */
1807 	struct ether_addr	ea;		/**< Station address */
1808 	uint16			PAD;
1809 	wl_rateset_t		rateset;	/**< rateset in use */
1810 	uint32			in;		/**< seconds elapsed since associated */
1811 	uint32			listen_interval_inms; /**< Min Listen interval in ms for this STA */
1812 	uint32			tx_pkts;	/**< # of user packets transmitted (unicast) */
1813 	uint32			tx_failures;	/**< # of user packets failed */
1814 	uint32			rx_ucast_pkts;	/**< # of unicast packets received */
1815 	uint32			rx_mcast_pkts;	/**< # of multicast packets received */
1816 	uint32			tx_rate;	/**< Rate used by last tx frame */
1817 	uint32			rx_rate;	/**< Rate of last successful rx frame */
1818 	uint32			rx_decrypt_succeeds;	/**< # of packet decrypted successfully */
1819 	uint32			rx_decrypt_failures;	/**< # of packet decrypted unsuccessfully */
1820 	uint32			tx_tot_pkts;	/**< # of user tx pkts (ucast + mcast) */
1821 	uint32			rx_tot_pkts;	/**< # of data packets recvd (uni + mcast) */
1822 	uint32			tx_mcast_pkts;	/**< # of mcast pkts txed */
1823 	uint64			tx_tot_bytes;	/**< data bytes txed (ucast + mcast) */
1824 	uint64			rx_tot_bytes;	/**< data bytes recvd (ucast + mcast) */
1825 	uint64			tx_ucast_bytes;	/**< data bytes txed (ucast) */
1826 	uint64			tx_mcast_bytes;	/**< # data bytes txed (mcast) */
1827 	uint64			rx_ucast_bytes;	/**< data bytes recvd (ucast) */
1828 	uint64			rx_mcast_bytes;	/**< data bytes recvd (mcast) */
1829 	int8			rssi[WL_STA_ANT_MAX]; /**< average rssi per antenna
1830 							* of data frames
1831 							*/
1832 	int8			nf[WL_STA_ANT_MAX];	/**< per antenna noise floor */
1833 	uint16			aid;			/**< association ID */
1834 	uint16			ht_capabilities;	/**< advertised ht caps */
1835 	uint16			vht_flags;		/**< converted vht flags */
1836 	uint16			PAD;
1837 	uint32			tx_pkts_retried;	/**< # of frames where a retry was
1838 							 * necessary
1839 							 */
1840 	uint32			tx_pkts_retry_exhausted; /**< # of user frames where a retry
1841 							  * was exhausted
1842 							  */
1843 	int8			rx_lastpkt_rssi[WL_STA_ANT_MAX]; /**< Per antenna RSSI of last
1844 								  * received data frame.
1845 								  */
1846 	/* TX WLAN retry/failure statistics:
1847 	 * Separated for host requested frames and WLAN locally generated frames.
1848 	 * Include unicast frame only where the retries/failures can be counted.
1849 	 */
1850 	uint32			tx_pkts_total;		/**< # user frames sent successfully */
1851 	uint32			tx_pkts_retries;	/**< # user frames retries */
1852 	uint32			tx_pkts_fw_total;	/**< # FW generated sent successfully */
1853 	uint32			tx_pkts_fw_retries;	/**< # retries for FW generated frames */
1854 	uint32			tx_pkts_fw_retry_exhausted;	/**< # FW generated where a retry
1855 								 * was exhausted
1856 								 */
1857 	uint32			rx_pkts_retried;	/**< # rx with retry bit set */
1858 	uint32			tx_rate_fallback;	/**< lowest fallback TX rate */
1859 	/* Fields above this line are common to sta_info_t versions 4 and 5 */
1860 
1861 	chanspec_t		chanspec;       /** chanspec this sta is on */
1862 	uint16			PAD;
1863 	wl_rateset_args_v1_t	rateset_adv;	/* rateset along with mcs index bitmap */
1864 } sta_info_v5_t;
1865 
1866 /* sta_info_t version 6
1867 	changes to wl_rateset_args_t is leading to update this struct version as well.
1868  */
1869 typedef struct {
1870 	uint16			ver;		/**< version of this struct */
1871 	uint16			len;		/**< length in bytes of this structure */
1872 	uint16			cap;		/**< sta's advertised capabilities */
1873 	uint16			PAD;
1874 	uint32			flags;		/**< flags defined below */
1875 	uint32			idle;		/**< time since data pkt rx'd from sta */
1876 	struct ether_addr	ea;		/**< Station address */
1877 	uint16			PAD;
1878 	wl_rateset_t	rateset;	/**< rateset in use */
1879 	uint32			in;		/**< seconds elapsed since associated */
1880 	uint32			listen_interval_inms; /**< Min Listen interval in ms for this STA */
1881 	uint32			tx_pkts;	/**< # of user packets transmitted (unicast) */
1882 	uint32			tx_failures;	/**< # of user packets failed */
1883 	uint32			rx_ucast_pkts;	/**< # of unicast packets received */
1884 	uint32			rx_mcast_pkts;	/**< # of multicast packets received */
1885 	uint32			tx_rate;	/**< Rate used by last tx frame */
1886 	uint32			rx_rate;	/**< Rate of last successful rx frame */
1887 	uint32			rx_decrypt_succeeds;	/**< # of packet decrypted successfully */
1888 	uint32			rx_decrypt_failures;	/**< # of packet decrypted unsuccessfully */
1889 	uint32			tx_tot_pkts;	/**< # of user tx pkts (ucast + mcast) */
1890 	uint32			rx_tot_pkts;	/**< # of data packets recvd (uni + mcast) */
1891 	uint32			tx_mcast_pkts;	/**< # of mcast pkts txed */
1892 	uint64			tx_tot_bytes;	/**< data bytes txed (ucast + mcast) */
1893 	uint64			rx_tot_bytes;	/**< data bytes recvd (ucast + mcast) */
1894 	uint64			tx_ucast_bytes;	/**< data bytes txed (ucast) */
1895 	uint64			tx_mcast_bytes;	/**< # data bytes txed (mcast) */
1896 	uint64			rx_ucast_bytes;	/**< data bytes recvd (ucast) */
1897 	uint64			rx_mcast_bytes;	/**< data bytes recvd (mcast) */
1898 	int8			rssi[WL_STA_ANT_MAX]; /**< average rssi per antenna
1899 							* of data frames
1900 							*/
1901 	int8			nf[WL_STA_ANT_MAX];	/**< per antenna noise floor */
1902 	uint16			aid;			/**< association ID */
1903 	uint16			ht_capabilities;	/**< advertised ht caps */
1904 	uint16			vht_flags;		/**< converted vht flags */
1905 	uint16			PAD;
1906 	uint32			tx_pkts_retried;	/**< # of frames where a retry was
1907 							 * necessary
1908 							 */
1909 	uint32			tx_pkts_retry_exhausted; /**< # of user frames where a retry
1910 							  * was exhausted
1911 							  */
1912 	int8			rx_lastpkt_rssi[WL_STA_ANT_MAX]; /**< Per antenna RSSI of last
1913 								  * received data frame.
1914 								  */
1915 	/* TX WLAN retry/failure statistics:
1916 	 * Separated for host requested frames and WLAN locally generated frames.
1917 	 * Include unicast frame only where the retries/failures can be counted.
1918 	 */
1919 	uint32			tx_pkts_total;		/**< # user frames sent successfully */
1920 	uint32			tx_pkts_retries;	/**< # user frames retries */
1921 	uint32			tx_pkts_fw_total;	/**< # FW generated sent successfully */
1922 	uint32			tx_pkts_fw_retries;	/**< # retries for FW generated frames */
1923 	uint32			tx_pkts_fw_retry_exhausted;	/**< # FW generated where a retry
1924 								 * was exhausted
1925 								 */
1926 	uint32			rx_pkts_retried;	/**< # rx with retry bit set */
1927 	uint32			tx_rate_fallback;	/**< lowest fallback TX rate */
1928 	/* Fields above this line are common to sta_info_t versions 4 and 5 */
1929 
1930 	uint32			rx_dur_total;	/* total user RX duration (estimated) */
1931 
1932 	chanspec_t		chanspec;       /** chanspec this sta is on */
1933 	uint16			PAD;
1934 	wl_rateset_args_v2_t	rateset_adv;	/* rateset along with mcs index bitmap */
1935 } sta_info_v6_t;
1936 
1937 #define WL_OLD_STAINFO_SIZE	OFFSETOF(sta_info_t, tx_tot_pkts)
1938 
1939 #define WL_STA_VER_4		4
1940 #define WL_STA_VER_5		5
1941 #define WL_STA_VER		WL_STA_VER_4
1942 
1943 #define SWDIV_STATS_VERSION_2 2
1944 #define SWDIV_STATS_CURRENT_VERSION SWDIV_STATS_VERSION_2
1945 
1946 struct wlc_swdiv_stats_v1 {
1947 	uint32 auto_en;
1948 	uint32 active_ant;
1949 	uint32 rxcount;
1950 	int32 avg_snr_per_ant0;
1951 	int32 avg_snr_per_ant1;
1952 	int32 avg_snr_per_ant2;
1953 	uint32 swap_ge_rxcount0;
1954 	uint32 swap_ge_rxcount1;
1955 	uint32 swap_ge_snrthresh0;
1956 	uint32 swap_ge_snrthresh1;
1957 	uint32 swap_txfail0;
1958 	uint32 swap_txfail1;
1959 	uint32 swap_timer0;
1960 	uint32 swap_timer1;
1961 	uint32 swap_alivecheck0;
1962 	uint32 swap_alivecheck1;
1963 	uint32 rxcount_per_ant0;
1964 	uint32 rxcount_per_ant1;
1965 	uint32 acc_rxcount;
1966 	uint32 acc_rxcount_per_ant0;
1967 	uint32 acc_rxcount_per_ant1;
1968 	uint32 tx_auto_en;
1969 	uint32 tx_active_ant;
1970 	uint32 rx_policy;
1971 	uint32 tx_policy;
1972 	uint32 cell_policy;
1973 	uint32 swap_snrdrop0;
1974 	uint32 swap_snrdrop1;
1975 	uint32 mws_antsel_ovr_tx;
1976 	uint32 mws_antsel_ovr_rx;
1977 	uint8 swap_trig_event_id;
1978 };
1979 
1980 struct wlc_swdiv_stats_v2 {
1981 	uint16	version;	/* version of the structure
1982 						* as defined by SWDIV_STATS_CURRENT_VERSION
1983 						*/
1984 	uint16	length;		/* length of the entire structure */
1985 	uint32 auto_en;
1986 	uint32 active_ant;
1987 	uint32 rxcount;
1988 	int32 avg_snr_per_ant0;
1989 	int32 avg_snr_per_ant1;
1990 	int32 avg_snr_per_ant2;
1991 	uint32 swap_ge_rxcount0;
1992 	uint32 swap_ge_rxcount1;
1993 	uint32 swap_ge_snrthresh0;
1994 	uint32 swap_ge_snrthresh1;
1995 	uint32 swap_txfail0;
1996 	uint32 swap_txfail1;
1997 	uint32 swap_timer0;
1998 	uint32 swap_timer1;
1999 	uint32 swap_alivecheck0;
2000 	uint32 swap_alivecheck1;
2001 	uint32 rxcount_per_ant0;
2002 	uint32 rxcount_per_ant1;
2003 	uint32 acc_rxcount;
2004 	uint32 acc_rxcount_per_ant0;
2005 	uint32 acc_rxcount_per_ant1;
2006 	uint32 tx_auto_en;
2007 	uint32 tx_active_ant;
2008 	uint32 rx_policy;
2009 	uint32 tx_policy;
2010 	uint32 cell_policy;
2011 	uint32 swap_snrdrop0;
2012 	uint32 swap_snrdrop1;
2013 	uint32 mws_antsel_ovr_tx;
2014 	uint32 mws_antsel_ovr_rx;
2015 	uint32 swap_trig_event_id;
2016 };
2017 
2018 #define	WLC_NUMRATES	16	/**< max # of rates in a rateset */
2019 
2020 /**Used to get specific STA parameters */
2021 typedef struct {
2022 	uint32	val;
2023 	struct ether_addr ea;
2024 	uint16	PAD;
2025 } scb_val_t;
2026 
2027 /**Used by iovar versions of some ioctls, i.e. WLC_SCB_AUTHORIZE et al */
2028 typedef struct {
2029 	uint32 code;
2030 	scb_val_t ioctl_args;
2031 } authops_t;
2032 
2033 /** channel encoding */
2034 typedef struct channel_info {
2035 	int32 hw_channel;
2036 	int32 target_channel;
2037 	int32 scan_channel;
2038 } channel_info_t;
2039 
2040 /** For ioctls that take a list of MAC addresses */
2041 typedef struct maclist {
2042 	uint32 count;			/**< number of MAC addresses */
2043 	struct ether_addr ea[1];	/**< variable length array of MAC addresses */
2044 } maclist_t;
2045 
2046 typedef struct wds_client_info {
2047 	char	ifname[INTF_NAME_SIZ];	/* WDS ifname */
2048 	struct	ether_addr ea;		/* WDS client MAC address */
2049 } wds_client_info_t;
2050 
2051 #define WDS_MACLIST_MAGIC	0xFFFFFFFF
2052 #define WDS_MACLIST_VERSION	1
2053 
2054 /* For wds MAC list ioctls */
2055 typedef struct wds_maclist {
2056 	uint32 count;				/* Number of WDS clients */
2057 	uint32 magic;				/* Magic number */
2058 	uint32 version;				/* Version number */
2059 	struct wds_client_info  client_list[1]; /* Variable length array of WDS clients */
2060 } wds_maclist_t;
2061 
2062 /**get pkt count struct passed through ioctl */
2063 typedef struct get_pktcnt {
2064 	uint32 rx_good_pkt;
2065 	uint32 rx_bad_pkt;
2066 	uint32 tx_good_pkt;
2067 	uint32 tx_bad_pkt;
2068 	uint32 rx_ocast_good_pkt; /**< unicast packets destined for others */
2069 } get_pktcnt_t;
2070 
2071 /* NINTENDO2 */
2072 #define LQ_IDX_MIN              0
2073 #define LQ_IDX_MAX              1
2074 #define LQ_IDX_AVG              2
2075 #define LQ_IDX_SUM              2
2076 #define LQ_IDX_LAST             3
2077 #define LQ_STOP_MONITOR         0
2078 #define LQ_START_MONITOR        1
2079 
2080 /** Get averages RSSI, Rx PHY rate and SNR values */
2081 /* Link Quality */
2082 typedef struct {
2083 	int32 rssi[LQ_IDX_LAST];  /**< Array to keep min, max, avg rssi */
2084 	int32 snr[LQ_IDX_LAST];   /**< Array to keep min, max, avg snr */
2085 	int32 isvalid;            /**< Flag indicating whether above data is valid */
2086 } wl_lq_t;
2087 
2088 typedef enum wl_wakeup_reason_type {
2089 	LCD_ON = 1,
2090 	LCD_OFF,
2091 	DRC1_WAKE,
2092 	DRC2_WAKE,
2093 	REASON_LAST
2094 } wl_wr_type_t;
2095 
2096 typedef struct {
2097 	/** Unique filter id */
2098 	uint32	id;
2099 	/** stores the reason for the last wake up */
2100 	uint8	reason;
2101 	uint8	PAD[3];
2102 } wl_wr_t;
2103 
2104 /** Get MAC specific rate histogram command */
2105 typedef struct {
2106 	struct	ether_addr ea;	/**< MAC Address */
2107 	uint8	ac_cat;	/**< Access Category */
2108 	uint8	num_pkts;	/**< Number of packet entries to be averaged */
2109 } wl_mac_ratehisto_cmd_t;
2110 /** Get MAC rate histogram response */
2111 typedef struct {
2112 	uint32	rate[DOT11_RATE_MAX + 1];	/**< Rates */
2113 	uint32	mcs[WL_RATESET_SZ_HT_IOCTL * WL_TX_CHAINS_MAX];	/**< MCS counts */
2114 	uint32	vht[WL_RATESET_SZ_VHT_MCS][WL_TX_CHAINS_MAX];	/**< VHT counts */
2115 	uint32	tsf_timer[2][2];	/**< Start and End time for 8bytes value */
2116 	uint32	prop11n_mcs[WLC_11N_LAST_PROP_MCS - WLC_11N_FIRST_PROP_MCS + 1]; /** MCS counts */
2117 } wl_mac_ratehisto_res_t;
2118 
2119 /* sta_info ecounters */
2120 typedef struct {
2121 	struct ether_addr   ea;				/* Station MAC addr */
2122 	struct ether_addr   BSSID;			/* BSSID of the BSS */
2123 	uint32              tx_pkts_fw_total;		/* # FW generated sent successfully */
2124 	uint32              tx_pkts_fw_retries;		/* # retries for FW generated frames */
2125 	uint32              tx_pkts_fw_retry_exhausted;	/* # FW generated which
2126 							 * failed after retry
2127 							 */
2128 } sta_info_ecounters_t;
2129 
2130 #define STAMON_MODULE_VER		1
2131 
2132 /**Linux network driver ioctl encoding */
2133 typedef struct wl_ioctl {
2134 	uint32 cmd;	/**< common ioctl definition */
2135 	void *buf;	/**< pointer to user buffer */
2136 	uint32 len;	/**< length of user buffer */
2137 	uint8 set;		/**< 1=set IOCTL; 0=query IOCTL */
2138 	uint32 used;	/**< bytes read or written (optional) */
2139 	uint32 needed;	/**< bytes needed (optional) */
2140 } wl_ioctl_t;
2141 
2142 #define WL_NUM_RATES_CCK		4 /**< 1, 2, 5.5, 11 Mbps */
2143 #define WL_NUM_RATES_OFDM		8 /**< 6, 9, 12, 18, 24, 36, 48, 54 Mbps SISO/CDD */
2144 #define WL_NUM_RATES_MCS_1STREAM	8 /**< MCS 0-7 1-stream rates - SISO/CDD/STBC/MCS */
2145 #define WL_NUM_RATES_EXTRA_VHT		2 /**< Additional VHT 11AC rates */
2146 #define WL_NUM_RATES_VHT		10
2147 #define WL_NUM_RATES_VHT_ALL		(WL_NUM_RATES_VHT + WL_NUM_RATES_EXTRA_VHT)
2148 #define WL_NUM_RATES_HE			12
2149 #define WL_NUM_RATES_MCS32		1
2150 #define UC_URL_LEN			128u /**< uCode URL length */
2151 
2152 /*
2153  * Structure for passing hardware and software
2154  * revision info up from the driver.
2155  */
2156 typedef struct wlc_rev_info {
2157 	uint32		vendorid;	/**< PCI vendor id */
2158 	uint32		deviceid;	/**< device id of chip */
2159 	uint32		radiorev;	/**< radio revision */
2160 	uint32		chiprev;	/**< chip revision */
2161 	uint32		corerev;	/**< core revision */
2162 	uint32		boardid;	/**< board identifier (usu. PCI sub-device id) */
2163 	uint32		boardvendor;	/**< board vendor (usu. PCI sub-vendor id) */
2164 	uint32		boardrev;	/**< board revision */
2165 	uint32		driverrev;	/**< driver version */
2166 	uint32		ucoderev;	/**< uCode version */
2167 	uint32		bus;		/**< bus type */
2168 	uint32		chipnum;	/**< chip number */
2169 	uint32		phytype;	/**< phy type */
2170 	uint32		phyrev;		/**< phy revision */
2171 	uint32		anarev;		/**< anacore rev */
2172 	uint32		chippkg;	/**< chip package info */
2173 	uint32		nvramrev;	/**< nvram revision number */
2174 	uint32		phyminorrev;	/**< phy minor rev */
2175 	uint32		coreminorrev;	/**< core minor rev */
2176 	uint32		drvrev_major;	/**< driver version: major */
2177 	uint32		drvrev_minor;	/**< driver version: minor */
2178 	uint32		drvrev_rc;	/**< driver version: rc */
2179 	uint32		drvrev_rc_inc;	/**< driver version: rc incremental */
2180 	uint16		ucodeprebuilt;	/**< uCode prebuilt flag */
2181 	uint16		ucodediffct;	/**< uCode diff count */
2182 	uchar		ucodeurl[UC_URL_LEN]; /**< uCode repo URL@cmt_id */
2183 } wlc_rev_info_t;
2184 
2185 #define WL_REV_INFO_LEGACY_LENGTH	48
2186 
2187 #define WL_BRAND_MAX 10
2188 typedef struct wl_instance_info {
2189 	uint32 instance;
2190 	int8 brand[WL_BRAND_MAX];
2191 	int8 PAD[4-(WL_BRAND_MAX%4)];
2192 } wl_instance_info_t;
2193 
2194 /** structure to change size of tx fifo */
2195 typedef struct wl_txfifo_sz {
2196 	uint16	magic;
2197 	uint16	fifo;
2198 	uint16	size;
2199 } wl_txfifo_sz_t;
2200 
2201 /* Transfer info about an IOVar from the driver */
2202 /**Max supported IOV name size in bytes, + 1 for nul termination */
2203 #define WLC_IOV_NAME_LEN	(32 + 1)
2204 
2205 typedef struct wlc_iov_trx_s {
2206 	uint8 module;
2207 	uint8 type;
2208 	char name[WLC_IOV_NAME_LEN];
2209 } wlc_iov_trx_t;
2210 
2211 /** bump this number if you change the ioctl interface */
2212 #define WLC_IOCTL_VERSION	2
2213 #define WLC_IOCTL_VERSION_LEGACY_IOTYPES	1
2214 /* ifdef EXT_STA */
2215 typedef struct _wl_assoc_result {
2216 	ulong associated;
2217 	ulong NDIS_auth;
2218 	ulong NDIS_infra;
2219 } wl_assoc_result_t;
2220 /* EXT_STA */
2221 
2222 #define WL_PHY_PAVARS_LEN	32	/**< Phytype, Bandrange, chain, a[0], b[0], c[0], d[0] .. */
2223 
2224 #define WL_PHY_PAVAR_VER	1	/**< pavars version */
2225 #define WL_PHY_PAVARS2_NUM	3	/**< a1, b0, b1 */
2226 typedef struct wl_pavars2 {
2227 	uint16 ver;		/**< version of this struct */
2228 	uint16 len;		/**< len of this structure */
2229 	uint16 inuse;		/**< driver return 1 for a1,b0,b1 in current band range */
2230 	uint16 phy_type;	/**< phy type */
2231 	uint16 bandrange;
2232 	uint16 chain;
2233 	uint16 inpa[WL_PHY_PAVARS2_NUM];	/**< phy pavars for one band range */
2234 } wl_pavars2_t;
2235 
2236 typedef struct wl_po {
2237 	uint16	phy_type;	/**< Phy type */
2238 	uint16	band;
2239 	uint16	cckpo;
2240 	uint16	PAD;
2241 	uint32	ofdmpo;
2242 	uint16	mcspo[8];
2243 } wl_po_t;
2244 
2245 #define WL_NUM_RPCALVARS 5	/**< number of rpcal vars */
2246 
2247 typedef struct wl_rpcal {
2248 	uint16 value;
2249 	uint16 update;
2250 } wl_rpcal_t;
2251 
2252 #define WL_NUM_RPCALPHASEVARS 5	/* number of rpcal phase vars */
2253 
2254 typedef struct wl_rpcal_phase {
2255 	uint16 value;
2256 	uint16 update;
2257 } wl_rpcal_phase_t;
2258 
2259 typedef struct wl_aci_args {
2260 	int32 enter_aci_thresh; /* Trigger level to start detecting ACI */
2261 	int32 exit_aci_thresh; /* Trigger level to exit ACI mode */
2262 	int32 usec_spin; /* microsecs to delay between rssi samples */
2263 	int32 glitch_delay; /* interval between ACI scans when glitch count is consistently high */
2264 	uint16 nphy_adcpwr_enter_thresh;	/**< ADC power to enter ACI mitigation mode */
2265 	uint16 nphy_adcpwr_exit_thresh;	/**< ADC power to exit ACI mitigation mode */
2266 	uint16 nphy_repeat_ctr;		/**< Number of tries per channel to compute power */
2267 	uint16 nphy_num_samples;	/**< Number of samples to compute power on one channel */
2268 	uint16 nphy_undetect_window_sz;	/**< num of undetects to exit ACI Mitigation mode */
2269 	uint16 nphy_b_energy_lo_aci;	/**< low ACI power energy threshold for bphy */
2270 	uint16 nphy_b_energy_md_aci;	/**< mid ACI power energy threshold for bphy */
2271 	uint16 nphy_b_energy_hi_aci;	/**< high ACI power energy threshold for bphy */
2272 	uint16 nphy_noise_noassoc_glitch_th_up; /**< wl interference 4 */
2273 	uint16 nphy_noise_noassoc_glitch_th_dn;
2274 	uint16 nphy_noise_assoc_glitch_th_up;
2275 	uint16 nphy_noise_assoc_glitch_th_dn;
2276 	uint16 nphy_noise_assoc_aci_glitch_th_up;
2277 	uint16 nphy_noise_assoc_aci_glitch_th_dn;
2278 	uint16 nphy_noise_assoc_enter_th;
2279 	uint16 nphy_noise_noassoc_enter_th;
2280 	uint16 nphy_noise_assoc_rx_glitch_badplcp_enter_th;
2281 	uint16 nphy_noise_noassoc_crsidx_incr;
2282 	uint16 nphy_noise_assoc_crsidx_incr;
2283 	uint16 nphy_noise_crsidx_decr;
2284 } wl_aci_args_t;
2285 
2286 #define WL_ACI_ARGS_LEGACY_LENGTH	16	/**< bytes of pre NPHY aci args */
2287 #define	WL_SAMPLECOLLECT_T_VERSION	2	/**< version of wl_samplecollect_args_t struct */
2288 typedef struct wl_samplecollect_args {
2289 	/* version 0 fields */
2290 	uint8 coll_us;
2291 	uint8 PAD[3];
2292 	int32 cores;
2293 	/* add'l version 1 fields */
2294 	uint16 version;     /**< see definition of WL_SAMPLECOLLECT_T_VERSION */
2295 	uint16 length;      /**< length of entire structure */
2296 	int8 trigger;
2297 	uint8 PAD;
2298 	uint16 timeout;
2299 	uint16 mode;
2300 	uint16 PAD;
2301 	uint32 pre_dur;
2302 	uint32 post_dur;
2303 	uint8 gpio_sel;
2304 	uint8 downsamp;
2305 	uint8 be_deaf;
2306 	uint8 agc;		/**< loop from init gain and going down */
2307 	uint8 filter;		/**< override high pass corners to lowest */
2308 	/* add'l version 2 fields */
2309 	uint8 trigger_state;
2310 	uint8 module_sel1;
2311 	uint8 module_sel2;
2312 	uint16 nsamps;
2313 	uint16 PAD;
2314 	int32 bitStart;
2315 	uint32 gpioCapMask;
2316 	uint8 gpio_collection;
2317 	uint8 PAD[3];
2318 } wl_samplecollect_args_t;
2319 
2320 #define	WL_SAMPLEDATA_T_VERSION		1	/**< version of wl_samplecollect_args_t struct */
2321 /* version for unpacked sample data, int16 {(I,Q),Core(0..N)} */
2322 #define	WL_SAMPLEDATA_T_VERSION_SPEC_AN 2
2323 
2324 typedef struct wl_sampledata {
2325 	uint16 version;	/**< structure version */
2326 	uint16 size;	/**< size of structure */
2327 	uint16 tag;	/**< Header/Data */
2328 	uint16 length;	/**< data length */
2329 	uint32 flag;	/**< bit def */
2330 } wl_sampledata_t;
2331 
2332 /* WL_OTA START */
2333 /* OTA Test Status */
2334 enum {
2335 	WL_OTA_TEST_IDLE = 0,		/**< Default Idle state */
2336 	WL_OTA_TEST_ACTIVE = 1,		/**< Test Running */
2337 	WL_OTA_TEST_SUCCESS = 2,	/**< Successfully Finished Test */
2338 	WL_OTA_TEST_FAIL = 3		/**< Test Failed in the Middle */
2339 };
2340 
2341 /* OTA SYNC Status */
2342 enum {
2343 	WL_OTA_SYNC_IDLE = 0,	/**< Idle state */
2344 	WL_OTA_SYNC_ACTIVE = 1,	/**< Waiting for Sync */
2345 	WL_OTA_SYNC_FAIL = 2	/**< Sync pkt not recieved */
2346 };
2347 
2348 /* Various error states dut can get stuck during test */
2349 enum {
2350 	WL_OTA_SKIP_TEST_CAL_FAIL = 1,		/**< Phy calibration failed */
2351 	WL_OTA_SKIP_TEST_SYNCH_FAIL = 2,	/**< Sync Packet not recieved */
2352 	WL_OTA_SKIP_TEST_FILE_DWNLD_FAIL = 3,	/**< Cmd flow file download failed */
2353 	WL_OTA_SKIP_TEST_NO_TEST_FOUND = 4,	/**< No test found in Flow file */
2354 	WL_OTA_SKIP_TEST_WL_NOT_UP = 5,		/**< WL UP failed */
2355 	WL_OTA_SKIP_TEST_UNKNOWN_CALL		/**< Unintentional scheduling on ota test */
2356 };
2357 
2358 /* Differentiator for ota_tx and ota_rx */
2359 enum {
2360 	WL_OTA_TEST_TX = 0,		/**< ota_tx */
2361 	WL_OTA_TEST_RX = 1,		/**< ota_rx */
2362 };
2363 
2364 /* Catch 3 modes of operation: 20Mhz, 40Mhz, 20 in 40 Mhz */
2365 enum {
2366 	WL_OTA_TEST_BW_20_IN_40MHZ = 0,		/**< 20 in 40 operation */
2367 	WL_OTA_TEST_BW_20MHZ = 1,		/**< 20 Mhz operation */
2368 	WL_OTA_TEST_BW_40MHZ = 2,		/**< full 40Mhz operation */
2369 	WL_OTA_TEST_BW_80MHZ = 3		/* full 80Mhz operation */
2370 };
2371 #define HT_MCS_INUSE	0x00000080	/* HT MCS in use,indicates b0-6 holds an mcs */
2372 #define VHT_MCS_INUSE	0x00000100	/* VHT MCS in use,indicates b0-6 holds an mcs */
2373 #define OTA_RATE_MASK 0x0000007f	/* rate/mcs value */
2374 #define OTA_STF_SISO	0
2375 #define OTA_STF_CDD		1
2376 #define OTA_STF_STBC	2
2377 #define OTA_STF_SDM		3
2378 
2379 typedef struct ota_rate_info {
2380 	uint8 rate_cnt;					/**< Total number of rates */
2381 	uint8 PAD;
2382 	uint16 rate_val_mbps[WL_OTA_TEST_MAX_NUM_RATE];	/**< array of rates from 1mbps to 130mbps */
2383 							/**< for legacy rates : ratein mbps * 2 */
2384 							/**< for HT rates : mcs index */
2385 } ota_rate_info_t;
2386 
2387 typedef struct ota_power_info {
2388 	int8 pwr_ctrl_on;	/**< power control on/off */
2389 	int8 start_pwr;		/**< starting power/index */
2390 	int8 delta_pwr;		/**< delta power/index */
2391 	int8 end_pwr;		/**< end power/index */
2392 } ota_power_info_t;
2393 
2394 typedef struct ota_packetengine {
2395 	uint16 delay;           /**< Inter-packet delay */
2396 				/**< for ota_tx, delay is tx ifs in micro seconds */
2397 				/* for ota_rx, delay is wait time in milliseconds */
2398 	uint16 nframes;         /**< Number of frames */
2399 	uint16 length;          /**< Packet length */
2400 } ota_packetengine_t;
2401 
2402 /*
2403  * OTA txant/rxant parameter
2404  *    bit7-4: 4 bits swdiv_tx/rx_policy bitmask, specify antenna-policy for SW diversity
2405  *    bit3-0: 4 bits TxCore bitmask, specify cores used for transmit frames
2406  *            (maximum spatial expansion)
2407  */
2408 #define WL_OTA_TEST_ANT_MASK	0xF0
2409 #define WL_OTA_TEST_CORE_MASK	0x0F
2410 
2411 /* OTA txant/rxant 'ant_mask' field; map to Tx/Rx antenna policy for SW diversity */
2412 enum {
2413 	WL_OTA_TEST_FORCE_ANT0 = 0x10,	/* force antenna to Ant 0 */
2414 	WL_OTA_TEST_FORCE_ANT1 = 0x20,	/* force antenna to Ant 1 */
2415 };
2416 
2417 /* antenna/core fields access */
2418 #define WL_OTA_TEST_GET_ANT(_txant) ((_txant) & WL_OTA_TEST_ANT_MASK)
2419 #define WL_OTA_TEST_GET_CORE(_txant) ((_txant) & WL_OTA_TEST_CORE_MASK)
2420 
2421 /** Test info vector */
2422 typedef struct wl_ota_test_args {
2423 	uint8 cur_test;			/**< test phase */
2424 	uint8 chan;			/**< channel */
2425 	uint8 bw;			/**< bandwidth */
2426 	uint8 control_band;		/**< control band */
2427 	uint8 stf_mode;			/**< stf mode */
2428 	uint8 PAD;
2429 	ota_rate_info_t rt_info;	/**< Rate info */
2430 	ota_packetengine_t pkteng;	/**< packeteng info */
2431 	uint8 txant;			/**< tx antenna */
2432 	uint8 rxant;			/**< rx antenna */
2433 	ota_power_info_t pwr_info;	/**< power sweep info */
2434 	uint8 wait_for_sync;		/**< wait for sync or not */
2435 	uint8 ldpc;
2436 	uint8 sgi;
2437 	uint8 PAD;
2438 	/* Update WL_OTA_TESTVEC_T_VERSION for adding new members to this structure */
2439 } wl_ota_test_args_t;
2440 
2441 #define WL_OTA_TESTVEC_T_VERSION		1	/* version of wl_ota_test_vector_t struct */
2442 typedef struct wl_ota_test_vector {
2443 	uint16 version;
2444 	wl_ota_test_args_t test_arg[WL_OTA_TEST_MAX_NUM_SEQ];	/**< Test argument struct */
2445 	uint16 test_cnt;					/**< Total no of test */
2446 	uint8 file_dwnld_valid;					/**< File successfully downloaded */
2447 	uint8 sync_timeout;					/**< sync packet timeout */
2448 	int8 sync_fail_action;					/**< sync fail action */
2449 	struct ether_addr sync_mac;				/**< macaddress for sync pkt */
2450 	struct ether_addr tx_mac;				/**< macaddress for tx */
2451 	struct ether_addr rx_mac;				/**< macaddress for rx */
2452 	int8 loop_test;					/**< dbg feature to loop the test */
2453 	uint16 test_rxcnt;
2454 	/* Update WL_OTA_TESTVEC_T_VERSION for adding new members to this structure */
2455 } wl_ota_test_vector_t;
2456 
2457 /** struct copied back form dongle to host to query the status */
2458 typedef struct wl_ota_test_status {
2459 	int16 cur_test_cnt;		/**< test phase */
2460 	int8 skip_test_reason;		/**< skip test reasoin */
2461 	uint8 PAD;
2462 	wl_ota_test_args_t test_arg;	/**< cur test arg details */
2463 	uint16 test_cnt;		/**< total no of test downloaded */
2464 	uint8 file_dwnld_valid;		/**< file successfully downloaded ? */
2465 	uint8 sync_timeout;		/**< sync timeout */
2466 	int8 sync_fail_action;		/**< sync fail action */
2467 	struct ether_addr sync_mac;	/**< macaddress for sync pkt */
2468 	struct ether_addr tx_mac;	/**< tx mac address */
2469 	struct ether_addr rx_mac;	/**< rx mac address */
2470 	uint8  test_stage;		/**< check the test status */
2471 	int8 loop_test;			/**< Debug feature to puts test enfine in a loop */
2472 	uint8 sync_status;		/**< sync status */
2473 } wl_ota_test_status_t;
2474 
2475 /* FOR ioctl that take the sta monitor information */
2476 typedef struct stamon_data {
2477 	struct ether_addr  ea;
2478 	uint8 PAD[2];
2479 	int32 rssi;
2480 } stamon_data_t;
2481 
2482 typedef struct stamon_info {
2483 	int32 version;
2484 	uint32 count;
2485 	stamon_data_t sta_data[1];
2486 } stamon_info_t;
2487 
2488 typedef struct wl_ota_rx_rssi {
2489 	uint16	pktcnt;		/* Pkt count used for this rx test */
2490 	chanspec_t chanspec;	/* Channel info on which the packets are received */
2491 	int16	rssi;		/* Average RSSI of the first 50% packets received */
2492 } wl_ota_rx_rssi_t;
2493 
2494 #define	WL_OTARSSI_T_VERSION		1	/* version of wl_ota_test_rssi_t struct */
2495 #define WL_OTA_TEST_RSSI_FIXED_SIZE	OFFSETOF(wl_ota_test_rssi_t, rx_rssi)
2496 
2497 typedef struct wl_ota_test_rssi {
2498 	uint8 version;
2499 	uint8	testcnt;		/* total measured RSSI values, valid on output only */
2500 	wl_ota_rx_rssi_t rx_rssi[1]; /* Variable length array of wl_ota_rx_rssi_t */
2501 } wl_ota_test_rssi_t;
2502 
2503 /* WL_OTA END */
2504 
2505 /**wl_radar_args_t */
2506 typedef struct {
2507 	int32 npulses;	/**< required number of pulses at n * t_int */
2508 	int32 ncontig;	/**< required number of pulses at t_int */
2509 	int32 min_pw;	/**< minimum pulse width (20 MHz clocks) */
2510 	int32 max_pw;	/**< maximum pulse width (20 MHz clocks) */
2511 	uint16 thresh0;	/**< Radar detection, thresh 0 */
2512 	uint16 thresh1;	/**< Radar detection, thresh 1 */
2513 	uint16 blank;	/**< Radar detection, blank control */
2514 	uint16 fmdemodcfg;	/**< Radar detection, fmdemod config */
2515 	int32 npulses_lp;  /**< Radar detection, minimum long pulses */
2516 	int32 min_pw_lp; /**< Minimum pulsewidth for long pulses */
2517 	int32 max_pw_lp; /**< Maximum pulsewidth for long pulses */
2518 	int32 min_fm_lp; /**< Minimum fm for long pulses */
2519 	int32 max_span_lp;  /**< Maximum deltat for long pulses */
2520 	int32 min_deltat; /**< Minimum spacing between pulses */
2521 	int32 max_deltat; /**< Maximum spacing between pulses */
2522 	uint16 autocorr;	/**< Radar detection, autocorr on or off */
2523 	uint16 st_level_time;	/**< Radar detection, start_timing level */
2524 	uint16 t2_min; /**< minimum clocks needed to remain in state 2 */
2525 	uint8 PAD[2];
2526 	uint32 version; /**< version */
2527 	uint32 fra_pulse_err;	/**< sample error margin for detecting French radar pulsed */
2528 	int32 npulses_fra;  /**< Radar detection, minimum French pulses set */
2529 	int32 npulses_stg2;  /**< Radar detection, minimum staggered-2 pulses set */
2530 	int32 npulses_stg3;  /**< Radar detection, minimum staggered-3 pulses set */
2531 	uint16 percal_mask;	/**< defines which period cal is masked from radar detection */
2532 	uint8 PAD[2];
2533 	int32 quant;	/**< quantization resolution to pulse positions */
2534 	uint32 min_burst_intv_lp;	/**< minimum burst to burst interval for bin3 radar */
2535 	uint32 max_burst_intv_lp;	/**< maximum burst to burst interval for bin3 radar */
2536 	int32 nskip_rst_lp;	/**< number of skipped pulses before resetting lp buffer */
2537 	int32 max_pw_tol; /* maximum tolerance allowd in detected pulse width for radar detection */
2538 	uint16 feature_mask; /**< 16-bit mask to specify enabled features */
2539 	uint16 thresh0_sc;	/**< Radar detection, thresh 0 */
2540 	uint16 thresh1_sc;	/**< Radar detection, thresh 1 */
2541 	uint8 PAD[2];
2542 } wl_radar_args_t;
2543 
2544 #define WL_RADAR_ARGS_VERSION 2
2545 
2546 typedef struct {
2547 	uint32 version; /**< version */
2548 	uint16 thresh0_20_lo;	/**< Radar detection, thresh 0 (range 5250-5350MHz) for BW 20MHz */
2549 	uint16 thresh1_20_lo;	/**< Radar detection, thresh 1 (range 5250-5350MHz) for BW 20MHz */
2550 	uint16 thresh0_40_lo;	/**< Radar detection, thresh 0 (range 5250-5350MHz) for BW 40MHz */
2551 	uint16 thresh1_40_lo;	/**< Radar detection, thresh 1 (range 5250-5350MHz) for BW 40MHz */
2552 	uint16 thresh0_80_lo;	/**< Radar detection, thresh 0 (range 5250-5350MHz) for BW 80MHz */
2553 	uint16 thresh1_80_lo;	/**< Radar detection, thresh 1 (range 5250-5350MHz) for BW 80MHz */
2554 	uint16 thresh0_20_hi;	/**< Radar detection, thresh 0 (range 5470-5725MHz) for BW 20MHz */
2555 	uint16 thresh1_20_hi;	/**< Radar detection, thresh 1 (range 5470-5725MHz) for BW 20MHz */
2556 	uint16 thresh0_40_hi;	/**< Radar detection, thresh 0 (range 5470-5725MHz) for BW 40MHz */
2557 	uint16 thresh1_40_hi;	/**< Radar detection, thresh 1 (range 5470-5725MHz) for BW 40MHz */
2558 	uint16 thresh0_80_hi;	/**< Radar detection, thresh 0 (range 5470-5725MHz) for BW 80MHz */
2559 	uint16 thresh1_80_hi;	/**< Radar detection, thresh 1 (range 5470-5725MHz) for BW 80MHz */
2560 	uint16 thresh0_160_lo;	/**< Radar detection, thresh 0 (range 5250-5350MHz) for BW 160MHz */
2561 	uint16 thresh1_160_lo;	/**< Radar detection, thresh 1 (range 5250-5350MHz) for BW 160MHz */
2562 	uint16 thresh0_160_hi;	/**< Radar detection, thresh 0 (range 5470-5725MHz) for BW 160MHz */
2563 	uint16 thresh1_160_hi;	/**< Radar detection, thresh 1 (range 5470-5725MHz) for BW 160MHz */
2564 } wl_radar_thr_t;
2565 
2566 typedef struct {
2567 	uint32 version; /* version */
2568 	uint16 thresh0_sc_20_lo;
2569 	uint16 thresh1_sc_20_lo;
2570 	uint16 thresh0_sc_40_lo;
2571 	uint16 thresh1_sc_40_lo;
2572 	uint16 thresh0_sc_80_lo;
2573 	uint16 thresh1_sc_80_lo;
2574 	uint16 thresh0_sc_20_hi;
2575 	uint16 thresh1_sc_20_hi;
2576 	uint16 thresh0_sc_40_hi;
2577 	uint16 thresh1_sc_40_hi;
2578 	uint16 thresh0_sc_80_hi;
2579 	uint16 thresh1_sc_80_hi;
2580 	uint16 fc_varth_sb;
2581 	uint16 fc_varth_bin5_sb;
2582 	uint16 notradar_enb;
2583 	uint16 max_notradar_lp;
2584 	uint16 max_notradar;
2585 	uint16 max_notradar_lp_sc;
2586 	uint16 max_notradar_sc;
2587 	uint16 highpow_war_enb;
2588 	uint16 highpow_sp_ratio;	//unit is 0.5
2589 } wl_radar_thr2_t;
2590 
2591 #define WL_RADAR_THR_VERSION	2
2592 
2593 typedef struct {
2594 	uint32 ver;
2595 	uint32 len;
2596 	int32  rssi_th[3];
2597 	uint8  rssi_gain_80[4];
2598 	uint8  rssi_gain_160[4];
2599 } wl_dyn_switch_th_t;
2600 
2601 #define WL_PHY_DYN_SWITCH_TH_VERSION	1
2602 
2603 /** RSSI per antenna */
2604 typedef struct {
2605 	uint32	version;		/**< version field */
2606 	uint32	count;			/**< number of valid antenna rssi */
2607 	int8 rssi_ant[WL_RSSI_ANT_MAX];	/**< rssi per antenna */
2608 	int8 rssi_sum;			/**< summed rssi across all antennas */
2609 	int8 PAD[3];
2610 } wl_rssi_ant_t;
2611 
2612 /* SNR per antenna */
2613 typedef struct {
2614 	uint32  version;				/* version field */
2615 	uint32  count;					/* number of valid antenna snr */
2616 	int8 snr_ant[WL_RSSI_ANT_MAX];	/* snr per antenna */
2617 } wl_snr_ant_t;
2618 
2619 /** data structure used in 'dfs_status' wl interface, which is used to query dfs status */
2620 typedef struct {
2621 	uint32 state;		/**< noted by WL_DFS_CACSTATE_XX. */
2622 	uint32 duration;		/**< time spent in ms in state. */
2623 	/**
2624 	 * as dfs enters ISM state, it removes the operational channel from quiet channel
2625 	 * list and notes the channel in channel_cleared. set to 0 if no channel is cleared
2626 	 */
2627 	chanspec_t chanspec_cleared;
2628 	/** chanspec cleared used to be a uint32, add another to uint16 to maintain size */
2629 	uint16 pad;
2630 } wl_dfs_status_t;
2631 
2632 typedef struct {
2633 	uint32 state;		/* noted by WL_DFS_CACSTATE_XX */
2634 	uint32 duration;		/* time spent in ms in state */
2635 	chanspec_t chanspec;	/* chanspec of this core */
2636 	chanspec_t chanspec_last_cleared; /* chanspec last cleared for operation by scanning */
2637 	uint16 sub_type;	/* currently just the index of the core or the respective PLL */
2638 	uint16 pad;
2639 } wl_dfs_sub_status_t;
2640 
2641 #define WL_DFS_STATUS_ALL_VERSION	(1)
2642 typedef struct {
2643 	uint16 version;		/* version field; current max version 1 */
2644 	uint16 num_sub_status;
2645 	wl_dfs_sub_status_t  dfs_sub_status[1]; /* struct array of length num_sub_status */
2646 } wl_dfs_status_all_t;
2647 
2648 #define WL_DFS_AP_MOVE_VERSION	(1)
2649 
2650 struct wl_dfs_ap_move_status_v1 {
2651 	int16 dfs_status;	/* DFS scan status */
2652 	chanspec_t chanspec;	/* New AP Chanspec */
2653 	wl_dfs_status_t cac_status;	/* CAC status */
2654 };
2655 
2656 typedef struct wl_dfs_ap_move_status_v2 {
2657 	int8 version;            /* version field; current max version 1 */
2658 	int8 move_status;        /* DFS move status */
2659 	chanspec_t chanspec;     /* New AP Chanspec */
2660 	wl_dfs_status_all_t scan_status; /* status; see dfs_status_all for wl_dfs_status_all_t */
2661 } wl_dfs_ap_move_status_v2_t;
2662 
2663 #define WL_DFS_AP_MOVE_ABORT -1		/* Abort any dfs_ap_move in progress immediately */
2664 #define WL_DFS_AP_MOVE_STUNT -2		/* Stunt move but continue background CSA if in progress */
2665 
2666 /** data structure used in 'radar_status' wl interface, which is use to query radar det status */
2667 typedef struct {
2668 	uint8 detected;
2669 	uint8 PAD[3];
2670 	int32 count;
2671 	uint8 pretended;
2672 	uint8 PAD[3];
2673 	uint32 radartype;
2674 	uint32 timenow;
2675 	uint32 timefromL;
2676 	int32  lp_csect_single;
2677 	int32  detected_pulse_index;
2678 	int32  nconsecq_pulses;
2679 	chanspec_t ch;
2680 	uint8 PAD[2];
2681 	int32  pw[10];
2682 	int32  intv[10];
2683 	int32  fm[10];
2684 } wl_radar_status_t;
2685 
2686 #define NUM_PWRCTRL_RATES 12
2687 
2688 typedef struct {
2689 	uint8 txpwr_band_max[NUM_PWRCTRL_RATES];	/**< User set target */
2690 	uint8 txpwr_limit[NUM_PWRCTRL_RATES];		/**< reg and local power limit */
2691 	uint8 txpwr_local_max;				/**< local max according to the AP */
2692 	uint8 txpwr_local_constraint;			/**< local constraint according to the AP */
2693 	uint8 txpwr_chan_reg_max;			/**< Regulatory max for this channel */
2694 	uint8 txpwr_target[2][NUM_PWRCTRL_RATES];	/**< Latest target for 2.4 and 5 Ghz */
2695 	uint8 txpwr_est_Pout[2];			/**< Latest estimate for 2.4 and 5 Ghz */
2696 	uint8 txpwr_opo[NUM_PWRCTRL_RATES];		/**< On G phy, OFDM power offset */
2697 	uint8 txpwr_bphy_cck_max[NUM_PWRCTRL_RATES];	/**< Max CCK power for this band (SROM) */
2698 	uint8 txpwr_bphy_ofdm_max;			/**< Max OFDM power for this band (SROM) */
2699 	uint8 txpwr_aphy_max[NUM_PWRCTRL_RATES];	/**< Max power for A band (SROM) */
2700 	int8  txpwr_antgain[2];				/**< Ant gain for each band - from SROM */
2701 	uint8 txpwr_est_Pout_gofdm;			/**< Pwr estimate for 2.4 OFDM */
2702 } tx_power_legacy_t;
2703 
2704 #define WL_TX_POWER_RATES_LEGACY    45
2705 #define WL_TX_POWER_MCS20_FIRST         12
2706 #define WL_TX_POWER_MCS20_NUM           16
2707 #define WL_TX_POWER_MCS40_FIRST         28
2708 #define WL_TX_POWER_MCS40_NUM           17
2709 
2710 typedef struct {
2711 	uint32 flags;
2712 	chanspec_t chanspec;                 /**< txpwr report for this channel */
2713 	chanspec_t local_chanspec;           /**< channel on which we are associated */
2714 	uint8 local_max;                 /**< local max according to the AP */
2715 	uint8 local_constraint;              /**< local constraint according to the AP */
2716 	int8  antgain[2];                /**< Ant gain for each band - from SROM */
2717 	uint8 rf_cores;                  /**< count of RF Cores being reported */
2718 	uint8 est_Pout[4];                           /**< Latest tx power out estimate per RF
2719 							  * chain without adjustment
2720 							  */
2721 	uint8 est_Pout_cck;                          /**< Latest CCK tx power out estimate */
2722 	uint8 user_limit[WL_TX_POWER_RATES_LEGACY];  /**< User limit */
2723 	uint8 reg_limit[WL_TX_POWER_RATES_LEGACY];   /**< Regulatory power limit */
2724 	uint8 board_limit[WL_TX_POWER_RATES_LEGACY]; /**< Max power board can support (SROM) */
2725 	uint8 target[WL_TX_POWER_RATES_LEGACY];      /**< Latest target power */
2726 	uint8 PAD[2];
2727 } tx_power_legacy2_t;
2728 
2729 #define WL_NUM_2x2_ELEMENTS		4
2730 #define WL_NUM_3x3_ELEMENTS		6
2731 #define WL_NUM_4x4_ELEMENTS		10
2732 
2733 typedef struct {
2734 	uint16 ver;				/**< version of this struct */
2735 	uint16 len;				/**< length in bytes of this structure */
2736 	uint32 flags;
2737 	chanspec_t chanspec;			/**< txpwr report for this channel */
2738 	chanspec_t local_chanspec;		/**< channel on which we are associated */
2739 	uint32     buflen;			/**< ppr buffer length */
2740 	uint8      pprbuf[1];			/**< Latest target power buffer */
2741 } wl_txppr_t;
2742 
2743 #define WL_TXPPR_VERSION	1
2744 #define WL_TXPPR_LENGTH	(sizeof(wl_txppr_t))
2745 #define TX_POWER_T_VERSION	45
2746 /** number of ppr serialization buffers, it should be reg, board and target */
2747 #define WL_TXPPR_SER_BUF_NUM	(3)
2748 /* curpower ppr types */
2749 enum {
2750 	PPRTYPE_TARGETPOWER	=	1,
2751 	PPRTYPE_BOARDLIMITS	=	2,
2752 	PPRTYPE_REGLIMITS	=	3
2753 };
2754 
2755 typedef struct chanspec_txpwr_max {
2756 	chanspec_t chanspec;   /**< chanspec */
2757 	uint8 txpwr_max;       /**< max txpwr in all the rates */
2758 	uint8 padding;
2759 } chanspec_txpwr_max_t;
2760 
2761 typedef struct  wl_chanspec_txpwr_max {
2762 	uint16 ver;			/**< version of this struct */
2763 	uint16 len;			/**< length in bytes of this structure */
2764 	uint32 count;		/**< number of elements of (chanspec, txpwr_max) pair */
2765 	chanspec_txpwr_max_t txpwr[1];	/**< array of (chanspec, max_txpwr) pair */
2766 } wl_chanspec_txpwr_max_t;
2767 
2768 #define WL_CHANSPEC_TXPWR_MAX_VER	1
2769 #define WL_CHANSPEC_TXPWR_MAX_LEN	(sizeof(wl_chanspec_txpwr_max_t))
2770 
2771 typedef struct tx_inst_power {
2772 	uint8 txpwr_est_Pout[2];			/**< Latest estimate for 2.4 and 5 Ghz */
2773 	uint8 txpwr_est_Pout_gofdm;			/**< Pwr estimate for 2.4 OFDM */
2774 } tx_inst_power_t;
2775 
2776 #define WL_NUM_TXCHAIN_MAX	4
2777 typedef struct wl_txchain_pwr_offsets {
2778 	int8 offset[WL_NUM_TXCHAIN_MAX];	/**< quarter dBm signed offset for each chain */
2779 } wl_txchain_pwr_offsets_t;
2780 
2781 /** maximum channels returned by the get valid channels iovar */
2782 #define WL_NUMCHANNELS		64
2783 #define WL_NUMCHANNELS_MANY_CHAN 10
2784 #define WL_ITER_LIMIT_MANY_CHAN 5
2785 
2786 #define WL_MIMO_PS_CFG_VERSION_1 1
2787 
2788 typedef struct wl_mimops_cfg {
2789 	uint8 version;
2790 	/* active_chains: 0 for all, 1 for 1 chain. */
2791 	uint8 active_chains;
2792 	/* static (0) or dynamic (1).or disabled (3) Mode applies only when active_chains = 0. */
2793 	uint8 mode;
2794 	/* bandwidth = Full (0), 20M (1), 40M (2), 80M (3). */
2795 	uint8 bandwidth;
2796 	uint8 applychangesafterlearning;
2797 	uint8 pad[3];
2798 } wl_mimops_cfg_t;
2799 
2800 /* This event is for tracing MIMO PS metrics snapshot calls.
2801  * It is helpful to debug out-of-sync issue between
2802  * ucode SHM values and FW snapshot calculation.
2803  * It is part of the EVENT_LOG_TAG_MIMO_PS_TRACE.
2804  */
2805 #define WL_MIMO_PS_METRICS_SNAPSHOT_TRACE_TYPE	0
2806 typedef struct wl_mimo_ps_metrics_snapshot_trace {
2807 	/* type field for this TLV: */
2808 	uint16  type;
2809 	/* length field for this TLV */
2810 	uint16  len;
2811 	uint32  idle_slotcnt_mimo;	/* MIMO idle slotcnt raw SHM value */
2812 	uint32  last_idle_slotcnt_mimo;	/* stored value snapshot */
2813 	uint32  idle_slotcnt_siso;	/* SISO idle slotcnt raw SHM value */
2814 	uint32  last_idle_slotcnt_siso;	/* stored value snapshot */
2815 	uint32	rx_time_mimo;		/* Rx MIMO raw SHM value */
2816 	uint32	last_rx_time_mimo;	/* stored value snapshot */
2817 	uint32	rx_time_siso;		/* RX SISO raw SHM value */
2818 	uint32	last_rx_time_siso;	/* stored value snapshot */
2819 	uint32  tx_time_1chain;		/* Tx 1-chain raw SHM value */
2820 	uint32  last_tx_time_1chain;	/* stored value snapshot */
2821 	uint32	tx_time_2chain;		/* Tx 2-chain raw SHM value */
2822 	uint32	last_tx_time_2chain;	/* stored value snapshot */
2823 	uint32  tx_time_3chain;		/* Tx 3-chain raw SHM value */
2824 	uint32  last_tx_time_3chain;	/* stored value snapshot */
2825 	uint16	reason;			/* reason for snapshot call, see below */
2826 	/* Does the call reset last values after delta calculation */
2827 	uint16	reset_last;
2828 } wl_mimo_ps_metrics_snapshot_trace_t;
2829 /* reason codes for mimo ps metrics snapshot function calls */
2830 #define WL_MIMOPS_METRICS_SNAPSHOT_REPORT		1
2831 #define WL_MIMOPS_METRICS_SNAPSHOT_RXCHAIN_SET		2
2832 #define WL_MIMOPS_METRICS_SNAPSHOT_ARBI			3
2833 #define WL_MIMOPS_METRICS_SNAPSHOT_SLOTUPD		4
2834 #define WL_MIMOPS_METRICS_SNAPSHOT_PMBCNRX		5
2835 #define WL_MIMOPS_METRICS_SNAPSHOT_BMACINIT		6
2836 #define WL_MIMOPS_METRICS_SNAPSHOT_HT_COMPLETE		7
2837 #define WL_MIMOPS_METRICS_SNAPSHOT_OCL                  8
2838 
2839 #define WL_MIMO_PS_STATUS_VERSION_2	2
2840 typedef struct wl_mimo_ps_status {
2841 	uint8 version;
2842 	uint8 ap_cap;			/* The associated AP's capability (BW, MIMO/SISO). */
2843 	uint8 association_status;	/* How we are associated to the AP (MIMO/SISO). */
2844 	uint8 mimo_ps_state;		/* mimo_ps_cfg states: [0-5]. See below for values */
2845 	uint8 mrc_state;		/* MRC state: NONE (0), ACTIVE(1) */
2846 	uint8 bss_rxchain;		/* bss rxchain bitmask */
2847 	uint8 bss_txchain;		/* bss txchain bitmask */
2848 	uint8 bss_bw;			/* bandwidth: Full (0), 20M (1), 40M (2), 80M (3), etc */
2849 	uint16 hw_state;		/* bitmask of hw state. See below for values */
2850 	uint8 hw_rxchain;		/* actual HW rxchain bitmask */
2851 	uint8 hw_txchain;		/* actual HW txchain bitmask */
2852 	uint8 hw_bw;			/* bandwidth: Full (0), 20M (1), 40M (2), 80M (3), etc */
2853 	uint8 pm_bcnrx_state;		/* actual state of ucode flag */
2854 	uint8 basic_rates_present;	/* internal flag to trigger siso bcmc rx */
2855 	uint8 siso_bcmc_rx_state;	/* actual state of ucode flag */
2856 } wl_mimo_ps_status_t;
2857 
2858 #define WL_MIMO_PS_STATUS_VERSION_1	1
2859 typedef struct wl_mimo_ps_status_v1 {
2860 	uint8 version;
2861 	uint8 ap_cap;			/* The associated AP's capability (BW, MIMO/SISO). */
2862 	uint8 association_status;	/* How we are associated to the AP (MIMO/SISO). */
2863 	uint8 mimo_ps_state;		/* mimo_ps_cfg states: [0-5]. See below for values */
2864 	uint8 mrc_state;		/* MRC state: NONE (0), ACTIVE(1) */
2865 	uint8 bss_rxchain;		/* bss rxchain bitmask */
2866 	uint8 bss_txchain;		/* bss txchain bitmask */
2867 	uint8 bss_bw;			/* bandwidth: Full (0), 20M (1), 40M (2), 80M (3), etc */
2868 	uint16 hw_state;		/* bitmask of hw state. See below for values */
2869 	uint8 hw_rxchain;		/* actual HW rxchain bitmask */
2870 	uint8 hw_txchain;		/* actual HW txchain bitmask */
2871 	uint8 hw_bw;			/* bandwidth: Full (0), 20M (1), 40M (2), 80M (3), etc */
2872 	uint8 pad[3];
2873 } wl_mimo_ps_status_v1_t;
2874 
2875 #define WL_MIMO_PS_STATUS_AP_CAP(ap_cap)	(ap_cap & 0x0F)
2876 #define WL_MIMO_PS_STATUS_AP_CAP_BW(ap_cap)	(ap_cap >> 4)
2877 #define WL_MIMO_PS_STATUS_ASSOC_BW_SHIFT 4
2878 
2879 /* version 3: assoc status: low nibble is status enum, high other flags */
2880 #define WL_MIMO_PS_STATUS_VERSION_3			3
2881 #define WL_MIMO_PS_STATUS_ASSOC_STATUS_MASK		0x0F
2882 #define WL_MIMO_PS_STATUS_ASSOC_STATUS_VHT_WITHOUT_OMN	0x80
2883 
2884 /* mimo_ps_status: ap_cap/association status */
2885 enum {
2886 	WL_MIMO_PS_STATUS_ASSOC_NONE	= 0,
2887 	WL_MIMO_PS_STATUS_ASSOC_SISO	= 1,
2888 	WL_MIMO_PS_STATUS_ASSOC_MIMO	= 2,
2889 	WL_MIMO_PS_STATUS_ASSOC_LEGACY	= 3
2890 };
2891 
2892 /* mimo_ps_status: mimo_ps_cfg states */
2893 enum {
2894 	WL_MIMO_PS_CFG_STATE_NONE			= 0,
2895 	WL_MIMO_PS_CFG_STATE_INFORM_AP_INPROGRESS	= 1,
2896 	WL_MIMO_PS_CFG_STATE_INFORM_AP_DONE		= 2,
2897 	WL_MIMO_PS_CFG_STATE_LEARNING			= 3,
2898 	WL_MIMO_PS_CFG_STATE_HW_CONFIGURE		= 4,
2899 	WL_MIMO_PS_CFG_STATE_INFORM_AP_PENDING		= 5
2900 };
2901 
2902 /* mimo_ps_status: hw_state values */
2903 #define WL_MIMO_PS_STATUS_HW_STATE_NONE			0
2904 #define WL_MIMO_PS_STATUS_HW_STATE_LTECOEX		(0x1 << 0)
2905 #define WL_MIMO_PS_STATUS_HW_STATE_MIMOPS_BSS		(0x1 << 1)
2906 #define WL_MIMO_PS_STATUS_HW_STATE_AWDL_BSS		(0x1 << 2)
2907 #define WL_MIMO_PS_STATUS_HW_STATE_SCAN			(0x1 << 3)
2908 #define WL_MIMO_PS_STATUS_HW_STATE_TXPPR		(0x1 << 4)
2909 #define WL_MIMO_PS_STATUS_HW_STATE_PWRTHOTTLE		(0x1 << 5)
2910 #define WL_MIMO_PS_STATUS_HW_STATE_TMPSENSE		(0x1 << 6)
2911 #define WL_MIMO_PS_STATUS_HW_STATE_IOVAR		(0x1 << 7)
2912 #define WL_MIMO_PS_STATUS_HW_STATE_AP_BSS		(0x1 << 8)
2913 
2914 /* mimo_ps_status: mrc states */
2915 #define WL_MIMO_PS_STATUS_MRC_NONE	0
2916 #define WL_MIMO_PS_STATUS_MRC_ACTIVE	1
2917 
2918 /* mimo_ps_status: core flag states for single-core beacon and siso-bcmc rx */
2919 #define WL_MIMO_PS_STATUS_MHF_FLAG_NONE		0
2920 #define WL_MIMO_PS_STATUS_MHF_FLAG_ACTIVE	1
2921 #define WL_MIMO_PS_STATUS_MHF_FLAG_COREDOWN	2
2922 #define WL_MIMO_PS_STATUS_MHF_FLAG_INVALID	3
2923 
2924 /* Type values for the REASON */
2925 #define WL_MIMO_PS_PS_LEARNING_ABORTED          (1 << 0)
2926 #define WL_MIMO_PS_PS_LEARNING_COMPLETED        (1 << 1)
2927 #define WL_MIMO_PS_PS_LEARNING_ONGOING          (1 << 2)
2928 
2929 typedef struct wl_mimo_ps_learning_event_data {
2930 	uint32 startTimeStamp;
2931 	uint32 endTimeStamp;
2932 	uint16 reason;
2933 	struct ether_addr BSSID;
2934 	uint32 totalSISO_below_rssi_threshold;
2935 	uint32 totalMIMO_below_rssi_threshold;
2936 	uint32 totalSISO_above_rssi_threshold;
2937 	uint32 totalMIMO_above_rssi_threshold;
2938 } wl_mimo_ps_learning_event_data_t;
2939 
2940 #define WL_MIMO_PS_PS_LEARNING_CFG_ABORT	(1 << 0)
2941 #define WL_MIMO_PS_PS_LEARNING_CFG_STATUS	(1 << 1)
2942 #define WL_MIMO_PS_PS_LEARNING_CFG_CONFIG	(1 << 2)
2943 #define WL_MIMO_PS_PS_LEARNING_CFG_MASK		(0x7)
2944 
2945 #define WL_MIMO_PS_PS_LEARNING_CFG_V1 1
2946 
2947 typedef struct wl_mimops_learning_cfg {
2948 	/* flag:  bit 0 for abort */
2949 	/* flag:  bit 1 for status */
2950 	/* flag:  bit 2 for configuring no of packets and rssi */
2951 	uint8                  flag;
2952 	/* mimo ps learning version, compatible version is 0 */
2953 	uint8                  version;
2954 	/* if version is 0 or rssi is 0, ignored */
2955 	int8                   learning_rssi_threshold;
2956 	uint8                  reserved;
2957 	uint32                 no_of_packets_for_learning;
2958 	wl_mimo_ps_learning_event_data_t mimops_learning_data;
2959 } wl_mimops_learning_cfg_t;
2960 
2961 #define WL_OCL_STATUS_VERSION 1
2962 typedef struct ocl_status_info {
2963 	uint8  version;
2964 	uint8  len;
2965 	uint16 fw_status;     /* Bits representing FW disable reasons */
2966 	uint8  hw_status;     /* Bits for actual HW config and SISO/MIMO coremask */
2967 	uint8  coremask;      /* The ocl core mask (indicating listening core) */
2968 } ocl_status_info_t;
2969 
2970 /* MWS OCL map */
2971 #define WL_MWS_OCL_OVERRIDE_VERSION 1
2972 typedef struct wl_mws_ocl_override {
2973 	uint16  version;    /* Structure version */
2974 	uint16	bitmap_2g; /* bitmap for 2.4G channels bits 1-13 */
2975 	uint16	bitmap_5g_lo;  /* bitmap for 5G low channels by 2:
2976 				*34-48, 52-56, 60-64, 100-102
2977 				*/
2978 	uint16	bitmap_5g_mid; /* bitmap for 5G mid channels by 2:
2979 				* 104, 108-112, 116-120, 124-128,
2980 				* 132-136, 140, 149-151
2981 				*/
2982 	uint16	bitmap_5g_high; /* bitmap for 5G high channels by 2
2983 				* 153, 157-161, 165
2984 				*/
2985 } wl_mws_ocl_override_t;
2986 
2987 /* Bits for fw_status */
2988 #define OCL_DISABLED_HOST		0x01   /* Host has disabled through ocl_enable */
2989 #define OCL_DISABLED_RSSI		0x02   /* Disabled because of ocl_rssi_threshold */
2990 #define OCL_DISABLED_LTEC		0x04   /* Disabled due to LTE Coex activity */
2991 #define OCL_DISABLED_SISO		0x08   /* Disabled while in SISO mode */
2992 #define OCL_DISABLED_CAL		0x10   /* Disabled during active calibration */
2993 #define OCL_DISABLED_CHANSWITCH		0x20   /* Disabled during active channel switch */
2994 #define OCL_DISABLED_ASPEND     0x40   /* Disabled due to assoc pending */
2995 
2996 /* Bits for hw_status */
2997 #define OCL_HWCFG			0x01   /* State of OCL config bit in phy HW */
2998 #define OCL_HWMIMO			0x02   /* Set if current coremask is > 1 bit */
2999 #define OCL_COREDOWN			0x80   /* Set if core is currently down */
3000 
3001 #define WL_OPS_CFG_VERSION_1  1
3002 /* Common IOVAR struct */
3003 typedef struct wl_ops_cfg_v1 {
3004 	uint16  version;
3005 	uint16 len;		/* total length includes fixed fields and variable data[] */
3006 	uint16 subcmd_id;	/* subcommand id */
3007 	uint16 padding;		/* reserved / padding for 4 byte align */
3008 	uint8 data[];		/* subcommand data; could be empty */
3009 } wl_ops_cfg_v1_t;
3010 
3011 /* subcommands ids */
3012 enum {
3013 	WL_OPS_CFG_SUBCMD_ENABLE =		0,	/* OPS enable/disable mybss and obss
3014 				                         * for nav and plcp options
3015 				                         */
3016 	WL_OPS_CFG_SUBCMD_MAX_SLEEP_DUR =	1,	/* Max sleep duration used for OPS */
3017 	WL_OPS_CFG_SUBCMD_RESET_STATS =		2	/* Reset stats part of ops_status
3018 			                                 * on both slices
3019 				                         */
3020 };
3021 
3022 #define WL_OPS_CFG_MASK				0xffff
3023 #define WL_OPS_CFG_CAP_MASK			0xffff0000
3024 #define WL_OPS_CFG_CAP_SHIFT			16	/* Shift bits to locate the OPS CAP */
3025 #define WL_OPS_MAX_SLEEP_DUR			12500	/* max ops duration in us */
3026 #define WL_OPS_MINOF_MAX_SLEEP_DUR		512	/* minof max ops duration in us */
3027 #define WL_OPS_SUPPORTED_CFG			(WL_OPS_MYBSS_PLCP_DUR | WL_OPS_MYBSS_NAV_DUR \
3028 		                                 | WL_OPS_OBSS_PLCP_DUR | WL_OPS_OBSS_NAV_DUR)
3029 #define WL_OPS_DEFAULT_CFG		        WL_OPS_SUPPORTED_CFG
3030 
3031 /* WL_OPS_CFG_SUBCMD_ENABLE */
3032 typedef struct wl_ops_cfg_enable {
3033 	uint32   bits;   /* selectively enable ops for mybss and obss */
3034 } wl_ops_cfg_enable_t;
3035 /* Bits for WL_OPS_CFG_SUBCMD_ENABLE Parameter */
3036 #define WL_OPS_MYBSS_PLCP_DUR		0x1	/* OPS based on mybss 11b & 11n mixed HT frames
3037 		                                 * PLCP header duration
3038 		                                 */
3039 #define WL_OPS_MYBSS_NAV_DUR		0x2	/* OPS based on mybss RTS-CTS duration */
3040 #define WL_OPS_OBSS_PLCP_DUR		0x4	/* OPS based on obss 11b & 11n mixed HT frames
3041 		                                 * PLCP header duration
3042 		                                 */
3043 #define WL_OPS_OBSS_NAV_DUR		0x8	/* OPS based on obss RTS-CTS duration */
3044 
3045 /* WL_OPS_CFG_SUBCMD_MAX_SLEEP_DUR */
3046 typedef struct wl_ops_cfg_max_sleep_dur {
3047 	uint32  val;   /* maximum sleep duration (us) used for OPS */
3048 } wl_ops_cfg_max_sleep_dur_t;
3049 
3050 /* WL_OPS_CFG_SUBCMD_RESET_STATS */
3051 typedef struct wl_ops_cfg_reset_stats {
3052 	uint32  val;   /* bitmap of slices, 0 means all slices */
3053 } wl_ops_cfg_reset_stats_t;
3054 
3055 #define WL_OPS_STATUS_VERSION_1 1
3056 #define OPS_DUR_HIST_BINS	5	/* number of bins used, 0-1, 1-2, 2-4, 4-8, >8 msec */
3057 typedef struct wl_ops_status_v1 {
3058 	uint16  version;
3059 	uint16  len;			/* Total length including all fixed fields */
3060 	uint8	slice_index;		/* Slice for which status is reported */
3061 	uint8   disable_obss;		/* indicate if obss cfg is disabled */
3062 	uint8   pad[2];			/* 4-byte alignment */
3063 	uint32  disable_reasons;	/* FW disable reasons */
3064 	uint32  disable_duration;	/* ops disable time(ms) due to disable reasons */
3065 	uint32  applied_ops_config;	/* currently applied ops config */
3066 	uint32  partial_ops_dur;	/* Total time (in usec) of partial ops duration */
3067 	uint32  full_ops_dur;		/* Total time (in usec) of full ops duration */
3068 	uint32  count_dur_hist[OPS_DUR_HIST_BINS];	/* ops occurrence histogram */
3069 	uint32  nav_cnt;		/* number of times ops triggered based NAV duration */
3070 	uint32  plcp_cnt;		/* number of times ops triggered based PLCP duration */
3071 	uint32  mybss_cnt;		/* number of times mybss ops trigger */
3072 	uint32  obss_cnt;		/* number of times obss ops trigger */
3073 	uint32  miss_dur_cnt;		/* number of times ops couldn't happen
3074 		                         * due to insufficient duration
3075 		                         */
3076 	uint32  miss_premt_cnt;		/* number of times ops couldn't happen due
3077 		                         * to not meeting Phy preemption thresh
3078 		                         */
3079 	uint32  max_dur_cnt;		/* number of times ops did not trigger due to
3080 		                         * frames exceeding max sleep duration
3081 		                         */
3082 	uint32	wake_cnt;		/* number of ops miss due to wake reason */
3083 	uint32	bcn_wait_cnt;		/* number of ops miss due to waiting for bcn */
3084 } wl_ops_status_v1_t;
3085 /* Bits for disable_reasons */
3086 #define OPS_DISABLED_HOST	0x01	/* Host has disabled through ops_cfg */
3087 #define OPS_DISABLED_UNASSOC	0x02	/* Disabled because the slice is in unassociated state */
3088 #define OPS_DISABLED_SCAN	0x04	/* Disabled because the slice is in scan state */
3089 #define OPS_DISABLED_BCN_MISS	0x08	/* Disabled because beacon missed for a duration */
3090 
3091 #define WL_PSBW_CFG_VERSION_1  1
3092 /* Common IOVAR struct */
3093 typedef struct wl_psbw_cfg_v1 {
3094 	uint16  version;
3095 	uint16 len;			/* total length includes fixed fields and variable data[] */
3096 	uint16 subcmd_id;		/* subcommand id */
3097 	uint16 pad;			/* reserved / padding for 4 byte align */
3098 	uint8 data[];			/* subcommand data */
3099 } wl_psbw_cfg_v1_t;
3100 
3101 /* subcommands ids */
3102 enum {
3103 	/* PSBW enable/disable */
3104 	WL_PSBW_CFG_SUBCMD_ENABLE =                0,
3105 	/* override psbw disable requests */
3106 	WL_PSBW_CFG_SUBCMD_OVERRIDE_DISABLE_MASK = 1,
3107 	/* Reset stats part of psbw status */
3108 	WL_PSBW_CFG_SUBCMD_RESET_STATS =           2
3109 };
3110 
3111 #define WL_PSBW_OVERRIDE_DISA_CFG_MASK			0x0000ffff
3112 #define WL_PSBW_OVERRIDE_DISA_CAP_MASK			0xffff0000
3113 #define WL_PSBW_OVERRIDE_DISA_CAP_SHIFT			16  /* shift bits for cap */
3114 
3115 /* WL_PSBW_CFG_SUBCMD_ENABLE */
3116 typedef struct wl_psbw_cfg_enable {
3117 	bool   enable;		/* enable or disable */
3118 } wl_psbw_cfg_enable_t;
3119 
3120 /* WL_PSBW_CFG_SUBCMD_OVERRIDE_DISABLE_MASK */
3121 typedef struct wl_psbw_cfg_override_disable_mask {
3122 	uint32  mask;		/* disable requests to override, cap and current cfg */
3123 } wl_psbw_cfg_override_disable_mask_t;
3124 
3125 /* WL_PSBW_CFG_SUBCMD_RESET_STATS */
3126 typedef struct wl_psbw_cfg_reset_stats {
3127 	uint32  val;		/* infra interface index, 0 */
3128 } wl_psbw_cfg_reset_stats_t;
3129 
3130 #define WL_PSBW_STATUS_VERSION_1 1
3131 typedef struct wl_psbw_status_v1 {
3132 	uint16  version;
3133 	uint16  len;			/* total length including all fixed fields */
3134 	uint8   curr_slice_index;	/* current slice index of the interface */
3135 	uint8   associated;		/* interface associatd */
3136 	chanspec_t   chspec;		/* radio chspec */
3137 	uint32	state;			/* psbw state */
3138 	uint32  disable_reasons;	/* FW disable reasons */
3139 	uint32  slice_enable_dur;	/* time(ms) psbw remains enabled on this slice */
3140 	uint32  total_enable_dur;	/* time(ms) psbw remains enabled total */
3141 	uint32  enter_cnt;		/* total cnt entering PSBW active */
3142 	uint32  exit_cnt;		/* total cnt exiting PSBW active */
3143 	uint32  exit_imd_cnt;		/* total cnt imd exit when waited N tbtts */
3144 	uint32  enter_skip_cnt;		/* total cnt entering PSBW active skipped */
3145 } wl_psbw_status_v1_t;
3146 
3147 /* Bit for state */
3148 #define PSBW_ACTIVE				0x1 /* active 20MHz */
3149 #define PSBW_TTTT_PEND				0x2 /* waiting for TTTT intr */
3150 #define PSBW_WAIT_ENTER				0x4 /* in wait period before entering */
3151 #define PSBW_CAL_DONE				0x8 /* 20M channel cal done */
3152 
3153 /* Bits for disable_reasons */
3154 #define WL_PSBW_DISA_HOST			0x00000001 /* Host has disabled through psbw_cfg */
3155 #define WL_PSBW_DISA_AP20M			0x00000002 /* AP is operating on 20 MHz */
3156 #define WL_PSBW_DISA_SLOTTED_BSS		0x00000004 /* AWDL or NAN active */
3157 #define WL_PSBW_DISA_NOT_PMFAST			0x00000008 /* Not PM_FAST */
3158 #define WL_PSBW_DISA_BASICRATESET		0x00000010 /* BasicRateSet is empty */
3159 #define WL_PSBW_DISA_NOT_D3			0x00000020 /* PCIe not in D3 */
3160 #define WL_PSBW_DISA_CSA			0x00000040 /* CSA IE is present */
3161 #define WL_PSBW_DISA_ASSOC			0x00000080 /* assoc state is active/or unassoc */
3162 #define WL_PSBW_DISA_SCAN			0x00000100 /* scan state is active */
3163 #define WL_PSBW_DISA_CAL			0x00000200 /* cal pending or active */
3164 /* following are not part of disable reasons */
3165 #define WL_PSBW_EXIT_PM				0x00001000 /* Out of PM */
3166 #define WL_PSBW_EXIT_TIM			0x00002000 /* unicast TIM bit present */
3167 #define WL_PSBW_EXIT_DATA			0x00004000 /* Data for transmission */
3168 #define WL_PSBW_EXIT_MGMTDATA			0x00008000 /* management frame for transmission */
3169 #define WL_PSBW_EXIT_BW_UPD			0x00010000 /* BW being updated */
3170 #define WL_PSBW_DISA_NONE			0x80000000 /* reserved for internal use only */
3171 
3172 /*
3173  * Join preference iovar value is an array of tuples. Each tuple has a one-byte type,
3174  * a one-byte length, and a variable length value.  RSSI type tuple must be present
3175  * in the array.
3176  *
3177  * Types are defined in "join preference types" section.
3178  *
3179  * Length is the value size in octets. It is reserved for WL_JOIN_PREF_WPA type tuple
3180  * and must be set to zero.
3181  *
3182  * Values are defined below.
3183  *
3184  * 1. RSSI - 2 octets
3185  * offset 0: reserved
3186  * offset 1: reserved
3187  *
3188  * 2. WPA - 2 + 12 * n octets (n is # tuples defined below)
3189  * offset 0: reserved
3190  * offset 1: # of tuples
3191  * offset 2: tuple 1
3192  * offset 14: tuple 2
3193  * ...
3194  * offset 2 + 12 * (n - 1) octets: tuple n
3195  *
3196  * struct wpa_cfg_tuple {
3197  *   uint8 akm[DOT11_OUI_LEN+1];     akm suite
3198  *   uint8 ucipher[DOT11_OUI_LEN+1]; unicast cipher suite
3199  *   uint8 mcipher[DOT11_OUI_LEN+1]; multicast cipher suite
3200  * };
3201  *
3202  * multicast cipher suite can be specified as a specific cipher suite or WL_WPA_ACP_MCS_ANY.
3203  *
3204  * 3. BAND - 2 octets
3205  * offset 0: reserved
3206  * offset 1: see "band preference" and "band types"
3207  *
3208  * 4. BAND RSSI - 2 octets
3209  * offset 0: band types
3210  * offset 1: +ve RSSI boost value in dB
3211  */
3212 
3213 struct tsinfo_arg {
3214 	uint8 octets[3];
3215 };
3216 
3217 #define RATE_CCK_1MBPS 0
3218 #define RATE_CCK_2MBPS 1
3219 #define RATE_CCK_5_5MBPS 2
3220 #define RATE_CCK_11MBPS 3
3221 
3222 #define RATE_LEGACY_OFDM_6MBPS 0
3223 #define RATE_LEGACY_OFDM_9MBPS 1
3224 #define RATE_LEGACY_OFDM_12MBPS 2
3225 #define RATE_LEGACY_OFDM_18MBPS 3
3226 #define RATE_LEGACY_OFDM_24MBPS 4
3227 #define RATE_LEGACY_OFDM_36MBPS 5
3228 #define RATE_LEGACY_OFDM_48MBPS 6
3229 #define RATE_LEGACY_OFDM_54MBPS 7
3230 
3231 #define WL_BSSTRANS_RSSI_RATE_MAP_VERSION 1
3232 #define WL_BSSTRANS_RSSI_RATE_MAP_VERSION_V1 1
3233 #define WL_BSSTRANS_RSSI_RATE_MAP_VERSION_V2 2
3234 
3235 typedef struct wl_bsstrans_rssi {
3236 	int8 rssi_2g;	/**< RSSI in dbm for 2.4 G */
3237 	int8 rssi_5g;	/**< RSSI in dbm for 5G, unused for cck */
3238 } wl_bsstrans_rssi_t;
3239 
3240 #define RSSI_RATE_MAP_MAX_STREAMS 4	/**< max streams supported */
3241 
3242 /** RSSI to rate mapping, all 20Mhz, no SGI */
3243 typedef struct wl_bsstrans_rssi_rate_map_v2 {
3244 	uint16 ver;
3245 	uint16 len; /**< length of entire structure */
3246 	wl_bsstrans_rssi_t cck[WL_NUM_RATES_CCK]; /**< 2.4G only */
3247 	wl_bsstrans_rssi_t ofdm[WL_NUM_RATES_OFDM]; /**< 6 to 54mbps */
3248 	wl_bsstrans_rssi_t phy_n[RSSI_RATE_MAP_MAX_STREAMS][WL_NUM_RATES_MCS_1STREAM]; /* MCS0-7 */
3249 	wl_bsstrans_rssi_t phy_ac[RSSI_RATE_MAP_MAX_STREAMS][WL_NUM_RATES_VHT_ALL]; /**< MCS0-11 */
3250 	wl_bsstrans_rssi_t phy_ax[RSSI_RATE_MAP_MAX_STREAMS][WL_NUM_RATES_HE]; /**< MCS0-11 */
3251 } wl_bsstrans_rssi_rate_map_v2_t;
3252 
3253 /** RSSI to rate mapping, all 20Mhz, no SGI */
3254 typedef struct wl_bsstrans_rssi_rate_map_v1 {
3255 	uint16 ver;
3256 	uint16 len; /**< length of entire structure */
3257 	wl_bsstrans_rssi_t cck[WL_NUM_RATES_CCK]; /**< 2.4G only */
3258 	wl_bsstrans_rssi_t ofdm[WL_NUM_RATES_OFDM]; /**< 6 to 54mbps */
3259 	wl_bsstrans_rssi_t phy_n[RSSI_RATE_MAP_MAX_STREAMS][WL_NUM_RATES_MCS_1STREAM]; /* MCS0-7 */
3260 	wl_bsstrans_rssi_t phy_ac[RSSI_RATE_MAP_MAX_STREAMS][WL_NUM_RATES_VHT]; /**< MCS0-9 */
3261 } wl_bsstrans_rssi_rate_map_v1_t;
3262 
3263 /** RSSI to rate mapping, all 20Mhz, no SGI */
3264 typedef struct wl_bsstrans_rssi_rate_map {
3265 	uint16 ver;
3266 	uint16 len; /**< length of entire structure */
3267 	wl_bsstrans_rssi_t cck[WL_NUM_RATES_CCK]; /**< 2.4G only */
3268 	wl_bsstrans_rssi_t ofdm[WL_NUM_RATES_OFDM]; /**< 6 to 54mbps */
3269 	wl_bsstrans_rssi_t phy_n[RSSI_RATE_MAP_MAX_STREAMS][WL_NUM_RATES_MCS_1STREAM]; /* MCS0-7 */
3270 	wl_bsstrans_rssi_t phy_ac[RSSI_RATE_MAP_MAX_STREAMS][WL_NUM_RATES_VHT]; /**< MCS0-9 */
3271 } wl_bsstrans_rssi_rate_map_t;
3272 
3273 #define WL_BSSTRANS_ROAMTHROTTLE_VERSION 1
3274 
3275 /** Configure number of scans allowed per throttle period */
3276 typedef struct wl_bsstrans_roamthrottle {
3277 	uint16 ver;
3278 	uint16 period;
3279 	uint16 scans_allowed;
3280 } wl_bsstrans_roamthrottle_t;
3281 
3282 #define	NFIFO			6	/**< # tx/rx fifopairs */
3283 
3284 #if defined(BCM_AQM_DMA_DESC) && !defined(BCM_AQM_DMA_DESC_DISABLED)
3285 #if defined(WL_MU_TX) && !defined(WL_MU_TX_DISABLED)
3286 #define NFIFO_EXT		32		/* 6 traditional FIFOs + 2 rsvd + 24 MU FIFOs */
3287 #else
3288 #define NFIFO_EXT		10		/* 4EDCA + 4 TWT + 1 Mcast/Bcast + 1 Spare */
3289 #endif // endif
3290 #elif defined(WL11AX_TRIGGERQ) && !defined(WL11AX_TRIGGERQ_DISABLED)
3291 #define NFIFO_EXT		10
3292 #else
3293 #define NFIFO_EXT		NFIFO
3294 #endif /* BCM_AQM_DMA_DESC && !BCM_AQM_DMA_DESC_DISABLED */
3295 
3296 /* Reinit reason codes */
3297 enum {
3298 	WL_REINIT_RC_NONE             = 0,
3299 	WL_REINIT_RC_PS_SYNC          = 1,
3300 	WL_REINIT_RC_PSM_WD           = 2,
3301 	WL_REINIT_RC_MAC_WAKE         = 3,
3302 	WL_REINIT_RC_MAC_SUSPEND      = 4,
3303 	WL_REINIT_RC_MAC_SPIN_WAIT    = 5,
3304 	WL_REINIT_RC_AXI_BUS_ERROR    = 6,
3305 	WL_REINIT_RC_DEVICE_REMOVED   = 7,
3306 	WL_REINIT_RC_PCIE_FATAL_ERROR = 8,
3307 	WL_REINIT_RC_OL_FW_TRAP       = 9,
3308 	WL_REINIT_RC_FIFO_ERR         = 10,
3309 	WL_REINIT_RC_INV_TX_STATUS    = 11,
3310 	WL_REINIT_RC_MQ_ERROR         = 12,
3311 	WL_REINIT_RC_PHYTXERR_THRESH  = 13,
3312 	WL_REINIT_RC_USER_FORCED      = 14,
3313 	WL_REINIT_RC_FULL_RESET       = 15,
3314 	WL_REINIT_RC_AP_BEACON        = 16,
3315 	WL_REINIT_RC_PM_EXCESSED      = 17,
3316 	WL_REINIT_RC_NO_CLK           = 18,
3317 	WL_REINIT_RC_SW_ASSERT        = 19,
3318 	WL_REINIT_RC_PSM_JMP0         = 20,
3319 	WL_REINIT_RC_PSM_RUN          = 21,
3320 	WL_REINIT_RC_ENABLE_MAC       = 22,
3321 	WL_REINIT_RC_SCAN_TIMEOUT     = 23,
3322 	WL_REINIT_RC_JOIN_TIMEOUT     = 24,
3323 	/* Below error codes are generated during D3 exit validation */
3324 	WL_REINIT_RC_LINK_NOT_ACTIVE  = 25,
3325 	WL_REINIT_RC_PCI_CFG_RD_FAIL  = 26,
3326 	WL_REINIT_RC_INV_VEN_ID       = 27,
3327 	WL_REINIT_RC_INV_DEV_ID       = 28,
3328 	WL_REINIT_RC_INV_BAR0         = 29,
3329 	WL_REINIT_RC_INV_BAR2         = 30,
3330 	WL_REINIT_RC_AER_UC_FATAL     = 31,
3331 	WL_REINIT_RC_AER_UC_NON_FATAL = 32,
3332 	WL_REINIT_RC_AER_CORR         = 33,
3333 	WL_REINIT_RC_AER_DEV_STS      = 34,
3334 	WL_REINIT_RC_PCIe_STS         = 35,
3335 	WL_REINIT_RC_MMIO_RD_FAIL     = 36,
3336 	WL_REINIT_RC_MMIO_RD_INVAL    = 37,
3337 	WL_REINIT_RC_MMIO_ARM_MEM_RD_FAIL = 38,
3338 	WL_REINIT_RC_MMIO_ARM_MEM_INVAL   = 39,
3339 	WL_REINIT_RC_SROM_LOAD_FAILED     = 40,
3340 	WL_REINIT_RC_PHY_CRASH            = 41,
3341 	WL_REINIT_TX_STALL                = 42,
3342 	WL_REINIT_RC_TX_FLOW_CONTROL_BLOCKED	= 43,
3343 	WL_REINIT_RC_RX_HC_FAIL           = 44,
3344 	WL_REINIT_RC_RX_DMA_STALL         = 45,
3345 	WL_REINIT_UTRACE_BUF_OVERLAP_SR	  = 46,
3346 	WL_REINIT_UTRACE_TPL_OUT_BOUNDS   = 47,
3347 	WL_REINIT_UTRACE_TPL_OSET_STRT0   = 48,
3348 	WL_REINIT_RC_PHYTXERR             = 49,
3349 	WL_REINIT_RC_PSM_FATAL_SUSP       = 50,
3350 	WL_REINIT_RC_TX_FIFO_SUSP         = 51,
3351 	WL_REINIT_RC_MAC_ENABLE           = 52,
3352 	WL_REINIT_RC_SCAN_STALLED         = 53,
3353 	WL_REINIT_RC_PHY_HC		  = 54,
3354 	WL_REINIT_RC_LAST	/* This must be the last entry */
3355 };
3356 
3357 #define NREINITREASONCOUNT	8
3358 
3359 #define REINITRSNIDX(_x)	(((_x) < WL_REINIT_RC_LAST) ? (_x) : 0)
3360 
3361 #define	WL_CNT_T_VERSION	30	/**< current version of wl_cnt_t struct */
3362 #define WL_CNT_VERSION_6	6
3363 #define WL_CNT_VERSION_7	7
3364 #define WL_CNT_VERSION_11	11
3365 #define WL_CNT_VERSION_XTLV	30
3366 
3367 #define WL_COUNTERS_IOV_VERSION_1	1
3368 #define WL_SUBCNTR_IOV_VER		WL_COUNTERS_IOV_VERSION_1
3369 /* First two uint16 are version and lenght fields. So offset of the first counter will be 4 */
3370 #define FIRST_COUNTER_OFFSET		0x04
3371 
3372 #define WLC_WITH_XTLV_CNT
3373 
3374 /* Number of xtlv info as required to calculate subcounter offsets */
3375 #define WL_CNT_XTLV_ID_NUM	10
3376 #define WL_TLV_IOV_VER		1
3377 
3378 /**
3379  * tlv IDs uniquely identifies counter component
3380  * packed into wl_cmd_t container
3381  */
3382 enum wl_cnt_xtlv_id {
3383 	WL_CNT_XTLV_SLICE_IDX = 0x1,		/**< Slice index */
3384 	WL_CNT_XTLV_WLC = 0x100,		/**< WLC layer counters */
3385 	WL_CNT_XTLV_WLC_RINIT_RSN = 0x101,	/**< WLC layer reinitreason extension */
3386 	WL_CNT_XTLV_WLC_HE = 0x102,		/* he counters */
3387 	WL_CNT_XTLV_WLC_SECVLN = 0x103,		/* security vulnerabilities counters */
3388 	WL_CNT_XTLV_CNTV_LE10_UCODE = 0x200,	/**< wl counter ver < 11 UCODE MACSTAT */
3389 	WL_CNT_XTLV_LT40_UCODE_V1 = 0x300,	/**< corerev < 40 UCODE MACSTAT */
3390 	WL_CNT_XTLV_GE40_UCODE_V1 = 0x400,	/**< corerev >= 40 UCODE MACSTAT */
3391 	WL_CNT_XTLV_GE64_UCODEX_V1 = 0x800,	/* corerev >= 64 UCODEX MACSTAT */
3392 	WL_CNT_XTLV_GE80_UCODE_V1 = 0x900,	/* corerev >= 80 UCODEX MACSTAT */
3393 	WL_CNT_XTLV_GE80_TXFUNFL_UCODE_V1 = 0x1000	/* corerev >= 80 UCODEX MACSTAT */
3394 };
3395 
3396 /* tlv IDs uniquely identifies periodic state component */
3397 enum wl_periodic_slice_state_xtlv_id {
3398 	WL_STATE_COMPACT_COUNTERS = 0x1,
3399 	WL_STATE_TXBF_COUNTERS = 0x2,
3400 	WL_STATE_COMPACT_HE_COUNTERS = 0x3
3401 };
3402 
3403 /* tlv IDs uniquely identifies periodic state component */
3404 enum wl_periodic_if_state_xtlv_id {
3405 	WL_STATE_IF_COMPACT_STATE = 0x1,
3406 	WL_STATE_IF_ADPS_STATE = 0x02
3407 };
3408 
3409 #define TDMTX_CNT_VERSION_V1      1
3410 #define TDMTX_CNT_VERSION_V2      2
3411 
3412 /* structure holding tdm counters that interface to iovar */
3413 typedef struct tdmtx_cnt_v1 {
3414 	uint16 ver;
3415 	uint16 length; /* length of this structure */
3416 	uint16 wlc_idx; /* index for wlc */
3417 	uint16 enabled; /* tdmtx is enabled on slice */
3418 	uint32 tdmtx_txa_on; /* TXA on requests */
3419 	uint32 tdmtx_txa_tmcnt; /* Total number of TXA timeout */
3420 	uint32 tdmtx_por_on; /* TXA POR requests */
3421 	uint32 tdmtx_txpuen; /* Path enable requests */
3422 	uint32 tdmtx_txpudis; /* Total number of times Tx path is muted on the slice */
3423 	uint32 tdmtx_txpri_on; /* Total number of times Tx priority was obtained by the slice */
3424 	uint32 tdmtx_txdefer; /* Total number of times Tx was deferred on the slice */
3425 	uint32 tdmtx_txmute; /* Total number of times active Tx muted on the slice */
3426 	uint32 tdmtx_actpwrboff; /* Total number of times TX power is backed off by the slice */
3427 	uint32 tdmtx_txa_dur; /* Total time txa on */
3428 	uint32 tdmtx_txpri_dur; /* Total time TXPri */
3429 	uint32 tdmtx_txdefer_dur; /* Total time txdefer */
3430 	/* TDMTX input fields */
3431 	uint32 tdmtx_txpri;
3432 	uint32 tdmtx_defer;
3433 	uint32 tdmtx_threshold;
3434 	uint32 tdmtx_rssi_threshold;
3435 	uint32 tdmtx_txpwrboff;
3436 	uint32 tdmtx_txpwrboff_dt;
3437 } tdmtx_cnt_v1_t;
3438 
3439 typedef struct {
3440 	uint16  ver;
3441 	uint16	length; /* length of the data portion */
3442 	uint16  cnt;
3443 	uint16	pad; /* pad to align to 32 bit */
3444 	uint8   data[]; /* array of tdmtx_cnt_v1_t */
3445 } tdmtx_status_t;
3446 
3447 /* structure holding counters that match exactly shm field sizes */
3448 typedef struct tdmtx_cnt_shm_v1 {
3449 	uint16 tdmtx_txa_on; /* TXA on requests */
3450 	uint16 tdmtx_tmcnt; /* TXA on requests */
3451 	uint16 tdmtx_por_on; /* TXA POR requests */
3452 	uint16 tdmtx_txpuen; /* Path enable requests */
3453 	uint16 tdmtx_txpudis; /* Total number of times Tx path is muted on the slice */
3454 	uint16 tdmtx_txpri_on; /* Total number of times Tx priority was obtained by the slice */
3455 	uint16 tdmtx_txdefer; /* Total number of times Tx was defered by the slice */
3456 	uint16 tdmtx_txmute; /* Total number of times active Tx muted on the slice */
3457 	uint16 tdmtx_actpwrboff; /* Total number of times TX power is backed off by the slice */
3458 	uint16 tdmtx_txa_dur_l; /* Total time (low 16 bits) txa on */
3459 	uint16 tdmtx_txa_dur_h; /* Total time (low 16 bits) txa on */
3460 	uint16 tdmtx_txpri_dur_l; /* Total time (low 16 bits) TXPri */
3461 	uint16 tdmtx_txpri_dur_h; /* Total time (high 16 bits) TXPri */
3462 	uint16 tdmtx_txdefer_dur_l; /* Total time (low 16 bits)  txdefer */
3463 	uint16 tdmtx_txdefer_dur_h; /* Total time (high 16 bits) txdefer */
3464 } tdmtx_cnt_shm_v1_t;
3465 
3466 /* structure holding tdm counters that interface to iovar for version 2 */
3467 typedef struct tdmtx_cnt_v2 {
3468 	uint16 ver;
3469 	uint16 length; /* length of this structure */
3470 	uint16 wlc_idx; /* index for wlc */
3471 	uint16 enabled; /* tdmtx is enabled on slice */
3472 	uint32 tdmtx_txa_on; /* TXA on requests */
3473 	uint32 tdmtx_txa_tmcnt; /* Total number of TXA timeout */
3474 	uint32 tdmtx_porhi_on; /* TXA PORHI requests */
3475 	uint32 tdmtx_porlo_on; /* TXA PORLO requests */
3476 	uint32 tdmtx_txpuen; /* Path enable requests */
3477 	uint32 tdmtx_txpudis; /* Total number of times Tx path is muted on the slice */
3478 	uint32 tdmtx_txpri_on; /* Total number of times Tx priority was obtained by the slice */
3479 	uint32 tdmtx_txdefer; /* Total number of times Tx was deferred on the slice */
3480 	uint32 tdmtx_txmute; /* Total number of times active Tx muted on the slice */
3481 	uint32 tdmtx_actpwrboff; /* Total number of times TX power is backed off by the slice */
3482 	uint32 tdmtx_txa_dur; /* Total time txa on */
3483 	uint32 tdmtx_txpri_dur; /* Total time TXPri */
3484 	uint32 tdmtx_txdefer_dur; /* Total time txdefer */
3485 	/* TDMTX input fields */
3486 	uint32 tdmtx_txpri;
3487 	uint32 tdmtx_defer;
3488 	uint32 tdmtx_threshold;
3489 	uint32 tdmtx_rssi_threshold;
3490 	uint32 tdmtx_txpwrboff;
3491 	uint32 tdmtx_txpwrboff_dt;
3492 } tdmtx_cnt_v2_t;
3493 
3494 /* structure holding counters that match exactly shm field sizes */
3495 typedef struct tdmtx_cnt_shm_v2 {
3496 	uint16 tdmtx_txa_on; /* TXA on requests */
3497 	uint16 tdmtx_tmcnt; /* TXA on requests */
3498 	uint16 tdmtx_porhi_on; /* TXA PORHI requests */
3499 	uint16 tdmtx_porlo_on; /* TXA PORLO requests */
3500 	uint16 tdmtx_txpuen; /* Path enable requests */
3501 	uint16 tdmtx_txpudis; /* Total number of times Tx path is muted on the slice */
3502 	uint16 tdmtx_txpri_on; /* Total number of times Tx priority was obtained by the slice */
3503 	uint16 tdmtx_txdefer; /* Total number of times Tx was defered by the slice */
3504 	uint16 tdmtx_txmute; /* Total number of times active Tx muted on the slice */
3505 	uint16 tdmtx_actpwrboff; /* Total number of times TX power is backed off by the slice */
3506 	uint16 tdmtx_txa_dur_l; /* Total time (low 16 bits) txa on */
3507 	uint16 tdmtx_txa_dur_h; /* Total time (low 16 bits) txa on */
3508 	uint16 tdmtx_txpri_dur_l; /* Total time (low 16 bits) TXPri */
3509 	uint16 tdmtx_txpri_dur_h; /* Total time (high 16 bits) TXPri */
3510 	uint16 tdmtx_txdefer_dur_l; /* Total time (low 16 bits)  txdefer */
3511 	uint16 tdmtx_txdefer_dur_h; /* Total time (high 16 bits) txdefer */
3512 } tdmtx_cnt_shm_v2_t;
3513 
3514 typedef struct wl_tdmtx_ioc {
3515 	uint16 id;	/* ID of the sub-command */
3516 	uint16 len;	/* total length of all data[] */
3517 	uint8  data[];	/* var len payload */
3518 } wl_tdmtx_ioc_t;
3519 
3520 /*
3521  * iovar subcommand ids
3522  */
3523 enum {
3524 	IOV_TDMTX_ENB = 1,
3525 	IOV_TDMTX_STATUS = 2,
3526 	IOV_TDMTX_TXPRI = 3,
3527 	IOV_TDMTX_DEFER = 4,
3528 	IOV_TDMTX_TXA = 5,
3529 	IOV_TDMTX_CFG = 6,
3530 	IOV_TDMTX_LAST
3531 };
3532 
3533 /**
3534  * The number of variables in wl macstat cnt struct.
3535  * (wl_cnt_ge40mcst_v1_t, wl_cnt_lt40mcst_v1_t, wl_cnt_v_le10_mcst_t)
3536  */
3537 #define WL_CNT_MCST_VAR_NUM 64
3538 /* sizeof(wl_cnt_ge40mcst_v1_t), sizeof(wl_cnt_lt40mcst_v1_t), and sizeof(wl_cnt_v_le10_mcst_t) */
3539 #define WL_CNT_MCST_STRUCT_SZ ((uint32)sizeof(uint32) * WL_CNT_MCST_VAR_NUM)
3540 #define WL_CNT_REV80_MCST_STRUCT_SZ ((uint32)sizeof(wl_cnt_ge80mcst_v1_t))
3541 #define WL_CNT_REV80_MCST_TXFUNFlW_STRUCT_FIXED_SZ \
3542 	((uint32)OFFSETOF(wl_cnt_ge80_txfunfl_v1_t, txfunfl))
3543 #define WL_CNT_REV80_MCST_TXFUNFl_STRUCT_SZ(fcnt) \
3544 	(WL_CNT_REV80_MCST_TXFUNFlW_STRUCT_FIXED_SZ + (fcnt * sizeof(uint32)))
3545 #define WL_CNT_REV80_MCST_TXFUNFlW_STRUCT_SZ (WL_CNT_REV80_MCST_TXFUNFl_STRUCT_SZ(NFIFO_EXT))
3546 
3547 #define WL_CNT_MCXST_STRUCT_SZ ((uint32)sizeof(wl_cnt_ge64mcxst_v1_t))
3548 
3549 #define WL_CNT_HE_STRUCT_SZ ((uint32)sizeof(wl_he_cnt_wlc_t))
3550 
3551 #define WL_CNT_SECVLN_STRUCT_SZ ((uint32)sizeof(wl_secvln_cnt_t))
3552 
3553 #define INVALID_CNT_VAL (uint32)(-1)
3554 
3555 #define WL_XTLV_CNTBUF_MAX_SIZE ((uint32)(OFFSETOF(wl_cnt_info_t, data)) +	\
3556 		(uint32)BCM_XTLV_HDR_SIZE + (uint32)sizeof(wl_cnt_wlc_t) +		\
3557 		(uint32)BCM_XTLV_HDR_SIZE + WL_CNT_MCST_STRUCT_SZ +              \
3558 		(uint32)BCM_XTLV_HDR_SIZE + WL_CNT_MCXST_STRUCT_SZ)
3559 
3560 #define WL_CNTBUF_MAX_SIZE MAX(WL_XTLV_CNTBUF_MAX_SIZE, (uint32)sizeof(wl_cnt_ver_11_t))
3561 
3562 /** Top structure of counters IOVar buffer */
3563 typedef struct {
3564 	uint16	version;	/**< see definition of WL_CNT_T_VERSION */
3565 	uint16	datalen;	/**< length of data including all paddings. */
3566 	uint8   data [];	/**< variable length payload:
3567 				 * 1 or more bcm_xtlv_t type of tuples.
3568 				 * each tuple is padded to multiple of 4 bytes.
3569 				 * 'datalen' field of this structure includes all paddings.
3570 				 */
3571 } wl_cnt_info_t;
3572 
3573 /* Top structure of subcounters IOVar buffer
3574  * Whenever we make any change in this structure
3575  * WL_SUBCNTR_IOV_VER should be updated accordingly
3576  * The structure definition should remain consistant b/w
3577  * FW and wl/WLM app.
3578  */
3579 typedef struct {
3580 	uint16	version;	  /* Version of IOVAR structure. Used for backward
3581 				   * compatibility in future. Whenever we make any
3582 				   * changes to this structure then value of WL_SUBCNTR_IOV_VER
3583 				   * needs to be updated properly.
3584 				   */
3585 	uint16	length;		  /* length in bytes of this structure */
3586 	uint16	counters_version; /* see definition of WL_CNT_T_VERSION
3587 				   * wl app will send the version of counters
3588 				   * which is used to calculate the offset of counters.
3589 				   * It must match the version of counters FW is using
3590 				   * else FW will return error with his version of counters
3591 				   * set in this field.
3592 				   */
3593 	uint16	num_subcounters;  /* Number of counter offset passed by wl app to FW. */
3594 	uint32	data[1];	  /* variable length payload:
3595 				   * Offsets to the counters will be passed to FW
3596 				   * throught this data field. FW will return the value of counters
3597 				   * at the offsets passed by wl app in this fiels itself.
3598 				   */
3599 } wl_subcnt_info_t;
3600 
3601 /* Top structure of counters TLV version IOVar buffer
3602  * The structure definition should remain consistant b/w
3603  * FW and wl/WLM app.
3604  */
3605 typedef struct {
3606 	uint16   version;	/* Version of IOVAR structure. Added for backward
3607 			* compatibility feature. If any changes are done,
3608 			* WL_TLV_IOV_VER need to be updated.
3609 			*/
3610 	uint16   length;	/* total len in bytes of this structure + payload */
3611 	uint16   counters_version;	/* See definition of WL_CNT_VERSION_XTLV
3612 			* wl app will update counter tlv version to be used
3613 			* so to calculate offset of supported TLVs.
3614 			* If there is a mismatch in the version, FW will update an error
3615 			*/
3616 	uint16  num_tlv;	/* Max number of TLV info passed by FW to WL app.
3617 			* and vice-versa
3618 			*/
3619 	uint32   data[];	/* variable length payload:
3620 			* This stores the tlv as supported by F/W to the wl app.
3621 			* This table is required to compute subcounter offsets at WLapp end.
3622 			*/
3623 } wl_cntr_tlv_info_t;
3624 
3625 /** wlc layer counters */
3626 typedef struct {
3627 	/* transmit stat counters */
3628 	uint32	txframe;	/**< tx data frames */
3629 	uint32	txbyte;		/**< tx data bytes */
3630 	uint32	txretrans;	/**< tx mac retransmits */
3631 	uint32	txerror;	/**< tx data errors (derived: sum of others) */
3632 	uint32	txctl;		/**< tx management frames */
3633 	uint32	txprshort;	/**< tx short preamble frames */
3634 	uint32	txserr;		/**< tx status errors */
3635 	uint32	txnobuf;	/**< tx out of buffers errors */
3636 	uint32	txnoassoc;	/**< tx discard because we're not associated */
3637 	uint32	txrunt;		/**< tx runt frames */
3638 	uint32	txchit;		/**< tx header cache hit (fastpath) */
3639 	uint32	txcmiss;	/**< tx header cache miss (slowpath) */
3640 
3641 	/* transmit chip error counters */
3642 	uint32	txuflo;		/**< tx fifo underflows */
3643 	uint32	txphyerr;	/**< tx phy errors (indicated in tx status) */
3644 	uint32	txphycrs;
3645 
3646 	/* receive stat counters */
3647 	uint32	rxframe;	/**< rx data frames */
3648 	uint32	rxbyte;		/**< rx data bytes */
3649 	uint32	rxerror;	/**< rx data errors (derived: sum of others) */
3650 	uint32	rxctl;		/**< rx management frames */
3651 	uint32	rxnobuf;	/**< rx out of buffers errors */
3652 	uint32	rxnondata;	/**< rx non data frames in the data channel errors */
3653 	uint32	rxbadds;	/**< rx bad DS errors */
3654 	uint32	rxbadcm;	/**< rx bad control or management frames */
3655 	uint32	rxfragerr;	/**< rx fragmentation errors */
3656 	uint32	rxrunt;		/**< rx runt frames */
3657 	uint32	rxgiant;	/**< rx giant frames */
3658 	uint32	rxnoscb;	/**< rx no scb error */
3659 	uint32	rxbadproto;	/**< rx invalid frames */
3660 	uint32	rxbadsrcmac;	/**< rx frames with Invalid Src Mac */
3661 	uint32	rxbadda;	/**< rx frames tossed for invalid da */
3662 	uint32	rxfilter;	/**< rx frames filtered out */
3663 
3664 	/* receive chip error counters */
3665 	uint32	rxoflo;		/**< rx fifo overflow errors */
3666 	uint32	rxuflo[NFIFO];	/**< rx dma descriptor underflow errors */
3667 
3668 	uint32	d11cnt_txrts_off;	/**< d11cnt txrts value when reset d11cnt */
3669 	uint32	d11cnt_rxcrc_off;	/**< d11cnt rxcrc value when reset d11cnt */
3670 	uint32	d11cnt_txnocts_off;	/**< d11cnt txnocts value when reset d11cnt */
3671 
3672 	/* misc counters */
3673 	uint32	dmade;		/**< tx/rx dma descriptor errors */
3674 	uint32	dmada;		/**< tx/rx dma data errors */
3675 	uint32	dmape;		/**< tx/rx dma descriptor protocol errors */
3676 	uint32	reset;		/**< reset count */
3677 	uint32	tbtt;		/**< cnts the TBTT int's */
3678 	uint32	txdmawar;
3679 	uint32	pkt_callback_reg_fail;	/**< callbacks register failure */
3680 
3681 	/* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
3682 	uint32	txfrag;		/**< dot11TransmittedFragmentCount */
3683 	uint32	txmulti;	/**< dot11MulticastTransmittedFrameCount */
3684 	uint32	txfail;		/**< dot11FailedCount */
3685 	uint32	txretry;	/**< dot11RetryCount */
3686 	uint32	txretrie;	/**< dot11MultipleRetryCount */
3687 	uint32	rxdup;		/**< dot11FrameduplicateCount */
3688 	uint32	txrts;		/**< dot11RTSSuccessCount */
3689 	uint32	txnocts;	/**< dot11RTSFailureCount */
3690 	uint32	txnoack;	/**< dot11ACKFailureCount */
3691 	uint32	rxfrag;		/**< dot11ReceivedFragmentCount */
3692 	uint32	rxmulti;	/**< dot11MulticastReceivedFrameCount */
3693 	uint32	rxcrc;		/**< dot11FCSErrorCount */
3694 	uint32	txfrmsnt;	/**< dot11TransmittedFrameCount (bogus MIB?) */
3695 	uint32	rxundec;	/**< dot11WEPUndecryptableCount */
3696 
3697 	/* WPA2 counters (see rxundec for DecryptFailureCount) */
3698 	uint32	tkipmicfaill;	/**< TKIPLocalMICFailures */
3699 	uint32	tkipcntrmsr;	/**< TKIPCounterMeasuresInvoked */
3700 	uint32	tkipreplay;	/**< TKIPReplays */
3701 	uint32	ccmpfmterr;	/**< CCMPFormatErrors */
3702 	uint32	ccmpreplay;	/**< CCMPReplays */
3703 	uint32	ccmpundec;	/**< CCMPDecryptErrors */
3704 	uint32	fourwayfail;	/**< FourWayHandshakeFailures */
3705 	uint32	wepundec;	/**< dot11WEPUndecryptableCount */
3706 	uint32	wepicverr;	/**< dot11WEPICVErrorCount */
3707 	uint32	decsuccess;	/**< DecryptSuccessCount */
3708 	uint32	tkipicverr;	/**< TKIPICVErrorCount */
3709 	uint32	wepexcluded;	/**< dot11WEPExcludedCount */
3710 
3711 	uint32	txchanrej;	/**< Tx frames suppressed due to channel rejection */
3712 	uint32	psmwds;		/**< Count PSM watchdogs */
3713 	uint32	phywatchdog;	/**< Count Phy watchdogs (triggered by ucode) */
3714 
3715 	/* MBSS counters, AP only */
3716 	uint32	prq_entries_handled;	/**< PRQ entries read in */
3717 	uint32	prq_undirected_entries;	/**<    which were bcast bss & ssid */
3718 	uint32	prq_bad_entries;	/**<    which could not be translated to info */
3719 	uint32	atim_suppress_count;	/**< TX suppressions on ATIM fifo */
3720 	uint32	bcn_template_not_ready;	/**< Template marked in use on send bcn ... */
3721 	uint32	bcn_template_not_ready_done; /**< ...but "DMA done" interrupt rcvd */
3722 	uint32	late_tbtt_dpc;	/**< TBTT DPC did not happen in time */
3723 
3724 	/* per-rate receive stat counters */
3725 	uint32  rx1mbps;	/**< packets rx at 1Mbps */
3726 	uint32  rx2mbps;	/**< packets rx at 2Mbps */
3727 	uint32  rx5mbps5;	/**< packets rx at 5.5Mbps */
3728 	uint32  rx6mbps;	/**< packets rx at 6Mbps */
3729 	uint32  rx9mbps;	/**< packets rx at 9Mbps */
3730 	uint32  rx11mbps;	/**< packets rx at 11Mbps */
3731 	uint32  rx12mbps;	/**< packets rx at 12Mbps */
3732 	uint32  rx18mbps;	/**< packets rx at 18Mbps */
3733 	uint32  rx24mbps;	/**< packets rx at 24Mbps */
3734 	uint32  rx36mbps;	/**< packets rx at 36Mbps */
3735 	uint32  rx48mbps;	/**< packets rx at 48Mbps */
3736 	uint32  rx54mbps;	/**< packets rx at 54Mbps */
3737 	uint32  rx108mbps;	/**< packets rx at 108mbps */
3738 	uint32  rx162mbps;	/**< packets rx at 162mbps */
3739 	uint32  rx216mbps;	/**< packets rx at 216 mbps */
3740 	uint32  rx270mbps;	/**< packets rx at 270 mbps */
3741 	uint32  rx324mbps;	/**< packets rx at 324 mbps */
3742 	uint32  rx378mbps;	/**< packets rx at 378 mbps */
3743 	uint32  rx432mbps;	/**< packets rx at 432 mbps */
3744 	uint32  rx486mbps;	/**< packets rx at 486 mbps */
3745 	uint32  rx540mbps;	/**< packets rx at 540 mbps */
3746 
3747 	uint32	rfdisable;	/**< count of radio disables */
3748 
3749 	uint32	txexptime;	/**< Tx frames suppressed due to timer expiration */
3750 
3751 	uint32	txmpdu_sgi;	/**< count for sgi transmit */
3752 	uint32	rxmpdu_sgi;	/**< count for sgi received */
3753 	uint32	txmpdu_stbc;	/**< count for stbc transmit */
3754 	uint32	rxmpdu_stbc;	/**< count for stbc received */
3755 
3756 	uint32	rxundec_mcst;	/**< dot11WEPUndecryptableCount */
3757 
3758 	/* WPA2 counters (see rxundec for DecryptFailureCount) */
3759 	uint32	tkipmicfaill_mcst;	/**< TKIPLocalMICFailures */
3760 	uint32	tkipcntrmsr_mcst;	/**< TKIPCounterMeasuresInvoked */
3761 	uint32	tkipreplay_mcst;	/**< TKIPReplays */
3762 	uint32	ccmpfmterr_mcst;	/**< CCMPFormatErrors */
3763 	uint32	ccmpreplay_mcst;	/**< CCMPReplays */
3764 	uint32	ccmpundec_mcst;	/**< CCMPDecryptErrors */
3765 	uint32	fourwayfail_mcst;	/**< FourWayHandshakeFailures */
3766 	uint32	wepundec_mcst;	/**< dot11WEPUndecryptableCount */
3767 	uint32	wepicverr_mcst;	/**< dot11WEPICVErrorCount */
3768 	uint32	decsuccess_mcst;	/**< DecryptSuccessCount */
3769 	uint32	tkipicverr_mcst;	/**< TKIPICVErrorCount */
3770 	uint32	wepexcluded_mcst;	/**< dot11WEPExcludedCount */
3771 
3772 	uint32	dma_hang;	/**< count for dma hang */
3773 	uint32	reinit;		/**< count for reinit */
3774 
3775 	uint32  pstatxucast;	/**< count of ucast frames xmitted on all psta assoc */
3776 	uint32  pstatxnoassoc;	/**< count of txnoassoc frames xmitted on all psta assoc */
3777 	uint32  pstarxucast;	/**< count of ucast frames received on all psta assoc */
3778 	uint32  pstarxbcmc;	/**< count of bcmc frames received on all psta */
3779 	uint32  pstatxbcmc;	/**< count of bcmc frames transmitted on all psta */
3780 
3781 	uint32  cso_passthrough; /**< hw cso required but passthrough */
3782 	uint32	cso_normal;	/**< hw cso hdr for normal process */
3783 	uint32	chained;	/**< number of frames chained */
3784 	uint32	chainedsz1;	/**< number of chain size 1 frames */
3785 	uint32	unchained;	/**< number of frames not chained */
3786 	uint32	maxchainsz;	/**< max chain size so far */
3787 	uint32	currchainsz;	/**< current chain size */
3788 	uint32	pciereset;	/**< Secondary Bus Reset issued by driver */
3789 	uint32	cfgrestore;	/**< configspace restore by driver */
3790 	uint32	reinitreason[NREINITREASONCOUNT]; /**< reinitreason counters; 0: Unknown reason */
3791 	uint32	rxrtry;
3792 	uint32  rxmpdu_mu;      /**< Number of MU MPDUs received */
3793 
3794 	/* detailed control/management frames */
3795 	uint32	txbar;		/**< Number of TX BAR */
3796 	uint32	rxbar;		/**< Number of RX BAR */
3797 	uint32	txpspoll;	/**< Number of TX PS-poll */
3798 	uint32	rxpspoll;	/**< Number of RX PS-poll */
3799 	uint32	txnull;		/**< Number of TX NULL_DATA */
3800 	uint32	rxnull;		/**< Number of RX NULL_DATA */
3801 	uint32	txqosnull;	/**< Number of TX NULL_QoSDATA */
3802 	uint32	rxqosnull;	/**< Number of RX NULL_QoSDATA */
3803 	uint32	txassocreq;	/**< Number of TX ASSOC request */
3804 	uint32	rxassocreq;	/**< Number of RX ASSOC request */
3805 	uint32	txreassocreq;	/**< Number of TX REASSOC request */
3806 	uint32	rxreassocreq;	/**< Number of RX REASSOC request */
3807 	uint32	txdisassoc;	/**< Number of TX DISASSOC */
3808 	uint32	rxdisassoc;	/**< Number of RX DISASSOC */
3809 	uint32	txassocrsp;	/**< Number of TX ASSOC response */
3810 	uint32	rxassocrsp;	/**< Number of RX ASSOC response */
3811 	uint32	txreassocrsp;	/**< Number of TX REASSOC response */
3812 	uint32	rxreassocrsp;	/**< Number of RX REASSOC response */
3813 	uint32	txauth;		/**< Number of TX AUTH */
3814 	uint32	rxauth;		/**< Number of RX AUTH */
3815 	uint32	txdeauth;	/**< Number of TX DEAUTH */
3816 	uint32	rxdeauth;	/**< Number of RX DEAUTH */
3817 	uint32	txprobereq;	/**< Number of TX probe request */
3818 	uint32	rxprobereq;	/**< Number of RX probe request */
3819 	uint32	txprobersp;	/**< Number of TX probe response */
3820 	uint32	rxprobersp;	/**< Number of RX probe response */
3821 	uint32	txaction;	/**< Number of TX action frame */
3822 	uint32	rxaction;	/**< Number of RX action frame */
3823 	uint32  ampdu_wds;	/**< Number of AMPDU watchdogs */
3824 	uint32  txlost;		/**< Number of lost packets reported in txs */
3825 	uint32	txdatamcast;	/**< Number of TX multicast data packets */
3826 	uint32	txdatabcast;	/**< Number of TX broadcast data packets */
3827 	uint32	psmxwds;	/**< Number of PSMx watchdogs */
3828 	uint32  rxback;
3829 	uint32  txback;
3830 	uint32  p2p_tbtt;	/**< Number of P2P TBTT Events */
3831 	uint32  p2p_tbtt_miss;	/**< Number of P2P TBTT Events Miss */
3832 	uint32	txqueue_start;
3833 	uint32	txqueue_end;
3834 	uint32  txbcast;        /* Broadcast TransmittedFrameCount */
3835 	uint32  txdropped;      /* tx dropped pkts */
3836 	uint32  rxbcast;        /* BroadcastReceivedFrameCount */
3837 	uint32  rxdropped;      /* rx dropped pkts (derived: sum of others) */
3838 	uint32	txq_end_assoccb; /* forced txqueue_end callback fired in assoc */
3839 	uint32	tx_toss_cnt;	/* number of tx packets tossed */
3840 	uint32	rx_toss_cnt;	/* number of rx packets tossed	*/
3841 	uint32	last_tx_toss_rsn; /* reason because of which last tx pkt tossed */
3842 	uint32	last_rx_toss_rsn; /* reason because of which last rx pkt tossed */
3843 	uint32	pmk_badlen_cnt;	/* number of invalid pmk len */
3844 
3845 } wl_cnt_wlc_t;
3846 
3847 /* he counters Version 1 */
3848 #define HE_COUNTERS_V1		(1)
3849 typedef struct wl_he_cnt_wlc_v1 {
3850 	uint32 he_rxtrig_myaid;
3851 	uint32 he_rxtrig_rand;
3852 	uint32 he_colormiss_cnt;
3853 	uint32 he_txmampdu;
3854 	uint32 he_txmtid_back;
3855 	uint32 he_rxmtid_back;
3856 	uint32 he_rxmsta_back;
3857 	uint32 he_txfrag;
3858 	uint32 he_rxdefrag;
3859 	uint32 he_txtrig;
3860 	uint32 he_rxtrig_basic;
3861 	uint32 he_rxtrig_murts;
3862 	uint32 he_rxtrig_bsrp;
3863 	uint32 he_rxdlmu;
3864 	uint32 he_physu_rx;
3865 	uint32 he_phyru_rx;
3866 	uint32 he_txtbppdu;
3867 } wl_he_cnt_wlc_v1_t;
3868 
3869 /* he counters Version 2 */
3870 #define HE_COUNTERS_V2		(2)
3871 typedef struct wl_he_cnt_wlc_v2 {
3872 	uint16 version;
3873 	uint16 len;
3874 	uint32 he_rxtrig_myaid; /**< rxed valid trigger frame with myaid */
3875 	uint32 he_rxtrig_rand; /**< rxed valid trigger frame with random aid */
3876 	uint32 he_colormiss_cnt; /**< for bss color mismatch cases */
3877 	uint32 he_txmampdu; /**< for multi-TID AMPDU transmission */
3878 	uint32 he_txmtid_back; /**< for multi-TID BACK transmission */
3879 	uint32 he_rxmtid_back; /**< reception of multi-TID BACK */
3880 	uint32 he_rxmsta_back; /**< reception of multi-STA BACK */
3881 	uint32 he_txfrag; /**< transmission of Dynamic fragmented packets */
3882 	uint32 he_rxdefrag; /**< reception of dynamic fragmented packets */
3883 	uint32 he_txtrig; /**< transmission of trigger frames */
3884 	uint32 he_rxtrig_basic; /**< reception of basic trigger frame */
3885 	uint32 he_rxtrig_murts; /**< reception of MU-RTS trigger frame */
3886 	uint32 he_rxtrig_bsrp; /**< reception of BSR poll trigger frame */
3887 	uint32 he_rxdlmu; /**< reception of DL MU PPDU */
3888 	uint32 he_physu_rx; /**< reception of SU frame */
3889 	uint32 he_phyru_rx; /**< reception of RU frame */
3890 	uint32 he_txtbppdu; /**< increments on transmission of every TB PPDU */
3891 	uint32 he_null_tbppdu; /**< null TB PPDU's sent as a response to basic trigger frame */
3892 	uint32 he_rxtrig_bfrp; /**< reception of BFRP frame */
3893 	uint32 he_rxtrig_mubar; /**< reception of MU BAR frame */
3894 } wl_he_cnt_wlc_v2_t;
3895 
3896 #ifndef HE_COUNTERS_VERSION_ENABLED
3897 #define HE_COUNTERS_VERSION	(HE_COUNTERS_V1)
3898 typedef wl_he_cnt_wlc_v1_t wl_he_cnt_wlc_t;
3899 #endif /* HE_COUNTERS_VERSION_ENABLED */
3900 
3901 /* security vulnerabilities counters */
3902 typedef struct {
3903 	uint32	ie_unknown;		/* number of unknown IEs */
3904 	uint32	ie_invalid_length;	/* number of IEs with invalid length */
3905 	uint32	ie_invalid_data;	/* number of IEs with invalid data */
3906 	uint32	ipv6_invalid_length;	/* number of IPv6 packets with invalid payload length */
3907 } wl_secvln_cnt_t;
3908 
3909 /* Reinit reasons - do not put anything else other than reinit reasons here */
3910 typedef struct {
3911 	uint32 rsn[WL_REINIT_RC_LAST];
3912 } reinit_rsns_t;
3913 
3914 /* MACXSTAT counters for ucodex (corerev >= 64) */
3915 typedef struct {
3916 	uint32 macxsusp;
3917 	uint32 m2vmsg;
3918 	uint32 v2mmsg;
3919 	uint32 mboxout;
3920 	uint32 musnd;
3921 	uint32 sfb2v;
3922 } wl_cnt_ge64mcxst_v1_t;
3923 
3924 /** MACSTAT counters for ucode (corerev >= 40) */
3925 typedef struct {
3926 	/* MAC counters: 32-bit version of d11.h's macstat_t */
3927 	uint32	txallfrm;	/**< total number of frames sent, incl. Data, ACK, RTS, CTS,
3928 				 * Control Management (includes retransmissions)
3929 				 */
3930 	uint32	txrtsfrm;	/**< number of RTS sent out by the MAC */
3931 	uint32	txctsfrm;	/**< number of CTS sent out by the MAC */
3932 	uint32	txackfrm;	/**< number of ACK frames sent out */
3933 	uint32	txdnlfrm;	/**< number of Null-Data transmission generated from template  */
3934 	uint32	txbcnfrm;	/**< beacons transmitted */
3935 	uint32	txfunfl[6];	/**< per-fifo tx underflows */
3936 	uint32	txampdu;	/**< number of AMPDUs transmitted */
3937 	uint32	txmpdu;		/**< number of MPDUs transmitted */
3938 	uint32	txtplunfl;	/**< Template underflows (mac was too slow to transmit ACK/CTS
3939 				 * or BCN)
3940 				 */
3941 	uint32	txphyerror;	/**< Transmit phy error, type of error is reported in tx-status for
3942 				 * driver enqueued frames
3943 				 */
3944 	uint32  pktengrxducast; /**< unicast frames rxed by the pkteng code */
3945 	uint32  pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
3946 	uint32	rxfrmtoolong;	/**< Received frame longer than legal limit (2346 bytes) */
3947 	uint32	rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
3948 	uint32	rxanyerr;	/**< Any RX error that is not counted by other counters. */
3949 	uint32	rxbadfcs;	/**< number of frames for which the CRC check failed in the MAC */
3950 	uint32	rxbadplcp;	/**< parity check of the PLCP header failed */
3951 	uint32	rxcrsglitch;	/**< PHY was able to correlate the preamble but not the header */
3952 	uint32	rxstrt;		/**< Number of received frames with a good PLCP
3953 				 * (i.e. passing parity check)
3954 				 */
3955 	uint32	rxdtucastmbss; /**< number of received DATA frames with good FCS and matching RA */
3956 	uint32	rxmgucastmbss; /**< number of received mgmt frames with good FCS and matching RA */
3957 	uint32	rxctlucast; /**< number of received CNTRL frames with good FCS and matching RA */
3958 	uint32	rxrtsucast;	/**< number of unicast RTS addressed to the MAC (good FCS) */
3959 	uint32	rxctsucast;	/**< number of unicast CTS addressed to the MAC (good FCS) */
3960 	uint32	rxackucast;	/**< number of ucast ACKS received (good FCS) */
3961 	uint32	rxdtocast; /**< number of received DATA frames (good FCS and not matching RA) */
3962 	uint32	rxmgocast; /**< number of received MGMT frames (good FCS and not matching RA) */
3963 	uint32	rxctlocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
3964 	uint32	rxrtsocast;	/**< number of received RTS not addressed to the MAC */
3965 	uint32	rxctsocast;	/**< number of received CTS not addressed to the MAC */
3966 	uint32	rxdtmcast;	/**< number of RX Data multicast frames received by the MAC */
3967 	uint32	rxmgmcast;	/**< number of RX Management multicast frames received by the MAC */
3968 	uint32	rxctlmcast;	/**< number of RX Control multicast frames received by the MAC
3969 				 * (unlikely to see these)
3970 				 */
3971 	uint32	rxbeaconmbss;	/**< beacons received from member of BSS */
3972 	uint32	rxdtucastobss; /**< number of unicast frames addressed to the MAC from
3973 				  * other BSS (WDS FRAME)
3974 				  */
3975 	uint32	rxbeaconobss;	/**< beacons received from other BSS */
3976 	uint32	rxrsptmout;	/**< number of response timeouts for transmitted frames
3977 				 * expecting a response
3978 				 */
3979 	uint32	bcntxcancl;	/**< transmit beacons canceled due to receipt of beacon (IBSS) */
3980 	uint32	rxnodelim;	/**< number of no valid delimiter detected by ampdu parser */
3981 	uint32	rxf0ovfl;	/**< number of receive fifo 0 overflows */
3982 	uint32	rxf1ovfl;	/**< number of receive fifo 1 overflows */
3983 	uint32	rxhlovfl;	/**< number of length / header fifo overflows */
3984 	uint32	missbcn_dbg;	/**< number of beacon missed to receive */
3985 	uint32	pmqovfl;	/**< number of PMQ overflows */
3986 	uint32	rxcgprqfrm;	/**< number of received Probe requests that made it into
3987 				 * the PRQ fifo
3988 				 */
3989 	uint32	rxcgprsqovfl;	/**< Rx Probe Request Que overflow in the AP */
3990 	uint32	txcgprsfail;	/**< Tx Probe Response Fail. AP sent probe response but did
3991 				 * not get ACK
3992 				 */
3993 	uint32	txcgprssuc;	/**< Tx Probe Response Success (ACK was received) */
3994 	uint32	prs_timeout;	/**< number of probe requests that were dropped from the PRQ
3995 				 * fifo because a probe response could not be sent out within
3996 				 * the time limit defined in M_PRS_MAXTIME
3997 				 */
3998 	uint32	txrtsfail;	/**< number of rts transmission failure that reach retry limit */
3999 	uint32	txucast;	/**< number of unicast tx expecting response other than cts/cwcts */
4000 	uint32  txinrtstxop;	/**< number of data frame transmissions during rts txop */
4001 	uint32	rxback;		/**< blockack rxcnt */
4002 	uint32	txback;		/**< blockack txcnt */
4003 	uint32	bphy_rxcrsglitch;	/**< PHY count of bphy glitches */
4004 	uint32	rxdrop20s;	/**< drop secondary cnt */
4005 	uint32	rxtoolate;	/**< receive too late */
4006 	uint32  bphy_badplcp;	/**< number of bad PLCP reception on BPHY rate */
4007 } wl_cnt_ge40mcst_v1_t;
4008 
4009 /** MACSTAT counters for ucode (corerev < 40) */
4010 typedef struct {
4011 	/* MAC counters: 32-bit version of d11.h's macstat_t */
4012 	uint32	txallfrm;	/**< total number of frames sent, incl. Data, ACK, RTS, CTS,
4013 				 * Control Management (includes retransmissions)
4014 				 */
4015 	uint32	txrtsfrm;	/**< number of RTS sent out by the MAC */
4016 	uint32	txctsfrm;	/**< number of CTS sent out by the MAC */
4017 	uint32	txackfrm;	/**< number of ACK frames sent out */
4018 	uint32	txdnlfrm;	/**< number of Null-Data transmission generated from template  */
4019 	uint32	txbcnfrm;	/**< beacons transmitted */
4020 	uint32	txfunfl[6];	/**< per-fifo tx underflows */
4021 	uint32	txampdu;	/**< number of AMPDUs transmitted */
4022 	uint32	txmpdu;		/**< number of MPDUs transmitted */
4023 	uint32	txtplunfl;	/**< Template underflows (mac was too slow to transmit ACK/CTS
4024 				 * or BCN)
4025 				 */
4026 	uint32	txphyerror;	/**< Transmit phy error, type of error is reported in tx-status for
4027 				 * driver enqueued frames
4028 				 */
4029 	uint32  pktengrxducast; /**< unicast frames rxed by the pkteng code */
4030 	uint32  pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
4031 	uint32	rxfrmtoolong;	/**< Received frame longer than legal limit (2346 bytes) */
4032 	uint32	rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
4033 	uint32	rxanyerr;	/**< Any RX error that is not counted by other counters. */
4034 	uint32	rxbadfcs;	/**< number of frames for which the CRC check failed in the MAC */
4035 	uint32	rxbadplcp;	/**< parity check of the PLCP header failed */
4036 	uint32	rxcrsglitch;	/**< PHY was able to correlate the preamble but not the header */
4037 	uint32	rxstrt;		/**< Number of received frames with a good PLCP
4038 				 * (i.e. passing parity check)
4039 				 */
4040 	uint32	rxdtucastmbss; /**< number of received DATA frames with good FCS and matching RA */
4041 	uint32	rxmgucastmbss; /**< number of received mgmt frames with good FCS and matching RA */
4042 	uint32	rxctlucast; /**< number of received CNTRL frames with good FCS and matching RA */
4043 	uint32	rxrtsucast;	/**< number of unicast RTS addressed to the MAC (good FCS) */
4044 	uint32	rxctsucast;	/**< number of unicast CTS addressed to the MAC (good FCS) */
4045 	uint32	rxackucast;	/**< number of ucast ACKS received (good FCS) */
4046 	uint32	rxdtocast;  /**< number of received DATA frames (good FCS and not matching RA) */
4047 	uint32	rxmgocast;  /**< number of received MGMT frames (good FCS and not matching RA) */
4048 	uint32	rxctlocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
4049 	uint32	rxrtsocast;	/**< number of received RTS not addressed to the MAC */
4050 	uint32	rxctsocast;	/**< number of received CTS not addressed to the MAC */
4051 	uint32	rxdtmcast;	/**< number of RX Data multicast frames received by the MAC */
4052 	uint32	rxmgmcast;	/**< number of RX Management multicast frames received by the MAC */
4053 	uint32	rxctlmcast;	/**< number of RX Control multicast frames received by the MAC
4054 				 * (unlikely to see these)
4055 				 */
4056 	uint32	rxbeaconmbss;	/**< beacons received from member of BSS */
4057 	uint32	rxdtucastobss; /**< number of unicast frames addressed to the MAC from
4058 				  * other BSS (WDS FRAME)
4059 				  */
4060 	uint32	rxbeaconobss;	/**< beacons received from other BSS */
4061 	uint32	rxrsptmout;	/**< number of response timeouts for transmitted frames
4062 				 * expecting a response
4063 				 */
4064 	uint32	bcntxcancl;	/**< transmit beacons canceled due to receipt of beacon (IBSS) */
4065 	uint32	rxnodelim;	/**< number of no valid delimiter detected by ampdu parser */
4066 	uint32	rxf0ovfl;	/**< number of receive fifo 0 overflows */
4067 	uint32	dbgoff46;
4068 	uint32	dbgoff47;
4069 	uint32	dbgoff48;	/**< Used for counting txstatus queue overflow (corerev <= 4)  */
4070 	uint32	pmqovfl;	/**< number of PMQ overflows */
4071 	uint32	rxcgprqfrm;	/**< number of received Probe requests that made it into
4072 				 * the PRQ fifo
4073 				 */
4074 	uint32	rxcgprsqovfl;	/**< Rx Probe Request Que overflow in the AP */
4075 	uint32	txcgprsfail;	/**< Tx Probe Response Fail. AP sent probe response but did
4076 				 * not get ACK
4077 				 */
4078 	uint32	txcgprssuc;	/**< Tx Probe Response Success (ACK was received) */
4079 	uint32	prs_timeout;	/**< number of probe requests that were dropped from the PRQ
4080 				 * fifo because a probe response could not be sent out within
4081 				 * the time limit defined in M_PRS_MAXTIME
4082 				 */
4083 	uint32	txrtsfail;	/**< number of rts transmission failure that reach retry limit */
4084 	uint32	txucast;	/**< number of unicast tx expecting response other than cts/cwcts */
4085 	uint32  txinrtstxop;	/**< number of data frame transmissions during rts txop */
4086 	uint32	rxback;		/**< blockack rxcnt */
4087 	uint32	txback;		/**< blockack txcnt */
4088 	uint32	bphy_rxcrsglitch;	/**< PHY count of bphy glitches */
4089 	uint32	phywatch;
4090 	uint32	rxtoolate;	/**< receive too late */
4091 	uint32  bphy_badplcp;	/**< number of bad PLCP reception on BPHY rate */
4092 } wl_cnt_lt40mcst_v1_t;
4093 
4094 /** MACSTAT counters for ucode (corerev >= 80) */
4095 typedef struct {
4096 	/* MAC counters: 32-bit version of d11.h's macstat_t */
4097 	/* Start of PSM2HOST stats(72) block */
4098 	uint32	txallfrm;	/**< total number of frames sent, incl. Data, ACK, RTS, CTS,
4099 				 * Control Management (includes retransmissions)
4100 				 */
4101 	uint32	txrtsfrm;	/**< number of RTS sent out by the MAC */
4102 	uint32	txctsfrm;	/**< number of CTS sent out by the MAC */
4103 	uint32	txackfrm;	/**< number of ACK frames sent out */
4104 	uint32	txdnlfrm;	/**< number of Null-Data transmission generated from template  */
4105 	uint32	txbcnfrm;	/**< beacons transmitted */
4106 	uint32	txampdu;	/**< number of AMPDUs transmitted */
4107 	uint32	txmpdu;		/**< number of MPDUs transmitted */
4108 	uint32	txtplunfl;	/**< Template underflows (mac was too slow to transmit ACK/CTS
4109 				 * or BCN)
4110 				 */
4111 	uint32	txphyerror;	/**< Transmit phy error, type of error is reported in tx-status for
4112 				 * driver enqueued frames
4113 				 */
4114 	uint32  pktengrxducast; /**< unicast frames rxed by the pkteng code */
4115 	uint32  pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
4116 	uint32	rxfrmtoolong;	/**< Received frame longer than legal limit (2346 bytes) */
4117 	uint32	rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
4118 	uint32	rxanyerr;	/**< Any RX error that is not counted by other counters. */
4119 	uint32	rxbadfcs;	/**< number of frames for which the CRC check failed in the MAC */
4120 	uint32	rxbadplcp;	/**< parity check of the PLCP header failed */
4121 	uint32	rxcrsglitch;	/**< PHY was able to correlate the preamble but not the header */
4122 	uint32	rxstrt;		/**< Number of received frames with a good PLCP
4123 				 * (i.e. passing parity check)
4124 				 */
4125 	uint32	rxdtucastmbss; /**< number of received DATA frames with good FCS and matching RA */
4126 	uint32	rxmgucastmbss; /**< number of received mgmt frames with good FCS and matching RA */
4127 	uint32	rxctlucast; /**< number of received CNTRL frames with good FCS and matching RA */
4128 	uint32	rxrtsucast;	/**< number of unicast RTS addressed to the MAC (good FCS) */
4129 	uint32	rxctsucast;	/**< number of unicast CTS addressed to the MAC (good FCS) */
4130 	uint32	rxackucast;	/**< number of ucast ACKS received (good FCS) */
4131 	uint32	rxdtocast; /**< number of received DATA frames (good FCS and not matching RA) */
4132 	uint32	rxmgocast; /**< number of received MGMT frames (good FCS and not matching RA) */
4133 	uint32	rxctlocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
4134 	uint32	rxrtsocast;	/**< number of received RTS not addressed to the MAC */
4135 	uint32	rxctsocast;	/**< number of received CTS not addressed to the MAC */
4136 	uint32	rxdtmcast;	/**< number of RX Data multicast frames received by the MAC */
4137 	uint32	rxmgmcast;	/**< number of RX Management multicast frames received by the MAC */
4138 	uint32	rxctlmcast;	/**< number of RX Control multicast frames received by the MAC
4139 				 * (unlikely to see these)
4140 				 */
4141 	uint32	rxbeaconmbss;	/**< beacons received from member of BSS */
4142 	uint32	rxdtucastobss; /**< number of unicast frames addressed to the MAC from
4143 				  * other BSS (WDS FRAME)
4144 				  */
4145 	uint32	rxbeaconobss;	/**< beacons received from other BSS */
4146 	uint32	rxrsptmout;	/**< number of response timeouts for transmitted frames
4147 				 * expecting a response
4148 				 */
4149 	uint32	bcntxcancl;	/**< transmit beacons canceled due to receipt of beacon (IBSS) */
4150 	uint32	rxnodelim;	/**< number of no valid delimiter detected by ampdu parser */
4151 	uint32	missbcn_dbg;	/**< number of beacon missed to receive */
4152 	uint32	pmqovfl;	/**< number of PMQ overflows */
4153 	uint32	rxcgprqfrm;	/**< number of received Probe requests that made it into
4154 				 * the PRQ fifo
4155 				 */
4156 	uint32	rxcgprsqovfl;	/**< Rx Probe Request Que overflow in the AP */
4157 	uint32	txcgprsfail;	/**< Tx Probe Response Fail. AP sent probe response but did
4158 				 * not get ACK
4159 				 */
4160 	uint32	txcgprssuc;	/**< Tx Probe Response Success (ACK was received) */
4161 	uint32	prs_timeout;	/**< number of probe requests that were dropped from the PRQ
4162 				 * fifo because a probe response could not be sent out within
4163 				 * the time limit defined in M_PRS_MAXTIME
4164 				 */
4165 	uint32	txrtsfail;	/**< number of rts transmission failure that reach retry limit */
4166 	uint32	txucast;	/**< number of unicast tx expecting response other than cts/cwcts */
4167 	uint32  txinrtstxop;	/**< number of data frame transmissions during rts txop */
4168 	uint32	rxback;		/**< blockack rxcnt */
4169 	uint32	txback;		/**< blockack txcnt */
4170 	uint32	bphy_rxcrsglitch;	/**< PHY count of bphy glitches */
4171 	uint32	rxdrop20s;	/**< drop secondary cnt */
4172 	uint32	rxtoolate;	/**< receive too late */
4173 	uint32  bphy_badplcp;	/**< number of bad PLCP reception on BPHY rate */
4174 	uint32	rxtrig_myaid;	/* New counters added in corerev 80 */
4175 	uint32	rxtrig_rand;
4176 	uint32	goodfcs;
4177 	uint32	colormiss;
4178 	uint32	txmampdu;
4179 	uint32	rxmtidback;
4180 	uint32	rxmstaback;
4181 	uint32	txfrag;
4182 	/* End of PSM2HOST stats block */
4183 	/* start of rxerror overflow counter(24) block which are modified/added in corerev 80 */
4184 	uint32	phyovfl;
4185 	uint32	rxf0ovfl;	/**< number of receive fifo 0 overflows */
4186 	uint32	rxf1ovfl;	/**< number of receive fifo 1 overflows */
4187 	uint32	lenfovfl;
4188 	uint32	weppeof;
4189 	uint32	badplcp;
4190 	uint32	msduthresh;
4191 	uint32	strmeof;
4192 	uint32	stsfifofull;
4193 	uint32	stsfifoerr;
4194 	uint32	PAD[6];
4195 	uint32	rxerr_stat;
4196 	uint32	ctx_fifo_full;
4197 	uint32	txdatamcast;	/**< Number of TX multicast data packets */
4198 	uint32	txdatabcast;	/**< Number of TX broadcast data packets */
4199 	uint32	PAD[36]; /* PAD added for counter elements to be added soon */
4200 } wl_cnt_ge80mcst_v1_t;
4201 
4202 typedef struct {
4203 	uint32 fifocount;
4204 	uint32 txfunfl[];
4205 } wl_cnt_ge80_txfunfl_v1_t;
4206 
4207 /** MACSTAT counters for "wl counter" version <= 10 */
4208 typedef struct {
4209 	/* MAC counters: 32-bit version of d11.h's macstat_t */
4210 	uint32	txallfrm;	/**< total number of frames sent, incl. Data, ACK, RTS, CTS,
4211 				 * Control Management (includes retransmissions)
4212 				 */
4213 	uint32	txrtsfrm;	/**< number of RTS sent out by the MAC */
4214 	uint32	txctsfrm;	/**< number of CTS sent out by the MAC */
4215 	uint32	txackfrm;	/**< number of ACK frames sent out */
4216 	uint32	txdnlfrm;	/**< number of Null-Data transmission generated from template  */
4217 	uint32	txbcnfrm;	/**< beacons transmitted */
4218 	uint32	txfunfl[6];	/**< per-fifo tx underflows */
4219 	uint32	txfbw;		/**< transmit at fallback bw (dynamic bw) */
4220 	uint32	PAD0;		/**< number of MPDUs transmitted */
4221 	uint32	txtplunfl;	/**< Template underflows (mac was too slow to transmit ACK/CTS
4222 				 * or BCN)
4223 				 */
4224 	uint32	txphyerror;	/**< Transmit phy error, type of error is reported in tx-status for
4225 				 * driver enqueued frames
4226 				 */
4227 	uint32  pktengrxducast; /**< unicast frames rxed by the pkteng code */
4228 	uint32  pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
4229 	uint32	rxfrmtoolong;	/**< Received frame longer than legal limit (2346 bytes) */
4230 	uint32	rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
4231 	uint32	rxinvmachdr;	/**< Either the protocol version != 0 or frame type not
4232 				 * data/control/management
4233 				 */
4234 	uint32	rxbadfcs;	/**< number of frames for which the CRC check failed in the MAC */
4235 	uint32	rxbadplcp;	/**< parity check of the PLCP header failed */
4236 	uint32	rxcrsglitch;	/**< PHY was able to correlate the preamble but not the header */
4237 	uint32	rxstrt;		/**< Number of received frames with a good PLCP
4238 				 * (i.e. passing parity check)
4239 				 */
4240 	uint32	rxdfrmucastmbss; /* number of received DATA frames with good FCS and matching RA */
4241 	uint32	rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
4242 	uint32	rxcfrmucast; /**< number of received CNTRL frames with good FCS and matching RA */
4243 	uint32	rxrtsucast;  /**< number of unicast RTS addressed to the MAC (good FCS) */
4244 	uint32	rxctsucast;  /**< number of unicast CTS addressed to the MAC (good FCS) */
4245 	uint32	rxackucast;	/**< number of ucast ACKS received (good FCS) */
4246 	uint32	rxdfrmocast; /**< number of received DATA frames (good FCS and not matching RA) */
4247 	uint32	rxmfrmocast; /**< number of received MGMT frames (good FCS and not matching RA) */
4248 	uint32	rxcfrmocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
4249 	uint32	rxrtsocast;	/**< number of received RTS not addressed to the MAC */
4250 	uint32	rxctsocast;	/**< number of received CTS not addressed to the MAC */
4251 	uint32	rxdfrmmcast;	/**< number of RX Data multicast frames received by the MAC */
4252 	uint32	rxmfrmmcast;	/**< number of RX Management multicast frames received by the MAC */
4253 	uint32	rxcfrmmcast;	/**< number of RX Control multicast frames received by the MAC
4254 				 * (unlikely to see these)
4255 				 */
4256 	uint32	rxbeaconmbss;	/**< beacons received from member of BSS */
4257 	uint32	rxdfrmucastobss; /**< number of unicast frames addressed to the MAC from
4258 				  * other BSS (WDS FRAME)
4259 				  */
4260 	uint32	rxbeaconobss;	/**< beacons received from other BSS */
4261 	uint32	rxrsptmout;	/**< number of response timeouts for transmitted frames
4262 				 * expecting a response
4263 				 */
4264 	uint32	bcntxcancl;	/**< transmit beacons canceled due to receipt of beacon (IBSS) */
4265 	uint32	PAD1;
4266 	uint32	rxf0ovfl;	/**< number of receive fifo 0 overflows */
4267 	uint32	rxf1ovfl;	/**< Number of receive fifo 1 overflows (obsolete) */
4268 	uint32	rxf2ovfl;	/**< Number of receive fifo 2 overflows (obsolete) */
4269 	uint32	txsfovfl;	/**< Number of transmit status fifo overflows (obsolete) */
4270 	uint32	pmqovfl;	/**< number of PMQ overflows */
4271 	uint32	rxcgprqfrm;	/**< number of received Probe requests that made it into
4272 				 * the PRQ fifo
4273 				 */
4274 	uint32	rxcgprsqovfl;	/**< Rx Probe Request Que overflow in the AP */
4275 	uint32	txcgprsfail;	/**< Tx Probe Response Fail. AP sent probe response but did
4276 				 * not get ACK
4277 				 */
4278 	uint32	txcgprssuc;	/**< Tx Probe Response Success (ACK was received) */
4279 	uint32	prs_timeout;	/**< number of probe requests that were dropped from the PRQ
4280 				 * fifo because a probe response could not be sent out within
4281 				 * the time limit defined in M_PRS_MAXTIME
4282 				 */
4283 	uint32	rxnack;		/**< obsolete */
4284 	uint32	frmscons;	/**< obsolete */
4285 	uint32  txnack;		/**< obsolete */
4286 	uint32	rxback;		/**< blockack rxcnt */
4287 	uint32	txback;		/**< blockack txcnt */
4288 	uint32	bphy_rxcrsglitch;	/**< PHY count of bphy glitches */
4289 	uint32	rxdrop20s;	/**< drop secondary cnt */
4290 	uint32	rxtoolate;	/**< receive too late */
4291 	uint32  bphy_badplcp;	/**< number of bad PLCP reception on BPHY rate */
4292 } wl_cnt_v_le10_mcst_t;
4293 
4294 #define MAX_RX_FIFO 3
4295 #define WL_RXFIFO_CNT_VERSION  1   /* current version of wl_rxfifo_cnt_t */
4296 typedef struct {
4297 	/* Counters for frames received from rx fifos */
4298 	uint16	version;
4299 	uint16	length;		/* length of entire structure */
4300 	uint32	rxf_data[MAX_RX_FIFO];		/* data frames from rx fifo */
4301 	uint32	rxf_mgmtctl[MAX_RX_FIFO];	/* mgmt/ctl frames from rx fifo */
4302 } wl_rxfifo_cnt_t;
4303 
4304 typedef struct {
4305 	uint16	version;	/**< see definition of WL_CNT_T_VERSION */
4306 	uint16	length;		/**< length of entire structure */
4307 
4308 	/* transmit stat counters */
4309 	uint32	txframe;	/**< tx data frames */
4310 	uint32	txbyte;		/**< tx data bytes */
4311 	uint32	txretrans;	/**< tx mac retransmits */
4312 	uint32	txerror;	/**< tx data errors (derived: sum of others) */
4313 	uint32	txctl;		/**< tx management frames */
4314 	uint32	txprshort;	/**< tx short preamble frames */
4315 	uint32	txserr;		/**< tx status errors */
4316 	uint32	txnobuf;	/**< tx out of buffers errors */
4317 	uint32	txnoassoc;	/**< tx discard because we're not associated */
4318 	uint32	txrunt;		/**< tx runt frames */
4319 	uint32	txchit;		/**< tx header cache hit (fastpath) */
4320 	uint32	txcmiss;	/**< tx header cache miss (slowpath) */
4321 
4322 	/* transmit chip error counters */
4323 	uint32	txuflo;		/**< tx fifo underflows */
4324 	uint32	txphyerr;	/**< tx phy errors (indicated in tx status) */
4325 	uint32	txphycrs;
4326 
4327 	/* receive stat counters */
4328 	uint32	rxframe;	/**< rx data frames */
4329 	uint32	rxbyte;		/**< rx data bytes */
4330 	uint32	rxerror;	/**< rx data errors (derived: sum of others) */
4331 	uint32	rxctl;		/**< rx management frames */
4332 	uint32	rxnobuf;	/**< rx out of buffers errors */
4333 	uint32	rxnondata;	/**< rx non data frames in the data channel errors */
4334 	uint32	rxbadds;	/**< rx bad DS errors */
4335 	uint32	rxbadcm;	/**< rx bad control or management frames */
4336 	uint32	rxfragerr;	/**< rx fragmentation errors */
4337 	uint32	rxrunt;		/**< rx runt frames */
4338 	uint32	rxgiant;	/**< rx giant frames */
4339 	uint32	rxnoscb;	/**< rx no scb error */
4340 	uint32	rxbadproto;	/**< rx invalid frames */
4341 	uint32	rxbadsrcmac;	/**< rx frames with Invalid Src Mac */
4342 	uint32	rxbadda;	/**< rx frames tossed for invalid da */
4343 	uint32	rxfilter;	/**< rx frames filtered out */
4344 
4345 	/* receive chip error counters */
4346 	uint32	rxoflo;		/**< rx fifo overflow errors */
4347 	uint32	rxuflo[NFIFO];	/**< rx dma descriptor underflow errors */
4348 
4349 	uint32	d11cnt_txrts_off;	/**< d11cnt txrts value when reset d11cnt */
4350 	uint32	d11cnt_rxcrc_off;	/**< d11cnt rxcrc value when reset d11cnt */
4351 	uint32	d11cnt_txnocts_off;	/**< d11cnt txnocts value when reset d11cnt */
4352 
4353 	/* misc counters */
4354 	uint32	dmade;		/**< tx/rx dma descriptor errors */
4355 	uint32	dmada;		/**< tx/rx dma data errors */
4356 	uint32	dmape;		/**< tx/rx dma descriptor protocol errors */
4357 	uint32	reset;		/**< reset count */
4358 	uint32	tbtt;		/**< cnts the TBTT int's */
4359 	uint32	txdmawar;
4360 	uint32	pkt_callback_reg_fail;	/**< callbacks register failure */
4361 
4362 	/* MAC counters: 32-bit version of d11.h's macstat_t */
4363 	uint32	txallfrm;	/**< total number of frames sent, incl. Data, ACK, RTS, CTS,
4364 				 * Control Management (includes retransmissions)
4365 				 */
4366 	uint32	txrtsfrm;	/**< number of RTS sent out by the MAC */
4367 	uint32	txctsfrm;	/**< number of CTS sent out by the MAC */
4368 	uint32	txackfrm;	/**< number of ACK frames sent out */
4369 	uint32	txdnlfrm;	/**< Not used */
4370 	uint32	txbcnfrm;	/**< beacons transmitted */
4371 	uint32	txfunfl[6];	/**< per-fifo tx underflows */
4372 	uint32	rxtoolate;	/**< receive too late */
4373 	uint32  txfbw;		/**< transmit at fallback bw (dynamic bw) */
4374 	uint32	txtplunfl;	/**< Template underflows (mac was too slow to transmit ACK/CTS
4375 				 * or BCN)
4376 				 */
4377 	uint32	txphyerror;	/**< Transmit phy error, type of error is reported in tx-status for
4378 				 * driver enqueued frames
4379 				 */
4380 	uint32	rxfrmtoolong;	/**< Received frame longer than legal limit (2346 bytes) */
4381 	uint32	rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
4382 	uint32	rxinvmachdr;	/**< Either the protocol version != 0 or frame type not
4383 				 * data/control/management
4384 				 */
4385 	uint32	rxbadfcs;	/**< number of frames for which the CRC check failed in the MAC */
4386 	uint32	rxbadplcp;	/**< parity check of the PLCP header failed */
4387 	uint32	rxcrsglitch;	/**< PHY was able to correlate the preamble but not the header */
4388 	uint32	rxstrt;		/**< Number of received frames with a good PLCP
4389 				 * (i.e. passing parity check)
4390 				 */
4391 	uint32	rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */
4392 	uint32	rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
4393 	uint32	rxcfrmucast; /**< number of received CNTRL frames with good FCS and matching RA */
4394 	uint32	rxrtsucast;	/**< number of unicast RTS addressed to the MAC (good FCS) */
4395 	uint32	rxctsucast;	/**< number of unicast CTS addressed to the MAC (good FCS) */
4396 	uint32	rxackucast;	/**< number of ucast ACKS received (good FCS) */
4397 	uint32	rxdfrmocast; /**< number of received DATA frames (good FCS and not matching RA) */
4398 	uint32	rxmfrmocast; /**< number of received MGMT frames (good FCS and not matching RA) */
4399 	uint32	rxcfrmocast; /**< number of received CNTRL frame (good FCS and not matching RA) */
4400 	uint32	rxrtsocast;	/**< number of received RTS not addressed to the MAC */
4401 	uint32	rxctsocast;	/**< number of received CTS not addressed to the MAC */
4402 	uint32	rxdfrmmcast;	/**< number of RX Data multicast frames received by the MAC */
4403 	uint32	rxmfrmmcast;	/**< number of RX Management multicast frames received by the MAC */
4404 	uint32	rxcfrmmcast;	/**< number of RX Control multicast frames received by the MAC
4405 				 * (unlikely to see these)
4406 				 */
4407 	uint32	rxbeaconmbss;	/**< beacons received from member of BSS */
4408 	uint32	rxdfrmucastobss; /**< number of unicast frames addressed to the MAC from
4409 				  * other BSS (WDS FRAME)
4410 				  */
4411 	uint32	rxbeaconobss;	/**< beacons received from other BSS */
4412 	uint32	rxrsptmout;	/**< Number of response timeouts for transmitted frames
4413 				 * expecting a response
4414 				 */
4415 	uint32	bcntxcancl;	/**< transmit beacons canceled due to receipt of beacon (IBSS) */
4416 	uint32	rxf0ovfl;	/**< Number of receive fifo 0 overflows */
4417 	uint32	rxf1ovfl;	/**< Number of receive fifo 1 overflows (obsolete) */
4418 	uint32	rxf2ovfl;	/**< Number of receive fifo 2 overflows (obsolete) */
4419 	uint32	txsfovfl;	/**< Number of transmit status fifo overflows (obsolete) */
4420 	uint32	pmqovfl;	/**< Number of PMQ overflows */
4421 	uint32	rxcgprqfrm;	/**< Number of received Probe requests that made it into
4422 				 * the PRQ fifo
4423 				 */
4424 	uint32	rxcgprsqovfl;	/**< Rx Probe Request Que overflow in the AP */
4425 	uint32	txcgprsfail;	/**< Tx Probe Response Fail. AP sent probe response but did
4426 				 * not get ACK
4427 				 */
4428 	uint32	txcgprssuc;	/**< Tx Probe Response Success (ACK was received) */
4429 	uint32	prs_timeout;	/**< Number of probe requests that were dropped from the PRQ
4430 				 * fifo because a probe response could not be sent out within
4431 				 * the time limit defined in M_PRS_MAXTIME
4432 				 */
4433 	uint32	rxnack;		/**< obsolete */
4434 	uint32	frmscons;	/**< obsolete */
4435 	uint32  txnack;		/**< obsolete */
4436 	uint32	rxback;		/**< blockack rxcnt */
4437 	uint32	txback;		/**< blockack txcnt */
4438 
4439 	/* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
4440 	uint32	txfrag;		/**< dot11TransmittedFragmentCount */
4441 	uint32	txmulti;	/**< dot11MulticastTransmittedFrameCount */
4442 	uint32	txfail;		/**< dot11FailedCount */
4443 	uint32	txretry;	/**< dot11RetryCount */
4444 	uint32	txretrie;	/**< dot11MultipleRetryCount */
4445 	uint32	rxdup;		/**< dot11FrameduplicateCount */
4446 	uint32	txrts;		/**< dot11RTSSuccessCount */
4447 	uint32	txnocts;	/**< dot11RTSFailureCount */
4448 	uint32	txnoack;	/**< dot11ACKFailureCount */
4449 	uint32	rxfrag;		/**< dot11ReceivedFragmentCount */
4450 	uint32	rxmulti;	/**< dot11MulticastReceivedFrameCount */
4451 	uint32	rxcrc;		/**< dot11FCSErrorCount */
4452 	uint32	txfrmsnt;	/**< dot11TransmittedFrameCount (bogus MIB?) */
4453 	uint32	rxundec;	/**< dot11WEPUndecryptableCount */
4454 
4455 	/* WPA2 counters (see rxundec for DecryptFailureCount) */
4456 	uint32	tkipmicfaill;	/**< TKIPLocalMICFailures */
4457 	uint32	tkipcntrmsr;	/**< TKIPCounterMeasuresInvoked */
4458 	uint32	tkipreplay;	/**< TKIPReplays */
4459 	uint32	ccmpfmterr;	/**< CCMPFormatErrors */
4460 	uint32	ccmpreplay;	/**< CCMPReplays */
4461 	uint32	ccmpundec;	/**< CCMPDecryptErrors */
4462 	uint32	fourwayfail;	/**< FourWayHandshakeFailures */
4463 	uint32	wepundec;	/**< dot11WEPUndecryptableCount */
4464 	uint32	wepicverr;	/**< dot11WEPICVErrorCount */
4465 	uint32	decsuccess;	/**< DecryptSuccessCount */
4466 	uint32	tkipicverr;	/**< TKIPICVErrorCount */
4467 	uint32	wepexcluded;	/**< dot11WEPExcludedCount */
4468 
4469 	uint32	txchanrej;	/**< Tx frames suppressed due to channel rejection */
4470 	uint32	psmwds;		/**< Count PSM watchdogs */
4471 	uint32	phywatchdog;	/**< Count Phy watchdogs (triggered by ucode) */
4472 
4473 	/* MBSS counters, AP only */
4474 	uint32	prq_entries_handled;	/**< PRQ entries read in */
4475 	uint32	prq_undirected_entries;	/**<    which were bcast bss & ssid */
4476 	uint32	prq_bad_entries;	/**<    which could not be translated to info */
4477 	uint32	atim_suppress_count;	/**< TX suppressions on ATIM fifo */
4478 	uint32	bcn_template_not_ready;	/**< Template marked in use on send bcn ... */
4479 	uint32	bcn_template_not_ready_done; /**< ...but "DMA done" interrupt rcvd */
4480 	uint32	late_tbtt_dpc;	/**< TBTT DPC did not happen in time */
4481 
4482 	/* per-rate receive stat counters */
4483 	uint32  rx1mbps;	/**< packets rx at 1Mbps */
4484 	uint32  rx2mbps;	/**< packets rx at 2Mbps */
4485 	uint32  rx5mbps5;	/**< packets rx at 5.5Mbps */
4486 	uint32  rx6mbps;	/**< packets rx at 6Mbps */
4487 	uint32  rx9mbps;	/**< packets rx at 9Mbps */
4488 	uint32  rx11mbps;	/**< packets rx at 11Mbps */
4489 	uint32  rx12mbps;	/**< packets rx at 12Mbps */
4490 	uint32  rx18mbps;	/**< packets rx at 18Mbps */
4491 	uint32  rx24mbps;	/**< packets rx at 24Mbps */
4492 	uint32  rx36mbps;	/**< packets rx at 36Mbps */
4493 	uint32  rx48mbps;	/**< packets rx at 48Mbps */
4494 	uint32  rx54mbps;	/**< packets rx at 54Mbps */
4495 	uint32  rx108mbps;	/**< packets rx at 108mbps */
4496 	uint32  rx162mbps;	/**< packets rx at 162mbps */
4497 	uint32  rx216mbps;	/**< packets rx at 216 mbps */
4498 	uint32  rx270mbps;	/**< packets rx at 270 mbps */
4499 	uint32  rx324mbps;	/**< packets rx at 324 mbps */
4500 	uint32  rx378mbps;	/**< packets rx at 378 mbps */
4501 	uint32  rx432mbps;	/**< packets rx at 432 mbps */
4502 	uint32  rx486mbps;	/**< packets rx at 486 mbps */
4503 	uint32  rx540mbps;	/**< packets rx at 540 mbps */
4504 
4505 	/* pkteng rx frame stats */
4506 	uint32	pktengrxducast; /**< unicast frames rxed by the pkteng code */
4507 	uint32	pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
4508 
4509 	uint32	rfdisable;	/**< count of radio disables */
4510 	uint32	bphy_rxcrsglitch;	/**< PHY count of bphy glitches */
4511 	uint32  bphy_badplcp;
4512 
4513 	uint32	txexptime;	/**< Tx frames suppressed due to timer expiration */
4514 
4515 	uint32	txmpdu_sgi;	/**< count for sgi transmit */
4516 	uint32	rxmpdu_sgi;	/**< count for sgi received */
4517 	uint32	txmpdu_stbc;	/**< count for stbc transmit */
4518 	uint32	rxmpdu_stbc;	/**< count for stbc received */
4519 
4520 	uint32	rxundec_mcst;	/**< dot11WEPUndecryptableCount */
4521 
4522 	/* WPA2 counters (see rxundec for DecryptFailureCount) */
4523 	uint32	tkipmicfaill_mcst;	/**< TKIPLocalMICFailures */
4524 	uint32	tkipcntrmsr_mcst;	/**< TKIPCounterMeasuresInvoked */
4525 	uint32	tkipreplay_mcst;	/**< TKIPReplays */
4526 	uint32	ccmpfmterr_mcst;	/**< CCMPFormatErrors */
4527 	uint32	ccmpreplay_mcst;	/**< CCMPReplays */
4528 	uint32	ccmpundec_mcst;	/**< CCMPDecryptErrors */
4529 	uint32	fourwayfail_mcst;	/**< FourWayHandshakeFailures */
4530 	uint32	wepundec_mcst;	/**< dot11WEPUndecryptableCount */
4531 	uint32	wepicverr_mcst;	/**< dot11WEPICVErrorCount */
4532 	uint32	decsuccess_mcst;	/**< DecryptSuccessCount */
4533 	uint32	tkipicverr_mcst;	/**< TKIPICVErrorCount */
4534 	uint32	wepexcluded_mcst;	/**< dot11WEPExcludedCount */
4535 
4536 	uint32	dma_hang;	/**< count for dma hang */
4537 	uint32	reinit;		/**< count for reinit */
4538 
4539 	uint32  pstatxucast;	/**< count of ucast frames xmitted on all psta assoc */
4540 	uint32  pstatxnoassoc;	/**< count of txnoassoc frames xmitted on all psta assoc */
4541 	uint32  pstarxucast;	/**< count of ucast frames received on all psta assoc */
4542 	uint32  pstarxbcmc;	/**< count of bcmc frames received on all psta */
4543 	uint32  pstatxbcmc;	/**< count of bcmc frames transmitted on all psta */
4544 
4545 	uint32  cso_passthrough; /**< hw cso required but passthrough */
4546 	uint32	cso_normal;	/**< hw cso hdr for normal process */
4547 	uint32	chained;	/**< number of frames chained */
4548 	uint32	chainedsz1;	/**< number of chain size 1 frames */
4549 	uint32	unchained;	/**< number of frames not chained */
4550 	uint32	maxchainsz;	/**< max chain size so far */
4551 	uint32	currchainsz;	/**< current chain size */
4552 	uint32	rxdrop20s;	/**< drop secondary cnt */
4553 	uint32	pciereset;	/**< Secondary Bus Reset issued by driver */
4554 	uint32	cfgrestore;	/**< configspace restore by driver */
4555 	uint32	reinitreason[NREINITREASONCOUNT]; /**< reinitreason counters; 0: Unknown reason */
4556 	uint32  rxrtry;		/**< num of received packets with retry bit on */
4557 	uint32	txmpdu;		/**< macstat cnt only valid in ver 11. number of MPDUs txed.  */
4558 	uint32	rxnodelim;	/**< macstat cnt only valid in ver 11.
4559 				 * number of occasions that no valid delimiter is detected
4560 				 * by ampdu parser.
4561 				 */
4562 	uint32  rxmpdu_mu;      /**< Number of MU MPDUs received */
4563 
4564 	/* detailed control/management frames */
4565 	uint32	txbar;		/**< Number of TX BAR */
4566 	uint32	rxbar;		/**< Number of RX BAR */
4567 	uint32	txpspoll;	/**< Number of TX PS-poll */
4568 	uint32	rxpspoll;	/**< Number of RX PS-poll */
4569 	uint32	txnull;		/**< Number of TX NULL_DATA */
4570 	uint32	rxnull;		/**< Number of RX NULL_DATA */
4571 	uint32	txqosnull;	/**< Number of TX NULL_QoSDATA */
4572 	uint32	rxqosnull;	/**< Number of RX NULL_QoSDATA */
4573 	uint32	txassocreq;	/**< Number of TX ASSOC request */
4574 	uint32	rxassocreq;	/**< Number of RX ASSOC request */
4575 	uint32	txreassocreq;	/**< Number of TX REASSOC request */
4576 	uint32	rxreassocreq;	/**< Number of RX REASSOC request */
4577 	uint32	txdisassoc;	/**< Number of TX DISASSOC */
4578 	uint32	rxdisassoc;	/**< Number of RX DISASSOC */
4579 	uint32	txassocrsp;	/**< Number of TX ASSOC response */
4580 	uint32	rxassocrsp;	/**< Number of RX ASSOC response */
4581 	uint32	txreassocrsp;	/**< Number of TX REASSOC response */
4582 	uint32	rxreassocrsp;	/**< Number of RX REASSOC response */
4583 	uint32	txauth;		/**< Number of TX AUTH */
4584 	uint32	rxauth;		/**< Number of RX AUTH */
4585 	uint32	txdeauth;	/**< Number of TX DEAUTH */
4586 	uint32	rxdeauth;	/**< Number of RX DEAUTH */
4587 	uint32	txprobereq;	/**< Number of TX probe request */
4588 	uint32	rxprobereq;	/**< Number of RX probe request */
4589 	uint32	txprobersp;	/**< Number of TX probe response */
4590 	uint32	rxprobersp;	/**< Number of RX probe response */
4591 	uint32	txaction;	/**< Number of TX action frame */
4592 	uint32	rxaction;	/**< Number of RX action frame */
4593 	uint32  ampdu_wds;      /**< Number of AMPDU watchdogs */
4594 	uint32  txlost;         /**< Number of lost packets reported in txs */
4595 	uint32  txdatamcast;	/**< Number of TX multicast data packets */
4596 	uint32  txdatabcast;	/**< Number of TX broadcast data packets */
4597 	uint32  txbcast;        /* Broadcast TransmittedFrameCount */
4598 	uint32  txdropped;      /* tx dropped pkts */
4599 	uint32  rxbcast;        /* BroadcastReceivedFrameCount */
4600 	uint32  rxdropped;      /* rx dropped pkts (derived: sum of others) */
4601 
4602 } wl_cnt_ver_11_t;
4603 
4604 typedef struct {
4605 	uint16	version;	/* see definition of WL_CNT_T_VERSION */
4606 	uint16	length;		/* length of entire structure */
4607 
4608 	/* transmit stat counters */
4609 	uint32	txframe;	/* tx data frames */
4610 	uint32	txbyte;		/* tx data bytes */
4611 	uint32	txretrans;	/* tx mac retransmits */
4612 	uint32	txerror;	/* tx data errors (derived: sum of others) */
4613 	uint32	txctl;		/* tx management frames */
4614 	uint32	txprshort;	/* tx short preamble frames */
4615 	uint32	txserr;		/* tx status errors */
4616 	uint32	txnobuf;	/* tx out of buffers errors */
4617 	uint32	txnoassoc;	/* tx discard because we're not associated */
4618 	uint32	txrunt;		/* tx runt frames */
4619 	uint32	txchit;		/* tx header cache hit (fastpath) */
4620 	uint32	txcmiss;	/* tx header cache miss (slowpath) */
4621 
4622 	/* transmit chip error counters */
4623 	uint32	txuflo;		/* tx fifo underflows */
4624 	uint32	txphyerr;	/* tx phy errors (indicated in tx status) */
4625 	uint32	txphycrs;
4626 
4627 	/* receive stat counters */
4628 	uint32	rxframe;	/* rx data frames */
4629 	uint32	rxbyte;		/* rx data bytes */
4630 	uint32	rxerror;	/* rx data errors (derived: sum of others) */
4631 	uint32	rxctl;		/* rx management frames */
4632 	uint32	rxnobuf;	/* rx out of buffers errors */
4633 	uint32	rxnondata;	/* rx non data frames in the data channel errors */
4634 	uint32	rxbadds;	/* rx bad DS errors */
4635 	uint32	rxbadcm;	/* rx bad control or management frames */
4636 	uint32	rxfragerr;	/* rx fragmentation errors */
4637 	uint32	rxrunt;		/* rx runt frames */
4638 	uint32	rxgiant;	/* rx giant frames */
4639 	uint32	rxnoscb;	/* rx no scb error */
4640 	uint32	rxbadproto;	/* rx invalid frames */
4641 	uint32	rxbadsrcmac;	/* rx frames with Invalid Src Mac */
4642 	uint32	rxbadda;	/* rx frames tossed for invalid da */
4643 	uint32	rxfilter;	/* rx frames filtered out */
4644 
4645 	/* receive chip error counters */
4646 	uint32	rxoflo;		/* rx fifo overflow errors */
4647 	uint32	rxuflo[NFIFO];	/* rx dma descriptor underflow errors */
4648 
4649 	uint32	d11cnt_txrts_off;	/* d11cnt txrts value when reset d11cnt */
4650 	uint32	d11cnt_rxcrc_off;	/* d11cnt rxcrc value when reset d11cnt */
4651 	uint32	d11cnt_txnocts_off;	/* d11cnt txnocts value when reset d11cnt */
4652 
4653 	/* misc counters */
4654 	uint32	dmade;		/* tx/rx dma descriptor errors */
4655 	uint32	dmada;		/* tx/rx dma data errors */
4656 	uint32	dmape;		/* tx/rx dma descriptor protocol errors */
4657 	uint32	reset;		/* reset count */
4658 	uint32	tbtt;		/* cnts the TBTT int's */
4659 	uint32	txdmawar;
4660 	uint32	pkt_callback_reg_fail;	/* callbacks register failure */
4661 
4662 	/* MAC counters: 32-bit version of d11.h's macstat_t */
4663 	uint32	txallfrm;	/* total number of frames sent, incl. Data, ACK, RTS, CTS,
4664 				 * Control Management (includes retransmissions)
4665 				 */
4666 	uint32	txrtsfrm;	/* number of RTS sent out by the MAC */
4667 	uint32	txctsfrm;	/* number of CTS sent out by the MAC */
4668 	uint32	txackfrm;	/* number of ACK frames sent out */
4669 	uint32	txdnlfrm;	/* Not used */
4670 	uint32	txbcnfrm;	/* beacons transmitted */
4671 	uint32	txfunfl[8];	/* per-fifo tx underflows */
4672 	uint32	txtplunfl;	/* Template underflows (mac was too slow to transmit ACK/CTS
4673 				 * or BCN)
4674 				 */
4675 	uint32	txphyerror;	/* Transmit phy error, type of error is reported in tx-status for
4676 				 * driver enqueued frames
4677 				 */
4678 	uint32	rxfrmtoolong;	/* Received frame longer than legal limit (2346 bytes) */
4679 	uint32	rxfrmtooshrt;	/* Received frame did not contain enough bytes for its frame type */
4680 	uint32	rxinvmachdr;	/* Either the protocol version != 0 or frame type not
4681 				 * data/control/management
4682 				 */
4683 	uint32	rxbadfcs;	/* number of frames for which the CRC check failed in the MAC */
4684 	uint32	rxbadplcp;	/* parity check of the PLCP header failed */
4685 	uint32	rxcrsglitch;	/* PHY was able to correlate the preamble but not the header */
4686 	uint32	rxstrt;		/* Number of received frames with a good PLCP
4687 				 * (i.e. passing parity check)
4688 				 */
4689 	uint32	rxdfrmucastmbss; /* Number of received DATA frames with good FCS and matching RA */
4690 	uint32	rxmfrmucastmbss; /* number of received mgmt frames with good FCS and matching RA */
4691 	uint32	rxcfrmucast;	/* number of received CNTRL frames with good FCS and matching RA */
4692 	uint32	rxrtsucast;	/* number of unicast RTS addressed to the MAC (good FCS) */
4693 	uint32	rxctsucast;	/* number of unicast CTS addressed to the MAC (good FCS) */
4694 	uint32	rxackucast;	/* number of ucast ACKS received (good FCS) */
4695 	uint32	rxdfrmocast;	/* number of received DATA frames (good FCS and not matching RA) */
4696 	uint32	rxmfrmocast;	/* number of received MGMT frames (good FCS and not matching RA) */
4697 	uint32	rxcfrmocast;	/* number of received CNTRL frame (good FCS and not matching RA) */
4698 	uint32	rxrtsocast;	/* number of received RTS not addressed to the MAC */
4699 	uint32	rxctsocast;	/* number of received CTS not addressed to the MAC */
4700 	uint32	rxdfrmmcast;	/* number of RX Data multicast frames received by the MAC */
4701 	uint32	rxmfrmmcast;	/* number of RX Management multicast frames received by the MAC */
4702 	uint32	rxcfrmmcast;	/* number of RX Control multicast frames received by the MAC
4703 				 * (unlikely to see these)
4704 				 */
4705 	uint32	rxbeaconmbss;	/* beacons received from member of BSS */
4706 	uint32	rxdfrmucastobss; /* number of unicast frames addressed to the MAC from
4707 				  * other BSS (WDS FRAME)
4708 				  */
4709 	uint32	rxbeaconobss;	/* beacons received from other BSS */
4710 	uint32	rxrsptmout;	/* Number of response timeouts for transmitted frames
4711 				 * expecting a response
4712 				 */
4713 	uint32	bcntxcancl;	/* transmit beacons canceled due to receipt of beacon (IBSS) */
4714 	uint32	rxf0ovfl;	/* Number of receive fifo 0 overflows */
4715 	uint32	rxf1ovfl;	/* Number of receive fifo 1 overflows (obsolete) */
4716 	uint32	rxf2ovfl;	/* Number of receive fifo 2 overflows (obsolete) */
4717 	uint32	txsfovfl;	/* Number of transmit status fifo overflows (obsolete) */
4718 	uint32	pmqovfl;	/* Number of PMQ overflows */
4719 	uint32	rxcgprqfrm;	/* Number of received Probe requests that made it into
4720 				 * the PRQ fifo
4721 				 */
4722 	uint32	rxcgprsqovfl;	/* Rx Probe Request Que overflow in the AP */
4723 	uint32	txcgprsfail;	/* Tx Probe Response Fail. AP sent probe response but did
4724 				 * not get ACK
4725 				 */
4726 	uint32	txcgprssuc;	/* Tx Probe Response Success (ACK was received) */
4727 	uint32	prs_timeout;	/* Number of probe requests that were dropped from the PRQ
4728 				 * fifo because a probe response could not be sent out within
4729 				 * the time limit defined in M_PRS_MAXTIME
4730 				 */
4731 	uint32	rxnack;		/* obsolete */
4732 	uint32	frmscons;	/* obsolete */
4733 	uint32	txnack;		/* obsolete */
4734 	uint32	txglitch_nack;	/* obsolete */
4735 	uint32	txburst;	/* obsolete */
4736 
4737 	/* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
4738 	uint32	txfrag;		/* dot11TransmittedFragmentCount */
4739 	uint32	txmulti;	/* dot11MulticastTransmittedFrameCount */
4740 	uint32	txfail;		/* dot11FailedCount */
4741 	uint32	txretry;	/* dot11RetryCount */
4742 	uint32	txretrie;	/* dot11MultipleRetryCount */
4743 	uint32	rxdup;		/* dot11FrameduplicateCount */
4744 	uint32	txrts;		/* dot11RTSSuccessCount */
4745 	uint32	txnocts;	/* dot11RTSFailureCount */
4746 	uint32	txnoack;	/* dot11ACKFailureCount */
4747 	uint32	rxfrag;		/* dot11ReceivedFragmentCount */
4748 	uint32	rxmulti;	/* dot11MulticastReceivedFrameCount */
4749 	uint32	rxcrc;		/* dot11FCSErrorCount */
4750 	uint32	txfrmsnt;	/* dot11TransmittedFrameCount (bogus MIB?) */
4751 	uint32	rxundec;	/* dot11WEPUndecryptableCount */
4752 
4753 	/* WPA2 counters (see rxundec for DecryptFailureCount) */
4754 	uint32	tkipmicfaill;	/* TKIPLocalMICFailures */
4755 	uint32	tkipcntrmsr;	/* TKIPCounterMeasuresInvoked */
4756 	uint32	tkipreplay;	/* TKIPReplays */
4757 	uint32	ccmpfmterr;	/* CCMPFormatErrors */
4758 	uint32	ccmpreplay;	/* CCMPReplays */
4759 	uint32	ccmpundec;	/* CCMPDecryptErrors */
4760 	uint32	fourwayfail;	/* FourWayHandshakeFailures */
4761 	uint32	wepundec;	/* dot11WEPUndecryptableCount */
4762 	uint32	wepicverr;	/* dot11WEPICVErrorCount */
4763 	uint32	decsuccess;	/* DecryptSuccessCount */
4764 	uint32	tkipicverr;	/* TKIPICVErrorCount */
4765 	uint32	wepexcluded;	/* dot11WEPExcludedCount */
4766 
4767 	uint32	txchanrej;	/* Tx frames suppressed due to channel rejection */
4768 	uint32	psmwds;		/* Count PSM watchdogs */
4769 	uint32	phywatchdog;	/* Count Phy watchdogs (triggered by ucode) */
4770 
4771 	/* MBSS counters, AP only */
4772 	uint32	prq_entries_handled;	/* PRQ entries read in */
4773 	uint32	prq_undirected_entries;	/*    which were bcast bss & ssid */
4774 	uint32	prq_bad_entries;	/*    which could not be translated to info */
4775 	uint32	atim_suppress_count;	/* TX suppressions on ATIM fifo */
4776 	uint32	bcn_template_not_ready;	/* Template marked in use on send bcn ... */
4777 	uint32	bcn_template_not_ready_done; /* ...but "DMA done" interrupt rcvd */
4778 	uint32	late_tbtt_dpc;	/* TBTT DPC did not happen in time */
4779 
4780 	/* per-rate receive stat counters */
4781 	uint32  rx1mbps;	/* packets rx at 1Mbps */
4782 	uint32  rx2mbps;	/* packets rx at 2Mbps */
4783 	uint32  rx5mbps5;	/* packets rx at 5.5Mbps */
4784 	uint32  rx6mbps;	/* packets rx at 6Mbps */
4785 	uint32  rx9mbps;	/* packets rx at 9Mbps */
4786 	uint32  rx11mbps;	/* packets rx at 11Mbps */
4787 	uint32  rx12mbps;	/* packets rx at 12Mbps */
4788 	uint32  rx18mbps;	/* packets rx at 18Mbps */
4789 	uint32  rx24mbps;	/* packets rx at 24Mbps */
4790 	uint32  rx36mbps;	/* packets rx at 36Mbps */
4791 	uint32  rx48mbps;	/* packets rx at 48Mbps */
4792 	uint32  rx54mbps;	/* packets rx at 54Mbps */
4793 	uint32  rx108mbps;	/* packets rx at 108mbps */
4794 	uint32  rx162mbps;	/* packets rx at 162mbps */
4795 	uint32  rx216mbps;	/* packets rx at 216 mbps */
4796 	uint32  rx270mbps;	/* packets rx at 270 mbps */
4797 	uint32  rx324mbps;	/* packets rx at 324 mbps */
4798 	uint32  rx378mbps;	/* packets rx at 378 mbps */
4799 	uint32  rx432mbps;	/* packets rx at 432 mbps */
4800 	uint32  rx486mbps;	/* packets rx at 486 mbps */
4801 	uint32  rx540mbps;	/* packets rx at 540 mbps */
4802 
4803 	/* pkteng rx frame stats */
4804 	uint32	pktengrxducast; /* unicast frames rxed by the pkteng code */
4805 	uint32	pktengrxdmcast; /* multicast frames rxed by the pkteng code */
4806 
4807 	uint32	rfdisable;	/* count of radio disables */
4808 	uint32	bphy_rxcrsglitch;	/* PHY count of bphy glitches */
4809 
4810 	uint32	txexptime;	/* Tx frames suppressed due to timer expiration */
4811 
4812 	uint32	txmpdu_sgi;	/* count for sgi transmit */
4813 	uint32	rxmpdu_sgi;	/* count for sgi received */
4814 	uint32	txmpdu_stbc;	/* count for stbc transmit */
4815 	uint32	rxmpdu_stbc;	/* count for stbc received */
4816 
4817 	uint32	rxundec_mcst;	/* dot11WEPUndecryptableCount */
4818 
4819 	/* WPA2 counters (see rxundec for DecryptFailureCount) */
4820 	uint32	tkipmicfaill_mcst;	/* TKIPLocalMICFailures */
4821 	uint32	tkipcntrmsr_mcst;	/* TKIPCounterMeasuresInvoked */
4822 	uint32	tkipreplay_mcst;	/* TKIPReplays */
4823 	uint32	ccmpfmterr_mcst;	/* CCMPFormatErrors */
4824 	uint32	ccmpreplay_mcst;	/* CCMPReplays */
4825 	uint32	ccmpundec_mcst;	/* CCMPDecryptErrors */
4826 	uint32	fourwayfail_mcst;	/* FourWayHandshakeFailures */
4827 	uint32	wepundec_mcst;	/* dot11WEPUndecryptableCount */
4828 	uint32	wepicverr_mcst;	/* dot11WEPICVErrorCount */
4829 	uint32	decsuccess_mcst;	/* DecryptSuccessCount */
4830 	uint32	tkipicverr_mcst;	/* TKIPICVErrorCount */
4831 	uint32	wepexcluded_mcst;	/* dot11WEPExcludedCount */
4832 
4833 	uint32	dma_hang;	/* count for stbc received */
4834 	uint32	rxrtry;		/* number of packets with retry bit set to 1 */
4835 } wl_cnt_ver_7_t;
4836 
4837 typedef struct {
4838 	uint16  version;    /**< see definition of WL_CNT_T_VERSION */
4839 	uint16  length;     /**< length of entire structure */
4840 
4841 	/* transmit stat counters */
4842 	uint32  txframe;    /**< tx data frames */
4843 	uint32  txbyte;     /**< tx data bytes */
4844 	uint32  txretrans;  /**< tx mac retransmits */
4845 	uint32  txerror;    /**< tx data errors (derived: sum of others) */
4846 	uint32  txctl;      /**< tx management frames */
4847 	uint32  txprshort;  /**< tx short preamble frames */
4848 	uint32  txserr;     /**< tx status errors */
4849 	uint32  txnobuf;    /**< tx out of buffers errors */
4850 	uint32  txnoassoc;  /**< tx discard because we're not associated */
4851 	uint32  txrunt;     /**< tx runt frames */
4852 	uint32  txchit;     /**< tx header cache hit (fastpath) */
4853 	uint32  txcmiss;    /**< tx header cache miss (slowpath) */
4854 
4855 	/* transmit chip error counters */
4856 	uint32  txuflo;     /**< tx fifo underflows */
4857 	uint32  txphyerr;   /**< tx phy errors (indicated in tx status) */
4858 	uint32  txphycrs;
4859 
4860 	/* receive stat counters */
4861 	uint32  rxframe;    /**< rx data frames */
4862 	uint32  rxbyte;     /**< rx data bytes */
4863 	uint32  rxerror;    /**< rx data errors (derived: sum of others) */
4864 	uint32  rxctl;      /**< rx management frames */
4865 	uint32  rxnobuf;    /**< rx out of buffers errors */
4866 	uint32  rxnondata;  /**< rx non data frames in the data channel errors */
4867 	uint32  rxbadds;    /**< rx bad DS errors */
4868 	uint32  rxbadcm;    /**< rx bad control or management frames */
4869 	uint32  rxfragerr;  /**< rx fragmentation errors */
4870 	uint32  rxrunt;     /**< rx runt frames */
4871 	uint32  rxgiant;    /**< rx giant frames */
4872 	uint32  rxnoscb;    /**< rx no scb error */
4873 	uint32  rxbadproto; /**< rx invalid frames */
4874 	uint32  rxbadsrcmac;    /**< rx frames with Invalid Src Mac */
4875 	uint32  rxbadda;    /**< rx frames tossed for invalid da */
4876 	uint32  rxfilter;   /**< rx frames filtered out */
4877 
4878 	/* receive chip error counters */
4879 	uint32  rxoflo;     /**< rx fifo overflow errors */
4880 	uint32  rxuflo[NFIFO];  /**< rx dma descriptor underflow errors */
4881 
4882 	uint32  d11cnt_txrts_off;   /**< d11cnt txrts value when reset d11cnt */
4883 	uint32  d11cnt_rxcrc_off;   /**< d11cnt rxcrc value when reset d11cnt */
4884 	uint32  d11cnt_txnocts_off; /**< d11cnt txnocts value when reset d11cnt */
4885 
4886 	/* misc counters */
4887 	uint32  dmade;      /**< tx/rx dma descriptor errors */
4888 	uint32  dmada;      /**< tx/rx dma data errors */
4889 	uint32  dmape;      /**< tx/rx dma descriptor protocol errors */
4890 	uint32  reset;      /**< reset count */
4891 	uint32  tbtt;       /**< cnts the TBTT int's */
4892 	uint32  txdmawar;
4893 	uint32  pkt_callback_reg_fail;  /**< callbacks register failure */
4894 
4895 	/* MAC counters: 32-bit version of d11.h's macstat_t */
4896 	uint32  txallfrm;   /**< total number of frames sent, incl. Data, ACK, RTS, CTS,
4897 			     * Control Management (includes retransmissions)
4898 			     */
4899 	uint32  txrtsfrm;   /**< number of RTS sent out by the MAC */
4900 	uint32  txctsfrm;   /**< number of CTS sent out by the MAC */
4901 	uint32  txackfrm;   /**< number of ACK frames sent out */
4902 	uint32  txdnlfrm;   /**< Not used */
4903 	uint32  txbcnfrm;   /**< beacons transmitted */
4904 	uint32  txfunfl[6]; /**< per-fifo tx underflows */
4905 	uint32	rxtoolate;	/**< receive too late */
4906 	uint32  txfbw;	    /**< transmit at fallback bw (dynamic bw) */
4907 	uint32  txtplunfl;  /**< Template underflows (mac was too slow to transmit ACK/CTS
4908 			     * or BCN)
4909 			     */
4910 	uint32  txphyerror; /**< Transmit phy error, type of error is reported in tx-status for
4911 			     * driver enqueued frames
4912 			     */
4913 	uint32  rxfrmtoolong;   /**< Received frame longer than legal limit (2346 bytes) */
4914 	uint32  rxfrmtooshrt; /**< Received frame did not contain enough bytes for its frame type */
4915 	uint32  rxinvmachdr;    /**< Either the protocol version != 0 or frame type not
4916 				 * data/control/management
4917 			   */
4918 	uint32  rxbadfcs;   /**< number of frames for which the CRC check failed in the MAC */
4919 	uint32  rxbadplcp;  /**< parity check of the PLCP header failed */
4920 	uint32  rxcrsglitch;    /**< PHY was able to correlate the preamble but not the header */
4921 	uint32  rxstrt;     /**< Number of received frames with a good PLCP
4922 			     * (i.e. passing parity check)
4923 			     */
4924 	uint32  rxdfrmucastmbss; /**< # of received DATA frames with good FCS and matching RA */
4925 	uint32  rxmfrmucastmbss; /**< # of received mgmt frames with good FCS and matching RA */
4926 	uint32  rxcfrmucast;     /**< # of received CNTRL frames with good FCS and matching RA */
4927 	uint32  rxrtsucast; /**< number of unicast RTS addressed to the MAC (good FCS) */
4928 	uint32  rxctsucast; /**< number of unicast CTS addressed to the MAC (good FCS) */
4929 	uint32  rxackucast; /**< number of ucast ACKS received (good FCS) */
4930 	uint32  rxdfrmocast;    /**< # of received DATA frames (good FCS and not matching RA) */
4931 	uint32  rxmfrmocast;    /**< # of received MGMT frames (good FCS and not matching RA) */
4932 	uint32  rxcfrmocast;    /**< # of received CNTRL frame (good FCS and not matching RA) */
4933 	uint32  rxrtsocast; /**< number of received RTS not addressed to the MAC */
4934 	uint32  rxctsocast; /**< number of received CTS not addressed to the MAC */
4935 	uint32  rxdfrmmcast;    /**< number of RX Data multicast frames received by the MAC */
4936 	uint32  rxmfrmmcast;    /**< number of RX Management multicast frames received by the MAC */
4937 	uint32  rxcfrmmcast;    /**< number of RX Control multicast frames received by the MAC
4938 				 * (unlikely to see these)
4939 				 */
4940 	uint32  rxbeaconmbss;   /**< beacons received from member of BSS */
4941 	uint32  rxdfrmucastobss; /**< number of unicast frames addressed to the MAC from
4942 				  * other BSS (WDS FRAME)
4943 				  */
4944 	uint32  rxbeaconobss;   /**< beacons received from other BSS */
4945 	uint32  rxrsptmout; /**< Number of response timeouts for transmitted frames
4946 			     * expecting a response
4947 			     */
4948 	uint32  bcntxcancl; /**< transmit beacons canceled due to receipt of beacon (IBSS) */
4949 	uint32  rxf0ovfl;   /**< Number of receive fifo 0 overflows */
4950 	uint32  rxf1ovfl;   /**< Number of receive fifo 1 overflows (obsolete) */
4951 	uint32  rxf2ovfl;   /**< Number of receive fifo 2 overflows (obsolete) */
4952 	uint32  txsfovfl;   /**< Number of transmit status fifo overflows (obsolete) */
4953 	uint32  pmqovfl;    /**< Number of PMQ overflows */
4954 	uint32  rxcgprqfrm; /**< Number of received Probe requests that made it into
4955 			     * the PRQ fifo
4956 			     */
4957 	uint32  rxcgprsqovfl;   /**< Rx Probe Request Que overflow in the AP */
4958 	uint32  txcgprsfail;    /**< Tx Probe Response Fail. AP sent probe response but did
4959 				 * not get ACK
4960 				 */
4961 	uint32  txcgprssuc; /**< Tx Probe Response Success (ACK was received) */
4962 	uint32  prs_timeout;    /**< Number of probe requests that were dropped from the PRQ
4963 				 * fifo because a probe response could not be sent out within
4964 				 * the time limit defined in M_PRS_MAXTIME
4965 				 */
4966 	uint32  rxnack;
4967 	uint32  frmscons;
4968 	uint32  txnack;		/**< obsolete */
4969 	uint32	rxback;		/**< blockack rxcnt */
4970 	uint32	txback;		/**< blockack txcnt */
4971 
4972 	/* 802.11 MIB counters, pp. 614 of 802.11 reaff doc. */
4973 	uint32  txfrag;     /**< dot11TransmittedFragmentCount */
4974 	uint32  txmulti;    /**< dot11MulticastTransmittedFrameCount */
4975 	uint32  txfail;     /**< dot11FailedCount */
4976 	uint32  txretry;    /**< dot11RetryCount */
4977 	uint32  txretrie;   /**< dot11MultipleRetryCount */
4978 	uint32  rxdup;      /**< dot11FrameduplicateCount */
4979 	uint32  txrts;      /**< dot11RTSSuccessCount */
4980 	uint32  txnocts;    /**< dot11RTSFailureCount */
4981 	uint32  txnoack;    /**< dot11ACKFailureCount */
4982 	uint32  rxfrag;     /**< dot11ReceivedFragmentCount */
4983 	uint32  rxmulti;    /**< dot11MulticastReceivedFrameCount */
4984 	uint32  rxcrc;      /**< dot11FCSErrorCount */
4985 	uint32  txfrmsnt;   /**< dot11TransmittedFrameCount (bogus MIB?) */
4986 	uint32  rxundec;    /**< dot11WEPUndecryptableCount */
4987 
4988 	/* WPA2 counters (see rxundec for DecryptFailureCount) */
4989 	uint32  tkipmicfaill;   /**< TKIPLocalMICFailures */
4990 	uint32  tkipcntrmsr;    /**< TKIPCounterMeasuresInvoked */
4991 	uint32  tkipreplay; /**< TKIPReplays */
4992 	uint32  ccmpfmterr; /**< CCMPFormatErrors */
4993 	uint32  ccmpreplay; /**< CCMPReplays */
4994 	uint32  ccmpundec;  /**< CCMPDecryptErrors */
4995 	uint32  fourwayfail;    /**< FourWayHandshakeFailures */
4996 	uint32  wepundec;   /**< dot11WEPUndecryptableCount */
4997 	uint32  wepicverr;  /**< dot11WEPICVErrorCount */
4998 	uint32  decsuccess; /**< DecryptSuccessCount */
4999 	uint32  tkipicverr; /**< TKIPICVErrorCount */
5000 	uint32  wepexcluded;    /**< dot11WEPExcludedCount */
5001 
5002 	uint32  rxundec_mcst;   /**< dot11WEPUndecryptableCount */
5003 
5004 	/* WPA2 counters (see rxundec for DecryptFailureCount) */
5005 	uint32  tkipmicfaill_mcst;  /**< TKIPLocalMICFailures */
5006 	uint32  tkipcntrmsr_mcst;   /**< TKIPCounterMeasuresInvoked */
5007 	uint32  tkipreplay_mcst;    /**< TKIPReplays */
5008 	uint32  ccmpfmterr_mcst;    /**< CCMPFormatErrors */
5009 	uint32  ccmpreplay_mcst;    /**< CCMPReplays */
5010 	uint32  ccmpundec_mcst; /**< CCMPDecryptErrors */
5011 	uint32  fourwayfail_mcst;   /**< FourWayHandshakeFailures */
5012 	uint32  wepundec_mcst;  /**< dot11WEPUndecryptableCount */
5013 	uint32  wepicverr_mcst; /**< dot11WEPICVErrorCount */
5014 	uint32  decsuccess_mcst;    /**< DecryptSuccessCount */
5015 	uint32  tkipicverr_mcst;    /**< TKIPICVErrorCount */
5016 	uint32  wepexcluded_mcst;   /**< dot11WEPExcludedCount */
5017 
5018 	uint32  txchanrej;  /**< Tx frames suppressed due to channel rejection */
5019 	uint32  txexptime;  /**< Tx frames suppressed due to timer expiration */
5020 	uint32  psmwds;     /**< Count PSM watchdogs */
5021 	uint32  phywatchdog;    /**< Count Phy watchdogs (triggered by ucode) */
5022 
5023 	/* MBSS counters, AP only */
5024 	uint32  prq_entries_handled;    /**< PRQ entries read in */
5025 	uint32  prq_undirected_entries; /**<    which were bcast bss & ssid */
5026 	uint32  prq_bad_entries;    /**<    which could not be translated to info */
5027 	uint32  atim_suppress_count;    /**< TX suppressions on ATIM fifo */
5028 	uint32  bcn_template_not_ready; /**< Template marked in use on send bcn ... */
5029 	uint32  bcn_template_not_ready_done; /**< ...but "DMA done" interrupt rcvd */
5030 	uint32  late_tbtt_dpc;  /**< TBTT DPC did not happen in time */
5031 
5032 	/* per-rate receive stat counters */
5033 	uint32  rx1mbps;    /**< packets rx at 1Mbps */
5034 	uint32  rx2mbps;    /**< packets rx at 2Mbps */
5035 	uint32  rx5mbps5;   /**< packets rx at 5.5Mbps */
5036 	uint32  rx6mbps;    /**< packets rx at 6Mbps */
5037 	uint32  rx9mbps;    /**< packets rx at 9Mbps */
5038 	uint32  rx11mbps;   /**< packets rx at 11Mbps */
5039 	uint32  rx12mbps;   /**< packets rx at 12Mbps */
5040 	uint32  rx18mbps;   /**< packets rx at 18Mbps */
5041 	uint32  rx24mbps;   /**< packets rx at 24Mbps */
5042 	uint32  rx36mbps;   /**< packets rx at 36Mbps */
5043 	uint32  rx48mbps;   /**< packets rx at 48Mbps */
5044 	uint32  rx54mbps;   /**< packets rx at 54Mbps */
5045 	uint32  rx108mbps;  /**< packets rx at 108mbps */
5046 	uint32  rx162mbps;  /**< packets rx at 162mbps */
5047 	uint32  rx216mbps;  /**< packets rx at 216 mbps */
5048 	uint32  rx270mbps;  /**< packets rx at 270 mbps */
5049 	uint32  rx324mbps;  /**< packets rx at 324 mbps */
5050 	uint32  rx378mbps;  /**< packets rx at 378 mbps */
5051 	uint32  rx432mbps;  /**< packets rx at 432 mbps */
5052 	uint32  rx486mbps;  /**< packets rx at 486 mbps */
5053 	uint32  rx540mbps;  /**< packets rx at 540 mbps */
5054 
5055 	/* pkteng rx frame stats */
5056 	uint32  pktengrxducast; /**< unicast frames rxed by the pkteng code */
5057 	uint32  pktengrxdmcast; /**< multicast frames rxed by the pkteng code */
5058 
5059 	uint32  rfdisable;  /**< count of radio disables */
5060 	uint32  bphy_rxcrsglitch;   /**< PHY count of bphy glitches */
5061 	uint32  bphy_badplcp;
5062 
5063 	uint32  txmpdu_sgi; /**< count for sgi transmit */
5064 	uint32  rxmpdu_sgi; /**< count for sgi received */
5065 	uint32  txmpdu_stbc;    /**< count for stbc transmit */
5066 	uint32  rxmpdu_stbc;    /**< count for stbc received */
5067 
5068 	uint32	rxdrop20s;	/**< drop secondary cnt */
5069 } wl_cnt_ver_6_t;
5070 
5071 #define	WL_DELTA_STATS_T_VERSION	2	/**< current version of wl_delta_stats_t struct */
5072 
5073 typedef struct {
5074 	uint16 version;     /**< see definition of WL_DELTA_STATS_T_VERSION */
5075 	uint16 length;      /**< length of entire structure */
5076 
5077 	/* transmit stat counters */
5078 	uint32 txframe;     /**< tx data frames */
5079 	uint32 txbyte;      /**< tx data bytes */
5080 	uint32 txretrans;   /**< tx mac retransmits */
5081 	uint32 txfail;      /**< tx failures */
5082 
5083 	/* receive stat counters */
5084 	uint32 rxframe;     /**< rx data frames */
5085 	uint32 rxbyte;      /**< rx data bytes */
5086 
5087 	/* per-rate receive stat counters */
5088 	uint32  rx1mbps;	/**< packets rx at 1Mbps */
5089 	uint32  rx2mbps;	/**< packets rx at 2Mbps */
5090 	uint32  rx5mbps5;	/**< packets rx at 5.5Mbps */
5091 	uint32  rx6mbps;	/**< packets rx at 6Mbps */
5092 	uint32  rx9mbps;	/**< packets rx at 9Mbps */
5093 	uint32  rx11mbps;	/**< packets rx at 11Mbps */
5094 	uint32  rx12mbps;	/**< packets rx at 12Mbps */
5095 	uint32  rx18mbps;	/**< packets rx at 18Mbps */
5096 	uint32  rx24mbps;	/**< packets rx at 24Mbps */
5097 	uint32  rx36mbps;	/**< packets rx at 36Mbps */
5098 	uint32  rx48mbps;	/**< packets rx at 48Mbps */
5099 	uint32  rx54mbps;	/**< packets rx at 54Mbps */
5100 	uint32  rx108mbps;	/**< packets rx at 108mbps */
5101 	uint32  rx162mbps;	/**< packets rx at 162mbps */
5102 	uint32  rx216mbps;	/**< packets rx at 216 mbps */
5103 	uint32  rx270mbps;	/**< packets rx at 270 mbps */
5104 	uint32  rx324mbps;	/**< packets rx at 324 mbps */
5105 	uint32  rx378mbps;	/**< packets rx at 378 mbps */
5106 	uint32  rx432mbps;	/**< packets rx at 432 mbps */
5107 	uint32  rx486mbps;	/**< packets rx at 486 mbps */
5108 	uint32  rx540mbps;	/**< packets rx at 540 mbps */
5109 
5110 	/* phy stats */
5111 	uint32 rxbadplcp;
5112 	uint32 rxcrsglitch;
5113 	uint32 bphy_rxcrsglitch;
5114 	uint32 bphy_badplcp;
5115 
5116 	uint32 slice_index; /**< Slice for which stats are reported */
5117 
5118 } wl_delta_stats_t;
5119 
5120 /* Partial statistics counter report */
5121 #define WL_CNT_CTL_MGT_FRAMES	0
5122 
5123 typedef struct {
5124 	uint16	type;
5125 	uint16	len;
5126 
5127 	/* detailed control/management frames */
5128 	uint32	txnull;
5129 	uint32	rxnull;
5130 	uint32	txqosnull;
5131 	uint32	rxqosnull;
5132 	uint32	txassocreq;
5133 	uint32	rxassocreq;
5134 	uint32	txreassocreq;
5135 	uint32	rxreassocreq;
5136 	uint32	txdisassoc;
5137 	uint32	rxdisassoc;
5138 	uint32	txassocrsp;
5139 	uint32	rxassocrsp;
5140 	uint32	txreassocrsp;
5141 	uint32	rxreassocrsp;
5142 	uint32	txauth;
5143 	uint32	rxauth;
5144 	uint32	txdeauth;
5145 	uint32	rxdeauth;
5146 	uint32	txprobereq;
5147 	uint32	rxprobereq;
5148 	uint32	txprobersp;
5149 	uint32	rxprobersp;
5150 	uint32	txaction;
5151 	uint32	rxaction;
5152 	uint32	txrts;
5153 	uint32	rxrts;
5154 	uint32	txcts;
5155 	uint32	rxcts;
5156 	uint32	txack;
5157 	uint32	rxack;
5158 	uint32	txbar;
5159 	uint32	rxbar;
5160 	uint32	txback;
5161 	uint32	rxback;
5162 	uint32	txpspoll;
5163 	uint32	rxpspoll;
5164 } wl_ctl_mgt_cnt_t;
5165 
5166 typedef struct {
5167 	uint32 packets;
5168 	uint32 bytes;
5169 } wl_traffic_stats_t;
5170 
5171 typedef struct {
5172 	uint16	version;	/**< see definition of WL_WME_CNT_VERSION */
5173 	uint16	length;		/**< length of entire structure */
5174 
5175 	wl_traffic_stats_t tx[AC_COUNT];	/**< Packets transmitted */
5176 	wl_traffic_stats_t tx_failed[AC_COUNT];	/**< Packets dropped or failed to transmit */
5177 	wl_traffic_stats_t rx[AC_COUNT];	/**< Packets received */
5178 	wl_traffic_stats_t rx_failed[AC_COUNT];	/**< Packets failed to receive */
5179 
5180 	wl_traffic_stats_t forward[AC_COUNT];	/**< Packets forwarded by AP */
5181 
5182 	wl_traffic_stats_t tx_expired[AC_COUNT]; /**< packets dropped due to lifetime expiry */
5183 
5184 } wl_wme_cnt_t;
5185 
5186 struct wl_msglevel2 {
5187 	uint32 low;
5188 	uint32 high;
5189 };
5190 
5191 /* A versioned structure for setting and retrieving debug message levels. */
5192 #define WL_MSGLEVEL_STRUCT_VERSION_1	1
5193 
5194 typedef struct wl_msglevel_v1 {
5195 	uint16 version;
5196 	uint16 length;
5197 	uint32 msglevel1;
5198 	uint32 msglevel2;
5199 	uint32 msglevel3;
5200 	/* add another uint32 when full */
5201 } wl_msglevel_v1_t;
5202 
5203 #define WL_ICMP_IPV6_CFG_VERSION         1
5204 #define WL_ICMP_IPV6_CLEAR_ALL           (1 << 0)
5205 
5206 typedef struct wl_icmp_ipv6_cfg {
5207 	uint16 version;
5208 	uint16 length;
5209 	uint16 fixed_length;
5210 	uint16 flags;
5211 	uint32 num_ipv6;
5212 	/* num_ipv6 to follow */
5213 	struct ipv6_addr host_ipv6[];
5214 } wl_icmp_ipv6_cfg_t;
5215 
5216 #define WL_ICMP_CFG_IPV6_FIXED_LEN      OFFSETOF(wl_icmp_ipv6_cfg_t, host_ipv6)
5217 #define WL_ICMP_CFG_IPV6_LEN(count)    (WL_ICMP_CFG_IPV6_FIXED_LEN + \
5218 					((count) * sizeof(struct ipv6_addr)))
5219 
5220 typedef struct wl_mkeep_alive_pkt {
5221 	uint16	version; /* Version for mkeep_alive */
5222 	uint16	length; /* length of fixed parameters in the structure */
5223 	uint32	period_msec; /* high bit on means immediate send */
5224 	uint16	len_bytes;
5225 	uint8	keep_alive_id; /* 0 - 3 for N = 4 */
5226 	uint8	data[1];
5227 } wl_mkeep_alive_pkt_t;
5228 
5229 #define WL_MKEEP_ALIVE_VERSION		1
5230 #define WL_MKEEP_ALIVE_FIXED_LEN	OFFSETOF(wl_mkeep_alive_pkt_t, data)
5231 #define WL_MKEEP_ALIVE_PRECISION	500
5232 #define WL_MKEEP_ALIVE_PERIOD_MASK  0x7FFFFFFF
5233 #define WL_MKEEP_ALIVE_IMMEDIATE    0x80000000
5234 
5235 /** TCP Keep-Alive conn struct */
5236 typedef struct wl_mtcpkeep_alive_conn_pkt {
5237 	struct ether_addr saddr;		/**< src mac address */
5238 	struct ether_addr daddr;		/**< dst mac address */
5239 	struct ipv4_addr sipaddr;		/**< source IP addr */
5240 	struct ipv4_addr dipaddr;		/**< dest IP addr */
5241 	uint16 sport;				/**< src port */
5242 	uint16 dport;				/**< dest port */
5243 	uint32 seq;				/**< seq number */
5244 	uint32 ack;				/**< ACK number */
5245 	uint16 tcpwin;				/**< TCP window */
5246 	uint16 PAD;
5247 } wl_mtcpkeep_alive_conn_pkt_t;
5248 
5249 /** TCP Keep-Alive interval struct */
5250 typedef struct wl_mtcpkeep_alive_timers_pkt {
5251 	uint16 interval;		/**< interval timer */
5252 	uint16 retry_interval;		/**< retry_interval timer */
5253 	uint16 retry_count;		/**< retry_count */
5254 } wl_mtcpkeep_alive_timers_pkt_t;
5255 
5256 typedef struct wake_info {
5257 	uint32 wake_reason;
5258 	uint32 wake_info_len;		/**< size of packet */
5259 	uint8  packet[];
5260 } wake_info_t;
5261 
5262 typedef struct wake_pkt {
5263 	uint32 wake_pkt_len;		/**< size of packet */
5264 	uint8  packet[];
5265 } wake_pkt_t;
5266 
5267 #define WL_MTCPKEEP_ALIVE_VERSION		1
5268 
5269 /* #ifdef WLBA */
5270 
5271 #define WLC_BA_CNT_VERSION  1   /**< current version of wlc_ba_cnt_t */
5272 
5273 /** block ack related stats */
5274 typedef struct wlc_ba_cnt {
5275 	uint16  version;    /**< WLC_BA_CNT_VERSION */
5276 	uint16  length;     /**< length of entire structure */
5277 
5278 	/* transmit stat counters */
5279 	uint32 txpdu;       /**< pdus sent */
5280 	uint32 txsdu;       /**< sdus sent */
5281 	uint32 txfc;        /**< tx side flow controlled packets */
5282 	uint32 txfci;       /**< tx side flow control initiated */
5283 	uint32 txretrans;   /**< retransmitted pdus */
5284 	uint32 txbatimer;   /**< ba resend due to timer */
5285 	uint32 txdrop;      /**< dropped packets */
5286 	uint32 txaddbareq;  /**< addba req sent */
5287 	uint32 txaddbaresp; /**< addba resp sent */
5288 	uint32 txdelba;     /**< delba sent */
5289 	uint32 txba;        /**< ba sent */
5290 	uint32 txbar;       /**< bar sent */
5291 	uint32 txpad[4];    /**< future */
5292 
5293 	/* receive side counters */
5294 	uint32 rxpdu;       /**< pdus recd */
5295 	uint32 rxqed;       /**< pdus buffered before sending up */
5296 	uint32 rxdup;       /**< duplicate pdus */
5297 	uint32 rxnobuf;     /**< pdus discarded due to no buf */
5298 	uint32 rxaddbareq;  /**< addba req recd */
5299 	uint32 rxaddbaresp; /**< addba resp recd */
5300 	uint32 rxdelba;     /**< delba recd */
5301 	uint32 rxba;        /**< ba recd */
5302 	uint32 rxbar;       /**< bar recd */
5303 	uint32 rxinvba;     /**< invalid ba recd */
5304 	uint32 rxbaholes;   /**< ba recd with holes */
5305 	uint32 rxunexp;     /**< unexpected packets */
5306 	uint32 rxpad[4];    /**< future */
5307 } wlc_ba_cnt_t;
5308 /* #endif  WLBA */
5309 
5310 /** structure for per-tid ampdu control */
5311 struct ampdu_tid_control {
5312 	uint8 tid;			/* tid */
5313 	uint8 enable;			/* enable/disable */
5314 };
5315 
5316 /** struct for ampdu tx/rx aggregation control */
5317 struct ampdu_aggr {
5318 	int8 aggr_override;	/**< aggr overrided by dongle. Not to be set by host. */
5319 	uint16 conf_TID_bmap;	/**< bitmap of TIDs to configure */
5320 	uint16 enab_TID_bmap;	/**< enable/disable per TID */
5321 };
5322 
5323 /** structure for identifying ea/tid for sending addba/delba */
5324 struct ampdu_ea_tid {
5325 	struct ether_addr ea;		/**< Station address */
5326 	uint8 tid;			/**< tid */
5327 	uint8 initiator;	/**< 0 is recipient, 1 is originator */
5328 };
5329 
5330 /** structure for identifying retry/tid for retry_limit_tid/rr_retry_limit_tid */
5331 struct ampdu_retry_tid {
5332 	uint8 tid;	/**< tid */
5333 	uint8 retry;	/**< retry value */
5334 };
5335 
5336 #define BDD_FNAME_LEN       32  /**< Max length of friendly name */
5337 typedef struct bdd_fname {
5338 	uint8 len;          /**< length of friendly name */
5339 	uchar name[BDD_FNAME_LEN];  /**< friendly name */
5340 } bdd_fname_t;
5341 
5342 /* structure for addts arguments */
5343 /** For ioctls that take a list of TSPEC */
5344 struct tslist {
5345 	int32 count;			/**< number of tspecs */
5346 	struct tsinfo_arg tsinfo[];	/**< variable length array of tsinfo */
5347 };
5348 
5349 /* WLTDLS */
5350 /**structure for tdls iovars */
5351 typedef struct tdls_iovar {
5352 	struct ether_addr ea;		/**< Station address */
5353 	uint8 mode;			/**< mode: depends on iovar */
5354 	uint8 PAD;
5355 	chanspec_t chanspec;
5356 	uint8 PAD[6];
5357 } tdls_iovar_t;
5358 
5359 #define TDLS_WFD_IE_SIZE		512
5360 /**structure for tdls wfd ie */
5361 typedef struct tdls_wfd_ie_iovar {
5362 	struct ether_addr ea;		/**< Station address */
5363 	uint8 mode;
5364 	uint8 PAD;
5365 	uint16 length;
5366 	uint8 data[TDLS_WFD_IE_SIZE];
5367 } tdls_wfd_ie_iovar_t;
5368 /* #endif WLTDLS */
5369 
5370 /** structure for addts/delts arguments */
5371 typedef struct tspec_arg {
5372 	uint16 version;			/**< see definition of TSPEC_ARG_VERSION */
5373 	uint16 length;			/**< length of entire structure */
5374 	uint32 flag;			/**< bit field */
5375 	/* TSPEC Arguments */
5376 	struct tsinfo_arg tsinfo;	/**< TS Info bit field */
5377 	uint8  PAD;
5378 	uint16 nom_msdu_size;		/**< (Nominal or fixed) MSDU Size (bytes) */
5379 	uint16 max_msdu_size;		/**< Maximum MSDU Size (bytes) */
5380 	uint32 min_srv_interval;		/**< Minimum Service Interval (us) */
5381 	uint32 max_srv_interval;		/**< Maximum Service Interval (us) */
5382 	uint32 inactivity_interval;	/**< Inactivity Interval (us) */
5383 	uint32 suspension_interval;	/**< Suspension Interval (us) */
5384 	uint32 srv_start_time;		/**< Service Start Time (us) */
5385 	uint32 min_data_rate;		/**< Minimum Data Rate (bps) */
5386 	uint32 mean_data_rate;		/**< Mean Data Rate (bps) */
5387 	uint32 peak_data_rate;		/**< Peak Data Rate (bps) */
5388 	uint32 max_burst_size;		/**< Maximum Burst Size (bytes) */
5389 	uint32 delay_bound;		/**< Delay Bound (us) */
5390 	uint32 min_phy_rate;		/**< Minimum PHY Rate (bps) */
5391 	uint16 surplus_bw;		/**< Surplus Bandwidth Allowance (range 1.0 to 8.0) */
5392 	uint16 medium_time;		/**< Medium Time (32 us/s periods) */
5393 	uint8 dialog_token;		/**< dialog token */
5394 	uint8  PAD[3];
5395 } tspec_arg_t;
5396 
5397 /** tspec arg for desired station */
5398 typedef	struct tspec_per_sta_arg {
5399 	struct ether_addr ea;
5400 	uint8  PAD[2];
5401 	struct tspec_arg ts;
5402 } tspec_per_sta_arg_t;
5403 
5404 /** structure for max bandwidth for each access category */
5405 typedef	struct wme_max_bandwidth {
5406 	uint32	ac[AC_COUNT];	/**< max bandwidth for each access category */
5407 } wme_max_bandwidth_t;
5408 
5409 #define WL_WME_MBW_PARAMS_IO_BYTES (sizeof(wme_max_bandwidth_t))
5410 
5411 /* current version of wl_tspec_arg_t struct */
5412 #define	TSPEC_ARG_VERSION		2	/**< current version of wl_tspec_arg_t struct */
5413 #define TSPEC_ARG_LENGTH		55	/**< argument length from tsinfo to medium_time */
5414 #define TSPEC_DEFAULT_DIALOG_TOKEN	42	/**< default dialog token */
5415 #define TSPEC_DEFAULT_SBW_FACTOR	0x3000	/**< default surplus bw */
5416 
5417 #define WL_WOWL_KEEPALIVE_MAX_PACKET_SIZE  80
5418 #define WLC_WOWL_MAX_KEEPALIVE	2
5419 
5420 /** Packet lifetime configuration per ac */
5421 typedef struct wl_lifetime {
5422 	uint32 ac;	        /**< access class */
5423 	uint32 lifetime;    /**< Packet lifetime value in ms */
5424 } wl_lifetime_t;
5425 
5426 /** Management time configuration */
5427 typedef struct wl_lifetime_mg {
5428 	uint32 mgmt_bitmap;	/**< Mgmt subtype */
5429 	uint32 lifetime;    /**< Packet lifetime value in us */
5430 } wl_lifetime_mg_t;
5431 
5432 /* MAC Sample Capture related */
5433 #define	WL_MACCAPTR_DEFSTART_PTR	0xA00
5434 #define	WL_MACCAPTR_DEFSTOP_PTR		0xA3F
5435 #define	WL_MACCAPTR_DEFSZ		0x3F
5436 
5437 #define WL_MACCAPTR_DEF_MASK		0xFFFFFFFF
5438 
5439 typedef enum {
5440 	WL_MACCAPT_TRIG		= 0,
5441 	WL_MACCAPT_STORE	= 1,
5442 	WL_MACCAPT_TRANS	= 2,
5443 	WL_MACCAPT_MATCH	= 3
5444 } maccaptr_optn;
5445 
5446 typedef enum {
5447 	WL_MACCAPT_STRT	= 1,
5448 	WL_MACCAPT_STOP	= 2,
5449 	WL_MACCAPT_RST	= 3
5450 } maccaptr_cmd_t;
5451 
5452 /* MAC Sample Capture Set-up Paramters */
5453 typedef struct wl_maccapture_params {
5454 	uint8	gpio_sel;
5455 	uint8	la_mode;	/* TRUE: GPIO Out Enabled */
5456 	uint8 	PAD[2];
5457 	uint32	start_ptr;	/* Start address to store */
5458 	uint32	stop_ptr;	/* Stop address to store */
5459 	uint8	optn_bmp;	/* Options */
5460 	uint8 	PAD[3];
5461 	uint32	tr_mask;	/* Trigger Mask */
5462 	uint32	tr_val;		/* Trigger Value */
5463 	uint32	s_mask;		/* Store Mode Mask */
5464 	uint32	x_mask;		/* Trans. Mode Mask */
5465 	uint32	m_mask;		/* Match Mode Mask */
5466 	uint32	m_val;		/* Match Value */
5467 	maccaptr_cmd_t cmd;	/* Start / Stop */
5468 } wl_maccapture_params_t;
5469 
5470 /** Channel Switch Announcement param */
5471 typedef struct wl_chan_switch {
5472 	uint8 mode;		/**< value 0 or 1 */
5473 	uint8 count;		/**< count # of beacons before switching */
5474 	chanspec_t chspec;	/**< chanspec */
5475 	uint8 reg;		/**< regulatory class */
5476 	uint8 frame_type;		/**< csa frame type, unicast or broadcast */
5477 } wl_chan_switch_t;
5478 
5479 enum {
5480 	PFN_LIST_ORDER,
5481 	PFN_RSSI
5482 };
5483 
5484 enum {
5485 	DISABLE,
5486 	ENABLE
5487 };
5488 
5489 enum {
5490 	OFF_ADAPT,
5491 	SMART_ADAPT,
5492 	STRICT_ADAPT,
5493 	SLOW_ADAPT
5494 };
5495 
5496 #define SORT_CRITERIA_BIT		0
5497 #define AUTO_NET_SWITCH_BIT		1
5498 #define ENABLE_BKGRD_SCAN_BIT		2
5499 #define IMMEDIATE_SCAN_BIT		3
5500 #define	AUTO_CONNECT_BIT		4
5501 #define	ENABLE_BD_SCAN_BIT		5
5502 #define ENABLE_ADAPTSCAN_BIT		6
5503 #define IMMEDIATE_EVENT_BIT		8
5504 #define SUPPRESS_SSID_BIT		9
5505 #define ENABLE_NET_OFFLOAD_BIT		10
5506 /** report found/lost events for SSID and BSSID networks seperately */
5507 #define REPORT_SEPERATELY_BIT		11
5508 
5509 #define SORT_CRITERIA_MASK	0x0001
5510 #define AUTO_NET_SWITCH_MASK	0x0002
5511 #define ENABLE_BKGRD_SCAN_MASK	0x0004
5512 #define IMMEDIATE_SCAN_MASK	0x0008
5513 #define AUTO_CONNECT_MASK	0x0010
5514 
5515 #define ENABLE_BD_SCAN_MASK	0x0020
5516 #define ENABLE_ADAPTSCAN_MASK	0x00c0
5517 #define IMMEDIATE_EVENT_MASK	0x0100
5518 #define SUPPRESS_SSID_MASK	0x0200
5519 #define ENABLE_NET_OFFLOAD_MASK	0x0400
5520 /** report found/lost events for SSID and BSSID networks seperately */
5521 #define REPORT_SEPERATELY_MASK	0x0800
5522 
5523 #define PFN_VERSION			2
5524 
5525 #define PFN_COMPLETE			1
5526 #define PFN_INCOMPLETE			0
5527 
5528 #define DEFAULT_BESTN			2
5529 #define DEFAULT_MSCAN			0
5530 #define DEFAULT_REPEAT			10
5531 #define DEFAULT_EXP			2
5532 
5533 #define PFN_PARTIAL_SCAN_BIT		0
5534 #define PFN_PARTIAL_SCAN_MASK		1
5535 
5536 #define PFN_SWC_RSSI_WINDOW_MAX   8
5537 #define PFN_SWC_MAX_NUM_APS       16
5538 #define PFN_HOTLIST_MAX_NUM_APS   64
5539 
5540 #define MAX_EPNO_HIDDEN_SSID    8
5541 #define MAX_WHITELIST_SSID      2
5542 
5543 /* Version 1 and 2 for various scan results structures defined below */
5544 #define PFN_SCANRESULTS_VERSION_V1	1
5545 #define PFN_SCANRESULTS_VERSION_V2	2
5546 
5547 /** PFN network info structure */
5548 typedef struct wl_pfn_subnet_info_v1 {
5549 	struct ether_addr BSSID;
5550 	uint8	channel; /**< channel number only */
5551 	uint8	SSID_len;
5552 	uint8	SSID[32];
5553 } wl_pfn_subnet_info_v1_t;
5554 
5555 typedef struct wl_pfn_subnet_info_v2 {
5556 	struct ether_addr BSSID;
5557 	uint8   channel; /**< channel number only */
5558 	uint8   SSID_len;
5559 	union {
5560 		uint8   SSID[32];
5561 		uint16 index;
5562 	} u;
5563 } wl_pfn_subnet_info_v2_t;
5564 
5565 typedef struct wl_pfn_net_info_v1 {
5566 	wl_pfn_subnet_info_v1_t pfnsubnet;
5567 	int16	RSSI; /**< receive signal strength (in dBm) */
5568 	uint16	timestamp; /**< age in seconds */
5569 } wl_pfn_net_info_v1_t;
5570 
5571 typedef struct wl_pfn_net_info_v2 {
5572 	wl_pfn_subnet_info_v2_t pfnsubnet;
5573 	int16   RSSI; /**< receive signal strength (in dBm) */
5574 	uint16  timestamp; /**< age in seconds */
5575 } wl_pfn_net_info_v2_t;
5576 
5577 /* Version 1 and 2 for various lbest scan results structures below */
5578 #define PFN_LBEST_SCAN_RESULT_VERSION_V1 1
5579 #define PFN_LBEST_SCAN_RESULT_VERSION_V2 2
5580 
5581 #define MAX_CHBKT_PER_RESULT		4
5582 
5583 typedef struct wl_pfn_lnet_info_v1 {
5584 	wl_pfn_subnet_info_v1_t pfnsubnet; /**< BSSID + channel + SSID len + SSID */
5585 	uint16	flags; /**< partial scan, etc */
5586 	int16	RSSI; /**< receive signal strength (in dBm) */
5587 	uint32	timestamp; /**< age in miliseconds */
5588 	uint16	rtt0; /**< estimated distance to this AP in centimeters */
5589 	uint16	rtt1; /**< standard deviation of the distance to this AP in centimeters */
5590 } wl_pfn_lnet_info_v1_t;
5591 
5592 typedef struct wl_pfn_lnet_info_v2 {
5593 	wl_pfn_subnet_info_v2_t pfnsubnet; /**< BSSID + channel + SSID len + SSID */
5594 	uint16  flags; /**< partial scan, etc */
5595 	int16   RSSI; /**< receive signal strength (in dBm) */
5596 	uint32  timestamp; /**< age in miliseconds */
5597 	uint16  rtt0; /**< estimated distance to this AP in centimeters */
5598 	uint16  rtt1; /**< standard deviation of the distance to this AP in centimeters */
5599 } wl_pfn_lnet_info_v2_t;
5600 
5601 typedef struct wl_pfn_lscanresults_v1 {
5602 	uint32 version;
5603 	uint32 status;
5604 	uint32 count;
5605 	wl_pfn_lnet_info_v1_t netinfo[1];
5606 } wl_pfn_lscanresults_v1_t;
5607 
5608 typedef struct wl_pfn_lscanresults_v2 {
5609 	uint32 version;
5610 	uint16 status;
5611 	uint16 count;
5612 	uint32 scan_ch_buckets[MAX_CHBKT_PER_RESULT];
5613 	wl_pfn_lnet_info_v2_t netinfo[1];
5614 } wl_pfn_lscanresults_v2_t;
5615 
5616 /**this is used to report on 1-* pfn scan results */
5617 typedef struct wl_pfn_scanresults_v1 {
5618 	uint32 version;
5619 	uint32 status;
5620 	uint32 count;
5621 	wl_pfn_net_info_v1_t netinfo[1];
5622 } wl_pfn_scanresults_v1_t;
5623 
5624 typedef struct wl_pfn_scanresults_v2 {
5625 	uint32 version;
5626 	uint32 status;
5627 	uint32 count;
5628 	uint32 scan_ch_bucket;
5629 	wl_pfn_net_info_v2_t netinfo[1];
5630 } wl_pfn_scanresults_v2_t;
5631 
5632 typedef struct wl_pfn_significant_net {
5633 	uint16 flags;
5634 	uint16 channel;
5635 	struct ether_addr BSSID;
5636 	int8 rssi[PFN_SWC_RSSI_WINDOW_MAX];
5637 } wl_pfn_significant_net_t;
5638 
5639 #define PFN_SWC_SCANRESULT_VERSION     1
5640 
5641 typedef struct wl_pfn_swc_results {
5642 	uint32 version;
5643 	uint32 pkt_count;   /**< No. of results in current frame */
5644 	uint32 total_count; /**< Total expected results */
5645 	wl_pfn_significant_net_t list[];
5646 } wl_pfn_swc_results_t;
5647 typedef struct wl_pfn_net_info_bssid {
5648 	struct ether_addr BSSID;
5649 	uint8 channel;	/**< channel number only */
5650 	int8  RSSI;	/**< receive signal strength (in dBm) */
5651 	uint16 flags;	/**< (e.g. partial scan, off channel) */
5652 	uint16 timestamp; /**< age in seconds */
5653 } wl_pfn_net_info_bssid_t;
5654 
5655 typedef struct wl_pfn_scanhist_bssid {
5656 	uint32 version;
5657 	uint32 status;
5658 	uint32 count;
5659 	wl_pfn_net_info_bssid_t netinfo[1];
5660 } wl_pfn_scanhist_bssid_t;
5661 
5662 /* Version 1 and 2 for various single scan result */
5663 #define PFN_SCANRESULT_VERSION_V1	1
5664 #define PFN_SCANRESULT_VERSION_V2	2
5665 
5666 /* used to report exactly one scan result */
5667 /* plus reports detailed scan info in bss_info */
5668 typedef struct wl_pfn_scanresult_v1 {
5669 	uint32 version;
5670 	uint32 status;
5671 	uint32 count;
5672 	wl_pfn_net_info_v1_t netinfo;
5673 	wl_bss_info_v109_t bss_info;
5674 } wl_pfn_scanresult_v1_t;
5675 
5676 typedef struct wl_pfn_scanresult_v2 {
5677 	uint32 version;
5678 	uint32 status;
5679 	uint32 count;
5680 	wl_pfn_net_info_v2_t netinfo;
5681 	wl_bss_info_v109_t bss_info;
5682 } wl_pfn_scanresult_v2_t;
5683 
5684 typedef struct wl_pfn_scanresult_v2_1 {
5685 	uint32 version;
5686 	uint32 status;
5687 	uint32 count;
5688 	wl_pfn_net_info_v2_t netinfo;
5689 	uint8 bss_info[];	/* var length wl_bss_info_X structures */
5690 } wl_pfn_scanresult_v2_1_t;
5691 
5692 /**PFN data structure */
5693 typedef struct wl_pfn_param {
5694 	int32 version;			/**< PNO parameters version */
5695 	int32 scan_freq;		/**< Scan frequency */
5696 	int32 lost_network_timeout;	/**< Timeout in sec. to declare
5697 								* discovered network as lost
5698 								*/
5699 	int16 flags;			/**< Bit field to control features
5700 							* of PFN such as sort criteria auto
5701 							* enable switch and background scan
5702 							*/
5703 	int16 rssi_margin;		/**< Margin to avoid jitter for choosing a
5704 							* PFN based on RSSI sort criteria
5705 							*/
5706 	uint8 bestn; /**< number of best networks in each scan */
5707 	uint8 mscan; /**< number of scans recorded */
5708 	uint8 repeat; /**< Minimum number of scan intervals
5709 				     *before scan frequency changes in adaptive scan
5710 				     */
5711 	uint8 exp; /**< Exponent of 2 for maximum scan interval */
5712 	int32 slow_freq; /**< slow scan period */
5713 } wl_pfn_param_t;
5714 
5715 typedef struct wl_pfn_bssid {
5716 	struct ether_addr  macaddr;
5717 	/* Bit4: suppress_lost, Bit3: suppress_found */
5718 	uint16             flags;
5719 } wl_pfn_bssid_t;
5720 typedef struct wl_pfn_significant_bssid {
5721 	struct ether_addr	macaddr;
5722 	int8    rssi_low_threshold;
5723 	int8    rssi_high_threshold;
5724 } wl_pfn_significant_bssid_t;
5725 #define WL_PFN_SUPPRESSFOUND_MASK	0x08
5726 #define WL_PFN_SUPPRESSLOST_MASK	0x10
5727 #define WL_PFN_SSID_IMPRECISE_MATCH	0x80
5728 #define WL_PFN_SSID_SAME_NETWORK	0x10000
5729 #define WL_PFN_SUPPRESS_AGING_MASK	0x20000
5730 #define WL_PFN_FLUSH_ALL_SSIDS		0x40000
5731 
5732 #define WL_PFN_IOVAR_FLAG_MASK		0xFFFF00FF
5733 #define WL_PFN_RSSI_MASK		0xff00
5734 #define WL_PFN_RSSI_SHIFT		8
5735 
5736 typedef struct wl_pfn_cfg {
5737 	uint32	reporttype;
5738 	int32	channel_num;
5739 	uint16	channel_list[WL_NUMCHANNELS];
5740 	uint32	flags;
5741 } wl_pfn_cfg_t;
5742 
5743 #define WL_PFN_SSID_CFG_VERSION		1
5744 #define WL_PFN_SSID_CFG_CLEAR		0x1
5745 
5746 typedef struct wl_pfn_ssid_params {
5747 	int8 min5G_rssi;           /* minimum 5GHz RSSI for a BSSID to be considered      */
5748 	int8 min2G_rssi;           /* minimum 2.4GHz RSSI for a BSSID to be considered   */
5749 	int16 init_score_max;     /* The maximum score that a network can have before bonuses  */
5750 
5751 	int16 cur_bssid_bonus;    /* Add to current bssid                                      */
5752 	int16 same_ssid_bonus;    /* score bonus for all networks with the same network flag   */
5753 	int16 secure_bonus;       /* score bonus for networks that are not open          */
5754 	int16 band_5g_bonus;
5755 } wl_pfn_ssid_params_t;
5756 
5757 typedef struct wl_ssid_ext_params {
5758 	int8 min5G_rssi;	/* minimum 5GHz RSSI for a BSSID to be considered      */
5759 	int8 min2G_rssi;	/* minimum 2.4GHz RSSI for a BSSID to be considered   */
5760 	int16 init_score_max;	/* The maximum score that a network can have before bonuses  */
5761 	int16 cur_bssid_bonus;	/* Add to current bssid                                      */
5762 	int16 same_ssid_bonus;	/* score bonus for all networks with the same network flag   */
5763 	int16 secure_bonus;	/* score bonus for networks that are not open                */
5764 	int16 band_5g_bonus;
5765 } wl_ssid_ext_params_t;
5766 
5767 typedef struct wl_pfn_ssid_cfg {
5768 	uint16 version;
5769 	uint16 flags;
5770 	wl_ssid_ext_params_t params;
5771 } wl_pfn_ssid_cfg_t;
5772 
5773 #define CH_BUCKET_REPORT_NONE                   0
5774 #define CH_BUCKET_REPORT_SCAN_COMPLETE_ONLY     1
5775 #define CH_BUCKET_REPORT_FULL_RESULT            2
5776 #define CH_BUCKET_REPORT_SCAN_COMPLETE    (CH_BUCKET_REPORT_SCAN_COMPLETE_ONLY | \
5777 								CH_BUCKET_REPORT_FULL_RESULT)
5778 #define CH_BUCKET_REPORT_REGULAR            0
5779 #define CH_BUCKET_GSCAN                     4
5780 
5781 typedef struct wl_pfn_gscan_ch_bucket_cfg {
5782 	uint8 bucket_end_index;
5783 	uint8 bucket_freq_multiple;
5784 	uint8 flag;
5785 	uint8 reserved;
5786 	uint16 repeat;
5787 	uint16 max_freq_multiple;
5788 } wl_pfn_gscan_ch_bucket_cfg_t;
5789 
5790 typedef struct wl_pfn_capabilities {
5791 	uint16 max_mscan;
5792 	uint16 max_bestn;
5793 	uint16 max_swc_bssid;
5794 	uint16 max_hotlist_bssid;
5795 } wl_pfn_capabilities_t;
5796 
5797 #define GSCAN_SEND_ALL_RESULTS_MASK          (1 << 0)
5798 #define GSCAN_ALL_BUCKETS_IN_FIRST_SCAN_MASK (1 << 3)
5799 #define GSCAN_CFG_FLAGS_ONLY_MASK            (1 << 7)
5800 #define WL_GSCAN_CFG_VERSION                     1
5801 typedef struct wl_pfn_gscan_cfg {
5802 	uint16 version;
5803 	/**
5804 	 * BIT0 1 = send probes/beacons to HOST
5805 	 * BIT1 Reserved
5806 	 * BIT2 Reserved
5807 	 * Add any future flags here
5808 	 * BIT7 1 = no other useful cfg sent
5809 	 */
5810 	uint8  flags;
5811 	/** Buffer filled threshold in % to generate an event */
5812 	uint8   buffer_threshold;
5813 	/**
5814 	 * No. of BSSIDs with "change" to generate an evt
5815 	 * change - crosses rssi threshold/lost
5816 	 */
5817 	uint8   swc_nbssid_threshold;
5818 	/* Max=8 (for now) Size of rssi cache buffer */
5819 	uint8  swc_rssi_window_size;
5820 	uint8  count_of_channel_buckets;
5821 	uint8  retry_threshold;
5822 	uint16  lost_ap_window;
5823 	wl_pfn_gscan_ch_bucket_cfg_t channel_bucket[1];
5824 } wl_pfn_gscan_cfg_t;
5825 
5826 #define WL_PFN_REPORT_ALLNET    0
5827 #define WL_PFN_REPORT_SSIDNET   1
5828 #define WL_PFN_REPORT_BSSIDNET  2
5829 
5830 #define WL_PFN_CFG_FLAGS_PROHIBITED	0x00000001	/* Accept and use prohibited channels */
5831 #define WL_PFN_CFG_FLAGS_RESERVED	0xfffffffe	/**< Remaining reserved for future use */
5832 
5833 typedef struct wl_pfn {
5834 	wlc_ssid_t		ssid;			/**< ssid name and its length */
5835 	int32			flags;			/**< bit2: hidden */
5836 	int32			infra;			/**< BSS Vs IBSS */
5837 	int32			auth;			/**< Open Vs Closed */
5838 	int32			wpa_auth;		/**< WPA type */
5839 	int32			wsec;			/**< wsec value */
5840 	wsec_pmk_t              psk;                    /**< Password */
5841 } wl_pfn_t;
5842 
5843 typedef struct wl_pfn_list {
5844 	uint32		version;
5845 	uint32		enabled;
5846 	uint32		count;
5847 	wl_pfn_t	pfn[1];
5848 } wl_pfn_list_t;
5849 
5850 #define PFN_SSID_EXT_VERSION   1
5851 
5852 typedef struct wl_pfn_ext {
5853 	uint8 flags;
5854 	int8 rssi_thresh; /* RSSI threshold, track only if RSSI > threshold */
5855 	uint16 wpa_auth; /* Match the wpa auth type defined in wlioctl_defs.h */
5856 	uint8 ssid[DOT11_MAX_SSID_LEN];
5857 	uint8 ssid_len;
5858 	uint8 pad;
5859 } wl_pfn_ext_t;
5860 typedef struct wl_pfn_ext_list {
5861 	uint16 version;
5862 	uint16 count;
5863 	wl_pfn_ext_t pfn_ext[1];
5864 } wl_pfn_ext_list_t;
5865 
5866 #define WL_PFN_SSID_EXT_FOUND   0x1
5867 #define WL_PFN_SSID_EXT_LOST    0x2
5868 typedef struct wl_pfn_result_ssid {
5869 	uint8 flags;
5870 	int8 rssi;
5871 	/* channel number */
5872 	uint16 channel;
5873 	/* Assume idx in order of cfg */
5874 	uint32 index;
5875 } wl_pfn_result_ssid_crc32_t;
5876 
5877 typedef struct wl_pfn_ssid_ext_result {
5878 	uint16 version;
5879 	uint16 count;
5880 	wl_pfn_result_ssid_crc32_t net[1];
5881 } wl_pfn_ssid_ext_result_t;
5882 
5883 #define PFN_EXT_AUTH_CODE_OPEN   1 /* open */
5884 #define PFN_EXT_AUTH_CODE_PSK   2 /* WPA_PSK or WPA2PSK */
5885 #define PFN_EXT_AUTH_CODE_EAPOL 4 /* any EAPOL  */
5886 
5887 #define WL_PFN_HIDDEN_BIT		2
5888 #define WL_PFN_HIDDEN_MASK		0x4
5889 
5890 #ifndef BESTN_MAX
5891 #define BESTN_MAX			10
5892 #endif // endif
5893 
5894 #ifndef MSCAN_MAX
5895 #define MSCAN_MAX			90
5896 #endif // endif
5897 
5898 /* Dynamic scan configuration for motion profiles */
5899 
5900 #define WL_PFN_MPF_VERSION 1
5901 
5902 /* Valid group IDs, may be expanded in the future */
5903 #define WL_PFN_MPF_GROUP_SSID 0
5904 #define WL_PFN_MPF_GROUP_BSSID 1
5905 #define WL_PFN_MPF_MAX_GROUPS 2
5906 
5907 /* Max number of MPF states supported in this time */
5908 #define WL_PFN_MPF_STATES_MAX 4
5909 
5910 /* Flags for the mpf-specific stuff */
5911 #define WL_PFN_MPF_ADAPT_ON_BIT		0
5912 #define WL_PFN_MPF_ADAPTSCAN_BIT	1
5913 
5914 #define WL_PFN_MPF_ADAPT_ON_MASK	0x0001
5915 #define WL_PFN_MPF_ADAPTSCAN_MASK 	0x0006
5916 
5917 /* Per-state timing values */
5918 typedef struct wl_pfn_mpf_state_params {
5919 	int32  scan_freq;	/* Scan frequency (secs) */
5920 	int32  lost_network_timeout; /* Timeout to declare net lost (secs) */
5921 	int16  flags;		/* Space for flags: ADAPT etc */
5922 	uint8  exp;		/* Exponent of 2 for max interval for SMART/STRICT_ADAPT */
5923 	uint8  repeat;		/* Number of scans before changing adaptation level */
5924 	int32  slow_freq;	/* Slow scan period for SLOW_ADAPT */
5925 } wl_pfn_mpf_state_params_t;
5926 
5927 typedef struct wl_pfn_mpf_param {
5928 	uint16 version;		/* Structure version */
5929 	uint16 groupid;		/* Group ID: 0 (SSID), 1 (BSSID), other: reserved */
5930 	wl_pfn_mpf_state_params_t state[WL_PFN_MPF_STATES_MAX];
5931 } wl_pfn_mpf_param_t;
5932 
5933 /* Structure for setting pfn_override iovar */
5934 typedef struct wl_pfn_override_param {
5935 	uint16 version;         /* Structure version */
5936 	uint16 start_offset;    /* Seconds from now to apply new params */
5937 	uint16 duration;        /* Seconds to keep new params applied */
5938 	uint16 reserved;
5939 	wl_pfn_mpf_state_params_t override;
5940 } wl_pfn_override_param_t;
5941 #define WL_PFN_OVERRIDE_VERSION	1
5942 
5943 /*
5944  * Definitions for base MPF configuration
5945  */
5946 
5947 #define WL_MPF_VERSION 1
5948 #define WL_MPF_MAX_BITS 3
5949 #define WL_MPF_MAX_STATES (1 << WL_MPF_MAX_BITS)
5950 
5951 #define WL_MPF_STATE_NAME_MAX 12
5952 
5953 typedef struct wl_mpf_val {
5954 	uint16 val;		/* Value of GPIO bits */
5955 	uint16 state;		/* State identifier */
5956 	char name[WL_MPF_STATE_NAME_MAX]; /* Optional name */
5957 } wl_mpf_val_t;
5958 
5959 typedef struct wl_mpf_map {
5960 	uint16 version;
5961 	uint16 type;
5962 	uint16 mask;		/* Which GPIO bits to use */
5963 	uint8  count;		/* Count of state/value mappings */
5964 	uint8  PAD;
5965 	wl_mpf_val_t vals[WL_MPF_MAX_STATES];
5966 } wl_mpf_map_t;
5967 
5968 #define WL_MPF_STATE_AUTO (0xFFFF) /* (uint16)-1) */
5969 
5970 typedef struct wl_mpf_state {
5971 	uint16 version;
5972 	uint16 type;
5973 	uint16 state;		/* Get/Set */
5974 	uint8 force;		/* 0 - auto (HW) state, 1 - forced state */
5975 	char name[WL_MPF_STATE_NAME_MAX]; /* Get/Set: Optional/actual name */
5976 	uint8  PAD;
5977 } wl_mpf_state_t;
5978 /*
5979  * WLFCTS definition
5980  */
5981 typedef struct wl_txstatus_additional_info {
5982 	uint32 rspec;
5983 	uint32 enq_ts;
5984 	uint32 last_ts;
5985 	uint32 entry_ts;
5986 	uint16 seq;
5987 	uint8  rts_cnt;
5988 	uint8  tx_cnt;
5989 } wl_txstatus_additional_info_t;
5990 
5991 /** Service discovery */
5992 typedef struct {
5993 	uint8	transaction_id;	/**< Transaction id */
5994 	uint8	protocol;	/**< Service protocol type */
5995 	uint16	query_len;	/**< Length of query */
5996 	uint16	response_len;	/**< Length of response */
5997 	uint8	qrbuf[];
5998 } wl_p2po_qr_t;
5999 
6000 typedef struct {
6001 	uint16			period;			/**< extended listen period */
6002 	uint16			interval;		/**< extended listen interval */
6003 	uint16                  count;                  /* count to repeat */
6004 	uint16                  pad;                    /* pad for 32bit align */
6005 } wl_p2po_listen_t;
6006 
6007 /** GAS state machine tunable parameters.  Structure field values of 0 means use the default. */
6008 typedef struct wl_gas_config {
6009 	uint16 max_retransmit;		/**< Max # of firmware/driver retransmits on no Ack
6010 					 * from peer (on top of the ucode retries).
6011 					 */
6012 	uint16 response_timeout;	/**< Max time to wait for a GAS-level response
6013 					 * after sending a packet.
6014 					 */
6015 	uint16 max_comeback_delay;	/**< Max GAS response comeback delay.
6016 					 * Exceeding this fails the GAS exchange.
6017 					 */
6018 	uint16 max_retries;		/**< Max # of GAS state machine retries on failure
6019 					 * of a GAS frame exchange.
6020 					 */
6021 } wl_gas_config_t;
6022 
6023 /** P2P Find Offload parameters */
6024 typedef struct wl_p2po_find_config {
6025 	uint16 version;			/**< Version of this struct */
6026 	uint16 length;			/**< sizeof(wl_p2po_find_config_t) */
6027 	int32 search_home_time;		/**< P2P search state home time when concurrent
6028 					 * connection exists.  -1 for default.
6029 					 */
6030 	uint8 num_social_channels;
6031 			/**< Number of social channels up to WL_P2P_SOCIAL_CHANNELS_MAX.
6032 			 * 0 means use default social channels.
6033 			 */
6034 	uint8 flags;
6035 	uint16 social_channels[1];	/**< Variable length array of social channels */
6036 } wl_p2po_find_config_t;
6037 #define WL_P2PO_FIND_CONFIG_VERSION 2	/**< value for version field */
6038 
6039 /** wl_p2po_find_config_t flags */
6040 #define P2PO_FIND_FLAG_SCAN_ALL_APS 0x01	/**< Whether to scan for all APs in the p2po_find
6041 						 * periodic scans of all channels.
6042 						 * 0 means scan for only P2P devices.
6043 						 * 1 means scan for P2P devices plus non-P2P APs.
6044 						 */
6045 
6046 /** For adding a WFDS service to seek */
6047 typedef struct {
6048 	uint32 seek_hdl;		/**< unique id chosen by host */
6049 	uint8 addr[6];			/**< Seek service from a specific device with this
6050 					 * MAC address, all 1's for any device.
6051 					 */
6052 	uint8 service_hash[P2P_WFDS_HASH_LEN];
6053 	uint8 service_name_len;
6054 	uint8 service_name[MAX_WFDS_SEEK_SVC_NAME_LEN];
6055 					/**< Service name to seek, not null terminated */
6056 	uint8 service_info_req_len;
6057 	uint8 service_info_req[1];	/**< Service info request, not null terminated.
6058 					 * Variable length specified by service_info_req_len.
6059 					 * Maximum length is MAX_WFDS_SEEK_SVC_INFO_LEN.
6060 					 */
6061 } wl_p2po_wfds_seek_add_t;
6062 
6063 /** For deleting a WFDS service to seek */
6064 typedef struct {
6065 	uint32 seek_hdl;		/**< delete service specified by id */
6066 } wl_p2po_wfds_seek_del_t;
6067 
6068 /** For adding a WFDS service to advertise */
6069 #include <packed_section_start.h>
6070 typedef BWL_PRE_PACKED_STRUCT struct {
6071 	uint32 advertise_hdl;		/**< unique id chosen by host */
6072 	uint8 service_hash[P2P_WFDS_HASH_LEN];
6073 	uint32 advertisement_id;
6074 	uint16 service_config_method;
6075 	uint8 service_name_len;
6076 	uint8 service_name[MAX_WFDS_SVC_NAME_LEN];
6077 					/**< Service name , not null terminated */
6078 	uint8 service_status;
6079 	uint16 service_info_len;
6080 	uint8 service_info[1];		/**< Service info, not null terminated.
6081 					 * Variable length specified by service_info_len.
6082 					 * Maximum length is MAX_WFDS_ADV_SVC_INFO_LEN.
6083 					 */
6084 } BWL_POST_PACKED_STRUCT wl_p2po_wfds_advertise_add_t;
6085 #include <packed_section_end.h>
6086 
6087 /** For deleting a WFDS service to advertise */
6088 typedef struct {
6089 	uint32 advertise_hdl;	/**< delete service specified by hdl */
6090 } wl_p2po_wfds_advertise_del_t;
6091 
6092 /** P2P Offload discovery mode for the p2po_state iovar */
6093 typedef enum {
6094 	WL_P2PO_DISC_STOP,
6095 	WL_P2PO_DISC_LISTEN,
6096 	WL_P2PO_DISC_DISCOVERY
6097 } disc_mode_t;
6098 
6099 /* ANQP offload */
6100 
6101 #define ANQPO_MAX_QUERY_SIZE		256
6102 typedef struct {
6103 	uint16 max_retransmit;		/**< ~0 use default, max retransmit on no ACK from peer */
6104 	uint16 response_timeout; /**< ~0 use default, msec to wait for resp after tx packet */
6105 	uint16 max_comeback_delay;	/**< ~0 use default, max comeback delay in resp else fail */
6106 	uint16 max_retries;		/**< ~0 use default, max retries on failure */
6107 	uint16 query_len;		/**< length of ANQP query */
6108 	uint8 query_data[1];		/**< ANQP encoded query (max ANQPO_MAX_QUERY_SIZE) */
6109 } wl_anqpo_set_t;
6110 
6111 #define WL_ANQPO_FLAGS_BSSID_WILDCARD		0x0001
6112 #define WL_ANQPO_PEER_LIST_VERSION_2		2
6113 typedef struct {
6114 	uint16 channel;			/**< channel of the peer */
6115 	struct ether_addr addr;		/**< addr of the peer */
6116 } wl_anqpo_peer_v1_t;
6117 typedef struct {
6118 	uint16 channel;			/**< channel of the peer */
6119 	struct ether_addr addr;		/**< addr of the peer */
6120 	uint32 flags;			/**< 0x01-Peer is MBO Capable */
6121 } wl_anqpo_peer_v2_t;
6122 
6123 #define ANQPO_MAX_PEER_LIST			64
6124 typedef struct {
6125 	uint16 count;				/**< number of peers in list */
6126 	wl_anqpo_peer_v1_t peer[1];	/**< max ANQPO_MAX_PEER_LIST */
6127 } wl_anqpo_peer_list_v1_t;
6128 
6129 typedef struct {
6130 	uint16  version;    /**<VERSION */
6131 	uint16  length;     /**< length of entire structure */
6132 	uint16 count;				/**< number of peers in list */
6133 	wl_anqpo_peer_v2_t peer[1];	/**< max ANQPO_MAX_PEER_LIST */
6134 } wl_anqpo_peer_list_v2_t;
6135 
6136 #ifndef WL_ANQPO_PEER_LIST_TYPEDEF_HAS_ALIAS
6137 typedef wl_anqpo_peer_list_v1_t wl_anqpo_peer_list_t;
6138 typedef wl_anqpo_peer_v1_t wl_anqpo_peer_t;
6139 #endif /* WL_ANQPO_PEER_LIST_TYPEDEF_HAS_ALIAS */
6140 
6141 #define ANQPO_MAX_IGNORE_SSID		64
6142 typedef struct {
6143 	uint8 is_clear;				/**< set to clear list (not used on GET) */
6144 	uint8 PAD;
6145 	uint16 count;				/**< number of SSID in list */
6146 	wlc_ssid_t ssid[1];			/**< max ANQPO_MAX_IGNORE_SSID */
6147 } wl_anqpo_ignore_ssid_list_t;
6148 
6149 #define ANQPO_MAX_IGNORE_BSSID		64
6150 typedef struct {
6151 	uint8 is_clear;				/**< set to clear list (not used on GET) */
6152 	uint8 PAD;
6153 	uint16 count;				/**< number of addr in list */
6154 	struct ether_addr bssid[];	/**< max ANQPO_MAX_IGNORE_BSSID */
6155 } wl_anqpo_ignore_bssid_list_t;
6156 
6157 struct toe_ol_stats_t {
6158 	/** Num of tx packets that don't need to be checksummed */
6159 	uint32 tx_summed;
6160 
6161 	/* Num of tx packets where checksum is filled by offload engine */
6162 	uint32 tx_iph_fill;
6163 	uint32 tx_tcp_fill;
6164 	uint32 tx_udp_fill;
6165 	uint32 tx_icmp_fill;
6166 
6167 	/*  Num of rx packets where toe finds out if checksum is good or bad */
6168 	uint32 rx_iph_good;
6169 	uint32 rx_iph_bad;
6170 	uint32 rx_tcp_good;
6171 	uint32 rx_tcp_bad;
6172 	uint32 rx_udp_good;
6173 	uint32 rx_udp_bad;
6174 	uint32 rx_icmp_good;
6175 	uint32 rx_icmp_bad;
6176 
6177 	/* Num of tx packets in which csum error is injected */
6178 	uint32 tx_tcp_errinj;
6179 	uint32 tx_udp_errinj;
6180 	uint32 tx_icmp_errinj;
6181 
6182 	/* Num of rx packets in which csum error is injected */
6183 	uint32 rx_tcp_errinj;
6184 	uint32 rx_udp_errinj;
6185 	uint32 rx_icmp_errinj;
6186 };
6187 
6188 /** Arp offload statistic counts */
6189 struct arp_ol_stats_t {
6190 	uint32  host_ip_entries; /**< Host IP table addresses (more than one if multihomed) */
6191 	uint32  host_ip_overflow;	/**< Host IP table additions skipped due to overflow */
6192 
6193 	uint32  arp_table_entries;	/**< ARP table entries */
6194 	uint32  arp_table_overflow;	/**< ARP table additions skipped due to overflow */
6195 
6196 	uint32  host_request;		/**< ARP requests from host */
6197 	uint32  host_reply;		/**< ARP replies from host */
6198 	uint32  host_service;		/**< ARP requests from host serviced by ARP Agent */
6199 
6200 	uint32  peer_request;		/**< ARP requests received from network */
6201 	uint32  peer_request_drop;	/**< ARP requests from network that were dropped */
6202 	uint32  peer_reply;		/**< ARP replies received from network */
6203 	uint32  peer_reply_drop;	/**< ARP replies from network that were dropped */
6204 	uint32  peer_service;		/**< ARP request from host serviced by ARP Agent */
6205 };
6206 
6207 /** NS offload statistic counts */
6208 struct nd_ol_stats_t {
6209 	uint32  host_ip_entries;    /**< Host IP table addresses (more than one if multihomed) */
6210 	uint32  host_ip_overflow;   /**< Host IP table additions skipped due to overflow */
6211 	uint32  peer_request;       /**< NS requests received from network */
6212 	uint32  peer_request_drop;  /**< NS requests from network that were dropped */
6213 	uint32  peer_reply_drop;    /**< NA replies from network that were dropped */
6214 	uint32  peer_service;       /**< NS request from host serviced by firmware */
6215 };
6216 
6217 /*
6218  * Neighbor Discovery Offloading
6219  */
6220 enum {
6221 	WL_ND_IPV6_ADDR_TYPE_UNICAST = 0,
6222 	WL_ND_IPV6_ADDR_TYPE_ANYCAST
6223 };
6224 
6225 typedef struct wl_nd_host_ip_addr {
6226 	struct ipv6_addr ip_addr;	/* host ip address */
6227 	uint8 type;			/* type of address */
6228 	uint8 pad[3];
6229 } wl_nd_host_ip_addr_t;
6230 
6231 typedef struct wl_nd_host_ip_list {
6232 	uint32 count;
6233 	wl_nd_host_ip_addr_t host_ip[1];
6234 } wl_nd_host_ip_list_t;
6235 
6236 #define WL_ND_HOSTIP_IOV_VER    1
6237 
6238 enum {
6239 	WL_ND_HOSTIP_OP_VER = 0,	/* get version */
6240 	WL_ND_HOSTIP_OP_ADD,		/* add address */
6241 	WL_ND_HOSTIP_OP_DEL,		/* delete specified address */
6242 	WL_ND_HOSTIP_OP_DEL_UC,		/* delete all unicast address */
6243 	WL_ND_HOSTIP_OP_DEL_AC,		/* delete all anycast address */
6244 	WL_ND_HOSTIP_OP_DEL_ALL,	/* delete all addresses */
6245 	WL_ND_HOSTIP_OP_LIST,		/* get list of host ip address */
6246 	WL_ND_HOSTIP_OP_MAX
6247 };
6248 
6249 typedef struct wl_nd_hostip {
6250 	uint16 version;				/* version of iovar buf */
6251 	uint16 op_type;				/* operation type */
6252 	uint32 length;				/* length of entire structure */
6253 	union {
6254 		wl_nd_host_ip_addr_t host_ip;	/* set param for add */
6255 		uint16 version;			/* get return for ver */
6256 	} u;
6257 } wl_nd_hostip_t;
6258 
6259 #define WL_ND_HOSTIP_FIXED_LEN		OFFSETOF(wl_nd_hostip_t, u)
6260 #define WL_ND_HOSTIP_WITH_ADDR_LEN	(WL_ND_HOSTIP_FIXED_LEN + sizeof(wl_nd_host_ip_addr_t))
6261 
6262 /*
6263  * Keep-alive packet offloading.
6264  */
6265 
6266 /**
6267  * NAT keep-alive packets format: specifies the re-transmission period, the packet
6268  * length, and packet contents.
6269  */
6270 typedef struct wl_keep_alive_pkt {
6271 	uint32	period_msec;	/** Retransmission period (0 to disable packet re-transmits) */
6272 	uint16	len_bytes;	/* Size of packet to transmit (0 to disable packet re-transmits) */
6273 	uint8	data[1];	/** Variable length packet to transmit.  Contents should include
6274 				 * entire ethernet packet (enet header, IP header, UDP header,
6275 				 * and UDP payload) in network byte order.
6276 				 */
6277 } wl_keep_alive_pkt_t;
6278 
6279 #define WL_KEEP_ALIVE_FIXED_LEN		OFFSETOF(wl_keep_alive_pkt_t, data)
6280 
6281 #define MAX_RSSI_COUNT			8
6282 typedef struct rssi_struct {
6283 	int8	val[MAX_RSSI_COUNT];	/**< rssi values in AFs */
6284 	int16	sum;			/**< total rssi sum */
6285 	uint8	cnt;			/**< number rssi samples */
6286 	uint8	idx;			/**< next rssi location */
6287 } rssi_struct_t;
6288 
6289 #ifdef WLDFSP
6290 #define DFSP_EVT_OFFSET			OFFSETOF(dfsp_event_data_t, ie)
6291 #define DFSP_EVT_FLAGS_AP_ASSOC		(1 << 0)
6292 #define DFSP_EVT_FLAGS_AP_BCNMON	(1 << 1)
6293 #define DFSP_EVT_FLAGS_PROXY_BCSA	(1 << 2)
6294 #define DFSP_EVT_FLAGS_PROXY_UCSA	(1 << 3)
6295 #define DFSP_EVT_FLAGS_PROXY_PCSA	(1 << 4)
6296 
6297 typedef struct dfsp_event_data {
6298 	uint16 flags;	/* indicate what triggers the event */
6299 	uint16 ie_len;
6300 	uint8 ie[];    /* variable length */
6301 } dfsp_event_data_t;
6302 
6303 /* Proxy Channel Switch Announcement is a collection of IEs */
6304 typedef struct dfsp_pcsa {
6305 	dot11_ext_csa_ie_t		ecsa;
6306 	dot11_mesh_csp_ie_t		mcsp;
6307 	dot11_wide_bw_chan_switch_ie_t	wbcs;
6308 } dfsp_pcsa_t;
6309 
6310 /* DFS Proxy */
6311 #define DFSP_CFG_VERSION	1
6312 #define DFSP_FLAGS_ENAB		0x1
6313 typedef struct dfsp_cfg {
6314 	uint16 version;
6315 	uint16 len;
6316 	uint16 flags;			/**< bit 1 to enable/disable the feature */
6317 	uint16 max_bcn_miss_dur;        /**< maximum beacon miss duration before ceasing data tx */
6318 	uint8 mcsp_ttl;                 /**< remaining number of hops allowed for pcsa message */
6319 	uint8 bcsa_cnt;                 /**< repeat numbers of broadcast CSA */
6320 	chanspec_t mon_chan;            /**< passive monitoring channel spec */
6321 	struct ether_addr mon_bssid;    /**< broadcast means monitoring all */
6322 	uint16 max_bcn_miss_dur_af;	/**< maximum beacon miss duration before ceasing AF tx */
6323 } dfsp_cfg_t;
6324 
6325 #define DFSP_UCSA_VERSION	1
6326 typedef struct dfsp_ucsa {
6327 	uint16 version;
6328 	uint16 len;
6329 	struct ether_addr address;
6330 	uint8 enable;
6331 	uint8 retry_cnt;		/**< just in case host needs to control the value */
6332 } dfsp_ucsa_t;
6333 
6334 typedef struct dfsp_ucsa_tbl {
6335 	uint8 tbl_num;
6336 	uint8 tbl[];
6337 } dfsp_ucsa_tbl_t;
6338 
6339 typedef struct dfsp_stats {
6340 	uint32  dfsp_csainfra;
6341 	uint32  dfsp_csabcnmon;
6342 	uint32  dfsp_bcsarx;
6343 	uint32  dfsp_ucsarx;
6344 	uint32  dfsp_pcsarx;
6345 	uint32  dfsp_bcsatx;
6346 	uint32  dfsp_ucsatx;
6347 	uint32  dfsp_pcsatx;
6348 	uint32  dfsp_ucsatxfail;
6349 	uint32  dfsp_evtnotif;
6350 	uint32  dfsp_evtsuspect;
6351 	uint32  dfsp_evtresume;
6352 } dfsp_stats_t;
6353 #endif /* WLDFSP */
6354 
6355 /*
6356  * ptk_start: iovar to start 4-way handshake for secured ranging
6357 */
6358 
6359 /* ptk negotiation security type - determines negotiation parameters */
6360 typedef enum {
6361 	WL_PTK_START_SEC_TYPE_PMK = 1
6362 } wl_ptk_start_sec_type_t;
6363 
6364 /* ptk negotiation role */
6365 typedef enum {
6366 	ROLE_NONE	= 0x0,
6367 	ROLE_AUTH	= 0x1,
6368 	ROLE_SUP	= 0x2,
6369 	ROLE_STATIC	= 0x3,
6370 	ROLE_INVALID	= 0xff,
6371 	WL_PTK_START_ROLE_NONE = ROLE_NONE,
6372 	WL_PTK_START_ROLE_AUTH = ROLE_AUTH,
6373 	WL_PTK_START_ROLE_SUP = ROLE_SUP,
6374 	WL_PTK_START_ROLE_STATIC = ROLE_STATIC,
6375 	WL_PTK_START_ROLE_INVALID = ROLE_INVALID
6376 } wl_ptk_start_role_t;
6377 
6378 typedef struct wl_ptk_start_tlv {
6379 	uint16 id;
6380 	uint16 len;
6381 	uint8 data[1];
6382 } wl_ptk_start_tlv_t;
6383 
6384 typedef enum {
6385 	WL_PTK_START_TLV_PMK	= 1	/* uint8[] */
6386 } wl_ptk_start_tlv_type;
6387 
6388 typedef enum {
6389 	WL_PTK_START_FLAG_NO_DATA_PROT	= 1,	/* data frame protection disabled */
6390 	WL_PTK_START_FLAG_GEN_FTM_TPK	= 2	/* Generate FTM Toast/Seq Protection Key */
6391 } wl_ptk_start_flags_t;
6392 
6393 typedef struct wl_ptk_start_iov {
6394 	uint16 version;
6395 	uint16 len;				/* length of entire iov from version */
6396 	wl_ptk_start_flags_t flags;
6397 	wl_ptk_start_sec_type_t sec_type;
6398 	wl_ptk_start_role_t role;
6399 	struct ether_addr peer_addr;
6400 	uint16 pad;				/* reserved/32 bit alignment */
6401 	wl_ptk_start_tlv_t tlvs[1];
6402 } wl_ptk_start_iov_t;
6403 
6404 /*
6405  * Dongle pattern matching filter.
6406  */
6407 
6408 #define MAX_WAKE_PACKET_CACHE_BYTES 128 /**< Maximum cached wake packet */
6409 
6410 #define MAX_WAKE_PACKET_BYTES	    (DOT11_A3_HDR_LEN +			    \
6411 				     DOT11_QOS_LEN +			    \
6412 				     sizeof(struct dot11_llc_snap_header) + \
6413 				     ETHER_MAX_DATA)
6414 
6415 typedef struct pm_wake_packet {
6416 	uint32	status;		/**< Is the wake reason a packet (if all the other field's valid) */
6417 	uint32	pattern_id;	/**< Pattern ID that matched */
6418 	uint32	original_packet_size;
6419 	uint32	saved_packet_size;
6420 	uint8	packet[MAX_WAKE_PACKET_CACHE_BYTES];
6421 } pm_wake_packet_t;
6422 
6423 /* Packet filter types. Currently, only pattern matching is supported. */
6424 typedef enum wl_pkt_filter_type {
6425 	WL_PKT_FILTER_TYPE_PATTERN_MATCH=0,       /**< Pattern matching filter */
6426 	WL_PKT_FILTER_TYPE_MAGIC_PATTERN_MATCH=1, /**< Magic packet match */
6427 	WL_PKT_FILTER_TYPE_PATTERN_LIST_MATCH=2,  /**< A pattern list (match all to match filter) */
6428 	WL_PKT_FILTER_TYPE_ENCRYPTED_PATTERN_MATCH=3, /**< SECURE WOWL magic / net pattern match */
6429 	WL_PKT_FILTER_TYPE_APF_MATCH=4, /* Android packet filter match */
6430 	WL_PKT_FILTER_TYPE_PATTERN_MATCH_TIMEOUT=5, /* Pattern matching filter with timeout event */
6431 	WL_PKT_FILTER_TYPE_IMMEDIATE_PATTERN_MATCH=6, /* Immediately pattern matching filter */
6432 	WL_PKT_FILTYER_TYPE_MAX = 7,	/* Pkt filter type MAX */
6433 } wl_pkt_filter_type_t;
6434 
6435 #define WL_PKT_FILTER_TYPE wl_pkt_filter_type_t
6436 
6437 /* String mapping for types that may be used by applications or debug */
6438 #define WL_PKT_FILTER_TYPE_NAMES \
6439 	{ "PATTERN", WL_PKT_FILTER_TYPE_PATTERN_MATCH },	\
6440 	{ "MAGIC",   WL_PKT_FILTER_TYPE_MAGIC_PATTERN_MATCH },	\
6441 	{ "PATLIST", WL_PKT_FILTER_TYPE_PATTERN_LIST_MATCH },	\
6442 	{ "SECURE WOWL", WL_PKT_FILTER_TYPE_ENCRYPTED_PATTERN_MATCH },	\
6443 	{ "APF", WL_PKT_FILTER_TYPE_APF_MATCH }, \
6444 	{ "PATTERN TIMEOUT", WL_PKT_FILTER_TYPE_PATTERN_MATCH_TIMEOUT }, \
6445 	{ "IMMEDIATE", WL_PKT_FILTER_TYPE_IMMEDIATE_PATTERN_MATCH }
6446 
6447 /** Secured WOWL packet was encrypted, need decrypted before check filter match */
6448 typedef struct wl_pkt_decrypter {
6449 	uint8* (*dec_cb)(void* dec_ctx, const void *sdu, int sending);
6450 	void*  dec_ctx;
6451 } wl_pkt_decrypter_t;
6452 
6453 /**
6454  * Pattern matching filter. Specifies an offset within received packets to
6455  * start matching, the pattern to match, the size of the pattern, and a bitmask
6456  * that indicates which bits within the pattern should be matched.
6457  */
6458 typedef struct wl_pkt_filter_pattern {
6459 	uint32	offset;		/**< Offset within received packet to start pattern matching.
6460 				 * Offset '0' is the first byte of the ethernet header.
6461 				 */
6462 	uint32	size_bytes;	/**< Size of the pattern.  Bitmask must be the same size. */
6463 	uint8   mask_and_pattern[]; /**< Variable length mask and pattern data.  mask starts
6464 				      * at offset 0.  Pattern immediately follows mask. for
6465 				      * secured pattern, put the descrypter pointer to the
6466 				      * beginning, mask and pattern postponed correspondingly
6467 				      */
6468 } wl_pkt_filter_pattern_t;
6469 
6470 /** A pattern list is a numerically specified list of modified pattern structures. */
6471 typedef struct wl_pkt_filter_pattern_listel {
6472 	uint16 rel_offs;	/**< Offset to begin match (relative to 'base' below) */
6473 	uint16 base_offs;	/**< Base for offset (defined below) */
6474 	uint16 size_bytes;	/**< Size of mask/pattern */
6475 	uint16 match_flags;	/**< Addition flags controlling the match */
6476 	uint8  mask_and_data[]; /**< Variable length mask followed by data, each size_bytes */
6477 } wl_pkt_filter_pattern_listel_t;
6478 
6479 typedef struct wl_pkt_filter_pattern_list {
6480 	uint8 list_cnt;		/**< Number of elements in the list */
6481 	uint8 PAD1[1];		/**< Reserved (possible version: reserved) */
6482 	uint16 totsize;		/**< Total size of this pattern list (includes this struct) */
6483 	uint8 patterns[]; /**< Variable number of wl_pkt_filter_pattern_listel_t elements */
6484 } wl_pkt_filter_pattern_list_t;
6485 
6486 typedef struct wl_apf_program {
6487 	uint16 version;
6488 	uint16 instr_len;	/* number of instruction blocks */
6489 	uint32 inst_ts;		/* program installation timestamp */
6490 	uint8 instrs[];	/* variable length instructions */
6491 } wl_apf_program_t;
6492 
6493 typedef struct wl_pkt_filter_pattern_timeout {
6494 	uint32	offset;	/* Offset within received packet to start pattern matching.
6495 					 * Offset '0' is the first byte of the ethernet header.
6496 					 */
6497 	uint32	size_bytes;	/* Size of the pattern. Bitmask must be the same size. */
6498 	uint32	timeout;	/* Timeout(seconds) */
6499 	uint8	mask_and_pattern[]; /* Variable length mask and pattern data.
6500 								 * mask starts at offset 0. Pattern
6501 								 * immediately follows mask.
6502 								*/
6503 } wl_pkt_filter_pattern_timeout_t;
6504 
6505 /** IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
6506 typedef struct wl_pkt_filter {
6507 	uint32	id;		/**< Unique filter id, specified by app. */
6508 	uint32	type;		/**< Filter type (WL_PKT_FILTER_TYPE_xxx). */
6509 	uint32	negate_match;	/**< Negate the result of filter matches */
6510 	union {			/* Filter definitions */
6511 		wl_pkt_filter_pattern_t pattern;	/**< Pattern matching filter */
6512 		wl_pkt_filter_pattern_list_t patlist; /**< List of patterns to match */
6513 		wl_apf_program_t apf_program; /* apf program */
6514 		wl_pkt_filter_pattern_timeout_t pattern_timeout; /* Pattern timeout event filter */
6515 	} u;
6516 } wl_pkt_filter_t;
6517 
6518 /** IOVAR "tcp_keep_set" parameter. Used to install tcp keep_alive stuff. */
6519 typedef struct wl_tcp_keep_set {
6520 	uint32	val1;
6521 	uint32	val2;
6522 } wl_tcp_keep_set_t;
6523 
6524 #define WL_PKT_FILTER_FIXED_LEN		  OFFSETOF(wl_pkt_filter_t, u)
6525 #define WL_PKT_FILTER_PATTERN_FIXED_LEN	  OFFSETOF(wl_pkt_filter_pattern_t, mask_and_pattern)
6526 #define WL_PKT_FILTER_PATTERN_LIST_FIXED_LEN OFFSETOF(wl_pkt_filter_pattern_list_t, patterns)
6527 #define WL_PKT_FILTER_PATTERN_LISTEL_FIXED_LEN	\
6528 			OFFSETOF(wl_pkt_filter_pattern_listel_t, mask_and_data)
6529 #define WL_PKT_FILTER_PATTERN_TIMEOUT_FIXED_LEN	\
6530 			OFFSETOF(wl_pkt_filter_pattern_timeout_t, mask_and_pattern)
6531 
6532 #define WL_APF_INTERNAL_VERSION	1
6533 #define WL_APF_PROGRAM_MAX_SIZE (2 * 1024)
6534 #define WL_APF_PROGRAM_FIXED_LEN	OFFSETOF(wl_apf_program_t, instrs)
6535 #define WL_APF_PROGRAM_LEN(apf_program)	\
6536 	((apf_program)->instr_len * sizeof((apf_program)->instrs[0]))
6537 #define WL_APF_PROGRAM_TOTAL_LEN(apf_program)	\
6538 	(WL_APF_PROGRAM_FIXED_LEN + WL_APF_PROGRAM_LEN(apf_program))
6539 
6540 /** IOVAR "pkt_filter_enable" parameter. */
6541 typedef struct wl_pkt_filter_enable {
6542 	uint32	id;		/**< Unique filter id */
6543 	uint32	enable;		/**< Enable/disable bool */
6544 } wl_pkt_filter_enable_t;
6545 
6546 /** IOVAR "pkt_filter_list" parameter. Used to retrieve a list of installed filters. */
6547 typedef struct wl_pkt_filter_list {
6548 	uint32	num;		/**< Number of installed packet filters */
6549 	uint8	filter[];	/**< Variable array of packet filters. */
6550 } wl_pkt_filter_list_t;
6551 
6552 #define WL_PKT_FILTER_LIST_FIXED_LEN	  OFFSETOF(wl_pkt_filter_list_t, filter)
6553 
6554 /** IOVAR "pkt_filter_stats" parameter. Used to retrieve debug statistics. */
6555 typedef struct wl_pkt_filter_stats {
6556 	uint32	num_pkts_matched;	/**< # filter matches for specified filter id */
6557 	uint32	num_pkts_forwarded;	/**< # packets fwded from dongle to host for all filters */
6558 	uint32	num_pkts_discarded;	/**< # packets discarded by dongle for all filters */
6559 } wl_pkt_filter_stats_t;
6560 
6561 /** IOVAR "pkt_filter_ports" parameter.  Configure TCP/UDP port filters. */
6562 typedef struct wl_pkt_filter_ports {
6563 	uint8 version;		/**< Be proper */
6564 	uint8 reserved;		/**< Be really proper */
6565 	uint16 count;		/**< Number of ports following */
6566 	/* End of fixed data */
6567 	uint16 ports[1];	/**< Placeholder for ports[<count>] */
6568 } wl_pkt_filter_ports_t;
6569 
6570 #define WL_PKT_FILTER_PORTS_FIXED_LEN	OFFSETOF(wl_pkt_filter_ports_t, ports)
6571 
6572 #define WL_PKT_FILTER_PORTS_VERSION	0
6573 #if defined(WL_PKT_FLTR_EXT) && !defined(WL_PKT_FLTR_EXT_DISABLED)
6574 #define WL_PKT_FILTER_PORTS_MAX	256
6575 #else
6576 #define WL_PKT_FILTER_PORTS_MAX	128
6577 #endif /* WL_PKT_FLTR_EXT && !WL_PKT_FLTR_EXT_DISABLED */
6578 
6579 #define RSN_REPLAY_LEN 8
6580 typedef struct _gtkrefresh {
6581 	uint8	KCK[RSN_KCK_LENGTH];
6582 	uint8	KEK[RSN_KEK_LENGTH];
6583 	uint8	ReplayCounter[RSN_REPLAY_LEN];
6584 } gtk_keyinfo_t, *pgtk_keyinfo_t;
6585 
6586 /** Sequential Commands ioctl */
6587 typedef struct wl_seq_cmd_ioctl {
6588 	uint32 cmd;		/**< common ioctl definition */
6589 	uint32 len;		/**< length of user buffer */
6590 } wl_seq_cmd_ioctl_t;
6591 
6592 #define WL_SEQ_CMD_ALIGN_BYTES	4
6593 
6594 /**
6595  * These are the set of get IOCTLs that should be allowed when using
6596  * IOCTL sequence commands. These are issued implicitly by wl.exe each time
6597  * it is invoked. We never want to buffer these, or else wl.exe will stop working.
6598  */
6599 #define WL_SEQ_CMDS_GET_IOCTL_FILTER(cmd) \
6600 	(((cmd) == WLC_GET_MAGIC)		|| \
6601 	 ((cmd) == WLC_GET_VERSION)		|| \
6602 	 ((cmd) == WLC_GET_AP)			|| \
6603 	 ((cmd) == WLC_GET_INSTANCE))
6604 
6605 #define MAX_PKTENG_SWEEP_STEPS 40
6606 typedef struct wl_pkteng {
6607 	uint32 flags;
6608 	uint32 delay;			/**< Inter-packet delay */
6609 	uint32 nframes;			/**< Number of frames */
6610 	uint32 length;			/**< Packet length */
6611 	uint8  seqno;			/**< Enable/disable sequence no. */
6612 	struct ether_addr dest;		/**< Destination address */
6613 	struct ether_addr src;		/**< Source address */
6614 	uint8  sweep_steps;		/**< Number of sweep power */
6615 	uint8  PAD[2];
6616 } wl_pkteng_t;
6617 
6618 /* IOVAR pkteng_sweep_counters response structure */
6619 #define WL_PKTENG_SWEEP_COUNTERS_VERSION    1
6620 typedef struct wl_pkteng_sweep_ctrs {
6621 	uint16 version;			/**< Version - 1 */
6622 	uint16 size;			/**< Complete Size including sweep_counters */
6623 	uint16 sweep_steps;		/**< Number of steps */
6624 	uint16 PAD;
6625 	uint16 sweep_counter[];		/**< Array of frame counters */
6626 } wl_pkteng_sweep_ctrs_t;
6627 
6628 /* IOVAR pkteng_rx_pkt response structure */
6629 #define WL_PKTENG_RX_PKT_VERSION    1
6630 typedef struct wl_pkteng_rx_pkt {
6631 	uint16 version;		/**< Version - 1 */
6632 	uint16 size;		/**< Complete Size including the packet */
6633 	uint8 payload[];	/**< Packet payload */
6634 } wl_pkteng_rx_pkt_t;
6635 
6636 #define WL_PKTENG_RU_FILL_VER_1		1u
6637 // struct for ru packet engine
6638 typedef struct wl_pkteng_ru_v1 {
6639 	uint16 version;			/* ver is 1 */
6640 	uint16 length;			/* size of complete structure */
6641 	uint8 bw;			/* bandwidth info */
6642 	uint8 ru_alloc_val;		/* ru allocation index number */
6643 	uint8 mcs_val;			/* mcs allocated value */
6644 	uint8 nss_val;			/* num of spatial streams */
6645 	uint32 num_bytes;		/* approx num of bytes to calculate other required params */
6646 	uint8 cp_ltf_val;		/* GI and LTF symbol size */
6647 	uint8 he_ltf_symb;		/* num of HE-LTF symbols */
6648 	uint8 stbc;			/* STBC support */
6649 	uint8 coding_val;		/* BCC/LDPC coding support */
6650 	uint8 pe_category;		/* PE duration 0/8/16usecs  */
6651 	uint8 dcm;			/* dual carrier modulation */
6652 	uint8 mumimo_ltfmode;		/* ltf mode */
6653 	uint8 trig_tx;			/* form and transmit the trigger frame */
6654 	uint8 trig_type;		/* type of trigger frame */
6655 	uint8 trig_period;		/* trigger tx periodicity TBD */
6656 	uint8 nuserinfo;		/* number of Userinfo fields */
6657 	struct ether_addr dest;		/* destination address for un-associated mode */
6658 	uint8 ppdu_format;		/* trigger frame format */
6659 } wl_pkteng_ru_v1_t;
6660 
6661 #ifndef WL_PKTENG_RU_VER
6662 /* This is for the App; source picks it up from wlc_types.h */
6663 typedef wl_pkteng_ru_v1_t wl_pkteng_ru_fill_t;
6664 #endif // endif
6665 
6666 typedef struct wl_trig_frame_info {
6667 	/* Structure versioning and structure length params */
6668 	uint16 version;
6669 	uint16 length;
6670 	/* Below params are the fields related to trigger frame contents */
6671 	/* Common Info Params Figure 9-52d - 11ax Draft 1.1 */
6672 	uint16 lsig_len;
6673 	uint16 trigger_type;
6674 	uint16 cascade_indication;
6675 	uint16 cs_req;
6676 	uint16 bw;
6677 	uint16 cp_ltf_type;
6678 	uint16 mu_mimo_ltf_mode;
6679 	uint16 num_he_ltf_syms;
6680 	uint16 stbc;
6681 	uint16 ldpc_extra_symb;
6682 	uint16 ap_tx_pwr;
6683 	uint16 afactor;
6684 	uint16 pe_disambiguity;
6685 	uint16 spatial_resuse;
6686 	uint16 doppler;
6687 	uint16 he_siga_rsvd;
6688 	uint16 cmn_info_rsvd;
6689 	/* User Info Params Figure 9-52e - 11ax Draft 1.1 */
6690 	uint16 aid12;
6691 	uint16 ru_alloc;
6692 	uint16 coding_type;
6693 	uint16 mcs;
6694 	uint16 dcm;
6695 	uint16 ss_alloc;
6696 	uint16 tgt_rssi;
6697 	uint16 usr_info_rsvd;
6698 } wl_trig_frame_info_t;
6699 
6700 /* wl pkteng_stats related definitions */
6701 #define WL_PKTENG_STATS_V1 (1)
6702 #define WL_PKTENG_STATS_V2 (2)
6703 
6704 typedef struct wl_pkteng_stats_v1 {
6705 	uint32 lostfrmcnt;		/**< RX PER test: no of frames lost (skip seqno) */
6706 	int32 rssi;			/**< RSSI */
6707 	int32 snr;			/**< signal to noise ratio */
6708 	uint16 rxpktcnt[NUM_80211_RATES+1];
6709 	uint8 rssi_qdb;			/**< qdB portion of the computed rssi */
6710 	uint8  version;
6711 } wl_pkteng_stats_v1_t;
6712 
6713 typedef struct wl_pkteng_stats_v2 {
6714 	uint32 lostfrmcnt;		/**< RX PER test: no of frames lost (skip seqno) */
6715 	int32 rssi;			/**< RSSI */
6716 	int32 snr;			/**< signal to noise ratio */
6717 	uint16 rxpktcnt[NUM_80211_RATES+1];
6718 	uint8 rssi_qdb;			/**< qdB portion of the computed rssi */
6719 	uint8  version;
6720 	uint16 length;
6721 	uint16 pad;
6722 	int32 rssi_per_core[WL_RSSI_ANT_MAX];
6723 	int32 rssi_per_core_qdb[WL_RSSI_ANT_MAX];
6724 } wl_pkteng_stats_v2_t;
6725 
6726 #ifndef WL_PKTENG_STATS_TYPEDEF_HAS_ALIAS
6727 typedef wl_pkteng_stats_v1_t wl_pkteng_stats_t;
6728 #endif /* WL_PKTENG_STATS_TYPEDEF_HAS_ALIAS */
6729 
6730 typedef struct wl_txcal_params {
6731 	wl_pkteng_t pkteng;
6732 	uint8 gidx_start;
6733 	int8 gidx_step;
6734 	uint8 gidx_stop;
6735 	uint8  PAD;
6736 } wl_txcal_params_t;
6737 
6738 typedef struct wl_txcal_gainidx {
6739 	uint8 num_actv_cores;
6740 	uint8 gidx_start_percore[WL_STA_ANT_MAX];
6741 	uint8 gidx_stop_percore[WL_STA_ANT_MAX];
6742 	uint8 PAD[3];
6743 } wl_txcal_gainidx_t;
6744 
6745 typedef struct wl_txcal_params_v2 {
6746 	wl_pkteng_t pkteng;
6747 	int8 gidx_step;
6748 	uint8 pwr_start[WL_STA_ANT_MAX];
6749 	uint8 pwr_stop[WL_STA_ANT_MAX];
6750 	uint8 init_start_idx;
6751 	uint8 gidx_start_percore[WL_STA_ANT_MAX];
6752 	uint8 gidx_stop_percore[WL_STA_ANT_MAX];
6753 	uint16 version;
6754 } wl_txcal_params_v2_t;
6755 
6756 typedef wl_txcal_params_t wl_txcal_params_v1_t;
6757 
6758 typedef struct wl_rssilog_params {
6759 	uint8 enable;
6760 	uint8 rssi_threshold;
6761 	uint8 time_threshold;
6762 	uint8 pad;
6763 } wl_rssilog_params_t;
6764 
6765 typedef struct wl_sslpnphy_papd_debug_data {
6766 	uint8 psat_pwr;
6767 	uint8 psat_indx;
6768 	uint8 final_idx;
6769 	uint8 start_idx;
6770 	int32 min_phase;
6771 	int32 voltage;
6772 	int8 temperature;
6773 	uint8  PAD[3];
6774 } wl_sslpnphy_papd_debug_data_t;
6775 typedef struct wl_sslpnphy_debug_data {
6776 	int16 papdcompRe [64];
6777 	int16 papdcompIm [64];
6778 } wl_sslpnphy_debug_data_t;
6779 typedef struct wl_sslpnphy_spbdump_data {
6780 	uint16 tbl_length;
6781 	int16 spbreal[256];
6782 	int16 spbimg[256];
6783 } wl_sslpnphy_spbdump_data_t;
6784 typedef struct wl_sslpnphy_percal_debug_data {
6785 	uint32 cur_idx;
6786 	uint32 tx_drift;
6787 	uint8 prev_cal_idx;
6788 	uint8  PAD[3];
6789 	uint32 percal_ctr;
6790 	int32 nxt_cal_idx;
6791 	uint32 force_1idxcal;
6792 	uint32 onedxacl_req;
6793 	int32 last_cal_volt;
6794 	int8 last_cal_temp;
6795 	uint8  PAD[3];
6796 	uint32 vbat_ripple;
6797 	uint32 exit_route;
6798 	int32 volt_winner;
6799 } wl_sslpnphy_percal_debug_data_t;
6800 
6801 typedef enum {
6802 	wowl_pattern_type_bitmap = 0,
6803 	wowl_pattern_type_arp,
6804 	wowl_pattern_type_na
6805 } wowl_pattern_type_t;
6806 
6807 typedef struct wl_wowl_pattern {
6808 	uint32		    masksize;		/**< Size of the mask in #of bytes */
6809 	uint32		    offset;		/**< Pattern byte offset in packet */
6810 	uint32		    patternoffset;	/**< Offset of start of pattern in the structure */
6811 	uint32		    patternsize;	/**< Size of the pattern itself in #of bytes */
6812 	uint32		    id;			/**< id */
6813 	uint32		    reasonsize;		/**< Size of the wakeup reason code */
6814 	wowl_pattern_type_t type;		/**< Type of pattern */
6815 	/* Mask follows the structure above */
6816 	/* Pattern follows the mask is at 'patternoffset' from the start */
6817 } wl_wowl_pattern_t;
6818 
6819 typedef struct wl_wowl_pattern_list {
6820 	uint32			count;
6821 	wl_wowl_pattern_t	pattern[1];
6822 } wl_wowl_pattern_list_t;
6823 
6824 typedef struct wl_wowl_wakeind {
6825 	uint8	pci_wakeind;	/**< Whether PCI PMECSR PMEStatus bit was set */
6826 	uint32	ucode_wakeind;	/**< What wakeup-event indication was set by ucode */
6827 } wl_wowl_wakeind_t;
6828 
6829 /** per AC rate control related data structure */
6830 typedef struct wl_txrate_class {
6831 	uint8		init_rate;
6832 	uint8		min_rate;
6833 	uint8		max_rate;
6834 } wl_txrate_class_t;
6835 
6836 /** structure for Overlap BSS scan arguments */
6837 typedef struct wl_obss_scan_arg {
6838 	int16	passive_dwell;
6839 	int16	active_dwell;
6840 	int16	bss_widthscan_interval;
6841 	int16	passive_total;
6842 	int16	active_total;
6843 	int16	chanwidth_transition_delay;
6844 	int16	activity_threshold;
6845 } wl_obss_scan_arg_t;
6846 
6847 #define WL_OBSS_SCAN_PARAM_LEN	sizeof(wl_obss_scan_arg_t)
6848 
6849 /** RSSI event notification configuration. */
6850 typedef struct wl_rssi_event {
6851 	uint32 rate_limit_msec;		/**< # of events posted to application will be limited to
6852 					 * one per specified period (0 to disable rate limit).
6853 					 */
6854 	uint8 num_rssi_levels;		/**< Number of entries in rssi_levels[] below */
6855 	int8 rssi_levels[MAX_RSSI_LEVELS];	/**< Variable number of RSSI levels. An event
6856 						 * will be posted each time the RSSI of received
6857 						 * beacons/packets crosses a level.
6858 						 */
6859 	int8 pad[3];
6860 } wl_rssi_event_t;
6861 
6862 #define RSSI_MONITOR_VERSION    1
6863 #define RSSI_MONITOR_STOP       (1 << 0)
6864 typedef struct wl_rssi_monitor_cfg {
6865 	uint8 version;
6866 	uint8 flags;
6867 	int8 max_rssi;
6868 	int8 min_rssi;
6869 } wl_rssi_monitor_cfg_t;
6870 
6871 typedef struct wl_rssi_monitor_evt {
6872 	uint8 version;
6873 	int8 cur_rssi;
6874 	uint16 pad;
6875 } wl_rssi_monitor_evt_t;
6876 
6877 /* CCA based channel quality event configuration (ID values for both config and report) */
6878 #define WL_CHAN_QUAL_CCA	0
6879 #define WL_CHAN_QUAL_NF		1
6880 #define WL_CHAN_QUAL_NF_LTE	2
6881 #define WL_CHAN_QUAL_TOTAL	3	/* The total IDs supported in both config and report */
6882 /* Additional channel quality event support in report only (>= 0x100)
6883  * Notice that uint8 is used in configuration struct wl_chan_qual_metric_t, but uint16 is
6884  * used for report in struct cca_chan_qual_event_t. So the ID values beyond 8-bit are used
6885  * for reporting purpose only.
6886  */
6887 #define WL_CHAN_QUAL_FULL_CCA	(0x100 | WL_CHAN_QUAL_CCA)
6888 #define WL_CHAN_QUAL_FULLPM_CCA (0x200u | WL_CHAN_QUAL_CCA)     /* CCA: me vs. notme, PM vs. !PM */
6889 
6890 #define MAX_CHAN_QUAL_LEVELS	8
6891 
6892 typedef struct wl_chan_qual_metric {
6893 	uint8 id;				/**< metric ID */
6894 	uint8 num_levels;               	/**< Number of entries in rssi_levels[] below */
6895 	uint16 flags;
6896 	int16 htol[MAX_CHAN_QUAL_LEVELS];	/**< threshold level array: hi-to-lo */
6897 	int16 ltoh[MAX_CHAN_QUAL_LEVELS];	/**< threshold level array: lo-to-hi */
6898 } wl_chan_qual_metric_t;
6899 
6900 typedef struct wl_chan_qual_event {
6901 	uint32 rate_limit_msec;		/**< # of events posted to application will be limited to
6902 					 * one per specified period (0 to disable rate limit).
6903 					 */
6904 	uint16 flags;
6905 	uint16 num_metrics;
6906 	wl_chan_qual_metric_t metric[WL_CHAN_QUAL_TOTAL];	/**< metric array */
6907 } wl_chan_qual_event_t;
6908 typedef struct wl_action_obss_coex_req {
6909 	uint8 info;
6910 	uint8 num;
6911 	uint8 ch_list[1];
6912 } wl_action_obss_coex_req_t;
6913 
6914 /** IOVar parameter block for small MAC address array with type indicator */
6915 #define WL_IOV_MAC_PARAM_LEN  4
6916 
6917 #define WL_IOV_PKTQ_LOG_PRECS 16
6918 
6919 #include <packed_section_start.h>
6920 typedef BWL_PRE_PACKED_STRUCT struct {
6921 	uint32 num_addrs;
6922 	uint8   addr_type[WL_IOV_MAC_PARAM_LEN];
6923 	struct ether_addr ea[WL_IOV_MAC_PARAM_LEN];
6924 } BWL_POST_PACKED_STRUCT wl_iov_mac_params_t;
6925 #include <packed_section_end.h>
6926 
6927 /** This is extra info that follows wl_iov_mac_params_t */
6928 typedef struct {
6929 	uint32 addr_info[WL_IOV_MAC_PARAM_LEN];
6930 } wl_iov_mac_extra_params_t;
6931 
6932 /** Combined structure */
6933 typedef struct {
6934 	wl_iov_mac_params_t params;
6935 	wl_iov_mac_extra_params_t extra_params;
6936 } wl_iov_mac_full_params_t;
6937 
6938 /** Parameter block for PKTQ_LOG statistics */
6939 #define PKTQ_LOG_COUNTERS_V4 \
6940 	/* packets requested to be stored */ \
6941 	uint32 requested; \
6942 	/* packets stored */ \
6943 	uint32 stored; \
6944 	/* packets saved, because a lowest priority queue has given away one packet */ \
6945 	uint32 saved; \
6946 	/* packets saved, because an older packet from the same queue has been dropped */ \
6947 	uint32 selfsaved; \
6948 	/* packets dropped, because pktq is full with higher precedence packets */ \
6949 	uint32 full_dropped; \
6950 	 /* packets dropped because pktq per that precedence is full */ \
6951 	uint32 dropped; \
6952 	/* packets dropped, in order to save one from a queue of a highest priority */ \
6953 	uint32 sacrificed; \
6954 	/* packets droped because of hardware/transmission error */ \
6955 	uint32 busy; \
6956 	/* packets re-sent because they were not received */ \
6957 	uint32 retry; \
6958 	/* packets retried again (ps pretend) prior to moving power save mode */ \
6959 	uint32 ps_retry; \
6960 	 /* suppressed packet count */ \
6961 	uint32 suppress; \
6962 	/* packets finally dropped after retry limit */ \
6963 	uint32 retry_drop; \
6964 	/* the high-water mark of the queue capacity for packets - goes to zero as queue fills */ \
6965 	uint32 max_avail; \
6966 	/* the high-water mark of the queue utilisation for packets - ('inverse' of max_avail) */ \
6967 	uint32 max_used; \
6968 	 /* the maximum capacity of the queue */ \
6969 	uint32 queue_capacity; \
6970 	/* count of rts attempts that failed to receive cts */ \
6971 	uint32 rtsfail; \
6972 	/* count of packets sent (acked) successfully */ \
6973 	uint32 acked; \
6974 	/* running total of phy rate of packets sent successfully */ \
6975 	uint32 txrate_succ; \
6976 	/* running total of phy 'main' rate */ \
6977 	uint32 txrate_main; \
6978 	/* actual data transferred successfully */ \
6979 	uint32 throughput; \
6980 	/* time difference since last pktq_stats */ \
6981 	uint32 time_delta;
6982 
6983 typedef struct {
6984 	PKTQ_LOG_COUNTERS_V4
6985 } pktq_log_counters_v04_t;
6986 
6987 /** v5 is the same as V4 with extra parameter */
6988 typedef struct {
6989 	PKTQ_LOG_COUNTERS_V4
6990 	/** cumulative time to transmit */
6991 	uint32 airtime;
6992 } pktq_log_counters_v05_t;
6993 
6994 typedef struct {
6995 	uint8                num_prec[WL_IOV_MAC_PARAM_LEN];
6996 	pktq_log_counters_v04_t  counters[WL_IOV_MAC_PARAM_LEN][WL_IOV_PKTQ_LOG_PRECS];
6997 	uint32               counter_info[WL_IOV_MAC_PARAM_LEN];
6998 	uint32               pspretend_time_delta[WL_IOV_MAC_PARAM_LEN];
6999 	char                 headings[];
7000 } pktq_log_format_v04_t;
7001 
7002 typedef struct {
7003 	uint8                num_prec[WL_IOV_MAC_PARAM_LEN];
7004 	pktq_log_counters_v05_t  counters[WL_IOV_MAC_PARAM_LEN][WL_IOV_PKTQ_LOG_PRECS];
7005 	uint32               counter_info[WL_IOV_MAC_PARAM_LEN];
7006 	uint32               pspretend_time_delta[WL_IOV_MAC_PARAM_LEN];
7007 	char                 headings[];
7008 } pktq_log_format_v05_t;
7009 
7010 typedef struct {
7011 	uint32               version;
7012 	wl_iov_mac_params_t  params;
7013 	union {
7014 		pktq_log_format_v04_t v04;
7015 		pktq_log_format_v05_t v05;
7016 	} pktq_log;
7017 } wl_iov_pktq_log_t;
7018 
7019 /* PKTQ_LOG_AUTO, PKTQ_LOG_DEF_PREC flags introduced in v05, they are ignored by v04 */
7020 #define PKTQ_LOG_AUTO     (1 << 31)
7021 #define PKTQ_LOG_DEF_PREC (1 << 30)
7022 
7023 typedef struct wl_pfn_macaddr_cfg_0 {
7024 	uint8 version;
7025 	uint8 reserved;
7026 	struct ether_addr macaddr;
7027 } wl_pfn_macaddr_cfg_0_t;
7028 #define LEGACY1_WL_PFN_MACADDR_CFG_VER 0
7029 #define WL_PFN_MAC_OUI_ONLY_MASK      1
7030 #define WL_PFN_SET_MAC_UNASSOC_MASK   2
7031 #define WL_PFN_RESTRICT_LA_MAC_MASK   4
7032 #define WL_PFN_MACADDR_FLAG_MASK     0x7
7033 /** To configure pfn_macaddr */
7034 typedef struct wl_pfn_macaddr_cfg {
7035 	uint8 version;
7036 	uint8 flags;
7037 	struct ether_addr macaddr;
7038 } wl_pfn_macaddr_cfg_t;
7039 #define WL_PFN_MACADDR_CFG_VER 1
7040 
7041 /*
7042  * SCB_BS_DATA iovar definitions start.
7043  */
7044 #define SCB_BS_DATA_STRUCT_VERSION	1
7045 
7046 /** The actual counters maintained for each station */
7047 typedef struct {
7048 	/* The following counters are a subset of what pktq_stats provides per precedence. */
7049 	uint32 retry;          /**< packets re-sent because they were not received */
7050 	uint32 retry_drop;     /**< packets finally dropped after retry limit */
7051 	uint32 rtsfail;        /**< count of rts attempts that failed to receive cts */
7052 	uint32 acked;          /**< count of packets sent (acked) successfully */
7053 	uint32 txrate_succ;    /**< running total of phy rate of packets sent successfully */
7054 	uint32 txrate_main;    /**< running total of phy 'main' rate */
7055 	uint32 throughput;     /**< actual data transferred successfully */
7056 	uint32 time_delta;     /**< time difference since last pktq_stats */
7057 	uint32 airtime;        /**< cumulative total medium access delay in useconds */
7058 } iov_bs_data_counters_t;
7059 
7060 /** The structure for individual station information. */
7061 #include <packed_section_start.h>
7062 typedef BWL_PRE_PACKED_STRUCT struct {
7063 	struct ether_addr	station_address;	/**< The station MAC address */
7064 	uint16			station_flags;		/**< Bit mask of flags, for future use. */
7065 	iov_bs_data_counters_t	station_counters;	/**< The actual counter values */
7066 } BWL_POST_PACKED_STRUCT iov_bs_data_record_t;
7067 #include <packed_section_end.h>
7068 
7069 #include <packed_section_start.h>
7070 typedef BWL_PRE_PACKED_STRUCT struct {
7071 	uint16	structure_version;	/**< Structure version number (for wl/wlu matching) */
7072 	uint16	structure_count;	/**< Number of iov_bs_data_record_t records following */
7073 	iov_bs_data_record_t	structure_record[1];	/**< 0 - structure_count records */
7074 } BWL_POST_PACKED_STRUCT iov_bs_data_struct_t;
7075 #include <packed_section_end.h>
7076 
7077 /* Bitmask of options that can be passed in to the iovar. */
7078 enum {
7079 	SCB_BS_DATA_FLAG_NO_RESET = (1<<0)	/**< Do not clear the counters after reading */
7080 };
7081 /*
7082  * SCB_BS_DATA iovar definitions end.
7083  */
7084 
7085 typedef struct wlc_extlog_cfg {
7086 	int32 max_number;
7087 	uint16 module;	/**< bitmap */
7088 	uint8 level;
7089 	uint8 flag;
7090 	uint16 version;
7091 	uint16 PAD;
7092 } wlc_extlog_cfg_t;
7093 
7094 typedef struct log_record {
7095 	uint32 time;
7096 	uint16 module;
7097 	uint16 id;
7098 	uint8 level;
7099 	uint8 sub_unit;
7100 	uint8 seq_num;
7101 	uint8 pad;
7102 	int32 arg;
7103 	char  str[MAX_ARGSTR_LEN];
7104 	char  PAD[4-MAX_ARGSTR_LEN%4];
7105 } log_record_t;
7106 
7107 typedef struct wlc_extlog_req {
7108 	uint32 from_last;
7109 	uint32 num;
7110 } wlc_extlog_req_t;
7111 
7112 typedef struct wlc_extlog_results {
7113 	uint16 version;
7114 	uint16 record_len;
7115 	uint32 num;
7116 	log_record_t logs[1];
7117 } wlc_extlog_results_t;
7118 
7119 typedef struct log_idstr {
7120 	uint16	id;
7121 	uint16	flag;
7122 	uint8	arg_type;
7123 	const char	*fmt_str;
7124 } log_idstr_t;
7125 
7126 #define FMTSTRF_USER		1
7127 
7128 /* flat ID definitions
7129  * New definitions HAVE TO BE ADDED at the end of the table. Otherwise, it will
7130  * affect backward compatibility with pre-existing apps
7131  */
7132 typedef enum {
7133 	FMTSTR_DRIVER_UP_ID = 0,
7134 	FMTSTR_DRIVER_DOWN_ID = 1,
7135 	FMTSTR_SUSPEND_MAC_FAIL_ID = 2,
7136 	FMTSTR_NO_PROGRESS_ID = 3,
7137 	FMTSTR_RFDISABLE_ID = 4,
7138 	FMTSTR_REG_PRINT_ID = 5,
7139 	FMTSTR_EXPTIME_ID = 6,
7140 	FMTSTR_JOIN_START_ID = 7,
7141 	FMTSTR_JOIN_COMPLETE_ID = 8,
7142 	FMTSTR_NO_NETWORKS_ID = 9,
7143 	FMTSTR_SECURITY_MISMATCH_ID = 10,
7144 	FMTSTR_RATE_MISMATCH_ID = 11,
7145 	FMTSTR_AP_PRUNED_ID = 12,
7146 	FMTSTR_KEY_INSERTED_ID = 13,
7147 	FMTSTR_DEAUTH_ID = 14,
7148 	FMTSTR_DISASSOC_ID = 15,
7149 	FMTSTR_LINK_UP_ID = 16,
7150 	FMTSTR_LINK_DOWN_ID = 17,
7151 	FMTSTR_RADIO_HW_OFF_ID = 18,
7152 	FMTSTR_RADIO_HW_ON_ID = 19,
7153 	FMTSTR_EVENT_DESC_ID = 20,
7154 	FMTSTR_PNP_SET_POWER_ID = 21,
7155 	FMTSTR_RADIO_SW_OFF_ID = 22,
7156 	FMTSTR_RADIO_SW_ON_ID = 23,
7157 	FMTSTR_PWD_MISMATCH_ID = 24,
7158 	FMTSTR_FATAL_ERROR_ID = 25,
7159 	FMTSTR_AUTH_FAIL_ID = 26,
7160 	FMTSTR_ASSOC_FAIL_ID = 27,
7161 	FMTSTR_IBSS_FAIL_ID = 28,
7162 	FMTSTR_EXTAP_FAIL_ID = 29,
7163 	FMTSTR_MAX_ID
7164 } log_fmtstr_id_t;
7165 
7166 /** 11k Neighbor Report element (unversioned, deprecated) */
7167 typedef struct nbr_element {
7168 	uint8 id;
7169 	uint8 len;
7170 	struct ether_addr bssid;
7171 	uint32 bssid_info;
7172 	uint8 reg;
7173 	uint8 channel;
7174 	uint8 phytype;
7175 	uint8 pad;
7176 } nbr_element_t;
7177 #define NBR_ADD_STATIC 0
7178 #define NBR_ADD_DYNAMIC 1
7179 
7180 #define WL_RRM_NBR_RPT_VER		1
7181 #define WL_NBR_RPT_FLAG_BSS_PREF_FROM_AP  0x01
7182 #define WL_RRM_DEFAULT_BSS_PREFERENCE 255
7183 #define WL_RRM_ADD_NBR_MIN_PARAMS	6
7184 /** 11k Neighbor Report element */
7185 typedef struct nbr_rpt_elem {
7186 	uint8 version;
7187 	uint8 id;
7188 	uint8 len;
7189 	uint8 pad;
7190 	struct ether_addr bssid;
7191 	uint8 pad_1[2];
7192 	uint32 bssid_info;
7193 	uint8 reg;
7194 	uint8 channel;
7195 	uint8 phytype;
7196 	uint8 addtype; /* static for manual add or dynamic if auto-learning of neighbors */
7197 	wlc_ssid_t ssid;
7198 	chanspec_t chanspec;
7199 	uint8 bss_trans_preference;
7200 	uint8 flags;
7201 } nbr_rpt_elem_t;
7202 
7203 typedef struct bcn_nbr_query {
7204 	uint16 list_cnt;
7205 	uint8 pad[2];
7206 	struct ether_addr sta_addr;
7207 } bcn_nbr_query_t;
7208 
7209 typedef enum event_msgs_ext_command {
7210 	EVENTMSGS_NONE		=	0,
7211 	EVENTMSGS_SET_BIT	=	1,
7212 	EVENTMSGS_RESET_BIT	=	2,
7213 	EVENTMSGS_SET_MASK	=	3
7214 } event_msgs_ext_command_t;
7215 
7216 #define EVENTMSGS_VER 1
7217 #define EVENTMSGS_EXT_STRUCT_SIZE	OFFSETOF(eventmsgs_ext_t, mask[0])
7218 
7219 /* len-	for SET it would be mask size from the application to the firmware */
7220 /*		for GET it would be actual firmware mask size */
7221 /* maxgetsize -	is only used for GET. indicate max mask size that the */
7222 /*				application can read from the firmware */
7223 typedef struct eventmsgs_ext
7224 {
7225 	uint8	ver;
7226 	uint8	command;
7227 	uint8	len;
7228 	uint8	maxgetsize;
7229 	uint8	mask[1];
7230 } eventmsgs_ext_t;
7231 
7232 #include <packed_section_start.h>
7233 typedef BWL_PRE_PACKED_STRUCT struct pcie_bus_tput_params {
7234 	/** no of host dma descriptors programmed by the firmware before a commit */
7235 	uint16		max_dma_descriptors;
7236 
7237 	uint16		host_buf_len; /**< length of host buffer */
7238 	dmaaddr_t	host_buf_addr; /**< physical address for bus_throughput_buf */
7239 } BWL_POST_PACKED_STRUCT pcie_bus_tput_params_t;
7240 #include <packed_section_end.h>
7241 
7242 typedef struct pcie_bus_tput_stats {
7243 	uint16		time_taken; /**< no of secs the test is run */
7244 	uint16		nbytes_per_descriptor; /**< no of bytes of data dma ed per descriptor */
7245 
7246 	/** no of desciptors for which dma is sucessfully completed within the test time */
7247 	uint32		count;
7248 } pcie_bus_tput_stats_t;
7249 
7250 #define HOST_WAKEUP_DATA_VER 1
7251 #include <packed_section_start.h>
7252 /* Bus interface host wakeup data */
7253 typedef BWL_PRE_PACKED_STRUCT struct wl_host_wakeup_data {
7254 	uint16 ver;
7255 	uint16 len;
7256 	uchar data[1];	/* wakeup data */
7257 } BWL_POST_PACKED_STRUCT wl_host_wakeup_data_t;
7258 #include <packed_section_end.h>
7259 
7260 #define HOST_WAKEUP_DATA_VER_2 2
7261 #include <packed_section_start.h>
7262 /* Bus interface host wakeup data */
7263 typedef BWL_PRE_PACKED_STRUCT struct wl_host_wakeup_data_v2 {
7264 	uint16 ver;
7265 	uint16 len;
7266 	uint32 gpio_toggle_time; /* gpio toggle time in ms */
7267 	uchar data[1];	/* wakeup data */
7268 } BWL_POST_PACKED_STRUCT wl_host_wakeup_data_v2_t;
7269 #include <packed_section_end.h>
7270 
7271 typedef struct keepalives_max_idle {
7272 	uint16  keepalive_count;        /**< nmbr of keepalives per bss_max_idle period */
7273 	uint8   mkeepalive_index;       /**< mkeepalive_index for keepalive frame to be used */
7274 	uint8   PAD;			/**< to align next field */
7275 	uint16  max_interval;           /**< seconds */
7276 } keepalives_max_idle_t;
7277 
7278 #define PM_IGNORE_BCMC_PROXY_ARP (1 << 0)
7279 #define PM_IGNORE_BCMC_ALL_DMS_ACCEPTED (1 << 1)
7280 
7281 /* ##### HMAP section ##### */
7282 #define PCIE_MAX_HMAP_WINDOWS 8
7283 #define PCIE_HMAPTEST_VERSION 2
7284 #define HMAPTEST_INVALID_OFFSET 0xFFFFFFFFu
7285 #define HMAPTEST_DEFAULT_WRITE_PATTERN 0xBABECAFEu
7286 #define HMAPTEST_ACCESS_ARM 0
7287 #define HMAPTEST_ACCESS_M2M 1
7288 #define HMAPTEST_ACCESS_D11 2
7289 #define HMAPTEST_ACCESS_NONE 3
7290 
7291 typedef struct pcie_hmaptest {
7292 	uint16	version;		/* Version */
7293 	uint16	length;		/* Length of entire structure */
7294 	uint32	xfer_len;
7295 	uint32	accesstype;
7296 	uint32	is_write;
7297 	uint32	is_invalid;
7298 	uint32	host_addr_hi;
7299 	uint32	host_addr_lo;
7300 	uint32	host_offset;
7301 	uint32  value; /* 4 byte value to be filled in case of write access test */
7302 	uint32	delay; /* wait time  in seconds before initiating access from dongle */
7303 } pcie_hmaptest_t;
7304 
7305 /* HMAP window register set */
7306 typedef struct hmapwindow {
7307 	uint32 baseaddr_lo; /* BaseAddrLower */
7308 	uint32 baseaddr_hi; /* BaseAddrUpper */
7309 	uint32 windowlength; /* Window Length */
7310 } hmapwindow_t;
7311 
7312 #define PCIE_HMAP_VERSION 1
7313 typedef struct pcie_hmap {
7314 	uint16	version;		/**< Version */
7315 	uint16	length;			/**< Length of entire structure */
7316 	uint32	enable;			/**< status of HMAP enabled/disabled */
7317 	uint32	nwindows;		/* no. of HMAP windows enabled */
7318 	uint32	window_config;		/* HMAP window_config register */
7319 	uint32	hmap_violationaddr_lo;	/* violating address lo */
7320 	uint32	hmap_violationaddr_hi;	/* violating addr hi */
7321 	uint32	hmap_violation_info;	/* violation info */
7322 	hmapwindow_t hwindows[];	/* Multiple hwindows */
7323 } pcie_hmap_t;
7324 
7325 /* ##### Power Stats section ##### */
7326 
7327 #define WL_PWRSTATS_VERSION	2
7328 
7329 /** Input structure for pwrstats IOVAR */
7330 typedef struct wl_pwrstats_query {
7331 	uint16 length;		/**< Number of entries in type array. */
7332 	uint16 type[1];		/**< Types (tags) to retrieve.
7333 				 * Length 0 (no types) means get all.
7334 				 */
7335 } wl_pwrstats_query_t;
7336 
7337 /** This structure is for version 2; version 1 will be deprecated in by FW */
7338 #include <packed_section_start.h>
7339 typedef BWL_PRE_PACKED_STRUCT struct wl_pwrstats {
7340 	uint16 version;		      /**< Version = 2 is TLV format */
7341 	uint16 length;		      /**< Length of entire structure */
7342 	uint8 data[1];		      /**< TLV data, a series of structures,
7343 				       * each starting with type and length.
7344 				       *
7345 				       * Padded as necessary so each section
7346 				       * starts on a 4-byte boundary.
7347 				       *
7348 				       * Both type and len are uint16, but the
7349 				       * upper nibble of length is reserved so
7350 				       * valid len values are 0-4095.
7351 				       */
7352 } BWL_POST_PACKED_STRUCT wl_pwrstats_t;
7353 #include <packed_section_end.h>
7354 #define WL_PWR_STATS_HDRLEN	OFFSETOF(wl_pwrstats_t, data)
7355 
7356 /* Bits for wake reasons */
7357 #define WLC_PMD_WAKE_SET		0x1
7358 #define WLC_PMD_PM_AWAKE_BCN		0x2
7359 /* BIT:3 is no longer being used */
7360 #define WLC_PMD_SCAN_IN_PROGRESS	0x8
7361 #define WLC_PMD_RM_IN_PROGRESS		0x10
7362 #define WLC_PMD_AS_IN_PROGRESS		0x20
7363 #define WLC_PMD_PM_PEND			0x40
7364 #define WLC_PMD_PS_POLL			0x80
7365 #define WLC_PMD_CHK_UNALIGN_TBTT	0x100
7366 #define WLC_PMD_APSD_STA_UP		0x200
7367 #define WLC_PMD_TX_PEND_WAR		0x400   /* obsolete, can be reused */
7368 #define WLC_PMD_GPTIMER_STAY_AWAKE	0x800
7369 #define WLC_PMD_PM2_RADIO_SOFF_PEND	0x2000
7370 #define WLC_PMD_NON_PRIM_STA_UP		0x4000
7371 #define WLC_PMD_AP_UP			0x8000
7372 
7373 typedef struct wlc_pm_debug {
7374 	uint32 timestamp;	     /**< timestamp in millisecond */
7375 	uint32 reason;		     /**< reason(s) for staying awake */
7376 } wlc_pm_debug_t;
7377 
7378 /** WL_PWRSTATS_TYPE_PM_AWAKE1 structures (for 6.25 firmware) */
7379 #define WLC_STA_AWAKE_STATES_MAX_V1	30
7380 #define WLC_PMD_EVENT_MAX_V1		32
7381 /** Data sent as part of pwrstats IOVAR (and EXCESS_PM_WAKE event) */
7382 #include <packed_section_start.h>
7383 typedef BWL_PRE_PACKED_STRUCT struct pm_awake_data_v1 {
7384 	uint32 curr_time;	/**< ms */
7385 	uint32 hw_macc;		/**< HW maccontrol */
7386 	uint32 sw_macc;		/**< SW maccontrol */
7387 	uint32 pm_dur;		/**< Total sleep time in PM, msecs */
7388 	uint32 mpc_dur;		/**< Total sleep time in MPC, msecs */
7389 
7390 	/* int32 drifts = remote - local; +ve drift => local-clk slow */
7391 	int32 last_drift;	/**< Most recent TSF drift from beacon */
7392 	int32 min_drift;	/**< Min TSF drift from beacon in magnitude */
7393 	int32 max_drift;	/**< Max TSF drift from beacon in magnitude */
7394 
7395 	uint32 avg_drift;	/**< Avg TSF drift from beacon */
7396 
7397 	/* Wake history tracking */
7398 	uint8  pmwake_idx;				   /**< for stepping through pm_state */
7399 	wlc_pm_debug_t pm_state[WLC_STA_AWAKE_STATES_MAX_V1]; /**< timestamped wake bits */
7400 	uint32 pmd_event_wake_dur[WLC_PMD_EVENT_MAX_V1];   /**< cumulative usecs per wake reason */
7401 	uint32 drift_cnt;	/**< Count of drift readings over which avg_drift was computed */
7402 } BWL_POST_PACKED_STRUCT pm_awake_data_v1_t;
7403 #include <packed_section_end.h>
7404 
7405 #include <packed_section_start.h>
7406 typedef BWL_PRE_PACKED_STRUCT struct wl_pwr_pm_awake_stats_v1 {
7407 	uint16 type;	     /**< WL_PWRSTATS_TYPE_PM_AWAKE */
7408 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
7409 
7410 	pm_awake_data_v1_t awake_data;
7411 	uint32 frts_time;	/**< Cumulative ms spent in frts since driver load */
7412 	uint32 frts_end_cnt;	/**< No of times frts ended since driver load */
7413 } BWL_POST_PACKED_STRUCT wl_pwr_pm_awake_stats_v1_t;
7414 #include <packed_section_end.h>
7415 
7416 /** WL_PWRSTATS_TYPE_PM_AWAKE2 structures. Data sent as part of pwrstats IOVAR */
7417 typedef struct pm_awake_data_v2 {
7418 	uint32 curr_time;	/**< ms */
7419 	uint32 hw_macc;		/**< HW maccontrol */
7420 	uint32 sw_macc;		/**< SW maccontrol */
7421 	uint32 pm_dur;		/**< Total sleep time in PM, msecs */
7422 	uint32 mpc_dur;		/**< Total sleep time in MPC, msecs */
7423 
7424 	/* int32 drifts = remote - local; +ve drift => local-clk slow */
7425 	int32 last_drift;	/**< Most recent TSF drift from beacon */
7426 	int32 min_drift;	/**< Min TSF drift from beacon in magnitude */
7427 	int32 max_drift;	/**< Max TSF drift from beacon in magnitude */
7428 
7429 	uint32 avg_drift;	/**< Avg TSF drift from beacon */
7430 
7431 	/* Wake history tracking */
7432 
7433 	/* pmstate array (type wlc_pm_debug_t) start offset */
7434 	uint16 pm_state_offset;
7435 	/** pmstate number of array entries */
7436 	uint16 pm_state_len;
7437 
7438 	/** array (type uint32) start offset */
7439 	uint16 pmd_event_wake_dur_offset;
7440 	/** pmd_event_wake_dur number of array entries */
7441 	uint16 pmd_event_wake_dur_len;
7442 
7443 	uint32 drift_cnt;	/**< Count of drift readings over which avg_drift was computed */
7444 	uint8  pmwake_idx;	/**< for stepping through pm_state */
7445 	uint8  flags;		/**< bit0: 1-sleep, 0- wake. bit1: 0-bit0 invlid, 1-bit0 valid */
7446 	uint8  pad[2];
7447 	uint32 frts_time;	/**< Cumulative ms spent in frts since driver load */
7448 	uint32 frts_end_cnt;	/**< No of times frts ended since driver load */
7449 } pm_awake_data_v2_t;
7450 
7451 typedef struct wl_pwr_pm_awake_stats_v2 {
7452 	uint16 type;	     /**< WL_PWRSTATS_TYPE_PM_AWAKE */
7453 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
7454 
7455 	pm_awake_data_v2_t awake_data;
7456 } wl_pwr_pm_awake_stats_v2_t;
7457 
7458 /* bit0: 1-sleep, 0- wake. bit1: 0-bit0 invlid, 1-bit0 valid */
7459 #define WL_PWR_PM_AWAKE_STATS_WAKE      0x02
7460 #define WL_PWR_PM_AWAKE_STATS_ASLEEP    0x03
7461 #define WL_PWR_PM_AWAKE_STATS_WAKE_MASK 0x03
7462 
7463 /* WL_PWRSTATS_TYPE_PM_AWAKE Version 2 structures taken from 4324/43342 */
7464 /* These structures are only to be used with 4324/43342 devices */
7465 
7466 #define WL_STA_AWAKE_STATES_MAX_V2	30
7467 #define WL_PMD_EVENT_MAX_V2		32
7468 #define MAX_P2P_BSS_DTIM_PRD		4
7469 
7470 #include <packed_section_start.h>
7471 typedef BWL_PRE_PACKED_STRUCT struct ucode_dbg_v2 {
7472 	uint32 macctrl;
7473 	uint16 m_p2p_hps;
7474 	uint16 m_p2p_bss_dtim_prd[MAX_P2P_BSS_DTIM_PRD];
7475 	uint32 psmdebug[20];
7476 	uint32 phydebug[20];
7477 	uint32 psm_brc;
7478 	uint32 ifsstat;
7479 } BWL_POST_PACKED_STRUCT ucode_dbg_v2_t;
7480 #include <packed_section_end.h>
7481 
7482 #include <packed_section_start.h>
7483 typedef BWL_PRE_PACKED_STRUCT struct pmalert_awake_data_v2 {
7484 	uint32 curr_time;	/* ms */
7485 	uint32 hw_macc;		/* HW maccontrol */
7486 	uint32 sw_macc;		/* SW maccontrol */
7487 	uint32 pm_dur;		/* Total sleep time in PM, msecs */
7488 	uint32 mpc_dur;		/* Total sleep time in MPC, msecs */
7489 
7490 	/* int32 drifts = remote - local; +ve drift => local-clk slow */
7491 	int32 last_drift;	/* Most recent TSF drift from beacon */
7492 	int32 min_drift;	/* Min TSF drift from beacon in magnitude */
7493 	int32 max_drift;	/* Max TSF drift from beacon in magnitude */
7494 
7495 	uint32 avg_drift;	/* Avg TSF drift from beacon */
7496 
7497 	/* Wake history tracking */
7498 	uint8  pmwake_idx;				   /* for stepping through pm_state */
7499 	wlc_pm_debug_t pm_state[WL_STA_AWAKE_STATES_MAX_V2]; /* timestamped wake bits */
7500 	uint32 pmd_event_wake_dur[WL_PMD_EVENT_MAX_V2];      /* cumulative usecs per wake reason */
7501 	uint32 drift_cnt;	/* Count of drift readings over which avg_drift was computed */
7502 	uint32	start_event_dur[WL_PMD_EVENT_MAX_V2]; /* start event-duration */
7503 	ucode_dbg_v2_t ud;
7504 	uint32 frts_time;	/* Cumulative ms spent in frts since driver load */
7505 	uint32 frts_end_cnt;	/* No of times frts ended since driver load */
7506 } BWL_POST_PACKED_STRUCT pmalert_awake_data_v2_t;
7507 #include <packed_section_end.h>
7508 
7509 #include <packed_section_start.h>
7510 typedef BWL_PRE_PACKED_STRUCT struct pm_alert_data_v2 {
7511 	uint32 version;
7512 	uint32 length; /* Length of entire structure */
7513 	uint32 reasons; /* reason(s) for pm_alert */
7514 	/* Following fields are present only for reasons
7515 	 * PM_DUR_EXCEEDED, MPC_DUR_EXCEEDED & CONST_AWAKE_DUR_EXCEEDED
7516 	 */
7517 	uint32 prev_stats_time;	/* msecs */
7518 	uint32 prev_pm_dur;	/* msecs */
7519 	uint32 prev_mpc_dur;	/* msecs */
7520 	pmalert_awake_data_v2_t awake_data;
7521 } BWL_POST_PACKED_STRUCT pm_alert_data_v2_t;
7522 #include <packed_section_end.h>
7523 
7524 #include <packed_section_start.h>
7525 typedef BWL_PRE_PACKED_STRUCT struct wl_pwr_pm_awake_status_v2 {
7526 	uint16 type;	     /* WL_PWRSTATS_TYPE_PM_AWAKE */
7527 	uint16 len;	     /* Up to 4K-1, top 4 bits are reserved */
7528 
7529 	pmalert_awake_data_v2_t awake_data;
7530 	uint32 frts_time;	/* Cumulative ms spent in frts since driver load */
7531 	uint32 frts_end_cnt;	/* No of times frts ended since driver load */
7532 } BWL_POST_PACKED_STRUCT wl_pwr_pm_awake_status_v2_t;
7533 #include <packed_section_end.h>
7534 
7535 /* Below are latest definitions from PHO25178RC100_BRANCH_6_50 */
7536 /* wl_pwr_pm_awake_stats_v1_t is used for WL_PWRSTATS_TYPE_PM_AWAKE */
7537 /* (at least) the chip independent registers */
7538 typedef struct ucode_dbg_ext {
7539 	uint32 x120;
7540 	uint32 x124;
7541 	uint32 x154;
7542 	uint32 x158;
7543 	uint32 x15c;
7544 	uint32 x180;
7545 	uint32 x184;
7546 	uint32 x188;
7547 	uint32 x18c;
7548 	uint32 x1a0;
7549 	uint32 x1a8;
7550 	uint32 x1e0;
7551 	uint32 scr_x14;
7552 	uint32 scr_x2b;
7553 	uint32 scr_x2c;
7554 	uint32 scr_x2d;
7555 	uint32 scr_x2e;
7556 
7557 	uint16 x40a;
7558 	uint16 x480;
7559 	uint16 x490;
7560 	uint16 x492;
7561 	uint16 x4d8;
7562 	uint16 x4b8;
7563 	uint16 x4ba;
7564 	uint16 x4bc;
7565 	uint16 x4be;
7566 	uint16 x500;
7567 	uint16 x50e;
7568 	uint16 x522;
7569 	uint16 x546;
7570 	uint16 x578;
7571 	uint16 x602;
7572 	uint16 x646;
7573 	uint16 x648;
7574 	uint16 x666;
7575 	uint16 x670;
7576 	uint16 x690;
7577 	uint16 x692;
7578 	uint16 x6a0;
7579 	uint16 x6a2;
7580 	uint16 x6a4;
7581 	uint16 x6b2;
7582 	uint16 x7c0;
7583 
7584 	uint16 shm_x20;
7585 	uint16 shm_x4a;
7586 	uint16 shm_x5e;
7587 	uint16 shm_x5f;
7588 	uint16 shm_xaab;
7589 	uint16 shm_x74a;
7590 	uint16 shm_x74b;
7591 	uint16 shm_x74c;
7592 	uint16 shm_x74e;
7593 	uint16 shm_x756;
7594 	uint16 shm_x75b;
7595 	uint16 shm_x7b9;
7596 	uint16 shm_x7d4;
7597 
7598 	uint16 shm_P2P_HPS;
7599 	uint16 shm_P2P_intr[16];
7600 	uint16 shm_P2P_perbss[48];
7601 } ucode_dbg_ext_t;
7602 
7603 #include <packed_section_start.h>
7604 typedef BWL_PRE_PACKED_STRUCT struct pm_alert_data_v1 {
7605 	uint32 version;
7606 	uint32 length; /**< Length of entire structure */
7607 	uint32 reasons; /**< reason(s) for pm_alert */
7608 	/* Following fields are present only for reasons
7609 	 * PM_DUR_EXCEEDED, MPC_DUR_EXCEEDED & CONST_AWAKE_DUR_EXCEEDED
7610 	 */
7611 	uint32 prev_stats_time;	/**< msecs */
7612 	uint32 prev_pm_dur;	/**< msecs */
7613 	uint32 prev_mpc_dur;	/**< msecs */
7614 	pm_awake_data_v1_t awake_data;
7615 	uint32	start_event_dur[WLC_PMD_EVENT_MAX_V1]; /**< start event-duration */
7616 	ucode_dbg_v2_t ud;
7617 	uint32 frts_time;	/**< Cumulative ms spent in frts since driver load */
7618 	uint32 frts_end_cnt;	/**< No of times frts ended since driver load */
7619 	ucode_dbg_ext_t ud_ext;
7620 	uint32 prev_frts_dur; /**< ms */
7621 } BWL_POST_PACKED_STRUCT pm_alert_data_v1_t;
7622 #include <packed_section_end.h>
7623 
7624 /* End of 43342/4324 v2 structure definitions */
7625 
7626 /* Original bus structure is for HSIC */
7627 
7628 typedef struct bus_metrics {
7629 	uint32 suspend_ct;	/**< suspend count */
7630 	uint32 resume_ct;	/**< resume count */
7631 	uint32 disconnect_ct;	/**< disconnect count */
7632 	uint32 reconnect_ct;	/**< reconnect count */
7633 	uint32 active_dur;	/**< msecs in bus, usecs for user */
7634 	uint32 suspend_dur;	/**< msecs in bus, usecs for user */
7635 	uint32 disconnect_dur;	/**< msecs in bus, usecs for user */
7636 } bus_metrics_t;
7637 
7638 /** Bus interface info for USB/HSIC */
7639 #include <packed_section_start.h>
7640 typedef BWL_PRE_PACKED_STRUCT struct wl_pwr_usb_hsic_stats {
7641 	uint16 type;	     /**< WL_PWRSTATS_TYPE_USB_HSIC */
7642 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
7643 
7644 	bus_metrics_t hsic;	/**< stats from hsic bus driver */
7645 } BWL_POST_PACKED_STRUCT wl_pwr_usb_hsic_stats_t;
7646 #include <packed_section_end.h>
7647 
7648 /* PCIe Event counter tlv IDs */
7649 enum pcie_cnt_xtlv_id {
7650 	PCIE_CNT_XTLV_METRICS = 0x1,	/**< PCIe Bus Metrics */
7651 	PCIE_CNT_XTLV_BUS_CNT = 0x2	/**< PCIe Bus counters */
7652 };
7653 
7654 typedef struct pcie_bus_metrics {
7655 	uint32 d3_suspend_ct;	/**< suspend count */
7656 	uint32 d0_resume_ct;	/**< resume count */
7657 	uint32 perst_assrt_ct;	/**< PERST# assert count */
7658 	uint32 perst_deassrt_ct;	/**< PERST# de-assert count */
7659 	uint32 active_dur;	/**< msecs */
7660 	uint32 d3_suspend_dur;	/**< msecs */
7661 	uint32 perst_dur;	/**< msecs */
7662 	uint32 l0_cnt;		/**< L0 entry count */
7663 	uint32 l0_usecs;	/**< L0 duration in usecs */
7664 	uint32 l1_cnt;		/**< L1 entry count */
7665 	uint32 l1_usecs;	/**< L1 duration in usecs */
7666 	uint32 l1_1_cnt;	/**< L1_1ss entry count */
7667 	uint32 l1_1_usecs;	/**< L1_1ss duration in usecs */
7668 	uint32 l1_2_cnt;	/**< L1_2ss entry count */
7669 	uint32 l1_2_usecs;	/**< L1_2ss duration in usecs */
7670 	uint32 l2_cnt;		/**< L2 entry count */
7671 	uint32 l2_usecs;	/**< L2 duration in usecs */
7672 	uint32 timestamp;	/**< Timestamp on when stats are collected */
7673 	uint32 num_h2d_doorbell;	/**< # of doorbell interrupts - h2d */
7674 	uint32 num_d2h_doorbell;	/**< # of doorbell interrupts - d2h */
7675 	uint32 num_submissions; /**< # of submissions */
7676 	uint32 num_completions; /**< # of completions */
7677 	uint32 num_rxcmplt;	/**< # of rx completions */
7678 	uint32 num_rxcmplt_drbl;	/**< of drbl interrupts for rx complt. */
7679 	uint32 num_txstatus;	/**< # of tx completions */
7680 	uint32 num_txstatus_drbl;	/**< of drbl interrupts for tx complt. */
7681 	uint32 deepsleep_count; /**< # of times chip went to deepsleep */
7682 	uint32 deepsleep_dur;   /**< # of msecs chip was in deepsleep */
7683 	uint32 ltr_active_ct;	/**< # of times chip went to LTR ACTIVE */
7684 	uint32 ltr_active_dur;	/**< # of msecs chip was in LTR ACTIVE */
7685 	uint32 ltr_sleep_ct;	/**< # of times chip went to LTR SLEEP */
7686 	uint32 ltr_sleep_dur;	/**< # of msecs chip was in LTR SLEEP */
7687 } pcie_bus_metrics_t;
7688 
7689 typedef struct pcie_cnt {
7690 	uint32 ltr_state; /**< Current LTR state */
7691 	uint32 l0_sr_cnt; /**< SR count during L0 */
7692 	uint32 l2l3_sr_cnt; /**< SR count during L2L3 */
7693 	uint32 d3_ack_sr_cnt; /**< srcount during last D3-ACK */
7694 	uint32 d3_sr_cnt; /**< SR count during D3 */
7695 	uint32 d3_info_start; /**< D3 INFORM received time */
7696 	uint32 d3_info_enter_cnt; /**< # of D3 INFORM received */
7697 	uint32 d3_cnt; /**< # of real D3 */
7698 	uint32 d3_ack_sent_cnt; /**< # of D3 ACK sent count */
7699 	uint32 d3_drop_cnt_event; /**< # of events dropped during D3 */
7700 	uint32 d2h_req_q_len; /**< # of Packet pending in D2H request queue */
7701 	uint32 hw_reason; /**< Last Host wake assert reason */
7702 	uint32 hw_assert_cnt; /**< # of times Host wake Asserted */
7703 	uint32 host_ready_cnt; /**< # of Host ready interrupts */
7704 	uint32 hw_assert_reason_0; /**< timestamp when hw_reason is TRAP  */
7705 	uint32 hw_assert_reason_1; /**< timestamp when hw_reason is WL_EVENT */
7706 	uint32 hw_assert_reason_2; /**< timestamp when hw_reason is DATA */
7707 	uint32 hw_assert_reason_3; /**< timestamp when hw_reason is DELAYED_WAKE */
7708 	uint32 last_host_ready; /**< Timestamp of last Host ready */
7709 	bool hw_asserted; /**< Flag to indicate if Host wake is Asserted */
7710 	bool event_delivery_pend; /**< No resources to send event */
7711 	uint16 pad; /**< Word alignment for scripts */
7712 } pcie_cnt_t;
7713 
7714 /** Bus interface info for PCIE */
7715 typedef struct wl_pwr_pcie_stats {
7716 	uint16 type;	     /**< WL_PWRSTATS_TYPE_PCIE */
7717 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
7718 	pcie_bus_metrics_t pcie;	/**< stats from pcie bus driver */
7719 } wl_pwr_pcie_stats_t;
7720 
7721 /** Scan information history per category */
7722 typedef struct scan_data {
7723 	uint32 count;		/**< Number of scans performed */
7724 	uint32 dur;		/**< Total time (in us) used */
7725 } scan_data_t;
7726 
7727 typedef struct wl_pwr_scan_stats {
7728 	uint16 type;	     /**< WL_PWRSTATS_TYPE_SCAN */
7729 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
7730 
7731 	/* Scan history */
7732 	scan_data_t user_scans;	  /**< User-requested scans: (i/e/p)scan */
7733 	scan_data_t assoc_scans;  /**< Scans initiated by association requests */
7734 	scan_data_t roam_scans;	  /**< Scans initiated by the roam engine */
7735 	scan_data_t pno_scans[8]; /**< For future PNO bucketing (BSSID, SSID, etc) */
7736 	scan_data_t other_scans;  /**< Scan engine usage not assigned to the above */
7737 } wl_pwr_scan_stats_t;
7738 
7739 typedef struct wl_pwr_connect_stats {
7740 	uint16 type;	     /**< WL_PWRSTATS_TYPE_SCAN */
7741 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
7742 
7743 	/* Connection (Association + Key exchange) data */
7744 	uint32 count;	/**< Number of connections performed */
7745 	uint32 dur;		/**< Total time (in ms) used */
7746 } wl_pwr_connect_stats_t;
7747 
7748 typedef struct wl_pwr_phy_stats {
7749 	uint16 type;	    /**< WL_PWRSTATS_TYPE_PHY */
7750 	uint16 len;	    /**< Up to 4K-1, top 4 bits are reserved */
7751 	uint32 tx_dur;	    /**< TX Active duration in us */
7752 	uint32 rx_dur;	    /**< RX Active duration in us */
7753 } wl_pwr_phy_stats_t;
7754 
7755 typedef struct wl_mimo_meas_metrics_v1 {
7756 	uint16 type;
7757 	uint16 len;
7758 	/* Total time(us) idle in MIMO RX chain configuration */
7759 	uint32 total_idle_time_mimo;
7760 	/* Total time(us) idle in SISO  RX chain configuration */
7761 	uint32 total_idle_time_siso;
7762 	/* Total receive time (us) in SISO RX chain configuration */
7763 	uint32 total_rx_time_siso;
7764 	/* Total receive time (us) in MIMO RX chain configuration */
7765 	uint32 total_rx_time_mimo;
7766 	/* Total 1-chain transmit time(us) */
7767 	uint32 total_tx_time_1chain;
7768 	/* Total 2-chain transmit time(us) */
7769 	uint32 total_tx_time_2chain;
7770 	/* Total 3-chain transmit time(us) */
7771 	uint32 total_tx_time_3chain;
7772 } wl_mimo_meas_metrics_v1_t;
7773 
7774 typedef struct wl_mimo_meas_metrics {
7775 	uint16 type;
7776 	uint16 len;
7777 	/* Total time(us) idle in MIMO RX chain configuration */
7778 	uint32 total_idle_time_mimo;
7779 	/* Total time(us) idle in SISO  RX chain configuration */
7780 	uint32 total_idle_time_siso;
7781 	/* Total receive time (us) in SISO RX chain configuration */
7782 	uint32 total_rx_time_siso;
7783 	/* Total receive time (us) in MIMO RX chain configuration */
7784 	uint32 total_rx_time_mimo;
7785 	/* Total 1-chain transmit time(us) */
7786 	uint32 total_tx_time_1chain;
7787 	/* Total 2-chain transmit time(us) */
7788 	uint32 total_tx_time_2chain;
7789 	/* Total 3-chain transmit time(us) */
7790 	uint32 total_tx_time_3chain;
7791 	/* End of original, OCL fields start here */
7792 	/* Total time(us) idle in ocl mode */
7793 	uint32 total_idle_time_ocl;
7794 	/* Total receive time (us) in ocl mode */
7795 	uint32 total_rx_time_ocl;
7796 	/* End of OCL fields, internal adjustment fields here */
7797 	/* Total SIFS idle time in MIMO mode */
7798 	uint32 total_sifs_time_mimo;
7799 	/* Total SIFS idle time in SISO mode */
7800 	uint32 total_sifs_time_siso;
7801 } wl_mimo_meas_metrics_t;
7802 
7803 typedef struct wl_pwr_slice_index {
7804 	uint16 type;	     /* WL_PWRSTATS_TYPE_SLICE_INDEX */
7805 	uint16 len;
7806 
7807 	uint32 slice_index;	/* Slice index for which stats are meant for */
7808 } wl_pwr_slice_index_t;
7809 
7810 typedef struct wl_pwr_tsync_stats {
7811 	uint16 type;		/**< WL_PWRSTATS_TYPE_TSYNC */
7812 	uint16 len;
7813 	uint32 avb_uptime;	/**< AVB uptime in msec */
7814 } wl_pwr_tsync_stats_t;
7815 
7816 typedef struct wl_pwr_ops_stats {
7817 	uint16 type;			/* WL_PWRSTATS_TYPE_OPS_STATS */
7818 	uint16 len;			/* total length includes fixed fields */
7819 	uint32 partial_ops_dur;		/* Total time(in usec) partial ops duration */
7820 	uint32 full_ops_dur;		/* Total time(in usec) full ops duration */
7821 } wl_pwr_ops_stats_t;
7822 
7823 typedef struct wl_pwr_bcntrim_stats {
7824 	uint16 type;			/* WL_PWRSTATS_TYPE_BCNTRIM_STATS */
7825 	uint16 len;			/* total length includes fixed fields */
7826 	uint8  associated;		/* STA is associated ? */
7827 	uint8  slice_idx;		/* on which slice STA is associated */
7828 	uint16 pad;			/* padding */
7829 	uint32 slice_beacon_seen;	/* number of beacons seen on the Infra
7830 		                         * interface on this slice
7831 		                         */
7832 	uint32 slice_beacon_trimmed;	/* number beacons actually trimmed on this slice */
7833 	uint32 total_beacon_seen;	/* total number of beacons seen on the Infra interface */
7834 	uint32 total_beacon_trimmed;	/* total beacons actually trimmed */
7835 } wl_pwr_bcntrim_stats_t;
7836 
7837 typedef struct wl_pwr_slice_index_band {
7838 	uint16 type;			/* WL_PWRSTATS_TYPE_SLICE_INDEX_BAND_INFO */
7839 	uint16 len;			/* Total length includes fixed fields */
7840 	uint16 index;			/* Slice Index */
7841 	int16  bandtype;		/* Slice Bandtype */
7842 } wl_pwr_slice_index_band_t;
7843 
7844 typedef struct wl_pwr_psbw_stats {
7845 	uint16 type;			/* WL_PWRSTATS_TYPE_PSBW_STATS */
7846 	uint16 len;			/* total length includes fixed fields */
7847 	uint8  slice_idx;		/* on which slice STA is associated */
7848 	uint8  pad[3];
7849 	uint32 slice_enable_dur;	/* time(ms) psbw remains enabled on this slice */
7850 	uint32 total_enable_dur;	/* time(ms) psbw remains enabled total */
7851 } wl_pwr_psbw_stats_t;
7852 
7853 /* ##### End of Power Stats section ##### */
7854 
7855 /** IPV4 Arp offloads for ndis context */
7856 #include <packed_section_start.h>
7857 BWL_PRE_PACKED_STRUCT struct hostip_id {
7858 	struct ipv4_addr ipa;
7859 	uint8 id;
7860 } BWL_POST_PACKED_STRUCT;
7861 #include <packed_section_end.h>
7862 
7863 /* Return values */
7864 #define ND_REPLY_PEER		0x1	/**< Reply was sent to service NS request from peer */
7865 #define ND_REQ_SINK		0x2	/**< Input packet should be discarded */
7866 #define ND_FORCE_FORWARD	0X3	/**< For the dongle to forward req to HOST */
7867 
7868 /** Neighbor Solicitation Response Offload IOVAR param */
7869 #include <packed_section_start.h>
7870 typedef BWL_PRE_PACKED_STRUCT struct nd_param {
7871 	struct ipv6_addr	host_ip[2];
7872 	struct ipv6_addr	solicit_ip;
7873 	struct ipv6_addr	remote_ip;
7874 	uint8	host_mac[ETHER_ADDR_LEN];
7875 	uint32	offload_id;
7876 } BWL_POST_PACKED_STRUCT nd_param_t;
7877 #include <packed_section_end.h>
7878 
7879 typedef struct wl_pfn_roam_thresh {
7880 	uint32 pfn_alert_thresh; /**< time in ms */
7881 	uint32 roam_alert_thresh; /**< time in ms */
7882 } wl_pfn_roam_thresh_t;
7883 
7884 /* Reasons for wl_pmalert_t */
7885 #define PM_DUR_EXCEEDED			(1<<0)
7886 #define MPC_DUR_EXCEEDED		(1<<1)
7887 #define ROAM_ALERT_THRESH_EXCEEDED	(1<<2)
7888 #define PFN_ALERT_THRESH_EXCEEDED	(1<<3)
7889 #define CONST_AWAKE_DUR_ALERT		(1<<4)
7890 #define CONST_AWAKE_DUR_RECOVERY	(1<<5)
7891 
7892 #define MIN_PM_ALERT_LEN 9
7893 
7894 /** Data sent in EXCESS_PM_WAKE event */
7895 #define WL_PM_ALERT_VERSION 3
7896 
7897 /** This structure is for version 3; version 2 will be deprecated in by FW */
7898 #include <packed_section_start.h>
7899 typedef BWL_PRE_PACKED_STRUCT struct wl_pmalert {
7900 	uint16 version;		/**< Version = 3 is TLV format */
7901 	uint16 length;		/**< Length of entire structure */
7902 	uint32 reasons;		/**< reason(s) for pm_alert */
7903 	uint8 data[1];		/**< TLV data, a series of structures,
7904 				 * each starting with type and length.
7905 				 *
7906 				 * Padded as necessary so each section
7907 				 * starts on a 4-byte boundary.
7908 				 *
7909 				 * Both type and len are uint16, but the
7910 				 * upper nibble of length is reserved so
7911 				 * valid len values are 0-4095.
7912 				*/
7913 } BWL_POST_PACKED_STRUCT wl_pmalert_t;
7914 #include <packed_section_end.h>
7915 
7916 /* Type values for the data section */
7917 #define WL_PMALERT_FIXED	0	/**< struct wl_pmalert_fixed_t, fixed fields */
7918 #define WL_PMALERT_PMSTATE	1	/**< struct wl_pmalert_pmstate_t, variable */
7919 #define WL_PMALERT_EVENT_DUR	2	/**< struct wl_pmalert_event_dur_t, variable */
7920 #define WL_PMALERT_UCODE_DBG	3	/**< struct wl_pmalert_ucode_dbg_v1, variable */
7921 #define WL_PMALERT_PS_ALLOWED_HIST	4 /**< struct wl_pmalert_ps_allowed_history, variable */
7922 #define WL_PMALERT_EXT_UCODE_DBG	5 /**< struct wl_pmalert_ext_ucode_dbg_t, variable */
7923 #define WL_PMALERT_EPM_START_EVENT_DUR	6 /**< struct wl_pmalert_event_dur_t, variable */
7924 #define WL_PMALERT_UCODE_DBG_V2		7 /**< struct wl_pmalert_ucode_dbg_v2, variable */
7925 
7926 typedef struct wl_pmalert_fixed {
7927 	uint16 type;		/**< WL_PMALERT_FIXED */
7928 	uint16 len;		/**< Up to 4K-1, top 4 bits are reserved */
7929 	uint32 prev_stats_time;	/**< msecs */
7930 	uint32 curr_time;	/**< ms */
7931 	uint32 prev_pm_dur;	/**< msecs */
7932 	uint32 pm_dur;		/**< Total sleep time in PM, msecs */
7933 	uint32 prev_mpc_dur;	/**< msecs */
7934 	uint32 mpc_dur;		/**< Total sleep time in MPC, msecs */
7935 	uint32 hw_macc;		/**< HW maccontrol */
7936 	uint32 sw_macc;		/**< SW maccontrol */
7937 
7938 	/* int32 drifts = remote - local; +ve drift -> local-clk slow */
7939 	int32 last_drift;	/**< Most recent TSF drift from beacon */
7940 	int32 min_drift;	/**< Min TSF drift from beacon in magnitude */
7941 	int32 max_drift;	/**< Max TSF drift from beacon in magnitude */
7942 
7943 	uint32 avg_drift;	/**< Avg TSF drift from beacon */
7944 	uint32 drift_cnt;	/**< Count of drift readings over which avg_drift was computed */
7945 	uint32 frts_time;	/**< Cumulative ms spent in data frts since driver load */
7946 	uint32 frts_end_cnt;	/**< No of times frts ended since driver load */
7947 	uint32 prev_frts_dur;	/**< Data frts duration at start of pm-period */
7948 	uint32 cal_dur;		/**< Cumulative ms spent in calibration */
7949 	uint32 prev_cal_dur;	/**< cal duration at start of pm-period */
7950 } wl_pmalert_fixed_t;
7951 
7952 typedef struct wl_pmalert_pmstate {
7953 	uint16 type;	     /**< WL_PMALERT_PMSTATE */
7954 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
7955 
7956 	uint8 pmwake_idx;   /**< for stepping through pm_state */
7957 	uint8 pad[3];
7958 	/* Array of pmstate; len of array is based on tlv len */
7959 	wlc_pm_debug_t pmstate[1];
7960 } wl_pmalert_pmstate_t;
7961 
7962 typedef struct wl_pmalert_event_dur {
7963 	uint16 type;	     /**< WL_PMALERT_EVENT_DUR */
7964 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
7965 
7966 	/* Array of event_dur, len of array is based on tlv len */
7967 	uint32 event_dur[1];
7968 } wl_pmalert_event_dur_t;
7969 
7970 #include <packed_section_start.h>
7971 BWL_PRE_PACKED_STRUCT struct wl_pmalert_ucode_dbg_v1 {
7972 	uint16 type;         /* WL_PMALERT_UCODE_DBG */
7973 	uint16 len;      /* Up to 4K-1, top 4 bits are reserved */
7974 	uint32 macctrl;
7975 	uint16 m_p2p_hps;
7976 	uint32 psm_brc;
7977 	uint32 ifsstat;
7978 	uint16 m_p2p_bss_dtim_prd[MAX_P2P_BSS_DTIM_PRD];
7979 	uint32 psmdebug[20];
7980 	uint32 phydebug[20];
7981 	uint16 M_P2P_BSS[3][12];
7982 	uint16 M_P2P_PRE_TBTT[3];
7983 
7984 	/* Following is valid only for corerevs<40 */
7985 	uint16 xmtfifordy;
7986 
7987 	/* Following 3 are valid only for 11ac corerevs (>=40) */
7988 	uint16 psm_maccommand;
7989 	uint16 txe_status1;
7990 	uint16 AQMFifoReady;
7991 } BWL_POST_PACKED_STRUCT;
7992 #include <packed_section_end.h>
7993 
7994 #include <packed_section_start.h>
7995 BWL_PRE_PACKED_STRUCT struct wl_pmalert_ucode_dbg_v2 {
7996 	uint16 type;	     /**< WL_PMALERT_UCODE_DBG_V2 */
7997 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
7998 	uint32 macctrl;
7999 	uint16 m_p2p_hps;
8000 	uint32 psm_brc;
8001 	uint32 ifsstat;
8002 	uint16 m_p2p_bss_dtim_prd[MAX_P2P_BSS_DTIM_PRD];
8003 	uint32 psmdebug[20];
8004 	uint32 phydebug[20];
8005 	uint16 M_P2P_BSS[3][12];
8006 	uint16 M_P2P_PRE_TBTT[3];
8007 
8008 	/* Following is valid only for corerevs<40 */
8009 	uint16 xmtfifordy;
8010 
8011 	/* Following 3 are valid only for 11ac corerevs (>=40) */
8012 	uint16 psm_maccommand;
8013 	uint16 txe_status1;
8014 	uint32 AQMFifoReady;
8015 } BWL_POST_PACKED_STRUCT;
8016 #include <packed_section_end.h>
8017 
8018 typedef struct wlc_ps_debug {
8019 	uint32 timestamp;	     /**< timestamp in millisecond */
8020 	uint32 ps_mask;		     /**< reason(s) for disallowing ps */
8021 } wlc_ps_debug_t;
8022 
8023 typedef struct wl_pmalert_ps_allowed_hist {
8024 	uint16 type;	     /**< WL_PMALERT_PS_ALLOWED_HIST */
8025 	uint16 len;	     /**< Up to 4K-1, top 4 bits are reserved */
8026 	uint32 ps_allowed_start_idx;
8027 	/* Array of ps_debug, len of array is based on tlv len */
8028 	wlc_ps_debug_t ps_debug[1];
8029 } wl_pmalert_ps_allowed_hist_t;
8030 
8031 /* Structures and constants used for "vndr_ie" IOVar interface */
8032 #define VNDR_IE_CMD_LEN		4	/**< length of the set command string:
8033 					 * "add", "del" (+ NUL)
8034 					 */
8035 
8036 #define VNDR_IE_INFO_HDR_LEN	(sizeof(uint32))
8037 
8038 #include <packed_section_start.h>
8039 typedef BWL_PRE_PACKED_STRUCT struct {
8040 	uint32 pktflag;			/**< bitmask indicating which packet(s) contain this IE */
8041 	vndr_ie_t vndr_ie_data;		/**< vendor IE data */
8042 } BWL_POST_PACKED_STRUCT vndr_ie_info_t;
8043 #include <packed_section_end.h>
8044 
8045 #include <packed_section_start.h>
8046 typedef BWL_PRE_PACKED_STRUCT struct {
8047 	int32 iecount;			/**< number of entries in the vndr_ie_list[] array */
8048 	vndr_ie_info_t vndr_ie_list[1];	/**< variable size list of vndr_ie_info_t structs */
8049 } BWL_POST_PACKED_STRUCT vndr_ie_buf_t;
8050 #include <packed_section_end.h>
8051 
8052 #include <packed_section_start.h>
8053 typedef BWL_PRE_PACKED_STRUCT struct {
8054 	char cmd[VNDR_IE_CMD_LEN];	/**< vndr_ie IOVar set command : "add", "del" + NUL */
8055 	vndr_ie_buf_t vndr_ie_buffer;	/**< buffer containing Vendor IE list information */
8056 } BWL_POST_PACKED_STRUCT vndr_ie_setbuf_t;
8057 #include <packed_section_end.h>
8058 
8059 /** tag_ID/length/value_buffer tuple */
8060 #include <packed_section_start.h>
8061 typedef BWL_PRE_PACKED_STRUCT struct {
8062 	uint8	id;
8063 	uint8	len;
8064 	uint8	data[1];
8065 } BWL_POST_PACKED_STRUCT tlv_t;
8066 #include <packed_section_end.h>
8067 
8068 #include <packed_section_start.h>
8069 typedef BWL_PRE_PACKED_STRUCT struct {
8070 	uint32 pktflag;			/**< bitmask indicating which packet(s) contain this IE */
8071 	tlv_t ie_data;		/**< IE data */
8072 } BWL_POST_PACKED_STRUCT ie_info_t;
8073 #include <packed_section_end.h>
8074 
8075 #include <packed_section_start.h>
8076 typedef BWL_PRE_PACKED_STRUCT struct {
8077 	int32 iecount;			/**< number of entries in the ie_list[] array */
8078 	ie_info_t ie_list[1];	/**< variable size list of ie_info_t structs */
8079 } BWL_POST_PACKED_STRUCT ie_buf_t;
8080 #include <packed_section_end.h>
8081 
8082 #include <packed_section_start.h>
8083 typedef BWL_PRE_PACKED_STRUCT struct {
8084 	char cmd[VNDR_IE_CMD_LEN];	/**< ie IOVar set command : "add" + NUL */
8085 	ie_buf_t ie_buffer;	/**< buffer containing IE list information */
8086 } BWL_POST_PACKED_STRUCT ie_setbuf_t;
8087 #include <packed_section_end.h>
8088 
8089 #include <packed_section_start.h>
8090 typedef BWL_PRE_PACKED_STRUCT struct {
8091 	uint32 pktflag;		/**< bitmask indicating which packet(s) contain this IE */
8092 	uint8 id;		/**< IE type */
8093 } BWL_POST_PACKED_STRUCT ie_getbuf_t;
8094 #include <packed_section_end.h>
8095 
8096 /* structures used to define format of wps ie data from probe requests */
8097 /* passed up to applications via iovar "prbreq_wpsie" */
8098 typedef struct sta_prbreq_wps_ie_hdr {
8099 	struct ether_addr staAddr;
8100 	uint16 ieLen;
8101 } sta_prbreq_wps_ie_hdr_t;
8102 
8103 #include <packed_section_start.h>
8104 typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_data {
8105 	sta_prbreq_wps_ie_hdr_t hdr;
8106 	uint8 ieData[1];
8107 } BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_data_t;
8108 #include <packed_section_end.h>
8109 
8110 #include <packed_section_start.h>
8111 typedef BWL_PRE_PACKED_STRUCT struct sta_prbreq_wps_ie_list {
8112 	uint32 totLen;
8113 	uint8 ieDataList[1];
8114 } BWL_POST_PACKED_STRUCT sta_prbreq_wps_ie_list_t;
8115 #include <packed_section_end.h>
8116 
8117 #include <packed_section_start.h>
8118 typedef BWL_PRE_PACKED_STRUCT struct {
8119 	uint32 flags;
8120 	chanspec_t chanspec;			/**< txpwr report for this channel */
8121 	chanspec_t local_chanspec;		/**< channel on which we are associated */
8122 	uint8 local_max;			/**< local max according to the AP */
8123 	uint8 local_constraint;			/**< local constraint according to the AP */
8124 	int8 antgain[2];			/**< Ant gain for each band - from SROM */
8125 	uint8 rf_cores;				/**< count of RF Cores being reported */
8126 	uint8 est_Pout[4];			/**< Latest tx power out estimate per RF chain */
8127 	uint8 est_Pout_act[4]; /**< Latest tx power out estimate per RF chain w/o adjustment */
8128 	uint8 est_Pout_cck;			/**< Latest CCK tx power out estimate */
8129 	uint8 tx_power_max[4];			/**< Maximum target power among all rates */
8130 	uint32 tx_power_max_rate_ind[4];  /**< Index of the rate with the max target power */
8131 	int8 sar;				/**< SAR limit for display by wl executable */
8132 	int8 channel_bandwidth;		/**< 20, 40 or 80 MHz bandwidth? */
8133 	uint8 version;				/**< Version of the data format wlu <--> driver */
8134 	uint8 display_core;			/**< Displayed curpower core */
8135 	int8 target_offsets[4];		/**< Target power offsets for current rate per core */
8136 	uint32 last_tx_ratespec;	/**< Ratespec for last transmition */
8137 	uint32 user_target;		/**< user limit */
8138 	uint32 ppr_len;		/**< length of each ppr serialization buffer */
8139 	int8 SARLIMIT[MAX_STREAMS_SUPPORTED];
8140 	uint8  pprdata[1];		/**< ppr serialization buffer */
8141 } BWL_POST_PACKED_STRUCT tx_pwr_rpt_v1_t;
8142 #include <packed_section_end.h>
8143 
8144 #include <packed_section_start.h>
8145 typedef BWL_PRE_PACKED_STRUCT struct {
8146 	uint32 flags;
8147 	chanspec_t chanspec;			/**< txpwr report for this channel */
8148 	chanspec_t local_chanspec;		/**< channel on which we are associated */
8149 	uint8 local_max;			/**< local max according to the AP */
8150 	uint8 local_constraint;			/**< local constraint according to the AP */
8151 	int8 antgain[3];			/**< Ant gain for each band - from SROM */
8152 	uint8 rf_cores;				/**< count of RF Cores being reported */
8153 	uint8 est_Pout[4];			/**< Latest tx power out estimate per RF chain */
8154 	uint8 est_Pout_act[4]; /**< Latest tx power out estimate per RF chain w/o adjustment */
8155 	uint8 est_Pout_cck;			/**< Latest CCK tx power out estimate */
8156 	uint8 tx_power_max[4];			/**< Maximum target power among all rates */
8157 	uint32 tx_power_max_rate_ind[4];  /**< Index of the rate with the max target power */
8158 	int8 sar;				/**< SAR limit for display by wl executable */
8159 	int8 channel_bandwidth;		/**< 20, 40 or 80 MHz bandwidth? */
8160 	uint8 version;				/**< Version of the data format wlu <--> driver */
8161 	uint8 display_core;			/**< Displayed curpower core */
8162 	int8 target_offsets[4];		/**< Target power offsets for current rate per core */
8163 	uint32 last_tx_ratespec;	/**< Ratespec for last transmition */
8164 	uint32 user_target;		/**< user limit */
8165 	uint32 ppr_len;		/**< length of each ppr serialization buffer */
8166 	int8 SARLIMIT[MAX_STREAMS_SUPPORTED];
8167 	uint8  pprdata[1];		/**< ppr serialization buffer */
8168 } BWL_POST_PACKED_STRUCT tx_pwr_rpt_v2_t;
8169 #include <packed_section_end.h>
8170 
8171 #include <packed_section_start.h>
8172 typedef BWL_PRE_PACKED_STRUCT struct {
8173 	uint8  version;	/* Version of the data format wlu <--> driver */
8174 	uint32 length;	/* Length token */
8175 } BWL_POST_PACKED_STRUCT tx_pwr_rpt_version_t;
8176 #include <packed_section_end.h>
8177 
8178 #ifdef TBAND
8179 typedef tx_pwr_rpt_v2_t tx_pwr_rpt_t;
8180 #else
8181 typedef tx_pwr_rpt_v1_t tx_pwr_rpt_t;
8182 #endif	/* TBAND */
8183 
8184 #define TXPWR_RPT_LEN_TOKEN	0x5649414e /* Spells VIAN */
8185 #define TXPWR_RPT_VERSION_V1	1
8186 #define TXPWR_RPT_VERSION_V2	2
8187 
8188 #include <packed_section_start.h>
8189 typedef BWL_PRE_PACKED_STRUCT struct {
8190 	struct ipv4_addr	ipv4_addr;
8191 	struct ether_addr nexthop;
8192 } BWL_POST_PACKED_STRUCT ibss_route_entry_t;
8193 #include <packed_section_end.h>
8194 
8195 #include <packed_section_start.h>
8196 typedef BWL_PRE_PACKED_STRUCT struct {
8197 	uint32 num_entry;
8198 	ibss_route_entry_t route_entry[1];
8199 } BWL_POST_PACKED_STRUCT ibss_route_tbl_t;
8200 #include <packed_section_end.h>
8201 
8202 #define MAX_IBSS_ROUTE_TBL_ENTRY	64
8203 
8204 #define TXPWR_TARGET_VERSION  0
8205 #include <packed_section_start.h>
8206 typedef BWL_PRE_PACKED_STRUCT struct {
8207 	int32 version;		/**< version number */
8208 	chanspec_t chanspec;	/**< txpwr report for this channel */
8209 	int8 txpwr[WL_STA_ANT_MAX]; /**< Max tx target power, in qdb */
8210 	uint8 rf_cores;		/**< count of RF Cores being reported */
8211 } BWL_POST_PACKED_STRUCT txpwr_target_max_t;
8212 #include <packed_section_end.h>
8213 
8214 #define BSS_PEER_INFO_PARAM_CUR_VER	0
8215 /** Input structure for IOV_BSS_PEER_INFO */
8216 #include <packed_section_start.h>
8217 typedef BWL_PRE_PACKED_STRUCT	struct {
8218 	uint16			version;
8219 	struct	ether_addr ea;	/**< peer MAC address */
8220 } BWL_POST_PACKED_STRUCT bss_peer_info_param_t;
8221 #include <packed_section_end.h>
8222 
8223 #define BSS_PEER_INFO_CUR_VER		0
8224 
8225 #include <packed_section_start.h>
8226 typedef BWL_PRE_PACKED_STRUCT struct {
8227 	uint16			version;
8228 	struct ether_addr	ea;
8229 	int32			rssi;
8230 	uint32			tx_rate;	/**< current tx rate */
8231 	uint32			rx_rate;	/**< current rx rate */
8232 	wl_rateset_t		rateset;	/**< rateset in use */
8233 	uint32			age;		/**< age in seconds */
8234 } BWL_POST_PACKED_STRUCT bss_peer_info_t;
8235 #include <packed_section_end.h>
8236 
8237 #define BSS_PEER_LIST_INFO_CUR_VER	0
8238 
8239 #include <packed_section_start.h>
8240 typedef BWL_PRE_PACKED_STRUCT struct {
8241 	uint16			version;
8242 	uint16			bss_peer_info_len;	/**< length of bss_peer_info_t */
8243 	uint32			count;			/**< number of peer info */
8244 	bss_peer_info_t		peer_info[1];		/**< peer info */
8245 } BWL_POST_PACKED_STRUCT bss_peer_list_info_t;
8246 #include <packed_section_end.h>
8247 
8248 #define BSS_PEER_LIST_INFO_FIXED_LEN OFFSETOF(bss_peer_list_info_t, peer_info)
8249 
8250 #define AIBSS_BCN_FORCE_CONFIG_VER_0	0
8251 
8252 /** structure used to configure AIBSS beacon force xmit */
8253 #include <packed_section_start.h>
8254 typedef BWL_PRE_PACKED_STRUCT struct {
8255 	uint16  version;
8256 	uint16	len;
8257 	uint32 initial_min_bcn_dur;	/**< dur in ms to check a bcn in bcn_flood period */
8258 	uint32 min_bcn_dur;	/**< dur in ms to check a bcn after bcn_flood period */
8259 	uint32 bcn_flood_dur; /**< Initial bcn xmit period in ms */
8260 } BWL_POST_PACKED_STRUCT aibss_bcn_force_config_t;
8261 #include <packed_section_end.h>
8262 
8263 #define AIBSS_TXFAIL_CONFIG_VER_0    0
8264 #define AIBSS_TXFAIL_CONFIG_VER_1    1
8265 #define AIBSS_TXFAIL_CONFIG_CUR_VER		AIBSS_TXFAIL_CONFIG_VER_1
8266 
8267 /** structure used to configure aibss tx fail event */
8268 #include <packed_section_start.h>
8269 typedef BWL_PRE_PACKED_STRUCT struct {
8270 	uint16  version;
8271 	uint16  len;
8272 	uint32 bcn_timeout;     /**< dur in seconds to receive 1 bcn */
8273 	uint32 max_tx_retry;     /**< no of consecutive no acks to send txfail event */
8274 	uint32 max_atim_failure; /**< no of consecutive atim failure */
8275 } BWL_POST_PACKED_STRUCT aibss_txfail_config_t;
8276 #include <packed_section_end.h>
8277 
8278 #include <packed_section_start.h>
8279 typedef BWL_PRE_PACKED_STRUCT struct wl_aibss_if {
8280 	uint16 version;
8281 	uint16 len;
8282 	uint32 flags;
8283 	struct ether_addr addr;
8284 	chanspec_t chspec;
8285 } BWL_POST_PACKED_STRUCT wl_aibss_if_t;
8286 #include <packed_section_end.h>
8287 
8288 #include <packed_section_start.h>
8289 typedef BWL_PRE_PACKED_STRUCT struct wlc_ipfo_route_entry {
8290 	struct ipv4_addr ip_addr;
8291 	struct ether_addr nexthop;
8292 } BWL_POST_PACKED_STRUCT wlc_ipfo_route_entry_t;
8293 #include <packed_section_end.h>
8294 
8295 #include <packed_section_start.h>
8296 typedef BWL_PRE_PACKED_STRUCT struct wlc_ipfo_route_tbl {
8297 	uint32 num_entry;
8298 	wlc_ipfo_route_entry_t route_entry[1];
8299 } BWL_POST_PACKED_STRUCT wlc_ipfo_route_tbl_t;
8300 #include <packed_section_end.h>
8301 
8302 /* Version of wlc_btc_stats_t structure.
8303  * Increment whenever a change is made to wlc_btc_stats_t
8304  */
8305 #define BTCX_STATS_VER_4 4
8306 typedef struct wlc_btc_stats_v4 {
8307 	uint16 version; /* version number of struct */
8308 	uint16 valid; /* Size of this struct */
8309 	uint32 stats_update_timestamp;	/* tStamp when data is updated. */
8310 	uint32 btc_status; /* Hybrid/TDM indicator: Bit2:Hybrid, Bit1:TDM,Bit0:CoexEnabled */
8311 	uint32 bt_req_type_map; /* BT Antenna Req types since last stats sample */
8312 	uint32 bt_req_cnt; /* #BT antenna requests since last stats sampl */
8313 	uint32 bt_gnt_cnt; /* #BT antenna grants since last stats sample */
8314 	uint32 bt_gnt_dur; /* usec BT owns antenna since last stats sample */
8315 	uint16 bt_abort_cnt; /* #Times WL was preempted due to BT since WL up */
8316 	uint16 bt_rxf1ovfl_cnt; /* #Time PSNULL retry count exceeded since WL up */
8317 	uint16 bt_latency_cnt; /* #Time ucode high latency detected since WL up */
8318 	uint16 bt_succ_pm_protect_cnt; /* successful PM protection */
8319 	uint16 bt_succ_cts_cnt; /* successful CTS2A protection */
8320 	uint16 bt_wlan_tx_preempt_cnt; /* WLAN TX Preemption */
8321 	uint16 bt_wlan_rx_preempt_cnt; /* WLAN RX Preemption */
8322 	uint16 bt_ap_tx_after_pm_cnt; /* AP TX even after PM protection */
8323 	uint16 bt_peraud_cumu_gnt_cnt; /* Grant cnt for periodic audio */
8324 	uint16 bt_peraud_cumu_deny_cnt; /* Deny cnt for periodic audio */
8325 	uint16 bt_a2dp_cumu_gnt_cnt; /* Grant cnt for A2DP */
8326 	uint16 bt_a2dp_cumu_deny_cnt; /* Deny cnt for A2DP */
8327 	uint16 bt_sniff_cumu_gnt_cnt; /* Grant cnt for Sniff */
8328 	uint16 bt_sniff_cumu_deny_cnt; /* Deny cnt for Sniff */
8329 	uint16 bt_dcsn_map; /* Accumulated decision bitmap once Ant grant */
8330 	uint16 bt_dcsn_cnt; /* Accumulated decision bitmap counters once Ant grant */
8331 	uint16 bt_a2dp_hiwat_cnt; /* Ant grant by a2dp high watermark */
8332 	uint16 bt_datadelay_cnt; /* Ant grant by acl/a2dp datadelay */
8333 	uint16 bt_crtpri_cnt; /* Ant grant by critical BT task */
8334 	uint16 bt_pri_cnt; /* Ant grant by high BT task */
8335 	uint16 a2dpbuf1cnt;	/* Ant request with a2dp buffercnt 1 */
8336 	uint16 a2dpbuf2cnt;	/* Ant request with a2dp buffercnt 2 */
8337 	uint16 a2dpbuf3cnt;	/* Ant request with a2dp buffercnt 3 */
8338 	uint16 a2dpbuf4cnt;	/* Ant request with a2dp buffercnt 4 */
8339 	uint16 a2dpbuf5cnt;	/* Ant request with a2dp buffercnt 5 */
8340 	uint16 a2dpbuf6cnt;	/* Ant request with a2dp buffercnt 6 */
8341 	uint16 a2dpbuf7cnt;	/* Ant request with a2dp buffercnt 7 */
8342 	uint16 a2dpbuf8cnt;	/* Ant request with a2dp buffercnt 8 */
8343 	uint16 antgrant_lt10ms; /* Ant grant duration cnt 0~10ms */
8344 	uint16 antgrant_lt30ms; /* Ant grant duration cnt 10~30ms */
8345 	uint16 antgrant_lt60ms; /* Ant grant duration cnt 30~60ms */
8346 	uint16 antgrant_ge60ms; /* Ant grant duration cnt 60~ms */
8347 } wlc_btc_stats_v4_t;
8348 
8349 #define BTCX_STATS_VER_3 3
8350 
8351 typedef struct wlc_btc_stats_v3 {
8352 	uint16 version; /* version number of struct */
8353 	uint16 valid; /* Size of this struct */
8354 	uint32 stats_update_timestamp;	/* tStamp when data is updated. */
8355 	uint32 btc_status; /* Hybrid/TDM indicator: Bit2:Hybrid, Bit1:TDM,Bit0:CoexEnabled */
8356 	uint32 bt_req_type_map; /* BT Antenna Req types since last stats sample */
8357 	uint32 bt_req_cnt; /* #BT antenna requests since last stats sampl */
8358 	uint32 bt_gnt_cnt; /* #BT antenna grants since last stats sample */
8359 	uint32 bt_gnt_dur; /* usec BT owns antenna since last stats sample */
8360 	uint16 bt_abort_cnt; /* #Times WL was preempted due to BT since WL up */
8361 	uint16 bt_rxf1ovfl_cnt; /* #Time PSNULL retry count exceeded since WL up */
8362 	uint16 bt_latency_cnt; /* #Time ucode high latency detected since WL up */
8363 	uint16 rsvd; /* pad to align struct to 32bit bndry	 */
8364 	uint16 bt_succ_pm_protect_cnt; /* successful PM protection */
8365 	uint16 bt_succ_cts_cnt; /* successful CTS2A protection */
8366 	uint16 bt_wlan_tx_preempt_cnt; /* WLAN TX Preemption */
8367 	uint16 bt_wlan_rx_preempt_cnt; /* WLAN RX Preemption */
8368 	uint16 bt_ap_tx_after_pm_cnt; /* AP TX even after PM protection */
8369 	uint16 bt_peraud_cumu_gnt_cnt; /* Grant cnt for periodic audio */
8370 	uint16 bt_peraud_cumu_deny_cnt; /* Deny cnt for periodic audio */
8371 	uint16 bt_a2dp_cumu_gnt_cnt; /* Grant cnt for A2DP */
8372 	uint16 bt_a2dp_cumu_deny_cnt; /* Deny cnt for A2DP */
8373 	uint16 bt_sniff_cumu_gnt_cnt; /* Grant cnt for Sniff */
8374 	uint16 bt_sniff_cumu_deny_cnt; /* Deny cnt for Sniff */
8375 	uint8 pad; /* Padding */
8376 	uint8 slice_index; /* Slice to report */
8377 } wlc_btc_stats_v3_t;
8378 
8379 #define BTCX_STATS_VER_2 2
8380 
8381 typedef struct wlc_btc_stats_v2 {
8382 	uint16 version; /* version number of struct */
8383 	uint16 valid; /* Size of this struct */
8384 	uint32 stats_update_timestamp;	/* tStamp when data is updated. */
8385 	uint32 btc_status; /* Hybrid/TDM indicator: Bit2:Hybrid, Bit1:TDM,Bit0:CoexEnabled */
8386 	uint32 bt_req_type_map; /* BT Antenna Req types since last stats sample */
8387 	uint32 bt_req_cnt; /* #BT antenna requests since last stats sampl */
8388 	uint32 bt_gnt_cnt; /* #BT antenna grants since last stats sample */
8389 	uint32 bt_gnt_dur; /* usec BT owns antenna since last stats sample */
8390 	uint16 bt_abort_cnt; /* #Times WL was preempted due to BT since WL up */
8391 	uint16 bt_rxf1ovfl_cnt; /* #Time PSNULL retry count exceeded since WL up */
8392 	uint16 bt_latency_cnt; /* #Time ucode high latency detected since WL up */
8393 	uint16 rsvd; /* pad to align struct to 32bit bndry	 */
8394 } wlc_btc_stats_v2_t;
8395 
8396 /* Durations for each bt task in millisecond */
8397 #define WL_BTCX_DURSTATS_VER_1 (1u)
8398 typedef struct wlc_btcx_durstats_v1 {
8399 	uint16 version;			/* version number of struct */
8400 	uint16 valid;			/* validity of this struct */
8401 	uint32 stats_update_timestamp;	/* tStamp when data is updated */
8402 	uint16 bt_acl_dur;		/* acl duration in ms */
8403 	uint16 bt_sco_dur;		/* sco duration in ms */
8404 	uint16 bt_esco_dur;		/* esco duration in ms */
8405 	uint16 bt_a2dp_dur;		/* a2dp duration in ms */
8406 	uint16 bt_sniff_dur;		/* sniff duration in ms */
8407 	uint16 bt_pscan_dur;		/* page scan duration in ms */
8408 	uint16 bt_iscan_dur;		/* inquiry scan duration in ms */
8409 	uint16 bt_page_dur;		/* paging duration in ms */
8410 	uint16 bt_inquiry_dur;		/* inquiry duration in ms */
8411 	uint16 bt_mss_dur;		/* mss duration in ms */
8412 	uint16 bt_park_dur;		/* park duration in ms */
8413 	uint16 bt_rssiscan_dur;		/* rssiscan duration in ms */
8414 	uint16 bt_iscan_sco_dur;	/* inquiry scan sco duration in ms */
8415 	uint16 bt_pscan_sco_dur;	/* page scan sco duration in ms */
8416 	uint16 bt_tpoll_dur;		/* tpoll duration in ms */
8417 	uint16 bt_sacq_dur;		/* sacq duration in ms */
8418 	uint16 bt_sdata_dur;		/* sdata duration in ms */
8419 	uint16 bt_rs_listen_dur;	/* rs listen duration in ms */
8420 	uint16 bt_rs_burst_dur;		/* rs brust duration in ms */
8421 	uint16 bt_ble_adv_dur;		/* ble adv duration in ms */
8422 	uint16 bt_ble_scan_dur;		/* ble scan duration in ms */
8423 	uint16 bt_ble_init_dur;		/* ble init duration in ms */
8424 	uint16 bt_ble_conn_dur;		/* ble connection duration in ms */
8425 	uint16 bt_task_lmp_dur;		/* lmp duration in ms */
8426 	uint16 bt_esco_retran_dur;	/* esco retransmission duration in ms */
8427 	uint16 bt_task26_dur;		/* task26 duration in ms */
8428 	uint16 bt_task27_dur;		/* task27 duration in ms */
8429 	uint16 bt_task28_dur;		/* task28 duration in ms */
8430 	uint16 bt_task_pred_dur;	/* prediction task duration in ms */
8431 	uint16 bt_multihid_dur;		/* multihid duration in ms */
8432 } wlc_btcx_durstats_v1_t;
8433 
8434 #define WL_IPFO_ROUTE_TBL_FIXED_LEN 4
8435 #define WL_MAX_IPFO_ROUTE_TBL_ENTRY	64
8436 
8437 	/* Global ASSERT Logging */
8438 #define ASSERTLOG_CUR_VER	0x0100
8439 #define MAX_ASSRTSTR_LEN	64
8440 
8441 	typedef struct assert_record {
8442 		uint32 time;
8443 		uint8 seq_num;
8444 		int8 str[MAX_ASSRTSTR_LEN];
8445 	} assert_record_t;
8446 
8447 	typedef struct assertlog_results {
8448 		uint16 version;
8449 		uint16 record_len;
8450 		uint32 num;
8451 		assert_record_t logs[1];
8452 	} assertlog_results_t;
8453 
8454 #define LOGRRC_FIX_LEN	8
8455 #define IOBUF_ALLOWED_NUM_OF_LOGREC(type, len) ((len - LOGRRC_FIX_LEN)/sizeof(type))
8456 /* BCMWAPI_WAI */
8457 #define IV_LEN 16
8458 	struct wapi_sta_msg_t
8459 	{
8460 		uint16	msg_type;
8461 		uint16	datalen;
8462 		uint8	vap_mac[6];
8463 		uint8	reserve_data1[2];
8464 		uint8	sta_mac[6];
8465 		uint8	reserve_data2[2];
8466 		uint8	gsn[IV_LEN];
8467 		uint8	wie[TLV_BODY_LEN_MAX + TLV_HDR_LEN]; /* 257 */
8468 		uint8	pad[3]; /* padding for alignment */
8469 	};
8470 /* #endif BCMWAPI_WAI */
8471 	/* chanim acs record */
8472 	typedef struct {
8473 		uint8 valid;
8474 		uint8 trigger;
8475 		chanspec_t selected_chspc;
8476 		int8 bgnoise;
8477 		uint32 glitch_cnt;
8478 		uint8 ccastats;
8479 		uint8 chan_idle;
8480 		uint32 timestamp;
8481 	} chanim_acs_record_t;
8482 
8483 	typedef struct {
8484 		chanim_acs_record_t acs_record[CHANIM_ACS_RECORD];
8485 		uint8 count;
8486 		uint32 timestamp;
8487 	} wl_acs_record_t;
8488 
8489 #define WL_CHANIM_STATS_V2 2
8490 #define CCASTATS_V2_MAX 9
8491 typedef struct chanim_stats_v2 {
8492 	uint32 glitchcnt;               /**< normalized as per second count */
8493 	uint32 badplcp;                 /**< normalized as per second count */
8494 	uint8 ccastats[CCASTATS_V2_MAX];   /**< normalized as 0-255 */
8495 	int8 bgnoise;                   /**< background noise level (in dBm) */
8496 	chanspec_t chanspec;            /**< ctrl chanspec of the interface */
8497 	uint32 timestamp;               /**< time stamp at which the stats are collected */
8498 	uint32 bphy_glitchcnt;          /**< normalized as per second count */
8499 	uint32 bphy_badplcp;            /**< normalized as per second count */
8500 	uint8 chan_idle;                /**< normalized as 0~255 */
8501 	uint8 PAD[3];
8502 } chanim_stats_v2_t;
8503 
8504 #define CCASTATS_V3_MAX 10
8505 typedef struct chanim_stats {
8506 	uint32 glitchcnt;               /**< normalized as per second count */
8507 	uint32 badplcp;                 /**< normalized as per second count */
8508 	uint8 ccastats[CCASTATS_V3_MAX];   /**< normalized as 0-255 */
8509 	int8 bgnoise;                   /**< background noise level (in dBm) */
8510 	uint8 pad_1[11 - CCASTATS_V3_MAX];
8511 	chanspec_t chanspec;            /**< ctrl chanspec of the interface */
8512 	uint8 pad_2[2];
8513 	uint32 timestamp;               /**< time stamp at which the stats are collected */
8514 	uint32 bphy_glitchcnt;          /**< normalized as per second count */
8515 	uint32 bphy_badplcp;            /**< normalized as per second count */
8516 	uint8 chan_idle;                /**< normalized as 0~255 */
8517 	uint8 PAD[3];
8518 } chanim_stats_t;
8519 
8520 #define WL_CHANIM_STATS_VERSION 3
8521 typedef struct {
8522 	uint32 buflen;
8523 	uint32 version;
8524 	uint32 count;
8525 	chanim_stats_t stats[1];
8526 } wl_chanim_stats_t;
8527 
8528 #define WL_CHANIM_STATS_FIXED_LEN OFFSETOF(wl_chanim_stats_t, stats)
8529 
8530 /** Noise measurement metrics. */
8531 #define NOISE_MEASURE_KNOISE	0x1
8532 
8533 /** scb probe parameter */
8534 typedef struct {
8535 	uint32 scb_timeout;
8536 	uint32 scb_activity_time;
8537 	uint32 scb_max_probe;
8538 } wl_scb_probe_t;
8539 
8540 /* structure/defines for selective mgmt frame (smf) stats support */
8541 
8542 #define SMFS_VERSION 1
8543 /** selected mgmt frame (smf) stats element */
8544 typedef struct wl_smfs_elem {
8545 	uint32 count;
8546 	uint16 code;  /**< SC or RC code */
8547 	uint8 PAD[2];
8548 } wl_smfs_elem_t;
8549 
8550 typedef struct wl_smf_stats {
8551 	uint32 version;
8552 	uint16 length;	/**< reserved for future usage */
8553 	uint8 type;
8554 	uint8 codetype;
8555 	uint32 ignored_cnt;
8556 	uint32 malformed_cnt;
8557 	uint32 count_total; /**< count included the interested group */
8558 	wl_smfs_elem_t elem[1];
8559 } wl_smf_stats_t;
8560 
8561 #define WL_SMFSTATS_FIXED_LEN OFFSETOF(wl_smf_stats_t, elem);
8562 
8563 enum {
8564 	SMFS_CODETYPE_SC,
8565 	SMFS_CODETYPE_RC
8566 };
8567 
8568 typedef enum smfs_type {
8569 	SMFS_TYPE_AUTH,
8570 	SMFS_TYPE_ASSOC,
8571 	SMFS_TYPE_REASSOC,
8572 	SMFS_TYPE_DISASSOC_TX,
8573 	SMFS_TYPE_DISASSOC_RX,
8574 	SMFS_TYPE_DEAUTH_TX,
8575 	SMFS_TYPE_DEAUTH_RX,
8576 	SMFS_TYPE_MAX
8577 } smfs_type_t;
8578 
8579 /* #ifdef PHYMON */
8580 
8581 #define PHYMON_VERSION 1
8582 
8583 typedef struct wl_phycal_core_state {
8584 	/* Tx IQ/LO calibration coeffs */
8585 	int16 tx_iqlocal_a;
8586 	int16 tx_iqlocal_b;
8587 	int8 tx_iqlocal_ci;
8588 	int8 tx_iqlocal_cq;
8589 	int8 tx_iqlocal_di;
8590 	int8 tx_iqlocal_dq;
8591 	int8 tx_iqlocal_ei;
8592 	int8 tx_iqlocal_eq;
8593 	int8 tx_iqlocal_fi;
8594 	int8 tx_iqlocal_fq;
8595 
8596 	/** Rx IQ calibration coeffs */
8597 	int16 rx_iqcal_a;
8598 	int16 rx_iqcal_b;
8599 
8600 	uint8 tx_iqlocal_pwridx; /**< Tx Power Index for Tx IQ/LO calibration */
8601 	uint8 PAD[3];
8602 	uint32 papd_epsilon_table[64]; /**< PAPD epsilon table */
8603 	int16 papd_epsilon_offset; /**< PAPD epsilon offset */
8604 	uint8 curr_tx_pwrindex; /**< Tx power index */
8605 	int8 idle_tssi; /**< Idle TSSI */
8606 	int8 est_tx_pwr; /**< Estimated Tx Power (dB) */
8607 	int8 est_rx_pwr; /**< Estimated Rx Power (dB) from RSSI */
8608 	uint16 rx_gaininfo; /**< Rx gain applied on last Rx pkt */
8609 	uint16 init_gaincode; /**< initgain required for ACI */
8610 	int8 estirr_tx;
8611 	int8 estirr_rx;
8612 } wl_phycal_core_state_t;
8613 
8614 typedef struct wl_phycal_state {
8615 	int32 version;
8616 	int8 num_phy_cores; /**< number of cores */
8617 	int8 curr_temperature; /**< on-chip temperature sensor reading */
8618 	chanspec_t chspec; /**< channspec for this state */
8619 	uint8 aci_state; /**< ACI state: ON/OFF */
8620 	uint8 PAD;
8621 	uint16 crsminpower; /**< crsminpower required for ACI */
8622 	uint16 crsminpowerl; /**< crsminpowerl required for ACI */
8623 	uint16 crsminpoweru; /**< crsminpoweru required for ACI */
8624 	wl_phycal_core_state_t phycal_core[1];
8625 } wl_phycal_state_t;
8626 
8627 #define WL_PHYCAL_STAT_FIXED_LEN OFFSETOF(wl_phycal_state_t, phycal_core)
8628 /* endif PHYMON */
8629 
8630 /** discovery state */
8631 typedef struct wl_p2p_disc_st {
8632 	uint8 state;	/**< see state */
8633 	uint8 PAD;
8634 	chanspec_t chspec;	/**< valid in listen state */
8635 	uint16 dwell;	/**< valid in listen state, in ms */
8636 } wl_p2p_disc_st_t;
8637 
8638 /** scan request */
8639 typedef struct wl_p2p_scan {
8640 	uint8 type;		/**< 'S' for WLC_SCAN, 'E' for "escan" */
8641 	uint8 reserved[3];
8642 	/* scan or escan parms... */
8643 } wl_p2p_scan_t;
8644 
8645 /** i/f request */
8646 typedef struct wl_p2p_if {
8647 	struct ether_addr addr;
8648 	uint8 type;	/**< see i/f type */
8649 	uint8 PAD;
8650 	chanspec_t chspec;	/**< for p2p_ifadd GO */
8651 } wl_p2p_if_t;
8652 
8653 /** i/f query */
8654 typedef struct wl_p2p_ifq {
8655 	uint32 bsscfgidx;
8656 	char ifname[BCM_MSG_IFNAME_MAX];
8657 } wl_p2p_ifq_t;
8658 
8659 /** OppPS & CTWindow */
8660 typedef struct wl_p2p_ops {
8661 	uint8 ops;	/**< 0: disable 1: enable */
8662 	uint8 ctw;	/**< >= 10 */
8663 } wl_p2p_ops_t;
8664 
8665 /** absence and presence request */
8666 typedef struct wl_p2p_sched_desc {
8667 	uint32 start;
8668 	uint32 interval;
8669 	uint32 duration;
8670 	uint32 count;	/**< see count */
8671 } wl_p2p_sched_desc_t;
8672 
8673 typedef struct wl_p2p_sched {
8674 	uint8 type;	/**< see schedule type */
8675 	uint8 action;	/**< see schedule action */
8676 	uint8 option;	/**< see schedule option */
8677 	uint8 PAD;
8678 	wl_p2p_sched_desc_t desc[1];
8679 } wl_p2p_sched_t;
8680 
8681 typedef struct wl_p2p_wfds_hash {
8682 	uint32	advt_id;
8683 	uint16	nw_cfg_method;
8684 	uint8	wfds_hash[6];
8685 	uint8	name_len;
8686 	uint8	service_name[MAX_WFDS_SVC_NAME_LEN];
8687 	uint8	PAD[3];
8688 } wl_p2p_wfds_hash_t;
8689 
8690 typedef struct wl_p2p_config_params {
8691 	uint16		enable;			/**< 0: disable 1: enable */
8692 	uint16		chanspec;		/* GO chanspec */
8693 	wlc_ssid_t	ssid;			/* SSID */
8694 } wl_p2p_config_params_t;
8695 
8696 typedef struct wl_bcmdcs_data {
8697 	uint32 reason;
8698 	chanspec_t chspec;
8699 	uint8	PAD[2];
8700 } wl_bcmdcs_data_t;
8701 /* ifdef EXT_STA */
8702 /**
8703  * Format of IHV data passed to OID_DOT11_NIC_SPECIFIC_EXTENSION.
8704  */
8705 typedef struct _IHV_NIC_SPECIFIC_EXTENSION {
8706 	uint8			oui[4];     /**< vendor specific OUI value */
8707 	uint32			event;      /**< event code */
8708 	uint8			ihvData[1];    /**< ihv data */
8709 } IHV_NIC_SPECIFIC_EXTENSION, *PIHV_NIC_SPECIFIC_EXTENSION;
8710 #define IHV_NIC_SPECIFIC_EXTENTION_HEADER	OFFSETOF(IHV_NIC_SPECIFIC_EXTENSION, ihvData[0])
8711 /* EXT_STA */
8712 /** NAT configuration */
8713 typedef struct {
8714 	uint32 ipaddr;		/**< interface ip address */
8715 	uint32 ipaddr_mask;	/**< interface ip address mask */
8716 	uint32 ipaddr_gateway;	/**< gateway ip address */
8717 	uint8 mac_gateway[6];	/**< gateway mac address */
8718 	uint8	PAD[2];
8719 	uint32 ipaddr_dns;	/**< DNS server ip address, valid only for public if */
8720 	uint8 mac_dns[6];	/**< DNS server mac address,  valid only for public if */
8721 	uint8 GUID[38];		/**< interface GUID */
8722 } nat_if_info_t;
8723 
8724 typedef struct {
8725 	uint32 op;		/**< operation code */
8726 	uint8 pub_if;		/**< set for public if, clear for private if */
8727 	uint8	PAD[3];
8728 	nat_if_info_t if_info;	/**< interface info */
8729 } nat_cfg_t;
8730 
8731 typedef struct {
8732 	int32 state;	/**< NAT state returned */
8733 } nat_state_t;
8734 
8735 typedef struct flush_txfifo {
8736 	uint32 txfifobmp;
8737 	uint32 hwtxfifoflush;
8738 	struct ether_addr ea;
8739 	uint8	PAD[2];
8740 } flush_txfifo_t;
8741 
8742 enum {
8743 	SPATIAL_MODE_2G_IDX = 0,
8744 	SPATIAL_MODE_5G_LOW_IDX,
8745 	SPATIAL_MODE_5G_MID_IDX,
8746 	SPATIAL_MODE_5G_HIGH_IDX,
8747 	SPATIAL_MODE_5G_UPPER_IDX,
8748 	SPATIAL_MODE_MAX_IDX
8749 };
8750 
8751 #define WLC_TXCORE_MAX		4	/**< max number of txcore supports */
8752 #define WLC_TXCORE_MAX_OLD	2	/**< backward compatibilty for TXCAL */
8753 #define WLC_SUBBAND_MAX		4	/**< max number of sub-band supports */
8754 typedef struct {
8755 	uint8	band2g[WLC_TXCORE_MAX];
8756 	uint8	band5g[WLC_SUBBAND_MAX][WLC_TXCORE_MAX];
8757 #ifdef TBAND
8758 	/* Temporary WAR. SWWLAN-140646 */
8759 	uint8	band6g[WLC_SUBBAND_MAX][WLC_TXCORE_MAX];
8760 #endif /* TBAND */
8761 } sar_limit_t;
8762 
8763 #define MAX_NUM_TXCAL_MEAS 128
8764 #define MAX_NUM_PWR_STEP 40
8765 #define TXCAL_IOVAR_VERSION	0x1
8766 
8767 #define TXCAL_GAINSWEEP_VER (TXCAL_GAINSWEEP_VERSION_V2)
8768 #define TXCAL_GAINSWEEP_VERSION_V2 2
8769 
8770 /* Below macro defines the latest txcal iovar version updated */
8771 /* This macro also reflects in the 'txcal_ver' iovar */
8772 #define TXCAL_IOVAR_LATEST TXCAL_GAINSWEEP_VER
8773 
8774 /* below are used for bphy/ofdm separated LSC */
8775 #define TXCAL_PWR_BPHY    0
8776 #define TXCAL_PWR_OFDM    1
8777 
8778 typedef struct wl_txcal_meas_percore {
8779 	uint16 tssi[MAX_NUM_TXCAL_MEAS];
8780 	int16 pwr[MAX_NUM_TXCAL_MEAS];
8781 } wl_txcal_meas_percore_t;
8782 
8783 typedef struct wl_txcal_meas_ncore {
8784 	uint16 version;
8785 	uint8 valid_cnt;
8786 	uint8 num_core;
8787 	wl_txcal_meas_percore_t txcal_percore[1];
8788 } wl_txcal_meas_ncore_t;
8789 
8790 typedef struct wl_txcal_power_tssi_percore {
8791 	int16 tempsense;
8792 	int16 pwr_start;
8793 	uint8 pwr_start_idx;
8794 	uint8 num_entries;
8795 	uint16 pad;
8796 	uint8 tssi[MAX_NUM_PWR_STEP];
8797 } wl_txcal_power_tssi_percore_t;
8798 
8799 typedef struct wl_txcal_power_tssi_ncore {
8800 	uint16 version;
8801 	uint8 set_core;
8802 	uint8 channel;
8803 	uint8 num_core;
8804 	uint8 gen_tbl;
8805 	uint8 ofdm;
8806 	uint8 pad;
8807 	wl_txcal_power_tssi_percore_t tssi_percore[4];
8808 } wl_txcal_power_tssi_ncore_t;
8809 
8810 typedef struct wl_txcal_meas {
8811 	uint16 tssi[WLC_TXCORE_MAX][MAX_NUM_TXCAL_MEAS];
8812 	int16 pwr[WLC_TXCORE_MAX][MAX_NUM_TXCAL_MEAS];
8813 	uint8 valid_cnt;
8814 	uint8 PAD;
8815 } wl_txcal_meas_t;
8816 
8817 typedef struct wl_txcal_meas_old {
8818 	uint16 tssi[WLC_TXCORE_MAX_OLD][MAX_NUM_TXCAL_MEAS];
8819 	int16 pwr[WLC_TXCORE_MAX_OLD][MAX_NUM_TXCAL_MEAS];
8820 	uint8 valid_cnt;
8821 	uint8 PAD;
8822 } wl_txcal_meas_old_t;
8823 
8824 typedef struct wl_txcal_power_tssi {
8825 	uint8 set_core;
8826 	uint8 channel;
8827 	int16 tempsense[WLC_TXCORE_MAX];
8828 	int16 pwr_start[WLC_TXCORE_MAX];
8829 	uint8 pwr_start_idx[WLC_TXCORE_MAX];
8830 	uint8 num_entries[WLC_TXCORE_MAX];
8831 	uint8 tssi[WLC_TXCORE_MAX][MAX_NUM_PWR_STEP];
8832 	uint8 gen_tbl;
8833 	uint8 ofdm;
8834 } wl_txcal_power_tssi_t;
8835 
8836 typedef struct wl_txcal_power_tssi_old {
8837 	uint8 set_core;
8838 	uint8 channel;
8839 	int16 tempsense[WLC_TXCORE_MAX_OLD];
8840 	int16 pwr_start[WLC_TXCORE_MAX_OLD];
8841 	uint8 pwr_start_idx[WLC_TXCORE_MAX_OLD];
8842 	uint8 num_entries[WLC_TXCORE_MAX_OLD];
8843 	uint8 tssi[WLC_TXCORE_MAX_OLD][MAX_NUM_PWR_STEP];
8844 	uint8 gen_tbl;
8845 	uint8 ofdm;
8846 } wl_txcal_power_tssi_old_t;
8847 
8848 typedef struct wl_olpc_pwr {
8849 	uint16 version;
8850 	uint8 core;
8851 	uint8 channel;
8852 	int16 tempsense;
8853 	uint8 olpc_idx;
8854 	uint8 ofdm;
8855 } wl_olpc_pwr_t;
8856 
8857 typedef struct wl_rfem_temp_vdet_temp {
8858 	uint8	vdet_fem_t1;
8859 	int8	rfem_temp_t1;
8860 	uint8	vdet_fem_t2;
8861 	int8	rfem_temp_t2;
8862 } wl_rfem_temp_vdet_temp_t;
8863 
8864 typedef struct wl_rfem_temp_vin_tssi {
8865 	uint16	vin_chip_v1;
8866 	int16	tssi_chip_v1;
8867 	uint16	vin_chip_v2;
8868 	int16	tssi_chip_v2;
8869 } wl_rfem_temp_vin_tssi_t;
8870 
8871 typedef struct wl_txcal_tempsense {
8872 	uint16 version;
8873 	uint8 valid_cnt;
8874 	uint8 core;
8875 	int16 ref_temperature;
8876 	int16 meas_temperature;
8877 	wl_rfem_temp_vdet_temp_t vdet_temp;
8878 	wl_rfem_temp_vin_tssi_t vin_tssi;
8879 } wl_txcal_tempsense_t;
8880 
8881 /** IOVAR "mempool" parameter. Used to retrieve a list of memory pool statistics. */
8882 typedef struct wl_mempool_stats {
8883 	int32 num;		/**< Number of memory pools */
8884 	bcm_mp_stats_t s[1];	/**< Variable array of memory pool stats. */
8885 } wl_mempool_stats_t;
8886 
8887 typedef struct {
8888 	uint32 ipaddr;
8889 	uint32 ipaddr_netmask;
8890 	uint32 ipaddr_gateway;
8891 } nwoe_ifconfig_t;
8892 
8893 /** Traffic management priority classes */
8894 typedef enum trf_mgmt_priority_class {
8895 	trf_mgmt_priority_low           = 0,        /**< Maps to 802.1p BK */
8896 	trf_mgmt_priority_medium        = 1,        /**< Maps to 802.1p BE */
8897 	trf_mgmt_priority_high          = 2,        /**< Maps to 802.1p VI */
8898 	trf_mgmt_priority_nochange	= 3,	    /**< do not update the priority */
8899 	trf_mgmt_priority_invalid       = (trf_mgmt_priority_nochange + 1)
8900 } trf_mgmt_priority_class_t;
8901 
8902 /** Traffic management configuration parameters */
8903 typedef struct trf_mgmt_config {
8904 	uint32  trf_mgmt_enabled;                           /**< 0 - disabled, 1 - enabled */
8905 	uint32  flags;                                      /**< See TRF_MGMT_FLAG_xxx defines */
8906 	uint32  host_ip_addr;                              /**< My IP address to determine subnet */
8907 	uint32  host_subnet_mask;                           /**< My subnet mask */
8908 	uint32  downlink_bandwidth;                         /**< In units of kbps */
8909 	uint32  uplink_bandwidth;                           /**< In units of kbps */
8910 	uint32  min_tx_bandwidth[TRF_MGMT_MAX_PRIORITIES];  /**< Minimum guaranteed tx bandwidth */
8911 	uint32  min_rx_bandwidth[TRF_MGMT_MAX_PRIORITIES];  /**< Minimum guaranteed rx bandwidth */
8912 } trf_mgmt_config_t;
8913 
8914 /** Traffic management filter */
8915 typedef struct trf_mgmt_filter {
8916 	struct ether_addr           dst_ether_addr;         /**< His L2 address */
8917 	uint8						PAD[2];
8918 	uint32                      dst_ip_addr;            /**< His IP address */
8919 	uint16                      dst_port;               /**< His L4 port */
8920 	uint16                      src_port;               /**< My L4 port */
8921 	uint16                      prot;                   /**< L4 protocol (only TCP or UDP) */
8922 	uint16                      flags;                  /**< TBD. For now, this must be zero. */
8923 	trf_mgmt_priority_class_t   priority;               /**< Priority for filtered packets */
8924 	uint32                      dscp;                   /**< DSCP */
8925 } trf_mgmt_filter_t;
8926 
8927 /** Traffic management filter list (variable length) */
8928 typedef struct trf_mgmt_filter_list     {
8929 	uint32              num_filters;
8930 	trf_mgmt_filter_t   filter[1];
8931 } trf_mgmt_filter_list_t;
8932 
8933 /** Traffic management global info used for all queues */
8934 typedef struct trf_mgmt_global_info {
8935 	uint32  maximum_bytes_per_second;
8936 	uint32  maximum_bytes_per_sampling_period;
8937 	uint32  total_bytes_consumed_per_second;
8938 	uint32  total_bytes_consumed_per_sampling_period;
8939 	uint32  total_unused_bytes_per_sampling_period;
8940 } trf_mgmt_global_info_t;
8941 
8942 /** Traffic management shaping info per priority queue */
8943 typedef struct trf_mgmt_shaping_info {
8944 	uint32  gauranteed_bandwidth_percentage;
8945 	uint32  guaranteed_bytes_per_second;
8946 	uint32  guaranteed_bytes_per_sampling_period;
8947 	uint32  num_bytes_produced_per_second;
8948 	uint32  num_bytes_consumed_per_second;
8949 	uint32  num_queued_packets;                         /**< Number of packets in queue */
8950 	uint32  num_queued_bytes;                           /**< Number of bytes in queue */
8951 } trf_mgmt_shaping_info_t;
8952 
8953 /** Traffic management shaping info array */
8954 typedef struct trf_mgmt_shaping_info_array {
8955 	trf_mgmt_global_info_t   tx_global_shaping_info;
8956 	trf_mgmt_shaping_info_t  tx_queue_shaping_info[TRF_MGMT_MAX_PRIORITIES];
8957 	trf_mgmt_global_info_t   rx_global_shaping_info;
8958 	trf_mgmt_shaping_info_t  rx_queue_shaping_info[TRF_MGMT_MAX_PRIORITIES];
8959 } trf_mgmt_shaping_info_array_t;
8960 
8961 /** Traffic management statistical counters */
8962 typedef struct trf_mgmt_stats {
8963 	uint32  num_processed_packets;      /**< Number of packets processed */
8964 	uint32  num_processed_bytes;        /**< Number of bytes processed */
8965 	uint32  num_discarded_packets;      /**< Number of packets discarded from queue */
8966 } trf_mgmt_stats_t;
8967 
8968 /** Traffic management statistics array */
8969 typedef struct trf_mgmt_stats_array {
8970 	trf_mgmt_stats_t  tx_queue_stats[TRF_MGMT_MAX_PRIORITIES];
8971 	trf_mgmt_stats_t  rx_queue_stats[TRF_MGMT_MAX_PRIORITIES];
8972 } trf_mgmt_stats_array_t;
8973 
8974 /* Both powersel_params and lpc_params are used by IOVAR lpc_params.
8975  * The powersel_params is replaced by lpc_params in later WLC versions.
8976  */
8977 typedef struct powersel_params {
8978 	/* LPC Params exposed via IOVAR */
8979 	int32		tp_ratio_thresh;  /**< Throughput ratio threshold */
8980 	uint8		rate_stab_thresh; /**< Thresh for rate stability based on nupd */
8981 	uint8		pwr_stab_thresh; /**< Number of successes before power step down */
8982 	uint8		pwr_sel_exp_time; /**< Time lapse for expiry of database */
8983 	uint8		PAD;
8984 } powersel_params_t;
8985 
8986 #define WL_LPC_PARAMS_VER_2	2
8987 #define WL_LPC_PARAMS_CURRENT_VERSION WL_LPC_PARAMS_VER_2
8988 
8989 typedef struct lpc_params {
8990 	uint16		version;
8991 	uint16		length;
8992 	/* LPC Params exposed via IOVAR */
8993 	uint8		rate_stab_thresh; /**< Thresh for rate stability based on nupd */
8994 	uint8		pwr_stab_thresh; /**< Number of successes before power step down */
8995 	uint8		lpc_exp_time; /**< Time lapse for expiry of database */
8996 	uint8		pwrup_slow_step; /**< Step size for slow step up */
8997 	uint8		pwrup_fast_step; /**< Step size for fast step up */
8998 	uint8		pwrdn_slow_step; /**< Step size for slow step down */
8999 } lpc_params_t;
9000 
9001 /* tx pkt delay statistics */
9002 #define	SCB_RETRY_SHORT_DEF	7	/**< Default Short retry Limit */
9003 #define WLPKTDLY_HIST_NBINS	16	/**< number of bins used in the Delay histogram */
9004 
9005 /** structure to store per-AC delay statistics */
9006 typedef struct scb_delay_stats {
9007 	uint32 txmpdu_lost;	/**< number of MPDUs lost */
9008 	uint32 txmpdu_cnt[SCB_RETRY_SHORT_DEF]; /**< retry times histogram */
9009 	uint32 delay_sum[SCB_RETRY_SHORT_DEF]; /**< cumulative packet latency */
9010 	uint32 delay_min;	/**< minimum packet latency observed */
9011 	uint32 delay_max;	/**< maximum packet latency observed */
9012 	uint32 delay_avg;	/**< packet latency average */
9013 	uint32 delay_hist[WLPKTDLY_HIST_NBINS];	/**< delay histogram */
9014 	uint32 delay_count;	/**< minimum number of time period units before
9015 				consequent packet delay events can be generated
9016 				*/
9017 	uint32 prev_txmpdu_cnt;	/**< Previous value of txmpdu_cnt[] during last iteration */
9018 	uint32 prev_delay_sum;	/**< Previous value of delay_sum[] during last iteration */
9019 } scb_delay_stats_t;
9020 
9021 /** structure for txdelay event */
9022 typedef struct txdelay_event {
9023 	uint8				status;
9024 	uint8				PAD[3];
9025 	int32				rssi;
9026 	chanim_stats_t		chanim_stats;
9027 	scb_delay_stats_t	delay_stats[AC_COUNT];
9028 } txdelay_event_t;
9029 
9030 /** structure for txdelay parameters */
9031 typedef struct txdelay_params {
9032 	uint16	ratio;	/**< Avg Txdelay Delta */
9033 	uint8	cnt;	/**< Sample cnt */
9034 	uint8	period;	/**< Sample period */
9035 	uint8	tune;	/**< Debug */
9036 	uint8	PAD;
9037 } txdelay_params_t;
9038 #define MAX_TXDELAY_STATS_SCBS 6
9039 #define TXDELAY_STATS_VERSION 1
9040 
9041 enum {
9042 	TXDELAY_STATS_PARTIAL_RESULT = 0,
9043 	TXDELAY_STATS_FULL_RESULT = 1
9044 };
9045 
9046 typedef struct scb_total_delay_stats {
9047 	struct  ether_addr ea;
9048 	uint8   pad[2];
9049 	scb_delay_stats_t dlystats[AC_COUNT];
9050 } scb_total_delay_stats_t;
9051 
9052 typedef struct txdelay_stats {
9053 	uint32  version;
9054 	uint32  full_result;    /* 0:Partial, 1:full */
9055 	uint32  scb_cnt;        /* in:requested, out:returned */
9056 	scb_total_delay_stats_t scb_delay_stats[1];
9057 } txdelay_stats_t;
9058 
9059 #define WL_TXDELAY_STATS_FIXED_SIZE \
9060 	(sizeof(txdelay_stats_t)+(MAX_TXDELAY_STATS_SCBS-1)*sizeof(scb_total_delay_stats_t))
9061 enum {
9062 	WNM_SERVICE_DMS = 1,
9063 	WNM_SERVICE_FMS = 2,
9064 	WNM_SERVICE_TFS = 3
9065 };
9066 
9067 /** Definitions for WNM/NPS TCLAS */
9068 typedef struct wl_tclas {
9069 	uint8 user_priority;
9070 	uint8 fc_len;
9071 	dot11_tclas_fc_t fc;
9072 } wl_tclas_t;
9073 
9074 #define WL_TCLAS_FIXED_SIZE	OFFSETOF(wl_tclas_t, fc)
9075 
9076 typedef struct wl_tclas_list {
9077 	uint32 num;
9078 	wl_tclas_t tclas[];
9079 } wl_tclas_list_t;
9080 
9081 /** Definitions for WNM/NPS Traffic Filter Service */
9082 typedef struct wl_tfs_req {
9083 	uint8 tfs_id;
9084 	uint8 tfs_actcode;
9085 	uint8 tfs_subelem_id;
9086 	uint8 send;
9087 } wl_tfs_req_t;
9088 
9089 typedef struct wl_tfs_filter {
9090 	uint8 status;			/**< Status returned by the AP */
9091 	uint8 tclas_proc;		/**< TCLAS processing value (0:and, 1:or)  */
9092 	uint8 tclas_cnt;		/**< count of all wl_tclas_t in tclas array */
9093 	uint8 tclas[1];			/**< VLA of wl_tclas_t */
9094 } wl_tfs_filter_t;
9095 #define WL_TFS_FILTER_FIXED_SIZE	OFFSETOF(wl_tfs_filter_t, tclas)
9096 
9097 typedef struct wl_tfs_fset {
9098 	struct ether_addr ea;		/**< Address of AP/STA involved with this filter set */
9099 	uint8 tfs_id;			/**< TFS ID field chosen by STA host */
9100 	uint8 status;			/**< Internal status TFS_STATUS_xxx */
9101 	uint8 actcode;			/**< Action code DOT11_TFS_ACTCODE_xxx */
9102 	uint8 token;			/**< Token used in last request frame */
9103 	uint8 notify;			/**< Notify frame sent/received because of this set */
9104 	uint8 filter_cnt;		/**< count of all wl_tfs_filter_t in filter array */
9105 	uint8 filter[1];		/**< VLA of wl_tfs_filter_t */
9106 } wl_tfs_fset_t;
9107 #define WL_TFS_FSET_FIXED_SIZE		OFFSETOF(wl_tfs_fset_t, filter)
9108 
9109 enum {
9110 	TFS_STATUS_DISABLED = 0,	/**< TFS filter set disabled by user */
9111 	TFS_STATUS_DISABLING = 1,	/**< Empty request just sent to AP */
9112 	TFS_STATUS_VALIDATED = 2,	/**< Filter set validated by AP (but maybe not enabled!) */
9113 	TFS_STATUS_VALIDATING = 3,	/**< Filter set just sent to AP */
9114 	TFS_STATUS_NOT_ASSOC = 4,	/**< STA not associated */
9115 	TFS_STATUS_NOT_SUPPORT = 5,	/**< TFS not supported by AP */
9116 	TFS_STATUS_DENIED = 6,		/**< Filter set refused by AP (=> all sets are disabled!) */
9117 };
9118 
9119 typedef struct wl_tfs_status {
9120 	uint8 fset_cnt;			/**< count of all wl_tfs_fset_t in fset array */
9121 	wl_tfs_fset_t fset[1];		/**< VLA of wl_tfs_fset_t */
9122 } wl_tfs_status_t;
9123 
9124 typedef struct wl_tfs_set {
9125 	uint8 send;		/**< Immediatly register registered sets on AP side */
9126 	uint8 tfs_id;		/**< ID of a specific set (existing or new), or nul for all */
9127 	uint8 actcode;		/**< Action code for this filter set */
9128 	uint8 tclas_proc;	/**< TCLAS processing operator for this filter set */
9129 } wl_tfs_set_t;
9130 
9131 typedef struct wl_tfs_term {
9132 	uint8 del;			/**< Delete internal set once confirmation received */
9133 	uint8 tfs_id;			/**< ID of a specific set (existing), or nul for all */
9134 } wl_tfs_term_t;
9135 
9136 #define DMS_DEP_PROXY_ARP (1 << 0)
9137 
9138 /* Definitions for WNM/NPS Directed Multicast Service */
9139 enum {
9140 	DMS_STATUS_DISABLED = 0,	/**< DMS desc disabled by user */
9141 	DMS_STATUS_ACCEPTED = 1,	/**< Request accepted by AP */
9142 	DMS_STATUS_NOT_ASSOC = 2,	/**< STA not associated */
9143 	DMS_STATUS_NOT_SUPPORT = 3,	/**< DMS not supported by AP */
9144 	DMS_STATUS_DENIED = 4,		/**< Request denied by AP */
9145 	DMS_STATUS_TERM = 5,		/**< Request terminated by AP */
9146 	DMS_STATUS_REMOVING = 6,	/**< Remove request just sent */
9147 	DMS_STATUS_ADDING = 7,		/**< Add request just sent */
9148 	DMS_STATUS_ERROR = 8,		/**< Non compliant AP behvior */
9149 	DMS_STATUS_IN_PROGRESS = 9,	/**< Request just sent */
9150 	DMS_STATUS_REQ_MISMATCH = 10	/**< Conditions for sending DMS req not met */
9151 };
9152 
9153 typedef struct wl_dms_desc {
9154 	uint8 user_id;
9155 	uint8 status;
9156 	uint8 token;
9157 	uint8 dms_id;
9158 	uint8 tclas_proc;
9159 	uint8 mac_len;		/**< length of all ether_addr in data array, 0 if STA */
9160 	uint8 tclas_len;	/**< length of all wl_tclas_t in data array */
9161 	uint8 data[1];		/**< VLA of 'ether_addr' and 'wl_tclas_t' (in this order ) */
9162 } wl_dms_desc_t;
9163 
9164 #define WL_DMS_DESC_FIXED_SIZE	OFFSETOF(wl_dms_desc_t, data)
9165 
9166 typedef struct wl_dms_status {
9167 	uint32 cnt;
9168 	wl_dms_desc_t desc[1];
9169 } wl_dms_status_t;
9170 
9171 typedef struct wl_dms_set {
9172 	uint8 send;
9173 	uint8 user_id;
9174 	uint8 tclas_proc;
9175 } wl_dms_set_t;
9176 
9177 typedef struct wl_dms_term {
9178 	uint8 del;
9179 	uint8 user_id;
9180 } wl_dms_term_t;
9181 
9182 typedef struct wl_service_term {
9183 	uint8 service;
9184 	union {
9185 		wl_dms_term_t dms;
9186 	} u;
9187 } wl_service_term_t;
9188 
9189 /** Definitions for WNM/NPS BSS Transistion */
9190 #define WL_BSSTRANS_QUERY_VERSION_1 1
9191 typedef struct wl_bsstrans_query {
9192 	uint16 version;   /* structure  version */
9193 	uint16 pad0;  /* padding for 4-byte allignment */
9194 	wlc_ssid_t ssid; /* SSID of NBR elem to be queried for */
9195 	uint8 reason; /* Reason code of the BTQ */
9196 	uint8 pad1[3];  /* padding for 4-byte allignment */
9197 } wl_bsstrans_query_t;
9198 
9199 #define BTM_QUERY_NBR_COUNT_MAX 16
9200 
9201 #define WL_BTQ_NBR_LIST_VERSION_1 1
9202 typedef struct wl_btq_nbr_list {
9203 	uint16 version;   /* structure  version */
9204 	uint8 count; /* No. of BTQ NBRs returned */
9205 	uint8 pad;  /* padding for 4-byte allignment */
9206 	nbr_rpt_elem_t btq_nbt_elem[]; /* BTQ NBR elem in a BTQ NBR list */
9207 } wl_btq_nbr_list_t;
9208 
9209 typedef struct wl_bsstrans_req {
9210 	uint16 tbtt;			/**< time of BSS to end of life, in unit of TBTT */
9211 	uint16 dur;			/**< time of BSS to keep off, in unit of minute */
9212 	uint8 reqmode;			/**< request mode of BSS transition request */
9213 	uint8 unicast;			/**< request by unicast or by broadcast */
9214 } wl_bsstrans_req_t;
9215 
9216 typedef struct wl_bsstrans_req_v2 {
9217 	wl_bsstrans_req_t v1;
9218 	int16 reason;				/**< Transition reason code, -1: no reason code */
9219 	uint16 assoc_delay;		/**< Association retry delay, 0: means no delay */
9220 } wl_bsstrans_req_v2_t;
9221 
9222 #define WL_BTM_REQ_NO_REASON_CODE -1
9223 #define WL_BTM_REQ_NO_ASSOC_RETRY_DELAY 0
9224 
9225 enum {
9226 	BSSTRANS_RESP_AUTO = 0,		/**< Currently equivalent to ENABLE */
9227 	BSSTRANS_RESP_DISABLE = 1,	/**< Never answer BSS Trans Req frames */
9228 	BSSTRANS_RESP_ENABLE = 2,	/**< Always answer Req frames with preset data */
9229 	BSSTRANS_RESP_WAIT = 3,		/**< Send ind, wait and/or send preset data (NOT IMPL) */
9230 	BSSTRANS_RESP_IMMEDIATE = 4	/**< After an ind, set data and send resp (NOT IMPL) */
9231 };
9232 
9233 typedef struct wl_bsstrans_resp {
9234 	uint8 policy;
9235 	uint8 status;
9236 	uint8 delay;
9237 	struct ether_addr target;
9238 } wl_bsstrans_resp_t;
9239 
9240 /* "wnm_bsstrans_policy" argument programs behavior after BSSTRANS Req reception.
9241  * BSS-Transition feature is used by multiple programs such as NPS-PF, VE-PF,
9242  * Band-steering, Hotspot 2.0 and customer requirements. Each PF and its test plan
9243  * mandates different behavior on receiving BSS-transition request. To accomodate
9244  * such divergent behaviors these policies have been created.
9245  */
9246 typedef enum {
9247 	WL_BSSTRANS_POLICY_ROAM_ALWAYS = 0,	/**< Roam (or disassociate) in all cases */
9248 	WL_BSSTRANS_POLICY_ROAM_IF_MODE = 1,	/**< Roam only if requested by Request Mode field */
9249 	WL_BSSTRANS_POLICY_ROAM_IF_PREF = 2,	/**< Roam only if Preferred BSS provided */
9250 	WL_BSSTRANS_POLICY_WAIT = 3,		/**< Wait for deauth and send Accepted status */
9251 	WL_BSSTRANS_POLICY_PRODUCT = 4,	/**< Policy for real product use cases (Olympic) */
9252 	WL_BSSTRANS_POLICY_PRODUCT_WBTEXT = 5,	/**< Policy for real product use cases (SS) */
9253 	WL_BSSTRANS_POLICY_MBO = 6,   /**< Policy for MBO certification */
9254 	WL_BSSTRANS_POLICY_MAX = 7
9255 } wnm_bsstrans_policy_type_t;
9256 
9257 /** Definitions for WNM/NPS TIM Broadcast */
9258 typedef struct wl_timbc_offset {
9259 	int16 offset;		/**< offset in us */
9260 	uint16 fix_intv;	/**< override interval sent from STA */
9261 	uint16 rate_override;	/**< use rate override to send high rate TIM broadcast frame */
9262 	uint8 tsf_present;	/**< show timestamp in TIM broadcast frame */
9263 	uint8 PAD;
9264 } wl_timbc_offset_t;
9265 
9266 typedef struct wl_timbc_set {
9267 	uint8 interval;		/**< Interval in DTIM wished or required. */
9268 	uint8 flags;		/**< Bitfield described below */
9269 	uint16 rate_min;	/**< Minimum rate required for High/Low TIM frames. Optionnal */
9270 	uint16 rate_max;	/**< Maximum rate required for High/Low TIM frames. Optionnal */
9271 } wl_timbc_set_t;
9272 
9273 enum {
9274 	WL_TIMBC_SET_TSF_REQUIRED = 1,	/**< Enable TIMBC only if TSF in TIM frames */
9275 	WL_TIMBC_SET_NO_OVERRIDE = 2,	/**< ... if AP does not override interval */
9276 	WL_TIMBC_SET_PROXY_ARP = 4,	/**< ... if AP support Proxy ARP */
9277 	WL_TIMBC_SET_DMS_ACCEPTED = 8	/**< ... if all DMS desc have been accepted */
9278 };
9279 
9280 typedef struct wl_timbc_status {
9281 	uint8 status_sta;		/**< Status from internal state machine (check below) */
9282 	uint8 status_ap;		/**< From AP response frame (check 8.4.2.86 from 802.11) */
9283 	uint8 interval;
9284 	uint8 pad;
9285 	int32 offset;
9286 	uint16 rate_high;
9287 	uint16 rate_low;
9288 } wl_timbc_status_t;
9289 
9290 enum {
9291 	WL_TIMBC_STATUS_DISABLE = 0,		/**< TIMBC disabled by user */
9292 	WL_TIMBC_STATUS_REQ_MISMATCH = 1,	/**< AP settings do no match user requirements */
9293 	WL_TIMBC_STATUS_NOT_ASSOC = 2,		/**< STA not associated */
9294 	WL_TIMBC_STATUS_NOT_SUPPORT = 3,	/**< TIMBC not supported by AP */
9295 	WL_TIMBC_STATUS_DENIED = 4,		/**< Req to disable TIMBC sent to AP */
9296 	WL_TIMBC_STATUS_ENABLE = 5		/**< TIMBC enabled */
9297 };
9298 
9299 /** Definitions for PM2 Dynamic Fast Return To Sleep */
9300 typedef struct wl_pm2_sleep_ret_ext {
9301 	uint8  logic;			/**< DFRTS logic: see WL_DFRTS_LOGIC_* below */
9302 	uint8  PAD;
9303 	uint16 low_ms;			/**< Low FRTS timeout */
9304 	uint16 high_ms;			/**< High FRTS timeout */
9305 	uint16 rx_pkts_threshold;	/**< switching threshold: # rx pkts */
9306 	uint16 tx_pkts_threshold;	/**< switching threshold: # tx pkts */
9307 	uint16 txrx_pkts_threshold;	/**< switching threshold: # (tx+rx) pkts */
9308 	uint32 rx_bytes_threshold;	/**< switching threshold: # rx bytes */
9309 	uint32 tx_bytes_threshold;	/**< switching threshold: # tx bytes */
9310 	uint32 txrx_bytes_threshold;	/**< switching threshold: # (tx+rx) bytes */
9311 } wl_pm2_sleep_ret_ext_t;
9312 
9313 #define WL_DFRTS_LOGIC_OFF	0	/**< Feature is disabled */
9314 #define WL_DFRTS_LOGIC_OR	1	/**< OR all non-zero threshold conditions */
9315 #define WL_DFRTS_LOGIC_AND	2	/**< AND all non-zero threshold conditions */
9316 
9317 /* Values for the passive_on_restricted_mode iovar.  When set to non-zero, this iovar
9318  * disables automatic conversions of a channel from passively scanned to
9319  * actively scanned.  These values only have an effect for country codes such
9320  * as XZ where some 5 GHz channels are defined to be passively scanned.
9321  */
9322 #define WL_PASSACTCONV_DISABLE_NONE	0	/**< Enable permanent and temporary conversions */
9323 #define WL_PASSACTCONV_DISABLE_ALL	1	/**< Disable permanent and temporary conversions */
9324 #define WL_PASSACTCONV_DISABLE_PERM	2	/**< Disable only permanent conversions */
9325 
9326 /* Definitions for Reliable Multicast */
9327 #define WL_RMC_CNT_VERSION	   1
9328 #define WL_RMC_TR_VERSION	   1
9329 #define WL_RMC_MAX_CLIENT	   32
9330 #define WL_RMC_FLAG_INBLACKLIST	   1
9331 #define WL_RMC_FLAG_ACTIVEACKER	   2
9332 #define WL_RMC_FLAG_RELMCAST	   4
9333 #define WL_RMC_MAX_TABLE_ENTRY     4
9334 
9335 #define WL_RMC_VER		   1
9336 #define WL_RMC_INDEX_ACK_ALL       255
9337 #define WL_RMC_NUM_OF_MC_STREAMS   4
9338 #define WL_RMC_MAX_TRS_PER_GROUP   1
9339 #define WL_RMC_MAX_TRS_IN_ACKALL   1
9340 #define WL_RMC_ACK_MCAST0          0x02
9341 #define WL_RMC_ACK_MCAST_ALL       0x01
9342 #define WL_RMC_ACTF_TIME_MIN       300		/**< time in ms */
9343 #define WL_RMC_ACTF_TIME_MAX       20000	/**< time in ms */
9344 #define WL_RMC_MAX_NUM_TRS	   32		/**< maximun transmitters allowed */
9345 #define WL_RMC_ARTMO_MIN           350		/**< time in ms */
9346 #define WL_RMC_ARTMO_MAX           40000	/**< time in ms */
9347 
9348 /* RMC events in action frames */
9349 enum rmc_opcodes {
9350 	RELMCAST_ENTRY_OP_DISABLE = 0,   /**< Disable multi-cast group */
9351 	RELMCAST_ENTRY_OP_DELETE  = 1,   /**< Delete multi-cast group */
9352 	RELMCAST_ENTRY_OP_ENABLE  = 2,   /**< Enable multi-cast group */
9353 	RELMCAST_ENTRY_OP_ACK_ALL = 3    /**< Enable ACK ALL bit in AMT */
9354 };
9355 
9356 /* RMC operational modes */
9357 enum rmc_modes {
9358 	WL_RMC_MODE_RECEIVER    = 0,	 /**< Receiver mode by default */
9359 	WL_RMC_MODE_TRANSMITTER = 1,	 /**< Transmitter mode using wl ackreq */
9360 	WL_RMC_MODE_INITIATOR   = 2	 /**< Initiator mode using wl ackreq */
9361 };
9362 
9363 /** Each RMC mcast client info */
9364 typedef struct wl_relmcast_client {
9365 	uint8 flag;			/**< status of client such as AR, R, or blacklisted */
9366 	uint8 PAD;
9367 	int16 rssi;			/**< rssi value of RMC client */
9368 	struct ether_addr addr;		/**< mac address of RMC client */
9369 } wl_relmcast_client_t;
9370 
9371 /** RMC Counters */
9372 typedef struct wl_rmc_cnts {
9373 	uint16  version;		/**< see definition of WL_CNT_T_VERSION */
9374 	uint16  length;			/**< length of entire structure */
9375 	uint16	dupcnt;			/**< counter for duplicate rmc MPDU */
9376 	uint16	ackreq_err;		/**< counter for wl ackreq error    */
9377 	uint16	af_tx_err;		/**< error count for action frame transmit   */
9378 	uint16	null_tx_err;		/**< error count for rmc null frame transmit */
9379 	uint16	af_unicast_tx_err;	/**< error count for rmc unicast frame transmit */
9380 	uint16	mc_no_amt_slot;		/**< No mcast AMT entry available */
9381 	/* Unused. Keep for rom compatibility */
9382 	uint16	mc_no_glb_slot;		/**< No mcast entry available in global table */
9383 	uint16	mc_not_mirrored;	/**< mcast group is not mirrored */
9384 	uint16	mc_existing_tr;		/**< mcast group is already taken by transmitter */
9385 	uint16	mc_exist_in_amt;	/**< mcast group is already programmed in amt */
9386 	/* Unused. Keep for rom compatibility */
9387 	uint16	mc_not_exist_in_gbl;	/**< mcast group is not in global table */
9388 	uint16	mc_not_exist_in_amt;	/**< mcast group is not in AMT table */
9389 	uint16	mc_utilized;		/**< mcast addressed is already taken */
9390 	uint16	mc_taken_other_tr;	/**< multi-cast addressed is already taken */
9391 	uint32	rmc_rx_frames_mac;      /**< no of mc frames received from mac */
9392 	uint32	rmc_tx_frames_mac;      /**< no of mc frames transmitted to mac */
9393 	uint32	mc_null_ar_cnt;         /**< no. of times NULL AR is received */
9394 	uint32	mc_ar_role_selected;	/**< no. of times took AR role */
9395 	uint32	mc_ar_role_deleted;	/**< no. of times AR role cancelled */
9396 	uint32	mc_noacktimer_expired;  /**< no. of times noack timer expired */
9397 	uint16  mc_no_wl_clk;           /**< no wl clk detected when trying to access amt */
9398 	uint16  mc_tr_cnt_exceeded;     /**< No of transmitters in the network exceeded */
9399 } wl_rmc_cnts_t;
9400 
9401 /** RMC Status */
9402 typedef struct wl_relmcast_st {
9403 	uint8         ver;		/**< version of RMC */
9404 	uint8         num;		/**< number of clients detected by transmitter */
9405 	wl_relmcast_client_t clients[WL_RMC_MAX_CLIENT];
9406 	uint16        err;		/**< error status (used in infra) */
9407 	uint16        actf_time;	/**< action frame time period */
9408 } wl_relmcast_status_t;
9409 
9410 /** Entry for each STA/node */
9411 typedef struct wl_rmc_entry {
9412 	/* operation on multi-cast entry such add,
9413 	 * delete, ack-all
9414 	 */
9415 	int8    flag;
9416 	struct ether_addr addr;		/**< multi-cast group mac address */
9417 } wl_rmc_entry_t;
9418 
9419 /** RMC table */
9420 typedef struct wl_rmc_entry_table {
9421 	uint8   index;			/**< index to a particular mac entry in table */
9422 	uint8   opcode;			/**< opcodes or operation on entry */
9423 	wl_rmc_entry_t entry[WL_RMC_MAX_TABLE_ENTRY];
9424 } wl_rmc_entry_table_t;
9425 
9426 typedef struct wl_rmc_trans_elem {
9427 	struct ether_addr tr_mac;	/**< transmitter mac */
9428 	struct ether_addr ar_mac;	/**< ar mac */
9429 	uint16 artmo;			/**< AR timeout */
9430 	uint8 amt_idx;			/**< amt table entry */
9431 	uint8 PAD;
9432 	uint16 flag;			/**< entry will be acked, not acked, programmed, full etc */
9433 } wl_rmc_trans_elem_t;
9434 
9435 /** RMC transmitters */
9436 typedef struct wl_rmc_trans_in_network {
9437 	uint8         ver;		/**< version of RMC */
9438 	uint8         num_tr;		/**< number of transmitters in the network */
9439 	wl_rmc_trans_elem_t trs[WL_RMC_MAX_NUM_TRS];
9440 } wl_rmc_trans_in_network_t;
9441 
9442 /** To update vendor specific ie for RMC */
9443 typedef struct wl_rmc_vsie {
9444 	uint8	oui[DOT11_OUI_LEN];
9445 	uint8	PAD;
9446 	uint16	payload;	/**< IE Data Payload */
9447 } wl_rmc_vsie_t;
9448 
9449 /* structures  & defines for proximity detection  */
9450 enum proxd_method {
9451 	PROXD_UNDEFINED_METHOD = 0,
9452 	PROXD_RSSI_METHOD = 1,
9453 	PROXD_TOF_METHOD = 2
9454 };
9455 
9456 /* structures for proximity detection device role */
9457 #define WL_PROXD_MODE_DISABLE	0
9458 #define WL_PROXD_MODE_NEUTRAL	1
9459 #define WL_PROXD_MODE_INITIATOR	2
9460 #define WL_PROXD_MODE_TARGET	3
9461 
9462 #define WL_PROXD_ACTION_STOP		0
9463 #define WL_PROXD_ACTION_START		1
9464 
9465 #define WL_PROXD_FLAG_TARGET_REPORT	0x1
9466 #define WL_PROXD_FLAG_REPORT_FAILURE	0x2
9467 #define WL_PROXD_FLAG_INITIATOR_REPORT	0x4
9468 #define WL_PROXD_FLAG_NOCHANSWT		0x8
9469 #define WL_PROXD_FLAG_NETRUAL		0x10
9470 #define WL_PROXD_FLAG_INITIATOR_RPTRTT	0x20
9471 #define WL_PROXD_FLAG_ONEWAY		0x40
9472 #define WL_PROXD_FLAG_SEQ_EN		0x80
9473 
9474 #define WL_PROXD_SETFLAG_K		0x1
9475 #define WL_PROXD_SETFLAG_N		0x2
9476 #define WL_PROXD_SETFLAG_S		0x4
9477 
9478 #define WL_PROXD_SETFLAG_K		0x1
9479 #define WL_PROXD_SETFLAG_N		0x2
9480 #define WL_PROXD_SETFLAG_S		0x4
9481 
9482 #define WL_PROXD_RANDOM_WAKEUP	0x8000
9483 #define WL_PROXD_MAXREPORT	8
9484 
9485 typedef struct wl_proxd_iovar {
9486 	uint16	method;		/**< Proximity Detection method */
9487 	uint16	mode;		/**< Mode (neutral, initiator, target) */
9488 } wl_proxd_iovar_t;
9489 
9490 /*
9491  * structures for proximity detection parameters
9492  * consists of two parts, common and method specific params
9493  * common params should be placed at the beginning
9494  */
9495 
9496 typedef struct wl_proxd_params_common	{
9497 	chanspec_t	chanspec;	/**< channel spec */
9498 	int16		tx_power;	/**< tx power of Proximity Detection(PD) frames (in dBm) */
9499 	uint16		tx_rate;	/**< tx rate of PD rames  (in 500kbps units) */
9500 	uint16		timeout;	/**< timeout value */
9501 	uint16		interval;	/**< interval between neighbor finding attempts (in TU) */
9502 	uint16		duration;	/**< duration of neighbor finding attempts (in ms) */
9503 } wl_proxd_params_common_t;
9504 
9505 typedef struct wl_proxd_params_rssi_method {
9506 	chanspec_t	chanspec;	/**< chanspec for home channel */
9507 	int16		tx_power;	/**< tx power of Proximity Detection frames (in dBm) */
9508 	uint16		tx_rate;	/**< tx rate of PD frames, 500kbps units */
9509 	uint16		timeout;	/**< state machine wait timeout of the frames (in ms) */
9510 	uint16		interval;	/**< interval between neighbor finding attempts (in TU) */
9511 	uint16		duration;	/**< duration of neighbor finding attempts (in ms) */
9512 					/* method specific ones go after this line */
9513 	int16		rssi_thresh;	/**< RSSI threshold (in dBm) */
9514 	uint16		maxconvergtmo;	/**< max wait converge timeout (in ms) */
9515 } wl_proxd_params_rssi_method_t;
9516 
9517 #define Q1_NS			25	/**< Q1 time units */
9518 
9519 #define TOF_BW_NUM		3	/**< number of bandwidth that the TOF can support */
9520 #define TOF_BW_SEQ_NUM		(TOF_BW_NUM+2)	/* number of total index */
9521 enum tof_bw_index {
9522 	TOF_BW_20MHZ_INDEX = 0,
9523 	TOF_BW_40MHZ_INDEX = 1,
9524 	TOF_BW_80MHZ_INDEX = 2,
9525 	TOF_BW_SEQTX_INDEX = 3,
9526 	TOF_BW_SEQRX_INDEX = 4
9527 };
9528 
9529 #define BANDWIDTH_BASE	20	/**< base value of bandwidth */
9530 #define TOF_BW_20MHZ    (BANDWIDTH_BASE << TOF_BW_20MHZ_INDEX)
9531 #define TOF_BW_40MHZ    (BANDWIDTH_BASE << TOF_BW_40MHZ_INDEX)
9532 #define TOF_BW_80MHZ    (BANDWIDTH_BASE << TOF_BW_80MHZ_INDEX)
9533 #define TOF_BW_10MHZ    10
9534 
9535 #define NFFT_BASE		64	/**< base size of fft */
9536 #define TOF_NFFT_20MHZ  (NFFT_BASE << TOF_BW_20MHZ_INDEX)
9537 #define TOF_NFFT_40MHZ  (NFFT_BASE << TOF_BW_40MHZ_INDEX)
9538 #define TOF_NFFT_80MHZ  (NFFT_BASE << TOF_BW_80MHZ_INDEX)
9539 
9540 typedef struct wl_proxd_params_tof_method {
9541 	chanspec_t	chanspec;	/**< chanspec for home channel */
9542 	int16		tx_power;	/**< tx power of Proximity Detection(PD) frames (in dBm) */
9543 	uint16		tx_rate;	/**< tx rate of PD rames  (in 500kbps units) */
9544 	uint16		timeout;	/**< state machine wait timeout of the frames (in ms) */
9545 	uint16		interval;	/**< interval between neighbor finding attempts (in TU) */
9546 	uint16		duration;	/**< duration of neighbor finding attempts (in ms) */
9547 	/* specific for the method go after this line */
9548 	struct ether_addr tgt_mac;	/**< target mac addr for TOF method */
9549 	uint16		ftm_cnt;	/**< number of the frames txed by initiator */
9550 	uint16		retry_cnt;	/**< number of retransmit attampts for ftm frames */
9551 	int16		vht_rate;	/**< ht or vht rate */
9552 	/* add more params required for other methods can be added here  */
9553 } wl_proxd_params_tof_method_t;
9554 
9555 typedef struct wl_proxd_seq_config
9556 {
9557 	int16 N_tx_log2;
9558 	int16 N_rx_log2;
9559 	int16 N_tx_scale;
9560 	int16 N_rx_scale;
9561 	int16 w_len;
9562 	int16 w_offset;
9563 } wl_proxd_seq_config_t;
9564 
9565 #define WL_PROXD_TUNE_VERSION_1		1
9566 #define WL_PROXD_TUNE_VERSION_2		2
9567 #include <packed_section_start.h>
9568 /* For legacy ranging target (e.g. 43430, 43342) */
9569 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_params_tof_tune_v1 {
9570 	uint32		version;
9571 	uint32		Ki;			/**< h/w delay K factor for initiator */
9572 	uint32		Kt;			/**< h/w delay K factor for target */
9573 	int16		vhtack;			/**< enable/disable VHT ACK */
9574 	int16		N_log2[TOF_BW_SEQ_NUM]; /**< simple threshold crossing */
9575 	int16		w_offset[TOF_BW_NUM];	/**< offset of threshold crossing window(per BW) */
9576 	int16		w_len[TOF_BW_NUM];	/**< length of threshold crossing window(per BW) */
9577 	int32		maxDT;			/**< max time difference of T4/T1 or T3/T2 */
9578 	int32		minDT;			/**< min time difference of T4/T1 or T3/T2 */
9579 	uint8		totalfrmcnt;	/**< total count of transfered measurement frames */
9580 	uint16		rsv_media;		/**< reserve media value for TOF */
9581 	uint32		flags;			/**< flags */
9582 	uint8		core;			/**< core to use for tx */
9583 	uint8		setflags;		/* set flags of K, N. S values  */
9584 	int16		N_scale[TOF_BW_SEQ_NUM]; /**< simple threshold crossing */
9585 	uint8		sw_adj;			/**< enable sw assisted timestamp adjustment */
9586 	uint8		hw_adj;			/**< enable hw assisted timestamp adjustment */
9587 	uint8		seq_en;			/**< enable ranging sequence */
9588 	uint8		ftm_cnt[TOF_BW_SEQ_NUM]; /**< number of ftm frames based on bandwidth */
9589 	int16		N_log2_2g;		/**< simple threshold crossing for 2g channel */
9590 	int16		N_scale_2g;		/**< simple threshold crossing for 2g channel */
9591 	wl_proxd_seq_config_t seq_5g20;
9592 	wl_proxd_seq_config_t seq_2g20;		/* Thresh crossing params for 2G Sequence */
9593 	uint16          bitflip_thresh;		/* bitflip threshold */
9594 	uint16          snr_thresh;		/* SNR threshold */
9595 	int8            recv_2g_thresh;		/* 2g recieve sensitivity threshold */
9596 	uint32          acs_gdv_thresh;
9597 	int8            acs_rssi_thresh;
9598 	uint8           smooth_win_en;
9599 	int32		emu_delay;
9600 } BWL_POST_PACKED_STRUCT wl_proxd_params_tof_tune_v1_t;
9601 #include <packed_section_end.h>
9602 
9603 #include <packed_section_start.h>
9604 /* For legacy ranging initiator (including 4364) */
9605 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_params_tof_tune_v2 {
9606 	uint32		version;
9607 	uint32		Ki;			/**< h/w delay K factor for initiator */
9608 	uint32		Kt;			/**< h/w delay K factor for target */
9609 	int16		vhtack;			/**< enable/disable VHT ACK */
9610 	int16		N_log2[TOF_BW_SEQ_NUM]; /**< simple threshold crossing */
9611 	int16		w_offset[TOF_BW_NUM];	/**< offset of threshold crossing window(per BW) */
9612 	int16		w_len[TOF_BW_NUM];	/**< length of threshold crossing window(per BW) */
9613 	int32		maxDT;			/**< max time difference of T4/T1 or T3/T2 */
9614 	int32		minDT;			/**< min time difference of T4/T1 or T3/T2 */
9615 	uint8		totalfrmcnt;		/**< total count of transfered measurement frames */
9616 	uint16		rsv_media;		/**< reserve media value for TOF */
9617 	uint32		flags;			/**< flags */
9618 	uint8		core;			/**< core to use for tx */
9619 	uint8		setflags;		/* set flags of K, N. S values  */
9620 	int16		N_scale[TOF_BW_SEQ_NUM]; /**< simple threshold crossing */
9621 	uint8		sw_adj;			/**< enable sw assisted timestamp adjustment */
9622 	uint8		hw_adj;			/**< enable hw assisted timestamp adjustment */
9623 	uint8		seq_en;			/**< enable ranging sequence */
9624 	uint8		ftm_cnt[TOF_BW_SEQ_NUM]; /**< number of ftm frames based on bandwidth */
9625 	int16		N_log2_2g;		/**< simple threshold crossing for 2g channel */
9626 	int16		N_scale_2g;		/**< simple threshold crossing for 2g channel */
9627 	wl_proxd_seq_config_t seq_5g20;
9628 	wl_proxd_seq_config_t seq_2g20;		/* Thresh crossing params for 2G Sequence */
9629 	uint16          bitflip_thresh;		/* bitflip threshold */
9630 	uint16          snr_thresh;		/* SNR threshold */
9631 	int8            recv_2g_thresh;		/* 2g recieve sensitivity threshold */
9632 	uint32          acs_gdv_thresh;
9633 	int8            acs_rssi_thresh;
9634 	uint8           smooth_win_en;
9635 	int32		acs_gdmm_thresh;
9636 	int8		acs_delta_rssi_thresh;
9637 	int32		emu_delay;
9638 	uint8		core_mask;		/* core mask selection */
9639 } BWL_POST_PACKED_STRUCT wl_proxd_params_tof_tune_v2_t;
9640 #include <packed_section_end.h>
9641 
9642 #define WL_PROXD_TUNE_VERSION_3		3
9643 /* Future ranging support */
9644 typedef struct wl_proxd_params_tof_tune_v3 {
9645 	uint16		version;
9646 	uint16		len;
9647 	uint32		Ki;			/**< h/w delay K factor for initiator */
9648 	uint32		Kt;			/**< h/w delay K factor for target */
9649 	int16		vhtack;			/**< enable/disable VHT ACK */
9650 	uint16		PAD;
9651 	int16		N_log2[TOF_BW_SEQ_NUM]; /**< simple threshold crossing */
9652 	uint16		PAD;
9653 	int16		w_offset[TOF_BW_NUM];	/**< offset of threshold crossing window(per BW) */
9654 	uint16		PAD;
9655 	int16		w_len[TOF_BW_NUM];	/**< length of threshold crossing window(per BW) */
9656 	uint16		PAD;
9657 	int32		maxDT;			/**< max time difference of T4/T1 or T3/T2 */
9658 	int32		minDT;			/**< min time difference of T4/T1 or T3/T2 */
9659 	uint8		totalfrmcnt;	/**< total count of transfered measurement frames */
9660 	uint8		PAD[3];
9661 	uint16		rsv_media;		/**< reserve media value for TOF */
9662 	uint16		PAD;
9663 	uint32		flags;			/**< flags */
9664 	uint8		core;			/**< core to use for tx */
9665 	uint8		setflags;		/* set flags of K, N. S values  */
9666 	uint16		PAD;
9667 	int16		N_scale[TOF_BW_SEQ_NUM]; /**< simple threshold crossing */
9668 	uint8		sw_adj;			/**< enable sw assisted timestamp adjustment */
9669 	uint8		hw_adj;			/**< enable hw assisted timestamp adjustment */
9670 	uint8		seq_en;			/**< enable ranging sequence */
9671 	uint8		PAD[3];
9672 	uint8		ftm_cnt[TOF_BW_SEQ_NUM]; /**< number of ftm frames based on bandwidth */
9673 	uint8		PAD[3];
9674 	int16		N_log2_2g;		/**< simple threshold crossing for 2g channel */
9675 	int16		N_scale_2g;		/**< simple threshold crossing for 2g channel */
9676 	wl_proxd_seq_config_t seq_5g20;
9677 	wl_proxd_seq_config_t seq_2g20;		/* Thresh crossing params for 2G Sequence */
9678 	uint16          bitflip_thresh;		/* bitflip threshold */
9679 	uint16          snr_thresh;		/* SNR threshold */
9680 	int8            recv_2g_thresh;		/* 2g recieve sensitivity threshold */
9681 	uint8		PAD[3];
9682 	uint32          acs_gdv_thresh;
9683 	int8            acs_rssi_thresh;
9684 	uint8           smooth_win_en;
9685 	uint16		PAD;
9686 	int32		acs_gdmm_thresh;
9687 	int8		acs_delta_rssi_thresh;
9688 	uint8		PAD[3];
9689 	int32		emu_delay;
9690 	uint8		core_mask;		/* core mask selection */
9691 	uint8		PAD[3];
9692 } wl_proxd_params_tof_tune_v3_t;
9693 
9694 typedef struct wl_proxd_params_iovar {
9695 	uint16	method;			/**< Proximity Detection method */
9696 	uint8	PAD[2];
9697 	union {
9698 		/* common params for pdsvc */
9699 		wl_proxd_params_common_t	cmn_params;	/**< common parameters */
9700 		/*  method specific */
9701 		wl_proxd_params_rssi_method_t	rssi_params;	/**< RSSI method parameters */
9702 		wl_proxd_params_tof_method_t	tof_params;	/**< TOF method parameters */
9703 		/* tune parameters */
9704 		wl_proxd_params_tof_tune_v3_t	tof_tune;	/**< TOF tune parameters */
9705 	} u;				/**< Method specific optional parameters */
9706 } wl_proxd_params_iovar_t;
9707 
9708 #define PROXD_COLLECT_GET_STATUS	0
9709 #define PROXD_COLLECT_SET_STATUS	1
9710 #define PROXD_COLLECT_QUERY_HEADER	2
9711 #define PROXD_COLLECT_QUERY_DATA	3
9712 #define PROXD_COLLECT_QUERY_DEBUG	4
9713 #define PROXD_COLLECT_REMOTE_REQUEST	5
9714 #define PROXD_COLLECT_DONE		6
9715 
9716 typedef enum {
9717 	WL_PROXD_COLLECT_METHOD_TYPE_DISABLE		= 0x0,
9718 	WL_PROXD_COLLECT_METHOD_TYPE_IOVAR		= 0x1,
9719 	WL_PROXD_COLLECT_METHOD_TYPE_EVENT		= 0x2,
9720 	WL_PROXD_COLLECT_METHOD_TYPE_EVENT_LOG		= 0x4
9721 } wl_proxd_collect_method_type_t;
9722 
9723 typedef uint16 wl_proxd_collect_method_t;	/* query status: method to send proxd collect */
9724 
9725 #include <packed_section_start.h>
9726 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_query {
9727 	uint32		method;		/**< method */
9728 	uint8		request;	/**< Query request. */
9729 	uint8		status;		/**< bitmask 0 -- disable, 0x1 -- enable collection, */
9730 					/* 0x2 -- Use generic event, 0x4 -- use event log */
9731 	uint16		index;		/**< The current frame index [0 to total_frames - 1]. */
9732 	uint16		mode;		/**< Initiator or Target */
9733 	uint8		busy;		/**< tof sm is busy */
9734 	uint8		remote;		/**< Remote collect data */
9735 } BWL_POST_PACKED_STRUCT wl_proxd_collect_query_t;
9736 #include <packed_section_end.h>
9737 
9738 #include <packed_section_start.h>
9739 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_header {
9740 	uint16		total_frames;			/**< The total frames for this collect. */
9741 	uint16		nfft;				/**< nfft value */
9742 	uint16		bandwidth;			/**< bandwidth */
9743 	uint16		channel;			/**< channel number */
9744 	uint32		chanspec;			/**< channel spec */
9745 	uint32		fpfactor;			/**< avb timer value factor */
9746 	uint16		fpfactor_shift;			/**< avb timer value shift bits */
9747 	int32		distance;			/**< distance calculated by fw */
9748 	uint32		meanrtt;			/**< mean of RTTs */
9749 	uint32		modertt;			/**< mode of RTTs */
9750 	uint32		medianrtt;			/**< median of RTTs */
9751 	uint32		sdrtt;				/**< standard deviation of RTTs */
9752 	uint32		clkdivisor;			/**< clock divisor */
9753 	uint16		chipnum;			/**< chip type */
9754 	uint8		chiprev;			/**< chip revision */
9755 	uint8		phyver;				/**< phy version */
9756 	struct ether_addr	localMacAddr;		/**< local mac address */
9757 	struct ether_addr	remoteMacAddr;		/**< remote mac address */
9758 	wl_proxd_params_tof_tune_v3_t params;
9759 } BWL_POST_PACKED_STRUCT wl_proxd_collect_header_t;
9760 #include <packed_section_end.h>
9761 
9762 /* ifdef WL_NAN */
9763 /*  ********************** NAN wl interface struct types and defs ******************** */
9764 /*
9765  * Uses new common IOVAR batch processing mechanism
9766  */
9767 
9768 /*
9769  * NAN config control
9770  * Bits 0 - 23 can be set by host
9771  * Bits 24 - 31 - Internal use for firmware, host cannot set it
9772  */
9773 
9774 /*
9775  * Bit 0 : If set to 1, means event uses nan bsscfg,
9776  * otherwise uses infra bsscfg. Default is using infra bsscfg
9777  */
9778 #define WL_NAN_CTRL_ROUTE_EVENT_VIA_NAN_BSSCFG	0x0000001
9779 /* If set, discovery beacons are transmitted on 2G band */
9780 #define WL_NAN_CTRL_DISC_BEACON_TX_2G		0x0000002
9781 /* If set, sync beacons are transmitted on 2G band */
9782 #define WL_NAN_CTRL_SYNC_BEACON_TX_2G		0x0000004
9783 /* If set, discovery beacons are transmitted on 5G band */
9784 #define WL_NAN_CTRL_DISC_BEACON_TX_5G		0x0000008
9785 /* If set, sync beacons are transmitted on 5G band */
9786 #define WL_NAN_CTRL_SYNC_BEACON_TX_5G		0x0000010
9787 /* If set, auto datapath responses will be sent by FW */
9788 #define WL_NAN_CTRL_AUTO_DPRESP			0x0000020
9789 /* If set, auto datapath confirms will be sent by FW */
9790 #define WL_NAN_CTRL_AUTO_DPCONF			0x0000040
9791 /* If set, auto schedule responses will be sent by FW */
9792 #define WL_NAN_CTRL_AUTO_SCHEDRESP		0x0000080
9793 /* If set, auto schedule confirms will be sent by FW */
9794 #define WL_NAN_CTRL_AUTO_SCHEDCONF		0x0000100
9795 /* If set, proprietary rates are supported by FW */
9796 #define WL_NAN_CTRL_PROP_RATE			0x0000200
9797 /* If set, service awake_dw overrides global dev awake_dw */
9798 #define WL_NAN_CTRL_SVC_OVERRIDE_DEV_AWAKE_DW	0x0000400
9799 /* If set, merge scan will be disabled */
9800 #define WL_NAN_CTRL_SCAN_DISABLE		0x0000800
9801 /* If set, power save will be disabled */
9802 #define WL_NAN_CTRL_POWER_SAVE_DISABLE		0x0001000
9803 /* If set, device will merge to configured CID only */
9804 #define WL_NAN_CTRL_MERGE_CONF_CID_ONLY		0x0002000
9805 /* If set, 5g core will be brought down in single band NAN */
9806 #define WL_NAN_CTRL_5G_SLICE_POWER_OPT		0x0004000
9807 #define WL_NAN_CTRL_DUMP_HEAP			0x0008000
9808 /* If set, host generates and assign ndp id for ndp sessions */
9809 #define WL_NAN_CTRL_HOST_GEN_NDPID		0x0010000
9810 /* If set, nan ndp inactivity watchdog will be activated */
9811 #define WL_NAN_CTRL_DELETE_INACTIVE_PEERS	0x0020000
9812 /* If set, nan assoc coex will be activated */
9813 #define WL_NAN_CTRL_INFRA_ASSOC_COEX		0x0040000
9814 /* If set, dam will accept all NDP/RNG request from the peer including counter */
9815 #define WL_NAN_CTRL_DAM_ACCEPT_ALL		0x0080000
9816 /* If set, nan mac ignores role for tx discovery beacon for periodic config */
9817 #define WL_NAN_CTRL_FASTDISC_IGNO_ROLE		0x0100000
9818 /* If set, include NA in NAN beacons (disc beacons for now) */
9819 #define WL_NAN_CTRL_INCL_NA_IN_BCNS		0x0200000
9820 /* If set, host assist will be enabled */
9821 #define WL_NAN_CTRL_HOST_ASSIST			0x0400000
9822 /* If set, host configures NDI associated with the service */
9823 #define WL_NAN_CTRL_HOST_CFG_SVC_NDI		0x0800000
9824 #define WL_NAN_CTRL_NDP_HB_ENABLE		0x1000000
9825 
9826 /* Value when all host-configurable bits set */
9827 #define WL_NAN_CTRL_MAX_MASK			0xFFFFFFF
9828 #define WL_NAN_CFG_CTRL_FW_BITS			4
9829 
9830 /* Last 4-bits are firmware controlled bits.
9831  * Bit 31:
9832  * If set - indicates that NAN initialization is successful
9833  * Bit 30:
9834  * If set - indicates that NAN MAC cfg creation is successful
9835  *
9836  * NOTE: These are only ready-only bits for host.
9837  * All sets to these bits from host are masked off
9838  */
9839 #define WL_NAN_PROTO_INIT_DONE		(1 << 31)
9840 #define WL_NAN_CFG_CREATE_DONE		(1 << 30)
9841 
9842 #define WL_NAN_GET_PROTO_INIT_STATUS(x) \
9843 		(((x) & WL_NAN_PROTO_INIT_DONE) ? TRUE:FALSE)
9844 #define WL_NAN_CLEAR_PROTO_INIT_STATUS(x) \
9845 		((x) &= ~WL_NAN_PROTO_INIT_DONE)
9846 #define WL_NAN_SET_PROTO_INIT_STATUS(x) \
9847 		((x) |= (WL_NAN_PROTO_INIT_DONE))
9848 
9849 #define WL_NAN_GET_CFG_CREATE_STATUS(x) \
9850 		(((x) & WL_NAN_CFG_CREATE_DONE) ? TRUE:FALSE)
9851 #define WL_NAN_CLEAR_CFG_CREATE_STATUS(x) \
9852 		((x) &= ~WL_NAN_CFG_CREATE_DONE)
9853 #define WL_NAN_SET_CFG_CREATE_STATUS(x) \
9854 		((x) |= (WL_NAN_CFG_CREATE_DONE))
9855 
9856 #define WL_NAN_IOCTL_VERSION			0x2
9857 /* < some sufficient ioc buff size for our module */
9858 #define WL_NAN_IOC_BUFSZ			256
9859 /* some sufficient ioc buff size for dump commands */
9860 #define WL_NAN_IOC_BUFSZ_EXT			1024
9861 #define WL_NAN_MAX_SIDS_IN_BEACONS		127 /* Max allowed SIDs */
9862 #define WL_NAN_MASTER_RANK_LEN			8
9863 #define WL_NAN_RANGE_LIMITED			0x0040 /* Publish/Subscribe flags */
9864 
9865 /** The service hash (service id) is exactly this many bytes. */
9866 #define WL_NAN_SVC_HASH_LEN			6
9867 #define WL_NAN_HASHES_PER_BLOOM			4 /** Number of hash functions per bloom filter */
9868 
9869 /* no. of max last disc results */
9870 #define WL_NAN_MAX_DISC_RESULTS			3
9871 
9872 /* Max len of Rx and Tx filters */
9873 #define WL_NAN_MAX_SVC_MATCH_FILTER_LEN	255
9874 
9875 /* Max service name len */
9876 #define WL_NAN_MAX_SVC_NAME_LEN	32
9877 
9878 /* Type of Data path connection */
9879 #define WL_NAN_DP_TYPE_UNICAST			0
9880 #define WL_NAN_DP_TYPE_MULTICAST		1
9881 
9882 /* MAX security params length PMK field */
9883 #define WL_NAN_NCS_SK_PMK_LEN 32
9884 
9885 /* Post disc attr ID type */
9886 typedef uint8 wl_nan_post_disc_attr_id_t;
9887 
9888 /*
9889  * Component IDs
9890  */
9891 typedef enum {
9892 	WL_NAN_COMPID_CONFIG = 1,
9893 	WL_NAN_COMPID_ELECTION = 2,
9894 	WL_NAN_COMPID_SD = 3,
9895 	WL_NAN_COMPID_TIMESYNC = 4,
9896 	WL_NAN_COMPID_DATA_PATH = 5,
9897 	WL_NAN_COMPID_DEBUG = 15 /* Keep this at the end */
9898 } wl_nan_comp_id_t;
9899 
9900 #define WL_NAN_COMP_SHIFT	8
9901 #define WL_NAN_COMP_MASK(_c)	(0x0F & ((uint8)(_c)))
9902 #define WL_NAN_COMP_ID(_c)	(WL_NAN_COMP_MASK(_c) << WL_NAN_COMP_SHIFT)
9903 
9904 /* NAN Events */
9905 
9906 /** Instance ID type (unique identifier) */
9907 typedef uint8 wl_nan_instance_id_t;
9908 
9909 /* Publish sent for a subscribe */
9910 /* WL_NAN_EVENT_REPLIED */
9911 
9912 typedef struct wl_nan_ev_replied {
9913 	struct ether_addr	sub_mac; /* Subscriber MAC */
9914 	wl_nan_instance_id_t	pub_id; /* Publisher Instance ID */
9915 	uint8			sub_id; /* Subscriber ID */
9916 	int8			sub_rssi; /* Subscriber RSSI */
9917 	uint8			pad[3];
9918 } wl_nan_ev_replied_t;
9919 
9920 typedef struct wl_nan_event_replied {
9921 	struct ether_addr	sub_mac; /* Subscriber MAC */
9922 	wl_nan_instance_id_t	pub_id; /* Publisher Instance ID */
9923 	uint8			sub_id; /* Subscriber ID */
9924 	int8			sub_rssi; /* Subscriber RSSI */
9925 	uint8		attr_num;
9926 	uint16		attr_list_len;  /* sizeof attributes attached to payload */
9927 	uint8		attr_list[0];   /* attributes payload */
9928 } wl_nan_event_replied_t;
9929 
9930 /* NAN Tx status of transmitted frames */
9931 #define WL_NAN_TXS_FAILURE	0
9932 #define WL_NAN_TXS_SUCCESS	1
9933 
9934 /* NAN frame types */
9935 enum wl_nan_frame_type {
9936 	/* discovery frame types */
9937 	WL_NAN_FRM_TYPE_PUBLISH = 1,
9938 	WL_NAN_FRM_TYPE_SUBSCRIBE = 2,
9939 	WL_NAN_FRM_TYPE_FOLLOWUP = 3,
9940 
9941 	/* datapath frame types */
9942 	WL_NAN_FRM_TYPE_DP_REQ = 4,
9943 	WL_NAN_FRM_TYPE_DP_RESP = 5,
9944 	WL_NAN_FRM_TYPE_DP_CONF = 6,
9945 	WL_NAN_FRM_TYPE_DP_INSTALL = 7,
9946 	WL_NAN_FRM_TYPE_DP_END = 8,
9947 
9948 	/* schedule frame types */
9949 	WL_NAN_FRM_TYPE_SCHED_REQ = 9,
9950 	WL_NAN_FRM_TYPE_SCHED_RESP = 10,
9951 	WL_NAN_FRM_TYPE_SCHED_CONF = 11,
9952 	WL_NAN_FRM_TYPE_SCHED_UPD = 12,
9953 
9954 	/* ranging frame types */
9955 	WL_NAN_FRM_TYPE_RNG_REQ = 13,
9956 	WL_NAN_FRM_TYPE_RNG_RESP = 14,
9957 	WL_NAN_FRM_TYPE_RNG_TERM = 15,
9958 	WL_NAN_FRM_TYPE_RNG_REPORT = 16,
9959 
9960 	WL_NAN_FRM_TYPE_UNSOLICIT_SDF = 17,
9961 	WL_NAN_FRM_TYPE_INVALID
9962 };
9963 typedef uint8 wl_nan_frame_type_t;
9964 
9965 /* NAN Reason codes for tx status */
9966 enum wl_nan_txs_reason_codes {
9967 	WL_NAN_REASON_SUCCESS = 1,    /* NAN status success */
9968 	WL_NAN_REASON_TIME_OUT = 2,   /* timeout reached */
9969 	WL_NAN_REASON_DROPPED = 3,    /* pkt dropped due to internal failure */
9970 	WL_NAN_REASON_MAX_RETRIES_DONE = 4 /* Max retries exceeded */
9971 };
9972 
9973 /* For NAN TX status */
9974 typedef struct wl_nan_event_txs {
9975 	uint8 status;	    /* For TX status, success or failure */
9976 	uint8 reason_code;  /* to identify reason when status is failure */
9977 	uint16 host_seq;    /* seq num to keep track of pkts sent by host */
9978 	uint8 type;	    /* frame type */
9979 	uint8 pad;
9980 	uint16 opt_tlvs_len;
9981 	uint8 opt_tlvs[];
9982 } wl_nan_event_txs_t;
9983 
9984 /* SD transmit pkt's event status is sent as optional tlv in wl_nan_event_txs_t */
9985 typedef struct wl_nan_event_sd_txs {
9986 	uint8 inst_id;	    /* Publish or subscribe instance id */
9987 	uint8 req_id;	    /* Requestor instance id */
9988 } wl_nan_event_sd_txs_t;
9989 
9990 /* Subscribe or Publish instance Terminated */
9991 
9992 /* WL_NAN_EVENT_TERMINATED */
9993 
9994 #define	NAN_SD_TERM_REASON_TIMEOUT	1
9995 #define	NAN_SD_TERM_REASON_HOSTREQ	2
9996 #define	NAN_SD_TERM_REASON_FWTERM	3
9997 #define	NAN_SD_TERM_REASON_FAIL		4
9998 
9999 typedef struct wl_nan_ev_terminated {
10000 	uint8 instance_id;	/* publish / subscribe instance id */
10001 	uint8 reason;		/* 1=timeout, 2=Host/IOVAR, 3=FW Terminated 4=Failure */
10002 	uint8 svctype;		/* 0 - Publish, 0x1 - Subscribe */
10003 	uint8 pad;              /* Align */
10004 	uint32 tx_cnt;		/* Number of SDFs sent */
10005 } wl_nan_ev_terminated_t;
10006 
10007 /* Follow up received against a pub / subscr */
10008 /* WL_NAN_EVENT_RECEIVE */
10009 
10010 typedef struct wl_nan_ev_receive {
10011 	struct ether_addr remote_addr;	/* Peer NAN device MAC */
10012 	uint8	local_id;		/* Local subscribe or publish ID */
10013 	uint8	remote_id;		/* Remote subscribe or publish ID */
10014 	int8	fup_rssi;
10015 	uint8	attr_num;
10016 	uint16	attr_list_len;  /* sizeof attributes attached to payload */
10017 	uint8	attr_list[0];   /* attributes payload */
10018 } wl_nan_ev_receive_t;
10019 
10020 /* WL_NAN_EVENT_DISC_CACHE_TIMEOUT */
10021 #define WL_NAN_DISC_CACHE_EXPIRY_ENTRIES_MAX 8
10022 
10023 typedef struct wl_nan_disc_expired_cache_entry {
10024 	uint8 l_sub_id;			/* local sub instance_id */
10025 	uint8 r_pub_id;			/* remote-matched pub instance_id */
10026 	struct ether_addr r_nmi_addr;	/* remote-matched pub nmi addr */
10027 } wl_nan_disc_expired_cache_entry_t;
10028 
10029 typedef struct wl_nan_ev_disc_cache_timeout {
10030 	uint16 count;      /* no. of expired cache entries */
10031 	uint16 pad;
10032 	wl_nan_disc_expired_cache_entry_t cache_exp_list[];
10033 } wl_nan_ev_disc_cache_timeout_t;
10034 
10035 /* For NAN event mask extention */
10036 #define WL_NAN_EVMASK_EXTN_VER	1
10037 #define WL_NAN_EVMASK_EXTN_LEN	16	/* 16*8 = 128 masks supported */
10038 
10039 typedef struct wl_nan_event_extn {
10040 	uint8	ver;
10041 	uint8	pad;
10042 	uint16	len;
10043 	uint8	evmask[];
10044 } wl_nan_evmask_extn_t;
10045 
10046 /* WL_NAN_XTLV_DATA_DP_TXS */
10047 
10048 typedef struct wl_nan_data_dp_txs {
10049 	uint8 ndp_id;
10050 	uint8 pad;
10051 	struct ether_addr indi; /* initiator ndi */
10052 } wl_nan_data_dp_txs_t;
10053 
10054 /* WL_NAN_XTLV_RNG_TXS */
10055 
10056 typedef struct wl_nan_range_txs {
10057 	uint8	range_id;
10058 	uint8	pad[3];
10059 } wl_nan_range_txs_t;
10060 
10061 #define NAN_MAX_BANDS 2
10062 
10063 /*
10064  * TLVs - Below XTLV definitions will be deprecated
10065  * in due course (soon as all other branches update
10066  * to the comp ID based XTLVs listed below).
10067  */
10068 enum wl_nan_cmd_xtlv_id {
10069 	WL_NAN_XTLV_MAC_ADDR = 0x120,
10070 	WL_NAN_XTLV_MATCH_RX = 0x121,
10071 	WL_NAN_XTLV_MATCH_TX = 0x122,
10072 	WL_NAN_XTLV_SVC_INFO = 0x123,
10073 	WL_NAN_XTLV_SVC_NAME = 0x124,
10074 	WL_NAN_XTLV_SR_FILTER = 0x125,
10075 	WL_NAN_XTLV_FOLLOWUP = 0x126,
10076 	WL_NAN_XTLV_SVC_LIFE_COUNT = 0x127,
10077 	WL_NAN_XTLV_AVAIL = 0x128,
10078 	WL_NAN_XTLV_SDF_RX = 0x129,
10079 	WL_NAN_XTLV_SDE_CONTROL = 0x12a,
10080 	WL_NAN_XTLV_SDE_RANGE_LIMIT = 0x12b,
10081 	WL_NAN_XTLV_NAN_AF = 0x12c,
10082 	WL_NAN_XTLV_SD_TERMINATE = 0x12d,
10083 	WL_NAN_XTLV_CLUSTER_ID = 0x12e,
10084 	WL_NAN_XTLV_PEER_RSSI = 0x12f,
10085 	WL_NAN_XTLV_BCN_RX = 0x130,
10086 	WL_NAN_XTLV_REPLIED = 0x131, /* Publish sent for a subscribe */
10087 	WL_NAN_XTLV_RECEIVED = 0x132, /* FUP Received */
10088 	WL_NAN_XTLV_DISC_RESULTS = 0x133, /* Discovery results */
10089 	WL_NAN_XTLV_TXS = 0x134 /* TX status */
10090 };
10091 
10092 #define WL_NAN_CMD_GLOBAL		0x00
10093 #define WL_NAN_CMD_CFG_COMP_ID		0x01
10094 #define WL_NAN_CMD_ELECTION_COMP_ID	0x02
10095 #define WL_NAN_CMD_SD_COMP_ID		0x03
10096 #define WL_NAN_CMD_SYNC_COMP_ID		0x04
10097 #define WL_NAN_CMD_DATA_COMP_ID		0x05
10098 #define WL_NAN_CMD_DAM_COMP_ID		0x06
10099 #define WL_NAN_CMD_RANGE_COMP_ID	0x07
10100 #define WL_NAN_CMD_GENERIC_COMP_ID	0x08
10101 #define WL_NAN_CMD_SCHED_COMP_ID	0x09
10102 #define WL_NAN_CMD_NSR_COMP_ID		0x0a /* NAN Save Restore */
10103 #define WL_NAN_CMD_NANHO_COMP_ID	0x0b /* NAN Host offload */
10104 #define WL_NAN_CMD_DBG_COMP_ID		0x0f
10105 
10106 #define WL_NAN_CMD_COMP_SHIFT		8
10107 #define NAN_CMD(x, y)  (((x) << WL_NAN_CMD_COMP_SHIFT) | (y))
10108 
10109 /*
10110  * Module based NAN TLV IDs
10111  */
10112 typedef enum wl_nan_tlv {
10113 
10114 	WL_NAN_XTLV_CFG_MATCH_RX	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x01),
10115 	WL_NAN_XTLV_CFG_MATCH_TX	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x02),
10116 	WL_NAN_XTLV_CFG_SR_FILTER	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x03),
10117 	WL_NAN_XTLV_CFG_SVC_NAME	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x04),
10118 	WL_NAN_XTLV_CFG_NAN_STATUS	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x05),
10119 	WL_NAN_XTLV_CFG_SVC_LIFE_COUNT	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x06),
10120 	WL_NAN_XTLV_CFG_SVC_HASH	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x07),
10121 	WL_NAN_XTLV_CFG_SEC_CSID	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x08), /* Security CSID */
10122 	WL_NAN_XTLV_CFG_SEC_PMK		= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x09), /* Security PMK */
10123 	WL_NAN_XTLV_CFG_SEC_PMKID	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0A),
10124 	WL_NAN_XTLV_CFG_SEC_SCID	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0B),
10125 	WL_NAN_XTLV_CFG_VNDR_PAYLOAD	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0C),
10126 	WL_NAN_XTLV_CFG_HOST_INDPID	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0D),
10127 	/* when host ndpid is used */
10128 	WL_NAN_XTLV_CFG_MAC_ADDR	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0E),
10129 	/* fast disc time bitmap config */
10130 	WL_NAN_XTLV_CFG_FDISC_TBMP	= NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0F),
10131 
10132 	WL_NAN_XTLV_SD_SVC_INFO		= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x01),
10133 	WL_NAN_XTLV_SD_FOLLOWUP		= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x02),
10134 	WL_NAN_XTLV_SD_SDF_RX		= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x03),
10135 	WL_NAN_XTLV_SD_SDE_CONTROL	= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x04),
10136 	WL_NAN_XTLV_SD_SDE_RANGE_LIMIT	= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x05),
10137 	WL_NAN_XTLV_SD_NAN_AF		= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x06),
10138 	WL_NAN_XTLV_SD_TERM		= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x07),
10139 	WL_NAN_XTLV_SD_REPLIED		= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x08), /* Pub sent */
10140 	WL_NAN_XTLV_SD_FUP_RECEIVED	= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x09), /* FUP Received */
10141 	WL_NAN_XTLV_SD_DISC_RESULTS	= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0A), /* Pub RX */
10142 	WL_NAN_XTLV_SD_TXS		= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0B), /* Tx status */
10143 	WL_NAN_XTLV_SD_SDE_SVC_INFO	= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0C),
10144 	WL_NAN_XTLV_SD_SDE_SVC_UPD_IND	= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0D),
10145 	WL_NAN_XTLV_SD_SVC_NDI		= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0E),
10146 	WL_NAN_XTLV_SD_NDP_SPEC_INFO	= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0F),
10147 	WL_NAN_XTLV_SD_NDPE_TLV_LIST	= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x10),
10148 	WL_NAN_XTLV_SD_NDL_QOS_UPD	= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x11),
10149 	WL_NAN_XTLV_SD_DISC_CACHE_TIMEOUT	= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x12),
10150 
10151 	WL_NAN_XTLV_SYNC_BCN_RX		= NAN_CMD(WL_NAN_CMD_SYNC_COMP_ID, 0x01),
10152 	WL_NAN_XTLV_EV_MR_CHANGED	= NAN_CMD(WL_NAN_CMD_SYNC_COMP_ID, 0x02),
10153 
10154 	WL_NAN_XTLV_DATA_DP_END		= NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x01),
10155 	WL_NAN_XTLV_DATA_DP_INFO	= NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x02),
10156 	WL_NAN_XTLV_DATA_DP_SEC_INST	= NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x03),
10157 	WL_NAN_XTLV_DATA_DP_TXS		= NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x04), /* txs for dp */
10158 	WL_NAN_XTLV_DATA_DP_OPAQUE_INFO	 = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x05),
10159 	WL_NAN_XTLV_RANGE_INFO		= NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x01),
10160 	WL_NAN_XTLV_RNG_TXS		= NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x02),
10161 
10162 	WL_NAN_XTLV_EV_SLOT_INFO	= NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x01),
10163 	WL_NAN_XTLV_EV_GEN_INFO         = NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x02),
10164 	WL_NAN_XTLV_CCA_STATS		= NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x03),
10165 	WL_NAN_XTLV_PER_STATS		= NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x04),
10166 	WL_NAN_XTLV_CHBOUND_INFO	= NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x05),
10167 	WL_NAN_XTLV_SLOT_STATS		= NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x06),
10168 
10169 	WL_NAN_XTLV_DAM_NA_ATTR		= NAN_CMD(WL_NAN_CMD_DAM_COMP_ID, 0x01), /* na attr */
10170 	WL_NAN_XTLV_HOST_ASSIST_REQ	= NAN_CMD(WL_NAN_CMD_DAM_COMP_ID, 0x02), /* host assist */
10171 
10172 	WL_NAN_XTLV_GEN_FW_CAP		= NAN_CMD(WL_NAN_CMD_GENERIC_COMP_ID, 0x01), /* fw cap */
10173 
10174 	WL_NAN_XTLV_SCHED_INFO		= NAN_CMD(WL_NAN_CMD_SCHED_COMP_ID, 0x01),
10175 
10176 	/* Nan Save-Restore XTLVs */
10177 	WL_NAN_XTLV_NSR2_PEER		= NAN_CMD(WL_NAN_CMD_NSR_COMP_ID, 0x21),
10178 	WL_NAN_XTLV_NSR2_NDP		= NAN_CMD(WL_NAN_CMD_NSR_COMP_ID, 0x22),
10179 
10180 	/* Host offload XTLVs */
10181 	WL_NAN_XTLV_NANHO_PEER_ENTRY	= NAN_CMD(WL_NAN_CMD_NANHO_COMP_ID, 0x01),
10182 	WL_NAN_XTLV_NANHO_DCAPLIST	= NAN_CMD(WL_NAN_CMD_NANHO_COMP_ID, 0x02),
10183 	WL_NAN_XTLV_NANHO_DCSLIST	= NAN_CMD(WL_NAN_CMD_NANHO_COMP_ID, 0x03),
10184 	WL_NAN_XTLV_NANHO_BLOB		= NAN_CMD(WL_NAN_CMD_NANHO_COMP_ID, 0x04),
10185 	WL_NAN_XTLV_NANHO_NDP_STATE	= NAN_CMD(WL_NAN_CMD_NANHO_COMP_ID, 0x05),
10186 	WL_NAN_XTLV_NANHO_FRM_TPLT	= NAN_CMD(WL_NAN_CMD_NANHO_COMP_ID, 0x06),
10187 	WL_NAN_XTLV_NANHO_OOB_NAF	= NAN_CMD(WL_NAN_CMD_NANHO_COMP_ID, 0x07)
10188 } wl_nan_tlv_t;
10189 
10190 /* Sub Module ID's for NAN */
10191 enum {
10192 	NAN_MAC =		0,	/* nan mac */
10193 	NAN_DISC =		1,	/* nan discovery */
10194 	NAN_DBG =		2,	/* nan debug */
10195 	NAN_SCHED =		3,	/* nan sched */
10196 	NAN_PEER_ENTRY =	4,	/* nan peer entry */
10197 	NAN_AVAIL =		5,	/* nan avail */
10198 	NAN_DAM =		6,	/* nan dam */
10199 	NAN_FSM =		7, /* nan fsm registry */
10200 	NAN_NDP =		8,	/* nan ndp */
10201 	NAN_NDL =		9,	/* nan ndl */
10202 	NAN_DP =		10,	/* nan dp core */
10203 	NAN_RNG =		11,	/* nan ranging */
10204 	NAN_SEC =		12,	/* nan sec */
10205 	NAN_LAST =		13
10206 };
10207 
10208 enum wl_nan_sub_cmd_xtlv_id {
10209 
10210 	/* Special command - Tag zero */
10211 	WL_NAN_CMD_GLB_NAN_VER = NAN_CMD(WL_NAN_CMD_GLOBAL, 0x00),
10212 
10213 	 /* nan cfg sub-commands */
10214 
10215 	WL_NAN_CMD_CFG_NAN_INIT = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x01),
10216 	WL_NAN_CMD_CFG_ROLE = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x02),
10217 	WL_NAN_CMD_CFG_HOP_CNT = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x03),
10218 	WL_NAN_CMD_CFG_HOP_LIMIT = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x04),
10219 	WL_NAN_CMD_CFG_WARMUP_TIME = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x05),
10220 	WL_NAN_CMD_CFG_STATUS = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x06),
10221 	WL_NAN_CMD_CFG_OUI = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x07),
10222 	WL_NAN_CMD_CFG_COUNT = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x08),
10223 	WL_NAN_CMD_CFG_CLEARCOUNT = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x09),
10224 	WL_NAN_CMD_CFG_CHANNEL = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0A),
10225 	WL_NAN_CMD_CFG_BAND = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0B),
10226 	WL_NAN_CMD_CFG_CID = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0C),
10227 	WL_NAN_CMD_CFG_IF_ADDR = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0D),
10228 	WL_NAN_CMD_CFG_BCN_INTERVAL = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0E),
10229 	WL_NAN_CMD_CFG_SDF_TXTIME = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x0F),
10230 	WL_NAN_CMD_CFG_SID_BEACON = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x10),
10231 	WL_NAN_CMD_CFG_DW_LEN = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x11),
10232 	WL_NAN_CMD_CFG_AVAIL = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x12),
10233 	WL_NAN_CMD_CFG_WFA_TM = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x13),
10234 	WL_NAN_CMD_CFG_EVENT_MASK =  NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x14),
10235 	WL_NAN_CMD_CFG_NAN_CONFIG = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x15), /* ctrl */
10236 	WL_NAN_CMD_CFG_NAN_ENAB = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x16),
10237 	WL_NAN_CMD_CFG_ULW = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x17),
10238 	WL_NAN_CMD_CFG_NAN_CONFIG2 = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x18), /* ctrl2 */
10239 	WL_NAN_CMD_CFG_DEV_CAP = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x19),
10240 	WL_NAN_CMD_CFG_SCAN_PARAMS = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x1A),
10241 	WL_NAN_CMD_CFG_VNDR_PAYLOAD = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x1B),
10242 	WL_NAN_CMD_CFG_FASTDISC = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x1C),
10243 	WL_NAN_CMD_CFG_MIN_TX_RATE = NAN_CMD(WL_NAN_CMD_CFG_COMP_ID, 0x1D),
10244 	WL_NAN_CMD_CFG_MAX = WL_NAN_CMD_CFG_MIN_TX_RATE,
10245 
10246 	/* Add new commands before and update */
10247 
10248 	/* nan election sub-commands */
10249 	WL_NAN_CMD_ELECTION_HOST_ENABLE = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x01),
10250 	WL_NAN_CMD_ELECTION_METRICS_CONFIG = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x02),
10251 	WL_NAN_CMD_ELECTION_METRICS_STATE = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x03),
10252 	WL_NAN_CMD_ELECTION_LEAVE = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x03),
10253 	WL_NAN_CMD_ELECTION_MERGE = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x04),
10254 	WL_NAN_CMD_ELECTION_ADVERTISERS = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x05),
10255 	WL_NAN_CMD_ELECTION_RSSI_THRESHOLD = NAN_CMD(WL_NAN_CMD_ELECTION_COMP_ID, 0x06),
10256 	WL_NAN_CMD_ELECTION_MAX = WL_NAN_CMD_ELECTION_RSSI_THRESHOLD,
10257 	/* New commands go before and update */
10258 
10259 	/* nan SD sub-commands */
10260 	WL_NAN_CMD_SD_PARAMS = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x01),
10261 	WL_NAN_CMD_SD_PUBLISH = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x02),
10262 	WL_NAN_CMD_SD_PUBLISH_LIST = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x03),
10263 	WL_NAN_CMD_SD_CANCEL_PUBLISH = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x04),
10264 	WL_NAN_CMD_SD_SUBSCRIBE = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x05),
10265 	WL_NAN_CMD_SD_SUBSCRIBE_LIST = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x06),
10266 	WL_NAN_CMD_SD_CANCEL_SUBSCRIBE = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x07),
10267 	WL_NAN_CMD_SD_VND_INFO = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x08),
10268 	WL_NAN_CMD_SD_STATS = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x09),
10269 	WL_NAN_CMD_SD_TRANSMIT = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0A),
10270 	WL_NAN_CMD_SD_FUP_TRANSMIT = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0B),
10271 	WL_NAN_CMD_SD_CONNECTION = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0C),
10272 	WL_NAN_CMD_SD_SHOW = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0D),
10273 	WL_NAN_CMD_SD_DISC_CACHE_TIMEOUT = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0E),
10274 	WL_NAN_CMD_SD_DISC_CACHE_CLEAR = NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x0F),
10275 	WL_NAN_CMD_SD_MAX = WL_NAN_CMD_SD_DISC_CACHE_CLEAR,
10276 
10277 	/* nan time sync sub-commands */
10278 
10279 	WL_NAN_CMD_SYNC_SOCIAL_CHAN = NAN_CMD(WL_NAN_CMD_SYNC_COMP_ID, 0x01),
10280 	WL_NAN_CMD_SYNC_AWAKE_DWS = NAN_CMD(WL_NAN_CMD_SYNC_COMP_ID, 0x02),
10281 	WL_NAN_CMD_SYNC_BCN_RSSI_NOTIF_THRESHOLD = NAN_CMD(WL_NAN_CMD_SYNC_COMP_ID, 0x03),
10282 	WL_NAN_CMD_SYNC_MAX = WL_NAN_CMD_SYNC_BCN_RSSI_NOTIF_THRESHOLD,
10283 
10284 	/* nan2 commands */
10285 	WL_NAN_CMD_DATA_CONFIG = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x01),
10286 	WL_NAN_CMD_DATA_RSVD02 = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x02),
10287 	WL_NAN_CMD_DATA_RSVD03 = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x03),
10288 	WL_NAN_CMD_DATA_DATAREQ = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x04),
10289 	WL_NAN_CMD_DATA_DATARESP = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x05),
10290 	WL_NAN_CMD_DATA_DATAEND = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x06),
10291 	WL_NAN_CMD_DATA_SCHEDUPD = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x07),
10292 	WL_NAN_CMD_DATA_RSVD08 = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x08),
10293 	WL_NAN_CMD_DATA_CAP = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x9),
10294 	WL_NAN_CMD_DATA_STATUS = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0A),
10295 	WL_NAN_CMD_DATA_STATS = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0B),
10296 	WL_NAN_CMD_DATA_RSVD0C = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0C),
10297 	WL_NAN_CMD_DATA_NDP_SHOW = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0D),
10298 	WL_NAN_CMD_DATA_DATACONF = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0E),
10299 	WL_NAN_CMD_DATA_MIN_TX_RATE = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x0F),
10300 	WL_NAN_CMD_DATA_MAX_PEERS = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x10),
10301 	WL_NAN_CMD_DATA_DP_IDLE_PERIOD = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x11),
10302 	WL_NAN_CMD_DATA_DP_OPAQUE_INFO = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x12),
10303 	WL_NAN_CMD_DATA_DP_HB_DURATION = NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x13),
10304 	WL_NAN_CMD_DATA_PATH_MAX = WL_NAN_CMD_DATA_DP_HB_DURATION, /* New ones before and update */
10305 
10306 	/* nan dam sub-commands */
10307 	WL_NAN_CMD_DAM_CFG = NAN_CMD(WL_NAN_CMD_DAM_COMP_ID, 0x01),
10308 	WL_NAN_CMD_DAM_MAX = WL_NAN_CMD_DAM_CFG,  /* New ones before and update */
10309 
10310 	/* nan2.0 ranging commands */
10311 	WL_NAN_CMD_RANGE_REQUEST = NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x01),
10312 	WL_NAN_CMD_RANGE_AUTO = NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x02),
10313 	WL_NAN_CMD_RANGE_RESPONSE = NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x03),
10314 	WL_NAN_CMD_RANGE_CANCEL = NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x04),
10315 	WL_NAN_CMD_RANGE_IDLE_COUNT = NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x05),
10316 	WL_NAN_CMD_RANGE_CANCEL_EXT = NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x06),
10317 
10318 	/*  nan debug sub-commands  */
10319 	WL_NAN_CMD_DBG_SCAN_PARAMS = NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x01),
10320 	WL_NAN_CMD_DBG_SCAN = NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x02),
10321 	WL_NAN_CMD_DBG_SCAN_RESULTS =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x03),
10322 	/* This is now moved under CFG */
10323 	WL_NAN_CMD_DBG_EVENT_MASK =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x04),
10324 	WL_NAN_CMD_DBG_EVENT_CHECK =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x05),
10325 	WL_NAN_CMD_DBG_DUMP =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x06),
10326 	WL_NAN_CMD_DBG_CLEAR =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x07),
10327 	WL_NAN_CMD_DBG_RSSI =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x08),
10328 	WL_NAN_CMD_DBG_DEBUG =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x09),
10329 	WL_NAN_CMD_DBG_TEST1 =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0A),
10330 	WL_NAN_CMD_DBG_TEST2 =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0B),
10331 	WL_NAN_CMD_DBG_TEST3 =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0C),
10332 	WL_NAN_CMD_DBG_DISC_RESULTS =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0D),
10333 	WL_NAN_CMD_DBG_STATS =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0E),
10334 	WL_NAN_CMD_DBG_LEVEL =  NAN_CMD(WL_NAN_CMD_DBG_COMP_ID, 0x0F),
10335 	WL_NAN_CMD_DBG_MAX = WL_NAN_CMD_DBG_LEVEL, /* New ones before and update */
10336 
10337 	 /* Generic componenet */
10338 	WL_NAN_CMD_GEN_STATS = NAN_CMD(WL_NAN_CMD_GENERIC_COMP_ID, 0x01),
10339 	WL_NAN_CMD_GEN_FW_CAP = NAN_CMD(WL_NAN_CMD_GENERIC_COMP_ID, 0x02),
10340 	WL_NAN_CMD_GEN_MAX = WL_NAN_CMD_GEN_FW_CAP,
10341 
10342 	/* NAN Save-Restore */
10343 	WL_NAN_CMD_NSR2 = NAN_CMD(WL_NAN_CMD_NSR_COMP_ID, 0x20),
10344 	WL_NAN_CMD_NSR2_MAX = WL_NAN_CMD_NSR2,
10345 
10346 	/* Host offload sub-commands */
10347 	WL_NAN_CMD_NANHO_UPDATE = NAN_CMD(WL_NAN_CMD_NANHO_COMP_ID, 0x01),
10348 	WL_NAN_CMD_NANHO_FRM_TPLT = NAN_CMD(WL_NAN_CMD_NANHO_COMP_ID, 0x02),
10349 	WL_NAN_CMD_NANHO_OOB_NAF = NAN_CMD(WL_NAN_CMD_NANHO_COMP_ID, 0x03),
10350 	WL_NAN_CMD_NANHO_MAX = WL_NAN_CMD_NANHO_OOB_NAF
10351 };
10352 
10353 /*
10354  * Component/Module based NAN TLV IDs for NAN stats
10355  */
10356 typedef enum wl_nan_stats_tlv {
10357 	WL_NAN_XTLV_SYNC_MAC_STATS		= NAN_CMD(WL_NAN_CMD_SYNC_COMP_ID, 0x01),
10358 
10359 	WL_NAN_XTLV_SD_DISC_STATS		= NAN_CMD(WL_NAN_CMD_SD_COMP_ID, 0x01),
10360 
10361 	WL_NAN_XTLV_DATA_NDP_STATS		= NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x01),
10362 	WL_NAN_XTLV_DATA_NDL_STATS		= NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x02),
10363 	WL_NAN_XTLV_DATA_SEC_STATS		= NAN_CMD(WL_NAN_CMD_DATA_COMP_ID, 0x03),
10364 
10365 	WL_NAN_XTLV_GEN_SCHED_STATS		= NAN_CMD(WL_NAN_CMD_GENERIC_COMP_ID, 0x01),
10366 	WL_NAN_XTLV_GEN_PEER_STATS		= NAN_CMD(WL_NAN_CMD_GENERIC_COMP_ID, 0x02),
10367 	WL_NAN_XTLV_GEN_PEER_STATS_DEVCAP	= NAN_CMD(WL_NAN_CMD_GENERIC_COMP_ID, 0x03),
10368 	WL_NAN_XTLV_GEN_PEER_STATS_NDP		= NAN_CMD(WL_NAN_CMD_GENERIC_COMP_ID, 0x04),
10369 	WL_NAN_XTLV_GEN_PEER_STATS_SCHED	= NAN_CMD(WL_NAN_CMD_GENERIC_COMP_ID, 0x05),
10370 	WL_NAN_XTLV_GEN_AVAIL_STATS_SCHED	= NAN_CMD(WL_NAN_CMD_GENERIC_COMP_ID, 0x06),
10371 	WL_NAN_XTLV_GEN_NDP_STATS               = NAN_CMD(WL_NAN_CMD_GENERIC_COMP_ID, 0x07),
10372 
10373 	WL_NAN_XTLV_DAM_STATS			= NAN_CMD(WL_NAN_CMD_DAM_COMP_ID, 0x01),
10374 	WL_NAN_XTLV_DAM_AVAIL_STATS		= NAN_CMD(WL_NAN_CMD_DAM_COMP_ID, 0x02),
10375 
10376 	WL_NAN_XTLV_RANGE_STATS			= NAN_CMD(WL_NAN_CMD_RANGE_COMP_ID, 0x01)
10377 } wl_nan_stats_tlv_t;
10378 
10379 /* NAN stats WL_NAN_CMD_GEN_STATS command */
10380 /* Input data */
10381 typedef struct wl_nan_cmn_get_stat {
10382 	uint32	modules_btmap;	/* Bitmap to indicate module stats are needed:
10383 				 * See NAN Sub Module ID's above
10384 				 */
10385 	uint8	operation;	/* Get, Get and Clear */
10386 	uint8	arg1;		/* Submodule control variable1 */
10387 	uint8	arg2;		/* Submodule control variable2 */
10388 	uint8	pad;		/* May not be needed as TLV's are aligned,add to pass compile chk */
10389 } wl_nan_cmn_get_stat_t;
10390 
10391 /* Output for Stats container */
10392 typedef struct wl_nan_cmn_stat {
10393 	uint32	n_stats;	/* Number of different sub TLV stats present in the container */
10394 	uint32	totlen;		/* Total Length of stats data in container */
10395 	uint8   stats_tlvs [];	/* Stat TLV's container */
10396 } wl_nan_cmn_stat_t;
10397 
10398 /* Defines for operation */
10399 #define WLA_NAN_STATS_GET	0
10400 #define WLA_NAN_STATS_GET_CLEAR	1
10401 
10402 #define WL_NAN_STAT_ALL 0xFFFFFFFF
10403 
10404 /* NAN Mac stats */
10405 
10406 typedef struct wl_nan_mac_band_stats {
10407 	uint32 bcn_tx;	/* 2g/5g disc/sync beacon tx count */
10408 	uint32 bcn_rx;	/* 2g/5g disc/sync beacon rx count */
10409 	uint32 dws;	/* Number of 2g/5g DW's */
10410 } wl_nan_mac_band_stats_t;
10411 
10412 /* Note: if this struct is changing update wl_nan_slot_ecounters_vX_t version,
10413  * as this struct is sent as payload in wl_nan_slot_ecounter_vX_ts
10414  */
10415 typedef struct wl_nan_mac_stats {
10416 	wl_nan_mac_band_stats_t	band[NAN_MAX_BANDS];	/* MAC sync band specific stats */
10417 	uint32 naf_tx;			/* NAN AF tx */
10418 	uint32 naf_rx;			/* NAN AF rx */
10419 	uint32 sdf_tx;			/* SDF tx */
10420 	uint32 sdf_rx;			/* SDF rx */
10421 } wl_nan_mac_stats_t;
10422 
10423 /* NAN Sched stats */
10424 /* Per core Sched stats */
10425 typedef struct nan_sched_stats_core {
10426 	uint32	slotstart;		/* slot_start */
10427 	uint32	slotend;		/* slot_end */
10428 	uint32	slotskip;		/* slot_skip */
10429 	uint32	slotstart_partial;	/* slot resume */
10430 	uint32	slotend_partial;	/* slot pre-empt */
10431 	uint8   avail_upd_cnt;		/* count to track num of times avail has been updated */
10432 	uint8	pad[3];
10433 } nan_sched_stats_core_t;
10434 /* Common Sched stats */
10435 typedef struct nan_sched_stats_cmn {
10436 	uint32	slot_adj_dw;	/* Slot adjusts due to DW changes */
10437 	uint32	slot_dur;	/* Total slot duration in TU's */
10438 } nan_sched_stats_cmn_t;
10439 
10440 /* Note: if this struct is changing update wl_nan_slot_ecounters_vX_t version,
10441  * as this struct is sent as payload in wl_nan_slot_ecounters_vX_t
10442  */
10443 typedef struct nan_sched_stats {
10444 	nan_sched_stats_cmn_t cmn;
10445 	nan_sched_stats_core_t slice[MAX_NUM_D11CORES];
10446 } nan_sched_stats_t;
10447 /* End NAN Sched stats */
10448 
10449 /* NAN Discovery stats */
10450 typedef struct nan_disc_stats {
10451 	uint32 pub_tx;		/* Publish tx */
10452 	uint32 pub_rx;		/* Publish rx */
10453 	uint32 sub_tx;		/* Subscribe tx */
10454 	uint32 sub_rx;		/* Subscribe rx */
10455 	uint32 fup_tx;		/* Followup tx */
10456 	uint32 fup_rx;		/* Followup rx */
10457 	uint32 pub_resp_ignored;	/* response to incoming publish ignored */
10458 	uint32 sub_resp_ignored;	/* response to incoming subscribe ignored */
10459 } nan_disc_stats_t;
10460 /* NAN Discovery stats end */
10461 
10462 /* statistics for nan sec */
10463 typedef struct nan_sec_stats_s {
10464 	uint32 mic_fail;		/* rx mic fail */
10465 	uint32 replay_fail;		/* replay counter */
10466 	uint32 tx_fail;			/* tx fail (from txstatus) */
10467 	uint32 key_info_err;		/* key info field err */
10468 	uint32 ok_sessions;		/* successful mx negotiations */
10469 	uint32 fail_sessions;		/* failed sessions */
10470 	uint32 keydesc_err;		/* key desc error */
10471 	uint32 invalid_cipher;		/* cipher suite not valid */
10472 	uint32 pmk_not_found;		/* no pmk found for given service or for any reason */
10473 	uint32 no_pmk_for_pmkid;	/* no pmk found for give pmkid */
10474 	uint32 key_install_err;		/* failed to install keys */
10475 	uint32 no_keydesc_attr;		/* key desc attr missing */
10476 	uint32 nonce_mismatch;		/* nonce mismatch */
10477 } nan_sec_stats_t;
10478 
10479 /* WL_NAN_XTLV_GEN_PEER_STATS */
10480 typedef struct wl_nan_peer_stats {
10481 	struct ether_addr nmi;
10482 	uint8 pad[2];
10483 	uint32 pkt_enq; /* counter for queued pkt of peer */
10484 
10485 	/* NDL */
10486 	bool ndl_exist;
10487 	uint8 ndl_state;
10488 	bool counter_proposed;
10489 	uint8 pad1;
10490 
10491 	/* NDL QoS */
10492 	uint16 local_max_latency;
10493 	uint16 peer_max_latency;
10494 	uint8 local_min_slots;
10495 	uint8 peer_min_slots;
10496 
10497 	/* security association */
10498 	struct ether_addr sec_laddr;	/* local mac addr */
10499 	struct ether_addr sec_raddr;	/* remote mac addr */
10500 	uint8 sec_csid;
10501 	uint8 pad2;
10502 } wl_nan_peer_stats_t;
10503 
10504 /* WL_NAN_XTLV_GEN_PEER_STATS_DEVCAP */
10505 typedef struct wl_nan_peer_stats_dev_cap {
10506 	uint8 mapid;
10507 	uint8 awake_dw_2g;
10508 	uint8 awake_dw_5g;
10509 	uint8 bands_supported;
10510 	uint8 op_mode;
10511 	uint8 num_antennas;
10512 	uint16 chan_switch_time;
10513 	uint8 capabilities;
10514 	uint8 pad[3];
10515 } wl_nan_peer_stats_dev_cap_t;
10516 
10517 /* WL_NAN_XTLV_GEN_PEER_STATS_NDP */
10518 typedef struct wl_nan_peer_stats_ndp {
10519 	uint8 peer_role;
10520 	uint8 ndp_state;
10521 	uint8 indp_id;	/* initiator ndp id */
10522 	uint8 ndp_ctrl;	/* ndp control field */
10523 	struct ether_addr peer_nmi;
10524 	struct ether_addr peer_ndi;
10525 	struct ether_addr local_ndi;
10526 
10527 	/* peer scb info */
10528 	bool scb_allocated;
10529 	bool scb_found;
10530 	uint32 scb_flags;
10531 	uint32 scb_flags2;
10532 	uint32 scb_flags3;
10533 } wl_nan_peer_stats_ndp_t;
10534 
10535 enum {
10536 	WL_NAN_SCHED_STAT_SLOT_COMM	= 0x01,	/* Committed slot */
10537 	WL_NAN_SCHED_STAT_SLOT_COND	= 0x02,	/* Conditional slot(proposal/counter) */
10538 	WL_NAN_SCHED_STAT_SLOT_NDC	= 0x04,	/* NDC slot */
10539 	WL_NAN_SCHED_STAT_SLOT_IMMUT	= 0x08,	/* Immutable slot */
10540 	WL_NAN_SCHED_STAT_SLOT_RANGE	= 0x10, /* Ranging slot */
10541 };
10542 typedef uint16 wl_nan_stats_sched_slot_info_t;
10543 
10544 typedef struct wl_nan_stats_sched_slot {
10545 	wl_nan_stats_sched_slot_info_t info;	/* capture slot type and more info */
10546 	chanspec_t chanspec;
10547 } wl_nan_stats_sched_slot_t;
10548 
10549 /* WL_NAN_XTLV_GEN_PEER_STATS_SCHED, WL_NAN_XTLV_GEN_AVAIL_STATS_SCHED */
10550 typedef struct wl_nan_stats_sched {
10551 	uint8 map_id;
10552 	uint8 seq_id;	/* seq id from NA attr */
10553 	uint8 slot_dur;
10554 	uint8 pad;
10555 	uint16 period;
10556 	uint16 num_slot;
10557 	wl_nan_stats_sched_slot_t slot[];
10558 } wl_nan_stats_sched_t;
10559 
10560 /* WL_NAN_XTLV_GEN_PEER_STATS_SCHED */
10561 typedef struct wl_nan_peer_stats_sched {
10562 	uint8 map_id;
10563 	uint8 seq_id;	/* seq id from NA attr */
10564 	uint8 slot_dur;
10565 	uint8 pad;
10566 	uint16 period;
10567 	uint16 num_slot;
10568 	wl_nan_stats_sched_slot_t slot[];
10569 } wl_nan_peer_stats_sched_t;
10570 
10571 /* WL_NAN_XTLV_RANGE_STATS  */
10572 typedef struct wl_nan_range_stats {
10573 	uint16 rng_ssn_estb;
10574 	uint16 rng_ssn_fail;
10575 	uint16 rng_sched_start;
10576 	uint16 rng_sched_end;
10577 	uint16 ftm_ssn_success; /* number of succesfull ftm sessions */
10578 	uint16 ftm_ssn_fail;
10579 	uint16 num_meas; /* number of ftm frames */
10580 	uint16 num_valid_meas; /* number of ftm frames with valid timestamp */
10581 } wl_nan_range_stats_t;
10582 
10583 /* defines for ndp stats flag */
10584 
10585 #define NAN_NDP_STATS_FLAG_ROLE_MASK                      0x01
10586 #define NAN_NDP_STATS_FLAG_ROLE_INIT                      0x00
10587 #define NAN_NDP_STATS_FLAG_ROLE_RESP                      0x01
10588 
10589 #define NAN_NDP_STATS_STATE_BIT_SHIFT                     1
10590 #define NAN_NDP_STATS_FLAG_STATE_MASK                     0x07
10591 #define NAN_NDP_STATS_FLAG_STATE_IN_PROG                  0x00
10592 #define NAN_NDP_STATS_FLAG_STATE_ESTB                     0x01
10593 #define NAN_NDP_STATS_FLAG_STATE_TEARDOWN_WAIT            0x02
10594 /* More states can be added here, when needed */
10595 
10596 /* WL_NAN_XTLV_GEN_NDP_STATS */
10597 typedef struct wl_nan_ndp_stats_s {
10598 	uint8 ndp_id;
10599 	uint8 indp_id;
10600 	uint8 flags;
10601 	uint8 nan_sec_csid;
10602 	struct ether_addr lndi_addr;
10603 	struct ether_addr pnmi_addr;
10604 	struct ether_addr pndi_addr;
10605 	uint8 PAD[2];
10606 } wl_nan_ndp_stats_t;
10607 
10608 /* WL_NAN_XTLV_EV_SLOT_INFO */
10609 typedef struct wl_nan_slot_info_s {
10610 	/* dw slot start expected */
10611 	uint32	dwst_h;
10612 	uint32	dwst_l;
10613 	/* dw slot start actual */
10614 	uint32	act_dwst_h;
10615 	uint32	act_dwst_l;
10616 	uint16	cur_chan[MAX_NUM_D11CORES];	/* sdb channels */
10617 	uint16	dw_chan;	/* dw channel */
10618 	uint8	dw_no;		/* dw number */
10619 	uint8	slot_seq_no;	/* slot seq no. */
10620 } wl_nan_slot_info_t;
10621 
10622 /* WL_NAN_EVENT_MR_CHANGED */
10623 typedef uint8 wl_nan_mr_changed_t;
10624 #define WL_NAN_AMR_CHANGED	1
10625 #define WL_NAN_IMR_CHANGED	2
10626 
10627 /** status - TBD BCME_ vs NAN status - range reserved for BCME_ */
10628 enum {
10629 	/* add new status here... */
10630 	WL_NAN_E_PEER_NOTAVAIL		= -2131,
10631 	WL_NAN_E_SCB_EXISTS		= -2130,
10632 	WL_NAN_E_INVALID_PEER_NDI	= -2129,
10633 	WL_NAN_E_INVALID_LOCAL_NDI	= -2128,
10634 	WL_NAN_E_ALREADY_EXISTS		= -2127,	/* generic NAN error for duplication */
10635 	WL_NAN_E_EXCEED_MAX_NUM_MAPS	= -2126,
10636 	WL_NAN_E_INVALID_DEV_CHAN_SCHED	= -2125,
10637 	WL_NAN_E_INVALID_PEER_BLOB_TYPE	= -2124,
10638 	WL_NAN_E_INVALID_LCL_BLOB_TYPE	= -2123,
10639 	WL_NAN_E_BCMC_PDPA		= -2122,	/* BCMC NAF PDPA */
10640 	WL_NAN_E_TIMEOUT		= -2121,
10641 	WL_NAN_E_HOST_CFG		= -2120,
10642 	WL_NAN_E_NO_ACK			= -2119,
10643 	WL_NAN_E_SECINST_FAIL		= -2118,
10644 	WL_NAN_E_REJECT_NDL		= -2117,	/* generic NDL rejection error */
10645 	WL_NAN_E_INVALID_NDP_ATTR	= -2116,
10646 	WL_NAN_E_HOST_REJECTED		= -2115,
10647 	WL_NAN_E_PCB_NORESOURCE		= -2114,
10648 	WL_NAN_E_NDC_EXISTS		= -2113,
10649 	WL_NAN_E_NO_NDC_ENTRY_AVAIL	= -2112,
10650 	WL_NAN_E_INVALID_NDC_ENTRY      = -2111,
10651 	WL_NAN_E_SD_TX_LIST_FULL        = -2110,
10652 	WL_NAN_E_SVC_SUB_LIST_FULL      = -2109,
10653 	WL_NAN_E_SVC_PUB_LIST_FULL      = -2108,
10654 	WL_NAN_E_SDF_MAX_LEN_EXCEEDED   = -2107,
10655 	WL_NAN_E_ZERO_CRB		= -2106,	/* no CRB between local and peer */
10656 	WL_NAN_E_PEER_NDC_NOT_SELECTED	= -2105,	/* peer ndc not selected */
10657 	WL_NAN_E_DAM_CHAN_CONFLICT	= -2104,	/* dam schedule channel conflict */
10658 	WL_NAN_E_DAM_SCHED_PERIOD	= -2103,	/* dam schedule period mismatch */
10659 	WL_NAN_E_LCL_NDC_NOT_SELECTED	= -2102,	/* local selected ndc not configured */
10660 	WL_NAN_E_NDL_QOS_INVALID_NA	= -2101,	/* na doesn't comply with ndl qos */
10661 	WL_NAN_E_CLEAR_NAF_WITH_SA_AS_RNDI = -2100,	/* rx clear naf with peer rndi */
10662 	WL_NAN_E_SEC_CLEAR_PKT		= -2099,	/* rx clear pkt from a peer with sec_sa */
10663 	WL_NAN_E_PROT_NON_PDPA_NAF	= -2098,	/* rx protected non PDPA frame */
10664 	WL_NAN_E_DAM_DOUBLE_REMOVE	= -2097,	/* remove peer schedule already removed */
10665 	WL_NAN_E_DAM_DOUBLE_MERGE	= -2096,	/* merge peer schedule already merged */
10666 	WL_NAN_E_DAM_REJECT_INVALID	= -2095,	/* reject for invalid schedule */
10667 	WL_NAN_E_DAM_REJECT_RANGE	= -2094,
10668 	WL_NAN_E_DAM_REJECT_QOS		= -2093,
10669 	WL_NAN_E_DAM_REJECT_NDC		= -2092,
10670 	WL_NAN_E_DAM_REJECT_PEER_IMMUT	= -2091,
10671 	WL_NAN_E_DAM_REJECT_LCL_IMMUT	= -2090,
10672 	WL_NAN_E_DAM_EXCEED_NUM_SCHED	= -2089,
10673 	WL_NAN_E_DAM_INVALID_SCHED_MAP	= -2088,	/* invalid schedule map list */
10674 	WL_NAN_E_DAM_INVALID_LCL_SCHED	= -2087,
10675 	WL_NAN_E_INVALID_MAP_ID		= -2086,
10676 	WL_NAN_E_CHAN_OVERLAP_ACROSS_MAP = -2085,
10677 	WL_NAN_E_INVALID_CHAN_LIST	= -2084,
10678 	WL_NAN_E_INVALID_RANGE_TBMP	= -2083,
10679 	WL_NAN_E_INVALID_IMMUT_SCHED	= -2082,
10680 	WL_NAN_E_INVALID_NDC_ATTR	= -2081,
10681 	WL_NAN_E_INVALID_TIME_BITMAP	= -2080,
10682 	WL_NAN_E_INVALID_NA_ATTR	= -2079,
10683 	WL_NAN_E_NO_NA_ATTR_IN_AVAIL_MAP = -2078,	/* no na attr saved in avail map */
10684 	WL_NAN_E_INVALID_MAP_IDX	= -2077,
10685 	WL_NAN_E_SEC_SA_NOTFOUND	= -2076,
10686 	WL_NAN_E_BSSCFG_NOTFOUND	= -2075,
10687 	WL_NAN_E_SCB_NOTFOUND		= -2074,
10688 	WL_NAN_E_NCS_SK_KDESC_TYPE      = -2073,
10689 	WL_NAN_E_NCS_SK_KEY_DESC_VER    = -2072,	/* key descr ver */
10690 	WL_NAN_E_NCS_SK_KEY_TYPE        = -2071,	/* key descr type */
10691 	WL_NAN_E_NCS_SK_KEYINFO_FAIL    = -2070,	/* key info (generic) */
10692 	WL_NAN_E_NCS_SK_KEY_LEN         = -2069,	/* key len */
10693 	WL_NAN_E_NCS_SK_KDESC_NOT_FOUND = -2068,	/* key desc not found */
10694 	WL_NAN_E_NCS_SK_INVALID_PARAMS  = -2067,	/* invalid args */
10695 	WL_NAN_E_NCS_SK_KDESC_INVALID   = -2066,	/* key descr is not valid */
10696 	WL_NAN_E_NCS_SK_NONCE_MISMATCH  = -2065,
10697 	WL_NAN_E_NCS_SK_KDATA_SAVE_FAIL = -2064,	/* not able to save key data */
10698 	WL_NAN_E_NCS_SK_AUTH_TOKEN_CALC_FAIL = -2063,
10699 	WL_NAN_E_NCS_SK_PTK_CALC_FAIL   = -2062,
10700 	WL_NAN_E_INVALID_STARTOFFSET	= -2061,
10701 	WL_NAN_E_BAD_NA_ENTRY_TYPE	= -2060,
10702 	WL_NAN_E_INVALID_CHANBMP	= -2059,
10703 	WL_NAN_E_INVALID_OP_CLASS	= -2058,
10704 	WL_NAN_E_NO_IES			= -2057,
10705 	WL_NAN_E_NO_PEER_ENTRY_AVAIL	= -2056,
10706 	WL_NAN_E_INVALID_PEER		= -2055,
10707 	WL_NAN_E_PEER_EXISTS		= -2054,
10708 	WL_NAN_E_PEER_NOTFOUND		= -2053,
10709 	WL_NAN_E_NO_MEM			= -2052,
10710 	WL_NAN_E_INVALID_OPTION		= -2051,
10711 	WL_NAN_E_INVALID_BAND		= -2050,
10712 	WL_NAN_E_INVALID_MAC		= -2049,
10713 	WL_NAN_E_BAD_INSTANCE		= -2048,
10714 	/* NAN status code reserved from -2048 to -3071 */
10715 	WL_NAN_E_ERROR			= -1,
10716 	WL_NAN_E_OK			= 0
10717 };
10718 
10719 /* Error codes used in vendor specific attribute in Data Path Termination frames */
10720 enum {
10721 	WL_NAN_DPEND_E_OK		= 0,
10722 	WL_NAN_DPEND_E_ERROR		= 1,
10723 	WL_NAN_DPEND_E_HOST_CMD		= 2,
10724 	WL_NAN_DPEND_E_HOST_REJECTED	= 3,	/* host rejected rx frame  */
10725 	WL_NAN_DPEND_E_RESOURCE_LIMIT	= 4,
10726 	WL_NAN_DPEND_E_NO_ACK_RCV	= 5,
10727 	WL_NAN_DPEND_E_TIMEOUT		= 6,
10728 	WL_NAN_DPEND_E_NO_ELT		= 7,	/* rx frame missing element container */
10729 	WL_NAN_DPEND_E_NO_NDP_ATTR	= 8,
10730 	WL_NAN_DPEND_E_NO_AVAIL_ATTR	= 9,
10731 	WL_NAN_DPEND_E_NO_NDC_ATTR	= 10,
10732 	WL_NAN_DPEND_E_NO_RANGE_BM	= 11,
10733 	WL_NAN_DPEND_E_INVALID_NDP_ATTR	= 12,
10734 	WL_NAN_DPEND_E_INVALID_NDC_ATTR	= 13,
10735 	WL_NAN_DPEND_E_INVALID_IMMUT	= 14,
10736 	WL_NAN_DPEND_E_INVALID_NDL_QOS	= 15,
10737 	WL_NAN_DPEND_E_INVALID_SEC_PARAMS = 16,
10738 	WL_NAN_DPEND_E_REJECT_AVAIL	= 17,
10739 	WL_NAN_DPEND_E_REJECT_NDL	= 18
10740 };
10741 
10742 typedef int32 wl_nan_status_t;
10743 
10744 /** nan cmd list entry  */
10745 enum wl_nan_sub_cmd_input_flags {
10746 	WL_NAN_SUB_CMD_FLAG_NONE = 0,
10747 	WL_NAN_SUB_CMD_FLAG_SKIP = 1, /* Skip to next sub-command on error */
10748 	WL_NAN_SUB_CMD_FLAG_TERMINATE = 2, /* Terminate processing and return */
10749 	WL_NAN_SUB_CMD_FLAG_LAST /* Keep this at the end */
10750 };
10751 
10752 /** container for nan events */
10753 typedef struct wl_nan_ioc {
10754 	uint16	version;	/**< interface command or event version */
10755 	uint16	id;			/**< nan ioctl cmd  ID  */
10756 	uint16	len;		/**< total length of all tlv records in data[]  */
10757 	uint16	pad;		/**< pad to be 32 bit aligment */
10758 	uint8	data [];	/**< var len payload of bcm_xtlv_t type */
10759 } wl_nan_ioc_t;
10760 
10761 /*
10762  * NAN sub-command data structures
10763  */
10764 
10765 /*
10766  * Config component WL_NAN_CMD_CFG_XXXX sub-commands
10767  * WL_NAN_CMD_CFG_ENABLE
10768  */
10769 enum wl_nan_config_state {
10770 	WL_NAN_CONFIG_STATE_DISABLE = 0,
10771 	WL_NAN_CONFIG_STATE_ENABLE = 1
10772 };
10773 
10774 typedef int8 wl_nan_config_state_t;
10775 
10776 /* WL_NAN_CMD_CFG_NAN_INIT */
10777 
10778 typedef uint8 wl_nan_init_t;
10779 
10780 /* WL_NAN_CMD_CFG_NAN_VERSION */
10781 typedef uint16 wl_nan_ver_t;
10782 
10783 /* WL_NAN_CMD_CFG_NAN_CONFIG  */
10784 typedef uint32 wl_nan_cfg_ctrl_t;
10785 
10786 /* WL_NAN_CMD_CFG_NAN_CONFIG2 */
10787 typedef struct wl_nan_cfg_ctrl2 {
10788 	uint32 flags1; /* wl_nan_cfg_ctrl2_flags1 */
10789 	uint32 flags2; /* wl_nan_cfg_ctrl2_flags2 */
10790 } wl_nan_cfg_ctrl2_t;
10791 
10792 enum wl_nan_cfg_ctrl2_flags1 {
10793 	/* Allows unicast SDF TX while local device is under NDP/NDL negotiation,
10794 	 * but Not with the peer SDF destined to.
10795 	 */
10796 	WL_NAN_CTRL2_FLAG1_ALLOW_SDF_TX_UCAST_IN_PROG	= 0x00000001,
10797 	/* Allows broadcast SDF TX while local device is under NDP/NDL negotiation */
10798 	WL_NAN_CTRL2_FLAG1_ALLOW_SDF_TX_BCAST_IN_PROG	= 0x00000002,
10799 	/* Allows the device to send schedule update automatically on local schedule change */
10800 	WL_NAN_CTRL2_FLAG1_AUTO_SCHEDUPD		= 0x00000004,
10801 	/* Allows the device to handle slot pre_close operations */
10802 	WL_NAN_CTRL2_FLAG1_SLOT_PRE_CLOSE		= 0x00000008
10803 };
10804 #define WL_NAN_CTRL2_FLAGS1_MASK	0x0000000F
10805 
10806 #define WL_NAN_CTRL2_FLAGS2_MASK	0x00000000
10807 
10808 /*
10809  * WL_NAN_CMD_CFG_BAND, WL_NAN_CMD_CFG_RSSI_THRESHOLD(Get only)
10810  */
10811 typedef uint8 wl_nan_band_t;
10812 
10813 /*
10814  * WL_NAN_CMD_CFG_ROLE
10815  */
10816 enum wl_nan_role {
10817 	WL_NAN_ROLE_AUTO = 0,
10818 	WL_NAN_ROLE_NON_MASTER_NON_SYNC = 1,
10819 	WL_NAN_ROLE_NON_MASTER_SYNC = 2,
10820 	WL_NAN_ROLE_MASTER = 3,
10821 	WL_NAN_ROLE_ANCHOR_MASTER = 4
10822 };
10823 
10824 typedef uint8 wl_nan_role_t;
10825 
10826 typedef struct wl_nan_device_state
10827 {
10828 	wl_nan_role_t role;		/* Sync Master, Non-Sync Master */
10829 	uint8 state;	/* TBD  */
10830 	uint8 hopcount;	/* Hops to the Anchor Master */
10831 	struct ether_addr immediate_master; /* Master MAC */
10832 	struct ether_addr anchor_master;	/* Anchor Master MAC */
10833 	struct ether_addr cluster_id; /* Cluster ID to which this device belongs to */
10834 	uint8 PAD[3];
10835 	uint32 tsf_high;  /* NAN Cluster TSFs */
10836 	uint32 tsf_low;
10837 } wl_nan_device_state_t;
10838 
10839 /*
10840  * WL_NAN_CMD_CFG_HOP_CNT, WL_NAN_CMD_CFG_HOP_LIMIT
10841  */
10842 typedef uint8 wl_nan_hop_count_t;
10843 
10844 /*
10845  * WL_NAN_CMD_CFG_WARMUP_TIME
10846  */
10847 typedef uint32 wl_nan_warmup_time_ticks_t;
10848 
10849 /*
10850  * WL_NAN_CMD_CFG_RSSI_THRESHOLD
10851  * rssi_close and rssi_mid are used to transition master to non-master
10852  * role by NAN state machine. rssi thresholds corresponding to the band
10853  * will be updated.
10854  */
10855 /* To be deprecated */
10856 typedef struct wl_nan_rssi_threshold {
10857 	wl_nan_band_t band;
10858 	int8 rssi_close;
10859 	int8 rssi_mid;
10860 	uint8 pad;
10861 } wl_nan_rssi_threshold_t;
10862 
10863 /* WL_NAN_CMD_ELECTION_RSSI_THRESHOLD */
10864 
10865 typedef struct wl_nan_rssi_thld {
10866 	int8 rssi_close_2g;
10867 	int8 rssi_mid_2g;
10868 	int8 rssi_close_5g;
10869 	int8 rssi_mid_5g;
10870 } wl_nan_rssi_thld_t;
10871 
10872 /* WL_NAN_CMD_DATA_MAX_PEERS */
10873 
10874 typedef uint8 wl_nan_max_peers_t;
10875 
10876 /*
10877  * WL_NAN_CMD_CFG_STATUS
10878  */
10879 
10880 typedef enum wl_nan_election_mode {
10881 	WL_NAN_ELECTION_RUN_BY_HOST = 1,
10882 	WL_NAN_ELECTION_RUN_BY_FW = 2
10883 } wl_nan_election_mode_t;
10884 
10885 typedef struct wl_nan_conf_status {
10886 	struct ether_addr	nmi;		/*  NAN mgmt interface address */
10887 	uint8			enabled;	/* NAN is enabled */
10888 	uint8			role;		/* Current nan sync role */
10889 	struct ether_addr	cid;		/*  Current Cluster id */
10890 	uint8			social_chans[2];	/* Social channels */
10891 	uint8			mr[8];		/* Self Master Rank */
10892 	uint8			amr[8];		/* Anchor Master Rank */
10893 	uint32			ambtt;		/* Anchor master beacon target time */
10894 	uint32			cluster_tsf_h;	/* Current Cluster TSF High */
10895 	uint32			cluster_tsf_l;	/* Current Cluster TSF Low */
10896 	uint8			election_mode; /* Election mode, host or firmware */
10897 	uint8			hop_count;	/* Current Hop count */
10898 	uint8			imr[8];		/* Immediate Master Rank */
10899 	uint8			pad[4];
10900 	uint16			opt_tlvs_len;
10901 	uint8			opt_tlvs[];
10902 } wl_nan_conf_status_t;
10903 
10904 /*
10905  * WL_NAN_CMD_CFG_OUI
10906  */
10907 typedef struct wl_nan_oui_type {
10908 	uint8 nan_oui[DOT11_OUI_LEN];
10909 	uint8 type;
10910 } wl_nan_oui_type_t;
10911 
10912 /*
10913  * WL_NAN_CMD_CFG_COUNT
10914  */
10915 typedef struct wl_nan_count {
10916 	uint32 cnt_bcn_tx;		/**< TX disc/sync beacon count */
10917 	uint32 cnt_bcn_rx;		/**< RX disc/sync beacon count */
10918 	uint32 cnt_svc_disc_tx;		/**< TX svc disc frame count */
10919 	uint32 cnt_svc_disc_rx;		/**< RX svc disc frame count */
10920 } wl_nan_count_t;
10921 /*
10922  * Election component WL_NAN_CMD_ELECTION_XXXX sub-commands
10923  * WL_NAN_CMD_ELECTION_HOST_ENABLE
10924  */
10925 enum wl_nan_enable_flags {
10926 	WL_NAN_DISABLE_FLAG_HOST_ELECTION = 0,
10927 	WL_NAN_ENABLE_FLAG_HOST_ELECTION = 1
10928 };
10929 
10930 /*
10931  * 0 - disable host based election
10932  * 1 - enable host based election
10933  */
10934 typedef uint8 wl_nan_host_enable_t;
10935 
10936 /*
10937  * WL_NAN_CMD_ELECTION_METRICS_CONFIG
10938  */
10939 /* Set only */
10940 typedef struct wl_nan_election_metric_config {
10941 	uint8 random_factor; /* Configured random factor */
10942 	uint8 master_pref;	/* configured master preference */
10943 	uint8 pad[2];
10944 } wl_nan_election_metric_config_t;
10945 
10946 /*
10947  * WL_NAN_CMD_ELECTION_METRICS_STATE
10948  */
10949 /* Get only */
10950 typedef struct wl_nan_election_metric_state {
10951 	uint8 random_factor; /* random factor used in MIs */
10952 	uint8 master_pref;	 /* Master advertised in MIs */
10953 	uint8 pad[2];
10954 } wl_nan_election_metric_state_t;
10955 
10956 /*
10957  * WL_NAN_CMD_ELECTION_LEAVE
10958  * WL_NAN_CMD_ELECTION_STOP
10959  */
10960 typedef struct ether_addr wl_nan_cluster_id_t;
10961 
10962 /*
10963  * WL_NAN_CMD_ELECTION_MERGE
10964  * 0 - disable cluster merge
10965  * 1 - enable cluster merge
10966  */
10967 typedef uint8 wl_nan_merge_enable_t;
10968 
10969 /*
10970  * WL_NAN_CMD_CFG_ROLE
10971  * role = 0 means configuration by firmware(obsolete); otherwise by host
10972  * when host configures role, also need target master address to sync to
10973  */
10974 #define NAN_SYNC_MASTER_SELF	1
10975 #define NAN_SYNC_MASTER_USE_TIMING		2 	/*  Use the tsf timing provided */
10976 #define NAN_SYNC_MASTER_AMREC_UPD		4	/* provide AM record update */
10977 
10978 /*
10979 	struct ether_addr addr:
10980 	when NAN_SYNC_MASTER_USE_TIMING is set, addr is the mac of Rx NAN beacon
10981 	providing the timing info
10982 	ltsf_h, ltsf_l:
10983 	The local TSF timestamp filled in by FW in the WL_NAN_EVENT_BCN_RX event;
10984 	rtsf_h, rtsf_l:
10985 	The timestamp in the Rx beacon frame, filled in by host
10986 	uint32 ambtt:
10987 	the amtt in the cluster ID attribute in the Rx beacon frame
10988 */
10989 
10990 typedef struct nan_sync_master {
10991 	uint8 flag;	/*  1: self; 2: use TSF timing; 4: AMR update */
10992 	uint8  hop_count;
10993 	struct ether_addr addr;
10994 	struct ether_addr cluster_id;
10995 	chanspec_t channel; /* bcn reception channel */
10996 	uint32 ltsf_h;
10997 	uint32 ltsf_l;
10998 	uint32 rtsf_h;
10999 	uint32 rtsf_l;
11000 	uint8 amr[WL_NAN_MASTER_RANK_LEN];
11001 	uint32 ambtt;
11002 } nan_sync_master_t;
11003 
11004 /*
11005 * NAN Sync TLV(NSTLV):
11006 * To keep NAN/AWDL concurrency time sync.
11007 * It is generated at hybrid device, and propogated by AWDL only device.
11008 * It contains the information needed to run NAN election
11009 */
11010 #include <packed_section_start.h>
11011 typedef BWL_PRE_PACKED_STRUCT struct awdl_nan_sync_tlv {
11012 	uint16 hop_count;				/* total hop_count */
11013 	struct ether_addr src_addr;		/* macaddr of the hybrid originator of nstlv */
11014 	struct ether_addr cluster_id;	/* NAN cluster ID of hybrid originator of nstlv */
11015 	uint32 nan_tsf_h;	/* NAN cluster TSF of the hybrid originator of nstlv */
11016 	uint32 nan_tsf_l;
11017 	uint8 master_preference;
11018 	uint8 random_factor;
11019 	uint8 amr[WL_NAN_MASTER_RANK_LEN];
11020 	uint8 orig_hop_count;			/* hop_count of the origin hybrid NAN device */
11021 	uint32  ambtt;		/* Anchor Master Beacon Transmission Time */
11022 	uint8 opt_xtlv_len;	/* xtlv len */
11023 } BWL_POST_PACKED_STRUCT awdl_nan_sync_tlv_t;
11024 
11025 typedef BWL_PRE_PACKED_STRUCT struct wl_awdl_nan_sync_tlv {
11026 	uint8 type;					/* 23 for NTLV */
11027 	uint16 param_len;
11028 	awdl_nan_sync_tlv_t ntlv;
11029 } BWL_POST_PACKED_STRUCT wl_awdl_nan_sync_tlv_t;
11030 #include <packed_section_end.h>
11031 
11032 /* NAN advertiser structure */
11033 /* TODO RSDB: add chspec to indicates core corresponds correct core */
11034 typedef struct nan_adv_entry {
11035 	uint8 age;	/* used to remove stale entries */
11036 	uint8 hop_count;	/* for NTLV support, use bit7 for virtual NAN peer */
11037 	struct ether_addr addr;
11038 	struct ether_addr cluster_id;
11039 	chanspec_t channel; /* bcn reception channel */
11040 	uint32 ltsf_h;
11041 	uint32 ltsf_l;
11042 	uint32 rtsf_h;
11043 	uint32 rtsf_l;
11044 	uint8 amr[WL_NAN_MASTER_RANK_LEN];
11045 	uint32 ambtt;
11046 	int8	rssi[NAN_MAX_BANDS];		/* rssi last af was received at */
11047 	int8	last_rssi[NAN_MAX_BANDS];	/* rssi in the last AF */
11048 } nan_adv_entry_t;
11049 #define NAN_VIRTUAL_PEER_BIT	0x80
11050 
11051 typedef enum {
11052 	NAC_CNT_NTLV_AF_TX = 0,		/* count of AWDL AF containing NTLV tx */
11053 	NAC_CNT_NTLV_AF_RX,		/* count of AWDL AF containing NTLV rx */
11054 	NAC_CNT_NTLV_TMERR_TX,		/* count of NTLV tx timing error */
11055 	NAC_CNT_NTLV_TMERR_RX,		/* count of NTLV rx timing error */
11056 	NAC_CNT_NTLV_TM_MISMATCH,	/* count of TopMaster mismatch in Rx NTLV processing */
11057 	NAC_CNT_NTLV_ADV_EXISTED,	/* count of NTLV ignored bc advertiser existed from bcn */
11058 	NAC_CNT_NTLV_STALED_BCN,	/* count of staled bcn from NTLV info */
11059 	NAC_CNT_NTLV_MERGE,		/* count of NTLV used for NAN cluster merge */
11060 	NAC_CNT_NTLV_ELECTION_DROP,	/* count of NTLV dropped in NAN election */
11061 	NAC_CNT_NTLV_TSF_ADOPT,		/* count of NTLV used for NAN TSF adoption */
11062 	NAC_CNT_NTLV_LAST
11063 } nac_cnt_enum_t;
11064 
11065 #define NAC_MAX_CNT	(NAC_CNT_NTLV_LAST)
11066 
11067 typedef struct nac_stats {
11068 	uint32 nac_cnt[NAC_MAX_CNT];
11069 } nac_stats_t;
11070 
11071 typedef struct nan_adv_table {
11072 	uint8  num_adv;
11073 	uint8	adv_size;
11074 	uint8	pad[2];
11075 	nan_adv_entry_t adv_nodes[0];
11076 } nan_adv_table_t;
11077 
11078 typedef struct wl_nan_role_cfg {
11079 	wl_nan_role_t cfg_role;
11080 	wl_nan_role_t cur_role;
11081 	uint8 pad[2];
11082 	nan_sync_master_t target_master;
11083 } wl_nan_role_cfg_t;
11084 
11085 typedef int8 wl_nan_sd_optional_field_types_t;
11086 
11087 /* Flag bits for Publish and Subscribe (wl_nan_sd_params_t flags) */
11088 
11089 /* First 8 bits are blocked for mapping
11090  * against svc_control flag bits which goes out
11091  * as part of SDA attribute in air in SDF frames
11092  */
11093 #define WL_NAN_RANGE_LIMITED		0x0040
11094 
11095 /* Event generation indicator (default is continuous) */
11096 
11097 #define WL_NAN_MATCH_ONCE		0x100000
11098 #define WL_NAN_MATCH_NEVER		0x200000
11099 
11100 /* Bits specific to Publish */
11101 
11102 #define WL_NAN_PUB_UNSOLICIT	0x1000	/* Unsolicited Tx */
11103 #define WL_NAN_PUB_SOLICIT		0x2000	/* Solicited Tx */
11104 #define WL_NAN_PUB_BOTH			0x3000	/* Both the above */
11105 
11106 #define WL_NAN_PUB_BCAST		0x4000	/* bcast solicited Tx only */
11107 #define WL_NAN_PUB_EVENT		0x8000	/* Event on each solicited Tx */
11108 #define WL_NAN_PUB_SOLICIT_PENDING	0x10000 /* Used for one-time solicited Publish */
11109 
11110 #define WL_NAN_FOLLOWUP			0x20000 /* Follow-up frames */
11111 #define WL_NAN_TX_FOLLOWUP             0x40000 /* host generated transmit Follow-up frames */
11112 
11113 /* Bits specific to Subscribe */
11114 
11115 #define WL_NAN_SUB_ACTIVE		0x1000 /* Active subscribe mode */
11116 #define WL_NAN_SUB_MATCH_IF_SVC_INFO	0x2000 /* Service info in publish */
11117 
11118 #define WL_NAN_TTL_UNTIL_CANCEL	0xFFFFFFFF /* Special values for time to live (ttl) parameter */
11119 
11120 /*
11121  * Publish -  runs until first transmission
11122  * Subscribe - runs until first  DiscoveryResult event
11123  */
11124 #define WL_NAN_TTL_FIRST	0
11125 
11126 /* Nan Service Based control Flags */
11127 
11128 /* If set, dev will take care of dp_resp */
11129 #define WL_NAN_SVC_CTRL_AUTO_DPRESP               0x1000000
11130 
11131 /* If set, host wont rec event "receive" */
11132 #define WL_NAN_SVC_CTRL_SUPPRESS_EVT_RECEIVE      0x2000000
11133 
11134 /* If set, host wont rec event "replied" */
11135 #define WL_NAN_SVC_CTRL_SUPPRESS_EVT_REPLIED      0x4000000
11136 
11137 /* If set, host wont rec event "terminated" */
11138 #define WL_NAN_SVC_CTRL_SUPPRESS_EVT_TERMINATED   0x8000000
11139 
11140 /*
11141  * WL_NAN_CMD_SD_PARAMS
11142  */
11143 typedef struct wl_nan_sd_params
11144 {
11145 	uint16	length; /* length including options */
11146 	uint8	period; /* period of the unsolicited SDF xmission in DWs */
11147 	uint8   awake_dw; /* interval between two DWs where SDF tx/rx are done */
11148 	uint8	svc_hash[WL_NAN_SVC_HASH_LEN]; /* Hash for the service name */
11149 	uint8	instance_id; /* Instance of the current service */
11150 	int8	proximity_rssi; /* RSSI limit to Rx subscribe or pub SDF 0 no effect */
11151 	uint32	flags; /* bitmap representing aforesaid optional flags */
11152 	int32	ttl; /* TTL for this instance id, -1 will run till cancelled */
11153 	tlv_t	optional[1]; /* optional fields in the SDF  as appropriate */
11154 } wl_nan_sd_params_t;
11155 
11156 /*
11157  * WL_NAN_CMD_SD_PUBLISH_LIST
11158  * WL_NAN_CMD_SD_SUBSCRIBE_LIST
11159  */
11160 typedef struct wl_nan_service_info
11161 {
11162 	uint8 instance_id;	/* Publish instance ID */
11163 	uint8 service_hash[WL_NAN_SVC_HASH_LEN]; /* Hash for service name */
11164 } wl_nan_service_info_t;
11165 
11166 typedef struct wl_nan_service_list
11167 {
11168 	uint16 id_count; /* Number of registered publish/subscribe services */
11169 	wl_nan_service_info_t list[1]; /* service info defined by nan_service instance */
11170 } wl_nan_service_list_t;
11171 
11172 /*
11173  * WL_NAN_CMD_CFG_BCN_INTERVAL
11174  */
11175 typedef uint16 wl_nan_disc_bcn_interval_t;
11176 
11177 /*
11178  * WL_NAN_CMD_CFG_SDF_TXTIME
11179  */
11180 typedef uint16 wl_nan_svc_disc_txtime_t;
11181 
11182 /*
11183  * WL_NAN_CMD_CFG_STOP_BCN_TX
11184  */
11185 typedef uint16 wl_nan_stop_bcn_tx_t;
11186 
11187 /*
11188  * WL_NAN_CMD_CFG_SID_BEACON
11189  */
11190 typedef struct wl_nan_sid_beacon_control {
11191 	uint8 sid_enable;	/* Flag to indicate the inclusion of Service IDs in Beacons */
11192 	uint8 sid_count;	/* Limit for number of publish SIDs to be included in Beacons */
11193 	uint8 sub_sid_count;	/* Limit for number of subscribe SIDs to be included in Beacons */
11194 	uint8 pad;
11195 } wl_nan_sid_beacon_control_t;
11196 
11197 /*
11198  * WL_NAN_CMD_CFG_DW_LEN
11199  */
11200 typedef uint16 wl_nan_dw_len_t;
11201 
11202 /*
11203  * WL_NAN_CMD_CFG_AWAKE_DW   Will be deprecated.
11204  */
11205 typedef struct wl_nan_awake_dw {
11206 	wl_nan_band_t band;	/* 0 - b mode 1- a mode */
11207 	uint8 interval;		/* 1 or 2 or 4 or 8 or 16 */
11208 	uint16 pad;
11209 } wl_nan_awake_dw_t;
11210 
11211 /*
11212  * WL_NAN_CMD_CFG_AWAKE_DWS
11213  */
11214 typedef struct wl_nan_awake_dws {
11215 	uint8 dw_interval_2g;	/* 2G DW interval */
11216 	uint8 dw_interval_5g;	/* 5G DW interval */
11217 	uint16 pad;
11218 } wl_nan_awake_dws_t;
11219 
11220 /* WL_NAN_CMD_SYNC_BCN_RSSI_NOTIF_THRESHOLD */
11221 
11222 typedef struct wl_nan_rssi_notif_thld {
11223 	int8 bcn_rssi_2g;
11224 	int8 bcn_rssi_5g;
11225 	int16 pad;
11226 } wl_nan_rssi_notif_thld_t;
11227 
11228 /*
11229  * WL_NAN_CMD_CFG_SOCIAL_CHAN
11230  */
11231 typedef struct wl_nan_social_channels {
11232 	uint8 soc_chan_2g;	/* 2G social channel */
11233 	uint8 soc_chan_5g;	/* 5G social channel */
11234 	uint16 pad;
11235 } wl_nan_social_channels_t;
11236 
11237 /*
11238  * WL_NAN_CMD_SD_CANCEL_PUBLISH
11239  * WL_NAN_CMD_SD_CANCEL_SUBSCRIBE
11240  */
11241 typedef uint8 wl_nan_instance_id; /* Instance ID of an active publish instance */
11242 
11243 /*
11244  * WL_NAN_CMD_SD_VND_INFO
11245  */
11246 typedef struct wl_nan_sd_vendor_info
11247 {
11248 	uint16 length; /* Size in bytes of the payload following this field */
11249 	uint8 data[];	/* Vendor Information */
11250 } wl_nan_sd_vendor_info_t;
11251 
11252 /*
11253  * WL_NAN_CMD_SD_STATS
11254  */
11255 typedef struct wl_nan_sd_stats {
11256 	uint32  sdftx;
11257 	uint32  sdfrx;
11258 	uint32  sdsrffail;
11259 	uint32  sdrejrssi;
11260 	uint32  sdfollowuprx;
11261 	uint32  sdsubmatch;
11262 	uint32  sdpubreplied;
11263 	uint32  sdmftfail1;
11264 	uint32  sdmftfail2;
11265 	uint32  sdmftfail3;
11266 	uint32  sdmftfail4;
11267 }  wl_nan_sd_stats_t;
11268 
11269 /* Flag bits for sd transmit message (wl_nan_sd_transmit_t flags) */
11270 
11271 /* If set, host wont rec "tx status" event for tx-followup msg */
11272 #define WL_NAN_FUP_SUPR_EVT_TXS      0x01
11273 /* more flags can be added here */
11274 
11275 /*
11276  * WL_NAN_CMD_SD_TRANSMIT
11277  * WL_NAN_CMD_SD_FUP_TRANSMIT
11278  */
11279 typedef struct wl_nan_sd_transmit {
11280 	uint8	local_service_id;		/* Sender Service ID */
11281 	uint8	requestor_service_id;		/* Destination Service ID */
11282 	struct ether_addr destination_addr;	/* Destination MAC */
11283 	uint16	token;				/* follow_up_token when a follow-up
11284 						 * msg is queued successfully
11285 						 */
11286 	uint8	priority;			/* requested relative prio */
11287 	uint8	flags;                          /* Flags for tx follow-up msg */
11288 	uint16	opt_len;			/* total length of optional tlvs */
11289 	uint8	opt_tlv[];			/* optional tlvs in bcm_xtlv_t type */
11290 } wl_nan_sd_transmit_t;
11291 
11292 /* disc cache timeout for a cache entry */
11293 typedef uint16 wl_nan_disc_cache_timeout_t;
11294 
11295 /*
11296  * WL_NAN_CMD_SYNC_TSRESERVE
11297  */
11298 /** time slot */
11299 #define NAN_MAX_TIMESLOT	32
11300 typedef struct wl_nan_timeslot {
11301 	uint32	abitmap; /**< available bitmap */
11302 	uint32 chanlist[NAN_MAX_TIMESLOT];
11303 } wl_nan_timeslot_t;
11304 
11305 /*
11306  * Deprecated
11307  *
11308  * WL_NAN_CMD_SYNC_TSRELEASE
11309  */
11310 typedef uint32 wl_nan_ts_bitmap_t;
11311 
11312 /* nan passive scan params */
11313 #define NAN_SCAN_MAX_CHCNT 8
11314 /* nan merge scan params */
11315 typedef struct wl_nan_scan_params {
11316 	/* dwell time of discovery channel corresponds to band_idx.
11317 	 * If set to 0 then fw default will be used.
11318 	 */
11319 	uint16 dwell_time;
11320 	/* scan period of  discovery channel corresponds to band_idx.
11321 	 * If set to 0 then fw default will be used.
11322 	 */
11323 	uint16 scan_period;
11324 	/* band index of discovery channel */
11325 	uint8 band_index;
11326 } wl_nan_scan_params_t;
11327 
11328 /*
11329  * WL_NAN_CMD_DBG_SCAN
11330  */
11331 typedef struct wl_nan_dbg_scan {
11332 	struct ether_addr cid;
11333 	uint8 pad[2];
11334 } wl_nan_dbg_scan_t;
11335 
11336 /* NAN_DBG_LEVEL */
11337 typedef struct wl_nan_dbg_level {
11338 	uint32 nan_err_level; /* for Error levels */
11339 	uint32 nan_dbg_level; /* for bebug logs and trace */
11340 	uint32 nan_info_level; /* for dumps like prhex */
11341 } wl_nan_dbg_level_t;
11342 
11343 /*
11344  * WL_NAN_CMD_DBG_EVENT_MASK
11345  */
11346 typedef uint32 wl_nan_event_mask_t;
11347 
11348 /*
11349  * WL_NAN_CMD_DBG_EVENT_CHECK
11350  */
11351 typedef uint8 wl_nan_dbg_ifname[BCM_MSG_IFNAME_MAX];
11352 
11353 /*
11354  * WL_NAN_CMD_DBG_DUMP
11355  * WL_NAN_CMD_DBG_CLEAR
11356  */
11357 enum wl_nan_dbg_dump_type {
11358 	WL_NAN_DBG_DT_RSSI_DATA = 1,
11359 	WL_NAN_DBG_DT_STATS_DATA = 2,
11360 	/*
11361 	 * Additional enums before this line
11362 	 */
11363 	WL_NAN_DBG_DT_INVALID
11364 };
11365 typedef int8 wl_nan_dbg_dump_type_t;
11366 
11367 /** various params and ctl swithce for nan_debug instance  */
11368 /*
11369  * WL_NAN_CMD_DBG_DEBUG
11370  */
11371 typedef struct wl_nan_debug_params {
11372 	uint16	cmd;	/**< debug cmd to perform a debug action */
11373 	uint16	status;
11374 	uint32	msglevel; /**< msg level if enabled */
11375 	uint8	enabled; /**< runtime debuging enabled */
11376 	uint8 collect;
11377 	uint8 PAD[2];
11378 } wl_nan_debug_params_t;
11379 
11380 typedef struct wl_nan_sched_svc_timeslot_s {
11381 	uint32 abitmap; /* availability bitmap */
11382 	uint32 chanlist[NAN_MAX_TIMESLOT];
11383 	uint8  res; /* resolution: 0 = 16ms, 1 = 32ms, 2 = 64ms 3 = reserved. REfer NAN spec */
11384 	uint8  mapid; /* mapid from NAN spec. Used to differentiate 2G Vs 5G band */
11385 	uint8 PAD[2];
11386 } wl_nan_sched_svc_timeslot_t;
11387 
11388 /*
11389  * WL_NAN_CMD_DATA_DP_IDLE_PERIOD
11390  */
11391 typedef uint16 wl_nan_ndp_idle_period_t;
11392 
11393 /*
11394  * WL_NAN_CMD_DATA_DP_HB_DURATION
11395  */
11396 typedef uint16 wl_nan_ndp_hb_duration_t;
11397 
11398 /* nan cmd IDs */
11399 enum wl_nan_cmds {
11400 	 /* nan cfg /disc & dbg ioctls */
11401 	WL_NAN_CMD_ENABLE = 1,
11402 	WL_NAN_CMD_ATTR = 2,
11403 	WL_NAN_CMD_NAN_JOIN = 3,
11404 	WL_NAN_CMD_LEAVE = 4,
11405 	WL_NAN_CMD_MERGE = 5,
11406 	WL_NAN_CMD_STATUS = 6,
11407 	WL_NAN_CMD_TSRESERVE = 7,
11408 	WL_NAN_CMD_TSSCHEDULE = 8,
11409 	WL_NAN_CMD_TSRELEASE = 9,
11410 	WL_NAN_CMD_OUI = 10,
11411 	WL_NAN_CMD_OOB_AF = 11,
11412 	WL_NAN_CMD_SCAN_PARAMS = 12,
11413 
11414 	WL_NAN_CMD_COUNT = 15,
11415 	WL_NAN_CMD_CLEARCOUNT = 16,
11416 
11417 	/*  discovery engine commands */
11418 	WL_NAN_CMD_PUBLISH = 20,
11419 	WL_NAN_CMD_SUBSCRIBE = 21,
11420 	WL_NAN_CMD_CANCEL_PUBLISH = 22,
11421 	WL_NAN_CMD_CANCEL_SUBSCRIBE = 23,
11422 	WL_NAN_CMD_TRANSMIT = 24,
11423 	WL_NAN_CMD_CONNECTION = 25,
11424 	WL_NAN_CMD_SHOW = 26,
11425 	WL_NAN_CMD_STOP = 27,	/* stop nan for a given cluster ID  */
11426 	/*  nan debug iovars & cmds  */
11427 	WL_NAN_CMD_SCAN = 47,
11428 	WL_NAN_CMD_SCAN_RESULTS = 48,
11429 	WL_NAN_CMD_EVENT_MASK = 49,
11430 	WL_NAN_CMD_EVENT_CHECK = 50,
11431 	WL_NAN_CMD_DUMP = 51,
11432 	WL_NAN_CMD_CLEAR = 52,
11433 	WL_NAN_CMD_RSSI = 53,
11434 
11435 	WL_NAN_CMD_DEBUG = 60,
11436 	WL_NAN_CMD_TEST1 = 61,
11437 	WL_NAN_CMD_TEST2 = 62,
11438 	WL_NAN_CMD_TEST3 = 63,
11439 	WL_NAN_CMD_DISC_RESULTS = 64,
11440 	/* nan 2.0 data path commands */
11441 	WL_NAN_CMD_DATAPATH = 65
11442 };
11443 
11444 /*   NAN DP interface commands  */
11445 enum wl_nan_dp_cmds {
11446 	/* nan 2.0 ioctls */
11447 	WL_NAN_CMD_DP_CAP = 1000,
11448 	WL_NAN_CMD_DP_CONFIG = 1001,
11449 	WL_NAN_CMD_DP_CREATE = 1002,
11450 	WL_NAN_CMD_DP_AUTO_CONNECT = 1003,
11451 	WL_NAN_CMD_DP_DATA_REQ = 1004,
11452 	WL_NAN_CMD_DP_DATA_RESP = 1005,
11453 	WL_NAN_CMD_DP_SCHED_UPD = 1006,
11454 	WL_NAN_CMD_DP_END = 1007,
11455 	WL_NAN_CMD_DP_CONNECT = 1008,
11456 	WL_NAN_CMD_DP_STATUS = 1009
11457 };
11458 
11459 /* TODO Should remove this fixed length */
11460 #define WL_NAN_DATA_SVC_SPEC_INFO_LEN 32 /* arbitrary */
11461 #define WL_NAN_DP_MAX_SVC_INFO	      0xFF
11462 #define WL_NAN_DATA_NDP_INST_SUPPORT 16
11463 
11464 /* Nan flags (16 bits) */
11465 #define WL_NAN_DP_FLAG_SVC_INFO		0x0001
11466 #define WL_NAN_DP_FLAG_CONFIRM		0x0002
11467 #define WL_NAN_DP_FLAG_EXPLICIT_CFM	0x0004
11468 #define WL_NAN_DP_FLAG_SECURITY		0x0008
11469 #define WL_NAN_DP_FLAG_HAST_NDL_COUNTER	0x0010 /* Host assisted NDL counter */
11470 
11471 /* NAN Datapath host status */
11472 #define WL_NAN_DP_STATUS_ACCEPTED     1
11473 #define WL_NAN_DP_STATUS_REJECTED     0
11474 
11475 /* to be done */
11476 typedef struct wl_nan_dp_cap {
11477 	uint8 tbd;
11478 } wl_nan_dp_cap_t;
11479 
11480 /** The service hash (service id) is exactly this many bytes. */
11481 #define WL_NAN_SVC_HASH_LEN	6
11482 /** Number of hash functions per bloom filter */
11483 #define WL_NAN_HASHES_PER_BLOOM 4
11484 /* no. of max last disc results */
11485 #define WL_NAN_MAX_DISC_RESULTS	3
11486 
11487 /* NAN security related defines */
11488 /* NCS-SK related */
11489 #define WL_NAN_NCS_SK_PMK_LEN	32
11490 #define WL_NAN_NCS_SK_PMKID_LEN	16
11491 
11492 /* recent discovery results */
11493 typedef struct wl_nan_disc_result_s
11494 {
11495 	wl_nan_instance_id_t instance_id;	/* instance id of pub/sub req */
11496 	wl_nan_instance_id_t peer_instance_id;	/* peer instance id of pub/sub req/resp */
11497 	uint8 svc_hash[WL_NAN_SVC_HASH_LEN];	/* service descp string */
11498 	struct ether_addr peer_mac;	/* peer mac address */
11499 } wl_nan_disc_result_t;
11500 
11501 /* list of recent discovery results */
11502 typedef struct wl_nan_disc_results_s
11503 {
11504 	wl_nan_disc_result_t disc_result[WL_NAN_MAX_DISC_RESULTS];
11505 } wl_nan_disc_results_list_t;
11506 
11507 /* nan 1.0 events */
11508 /* To be deprecated - will be replaced by event_disc_result */
11509 typedef struct wl_nan_ev_disc_result {
11510 	wl_nan_instance_id_t pub_id;
11511 	wl_nan_instance_id_t sub_id;
11512 	struct ether_addr pub_mac;
11513 	uint8 opt_tlvs[0];
11514 } wl_nan_ev_disc_result_t;
11515 
11516 typedef struct wl_nan_event_disc_result {
11517 	wl_nan_instance_id_t pub_id;
11518 	wl_nan_instance_id_t sub_id;
11519 	struct ether_addr pub_mac;
11520 	int8		publish_rssi;		/* publisher RSSI */
11521 	uint8		attr_num;
11522 	uint16		attr_list_len;	/* length of the all the attributes in the SDF */
11523 	uint8		attr_list[0];	/* list of NAN attributes */
11524 } wl_nan_event_disc_result_t;
11525 
11526 typedef struct wl_nan_ev_p2p_avail {
11527 	struct ether_addr sender;
11528 	struct ether_addr p2p_dev_addr;
11529 	uint8 dev_role;
11530 	uint8 resolution;
11531 	uint8 repeat;
11532 	uint8 pad[3];
11533 	chanspec_t chanspec;
11534 	uint32 avail_bmap;
11535 } wl_nan_ev_p2p_avail_t;
11536 
11537 /*
11538 * discovery interface event structures *
11539 */
11540 
11541 /* mandatory parameters for OOB action frame */
11542 /* single-shot when bitmap and offset are set to 0; periodic otherwise */
11543 typedef struct wl_nan_oob_af_params_s
11544 {
11545 	/* bitmap for the 32 timeslots in 512TU dw interval */
11546 	uint32 ts_map;
11547 	/* offset from start of dw, in us */
11548 	uint32 tx_offset;
11549 	struct ether_addr bssid;
11550 	struct ether_addr dest;
11551 	uint32 pkt_lifetime;
11552 	uint16 payload_len;
11553 	uint8 payload[1];
11554 } wl_nan_oob_af_params_t;
11555 
11556 /* NAN Ranging */
11557 
11558 /* Bit defines for global flags */
11559 #define WL_NAN_RANGING_ENABLE		1 /**< enable RTT */
11560 #define WL_NAN_RANGING_RANGED		2 /**< Report to host if ranged as target */
11561 typedef struct nan_ranging_config {
11562 	uint32 chanspec;		/**< Ranging chanspec */
11563 	uint16 timeslot;		/**< NAN RTT start time slot  1-511 */
11564 	uint16 duration;		/**< NAN RTT duration in ms */
11565 	struct ether_addr allow_mac;	/**< peer initiated ranging: the allowed peer mac
11566 					 * address, a unicast (for one peer) or
11567 					 * a broadcast for all. Setting it to all zeros
11568 					 * means responding to none,same as not setting
11569 					 * the flag bit NAN_RANGING_RESPOND
11570 					 */
11571 	uint16 flags;
11572 } wl_nan_ranging_config_t;
11573 
11574 /** list of peers for self initiated ranging */
11575 /** Bit defines for per peer flags */
11576 #define WL_NAN_RANGING_REPORT (1<<0)	/**< Enable reporting range to target */
11577 typedef struct nan_ranging_peer {
11578 	uint32 chanspec;		/**< desired chanspec for this peer */
11579 	uint32 abitmap;			/**< available bitmap */
11580 	struct ether_addr ea;		/**< peer MAC address */
11581 	uint8 frmcnt;			/**< frame count */
11582 	uint8 retrycnt;			/**< retry count */
11583 	uint16 flags;			/**< per peer flags, report or not */
11584 	uint16 PAD;
11585 } wl_nan_ranging_peer_t;
11586 typedef struct nan_ranging_list {
11587 	uint8 count;			/**< number of MAC addresses */
11588 	uint8 num_peers_done;		/**< host set to 0, when read, shows number of peers
11589 					 * completed, success or fail
11590 					 */
11591 	uint8 num_dws;			/**< time period to do the ranging, specified in dws */
11592 	uint8 reserve;			/**< reserved field */
11593 	wl_nan_ranging_peer_t rp[1];	/**< variable length array of peers */
11594 } wl_nan_ranging_list_t;
11595 
11596 /* ranging results, a list for self initiated ranging and one for peer initiated ranging */
11597 /* There will be one structure for each peer */
11598 #define WL_NAN_RANGING_STATUS_SUCCESS		1
11599 #define WL_NAN_RANGING_STATUS_FAIL		2
11600 #define WL_NAN_RANGING_STATUS_TIMEOUT		3
11601 #define WL_NAN_RANGING_STATUS_ABORT		4 /**< with partial results if sounding count > 0 */
11602 typedef struct nan_ranging_result {
11603 	uint8 status;			/**< 1: Success, 2: Fail 3: Timeout 4: Aborted */
11604 	uint8 sounding_count;		/**< number of measurements completed (0 = failure) */
11605 	struct ether_addr ea;		/**< initiator MAC address */
11606 	uint32 chanspec;		/**< Chanspec where the ranging was done */
11607 	uint32 timestamp;		/**< 32bits of the TSF timestamp ranging was completed at */
11608 	uint32 distance;		/**< mean distance in meters expressed as Q4 number.
11609 					 * Only valid when sounding_count > 0. Examples:
11610 					 * 0x08 = 0.5m
11611 					 * 0x10 = 1m
11612 					 * 0x18 = 1.5m
11613 					 * set to 0xffffffff to indicate invalid number
11614 					 */
11615 	int32 rtt_var;			/**< standard deviation in 10th of ns of RTTs measured.
11616 					 * Only valid when sounding_count > 0
11617 					 */
11618 	struct ether_addr tgtea;	/**< target MAC address */
11619 	uint8 PAD[2];
11620 } wl_nan_ranging_result_t;
11621 typedef struct nan_ranging_event_data {
11622 	uint8 mode;			/**< 1: Result of host initiated ranging */
11623 					/* 2: Result of peer initiated ranging */
11624 	uint8 reserved;
11625 	uint8 success_count;		/**< number of peers completed successfully */
11626 	uint8 count;			/**< number of peers in the list */
11627 	wl_nan_ranging_result_t rr[1];	/**< variable array of ranging peers */
11628 } wl_nan_ranging_event_data_t;
11629 
11630 enum {
11631 	WL_NAN_STATS_RSSI = 1,
11632 	WL_NAN_STATS_DATA = 2,
11633 	WL_NAN_STATS_DP = 3,
11634 /*
11635  * ***** ADD before this line ****
11636  */
11637 	WL_NAN_STATS_INVALID
11638 };
11639 typedef struct wl_nan_dp_stats {
11640 	uint32 tbd; /* TBD */
11641 } wl_nan_dp_stats_t;
11642 
11643 typedef struct wl_nan_stats {
11644 	/* general */
11645 	uint32 cnt_dw; /* DW slots */
11646 	uint32 cnt_disc_bcn_sch; /* disc beacon slots */
11647 	uint32 cnt_amr_exp; /* count of ambtt expiries resetting roles */
11648 	uint32 cnt_bcn_upd; /* count of beacon template updates */
11649 	uint32 cnt_bcn_tx; /* count of sync & disc bcn tx */
11650 	uint32 cnt_bcn_rx; /* count of sync & disc bcn rx */
11651 	uint32 cnt_sync_bcn_tx; /* count of sync bcn tx within DW */
11652 	uint32 cnt_disc_bcn_tx; /* count of disc bcn tx */
11653 	uint32 cnt_sdftx_bcmc; /* count of bcast/mcast sdf tx */
11654 	uint32 cnt_sdftx_uc; /* count of unicast sdf tx */
11655 	uint32 cnt_sdftx_fail; /* count of unicast sdf tx fails */
11656 	uint32 cnt_sdf_rx; /* count of  sdf rx */
11657 	/* NAN roles */
11658 	uint32 cnt_am; /* anchor master */
11659 	uint32 cnt_master; /* master */
11660 	uint32 cnt_nms; /* non master sync */
11661 	uint32 cnt_nmns; /* non master non sync */
11662 	/* TX */
11663 	uint32 cnt_err_txtime; /* txtime in sync bcn frame not a multiple of dw intv */
11664 	uint32 cnt_err_unsch_tx; /* tx while not in DW/ disc bcn slot */
11665 	uint32 cnt_err_bcn_tx; /*  beacon tx error */
11666 	uint32 cnt_sync_bcn_tx_miss; /* no. of times time delta between 2 cosequetive
11667 						* sync beacons is more than expected
11668 						*/
11669 	/* MSCH */
11670 	uint32 cnt_err_msch_reg; /* error is Dw/disc reg with msch */
11671 	uint32 cnt_err_wrong_ch_cb; /* count of msch calbacks in wrong channel */
11672 	uint32 cnt_dw_skip;	/* count of DW rejected */
11673 	uint32 cnt_disc_skip; /* count of disc bcn rejected */
11674 	uint32 cnt_dw_start_early; /* msch cb not at registered time */
11675 	uint32 cnt_dw_start_late; /* no. of delays in slot start */
11676 	/* SCANS */
11677 	uint32 cnt_mrg_scan; /* count of merge scans completed */
11678 	uint32 cnt_err_ms_rej; /* number of merge scan failed */
11679 	uint32 cnt_scan_results; /* no. of nan beacons scanned */
11680 	uint32 cnt_join_scan_rej; /* no. of join scans rejected */
11681 	uint32 cnt_nan_scan_abort; /* no. of join scans rejected */
11682 	/* enable/disable */
11683 	uint32 cnt_nan_enab; /* no. of times nan feature got enabled */
11684 	uint32 cnt_nan_disab; /* no. of times nan feature got disabled */
11685 	uint32 cnt_sync_bcn_rx; /* count of sync bcn rx within DW */
11686 	uint32 cnt_sync_bcn_rx_tu[3]; /* Delta bw the tsf in bcn & remote */
11687 	uint32 cnt_bcn_tx_out_dw;  /* TX sync beacon outside dw */
11688 	uint32 cnt_role_am_dw; /* anchor master role due to dw */
11689 	uint32 cnt_am_hop_err; /* wrong hopcount set for AM */
11690 } wl_nan_stats_t;
11691 
11692 #define WL_NAN_MAC_MAX_NAN_PEERS 6
11693 #define WL_NAN_MAC_MAX_RSSI_DATA_PER_PEER  10
11694 
11695 typedef struct wl_nan_nbr_rssi {
11696 	uint8 rx_chan; /* channel number on which bcn rcvd */
11697 	uint8 PAD[3];
11698 	int32 rssi_raw;  /* received rssi value */
11699 	int32 rssi_avg;  /* normalized rssi value */
11700 } wl_nan_peer_rssi_t;
11701 
11702 typedef struct wl_nan_peer_rssi_entry {
11703 	struct ether_addr mac;  /* peer mac address */
11704 	uint8 flags;   /* TODO:rssi data order: latest first, oldest first etc */
11705 	uint8 rssi_cnt;   /* rssi data sample present */
11706 	wl_nan_peer_rssi_t rssi[WL_NAN_MAC_MAX_RSSI_DATA_PER_PEER]; /* RSSI data frm peer */
11707 } wl_nan_peer_rssi_entry_t;
11708 
11709 #define WL_NAN_PEER_RSSI      0x1
11710 #define WL_NAN_PEER_RSSI_LIST 0x2
11711 
11712 typedef struct wl_nan_nbr_rssi_data {
11713 	uint8 flags;   /* this is a list or single rssi data */
11714 	uint8 peer_cnt; /* number of peers */
11715 	uint16 pad; /* padding */
11716 	wl_nan_peer_rssi_entry_t peers[1]; /* peers data list */
11717 } wl_nan_peer_rssi_data_t;
11718 
11719 /* WL_NAN_CMD_DBG_DUMP, GET Resp */
11720 typedef struct wl_nan_dbg_dump_rsp {
11721 	wl_nan_dbg_dump_type_t dump_type; /* dump data type */
11722 	uint8 pad[3];
11723 	union {
11724 		wl_nan_peer_rssi_data_t peer_rssi;
11725 		wl_nan_stats_t		nan_stats;
11726 	} u;
11727 } wl_nan_dbg_dump_rsp_t;
11728 
11729 enum nan_termination_status {
11730 	NAN_TERM_REASON_INVALID = 1,
11731 	NAN_TERM_REASON_TIMEOUT = 2,
11732 	NAN_TERM_REASON_USER_REQ = 3,
11733 	NAN_TERM_REASON_FAILURE = 4,
11734 	NAN_TERM_REASON_COUNT_REACHED = 5,
11735 	NAN_TERM_REASON_DE_SHUTDOWN = 6,
11736 	NAN_TERM_REASON_DISABLE_IN_PROGRESS = 7
11737 };
11738 
11739 /* nan2 data iovar */
11740 /* nan2 qos */
11741 typedef struct wl_nan_dp_qos
11742 {
11743 	uint8 tid;
11744 	uint8 pad;
11745 	uint16 pkt_size;
11746 	uint16 mean_rate;
11747 	uint16 svc_interval;
11748 } wl_nan_dp_qos_t;
11749 
11750 #define WL_NAN_NDL_QOS_MAX_LAT_NO_PREF 0xFFFF
11751 
11752 /* nan2 qos */
11753 typedef struct wl_nan_ndl_qos
11754 {
11755 	uint8 min_slots;	/* min slots per dw interval */
11756 	uint8 pad;
11757 	uint16 max_latency;	/* max latency */
11758 } wl_nan_ndl_qos_t;
11759 
11760 /* ndp config */
11761 typedef struct wl_nan_ndp_config
11762 {
11763 	uint8 ndp_id;
11764 	uint8 pub_id;
11765 	struct ether_addr pub_addr;
11766 	struct ether_addr data_addr;	/* configure local data addr */
11767 	struct ether_addr init_data_addr;	/* initiator data addr */
11768 	uint8 svc_spec_info[WL_NAN_DATA_SVC_SPEC_INFO_LEN];
11769 	wl_nan_dp_qos_t qos;
11770 	uint16 avail_len;
11771 	uint8 pad[3];
11772 	uint8 data[1];
11773 } wl_nan_ndp_config_t;
11774 
11775 /* nan2 device capabilities */
11776 typedef struct wl_nan_ndp_oper_cfg {
11777 	uint8 awake_dw_2g;
11778 	uint8 awake_dw_5g;
11779 	uint8 bands_supported;
11780 	uint8 op_mode;
11781 } wl_nan_ndp_oper_cfg_t;
11782 
11783 typedef uint8 wl_nan_ndp_ndpid_t;
11784 typedef uint8 wl_nan_ndp_conn_t;
11785 
11786 #define WL_NAN_INVALID_NDPID	0	/* reserved ndp id */
11787 
11788 typedef struct wl_nan_dp_req {
11789 	uint8 type;		    /* 0- unicast 1 - multicast */
11790 	uint8 pub_id;		    /* Publisher ID */
11791 	uint16 flags;
11792 	struct ether_addr peer_mac; /* Peer's NMI addr */
11793 	struct ether_addr mcast_mac; /* Multicast addr */
11794 	struct ether_addr ndi;
11795 	wl_nan_dp_qos_t qos;
11796 	wl_nan_ndl_qos_t ndl_qos;	/* ndl qos */
11797 	uint8 tlv_params[];	/* xtlv parameters for command */
11798 } wl_nan_dp_req_t;
11799 
11800 /* TODO  Need to replace ndp_id with lndp_id */
11801 /* Return structure to data req IOVAR */
11802 typedef struct wl_nan_dp_req_ret {
11803 	struct ether_addr indi;	    /* Initiators data mac addr */
11804 	uint8 ndp_id;		    /* Initiators ndpid */
11805 	uint8 pad;
11806 } wl_nan_dp_req_ret_t;
11807 
11808 typedef struct wl_nan_dp_resp {
11809 	uint8 type;		    /* 0- unicast 1 - multicast */
11810 	uint8 status;		    /* Accepted or Rejected */
11811 	uint8 reason_code;
11812 	/* Local NDP ID for unicast, mc_id for multicast, 0 for implicit NMSG */
11813 	uint8 ndp_id;	/* can be host indp id also */
11814 	wl_nan_dp_qos_t qos;
11815 	/* Initiator data address for unicast or multicast address for multicast */
11816 	struct ether_addr mac_addr;
11817 	struct ether_addr ndi;
11818 	uint16 flags;
11819 	wl_nan_ndl_qos_t ndl_qos;	/* ndl qos */
11820 	uint8 tlv_params[];	/* xtlv parameters for command */
11821 } wl_nan_dp_resp_t;
11822 
11823 /* Return structure to data resp IOVAR */
11824 typedef struct wl_nan_dp_resp_ret {
11825 	uint8 nmsgid;		    /* NMSG ID or for multicast else 0 */
11826 	uint8 pad[3];
11827 } wl_nan_dp_resp_ret_t;
11828 
11829 typedef struct wl_nan_dp_conf {
11830 	uint8 lndp_id;	/* can be host ndp id */
11831 	uint8 status;	/* Accepted or Rejected */
11832 	uint8 pad[2];
11833 } wl_nan_dp_conf_t;
11834 
11835 typedef struct wl_nan_dp_end
11836 {
11837 	uint8 lndp_id;	/* can be host ndp id */
11838 	uint8 status;
11839 	struct ether_addr mac_addr;	/* initiator's ndi */
11840 } wl_nan_dp_end_t;
11841 
11842 typedef struct wl_nan_dp_schedupd {
11843 	uint8 type;		/* 0: unicast, 1: multicast */
11844 	uint8 flags;
11845 	struct ether_addr addr;	/* peer NMI or multicast addr */
11846 	wl_nan_dp_qos_t qos;
11847 	wl_nan_ndl_qos_t ndl_qos;	/* ndl qos */
11848 	uint8 map_id;
11849 	uint8 pad;
11850 	uint16 hostseq;
11851 } wl_nan_dp_schedupd_t;
11852 
11853 /* set: update with notification, unset: NDL setup handshake */
11854 #define WL_NAN_DP_SCHEDUPD_NOTIF (1 << 0)
11855 
11856 /* list ndp ids */
11857 typedef struct wl_nan_ndp_id_list {
11858 	uint16 ndp_count;
11859 	uint8 lndp_id[];
11860 } wl_nan_ndp_id_list_t;
11861 
11862 /* nan2 status */
11863 typedef struct ndp_session {
11864 	uint8 lndp_id;
11865 	uint8 state;
11866 	uint8 pub_id;
11867 	uint8 pad;
11868 } ndp_session_t;
11869 
11870 typedef struct wl_nan_ndp_status {
11871 	struct ether_addr peer_nmi;
11872 	struct ether_addr peer_ndi;
11873 	ndp_session_t session;
11874 	struct ether_addr lndi;
11875 	uint8 pad[2];
11876 } wl_nan_ndp_status_t;
11877 
11878 #define NAN_DP_OPAQUE_INFO_DP_RESP 0x01
11879 #define NAN_DP_OPAQUE_INFO_DP_CONF 0x02
11880 
11881 typedef struct wl_nan_dp_opaque_info {
11882 	uint8 frm_mask;   /* dp_resp / dp_conf as defined above. */
11883 	struct ether_addr initiator_ndi;  /* NDI to match in the dp_req. */
11884 	uint8 pub_id;     /* publish id where the opaque data is included. */
11885 	uint8 len;        /* len of opaque_info[]. */
11886 	uint8 pad[3];
11887 	uint8 opaque_info[0];
11888 } wl_nan_dp_opaque_info_t;
11889 
11890 /* events */
11891 #define NAN_DP_SESSION_UNICAST         0
11892 #define NAN_DP_SESSION_MULTICAST       1
11893 #define NAN_DP_SECURITY_NONE           0
11894 #define NAN_DP_SECURITY_CSID           1
11895 #define NAN_DP_SECURITY_MK             2
11896 #define WL_NAN_DATA_NMSGID_LEN    8 /* 8 bytes as per nan spec */
11897 
11898 /* Common event structure for Nan Datapath
11899  * Used for sending NDP Indication, Response, Confirmation, Securty Install and Establish events
11900  */
11901 typedef struct wl_nan_ev_datapath_cmn {
11902 	uint8 type;
11903 	/* ndp_id is valid only if type is unicast */
11904 	uint8 ndp_id;
11905 	uint8 pub_id;
11906 	uint8 security;
11907 	/* Following two fields are valid only if type is unicast */
11908 	struct ether_addr initiator_ndi;
11909 	struct ether_addr responder_ndi;
11910 	struct ether_addr peer_nmi;
11911 	uint8 status;
11912 	uint8 role;
11913 	/* Following two fields are valid only if type is multicast */
11914 	uint8 nmsg_id[WL_NAN_DATA_NMSGID_LEN];
11915 	uint8 mc_id;
11916 	uint8 pad;
11917 	uint16 opt_tlv_len;
11918 	uint8 opt_tlvs[];
11919 } wl_nan_ev_datapath_cmn_t;
11920 
11921 /* this is obsolete - DON'T USE */
11922 typedef struct wl_nan_ev_datapath_end {
11923 	uint8 ndp_id;
11924 	uint8 status;
11925 	uint8 pad[2];
11926 	struct ether_addr peer_nmi;
11927 	struct ether_addr peer_ndi;
11928 } wl_nan_ev_datapath_end_t;
11929 
11930 typedef struct wl_tsf {
11931 	uint32 tsf_l;
11932 	uint32 tsf_h;
11933 } wl_tsf_t;
11934 
11935 typedef struct wl_nan_ev_rx_bcn {
11936 	wl_tsf_t tsf;
11937 	uint16   bcn_len;
11938 	uint8    pad[2];
11939 	uint8    bcn[0];
11940 } wl_nan_ev_rx_bcn_t;
11941 
11942 /* reason of host assist request */
11943 enum wl_nan_host_assist_reason {
11944 	WL_NAN_HAST_REASON_NONE		= 0,
11945 
11946 	/* reason for host assist request */
11947 	WL_NAN_HAST_REASON_NO_CRB		= 1,	/* NDL: no common NA */
11948 	WL_NAN_HAST_REASON_NDC			= 2,	/* NDL: NDC not compliant */
11949 	WL_NAN_HAST_REASON_IMMUT		= 3,	/* NDL: peer immutable schedule */
11950 	WL_NAN_HAST_REASON_RNG			= 4,	/* NDL: ranging schedule */
11951 	WL_NAN_HAST_REASON_QOS			= 5,	/* NDL: QoS not satisfied */
11952 	WL_NAN_HAST_REASON_SVC_NDI_MISSING	= 6	/* SD: NDI associated with svc is missing */
11953 };
11954 typedef uint8 wl_nan_host_assist_reason_t;
11955 
11956 /* WL_NAN_XTLV_HOST_ASSIST_REQ */
11957 typedef struct wl_nan_host_assist_req {
11958 	struct ether_addr peer_nmi;		/* peer nmi */
11959 	struct ether_addr initiator_ndi;	/* initiator ndi */
11960 	uint8 indp_id;				/* initiator NDP ID */
11961 	wl_nan_frame_type_t frm_type;		/* received NAF type */
11962 	wl_nan_host_assist_reason_t reason;	/* reason of host assist request */
11963 	uint8 pub_id;				/* Publish ID (valid for WL_NAN_FRM_TYPE_DP_REQ) */
11964 	uint8 pad[2];
11965 } wl_nan_host_assist_req_t;
11966 
11967 /* nan sub-features */
11968 enum wl_nan_fw_cap_flag1 {
11969 	WL_NAN_FW_CAP_FLAG_NONE			= 0x00000000, /* dummy */
11970 	WL_NAN_FW_CAP_FLAG1_AVAIL		= 0x00000001,
11971 	WL_NAN_FW_CAP_FLAG1_DISC		= 0x00000002,
11972 	WL_NAN_FW_CAP_FLAG1_DATA		= 0x00000004,
11973 	WL_NAN_FW_CAP_FLAG1_SEC			= 0x00000008,
11974 	WL_NAN_FW_CAP_FLAG1_RANGE		= 0x00000010,
11975 	WL_NAN_FW_CAP_FLAG1_WFA_TB		= 0x00000020,
11976 	WL_NAN_FW_CAP_FLAG1_DAM			= 0x00000040,
11977 	WL_NAN_FW_CAP_FLAG1_DAM_STRICT		= 0x00000080,
11978 	WL_NAN_FW_CAP_FLAG1_DAM_AUTO		= 0x00000100,
11979 	WL_NAN_FW_CAP_FLAG1_DBG			= 0x00000200,
11980 	WL_NAN_FW_CAP_FLAG1_BCMC_IN_NDC		= 0x00000400,
11981 	WL_NAN_FW_CAP_FLAG1_CHSTATS		= 0x00000800,
11982 	WL_NAN_FW_CAP_FLAG1_ASSOC_COEX		= 0x00001000,
11983 	WL_NAN_FW_CAP_FLAG1_FASTDISC		= 0x00002000,
11984 	WL_NAN_FW_CAP_FLAG1_NO_ID_GEN		= 0x00004000,
11985 	WL_NAN_FW_CAP_FLAG1_DP_OPAQUE_DATA	= 0x00008000,
11986 	WL_NAN_FW_CAP_FLAG1_NSR2		= 0x00010000,
11987 	WL_NAN_FW_CAP_FLAG1_NSR2_SAVE		= 0x00020000,
11988 	WL_NAN_FW_CAP_FLAG1_NANHO		= 0x00040000
11989 };
11990 
11991 /* WL_NAN_XTLV_GEN_FW_CAP */
11992 typedef struct wl_nan_fw_cap {
11993 	uint32 flags1;                  /* nan sub-features compiled in firmware */
11994 	uint32 flags2;                  /* for more sub-features in future */
11995 	uint8  max_svc_publishes;        /* max num of service publish */
11996 	uint8  max_svc_subscribes;       /* max num of service subscribe */
11997 	uint8  max_lcl_sched_maps;       /* max num of local schedule map */
11998 	uint8  max_lcl_ndc_entries;      /* max num of local NDC entry */
11999 	uint8  max_lcl_ndi_interfaces;   /* max num of local NDI interface */
12000 	uint8  max_peer_entries;         /* max num of peer entry */
12001 	uint8  max_ndp_sessions;         /* max num of NDP session */
12002 	uint8  max_concurrent_nan_clusters; /* max num of concurrent clusters */
12003 	uint16 max_service_name_len; /* max service name length */
12004 	uint16 max_match_filter_len; /* max match filter length */
12005 	uint16 max_total_match_filter_len; /* max total match filter length */
12006 	uint16 max_service_specific_info_len; /* max service specific info length */
12007 	uint16 max_vsa_data_len; /* max vendor specific attrib data length */
12008 	uint16 max_mesh_data_len; /* max mesh data length */
12009 	uint16 max_app_info_len; /* max app info length */
12010 	uint16 max_sdea_svc_specific_info_len; /* max sdea ser specific info length */
12011 	uint8  max_queued_tx_followup_msgs; /* max no. of queued tx followup msgs */
12012 	uint8  max_subscribe_address; /* max subscribe addresses supported */
12013 	uint8  ndp_supported_bands; /* number of ndp supported bands */
12014 	uint8  is_ndp_security_supported; /* if secure ndp is supported */
12015 	uint8  cipher_suites_supported_mask; /* bitmask for suites supported */
12016 	uint8  pad[3];
12017 } wl_nan_fw_cap_t;
12018 
12019 /* nan cipher suite support mask bits */
12020 #define WL_NAN_CIPHER_SUITE_SHARED_KEY_128_MASK  0x01
12021 #define WL_NAN_CIPHER_SUITE_SHARED_KEY_256_MASK  0x02
12022 
12023 /* NAN Save Restore */
12024 #define WL_NAN_NSR2_INFO_MAX_SIZE	2048 /* arbitrary */
12025 
12026 /* WL_NAN_XTLV_NSR2_PEER */
12027 typedef struct wl_nan_nsr_peer_info {
12028 	struct ether_addr nmi;
12029 	uint8 l_min_slots;	/* local QoS min slots */
12030 	uint8 p_min_slots;	/* peer QoS min slots */
12031 	uint16 l_max_latency;	/* local QoS max latency */
12032 	uint16 p_max_latency;	/* peer QoS max latency */
12033 	uint8 num_map;		/* num of NA map */
12034 	uint8 pad;
12035 	uint16 attrs_len;	/* total len of following attrs */
12036 	uint8 attrs[];		/* peer attributes (NA/NDC/ULW/DevCap/Element container) */
12037 } wl_nan_nsr_peer_info_t;
12038 
12039 enum wl_nan_nsr_ndp_flag {
12040 	WL_NAN_NSR_NDP_FLAG_LCL_INITATOR	= 0x0001,
12041 	WL_NAN_NSR_NDP_FLAG_MCAST		= 0x0002
12042 };
12043 typedef uint16 wl_nan_nsr_ndp_flag_t;
12044 
12045 /* WL_NAN_XTLV_NSR2_NDP */
12046 typedef struct wl_nan_nsr_ndp_info {
12047 	struct ether_addr peer_nmi;
12048 	struct ether_addr peer_ndi;
12049 	struct ether_addr lcl_ndi;
12050 	uint16 flags;		/* wl_nan_nsr_ndp_flag_t */
12051 	uint8 pub_id;		/* publish id */
12052 	uint8 indp_id;		/* initiator's ndp id */
12053 	uint8 last_token;	/* last NDP dialog token */
12054 	uint8 pad;
12055 } wl_nan_nsr_ndp_info_t;
12056 
12057 /* NAN2.0 Ranging definitions */
12058 
12059 /* result indication bit map */
12060 #define NAN_RANGE_INDICATION_CONT		(1<<0)
12061 #define NAN_RANGE_INDICATION_INGRESS		(1<<1)
12062 #define NAN_RANGE_INDICATION_EGRESS		(1<<2)
12063 
12064 /* responder flags */
12065 #define NAN_RANGE_FLAG_AUTO_ACCEPT	(1 << 0)
12066 #define NAN_RANGE_FLAG_RESULT_REQUIRED	(1 << 1)
12067 
12068 typedef struct wl_nan_range_req {
12069 	struct ether_addr peer;
12070 	uint8 publisher_id;
12071 	uint8 indication; /* bit map for result event */
12072 	uint32 resolution; /* default millimeters */
12073 	uint32 ingress; /* ingress limit in mm */
12074 	uint32 egress; /* egress limit in mm */
12075 	uint32 interval; /* max interval(in TU) b/w two ranging measurements */
12076 } wl_nan_range_req_t;
12077 
12078 #define NAN_RNG_REQ_IOV_LEN	24
12079 
12080 typedef uint8 wl_nan_range_id;
12081 
12082 typedef struct wl_nan_range_resp {
12083 	wl_nan_range_id range_id;
12084 	uint8 flags; /* auto response, range result required */
12085 	uint8 status; /* accept, reject */
12086 	uint8 indication; /* bit map for result event */
12087 	uint32 resolution; /* default millimeters */
12088 	uint32 ingress; /* ingress limit in mm */
12089 	uint32 egress; /* egress limit in mm */
12090 	uint32 interval; /* max interval(in TU) b/w two ranging measurements */
12091 } wl_nan_range_resp_t;
12092 
12093 #define NAN_RNG_RESP_IOV_LEN	20
12094 
12095 #define NAN_RNG_TERM_FLAG_IMMEDIATE				(1u << 0u) /* Do not wait for TXS */
12096 #define NAN_RNG_TERM_FLAG_SILIENT_TEARDOWN	(1u << 1u) /* Do not TX rng_term */
12097 #define NAN_RNG_TERM_FLAG_EVENT_HOST			(1u << 2u) /* Notify event to host */
12098 #define NAN_RNG_TERM_FLAG_OPT_TLVS				(1u << 3u) /* opt tlvs present */
12099 
12100 typedef struct wl_nan_range_cancel_ext {
12101 	wl_nan_range_id range_id;
12102 	uint8 flags;
12103 	uint8 pad[2];
12104 } wl_nan_range_cancel_ext_t;
12105 
12106 #define NAN_RNG_CANCEL_IOV_FIXED_LEN	4u
12107 
12108 #define NAN_RNG_MAX_IOV_LEN	255
12109 
12110 typedef struct wl_nan_ev_rng_req_ind {
12111 	struct ether_addr peer_m_addr;
12112 	uint8 rng_id;
12113 	/* ftm parameters */
12114 	uint8 max_burst_dur;
12115 	uint8 min_ftm_delta;
12116 	uint8 max_num_ftm;
12117 	uint8 ftm_format_bw;
12118 	/* location info availability bit map */
12119 	uint8 lc_info_avail;
12120 	/* Last movement indication */
12121 	uint16 last_movement;
12122 	uint8 pad[2];
12123 } wl_nan_ev_rng_req_ind_t;
12124 
12125 #define NAN_RNG_REQ_IND_SIZE 14
12126 
12127 typedef struct wl_nan_ev_rng_rpt_ind {
12128 	uint32 dist_mm; /* in millimeter */
12129 	struct ether_addr peer_m_addr;
12130 	uint8 indication; /* indication definitions mentioned above */
12131 	uint8 rng_id;
12132 } wl_nan_ev_rng_rpt_ind_t;
12133 
12134 #define NAN_RNG_RPT_IND_SIZE 12
12135 
12136 /* number of continuous ranging crbs which can be idle,
12137 * after which ranging session will be terminated.
12138 * Default value is 5. Set to zero for disabling the
12139 * idle timeout functionality
12140 */
12141 typedef uint8 wl_nan_range_idle_count_t;
12142 
12143 /* nan ranging termination reason codes */
12144 #define NAN_RNG_TERM_IDLE_TIMEOUT	1 /* no ftms from peer */
12145 #define NAN_RNG_TERM_PEER_REQ		2
12146 #define NAN_RNG_TERM_USER_REQ		3
12147 #define NAN_RNG_TERM_RNG_RESP_TIMEOUT	4
12148 
12149 typedef struct wl_nan_ev_rng_term_ind {
12150 	struct ether_addr peer_m_addr;
12151 	uint8 reason_code;
12152 	uint8 rng_id;
12153 } wl_nan_ev_rng_term_ind_t;
12154 
12155 #define NAN_RNG_TERM_IND_SIZE 8
12156 
12157 typedef struct wl_nan_ev_rng_resp {
12158 	struct ether_addr peer_m_addr;
12159 	uint8 status;
12160 	uint8 rng_id;
12161 } wl_nan_ev_rng_resp_t;
12162 
12163 /* Used by NDL schedule events -
12164  * WL_NAN_EVENT_PEER_SCHED_UPD_NOTIF, WL_NAN_EVENT_PEER_SCHED_REQ
12165  * WL_NAN_EVENT_PEER_SCHED_RESP, WL_NAN_EVENT_PEER_SCHED_CONF
12166  */
12167 typedef struct wl_nan_ev_sched_info {
12168 	struct ether_addr peer_nmi;
12169 	uint8	ndl_status;	/* applies only to sched resp/conf */
12170 	uint8	pad;
12171 	uint16	opt_tlv_len;
12172 	uint8	opt_tlvs[];
12173 } wl_nan_ev_sched_info_t;
12174 
12175 /* WL_NAN_EVENT_CHAN_BOUNDARY */
12176 typedef struct wl_nan_chbound_info {
12177 	uint32	cluster_tsf_h;	/* Current Cluster TSF High */
12178 	uint32	cluster_tsf_l;	/* Current Cluster TSF Low */
12179 	uint16	cur_chspec;
12180 	uint16	opt_tlvs_len;
12181 	uint8	opt_tlvs[];
12182 } wl_nan_chbound_info_t;
12183 
12184 /* channel stats (includes nan & non-nan) */
12185 
12186 /* WL_NAN_XTLV_CCA_STATS */
12187 typedef struct wl_nan_cca_stats {
12188 	uint16	chanspec;
12189 	uint8	pad[2];
12190 	uint32	sample_dur;
12191 
12192 	uint32	congest_ibss;
12193 	uint32	congest_obss;
12194 	uint32	interference;
12195 } wl_nan_cca_stats_t;
12196 
12197 /* WL_NAN_XTLV_PER_STATS */
12198 typedef struct wl_nan_per_stats_s {
12199 	uint16	chanspec;
12200 	uint8	pad[2];
12201 	uint32	sample_dur;
12202 
12203 	uint32	txframe;	/* tx data frames */
12204 	uint32	txretrans;	/* tx mac retransmits */
12205 	uint32	txerror;	/* tx data errors  */
12206 	uint32	txctl;		/* tx management frames */
12207 	uint32	txserr;		/* tx status errors */
12208 
12209 	uint32	rxframe;	/* rx data frames */
12210 	uint32	rxerror;	/* rx data errors */
12211 	uint32	rxctl;		/* rx management frames */
12212 
12213 	uint32	txbar;		/* tx bar */
12214 	uint32	rxbar;		/* rx bar */
12215 	uint32	txaction;	/* tx action frame */
12216 	uint32	rxaction;	/* rx action frame */
12217 	uint32  txlost;		/* lost packets reported in txs */
12218 	uint32  rxback;		/* rx block ack */
12219 	uint32  txback;		/* tx bloak ack */
12220 } wl_nan_per_stats_t;
12221 
12222 /* fast discovery beacon config
12223  * WL_NAN_XTLV_CFG_FDISC_TBMP
12224 */
12225 typedef struct wl_nan_fastdisc_s {
12226 	uint8 id;
12227 	uint8 bitmap_len;
12228 	uint8 pad[2];
12229 	uint8 bitmap[];
12230 } wl_nan_fastdisc_t;
12231 
12232 #define WL_NAN_FASTDISC_CFG_SIZE	1024 /* arbitrary */
12233 
12234 /* ********************* end of NAN section ******************************** */
12235 /* endif WL_NAN */
12236 
12237 #define P2P_NAN_IOC_BUFSZ  512 /* some sufficient ioc buff size */
12238 #define WL_P2P_NAN_IOCTL_VERSION    0x1
12239 
12240 /* container for p2p nan iovtls & events */
12241 typedef struct wl_p2p_nan_ioc {
12242 	uint16  version;    /* interface command or event version */
12243 	uint16  id;     /* p2p nan ioctl cmd  ID  */
12244 	uint16  len;        /* total length of data[]  */
12245 	uint16  pad;        /* padding */
12246 	uint8   data [];   /* var len payload of bcm_xtlv_t type */
12247 } wl_p2p_nan_ioc_t;
12248 
12249 /* p2p nan cmd IDs */
12250 enum wl_p2p_nan_cmds {
12251 	/* p2p nan cfg ioctls */
12252 	WL_P2P_NAN_CMD_ENABLE = 1,
12253 	WL_P2P_NAN_CMD_CONFIG = 2,
12254 	WL_P2P_NAN_CMD_DEL_CONFIG = 3,
12255 	WL_P2P_NAN_CMD_GET_INSTS = 4
12256 };
12257 
12258 #define WL_P2P_NAN_CONFIG_VERSION       1
12259 
12260 #define WL_P2P_NAN_DEVICE_P2P  0x0
12261 #define WL_P2P_NAN_DEVICE_GO   0x1
12262 #define WL_P2P_NAN_DEVICE_GC   0x2
12263 #define WL_P2P_NAN_DEVICE_INVAL   0xFF
12264 
12265 /* NAN P2P operation */
12266 typedef struct p2p_nan_config {
12267 	uint16 version;            /* wl_p2p_nan_config_t structure version */
12268 	uint16 len;                /* total length including version and variable IE */
12269 	uint32 flags;              /* 0x1 to NEW, 0x2 to ADD, 0x4 to DEL */
12270 	uint8  inst_id;            /* publisher/subscriber id */
12271 	uint8  inst_type;          /* publisher/subscriber */
12272 	uint8  dev_role;           /* P2P device role: 'P2P','GO' or 'GC' */
12273 	uint8  pad1;               /* padding */
12274 	uint8  resolution;         /* Availability bitmap resolution */
12275 	uint8  repeat;             /* Whether Availabilty repeat across DW */
12276 	uint16 ie_len;             /* variable ie len */
12277 	struct ether_addr dev_mac; /* P2P device addres */
12278 	uint16 pad2;               /* Padding */
12279 	uint32 avail_bmap;         /* availability interval bitmap */
12280 	uint32 chanspec;           /* Chanspec */
12281 	uint8  ie[];              /* hex ie data */
12282 } wl_p2p_nan_config_t;
12283 
12284 #define WL_P2P_NAN_SERVICE_LIST_VERSION 1
12285 typedef enum wl_nan_service_type {
12286 	WL_NAN_SVC_INST_PUBLISHER = 1,
12287 	WL_NAN_SVC_INST_SUBSCRIBER = 2
12288 } wl_nan_service_type_t;
12289 
12290 #define WL_P2P_NAN_CONFIG_NEW   0x1
12291 #define WL_P2P_NAN_CONFIG_ADD   0x2
12292 #define WL_P2P_NAN_CONFIG_DEL   0x4
12293 
12294 typedef struct wl_nan_svc_inst {
12295 	uint8  inst_id;      /* publisher/subscriber id */
12296 	uint8  inst_type;    /* publisher/subscriber */
12297 } wl_nan_svc_inst_t;
12298 
12299 typedef struct wl_nan_svc_inst_list {
12300 	uint16 version;           /* this structure version */
12301 	uint16 len;               /* total length including version and variable svc list */
12302 	uint16 count;             /* service instance count */
12303 	uint16 pad;               /* padding */
12304 	wl_nan_svc_inst_t svc[1]; /* service instance list */
12305 } wl_nan_svc_inst_list_t;
12306 
12307 #define NAN_POST_DISC_P2P_DATA_VER  1
12308 /* This structure will be used send peer p2p data with
12309  * NAN discovery result
12310  */
12311 typedef struct nan_post_disc_p2p_data {
12312 	uint8 ver;                 /* this structure version */
12313 	uint8 dev_role;            /* P2P Device role */
12314 	uint8 resolution;          /* Availability bitmap resolution */
12315 	uint8 repeat;              /* Whether Availabilty repeat across DW */
12316 	struct ether_addr dev_mac; /* P2P device addres */
12317 	uint16 pad1;               /* Padding */
12318 	uint32 chanspec;           /* Chanspec */
12319 	uint32 avl_bmp;				/* availability interval bitmap */
12320 } nan_post_disc_p2p_data_t;
12321 
12322 enum {
12323 	WL_AVAIL_NONE		= 0x0000,
12324 	WL_AVAIL_LOCAL		= 0x0001,
12325 	WL_AVAIL_PEER		= 0x0002,
12326 	WL_AVAIL_NDC		= 0x0003,
12327 	WL_AVAIL_IMMUTABLE	= 0x0004,
12328 	WL_AVAIL_RESPONSE	= 0x0005,
12329 	WL_AVAIL_COUNTER	= 0x0006,
12330 	WL_AVAIL_RANGING	= 0x0007,
12331 	WL_AVAIL_UPD_POT	= 0x0008,	/* modify potential, keep committed/conditional */
12332 	WL_AVAIL_UPD_COM_COND	= 0x0009,	/* modify committed/conditional, keep potential */
12333 	WL_AVAIL_REMOVE_MAP	= 0x000A,	/* remove map */
12334 	WL_AVAIL_FRM_TYPE	= 0x000B,	/* specify frame types containing NA */
12335 	WL_AVAIL_TYPE_MAX	= WL_AVAIL_FRM_TYPE	/* New ones before and update */
12336 };
12337 #define WL_AVAIL_TYPE_MASK		0x000F
12338 #define WL_AVAIL_FLAG_REMOVE		0x2000	/* remove schedule attr of given type & map id */
12339 #define WL_AVAIL_FLAG_SELECTED_NDC	0x4000
12340 #define WL_AVAIL_FLAG_RAW_MODE		0x8000
12341 #define WL_AVAIL_FLAGS_MASK		0xFF00
12342 #define WL_AVAIL_FLAGS_SHIFT		8
12343 
12344 typedef int16 wl_avail_flags_t;
12345 
12346 /* availability entry flags */
12347 enum {
12348 	WL_AVAIL_ENTRY_NONE		= 0x0000,
12349 	WL_AVAIL_ENTRY_COM		= 0x0001,		/* committed */
12350 	WL_AVAIL_ENTRY_POT		= 0x0002,		/* potential */
12351 	WL_AVAIL_ENTRY_COND		= 0x0004,	/* conditional */
12352 	WL_AVAIL_ENTRY_PAGED		= 0x0008,	/* P-NDL */
12353 	WL_AVAIL_ENTRY_USAGE		= 0x0030,	/* usage preference */
12354 	WL_AVAIL_ENTRY_BIT_DUR		= 0x00C0,	/* bit duration */
12355 	WL_AVAIL_ENTRY_BAND_PRESENT	= 0x0100,	/* band present */
12356 	WL_AVAIL_ENTRY_CHAN_PRESENT	= 0x0200,	/* channel information present */
12357 	WL_AVAIL_ENTRY_CHAN_ENTRY_PRESENT = 0x0400,	/* channel entry (opclass+bitmap) */
12358 	/* free to use 0x0800 */
12359 	WL_AVAIL_ENTRY_RXNSS		= 0xF000	/* max num of spatial stream RX */
12360 };
12361 
12362 /* bit duration */
12363 enum {
12364 	WL_AVAIL_BIT_DUR_16	= 0,	/* 16TU */
12365 	WL_AVAIL_BIT_DUR_32	= 1,	/* 32TU */
12366 	WL_AVAIL_BIT_DUR_64	= 2,	/* 64TU */
12367 	WL_AVAIL_BIT_DUR_128	= 3,	/* 128TU */
12368 };
12369 
12370 /* period */
12371 enum {
12372 	WL_AVAIL_PERIOD_0	= 0,	/* 0TU */
12373 	WL_AVAIL_PERIOD_128	= 1,	/* 128TU */
12374 	WL_AVAIL_PERIOD_256	= 2,	/* 256TU */
12375 	WL_AVAIL_PERIOD_512	= 3,	/* 512TU */
12376 	WL_AVAIL_PERIOD_1024	= 4,	/* 1024TU */
12377 	WL_AVAIL_PERIOD_2048	= 5,	/* 2048TU */
12378 	WL_AVAIL_PERIOD_4096	= 6,	/* 4096TU */
12379 	WL_AVAIL_PERIOD_8192	= 7,	/* 8192TU */
12380 };
12381 
12382 /* band */
12383 enum {
12384 	WL_AVAIL_BAND_NONE	= 0,	/* reserved */
12385 	WL_AVAIL_BAND_SUB1G	= 1,	/* sub-1 GHz */
12386 	WL_AVAIL_BAND_2G	= 2,	/* 2.4 GHz */
12387 	WL_AVAIL_BAND_3G	= 3,	/* reserved (for 3.6 GHz) */
12388 	WL_AVAIL_BAND_5G	= 4,	/* 4.9 and 5 GHz */
12389 	WL_AVAIL_BAND_60G	= 5,	/* reserved (for 60 GHz) */
12390 };
12391 
12392 #define WL_AVAIL_ENTRY_TYPE_MASK	0x000F
12393 #define WL_AVAIL_ENTRY_USAGE_MASK	0x0030 /* up to 4 usage preferences */
12394 #define WL_AVAIL_ENTRY_USAGE_SHIFT	4
12395 #define WL_AVAIL_ENTRY_USAGE_VAL(_flags)	(((_flags) & WL_AVAIL_ENTRY_USAGE_MASK) \
12396 	>> WL_AVAIL_ENTRY_USAGE_SHIFT)
12397 
12398 #define WL_AVAIL_ENTRY_BIT_DUR_MASK	0x00C0 /* 0:16TU, 1:32TU, 2:64TU, 3:128TU */
12399 #define WL_AVAIL_ENTRY_BIT_DUR_SHIFT	6
12400 #define WL_AVAIL_ENTRY_BIT_DUR_VAL(_flags)	(((_flags) & WL_AVAIL_ENTRY_BIT_DUR_MASK) \
12401 	>> WL_AVAIL_ENTRY_BIT_DUR_SHIFT)
12402 
12403 #define WL_AVAIL_ENTRY_BAND_MASK	0x0100 /* 0=band not present, 1=present */
12404 #define WL_AVAIL_ENTRY_BAND_SHIFT	8
12405 
12406 #define WL_AVAIL_ENTRY_CHAN_MASK	0x0200 /* 0=channel info not present, 1=present */
12407 #define WL_AVAIL_ENTRY_CHAN_SHIFT	9
12408 
12409 #define WL_AVAIL_ENTRY_CHAN_ENTRY_MASK	0x0400 /* 0=chanspec, 1=hex channel entry */
12410 #define WL_AVAIL_ENTRY_CHAN_ENTRY_SHIFT	10
12411 
12412 #define WL_AVAIL_ENTRY_RXNSS_MASK	0xF000
12413 #define WL_AVAIL_ENTRY_RXNSS_SHIFT	12
12414 #define WL_AVAIL_ENTRY_RXNSS_VAL(_flags)	(((_flags) & WL_AVAIL_ENTRY_RXNSS_MASK) \
12415 	>> WL_AVAIL_ENTRY_RXNSS_SHIFT)
12416 #define WL_AVAIL_ENTRY_RXNSS_MAX	15	/* 0-15 */
12417 
12418 /* mask for channel_entry (to be obsoleted) */
12419 #define WL_AVAIL_ENTRY_OPCLASS_MASK		0xFF
12420 #define WL_AVAIL_ENTRY_CHAN_BITMAP_MASK		0xFF00
12421 #define WL_AVAIL_ENTRY_CHAN_BITMAP_SHIFT	8
12422 #define WL_AVAIL_ENTRY_CHAN_BITMAP_VAL(_info)	(((_info) & WL_AVAIL_ENTRY_CHAN_BITMAP_MASK) \
12423 	>> WL_AVAIL_ENTRY_CHAN_BITMAP_SHIFT)
12424 
12425 /* Used for raw channel entry field input */
12426 #define MAX_CHAN_ENTRY_LEN 6
12427 
12428 typedef struct wl_avail_entry {
12429 	uint16		length;		/* total length */
12430 	uint16		start_offset;	/* in TUs, multiply by 16 for total offset */
12431 	union {
12432 		uint32 channel_info;	/* either chanspec or hex channel entry (opclass +
12433 					 * bitmap per NAN spec), as indicated by setting
12434 					 * WL_AVAIL_ENTRY_HEX_CHAN_ENTRY flag
12435 					 */
12436 		uint32 band;		/* defined by WL_BAND enum, 2=2.4GHz, 4=5GHz */
12437 		uint8 channel_entry[MAX_CHAN_ENTRY_LEN];
12438 		uint8 align[8];		/* aligned len of union in structure (not for use)
12439 					 * if member of union is changed,
12440 					 * update length of align[] accordingly.
12441 					 */
12442 	} u;				/* band or channel value, 0=all band/channels */
12443 	uint8		sched_map_id;	/* avail map id associated with sched entry */
12444 	uint8		pad;
12445 	uint8		period;		/* in TUs, defined by WL_AVAIL_PERIOD enum
12446 					 * 1:128, 2:256, 3:512, 4:1024, 5:2048, 6:4096,
12447 					 * 7:8192
12448 					 */
12449 	uint8		bitmap_len;
12450 	uint16		flags;		/* defined by avail entry flags enum:
12451 					 * type, usage pref, bit duration, rx nss,
12452 					 * and band, channel or channel entry
12453 					 */
12454 	uint8		bitmap[];	/* time bitmap */
12455 } wl_avail_entry_t;
12456 
12457 #define WL_AVAIL_VERSION	1	/* current wl_avail version */
12458 
12459 typedef struct wl_avail {
12460 	uint16		length;		/* total length */
12461 	uint16		flags;		/* LSB - avail type (defined by WL_AVAIL enum)
12462 					 * MSB - avail flags
12463 					 */
12464 	uint8		id;		/* id used for multiple maps/avail */
12465 	uint8		lndc_id;	/* ndc id used in multi-ndc case */
12466 	uint8		version;
12467 	uint8		pad;
12468 	struct ether_addr addr;		/* peer mac address or ndc id */
12469 	uint8		num_entries;
12470 	uint8		unused_byte;
12471 	/* add additional fields above this line */
12472 	uint8		entry[];
12473 } wl_avail_t;
12474 
12475 #define WL_AVAIL_MIN_LEN(n) ((n) ? OFFSETOF(wl_avail_t, entry) + \
12476 		((n) * OFFSETOF(wl_avail_entry_t, bitmap)) : 0)
12477 
12478 /* unaligned schedule (window) */
12479 typedef struct wl_avail_ulw {
12480 	uint8	id;		/* schedule ID */
12481 	uint8	overwrite;	/* bit 0: overwrite all
12482 				 * 1-4: map ID if overwrite all is 0
12483 				 */
12484 	uint16	flags;
12485 	uint32	start;		/* start time of first ULW, in us */
12486 	uint32	dur;		/* duration of ULW, in us */
12487 	uint32	period;		/* time between consecutive ULWs, in us */
12488 	union {
12489 		uint32 chanspec;
12490 		uint32 band;
12491 		uint8 chan_entry[MAX_CHAN_ENTRY_LEN];
12492 		uint8 pad[8];
12493 	} u;
12494 	uint8	cntdwn;		/* remaining ULWs before schedule ends */
12495 	uint8	pad[3];
12496 } wl_avail_ulw_t;
12497 
12498 /* unset: NAN is not available during ULW, set: NAN is avail depending on ctrl flags */
12499 #define WL_NAN_ULW_CTRL_PRESENT		(1 << 0)
12500 /* unset: band, set: channel */
12501 #define WL_NAN_ULW_CTRL_TYPE		(1 << 1)
12502 /* set: NAN is availabile on specified band/channel */
12503 #define WL_NAN_ULW_CTRL_AVAIL		(1 << 2)
12504 /* channel is provided in raw attribute format */
12505 #define WL_NAN_ULW_CTRL_RAW_CHAN	(1 << 3)
12506 
12507 /* nan wfa testmode operations */
12508 enum {
12509 	WL_NAN_WFA_TM_IGNORE_TERMINATE_NAF		= 0x00000001,
12510 	WL_NAN_WFA_TM_IGNORE_RX_DATA_OUTSIDE_CRB	= 0x00000002,
12511 	WL_NAN_WFA_TM_ALLOW_TX_DATA_OUTSIDE_CRB		= 0x00000004,
12512 	WL_NAN_WFA_TM_ENFORCE_NDL_COUNTER		= 0x00000008,
12513 	WL_NAN_WFA_TM_BYPASS_NDL_PROPOSAL_VALIDATION	= 0x00000010,
12514 	/* allow data(pings) tx while ndp sec negotiation */
12515 	WL_NAN_WFA_TM_SEC_SEND_PINGS_BYPASS_NDP_SM	= 0x00000020,
12516 	/* generate and insert incorrect mic */
12517 	WL_NAN_WFA_TM_SEC_INCORRECT_MIC		        = 0x00000040,
12518 	/* send m4 reject deliberately */
12519 	WL_NAN_WFA_TM_SEC_REJECT_STATUS4M4		= 0x00000080,
12520 	/* send mgmt frame (for eg. ndp terminate) in clear txt (bypass security) */
12521 	WL_NAN_WFA_TM_SEC_SEND_MGMT_CLEAR	        = 0x00000100,
12522 	/* validate qos */
12523 	WL_NAN_WFA_TM_NDL_QOS_VALIDATE			= 0x00000200,
12524 	/* firmware generated schedule update */
12525 	WL_NAN_WFA_TM_GEN_SCHED_UPD			= 0x00000400,
12526 	/* add lower 4-bytes of TSF to configured start time */
12527 	WL_NAN_WFA_TM_ULW_START_TIME			= 0x00000800,
12528 	/* enable schedule validation for SDF */
12529 	WL_NAN_WFA_TM_SDF_SCHED_VALIDATE		= 0x00001000,
12530 	/* by pass faw na iovar */
12531 	WL_NAN_WFA_TM_SKIP_RAW_NA_BLOB		        = 0x00002000,
12532 	/* overwrite local NA with peer NA in received frame */
12533 	WL_NAN_WFA_TM_LOCAL_NA_OVERWRITE		= 0x00004000,
12534 	/* randomize and self configure ndl qos(needed at responder in auto mode) */
12535 	WL_NAN_WFA_TM_SELF_CFG_NDL_QOS                  = 0x00008000,
12536 	/* send NAF frames only in DW */
12537 	WL_NAN_WFA_TM_SEND_NAF_IN_DW			= 0x00010000,
12538 	/* restrict channels used for countered slots to Ch 6/149 only */
12539 	WL_NAN_WFA_TM_RESTRICT_COUNTER_SLOTS_CHAN	= 0x00020000,
12540 	/* NDPE negative test case (4.2.5 & 4.2.6) */
12541 	WL_NAN_WFA_TM_NDPE_NEGATIVE_TEST_TB		= 0x00040000,
12542 	/* Set NDPE(NAN3.0) capable bit in dev cap attr */
12543 	WL_NAN_WFA_TM_ENABLE_NDPE_CAP			= 0x00080000,
12544 
12545 	/* add above & update mask */
12546 	WL_NAN_WFA_TM_FLAG_MASK                         = 0x000FFFFF
12547 };
12548 typedef uint32 wl_nan_wfa_testmode_t;
12549 
12550 /* To be removed; replaced by wl_nan_vndr_payload */
12551 typedef struct wl_nan_vndr_ie {
12552 	uint32  flags;			/* bitmask indicating which packet(s) contain this IE */
12553 	uint16  body_len;		/* length of body (does not include oui field) */
12554 	uint8   pad[2];
12555 	uint8   oui[DOT11_OUI_LEN];
12556 	uint8   pad2;
12557 	uint8   body[];			/* vendor IE payload */
12558 } wl_nan_vndr_ie_t;
12559 
12560 typedef struct wl_nan_vndr_payload {
12561 	uint32  flags;			/* bitmask indicating which packet(s) contain payload */
12562 	uint16  payload_len;		/* length of payload */
12563 	uint8   pad[2];
12564 	uint8   payload[];		/* payload to be appended to NAN frame */
12565 } wl_nan_vndr_payload_t;
12566 
12567 typedef struct wl_nan_dev_cap {
12568 	uint8 bands[NAN_MAX_BANDS];
12569 	uint8 awake_dw[NAN_MAX_BANDS];
12570 	uint8 overwrite_mapid[NAN_MAX_BANDS];
12571 	uint8 mapid;	/* dev cap mapid */
12572 	uint8 all_maps;	/* applies to device */
12573 	uint8 paging;
12574 	uint8 pad[3];
12575 } wl_nan_dev_cap_t;
12576 
12577 /* arbitrary max len for frame template */
12578 #define WL_NAN_FRM_TPLT_MAX_LEN	1024
12579 
12580 typedef struct wl_nan_frm_tplt {
12581 	wl_nan_frame_type_t type;
12582 	uint8   pad;
12583 	uint16  len;		/* length of template */
12584 	uint8   data[];		/* template */
12585 } wl_nan_frm_tplt_t;
12586 
12587 #define RSSI_THRESHOLD_SIZE 16
12588 #define MAX_IMP_RESP_SIZE 256
12589 
12590 typedef struct wl_proxd_rssi_bias {
12591 	int32		version;			/**< version */
12592 	int32		threshold[RSSI_THRESHOLD_SIZE];	/**< threshold */
12593 	int32		peak_offset;			/**< peak offset */
12594 	int32		bias;				/**< rssi bias */
12595 	int32		gd_delta;			/**< GD - GD_ADJ */
12596 	int32		imp_resp[MAX_IMP_RESP_SIZE];	/**< (Hi*Hi)+(Hr*Hr) */
12597 } wl_proxd_rssi_bias_t;
12598 
12599 typedef struct wl_proxd_rssi_bias_avg {
12600 	int32		avg_threshold[RSSI_THRESHOLD_SIZE];	/**< avg threshold */
12601 	int32		avg_peak_offset;			/**< avg peak offset */
12602 	int32		avg_rssi;				/**< avg rssi */
12603 	int32		avg_bias;				/**< avg bias */
12604 } wl_proxd_rssi_bias_avg_t;
12605 
12606 #include <packed_section_start.h>
12607 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_info {
12608 	uint16		type;  /**< type: 0 channel table, 1 channel smoothing table, 2 and 3 seq */
12609 	uint16		index;		/**< The current frame index, from 1 to total_frames. */
12610 	uint16		tof_cmd;	/**< M_TOF_CMD      */
12611 	uint16		tof_rsp;	/**< M_TOF_RSP      */
12612 	uint16		tof_avb_rxl;	/**< M_TOF_AVB_RX_L */
12613 	uint16		tof_avb_rxh;	/**< M_TOF_AVB_RX_H */
12614 	uint16		tof_avb_txl;	/**< M_TOF_AVB_TX_L */
12615 	uint16		tof_avb_txh;	/**< M_TOF_AVB_TX_H */
12616 	uint16		tof_id;		/**< M_TOF_ID */
12617 	uint8		tof_frame_type;
12618 	uint8		tof_frame_bw;
12619 	int8		tof_rssi;
12620 	int32		tof_cfo;
12621 	int32		gd_adj_ns;	/**< gound delay */
12622 	int32		gd_h_adj_ns;	/**< group delay + threshold crossing */
12623 	int16		nfft;		/**< number of samples stored in H */
12624 	uint8		num_max_cores;
12625 
12626 } BWL_POST_PACKED_STRUCT wl_proxd_collect_info_t;
12627 #include <packed_section_end.h>
12628 
12629 #define K_TOF_COLLECT_H_PAD 1
12630 #define K_TOF_COLLECT_SC_20MHZ (64)
12631 /* Maximum possible size of sample capture */
12632 #define K_TOF_COLLECT_SC_80MHZ (2*K_TOF_COLLECT_SC_20MHZ)
12633 /* Maximum possible size of channel dump */
12634 #define K_TOF_COLLECT_CHAN_SIZE (2*K_TOF_COLLECT_SC_80MHZ)
12635 
12636 /*
12637 A few extra samples are required to estimate frequency offset
12638 Right now 16 samples are being used. Can be changed in future.
12639 */
12640 #define K_TOF_COLLECT_SAMP_SIZE_20MHZ (2*(K_TOF_COLLECT_SC_20MHZ)+16+K_TOF_COLLECT_H_PAD)
12641 #define K_TOF_COLLECT_RAW_SAMP_SIZE_20MHZ (2*K_TOF_COLLECT_SAMP_SIZE_20MHZ)
12642 #define K_TOF_COLLECT_H_SIZE_20MHZ (K_TOF_COLLECT_SAMP_SIZE_20MHZ)
12643 #define K_TOF_COLLECT_HRAW_SIZE_20MHZ (K_TOF_COLLECT_RAW_SAMP_SIZE_20MHZ)
12644 
12645 #define K_TOF_COLLECT_SAMP_SIZE_80MHZ (2*(K_TOF_COLLECT_SC_80MHZ)+16+K_TOF_COLLECT_H_PAD)
12646 #define K_TOF_COLLECT_RAW_SAMP_SIZE_80MHZ (2*K_TOF_COLLECT_SAMP_SIZE_80MHZ)
12647 #define K_TOF_COLLECT_H_SIZE_80MHZ (K_TOF_COLLECT_SAMP_SIZE_80MHZ)
12648 #define K_TOF_COLLECT_HRAW_SIZE_80MHZ (K_TOF_COLLECT_RAW_SAMP_SIZE_80MHZ)
12649 
12650 #define WL_PROXD_COLLECT_DATA_VERSION_1		1
12651 #include <packed_section_start.h>
12652 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_data_v1 {
12653 	wl_proxd_collect_info_t  info;
12654 	uint8	ri_rr[FTM_TPK_RI_RR_LEN];
12655 	/**< raw data read from phy used to adjust timestamps */
12656 	uint32	H[K_TOF_COLLECT_H_SIZE_20MHZ];
12657 } BWL_POST_PACKED_STRUCT wl_proxd_collect_data_t_v1;
12658 #include <packed_section_end.h>
12659 
12660 #define WL_PROXD_COLLECT_DATA_VERSION_2		2
12661 #include <packed_section_start.h>
12662 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_data_v2 {
12663 	wl_proxd_collect_info_t  info;
12664 	uint8   ri_rr[FTM_TPK_RI_RR_LEN_SECURE_2_0];
12665 	/**< raw data read from phy used to adjust timestamps */
12666 	uint32  H[K_TOF_COLLECT_H_SIZE_20MHZ];
12667 } BWL_POST_PACKED_STRUCT wl_proxd_collect_data_t_v2;
12668 #include <packed_section_end.h>
12669 
12670 #define WL_PROXD_COLLECT_DATA_VERSION_3         3
12671 typedef struct wl_proxd_collect_data_v3 {
12672 	uint16			version;
12673 	uint16			len;
12674 	wl_proxd_collect_info_t	info;
12675 	uint8			ri_rr[FTM_TPK_RI_RR_LEN_SECURE_2_0];
12676 	/**< raw data read from phy used to adjust timestamps */
12677 	uint32			H[K_TOF_COLLECT_H_SIZE_20MHZ];
12678 	uint32			chan[4 * K_TOF_COLLECT_CHAN_SIZE];
12679 } wl_proxd_collect_data_t_v3;
12680 #define WL_PROXD_COLLECT_DATA_VERSION_MAX	WL_PROXD_COLLECT_DATA_VERSION_3
12681 
12682 typedef struct wl_proxd_debug_data {
12683 	uint8		count;		/**< number of packets */
12684 	uint8		stage;		/**< state machone stage */
12685 	uint8		received;	/**< received or txed */
12686 	uint8		paket_type;	/**< packet type */
12687 	uint8		category;	/**< category field */
12688 	uint8		action;		/**< action field */
12689 	uint8		token;		/**< token number */
12690 	uint8		follow_token;	/**< following token number */
12691 	uint16		index;		/**< index of the packet */
12692 	uint16		tof_cmd;	/**< M_TOF_CMD */
12693 	uint16		tof_rsp;	/**< M_TOF_RSP */
12694 	uint16		tof_avb_rxl;	/**< M_TOF_AVB_RX_L */
12695 	uint16		tof_avb_rxh;	/**< M_TOF_AVB_RX_H */
12696 	uint16		tof_avb_txl;	/**< M_TOF_AVB_TX_L */
12697 	uint16		tof_avb_txh;	/**< M_TOF_AVB_TX_H */
12698 	uint16		tof_id;		/**< M_TOF_ID */
12699 	uint16		tof_status0;	/**< M_TOF_STATUS_0 */
12700 	uint16		tof_status2;	/**< M_TOF_STATUS_2 */
12701 	uint16		tof_chsm0;	/**< M_TOF_CHNSM_0 */
12702 	uint16		tof_phyctl0;	/**< M_TOF_PHYCTL0 */
12703 	uint16		tof_phyctl1;	/**< M_TOF_PHYCTL1 */
12704 	uint16		tof_phyctl2;	/**< M_TOF_PHYCTL2 */
12705 	uint16		tof_lsig;	/**< M_TOF_LSIG */
12706 	uint16		tof_vhta0;	/**< M_TOF_VHTA0 */
12707 	uint16		tof_vhta1;	/**< M_TOF_VHTA1 */
12708 	uint16		tof_vhta2;	/**< M_TOF_VHTA2 */
12709 	uint16		tof_vhtb0;	/**< M_TOF_VHTB0 */
12710 	uint16		tof_vhtb1;	/**< M_TOF_VHTB1 */
12711 	uint16		tof_apmductl;	/**< M_TOF_AMPDU_CTL */
12712 	uint16		tof_apmdudlim;	/**< M_TOF_AMPDU_DLIM */
12713 	uint16		tof_apmdulen;	/**< M_TOF_AMPDU_LEN */
12714 } wl_proxd_debug_data_t;
12715 
12716 /** version of the wl_wsec_info structure */
12717 #define WL_WSEC_INFO_VERSION 0x01
12718 
12719 /** start enum value for BSS properties */
12720 #define WL_WSEC_INFO_BSS_BASE 0x0100
12721 
12722 /** size of len and type fields of wl_wsec_info_tlv_t struct */
12723 #define WL_WSEC_INFO_TLV_HDR_LEN OFFSETOF(wl_wsec_info_tlv_t, data)
12724 
12725 /** Allowed wl_wsec_info properties; not all of them may be supported. */
12726 typedef enum {
12727 	WL_WSEC_INFO_NONE = 0,
12728 	WL_WSEC_INFO_MAX_KEYS = 1,
12729 	WL_WSEC_INFO_NUM_KEYS = 2,
12730 	WL_WSEC_INFO_NUM_HW_KEYS = 3,
12731 	WL_WSEC_INFO_MAX_KEY_IDX = 4,
12732 	WL_WSEC_INFO_NUM_REPLAY_CNTRS = 5,
12733 	WL_WSEC_INFO_SUPPORTED_ALGOS = 6,
12734 	WL_WSEC_INFO_MAX_KEY_LEN = 7,
12735 	WL_WSEC_INFO_FLAGS = 8,
12736 	/* add global/per-wlc properties above */
12737 	WL_WSEC_INFO_BSS_FLAGS = (WL_WSEC_INFO_BSS_BASE + 1),
12738 	WL_WSEC_INFO_BSS_WSEC = (WL_WSEC_INFO_BSS_BASE + 2),
12739 	WL_WSEC_INFO_BSS_TX_KEY_ID = (WL_WSEC_INFO_BSS_BASE + 3),
12740 	WL_WSEC_INFO_BSS_ALGO = (WL_WSEC_INFO_BSS_BASE + 4),
12741 	WL_WSEC_INFO_BSS_KEY_LEN = (WL_WSEC_INFO_BSS_BASE + 5),
12742 	WL_WSEC_INFO_BSS_ALGOS = (WL_WSEC_INFO_BSS_BASE + 6),
12743 	/* add per-BSS properties above */
12744 	WL_WSEC_INFO_MAX = 0xffff
12745 } wl_wsec_info_type_t;
12746 
12747 typedef struct {
12748 	uint32 algos; /* set algos to be enabled/disabled */
12749 	uint32 mask; /* algos outside mask unaltered */
12750 } wl_wsec_info_algos_t;
12751 
12752 /** tlv used to return wl_wsec_info properties */
12753 typedef struct {
12754 	uint16 type;
12755 	uint16 len;		/**< data length */
12756 	uint8 data[1];	/**< data follows */
12757 } wl_wsec_info_tlv_t;
12758 
12759 /** input/output data type for wsec_info iovar */
12760 typedef struct wl_wsec_info {
12761 	uint8 version; /**< structure version */
12762 	uint8 pad[2];
12763 	uint8 num_tlvs;
12764 	wl_wsec_info_tlv_t tlvs[1]; /**< tlv data follows */
12765 } wl_wsec_info_t;
12766 
12767 /*
12768  * randmac definitions
12769  */
12770 #define WL_RANDMAC_MODULE			"randmac"
12771 #define WL_RANDMAC_API_VERSION		0x0100 /**< version 1.0 */
12772 #define WL_RANDMAC_API_MIN_VERSION	0x0100 /**< version 1.0 */
12773 
12774 /** subcommands that can apply to randmac */
12775 enum {
12776 	WL_RANDMAC_SUBCMD_NONE				= 0,
12777 	WL_RANDMAC_SUBCMD_GET_VERSION			= 1,
12778 	WL_RANDMAC_SUBCMD_ENABLE			= 2,
12779 	WL_RANDMAC_SUBCMD_DISABLE			= 3,
12780 	WL_RANDMAC_SUBCMD_CONFIG			= 4,
12781 	WL_RANDMAC_SUBCMD_STATS				= 5,
12782 	WL_RANDMAC_SUBCMD_CLEAR_STATS			= 6,
12783 
12784 	WL_RANDMAC_SUBCMD_MAX
12785 };
12786 typedef int16 wl_randmac_subcmd_t;
12787 
12788 /* Common IOVAR struct */
12789 typedef struct wl_randmac {
12790 	uint16 version;
12791 	uint16 len;			/* total length */
12792 	wl_randmac_subcmd_t subcmd_id;	/* subcommand id */
12793 	uint8 data[0];			/* subcommand data */
12794 } wl_randmac_t;
12795 
12796 #define WL_RANDMAC_IOV_HDR_SIZE OFFSETOF(wl_randmac_t, data)
12797 
12798 /* randmac version subcommand */
12799 typedef struct wl_randmac_version {
12800 	uint16 version;  /* Randmac method version info */
12801 	uint8 pad[2];    /* Align on 4 byte boundary */
12802 } wl_randmac_version_t;
12803 
12804 /*
12805  * Bitmask for methods supporting MAC randomization feature
12806  */
12807 #define WL_RANDMAC_USER_NONE		0x0000
12808 #define WL_RANDMAC_USER_FTM		0x0001
12809 #define WL_RANDMAC_USER_NAN		0x0002
12810 #define WL_RANDMAC_USER_SCAN		0x0004
12811 #define WL_RANDMAC_USER_ANQP		0x0008
12812 #define WL_RANDMAC_USER_ALL		0xFFFF
12813 typedef uint16 wl_randmac_method_t;
12814 
12815 enum {
12816 	WL_RANDMAC_FLAGS_NONE	= 0x00,
12817 	WL_RANDMAC_FLAGS_ADDR	= 0x01,
12818 	WL_RANDMAC_FLAGS_MASK	= 0x02,
12819 	WL_RANDMAC_FLAGS_METHOD	= 0x04,
12820 	WL_RANDMAC_FLAGS_ALL	= 0xFF
12821 };
12822 typedef uint8 wl_randmac_flags_t;
12823 
12824 /* randmac statistics subcommand */
12825 typedef struct wl_randmac_stats {
12826 	uint32 set_ok;		/* Set random addr success count */
12827 	uint32 set_fail;	/* Set random addr failed count */
12828 	uint32 set_reqs;	/* Set random addr count */
12829 	uint32 reset_reqs;	/* Restore random addr count */
12830 	uint32 restore_ok;	/* Restore random addr succes count */
12831 	uint32 restore_fail;	/* Restore random addr failed count */
12832 	uint32 events_sent;	/* randmac module events count */
12833 	uint32 events_rcvd;	/* randmac events received count */
12834 } wl_randmac_stats_t;
12835 
12836 /* randmac config subcommand */
12837 typedef struct wl_randmac_config {
12838 	struct ether_addr addr;			/* Randomized MAC address */
12839 	struct ether_addr addr_mask;		/* bitmask for randomization */
12840 	wl_randmac_method_t method;		/* Enabled methods */
12841 	wl_randmac_flags_t flags;		/* What config info changed */
12842 	uint8	PAD;
12843 } wl_randmac_config_t;
12844 
12845 enum {
12846 	WL_RANDMAC_EVENT_NONE			= 0,	/**< not an event, reserved */
12847 	WL_RANDMAC_EVENT_BSSCFG_ADDR_SET	= 1,	/* bsscfg addr randomized */
12848 	WL_RANDMAC_EVENT_BSSCFG_ADDR_RESTORE	= 2,	/* bsscfg addr restored */
12849 	WL_RANDMAC_EVENT_ENABLED		= 3,	/* randmac module enabled */
12850 	WL_RANDMAC_EVENT_DISABLE		= 4,	/* randmac module disabled */
12851 	WL_RANDMAC_EVENT_BSSCFG_STATUS	= 5,	/* bsscfg enable/disable */
12852 
12853 	WL_RANDMAC_EVENT_MAX
12854 };
12855 typedef int16 wl_randmac_event_type_t;
12856 typedef int32 wl_randmac_status_t;
12857 typedef uint32 wl_randmac_event_mask_t;
12858 
12859 #define WL_RANDMAC_EVENT_MASK_ALL 0xfffffffe
12860 #define WL_RANDMAC_EVENT_MASK_EVENT(_event_type) (1 << (_event_type))
12861 #define WL_RANDMAC_EVENT_ENABLED(_mask, _event_type) (\
12862 	((_mask) & WL_RANDMAC_EVENT_MASK_EVENT(_event_type)) != 0)
12863 
12864 /** tlv IDs - data length 4 bytes unless overridden by type, alignment 32 bits */
12865 enum {
12866 	WL_RANDMAC_TLV_NONE		= 0,
12867 	WL_RANDMAC_TLV_METHOD		= 1,
12868 	WL_RANDMAC_TLV_ADDR		= 2,
12869 	WL_RANDMAC_TLV_MASK		= 3
12870 };
12871 typedef uint16 wl_randmac_tlv_id_t;
12872 
12873 typedef struct wl_randmac_tlv {
12874 	wl_randmac_tlv_id_t id;
12875 	uint16 len;		/* Length of variable */
12876 	uint8  data[1];
12877 } wl_randmac_tlv_t;
12878 
12879 /** randmac event */
12880 typedef struct wl_randmac_event {
12881 	uint16					version;
12882 	uint16					len;	/* Length of all variables */
12883 	wl_randmac_event_type_t			type;
12884 	wl_randmac_method_t			method;
12885 	uint8					pad[2];
12886 	wl_randmac_tlv_t			tlvs[1];	/**< variable */
12887 } wl_randmac_event_t;
12888 
12889 /*
12890  * scan MAC definitions
12891  */
12892 
12893 /** common iovar struct */
12894 typedef struct wl_scanmac {
12895 	uint16 subcmd_id;	/**< subcommand id */
12896 	uint16 len;		/**< total length of data[] */
12897 	uint8 data[];		/**< subcommand data */
12898 } wl_scanmac_t;
12899 
12900 /* subcommand ids */
12901 #define WL_SCANMAC_SUBCMD_ENABLE   0
12902 #define WL_SCANMAC_SUBCMD_BSSCFG   1   /**< only GET supported */
12903 #define WL_SCANMAC_SUBCMD_CONFIG   2
12904 
12905 /** scanmac enable data struct */
12906 typedef struct wl_scanmac_enable {
12907 	uint8 enable;	/**< 1 - enable, 0 - disable */
12908 	uint8 pad[3];	/**< 4-byte struct alignment */
12909 } wl_scanmac_enable_t;
12910 
12911 /** scanmac bsscfg data struct */
12912 typedef struct wl_scanmac_bsscfg {
12913 	uint32 bsscfg;	/**< bsscfg index */
12914 } wl_scanmac_bsscfg_t;
12915 
12916 /** scanmac config data struct */
12917 typedef struct wl_scanmac_config {
12918 	struct ether_addr mac;	/**< 6 bytes of MAC address or MAC prefix (i.e. OUI) */
12919 	struct ether_addr random_mask;	/**< randomized bits on each scan */
12920 	uint16 scan_bitmap;	/**< scans to use this MAC address */
12921 	uint8 pad[2];	/**< 4-byte struct alignment */
12922 } wl_scanmac_config_t;
12923 
12924 /* scan bitmap */
12925 #define WL_SCANMAC_SCAN_UNASSOC		(0x01 << 0)	/**< unassociated scans */
12926 #define WL_SCANMAC_SCAN_ASSOC_ROAM	(0x01 << 1)	/**< associated roam scans */
12927 #define WL_SCANMAC_SCAN_ASSOC_PNO	(0x01 << 2)	/**< associated PNO scans */
12928 #define WL_SCANMAC_SCAN_ASSOC_HOST	(0x01 << 3)	/**< associated host scans */
12929 
12930 #define WL_SCAN_EVENT_VERSION         1
12931 
12932 #define WL_SCAN_TYPE_ASSOC      0x1   /* Assoc scan     */
12933 #define WL_SCAN_TYPE_ROAM       0x2   /* Roam scan     */
12934 #define WL_SCAN_TYPE_FWSCAN     0x4   /* Other FW scan     */
12935 #define WL_SCAN_TYPE_HOSTSCAN   0x8   /* Host scan     */
12936 
12937 typedef struct scan_event_data {
12938 	uint32 version;
12939 	uint32 flags;
12940 	uint16 num_chan_slice0;
12941 	uint16 num_chan_slice1;
12942 	/* Will contain num_chan_slice0 followed by num_chan_slice1 chanspecs */
12943 	chanspec_t scan_chan_list[];
12944 } scan_event_data_t;
12945 
12946 /*
12947  * bonjour dongle offload definitions
12948  */
12949 
12950 /* common iovar struct */
12951 typedef struct wl_bdo {
12952 	uint16 subcmd_id;	/* subcommand id */
12953 	uint16 len;		/* total length of data[] */
12954 	uint8 data[];		/* subcommand data */
12955 } wl_bdo_t;
12956 
12957 /* subcommand ids */
12958 #define WL_BDO_SUBCMD_DOWNLOAD		0	/* Download flattened database  */
12959 #define WL_BDO_SUBCMD_ENABLE		1	/* Start bonjour after download */
12960 #define WL_BDO_SUBCMD_MAX_DOWNLOAD	2	/* Get the max download size    */
12961 
12962 /* maximum fragment size */
12963 #define BDO_MAX_FRAGMENT_SIZE	1024
12964 
12965 /* download flattened database
12966  *
12967  * BDO must be disabled before database download else fail.
12968  *
12969  * If database size is within BDO_MAX_FRAGMENT_SIZE then only a single fragment
12970  * is required (i.e. frag_num = 0, total_size = frag_size).
12971  * If database size exceeds BDO_MAX_FRAGMENT_SIZE then multiple fragments are required.
12972  */
12973 typedef struct wl_bdo_download {
12974 	uint16 total_size;	/* total database size */
12975 	uint16 frag_num;	/* fragment number, 0 for first fragment, N-1 for last fragment */
12976 	uint16 frag_size;	/* size of fragment (max BDO_MAX_FRAGMENT_SIZE) */
12977 	uint8 pad[2];		/* 4-byte struct alignment */
12978 	uint8 fragment[BDO_MAX_FRAGMENT_SIZE];  /* fragment data */
12979 } wl_bdo_download_t;
12980 
12981 /* enable
12982  *
12983  * Enable requires a downloaded database else fail.
12984  */
12985 typedef struct wl_bdo_enable {
12986 	uint8 enable;	/* 1 - enable, 0 - disable */
12987 	uint8 pad[3];	/* 4-byte struct alignment */
12988 } wl_bdo_enable_t;
12989 
12990 /*
12991  * Get the max download size for Bonjour Offload.
12992  */
12993 typedef struct wl_bdo_max_download {
12994 	uint16 size;	/* Max download size in bytes */
12995 	uint8 pad[2];	/* 4-byte struct alignment    */
12996 } wl_bdo_max_download_t;
12997 
12998 /*
12999  * TCP keepalive offload definitions
13000  */
13001 
13002 /* common iovar struct */
13003 typedef struct wl_tko {
13004 	uint16 subcmd_id;	/* subcommand id */
13005 	uint16 len;		/* total length of data[] */
13006 	uint8 data[];		/* subcommand data */
13007 } wl_tko_t;
13008 
13009 /* subcommand ids */
13010 #define WL_TKO_SUBCMD_MAX_TCP		0	/* max TCP connections supported */
13011 #define WL_TKO_SUBCMD_PARAM		1	/* configure offload common parameters  */
13012 #define WL_TKO_SUBCMD_CONNECT		2	/* TCP connection info */
13013 #define WL_TKO_SUBCMD_ENABLE		3	/* enable/disable */
13014 #define WL_TKO_SUBCMD_STATUS		4	/* TCP connection status */
13015 #define WL_TKO_SUBCMD_RST		5	/* TCP wake RST frame release request */
13016 
13017 /** Delay to retain a TCP RST frame on a monitored TCP session
13018  * before toggling the wake GPIO (in sec).
13019  */
13020 typedef enum tko_rst_wake_delay {
13021 	/** No delay, no RST frame retention */
13022 	TKO_RST_WAKE_DELAY_DISABLED	= -2,
13023 	/** Infinite delay. No timeout */
13024 	TKO_RST_WAKE_DELAY_INFINITY	= -1,
13025 	/* 0 - 3600 sec are valid */
13026 	TKO_RST_WAKE_DELAY_MAX		= 3600
13027 } tko_rst_wake_delay_t;
13028 
13029 /* WL_TKO_SUBCMD_MAX_CONNECT subcommand data */
13030 typedef struct wl_tko_max_tcp {
13031 	uint8 max;	/* max TCP connections supported */
13032 	uint8 pad[3];	/* 4-byte struct alignment */
13033 } wl_tko_max_tcp_t;
13034 
13035 /* WL_TKO_SUBCMD_PARAM subcommand data */
13036 typedef struct wl_tko_param {
13037 	uint16 interval;	/* keepalive tx interval (secs) */
13038 	uint16 retry_interval;	/* keepalive retry interval (secs) */
13039 	uint16 retry_count;	/* retry_count */
13040 	int16 rst_delay;	/* delay to delay a RST frame from reaching the host */
13041 } wl_tko_param_t;
13042 
13043 /* WL_TKO_SUBCMD_CONNECT subcommand data
13044  * invoke with unique 'index' for each TCP connection
13045  */
13046 typedef struct wl_tko_connect {
13047 	uint8 index;		/* TCP connection index, 0 to max-1 */
13048 	uint8 ip_addr_type;	/* 0 - IPv4, 1 - IPv6 */
13049 	uint16 local_port;	/* local port */
13050 	uint16 remote_port;	/* remote port */
13051 	uint16 PAD;
13052 	uint32 local_seq;	/* local sequence number */
13053 	uint32 remote_seq;	/* remote sequence number */
13054 	uint16 request_len;	/* TCP keepalive request packet length */
13055 	uint16 response_len;	/* TCP keepalive response packet length */
13056 	uint8 data[];		/* variable length field containing local/remote IPv4/IPv6,
13057 				 * TCP keepalive request packet, TCP keepalive response packet
13058 				 *    For IPv4, length is 4 * 2 + request_length + response_length
13059 				 *       offset 0 - local IPv4
13060 				 *       offset 4 - remote IPv4
13061 				 *       offset 8 - TCP keepalive request packet
13062 				 *       offset 8+request_length - TCP keepalive response packet
13063 				 *    For IPv6, length is 16 * 2 + request_length + response_length
13064 				 *       offset 0 - local IPv6
13065 				 *       offset 16 - remote IPv6
13066 				 *       offset 32 - TCP keepalive request packet
13067 				 *       offset 32+request_length - TCP keepalive response packet
13068 				 */
13069 } wl_tko_connect_t;
13070 
13071 /* WL_TKO_SUBCMD_CONNECT subcommand data to GET configured info for specific index */
13072 typedef struct wl_tko_get_connect {
13073 	uint8 index;		/* TCP connection index, 0 to max-1 */
13074 	uint8 pad[3];		/* 4-byte struct alignment */
13075 } wl_tko_get_connect_t;
13076 
13077 typedef struct wl_tko_enable {
13078 	uint8 enable;	/* 1 - enable, 0 - disable */
13079 	uint8 pad[3];	/* 4-byte struct alignment */
13080 } wl_tko_enable_t;
13081 
13082 /* WL_TKO_SUBCMD_STATUS subcommand data */
13083 /* must be invoked before tko is disabled else status is unavailable */
13084 typedef struct wl_tko_status {
13085 	uint8 count;		/* number of status entries (i.e. equals
13086 				 * max TCP connections supported)
13087 	                         */
13088 	uint8 status[1];	/* variable length field contain status for
13089 				 * each TCP connection index
13090 				 */
13091 } wl_tko_status_t;
13092 
13093 /* TKO_STATUS_TCP_RST subcommand data */
13094 typedef struct wl_tko_get_reset {
13095 	uint8 index;	/**< TCP connection index, 0 to max-1 */
13096 	uint8 clear_only; /**< 1 to clear the RST frame without sending it up to the host */
13097 	uint8 pad[2];	/**< 4-bytes structure alignment */
13098 } wl_tko_get_reset_t;
13099 
13100 typedef enum {
13101 	TKO_STATUS_NORMAL			= 0,	/* TCP connection normal, no error */
13102 	TKO_STATUS_NO_RESPONSE			= 1,	/* no response to TCP keepalive */
13103 	TKO_STATUS_NO_TCP_ACK_FLAG		= 2,	/* TCP ACK flag not set */
13104 	TKO_STATUS_UNEXPECT_TCP_FLAG		= 3,	/* unexpect TCP flags set other than ACK */
13105 	TKO_STATUS_SEQ_NUM_INVALID		= 4,	/* ACK != sequence number */
13106 	TKO_STATUS_REMOTE_SEQ_NUM_INVALID	= 5,	/* SEQ > remote sequence number */
13107 	TKO_STATUS_TCP_DATA			= 6,	/* TCP data available */
13108 	TKO_STATUS_TCP_RST			= 7,	/* TCP RST flag received */
13109 	TKO_STATUS_UNAVAILABLE			= 255,	/* not used/configured */
13110 } tko_status_t;
13111 
13112 /*
13113  * DHCP lease time renew offload definitions
13114  */
13115 
13116 /* Common iovar struct */
13117 typedef struct wl_dltro {
13118 	uint8 subcmd_id;    /* Subcommand id */
13119 	uint8 pad;
13120 	uint16 len;         /* Total length of data[] */
13121 	uint8 data[1];      /* Subcommand data */
13122 } wl_dltro_t;
13123 
13124 /* Subcommand ids */
13125 #define WL_DLTRO_SUBCMD_CONNECT     0   /* DLTRO connection info */
13126 #define WL_DLTRO_SUBCMD_PARAM       1   /* DLTRO parameter info */
13127 #define WL_DLTRO_SUBCMD_MAX_DLTRO   2   /* Max DLTRO supported */
13128 
13129 /* WL_DLTRO_SUBCMD_CONNECT subcommand data
13130  * Invoke with unique 'index' for each DLTRO connection
13131  */
13132 typedef struct wl_dltro_connect {
13133 	uint8 index;                  /* DLTRO connection index, 0 to max-1 */
13134 	uint8 ip_addr_type;           /* 0 - IPv4, 1 - IPv6 */
13135 	uint8 offload_type;           /* 0 - Client, 1 - Server */
13136 	uint8 pad;
13137 	uint32 tid;                   /* Transaction id */
13138 	uint32 timer_val;             /* DHCP lease time remaining in seconds */
13139 	uint32 time_before_expiry;    /* Time before expiry for DHCP lease renewal in seconds */
13140 	uint32 len;                   /* Length of the variable data */
13141 	uint8 data[1];                /* Variable length field containing DLTRO packet */
13142 } wl_dltro_connect_t;
13143 
13144 /* WL_DLTRO_SUBCMD_PARAM subcommand data
13145  * Invoke with unique 'index' for each DLTRO connection
13146  */
13147 typedef struct wl_dltro_param {
13148 	uint8 index;        /* DLTRO connection index, 0 to max-1 */
13149 	uint8 retry;        /* Number of retries */
13150 } wl_dltro_param_t;
13151 
13152 /* WL_DLTRO_SUBCMD_MAX_DLTRO subcommand data */
13153 typedef struct wl_dltro_max_dltro {
13154 	uint8 max;  /* Max DLTRO supported */
13155 } wl_dltro_max_dltro_t;
13156 
13157 /* WL_DLTRO_SUBCMD_PARAM subcommand data to GET configured info for specific index */
13158 typedef struct wl_dltro_get_param {
13159 	uint8 index;        /* DLTRO connection index, 0 to max-1 */
13160 } wl_dltro_get_param_t;
13161 
13162 enum rssi_reason {
13163 	RSSI_REASON_UNKNOW = 0,
13164 	RSSI_REASON_LOWRSSI = 1,
13165 	RSSI_REASON_NSYC = 2,
13166 	RSSI_REASON_TIMEOUT = 3
13167 };
13168 
13169 enum tof_reason {
13170 	TOF_REASON_OK = 0,
13171 	TOF_REASON_REQEND = 1,
13172 	TOF_REASON_TIMEOUT = 2,
13173 	TOF_REASON_NOACK = 3,
13174 	TOF_REASON_INVALIDAVB = 4,
13175 	TOF_REASON_INITIAL = 5,
13176 	TOF_REASON_ABORT = 6
13177 };
13178 
13179 enum rssi_state {
13180 	RSSI_STATE_POLL = 0,
13181 	RSSI_STATE_TPAIRING = 1,
13182 	RSSI_STATE_IPAIRING = 2,
13183 	RSSI_STATE_THANDSHAKE = 3,
13184 	RSSI_STATE_IHANDSHAKE = 4,
13185 	RSSI_STATE_CONFIRMED = 5,
13186 	RSSI_STATE_PIPELINE = 6,
13187 	RSSI_STATE_NEGMODE = 7,
13188 	RSSI_STATE_MONITOR = 8,
13189 	RSSI_STATE_LAST = 9
13190 };
13191 
13192 enum tof_state {
13193 	TOF_STATE_IDLE	 = 0,
13194 	TOF_STATE_IWAITM = 1,
13195 	TOF_STATE_TWAITM = 2,
13196 	TOF_STATE_ILEGACY = 3,
13197 	TOF_STATE_IWAITCL = 4,
13198 	TOF_STATE_TWAITCL = 5,
13199 	TOF_STATE_ICONFIRM = 6,
13200 	TOF_STATE_IREPORT = 7
13201 };
13202 
13203 enum tof_mode_type {
13204 	TOF_LEGACY_UNKNOWN	= 0,
13205 	TOF_LEGACY_AP		= 1,
13206 	TOF_NONLEGACY_AP	= 2
13207 };
13208 
13209 enum tof_way_type {
13210 	TOF_TYPE_ONE_WAY = 0,
13211 	TOF_TYPE_TWO_WAY = 1,
13212 	TOF_TYPE_REPORT = 2
13213 };
13214 
13215 enum tof_rate_type {
13216 	TOF_FRAME_RATE_VHT = 0,
13217 	TOF_FRAME_RATE_LEGACY = 1
13218 };
13219 
13220 #define TOF_ADJ_TYPE_NUM	4	/**< number of assisted timestamp adjustment */
13221 enum tof_adj_mode {
13222 	TOF_ADJ_SOFTWARE = 0,
13223 	TOF_ADJ_HARDWARE = 1,
13224 	TOF_ADJ_SEQ = 2,
13225 	TOF_ADJ_NONE = 3
13226 };
13227 
13228 #define FRAME_TYPE_NUM		4	/**< number of frame type */
13229 enum frame_type {
13230 	FRAME_TYPE_CCK	= 0,
13231 	FRAME_TYPE_OFDM	= 1,
13232 	FRAME_TYPE_11N	= 2,
13233 	FRAME_TYPE_11AC	= 3
13234 };
13235 
13236 typedef struct wl_proxd_status_iovar {
13237 	uint16			method;				/**< method */
13238 	uint8			mode;				/**< mode */
13239 	uint8			peermode;			/**< peer mode */
13240 	uint8			state;				/**< state */
13241 	uint8			reason;				/**< reason code */
13242 	uint8			PAD[2];
13243 	uint32			distance;			/**< distance */
13244 	uint32			txcnt;				/**< tx pkt counter */
13245 	uint32			rxcnt;				/**< rx pkt counter */
13246 	struct ether_addr	peer;				/**< peer mac address */
13247 	int8			avg_rssi;			/**< average rssi */
13248 	int8			hi_rssi;			/**< highest rssi */
13249 	int8			low_rssi;			/**< lowest rssi */
13250 	uint8			PAD[3];
13251 	uint32			dbgstatus;			/**< debug status */
13252 	uint16			frame_type_cnt[FRAME_TYPE_NUM];	/**< frame types */
13253 	uint8			adj_type_cnt[TOF_ADJ_TYPE_NUM];	/**< adj types HW/SW */
13254 } wl_proxd_status_iovar_t;
13255 
13256 /* ifdef NET_DETECT */
13257 typedef struct net_detect_adapter_features {
13258 	uint8	wowl_enabled;
13259 	uint8	net_detect_enabled;
13260 	uint8	nlo_enabled;
13261 } net_detect_adapter_features_t;
13262 
13263 typedef enum net_detect_bss_type {
13264 	nd_bss_any = 0,
13265 	nd_ibss,
13266 	nd_ess
13267 } net_detect_bss_type_t;
13268 
13269 typedef struct net_detect_profile {
13270 	wlc_ssid_t		ssid;
13271 	net_detect_bss_type_t   bss_type;	/**< Ignore for now since Phase 1 is only for ESS */
13272 	uint32			cipher_type;	/**< DOT11_CIPHER_ALGORITHM enumeration values */
13273 	uint32			auth_type;	/**< DOT11_AUTH_ALGORITHM enumeration values */
13274 } net_detect_profile_t;
13275 
13276 typedef struct net_detect_profile_list {
13277 	uint32			num_nd_profiles;
13278 	net_detect_profile_t	nd_profile[];
13279 } net_detect_profile_list_t;
13280 
13281 typedef struct net_detect_config {
13282 	uint8			    nd_enabled;
13283 	uint8				PAD[3];
13284 	uint32			    scan_interval;
13285 	uint32			    wait_period;
13286 	uint8			    wake_if_connected;
13287 	uint8			    wake_if_disconnected;
13288 	uint8				PAD[2];
13289 	net_detect_profile_list_t   nd_profile_list;
13290 } net_detect_config_t;
13291 
13292 typedef enum net_detect_wake_reason {
13293 	nd_reason_unknown,
13294 	nd_net_detected,
13295 	nd_wowl_event,
13296 	nd_ucode_error
13297 } net_detect_wake_reason_t;
13298 
13299 typedef struct net_detect_wake_data {
13300 	net_detect_wake_reason_t    nd_wake_reason;
13301 	uint32			    nd_wake_date_length;
13302 	uint8			    nd_wake_data[0];	    /**< Wake data (currently unused) */
13303 } net_detect_wake_data_t;
13304 
13305 /* endif NET_DETECT */
13306 
13307 /* (unversioned, deprecated) */
13308 typedef struct bcnreq {
13309 	uint8 bcn_mode;
13310 	uint8 PAD[3];
13311 	int32 dur;
13312 	int32 channel;
13313 	struct ether_addr da;
13314 	uint16 random_int;
13315 	wlc_ssid_t ssid;
13316 	uint16 reps;
13317 	uint8 PAD[2];
13318 } bcnreq_t;
13319 
13320 #define WL_RRM_BCN_REQ_VER		1
13321 typedef struct bcn_req {
13322 	uint8 version;
13323 	uint8 bcn_mode;
13324 	uint8 pad_1[2];
13325 	int32 dur;
13326 	int32 channel;
13327 	struct ether_addr da;
13328 	uint16 random_int;
13329 	wlc_ssid_t ssid;
13330 	uint16 reps;
13331 	uint8 req_elements;
13332 	uint8 pad_2;
13333 	chanspec_list_t chspec_list;
13334 } bcn_req_t;
13335 
13336 #define WL_RRM_BCN_REQ_VER_2		2
13337 typedef struct bcn_req_v2 {
13338 	uint8 version;
13339 	uint8 bcn_mode;
13340 	uint8 pad_1[2];
13341 	int32 dur;
13342 	int32 channel;
13343 	struct ether_addr da;
13344 	uint16 random_int;
13345 	wlc_ssid_t ssid;
13346 	uint16 reps;
13347 	uint8 req_elements;
13348 	uint8 pad_2;
13349 	struct ether_addr bssid;
13350 	uint8 pad_3[2];
13351 	chanspec_list_t chspec_list;
13352 } bcn_req_v2_t;
13353 
13354 #define WL_RRM_BCN_REQ_MIN_PARAMS		8
13355 #define WL_RRM_BCN_REQ_PARAM_INC_SSID	8
13356 #define WL_RRM_BCN_REQ_PARAM_INC_CHANS	9
13357 enum {
13358 	WL_RRM_BCN_MODE_PASSIVE = 0,	/* passive mode */
13359 	WL_RRM_BCN_MODE_ACTIVE = 1,	/* active mode */
13360 	WL_RRM_BCN_MODE_TABLE = 2,	/* beacon table */
13361 	WL_RRM_BCN_MODE_MAX_VALUE = 2
13362 };
13363 
13364 typedef struct rrmreq {
13365 	struct ether_addr da;
13366 	uint8 reg;
13367 	uint8 chan;
13368 	uint16 random_int;
13369 	uint16 dur;
13370 	uint16 reps;
13371 } rrmreq_t;
13372 
13373 typedef struct framereq {
13374 	struct ether_addr da;
13375 	uint8 reg;
13376 	uint8 chan;
13377 	uint16 random_int;
13378 	uint16 dur;
13379 	struct ether_addr ta;
13380 	uint16 reps;
13381 } framereq_t;
13382 
13383 typedef struct statreq {
13384 	struct ether_addr da;
13385 	struct ether_addr peer;
13386 	uint16 random_int;
13387 	uint16 dur;
13388 	uint8 group_id;
13389 	uint8 PAD;
13390 	uint16 reps;
13391 } statreq_t;
13392 
13393 typedef struct txstrmreq {
13394 	struct ether_addr da;	/* Destination address */
13395 	uint16 random_int;	/* Random interval for measurement start */
13396 	uint16 dur;		/* Measurement duration */
13397 	uint16 reps;		/* number of repetitions */
13398 	struct ether_addr peer;	/* Peer MAC address */
13399 	uint8 tid;		/* Traffic ID */
13400 	uint8 bin0_range;	/* Delay range of the first bin */
13401 } txstrmreq_t;
13402 
13403 typedef struct lcireq {
13404 	struct ether_addr da;	/* Destination address */
13405 	uint16 reps;		/* number of repetitions */
13406 	uint8 subj;		/* Local/Remote/Thid party */
13407 	uint8 lat_res;		/* Latitude requested Resolution */
13408 	uint8 lon_res;		/* Longitude requested Resolution */
13409 	uint8 alt_res;		/* Altitude requested Resolution */
13410 } lcireq_t;
13411 
13412 typedef struct civicreq {
13413 	struct ether_addr da;	/* Destination address */
13414 	uint16 reps;		/* number of repetitions */
13415 	uint8 subj;		/* Local/Remote/Thid party */
13416 	uint8 civloc_type;	/* Format of location info */
13417 	uint8 siu;		/* Unit of Location service interval */
13418 	uint8 pad;
13419 	uint16 si;		/* Location service interval */
13420 } civicreq_t;
13421 
13422 typedef struct locidreq {
13423 	struct ether_addr da;	/* Destination address */
13424 	uint16 reps;		/* number of repetitions */
13425 	uint8 subj;		/* Local/Remote/Thid party */
13426 	uint8 siu;		/* Unit of Location service interval */
13427 	uint16 si;		/* Location service interval */
13428 } locidreq_t;
13429 
13430 typedef struct wl_rrm_config_ioc {
13431 	uint16 version; /* command version */
13432 	uint16 id;      /* subiovar cmd ID */
13433 	uint16 len;     /* total length of all bytes in data[] */
13434 	uint16 pad;     /* 4-byte boundary padding */
13435 	uint8 data[1];  /* payload */
13436 } wl_rrm_config_ioc_t;
13437 
13438 enum {
13439 	WL_RRM_CONFIG_NONE	= 0,	/* reserved */
13440 	WL_RRM_CONFIG_GET_LCI	= 1,	/* get LCI */
13441 	WL_RRM_CONFIG_SET_LCI	= 2,	/* set LCI */
13442 	WL_RRM_CONFIG_GET_CIVIC	= 3,	/* get civic location */
13443 	WL_RRM_CONFIG_SET_CIVIC	= 4,	/* set civic location */
13444 	WL_RRM_CONFIG_GET_LOCID	= 5,	/* get location identifier */
13445 	WL_RRM_CONFIG_SET_LOCID	= 6,	/* set location identifier */
13446 	WL_RRM_CONFIG_MAX	= 7
13447 };
13448 
13449 #define WL_RRM_CONFIG_NAME "rrm_config"
13450 #define WL_RRM_CONFIG_MIN_LENGTH OFFSETOF(wl_rrm_config_ioc_t, data)
13451 
13452 enum {
13453 	WL_RRM_EVENT_NONE		= 0,	/* not an event, reserved */
13454 	WL_RRM_EVENT_FRNG_REQ	= 1,	/* Receipt of FRNG request frame */
13455 	WL_RRM_EVENT_FRNG_REP	= 2,	/* Receipt of FRNG report frame */
13456 
13457 	WL_RRM_EVENT_MAX
13458 };
13459 typedef int16 wl_rrm_event_type_t;
13460 
13461 typedef struct frngreq_target {
13462 	uint32 bssid_info;
13463 	uint8 channel;
13464 	uint8 phytype;
13465 	uint8 reg;
13466 	uint8 pad;
13467 	struct ether_addr bssid;
13468 	chanspec_t chanspec;
13469 	uint32 sid;
13470 } frngreq_target_t;
13471 
13472 typedef struct frngreq {
13473 	wl_rrm_event_type_t event;			/* RRM event type */
13474 	struct ether_addr da;
13475 	uint16 max_init_delay;	/* Upper bound of random delay, in TUs */
13476 	uint8 min_ap_count;		/* Min FTM ranges requested (1-15) */
13477 	uint8 num_aps;			/* Number of APs to range, at least min_ap_count */
13478 	uint16 max_age;			/* Max elapsed time before FTM request, 0xFFFF = any */
13479 	uint16 reps;			/* Number of repetitions of this measurement type */
13480 	frngreq_target_t targets[1];	/* Target BSSIDs to range */
13481 } frngreq_t;
13482 
13483 typedef struct frngrep_range {
13484 	uint32 start_tsf;		/* 4 lsb of tsf */
13485 	struct ether_addr bssid;
13486 	uint8 pad[2];
13487 	uint32 range;
13488 	uint32 max_err;
13489 	uint8  rsvd;
13490 	uint8 pad2[3];
13491 } frngrep_range_t;
13492 
13493 typedef struct frngrep_error {
13494 	uint32 start_tsf;		/* 4 lsb of tsf */
13495 	struct ether_addr bssid;
13496 	uint8  code;
13497 	uint8 pad[1];
13498 } frngrep_error_t;
13499 
13500 typedef struct frngrep {
13501 	wl_rrm_event_type_t event;			/* RRM event type */
13502 	struct ether_addr da;
13503 	uint8 range_entry_count;
13504 	uint8 error_entry_count;
13505 	uint16 dialog_token;				/* dialog token */
13506 	frngrep_range_t range_entries[DOT11_FTM_RANGE_ENTRY_MAX_COUNT];
13507 	frngrep_error_t error_entries[DOT11_FTM_RANGE_ERROR_ENTRY_MAX_COUNT];
13508 } frngrep_t;
13509 
13510 typedef struct wl_rrm_frng_ioc {
13511 	uint16 version; /* command version */
13512 	uint16 id;      /* subiovar cmd ID */
13513 	uint16 len;     /* total length of all bytes in data[] */
13514 	uint16 pad;     /* 4-byte boundary padding */
13515 	uint8 data[];  /* payload */
13516 } wl_rrm_frng_ioc_t;
13517 
13518 enum {
13519 	WL_RRM_FRNG_NONE	= 0,	/* reserved */
13520 	WL_RRM_FRNG_SET_REQ	= 1,	/* send ftm ranging request */
13521 	WL_RRM_FRNG_MAX		= 2
13522 };
13523 
13524 #define WL_RRM_FRNG_NAME "rrm_frng"
13525 #define WL_RRM_FRNG_MIN_LENGTH OFFSETOF(wl_rrm_frng_ioc_t, data)
13526 
13527 #define WL_RRM_RPT_VER		0
13528 #define WL_RRM_RPT_MAX_PAYLOAD	256
13529 #define WL_RRM_RPT_MIN_PAYLOAD	7
13530 #define WL_RRM_RPT_FALG_ERR	0
13531 #define WL_RRM_RPT_FALG_GRP_ID_PROPR	(1 << 0)
13532 #define WL_RRM_RPT_FALG_GRP_ID_0	(1 << 1)
13533 typedef struct {
13534 	uint16 ver;		/**< version */
13535 	struct ether_addr addr;	/**< STA MAC addr */
13536 	uint32 timestamp;	/**< timestamp of the report */
13537 	uint16 flag;		/**< flag */
13538 	uint16 len;		/**< length of payload data */
13539 	uint8 data[WL_RRM_RPT_MAX_PAYLOAD];
13540 } statrpt_t;
13541 
13542 typedef struct wlc_dwds_config {
13543 	uint32		enable;
13544 	uint32		mode; /**< STA/AP interface */
13545 	struct ether_addr ea;
13546 	uint8  PAD[2];
13547 } wlc_dwds_config_t;
13548 
13549 typedef struct wl_el_set_params_s {
13550 	uint8 set;	/**< Set number */
13551 	uint8  PAD[3];
13552 	uint32 size;	/**< Size to make/expand */
13553 } wl_el_set_params_t;
13554 
13555 typedef struct wl_el_tag_params_s {
13556 	uint16 tag;
13557 	uint8 set;
13558 	uint8 flags;
13559 } wl_el_tag_params_t;
13560 
13561 /** Video Traffic Interference Monitor config */
13562 #define INTFER_VERSION		1
13563 typedef struct wl_intfer_params {
13564 	uint16 version;			/**< version */
13565 	uint8 period;			/**< sample period */
13566 	uint8 cnt;			/**< sample cnt */
13567 	uint8 txfail_thresh;	/**< non-TCP txfail threshold */
13568 	uint8 tcptxfail_thresh;	/**< tcptxfail threshold */
13569 } wl_intfer_params_t;
13570 
13571 #define EVENT_LOG_SET_TYPE_CURRENT_VERSION 0
13572 typedef struct wl_el_set_type_s {
13573 	uint16	version;
13574 	uint16	len;
13575 	uint8	set;	/* Set number */
13576 	uint8	type;	/* Type- EVENT_LOG_SET_TYPE_DEFAULT or EVENT_LOG_SET_TYPE_PRSRV */
13577 	uint16	PAD;
13578 } wl_el_set_type_t;
13579 
13580 typedef struct wl_staprio_cfg {
13581 	struct ether_addr ea;	/**< mac addr */
13582 	uint8 prio;		/**< scb priority */
13583 } wl_staprio_cfg_t;
13584 
13585 #define STAMON_STACONFIG_VER    1
13586 /* size of struct wlc_stamon_sta_config_t elements */
13587 #define STAMON_STACONFIG_LENGTH 20
13588 
13589 typedef enum wl_stamon_cfg_cmd_type {
13590 	STAMON_CFG_CMD_DEL = 0,
13591 	STAMON_CFG_CMD_ADD = 1,
13592 	STAMON_CFG_CMD_ENB = 2,
13593 	STAMON_CFG_CMD_DSB = 3,
13594 	STAMON_CFG_CMD_CNT = 4,
13595 	STAMON_CFG_CMD_RSTCNT = 5,
13596 	STAMON_CFG_CMD_GET_STATS = 6,
13597 	STAMON_CFG_CMD_SET_MONTIME = 7
13598 } wl_stamon_cfg_cmd_type_t;
13599 
13600 typedef struct wlc_stamon_sta_config {
13601 	wl_stamon_cfg_cmd_type_t cmd;	/**< 0 - delete, 1 - add */
13602 	struct ether_addr ea;
13603 	uint16	version;		/* Command structure version */
13604 	uint16	length;			/* Command structure length */
13605 	uint8	pad[2];
13606 	/* Time (ms) for which STA's are monitored. Value ZERO indicates no time limit */
13607 	uint32	monitor_time;
13608 } wlc_stamon_sta_config_t;
13609 
13610 /* ifdef SR_DEBUG */
13611 typedef struct /* pmu_reg */{
13612 	uint32  pmu_control;
13613 	uint32  pmu_capabilities;
13614 	uint32  pmu_status;
13615 	uint32  res_state;
13616 	uint32  res_pending;
13617 	uint32  pmu_timer1;
13618 	uint32  min_res_mask;
13619 	uint32  max_res_mask;
13620 	uint32  pmu_chipcontrol1[4];
13621 	uint32  pmu_regcontrol[5];
13622 	uint32  pmu_pllcontrol[5];
13623 	uint32  pmu_rsrc_up_down_timer[31];
13624 	uint32  rsrc_dep_mask[31];
13625 } pmu_reg_t;
13626 /* endif SR_DEBUG */
13627 
13628 typedef struct wl_taf_define {
13629 	struct ether_addr ea;	/**< STA MAC or 0xFF... */
13630 	uint16 version;         /**< version */
13631 	uint32 sch;             /**< method index */
13632 	uint32 prio;            /**< priority */
13633 	uint32 misc;            /**< used for return value */
13634 	uint8  text[];         /**< used to pass and return ascii text */
13635 } wl_taf_define_t;
13636 
13637 /** Received Beacons lengths information */
13638 #define WL_LAST_BCNS_INFO_FIXED_LEN		OFFSETOF(wlc_bcn_len_hist_t, bcnlen_ring)
13639 typedef struct wlc_bcn_len_hist {
13640 	uint16	ver;				/**< version field */
13641 	uint16	cur_index;			/**< current pointed index in ring buffer */
13642 	uint32	max_bcnlen;		/**< Max beacon length received */
13643 	uint32	min_bcnlen;		/**< Min beacon length received */
13644 	uint32	ringbuff_len;		/**< Length of the ring buffer 'bcnlen_ring' */
13645 	uint32	bcnlen_ring[1];	/**< ring buffer storing received beacon lengths */
13646 } wlc_bcn_len_hist_t;
13647 
13648 /* WDS net interface types */
13649 #define WL_WDSIFTYPE_NONE  0x0 /**< The interface type is neither WDS nor DWDS. */
13650 #define WL_WDSIFTYPE_WDS   0x1 /**< The interface is WDS type. */
13651 #define WL_WDSIFTYPE_DWDS  0x2 /**< The interface is DWDS type. */
13652 
13653 typedef struct wl_bssload_static {
13654 	uint8 is_static;
13655 	uint8  PAD;
13656 	uint16 sta_count;
13657 	uint8 chan_util;
13658 	uint8  PAD;
13659 	uint16 aac;
13660 } wl_bssload_static_t;
13661 
13662 /* Buffer of size WLC_SAMPLECOLLECT_MAXLEN (=10240 for 4345a0 ACPHY)
13663  * gets copied to this, multiple times
13664  */
13665 typedef enum wl_gpaio_option {
13666 	GPAIO_PMU_AFELDO,
13667 	GPAIO_PMU_TXLDO,
13668 	GPAIO_PMU_VCOLDO,
13669 	GPAIO_PMU_LNALDO,
13670 	GPAIO_PMU_ADCLDO,
13671 	GPAIO_ICTAT_CAL,
13672 	GPAIO_PMU_CLEAR,
13673 	GPAIO_OFF,
13674 	GPAIO_PMU_LOGENLDO,
13675 	GPAIO_PMU_RXLDO2G,
13676 	GPAIO_PMU_RXLDO5G,
13677 	GPAIO_PMU_LPFTXLDO,
13678 	GPAIO_PMU_LDO1P6,
13679 	GPAIO_RCAL,
13680 	GPAIO_IQDAC_BUF_DC_MEAS,
13681 	GPAIO_IQDAC_BUF_DC_CLEAR,
13682 	GPAIO_DAC_IQ_DC_RDBK,
13683 	GPAIO_DAC_IQ_DC_RDBK_CLEAR,
13684 	GPAIO_AFE_LDO_FOR_DAC_DC,
13685 	GPAIO_PA5G_VCAS_SOURCE,
13686 	GPAIO_BIQ2_DC_MEAS,
13687 	GPAIO_BIQ2_DC_CLEAR,
13688 	GPAIO_LDO_1P8_OUT
13689 } wl_gpaio_option_t;
13690 
13691 /** IO Var Operations - the Value of iov_op In wlc_ap_doiovar */
13692 typedef enum wlc_ap_iov_bss_operation {
13693 	WLC_AP_IOV_OP_DELETE                   = -1,
13694 	WLC_AP_IOV_OP_DISABLE                  = 0,
13695 	WLC_AP_IOV_OP_ENABLE                   = 1,
13696 	WLC_AP_IOV_OP_MANUAL_STA_BSSCFG_CREATE = 2,
13697 	WLC_AP_IOV_OP_MANUAL_AP_BSSCFG_CREATE  = 3,
13698 	WLC_AP_IOV_OP_MOVE                     = 4
13699 } wlc_ap_iov_bss_oper_t;
13700 
13701 /* LTE coex info */
13702 /* Analogue of HCI Set MWS Signaling cmd */
13703 typedef struct {
13704 	int16	mws_rx_assert_offset;
13705 	int16	mws_rx_assert_jitter;
13706 	int16	mws_rx_deassert_offset;
13707 	int16	mws_rx_deassert_jitter;
13708 	int16	mws_tx_assert_offset;
13709 	int16	mws_tx_assert_jitter;
13710 	int16	mws_tx_deassert_offset;
13711 	int16	mws_tx_deassert_jitter;
13712 	int16	mws_pattern_assert_offset;
13713 	int16	mws_pattern_assert_jitter;
13714 	int16	mws_inact_dur_assert_offset;
13715 	int16	mws_inact_dur_assert_jitter;
13716 	int16	mws_scan_freq_assert_offset;
13717 	int16	mws_scan_freq_assert_jitter;
13718 	int16	mws_prio_assert_offset_req;
13719 } wci2_config_t;
13720 
13721 /** Analogue of HCI MWS Channel Params */
13722 typedef struct {
13723 	uint16	mws_rx_center_freq; /**< MHz */
13724 	uint16	mws_tx_center_freq;
13725 	uint16	mws_rx_channel_bw;  /**< KHz */
13726 	uint16	mws_tx_channel_bw;
13727 	uint8	mws_channel_en;
13728 	uint8	mws_channel_type;   /**< Don't care for WLAN? */
13729 } mws_params_t;
13730 
13731 #define LTECX_MAX_NUM_PERIOD_TYPES	7
13732 
13733 /* LTE Frame params */
13734 typedef struct {
13735 	uint16	mws_frame_dur;
13736 	int16	mws_framesync_assert_offset;
13737 	uint16	mws_framesync_assert_jitter;
13738 	uint16  mws_period_dur[LTECX_MAX_NUM_PERIOD_TYPES];
13739 	uint8	mws_period_type[LTECX_MAX_NUM_PERIOD_TYPES];
13740 	uint8	mws_num_periods;
13741 } mws_frame_config_t;
13742 
13743 /** MWS wci2 message */
13744 typedef struct {
13745 	uint8	mws_wci2_data; /**< BT-SIG msg */
13746 	uint8	PAD;
13747 	uint16	mws_wci2_interval; /**< Interval in us */
13748 	uint16	mws_wci2_repeat; /**< No of msgs to send */
13749 } mws_wci2_msg_t;
13750 /* MWS ANT map */
13751 typedef struct {
13752 	uint16	combo1; /* mws ant selection 1 */
13753 	uint16	combo2; /* mws ant selection 2 */
13754 	uint16	combo3; /* mws ant selection 3 */
13755 	uint16	combo4; /* mws ant selection 4 */
13756 } mws_ant_map_t;
13757 
13758 /* MWS ANT map 2nd generation */
13759 typedef struct {
13760 	uint16	combo[16]; /* mws ant selection 2nd */
13761 } mws_ant_map_t_2nd;
13762 
13763 /* MWS SCAN_REQ Bitmap */
13764 typedef struct mws_scanreq_params {
13765 	uint16 idx;
13766 	uint16 bm_2g;
13767 	uint16 bm_5g_lo;
13768 	uint16 bm_5g_mid;
13769 	uint16 bm_5g_hi;
13770 } mws_scanreq_params_t;
13771 
13772 typedef struct {
13773 	uint32 config;	/**< MODE: AUTO (-1), Disable (0), Enable (1) */
13774 	uint32 status;	/**< Current state: Disabled (0), Enabled (1) */
13775 } wl_config_t;
13776 
13777 #define WLC_RSDB_MODE_AUTO_MASK 0x80
13778 #define WLC_RSDB_EXTRACT_MODE(val) ((int8)((val) & (~(WLC_RSDB_MODE_AUTO_MASK))))
13779 
13780 typedef struct {
13781 	uint16  request; /* type of sensor hub request */
13782 	uint16  enable; /* enable/disable response for specified request */
13783 	uint16  interval; /* interval between responses to the request */
13784 } shub_req_t;
13785 
13786 #define	WL_IF_STATS_T_VERSION 1	/**< current version of wl_if_stats structure */
13787 
13788 /** per interface counters */
13789 typedef struct wl_if_stats {
13790 	uint16	version;		/**< version of the structure */
13791 	uint16	length;			/**< length of the entire structure */
13792 	uint32	PAD;			/**< padding */
13793 
13794 	/* transmit stat counters */
13795 	uint64	txframe;		/**< tx data frames */
13796 	uint64	txbyte;			/**< tx data bytes */
13797 	uint64	txerror;		/**< tx data errors (derived: sum of others) */
13798 	uint64  txnobuf;		/**< tx out of buffer errors */
13799 	uint64  txrunt;			/**< tx runt frames */
13800 	uint64  txfail;			/**< tx failed frames */
13801 	uint64	txretry;		/**< tx retry frames */
13802 	uint64	txretrie;		/**< tx multiple retry frames */
13803 	uint64	txfrmsnt;		/**< tx sent frames */
13804 	uint64	txmulti;		/**< tx mulitcast sent frames */
13805 	uint64	txfrag;			/**< tx fragments sent */
13806 
13807 	/* receive stat counters */
13808 	uint64	rxframe;		/**< rx data frames */
13809 	uint64	rxbyte;			/**< rx data bytes */
13810 	uint64	rxerror;		/**< rx data errors (derived: sum of others) */
13811 	uint64	rxnobuf;		/**< rx out of buffer errors */
13812 	uint64  rxrunt;			/**< rx runt frames */
13813 	uint64  rxfragerr;		/**< rx fragment errors */
13814 	uint64	rxmulti;		/**< rx multicast frames */
13815 
13816 	uint64	txexptime;		/* DATA Tx frames suppressed due to timer expiration */
13817 	uint64	txrts;			/* RTS/CTS succeeeded count */
13818 	uint64	txnocts;		/* RTS/CTS faled count */
13819 
13820 	uint64	txretrans;		/* Number of frame retransmissions */
13821 }
13822 wl_if_stats_t;
13823 
13824 typedef struct wl_band {
13825 	uint16		bandtype;		/**< WL_BAND_2G, WL_BAND_5G */
13826 	uint16		bandunit;		/**< bandstate[] index */
13827 	uint16		phytype;		/**< phytype */
13828 	uint16		phyrev;
13829 }
13830 wl_band_t;
13831 
13832 #define	WL_WLC_VERSION_T_VERSION 1 /**< current version of wlc_version structure */
13833 
13834 /** wlc interface version */
13835 typedef struct wl_wlc_version {
13836 	uint16	version;		/**< version of the structure */
13837 	uint16	length;			/**< length of the entire structure */
13838 
13839 	/* epi version numbers */
13840 	uint16	epi_ver_major;		/**< epi major version number */
13841 	uint16	epi_ver_minor;		/**< epi minor version number */
13842 	uint16	epi_rc_num;		/**< epi RC number */
13843 	uint16	epi_incr_num;		/**< epi increment number */
13844 
13845 	/* wlc interface version numbers */
13846 	uint16	wlc_ver_major;		/**< wlc interface major version number */
13847 	uint16	wlc_ver_minor;		/**< wlc interface minor version number */
13848 }
13849 wl_wlc_version_t;
13850 
13851 /* Highest version of WLC_API_VERSION supported */
13852 #define WLC_API_VERSION_MAJOR_MAX	8
13853 #define WLC_API_VERSION_MINOR_MAX	0
13854 
13855 /* begin proxd definitions */
13856 #include <packed_section_start.h>
13857 
13858 #define WL_PROXD_API_VERSION 0x0300	/**< version 3.0 */
13859 
13860 /** Minimum supported API version */
13861 #define WL_PROXD_API_MIN_VERSION 0x0300
13862 
13863 /** proximity detection methods */
13864 enum {
13865 	WL_PROXD_METHOD_NONE	= 0,
13866 	WL_PROXD_METHOD_RSVD1	= 1, /**< backward compatibility - RSSI, not supported */
13867 	WL_PROXD_METHOD_TOF	= 2,
13868 	WL_PROXD_METHOD_RSVD2	= 3, /**< 11v only - if needed */
13869 	WL_PROXD_METHOD_FTM	= 4, /**< IEEE rev mc/2014 */
13870 	WL_PROXD_METHOD_MAX
13871 };
13872 typedef int16 wl_proxd_method_t;
13873 
13874 /** global and method configuration flags */
13875 enum {
13876 	WL_PROXD_FLAG_NONE			= 0x00000000,
13877 	WL_PROXD_FLAG_RX_ENABLED		= 0x00000001, /**< respond to requests, per bss */
13878 	WL_PROXD_FLAG_RX_RANGE_REQ		= 0x00000002, /**< 11mc range requests enabled */
13879 	WL_PROXD_FLAG_TX_LCI			= 0x00000004, /**< tx lci, if known */
13880 	WL_PROXD_FLAG_TX_CIVIC			= 0x00000008, /**< tx civic, if known */
13881 	WL_PROXD_FLAG_RX_AUTO_BURST		= 0x00000010, /**< auto respond w/o host action */
13882 	WL_PROXD_FLAG_TX_AUTO_BURST		= 0x00000020, /**< continue tx w/o host action */
13883 	WL_PROXD_FLAG_AVAIL_PUBLISH		= 0x00000040,     /**< publish availability */
13884 	WL_PROXD_FLAG_AVAIL_SCHEDULE		= 0x00000080,    /**< schedule using availability */
13885 	WL_PROXD_FLAG_ASAP_CAPABLE		= 0x00000100, /* ASAP capable */
13886 	WL_PROXD_FLAG_MBURST_FOLLOWUP		= 0x00000200, /* new multi-burst algorithm */
13887 	WL_PROXD_FLAG_SECURE			= 0x00000400, /* per bsscfg option */
13888 	WL_PROXD_FLAG_NO_TSF_SYNC		= 0x00000800, /* disable tsf sync */
13889 	WL_PROXD_FLAG_ALL			= 0xffffffff
13890 };
13891 typedef uint32 wl_proxd_flags_t;
13892 
13893 #define WL_PROXD_FLAGS_AVAIL (WL_PROXD_FLAG_AVAIL_PUBLISH | \
13894 	WL_PROXD_FLAG_AVAIL_SCHEDULE)
13895 
13896 /** session flags */
13897 enum {
13898 	WL_PROXD_SESSION_FLAG_NONE 		= 0x00000000,  /**< no flags */
13899 	WL_PROXD_SESSION_FLAG_INITIATOR 	= 0x00000001,  /**< local device is initiator */
13900 	WL_PROXD_SESSION_FLAG_TARGET 		= 0x00000002,  /**< local device is target */
13901 	WL_PROXD_SESSION_FLAG_ONE_WAY		= 0x00000004,  /**< (initiated) 1-way rtt */
13902 	WL_PROXD_SESSION_FLAG_AUTO_BURST	= 0x00000008,  /**< created w/ rx_auto_burst */
13903 	WL_PROXD_SESSION_FLAG_PERSIST		= 0x00000010,  /**< good until cancelled */
13904 	WL_PROXD_SESSION_FLAG_RTT_DETAIL	= 0x00000020,  /**< rtt detail in results */
13905 	WL_PROXD_SESSION_FLAG_SECURE		= 0x00000040,  /**< sessionis secure */
13906 	WL_PROXD_SESSION_FLAG_AOA		= 0x00000080,  /**< AOA along w/ RTT */
13907 	WL_PROXD_SESSION_FLAG_RX_AUTO_BURST	= 0x00000100,  /**< Same as proxd flags above */
13908 	WL_PROXD_SESSION_FLAG_TX_AUTO_BURST	= 0x00000200,  /**< Same as proxd flags above */
13909 	WL_PROXD_SESSION_FLAG_NAN_BSS		= 0x00000400,  /**< Use NAN BSS, if applicable */
13910 	WL_PROXD_SESSION_FLAG_TS1		= 0x00000800,  /**< e.g. FTM1 - ASAP-capable */
13911 	WL_PROXD_SESSION_FLAG_REPORT_FAILURE	= 0x00002000, /**< report failure to target */
13912 	WL_PROXD_SESSION_FLAG_INITIATOR_RPT	= 0x00004000, /**< report distance to target */
13913 	WL_PROXD_SESSION_FLAG_NOCHANSWT		= 0x00008000,
13914 	WL_PROXD_SESSION_FLAG_NETRUAL		= 0x00010000, /**< netrual mode */
13915 	WL_PROXD_SESSION_FLAG_SEQ_EN		= 0x00020000, /**< Toast */
13916 	WL_PROXD_SESSION_FLAG_NO_PARAM_OVRD	= 0x00040000, /**< no param override from target */
13917 	WL_PROXD_SESSION_FLAG_ASAP		= 0x00080000, /**< ASAP session */
13918 	WL_PROXD_SESSION_FLAG_REQ_LCI		= 0x00100000, /**< transmit LCI req */
13919 	WL_PROXD_SESSION_FLAG_REQ_CIV		= 0x00200000, /**< transmit civic loc req */
13920 	WL_PROXD_SESSION_FLAG_PRE_SCAN		= 0x00400000, /* enable pre-scan for asap=1 */
13921 	WL_PROXD_SESSION_FLAG_AUTO_VHTACK	= 0x00800000, /* use vhtack based on brcm ie */
13922 	WL_PROXD_SESSION_FLAG_VHTACK		= 0x01000000, /* vht ack is in use - output only */
13923 	WL_PROXD_SESSION_FLAG_BDUR_NOPREF	= 0x02000000, /* burst-duration: no preference */
13924 	WL_PROXD_SESSION_FLAG_NUM_FTM_NOPREF	= 0x04000000, /* num of FTM frames: no preference */
13925 	WL_PROXD_SESSION_FLAG_FTM_SEP_NOPREF	= 0x08000000, /* time btw FTM frams: no pref */
13926 	WL_PROXD_SESSION_FLAG_NUM_BURST_NOPREF	= 0x10000000, /* num of bursts: no pref */
13927 	WL_PROXD_SESSION_FLAG_BURST_PERIOD_NOPREF = 0x20000000, /* burst period: no pref */
13928 	WL_PROXD_SESSION_FLAG_MBURST_FOLLOWUP	= 0x40000000, /* new mburst algo  - reserved */
13929 	WL_PROXD_SESSION_FLAG_MBURST_NODELAY	= 0x80000000, /**< good until cancelled */
13930 	WL_PROXD_SESSION_FLAG_ALL		= 0xffffffff
13931 
13932 };
13933 typedef uint32 wl_proxd_session_flags_t;
13934 
13935 /** time units - mc supports up to 0.1ns resolution */
13936 enum {
13937 	WL_PROXD_TMU_TU			= 0,		/**< 1024us */
13938 	WL_PROXD_TMU_SEC		= 1,
13939 	WL_PROXD_TMU_MILLI_SEC	= 2,
13940 	WL_PROXD_TMU_MICRO_SEC	= 3,
13941 	WL_PROXD_TMU_NANO_SEC	= 4,
13942 	WL_PROXD_TMU_PICO_SEC	= 5
13943 };
13944 typedef int16 wl_proxd_tmu_t;
13945 
13946 /** time interval e.g. 10ns */
13947 typedef struct wl_proxd_intvl {
13948 	uint32 intvl;
13949 	wl_proxd_tmu_t tmu;
13950 	uint8	pad[2];
13951 } wl_proxd_intvl_t;
13952 
13953 /** commands that can apply to proxd, method or a session */
13954 enum {
13955 	WL_PROXD_CMD_NONE			= 0,
13956 	WL_PROXD_CMD_GET_VERSION		= 1,
13957 	WL_PROXD_CMD_ENABLE			= 2,
13958 	WL_PROXD_CMD_DISABLE			= 3,
13959 	WL_PROXD_CMD_CONFIG			= 4,
13960 	WL_PROXD_CMD_START_SESSION		= 5,
13961 	WL_PROXD_CMD_BURST_REQUEST		= 6,
13962 	WL_PROXD_CMD_STOP_SESSION		= 7,
13963 	WL_PROXD_CMD_DELETE_SESSION		= 8,
13964 	WL_PROXD_CMD_GET_RESULT			= 9,
13965 	WL_PROXD_CMD_GET_INFO			= 10,
13966 	WL_PROXD_CMD_GET_STATUS			= 11,
13967 	WL_PROXD_CMD_GET_SESSIONS		= 12,
13968 	WL_PROXD_CMD_GET_COUNTERS		= 13,
13969 	WL_PROXD_CMD_CLEAR_COUNTERS		= 14,
13970 	WL_PROXD_CMD_COLLECT			= 15,	/* not supported, see 'wl proxd_collect' */
13971 	WL_PROXD_CMD_TUNE			= 16,	/* not supported, see 'wl proxd_tune' */
13972 	WL_PROXD_CMD_DUMP			= 17,
13973 	WL_PROXD_CMD_START_RANGING		= 18,
13974 	WL_PROXD_CMD_STOP_RANGING		= 19,
13975 	WL_PROXD_CMD_GET_RANGING_INFO		= 20,
13976 	WL_PROXD_CMD_IS_TLV_SUPPORTED		= 21,
13977 
13978 	WL_PROXD_CMD_MAX
13979 };
13980 typedef int16 wl_proxd_cmd_t;
13981 
13982 /* session ids:
13983  * id 0 is reserved
13984  * ids 1..0x7fff - allocated by host/app
13985  * 0x8000-0xffff - allocated by firmware, used for auto/rx
13986  */
13987 enum {
13988 	 WL_PROXD_SESSION_ID_GLOBAL = 0
13989 };
13990 
13991 /* Externally allocated sids */
13992 #define WL_PROXD_SID_EXT_MAX 0x7fff
13993 #define WL_PROXD_SID_EXT_ALLOC(_sid) ((_sid) > 0 && (_sid) <= WL_PROXD_SID_EXT_MAX)
13994 
13995 /* block size for reserved sid blocks */
13996 #define WL_PROXD_SID_EXT_BLKSZ 256
13997 #define WL_PROXD_SID_EXT_BLK_START(_i) (WL_PROXD_SID_EXT_MAX - (_i) * WL_PROXD_SID_EXT_BLKSZ + 1)
13998 #define WL_PROXD_SID_EXT_BLK_END(_start) ((_start) + WL_PROXD_SID_EXT_BLKSZ - 1)
13999 
14000 /* rrm block */
14001 #define WL_PROXD_SID_RRM_START WL_PROXD_SID_EXT_BLK_START(1)
14002 #define WL_PROXD_SID_RRM_END WL_PROXD_SID_EXT_BLK_END(WL_PROXD_SID_RRM_START)
14003 
14004 /* nan block */
14005 #define WL_PROXD_SID_NAN_START WL_PROXD_SID_EXT_BLK_START(2)
14006 #define WL_PROXD_SID_NAN_END WL_PROXD_SID_EXT_BLK_END(WL_PROXD_SID_NAN_START)
14007 
14008 /** maximum number sessions that can be allocated, may be less if tunable */
14009 #define WL_PROXD_MAX_SESSIONS 16
14010 
14011 typedef uint16 wl_proxd_session_id_t;
14012 
14013 /** status - TBD BCME_ vs proxd status - range reserved for BCME_ */
14014 enum {
14015 	WL_PROXD_E_LAST			= -1056,
14016 	WL_PROXD_E_NOAVAIL		= -1056,
14017 	WL_PROXD_E_EXT_SCHED		= -1055,
14018 	WL_PROXD_E_NOT_BCM		= -1054,
14019 	WL_PROXD_E_FRAME_TYPE		= -1053,
14020 	WL_PROXD_E_VERNOSUPPORT		= -1052,
14021 	WL_PROXD_E_SEC_NOKEY		= -1051,
14022 	WL_PROXD_E_SEC_POLICY		= -1050,
14023 	WL_PROXD_E_SCAN_INPROCESS	= -1049,
14024 	WL_PROXD_E_BAD_PARTIAL_TSF	= -1048,
14025 	WL_PROXD_E_SCANFAIL		= -1047,
14026 	WL_PROXD_E_NOTSF		= -1046,
14027 	WL_PROXD_E_POLICY		= -1045,
14028 	WL_PROXD_E_INCOMPLETE		= -1044,
14029 	WL_PROXD_E_OVERRIDDEN		= -1043,
14030 	WL_PROXD_E_ASAP_FAILED		= -1042,
14031 	WL_PROXD_E_NOTSTARTED		= -1041,
14032 	WL_PROXD_E_INVALIDMEAS		= -1040,
14033 	WL_PROXD_E_INCAPABLE		= -1039,
14034 	WL_PROXD_E_MISMATCH		= -1038,
14035 	WL_PROXD_E_DUP_SESSION		= -1037,
14036 	WL_PROXD_E_REMOTE_FAIL		= -1036,
14037 	WL_PROXD_E_REMOTE_INCAPABLE	= -1035,
14038 	WL_PROXD_E_SCHED_FAIL		= -1034,
14039 	WL_PROXD_E_PROTO		= -1033,
14040 	WL_PROXD_E_EXPIRED		= -1032,
14041 	WL_PROXD_E_TIMEOUT		= -1031,
14042 	WL_PROXD_E_NOACK		= -1030,
14043 	WL_PROXD_E_DEFERRED		= -1029,
14044 	WL_PROXD_E_INVALID_SID		= -1028,
14045 	WL_PROXD_E_REMOTE_CANCEL	= -1027,
14046 	WL_PROXD_E_CANCELED		= -1026,	/**< local */
14047 	WL_PROXD_E_INVALID_SESSION	= -1025,
14048 	WL_PROXD_E_BAD_STATE		= -1024,
14049 	WL_PROXD_E_START		= -1024,
14050 	WL_PROXD_E_ERROR		= -1,
14051 	WL_PROXD_E_OK			= 0
14052 };
14053 typedef int32 wl_proxd_status_t;
14054 
14055 /* proxd errors from phy */
14056 #define PROXD_TOF_INIT_ERR_BITS 16
14057 
14058 enum {
14059 	WL_PROXD_PHY_ERR_LB_CORR_THRESH    = (1 << 0), /* Loopback Correlation threshold */
14060 	WL_PROXD_PHY_ERR_RX_CORR_THRESH    = (1 << 1), /* Received Correlation threshold */
14061 	WL_PROXD_PHY_ERR_LB_PEAK_POWER     = (1 << 2), /* Loopback Peak power   */
14062 	WL_PROXD_PHY_ERR_RX_PEAK_POWER     = (1 << 3), /* Received Peak power   */
14063 	WL_PROXD_PHY_ERR_BITFLIP           = (1 << 4), /* Bitflips */
14064 	WL_PROXD_PHY_ERR_SNR               = (1 << 5), /* SNR */
14065 	WL_PROXD_PHY_RX_STRT_WIN_OFF       = (1 << 6), /* Receive start window is off */
14066 	WL_PROXD_PHY_RX_END_WIN_OFF        = (1 << 7), /* Receive End window is off */
14067 	WL_PROXD_PHY_ERR_LOW_CONFIDENCE    = (1 << 15), /* Low confidence on meas distance */
14068 };
14069 typedef uint32 wl_proxd_phy_error_t;
14070 
14071 /** session states */
14072 enum {
14073 	WL_PROXD_SESSION_STATE_NONE			= 0,
14074 	WL_PROXD_SESSION_STATE_CREATED			= 1,
14075 	WL_PROXD_SESSION_STATE_CONFIGURED		= 2,
14076 	WL_PROXD_SESSION_STATE_STARTED			= 3,
14077 	WL_PROXD_SESSION_STATE_DELAY			= 4,
14078 	WL_PROXD_SESSION_STATE_USER_WAIT		= 5,
14079 	WL_PROXD_SESSION_STATE_SCHED_WAIT		= 6,
14080 	WL_PROXD_SESSION_STATE_BURST			= 7,
14081 	WL_PROXD_SESSION_STATE_STOPPING			= 8,
14082 	WL_PROXD_SESSION_STATE_ENDED			= 9,
14083 	WL_PROXD_SESSION_STATE_START_WAIT		= 10,
14084 	WL_PROXD_SESSION_STATE_DESTROYING		= -1
14085 };
14086 typedef int16 wl_proxd_session_state_t;
14087 
14088 /** RTT sample flags */
14089 enum {
14090 	WL_PROXD_RTT_SAMPLE_NONE	= 0x00,
14091 	WL_PROXD_RTT_SAMPLE_DISCARD	= 0x01
14092 };
14093 typedef uint8 wl_proxd_rtt_sample_flags_t;
14094 typedef int16 wl_proxd_rssi_t;
14095 typedef uint16 wl_proxd_snr_t;
14096 typedef uint16 wl_proxd_bitflips_t;
14097 
14098 /** result flags */
14099 enum {
14100 	WL_PRXOD_RESULT_FLAG_NONE	= 0x0000,
14101 	WL_PROXD_RESULT_FLAG_NLOS	= 0x0001,	/**< LOS - if available */
14102 	WL_PROXD_RESULT_FLAG_LOS	= 0x0002,	/**< NLOS - if available */
14103 	WL_PROXD_RESULT_FLAG_FATAL	= 0x0004,	/**< Fatal error during burst */
14104 	WL_PROXD_RESULT_FLAG_VHTACK	= 0x0008,	/* VHTACK or Legacy ACK used */
14105 	WL_PROXD_REQUEST_SENT		= 0x0010,	/* FTM request was sent */
14106 	WL_PROXD_REQUEST_ACKED		= 0x0020,	/* FTM request was acked */
14107 	WL_PROXD_LTFSEQ_STARTED		= 0x0040,	/* LTF sequence started */
14108 	WL_PROXD_RESULT_FLAG_ALL	= 0xffff
14109 };
14110 typedef int16 wl_proxd_result_flags_t;
14111 
14112 #define WL_PROXD_RTT_SAMPLE_VERSION_1	1
14113 typedef struct wl_proxd_rtt_sample_v1 {
14114 	uint8				id;		/**< id for the sample - non-zero */
14115 	wl_proxd_rtt_sample_flags_t	flags;
14116 	wl_proxd_rssi_t			rssi;
14117 	wl_proxd_intvl_t		rtt;		/**< round trip time */
14118 	uint32				ratespec;
14119 	wl_proxd_snr_t                  snr;
14120 	wl_proxd_bitflips_t             bitflips;
14121 	wl_proxd_status_t               status;
14122 	int32                           distance;
14123 	wl_proxd_phy_error_t		tof_phy_error;
14124 	wl_proxd_phy_error_t		tof_tgt_phy_error; /* target phy error bit map */
14125 	wl_proxd_snr_t                  tof_tgt_snr;
14126 	wl_proxd_bitflips_t             tof_tgt_bitflips;
14127 	uint8                           coreid;
14128 	uint8                           pad[3];
14129 } wl_proxd_rtt_sample_v1_t;
14130 
14131 #define WL_PROXD_RTT_RESULT_VERSION_1	1
14132 /** rtt measurement result */
14133 typedef struct wl_proxd_rtt_result_v1 {
14134 	wl_proxd_session_id_t		sid;
14135 	wl_proxd_result_flags_t		flags;
14136 	wl_proxd_status_t		status;
14137 	struct ether_addr		peer;
14138 	wl_proxd_session_state_t	state;		/**< current state */
14139 	union {
14140 		wl_proxd_intvl_t	retry_after;	/* hint for errors */
14141 		wl_proxd_intvl_t	burst_duration; /* burst duration */
14142 	} u;
14143 	wl_proxd_rtt_sample_v1_t	avg_rtt;
14144 	uint32				avg_dist;	/* 1/256m units */
14145 	uint16				sd_rtt;		/* RTT standard deviation */
14146 	uint8				num_valid_rtt;	/* valid rtt cnt */
14147 	uint8				num_ftm;	/* actual num of ftm cnt (Configured) */
14148 	uint16				burst_num;	/* in a session */
14149 	uint16				num_rtt;	/* 0 if no detail */
14150 	uint16				num_meas;	/* number of ftm frames seen OTA */
14151 	uint8                           pad[2];
14152 	wl_proxd_rtt_sample_v1_t	rtt[1];		/* variable */
14153 } wl_proxd_rtt_result_v1_t;
14154 
14155 #define WL_PROXD_RTT_SAMPLE_VERSION_2	2
14156 typedef struct wl_proxd_rtt_sample_v2 {
14157 	uint16				version;
14158 	uint16				length;
14159 	uint8				id;		/**< id for the sample - non-zero */
14160 	wl_proxd_rtt_sample_flags_t	flags;
14161 	wl_proxd_rssi_t			rssi;
14162 	wl_proxd_intvl_t		rtt;		/**< round trip time */
14163 	uint32				ratespec;
14164 	wl_proxd_snr_t                  snr;
14165 	wl_proxd_bitflips_t             bitflips;
14166 	wl_proxd_status_t               status;
14167 	int32                           distance;
14168 	wl_proxd_phy_error_t		tof_phy_error;
14169 	wl_proxd_phy_error_t		tof_tgt_phy_error; /* target phy error bit map */
14170 	wl_proxd_snr_t                  tof_tgt_snr;
14171 	wl_proxd_bitflips_t             tof_tgt_bitflips;
14172 	uint8                           coreid;
14173 	uint8                           pad[3];
14174 	uint32				chanspec;
14175 } wl_proxd_rtt_sample_v2_t;
14176 
14177 #define WL_PROXD_RTT_RESULT_VERSION_2	2
14178 /** rtt measurement result */
14179 typedef struct wl_proxd_rtt_result_v2 {
14180 	uint16				version;
14181 	uint16				length;		/* up to rtt[] */
14182 	wl_proxd_session_id_t		sid;
14183 	wl_proxd_result_flags_t		flags;
14184 	wl_proxd_status_t		status;
14185 	struct ether_addr		peer;
14186 	wl_proxd_session_state_t	state;		/**< current state */
14187 	union {
14188 		wl_proxd_intvl_t	retry_after;	/* hint for errors */
14189 		wl_proxd_intvl_t	burst_duration; /* burst duration */
14190 	} u;
14191 	uint32				avg_dist;	/* 1/256m units */
14192 	uint16				sd_rtt;		/* RTT standard deviation */
14193 	uint8				num_valid_rtt;	/* valid rtt cnt */
14194 	uint8				num_ftm;	/* actual num of ftm cnt (Configured) */
14195 	uint16				burst_num;	/* in a session */
14196 	uint16				num_rtt;	/* 0 if no detail */
14197 	uint16				num_meas;	/* number of ftm frames seen OTA */
14198 	uint8                           pad[2];
14199 	wl_proxd_rtt_sample_v2_t	rtt[1];		/* variable, first element is avg_rtt */
14200 } wl_proxd_rtt_result_v2_t;
14201 
14202 /** aoa measurement result */
14203 typedef struct wl_proxd_aoa_result {
14204 	wl_proxd_session_id_t		sid;
14205 	wl_proxd_result_flags_t		flags;
14206 	wl_proxd_status_t		status;
14207 	struct ether_addr		peer;
14208 	wl_proxd_session_state_t	state;
14209 	uint16				burst_num;
14210 	uint8				pad[2];
14211 	/* wl_proxd_aoa_sample_t sample_avg; TBD */
14212 } BWL_POST_PACKED_STRUCT wl_proxd_aoa_result_t;
14213 #include <packed_section_end.h>
14214 
14215 /** global stats */
14216 typedef struct wl_proxd_counters {
14217 	uint32 tx;			/* tx frame count */
14218 	uint32 rx;			/* rx frame count */
14219 	uint32 burst;			/* total number of burst */
14220 	uint32 sessions;		/* total number of sessions */
14221 	uint32 max_sessions;		/* max concurrency */
14222 	uint32 sched_fail;		/* scheduling failures */
14223 	uint32 timeouts;		/* timeouts */
14224 	uint32 protoerr;		/* protocol errors */
14225 	uint32 noack;			/* tx w/o ack */
14226 	uint32 txfail;			/* any tx falure */
14227 	uint32 lci_req_tx;		/* tx LCI requests */
14228 	uint32 lci_req_rx;		/* rx LCI requests */
14229 	uint32 lci_rep_tx;		/* tx LCI reports */
14230 	uint32 lci_rep_rx;		/* rx LCI reports */
14231 	uint32 civic_req_tx;		/* tx civic requests */
14232 	uint32 civic_req_rx;		/* rx civic requests */
14233 	uint32 civic_rep_tx;		/* tx civic reports */
14234 	uint32 civic_rep_rx;		/* rx civic reports */
14235 	uint32 rctx;			/* ranging contexts created */
14236 	uint32 rctx_done;		/* count of ranging done */
14237 	uint32 publish_err;		/* availability publishing errors */
14238 	uint32 on_chan;			/* count of scheduler onchan */
14239 	uint32 off_chan;		/* count of scheduler offchan */
14240 	uint32 tsf_lo;			/* local tsf or session tsf */
14241 	uint32 tsf_hi;
14242 	uint32 num_meas;
14243 } wl_proxd_counters_t;
14244 
14245 typedef struct wl_proxd_counters wl_proxd_session_counters_t;
14246 
14247 enum {
14248 	WL_PROXD_CAP_NONE 		= 0x0000,
14249 	WL_PROXD_CAP_ALL 		= 0xffff
14250 };
14251 typedef int16 wl_proxd_caps_t;
14252 
14253 /** method capabilities */
14254 enum {
14255 	WL_PROXD_FTM_CAP_NONE = 0x0000,
14256 	WL_PROXD_FTM_CAP_FTM1 = 0x0001
14257 };
14258 typedef uint16 wl_proxd_ftm_caps_t;
14259 
14260 typedef struct wl_proxd_tlv_id_list {
14261 	uint16			num_ids;
14262 	uint16			ids[1];
14263 } wl_proxd_tlv_id_list_t;
14264 
14265 typedef struct wl_proxd_session_id_list {
14266 	uint16 num_ids;
14267 	wl_proxd_session_id_t ids[1];
14268 } wl_proxd_session_id_list_t;
14269 
14270 typedef struct wl_proxd_tpk {
14271 	struct ether_addr	peer;
14272 	uint8 tpk[TPK_FTM_LEN];
14273 } wl_proxd_tpk_t;
14274 
14275 /* tlvs returned for get_info on ftm method
14276  *	configuration:
14277  *	proxd flags
14278  *	event mask
14279  *	debug mask
14280  *	session defaults (session tlvs)
14281  * status tlv - not supported for ftm method
14282  * info tlv
14283  */
14284 typedef struct wl_proxd_ftm_info {
14285 	wl_proxd_ftm_caps_t caps;
14286 	uint16 max_sessions;
14287 	uint16 num_sessions;
14288 	uint16 rx_max_burst;
14289 } wl_proxd_ftm_info_t;
14290 
14291 enum {
14292 	WL_PROXD_WAIT_NONE	= 0x0000,
14293 	WL_PROXD_WAIT_KEY	= 0x0001,
14294 	WL_PROXD_WAIT_SCHED	= 0x0002,
14295 	WL_PROXD_WAIT_TSF	= 0x0004
14296 };
14297 typedef int16 wl_proxd_wait_reason_t;
14298 
14299 /* tlvs returned for get_info on session
14300  * session config (tlvs)
14301  * session info tlv
14302  */
14303 typedef struct wl_proxd_ftm_session_info {
14304 	uint16 sid;
14305 	uint8 bss_index;
14306 	uint8 pad;
14307 	struct ether_addr bssid;
14308 	wl_proxd_session_state_t state;
14309 	wl_proxd_status_t status;
14310 	uint16	burst_num;
14311 	wl_proxd_wait_reason_t wait_reason;
14312 	uint32	meas_start_lo; /* sn tsf of 1st meas for cur/prev burst */
14313 	uint32	meas_start_hi;
14314 } wl_proxd_ftm_session_info_t;
14315 
14316 typedef struct wl_proxd_ftm_session_status {
14317 	uint16 sid;
14318 	wl_proxd_session_state_t state;
14319 	wl_proxd_status_t status;
14320 	uint16	burst_num;
14321 	uint16	pad;
14322 } wl_proxd_ftm_session_status_t;
14323 
14324 /** rrm range request */
14325 typedef struct wl_proxd_range_req {
14326 	uint16 			num_repeat;
14327 	uint16			init_delay_range;	/**< in TUs */
14328 	uint8			pad;
14329 	uint8			num_nbr;		/**< number of (possible) neighbors */
14330 	nbr_element_t		nbr[1];
14331 } wl_proxd_range_req_t;
14332 
14333 #define WL_PROXD_LCI_LAT_OFF 	0
14334 #define WL_PROXD_LCI_LONG_OFF 	5
14335 #define WL_PROXD_LCI_ALT_OFF 	10
14336 
14337 #define WL_PROXD_LCI_GET_LAT(_lci, _lat, _lat_err) { \
14338 	unsigned _off = WL_PROXD_LCI_LAT_OFF; \
14339 	_lat_err = (_lci)->data[(_off)] & 0x3f; \
14340 	_lat = (_lci)->data[(_off)+1]; \
14341 	_lat |= (_lci)->data[(_off)+2] << 8; \
14342 	_lat |= (_lci)->data[_(_off)+3] << 16; \
14343 	_lat |= (_lci)->data[(_off)+4] << 24; \
14344 	_lat <<= 2; \
14345 	_lat |= (_lci)->data[(_off)] >> 6; \
14346 }
14347 
14348 #define WL_PROXD_LCI_GET_LONG(_lci, _lcilong, _long_err) { \
14349 	unsigned _off = WL_PROXD_LCI_LONG_OFF; \
14350 	_long_err = (_lci)->data[(_off)] & 0x3f; \
14351 	_lcilong = (_lci)->data[(_off)+1]; \
14352 	_lcilong |= (_lci)->data[(_off)+2] << 8; \
14353 	_lcilong |= (_lci)->data[_(_off)+3] << 16; \
14354 	_lcilong |= (_lci)->data[(_off)+4] << 24; \
14355 	__lcilong <<= 2; \
14356 	_lcilong |= (_lci)->data[(_off)] >> 6; \
14357 }
14358 
14359 #define WL_PROXD_LCI_GET_ALT(_lci, _alt_type, _alt, _alt_err) { \
14360 	unsigned _off = WL_PROXD_LCI_ALT_OFF; \
14361 	_alt_type = (_lci)->data[_off] & 0x0f; \
14362 	_alt_err = (_lci)->data[(_off)] >> 4; \
14363 	_alt_err |= ((_lci)->data[(_off)+1] & 0x03) << 4; \
14364 	_alt = (_lci)->data[(_off)+2]; \
14365 	_alt |= (_lci)->data[(_off)+3] << 8; \
14366 	_alt |= (_lci)->data[_(_off)+4] << 16; \
14367 	_alt <<= 6; \
14368 	_alt |= (_lci)->data[(_off) + 1] >> 2; \
14369 }
14370 
14371 #define WL_PROXD_LCI_VERSION(_lci) ((_lci)->data[15] >> 6)
14372 
14373 /* availability. advertising mechanism bss specific */
14374 /** availablity flags */
14375 enum {
14376 	WL_PROXD_AVAIL_NONE = 0,
14377 	WL_PROXD_AVAIL_NAN_PUBLISHED = 0x0001,
14378 	WL_PROXD_AVAIL_SCHEDULED = 0x0002        /**< scheduled by proxd */
14379 };
14380 typedef int16 wl_proxd_avail_flags_t;
14381 
14382 /** time reference */
14383 enum {
14384 	WL_PROXD_TREF_NONE = 0,
14385 	WL_PROXD_TREF_DEV_TSF = 1,
14386 	WL_PROXD_TREF_NAN_DW = 2,
14387 	WL_PROXD_TREF_TBTT = 3,
14388 	WL_PROXD_TREF_MAX		/* last entry */
14389 };
14390 typedef int16 wl_proxd_time_ref_t;
14391 
14392 /** proxd channel-time slot */
14393 typedef struct {
14394 	wl_proxd_intvl_t start;         /**< from ref */
14395 	wl_proxd_intvl_t duration;      /**< from start */
14396 	uint32  chanspec;
14397 } wl_proxd_time_slot_t;
14398 
14399 typedef struct wl_proxd_avail24 {
14400 	wl_proxd_avail_flags_t flags; /**< for query only */
14401 	wl_proxd_time_ref_t time_ref;
14402 	uint16	max_slots; /**< for query only */
14403 	uint16  num_slots;
14404 	wl_proxd_time_slot_t slots[1];	/**< ROM compat - not used */
14405 	wl_proxd_intvl_t 	repeat;
14406 	wl_proxd_time_slot_t ts0[1];
14407 } wl_proxd_avail24_t;
14408 #define WL_PROXD_AVAIL24_TIMESLOT(_avail24, _i) (&(_avail24)->ts0[(_i)])
14409 #define WL_PROXD_AVAIL24_TIMESLOT_OFFSET(_avail24) OFFSETOF(wl_proxd_avail24_t, ts0)
14410 #define WL_PROXD_AVAIL24_TIMESLOTS(_avail24) WL_PROXD_AVAIL24_TIMESLOT(_avail24, 0)
14411 #define WL_PROXD_AVAIL24_SIZE(_avail24, _num_slots) (\
14412 	WL_PROXD_AVAIL24_TIMESLOT_OFFSET(_avail24) + \
14413 	(_num_slots) * sizeof(*WL_PROXD_AVAIL24_TIMESLOT(_avail24, 0)))
14414 
14415 typedef struct wl_proxd_avail {
14416 	wl_proxd_avail_flags_t flags; /**< for query only */
14417 	wl_proxd_time_ref_t time_ref;
14418 	uint16	max_slots; /**< for query only */
14419 	uint16  num_slots;
14420 	wl_proxd_intvl_t 	repeat;
14421 	wl_proxd_time_slot_t slots[1];
14422 } wl_proxd_avail_t;
14423 #define WL_PROXD_AVAIL_TIMESLOT(_avail, _i) (&(_avail)->slots[(_i)])
14424 #define WL_PROXD_AVAIL_TIMESLOT_OFFSET(_avail) OFFSETOF(wl_proxd_avail_t, slots)
14425 
14426 #define WL_PROXD_AVAIL_TIMESLOTS(_avail) WL_PROXD_AVAIL_TIMESLOT(_avail, 0)
14427 #define WL_PROXD_AVAIL_SIZE(_avail, _num_slots) (\
14428 	WL_PROXD_AVAIL_TIMESLOT_OFFSET(_avail) + \
14429 	(_num_slots) * sizeof(*WL_PROXD_AVAIL_TIMESLOT(_avail, 0)))
14430 
14431 /* collect support TBD */
14432 
14433 /** debugging */
14434 enum {
14435 	WL_PROXD_DEBUG_NONE		= 0x00000000,
14436 	WL_PROXD_DEBUG_LOG		= 0x00000001,
14437 	WL_PROXD_DEBUG_IOV		= 0x00000002,
14438 	WL_PROXD_DEBUG_EVENT		= 0x00000004,
14439 	WL_PROXD_DEBUG_SESSION		= 0x00000008,
14440 	WL_PROXD_DEBUG_PROTO		= 0x00000010,
14441 	WL_PROXD_DEBUG_SCHED		= 0x00000020,
14442 	WL_PROXD_DEBUG_RANGING		= 0x00000040,
14443 	WL_PROXD_DEBUG_NAN		= 0x00000080,
14444 	WL_PROXD_DEBUG_PKT		= 0x00000100,
14445 	WL_PROXD_DEBUG_SEC		= 0x00000200,
14446 	WL_PROXD_DEBUG_EVENTLOG		= 0x80000000,	/* map/enable EVNET_LOG_TAG_PROXD_INFO */
14447 	WL_PROXD_DEBUG_ALL		= 0xffffffff
14448 };
14449 typedef uint32 wl_proxd_debug_mask_t;
14450 
14451 /** tlv IDs - data length 4 bytes unless overridden by type, alignment 32 bits */
14452 enum {
14453 	WL_PROXD_TLV_ID_NONE			= 0,
14454 	WL_PROXD_TLV_ID_METHOD			= 1,
14455 	WL_PROXD_TLV_ID_FLAGS			= 2,
14456 	WL_PROXD_TLV_ID_CHANSPEC		= 3,	/**< note: uint32 */
14457 	WL_PROXD_TLV_ID_TX_POWER		= 4,
14458 	WL_PROXD_TLV_ID_RATESPEC		= 5,
14459 	WL_PROXD_TLV_ID_BURST_DURATION		= 6,	/**< intvl - length of burst */
14460 	WL_PROXD_TLV_ID_BURST_PERIOD		= 7,	/**< intvl - between bursts */
14461 	WL_PROXD_TLV_ID_BURST_FTM_SEP		= 8,	/**< intvl - between FTMs */
14462 	WL_PROXD_TLV_ID_BURST_NUM_FTM		= 9,	/**< uint16 - per burst */
14463 	WL_PROXD_TLV_ID_NUM_BURST		= 10,	/**< uint16 */
14464 	WL_PROXD_TLV_ID_FTM_RETRIES		= 11,	/**< uint16 at FTM level */
14465 	WL_PROXD_TLV_ID_BSS_INDEX		= 12,	/**< uint8 */
14466 	WL_PROXD_TLV_ID_BSSID			= 13,
14467 	WL_PROXD_TLV_ID_INIT_DELAY		= 14,	/**< intvl - optional,non-standalone only */
14468 	WL_PROXD_TLV_ID_BURST_TIMEOUT		= 15,	/**< expect response within - intvl */
14469 	WL_PROXD_TLV_ID_EVENT_MASK		= 16,	/**< interested events - in/out */
14470 	WL_PROXD_TLV_ID_FLAGS_MASK		= 17,	/**< interested flags - in only */
14471 	WL_PROXD_TLV_ID_PEER_MAC		= 18,	/**< mac address of peer */
14472 	WL_PROXD_TLV_ID_FTM_REQ			= 19,	/**< dot11_ftm_req */
14473 	WL_PROXD_TLV_ID_LCI_REQ			= 20,
14474 	WL_PROXD_TLV_ID_LCI			= 21,
14475 	WL_PROXD_TLV_ID_CIVIC_REQ		= 22,
14476 	WL_PROXD_TLV_ID_CIVIC			= 23,
14477 	WL_PROXD_TLV_ID_AVAIL24			= 24,	/**< ROM compatibility */
14478 	WL_PROXD_TLV_ID_SESSION_FLAGS		= 25,
14479 	WL_PROXD_TLV_ID_SESSION_FLAGS_MASK	= 26,	/**< in only */
14480 	WL_PROXD_TLV_ID_RX_MAX_BURST		= 27,	/**< uint16 - limit bursts per session */
14481 	WL_PROXD_TLV_ID_RANGING_INFO		= 28,	/**< ranging info */
14482 	WL_PROXD_TLV_ID_RANGING_FLAGS		= 29,	/**< uint16 */
14483 	WL_PROXD_TLV_ID_RANGING_FLAGS_MASK	= 30,	/**< uint16, in only */
14484 	WL_PROXD_TLV_ID_NAN_MAP_ID		= 31,
14485 	WL_PROXD_TLV_ID_DEV_ADDR		= 32,
14486 	WL_PROXD_TLV_ID_AVAIL			= 33,	/**< wl_proxd_avail_t  */
14487 	WL_PROXD_TLV_ID_TLV_ID			= 34,	/* uint16 tlv-id */
14488 	WL_PROXD_TLV_ID_FTM_REQ_RETRIES		= 35,	/* uint16 FTM request retries */
14489 	WL_PROXD_TLV_ID_TPK			= 36,	/* 32byte TPK  */
14490 	WL_PROXD_TLV_ID_RI_RR			= 36,	/* RI_RR */
14491 	WL_PROXD_TLV_ID_TUNE			= 37,	/* wl_proxd_pararms_tof_tune_t */
14492 	WL_PROXD_TLV_ID_CUR_ETHER_ADDR		= 38,	/* Source Address used for Tx */
14493 
14494 	/* output - 512 + x */
14495 	WL_PROXD_TLV_ID_STATUS			= 512,
14496 	WL_PROXD_TLV_ID_COUNTERS		= 513,
14497 	WL_PROXD_TLV_ID_INFO			= 514,
14498 	WL_PROXD_TLV_ID_RTT_RESULT		= 515,
14499 	WL_PROXD_TLV_ID_AOA_RESULT		= 516,
14500 	WL_PROXD_TLV_ID_SESSION_INFO		= 517,
14501 	WL_PROXD_TLV_ID_SESSION_STATUS		= 518,
14502 	WL_PROXD_TLV_ID_SESSION_ID_LIST		= 519,
14503 	WL_PROXD_TLV_ID_RTT_RESULT_V2		= 520,
14504 
14505 	/* debug tlvs can be added starting 1024 */
14506 	WL_PROXD_TLV_ID_DEBUG_MASK		= 1024,
14507 	WL_PROXD_TLV_ID_COLLECT			= 1025,	/**< output only */
14508 	WL_PROXD_TLV_ID_STRBUF			= 1026,
14509 
14510 	WL_PROXD_TLV_ID_COLLECT_HEADER		= 1025,	/* wl_proxd_collect_header_t */
14511 	WL_PROXD_TLV_ID_COLLECT_INFO		= 1028,	/* wl_proxd_collect_info_t */
14512 	WL_PROXD_TLV_ID_COLLECT_DATA		= 1029,	/* wl_proxd_collect_data_t */
14513 	WL_PROXD_TLV_ID_COLLECT_CHAN_DATA	= 1030,	/* wl_proxd_collect_data_t */
14514 	WL_PROXD_TLV_ID_MF_STATS_DATA		= 1031,	/* mf_stats_buffer */
14515 
14516 	WL_PROXD_TLV_ID_MAX
14517 };
14518 
14519 typedef struct wl_proxd_tlv {
14520 	uint16 id;
14521 	uint16 len;
14522 	uint8  data[1];
14523 } wl_proxd_tlv_t;
14524 
14525 /** proxd iovar - applies to proxd, method or session */
14526 typedef struct wl_proxd_iov {
14527 	uint16                  version;
14528 	uint16                  len;
14529 	wl_proxd_cmd_t          cmd;
14530 	wl_proxd_method_t       method;
14531 	wl_proxd_session_id_t   sid;
14532 	uint8                   PAD[2];
14533 	wl_proxd_tlv_t          tlvs[1];	/**< variable */
14534 } wl_proxd_iov_t;
14535 
14536 #define WL_PROXD_IOV_HDR_SIZE OFFSETOF(wl_proxd_iov_t, tlvs)
14537 
14538 /* The following event definitions may move to bcmevent.h, but sharing proxd types
14539  * across needs more invasive changes unrelated to proxd
14540  */
14541 enum {
14542 	WL_PROXD_EVENT_NONE			= 0,	/**< not an event, reserved */
14543 	WL_PROXD_EVENT_SESSION_CREATE		= 1,
14544 	WL_PROXD_EVENT_SESSION_START		= 2,
14545 	WL_PROXD_EVENT_FTM_REQ			= 3,
14546 	WL_PROXD_EVENT_BURST_START		= 4,
14547 	WL_PROXD_EVENT_BURST_END		= 5,
14548 	WL_PROXD_EVENT_SESSION_END		= 6,
14549 	WL_PROXD_EVENT_SESSION_RESTART		= 7,
14550 	WL_PROXD_EVENT_BURST_RESCHED		= 8,	/**< burst rescheduled-e.g. partial TSF */
14551 	WL_PROXD_EVENT_SESSION_DESTROY		= 9,
14552 	WL_PROXD_EVENT_RANGE_REQ		= 10,
14553 	WL_PROXD_EVENT_FTM_FRAME		= 11,
14554 	WL_PROXD_EVENT_DELAY			= 12,
14555 	WL_PROXD_EVENT_VS_INITIATOR_RPT		= 13,	/**< (target) rx initiator-report */
14556 	WL_PROXD_EVENT_RANGING			= 14,
14557 	WL_PROXD_EVENT_LCI_MEAS_REP		= 15,	/* LCI measurement report */
14558 	WL_PROXD_EVENT_CIVIC_MEAS_REP		= 16,	/* civic measurement report */
14559 	WL_PROXD_EVENT_COLLECT			= 17,
14560 	WL_PROXD_EVENT_START_WAIT		= 18,	/* waiting to start */
14561 	WL_PROXD_EVENT_MF_STATS			= 19,	/* mf stats event */
14562 
14563 	WL_PROXD_EVENT_MAX
14564 };
14565 typedef int16 wl_proxd_event_type_t;
14566 
14567 /** proxd event mask - upto 32 events for now */
14568 typedef uint32 wl_proxd_event_mask_t;
14569 
14570 #define WL_PROXD_EVENT_MASK_ALL 0xfffffffe
14571 #define WL_PROXD_EVENT_MASK_EVENT(_event_type) (1 << (_event_type))
14572 #define WL_PROXD_EVENT_ENABLED(_mask, _event_type) (\
14573 	((_mask) & WL_PROXD_EVENT_MASK_EVENT(_event_type)) != 0)
14574 
14575 /** proxd event - applies to proxd, method or session */
14576 typedef struct wl_proxd_event {
14577 	uint16			version;
14578 	uint16			len;
14579 	wl_proxd_event_type_t	type;
14580 	wl_proxd_method_t	method;
14581 	wl_proxd_session_id_t	sid;
14582 	uint8			pad[2];
14583 	wl_proxd_tlv_t		tlvs[1];	/**< variable */
14584 } wl_proxd_event_t;
14585 
14586 enum {
14587 	WL_PROXD_RANGING_STATE_NONE = 0,
14588 	WL_PROXD_RANGING_STATE_NOTSTARTED = 1,
14589 	WL_PROXD_RANGING_STATE_INPROGRESS = 2,
14590 	WL_PROXD_RANGING_STATE_DONE = 3
14591 };
14592 typedef int16 wl_proxd_ranging_state_t;
14593 
14594 /** proxd ranging flags */
14595 enum {
14596 	WL_PROXD_RANGING_FLAG_NONE = 0x0000,  /**< no flags */
14597 	WL_PROXD_RANGING_FLAG_DEL_SESSIONS_ON_STOP = 0x0001,
14598 	WL_PROXD_RANGING_FLAG_ALL = 0xffff
14599 };
14600 typedef uint16 wl_proxd_ranging_flags_t;
14601 
14602 struct wl_proxd_ranging_info {
14603 	wl_proxd_status_t   status;
14604 	wl_proxd_ranging_state_t state;
14605 	wl_proxd_ranging_flags_t flags;
14606 	uint16	num_sids;
14607 	uint16	num_done;
14608 };
14609 typedef struct wl_proxd_ranging_info wl_proxd_ranging_info_t;
14610 
14611 #include <packed_section_start.h>
14612 /* Legacy platform i.e. 43342/43430 */
14613 #define WL_PROXD_COLLECT_EVENT_DATA_VERSION_1		1
14614 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_event_data_v1 {
14615 	uint32                  H_LB[K_TOF_COLLECT_H_SIZE_20MHZ];
14616 	uint32                  H_RX[K_TOF_COLLECT_H_SIZE_20MHZ];
14617 	uint8                   ri_rr[FTM_TPK_LEN];
14618 	wl_proxd_phy_error_t    phy_err_mask;
14619 } BWL_POST_PACKED_STRUCT wl_proxd_collect_event_data_v1_t;
14620 
14621 /* Secured 2.0 supoorted devices i.e. 4364 */
14622 #define WL_PROXD_COLLECT_EVENT_DATA_VERSION_2		2
14623 typedef BWL_PRE_PACKED_STRUCT struct wl_proxd_collect_event_data_v2 {
14624 	uint32                  H_LB[K_TOF_COLLECT_H_SIZE_20MHZ];
14625 	uint32                  H_RX[K_TOF_COLLECT_H_SIZE_20MHZ];
14626 	uint8                   ri_rr[FTM_TPK_RI_RR_LEN_SECURE_2_0];
14627 	wl_proxd_phy_error_t    phy_err_mask;
14628 } BWL_POST_PACKED_STRUCT wl_proxd_collect_event_data_v2_t;
14629 #include <packed_section_end.h>
14630 
14631 #define WL_PROXD_COLLECT_EVENT_DATA_VERSION_3		3
14632 typedef struct wl_proxd_collect_event_data_v3 {
14633 	uint16			version;
14634 	uint16			length;
14635 	uint32                  H_LB[K_TOF_COLLECT_H_SIZE_20MHZ];
14636 	uint32                  H_RX[K_TOF_COLLECT_H_SIZE_20MHZ];
14637 	uint8                   ri_rr[FTM_TPK_RI_RR_LEN_SECURE_2_0];
14638 	wl_proxd_phy_error_t    phy_err_mask;
14639 } wl_proxd_collect_event_data_v3_t;
14640 
14641 #define WL_PROXD_COLLECT_EVENT_DATA_VERSION_MAX	WL_PROXD_COLLECT_EVENT_DATA_VERSION_3
14642 
14643 /** Data returned by the bssload_report iovar. This is also the WLC_E_BSS_LOAD event data */
14644 #include <packed_section_start.h>
14645 typedef BWL_PRE_PACKED_STRUCT struct wl_bssload {
14646 	uint16 sta_count;		/**< station count */
14647 	uint16 aac;			/**< available admission capacity */
14648 	uint8 chan_util;		/**< channel utilization */
14649 } BWL_POST_PACKED_STRUCT wl_bssload_t;
14650 #include <packed_section_end.h>
14651 
14652 /**
14653  * Maximum number of configurable BSS Load levels.  The number of BSS Load
14654  * ranges is always 1 more than the number of configured levels.  eg. if
14655  * 3 levels of 10, 20, 30 are configured then this defines 4 load ranges:
14656  * 0-10, 11-20, 21-30, 31-255.  A WLC_E_BSS_LOAD event is generated each time
14657  * the utilization level crosses into another range, subject to the rate limit.
14658  */
14659 #define MAX_BSSLOAD_LEVELS 8
14660 #define MAX_BSSLOAD_RANGES (MAX_BSSLOAD_LEVELS + 1)
14661 
14662 /** BSS Load event notification configuration. */
14663 typedef struct wl_bssload_cfg {
14664 	uint32 rate_limit_msec;	/**< # of events posted to application will be limited to
14665 				 * one per specified period (0 to disable rate limit).
14666 				 */
14667 	uint8 num_util_levels;	/**< Number of entries in util_levels[] below */
14668 	uint8 util_levels[MAX_BSSLOAD_LEVELS];
14669 				/**< Variable number of BSS Load utilization levels in
14670 				 * low to high order.  An event will be posted each time
14671 				 * a received beacon's BSS Load IE channel utilization
14672 				 * value crosses a level.
14673 				 */
14674 	uint8 PAD[3];
14675 } wl_bssload_cfg_t;
14676 
14677 /** Multiple roaming profile suport */
14678 #define WL_MAX_ROAM_PROF_BRACKETS	4
14679 
14680 #define WL_ROAM_PROF_VER_0	0
14681 #define WL_ROAM_PROF_VER_1	1
14682 #define WL_ROAM_PROF_VER_2	2
14683 #define WL_MAX_ROAM_PROF_VER	WL_ROAM_PROF_VER_1
14684 
14685 #define WL_ROAM_PROF_NONE	(0 << 0)
14686 #define WL_ROAM_PROF_LAZY	(1 << 0)
14687 #define WL_ROAM_PROF_NO_CI	(1 << 1)
14688 #define WL_ROAM_PROF_SUSPEND	(1 << 2)
14689 #define WL_ROAM_PROF_SYNC_DTIM	(1 << 6)
14690 #define WL_ROAM_PROF_DEFAULT	(1 << 7)	/**< backward compatible single default profile */
14691 
14692 #define WL_FACTOR_TABLE_MAX_LIMIT 5
14693 
14694 #define WL_CU_2G_ROAM_TRIGGER (-60)
14695 #define WL_CU_5G_ROAM_TRIGGER (-70)
14696 
14697 #define WL_CU_SCORE_DELTA_DEFAULT 20
14698 
14699 #define WL_MAX_CHANNEL_USAGE 0x0FF
14700 #define WL_CU_PERCENTAGE_DISABLE 0
14701 #define WL_CU_PERCENTAGE_DEFAULT 70
14702 #define WL_CU_PERCENTAGE_MAX 100
14703 #define WL_CU_CALC_DURATION_DEFAULT 10 /* seconds */
14704 #define WL_CU_CALC_DURATION_MAX 60 /* seconds */
14705 
14706 #define WL_ESTM_LOW_TRIGGER_DISABLE 0
14707 #define WL_ESTM_LOW_TRIGGER_DEFAULT 5 /* Mbps */
14708 #define WL_ESTM_LOW_TRIGGER_MAX 250  /* Mbps */
14709 #define WL_ESTM_ROAM_DELTA_DEFAULT 10
14710 
14711 typedef struct wl_roam_prof_v3 {
14712 	uint8	roam_flags;		/**< bit flags */
14713 	int8	roam_trigger;		/**< RSSI trigger level per profile/RSSI bracket */
14714 	int8	rssi_lower;
14715 	int8	roam_delta;
14716 
14717 	/* if channel_usage if zero, roam_delta is rssi delta required for new AP */
14718 	/* if channel_usage if non-zero, roam_delta is score delta(%) required for new AP */
14719 	int8	rssi_boost_thresh;	/**< Min RSSI to qualify for RSSI boost */
14720 	int8	rssi_boost_delta;	/**< RSSI boost for AP in the other band */
14721 	uint16	nfscan;			/**< number of full scan to start with */
14722 	uint16	fullscan_period;
14723 	uint16	init_scan_period;
14724 	uint16	backoff_multiplier;
14725 	uint16	max_scan_period;
14726 	uint8	channel_usage;
14727 	uint8	cu_avg_calc_dur;
14728 	uint16	estm_low_trigger; /**< ESTM low throughput roam trigger */
14729 	int8	estm_roam_delta; /**< ESTM low throughput roam delta */
14730 	uint8 pad;
14731 } wl_roam_prof_v3_t;
14732 
14733 typedef struct wl_roam_prof_v2 {
14734 	int8	roam_flags;		/**< bit flags */
14735 	int8	roam_trigger;		/**< RSSI trigger level per profile/RSSI bracket */
14736 	int8	rssi_lower;
14737 	int8	roam_delta;
14738 
14739 	/* if channel_usage if zero, roam_delta is rssi delta required for new AP */
14740 	/* if channel_usage if non-zero, roam_delta is score delta(%) required for new AP */
14741 	int8	rssi_boost_thresh;	/**< Min RSSI to qualify for RSSI boost */
14742 	int8	rssi_boost_delta;	/**< RSSI boost for AP in the other band */
14743 	uint16	nfscan;			/**< number of full scan to start with */
14744 	uint16	fullscan_period;
14745 	uint16	init_scan_period;
14746 	uint16	backoff_multiplier;
14747 	uint16	max_scan_period;
14748 	uint8	channel_usage;
14749 	uint8	cu_avg_calc_dur;
14750 	uint8	pad[2];
14751 } wl_roam_prof_v2_t;
14752 
14753 typedef struct wl_roam_prof_v1 {
14754 	int8	roam_flags;		/**< bit flags */
14755 	int8	roam_trigger;		/**< RSSI trigger level per profile/RSSI bracket */
14756 	int8	rssi_lower;
14757 	int8	roam_delta;
14758 
14759 	/* if channel_usage if zero, roam_delta is rssi delta required for new AP */
14760 	/* if channel_usage if non-zero, roam_delta is score delta(%) required for new AP */
14761 	int8	rssi_boost_thresh;	/**< Min RSSI to qualify for RSSI boost */
14762 	int8	rssi_boost_delta;	/**< RSSI boost for AP in the other band */
14763 	uint16	nfscan;			/**< number of full scan to start with */
14764 	uint16	fullscan_period;
14765 	uint16	init_scan_period;
14766 	uint16	backoff_multiplier;
14767 	uint16	max_scan_period;
14768 } wl_roam_prof_v1_t;
14769 
14770 typedef struct wl_roam_prof_band_v3 {
14771 	uint32	band;			/**< Must be just one band */
14772 	uint16	ver;			/**< version of this struct */
14773 	uint16	len;			/**< length in bytes of this structure */
14774 	wl_roam_prof_v3_t roam_prof[WL_MAX_ROAM_PROF_BRACKETS];
14775 } wl_roam_prof_band_v3_t;
14776 
14777 typedef struct wl_roam_prof_band_v2 {
14778 	uint32	band;			/**< Must be just one band */
14779 	uint16	ver;			/**< version of this struct */
14780 	uint16	len;			/**< length in bytes of this structure */
14781 	wl_roam_prof_v2_t roam_prof[WL_MAX_ROAM_PROF_BRACKETS];
14782 } wl_roam_prof_band_v2_t;
14783 
14784 typedef struct wl_roam_prof_band_v1 {
14785 	uint32	band;			/**< Must be just one band */
14786 	uint16	ver;			/**< version of this struct */
14787 	uint16	len;			/**< length in bytes of this structure */
14788 	wl_roam_prof_v1_t roam_prof[WL_MAX_ROAM_PROF_BRACKETS];
14789 } wl_roam_prof_band_v1_t;
14790 
14791 #define BSS_MAXTABLE_SIZE 10
14792 #define WNM_BSS_SELECT_FACTOR_VERSION   1
14793 typedef struct wnm_bss_select_factor_params {
14794 	uint8 low;
14795 	uint8 high;
14796 	uint8 factor;
14797 	uint8 pad;
14798 } wnm_bss_select_factor_params_t;
14799 
14800 #define WNM_BSS_SELECT_FIXED_SIZE OFFSETOF(wnm_bss_select_factor_cfg_t, params)
14801 typedef struct wnm_bss_select_factor_cfg {
14802 	uint8 version;
14803 	uint8 band;
14804 	uint16 type;
14805 	uint16 pad;
14806 	uint16 count;
14807 	wnm_bss_select_factor_params_t params[1];
14808 } wnm_bss_select_factor_cfg_t;
14809 
14810 #define WNM_BSS_SELECT_WEIGHT_VERSION   1
14811 typedef struct wnm_bss_select_weight_cfg {
14812 	uint8 version;
14813 	uint8 band;
14814 	uint16 type;
14815 	uint16 weight; /* weightage for each type between 0 to 100 */
14816 } wnm_bss_select_weight_cfg_t;
14817 
14818 /* For branches before koala .. wbtext is part
14819  * of wnm need to use below type only
14820  */
14821 typedef struct wnm_btm_default_score_cfg {
14822 	uint32 default_score; /* default score */
14823 	uint8 band;
14824 } wnm_btm_default_score_cfg_t;
14825 
14826 /* For branches from koala and above .. wbtext is
14827  * seperate module..need to use below type only
14828  */
14829 typedef struct wbtext_btm_default_score_cfg {
14830 	uint32 default_score; /* default score */
14831 	uint8 band;
14832 } wbtext_btm_default_score_cfg_t;
14833 
14834 #define WNM_BSS_SELECT_TYPE_RSSI   0
14835 #define WNM_BSS_SELECT_TYPE_CU   1
14836 #define WNM_BSS_SELECT_TYPE_ESTM_DL   2
14837 
14838 #define WNM_BSSLOAD_MONITOR_VERSION   1
14839 typedef struct wnm_bssload_monitor_cfg {
14840 	uint8 version;
14841 	uint8 band;
14842 	uint8 duration; /* duration between 1 to 20sec */
14843 } wnm_bssload_monitor_cfg_t;
14844 
14845 #define WNM_ROAM_TRIGGER_VERSION   1
14846 typedef struct wnm_roam_trigger_cfg {
14847 	uint8 version;
14848 	uint8 band;
14849 	uint16 type;
14850 	int16 trigger; /* trigger for each type in new roam algorithm */
14851 } wnm_roam_trigger_cfg_t;
14852 
14853 /* Data structures for Interface Create/Remove  */
14854 
14855 #define WL_INTERFACE_CREATE_VER_1	1
14856 #define WL_INTERFACE_CREATE_VER_2	2
14857 #define WL_INTERFACE_CREATE_VER_3	3
14858 
14859 /*
14860  * The flags filed of the wl_interface_create is designed to be
14861  * a Bit Mask. As of now only Bit 0 and Bit 1 are used as mentioned below.
14862  * The rest of the bits can be used, incase we have to provide
14863  * more information to the dongle
14864  */
14865 
14866 /*
14867  * Bit 0 of flags field is used to inform whether the interface requested to
14868  * be created is STA or AP.
14869  * 0 - Create a STA interface
14870  * 1 - Create an AP interface
14871  * NOTE: This Bit 0 is applicable for the WL_INTERFACE_CREATE_VER < 2
14872  */
14873 #define WL_INTERFACE_CREATE_STA	(0 << 0)
14874 #define WL_INTERFACE_CREATE_AP	(1 << 0)
14875 
14876 /*
14877  * From revision >= 2 Bit 0 of flags field will not used be for STA or AP interface creation.
14878  * "iftype" field shall be used for identifying the interface type.
14879  */
14880 typedef enum wl_interface_type {
14881 	WL_INTERFACE_TYPE_STA = 0,
14882 	WL_INTERFACE_TYPE_AP = 1,
14883 	WL_INTERFACE_TYPE_AWDL = 2,
14884 	WL_INTERFACE_TYPE_NAN = 3,
14885 	WL_INTERFACE_TYPE_P2P_GO = 4,
14886 	WL_INTERFACE_TYPE_P2P_GC = 5,
14887 	WL_INTERFACE_TYPE_P2P_DISC = 6,
14888 	WL_INTERFACE_TYPE_IBSS = 7,
14889 	WL_INTERFACE_TYPE_MAX
14890 } wl_interface_type_t;
14891 
14892 /*
14893  * Bit 1 of flags field is used to inform whether MAC is present in the
14894  * data structure or not.
14895  * 0 - Ignore mac_addr field
14896  * 1 - Use the mac_addr field
14897  */
14898 #define WL_INTERFACE_MAC_DONT_USE	(0 << 1)
14899 #define WL_INTERFACE_MAC_USE		(1 << 1)
14900 
14901 /*
14902  * Bit 2 of flags field is used to inform whether core or wlc index
14903  * is present in the data structure or not.
14904  * 0 - Ignore wlc_index field
14905  * 1 - Use the wlc_index field
14906  */
14907 #define WL_INTERFACE_WLC_INDEX_DONT_USE	(0 << 2)
14908 #define WL_INTERFACE_WLC_INDEX_USE	(1 << 2)
14909 
14910 /*
14911  * Bit 3 of flags field is used to create interface on the host requested interface index
14912  * 0 - Ignore if_index field
14913  * 1 - Use the if_index field
14914  */
14915 #define WL_INTERFACE_IF_INDEX_USE       (1 << 3)
14916 
14917 /*
14918  * Bit 4 of flags field is used to assign BSSID
14919  * 0 - Ignore bssid field
14920  * 1 - Use the bssid field
14921  */
14922 #define WL_INTERFACE_BSSID_INDEX_USE	(1 << 4)
14923 
14924 typedef struct wl_interface_create {
14925 	uint16  ver;                    /**< version of this struct */
14926 	uint8   pad1[2];                /**< Padding bytes */
14927 	uint32  flags;                  /**< flags that defines the operation */
14928 	struct  ether_addr   mac_addr;  /**< Optional Mac address */
14929 	uint8   pad2[2];                /**< Padding bytes */
14930 	uint32  wlc_index;              /**< Optional wlc index */
14931 } wl_interface_create_v1_t;
14932 
14933 typedef struct wl_interface_create_v2 {
14934 	uint16  ver;                    /**< version of this struct */
14935 	uint8   pad1[2];                /**< Padding bytes */
14936 	uint32  flags;                  /**< flags that defines the operation */
14937 	struct  ether_addr   mac_addr;  /**< Optional Mac address */
14938 	uint8   iftype;                 /**< Type of interface created */
14939 	uint8   pad2;                   /**< Padding bytes */
14940 	uint32  wlc_index;              /**< Optional wlc index */
14941 } wl_interface_create_v2_t;
14942 
14943 typedef struct wl_interface_create_v3 {
14944 	uint16	ver;			/**< version of this struct */
14945 	uint16	len;			/**< length of whole structure including variable length */
14946 	uint16	fixed_len;		/**< Fixed length of this structure excluding data[] */
14947 	uint8	iftype;			/**< Type of interface created */
14948 	uint8	wlc_index;		/**< Optional wlc index */
14949 	uint32  flags;			/**< flags that defines the operation */
14950 	struct	ether_addr   mac_addr;	/**< Optional Mac address */
14951 	struct	ether_addr   bssid;	/**< Optional BSSID */
14952 	uint8	if_index;		/**< interface index requested by Host */
14953 	uint8	pad[3];			/**< Padding bytes to ensure data[] is at 32 bit aligned */
14954 	uint8	data[];			/**< Optional application/Module specific data */
14955 } wl_interface_create_v3_t;
14956 
14957 #define WL_INTERFACE_INFO_VER_1		1
14958 #define WL_INTERFACE_INFO_VER_2		2
14959 
14960 typedef struct wl_interface_info_v1 {
14961 	uint16  ver;                    /**< version of this struct */
14962 	struct ether_addr    mac_addr;  /**< MAC address of the interface */
14963 	char    ifname[BCM_MSG_IFNAME_MAX]; /**< name of interface */
14964 	uint8   bsscfgidx;              /**< source bsscfg index */
14965 	uint8	PAD;
14966 } wl_interface_info_v1_t;
14967 
14968 typedef struct wl_interface_info_v2 {
14969 	uint16                  ver;                    /**< version of this struct */
14970 	uint16                  length;                 /**< length of the whole structure */
14971 	struct  ether_addr      mac_addr;               /**< MAC address of the interface */
14972 	uint8                   bsscfgidx;              /**< source bsscfg index */
14973 	uint8                   if_index;               /**< Interface index allocated by FW */
14974 	char                    ifname[BCM_MSG_IFNAME_MAX]; /**< name of interface */
14975 } wl_interface_info_v2_t;
14976 
14977 #define PHY_RXIQEST_AVERAGING_DELAY 10
14978 
14979 typedef struct wl_iqest_params {
14980 	uint32 rxiq;
14981 	uint8 niter;
14982 	uint8 delay;
14983 	uint8 PAD[2];
14984 } wl_iqest_params_t;
14985 
14986 typedef struct wl_iqest_sweep_params {
14987 	wl_iqest_params_t params;
14988 	uint8 nchannels;
14989 	uint8 channel[3];	/** variable */
14990 } wl_iqest_sweep_params_t;
14991 
14992 typedef struct wl_iqest_value {
14993 	uint8 channel;
14994 	uint8 PAD[3];
14995 	uint32 rxiq;
14996 } wl_iqest_value_t;
14997 
14998 typedef struct wl_iqest_result {
14999 	uint8 nvalues;
15000 	uint8 PAD[3];
15001 	wl_iqest_value_t value[1];
15002 } wl_iqest_result_t;
15003 
15004 #define WL_PRIO_ROAM_PROF_V1 (1u)
15005 
15006 typedef struct wl_prio_roam_prof_v1 {
15007 	uint16 version; /* Version info */
15008 	uint16 length; /* byte length of this structure */
15009 	uint8 prio_roam_mode; /* Roam mode RCC/RCC+Full Scan */
15010 	uint8 PAD[3];
15011 } wl_prio_roam_prof_v1_t;
15012 
15013 typedef enum wl_prio_roam_mode {
15014 	PRIO_ROAM_MODE_OFF = 0, /* Prio_Roam feature disable */
15015 	PRIO_ROAM_MODE_RCC_ONLY = 1, /* Scan RCC list only */
15016 	PRIO_ROAM_MODE_RCC_FULLSCAN = 2, /* Scan RCC list + Full scan */
15017 	PRIO_ROAM_MODE_FULLSCAN_ONLY = 3 /* Full Scan only */
15018 } wl_prio_roam_mode_t;
15019 
15020 /* BTCX AIBSS (Oxygen) Status */
15021 /* MC2 strobing status */
15022 typedef struct wlc_btc_aibss_info {
15023 	uint32	prev_tsf_l;		// Lower 32 bits of last read of TSF
15024 	uint32	prev_tsf_h;		// Higher 32 bits of last read of TSF
15025 	uint32	last_btinfo;		// Last read of BT info
15026 	uint32	local_btinfo;		// Local BT INFO BitMap
15027 	uint8	bt_out_of_sync_cnt;	// BT not in sync with strobe
15028 	uint8	esco_off_cnt;		// Count incremented when ESCO is off
15029 	uint8	strobe_enabled;		// Set only in AIBSS mode
15030 	uint8	strobe_on;		// strobe to BT is on for Oxygen
15031 	uint8	local_bt_in_sync;	// Sync status of local BT when strobe is on
15032 	uint8	other_bt_in_sync;	// Sync state of BT in other devices in AIBSS
15033 	uint8	local_bt_is_master;	// Local BT is master
15034 	uint8	sco_prot_on;		// eSCO Protection on in local device
15035 	uint8	other_esco_present;	// eSCO status in other devices in AIBSS
15036 	uint8	rx_agg_change;		// Indicates Rx Agg size needs to change
15037 	uint8	rx_agg_modified;	// Rx Agg size modified
15038 	uint8	acl_grant_set;		// ACL grants on for speeding up sync
15039 	uint8	write_ie_err_cnt;	// BTCX Ie write error cnt
15040 	uint8	parse_ie_err_cnt;	// BTCX IE parse error cnt
15041 	uint8	wci2_fail_cnt;		// WCI2 init failure cnt
15042 	uint8	strobe_enable_err_cnt;	// Strobe enable err cnt
15043 	uint8	strobe_init_err_cnt;	// Strobe init err cnt
15044 	uint8	tsf_jump_cnt;		// TSF jump cnt
15045 	uint8	acl_grant_cnt;		// ALC grant cnt
15046 	uint8	pad1;
15047 	uint16	ibss_tsf_shm;		// SHM address of strobe TSF
15048 	uint16	strobe_interval;	/**< interval of the strobe */
15049 	uint32	strobe_missed_cnt;	/**< missed strobe counter */
15050 } wlc_btc_aibss_info_t;
15051 
15052 #define WLC_BTC_AIBSS_STATUS_VER	1
15053 #define WLC_BTC_AIBSS_STATUS_LEN	(sizeof(wlc_btc_aibss_status_t) - 2 * (sizeof(uint16)))
15054 
15055 typedef struct wlc_btc_aibss_status {
15056 	uint16	version;		// Version #
15057 	uint16	len;			// Length of the structure(excluding len & version)
15058 	int32	mode;			// Current value of btc_mode
15059 	uint16	bth_period;             // bt coex period. read from shm.
15060 	uint16	agg_off_bm;		// AGG OFF BM read from SHM
15061 	uint8	bth_active;             // bt active session
15062 	uint8	pad[3];
15063 	wlc_btc_aibss_info_t aibss_info;	// Structure definition above
15064 } wlc_btc_aibss_status_t;
15065 
15066 typedef enum {
15067 	STATE_NONE = 0,
15068 
15069 	/* WLAN -> BT */
15070 	W2B_DATA_SET = 21,
15071 	B2W_ACK_SET = 22,
15072 	W2B_DATA_CLEAR = 23,
15073 	B2W_ACK_CLEAR = 24,
15074 
15075 	/* BT -> WLAN */
15076 	B2W_DATA_SET = 31,
15077 	W2B_ACK_SET = 32,
15078 	B2W_DATA_CLEAR = 33,
15079 	W2B_ACK_CLEAR = 34
15080 } bwte_gci_intstate_t;
15081 
15082 #define WL_BWTE_STATS_VERSION 1 /* version of bwte_stats_t */
15083 typedef struct {
15084 	uint32 version;
15085 
15086 	bwte_gci_intstate_t inttobt;
15087 	bwte_gci_intstate_t intfrombt;
15088 
15089 	uint32 bt2wl_intrcnt; /* bt->wlan interrrupt count */
15090 	uint32 wl2bt_intrcnt; /* wlan->bt interrupt count  */
15091 
15092 	uint32 wl2bt_dset_cnt;
15093 	uint32 wl2bt_dclear_cnt;
15094 	uint32 wl2bt_aset_cnt;
15095 	uint32 wl2bt_aclear_cnt;
15096 
15097 	uint32 bt2wl_dset_cnt;
15098 	uint32 bt2wl_dclear_cnt;
15099 	uint32 bt2wl_aset_cnt;
15100 	uint32 bt2wl_aclear_cnt;
15101 
15102 	uint32 state_error_1;
15103 	uint32 state_error_2;
15104 	uint32 state_error_3;
15105 	uint32 state_error_4;
15106 } bwte_stats_t;
15107 
15108 #define TBOW_MAX_SSID_LEN        32
15109 #define TBOW_MAX_PASSPHRASE_LEN  63
15110 
15111 #define WL_TBOW_SETUPINFO_T_VERSION 1 /* version of tbow_setup_netinfo_t */
15112 typedef struct tbow_setup_netinfo {
15113 	uint32 version;
15114 	uint8 opmode;
15115 	uint8 pad;
15116 	uint8 macaddr[ETHER_ADDR_LEN];
15117 	uint32 ssid_len;
15118 	uint8 ssid[TBOW_MAX_SSID_LEN];
15119 	uint8 passphrase_len;
15120 	uint8 passphrase[TBOW_MAX_PASSPHRASE_LEN];
15121 	chanspec_t chanspec;
15122 	uint8 PAD[2];
15123 	uint32 channel;
15124 } tbow_setup_netinfo_t;
15125 
15126 typedef enum tbow_ho_opmode {
15127 	TBOW_HO_MODE_START_GO = 0,
15128 	TBOW_HO_MODE_START_STA,
15129 	TBOW_HO_MODE_START_GC,
15130 	TBOW_HO_MODE_TEST_GO,
15131 	TBOW_HO_MODE_STOP_GO = 0x10,
15132 	TBOW_HO_MODE_STOP_STA,
15133 	TBOW_HO_MODE_STOP_GC,
15134 	TBOW_HO_MODE_TEARDOWN
15135 } tbow_ho_opmode_t;
15136 
15137 /* Beacon trim feature statistics */
15138 /* configuration */
15139 #define BCNTRIMST_PER			0	/* Number of beacons to trim (0: disable) */
15140 #define BCNTRIMST_TIMEND		1	/* Number of bytes till TIM IE */
15141 #define BCNTRIMST_TSFLMT		2	/* TSF tolerance value (usecs) */
15142 /* internal use */
15143 #define BCNTRIMST_CUR			3	/* PSM's local beacon trim counter */
15144 #define BCNTRIMST_PREVLEN		4	/* Beacon length excluding the TIM IE */
15145 #define BCNTRIMST_TIMLEN		5	/* TIM IE Length */
15146 #define BCNTRIMST_RSSI			6	/* Partial beacon RSSI */
15147 #define BCNTRIMST_CHAN			7	/* Partial beacon channel */
15148 /* debug stat (off by default) */
15149 #define BCNTRIMST_DUR			8	/* RX duration until beacon trimmed */
15150 #define BCNTRIMST_RXMBSS		9	/* MYBSSID beacon received */
15151 #define BCNTRIMST_CANTRIM		10	/* # beacons which were trimmed */
15152 #define BCNTRIMST_LENCHG		11	/* # beacons not trimmed due to length change */
15153 #define BCNTRIMST_TSFDRF		12	/* # beacons not trimmed due to large TSF delta */
15154 #define BCNTRIMST_NOTIM			13	/* # beacons not trimmed due to TIM missing */
15155 
15156 #define BCNTRIMST_NUM			14
15157 
15158 #define WL_BCNTRIM_STATUS_VERSION_1 1
15159 typedef struct wl_bcntrim_status_query_v1 {
15160 	uint16  version;
15161 	uint16  len;     /* Total length includes fixed fields */
15162 	uint8   reset;   /* reset after reading the stats */
15163 	uint8   pad[3];  /* 4-byte alignment */
15164 } wl_bcntrim_status_query_v1_t;
15165 
15166 typedef struct wl_bcntrim_status_v1 {
15167 	uint16  version;
15168 	uint16  len;            /* Total length includes fixed fields and variable data[] */
15169 	uint8   curr_slice_id;  /* slice index of the interface */
15170 	uint8   applied_cfg;    /* applied bcntrim N threshold */
15171 	uint8   pad[2];         /* 4-byte alignment */
15172 	uint32  fw_status;      /* Bits representing bcntrim disable reason in FW */
15173 	uint32  total_disable_dur;    /* total duration (msec) bcntrim remains
15174 	                                 disabled due to FW disable reasons
15175 	                               */
15176 	uint32  data[];         /* variable length data containing stats */
15177 } wl_bcntrim_status_v1_t;
15178 
15179 #define BCNTRIM_STATS_MAX		10	/* Total stats part of the status data[] */
15180 
15181 /* Bits for FW status */
15182 #define WL_BCNTRIM_DISABLE_HOST		0x1	/* Host disabled bcntrim through bcntrim IOVar */
15183 #define WL_BCNTRIM_DISABLE_PHY_RATE	0x2	/* bcntrim disabled because beacon rx rate is
15184 		                                 * higher than phy_rate_thresh
15185 		                                 */
15186 #define WL_BCNTRIM_DISABLE_QUIET_IE	0x4	/* bcntrim disable when Quiet IE present */
15187 #define WL_BCNTRIM_DISABLE_QBSSLOAD_IE	0x8	/* bcntrim disable when QBSS Load IE present */
15188 #define WL_BCNTRIM_DISABLE_OPERMODE_IE	0x10	/* bcntrim dsiable when opermode IE is present */
15189 #define WL_BCNTRIM_DISABLE_CSA_IE	0x20	/* bcntrim dsiable when CSA IE is present */
15190 
15191 #define BCNTRIM_DISABLE_THRESHOLD_TIME  1000 * 10	/* enable bcntrim after a threshold (10sec)
15192 							 * when disabled due to above mentioned IE's
15193 							 */
15194 #define WL_BCNTRIM_CFG_VERSION_1     1
15195 /* Common IOVAR struct */
15196 typedef struct wl_bcntrim_cfg_v1 {
15197 	uint16  version;
15198 	uint16 len;          /* Total length includes fixed fields and variable data[] */
15199 	uint16 subcmd_id;    /* subcommand id */
15200 	uint16 pad;          /* pad/reserved */
15201 	uint8 data[];        /* subcommand data; could be empty */
15202 } wl_bcntrim_cfg_v1_t;
15203 
15204 /* subcommands ids */
15205 enum {
15206 	WL_BCNTRIM_CFG_SUBCMD_PHY_RATE_THRESH =       0,   /* PHY rate threshold above
15207 	                                                      which bcntrim is not applied
15208 	                                                    */
15209 	WL_BCNTRIM_CFG_SUBCMD_OVERRIDE_DISABLE_MASK = 1,   /* Override bcntrim disable reasons */
15210 	WL_BCNTRIM_CFG_SUBCMD_TSF_DRIFT_LIMIT =       2    /* TSF drift limit to consider bcntrim */
15211 };
15212 
15213 #define BCNTRIM_MAX_PHY_RATE	48     /* in 500Kbps */
15214 #define BCNTRIM_MAX_TSF_DRIFT   65535  /* in usec */
15215 #define WL_BCNTRIM_OVERRIDE_DISABLE_MASK \
15216 		(WL_BCNTRIM_DISABLE_QUIET_IE | WL_BCNTRIM_DISABLE_QBSSLOAD_IE)
15217 
15218 /* WL_BCNTRIM_CFG_SUBCMD_PHY_RATE_TRESH */
15219 typedef struct wl_bcntrim_cfg_phy_rate_thresh {
15220 	uint32 rate;      /* beacon rate (in 500kbps units)  */
15221 } wl_bcntrim_cfg_phy_rate_thresh_t;
15222 
15223 /* WL_BCNTRIM_CFG_SUBCMD_OVERRIDE_DISABLE_MASK */
15224 typedef struct wl_bcntrim_cfg_override_disable_mask {
15225 	uint32  mask;     /* bits representing individual disable reason to override */
15226 } wl_bcntrim_cfg_override_disable_mask_t;
15227 
15228 /* WL_BCNTRIM_CFG_SUBCMD_TSF_DRIFT_LIMIT */
15229 typedef struct wl_bcntrim_cfg_tsf_drift_limit {
15230 	uint16   drift;   /* tsf drift limit specified in usec */
15231 	uint8    pad[2];  /* 4-byte alignment */
15232 } wl_bcntrim_cfg_tsf_drift_limit_t;
15233 
15234 /* --------------  TX Power Cap --------------- */
15235 #define TXPWRCAP_MAX_NUM_CORES 8
15236 #define TXPWRCAP_MAX_NUM_ANTENNAS (TXPWRCAP_MAX_NUM_CORES * 2)
15237 
15238 #define TXPWRCAP_MAX_NUM_CORES_V3 4
15239 #define TXPWRCAP_MAX_NUM_ANTENNAS_V3 (TXPWRCAP_MAX_NUM_CORES_V3 * 2)
15240 
15241 #define TXPWRCAP_NUM_SUBBANDS 5
15242 #define TXPWRCAP_MAX_NUM_SUBGRPS 10
15243 
15244 /* IOVAR txcapconfig enum's */
15245 #define TXPWRCAPCONFIG_WCI2 0u
15246 #define TXPWRCAPCONFIG_HOST 1u
15247 #define TXPWRCAPCONFIG_WCI2_AND_HOST 2u
15248 #define TXPWRCAPCONFIG_NONE 0xFFu
15249 
15250 /* IOVAR txcapstate enum's */
15251 #define TXPWRCAPSTATE_LOW_CAP  0
15252 #define TXPWRCAPSTATE_HIGH_CAP 1
15253 #define TXPWRCAPSTATE_HOST_LOW_WCI2_LOW_CAP	0
15254 #define TXPWRCAPSTATE_HOST_LOW_WCI2_HIGH_CAP	1
15255 #define TXPWRCAPSTATE_HOST_HIGH_WCI2_LOW_CAP	2
15256 #define TXPWRCAPSTATE_HOST_HIGH_WCI2_HIGH_CAP	3
15257 
15258 /* IOVAR txcapconfig and txcapstate structure is shared: SET and GET */
15259 #define TXPWRCAPCTL_VERSION 2
15260 #define TXPWRCAPCTL_VERSION_3 3
15261 
15262 typedef struct wl_txpwrcap_ctl {
15263 	uint8   version;
15264 	uint8   ctl[TXPWRCAP_NUM_SUBBANDS];
15265 } wl_txpwrcap_ctl_t;
15266 
15267 typedef struct wl_txpwrcap_ctl_v3 {
15268 	uint8   version;
15269 	uint8   ctl[TXPWRCAP_MAX_NUM_SUBGRPS];
15270 } wl_txpwrcap_ctl_v3_t;
15271 
15272 /* IOVAR txcapdump structure: GET only */
15273 #define TXPWRCAP_DUMP_VERSION 2
15274 typedef struct wl_txpwrcap_dump {
15275 	uint8   version;
15276 	uint8	pad0;
15277 	uint8   current_country[2];
15278 	uint32	current_channel;
15279 	uint8   config[TXPWRCAP_NUM_SUBBANDS];
15280 	uint8   state[TXPWRCAP_NUM_SUBBANDS];
15281 	uint8	high_cap_state_enabled;
15282 	uint8	wci2_cell_status_last;
15283 	uint8   download_present;
15284 	uint8	num_subbands;
15285 	uint8	num_antennas;
15286 	uint8   num_antennas_per_core[TXPWRCAP_MAX_NUM_CORES];
15287 	uint8	num_cc_groups;
15288 	uint8   current_country_cc_group_info_index;
15289 	int8    low_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
15290 	int8    high_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
15291 	uint8	PAD[3];
15292 } wl_txpwrcap_dump_t;
15293 
15294 typedef struct wl_txpwrcap_dump_v3 {
15295 	uint8   version;
15296 	uint8	pad0;
15297 	uint8   current_country[2];
15298 	uint32	current_channel;
15299 	uint8   config[TXPWRCAP_NUM_SUBBANDS];
15300 	uint8   state[TXPWRCAP_NUM_SUBBANDS];
15301 	uint8	high_cap_state_enabled;
15302 	uint8	wci2_cell_status_last;
15303 	uint8   download_present;
15304 	uint8	num_subbands;
15305 	uint8	num_antennas;
15306 	uint8   num_antennas_per_core[TXPWRCAP_MAX_NUM_CORES];
15307 	uint8	num_cc_groups;
15308 	uint8   current_country_cc_group_info_index;
15309 	uint8	cap_states_per_cc_group;
15310 	int8    host_low_wci2_low_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
15311 	int8    host_low_wci2_high_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
15312 	int8    host_high_wci2_low_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
15313 	int8    host_high_wci2_high_cap[TXPWRCAP_MAX_NUM_ANTENNAS*TXPWRCAP_NUM_SUBBANDS];
15314 	uint8	PAD[2];
15315 } wl_txpwrcap_dump_v3_t;
15316 
15317 /*
15318 * Capability flag for wl_txpwrcap_tbl_v2_t and wl_txpwrcap_t
15319 * The index into pwrs will be:  0: onbody-cck, 1: onbody-ofdm, 2:offbody-cck, 3:offbody-ofdm
15320 *
15321 * For 5G power in SDB case as well as for non-SDB case, the value of flag will be: CAP_ONOFF_BODY
15322 * The index into pwrs will be:  0: onbody, 1: offbody-ofdm
15323 */
15324 
15325 #define CAP_ONOFF_BODY	(0x1)	/* on/off body only */
15326 #define CAP_CCK_OFDM	(0x2)	/* cck/ofdm capability only */
15327 #define CAP_LTE_CELL	(0x4)	/* cell on/off capability; required for iOS builds */
15328 #define CAP_HEAD_BODY	(0x8)	/* head/body capability */
15329 #define CAP_2G_DEPON_5G (0x10)	/* 2G pwr caps depend on other slice 5G subband */
15330 #define CAP_SISO_MIMO	(0x20)	/* Siso/Mimo Separate Power Caps */
15331 #define CAP_ANT_TX	(0x40)	/* Separate Power Caps based on cell ant tx value */
15332 #define CAP_ONOFF_BODY_CCK_OFDM	(CAP_ONOFF_BODY | CAP_CCK_OFDM)
15333 #define CAP_TXPWR_ALL	(CAP_ONOFF_BODY|CAP_CCK_OFDM|CAP_LTE_CELL|\
15334 	CAP_SISO_MIMO|CAP_HEAD_BODY|CAP_ANT_TX)
15335 
15336 #define TXHDR_SEC_MAX		5u	/* Deprecated.  Kept till removed in all branches */
15337 #define TXPWRCAP_MAX_STATES	4u
15338 #define TXPWRCAP_MAX_STATES_V3	10u
15339 #define TXPWRCAP_CCKOFDM_ONOFFBODY_MAX_STATES 4u
15340 #define TXPWRCAP_ONOFFBODY_MAX_STATES 2u
15341 #define TXPWRCAP_ONOFFCELL_MAX_STATES 2u
15342 
15343 #define TXHDR_SEC_NONSDB_MAIN_2G	0
15344 #define TXHDR_SEC_NONSDB_MAIN_5G	1
15345 #define TXHDR_SEC_NONSDB_AUX_2G		2
15346 #define TXHDR_SEC_NONSDB_AUX_5G		3
15347 #define TXHDR_SEC_SDB_MAIN_2G		4
15348 #define TXHDR_SEC_SDB_MAIN_5G		5
15349 #define TXHDR_SEC_SDB_AUX_2G		6
15350 #define TXHDR_SEC_SDB_AUX_5G		7
15351 #define TXHDR_MAX_SECTION		8
15352 
15353 #define WL_TXPWRCAP_MAX_SLICES	2
15354 #define WL_TXPWRCAPDUMP_VER	4
15355 
15356 #define WL_TXPWRCAP_VERSION_2 2
15357 #define WL_TXPWRCAP_VERSION_3 3
15358 
15359 typedef struct wl_txpwrcap {
15360 	uint8   capability;
15361 	uint8	num_cap_states;
15362 	uint8   section; /* Index from above,eg. TXHDR_SEC_NONSDB */
15363 	int8    pwrs[][TXPWRCAP_NUM_SUBBANDS][TXPWRCAP_MAX_NUM_CORES];
15364 } wl_txpwrcap_t;
15365 
15366 typedef struct {
15367 	uint8   capability;
15368 	uint8	num_cap_states;
15369 	uint8   num_subgrps;
15370 	uint8   section; /* Index from above,eg. TXHDR_SEC_NONSDB */
15371 	int8    pwrs[][TXPWRCAP_MAX_NUM_SUBGRPS][TXPWRCAP_MAX_NUM_ANTENNAS_V3];
15372 } wl_txpwrcap_v2_t;
15373 
15374 #define TXPWRCAP_DUMP_VERSION_4 4
15375 #define TXPWRCAP_DUMP_VERSION_5 5
15376 
15377 typedef struct wl_txpwrcap_dump_v4 {
15378 	uint8		version;
15379 	uint8		num_pwrcap;
15380 	uint8		current_country[2];
15381 	uint32		current_channel;
15382 	uint8		download_present;
15383 	uint8		num_cores;	/* number cores on slice */
15384 	uint8		num_cc_groups;	/* number cc groups */
15385 	uint8		current_country_cc_group_info_index;
15386 	/* first power cap always exist
15387 	* On main,-non-sdb follows by sdb2g and then sdb5g
15388 	* On aux slice - aux2g then aux5g.
15389 	*/
15390 	wl_txpwrcap_t   pwrcap; /* first power cap */
15391 } wl_txpwrcap_dump_v4_t;
15392 
15393 typedef struct wl_txpwrcap_dump_v5 {
15394 	uint8	version;
15395 	uint8	num_pwrcap;
15396 	uint8	current_country[2];
15397 	uint8	current_channel;
15398 	uint8	high_cap_state_enabled;
15399 	uint8	reserved[2];
15400 	uint8	download_present;
15401 	uint8	num_ants;	/* number antenna slice */
15402 	uint8	num_cc_groups;	/* number cc groups */
15403 	uint8	current_country_cc_group_info_index;
15404 	uint8	ant_tx; /* current value of ant_tx */
15405 	uint8	cell_status; /* current value of cell status */
15406 	int8	pwrcap[]; /* variable size power caps (wl_txpwrcap_v2_t) */
15407 } wl_txpwrcap_dump_v5_t;
15408 
15409 typedef struct wl_txpwrcap_tbl {
15410 	uint8 num_antennas_per_core[TXPWRCAP_MAX_NUM_CORES];
15411 	/* Stores values for valid antennas */
15412 	int8 pwrcap_cell_on[TXPWRCAP_MAX_NUM_ANTENNAS]; /* qdBm units */
15413 	int8 pwrcap_cell_off[TXPWRCAP_MAX_NUM_ANTENNAS]; /* qdBm units */
15414 } wl_txpwrcap_tbl_t;
15415 
15416 typedef struct wl_txpwrcap_tbl_v2 {
15417 	uint8 version;
15418 	uint8 length;		/* size of entire structure, including the pwrs */
15419 	uint8 capability;	/* capability bitmap */
15420 	uint8 num_cores;	/* number of cores i.e. entries in each cap state row */
15421 	/*
15422 	* pwrs array has TXPWRCAP_MAX_STATES rows - one for each cap state.
15423 	* Each row has up to TXPWRCAP_MAX_NUM_CORES entries - one for each core.
15424 	*/
15425 	uint8 pwrs[][TXPWRCAP_MAX_NUM_CORES];  /* qdBm units */
15426 } wl_txpwrcap_tbl_v2_t;
15427 
15428 typedef struct wl_txpwrcap_tbl_v3 {
15429 	uint8 version;
15430 	uint8 length;		/* size of entire structure, including the pwrs */
15431 	uint8 capability;	/* capability bitmap */
15432 	uint8 num_cores;	/* number of cores */
15433 	uint8 num_antennas_per_core[TXPWRCAP_MAX_NUM_CORES_V3];
15434 	/*
15435 	* pwrs array has TXPWRCAP_MAX_STATES rows - one for each cap state.
15436 	* Each row has up to TXPWRCAP_MAX_NUM_ANTENNAS entries - for each antenna.
15437 	* Included in the rows of powers are rows for fail safe.
15438 	*/
15439 	int8 pwrs[][TXPWRCAP_MAX_NUM_ANTENNAS_V3];	/* qdBm units */
15440 } wl_txpwrcap_tbl_v3_t;
15441 
15442 /* ##### Ecounters section ##### */
15443 #define ECOUNTERS_VERSION_1	1
15444 
15445 /* Input structure for ecounters IOVAR */
15446 typedef struct ecounters_config_request {
15447 	uint16 version;		/* config version */
15448 	uint16 set;		/* Set where data will go. */
15449 	uint16 size;		/* Size of the set. */
15450 	uint16 timeout;		/* timeout in seconds. */
15451 	uint16 num_events;	/* Number of events to report. */
15452 	uint16 ntypes;		/* Number of entries in type array. */
15453 	uint16 type[1];		/* Statistics Types (tags) to retrieve. */
15454 } ecounters_config_request_t;
15455 
15456 #define ECOUNTERS_EVENTMSGS_VERSION_1		1
15457 #define ECOUNTERS_TRIGGER_CONFIG_VERSION_1	1
15458 
15459 #define ECOUNTERS_EVENTMSGS_EXT_MASK_OFFSET	\
15460 		OFFSETOF(ecounters_eventmsgs_ext_t, mask[0])
15461 
15462 #define ECOUNTERS_TRIG_CONFIG_TYPE_OFFSET	\
15463 		OFFSETOF(ecounters_trigger_config_t, type[0])
15464 
15465 typedef struct ecounters_eventmsgs_ext {
15466 	uint8 version;
15467 	uint8 len;
15468 	uint8 mask[1];
15469 } ecounters_eventmsgs_ext_t;
15470 
15471 typedef struct ecounters_trigger_config {
15472 	uint16 version;		/* version */
15473 	uint16 set;		/* set where data should go */
15474 	uint16 rsvd;		/* reserved */
15475 	uint16 pad;		/* pad/reserved */
15476 	uint16 ntypes;		/* number of types/tags */
15477 	uint16 type[1];		/* list of types */
15478 } ecounters_trigger_config_t;
15479 
15480 #define ECOUNTERS_TRIGGER_REASON_VERSION_1	1
15481 typedef enum {
15482 	/* Triggered due to timer based ecounters */
15483 	ECOUNTERS_TRIGGER_REASON_TIMER = 0,
15484 	/* Triggered due to event based configuration */
15485 	ECOUNTERS_TRIGGER_REASON_EVENTS = 1,
15486 	ECOUNTERS_TRIGGER_REASON_D2H_EVENTS = 2,
15487 	ECOUNTERS_TRIGGER_REASON_H2D_EVENTS = 3,
15488 	ECOUNTERS_TRIGGER_REASON_USER_EVENTS = 4,
15489 	ECOUNTERS_TRIGGER_REASON_MAX = 5
15490 } ecounters_trigger_reasons_list_t;
15491 
15492 typedef struct ecounters_trigger_reason {
15493 	uint16 version;			/* version */
15494 	uint16 trigger_reason;		/* trigger reason */
15495 	uint32 sub_reason_code;		/* sub reason code */
15496 	uint32 trigger_time_now;	/* time in ms  at trigger */
15497 	uint32 host_ref_time;		/* host ref time */
15498 } ecounters_trigger_reason_t;
15499 
15500 #define WL_LQM_VERSION_1 1
15501 
15502 /* For wl_lqm_t flags field */
15503 #define WL_LQM_CURRENT_BSS_VALID 0x1
15504 #define WL_LQM_TARGET_BSS_VALID 0x2
15505 
15506 #define WL_PERIODIC_COMPACT_CNTRS_VER_1 (1)
15507 #define WL_PERIODIC_TXBF_CNTRS_VER_1 (1)
15508 typedef struct {
15509 	uint16 version;
15510 	uint16 pad;
15511 	/* taken from wl_wlc_cnt_t */
15512 	uint32 txfail;
15513 	/* taken from wl_cnt_ge40mcst_v1_t */
15514 	uint32	txallfrm;	/**< total number of frames sent, incl. Data, ACK, RTS, CTS,
15515 				 * Control Management (includes retransmissions)
15516 				 */
15517 	uint32	txrtsfrm;	/**< number of RTS sent out by the MAC */
15518 	uint32	txctsfrm;	/**< number of CTS sent out by the MAC */
15519 	uint32	txback;		/**< blockack txcnt */
15520 	uint32	txucast;	/**< number of unicast tx expecting response other than cts/cwcts */
15521 	uint32  txnoack;	/**< dot11ACKFailureCount */
15522 	uint32  txframe;	/**< tx data frames */
15523 	uint32  txretrans;	/**< tx mac retransmits */
15524 	uint32  txpspoll;	/**< Number of TX PS-poll */
15525 
15526 	uint32	rxrsptmout;	/**< number of response timeouts for transmitted frames
15527 				 * expecting a response
15528 				 */
15529 	uint32	txrtsfail;	/**< number of rts transmission failure that reach retry limit */
15530 	uint32	rxstrt;		/**< number of received frames with a good PLCP */
15531 	uint32  rxbadplcp;	/**< number of parity check of the PLCP header failed */
15532 	uint32  rxcrsglitch;	/**< PHY was able to correlate the preamble but not the header */
15533 	uint32  rxnodelim;	/**< number of no valid delimiter detected by ampdu parser */
15534 	uint32  bphy_badplcp;	/**< number of bad PLCP reception on BPHY rate */
15535 	uint32  bphy_rxcrsglitch;	/**< PHY count of bphy glitches */
15536 	uint32  rxbadfcs;	/**< number of frames for which the CRC check failed in the MAC */
15537 	uint32  rxf0ovfl;	/**< number of receive fifo 0 overflows */
15538 	uint32  rxf1ovfl;	/**< number of receive fifo 0 overflows */
15539 	uint32  rxhlovfl;	/**< number of length / header fifo overflows */
15540 	uint32	rxrtsucast;	/**< number of unicast RTS addressed to the MAC (good FCS) */
15541 	uint32	rxctsucast;	/**< number of unicast CTS addressed to the MAC (good FCS) */
15542 	uint32	rxackucast;	/**< number of ucast ACKS received (good FCS) */
15543 	uint32	rxback;		/**< blockack rxcnt */
15544 	uint32	rxbeaconmbss;	/**< beacons received from member of BSS */
15545 	uint32	rxdtucastmbss;	/**< number of received DATA frames with good FCS and matching RA */
15546 	uint32	rxbeaconobss;	/**< beacons received from other BSS */
15547 	uint32	rxdtucastobss;	/**< number of unicast frames addressed to the MAC from
15548 				* other BSS (WDS FRAME)
15549 				*/
15550 	uint32	rxdtocast;	/**< number of received DATA frames (good FCS and no matching RA) */
15551 	uint32	rxrtsocast;	/**< number of received RTS not addressed to the MAC */
15552 	uint32	rxctsocast;	/**< number of received CTS not addressed to the MAC */
15553 	uint32	rxdtmcast;	/**< number of RX Data multicast frames received by the MAC */
15554 	uint32  rxmpdu_mu;	/**< Number of MU MPDUs received */
15555 	uint32  rxtoolate;	/**< receive too late */
15556 	uint32  rxframe;	/**< rx data frames */
15557 	uint32  lqcm_report;	/**<  lqcm metric tx/rx idx */
15558 	uint32	tx_toss_cnt;	/* number of tx packets tossed */
15559 	uint32	rx_toss_cnt;	/* number of rx packets tossed	*/
15560 	uint32	last_tx_toss_rsn; /* reason because of which last tx pkt tossed */
15561 	uint32	last_rx_toss_rsn; /* reason because of which last rx pkt tossed */
15562 	uint32	txbcnfrm;	/**< beacons transmitted */
15563 } wl_periodic_compact_cntrs_v1_t;
15564 
15565 #define WL_PERIODIC_COMPACT_CNTRS_VER_2 (2)
15566 typedef struct {
15567 	uint16 version;
15568 	uint16 pad;
15569 	/* taken from wl_wlc_cnt_t */
15570 	uint32 txfail;
15571 	/* taken from wl_cnt_ge40mcst_v1_t */
15572 	uint32	txallfrm;	/**< total number of frames sent, incl. Data, ACK, RTS, CTS,
15573 				 * Control Management (includes retransmissions)
15574 				 */
15575 	uint32	txrtsfrm;	/**< number of RTS sent out by the MAC */
15576 	uint32	txctsfrm;	/**< number of CTS sent out by the MAC */
15577 	uint32	txback;		/**< blockack txcnt */
15578 	uint32	txucast;	/**< number of unicast tx expecting response other than cts/cwcts */
15579 	uint32  txnoack;	/**< dot11ACKFailureCount */
15580 	uint32  txframe;	/**< tx data frames */
15581 	uint32  txretrans;	/**< tx mac retransmits */
15582 	uint32  txpspoll;	/**< Number of TX PS-poll */
15583 
15584 	uint32	rxrsptmout;	/**< number of response timeouts for transmitted frames
15585 				 * expecting a response
15586 				 */
15587 	uint32	txrtsfail;	/**< number of rts transmission failure that reach retry limit */
15588 	uint32	rxstrt;		/**< number of received frames with a good PLCP */
15589 	uint32  rxbadplcp;	/**< number of parity check of the PLCP header failed */
15590 	uint32  rxcrsglitch;	/**< PHY was able to correlate the preamble but not the header */
15591 	uint32  rxnodelim;	/**< number of no valid delimiter detected by ampdu parser */
15592 	uint32  bphy_badplcp;	/**< number of bad PLCP reception on BPHY rate */
15593 	uint32  bphy_rxcrsglitch;	/**< PHY count of bphy glitches */
15594 	uint32  rxbadfcs;	/**< number of frames for which the CRC check failed in the MAC */
15595 	uint32  rxf0ovfl;	/**< number of receive fifo 0 overflows */
15596 	uint32  rxf1ovfl;	/**< number of receive fifo 0 overflows */
15597 	uint32  rxhlovfl;	/**< number of length / header fifo overflows */
15598 	uint32	rxrtsucast;	/**< number of unicast RTS addressed to the MAC (good FCS) */
15599 	uint32	rxctsucast;	/**< number of unicast CTS addressed to the MAC (good FCS) */
15600 	uint32	rxackucast;	/**< number of ucast ACKS received (good FCS) */
15601 	uint32	rxback;		/**< blockack rxcnt */
15602 	uint32	rxbeaconmbss;	/**< beacons received from member of BSS */
15603 	uint32	rxdtucastmbss;	/**< number of received DATA frames with good FCS and matching RA */
15604 	uint32	rxbeaconobss;	/**< beacons received from other BSS */
15605 	uint32	rxdtucastobss;	/**< number of unicast frames addressed to the MAC from
15606 				* other BSS (WDS FRAME)
15607 				*/
15608 	uint32	rxdtocast;	/**< number of received DATA frames (good FCS and no matching RA) */
15609 	uint32	rxrtsocast;	/**< number of received RTS not addressed to the MAC */
15610 	uint32	rxctsocast;	/**< number of received CTS not addressed to the MAC */
15611 	uint32	rxdtmcast;	/**< number of RX Data multicast frames received by the MAC */
15612 	uint32  rxmpdu_mu;	/**< Number of MU MPDUs received */
15613 	uint32  rxtoolate;	/**< receive too late */
15614 	uint32  rxframe;	/**< rx data frames */
15615 	uint32  lqcm_report;	/**<  lqcm metric tx/rx idx */
15616 	uint32	tx_toss_cnt;	/* number of tx packets tossed */
15617 	uint32	rx_toss_cnt;	/* number of rx packets tossed	*/
15618 	uint32	last_tx_toss_rsn; /* reason because of which last tx pkt tossed */
15619 	uint32	last_rx_toss_rsn; /* reason because of which last rx pkt tossed */
15620 	uint32	txbcnfrm;	/**< beacons transmitted */
15621 	uint32	rxretry;	/* Number of rx packets received after retry */
15622 	uint32	rxdup;		/* Number of dump packet. Indicates whether peer is receiving ack */
15623 	uint32	chswitch_cnt;	/* Number of channel switches */
15624 	uint32 pm_dur;		/* Total sleep time in PM, msecs */
15625 } wl_periodic_compact_cntrs_v2_t;
15626 
15627 #define WL_PERIODIC_COMPACT_HE_CNTRS_VER_1 (1)
15628 typedef struct {
15629 	uint16 version;
15630 	uint16 len;
15631 	uint32 he_rxtrig_rand;
15632 	uint32 he_colormiss_cnt;
15633 	uint32 he_txmtid_back;
15634 	uint32 he_rxmtid_back;
15635 	uint32 he_rxmsta_back;
15636 	uint32 he_rxtrig_basic;
15637 	uint32 he_rxtrig_murts;
15638 	uint32 he_rxtrig_bsrp;
15639 	uint32 he_rxdlmu;
15640 	uint32 he_physu_rx;
15641 	uint32 he_txtbppdu;
15642 } wl_compact_he_cnt_wlc_v1_t;
15643 
15644 typedef struct {
15645 	uint16	version;
15646 	uint16	coreup;
15647 	uint32  txndpa;
15648 	uint32	txndp;
15649 	uint32	rxsf;
15650 	uint32	txbfm;
15651 	uint32	rxndpa_u;
15652 	uint32	rxndpa_m;
15653 	uint32	bferpt;
15654 	uint32	rxbfpoll;
15655 	uint32	txsf;
15656 } wl_periodic_txbf_cntrs_v1_t;
15657 
15658 typedef struct {
15659 	struct ether_addr BSSID;
15660 	chanspec_t chanspec;
15661 	int32 rssi;
15662 	int32 snr;
15663 } wl_rx_signal_metric_t;
15664 
15665 typedef struct {
15666 	uint8 version;
15667 	uint8 flags;
15668 	uint16 pad;
15669 	int32 noise_level; /* current noise level */
15670 	wl_rx_signal_metric_t current_bss;
15671 	wl_rx_signal_metric_t target_bss;
15672 } wl_lqm_t;
15673 
15674 #define WL_PERIODIC_IF_STATE_VER_1 (1)
15675 typedef struct wl_if_state_compact {
15676 	uint8 version;
15677 	uint8 assoc_state;
15678 	uint8 antenna_count;		/**< number of valid antenna rssi */
15679 	int8 noise_level;		/**< noise right after tx (in dBm) */
15680 	int8 snr;			/* current noise level */
15681 	int8 rssi_sum;			/**< summed rssi across all antennas */
15682 	uint16 pad16;
15683 	int8 rssi_ant[WL_RSSI_ANT_MAX]; /**< rssi per antenna */
15684 	struct ether_addr BSSID;
15685 	chanspec_t chanspec;
15686 } wl_if_state_compact_t;
15687 
15688 #define WL_EVENT_STATISTICS_VER_1 (1)
15689 /* Event based statistics ecounters */
15690 typedef struct {
15691 	uint16 version;
15692 	uint16 pad;
15693 	struct ether_addr   BSSID;			/* BSSID of the BSS */
15694 	uint32 txdeauthivalclass;
15695 } wl_event_based_statistics_v1_t;
15696 
15697 /* ##### Ecounters v2 section ##### */
15698 
15699 #define ECOUNTERS_VERSION_2	2
15700 
15701 /* Enumeration of various ecounters request types. This namespace is different from
15702  * global reportable stats namespace.
15703 */
15704 enum {
15705 	WL_ECOUNTERS_XTLV_REPORT_REQ = 1
15706 };
15707 
15708 /* Input structure for ecounters IOVAR */
15709 typedef struct ecounters_config_request_v2 {
15710 	uint16 version;		/* config version */
15711 	uint16 len;		/* Length of this struct including variable len */
15712 	uint16 logset;		/* Set where data will go. */
15713 	uint16 reporting_period;	/* reporting_period */
15714 	uint16 num_reports;	/* Number of timer expirations to report on */
15715 	uint8 pad[2];		/* Reserved for future use */
15716 	uint8 ecounters_xtlvs[];	/* Statistics Types (tags) to retrieve. */
15717 } ecounters_config_request_v2_t;
15718 
15719 #define ECOUNTERS_STATS_TYPES_FLAG_SLICE	0x1
15720 #define ECOUNTERS_STATS_TYPES_FLAG_IFACE	0x2
15721 #define ECOUNTERS_STATS_TYPES_FLAG_GLOBAL	0x4
15722 #define ECOUNTERS_STATS_TYPES_DEFAULT		0x8
15723 
15724 /* Slice mask bits */
15725 #define ECOUNTERS_STATS_TYPES_SLICE_MASK_SLICE0	0x1
15726 #define ECOUNTERS_STATS_TYPES_SLICE_MASK_SLICE1	0x2
15727 
15728 typedef struct ecounters_stats_types_report_req {
15729 	/* flags: bit0 = slice, bit1 = iface, bit2 = global,
15730 	 * rest reserved
15731 	 */
15732 	uint16 flags;
15733 	uint16 if_index;	/* host interface index */
15734 	uint16 slice_mask;	/* bit0 = slice0, bit1=slice1, rest reserved */
15735 	uint8 pad[2];	/* padding */
15736 	uint8 stats_types_req[]; /* XTLVs of requested types */
15737 } ecounters_stats_types_report_req_t;
15738 
15739 /* ##### Ecounters_Eventmsgs v2 section ##### */
15740 
15741 #define ECOUNTERS_EVENTMSGS_VERSION_2		2
15742 
15743 typedef struct event_ecounters_config_request_v2 {
15744 	uint16 version;	/* config version */
15745 	uint16 len;	/* Length of this struct including variable len */
15746 	uint16 logset;	/* Set where data will go. */
15747 	uint16 event_id;	/* Event id for which this config is meant for */
15748 	uint8 flags;	/* Config flags */
15749 	uint8 pad[3];	/* Reserved for future use */
15750 	uint8 ecounters_xtlvs[];	/* Statistics Types (tags) to retrieve. */
15751 } event_ecounters_config_request_v2_t;
15752 
15753 #define EVENT_ECOUNTERS_FLAGS_ADD	(1 << 0) /* Add configuration for the event_id if set */
15754 #define EVENT_ECOUNTERS_FLAGS_DEL	(1 << 1) /* Delete configuration for event_id if set */
15755 #define EVENT_ECOUNTERS_FLAGS_ANYIF	(1 << 2) /* Interface filtering disable / off bit */
15756 #define EVENT_ECOUNTERS_FLAGS_BE	(1 << 3) /* If cleared report stats of
15757 						    * one event log buffer
15758 						    */
15759 #define EVENT_ECOUNTERS_FLAGS_DEL_ALL	(1 << 4) /* Delete all the configurations of
15760 						    * event ecounters if set
15761 						    */
15762 
15763 #define EVENT_ECOUNTERS_FLAGS_BUS	(1 << 5) /* Add configuration for the bus events */
15764 #define EVENT_ECOUNTERS_FLAGS_BUS_H2D	(1 << 6) /* Add configuration for the bus direction
15765 						  * 0 - D2H and 1 - H2D
15766 						  */
15767 
15768 #define EVENT_ECOUNTERS_FLAGS_DELAYED_FLUSH	(1 << 7) /* Flush only when half of the total size
15769 						   * of blocks gets filled. This is to avoid
15770 						   * many interrupts to host.
15771 						   */
15772 #define EVENT_ECOUNTERS_FLAGS_USER	(1 << 6) /* Add configuration for user defined events
15773 						* Reuse the same flag as H2D
15774 						*/
15775 
15776 /* Ecounters suspend resume */
15777 #define ECOUNTERS_SUSPEND_VERSION_V1	1
15778 /* To be used in populating suspend_mask and suspend_bitmap */
15779 #define ECOUNTERS_SUSPEND_TIMER (1 << ECOUNTERS_TRIGGER_REASON_TIMER)
15780 #define ECOUNTERS_SUSPEND_EVENTS (1 << ECOUNTERS_TRIGGER_REASON_EVENTS)
15781 
15782 typedef struct ecounters_suspend {
15783 	uint16 version;
15784 	uint16 len;
15785 	uint32 suspend_bitmap; /* type of ecounter reporting to be suspended */
15786 	uint32 suspend_mask; /* type of ecounter reporting to be suspended */
15787 } ecounters_suspend_t;
15788 
15789 /* -------------- dynamic BTCOEX --------------- */
15790 #define DCTL_TROWS	2			/**< currently practical number of rows  */
15791 #define DCTL_TROWS_MAX	4			/**<  2 extra rows RFU */
15792 /* DYNCTL profile flags */
15793 #define DCTL_FLAGS_DISABLED	0		/**< default value: all features disabled */
15794 #define DCTL_FLAGS_DYNCTL	(1 << 0)	/**<  1 - enabled, 0 - legacy only */
15795 #define DCTL_FLAGS_DESENSE	(1 << 1)	/**< auto desense is enabled */
15796 #define DCTL_FLAGS_MSWITCH	(1 << 2)	/**< mode switching is enabled */
15797 #define DCTL_FLAGS_PWRCTRL	(1 << 3)	/**< Tx power control is enabled */
15798 /* for now AGG on/off is handled separately  */
15799 #define DCTL_FLAGS_TX_AGG_OFF	(1 << 4)	/**< TBD: allow TX agg Off */
15800 #define DCTL_FLAGS_RX_AGG_OFF	(1 << 5)	/**< TBD: allow RX agg Off */
15801 /* used for dry run testing only */
15802 #define DCTL_FLAGS_DRYRUN	(1 << 7)	/**< Enables dynctl dry run mode  */
15803 #define IS_DYNCTL_ON(prof)	((prof->flags & DCTL_FLAGS_DYNCTL) != 0)
15804 #define IS_DESENSE_ON(prof)	((prof->flags & DCTL_FLAGS_DESENSE) != 0)
15805 #define IS_MSWITCH_ON(prof)	((prof->flags & DCTL_FLAGS_MSWITCH) != 0)
15806 #define IS_PWRCTRL_ON(prof)	((prof->flags & DCTL_FLAGS_PWRCTRL) != 0)
15807 /* desense level currently in use */
15808 #define DESENSE_OFF	0
15809 #define DFLT_DESENSE_MID	12
15810 #define DFLT_DESENSE_HIGH	2
15811 
15812 /**
15813  * dynctl data points(a set of btpwr & wlrssi thresholds)
15814  * for mode & desense switching
15815  */
15816 typedef struct btc_thr_data {
15817 	int8	mode;	/**< used by desense sw */
15818 	int8	bt_pwr;	/**< BT tx power threshold */
15819 	int8	bt_rssi;	/**< BT rssi threshold */
15820 	/* wl rssi range when mode or desense change may be needed */
15821 	int8	wl_rssi_high;
15822 	int8	wl_rssi_low;
15823 } btc_thr_data_t;
15824 
15825 /* dynctl. profile data structure  */
15826 #define DCTL_PROFILE_VER 0x01
15827 #include <packed_section_start.h>
15828 typedef BWL_PRE_PACKED_STRUCT struct  dctl_prof {
15829 	uint8 version;  /**< dynctl profile version */
15830 	/* dynctl profile flags bit:0 - dynctl On, bit:1 dsns On, bit:2 mode sw On, */
15831 	uint8 flags;  /**< bit[6:3] reserved, bit7 - Dryrun (sim) - On */
15832 	/**  wl desense levels to apply */
15833 	uint8	dflt_dsns_level;
15834 	uint8	low_dsns_level;
15835 	uint8	mid_dsns_level;
15836 	uint8	high_dsns_level;
15837 	/** mode switching hysteresis in dBm */
15838 	int8	msw_btrssi_hyster;
15839 	/** default btcoex mode */
15840 	uint8	default_btc_mode;
15841 	/** num of active rows in mode switching table */
15842 	uint8	msw_rows;
15843 	/** num of rows in desense table */
15844 	uint8	dsns_rows;
15845 	/** dynctl mode switching data table  */
15846 	btc_thr_data_t msw_data[DCTL_TROWS_MAX];
15847 	/** dynctl desense switching data table */
15848 	btc_thr_data_t dsns_data[DCTL_TROWS_MAX];
15849 } BWL_POST_PACKED_STRUCT dctl_prof_t;
15850 #include <packed_section_end.h>
15851 
15852 /**  dynctl status info */
15853 #include <packed_section_start.h>
15854 typedef BWL_PRE_PACKED_STRUCT struct  dynctl_status {
15855 	uint8 sim_on;	/**< true if simulation is On */
15856 	uint16	bt_pwr_shm; /**< BT per/task power as read from ucode  */
15857 	int8	bt_pwr;		/**< BT pwr extracted & converted to dBm */
15858 	int8	bt_rssi;	/**< BT rssi in dBm */
15859 	int8	wl_rssi;	/**< last wl rssi reading used by btcoex */
15860 	uint8	dsns_level; /**< current desense level */
15861 	uint8	btc_mode;   /**< current btcoex mode */
15862 	/* add more status items if needed,  pad to 4 BB if needed */
15863 } BWL_POST_PACKED_STRUCT dynctl_status_t;
15864 #include <packed_section_end.h>
15865 
15866 /**  dynctl simulation (dryrun data) */
15867 #include <packed_section_start.h>
15868 typedef BWL_PRE_PACKED_STRUCT struct  dynctl_sim {
15869 	uint8 sim_on;	/**< simulation mode on/off */
15870 	int8 btpwr;		/**< simulated BT power in dBm */
15871 	int8 btrssi;	/**< simulated BT rssi in dBm */
15872 	int8 wlrssi;	/**< simulated WL rssi in dBm */
15873 } BWL_POST_PACKED_STRUCT dynctl_sim_t;
15874 /* no default structure packing */
15875 #include <packed_section_end.h>
15876 
15877 /** PTK key maintained per SCB */
15878 #define RSN_TEMP_ENCR_KEY_LEN 16
15879 typedef struct wpa_ptk {
15880 	uint8 kck[RSN_KCK_LENGTH]; /**< EAPOL-Key Key Confirmation Key (KCK) */
15881 	uint8 kek[RSN_KEK_LENGTH]; /**< EAPOL-Key Key Encryption Key (KEK) */
15882 	uint8 tk1[RSN_TEMP_ENCR_KEY_LEN]; /**< Temporal Key 1 (TK1) */
15883 	uint8 tk2[RSN_TEMP_ENCR_KEY_LEN]; /**< Temporal Key 2 (TK2) */
15884 } wpa_ptk_t;
15885 
15886 /** GTK key maintained per SCB */
15887 typedef struct wpa_gtk {
15888 	uint32 idx;
15889 	uint32 key_len;
15890 	uint8  key[DOT11_MAX_KEY_SIZE];
15891 } wpa_gtk_t;
15892 
15893 /** FBT Auth Response Data structure */
15894 typedef struct wlc_fbt_auth_resp {
15895 	uint8 macaddr[ETHER_ADDR_LEN]; /**< station mac address */
15896 	uint8 pad[2];
15897 	uint8 pmk_r1_name[WPA2_PMKID_LEN];
15898 	wpa_ptk_t ptk; /**< pairwise key */
15899 	wpa_gtk_t gtk; /**< group key */
15900 	uint32 ie_len;
15901 	uint8 status;  /**< Status of parsing FBT authentication
15902 					Request in application
15903 					*/
15904 	uint8 ies[1]; /**< IEs contains MDIE, RSNIE,
15905 					FBTIE (ANonce, SNonce,R0KH-ID, R1KH-ID)
15906 					*/
15907 } wlc_fbt_auth_resp_t;
15908 
15909 /** FBT Action Response frame */
15910 typedef struct wlc_fbt_action_resp {
15911 	uint16 version; /**< structure version */
15912 	uint16 length; /**< length of structure */
15913 	uint8 macaddr[ETHER_ADDR_LEN]; /**< station mac address */
15914 	uint8 data_len;  /**< len of ie from Category */
15915 	uint8 data[1]; /**< data contains category, action, sta address, target ap,
15916 						status code,fbt response frame body
15917 						*/
15918 } wlc_fbt_action_resp_t;
15919 
15920 #define MACDBG_PMAC_ADDR_INPUT_MAXNUM 16
15921 #define MACDBG_PMAC_OBJ_TYPE_LEN 8
15922 
15923 typedef struct _wl_macdbg_pmac_param_t {
15924 	char type[MACDBG_PMAC_OBJ_TYPE_LEN];
15925 	uint8 step;
15926 	uint8 w_en;
15927 	uint16 num;
15928 	uint32 bitmap;
15929 	uint8 addr_raw;
15930 	uint8 addr_num;
15931 	uint16 addr[MACDBG_PMAC_ADDR_INPUT_MAXNUM];
15932 	uint8 pad0[2];
15933 	uint32 w_val;
15934 } wl_macdbg_pmac_param_t;
15935 
15936 /** IOVAR 'svmp_sampcol' parameter. Used to set and read SVMP_SAMPLE_COLLECT's setting */
15937 typedef struct wl_svmp_sampcol_param {
15938 	uint32 version;           /* version */
15939 	uint8  enable;
15940 	uint8  trigger_mode;      /* SVMP_SAMPCOL_TRIGGER */
15941 	uint8  trigger_mode_s[2]; /* SVMP_SAMPCOL_PKTPROC */
15942 	uint8  data_samplerate;   /* SVMP_SAMPCOL_SAMPLERATE */
15943 	uint8  data_sel_phy1;     /* SVMP_SAMPCOL_PHY1MUX */
15944 	uint8  data_sel_rx1;      /* SVMP_SAMPCOL_RX1MUX without iqCompOut */
15945 	uint8  data_sel_dualcap;  /* SVMP_SAMPCOL_RX1MUX */
15946 	uint8  pack_mode;         /* SVMP_SAMPCOL_PACK */
15947 	uint8  pack_order;
15948 	uint8  pack_cfix_fmt;
15949 	uint8  pack_1core_sel;
15950 	uint16 waitcnt;
15951 	uint16 caplen;
15952 	uint32 buff_addr_start;   /* in word-size (2-bytes) */
15953 	uint32 buff_addr_end;     /* note: Tcl in byte-size, HW in vector-size (8-bytes) */
15954 	uint8  int2vasip;
15955 	uint8  PAD;
15956 	uint16 status;
15957 } wl_svmp_sampcol_t;
15958 
15959 #define WL_SVMP_SAMPCOL_PARAMS_VERSION	1
15960 
15961 enum {
15962 	SVMP_SAMPCOL_TRIGGER_PKTPROC_TRANSITION = 0,
15963 	SVMP_SAMPCOL_TRIGGER_FORCE_IMMEDIATE,
15964 	SVMP_SAMPCOL_TRIGGER_RADAR_DET
15965 };
15966 
15967 enum {
15968 	SVMP_SAMPCOL_PHY1MUX_GPIOOUT = 0,
15969 	SVMP_SAMPCOL_PHY1MUX_FFT,
15970 	SVMP_SAMPCOL_PHY1MUX_DBGHX,
15971 	SVMP_SAMPCOL_PHY1MUX_RX1MUX
15972 };
15973 
15974 enum {
15975 	SVMP_SAMPCOL_RX1MUX_FARROWOUT = 4,
15976 	SVMP_SAMPCOL_RX1MUX_IQCOMPOUT,
15977 	SVMP_SAMPCOL_RX1MUX_DCFILTEROUT,
15978 	SVMP_SAMPCOL_RX1MUX_RXFILTEROUT,
15979 	SVMP_SAMPCOL_RX1MUX_ACIFILTEROUT
15980 };
15981 
15982 enum {
15983 	SVMP_SAMPCOL_SAMPLERATE_1XBW = 0,
15984 	SVMP_SAMPCOL_SAMPLERATE_2XBW
15985 };
15986 
15987 enum {
15988 	SVMP_SAMPCOL_PACK_DUALCAP = 0,
15989 	SVMP_SAMPCOL_PACK_4CORE,
15990 	SVMP_SAMPCOL_PACK_2CORE,
15991 	SVMP_SAMPCOL_PACK_1CORE
15992 };
15993 
15994 enum {
15995 	SVMP_SAMPCOL_PKTPROC_RESET = 0,
15996 	SVMP_SAMPCOL_PKTPROC_CARRIER_SEARCH,
15997 	SVMP_SAMPCOL_PKTPROC_WAIT_FOR_NB_PWR,
15998 	SVMP_SAMPCOL_PKTPROC_WAIT_FOR_W1_PWR,
15999 	SVMP_SAMPCOL_PKTPROC_WAIT_FOR_W2_PWR,
16000 	SVMP_SAMPCOL_PKTPROC_OFDM_PHY,
16001 	SVMP_SAMPCOL_PKTPROC_TIMING_SEARCH,
16002 	SVMP_SAMPCOL_PKTPROC_CHAN_EST_1,
16003 	SVMP_SAMPCOL_PKTPROC_LEG_SIG_DEC,
16004 	SVMP_SAMPCOL_PKTPROC_SIG_DECODE_1,
16005 	SVMP_SAMPCOL_PKTPROC_SIG_DECODE_2,
16006 	SVMP_SAMPCOL_PKTPROC_HT_AGC,
16007 	SVMP_SAMPCOL_PKTPROC_CHAN_EST_2,
16008 	SVMP_SAMPCOL_PKTPROC_PAY_DECODE,
16009 	SVMP_SAMPCOL_PKTPROC_DSSS_CCK_PHY,
16010 	SVMP_SAMPCOL_PKTPROC_WAIT_ENERGY_DROP,
16011 	SVMP_SAMPCOL_PKTPROC_WAIT_NCLKS,
16012 	SVMP_SAMPCOL_PKTPROC_PAY_DEC_EXT,
16013 	SVMP_SAMPCOL_PKTPROC_SIG_FAIL_DELAY,
16014 	SVMP_SAMPCOL_PKTPROC_RIFS_SEARCH,
16015 	SVMP_SAMPCOL_PKTPROC_BOARD_SWITCH_DIV_SEARCH,
16016 	SVMP_SAMPCOL_PKTPROC_DSSS_CCK_BOARD_SWITCH_DIV_SEARCH,
16017 	SVMP_SAMPCOL_PKTPROC_CHAN_EST_3,
16018 	SVMP_SAMPCOL_PKTPROC_CHAN_EST_4,
16019 	SVMP_SAMPCOL_PKTPROC_FINE_TIMING_SEARCH,
16020 	SVMP_SAMPCOL_PKTPROC_SET_CLIP_GAIN,
16021 	SVMP_SAMPCOL_PKTPROC_NAP,
16022 	SVMP_SAMPCOL_PKTPROC_VHT_SIGA_DEC,
16023 	SVMP_SAMPCOL_PKTPROC_VHT_SIGB_DEC,
16024 	SVMP_SAMPCOL_PKTPROC_PKT_ABORT,
16025 	SVMP_SAMPCOL_PKTPROC_DCCAL
16026 };
16027 
16028 /** IOVAR 'svmp_mem' parameter. Used to read/clear svmp memory */
16029 typedef struct svmp_mem {
16030 	uint32 addr;	/**< offset to read svmp memory from vasip base address */
16031 	uint16 len;	/**< length in count of uint16's */
16032 	uint16 val;	/**< set the range of addr/len with a value */
16033 } svmp_mem_t;
16034 
16035 /** IOVAR 'mu_rate' parameter. read/set mu rate for upto four users */
16036 #define MU_RATE_CFG_VERSION	1
16037 typedef struct mu_rate {
16038 	uint16	version;	/**< version of the structure as defined by MU_RATE_CFG_VERSION */
16039 	uint16	length;		/**< length of entire structure */
16040 	uint8	auto_rate;	/**< enable/disable auto rate */
16041 	uint8	PAD;
16042 	uint16	rate_user[4];	/**< rate per each of four users, set to -1 for no change */
16043 } mu_rate_t;
16044 
16045 /** IOVAR 'mu_group' parameter. Used to set and read MU group recommendation setting */
16046 #define WL_MU_GROUP_AUTO_COMMAND      -1
16047 #define WL_MU_GROUP_PARAMS_VERSION     3
16048 #define WL_MU_GROUP_METHOD_NAMELEN    64
16049 #define WL_MU_GROUP_NGROUP_MAX        15
16050 #define WL_MU_GROUP_NUSER_MAX          4
16051 #define WL_MU_GROUP_METHOD_MIN         0
16052 #define WL_MU_GROUP_NUMBER_AUTO_MIN    1
16053 #define WL_MU_GROUP_NUMBER_AUTO_MAX   15
16054 #define WL_MU_GROUP_NUMBER_FORCED_MAX  8
16055 #define WL_MU_GROUP_METHOD_OLD         0
16056 #define WL_MU_GROUP_MODE_AUTO          0
16057 #define WL_MU_GROUP_MODE_FORCED        1
16058 #define WL_MU_GROUP_FORCED_1GROUP      1
16059 #define WL_MU_GROUP_ENTRY_EMPTY       -1
16060 typedef struct mu_group {
16061 	uint32 version;          /* version */
16062 	int16  forced;           /* forced group recommendation */
16063 	int16  forced_group_mcs; /* forced group with mcs */
16064 	int16  forced_group_num; /* forced group number */
16065 	int16  group_option[WL_MU_GROUP_NGROUP_MAX][WL_MU_GROUP_NUSER_MAX];
16066 	                         /* set mode for forced grouping and read mode for auto grouping */
16067 	int16  group_GID[WL_MU_GROUP_NGROUP_MAX];
16068 	int16  group_method;     /* methof for VASIP group recommendation */
16069 	int16  group_number;     /* requested number for VASIP group recommendation */
16070 	int16  auto_group_num;   /* exact number from VASIP group recommendation */
16071 	int8   group_method_name[WL_MU_GROUP_METHOD_NAMELEN];
16072 	uint8  PAD[2];
16073 } mu_group_t;
16074 
16075 typedef struct mupkteng_sta {
16076     struct ether_addr ea;
16077 	uint8  PAD[2];
16078     int32 nrxchain;
16079     int32 idx;
16080 } mupkteng_sta_t;
16081 
16082 typedef struct mupkteng_client {
16083     int32 rspec;
16084     int32 idx;
16085     int32 flen;
16086     int32 nframes;
16087 } mupkteng_client_t;
16088 
16089 typedef struct mupkteng_tx {
16090     mupkteng_client_t client[8];
16091     int32 nclients;
16092     int32 ntx;
16093 } mupkteng_tx_t;
16094 
16095 /*
16096  * MU Packet engine interface.
16097  * The following two definitions will go into
16098  * wlioctl_defs.h
16099  * when wl utility changes are merged to EAGLE TOB & Trunk
16100  */
16101 
16102 #define WL_MUPKTENG_PER_TX_START		0x10
16103 #define WL_MUPKTENG_PER_TX_STOP		        0x20
16104 
16105 /** IOVAR 'mu_policy' parameter. Used to configure MU admission control policies */
16106 #define WL_MU_POLICY_PARAMS_VERSION     1
16107 #define WL_MU_POLICY_SCHED_DEFAULT	60
16108 #define WL_MU_POLICY_DISABLED		0
16109 #define WL_MU_POLICY_ENABLED		1
16110 #define WL_MU_POLICY_NRX_MIN		1
16111 #define WL_MU_POLICY_NRX_MAX		2
16112 typedef struct mu_policy {
16113 	uint16 version;
16114 	uint16 length;
16115 	uint32 sched_timer;
16116 	uint32 pfmon;
16117 	uint32 pfmon_gpos;
16118 	uint32 samebw;
16119 	uint32 nrx;
16120 	uint32 max_muclients;
16121 } mu_policy_t;
16122 
16123 #define WL_NAN_BAND_STR_SIZE 5       /* sizeof ("auto") */
16124 
16125 /** Definitions of different NAN Bands */
16126 /* do not change the order */
16127 enum {
16128 		NAN_BAND_B = 0,
16129 		NAN_BAND_A,
16130 		NAN_BAND_AUTO,
16131 		NAN_BAND_INVALID = 0xFF
16132 };
16133 
16134 /* ifdef WL11ULB */
16135 /* ULB Mode configured via "ulb_mode" IOVAR */
16136 enum {
16137     ULB_MODE_DISABLED = 0,
16138     ULB_MODE_STD_ALONE_MODE = 1,    /* Standalone ULB Mode */
16139     ULB_MODE_DYN_MODE = 2,      /* Dynamic ULB Mode */
16140 	/* Add all other enums before this */
16141     MAX_SUPP_ULB_MODES
16142 };
16143 
16144 /* ULB BWs configured via "ulb_bw" IOVAR during Standalone Mode Only.
16145  * Values of this enumeration are also used to specify 'Current Operational Bandwidth'
16146  * and 'Primary Operational Bandwidth' sub-fields in 'ULB Operations' field (used in
16147  * 'ULB Operations' Attribute or 'ULB Mode Switch' Attribute)
16148  */
16149 typedef enum {
16150     ULB_BW_DISABLED = 0,
16151     ULB_BW_10MHZ    = 1,    /* Standalone ULB BW in 10 MHz BW */
16152     ULB_BW_5MHZ = 2,    /* Standalone ULB BW in 5 MHz BW */
16153     ULB_BW_2P5MHZ   = 3,    /* Standalone ULB BW in 2.5 MHz BW */
16154 	/* Add all other enums before this */
16155     MAX_SUPP_ULB_BW
16156 } ulb_bw_type_t;
16157 /* endif WL11ULB */
16158 
16159 #define WL_MESH_IOCTL_VERSION     1
16160 #define MESH_IOC_BUFSZ            512 /* sufficient ioc buff size for mesh */
16161 
16162 #ifdef WLMESH
16163 typedef struct mesh_peer_info_ext {
16164 	mesh_peer_info_t        peer_info;
16165 	uint8   pad1;
16166 	uint16  local_aid;      /* AID generated by *local* to peer */
16167 	uint32  entry_state;    /* see MESH_PEER_ENTRY_STATE_ACTIVE etc; valid
16168 				* ONLY for internal peering requests
16169 				*/
16170 	int8 rssi;
16171 	uint8 pad2;
16172 	struct ether_addr ea; /* peer ea */
16173 } mesh_peer_info_ext_t;
16174 
16175 /* #ifdef WLMESH */
16176 typedef struct mesh_peer_info_dump {
16177 	uint32 buflen;
16178 	uint32 version;
16179 	uint16 count;   /* number of results */
16180 	uint16 remaining; /* remaining rsults */
16181 	mesh_peer_info_ext_t    mpi_ext[1];
16182 } mesh_peer_info_dump_t;
16183 #define WL_MESH_PEER_RES_FIXED_SIZE (sizeof(mesh_peer_info_dump_t) - sizeof(mesh_peer_info_ext_t))
16184 
16185 #endif /* WLMESH */
16186 /* container for mesh iovtls & events */
16187 typedef struct wl_mesh_ioc {
16188 	uint16  version;        /* interface command or event version */
16189 	uint16  id;             /* mesh ioctl cmd  ID  */
16190 	uint16  len;            /* total length of all tlv records in data[]  */
16191 	uint16  pad;            /* pad to be 32 bit aligment */
16192 	uint8   data[];       /* var len payload of bcm_xtlv_t type */
16193 } wl_mesh_ioc_t;
16194 
16195 enum wl_mesh_cmds {
16196 	WL_MESH_CMD_ENABLE = 1,
16197 	WL_MESH_CMD_JOIN = 2,
16198 	WL_MESH_CMD_PEER_STATUS = 3,
16199 	WL_MESH_CMD_ADD_ROUTE = 4,
16200 	WL_MESH_CMD_DEL_ROUTE = 5,
16201 	WL_MESH_CMD_ADD_FILTER = 6,
16202 	WL_MESH_CMD_ENAB_AL_METRIC = 7
16203 };
16204 
16205 enum wl_mesh_cmd_xtlv_id {
16206 	WL_MESH_XTLV_ENABLE = 1,
16207 	WL_MESH_XTLV_JOIN = 2,
16208 	WL_MESH_XTLV_STATUS = 3,
16209 	WL_MESH_XTLV_ADD_ROUTE = 4,
16210 	WL_MESH_XTLV_DEL_ROUTE = 5,
16211 	WL_MESH_XTLV_ADD_FILTER = 6,
16212 	WL_MESH_XTLV_ENAB_AIRLINK = 7
16213 };
16214 /* endif WLMESH */
16215 
16216 /* Fast BSS Transition parameter configuration */
16217 #define FBT_PARAM_CURRENT_VERSION 0
16218 
16219 typedef struct _wl_fbt_params {
16220 	uint16	version;		/* version of the structure
16221 					* as defined by FBT_PARAM_CURRENT_VERSION
16222 					*/
16223 	uint16	length;			/* length of the entire structure */
16224 
16225 	uint16 param_type;		/* type of parameter defined below */
16226 	uint16 param_len;		/* length of the param_value */
16227 	uint8 param_value[1];		/* variable length */
16228 } wl_fbt_params_t;
16229 
16230 #define WL_FBT_PARAM_TYPE_RSNIE			0
16231 #define WL_FBT_PARAM_TYPE_FTIE			0x1
16232 #define WL_FBT_PARAM_TYPE_SNONCE		0x2
16233 #define WL_FBT_PARAM_TYPE_MDE			0x3
16234 #define WL_FBT_PARAM_TYPE_PMK_R0_NAME		0x4
16235 #define WL_FBT_PARAM_TYPE_R0_KHID		0x5
16236 #define WL_FBT_PARAM_TYPE_R1_KHID		0x6
16237 #define WL_FBT_PARAM_TYPE_FIRST_INVALID		0x7
16238 
16239 /* Assoc Mgr commands for fine control of assoc */
16240 #define WL_ASSOC_MGR_CURRENT_VERSION  0x0
16241 
16242 typedef struct {
16243 	uint16	version;		/* version of the structure as
16244 					 * defined by WL_ASSOC_MGR_CURRENT_VERSION
16245 					 */
16246 	uint16	length;			/* length of the entire structure */
16247 
16248 	uint16 cmd;
16249 	uint16 params;
16250 } wl_assoc_mgr_cmd_t;
16251 
16252 #define WL_ASSOC_MGR_CMD_PAUSE_ON_EVT		0 /* have assoc pause on certain events */
16253 #define WL_ASSOC_MGR_CMD_ABORT_ASSOC		1
16254 
16255 #define WL_ASSOC_MGR_PARAMS_EVENT_NONE			0 /* use this to resume as well as clear */
16256 #define WL_ASSOC_MGR_PARAMS_PAUSE_EVENT_AUTH_RESP	1
16257 
16258 #define WL_WINVER_STRUCT_VER_1 (1)
16259 
16260 typedef struct wl_winver {
16261 
16262 	/* Version and length of this structure. Length includes all fields in wl_winver_t */
16263 	uint16 struct_version;
16264 	uint16 struct_length;
16265 
16266 	/* Windows operating system version info (Microsoft provided) */
16267 	struct {
16268 		uint32 major_ver;
16269 		uint32 minor_ver;
16270 		uint32 build;
16271 	} os_runtime;
16272 
16273 	/* NDIS runtime version (Microsoft provided) */
16274 	struct {
16275 		uint16 major_ver;
16276 		uint16 minor_ver;
16277 	} ndis_runtime;
16278 
16279 	/* NDIS Driver version (Broadcom provided) */
16280 	struct {
16281 		uint16 major_ver;
16282 		uint16 minor_ver;
16283 	} ndis_driver;
16284 
16285 	/* WDI Upper Edge (UE) Driver version (Microsoft provided) */
16286 	struct {
16287 		uint8 major_ver;
16288 		uint8 minor_ver;
16289 		uint8 suffix;
16290 	} wdi_ue;
16291 
16292 	/* WDI Lower Edge (LE) Driver version (Broadcom provided) */
16293 	struct {
16294 		uint8 major_ver;
16295 		uint8 minor_ver;
16296 		uint8 suffix;
16297 	} wdi_le;
16298 	uint8 PAD[2];
16299 } wl_winver_t;
16300 
16301 /* defined(WLRCC) || defined(ROAM_CHANNEL_CACHE) */
16302 #define MAX_ROAM_CHANNEL      20
16303 typedef struct {
16304 	int32 n;
16305 	chanspec_t channels[MAX_ROAM_CHANNEL];
16306 } wl_roam_channel_list_t;
16307 /* endif RCC || ROAM_CHANNEL_CACHE */
16308 
16309 /* values for IOV_MFP arg */
16310 enum {
16311     WL_MFP_NONE = 0,
16312     WL_MFP_CAPABLE,
16313     WL_MFP_REQUIRED
16314 };
16315 
16316 typedef enum {
16317 	CHANSW_UNKNOWN = 0,	/* channel switch due to unknown reason */
16318 	CHANSW_SCAN = 1,	/* channel switch due to scan */
16319 	CHANSW_PHYCAL = 2,	/* channel switch due to phy calibration */
16320 	CHANSW_INIT = 3,	/* channel set at WLC up time */
16321 	CHANSW_ASSOC = 4,	/* channel switch due to association */
16322 	CHANSW_ROAM = 5,	/* channel switch due to roam */
16323 	CHANSW_MCHAN = 6,	/* channel switch triggered by mchan module */
16324 	CHANSW_IOVAR = 7,	/* channel switch due to IOVAR */
16325 	CHANSW_CSA_DFS = 8,	/* channel switch due to chan switch  announcement from AP */
16326 	CHANSW_APCS = 9,	/* Channel switch from AP channel select module */
16327 	CHANSW_AWDL = 10,	/* channel switch due to AWDL */
16328 	CHANSW_FBT = 11,	/* Channel switch from FBT module for action frame response */
16329 	CHANSW_UPDBW = 12,	/* channel switch at update bandwidth */
16330 	CHANSW_ULB = 13,	/* channel switch at ULB */
16331 	CHANSW_LAST = 14	/* last channel switch reason */
16332 } chansw_reason_t;
16333 
16334 /*
16335  * WOWL unassociated mode power svae pattern.
16336  */
16337 typedef struct wowl_radio_duty_cycle {
16338 	uint16 wake_interval;
16339 	uint16  sleep_interval;
16340 } wowl_radio_duty_cycle_t;
16341 
16342 typedef struct nd_ra_ol_limits {
16343 	uint16 version;         /* version of the iovar buffer */
16344 	uint16 type;            /* type of data provided */
16345 	uint16 length;          /* length of the entire structure */
16346 	uint16 pad1;            /* pad union to 4 byte boundary */
16347 	union {
16348 		struct {
16349 			uint16 min_time;         /* seconds, min time for RA offload hold */
16350 			uint16 lifetime_percent;
16351 			/* percent, lifetime percentage for offload hold time */
16352 		} lifetime_relative;
16353 		struct {
16354 			uint16 hold_time;        /* seconds, RA offload hold time */
16355 			uint16 pad2;             /* unused */
16356 		} fixed;
16357 	} limits;
16358 } nd_ra_ol_limits_t;
16359 
16360 #define ND_RA_OL_LIMITS_VER 1
16361 
16362 /* nd_ra_ol_limits sub-types */
16363 #define ND_RA_OL_LIMITS_REL_TYPE   0     /* relative, percent of RA lifetime */
16364 #define ND_RA_OL_LIMITS_FIXED_TYPE 1     /* fixed time */
16365 
16366 /* buffer lengths for the different nd_ra_ol_limits types */
16367 #define ND_RA_OL_LIMITS_REL_TYPE_LEN   12
16368 #define ND_RA_OL_LIMITS_FIXED_TYPE_LEN  10
16369 
16370 /*
16371  * Temperature Throttling control mode
16372  */
16373 typedef struct wl_temp_control {
16374 	uint8 enable;
16375 	uint8 PAD;
16376 	uint16 control_bit;
16377 } wl_temp_control_t;
16378 
16379 /* SensorHub Interworking mode */
16380 
16381 #define SHUB_CONTROL_VERSION    1
16382 #define SHUB_CONTROL_LEN    12
16383 
16384 typedef struct {
16385 	uint16  verison;
16386 	uint16  length;
16387 	uint16  cmd;
16388 	uint16  op_mode;
16389 	uint16  interval;
16390 	uint16  enable;
16391 } shub_control_t;
16392 
16393 /* WLC_MAJOR_VER <= 5 */
16394 /* Data structures for non-TLV format */
16395 
16396 /* Data structures for rsdb caps */
16397 /*
16398  * The flags field of the rsdb_caps_response is designed to be
16399  * a Bit Mask. As of now only Bit 0 is used as mentioned below.
16400  */
16401 
16402 /* Bit-0 in flags is used to indicate if the cores can operate synchronously
16403 * i.e either as 2x2 MIMO or 2(1x1 SISO). This is true only for 4349 variants
16404 * 0 - device can operate only in rsdb mode (eg: 4364)
16405 * 1 - device can operate in both rsdb and mimo (eg : 4359 variants)
16406 */
16407 
16408 #define WL_RSDB_CAPS_VER 2
16409 #define SYNCHRONOUS_OPERATION_TRUE	(1 << 0)
16410 #define WL_RSDB_CAPS_FIXED_LEN  OFFSETOF(rsdb_caps_response_t, num_chains)
16411 
16412 typedef struct rsdb_caps_response {
16413 	uint8 ver;		/* Version */
16414 	uint8 len;		/* length of this structure excluding ver and len */
16415 	uint8 rsdb;		/* TRUE for rsdb chip */
16416 	uint8 num_of_cores;	/* no of d11 cores */
16417 	uint16 flags;		/* Flags to indicate various capabilities */
16418 	uint8 num_chains[1];	/* Tx/Rx chains for each core */
16419 } rsdb_caps_response_t;
16420 
16421 /* Data structures for rsdb bands */
16422 
16423 #define WL_RSDB_BANDS_VER       2
16424 #define WL_RSDB_BANDS_FIXED_LEN  OFFSETOF(rsdb_bands_t, band)
16425 
16426 typedef struct rsdb_bands
16427 {
16428 	uint8 ver;
16429 	uint8 len;
16430 	uint16 num_cores;	/* num of D11 cores */
16431 	int16 band[1];		/* The band operating on each of the d11 cores */
16432 } rsdb_bands_t;
16433 
16434 /* rsdb config */
16435 
16436 #define WL_RSDB_CONFIG_VER 3
16437 #define ALLOW_SIB_PARALLEL_SCAN	(1 << 0)
16438 #define MAX_BANDS 2
16439 
16440 #define WL_RSDB_CONFIG_LEN sizeof(rsdb_config_t)
16441 
16442 typedef uint8 rsdb_opmode_t;
16443 typedef uint32 rsdb_flags_t;
16444 
16445 typedef enum rsdb_modes {
16446 	WLC_SDB_MODE_NOSDB_MAIN = 1, /* 2X2 or MIMO mode (applicable only for 4355) */
16447 	WLC_SDB_MODE_NOSDB_AUX = 2,
16448 	WLC_SDB_MODE_SDB_MAIN = 3, /* This is RSDB mode(default) applicable only for 4364 */
16449 	WLC_SDB_MODE_SDB_AUX = 4,
16450 	WLC_SDB_MODE_SDB_AUTO = 5, /* Same as WLC_RSDB_MODE_RSDB(1+1) mode above */
16451 } rsdb_modes_t;
16452 
16453 typedef struct rsdb_config {
16454 	uint8 ver;
16455 	uint8 len;
16456 	uint16 reserved;
16457 	rsdb_opmode_t non_infra_mode;
16458 	rsdb_opmode_t infra_mode[MAX_BANDS];
16459 	rsdb_flags_t flags[MAX_BANDS];
16460 	rsdb_opmode_t current_mode;   /* Valid only in GET, returns the current mode */
16461 	uint8  pad[3];
16462 } rsdb_config_t;
16463 
16464 /* WLC_MAJOR_VER > =5 */
16465 /* TLV definitions and data structures for rsdb subcmds */
16466 
16467 enum wl_rsdb_cmd_ids {
16468 	/* RSDB ioctls */
16469 	WL_RSDB_CMD_VER = 0,
16470 	WL_RSDB_CMD_CAPS = 1,
16471 	WL_RSDB_CMD_BANDS = 2,
16472 	WL_RSDB_CMD_CONFIG = 3,
16473 	/* Add before this !! */
16474 	WL_RSDB_CMD_LAST
16475 };
16476 #define WL_RSDB_IOV_VERSION	0x1
16477 
16478 typedef struct rsdb_caps_response_v1 {
16479 	uint8 rsdb;		/* TRUE for rsdb chip */
16480 	uint8 num_of_cores;	/* no of d11 cores */
16481 	uint16 flags;		/* Flags to indicate various capabilities */
16482 	uint8 num_chains[MAX_NUM_D11CORES];	/* Tx/Rx chains for each core */
16483 	uint8 band_cap[MAX_NUM_D11CORES]; /* band cap bitmask per slice */
16484 } rsdb_caps_response_v1_t;
16485 
16486 typedef struct rsdb_bands_v1
16487 {
16488 	uint8 num_cores;		/* num of D11 cores */
16489 	uint8 pad;			/* padding bytes for 4 byte alignment */
16490 	int8 band[MAX_NUM_D11CORES];	/* The band operating on each of the d11 cores */
16491 } rsdb_bands_v1_t;
16492 
16493 typedef struct rsdb_config_xtlv {
16494 	rsdb_opmode_t reserved1;	/* Non_infra mode is no more applicable */
16495 	rsdb_opmode_t infra_mode[MAX_BANDS]; /* Target mode for Infra association */
16496 	uint8 pad;	/* pad bytes for 4 byte alignment */
16497 	rsdb_flags_t  flags[MAX_BANDS];
16498 	rsdb_opmode_t current_mode; /* GET only; has current mode of operation */
16499 	uint8 pad1[3];
16500 } rsdb_config_xtlv_t;
16501 
16502 /* Definitions for slot_bss chanseq iovar */
16503 #define WL_SLOT_BSS_VERSION 1
16504 
16505 /* critical slots max size */
16506 #define WL_SLOTTED_BSS_CS_BMP_CFG_MAX_SZ	128 /* arbitrary */
16507 
16508 enum wl_slotted_bss_cmd_id {
16509 	WL_SLOTTED_BSS_CMD_VER = 0,
16510 	WL_SLOTTED_BSS_CMD_CHANSEQ = 1,
16511 	WL_SLOTTED_BSS_CMD_CS_BMP = 2 /* critical slots bitmap */
16512 };
16513 typedef uint16 chan_seq_type_t;
16514 enum chan_seq_type {
16515 	CHAN_SEQ_TYPE_AWDL = 1,
16516 	CHAN_SEQ_TYPE_SLICE = 2,
16517 	CHAN_SEQ_TYPE_NAN = 3
16518 };
16519 typedef uint8 sched_flag_t;
16520 enum sched_flag {
16521 	NO_SDB_SCHED = 0x1,
16522 	SDB_TDM_SCHED = 0x2,
16523 	SDB_SPLIT_BAND_SCHED = 0x4, /* default mode for 4357 */
16524 	MAIN_ONLY = 0x8,
16525 	AUX_ONLY = 0x10,
16526 	SDB_DUAL_TIME = (MAIN_ONLY | AUX_ONLY),
16527 	NO_SDB_MAIN_ONLY = (NO_SDB_SCHED | MAIN_ONLY), /* default mode for 4364 */
16528 	SDB_TDM_SCHED_MAIN = (SDB_TDM_SCHED | MAIN_ONLY),
16529 	SDB_TDM_SCHED_AUX = (SDB_TDM_SCHED | AUX_ONLY),
16530 	SDB_TDM_SCHED_DUAL_TIME = (SDB_TDM_SCHED | SDB_DUAL_TIME),
16531 	SDB_SPLIT_BAND_SCHED_DUAL_TIME = (SDB_SPLIT_BAND_SCHED | SDB_DUAL_TIME)
16532 };
16533 
16534 typedef struct chan_seq_tlv_data {
16535 	uint32 flags;
16536 	uint8 data[1];
16537 } chan_seq_tlv_data_t;
16538 
16539 typedef struct chan_seq_tlv {
16540 	chan_seq_type_t type;
16541 	uint16 len;
16542 	chan_seq_tlv_data_t chanseq_data[1];
16543 } chan_seq_tlv_t;
16544 
16545 typedef struct sb_channel_sequence {
16546 	sched_flag_t sched_flags; /* (sdb-tdm or sdb-sb or Dual-Time) */
16547 	uint8 num_seq; /* number of chan_seq_tlv following */
16548 	uint16 pad;
16549 	chan_seq_tlv_t seq[1];
16550 } sb_channel_sequence_t;
16551 
16552 typedef struct slice_chan_seq {
16553 	uint8 slice_index;  /* 0(Main) or 1 (Aux) */
16554 	uint8 num_chanspecs;
16555 	uint8 dur;
16556 	uint8 pad;
16557 	chanspec_t chanspecs[1];
16558 } slice_chan_seq_t;
16559 
16560 #define SLOT_BSS_SLICE_TYPE_DUR_MAX_RANGE	2u
16561 #define SLOTTED_BSS_AGGR_EN			(1 << 0)    /* Bitmap of mode */
16562 #define SLOTTED_BSS_AGGR_LIMIT_DUR	        (1 << 1)    /* Jira 49554 */
16563 
16564 #define WL_SLICE_CHAN_SEQ_FIXED_LEN   OFFSETOF(slice_chan_seq_t, chanspecs)
16565 /* Definitions for slotted_bss stats */
16566 #define SBSS_STATS_VERSION 1
16567 #define SBSS_STATS_CURRENT_VERSION SBSS_STATS_VERSION
16568 
16569 #define SBSS_MAX_CHAN_STATS 4
16570 
16571 typedef struct sbss_core_stats {
16572 	uint32 sb_slot_start;
16573 	uint32 sb_slot_end;
16574 	uint32 sb_slot_skip;
16575 	uint32 mismatch_count;
16576 } sbss_core_stats_t;
16577 
16578 typedef struct sbss_chan_stats {
16579 	chanspec_t chanspec;
16580 	uint32 slot_start;
16581 	uint32 slot_end;
16582 	uint32 slot_skip;
16583 } sbss_chan_stats_t;
16584 
16585 typedef struct sbss_stats_v1 {
16586 	uint16 version;
16587 	uint16 length;
16588 	sbss_core_stats_t corestats[MAX_NUM_D11CORES];
16589 	sbss_chan_stats_t sbss_chanstats[MAX_NUM_D11CORES][SBSS_MAX_CHAN_STATS];
16590 } sbss_stats_t;
16591 
16592 /* slotted bss critical slots */
16593 typedef struct wl_sbss_cs_bmp_s {
16594 	uint8 bitmap_len;
16595 	uint8 pad[3];
16596 	uint8 bitmap[];
16597 } wl_sbss_cs_bmp_t;
16598 
16599 typedef struct sim_pm_params {
16600 	uint32 enabled;
16601 	uint16 cycle;
16602 	uint16 up;
16603 } sim_pm_params_t;
16604 
16605 /* Digital napping status */
16606 #define WL_NAP_STATUS_VERSION_1		1
16607 typedef struct wl_nap_status_v1 {
16608 	uint16 version;			/* structure version  */
16609 	uint16 len;			/* length of returned data */
16610 	uint16 fw_status;		/* bitmask of FW disable reasons */
16611 	uint8  hw_status;		/* bitmask for actual HW state info */
16612 	uint8  slice_index;		/* which slice this represents */
16613 	uint32 total_disable_dur;       /* total time (ms) disabled for fw_status */
16614 } wl_nap_status_v1_t;
16615 
16616 /* Bits for fw_status */
16617 #define NAP_DISABLED_HOST		0x0001   /* Host has disabled through nap_enable */
16618 #define NAP_DISABLED_RSSI		0x0002   /* Disabled because of nap_rssi_threshold */
16619 #define NAP_DISABLED_SCAN		0x0004   /* Disabled because of scan */
16620 #define NAP_DISABLED_ASSOC		0x0008   /* Disabled because of association */
16621 #define NAP_DISABLED_LTE		0x0010   /* Disabled because of LTE */
16622 #define NAP_DISABLED_ACI		0x0020   /* Disabled because of ACI mitigation */
16623 
16624 /* Bits for hw_status */
16625 #define NAP_HWCFG			0x01   /* State of NAP config bit in phy HW */
16626 #define NAP_NOCLK			0x80   /* No clock to read HW (e.g. core down) */
16627 
16628 /* ifdef WL_NATOE */
16629 #define WL_NATOE_IOCTL_VERSION		1
16630 #define WL_NATOE_IOC_BUFSZ		512	/* sufficient ioc buff size for natoe */
16631 #define WL_NATOE_DBG_STATS_BUFSZ	2048
16632 #define NATOE_FLAGS_ENAB_MASK		0x1
16633 #define NATOE_FLAGS_ACTIVE_MASK		0x2
16634 #define NATOE_FLAGS_PUBNW_MASK		0x4
16635 #define NATOE_FLAGS_PVTNW_MASK		0x8
16636 #define NATOE_FLAGS_ENAB_SHFT_MASK	0
16637 #define NATOE_FLAGS_ACTIVE_SHFT_MASK	1
16638 #define NATOE_FLAGS_PUBNW_SHFT_MASK	2
16639 #define NATOE_FLAGS_PVTNW_SHFT_MASK	3
16640 #define NATOE_FLAGS_PUB_NW_UP	(1 << NATOE_FLAGS_PUBNW_SHFT_MASK)
16641 #define NATOE_FLAGS_PVT_NW_UP	(1 << NATOE_FLAGS_PVTNW_SHFT_MASK)
16642 
16643 #define PCIE_FRWDPKT_STATS_VERSION	1
16644 
16645 /* Module version is 1 for IGUANA */
16646 #define WL_NATOE_MODULE_VER_1	1
16647 /* Module version is 2 for Lemur */
16648 #define WL_NATOE_MODULE_VER_2	2
16649 
16650 /* WL_NATOE_CMD_MOD_VER */
16651 typedef uint16 wl_natoe_ver_t;
16652 /* config natoe STA and AP IP's structure */
16653 typedef struct {
16654 	uint32 sta_ip;
16655 	uint32 sta_netmask;
16656 	uint32 sta_router_ip;
16657 	uint32 sta_dnsip;
16658 	uint32 ap_ip;
16659 	uint32 ap_netmask;
16660 } wl_natoe_config_ips_t;
16661 
16662 /* natoe ports config structure */
16663 typedef struct {
16664 	uint16 start_port_num;
16665 	uint16 no_of_ports;
16666 } wl_natoe_ports_config_t;
16667 
16668 /* natoe ports exception info */
16669 typedef struct {
16670 	uint16 sta_port_num;
16671 	uint16 dst_port_num;    /* for SIP type protocol, dst_port_num info can be ignored by FW */
16672 	uint32 ip;              /* for SIP ip is APcli_ip and for port clash it is dst_ip */
16673 	uint8  entry_type;      /* Create/Destroy */
16674 	uint8  pad[3];
16675 } wl_natoe_exception_port_t;
16676 
16677 /* container for natoe ioctls & events */
16678 typedef struct wl_natoe_ioc {
16679 	uint16  version;        /* interface command or event version */
16680 	uint16  id;             /* natoe ioctl cmd  ID  */
16681 	uint16  len;            /* total length of all tlv records in data[]  */
16682 	uint16  pad;            /* pad to be 32 bit aligment */
16683 	uint8   data[];       /* var len payload of bcm_xtlv_t type */
16684 } wl_natoe_ioc_t;
16685 
16686 typedef struct wl_natoe_pool_stats_v1 {
16687 	/* For debug purposes */
16688 	uint16 poolreorg_cnt;
16689 	uint16 poolrevert_cnt;
16690 	uint16 txfrag_state;
16691 	uint16 rxfrag_state;
16692 	uint16 txfrag_plen;
16693 	uint16 rxfrag_plen;
16694 	uint16 tx_pavail;
16695 	uint16 rx_pavail;
16696 	uint16 txmin_bkup_bufs;
16697 	uint16 rxmin_bkup_bufs;
16698 	uint16 pktpool_sbuf_alloc;
16699 	uint16 pktpool_plen;
16700 	uint16 pktpool_pavail;
16701 	/* Peak shared buffer count in all iterations */
16702 	uint16 sbuf_peak;
16703 	/* Peak shared buffer count in current D3 iteration */
16704 	uint16 sbuf_peak_cur;
16705 } wl_natoe_pool_stats_v1_t;
16706 
16707 typedef struct wl_natoe_arp_entry_v1 {
16708 	struct ipv4_addr ip;
16709 	struct ether_addr mac_addr;
16710 	uint8  lifetime;
16711 	uint8 flags;
16712 } wl_natoe_arp_entry_v1_t;
16713 
16714 typedef struct wl_natoe_dbg_arp_tbl_info_v1 {
16715 	uint8 valid_arp_entries;
16716 	uint8 PAD[3];
16717 	wl_natoe_arp_entry_v1_t arp_ent[];
16718 } wl_natoe_dbg_arp_tbl_info_v1_t;
16719 
16720 typedef struct wl_natoe_skip_port_entry_v1 {
16721 	struct ipv4_addr srcip;
16722 	uint16 src_port;
16723 	uint16 lifetime;
16724 } wl_natoe_skip_port_entry_v1_t;
16725 
16726 typedef struct wl_natoe_skip_port_info_v1 {
16727 	uint8 valid_entries;
16728 	uint8 PAD[3];
16729 	wl_natoe_skip_port_entry_v1_t skip_port_ent[];
16730 } wl_natoe_skip_port_info_v1_t;
16731 
16732 typedef struct wl_natoe_dbg_stats_v1 {
16733 	uint16 active_nat_entries;
16734 	uint16 active_dns_entries;
16735 	uint16 active_icmp_entries;
16736 	uint16 valid_arp_entries;
16737 	uint16 prev_nat_entries;
16738 	uint16 prev_dns_entries;
16739 	uint16 tcp_fast_reclaim_cnt;
16740 	uint16 mcast_packets;
16741 	uint16 bcast_packets;
16742 	uint16 port_commands_rcvd;
16743 	uint16 unsupported_prot;
16744 	uint16 arp_req_sent;
16745 	uint16 arp_rsp_rcvd;
16746 	uint16 non_ether_frames;
16747 	uint16 port_alloc_fail;
16748 	uint16 srcip_tbl_full;
16749 	uint16 dstip_tbl_full;
16750 	uint16 nat_tbl_full;
16751 	uint16 icmp_error_cnt;
16752 	uint16 pkt_drops_resource;
16753 	uint32 frwd_nat_pkt_cnt;
16754 	uint32 reverse_nat_pkt_cnt;
16755 	uint16 pub_nw_chspec;
16756 	uint16 pvt_nw_chspec;
16757 	uint8 pubnw_cfg_idx;
16758 	uint8 pvtnw_cfg_idx;
16759 	uint8 pubnw_cfg_ID;
16760 	uint8 pvtnw_cfg_ID;
16761 	uint16 natoe_flags;
16762 } wl_natoe_dbg_stats_v1_t;
16763 
16764 typedef struct wl_natoe_exception_port_inf_v1 {
16765 	uint16 except_bmap_size;
16766 	uint8 port_except_bmap[];
16767 } wl_natoe_exception_port_inf_v1_t;
16768 
16769 typedef struct wl_natoe_dstnat_entry_v1 {
16770 	struct ipv4_addr clientip;
16771 	struct ether_addr client_mac_addr;
16772 	uint16 client_listenport;
16773 	uint8 opcode;
16774 } wl_natoe_dstnat_entry_v1_t;
16775 
16776 typedef struct wl_pcie_frwd_stats_v1 {
16777 	uint16 version;
16778 	uint16 len;
16779 	uint16 frwd_txfrag_q_cnt; /* no. of txfrags in frwd_txfrag_list */
16780 	/* no. of outstanding lbufs in txpath on if0/ifx */
16781 	uint16 tx_frwd_n_lb_if0;
16782 	uint16 tx_frwd_n_lb_ifx;
16783 	/* no. of outstanding lfrags in txpath on if0/ifx */
16784 	uint16 tx_frwd_n_lf_if0;
16785 	uint16 tx_frwd_n_lf_ifx;
16786 	/* no. of pending frwd pkts dropped upon d3 entry */
16787 	uint16 tx_frwd_d3_drop_cnt;
16788 	/* Total no. of lbufs frwded in txpath on if0/ifx */
16789 	uint32 tx_frwd_n_lb_if0_cnt;
16790 	uint32 tx_frwd_n_lb_ifx_cnt;
16791 	/* Total no. of lfrags frwded in txpath on if0/ifx */
16792 	uint32 tx_frwd_n_lf_if0_cnt;
16793 	uint32 tx_frwd_n_lf_ifx_cnt;
16794 	uint32 frwd_tx_drop_thr_cnt; /* no. of pkts dropped due to txfrag threshold */
16795 	uint32 frwd_tx_drop_err_cnt; /* no. of pkts dropped due to txfrags not avail / errors */
16796 } wl_pcie_frwd_stats_v1_t;
16797 
16798 enum wl_natoe_cmds {
16799 	WL_NATOE_CMD_MOD_VER = 0,
16800 	WL_NATOE_CMD_ENABLE = 1,
16801 	WL_NATOE_CMD_CONFIG_IPS = 2,
16802 	WL_NATOE_CMD_CONFIG_PORTS = 3,
16803 	WL_NATOE_CMD_DBG_STATS = 4,
16804 	WL_NATOE_CMD_EXCEPTION_PORT = 5,
16805 	WL_NATOE_CMD_SKIP_PORT = 6,
16806 	WL_NATOE_CMD_TBL_CNT = 7,
16807 	WL_NATOE_CMD_CONFIG_DSTNAT = 8,
16808 	WL_NATOE_CMD_CTRL = 9
16809 };
16810 
16811 enum wl_natoe_cmd_xtlv_id {
16812 	WL_NATOE_XTLV_MOD_VER = 0,
16813 	WL_NATOE_XTLV_ENABLE = 1,
16814 	WL_NATOE_XTLV_CONFIG_IPS = 2,
16815 	WL_NATOE_XTLV_CONFIG_PORTS = 3,
16816 	WL_NATOE_XTLV_DBG_STATS = 4,
16817 	WL_NATOE_XTLV_EXCEPTION_PORT = 5,
16818 	WL_NATOE_XTLV_SKIP_PORT = 6,
16819 	WL_NATOE_XTLV_TBL_CNT = 7,
16820 	WL_NATOE_XTLV_ARP_TBL = 8,
16821 	WL_NATOE_XTLV_POOLREORG = 9,
16822 	WL_NATOE_XTLV_CONFIG_DSTNAT = 10,
16823 	WL_NATOE_XTLV_CTRL = 11
16824 };
16825 
16826 /* endif WL_NATOE */
16827 
16828 enum wl_idauth_cmd_ids {
16829 	WL_IDAUTH_CMD_CONFIG				= 1,
16830 	WL_IDAUTH_CMD_PEER_INFO				= 2,
16831 	WL_IDAUTH_CMD_COUNTERS				= 3,
16832 	WL_IDAUTH_CMD_LAST
16833 };
16834 enum wl_idauth_xtlv_id {
16835 	WL_IDAUTH_XTLV_AUTH_ENAB			= 0x1,
16836 	WL_IDAUTH_XTLV_GTK_ROTATION			= 0x2,
16837 	WL_IDAUTH_XTLV_EAPOL_COUNT			= 0x3,
16838 	WL_IDAUTH_XTLV_EAPOL_INTRVL			= 0x4,
16839 	WL_IDAUTH_XTLV_BLKLIST_COUNT			= 0x5,
16840 	WL_IDAUTH_XTLV_BLKLIST_AGE			= 0x6,
16841 	WL_IDAUTH_XTLV_PEERS_INFO			= 0x7,
16842 	WL_IDAUTH_XTLV_COUNTERS				= 0x8
16843 };
16844 enum wl_idauth_stats {
16845 	WL_AUTH_PEER_STATE_AUTHORISED			= 0x01,
16846 	WL_AUTH_PEER_STATE_BLACKLISTED			= 0x02,
16847 	WL_AUTH_PEER_STATE_4WAY_HS_ONGOING		= 0x03,
16848 	WL_AUTH_PEER_STATE_LAST
16849 };
16850 typedef struct {
16851 	uint16 state;				/* Peer State: Authorised or Blacklisted */
16852 	struct ether_addr peer_addr;		/* peer Address */
16853 	uint32 blklist_end_time;		/* Time of blacklist end */
16854 } auth_peer_t;
16855 typedef struct wl_idauth_counters {
16856 	uint32 auth_reqs;			/* No of auth req recvd */
16857 	uint32 mic_fail;			/* No of mic fails */
16858 	uint32 four_way_hs_fail;		/* No of 4-way handshake fails */
16859 } wl_idauth_counters_t;
16860 
16861 #define WLC_UTRACE_LEN		(1024u * 4u) // default length
16862 #define WLC_UTRACE_LEN_AUX	(1024u * 3u) // reduced length to fit smaller AUX BM
16863 #define WLC_UTRACE_READ_END 0
16864 #define WLC_UTRACE_MORE_DATA 1
16865 typedef struct wl_utrace_capture_args_v1 {
16866 	uint32 length;
16867 	uint32 flag;
16868 } wl_utrace_capture_args_v1_t;
16869 
16870 #define UTRACE_CAPTURE_VER_2	2
16871 typedef struct wl_utrace_capture_args_v2 {
16872 	/* structure control */
16873 	uint16 version;		/**< structure version */
16874 	uint16 length;		/**< length of the response */
16875 	uint32 flag;		/* Indicates if there is more data or not */
16876 } wl_utrace_capture_args_v2_t;
16877 
16878 /* Signal read end. */
16879 #define WLC_REGVAL_READ_END 0
16880 /* Signal more data pending. */
16881 #define WLC_REGVAL_MORE_DATA 1
16882 /* Internal read state. */
16883 #define WLC_REGVAL_READ_CONTINUE 2
16884 
16885 #define WLC_REGVAL_DUMP_PHYREG 0
16886 #define WLC_REGVAL_DUMP_RADREG 1
16887 
16888 #define PHYREGVAL_CAPTURE_BUFFER_LEN 2048
16889 
16890 typedef struct wl_regval_capture_args {
16891 	uint32 control_flag;	/* Carries status information. */
16892 } wl_regval_capture_args_t;
16893 
16894 /* XTLV IDs for the Health Check "hc" iovar top level container */
16895 enum {
16896 	WL_HC_XTLV_ID_CAT_HC = 1,		/* category for HC as a whole */
16897 	WL_HC_XTLV_ID_CAT_DATAPATH_TX = 2,	/* Datapath Tx */
16898 	WL_HC_XTLV_ID_CAT_DATAPATH_RX = 3,	/* Datapath Rx */
16899 	WL_HC_XTLV_ID_CAT_SCAN	= 4,		/* Scan */
16900 	WL_HC_XTLV_ID_CAT_EVENTMASK	= 5,		/* Health Check event mask. */
16901 };
16902 
16903 /* Health Check: Common XTLV IDs for sub-elements in the top level container
16904  * Number starts at 0x8000 to be out of the way for category specific IDs.
16905  */
16906 enum {
16907 	WL_HC_XTLV_ID_ERR       = 0x8000,       /* for sub-command  err return */
16908 	WL_HC_XTLV_ID_IDLIST    = 0x8001,       /* container for uint16 IDs */
16909 };
16910 
16911 /* Health Check: Datapath TX IDs */
16912 enum {
16913 	WL_HC_TX_XTLV_ID_VAL_STALL_THRESHOLD   = 1,     /* stall_threshold */
16914 	WL_HC_TX_XTLV_ID_VAL_STALL_SAMPLE_SIZE = 2,     /* stall_sample_size */
16915 	WL_HC_TX_XTLV_ID_VAL_STALL_TIMEOUT     = 3,     /* stall_timeout */
16916 	WL_HC_TX_XTLV_ID_VAL_STALL_FORCE       = 4,     /* stall_force */
16917 	WL_HC_TX_XTLV_ID_VAL_STALL_EXCLUDE     = 5,     /* stall_exclude */
16918 	WL_HC_TX_XTLV_ID_VAL_FC_TIMEOUT        = 6,     /* flow ctl timeout */
16919 	WL_HC_TX_XTLV_ID_VAL_FC_FORCE          = 7,     /* flow ctl force failure */
16920 	WL_HC_TX_XTLV_ID_VAL_DELAY_TO_TRAP     = 8,     /* delay threshold for forced trap */
16921 	WL_HC_TX_XTLV_ID_VAL_DELAY_TO_RPT      = 9,     /* delay threshold for event log report */
16922 	WL_HC_TX_XTLV_ID_VAL_FAILURE_TO_RPT    = 10,	/* threshold for consecutive TX failures */
16923 };
16924 
16925 /* Health Check: Datapath RX IDs */
16926 enum {
16927 	WL_HC_RX_XTLV_ID_VAL_DMA_STALL_TIMEOUT = 1,     /* dma_stall_timeout */
16928 	WL_HC_RX_XTLV_ID_VAL_DMA_STALL_FORCE   = 2,     /* dma_stall test trigger */
16929 	WL_HC_RX_XTLV_ID_VAL_STALL_THRESHOLD   = 3,     /* stall_threshold */
16930 	WL_HC_RX_XTLV_ID_VAL_STALL_SAMPLE_SIZE = 4,     /* stall_sample_size */
16931 	WL_HC_RX_XTLV_ID_VAL_STALL_FORCE       = 5,     /* stall test trigger */
16932 };
16933 
16934 /* Health Check: Datapath SCAN IDs */
16935 enum {
16936 	WL_HC_XTLV_ID_VAL_SCAN_STALL_THRESHOLD	= 1,	/* scan stall threshold */
16937 };
16938 
16939 /* Health check: PHY IDs */
16940 /* Needed for iguana 13.35 branch */
16941 typedef enum {
16942 	PHY_HC_DD_ALL		= 0,
16943 	PHY_HC_DD_TEMPSENSE	= 1,
16944 	PHY_HC_DD_VCOCAL	= 2,
16945 	PHY_HC_DD_RX		= 3,
16946 	PHY_HC_DD_TX		= 4,
16947 	PHY_HC_DD_LAST		/* This must be the last entry */
16948 } phy_hc_dd_type_t;
16949 
16950 typedef enum {
16951 	PHY_HC_DD_TEMP_FAIL	= 0,
16952 	PHY_HC_DD_VCO_FAIL	= 1,
16953 	PHY_HC_DD_RXDSN_FAIL	= 2,
16954 	PHY_HC_DD_TXPOW_FAIL	= 3,
16955 	PHY_HC_DD_END		/* This must be the last entry */
16956 } phy_hc_dd_type_v2_t;
16957 
16958 /* IDs of Health Check report structures for sub types of health checks within WL */
16959 typedef enum wl_hc_dd_type {
16960 	WL_HC_DD_PCIE = 0,		/* PCIe */
16961 	WL_HC_DD_RX_DMA_STALL = 1,	/* RX DMA stall check */
16962 	WL_HC_DD_RX_STALL = 2,		/* RX stall check */
16963 	WL_HC_DD_TX_STALL = 3,		/* TX stall check */
16964 	WL_HC_DD_SCAN_STALL = 4,	/* SCAN stall check */
16965 	WL_HC_DD_PHY = 5,		/* PHY health check */
16966 	WL_HC_DD_REINIT = 6,		/* Reinit due to other reasons */
16967 	WL_HC_DD_TXQ_STALL = 7,		/* TXQ stall */
16968 	WL_HC_DD_MAX
16969 } wl_hc_dd_type_t;
16970 
16971 /*
16972  * Health Check report structures for sub types of health checks within WL
16973  */
16974 
16975 /* Health Check report structure for Rx DMA Stall check */
16976 typedef struct {
16977 	uint16 type;
16978 	uint16 length;
16979 	uint16 timeout;
16980 	uint16 stalled_dma_bitmap;
16981 } wl_rx_dma_hc_info_t;
16982 
16983 /* Health Check report structure for Tx packet failure check */
16984 typedef struct {
16985 	uint16 type;
16986 	uint16 length;
16987 	uint32 stall_bitmap;
16988 	uint32 stall_bitmap1;
16989 	uint32 failure_ac;
16990 	uint32 threshold;
16991 	uint32 tx_all;
16992 	uint32 tx_failure_all;
16993 } wl_tx_hc_info_t;
16994 
16995 /* Health Check report structure for Rx dropped packet failure check */
16996 typedef struct {
16997 	uint16 type;
16998 	uint16 length;
16999 	uint32 bsscfg_idx;
17000 	uint32 rx_hc_pkts;
17001 	uint32 rx_hc_dropped_all;
17002 	uint32 rx_hc_alert_th;
17003 } wl_rx_hc_info_t;
17004 
17005 /* HE top level command IDs */
17006 enum {
17007 	WL_HE_CMD_ENAB = 0,
17008 	WL_HE_CMD_FEATURES = 1,
17009 	WL_HE_CMD_TWT_SETUP = 2,
17010 	WL_HE_CMD_TWT_TEARDOWN = 3,
17011 	WL_HE_CMD_TWT_INFO = 4,
17012 	WL_HE_CMD_BSSCOLOR = 5,
17013 	WL_HE_CMD_PARTIAL_BSSCOLOR = 6,
17014 	WL_HE_CMD_CAP = 7,
17015 	WL_HE_CMD_STAID = 8,
17016 	WL_HE_CMD_RTSDURTHRESH = 10,
17017 	WL_HE_CMD_PEDURATION = 11,
17018 	WL_HE_CMD_TESTBED_MODE = 12,
17019 	WL_HE_CMD_OMI = 13,
17020 	WL_HE_CMD_MAC_PAD_DUR = 14,
17021 	WL_HE_CMD_MUEDCA = 15,
17022 	WL_HE_CMD_MACCAP = 16,
17023 	WL_HE_CMD_PHYCAP = 17,
17024 	WL_HE_CMD_DISPLAY = 18,
17025 	WL_HE_CMD_ACTION = 19,
17026 	WL_HE_CMD_OFDMATX = 20,
17027 	WL_HE_CMD_20IN80_MODE = 21,
17028 	WL_HE_CMD_SMPS = 22,
17029 	WL_HE_CMD_PPETHRESH = 23,
17030 #ifdef WL11AX_TESTBED
17031 	WL_HE_CMD_HTC_OMI_EN = 24,
17032 	WL_HE_CMD_ERSU_EN = 25,
17033 	WL_HE_CMD_PREPUNCRX_EN = 26,
17034 	WL_HE_CMD_MIMOCAP_EN = 27,
17035 #endif // endif
17036 	WL_HE_CMD_LAST
17037 };
17038 
17039 /* TWT top level command IDs */
17040 enum {
17041 	WL_TWT_CMD_ENAB = 0,
17042 	WL_TWT_CMD_SETUP = 1,
17043 	WL_TWT_CMD_TEARDOWN = 2,
17044 	WL_TWT_CMD_INFO = 3,
17045 	WL_TWT_CMD_AUTOSCHED = 4,
17046 	WL_TWT_CMD_STATS = 5,
17047 	WL_TWT_CMD_EARLY_TERM_TIME = 6,
17048 	WL_TWT_CMD_RESP_CONFIG = 7,
17049 	WL_TWT_CMD_SPPS_ENAB = 8,
17050 	WL_TWT_CMD_FEATURES = 9,
17051 	WL_TWT_CMD_LAST
17052 };
17053 
17054 /* TODO: Remove the follwoing after mering TWT changes to trunk */
17055 #define WL_TWT_CMD_DEF_IN_WLIOCTL 1
17056 
17057 #define WL_HEB_VER_1	1
17058 
17059 /* HEB top level command IDs */
17060 enum {
17061 	WL_HEB_CMD_ENAB = 0,
17062 	WL_HEB_CMD_NUM_HEB = 1,
17063 	WL_HEB_CMD_COUNTERS = 2,
17064 	WL_HEB_CMD_CLEAR_COUNTERS = 3,
17065 	WL_HEB_CMD_CONFIG = 4,
17066 	WL_HEB_CMD_STATUS = 5,
17067 	WL_HEB_CMD_LAST
17068 };
17069 
17070 /* HEB counters structures */
17071 typedef struct wl_heb_int_cnt_v1 {
17072 	uint16 pre_event;
17073 	uint16 start_event;
17074 	uint16 end_event;
17075 	uint16 missed;
17076 } wl_heb_int_cnt_v1_t;
17077 
17078 typedef struct wl_heb_cnt_v1 {
17079 	/* structure control */
17080 	uint16 version;	/* structure version */
17081 	uint16 length;	/* data length (starting after this field) */
17082 	wl_heb_int_cnt_v1_t heb_int_cnt[1];
17083 } wl_heb_cnt_v1_t;
17084 
17085 // struct for configuring HEB
17086 typedef struct wl_config_heb_fill_v1 {
17087 	uint16 version;	/* structure version */
17088 	uint16 length;	/* data length (starting after this field) */
17089 	uint32 duration;
17090 	uint32 periodicity;
17091 	uint16 heb_idx;
17092 	uint16 preeventtime;
17093 	uint8 count;
17094 	uint8 PAD[3];
17095 } wl_config_heb_fill_v1_t;
17096 
17097 typedef struct wl_heb_blk_params_v1 {
17098 	/* Don't change the order of following elements. This is as per the HEB HW spec */
17099 	uint32 event_int_val_l;
17100 	uint32 event_int_val_h;
17101 	uint32 param2;
17102 	uint32 param3;
17103 	uint32 pre_event_intmsk_bmp;
17104 	uint32 start_event_intmsk_bmp;
17105 	uint32 end_event_intmsk_bmp;
17106 	uint32 event_driver_info;
17107 	uint16 param1;
17108 	uint8 event_count;
17109 	uint8 noa_invert;
17110 } wl_heb_blk_params_v1_t;
17111 
17112 typedef struct wl_heb_int_status_v1 {
17113 	uint32 heb_idx;
17114 	wl_heb_blk_params_v1_t blk_params;
17115 } wl_heb_reg_status_v1_t;
17116 
17117 typedef struct wl_heb_status_v1 {
17118 	uint16 version;	/* structure version */
17119 	uint16 length;	/* data length (starting after this field) */
17120 	wl_heb_reg_status_v1_t heb_status[1];
17121 } wl_heb_status_v1_t;
17122 
17123 /* TWT Setup descriptor */
17124 typedef struct wl_twt_sdesc {
17125 	/* Setup Command. */
17126 	uint8 setup_cmd;		/* See TWT_SETUP_CMD_XXXX in 802.11ah.h */
17127 	uint8 flow_flags;		/* Flow attributes. See WL_TWT_FLOW_FLAG_XXXX below */
17128 	uint8 flow_id;		/* must be between 0 and 7. Set 0xFF for auto assignment */
17129 	uint8 wake_type;	/* See WL_TWT_TIME_TYPE_XXXX below */
17130 	uint32 wake_time_h;	/* target wake time - BSS TSF (us) */
17131 	uint32 wake_time_l;
17132 	uint32 wake_dur;	/* target wake duration in unit of microseconds */
17133 	uint32 wake_int;	/* target wake interval */
17134 	uint32 btwt_persistence;	/* Broadcast TWT Persistence */
17135 	uint32 wake_int_max;	/* max wake interval(uS) for TWT */
17136 	uint8 duty_cycle_min;	/* min duty cycle for TWT(Percentage) */
17137 	uint8 pad;
17138 	uint8 bid;		/* must be between 0 and 31. Set 0xFF for auto assignment */
17139 	uint8 channel;		/* Twt channel - Not used for now */
17140 	uint8 negotiation_type;	/* Negotiation Type: See macros TWT_NEGO_TYPE_X */
17141 	uint8 frame_recomm;	/* frame recommendation for broadcast TWTs - Not used for now	 */
17142 	/* deprecated - to be removed */
17143 	uint16 li;
17144 
17145 } wl_twt_sdesc_t;
17146 
17147 /* Flow flags */
17148 /* [TODO] : below flags are to be applied with corresponding wl param parsing
17149 #define WL_TWT_FLOW_FLAG_UNANNOUNCED	(1u << 0u)
17150 #define WL_TWT_FLOW_FLAG_TRIGGER	(1u << 1u)
17151 #define WL_TWT_FLOW_FLAG_REQUEST	(1u << 2u)
17152 #define WL_TWT_FLOW_FLAG_PROTECT	(1u << 3u)
17153 #define WL_TWT_FLOW_FLAG_RESPONDER_PM	(1u << 4u)
17154 #define WL_TWT_FLOW_FLAG_UNSOLICITED	(1u << 5u)
17155 
17156 #define WL_TWT_FLOW_FLAG_BROADCAST	(1u << 5u)
17157 #define WL_TWT_FLOW_FLAG_WAKE_TBTT_NEGO (1u << 6u)
17158 #define WL_TWT_FLOW_FLAG_IMPLICIT	(1u << 7u)
17159 */
17160 #define WL_TWT_FLOW_FLAG_BROADCAST	(1 << 0)
17161 #define WL_TWT_FLOW_FLAG_IMPLICIT	(1 << 1)
17162 #define WL_TWT_FLOW_FLAG_UNANNOUNCED	(1 << 2)
17163 #define WL_TWT_FLOW_FLAG_TRIGGER	(1 << 3)
17164 #define WL_TWT_FLOW_FLAG_WAKE_TBTT_NEGO (1 << 4)
17165 #define WL_TWT_FLOW_FLAG_REQUEST	(1 << 5)
17166 
17167 #define WL_TWT_FLOW_FLAG_PROTECT	(1u << 0u)
17168 #define WL_TWT_FLOW_FLAG_RESPONDER_PM	(1u << 6u)
17169 #define WL_TWT_FLOW_FLAG_UNSOLICITED	(1u << 7u)
17170 
17171 /* Flow id */
17172 #define WL_TWT_FLOW_ID_FID	0x07u	/* flow id */
17173 #define WL_TWT_FLOW_ID_GID_MASK	0x70u	/* group id - broadcast TWT only */
17174 #define WL_TWT_FLOW_ID_GID_SHIFT 4u
17175 
17176 #define WL_TWT_INV_BCAST_ID	0xFFu
17177 #define WL_TWT_INV_FLOW_ID	0xFFu
17178 
17179 /* auto flow_id */
17180 #define WL_TWT_SETUP_FLOW_ID_AUTO	0xFFu
17181 /* auto broadcast ID */
17182 #define WL_TWT_SETUP_BCAST_ID_AUTO	0xFFu
17183 /* Infinite persistence for broadcast schedule */
17184 #define WL_TWT_INFINITE_BTWT_PERSIST	0xFFFFFFFFu
17185 
17186 #define WL_TWT_STATS_MAX_BTWT	4u
17187 #define WL_TWT_STATS_MAX_ITWT	4u
17188 
17189 /* Wake type */
17190 /* TODO: not yet finalized */
17191 #define WL_TWT_TIME_TYPE_BSS	0u	/* The time specified in wake_time_h/l is
17192 					 * the BSS TSF time.
17193 					 */
17194 #define WL_TWT_TIME_TYPE_OFFSET	1u	/* The time specified in wake_time_h/l is an offset
17195 					 * of the TSF time when the iovar is processed.
17196 					 */
17197 #define WL_TWT_TIME_TYPE_AUTO	2u	/* The target wake time is chosen internally by the FW */
17198 
17199 #define WL_TWT_SETUP_VER	0u
17200 
17201 /* HE TWT Setup command */
17202 typedef struct wl_twt_setup {
17203 	/* structure control */
17204 	uint16 version;	/* structure version */
17205 	uint16 length;	/* data length (starting after this field) */
17206 	/* peer address */
17207 	struct ether_addr peer;	/* leave it all 0s' for AP */
17208 	uint8 pad[2];
17209 	/* setup descriptor */
17210 	wl_twt_sdesc_t desc;
17211 
17212 	/* deprecated - to be removed */
17213 	uint16 dialog;
17214 	uint8 pad1[2];
17215 } wl_twt_setup_t;
17216 
17217 /* deprecated -to be removed */
17218 #define WL_TWT_DIALOG_TOKEN_AUTO 0xFFFF
17219 
17220 #define WL_TWT_TEARDOWN_VER	0u
17221 
17222 /* twt teardown descriptor */
17223 typedef struct wl_twt_teardesc {
17224 	uint8 negotiation_type;
17225 	uint8 flow_id;		/* must be between 0 and 7 */
17226 	uint8 bid;		/* must be between 0 and 31 */
17227 	uint8 alltwt;		/* all twt teardown - 0 or 1 */
17228 } wl_twt_teardesc_t;
17229 
17230 /* HE TWT Teardown command */
17231 typedef struct wl_twt_teardown {
17232 	/* structure control */
17233 	uint16 version;	/* structure version */
17234 	uint16 length;	/* data length (starting after this field) */
17235 	/* peer address */
17236 	struct ether_addr peer;	/* leave it all 0s' for AP */
17237 	wl_twt_teardesc_t teardesc;	/* Teardown descriptor */
17238 
17239 	/* deprecated - to be removed */
17240 	uint8 flow_flags;
17241 	uint8 flow_id;
17242 	uint8 bid;
17243 	uint8 pad;
17244 } wl_twt_teardown_t;
17245 
17246 /* twt information descriptor */
17247 typedef struct wl_twt_infodesc {
17248 	uint8 flow_flags;	/* See WL_TWT_INFO_FLAG_XXX below */
17249 	uint8 flow_id;
17250 	uint8 pad[2];
17251 	uint32 next_twt_h;
17252 	uint32 next_twt_l;
17253 	/* deprecated - to be removed */
17254 	uint8 wake_type;
17255 	uint8 pad1[3];
17256 } wl_twt_infodesc_t;
17257 
17258 /* Flow flags */
17259 #define WL_TWT_INFO_FLAG_ALL_TWT	(1u << 0u)	/* All TWT */
17260 #define WL_TWT_INFO_FLAG_RESUME		(1u << 1u)	/* 1 is TWT Resume, 0 is TWT Suspend */
17261 
17262 /* deprecated - to be removed */
17263 #define WL_TWT_INFO_FLAG_RESP_REQ	(1 << 0)	/* Response Requested */
17264 #define WL_TWT_INFO_FLAG_NEXT_TWT_REQ	(1 << 1)	/* Next TWT Request */
17265 #define WL_TWT_INFO_FLAG_BTWT_RESCHED	(1 << 2)	/* Broadcast Reschedule */
17266 typedef wl_twt_infodesc_t wl_twt_idesc_t;
17267 
17268 #define WL_TWT_INFO_VER	0u
17269 
17270 /* HE TWT Information command */
17271 typedef struct wl_twt_info {
17272 	/* structure control */
17273 	uint16 version;	/* structure version */
17274 	uint16 length;	/* data length (starting after this field) */
17275 	/* peer address */
17276 	struct ether_addr peer;	/* leave it all 0s' for AP */
17277 	uint8 pad[2];
17278 	wl_twt_infodesc_t infodesc;	/* information descriptor */
17279 	/* deprecated - to be removed */
17280 	wl_twt_idesc_t desc;
17281 } wl_twt_info_t;
17282 
17283 #define WL_TWT_PEER_STATS_VERSION_1	1u
17284 typedef struct wl_twt_peer_stats_v1 {
17285 	uint16	version;
17286 	uint16	length;
17287 	struct	ether_addr peer;
17288 	uint8	PAD[2];
17289 	uint8	id;
17290 	uint8	flow_flags;
17291 	uint8	PAD[2];
17292 	uint32	sp_seq;		/* sequence number of the service period */
17293 	uint32	tx_ucast_pkts;
17294 	uint32	tx_pkts_min;
17295 	uint32	tx_pkts_max;
17296 	uint32	tx_pkts_avg;
17297 	uint32	tx_failures;
17298 	uint32	rx_ucast_pkts;
17299 	uint32	rx_pkts_min;
17300 	uint32	rx_pkts_max;
17301 	uint32	rx_pkts_avg;
17302 	uint32	rx_pkts_retried;
17303 } wl_twt_peer_stats_v1_t;
17304 
17305 #define WL_TWT_STATS_VERSION_1		1
17306 typedef struct wl_twt_stats_v1 {
17307 	uint16	version;
17308 	uint16	length;
17309 	uint32	num_stats;	/* number of peer stats in the peer_stats_list */
17310 	wl_twt_peer_stats_v1_t	peer_stats_list[];
17311 } wl_twt_stats_v1_t;
17312 
17313 #define WL_TWT_STATS_CMD_VERSION_1	1
17314 #define WL_TWT_STATS_CMD_FLAGS_RESET	(1u << 0u)
17315 /* HE TWT stats command */
17316 typedef struct wl_twt_stats_cmd_v1 {
17317 	uint16	version;
17318 	uint16	length;
17319 	struct ether_addr peer;
17320 	uint8	PAD[2];
17321 	uint16	flags;		/* see WL_TWT_STATS_CMD_FLAGS */
17322 	uint8	num_fid;
17323 	uint8	num_bid;
17324 	uint8	fid_list[WL_TWT_STATS_MAX_ITWT];
17325 	uint8	bid_list[WL_TWT_STATS_MAX_BTWT];
17326 } wl_twt_stats_cmd_v1_t;
17327 
17328 #define WL_TWT_RESP_CFG_VER	0u
17329 
17330 #define WL_TWT_CMD_RESP_CFG_TYPE_ALTERNATE	0u
17331 #define WL_TWT_CMD_RESP_CFG_TYPE_DICTATE	1u
17332 /* HE TWT resp command */
17333 typedef struct wl_twt_resp_cfg {
17334 	/* structure control */
17335 	uint16 version;		/* Structure version */
17336 	uint16 length;		/* Data length (starting after this field) */
17337 	uint8 dc_max;		/* Max supported duty cycle for single TWT */
17338 	uint8 resp_type;	/* Resp. type(Alt/dict) if duty cycle>max duty cycle */
17339 } wl_twt_resp_cfg_t;
17340 
17341 /* Current version for wlc_clm_power_limits_req_t structure and flags */
17342 #define WLC_CLM_POWER_LIMITS_REQ_VERSION 1
17343 /* "clm_power_limits" iovar request structure */
17344 typedef struct wlc_clm_power_limits_req {
17345 	/* Input. Structure and flags version */
17346 	uint32 version;
17347 	/* Full length of buffer (includes this structure and space for TLV-encoded PPR) */
17348 	uint32 buflen;
17349 	/* Input. Flags (see WLC_CLM_POWER_LIMITS_INPUT_FLAG_... below) */
17350 	uint32 input_flags;
17351 	/* Input. CC of region whose data is being requested */
17352 	char cc[WLC_CNTRY_BUF_SZ];
17353 	/* Input. Channel/subchannel in chanspec_t format */
17354 	uint32 chanspec;
17355 	/* Subchannel encoded as clm_limits_type_t */
17356 	uint32 clm_subchannel;
17357 	/* Input. 0-based antenna index */
17358 	uint32 antenna_idx;
17359 	/* Output. General flags (see WLC_CLM_POWER_LIMITS_OUTPUT_FLAG_... below) */
17360 	uint32 output_flags;
17361 	/* Output. 2.4G country flags, encoded as clm_flags_t enum */
17362 	uint32 clm_country_flags_2g;
17363 	/* Output. 5G country flags, encoded as clm_flags_t enum */
17364 	uint32 clm_country_flags_5g;
17365 	/* Output. Length of TLV-encoded PPR data that follows this structure */
17366 	uint32 ppr_tlv_size;
17367 	/* Output. Beginning of buffer for TLV-encoded PPR data */
17368 	uint8 ppr_tlv[1];
17369 } wlc_clm_power_limits_req_t;
17370 
17371 /* Input. Do not apply SAR limits */
17372 #define WLC_CLM_POWER_LIMITS_INPUT_FLAG_NO_SAR				0x00000001
17373 /* Input. Do not apply board limits */
17374 #define WLC_CLM_POWER_LIMITS_INPUT_FLAG_NO_BOARD			0x00000002
17375 /* Output. Limits taken from product-specific country data */
17376 #define WLC_CLM_POWER_LIMITS_OUTPUT_FLAG_PRODUCT_LIMITS			0x00000001
17377 /* Output. Limits taken from product-specific worldwide data */
17378 #define WLC_CLM_POWER_LIMITS_OUTPUT_FLAG_WORLDWIDE_LIMITS		0x00000002
17379 /* Output. Limits taken from country-default (all-product) data */
17380 #define WLC_CLM_POWER_LIMITS_OUTPUT_FLAG_DEFAULT_COUNTRY_LIMITS		0x00000004
17381 
17382 #define WL_MBO_IOV_MAJOR_VER 1
17383 #define WL_MBO_IOV_MINOR_VER 1
17384 #define WL_MBO_IOV_MAJOR_VER_SHIFT 8
17385 #define WL_MBO_IOV_VERSION \
17386 	((WL_MBO_IOV_MAJOR_VER << WL_MBO_IOV_MAJOR_VER_SHIFT)| WL_MBO_IOV_MINOR_VER)
17387 
17388 #define MBO_MAX_CHAN_PREF_ENTRIES  16
17389 
17390 enum wl_mbo_cmd_ids {
17391 	WL_MBO_CMD_ADD_CHAN_PREF = 1,
17392 	WL_MBO_CMD_DEL_CHAN_PREF = 2,
17393 	WL_MBO_CMD_LIST_CHAN_PREF = 3,
17394 	WL_MBO_CMD_CELLULAR_DATA_CAP = 4,
17395 	WL_MBO_CMD_DUMP_COUNTERS = 5,
17396 	WL_MBO_CMD_CLEAR_COUNTERS = 6,
17397 	WL_MBO_CMD_FORCE_ASSOC = 7,
17398 	WL_MBO_CMD_BSSTRANS_REJECT = 8,
17399 	WL_MBO_CMD_SEND_NOTIF = 9,
17400 	/* Unused command, This enum no can be use
17401 	 * for next new command
17402 	 */
17403 	WL_MBO_CMD_CLEAR_CHAN_PREF = 10,
17404 	WL_MBO_CMD_NBR_INFO_CACHE = 11,
17405 	WL_MBO_CMD_ANQPO_SUPPORT = 12,
17406 	WL_MBO_CMD_DBG_EVENT_CHECK = 13,
17407 	WL_MBO_CMD_EVENT_MASK = 14,
17408 	WL_MBO_CMD_ASSOC_DISALLOWED = 15,
17409 	/* Add before this !! */
17410 	WL_MBO_CMD_LAST
17411 };
17412 
17413 enum wl_mbo_xtlv_id {
17414 	WL_MBO_XTLV_OPCLASS            = 0x1,
17415 	WL_MBO_XTLV_CHAN               = 0x2,
17416 	WL_MBO_XTLV_PREFERENCE         = 0x3,
17417 	WL_MBO_XTLV_REASON_CODE        = 0x4,
17418 	WL_MBO_XTLV_CELL_DATA_CAP      = 0x5,
17419 	WL_MBO_XTLV_COUNTERS           = 0x6,
17420 	WL_MBO_XTLV_ENABLE             = 0x7,
17421 	WL_MBO_XTLV_SUB_ELEM_TYPE      = 0x8,
17422 	WL_MBO_XTLV_BTQ_TRIG_START_OFFSET = 0x9,
17423 	WL_MBO_XTLV_BTQ_TRIG_RSSI_DELTA = 0xa,
17424 	WL_MBO_XTLV_ANQP_CELL_SUPP      = 0xb,
17425 	WL_MBO_XTLV_BIT_MASK		= 0xc,
17426 	WL_MBO_XTLV_ASSOC_DISALLOWED	= 0xd
17427 };
17428 
17429 /* event bit mask flags for MBO */
17430 #define MBO_EVT_BIT_MASK_CELLULAR_SWITCH        0x0001  /* Evt bit mask to enab cellular switch */
17431 #define MBO_EVT_BIT_MASK_BTM_REQ_RCVD           0x0002  /* Evt bit mask to enab BTM req rcvd */
17432 
17433 /* masks for values in assoc_disallowed */
17434 #define WL_MBO_ASSOC_DISALLOWED_MASK		0xff00
17435 #define WL_MBO_ASSOC_DISALLOWED_SHIFT		8
17436 #define WL_MBO_ASSOC_DISALLOWED_RC_MASK	0xff
17437 
17438 typedef struct wl_mbo_counters {
17439 	/* No of transition req recvd */
17440 	uint16 trans_req_rcvd;
17441 	/* No of transition req with disassoc imminent */
17442 	uint16 trans_req_disassoc;
17443 	/* No of transition req with BSS Termination */
17444 	uint16 trans_req_bss_term;
17445 	/* No of trans req w/ unspecified reason */
17446 	uint16 trans_resn_unspec;
17447 	/* No of trans req w/ reason frame loss */
17448 	uint16 trans_resn_frm_loss;
17449 	/* No of trans req w/ reason traffic delay */
17450 	uint16 trans_resn_traffic_delay;
17451 	/* No of trans req w/ reason insufficient buffer */
17452 	uint16 trans_resn_insuff_bw;
17453 	/* No of trans req w/ reason load balance */
17454 	uint16 trans_resn_load_bal;
17455 	/* No of trans req w/ reason low rssi */
17456 	uint16 trans_resn_low_rssi;
17457 	/* No of trans req w/ reason excessive retransmission */
17458 	uint16 trans_resn_xcess_retransmn;
17459 	/* No of trans req w/ reason gray zone */
17460 	uint16 trans_resn_gray_zone;
17461 	/* No of trans req w/ reason switch to premium AP */
17462 	uint16 trans_resn_prem_ap_sw;
17463 	/* No of transition rejection sent */
17464 	uint16 trans_rejn_sent;
17465 	/* No of trans rejn reason excessive frame loss */
17466 	uint16 trans_rejn_xcess_frm_loss;
17467 	/* No of trans rejn reason excessive traffic delay */
17468 	uint16 trans_rejn_xcess_traffic_delay;
17469 	/* No of trans rejn reason insufficient QoS capability */
17470 	uint16 trans_rejn_insuffic_qos_cap;
17471 	/* No of trans rejn reason low RSSI */
17472 	uint16 trans_rejn_low_rssi;
17473 	/* No of trans rejn reason high interference */
17474 	uint16 trans_rejn_high_interference;
17475 	/* No of trans rejn reason service unavilable */
17476 	uint16 trans_rejn_service_unavail;
17477 	/* No of beacon request rcvd */
17478 	uint16 bcn_req_rcvd;
17479 	/* No of beacon report sent */
17480 	uint16 bcn_rep_sent;
17481 	/* No of null beacon report sent */
17482 	uint16 null_bcn_rep_sent;
17483 	/* No of wifi to cell switch */
17484 	uint16 wifi_to_cell;
17485 } wl_mbo_counters_t;
17486 
17487 #define WL_FILS_IOV_MAJOR_VER 1
17488 #define WL_FILS_IOV_MINOR_VER 1
17489 #define WL_FILS_IOV_MAJOR_VER_SHIFT 8
17490 #define WL_FILS_IOV_VERSION \
17491 	((WL_FILS_IOV_MAJOR_VER << WL_FILS_IOV_MAJOR_VER_SHIFT)| WL_FILS_IOV_MINOR_VER)
17492 
17493 enum wl_fils_cmd_ids {
17494 	WL_FILS_CMD_ADD_IND_IE		= 1,
17495 	WL_FILS_CMD_ADD_AUTH_DATA	= 2,	/* Deprecated, kept to prevent ROM invalidation */
17496 	WL_FILS_CMD_ADD_HLP_IE		= 3,
17497 	WL_FILS_CMD_ADD_CONNECT_PARAMS	= 4,
17498 	WL_FILS_CMD_GET_CONNECT_PARAMS	= 5,
17499 	/* Add before this !! */
17500 	WL_FILS_CMD_LAST
17501 };
17502 
17503 enum wl_fils_xtlv_id {
17504 	WL_FILS_XTLV_IND_IE		= 0x1,
17505 	WL_FILS_XTLV_AUTH_DATA		= 0x2,	/* Deprecated, kept to prevent ROM invalidation */
17506 	WL_FILS_XTLV_HLP_IE		= 0x3,
17507 	WL_FILS_XTLV_ERP_USERNAME	= 0x4,
17508 	WL_FILS_XTLV_ERP_REALM		= 0x5,
17509 	WL_FILS_XTLV_ERP_RRK		= 0x6,
17510 	WL_FILS_XTLV_ERP_NEXT_SEQ_NUM	= 0x7,
17511 	WL_FILS_XTLV_KEK		= 0x8,
17512 	WL_FILS_XTLV_PMK		= 0x9,
17513 	WL_FILS_XTLV_TK			= 0xa,
17514 	WL_FILS_XTLV_PMKID		= 0xb
17515 };
17516 
17517 #define WL_OCE_IOV_MAJOR_VER 1
17518 #define WL_OCE_IOV_MINOR_VER 1
17519 #define WL_OCE_IOV_MAJOR_VER_SHIFT 8
17520 #define WL_OCE_IOV_VERSION \
17521 	((WL_OCE_IOV_MAJOR_VER << WL_OCE_IOV_MAJOR_VER_SHIFT)| WL_OCE_IOV_MINOR_VER)
17522 
17523 enum wl_oce_cmd_ids {
17524 	WL_OCE_CMD_ENABLE = 1,
17525 	WL_OCE_CMD_PROBE_DEF_TIME = 2,
17526 	WL_OCE_CMD_FD_TX_PERIOD = 3,
17527 	WL_OCE_CMD_FD_TX_DURATION = 4,
17528 	WL_OCE_CMD_RSSI_TH = 5,
17529 	WL_OCE_CMD_RWAN_LINKS = 6,
17530 	WL_OCE_CMD_CU_TRIGGER = 7,
17531 	/* Add before this !! */
17532 	WL_OCE_CMD_LAST
17533 };
17534 
17535 enum wl_oce_xtlv_id {
17536 	WL_OCE_XTLV_ENABLE  = 0x1,
17537 	WL_OCE_XTLV_PROBE_DEF_TIME  = 0x2,
17538 	WL_OCE_XTLV_FD_TX_PERIOD    = 0x3,
17539 	WL_OCE_XTLV_FD_TX_DURATION  = 0x4,
17540 	WL_OCE_XTLV_RSSI_TH = 0x5,
17541 	WL_OCE_XTLV_RWAN_LINKS = 0x6,
17542 	WL_OCE_XTLV_CU_TRIGGER = 0x7
17543 };
17544 
17545 #define WL_ESP_IOV_MAJOR_VER 1
17546 #define WL_ESP_IOV_MINOR_VER 1
17547 #define WL_ESP_IOV_MAJOR_VER_SHIFT 8
17548 #define WL_ESP_IOV_VERSION \
17549 	((WL_ESP_IOV_MAJOR_VER << WL_ESP_IOV_MAJOR_VER_SHIFT)| WL_ESP_IOV_MINOR_VER)
17550 
17551 enum wl_esp_cmd_ids {
17552 	WL_ESP_CMD_ENABLE = 1,
17553 	WL_ESP_CMD_STATIC = 2,
17554 	/* Add before this !! */
17555 	WL_ESP_CMD_LAST
17556 };
17557 
17558 enum wl_esp_xtlv_id {
17559 	WL_ESP_XTLV_ENABLE  = 0x1,
17560 	WL_ESP_XTLV_STATIC_AC    = 0x2,	/* access category */
17561 	WL_ESP_XTLV_STATIC_TYPE  = 0x3,	/* data type */
17562 	WL_ESP_XTLV_STATIC_VAL   = 0x4
17563 };
17564 
17565 /* otpread command */
17566 #define WL_OTPREAD_VER 1
17567 
17568 typedef struct {
17569 	uint16 version;		/* cmd structure version */
17570 	uint16 cmd_len;		/* cmd struct len */
17571 	uint32 rdmode;		/* otp read mode */
17572 	uint32 rdoffset;	/* byte offset into otp to start read */
17573 	uint32 rdsize;		/* number of bytes to read */
17574 } wl_otpread_cmd_t;
17575 
17576 /* "otpecc_rows" command */
17577 typedef struct {
17578 	uint16 version;		/* version of this structure */
17579 	uint16 len;			/* len in bytes of this structure */
17580 	uint32 cmdtype;		/* command type : 0 : read row data, 1 : ECC lock  */
17581 	uint32 rowoffset;	/* start row offset */
17582 	uint32 numrows;		/* number of rows */
17583 	uint8  rowdata[];	/* read rows data */
17584 } wl_otpecc_rows_t;
17585 
17586 #define WL_OTPECC_ROWS_VER  1
17587 
17588 #define WL_OTPECC_ROWS_CMD_READ  0
17589 #define WL_OTPECC_ROWS_CMD_LOCK  1
17590 
17591 #define WL_OTPECC_ARGIDX_CMDTYPE		0	/* command type */
17592 #define WL_OTPECC_ARGIDX_ROWOFFSET		1	/* start row offset */
17593 #define WL_OTPECC_ARGIDX_NUMROWS		2	/* number of rows */
17594 
17595 /* "otpeccrows" raw data size per row */
17596 #define WL_ECCDUMP_ROW_SIZE_BYTE	6 /* 4 bytes row data + 2 bytes ECC status */
17597 #define WL_ECCDUMP_ROW_SIZE_WORD	3
17598 
17599 /* otpECCstatus */
17600 #define OTP_ECC_ENAB_SHIFT		13
17601 #define OTP_ECC_ENAB_MASK		0x7
17602 #define OTP_ECC_CORR_ST_SHIFT	12
17603 #define OTP_ECC_CORR_ST_MASK	0x1
17604 #define OTP_ECC_DBL_ERR_SHIFT	11
17605 #define OTP_ECC_DBL_ERR_MASK	0x1
17606 #define OTP_ECC_DED_ST_SHIFT	10
17607 #define OTP_ECC_DED_ST_MASK		0x1
17608 #define OTP_ECC_SEC_ST_SHIFT	9
17609 #define OTP_ECC_SEC_ST_MASK		0x1
17610 #define OTP_ECC_DATA_SHIFT		0
17611 #define OTP_ECC_DATA_MASK		0x7f
17612 
17613 /* OTP_ECC_CORR_ST field */
17614 #define OTP_ECC_MODE		1
17615 #define OTP_NO_ECC_MODE		0
17616 
17617 /* OTP_ECC_ENAB field (bit15:13) :
17618  * When 2 or 3 bits are set,
17619  * it indicates that OTP ECC is enabled on the last row read.
17620  * Otherwise, ECC is disabled
17621  */
17622 #define OTP_ECC_ENAB(val) \
17623 	(bcm_bitcount((uint8 *)&(val), sizeof(uint8)) > 1)
17624 
17625 #define WL_LEAKY_AP_STATS_GT_TYPE	0
17626 #define WL_LEAKY_AP_STATS_PKT_TYPE	1
17627 typedef struct wlc_leaked_infra_guard_marker {
17628 	/* type field for this TLV: WL_LEAKY_AP_STATS_GT_TYPE */
17629 	uint16  type;
17630 	/* length field for this TLV */
17631 	uint16  len;
17632 	/* guard sample sequence number; Updated by 1 on every guard sample */
17633 	uint32  seq_number;
17634 	/* Guard time start time (tsf; PS indicated and acked) */
17635 	uint32  start_time;
17636 	/* tsf timestamp for the GT end event */
17637 	uint32  gt_tsf_l;
17638 	/* Guard time period in ms */
17639 	uint16  guard_duration;
17640 	/* Number PPDUs in the notification */
17641 	uint16  num_pkts;
17642 	/* Flags to indicate some states see below */
17643 	uint8   flag;
17644 	/* pad for 32-bit alignment */
17645 	uint8   reserved[3];
17646 } wlc_leaked_infra_guard_marker_t;
17647 
17648 /* Flag information */
17649 #define WL_LEAKED_GUARD_TIME_NONE	0               /* Not in any guard time */
17650 #define WL_LEAKED_GUARD_TIME_FRTS	(0x01 << 0)     /* Normal FRTS power save */
17651 #define WL_LEAKED_GUARD_TIME_SCAN	(0x01 << 1)     /* Channel switch due to scanning */
17652 #define WL_LEAKED_GUARD_TIME_AWDL_PSF	(0x01 << 2)     /* Channel switch due to AWDL PSF */
17653 #define WL_LEAKED_GUARD_TIME_AWDL_AW	(0x01 << 3)     /* Channel switch due to AWDL AW */
17654 #define WL_LEAKED_GUARD_TIME_INFRA_STA	(0x01 << 4)	/* generic type infra sta channel switch */
17655 #define WL_LEAKED_GUARD_TIME_TERMINATED (0x01 << 7)     /* indicate a GT is terminated early */
17656 
17657 typedef struct wlc_leaked_infra_packet_stat {
17658 	uint16  type;			/* type field for this TLV: WL_LEAKY_AP_STATS_PKT_TYPE */
17659 	uint16  len;			/* length field for this TLV */
17660 	uint16  ppdu_len_bytes;		/* PPDU packet length in bytes */
17661 	uint16  num_mpdus;		/* number of the MPDUs in the PPDU */
17662 	uint32  ppdu_time;		/* PPDU arrival time at the begining of the guard time */
17663 	uint32  rate;			/* PPDU packet rate; Received packet's data rate */
17664 	uint16  seq_number;		/* sequence number */
17665 	int8    rssi;			/* RSSI */
17666 	uint8   tid;			/* tid */
17667 } wlc_leaked_infra_packet_stat_t;
17668 
17669 /* Wake timer structure definition */
17670 #define WAKE_TIMER_VERSION 1
17671 #define WAKE_TIMER_NOLIMIT 0xFFFF
17672 
17673 typedef struct wake_timer {
17674 	uint16 ver;
17675 	uint16 len;
17676 	uint16 limit;   /* number of events to deliver
17677 			* 0-disable, 0xffff-indefinite, num_events otherwise
17678 			*/
17679 	uint16 count;	/* number of events delivered since enable (get only) */
17680 	uint16 period;	/* timeout/period in milliseconds */
17681 } wake_timer_t;
17682 
17683 typedef struct wl_desense_restage_gain {
17684 	uint16 version;
17685 	uint16 length;
17686 	uint32 band;
17687 	uint8 num_cores;
17688 	uint8 desense_array[WL_TX_CHAINS_MAX];
17689 	uint8 PAD[3];
17690 } wl_desense_restage_gain_t;
17691 
17692 #define MAX_UCM_CHAINS 5
17693 #define MAX_UCM_PROFILES 10
17694 #define UCM_PROFILE_VERSION_1 1
17695 
17696 /* UCM per chain attribute struct */
17697 typedef struct wlc_btcx_chain_attr {
17698 	uint16 length;			/* chain attr length, version is same as profile version */
17699 	int8 desense_level;		/* per chain desense level */
17700 	int8 ack_pwr_strong_rssi;	/* per chain ack power at strong rssi */
17701 	int8 ack_pwr_weak_rssi;		/* per chain ack power at weak rssi */
17702 	int8 tx_pwr_strong_rssi;	/* per chain tx power at strong rssi */
17703 	int8 tx_pwr_weak_rssi;		/* per chain tx power at weak rssi */
17704 	uint8 PAD[1];			/* additional bytes for alignment */
17705 } wlc_btcx_chain_attr_t;
17706 
17707 typedef struct wlc_btcx_profile_v1 {
17708 	uint16 version;			/* UCM profile version */
17709 	uint16 length;			/* profile size */
17710 	uint16 fixed_length;		/* size of the fixed portion of the profile */
17711 	uint8 init;			/* profile initialized or not */
17712 	uint8 chain_attr_count;		/* Number of elements in chain_attr array */
17713 	uint8 profile_index;		/* profile index */
17714 	uint8 mode_strong_wl_bt;	/* Mode under strong WLAN and BT RSSI */
17715 	uint8 mode_weak_wl;		/* Mode under weak WLAN RSSI */
17716 	uint8 mode_weak_bt;		/* Mode under weak BT RSSI */
17717 	uint8 mode_weak_wl_bt;		/* Mode under weak BT and WLAN RSSI */
17718 	int8 mode_wl_hi_lo_rssi_thresh;	/* Strong to weak WLAN RSSI threshold for mode selection */
17719 	int8 mode_wl_lo_hi_rssi_thresh;	/* Weak to strong WLAN RSSI threshold for mode selection */
17720 	int8 mode_bt_hi_lo_rssi_thresh;	/* Strong to weak BT RSSI threshold for mode selection */
17721 	int8 mode_bt_lo_hi_rssi_thresh;	/* Weak to strong BT RSSI threshold for mode selection */
17722 	int8 desense_wl_hi_lo_rssi_thresh;	/* Strong to weak RSSI threshold for desense */
17723 	int8 desense_wl_lo_hi_rssi_thresh;	/* Weak to strong RSSI threshold for desense */
17724 	int8 ack_pwr_wl_hi_lo_rssi_thresh;	/* Strong to weak RSSI threshold for ACK power */
17725 	int8 ack_pwr_wl_lo_hi_rssi_thresh;	/* Weak to strong RSSI threshold for ACK power */
17726 	int8 tx_pwr_wl_hi_lo_rssi_thresh;	/* Strong to weak RSSI threshold for Tx power */
17727 	int8 tx_pwr_wl_lo_hi_rssi_thresh;	/* Weak to strong RSSI threshold for Tx power */
17728 	uint8 PAD[1];				/* additional bytes for 4 byte alignment */
17729 	wlc_btcx_chain_attr_t chain_attr[];	/* variable length array with chain attributes */
17730 } wlc_btcx_profile_v1_t;
17731 
17732 #define SSSR_D11_RESET_SEQ_STEPS   5
17733 #define SSSR_REG_INFO_VER   0
17734 #define SSSR_REG_INFO_VER_1	1
17735 
17736 typedef struct sssr_reg_info_v0 {
17737 	uint16 version;
17738 	uint16 length;  /* length of the structure validated at host */
17739 	struct {
17740 		struct {
17741 			uint32 pmuintmask0;
17742 			uint32 pmuintmask1;
17743 			uint32 resreqtimer;
17744 			uint32 macresreqtimer;
17745 			uint32 macresreqtimer1;
17746 		} base_regs;
17747 	} pmu_regs;
17748 	struct {
17749 		struct {
17750 			uint32 intmask;
17751 			uint32 powerctrl;
17752 			uint32 clockcontrolstatus;
17753 			uint32 powerctrl_mask;
17754 		} base_regs;
17755 	} chipcommon_regs;
17756 	struct {
17757 		struct {
17758 			uint32 clockcontrolstatus;
17759 			uint32 clockcontrolstatus_val;
17760 		} base_regs;
17761 		struct {
17762 			uint32 resetctrl;
17763 			uint32 itopoobb;
17764 		} wrapper_regs;
17765 	} arm_regs;
17766 	struct {
17767 		struct {
17768 			uint32 ltrstate;
17769 			uint32 clockcontrolstatus;
17770 			uint32 clockcontrolstatus_val;
17771 		} base_regs;
17772 		struct {
17773 			uint32 itopoobb;
17774 		} wrapper_regs;
17775 	} pcie_regs;
17776 	struct {
17777 		struct {
17778 			uint32 ioctrl;
17779 		} wrapper_regs;
17780 		uint32 vasip_sr_addr;
17781 		uint32 vasip_sr_size;
17782 	} vasip_regs;
17783 	struct {
17784 		struct {
17785 			uint32 xmtaddress;
17786 			uint32 xmtdata;
17787 			uint32 clockcontrolstatus;
17788 			uint32 clockcontrolstatus_val;
17789 		} base_regs;
17790 		struct {
17791 			uint32 resetctrl;
17792 			uint32 itopoobb;
17793 			uint32 ioctrl;
17794 			uint32 ioctrl_resetseq_val[SSSR_D11_RESET_SEQ_STEPS];
17795 		} wrapper_regs;
17796 		uint32 sr_size;
17797 	} mac_regs[MAX_NUM_D11CORES];
17798 } sssr_reg_info_v0_t;
17799 
17800 typedef struct sssr_reg_info_v1 {
17801 	uint16 version;
17802 	uint16 length;  /* length of the structure validated at host */
17803 	struct {
17804 		struct {
17805 			uint32 pmuintmask0;
17806 			uint32 pmuintmask1;
17807 			uint32 resreqtimer;
17808 			uint32 macresreqtimer;
17809 			uint32 macresreqtimer1;
17810 		} base_regs;
17811 	} pmu_regs;
17812 	struct {
17813 		struct {
17814 			uint32 intmask;
17815 			uint32 powerctrl;
17816 			uint32 clockcontrolstatus;
17817 			uint32 powerctrl_mask;
17818 		} base_regs;
17819 	} chipcommon_regs;
17820 	struct {
17821 		struct {
17822 			uint32 clockcontrolstatus;
17823 			uint32 clockcontrolstatus_val;
17824 		} base_regs;
17825 		struct {
17826 			uint32 resetctrl;
17827 			uint32 itopoobb;
17828 		} wrapper_regs;
17829 	} arm_regs;
17830 	struct {
17831 		struct {
17832 			uint32 ltrstate;
17833 			uint32 clockcontrolstatus;
17834 			uint32 clockcontrolstatus_val;
17835 		} base_regs;
17836 		struct {
17837 			uint32 itopoobb;
17838 		} wrapper_regs;
17839 	} pcie_regs;
17840 	struct {
17841 		struct {
17842 			uint32 ioctrl;
17843 		} wrapper_regs;
17844 		uint32 vasip_sr_addr;
17845 		uint32 vasip_sr_size;
17846 	} vasip_regs;
17847 	struct {
17848 		struct {
17849 			uint32 xmtaddress;
17850 			uint32 xmtdata;
17851 			uint32 clockcontrolstatus;
17852 			uint32 clockcontrolstatus_val;
17853 		} base_regs;
17854 		struct {
17855 			uint32 resetctrl;
17856 			uint32 itopoobb;
17857 			uint32 ioctrl;
17858 			uint32 ioctrl_resetseq_val[SSSR_D11_RESET_SEQ_STEPS];
17859 		} wrapper_regs;
17860 		uint32 sr_size;
17861 	} mac_regs[MAX_NUM_D11CORES];
17862 	struct {
17863 		uint32 dig_sr_addr;
17864 		uint32 dig_sr_size;
17865 	} dig_mem_info;
17866 } sssr_reg_info_v1_t;
17867 
17868 #ifndef SSSR_REG_INFO_HAS_ALIAS
17869 typedef sssr_reg_info_v0_t sssr_reg_info_t;
17870 #endif // endif
17871 
17872 /* ADaptive Power Save(ADPS) structure definition */
17873 #define WL_ADPS_IOV_MAJOR_VER	1
17874 #define WL_ADPS_IOV_MINOR_VER	0
17875 #define WL_ADPS_IOV_MAJOR_VER_SHIFT	8
17876 #define WL_ADPS_IOV_VER \
17877 	((WL_ADPS_IOV_MAJOR_VER << WL_ADPS_IOV_MAJOR_VER_SHIFT) | WL_ADPS_IOV_MINOR_VER)
17878 
17879 #define ADPS_NUM_DIR	2
17880 #define ADPS_RX		0
17881 #define ADPS_TX		1
17882 
17883 #define WL_ADPS_IOV_MODE	0x0001
17884 #define WL_ADPS_IOV_RSSI	0x0002
17885 #define WL_ADPS_IOV_DUMP	0x0003
17886 #define WL_ADPS_IOV_DUMP_CLEAR	0x0004
17887 #define WL_ADPS_IOV_SUSPEND	0x0005
17888 
17889 #define ADPS_SUMMARY_STEP_NUM   2
17890 #define ADPS_SUMMARY_STEP_LOW	0
17891 #define ADPS_SUMMARY_STEP_HIGH	1
17892 
17893 #define ADPS_SUB_IOV_VERSION_1	1
17894 #define ADPS_SUB_IOV_VERSION_2	2
17895 
17896 /* suspend/resume ADPS by wl/private command from host */
17897 #define ADPS_RESUME	0u
17898 #define ADPS_SUSPEND	1u
17899 
17900 typedef struct wl_adps_params_v1 {
17901 	uint16 version;
17902 	uint16 length;
17903 	uint8 band;		/* band - 2G or 5G */
17904 	uint8 mode;		/* operation mode, default = 0 (ADPS disable) */
17905 	uint16 padding;
17906 } wl_adps_params_v1_t;
17907 
17908 typedef struct wl_adps_rssi {
17909 	int32 thresh_hi;	/* rssi threshold to resume ADPS operation */
17910 	int32 thresh_lo;	/* rssi threshold to suspend ADPS operation */
17911 } wl_adps_rssi_t;
17912 
17913 typedef struct wl_adps_rssi_params_v1 {
17914 	uint16 version;
17915 	uint16 length;
17916 	uint8 band;
17917 	uint8 padding[3];
17918 	wl_adps_rssi_t rssi;
17919 } wl_adps_rssi_params_v1_t;
17920 
17921 typedef struct adps_stat_elem {
17922 	uint32 duration;	/* each step duration time (mSec) */
17923 	uint32 counts;		/* each step hit count number */
17924 } adps_stat_elem_t;
17925 
17926 typedef struct wl_adps_dump_summary_v1 {
17927 	uint16 version;
17928 	uint16 length;
17929 	uint8 mode;					/* operation mode: On/Off */
17930 	uint8 flags;					/* restrict flags */
17931 	uint8 current_step;				/* current step */
17932 	uint8 padding;
17933 	adps_stat_elem_t stat[ADPS_SUMMARY_STEP_NUM];	/* statistics */
17934 } wl_adps_dump_summary_v1_t;
17935 
17936 typedef struct wl_adps_dump_summary_v2 {
17937 	uint16 version;
17938 	uint16 length;
17939 	uint8 mode;					/* operation mode: On/Off */
17940 	uint8 current_step;				/* current step */
17941 	uint8 padding[2];
17942 	uint32 flags;					/* restrict flags */
17943 	adps_stat_elem_t stat[ADPS_SUMMARY_STEP_NUM];	/* statistics */
17944 } wl_adps_dump_summary_v2_t;
17945 
17946 typedef struct wl_adps_suspend_v1 {
17947 	uint16 version;
17948 	uint16 length;
17949 	uint8 suspend;			/* 1: suspend 0: resume */
17950 	uint8 padding[3];
17951 } wl_adps_suspend_v1_t;
17952 
17953 typedef struct wlc_btc_2gchain_dis {
17954 	uint16 ver;
17955 	uint16 len;
17956 	uint8 chain_dis;
17957 	uint8 flag;
17958 } wlc_btc_2gchain_dis_t;
17959 
17960 #define WLC_BTC_2GCHAIN_DIS_REASSOC	0x1
17961 #define WLC_BTC_2GCHAIN_DIS_VER1	0x1
17962 #define WLC_BTC_2GCHAIN_DIS_VER1_LEN	6
17963 
17964 /* --- BTCX WiFi Protection (btc_wifi_prot iovar) --- */
17965 
17966 /* Current iovar structure version: 1 */
17967 #define WL_BTC_WIFI_PROT_VER_1	1
17968 
17969 typedef struct wl_btc_wifi_prot_v1 {
17970 	uint16 ver;	/* version */
17971 	uint16 len;	/* total length */
17972 	uint8 data[];	/* bcm_xtlv_t payload */
17973 } wl_btc_wifi_prot_v1_t;
17974 
17975 /* Xtlv tags (protection type) and data */
17976 #define WL_BTC_WIFI_PROT_M1_M4 1
17977 typedef struct wl_btc_wifi_prot_m1_m4 {
17978 	uint32 enable;	/* enable/disable m1-m4 protection */
17979 	uint32 timeout;	/* maximum timeout in ms (0: default) */
17980 } wl_btc_wifi_prot_m1_m4_t;
17981 
17982 #define WL_BTC_WIFI_PROT_ENABLE		1
17983 #define WL_BTC_WIFI_PROT__DISABLE	0
17984 
17985 /* --- End BTCX WiFi Protection --- */
17986 
17987 /* --- BTCX ULMU disable (btc_ulmu_config iovar) --- */
17988 
17989 /* Version number */
17990 #define WL_BTC_ULMU_CONFIG_VER_1 1
17991 typedef struct wl_btc_ulmu_config_v1 {
17992 	uint16 version;			/* btc_ulmu_config version */
17993 	uint16 len;			/* Total length */
17994 	uint32 ulmu_bt_task_bm;		/* BT Task bimtap for ULMU disable */
17995 	uint32 ulmu_bt_period_th;	/* BT period thresh for ULMU disable */
17996 } wl_btc_ulmu_config_v1_t;
17997 
17998 /* --- End BTCX ULMU config --- */
17999 enum wl_rpsnoa_cmd_ids {
18000 	WL_RPSNOA_CMD_ENABLE = 1,
18001 	WL_RPSNOA_CMD_STATUS,
18002 	WL_RPSNOA_CMD_PARAMS,
18003 	WL_RPSNOA_CMD_LAST
18004 };
18005 
18006 typedef struct rpsnoa_cmnhdr {
18007 	uint16 ver;		/* cmd structure version */
18008 	uint16 len;		/* cmd structure len */
18009 	uint32 subcmd;
18010 	uint32 cnt;
18011 } rpsnoa_cmnhdr_t;
18012 
18013 typedef struct rpsnoa_data {
18014 	int16 band;
18015 	int16 value;
18016 } rpsnoa_data_t;
18017 
18018 typedef struct rpsnoa_stats {
18019 	int16 band;
18020 	int16 state;
18021 	uint32 sleep_dur;
18022 	uint32 sleep_avail_dur;
18023 	uint32 last_pps;
18024 } rpsnoa_stats_t;
18025 
18026 typedef struct rpsnoa_param {
18027 	uint16 band;
18028 	uint8 level;
18029 	uint8 stas_assoc_check;
18030 	uint32 pps;
18031 	uint32 quiet_time;
18032 } rpsnoa_param_t;
18033 
18034 typedef struct rpsnoa_iovar {
18035 	rpsnoa_cmnhdr_t hdr;
18036 	rpsnoa_data_t data[1];
18037 } rpsnoa_iovar_t;
18038 
18039 typedef struct rpsnoa_iovar_status {
18040 	rpsnoa_cmnhdr_t hdr;
18041 	rpsnoa_stats_t stats[1];
18042 } rpsnoa_iovar_status_t;
18043 
18044 typedef struct rpsnoa_iovar_params {
18045 	rpsnoa_cmnhdr_t hdr;
18046 	rpsnoa_param_t param[1];
18047 } rpsnoa_iovar_params_t;
18048 
18049 /* Per-interface reportable stats types */
18050 enum wl_ifstats_xtlv_id {
18051 	/* global */
18052 	WL_IFSTATS_XTLV_SLICE_INDEX = 1,
18053 	WL_IFSTATS_XTLV_IF_INDEX = 2,
18054 	WL_IFSTATS_XTLV_MAC_ADDR = 3,
18055 	WL_IFSTATS_XTLV_REPORT_CMD = 4,	/* Comes in an iovar */
18056 	WL_IFSTATS_XTLV_BUS_PCIE = 5,
18057 
18058 	/* Report data across all SCBs using ecounters */
18059 	/* STA_info ecounters */
18060 	WL_IFSTATS_XTLV_WL_STA_INFO_ECOUNTERS = 0x100,
18061 	/* For AMPDU stat sub-types requested in a different format */
18062 	/* these could be sum and report stats across slices. OR
18063 	 * report sub-types in pairs so host can sum and add.
18064 	 * Information sent here is across slices, therefore global
18065 	 */
18066 	WL_IFSTATS_XTLV_TX_AMPDU_STATS = 0x101,
18067 	WL_IFSTATS_XTLV_RX_AMPDU_STATS = 0x102,
18068 	/* scb ecounter statistics */
18069 	WL_IFSTATS_XTLV_SCB_ECOUNTERS = 0x103,
18070 	/* Global NAN stats */
18071 	WL_IFSTATS_XTLV_NAN_STATS = 0x104,
18072 
18073 	/* Per-slice information
18074 	 * Per-interface reporting could also include slice specific data
18075 	 */
18076 	/* xtlv container for reporting */
18077 	WL_IFSTATS_XTLV_WL_SLICE = 0x301,
18078 	/* Per-slice AMPDU stats */
18079 	WL_IFSTATS_XTLV_WL_SLICE_TX_AMPDU_DUMP = 0x302,
18080 	WL_IFSTATS_XTLV_WL_SLICE_RX_AMPDU_DUMP = 0x303,
18081 	/* Per-slice BTCOEX stats */
18082 	WL_IFSTATS_XTLV_WL_SLICE_BTCOEX = 0x304,
18083 	/* V11_WLCNTRS used in ecounters */
18084 	WL_IFSTATS_XTLV_WL_SLICE_V11_WLCNTRS = 0x305,
18085 	/* V30_WLCNTRS Used in ecounters */
18086 	WL_IFSTATS_XTLV_WL_SLICE_V30_WLCNTRS = 0x306,
18087 	/* phy,ucode,scan pwrstats */
18088 	WL_IFSTATS_XTLV_WL_SLICE_PWRSTATS_PHY = 0x307,
18089 	WL_IFSTATS_XTLV_WL_SLICE_PWRSTATS_SCAN = 0x308,
18090 	WL_IFSTATS_XTLV_WL_SLICE_PWRSTATS_WAKE_V2 = 0x309,
18091 	/* Per-slice LTECOEX stats */
18092 	WL_IFSTATS_XTLV_WL_SLICE_LTECOEX = 0x30A,
18093 	/* TVPM ecounters */
18094 	WL_IFSTATS_XTLV_WL_SLICE_TVPM = 0x30B,
18095 	/* TDMTX ecounters */
18096 	WL_IFSTATS_XTLV_WL_SLICE_TDMTX = 0x30C,
18097 	/* Slice specific state capture in periodic fasion */
18098 	WL_SLICESTATS_XTLV_PERIODIC_STATE = 0x30D,
18099 	/* Per-slice BTCOEX task duration stats */
18100 	WL_IFSTATS_XTLV_WL_SLICE_BTCOEX_TSKDUR_STATS = 0x30E,
18101 	/* Per-interface */
18102 	/* XTLV container for reporting */
18103 	WL_IFSTATS_XTLV_IF = 0x501,
18104 	/* Generic stats applicable to all IFs */
18105 	WL_IFSTATS_XTLV_GENERIC = 0x502,
18106 	/* Infra specific */
18107 	WL_IFSTATS_XTLV_INFRA_SPECIFIC = 0x503,
18108 	/* MGT counters infra and softAP */
18109 	WL_IFSTATS_XTLV_MGT_CNT = 0x504,
18110 	/* AMPDU stats on per-IF */
18111 	WL_IFSTATS_XTLV_AMPDU_DUMP = 0x505,
18112 	WL_IFSTATS_XTLV_IF_SPECIFIC = 0x506,
18113 	WL_IFSTATS_XTLV_WL_PWRSTATS_AWDL = 0x507,
18114 	WL_IFSTATS_XTLV_IF_LQM = 0x508,
18115 	/* Interface specific state capture in periodic fashion */
18116 	WL_IFSTATS_XTLV_IF_PERIODIC_STATE = 0x509,
18117 	/* Event statistics on per-IF */
18118 	WL_IFSTATS_XTLV_IF_EVENT_STATS = 0x50A,
18119 	/* ecounters for nan */
18120 	/* nan slot stats */
18121 	WL_IFSTATS_XTLV_NAN_SLOT_STATS = 0x601
18122 };
18123 
18124 /* current version of wl_stats_report_t structure for request */
18125 #define WL_STATS_REPORT_REQUEST_VERSION_V2	2
18126 
18127 /* current version of wl_stats_report_t structure for response */
18128 #define WL_STATS_REPORT_RESPONSE_VERSION_V2	2
18129 
18130 /** Top structure of if_counters IOVar buffer */
18131 typedef struct wl_stats_report {
18132 	uint16	version;	/**< see version definitions above */
18133 	uint16	length;		/**< length of data including all paddings. */
18134 	uint8   data [];	/**< variable length payload:
18135 				 * 1 or more bcm_xtlv_t type of tuples.
18136 				 * each tuple is padded to multiple of 4 bytes.
18137 				 * 'length' field of this structure includes all paddings.
18138 				 */
18139 } wl_stats_report_t;
18140 
18141 /* interface specific mgt count */
18142 #define WL_MGT_STATS_VERSION_V1	1
18143 /* Associated stats type: WL_IFSTATS_MGT_CNT */
18144 typedef struct {
18145 	uint16	version;
18146 	uint16	length;
18147 
18148 	/* detailed control/management frames */
18149 	uint32	txnull;
18150 	uint32	rxnull;
18151 	uint32	txqosnull;
18152 	uint32	rxqosnull;
18153 	uint32	txassocreq;
18154 	uint32	rxassocreq;
18155 	uint32	txreassocreq;
18156 	uint32	rxreassocreq;
18157 	uint32	txdisassoc;
18158 	uint32	rxdisassoc;
18159 	uint32	txassocrsp;
18160 	uint32	rxassocrsp;
18161 	uint32	txreassocrsp;
18162 	uint32	rxreassocrsp;
18163 	uint32	txauth;
18164 	uint32	rxauth;
18165 	uint32	txdeauth;
18166 	uint32	rxdeauth;
18167 	uint32	txprobereq;
18168 	uint32	rxprobereq;
18169 	uint32	txprobersp;
18170 	uint32	rxprobersp;
18171 	uint32	txaction;
18172 	uint32	rxaction;
18173 	uint32	txpspoll;
18174 	uint32	rxpspoll;
18175 } wl_if_mgt_stats_t;
18176 
18177 #define WL_INFRA_STATS_VERSION_V1	1
18178 /* Associated stats type: WL_IFSTATS_INFRA_SPECIFIC */
18179 typedef struct wl_infra_stats {
18180 	uint16 version;             /**< version of the structure */
18181 	uint16 length;
18182 	uint32 rxbeaconmbss;
18183 	uint32 tbtt;
18184 } wl_if_infra_stats_t;
18185 
18186 #define LTECOEX_STATS_VER   1
18187 
18188 typedef struct wlc_ltecoex_stats {
18189 	uint16 version;	     /**< WL_IFSTATS_XTLV_WL_SLICE_LTECOEX */
18190 	uint16 len;			/* Length of  wl_ltecx_stats structure */
18191 	uint8 slice_index;	/* Slice unit of  wl_ltecx_stats structure */
18192 	uint8 pad[3];	/* Padding */
18193 	/* LTE noise based eCounters Bins
18194 	 cumulative the wl_cnt_wlc_t and  wl_ctl_mgt_cnt_t
18195 	 counter information based on LTE Coex interference level
18196 	 */
18197 	uint32	txframe_no_LTE;		/* txframe counter in no LTE Coex case */
18198 	uint32	rxframe_no_LTE;		/* rxframe counter in no LTE Coex case */
18199 	uint32	rxrtry_no_LTE;		/* rxrtry counter in no LTE Coex case */
18200 	uint32	txretrans_no_LTE;	/* txretrans counter in no LTE Coex case */
18201 	uint32	txnocts_no_LTE;		/* txnocts counter in no LTE Coex case */
18202 	uint32	txrts_no_LTE;		/* txrts counter in no LTE Coex case */
18203 	uint32	txdeauth_no_LTE;	/* txdeauth counter in no LTE Coex case */
18204 	uint32	txassocreq_no_LTE;	/* txassocreq counter in no LTE Coex case */
18205 	uint32	txassocrsp_no_LTE;		/* txassocrsp counter in no LTE Coex case */
18206 	uint32	txreassocreq_no_LTE;	/* txreassocreq counter in no LTE Coex case */
18207 	uint32	txreassocrsp_no_LTE;	/* txreassocrsp counter in no LTE Coex case */
18208 	uint32	txframe_light_LTE;	/* txframe counter in light LTE Coex case */
18209 	uint32	txretrans_light_LTE;	/* txretrans counter in light LTE Coex case */
18210 	uint32	rxframe_light_LTE;	/* rxframe counter in light LTE Coex case */
18211 	uint32	rxrtry_light_LTE;	/* rxrtry counter in light LTE Coex case */
18212 	uint32	txnocts_light_LTE;	/* txnocts counter in light LTE Coex case */
18213 	uint32	txrts_light_LTE;	/* txrts counter in light LTE Coex case */
18214 	uint32	txdeauth_light_LTE;	/* txdeauth counter in light LTE Coex case */
18215 	uint32	txassocreq_light_LTE;	/* txassocreq counter in light LTE Coex case */
18216 	uint32	txassocrsp_light_LTE;	/* txassocrsp counter in light LTE Coex case */
18217 	uint32	txreassocreq_light_LTE;	/* txreassocreq counter in light LTE Coex case */
18218 	uint32	txreassocrsp_light_LTE;	/* txreassocrsp counter in light LTE Coex case */
18219 	uint32	txframe_heavy_LTE;	/* txframe counter in heavy LTE Coex case */
18220 	uint32	txretrans_heavy_LTE;	/* txretrans counter in heavy LTE Coex case */
18221 	uint32	rxframe_heavy_LTE;	/* rxframe counter in heavy LTE Coex case */
18222 	uint32	rxrtry_heavy_LTE;	/* rxrtry counter in heavy LTE Coex case */
18223 	uint32	txnocts_heavy_LTE;	/* txnocts counter in heavy LTE Coex case */
18224 	uint32	txrts_heavy_LTE;	/* txrts counter in heavy LTE Coex case */
18225 	uint32	txdeauth_heavy_LTE;	/* txdeauth counter in heavy LTE Coex case */
18226 	uint32	txassocreq_heavy_LTE;	/* txassocreq counter in heavy LTE Coex case */
18227 	uint32	txassocrsp_heavy_LTE;	/* txassocrsp counter in heavy LTE Coex case */
18228 	uint32	txreassocreq_heavy_LTE;	/* txreassocreq counter in heavy LTE Coex case */
18229 	uint32	txreassocrsp_heavy_LTE;	/* txreassocrsp counter in heavy LTE Coex case */
18230 
18231 	/* LTE specific ecounters */
18232 	uint16	type4_txinhi_dur;	/* Duration of tx inhibit(in ms) due to Type4 */
18233 	uint16	type4_nonzero_cnt;	/* Counts of none zero Type4 msg */
18234 	uint16	type4_timeout_cnt;	/* Counts of Type4 timeout */
18235 	uint16	rx_pri_dur;		/* Duration of wlan_rx_pri assertions */
18236 	uint16	rx_pri_cnt;		/* Count of wlan_rx_pri assertions */
18237 	uint16	type6_dur;		/* duration of LTE Tx power limiting assertions */
18238 	uint16	type6_cnt;		/* Count of LTE Tx power limiting assertions */
18239 	uint16	ts_prot_frm_cnt;	/* count of WLAN protection frames triggered by LTE coex */
18240 	uint16	ts_gr_cnt;		/* count of intervals granted to WLAN in timesharing */
18241 	uint16	ts_gr_dur;		/* duration granted to WLAN in timesharing */
18242 } wlc_ltecoex_stats_t;
18243 
18244 #define CSA_EVT_CSA_RXED        (1 << 0)
18245 #define CSA_EVT_CSA_TIMEOUT     (1 << 1)
18246 #define CSA_EVT_FROM_INFRA      (1 << 2)
18247 typedef struct csa_event_data {
18248 	chanspec_t chan_old;
18249 	dot11_ext_csa_ie_t ecsa;
18250 	dot11_mesh_csp_ie_t mcsp;
18251 	dot11_wide_bw_chan_switch_ie_t wbcs;
18252 	uint8 flags;
18253 	uint8 pad[3];
18254 } csa_event_data_t;
18255 
18256 /* ifdef (WL_ASSOC_BCN_RPT) */
18257 enum wl_bcn_report_cmd_id {
18258 	WL_BCN_RPT_CMD_VER		= 0,
18259 	WL_BCN_RPT_CMD_CONFIG		= 1,
18260 	WL_BCN_RPT_CMD_VENDOR_IE	= 2,
18261 	WL_BCN_RPT_CMD_LAST
18262 };
18263 
18264 /* beacon report specific macros */
18265 #define WL_BCN_RPT_CCX_IE_OVERRIDE	(1u << 0)
18266 
18267 /* beacon report specific macros */
18268 #define WL_BCN_RPT_ASSOC_SCAN_UNSOLICITED_MODE	(1u << 1)
18269 #define WL_BCN_RPT_ASSOC_SCAN_SOLICITED_MODE	(1u << 2)
18270 #define WL_BCN_RPT_ASSOC_SCAN_MODE_SHIFT	(1)
18271 #define WL_BCN_RPT_ASSOC_SCAN_MODE_MASK		(WL_BCN_RPT_ASSOC_SCAN_UNSOLICITED_MODE |\
18272 							WL_BCN_RPT_ASSOC_SCAN_SOLICITED_MODE)
18273 #define WL_BCN_RPT_ASSOC_SCAN_MODE_MAX		(WL_BCN_RPT_ASSOC_SCAN_MODE_MASK >> \
18274 							WL_BCN_RPT_ASSOC_SCAN_MODE_SHIFT)
18275 /* beacon report mode specific macro */
18276 #define WL_BCN_RPT_ASSOC_SCAN_MODE_DEFAULT	WL_BCN_RPT_ASSOC_SCAN_UNSOLICITED_MODE
18277 
18278 /* beacon report timeout config specific macros */
18279 #define WL_BCN_RPT_ASSOC_SCAN_CACHE_TIMEOUT_DEFAULT	(120000)
18280 #define WL_BCN_RPT_ASSOC_SCAN_CACHE_TIMEOUT_MIN		(60000)
18281 #define WL_BCN_RPT_ASSOC_SCAN_CACHE_TIMEOUT_MAX		(0xFFFFFFFF)
18282 
18283 /* beacon report cache count specific macros */
18284 #define WL_BCN_RPT_ASSOC_SCAN_CACHE_COUNT_MIN		(0)
18285 #define WL_BCN_RPT_ASSOC_SCAN_CACHE_COUNT_MAX		(8)
18286 #define WL_BCN_RPT_ASSOC_SCAN_CACHE_COUNT_DEFAULT	(WL_BCN_RPT_ASSOC_SCAN_CACHE_COUNT_MAX)
18287 
18288 #define WL_BCN_REPORT_CMD_VERSION		1
18289 struct wl_bcn_report_cfg {
18290 	uint32	flags;			/**< Flags that defines the operation/setting information */
18291 	uint32	scan_cache_timeout;	/**< scan cache timeout value in millisec */
18292 	uint32	scan_cache_timer_pend;	/**< Read only pending time for timer expiry in millisec */
18293 	uint8	scan_cache_cnt;		/**< scan cache count */
18294 };
18295 
18296 /* endif (WL_ASSOC_BCN_RPT) */
18297 
18298 /* Thermal, Voltage, and Power Mitigation */
18299 #define TVPM_REQ_VERSION_1		1
18300 #define TVPM_REQ_CURRENT_VERSION	TVPM_REQ_VERSION_1
18301 
18302 /* tvpm iovar data */
18303 typedef struct {
18304 	uint16	version;		/* TVPM request version */
18305 	uint16	length;			/* Length of the entire structure */
18306 
18307 	uint16	req_type;		/* Request type: wl_tvpm_req_type_t */
18308 	uint16	req_len;		/* Length of the following value */
18309 	uint8	value[];		/* Variable length data depending on req_type */
18310 } wl_tvpm_req_t;
18311 
18312 /* tvpm iovar request types */
18313 typedef enum {
18314 	WL_TVPM_REQ_CLTM_INDEX,	/* req_value: uint32, range 1...100 */
18315 	WL_TVPM_REQ_PPM_INDEX,	/* req_value: uint32, range 1...100 */
18316 	WL_TVPM_REQ_ENABLE,	/* req_value: uint32, range 0...1 */
18317 	WL_TVPM_REQ_STATUS,	/* req_value: none */
18318 	WL_TVPM_REQ_PERIOD,	/* req_value: int32, range {-1,1-10} */
18319 	WL_TVPM_REQ_SETVAL,
18320 	WL_TVPM_REQ_MAX
18321 } wl_tvpm_req_type_t;
18322 
18323 /* structure for data returned by request type WL_TVPM_REQ_STATUS */
18324 typedef struct wl_tvpm_status {
18325 	uint16	enable;			/* whether TVPM is enabled */
18326 	uint16	tx_dutycycle;		/* a percentage: 1-100 */
18327 	int16	tx_power_backoff;	/* 0...-6 */
18328 	uint16	num_active_chains;	/* 1...3 */
18329 	int16	temp;			/* local temperature in degrees C */
18330 	uint8	vbat;			/* local voltage in units of 0.1V */
18331 	uint8	pad;
18332 } wl_tvpm_status_t;
18333 
18334 /* TVPM ecounters */
18335 typedef struct wl_tvpm_ecounters_t {
18336 	uint16	version;		/* version field */
18337 	uint16	length;			/* byte length in wl_tvpm_ecounters_t starting at version */
18338 	uint16	tx_dutycycle;		/* a percentage: 1-100 */
18339 	int16	tx_power_backoff;	/* 0...-6 */
18340 	uint16	num_active_chains;	/* 1...3 */
18341 	int16	temp;			/* local temperature */
18342 	uint8	vbat;			/* local voltage */
18343 	uint8	cltm;			/* CLTM index  */
18344 	uint8	ppm;			/* PPM index  */
18345 	uint8	pad;			/* pad to align to uint16 */
18346 } wl_tvpm_ecounters_t;
18347 
18348 #define TDMTX_ECOUNTERS_VERSION_V1      1
18349 #define TDMTX_ECOUNTERS_VERSION_V2      2
18350 
18351 /* TDMTX ecounters */
18352 typedef struct wl_tdmtx_ecounters_v1 {
18353 	uint16  version;	/* version field */
18354 	uint16	length;	/* byte length in wl_tdmtx_ecounters_t starting at version */
18355 	uint32	txa_on; /* TXA on requests */
18356 	uint32	txa_tmcnt; /* Total number of TXA timeout */
18357 	uint32	por_on; /* TXA POR requests */
18358 	uint32	txpuen; /* Path enable requests */
18359 	uint32	txpudis; /* Total number of times Tx path is muted on the slice */
18360 	uint32	txpri_on; /* Total number of times Tx priority was obtained by the slice */
18361 	uint32	txdefer; /* Total number of times Tx was deferred by the slice */
18362 	uint32	txmute; /* Total number of times active Tx muted on the slice */
18363 	uint32	actpwrboff; /* Total number of times TX power is backed off by the slice */
18364 	uint32	txa_dur; /* Total time txa on */
18365 	uint32	txpri_dur; /* Total time TXPri */
18366 	uint32	txdefer_dur; /* Total time txdefer */
18367 } wl_tdmtx_ecounters_v1_t;
18368 
18369 /* TDMTX ecounters for version 2 */
18370 typedef struct wl_tdmtx_ecounters_v2 {
18371 	uint16  version;	/* version field */
18372 	uint16	length;	/* byte length in wl_tdmtx_ecounters_t starting at version */
18373 	uint32	txa_on; /* TXA on requests */
18374 	uint32	txa_tmcnt; /* Total number of TXA timeout */
18375 	uint32  porhi_on; /* TXA PORHI requests */
18376 	uint32  porlo_on; /* TXA PORLO requests */
18377 	uint32	txpuen; /* Path enable requests */
18378 	uint32	txpudis; /* Total number of times Tx path is muted on the slice */
18379 	uint32	txpri_on; /* Total number of times Tx priority was obtained by the slice */
18380 	uint32	txdefer; /* Total number of times Tx was deferred by the slice */
18381 	uint32	txmute; /* Total number of times active Tx muted on the slice */
18382 	uint32	actpwrboff; /* Total number of times TX power is backed off by the slice */
18383 	uint32	txa_dur; /* Total time txa on */
18384 	uint32	txpri_dur; /* Total time TXPri */
18385 	uint32	txdefer_dur; /* Total time txdefer */
18386 } wl_tdmtx_ecounters_v2_t;
18387 
18388 /* Note: if this struct is changing update wl_scb_ecounters_vX_t version,
18389  * as this struct is sent as payload in wl_scb_ecounters_vX_t
18390  */
18391 typedef struct wlc_scb_stats_v1 {
18392 	uint32 tx_pkts;			    /* num of packets transmitted (ucast) */
18393 	uint32 tx_failures;		    /* num of packets failed */
18394 	uint32 rx_ucast_pkts;		    /* num of unicast packets received */
18395 	uint32 rx_mcast_pkts;		    /* num of multicast packets received */
18396 	uint32 tx_rate;			    /* Rate of last successful tx frame */
18397 	uint32 rx_rate;			    /* Rate of last successful rx frame */
18398 	uint32 rx_decrypt_succeeds;	    /* num of packets decrypted successfully */
18399 	uint32 rx_decrypt_failures;	    /* num of packets decrypted unsuccessfully */
18400 	uint32 tx_mcast_pkts;		    /* num of mcast pkts txed */
18401 	uint64 tx_ucast_bytes;		    /* data bytes txed (ucast) */
18402 	uint64 tx_mcast_bytes;		    /* data bytes txed (mcast) */
18403 	uint64 rx_ucast_bytes;		    /* data bytes recvd ucast */
18404 	uint64 rx_mcast_bytes;		    /* data bytes recvd mcast */
18405 	uint32 tx_pkts_retried;		    /* num of packets where a retry was necessary */
18406 	uint32 tx_pkts_retry_exhausted;	    /* num of packets where a retry was exhausted */
18407 	uint32 tx_rate_mgmt;		    /* Rate of last transmitted management frame */
18408 	uint32 tx_rate_fallback;	    /* last used lowest fallback TX rate */
18409 	uint32 rx_pkts_retried;		    /* # rx with retry bit set */
18410 	uint32 tx_pkts_total;		    /* total num of tx pkts */
18411 	uint32 tx_pkts_retries;		    /* total num of tx retries */
18412 	uint32 tx_pkts_fw_total;	    /* total num of tx pkts generated from fw */
18413 	uint32 tx_pkts_fw_retries;	    /* num of fw generated tx pkts retried */
18414 	uint32 tx_pkts_fw_retry_exhausted;  /* num of fw generated tx pkts where retry exhausted */
18415 } wlc_scb_stats_v1_t;
18416 
18417 /* ecounters for scb stats
18418  * XTLV ID: WL_IFSTATS_XTLV_SCB_ECOUNTERS
18419  */
18420 
18421 #define WL_SCB_ECOUNTERS_VERSION_1		1
18422 #define WL_SCB_ECOUNTERS_VERSION_2		2
18423 
18424 typedef struct wl_scb_ecounters_v1 {
18425 	uint16	version;	/* version field */
18426 	uint16	length;		/* struct length starting from version */
18427 	uint32	chanspec;	/* current chanspec where scb is operating */
18428 	struct  ether_addr  ea; /* peer ndi or sta ea */
18429 	uint8	peer_type;	/* peer type */
18430 	uint8	pad;
18431 
18432 	/* scb tx and rx stats */
18433 	wlc_scb_stats_v1_t stats;
18434 } wl_scb_ecounters_v1_t;
18435 
18436 typedef struct wl_scb_ecounters_v2 {
18437 	uint16	version;	/* version field */
18438 	uint16	length;		/* struct length starting from version */
18439 	uint32	chanspec;	/* current chanspec where scb is operating */
18440 	struct  ether_addr  ea; /* peer ndi or sta ea */
18441 	uint8	peer_type;	/* peer type */
18442 	uint8	pad;
18443 
18444 	/* scb tx and rx stats */
18445 	uint16 tx_rate;			    /* Rate(in Mbps) of last successful tx frame */
18446 	uint16 rx_rate;			    /* Rate(in Mbps) of last successful rx frame */
18447 	uint16 tx_rate_fallback;	    /* last used lowest fallback TX rate(in Mbps) */
18448 	uint16 pad1;
18449 	uint32 rx_decrypt_succeeds;	    /* num of packets decrypted successfully */
18450 	uint32 rx_decrypt_failures;	    /* num of packets decrypted unsuccessfully */
18451 	uint32 rx_pkts_retried;		    /* # rx with retry bit set */
18452 	uint32 tx_pkts_retries;		    /* total num of tx retries */
18453 	uint32 tx_failures;		    /* num of packets failed */
18454 	uint32 tx_pkts_total;		    /* total num of tx pkts */
18455 	int8   rssi[WL_STA_ANT_MAX];	    /* average rssi per antenna of data frames */
18456 } wl_scb_ecounters_v2_t;
18457 
18458 /* ecounters for nan slot stats
18459  * XTLV ID: WL_IFSTATS_XTLV_NAN_SLOT_STATS
18460  */
18461 
18462 #define WL_NAN_SLOT_ECOUNTERS_VERSION_1		1
18463 
18464 typedef struct wl_nan_slot_ecounters_v1 {
18465 	uint16	version;	      /* version field */
18466 	uint16	length;		      /* struct length starting from version */
18467 	uint32	chan[NAN_MAX_BANDS];  /* cur nan slot chanspec of both bands */
18468 	uint16	cur_slot_idx;	      /* cur nan slot index */
18469 	uint16  pad;
18470 	nan_sched_stats_t sched;      /* sched stats */
18471 	wl_nan_mac_stats_t mac;	      /* mac stats */
18472 } wl_nan_slot_ecounters_v1_t;
18473 /*
18474  * BT log definitions
18475  */
18476 
18477 /* common iovar struct */
18478 typedef struct wl_btl {
18479 	uint16 subcmd_id;	/* subcommand id */
18480 	uint16 len;		/* total length of data[] */
18481 	uint8 data[2];		/* subcommand data, variable length */
18482 } wl_btl_t;
18483 
18484 /* subcommand ids */
18485 #define WL_BTL_SUBCMD_ENABLE	0	/* enable/disable logging */
18486 #define WL_BTL_SUBCMD_STATS	1	/* statistics */
18487 
18488 /* WL_BTL_SUBCMD_ENABLE data */
18489 typedef struct wl_blt_enable {
18490 	uint8 enable;			/* 1 - enable, 0 - disable */
18491 	uint8 pad[3];			/* 4-byte struct alignment */
18492 } wl_btl_enable_t;
18493 
18494 /* WL_BTL_SUBCMD_STATS data */
18495 typedef struct wl_blt_stats {
18496 	uint32 bt_interrupt;			/* num BT interrupts */
18497 	uint32 config_req;			/* num CONFIG_REQ */
18498 	uint32 config_res_success;		/* num CONFIG_RES successful */
18499 	uint32 config_res_fail;			/* num CONFIG_RES failed */
18500 	uint32 log_req;				/* num LOG_REQ */
18501 	uint32 log_res_success;			/* num LOG_RES successful */
18502 	uint32 log_res_fail;			/* num LOG_RES failed */
18503 	uint32 indirect_read_fail;		/* num indirect read fail */
18504 	uint32 indirect_write_fail;		/* num indirect write fail */
18505 	uint32 dma_fail;			/* num DMA failed */
18506 	uint32 min_log_req_duration;		/* min log request duration in usec */
18507 	uint32 max_log_req_duration;		/* max log request duration in usec */
18508 	uint16 mem_dump_req;			/* num mem dump requests */
18509 	uint16 mem_dump_success;		/* num mem dumps successful */
18510 	uint16 mem_dump_fail;			/* num mem dumps failed */
18511 	uint16 bt_wake_success;			/* num BT wakes successful */
18512 	uint16 bt_wake_fail;			/* num BT wakes failed */
18513 	uint16 mem_dump_req_interrupt;		/* num MEM_DUMP_REQ interrupt */
18514 	uint16 mem_dump_res_interrupt;		/* num MEM_DUMP_RES interrupt */
18515 	uint16 mem_dump_res_timeout;		/* num MEM_DUMP_RES timeout */
18516 	uint16 mem_dump_proc_no_bt_ready;	/* num proceed if no BT ready */
18517 	uint16 mem_dump_proc_no_bt_response;	/* num proceed if no BT response */
18518 	uint16 mem_dump_proc_no_bt_clock;	/* num proceed if no BT clock */
18519 	uint16 pad;				/* alignment */
18520 	uint32 last_failed_region;		/* start addr of last failed region */
18521 	uint32 min_mem_dump_duration;		/* min mem dump duration in usec */
18522 	uint32 max_mem_dump_duration;		/* max mem dump duration in usec */
18523 } wl_btl_stats_t;
18524 
18525 /* IOV AWD DATA */
18526 
18527 /* AWD DATA structures */
18528 typedef struct {
18529 	uint8 version;	/* Extended trap version info */
18530 	uint8 reserved;	/* currently unused */
18531 	uint16 length;	/* Length of data excluding this header */
18532 	uint8 data[];	/* this data is TLV of tags */
18533 } awd_data_v1_t;
18534 
18535 /* AWD TAG structure */
18536 typedef struct {
18537 	uint8 tagid;	/* one of AWD DATA TAGs numbers */
18538 	uint8 length;	/* the data size represented by this field must be aligned to 32 bits */
18539 	uint8 data[];	/* variable size, defined by length field */
18540 } awd_tag_data_v1_t;
18541 
18542 /* IOV ETD DATA */
18543 
18544 /* ETD DATA structures */
18545 typedef struct {
18546 	uint8 version;	/* Extended trap version info */
18547 	uint8 reserved;	/* currently unused */
18548 	uint16 length;	/* Length of data excluding this header */
18549 	uint8 data[];	/* this data is TLV of tags */
18550 } etd_data_v1_t;
18551 
18552 /* ETD TAG structure */
18553 typedef struct {
18554 	uint8 tagid;	/* one of ETD DATA TAGs numbers */
18555 	uint8 length;	/* the data size represented by this field must be aligned to 32 bits */
18556 	uint8 data[];	/* variable size, defined by length field */
18557 } etd_tag_data_v1_t;
18558 
18559 /* ETD information structures associated with ETD_DATA_Tags */
18560 /* ETD_JOIN_CLASSIFICATION_INFO 10 */
18561 typedef struct {
18562 	uint8 assoc_type;		/* assoc type */
18563 	uint8 assoc_state;		/* current state of assoc state machine */
18564 	uint8 wpa_state;		/* wpa->state */
18565 	uint8 wsec_portopen;		/* shows if security port is open */
18566 	uint8 total_attempts_num;	/* total number of join attempts (bss_retries) */
18567 	uint8 num_of_targets;		/* up to 3, in current design */
18568 	uint8 reserved [2];		/* padding to get 32 bits alignment */
18569 	uint32 wsec;			/* bsscfg->wsec */
18570 	uint32 wpa_auth;		/* bsscfg->WPA_auth */
18571 	uint32 time_to_join;		/* time duration to process WLC_SET_SSID request (ms) */
18572 } join_classification_info_v1_t;
18573 
18574 /* ETD_JOIN_TARGET_CLASSIFICATION_INFO 11 */
18575 typedef struct {
18576 	int8 rssi;			/* RSSI on current channel */
18577 	uint8 cca;			/* CCA on current channel */
18578 	uint8 channel;			/* current channel */
18579 	uint8 num_of_attempts;		/* (bss_retries) up to 5 */
18580 	uint8 oui[3];			/* the first three octets of the AP's address */
18581 	uint8 reserved;			/* padding to get 32 bits alignment */
18582 	uint32 time_duration;		/* time duration of current attempt (ms) */
18583 } join_target_classification_info_v1_t;
18584 
18585 /* ETD_ASSOC_STATE 12 */
18586 typedef struct {
18587 	uint8 assoc_state;		/* assoc type */
18588 	uint8 reserved [3];		/* padding to get 32 bits alignment */
18589 } join_assoc_state_v1_t;
18590 
18591 /* ETD_CHANNEL 13 tag */
18592 typedef struct {
18593 	uint8 channel;			/* last attempt channel */
18594 	uint8 reserved [3];		/* padding to get 32 bits alignment */
18595 } join_channel_v1_t;
18596 
18597 /* ETD_TOTAL_NUM_OF_JOIN_ATTEMPTS 14 */
18598 typedef struct {
18599 	uint8 total_attempts_num;	/* total number of join attempts (bss_retries) */
18600 	uint8 reserved [3];		/* padding to get 32 bits alignment */
18601 } join_total_attempts_num_v1_t;
18602 
18603 /* IOV_ROAM_CACHE structures */
18604 
18605 enum wl_rmc_report_cmd_id {
18606 	WL_RMC_RPT_CMD_VER	= 0,
18607 	WL_RMC_RPT_CMD_DATA	= 1,
18608 	WL_RMC_RPT_CMD_LAST
18609 };
18610 
18611 enum wl_rmc_report_xtlv_id {
18612 	WL_RMC_RPT_XTLV_VER		= 0x0,
18613 	WL_RMC_RPT_XTLV_BSS_INFO	= 0x1,
18614 	WL_RMC_RPT_XTLV_CANDIDATE_INFO	= 0x2
18615 };
18616 
18617 /* WL_RMC_RPT_XTLV_BSS_INFO */
18618 typedef struct {
18619 	int16 rssi;		/* current BSS RSSI */
18620 	uint8 reason;		/* reason code for last full scan */
18621 	uint8 status;		/* last status code for not roaming */
18622 	uint32 fullscan_count;	/* number of full scans performed on current BSS */
18623 	uint32 time_full_scan;	/* delta time (in ms) between cur time and full scan timestamp */
18624 } rmc_bss_info_v1_t;
18625 
18626 /* WL_RMC_RPT_XTLV_CANDIDATE_INFO */
18627 typedef struct {
18628 	int16 rssi;		/* last seen rssi */
18629 	uint16 ctl_channel;	/* channel */
18630 	uint32 time_last_seen;	/* delta time (in ms) between cur time and last seen timestamp */
18631 	uint16 bss_load;	/* BSS load */
18632 	uint8 bssid [6];	/* padding to get 32 bits alignment */
18633 } rmc_candidate_info_v1_t;
18634 
18635 #define WL_FILTER_IE_VERSION 1
18636 enum wl_filter_ie_options {
18637 	WL_FILTER_IE_CLEAR =            0,   /* allow  element id in packet.For suboption */
18638 	WL_FILTER_IE_SET =              1,   /* filter element id in packet.For suboption */
18639 	WL_FILTER_IE_LIST =             2,   /* list  element ID's.Set as option */
18640 	WL_FILTER_IE_CLEAR_ALL =        3,   /* clear all the element.Set as option */
18641 	WL_FILTER_IE_CHECK_SUB_OPTION = 4    /* check for suboptions.Set only as option */
18642 };
18643 
18644 typedef struct wl_filter_ie_tlv {
18645 	uint16 id;
18646 	uint16 len;			/* sub option length + pattern length */
18647 	uint8 data[];		/* sub option + pattern matching(OUI,type,sub-type) */
18648 } wl_filter_ie_tlv_t;
18649 
18650 typedef struct wl_filter_ie_iov {
18651 	uint16 version;				/* Structure version */
18652 	uint16 len;					/* Total length of the structure */
18653 	uint16 fixed_length;		/* Total length of fixed fields */
18654 	uint8 option;				/* Filter action - check for suboption */
18655 	uint8 pad[1];				/* Align to 4 bytes */
18656 	uint32 pktflag;				/* frame type */
18657 	uint8  tlvs[]; 				/* variable data (zero in for list ,clearall) */
18658 } wl_filter_ie_iov_v1_t;
18659 
18660 /* Event aggregation config */
18661 #define EVENT_AGGR_CFG_VERSION		1
18662 #define EVENT_AGGR_DISABLED			0x0
18663 #define EVENT_AGGR_ENABLED			0x1
18664 
18665 #define EVENT_AGGR_BUFSIZE_MAX		1512
18666 #define EVENT_AGGR_BUFSIZE_MIN		512
18667 
18668 #define EVENT_AGGR_FLUSH_TIMEOUT_DEFAULT	100
18669 #define EVENT_AGGR_FLUSH_TIMEOUT_MAX		2000
18670 #define EVENT_AGGR_NUM_EVENTS_FLUSH		5
18671 typedef struct event_aggr_config {
18672 	uint16 version;
18673 	uint16 len;
18674 	uint16 flags;			/* bit 0 to enable/disable the feature */
18675 	uint16 bufsize;			/* Aggregate buffer size */
18676 	uint16 flush_timeout;		/* Timeout for event flush */
18677 	uint16 num_events_flush;	/* Number of events aggregated before flush */
18678 } event_aggr_config_t;
18679 
18680 #ifndef WL_TDMTX_TYPEDEF_HAS_ALIAS
18681 typedef tdmtx_cnt_v1_t tdmtx_cnt_t;
18682 typedef tdmtx_cnt_shm_v1_t tdmtx_cnt_shm_t;
18683 typedef wl_tdmtx_ecounters_v1_t wl_tdmtx_ecounters_t;
18684 #define WL_CNT_TDMTX_STRUCT_SZ (sizeof(tdmtx_cnt_t))
18685 #define WL_CNT_TDMTX_SHM_SZ (sizeof(tdmtx_cnt_shm_t))
18686 #endif // endif
18687 
18688 /** chanctxt related statistics */
18689 #define CHANCTXT_STATS_VERSION_1 1
18690 #define CHANCTXT_STATS_CURRENT_VERSION CHANCTXT_STATS_VERSION_1
18691 typedef struct wlc_chanctxt_stats {
18692 	uint32  excursionq_end_miss;
18693 	uint32	activeq_end_miss;
18694 	uint32	no_chanctxt_count;
18695 	uint32	txqueue_end_incomplete;
18696 	uint32	txqueue_start_incomplete;
18697 } wlc_chanctxt_stats_core_t;
18698 
18699 typedef struct chanctxt_stats {
18700 	uint16	version;
18701 	uint16	length;
18702 	wlc_chanctxt_stats_core_t corestats[MAX_NUM_D11CORES];
18703 } wlc_chanctxt_stats_t;
18704 
18705 typedef struct wl_txdc_ioc {
18706 	uint8 ver;
18707 	uint8 id;	/* ID of the sub-command */
18708 	uint16 len;	/* total length of all data[] */
18709 	uint8  data[];	/* var len payload */
18710 } wl_txdc_ioc_t;
18711 
18712 /*
18713  * iovar subcommand ids
18714  */
18715 enum {
18716 	IOV_TXDC_ENB = 1,
18717 	IOV_TXDC_MODE = 2,
18718 	IOV_TXDC_DUMP = 3,
18719 	IOV_TXDC_LAST
18720 };
18721 
18722 /* WL_NAN_XTLV_SLOT_STATS */
18723 /* WL_NAN_EVENT_SLOT_START, WL_NAN_EVENT_SLOT_END */
18724 typedef struct nan_slot_event_data {
18725 	uint32 cur_slot_idx; /* current idx in channel schedule */
18726 	uint32 fw_time; /* target current time in microseconds */
18727 	uint32 band; /* current band (2G/5G) for which the event is received */
18728 } nan_slot_event_data_t;
18729 
18730 /* SAE (Simultaneous Authentication of Equals) error codes.
18731  * These error codes are local.
18732  */
18733 
18734 #define WL_SAE_E_BASE -3072
18735 
18736 /*  SAE status codes are reserved from -3072 to -4095 (1K) */
18737 
18738 enum WL_SAE_E_STATUS_CODES {
18739 	WL_SAE_E_AUTH_FAILURE			= -3072,
18740 	/* Discard silently */
18741 	WL_SAE_E_AUTH_DISCARD			= -3073,
18742 	/* Authentication in progress */
18743 	WL_SAE_E_AUTH_CONTINUE			= -3074,
18744 	/* Invalid scalar/elt */
18745 	WL_SAE_E_AUTH_COMMIT_INVALID		= -3075,
18746 	/* Invalid confirm token */
18747 	WL_SAE_E_AUTH_CONFIRM_INVALID		= -3076,
18748 	/* Peer scalar validation failure */
18749 	WL_SAE_E_CRYPTO_SCALAR_VALIDATION	= -3077,
18750 	/* Peer element prime validation failure */
18751 	WL_SAE_E_CRYPTO_ELE_PRIME_VALIDATION	= -3078,
18752 	/* Peer element is not on the curve */
18753 	WL_SAE_E_CRYPTO_ELE_NOT_ON_CURVE	= -3079,
18754 	/* Generic EC error (eliptic curve related) */
18755 	WL_SAE_E_CRYPTO_EC_ERROR		= -3080,
18756 	/* Both local and peer mac addrs are same */
18757 	WL_SAE_E_CRYPTO_EQUAL_MACADDRS		= -3081,
18758 	/* Loop exceeded in deriving the scalar */
18759 	WL_SAE_E_CRYPTO_SCALAR_ITER_EXCEEDED	= -3082,
18760 	/* ECC group is unsupported */
18761 	WL_SAE_E_CRYPTO_UNSUPPORTED_GROUP	= -3083,
18762 	/* Exceeded the hunting-and-pecking counter */
18763 	WL_SAE_E_CRYPTO_PWE_COUNTER_EXCEEDED	= -3084,
18764 	/* SAE crypto component is not initialized */
18765 	WL_SAE_E_CRYPTO_NOT_INITED		= -3085,
18766 	/* bn_get has failed */
18767 	WL_SAE_E_CRYPTO_BN_GET_ERROR		= -3086,
18768 	/* bn_set has failed */
18769 	WL_SAE_E_CRYPTO_BN_SET_ERROR		= -3087,
18770 	/* PMK is not computed yet */
18771 	WL_SAE_E_CRYPTO_PMK_UNAVAILABLE		= -3088,
18772 	/* Peer confirm did not match */
18773 	WL_SAE_E_CRYPTO_CONFIRM_MISMATCH	= -3089,
18774 	/* Element K is at infinity no the curve */
18775 	WL_SAE_E_CRYPTO_KEY_AT_INFINITY		= -3090,
18776 	/* SAE Crypto private data magic number mismatch */
18777 	WL_SAE_E_CRYPTO_PRIV_MAGIC_MISMATCH	= -3091
18778 };
18779 
18780 /* Block Channel */
18781 #define WL_BLOCK_CHANNEL_VER_1	1u
18782 
18783 typedef struct wl_block_ch_v1 {
18784 	uint16 version;
18785 	uint16 len;
18786 	uint32 band;		/* Band select */
18787 	uint8 channel_num;	/* The number of block channels in the selected band */
18788 	uint8 padding[3];
18789 	uint8 channel[];	/* Channel to block, Variable Length */
18790 } wl_block_ch_v1_t;
18791 
18792 typedef struct dma_wl_addr_region {
18793 	uint32 addr_low;
18794 	uint32 addr_high;
18795 } dma_wl_addr_region_t;
18796 
18797 #define WL_ROAMSTATS_IOV_VERSION 1
18798 
18799 #define MAX_PREV_ROAM_EVENTS   16u
18800 
18801 #define ROAMSTATS_UNKNOWN_CNT  0xFFFFu
18802 
18803 /* roaming statistics counter structures */
18804 typedef struct wlc_assoc_roamstats_event_msg_v1 {
18805 	uint32  event_type;             /* Message (see below) */
18806 	uint32  status;                 /* Status code (see below) */
18807 	uint32  reason;                 /* Reason code (if applicable) */
18808 	uint32  timestamp;              /* Timestamp of event */
18809 } wlc_assoc_roamstats_event_msg_v1_t;
18810 
18811 enum wl_roamstats_cmd_id {
18812 	WL_ROAMSTATS_XTLV_CMD_VER = 0,
18813 	WL_ROAMSTATS_XTLV_CMD_RESET = 1,
18814 	WL_ROAMSTATS_XTLV_CMD_STATUS = 2,
18815 	WL_ROAMSTATS_XTLV_CMD_LAST      /* Keep this at the end */
18816 };
18817 
18818 enum wl_roamstats_xtlv_id {
18819 	WL_ROAMSTATS_XTLV_VER           = 0x0,
18820 	WL_ROAMSTATS_XTLV_COUNTER_INFO          = 0x1,
18821 	WL_ROAMSTATS_XTLV_PREV_ROAM_EVENTS      = 0x2,
18822 	WL_ROAMSTATS_XTLV_REASON_INFO           = 0x3
18823 };
18824 
18825 /* WL_ROAMSTATS_XTLV_COUNTER_INFO */
18826 typedef struct {
18827 	uint32 initial_assoc_time;
18828 	uint32 prev_roam_time;
18829 	uint32 host_access_time;
18830 	uint16 roam_success_cnt;
18831 	uint16 roam_fail_cnt;
18832 	uint16 roam_attempt_cnt;
18833 	uint16 max_roam_target_cnt;
18834 	uint16 min_roam_target_cnt;
18835 	uint16 max_cached_ch_cnt;
18836 	uint16 min_cached_ch_cnt;
18837 	uint16 partial_roam_scan_cnt;
18838 	uint16 full_roam_scan_cnt;
18839 } roamstats_counter_info_v1_t;
18840 
18841 /* WL_ROAMSTATS_XTLV_PREV_ROAM_EVENTS */
18842 typedef struct {
18843 	uint16 max;
18844 	uint16 pos;
18845 	wlc_assoc_roamstats_event_msg_v1_t roam_event[];
18846 } roamstats_prev_roam_events_v1_t;
18847 
18848 /* WL_ROAMSTATS_XTLV_REASON_INFO */
18849 typedef struct {
18850 	uint16 max;
18851 	uint16 reason_cnt[];
18852 } roamstats_reason_info_v1_t;
18853 
18854 #ifdef HEALTH_CHECK_WLIOCTL
18855 /* Health check status format:
18856  * reporting status size = uint32
18857  * 8 LSB bits are reserved for: WARN (0), ERROR (1), and other levels
18858  * MSB 24 bits are reserved for client to fill in its specific status
18859  */
18860 #define HEALTH_CHECK_STATUS_OK			0
18861 /* Bit positions. */
18862 #define HEALTH_CHECK_STATUS_WARN		0x1
18863 #define HEALTH_CHECK_STATUS_ERROR		0x2
18864 #define HEALTH_CHECK_STATUS_TRAP		0x4
18865 #define HEALTH_CHECK_STATUS_NOEVENT		0x8
18866 
18867 /* Indication that required information is populated in log buffers */
18868 #define HEALTH_CHECK_STATUS_INFO_LOG_BUF	0x80
18869 #define HEALTH_CHECK_STATUS_MASK		(0xFF)
18870 
18871 #define HEALTH_CHECK_STATUS_MSB_SHIFT		8
18872 #endif /* HEALTH_CHECK_WLIOCTL */
18873 
18874 /** receive signal reporting module interface */
18875 
18876 #define WL_RXSIG_IOV_MAJOR_VER       (1u)
18877 #define WL_RXSIG_IOV_MINOR_VER       (1u)
18878 #define WL_RXSIG_IOV_MAJOR_VER_SHIFT (8u)
18879 #define WL_RXSIG_IOV_VERSION \
18880 	((WL_RXSIG_IOV_MAJOR_VER << WL_RXSIG_IOV_MAJOR_VER_SHIFT) | WL_RXSIG_IOV_MINOR_VER)
18881 #define WL_RXSIG_IOV_GET_MAJOR(x)    (x >> WL_RXSIG_IOV_MAJOR_VER_SHIFT)
18882 #define WL_RXSIG_IOV_GET_MINOR(x)    (x & 0xFF)
18883 
18884 enum wl_rxsig_cmd_rssi_mode {
18885 	WL_RXSIG_MODE_DB =   0x0,
18886 	WL_RXSIG_MODE_QDB =  0x1,
18887 	WL_RXSIG_MODE_LAST
18888 };
18889 
18890 /* structure defs for 'wl rxsig [cmd]' iovars */
18891 enum wl_rxsig_iov_v1 {
18892 	WL_RXSIG_CMD_RSSI =      0x1,     /**< combined rssi moving avg */
18893 	WL_RXSIG_CMD_SNR =       0x2,     /**< combined snr moving avg */
18894 	WL_RXSIG_CMD_RSSIANT =   0x3,     /**< rssi moving avg per-ant */
18895 	WL_RXSIG_CMD_SNRANT =    0x4,     /**< snr moving avg per-snr */
18896 	WL_RXSIG_CMD_SMPLWIN =   0x5,     /**< config for sampling window size */
18897 	WL_RXSIG_CMD_SMPLGRP =   0x7,     /**< config for grouping of pkt type */
18898 	WL_RXSIG_CMD_STA_MA =    0x8,
18899 	WL_RXSIG_CMD_MAMODE =    0x9,
18900 	WL_RXSIG_CMD_MADIV =     0xa,
18901 	WL_RXSIG_CMD_DUMP =      0xb,
18902 	WL_RXSIG_CMD_DUMPWIN =   0xc,
18903 	WL_RXSIG_CMD_TOTAL
18904 };
18905 
18906 struct wl_rxsig_cfg_v1 {
18907 	uint16 version;
18908 	chanspec_t chan;       /**< chanspec info for querying stats */
18909 	uint8 pmac[ETHER_ADDR_LEN];       /**< peer(link) mac address */
18910 };
18911 
18912 struct wl_rxsig_iov_rssi_v1 {
18913 	int8 rssi;
18914 	uint8 rssi_qdb;
18915 	uint8 pad[2];
18916 };
18917 
18918 struct wl_rxsig_iov_snr_v1 {
18919 	int16 snr;
18920 	uint16 pad;
18921 };
18922 
18923 struct wl_rxsig_iov_rssi_ant_v1 {
18924 	int8 deci[WL_RSSI_ANT_MAX];
18925 	uint8 frac[WL_RSSI_ANT_MAX];
18926 	uint8 rssi_mode;       /**< MODE_DB or MODE_QDB */
18927 	uint8 num_of_ant;      /**< total number of ants */
18928 	uint8 pad[2];          /**< padding for 32bit align */
18929 };
18930 
18931 #ifdef BCM_SDC
18932 
18933 #define SDC_TRIGGER_CONFIG_VER_1	1
18934 typedef struct {
18935 	uint16  version;
18936 	uint16	type;
18937 	uint8	activate;
18938 	uint8	pad;
18939 } sdc_trigger_cfg_t;
18940 
18941 typedef enum sdc_trigger_types {
18942 	SDC_TYPE_STA_ONBOARD_DEBUG = 1,
18943 #ifdef SDC_TEST
18944 	/*
18945 	 * This is for test purpose only. Don't assign specific value.
18946 	 * Keep at the end
18947 	 */
18948 	SDC_TYPE_TEST1,
18949 	SDC_TYPE_TEST2,
18950 	SDC_TYPE_TEST3,
18951 #endif /* SDC_TEST */
18952 	SDC_TYPE_MAX_TRIGGER
18953 } sdc_trigger_types_t;
18954 
18955 #endif /* BCM_SDC */
18956 
18957 typedef struct wl_avs_info_v1 {
18958 	uint16 version;		/* Structure version */
18959 	uint16 equ_version;	/* Equation Version */
18960 	uint32 RO;		/* RO in OTP */
18961 	uint32 equ_csr;		/* Equated CSR */
18962 	uint32 read_csr;	/* Read Back CSR */
18963 	uint32 aging;		/* aging setting in nvram */
18964 } wl_avs_info_v1_t;
18965 
18966 #define WL_AVS_INFO_VER_1	1
18967 
18968 /* bitmap for clm_flags iovar */
18969 #define WL_CLM_TXBF                0x01 /**< Flag for Tx beam forming */
18970 #define WL_CLM_RED_EU              0x02 /* Flag for EU RED */
18971 #define WL_CLM_EDCRS_EU            0x04 /**< Use EU post-2015 energy detect */
18972 #define WL_CLM_DFS_TPC             0x08 /**< Flag for DFS TPC */
18973 #define WL_CLM_RADAR_TYPE_EU       0x10 /**< Flag for EU */
18974 #define WL_CLM_DFS_FCC             WL_CLM_DFS_TPC /**< Flag for DFS FCC */
18975 #define WL_CLM_DFS_EU              (WL_CLM_DFS_TPC | WL_CLM_RADAR_TYPE_EU) /**< Flag for DFS EU */
18976 
18977 /* SC (scan core) command IDs */
18978 enum wl_sc_cmd {
18979 	WL_SC_CMD_DBG = 0,
18980 	WL_SC_CMD_CNX = 1,
18981 	WL_SC_CMD_LAST
18982 };
18983 
18984 #define WSEC_MAX_SAE_PASSWORD_LEN      128
18985 
18986 typedef struct {
18987 	ushort  password_len;           /* octets in key material */
18988 	uint8   password[WSEC_MAX_SAE_PASSWORD_LEN];    /* maximum key len for SAE passphrase */
18989 } wsec_sae_password_t;
18990 
18991 /** Statistic related to dongle sleep while in wowl. */
18992 typedef struct wl_sleep_stats {
18993 	uint32 cpu_wakes; /** Number of times the CPU has woken up from sleep. */
18994 	uint32 cpu_up_us;		/** CPU active time in us */
18995 	uint32 total_time_ms;	/** Total measured time in ms */
18996 	uint32 dtim;			/** Number of DTIM processed */
18997 	uint32 tx_packets;		/** Number of packets sent */
18998 	uint32 tx_bytes;		/** Number of bytes sent */
18999 	uint32 tx_us;			/** Time radio spent doing TX. */
19000 	uint32 rx_packets;		/** Number of packets received */
19001 	uint32 rx_bytes;		/** Number of bytes received */
19002 	uint32 rx_us;			/** Time radio spent doing RX. */
19003 	uint32 idle_us;			/** Time radio spent idle. */
19004 	uint32 arp_resp_cnt;	/** Number of ARP replies sent */
19005 	uint32 tcpka_ack_cnt;	/** Number of TCP KeepAlive Acks sent */
19006 	uint32 grp_key_renew_cnt; /** Number of group key renewals */
19007 } wl_sleep_stats_t;
19008 
19009 /* NSC defintions */
19010 #include <packed_section_start.h>
19011 typedef BWL_PRE_PACKED_STRUCT struct nsc_af_body {
19012 	uint8			type;		/* should be 0x7f */
19013 	uint8			oui[DOT11_OUI_LEN];	/* just like it says */
19014 	uint8			subtype;	/* 221, 0xdd: proprietary ie */
19015 	uint8			ielen;		/* */
19016 	uint8			data[1];	/* variable */
19017 } BWL_POST_PACKED_STRUCT nsc_af_body_t;
19018 #include <packed_section_end.h>
19019 
19020 #define NSC_SUBTYPES_MAX	8
19021 #define NSC_SUBTYPES_EOL	0xff
19022 
19023 /* Aloe constants */
19024 #define WL_ALOE_AF_TYPE			(0x7)
19025 #define WL_ALOE_CMD_PERIODIC	(0x01)
19026 #define WL_ALOE_CMD_ONESHOT		(0x02)
19027 #define WL_ALOE_HASHTABLE_SZ	(508) /**< Max number of hash entries */
19028 #define WL_ALOE_HASH_SZ			(8) /**< eight byte hash size */
19029 #define WL_ALOE_AF_CACHE_SZ		(8) /** Mac Number of cached AF. */
19030 
19031 /** ALOE configuration */
19032 typedef struct wl_aloe_cfg {
19033 	/** ALOE major version number to be able to receive. */
19034 	uint8 major;
19035 	/** ALOE minor version number to be able to receive. */
19036 	uint8 minor;
19037 	/** Bitfield of the command to be able to receive.
19038 	 * BWL_ALOE_CMD_PERIODIC and/or BWL_ALOE_CMD_ONESHOT.
19039 	 */
19040 	uint8 command;
19041 	/** BSSID to receive the Aloe frame sent on. */
19042 	struct ether_addr BSSID;
19043 } wl_aloe_cfg_t;
19044 
19045 /** ALOE periodic action frame */
19046 typedef struct wl_aloe_periodic_af {
19047 	/** Tx interval, in ms. */
19048 	uint32 tx_int;
19049 	/** Number of AF to send during a phase.
19050 	 * Phase duration is defined as tx_cnt * tx_int ms.
19051 	 */
19052 	uint32 tx_cnt;
19053 	/** Interphase space, defined as muted TX periods during which no AF is sent.
19054 	 * Interphase duration is defined as idle_cnt * tx_int ms.
19055 	 */
19056 	uint32 idle_cnt;
19057 	/** Start of the RX window as a number of tx interval
19058 	 * The RX window starts at  rx_start * tx_int ms after the
19059 	 * beginning of a given phase.
19060 	 */
19061 	uint32 rx_start;
19062 	/** Number of tx_inteval the listening window lasts
19063 	 * A RX window lasts for rx_cnt * tx_int ms.
19064 	 */
19065 	uint32 rx_cnt;
19066 	wl_af_params_t	af;
19067 } wl_aloe_periodic_af_t;
19068 
19069 /**
19070  * @brief Aloe's action frame format.
19071  */
19072 typedef struct wl_aloe_af {
19073 	/** Vendor specific: 0x7f */
19074 	uint8	category;
19075 	/** 00-22-aa */
19076 	uint8	oui[3];
19077 	/** 7 */
19078 	uint8	subtype;
19079 	uint8	PAD0;
19080 	/** ALOE Major version number */
19081 	uint8	major;
19082 	/** ALOE Minor version number */
19083 	uint8	minor;
19084 	/** Periodic or single shot */
19085 	uint8	command;
19086 	uint8	PAD1;
19087 	/** Authentication hash */
19088 	uint8	hash[8];
19089 	/** Aloe payload */
19090 	uint8	data[];
19091 } wl_aloe_af_t;
19092 
19093 typedef struct wl_aloe_stats {
19094 	uint32 tx_af_total; /** Counter for the total number of AF sent. */
19095 	/** Number of AF not sent because the previous TX is still pending */
19096 	/** Data is held in the AF data legacy buffer */
19097 	uint32 tx_af_aborted;
19098 	uint32 tx_af_failed; /** Number of TX AF that failed for a reason */
19099 	uint32 rx_af; /** Received ALOE Action frames. */
19100 	uint32 rx_af_filtered; /** Received and filtered out Aloe AF. */
19101 	/** Action frame received but dropped as the host is not asleep yet. */
19102 	uint32 rx_dropped;
19103 	uint32 cache_cnt;
19104 } wl_aloe_stats_t;
19105 
19106 /* pkteng_ru_fill enum definitions */
19107 #define PKTENG_RU_FILL_VERSION	1
19108 #define PKTENG_RU_FILL_LENGTH	32
19109 
19110 /* Packet length in bytes */
19111 #define PKT_LEN_TRIG_PROFILE_DEFAULT 100
19112 #define PKT_LEN_TRIG_PROFILE_0 650
19113 #define PKT_LEN_TRIG_PROFILE_1 600
19114 #define PKT_LEN_TRIG_PROFILE_2 4000
19115 #define PKT_LEN_TRIG_PROFILE_3 4000
19116 #define PKT_LEN_TRIG_PROFILE_4 3000
19117 #define PKT_LEN_TRIG_PROFILE_5 3000
19118 
19119 /* RU Allocation value */
19120 #define RU26_5 5
19121 #define RU242_61 61
19122 
19123 /* MAC Broadcast address individual Octet */
19124 #define BCAST_ADDR_OCTET 0xff
19125 
19126 #define ONE_SHOT_TRIGGER_TX 255 /* To send one shot trigger frame */
19127 #define TRIG_PERIOD_MAX 255 /* Max period */
19128 #define TRIG_PROFILES 6	/* Packet profiles to compute cmn and usr info params */
19129 #define HE_TRIG_FRM_NUSERINFO 1 /* Default number of user info fields */
19130 #define TRIG_TX_MIN_IP_ARGS 1
19131 #define TRIG_TX_MAX_IP_ARGS 4
19132 
19133 #define HE_TRIG_NON_HT_PPDU	0
19134 #define HE_TRIG_VHT_PPDU	1
19135 
19136 typedef struct {
19137 	uint8 ru_alloc_val;             /* ru allocation index number */
19138 	uint8 mcs_val;                  /* mcs allocated value */
19139 	uint8 nss_val;                  /* num of spatial streams */
19140 	uint32 num_bytes;               /* approx num of bytes to calculate other required params */
19141 } pkteng_reduced_t;
19142 
19143 /* Generic BW defintions */
19144 enum {
19145 	BW_20MHz = 0,
19146 	BW_40MHz = 1,
19147 	BW_80MHz = 2,
19148 	BW_160MHz = 3
19149 };
19150 
19151 /* Generic MCS */
19152 enum {
19153 	MCS_0 = 0,
19154 	MCS_1 = 1,
19155 	MCS_2 = 2,
19156 	MCS_3 = 3,
19157 	MCS_4 = 4,
19158 	MCS_5 = 5,
19159 	MCS_6 = 6,
19160 	MCS_7 = 7,
19161 	MCS_8 = 8,
19162 	MCS_9 = 9,
19163 	MCS_10 = 10,
19164 	MCS_11 = 11
19165 };
19166 
19167 /* Spatial streams */
19168 enum {
19169 	NSS1 = 1,
19170 	NSS2 = 2
19171 };
19172 
19173 /* HE-LTF Symbols index */
19174 enum {
19175 	NUM_HE_LTF_SYM0 = 0,
19176 	NUM_HE_LTF_SYM1 = 1,
19177 	NUM_HE_LTF_SYM2 = 2,
19178 	NUM_HE_LTF_SYM4 = 4,
19179 	NUM_HE_LTF_SYM5 = 5,
19180 	NUM_HE_LTF_SYM6 = 6
19181 };
19182 
19183 /* Status of STBC encoding in the solicited HE TBPPDUs */
19184 enum {
19185 	STBC_DIS = 0, /* Disabled */
19186 	STBC_EN = 1 /* Enabled */
19187 };
19188 
19189 /* pe_category, PE dur supported */
19190 enum {
19191 	PE0 = 0,
19192 	PE8 = 1,
19193 	PE16 = 2
19194 };
19195 
19196 /* Dual carrier modulation in solicited HE TBPPDU */
19197 enum {
19198 	DCM_DIS = 0, /* Disabled */
19199 	DCM_EN = 1, /* Enabled */
19200 };
19201 
19202 enum {
19203 	TRIG_TX_DIS = 0, /* Fake trigger frame TX */
19204 	TRIG_TX_EN = 1 /* Enable trigger frame transmission */
19205 };
19206 
19207 /* UL FEC Coding Type */
19208 enum {
19209 	CODING_BCC = 0, /* BCC Coding */
19210 	CODING_LDPC = 1 /* LDPC coding */
19211 };
19212 
19213 /* MU-MIMO LTF Mode subfield encoding */
19214 enum {
19215 	MUMIMO_LTF_0 = 0, /* HE single stream pilot HE-LTF mode */
19216 	MUMIMO_LTF_1 = 1 /* HE masked HE-LTF sequence mode */
19217 };
19218 #endif /* _wlioctl_h_ */
19219