xref: /linux/drivers/net/wireless/intel/iwlwifi/fw/api/d3.h (revision 7a7c52645ce62314cdd69815e9d8fcb33e0042d5)
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 	HAS_BEACON_PROTECTION	= BIT(5),
371 };
372 
373 /**
374  * struct iwl_wowlan_config_cmd_v6 - WoWLAN configuration (versions 5 and 6)
375  * @wakeup_filter: filter from &enum iwl_wowlan_wakeup_filters
376  * @non_qos_seq: non-QoS sequence counter to use next.
377  *               Reserved if the struct has version >= 6.
378  * @qos_seq: QoS sequence counters to use next
379  * @wowlan_ba_teardown_tids: bitmap of BA sessions to tear down
380  * @is_11n_connection: indicates HT connection
381  * @offloading_tid: TID reserved for firmware use
382  * @flags: extra flags, see &enum iwl_wowlan_flags
383  * @sta_id: station ID for wowlan.
384  * @reserved: reserved
385  */
386 struct iwl_wowlan_config_cmd_v6 {
387 	__le32 wakeup_filter;
388 	__le16 non_qos_seq;
389 	__le16 qos_seq[8];
390 	u8 wowlan_ba_teardown_tids;
391 	u8 is_11n_connection;
392 	u8 offloading_tid;
393 	u8 flags;
394 	u8 sta_id;
395 	u8 reserved;
396 } __packed; /* WOWLAN_CONFIG_API_S_VER_6 */
397 
398 /**
399  * struct iwl_wowlan_config_cmd - WoWLAN configuration
400  * @wakeup_filter: filter from &enum iwl_wowlan_wakeup_filters
401  * @wowlan_ba_teardown_tids: bitmap of BA sessions to tear down
402  * @is_11n_connection: indicates HT connection
403  * @offloading_tid: TID reserved for firmware use
404  * @flags: extra flags, see &enum iwl_wowlan_flags
405  * @sta_id: station ID for wowlan.
406  * @reserved: reserved
407  */
408 struct iwl_wowlan_config_cmd {
409 	__le32 wakeup_filter;
410 	u8 wowlan_ba_teardown_tids;
411 	u8 is_11n_connection;
412 	u8 offloading_tid;
413 	u8 flags;
414 	u8 sta_id;
415 	u8 reserved[3];
416 } __packed; /* WOWLAN_CONFIG_API_S_VER_7 */
417 
418 #define IWL_NUM_RSC	16
419 #define WOWLAN_KEY_MAX_SIZE	32
420 #define WOWLAN_GTK_KEYS_NUM     2
421 #define WOWLAN_IGTK_KEYS_NUM	2
422 #define WOWLAN_IGTK_MIN_INDEX	4
423 #define WOWLAN_BIGTK_KEYS_NUM	2
424 #define WOWLAN_BIGTK_MIN_INDEX	6
425 
426 /*
427  * WOWLAN_TSC_RSC_PARAMS
428  */
429 struct tkip_sc {
430 	__le16 iv16;
431 	__le16 pad;
432 	__le32 iv32;
433 } __packed; /* TKIP_SC_API_U_VER_1 */
434 
435 struct iwl_tkip_rsc_tsc {
436 	struct tkip_sc unicast_rsc[IWL_NUM_RSC];
437 	struct tkip_sc multicast_rsc[IWL_NUM_RSC];
438 	struct tkip_sc tsc;
439 } __packed; /* TKIP_TSC_RSC_API_S_VER_1 */
440 
441 struct aes_sc {
442 	__le64 pn;
443 } __packed; /* TKIP_AES_SC_API_U_VER_1 */
444 
445 struct iwl_aes_rsc_tsc {
446 	struct aes_sc unicast_rsc[IWL_NUM_RSC];
447 	struct aes_sc multicast_rsc[IWL_NUM_RSC];
448 	struct aes_sc tsc;
449 } __packed; /* AES_TSC_RSC_API_S_VER_1 */
450 
451 union iwl_all_tsc_rsc {
452 	struct iwl_tkip_rsc_tsc tkip;
453 	struct iwl_aes_rsc_tsc aes;
454 }; /* ALL_TSC_RSC_API_S_VER_2 */
455 
456 struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 {
457 	union iwl_all_tsc_rsc all_tsc_rsc;
458 } __packed; /* ALL_TSC_RSC_API_S_VER_2 */
459 
460 struct iwl_wowlan_rsc_tsc_params_cmd {
461 	__le64 ucast_rsc[IWL_MAX_TID_COUNT];
462 	__le64 mcast_rsc[WOWLAN_GTK_KEYS_NUM][IWL_MAX_TID_COUNT];
463 	__le32 sta_id;
464 #define IWL_MCAST_KEY_MAP_INVALID	0xff
465 	u8 mcast_key_id_map[4];
466 } __packed; /* ALL_TSC_RSC_API_S_VER_5 */
467 
468 #define IWL_MIC_KEY_SIZE	8
469 struct iwl_mic_keys {
470 	u8 tx[IWL_MIC_KEY_SIZE];
471 	u8 rx_unicast[IWL_MIC_KEY_SIZE];
472 	u8 rx_mcast[IWL_MIC_KEY_SIZE];
473 } __packed; /* MIC_KEYS_API_S_VER_1 */
474 
475 #define IWL_P1K_SIZE		5
476 struct iwl_p1k_cache {
477 	__le16 p1k[IWL_P1K_SIZE];
478 } __packed;
479 
480 #define IWL_NUM_RX_P1K_CACHE	2
481 
482 struct iwl_wowlan_tkip_params_cmd_ver_1 {
483 	struct iwl_mic_keys mic_keys;
484 	struct iwl_p1k_cache tx;
485 	struct iwl_p1k_cache rx_uni[IWL_NUM_RX_P1K_CACHE];
486 	struct iwl_p1k_cache rx_multi[IWL_NUM_RX_P1K_CACHE];
487 } __packed; /* WOWLAN_TKIP_SETTING_API_S_VER_1 */
488 
489 struct iwl_wowlan_tkip_params_cmd {
490 	struct iwl_mic_keys mic_keys;
491 	struct iwl_p1k_cache tx;
492 	struct iwl_p1k_cache rx_uni[IWL_NUM_RX_P1K_CACHE];
493 	struct iwl_p1k_cache rx_multi[IWL_NUM_RX_P1K_CACHE];
494 	u8     reversed[2];
495 	__le32 sta_id;
496 } __packed; /* WOWLAN_TKIP_SETTING_API_S_VER_2 */
497 
498 #define IWL_KCK_MAX_SIZE	32
499 #define IWL_KEK_MAX_SIZE	32
500 
501 struct iwl_wowlan_kek_kck_material_cmd_v2 {
502 	u8	kck[IWL_KCK_MAX_SIZE];
503 	u8	kek[IWL_KEK_MAX_SIZE];
504 	__le16	kck_len;
505 	__le16	kek_len;
506 	__le64	replay_ctr;
507 } __packed; /* KEK_KCK_MATERIAL_API_S_VER_2 */
508 
509 struct iwl_wowlan_kek_kck_material_cmd_v3 {
510 	u8	kck[IWL_KCK_MAX_SIZE];
511 	u8	kek[IWL_KEK_MAX_SIZE];
512 	__le16	kck_len;
513 	__le16	kek_len;
514 	__le64	replay_ctr;
515 	__le32  akm;
516 	__le32  gtk_cipher;
517 	__le32  igtk_cipher;
518 	__le32  bigtk_cipher;
519 } __packed; /* KEK_KCK_MATERIAL_API_S_VER_3 */
520 
521 struct iwl_wowlan_kek_kck_material_cmd_v4 {
522 	__le32  sta_id;
523 	u8	kck[IWL_KCK_MAX_SIZE];
524 	u8	kek[IWL_KEK_MAX_SIZE];
525 	__le16	kck_len;
526 	__le16	kek_len;
527 	__le64	replay_ctr;
528 	__le32  akm;
529 	__le32  gtk_cipher;
530 	__le32  igtk_cipher;
531 	__le32  bigtk_cipher;
532 } __packed; /* KEK_KCK_MATERIAL_API_S_VER_4 */
533 
534 struct iwl_wowlan_get_status_cmd {
535 	__le32  sta_id;
536 } __packed; /* WOWLAN_GET_STATUSES_CMD_API_S_VER_1 */
537 
538 #define RF_KILL_INDICATOR_FOR_WOWLAN	0x87
539 
540 enum iwl_wowlan_rekey_status {
541 	IWL_WOWLAN_REKEY_POST_REKEY = 0,
542 	IWL_WOWLAN_REKEY_WHILE_REKEY = 1,
543 }; /* WOWLAN_REKEY_STATUS_API_E_VER_1 */
544 
545 enum iwl_wowlan_wakeup_reason {
546 	IWL_WOWLAN_WAKEUP_BY_NON_WIRELESS			= 0,
547 	IWL_WOWLAN_WAKEUP_BY_MAGIC_PACKET			= BIT(0),
548 	IWL_WOWLAN_WAKEUP_BY_PATTERN				= BIT(1),
549 	IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_MISSED_BEACON	= BIT(2),
550 	IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_DEAUTH		= BIT(3),
551 	IWL_WOWLAN_WAKEUP_BY_GTK_REKEY_FAILURE			= BIT(4),
552 	IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED			= BIT(5),
553 	IWL_WOWLAN_WAKEUP_BY_UCODE_ERROR			= BIT(6),
554 	IWL_WOWLAN_WAKEUP_BY_EAPOL_REQUEST			= BIT(7),
555 	IWL_WOWLAN_WAKEUP_BY_FOUR_WAY_HANDSHAKE			= BIT(8),
556 	IWL_WOWLAN_WAKEUP_BY_REM_WAKE_LINK_LOSS			= BIT(9),
557 	IWL_WOWLAN_WAKEUP_BY_REM_WAKE_SIGNATURE_TABLE		= BIT(10),
558 	IWL_WOWLAN_WAKEUP_BY_REM_WAKE_TCP_EXTERNAL		= BIT(11),
559 	IWL_WOWLAN_WAKEUP_BY_REM_WAKE_WAKEUP_PACKET		= BIT(12),
560 	IWL_WOWLAN_WAKEUP_BY_IOAC_MAGIC_PACKET			= BIT(13),
561 	IWL_WOWLAN_WAKEUP_BY_D3_WAKEUP_HOST_TIMER		= BIT(14),
562 	IWL_WOWLAN_WAKEUP_BY_RXFRAME_FILTERED_IN		= BIT(15),
563 	IWL_WOWLAN_WAKEUP_BY_BEACON_FILTERED_IN			= BIT(16),
564 	IWL_WAKEUP_BY_11W_UNPROTECTED_DEAUTH_OR_DISASSOC	= BIT(17),
565 	IWL_WAKEUP_BY_PATTERN_IPV4_TCP_SYN			= BIT(18),
566 	IWL_WAKEUP_BY_PATTERN_IPV4_TCP_SYN_WILDCARD		= BIT(19),
567 	IWL_WAKEUP_BY_PATTERN_IPV6_TCP_SYN			= BIT(20),
568 	IWL_WAKEUP_BY_PATTERN_IPV6_TCP_SYN_WILDCARD		= BIT(21),
569 }; /* WOWLAN_WAKE_UP_REASON_API_E_VER_2 */
570 
571 struct iwl_wowlan_gtk_status_v1 {
572 	u8 key_index;
573 	u8 reserved[3];
574 	u8 decrypt_key[16];
575 	u8 tkip_mic_key[8];
576 	struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 rsc;
577 } __packed; /* WOWLAN_GTK_MATERIAL_VER_1 */
578 
579 /**
580  * struct iwl_wowlan_gtk_status_v2 - GTK status
581  * @key: GTK material
582  * @key_len: GTK legth, if set to 0, the key is not available
583  * @key_flags: information about the key:
584  *	bits[0:1]:  key index assigned by the AP
585  *	bits[2:6]:  GTK index of the key in the internal DB
586  *	bit[7]:     Set iff this is the currently used GTK
587  * @reserved: padding
588  * @tkip_mic_key: TKIP RX MIC key
589  * @rsc: TSC RSC counters
590  */
591 struct iwl_wowlan_gtk_status_v2 {
592 	u8 key[WOWLAN_KEY_MAX_SIZE];
593 	u8 key_len;
594 	u8 key_flags;
595 	u8 reserved[2];
596 	u8 tkip_mic_key[8];
597 	struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 rsc;
598 } __packed; /* WOWLAN_GTK_MATERIAL_VER_2 */
599 
600 /**
601  * struct iwl_wowlan_all_rsc_tsc_v5 - key counters
602  * @ucast_rsc: unicast RSC values
603  * @mcast_rsc: multicast RSC values (per key map value)
604  * @sta_id: station ID
605  * @mcast_key_id_map: map of key id to @mcast_rsc entry
606  */
607 struct iwl_wowlan_all_rsc_tsc_v5 {
608 	__le64 ucast_rsc[IWL_MAX_TID_COUNT];
609 	__le64 mcast_rsc[2][IWL_MAX_TID_COUNT];
610 	__le32 sta_id;
611 	u8 mcast_key_id_map[4];
612 } __packed; /* ALL_TSC_RSC_API_S_VER_5 */
613 
614 /**
615  * struct iwl_wowlan_gtk_status_v3 - GTK status
616  * @key: GTK material
617  * @key_len: GTK length, if set to 0, the key is not available
618  * @key_flags: information about the key:
619  *	bits[0:1]:  key index assigned by the AP
620  *	bits[2:6]:  GTK index of the key in the internal DB
621  *	bit[7]:     Set iff this is the currently used GTK
622  * @reserved: padding
623  * @tkip_mic_key: TKIP RX MIC key
624  * @sc: RSC/TSC counters
625  */
626 struct iwl_wowlan_gtk_status_v3 {
627 	u8 key[WOWLAN_KEY_MAX_SIZE];
628 	u8 key_len;
629 	u8 key_flags;
630 	u8 reserved[2];
631 	u8 tkip_mic_key[IWL_MIC_KEY_SIZE];
632 	struct iwl_wowlan_all_rsc_tsc_v5 sc;
633 } __packed; /* WOWLAN_GTK_MATERIAL_VER_3 */
634 
635 #define IWL_WOWLAN_GTK_IDX_MASK		(BIT(0) | BIT(1))
636 #define IWL_WOWLAN_IGTK_BIGTK_IDX_MASK	(BIT(0))
637 
638 /**
639  * struct iwl_wowlan_igtk_status - IGTK status
640  * @key: IGTK material
641  * @ipn: the IGTK packet number (replay counter)
642  * @key_len: IGTK length, if set to 0, the key is not available
643  * @key_flags: information about the key:
644  *	bits[0]: key index assigned by the AP (0: index 4, 1: index 5)
645  *	(0: index 6, 1: index 7 with bigtk)
646  *	bits[1:5]: IGTK index of the key in the internal DB
647  *	bit[6]: Set iff this is the currently used IGTK
648  */
649 struct iwl_wowlan_igtk_status {
650 	u8 key[WOWLAN_KEY_MAX_SIZE];
651 	u8 ipn[6];
652 	u8 key_len;
653 	u8 key_flags;
654 } __packed; /* WOWLAN_IGTK_MATERIAL_VER_1 */
655 
656 /**
657  * struct iwl_wowlan_status_v6 - WoWLAN status
658  * @gtk: GTK data
659  * @replay_ctr: GTK rekey replay counter
660  * @pattern_number: number of the matched pattern
661  * @non_qos_seq_ctr: non-QoS sequence counter to use next
662  * @qos_seq_ctr: QoS sequence counters to use next
663  * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
664  * @num_of_gtk_rekeys: number of GTK rekeys
665  * @transmitted_ndps: number of transmitted neighbor discovery packets
666  * @received_beacons: number of received beacons
667  * @wake_packet_length: wakeup packet length
668  * @wake_packet_bufsize: wakeup packet buffer size
669  * @wake_packet: wakeup packet
670  */
671 struct iwl_wowlan_status_v6 {
672 	struct iwl_wowlan_gtk_status_v1 gtk;
673 	__le64 replay_ctr;
674 	__le16 pattern_number;
675 	__le16 non_qos_seq_ctr;
676 	__le16 qos_seq_ctr[8];
677 	__le32 wakeup_reasons;
678 	__le32 num_of_gtk_rekeys;
679 	__le32 transmitted_ndps;
680 	__le32 received_beacons;
681 	__le32 wake_packet_length;
682 	__le32 wake_packet_bufsize;
683 	u8 wake_packet[]; /* can be truncated from _length to _bufsize */
684 } __packed; /* WOWLAN_STATUSES_API_S_VER_6 */
685 
686 /**
687  * struct iwl_wowlan_status_v7 - WoWLAN status
688  * @gtk: GTK data
689  * @igtk: IGTK data
690  * @replay_ctr: GTK rekey replay counter
691  * @pattern_number: number of the matched pattern
692  * @non_qos_seq_ctr: non-QoS sequence counter to use next
693  * @qos_seq_ctr: QoS sequence counters to use next
694  * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
695  * @num_of_gtk_rekeys: number of GTK rekeys
696  * @transmitted_ndps: number of transmitted neighbor discovery packets
697  * @received_beacons: number of received beacons
698  * @wake_packet_length: wakeup packet length
699  * @wake_packet_bufsize: wakeup packet buffer size
700  * @wake_packet: wakeup packet
701  */
702 struct iwl_wowlan_status_v7 {
703 	struct iwl_wowlan_gtk_status_v2 gtk[WOWLAN_GTK_KEYS_NUM];
704 	struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
705 	__le64 replay_ctr;
706 	__le16 pattern_number;
707 	__le16 non_qos_seq_ctr;
708 	__le16 qos_seq_ctr[8];
709 	__le32 wakeup_reasons;
710 	__le32 num_of_gtk_rekeys;
711 	__le32 transmitted_ndps;
712 	__le32 received_beacons;
713 	__le32 wake_packet_length;
714 	__le32 wake_packet_bufsize;
715 	u8 wake_packet[]; /* can be truncated from _length to _bufsize */
716 } __packed; /* WOWLAN_STATUSES_API_S_VER_7 */
717 
718 /**
719  * struct iwl_wowlan_info_notif_v1 - WoWLAN information notification
720  * @gtk: GTK data
721  * @igtk: IGTK data
722  * @replay_ctr: GTK rekey replay counter
723  * @pattern_number: number of the matched patterns
724  * @reserved1: reserved
725  * @qos_seq_ctr: QoS sequence counters to use next
726  * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
727  * @num_of_gtk_rekeys: number of GTK rekeys
728  * @transmitted_ndps: number of transmitted neighbor discovery packets
729  * @received_beacons: number of received beacons
730  * @wake_packet_length: wakeup packet length
731  * @wake_packet_bufsize: wakeup packet buffer size
732  * @tid_tear_down: bit mask of tids whose BA sessions were closed
733  *	in suspend state
734  * @station_id: station id
735  * @reserved2: reserved
736  */
737 struct iwl_wowlan_info_notif_v1 {
738 	struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM];
739 	struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
740 	__le64 replay_ctr;
741 	__le16 pattern_number;
742 	__le16 reserved1;
743 	__le16 qos_seq_ctr[8];
744 	__le32 wakeup_reasons;
745 	__le32 num_of_gtk_rekeys;
746 	__le32 transmitted_ndps;
747 	__le32 received_beacons;
748 	__le32 wake_packet_length;
749 	__le32 wake_packet_bufsize;
750 	u8 tid_tear_down;
751 	u8 station_id;
752 	u8 reserved2[2];
753 } __packed; /* WOWLAN_INFO_NTFY_API_S_VER_1 */
754 
755 /* MAX MLO keys of non-active links that can arrive in the notification */
756 #define WOWLAN_MAX_MLO_KEYS 18
757 
758 /**
759  * enum iwl_wowlan_mlo_gtk_type - GTK types
760  * @WOWLAN_MLO_GTK_KEY_TYPE_GTK: GTK
761  * @WOWLAN_MLO_GTK_KEY_TYPE_IGTK: IGTK
762  * @WOWLAN_MLO_GTK_KEY_TYPE_BIGTK: BIGTK
763  * @WOWLAN_MLO_GTK_KEY_NUM_TYPES: number of key types
764  */
765 enum iwl_wowlan_mlo_gtk_type {
766 	WOWLAN_MLO_GTK_KEY_TYPE_GTK,
767 	WOWLAN_MLO_GTK_KEY_TYPE_IGTK,
768 	WOWLAN_MLO_GTK_KEY_TYPE_BIGTK,
769 	WOWLAN_MLO_GTK_KEY_NUM_TYPES
770 }; /* WOWLAN_MLO_GTK_KEY_TYPE_API_E_VER_1 */
771 
772 /**
773  * enum iwl_wowlan_mlo_gtk_flag - MLO GTK flags
774  * @WOWLAN_MLO_GTK_FLAG_KEY_LEN_MSK: 0 for len 16, 1 for len 32
775  * @WOWLAN_MLO_GTK_FLAG_KEY_ID_MSK: key id (ranges from 0 to 7)
776  * @WOWLAN_MLO_GTK_FLAG_LINK_ID_MSK: spec link id of the key
777  * @WOWLAN_MLO_GTK_FLAG_KEY_TYPE_MSK: &enum iwl_wowlan_mlo_gtk_type
778  * @WOWLAN_MLO_GTK_FLAG_LAST_KEY_MSK: is this the last given key per
779  *	key-type / link-id - the currently used key
780  */
781 enum iwl_wowlan_mlo_gtk_flag {
782 	WOWLAN_MLO_GTK_FLAG_KEY_LEN_MSK = 0x0001,
783 	WOWLAN_MLO_GTK_FLAG_KEY_ID_MSK = 0x000E,
784 	WOWLAN_MLO_GTK_FLAG_LINK_ID_MSK = 0x00F0,
785 	WOWLAN_MLO_GTK_FLAG_KEY_TYPE_MSK = 0x0300,
786 	WOWLAN_MLO_GTK_FLAG_LAST_KEY_MSK = 0x0400
787 }; /* WOWLAN_MLO_GTK_FLAG_API_E_VER_1 */
788 
789 /**
790  * struct iwl_wowlan_mlo_gtk - MLO GTK info
791  * @key: key material
792  * @flags: &enum iwl_wowlan_mlo_gtk_flag
793  * @pn: packet number
794  */
795 struct iwl_wowlan_mlo_gtk {
796 	u8 key[WOWLAN_KEY_MAX_SIZE];
797 	__le16 flags;
798 	u8 pn[6];
799 } __packed; /* WOWLAN_MLO_GTK_KEY_API_S_VER_1 */
800 
801 /**
802  * struct iwl_wowlan_info_notif_v3 - WoWLAN information notification
803  * @gtk: GTK data
804  * @igtk: IGTK data
805  * @bigtk: BIGTK data
806  * @replay_ctr: GTK rekey replay counter
807  * @pattern_number: number of the matched patterns
808  * @reserved1: reserved
809  * @qos_seq_ctr: QoS sequence counters to use next
810  * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
811  * @num_of_gtk_rekeys: number of GTK rekeys
812  * @transmitted_ndps: number of transmitted neighbor discovery packets
813  * @received_beacons: number of received beacons
814  * @tid_tear_down: bit mask of tids whose BA sessions were closed
815  *	in suspend state
816  * @station_id: station id
817  * @reserved2: reserved
818  */
819 struct iwl_wowlan_info_notif_v3 {
820 	struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM];
821 	struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
822 	struct iwl_wowlan_igtk_status bigtk[WOWLAN_BIGTK_KEYS_NUM];
823 	__le64 replay_ctr;
824 	__le16 pattern_number;
825 	__le16 reserved1;
826 	__le16 qos_seq_ctr[8];
827 	__le32 wakeup_reasons;
828 	__le32 num_of_gtk_rekeys;
829 	__le32 transmitted_ndps;
830 	__le32 received_beacons;
831 	u8 tid_tear_down;
832 	u8 station_id;
833 	u8 reserved2[2];
834 } __packed; /* WOWLAN_INFO_NTFY_API_S_VER_3 */
835 
836 /**
837  * struct iwl_wowlan_info_notif - WoWLAN information notification
838  * @gtk: GTK data
839  * @igtk: IGTK data
840  * @bigtk: BIGTK data
841  * @replay_ctr: GTK rekey replay counter
842  * @pattern_number: number of the matched patterns
843  * @qos_seq_ctr: QoS sequence counters to use next
844  * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
845  * @num_of_gtk_rekeys: number of GTK rekeys
846  * @transmitted_ndps: number of transmitted neighbor discovery packets
847  * @received_beacons: number of received beacons
848  * @tid_tear_down: bit mask of tids whose BA sessions were closed
849  *	in suspend state
850  * @station_id: station id
851  * @num_mlo_link_keys: number of &struct iwl_wowlan_mlo_gtk structs
852  *	following this notif
853  * @tid_offloaded_tx: tid used by the firmware to transmit data packets
854  *	while in wowlan
855  * @mlo_gtks: array of GTKs of size num_mlo_link_keys
856  */
857 struct iwl_wowlan_info_notif {
858 	struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM];
859 	struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
860 	struct iwl_wowlan_igtk_status bigtk[WOWLAN_BIGTK_KEYS_NUM];
861 	__le64 replay_ctr;
862 	__le16 pattern_number;
863 	__le16 qos_seq_ctr;
864 	__le32 wakeup_reasons;
865 	__le32 num_of_gtk_rekeys;
866 	__le32 transmitted_ndps;
867 	__le32 received_beacons;
868 	u8 tid_tear_down;
869 	u8 station_id;
870 	u8 num_mlo_link_keys;
871 	u8 tid_offloaded_tx;
872 	struct iwl_wowlan_mlo_gtk mlo_gtks[];
873 } __packed; /* WOWLAN_INFO_NTFY_API_S_VER_5 */
874 
875 /**
876  * struct iwl_wowlan_wake_pkt_notif - WoWLAN wake packet notification
877  * @wake_packet_length: wakeup packet length
878  * @station_id: station id
879  * @reserved: unused
880  * @wake_packet: wakeup packet
881  */
882 struct iwl_wowlan_wake_pkt_notif {
883 	__le32 wake_packet_length;
884 	u8 station_id;
885 	u8 reserved[3];
886 	u8 wake_packet[1];
887 } __packed; /* WOWLAN_WAKE_PKT_NTFY_API_S_VER_1 */
888 
889 /**
890  * struct iwl_mvm_d3_end_notif -  d3 end notification
891  * @flags: See &enum iwl_d0i3_flags
892  */
893 struct iwl_d3_end_notif {
894 	__le32 flags;
895 } __packed;
896 
897 /* TODO: NetDetect API */
898 
899 #endif /* __iwl_fw_api_d3_h__ */
900