Path: blob/main/sys/contrib/dev/iwlwifi/fw/api/time-event.h
48425 views
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */1/*2* Copyright (C) 2012-2014, 2018-2020, 2022-2025 Intel Corporation3* Copyright (C) 2013-2015 Intel Mobile Communications GmbH4* Copyright (C) 2016-2017 Intel Deutschland GmbH5*/6#ifndef __iwl_fw_api_time_event_h__7#define __iwl_fw_api_time_event_h__89#include "fw/api/phy-ctxt.h"1011/* Time Event types, according to MAC type */12enum iwl_time_event_type {13/* BSS Station Events */14TE_BSS_STA_AGGRESSIVE_ASSOC,15TE_BSS_STA_ASSOC,16TE_BSS_EAP_DHCP_PROT,17TE_BSS_QUIET_PERIOD,1819/* P2P Device Events */20TE_P2P_DEVICE_DISCOVERABLE,21TE_P2P_DEVICE_LISTEN,22TE_P2P_DEVICE_ACTION_SCAN,23TE_P2P_DEVICE_FULL_SCAN,2425/* P2P Client Events */26TE_P2P_CLIENT_AGGRESSIVE_ASSOC,27TE_P2P_CLIENT_ASSOC,28TE_P2P_CLIENT_QUIET_PERIOD,2930/* P2P GO Events */31TE_P2P_GO_ASSOC_PROT,32TE_P2P_GO_REPETITIVET_NOA,33TE_P2P_GO_CT_WINDOW,3435/* WiDi Sync Events */36TE_WIDI_TX_SYNC,3738/* Channel Switch NoA */39TE_CHANNEL_SWITCH_PERIOD,4041TE_MAX42}; /* MAC_EVENT_TYPE_API_E_VER_1 */4344/* Time event - defines for command API v1 */4546/*47* @TE_V1_FRAG_NONE: fragmentation of the time event is NOT allowed.48* @TE_V1_FRAG_SINGLE: fragmentation of the time event is allowed, but only49* the first fragment is scheduled.50* @TE_V1_FRAG_DUAL: fragmentation of the time event is allowed, but only51* the first 2 fragments are scheduled.52* @TE_V1_FRAG_ENDLESS: fragmentation of the time event is allowed, and any53* number of fragments are valid.54*55* Other than the constant defined above, specifying a fragmentation value 'x'56* means that the event can be fragmented but only the first 'x' will be57* scheduled.58*/59enum {60TE_V1_FRAG_NONE = 0,61TE_V1_FRAG_SINGLE = 1,62TE_V1_FRAG_DUAL = 2,63TE_V1_FRAG_ENDLESS = 0xffffffff64};6566/* If a Time Event can be fragmented, this is the max number of fragments */67#define TE_V1_FRAG_MAX_MSK 0x0fffffff68/* Repeat the time event endlessly (until removed) */69#define TE_V1_REPEAT_ENDLESS 0xffffffff70/* If a Time Event has bounded repetitions, this is the maximal value */71#define TE_V1_REPEAT_MAX_MSK_V1 0x0fffffff7273/* Time Event dependencies: none, on another TE, or in a specific time */74enum {75TE_V1_INDEPENDENT = 0,76TE_V1_DEP_OTHER = BIT(0),77TE_V1_DEP_TSF = BIT(1),78TE_V1_EVENT_SOCIOPATHIC = BIT(2),79}; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */8081/*82* @TE_V1_NOTIF_NONE: no notifications83* @TE_V1_NOTIF_HOST_EVENT_START: request/receive notification on event start84* @TE_V1_NOTIF_HOST_EVENT_END:request/receive notification on event end85* @TE_V1_NOTIF_INTERNAL_EVENT_START: internal FW use86* @TE_V1_NOTIF_INTERNAL_EVENT_END: internal FW use.87* @TE_V1_NOTIF_HOST_FRAG_START: request/receive notification on frag start88* @TE_V1_NOTIF_HOST_FRAG_END:request/receive notification on frag end89* @TE_V1_NOTIF_INTERNAL_FRAG_START: internal FW use.90* @TE_V1_NOTIF_INTERNAL_FRAG_END: internal FW use.91*92* Supported Time event notifications configuration.93* A notification (both event and fragment) includes a status indicating weather94* the FW was able to schedule the event or not. For fragment start/end95* notification the status is always success. There is no start/end fragment96* notification for monolithic events.97*/98enum {99TE_V1_NOTIF_NONE = 0,100TE_V1_NOTIF_HOST_EVENT_START = BIT(0),101TE_V1_NOTIF_HOST_EVENT_END = BIT(1),102TE_V1_NOTIF_INTERNAL_EVENT_START = BIT(2),103TE_V1_NOTIF_INTERNAL_EVENT_END = BIT(3),104TE_V1_NOTIF_HOST_FRAG_START = BIT(4),105TE_V1_NOTIF_HOST_FRAG_END = BIT(5),106TE_V1_NOTIF_INTERNAL_FRAG_START = BIT(6),107TE_V1_NOTIF_INTERNAL_FRAG_END = BIT(7),108}; /* MAC_EVENT_ACTION_API_E_VER_2 */109110/* Time event - defines for command API */111112/*113* @TE_V2_FRAG_NONE: fragmentation of the time event is NOT allowed.114* @TE_V2_FRAG_SINGLE: fragmentation of the time event is allowed, but only115* the first fragment is scheduled.116* @TE_V2_FRAG_DUAL: fragmentation of the time event is allowed, but only117* the first 2 fragments are scheduled.118* @TE_V2_FRAG_ENDLESS: fragmentation of the time event is allowed, and any119* number of fragments are valid.120*121* Other than the constant defined above, specifying a fragmentation value 'x'122* means that the event can be fragmented but only the first 'x' will be123* scheduled.124*/125enum {126TE_V2_FRAG_NONE = 0,127TE_V2_FRAG_SINGLE = 1,128TE_V2_FRAG_DUAL = 2,129TE_V2_FRAG_MAX = 0xfe,130TE_V2_FRAG_ENDLESS = 0xff131};132133/* Repeat the time event endlessly (until removed) */134#define TE_V2_REPEAT_ENDLESS 0xff135/* If a Time Event has bounded repetitions, this is the maximal value */136#define TE_V2_REPEAT_MAX 0xfe137138#define TE_V2_PLACEMENT_POS 12139#define TE_V2_ABSENCE_POS 15140141/**142* enum iwl_time_event_policy - Time event policy values143* A notification (both event and fragment) includes a status indicating weather144* the FW was able to schedule the event or not. For fragment start/end145* notification the status is always success. There is no start/end fragment146* notification for monolithic events.147*148* @TE_V2_DEFAULT_POLICY: independent, social, present, unoticable149* @TE_V2_NOTIF_HOST_EVENT_START: request/receive notification on event start150* @TE_V2_NOTIF_HOST_EVENT_END:request/receive notification on event end151* @TE_V2_NOTIF_INTERNAL_EVENT_START: internal FW use152* @TE_V2_NOTIF_INTERNAL_EVENT_END: internal FW use.153* @TE_V2_NOTIF_HOST_FRAG_START: request/receive notification on frag start154* @TE_V2_NOTIF_HOST_FRAG_END:request/receive notification on frag end155* @TE_V2_NOTIF_INTERNAL_FRAG_START: internal FW use.156* @TE_V2_NOTIF_INTERNAL_FRAG_END: internal FW use.157* @TE_V2_START_IMMEDIATELY: start time event immediately158* @TE_V2_DEP_OTHER: depends on another time event159* @TE_V2_DEP_TSF: depends on a specific time160* @TE_V2_EVENT_SOCIOPATHIC: can't co-exist with other events of tha same MAC161* @TE_V2_ABSENCE: are we present or absent during the Time Event.162*/163enum iwl_time_event_policy {164TE_V2_DEFAULT_POLICY = 0x0,165166/* notifications (event start/stop, fragment start/stop) */167TE_V2_NOTIF_HOST_EVENT_START = BIT(0),168TE_V2_NOTIF_HOST_EVENT_END = BIT(1),169TE_V2_NOTIF_INTERNAL_EVENT_START = BIT(2),170TE_V2_NOTIF_INTERNAL_EVENT_END = BIT(3),171172TE_V2_NOTIF_HOST_FRAG_START = BIT(4),173TE_V2_NOTIF_HOST_FRAG_END = BIT(5),174TE_V2_NOTIF_INTERNAL_FRAG_START = BIT(6),175TE_V2_NOTIF_INTERNAL_FRAG_END = BIT(7),176TE_V2_START_IMMEDIATELY = BIT(11),177178/* placement characteristics */179TE_V2_DEP_OTHER = BIT(TE_V2_PLACEMENT_POS),180TE_V2_DEP_TSF = BIT(TE_V2_PLACEMENT_POS + 1),181TE_V2_EVENT_SOCIOPATHIC = BIT(TE_V2_PLACEMENT_POS + 2),182183/* are we present or absent during the Time Event. */184TE_V2_ABSENCE = BIT(TE_V2_ABSENCE_POS),185};186187/**188* struct iwl_time_event_cmd - configuring Time Events189* with struct MAC_TIME_EVENT_DATA_API_S_VER_2 (see also190* with version 1. determined by IWL_UCODE_TLV_FLAGS)191* ( TIME_EVENT_CMD = 0x29 )192* @id_and_color: ID and color of the relevant MAC,193* &enum iwl_ctxt_id_and_color194* @action: action to perform, one of &enum iwl_ctxt_action195* @id: this field has two meanings, depending on the action:196* If the action is ADD, then it means the type of event to add.197* For all other actions it is the unique event ID assigned when the198* event was added by the FW.199* @apply_time: When to start the Time Event (in GP2)200* @max_delay: maximum delay to event's start (apply time), in TU201* @depends_on: the unique ID of the event we depend on (if any)202* @interval: interval between repetitions, in TU203* @duration: duration of event in TU204* @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS205* @max_frags: maximal number of fragments the Time Event can be divided to206* @policy: defines whether uCode shall notify the host or other uCode modules207* on event and/or fragment start and/or end208* using one of TE_INDEPENDENT, TE_DEP_OTHER, TE_DEP_TSF209* TE_EVENT_SOCIOPATHIC210* using TE_ABSENCE and using TE_NOTIF_*,211* &enum iwl_time_event_policy212*/213struct iwl_time_event_cmd {214/* COMMON_INDEX_HDR_API_S_VER_1 */215__le32 id_and_color;216__le32 action;217__le32 id;218/* MAC_TIME_EVENT_DATA_API_S_VER_2 */219__le32 apply_time;220__le32 max_delay;221__le32 depends_on;222__le32 interval;223__le32 duration;224u8 repeat;225u8 max_frags;226__le16 policy;227} __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_2 */228229/**230* struct iwl_time_event_resp - response structure to iwl_time_event_cmd231* @status: bit 0 indicates success, all others specify errors232* @id: the Time Event type233* @unique_id: the unique ID assigned (in ADD) or given (others) to the TE234* @id_and_color: ID and color of the relevant MAC,235* &enum iwl_ctxt_id_and_color236*/237struct iwl_time_event_resp {238__le32 status;239__le32 id;240__le32 unique_id;241__le32 id_and_color;242} __packed; /* MAC_TIME_EVENT_RSP_API_S_VER_1 */243244/**245* struct iwl_time_event_notif - notifications of time event start/stop246* ( TIME_EVENT_NOTIFICATION = 0x2a )247* @timestamp: action timestamp in GP2248* @session_id: session's unique id249* @unique_id: unique id of the Time Event itself250* @id_and_color: ID and color of the relevant MAC251* @action: &enum iwl_time_event_policy252* @status: true if scheduled, false otherwise (not executed)253*/254struct iwl_time_event_notif {255__le32 timestamp;256__le32 session_id;257__le32 unique_id;258__le32 id_and_color;259__le32 action;260__le32 status;261} __packed; /* MAC_TIME_EVENT_NTFY_API_S_VER_1 */262263/*264* struct iwl_hs20_roc_req_tail - tail of iwl_hs20_roc_req265*266* @node_addr: Our MAC Address267* @reserved: reserved for alignment268* @apply_time: GP2 value to start (should always be the current GP2 value)269* @apply_time_max_delay: Maximum apply time delay value in TU. Defines max270* time by which start of the event is allowed to be postponed.271* @duration: event duration in TU To calculate event duration:272* timeEventDuration = min(duration, remainingQuota)273*/274struct iwl_hs20_roc_req_tail {275u8 node_addr[ETH_ALEN];276__le16 reserved;277__le32 apply_time;278__le32 apply_time_max_delay;279__le32 duration;280} __packed;281282/*283* Aux ROC command284*285* Command requests the firmware to create a time event for a certain duration286* and remain on the given channel. This is done by using the Aux framework in287* the FW.288* The command was first used for Hot Spot issues - but can be used regardless289* to Hot Spot.290*291* ( HOT_SPOT_CMD 0x53 )292*293* @id_and_color: ID and color of the MAC294* @action: action to perform, see &enum iwl_ctxt_action295* @event_unique_id: If the action FW_CTXT_ACTION_REMOVE then the296* event_unique_id should be the id of the time event assigned by ucode.297* Otherwise ignore the event_unique_id.298* @sta_id_and_color: station id and color, resumed during "Remain On Channel"299* activity.300* @channel_info: channel info301*/302struct iwl_hs20_roc_req {303/* COMMON_INDEX_HDR_API_S_VER_1 hdr */304__le32 id_and_color;305__le32 action;306__le32 event_unique_id;307__le32 sta_id_and_color;308struct iwl_fw_channel_info channel_info;309struct iwl_hs20_roc_req_tail tail;310} __packed; /* HOT_SPOT_CMD_API_S_VER_1 */311312/*313* values for AUX ROC result values314*/315enum iwl_mvm_hot_spot {316HOT_SPOT_RSP_STATUS_OK,317HOT_SPOT_RSP_STATUS_TOO_MANY_EVENTS,318HOT_SPOT_MAX_NUM_OF_SESSIONS,319};320321/*322* Aux ROC command response323*324* In response to iwl_hs20_roc_req the FW sends this command to notify the325* driver the uid of the timevent.326*327* ( HOT_SPOT_CMD 0x53 )328*329* @event_unique_id: Unique ID of time event assigned by ucode330* @status: Return status 0 is success, all the rest used for specific errors331*/332struct iwl_hs20_roc_res {333__le32 event_unique_id;334__le32 status;335} __packed; /* HOT_SPOT_RSP_API_S_VER_1 */336337/*338* Activity types for the ROC command339* @ROC_ACTIVITY_HOTSPOT: ROC for hs20 activity340* @ROC_ACTIVITY_P2P_DISC: ROC for p2p discoverability activity341* @ROC_ACTIVITY_P2P_TXRX: ROC for p2p action frames activity342* @ROC_ACTIVITY_P2P_NEG: ROC for p2p negotiation (used also for TX)343*/344enum iwl_roc_activity {345ROC_ACTIVITY_HOTSPOT,346ROC_ACTIVITY_P2P_DISC,347ROC_ACTIVITY_P2P_TXRX,348ROC_ACTIVITY_P2P_NEG,349ROC_NUM_ACTIVITIES350}; /* ROC_ACTIVITY_API_E_VER_1 */351352/*353* ROC command v5354*355* Command requests the firmware to remain on a channel for a certain duration.356*357* ( MAC_CONF_GROUP 0x3, ROC_CMD 0xE )358*359* @action: action to perform, see &enum iwl_ctxt_action360* @activity: type of activity, see &enum iwl_roc_activity361* @sta_id: station id, resumed during "Remain On Channel" activity.362* @channel_info: &struct iwl_fw_channel_info363* @node_addr: node MAC address for Rx filtering364* @reserved: align to a dword365* @max_delay: max delay the ROC can start in TU366* @duration: remain on channel duration in TU367*/368struct iwl_roc_req_v5 {369__le32 action;370__le32 activity;371__le32 sta_id;372struct iwl_fw_channel_info channel_info;373u8 node_addr[ETH_ALEN];374__le16 reserved;375__le32 max_delay;376__le32 duration;377} __packed; /* ROC_CMD_API_S_VER_5 */378379/*380* ROC command381*382* Command requests the firmware to remain on a channel for a certain duration.383*384* ( MAC_CONF_GROUP 0x3, ROC_CMD 0xE )385*386* @action: action to perform, see &enum iwl_ctxt_action387* @activity: type of activity, see &enum iwl_roc_activity388* @sta_id: station id, resumed during "Remain On Channel" activity.389* @channel_info: &struct iwl_fw_channel_info390* @node_addr: node MAC address for Rx filtering391* @reserved1: align to a dword392* @max_delay: max delay the ROC can start in TU393* @duration: remain on channel duration in TU394* @interval: interval between repetitions (when repetitions > 1).395* @repetitions: number of repetitions396* 0xFF: infinite repetitions. 0 or 1: single repetition.397* @reserved2: align to a dword398*/399struct iwl_roc_req {400__le32 action;401__le32 activity;402__le32 sta_id;403struct iwl_fw_channel_info channel_info;404u8 node_addr[ETH_ALEN];405__le16 reserved1;406__le32 max_delay;407__le32 duration;408__le32 interval;409u8 repetitions;410u8 reserved2[3];411} __packed; /* ROC_CMD_API_S_VER_6 */412413/*414* ROC notification415*416* Notification when ROC startes and when ROC ended.417*418* ( MAC_CONF_GROUP 0x3, ROC_NOTIF 0xf8 )419*420* @status: true if ROC succeeded to start421* @start_end: true if ROC started, false if ROC ended422* @activity: notification to which activity - &enum iwl_roc_activity423*/424struct iwl_roc_notif {425__le32 success;426__le32 started;427__le32 activity;428} __packed; /* ROC_NOTIF_API_S_VER_1 */429430/**431* enum iwl_session_prot_conf_id - session protection's configurations432* @SESSION_PROTECT_CONF_ASSOC: Start a session protection for association.433* The firmware will allocate two events.434* Valid for BSS_STA and P2P_STA.435* * A rather short event that can't be fragmented and with a very436* high priority. If every goes well (99% of the cases) the437* association should complete within this first event. During438* that event, no other activity will happen in the firmware,439* which is why it can't be too long.440* The length of this event is hard-coded in the firmware: 300TUs.441* * Another event which can be much longer (it's duration is442* configurable by the driver) which has a slightly lower443* priority and that can be fragmented allowing other activities444* to run while this event is running.445* The firmware will automatically remove both events once the driver sets446* the BSS MAC as associated. Neither of the events will be removed447* for the P2P_STA MAC.448* Only the duration is configurable for this protection.449* @SESSION_PROTECT_CONF_GO_CLIENT_ASSOC: not used450* @SESSION_PROTECT_CONF_P2P_DEVICE_DISCOV: Schedule the P2P Device to be in451* listen mode. Will be fragmented. Valid only on the P2P Device MAC.452* Valid only on the P2P Device MAC. The firmware will take into account453* the duration, the interval and the repetition count.454* @SESSION_PROTECT_CONF_P2P_GO_NEGOTIATION: Schedule the P2P Device to be455* able to run the GO Negotiation. Will not be fragmented and not456* repetitive. Valid only on the P2P Device MAC. Only the duration will457* be taken into account.458* @SESSION_PROTECT_CONF_MAX_ID: not used459*/460enum iwl_session_prot_conf_id {461SESSION_PROTECT_CONF_ASSOC,462SESSION_PROTECT_CONF_GO_CLIENT_ASSOC,463SESSION_PROTECT_CONF_P2P_DEVICE_DISCOV,464SESSION_PROTECT_CONF_P2P_GO_NEGOTIATION,465SESSION_PROTECT_CONF_MAX_ID,466}; /* SESSION_PROTECTION_CONF_ID_E_VER_1 */467468/**469* struct iwl_session_prot_cmd - configure a session protection470* @id_and_color: the id and color of the link (or mac, for command version 1)471* for which this session protection is sent472* @action: can be either FW_CTXT_ACTION_ADD or FW_CTXT_ACTION_REMOVE,473* see &enum iwl_ctxt_action474* @conf_id: see &enum iwl_session_prot_conf_id475* @duration_tu: the duration of the whole protection in TUs.476* @repetition_count: not used477* @interval: not used478*479* Note: the session protection will always be scheduled to start as480* early as possible, but the maximum delay is configuration dependent.481* The firmware supports only one concurrent session protection per vif.482* Adding a new session protection will remove any currently running session.483*/484struct iwl_session_prot_cmd {485/* COMMON_INDEX_HDR_API_S_VER_1 hdr */486__le32 id_and_color;487__le32 action;488__le32 conf_id;489__le32 duration_tu;490__le32 repetition_count;491__le32 interval;492} __packed;493/* SESSION_PROTECTION_CMD_API_S_VER_1 and494* SESSION_PROTECTION_CMD_API_S_VER_2495*/496497/**498* struct iwl_session_prot_notif - session protection started / ended499* @mac_link_id: the mac id (or link id, for notif ver > 2) for which the500* session protection started / ended501* @status: 1 means success, 0 means failure502* @start: 1 means the session protection started, 0 means it ended503* @conf_id: see &enum iwl_session_prot_conf_id504*505* Note that any session protection will always get two notifications: start506* and end even the firmware could not schedule it.507*/508struct iwl_session_prot_notif {509__le32 mac_link_id;510__le32 status;511__le32 start;512__le32 conf_id;513} __packed;514/* SESSION_PROTECTION_NOTIFICATION_API_S_VER_2 and515* SESSION_PROTECTION_NOTIFICATION_API_S_VER_3516*/517518#endif /* __iwl_fw_api_time_event_h__ */519520521