Linux Audio

Check our new training course

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