linux/drivers/net/wireless/intel/iwlwifi/fw/api/d3.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
   2/*
   3 * Copyright (C) 2012-2014, 2018-2021 Intel Corporation
   4 * Copyright (C) 2013-2014 Intel Mobile Communications GmbH
   5 * Copyright (C) 2015-2017 Intel Deutschland GmbH
   6 */
   7#ifndef __iwl_fw_api_d3_h__
   8#define __iwl_fw_api_d3_h__
   9#include <iwl-trans.h>
  10
  11/**
  12 * enum iwl_d0i3_flags - d0i3 flags
  13 * @IWL_D0I3_RESET_REQUIRE: FW require reset upon resume
  14 */
  15enum iwl_d0i3_flags {
  16        IWL_D0I3_RESET_REQUIRE = BIT(0),
  17};
  18
  19/**
  20 * enum iwl_d3_wakeup_flags - D3 manager wakeup flags
  21 * @IWL_WAKEUP_D3_CONFIG_FW_ERROR: wake up on firmware sysassert
  22 */
  23enum iwl_d3_wakeup_flags {
  24        IWL_WAKEUP_D3_CONFIG_FW_ERROR = BIT(0),
  25}; /* D3_MANAGER_WAKEUP_CONFIG_API_E_VER_3 */
  26
  27/**
  28 * struct iwl_d3_manager_config - D3 manager configuration command
  29 * @min_sleep_time: minimum sleep time (in usec)
  30 * @wakeup_flags: wakeup flags, see &enum iwl_d3_wakeup_flags
  31 * @wakeup_host_timer: force wakeup after this many seconds
  32 *
  33 * The structure is used for the D3_CONFIG_CMD command.
  34 */
  35struct iwl_d3_manager_config {
  36        __le32 min_sleep_time;
  37        __le32 wakeup_flags;
  38        __le32 wakeup_host_timer;
  39} __packed; /* D3_MANAGER_CONFIG_CMD_S_VER_4 */
  40
  41
  42/* TODO: OFFLOADS_QUERY_API_S_VER_1 */
  43
  44/**
  45 * enum iwl_d3_proto_offloads - enabled protocol offloads
  46 * @IWL_D3_PROTO_OFFLOAD_ARP: ARP data is enabled
  47 * @IWL_D3_PROTO_OFFLOAD_NS: NS (Neighbor Solicitation) is enabled
  48 * @IWL_D3_PROTO_IPV4_VALID: IPv4 data is valid
  49 * @IWL_D3_PROTO_IPV6_VALID: IPv6 data is valid
  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 * struct iwl_proto_offload_cmd_common - ARP/NS offload common part
  69 * @enabled: enable flags
  70 * @remote_ipv4_addr: remote address to answer to (or zero if all)
  71 * @host_ipv4_addr: our IPv4 address to respond to queries for
  72 * @arp_mac_addr: our MAC address for ARP responses
  73 * @reserved: unused
  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 * struct iwl_proto_offload_cmd_v1 - ARP/NS offload configuration
  85 * @common: common/IPv4 configuration
  86 * @remote_ipv6_addr: remote address to answer to (or zero if all)
  87 * @solicited_node_ipv6_addr: broken -- solicited node address exists
  88 *      for each target address
  89 * @target_ipv6_addr: our target addresses
  90 * @ndp_mac_addr: neighbor solicitation response MAC address
  91 * @reserved2: reserved
  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; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_1 */
 101
 102/**
 103 * struct iwl_proto_offload_cmd_v2 - ARP/NS offload configuration
 104 * @common: common/IPv4 configuration
 105 * @remote_ipv6_addr: remote address to answer to (or zero if all)
 106 * @solicited_node_ipv6_addr: broken -- solicited node address exists
 107 *      for each target address
 108 * @target_ipv6_addr: our target addresses
 109 * @ndp_mac_addr: neighbor solicitation response MAC address
 110 * @num_valid_ipv6_addrs: number of valid IPv6 addresses
 111 * @reserved2: reserved
 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; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_2 */
 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; /* NS_OFFLOAD_CONFIG */
 129
 130struct iwl_targ_addr {
 131        struct in6_addr addr;
 132        __le32 config_num;
 133} __packed; /* TARGET_IPV6_ADDRESS */
 134
 135/**
 136 * struct iwl_proto_offload_cmd_v3_small - ARP/NS offload configuration
 137 * @common: common/IPv4 configuration
 138 * @num_valid_ipv6_addrs: number of valid IPv6 addresses
 139 * @targ_addrs: target IPv6 addresses
 140 * @ns_config: NS offload configurations
 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; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_3 */
 148
 149/**
 150 * struct iwl_proto_offload_cmd_v3_large - ARP/NS offload configuration
 151 * @common: common/IPv4 configuration
 152 * @num_valid_ipv6_addrs: number of valid IPv6 addresses
 153 * @targ_addrs: target IPv6 addresses
 154 * @ns_config: NS offload configurations
 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; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_3 */
 162
 163/**
 164 * struct iwl_proto_offload_cmd_v4 - ARP/NS offload configuration
 165 * @sta_id: station id
 166 * @common: common/IPv4 configuration
 167 * @num_valid_ipv6_addrs: number of valid IPv6 addresses
 168 * @targ_addrs: target IPv6 addresses
 169 * @ns_config: NS offload configurations
 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; /* PROT_OFFLOAD_CONFIG_CMD_DB_S_VER_4 */
 178
 179/*
 180 * WOWLAN_PATTERNS
 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; /* WOWLAN_PATTERN_API_S_VER_1 */
 192
 193#define IWL_WOWLAN_MAX_PATTERNS 20
 194
 195/**
 196 * struct iwl_wowlan_patterns_cmd - WoWLAN wakeup patterns
 197 */
 198struct iwl_wowlan_patterns_cmd_v1 {
 199        /**
 200         * @n_patterns: number of patterns
 201         */
 202        __le32 n_patterns;
 203
 204        /**
 205         * @patterns: the patterns, array length in @n_patterns
 206         */
 207        struct iwl_wowlan_pattern_v1 patterns[];
 208} __packed; /* WOWLAN_PATTERN_ARRAY_API_S_VER_1 */
 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}; /* WOWLAN_PATTERN_TYPE_API_E_VER_1 */
 220
 221/**
 222 * struct iwl_wowlan_ipv4_tcp_syn - WoWLAN IPv4 TCP SYN pattern data
 223 */
 224struct iwl_wowlan_ipv4_tcp_syn {
 225        /**
 226         * @src_addr: source IP address to match
 227         */
 228        u8 src_addr[IPV4_ADDR_SIZE];
 229
 230        /**
 231         * @dst_addr: destination IP address to match
 232         */
 233        u8 dst_addr[IPV4_ADDR_SIZE];
 234
 235        /**
 236         * @src_port: source TCP port to match
 237         */
 238        __le16 src_port;
 239
 240        /**
 241         * @dst_port: destination TCP port to match
 242         */
 243        __le16 dst_port;
 244} __packed; /* WOWLAN_IPV4_TCP_SYN_API_S_VER_1 */
 245
 246/**
 247 * struct iwl_wowlan_ipv6_tcp_syn - WoWLAN Ipv6 TCP SYN pattern data
 248 */
 249struct iwl_wowlan_ipv6_tcp_syn {
 250        /**
 251         * @src_addr: source IP address to match
 252         */
 253        u8 src_addr[IPV6_ADDR_SIZE];
 254
 255        /**
 256         * @dst_addr: destination IP address to match
 257         */
 258        u8 dst_addr[IPV6_ADDR_SIZE];
 259
 260        /**
 261         * @src_port: source TCP port to match
 262         */
 263        __le16 src_port;
 264
 265        /**
 266         * @dst_port: destination TCP port to match
 267         */
 268        __le16 dst_port;
 269} __packed; /* WOWLAN_IPV6_TCP_SYN_API_S_VER_1 */
 270
 271/**
 272 * union iwl_wowlan_pattern_data - Data for the different pattern types
 273 *
 274 * If wildcard addresses/ports are to be used, the union can be left
 275 * undefined.
 276 */
 277union iwl_wowlan_pattern_data {
 278        /**
 279         * @bitmask: bitmask pattern data
 280         */
 281        struct iwl_wowlan_pattern_v1 bitmask;
 282
 283        /**
 284         * @ipv4_tcp_syn: IPv4 TCP SYN pattern data
 285         */
 286        struct iwl_wowlan_ipv4_tcp_syn ipv4_tcp_syn;
 287
 288        /**
 289         * @ipv6_tcp_syn: IPv6 TCP SYN pattern data
 290         */
 291        struct iwl_wowlan_ipv6_tcp_syn ipv6_tcp_syn;
 292}; /* WOWLAN_PATTERN_API_U_VER_1 */
 293
 294/**
 295 * struct iwl_wowlan_pattern_v2 - Pattern entry for the WoWLAN wakeup patterns
 296 */
 297struct iwl_wowlan_pattern_v2 {
 298        /**
 299         * @pattern_type: defines the struct type to be used in the union
 300         */
 301        u8 pattern_type;
 302
 303        /**
 304         * @reserved: reserved for alignment
 305         */
 306        u8 reserved[3];
 307
 308        /**
 309         * @u: the union containing the match data, or undefined for
 310         *     wildcard matches
 311         */
 312        union iwl_wowlan_pattern_data u;
 313} __packed; /* WOWLAN_PATTERN_API_S_VER_2 */
 314
 315/**
 316 * struct iwl_wowlan_patterns_cmd - WoWLAN wakeup patterns command
 317 */
 318struct iwl_wowlan_patterns_cmd {
 319        /**
 320         * @n_patterns: number of patterns
 321         */
 322        u8 n_patterns;
 323
 324        /**
 325         * @n_patterns: sta_id
 326         */
 327        u8 sta_id;
 328
 329        /**
 330         * @reserved: reserved for alignment
 331         */
 332        __le16 reserved;
 333
 334        /**
 335         * @patterns: the patterns, array length in @n_patterns
 336         */
 337        struct iwl_wowlan_pattern_v2 patterns[];
 338} __packed; /* WOWLAN_PATTERN_ARRAY_API_S_VER_3 */
 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}; /* WOWLAN_WAKEUP_FILTER_API_E_VER_4 */
 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 * struct iwl_wowlan_config_cmd - WoWLAN configuration (versions 5 and 6)
 370 * @wakeup_filter: filter from &enum iwl_wowlan_wakeup_filters
 371 * @non_qos_seq: non-QoS sequence counter to use next.
 372 *               Reserved if the struct has version >= 6.
 373 * @qos_seq: QoS sequence counters to use next
 374 * @wowlan_ba_teardown_tids: bitmap of BA sessions to tear down
 375 * @is_11n_connection: indicates HT connection
 376 * @offloading_tid: TID reserved for firmware use
 377 * @flags: extra flags, see &enum iwl_wowlan_flags
 378 * @sta_id: station ID for wowlan.
 379 * @reserved: reserved
 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; /* WOWLAN_CONFIG_API_S_VER_5 */
 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 * WOWLAN_TSC_RSC_PARAMS
 400 */
 401struct tkip_sc {
 402        __le16 iv16;
 403        __le16 pad;
 404        __le32 iv32;
 405} __packed; /* TKIP_SC_API_U_VER_1 */
 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; /* TKIP_TSC_RSC_API_S_VER_1 */
 412
 413struct aes_sc {
 414        __le64 pn;
 415} __packed; /* TKIP_AES_SC_API_U_VER_1 */
 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; /* AES_TSC_RSC_API_S_VER_1 */
 422
 423union iwl_all_tsc_rsc {
 424        struct iwl_tkip_rsc_tsc tkip;
 425        struct iwl_aes_rsc_tsc aes;
 426}; /* ALL_TSC_RSC_API_S_VER_2 */
 427
 428struct iwl_wowlan_rsc_tsc_params_cmd_ver_2 {
 429        union iwl_all_tsc_rsc all_tsc_rsc;
 430} __packed; /* ALL_TSC_RSC_API_S_VER_2 */
 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; /* ALL_TSC_RSC_API_S_VER_4 */
 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; /* ALL_TSC_RSC_API_S_VER_5 */
 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; /* MIC_KEYS_API_S_VER_1 */
 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; /* WOWLAN_TKIP_SETTING_API_S_VER_1 */
 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; /* WOWLAN_TKIP_SETTING_API_S_VER_2 */
 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; /* KEK_KCK_MATERIAL_API_S_VER_2 */
 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; /* KEK_KCK_MATERIAL_API_S_VER_3 */
 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; /* KEK_KCK_MATERIAL_API_S_VER_4 */
 510
 511struct iwl_wowlan_get_status_cmd {
 512        __le32  sta_id;
 513} __packed; /* WOWLAN_GET_STATUSES_CMD_API_S_VER_1 */
 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}; /* WOWLAN_REKEY_STATUS_API_E_VER_1 */
 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}; /* WOWLAN_WAKE_UP_REASON_API_E_VER_2 */
 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; /* WOWLAN_GTK_MATERIAL_VER_1 */
 555
 556/**
 557 * struct iwl_wowlan_gtk_status - GTK status
 558 * @key: GTK material
 559 * @key_len: GTK legth, if set to 0, the key is not available
 560 * @key_flags: information about the key:
 561 *      bits[0:1]:  key index assigned by the AP
 562 *      bits[2:6]:  GTK index of the key in the internal DB
 563 *      bit[7]:     Set iff this is the currently used GTK
 564 * @reserved: padding
 565 * @tkip_mic_key: TKIP RX MIC key
 566 * @rsc: TSC RSC counters
 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; /* WOWLAN_GTK_MATERIAL_VER_2 */
 576
 577#define IWL_WOWLAN_GTK_IDX_MASK         (BIT(0) | BIT(1))
 578
 579/**
 580 * struct iwl_wowlan_igtk_status - IGTK status
 581 * @key: IGTK material
 582 * @ipn: the IGTK packet number (replay counter)
 583 * @key_len: IGTK length, if set to 0, the key is not available
 584 * @key_flags: information about the key:
 585 *      bits[0]:    key index assigned by the AP (0: index 4, 1: index 5)
 586 *      bits[1:5]:  IGTK index of the key in the internal DB
 587 *      bit[6]:     Set iff this is the currently used IGTK
 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; /* WOWLAN_IGTK_MATERIAL_VER_1 */
 595
 596/**
 597 * struct iwl_wowlan_status_v6 - WoWLAN status
 598 * @gtk: GTK data
 599 * @replay_ctr: GTK rekey replay counter
 600 * @pattern_number: number of the matched pattern
 601 * @non_qos_seq_ctr: non-QoS sequence counter to use next
 602 * @qos_seq_ctr: QoS sequence counters to use next
 603 * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
 604 * @num_of_gtk_rekeys: number of GTK rekeys
 605 * @transmitted_ndps: number of transmitted neighbor discovery packets
 606 * @received_beacons: number of received beacons
 607 * @wake_packet_length: wakeup packet length
 608 * @wake_packet_bufsize: wakeup packet buffer size
 609 * @wake_packet: wakeup packet
 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[]; /* can be truncated from _length to _bufsize */
 624} __packed; /* WOWLAN_STATUSES_API_S_VER_6 */
 625
 626/**
 627 * struct iwl_wowlan_status - WoWLAN status
 628 * @gtk: GTK data
 629 * @igtk: IGTK data
 630 * @replay_ctr: GTK rekey replay counter
 631 * @pattern_number: number of the matched pattern
 632 * @non_qos_seq_ctr: non-QoS sequence counter to use next
 633 * @qos_seq_ctr: QoS sequence counters to use next
 634 * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
 635 * @num_of_gtk_rekeys: number of GTK rekeys
 636 * @transmitted_ndps: number of transmitted neighbor discovery packets
 637 * @received_beacons: number of received beacons
 638 * @wake_packet_length: wakeup packet length
 639 * @wake_packet_bufsize: wakeup packet buffer size
 640 * @wake_packet: wakeup packet
 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[]; /* can be truncated from _length to _bufsize */
 656} __packed; /* WOWLAN_STATUSES_API_S_VER_7 */
 657
 658/**
 659 * struct iwl_wowlan_status_v9 - WoWLAN status (versions 9 and 10)
 660 * @gtk: GTK data
 661 * @igtk: IGTK data
 662 * @replay_ctr: GTK rekey replay counter
 663 * @pattern_number: number of the matched pattern
 664 * @non_qos_seq_ctr: non-QoS sequence counter to use next.
 665 *                   Reserved if the struct has version >= 10.
 666 * @qos_seq_ctr: QoS sequence counters to use next
 667 * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
 668 * @num_of_gtk_rekeys: number of GTK rekeys
 669 * @transmitted_ndps: number of transmitted neighbor discovery packets
 670 * @received_beacons: number of received beacons
 671 * @wake_packet_length: wakeup packet length
 672 * @wake_packet_bufsize: wakeup packet buffer size
 673 * @tid_tear_down: bit mask of tids whose BA sessions were closed
 674 *                 in suspend state
 675 * @reserved: unused
 676 * @wake_packet: wakeup packet
 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[]; /* can be truncated from _length to _bufsize */
 694} __packed; /* WOWLAN_STATUSES_RSP_API_S_VER_9 */
 695
 696/**
 697 * struct iwl_wowlan_status - WoWLAN status
 698 * @gtk: GTK data
 699 * @igtk: IGTK data
 700 * @bigtk: BIGTK data
 701 * @replay_ctr: GTK rekey replay counter
 702 * @pattern_number: number of the matched pattern
 703 * @non_qos_seq_ctr: non-QoS sequence counter to use next
 704 * @qos_seq_ctr: QoS sequence counters to use next
 705 * @wakeup_reasons: wakeup reasons, see &enum iwl_wowlan_wakeup_reason
 706 * @num_of_gtk_rekeys: number of GTK rekeys
 707 * @tid_tear_down: bitmap of TIDs torn down
 708 * @reserved: reserved
 709 * @received_beacons: number of received beacons
 710 * @wake_packet_length: wakeup packet length
 711 * @wake_packet_bufsize: wakeup packet buffer size
 712 * @tid_tear_down: bit mask of tids whose BA sessions were closed
 713 *                 in suspend state
 714 * @wake_packet: wakeup packet
 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[]; /* can be truncated from _length to _bufsize */
 732} __packed; /* WOWLAN_STATUSES_API_S_VER_11 */
 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/* TODO: NetDetect API */
 740
 741#endif /* __iwl_fw_api_d3_h__ */
 742