xref: /linux/drivers/net/wireless/intel/iwlwifi/fw/api/d3.h (revision 8be4d31cb8aaeea27bde4b7ddb26e28a89062ebf)
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3  * Copyright (C) 2012-2014, 2018-2025 Intel Corporation
4  * Copyright (C) 2013-2014 Intel Mobile Communications GmbH
5  * Copyright (C) 2015-2017 Intel Deutschland GmbH
6  */
7 #ifndef __iwl_fw_api_d3_h__
8 #define __iwl_fw_api_d3_h__
9 #include <iwl-trans.h>
10 
11 /**
12  * enum iwl_d0i3_flags - d0i3 flags
13  * @IWL_D0I3_RESET_REQUIRE: FW require reset upon resume
14  */
15 enum iwl_d0i3_flags {
16 	IWL_D0I3_RESET_REQUIRE = BIT(0),
17 };
18 
19 /**
20  * enum iwl_d3_wakeup_flags - D3 manager wakeup flags
21  * @IWL_WAKEUP_D3_CONFIG_FW_ERROR: wake up on firmware sysassert
22  * @IWL_WAKEUP_D3_HOST_TIMER: wake up on host timer expiry
23  */
24 enum iwl_d3_wakeup_flags {
25 	IWL_WAKEUP_D3_CONFIG_FW_ERROR	= BIT(0),
26 	IWL_WAKEUP_D3_HOST_TIMER	= BIT(1),
27 }; /* D3_MANAGER_WAKEUP_CONFIG_API_E_VER_3 */
28 
29 /**
30  * struct iwl_d3_manager_config - D3 manager configuration command
31  * @min_sleep_time: minimum sleep time (in usec)
32  * @wakeup_flags: wakeup flags, see &enum iwl_d3_wakeup_flags
33  * @wakeup_host_timer: force wakeup after this many seconds
34  *
35  * The structure is used for the D3_CONFIG_CMD command.
36  */
37 struct iwl_d3_manager_config {
38 	__le32 min_sleep_time;
39 	__le32 wakeup_flags;
40 	__le32 wakeup_host_timer;
41 } __packed; /* D3_MANAGER_CONFIG_CMD_S_VER_4 */
42 
43 
44 /* TODO: OFFLOADS_QUERY_API_S_VER_1 */
45 
46 /**
47  * enum iwl_proto_offloads - enabled protocol offloads
48  * @IWL_D3_PROTO_OFFLOAD_ARP: ARP data is enabled
49  * @IWL_D3_PROTO_OFFLOAD_NS: NS (Neighbor Solicitation) is enabled
50  * @IWL_D3_PROTO_IPV4_VALID: IPv4 data is valid
51  * @IWL_D3_PROTO_IPV6_VALID: IPv6 data is valid
52  * @IWL_D3_PROTO_OFFLOAD_BTM: BTM offload is enabled
53  */
54 enum iwl_proto_offloads {
55 	IWL_D3_PROTO_OFFLOAD_ARP = BIT(0),
56 	IWL_D3_PROTO_OFFLOAD_NS = BIT(1),
57 	IWL_D3_PROTO_IPV4_VALID = BIT(2),
58 	IWL_D3_PROTO_IPV6_VALID = BIT(3),
59 	IWL_D3_PROTO_OFFLOAD_BTM = BIT(4),
60 };
61 
62 #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V1	2
63 #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V2	6
64 #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L	12
65 #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3S	4
66 #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX	12
67 
68 #define IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L	4
69 #define IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3S	2
70 
71 /**
72  * struct iwl_proto_offload_cmd_common - ARP/NS offload common part
73  * @enabled: enable flags
74  * @remote_ipv4_addr: remote address to answer to (or zero if all)
75  * @host_ipv4_addr: our IPv4 address to respond to queries for
76  * @arp_mac_addr: our MAC address for ARP responses
77  * @reserved: unused
78  */
79 struct iwl_proto_offload_cmd_common {
80 	__le32 enabled;
81 	__be32 remote_ipv4_addr;
82 	__be32 host_ipv4_addr;
83 	u8 arp_mac_addr[ETH_ALEN];
84 	__le16 reserved;
85 } __packed;
86 
87 /**
88  * struct iwl_proto_offload_cmd_v1 - ARP/NS offload configuration
89  * @common: common/IPv4 configuration
90  * @remote_ipv6_addr: remote address to answer to (or zero if all)
91  * @solicited_node_ipv6_addr: broken -- solicited node address exists
92  *	for each target address
93  * @target_ipv6_addr: our target addresses
94  * @ndp_mac_addr: neighbor solicitation response MAC address
95  * @reserved2: reserved
96  */
97 struct iwl_proto_offload_cmd_v1 {
98 	struct iwl_proto_offload_cmd_common common;
99 	u8 remote_ipv6_addr[16];
100 	u8 solicited_node_ipv6_addr[16];
101 	u8 target_ipv6_addr[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V1][16];
102 	u8 ndp_mac_addr[ETH_ALEN];
103 	__le16 reserved2;
104 } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_1 */
105 
106 /**
107  * struct iwl_proto_offload_cmd_v2 - ARP/NS offload configuration
108  * @common: common/IPv4 configuration
109  * @remote_ipv6_addr: remote address to answer to (or zero if all)
110  * @solicited_node_ipv6_addr: broken -- solicited node address exists
111  *	for each target address
112  * @target_ipv6_addr: our target addresses
113  * @ndp_mac_addr: neighbor solicitation response MAC address
114  * @num_valid_ipv6_addrs: number of valid IPv6 addresses
115  * @reserved2: reserved
116  */
117 struct iwl_proto_offload_cmd_v2 {
118 	struct iwl_proto_offload_cmd_common common;
119 	u8 remote_ipv6_addr[16];
120 	u8 solicited_node_ipv6_addr[16];
121 	u8 target_ipv6_addr[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V2][16];
122 	u8 ndp_mac_addr[ETH_ALEN];
123 	u8 num_valid_ipv6_addrs;
124 	u8 reserved2[3];
125 } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_2 */
126 
127 struct iwl_ns_config {
128 	struct in6_addr source_ipv6_addr;
129 	struct in6_addr dest_ipv6_addr;
130 	u8 target_mac_addr[ETH_ALEN];
131 	__le16 reserved;
132 } __packed; /* NS_OFFLOAD_CONFIG */
133 
134 struct iwl_targ_addr {
135 	struct in6_addr addr;
136 	__le32 config_num;
137 } __packed; /* TARGET_IPV6_ADDRESS */
138 
139 /**
140  * struct iwl_proto_offload_cmd_v3_small - ARP/NS offload configuration
141  * @common: common/IPv4 configuration
142  * @num_valid_ipv6_addrs: number of valid IPv6 addresses
143  * @targ_addrs: target IPv6 addresses
144  * @ns_config: NS offload configurations
145  */
146 struct iwl_proto_offload_cmd_v3_small {
147 	struct iwl_proto_offload_cmd_common common;
148 	__le32 num_valid_ipv6_addrs;
149 	struct iwl_targ_addr targ_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3S];
150 	struct iwl_ns_config ns_config[IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3S];
151 } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_3 */
152 
153 /**
154  * struct iwl_proto_offload_cmd_v3_large - ARP/NS offload configuration
155  * @common: common/IPv4 configuration
156  * @num_valid_ipv6_addrs: number of valid IPv6 addresses
157  * @targ_addrs: target IPv6 addresses
158  * @ns_config: NS offload configurations
159  */
160 struct iwl_proto_offload_cmd_v3_large {
161 	struct iwl_proto_offload_cmd_common common;
162 	__le32 num_valid_ipv6_addrs;
163 	struct iwl_targ_addr targ_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L];
164 	struct iwl_ns_config ns_config[IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L];
165 } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_3 */
166 
167 /**
168  * struct iwl_proto_offload_cmd_v4 - ARP/NS offload configuration
169  * @sta_id: station id
170  * @common: common/IPv4 configuration
171  * @num_valid_ipv6_addrs: number of valid IPv6 addresses
172  * @targ_addrs: target IPv6 addresses
173  * @ns_config: NS offload configurations
174  */
175 struct iwl_proto_offload_cmd_v4 {
176 	__le32 sta_id;
177 	struct iwl_proto_offload_cmd_common common;
178 	__le32 num_valid_ipv6_addrs;
179 	struct iwl_targ_addr targ_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L];
180 	struct iwl_ns_config ns_config[IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L];
181 } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_4 */
182 
183 /*
184  * WOWLAN_PATTERNS
185  */
186 #define IWL_WOWLAN_MIN_PATTERN_LEN	16
187 #define IWL_WOWLAN_MAX_PATTERN_LEN	128
188 
189 struct iwl_wowlan_pattern_v1 {
190 	u8 mask[IWL_WOWLAN_MAX_PATTERN_LEN / 8];
191 	u8 pattern[IWL_WOWLAN_MAX_PATTERN_LEN];
192 	u8 mask_size;
193 	u8 pattern_size;
194 	__le16 reserved;
195 } __packed; /* WOWLAN_PATTERN_API_S_VER_1 */
196 
197 #define IWL_WOWLAN_MAX_PATTERNS	20
198 
199 /**
200  * struct iwl_wowlan_patterns_cmd_v1 - WoWLAN wakeup patterns
201  */
202 struct iwl_wowlan_patterns_cmd_v1 {
203 	/**
204 	 * @n_patterns: number of patterns
205 	 */
206 	__le32 n_patterns;
207 
208 	/**
209 	 * @patterns: the patterns, array length in @n_patterns
210 	 */
211 	struct iwl_wowlan_pattern_v1 patterns[];
212 } __packed; /* WOWLAN_PATTERN_ARRAY_API_S_VER_1 */
213 
214 #define IPV4_ADDR_SIZE	4
215 #define IPV6_ADDR_SIZE	16
216 
217 enum iwl_wowlan_pattern_type {
218 	WOWLAN_PATTERN_TYPE_BITMASK,
219 	WOWLAN_PATTERN_TYPE_IPV4_TCP_SYN,
220 	WOWLAN_PATTERN_TYPE_IPV6_TCP_SYN,
221 	WOWLAN_PATTERN_TYPE_IPV4_TCP_SYN_WILDCARD,
222 	WOWLAN_PATTERN_TYPE_IPV6_TCP_SYN_WILDCARD,
223 }; /* WOWLAN_PATTERN_TYPE_API_E_VER_1 */
224 
225 /**
226  * struct iwl_wowlan_ipv4_tcp_syn - WoWLAN IPv4 TCP SYN pattern data
227  */
228 struct iwl_wowlan_ipv4_tcp_syn {
229 	/**
230 	 * @src_addr: source IP address to match
231 	 */
232 	u8 src_addr[IPV4_ADDR_SIZE];
233 
234 	/**
235 	 * @dst_addr: destination IP address to match
236 	 */
237 	u8 dst_addr[IPV4_ADDR_SIZE];
238 
239 	/**
240 	 * @src_port: source TCP port to match
241 	 */
242 	__le16 src_port;
243 
244 	/**
245 	 * @dst_port: destination TCP port to match
246 	 */
247 	__le16 dst_port;
248 } __packed; /* WOWLAN_IPV4_TCP_SYN_API_S_VER_1 */
249 
250 /**
251  * struct iwl_wowlan_ipv6_tcp_syn - WoWLAN Ipv6 TCP SYN pattern data
252  */
253 struct iwl_wowlan_ipv6_tcp_syn {
254 	/**
255 	 * @src_addr: source IP address to match
256 	 */
257 	u8 src_addr[IPV6_ADDR_SIZE];
258 
259 	/**
260 	 * @dst_addr: destination IP address to match
261 	 */
262 	u8 dst_addr[IPV6_ADDR_SIZE];
263 
264 	/**
265 	 * @src_port: source TCP port to match
266 	 */
267 	__le16 src_port;
268 
269 	/**
270 	 * @dst_port: destination TCP port to match
271 	 */
272 	__le16 dst_port;
273 } __packed; /* WOWLAN_IPV6_TCP_SYN_API_S_VER_1 */
274 
275 /**
276  * union iwl_wowlan_pattern_data - Data for the different pattern types
277  *
278  * If wildcard addresses/ports are to be used, the union can be left
279  * undefined.
280  */
281 union iwl_wowlan_pattern_data {
282 	/**
283 	 * @bitmask: bitmask pattern data
284 	 */
285 	struct iwl_wowlan_pattern_v1 bitmask;
286 
287 	/**
288 	 * @ipv4_tcp_syn: IPv4 TCP SYN pattern data
289 	 */
290 	struct iwl_wowlan_ipv4_tcp_syn ipv4_tcp_syn;
291 
292 	/**
293 	 * @ipv6_tcp_syn: IPv6 TCP SYN pattern data
294 	 */
295 	struct iwl_wowlan_ipv6_tcp_syn ipv6_tcp_syn;
296 }; /* WOWLAN_PATTERN_API_U_VER_1 */
297 
298 /**
299  * struct iwl_wowlan_pattern_v2 - Pattern entry for the WoWLAN wakeup patterns
300  */
301 struct iwl_wowlan_pattern_v2 {
302 	/**
303 	 * @pattern_type: defines the struct type to be used in the union
304 	 */
305 	u8 pattern_type;
306 
307 	/**
308 	 * @reserved: reserved for alignment
309 	 */
310 	u8 reserved[3];
311 
312 	/**
313 	 * @u: the union containing the match data, or undefined for
314 	 *     wildcard matches
315 	 */
316 	union iwl_wowlan_pattern_data u;
317 } __packed; /* WOWLAN_PATTERN_API_S_VER_2 */
318 
319 /**
320  * struct iwl_wowlan_patterns_cmd - WoWLAN wakeup patterns command
321  */
322 struct iwl_wowlan_patterns_cmd {
323 	/**
324 	 * @n_patterns: number of patterns
325 	 */
326 	u8 n_patterns;
327 
328 	/**
329 	 * @sta_id: sta_id
330 	 */
331 	u8 sta_id;
332 
333 	/**
334 	 * @reserved: reserved for alignment
335 	 */
336 	__le16 reserved;
337 
338 	/**
339 	 * @patterns: the patterns, array length in @n_patterns
340 	 */
341 	struct iwl_wowlan_pattern_v2 patterns[];
342 } __packed; /* WOWLAN_PATTERN_ARRAY_API_S_VER_3 */
343 
344 enum iwl_wowlan_wakeup_filters {
345 	IWL_WOWLAN_WAKEUP_MAGIC_PACKET			= BIT(0),
346 	IWL_WOWLAN_WAKEUP_PATTERN_MATCH			= BIT(1),
347 	IWL_WOWLAN_WAKEUP_BEACON_MISS			= BIT(2),
348 	IWL_WOWLAN_WAKEUP_LINK_CHANGE			= BIT(3),
349 	IWL_WOWLAN_WAKEUP_GTK_REKEY_FAIL		= BIT(4),
350 	IWL_WOWLAN_WAKEUP_EAP_IDENT_REQ			= BIT(5),
351 	IWL_WOWLAN_WAKEUP_4WAY_HANDSHAKE		= BIT(6),
352 	IWL_WOWLAN_WAKEUP_ENABLE_NET_DETECT		= BIT(7),
353 	IWL_WOWLAN_WAKEUP_RF_KILL_DEASSERT		= BIT(8),
354 	IWL_WOWLAN_WAKEUP_REMOTE_LINK_LOSS		= BIT(9),
355 	IWL_WOWLAN_WAKEUP_REMOTE_SIGNATURE_TABLE	= BIT(10),
356 	IWL_WOWLAN_WAKEUP_REMOTE_TCP_EXTERNAL		= BIT(11),
357 	IWL_WOWLAN_WAKEUP_REMOTE_WAKEUP_PACKET		= BIT(12),
358 	IWL_WOWLAN_WAKEUP_IOAC_MAGIC_PACKET		= BIT(13),
359 	IWL_WOWLAN_WAKEUP_HOST_TIMER			= BIT(14),
360 	IWL_WOWLAN_WAKEUP_RX_FRAME			= BIT(15),
361 	IWL_WOWLAN_WAKEUP_BCN_FILTERING			= BIT(16),
362 }; /* WOWLAN_WAKEUP_FILTER_API_E_VER_4 */
363 
364 enum iwl_wowlan_flags {
365 	IS_11W_ASSOC		= BIT(0),
366 	ENABLE_L3_FILTERING	= BIT(1),
367 	ENABLE_NBNS_FILTERING	= BIT(2),
368 	ENABLE_DHCP_FILTERING	= BIT(3),
369 	ENABLE_STORE_BEACON	= BIT(4),
370 };
371 
372 /**
373  * struct iwl_wowlan_config_cmd_v6 - WoWLAN configuration (versions 5 and 6)
374  * @wakeup_filter: filter from &enum iwl_wowlan_wakeup_filters
375  * @non_qos_seq: non-QoS sequence counter to use next.
376  *               Reserved if the struct has version >= 6.
377  * @qos_seq: QoS sequence counters to use next
378  * @wowlan_ba_teardown_tids: bitmap of BA sessions to tear down
379  * @is_11n_connection: indicates HT connection
380  * @offloading_tid: TID reserved for firmware use
381  * @flags: extra flags, see &enum iwl_wowlan_flags
382  * @sta_id: station ID for wowlan.
383  * @reserved: reserved
384  */
385 struct iwl_wowlan_config_cmd_v6 {
386 	__le32 wakeup_filter;
387 	__le16 non_qos_seq;
388 	__le16 qos_seq[8];
389 	u8 wowlan_ba_teardown_tids;
390 	u8 is_11n_connection;
391 	u8 offloading_tid;
392 	u8 flags;
393 	u8 sta_id;
394 	u8 reserved;
395 } __packed; /* WOWLAN_CONFIG_API_S_VER_6 */
396 
397 /**
398  * struct iwl_wowlan_config_cmd - WoWLAN configuration
399  * @wakeup_filter: filter from &enum iwl_wowlan_wakeup_filters
400  * @wowlan_ba_teardown_tids: bitmap of BA sessions to tear down
401  * @is_11n_connection: indicates HT connection
402  * @offloading_tid: TID reserved for firmware use
403  * @flags: extra flags, see &enum iwl_wowlan_flags
404  * @sta_id: station ID for wowlan.
405  * @reserved: reserved
406  */
407 struct iwl_wowlan_config_cmd {
408 	__le32 wakeup_filter;
409 	u8 wowlan_ba_teardown_tids;
410 	u8 is_11n_connection;
411 	u8 offloading_tid;
412 	u8 flags;
413 	u8 sta_id;
414 	u8 reserved[3];
415 } __packed; /* WOWLAN_CONFIG_API_S_VER_7 */
416 
417 #define IWL_NUM_RSC	16
418 #define WOWLAN_KEY_MAX_SIZE	32
419 #define WOWLAN_GTK_KEYS_NUM     2
420 #define WOWLAN_IGTK_KEYS_NUM	2
421 #define WOWLAN_IGTK_MIN_INDEX	4
422 #define WOWLAN_BIGTK_KEYS_NUM	2
423 #define WOWLAN_BIGTK_MIN_INDEX	6
424 
425 /*
426  * WOWLAN_TSC_RSC_PARAMS
427  */
428 struct tkip_sc {
429 	__le16 iv16;
430 	__le16 pad;
431 	__le32 iv32;
432 } __packed; /* TKIP_SC_API_U_VER_1 */
433 
434 struct iwl_tkip_rsc_tsc {
435 	struct tkip_sc unicast_rsc[IWL_NUM_RSC];
436 	struct tkip_sc multicast_rsc[IWL_NUM_RSC];
437 	struct tkip_sc tsc;
438 } __packed; /* TKIP_TSC_RSC_API_S_VER_1 */
439 
440 struct aes_sc {
441 	__le64 pn;
442 } __packed; /* TKIP_AES_SC_API_U_VER_1 */
443 
444 struct iwl_aes_rsc_tsc {
445 	struct aes_sc unicast_rsc[IWL_NUM_RSC];
446 	struct aes_sc multicast_rsc[IWL_NUM_RSC];
447 	struct aes_sc tsc;
448 } __packed; /* AES_TSC_RSC_API_S_VER_1 */
449 
450 union iwl_all_tsc_rsc {
451 	struct iwl_tkip_rsc_tsc tkip;
452 	struct iwl_aes_rsc_tsc aes;
453 }; /* ALL_TSC_RSC_API_S_VER_2 */
454 
455 struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 {
456 	union iwl_all_tsc_rsc all_tsc_rsc;
457 } __packed; /* ALL_TSC_RSC_API_S_VER_2 */
458 
459 struct iwl_wowlan_rsc_tsc_params_cmd {
460 	__le64 ucast_rsc[IWL_MAX_TID_COUNT];
461 	__le64 mcast_rsc[WOWLAN_GTK_KEYS_NUM][IWL_MAX_TID_COUNT];
462 	__le32 sta_id;
463 #define IWL_MCAST_KEY_MAP_INVALID	0xff
464 	u8 mcast_key_id_map[4];
465 } __packed; /* ALL_TSC_RSC_API_S_VER_5 */
466 
467 #define IWL_MIC_KEY_SIZE	8
468 struct iwl_mic_keys {
469 	u8 tx[IWL_MIC_KEY_SIZE];
470 	u8 rx_unicast[IWL_MIC_KEY_SIZE];
471 	u8 rx_mcast[IWL_MIC_KEY_SIZE];
472 } __packed; /* MIC_KEYS_API_S_VER_1 */
473 
474 #define IWL_P1K_SIZE		5
475 struct iwl_p1k_cache {
476 	__le16 p1k[IWL_P1K_SIZE];
477 } __packed;
478 
479 #define IWL_NUM_RX_P1K_CACHE	2
480 
481 struct iwl_wowlan_tkip_params_cmd_ver_1 {
482 	struct iwl_mic_keys mic_keys;
483 	struct iwl_p1k_cache tx;
484 	struct iwl_p1k_cache rx_uni[IWL_NUM_RX_P1K_CACHE];
485 	struct iwl_p1k_cache rx_multi[IWL_NUM_RX_P1K_CACHE];
486 } __packed; /* WOWLAN_TKIP_SETTING_API_S_VER_1 */
487 
488 struct iwl_wowlan_tkip_params_cmd {
489 	struct iwl_mic_keys mic_keys;
490 	struct iwl_p1k_cache tx;
491 	struct iwl_p1k_cache rx_uni[IWL_NUM_RX_P1K_CACHE];
492 	struct iwl_p1k_cache rx_multi[IWL_NUM_RX_P1K_CACHE];
493 	u8     reversed[2];
494 	__le32 sta_id;
495 } __packed; /* WOWLAN_TKIP_SETTING_API_S_VER_2 */
496 
497 #define IWL_KCK_MAX_SIZE	32
498 #define IWL_KEK_MAX_SIZE	32
499 
500 struct iwl_wowlan_kek_kck_material_cmd_v2 {
501 	u8	kck[IWL_KCK_MAX_SIZE];
502 	u8	kek[IWL_KEK_MAX_SIZE];
503 	__le16	kck_len;
504 	__le16	kek_len;
505 	__le64	replay_ctr;
506 } __packed; /* KEK_KCK_MATERIAL_API_S_VER_2 */
507 
508 struct iwl_wowlan_kek_kck_material_cmd_v3 {
509 	u8	kck[IWL_KCK_MAX_SIZE];
510 	u8	kek[IWL_KEK_MAX_SIZE];
511 	__le16	kck_len;
512 	__le16	kek_len;
513 	__le64	replay_ctr;
514 	__le32  akm;
515 	__le32  gtk_cipher;
516 	__le32  igtk_cipher;
517 	__le32  bigtk_cipher;
518 } __packed; /* KEK_KCK_MATERIAL_API_S_VER_3 */
519 
520 struct iwl_wowlan_kek_kck_material_cmd_v4 {
521 	__le32  sta_id;
522 	u8	kck[IWL_KCK_MAX_SIZE];
523 	u8	kek[IWL_KEK_MAX_SIZE];
524 	__le16	kck_len;
525 	__le16	kek_len;
526 	__le64	replay_ctr;
527 	__le32  akm;
528 	__le32  gtk_cipher;
529 	__le32  igtk_cipher;
530 	__le32  bigtk_cipher;
531 } __packed; /* KEK_KCK_MATERIAL_API_S_VER_4 */
532 
533 struct iwl_wowlan_get_status_cmd {
534 	__le32  sta_id;
535 } __packed; /* WOWLAN_GET_STATUSES_CMD_API_S_VER_1 */
536 
537 #define RF_KILL_INDICATOR_FOR_WOWLAN	0x87
538 
539 enum iwl_wowlan_rekey_status {
540 	IWL_WOWLAN_REKEY_POST_REKEY = 0,
541 	IWL_WOWLAN_REKEY_WHILE_REKEY = 1,
542 }; /* WOWLAN_REKEY_STATUS_API_E_VER_1 */
543 
544 enum iwl_wowlan_wakeup_reason {
545 	IWL_WOWLAN_WAKEUP_BY_NON_WIRELESS			= 0,
546 	IWL_WOWLAN_WAKEUP_BY_MAGIC_PACKET			= BIT(0),
547 	IWL_WOWLAN_WAKEUP_BY_PATTERN				= BIT(1),
548 	IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_MISSED_BEACON	= BIT(2),
549 	IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_DEAUTH		= BIT(3),
550 	IWL_WOWLAN_WAKEUP_BY_GTK_REKEY_FAILURE			= BIT(4),
551 	IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED			= BIT(5),
552 	IWL_WOWLAN_WAKEUP_BY_UCODE_ERROR			= BIT(6),
553 	IWL_WOWLAN_WAKEUP_BY_EAPOL_REQUEST			= BIT(7),
554 	IWL_WOWLAN_WAKEUP_BY_FOUR_WAY_HANDSHAKE			= BIT(8),
555 	IWL_WOWLAN_WAKEUP_BY_REM_WAKE_LINK_LOSS			= BIT(9),
556 	IWL_WOWLAN_WAKEUP_BY_REM_WAKE_SIGNATURE_TABLE		= BIT(10),
557 	IWL_WOWLAN_WAKEUP_BY_REM_WAKE_TCP_EXTERNAL		= BIT(11),
558 	IWL_WOWLAN_WAKEUP_BY_REM_WAKE_WAKEUP_PACKET		= BIT(12),
559 	IWL_WOWLAN_WAKEUP_BY_IOAC_MAGIC_PACKET			= BIT(13),
560 	IWL_WOWLAN_WAKEUP_BY_D3_WAKEUP_HOST_TIMER		= BIT(14),
561 	IWL_WOWLAN_WAKEUP_BY_RXFRAME_FILTERED_IN		= BIT(15),
562 	IWL_WOWLAN_WAKEUP_BY_BEACON_FILTERED_IN			= BIT(16),
563 	IWL_WAKEUP_BY_11W_UNPROTECTED_DEAUTH_OR_DISASSOC	= BIT(17),
564 	IWL_WAKEUP_BY_PATTERN_IPV4_TCP_SYN			= BIT(18),
565 	IWL_WAKEUP_BY_PATTERN_IPV4_TCP_SYN_WILDCARD		= BIT(19),
566 	IWL_WAKEUP_BY_PATTERN_IPV6_TCP_SYN			= BIT(20),
567 	IWL_WAKEUP_BY_PATTERN_IPV6_TCP_SYN_WILDCARD		= BIT(21),
568 }; /* WOWLAN_WAKE_UP_REASON_API_E_VER_2 */
569 
570 struct iwl_wowlan_gtk_status_v1 {
571 	u8 key_index;
572 	u8 reserved[3];
573 	u8 decrypt_key[16];
574 	u8 tkip_mic_key[8];
575 	struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 rsc;
576 } __packed; /* WOWLAN_GTK_MATERIAL_VER_1 */
577 
578 /**
579  * struct iwl_wowlan_gtk_status_v2 - GTK status
580  * @key: GTK material
581  * @key_len: GTK legth, if set to 0, the key is not available
582  * @key_flags: information about the key:
583  *	bits[0:1]:  key index assigned by the AP
584  *	bits[2:6]:  GTK index of the key in the internal DB
585  *	bit[7]:     Set iff this is the currently used GTK
586  * @reserved: padding
587  * @tkip_mic_key: TKIP RX MIC key
588  * @rsc: TSC RSC counters
589  */
590 struct iwl_wowlan_gtk_status_v2 {
591 	u8 key[WOWLAN_KEY_MAX_SIZE];
592 	u8 key_len;
593 	u8 key_flags;
594 	u8 reserved[2];
595 	u8 tkip_mic_key[8];
596 	struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 rsc;
597 } __packed; /* WOWLAN_GTK_MATERIAL_VER_2 */
598 
599 /**
600  * struct iwl_wowlan_all_rsc_tsc_v5 - key counters
601  * @ucast_rsc: unicast RSC values
602  * @mcast_rsc: multicast RSC values (per key map value)
603  * @sta_id: station ID
604  * @mcast_key_id_map: map of key id to @mcast_rsc entry
605  */
606 struct iwl_wowlan_all_rsc_tsc_v5 {
607 	__le64 ucast_rsc[IWL_MAX_TID_COUNT];
608 	__le64 mcast_rsc[2][IWL_MAX_TID_COUNT];
609 	__le32 sta_id;
610 	u8 mcast_key_id_map[4];
611 } __packed; /* ALL_TSC_RSC_API_S_VER_5 */
612 
613 /**
614  * struct iwl_wowlan_gtk_status_v3 - GTK status
615  * @key: GTK material
616  * @key_len: GTK length, if set to 0, the key is not available
617  * @key_flags: information about the key:
618  *	bits[0:1]:  key index assigned by the AP
619  *	bits[2:6]:  GTK index of the key in the internal DB
620  *	bit[7]:     Set iff this is the currently used GTK
621  * @reserved: padding
622  * @tkip_mic_key: TKIP RX MIC key
623  * @sc: RSC/TSC counters
624  */
625 struct iwl_wowlan_gtk_status_v3 {
626 	u8 key[WOWLAN_KEY_MAX_SIZE];
627 	u8 key_len;
628 	u8 key_flags;
629 	u8 reserved[2];
630 	u8 tkip_mic_key[IWL_MIC_KEY_SIZE];
631 	struct iwl_wowlan_all_rsc_tsc_v5 sc;
632 } __packed; /* WOWLAN_GTK_MATERIAL_VER_3 */
633 
634 #define IWL_WOWLAN_GTK_IDX_MASK		(BIT(0) | BIT(1))
635 #define IWL_WOWLAN_IGTK_BIGTK_IDX_MASK	(BIT(0))
636 
637 /**
638  * struct iwl_wowlan_igtk_status - IGTK status
639  * @key: IGTK material
640  * @ipn: the IGTK packet number (replay counter)
641  * @key_len: IGTK length, if set to 0, the key is not available
642  * @key_flags: information about the key:
643  *	bits[0]: key index assigned by the AP (0: index 4, 1: index 5)
644  *	(0: index 6, 1: index 7 with bigtk)
645  *	bits[1:5]: IGTK index of the key in the internal DB
646  *	bit[6]: Set iff this is the currently used IGTK
647  */
648 struct iwl_wowlan_igtk_status {
649 	u8 key[WOWLAN_KEY_MAX_SIZE];
650 	u8 ipn[6];
651 	u8 key_len;
652 	u8 key_flags;
653 } __packed; /* WOWLAN_IGTK_MATERIAL_VER_1 */
654 
655 /**
656  * struct iwl_wowlan_status_v6 - WoWLAN status
657  * @gtk: GTK data
658  * @replay_ctr: GTK rekey replay counter
659  * @pattern_number: number of the matched pattern
660  * @non_qos_seq_ctr: non-QoS sequence counter to use next
661  * @qos_seq_ctr: QoS sequence counters to use next
662  * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
663  * @num_of_gtk_rekeys: number of GTK rekeys
664  * @transmitted_ndps: number of transmitted neighbor discovery packets
665  * @received_beacons: number of received beacons
666  * @wake_packet_length: wakeup packet length
667  * @wake_packet_bufsize: wakeup packet buffer size
668  * @wake_packet: wakeup packet
669  */
670 struct iwl_wowlan_status_v6 {
671 	struct iwl_wowlan_gtk_status_v1 gtk;
672 	__le64 replay_ctr;
673 	__le16 pattern_number;
674 	__le16 non_qos_seq_ctr;
675 	__le16 qos_seq_ctr[8];
676 	__le32 wakeup_reasons;
677 	__le32 num_of_gtk_rekeys;
678 	__le32 transmitted_ndps;
679 	__le32 received_beacons;
680 	__le32 wake_packet_length;
681 	__le32 wake_packet_bufsize;
682 	u8 wake_packet[]; /* can be truncated from _length to _bufsize */
683 } __packed; /* WOWLAN_STATUSES_API_S_VER_6 */
684 
685 /**
686  * struct iwl_wowlan_status_v7 - WoWLAN status
687  * @gtk: GTK data
688  * @igtk: IGTK data
689  * @replay_ctr: GTK rekey replay counter
690  * @pattern_number: number of the matched pattern
691  * @non_qos_seq_ctr: non-QoS sequence counter to use next
692  * @qos_seq_ctr: QoS sequence counters to use next
693  * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
694  * @num_of_gtk_rekeys: number of GTK rekeys
695  * @transmitted_ndps: number of transmitted neighbor discovery packets
696  * @received_beacons: number of received beacons
697  * @wake_packet_length: wakeup packet length
698  * @wake_packet_bufsize: wakeup packet buffer size
699  * @wake_packet: wakeup packet
700  */
701 struct iwl_wowlan_status_v7 {
702 	struct iwl_wowlan_gtk_status_v2 gtk[WOWLAN_GTK_KEYS_NUM];
703 	struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
704 	__le64 replay_ctr;
705 	__le16 pattern_number;
706 	__le16 non_qos_seq_ctr;
707 	__le16 qos_seq_ctr[8];
708 	__le32 wakeup_reasons;
709 	__le32 num_of_gtk_rekeys;
710 	__le32 transmitted_ndps;
711 	__le32 received_beacons;
712 	__le32 wake_packet_length;
713 	__le32 wake_packet_bufsize;
714 	u8 wake_packet[]; /* can be truncated from _length to _bufsize */
715 } __packed; /* WOWLAN_STATUSES_API_S_VER_7 */
716 
717 /**
718  * struct iwl_wowlan_info_notif_v1 - WoWLAN information notification
719  * @gtk: GTK data
720  * @igtk: IGTK data
721  * @replay_ctr: GTK rekey replay counter
722  * @pattern_number: number of the matched patterns
723  * @reserved1: reserved
724  * @qos_seq_ctr: QoS sequence counters to use next
725  * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
726  * @num_of_gtk_rekeys: number of GTK rekeys
727  * @transmitted_ndps: number of transmitted neighbor discovery packets
728  * @received_beacons: number of received beacons
729  * @wake_packet_length: wakeup packet length
730  * @wake_packet_bufsize: wakeup packet buffer size
731  * @tid_tear_down: bit mask of tids whose BA sessions were closed
732  *	in suspend state
733  * @station_id: station id
734  * @reserved2: reserved
735  */
736 struct iwl_wowlan_info_notif_v1 {
737 	struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM];
738 	struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
739 	__le64 replay_ctr;
740 	__le16 pattern_number;
741 	__le16 reserved1;
742 	__le16 qos_seq_ctr[8];
743 	__le32 wakeup_reasons;
744 	__le32 num_of_gtk_rekeys;
745 	__le32 transmitted_ndps;
746 	__le32 received_beacons;
747 	__le32 wake_packet_length;
748 	__le32 wake_packet_bufsize;
749 	u8 tid_tear_down;
750 	u8 station_id;
751 	u8 reserved2[2];
752 } __packed; /* WOWLAN_INFO_NTFY_API_S_VER_1 */
753 
754 /* MAX MLO keys of non-active links that can arrive in the notification */
755 #define WOWLAN_MAX_MLO_KEYS 18
756 
757 /**
758  * enum iwl_wowlan_mlo_gtk_type - GTK types
759  * @WOWLAN_MLO_GTK_KEY_TYPE_GTK: GTK
760  * @WOWLAN_MLO_GTK_KEY_TYPE_IGTK: IGTK
761  * @WOWLAN_MLO_GTK_KEY_TYPE_BIGTK: BIGTK
762  * @WOWLAN_MLO_GTK_KEY_NUM_TYPES: number of key types
763  */
764 enum iwl_wowlan_mlo_gtk_type {
765 	WOWLAN_MLO_GTK_KEY_TYPE_GTK,
766 	WOWLAN_MLO_GTK_KEY_TYPE_IGTK,
767 	WOWLAN_MLO_GTK_KEY_TYPE_BIGTK,
768 	WOWLAN_MLO_GTK_KEY_NUM_TYPES
769 }; /* WOWLAN_MLO_GTK_KEY_TYPE_API_E_VER_1 */
770 
771 /**
772  * enum iwl_wowlan_mlo_gtk_flag - MLO GTK flags
773  * @WOWLAN_MLO_GTK_FLAG_KEY_LEN_MSK: 0 for len 16, 1 for len 32
774  * @WOWLAN_MLO_GTK_FLAG_KEY_ID_MSK: key id (ranges from 0 to 7)
775  * @WOWLAN_MLO_GTK_FLAG_LINK_ID_MSK: spec link id of the key
776  * @WOWLAN_MLO_GTK_FLAG_KEY_TYPE_MSK: &enum iwl_wowlan_mlo_gtk_type
777  * @WOWLAN_MLO_GTK_FLAG_LAST_KEY_MSK: is this the last given key per
778  *	key-type / link-id - the currently used key
779  */
780 enum iwl_wowlan_mlo_gtk_flag {
781 	WOWLAN_MLO_GTK_FLAG_KEY_LEN_MSK = 0x0001,
782 	WOWLAN_MLO_GTK_FLAG_KEY_ID_MSK = 0x000E,
783 	WOWLAN_MLO_GTK_FLAG_LINK_ID_MSK = 0x00F0,
784 	WOWLAN_MLO_GTK_FLAG_KEY_TYPE_MSK = 0x0300,
785 	WOWLAN_MLO_GTK_FLAG_LAST_KEY_MSK = 0x0400
786 }; /* WOWLAN_MLO_GTK_FLAG_API_E_VER_1 */
787 
788 /**
789  * struct iwl_wowlan_mlo_gtk - MLO GTK info
790  * @key: key material
791  * @flags: &enum iwl_wowlan_mlo_gtk_flag
792  * @pn: packet number
793  */
794 struct iwl_wowlan_mlo_gtk {
795 	u8 key[WOWLAN_KEY_MAX_SIZE];
796 	__le16 flags;
797 	u8 pn[6];
798 } __packed; /* WOWLAN_MLO_GTK_KEY_API_S_VER_1 */
799 
800 /**
801  * struct iwl_wowlan_info_notif_v3 - WoWLAN information notification
802  * @gtk: GTK data
803  * @igtk: IGTK data
804  * @bigtk: BIGTK data
805  * @replay_ctr: GTK rekey replay counter
806  * @pattern_number: number of the matched patterns
807  * @reserved1: reserved
808  * @qos_seq_ctr: QoS sequence counters to use next
809  * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
810  * @num_of_gtk_rekeys: number of GTK rekeys
811  * @transmitted_ndps: number of transmitted neighbor discovery packets
812  * @received_beacons: number of received beacons
813  * @tid_tear_down: bit mask of tids whose BA sessions were closed
814  *	in suspend state
815  * @station_id: station id
816  * @reserved2: reserved
817  */
818 struct iwl_wowlan_info_notif_v3 {
819 	struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM];
820 	struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
821 	struct iwl_wowlan_igtk_status bigtk[WOWLAN_BIGTK_KEYS_NUM];
822 	__le64 replay_ctr;
823 	__le16 pattern_number;
824 	__le16 reserved1;
825 	__le16 qos_seq_ctr[8];
826 	__le32 wakeup_reasons;
827 	__le32 num_of_gtk_rekeys;
828 	__le32 transmitted_ndps;
829 	__le32 received_beacons;
830 	u8 tid_tear_down;
831 	u8 station_id;
832 	u8 reserved2[2];
833 } __packed; /* WOWLAN_INFO_NTFY_API_S_VER_3 */
834 
835 /**
836  * struct iwl_wowlan_info_notif - WoWLAN information notification
837  * @gtk: GTK data
838  * @igtk: IGTK data
839  * @bigtk: BIGTK data
840  * @replay_ctr: GTK rekey replay counter
841  * @pattern_number: number of the matched patterns
842  * @qos_seq_ctr: QoS sequence counters to use next
843  * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
844  * @num_of_gtk_rekeys: number of GTK rekeys
845  * @transmitted_ndps: number of transmitted neighbor discovery packets
846  * @received_beacons: number of received beacons
847  * @tid_tear_down: bit mask of tids whose BA sessions were closed
848  *	in suspend state
849  * @station_id: station id
850  * @num_mlo_link_keys: number of &struct iwl_wowlan_mlo_gtk structs
851  *	following this notif
852  * @tid_offloaded_tx: tid used by the firmware to transmit data packets
853  *	while in wowlan
854  * @mlo_gtks: array of GTKs of size num_mlo_link_keys
855  */
856 struct iwl_wowlan_info_notif {
857 	struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM];
858 	struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
859 	struct iwl_wowlan_igtk_status bigtk[WOWLAN_BIGTK_KEYS_NUM];
860 	__le64 replay_ctr;
861 	__le16 pattern_number;
862 	__le16 qos_seq_ctr;
863 	__le32 wakeup_reasons;
864 	__le32 num_of_gtk_rekeys;
865 	__le32 transmitted_ndps;
866 	__le32 received_beacons;
867 	u8 tid_tear_down;
868 	u8 station_id;
869 	u8 num_mlo_link_keys;
870 	u8 tid_offloaded_tx;
871 	struct iwl_wowlan_mlo_gtk mlo_gtks[];
872 } __packed; /* WOWLAN_INFO_NTFY_API_S_VER_5 */
873 
874 /**
875  * struct iwl_wowlan_wake_pkt_notif - WoWLAN wake packet notification
876  * @wake_packet_length: wakeup packet length
877  * @station_id: station id
878  * @reserved: unused
879  * @wake_packet: wakeup packet
880  */
881 struct iwl_wowlan_wake_pkt_notif {
882 	__le32 wake_packet_length;
883 	u8 station_id;
884 	u8 reserved[3];
885 	u8 wake_packet[1];
886 } __packed; /* WOWLAN_WAKE_PKT_NTFY_API_S_VER_1 */
887 
888 /**
889  * struct iwl_mvm_d3_end_notif -  d3 end notification
890  * @flags: See &enum iwl_d0i3_flags
891  */
892 struct iwl_d3_end_notif {
893 	__le32 flags;
894 } __packed;
895 
896 /* TODO: NetDetect API */
897 
898 #endif /* __iwl_fw_api_d3_h__ */
899