hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/net/wireless/intel/iwlwifi/fw/api/d3.h
....@@ -8,6 +8,7 @@
88 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
99 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
1010 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
11
+ * Copyright(c) 2018 - 2020 Intel Corporation
1112 *
1213 * This program is free software; you can redistribute it and/or modify
1314 * it under the terms of version 2 of the GNU General Public License as
....@@ -30,6 +31,7 @@
3031 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
3132 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
3233 * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
34
+ * Copyright(c) 2018 - 2020 Intel Corporation
3335 * All rights reserved.
3436 *
3537 * Redistribution and use in source and binary forms, with or without
....@@ -61,6 +63,14 @@
6163
6264 #ifndef __iwl_fw_api_d3_h__
6365 #define __iwl_fw_api_d3_h__
66
+
67
+/**
68
+ * enum iwl_d0i3_flags - d0i3 flags
69
+ * @IWL_D0I3_RESET_REQUIRE: FW require reset upon resume
70
+ */
71
+enum iwl_d0i3_flags {
72
+ IWL_D0I3_RESET_REQUIRE = BIT(0),
73
+};
6474
6575 /**
6676 * enum iwl_d3_wakeup_flags - D3 manager wakeup flags
....@@ -212,7 +222,7 @@
212222 #define IWL_WOWLAN_MIN_PATTERN_LEN 16
213223 #define IWL_WOWLAN_MAX_PATTERN_LEN 128
214224
215
-struct iwl_wowlan_pattern {
225
+struct iwl_wowlan_pattern_v1 {
216226 u8 mask[IWL_WOWLAN_MAX_PATTERN_LEN / 8];
217227 u8 pattern[IWL_WOWLAN_MAX_PATTERN_LEN];
218228 u8 mask_size;
....@@ -222,10 +232,140 @@
222232
223233 #define IWL_WOWLAN_MAX_PATTERNS 20
224234
225
-struct iwl_wowlan_patterns_cmd {
235
+/**
236
+ * struct iwl_wowlan_patterns_cmd - WoWLAN wakeup patterns
237
+ */
238
+struct iwl_wowlan_patterns_cmd_v1 {
239
+ /**
240
+ * @n_patterns: number of patterns
241
+ */
226242 __le32 n_patterns;
227
- struct iwl_wowlan_pattern patterns[];
243
+
244
+ /**
245
+ * @patterns: the patterns, array length in @n_patterns
246
+ */
247
+ struct iwl_wowlan_pattern_v1 patterns[];
228248 } __packed; /* WOWLAN_PATTERN_ARRAY_API_S_VER_1 */
249
+
250
+#define IPV4_ADDR_SIZE 4
251
+#define IPV6_ADDR_SIZE 16
252
+
253
+enum iwl_wowlan_pattern_type {
254
+ WOWLAN_PATTERN_TYPE_BITMASK,
255
+ WOWLAN_PATTERN_TYPE_IPV4_TCP_SYN,
256
+ WOWLAN_PATTERN_TYPE_IPV6_TCP_SYN,
257
+ WOWLAN_PATTERN_TYPE_IPV4_TCP_SYN_WILDCARD,
258
+ WOWLAN_PATTERN_TYPE_IPV6_TCP_SYN_WILDCARD,
259
+}; /* WOWLAN_PATTERN_TYPE_API_E_VER_1 */
260
+
261
+/**
262
+ * struct iwl_wowlan_ipv4_tcp_syn - WoWLAN IPv4 TCP SYN pattern data
263
+ */
264
+struct iwl_wowlan_ipv4_tcp_syn {
265
+ /**
266
+ * @src_addr: source IP address to match
267
+ */
268
+ u8 src_addr[IPV4_ADDR_SIZE];
269
+
270
+ /**
271
+ * @dst_addr: destination IP address to match
272
+ */
273
+ u8 dst_addr[IPV4_ADDR_SIZE];
274
+
275
+ /**
276
+ * @src_port: source TCP port to match
277
+ */
278
+ __le16 src_port;
279
+
280
+ /**
281
+ * @dst_port: destination TCP port to match
282
+ */
283
+ __le16 dst_port;
284
+} __packed; /* WOWLAN_IPV4_TCP_SYN_API_S_VER_1 */
285
+
286
+/**
287
+ * struct iwl_wowlan_ipv6_tcp_syn - WoWLAN Ipv6 TCP SYN pattern data
288
+ */
289
+struct iwl_wowlan_ipv6_tcp_syn {
290
+ /**
291
+ * @src_addr: source IP address to match
292
+ */
293
+ u8 src_addr[IPV6_ADDR_SIZE];
294
+
295
+ /**
296
+ * @dst_addr: destination IP address to match
297
+ */
298
+ u8 dst_addr[IPV6_ADDR_SIZE];
299
+
300
+ /**
301
+ * @src_port: source TCP port to match
302
+ */
303
+ __le16 src_port;
304
+
305
+ /**
306
+ * @dst_port: destination TCP port to match
307
+ */
308
+ __le16 dst_port;
309
+} __packed; /* WOWLAN_IPV6_TCP_SYN_API_S_VER_1 */
310
+
311
+/**
312
+ * union iwl_wowlan_pattern_data - Data for the different pattern types
313
+ *
314
+ * If wildcard addresses/ports are to be used, the union can be left
315
+ * undefined.
316
+ */
317
+union iwl_wowlan_pattern_data {
318
+ /**
319
+ * @bitmask: bitmask pattern data
320
+ */
321
+ struct iwl_wowlan_pattern_v1 bitmask;
322
+
323
+ /**
324
+ * @ipv4_tcp_syn: IPv4 TCP SYN pattern data
325
+ */
326
+ struct iwl_wowlan_ipv4_tcp_syn ipv4_tcp_syn;
327
+
328
+ /**
329
+ * @ipv6_tcp_syn: IPv6 TCP SYN pattern data
330
+ */
331
+ struct iwl_wowlan_ipv6_tcp_syn ipv6_tcp_syn;
332
+}; /* WOWLAN_PATTERN_API_U_VER_1 */
333
+
334
+/**
335
+ * struct iwl_wowlan_pattern_v2 - Pattern entry for the WoWLAN wakeup patterns
336
+ */
337
+struct iwl_wowlan_pattern_v2 {
338
+ /**
339
+ * @pattern_type: defines the struct type to be used in the union
340
+ */
341
+ u8 pattern_type;
342
+
343
+ /**
344
+ * @reserved: reserved for alignment
345
+ */
346
+ u8 reserved[3];
347
+
348
+ /**
349
+ * @u: the union containing the match data, or undefined for
350
+ * wildcard matches
351
+ */
352
+ union iwl_wowlan_pattern_data u;
353
+} __packed; /* WOWLAN_PATTERN_API_S_VER_2 */
354
+
355
+/**
356
+ * struct iwl_wowlan_patterns_cmd - WoWLAN wakeup patterns command
357
+ */
358
+struct iwl_wowlan_patterns_cmd {
359
+ /**
360
+ * @n_patterns: number of patterns
361
+ */
362
+ __le32 n_patterns;
363
+
364
+ /**
365
+ * @patterns: the patterns, array length in @n_patterns
366
+ */
367
+ struct iwl_wowlan_pattern_v2 patterns[];
368
+} __packed; /* WOWLAN_PATTERN_ARRAY_API_S_VER_2 */
229369
230370 enum iwl_wowlan_wakeup_filters {
231371 IWL_WOWLAN_WAKEUP_MAGIC_PACKET = BIT(0),
....@@ -264,6 +404,7 @@
264404 * @is_11n_connection: indicates HT connection
265405 * @offloading_tid: TID reserved for firmware use
266406 * @flags: extra flags, see &enum iwl_wowlan_flags
407
+ * @sta_id: station ID for wowlan.
267408 * @reserved: reserved
268409 */
269410 struct iwl_wowlan_config_cmd {
....@@ -274,8 +415,9 @@
274415 u8 is_11n_connection;
275416 u8 offloading_tid;
276417 u8 flags;
277
- u8 reserved[2];
278
-} __packed; /* WOWLAN_CONFIG_API_S_VER_4 */
418
+ u8 sta_id;
419
+ u8 reserved;
420
+} __packed; /* WOWLAN_CONFIG_API_S_VER_5 */
279421
280422 /*
281423 * WOWLAN_TSC_RSC_PARAMS
....@@ -309,9 +451,14 @@
309451 struct iwl_aes_rsc_tsc aes;
310452 }; /* ALL_TSC_RSC_API_S_VER_2 */
311453
312
-struct iwl_wowlan_rsc_tsc_params_cmd {
454
+struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 {
313455 union iwl_all_tsc_rsc all_tsc_rsc;
314456 } __packed; /* ALL_TSC_RSC_API_S_VER_2 */
457
+
458
+struct iwl_wowlan_rsc_tsc_params_cmd {
459
+ struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 params;
460
+ __le32 sta_id;
461
+} __packed; /* ALL_TSC_RSC_API_S_VER_4 */
315462
316463 #define IWL_MIC_KEY_SIZE 8
317464 struct iwl_mic_keys {
....@@ -327,23 +474,44 @@
327474
328475 #define IWL_NUM_RX_P1K_CACHE 2
329476
330
-struct iwl_wowlan_tkip_params_cmd {
477
+struct iwl_wowlan_tkip_params_cmd_ver_1 {
331478 struct iwl_mic_keys mic_keys;
332479 struct iwl_p1k_cache tx;
333480 struct iwl_p1k_cache rx_uni[IWL_NUM_RX_P1K_CACHE];
334481 struct iwl_p1k_cache rx_multi[IWL_NUM_RX_P1K_CACHE];
335482 } __packed; /* WOWLAN_TKIP_SETTING_API_S_VER_1 */
336483
484
+struct iwl_wowlan_tkip_params_cmd {
485
+ struct iwl_mic_keys mic_keys;
486
+ struct iwl_p1k_cache tx;
487
+ struct iwl_p1k_cache rx_uni[IWL_NUM_RX_P1K_CACHE];
488
+ struct iwl_p1k_cache rx_multi[IWL_NUM_RX_P1K_CACHE];
489
+ u8 reversed[2];
490
+ __le32 sta_id;
491
+} __packed; /* WOWLAN_TKIP_SETTING_API_S_VER_2 */
492
+
337493 #define IWL_KCK_MAX_SIZE 32
338494 #define IWL_KEK_MAX_SIZE 32
339495
340
-struct iwl_wowlan_kek_kck_material_cmd {
496
+struct iwl_wowlan_kek_kck_material_cmd_v2 {
341497 u8 kck[IWL_KCK_MAX_SIZE];
342498 u8 kek[IWL_KEK_MAX_SIZE];
343499 __le16 kck_len;
344500 __le16 kek_len;
345501 __le64 replay_ctr;
346502 } __packed; /* KEK_KCK_MATERIAL_API_S_VER_2 */
503
+
504
+struct iwl_wowlan_kek_kck_material_cmd_v3 {
505
+ u8 kck[IWL_KCK_MAX_SIZE];
506
+ u8 kek[IWL_KEK_MAX_SIZE];
507
+ __le16 kck_len;
508
+ __le16 kek_len;
509
+ __le64 replay_ctr;
510
+ __le32 akm;
511
+ __le32 gtk_cipher;
512
+ __le32 igtk_cipher;
513
+ __le32 bigtk_cipher;
514
+} __packed; /* KEK_KCK_MATERIAL_API_S_VER_3 */
347515
348516 #define RF_KILL_INDICATOR_FOR_WOWLAN 0x87
349517
....@@ -371,19 +539,67 @@
371539 IWL_WOWLAN_WAKEUP_BY_D3_WAKEUP_HOST_TIMER = BIT(14),
372540 IWL_WOWLAN_WAKEUP_BY_RXFRAME_FILTERED_IN = BIT(15),
373541 IWL_WOWLAN_WAKEUP_BY_BEACON_FILTERED_IN = BIT(16),
374
-
542
+ IWL_WAKEUP_BY_11W_UNPROTECTED_DEAUTH_OR_DISASSOC = BIT(17),
543
+ IWL_WAKEUP_BY_PATTERN_IPV4_TCP_SYN = BIT(18),
544
+ IWL_WAKEUP_BY_PATTERN_IPV4_TCP_SYN_WILDCARD = BIT(19),
545
+ IWL_WAKEUP_BY_PATTERN_IPV6_TCP_SYN = BIT(20),
546
+ IWL_WAKEUP_BY_PATTERN_IPV6_TCP_SYN_WILDCARD = BIT(21),
375547 }; /* WOWLAN_WAKE_UP_REASON_API_E_VER_2 */
376548
377
-struct iwl_wowlan_gtk_status {
549
+struct iwl_wowlan_gtk_status_v1 {
378550 u8 key_index;
379551 u8 reserved[3];
380552 u8 decrypt_key[16];
381553 u8 tkip_mic_key[8];
382
- struct iwl_wowlan_rsc_tsc_params_cmd rsc;
554
+ struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 rsc;
383555 } __packed; /* WOWLAN_GTK_MATERIAL_VER_1 */
384556
557
+#define WOWLAN_KEY_MAX_SIZE 32
558
+#define WOWLAN_GTK_KEYS_NUM 2
559
+#define WOWLAN_IGTK_KEYS_NUM 2
560
+
385561 /**
386
- * struct iwl_wowlan_status - WoWLAN status
562
+ * struct iwl_wowlan_gtk_status - GTK status
563
+ * @key: GTK material
564
+ * @key_len: GTK legth, if set to 0, the key is not available
565
+ * @key_flags: information about the key:
566
+ * bits[0:1]: key index assigned by the AP
567
+ * bits[2:6]: GTK index of the key in the internal DB
568
+ * bit[7]: Set iff this is the currently used GTK
569
+ * @reserved: padding
570
+ * @tkip_mic_key: TKIP RX MIC key
571
+ * @rsc: TSC RSC counters
572
+ */
573
+struct iwl_wowlan_gtk_status {
574
+ u8 key[WOWLAN_KEY_MAX_SIZE];
575
+ u8 key_len;
576
+ u8 key_flags;
577
+ u8 reserved[2];
578
+ u8 tkip_mic_key[8];
579
+ struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 rsc;
580
+} __packed; /* WOWLAN_GTK_MATERIAL_VER_2 */
581
+
582
+#define IWL_WOWLAN_GTK_IDX_MASK (BIT(0) | BIT(1))
583
+
584
+/**
585
+ * struct iwl_wowlan_igtk_status - IGTK status
586
+ * @key: IGTK material
587
+ * @ipn: the IGTK packet number (replay counter)
588
+ * @key_len: IGTK length, if set to 0, the key is not available
589
+ * @key_flags: information about the key:
590
+ * bits[0]: key index assigned by the AP (0: index 4, 1: index 5)
591
+ * bits[1:5]: IGTK index of the key in the internal DB
592
+ * bit[6]: Set iff this is the currently used IGTK
593
+ */
594
+struct iwl_wowlan_igtk_status {
595
+ u8 key[WOWLAN_KEY_MAX_SIZE];
596
+ u8 ipn[6];
597
+ u8 key_len;
598
+ u8 key_flags;
599
+} __packed; /* WOWLAN_IGTK_MATERIAL_VER_1 */
600
+
601
+/**
602
+ * struct iwl_wowlan_status_v6 - WoWLAN status
387603 * @gtk: GTK data
388604 * @replay_ctr: GTK rekey replay counter
389605 * @pattern_number: number of the matched pattern
....@@ -397,8 +613,8 @@
397613 * @wake_packet_bufsize: wakeup packet buffer size
398614 * @wake_packet: wakeup packet
399615 */
400
-struct iwl_wowlan_status {
401
- struct iwl_wowlan_gtk_status gtk;
616
+struct iwl_wowlan_status_v6 {
617
+ struct iwl_wowlan_gtk_status_v1 gtk;
402618 __le64 replay_ctr;
403619 __le16 pattern_number;
404620 __le16 non_qos_seq_ctr;
....@@ -412,6 +628,118 @@
412628 u8 wake_packet[]; /* can be truncated from _length to _bufsize */
413629 } __packed; /* WOWLAN_STATUSES_API_S_VER_6 */
414630
631
+/**
632
+ * struct iwl_wowlan_status - WoWLAN status
633
+ * @gtk: GTK data
634
+ * @igtk: IGTK data
635
+ * @replay_ctr: GTK rekey replay counter
636
+ * @pattern_number: number of the matched pattern
637
+ * @non_qos_seq_ctr: non-QoS sequence counter to use next
638
+ * @qos_seq_ctr: QoS sequence counters to use next
639
+ * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
640
+ * @num_of_gtk_rekeys: number of GTK rekeys
641
+ * @transmitted_ndps: number of transmitted neighbor discovery packets
642
+ * @received_beacons: number of received beacons
643
+ * @wake_packet_length: wakeup packet length
644
+ * @wake_packet_bufsize: wakeup packet buffer size
645
+ * @wake_packet: wakeup packet
646
+ */
647
+struct iwl_wowlan_status_v7 {
648
+ struct iwl_wowlan_gtk_status gtk[WOWLAN_GTK_KEYS_NUM];
649
+ struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
650
+ __le64 replay_ctr;
651
+ __le16 pattern_number;
652
+ __le16 non_qos_seq_ctr;
653
+ __le16 qos_seq_ctr[8];
654
+ __le32 wakeup_reasons;
655
+ __le32 num_of_gtk_rekeys;
656
+ __le32 transmitted_ndps;
657
+ __le32 received_beacons;
658
+ __le32 wake_packet_length;
659
+ __le32 wake_packet_bufsize;
660
+ u8 wake_packet[]; /* can be truncated from _length to _bufsize */
661
+} __packed; /* WOWLAN_STATUSES_API_S_VER_7 */
662
+
663
+/**
664
+ * struct iwl_wowlan_status_v9 - WoWLAN status (version 9)
665
+ * @gtk: GTK data
666
+ * @igtk: IGTK data
667
+ * @replay_ctr: GTK rekey replay counter
668
+ * @pattern_number: number of the matched pattern
669
+ * @non_qos_seq_ctr: non-QoS sequence counter to use next
670
+ * @qos_seq_ctr: QoS sequence counters to use next
671
+ * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
672
+ * @num_of_gtk_rekeys: number of GTK rekeys
673
+ * @transmitted_ndps: number of transmitted neighbor discovery packets
674
+ * @received_beacons: number of received beacons
675
+ * @wake_packet_length: wakeup packet length
676
+ * @wake_packet_bufsize: wakeup packet buffer size
677
+ * @tid_tear_down: bit mask of tids whose BA sessions were closed
678
+ * in suspend state
679
+ * @reserved: unused
680
+ * @wake_packet: wakeup packet
681
+ */
682
+struct iwl_wowlan_status_v9 {
683
+ struct iwl_wowlan_gtk_status gtk[WOWLAN_GTK_KEYS_NUM];
684
+ struct iwl_wowlan_igtk_status igtk[WOWLAN_IGTK_KEYS_NUM];
685
+ __le64 replay_ctr;
686
+ __le16 pattern_number;
687
+ __le16 non_qos_seq_ctr;
688
+ __le16 qos_seq_ctr[8];
689
+ __le32 wakeup_reasons;
690
+ __le32 num_of_gtk_rekeys;
691
+ __le32 transmitted_ndps;
692
+ __le32 received_beacons;
693
+ __le32 wake_packet_length;
694
+ __le32 wake_packet_bufsize;
695
+ u8 tid_tear_down;
696
+ u8 reserved[3];
697
+ u8 wake_packet[]; /* can be truncated from _length to _bufsize */
698
+} __packed; /* WOWLAN_STATUSES_API_S_VER_9 */
699
+
700
+/**
701
+ * struct iwl_wowlan_status - WoWLAN status
702
+ * @gtk: GTK data
703
+ * @igtk: IGTK data
704
+ * @bigtk: BIGTK data
705
+ * @replay_ctr: GTK rekey replay counter
706
+ * @pattern_number: number of the matched pattern
707
+ * @non_qos_seq_ctr: non-QoS sequence counter to use next
708
+ * @qos_seq_ctr: QoS sequence counters to use next
709
+ * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
710
+ * @num_of_gtk_rekeys: number of GTK rekeys
711
+ * @tid_tear_down: bitmap of TIDs torn down
712
+ * @reserved: reserved
713
+ * @received_beacons: number of received beacons
714
+ * @wake_packet_length: wakeup packet length
715
+ * @wake_packet_bufsize: wakeup packet buffer size
716
+ * @tid_tear_down: bit mask of tids whose BA sessions were closed
717
+ * in suspend state
718
+ * @wake_packet: wakeup packet
719
+ */
720
+struct iwl_wowlan_status {
721
+ struct iwl_wowlan_gtk_status gtk[1];
722
+ struct iwl_wowlan_igtk_status igtk[1];
723
+ struct iwl_wowlan_igtk_status bigtk[WOWLAN_IGTK_KEYS_NUM];
724
+ __le64 replay_ctr;
725
+ __le16 pattern_number;
726
+ __le16 non_qos_seq_ctr;
727
+ __le16 qos_seq_ctr[8];
728
+ __le32 wakeup_reasons;
729
+ __le32 num_of_gtk_rekeys;
730
+ u8 tid_tear_down;
731
+ u8 reserved[3];
732
+ __le32 received_beacons;
733
+ __le32 wake_packet_length;
734
+ __le32 wake_packet_bufsize;
735
+ u8 wake_packet[]; /* can be truncated from _length to _bufsize */
736
+} __packed; /* WOWLAN_STATUSES_API_S_VER_11 */
737
+
738
+static inline u8 iwlmvm_wowlan_gtk_idx(struct iwl_wowlan_gtk_status *gtk)
739
+{
740
+ return gtk->key_flags & IWL_WOWLAN_GTK_IDX_MASK;
741
+}
742
+
415743 #define IWL_WOWLAN_TCP_MAX_PACKET_LEN 64
416744 #define IWL_WOWLAN_REMOTE_WAKE_MAX_PACKET_LEN 128
417745 #define IWL_WOWLAN_REMOTE_WAKE_MAX_TOKENS 2048