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