1
2
3
4
5
6
7#ifndef __iwl_fw_api_d3_h__
8#define __iwl_fw_api_d3_h__
9#include <iwl-trans.h>
10
11
12
13
14
15enum iwl_d0i3_flags {
16 IWL_D0I3_RESET_REQUIRE = BIT(0),
17};
18
19
20
21
22
23enum iwl_d3_wakeup_flags {
24 IWL_WAKEUP_D3_CONFIG_FW_ERROR = BIT(0),
25};
26
27
28
29
30
31
32
33
34
35struct iwl_d3_manager_config {
36 __le32 min_sleep_time;
37 __le32 wakeup_flags;
38 __le32 wakeup_host_timer;
39} __packed;
40
41
42
43
44
45
46
47
48
49
50
51enum iwl_proto_offloads {
52 IWL_D3_PROTO_OFFLOAD_ARP = BIT(0),
53 IWL_D3_PROTO_OFFLOAD_NS = BIT(1),
54 IWL_D3_PROTO_IPV4_VALID = BIT(2),
55 IWL_D3_PROTO_IPV6_VALID = BIT(3),
56};
57
58#define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V1 2
59#define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V2 6
60#define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L 12
61#define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3S 4
62#define IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_MAX 12
63
64#define IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L 4
65#define IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3S 2
66
67
68
69
70
71
72
73
74
75struct iwl_proto_offload_cmd_common {
76 __le32 enabled;
77 __be32 remote_ipv4_addr;
78 __be32 host_ipv4_addr;
79 u8 arp_mac_addr[ETH_ALEN];
80 __le16 reserved;
81} __packed;
82
83
84
85
86
87
88
89
90
91
92
93struct iwl_proto_offload_cmd_v1 {
94 struct iwl_proto_offload_cmd_common common;
95 u8 remote_ipv6_addr[16];
96 u8 solicited_node_ipv6_addr[16];
97 u8 target_ipv6_addr[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V1][16];
98 u8 ndp_mac_addr[ETH_ALEN];
99 __le16 reserved2;
100} __packed;
101
102
103
104
105
106
107
108
109
110
111
112
113struct iwl_proto_offload_cmd_v2 {
114 struct iwl_proto_offload_cmd_common common;
115 u8 remote_ipv6_addr[16];
116 u8 solicited_node_ipv6_addr[16];
117 u8 target_ipv6_addr[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V2][16];
118 u8 ndp_mac_addr[ETH_ALEN];
119 u8 num_valid_ipv6_addrs;
120 u8 reserved2[3];
121} __packed;
122
123struct iwl_ns_config {
124 struct in6_addr source_ipv6_addr;
125 struct in6_addr dest_ipv6_addr;
126 u8 target_mac_addr[ETH_ALEN];
127 __le16 reserved;
128} __packed;
129
130struct iwl_targ_addr {
131 struct in6_addr addr;
132 __le32 config_num;
133} __packed;
134
135
136
137
138
139
140
141
142struct iwl_proto_offload_cmd_v3_small {
143 struct iwl_proto_offload_cmd_common common;
144 __le32 num_valid_ipv6_addrs;
145 struct iwl_targ_addr targ_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3S];
146 struct iwl_ns_config ns_config[IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3S];
147} __packed;
148
149
150
151
152
153
154
155
156struct iwl_proto_offload_cmd_v3_large {
157 struct iwl_proto_offload_cmd_common common;
158 __le32 num_valid_ipv6_addrs;
159 struct iwl_targ_addr targ_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L];
160 struct iwl_ns_config ns_config[IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L];
161} __packed;
162
163
164
165
166
167
168
169
170
171struct iwl_proto_offload_cmd_v4 {
172 __le32 sta_id;
173 struct iwl_proto_offload_cmd_common common;
174 __le32 num_valid_ipv6_addrs;
175 struct iwl_targ_addr targ_addrs[IWL_PROTO_OFFLOAD_NUM_IPV6_ADDRS_V3L];
176 struct iwl_ns_config ns_config[IWL_PROTO_OFFLOAD_NUM_NS_CONFIG_V3L];
177} __packed;
178
179
180
181
182#define IWL_WOWLAN_MIN_PATTERN_LEN 16
183#define IWL_WOWLAN_MAX_PATTERN_LEN 128
184
185struct iwl_wowlan_pattern_v1 {
186 u8 mask[IWL_WOWLAN_MAX_PATTERN_LEN / 8];
187 u8 pattern[IWL_WOWLAN_MAX_PATTERN_LEN];
188 u8 mask_size;
189 u8 pattern_size;
190 __le16 reserved;
191} __packed;
192
193#define IWL_WOWLAN_MAX_PATTERNS 20
194
195
196
197
198struct iwl_wowlan_patterns_cmd_v1 {
199
200
201
202 __le32 n_patterns;
203
204
205
206
207 struct iwl_wowlan_pattern_v1 patterns[];
208} __packed;
209
210#define IPV4_ADDR_SIZE 4
211#define IPV6_ADDR_SIZE 16
212
213enum iwl_wowlan_pattern_type {
214 WOWLAN_PATTERN_TYPE_BITMASK,
215 WOWLAN_PATTERN_TYPE_IPV4_TCP_SYN,
216 WOWLAN_PATTERN_TYPE_IPV6_TCP_SYN,
217 WOWLAN_PATTERN_TYPE_IPV4_TCP_SYN_WILDCARD,
218 WOWLAN_PATTERN_TYPE_IPV6_TCP_SYN_WILDCARD,
219};
220
221
222
223
224struct iwl_wowlan_ipv4_tcp_syn {
225
226
227
228 u8 src_addr[IPV4_ADDR_SIZE];
229
230
231
232
233 u8 dst_addr[IPV4_ADDR_SIZE];
234
235
236
237
238 __le16 src_port;
239
240
241
242
243 __le16 dst_port;
244} __packed;
245
246
247
248
249struct iwl_wowlan_ipv6_tcp_syn {
250
251
252
253 u8 src_addr[IPV6_ADDR_SIZE];
254
255
256
257
258 u8 dst_addr[IPV6_ADDR_SIZE];
259
260
261
262
263 __le16 src_port;
264
265
266
267
268 __le16 dst_port;
269} __packed;
270
271
272
273
274
275
276
277union iwl_wowlan_pattern_data {
278
279
280
281 struct iwl_wowlan_pattern_v1 bitmask;
282
283
284
285
286 struct iwl_wowlan_ipv4_tcp_syn ipv4_tcp_syn;
287
288
289
290
291 struct iwl_wowlan_ipv6_tcp_syn ipv6_tcp_syn;
292};
293
294
295
296
297struct iwl_wowlan_pattern_v2 {
298
299
300
301 u8 pattern_type;
302
303
304
305
306 u8 reserved[3];
307
308
309
310
311
312 union iwl_wowlan_pattern_data u;
313} __packed;
314
315
316
317
318struct iwl_wowlan_patterns_cmd {
319
320
321
322 u8 n_patterns;
323
324
325
326
327 u8 sta_id;
328
329
330
331
332 __le16 reserved;
333
334
335
336
337 struct iwl_wowlan_pattern_v2 patterns[];
338} __packed;
339
340enum iwl_wowlan_wakeup_filters {
341 IWL_WOWLAN_WAKEUP_MAGIC_PACKET = BIT(0),
342 IWL_WOWLAN_WAKEUP_PATTERN_MATCH = BIT(1),
343 IWL_WOWLAN_WAKEUP_BEACON_MISS = BIT(2),
344 IWL_WOWLAN_WAKEUP_LINK_CHANGE = BIT(3),
345 IWL_WOWLAN_WAKEUP_GTK_REKEY_FAIL = BIT(4),
346 IWL_WOWLAN_WAKEUP_EAP_IDENT_REQ = BIT(5),
347 IWL_WOWLAN_WAKEUP_4WAY_HANDSHAKE = BIT(6),
348 IWL_WOWLAN_WAKEUP_ENABLE_NET_DETECT = BIT(7),
349 IWL_WOWLAN_WAKEUP_RF_KILL_DEASSERT = BIT(8),
350 IWL_WOWLAN_WAKEUP_REMOTE_LINK_LOSS = BIT(9),
351 IWL_WOWLAN_WAKEUP_REMOTE_SIGNATURE_TABLE = BIT(10),
352 IWL_WOWLAN_WAKEUP_REMOTE_TCP_EXTERNAL = BIT(11),
353 IWL_WOWLAN_WAKEUP_REMOTE_WAKEUP_PACKET = BIT(12),
354 IWL_WOWLAN_WAKEUP_IOAC_MAGIC_PACKET = BIT(13),
355 IWL_WOWLAN_WAKEUP_HOST_TIMER = BIT(14),
356 IWL_WOWLAN_WAKEUP_RX_FRAME = BIT(15),
357 IWL_WOWLAN_WAKEUP_BCN_FILTERING = BIT(16),
358};
359
360enum iwl_wowlan_flags {
361 IS_11W_ASSOC = BIT(0),
362 ENABLE_L3_FILTERING = BIT(1),
363 ENABLE_NBNS_FILTERING = BIT(2),
364 ENABLE_DHCP_FILTERING = BIT(3),
365 ENABLE_STORE_BEACON = BIT(4),
366};
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381struct iwl_wowlan_config_cmd {
382 __le32 wakeup_filter;
383 __le16 non_qos_seq;
384 __le16 qos_seq[8];
385 u8 wowlan_ba_teardown_tids;
386 u8 is_11n_connection;
387 u8 offloading_tid;
388 u8 flags;
389 u8 sta_id;
390 u8 reserved;
391} __packed;
392
393#define IWL_NUM_RSC 16
394#define WOWLAN_KEY_MAX_SIZE 32
395#define WOWLAN_GTK_KEYS_NUM 2
396#define WOWLAN_IGTK_KEYS_NUM 2
397
398
399
400
401struct tkip_sc {
402 __le16 iv16;
403 __le16 pad;
404 __le32 iv32;
405} __packed;
406
407struct iwl_tkip_rsc_tsc {
408 struct tkip_sc unicast_rsc[IWL_NUM_RSC];
409 struct tkip_sc multicast_rsc[IWL_NUM_RSC];
410 struct tkip_sc tsc;
411} __packed;
412
413struct aes_sc {
414 __le64 pn;
415} __packed;
416
417struct iwl_aes_rsc_tsc {
418 struct aes_sc unicast_rsc[IWL_NUM_RSC];
419 struct aes_sc multicast_rsc[IWL_NUM_RSC];
420 struct aes_sc tsc;
421} __packed;
422
423union iwl_all_tsc_rsc {
424 struct iwl_tkip_rsc_tsc tkip;
425 struct iwl_aes_rsc_tsc aes;
426};
427
428struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 {
429 union iwl_all_tsc_rsc all_tsc_rsc;
430} __packed;
431
432struct iwl_wowlan_rsc_tsc_params_cmd_v4 {
433 struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 params;
434 __le32 sta_id;
435} __packed;
436
437struct iwl_wowlan_rsc_tsc_params_cmd {
438 __le64 ucast_rsc[IWL_MAX_TID_COUNT];
439 __le64 mcast_rsc[WOWLAN_GTK_KEYS_NUM][IWL_MAX_TID_COUNT];
440 __le32 sta_id;
441#define IWL_MCAST_KEY_MAP_INVALID 0xff
442 u8 mcast_key_id_map[4];
443} __packed;
444
445#define IWL_MIC_KEY_SIZE 8
446struct iwl_mic_keys {
447 u8 tx[IWL_MIC_KEY_SIZE];
448 u8 rx_unicast[IWL_MIC_KEY_SIZE];
449 u8 rx_mcast[IWL_MIC_KEY_SIZE];
450} __packed;
451
452#define IWL_P1K_SIZE 5
453struct iwl_p1k_cache {
454 __le16 p1k[IWL_P1K_SIZE];
455} __packed;
456
457#define IWL_NUM_RX_P1K_CACHE 2
458
459struct iwl_wowlan_tkip_params_cmd_ver_1 {
460 struct iwl_mic_keys mic_keys;
461 struct iwl_p1k_cache tx;
462 struct iwl_p1k_cache rx_uni[IWL_NUM_RX_P1K_CACHE];
463 struct iwl_p1k_cache rx_multi[IWL_NUM_RX_P1K_CACHE];
464} __packed;
465
466struct iwl_wowlan_tkip_params_cmd {
467 struct iwl_mic_keys mic_keys;
468 struct iwl_p1k_cache tx;
469 struct iwl_p1k_cache rx_uni[IWL_NUM_RX_P1K_CACHE];
470 struct iwl_p1k_cache rx_multi[IWL_NUM_RX_P1K_CACHE];
471 u8 reversed[2];
472 __le32 sta_id;
473} __packed;
474
475#define IWL_KCK_MAX_SIZE 32
476#define IWL_KEK_MAX_SIZE 32
477
478struct iwl_wowlan_kek_kck_material_cmd_v2 {
479 u8 kck[IWL_KCK_MAX_SIZE];
480 u8 kek[IWL_KEK_MAX_SIZE];
481 __le16 kck_len;
482 __le16 kek_len;
483 __le64 replay_ctr;
484} __packed;
485
486struct iwl_wowlan_kek_kck_material_cmd_v3 {
487 u8 kck[IWL_KCK_MAX_SIZE];
488 u8 kek[IWL_KEK_MAX_SIZE];
489 __le16 kck_len;
490 __le16 kek_len;
491 __le64 replay_ctr;
492 __le32 akm;
493 __le32 gtk_cipher;
494 __le32 igtk_cipher;
495 __le32 bigtk_cipher;
496} __packed;
497
498struct iwl_wowlan_kek_kck_material_cmd_v4 {
499 __le32 sta_id;
500 u8 kck[IWL_KCK_MAX_SIZE];
501 u8 kek[IWL_KEK_MAX_SIZE];
502 __le16 kck_len;
503 __le16 kek_len;
504 __le64 replay_ctr;
505 __le32 akm;
506 __le32 gtk_cipher;
507 __le32 igtk_cipher;
508 __le32 bigtk_cipher;
509} __packed;
510
511struct iwl_wowlan_get_status_cmd {
512 __le32 sta_id;
513} __packed;
514
515#define RF_KILL_INDICATOR_FOR_WOWLAN 0x87
516
517enum iwl_wowlan_rekey_status {
518 IWL_WOWLAN_REKEY_POST_REKEY = 0,
519 IWL_WOWLAN_REKEY_WHILE_REKEY = 1,
520};
521
522enum iwl_wowlan_wakeup_reason {
523 IWL_WOWLAN_WAKEUP_BY_NON_WIRELESS = 0,
524 IWL_WOWLAN_WAKEUP_BY_MAGIC_PACKET = BIT(0),
525 IWL_WOWLAN_WAKEUP_BY_PATTERN = BIT(1),
526 IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_MISSED_BEACON = BIT(2),
527 IWL_WOWLAN_WAKEUP_BY_DISCONNECTION_ON_DEAUTH = BIT(3),
528 IWL_WOWLAN_WAKEUP_BY_GTK_REKEY_FAILURE = BIT(4),
529 IWL_WOWLAN_WAKEUP_BY_RFKILL_DEASSERTED = BIT(5),
530 IWL_WOWLAN_WAKEUP_BY_UCODE_ERROR = BIT(6),
531 IWL_WOWLAN_WAKEUP_BY_EAPOL_REQUEST = BIT(7),
532 IWL_WOWLAN_WAKEUP_BY_FOUR_WAY_HANDSHAKE = BIT(8),
533 IWL_WOWLAN_WAKEUP_BY_REM_WAKE_LINK_LOSS = BIT(9),
534 IWL_WOWLAN_WAKEUP_BY_REM_WAKE_SIGNATURE_TABLE = BIT(10),
535 IWL_WOWLAN_WAKEUP_BY_REM_WAKE_TCP_EXTERNAL = BIT(11),
536 IWL_WOWLAN_WAKEUP_BY_REM_WAKE_WAKEUP_PACKET = BIT(12),
537 IWL_WOWLAN_WAKEUP_BY_IOAC_MAGIC_PACKET = BIT(13),
538 IWL_WOWLAN_WAKEUP_BY_D3_WAKEUP_HOST_TIMER = BIT(14),
539 IWL_WOWLAN_WAKEUP_BY_RXFRAME_FILTERED_IN = BIT(15),
540 IWL_WOWLAN_WAKEUP_BY_BEACON_FILTERED_IN = BIT(16),
541 IWL_WAKEUP_BY_11W_UNPROTECTED_DEAUTH_OR_DISASSOC = BIT(17),
542 IWL_WAKEUP_BY_PATTERN_IPV4_TCP_SYN = BIT(18),
543 IWL_WAKEUP_BY_PATTERN_IPV4_TCP_SYN_WILDCARD = BIT(19),
544 IWL_WAKEUP_BY_PATTERN_IPV6_TCP_SYN = BIT(20),
545 IWL_WAKEUP_BY_PATTERN_IPV6_TCP_SYN_WILDCARD = BIT(21),
546};
547
548struct iwl_wowlan_gtk_status_v1 {
549 u8 key_index;
550 u8 reserved[3];
551 u8 decrypt_key[16];
552 u8 tkip_mic_key[8];
553 struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 rsc;
554} __packed;
555
556
557
558
559
560
561
562
563
564
565
566
567
568struct iwl_wowlan_gtk_status {
569 u8 key[WOWLAN_KEY_MAX_SIZE];
570 u8 key_len;
571 u8 key_flags;
572 u8 reserved[2];
573 u8 tkip_mic_key[8];
574 struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 rsc;
575} __packed;
576
577#define IWL_WOWLAN_GTK_IDX_MASK (BIT(0) | BIT(1))
578
579
580
581
582
583
584
585
586
587
588
589struct iwl_wowlan_igtk_status {
590 u8 key[WOWLAN_KEY_MAX_SIZE];
591 u8 ipn[6];
592 u8 key_len;
593 u8 key_flags;
594} __packed;
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611struct iwl_wowlan_status_v6 {
612 struct iwl_wowlan_gtk_status_v1 gtk;
613 __le64 replay_ctr;
614 __le16 pattern_number;
615 __le16 non_qos_seq_ctr;
616 __le16 qos_seq_ctr[8];
617 __le32 wakeup_reasons;
618 __le32 num_of_gtk_rekeys;
619 __le32 transmitted_ndps;
620 __le32 received_beacons;
621 __le32 wake_packet_length;
622 __le32 wake_packet_bufsize;
623 u8 wake_packet[];
624} __packed;
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642struct iwl_wowlan_status_v7 {
643 struct iwl_wowlan_gtk_status gtk[WOWLAN_GTK_KEYS_NUM];
644 struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
645 __le64 replay_ctr;
646 __le16 pattern_number;
647 __le16 non_qos_seq_ctr;
648 __le16 qos_seq_ctr[8];
649 __le32 wakeup_reasons;
650 __le32 num_of_gtk_rekeys;
651 __le32 transmitted_ndps;
652 __le32 received_beacons;
653 __le32 wake_packet_length;
654 __le32 wake_packet_bufsize;
655 u8 wake_packet[];
656} __packed;
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678struct iwl_wowlan_status_v9 {
679 struct iwl_wowlan_gtk_status gtk[WOWLAN_GTK_KEYS_NUM];
680 struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
681 __le64 replay_ctr;
682 __le16 pattern_number;
683 __le16 non_qos_seq_ctr;
684 __le16 qos_seq_ctr[8];
685 __le32 wakeup_reasons;
686 __le32 num_of_gtk_rekeys;
687 __le32 transmitted_ndps;
688 __le32 received_beacons;
689 __le32 wake_packet_length;
690 __le32 wake_packet_bufsize;
691 u8 tid_tear_down;
692 u8 reserved[3];
693 u8 wake_packet[];
694} __packed;
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716struct iwl_wowlan_status {
717 struct iwl_wowlan_gtk_status gtk[1];
718 struct iwl_wowlan_igtk_status igtk[1];
719 struct iwl_wowlan_igtk_status bigtk[WOWLAN_IGTK_KEYS_NUM];
720 __le64 replay_ctr;
721 __le16 pattern_number;
722 __le16 non_qos_seq_ctr;
723 __le16 qos_seq_ctr[8];
724 __le32 wakeup_reasons;
725 __le32 num_of_gtk_rekeys;
726 u8 tid_tear_down;
727 u8 reserved[3];
728 __le32 received_beacons;
729 __le32 wake_packet_length;
730 __le32 wake_packet_bufsize;
731 u8 wake_packet[];
732} __packed;
733
734static inline u8 iwlmvm_wowlan_gtk_idx(struct iwl_wowlan_gtk_status *gtk)
735{
736 return gtk->key_flags & IWL_WOWLAN_GTK_IDX_MASK;
737}
738
739
740
741#endif
742