1 // SPDX-License-Identifier: ISC
2 /*
3  * Copyright (c) 2012 Broadcom Corporation
4  */
5 
6 
7 #ifndef FWIL_TYPES_H_
8 #define FWIL_TYPES_H_
9 
10 #include <linux/if_ether.h>
11 
12 
13 #define BRCMF_FIL_ACTION_FRAME_SIZE	1800
14 
15 /* ARP Offload feature flags for arp_ol iovar */
16 #define BRCMF_ARP_OL_AGENT		0x00000001
17 #define BRCMF_ARP_OL_SNOOP		0x00000002
18 #define BRCMF_ARP_OL_HOST_AUTO_REPLY	0x00000004
19 #define BRCMF_ARP_OL_PEER_AUTO_REPLY	0x00000008
20 
21 #define	BRCMF_BSS_INFO_VERSION	109 /* curr ver of brcmf_bss_info_le struct */
22 #define BRCMF_BSS_RSSI_ON_CHANNEL	0x0004
23 
24 #define BRCMF_STA_BRCM			0x00000001	/* Running a Broadcom driver */
25 #define BRCMF_STA_WME			0x00000002	/* WMM association */
26 #define BRCMF_STA_NONERP		0x00000004	/* No ERP */
27 #define BRCMF_STA_AUTHE			0x00000008	/* Authenticated */
28 #define BRCMF_STA_ASSOC			0x00000010	/* Associated */
29 #define BRCMF_STA_AUTHO			0x00000020	/* Authorized */
30 #define BRCMF_STA_WDS			0x00000040	/* Wireless Distribution System */
31 #define BRCMF_STA_WDS_LINKUP		0x00000080	/* WDS traffic/probes flowing properly */
32 #define BRCMF_STA_PS			0x00000100	/* STA is in power save mode from AP's viewpoint */
33 #define BRCMF_STA_APSD_BE		0x00000200	/* APSD delv/trigger for AC_BE is default enabled */
34 #define BRCMF_STA_APSD_BK		0x00000400	/* APSD delv/trigger for AC_BK is default enabled */
35 #define BRCMF_STA_APSD_VI		0x00000800	/* APSD delv/trigger for AC_VI is default enabled */
36 #define BRCMF_STA_APSD_VO		0x00001000	/* APSD delv/trigger for AC_VO is default enabled */
37 #define BRCMF_STA_N_CAP			0x00002000	/* STA 802.11n capable */
38 #define BRCMF_STA_SCBSTATS		0x00004000	/* Per STA debug stats */
39 #define BRCMF_STA_AMPDU_CAP		0x00008000	/* STA AMPDU capable */
40 #define BRCMF_STA_AMSDU_CAP		0x00010000	/* STA AMSDU capable */
41 #define BRCMF_STA_MIMO_PS		0x00020000	/* mimo ps mode is enabled */
42 #define BRCMF_STA_MIMO_RTS		0x00040000	/* send rts in mimo ps mode */
43 #define BRCMF_STA_RIFS_CAP		0x00080000	/* rifs enabled */
44 #define BRCMF_STA_VHT_CAP		0x00100000	/* STA VHT(11ac) capable */
45 #define BRCMF_STA_WPS			0x00200000	/* WPS state */
46 #define BRCMF_STA_DWDS_CAP		0x01000000	/* DWDS CAP */
47 #define BRCMF_STA_DWDS			0x02000000	/* DWDS active */
48 
49 /* size of brcmf_scan_params not including variable length array */
50 #define BRCMF_SCAN_PARAMS_FIXED_SIZE	64
51 #define BRCMF_SCAN_PARAMS_V2_FIXED_SIZE	72
52 
53 /* version of brcmf_scan_params structure */
54 #define BRCMF_SCAN_PARAMS_VERSION_V2	2
55 
56 /* masks for channel and ssid count */
57 #define BRCMF_SCAN_PARAMS_COUNT_MASK	0x0000ffff
58 #define BRCMF_SCAN_PARAMS_NSSID_SHIFT	16
59 
60 /* scan type definitions */
61 #define BRCMF_SCANTYPE_DEFAULT		0xFF
62 #define BRCMF_SCANTYPE_ACTIVE		0
63 #define BRCMF_SCANTYPE_PASSIVE		1
64 
65 #define BRCMF_WSEC_MAX_PSK_LEN		32
66 #define	BRCMF_WSEC_PASSPHRASE		BIT(0)
67 
68 #define BRCMF_WSEC_MAX_SAE_PASSWORD_LEN 128
69 
70 /* primary (ie tx) key */
71 #define BRCMF_PRIMARY_KEY		(1 << 1)
72 #define DOT11_BSSTYPE_ANY		2
73 #define BRCMF_ESCAN_REQ_VERSION		1
74 #define BRCMF_ESCAN_REQ_VERSION_V2	2
75 
76 #define BRCMF_MAXRATES_IN_SET		16	/* max # of rates in rateset */
77 
78 /* OBSS Coex Auto/On/Off */
79 #define BRCMF_OBSS_COEX_AUTO		(-1)
80 #define BRCMF_OBSS_COEX_OFF		0
81 #define BRCMF_OBSS_COEX_ON		1
82 
83 /* WOWL bits */
84 /* Wakeup on Magic packet: */
85 #define BRCMF_WOWL_MAGIC		(1 << 0)
86 /* Wakeup on Netpattern */
87 #define BRCMF_WOWL_NET			(1 << 1)
88 /* Wakeup on loss-of-link due to Disassoc/Deauth: */
89 #define BRCMF_WOWL_DIS			(1 << 2)
90 /* Wakeup on retrograde TSF: */
91 #define BRCMF_WOWL_RETR			(1 << 3)
92 /* Wakeup on loss of beacon: */
93 #define BRCMF_WOWL_BCN			(1 << 4)
94 /* Wakeup after test: */
95 #define BRCMF_WOWL_TST			(1 << 5)
96 /* Wakeup after PTK refresh: */
97 #define BRCMF_WOWL_M1			(1 << 6)
98 /* Wakeup after receipt of EAP-Identity Req: */
99 #define BRCMF_WOWL_EAPID		(1 << 7)
100 /* Wakeind via PME(0) or GPIO(1): */
101 #define BRCMF_WOWL_PME_GPIO		(1 << 8)
102 /* need tkip phase 1 key to be updated by the driver: */
103 #define BRCMF_WOWL_NEEDTKIP1		(1 << 9)
104 /* enable wakeup if GTK fails: */
105 #define BRCMF_WOWL_GTK_FAILURE		(1 << 10)
106 /* support extended magic packets: */
107 #define BRCMF_WOWL_EXTMAGPAT		(1 << 11)
108 /* support ARP/NS/keepalive offloading: */
109 #define BRCMF_WOWL_ARPOFFLOAD		(1 << 12)
110 /* read protocol version for EAPOL frames: */
111 #define BRCMF_WOWL_WPA2			(1 << 13)
112 /* If the bit is set, use key rotaton: */
113 #define BRCMF_WOWL_KEYROT		(1 << 14)
114 /* If the bit is set, frm received was bcast frame: */
115 #define BRCMF_WOWL_BCAST		(1 << 15)
116 /* If the bit is set, scan offload is enabled: */
117 #define BRCMF_WOWL_SCANOL		(1 << 16)
118 /* Wakeup on tcpkeep alive timeout: */
119 #define BRCMF_WOWL_TCPKEEP_TIME		(1 << 17)
120 /* Wakeup on mDNS Conflict Resolution: */
121 #define BRCMF_WOWL_MDNS_CONFLICT	(1 << 18)
122 /* Wakeup on mDNS Service Connect: */
123 #define BRCMF_WOWL_MDNS_SERVICE		(1 << 19)
124 /* tcp keepalive got data: */
125 #define BRCMF_WOWL_TCPKEEP_DATA		(1 << 20)
126 /* Firmware died in wowl mode: */
127 #define BRCMF_WOWL_FW_HALT		(1 << 21)
128 /* Enable detection of radio button changes: */
129 #define BRCMF_WOWL_ENAB_HWRADIO		(1 << 22)
130 /* Offloads detected MIC failure(s): */
131 #define BRCMF_WOWL_MIC_FAIL		(1 << 23)
132 /* Wakeup in Unassociated state (Net/Magic Pattern): */
133 #define BRCMF_WOWL_UNASSOC		(1 << 24)
134 /* Wakeup if received matched secured pattern: */
135 #define BRCMF_WOWL_SECURE		(1 << 25)
136 /* Wakeup on finding preferred network */
137 #define BRCMF_WOWL_PFN_FOUND		(1 << 27)
138 /* Wakeup on receiving pairwise key EAP packets: */
139 #define WIPHY_WOWL_EAP_PK		(1 << 28)
140 /* Link Down indication in WoWL mode: */
141 #define BRCMF_WOWL_LINKDOWN		(1 << 31)
142 
143 #define BRCMF_WOWL_MAXPATTERNS		16
144 #define BRCMF_WOWL_MAXPATTERNSIZE	128
145 
146 #define BRCMF_COUNTRY_BUF_SZ		4
147 #define BRCMF_ANT_MAX			4
148 
149 #define BRCMF_MAX_ASSOCLIST		128
150 
151 #define BRCMF_TXBF_SU_BFE_CAP		BIT(0)
152 #define BRCMF_TXBF_MU_BFE_CAP		BIT(1)
153 #define BRCMF_TXBF_SU_BFR_CAP		BIT(0)
154 #define BRCMF_TXBF_MU_BFR_CAP		BIT(1)
155 
156 #define	BRCMF_MAXPMKID			16	/* max # PMKID cache entries */
157 #define BRCMF_NUMCHANNELS		64
158 
159 #define BRCMF_PFN_MACADDR_CFG_VER	1
160 #define BRCMF_PFN_MAC_OUI_ONLY		BIT(0)
161 #define BRCMF_PFN_SET_MAC_UNASSOC	BIT(1)
162 
163 #define BRCMF_MCSSET_LEN		16
164 
165 #define BRCMF_RSN_KCK_LENGTH		16
166 #define BRCMF_RSN_KEK_LENGTH		16
167 #define BRCMF_RSN_REPLAY_LEN		8
168 
169 #define BRCMF_MFP_NONE			0
170 #define BRCMF_MFP_CAPABLE		1
171 #define BRCMF_MFP_REQUIRED		2
172 
173 #define BRCMF_VHT_CAP_MCS_MAP_NSS_MAX	8
174 
175 #define BRCMF_HE_CAP_MCS_MAP_NSS_MAX	8
176 
177 #define BRCMF_PMKSA_VER_2		2
178 #define BRCMF_PMKSA_VER_3		3
179 #define BRCMF_PMKSA_NO_EXPIRY		0xffffffff
180 
181 /* MAX_CHUNK_LEN is the maximum length for data passing to firmware in each
182  * ioctl. It is relatively small because firmware has small maximum size input
183  * playload restriction for ioctls.
184  */
185 #define MAX_CHUNK_LEN			1400
186 
187 #define DLOAD_HANDLER_VER		1	/* Downloader version */
188 #define DLOAD_FLAG_VER_MASK		0xf000	/* Downloader version mask */
189 #define DLOAD_FLAG_VER_SHIFT		12	/* Downloader version shift */
190 
191 #define DL_BEGIN			0x0002
192 #define DL_END				0x0004
193 
194 #define DL_TYPE_CLM			2
195 
196 /* join preference types for join_pref iovar */
197 enum brcmf_join_pref_types {
198 	BRCMF_JOIN_PREF_RSSI = 1,
199 	BRCMF_JOIN_PREF_WPA,
200 	BRCMF_JOIN_PREF_BAND,
201 	BRCMF_JOIN_PREF_RSSI_DELTA,
202 };
203 
204 enum brcmf_fil_p2p_if_types {
205 	BRCMF_FIL_P2P_IF_CLIENT,
206 	BRCMF_FIL_P2P_IF_GO,
207 	BRCMF_FIL_P2P_IF_DYNBCN_GO,
208 	BRCMF_FIL_P2P_IF_DEV,
209 };
210 
211 enum brcmf_wowl_pattern_type {
212 	BRCMF_WOWL_PATTERN_TYPE_BITMAP = 0,
213 	BRCMF_WOWL_PATTERN_TYPE_ARP,
214 	BRCMF_WOWL_PATTERN_TYPE_NA
215 };
216 
217 struct brcmf_fil_p2p_if_le {
218 	u8 addr[ETH_ALEN];
219 	__le16 type;
220 	__le16 chspec;
221 };
222 
223 struct brcmf_fil_chan_info_le {
224 	__le32 hw_channel;
225 	__le32 target_channel;
226 	__le32 scan_channel;
227 };
228 
229 struct brcmf_fil_action_frame_le {
230 	u8	da[ETH_ALEN];
231 	__le16	len;
232 	__le32	packet_id;
233 	u8	data[BRCMF_FIL_ACTION_FRAME_SIZE];
234 };
235 
236 struct brcmf_fil_af_params_le {
237 	__le32					channel;
238 	__le32					dwell_time;
239 	u8					bssid[ETH_ALEN];
240 	u8					pad[2];
241 	struct brcmf_fil_action_frame_le	action_frame;
242 };
243 
244 struct brcmf_fil_bss_enable_le {
245 	__le32 bsscfgidx;
246 	__le32 enable;
247 };
248 
249 struct brcmf_fil_bwcap_le {
250 	__le32 band;
251 	__le32 bw_cap;
252 };
253 
254 /**
255  * struct tdls_iovar - common structure for tdls iovars.
256  *
257  * @ea: ether address of peer station.
258  * @mode: mode value depending on specific tdls iovar.
259  * @chanspec: channel specification.
260  * @pad: unused (for future use).
261  */
262 struct brcmf_tdls_iovar_le {
263 	u8 ea[ETH_ALEN];		/* Station address */
264 	u8 mode;			/* mode: depends on iovar */
265 	__le16 chanspec;
266 	__le32 pad;			/* future */
267 };
268 
269 enum brcmf_tdls_manual_ep_ops {
270 	BRCMF_TDLS_MANUAL_EP_CREATE = 1,
271 	BRCMF_TDLS_MANUAL_EP_DELETE = 3,
272 	BRCMF_TDLS_MANUAL_EP_DISCOVERY = 6
273 };
274 
275 /* Pattern matching filter. Specifies an offset within received packets to
276  * start matching, the pattern to match, the size of the pattern, and a bitmask
277  * that indicates which bits within the pattern should be matched.
278  */
279 struct brcmf_pkt_filter_pattern_le {
280 	/*
281 	 * Offset within received packet to start pattern matching.
282 	 * Offset '0' is the first byte of the ethernet header.
283 	 */
284 	__le32 offset;
285 	/* Size of the pattern.  Bitmask must be the same size.*/
286 	__le32 size_bytes;
287 	/*
288 	 * Variable length mask and pattern data. mask starts at offset 0.
289 	 * Pattern immediately follows mask.
290 	 */
291 	u8 mask_and_pattern[1];
292 };
293 
294 /* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */
295 struct brcmf_pkt_filter_le {
296 	__le32 id;		/* Unique filter id, specified by app. */
297 	__le32 type;		/* Filter type (WL_PKT_FILTER_TYPE_xxx). */
298 	__le32 negate_match;	/* Negate the result of filter matches */
299 	union {			/* Filter definitions */
300 		struct brcmf_pkt_filter_pattern_le pattern; /* Filter pattern */
301 	} u;
302 };
303 
304 /* IOVAR "pkt_filter_enable" parameter. */
305 struct brcmf_pkt_filter_enable_le {
306 	__le32 id;		/* Unique filter id */
307 	__le32 enable;		/* Enable/disable bool */
308 };
309 
310 /* BSS info structure
311  * Applications MUST CHECK ie_offset field and length field to access IEs and
312  * next bss_info structure in a vector (in struct brcmf_scan_results)
313  */
314 struct brcmf_bss_info_le {
315 	__le32 version;		/* version field */
316 	__le32 length;		/* byte length of data in this record,
317 				 * starting at version and including IEs
318 				 */
319 	u8 BSSID[ETH_ALEN];
320 	__le16 beacon_period;	/* units are Kusec */
321 	__le16 capability;	/* Capability information */
322 	u8 SSID_len;
323 	u8 SSID[32];
324 	struct {
325 		__le32 count;   /* # rates in this set */
326 		u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */
327 	} rateset;		/* supported rates */
328 	__le16 chanspec;	/* chanspec for bss */
329 	__le16 atim_window;	/* units are Kusec */
330 	u8 dtim_period;	/* DTIM period */
331 	__le16 RSSI;		/* receive signal strength (in dBm) */
332 	s8 phy_noise;		/* noise (in dBm) */
333 
334 	u8 n_cap;		/* BSS is 802.11N Capable */
335 	/* 802.11N BSS Capabilities (based on HT_CAP_*): */
336 	__le32 nbss_cap;
337 	u8 ctl_ch;		/* 802.11N BSS control channel number */
338 	__le32 reserved32[1];	/* Reserved for expansion of BSS properties */
339 	u8 flags;		/* flags */
340 	u8 reserved[3];	/* Reserved for expansion of BSS properties */
341 	u8 basic_mcs[BRCMF_MCSSET_LEN];	/* 802.11N BSS required MCS set */
342 
343 	__le16 ie_offset;	/* offset at which IEs start, from beginning */
344 	__le32 ie_length;	/* byte length of Information Elements */
345 	__le16 SNR;		/* average SNR of during frame reception */
346 	/* Add new fields here */
347 	/* variable length Information Elements */
348 };
349 
350 struct brcm_rateset_le {
351 	/* # rates in this set */
352 	__le32 count;
353 	/* rates in 500kbps units w/hi bit set if basic */
354 	u8 rates[BRCMF_MAXRATES_IN_SET];
355 };
356 
357 struct brcmf_ssid_le {
358 	__le32 SSID_len;
359 	unsigned char SSID[IEEE80211_MAX_SSID_LEN];
360 };
361 
362 /* Alternate SSID structure used in some places... */
363 struct brcmf_ssid8_le {
364 	u8 SSID_len;
365 	unsigned char SSID[IEEE80211_MAX_SSID_LEN];
366 };
367 
368 struct brcmf_scan_params_le {
369 	struct brcmf_ssid_le ssid_le;	/* default: {0, ""} */
370 	u8 bssid[ETH_ALEN];	/* default: bcast */
371 	s8 bss_type;		/* default: any,
372 				 * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
373 				 */
374 	u8 scan_type;	/* flags, 0 use default */
375 	__le32 nprobes;	  /* -1 use default, number of probes per channel */
376 	__le32 active_time;	/* -1 use default, dwell time per channel for
377 				 * active scanning
378 				 */
379 	__le32 passive_time;	/* -1 use default, dwell time per channel
380 				 * for passive scanning
381 				 */
382 	__le32 home_time;	/* -1 use default, dwell time for the
383 				 * home channel between channel scans
384 				 */
385 	__le32 channel_num;	/* count of channels and ssids that follow
386 				 *
387 				 * low half is count of channels in
388 				 * channel_list, 0 means default (use all
389 				 * available channels)
390 				 *
391 				 * high half is entries in struct brcmf_ssid
392 				 * array that follows channel_list, aligned for
393 				 * s32 (4 bytes) meaning an odd channel count
394 				 * implies a 2-byte pad between end of
395 				 * channel_list and first ssid
396 				 *
397 				 * if ssid count is zero, single ssid in the
398 				 * fixed parameter portion is assumed, otherwise
399 				 * ssid in the fixed portion is ignored
400 				 */
401 	union {
402 		__le16 padding;	/* Reserve space for at least 1 entry for abort
403 				 * which uses an on stack brcmf_scan_params_le
404 				 */
405 		DECLARE_FLEX_ARRAY(__le16, channel_list);	/* chanspecs */
406 	};
407 };
408 
409 struct brcmf_scan_params_v2_le {
410 	__le16 version;		/* structure version */
411 	__le16 length;		/* structure length */
412 	struct brcmf_ssid_le ssid_le;	/* default: {0, ""} */
413 	u8 bssid[ETH_ALEN];	/* default: bcast */
414 	s8 bss_type;		/* default: any,
415 				 * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT
416 				 */
417 	u8 pad;
418 	__le32 scan_type;	/* flags, 0 use default */
419 	__le32 nprobes;		/* -1 use default, number of probes per channel */
420 	__le32 active_time;	/* -1 use default, dwell time per channel for
421 				 * active scanning
422 				 */
423 	__le32 passive_time;	/* -1 use default, dwell time per channel
424 				 * for passive scanning
425 				 */
426 	__le32 home_time;	/* -1 use default, dwell time for the
427 				 * home channel between channel scans
428 				 */
429 	__le32 channel_num;	/* count of channels and ssids that follow
430 				 *
431 				 * low half is count of channels in
432 				 * channel_list, 0 means default (use all
433 				 * available channels)
434 				 *
435 				 * high half is entries in struct brcmf_ssid
436 				 * array that follows channel_list, aligned for
437 				 * s32 (4 bytes) meaning an odd channel count
438 				 * implies a 2-byte pad between end of
439 				 * channel_list and first ssid
440 				 *
441 				 * if ssid count is zero, single ssid in the
442 				 * fixed parameter portion is assumed, otherwise
443 				 * ssid in the fixed portion is ignored
444 				 */
445 	union {
446 		__le16 padding;	/* Reserve space for at least 1 entry for abort
447 				 * which uses an on stack brcmf_scan_params_v2_le
448 				 */
449 		DECLARE_FLEX_ARRAY(__le16, channel_list);	/* chanspecs */
450 	};
451 };
452 
453 struct brcmf_scan_results {
454 	u32 buflen;
455 	u32 version;
456 	u32 count;
457 	struct brcmf_bss_info_le bss_info_le[];
458 };
459 
460 struct brcmf_escan_params_le {
461 	__le32 version;
462 	__le16 action;
463 	__le16 sync_id;
464 	union {
465 		struct brcmf_scan_params_le params_le;
466 		struct brcmf_scan_params_v2_le params_v2_le;
467 	};
468 };
469 
470 struct brcmf_escan_result_le {
471 	__le32 buflen;
472 	__le32 version;
473 	__le16 sync_id;
474 	__le16 bss_count;
475 	struct brcmf_bss_info_le bss_info_le;
476 };
477 
478 #define WL_ESCAN_RESULTS_FIXED_SIZE (sizeof(struct brcmf_escan_result_le) - \
479 	sizeof(struct brcmf_bss_info_le))
480 
481 /* used for association with a specific BSSID and chanspec list */
482 struct brcmf_assoc_params_le {
483 	/* 00:00:00:00:00:00: broadcast scan */
484 	u8 bssid[ETH_ALEN];
485 	/* 0: all available channels, otherwise count of chanspecs in
486 	 * chanspec_list */
487 	__le32 chanspec_num;
488 	/* list of chanspecs */
489 	__le16 chanspec_list[1];
490 };
491 
492 /**
493  * struct join_pref params - parameters for preferred join selection.
494  *
495  * @type: preference type (see enum brcmf_join_pref_types).
496  * @len: length of bytes following (currently always 2).
497  * @rssi_gain: signal gain for selection (only when @type is RSSI_DELTA).
498  * @band: band to which selection preference applies.
499  *	This is used if @type is BAND or RSSI_DELTA.
500  */
501 struct brcmf_join_pref_params {
502 	u8 type;
503 	u8 len;
504 	u8 rssi_gain;
505 	u8 band;
506 };
507 
508 /* used for join with or without a specific bssid and channel list */
509 struct brcmf_join_params {
510 	struct brcmf_ssid_le ssid_le;
511 	struct brcmf_assoc_params_le params_le;
512 };
513 
514 /* scan params for extended join */
515 struct brcmf_join_scan_params_le {
516 	u8 scan_type;		/* 0 use default, active or passive scan */
517 	__le32 nprobes;		/* -1 use default, nr of probes per channel */
518 	__le32 active_time;	/* -1 use default, dwell time per channel for
519 				 * active scanning
520 				 */
521 	__le32 passive_time;	/* -1 use default, dwell time per channel
522 				 * for passive scanning
523 				 */
524 	__le32 home_time;	/* -1 use default, dwell time for the home
525 				 * channel between channel scans
526 				 */
527 };
528 
529 /* extended join params */
530 struct brcmf_ext_join_params_le {
531 	struct brcmf_ssid_le ssid_le;	/* {0, ""}: wildcard scan */
532 	struct brcmf_join_scan_params_le scan_le;
533 	struct brcmf_assoc_params_le assoc_le;
534 };
535 
536 struct brcmf_wsec_key {
537 	u32 index;		/* key index */
538 	u32 len;		/* key length */
539 	u8 data[WLAN_MAX_KEY_LEN];	/* key data */
540 	u32 pad_1[18];
541 	u32 algo;	/* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
542 	u32 flags;	/* misc flags */
543 	u32 pad_2[3];
544 	u32 iv_initialized;	/* has IV been initialized already? */
545 	u32 pad_3;
546 	/* Rx IV */
547 	struct {
548 		u32 hi;	/* upper 32 bits of IV */
549 		u16 lo;	/* lower 16 bits of IV */
550 	} rxiv;
551 	u32 pad_4[2];
552 	u8 ea[ETH_ALEN];	/* per station */
553 };
554 
555 /*
556  * dongle requires same struct as above but with fields in little endian order
557  */
558 struct brcmf_wsec_key_le {
559 	__le32 index;		/* key index */
560 	__le32 len;		/* key length */
561 	u8 data[WLAN_MAX_KEY_LEN];	/* key data */
562 	__le32 pad_1[18];
563 	__le32 algo;	/* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
564 	__le32 flags;	/* misc flags */
565 	__le32 pad_2[3];
566 	__le32 iv_initialized;	/* has IV been initialized already? */
567 	__le32 pad_3;
568 	/* Rx IV */
569 	struct {
570 		__le32 hi;	/* upper 32 bits of IV */
571 		__le16 lo;	/* lower 16 bits of IV */
572 	} rxiv;
573 	__le32 pad_4[2];
574 	u8 ea[ETH_ALEN];	/* per station */
575 };
576 
577 /**
578  * struct brcmf_wsec_pmk_le - firmware pmk material.
579  *
580  * @key_len: number of octets in key material.
581  * @flags: key handling qualifiers.
582  * @key: PMK key material.
583  */
584 struct brcmf_wsec_pmk_le {
585 	__le16  key_len;
586 	__le16  flags;
587 	u8 key[2 * BRCMF_WSEC_MAX_PSK_LEN + 1];
588 };
589 
590 /**
591  * struct brcmf_wsec_sae_pwd_le - firmware SAE password material.
592  *
593  * @key_len: number of octets in key materials.
594  * @key: SAE password material.
595  */
596 struct brcmf_wsec_sae_pwd_le {
597 	__le16 key_len;
598 	u8 key[BRCMF_WSEC_MAX_SAE_PASSWORD_LEN];
599 };
600 
601 /* Used to get specific STA parameters */
602 struct brcmf_scb_val_le {
603 	__le32 val;
604 	u8 ea[ETH_ALEN];
605 };
606 
607 /* channel encoding */
608 struct brcmf_channel_info_le {
609 	__le32 hw_channel;
610 	__le32 target_channel;
611 	__le32 scan_channel;
612 };
613 
614 struct brcmf_sta_info_le {
615 	__le16 ver;		/* version of this struct */
616 	__le16 len;		/* length in bytes of this structure */
617 	__le16 cap;		/* sta's advertised capabilities */
618 	__le32 flags;		/* flags defined below */
619 	__le32 idle;		/* time since data pkt rx'd from sta */
620 	u8 ea[ETH_ALEN];		/* Station address */
621 	__le32 count;			/* # rates in this set */
622 	u8 rates[BRCMF_MAXRATES_IN_SET];	/* rates in 500kbps units */
623 						/* w/hi bit set if basic */
624 	__le32 in;		/* seconds elapsed since associated */
625 	__le32 listen_interval_inms; /* Min Listen interval in ms for STA */
626 
627 	/* Fields valid for ver >= 3 */
628 	__le32 tx_pkts;	/* # of packets transmitted */
629 	__le32 tx_failures;	/* # of packets failed */
630 	__le32 rx_ucast_pkts;	/* # of unicast packets received */
631 	__le32 rx_mcast_pkts;	/* # of multicast packets received */
632 	__le32 tx_rate;	/* Rate of last successful tx frame */
633 	__le32 rx_rate;	/* Rate of last successful rx frame */
634 	__le32 rx_decrypt_succeeds;	/* # of packet decrypted successfully */
635 	__le32 rx_decrypt_failures;	/* # of packet decrypted failed */
636 
637 	/* Fields valid for ver >= 4 */
638 	__le32 tx_tot_pkts;    /* # of tx pkts (ucast + mcast) */
639 	__le32 rx_tot_pkts;    /* # of data packets recvd (uni + mcast) */
640 	__le32 tx_mcast_pkts;  /* # of mcast pkts txed */
641 	__le64 tx_tot_bytes;   /* data bytes txed (ucast + mcast) */
642 	__le64 rx_tot_bytes;   /* data bytes recvd (ucast + mcast) */
643 	__le64 tx_ucast_bytes; /* data bytes txed (ucast) */
644 	__le64 tx_mcast_bytes; /* # data bytes txed (mcast) */
645 	__le64 rx_ucast_bytes; /* data bytes recvd (ucast) */
646 	__le64 rx_mcast_bytes; /* data bytes recvd (mcast) */
647 	s8 rssi[BRCMF_ANT_MAX];   /* per antenna rssi */
648 	s8 nf[BRCMF_ANT_MAX];     /* per antenna noise floor */
649 	__le16 aid;                    /* association ID */
650 	__le16 ht_capabilities;        /* advertised ht caps */
651 	__le16 vht_flags;              /* converted vht flags */
652 	__le32 tx_pkts_retry_cnt;      /* # of frames where a retry was
653 					 * exhausted.
654 					 */
655 	__le32 tx_pkts_retry_exhausted; /* # of user frames where a retry
656 					 * was exhausted
657 					 */
658 	s8 rx_lastpkt_rssi[BRCMF_ANT_MAX]; /* Per antenna RSSI of last
659 					    * received data frame.
660 					    */
661 	/* TX WLAN retry/failure statistics:
662 	 * Separated for host requested frames and locally generated frames.
663 	 * Include unicast frame only where the retries/failures can be counted.
664 	 */
665 	__le32 tx_pkts_total;          /* # user frames sent successfully */
666 	__le32 tx_pkts_retries;        /* # user frames retries */
667 	__le32 tx_pkts_fw_total;       /* # FW generated sent successfully */
668 	__le32 tx_pkts_fw_retries;     /* # retries for FW generated frames */
669 	__le32 tx_pkts_fw_retry_exhausted;     /* # FW generated where a retry
670 						* was exhausted
671 						*/
672 	__le32 rx_pkts_retried;        /* # rx with retry bit set */
673 	__le32 tx_rate_fallback;       /* lowest fallback TX rate */
674 
675 	union {
676 		struct {
677 			struct {
678 				__le32 count;					/* # rates in this set */
679 				u8 rates[BRCMF_MAXRATES_IN_SET];		/* rates in 500kbps units w/hi bit set if basic */
680 				u8 mcs[BRCMF_MCSSET_LEN];			/* supported mcs index bit map */
681 				__le16 vht_mcs[BRCMF_VHT_CAP_MCS_MAP_NSS_MAX];	/* supported mcs index bit map per nss */
682 			} rateset_adv;
683 		} v5;
684 
685 		struct {
686 			__le32 rx_dur_total;	/* total user RX duration (estimated) */
687 			__le16 chanspec;	/** chanspec this sta is on */
688 			__le16 pad_1;
689 			struct {
690 				__le16 version;					/* version */
691 				__le16 len;					/* length */
692 				__le32 count;					/* # rates in this set */
693 				u8 rates[BRCMF_MAXRATES_IN_SET];		/* rates in 500kbps units w/hi bit set if basic */
694 				u8 mcs[BRCMF_MCSSET_LEN];			/* supported mcs index bit map */
695 				__le16 vht_mcs[BRCMF_VHT_CAP_MCS_MAP_NSS_MAX];	/* supported mcs index bit map per nss */
696 				__le16 he_mcs[BRCMF_HE_CAP_MCS_MAP_NSS_MAX];	/* supported he mcs index bit map per nss */
697 			} rateset_adv;		/* rateset along with mcs index bitmap */
698 			__le16 wpauth;		/* authentication type */
699 			u8 algo;		/* crypto algorithm */
700 			u8 pad_2;
701 			__le32 tx_rspec;	/* Rate of last successful tx frame */
702 			__le32 rx_rspec;	/* Rate of last successful rx frame */
703 			__le32 wnm_cap;		/* wnm capabilities */
704 		} v7;
705 	};
706 };
707 
708 struct brcmf_chanspec_list {
709 	__le32	count;		/* # of entries */
710 	__le32  element[];	/* variable length uint32 list */
711 };
712 
713 /*
714  * WLC_E_PROBRESP_MSG
715  * WLC_E_P2P_PROBREQ_MSG
716  * WLC_E_ACTION_FRAME_RX
717  */
718 struct brcmf_rx_mgmt_data {
719 	__be16	version;
720 	__be16	chanspec;
721 	__be32	rssi;
722 	__be32	mactime;
723 	__be32	rate;
724 };
725 
726 /**
727  * struct brcmf_fil_wowl_pattern_le - wowl pattern configuration struct.
728  *
729  * @cmd: "add", "del" or "clr".
730  * @masksize: Size of the mask in #of bytes
731  * @offset: Pattern byte offset in packet
732  * @patternoffset: Offset of start of pattern. Starting from field masksize.
733  * @patternsize: Size of the pattern itself in #of bytes
734  * @id: id
735  * @reasonsize: Size of the wakeup reason code
736  * @type: Type of pattern (enum brcmf_wowl_pattern_type)
737  */
738 struct brcmf_fil_wowl_pattern_le {
739 	u8	cmd[4];
740 	__le32	masksize;
741 	__le32	offset;
742 	__le32	patternoffset;
743 	__le32	patternsize;
744 	__le32	id;
745 	__le32	reasonsize;
746 	__le32	type;
747 	/* u8 mask[] - Mask follows the structure above */
748 	/* u8 pattern[] - Pattern follows the mask is at 'patternoffset' */
749 };
750 
751 struct brcmf_mbss_ssid_le {
752 	__le32	bsscfgidx;
753 	__le32	SSID_len;
754 	unsigned char SSID[32];
755 };
756 
757 /**
758  * struct brcmf_fil_country_le - country configuration structure.
759  *
760  * @country_abbrev: null-terminated country code used in the country IE.
761  * @rev: revision specifier for ccode. on set, -1 indicates unspecified.
762  * @ccode: null-terminated built-in country code.
763  */
764 struct brcmf_fil_country_le {
765 	char country_abbrev[BRCMF_COUNTRY_BUF_SZ];
766 	__le32 rev;
767 	char ccode[BRCMF_COUNTRY_BUF_SZ];
768 };
769 
770 /**
771  * struct brcmf_rev_info_le - device revision info.
772  *
773  * @vendorid: PCI vendor id.
774  * @deviceid: device id of chip.
775  * @radiorev: radio revision.
776  * @chiprev: chip revision.
777  * @corerev: core revision.
778  * @boardid: board identifier (usu. PCI sub-device id).
779  * @boardvendor: board vendor (usu. PCI sub-vendor id).
780  * @boardrev: board revision.
781  * @driverrev: driver version.
782  * @ucoderev: microcode version.
783  * @bus: bus type.
784  * @chipnum: chip number.
785  * @phytype: phy type.
786  * @phyrev: phy revision.
787  * @anarev: anacore rev.
788  * @chippkg: chip package info.
789  * @nvramrev: nvram revision number.
790  */
791 struct brcmf_rev_info_le {
792 	__le32 vendorid;
793 	__le32 deviceid;
794 	__le32 radiorev;
795 	__le32 chiprev;
796 	__le32 corerev;
797 	__le32 boardid;
798 	__le32 boardvendor;
799 	__le32 boardrev;
800 	__le32 driverrev;
801 	__le32 ucoderev;
802 	__le32 bus;
803 	__le32 chipnum;
804 	__le32 phytype;
805 	__le32 phyrev;
806 	__le32 anarev;
807 	__le32 chippkg;
808 	__le32 nvramrev;
809 };
810 
811 /**
812  * struct brcmf_wlc_version_le - firmware revision info.
813  *
814  * @version: structure version.
815  * @length: structure length.
816  * @epi_ver_major: EPI major version
817  * @epi_ver_minor: EPI minor version
818  * @epi_ver_rc: EPI rc version
819  * @epi_ver_incr: EPI increment version
820  * @wlc_ver_major: WLC major version
821  * @wlc_ver_minor: WLC minor version
822  */
823 struct brcmf_wlc_version_le {
824 	__le16 version;
825 	__le16 length;
826 
827 	__le16 epi_ver_major;
828 	__le16 epi_ver_minor;
829 	__le16 epi_ver_rc;
830 	__le16 epi_ver_incr;
831 
832 	__le16 wlc_ver_major;
833 	__le16 wlc_ver_minor;
834 };
835 
836 /**
837  * struct brcmf_assoclist_le - request assoc list.
838  *
839  * @count: indicates number of stations.
840  * @mac: MAC addresses of stations.
841  */
842 struct brcmf_assoclist_le {
843 	__le32 count;
844 	u8 mac[BRCMF_MAX_ASSOCLIST][ETH_ALEN];
845 };
846 
847 /**
848  * struct brcmf_rssi_be - RSSI threshold event format
849  *
850  * @rssi: receive signal strength (in dBm)
851  * @snr: signal-noise ratio
852  * @noise: noise (in dBm)
853  */
854 struct brcmf_rssi_be {
855 	__be32 rssi;
856 	__be32 snr;
857 	__be32 noise;
858 };
859 
860 #define BRCMF_MAX_RSSI_LEVELS 8
861 
862 /**
863  * struct brcm_rssi_event_le - rssi_event IOVAR format
864  *
865  * @rate_limit_msec: RSSI event rate limit
866  * @rssi_level_num: number of supplied RSSI levels
867  * @rssi_levels: RSSI levels in ascending order
868  */
869 struct brcmf_rssi_event_le {
870 	__le32 rate_limit_msec;
871 	s8 rssi_level_num;
872 	s8 rssi_levels[BRCMF_MAX_RSSI_LEVELS];
873 };
874 
875 /**
876  * struct brcmf_wowl_wakeind_le - Wakeup indicators
877  *	Note: note both fields contain same information.
878  *
879  * @pci_wakeind: Whether PCI PMECSR PMEStatus bit was set.
880  * @ucode_wakeind: What wakeup-event indication was set by ucode
881  */
882 struct brcmf_wowl_wakeind_le {
883 	__le32 pci_wakeind;
884 	__le32 ucode_wakeind;
885 };
886 
887 /**
888  * struct brcmf_pmksa - PMK Security Association
889  *
890  * @bssid: The AP's BSSID.
891  * @pmkid: he PMK material itself.
892  */
893 struct brcmf_pmksa {
894 	u8 bssid[ETH_ALEN];
895 	u8 pmkid[WLAN_PMKID_LEN];
896 };
897 
898 /**
899  * struct brcmf_pmksa_v2 - PMK Security Association
900  *
901  * @length: Length of the structure.
902  * @bssid: The AP's BSSID.
903  * @pmkid: The PMK ID.
904  * @pmk: PMK material for FILS key derivation.
905  * @pmk_len: Length of PMK data.
906  * @ssid: The AP's SSID.
907  * @fils_cache_id: FILS cache identifier
908  */
909 struct brcmf_pmksa_v2 {
910 	__le16 length;
911 	u8 bssid[ETH_ALEN];
912 	u8 pmkid[WLAN_PMKID_LEN];
913 	u8 pmk[WLAN_PMK_LEN_SUITE_B_192];
914 	__le16 pmk_len;
915 	struct brcmf_ssid8_le ssid;
916 	u16 fils_cache_id;
917 };
918 
919 /**
920  * struct brcmf_pmksa_v3 - PMK Security Association
921  *
922  * @bssid: The AP's BSSID.
923  * @pmkid: The PMK ID.
924  * @pmkid_len: The length of the PMK ID.
925  * @pmk: PMK material for FILS key derivation.
926  * @pmk_len: Length of PMK data.
927  * @fils_cache_id: FILS cache identifier
928  * @ssid: The AP's SSID.
929  * @time_left: Remaining time until expiry. 0 = expired, ~0 = no expiry.
930  */
931 struct brcmf_pmksa_v3 {
932 	u8 bssid[ETH_ALEN];
933 	u8 pmkid[WLAN_PMKID_LEN];
934 	u8 pmkid_len;
935 	u8 pmk[WLAN_PMK_LEN_SUITE_B_192];
936 	u8 pmk_len;
937 	__le16 fils_cache_id;
938 	u8 pad;
939 	struct brcmf_ssid8_le ssid;
940 	__le32 time_left;
941 };
942 
943 /**
944  * struct brcmf_pmk_list_le - List of pmksa's.
945  *
946  * @npmk: Number of pmksa's.
947  * @pmk: PMK SA information.
948  */
949 struct brcmf_pmk_list_le {
950 	__le32 npmk;
951 	struct brcmf_pmksa pmk[BRCMF_MAXPMKID];
952 };
953 
954 /**
955  * struct brcmf_pmk_list_v2_le - List of pmksa's.
956  *
957  * @version: Request version.
958  * @length: Length of this structure.
959  * @pmk: PMK SA information.
960  */
961 struct brcmf_pmk_list_v2_le {
962 	__le16 version;
963 	__le16 length;
964 	struct brcmf_pmksa_v2 pmk[BRCMF_MAXPMKID];
965 };
966 
967 /**
968  * struct brcmf_pmk_op_v3_le - Operation on PMKSA list.
969  *
970  * @version: Request version.
971  * @length: Length of this structure.
972  * @pmk: PMK SA information.
973  */
974 struct brcmf_pmk_op_v3_le {
975 	__le16 version;
976 	__le16 length;
977 	__le16 count;
978 	__le16 pad;
979 	struct brcmf_pmksa_v3 pmk[BRCMF_MAXPMKID];
980 };
981 
982 /**
983  * struct brcmf_pno_param_le - PNO scan configuration parameters
984  *
985  * @version: PNO parameters version.
986  * @scan_freq: scan frequency.
987  * @lost_network_timeout: #sec. to declare discovered network as lost.
988  * @flags: Bit field to control features of PFN such as sort criteria auto
989  *	enable switch and background scan.
990  * @rssi_margin: Margin to avoid jitter for choosing a PFN based on RSSI sort
991  *	criteria.
992  * @bestn: number of best networks in each scan.
993  * @mscan: number of scans recorded.
994  * @repeat: minimum number of scan intervals before scan frequency changes
995  *	in adaptive scan.
996  * @exp: exponent of 2 for maximum scan interval.
997  * @slow_freq: slow scan period.
998  */
999 struct brcmf_pno_param_le {
1000 	__le32 version;
1001 	__le32 scan_freq;
1002 	__le32 lost_network_timeout;
1003 	__le16 flags;
1004 	__le16 rssi_margin;
1005 	u8 bestn;
1006 	u8 mscan;
1007 	u8 repeat;
1008 	u8 exp;
1009 	__le32 slow_freq;
1010 };
1011 
1012 /**
1013  * struct brcmf_pno_config_le - PNO channel configuration.
1014  *
1015  * @reporttype: determines what is reported.
1016  * @channel_num: number of channels specified in @channel_list.
1017  * @channel_list: channels to use in PNO scan.
1018  * @flags: reserved.
1019  */
1020 struct brcmf_pno_config_le {
1021 	__le32  reporttype;
1022 	__le32  channel_num;
1023 	__le16  channel_list[BRCMF_NUMCHANNELS];
1024 	__le32  flags;
1025 };
1026 
1027 /**
1028  * struct brcmf_pno_net_param_le - scan parameters per preferred network.
1029  *
1030  * @ssid: ssid name and its length.
1031  * @flags: bit2: hidden.
1032  * @infra: BSS vs IBSS.
1033  * @auth: Open vs Closed.
1034  * @wpa_auth: WPA type.
1035  * @wsec: wsec value.
1036  */
1037 struct brcmf_pno_net_param_le {
1038 	struct brcmf_ssid_le ssid;
1039 	__le32 flags;
1040 	__le32 infra;
1041 	__le32 auth;
1042 	__le32 wpa_auth;
1043 	__le32 wsec;
1044 };
1045 
1046 /**
1047  * struct brcmf_pno_net_info_le - information per found network.
1048  *
1049  * @bssid: BSS network identifier.
1050  * @channel: channel number only.
1051  * @SSID_len: length of ssid.
1052  * @SSID: ssid characters.
1053  * @RSSI: receive signal strength (in dBm).
1054  * @timestamp: age in seconds.
1055  */
1056 struct brcmf_pno_net_info_le {
1057 	u8 bssid[ETH_ALEN];
1058 	u8 channel;
1059 	u8 SSID_len;
1060 	u8 SSID[32];
1061 	__le16	RSSI;
1062 	__le16	timestamp;
1063 };
1064 
1065 /**
1066  * struct brcmf_pno_scanresults_le - result returned in PNO NET FOUND event.
1067  *
1068  * @version: PNO version identifier.
1069  * @status: indicates completion status of PNO scan.
1070  * @count: amount of brcmf_pno_net_info_le entries appended.
1071  */
1072 struct brcmf_pno_scanresults_le {
1073 	__le32 version;
1074 	__le32 status;
1075 	__le32 count;
1076 };
1077 
1078 struct brcmf_pno_scanresults_v2_le {
1079 	__le32 version;
1080 	__le32 status;
1081 	__le32 count;
1082 	__le32 scan_ch_bucket;
1083 };
1084 
1085 /**
1086  * struct brcmf_pno_macaddr_le - to configure PNO macaddr randomization.
1087  *
1088  * @version: PNO version identifier.
1089  * @flags: Flags defining how mac addrss should be used.
1090  * @mac: MAC address.
1091  */
1092 struct brcmf_pno_macaddr_le {
1093 	u8 version;
1094 	u8 flags;
1095 	u8 mac[ETH_ALEN];
1096 };
1097 
1098 /**
1099  * struct brcmf_dload_data_le - data passing to firmware for downloading
1100  * @flag: flags related to download data.
1101  * @dload_type: type of download data.
1102  * @len: length in bytes of download data.
1103  * @crc: crc of download data.
1104  * @data: download data.
1105  */
1106 struct brcmf_dload_data_le {
1107 	__le16 flag;
1108 	__le16 dload_type;
1109 	__le32 len;
1110 	__le32 crc;
1111 	u8 data[];
1112 };
1113 
1114 /**
1115  * struct brcmf_pno_bssid_le - bssid configuration for PNO scan.
1116  *
1117  * @bssid: BSS network identifier.
1118  * @flags: flags for this BSSID.
1119  */
1120 struct brcmf_pno_bssid_le {
1121 	u8 bssid[ETH_ALEN];
1122 	__le16 flags;
1123 };
1124 
1125 /**
1126  * struct brcmf_pktcnt_le - packet counters.
1127  *
1128  * @rx_good_pkt: packets (MSDUs & MMPDUs) received from this station
1129  * @rx_bad_pkt: failed rx packets
1130  * @tx_good_pkt: packets (MSDUs & MMPDUs) transmitted to this station
1131  * @tx_bad_pkt: failed tx packets
1132  * @rx_ocast_good_pkt: unicast packets destined for others
1133  */
1134 struct brcmf_pktcnt_le {
1135 	__le32 rx_good_pkt;
1136 	__le32 rx_bad_pkt;
1137 	__le32 tx_good_pkt;
1138 	__le32 tx_bad_pkt;
1139 	__le32 rx_ocast_good_pkt;
1140 };
1141 
1142 /**
1143  * struct brcmf_gtk_keyinfo_le - GTP rekey data
1144  *
1145  * @kck: key confirmation key.
1146  * @kek: key encryption key.
1147  * @replay_counter: replay counter.
1148  */
1149 struct brcmf_gtk_keyinfo_le {
1150 	u8 kck[BRCMF_RSN_KCK_LENGTH];
1151 	u8 kek[BRCMF_RSN_KEK_LENGTH];
1152 	u8 replay_counter[BRCMF_RSN_REPLAY_LEN];
1153 };
1154 
1155 #define BRCMF_PNO_REPORT_NO_BATCH	BIT(2)
1156 
1157 /**
1158  * struct brcmf_gscan_bucket_config - configuration data for channel bucket.
1159  *
1160  * @bucket_end_index: last channel index in @channel_list in
1161  *	@struct brcmf_pno_config_le.
1162  * @bucket_freq_multiple: scan interval expressed in N * @scan_freq.
1163  * @flag: channel bucket report flags.
1164  * @reserved: for future use.
1165  * @repeat: number of scan at interval for exponential scan.
1166  * @max_freq_multiple: maximum scan interval for exponential scan.
1167  */
1168 struct brcmf_gscan_bucket_config {
1169 	u8 bucket_end_index;
1170 	u8 bucket_freq_multiple;
1171 	u8 flag;
1172 	u8 reserved;
1173 	__le16 repeat;
1174 	__le16 max_freq_multiple;
1175 };
1176 
1177 /* version supported which must match firmware */
1178 #define BRCMF_GSCAN_CFG_VERSION                     2
1179 
1180 /**
1181  * enum brcmf_gscan_cfg_flags - bit values for gscan flags.
1182  *
1183  * @BRCMF_GSCAN_CFG_FLAGS_ALL_RESULTS: send probe responses/beacons to host.
1184  * @BRCMF_GSCAN_CFG_ALL_BUCKETS_IN_1ST_SCAN: all buckets will be included in
1185  *	first scan cycle.
1186  * @BRCMF_GSCAN_CFG_FLAGS_CHANGE_ONLY: indicated only flags member is changed.
1187  */
1188 enum brcmf_gscan_cfg_flags {
1189 	BRCMF_GSCAN_CFG_FLAGS_ALL_RESULTS = BIT(0),
1190 	BRCMF_GSCAN_CFG_ALL_BUCKETS_IN_1ST_SCAN = BIT(3),
1191 	BRCMF_GSCAN_CFG_FLAGS_CHANGE_ONLY = BIT(7),
1192 };
1193 
1194 /**
1195  * struct brcmf_gscan_config - configuration data for gscan.
1196  *
1197  * @version: version of the api to match firmware.
1198  * @flags: flags according %enum brcmf_gscan_cfg_flags.
1199  * @buffer_threshold: percentage threshold of buffer to generate an event.
1200  * @swc_nbssid_threshold: number of BSSIDs with significant change that
1201  *	will generate an event.
1202  * @swc_rssi_window_size: size of rssi cache buffer (max=8).
1203  * @count_of_channel_buckets: number of array members in @bucket.
1204  * @retry_threshold: !unknown!
1205  * @lost_ap_window: !unknown!
1206  * @bucket: array of channel buckets.
1207  */
1208 struct brcmf_gscan_config {
1209 	__le16 version;
1210 	u8 flags;
1211 	u8 buffer_threshold;
1212 	u8 swc_nbssid_threshold;
1213 	u8 swc_rssi_window_size;
1214 	u8 count_of_channel_buckets;
1215 	u8 retry_threshold;
1216 	__le16  lost_ap_window;
1217 	struct brcmf_gscan_bucket_config bucket[];
1218 };
1219 
1220 /**
1221  * struct brcmf_mkeep_alive_pkt_le - configuration data for keep-alive frame.
1222  *
1223  * @version: version for mkeep_alive
1224  * @length: length of fixed parameters in the structure.
1225  * @period_msec: keep-alive period in milliseconds.
1226  * @len_bytes: size of the data.
1227  * @keep_alive_id: ID  (0 - 3).
1228  * @data: keep-alive frame data.
1229  */
1230 struct brcmf_mkeep_alive_pkt_le {
1231 	__le16  version;
1232 	__le16  length;
1233 	__le32  period_msec;
1234 	__le16  len_bytes;
1235 	u8   keep_alive_id;
1236 	u8   data[];
1237 } __packed;
1238 
1239 #endif /* FWIL_TYPES_H_ */
1240