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