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