1d30ea906Sjfb8856606 /* SPDX-License-Identifier: BSD-3-Clause
2d30ea906Sjfb8856606  * Copyright(c) 2016 Cavium, Inc.
3d30ea906Sjfb8856606  * Copyright(c) 2016-2018 Intel Corporation.
4d30ea906Sjfb8856606  * Copyright 2016 NXP
5d30ea906Sjfb8856606  * All rights reserved.
62bfe3f2eSlogwang  */
72bfe3f2eSlogwang 
82bfe3f2eSlogwang #ifndef _RTE_EVENTDEV_H_
92bfe3f2eSlogwang #define _RTE_EVENTDEV_H_
102bfe3f2eSlogwang 
112bfe3f2eSlogwang /**
122bfe3f2eSlogwang  * @file
132bfe3f2eSlogwang  *
142bfe3f2eSlogwang  * RTE Event Device API
152bfe3f2eSlogwang  *
162bfe3f2eSlogwang  * In a polling model, lcores poll ethdev ports and associated rx queues
172bfe3f2eSlogwang  * directly to look for packet. In an event driven model, by contrast, lcores
182bfe3f2eSlogwang  * call the scheduler that selects packets for them based on programmer
192bfe3f2eSlogwang  * specified criteria. Eventdev library adds support for event driven
202bfe3f2eSlogwang  * programming model, which offer applications automatic multicore scaling,
212bfe3f2eSlogwang  * dynamic load balancing, pipelining, packet ingress order maintenance and
222bfe3f2eSlogwang  * synchronization services to simplify application packet processing.
232bfe3f2eSlogwang  *
242bfe3f2eSlogwang  * The Event Device API is composed of two parts:
252bfe3f2eSlogwang  *
262bfe3f2eSlogwang  * - The application-oriented Event API that includes functions to setup
272bfe3f2eSlogwang  *   an event device (configure it, setup its queues, ports and start it), to
282bfe3f2eSlogwang  *   establish the link between queues to port and to receive events, and so on.
292bfe3f2eSlogwang  *
302bfe3f2eSlogwang  * - The driver-oriented Event API that exports a function allowing
312bfe3f2eSlogwang  *   an event poll Mode Driver (PMD) to simultaneously register itself as
322bfe3f2eSlogwang  *   an event device driver.
332bfe3f2eSlogwang  *
342bfe3f2eSlogwang  * Event device components:
352bfe3f2eSlogwang  *
362bfe3f2eSlogwang  *                     +-----------------+
372bfe3f2eSlogwang  *                     | +-------------+ |
382bfe3f2eSlogwang  *        +-------+    | |    flow 0   | |
392bfe3f2eSlogwang  *        |Packet |    | +-------------+ |
402bfe3f2eSlogwang  *        |event  |    | +-------------+ |
412bfe3f2eSlogwang  *        |       |    | |    flow 1   | |port_link(port0, queue0)
422bfe3f2eSlogwang  *        +-------+    | +-------------+ |     |     +--------+
432bfe3f2eSlogwang  *        +-------+    | +-------------+ o-----v-----o        |dequeue +------+
442bfe3f2eSlogwang  *        |Crypto |    | |    flow n   | |           | event  +------->|Core 0|
452bfe3f2eSlogwang  *        |work   |    | +-------------+ o----+      | port 0 |        |      |
462bfe3f2eSlogwang  *        |done ev|    |  event queue 0  |    |      +--------+        +------+
472bfe3f2eSlogwang  *        +-------+    +-----------------+    |
482bfe3f2eSlogwang  *        +-------+                           |
492bfe3f2eSlogwang  *        |Timer  |    +-----------------+    |      +--------+
502bfe3f2eSlogwang  *        |expiry |    | +-------------+ |    +------o        |dequeue +------+
512bfe3f2eSlogwang  *        |event  |    | |    flow 0   | o-----------o event  +------->|Core 1|
522bfe3f2eSlogwang  *        +-------+    | +-------------+ |      +----o port 1 |        |      |
532bfe3f2eSlogwang  *       Event enqueue | +-------------+ |      |    +--------+        +------+
542bfe3f2eSlogwang  *     o-------------> | |    flow 1   | |      |
552bfe3f2eSlogwang  *        enqueue(     | +-------------+ |      |
562bfe3f2eSlogwang  *        queue_id,    |                 |      |    +--------+        +------+
572bfe3f2eSlogwang  *        flow_id,     | +-------------+ |      |    |        |dequeue |Core 2|
582bfe3f2eSlogwang  *        sched_type,  | |    flow n   | o-----------o event  +------->|      |
592bfe3f2eSlogwang  *        event_type,  | +-------------+ |      |    | port 2 |        +------+
602bfe3f2eSlogwang  *        subev_type,  |  event queue 1  |      |    +--------+
612bfe3f2eSlogwang  *        event)       +-----------------+      |    +--------+
622bfe3f2eSlogwang  *                                              |    |        |dequeue +------+
632bfe3f2eSlogwang  *        +-------+    +-----------------+      |    | event  +------->|Core n|
642bfe3f2eSlogwang  *        |Core   |    | +-------------+ o-----------o port n |        |      |
652bfe3f2eSlogwang  *        |(SW)   |    | |    flow 0   | |      |    +--------+        +--+---+
662bfe3f2eSlogwang  *        |event  |    | +-------------+ |      |                         |
672bfe3f2eSlogwang  *        +-------+    | +-------------+ |      |                         |
682bfe3f2eSlogwang  *            ^        | |    flow 1   | |      |                         |
692bfe3f2eSlogwang  *            |        | +-------------+ o------+                         |
702bfe3f2eSlogwang  *            |        | +-------------+ |                                |
712bfe3f2eSlogwang  *            |        | |    flow n   | |                                |
722bfe3f2eSlogwang  *            |        | +-------------+ |                                |
732bfe3f2eSlogwang  *            |        |  event queue n  |                                |
742bfe3f2eSlogwang  *            |        +-----------------+                                |
752bfe3f2eSlogwang  *            |                                                           |
762bfe3f2eSlogwang  *            +-----------------------------------------------------------+
772bfe3f2eSlogwang  *
782bfe3f2eSlogwang  * Event device: A hardware or software-based event scheduler.
792bfe3f2eSlogwang  *
802bfe3f2eSlogwang  * Event: A unit of scheduling that encapsulates a packet or other datatype
812bfe3f2eSlogwang  * like SW generated event from the CPU, Crypto work completion notification,
822bfe3f2eSlogwang  * Timer expiry event notification etc as well as metadata.
832bfe3f2eSlogwang  * The metadata includes flow ID, scheduling type, event priority, event_type,
842bfe3f2eSlogwang  * sub_event_type etc.
852bfe3f2eSlogwang  *
862bfe3f2eSlogwang  * Event queue: A queue containing events that are scheduled by the event dev.
872bfe3f2eSlogwang  * An event queue contains events of different flows associated with scheduling
882bfe3f2eSlogwang  * types, such as atomic, ordered, or parallel.
892bfe3f2eSlogwang  *
902bfe3f2eSlogwang  * Event port: An application's interface into the event dev for enqueue and
912bfe3f2eSlogwang  * dequeue operations. Each event port can be linked with one or more
922bfe3f2eSlogwang  * event queues for dequeue operations.
932bfe3f2eSlogwang  *
942bfe3f2eSlogwang  * By default, all the functions of the Event Device API exported by a PMD
952bfe3f2eSlogwang  * are lock-free functions which assume to not be invoked in parallel on
962bfe3f2eSlogwang  * different logical cores to work on the same target object. For instance,
972bfe3f2eSlogwang  * the dequeue function of a PMD cannot be invoked in parallel on two logical
982bfe3f2eSlogwang  * cores to operates on same  event port. Of course, this function
992bfe3f2eSlogwang  * can be invoked in parallel by different logical cores on different ports.
1002bfe3f2eSlogwang  * It is the responsibility of the upper level application to enforce this rule.
1012bfe3f2eSlogwang  *
1022bfe3f2eSlogwang  * In all functions of the Event API, the Event device is
1032bfe3f2eSlogwang  * designated by an integer >= 0 named the device identifier *dev_id*
1042bfe3f2eSlogwang  *
1052bfe3f2eSlogwang  * At the Event driver level, Event devices are represented by a generic
1062bfe3f2eSlogwang  * data structure of type *rte_event_dev*.
1072bfe3f2eSlogwang  *
1082bfe3f2eSlogwang  * Event devices are dynamically registered during the PCI/SoC device probing
1092bfe3f2eSlogwang  * phase performed at EAL initialization time.
1102bfe3f2eSlogwang  * When an Event device is being probed, a *rte_event_dev* structure and
1112bfe3f2eSlogwang  * a new device identifier are allocated for that device. Then, the
1122bfe3f2eSlogwang  * event_dev_init() function supplied by the Event driver matching the probed
1132bfe3f2eSlogwang  * device is invoked to properly initialize the device.
1142bfe3f2eSlogwang  *
1152bfe3f2eSlogwang  * The role of the device init function consists of resetting the hardware or
1162bfe3f2eSlogwang  * software event driver implementations.
1172bfe3f2eSlogwang  *
1182bfe3f2eSlogwang  * If the device init operation is successful, the correspondence between
1192bfe3f2eSlogwang  * the device identifier assigned to the new device and its associated
1202bfe3f2eSlogwang  * *rte_event_dev* structure is effectively registered.
1212bfe3f2eSlogwang  * Otherwise, both the *rte_event_dev* structure and the device identifier are
1222bfe3f2eSlogwang  * freed.
1232bfe3f2eSlogwang  *
1242bfe3f2eSlogwang  * The functions exported by the application Event API to setup a device
1252bfe3f2eSlogwang  * designated by its device identifier must be invoked in the following order:
1262bfe3f2eSlogwang  *     - rte_event_dev_configure()
1272bfe3f2eSlogwang  *     - rte_event_queue_setup()
1282bfe3f2eSlogwang  *     - rte_event_port_setup()
1292bfe3f2eSlogwang  *     - rte_event_port_link()
1302bfe3f2eSlogwang  *     - rte_event_dev_start()
1312bfe3f2eSlogwang  *
1322bfe3f2eSlogwang  * Then, the application can invoke, in any order, the functions
1332bfe3f2eSlogwang  * exported by the Event API to schedule events, dequeue events, enqueue events,
1342bfe3f2eSlogwang  * change event queue(s) to event port [un]link establishment and so on.
1352bfe3f2eSlogwang  *
1362bfe3f2eSlogwang  * Application may use rte_event_[queue/port]_default_conf_get() to get the
1372bfe3f2eSlogwang  * default configuration to set up an event queue or event port by
1382bfe3f2eSlogwang  * overriding few default values.
1392bfe3f2eSlogwang  *
1402bfe3f2eSlogwang  * If the application wants to change the configuration (i.e. call
1412bfe3f2eSlogwang  * rte_event_dev_configure(), rte_event_queue_setup(), or
1422bfe3f2eSlogwang  * rte_event_port_setup()), it must call rte_event_dev_stop() first to stop the
1432bfe3f2eSlogwang  * device and then do the reconfiguration before calling rte_event_dev_start()
1442bfe3f2eSlogwang  * again. The schedule, enqueue and dequeue functions should not be invoked
1452bfe3f2eSlogwang  * when the device is stopped.
1462bfe3f2eSlogwang  *
1472bfe3f2eSlogwang  * Finally, an application can close an Event device by invoking the
1482bfe3f2eSlogwang  * rte_event_dev_close() function.
1492bfe3f2eSlogwang  *
1502bfe3f2eSlogwang  * Each function of the application Event API invokes a specific function
1512bfe3f2eSlogwang  * of the PMD that controls the target device designated by its device
1522bfe3f2eSlogwang  * identifier.
1532bfe3f2eSlogwang  *
1542bfe3f2eSlogwang  * For this purpose, all device-specific functions of an Event driver are
1552bfe3f2eSlogwang  * supplied through a set of pointers contained in a generic structure of type
1562bfe3f2eSlogwang  * *event_dev_ops*.
1572bfe3f2eSlogwang  * The address of the *event_dev_ops* structure is stored in the *rte_event_dev*
1582bfe3f2eSlogwang  * structure by the device init function of the Event driver, which is
1592bfe3f2eSlogwang  * invoked during the PCI/SoC device probing phase, as explained earlier.
1602bfe3f2eSlogwang  *
1612bfe3f2eSlogwang  * In other words, each function of the Event API simply retrieves the
1622bfe3f2eSlogwang  * *rte_event_dev* structure associated with the device identifier and
1632bfe3f2eSlogwang  * performs an indirect invocation of the corresponding driver function
1642bfe3f2eSlogwang  * supplied in the *event_dev_ops* structure of the *rte_event_dev* structure.
1652bfe3f2eSlogwang  *
1662bfe3f2eSlogwang  * For performance reasons, the address of the fast-path functions of the
1672bfe3f2eSlogwang  * Event driver is not contained in the *event_dev_ops* structure.
1682bfe3f2eSlogwang  * Instead, they are directly stored at the beginning of the *rte_event_dev*
1692bfe3f2eSlogwang  * structure to avoid an extra indirect memory access during their invocation.
1702bfe3f2eSlogwang  *
1712bfe3f2eSlogwang  * RTE event device drivers do not use interrupts for enqueue or dequeue
1722bfe3f2eSlogwang  * operation. Instead, Event drivers export Poll-Mode enqueue and dequeue
1732bfe3f2eSlogwang  * functions to applications.
1742bfe3f2eSlogwang  *
1752bfe3f2eSlogwang  * The events are injected to event device through *enqueue* operation by
1762bfe3f2eSlogwang  * event producers in the system. The typical event producers are ethdev
1772bfe3f2eSlogwang  * subsystem for generating packet events, CPU(SW) for generating events based
1782bfe3f2eSlogwang  * on different stages of application processing, cryptodev for generating
1792bfe3f2eSlogwang  * crypto work completion notification etc
1802bfe3f2eSlogwang  *
1812bfe3f2eSlogwang  * The *dequeue* operation gets one or more events from the event ports.
1822bfe3f2eSlogwang  * The application process the events and send to downstream event queue through
1832bfe3f2eSlogwang  * rte_event_enqueue_burst() if it is an intermediate stage of event processing,
1844b05018fSfengbojiang  * on the final stage, the application may use Tx adapter API for maintaining
1854b05018fSfengbojiang  * the ingress order and then send the packet/event on the wire.
1862bfe3f2eSlogwang  *
1872bfe3f2eSlogwang  * The point at which events are scheduled to ports depends on the device.
1882bfe3f2eSlogwang  * For hardware devices, scheduling occurs asynchronously without any software
1892bfe3f2eSlogwang  * intervention. Software schedulers can either be distributed
1902bfe3f2eSlogwang  * (each worker thread schedules events to its own port) or centralized
1912bfe3f2eSlogwang  * (a dedicated thread schedules to all ports). Distributed software schedulers
1922bfe3f2eSlogwang  * perform the scheduling in rte_event_dequeue_burst(), whereas centralized
1932bfe3f2eSlogwang  * scheduler logic need a dedicated service core for scheduling.
1942bfe3f2eSlogwang  * The RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED capability flag is not set
1952bfe3f2eSlogwang  * indicates the device is centralized and thus needs a dedicated scheduling
1962bfe3f2eSlogwang  * thread that repeatedly calls software specific scheduling function.
1972bfe3f2eSlogwang  *
1982bfe3f2eSlogwang  * An event driven worker thread has following typical workflow on fastpath:
1992bfe3f2eSlogwang  * \code{.c}
2002bfe3f2eSlogwang  *	while (1) {
2012bfe3f2eSlogwang  *		rte_event_dequeue_burst(...);
2022bfe3f2eSlogwang  *		(event processing)
2032bfe3f2eSlogwang  *		rte_event_enqueue_burst(...);
2042bfe3f2eSlogwang  *	}
2052bfe3f2eSlogwang  * \endcode
2062bfe3f2eSlogwang  *
2072bfe3f2eSlogwang  */
2082bfe3f2eSlogwang 
2092bfe3f2eSlogwang #ifdef __cplusplus
2102bfe3f2eSlogwang extern "C" {
2112bfe3f2eSlogwang #endif
2122bfe3f2eSlogwang 
2132bfe3f2eSlogwang #include <rte_common.h>
2142bfe3f2eSlogwang #include <rte_config.h>
2152bfe3f2eSlogwang #include <rte_memory.h>
2162bfe3f2eSlogwang #include <rte_errno.h>
2172bfe3f2eSlogwang 
218*2d9fd380Sjfb8856606 #include "rte_eventdev_trace_fp.h"
219*2d9fd380Sjfb8856606 
2202bfe3f2eSlogwang struct rte_mbuf; /* we just use mbuf pointers; no need to include rte_mbuf.h */
221d30ea906Sjfb8856606 struct rte_event;
2222bfe3f2eSlogwang 
2232bfe3f2eSlogwang /* Event device capability bitmap flags */
2242bfe3f2eSlogwang #define RTE_EVENT_DEV_CAP_QUEUE_QOS           (1ULL << 0)
2252bfe3f2eSlogwang /**< Event scheduling prioritization is based on the priority associated with
2262bfe3f2eSlogwang  *  each event queue.
2272bfe3f2eSlogwang  *
2282bfe3f2eSlogwang  *  @see rte_event_queue_setup()
2292bfe3f2eSlogwang  */
2302bfe3f2eSlogwang #define RTE_EVENT_DEV_CAP_EVENT_QOS           (1ULL << 1)
2312bfe3f2eSlogwang /**< Event scheduling prioritization is based on the priority associated with
2322bfe3f2eSlogwang  *  each event. Priority of each event is supplied in *rte_event* structure
2332bfe3f2eSlogwang  *  on each enqueue operation.
2342bfe3f2eSlogwang  *
2352bfe3f2eSlogwang  *  @see rte_event_enqueue_burst()
2362bfe3f2eSlogwang  */
2372bfe3f2eSlogwang #define RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED   (1ULL << 2)
2382bfe3f2eSlogwang /**< Event device operates in distributed scheduling mode.
2392bfe3f2eSlogwang  * In distributed scheduling mode, event scheduling happens in HW or
2402bfe3f2eSlogwang  * rte_event_dequeue_burst() or the combination of these two.
2412bfe3f2eSlogwang  * If the flag is not set then eventdev is centralized and thus needs a
2422bfe3f2eSlogwang  * dedicated service core that acts as a scheduling thread .
2432bfe3f2eSlogwang  *
2442bfe3f2eSlogwang  * @see rte_event_dequeue_burst()
2452bfe3f2eSlogwang  */
2462bfe3f2eSlogwang #define RTE_EVENT_DEV_CAP_QUEUE_ALL_TYPES     (1ULL << 3)
2472bfe3f2eSlogwang /**< Event device is capable of enqueuing events of any type to any queue.
2482bfe3f2eSlogwang  * If this capability is not set, the queue only supports events of the
2492bfe3f2eSlogwang  *  *RTE_SCHED_TYPE_* type that it was created with.
2502bfe3f2eSlogwang  *
2512bfe3f2eSlogwang  * @see RTE_SCHED_TYPE_* values
2522bfe3f2eSlogwang  */
2532bfe3f2eSlogwang #define RTE_EVENT_DEV_CAP_BURST_MODE          (1ULL << 4)
2542bfe3f2eSlogwang /**< Event device is capable of operating in burst mode for enqueue(forward,
2552bfe3f2eSlogwang  * release) and dequeue operation. If this capability is not set, application
2562bfe3f2eSlogwang  * still uses the rte_event_dequeue_burst() and rte_event_enqueue_burst() but
2572bfe3f2eSlogwang  * PMD accepts only one event at a time.
2582bfe3f2eSlogwang  *
2592bfe3f2eSlogwang  * @see rte_event_dequeue_burst() rte_event_enqueue_burst()
2602bfe3f2eSlogwang  */
261d30ea906Sjfb8856606 #define RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE    (1ULL << 5)
262d30ea906Sjfb8856606 /**< Event device ports support disabling the implicit release feature, in
263d30ea906Sjfb8856606  * which the port will release all unreleased events in its dequeue operation.
264d30ea906Sjfb8856606  * If this capability is set and the port is configured with implicit release
265d30ea906Sjfb8856606  * disabled, the application is responsible for explicitly releasing events
266d30ea906Sjfb8856606  * using either the RTE_EVENT_OP_FORWARD or the RTE_EVENT_OP_RELEASE event
267d30ea906Sjfb8856606  * enqueue operations.
268d30ea906Sjfb8856606  *
269d30ea906Sjfb8856606  * @see rte_event_dequeue_burst() rte_event_enqueue_burst()
270d30ea906Sjfb8856606  */
271d30ea906Sjfb8856606 
272d30ea906Sjfb8856606 #define RTE_EVENT_DEV_CAP_NONSEQ_MODE         (1ULL << 6)
273d30ea906Sjfb8856606 /**< Event device is capable of operating in none sequential mode. The path
274d30ea906Sjfb8856606  * of the event is not necessary to be sequential. Application can change
275d30ea906Sjfb8856606  * the path of event at runtime. If the flag is not set, then event each event
276d30ea906Sjfb8856606  * will follow a path from queue 0 to queue 1 to queue 2 etc. If the flag is
277d30ea906Sjfb8856606  * set, events may be sent to queues in any order. If the flag is not set, the
278d30ea906Sjfb8856606  * eventdev will return an error when the application enqueues an event for a
279d30ea906Sjfb8856606  * qid which is not the next in the sequence.
280d30ea906Sjfb8856606  */
281d30ea906Sjfb8856606 
282d30ea906Sjfb8856606 #define RTE_EVENT_DEV_CAP_RUNTIME_PORT_LINK   (1ULL << 7)
283d30ea906Sjfb8856606 /**< Event device is capable of configuring the queue/port link at runtime.
284d30ea906Sjfb8856606  * If the flag is not set, the eventdev queue/port link is only can be
285d30ea906Sjfb8856606  * configured during  initialization.
286d30ea906Sjfb8856606  */
287d30ea906Sjfb8856606 
288d30ea906Sjfb8856606 #define RTE_EVENT_DEV_CAP_MULTIPLE_QUEUE_PORT (1ULL << 8)
289d30ea906Sjfb8856606 /**< Event device is capable of setting up the link between multiple queue
290d30ea906Sjfb8856606  * with single port. If the flag is not set, the eventdev can only map a
291d30ea906Sjfb8856606  * single queue to each port or map a single queue to many port.
292d30ea906Sjfb8856606  */
2932bfe3f2eSlogwang 
294*2d9fd380Sjfb8856606 #define RTE_EVENT_DEV_CAP_CARRY_FLOW_ID (1ULL << 9)
295*2d9fd380Sjfb8856606 /**< Event device preserves the flow ID from the enqueued
296*2d9fd380Sjfb8856606  * event to the dequeued event if the flag is set. Otherwise,
297*2d9fd380Sjfb8856606  * the content of this field is implementation dependent.
298*2d9fd380Sjfb8856606  */
299*2d9fd380Sjfb8856606 
3002bfe3f2eSlogwang /* Event device priority levels */
3012bfe3f2eSlogwang #define RTE_EVENT_DEV_PRIORITY_HIGHEST   0
3022bfe3f2eSlogwang /**< Highest priority expressed across eventdev subsystem
3032bfe3f2eSlogwang  * @see rte_event_queue_setup(), rte_event_enqueue_burst()
3042bfe3f2eSlogwang  * @see rte_event_port_link()
3052bfe3f2eSlogwang  */
3062bfe3f2eSlogwang #define RTE_EVENT_DEV_PRIORITY_NORMAL    128
3072bfe3f2eSlogwang /**< Normal priority expressed across eventdev subsystem
3082bfe3f2eSlogwang  * @see rte_event_queue_setup(), rte_event_enqueue_burst()
3092bfe3f2eSlogwang  * @see rte_event_port_link()
3102bfe3f2eSlogwang  */
3112bfe3f2eSlogwang #define RTE_EVENT_DEV_PRIORITY_LOWEST    255
3122bfe3f2eSlogwang /**< Lowest priority expressed across eventdev subsystem
3132bfe3f2eSlogwang  * @see rte_event_queue_setup(), rte_event_enqueue_burst()
3142bfe3f2eSlogwang  * @see rte_event_port_link()
3152bfe3f2eSlogwang  */
3162bfe3f2eSlogwang 
3172bfe3f2eSlogwang /**
3182bfe3f2eSlogwang  * Get the total number of event devices that have been successfully
3192bfe3f2eSlogwang  * initialised.
3202bfe3f2eSlogwang  *
3212bfe3f2eSlogwang  * @return
3222bfe3f2eSlogwang  *   The total number of usable event devices.
3232bfe3f2eSlogwang  */
3242bfe3f2eSlogwang uint8_t
3252bfe3f2eSlogwang rte_event_dev_count(void);
3262bfe3f2eSlogwang 
3272bfe3f2eSlogwang /**
3282bfe3f2eSlogwang  * Get the device identifier for the named event device.
3292bfe3f2eSlogwang  *
3302bfe3f2eSlogwang  * @param name
3312bfe3f2eSlogwang  *   Event device name to select the event device identifier.
3322bfe3f2eSlogwang  *
3332bfe3f2eSlogwang  * @return
3342bfe3f2eSlogwang  *   Returns event device identifier on success.
3352bfe3f2eSlogwang  *   - <0: Failure to find named event device.
3362bfe3f2eSlogwang  */
3372bfe3f2eSlogwang int
3382bfe3f2eSlogwang rte_event_dev_get_dev_id(const char *name);
3392bfe3f2eSlogwang 
3402bfe3f2eSlogwang /**
3412bfe3f2eSlogwang  * Return the NUMA socket to which a device is connected.
3422bfe3f2eSlogwang  *
3432bfe3f2eSlogwang  * @param dev_id
3442bfe3f2eSlogwang  *   The identifier of the device.
3452bfe3f2eSlogwang  * @return
3462bfe3f2eSlogwang  *   The NUMA socket id to which the device is connected or
3472bfe3f2eSlogwang  *   a default of zero if the socket could not be determined.
3482bfe3f2eSlogwang  *   -(-EINVAL)  dev_id value is out of range.
3492bfe3f2eSlogwang  */
3502bfe3f2eSlogwang int
3512bfe3f2eSlogwang rte_event_dev_socket_id(uint8_t dev_id);
3522bfe3f2eSlogwang 
3532bfe3f2eSlogwang /**
3542bfe3f2eSlogwang  * Event device information
3552bfe3f2eSlogwang  */
3562bfe3f2eSlogwang struct rte_event_dev_info {
3572bfe3f2eSlogwang 	const char *driver_name;	/**< Event driver name */
3582bfe3f2eSlogwang 	struct rte_device *dev;	/**< Device information */
3592bfe3f2eSlogwang 	uint32_t min_dequeue_timeout_ns;
3602bfe3f2eSlogwang 	/**< Minimum supported global dequeue timeout(ns) by this device */
3612bfe3f2eSlogwang 	uint32_t max_dequeue_timeout_ns;
3622bfe3f2eSlogwang 	/**< Maximum supported global dequeue timeout(ns) by this device */
3632bfe3f2eSlogwang 	uint32_t dequeue_timeout_ns;
3642bfe3f2eSlogwang 	/**< Configured global dequeue timeout(ns) for this device */
3652bfe3f2eSlogwang 	uint8_t max_event_queues;
3662bfe3f2eSlogwang 	/**< Maximum event_queues supported by this device */
3672bfe3f2eSlogwang 	uint32_t max_event_queue_flows;
3682bfe3f2eSlogwang 	/**< Maximum supported flows in an event queue by this device*/
3692bfe3f2eSlogwang 	uint8_t max_event_queue_priority_levels;
3702bfe3f2eSlogwang 	/**< Maximum number of event queue priority levels by this device.
3712bfe3f2eSlogwang 	 * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability
3722bfe3f2eSlogwang 	 */
3732bfe3f2eSlogwang 	uint8_t max_event_priority_levels;
3742bfe3f2eSlogwang 	/**< Maximum number of event priority levels by this device.
3752bfe3f2eSlogwang 	 * Valid when the device has RTE_EVENT_DEV_CAP_EVENT_QOS capability
3762bfe3f2eSlogwang 	 */
3772bfe3f2eSlogwang 	uint8_t max_event_ports;
3782bfe3f2eSlogwang 	/**< Maximum number of event ports supported by this device */
3792bfe3f2eSlogwang 	uint8_t max_event_port_dequeue_depth;
3802bfe3f2eSlogwang 	/**< Maximum number of events can be dequeued at a time from an
3812bfe3f2eSlogwang 	 * event port by this device.
3822bfe3f2eSlogwang 	 * A device that does not support bulk dequeue will set this as 1.
3832bfe3f2eSlogwang 	 */
3842bfe3f2eSlogwang 	uint32_t max_event_port_enqueue_depth;
3852bfe3f2eSlogwang 	/**< Maximum number of events can be enqueued at a time from an
3862bfe3f2eSlogwang 	 * event port by this device.
3872bfe3f2eSlogwang 	 * A device that does not support bulk enqueue will set this as 1.
3882bfe3f2eSlogwang 	 */
389*2d9fd380Sjfb8856606 	uint8_t max_event_port_links;
390*2d9fd380Sjfb8856606 	/**< Maximum number of queues that can be linked to a single event
391*2d9fd380Sjfb8856606 	 * port by this device.
392*2d9fd380Sjfb8856606 	 */
3932bfe3f2eSlogwang 	int32_t max_num_events;
3942bfe3f2eSlogwang 	/**< A *closed system* event dev has a limit on the number of events it
3952bfe3f2eSlogwang 	 * can manage at a time. An *open system* event dev does not have a
3962bfe3f2eSlogwang 	 * limit and will specify this as -1.
3972bfe3f2eSlogwang 	 */
3982bfe3f2eSlogwang 	uint32_t event_dev_cap;
3992bfe3f2eSlogwang 	/**< Event device capabilities(RTE_EVENT_DEV_CAP_)*/
400*2d9fd380Sjfb8856606 	uint8_t max_single_link_event_port_queue_pairs;
401*2d9fd380Sjfb8856606 	/**< Maximum number of event ports and queues that are optimized for
402*2d9fd380Sjfb8856606 	 * (and only capable of) single-link configurations supported by this
403*2d9fd380Sjfb8856606 	 * device. These ports and queues are not accounted for in
404*2d9fd380Sjfb8856606 	 * max_event_ports or max_event_queues.
405*2d9fd380Sjfb8856606 	 */
4062bfe3f2eSlogwang };
4072bfe3f2eSlogwang 
4082bfe3f2eSlogwang /**
4092bfe3f2eSlogwang  * Retrieve the contextual information of an event device.
4102bfe3f2eSlogwang  *
4112bfe3f2eSlogwang  * @param dev_id
4122bfe3f2eSlogwang  *   The identifier of the device.
4132bfe3f2eSlogwang  *
4142bfe3f2eSlogwang  * @param[out] dev_info
4152bfe3f2eSlogwang  *   A pointer to a structure of type *rte_event_dev_info* to be filled with the
4162bfe3f2eSlogwang  *   contextual information of the device.
4172bfe3f2eSlogwang  *
4182bfe3f2eSlogwang  * @return
4192bfe3f2eSlogwang  *   - 0: Success, driver updates the contextual information of the event device
4202bfe3f2eSlogwang  *   - <0: Error code returned by the driver info get function.
4212bfe3f2eSlogwang  *
4222bfe3f2eSlogwang  */
4232bfe3f2eSlogwang int
4242bfe3f2eSlogwang rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info);
4252bfe3f2eSlogwang 
4262bfe3f2eSlogwang /**
4272bfe3f2eSlogwang  * The count of ports.
4282bfe3f2eSlogwang  */
4292bfe3f2eSlogwang #define RTE_EVENT_DEV_ATTR_PORT_COUNT 0
4302bfe3f2eSlogwang /**
4312bfe3f2eSlogwang  * The count of queues.
4322bfe3f2eSlogwang  */
4332bfe3f2eSlogwang #define RTE_EVENT_DEV_ATTR_QUEUE_COUNT 1
4342bfe3f2eSlogwang /**
4352bfe3f2eSlogwang  * The status of the device, zero for stopped, non-zero for started.
4362bfe3f2eSlogwang  */
4372bfe3f2eSlogwang #define RTE_EVENT_DEV_ATTR_STARTED 2
4382bfe3f2eSlogwang 
4392bfe3f2eSlogwang /**
4402bfe3f2eSlogwang  * Get an attribute from a device.
4412bfe3f2eSlogwang  *
4422bfe3f2eSlogwang  * @param dev_id Eventdev id
4432bfe3f2eSlogwang  * @param attr_id The attribute ID to retrieve
4442bfe3f2eSlogwang  * @param[out] attr_value A pointer that will be filled in with the attribute
4452bfe3f2eSlogwang  *             value if successful.
4462bfe3f2eSlogwang  *
4472bfe3f2eSlogwang  * @return
4482bfe3f2eSlogwang  *   - 0: Successfully retrieved attribute value
4492bfe3f2eSlogwang  *   - -EINVAL: Invalid device or  *attr_id* provided, or *attr_value* is NULL
4502bfe3f2eSlogwang  */
4512bfe3f2eSlogwang int
4522bfe3f2eSlogwang rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
4532bfe3f2eSlogwang 		       uint32_t *attr_value);
4542bfe3f2eSlogwang 
4552bfe3f2eSlogwang 
4562bfe3f2eSlogwang /* Event device configuration bitmap flags */
4572bfe3f2eSlogwang #define RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT (1ULL << 0)
4582bfe3f2eSlogwang /**< Override the global *dequeue_timeout_ns* and use per dequeue timeout in ns.
4592bfe3f2eSlogwang  *  @see rte_event_dequeue_timeout_ticks(), rte_event_dequeue_burst()
4602bfe3f2eSlogwang  */
4612bfe3f2eSlogwang 
4622bfe3f2eSlogwang /** Event device configuration structure */
4632bfe3f2eSlogwang struct rte_event_dev_config {
4642bfe3f2eSlogwang 	uint32_t dequeue_timeout_ns;
4652bfe3f2eSlogwang 	/**< rte_event_dequeue_burst() timeout on this device.
4662bfe3f2eSlogwang 	 * This value should be in the range of *min_dequeue_timeout_ns* and
4672bfe3f2eSlogwang 	 * *max_dequeue_timeout_ns* which previously provided in
4682bfe3f2eSlogwang 	 * rte_event_dev_info_get()
4692bfe3f2eSlogwang 	 * The value 0 is allowed, in which case, default dequeue timeout used.
4702bfe3f2eSlogwang 	 * @see RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT
4712bfe3f2eSlogwang 	 */
4722bfe3f2eSlogwang 	int32_t nb_events_limit;
4732bfe3f2eSlogwang 	/**< In a *closed system* this field is the limit on maximum number of
4742bfe3f2eSlogwang 	 * events that can be inflight in the eventdev at a given time. The
4752bfe3f2eSlogwang 	 * limit is required to ensure that the finite space in a closed system
4762bfe3f2eSlogwang 	 * is not overwhelmed. The value cannot exceed the *max_num_events*
4772bfe3f2eSlogwang 	 * as provided by rte_event_dev_info_get().
4782bfe3f2eSlogwang 	 * This value should be set to -1 for *open system*.
4792bfe3f2eSlogwang 	 */
4802bfe3f2eSlogwang 	uint8_t nb_event_queues;
4812bfe3f2eSlogwang 	/**< Number of event queues to configure on this device.
4822bfe3f2eSlogwang 	 * This value cannot exceed the *max_event_queues* which previously
4832bfe3f2eSlogwang 	 * provided in rte_event_dev_info_get()
4842bfe3f2eSlogwang 	 */
4852bfe3f2eSlogwang 	uint8_t nb_event_ports;
4862bfe3f2eSlogwang 	/**< Number of event ports to configure on this device.
4872bfe3f2eSlogwang 	 * This value cannot exceed the *max_event_ports* which previously
4882bfe3f2eSlogwang 	 * provided in rte_event_dev_info_get()
4892bfe3f2eSlogwang 	 */
4902bfe3f2eSlogwang 	uint32_t nb_event_queue_flows;
4912bfe3f2eSlogwang 	/**< Number of flows for any event queue on this device.
4922bfe3f2eSlogwang 	 * This value cannot exceed the *max_event_queue_flows* which previously
4932bfe3f2eSlogwang 	 * provided in rte_event_dev_info_get()
4942bfe3f2eSlogwang 	 */
4952bfe3f2eSlogwang 	uint32_t nb_event_port_dequeue_depth;
4962bfe3f2eSlogwang 	/**< Maximum number of events can be dequeued at a time from an
4972bfe3f2eSlogwang 	 * event port by this device.
4982bfe3f2eSlogwang 	 * This value cannot exceed the *max_event_port_dequeue_depth*
4992bfe3f2eSlogwang 	 * which previously provided in rte_event_dev_info_get().
5002bfe3f2eSlogwang 	 * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
5012bfe3f2eSlogwang 	 * @see rte_event_port_setup()
5022bfe3f2eSlogwang 	 */
5032bfe3f2eSlogwang 	uint32_t nb_event_port_enqueue_depth;
5042bfe3f2eSlogwang 	/**< Maximum number of events can be enqueued at a time from an
5052bfe3f2eSlogwang 	 * event port by this device.
5062bfe3f2eSlogwang 	 * This value cannot exceed the *max_event_port_enqueue_depth*
5072bfe3f2eSlogwang 	 * which previously provided in rte_event_dev_info_get().
5082bfe3f2eSlogwang 	 * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
5092bfe3f2eSlogwang 	 * @see rte_event_port_setup()
5102bfe3f2eSlogwang 	 */
5112bfe3f2eSlogwang 	uint32_t event_dev_cfg;
5122bfe3f2eSlogwang 	/**< Event device config flags(RTE_EVENT_DEV_CFG_)*/
513*2d9fd380Sjfb8856606 	uint8_t nb_single_link_event_port_queues;
514*2d9fd380Sjfb8856606 	/**< Number of event ports and queues that will be singly-linked to
515*2d9fd380Sjfb8856606 	 * each other. These are a subset of the overall event ports and
516*2d9fd380Sjfb8856606 	 * queues; this value cannot exceed *nb_event_ports* or
517*2d9fd380Sjfb8856606 	 * *nb_event_queues*. If the device has ports and queues that are
518*2d9fd380Sjfb8856606 	 * optimized for single-link usage, this field is a hint for how many
519*2d9fd380Sjfb8856606 	 * to allocate; otherwise, regular event ports and queues can be used.
520*2d9fd380Sjfb8856606 	 */
5212bfe3f2eSlogwang };
5222bfe3f2eSlogwang 
5232bfe3f2eSlogwang /**
5242bfe3f2eSlogwang  * Configure an event device.
5252bfe3f2eSlogwang  *
5262bfe3f2eSlogwang  * This function must be invoked first before any other function in the
5272bfe3f2eSlogwang  * API. This function can also be re-invoked when a device is in the
5282bfe3f2eSlogwang  * stopped state.
5292bfe3f2eSlogwang  *
5302bfe3f2eSlogwang  * The caller may use rte_event_dev_info_get() to get the capability of each
5312bfe3f2eSlogwang  * resources available for this event device.
5322bfe3f2eSlogwang  *
5332bfe3f2eSlogwang  * @param dev_id
5342bfe3f2eSlogwang  *   The identifier of the device to configure.
5352bfe3f2eSlogwang  * @param dev_conf
5362bfe3f2eSlogwang  *   The event device configuration structure.
5372bfe3f2eSlogwang  *
5382bfe3f2eSlogwang  * @return
5392bfe3f2eSlogwang  *   - 0: Success, device configured.
5402bfe3f2eSlogwang  *   - <0: Error code returned by the driver configuration function.
5412bfe3f2eSlogwang  */
5422bfe3f2eSlogwang int
5432bfe3f2eSlogwang rte_event_dev_configure(uint8_t dev_id,
5442bfe3f2eSlogwang 			const struct rte_event_dev_config *dev_conf);
5452bfe3f2eSlogwang 
5462bfe3f2eSlogwang /* Event queue specific APIs */
5472bfe3f2eSlogwang 
5482bfe3f2eSlogwang /* Event queue configuration bitmap flags */
5492bfe3f2eSlogwang #define RTE_EVENT_QUEUE_CFG_ALL_TYPES          (1ULL << 0)
5502bfe3f2eSlogwang /**< Allow ATOMIC,ORDERED,PARALLEL schedule type enqueue
5512bfe3f2eSlogwang  *
5522bfe3f2eSlogwang  * @see RTE_SCHED_TYPE_ORDERED, RTE_SCHED_TYPE_ATOMIC, RTE_SCHED_TYPE_PARALLEL
5532bfe3f2eSlogwang  * @see rte_event_enqueue_burst()
5542bfe3f2eSlogwang  */
5552bfe3f2eSlogwang #define RTE_EVENT_QUEUE_CFG_SINGLE_LINK        (1ULL << 1)
5562bfe3f2eSlogwang /**< This event queue links only to a single event port.
5572bfe3f2eSlogwang  *
5582bfe3f2eSlogwang  *  @see rte_event_port_setup(), rte_event_port_link()
5592bfe3f2eSlogwang  */
5602bfe3f2eSlogwang 
5612bfe3f2eSlogwang /** Event queue configuration structure */
5622bfe3f2eSlogwang struct rte_event_queue_conf {
5632bfe3f2eSlogwang 	uint32_t nb_atomic_flows;
5642bfe3f2eSlogwang 	/**< The maximum number of active flows this queue can track at any
5652bfe3f2eSlogwang 	 * given time. If the queue is configured for atomic scheduling (by
5662bfe3f2eSlogwang 	 * applying the RTE_EVENT_QUEUE_CFG_ALL_TYPES flag to event_queue_cfg
5672bfe3f2eSlogwang 	 * or RTE_SCHED_TYPE_ATOMIC flag to schedule_type), then the
5682bfe3f2eSlogwang 	 * value must be in the range of [1, nb_event_queue_flows], which was
5692bfe3f2eSlogwang 	 * previously provided in rte_event_dev_configure().
5702bfe3f2eSlogwang 	 */
5712bfe3f2eSlogwang 	uint32_t nb_atomic_order_sequences;
5722bfe3f2eSlogwang 	/**< The maximum number of outstanding events waiting to be
5732bfe3f2eSlogwang 	 * reordered by this queue. In other words, the number of entries in
5742bfe3f2eSlogwang 	 * this queue’s reorder buffer.When the number of events in the
5752bfe3f2eSlogwang 	 * reorder buffer reaches to *nb_atomic_order_sequences* then the
5762bfe3f2eSlogwang 	 * scheduler cannot schedule the events from this queue and invalid
5772bfe3f2eSlogwang 	 * event will be returned from dequeue until one or more entries are
5782bfe3f2eSlogwang 	 * freed up/released.
5792bfe3f2eSlogwang 	 * If the queue is configured for ordered scheduling (by applying the
5802bfe3f2eSlogwang 	 * RTE_EVENT_QUEUE_CFG_ALL_TYPES flag to event_queue_cfg or
5812bfe3f2eSlogwang 	 * RTE_SCHED_TYPE_ORDERED flag to schedule_type), then the value must
5822bfe3f2eSlogwang 	 * be in the range of [1, nb_event_queue_flows], which was
5832bfe3f2eSlogwang 	 * previously supplied to rte_event_dev_configure().
5842bfe3f2eSlogwang 	 */
5852bfe3f2eSlogwang 	uint32_t event_queue_cfg;
5862bfe3f2eSlogwang 	/**< Queue cfg flags(EVENT_QUEUE_CFG_) */
5872bfe3f2eSlogwang 	uint8_t schedule_type;
5882bfe3f2eSlogwang 	/**< Queue schedule type(RTE_SCHED_TYPE_*).
5892bfe3f2eSlogwang 	 * Valid when RTE_EVENT_QUEUE_CFG_ALL_TYPES bit is not set in
5902bfe3f2eSlogwang 	 * event_queue_cfg.
5912bfe3f2eSlogwang 	 */
5922bfe3f2eSlogwang 	uint8_t priority;
5932bfe3f2eSlogwang 	/**< Priority for this event queue relative to other event queues.
5942bfe3f2eSlogwang 	 * The requested priority should in the range of
5952bfe3f2eSlogwang 	 * [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST].
5962bfe3f2eSlogwang 	 * The implementation shall normalize the requested priority to
5972bfe3f2eSlogwang 	 * event device supported priority value.
5982bfe3f2eSlogwang 	 * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability
5992bfe3f2eSlogwang 	 */
6002bfe3f2eSlogwang };
6012bfe3f2eSlogwang 
6022bfe3f2eSlogwang /**
6032bfe3f2eSlogwang  * Retrieve the default configuration information of an event queue designated
6042bfe3f2eSlogwang  * by its *queue_id* from the event driver for an event device.
6052bfe3f2eSlogwang  *
6062bfe3f2eSlogwang  * This function intended to be used in conjunction with rte_event_queue_setup()
6072bfe3f2eSlogwang  * where caller needs to set up the queue by overriding few default values.
6082bfe3f2eSlogwang  *
6092bfe3f2eSlogwang  * @param dev_id
6102bfe3f2eSlogwang  *   The identifier of the device.
6112bfe3f2eSlogwang  * @param queue_id
6122bfe3f2eSlogwang  *   The index of the event queue to get the configuration information.
6132bfe3f2eSlogwang  *   The value must be in the range [0, nb_event_queues - 1]
6142bfe3f2eSlogwang  *   previously supplied to rte_event_dev_configure().
6152bfe3f2eSlogwang  * @param[out] queue_conf
6162bfe3f2eSlogwang  *   The pointer to the default event queue configuration data.
6172bfe3f2eSlogwang  * @return
6182bfe3f2eSlogwang  *   - 0: Success, driver updates the default event queue configuration data.
6192bfe3f2eSlogwang  *   - <0: Error code returned by the driver info get function.
6202bfe3f2eSlogwang  *
6212bfe3f2eSlogwang  * @see rte_event_queue_setup()
6222bfe3f2eSlogwang  *
6232bfe3f2eSlogwang  */
6242bfe3f2eSlogwang int
6252bfe3f2eSlogwang rte_event_queue_default_conf_get(uint8_t dev_id, uint8_t queue_id,
6262bfe3f2eSlogwang 				 struct rte_event_queue_conf *queue_conf);
6272bfe3f2eSlogwang 
6282bfe3f2eSlogwang /**
6292bfe3f2eSlogwang  * Allocate and set up an event queue for an event device.
6302bfe3f2eSlogwang  *
6312bfe3f2eSlogwang  * @param dev_id
6322bfe3f2eSlogwang  *   The identifier of the device.
6332bfe3f2eSlogwang  * @param queue_id
6342bfe3f2eSlogwang  *   The index of the event queue to setup. The value must be in the range
6352bfe3f2eSlogwang  *   [0, nb_event_queues - 1] previously supplied to rte_event_dev_configure().
6362bfe3f2eSlogwang  * @param queue_conf
6372bfe3f2eSlogwang  *   The pointer to the configuration data to be used for the event queue.
6382bfe3f2eSlogwang  *   NULL value is allowed, in which case default configuration	used.
6392bfe3f2eSlogwang  *
6402bfe3f2eSlogwang  * @see rte_event_queue_default_conf_get()
6412bfe3f2eSlogwang  *
6422bfe3f2eSlogwang  * @return
6432bfe3f2eSlogwang  *   - 0: Success, event queue correctly set up.
6442bfe3f2eSlogwang  *   - <0: event queue configuration failed
6452bfe3f2eSlogwang  */
6462bfe3f2eSlogwang int
6472bfe3f2eSlogwang rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
6482bfe3f2eSlogwang 		      const struct rte_event_queue_conf *queue_conf);
6492bfe3f2eSlogwang 
6502bfe3f2eSlogwang /**
6512bfe3f2eSlogwang  * The priority of the queue.
6522bfe3f2eSlogwang  */
6532bfe3f2eSlogwang #define RTE_EVENT_QUEUE_ATTR_PRIORITY 0
6542bfe3f2eSlogwang /**
6552bfe3f2eSlogwang  * The number of atomic flows configured for the queue.
6562bfe3f2eSlogwang  */
6572bfe3f2eSlogwang #define RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_FLOWS 1
6582bfe3f2eSlogwang /**
6592bfe3f2eSlogwang  * The number of atomic order sequences configured for the queue.
6602bfe3f2eSlogwang  */
6612bfe3f2eSlogwang #define RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_ORDER_SEQUENCES 2
6622bfe3f2eSlogwang /**
6632bfe3f2eSlogwang  * The cfg flags for the queue.
6642bfe3f2eSlogwang  */
6652bfe3f2eSlogwang #define RTE_EVENT_QUEUE_ATTR_EVENT_QUEUE_CFG 3
6662bfe3f2eSlogwang /**
6672bfe3f2eSlogwang  * The schedule type of the queue.
6682bfe3f2eSlogwang  */
6692bfe3f2eSlogwang #define RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE 4
6702bfe3f2eSlogwang 
6712bfe3f2eSlogwang /**
6722bfe3f2eSlogwang  * Get an attribute from a queue.
6732bfe3f2eSlogwang  *
6742bfe3f2eSlogwang  * @param dev_id
6752bfe3f2eSlogwang  *   Eventdev id
6762bfe3f2eSlogwang  * @param queue_id
6772bfe3f2eSlogwang  *   Eventdev queue id
6782bfe3f2eSlogwang  * @param attr_id
6792bfe3f2eSlogwang  *   The attribute ID to retrieve
6802bfe3f2eSlogwang  * @param[out] attr_value
6812bfe3f2eSlogwang  *   A pointer that will be filled in with the attribute value if successful
6822bfe3f2eSlogwang  *
6832bfe3f2eSlogwang  * @return
6842bfe3f2eSlogwang  *   - 0: Successfully returned value
6852bfe3f2eSlogwang  *   - -EINVAL: invalid device, queue or attr_id provided, or attr_value was
6862bfe3f2eSlogwang  *		NULL
6872bfe3f2eSlogwang  *   - -EOVERFLOW: returned when attr_id is set to
6882bfe3f2eSlogwang  *   RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE and event_queue_cfg is set to
6892bfe3f2eSlogwang  *   RTE_EVENT_QUEUE_CFG_ALL_TYPES
6902bfe3f2eSlogwang  */
6912bfe3f2eSlogwang int
6922bfe3f2eSlogwang rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
6932bfe3f2eSlogwang 			uint32_t *attr_value);
6942bfe3f2eSlogwang 
6952bfe3f2eSlogwang /* Event port specific APIs */
6962bfe3f2eSlogwang 
697*2d9fd380Sjfb8856606 /* Event port configuration bitmap flags */
698*2d9fd380Sjfb8856606 #define RTE_EVENT_PORT_CFG_DISABLE_IMPL_REL    (1ULL << 0)
699*2d9fd380Sjfb8856606 /**< Configure the port not to release outstanding events in
700*2d9fd380Sjfb8856606  * rte_event_dev_dequeue_burst(). If set, all events received through
701*2d9fd380Sjfb8856606  * the port must be explicitly released with RTE_EVENT_OP_RELEASE or
702*2d9fd380Sjfb8856606  * RTE_EVENT_OP_FORWARD. Must be unset if the device is not
703*2d9fd380Sjfb8856606  * RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE capable.
704*2d9fd380Sjfb8856606  */
705*2d9fd380Sjfb8856606 #define RTE_EVENT_PORT_CFG_SINGLE_LINK         (1ULL << 1)
706*2d9fd380Sjfb8856606 /**< This event port links only to a single event queue.
707*2d9fd380Sjfb8856606  *
708*2d9fd380Sjfb8856606  *  @see rte_event_port_setup(), rte_event_port_link()
709*2d9fd380Sjfb8856606  */
710*2d9fd380Sjfb8856606 
7112bfe3f2eSlogwang /** Event port configuration structure */
7122bfe3f2eSlogwang struct rte_event_port_conf {
7132bfe3f2eSlogwang 	int32_t new_event_threshold;
7142bfe3f2eSlogwang 	/**< A backpressure threshold for new event enqueues on this port.
7152bfe3f2eSlogwang 	 * Use for *closed system* event dev where event capacity is limited,
7162bfe3f2eSlogwang 	 * and cannot exceed the capacity of the event dev.
7172bfe3f2eSlogwang 	 * Configuring ports with different thresholds can make higher priority
7182bfe3f2eSlogwang 	 * traffic less likely to  be backpressured.
7192bfe3f2eSlogwang 	 * For example, a port used to inject NIC Rx packets into the event dev
7202bfe3f2eSlogwang 	 * can have a lower threshold so as not to overwhelm the device,
7212bfe3f2eSlogwang 	 * while ports used for worker pools can have a higher threshold.
7222bfe3f2eSlogwang 	 * This value cannot exceed the *nb_events_limit*
7232bfe3f2eSlogwang 	 * which was previously supplied to rte_event_dev_configure().
7242bfe3f2eSlogwang 	 * This should be set to '-1' for *open system*.
7252bfe3f2eSlogwang 	 */
7262bfe3f2eSlogwang 	uint16_t dequeue_depth;
7272bfe3f2eSlogwang 	/**< Configure number of bulk dequeues for this event port.
7282bfe3f2eSlogwang 	 * This value cannot exceed the *nb_event_port_dequeue_depth*
7292bfe3f2eSlogwang 	 * which previously supplied to rte_event_dev_configure().
7302bfe3f2eSlogwang 	 * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
7312bfe3f2eSlogwang 	 */
7322bfe3f2eSlogwang 	uint16_t enqueue_depth;
7332bfe3f2eSlogwang 	/**< Configure number of bulk enqueues for this event port.
7342bfe3f2eSlogwang 	 * This value cannot exceed the *nb_event_port_enqueue_depth*
7352bfe3f2eSlogwang 	 * which previously supplied to rte_event_dev_configure().
7362bfe3f2eSlogwang 	 * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
7372bfe3f2eSlogwang 	 */
738*2d9fd380Sjfb8856606 	uint32_t event_port_cfg; /**< Port cfg flags(EVENT_PORT_CFG_) */
7392bfe3f2eSlogwang };
7402bfe3f2eSlogwang 
7412bfe3f2eSlogwang /**
7422bfe3f2eSlogwang  * Retrieve the default configuration information of an event port designated
7432bfe3f2eSlogwang  * by its *port_id* from the event driver for an event device.
7442bfe3f2eSlogwang  *
7452bfe3f2eSlogwang  * This function intended to be used in conjunction with rte_event_port_setup()
7462bfe3f2eSlogwang  * where caller needs to set up the port by overriding few default values.
7472bfe3f2eSlogwang  *
7482bfe3f2eSlogwang  * @param dev_id
7492bfe3f2eSlogwang  *   The identifier of the device.
7502bfe3f2eSlogwang  * @param port_id
7512bfe3f2eSlogwang  *   The index of the event port to get the configuration information.
7522bfe3f2eSlogwang  *   The value must be in the range [0, nb_event_ports - 1]
7532bfe3f2eSlogwang  *   previously supplied to rte_event_dev_configure().
7542bfe3f2eSlogwang  * @param[out] port_conf
7552bfe3f2eSlogwang  *   The pointer to the default event port configuration data
7562bfe3f2eSlogwang  * @return
7572bfe3f2eSlogwang  *   - 0: Success, driver updates the default event port configuration data.
7582bfe3f2eSlogwang  *   - <0: Error code returned by the driver info get function.
7592bfe3f2eSlogwang  *
7602bfe3f2eSlogwang  * @see rte_event_port_setup()
7612bfe3f2eSlogwang  *
7622bfe3f2eSlogwang  */
7632bfe3f2eSlogwang int
7642bfe3f2eSlogwang rte_event_port_default_conf_get(uint8_t dev_id, uint8_t port_id,
7652bfe3f2eSlogwang 				struct rte_event_port_conf *port_conf);
7662bfe3f2eSlogwang 
7672bfe3f2eSlogwang /**
7682bfe3f2eSlogwang  * Allocate and set up an event port for an event device.
7692bfe3f2eSlogwang  *
7702bfe3f2eSlogwang  * @param dev_id
7712bfe3f2eSlogwang  *   The identifier of the device.
7722bfe3f2eSlogwang  * @param port_id
7732bfe3f2eSlogwang  *   The index of the event port to setup. The value must be in the range
7742bfe3f2eSlogwang  *   [0, nb_event_ports - 1] previously supplied to rte_event_dev_configure().
7752bfe3f2eSlogwang  * @param port_conf
7762bfe3f2eSlogwang  *   The pointer to the configuration data to be used for the queue.
7772bfe3f2eSlogwang  *   NULL value is allowed, in which case default configuration	used.
7782bfe3f2eSlogwang  *
7792bfe3f2eSlogwang  * @see rte_event_port_default_conf_get()
7802bfe3f2eSlogwang  *
7812bfe3f2eSlogwang  * @return
7822bfe3f2eSlogwang  *   - 0: Success, event port correctly set up.
7832bfe3f2eSlogwang  *   - <0: Port configuration failed
7842bfe3f2eSlogwang  *   - (-EDQUOT) Quota exceeded(Application tried to link the queue configured
7852bfe3f2eSlogwang  *   with RTE_EVENT_QUEUE_CFG_SINGLE_LINK to more than one event ports)
7862bfe3f2eSlogwang  */
7872bfe3f2eSlogwang int
7882bfe3f2eSlogwang rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
7892bfe3f2eSlogwang 		     const struct rte_event_port_conf *port_conf);
7902bfe3f2eSlogwang 
7912bfe3f2eSlogwang /**
7922bfe3f2eSlogwang  * The queue depth of the port on the enqueue side
7932bfe3f2eSlogwang  */
7942bfe3f2eSlogwang #define RTE_EVENT_PORT_ATTR_ENQ_DEPTH 0
7952bfe3f2eSlogwang /**
7962bfe3f2eSlogwang  * The queue depth of the port on the dequeue side
7972bfe3f2eSlogwang  */
7982bfe3f2eSlogwang #define RTE_EVENT_PORT_ATTR_DEQ_DEPTH 1
7992bfe3f2eSlogwang /**
8002bfe3f2eSlogwang  * The new event threshold of the port
8012bfe3f2eSlogwang  */
8022bfe3f2eSlogwang #define RTE_EVENT_PORT_ATTR_NEW_EVENT_THRESHOLD 2
803*2d9fd380Sjfb8856606 /**
804*2d9fd380Sjfb8856606  * The implicit release disable attribute of the port
805*2d9fd380Sjfb8856606  */
806*2d9fd380Sjfb8856606 #define RTE_EVENT_PORT_ATTR_IMPLICIT_RELEASE_DISABLE 3
8072bfe3f2eSlogwang 
8082bfe3f2eSlogwang /**
8092bfe3f2eSlogwang  * Get an attribute from a port.
8102bfe3f2eSlogwang  *
8112bfe3f2eSlogwang  * @param dev_id
8122bfe3f2eSlogwang  *   Eventdev id
8132bfe3f2eSlogwang  * @param port_id
8142bfe3f2eSlogwang  *   Eventdev port id
8152bfe3f2eSlogwang  * @param attr_id
8162bfe3f2eSlogwang  *   The attribute ID to retrieve
8172bfe3f2eSlogwang  * @param[out] attr_value
8182bfe3f2eSlogwang  *   A pointer that will be filled in with the attribute value if successful
8192bfe3f2eSlogwang  *
8202bfe3f2eSlogwang  * @return
8212bfe3f2eSlogwang  *   - 0: Successfully returned value
8222bfe3f2eSlogwang  *   - (-EINVAL) Invalid device, port or attr_id, or attr_value was NULL
8232bfe3f2eSlogwang  */
8242bfe3f2eSlogwang int
8252bfe3f2eSlogwang rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
8262bfe3f2eSlogwang 			uint32_t *attr_value);
8272bfe3f2eSlogwang 
8282bfe3f2eSlogwang /**
8292bfe3f2eSlogwang  * Start an event device.
8302bfe3f2eSlogwang  *
8312bfe3f2eSlogwang  * The device start step is the last one and consists of setting the event
8322bfe3f2eSlogwang  * queues to start accepting the events and schedules to event ports.
8332bfe3f2eSlogwang  *
8342bfe3f2eSlogwang  * On success, all basic functions exported by the API (event enqueue,
8352bfe3f2eSlogwang  * event dequeue and so on) can be invoked.
8362bfe3f2eSlogwang  *
8372bfe3f2eSlogwang  * @param dev_id
8382bfe3f2eSlogwang  *   Event device identifier
8392bfe3f2eSlogwang  * @return
8402bfe3f2eSlogwang  *   - 0: Success, device started.
8412bfe3f2eSlogwang  *   - -ESTALE : Not all ports of the device are configured
8422bfe3f2eSlogwang  *   - -ENOLINK: Not all queues are linked, which could lead to deadlock.
8432bfe3f2eSlogwang  */
8442bfe3f2eSlogwang int
8452bfe3f2eSlogwang rte_event_dev_start(uint8_t dev_id);
8462bfe3f2eSlogwang 
8472bfe3f2eSlogwang /**
848d30ea906Sjfb8856606  * Stop an event device.
849d30ea906Sjfb8856606  *
850d30ea906Sjfb8856606  * This function causes all queued events to be drained, including those
851d30ea906Sjfb8856606  * residing in event ports. While draining events out of the device, this
852d30ea906Sjfb8856606  * function calls the user-provided flush callback (if one was registered) once
853d30ea906Sjfb8856606  * per event.
854d30ea906Sjfb8856606  *
855d30ea906Sjfb8856606  * The device can be restarted with a call to rte_event_dev_start(). Threads
856d30ea906Sjfb8856606  * that continue to enqueue/dequeue while the device is stopped, or being
857d30ea906Sjfb8856606  * stopped, will result in undefined behavior. This includes event adapters,
858d30ea906Sjfb8856606  * which must be stopped prior to stopping the eventdev.
8592bfe3f2eSlogwang  *
8602bfe3f2eSlogwang  * @param dev_id
8612bfe3f2eSlogwang  *   Event device identifier.
862d30ea906Sjfb8856606  *
863d30ea906Sjfb8856606  * @see rte_event_dev_stop_flush_callback_register()
8642bfe3f2eSlogwang  */
8652bfe3f2eSlogwang void
8662bfe3f2eSlogwang rte_event_dev_stop(uint8_t dev_id);
8672bfe3f2eSlogwang 
868d30ea906Sjfb8856606 typedef void (*eventdev_stop_flush_t)(uint8_t dev_id, struct rte_event event,
869d30ea906Sjfb8856606 		void *arg);
870d30ea906Sjfb8856606 /**< Callback function called during rte_event_dev_stop(), invoked once per
871d30ea906Sjfb8856606  * flushed event.
872d30ea906Sjfb8856606  */
873d30ea906Sjfb8856606 
874d30ea906Sjfb8856606 /**
875d30ea906Sjfb8856606  * Registers a callback function to be invoked during rte_event_dev_stop() for
876d30ea906Sjfb8856606  * each flushed event. This function can be used to properly dispose of queued
877d30ea906Sjfb8856606  * events, for example events containing memory pointers.
878d30ea906Sjfb8856606  *
879d30ea906Sjfb8856606  * The callback function is only registered for the calling process. The
880d30ea906Sjfb8856606  * callback function must be registered in every process that can call
881d30ea906Sjfb8856606  * rte_event_dev_stop().
882d30ea906Sjfb8856606  *
883d30ea906Sjfb8856606  * To unregister a callback, call this function with a NULL callback pointer.
884d30ea906Sjfb8856606  *
885d30ea906Sjfb8856606  * @param dev_id
886d30ea906Sjfb8856606  *   The identifier of the device.
887d30ea906Sjfb8856606  * @param callback
888d30ea906Sjfb8856606  *   Callback function invoked once per flushed event.
889d30ea906Sjfb8856606  * @param userdata
890d30ea906Sjfb8856606  *   Argument supplied to callback.
891d30ea906Sjfb8856606  *
892d30ea906Sjfb8856606  * @return
893d30ea906Sjfb8856606  *  - 0 on success.
894d30ea906Sjfb8856606  *  - -EINVAL if *dev_id* is invalid
895d30ea906Sjfb8856606  *
896d30ea906Sjfb8856606  * @see rte_event_dev_stop()
897d30ea906Sjfb8856606  */
898d30ea906Sjfb8856606 int
899d30ea906Sjfb8856606 rte_event_dev_stop_flush_callback_register(uint8_t dev_id,
900d30ea906Sjfb8856606 		eventdev_stop_flush_t callback, void *userdata);
901d30ea906Sjfb8856606 
9022bfe3f2eSlogwang /**
9032bfe3f2eSlogwang  * Close an event device. The device cannot be restarted!
9042bfe3f2eSlogwang  *
9052bfe3f2eSlogwang  * @param dev_id
9062bfe3f2eSlogwang  *   Event device identifier
9072bfe3f2eSlogwang  *
9082bfe3f2eSlogwang  * @return
9092bfe3f2eSlogwang  *  - 0 on successfully closing device
9102bfe3f2eSlogwang  *  - <0 on failure to close device
9112bfe3f2eSlogwang  *  - (-EAGAIN) if device is busy
9122bfe3f2eSlogwang  */
9132bfe3f2eSlogwang int
9142bfe3f2eSlogwang rte_event_dev_close(uint8_t dev_id);
9152bfe3f2eSlogwang 
9162bfe3f2eSlogwang /* Scheduler type definitions */
9172bfe3f2eSlogwang #define RTE_SCHED_TYPE_ORDERED          0
9182bfe3f2eSlogwang /**< Ordered scheduling
9192bfe3f2eSlogwang  *
9202bfe3f2eSlogwang  * Events from an ordered flow of an event queue can be scheduled to multiple
9212bfe3f2eSlogwang  * ports for concurrent processing while maintaining the original event order.
9222bfe3f2eSlogwang  * This scheme enables the user to achieve high single flow throughput by
9232bfe3f2eSlogwang  * avoiding SW synchronization for ordering between ports which bound to cores.
9242bfe3f2eSlogwang  *
9252bfe3f2eSlogwang  * The source flow ordering from an event queue is maintained when events are
9262bfe3f2eSlogwang  * enqueued to their destination queue within the same ordered flow context.
9272bfe3f2eSlogwang  * An event port holds the context until application call
9282bfe3f2eSlogwang  * rte_event_dequeue_burst() from the same port, which implicitly releases
9292bfe3f2eSlogwang  * the context.
9302bfe3f2eSlogwang  * User may allow the scheduler to release the context earlier than that
9312bfe3f2eSlogwang  * by invoking rte_event_enqueue_burst() with RTE_EVENT_OP_RELEASE operation.
9322bfe3f2eSlogwang  *
9332bfe3f2eSlogwang  * Events from the source queue appear in their original order when dequeued
9342bfe3f2eSlogwang  * from a destination queue.
9352bfe3f2eSlogwang  * Event ordering is based on the received event(s), but also other
9362bfe3f2eSlogwang  * (newly allocated or stored) events are ordered when enqueued within the same
9372bfe3f2eSlogwang  * ordered context. Events not enqueued (e.g. released or stored) within the
9382bfe3f2eSlogwang  * context are  considered missing from reordering and are skipped at this time
9392bfe3f2eSlogwang  * (but can be ordered again within another context).
9402bfe3f2eSlogwang  *
9412bfe3f2eSlogwang  * @see rte_event_queue_setup(), rte_event_dequeue_burst(), RTE_EVENT_OP_RELEASE
9422bfe3f2eSlogwang  */
9432bfe3f2eSlogwang 
9442bfe3f2eSlogwang #define RTE_SCHED_TYPE_ATOMIC           1
9452bfe3f2eSlogwang /**< Atomic scheduling
9462bfe3f2eSlogwang  *
9472bfe3f2eSlogwang  * Events from an atomic flow of an event queue can be scheduled only to a
9482bfe3f2eSlogwang  * single port at a time. The port is guaranteed to have exclusive (atomic)
9492bfe3f2eSlogwang  * access to the associated flow context, which enables the user to avoid SW
9502bfe3f2eSlogwang  * synchronization. Atomic flows also help to maintain event ordering
9512bfe3f2eSlogwang  * since only one port at a time can process events from a flow of an
9522bfe3f2eSlogwang  * event queue.
9532bfe3f2eSlogwang  *
9542bfe3f2eSlogwang  * The atomic queue synchronization context is dedicated to the port until
9552bfe3f2eSlogwang  * application call rte_event_dequeue_burst() from the same port,
9562bfe3f2eSlogwang  * which implicitly releases the context. User may allow the scheduler to
9572bfe3f2eSlogwang  * release the context earlier than that by invoking rte_event_enqueue_burst()
9582bfe3f2eSlogwang  * with RTE_EVENT_OP_RELEASE operation.
9592bfe3f2eSlogwang  *
9602bfe3f2eSlogwang  * @see rte_event_queue_setup(), rte_event_dequeue_burst(), RTE_EVENT_OP_RELEASE
9612bfe3f2eSlogwang  */
9622bfe3f2eSlogwang 
9632bfe3f2eSlogwang #define RTE_SCHED_TYPE_PARALLEL         2
9642bfe3f2eSlogwang /**< Parallel scheduling
9652bfe3f2eSlogwang  *
9662bfe3f2eSlogwang  * The scheduler performs priority scheduling, load balancing, etc. functions
9672bfe3f2eSlogwang  * but does not provide additional event synchronization or ordering.
9682bfe3f2eSlogwang  * It is free to schedule events from a single parallel flow of an event queue
9692bfe3f2eSlogwang  * to multiple events ports for concurrent processing.
9702bfe3f2eSlogwang  * The application is responsible for flow context synchronization and
9712bfe3f2eSlogwang  * event ordering (SW synchronization).
9722bfe3f2eSlogwang  *
9732bfe3f2eSlogwang  * @see rte_event_queue_setup(), rte_event_dequeue_burst()
9742bfe3f2eSlogwang  */
9752bfe3f2eSlogwang 
9762bfe3f2eSlogwang /* Event types to classify the event source */
9772bfe3f2eSlogwang #define RTE_EVENT_TYPE_ETHDEV           0x0
9782bfe3f2eSlogwang /**< The event generated from ethdev subsystem */
9792bfe3f2eSlogwang #define RTE_EVENT_TYPE_CRYPTODEV        0x1
9802bfe3f2eSlogwang /**< The event generated from crypodev subsystem */
981d30ea906Sjfb8856606 #define RTE_EVENT_TYPE_TIMER		0x2
982d30ea906Sjfb8856606 /**< The event generated from event timer adapter */
9832bfe3f2eSlogwang #define RTE_EVENT_TYPE_CPU              0x3
9842bfe3f2eSlogwang /**< The event generated from cpu for pipelining.
9852bfe3f2eSlogwang  * Application may use *sub_event_type* to further classify the event
9862bfe3f2eSlogwang  */
9872bfe3f2eSlogwang #define RTE_EVENT_TYPE_ETH_RX_ADAPTER   0x4
9882bfe3f2eSlogwang /**< The event generated from event eth Rx adapter */
9892bfe3f2eSlogwang #define RTE_EVENT_TYPE_MAX              0x10
9902bfe3f2eSlogwang /**< Maximum number of event types */
9912bfe3f2eSlogwang 
9922bfe3f2eSlogwang /* Event enqueue operations */
9932bfe3f2eSlogwang #define RTE_EVENT_OP_NEW                0
9942bfe3f2eSlogwang /**< The event producers use this operation to inject a new event to the
9952bfe3f2eSlogwang  * event device.
9962bfe3f2eSlogwang  */
9972bfe3f2eSlogwang #define RTE_EVENT_OP_FORWARD            1
9982bfe3f2eSlogwang /**< The CPU use this operation to forward the event to different event queue or
9992bfe3f2eSlogwang  * change to new application specific flow or schedule type to enable
10002bfe3f2eSlogwang  * pipelining.
10012bfe3f2eSlogwang  *
10022bfe3f2eSlogwang  * This operation must only be enqueued to the same port that the
10032bfe3f2eSlogwang  * event to be forwarded was dequeued from.
10042bfe3f2eSlogwang  */
10052bfe3f2eSlogwang #define RTE_EVENT_OP_RELEASE            2
10062bfe3f2eSlogwang /**< Release the flow context associated with the schedule type.
10072bfe3f2eSlogwang  *
10082bfe3f2eSlogwang  * If current flow's scheduler type method is *RTE_SCHED_TYPE_ATOMIC*
10092bfe3f2eSlogwang  * then this function hints the scheduler that the user has completed critical
10102bfe3f2eSlogwang  * section processing in the current atomic context.
10112bfe3f2eSlogwang  * The scheduler is now allowed to schedule events from the same flow from
10122bfe3f2eSlogwang  * an event queue to another port. However, the context may be still held
10132bfe3f2eSlogwang  * until the next rte_event_dequeue_burst() call, this call allows but does not
10142bfe3f2eSlogwang  * force the scheduler to release the context early.
10152bfe3f2eSlogwang  *
10162bfe3f2eSlogwang  * Early atomic context release may increase parallelism and thus system
10172bfe3f2eSlogwang  * performance, but the user needs to design carefully the split into critical
10182bfe3f2eSlogwang  * vs non-critical sections.
10192bfe3f2eSlogwang  *
10202bfe3f2eSlogwang  * If current flow's scheduler type method is *RTE_SCHED_TYPE_ORDERED*
10212bfe3f2eSlogwang  * then this function hints the scheduler that the user has done all that need
10222bfe3f2eSlogwang  * to maintain event order in the current ordered context.
10232bfe3f2eSlogwang  * The scheduler is allowed to release the ordered context of this port and
10242bfe3f2eSlogwang  * avoid reordering any following enqueues.
10252bfe3f2eSlogwang  *
10262bfe3f2eSlogwang  * Early ordered context release may increase parallelism and thus system
10272bfe3f2eSlogwang  * performance.
10282bfe3f2eSlogwang  *
10292bfe3f2eSlogwang  * If current flow's scheduler type method is *RTE_SCHED_TYPE_PARALLEL*
10302bfe3f2eSlogwang  * or no scheduling context is held then this function may be an NOOP,
10312bfe3f2eSlogwang  * depending on the implementation.
10322bfe3f2eSlogwang  *
10332bfe3f2eSlogwang  * This operation must only be enqueued to the same port that the
10342bfe3f2eSlogwang  * event to be released was dequeued from.
10352bfe3f2eSlogwang  *
10362bfe3f2eSlogwang  */
10372bfe3f2eSlogwang 
10382bfe3f2eSlogwang /**
10392bfe3f2eSlogwang  * The generic *rte_event* structure to hold the event attributes
10402bfe3f2eSlogwang  * for dequeue and enqueue operation
10412bfe3f2eSlogwang  */
10422bfe3f2eSlogwang RTE_STD_C11
10432bfe3f2eSlogwang struct rte_event {
10442bfe3f2eSlogwang 	/** WORD0 */
10452bfe3f2eSlogwang 	union {
10462bfe3f2eSlogwang 		uint64_t event;
10472bfe3f2eSlogwang 		/** Event attributes for dequeue or enqueue operation */
10482bfe3f2eSlogwang 		struct {
10492bfe3f2eSlogwang 			uint32_t flow_id:20;
10502bfe3f2eSlogwang 			/**< Targeted flow identifier for the enqueue and
10512bfe3f2eSlogwang 			 * dequeue operation.
10522bfe3f2eSlogwang 			 * The value must be in the range of
10532bfe3f2eSlogwang 			 * [0, nb_event_queue_flows - 1] which
10542bfe3f2eSlogwang 			 * previously supplied to rte_event_dev_configure().
10552bfe3f2eSlogwang 			 */
10562bfe3f2eSlogwang 			uint32_t sub_event_type:8;
10572bfe3f2eSlogwang 			/**< Sub-event types based on the event source.
10582bfe3f2eSlogwang 			 * @see RTE_EVENT_TYPE_CPU
10592bfe3f2eSlogwang 			 */
10602bfe3f2eSlogwang 			uint32_t event_type:4;
10612bfe3f2eSlogwang 			/**< Event type to classify the event source.
10622bfe3f2eSlogwang 			 * @see RTE_EVENT_TYPE_ETHDEV, (RTE_EVENT_TYPE_*)
10632bfe3f2eSlogwang 			 */
10642bfe3f2eSlogwang 			uint8_t op:2;
10652bfe3f2eSlogwang 			/**< The type of event enqueue operation - new/forward/
10662bfe3f2eSlogwang 			 * etc.This field is not preserved across an instance
10672bfe3f2eSlogwang 			 * and is undefined on dequeue.
10682bfe3f2eSlogwang 			 * @see RTE_EVENT_OP_NEW, (RTE_EVENT_OP_*)
10692bfe3f2eSlogwang 			 */
10702bfe3f2eSlogwang 			uint8_t rsvd:4;
10712bfe3f2eSlogwang 			/**< Reserved for future use */
10722bfe3f2eSlogwang 			uint8_t sched_type:2;
10732bfe3f2eSlogwang 			/**< Scheduler synchronization type (RTE_SCHED_TYPE_*)
10742bfe3f2eSlogwang 			 * associated with flow id on a given event queue
10752bfe3f2eSlogwang 			 * for the enqueue and dequeue operation.
10762bfe3f2eSlogwang 			 */
10772bfe3f2eSlogwang 			uint8_t queue_id;
10782bfe3f2eSlogwang 			/**< Targeted event queue identifier for the enqueue or
10792bfe3f2eSlogwang 			 * dequeue operation.
10802bfe3f2eSlogwang 			 * The value must be in the range of
10812bfe3f2eSlogwang 			 * [0, nb_event_queues - 1] which previously supplied to
10822bfe3f2eSlogwang 			 * rte_event_dev_configure().
10832bfe3f2eSlogwang 			 */
10842bfe3f2eSlogwang 			uint8_t priority;
10852bfe3f2eSlogwang 			/**< Event priority relative to other events in the
10862bfe3f2eSlogwang 			 * event queue. The requested priority should in the
10872bfe3f2eSlogwang 			 * range of  [RTE_EVENT_DEV_PRIORITY_HIGHEST,
10882bfe3f2eSlogwang 			 * RTE_EVENT_DEV_PRIORITY_LOWEST].
10892bfe3f2eSlogwang 			 * The implementation shall normalize the requested
10902bfe3f2eSlogwang 			 * priority to supported priority value.
10912bfe3f2eSlogwang 			 * Valid when the device has
10922bfe3f2eSlogwang 			 * RTE_EVENT_DEV_CAP_EVENT_QOS capability.
10932bfe3f2eSlogwang 			 */
10942bfe3f2eSlogwang 			uint8_t impl_opaque;
10952bfe3f2eSlogwang 			/**< Implementation specific opaque value.
10962bfe3f2eSlogwang 			 * An implementation may use this field to hold
10972bfe3f2eSlogwang 			 * implementation specific value to share between
10982bfe3f2eSlogwang 			 * dequeue and enqueue operation.
10992bfe3f2eSlogwang 			 * The application should not modify this field.
11002bfe3f2eSlogwang 			 */
11012bfe3f2eSlogwang 		};
11022bfe3f2eSlogwang 	};
11032bfe3f2eSlogwang 	/** WORD1 */
11042bfe3f2eSlogwang 	union {
11052bfe3f2eSlogwang 		uint64_t u64;
11062bfe3f2eSlogwang 		/**< Opaque 64-bit value */
11072bfe3f2eSlogwang 		void *event_ptr;
11082bfe3f2eSlogwang 		/**< Opaque event pointer */
11092bfe3f2eSlogwang 		struct rte_mbuf *mbuf;
11102bfe3f2eSlogwang 		/**< mbuf pointer if dequeued event is associated with mbuf */
11112bfe3f2eSlogwang 	};
11122bfe3f2eSlogwang };
11132bfe3f2eSlogwang 
11142bfe3f2eSlogwang /* Ethdev Rx adapter capability bitmap flags */
11152bfe3f2eSlogwang #define RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT	0x1
11162bfe3f2eSlogwang /**< This flag is sent when the packet transfer mechanism is in HW.
11172bfe3f2eSlogwang  * Ethdev can send packets to the event device using internal event port.
11182bfe3f2eSlogwang  */
11192bfe3f2eSlogwang #define RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ	0x2
11202bfe3f2eSlogwang /**< Adapter supports multiple event queues per ethdev. Every ethdev
11212bfe3f2eSlogwang  * Rx queue can be connected to a unique event queue.
11222bfe3f2eSlogwang  */
11232bfe3f2eSlogwang #define RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID	0x4
11242bfe3f2eSlogwang /**< The application can override the adapter generated flow ID in the
11252bfe3f2eSlogwang  * event. This flow ID can be specified when adding an ethdev Rx queue
11262bfe3f2eSlogwang  * to the adapter using the ev member of struct rte_event_eth_rx_adapter
11272bfe3f2eSlogwang  * @see struct rte_event_eth_rx_adapter_queue_conf::ev
11282bfe3f2eSlogwang  * @see struct rte_event_eth_rx_adapter_queue_conf::rx_queue_flags
11292bfe3f2eSlogwang  */
11302bfe3f2eSlogwang 
11312bfe3f2eSlogwang /**
11322bfe3f2eSlogwang  * Retrieve the event device's ethdev Rx adapter capabilities for the
11332bfe3f2eSlogwang  * specified ethernet port
11342bfe3f2eSlogwang  *
11352bfe3f2eSlogwang  * @param dev_id
11362bfe3f2eSlogwang  *   The identifier of the device.
11372bfe3f2eSlogwang  *
11382bfe3f2eSlogwang  * @param eth_port_id
11392bfe3f2eSlogwang  *   The identifier of the ethernet device.
11402bfe3f2eSlogwang  *
11412bfe3f2eSlogwang  * @param[out] caps
11422bfe3f2eSlogwang  *   A pointer to memory filled with Rx event adapter capabilities.
11432bfe3f2eSlogwang  *
11442bfe3f2eSlogwang  * @return
11452bfe3f2eSlogwang  *   - 0: Success, driver provides Rx event adapter capabilities for the
11462bfe3f2eSlogwang  *	ethernet device.
11472bfe3f2eSlogwang  *   - <0: Error code returned by the driver function.
11482bfe3f2eSlogwang  *
11492bfe3f2eSlogwang  */
11502bfe3f2eSlogwang int
1151d30ea906Sjfb8856606 rte_event_eth_rx_adapter_caps_get(uint8_t dev_id, uint16_t eth_port_id,
11522bfe3f2eSlogwang 				uint32_t *caps);
11532bfe3f2eSlogwang 
1154d30ea906Sjfb8856606 #define RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT (1ULL << 0)
1155d30ea906Sjfb8856606 /**< This flag is set when the timer mechanism is in HW. */
1156d30ea906Sjfb8856606 
1157d30ea906Sjfb8856606 /**
1158d30ea906Sjfb8856606  * Retrieve the event device's timer adapter capabilities.
1159d30ea906Sjfb8856606  *
1160d30ea906Sjfb8856606  * @param dev_id
1161d30ea906Sjfb8856606  *   The identifier of the device.
1162d30ea906Sjfb8856606  *
1163d30ea906Sjfb8856606  * @param[out] caps
1164d30ea906Sjfb8856606  *   A pointer to memory to be filled with event timer adapter capabilities.
1165d30ea906Sjfb8856606  *
1166d30ea906Sjfb8856606  * @return
1167d30ea906Sjfb8856606  *   - 0: Success, driver provided event timer adapter capabilities.
1168d30ea906Sjfb8856606  *   - <0: Error code returned by the driver function.
1169d30ea906Sjfb8856606  */
11704418919fSjohnjiang int
1171d30ea906Sjfb8856606 rte_event_timer_adapter_caps_get(uint8_t dev_id, uint32_t *caps);
1172d30ea906Sjfb8856606 
1173d30ea906Sjfb8856606 /* Crypto adapter capability bitmap flag */
1174d30ea906Sjfb8856606 #define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW   0x1
1175d30ea906Sjfb8856606 /**< Flag indicates HW is capable of generating events in
1176d30ea906Sjfb8856606  * RTE_EVENT_OP_NEW enqueue operation. Cryptodev will send
1177d30ea906Sjfb8856606  * packets to the event device as new events using an internal
1178d30ea906Sjfb8856606  * event port.
1179d30ea906Sjfb8856606  */
1180d30ea906Sjfb8856606 
1181d30ea906Sjfb8856606 #define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD   0x2
1182d30ea906Sjfb8856606 /**< Flag indicates HW is capable of generating events in
1183d30ea906Sjfb8856606  * RTE_EVENT_OP_FORWARD enqueue operation. Cryptodev will send
1184d30ea906Sjfb8856606  * packets to the event device as forwarded event using an
1185d30ea906Sjfb8856606  * internal event port.
1186d30ea906Sjfb8856606  */
1187d30ea906Sjfb8856606 
1188d30ea906Sjfb8856606 #define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND  0x4
1189d30ea906Sjfb8856606 /**< Flag indicates HW is capable of mapping crypto queue pair to
1190d30ea906Sjfb8856606  * event queue.
1191d30ea906Sjfb8856606  */
1192d30ea906Sjfb8856606 
1193d30ea906Sjfb8856606 #define RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA   0x8
11941646932aSjfb8856606 /**< Flag indicates HW/SW supports a mechanism to store and retrieve
1195d30ea906Sjfb8856606  * the private data information along with the crypto session.
1196d30ea906Sjfb8856606  */
1197d30ea906Sjfb8856606 
1198d30ea906Sjfb8856606 /**
1199d30ea906Sjfb8856606  * Retrieve the event device's crypto adapter capabilities for the
1200d30ea906Sjfb8856606  * specified cryptodev device
1201d30ea906Sjfb8856606  *
1202d30ea906Sjfb8856606  * @param dev_id
1203d30ea906Sjfb8856606  *   The identifier of the device.
1204d30ea906Sjfb8856606  *
1205d30ea906Sjfb8856606  * @param cdev_id
1206d30ea906Sjfb8856606  *   The identifier of the cryptodev device.
1207d30ea906Sjfb8856606  *
1208d30ea906Sjfb8856606  * @param[out] caps
1209d30ea906Sjfb8856606  *   A pointer to memory filled with event adapter capabilities.
1210d30ea906Sjfb8856606  *   It is expected to be pre-allocated & initialized by caller.
1211d30ea906Sjfb8856606  *
1212d30ea906Sjfb8856606  * @return
1213d30ea906Sjfb8856606  *   - 0: Success, driver provides event adapter capabilities for the
1214d30ea906Sjfb8856606  *     cryptodev device.
1215d30ea906Sjfb8856606  *   - <0: Error code returned by the driver function.
1216d30ea906Sjfb8856606  *
1217d30ea906Sjfb8856606  */
12184418919fSjohnjiang int
1219d30ea906Sjfb8856606 rte_event_crypto_adapter_caps_get(uint8_t dev_id, uint8_t cdev_id,
1220d30ea906Sjfb8856606 				  uint32_t *caps);
1221d30ea906Sjfb8856606 
1222d30ea906Sjfb8856606 /* Ethdev Tx adapter capability bitmap flags */
1223d30ea906Sjfb8856606 #define RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT	0x1
1224d30ea906Sjfb8856606 /**< This flag is sent when the PMD supports a packet transmit callback
1225d30ea906Sjfb8856606  */
1226d30ea906Sjfb8856606 
1227d30ea906Sjfb8856606 /**
1228d30ea906Sjfb8856606  * Retrieve the event device's eth Tx adapter capabilities
1229d30ea906Sjfb8856606  *
1230d30ea906Sjfb8856606  * @param dev_id
1231d30ea906Sjfb8856606  *   The identifier of the device.
1232d30ea906Sjfb8856606  *
1233d30ea906Sjfb8856606  * @param eth_port_id
1234d30ea906Sjfb8856606  *   The identifier of the ethernet device.
1235d30ea906Sjfb8856606  *
1236d30ea906Sjfb8856606  * @param[out] caps
1237d30ea906Sjfb8856606  *   A pointer to memory filled with eth Tx adapter capabilities.
1238d30ea906Sjfb8856606  *
1239d30ea906Sjfb8856606  * @return
1240d30ea906Sjfb8856606  *   - 0: Success, driver provides eth Tx adapter capabilities.
1241d30ea906Sjfb8856606  *   - <0: Error code returned by the driver function.
1242d30ea906Sjfb8856606  *
1243d30ea906Sjfb8856606  */
12444418919fSjohnjiang int
1245d30ea906Sjfb8856606 rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint16_t eth_port_id,
1246d30ea906Sjfb8856606 				uint32_t *caps);
1247d30ea906Sjfb8856606 
12482bfe3f2eSlogwang struct rte_eventdev_ops;
12492bfe3f2eSlogwang struct rte_eventdev;
12502bfe3f2eSlogwang 
12512bfe3f2eSlogwang typedef uint16_t (*event_enqueue_t)(void *port, const struct rte_event *ev);
12522bfe3f2eSlogwang /**< @internal Enqueue event on port of a device */
12532bfe3f2eSlogwang 
12542bfe3f2eSlogwang typedef uint16_t (*event_enqueue_burst_t)(void *port,
12552bfe3f2eSlogwang 			const struct rte_event ev[], uint16_t nb_events);
12562bfe3f2eSlogwang /**< @internal Enqueue burst of events on port of a device */
12572bfe3f2eSlogwang 
12582bfe3f2eSlogwang typedef uint16_t (*event_dequeue_t)(void *port, struct rte_event *ev,
12592bfe3f2eSlogwang 		uint64_t timeout_ticks);
12602bfe3f2eSlogwang /**< @internal Dequeue event from port of a device */
12612bfe3f2eSlogwang 
12622bfe3f2eSlogwang typedef uint16_t (*event_dequeue_burst_t)(void *port, struct rte_event ev[],
12632bfe3f2eSlogwang 		uint16_t nb_events, uint64_t timeout_ticks);
12642bfe3f2eSlogwang /**< @internal Dequeue burst of events from port of a device */
12652bfe3f2eSlogwang 
1266d30ea906Sjfb8856606 typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
1267d30ea906Sjfb8856606 				struct rte_event ev[], uint16_t nb_events);
1268d30ea906Sjfb8856606 /**< @internal Enqueue burst of events on port of a device */
1269d30ea906Sjfb8856606 
12704418919fSjohnjiang typedef uint16_t (*event_tx_adapter_enqueue_same_dest)(void *port,
12714418919fSjohnjiang 		struct rte_event ev[], uint16_t nb_events);
12724418919fSjohnjiang /**< @internal Enqueue burst of events on port of a device supporting
12734418919fSjohnjiang  * burst having same destination Ethernet port & Tx queue.
12744418919fSjohnjiang  */
12754418919fSjohnjiang 
12762bfe3f2eSlogwang #define RTE_EVENTDEV_NAME_MAX_LEN	(64)
12772bfe3f2eSlogwang /**< @internal Max length of name of event PMD */
12782bfe3f2eSlogwang 
12792bfe3f2eSlogwang /**
12802bfe3f2eSlogwang  * @internal
12812bfe3f2eSlogwang  * The data part, with no function pointers, associated with each device.
12822bfe3f2eSlogwang  *
12832bfe3f2eSlogwang  * This structure is safe to place in shared memory to be common among
12842bfe3f2eSlogwang  * different processes in a multi-process configuration.
12852bfe3f2eSlogwang  */
12862bfe3f2eSlogwang struct rte_eventdev_data {
12872bfe3f2eSlogwang 	int socket_id;
12882bfe3f2eSlogwang 	/**< Socket ID where memory is allocated */
12892bfe3f2eSlogwang 	uint8_t dev_id;
12902bfe3f2eSlogwang 	/**< Device ID for this instance */
12912bfe3f2eSlogwang 	uint8_t nb_queues;
12922bfe3f2eSlogwang 	/**< Number of event queues. */
12932bfe3f2eSlogwang 	uint8_t nb_ports;
12942bfe3f2eSlogwang 	/**< Number of event ports. */
12952bfe3f2eSlogwang 	void **ports;
12962bfe3f2eSlogwang 	/**< Array of pointers to ports. */
12972bfe3f2eSlogwang 	struct rte_event_port_conf *ports_cfg;
12982bfe3f2eSlogwang 	/**< Array of port configuration structures. */
12992bfe3f2eSlogwang 	struct rte_event_queue_conf *queues_cfg;
13002bfe3f2eSlogwang 	/**< Array of queue configuration structures. */
13012bfe3f2eSlogwang 	uint16_t *links_map;
13022bfe3f2eSlogwang 	/**< Memory to store queues to port connections. */
13032bfe3f2eSlogwang 	void *dev_private;
13042bfe3f2eSlogwang 	/**< PMD-specific private data */
13052bfe3f2eSlogwang 	uint32_t event_dev_cap;
13062bfe3f2eSlogwang 	/**< Event device capabilities(RTE_EVENT_DEV_CAP_)*/
13072bfe3f2eSlogwang 	struct rte_event_dev_config dev_conf;
13082bfe3f2eSlogwang 	/**< Configuration applied to device. */
13092bfe3f2eSlogwang 	uint8_t service_inited;
13102bfe3f2eSlogwang 	/* Service initialization state */
13112bfe3f2eSlogwang 	uint32_t service_id;
13122bfe3f2eSlogwang 	/* Service ID*/
1313d30ea906Sjfb8856606 	void *dev_stop_flush_arg;
1314d30ea906Sjfb8856606 	/**< User-provided argument for event flush function */
13152bfe3f2eSlogwang 
13162bfe3f2eSlogwang 	RTE_STD_C11
13172bfe3f2eSlogwang 	uint8_t dev_started : 1;
13182bfe3f2eSlogwang 	/**< Device state: STARTED(1)/STOPPED(0) */
13192bfe3f2eSlogwang 
13202bfe3f2eSlogwang 	char name[RTE_EVENTDEV_NAME_MAX_LEN];
13212bfe3f2eSlogwang 	/**< Unique identifier name */
13224418919fSjohnjiang 
13234418919fSjohnjiang 	uint64_t reserved_64s[4]; /**< Reserved for future fields */
13244418919fSjohnjiang 	void *reserved_ptrs[4];   /**< Reserved for future fields */
13252bfe3f2eSlogwang } __rte_cache_aligned;
13262bfe3f2eSlogwang 
13272bfe3f2eSlogwang /** @internal The data structure associated with each event device. */
13282bfe3f2eSlogwang struct rte_eventdev {
13292bfe3f2eSlogwang 	event_enqueue_t enqueue;
13302bfe3f2eSlogwang 	/**< Pointer to PMD enqueue function. */
13312bfe3f2eSlogwang 	event_enqueue_burst_t enqueue_burst;
13322bfe3f2eSlogwang 	/**< Pointer to PMD enqueue burst function. */
13332bfe3f2eSlogwang 	event_enqueue_burst_t enqueue_new_burst;
13342bfe3f2eSlogwang 	/**< Pointer to PMD enqueue burst function(op new variant) */
13352bfe3f2eSlogwang 	event_enqueue_burst_t enqueue_forward_burst;
13362bfe3f2eSlogwang 	/**< Pointer to PMD enqueue burst function(op forward variant) */
13372bfe3f2eSlogwang 	event_dequeue_t dequeue;
13382bfe3f2eSlogwang 	/**< Pointer to PMD dequeue function. */
13392bfe3f2eSlogwang 	event_dequeue_burst_t dequeue_burst;
13402bfe3f2eSlogwang 	/**< Pointer to PMD dequeue burst function. */
13414418919fSjohnjiang 	event_tx_adapter_enqueue_same_dest txa_enqueue_same_dest;
13424418919fSjohnjiang 	/**< Pointer to PMD eth Tx adapter burst enqueue function with
13434418919fSjohnjiang 	 * events destined to same Eth port & Tx queue.
13444418919fSjohnjiang 	 */
1345d30ea906Sjfb8856606 	event_tx_adapter_enqueue txa_enqueue;
1346d30ea906Sjfb8856606 	/**< Pointer to PMD eth Tx adapter enqueue function. */
13472bfe3f2eSlogwang 	struct rte_eventdev_data *data;
13482bfe3f2eSlogwang 	/**< Pointer to device data */
1349d30ea906Sjfb8856606 	struct rte_eventdev_ops *dev_ops;
13502bfe3f2eSlogwang 	/**< Functions exported by PMD */
13512bfe3f2eSlogwang 	struct rte_device *dev;
13522bfe3f2eSlogwang 	/**< Device info. supplied by probing */
13532bfe3f2eSlogwang 
13542bfe3f2eSlogwang 	RTE_STD_C11
13552bfe3f2eSlogwang 	uint8_t attached : 1;
13562bfe3f2eSlogwang 	/**< Flag indicating the device is attached */
13574418919fSjohnjiang 
13584418919fSjohnjiang 	uint64_t reserved_64s[4]; /**< Reserved for future fields */
13594418919fSjohnjiang 	void *reserved_ptrs[4];   /**< Reserved for future fields */
13602bfe3f2eSlogwang } __rte_cache_aligned;
13612bfe3f2eSlogwang 
13622bfe3f2eSlogwang extern struct rte_eventdev *rte_eventdevs;
13632bfe3f2eSlogwang /** @internal The pool of rte_eventdev structures. */
13642bfe3f2eSlogwang 
13652bfe3f2eSlogwang static __rte_always_inline uint16_t
__rte_event_enqueue_burst(uint8_t dev_id,uint8_t port_id,const struct rte_event ev[],uint16_t nb_events,const event_enqueue_burst_t fn)13662bfe3f2eSlogwang __rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id,
13672bfe3f2eSlogwang 			const struct rte_event ev[], uint16_t nb_events,
13682bfe3f2eSlogwang 			const event_enqueue_burst_t fn)
13692bfe3f2eSlogwang {
13702bfe3f2eSlogwang 	const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
13712bfe3f2eSlogwang 
13722bfe3f2eSlogwang #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
13732bfe3f2eSlogwang 	if (dev_id >= RTE_EVENT_MAX_DEVS || !rte_eventdevs[dev_id].attached) {
13744b05018fSfengbojiang 		rte_errno = EINVAL;
13752bfe3f2eSlogwang 		return 0;
13762bfe3f2eSlogwang 	}
13772bfe3f2eSlogwang 
13782bfe3f2eSlogwang 	if (port_id >= dev->data->nb_ports) {
13794b05018fSfengbojiang 		rte_errno = EINVAL;
13802bfe3f2eSlogwang 		return 0;
13812bfe3f2eSlogwang 	}
13822bfe3f2eSlogwang #endif
1383*2d9fd380Sjfb8856606 	rte_eventdev_trace_enq_burst(dev_id, port_id, ev, nb_events, fn);
13842bfe3f2eSlogwang 	/*
13852bfe3f2eSlogwang 	 * Allow zero cost non burst mode routine invocation if application
13862bfe3f2eSlogwang 	 * requests nb_events as const one
13872bfe3f2eSlogwang 	 */
13882bfe3f2eSlogwang 	if (nb_events == 1)
13892bfe3f2eSlogwang 		return (*dev->enqueue)(dev->data->ports[port_id], ev);
13902bfe3f2eSlogwang 	else
13912bfe3f2eSlogwang 		return fn(dev->data->ports[port_id], ev, nb_events);
13922bfe3f2eSlogwang }
13932bfe3f2eSlogwang 
13942bfe3f2eSlogwang /**
13952bfe3f2eSlogwang  * Enqueue a burst of events objects or an event object supplied in *rte_event*
13962bfe3f2eSlogwang  * structure on an  event device designated by its *dev_id* through the event
13972bfe3f2eSlogwang  * port specified by *port_id*. Each event object specifies the event queue on
13982bfe3f2eSlogwang  * which it will be enqueued.
13992bfe3f2eSlogwang  *
14002bfe3f2eSlogwang  * The *nb_events* parameter is the number of event objects to enqueue which are
14012bfe3f2eSlogwang  * supplied in the *ev* array of *rte_event* structure.
14022bfe3f2eSlogwang  *
14032bfe3f2eSlogwang  * Event operations RTE_EVENT_OP_FORWARD and RTE_EVENT_OP_RELEASE must only be
14042bfe3f2eSlogwang  * enqueued to the same port that their associated events were dequeued from.
14052bfe3f2eSlogwang  *
14062bfe3f2eSlogwang  * The rte_event_enqueue_burst() function returns the number of
14072bfe3f2eSlogwang  * events objects it actually enqueued. A return value equal to *nb_events*
14082bfe3f2eSlogwang  * means that all event objects have been enqueued.
14092bfe3f2eSlogwang  *
14102bfe3f2eSlogwang  * @param dev_id
14112bfe3f2eSlogwang  *   The identifier of the device.
14122bfe3f2eSlogwang  * @param port_id
14132bfe3f2eSlogwang  *   The identifier of the event port.
14142bfe3f2eSlogwang  * @param ev
14152bfe3f2eSlogwang  *   Points to an array of *nb_events* objects of type *rte_event* structure
14162bfe3f2eSlogwang  *   which contain the event object enqueue operations to be processed.
14172bfe3f2eSlogwang  * @param nb_events
14182bfe3f2eSlogwang  *   The number of event objects to enqueue, typically number of
14191646932aSjfb8856606  *   rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
14201646932aSjfb8856606  *   available for this port.
14212bfe3f2eSlogwang  *
14222bfe3f2eSlogwang  * @return
14232bfe3f2eSlogwang  *   The number of event objects actually enqueued on the event device. The
14242bfe3f2eSlogwang  *   return value can be less than the value of the *nb_events* parameter when
14252bfe3f2eSlogwang  *   the event devices queue is full or if invalid parameters are specified in a
14262bfe3f2eSlogwang  *   *rte_event*. If the return value is less than *nb_events*, the remaining
14272bfe3f2eSlogwang  *   events at the end of ev[] are not consumed and the caller has to take care
14282bfe3f2eSlogwang  *   of them, and rte_errno is set accordingly. Possible errno values include:
14294b05018fSfengbojiang  *   - EINVAL   The port ID is invalid, device ID is invalid, an event's queue
14302bfe3f2eSlogwang  *              ID is invalid, or an event's sched type doesn't match the
14312bfe3f2eSlogwang  *              capabilities of the destination queue.
14324b05018fSfengbojiang  *   - ENOSPC   The event port was backpressured and unable to enqueue
14332bfe3f2eSlogwang  *              one or more events. This error code is only applicable to
14342bfe3f2eSlogwang  *              closed systems.
14351646932aSjfb8856606  * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH
14362bfe3f2eSlogwang  */
14372bfe3f2eSlogwang static inline uint16_t
rte_event_enqueue_burst(uint8_t dev_id,uint8_t port_id,const struct rte_event ev[],uint16_t nb_events)14382bfe3f2eSlogwang rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id,
14392bfe3f2eSlogwang 			const struct rte_event ev[], uint16_t nb_events)
14402bfe3f2eSlogwang {
14412bfe3f2eSlogwang 	const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
14422bfe3f2eSlogwang 
14432bfe3f2eSlogwang 	return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
14442bfe3f2eSlogwang 			dev->enqueue_burst);
14452bfe3f2eSlogwang }
14462bfe3f2eSlogwang 
14472bfe3f2eSlogwang /**
14482bfe3f2eSlogwang  * Enqueue a burst of events objects of operation type *RTE_EVENT_OP_NEW* on
14492bfe3f2eSlogwang  * an event device designated by its *dev_id* through the event port specified
14502bfe3f2eSlogwang  * by *port_id*.
14512bfe3f2eSlogwang  *
14522bfe3f2eSlogwang  * Provides the same functionality as rte_event_enqueue_burst(), expect that
14532bfe3f2eSlogwang  * application can use this API when the all objects in the burst contains
14542bfe3f2eSlogwang  * the enqueue operation of the type *RTE_EVENT_OP_NEW*. This specialized
14552bfe3f2eSlogwang  * function can provide the additional hint to the PMD and optimize if possible.
14562bfe3f2eSlogwang  *
14572bfe3f2eSlogwang  * The rte_event_enqueue_new_burst() result is undefined if the enqueue burst
14582bfe3f2eSlogwang  * has event object of operation type != RTE_EVENT_OP_NEW.
14592bfe3f2eSlogwang  *
14602bfe3f2eSlogwang  * @param dev_id
14612bfe3f2eSlogwang  *   The identifier of the device.
14622bfe3f2eSlogwang  * @param port_id
14632bfe3f2eSlogwang  *   The identifier of the event port.
14642bfe3f2eSlogwang  * @param ev
14652bfe3f2eSlogwang  *   Points to an array of *nb_events* objects of type *rte_event* structure
14662bfe3f2eSlogwang  *   which contain the event object enqueue operations to be processed.
14672bfe3f2eSlogwang  * @param nb_events
14682bfe3f2eSlogwang  *   The number of event objects to enqueue, typically number of
14691646932aSjfb8856606  *   rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
14701646932aSjfb8856606  *   available for this port.
14712bfe3f2eSlogwang  *
14722bfe3f2eSlogwang  * @return
14732bfe3f2eSlogwang  *   The number of event objects actually enqueued on the event device. The
14742bfe3f2eSlogwang  *   return value can be less than the value of the *nb_events* parameter when
14752bfe3f2eSlogwang  *   the event devices queue is full or if invalid parameters are specified in a
14762bfe3f2eSlogwang  *   *rte_event*. If the return value is less than *nb_events*, the remaining
14772bfe3f2eSlogwang  *   events at the end of ev[] are not consumed and the caller has to take care
14782bfe3f2eSlogwang  *   of them, and rte_errno is set accordingly. Possible errno values include:
14794b05018fSfengbojiang  *   - EINVAL   The port ID is invalid, device ID is invalid, an event's queue
14802bfe3f2eSlogwang  *              ID is invalid, or an event's sched type doesn't match the
14812bfe3f2eSlogwang  *              capabilities of the destination queue.
14824b05018fSfengbojiang  *   - ENOSPC   The event port was backpressured and unable to enqueue
14832bfe3f2eSlogwang  *              one or more events. This error code is only applicable to
14842bfe3f2eSlogwang  *              closed systems.
14851646932aSjfb8856606  * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH
14861646932aSjfb8856606  * @see rte_event_enqueue_burst()
14872bfe3f2eSlogwang  */
14882bfe3f2eSlogwang static inline uint16_t
rte_event_enqueue_new_burst(uint8_t dev_id,uint8_t port_id,const struct rte_event ev[],uint16_t nb_events)14892bfe3f2eSlogwang rte_event_enqueue_new_burst(uint8_t dev_id, uint8_t port_id,
14902bfe3f2eSlogwang 			const struct rte_event ev[], uint16_t nb_events)
14912bfe3f2eSlogwang {
14922bfe3f2eSlogwang 	const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
14932bfe3f2eSlogwang 
14942bfe3f2eSlogwang 	return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
14952bfe3f2eSlogwang 			dev->enqueue_new_burst);
14962bfe3f2eSlogwang }
14972bfe3f2eSlogwang 
14982bfe3f2eSlogwang /**
14992bfe3f2eSlogwang  * Enqueue a burst of events objects of operation type *RTE_EVENT_OP_FORWARD*
15002bfe3f2eSlogwang  * on an event device designated by its *dev_id* through the event port
15012bfe3f2eSlogwang  * specified by *port_id*.
15022bfe3f2eSlogwang  *
15032bfe3f2eSlogwang  * Provides the same functionality as rte_event_enqueue_burst(), expect that
15042bfe3f2eSlogwang  * application can use this API when the all objects in the burst contains
15052bfe3f2eSlogwang  * the enqueue operation of the type *RTE_EVENT_OP_FORWARD*. This specialized
15062bfe3f2eSlogwang  * function can provide the additional hint to the PMD and optimize if possible.
15072bfe3f2eSlogwang  *
15082bfe3f2eSlogwang  * The rte_event_enqueue_new_burst() result is undefined if the enqueue burst
15092bfe3f2eSlogwang  * has event object of operation type != RTE_EVENT_OP_FORWARD.
15102bfe3f2eSlogwang  *
15112bfe3f2eSlogwang  * @param dev_id
15122bfe3f2eSlogwang  *   The identifier of the device.
15132bfe3f2eSlogwang  * @param port_id
15142bfe3f2eSlogwang  *   The identifier of the event port.
15152bfe3f2eSlogwang  * @param ev
15162bfe3f2eSlogwang  *   Points to an array of *nb_events* objects of type *rte_event* structure
15172bfe3f2eSlogwang  *   which contain the event object enqueue operations to be processed.
15182bfe3f2eSlogwang  * @param nb_events
15192bfe3f2eSlogwang  *   The number of event objects to enqueue, typically number of
15201646932aSjfb8856606  *   rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
15211646932aSjfb8856606  *   available for this port.
15222bfe3f2eSlogwang  *
15232bfe3f2eSlogwang  * @return
15242bfe3f2eSlogwang  *   The number of event objects actually enqueued on the event device. The
15252bfe3f2eSlogwang  *   return value can be less than the value of the *nb_events* parameter when
15262bfe3f2eSlogwang  *   the event devices queue is full or if invalid parameters are specified in a
15272bfe3f2eSlogwang  *   *rte_event*. If the return value is less than *nb_events*, the remaining
15282bfe3f2eSlogwang  *   events at the end of ev[] are not consumed and the caller has to take care
15292bfe3f2eSlogwang  *   of them, and rte_errno is set accordingly. Possible errno values include:
15304b05018fSfengbojiang  *   - EINVAL   The port ID is invalid, device ID is invalid, an event's queue
15312bfe3f2eSlogwang  *              ID is invalid, or an event's sched type doesn't match the
15322bfe3f2eSlogwang  *              capabilities of the destination queue.
15334b05018fSfengbojiang  *   - ENOSPC   The event port was backpressured and unable to enqueue
15342bfe3f2eSlogwang  *              one or more events. This error code is only applicable to
15352bfe3f2eSlogwang  *              closed systems.
15361646932aSjfb8856606  * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH
15371646932aSjfb8856606  * @see rte_event_enqueue_burst()
15382bfe3f2eSlogwang  */
15392bfe3f2eSlogwang static inline uint16_t
rte_event_enqueue_forward_burst(uint8_t dev_id,uint8_t port_id,const struct rte_event ev[],uint16_t nb_events)15402bfe3f2eSlogwang rte_event_enqueue_forward_burst(uint8_t dev_id, uint8_t port_id,
15412bfe3f2eSlogwang 			const struct rte_event ev[], uint16_t nb_events)
15422bfe3f2eSlogwang {
15432bfe3f2eSlogwang 	const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
15442bfe3f2eSlogwang 
15452bfe3f2eSlogwang 	return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
15462bfe3f2eSlogwang 			dev->enqueue_forward_burst);
15472bfe3f2eSlogwang }
15482bfe3f2eSlogwang 
15492bfe3f2eSlogwang /**
15502bfe3f2eSlogwang  * Converts nanoseconds to *timeout_ticks* value for rte_event_dequeue_burst()
15512bfe3f2eSlogwang  *
15522bfe3f2eSlogwang  * If the device is configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT flag
15532bfe3f2eSlogwang  * then application can use this function to convert timeout value in
15542bfe3f2eSlogwang  * nanoseconds to implementations specific timeout value supplied in
15552bfe3f2eSlogwang  * rte_event_dequeue_burst()
15562bfe3f2eSlogwang  *
15572bfe3f2eSlogwang  * @param dev_id
15582bfe3f2eSlogwang  *   The identifier of the device.
15592bfe3f2eSlogwang  * @param ns
15602bfe3f2eSlogwang  *   Wait time in nanosecond
15612bfe3f2eSlogwang  * @param[out] timeout_ticks
15622bfe3f2eSlogwang  *   Value for the *timeout_ticks* parameter in rte_event_dequeue_burst()
15632bfe3f2eSlogwang  *
15642bfe3f2eSlogwang  * @return
15652bfe3f2eSlogwang  *  - 0 on success.
15662bfe3f2eSlogwang  *  - -ENOTSUP if the device doesn't support timeouts
15672bfe3f2eSlogwang  *  - -EINVAL if *dev_id* is invalid or *timeout_ticks* is NULL
15682bfe3f2eSlogwang  *  - other values < 0 on failure.
15692bfe3f2eSlogwang  *
15702bfe3f2eSlogwang  * @see rte_event_dequeue_burst(), RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT
15712bfe3f2eSlogwang  * @see rte_event_dev_configure()
15722bfe3f2eSlogwang  *
15732bfe3f2eSlogwang  */
15742bfe3f2eSlogwang int
15752bfe3f2eSlogwang rte_event_dequeue_timeout_ticks(uint8_t dev_id, uint64_t ns,
15762bfe3f2eSlogwang 					uint64_t *timeout_ticks);
15772bfe3f2eSlogwang 
15782bfe3f2eSlogwang /**
15792bfe3f2eSlogwang  * Dequeue a burst of events objects or an event object from the event port
15802bfe3f2eSlogwang  * designated by its *event_port_id*, on an event device designated
15812bfe3f2eSlogwang  * by its *dev_id*.
15822bfe3f2eSlogwang  *
15832bfe3f2eSlogwang  * rte_event_dequeue_burst() does not dictate the specifics of scheduling
15842bfe3f2eSlogwang  * algorithm as each eventdev driver may have different criteria to schedule
15852bfe3f2eSlogwang  * an event. However, in general, from an application perspective scheduler may
15862bfe3f2eSlogwang  * use the following scheme to dispatch an event to the port.
15872bfe3f2eSlogwang  *
15882bfe3f2eSlogwang  * 1) Selection of event queue based on
15892bfe3f2eSlogwang  *   a) The list of event queues are linked to the event port.
15902bfe3f2eSlogwang  *   b) If the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability then event
15912bfe3f2eSlogwang  *   queue selection from list is based on event queue priority relative to
15922bfe3f2eSlogwang  *   other event queue supplied as *priority* in rte_event_queue_setup()
15932bfe3f2eSlogwang  *   c) If the device has RTE_EVENT_DEV_CAP_EVENT_QOS capability then event
15942bfe3f2eSlogwang  *   queue selection from the list is based on event priority supplied as
15952bfe3f2eSlogwang  *   *priority* in rte_event_enqueue_burst()
15962bfe3f2eSlogwang  * 2) Selection of event
15972bfe3f2eSlogwang  *   a) The number of flows available in selected event queue.
15982bfe3f2eSlogwang  *   b) Schedule type method associated with the event
15992bfe3f2eSlogwang  *
16002bfe3f2eSlogwang  * The *nb_events* parameter is the maximum number of event objects to dequeue
16012bfe3f2eSlogwang  * which are returned in the *ev* array of *rte_event* structure.
16022bfe3f2eSlogwang  *
16032bfe3f2eSlogwang  * The rte_event_dequeue_burst() function returns the number of events objects
16042bfe3f2eSlogwang  * it actually dequeued. A return value equal to *nb_events* means that all
16052bfe3f2eSlogwang  * event objects have been dequeued.
16062bfe3f2eSlogwang  *
16072bfe3f2eSlogwang  * The number of events dequeued is the number of scheduler contexts held by
16082bfe3f2eSlogwang  * this port. These contexts are automatically released in the next
1609d30ea906Sjfb8856606  * rte_event_dequeue_burst() invocation if the port supports implicit
1610d30ea906Sjfb8856606  * releases, or invoking rte_event_enqueue_burst() with RTE_EVENT_OP_RELEASE
1611d30ea906Sjfb8856606  * operation can be used to release the contexts early.
16122bfe3f2eSlogwang  *
16132bfe3f2eSlogwang  * Event operations RTE_EVENT_OP_FORWARD and RTE_EVENT_OP_RELEASE must only be
16142bfe3f2eSlogwang  * enqueued to the same port that their associated events were dequeued from.
16152bfe3f2eSlogwang  *
16162bfe3f2eSlogwang  * @param dev_id
16172bfe3f2eSlogwang  *   The identifier of the device.
16182bfe3f2eSlogwang  * @param port_id
16192bfe3f2eSlogwang  *   The identifier of the event port.
16202bfe3f2eSlogwang  * @param[out] ev
16212bfe3f2eSlogwang  *   Points to an array of *nb_events* objects of type *rte_event* structure
16222bfe3f2eSlogwang  *   for output to be populated with the dequeued event objects.
16232bfe3f2eSlogwang  * @param nb_events
16242bfe3f2eSlogwang  *   The maximum number of event objects to dequeue, typically number of
16252bfe3f2eSlogwang  *   rte_event_port_dequeue_depth() available for this port.
16262bfe3f2eSlogwang  *
16272bfe3f2eSlogwang  * @param timeout_ticks
16282bfe3f2eSlogwang  *   - 0 no-wait, returns immediately if there is no event.
16292bfe3f2eSlogwang  *   - >0 wait for the event, if the device is configured with
16302bfe3f2eSlogwang  *   RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT then this function will wait until
16312bfe3f2eSlogwang  *   at least one event is available or *timeout_ticks* time.
16322bfe3f2eSlogwang  *   if the device is not configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT
16332bfe3f2eSlogwang  *   then this function will wait until the event available or
16342bfe3f2eSlogwang  *   *dequeue_timeout_ns* ns which was previously supplied to
16352bfe3f2eSlogwang  *   rte_event_dev_configure()
16362bfe3f2eSlogwang  *
16372bfe3f2eSlogwang  * @return
16382bfe3f2eSlogwang  * The number of event objects actually dequeued from the port. The return
16392bfe3f2eSlogwang  * value can be less than the value of the *nb_events* parameter when the
16402bfe3f2eSlogwang  * event port's queue is not full.
16412bfe3f2eSlogwang  *
16422bfe3f2eSlogwang  * @see rte_event_port_dequeue_depth()
16432bfe3f2eSlogwang  */
16442bfe3f2eSlogwang static inline uint16_t
rte_event_dequeue_burst(uint8_t dev_id,uint8_t port_id,struct rte_event ev[],uint16_t nb_events,uint64_t timeout_ticks)16452bfe3f2eSlogwang rte_event_dequeue_burst(uint8_t dev_id, uint8_t port_id, struct rte_event ev[],
16462bfe3f2eSlogwang 			uint16_t nb_events, uint64_t timeout_ticks)
16472bfe3f2eSlogwang {
16482bfe3f2eSlogwang 	struct rte_eventdev *dev = &rte_eventdevs[dev_id];
16492bfe3f2eSlogwang 
16502bfe3f2eSlogwang #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
16512bfe3f2eSlogwang 	if (dev_id >= RTE_EVENT_MAX_DEVS || !rte_eventdevs[dev_id].attached) {
16524b05018fSfengbojiang 		rte_errno = EINVAL;
16532bfe3f2eSlogwang 		return 0;
16542bfe3f2eSlogwang 	}
16552bfe3f2eSlogwang 
16562bfe3f2eSlogwang 	if (port_id >= dev->data->nb_ports) {
16574b05018fSfengbojiang 		rte_errno = EINVAL;
16582bfe3f2eSlogwang 		return 0;
16592bfe3f2eSlogwang 	}
16602bfe3f2eSlogwang #endif
1661*2d9fd380Sjfb8856606 	rte_eventdev_trace_deq_burst(dev_id, port_id, ev, nb_events);
16622bfe3f2eSlogwang 	/*
16632bfe3f2eSlogwang 	 * Allow zero cost non burst mode routine invocation if application
16642bfe3f2eSlogwang 	 * requests nb_events as const one
16652bfe3f2eSlogwang 	 */
16662bfe3f2eSlogwang 	if (nb_events == 1)
16672bfe3f2eSlogwang 		return (*dev->dequeue)(
16682bfe3f2eSlogwang 			dev->data->ports[port_id], ev, timeout_ticks);
16692bfe3f2eSlogwang 	else
16702bfe3f2eSlogwang 		return (*dev->dequeue_burst)(
16712bfe3f2eSlogwang 			dev->data->ports[port_id], ev, nb_events,
16722bfe3f2eSlogwang 				timeout_ticks);
16732bfe3f2eSlogwang }
16742bfe3f2eSlogwang 
16752bfe3f2eSlogwang /**
16762bfe3f2eSlogwang  * Link multiple source event queues supplied in *queues* to the destination
16772bfe3f2eSlogwang  * event port designated by its *port_id* with associated service priority
16782bfe3f2eSlogwang  * supplied in *priorities* on the event device designated by its *dev_id*.
16792bfe3f2eSlogwang  *
16802bfe3f2eSlogwang  * The link establishment shall enable the event port *port_id* from
16812bfe3f2eSlogwang  * receiving events from the specified event queue(s) supplied in *queues*
16822bfe3f2eSlogwang  *
16832bfe3f2eSlogwang  * An event queue may link to one or more event ports.
16842bfe3f2eSlogwang  * The number of links can be established from an event queue to event port is
16852bfe3f2eSlogwang  * implementation defined.
16862bfe3f2eSlogwang  *
16872bfe3f2eSlogwang  * Event queue(s) to event port link establishment can be changed at runtime
16882bfe3f2eSlogwang  * without re-configuring the device to support scaling and to reduce the
16892bfe3f2eSlogwang  * latency of critical work by establishing the link with more event ports
16902bfe3f2eSlogwang  * at runtime.
16912bfe3f2eSlogwang  *
16922bfe3f2eSlogwang  * @param dev_id
16932bfe3f2eSlogwang  *   The identifier of the device.
16942bfe3f2eSlogwang  *
16952bfe3f2eSlogwang  * @param port_id
16962bfe3f2eSlogwang  *   Event port identifier to select the destination port to link.
16972bfe3f2eSlogwang  *
16982bfe3f2eSlogwang  * @param queues
16992bfe3f2eSlogwang  *   Points to an array of *nb_links* event queues to be linked
17002bfe3f2eSlogwang  *   to the event port.
17012bfe3f2eSlogwang  *   NULL value is allowed, in which case this function links all the configured
17022bfe3f2eSlogwang  *   event queues *nb_event_queues* which previously supplied to
17032bfe3f2eSlogwang  *   rte_event_dev_configure() to the event port *port_id*
17042bfe3f2eSlogwang  *
17052bfe3f2eSlogwang  * @param priorities
17062bfe3f2eSlogwang  *   Points to an array of *nb_links* service priorities associated with each
17072bfe3f2eSlogwang  *   event queue link to event port.
17082bfe3f2eSlogwang  *   The priority defines the event port's servicing priority for
17092bfe3f2eSlogwang  *   event queue, which may be ignored by an implementation.
17102bfe3f2eSlogwang  *   The requested priority should in the range of
17112bfe3f2eSlogwang  *   [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST].
17122bfe3f2eSlogwang  *   The implementation shall normalize the requested priority to
17132bfe3f2eSlogwang  *   implementation supported priority value.
17142bfe3f2eSlogwang  *   NULL value is allowed, in which case this function links the event queues
17152bfe3f2eSlogwang  *   with RTE_EVENT_DEV_PRIORITY_NORMAL servicing priority
17162bfe3f2eSlogwang  *
17172bfe3f2eSlogwang  * @param nb_links
17182bfe3f2eSlogwang  *   The number of links to establish. This parameter is ignored if queues is
17192bfe3f2eSlogwang  *   NULL.
17202bfe3f2eSlogwang  *
17212bfe3f2eSlogwang  * @return
17222bfe3f2eSlogwang  * The number of links actually established. The return value can be less than
17232bfe3f2eSlogwang  * the value of the *nb_links* parameter when the implementation has the
17242bfe3f2eSlogwang  * limitation on specific queue to port link establishment or if invalid
17252bfe3f2eSlogwang  * parameters are specified in *queues*
17262bfe3f2eSlogwang  * If the return value is less than *nb_links*, the remaining links at the end
17272bfe3f2eSlogwang  * of link[] are not established, and the caller has to take care of them.
17282bfe3f2eSlogwang  * If return value is less than *nb_links* then implementation shall update the
17292bfe3f2eSlogwang  * rte_errno accordingly, Possible rte_errno values are
17304b05018fSfengbojiang  * (EDQUOT) Quota exceeded(Application tried to link the queue configured with
17312bfe3f2eSlogwang  *  RTE_EVENT_QUEUE_CFG_SINGLE_LINK to more than one event ports)
17324b05018fSfengbojiang  * (EINVAL) Invalid parameter
17332bfe3f2eSlogwang  *
17342bfe3f2eSlogwang  */
17352bfe3f2eSlogwang int
17362bfe3f2eSlogwang rte_event_port_link(uint8_t dev_id, uint8_t port_id,
17372bfe3f2eSlogwang 		    const uint8_t queues[], const uint8_t priorities[],
17382bfe3f2eSlogwang 		    uint16_t nb_links);
17392bfe3f2eSlogwang 
17402bfe3f2eSlogwang /**
17412bfe3f2eSlogwang  * Unlink multiple source event queues supplied in *queues* from the destination
17422bfe3f2eSlogwang  * event port designated by its *port_id* on the event device designated
17432bfe3f2eSlogwang  * by its *dev_id*.
17442bfe3f2eSlogwang  *
1745d30ea906Sjfb8856606  * The unlink call issues an async request to disable the event port *port_id*
1746d30ea906Sjfb8856606  * from receiving events from the specified event queue *queue_id*.
17472bfe3f2eSlogwang  * Event queue(s) to event port unlink establishment can be changed at runtime
17482bfe3f2eSlogwang  * without re-configuring the device.
17492bfe3f2eSlogwang  *
1750d30ea906Sjfb8856606  * @see rte_event_port_unlinks_in_progress() to poll for completed unlinks.
1751d30ea906Sjfb8856606  *
17522bfe3f2eSlogwang  * @param dev_id
17532bfe3f2eSlogwang  *   The identifier of the device.
17542bfe3f2eSlogwang  *
17552bfe3f2eSlogwang  * @param port_id
17562bfe3f2eSlogwang  *   Event port identifier to select the destination port to unlink.
17572bfe3f2eSlogwang  *
17582bfe3f2eSlogwang  * @param queues
17592bfe3f2eSlogwang  *   Points to an array of *nb_unlinks* event queues to be unlinked
17602bfe3f2eSlogwang  *   from the event port.
17612bfe3f2eSlogwang  *   NULL value is allowed, in which case this function unlinks all the
17622bfe3f2eSlogwang  *   event queue(s) from the event port *port_id*.
17632bfe3f2eSlogwang  *
17642bfe3f2eSlogwang  * @param nb_unlinks
17652bfe3f2eSlogwang  *   The number of unlinks to establish. This parameter is ignored if queues is
17662bfe3f2eSlogwang  *   NULL.
17672bfe3f2eSlogwang  *
17682bfe3f2eSlogwang  * @return
1769d30ea906Sjfb8856606  * The number of unlinks successfully requested. The return value can be less
17702bfe3f2eSlogwang  * than the value of the *nb_unlinks* parameter when the implementation has the
17712bfe3f2eSlogwang  * limitation on specific queue to port unlink establishment or
17722bfe3f2eSlogwang  * if invalid parameters are specified.
17732bfe3f2eSlogwang  * If the return value is less than *nb_unlinks*, the remaining queues at the
1774d30ea906Sjfb8856606  * end of queues[] are not unlinked, and the caller has to take care of them.
17752bfe3f2eSlogwang  * If return value is less than *nb_unlinks* then implementation shall update
17762bfe3f2eSlogwang  * the rte_errno accordingly, Possible rte_errno values are
17774b05018fSfengbojiang  * (EINVAL) Invalid parameter
17782bfe3f2eSlogwang  */
17792bfe3f2eSlogwang int
17802bfe3f2eSlogwang rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
17812bfe3f2eSlogwang 		      uint8_t queues[], uint16_t nb_unlinks);
17822bfe3f2eSlogwang 
17832bfe3f2eSlogwang /**
1784d30ea906Sjfb8856606  * Returns the number of unlinks in progress.
1785d30ea906Sjfb8856606  *
1786d30ea906Sjfb8856606  * This function provides the application with a method to detect when an
1787d30ea906Sjfb8856606  * unlink has been completed by the implementation.
1788d30ea906Sjfb8856606  *
1789d30ea906Sjfb8856606  * @see rte_event_port_unlink() to issue unlink requests.
1790d30ea906Sjfb8856606  *
1791d30ea906Sjfb8856606  * @param dev_id
17921646932aSjfb8856606  *   The identifier of the device.
1793d30ea906Sjfb8856606  *
1794d30ea906Sjfb8856606  * @param port_id
1795d30ea906Sjfb8856606  *   Event port identifier to select port to check for unlinks in progress.
1796d30ea906Sjfb8856606  *
1797d30ea906Sjfb8856606  * @return
1798d30ea906Sjfb8856606  * The number of unlinks that are in progress. A return of zero indicates that
1799d30ea906Sjfb8856606  * there are no outstanding unlink requests. A positive return value indicates
1800d30ea906Sjfb8856606  * the number of unlinks that are in progress, but are not yet complete.
1801d30ea906Sjfb8856606  * A negative return value indicates an error, -EINVAL indicates an invalid
1802d30ea906Sjfb8856606  * parameter passed for *dev_id* or *port_id*.
1803d30ea906Sjfb8856606  */
18044418919fSjohnjiang int
1805d30ea906Sjfb8856606 rte_event_port_unlinks_in_progress(uint8_t dev_id, uint8_t port_id);
1806d30ea906Sjfb8856606 
1807d30ea906Sjfb8856606 /**
18082bfe3f2eSlogwang  * Retrieve the list of source event queues and its associated service priority
18092bfe3f2eSlogwang  * linked to the destination event port designated by its *port_id*
18102bfe3f2eSlogwang  * on the event device designated by its *dev_id*.
18112bfe3f2eSlogwang  *
18122bfe3f2eSlogwang  * @param dev_id
18132bfe3f2eSlogwang  *   The identifier of the device.
18142bfe3f2eSlogwang  *
18152bfe3f2eSlogwang  * @param port_id
18162bfe3f2eSlogwang  *   Event port identifier.
18172bfe3f2eSlogwang  *
18182bfe3f2eSlogwang  * @param[out] queues
18192bfe3f2eSlogwang  *   Points to an array of *queues* for output.
18202bfe3f2eSlogwang  *   The caller has to allocate *RTE_EVENT_MAX_QUEUES_PER_DEV* bytes to
18212bfe3f2eSlogwang  *   store the event queue(s) linked with event port *port_id*
18222bfe3f2eSlogwang  *
18232bfe3f2eSlogwang  * @param[out] priorities
18242bfe3f2eSlogwang  *   Points to an array of *priorities* for output.
18252bfe3f2eSlogwang  *   The caller has to allocate *RTE_EVENT_MAX_QUEUES_PER_DEV* bytes to
18262bfe3f2eSlogwang  *   store the service priority associated with each event queue linked
18272bfe3f2eSlogwang  *
18282bfe3f2eSlogwang  * @return
18292bfe3f2eSlogwang  * The number of links established on the event port designated by its
18302bfe3f2eSlogwang  *  *port_id*.
18312bfe3f2eSlogwang  * - <0 on failure.
18322bfe3f2eSlogwang  *
18332bfe3f2eSlogwang  */
18342bfe3f2eSlogwang int
18352bfe3f2eSlogwang rte_event_port_links_get(uint8_t dev_id, uint8_t port_id,
18362bfe3f2eSlogwang 			 uint8_t queues[], uint8_t priorities[]);
18372bfe3f2eSlogwang 
18382bfe3f2eSlogwang /**
18392bfe3f2eSlogwang  * Retrieve the service ID of the event dev. If the adapter doesn't use
18402bfe3f2eSlogwang  * a rte_service function, this function returns -ESRCH.
18412bfe3f2eSlogwang  *
18422bfe3f2eSlogwang  * @param dev_id
18432bfe3f2eSlogwang  *   The identifier of the device.
18442bfe3f2eSlogwang  *
18452bfe3f2eSlogwang  * @param [out] service_id
18462bfe3f2eSlogwang  *   A pointer to a uint32_t, to be filled in with the service id.
18472bfe3f2eSlogwang  *
18482bfe3f2eSlogwang  * @return
18492bfe3f2eSlogwang  *   - 0: Success
18502bfe3f2eSlogwang  *   - <0: Error code on failure, if the event dev doesn't use a rte_service
18512bfe3f2eSlogwang  *   function, this function returns -ESRCH.
18522bfe3f2eSlogwang  */
18532bfe3f2eSlogwang int
18542bfe3f2eSlogwang rte_event_dev_service_id_get(uint8_t dev_id, uint32_t *service_id);
18552bfe3f2eSlogwang 
18562bfe3f2eSlogwang /**
18572bfe3f2eSlogwang  * Dump internal information about *dev_id* to the FILE* provided in *f*.
18582bfe3f2eSlogwang  *
18592bfe3f2eSlogwang  * @param dev_id
18602bfe3f2eSlogwang  *   The identifier of the device.
18612bfe3f2eSlogwang  *
18622bfe3f2eSlogwang  * @param f
18632bfe3f2eSlogwang  *   A pointer to a file for output
18642bfe3f2eSlogwang  *
18652bfe3f2eSlogwang  * @return
18662bfe3f2eSlogwang  *   - 0: on success
18672bfe3f2eSlogwang  *   - <0: on failure.
18682bfe3f2eSlogwang  */
18692bfe3f2eSlogwang int
18702bfe3f2eSlogwang rte_event_dev_dump(uint8_t dev_id, FILE *f);
18712bfe3f2eSlogwang 
18722bfe3f2eSlogwang /** Maximum name length for extended statistics counters */
18732bfe3f2eSlogwang #define RTE_EVENT_DEV_XSTATS_NAME_SIZE 64
18742bfe3f2eSlogwang 
18752bfe3f2eSlogwang /**
18762bfe3f2eSlogwang  * Selects the component of the eventdev to retrieve statistics from.
18772bfe3f2eSlogwang  */
18782bfe3f2eSlogwang enum rte_event_dev_xstats_mode {
18792bfe3f2eSlogwang 	RTE_EVENT_DEV_XSTATS_DEVICE,
18802bfe3f2eSlogwang 	RTE_EVENT_DEV_XSTATS_PORT,
18812bfe3f2eSlogwang 	RTE_EVENT_DEV_XSTATS_QUEUE,
18822bfe3f2eSlogwang };
18832bfe3f2eSlogwang 
18842bfe3f2eSlogwang /**
18852bfe3f2eSlogwang  * A name-key lookup element for extended statistics.
18862bfe3f2eSlogwang  *
18872bfe3f2eSlogwang  * This structure is used to map between names and ID numbers
18882bfe3f2eSlogwang  * for extended ethdev statistics.
18892bfe3f2eSlogwang  */
18902bfe3f2eSlogwang struct rte_event_dev_xstats_name {
18912bfe3f2eSlogwang 	char name[RTE_EVENT_DEV_XSTATS_NAME_SIZE];
18922bfe3f2eSlogwang };
18932bfe3f2eSlogwang 
18942bfe3f2eSlogwang /**
18952bfe3f2eSlogwang  * Retrieve names of extended statistics of an event device.
18962bfe3f2eSlogwang  *
18972bfe3f2eSlogwang  * @param dev_id
18982bfe3f2eSlogwang  *   The identifier of the event device.
18992bfe3f2eSlogwang  * @param mode
19002bfe3f2eSlogwang  *   The mode of statistics to retrieve. Choices include the device statistics,
19012bfe3f2eSlogwang  *   port statistics or queue statistics.
19022bfe3f2eSlogwang  * @param queue_port_id
19032bfe3f2eSlogwang  *   Used to specify the port or queue number in queue or port mode, and is
19042bfe3f2eSlogwang  *   ignored in device mode.
19052bfe3f2eSlogwang  * @param[out] xstats_names
19062bfe3f2eSlogwang  *   Block of memory to insert names into. Must be at least size in capacity.
19072bfe3f2eSlogwang  *   If set to NULL, function returns required capacity.
19082bfe3f2eSlogwang  * @param[out] ids
19092bfe3f2eSlogwang  *   Block of memory to insert ids into. Must be at least size in capacity.
19102bfe3f2eSlogwang  *   If set to NULL, function returns required capacity. The id values returned
19112bfe3f2eSlogwang  *   can be passed to *rte_event_dev_xstats_get* to select statistics.
19122bfe3f2eSlogwang  * @param size
19132bfe3f2eSlogwang  *   Capacity of xstats_names (number of names).
19142bfe3f2eSlogwang  * @return
19152bfe3f2eSlogwang  *   - positive value lower or equal to size: success. The return value
19162bfe3f2eSlogwang  *     is the number of entries filled in the stats table.
19172bfe3f2eSlogwang  *   - positive value higher than size: error, the given statistics table
19182bfe3f2eSlogwang  *     is too small. The return value corresponds to the size that should
19192bfe3f2eSlogwang  *     be given to succeed. The entries in the table are not valid and
19202bfe3f2eSlogwang  *     shall not be used by the caller.
19212bfe3f2eSlogwang  *   - negative value on error:
19222bfe3f2eSlogwang  *        -ENODEV for invalid *dev_id*
19232bfe3f2eSlogwang  *        -EINVAL for invalid mode, queue port or id parameters
19242bfe3f2eSlogwang  *        -ENOTSUP if the device doesn't support this function.
19252bfe3f2eSlogwang  */
19262bfe3f2eSlogwang int
19272bfe3f2eSlogwang rte_event_dev_xstats_names_get(uint8_t dev_id,
19282bfe3f2eSlogwang 			       enum rte_event_dev_xstats_mode mode,
19292bfe3f2eSlogwang 			       uint8_t queue_port_id,
19302bfe3f2eSlogwang 			       struct rte_event_dev_xstats_name *xstats_names,
19312bfe3f2eSlogwang 			       unsigned int *ids,
19322bfe3f2eSlogwang 			       unsigned int size);
19332bfe3f2eSlogwang 
19342bfe3f2eSlogwang /**
19352bfe3f2eSlogwang  * Retrieve extended statistics of an event device.
19362bfe3f2eSlogwang  *
19372bfe3f2eSlogwang  * @param dev_id
19382bfe3f2eSlogwang  *   The identifier of the device.
19392bfe3f2eSlogwang  * @param mode
19402bfe3f2eSlogwang  *  The mode of statistics to retrieve. Choices include the device statistics,
19412bfe3f2eSlogwang  *  port statistics or queue statistics.
19422bfe3f2eSlogwang  * @param queue_port_id
19432bfe3f2eSlogwang  *   Used to specify the port or queue number in queue or port mode, and is
19442bfe3f2eSlogwang  *   ignored in device mode.
19452bfe3f2eSlogwang  * @param ids
19462bfe3f2eSlogwang  *   The id numbers of the stats to get. The ids can be got from the stat
19472bfe3f2eSlogwang  *   position in the stat list from rte_event_dev_get_xstats_names(), or
19481646932aSjfb8856606  *   by using rte_event_dev_xstats_by_name_get().
19492bfe3f2eSlogwang  * @param[out] values
19502bfe3f2eSlogwang  *   The values for each stats request by ID.
19512bfe3f2eSlogwang  * @param n
19522bfe3f2eSlogwang  *   The number of stats requested
19532bfe3f2eSlogwang  * @return
19542bfe3f2eSlogwang  *   - positive value: number of stat entries filled into the values array
19552bfe3f2eSlogwang  *   - negative value on error:
19562bfe3f2eSlogwang  *        -ENODEV for invalid *dev_id*
19572bfe3f2eSlogwang  *        -EINVAL for invalid mode, queue port or id parameters
19582bfe3f2eSlogwang  *        -ENOTSUP if the device doesn't support this function.
19592bfe3f2eSlogwang  */
19602bfe3f2eSlogwang int
19612bfe3f2eSlogwang rte_event_dev_xstats_get(uint8_t dev_id,
19622bfe3f2eSlogwang 			 enum rte_event_dev_xstats_mode mode,
19632bfe3f2eSlogwang 			 uint8_t queue_port_id,
19642bfe3f2eSlogwang 			 const unsigned int ids[],
19652bfe3f2eSlogwang 			 uint64_t values[], unsigned int n);
19662bfe3f2eSlogwang 
19672bfe3f2eSlogwang /**
19682bfe3f2eSlogwang  * Retrieve the value of a single stat by requesting it by name.
19692bfe3f2eSlogwang  *
19702bfe3f2eSlogwang  * @param dev_id
19712bfe3f2eSlogwang  *   The identifier of the device
19722bfe3f2eSlogwang  * @param name
19732bfe3f2eSlogwang  *   The stat name to retrieve
19742bfe3f2eSlogwang  * @param[out] id
19752bfe3f2eSlogwang  *   If non-NULL, the numerical id of the stat will be returned, so that further
19761646932aSjfb8856606  *   requests for the stat can be got using rte_event_dev_xstats_get, which will
19772bfe3f2eSlogwang  *   be faster as it doesn't need to scan a list of names for the stat.
19782bfe3f2eSlogwang  *   If the stat cannot be found, the id returned will be (unsigned)-1.
19792bfe3f2eSlogwang  * @return
19802bfe3f2eSlogwang  *   - positive value or zero: the stat value
19812bfe3f2eSlogwang  *   - negative value: -EINVAL if stat not found, -ENOTSUP if not supported.
19822bfe3f2eSlogwang  */
19832bfe3f2eSlogwang uint64_t
19842bfe3f2eSlogwang rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
19852bfe3f2eSlogwang 				 unsigned int *id);
19862bfe3f2eSlogwang 
19872bfe3f2eSlogwang /**
19882bfe3f2eSlogwang  * Reset the values of the xstats of the selected component in the device.
19892bfe3f2eSlogwang  *
19902bfe3f2eSlogwang  * @param dev_id
19912bfe3f2eSlogwang  *   The identifier of the device
19922bfe3f2eSlogwang  * @param mode
19932bfe3f2eSlogwang  *   The mode of the statistics to reset. Choose from device, queue or port.
19942bfe3f2eSlogwang  * @param queue_port_id
19952bfe3f2eSlogwang  *   The queue or port to reset. 0 and positive values select ports and queues,
19962bfe3f2eSlogwang  *   while -1 indicates all ports or queues.
19972bfe3f2eSlogwang  * @param ids
19982bfe3f2eSlogwang  *   Selects specific statistics to be reset. When NULL, all statistics selected
19992bfe3f2eSlogwang  *   by *mode* will be reset. If non-NULL, must point to array of at least
20002bfe3f2eSlogwang  *   *nb_ids* size.
20012bfe3f2eSlogwang  * @param nb_ids
20022bfe3f2eSlogwang  *   The number of ids available from the *ids* array. Ignored when ids is NULL.
20032bfe3f2eSlogwang  * @return
20042bfe3f2eSlogwang  *   - zero: successfully reset the statistics to zero
20052bfe3f2eSlogwang  *   - negative value: -EINVAL invalid parameters, -ENOTSUP if not supported.
20062bfe3f2eSlogwang  */
20072bfe3f2eSlogwang int
20082bfe3f2eSlogwang rte_event_dev_xstats_reset(uint8_t dev_id,
20092bfe3f2eSlogwang 			   enum rte_event_dev_xstats_mode mode,
20102bfe3f2eSlogwang 			   int16_t queue_port_id,
20112bfe3f2eSlogwang 			   const uint32_t ids[],
20122bfe3f2eSlogwang 			   uint32_t nb_ids);
20132bfe3f2eSlogwang 
2014d30ea906Sjfb8856606 /**
2015d30ea906Sjfb8856606  * Trigger the eventdev self test.
2016d30ea906Sjfb8856606  *
2017d30ea906Sjfb8856606  * @param dev_id
2018d30ea906Sjfb8856606  *   The identifier of the device
2019d30ea906Sjfb8856606  * @return
2020d30ea906Sjfb8856606  *   - 0: Selftest successful
2021d30ea906Sjfb8856606  *   - -ENOTSUP if the device doesn't support selftest
2022d30ea906Sjfb8856606  *   - other values < 0 on failure.
2023d30ea906Sjfb8856606  */
2024d30ea906Sjfb8856606 int rte_event_dev_selftest(uint8_t dev_id);
2025d30ea906Sjfb8856606 
20262bfe3f2eSlogwang #ifdef __cplusplus
20272bfe3f2eSlogwang }
20282bfe3f2eSlogwang #endif
20292bfe3f2eSlogwang 
20302bfe3f2eSlogwang #endif /* _RTE_EVENTDEV_H_ */
2031