xref: /openbmc/linux/drivers/net/wireless/intel/iwlwifi/fw/api/d3.h (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
18e99ea8dSJohannes Berg /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
28e99ea8dSJohannes Berg /*
34da46a06SHaim Dreyfuss  * Copyright (C) 2012-2014, 2018-2023 Intel Corporation
48e99ea8dSJohannes Berg  * Copyright (C) 2013-2014 Intel Mobile Communications GmbH
58e99ea8dSJohannes Berg  * Copyright (C) 2015-2017 Intel Deutschland GmbH
68e99ea8dSJohannes Berg  */
7d172a5efSJohannes Berg #ifndef __iwl_fw_api_d3_h__
8d172a5efSJohannes Berg #define __iwl_fw_api_d3_h__
979e561f0SJohannes Berg #include <iwl-trans.h>
10d172a5efSJohannes Berg 
11d172a5efSJohannes Berg /**
12d3b4dc01SHaim Dreyfuss  * enum iwl_d0i3_flags - d0i3 flags
13d3b4dc01SHaim Dreyfuss  * @IWL_D0I3_RESET_REQUIRE: FW require reset upon resume
14d3b4dc01SHaim Dreyfuss  */
15d3b4dc01SHaim Dreyfuss enum iwl_d0i3_flags {
16d3b4dc01SHaim Dreyfuss 	IWL_D0I3_RESET_REQUIRE = BIT(0),
17d3b4dc01SHaim Dreyfuss };
18d3b4dc01SHaim Dreyfuss 
19d3b4dc01SHaim Dreyfuss /**
20d172a5efSJohannes Berg  * enum iwl_d3_wakeup_flags - D3 manager wakeup flags
21d172a5efSJohannes Berg  * @IWL_WAKEUP_D3_CONFIG_FW_ERROR: wake up on firmware sysassert
22d172a5efSJohannes Berg  */
23d172a5efSJohannes Berg enum iwl_d3_wakeup_flags {
24d172a5efSJohannes Berg 	IWL_WAKEUP_D3_CONFIG_FW_ERROR = BIT(0),
25d172a5efSJohannes Berg }; /* D3_MANAGER_WAKEUP_CONFIG_API_E_VER_3 */
26d172a5efSJohannes Berg 
27d172a5efSJohannes Berg /**
28d172a5efSJohannes Berg  * struct iwl_d3_manager_config - D3 manager configuration command
29d172a5efSJohannes Berg  * @min_sleep_time: minimum sleep time (in usec)
30d172a5efSJohannes Berg  * @wakeup_flags: wakeup flags, see &enum iwl_d3_wakeup_flags
31d172a5efSJohannes Berg  * @wakeup_host_timer: force wakeup after this many seconds
32d172a5efSJohannes Berg  *
33d172a5efSJohannes Berg  * The structure is used for the D3_CONFIG_CMD command.
34d172a5efSJohannes Berg  */
35d172a5efSJohannes Berg struct iwl_d3_manager_config {
36d172a5efSJohannes Berg 	__le32 min_sleep_time;
37d172a5efSJohannes Berg 	__le32 wakeup_flags;
38d172a5efSJohannes Berg 	__le32 wakeup_host_timer;
39d172a5efSJohannes Berg } __packed; /* D3_MANAGER_CONFIG_CMD_S_VER_4 */
40d172a5efSJohannes Berg 
41d172a5efSJohannes Berg 
42d172a5efSJohannes Berg /* TODO: OFFLOADS_QUERY_API_S_VER_1 */
43d172a5efSJohannes Berg 
44d172a5efSJohannes Berg /**
45d172a5efSJohannes Berg  * enum iwl_d3_proto_offloads - enabled protocol offloads
46d172a5efSJohannes Berg  * @IWL_D3_PROTO_OFFLOAD_ARP: ARP data is enabled
47d172a5efSJohannes Berg  * @IWL_D3_PROTO_OFFLOAD_NS: NS (Neighbor Solicitation) is enabled
48d172a5efSJohannes Berg  * @IWL_D3_PROTO_IPV4_VALID: IPv4 data is valid
49d172a5efSJohannes Berg  * @IWL_D3_PROTO_IPV6_VALID: IPv6 data is valid
50d172a5efSJohannes Berg  * @IWL_D3_PROTO_OFFLOAD_BTM: BTM offload is enabled
51d172a5efSJohannes Berg  */
52d172a5efSJohannes Berg enum iwl_proto_offloads {
53d172a5efSJohannes Berg 	IWL_D3_PROTO_OFFLOAD_ARP = BIT(0),
54d172a5efSJohannes Berg 	IWL_D3_PROTO_OFFLOAD_NS = BIT(1),
55d172a5efSJohannes Berg 	IWL_D3_PROTO_IPV4_VALID = BIT(2),
56d172a5efSJohannes Berg 	IWL_D3_PROTO_IPV6_VALID = BIT(3),
57d172a5efSJohannes Berg 	IWL_D3_PROTO_OFFLOAD_BTM = BIT(4),
58d172a5efSJohannes Berg };
59d172a5efSJohannes Berg 
60d172a5efSJohannes Berg #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V1	2
61d172a5efSJohannes Berg #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V2	6
62d172a5efSJohannes Berg #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L	12
63d172a5efSJohannes Berg #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3S	4
64d172a5efSJohannes Berg #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX	12
65d172a5efSJohannes Berg 
66d172a5efSJohannes Berg #define IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L	4
67d172a5efSJohannes Berg #define IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3S	2
68d172a5efSJohannes Berg 
69d172a5efSJohannes Berg /**
70d172a5efSJohannes Berg  * struct iwl_proto_offload_cmd_common - ARP/NS offload common part
71d172a5efSJohannes Berg  * @enabled: enable flags
72d172a5efSJohannes Berg  * @remote_ipv4_addr: remote address to answer to (or zero if all)
73d172a5efSJohannes Berg  * @host_ipv4_addr: our IPv4 address to respond to queries for
74d172a5efSJohannes Berg  * @arp_mac_addr: our MAC address for ARP responses
75d172a5efSJohannes Berg  * @reserved: unused
76d172a5efSJohannes Berg  */
77d172a5efSJohannes Berg struct iwl_proto_offload_cmd_common {
78d172a5efSJohannes Berg 	__le32 enabled;
79d172a5efSJohannes Berg 	__be32 remote_ipv4_addr;
80d172a5efSJohannes Berg 	__be32 host_ipv4_addr;
81d172a5efSJohannes Berg 	u8 arp_mac_addr[ETH_ALEN];
82d172a5efSJohannes Berg 	__le16 reserved;
83d172a5efSJohannes Berg } __packed;
84d172a5efSJohannes Berg 
85d172a5efSJohannes Berg /**
86d172a5efSJohannes Berg  * struct iwl_proto_offload_cmd_v1 - ARP/NS offload configuration
87d172a5efSJohannes Berg  * @common: common/IPv4 configuration
88d172a5efSJohannes Berg  * @remote_ipv6_addr: remote address to answer to (or zero if all)
89d172a5efSJohannes Berg  * @solicited_node_ipv6_addr: broken -- solicited node address exists
90d172a5efSJohannes Berg  *	for each target address
91d172a5efSJohannes Berg  * @target_ipv6_addr: our target addresses
92d172a5efSJohannes Berg  * @ndp_mac_addr: neighbor solicitation response MAC address
93d172a5efSJohannes Berg  * @reserved2: reserved
94d172a5efSJohannes Berg  */
95d172a5efSJohannes Berg struct iwl_proto_offload_cmd_v1 {
96d172a5efSJohannes Berg 	struct iwl_proto_offload_cmd_common common;
97d172a5efSJohannes Berg 	u8 remote_ipv6_addr[16];
98d172a5efSJohannes Berg 	u8 solicited_node_ipv6_addr[16];
99d172a5efSJohannes Berg 	u8 target_ipv6_addr[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V1][16];
100d172a5efSJohannes Berg 	u8 ndp_mac_addr[ETH_ALEN];
101d172a5efSJohannes Berg 	__le16 reserved2;
102d172a5efSJohannes Berg } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_1 */
103d172a5efSJohannes Berg 
104d172a5efSJohannes Berg /**
105d172a5efSJohannes Berg  * struct iwl_proto_offload_cmd_v2 - ARP/NS offload configuration
106d172a5efSJohannes Berg  * @common: common/IPv4 configuration
107d172a5efSJohannes Berg  * @remote_ipv6_addr: remote address to answer to (or zero if all)
108d172a5efSJohannes Berg  * @solicited_node_ipv6_addr: broken -- solicited node address exists
109d172a5efSJohannes Berg  *	for each target address
110d172a5efSJohannes Berg  * @target_ipv6_addr: our target addresses
111d172a5efSJohannes Berg  * @ndp_mac_addr: neighbor solicitation response MAC address
112d172a5efSJohannes Berg  * @num_valid_ipv6_addrs: number of valid IPv6 addresses
113d172a5efSJohannes Berg  * @reserved2: reserved
114d172a5efSJohannes Berg  */
115d172a5efSJohannes Berg struct iwl_proto_offload_cmd_v2 {
116d172a5efSJohannes Berg 	struct iwl_proto_offload_cmd_common common;
117d172a5efSJohannes Berg 	u8 remote_ipv6_addr[16];
118d172a5efSJohannes Berg 	u8 solicited_node_ipv6_addr[16];
119d172a5efSJohannes Berg 	u8 target_ipv6_addr[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V2][16];
120d172a5efSJohannes Berg 	u8 ndp_mac_addr[ETH_ALEN];
121d172a5efSJohannes Berg 	u8 num_valid_ipv6_addrs;
122d172a5efSJohannes Berg 	u8 reserved2[3];
123d172a5efSJohannes Berg } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_2 */
124d172a5efSJohannes Berg 
125d172a5efSJohannes Berg struct iwl_ns_config {
126d172a5efSJohannes Berg 	struct in6_addr source_ipv6_addr;
127d172a5efSJohannes Berg 	struct in6_addr dest_ipv6_addr;
128d172a5efSJohannes Berg 	u8 target_mac_addr[ETH_ALEN];
129d172a5efSJohannes Berg 	__le16 reserved;
130d172a5efSJohannes Berg } __packed; /* NS_OFFLOAD_CONFIG */
131d172a5efSJohannes Berg 
132d172a5efSJohannes Berg struct iwl_targ_addr {
133d172a5efSJohannes Berg 	struct in6_addr addr;
134d172a5efSJohannes Berg 	__le32 config_num;
135d172a5efSJohannes Berg } __packed; /* TARGET_IPV6_ADDRESS */
136d172a5efSJohannes Berg 
137d172a5efSJohannes Berg /**
138d172a5efSJohannes Berg  * struct iwl_proto_offload_cmd_v3_small - ARP/NS offload configuration
139d172a5efSJohannes Berg  * @common: common/IPv4 configuration
140d172a5efSJohannes Berg  * @num_valid_ipv6_addrs: number of valid IPv6 addresses
141d172a5efSJohannes Berg  * @targ_addrs: target IPv6 addresses
142d172a5efSJohannes Berg  * @ns_config: NS offload configurations
143d172a5efSJohannes Berg  */
144d172a5efSJohannes Berg struct iwl_proto_offload_cmd_v3_small {
145d172a5efSJohannes Berg 	struct iwl_proto_offload_cmd_common common;
146d172a5efSJohannes Berg 	__le32 num_valid_ipv6_addrs;
147d172a5efSJohannes Berg 	struct iwl_targ_addr targ_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3S];
148d172a5efSJohannes Berg 	struct iwl_ns_config ns_config[IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3S];
149d172a5efSJohannes Berg } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_3 */
150d172a5efSJohannes Berg 
151d172a5efSJohannes Berg /**
152d172a5efSJohannes Berg  * struct iwl_proto_offload_cmd_v3_large - ARP/NS offload configuration
153d172a5efSJohannes Berg  * @common: common/IPv4 configuration
154d172a5efSJohannes Berg  * @num_valid_ipv6_addrs: number of valid IPv6 addresses
155d172a5efSJohannes Berg  * @targ_addrs: target IPv6 addresses
156d172a5efSJohannes Berg  * @ns_config: NS offload configurations
157d172a5efSJohannes Berg  */
158d172a5efSJohannes Berg struct iwl_proto_offload_cmd_v3_large {
159d172a5efSJohannes Berg 	struct iwl_proto_offload_cmd_common common;
160d172a5efSJohannes Berg 	__le32 num_valid_ipv6_addrs;
161d172a5efSJohannes Berg 	struct iwl_targ_addr targ_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L];
162d172a5efSJohannes Berg 	struct iwl_ns_config ns_config[IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L];
163b60bc716SEmmanuel Grumbach } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_3 */
164b60bc716SEmmanuel Grumbach 
165b60bc716SEmmanuel Grumbach /**
166b60bc716SEmmanuel Grumbach  * struct iwl_proto_offload_cmd_v4 - ARP/NS offload configuration
167b60bc716SEmmanuel Grumbach  * @sta_id: station id
168b60bc716SEmmanuel Grumbach  * @common: common/IPv4 configuration
169b60bc716SEmmanuel Grumbach  * @num_valid_ipv6_addrs: number of valid IPv6 addresses
170b60bc716SEmmanuel Grumbach  * @targ_addrs: target IPv6 addresses
171b60bc716SEmmanuel Grumbach  * @ns_config: NS offload configurations
172b60bc716SEmmanuel Grumbach  */
173b60bc716SEmmanuel Grumbach struct iwl_proto_offload_cmd_v4 {
174b60bc716SEmmanuel Grumbach 	__le32 sta_id;
175b60bc716SEmmanuel Grumbach 	struct iwl_proto_offload_cmd_common common;
176b60bc716SEmmanuel Grumbach 	__le32 num_valid_ipv6_addrs;
177b60bc716SEmmanuel Grumbach 	struct iwl_targ_addr targ_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L];
178b60bc716SEmmanuel Grumbach 	struct iwl_ns_config ns_config[IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L];
179d172a5efSJohannes Berg } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_4 */
180d172a5efSJohannes Berg 
181d172a5efSJohannes Berg /*
182d172a5efSJohannes Berg  * WOWLAN_PATTERNS
183d172a5efSJohannes Berg  */
184d172a5efSJohannes Berg #define IWL_WOWLAN_MIN_PATTERN_LEN	16
1850c546fb6SLuca Coelho #define IWL_WOWLAN_MAX_PATTERN_LEN	128
186d172a5efSJohannes Berg 
187d172a5efSJohannes Berg struct iwl_wowlan_pattern_v1 {
188d172a5efSJohannes Berg 	u8 mask[IWL_WOWLAN_MAX_PATTERN_LEN / 8];
189d172a5efSJohannes Berg 	u8 pattern[IWL_WOWLAN_MAX_PATTERN_LEN];
190d172a5efSJohannes Berg 	u8 mask_size;
191d172a5efSJohannes Berg 	u8 pattern_size;
192d172a5efSJohannes Berg 	__le16 reserved;
193d172a5efSJohannes Berg } __packed; /* WOWLAN_PATTERN_API_S_VER_1 */
194d172a5efSJohannes Berg 
195ec95b270SJohannes Berg #define IWL_WOWLAN_MAX_PATTERNS	20
196ec95b270SJohannes Berg 
197ec95b270SJohannes Berg /**
1980c546fb6SLuca Coelho  * struct iwl_wowlan_patterns_cmd - WoWLAN wakeup patterns
1990c546fb6SLuca Coelho  */
2000c546fb6SLuca Coelho struct iwl_wowlan_patterns_cmd_v1 {
2010c546fb6SLuca Coelho 	/**
2020c546fb6SLuca Coelho 	 * @n_patterns: number of patterns
2030c546fb6SLuca Coelho 	 */
2040c546fb6SLuca Coelho 	__le32 n_patterns;
2050c546fb6SLuca Coelho 
2060c546fb6SLuca Coelho 	/**
2070c546fb6SLuca Coelho 	 * @patterns: the patterns, array length in @n_patterns
2080c546fb6SLuca Coelho 	 */
2090c546fb6SLuca Coelho 	struct iwl_wowlan_pattern_v1 patterns[];
2100c546fb6SLuca Coelho } __packed; /* WOWLAN_PATTERN_ARRAY_API_S_VER_1 */
2110c546fb6SLuca Coelho 
2120c546fb6SLuca Coelho #define IPV4_ADDR_SIZE	4
2130c546fb6SLuca Coelho #define IPV6_ADDR_SIZE	16
2140c546fb6SLuca Coelho 
2150c546fb6SLuca Coelho enum iwl_wowlan_pattern_type {
2160c546fb6SLuca Coelho 	WOWLAN_PATTERN_TYPE_BITMASK,
2170c546fb6SLuca Coelho 	WOWLAN_PATTERN_TYPE_IPV4_TCP_SYN,
2180c546fb6SLuca Coelho 	WOWLAN_PATTERN_TYPE_IPV6_TCP_SYN,
2190c546fb6SLuca Coelho 	WOWLAN_PATTERN_TYPE_IPV4_TCP_SYN_WILDCARD,
2200c546fb6SLuca Coelho 	WOWLAN_PATTERN_TYPE_IPV6_TCP_SYN_WILDCARD,
2210c546fb6SLuca Coelho }; /* WOWLAN_PATTERN_TYPE_API_E_VER_1 */
2220c546fb6SLuca Coelho 
2230c546fb6SLuca Coelho /**
2240c546fb6SLuca Coelho  * struct iwl_wowlan_ipv4_tcp_syn - WoWLAN IPv4 TCP SYN pattern data
2250c546fb6SLuca Coelho  */
2260c546fb6SLuca Coelho struct iwl_wowlan_ipv4_tcp_syn {
2270c546fb6SLuca Coelho 	/**
2280c546fb6SLuca Coelho 	 * @src_addr: source IP address to match
2290c546fb6SLuca Coelho 	 */
2300c546fb6SLuca Coelho 	u8 src_addr[IPV4_ADDR_SIZE];
2310c546fb6SLuca Coelho 
2320c546fb6SLuca Coelho 	/**
2330c546fb6SLuca Coelho 	 * @dst_addr: destination IP address to match
2340c546fb6SLuca Coelho 	 */
2350c546fb6SLuca Coelho 	u8 dst_addr[IPV4_ADDR_SIZE];
2360c546fb6SLuca Coelho 
2370c546fb6SLuca Coelho 	/**
2380c546fb6SLuca Coelho 	 * @src_port: source TCP port to match
2390c546fb6SLuca Coelho 	 */
2400c546fb6SLuca Coelho 	__le16 src_port;
2410c546fb6SLuca Coelho 
2420c546fb6SLuca Coelho 	/**
2430c546fb6SLuca Coelho 	 * @dst_port: destination TCP port to match
2440c546fb6SLuca Coelho 	 */
2450c546fb6SLuca Coelho 	__le16 dst_port;
2460c546fb6SLuca Coelho } __packed; /* WOWLAN_IPV4_TCP_SYN_API_S_VER_1 */
2470c546fb6SLuca Coelho 
2480c546fb6SLuca Coelho /**
2490c546fb6SLuca Coelho  * struct iwl_wowlan_ipv6_tcp_syn - WoWLAN Ipv6 TCP SYN pattern data
2500c546fb6SLuca Coelho  */
2510c546fb6SLuca Coelho struct iwl_wowlan_ipv6_tcp_syn {
2520c546fb6SLuca Coelho 	/**
2530c546fb6SLuca Coelho 	 * @src_addr: source IP address to match
2540c546fb6SLuca Coelho 	 */
2550c546fb6SLuca Coelho 	u8 src_addr[IPV6_ADDR_SIZE];
2560c546fb6SLuca Coelho 
2570c546fb6SLuca Coelho 	/**
2580c546fb6SLuca Coelho 	 * @dst_addr: destination IP address to match
2590c546fb6SLuca Coelho 	 */
2600c546fb6SLuca Coelho 	u8 dst_addr[IPV6_ADDR_SIZE];
2610c546fb6SLuca Coelho 
2620c546fb6SLuca Coelho 	/**
2630c546fb6SLuca Coelho 	 * @src_port: source TCP port to match
2640c546fb6SLuca Coelho 	 */
2650c546fb6SLuca Coelho 	__le16 src_port;
2660c546fb6SLuca Coelho 
2670c546fb6SLuca Coelho 	/**
2680c546fb6SLuca Coelho 	 * @dst_port: destination TCP port to match
2690c546fb6SLuca Coelho 	 */
2700c546fb6SLuca Coelho 	__le16 dst_port;
2710c546fb6SLuca Coelho } __packed; /* WOWLAN_IPV6_TCP_SYN_API_S_VER_1 */
2720c546fb6SLuca Coelho 
2730c546fb6SLuca Coelho /**
2740c546fb6SLuca Coelho  * union iwl_wowlan_pattern_data - Data for the different pattern types
2750c546fb6SLuca Coelho  *
2760c546fb6SLuca Coelho  * If wildcard addresses/ports are to be used, the union can be left
2770c546fb6SLuca Coelho  * undefined.
2780c546fb6SLuca Coelho  */
2790c546fb6SLuca Coelho union iwl_wowlan_pattern_data {
2800c546fb6SLuca Coelho 	/**
2810c546fb6SLuca Coelho 	 * @bitmask: bitmask pattern data
2820c546fb6SLuca Coelho 	 */
2830c546fb6SLuca Coelho 	struct iwl_wowlan_pattern_v1 bitmask;
2840c546fb6SLuca Coelho 
2850c546fb6SLuca Coelho 	/**
2860c546fb6SLuca Coelho 	 * @ipv4_tcp_syn: IPv4 TCP SYN pattern data
2870c546fb6SLuca Coelho 	 */
2880c546fb6SLuca Coelho 	struct iwl_wowlan_ipv4_tcp_syn ipv4_tcp_syn;
2890c546fb6SLuca Coelho 
2900c546fb6SLuca Coelho 	/**
2910c546fb6SLuca Coelho 	 * @ipv6_tcp_syn: IPv6 TCP SYN pattern data
2920c546fb6SLuca Coelho 	 */
2930c546fb6SLuca Coelho 	struct iwl_wowlan_ipv6_tcp_syn ipv6_tcp_syn;
2940c546fb6SLuca Coelho }; /* WOWLAN_PATTERN_API_U_VER_1 */
2950c546fb6SLuca Coelho 
2960c546fb6SLuca Coelho /**
2970c546fb6SLuca Coelho  * struct iwl_wowlan_pattern_v2 - Pattern entry for the WoWLAN wakeup patterns
2980c546fb6SLuca Coelho  */
2990c546fb6SLuca Coelho struct iwl_wowlan_pattern_v2 {
3000c546fb6SLuca Coelho 	/**
3010c546fb6SLuca Coelho 	 * @pattern_type: defines the struct type to be used in the union
3020c546fb6SLuca Coelho 	 */
3030c546fb6SLuca Coelho 	u8 pattern_type;
3040c546fb6SLuca Coelho 
3050c546fb6SLuca Coelho 	/**
3060c546fb6SLuca Coelho 	 * @reserved: reserved for alignment
3070c546fb6SLuca Coelho 	 */
3080c546fb6SLuca Coelho 	u8 reserved[3];
3090c546fb6SLuca Coelho 
3100c546fb6SLuca Coelho 	/**
3110c546fb6SLuca Coelho 	 * @u: the union containing the match data, or undefined for
3120c546fb6SLuca Coelho 	 *     wildcard matches
3130c546fb6SLuca Coelho 	 */
3140c546fb6SLuca Coelho 	union iwl_wowlan_pattern_data u;
3150c546fb6SLuca Coelho } __packed; /* WOWLAN_PATTERN_API_S_VER_2 */
3160c546fb6SLuca Coelho 
3170c546fb6SLuca Coelho /**
318d172a5efSJohannes Berg  * struct iwl_wowlan_patterns_cmd - WoWLAN wakeup patterns command
319ec95b270SJohannes Berg  */
320ec95b270SJohannes Berg struct iwl_wowlan_patterns_cmd {
321ec95b270SJohannes Berg 	/**
3220b35991aSEmmanuel Grumbach 	 * @n_patterns: number of patterns
3230b35991aSEmmanuel Grumbach 	 */
3240b35991aSEmmanuel Grumbach 	u8 n_patterns;
3250b35991aSEmmanuel Grumbach 
3260b35991aSEmmanuel Grumbach 	/**
3270b35991aSEmmanuel Grumbach 	 * @n_patterns: sta_id
3280b35991aSEmmanuel Grumbach 	 */
3290b35991aSEmmanuel Grumbach 	u8 sta_id;
3300b35991aSEmmanuel Grumbach 
3310b35991aSEmmanuel Grumbach 	/**
3320b35991aSEmmanuel Grumbach 	 * @reserved: reserved for alignment
333ec95b270SJohannes Berg 	 */
334ec95b270SJohannes Berg 	__le16 reserved;
335ec95b270SJohannes Berg 
336ec95b270SJohannes Berg 	/**
3370c546fb6SLuca Coelho 	 * @patterns: the patterns, array length in @n_patterns
3380b35991aSEmmanuel Grumbach 	 */
339d172a5efSJohannes Berg 	struct iwl_wowlan_pattern_v2 patterns[];
340d172a5efSJohannes Berg } __packed; /* WOWLAN_PATTERN_ARRAY_API_S_VER_3 */
341d172a5efSJohannes Berg 
342d172a5efSJohannes Berg enum iwl_wowlan_wakeup_filters {
343d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_MAGIC_PACKET			= BIT(0),
344d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_PATTERN_MATCH			= BIT(1),
345d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BEACON_MISS			= BIT(2),
346d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_LINK_CHANGE			= BIT(3),
347d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_GTK_REKEY_FAIL		= BIT(4),
348d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_EAP_IDENT_REQ			= BIT(5),
349d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_4WAY_HANDSHAKE		= BIT(6),
350d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_ENABLE_NET_DETECT		= BIT(7),
351d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_RF_KILL_DEASSERT		= BIT(8),
352d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_REMOTE_LINK_LOSS		= BIT(9),
353d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_REMOTE_SIGNATURE_TABLE	= BIT(10),
354d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_REMOTE_TCP_EXTERNAL		= BIT(11),
355d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_REMOTE_WAKEUP_PACKET		= BIT(12),
356d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_IOAC_MAGIC_PACKET		= BIT(13),
357d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_HOST_TIMER			= BIT(14),
358d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_RX_FRAME			= BIT(15),
359d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BCN_FILTERING			= BIT(16),
360d172a5efSJohannes Berg }; /* WOWLAN_WAKEUP_FILTER_API_E_VER_4 */
361d172a5efSJohannes Berg 
362d172a5efSJohannes Berg enum iwl_wowlan_flags {
363d172a5efSJohannes Berg 	IS_11W_ASSOC		= BIT(0),
364d172a5efSJohannes Berg 	ENABLE_L3_FILTERING	= BIT(1),
365d172a5efSJohannes Berg 	ENABLE_NBNS_FILTERING	= BIT(2),
366d172a5efSJohannes Berg 	ENABLE_DHCP_FILTERING	= BIT(3),
367d172a5efSJohannes Berg 	ENABLE_STORE_BEACON	= BIT(4),
368d172a5efSJohannes Berg };
3695b16565aSNaftali Goldstein 
370d172a5efSJohannes Berg /**
3715b16565aSNaftali Goldstein  * struct iwl_wowlan_config_cmd - WoWLAN configuration (versions 5 and 6)
3725b16565aSNaftali Goldstein  * @wakeup_filter: filter from &enum iwl_wowlan_wakeup_filters
373d172a5efSJohannes Berg  * @non_qos_seq: non-QoS sequence counter to use next.
374d172a5efSJohannes Berg  *               Reserved if the struct has version >= 6.
375d172a5efSJohannes Berg  * @qos_seq: QoS sequence counters to use next
376d172a5efSJohannes Berg  * @wowlan_ba_teardown_tids: bitmap of BA sessions to tear down
377d172a5efSJohannes Berg  * @is_11n_connection: indicates HT connection
378f005fd88SHaim Dreyfuss  * @offloading_tid: TID reserved for firmware use
379d172a5efSJohannes Berg  * @flags: extra flags, see &enum iwl_wowlan_flags
380d172a5efSJohannes Berg  * @sta_id: station ID for wowlan.
381d172a5efSJohannes Berg  * @reserved: reserved
382d172a5efSJohannes Berg  */
383d172a5efSJohannes Berg struct iwl_wowlan_config_cmd {
384d172a5efSJohannes Berg 	__le32 wakeup_filter;
385d172a5efSJohannes Berg 	__le16 non_qos_seq;
386d172a5efSJohannes Berg 	__le16 qos_seq[8];
387d172a5efSJohannes Berg 	u8 wowlan_ba_teardown_tids;
388d172a5efSJohannes Berg 	u8 is_11n_connection;
389f005fd88SHaim Dreyfuss 	u8 offloading_tid;
390f005fd88SHaim Dreyfuss 	u8 flags;
391f005fd88SHaim Dreyfuss 	u8 sta_id;
392d172a5efSJohannes Berg 	u8 reserved;
39379e561f0SJohannes Berg } __packed; /* WOWLAN_CONFIG_API_S_VER_5 */
39479e561f0SJohannes Berg 
39579e561f0SJohannes Berg #define IWL_NUM_RSC	16
39679e561f0SJohannes Berg #define WOWLAN_KEY_MAX_SIZE	32
39779e561f0SJohannes Berg #define WOWLAN_GTK_KEYS_NUM     2
398d172a5efSJohannes Berg #define WOWLAN_IGTK_KEYS_NUM	2
399d172a5efSJohannes Berg #define WOWLAN_IGTK_MIN_INDEX	4
400d172a5efSJohannes Berg 
401d172a5efSJohannes Berg /*
402d172a5efSJohannes Berg  * WOWLAN_TSC_RSC_PARAMS
403d172a5efSJohannes Berg  */
404d172a5efSJohannes Berg struct tkip_sc {
405d172a5efSJohannes Berg 	__le16 iv16;
406d172a5efSJohannes Berg 	__le16 pad;
407d172a5efSJohannes Berg 	__le32 iv32;
408d172a5efSJohannes Berg } __packed; /* TKIP_SC_API_U_VER_1 */
409d172a5efSJohannes Berg 
410d172a5efSJohannes Berg struct iwl_tkip_rsc_tsc {
411d172a5efSJohannes Berg 	struct tkip_sc unicast_rsc[IWL_NUM_RSC];
412d172a5efSJohannes Berg 	struct tkip_sc multicast_rsc[IWL_NUM_RSC];
413d172a5efSJohannes Berg 	struct tkip_sc tsc;
414d172a5efSJohannes Berg } __packed; /* TKIP_TSC_RSC_API_S_VER_1 */
415d172a5efSJohannes Berg 
416d172a5efSJohannes Berg struct aes_sc {
417d172a5efSJohannes Berg 	__le64 pn;
418d172a5efSJohannes Berg } __packed; /* TKIP_AES_SC_API_U_VER_1 */
419d172a5efSJohannes Berg 
420d172a5efSJohannes Berg struct iwl_aes_rsc_tsc {
421d172a5efSJohannes Berg 	struct aes_sc unicast_rsc[IWL_NUM_RSC];
422d172a5efSJohannes Berg 	struct aes_sc multicast_rsc[IWL_NUM_RSC];
423d172a5efSJohannes Berg 	struct aes_sc tsc;
424d172a5efSJohannes Berg } __packed; /* AES_TSC_RSC_API_S_VER_1 */
425d172a5efSJohannes Berg 
426d172a5efSJohannes Berg union iwl_all_tsc_rsc {
427d172a5efSJohannes Berg 	struct iwl_tkip_rsc_tsc tkip;
428ee3ae3a1SDan Halperin 	struct iwl_aes_rsc_tsc aes;
429d172a5efSJohannes Berg }; /* ALL_TSC_RSC_API_S_VER_2 */
430d172a5efSJohannes Berg 
431d172a5efSJohannes Berg struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 {
43279e561f0SJohannes Berg 	union iwl_all_tsc_rsc all_tsc_rsc;
433ee3ae3a1SDan Halperin } __packed; /* ALL_TSC_RSC_API_S_VER_2 */
434ee3ae3a1SDan Halperin 
435ee3ae3a1SDan Halperin struct iwl_wowlan_rsc_tsc_params_cmd_v4 {
436ee3ae3a1SDan Halperin 	struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 params;
43779e561f0SJohannes Berg 	__le32 sta_id;
43879e561f0SJohannes Berg } __packed; /* ALL_TSC_RSC_API_S_VER_4 */
43979e561f0SJohannes Berg 
44079e561f0SJohannes Berg struct iwl_wowlan_rsc_tsc_params_cmd {
44179e561f0SJohannes Berg 	__le64 ucast_rsc[IWL_MAX_TID_COUNT];
44279e561f0SJohannes Berg 	__le64 mcast_rsc[WOWLAN_GTK_KEYS_NUM][IWL_MAX_TID_COUNT];
44379e561f0SJohannes Berg 	__le32 sta_id;
44479e561f0SJohannes Berg #define IWL_MCAST_KEY_MAP_INVALID	0xff
445d172a5efSJohannes Berg 	u8 mcast_key_id_map[4];
446d172a5efSJohannes Berg } __packed; /* ALL_TSC_RSC_API_S_VER_5 */
447d172a5efSJohannes Berg 
448d172a5efSJohannes Berg #define IWL_MIC_KEY_SIZE	8
449d172a5efSJohannes Berg struct iwl_mic_keys {
450d172a5efSJohannes Berg 	u8 tx[IWL_MIC_KEY_SIZE];
451d172a5efSJohannes Berg 	u8 rx_unicast[IWL_MIC_KEY_SIZE];
452d172a5efSJohannes Berg 	u8 rx_mcast[IWL_MIC_KEY_SIZE];
453d172a5efSJohannes Berg } __packed; /* MIC_KEYS_API_S_VER_1 */
454d172a5efSJohannes Berg 
455d172a5efSJohannes Berg #define IWL_P1K_SIZE		5
456d172a5efSJohannes Berg struct iwl_p1k_cache {
457d172a5efSJohannes Berg 	__le16 p1k[IWL_P1K_SIZE];
458d172a5efSJohannes Berg } __packed;
459870bde78SDan Halperin 
460d172a5efSJohannes Berg #define IWL_NUM_RX_P1K_CACHE	2
461d172a5efSJohannes Berg 
462d172a5efSJohannes Berg struct iwl_wowlan_tkip_params_cmd_ver_1 {
463d172a5efSJohannes Berg 	struct iwl_mic_keys mic_keys;
464d172a5efSJohannes Berg 	struct iwl_p1k_cache tx;
465d172a5efSJohannes Berg 	struct iwl_p1k_cache rx_uni[IWL_NUM_RX_P1K_CACHE];
466870bde78SDan Halperin 	struct iwl_p1k_cache rx_multi[IWL_NUM_RX_P1K_CACHE];
467870bde78SDan Halperin } __packed; /* WOWLAN_TKIP_SETTING_API_S_VER_1 */
468870bde78SDan Halperin 
469870bde78SDan Halperin struct iwl_wowlan_tkip_params_cmd {
470870bde78SDan Halperin 	struct iwl_mic_keys mic_keys;
471870bde78SDan Halperin 	struct iwl_p1k_cache tx;
472870bde78SDan Halperin 	struct iwl_p1k_cache rx_uni[IWL_NUM_RX_P1K_CACHE];
473870bde78SDan Halperin 	struct iwl_p1k_cache rx_multi[IWL_NUM_RX_P1K_CACHE];
474870bde78SDan Halperin 	u8     reversed[2];
475d172a5efSJohannes Berg 	__le32 sta_id;
476d172a5efSJohannes Berg } __packed; /* WOWLAN_TKIP_SETTING_API_S_VER_2 */
477d172a5efSJohannes Berg 
4789e3c3936SNathan Errera #define IWL_KCK_MAX_SIZE	32
479d172a5efSJohannes Berg #define IWL_KEK_MAX_SIZE	32
480d172a5efSJohannes Berg 
481d172a5efSJohannes Berg struct iwl_wowlan_kek_kck_material_cmd_v2 {
482d172a5efSJohannes Berg 	u8	kck[IWL_KCK_MAX_SIZE];
483d172a5efSJohannes Berg 	u8	kek[IWL_KEK_MAX_SIZE];
484d172a5efSJohannes Berg 	__le16	kck_len;
485d172a5efSJohannes Berg 	__le16	kek_len;
4869e3c3936SNathan Errera 	__le64	replay_ctr;
4879e3c3936SNathan Errera } __packed; /* KEK_KCK_MATERIAL_API_S_VER_2 */
4889e3c3936SNathan Errera 
4899e3c3936SNathan Errera struct iwl_wowlan_kek_kck_material_cmd_v3 {
4909e3c3936SNathan Errera 	u8	kck[IWL_KCK_MAX_SIZE];
4919e3c3936SNathan Errera 	u8	kek[IWL_KEK_MAX_SIZE];
4929e3c3936SNathan Errera 	__le16	kck_len;
4939e3c3936SNathan Errera 	__le16	kek_len;
4949e3c3936SNathan Errera 	__le64	replay_ctr;
4959e3c3936SNathan Errera 	__le32  akm;
4969e3c3936SNathan Errera 	__le32  gtk_cipher;
4979e3c3936SNathan Errera 	__le32  igtk_cipher;
49880e67119SEmmanuel Grumbach 	__le32  bigtk_cipher;
49980e67119SEmmanuel Grumbach } __packed; /* KEK_KCK_MATERIAL_API_S_VER_3 */
50080e67119SEmmanuel Grumbach 
50180e67119SEmmanuel Grumbach struct iwl_wowlan_kek_kck_material_cmd_v4 {
50280e67119SEmmanuel Grumbach 	__le32  sta_id;
50380e67119SEmmanuel Grumbach 	u8	kck[IWL_KCK_MAX_SIZE];
50480e67119SEmmanuel Grumbach 	u8	kek[IWL_KEK_MAX_SIZE];
50580e67119SEmmanuel Grumbach 	__le16	kck_len;
50680e67119SEmmanuel Grumbach 	__le16	kek_len;
50780e67119SEmmanuel Grumbach 	__le64	replay_ctr;
50880e67119SEmmanuel Grumbach 	__le32  akm;
50980e67119SEmmanuel Grumbach 	__le32  gtk_cipher;
51080e67119SEmmanuel Grumbach 	__le32  igtk_cipher;
5115c157941SEmmanuel Grumbach 	__le32  bigtk_cipher;
5125c157941SEmmanuel Grumbach } __packed; /* KEK_KCK_MATERIAL_API_S_VER_4 */
5135c157941SEmmanuel Grumbach 
5145c157941SEmmanuel Grumbach struct iwl_wowlan_get_status_cmd {
515d172a5efSJohannes Berg 	__le32  sta_id;
516d172a5efSJohannes Berg } __packed; /* WOWLAN_GET_STATUSES_CMD_API_S_VER_1 */
517d172a5efSJohannes Berg 
518d172a5efSJohannes Berg #define RF_KILL_INDICATOR_FOR_WOWLAN	0x87
519d172a5efSJohannes Berg 
520d172a5efSJohannes Berg enum iwl_wowlan_rekey_status {
521d172a5efSJohannes Berg 	IWL_WOWLAN_REKEY_POST_REKEY = 0,
522d172a5efSJohannes Berg 	IWL_WOWLAN_REKEY_WHILE_REKEY = 1,
523d172a5efSJohannes Berg }; /* WOWLAN_REKEY_STATUS_API_E_VER_1 */
524d172a5efSJohannes Berg 
525d172a5efSJohannes Berg enum iwl_wowlan_wakeup_reason {
526d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BY_NON_WIRELESS			= 0,
527d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BY_MAGIC_PACKET			= BIT(0),
528d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BY_PATTERN				= BIT(1),
529d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_MISSED_BEACON	= BIT(2),
530d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_DEAUTH		= BIT(3),
531d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BY_GTK_REKEY_FAILURE			= BIT(4),
532d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED			= BIT(5),
533d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BY_UCODE_ERROR			= BIT(6),
534d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BY_EAPOL_REQUEST			= BIT(7),
535d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BY_FOUR_WAY_HANDSHAKE			= BIT(8),
536d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BY_REM_WAKE_LINK_LOSS			= BIT(9),
537d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BY_REM_WAKE_SIGNATURE_TABLE		= BIT(10),
538d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BY_REM_WAKE_TCP_EXTERNAL		= BIT(11),
539d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BY_REM_WAKE_WAKEUP_PACKET		= BIT(12),
540d172a5efSJohannes Berg 	IWL_WOWLAN_WAKEUP_BY_IOAC_MAGIC_PACKET			= BIT(13),
5410c546fb6SLuca Coelho 	IWL_WOWLAN_WAKEUP_BY_D3_WAKEUP_HOST_TIMER		= BIT(14),
5420c546fb6SLuca Coelho 	IWL_WOWLAN_WAKEUP_BY_RXFRAME_FILTERED_IN		= BIT(15),
5430c546fb6SLuca Coelho 	IWL_WOWLAN_WAKEUP_BY_BEACON_FILTERED_IN			= BIT(16),
5440c546fb6SLuca Coelho 	IWL_WAKEUP_BY_11W_UNPROTECTED_DEAUTH_OR_DISASSOC	= BIT(17),
5450c546fb6SLuca Coelho 	IWL_WAKEUP_BY_PATTERN_IPV4_TCP_SYN			= BIT(18),
546d172a5efSJohannes Berg 	IWL_WAKEUP_BY_PATTERN_IPV4_TCP_SYN_WILDCARD		= BIT(19),
547d172a5efSJohannes Berg 	IWL_WAKEUP_BY_PATTERN_IPV6_TCP_SYN			= BIT(20),
5482afa6a73SLuca Coelho 	IWL_WAKEUP_BY_PATTERN_IPV6_TCP_SYN_WILDCARD		= BIT(21),
549d172a5efSJohannes Berg }; /* WOWLAN_WAKE_UP_REASON_API_E_VER_2 */
550d172a5efSJohannes Berg 
551d172a5efSJohannes Berg struct iwl_wowlan_gtk_status_v1 {
552d172a5efSJohannes Berg 	u8 key_index;
553ee3ae3a1SDan Halperin 	u8 reserved[3];
554d172a5efSJohannes Berg 	u8 decrypt_key[16];
555d172a5efSJohannes Berg 	u8 tkip_mic_key[8];
556d172a5efSJohannes Berg 	struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 rsc;
5572dc97742SJohannes Berg } __packed; /* WOWLAN_GTK_MATERIAL_VER_1 */
5582afa6a73SLuca Coelho 
5592afa6a73SLuca Coelho /**
5602afa6a73SLuca Coelho  * struct iwl_wowlan_gtk_status_v2 - GTK status
5612afa6a73SLuca Coelho  * @key: GTK material
5622afa6a73SLuca Coelho  * @key_len: GTK legth, if set to 0, the key is not available
5632afa6a73SLuca Coelho  * @key_flags: information about the key:
5642afa6a73SLuca Coelho  *	bits[0:1]:  key index assigned by the AP
5652afa6a73SLuca Coelho  *	bits[2:6]:  GTK index of the key in the internal DB
5662afa6a73SLuca Coelho  *	bit[7]:     Set iff this is the currently used GTK
5672afa6a73SLuca Coelho  * @reserved: padding
5682dc97742SJohannes Berg  * @tkip_mic_key: TKIP RX MIC key
5692afa6a73SLuca Coelho  * @rsc: TSC RSC counters
5702afa6a73SLuca Coelho  */
5712afa6a73SLuca Coelho struct iwl_wowlan_gtk_status_v2 {
5722afa6a73SLuca Coelho 	u8 key[WOWLAN_KEY_MAX_SIZE];
5732afa6a73SLuca Coelho 	u8 key_len;
574ee3ae3a1SDan Halperin 	u8 key_flags;
5752afa6a73SLuca Coelho 	u8 reserved[2];
5762afa6a73SLuca Coelho 	u8 tkip_mic_key[8];
5772dc97742SJohannes Berg 	struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 rsc;
5782dc97742SJohannes Berg } __packed; /* WOWLAN_GTK_MATERIAL_VER_2 */
5792dc97742SJohannes Berg 
5802dc97742SJohannes Berg /**
5812dc97742SJohannes Berg  * struct iwl_wowlan_all_rsc_tsc_v5 - key counters
5822dc97742SJohannes Berg  * @ucast_rsc: unicast RSC values
5832dc97742SJohannes Berg  * @mcast_rsc: multicast RSC values (per key map value)
5842dc97742SJohannes Berg  * @sta_id: station ID
5852dc97742SJohannes Berg  * @mcast_key_id_map: map of key id to @mcast_rsc entry
5862dc97742SJohannes Berg  */
5872dc97742SJohannes Berg struct iwl_wowlan_all_rsc_tsc_v5 {
5882dc97742SJohannes Berg 	__le64 ucast_rsc[IWL_MAX_TID_COUNT];
5892dc97742SJohannes Berg 	__le64 mcast_rsc[2][IWL_MAX_TID_COUNT];
5902dc97742SJohannes Berg 	__le32 sta_id;
5912dc97742SJohannes Berg 	u8 mcast_key_id_map[4];
5922dc97742SJohannes Berg } __packed; /* ALL_TSC_RSC_API_S_VER_5 */
5932dc97742SJohannes Berg 
5942dc97742SJohannes Berg /**
5952dc97742SJohannes Berg  * struct iwl_wowlan_gtk_status_v3 - GTK status
5962dc97742SJohannes Berg  * @key: GTK material
5972dc97742SJohannes Berg  * @key_len: GTK length, if set to 0, the key is not available
5982dc97742SJohannes Berg  * @key_flags: information about the key:
5992dc97742SJohannes Berg  *	bits[0:1]:  key index assigned by the AP
6002dc97742SJohannes Berg  *	bits[2:6]:  GTK index of the key in the internal DB
6012dc97742SJohannes Berg  *	bit[7]:     Set iff this is the currently used GTK
6022dc97742SJohannes Berg  * @reserved: padding
6032dc97742SJohannes Berg  * @tkip_mic_key: TKIP RX MIC key
6042dc97742SJohannes Berg  * @sc: RSC/TSC counters
6052dc97742SJohannes Berg  */
6062dc97742SJohannes Berg struct iwl_wowlan_gtk_status_v3 {
6072dc97742SJohannes Berg 	u8 key[WOWLAN_KEY_MAX_SIZE];
6082dc97742SJohannes Berg 	u8 key_len;
6092dc97742SJohannes Berg 	u8 key_flags;
6102dc97742SJohannes Berg 	u8 reserved[2];
6112dc97742SJohannes Berg 	u8 tkip_mic_key[IWL_MIC_KEY_SIZE];
6122afa6a73SLuca Coelho 	struct iwl_wowlan_all_rsc_tsc_v5 sc;
6132afa6a73SLuca Coelho } __packed; /* WOWLAN_GTK_MATERIAL_VER_3 */
6142afa6a73SLuca Coelho 
6152afa6a73SLuca Coelho #define IWL_WOWLAN_GTK_IDX_MASK		(BIT(0) | BIT(1))
6162afa6a73SLuca Coelho #define IWL_WOWLAN_IGTK_BIGTK_IDX_MASK	(BIT(0))
6172afa6a73SLuca Coelho 
6182afa6a73SLuca Coelho /**
6192afa6a73SLuca Coelho  * struct iwl_wowlan_igtk_status - IGTK status
6202afa6a73SLuca Coelho  * @key: IGTK material
6212afa6a73SLuca Coelho  * @ipn: the IGTK packet number (replay counter)
6222afa6a73SLuca Coelho  * @key_len: IGTK length, if set to 0, the key is not available
6232afa6a73SLuca Coelho  * @key_flags: information about the key:
6242afa6a73SLuca Coelho  *	bits[0]:    key index assigned by the AP (0: index 4, 1: index 5)
6252afa6a73SLuca Coelho  *	bits[1:5]:  IGTK index of the key in the internal DB
6262afa6a73SLuca Coelho  *	bit[6]:     Set iff this is the currently used IGTK
6272afa6a73SLuca Coelho  */
6282afa6a73SLuca Coelho struct iwl_wowlan_igtk_status {
6292afa6a73SLuca Coelho 	u8 key[WOWLAN_KEY_MAX_SIZE];
6302afa6a73SLuca Coelho 	u8 ipn[6];
6312afa6a73SLuca Coelho 	u8 key_len;
6322afa6a73SLuca Coelho 	u8 key_flags;
633d172a5efSJohannes Berg } __packed; /* WOWLAN_IGTK_MATERIAL_VER_1 */
634d172a5efSJohannes Berg 
635d172a5efSJohannes Berg /**
636d172a5efSJohannes Berg  * struct iwl_wowlan_status_v6 - WoWLAN status
637d172a5efSJohannes Berg  * @gtk: GTK data
638d172a5efSJohannes Berg  * @replay_ctr: GTK rekey replay counter
639d172a5efSJohannes Berg  * @pattern_number: number of the matched pattern
640d172a5efSJohannes Berg  * @non_qos_seq_ctr: non-QoS sequence counter to use next
641d172a5efSJohannes Berg  * @qos_seq_ctr: QoS sequence counters to use next
642d172a5efSJohannes Berg  * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
643d172a5efSJohannes Berg  * @num_of_gtk_rekeys: number of GTK rekeys
644d172a5efSJohannes Berg  * @transmitted_ndps: number of transmitted neighbor discovery packets
645d172a5efSJohannes Berg  * @received_beacons: number of received beacons
6462afa6a73SLuca Coelho  * @wake_packet_length: wakeup packet length
6472afa6a73SLuca Coelho  * @wake_packet_bufsize: wakeup packet buffer size
648d172a5efSJohannes Berg  * @wake_packet: wakeup packet
649d172a5efSJohannes Berg  */
650d172a5efSJohannes Berg struct iwl_wowlan_status_v6 {
651d172a5efSJohannes Berg 	struct iwl_wowlan_gtk_status_v1 gtk;
652d172a5efSJohannes Berg 	__le64 replay_ctr;
653d172a5efSJohannes Berg 	__le16 pattern_number;
654d172a5efSJohannes Berg 	__le16 non_qos_seq_ctr;
655d172a5efSJohannes Berg 	__le16 qos_seq_ctr[8];
656d172a5efSJohannes Berg 	__le32 wakeup_reasons;
657d172a5efSJohannes Berg 	__le32 num_of_gtk_rekeys;
658d172a5efSJohannes Berg 	__le32 transmitted_ndps;
659d172a5efSJohannes Berg 	__le32 received_beacons;
660d172a5efSJohannes Berg 	__le32 wake_packet_length;
6612afa6a73SLuca Coelho 	__le32 wake_packet_bufsize;
66234c4eca1SJohannes Berg 	u8 wake_packet[]; /* can be truncated from _length to _bufsize */
6632afa6a73SLuca Coelho } __packed; /* WOWLAN_STATUSES_API_S_VER_6 */
6642afa6a73SLuca Coelho 
6652afa6a73SLuca Coelho /**
6662afa6a73SLuca Coelho  * struct iwl_wowlan_status_v7 - WoWLAN status
6672afa6a73SLuca Coelho  * @gtk: GTK data
6682afa6a73SLuca Coelho  * @igtk: IGTK data
6692afa6a73SLuca Coelho  * @replay_ctr: GTK rekey replay counter
6702afa6a73SLuca Coelho  * @pattern_number: number of the matched pattern
6712afa6a73SLuca Coelho  * @non_qos_seq_ctr: non-QoS sequence counter to use next
6722afa6a73SLuca Coelho  * @qos_seq_ctr: QoS sequence counters to use next
6732afa6a73SLuca Coelho  * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
6742afa6a73SLuca Coelho  * @num_of_gtk_rekeys: number of GTK rekeys
6752afa6a73SLuca Coelho  * @transmitted_ndps: number of transmitted neighbor discovery packets
6762afa6a73SLuca Coelho  * @received_beacons: number of received beacons
677250380c9SMordechay Goodstein  * @wake_packet_length: wakeup packet length
6782dc97742SJohannes Berg  * @wake_packet_bufsize: wakeup packet buffer size
6792afa6a73SLuca Coelho  * @wake_packet: wakeup packet
6802afa6a73SLuca Coelho  */
6812afa6a73SLuca Coelho struct iwl_wowlan_status_v7 {
6822afa6a73SLuca Coelho 	struct iwl_wowlan_gtk_status_v2 gtk[WOWLAN_GTK_KEYS_NUM];
6832afa6a73SLuca Coelho 	struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
6842afa6a73SLuca Coelho 	__le64 replay_ctr;
6852afa6a73SLuca Coelho 	__le16 pattern_number;
6862afa6a73SLuca Coelho 	__le16 non_qos_seq_ctr;
6872afa6a73SLuca Coelho 	__le16 qos_seq_ctr[8];
6882afa6a73SLuca Coelho 	__le32 wakeup_reasons;
6892afa6a73SLuca Coelho 	__le32 num_of_gtk_rekeys;
6902afa6a73SLuca Coelho 	__le32 transmitted_ndps;
6912afa6a73SLuca Coelho 	__le32 received_beacons;
6922afa6a73SLuca Coelho 	__le32 wake_packet_length;
693250380c9SMordechay Goodstein 	__le32 wake_packet_bufsize;
6945b16565aSNaftali Goldstein 	u8 wake_packet[]; /* can be truncated from _length to _bufsize */
695250380c9SMordechay Goodstein } __packed; /* WOWLAN_STATUSES_API_S_VER_7 */
696250380c9SMordechay Goodstein 
697250380c9SMordechay Goodstein /**
698250380c9SMordechay Goodstein  * struct iwl_wowlan_status_v9 - WoWLAN status (versions 9 and 10)
6995b16565aSNaftali Goldstein  * @gtk: GTK data
7005b16565aSNaftali Goldstein  * @igtk: IGTK data
701250380c9SMordechay Goodstein  * @replay_ctr: GTK rekey replay counter
702250380c9SMordechay Goodstein  * @pattern_number: number of the matched pattern
703250380c9SMordechay Goodstein  * @non_qos_seq_ctr: non-QoS sequence counter to use next.
704250380c9SMordechay Goodstein  *                   Reserved if the struct has version >= 10.
705250380c9SMordechay Goodstein  * @qos_seq_ctr: QoS sequence counters to use next
706250380c9SMordechay Goodstein  * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
707250380c9SMordechay Goodstein  * @num_of_gtk_rekeys: number of GTK rekeys
708250380c9SMordechay Goodstein  * @transmitted_ndps: number of transmitted neighbor discovery packets
709250380c9SMordechay Goodstein  * @received_beacons: number of received beacons
710250380c9SMordechay Goodstein  * @wake_packet_length: wakeup packet length
711250380c9SMordechay Goodstein  * @wake_packet_bufsize: wakeup packet buffer size
712250380c9SMordechay Goodstein  * @tid_tear_down: bit mask of tids whose BA sessions were closed
713bc68163cSJohannes Berg  *		   in suspend state
7142dc97742SJohannes Berg  * @reserved: unused
715250380c9SMordechay Goodstein  * @wake_packet: wakeup packet
716250380c9SMordechay Goodstein  */
717250380c9SMordechay Goodstein struct iwl_wowlan_status_v9 {
718250380c9SMordechay Goodstein 	struct iwl_wowlan_gtk_status_v2 gtk[WOWLAN_GTK_KEYS_NUM];
719250380c9SMordechay Goodstein 	struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
720250380c9SMordechay Goodstein 	__le64 replay_ctr;
721250380c9SMordechay Goodstein 	__le16 pattern_number;
722250380c9SMordechay Goodstein 	__le16 non_qos_seq_ctr;
723250380c9SMordechay Goodstein 	__le16 qos_seq_ctr[8];
724250380c9SMordechay Goodstein 	__le32 wakeup_reasons;
725250380c9SMordechay Goodstein 	__le32 num_of_gtk_rekeys;
726250380c9SMordechay Goodstein 	__le32 transmitted_ndps;
727250380c9SMordechay Goodstein 	__le32 received_beacons;
728250380c9SMordechay Goodstein 	__le32 wake_packet_length;
7295b16565aSNaftali Goldstein 	__le32 wake_packet_bufsize;
730250380c9SMordechay Goodstein 	u8 tid_tear_down;
7312dc97742SJohannes Berg 	u8 reserved[3];
7322dc97742SJohannes Berg 	u8 wake_packet[]; /* can be truncated from _length to _bufsize */
7332dc97742SJohannes Berg } __packed; /* WOWLAN_STATUSES_RSP_API_S_VER_9 */
7342dc97742SJohannes Berg 
7352dc97742SJohannes Berg /**
7362dc97742SJohannes Berg  * struct iwl_wowlan_status_v12 - WoWLAN status
7372dc97742SJohannes Berg  * @gtk: GTK data
7382dc97742SJohannes Berg  * @igtk: IGTK data
7392dc97742SJohannes Berg  * @replay_ctr: GTK rekey replay counter
7402dc97742SJohannes Berg  * @pattern_number: number of the matched pattern
7412dc97742SJohannes Berg  * @non_qos_seq_ctr: non-QoS sequence counter to use next.
7422dc97742SJohannes Berg  *                   Reserved if the struct has version >= 10.
7432dc97742SJohannes Berg  * @qos_seq_ctr: QoS sequence counters to use next
7442dc97742SJohannes Berg  * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
7452dc97742SJohannes Berg  * @num_of_gtk_rekeys: number of GTK rekeys
7462dc97742SJohannes Berg  * @transmitted_ndps: number of transmitted neighbor discovery packets
7472dc97742SJohannes Berg  * @received_beacons: number of received beacons
7482dc97742SJohannes Berg  * @wake_packet_length: wakeup packet length
7492dc97742SJohannes Berg  * @wake_packet_bufsize: wakeup packet buffer size
7502dc97742SJohannes Berg  * @tid_tear_down: bit mask of tids whose BA sessions were closed
7512dc97742SJohannes Berg  *		   in suspend state
7522dc97742SJohannes Berg  * @reserved: unused
7532dc97742SJohannes Berg  * @wake_packet: wakeup packet
7542dc97742SJohannes Berg  */
7552dc97742SJohannes Berg struct iwl_wowlan_status_v12 {
7562dc97742SJohannes Berg 	struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM];
7572dc97742SJohannes Berg 	struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
7582dc97742SJohannes Berg 	__le64 replay_ctr;
7592dc97742SJohannes Berg 	__le16 pattern_number;
7602dc97742SJohannes Berg 	__le16 non_qos_seq_ctr;
7612dc97742SJohannes Berg 	__le16 qos_seq_ctr[8];
7622dc97742SJohannes Berg 	__le32 wakeup_reasons;
7632dc97742SJohannes Berg 	__le32 num_of_gtk_rekeys;
7642dc97742SJohannes Berg 	__le32 transmitted_ndps;
7652dc97742SJohannes Berg 	__le32 received_beacons;
7662dc97742SJohannes Berg 	__le32 wake_packet_length;
7672dc97742SJohannes Berg 	__le32 wake_packet_bufsize;
7682dc97742SJohannes Berg 	u8 tid_tear_down;
7694da46a06SHaim Dreyfuss 	u8 reserved[3];
770*905d50ddSHaim Dreyfuss 	u8 wake_packet[]; /* can be truncated from _length to _bufsize */
7714da46a06SHaim Dreyfuss } __packed; /* WOWLAN_STATUSES_RSP_API_S_VER_12 */
7724da46a06SHaim Dreyfuss 
7734da46a06SHaim Dreyfuss /**
7744da46a06SHaim Dreyfuss  * struct iwl_wowlan_info_notif_v1 - WoWLAN information notification
7754da46a06SHaim Dreyfuss  * @gtk: GTK data
7764da46a06SHaim Dreyfuss  * @igtk: IGTK data
7774da46a06SHaim Dreyfuss  * @replay_ctr: GTK rekey replay counter
7784da46a06SHaim Dreyfuss  * @pattern_number: number of the matched patterns
7794da46a06SHaim Dreyfuss  * @reserved1: reserved
7804da46a06SHaim Dreyfuss  * @qos_seq_ctr: QoS sequence counters to use next
7814da46a06SHaim Dreyfuss  * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
7824da46a06SHaim Dreyfuss  * @num_of_gtk_rekeys: number of GTK rekeys
7834da46a06SHaim Dreyfuss  * @transmitted_ndps: number of transmitted neighbor discovery packets
7844da46a06SHaim Dreyfuss  * @received_beacons: number of received beacons
7854da46a06SHaim Dreyfuss  * @wake_packet_length: wakeup packet length
7864da46a06SHaim Dreyfuss  * @wake_packet_bufsize: wakeup packet buffer size
7874da46a06SHaim Dreyfuss  * @tid_tear_down: bit mask of tids whose BA sessions were closed
788*905d50ddSHaim Dreyfuss  *	in suspend state
7894da46a06SHaim Dreyfuss  * @station_id: station id
7904da46a06SHaim Dreyfuss  * @reserved2: reserved
7914da46a06SHaim Dreyfuss  */
7924da46a06SHaim Dreyfuss struct iwl_wowlan_info_notif_v1 {
7934da46a06SHaim Dreyfuss 	struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM];
7944da46a06SHaim Dreyfuss 	struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
7954da46a06SHaim Dreyfuss 	__le64 replay_ctr;
7964da46a06SHaim Dreyfuss 	__le16 pattern_number;
7974da46a06SHaim Dreyfuss 	__le16 reserved1;
7984da46a06SHaim Dreyfuss 	__le16 qos_seq_ctr[8];
7994da46a06SHaim Dreyfuss 	__le32 wakeup_reasons;
8004da46a06SHaim Dreyfuss 	__le32 num_of_gtk_rekeys;
8014da46a06SHaim Dreyfuss 	__le32 transmitted_ndps;
8024da46a06SHaim Dreyfuss 	__le32 received_beacons;
8034da46a06SHaim Dreyfuss 	__le32 wake_packet_length;
8044da46a06SHaim Dreyfuss 	__le32 wake_packet_bufsize;
8054da46a06SHaim Dreyfuss 	u8 tid_tear_down;
806219ed58fSHaim Dreyfuss 	u8 station_id;
807*905d50ddSHaim Dreyfuss 	u8 reserved2[2];
808*905d50ddSHaim Dreyfuss } __packed; /* WOWLAN_INFO_NTFY_API_S_VER_1 */
809*905d50ddSHaim Dreyfuss 
810*905d50ddSHaim Dreyfuss /**
811*905d50ddSHaim Dreyfuss  * struct iwl_wowlan_info_notif - WoWLAN information notification
812*905d50ddSHaim Dreyfuss  * @gtk: GTK data
813*905d50ddSHaim Dreyfuss  * @igtk: IGTK data
814*905d50ddSHaim Dreyfuss  * @replay_ctr: GTK rekey replay counter
815*905d50ddSHaim Dreyfuss  * @pattern_number: number of the matched patterns
816*905d50ddSHaim Dreyfuss  * @reserved1: reserved
817*905d50ddSHaim Dreyfuss  * @qos_seq_ctr: QoS sequence counters to use next
818*905d50ddSHaim Dreyfuss  * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
819*905d50ddSHaim Dreyfuss  * @num_of_gtk_rekeys: number of GTK rekeys
820*905d50ddSHaim Dreyfuss  * @transmitted_ndps: number of transmitted neighbor discovery packets
821*905d50ddSHaim Dreyfuss  * @received_beacons: number of received beacons
822*905d50ddSHaim Dreyfuss  * @tid_tear_down: bit mask of tids whose BA sessions were closed
823*905d50ddSHaim Dreyfuss  *	in suspend state
824*905d50ddSHaim Dreyfuss  * @station_id: station id
825*905d50ddSHaim Dreyfuss  * @reserved2: reserved
826*905d50ddSHaim Dreyfuss  */
827*905d50ddSHaim Dreyfuss struct iwl_wowlan_info_notif {
828*905d50ddSHaim Dreyfuss 	struct iwl_wowlan_gtk_status_v3 gtk[WOWLAN_GTK_KEYS_NUM];
829*905d50ddSHaim Dreyfuss 	struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
830*905d50ddSHaim Dreyfuss 	__le64 replay_ctr;
831*905d50ddSHaim Dreyfuss 	__le16 pattern_number;
832*905d50ddSHaim Dreyfuss 	__le16 reserved1;
833*905d50ddSHaim Dreyfuss 	__le16 qos_seq_ctr[8];
834*905d50ddSHaim Dreyfuss 	__le32 wakeup_reasons;
835*905d50ddSHaim Dreyfuss 	__le32 num_of_gtk_rekeys;
836*905d50ddSHaim Dreyfuss 	__le32 transmitted_ndps;
837*905d50ddSHaim Dreyfuss 	__le32 received_beacons;
838*905d50ddSHaim Dreyfuss 	u8 tid_tear_down;
839*905d50ddSHaim Dreyfuss 	u8 station_id;
840219ed58fSHaim Dreyfuss 	u8 reserved2[2];
841219ed58fSHaim Dreyfuss } __packed; /* WOWLAN_INFO_NTFY_API_S_VER_2 */
842219ed58fSHaim Dreyfuss 
843219ed58fSHaim Dreyfuss /**
844219ed58fSHaim Dreyfuss  * struct iwl_wowlan_wake_pkt_notif - WoWLAN wake packet notification
845219ed58fSHaim Dreyfuss  * @wake_packet_length: wakeup packet length
846219ed58fSHaim Dreyfuss  * @station_id: station id
847219ed58fSHaim Dreyfuss  * @reserved: unused
848219ed58fSHaim Dreyfuss  * @wake_packet: wakeup packet
849219ed58fSHaim Dreyfuss  */
850219ed58fSHaim Dreyfuss struct iwl_wowlan_wake_pkt_notif {
851219ed58fSHaim Dreyfuss 	__le32 wake_packet_length;
852219ed58fSHaim Dreyfuss 	u8 station_id;
853c39e718aSHaim Dreyfuss 	u8 reserved[3];
854c39e718aSHaim Dreyfuss 	u8 wake_packet[1];
855c39e718aSHaim Dreyfuss } __packed; /* WOWLAN_WAKE_PKT_NTFY_API_S_VER_1 */
856c39e718aSHaim Dreyfuss 
857c39e718aSHaim Dreyfuss /**
858c39e718aSHaim Dreyfuss  * struct iwl_mvm_d3_end_notif -  d3 end notification
859c39e718aSHaim Dreyfuss  * @flags: See &enum iwl_d0i3_flags
860c39e718aSHaim Dreyfuss  */
861d172a5efSJohannes Berg struct iwl_mvm_d3_end_notif {
862d172a5efSJohannes Berg 	__le32 flags;
863d172a5efSJohannes Berg } __packed;
864 
865 /* TODO: NetDetect API */
866 
867 #endif /* __iwl_fw_api_d3_h__ */
868