]> Pileus Git - ~andy/linux/blob - drivers/net/wireless/iwlwifi/mvm/fw-api-d3.h
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec...
[~andy/linux] / drivers / net / wireless / iwlwifi / mvm / fw-api-d3.h
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  *
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 - 2014 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  * @wakeup_host_timer: force wakeup after this many seconds
79  *
80  * The structure is used for the D3_CONFIG_CMD command.
81  */
82 struct iwl_d3_manager_config {
83         __le32 min_sleep_time;
84         __le32 wakeup_flags;
85         __le32 wakeup_host_timer;
86 } __packed; /* D3_MANAGER_CONFIG_CMD_S_VER_4 */
87
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  */
96 enum 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_V1     2
102 #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V2     6
103 #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L    12
104 #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3S    4
105 #define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX    12
106
107 #define IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L     4
108 #define IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3S     2
109
110 /**
111  * struct iwl_proto_offload_cmd_common - ARP/NS offload common part
112  * @enabled: enable flags
113  * @remote_ipv4_addr: remote address to answer to (or zero if all)
114  * @host_ipv4_addr: our IPv4 address to respond to queries for
115  * @arp_mac_addr: our MAC address for ARP responses
116  * @reserved: unused
117  */
118 struct iwl_proto_offload_cmd_common {
119         __le32 enabled;
120         __be32 remote_ipv4_addr;
121         __be32 host_ipv4_addr;
122         u8 arp_mac_addr[ETH_ALEN];
123         __le16 reserved;
124 } __packed;
125
126 /**
127  * struct iwl_proto_offload_cmd_v1 - ARP/NS offload configuration
128  * @common: common/IPv4 configuration
129  * @remote_ipv6_addr: remote address to answer to (or zero if all)
130  * @solicited_node_ipv6_addr: broken -- solicited node address exists
131  *      for each target address
132  * @target_ipv6_addr: our target addresses
133  * @ndp_mac_addr: neighbor soliciation response MAC address
134  */
135 struct iwl_proto_offload_cmd_v1 {
136         struct iwl_proto_offload_cmd_common common;
137         u8 remote_ipv6_addr[16];
138         u8 solicited_node_ipv6_addr[16];
139         u8 target_ipv6_addr[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V1][16];
140         u8 ndp_mac_addr[ETH_ALEN];
141         __le16 reserved2;
142 } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_1 */
143
144 /**
145  * struct iwl_proto_offload_cmd_v2 - ARP/NS offload configuration
146  * @common: common/IPv4 configuration
147  * @remote_ipv6_addr: remote address to answer to (or zero if all)
148  * @solicited_node_ipv6_addr: broken -- solicited node address exists
149  *      for each target address
150  * @target_ipv6_addr: our target addresses
151  * @ndp_mac_addr: neighbor soliciation response MAC address
152  */
153 struct iwl_proto_offload_cmd_v2 {
154         struct iwl_proto_offload_cmd_common common;
155         u8 remote_ipv6_addr[16];
156         u8 solicited_node_ipv6_addr[16];
157         u8 target_ipv6_addr[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V2][16];
158         u8 ndp_mac_addr[ETH_ALEN];
159         u8 numValidIPv6Addresses;
160         u8 reserved2[3];
161 } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_2 */
162
163 struct iwl_ns_config {
164         struct in6_addr source_ipv6_addr;
165         struct in6_addr dest_ipv6_addr;
166         u8 target_mac_addr[ETH_ALEN];
167         __le16 reserved;
168 } __packed; /* NS_OFFLOAD_CONFIG */
169
170 struct iwl_targ_addr {
171         struct in6_addr addr;
172         __le32 config_num;
173 } __packed; /* TARGET_IPV6_ADDRESS */
174
175 /**
176  * struct iwl_proto_offload_cmd_v3_small - ARP/NS offload configuration
177  * @common: common/IPv4 configuration
178  * @target_ipv6_addr: target IPv6 addresses
179  * @ns_config: NS offload configurations
180  */
181 struct iwl_proto_offload_cmd_v3_small {
182         struct iwl_proto_offload_cmd_common common;
183         __le32 num_valid_ipv6_addrs;
184         struct iwl_targ_addr targ_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3S];
185         struct iwl_ns_config ns_config[IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3S];
186 } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_3 */
187
188 /**
189  * struct iwl_proto_offload_cmd_v3_large - ARP/NS offload configuration
190  * @common: common/IPv4 configuration
191  * @target_ipv6_addr: target IPv6 addresses
192  * @ns_config: NS offload configurations
193  */
194 struct iwl_proto_offload_cmd_v3_large {
195         struct iwl_proto_offload_cmd_common common;
196         __le32 num_valid_ipv6_addrs;
197         struct iwl_targ_addr targ_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L];
198         struct iwl_ns_config ns_config[IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L];
199 } __packed; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_3 */
200
201 /*
202  * WOWLAN_PATTERNS
203  */
204 #define IWL_WOWLAN_MIN_PATTERN_LEN      16
205 #define IWL_WOWLAN_MAX_PATTERN_LEN      128
206
207 struct iwl_wowlan_pattern {
208         u8 mask[IWL_WOWLAN_MAX_PATTERN_LEN / 8];
209         u8 pattern[IWL_WOWLAN_MAX_PATTERN_LEN];
210         u8 mask_size;
211         u8 pattern_size;
212         __le16 reserved;
213 } __packed; /* WOWLAN_PATTERN_API_S_VER_1 */
214
215 #define IWL_WOWLAN_MAX_PATTERNS 20
216
217 struct iwl_wowlan_patterns_cmd {
218         __le32 n_patterns;
219         struct iwl_wowlan_pattern patterns[];
220 } __packed; /* WOWLAN_PATTERN_ARRAY_API_S_VER_1 */
221
222 enum iwl_wowlan_wakeup_filters {
223         IWL_WOWLAN_WAKEUP_MAGIC_PACKET                  = BIT(0),
224         IWL_WOWLAN_WAKEUP_PATTERN_MATCH                 = BIT(1),
225         IWL_WOWLAN_WAKEUP_BEACON_MISS                   = BIT(2),
226         IWL_WOWLAN_WAKEUP_LINK_CHANGE                   = BIT(3),
227         IWL_WOWLAN_WAKEUP_GTK_REKEY_FAIL                = BIT(4),
228         IWL_WOWLAN_WAKEUP_EAP_IDENT_REQ                 = BIT(5),
229         IWL_WOWLAN_WAKEUP_4WAY_HANDSHAKE                = BIT(6),
230         IWL_WOWLAN_WAKEUP_ENABLE_NET_DETECT             = BIT(7),
231         IWL_WOWLAN_WAKEUP_RF_KILL_DEASSERT              = BIT(8),
232         IWL_WOWLAN_WAKEUP_REMOTE_LINK_LOSS              = BIT(9),
233         IWL_WOWLAN_WAKEUP_REMOTE_SIGNATURE_TABLE        = BIT(10),
234         /* BIT(11) reserved */
235         IWL_WOWLAN_WAKEUP_REMOTE_WAKEUP_PACKET          = BIT(12),
236 }; /* WOWLAN_WAKEUP_FILTER_API_E_VER_4 */
237
238 struct iwl_wowlan_config_cmd {
239         __le32 wakeup_filter;
240         __le16 non_qos_seq;
241         __le16 qos_seq[8];
242         u8 wowlan_ba_teardown_tids;
243         u8 is_11n_connection;
244 } __packed; /* WOWLAN_CONFIG_API_S_VER_2 */
245
246 /*
247  * WOWLAN_TSC_RSC_PARAMS
248  */
249 #define IWL_NUM_RSC     16
250
251 struct tkip_sc {
252         __le16 iv16;
253         __le16 pad;
254         __le32 iv32;
255 } __packed; /* TKIP_SC_API_U_VER_1 */
256
257 struct iwl_tkip_rsc_tsc {
258         struct tkip_sc unicast_rsc[IWL_NUM_RSC];
259         struct tkip_sc multicast_rsc[IWL_NUM_RSC];
260         struct tkip_sc tsc;
261 } __packed; /* TKIP_TSC_RSC_API_S_VER_1 */
262
263 struct aes_sc {
264         __le64 pn;
265 } __packed; /* TKIP_AES_SC_API_U_VER_1 */
266
267 struct iwl_aes_rsc_tsc {
268         struct aes_sc unicast_rsc[IWL_NUM_RSC];
269         struct aes_sc multicast_rsc[IWL_NUM_RSC];
270         struct aes_sc tsc;
271 } __packed; /* AES_TSC_RSC_API_S_VER_1 */
272
273 union iwl_all_tsc_rsc {
274         struct iwl_tkip_rsc_tsc tkip;
275         struct iwl_aes_rsc_tsc aes;
276 }; /* ALL_TSC_RSC_API_S_VER_2 */
277
278 struct iwl_wowlan_rsc_tsc_params_cmd {
279         union iwl_all_tsc_rsc all_tsc_rsc;
280 } __packed; /* ALL_TSC_RSC_API_S_VER_2 */
281
282 #define IWL_MIC_KEY_SIZE        8
283 struct iwl_mic_keys {
284         u8 tx[IWL_MIC_KEY_SIZE];
285         u8 rx_unicast[IWL_MIC_KEY_SIZE];
286         u8 rx_mcast[IWL_MIC_KEY_SIZE];
287 } __packed; /* MIC_KEYS_API_S_VER_1 */
288
289 #define IWL_P1K_SIZE            5
290 struct iwl_p1k_cache {
291         __le16 p1k[IWL_P1K_SIZE];
292 } __packed;
293
294 #define IWL_NUM_RX_P1K_CACHE    2
295
296 struct iwl_wowlan_tkip_params_cmd {
297         struct iwl_mic_keys mic_keys;
298         struct iwl_p1k_cache tx;
299         struct iwl_p1k_cache rx_uni[IWL_NUM_RX_P1K_CACHE];
300         struct iwl_p1k_cache rx_multi[IWL_NUM_RX_P1K_CACHE];
301 } __packed; /* WOWLAN_TKIP_SETTING_API_S_VER_1 */
302
303 #define IWL_KCK_MAX_SIZE        32
304 #define IWL_KEK_MAX_SIZE        32
305
306 struct iwl_wowlan_kek_kck_material_cmd {
307         u8      kck[IWL_KCK_MAX_SIZE];
308         u8      kek[IWL_KEK_MAX_SIZE];
309         __le16  kck_len;
310         __le16  kek_len;
311         __le64  replay_ctr;
312 } __packed; /* KEK_KCK_MATERIAL_API_S_VER_2 */
313
314 #define RF_KILL_INDICATOR_FOR_WOWLAN    0x87
315
316 enum iwl_wowlan_rekey_status {
317         IWL_WOWLAN_REKEY_POST_REKEY = 0,
318         IWL_WOWLAN_REKEY_WHILE_REKEY = 1,
319 }; /* WOWLAN_REKEY_STATUS_API_E_VER_1 */
320
321 enum iwl_wowlan_wakeup_reason {
322         IWL_WOWLAN_WAKEUP_BY_NON_WIRELESS                       = 0,
323         IWL_WOWLAN_WAKEUP_BY_MAGIC_PACKET                       = BIT(0),
324         IWL_WOWLAN_WAKEUP_BY_PATTERN                            = BIT(1),
325         IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_MISSED_BEACON     = BIT(2),
326         IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_DEAUTH            = BIT(3),
327         IWL_WOWLAN_WAKEUP_BY_GTK_REKEY_FAILURE                  = BIT(4),
328         IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED                  = BIT(5),
329         IWL_WOWLAN_WAKEUP_BY_UCODE_ERROR                        = BIT(6),
330         IWL_WOWLAN_WAKEUP_BY_EAPOL_REQUEST                      = BIT(7),
331         IWL_WOWLAN_WAKEUP_BY_FOUR_WAY_HANDSHAKE                 = BIT(8),
332         IWL_WOWLAN_WAKEUP_BY_REM_WAKE_LINK_LOSS                 = BIT(9),
333         IWL_WOWLAN_WAKEUP_BY_REM_WAKE_SIGNATURE_TABLE           = BIT(10),
334         /* BIT(11) reserved */
335         IWL_WOWLAN_WAKEUP_BY_REM_WAKE_WAKEUP_PACKET             = BIT(12),
336 }; /* WOWLAN_WAKE_UP_REASON_API_E_VER_2 */
337
338 struct iwl_wowlan_status_v4 {
339         __le64 replay_ctr;
340         __le16 pattern_number;
341         __le16 non_qos_seq_ctr;
342         __le16 qos_seq_ctr[8];
343         __le32 wakeup_reasons;
344         __le32 rekey_status;
345         __le32 num_of_gtk_rekeys;
346         __le32 transmitted_ndps;
347         __le32 received_beacons;
348         __le32 wake_packet_length;
349         __le32 wake_packet_bufsize;
350         u8 wake_packet[]; /* can be truncated from _length to _bufsize */
351 } __packed; /* WOWLAN_STATUSES_API_S_VER_4 */
352
353 struct iwl_wowlan_gtk_status {
354         u8 key_index;
355         u8 reserved[3];
356         u8 decrypt_key[16];
357         u8 tkip_mic_key[8];
358         struct iwl_wowlan_rsc_tsc_params_cmd rsc;
359 } __packed;
360
361 struct iwl_wowlan_status_v6 {
362         struct iwl_wowlan_gtk_status gtk;
363         __le64 replay_ctr;
364         __le16 pattern_number;
365         __le16 non_qos_seq_ctr;
366         __le16 qos_seq_ctr[8];
367         __le32 wakeup_reasons;
368         __le32 num_of_gtk_rekeys;
369         __le32 transmitted_ndps;
370         __le32 received_beacons;
371         __le32 wake_packet_length;
372         __le32 wake_packet_bufsize;
373         u8 wake_packet[]; /* can be truncated from _length to _bufsize */
374 } __packed; /* WOWLAN_STATUSES_API_S_VER_6 */
375
376 #define IWL_WOWLAN_TCP_MAX_PACKET_LEN           64
377 #define IWL_WOWLAN_REMOTE_WAKE_MAX_PACKET_LEN   128
378 #define IWL_WOWLAN_REMOTE_WAKE_MAX_TOKENS       2048
379
380 struct iwl_tcp_packet_info {
381         __le16 tcp_pseudo_header_checksum;
382         __le16 tcp_payload_length;
383 } __packed; /* TCP_PACKET_INFO_API_S_VER_2 */
384
385 struct iwl_tcp_packet {
386         struct iwl_tcp_packet_info info;
387         u8 rx_mask[IWL_WOWLAN_MAX_PATTERN_LEN / 8];
388         u8 data[IWL_WOWLAN_TCP_MAX_PACKET_LEN];
389 } __packed; /* TCP_PROTOCOL_PACKET_API_S_VER_1 */
390
391 struct iwl_remote_wake_packet {
392         struct iwl_tcp_packet_info info;
393         u8 rx_mask[IWL_WOWLAN_MAX_PATTERN_LEN / 8];
394         u8 data[IWL_WOWLAN_REMOTE_WAKE_MAX_PACKET_LEN];
395 } __packed; /* TCP_PROTOCOL_PACKET_API_S_VER_1 */
396
397 struct iwl_wowlan_remote_wake_config {
398         __le32 connection_max_time; /* unused */
399         /* TCP_PROTOCOL_CONFIG_API_S_VER_1 */
400         u8 max_syn_retries;
401         u8 max_data_retries;
402         u8 tcp_syn_ack_timeout;
403         u8 tcp_ack_timeout;
404
405         struct iwl_tcp_packet syn_tx;
406         struct iwl_tcp_packet synack_rx;
407         struct iwl_tcp_packet keepalive_ack_rx;
408         struct iwl_tcp_packet fin_tx;
409
410         struct iwl_remote_wake_packet keepalive_tx;
411         struct iwl_remote_wake_packet wake_rx;
412
413         /* REMOTE_WAKE_OFFSET_INFO_API_S_VER_1 */
414         u8 sequence_number_offset;
415         u8 sequence_number_length;
416         u8 token_offset;
417         u8 token_length;
418         /* REMOTE_WAKE_PROTOCOL_PARAMS_API_S_VER_1 */
419         __le32 initial_sequence_number;
420         __le16 keepalive_interval;
421         __le16 num_tokens;
422         u8 tokens[IWL_WOWLAN_REMOTE_WAKE_MAX_TOKENS];
423 } __packed; /* REMOTE_WAKE_CONFIG_API_S_VER_2 */
424
425 /* TODO: NetDetect API */
426
427 #endif /* __fw_api_d3_h__ */