199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
299a2dd95SBruce Richardson  * Copyright(c) 2017 Cavium, Inc.
399a2dd95SBruce Richardson  * Copyright(c) 2017-2018 Intel Corporation.
499a2dd95SBruce Richardson  * All rights reserved.
599a2dd95SBruce Richardson  */
699a2dd95SBruce Richardson 
799a2dd95SBruce Richardson #ifndef __RTE_EVENT_TIMER_ADAPTER_H__
899a2dd95SBruce Richardson #define __RTE_EVENT_TIMER_ADAPTER_H__
999a2dd95SBruce Richardson 
1099a2dd95SBruce Richardson /**
1199a2dd95SBruce Richardson  * @file
1299a2dd95SBruce Richardson  *
1399a2dd95SBruce Richardson  * RTE Event Timer Adapter
1499a2dd95SBruce Richardson  *
1599a2dd95SBruce Richardson  * An event timer adapter has the following abstract working model:
1699a2dd95SBruce Richardson  *
1799a2dd95SBruce Richardson  *                               timer_tick_ns
1899a2dd95SBruce Richardson  *                                   +
1999a2dd95SBruce Richardson  *                      +-------+    |
2099a2dd95SBruce Richardson  *                      |       |    |
2199a2dd95SBruce Richardson  *              +-------+ bkt 0 +----v---+
2299a2dd95SBruce Richardson  *              |       |       |        |
2399a2dd95SBruce Richardson  *              |       +-------+        |
2499a2dd95SBruce Richardson  *          +---+---+                +---+---+  +---+---+---+---+
2599a2dd95SBruce Richardson  *          |       |                |       |  |   |   |   |   |
2699a2dd95SBruce Richardson  *          | bkt n |                | bkt 1 |<-> t0| t1| t2| tn|
2799a2dd95SBruce Richardson  *          |       |                |       |  |   |   |   |   |
2899a2dd95SBruce Richardson  *          +---+---+                +---+---+  +---+---+---+---+
2999a2dd95SBruce Richardson  *              |     Timer adapter      |
3099a2dd95SBruce Richardson  *          +---+---+                +---+---+
3199a2dd95SBruce Richardson  *          |       |                |       |
3299a2dd95SBruce Richardson  *          | bkt 4 |                | bkt 2 |<--- Current bucket
3399a2dd95SBruce Richardson  *          |       |                |       |
3499a2dd95SBruce Richardson  *          +---+---+                +---+---+
3599a2dd95SBruce Richardson  *               |      +-------+       |
3699a2dd95SBruce Richardson  *               |      |       |       |
3799a2dd95SBruce Richardson  *               +------+ bkt 3 +-------+
3899a2dd95SBruce Richardson  *                      |       |
3999a2dd95SBruce Richardson  *                      +-------+
4099a2dd95SBruce Richardson  *
4199a2dd95SBruce Richardson  * - It has a virtual monotonically increasing 64-bit timer adapter clock based
4299a2dd95SBruce Richardson  *   on *enum rte_event_timer_adapter_clk_src* clock source. The clock source
4399a2dd95SBruce Richardson  *   could be a CPU clock, or a platform dependent external clock.
4499a2dd95SBruce Richardson  *
4599a2dd95SBruce Richardson  * - The application creates a timer adapter instance with given the clock
4699a2dd95SBruce Richardson  *   source, the total number of event timers, and a resolution(expressed in ns)
4799a2dd95SBruce Richardson  *   to traverse between the buckets.
4899a2dd95SBruce Richardson  *
4999a2dd95SBruce Richardson  * - Each timer adapter may have 0 to n buckets based on the configured
5099a2dd95SBruce Richardson  *   max timeout(max_tmo_ns) and resolution(timer_tick_ns). Upon starting the
5199a2dd95SBruce Richardson  *   timer adapter, the adapter starts ticking at *timer_tick_ns* resolution.
5299a2dd95SBruce Richardson  *
5399a2dd95SBruce Richardson  * - The application arms an event timer that will expire *timer_tick_ns*
5499a2dd95SBruce Richardson  *   from now.
5599a2dd95SBruce Richardson  *
5699a2dd95SBruce Richardson  * - The application can cancel an armed timer and no timer expiry event will be
5799a2dd95SBruce Richardson  *   generated.
5899a2dd95SBruce Richardson  *
5999a2dd95SBruce Richardson  * - If a timer expires then the library injects the timer expiry event in
6099a2dd95SBruce Richardson  *   the designated event queue.
6199a2dd95SBruce Richardson  *
6299a2dd95SBruce Richardson  * - The timer expiry event will be received through *rte_event_dequeue_burst*.
6399a2dd95SBruce Richardson  *
6499a2dd95SBruce Richardson  * - The application frees the timer adapter instance.
6599a2dd95SBruce Richardson  *
6699a2dd95SBruce Richardson  * Multiple timer adapters can be created with a varying level of resolution
6799a2dd95SBruce Richardson  * for various expiry use cases that run in parallel.
6899a2dd95SBruce Richardson  *
6999a2dd95SBruce Richardson  * Before using the timer adapter, the application has to create and configure
7099a2dd95SBruce Richardson  * an event device along with the event port. Based on the event device
7199a2dd95SBruce Richardson  * capability it might require creating an additional event port to be used
7299a2dd95SBruce Richardson  * by the timer adapter.
7399a2dd95SBruce Richardson  *
7499a2dd95SBruce Richardson  * The application creates the event timer adapter using the
7599a2dd95SBruce Richardson  * ``rte_event_timer_adapter_create()``. The event device id is passed to this
7699a2dd95SBruce Richardson  * function, inside this function the event device capability is checked,
7799a2dd95SBruce Richardson  * and if an in-built port is absent the application uses the default
7899a2dd95SBruce Richardson  * function to create a new producer port.
7999a2dd95SBruce Richardson  *
8099a2dd95SBruce Richardson  * The application may also use the function
8199a2dd95SBruce Richardson  * ``rte_event_timer_adapter_create_ext()`` to have granular control over
8299a2dd95SBruce Richardson  * producer port creation in a case where the in-built port is absent.
8399a2dd95SBruce Richardson  *
8499a2dd95SBruce Richardson  * After creating the timer adapter, the application has to start it
8599a2dd95SBruce Richardson  * using ``rte_event_timer_adapter_start()``. The buckets are traversed from
8699a2dd95SBruce Richardson  * 0 to n; when the adapter ticks, the next bucket is visited. Each time,
8799a2dd95SBruce Richardson  * the list per bucket is processed, and timer expiry events are sent to the
8899a2dd95SBruce Richardson  * designated event queue.
8999a2dd95SBruce Richardson  *
9099a2dd95SBruce Richardson  * The application can arm one or more event timers using the
9199a2dd95SBruce Richardson  * ``rte_event_timer_arm_burst()``. The *timeout_ticks* represents the number
9299a2dd95SBruce Richardson  * of *timer_tick_ns* after which the timer has to expire. The timeout at
9399a2dd95SBruce Richardson  * which the timers expire can be grouped or be independent of each
9499a2dd95SBruce Richardson  * event timer instance. ``rte_event_timer_arm_tmo_tick_burst()`` addresses the
9599a2dd95SBruce Richardson  * former case and ``rte_event_timer_arm_burst()`` addresses the latter case.
9699a2dd95SBruce Richardson  *
9799a2dd95SBruce Richardson  * The application can cancel the timers from expiring using the
9899a2dd95SBruce Richardson  * ``rte_event_timer_cancel_burst()``.
9999a2dd95SBruce Richardson  *
10099a2dd95SBruce Richardson  * On the secondary process, ``rte_event_timer_adapter_lookup()`` can be used
10199a2dd95SBruce Richardson  * to get the timer adapter pointer from its id and use it to invoke fastpath
10299a2dd95SBruce Richardson  * operations such as arm and cancel.
10399a2dd95SBruce Richardson  *
10499a2dd95SBruce Richardson  * Some of the use cases of event timer adapter are Beacon Timers,
10599a2dd95SBruce Richardson  * Generic SW Timeout, Wireless MAC Scheduling, 3G Frame Protocols,
10699a2dd95SBruce Richardson  * Packet Scheduling, Protocol Retransmission Timers, Supervision Timers.
10799a2dd95SBruce Richardson  * All these use cases require high resolution and low time drift.
10899a2dd95SBruce Richardson  */
10999a2dd95SBruce Richardson 
11099a2dd95SBruce Richardson #ifdef __cplusplus
11199a2dd95SBruce Richardson extern "C" {
11299a2dd95SBruce Richardson #endif
11399a2dd95SBruce Richardson 
11499a2dd95SBruce Richardson 
11599a2dd95SBruce Richardson #include "rte_eventdev.h"
11699a2dd95SBruce Richardson #include "rte_eventdev_trace_fp.h"
11799a2dd95SBruce Richardson 
11899a2dd95SBruce Richardson /**
11999a2dd95SBruce Richardson  * Timer adapter clock source
12099a2dd95SBruce Richardson  */
12199a2dd95SBruce Richardson enum rte_event_timer_adapter_clk_src {
12299a2dd95SBruce Richardson 	RTE_EVENT_TIMER_ADAPTER_CPU_CLK,
12399a2dd95SBruce Richardson 	/**< Use CPU clock as the clock source. */
12499a2dd95SBruce Richardson 	RTE_EVENT_TIMER_ADAPTER_EXT_CLK0,
12599a2dd95SBruce Richardson 	/**< Platform dependent external clock source 0. */
12699a2dd95SBruce Richardson 	RTE_EVENT_TIMER_ADAPTER_EXT_CLK1,
12799a2dd95SBruce Richardson 	/**< Platform dependent external clock source 1. */
12899a2dd95SBruce Richardson 	RTE_EVENT_TIMER_ADAPTER_EXT_CLK2,
12999a2dd95SBruce Richardson 	/**< Platform dependent external clock source 2. */
13099a2dd95SBruce Richardson 	RTE_EVENT_TIMER_ADAPTER_EXT_CLK3,
13199a2dd95SBruce Richardson 	/**< Platform dependent external clock source 3. */
13299a2dd95SBruce Richardson };
13399a2dd95SBruce Richardson 
13499a2dd95SBruce Richardson #define RTE_EVENT_TIMER_ADAPTER_F_ADJUST_RES	(1ULL << 0)
13599a2dd95SBruce Richardson /**< The event timer adapter implementation may have constraints on the
13699a2dd95SBruce Richardson  * resolution (timer_tick_ns) and maximum timer expiry timeout(max_tmo_ns)
13799a2dd95SBruce Richardson  * based on the given timer adapter or system. If this flag is set, the
13899a2dd95SBruce Richardson  * implementation adjusts the resolution and maximum timeout to the best
13999a2dd95SBruce Richardson  * possible configuration. On successful timer adapter creation, the
14099a2dd95SBruce Richardson  * application can get the configured resolution and max timeout with
14199a2dd95SBruce Richardson  * ``rte_event_timer_adapter_get_info()``.
14299a2dd95SBruce Richardson  *
14399a2dd95SBruce Richardson  * @see struct rte_event_timer_adapter_info::min_resolution_ns
14499a2dd95SBruce Richardson  * @see struct rte_event_timer_adapter_info::max_tmo_ns
14599a2dd95SBruce Richardson  */
14699a2dd95SBruce Richardson #define RTE_EVENT_TIMER_ADAPTER_F_SP_PUT	(1ULL << 1)
14799a2dd95SBruce Richardson /**< ``rte_event_timer_arm_burst()`` API to be used in single producer mode.
14899a2dd95SBruce Richardson  *
14999a2dd95SBruce Richardson  * @see struct rte_event_timer_adapter_conf::flags
15099a2dd95SBruce Richardson  */
15199a2dd95SBruce Richardson 
15299a2dd95SBruce Richardson #define RTE_EVENT_TIMER_ADAPTER_F_PERIODIC	(1ULL << 2)
15399a2dd95SBruce Richardson /**< Flag to configure an event timer adapter in periodic mode; non-periodic
15499a2dd95SBruce Richardson  * mode is the default. A timer will fire once or periodically until the timer
15599a2dd95SBruce Richardson  * is cancelled based on the adapter mode.
15699a2dd95SBruce Richardson  *
15799a2dd95SBruce Richardson  * @see struct rte_event_timer_adapter_conf::flags
15899a2dd95SBruce Richardson  */
15999a2dd95SBruce Richardson 
16099a2dd95SBruce Richardson /**
16199a2dd95SBruce Richardson  * Timer adapter configuration structure
16299a2dd95SBruce Richardson  */
16399a2dd95SBruce Richardson struct rte_event_timer_adapter_conf {
16499a2dd95SBruce Richardson 	uint8_t event_dev_id;
16599a2dd95SBruce Richardson 	/**< Event device identifier */
16699a2dd95SBruce Richardson 	uint16_t timer_adapter_id;
16799a2dd95SBruce Richardson 	/**< Event timer adapter identifier */
16899a2dd95SBruce Richardson 	uint32_t socket_id;
16999a2dd95SBruce Richardson 	/**< Identifier of socket from which to allocate memory for adapter */
17099a2dd95SBruce Richardson 	enum rte_event_timer_adapter_clk_src clk_src;
17199a2dd95SBruce Richardson 	/**< Clock source for timer adapter */
17299a2dd95SBruce Richardson 	uint64_t timer_tick_ns;
17399a2dd95SBruce Richardson 	/**< Timer adapter resolution in ns */
17499a2dd95SBruce Richardson 	uint64_t max_tmo_ns;
17599a2dd95SBruce Richardson 	/**< Maximum timer timeout(expiry) in ns */
17699a2dd95SBruce Richardson 	uint64_t nb_timers;
17799a2dd95SBruce Richardson 	/**< Total number of timers per adapter */
17899a2dd95SBruce Richardson 	uint64_t flags;
17999a2dd95SBruce Richardson 	/**< Timer adapter config flags (RTE_EVENT_TIMER_ADAPTER_F_*) */
18099a2dd95SBruce Richardson };
18199a2dd95SBruce Richardson 
18299a2dd95SBruce Richardson /**
18399a2dd95SBruce Richardson  * Event timer adapter stats structure
18499a2dd95SBruce Richardson  */
18599a2dd95SBruce Richardson struct rte_event_timer_adapter_stats {
18699a2dd95SBruce Richardson 	uint64_t evtim_exp_count;
18799a2dd95SBruce Richardson 	/**< Number of event timers that have expired. */
18899a2dd95SBruce Richardson 	uint64_t ev_enq_count;
18999a2dd95SBruce Richardson 	/**< Eventdev enqueue count */
19099a2dd95SBruce Richardson 	uint64_t ev_inv_count;
19199a2dd95SBruce Richardson 	/**< Invalid expiry event count */
19299a2dd95SBruce Richardson 	uint64_t evtim_retry_count;
19399a2dd95SBruce Richardson 	/**< Event timer retry count */
19499a2dd95SBruce Richardson 	uint64_t adapter_tick_count;
19599a2dd95SBruce Richardson 	/**< Tick count for the adapter, at its resolution */
19699a2dd95SBruce Richardson };
19799a2dd95SBruce Richardson 
19899a2dd95SBruce Richardson struct rte_event_timer_adapter;
19999a2dd95SBruce Richardson 
20099a2dd95SBruce Richardson /**
20199a2dd95SBruce Richardson  * Callback function type for producer port creation.
20299a2dd95SBruce Richardson  */
20399a2dd95SBruce Richardson typedef int (*rte_event_timer_adapter_port_conf_cb_t)(uint16_t id,
20499a2dd95SBruce Richardson 						      uint8_t event_dev_id,
20599a2dd95SBruce Richardson 						      uint8_t *event_port_id,
20699a2dd95SBruce Richardson 						      void *conf_arg);
20799a2dd95SBruce Richardson 
20899a2dd95SBruce Richardson /**
20999a2dd95SBruce Richardson  * Create an event timer adapter.
21099a2dd95SBruce Richardson  *
21199a2dd95SBruce Richardson  * This function must be invoked first before any other function in the API.
21299a2dd95SBruce Richardson  *
21399a2dd95SBruce Richardson  * @param conf
21499a2dd95SBruce Richardson  *   The event timer adapter configuration structure.
21599a2dd95SBruce Richardson  *
21699a2dd95SBruce Richardson  * @return
21799a2dd95SBruce Richardson  *   A pointer to the new allocated event timer adapter on success.
21899a2dd95SBruce Richardson  *   NULL on error with rte_errno set appropriately.
21999a2dd95SBruce Richardson  *   Possible rte_errno values include:
22099a2dd95SBruce Richardson  *   - ERANGE: timer_tick_ns is not in supported range.
22199a2dd95SBruce Richardson  *   - ENOMEM: unable to allocate sufficient memory for adapter instances
22299a2dd95SBruce Richardson  *   - EINVAL: invalid event device identifier specified in config
22399a2dd95SBruce Richardson  *   - ENOSPC: maximum number of adapters already created
22499a2dd95SBruce Richardson  *   - EIO: event device reconfiguration and restart error.  The adapter
22599a2dd95SBruce Richardson  *   reconfigures the event device with an additional port by default if it is
22699a2dd95SBruce Richardson  *   required to use a service to manage timers. If the device had been started
22799a2dd95SBruce Richardson  *   before this call, this error code indicates an error in restart following
22899a2dd95SBruce Richardson  *   an error in reconfiguration, i.e., a combination of the two error codes.
22999a2dd95SBruce Richardson  */
23099a2dd95SBruce Richardson struct rte_event_timer_adapter *
23199a2dd95SBruce Richardson rte_event_timer_adapter_create(const struct rte_event_timer_adapter_conf *conf);
23299a2dd95SBruce Richardson 
23399a2dd95SBruce Richardson /**
23499a2dd95SBruce Richardson  * Create a timer adapter with the supplied callback.
23599a2dd95SBruce Richardson  *
23699a2dd95SBruce Richardson  * This function can be used to have a more granular control over the timer
23799a2dd95SBruce Richardson  * adapter creation.  If a built-in port is absent, then the function uses the
23899a2dd95SBruce Richardson  * callback provided to create and get the port id to be used as a producer
23999a2dd95SBruce Richardson  * port.
24099a2dd95SBruce Richardson  *
24199a2dd95SBruce Richardson  * @param conf
24299a2dd95SBruce Richardson  *   The timer adapter configuration structure
24399a2dd95SBruce Richardson  * @param conf_cb
24499a2dd95SBruce Richardson  *   The port config callback function.
24599a2dd95SBruce Richardson  * @param conf_arg
24699a2dd95SBruce Richardson  *   Opaque pointer to the argument for the callback function
24799a2dd95SBruce Richardson  *
24899a2dd95SBruce Richardson  * @return
24999a2dd95SBruce Richardson  *   A pointer to the new allocated event timer adapter on success.
25099a2dd95SBruce Richardson  *   NULL on error with rte_errno set appropriately.
25199a2dd95SBruce Richardson  *   Possible rte_errno values include:
25299a2dd95SBruce Richardson  *   - ERANGE: timer_tick_ns is not in supported range.
25399a2dd95SBruce Richardson  *   - ENOMEM: unable to allocate sufficient memory for adapter instances
25499a2dd95SBruce Richardson  *   - EINVAL: invalid event device identifier specified in config
25599a2dd95SBruce Richardson  *   - ENOSPC: maximum number of adapters already created
25699a2dd95SBruce Richardson  */
25799a2dd95SBruce Richardson struct rte_event_timer_adapter *
25899a2dd95SBruce Richardson rte_event_timer_adapter_create_ext(
25999a2dd95SBruce Richardson 		const struct rte_event_timer_adapter_conf *conf,
26099a2dd95SBruce Richardson 		rte_event_timer_adapter_port_conf_cb_t conf_cb,
26199a2dd95SBruce Richardson 		void *conf_arg);
26299a2dd95SBruce Richardson 
26399a2dd95SBruce Richardson /**
26499a2dd95SBruce Richardson  * Timer adapter info structure.
26599a2dd95SBruce Richardson  */
26699a2dd95SBruce Richardson struct rte_event_timer_adapter_info {
26799a2dd95SBruce Richardson 	uint64_t min_resolution_ns;
26899a2dd95SBruce Richardson 	/**< Minimum timer adapter resolution in ns */
26999a2dd95SBruce Richardson 	uint64_t max_tmo_ns;
27099a2dd95SBruce Richardson 	/**< Maximum timer timeout(expire) in ns */
27199a2dd95SBruce Richardson 	struct rte_event_timer_adapter_conf conf;
27299a2dd95SBruce Richardson 	/**< Configured timer adapter attributes */
27399a2dd95SBruce Richardson 	uint32_t caps;
27499a2dd95SBruce Richardson 	/**< Event timer adapter capabilities */
27599a2dd95SBruce Richardson 	int16_t event_dev_port_id;
27699a2dd95SBruce Richardson 	/**< Event device port ID, if applicable */
27799a2dd95SBruce Richardson };
27899a2dd95SBruce Richardson 
27999a2dd95SBruce Richardson /**
28099a2dd95SBruce Richardson  * Retrieve the contextual information of an event timer adapter.
28199a2dd95SBruce Richardson  *
28299a2dd95SBruce Richardson  * @param adapter
28399a2dd95SBruce Richardson  *   A pointer to the event timer adapter structure.
28499a2dd95SBruce Richardson  *
28599a2dd95SBruce Richardson  * @param[out] adapter_info
28699a2dd95SBruce Richardson  *   A pointer to a structure of type *rte_event_timer_adapter_info* to be
28799a2dd95SBruce Richardson  *   filled with the contextual information of the adapter.
28899a2dd95SBruce Richardson  *
28999a2dd95SBruce Richardson  * @return
29099a2dd95SBruce Richardson  *   - 0: Success, driver updates the contextual information of the
29199a2dd95SBruce Richardson  *   timer adapter
29299a2dd95SBruce Richardson  *   - <0: Error code returned by the driver info get function.
29399a2dd95SBruce Richardson  *   - -EINVAL: adapter identifier invalid
29499a2dd95SBruce Richardson  *
29599a2dd95SBruce Richardson  * @see RTE_EVENT_TIMER_ADAPTER_F_ADJUST_RES,
29699a2dd95SBruce Richardson  *   struct rte_event_timer_adapter_info
29799a2dd95SBruce Richardson  *
29899a2dd95SBruce Richardson  */
29999a2dd95SBruce Richardson int
30099a2dd95SBruce Richardson rte_event_timer_adapter_get_info(
30199a2dd95SBruce Richardson 		const struct rte_event_timer_adapter *adapter,
30299a2dd95SBruce Richardson 		struct rte_event_timer_adapter_info *adapter_info);
30399a2dd95SBruce Richardson 
30499a2dd95SBruce Richardson /**
30599a2dd95SBruce Richardson  * Start a timer adapter.
30699a2dd95SBruce Richardson  *
30799a2dd95SBruce Richardson  * The adapter start step is the last one and consists of setting the timer
30899a2dd95SBruce Richardson  * adapter to start accepting the timers and schedules to event queues.
30999a2dd95SBruce Richardson  *
31099a2dd95SBruce Richardson  * On success, all basic functions exported by the API (timer arm,
31199a2dd95SBruce Richardson  * timer cancel and so on) can be invoked.
31299a2dd95SBruce Richardson  *
31399a2dd95SBruce Richardson  * @param adapter
31499a2dd95SBruce Richardson  *   A pointer to the event timer adapter structure.
31599a2dd95SBruce Richardson  *
31699a2dd95SBruce Richardson  * @return
31799a2dd95SBruce Richardson  *   - 0: Success, adapter started.
31899a2dd95SBruce Richardson  *   - <0: Error code returned by the driver start function.
31999a2dd95SBruce Richardson  *   - -EINVAL if adapter identifier invalid
32099a2dd95SBruce Richardson  *   - -ENOENT if software adapter but no service core mapped
32199a2dd95SBruce Richardson  *   - -ENOTSUP if software adapter and more than one service core mapped
32299a2dd95SBruce Richardson  *   - -EALREADY if adapter has already been started
32399a2dd95SBruce Richardson  *
32499a2dd95SBruce Richardson  * @note
32599a2dd95SBruce Richardson  *  The eventdev to which the event_timer_adapter is connected needs to
32699a2dd95SBruce Richardson  *  be started before calling rte_event_timer_adapter_start().
32799a2dd95SBruce Richardson  */
32899a2dd95SBruce Richardson int
32999a2dd95SBruce Richardson rte_event_timer_adapter_start(
33099a2dd95SBruce Richardson 		const struct rte_event_timer_adapter *adapter);
33199a2dd95SBruce Richardson 
33299a2dd95SBruce Richardson /**
33399a2dd95SBruce Richardson  * Stop an event timer adapter.
33499a2dd95SBruce Richardson  *
33599a2dd95SBruce Richardson  * The adapter can be restarted with a call to
33699a2dd95SBruce Richardson  * ``rte_event_timer_adapter_start()``.
33799a2dd95SBruce Richardson  *
33899a2dd95SBruce Richardson  * @param adapter
33999a2dd95SBruce Richardson  *   A pointer to the event timer adapter structure.
34099a2dd95SBruce Richardson  *
34199a2dd95SBruce Richardson  * @return
34299a2dd95SBruce Richardson  *   - 0: Success, adapter stopped.
34399a2dd95SBruce Richardson  *   - <0: Error code returned by the driver stop function.
34499a2dd95SBruce Richardson  *   - -EINVAL if adapter identifier invalid
34599a2dd95SBruce Richardson  */
34699a2dd95SBruce Richardson int
34799a2dd95SBruce Richardson rte_event_timer_adapter_stop(const struct rte_event_timer_adapter *adapter);
34899a2dd95SBruce Richardson 
34999a2dd95SBruce Richardson /**
35099a2dd95SBruce Richardson  * Lookup an event timer adapter using its identifier.
35199a2dd95SBruce Richardson  *
35299a2dd95SBruce Richardson  * If an event timer adapter was created in another process with the same
35399a2dd95SBruce Richardson  * identifier, this function will locate its state and set up access to it
35499a2dd95SBruce Richardson  * so that it can be used in this process.
35599a2dd95SBruce Richardson  *
35699a2dd95SBruce Richardson  * @param adapter_id
35799a2dd95SBruce Richardson  *  The event timer adapter identifier.
35899a2dd95SBruce Richardson  *
35999a2dd95SBruce Richardson  * @return
36099a2dd95SBruce Richardson  *  A pointer to the event timer adapter matching the identifier on success.
36199a2dd95SBruce Richardson  *  NULL on error with rte_errno set appropriately.
36299a2dd95SBruce Richardson  *  Possible rte_errno values include:
36399a2dd95SBruce Richardson  *   - ENOENT - requested entry not available to return.
36499a2dd95SBruce Richardson  */
36599a2dd95SBruce Richardson struct rte_event_timer_adapter *
36699a2dd95SBruce Richardson rte_event_timer_adapter_lookup(uint16_t adapter_id);
36799a2dd95SBruce Richardson 
36899a2dd95SBruce Richardson /**
36999a2dd95SBruce Richardson  * Free an event timer adapter.
37099a2dd95SBruce Richardson  *
37199a2dd95SBruce Richardson  * Destroy an event timer adapter, freeing all resources.
37299a2dd95SBruce Richardson  *
37399a2dd95SBruce Richardson  * Before invoking this function, the application must wait for all the
37499a2dd95SBruce Richardson  * armed timers to expire or cancel the outstanding armed timers.
37599a2dd95SBruce Richardson  *
37699a2dd95SBruce Richardson  * @param adapter
37799a2dd95SBruce Richardson  *   A pointer to an event timer adapter structure.
37899a2dd95SBruce Richardson  *
37999a2dd95SBruce Richardson  * @return
38099a2dd95SBruce Richardson  *   - 0: Successfully freed the event timer adapter resources.
38199a2dd95SBruce Richardson  *   - <0: Failed to free the event timer adapter resources.
38299a2dd95SBruce Richardson  *   - -EAGAIN:  adapter is busy; timers outstanding
38399a2dd95SBruce Richardson  *   - -EBUSY: stop hasn't been called for this adapter yet
38499a2dd95SBruce Richardson  *   - -EINVAL: adapter id invalid, or adapter invalid
38599a2dd95SBruce Richardson  */
38699a2dd95SBruce Richardson int
38799a2dd95SBruce Richardson rte_event_timer_adapter_free(struct rte_event_timer_adapter *adapter);
38899a2dd95SBruce Richardson 
38999a2dd95SBruce Richardson /**
39099a2dd95SBruce Richardson  * Retrieve the service ID of the event timer adapter. If the adapter doesn't
39199a2dd95SBruce Richardson  * use an rte_service function, this function returns -ESRCH.
39299a2dd95SBruce Richardson  *
39399a2dd95SBruce Richardson  * @param adapter
39499a2dd95SBruce Richardson  *   A pointer to an event timer adapter.
39599a2dd95SBruce Richardson  *
39699a2dd95SBruce Richardson  * @param [out] service_id
39799a2dd95SBruce Richardson  *   A pointer to a uint32_t, to be filled in with the service id.
39899a2dd95SBruce Richardson  *
39999a2dd95SBruce Richardson  * @return
40099a2dd95SBruce Richardson  *   - 0: Success
40199a2dd95SBruce Richardson  *   - <0: Error code on failure
40299a2dd95SBruce Richardson  *   - -ESRCH: the adapter does not require a service to operate
40399a2dd95SBruce Richardson  */
40499a2dd95SBruce Richardson int
40599a2dd95SBruce Richardson rte_event_timer_adapter_service_id_get(struct rte_event_timer_adapter *adapter,
40699a2dd95SBruce Richardson 				       uint32_t *service_id);
40799a2dd95SBruce Richardson 
40899a2dd95SBruce Richardson /**
40999a2dd95SBruce Richardson  * Retrieve statistics for an event timer adapter instance.
41099a2dd95SBruce Richardson  *
41199a2dd95SBruce Richardson  * @param adapter
41299a2dd95SBruce Richardson  *   A pointer to an event timer adapter structure.
41399a2dd95SBruce Richardson  * @param[out] stats
41499a2dd95SBruce Richardson  *   A pointer to a structure to fill with statistics.
41599a2dd95SBruce Richardson  *
41699a2dd95SBruce Richardson  * @return
41799a2dd95SBruce Richardson  *   - 0: Successfully retrieved.
41899a2dd95SBruce Richardson  *   - <0: Failure; error code returned.
41999a2dd95SBruce Richardson  */
42099a2dd95SBruce Richardson int
42199a2dd95SBruce Richardson rte_event_timer_adapter_stats_get(struct rte_event_timer_adapter *adapter,
42299a2dd95SBruce Richardson 		struct rte_event_timer_adapter_stats *stats);
42399a2dd95SBruce Richardson 
42499a2dd95SBruce Richardson /**
42599a2dd95SBruce Richardson  * Reset statistics for an event timer adapter instance.
42699a2dd95SBruce Richardson  *
42799a2dd95SBruce Richardson  * @param adapter
42899a2dd95SBruce Richardson  *   A pointer to an event timer adapter structure.
42999a2dd95SBruce Richardson  *
43099a2dd95SBruce Richardson  * @return
43199a2dd95SBruce Richardson  *   - 0: Successfully reset;
43299a2dd95SBruce Richardson  *   - <0: Failure; error code returned.
43399a2dd95SBruce Richardson  */
43499a2dd95SBruce Richardson int
43599a2dd95SBruce Richardson rte_event_timer_adapter_stats_reset(struct rte_event_timer_adapter *adapter);
43699a2dd95SBruce Richardson 
43799a2dd95SBruce Richardson /**
43899a2dd95SBruce Richardson  * Event timer state.
43999a2dd95SBruce Richardson  */
44099a2dd95SBruce Richardson enum rte_event_timer_state {
44199a2dd95SBruce Richardson 	RTE_EVENT_TIMER_NOT_ARMED	= 0,
44299a2dd95SBruce Richardson 	/**< Event timer not armed. */
44399a2dd95SBruce Richardson 	RTE_EVENT_TIMER_ARMED		= 1,
44499a2dd95SBruce Richardson 	/**< Event timer successfully armed. */
44599a2dd95SBruce Richardson 	RTE_EVENT_TIMER_CANCELED	= 2,
44699a2dd95SBruce Richardson 	/**< Event timer successfully canceled. */
44799a2dd95SBruce Richardson 	RTE_EVENT_TIMER_ERROR		= -1,
44899a2dd95SBruce Richardson 	/**< Generic event timer error. */
44999a2dd95SBruce Richardson 	RTE_EVENT_TIMER_ERROR_TOOEARLY	= -2,
45099a2dd95SBruce Richardson 	/**< Event timer timeout tick value is too small for the adapter to
45199a2dd95SBruce Richardson 	 * handle, given its configured resolution.
45299a2dd95SBruce Richardson 	 */
45399a2dd95SBruce Richardson 	RTE_EVENT_TIMER_ERROR_TOOLATE	= -3,
45499a2dd95SBruce Richardson 	/**< Event timer timeout tick is greater than the maximum timeout.*/
45599a2dd95SBruce Richardson };
45699a2dd95SBruce Richardson 
45799a2dd95SBruce Richardson /**
45899a2dd95SBruce Richardson  * The generic *rte_event_timer* structure to hold the event timer attributes
45999a2dd95SBruce Richardson  * for arm and cancel operations.
46099a2dd95SBruce Richardson  */
46199a2dd95SBruce Richardson RTE_STD_C11
46299a2dd95SBruce Richardson struct rte_event_timer {
46399a2dd95SBruce Richardson 	struct rte_event ev;
46499a2dd95SBruce Richardson 	/**<
46599a2dd95SBruce Richardson 	 * Expiry event attributes.  On successful event timer timeout,
46699a2dd95SBruce Richardson 	 * the following attributes will be used to inject the expiry event to
46799a2dd95SBruce Richardson 	 * the eventdev:
46899a2dd95SBruce Richardson 	 *  - event_queue_id: Targeted event queue id for expiry events.
46999a2dd95SBruce Richardson 	 *  - event_priority: Event priority of the event expiry event in the
47099a2dd95SBruce Richardson 	 *  event queue relative to other events.
47199a2dd95SBruce Richardson 	 *  - sched_type: Scheduling type of the expiry event.
47299a2dd95SBruce Richardson 	 *  - flow_id: Flow id of the expiry event.
47399a2dd95SBruce Richardson 	 *  - op: RTE_EVENT_OP_NEW
47499a2dd95SBruce Richardson 	 *  - event_type: RTE_EVENT_TYPE_TIMER
47599a2dd95SBruce Richardson 	 */
47699a2dd95SBruce Richardson 	uint64_t timeout_ticks;
47799a2dd95SBruce Richardson 	/**< Expiry timer ticks expressed in number of *timer_ticks_ns* from
47899a2dd95SBruce Richardson 	 * now.
47999a2dd95SBruce Richardson 	 * @see struct rte_event_timer_adapter_info::adapter_conf::timer_tick_ns
48099a2dd95SBruce Richardson 	 */
48199a2dd95SBruce Richardson 	uint64_t impl_opaque[2];
48299a2dd95SBruce Richardson 	/**< Implementation-specific opaque data.
48399a2dd95SBruce Richardson 	 * An event timer adapter implementation use this field to hold
48499a2dd95SBruce Richardson 	 * implementation specific values to share between the arm and cancel
48599a2dd95SBruce Richardson 	 * operations.  The application should not modify this field.
48699a2dd95SBruce Richardson 	 */
4871dcd67baSPavan Nikhilesh 	enum rte_event_timer_state state;
4881dcd67baSPavan Nikhilesh 	/**< State of the event timer. */
48999a2dd95SBruce Richardson 	uint8_t user_meta[0];
49099a2dd95SBruce Richardson 	/**< Memory to store user specific metadata.
49199a2dd95SBruce Richardson 	 * The event timer adapter implementation should not modify this area.
49299a2dd95SBruce Richardson 	 */
49399a2dd95SBruce Richardson } __rte_cache_aligned;
49499a2dd95SBruce Richardson 
49599a2dd95SBruce Richardson typedef uint16_t (*rte_event_timer_arm_burst_t)(
49699a2dd95SBruce Richardson 		const struct rte_event_timer_adapter *adapter,
49799a2dd95SBruce Richardson 		struct rte_event_timer **tims,
49899a2dd95SBruce Richardson 		uint16_t nb_tims);
49999a2dd95SBruce Richardson /**< @internal Enable event timers to enqueue timer events upon expiry */
50099a2dd95SBruce Richardson typedef uint16_t (*rte_event_timer_arm_tmo_tick_burst_t)(
50199a2dd95SBruce Richardson 		const struct rte_event_timer_adapter *adapter,
50299a2dd95SBruce Richardson 		struct rte_event_timer **tims,
50399a2dd95SBruce Richardson 		uint64_t timeout_tick,
50499a2dd95SBruce Richardson 		uint16_t nb_tims);
50599a2dd95SBruce Richardson /**< @internal Enable event timers with common expiration time */
50699a2dd95SBruce Richardson typedef uint16_t (*rte_event_timer_cancel_burst_t)(
50799a2dd95SBruce Richardson 		const struct rte_event_timer_adapter *adapter,
50899a2dd95SBruce Richardson 		struct rte_event_timer **tims,
50999a2dd95SBruce Richardson 		uint16_t nb_tims);
51099a2dd95SBruce Richardson /**< @internal Prevent event timers from enqueuing timer events */
51199a2dd95SBruce Richardson 
51299a2dd95SBruce Richardson /**
51399a2dd95SBruce Richardson  * @internal Data structure associated with each event timer adapter.
51499a2dd95SBruce Richardson  */
51599a2dd95SBruce Richardson struct rte_event_timer_adapter {
51699a2dd95SBruce Richardson 	rte_event_timer_arm_burst_t arm_burst;
51799a2dd95SBruce Richardson 	/**< Pointer to driver arm_burst function. */
51899a2dd95SBruce Richardson 	rte_event_timer_arm_tmo_tick_burst_t arm_tmo_tick_burst;
51999a2dd95SBruce Richardson 	/**< Pointer to driver arm_tmo_tick_burst function. */
52099a2dd95SBruce Richardson 	rte_event_timer_cancel_burst_t cancel_burst;
52199a2dd95SBruce Richardson 	/**< Pointer to driver cancel function. */
52299a2dd95SBruce Richardson 	struct rte_event_timer_adapter_data *data;
52399a2dd95SBruce Richardson 	/**< Pointer to shared adapter data */
52453548ad3SPavan Nikhilesh 	const struct event_timer_adapter_ops *ops;
52599a2dd95SBruce Richardson 	/**< Functions exported by adapter driver */
52699a2dd95SBruce Richardson 
52799a2dd95SBruce Richardson 	RTE_STD_C11
52899a2dd95SBruce Richardson 	uint8_t allocated : 1;
52999a2dd95SBruce Richardson 	/**< Flag to indicate that this adapter has been allocated */
53099a2dd95SBruce Richardson } __rte_cache_aligned;
53199a2dd95SBruce Richardson 
53299a2dd95SBruce Richardson #define ADAPTER_VALID_OR_ERR_RET(adapter, retval) do {		\
53399a2dd95SBruce Richardson 	if (adapter == NULL || !adapter->allocated)		\
53499a2dd95SBruce Richardson 		return retval;					\
53599a2dd95SBruce Richardson } while (0)
53699a2dd95SBruce Richardson 
53799a2dd95SBruce Richardson #define FUNC_PTR_OR_ERR_RET(func, errval) do { 			\
53899a2dd95SBruce Richardson 	if ((func) == NULL)					\
53999a2dd95SBruce Richardson 		return errval;					\
54099a2dd95SBruce Richardson } while (0)
54199a2dd95SBruce Richardson 
54299a2dd95SBruce Richardson #define FUNC_PTR_OR_NULL_RET_WITH_ERRNO(func, errval) do { 	\
54399a2dd95SBruce Richardson 	if ((func) == NULL) {					\
54499a2dd95SBruce Richardson 		rte_errno = errval;				\
54599a2dd95SBruce Richardson 		return NULL;					\
54699a2dd95SBruce Richardson 	}							\
54799a2dd95SBruce Richardson } while (0)
54899a2dd95SBruce Richardson 
54999a2dd95SBruce Richardson /**
55099a2dd95SBruce Richardson  * Arm a burst of event timers with separate expiration timeout tick for each
55199a2dd95SBruce Richardson  * event timer.
55299a2dd95SBruce Richardson  *
55399a2dd95SBruce Richardson  * Before calling this function, the application allocates
55499a2dd95SBruce Richardson  * ``struct rte_event_timer`` objects from mempool or huge page backed
55599a2dd95SBruce Richardson  * application buffers of desired size. On successful allocation,
55699a2dd95SBruce Richardson  * application updates the `struct rte_event_timer`` attributes such as
55799a2dd95SBruce Richardson  * expiry event attributes, timeout ticks from now.
55899a2dd95SBruce Richardson  * This function submits the event timer arm requests to the event timer adapter
55999a2dd95SBruce Richardson  * and on expiry, the events will be injected to designated event queue.
56099a2dd95SBruce Richardson  * Timer expiry events will be generated once or periodically until cancellation
56199a2dd95SBruce Richardson  * based on the adapter mode.
56299a2dd95SBruce Richardson  *
56399a2dd95SBruce Richardson  * @param adapter
56499a2dd95SBruce Richardson  *   A pointer to an event timer adapter structure.
56599a2dd95SBruce Richardson  * @param evtims
56699a2dd95SBruce Richardson  *   Pointer to an array of objects of type *rte_event_timer* structure.
56799a2dd95SBruce Richardson  * @param nb_evtims
56899a2dd95SBruce Richardson  *   Number of event timers in the supplied array.
56999a2dd95SBruce Richardson  *
57099a2dd95SBruce Richardson  * @return
57199a2dd95SBruce Richardson  *   The number of successfully armed event timers. The return value can be less
57299a2dd95SBruce Richardson  *   than the value of the *nb_evtims* parameter. If the return value is less
57399a2dd95SBruce Richardson  *   than *nb_evtims*, the remaining event timers at the end of *evtims*
57499a2dd95SBruce Richardson  *   are not consumed, and the caller has to take care of them, and rte_errno
57599a2dd95SBruce Richardson  *   is set accordingly. Possible errno values include:
57699a2dd95SBruce Richardson  *   - EINVAL Invalid timer adapter, expiry event queue ID is invalid, or an
57799a2dd95SBruce Richardson  *   expiry event's sched type doesn't match the capabilities of the
57899a2dd95SBruce Richardson  *   destination event queue.
57999a2dd95SBruce Richardson  *   - EAGAIN Specified timer adapter is not running
58099a2dd95SBruce Richardson  *   - EALREADY A timer was encountered that was already armed
58199a2dd95SBruce Richardson  *
58299a2dd95SBruce Richardson  * @see RTE_EVENT_TIMER_ADAPTER_F_PERIODIC
58399a2dd95SBruce Richardson  *
58499a2dd95SBruce Richardson  */
58599a2dd95SBruce Richardson static inline uint16_t
rte_event_timer_arm_burst(const struct rte_event_timer_adapter * adapter,struct rte_event_timer ** evtims,uint16_t nb_evtims)58699a2dd95SBruce Richardson rte_event_timer_arm_burst(const struct rte_event_timer_adapter *adapter,
58799a2dd95SBruce Richardson 			  struct rte_event_timer **evtims,
58899a2dd95SBruce Richardson 			  uint16_t nb_evtims)
58999a2dd95SBruce Richardson {
59099a2dd95SBruce Richardson #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
59199a2dd95SBruce Richardson 	ADAPTER_VALID_OR_ERR_RET(adapter, -EINVAL);
59299a2dd95SBruce Richardson 	FUNC_PTR_OR_ERR_RET(adapter->arm_burst, -EINVAL);
59399a2dd95SBruce Richardson #endif
59499a2dd95SBruce Richardson 	rte_eventdev_trace_timer_arm_burst(adapter, (void **)evtims,
59599a2dd95SBruce Richardson 		nb_evtims);
59699a2dd95SBruce Richardson 	return adapter->arm_burst(adapter, evtims, nb_evtims);
59799a2dd95SBruce Richardson }
59899a2dd95SBruce Richardson 
59999a2dd95SBruce Richardson /**
60099a2dd95SBruce Richardson  * Arm a burst of event timers with same expiration timeout tick.
60199a2dd95SBruce Richardson  *
60299a2dd95SBruce Richardson  * Provides the same functionality as ``rte_event_timer_arm_burst()``, except
60399a2dd95SBruce Richardson  * that application can use this API when all the event timers have the
60499a2dd95SBruce Richardson  * same timeout expiration tick. This specialized function can provide the
60599a2dd95SBruce Richardson  * additional hint to the adapter implementation and optimize if possible.
60699a2dd95SBruce Richardson  *
60799a2dd95SBruce Richardson  * @param adapter
60899a2dd95SBruce Richardson  *   A pointer to an event timer adapter structure.
60999a2dd95SBruce Richardson  * @param evtims
61099a2dd95SBruce Richardson  *   Points to an array of objects of type *rte_event_timer* structure.
61199a2dd95SBruce Richardson  * @param timeout_ticks
61299a2dd95SBruce Richardson  *   The number of ticks in which the timers should expire.
61399a2dd95SBruce Richardson  * @param nb_evtims
61499a2dd95SBruce Richardson  *   Number of event timers in the supplied array.
61599a2dd95SBruce Richardson  *
61699a2dd95SBruce Richardson  * @return
61799a2dd95SBruce Richardson  *   The number of successfully armed event timers. The return value can be less
61899a2dd95SBruce Richardson  *   than the value of the *nb_evtims* parameter. If the return value is less
61999a2dd95SBruce Richardson  *   than *nb_evtims*, the remaining event timers at the end of *evtims*
62099a2dd95SBruce Richardson  *   are not consumed, and the caller has to take care of them, and rte_errno
62199a2dd95SBruce Richardson  *   is set accordingly. Possible errno values include:
62299a2dd95SBruce Richardson  *   - EINVAL Invalid timer adapter, expiry event queue ID is invalid, or an
62399a2dd95SBruce Richardson  *   expiry event's sched type doesn't match the capabilities of the
62499a2dd95SBruce Richardson  *   destination event queue.
62599a2dd95SBruce Richardson  *   - EAGAIN Specified event timer adapter is not running
62699a2dd95SBruce Richardson  *   - EALREADY A timer was encountered that was already armed
62799a2dd95SBruce Richardson  */
62899a2dd95SBruce Richardson static inline uint16_t
rte_event_timer_arm_tmo_tick_burst(const struct rte_event_timer_adapter * adapter,struct rte_event_timer ** evtims,const uint64_t timeout_ticks,const uint16_t nb_evtims)62999a2dd95SBruce Richardson rte_event_timer_arm_tmo_tick_burst(
63099a2dd95SBruce Richardson 			const struct rte_event_timer_adapter *adapter,
63199a2dd95SBruce Richardson 			struct rte_event_timer **evtims,
63299a2dd95SBruce Richardson 			const uint64_t timeout_ticks,
63399a2dd95SBruce Richardson 			const uint16_t nb_evtims)
63499a2dd95SBruce Richardson {
63599a2dd95SBruce Richardson #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
63699a2dd95SBruce Richardson 	ADAPTER_VALID_OR_ERR_RET(adapter, -EINVAL);
63799a2dd95SBruce Richardson 	FUNC_PTR_OR_ERR_RET(adapter->arm_tmo_tick_burst, -EINVAL);
63899a2dd95SBruce Richardson #endif
63999a2dd95SBruce Richardson 	rte_eventdev_trace_timer_arm_tmo_tick_burst(adapter, timeout_ticks,
64099a2dd95SBruce Richardson 		(void **)evtims, nb_evtims);
64199a2dd95SBruce Richardson 	return adapter->arm_tmo_tick_burst(adapter, evtims, timeout_ticks,
64299a2dd95SBruce Richardson 					   nb_evtims);
64399a2dd95SBruce Richardson }
64499a2dd95SBruce Richardson 
64599a2dd95SBruce Richardson /**
64699a2dd95SBruce Richardson  * Cancel a burst of event timers from being scheduled to the event device.
64799a2dd95SBruce Richardson  *
64899a2dd95SBruce Richardson  * @param adapter
64999a2dd95SBruce Richardson  *   A pointer to an event timer adapter structure.
65099a2dd95SBruce Richardson  * @param evtims
65199a2dd95SBruce Richardson  *   Points to an array of objects of type *rte_event_timer* structure
65299a2dd95SBruce Richardson  * @param nb_evtims
65399a2dd95SBruce Richardson  *   Number of event timer instances in the supplied array.
65499a2dd95SBruce Richardson  *
65599a2dd95SBruce Richardson  * @return
65699a2dd95SBruce Richardson  *   The number of successfully canceled event timers. The return value can be
65799a2dd95SBruce Richardson  *   less than the value of the *nb_evtims* parameter. If the return value is
65899a2dd95SBruce Richardson  *   less than *nb_evtims*, the remaining event timers at the end of *evtims*
65999a2dd95SBruce Richardson  *   are not consumed, and the caller has to take care of them, and rte_errno
66099a2dd95SBruce Richardson  *   is set accordingly. Possible errno values include:
66199a2dd95SBruce Richardson  *   - EINVAL Invalid timer adapter identifier
66299a2dd95SBruce Richardson  *   - EAGAIN Specified timer adapter is not running
66399a2dd95SBruce Richardson  *   - EALREADY  A timer was encountered that was already canceled
66499a2dd95SBruce Richardson  */
66599a2dd95SBruce Richardson static inline uint16_t
rte_event_timer_cancel_burst(const struct rte_event_timer_adapter * adapter,struct rte_event_timer ** evtims,uint16_t nb_evtims)66699a2dd95SBruce Richardson rte_event_timer_cancel_burst(const struct rte_event_timer_adapter *adapter,
66799a2dd95SBruce Richardson 			     struct rte_event_timer **evtims,
66899a2dd95SBruce Richardson 			     uint16_t nb_evtims)
66999a2dd95SBruce Richardson {
67099a2dd95SBruce Richardson #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
67199a2dd95SBruce Richardson 	ADAPTER_VALID_OR_ERR_RET(adapter, -EINVAL);
67299a2dd95SBruce Richardson 	FUNC_PTR_OR_ERR_RET(adapter->cancel_burst, -EINVAL);
67399a2dd95SBruce Richardson #endif
67499a2dd95SBruce Richardson 	rte_eventdev_trace_timer_cancel_burst(adapter, (void **)evtims,
67599a2dd95SBruce Richardson 		nb_evtims);
67699a2dd95SBruce Richardson 	return adapter->cancel_burst(adapter, evtims, nb_evtims);
67799a2dd95SBruce Richardson }
67899a2dd95SBruce Richardson 
679*153e7d88SBruce Richardson #ifdef __cplusplus
680*153e7d88SBruce Richardson }
681*153e7d88SBruce Richardson #endif
682*153e7d88SBruce Richardson 
68399a2dd95SBruce Richardson #endif /* __RTE_EVENT_TIMER_ADAPTER_H__ */
684