1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
3 * Copyright (C) 2012-2014, 2018-2020 Intel Corporation
4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5 * Copyright (C) 2016-2017 Intel Deutschland GmbH
7 #ifndef __iwl_fw_api_time_event_h__
8 #define __iwl_fw_api_time_event_h__
10 #include "fw/api/phy-ctxt.h"
12 /* Time Event types, according to MAC type */
13 enum iwl_time_event_type
{
14 /* BSS Station Events */
15 TE_BSS_STA_AGGRESSIVE_ASSOC
,
20 /* P2P Device Events */
21 TE_P2P_DEVICE_DISCOVERABLE
,
23 TE_P2P_DEVICE_ACTION_SCAN
,
24 TE_P2P_DEVICE_FULL_SCAN
,
26 /* P2P Client Events */
27 TE_P2P_CLIENT_AGGRESSIVE_ASSOC
,
29 TE_P2P_CLIENT_QUIET_PERIOD
,
33 TE_P2P_GO_REPETITIVET_NOA
,
36 /* WiDi Sync Events */
39 /* Channel Switch NoA */
40 TE_CHANNEL_SWITCH_PERIOD
,
43 }; /* MAC_EVENT_TYPE_API_E_VER_1 */
45 /* Time event - defines for command API v1 */
48 * @TE_V1_FRAG_NONE: fragmentation of the time event is NOT allowed.
49 * @TE_V1_FRAG_SINGLE: fragmentation of the time event is allowed, but only
50 * the first fragment is scheduled.
51 * @TE_V1_FRAG_DUAL: fragmentation of the time event is allowed, but only
52 * the first 2 fragments are scheduled.
53 * @TE_V1_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
54 * number of fragments are valid.
56 * Other than the constant defined above, specifying a fragmentation value 'x'
57 * means that the event can be fragmented but only the first 'x' will be
62 TE_V1_FRAG_SINGLE
= 1,
64 TE_V1_FRAG_ENDLESS
= 0xffffffff
67 /* If a Time Event can be fragmented, this is the max number of fragments */
68 #define TE_V1_FRAG_MAX_MSK 0x0fffffff
69 /* Repeat the time event endlessly (until removed) */
70 #define TE_V1_REPEAT_ENDLESS 0xffffffff
71 /* If a Time Event has bounded repetitions, this is the maximal value */
72 #define TE_V1_REPEAT_MAX_MSK_V1 0x0fffffff
74 /* Time Event dependencies: none, on another TE, or in a specific time */
76 TE_V1_INDEPENDENT
= 0,
77 TE_V1_DEP_OTHER
= BIT(0),
78 TE_V1_DEP_TSF
= BIT(1),
79 TE_V1_EVENT_SOCIOPATHIC
= BIT(2),
80 }; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */
83 * @TE_V1_NOTIF_NONE: no notifications
84 * @TE_V1_NOTIF_HOST_EVENT_START: request/receive notification on event start
85 * @TE_V1_NOTIF_HOST_EVENT_END:request/receive notification on event end
86 * @TE_V1_NOTIF_INTERNAL_EVENT_START: internal FW use
87 * @TE_V1_NOTIF_INTERNAL_EVENT_END: internal FW use.
88 * @TE_V1_NOTIF_HOST_FRAG_START: request/receive notification on frag start
89 * @TE_V1_NOTIF_HOST_FRAG_END:request/receive notification on frag end
90 * @TE_V1_NOTIF_INTERNAL_FRAG_START: internal FW use.
91 * @TE_V1_NOTIF_INTERNAL_FRAG_END: internal FW use.
93 * Supported Time event notifications configuration.
94 * A notification (both event and fragment) includes a status indicating weather
95 * the FW was able to schedule the event or not. For fragment start/end
96 * notification the status is always success. There is no start/end fragment
97 * notification for monolithic events.
100 TE_V1_NOTIF_NONE
= 0,
101 TE_V1_NOTIF_HOST_EVENT_START
= BIT(0),
102 TE_V1_NOTIF_HOST_EVENT_END
= BIT(1),
103 TE_V1_NOTIF_INTERNAL_EVENT_START
= BIT(2),
104 TE_V1_NOTIF_INTERNAL_EVENT_END
= BIT(3),
105 TE_V1_NOTIF_HOST_FRAG_START
= BIT(4),
106 TE_V1_NOTIF_HOST_FRAG_END
= BIT(5),
107 TE_V1_NOTIF_INTERNAL_FRAG_START
= BIT(6),
108 TE_V1_NOTIF_INTERNAL_FRAG_END
= BIT(7),
109 }; /* MAC_EVENT_ACTION_API_E_VER_2 */
111 /* Time event - defines for command API */
114 * @TE_V2_FRAG_NONE: fragmentation of the time event is NOT allowed.
115 * @TE_V2_FRAG_SINGLE: fragmentation of the time event is allowed, but only
116 * the first fragment is scheduled.
117 * @TE_V2_FRAG_DUAL: fragmentation of the time event is allowed, but only
118 * the first 2 fragments are scheduled.
119 * @TE_V2_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
120 * number of fragments are valid.
122 * Other than the constant defined above, specifying a fragmentation value 'x'
123 * means that the event can be fragmented but only the first 'x' will be
128 TE_V2_FRAG_SINGLE
= 1,
130 TE_V2_FRAG_MAX
= 0xfe,
131 TE_V2_FRAG_ENDLESS
= 0xff
134 /* Repeat the time event endlessly (until removed) */
135 #define TE_V2_REPEAT_ENDLESS 0xff
136 /* If a Time Event has bounded repetitions, this is the maximal value */
137 #define TE_V2_REPEAT_MAX 0xfe
139 #define TE_V2_PLACEMENT_POS 12
140 #define TE_V2_ABSENCE_POS 15
143 * enum iwl_time_event_policy - Time event policy values
144 * A notification (both event and fragment) includes a status indicating weather
145 * the FW was able to schedule the event or not. For fragment start/end
146 * notification the status is always success. There is no start/end fragment
147 * notification for monolithic events.
149 * @TE_V2_DEFAULT_POLICY: independent, social, present, unoticable
150 * @TE_V2_NOTIF_HOST_EVENT_START: request/receive notification on event start
151 * @TE_V2_NOTIF_HOST_EVENT_END:request/receive notification on event end
152 * @TE_V2_NOTIF_INTERNAL_EVENT_START: internal FW use
153 * @TE_V2_NOTIF_INTERNAL_EVENT_END: internal FW use.
154 * @TE_V2_NOTIF_HOST_FRAG_START: request/receive notification on frag start
155 * @TE_V2_NOTIF_HOST_FRAG_END:request/receive notification on frag end
156 * @TE_V2_NOTIF_INTERNAL_FRAG_START: internal FW use.
157 * @TE_V2_NOTIF_INTERNAL_FRAG_END: internal FW use.
158 * @TE_V2_START_IMMEDIATELY: start time event immediately
159 * @TE_V2_DEP_OTHER: depends on another time event
160 * @TE_V2_DEP_TSF: depends on a specific time
161 * @TE_V2_EVENT_SOCIOPATHIC: can't co-exist with other events of tha same MAC
162 * @TE_V2_ABSENCE: are we present or absent during the Time Event.
164 enum iwl_time_event_policy
{
165 TE_V2_DEFAULT_POLICY
= 0x0,
167 /* notifications (event start/stop, fragment start/stop) */
168 TE_V2_NOTIF_HOST_EVENT_START
= BIT(0),
169 TE_V2_NOTIF_HOST_EVENT_END
= BIT(1),
170 TE_V2_NOTIF_INTERNAL_EVENT_START
= BIT(2),
171 TE_V2_NOTIF_INTERNAL_EVENT_END
= BIT(3),
173 TE_V2_NOTIF_HOST_FRAG_START
= BIT(4),
174 TE_V2_NOTIF_HOST_FRAG_END
= BIT(5),
175 TE_V2_NOTIF_INTERNAL_FRAG_START
= BIT(6),
176 TE_V2_NOTIF_INTERNAL_FRAG_END
= BIT(7),
177 TE_V2_START_IMMEDIATELY
= BIT(11),
179 /* placement characteristics */
180 TE_V2_DEP_OTHER
= BIT(TE_V2_PLACEMENT_POS
),
181 TE_V2_DEP_TSF
= BIT(TE_V2_PLACEMENT_POS
+ 1),
182 TE_V2_EVENT_SOCIOPATHIC
= BIT(TE_V2_PLACEMENT_POS
+ 2),
184 /* are we present or absent during the Time Event. */
185 TE_V2_ABSENCE
= BIT(TE_V2_ABSENCE_POS
),
189 * struct iwl_time_event_cmd - configuring Time Events
190 * with struct MAC_TIME_EVENT_DATA_API_S_VER_2 (see also
191 * with version 1. determined by IWL_UCODE_TLV_FLAGS)
192 * ( TIME_EVENT_CMD = 0x29 )
193 * @id_and_color: ID and color of the relevant MAC,
194 * &enum iwl_ctxt_id_and_color
195 * @action: action to perform, one of &enum iwl_ctxt_action
196 * @id: this field has two meanings, depending on the action:
197 * If the action is ADD, then it means the type of event to add.
198 * For all other actions it is the unique event ID assigned when the
199 * event was added by the FW.
200 * @apply_time: When to start the Time Event (in GP2)
201 * @max_delay: maximum delay to event's start (apply time), in TU
202 * @depends_on: the unique ID of the event we depend on (if any)
203 * @interval: interval between repetitions, in TU
204 * @duration: duration of event in TU
205 * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS
206 * @max_frags: maximal number of fragments the Time Event can be divided to
207 * @policy: defines whether uCode shall notify the host or other uCode modules
208 * on event and/or fragment start and/or end
209 * using one of TE_INDEPENDENT, TE_DEP_OTHER, TE_DEP_TSF
210 * TE_EVENT_SOCIOPATHIC
211 * using TE_ABSENCE and using TE_NOTIF_*,
212 * &enum iwl_time_event_policy
214 struct iwl_time_event_cmd
{
215 /* COMMON_INDEX_HDR_API_S_VER_1 */
219 /* MAC_TIME_EVENT_DATA_API_S_VER_2 */
228 } __packed
; /* MAC_TIME_EVENT_CMD_API_S_VER_2 */
231 * struct iwl_time_event_resp - response structure to iwl_time_event_cmd
232 * @status: bit 0 indicates success, all others specify errors
233 * @id: the Time Event type
234 * @unique_id: the unique ID assigned (in ADD) or given (others) to the TE
235 * @id_and_color: ID and color of the relevant MAC,
236 * &enum iwl_ctxt_id_and_color
238 struct iwl_time_event_resp
{
243 } __packed
; /* MAC_TIME_EVENT_RSP_API_S_VER_1 */
246 * struct iwl_time_event_notif - notifications of time event start/stop
247 * ( TIME_EVENT_NOTIFICATION = 0x2a )
248 * @timestamp: action timestamp in GP2
249 * @session_id: session's unique id
250 * @unique_id: unique id of the Time Event itself
251 * @id_and_color: ID and color of the relevant MAC
252 * @action: &enum iwl_time_event_policy
253 * @status: true if scheduled, false otherwise (not executed)
255 struct iwl_time_event_notif
{
262 } __packed
; /* MAC_TIME_EVENT_NTFY_API_S_VER_1 */
265 * struct iwl_hs20_roc_req_tail - tail of iwl_hs20_roc_req
267 * @node_addr: Our MAC Address
268 * @reserved: reserved for alignment
269 * @apply_time: GP2 value to start (should always be the current GP2 value)
270 * @apply_time_max_delay: Maximum apply time delay value in TU. Defines max
271 * time by which start of the event is allowed to be postponed.
272 * @duration: event duration in TU To calculate event duration:
273 * timeEventDuration = min(duration, remainingQuota)
275 struct iwl_hs20_roc_req_tail
{
276 u8 node_addr
[ETH_ALEN
];
279 __le32 apply_time_max_delay
;
286 * Command requests the firmware to create a time event for a certain duration
287 * and remain on the given channel. This is done by using the Aux framework in
289 * The command was first used for Hot Spot issues - but can be used regardless
292 * ( HOT_SPOT_CMD 0x53 )
294 * @id_and_color: ID and color of the MAC
295 * @action: action to perform, one of FW_CTXT_ACTION_*
296 * @event_unique_id: If the action FW_CTXT_ACTION_REMOVE then the
297 * event_unique_id should be the id of the time event assigned by ucode.
298 * Otherwise ignore the event_unique_id.
299 * @sta_id_and_color: station id and color, resumed during "Remain On Channel"
301 * @channel_info: channel info
303 struct iwl_hs20_roc_req
{
304 /* COMMON_INDEX_HDR_API_S_VER_1 hdr */
307 __le32 event_unique_id
;
308 __le32 sta_id_and_color
;
309 struct iwl_fw_channel_info channel_info
;
310 struct iwl_hs20_roc_req_tail tail
;
311 } __packed
; /* HOT_SPOT_CMD_API_S_VER_1 */
314 * values for AUX ROC result values
316 enum iwl_mvm_hot_spot
{
317 HOT_SPOT_RSP_STATUS_OK
,
318 HOT_SPOT_RSP_STATUS_TOO_MANY_EVENTS
,
319 HOT_SPOT_MAX_NUM_OF_SESSIONS
,
323 * Aux ROC command response
325 * In response to iwl_hs20_roc_req the FW sends this command to notify the
326 * driver the uid of the timevent.
328 * ( HOT_SPOT_CMD 0x53 )
330 * @event_unique_id: Unique ID of time event assigned by ucode
331 * @status: Return status 0 is success, all the rest used for specific errors
333 struct iwl_hs20_roc_res
{
334 __le32 event_unique_id
;
336 } __packed
; /* HOT_SPOT_RSP_API_S_VER_1 */
339 * enum iwl_mvm_session_prot_conf_id - session protection's configurations
340 * @SESSION_PROTECT_CONF_ASSOC: Start a session protection for association.
341 * The firmware will allocate two events.
342 * Valid for BSS_STA and P2P_STA.
343 * * A rather short event that can't be fragmented and with a very
344 * high priority. If every goes well (99% of the cases) the
345 * association should complete within this first event. During
346 * that event, no other activity will happen in the firmware,
347 * which is why it can't be too long.
348 * The length of this event is hard-coded in the firmware: 300TUs.
349 * * Another event which can be much longer (it's duration is
350 * configurable by the driver) which has a slightly lower
351 * priority and that can be fragmented allowing other activities
352 * to run while this event is running.
353 * The firmware will automatically remove both events once the driver sets
354 * the BSS MAC as associated. Neither of the events will be removed
355 * for the P2P_STA MAC.
356 * Only the duration is configurable for this protection.
357 * @SESSION_PROTECT_CONF_GO_CLIENT_ASSOC: not used
358 * @SESSION_PROTECT_CONF_P2P_DEVICE_DISCOV: Schedule the P2P Device to be in
359 * listen mode. Will be fragmented. Valid only on the P2P Device MAC.
360 * Valid only on the P2P Device MAC. The firmware will take into account
361 * the duration, the interval and the repetition count.
362 * @SESSION_PROTECT_CONF_P2P_GO_NEGOTIATION: Schedule the P2P Device to be be
363 * able to run the GO Negotiation. Will not be fragmented and not
364 * repetitive. Valid only on the P2P Device MAC. Only the duration will
365 * be taken into account.
366 * @SESSION_PROTECT_CONF_MAX_ID: not used
368 enum iwl_mvm_session_prot_conf_id
{
369 SESSION_PROTECT_CONF_ASSOC
,
370 SESSION_PROTECT_CONF_GO_CLIENT_ASSOC
,
371 SESSION_PROTECT_CONF_P2P_DEVICE_DISCOV
,
372 SESSION_PROTECT_CONF_P2P_GO_NEGOTIATION
,
373 SESSION_PROTECT_CONF_MAX_ID
,
374 }; /* SESSION_PROTECTION_CONF_ID_E_VER_1 */
377 * struct iwl_mvm_session_prot_cmd - configure a session protection
378 * @id_and_color: the id and color of the mac for which this session protection
380 * @action: can be either FW_CTXT_ACTION_ADD or FW_CTXT_ACTION_REMOVE
381 * @conf_id: see &enum iwl_mvm_session_prot_conf_id
382 * @duration_tu: the duration of the whole protection in TUs.
383 * @repetition_count: not used
384 * @interval: not used
386 * Note: the session protection will always be scheduled to start as
387 * early as possible, but the maximum delay is configuration dependent.
388 * The firmware supports only one concurrent session protection per vif.
389 * Adding a new session protection will remove any currently running session.
391 struct iwl_mvm_session_prot_cmd
{
392 /* COMMON_INDEX_HDR_API_S_VER_1 hdr */
397 __le32 repetition_count
;
399 } __packed
; /* SESSION_PROTECTION_CMD_API_S_VER_1 */
402 * struct iwl_mvm_session_prot_notif - session protection started / ended
403 * @mac_id: the mac id for which the session protection started / ended
404 * @status: 1 means success, 0 means failure
405 * @start: 1 means the session protection started, 0 means it ended
406 * @conf_id: see &enum iwl_mvm_session_prot_conf_id
408 * Note that any session protection will always get two notifications: start
409 * and end even the firmware could not schedule it.
411 struct iwl_mvm_session_prot_notif
{
416 } __packed
; /* SESSION_PROTECTION_NOTIFICATION_API_S_VER_2 */
418 #endif /* __iwl_fw_api_time_event_h__ */