log: update default log levels
[dpdk.git] / lib / librte_eventdev / rte_eventdev.h
1 /*
2  *   BSD LICENSE
3  *
4  *   Copyright 2016 Cavium, Inc.
5  *   Copyright 2016 Intel Corporation.
6  *   Copyright 2016 NXP.
7  *
8  *   Redistribution and use in source and binary forms, with or without
9  *   modification, are permitted provided that the following conditions
10  *   are met:
11  *
12  *     * Redistributions of source code must retain the above copyright
13  *       notice, this list of conditions and the following disclaimer.
14  *     * Redistributions in binary form must reproduce the above copyright
15  *       notice, this list of conditions and the following disclaimer in
16  *       the documentation and/or other materials provided with the
17  *       distribution.
18  *     * Neither the name of Cavium, Inc nor the names of its
19  *       contributors may be used to endorse or promote products derived
20  *       from this software without specific prior written permission.
21  *
22  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34
35 #ifndef _RTE_EVENTDEV_H_
36 #define _RTE_EVENTDEV_H_
37
38 /**
39  * @file
40  *
41  * RTE Event Device API
42  *
43  * In a polling model, lcores poll ethdev ports and associated rx queues
44  * directly to look for packet. In an event driven model, by contrast, lcores
45  * call the scheduler that selects packets for them based on programmer
46  * specified criteria. Eventdev library adds support for event driven
47  * programming model, which offer applications automatic multicore scaling,
48  * dynamic load balancing, pipelining, packet ingress order maintenance and
49  * synchronization services to simplify application packet processing.
50  *
51  * The Event Device API is composed of two parts:
52  *
53  * - The application-oriented Event API that includes functions to setup
54  *   an event device (configure it, setup its queues, ports and start it), to
55  *   establish the link between queues to port and to receive events, and so on.
56  *
57  * - The driver-oriented Event API that exports a function allowing
58  *   an event poll Mode Driver (PMD) to simultaneously register itself as
59  *   an event device driver.
60  *
61  * Event device components:
62  *
63  *                     +-----------------+
64  *                     | +-------------+ |
65  *        +-------+    | |    flow 0   | |
66  *        |Packet |    | +-------------+ |
67  *        |event  |    | +-------------+ |
68  *        |       |    | |    flow 1   | |port_link(port0, queue0)
69  *        +-------+    | +-------------+ |     |     +--------+
70  *        +-------+    | +-------------+ o-----v-----o        |dequeue +------+
71  *        |Crypto |    | |    flow n   | |           | event  +------->|Core 0|
72  *        |work   |    | +-------------+ o----+      | port 0 |        |      |
73  *        |done ev|    |  event queue 0  |    |      +--------+        +------+
74  *        +-------+    +-----------------+    |
75  *        +-------+                           |
76  *        |Timer  |    +-----------------+    |      +--------+
77  *        |expiry |    | +-------------+ |    +------o        |dequeue +------+
78  *        |event  |    | |    flow 0   | o-----------o event  +------->|Core 1|
79  *        +-------+    | +-------------+ |      +----o port 1 |        |      |
80  *       Event enqueue | +-------------+ |      |    +--------+        +------+
81  *     o-------------> | |    flow 1   | |      |
82  *        enqueue(     | +-------------+ |      |
83  *        queue_id,    |                 |      |    +--------+        +------+
84  *        flow_id,     | +-------------+ |      |    |        |dequeue |Core 2|
85  *        sched_type,  | |    flow n   | o-----------o event  +------->|      |
86  *        event_type,  | +-------------+ |      |    | port 2 |        +------+
87  *        subev_type,  |  event queue 1  |      |    +--------+
88  *        event)       +-----------------+      |    +--------+
89  *                                              |    |        |dequeue +------+
90  *        +-------+    +-----------------+      |    | event  +------->|Core n|
91  *        |Core   |    | +-------------+ o-----------o port n |        |      |
92  *        |(SW)   |    | |    flow 0   | |      |    +--------+        +--+---+
93  *        |event  |    | +-------------+ |      |                         |
94  *        +-------+    | +-------------+ |      |                         |
95  *            ^        | |    flow 1   | |      |                         |
96  *            |        | +-------------+ o------+                         |
97  *            |        | +-------------+ |                                |
98  *            |        | |    flow n   | |                                |
99  *            |        | +-------------+ |                                |
100  *            |        |  event queue n  |                                |
101  *            |        +-----------------+                                |
102  *            |                                                           |
103  *            +-----------------------------------------------------------+
104  *
105  * Event device: A hardware or software-based event scheduler.
106  *
107  * Event: A unit of scheduling that encapsulates a packet or other datatype
108  * like SW generated event from the CPU, Crypto work completion notification,
109  * Timer expiry event notification etc as well as metadata.
110  * The metadata includes flow ID, scheduling type, event priority, event_type,
111  * sub_event_type etc.
112  *
113  * Event queue: A queue containing events that are scheduled by the event dev.
114  * An event queue contains events of different flows associated with scheduling
115  * types, such as atomic, ordered, or parallel.
116  *
117  * Event port: An application's interface into the event dev for enqueue and
118  * dequeue operations. Each event port can be linked with one or more
119  * event queues for dequeue operations.
120  *
121  * By default, all the functions of the Event Device API exported by a PMD
122  * are lock-free functions which assume to not be invoked in parallel on
123  * different logical cores to work on the same target object. For instance,
124  * the dequeue function of a PMD cannot be invoked in parallel on two logical
125  * cores to operates on same  event port. Of course, this function
126  * can be invoked in parallel by different logical cores on different ports.
127  * It is the responsibility of the upper level application to enforce this rule.
128  *
129  * In all functions of the Event API, the Event device is
130  * designated by an integer >= 0 named the device identifier *dev_id*
131  *
132  * At the Event driver level, Event devices are represented by a generic
133  * data structure of type *rte_event_dev*.
134  *
135  * Event devices are dynamically registered during the PCI/SoC device probing
136  * phase performed at EAL initialization time.
137  * When an Event device is being probed, a *rte_event_dev* structure and
138  * a new device identifier are allocated for that device. Then, the
139  * event_dev_init() function supplied by the Event driver matching the probed
140  * device is invoked to properly initialize the device.
141  *
142  * The role of the device init function consists of resetting the hardware or
143  * software event driver implementations.
144  *
145  * If the device init operation is successful, the correspondence between
146  * the device identifier assigned to the new device and its associated
147  * *rte_event_dev* structure is effectively registered.
148  * Otherwise, both the *rte_event_dev* structure and the device identifier are
149  * freed.
150  *
151  * The functions exported by the application Event API to setup a device
152  * designated by its device identifier must be invoked in the following order:
153  *     - rte_event_dev_configure()
154  *     - rte_event_queue_setup()
155  *     - rte_event_port_setup()
156  *     - rte_event_port_link()
157  *     - rte_event_dev_start()
158  *
159  * Then, the application can invoke, in any order, the functions
160  * exported by the Event API to schedule events, dequeue events, enqueue events,
161  * change event queue(s) to event port [un]link establishment and so on.
162  *
163  * Application may use rte_event_[queue/port]_default_conf_get() to get the
164  * default configuration to set up an event queue or event port by
165  * overriding few default values.
166  *
167  * If the application wants to change the configuration (i.e. call
168  * rte_event_dev_configure(), rte_event_queue_setup(), or
169  * rte_event_port_setup()), it must call rte_event_dev_stop() first to stop the
170  * device and then do the reconfiguration before calling rte_event_dev_start()
171  * again. The schedule, enqueue and dequeue functions should not be invoked
172  * when the device is stopped.
173  *
174  * Finally, an application can close an Event device by invoking the
175  * rte_event_dev_close() function.
176  *
177  * Each function of the application Event API invokes a specific function
178  * of the PMD that controls the target device designated by its device
179  * identifier.
180  *
181  * For this purpose, all device-specific functions of an Event driver are
182  * supplied through a set of pointers contained in a generic structure of type
183  * *event_dev_ops*.
184  * The address of the *event_dev_ops* structure is stored in the *rte_event_dev*
185  * structure by the device init function of the Event driver, which is
186  * invoked during the PCI/SoC device probing phase, as explained earlier.
187  *
188  * In other words, each function of the Event API simply retrieves the
189  * *rte_event_dev* structure associated with the device identifier and
190  * performs an indirect invocation of the corresponding driver function
191  * supplied in the *event_dev_ops* structure of the *rte_event_dev* structure.
192  *
193  * For performance reasons, the address of the fast-path functions of the
194  * Event driver is not contained in the *event_dev_ops* structure.
195  * Instead, they are directly stored at the beginning of the *rte_event_dev*
196  * structure to avoid an extra indirect memory access during their invocation.
197  *
198  * RTE event device drivers do not use interrupts for enqueue or dequeue
199  * operation. Instead, Event drivers export Poll-Mode enqueue and dequeue
200  * functions to applications.
201  *
202  * The events are injected to event device through *enqueue* operation by
203  * event producers in the system. The typical event producers are ethdev
204  * subsystem for generating packet events, CPU(SW) for generating events based
205  * on different stages of application processing, cryptodev for generating
206  * crypto work completion notification etc
207  *
208  * The *dequeue* operation gets one or more events from the event ports.
209  * The application process the events and send to downstream event queue through
210  * rte_event_enqueue_burst() if it is an intermediate stage of event processing,
211  * on the final stage, the application may send to different subsystem like
212  * ethdev to send the packet/event on the wire using ethdev
213  * rte_eth_tx_burst() API.
214  *
215  * The point at which events are scheduled to ports depends on the device.
216  * For hardware devices, scheduling occurs asynchronously without any software
217  * intervention. Software schedulers can either be distributed
218  * (each worker thread schedules events to its own port) or centralized
219  * (a dedicated thread schedules to all ports). Distributed software schedulers
220  * perform the scheduling in rte_event_dequeue_burst(), whereas centralized
221  * scheduler logic need a dedicated service core for scheduling.
222  * The RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED capability flag is not set
223  * indicates the device is centralized and thus needs a dedicated scheduling
224  * thread that repeatedly calls software specific scheduling function.
225  *
226  * An event driven worker thread has following typical workflow on fastpath:
227  * \code{.c}
228  *      while (1) {
229  *              rte_event_dequeue_burst(...);
230  *              (event processing)
231  *              rte_event_enqueue_burst(...);
232  *      }
233  * \endcode
234  *
235  */
236
237 #ifdef __cplusplus
238 extern "C" {
239 #endif
240
241 #include <rte_common.h>
242 #include <rte_config.h>
243 #include <rte_memory.h>
244 #include <rte_errno.h>
245
246 struct rte_mbuf; /* we just use mbuf pointers; no need to include rte_mbuf.h */
247
248 /* Event device capability bitmap flags */
249 #define RTE_EVENT_DEV_CAP_QUEUE_QOS           (1ULL << 0)
250 /**< Event scheduling prioritization is based on the priority associated with
251  *  each event queue.
252  *
253  *  @see rte_event_queue_setup()
254  */
255 #define RTE_EVENT_DEV_CAP_EVENT_QOS           (1ULL << 1)
256 /**< Event scheduling prioritization is based on the priority associated with
257  *  each event. Priority of each event is supplied in *rte_event* structure
258  *  on each enqueue operation.
259  *
260  *  @see rte_event_enqueue_burst()
261  */
262 #define RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED   (1ULL << 2)
263 /**< Event device operates in distributed scheduling mode.
264  * In distributed scheduling mode, event scheduling happens in HW or
265  * rte_event_dequeue_burst() or the combination of these two.
266  * If the flag is not set then eventdev is centralized and thus needs a
267  * dedicated service core that acts as a scheduling thread .
268  *
269  * @see rte_event_dequeue_burst()
270  */
271 #define RTE_EVENT_DEV_CAP_QUEUE_ALL_TYPES     (1ULL << 3)
272 /**< Event device is capable of enqueuing events of any type to any queue.
273  * If this capability is not set, the queue only supports events of the
274  *  *RTE_SCHED_TYPE_* type that it was created with.
275  *
276  * @see RTE_SCHED_TYPE_* values
277  */
278 #define RTE_EVENT_DEV_CAP_BURST_MODE          (1ULL << 4)
279 /**< Event device is capable of operating in burst mode for enqueue(forward,
280  * release) and dequeue operation. If this capability is not set, application
281  * still uses the rte_event_dequeue_burst() and rte_event_enqueue_burst() but
282  * PMD accepts only one event at a time.
283  *
284  * @see rte_event_dequeue_burst() rte_event_enqueue_burst()
285  */
286
287 /* Event device priority levels */
288 #define RTE_EVENT_DEV_PRIORITY_HIGHEST   0
289 /**< Highest priority expressed across eventdev subsystem
290  * @see rte_event_queue_setup(), rte_event_enqueue_burst()
291  * @see rte_event_port_link()
292  */
293 #define RTE_EVENT_DEV_PRIORITY_NORMAL    128
294 /**< Normal priority expressed across eventdev subsystem
295  * @see rte_event_queue_setup(), rte_event_enqueue_burst()
296  * @see rte_event_port_link()
297  */
298 #define RTE_EVENT_DEV_PRIORITY_LOWEST    255
299 /**< Lowest priority expressed across eventdev subsystem
300  * @see rte_event_queue_setup(), rte_event_enqueue_burst()
301  * @see rte_event_port_link()
302  */
303
304 /**
305  * Get the total number of event devices that have been successfully
306  * initialised.
307  *
308  * @return
309  *   The total number of usable event devices.
310  */
311 uint8_t
312 rte_event_dev_count(void);
313
314 /**
315  * Get the device identifier for the named event device.
316  *
317  * @param name
318  *   Event device name to select the event device identifier.
319  *
320  * @return
321  *   Returns event device identifier on success.
322  *   - <0: Failure to find named event device.
323  */
324 int
325 rte_event_dev_get_dev_id(const char *name);
326
327 /**
328  * Return the NUMA socket to which a device is connected.
329  *
330  * @param dev_id
331  *   The identifier of the device.
332  * @return
333  *   The NUMA socket id to which the device is connected or
334  *   a default of zero if the socket could not be determined.
335  *   -(-EINVAL)  dev_id value is out of range.
336  */
337 int
338 rte_event_dev_socket_id(uint8_t dev_id);
339
340 /**
341  * Event device information
342  */
343 struct rte_event_dev_info {
344         const char *driver_name;        /**< Event driver name */
345         struct rte_device *dev; /**< Device information */
346         uint32_t min_dequeue_timeout_ns;
347         /**< Minimum supported global dequeue timeout(ns) by this device */
348         uint32_t max_dequeue_timeout_ns;
349         /**< Maximum supported global dequeue timeout(ns) by this device */
350         uint32_t dequeue_timeout_ns;
351         /**< Configured global dequeue timeout(ns) for this device */
352         uint8_t max_event_queues;
353         /**< Maximum event_queues supported by this device */
354         uint32_t max_event_queue_flows;
355         /**< Maximum supported flows in an event queue by this device*/
356         uint8_t max_event_queue_priority_levels;
357         /**< Maximum number of event queue priority levels by this device.
358          * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability
359          */
360         uint8_t max_event_priority_levels;
361         /**< Maximum number of event priority levels by this device.
362          * Valid when the device has RTE_EVENT_DEV_CAP_EVENT_QOS capability
363          */
364         uint8_t max_event_ports;
365         /**< Maximum number of event ports supported by this device */
366         uint8_t max_event_port_dequeue_depth;
367         /**< Maximum number of events can be dequeued at a time from an
368          * event port by this device.
369          * A device that does not support bulk dequeue will set this as 1.
370          */
371         uint32_t max_event_port_enqueue_depth;
372         /**< Maximum number of events can be enqueued at a time from an
373          * event port by this device.
374          * A device that does not support bulk enqueue will set this as 1.
375          */
376         int32_t max_num_events;
377         /**< A *closed system* event dev has a limit on the number of events it
378          * can manage at a time. An *open system* event dev does not have a
379          * limit and will specify this as -1.
380          */
381         uint32_t event_dev_cap;
382         /**< Event device capabilities(RTE_EVENT_DEV_CAP_)*/
383 };
384
385 /**
386  * Retrieve the contextual information of an event device.
387  *
388  * @param dev_id
389  *   The identifier of the device.
390  *
391  * @param[out] dev_info
392  *   A pointer to a structure of type *rte_event_dev_info* to be filled with the
393  *   contextual information of the device.
394  *
395  * @return
396  *   - 0: Success, driver updates the contextual information of the event device
397  *   - <0: Error code returned by the driver info get function.
398  *
399  */
400 int
401 rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info);
402
403 /**
404  * The count of ports.
405  */
406 #define RTE_EVENT_DEV_ATTR_PORT_COUNT 0
407 /**
408  * The count of queues.
409  */
410 #define RTE_EVENT_DEV_ATTR_QUEUE_COUNT 1
411 /**
412  * The status of the device, zero for stopped, non-zero for started.
413  */
414 #define RTE_EVENT_DEV_ATTR_STARTED 2
415
416 /**
417  * Get an attribute from a device.
418  *
419  * @param dev_id Eventdev id
420  * @param attr_id The attribute ID to retrieve
421  * @param[out] attr_value A pointer that will be filled in with the attribute
422  *             value if successful.
423  *
424  * @retval 0 Successfully retrieved attribute value
425  *         -EINVAL Invalid device or  *attr_id* provided, or *attr_value*
426  *         is NULL
427  */
428 int
429 rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
430                        uint32_t *attr_value);
431
432
433 /* Event device configuration bitmap flags */
434 #define RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT (1ULL << 0)
435 /**< Override the global *dequeue_timeout_ns* and use per dequeue timeout in ns.
436  *  @see rte_event_dequeue_timeout_ticks(), rte_event_dequeue_burst()
437  */
438
439 /** Event device configuration structure */
440 struct rte_event_dev_config {
441         uint32_t dequeue_timeout_ns;
442         /**< rte_event_dequeue_burst() timeout on this device.
443          * This value should be in the range of *min_dequeue_timeout_ns* and
444          * *max_dequeue_timeout_ns* which previously provided in
445          * rte_event_dev_info_get()
446          * The value 0 is allowed, in which case, default dequeue timeout used.
447          * @see RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT
448          */
449         int32_t nb_events_limit;
450         /**< In a *closed system* this field is the limit on maximum number of
451          * events that can be inflight in the eventdev at a given time. The
452          * limit is required to ensure that the finite space in a closed system
453          * is not overwhelmed. The value cannot exceed the *max_num_events*
454          * as provided by rte_event_dev_info_get().
455          * This value should be set to -1 for *open system*.
456          */
457         uint8_t nb_event_queues;
458         /**< Number of event queues to configure on this device.
459          * This value cannot exceed the *max_event_queues* which previously
460          * provided in rte_event_dev_info_get()
461          */
462         uint8_t nb_event_ports;
463         /**< Number of event ports to configure on this device.
464          * This value cannot exceed the *max_event_ports* which previously
465          * provided in rte_event_dev_info_get()
466          */
467         uint32_t nb_event_queue_flows;
468         /**< Number of flows for any event queue on this device.
469          * This value cannot exceed the *max_event_queue_flows* which previously
470          * provided in rte_event_dev_info_get()
471          */
472         uint32_t nb_event_port_dequeue_depth;
473         /**< Maximum number of events can be dequeued at a time from an
474          * event port by this device.
475          * This value cannot exceed the *max_event_port_dequeue_depth*
476          * which previously provided in rte_event_dev_info_get().
477          * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
478          * @see rte_event_port_setup()
479          */
480         uint32_t nb_event_port_enqueue_depth;
481         /**< Maximum number of events can be enqueued at a time from an
482          * event port by this device.
483          * This value cannot exceed the *max_event_port_enqueue_depth*
484          * which previously provided in rte_event_dev_info_get().
485          * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
486          * @see rte_event_port_setup()
487          */
488         uint32_t event_dev_cfg;
489         /**< Event device config flags(RTE_EVENT_DEV_CFG_)*/
490 };
491
492 /**
493  * Configure an event device.
494  *
495  * This function must be invoked first before any other function in the
496  * API. This function can also be re-invoked when a device is in the
497  * stopped state.
498  *
499  * The caller may use rte_event_dev_info_get() to get the capability of each
500  * resources available for this event device.
501  *
502  * @param dev_id
503  *   The identifier of the device to configure.
504  * @param dev_conf
505  *   The event device configuration structure.
506  *
507  * @return
508  *   - 0: Success, device configured.
509  *   - <0: Error code returned by the driver configuration function.
510  */
511 int
512 rte_event_dev_configure(uint8_t dev_id,
513                         const struct rte_event_dev_config *dev_conf);
514
515
516 /* Event queue specific APIs */
517
518 /* Event queue configuration bitmap flags */
519 #define RTE_EVENT_QUEUE_CFG_ALL_TYPES          (1ULL << 0)
520 /**< Allow ATOMIC,ORDERED,PARALLEL schedule type enqueue
521  *
522  * @see RTE_SCHED_TYPE_ORDERED, RTE_SCHED_TYPE_ATOMIC, RTE_SCHED_TYPE_PARALLEL
523  * @see rte_event_enqueue_burst()
524  */
525 #define RTE_EVENT_QUEUE_CFG_SINGLE_LINK        (1ULL << 1)
526 /**< This event queue links only to a single event port.
527  *
528  *  @see rte_event_port_setup(), rte_event_port_link()
529  */
530
531 /** Event queue configuration structure */
532 struct rte_event_queue_conf {
533         uint32_t nb_atomic_flows;
534         /**< The maximum number of active flows this queue can track at any
535          * given time. If the queue is configured for atomic scheduling (by
536          * applying the RTE_EVENT_QUEUE_CFG_ALL_TYPES flag to event_queue_cfg
537          * or RTE_SCHED_TYPE_ATOMIC flag to schedule_type), then the
538          * value must be in the range of [1, nb_event_queue_flows], which was
539          * previously provided in rte_event_dev_configure().
540          */
541         uint32_t nb_atomic_order_sequences;
542         /**< The maximum number of outstanding events waiting to be
543          * reordered by this queue. In other words, the number of entries in
544          * this queue’s reorder buffer.When the number of events in the
545          * reorder buffer reaches to *nb_atomic_order_sequences* then the
546          * scheduler cannot schedule the events from this queue and invalid
547          * event will be returned from dequeue until one or more entries are
548          * freed up/released.
549          * If the queue is configured for ordered scheduling (by applying the
550          * RTE_EVENT_QUEUE_CFG_ALL_TYPES flag to event_queue_cfg or
551          * RTE_SCHED_TYPE_ORDERED flag to schedule_type), then the value must
552          * be in the range of [1, nb_event_queue_flows], which was
553          * previously supplied to rte_event_dev_configure().
554          */
555         uint32_t event_queue_cfg;
556         /**< Queue cfg flags(EVENT_QUEUE_CFG_) */
557         uint8_t schedule_type;
558         /**< Queue schedule type(RTE_SCHED_TYPE_*).
559          * Valid when RTE_EVENT_QUEUE_CFG_ALL_TYPES bit is not set in
560          * event_queue_cfg.
561          */
562         uint8_t priority;
563         /**< Priority for this event queue relative to other event queues.
564          * The requested priority should in the range of
565          * [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST].
566          * The implementation shall normalize the requested priority to
567          * event device supported priority value.
568          * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability
569          */
570 };
571
572 /**
573  * Retrieve the default configuration information of an event queue designated
574  * by its *queue_id* from the event driver for an event device.
575  *
576  * This function intended to be used in conjunction with rte_event_queue_setup()
577  * where caller needs to set up the queue by overriding few default values.
578  *
579  * @param dev_id
580  *   The identifier of the device.
581  * @param queue_id
582  *   The index of the event queue to get the configuration information.
583  *   The value must be in the range [0, nb_event_queues - 1]
584  *   previously supplied to rte_event_dev_configure().
585  * @param[out] queue_conf
586  *   The pointer to the default event queue configuration data.
587  * @return
588  *   - 0: Success, driver updates the default event queue configuration data.
589  *   - <0: Error code returned by the driver info get function.
590  *
591  * @see rte_event_queue_setup()
592  *
593  */
594 int
595 rte_event_queue_default_conf_get(uint8_t dev_id, uint8_t queue_id,
596                                  struct rte_event_queue_conf *queue_conf);
597
598 /**
599  * Allocate and set up an event queue for an event device.
600  *
601  * @param dev_id
602  *   The identifier of the device.
603  * @param queue_id
604  *   The index of the event queue to setup. The value must be in the range
605  *   [0, nb_event_queues - 1] previously supplied to rte_event_dev_configure().
606  * @param queue_conf
607  *   The pointer to the configuration data to be used for the event queue.
608  *   NULL value is allowed, in which case default configuration used.
609  *
610  * @see rte_event_queue_default_conf_get()
611  *
612  * @return
613  *   - 0: Success, event queue correctly set up.
614  *   - <0: event queue configuration failed
615  */
616 int
617 rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
618                       const struct rte_event_queue_conf *queue_conf);
619
620 /**
621  * The priority of the queue.
622  */
623 #define RTE_EVENT_QUEUE_ATTR_PRIORITY 0
624 /**
625  * The number of atomic flows configured for the queue.
626  */
627 #define RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_FLOWS 1
628 /**
629  * The number of atomic order sequences configured for the queue.
630  */
631 #define RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_ORDER_SEQUENCES 2
632 /**
633  * The cfg flags for the queue.
634  */
635 #define RTE_EVENT_QUEUE_ATTR_EVENT_QUEUE_CFG 3
636 /**
637  * The schedule type of the queue.
638  */
639 #define RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE 4
640
641 /**
642  * Get an attribute from a queue.
643  *
644  * @param dev_id Eventdev id
645  * @param queue_id Eventdev queue id
646  * @param attr_id The attribute ID to retrieve
647  * @param[out] attr_value A pointer that will be filled in with the attribute
648  *             value if successful
649  *
650  * @retval 0 Successfully returned value
651  *         -EINVAL invalid device, queue or attr_id provided, or attr_value
652  *         was NULL
653  *         -EOVERFLOW returned when attr_id is set to
654  *         RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE and event_queue_cfg is set to
655  *         RTE_EVENT_QUEUE_CFG_ALL_TYPES
656  */
657 int
658 rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
659                         uint32_t *attr_value);
660
661 /* Event port specific APIs */
662
663 /** Event port configuration structure */
664 struct rte_event_port_conf {
665         int32_t new_event_threshold;
666         /**< A backpressure threshold for new event enqueues on this port.
667          * Use for *closed system* event dev where event capacity is limited,
668          * and cannot exceed the capacity of the event dev.
669          * Configuring ports with different thresholds can make higher priority
670          * traffic less likely to  be backpressured.
671          * For example, a port used to inject NIC Rx packets into the event dev
672          * can have a lower threshold so as not to overwhelm the device,
673          * while ports used for worker pools can have a higher threshold.
674          * This value cannot exceed the *nb_events_limit*
675          * which was previously supplied to rte_event_dev_configure().
676          * This should be set to '-1' for *open system*.
677          */
678         uint16_t dequeue_depth;
679         /**< Configure number of bulk dequeues for this event port.
680          * This value cannot exceed the *nb_event_port_dequeue_depth*
681          * which previously supplied to rte_event_dev_configure().
682          * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
683          */
684         uint16_t enqueue_depth;
685         /**< Configure number of bulk enqueues for this event port.
686          * This value cannot exceed the *nb_event_port_enqueue_depth*
687          * which previously supplied to rte_event_dev_configure().
688          * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
689          */
690 };
691
692 /**
693  * Retrieve the default configuration information of an event port designated
694  * by its *port_id* from the event driver for an event device.
695  *
696  * This function intended to be used in conjunction with rte_event_port_setup()
697  * where caller needs to set up the port by overriding few default values.
698  *
699  * @param dev_id
700  *   The identifier of the device.
701  * @param port_id
702  *   The index of the event port to get the configuration information.
703  *   The value must be in the range [0, nb_event_ports - 1]
704  *   previously supplied to rte_event_dev_configure().
705  * @param[out] port_conf
706  *   The pointer to the default event port configuration data
707  * @return
708  *   - 0: Success, driver updates the default event port configuration data.
709  *   - <0: Error code returned by the driver info get function.
710  *
711  * @see rte_event_port_setup()
712  *
713  */
714 int
715 rte_event_port_default_conf_get(uint8_t dev_id, uint8_t port_id,
716                                 struct rte_event_port_conf *port_conf);
717
718 /**
719  * Allocate and set up an event port for an event device.
720  *
721  * @param dev_id
722  *   The identifier of the device.
723  * @param port_id
724  *   The index of the event port to setup. The value must be in the range
725  *   [0, nb_event_ports - 1] previously supplied to rte_event_dev_configure().
726  * @param port_conf
727  *   The pointer to the configuration data to be used for the queue.
728  *   NULL value is allowed, in which case default configuration used.
729  *
730  * @see rte_event_port_default_conf_get()
731  *
732  * @return
733  *   - 0: Success, event port correctly set up.
734  *   - <0: Port configuration failed
735  *   - (-EDQUOT) Quota exceeded(Application tried to link the queue configured
736  *   with RTE_EVENT_QUEUE_CFG_SINGLE_LINK to more than one event ports)
737  */
738 int
739 rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
740                      const struct rte_event_port_conf *port_conf);
741
742 /**
743  * The queue depth of the port on the enqueue side
744  */
745 #define RTE_EVENT_PORT_ATTR_ENQ_DEPTH 0
746 /**
747  * The queue depth of the port on the dequeue side
748  */
749 #define RTE_EVENT_PORT_ATTR_DEQ_DEPTH 1
750 /**
751  * The new event threshold of the port
752  */
753 #define RTE_EVENT_PORT_ATTR_NEW_EVENT_THRESHOLD 2
754
755 /**
756  * Get an attribute from a port.
757  *
758  * @param dev_id Eventdev id
759  * @param port_id Eventdev port id
760  * @param attr_id The attribute ID to retrieve
761  * @param[out] attr_value A pointer that will be filled in with the attribute
762  *             value if successful
763  *
764  * @retval 0 Successfully returned value
765  *         -EINVAL Invalid device, port or attr_id, or attr_value was NULL
766  */
767 int
768 rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
769                         uint32_t *attr_value);
770
771 /**
772  * Start an event device.
773  *
774  * The device start step is the last one and consists of setting the event
775  * queues to start accepting the events and schedules to event ports.
776  *
777  * On success, all basic functions exported by the API (event enqueue,
778  * event dequeue and so on) can be invoked.
779  *
780  * @param dev_id
781  *   Event device identifier
782  * @return
783  *   - 0: Success, device started.
784  *   - -ESTALE : Not all ports of the device are configured
785  *   - -ENOLINK: Not all queues are linked, which could lead to deadlock.
786  */
787 int
788 rte_event_dev_start(uint8_t dev_id);
789
790 /**
791  * Stop an event device. The device can be restarted with a call to
792  * rte_event_dev_start()
793  *
794  * @param dev_id
795  *   Event device identifier.
796  */
797 void
798 rte_event_dev_stop(uint8_t dev_id);
799
800 /**
801  * Close an event device. The device cannot be restarted!
802  *
803  * @param dev_id
804  *   Event device identifier
805  *
806  * @return
807  *  - 0 on successfully closing device
808  *  - <0 on failure to close device
809  *  - (-EAGAIN) if device is busy
810  */
811 int
812 rte_event_dev_close(uint8_t dev_id);
813
814 /* Scheduler type definitions */
815 #define RTE_SCHED_TYPE_ORDERED          0
816 /**< Ordered scheduling
817  *
818  * Events from an ordered flow of an event queue can be scheduled to multiple
819  * ports for concurrent processing while maintaining the original event order.
820  * This scheme enables the user to achieve high single flow throughput by
821  * avoiding SW synchronization for ordering between ports which bound to cores.
822  *
823  * The source flow ordering from an event queue is maintained when events are
824  * enqueued to their destination queue within the same ordered flow context.
825  * An event port holds the context until application call
826  * rte_event_dequeue_burst() from the same port, which implicitly releases
827  * the context.
828  * User may allow the scheduler to release the context earlier than that
829  * by invoking rte_event_enqueue_burst() with RTE_EVENT_OP_RELEASE operation.
830  *
831  * Events from the source queue appear in their original order when dequeued
832  * from a destination queue.
833  * Event ordering is based on the received event(s), but also other
834  * (newly allocated or stored) events are ordered when enqueued within the same
835  * ordered context. Events not enqueued (e.g. released or stored) within the
836  * context are  considered missing from reordering and are skipped at this time
837  * (but can be ordered again within another context).
838  *
839  * @see rte_event_queue_setup(), rte_event_dequeue_burst(), RTE_EVENT_OP_RELEASE
840  */
841
842 #define RTE_SCHED_TYPE_ATOMIC           1
843 /**< Atomic scheduling
844  *
845  * Events from an atomic flow of an event queue can be scheduled only to a
846  * single port at a time. The port is guaranteed to have exclusive (atomic)
847  * access to the associated flow context, which enables the user to avoid SW
848  * synchronization. Atomic flows also help to maintain event ordering
849  * since only one port at a time can process events from a flow of an
850  * event queue.
851  *
852  * The atomic queue synchronization context is dedicated to the port until
853  * application call rte_event_dequeue_burst() from the same port,
854  * which implicitly releases the context. User may allow the scheduler to
855  * release the context earlier than that by invoking rte_event_enqueue_burst()
856  * with RTE_EVENT_OP_RELEASE operation.
857  *
858  * @see rte_event_queue_setup(), rte_event_dequeue_burst(), RTE_EVENT_OP_RELEASE
859  */
860
861 #define RTE_SCHED_TYPE_PARALLEL         2
862 /**< Parallel scheduling
863  *
864  * The scheduler performs priority scheduling, load balancing, etc. functions
865  * but does not provide additional event synchronization or ordering.
866  * It is free to schedule events from a single parallel flow of an event queue
867  * to multiple events ports for concurrent processing.
868  * The application is responsible for flow context synchronization and
869  * event ordering (SW synchronization).
870  *
871  * @see rte_event_queue_setup(), rte_event_dequeue_burst()
872  */
873
874 /* Event types to classify the event source */
875 #define RTE_EVENT_TYPE_ETHDEV           0x0
876 /**< The event generated from ethdev subsystem */
877 #define RTE_EVENT_TYPE_CRYPTODEV        0x1
878 /**< The event generated from crypodev subsystem */
879 #define RTE_EVENT_TYPE_TIMERDEV         0x2
880 /**< The event generated from timerdev subsystem */
881 #define RTE_EVENT_TYPE_CPU              0x3
882 /**< The event generated from cpu for pipelining.
883  * Application may use *sub_event_type* to further classify the event
884  */
885 #define RTE_EVENT_TYPE_ETH_RX_ADAPTER   0x4
886 /**< The event generated from event eth Rx adapter */
887 #define RTE_EVENT_TYPE_MAX              0x10
888 /**< Maximum number of event types */
889
890 /* Event enqueue operations */
891 #define RTE_EVENT_OP_NEW                0
892 /**< The event producers use this operation to inject a new event to the
893  * event device.
894  */
895 #define RTE_EVENT_OP_FORWARD            1
896 /**< The CPU use this operation to forward the event to different event queue or
897  * change to new application specific flow or schedule type to enable
898  * pipelining.
899  *
900  * This operation must only be enqueued to the same port that the
901  * event to be forwarded was dequeued from.
902  */
903 #define RTE_EVENT_OP_RELEASE            2
904 /**< Release the flow context associated with the schedule type.
905  *
906  * If current flow's scheduler type method is *RTE_SCHED_TYPE_ATOMIC*
907  * then this function hints the scheduler that the user has completed critical
908  * section processing in the current atomic context.
909  * The scheduler is now allowed to schedule events from the same flow from
910  * an event queue to another port. However, the context may be still held
911  * until the next rte_event_dequeue_burst() call, this call allows but does not
912  * force the scheduler to release the context early.
913  *
914  * Early atomic context release may increase parallelism and thus system
915  * performance, but the user needs to design carefully the split into critical
916  * vs non-critical sections.
917  *
918  * If current flow's scheduler type method is *RTE_SCHED_TYPE_ORDERED*
919  * then this function hints the scheduler that the user has done all that need
920  * to maintain event order in the current ordered context.
921  * The scheduler is allowed to release the ordered context of this port and
922  * avoid reordering any following enqueues.
923  *
924  * Early ordered context release may increase parallelism and thus system
925  * performance.
926  *
927  * If current flow's scheduler type method is *RTE_SCHED_TYPE_PARALLEL*
928  * or no scheduling context is held then this function may be an NOOP,
929  * depending on the implementation.
930  *
931  * This operation must only be enqueued to the same port that the
932  * event to be released was dequeued from.
933  *
934  */
935
936 /**
937  * The generic *rte_event* structure to hold the event attributes
938  * for dequeue and enqueue operation
939  */
940 RTE_STD_C11
941 struct rte_event {
942         /** WORD0 */
943         union {
944                 uint64_t event;
945                 /** Event attributes for dequeue or enqueue operation */
946                 struct {
947                         uint32_t flow_id:20;
948                         /**< Targeted flow identifier for the enqueue and
949                          * dequeue operation.
950                          * The value must be in the range of
951                          * [0, nb_event_queue_flows - 1] which
952                          * previously supplied to rte_event_dev_configure().
953                          */
954                         uint32_t sub_event_type:8;
955                         /**< Sub-event types based on the event source.
956                          * @see RTE_EVENT_TYPE_CPU
957                          */
958                         uint32_t event_type:4;
959                         /**< Event type to classify the event source.
960                          * @see RTE_EVENT_TYPE_ETHDEV, (RTE_EVENT_TYPE_*)
961                          */
962                         uint8_t op:2;
963                         /**< The type of event enqueue operation - new/forward/
964                          * etc.This field is not preserved across an instance
965                          * and is undefined on dequeue.
966                          * @see RTE_EVENT_OP_NEW, (RTE_EVENT_OP_*)
967                          */
968                         uint8_t rsvd:4;
969                         /**< Reserved for future use */
970                         uint8_t sched_type:2;
971                         /**< Scheduler synchronization type (RTE_SCHED_TYPE_*)
972                          * associated with flow id on a given event queue
973                          * for the enqueue and dequeue operation.
974                          */
975                         uint8_t queue_id;
976                         /**< Targeted event queue identifier for the enqueue or
977                          * dequeue operation.
978                          * The value must be in the range of
979                          * [0, nb_event_queues - 1] which previously supplied to
980                          * rte_event_dev_configure().
981                          */
982                         uint8_t priority;
983                         /**< Event priority relative to other events in the
984                          * event queue. The requested priority should in the
985                          * range of  [RTE_EVENT_DEV_PRIORITY_HIGHEST,
986                          * RTE_EVENT_DEV_PRIORITY_LOWEST].
987                          * The implementation shall normalize the requested
988                          * priority to supported priority value.
989                          * Valid when the device has
990                          * RTE_EVENT_DEV_CAP_EVENT_QOS capability.
991                          */
992                         uint8_t impl_opaque;
993                         /**< Implementation specific opaque value.
994                          * An implementation may use this field to hold
995                          * implementation specific value to share between
996                          * dequeue and enqueue operation.
997                          * The application should not modify this field.
998                          */
999                 };
1000         };
1001         /** WORD1 */
1002         union {
1003                 uint64_t u64;
1004                 /**< Opaque 64-bit value */
1005                 void *event_ptr;
1006                 /**< Opaque event pointer */
1007                 struct rte_mbuf *mbuf;
1008                 /**< mbuf pointer if dequeued event is associated with mbuf */
1009         };
1010 };
1011
1012 /* Ethdev Rx adapter capability bitmap flags */
1013 #define RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT      0x1
1014 /**< This flag is sent when the packet transfer mechanism is in HW.
1015  * Ethdev can send packets to the event device using internal event port.
1016  */
1017 #define RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ       0x2
1018 /**< Adapter supports multiple event queues per ethdev. Every ethdev
1019  * Rx queue can be connected to a unique event queue.
1020  */
1021 #define RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID   0x4
1022 /**< The application can override the adapter generated flow ID in the
1023  * event. This flow ID can be specified when adding an ethdev Rx queue
1024  * to the adapter using the ev member of struct rte_event_eth_rx_adapter
1025  * @see struct rte_event_eth_rx_adapter_queue_conf::ev
1026  * @see struct rte_event_eth_rx_adapter_queue_conf::rx_queue_flags
1027  */
1028
1029 /**
1030  * Retrieve the event device's ethdev Rx adapter capabilities for the
1031  * specified ethernet port
1032  *
1033  * @param dev_id
1034  *   The identifier of the device.
1035  *
1036  * @param eth_port_id
1037  *   The identifier of the ethernet device.
1038  *
1039  * @param[out] caps
1040  *   A pointer to memory filled with Rx event adapter capabilities.
1041  *
1042  * @return
1043  *   - 0: Success, driver provides Rx event adapter capabilities for the
1044  *      ethernet device.
1045  *   - <0: Error code returned by the driver function.
1046  *
1047  */
1048 int
1049 rte_event_eth_rx_adapter_caps_get(uint8_t dev_id, uint8_t eth_port_id,
1050                                 uint32_t *caps);
1051
1052 struct rte_eventdev_driver;
1053 struct rte_eventdev_ops;
1054 struct rte_eventdev;
1055
1056 typedef uint16_t (*event_enqueue_t)(void *port, const struct rte_event *ev);
1057 /**< @internal Enqueue event on port of a device */
1058
1059 typedef uint16_t (*event_enqueue_burst_t)(void *port,
1060                         const struct rte_event ev[], uint16_t nb_events);
1061 /**< @internal Enqueue burst of events on port of a device */
1062
1063 typedef uint16_t (*event_dequeue_t)(void *port, struct rte_event *ev,
1064                 uint64_t timeout_ticks);
1065 /**< @internal Dequeue event from port of a device */
1066
1067 typedef uint16_t (*event_dequeue_burst_t)(void *port, struct rte_event ev[],
1068                 uint16_t nb_events, uint64_t timeout_ticks);
1069 /**< @internal Dequeue burst of events from port of a device */
1070
1071 #define RTE_EVENTDEV_NAME_MAX_LEN       (64)
1072 /**< @internal Max length of name of event PMD */
1073
1074 /**
1075  * @internal
1076  * The data part, with no function pointers, associated with each device.
1077  *
1078  * This structure is safe to place in shared memory to be common among
1079  * different processes in a multi-process configuration.
1080  */
1081 struct rte_eventdev_data {
1082         int socket_id;
1083         /**< Socket ID where memory is allocated */
1084         uint8_t dev_id;
1085         /**< Device ID for this instance */
1086         uint8_t nb_queues;
1087         /**< Number of event queues. */
1088         uint8_t nb_ports;
1089         /**< Number of event ports. */
1090         void **ports;
1091         /**< Array of pointers to ports. */
1092         struct rte_event_port_conf *ports_cfg;
1093         /**< Array of port configuration structures. */
1094         struct rte_event_queue_conf *queues_cfg;
1095         /**< Array of queue configuration structures. */
1096         uint16_t *links_map;
1097         /**< Memory to store queues to port connections. */
1098         void *dev_private;
1099         /**< PMD-specific private data */
1100         uint32_t event_dev_cap;
1101         /**< Event device capabilities(RTE_EVENT_DEV_CAP_)*/
1102         struct rte_event_dev_config dev_conf;
1103         /**< Configuration applied to device. */
1104         uint8_t service_inited;
1105         /* Service initialization state */
1106         uint32_t service_id;
1107         /* Service ID*/
1108
1109         RTE_STD_C11
1110         uint8_t dev_started : 1;
1111         /**< Device state: STARTED(1)/STOPPED(0) */
1112
1113         char name[RTE_EVENTDEV_NAME_MAX_LEN];
1114         /**< Unique identifier name */
1115 } __rte_cache_aligned;
1116
1117 /** @internal The data structure associated with each event device. */
1118 struct rte_eventdev {
1119         event_enqueue_t enqueue;
1120         /**< Pointer to PMD enqueue function. */
1121         event_enqueue_burst_t enqueue_burst;
1122         /**< Pointer to PMD enqueue burst function. */
1123         event_enqueue_burst_t enqueue_new_burst;
1124         /**< Pointer to PMD enqueue burst function(op new variant) */
1125         event_enqueue_burst_t enqueue_forward_burst;
1126         /**< Pointer to PMD enqueue burst function(op forward variant) */
1127         event_dequeue_t dequeue;
1128         /**< Pointer to PMD dequeue function. */
1129         event_dequeue_burst_t dequeue_burst;
1130         /**< Pointer to PMD dequeue burst function. */
1131
1132         struct rte_eventdev_data *data;
1133         /**< Pointer to device data */
1134         const struct rte_eventdev_ops *dev_ops;
1135         /**< Functions exported by PMD */
1136         struct rte_device *dev;
1137         /**< Device info. supplied by probing */
1138
1139         RTE_STD_C11
1140         uint8_t attached : 1;
1141         /**< Flag indicating the device is attached */
1142 } __rte_cache_aligned;
1143
1144 extern struct rte_eventdev *rte_eventdevs;
1145 /** @internal The pool of rte_eventdev structures. */
1146
1147 static __rte_always_inline uint16_t
1148 __rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id,
1149                         const struct rte_event ev[], uint16_t nb_events,
1150                         const event_enqueue_burst_t fn)
1151 {
1152         const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
1153
1154 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
1155         if (dev_id >= RTE_EVENT_MAX_DEVS || !rte_eventdevs[dev_id].attached) {
1156                 rte_errno = -EINVAL;
1157                 return 0;
1158         }
1159
1160         if (port_id >= dev->data->nb_ports) {
1161                 rte_errno = -EINVAL;
1162                 return 0;
1163         }
1164 #endif
1165         /*
1166          * Allow zero cost non burst mode routine invocation if application
1167          * requests nb_events as const one
1168          */
1169         if (nb_events == 1)
1170                 return (*dev->enqueue)(dev->data->ports[port_id], ev);
1171         else
1172                 return fn(dev->data->ports[port_id], ev, nb_events);
1173 }
1174
1175 /**
1176  * Enqueue a burst of events objects or an event object supplied in *rte_event*
1177  * structure on an  event device designated by its *dev_id* through the event
1178  * port specified by *port_id*. Each event object specifies the event queue on
1179  * which it will be enqueued.
1180  *
1181  * The *nb_events* parameter is the number of event objects to enqueue which are
1182  * supplied in the *ev* array of *rte_event* structure.
1183  *
1184  * Event operations RTE_EVENT_OP_FORWARD and RTE_EVENT_OP_RELEASE must only be
1185  * enqueued to the same port that their associated events were dequeued from.
1186  *
1187  * The rte_event_enqueue_burst() function returns the number of
1188  * events objects it actually enqueued. A return value equal to *nb_events*
1189  * means that all event objects have been enqueued.
1190  *
1191  * @param dev_id
1192  *   The identifier of the device.
1193  * @param port_id
1194  *   The identifier of the event port.
1195  * @param ev
1196  *   Points to an array of *nb_events* objects of type *rte_event* structure
1197  *   which contain the event object enqueue operations to be processed.
1198  * @param nb_events
1199  *   The number of event objects to enqueue, typically number of
1200  *   rte_event_port_enqueue_depth() available for this port.
1201  *
1202  * @return
1203  *   The number of event objects actually enqueued on the event device. The
1204  *   return value can be less than the value of the *nb_events* parameter when
1205  *   the event devices queue is full or if invalid parameters are specified in a
1206  *   *rte_event*. If the return value is less than *nb_events*, the remaining
1207  *   events at the end of ev[] are not consumed and the caller has to take care
1208  *   of them, and rte_errno is set accordingly. Possible errno values include:
1209  *   - -EINVAL  The port ID is invalid, device ID is invalid, an event's queue
1210  *              ID is invalid, or an event's sched type doesn't match the
1211  *              capabilities of the destination queue.
1212  *   - -ENOSPC  The event port was backpressured and unable to enqueue
1213  *              one or more events. This error code is only applicable to
1214  *              closed systems.
1215  * @see rte_event_port_enqueue_depth()
1216  */
1217 static inline uint16_t
1218 rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id,
1219                         const struct rte_event ev[], uint16_t nb_events)
1220 {
1221         const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
1222
1223         return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
1224                         dev->enqueue_burst);
1225 }
1226
1227 /**
1228  * Enqueue a burst of events objects of operation type *RTE_EVENT_OP_NEW* on
1229  * an event device designated by its *dev_id* through the event port specified
1230  * by *port_id*.
1231  *
1232  * Provides the same functionality as rte_event_enqueue_burst(), expect that
1233  * application can use this API when the all objects in the burst contains
1234  * the enqueue operation of the type *RTE_EVENT_OP_NEW*. This specialized
1235  * function can provide the additional hint to the PMD and optimize if possible.
1236  *
1237  * The rte_event_enqueue_new_burst() result is undefined if the enqueue burst
1238  * has event object of operation type != RTE_EVENT_OP_NEW.
1239  *
1240  * @param dev_id
1241  *   The identifier of the device.
1242  * @param port_id
1243  *   The identifier of the event port.
1244  * @param ev
1245  *   Points to an array of *nb_events* objects of type *rte_event* structure
1246  *   which contain the event object enqueue operations to be processed.
1247  * @param nb_events
1248  *   The number of event objects to enqueue, typically number of
1249  *   rte_event_port_enqueue_depth() available for this port.
1250  *
1251  * @return
1252  *   The number of event objects actually enqueued on the event device. The
1253  *   return value can be less than the value of the *nb_events* parameter when
1254  *   the event devices queue is full or if invalid parameters are specified in a
1255  *   *rte_event*. If the return value is less than *nb_events*, the remaining
1256  *   events at the end of ev[] are not consumed and the caller has to take care
1257  *   of them, and rte_errno is set accordingly. Possible errno values include:
1258  *   - -EINVAL  The port ID is invalid, device ID is invalid, an event's queue
1259  *              ID is invalid, or an event's sched type doesn't match the
1260  *              capabilities of the destination queue.
1261  *   - -ENOSPC  The event port was backpressured and unable to enqueue
1262  *              one or more events. This error code is only applicable to
1263  *              closed systems.
1264  * @see rte_event_port_enqueue_depth() rte_event_enqueue_burst()
1265  */
1266 static inline uint16_t
1267 rte_event_enqueue_new_burst(uint8_t dev_id, uint8_t port_id,
1268                         const struct rte_event ev[], uint16_t nb_events)
1269 {
1270         const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
1271
1272         return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
1273                         dev->enqueue_new_burst);
1274 }
1275
1276 /**
1277  * Enqueue a burst of events objects of operation type *RTE_EVENT_OP_FORWARD*
1278  * on an event device designated by its *dev_id* through the event port
1279  * specified by *port_id*.
1280  *
1281  * Provides the same functionality as rte_event_enqueue_burst(), expect that
1282  * application can use this API when the all objects in the burst contains
1283  * the enqueue operation of the type *RTE_EVENT_OP_FORWARD*. This specialized
1284  * function can provide the additional hint to the PMD and optimize if possible.
1285  *
1286  * The rte_event_enqueue_new_burst() result is undefined if the enqueue burst
1287  * has event object of operation type != RTE_EVENT_OP_FORWARD.
1288  *
1289  * @param dev_id
1290  *   The identifier of the device.
1291  * @param port_id
1292  *   The identifier of the event port.
1293  * @param ev
1294  *   Points to an array of *nb_events* objects of type *rte_event* structure
1295  *   which contain the event object enqueue operations to be processed.
1296  * @param nb_events
1297  *   The number of event objects to enqueue, typically number of
1298  *   rte_event_port_enqueue_depth() available for this port.
1299  *
1300  * @return
1301  *   The number of event objects actually enqueued on the event device. The
1302  *   return value can be less than the value of the *nb_events* parameter when
1303  *   the event devices queue is full or if invalid parameters are specified in a
1304  *   *rte_event*. If the return value is less than *nb_events*, the remaining
1305  *   events at the end of ev[] are not consumed and the caller has to take care
1306  *   of them, and rte_errno is set accordingly. Possible errno values include:
1307  *   - -EINVAL  The port ID is invalid, device ID is invalid, an event's queue
1308  *              ID is invalid, or an event's sched type doesn't match the
1309  *              capabilities of the destination queue.
1310  *   - -ENOSPC  The event port was backpressured and unable to enqueue
1311  *              one or more events. This error code is only applicable to
1312  *              closed systems.
1313  * @see rte_event_port_enqueue_depth() rte_event_enqueue_burst()
1314  */
1315 static inline uint16_t
1316 rte_event_enqueue_forward_burst(uint8_t dev_id, uint8_t port_id,
1317                         const struct rte_event ev[], uint16_t nb_events)
1318 {
1319         const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
1320
1321         return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
1322                         dev->enqueue_forward_burst);
1323 }
1324
1325 /**
1326  * Converts nanoseconds to *timeout_ticks* value for rte_event_dequeue_burst()
1327  *
1328  * If the device is configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT flag
1329  * then application can use this function to convert timeout value in
1330  * nanoseconds to implementations specific timeout value supplied in
1331  * rte_event_dequeue_burst()
1332  *
1333  * @param dev_id
1334  *   The identifier of the device.
1335  * @param ns
1336  *   Wait time in nanosecond
1337  * @param[out] timeout_ticks
1338  *   Value for the *timeout_ticks* parameter in rte_event_dequeue_burst()
1339  *
1340  * @return
1341  *  - 0 on success.
1342  *  - -ENOTSUP if the device doesn't support timeouts
1343  *  - -EINVAL if *dev_id* is invalid or *timeout_ticks* is NULL
1344  *  - other values < 0 on failure.
1345  *
1346  * @see rte_event_dequeue_burst(), RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT
1347  * @see rte_event_dev_configure()
1348  *
1349  */
1350 int
1351 rte_event_dequeue_timeout_ticks(uint8_t dev_id, uint64_t ns,
1352                                         uint64_t *timeout_ticks);
1353
1354 /**
1355  * Dequeue a burst of events objects or an event object from the event port
1356  * designated by its *event_port_id*, on an event device designated
1357  * by its *dev_id*.
1358  *
1359  * rte_event_dequeue_burst() does not dictate the specifics of scheduling
1360  * algorithm as each eventdev driver may have different criteria to schedule
1361  * an event. However, in general, from an application perspective scheduler may
1362  * use the following scheme to dispatch an event to the port.
1363  *
1364  * 1) Selection of event queue based on
1365  *   a) The list of event queues are linked to the event port.
1366  *   b) If the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability then event
1367  *   queue selection from list is based on event queue priority relative to
1368  *   other event queue supplied as *priority* in rte_event_queue_setup()
1369  *   c) If the device has RTE_EVENT_DEV_CAP_EVENT_QOS capability then event
1370  *   queue selection from the list is based on event priority supplied as
1371  *   *priority* in rte_event_enqueue_burst()
1372  * 2) Selection of event
1373  *   a) The number of flows available in selected event queue.
1374  *   b) Schedule type method associated with the event
1375  *
1376  * The *nb_events* parameter is the maximum number of event objects to dequeue
1377  * which are returned in the *ev* array of *rte_event* structure.
1378  *
1379  * The rte_event_dequeue_burst() function returns the number of events objects
1380  * it actually dequeued. A return value equal to *nb_events* means that all
1381  * event objects have been dequeued.
1382  *
1383  * The number of events dequeued is the number of scheduler contexts held by
1384  * this port. These contexts are automatically released in the next
1385  * rte_event_dequeue_burst() invocation, or invoking rte_event_enqueue_burst()
1386  * with RTE_EVENT_OP_RELEASE operation can be used to release the
1387  * contexts early.
1388  *
1389  * Event operations RTE_EVENT_OP_FORWARD and RTE_EVENT_OP_RELEASE must only be
1390  * enqueued to the same port that their associated events were dequeued from.
1391  *
1392  * @param dev_id
1393  *   The identifier of the device.
1394  * @param port_id
1395  *   The identifier of the event port.
1396  * @param[out] ev
1397  *   Points to an array of *nb_events* objects of type *rte_event* structure
1398  *   for output to be populated with the dequeued event objects.
1399  * @param nb_events
1400  *   The maximum number of event objects to dequeue, typically number of
1401  *   rte_event_port_dequeue_depth() available for this port.
1402  *
1403  * @param timeout_ticks
1404  *   - 0 no-wait, returns immediately if there is no event.
1405  *   - >0 wait for the event, if the device is configured with
1406  *   RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT then this function will wait until
1407  *   at least one event is available or *timeout_ticks* time.
1408  *   if the device is not configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT
1409  *   then this function will wait until the event available or
1410  *   *dequeue_timeout_ns* ns which was previously supplied to
1411  *   rte_event_dev_configure()
1412  *
1413  * @return
1414  * The number of event objects actually dequeued from the port. The return
1415  * value can be less than the value of the *nb_events* parameter when the
1416  * event port's queue is not full.
1417  *
1418  * @see rte_event_port_dequeue_depth()
1419  */
1420 static inline uint16_t
1421 rte_event_dequeue_burst(uint8_t dev_id, uint8_t port_id, struct rte_event ev[],
1422                         uint16_t nb_events, uint64_t timeout_ticks)
1423 {
1424         struct rte_eventdev *dev = &rte_eventdevs[dev_id];
1425
1426 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
1427         if (dev_id >= RTE_EVENT_MAX_DEVS || !rte_eventdevs[dev_id].attached) {
1428                 rte_errno = -EINVAL;
1429                 return 0;
1430         }
1431
1432         if (port_id >= dev->data->nb_ports) {
1433                 rte_errno = -EINVAL;
1434                 return 0;
1435         }
1436 #endif
1437
1438         /*
1439          * Allow zero cost non burst mode routine invocation if application
1440          * requests nb_events as const one
1441          */
1442         if (nb_events == 1)
1443                 return (*dev->dequeue)(
1444                         dev->data->ports[port_id], ev, timeout_ticks);
1445         else
1446                 return (*dev->dequeue_burst)(
1447                         dev->data->ports[port_id], ev, nb_events,
1448                                 timeout_ticks);
1449 }
1450
1451 /**
1452  * Link multiple source event queues supplied in *queues* to the destination
1453  * event port designated by its *port_id* with associated service priority
1454  * supplied in *priorities* on the event device designated by its *dev_id*.
1455  *
1456  * The link establishment shall enable the event port *port_id* from
1457  * receiving events from the specified event queue(s) supplied in *queues*
1458  *
1459  * An event queue may link to one or more event ports.
1460  * The number of links can be established from an event queue to event port is
1461  * implementation defined.
1462  *
1463  * Event queue(s) to event port link establishment can be changed at runtime
1464  * without re-configuring the device to support scaling and to reduce the
1465  * latency of critical work by establishing the link with more event ports
1466  * at runtime.
1467  *
1468  * @param dev_id
1469  *   The identifier of the device.
1470  *
1471  * @param port_id
1472  *   Event port identifier to select the destination port to link.
1473  *
1474  * @param queues
1475  *   Points to an array of *nb_links* event queues to be linked
1476  *   to the event port.
1477  *   NULL value is allowed, in which case this function links all the configured
1478  *   event queues *nb_event_queues* which previously supplied to
1479  *   rte_event_dev_configure() to the event port *port_id*
1480  *
1481  * @param priorities
1482  *   Points to an array of *nb_links* service priorities associated with each
1483  *   event queue link to event port.
1484  *   The priority defines the event port's servicing priority for
1485  *   event queue, which may be ignored by an implementation.
1486  *   The requested priority should in the range of
1487  *   [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST].
1488  *   The implementation shall normalize the requested priority to
1489  *   implementation supported priority value.
1490  *   NULL value is allowed, in which case this function links the event queues
1491  *   with RTE_EVENT_DEV_PRIORITY_NORMAL servicing priority
1492  *
1493  * @param nb_links
1494  *   The number of links to establish. This parameter is ignored if queues is
1495  *   NULL.
1496  *
1497  * @return
1498  * The number of links actually established. The return value can be less than
1499  * the value of the *nb_links* parameter when the implementation has the
1500  * limitation on specific queue to port link establishment or if invalid
1501  * parameters are specified in *queues*
1502  * If the return value is less than *nb_links*, the remaining links at the end
1503  * of link[] are not established, and the caller has to take care of them.
1504  * If return value is less than *nb_links* then implementation shall update the
1505  * rte_errno accordingly, Possible rte_errno values are
1506  * (-EDQUOT) Quota exceeded(Application tried to link the queue configured with
1507  *  RTE_EVENT_QUEUE_CFG_SINGLE_LINK to more than one event ports)
1508  * (-EINVAL) Invalid parameter
1509  *
1510  */
1511 int
1512 rte_event_port_link(uint8_t dev_id, uint8_t port_id,
1513                     const uint8_t queues[], const uint8_t priorities[],
1514                     uint16_t nb_links);
1515
1516 /**
1517  * Unlink multiple source event queues supplied in *queues* from the destination
1518  * event port designated by its *port_id* on the event device designated
1519  * by its *dev_id*.
1520  *
1521  * The unlink establishment shall disable the event port *port_id* from
1522  * receiving events from the specified event queue *queue_id*
1523  *
1524  * Event queue(s) to event port unlink establishment can be changed at runtime
1525  * without re-configuring the device.
1526  *
1527  * @param dev_id
1528  *   The identifier of the device.
1529  *
1530  * @param port_id
1531  *   Event port identifier to select the destination port to unlink.
1532  *
1533  * @param queues
1534  *   Points to an array of *nb_unlinks* event queues to be unlinked
1535  *   from the event port.
1536  *   NULL value is allowed, in which case this function unlinks all the
1537  *   event queue(s) from the event port *port_id*.
1538  *
1539  * @param nb_unlinks
1540  *   The number of unlinks to establish. This parameter is ignored if queues is
1541  *   NULL.
1542  *
1543  * @return
1544  * The number of unlinks actually established. The return value can be less
1545  * than the value of the *nb_unlinks* parameter when the implementation has the
1546  * limitation on specific queue to port unlink establishment or
1547  * if invalid parameters are specified.
1548  * If the return value is less than *nb_unlinks*, the remaining queues at the
1549  * end of queues[] are not established, and the caller has to take care of them.
1550  * If return value is less than *nb_unlinks* then implementation shall update
1551  * the rte_errno accordingly, Possible rte_errno values are
1552  * (-EINVAL) Invalid parameter
1553  *
1554  */
1555 int
1556 rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
1557                       uint8_t queues[], uint16_t nb_unlinks);
1558
1559 /**
1560  * Retrieve the list of source event queues and its associated service priority
1561  * linked to the destination event port designated by its *port_id*
1562  * on the event device designated by its *dev_id*.
1563  *
1564  * @param dev_id
1565  *   The identifier of the device.
1566  *
1567  * @param port_id
1568  *   Event port identifier.
1569  *
1570  * @param[out] queues
1571  *   Points to an array of *queues* for output.
1572  *   The caller has to allocate *RTE_EVENT_MAX_QUEUES_PER_DEV* bytes to
1573  *   store the event queue(s) linked with event port *port_id*
1574  *
1575  * @param[out] priorities
1576  *   Points to an array of *priorities* for output.
1577  *   The caller has to allocate *RTE_EVENT_MAX_QUEUES_PER_DEV* bytes to
1578  *   store the service priority associated with each event queue linked
1579  *
1580  * @return
1581  * The number of links established on the event port designated by its
1582  *  *port_id*.
1583  * - <0 on failure.
1584  *
1585  */
1586 int
1587 rte_event_port_links_get(uint8_t dev_id, uint8_t port_id,
1588                          uint8_t queues[], uint8_t priorities[]);
1589
1590 /**
1591  * Retrieve the service ID of the event dev. If the adapter doesn't use
1592  * a rte_service function, this function returns -ESRCH.
1593  *
1594  * @param dev_id
1595  *   The identifier of the device.
1596  *
1597  * @param [out] service_id
1598  *   A pointer to a uint32_t, to be filled in with the service id.
1599  *
1600  * @return
1601  *   - 0: Success
1602  *   - <0: Error code on failure, if the event dev doesn't use a rte_service
1603  *   function, this function returns -ESRCH.
1604  */
1605 int
1606 rte_event_dev_service_id_get(uint8_t dev_id, uint32_t *service_id);
1607
1608 /**
1609  * Dump internal information about *dev_id* to the FILE* provided in *f*.
1610  *
1611  * @param dev_id
1612  *   The identifier of the device.
1613  *
1614  * @param f
1615  *   A pointer to a file for output
1616  *
1617  * @return
1618  *   - 0: on success
1619  *   - <0: on failure.
1620  */
1621 int
1622 rte_event_dev_dump(uint8_t dev_id, FILE *f);
1623
1624 /** Maximum name length for extended statistics counters */
1625 #define RTE_EVENT_DEV_XSTATS_NAME_SIZE 64
1626
1627 /**
1628  * Selects the component of the eventdev to retrieve statistics from.
1629  */
1630 enum rte_event_dev_xstats_mode {
1631         RTE_EVENT_DEV_XSTATS_DEVICE,
1632         RTE_EVENT_DEV_XSTATS_PORT,
1633         RTE_EVENT_DEV_XSTATS_QUEUE,
1634 };
1635
1636 /**
1637  * A name-key lookup element for extended statistics.
1638  *
1639  * This structure is used to map between names and ID numbers
1640  * for extended ethdev statistics.
1641  */
1642 struct rte_event_dev_xstats_name {
1643         char name[RTE_EVENT_DEV_XSTATS_NAME_SIZE];
1644 };
1645
1646 /**
1647  * Retrieve names of extended statistics of an event device.
1648  *
1649  * @param dev_id
1650  *   The identifier of the event device.
1651  * @param mode
1652  *   The mode of statistics to retrieve. Choices include the device statistics,
1653  *   port statistics or queue statistics.
1654  * @param queue_port_id
1655  *   Used to specify the port or queue number in queue or port mode, and is
1656  *   ignored in device mode.
1657  * @param[out] xstats_names
1658  *   Block of memory to insert names into. Must be at least size in capacity.
1659  *   If set to NULL, function returns required capacity.
1660  * @param[out] ids
1661  *   Block of memory to insert ids into. Must be at least size in capacity.
1662  *   If set to NULL, function returns required capacity. The id values returned
1663  *   can be passed to *rte_event_dev_xstats_get* to select statistics.
1664  * @param size
1665  *   Capacity of xstats_names (number of names).
1666  * @return
1667  *   - positive value lower or equal to size: success. The return value
1668  *     is the number of entries filled in the stats table.
1669  *   - positive value higher than size: error, the given statistics table
1670  *     is too small. The return value corresponds to the size that should
1671  *     be given to succeed. The entries in the table are not valid and
1672  *     shall not be used by the caller.
1673  *   - negative value on error:
1674  *        -ENODEV for invalid *dev_id*
1675  *        -EINVAL for invalid mode, queue port or id parameters
1676  *        -ENOTSUP if the device doesn't support this function.
1677  */
1678 int
1679 rte_event_dev_xstats_names_get(uint8_t dev_id,
1680                                enum rte_event_dev_xstats_mode mode,
1681                                uint8_t queue_port_id,
1682                                struct rte_event_dev_xstats_name *xstats_names,
1683                                unsigned int *ids,
1684                                unsigned int size);
1685
1686 /**
1687  * Retrieve extended statistics of an event device.
1688  *
1689  * @param dev_id
1690  *   The identifier of the device.
1691  * @param mode
1692  *  The mode of statistics to retrieve. Choices include the device statistics,
1693  *  port statistics or queue statistics.
1694  * @param queue_port_id
1695  *   Used to specify the port or queue number in queue or port mode, and is
1696  *   ignored in device mode.
1697  * @param ids
1698  *   The id numbers of the stats to get. The ids can be got from the stat
1699  *   position in the stat list from rte_event_dev_get_xstats_names(), or
1700  *   by using rte_eventdev_get_xstats_by_name()
1701  * @param[out] values
1702  *   The values for each stats request by ID.
1703  * @param n
1704  *   The number of stats requested
1705  * @return
1706  *   - positive value: number of stat entries filled into the values array
1707  *   - negative value on error:
1708  *        -ENODEV for invalid *dev_id*
1709  *        -EINVAL for invalid mode, queue port or id parameters
1710  *        -ENOTSUP if the device doesn't support this function.
1711  */
1712 int
1713 rte_event_dev_xstats_get(uint8_t dev_id,
1714                          enum rte_event_dev_xstats_mode mode,
1715                          uint8_t queue_port_id,
1716                          const unsigned int ids[],
1717                          uint64_t values[], unsigned int n);
1718
1719 /**
1720  * Retrieve the value of a single stat by requesting it by name.
1721  *
1722  * @param dev_id
1723  *   The identifier of the device
1724  * @param name
1725  *   The stat name to retrieve
1726  * @param[out] id
1727  *   If non-NULL, the numerical id of the stat will be returned, so that further
1728  *   requests for the stat can be got using rte_eventdev_xstats_get, which will
1729  *   be faster as it doesn't need to scan a list of names for the stat.
1730  *   If the stat cannot be found, the id returned will be (unsigned)-1.
1731  * @return
1732  *   - positive value or zero: the stat value
1733  *   - negative value: -EINVAL if stat not found, -ENOTSUP if not supported.
1734  */
1735 uint64_t
1736 rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
1737                                  unsigned int *id);
1738
1739 /**
1740  * Reset the values of the xstats of the selected component in the device.
1741  *
1742  * @param dev_id
1743  *   The identifier of the device
1744  * @param mode
1745  *   The mode of the statistics to reset. Choose from device, queue or port.
1746  * @param queue_port_id
1747  *   The queue or port to reset. 0 and positive values select ports and queues,
1748  *   while -1 indicates all ports or queues.
1749  * @param ids
1750  *   Selects specific statistics to be reset. When NULL, all statistics selected
1751  *   by *mode* will be reset. If non-NULL, must point to array of at least
1752  *   *nb_ids* size.
1753  * @param nb_ids
1754  *   The number of ids available from the *ids* array. Ignored when ids is NULL.
1755  * @return
1756  *   - zero: successfully reset the statistics to zero
1757  *   - negative value: -EINVAL invalid parameters, -ENOTSUP if not supported.
1758  */
1759 int
1760 rte_event_dev_xstats_reset(uint8_t dev_id,
1761                            enum rte_event_dev_xstats_mode mode,
1762                            int16_t queue_port_id,
1763                            const uint32_t ids[],
1764                            uint32_t nb_ids);
1765
1766 #ifdef __cplusplus
1767 }
1768 #endif
1769
1770 #endif /* _RTE_EVENTDEV_H_ */