• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * This file is provided under a dual BSD/GPLv2 license.  When using or
4  * redistributing this file, you may do so under either license.
5  *
6  * GPL LICENSE SUMMARY
7  *
8  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
9  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of version 2 of the GNU General Public License as
13  * published by the Free Software Foundation.
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
23  * USA
24  *
25  * The full GNU General Public License is included in this distribution
26  * in the file called COPYING.
27  *
28  * Contact Information:
29  *  Intel Linux Wireless <ilw@linux.intel.com>
30  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
31  *
32  * BSD LICENSE
33  *
34  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
35  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
36  * All rights reserved.
37  *
38  * Redistribution and use in source and binary forms, with or without
39  * modification, are permitted provided that the following conditions
40  * are met:
41  *
42  *  * Redistributions of source code must retain the above copyright
43  *    notice, this list of conditions and the following disclaimer.
44  *  * Redistributions in binary form must reproduce the above copyright
45  *    notice, this list of conditions and the following disclaimer in
46  *    the documentation and/or other materials provided with the
47  *    distribution.
48  *  * Neither the name Intel Corporation nor the names of its
49  *    contributors may be used to endorse or promote products derived
50  *    from this software without specific prior written permission.
51  *
52  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
53  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
54  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
55  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
56  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
57  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
58  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
59  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
60  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
61  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
62  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63  *****************************************************************************/
64 
65 #ifndef __fw_api_d3_h__
66 #define __fw_api_d3_h__
67 
68 /**
69  * enum iwl_d3_wakeup_flags - D3 manager wakeup flags
70  * @IWL_WAKEUP_D3_CONFIG_FW_ERROR: wake up on firmware sysassert
71  */
72 enum iwl_d3_wakeup_flags {
73 	IWL_WAKEUP_D3_CONFIG_FW_ERROR = BIT(0),
74 }; /* D3_MANAGER_WAKEUP_CONFIG_API_E_VER_3 */
75 
76 /**
77  * struct iwl_d3_manager_config - D3 manager configuration command
78  * @min_sleep_time: minimum sleep time (in usec)
79  * @wakeup_flags: wakeup flags, see &enum iwl_d3_wakeup_flags
80  * @wakeup_host_timer: force wakeup after this many seconds
81  *
82  * The structure is used for the D3_CONFIG_CMD command.
83  */
84 struct iwl_d3_manager_config {
85 	__le32 min_sleep_time;
86 	__le32 wakeup_flags;
87 	__le32 wakeup_host_timer;
88 } __packed; /* D3_MANAGER_CONFIG_CMD_S_VER_4 */
89 
90 
91 /* TODO: OFFLOADS_QUERY_API_S_VER_1 */
92 
93 /**
94  * enum iwl_d3_proto_offloads - enabled protocol offloads
95  * @IWL_D3_PROTO_OFFLOAD_ARP: ARP data is enabled
96  * @IWL_D3_PROTO_OFFLOAD_NS: NS (Neighbor Solicitation) is enabled
97  */
98 enum iwl_proto_offloads {
99 	IWL_D3_PROTO_OFFLOAD_ARP = BIT(0),
100 	IWL_D3_PROTO_OFFLOAD_NS = BIT(1),
101 };
102 
103 #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V1	2
104 #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V2	6
105 #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L	12
106 #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3S	4
107 #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX	12
108 
109 #define IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L	4
110 #define IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3S	2
111 
112 /**
113  * struct iwl_proto_offload_cmd_common - ARP/NS offload common part
114  * @enabled: enable flags
115  * @remote_ipv4_addr: remote address to answer to (or zero if all)
116  * @host_ipv4_addr: our IPv4 address to respond to queries for
117  * @arp_mac_addr: our MAC address for ARP responses
118  * @reserved: unused
119  */
120 struct iwl_proto_offload_cmd_common {
121 	__le32 enabled;
122 	__be32 remote_ipv4_addr;
123 	__be32 host_ipv4_addr;
124 	u8 arp_mac_addr[ETH_ALEN];
125 	__le16 reserved;
126 } __packed;
127 
128 /**
129  * struct iwl_proto_offload_cmd_v1 - ARP/NS offload configuration
130  * @common: common/IPv4 configuration
131  * @remote_ipv6_addr: remote address to answer to (or zero if all)
132  * @solicited_node_ipv6_addr: broken -- solicited node address exists
133  *	for each target address
134  * @target_ipv6_addr: our target addresses
135  * @ndp_mac_addr: neighbor solicitation response MAC address
136  */
137 struct iwl_proto_offload_cmd_v1 {
138 	struct iwl_proto_offload_cmd_common common;
139 	u8 remote_ipv6_addr[16];
140 	u8 solicited_node_ipv6_addr[16];
141 	u8 target_ipv6_addr[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V1][16];
142 	u8 ndp_mac_addr[ETH_ALEN];
143 	__le16 reserved2;
144 } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_1 */
145 
146 /**
147  * struct iwl_proto_offload_cmd_v2 - ARP/NS offload configuration
148  * @common: common/IPv4 configuration
149  * @remote_ipv6_addr: remote address to answer to (or zero if all)
150  * @solicited_node_ipv6_addr: broken -- solicited node address exists
151  *	for each target address
152  * @target_ipv6_addr: our target addresses
153  * @ndp_mac_addr: neighbor solicitation response MAC address
154  */
155 struct iwl_proto_offload_cmd_v2 {
156 	struct iwl_proto_offload_cmd_common common;
157 	u8 remote_ipv6_addr[16];
158 	u8 solicited_node_ipv6_addr[16];
159 	u8 target_ipv6_addr[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V2][16];
160 	u8 ndp_mac_addr[ETH_ALEN];
161 	u8 numValidIPv6Addresses;
162 	u8 reserved2[3];
163 } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_2 */
164 
165 struct iwl_ns_config {
166 	struct in6_addr source_ipv6_addr;
167 	struct in6_addr dest_ipv6_addr;
168 	u8 target_mac_addr[ETH_ALEN];
169 	__le16 reserved;
170 } __packed; /* NS_OFFLOAD_CONFIG */
171 
172 struct iwl_targ_addr {
173 	struct in6_addr addr;
174 	__le32 config_num;
175 } __packed; /* TARGET_IPV6_ADDRESS */
176 
177 /**
178  * struct iwl_proto_offload_cmd_v3_small - ARP/NS offload configuration
179  * @common: common/IPv4 configuration
180  * @target_ipv6_addr: target IPv6 addresses
181  * @ns_config: NS offload configurations
182  */
183 struct iwl_proto_offload_cmd_v3_small {
184 	struct iwl_proto_offload_cmd_common common;
185 	__le32 num_valid_ipv6_addrs;
186 	struct iwl_targ_addr targ_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3S];
187 	struct iwl_ns_config ns_config[IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3S];
188 } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_3 */
189 
190 /**
191  * struct iwl_proto_offload_cmd_v3_large - ARP/NS offload configuration
192  * @common: common/IPv4 configuration
193  * @target_ipv6_addr: target IPv6 addresses
194  * @ns_config: NS offload configurations
195  */
196 struct iwl_proto_offload_cmd_v3_large {
197 	struct iwl_proto_offload_cmd_common common;
198 	__le32 num_valid_ipv6_addrs;
199 	struct iwl_targ_addr targ_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L];
200 	struct iwl_ns_config ns_config[IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L];
201 } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_3 */
202 
203 /*
204  * WOWLAN_PATTERNS
205  */
206 #define IWL_WOWLAN_MIN_PATTERN_LEN	16
207 #define IWL_WOWLAN_MAX_PATTERN_LEN	128
208 
209 struct iwl_wowlan_pattern {
210 	u8 mask[IWL_WOWLAN_MAX_PATTERN_LEN / 8];
211 	u8 pattern[IWL_WOWLAN_MAX_PATTERN_LEN];
212 	u8 mask_size;
213 	u8 pattern_size;
214 	__le16 reserved;
215 } __packed; /* WOWLAN_PATTERN_API_S_VER_1 */
216 
217 #define IWL_WOWLAN_MAX_PATTERNS	20
218 
219 struct iwl_wowlan_patterns_cmd {
220 	__le32 n_patterns;
221 	struct iwl_wowlan_pattern patterns[];
222 } __packed; /* WOWLAN_PATTERN_ARRAY_API_S_VER_1 */
223 
224 enum iwl_wowlan_wakeup_filters {
225 	IWL_WOWLAN_WAKEUP_MAGIC_PACKET			= BIT(0),
226 	IWL_WOWLAN_WAKEUP_PATTERN_MATCH			= BIT(1),
227 	IWL_WOWLAN_WAKEUP_BEACON_MISS			= BIT(2),
228 	IWL_WOWLAN_WAKEUP_LINK_CHANGE			= BIT(3),
229 	IWL_WOWLAN_WAKEUP_GTK_REKEY_FAIL		= BIT(4),
230 	IWL_WOWLAN_WAKEUP_EAP_IDENT_REQ			= BIT(5),
231 	IWL_WOWLAN_WAKEUP_4WAY_HANDSHAKE		= BIT(6),
232 	IWL_WOWLAN_WAKEUP_ENABLE_NET_DETECT		= BIT(7),
233 	IWL_WOWLAN_WAKEUP_RF_KILL_DEASSERT		= BIT(8),
234 	IWL_WOWLAN_WAKEUP_REMOTE_LINK_LOSS		= BIT(9),
235 	IWL_WOWLAN_WAKEUP_REMOTE_SIGNATURE_TABLE	= BIT(10),
236 	IWL_WOWLAN_WAKEUP_REMOTE_TCP_EXTERNAL		= BIT(11),
237 	IWL_WOWLAN_WAKEUP_REMOTE_WAKEUP_PACKET		= BIT(12),
238 	IWL_WOWLAN_WAKEUP_IOAC_MAGIC_PACKET		= BIT(13),
239 	IWL_WOWLAN_WAKEUP_HOST_TIMER			= BIT(14),
240 	IWL_WOWLAN_WAKEUP_RX_FRAME			= BIT(15),
241 	IWL_WOWLAN_WAKEUP_BCN_FILTERING			= BIT(16),
242 }; /* WOWLAN_WAKEUP_FILTER_API_E_VER_4 */
243 
244 struct iwl_wowlan_config_cmd {
245 	__le32 wakeup_filter;
246 	__le16 non_qos_seq;
247 	__le16 qos_seq[8];
248 	u8 wowlan_ba_teardown_tids;
249 	u8 is_11n_connection;
250 	u8 offloading_tid;
251 	u8 reserved[3];
252 } __packed; /* WOWLAN_CONFIG_API_S_VER_3 */
253 
254 /*
255  * WOWLAN_TSC_RSC_PARAMS
256  */
257 #define IWL_NUM_RSC	16
258 
259 struct tkip_sc {
260 	__le16 iv16;
261 	__le16 pad;
262 	__le32 iv32;
263 } __packed; /* TKIP_SC_API_U_VER_1 */
264 
265 struct iwl_tkip_rsc_tsc {
266 	struct tkip_sc unicast_rsc[IWL_NUM_RSC];
267 	struct tkip_sc multicast_rsc[IWL_NUM_RSC];
268 	struct tkip_sc tsc;
269 } __packed; /* TKIP_TSC_RSC_API_S_VER_1 */
270 
271 struct aes_sc {
272 	__le64 pn;
273 } __packed; /* TKIP_AES_SC_API_U_VER_1 */
274 
275 struct iwl_aes_rsc_tsc {
276 	struct aes_sc unicast_rsc[IWL_NUM_RSC];
277 	struct aes_sc multicast_rsc[IWL_NUM_RSC];
278 	struct aes_sc tsc;
279 } __packed; /* AES_TSC_RSC_API_S_VER_1 */
280 
281 union iwl_all_tsc_rsc {
282 	struct iwl_tkip_rsc_tsc tkip;
283 	struct iwl_aes_rsc_tsc aes;
284 }; /* ALL_TSC_RSC_API_S_VER_2 */
285 
286 struct iwl_wowlan_rsc_tsc_params_cmd {
287 	union iwl_all_tsc_rsc all_tsc_rsc;
288 } __packed; /* ALL_TSC_RSC_API_S_VER_2 */
289 
290 #define IWL_MIC_KEY_SIZE	8
291 struct iwl_mic_keys {
292 	u8 tx[IWL_MIC_KEY_SIZE];
293 	u8 rx_unicast[IWL_MIC_KEY_SIZE];
294 	u8 rx_mcast[IWL_MIC_KEY_SIZE];
295 } __packed; /* MIC_KEYS_API_S_VER_1 */
296 
297 #define IWL_P1K_SIZE		5
298 struct iwl_p1k_cache {
299 	__le16 p1k[IWL_P1K_SIZE];
300 } __packed;
301 
302 #define IWL_NUM_RX_P1K_CACHE	2
303 
304 struct iwl_wowlan_tkip_params_cmd {
305 	struct iwl_mic_keys mic_keys;
306 	struct iwl_p1k_cache tx;
307 	struct iwl_p1k_cache rx_uni[IWL_NUM_RX_P1K_CACHE];
308 	struct iwl_p1k_cache rx_multi[IWL_NUM_RX_P1K_CACHE];
309 } __packed; /* WOWLAN_TKIP_SETTING_API_S_VER_1 */
310 
311 #define IWL_KCK_MAX_SIZE	32
312 #define IWL_KEK_MAX_SIZE	32
313 
314 struct iwl_wowlan_kek_kck_material_cmd {
315 	u8	kck[IWL_KCK_MAX_SIZE];
316 	u8	kek[IWL_KEK_MAX_SIZE];
317 	__le16	kck_len;
318 	__le16	kek_len;
319 	__le64	replay_ctr;
320 } __packed; /* KEK_KCK_MATERIAL_API_S_VER_2 */
321 
322 #define RF_KILL_INDICATOR_FOR_WOWLAN	0x87
323 
324 enum iwl_wowlan_rekey_status {
325 	IWL_WOWLAN_REKEY_POST_REKEY = 0,
326 	IWL_WOWLAN_REKEY_WHILE_REKEY = 1,
327 }; /* WOWLAN_REKEY_STATUS_API_E_VER_1 */
328 
329 enum iwl_wowlan_wakeup_reason {
330 	IWL_WOWLAN_WAKEUP_BY_NON_WIRELESS			= 0,
331 	IWL_WOWLAN_WAKEUP_BY_MAGIC_PACKET			= BIT(0),
332 	IWL_WOWLAN_WAKEUP_BY_PATTERN				= BIT(1),
333 	IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_MISSED_BEACON	= BIT(2),
334 	IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_DEAUTH		= BIT(3),
335 	IWL_WOWLAN_WAKEUP_BY_GTK_REKEY_FAILURE			= BIT(4),
336 	IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED			= BIT(5),
337 	IWL_WOWLAN_WAKEUP_BY_UCODE_ERROR			= BIT(6),
338 	IWL_WOWLAN_WAKEUP_BY_EAPOL_REQUEST			= BIT(7),
339 	IWL_WOWLAN_WAKEUP_BY_FOUR_WAY_HANDSHAKE			= BIT(8),
340 	IWL_WOWLAN_WAKEUP_BY_REM_WAKE_LINK_LOSS			= BIT(9),
341 	IWL_WOWLAN_WAKEUP_BY_REM_WAKE_SIGNATURE_TABLE		= BIT(10),
342 	IWL_WOWLAN_WAKEUP_BY_REM_WAKE_TCP_EXTERNAL		= BIT(11),
343 	IWL_WOWLAN_WAKEUP_BY_REM_WAKE_WAKEUP_PACKET		= BIT(12),
344 	IWL_WOWLAN_WAKEUP_BY_IOAC_MAGIC_PACKET			= BIT(13),
345 	IWL_WOWLAN_WAKEUP_BY_D3_WAKEUP_HOST_TIMER		= BIT(14),
346 	IWL_WOWLAN_WAKEUP_BY_RXFRAME_FILTERED_IN		= BIT(15),
347 	IWL_WOWLAN_WAKEUP_BY_BEACON_FILTERED_IN			= BIT(16),
348 
349 }; /* WOWLAN_WAKE_UP_REASON_API_E_VER_2 */
350 
351 struct iwl_wowlan_gtk_status {
352 	u8 key_index;
353 	u8 reserved[3];
354 	u8 decrypt_key[16];
355 	u8 tkip_mic_key[8];
356 	struct iwl_wowlan_rsc_tsc_params_cmd rsc;
357 } __packed;
358 
359 struct iwl_wowlan_status {
360 	struct iwl_wowlan_gtk_status gtk;
361 	__le64 replay_ctr;
362 	__le16 pattern_number;
363 	__le16 non_qos_seq_ctr;
364 	__le16 qos_seq_ctr[8];
365 	__le32 wakeup_reasons;
366 	__le32 num_of_gtk_rekeys;
367 	__le32 transmitted_ndps;
368 	__le32 received_beacons;
369 	__le32 wake_packet_length;
370 	__le32 wake_packet_bufsize;
371 	u8 wake_packet[]; /* can be truncated from _length to _bufsize */
372 } __packed; /* WOWLAN_STATUSES_API_S_VER_6 */
373 
374 #define IWL_WOWLAN_TCP_MAX_PACKET_LEN		64
375 #define IWL_WOWLAN_REMOTE_WAKE_MAX_PACKET_LEN	128
376 #define IWL_WOWLAN_REMOTE_WAKE_MAX_TOKENS	2048
377 
378 struct iwl_tcp_packet_info {
379 	__le16 tcp_pseudo_header_checksum;
380 	__le16 tcp_payload_length;
381 } __packed; /* TCP_PACKET_INFO_API_S_VER_2 */
382 
383 struct iwl_tcp_packet {
384 	struct iwl_tcp_packet_info info;
385 	u8 rx_mask[IWL_WOWLAN_MAX_PATTERN_LEN / 8];
386 	u8 data[IWL_WOWLAN_TCP_MAX_PACKET_LEN];
387 } __packed; /* TCP_PROTOCOL_PACKET_API_S_VER_1 */
388 
389 struct iwl_remote_wake_packet {
390 	struct iwl_tcp_packet_info info;
391 	u8 rx_mask[IWL_WOWLAN_MAX_PATTERN_LEN / 8];
392 	u8 data[IWL_WOWLAN_REMOTE_WAKE_MAX_PACKET_LEN];
393 } __packed; /* TCP_PROTOCOL_PACKET_API_S_VER_1 */
394 
395 struct iwl_wowlan_remote_wake_config {
396 	__le32 connection_max_time; /* unused */
397 	/* TCP_PROTOCOL_CONFIG_API_S_VER_1 */
398 	u8 max_syn_retries;
399 	u8 max_data_retries;
400 	u8 tcp_syn_ack_timeout;
401 	u8 tcp_ack_timeout;
402 
403 	struct iwl_tcp_packet syn_tx;
404 	struct iwl_tcp_packet synack_rx;
405 	struct iwl_tcp_packet keepalive_ack_rx;
406 	struct iwl_tcp_packet fin_tx;
407 
408 	struct iwl_remote_wake_packet keepalive_tx;
409 	struct iwl_remote_wake_packet wake_rx;
410 
411 	/* REMOTE_WAKE_OFFSET_INFO_API_S_VER_1 */
412 	u8 sequence_number_offset;
413 	u8 sequence_number_length;
414 	u8 token_offset;
415 	u8 token_length;
416 	/* REMOTE_WAKE_PROTOCOL_PARAMS_API_S_VER_1 */
417 	__le32 initial_sequence_number;
418 	__le16 keepalive_interval;
419 	__le16 num_tokens;
420 	u8 tokens[IWL_WOWLAN_REMOTE_WAKE_MAX_TOKENS];
421 } __packed; /* REMOTE_WAKE_CONFIG_API_S_VER_2 */
422 
423 /* TODO: NetDetect API */
424 
425 #endif /* __fw_api_d3_h__ */
426