xref: /freebsd/sys/contrib/dev/iwlwifi/fw/api/time-event.h (revision a4128aad8503277614f2d214011ef60a19447b83)
1bfcc09ddSBjoern A. Zeeb /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2bfcc09ddSBjoern A. Zeeb /*
3*a4128aadSBjoern A. Zeeb  * Copyright (C) 2012-2014, 2018-2020, 2022-2024 Intel Corporation
4bfcc09ddSBjoern A. Zeeb  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
5bfcc09ddSBjoern A. Zeeb  * Copyright (C) 2016-2017 Intel Deutschland GmbH
6bfcc09ddSBjoern A. Zeeb  */
7bfcc09ddSBjoern A. Zeeb #ifndef __iwl_fw_api_time_event_h__
8bfcc09ddSBjoern A. Zeeb #define __iwl_fw_api_time_event_h__
9bfcc09ddSBjoern A. Zeeb 
10bfcc09ddSBjoern A. Zeeb #include "fw/api/phy-ctxt.h"
11bfcc09ddSBjoern A. Zeeb 
12bfcc09ddSBjoern A. Zeeb /* Time Event types, according to MAC type */
13bfcc09ddSBjoern A. Zeeb enum iwl_time_event_type {
14bfcc09ddSBjoern A. Zeeb 	/* BSS Station Events */
15bfcc09ddSBjoern A. Zeeb 	TE_BSS_STA_AGGRESSIVE_ASSOC,
16bfcc09ddSBjoern A. Zeeb 	TE_BSS_STA_ASSOC,
17bfcc09ddSBjoern A. Zeeb 	TE_BSS_EAP_DHCP_PROT,
18bfcc09ddSBjoern A. Zeeb 	TE_BSS_QUIET_PERIOD,
19bfcc09ddSBjoern A. Zeeb 
20bfcc09ddSBjoern A. Zeeb 	/* P2P Device Events */
21bfcc09ddSBjoern A. Zeeb 	TE_P2P_DEVICE_DISCOVERABLE,
22bfcc09ddSBjoern A. Zeeb 	TE_P2P_DEVICE_LISTEN,
23bfcc09ddSBjoern A. Zeeb 	TE_P2P_DEVICE_ACTION_SCAN,
24bfcc09ddSBjoern A. Zeeb 	TE_P2P_DEVICE_FULL_SCAN,
25bfcc09ddSBjoern A. Zeeb 
26bfcc09ddSBjoern A. Zeeb 	/* P2P Client Events */
27bfcc09ddSBjoern A. Zeeb 	TE_P2P_CLIENT_AGGRESSIVE_ASSOC,
28bfcc09ddSBjoern A. Zeeb 	TE_P2P_CLIENT_ASSOC,
29bfcc09ddSBjoern A. Zeeb 	TE_P2P_CLIENT_QUIET_PERIOD,
30bfcc09ddSBjoern A. Zeeb 
31bfcc09ddSBjoern A. Zeeb 	/* P2P GO Events */
32bfcc09ddSBjoern A. Zeeb 	TE_P2P_GO_ASSOC_PROT,
33bfcc09ddSBjoern A. Zeeb 	TE_P2P_GO_REPETITIVET_NOA,
34bfcc09ddSBjoern A. Zeeb 	TE_P2P_GO_CT_WINDOW,
35bfcc09ddSBjoern A. Zeeb 
36bfcc09ddSBjoern A. Zeeb 	/* WiDi Sync Events */
37bfcc09ddSBjoern A. Zeeb 	TE_WIDI_TX_SYNC,
38bfcc09ddSBjoern A. Zeeb 
39bfcc09ddSBjoern A. Zeeb 	/* Channel Switch NoA */
40bfcc09ddSBjoern A. Zeeb 	TE_CHANNEL_SWITCH_PERIOD,
41bfcc09ddSBjoern A. Zeeb 
42bfcc09ddSBjoern A. Zeeb 	TE_MAX
43bfcc09ddSBjoern A. Zeeb }; /* MAC_EVENT_TYPE_API_E_VER_1 */
44bfcc09ddSBjoern A. Zeeb 
45bfcc09ddSBjoern A. Zeeb /* Time event - defines for command API v1 */
46bfcc09ddSBjoern A. Zeeb 
47bfcc09ddSBjoern A. Zeeb /*
48bfcc09ddSBjoern A. Zeeb  * @TE_V1_FRAG_NONE: fragmentation of the time event is NOT allowed.
49bfcc09ddSBjoern A. Zeeb  * @TE_V1_FRAG_SINGLE: fragmentation of the time event is allowed, but only
50bfcc09ddSBjoern A. Zeeb  *	the first fragment is scheduled.
51bfcc09ddSBjoern A. Zeeb  * @TE_V1_FRAG_DUAL: fragmentation of the time event is allowed, but only
52bfcc09ddSBjoern A. Zeeb  *	the first 2 fragments are scheduled.
53bfcc09ddSBjoern A. Zeeb  * @TE_V1_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
54bfcc09ddSBjoern A. Zeeb  *	number of fragments are valid.
55bfcc09ddSBjoern A. Zeeb  *
56bfcc09ddSBjoern A. Zeeb  * Other than the constant defined above, specifying a fragmentation value 'x'
57bfcc09ddSBjoern A. Zeeb  * means that the event can be fragmented but only the first 'x' will be
58bfcc09ddSBjoern A. Zeeb  * scheduled.
59bfcc09ddSBjoern A. Zeeb  */
60bfcc09ddSBjoern A. Zeeb enum {
61bfcc09ddSBjoern A. Zeeb 	TE_V1_FRAG_NONE = 0,
62bfcc09ddSBjoern A. Zeeb 	TE_V1_FRAG_SINGLE = 1,
63bfcc09ddSBjoern A. Zeeb 	TE_V1_FRAG_DUAL = 2,
64bfcc09ddSBjoern A. Zeeb 	TE_V1_FRAG_ENDLESS = 0xffffffff
65bfcc09ddSBjoern A. Zeeb };
66bfcc09ddSBjoern A. Zeeb 
67bfcc09ddSBjoern A. Zeeb /* If a Time Event can be fragmented, this is the max number of fragments */
68bfcc09ddSBjoern A. Zeeb #define TE_V1_FRAG_MAX_MSK	0x0fffffff
69bfcc09ddSBjoern A. Zeeb /* Repeat the time event endlessly (until removed) */
70bfcc09ddSBjoern A. Zeeb #define TE_V1_REPEAT_ENDLESS	0xffffffff
71bfcc09ddSBjoern A. Zeeb /* If a Time Event has bounded repetitions, this is the maximal value */
72bfcc09ddSBjoern A. Zeeb #define TE_V1_REPEAT_MAX_MSK_V1	0x0fffffff
73bfcc09ddSBjoern A. Zeeb 
74bfcc09ddSBjoern A. Zeeb /* Time Event dependencies: none, on another TE, or in a specific time */
75bfcc09ddSBjoern A. Zeeb enum {
76bfcc09ddSBjoern A. Zeeb 	TE_V1_INDEPENDENT		= 0,
77bfcc09ddSBjoern A. Zeeb 	TE_V1_DEP_OTHER			= BIT(0),
78bfcc09ddSBjoern A. Zeeb 	TE_V1_DEP_TSF			= BIT(1),
79bfcc09ddSBjoern A. Zeeb 	TE_V1_EVENT_SOCIOPATHIC		= BIT(2),
80bfcc09ddSBjoern A. Zeeb }; /* MAC_EVENT_DEPENDENCY_POLICY_API_E_VER_2 */
81bfcc09ddSBjoern A. Zeeb 
82bfcc09ddSBjoern A. Zeeb /*
83bfcc09ddSBjoern A. Zeeb  * @TE_V1_NOTIF_NONE: no notifications
84bfcc09ddSBjoern A. Zeeb  * @TE_V1_NOTIF_HOST_EVENT_START: request/receive notification on event start
85bfcc09ddSBjoern A. Zeeb  * @TE_V1_NOTIF_HOST_EVENT_END:request/receive notification on event end
86bfcc09ddSBjoern A. Zeeb  * @TE_V1_NOTIF_INTERNAL_EVENT_START: internal FW use
87bfcc09ddSBjoern A. Zeeb  * @TE_V1_NOTIF_INTERNAL_EVENT_END: internal FW use.
88bfcc09ddSBjoern A. Zeeb  * @TE_V1_NOTIF_HOST_FRAG_START: request/receive notification on frag start
89bfcc09ddSBjoern A. Zeeb  * @TE_V1_NOTIF_HOST_FRAG_END:request/receive notification on frag end
90bfcc09ddSBjoern A. Zeeb  * @TE_V1_NOTIF_INTERNAL_FRAG_START: internal FW use.
91bfcc09ddSBjoern A. Zeeb  * @TE_V1_NOTIF_INTERNAL_FRAG_END: internal FW use.
92bfcc09ddSBjoern A. Zeeb  *
93bfcc09ddSBjoern A. Zeeb  * Supported Time event notifications configuration.
94bfcc09ddSBjoern A. Zeeb  * A notification (both event and fragment) includes a status indicating weather
95bfcc09ddSBjoern A. Zeeb  * the FW was able to schedule the event or not. For fragment start/end
96bfcc09ddSBjoern A. Zeeb  * notification the status is always success. There is no start/end fragment
97bfcc09ddSBjoern A. Zeeb  * notification for monolithic events.
98bfcc09ddSBjoern A. Zeeb  */
99bfcc09ddSBjoern A. Zeeb enum {
100bfcc09ddSBjoern A. Zeeb 	TE_V1_NOTIF_NONE = 0,
101bfcc09ddSBjoern A. Zeeb 	TE_V1_NOTIF_HOST_EVENT_START = BIT(0),
102bfcc09ddSBjoern A. Zeeb 	TE_V1_NOTIF_HOST_EVENT_END = BIT(1),
103bfcc09ddSBjoern A. Zeeb 	TE_V1_NOTIF_INTERNAL_EVENT_START = BIT(2),
104bfcc09ddSBjoern A. Zeeb 	TE_V1_NOTIF_INTERNAL_EVENT_END = BIT(3),
105bfcc09ddSBjoern A. Zeeb 	TE_V1_NOTIF_HOST_FRAG_START = BIT(4),
106bfcc09ddSBjoern A. Zeeb 	TE_V1_NOTIF_HOST_FRAG_END = BIT(5),
107bfcc09ddSBjoern A. Zeeb 	TE_V1_NOTIF_INTERNAL_FRAG_START = BIT(6),
108bfcc09ddSBjoern A. Zeeb 	TE_V1_NOTIF_INTERNAL_FRAG_END = BIT(7),
109bfcc09ddSBjoern A. Zeeb }; /* MAC_EVENT_ACTION_API_E_VER_2 */
110bfcc09ddSBjoern A. Zeeb 
111bfcc09ddSBjoern A. Zeeb /* Time event - defines for command API */
112bfcc09ddSBjoern A. Zeeb 
113bfcc09ddSBjoern A. Zeeb /*
114bfcc09ddSBjoern A. Zeeb  * @TE_V2_FRAG_NONE: fragmentation of the time event is NOT allowed.
115bfcc09ddSBjoern A. Zeeb  * @TE_V2_FRAG_SINGLE: fragmentation of the time event is allowed, but only
116bfcc09ddSBjoern A. Zeeb  *  the first fragment is scheduled.
117bfcc09ddSBjoern A. Zeeb  * @TE_V2_FRAG_DUAL: fragmentation of the time event is allowed, but only
118bfcc09ddSBjoern A. Zeeb  *  the first 2 fragments are scheduled.
119bfcc09ddSBjoern A. Zeeb  * @TE_V2_FRAG_ENDLESS: fragmentation of the time event is allowed, and any
120bfcc09ddSBjoern A. Zeeb  *  number of fragments are valid.
121bfcc09ddSBjoern A. Zeeb  *
122bfcc09ddSBjoern A. Zeeb  * Other than the constant defined above, specifying a fragmentation value 'x'
123bfcc09ddSBjoern A. Zeeb  * means that the event can be fragmented but only the first 'x' will be
124bfcc09ddSBjoern A. Zeeb  * scheduled.
125bfcc09ddSBjoern A. Zeeb  */
126bfcc09ddSBjoern A. Zeeb enum {
127bfcc09ddSBjoern A. Zeeb 	TE_V2_FRAG_NONE = 0,
128bfcc09ddSBjoern A. Zeeb 	TE_V2_FRAG_SINGLE = 1,
129bfcc09ddSBjoern A. Zeeb 	TE_V2_FRAG_DUAL = 2,
130bfcc09ddSBjoern A. Zeeb 	TE_V2_FRAG_MAX = 0xfe,
131bfcc09ddSBjoern A. Zeeb 	TE_V2_FRAG_ENDLESS = 0xff
132bfcc09ddSBjoern A. Zeeb };
133bfcc09ddSBjoern A. Zeeb 
134bfcc09ddSBjoern A. Zeeb /* Repeat the time event endlessly (until removed) */
135bfcc09ddSBjoern A. Zeeb #define TE_V2_REPEAT_ENDLESS	0xff
136bfcc09ddSBjoern A. Zeeb /* If a Time Event has bounded repetitions, this is the maximal value */
137bfcc09ddSBjoern A. Zeeb #define TE_V2_REPEAT_MAX	0xfe
138bfcc09ddSBjoern A. Zeeb 
139bfcc09ddSBjoern A. Zeeb #define TE_V2_PLACEMENT_POS	12
140bfcc09ddSBjoern A. Zeeb #define TE_V2_ABSENCE_POS	15
141bfcc09ddSBjoern A. Zeeb 
142bfcc09ddSBjoern A. Zeeb /**
143bfcc09ddSBjoern A. Zeeb  * enum iwl_time_event_policy - Time event policy values
144bfcc09ddSBjoern A. Zeeb  * A notification (both event and fragment) includes a status indicating weather
145bfcc09ddSBjoern A. Zeeb  * the FW was able to schedule the event or not. For fragment start/end
146bfcc09ddSBjoern A. Zeeb  * notification the status is always success. There is no start/end fragment
147bfcc09ddSBjoern A. Zeeb  * notification for monolithic events.
148bfcc09ddSBjoern A. Zeeb  *
149bfcc09ddSBjoern A. Zeeb  * @TE_V2_DEFAULT_POLICY: independent, social, present, unoticable
150bfcc09ddSBjoern A. Zeeb  * @TE_V2_NOTIF_HOST_EVENT_START: request/receive notification on event start
151bfcc09ddSBjoern A. Zeeb  * @TE_V2_NOTIF_HOST_EVENT_END:request/receive notification on event end
152bfcc09ddSBjoern A. Zeeb  * @TE_V2_NOTIF_INTERNAL_EVENT_START: internal FW use
153bfcc09ddSBjoern A. Zeeb  * @TE_V2_NOTIF_INTERNAL_EVENT_END: internal FW use.
154bfcc09ddSBjoern A. Zeeb  * @TE_V2_NOTIF_HOST_FRAG_START: request/receive notification on frag start
155bfcc09ddSBjoern A. Zeeb  * @TE_V2_NOTIF_HOST_FRAG_END:request/receive notification on frag end
156bfcc09ddSBjoern A. Zeeb  * @TE_V2_NOTIF_INTERNAL_FRAG_START: internal FW use.
157bfcc09ddSBjoern A. Zeeb  * @TE_V2_NOTIF_INTERNAL_FRAG_END: internal FW use.
158bfcc09ddSBjoern A. Zeeb  * @TE_V2_START_IMMEDIATELY: start time event immediately
159bfcc09ddSBjoern A. Zeeb  * @TE_V2_DEP_OTHER: depends on another time event
160bfcc09ddSBjoern A. Zeeb  * @TE_V2_DEP_TSF: depends on a specific time
161bfcc09ddSBjoern A. Zeeb  * @TE_V2_EVENT_SOCIOPATHIC: can't co-exist with other events of tha same MAC
162bfcc09ddSBjoern A. Zeeb  * @TE_V2_ABSENCE: are we present or absent during the Time Event.
163bfcc09ddSBjoern A. Zeeb  */
164bfcc09ddSBjoern A. Zeeb enum iwl_time_event_policy {
165bfcc09ddSBjoern A. Zeeb 	TE_V2_DEFAULT_POLICY = 0x0,
166bfcc09ddSBjoern A. Zeeb 
167bfcc09ddSBjoern A. Zeeb 	/* notifications (event start/stop, fragment start/stop) */
168bfcc09ddSBjoern A. Zeeb 	TE_V2_NOTIF_HOST_EVENT_START = BIT(0),
169bfcc09ddSBjoern A. Zeeb 	TE_V2_NOTIF_HOST_EVENT_END = BIT(1),
170bfcc09ddSBjoern A. Zeeb 	TE_V2_NOTIF_INTERNAL_EVENT_START = BIT(2),
171bfcc09ddSBjoern A. Zeeb 	TE_V2_NOTIF_INTERNAL_EVENT_END = BIT(3),
172bfcc09ddSBjoern A. Zeeb 
173bfcc09ddSBjoern A. Zeeb 	TE_V2_NOTIF_HOST_FRAG_START = BIT(4),
174bfcc09ddSBjoern A. Zeeb 	TE_V2_NOTIF_HOST_FRAG_END = BIT(5),
175bfcc09ddSBjoern A. Zeeb 	TE_V2_NOTIF_INTERNAL_FRAG_START = BIT(6),
176bfcc09ddSBjoern A. Zeeb 	TE_V2_NOTIF_INTERNAL_FRAG_END = BIT(7),
177bfcc09ddSBjoern A. Zeeb 	TE_V2_START_IMMEDIATELY = BIT(11),
178bfcc09ddSBjoern A. Zeeb 
179bfcc09ddSBjoern A. Zeeb 	/* placement characteristics */
180bfcc09ddSBjoern A. Zeeb 	TE_V2_DEP_OTHER = BIT(TE_V2_PLACEMENT_POS),
181bfcc09ddSBjoern A. Zeeb 	TE_V2_DEP_TSF = BIT(TE_V2_PLACEMENT_POS + 1),
182bfcc09ddSBjoern A. Zeeb 	TE_V2_EVENT_SOCIOPATHIC = BIT(TE_V2_PLACEMENT_POS + 2),
183bfcc09ddSBjoern A. Zeeb 
184bfcc09ddSBjoern A. Zeeb 	/* are we present or absent during the Time Event. */
185bfcc09ddSBjoern A. Zeeb 	TE_V2_ABSENCE = BIT(TE_V2_ABSENCE_POS),
186bfcc09ddSBjoern A. Zeeb };
187bfcc09ddSBjoern A. Zeeb 
188bfcc09ddSBjoern A. Zeeb /**
189bfcc09ddSBjoern A. Zeeb  * struct iwl_time_event_cmd - configuring Time Events
190bfcc09ddSBjoern A. Zeeb  * with struct MAC_TIME_EVENT_DATA_API_S_VER_2 (see also
191bfcc09ddSBjoern A. Zeeb  * with version 1. determined by IWL_UCODE_TLV_FLAGS)
192bfcc09ddSBjoern A. Zeeb  * ( TIME_EVENT_CMD = 0x29 )
193bfcc09ddSBjoern A. Zeeb  * @id_and_color: ID and color of the relevant MAC,
194bfcc09ddSBjoern A. Zeeb  *	&enum iwl_ctxt_id_and_color
195bfcc09ddSBjoern A. Zeeb  * @action: action to perform, one of &enum iwl_ctxt_action
196bfcc09ddSBjoern A. Zeeb  * @id: this field has two meanings, depending on the action:
197bfcc09ddSBjoern A. Zeeb  *	If the action is ADD, then it means the type of event to add.
198bfcc09ddSBjoern A. Zeeb  *	For all other actions it is the unique event ID assigned when the
199bfcc09ddSBjoern A. Zeeb  *	event was added by the FW.
200bfcc09ddSBjoern A. Zeeb  * @apply_time: When to start the Time Event (in GP2)
201bfcc09ddSBjoern A. Zeeb  * @max_delay: maximum delay to event's start (apply time), in TU
202bfcc09ddSBjoern A. Zeeb  * @depends_on: the unique ID of the event we depend on (if any)
203bfcc09ddSBjoern A. Zeeb  * @interval: interval between repetitions, in TU
204bfcc09ddSBjoern A. Zeeb  * @duration: duration of event in TU
205bfcc09ddSBjoern A. Zeeb  * @repeat: how many repetitions to do, can be TE_REPEAT_ENDLESS
206bfcc09ddSBjoern A. Zeeb  * @max_frags: maximal number of fragments the Time Event can be divided to
207bfcc09ddSBjoern A. Zeeb  * @policy: defines whether uCode shall notify the host or other uCode modules
208bfcc09ddSBjoern A. Zeeb  *	on event and/or fragment start and/or end
209bfcc09ddSBjoern A. Zeeb  *	using one of TE_INDEPENDENT, TE_DEP_OTHER, TE_DEP_TSF
210bfcc09ddSBjoern A. Zeeb  *	TE_EVENT_SOCIOPATHIC
211bfcc09ddSBjoern A. Zeeb  *	using TE_ABSENCE and using TE_NOTIF_*,
212bfcc09ddSBjoern A. Zeeb  *	&enum iwl_time_event_policy
213bfcc09ddSBjoern A. Zeeb  */
214bfcc09ddSBjoern A. Zeeb struct iwl_time_event_cmd {
215bfcc09ddSBjoern A. Zeeb 	/* COMMON_INDEX_HDR_API_S_VER_1 */
216bfcc09ddSBjoern A. Zeeb 	__le32 id_and_color;
217bfcc09ddSBjoern A. Zeeb 	__le32 action;
218bfcc09ddSBjoern A. Zeeb 	__le32 id;
219bfcc09ddSBjoern A. Zeeb 	/* MAC_TIME_EVENT_DATA_API_S_VER_2 */
220bfcc09ddSBjoern A. Zeeb 	__le32 apply_time;
221bfcc09ddSBjoern A. Zeeb 	__le32 max_delay;
222bfcc09ddSBjoern A. Zeeb 	__le32 depends_on;
223bfcc09ddSBjoern A. Zeeb 	__le32 interval;
224bfcc09ddSBjoern A. Zeeb 	__le32 duration;
225bfcc09ddSBjoern A. Zeeb 	u8 repeat;
226bfcc09ddSBjoern A. Zeeb 	u8 max_frags;
227bfcc09ddSBjoern A. Zeeb 	__le16 policy;
228bfcc09ddSBjoern A. Zeeb } __packed; /* MAC_TIME_EVENT_CMD_API_S_VER_2 */
229bfcc09ddSBjoern A. Zeeb 
230bfcc09ddSBjoern A. Zeeb /**
231bfcc09ddSBjoern A. Zeeb  * struct iwl_time_event_resp - response structure to iwl_time_event_cmd
232bfcc09ddSBjoern A. Zeeb  * @status: bit 0 indicates success, all others specify errors
233bfcc09ddSBjoern A. Zeeb  * @id: the Time Event type
234bfcc09ddSBjoern A. Zeeb  * @unique_id: the unique ID assigned (in ADD) or given (others) to the TE
235bfcc09ddSBjoern A. Zeeb  * @id_and_color: ID and color of the relevant MAC,
236bfcc09ddSBjoern A. Zeeb  *	&enum iwl_ctxt_id_and_color
237bfcc09ddSBjoern A. Zeeb  */
238bfcc09ddSBjoern A. Zeeb struct iwl_time_event_resp {
239bfcc09ddSBjoern A. Zeeb 	__le32 status;
240bfcc09ddSBjoern A. Zeeb 	__le32 id;
241bfcc09ddSBjoern A. Zeeb 	__le32 unique_id;
242bfcc09ddSBjoern A. Zeeb 	__le32 id_and_color;
243bfcc09ddSBjoern A. Zeeb } __packed; /* MAC_TIME_EVENT_RSP_API_S_VER_1 */
244bfcc09ddSBjoern A. Zeeb 
245bfcc09ddSBjoern A. Zeeb /**
246bfcc09ddSBjoern A. Zeeb  * struct iwl_time_event_notif - notifications of time event start/stop
247bfcc09ddSBjoern A. Zeeb  * ( TIME_EVENT_NOTIFICATION = 0x2a )
248bfcc09ddSBjoern A. Zeeb  * @timestamp: action timestamp in GP2
249bfcc09ddSBjoern A. Zeeb  * @session_id: session's unique id
250bfcc09ddSBjoern A. Zeeb  * @unique_id: unique id of the Time Event itself
251bfcc09ddSBjoern A. Zeeb  * @id_and_color: ID and color of the relevant MAC
252bfcc09ddSBjoern A. Zeeb  * @action: &enum iwl_time_event_policy
253bfcc09ddSBjoern A. Zeeb  * @status: true if scheduled, false otherwise (not executed)
254bfcc09ddSBjoern A. Zeeb  */
255bfcc09ddSBjoern A. Zeeb struct iwl_time_event_notif {
256bfcc09ddSBjoern A. Zeeb 	__le32 timestamp;
257bfcc09ddSBjoern A. Zeeb 	__le32 session_id;
258bfcc09ddSBjoern A. Zeeb 	__le32 unique_id;
259bfcc09ddSBjoern A. Zeeb 	__le32 id_and_color;
260bfcc09ddSBjoern A. Zeeb 	__le32 action;
261bfcc09ddSBjoern A. Zeeb 	__le32 status;
262bfcc09ddSBjoern A. Zeeb } __packed; /* MAC_TIME_EVENT_NTFY_API_S_VER_1 */
263bfcc09ddSBjoern A. Zeeb 
264bfcc09ddSBjoern A. Zeeb /*
265bfcc09ddSBjoern A. Zeeb  * struct iwl_hs20_roc_req_tail - tail of iwl_hs20_roc_req
266bfcc09ddSBjoern A. Zeeb  *
267bfcc09ddSBjoern A. Zeeb  * @node_addr: Our MAC Address
268bfcc09ddSBjoern A. Zeeb  * @reserved: reserved for alignment
269bfcc09ddSBjoern A. Zeeb  * @apply_time: GP2 value to start (should always be the current GP2 value)
270bfcc09ddSBjoern A. Zeeb  * @apply_time_max_delay: Maximum apply time delay value in TU. Defines max
271bfcc09ddSBjoern A. Zeeb  *	time by which start of the event is allowed to be postponed.
272bfcc09ddSBjoern A. Zeeb  * @duration: event duration in TU To calculate event duration:
273bfcc09ddSBjoern A. Zeeb  *	timeEventDuration = min(duration, remainingQuota)
274bfcc09ddSBjoern A. Zeeb  */
275bfcc09ddSBjoern A. Zeeb struct iwl_hs20_roc_req_tail {
276bfcc09ddSBjoern A. Zeeb 	u8 node_addr[ETH_ALEN];
277bfcc09ddSBjoern A. Zeeb 	__le16 reserved;
278bfcc09ddSBjoern A. Zeeb 	__le32 apply_time;
279bfcc09ddSBjoern A. Zeeb 	__le32 apply_time_max_delay;
280bfcc09ddSBjoern A. Zeeb 	__le32 duration;
281bfcc09ddSBjoern A. Zeeb } __packed;
282bfcc09ddSBjoern A. Zeeb 
283bfcc09ddSBjoern A. Zeeb /*
284bfcc09ddSBjoern A. Zeeb  * Aux ROC command
285bfcc09ddSBjoern A. Zeeb  *
286bfcc09ddSBjoern A. Zeeb  * Command requests the firmware to create a time event for a certain duration
287bfcc09ddSBjoern A. Zeeb  * and remain on the given channel. This is done by using the Aux framework in
288bfcc09ddSBjoern A. Zeeb  * the FW.
289bfcc09ddSBjoern A. Zeeb  * The command was first used for Hot Spot issues - but can be used regardless
290bfcc09ddSBjoern A. Zeeb  * to Hot Spot.
291bfcc09ddSBjoern A. Zeeb  *
292bfcc09ddSBjoern A. Zeeb  * ( HOT_SPOT_CMD 0x53 )
293bfcc09ddSBjoern A. Zeeb  *
294bfcc09ddSBjoern A. Zeeb  * @id_and_color: ID and color of the MAC
2959af1bba4SBjoern A. Zeeb  * @action: action to perform, see &enum iwl_ctxt_action
296bfcc09ddSBjoern A. Zeeb  * @event_unique_id: If the action FW_CTXT_ACTION_REMOVE then the
297bfcc09ddSBjoern A. Zeeb  *	event_unique_id should be the id of the time event assigned by ucode.
298bfcc09ddSBjoern A. Zeeb  *	Otherwise ignore the event_unique_id.
299bfcc09ddSBjoern A. Zeeb  * @sta_id_and_color: station id and color, resumed during "Remain On Channel"
300bfcc09ddSBjoern A. Zeeb  *	activity.
301bfcc09ddSBjoern A. Zeeb  * @channel_info: channel info
302bfcc09ddSBjoern A. Zeeb  */
303bfcc09ddSBjoern A. Zeeb struct iwl_hs20_roc_req {
304bfcc09ddSBjoern A. Zeeb 	/* COMMON_INDEX_HDR_API_S_VER_1 hdr */
305bfcc09ddSBjoern A. Zeeb 	__le32 id_and_color;
306bfcc09ddSBjoern A. Zeeb 	__le32 action;
307bfcc09ddSBjoern A. Zeeb 	__le32 event_unique_id;
308bfcc09ddSBjoern A. Zeeb 	__le32 sta_id_and_color;
309bfcc09ddSBjoern A. Zeeb 	struct iwl_fw_channel_info channel_info;
310bfcc09ddSBjoern A. Zeeb 	struct iwl_hs20_roc_req_tail tail;
311bfcc09ddSBjoern A. Zeeb } __packed; /* HOT_SPOT_CMD_API_S_VER_1 */
312bfcc09ddSBjoern A. Zeeb 
313bfcc09ddSBjoern A. Zeeb /*
314bfcc09ddSBjoern A. Zeeb  * values for AUX ROC result values
315bfcc09ddSBjoern A. Zeeb  */
316bfcc09ddSBjoern A. Zeeb enum iwl_mvm_hot_spot {
317bfcc09ddSBjoern A. Zeeb 	HOT_SPOT_RSP_STATUS_OK,
318bfcc09ddSBjoern A. Zeeb 	HOT_SPOT_RSP_STATUS_TOO_MANY_EVENTS,
319bfcc09ddSBjoern A. Zeeb 	HOT_SPOT_MAX_NUM_OF_SESSIONS,
320bfcc09ddSBjoern A. Zeeb };
321bfcc09ddSBjoern A. Zeeb 
322bfcc09ddSBjoern A. Zeeb /*
323bfcc09ddSBjoern A. Zeeb  * Aux ROC command response
324bfcc09ddSBjoern A. Zeeb  *
325bfcc09ddSBjoern A. Zeeb  * In response to iwl_hs20_roc_req the FW sends this command to notify the
326bfcc09ddSBjoern A. Zeeb  * driver the uid of the timevent.
327bfcc09ddSBjoern A. Zeeb  *
328bfcc09ddSBjoern A. Zeeb  * ( HOT_SPOT_CMD 0x53 )
329bfcc09ddSBjoern A. Zeeb  *
330bfcc09ddSBjoern A. Zeeb  * @event_unique_id: Unique ID of time event assigned by ucode
331bfcc09ddSBjoern A. Zeeb  * @status: Return status 0 is success, all the rest used for specific errors
332bfcc09ddSBjoern A. Zeeb  */
333bfcc09ddSBjoern A. Zeeb struct iwl_hs20_roc_res {
334bfcc09ddSBjoern A. Zeeb 	__le32 event_unique_id;
335bfcc09ddSBjoern A. Zeeb 	__le32 status;
336bfcc09ddSBjoern A. Zeeb } __packed; /* HOT_SPOT_RSP_API_S_VER_1 */
337bfcc09ddSBjoern A. Zeeb 
338*a4128aadSBjoern A. Zeeb /*
339*a4128aadSBjoern A. Zeeb  * Activity types for the ROC command
340*a4128aadSBjoern A. Zeeb  * @ROC_ACTIVITY_HOTSPOT: ROC for hs20 activity
341*a4128aadSBjoern A. Zeeb  * @ROC_ACTIVITY_P2P_DISC: ROC for p2p discoverability activity
342*a4128aadSBjoern A. Zeeb  * @ROC_ACTIVITY_P2P_TXRX: ROC for p2p action frames activity
343*a4128aadSBjoern A. Zeeb  * @ROC_ACTIVITY_P2P_NEG: ROC for p2p negotiation (used also for TX)
344*a4128aadSBjoern A. Zeeb  */
345*a4128aadSBjoern A. Zeeb enum iwl_roc_activity {
346*a4128aadSBjoern A. Zeeb 	ROC_ACTIVITY_HOTSPOT,
347*a4128aadSBjoern A. Zeeb 	ROC_ACTIVITY_P2P_DISC,
348*a4128aadSBjoern A. Zeeb 	ROC_ACTIVITY_P2P_TXRX,
349*a4128aadSBjoern A. Zeeb 	ROC_ACTIVITY_P2P_NEG,
350*a4128aadSBjoern A. Zeeb 	ROC_NUM_ACTIVITIES
351*a4128aadSBjoern A. Zeeb }; /* ROC_ACTIVITY_API_E_VER_1 */
352*a4128aadSBjoern A. Zeeb 
353*a4128aadSBjoern A. Zeeb /*
354*a4128aadSBjoern A. Zeeb  * ROC command
355*a4128aadSBjoern A. Zeeb  *
356*a4128aadSBjoern A. Zeeb  * Command requests the firmware to remain on a channel for a certain duration.
357*a4128aadSBjoern A. Zeeb  *
358*a4128aadSBjoern A. Zeeb  * ( MAC_CONF_GROUP 0x3, ROC_CMD 0xE )
359*a4128aadSBjoern A. Zeeb  *
360*a4128aadSBjoern A. Zeeb  * @action: action to perform, see &enum iwl_ctxt_action
361*a4128aadSBjoern A. Zeeb  * @activity: type of activity, see &enum iwl_roc_activity
362*a4128aadSBjoern A. Zeeb  * @sta_id: station id, resumed during "Remain On Channel" activity.
363*a4128aadSBjoern A. Zeeb  * @channel_info: &struct iwl_fw_channel_info
364*a4128aadSBjoern A. Zeeb  * @node_addr: node MAC address for Rx filtering
365*a4128aadSBjoern A. Zeeb  * @reserved: align to a dword
366*a4128aadSBjoern A. Zeeb  * @max_delay: max delay the ROC can start in TU
367*a4128aadSBjoern A. Zeeb  * @duration: remain on channel duration in TU
368*a4128aadSBjoern A. Zeeb  */
369*a4128aadSBjoern A. Zeeb struct iwl_roc_req {
370*a4128aadSBjoern A. Zeeb 	__le32 action;
371*a4128aadSBjoern A. Zeeb 	__le32 activity;
372*a4128aadSBjoern A. Zeeb 	__le32 sta_id;
373*a4128aadSBjoern A. Zeeb 	struct iwl_fw_channel_info channel_info;
374*a4128aadSBjoern A. Zeeb 	u8 node_addr[ETH_ALEN];
375*a4128aadSBjoern A. Zeeb 	__le16 reserved;
376*a4128aadSBjoern A. Zeeb 	__le32 max_delay;
377*a4128aadSBjoern A. Zeeb 	__le32 duration;
378*a4128aadSBjoern A. Zeeb } __packed; /* ROC_CMD_API_S_VER_3 */
379*a4128aadSBjoern A. Zeeb 
380*a4128aadSBjoern A. Zeeb /*
381*a4128aadSBjoern A. Zeeb  * ROC notification
382*a4128aadSBjoern A. Zeeb  *
383*a4128aadSBjoern A. Zeeb  * Notification when ROC startes and when ROC ended.
384*a4128aadSBjoern A. Zeeb  *
385*a4128aadSBjoern A. Zeeb  * ( MAC_CONF_GROUP 0x3, ROC_NOTIF 0xf8 )
386*a4128aadSBjoern A. Zeeb  *
387*a4128aadSBjoern A. Zeeb  * @status: true if ROC succeeded to start
388*a4128aadSBjoern A. Zeeb  * @start_end: true if ROC started, false if ROC ended
389*a4128aadSBjoern A. Zeeb  * @activity: notification to which activity - &enum iwl_roc_activity
390*a4128aadSBjoern A. Zeeb  */
391*a4128aadSBjoern A. Zeeb struct iwl_roc_notif {
392*a4128aadSBjoern A. Zeeb 	__le32 success;
393*a4128aadSBjoern A. Zeeb 	__le32 started;
394*a4128aadSBjoern A. Zeeb 	__le32 activity;
395*a4128aadSBjoern A. Zeeb } __packed; /* ROC_NOTIF_API_S_VER_1 */
396*a4128aadSBjoern A. Zeeb 
397bfcc09ddSBjoern A. Zeeb /**
398bfcc09ddSBjoern A. Zeeb  * enum iwl_mvm_session_prot_conf_id - session protection's configurations
399bfcc09ddSBjoern A. Zeeb  * @SESSION_PROTECT_CONF_ASSOC: Start a session protection for association.
400bfcc09ddSBjoern A. Zeeb  *	The firmware will allocate two events.
401bfcc09ddSBjoern A. Zeeb  *	Valid for BSS_STA and P2P_STA.
402bfcc09ddSBjoern A. Zeeb  *	* A rather short event that can't be fragmented and with a very
403bfcc09ddSBjoern A. Zeeb  *	high priority. If every goes well (99% of the cases) the
404bfcc09ddSBjoern A. Zeeb  *	association should complete within this first event. During
405bfcc09ddSBjoern A. Zeeb  *	that event, no other activity will happen in the firmware,
406bfcc09ddSBjoern A. Zeeb  *	which is why it can't be too long.
407bfcc09ddSBjoern A. Zeeb  *	The length of this event is hard-coded in the firmware: 300TUs.
408bfcc09ddSBjoern A. Zeeb  *	* Another event which can be much longer (it's duration is
409bfcc09ddSBjoern A. Zeeb  *	configurable by the driver) which has a slightly lower
410bfcc09ddSBjoern A. Zeeb  *	priority and that can be fragmented allowing other activities
411bfcc09ddSBjoern A. Zeeb  *	to run while this event is running.
412bfcc09ddSBjoern A. Zeeb  *	The firmware will automatically remove both events once the driver sets
413bfcc09ddSBjoern A. Zeeb  *	the BSS MAC as associated. Neither of the events will be removed
414bfcc09ddSBjoern A. Zeeb  *	for the P2P_STA MAC.
415bfcc09ddSBjoern A. Zeeb  *	Only the duration is configurable for this protection.
416bfcc09ddSBjoern A. Zeeb  * @SESSION_PROTECT_CONF_GO_CLIENT_ASSOC: not used
417bfcc09ddSBjoern A. Zeeb  * @SESSION_PROTECT_CONF_P2P_DEVICE_DISCOV: Schedule the P2P Device to be in
418bfcc09ddSBjoern A. Zeeb  *	listen mode. Will be fragmented. Valid only on the P2P Device MAC.
419bfcc09ddSBjoern A. Zeeb  *	Valid only on the P2P Device MAC. The firmware will take into account
420bfcc09ddSBjoern A. Zeeb  *	the duration, the interval and the repetition count.
421bfcc09ddSBjoern A. Zeeb  * @SESSION_PROTECT_CONF_P2P_GO_NEGOTIATION: Schedule the P2P Device to be be
422bfcc09ddSBjoern A. Zeeb  *	able to run the GO Negotiation. Will not be fragmented and not
423bfcc09ddSBjoern A. Zeeb  *	repetitive. Valid only on the P2P Device MAC. Only the duration will
424bfcc09ddSBjoern A. Zeeb  *	be taken into account.
425bfcc09ddSBjoern A. Zeeb  * @SESSION_PROTECT_CONF_MAX_ID: not used
426bfcc09ddSBjoern A. Zeeb  */
427bfcc09ddSBjoern A. Zeeb enum iwl_mvm_session_prot_conf_id {
428bfcc09ddSBjoern A. Zeeb 	SESSION_PROTECT_CONF_ASSOC,
429bfcc09ddSBjoern A. Zeeb 	SESSION_PROTECT_CONF_GO_CLIENT_ASSOC,
430bfcc09ddSBjoern A. Zeeb 	SESSION_PROTECT_CONF_P2P_DEVICE_DISCOV,
431bfcc09ddSBjoern A. Zeeb 	SESSION_PROTECT_CONF_P2P_GO_NEGOTIATION,
432bfcc09ddSBjoern A. Zeeb 	SESSION_PROTECT_CONF_MAX_ID,
433bfcc09ddSBjoern A. Zeeb }; /* SESSION_PROTECTION_CONF_ID_E_VER_1 */
434bfcc09ddSBjoern A. Zeeb 
435bfcc09ddSBjoern A. Zeeb /**
436bfcc09ddSBjoern A. Zeeb  * struct iwl_mvm_session_prot_cmd - configure a session protection
437*a4128aadSBjoern A. Zeeb  * @id_and_color: the id and color of the link (or mac, for command version 1)
438*a4128aadSBjoern A. Zeeb  *	for which this session protection is sent
4399af1bba4SBjoern A. Zeeb  * @action: can be either FW_CTXT_ACTION_ADD or FW_CTXT_ACTION_REMOVE,
4409af1bba4SBjoern A. Zeeb  *	see &enum iwl_ctxt_action
441bfcc09ddSBjoern A. Zeeb  * @conf_id: see &enum iwl_mvm_session_prot_conf_id
442bfcc09ddSBjoern A. Zeeb  * @duration_tu: the duration of the whole protection in TUs.
443bfcc09ddSBjoern A. Zeeb  * @repetition_count: not used
444bfcc09ddSBjoern A. Zeeb  * @interval: not used
445bfcc09ddSBjoern A. Zeeb  *
446bfcc09ddSBjoern A. Zeeb  * Note: the session protection will always be scheduled to start as
447bfcc09ddSBjoern A. Zeeb  * early as possible, but the maximum delay is configuration dependent.
448bfcc09ddSBjoern A. Zeeb  * The firmware supports only one concurrent session protection per vif.
449bfcc09ddSBjoern A. Zeeb  * Adding a new session protection will remove any currently running session.
450bfcc09ddSBjoern A. Zeeb  */
451bfcc09ddSBjoern A. Zeeb struct iwl_mvm_session_prot_cmd {
452bfcc09ddSBjoern A. Zeeb 	/* COMMON_INDEX_HDR_API_S_VER_1 hdr */
453bfcc09ddSBjoern A. Zeeb 	__le32 id_and_color;
454bfcc09ddSBjoern A. Zeeb 	__le32 action;
455bfcc09ddSBjoern A. Zeeb 	__le32 conf_id;
456bfcc09ddSBjoern A. Zeeb 	__le32 duration_tu;
457bfcc09ddSBjoern A. Zeeb 	__le32 repetition_count;
458bfcc09ddSBjoern A. Zeeb 	__le32 interval;
459*a4128aadSBjoern A. Zeeb } __packed;
460*a4128aadSBjoern A. Zeeb /* SESSION_PROTECTION_CMD_API_S_VER_1 and
461*a4128aadSBjoern A. Zeeb  * SESSION_PROTECTION_CMD_API_S_VER_2
462*a4128aadSBjoern A. Zeeb  */
463bfcc09ddSBjoern A. Zeeb 
464bfcc09ddSBjoern A. Zeeb /**
465bfcc09ddSBjoern A. Zeeb  * struct iwl_mvm_session_prot_notif - session protection started / ended
466*a4128aadSBjoern A. Zeeb  * @mac_link_id: the mac id (or link id, for notif ver > 2) for which the
467*a4128aadSBjoern A. Zeeb  *	session protection started / ended
468bfcc09ddSBjoern A. Zeeb  * @status: 1 means success, 0 means failure
469bfcc09ddSBjoern A. Zeeb  * @start: 1 means the session protection started, 0 means it ended
470bfcc09ddSBjoern A. Zeeb  * @conf_id: see &enum iwl_mvm_session_prot_conf_id
471bfcc09ddSBjoern A. Zeeb  *
472bfcc09ddSBjoern A. Zeeb  * Note that any session protection will always get two notifications: start
473bfcc09ddSBjoern A. Zeeb  * and end even the firmware could not schedule it.
474bfcc09ddSBjoern A. Zeeb  */
475bfcc09ddSBjoern A. Zeeb struct iwl_mvm_session_prot_notif {
476*a4128aadSBjoern A. Zeeb 	__le32 mac_link_id;
477bfcc09ddSBjoern A. Zeeb 	__le32 status;
478bfcc09ddSBjoern A. Zeeb 	__le32 start;
479bfcc09ddSBjoern A. Zeeb 	__le32 conf_id;
480*a4128aadSBjoern A. Zeeb } __packed;
481*a4128aadSBjoern A. Zeeb /* SESSION_PROTECTION_NOTIFICATION_API_S_VER_2 and
482*a4128aadSBjoern A. Zeeb  * SESSION_PROTECTION_NOTIFICATION_API_S_VER_3
483*a4128aadSBjoern A. Zeeb  */
484bfcc09ddSBjoern A. Zeeb 
485bfcc09ddSBjoern A. Zeeb #endif /* __iwl_fw_api_time_event_h__ */
486