blob: 6f8b2c16ae171965253c0d7e0e149ab3ff0d52f6 [file] [log] [blame]
Johannes Berg8ca151b2013-01-24 14:25:36 +01001/******************************************************************************
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
Emmanuel Grumbach410dc5a2013-02-18 09:22:28 +020025 * in the file called COPYING.
Johannes Berg8ca151b2013-01-24 14:25:36 +010026 *
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 */
70enum 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
Johannes Bergdfcb4c32013-05-15 11:44:49 +020078 * @wakeup_host_timer: force wakeup after this many seconds
Johannes Berg8ca151b2013-01-24 14:25:36 +010079 *
80 * The structure is used for the D3_CONFIG_CMD command.
81 */
82struct iwl_d3_manager_config {
83 __le32 min_sleep_time;
84 __le32 wakeup_flags;
Johannes Bergdfcb4c32013-05-15 11:44:49 +020085 __le32 wakeup_host_timer;
86} __packed; /* D3_MANAGER_CONFIG_CMD_S_VER_4 */
Johannes Berg8ca151b2013-01-24 14:25:36 +010087
88
89/* TODO: OFFLOADS_QUERY_API_S_VER_1 */
90
91/**
92 * enum iwl_d3_proto_offloads - enabled protocol offloads
93 * @IWL_D3_PROTO_OFFLOAD_ARP: ARP data is enabled
94 * @IWL_D3_PROTO_OFFLOAD_NS: NS (Neighbor Solicitation) is enabled
95 */
96enum iwl_proto_offloads {
97 IWL_D3_PROTO_OFFLOAD_ARP = BIT(0),
98 IWL_D3_PROTO_OFFLOAD_NS = BIT(1),
99};
100
101#define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS 2
102
103/**
104 * struct iwl_proto_offload_cmd - ARP/NS offload configuration
105 * @enabled: enable flags
106 * @remote_ipv4_addr: remote address to answer to (or zero if all)
107 * @host_ipv4_addr: our IPv4 address to respond to queries for
108 * @arp_mac_addr: our MAC address for ARP responses
109 * @remote_ipv6_addr: remote address to answer to (or zero if all)
110 * @solicited_node_ipv6_addr: broken -- solicited node address exists
111 * for each target address
112 * @target_ipv6_addr: our target addresses
113 * @ndp_mac_addr: neighbor soliciation response MAC address
114 */
115struct iwl_proto_offload_cmd {
116 __le32 enabled;
117 __be32 remote_ipv4_addr;
118 __be32 host_ipv4_addr;
119 u8 arp_mac_addr[ETH_ALEN];
120 __le16 reserved1;
121
122 u8 remote_ipv6_addr[16];
123 u8 solicited_node_ipv6_addr[16];
124 u8 target_ipv6_addr[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS][16];
125 u8 ndp_mac_addr[ETH_ALEN];
126 __le16 reserved2;
127} __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_1 */
128
129
130/*
131 * WOWLAN_PATTERNS
132 */
133#define IWL_WOWLAN_MIN_PATTERN_LEN 16
134#define IWL_WOWLAN_MAX_PATTERN_LEN 128
135
136struct iwl_wowlan_pattern {
137 u8 mask[IWL_WOWLAN_MAX_PATTERN_LEN / 8];
138 u8 pattern[IWL_WOWLAN_MAX_PATTERN_LEN];
139 u8 mask_size;
140 u8 pattern_size;
141 __le16 reserved;
142} __packed; /* WOWLAN_PATTERN_API_S_VER_1 */
143
144#define IWL_WOWLAN_MAX_PATTERNS 20
145
146struct iwl_wowlan_patterns_cmd {
147 __le32 n_patterns;
148 struct iwl_wowlan_pattern patterns[];
149} __packed; /* WOWLAN_PATTERN_ARRAY_API_S_VER_1 */
150
151enum iwl_wowlan_wakeup_filters {
152 IWL_WOWLAN_WAKEUP_MAGIC_PACKET = BIT(0),
153 IWL_WOWLAN_WAKEUP_PATTERN_MATCH = BIT(1),
154 IWL_WOWLAN_WAKEUP_BEACON_MISS = BIT(2),
155 IWL_WOWLAN_WAKEUP_LINK_CHANGE = BIT(3),
156 IWL_WOWLAN_WAKEUP_GTK_REKEY_FAIL = BIT(4),
157 IWL_WOWLAN_WAKEUP_EAP_IDENT_REQ = BIT(5),
158 IWL_WOWLAN_WAKEUP_4WAY_HANDSHAKE = BIT(6),
159 IWL_WOWLAN_WAKEUP_ENABLE_NET_DETECT = BIT(7),
160 IWL_WOWLAN_WAKEUP_RF_KILL_DEASSERT = BIT(8),
161 IWL_WOWLAN_WAKEUP_REMOTE_LINK_LOSS = BIT(9),
162 IWL_WOWLAN_WAKEUP_REMOTE_SIGNATURE_TABLE = BIT(10),
163 /* BIT(11) reserved */
164 IWL_WOWLAN_WAKEUP_REMOTE_WAKEUP_PACKET = BIT(12),
165}; /* WOWLAN_WAKEUP_FILTER_API_E_VER_4 */
166
167struct iwl_wowlan_config_cmd {
168 __le32 wakeup_filter;
169 __le16 non_qos_seq;
170 __le16 qos_seq[8];
171 u8 wowlan_ba_teardown_tids;
172 u8 is_11n_connection;
173} __packed; /* WOWLAN_CONFIG_API_S_VER_2 */
174
175/*
176 * WOWLAN_TSC_RSC_PARAMS
177 */
178#define IWL_NUM_RSC 16
179
180struct tkip_sc {
181 __le16 iv16;
182 __le16 pad;
183 __le32 iv32;
184} __packed; /* TKIP_SC_API_U_VER_1 */
185
186struct iwl_tkip_rsc_tsc {
187 struct tkip_sc unicast_rsc[IWL_NUM_RSC];
188 struct tkip_sc multicast_rsc[IWL_NUM_RSC];
189 struct tkip_sc tsc;
190} __packed; /* TKIP_TSC_RSC_API_S_VER_1 */
191
192struct aes_sc {
193 __le64 pn;
194} __packed; /* TKIP_AES_SC_API_U_VER_1 */
195
196struct iwl_aes_rsc_tsc {
197 struct aes_sc unicast_rsc[IWL_NUM_RSC];
198 struct aes_sc multicast_rsc[IWL_NUM_RSC];
199 struct aes_sc tsc;
200} __packed; /* AES_TSC_RSC_API_S_VER_1 */
201
202union iwl_all_tsc_rsc {
203 struct iwl_tkip_rsc_tsc tkip;
204 struct iwl_aes_rsc_tsc aes;
205}; /* ALL_TSC_RSC_API_S_VER_2 */
206
207struct iwl_wowlan_rsc_tsc_params_cmd {
208 union iwl_all_tsc_rsc all_tsc_rsc;
209} __packed; /* ALL_TSC_RSC_API_S_VER_2 */
210
211#define IWL_MIC_KEY_SIZE 8
212struct iwl_mic_keys {
213 u8 tx[IWL_MIC_KEY_SIZE];
214 u8 rx_unicast[IWL_MIC_KEY_SIZE];
215 u8 rx_mcast[IWL_MIC_KEY_SIZE];
216} __packed; /* MIC_KEYS_API_S_VER_1 */
217
218#define IWL_P1K_SIZE 5
219struct iwl_p1k_cache {
220 __le16 p1k[IWL_P1K_SIZE];
221} __packed;
222
223#define IWL_NUM_RX_P1K_CACHE 2
224
225struct iwl_wowlan_tkip_params_cmd {
226 struct iwl_mic_keys mic_keys;
227 struct iwl_p1k_cache tx;
228 struct iwl_p1k_cache rx_uni[IWL_NUM_RX_P1K_CACHE];
229 struct iwl_p1k_cache rx_multi[IWL_NUM_RX_P1K_CACHE];
230} __packed; /* WOWLAN_TKIP_SETTING_API_S_VER_1 */
231
232#define IWL_KCK_MAX_SIZE 32
233#define IWL_KEK_MAX_SIZE 32
234
235struct iwl_wowlan_kek_kck_material_cmd {
236 u8 kck[IWL_KCK_MAX_SIZE];
237 u8 kek[IWL_KEK_MAX_SIZE];
238 __le16 kck_len;
239 __le16 kek_len;
240 __le64 replay_ctr;
241} __packed; /* KEK_KCK_MATERIAL_API_S_VER_2 */
242
243#define RF_KILL_INDICATOR_FOR_WOWLAN 0x87
244
245enum iwl_wowlan_rekey_status {
246 IWL_WOWLAN_REKEY_POST_REKEY = 0,
247 IWL_WOWLAN_REKEY_WHILE_REKEY = 1,
248}; /* WOWLAN_REKEY_STATUS_API_E_VER_1 */
249
250enum iwl_wowlan_wakeup_reason {
251 IWL_WOWLAN_WAKEUP_BY_NON_WIRELESS = 0,
252 IWL_WOWLAN_WAKEUP_BY_MAGIC_PACKET = BIT(0),
253 IWL_WOWLAN_WAKEUP_BY_PATTERN = BIT(1),
254 IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_MISSED_BEACON = BIT(2),
255 IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_DEAUTH = BIT(3),
256 IWL_WOWLAN_WAKEUP_BY_GTK_REKEY_FAILURE = BIT(4),
257 IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED = BIT(5),
258 IWL_WOWLAN_WAKEUP_BY_UCODE_ERROR = BIT(6),
259 IWL_WOWLAN_WAKEUP_BY_EAPOL_REQUEST = BIT(7),
260 IWL_WOWLAN_WAKEUP_BY_FOUR_WAY_HANDSHAKE = BIT(8),
261 IWL_WOWLAN_WAKEUP_BY_REM_WAKE_LINK_LOSS = BIT(9),
262 IWL_WOWLAN_WAKEUP_BY_REM_WAKE_SIGNATURE_TABLE = BIT(10),
Johannes Bergf0c26462013-01-22 20:41:58 +0100263 /* BIT(11) reserved */
Johannes Berg8ca151b2013-01-24 14:25:36 +0100264 IWL_WOWLAN_WAKEUP_BY_REM_WAKE_WAKEUP_PACKET = BIT(12),
265}; /* WOWLAN_WAKE_UP_REASON_API_E_VER_2 */
266
267struct iwl_wowlan_status {
268 __le64 replay_ctr;
269 __le16 pattern_number;
270 __le16 non_qos_seq_ctr;
271 __le16 qos_seq_ctr[8];
272 __le32 wakeup_reasons;
273 __le32 rekey_status;
274 __le32 num_of_gtk_rekeys;
275 __le32 transmitted_ndps;
276 __le32 received_beacons;
277 __le32 wake_packet_length;
278 __le32 wake_packet_bufsize;
279 u8 wake_packet[]; /* can be truncated from _length to _bufsize */
280} __packed; /* WOWLAN_STATUSES_API_S_VER_4 */
281
Johannes Bergf0c26462013-01-22 20:41:58 +0100282#define IWL_WOWLAN_TCP_MAX_PACKET_LEN 64
283#define IWL_WOWLAN_REMOTE_WAKE_MAX_PACKET_LEN 128
284#define IWL_WOWLAN_REMOTE_WAKE_MAX_TOKENS 2048
285
286struct iwl_tcp_packet_info {
287 __le16 tcp_pseudo_header_checksum;
288 __le16 tcp_payload_length;
289} __packed; /* TCP_PACKET_INFO_API_S_VER_2 */
290
291struct iwl_tcp_packet {
292 struct iwl_tcp_packet_info info;
293 u8 rx_mask[IWL_WOWLAN_MAX_PATTERN_LEN / 8];
294 u8 data[IWL_WOWLAN_TCP_MAX_PACKET_LEN];
295} __packed; /* TCP_PROTOCOL_PACKET_API_S_VER_1 */
296
297struct iwl_remote_wake_packet {
298 struct iwl_tcp_packet_info info;
299 u8 rx_mask[IWL_WOWLAN_MAX_PATTERN_LEN / 8];
300 u8 data[IWL_WOWLAN_REMOTE_WAKE_MAX_PACKET_LEN];
301} __packed; /* TCP_PROTOCOL_PACKET_API_S_VER_1 */
302
303struct iwl_wowlan_remote_wake_config {
304 __le32 connection_max_time; /* unused */
305 /* TCP_PROTOCOL_CONFIG_API_S_VER_1 */
306 u8 max_syn_retries;
307 u8 max_data_retries;
308 u8 tcp_syn_ack_timeout;
309 u8 tcp_ack_timeout;
310
311 struct iwl_tcp_packet syn_tx;
312 struct iwl_tcp_packet synack_rx;
313 struct iwl_tcp_packet keepalive_ack_rx;
314 struct iwl_tcp_packet fin_tx;
315
316 struct iwl_remote_wake_packet keepalive_tx;
317 struct iwl_remote_wake_packet wake_rx;
318
319 /* REMOTE_WAKE_OFFSET_INFO_API_S_VER_1 */
320 u8 sequence_number_offset;
321 u8 sequence_number_length;
322 u8 token_offset;
323 u8 token_length;
324 /* REMOTE_WAKE_PROTOCOL_PARAMS_API_S_VER_1 */
325 __le32 initial_sequence_number;
326 __le16 keepalive_interval;
327 __le16 num_tokens;
328 u8 tokens[IWL_WOWLAN_REMOTE_WAKE_MAX_TOKENS];
329} __packed; /* REMOTE_WAKE_CONFIG_API_S_VER_2 */
330
Johannes Berg8ca151b2013-01-24 14:25:36 +0100331/* TODO: NetDetect API */
332
333#endif /* __fw_api_d3_h__ */