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