examples/fips_validation: support self-test only
[dpdk.git] / lib / librte_eventdev / rte_event_timer_adapter.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017 Cavium, Inc.
3  * Copyright(c) 2017-2018 Intel Corporation.
4  * All rights reserved.
5  */
6
7 #ifndef __RTE_EVENT_TIMER_ADAPTER_H__
8 #define __RTE_EVENT_TIMER_ADAPTER_H__
9
10 /**
11  * @file
12  *
13  * RTE Event Timer Adapter
14  *
15  * An event timer adapter has the following abstract working model:
16  *
17  *                               timer_tick_ns
18  *                                   +
19  *                      +-------+    |
20  *                      |       |    |
21  *              +-------+ bkt 0 +----v---+
22  *              |       |       |        |
23  *              |       +-------+        |
24  *          +---+---+                +---+---+  +---+---+---+---+
25  *          |       |                |       |  |   |   |   |   |
26  *          | bkt n |                | bkt 1 |<-> t0| t1| t2| tn|
27  *          |       |                |       |  |   |   |   |   |
28  *          +---+---+                +---+---+  +---+---+---+---+
29  *              |     Timer adapter      |
30  *          +---+---+                +---+---+
31  *          |       |                |       |
32  *          | bkt 4 |                | bkt 2 |<--- Current bucket
33  *          |       |                |       |
34  *          +---+---+                +---+---+
35  *               |      +-------+       |
36  *               |      |       |       |
37  *               +------+ bkt 3 +-------+
38  *                      |       |
39  *                      +-------+
40  *
41  * - It has a virtual monotonically increasing 64-bit timer adapter clock based
42  *   on *enum rte_event_timer_adapter_clk_src* clock source. The clock source
43  *   could be a CPU clock, or a platform dependent external clock.
44  *
45  * - The application creates a timer adapter instance with given the clock
46  *   source, the total number of event timers, and a resolution(expressed in ns)
47  *   to traverse between the buckets.
48  *
49  * - Each timer adapter may have 0 to n buckets based on the configured
50  *   max timeout(max_tmo_ns) and resolution(timer_tick_ns). Upon starting the
51  *   timer adapter, the adapter starts ticking at *timer_tick_ns* resolution.
52  *
53  * - The application arms an event timer that will expire *timer_tick_ns*
54  *   from now.
55  *
56  * - The application can cancel an armed timer and no timer expiry event will be
57  *   generated.
58  *
59  * - If a timer expires then the library injects the timer expiry event in
60  *   the designated event queue.
61  *
62  * - The timer expiry event will be received through *rte_event_dequeue_burst*.
63  *
64  * - The application frees the timer adapter instance.
65  *
66  * Multiple timer adapters can be created with a varying level of resolution
67  * for various expiry use cases that run in parallel.
68  *
69  * Before using the timer adapter, the application has to create and configure
70  * an event device along with the event port. Based on the event device
71  * capability it might require creating an additional event port to be used
72  * by the timer adapter.
73  *
74  * The application creates the event timer adapter using the
75  * ``rte_event_timer_adapter_create()``. The event device id is passed to this
76  * function, inside this function the event device capability is checked,
77  * and if an in-built port is absent the application uses the default
78  * function to create a new producer port.
79  *
80  * The application may also use the function
81  * ``rte_event_timer_adapter_create_ext()`` to have granular control over
82  * producer port creation in a case where the in-built port is absent.
83  *
84  * After creating the timer adapter, the application has to start it
85  * using ``rte_event_timer_adapter_start()``. The buckets are traversed from
86  * 0 to n; when the adapter ticks, the next bucket is visited. Each time,
87  * the list per bucket is processed, and timer expiry events are sent to the
88  * designated event queue.
89  *
90  * The application can arm one or more event timers using the
91  * ``rte_event_timer_arm_burst()``. The *timeout_ticks* represents the number
92  * of *timer_tick_ns* after which the timer has to expire. The timeout at
93  * which the timers expire can be grouped or be independent of each
94  * event timer instance. ``rte_event_timer_arm_tmo_tick_burst()`` addresses the
95  * former case and ``rte_event_timer_arm_burst()`` addresses the latter case.
96  *
97  * The application can cancel the timers from expiring using the
98  * ``rte_event_timer_cancel_burst()``.
99  *
100  * On the secondary process, ``rte_event_timer_adapter_lookup()`` can be used
101  * to get the timer adapter pointer from its id and use it to invoke fastpath
102  * operations such as arm and cancel.
103  *
104  * Some of the use cases of event timer adapter are Beacon Timers,
105  * Generic SW Timeout, Wireless MAC Scheduling, 3G Frame Protocols,
106  * Packet Scheduling, Protocol Retransmission Timers, Supervision Timers.
107  * All these use cases require high resolution and low time drift.
108  */
109
110 #ifdef __cplusplus
111 extern "C" {
112 #endif
113
114 #include <rte_spinlock.h>
115 #include <rte_memory.h>
116
117 #include "rte_eventdev.h"
118 #include "rte_eventdev_trace_fp.h"
119
120 /**
121  * Timer adapter clock source
122  */
123 enum rte_event_timer_adapter_clk_src {
124         RTE_EVENT_TIMER_ADAPTER_CPU_CLK,
125         /**< Use CPU clock as the clock source. */
126         RTE_EVENT_TIMER_ADAPTER_EXT_CLK0,
127         /**< Platform dependent external clock source 0. */
128         RTE_EVENT_TIMER_ADAPTER_EXT_CLK1,
129         /**< Platform dependent external clock source 1. */
130         RTE_EVENT_TIMER_ADAPTER_EXT_CLK2,
131         /**< Platform dependent external clock source 2. */
132         RTE_EVENT_TIMER_ADAPTER_EXT_CLK3,
133         /**< Platform dependent external clock source 3. */
134 };
135
136 #define RTE_EVENT_TIMER_ADAPTER_F_ADJUST_RES    (1ULL << 0)
137 /**< The event timer adapter implementation may have constraints on the
138  * resolution (timer_tick_ns) and maximum timer expiry timeout(max_tmo_ns)
139  * based on the given timer adapter or system. If this flag is set, the
140  * implementation adjusts the resolution and maximum timeout to the best
141  * possible configuration. On successful timer adapter creation, the
142  * application can get the configured resolution and max timeout with
143  * ``rte_event_timer_adapter_get_info()``.
144  *
145  * @see struct rte_event_timer_adapter_info::min_resolution_ns
146  * @see struct rte_event_timer_adapter_info::max_tmo_ns
147  */
148 #define RTE_EVENT_TIMER_ADAPTER_F_SP_PUT        (1ULL << 1)
149 /**< ``rte_event_timer_arm_burst()`` API to be used in single producer mode.
150  *
151  * @see struct rte_event_timer_adapter_conf::flags
152  */
153
154 /**
155  * Timer adapter configuration structure
156  */
157 struct rte_event_timer_adapter_conf {
158         uint8_t event_dev_id;
159         /**< Event device identifier */
160         uint16_t timer_adapter_id;
161         /**< Event timer adapter identifier */
162         uint32_t socket_id;
163         /**< Identifier of socket from which to allocate memory for adapter */
164         enum rte_event_timer_adapter_clk_src clk_src;
165         /**< Clock source for timer adapter */
166         uint64_t timer_tick_ns;
167         /**< Timer adapter resolution in ns */
168         uint64_t max_tmo_ns;
169         /**< Maximum timer timeout(expiry) in ns */
170         uint64_t nb_timers;
171         /**< Total number of timers per adapter */
172         uint64_t flags;
173         /**< Timer adapter config flags (RTE_EVENT_TIMER_ADAPTER_F_*) */
174 };
175
176 /**
177  * Event timer adapter stats structure
178  */
179 struct rte_event_timer_adapter_stats {
180         uint64_t evtim_exp_count;
181         /**< Number of event timers that have expired. */
182         uint64_t ev_enq_count;
183         /**< Eventdev enqueue count */
184         uint64_t ev_inv_count;
185         /**< Invalid expiry event count */
186         uint64_t evtim_retry_count;
187         /**< Event timer retry count */
188         uint64_t adapter_tick_count;
189         /**< Tick count for the adapter, at its resolution */
190 };
191
192 struct rte_event_timer_adapter;
193
194 /**
195  * Callback function type for producer port creation.
196  */
197 typedef int (*rte_event_timer_adapter_port_conf_cb_t)(uint16_t id,
198                                                       uint8_t event_dev_id,
199                                                       uint8_t *event_port_id,
200                                                       void *conf_arg);
201
202 /**
203  * Create an event timer adapter.
204  *
205  * This function must be invoked first before any other function in the API.
206  *
207  * @param conf
208  *   The event timer adapter configuration structure.
209  *
210  * @return
211  *   A pointer to the new allocated event timer adapter on success.
212  *   NULL on error with rte_errno set appropriately.
213  *   Possible rte_errno values include:
214  *   - ERANGE: timer_tick_ns is not in supported range.
215  *   - ENOMEM: unable to allocate sufficient memory for adapter instances
216  *   - EINVAL: invalid event device identifier specified in config
217  *   - ENOSPC: maximum number of adapters already created
218  *   - EIO: event device reconfiguration and restart error.  The adapter
219  *   reconfigures the event device with an additional port by default if it is
220  *   required to use a service to manage timers. If the device had been started
221  *   before this call, this error code indicates an error in restart following
222  *   an error in reconfiguration, i.e., a combination of the two error codes.
223  */
224 struct rte_event_timer_adapter *
225 rte_event_timer_adapter_create(const struct rte_event_timer_adapter_conf *conf);
226
227 /**
228  * Create a timer adapter with the supplied callback.
229  *
230  * This function can be used to have a more granular control over the timer
231  * adapter creation.  If a built-in port is absent, then the function uses the
232  * callback provided to create and get the port id to be used as a producer
233  * port.
234  *
235  * @param conf
236  *   The timer adapter configuration structure
237  * @param conf_cb
238  *   The port config callback function.
239  * @param conf_arg
240  *   Opaque pointer to the argument for the callback function
241  *
242  * @return
243  *   A pointer to the new allocated event timer adapter on success.
244  *   NULL on error with rte_errno set appropriately.
245  *   Possible rte_errno values include:
246  *   - ERANGE: timer_tick_ns is not in supported range.
247  *   - ENOMEM: unable to allocate sufficient memory for adapter instances
248  *   - EINVAL: invalid event device identifier specified in config
249  *   - ENOSPC: maximum number of adapters already created
250  */
251 struct rte_event_timer_adapter *
252 rte_event_timer_adapter_create_ext(
253                 const struct rte_event_timer_adapter_conf *conf,
254                 rte_event_timer_adapter_port_conf_cb_t conf_cb,
255                 void *conf_arg);
256
257 /**
258  * Timer adapter info structure.
259  */
260 struct rte_event_timer_adapter_info {
261         uint64_t min_resolution_ns;
262         /**< Minimum timer adapter resolution in ns */
263         uint64_t max_tmo_ns;
264         /**< Maximum timer timeout(expire) in ns */
265         struct rte_event_timer_adapter_conf conf;
266         /**< Configured timer adapter attributes */
267         uint32_t caps;
268         /**< Event timer adapter capabilities */
269         int16_t event_dev_port_id;
270         /**< Event device port ID, if applicable */
271 };
272
273 /**
274  * Retrieve the contextual information of an event timer adapter.
275  *
276  * @param adapter
277  *   A pointer to the event timer adapter structure.
278  *
279  * @param[out] adapter_info
280  *   A pointer to a structure of type *rte_event_timer_adapter_info* to be
281  *   filled with the contextual information of the adapter.
282  *
283  * @return
284  *   - 0: Success, driver updates the contextual information of the
285  *   timer adapter
286  *   - <0: Error code returned by the driver info get function.
287  *   - -EINVAL: adapter identifier invalid
288  *
289  * @see RTE_EVENT_TIMER_ADAPTER_F_ADJUST_RES,
290  *   struct rte_event_timer_adapter_info
291  *
292  */
293 int
294 rte_event_timer_adapter_get_info(
295                 const struct rte_event_timer_adapter *adapter,
296                 struct rte_event_timer_adapter_info *adapter_info);
297
298 /**
299  * Start a timer adapter.
300  *
301  * The adapter start step is the last one and consists of setting the timer
302  * adapter to start accepting the timers and schedules to event queues.
303  *
304  * On success, all basic functions exported by the API (timer arm,
305  * timer cancel and so on) can be invoked.
306  *
307  * @param adapter
308  *   A pointer to the event timer adapter structure.
309  *
310  * @return
311  *   - 0: Success, adapter started.
312  *   - <0: Error code returned by the driver start function.
313  *   - -EINVAL if adapter identifier invalid
314  *   - -ENOENT if software adapter but no service core mapped
315  *   - -ENOTSUP if software adapter and more than one service core mapped
316  *   - -EALREADY if adapter has already been started
317  *
318  * @note
319  *  The eventdev to which the event_timer_adapter is connected needs to
320  *  be started before calling rte_event_timer_adapter_start().
321  */
322 int
323 rte_event_timer_adapter_start(
324                 const struct rte_event_timer_adapter *adapter);
325
326 /**
327  * Stop an event timer adapter.
328  *
329  * The adapter can be restarted with a call to
330  * ``rte_event_timer_adapter_start()``.
331  *
332  * @param adapter
333  *   A pointer to the event timer adapter structure.
334  *
335  * @return
336  *   - 0: Success, adapter stopped.
337  *   - <0: Error code returned by the driver stop function.
338  *   - -EINVAL if adapter identifier invalid
339  */
340 int
341 rte_event_timer_adapter_stop(const struct rte_event_timer_adapter *adapter);
342
343 /**
344  * Lookup an event timer adapter using its identifier.
345  *
346  * If an event timer adapter was created in another process with the same
347  * identifier, this function will locate its state and set up access to it
348  * so that it can be used in this process.
349  *
350  * @param adapter_id
351  *  The event timer adapter identifier.
352  *
353  * @return
354  *  A pointer to the event timer adapter matching the identifier on success.
355  *  NULL on error with rte_errno set appropriately.
356  *  Possible rte_errno values include:
357  *   - ENOENT - requested entry not available to return.
358  */
359 struct rte_event_timer_adapter *
360 rte_event_timer_adapter_lookup(uint16_t adapter_id);
361
362 /**
363  * Free an event timer adapter.
364  *
365  * Destroy an event timer adapter, freeing all resources.
366  *
367  * Before invoking this function, the application must wait for all the
368  * armed timers to expire or cancel the outstanding armed timers.
369  *
370  * @param adapter
371  *   A pointer to an event timer adapter structure.
372  *
373  * @return
374  *   - 0: Successfully freed the event timer adapter resources.
375  *   - <0: Failed to free the event timer adapter resources.
376  *   - -EAGAIN:  adapter is busy; timers outstanding
377  *   - -EBUSY: stop hasn't been called for this adapter yet
378  *   - -EINVAL: adapter id invalid, or adapter invalid
379  */
380 int
381 rte_event_timer_adapter_free(struct rte_event_timer_adapter *adapter);
382
383 /**
384  * Retrieve the service ID of the event timer adapter. If the adapter doesn't
385  * use an rte_service function, this function returns -ESRCH.
386  *
387  * @param adapter
388  *   A pointer to an event timer adapter.
389  *
390  * @param [out] service_id
391  *   A pointer to a uint32_t, to be filled in with the service id.
392  *
393  * @return
394  *   - 0: Success
395  *   - <0: Error code on failure
396  *   - -ESRCH: the adapter does not require a service to operate
397  */
398 int
399 rte_event_timer_adapter_service_id_get(struct rte_event_timer_adapter *adapter,
400                                        uint32_t *service_id);
401
402 /**
403  * Retrieve statistics for an event timer adapter instance.
404  *
405  * @param adapter
406  *   A pointer to an event timer adapter structure.
407  * @param[out] stats
408  *   A pointer to a structure to fill with statistics.
409  *
410  * @return
411  *   - 0: Successfully retrieved.
412  *   - <0: Failure; error code returned.
413  */
414 int
415 rte_event_timer_adapter_stats_get(struct rte_event_timer_adapter *adapter,
416                 struct rte_event_timer_adapter_stats *stats);
417
418 /**
419  * Reset statistics for an event timer adapter instance.
420  *
421  * @param adapter
422  *   A pointer to an event timer adapter structure.
423  *
424  * @return
425  *   - 0: Successfully reset;
426  *   - <0: Failure; error code returned.
427  */
428 int
429 rte_event_timer_adapter_stats_reset(struct rte_event_timer_adapter *adapter);
430
431 /**
432  * Event timer state.
433  */
434 enum rte_event_timer_state {
435         RTE_EVENT_TIMER_NOT_ARMED       = 0,
436         /**< Event timer not armed. */
437         RTE_EVENT_TIMER_ARMED           = 1,
438         /**< Event timer successfully armed. */
439         RTE_EVENT_TIMER_CANCELED        = 2,
440         /**< Event timer successfully canceled. */
441         RTE_EVENT_TIMER_ERROR           = -1,
442         /**< Generic event timer error. */
443         RTE_EVENT_TIMER_ERROR_TOOEARLY  = -2,
444         /**< Event timer timeout tick value is too small for the adapter to
445          * handle, given its configured resolution.
446          */
447         RTE_EVENT_TIMER_ERROR_TOOLATE   = -3,
448         /**< Event timer timeout tick is greater than the maximum timeout.*/
449 };
450
451 /**
452  * The generic *rte_event_timer* structure to hold the event timer attributes
453  * for arm and cancel operations.
454  */
455 RTE_STD_C11
456 struct rte_event_timer {
457         struct rte_event ev;
458         /**<
459          * Expiry event attributes.  On successful event timer timeout,
460          * the following attributes will be used to inject the expiry event to
461          * the eventdev:
462          *  - event_queue_id: Targeted event queue id for expiry events.
463          *  - event_priority: Event priority of the event expiry event in the
464          *  event queue relative to other events.
465          *  - sched_type: Scheduling type of the expiry event.
466          *  - flow_id: Flow id of the expiry event.
467          *  - op: RTE_EVENT_OP_NEW
468          *  - event_type: RTE_EVENT_TYPE_TIMER
469          */
470         volatile enum rte_event_timer_state state;
471         /**< State of the event timer. */
472         uint64_t timeout_ticks;
473         /**< Expiry timer ticks expressed in number of *timer_ticks_ns* from
474          * now.
475          * @see struct rte_event_timer_adapter_info::adapter_conf::timer_tick_ns
476          */
477         uint64_t impl_opaque[2];
478         /**< Implementation-specific opaque data.
479          * An event timer adapter implementation use this field to hold
480          * implementation specific values to share between the arm and cancel
481          * operations.  The application should not modify this field.
482          */
483         uint8_t user_meta[0];
484         /**< Memory to store user specific metadata.
485          * The event timer adapter implementation should not modify this area.
486          */
487 } __rte_cache_aligned;
488
489 typedef uint16_t (*rte_event_timer_arm_burst_t)(
490                 const struct rte_event_timer_adapter *adapter,
491                 struct rte_event_timer **tims,
492                 uint16_t nb_tims);
493 /**< @internal Enable event timers to enqueue timer events upon expiry */
494 typedef uint16_t (*rte_event_timer_arm_tmo_tick_burst_t)(
495                 const struct rte_event_timer_adapter *adapter,
496                 struct rte_event_timer **tims,
497                 uint64_t timeout_tick,
498                 uint16_t nb_tims);
499 /**< @internal Enable event timers with common expiration time */
500 typedef uint16_t (*rte_event_timer_cancel_burst_t)(
501                 const struct rte_event_timer_adapter *adapter,
502                 struct rte_event_timer **tims,
503                 uint16_t nb_tims);
504 /**< @internal Prevent event timers from enqueuing timer events */
505
506 /**
507  * @internal Data structure associated with each event timer adapter.
508  */
509 struct rte_event_timer_adapter {
510         rte_event_timer_arm_burst_t arm_burst;
511         /**< Pointer to driver arm_burst function. */
512         rte_event_timer_arm_tmo_tick_burst_t arm_tmo_tick_burst;
513         /**< Pointer to driver arm_tmo_tick_burst function. */
514         rte_event_timer_cancel_burst_t cancel_burst;
515         /**< Pointer to driver cancel function. */
516         struct rte_event_timer_adapter_data *data;
517         /**< Pointer to shared adapter data */
518         const struct rte_event_timer_adapter_ops *ops;
519         /**< Functions exported by adapter driver */
520
521         RTE_STD_C11
522         uint8_t allocated : 1;
523         /**< Flag to indicate that this adapter has been allocated */
524 } __rte_cache_aligned;
525
526 #define ADAPTER_VALID_OR_ERR_RET(adapter, retval) do {          \
527         if (adapter == NULL || !adapter->allocated)             \
528                 return retval;                                  \
529 } while (0)
530
531 #define FUNC_PTR_OR_ERR_RET(func, errval) do {                  \
532         if ((func) == NULL)                                     \
533                 return errval;                                  \
534 } while (0)
535
536 #define FUNC_PTR_OR_NULL_RET_WITH_ERRNO(func, errval) do {      \
537         if ((func) == NULL) {                                   \
538                 rte_errno = errval;                             \
539                 return NULL;                                    \
540         }                                                       \
541 } while (0)
542
543 /**
544  * Arm a burst of event timers with separate expiration timeout tick for each
545  * event timer.
546  *
547  * Before calling this function, the application allocates
548  * ``struct rte_event_timer`` objects from mempool or huge page backed
549  * application buffers of desired size. On successful allocation,
550  * application updates the `struct rte_event_timer`` attributes such as
551  * expiry event attributes, timeout ticks from now.
552  * This function submits the event timer arm requests to the event timer adapter
553  * and on expiry, the events will be injected to designated event queue.
554  *
555  * @param adapter
556  *   A pointer to an event timer adapter structure.
557  * @param evtims
558  *   Pointer to an array of objects of type *rte_event_timer* structure.
559  * @param nb_evtims
560  *   Number of event timers in the supplied array.
561  *
562  * @return
563  *   The number of successfully armed event timers. The return value can be less
564  *   than the value of the *nb_evtims* parameter. If the return value is less
565  *   than *nb_evtims*, the remaining event timers at the end of *evtims*
566  *   are not consumed, and the caller has to take care of them, and rte_errno
567  *   is set accordingly. Possible errno values include:
568  *   - EINVAL Invalid timer adapter, expiry event queue ID is invalid, or an
569  *   expiry event's sched type doesn't match the capabilities of the
570  *   destination event queue.
571  *   - EAGAIN Specified timer adapter is not running
572  *   - EALREADY A timer was encountered that was already armed
573  */
574 static inline uint16_t
575 rte_event_timer_arm_burst(const struct rte_event_timer_adapter *adapter,
576                           struct rte_event_timer **evtims,
577                           uint16_t nb_evtims)
578 {
579 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
580         ADAPTER_VALID_OR_ERR_RET(adapter, -EINVAL);
581         FUNC_PTR_OR_ERR_RET(adapter->arm_burst, -EINVAL);
582 #endif
583         rte_eventdev_trace_timer_arm_burst(adapter, (void **)evtims,
584                 nb_evtims);
585         return adapter->arm_burst(adapter, evtims, nb_evtims);
586 }
587
588 /**
589  * Arm a burst of event timers with same expiration timeout tick.
590  *
591  * Provides the same functionality as ``rte_event_timer_arm_burst()``, except
592  * that application can use this API when all the event timers have the
593  * same timeout expiration tick. This specialized function can provide the
594  * additional hint to the adapter implementation and optimize if possible.
595  *
596  * @param adapter
597  *   A pointer to an event timer adapter structure.
598  * @param evtims
599  *   Points to an array of objects of type *rte_event_timer* structure.
600  * @param timeout_ticks
601  *   The number of ticks in which the timers should expire.
602  * @param nb_evtims
603  *   Number of event timers in the supplied array.
604  *
605  * @return
606  *   The number of successfully armed event timers. The return value can be less
607  *   than the value of the *nb_evtims* parameter. If the return value is less
608  *   than *nb_evtims*, the remaining event timers at the end of *evtims*
609  *   are not consumed, and the caller has to take care of them, and rte_errno
610  *   is set accordingly. Possible errno values include:
611  *   - EINVAL Invalid timer adapter, expiry event queue ID is invalid, or an
612  *   expiry event's sched type doesn't match the capabilities of the
613  *   destination event queue.
614  *   - EAGAIN Specified event timer adapter is not running
615  *   - EALREADY A timer was encountered that was already armed
616  */
617 static inline uint16_t
618 rte_event_timer_arm_tmo_tick_burst(
619                         const struct rte_event_timer_adapter *adapter,
620                         struct rte_event_timer **evtims,
621                         const uint64_t timeout_ticks,
622                         const uint16_t nb_evtims)
623 {
624 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
625         ADAPTER_VALID_OR_ERR_RET(adapter, -EINVAL);
626         FUNC_PTR_OR_ERR_RET(adapter->arm_tmo_tick_burst, -EINVAL);
627 #endif
628         rte_eventdev_trace_timer_arm_tmo_tick_burst(adapter, timeout_ticks,
629                 (void **)evtims, nb_evtims);
630         return adapter->arm_tmo_tick_burst(adapter, evtims, timeout_ticks,
631                                            nb_evtims);
632 }
633
634 /**
635  * Cancel a burst of event timers from being scheduled to the event device.
636  *
637  * @param adapter
638  *   A pointer to an event timer adapter structure.
639  * @param evtims
640  *   Points to an array of objects of type *rte_event_timer* structure
641  * @param nb_evtims
642  *   Number of event timer instances in the supplied array.
643  *
644  * @return
645  *   The number of successfully canceled event timers. The return value can be
646  *   less than the value of the *nb_evtims* parameter. If the return value is
647  *   less than *nb_evtims*, the remaining event timers at the end of *evtims*
648  *   are not consumed, and the caller has to take care of them, and rte_errno
649  *   is set accordingly. Possible errno values include:
650  *   - EINVAL Invalid timer adapter identifier
651  *   - EAGAIN Specified timer adapter is not running
652  *   - EALREADY  A timer was encountered that was already canceled
653  */
654 static inline uint16_t
655 rte_event_timer_cancel_burst(const struct rte_event_timer_adapter *adapter,
656                              struct rte_event_timer **evtims,
657                              uint16_t nb_evtims)
658 {
659 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
660         ADAPTER_VALID_OR_ERR_RET(adapter, -EINVAL);
661         FUNC_PTR_OR_ERR_RET(adapter->cancel_burst, -EINVAL);
662 #endif
663         rte_eventdev_trace_timer_cancel_burst(adapter, (void **)evtims,
664                 nb_evtims);
665         return adapter->cancel_burst(adapter, evtims, nb_evtims);
666 }
667
668 #endif /* __RTE_EVENT_TIMER_ADAPTER_H__ */