xref: /dpdk/lib/eventdev/rte_eventdev.h (revision c6552d9a8deffa448de2d5e2e726f50508c1efd2)
199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
299a2dd95SBruce Richardson  * Copyright(c) 2016 Cavium, Inc.
399a2dd95SBruce Richardson  * Copyright(c) 2016-2018 Intel Corporation.
499a2dd95SBruce Richardson  * Copyright 2016 NXP
599a2dd95SBruce Richardson  * All rights reserved.
699a2dd95SBruce Richardson  */
799a2dd95SBruce Richardson 
899a2dd95SBruce Richardson #ifndef _RTE_EVENTDEV_H_
999a2dd95SBruce Richardson #define _RTE_EVENTDEV_H_
1099a2dd95SBruce Richardson 
1199a2dd95SBruce Richardson /**
1299a2dd95SBruce Richardson  * @file
1399a2dd95SBruce Richardson  *
1499a2dd95SBruce Richardson  * RTE Event Device API
159d22ced0SBruce Richardson  * ====================
1699a2dd95SBruce Richardson  *
179d22ced0SBruce Richardson  * In a traditional DPDK application model, the application polls Ethdev port RX
189d22ced0SBruce Richardson  * queues to look for work, and processing is done in a run-to-completion manner,
199d22ced0SBruce Richardson  * after which the packets are transmitted on a Ethdev TX queue. Load is
209d22ced0SBruce Richardson  * distributed by statically assigning ports and queues to lcores, and NIC
219d22ced0SBruce Richardson  * receive-side scaling (RSS), or similar, is employed to distribute network flows
229d22ced0SBruce Richardson  * (and thus work) on the same port across multiple RX queues.
239d22ced0SBruce Richardson  *
249d22ced0SBruce Richardson  * In contrast, in an event-driven model, as supported by this "eventdev" library,
259d22ced0SBruce Richardson  * incoming packets (or other input events) are fed into an event device, which
269d22ced0SBruce Richardson  * schedules those packets across the available lcores, in accordance with its configuration.
279d22ced0SBruce Richardson  * This event-driven programming model offers applications automatic multicore scaling,
289d22ced0SBruce Richardson  * dynamic load balancing, pipelining, packet order maintenance, synchronization,
299d22ced0SBruce Richardson  * and prioritization/quality of service.
3099a2dd95SBruce Richardson  *
3199a2dd95SBruce Richardson  * The Event Device API is composed of two parts:
3299a2dd95SBruce Richardson  *
3399a2dd95SBruce Richardson  * - The application-oriented Event API that includes functions to setup
3499a2dd95SBruce Richardson  *   an event device (configure it, setup its queues, ports and start it), to
359d22ced0SBruce Richardson  *   establish the links between queues and ports to receive events, and so on.
3699a2dd95SBruce Richardson  *
3799a2dd95SBruce Richardson  * - The driver-oriented Event API that exports a function allowing
389d22ced0SBruce Richardson  *   an event poll Mode Driver (PMD) to register itself as
3999a2dd95SBruce Richardson  *   an event device driver.
4099a2dd95SBruce Richardson  *
419d22ced0SBruce Richardson  * Application-oriented Event API
429d22ced0SBruce Richardson  * ------------------------------
439d22ced0SBruce Richardson  *
4499a2dd95SBruce Richardson  * Event device components:
4599a2dd95SBruce Richardson  *
4699a2dd95SBruce Richardson  *                     +-----------------+
4799a2dd95SBruce Richardson  *                     | +-------------+ |
4899a2dd95SBruce Richardson  *        +-------+    | |    flow 0   | |
4999a2dd95SBruce Richardson  *        |Packet |    | +-------------+ |
5099a2dd95SBruce Richardson  *        |event  |    | +-------------+ |
5199a2dd95SBruce Richardson  *        |       |    | |    flow 1   | |port_link(port0, queue0)
5299a2dd95SBruce Richardson  *        +-------+    | +-------------+ |     |     +--------+
5399a2dd95SBruce Richardson  *        +-------+    | +-------------+ o-----v-----o        |dequeue +------+
5499a2dd95SBruce Richardson  *        |Crypto |    | |    flow n   | |           | event  +------->|Core 0|
5599a2dd95SBruce Richardson  *        |work   |    | +-------------+ o----+      | port 0 |        |      |
5699a2dd95SBruce Richardson  *        |done ev|    |  event queue 0  |    |      +--------+        +------+
5799a2dd95SBruce Richardson  *        +-------+    +-----------------+    |
5899a2dd95SBruce Richardson  *        +-------+                           |
5999a2dd95SBruce Richardson  *        |Timer  |    +-----------------+    |      +--------+
6099a2dd95SBruce Richardson  *        |expiry |    | +-------------+ |    +------o        |dequeue +------+
6199a2dd95SBruce Richardson  *        |event  |    | |    flow 0   | o-----------o event  +------->|Core 1|
6299a2dd95SBruce Richardson  *        +-------+    | +-------------+ |      +----o port 1 |        |      |
6399a2dd95SBruce Richardson  *       Event enqueue | +-------------+ |      |    +--------+        +------+
6499a2dd95SBruce Richardson  *     o-------------> | |    flow 1   | |      |
6599a2dd95SBruce Richardson  *        enqueue(     | +-------------+ |      |
6699a2dd95SBruce Richardson  *        queue_id,    |                 |      |    +--------+        +------+
6799a2dd95SBruce Richardson  *        flow_id,     | +-------------+ |      |    |        |dequeue |Core 2|
6899a2dd95SBruce Richardson  *        sched_type,  | |    flow n   | o-----------o event  +------->|      |
6999a2dd95SBruce Richardson  *        event_type,  | +-------------+ |      |    | port 2 |        +------+
7099a2dd95SBruce Richardson  *        subev_type,  |  event queue 1  |      |    +--------+
7199a2dd95SBruce Richardson  *        event)       +-----------------+      |    +--------+
7299a2dd95SBruce Richardson  *                                              |    |        |dequeue +------+
7399a2dd95SBruce Richardson  *        +-------+    +-----------------+      |    | event  +------->|Core n|
7499a2dd95SBruce Richardson  *        |Core   |    | +-------------+ o-----------o port n |        |      |
7599a2dd95SBruce Richardson  *        |(SW)   |    | |    flow 0   | |      |    +--------+        +--+---+
7699a2dd95SBruce Richardson  *        |event  |    | +-------------+ |      |                         |
7799a2dd95SBruce Richardson  *        +-------+    | +-------------+ |      |                         |
7899a2dd95SBruce Richardson  *            ^        | |    flow 1   | |      |                         |
7999a2dd95SBruce Richardson  *            |        | +-------------+ o------+                         |
8099a2dd95SBruce Richardson  *            |        | +-------------+ |                                |
8199a2dd95SBruce Richardson  *            |        | |    flow n   | |                                |
8299a2dd95SBruce Richardson  *            |        | +-------------+ |                                |
8399a2dd95SBruce Richardson  *            |        |  event queue n  |                                |
8499a2dd95SBruce Richardson  *            |        +-----------------+                                |
8599a2dd95SBruce Richardson  *            |                                                           |
8699a2dd95SBruce Richardson  *            +-----------------------------------------------------------+
8799a2dd95SBruce Richardson  *
889d22ced0SBruce Richardson  * **Event device**: A hardware or software-based event scheduler.
8999a2dd95SBruce Richardson  *
909d22ced0SBruce Richardson  * **Event**: Represents an item of work and is the smallest unit of scheduling.
919d22ced0SBruce Richardson  * An event carries metadata, such as queue ID, scheduling type, and event priority,
929d22ced0SBruce Richardson  * and data such as one or more packets or other kinds of buffers.
939d22ced0SBruce Richardson  * Some examples of events are:
949d22ced0SBruce Richardson  * - a software-generated item of work originating from a lcore,
959d22ced0SBruce Richardson  *   perhaps carrying a packet to be processed.
969d22ced0SBruce Richardson  * - a crypto work completion notification.
979d22ced0SBruce Richardson  * - a timer expiry notification.
9899a2dd95SBruce Richardson  *
999d22ced0SBruce Richardson  * **Event queue**: A queue containing events that are to be scheduled by the event device.
10099a2dd95SBruce Richardson  * An event queue contains events of different flows associated with scheduling
10199a2dd95SBruce Richardson  * types, such as atomic, ordered, or parallel.
1029d22ced0SBruce Richardson  * Each event given to an event device must have a valid event queue id field in the metadata,
1039d22ced0SBruce Richardson  * to specify on which event queue in the device the event must be placed,
1049d22ced0SBruce Richardson  * for later scheduling.
10599a2dd95SBruce Richardson  *
1069d22ced0SBruce Richardson  * **Event port**: An application's interface into the event dev for enqueue and
10799a2dd95SBruce Richardson  * dequeue operations. Each event port can be linked with one or more
10899a2dd95SBruce Richardson  * event queues for dequeue operations.
1099d22ced0SBruce Richardson  * Enqueue and dequeue from a port is not thread-safe, and the expected use-case is
1109d22ced0SBruce Richardson  * that each port is polled by only a single lcore. [If this is not the case,
1119d22ced0SBruce Richardson  * a suitable synchronization mechanism should be used to prevent simultaneous
1129d22ced0SBruce Richardson  * access from multiple lcores.]
1139d22ced0SBruce Richardson  * To schedule events to an lcore, the event device will schedule them to the event port(s)
1149d22ced0SBruce Richardson  * being polled by that lcore.
11599a2dd95SBruce Richardson  *
1169d22ced0SBruce Richardson  * *NOTE*: By default, all the functions of the Event Device API exported by a PMD
1179d22ced0SBruce Richardson  * are non-thread-safe functions, which must not be invoked on the same object in parallel on
1189d22ced0SBruce Richardson  * different logical cores.
1199d22ced0SBruce Richardson  * For instance, the dequeue function of a PMD cannot be invoked in parallel on two logical
1209d22ced0SBruce Richardson  * cores to operate on same  event port. Of course, this function
12199a2dd95SBruce Richardson  * can be invoked in parallel by different logical cores on different ports.
12299a2dd95SBruce Richardson  * It is the responsibility of the upper level application to enforce this rule.
12399a2dd95SBruce Richardson  *
12499a2dd95SBruce Richardson  * In all functions of the Event API, the Event device is
12599a2dd95SBruce Richardson  * designated by an integer >= 0 named the device identifier *dev_id*
12699a2dd95SBruce Richardson  *
12799a2dd95SBruce Richardson  * The functions exported by the application Event API to setup a device
1289d22ced0SBruce Richardson  * must be invoked in the following order:
12999a2dd95SBruce Richardson  *     - rte_event_dev_configure()
13099a2dd95SBruce Richardson  *     - rte_event_queue_setup()
13199a2dd95SBruce Richardson  *     - rte_event_port_setup()
13299a2dd95SBruce Richardson  *     - rte_event_port_link()
13399a2dd95SBruce Richardson  *     - rte_event_dev_start()
13499a2dd95SBruce Richardson  *
13599a2dd95SBruce Richardson  * Then, the application can invoke, in any order, the functions
1369d22ced0SBruce Richardson  * exported by the Event API to dequeue events, enqueue events,
1379d22ced0SBruce Richardson  * and link and unlink event queue(s) to event ports.
13899a2dd95SBruce Richardson  *
1399d22ced0SBruce Richardson  * Before configuring a device, an application should call rte_event_dev_info_get()
1409d22ced0SBruce Richardson  * to determine the capabilities of the event device, and any queue or port
1419d22ced0SBruce Richardson  * limits of that device. The parameters set in the various device configuration
1429d22ced0SBruce Richardson  * structures may need to be adjusted based on the max values provided in the
1439d22ced0SBruce Richardson  * device information structure returned from the rte_event_dev_info_get() API.
1449d22ced0SBruce Richardson  * An application may use rte_event_queue_default_conf_get() or
1459d22ced0SBruce Richardson  * rte_event_port_default_conf_get() to get the default configuration
1469d22ced0SBruce Richardson  * to set up an event queue or event port by overriding few default values.
14799a2dd95SBruce Richardson  *
14899a2dd95SBruce Richardson  * If the application wants to change the configuration (i.e. call
14999a2dd95SBruce Richardson  * rte_event_dev_configure(), rte_event_queue_setup(), or
15099a2dd95SBruce Richardson  * rte_event_port_setup()), it must call rte_event_dev_stop() first to stop the
15199a2dd95SBruce Richardson  * device and then do the reconfiguration before calling rte_event_dev_start()
15299a2dd95SBruce Richardson  * again. The schedule, enqueue and dequeue functions should not be invoked
15399a2dd95SBruce Richardson  * when the device is stopped.
15499a2dd95SBruce Richardson  *
15599a2dd95SBruce Richardson  * Finally, an application can close an Event device by invoking the
1569d22ced0SBruce Richardson  * rte_event_dev_close() function. Once closed, a device cannot be
1579d22ced0SBruce Richardson  * reconfigured or restarted.
1589d22ced0SBruce Richardson  *
1599d22ced0SBruce Richardson  * Driver-Oriented Event API
1609d22ced0SBruce Richardson  * -------------------------
16199a2dd95SBruce Richardson  *
162de972a78SBruce Richardson  * At the Event driver level, Event devices are represented by a generic
163de972a78SBruce Richardson  * data structure of type *rte_event_dev*.
164de972a78SBruce Richardson  *
165de972a78SBruce Richardson  * Event devices are dynamically registered during the PCI/SoC device probing
166de972a78SBruce Richardson  * phase performed at EAL initialization time.
167de972a78SBruce Richardson  * When an Event device is being probed, an *rte_event_dev* structure is allocated
168de972a78SBruce Richardson  * for it and the event_dev_init() function supplied by the Event driver
169de972a78SBruce Richardson  * is invoked to properly initialize the device.
170de972a78SBruce Richardson  *
171de972a78SBruce Richardson  * The role of the device init function is to reset the device hardware or
172de972a78SBruce Richardson  * to initialize the software event driver implementation.
173de972a78SBruce Richardson  *
174de972a78SBruce Richardson  * If the device init operation is successful, the device is assigned a device
175de972a78SBruce Richardson  * id (dev_id) for application use.
176de972a78SBruce Richardson  * Otherwise, the *rte_event_dev* structure is freed.
177de972a78SBruce Richardson  *
17899a2dd95SBruce Richardson  * Each function of the application Event API invokes a specific function
17999a2dd95SBruce Richardson  * of the PMD that controls the target device designated by its device
18099a2dd95SBruce Richardson  * identifier.
18199a2dd95SBruce Richardson  *
18299a2dd95SBruce Richardson  * For this purpose, all device-specific functions of an Event driver are
18399a2dd95SBruce Richardson  * supplied through a set of pointers contained in a generic structure of type
18499a2dd95SBruce Richardson  * *event_dev_ops*.
18599a2dd95SBruce Richardson  * The address of the *event_dev_ops* structure is stored in the *rte_event_dev*
18699a2dd95SBruce Richardson  * structure by the device init function of the Event driver, which is
18799a2dd95SBruce Richardson  * invoked during the PCI/SoC device probing phase, as explained earlier.
18899a2dd95SBruce Richardson  *
18999a2dd95SBruce Richardson  * In other words, each function of the Event API simply retrieves the
19099a2dd95SBruce Richardson  * *rte_event_dev* structure associated with the device identifier and
19199a2dd95SBruce Richardson  * performs an indirect invocation of the corresponding driver function
19299a2dd95SBruce Richardson  * supplied in the *event_dev_ops* structure of the *rte_event_dev* structure.
19399a2dd95SBruce Richardson  *
1949d22ced0SBruce Richardson  * For performance reasons, the addresses of the fast-path functions of the
1959d22ced0SBruce Richardson  * event driver are not contained in the *event_dev_ops* structure.
19699a2dd95SBruce Richardson  * Instead, they are directly stored at the beginning of the *rte_event_dev*
19799a2dd95SBruce Richardson  * structure to avoid an extra indirect memory access during their invocation.
19899a2dd95SBruce Richardson  *
1999d22ced0SBruce Richardson  * Event Enqueue, Dequeue and Scheduling
2009d22ced0SBruce Richardson  * -------------------------------------
2019d22ced0SBruce Richardson  *
20299a2dd95SBruce Richardson  * RTE event device drivers do not use interrupts for enqueue or dequeue
20399a2dd95SBruce Richardson  * operation. Instead, Event drivers export Poll-Mode enqueue and dequeue
20499a2dd95SBruce Richardson  * functions to applications.
20599a2dd95SBruce Richardson  *
20699a2dd95SBruce Richardson  * The events are injected to event device through *enqueue* operation by
20799a2dd95SBruce Richardson  * event producers in the system. The typical event producers are ethdev
20899a2dd95SBruce Richardson  * subsystem for generating packet events, CPU(SW) for generating events based
20999a2dd95SBruce Richardson  * on different stages of application processing, cryptodev for generating
21099a2dd95SBruce Richardson  * crypto work completion notification etc
21199a2dd95SBruce Richardson  *
21299a2dd95SBruce Richardson  * The *dequeue* operation gets one or more events from the event ports.
2139d22ced0SBruce Richardson  * The application processes the events and sends them to a downstream event queue through
2149d22ced0SBruce Richardson  * rte_event_enqueue_burst(), if it is an intermediate stage of event processing.
2159d22ced0SBruce Richardson  * On the final stage of processing, the application may use the Tx adapter API for maintaining
2169d22ced0SBruce Richardson  * the event ingress order while sending the packet/event on the wire via NIC Tx.
21799a2dd95SBruce Richardson  *
21899a2dd95SBruce Richardson  * The point at which events are scheduled to ports depends on the device.
21999a2dd95SBruce Richardson  * For hardware devices, scheduling occurs asynchronously without any software
22099a2dd95SBruce Richardson  * intervention. Software schedulers can either be distributed
22199a2dd95SBruce Richardson  * (each worker thread schedules events to its own port) or centralized
22299a2dd95SBruce Richardson  * (a dedicated thread schedules to all ports). Distributed software schedulers
2239d22ced0SBruce Richardson  * perform the scheduling inside the enqueue or dequeue functions, whereas centralized
2249d22ced0SBruce Richardson  * software schedulers need a dedicated service core for scheduling.
2259d22ced0SBruce Richardson  * The absence of the RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED capability flag
2269d22ced0SBruce Richardson  * indicates that the device is centralized and thus needs a dedicated scheduling
2279d22ced0SBruce Richardson  * thread (generally an RTE service that should be mapped to one or more service cores)
2289d22ced0SBruce Richardson  * that repeatedly calls the software specific scheduling function.
22999a2dd95SBruce Richardson  *
23099a2dd95SBruce Richardson  * An event driven worker thread has following typical workflow on fastpath:
23199a2dd95SBruce Richardson  * \code{.c}
23299a2dd95SBruce Richardson  *	while (1) {
23399a2dd95SBruce Richardson  *		rte_event_dequeue_burst(...);
23499a2dd95SBruce Richardson  *		(event processing)
23599a2dd95SBruce Richardson  *		rte_event_enqueue_burst(...);
23699a2dd95SBruce Richardson  *	}
23799a2dd95SBruce Richardson  * \endcode
23899a2dd95SBruce Richardson  */
23999a2dd95SBruce Richardson 
24099a2dd95SBruce Richardson #ifdef __cplusplus
24199a2dd95SBruce Richardson extern "C" {
24299a2dd95SBruce Richardson #endif
24399a2dd95SBruce Richardson 
2441094dd94SDavid Marchand #include <rte_compat.h>
24599a2dd95SBruce Richardson #include <rte_common.h>
24699a2dd95SBruce Richardson #include <rte_errno.h>
24799a2dd95SBruce Richardson #include <rte_mbuf_pool_ops.h>
24899a2dd95SBruce Richardson #include <rte_mempool.h>
24999a2dd95SBruce Richardson 
25099a2dd95SBruce Richardson #include "rte_eventdev_trace_fp.h"
25199a2dd95SBruce Richardson 
25299a2dd95SBruce Richardson struct rte_mbuf; /* we just use mbuf pointers; no need to include rte_mbuf.h */
25399a2dd95SBruce Richardson struct rte_event;
25499a2dd95SBruce Richardson 
25599a2dd95SBruce Richardson /* Event device capability bitmap flags */
25699a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_QUEUE_QOS           (1ULL << 0)
25744516e6bSShijith Thotton /**< Event scheduling prioritization is based on the priority and weight
258bccda56aSBruce Richardson  * associated with each event queue.
259bccda56aSBruce Richardson  *
260bccda56aSBruce Richardson  * Events from a queue with highest priority
261bccda56aSBruce Richardson  * are scheduled first. If the queues are of same priority, weight of the queues
26244516e6bSShijith Thotton  * are considered to select a queue in a weighted round robin fashion.
26344516e6bSShijith Thotton  * Subsequent dequeue calls from an event port could see events from the same
26444516e6bSShijith Thotton  * event queue, if the queue is configured with an affinity count. Affinity
26544516e6bSShijith Thotton  * count is the number of subsequent dequeue calls, in which an event port
26644516e6bSShijith Thotton  * should use the same event queue if the queue is non-empty
26799a2dd95SBruce Richardson  *
268bccda56aSBruce Richardson  * NOTE: A device may use both queue prioritization and event prioritization
269bccda56aSBruce Richardson  * (@ref RTE_EVENT_DEV_CAP_EVENT_QOS capability) when making packet scheduling decisions.
270bccda56aSBruce Richardson  *
271bccda56aSBruce Richardson  *  @see rte_event_queue_setup()
272bccda56aSBruce Richardson  *  @see rte_event_queue_attr_set()
27399a2dd95SBruce Richardson  */
27499a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_EVENT_QOS           (1ULL << 1)
27599a2dd95SBruce Richardson /**< Event scheduling prioritization is based on the priority associated with
276bccda56aSBruce Richardson  *  each event.
27799a2dd95SBruce Richardson  *
278bccda56aSBruce Richardson  *  Priority of each event is supplied in *rte_event* structure
279bccda56aSBruce Richardson  *  on each enqueue operation.
280bccda56aSBruce Richardson  *  If this capability is not set, the priority field of the event structure
281bccda56aSBruce Richardson  *  is ignored for each event.
282bccda56aSBruce Richardson  *
283bccda56aSBruce Richardson  * NOTE: A device may use both queue prioritization (@ref RTE_EVENT_DEV_CAP_QUEUE_QOS capability)
284bccda56aSBruce Richardson  * and event prioritization when making packet scheduling decisions.
285bccda56aSBruce Richardson 
28699a2dd95SBruce Richardson  *  @see rte_event_enqueue_burst()
28799a2dd95SBruce Richardson  */
28899a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED   (1ULL << 2)
28999a2dd95SBruce Richardson /**< Event device operates in distributed scheduling mode.
290bccda56aSBruce Richardson  *
29199a2dd95SBruce Richardson  * In distributed scheduling mode, event scheduling happens in HW or
292bccda56aSBruce Richardson  * rte_event_dequeue_burst() / rte_event_enqueue_burst() or the combination of these two.
29399a2dd95SBruce Richardson  * If the flag is not set then eventdev is centralized and thus needs a
29499a2dd95SBruce Richardson  * dedicated service core that acts as a scheduling thread.
29599a2dd95SBruce Richardson  *
296bccda56aSBruce Richardson  * @see rte_event_dev_service_id_get()
29799a2dd95SBruce Richardson  */
29899a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_QUEUE_ALL_TYPES     (1ULL << 3)
299ef0646ceSBruce Richardson /**< Event device is capable of accepting enqueued events, of any type
300ef0646ceSBruce Richardson  * advertised as supported by the device, to all destination queues.
30199a2dd95SBruce Richardson  *
302bccda56aSBruce Richardson  * When this capability is set, and @ref RTE_EVENT_QUEUE_CFG_ALL_TYPES flag is set
303bccda56aSBruce Richardson  * in @ref rte_event_queue_conf.event_queue_cfg, the "schedule_type" field of the
304bccda56aSBruce Richardson  * @ref rte_event_queue_conf structure is ignored when a queue is being configured.
305ef0646ceSBruce Richardson  * Instead the "sched_type" field of each event enqueued is used to
306ef0646ceSBruce Richardson  * select the scheduling to be performed on that event.
307ef0646ceSBruce Richardson  *
308bccda56aSBruce Richardson  * If this capability is not set, or the configuration flag is not set,
309bccda56aSBruce Richardson  * the queue only supports events of the *RTE_SCHED_TYPE_* type specified
310bccda56aSBruce Richardson  * in the @ref rte_event_queue_conf structure  at time of configuration.
311bccda56aSBruce Richardson  * The behaviour when events of other scheduling types are sent to the queue is
312bccda56aSBruce Richardson  * undefined.
313ef0646ceSBruce Richardson  *
314bccda56aSBruce Richardson  * @see RTE_EVENT_QUEUE_CFG_ALL_TYPES
315ef0646ceSBruce Richardson  * @see RTE_SCHED_TYPE_ATOMIC
316ef0646ceSBruce Richardson  * @see RTE_SCHED_TYPE_ORDERED
317ef0646ceSBruce Richardson  * @see RTE_SCHED_TYPE_PARALLEL
318bccda56aSBruce Richardson  * @see rte_event_queue_conf.event_queue_cfg
319ef0646ceSBruce Richardson  * @see rte_event_queue_conf.schedule_type
320bccda56aSBruce Richardson  * @see rte_event_enqueue_burst()
32199a2dd95SBruce Richardson  */
32299a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_BURST_MODE          (1ULL << 4)
32399a2dd95SBruce Richardson /**< Event device is capable of operating in burst mode for enqueue(forward,
324bccda56aSBruce Richardson  * release) and dequeue operation.
32599a2dd95SBruce Richardson  *
326bccda56aSBruce Richardson  * If this capability is not set, application
327bccda56aSBruce Richardson  * can still use the rte_event_dequeue_burst() and rte_event_enqueue_burst() but
328bccda56aSBruce Richardson  * PMD accepts or returns only one event at a time.
329bccda56aSBruce Richardson  *
330bccda56aSBruce Richardson  * @see rte_event_dequeue_burst()
331bccda56aSBruce Richardson  * @see rte_event_enqueue_burst()
33299a2dd95SBruce Richardson  */
33399a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE    (1ULL << 5)
33499a2dd95SBruce Richardson /**< Event device ports support disabling the implicit release feature, in
33599a2dd95SBruce Richardson  * which the port will release all unreleased events in its dequeue operation.
336bccda56aSBruce Richardson  *
33799a2dd95SBruce Richardson  * If this capability is set and the port is configured with implicit release
33899a2dd95SBruce Richardson  * disabled, the application is responsible for explicitly releasing events
339bccda56aSBruce Richardson  * using either the @ref RTE_EVENT_OP_FORWARD or the @ref RTE_EVENT_OP_RELEASE event
34099a2dd95SBruce Richardson  * enqueue operations.
34199a2dd95SBruce Richardson  *
342bccda56aSBruce Richardson  * @see rte_event_dequeue_burst()
343bccda56aSBruce Richardson  * @see rte_event_enqueue_burst()
34499a2dd95SBruce Richardson  */
34599a2dd95SBruce Richardson 
34699a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_NONSEQ_MODE         (1ULL << 6)
347bccda56aSBruce Richardson /**< Event device is capable of operating in non-sequential mode.
348bccda56aSBruce Richardson  *
349bccda56aSBruce Richardson  * The path of the event is not necessary to be sequential. Application can change
350bccda56aSBruce Richardson  * the path of event at runtime and events may be sent to queues in any order.
351bccda56aSBruce Richardson  *
352bccda56aSBruce Richardson  * If the flag is not set, then event each event will follow a path from queue 0
353bccda56aSBruce Richardson  * to queue 1 to queue 2 etc.
354bccda56aSBruce Richardson  * The eventdev will return an error when the application enqueues an event for a
35599a2dd95SBruce Richardson  * qid which is not the next in the sequence.
35699a2dd95SBruce Richardson  */
35799a2dd95SBruce Richardson 
35899a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_RUNTIME_PORT_LINK   (1ULL << 7)
359bccda56aSBruce Richardson /**< Event device is capable of reconfiguring the queue/port link at runtime.
360bccda56aSBruce Richardson  *
36199a2dd95SBruce Richardson  * If the flag is not set, the eventdev queue/port link is only can be
362bccda56aSBruce Richardson  * configured during  initialization, or by stopping the device and
363bccda56aSBruce Richardson  * then later restarting it after reconfiguration.
364bccda56aSBruce Richardson  *
365bccda56aSBruce Richardson  * @see rte_event_port_link()
366bccda56aSBruce Richardson  * @see rte_event_port_unlink()
36799a2dd95SBruce Richardson  */
36899a2dd95SBruce Richardson 
36999a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_MULTIPLE_QUEUE_PORT (1ULL << 8)
370bccda56aSBruce Richardson /**< Event device is capable of setting up links between multiple queues and a single port.
371bccda56aSBruce Richardson  *
372bccda56aSBruce Richardson  * If the flag is not set, each port may only be linked to a single queue, and
373bccda56aSBruce Richardson  * so can only receive events from that queue.
374bccda56aSBruce Richardson  * However, each queue may be linked to multiple ports.
375bccda56aSBruce Richardson  *
376bccda56aSBruce Richardson  * @see rte_event_port_link()
37799a2dd95SBruce Richardson  */
37899a2dd95SBruce Richardson 
37999a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_CARRY_FLOW_ID (1ULL << 9)
380bccda56aSBruce Richardson /**< Event device preserves the flow ID from the enqueued event to the dequeued event.
381bccda56aSBruce Richardson  *
382bccda56aSBruce Richardson  * If this flag is not set,
383bccda56aSBruce Richardson  * the content of the flow-id field in dequeued events is implementation dependent.
384bccda56aSBruce Richardson  *
385bccda56aSBruce Richardson  * @see rte_event_dequeue_burst()
38699a2dd95SBruce Richardson  */
38799a2dd95SBruce Richardson 
388bd991897SMattias Rönnblom #define RTE_EVENT_DEV_CAP_MAINTENANCE_FREE (1ULL << 10)
389bd991897SMattias Rönnblom /**< Event device *does not* require calls to rte_event_maintain().
390bccda56aSBruce Richardson  *
391bd991897SMattias Rönnblom  * An event device that does not set this flag requires calls to
392bd991897SMattias Rönnblom  * rte_event_maintain() during periods when neither
393bd991897SMattias Rönnblom  * rte_event_dequeue_burst() nor rte_event_enqueue_burst() are called
394bd991897SMattias Rönnblom  * on a port. This will allow the event device to perform internal
395bd991897SMattias Rönnblom  * processing, such as flushing buffered events, return credits to a
396bd991897SMattias Rönnblom  * global pool, or process signaling related to load balancing.
397bccda56aSBruce Richardson  *
398bccda56aSBruce Richardson  * @see rte_event_maintain()
39954f17843SMattias Rönnblom  */
40054f17843SMattias Rönnblom 
40197b914f4SShijith Thotton #define RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR (1ULL << 11)
40297b914f4SShijith Thotton /**< Event device is capable of changing the queue attributes at runtime i.e
403bccda56aSBruce Richardson  * after rte_event_queue_setup() or rte_event_dev_start() call sequence.
404bccda56aSBruce Richardson  *
405bccda56aSBruce Richardson  * If this flag is not set, event queue attributes can only be configured during
40697b914f4SShijith Thotton  * rte_event_queue_setup().
407bccda56aSBruce Richardson  *
408bccda56aSBruce Richardson  * @see rte_event_queue_setup()
40997b914f4SShijith Thotton  */
41097b914f4SShijith Thotton 
411d007a7f3SPavan Nikhilesh #define RTE_EVENT_DEV_CAP_PROFILE_LINK (1ULL << 12)
412bccda56aSBruce Richardson /**< Event device is capable of supporting multiple link profiles per event port.
413bccda56aSBruce Richardson  *
414bccda56aSBruce Richardson  * When set, the value of `rte_event_dev_info::max_profiles_per_port` is greater
415bccda56aSBruce Richardson  * than one, and multiple profiles may be configured and then switched at runtime.
416bccda56aSBruce Richardson  * If not set, only a single profile may be configured, which may itself be
417bccda56aSBruce Richardson  * runtime adjustable (if @ref RTE_EVENT_DEV_CAP_RUNTIME_PORT_LINK is set).
418bccda56aSBruce Richardson  *
419bccda56aSBruce Richardson  * @see rte_event_port_profile_links_set()
420bccda56aSBruce Richardson  * @see rte_event_port_profile_links_get()
421bccda56aSBruce Richardson  * @see rte_event_port_profile_switch()
422bccda56aSBruce Richardson  * @see RTE_EVENT_DEV_CAP_RUNTIME_PORT_LINK
423d007a7f3SPavan Nikhilesh  */
424d007a7f3SPavan Nikhilesh 
425eaa8fb6cSBruce Richardson #define RTE_EVENT_DEV_CAP_ATOMIC  (1ULL << 13)
426eaa8fb6cSBruce Richardson /**< Event device is capable of atomic scheduling.
427eaa8fb6cSBruce Richardson  * When this flag is set, the application can configure queues with scheduling type
428eaa8fb6cSBruce Richardson  * atomic on this event device.
429bccda56aSBruce Richardson  *
430eaa8fb6cSBruce Richardson  * @see RTE_SCHED_TYPE_ATOMIC
431eaa8fb6cSBruce Richardson  */
432eaa8fb6cSBruce Richardson 
433eaa8fb6cSBruce Richardson #define RTE_EVENT_DEV_CAP_ORDERED  (1ULL << 14)
434eaa8fb6cSBruce Richardson /**< Event device is capable of ordered scheduling.
435eaa8fb6cSBruce Richardson  * When this flag is set, the application can configure queues with scheduling type
436eaa8fb6cSBruce Richardson  * ordered on this event device.
437bccda56aSBruce Richardson  *
438eaa8fb6cSBruce Richardson  * @see RTE_SCHED_TYPE_ORDERED
439eaa8fb6cSBruce Richardson  */
440eaa8fb6cSBruce Richardson 
441eaa8fb6cSBruce Richardson #define RTE_EVENT_DEV_CAP_PARALLEL  (1ULL << 15)
442eaa8fb6cSBruce Richardson /**< Event device is capable of parallel scheduling.
443eaa8fb6cSBruce Richardson  * When this flag is set, the application can configure queues with scheduling type
444eaa8fb6cSBruce Richardson  * parallel on this event device.
445bccda56aSBruce Richardson  *
446eaa8fb6cSBruce Richardson  * @see RTE_SCHED_TYPE_PARALLEL
447eaa8fb6cSBruce Richardson  */
448eaa8fb6cSBruce Richardson 
44999a2dd95SBruce Richardson /* Event device priority levels */
45099a2dd95SBruce Richardson #define RTE_EVENT_DEV_PRIORITY_HIGHEST   0
451bccda56aSBruce Richardson /**< Highest priority level for events and queues.
452bccda56aSBruce Richardson  *
453bccda56aSBruce Richardson  * @see rte_event_queue_setup()
454bccda56aSBruce Richardson  * @see rte_event_enqueue_burst()
45599a2dd95SBruce Richardson  * @see rte_event_port_link()
45699a2dd95SBruce Richardson  */
45799a2dd95SBruce Richardson #define RTE_EVENT_DEV_PRIORITY_NORMAL    128
458bccda56aSBruce Richardson /**< Normal priority level for events and queues.
459bccda56aSBruce Richardson  *
460bccda56aSBruce Richardson  * @see rte_event_queue_setup()
461bccda56aSBruce Richardson  * @see rte_event_enqueue_burst()
46299a2dd95SBruce Richardson  * @see rte_event_port_link()
46399a2dd95SBruce Richardson  */
46499a2dd95SBruce Richardson #define RTE_EVENT_DEV_PRIORITY_LOWEST    255
465bccda56aSBruce Richardson /**< Lowest priority level for events and queues.
466bccda56aSBruce Richardson  *
467bccda56aSBruce Richardson  * @see rte_event_queue_setup()
468bccda56aSBruce Richardson  * @see rte_event_enqueue_burst()
46999a2dd95SBruce Richardson  * @see rte_event_port_link()
47099a2dd95SBruce Richardson  */
47199a2dd95SBruce Richardson 
47244516e6bSShijith Thotton /* Event queue scheduling weights */
47344516e6bSShijith Thotton #define RTE_EVENT_QUEUE_WEIGHT_HIGHEST 255
474bccda56aSBruce Richardson /**< Highest weight of an event queue.
475bccda56aSBruce Richardson  *
476bccda56aSBruce Richardson  * @see rte_event_queue_attr_get()
477bccda56aSBruce Richardson  * @see rte_event_queue_attr_set()
47844516e6bSShijith Thotton  */
47944516e6bSShijith Thotton #define RTE_EVENT_QUEUE_WEIGHT_LOWEST 0
480bccda56aSBruce Richardson /**< Lowest weight of an event queue.
481bccda56aSBruce Richardson  *
482bccda56aSBruce Richardson  * @see rte_event_queue_attr_get()
483bccda56aSBruce Richardson  * @see rte_event_queue_attr_set()
48444516e6bSShijith Thotton  */
48544516e6bSShijith Thotton 
48644516e6bSShijith Thotton /* Event queue scheduling affinity */
48744516e6bSShijith Thotton #define RTE_EVENT_QUEUE_AFFINITY_HIGHEST 255
488bccda56aSBruce Richardson /**< Highest scheduling affinity of an event queue.
489bccda56aSBruce Richardson  *
490bccda56aSBruce Richardson  * @see rte_event_queue_attr_get()
491bccda56aSBruce Richardson  * @see rte_event_queue_attr_set()
49244516e6bSShijith Thotton  */
49344516e6bSShijith Thotton #define RTE_EVENT_QUEUE_AFFINITY_LOWEST 0
494bccda56aSBruce Richardson /**< Lowest scheduling affinity of an event queue.
495bccda56aSBruce Richardson  *
496bccda56aSBruce Richardson  * @see rte_event_queue_attr_get()
497bccda56aSBruce Richardson  * @see rte_event_queue_attr_set()
49844516e6bSShijith Thotton  */
49944516e6bSShijith Thotton 
50099a2dd95SBruce Richardson /**
501d77c9cbfSBruce Richardson  * Get the total number of event devices.
50299a2dd95SBruce Richardson  *
50399a2dd95SBruce Richardson  * @return
50499a2dd95SBruce Richardson  *   The total number of usable event devices.
50599a2dd95SBruce Richardson  */
50699a2dd95SBruce Richardson uint8_t
50799a2dd95SBruce Richardson rte_event_dev_count(void);
50899a2dd95SBruce Richardson 
50999a2dd95SBruce Richardson /**
51099a2dd95SBruce Richardson  * Get the device identifier for the named event device.
51199a2dd95SBruce Richardson  *
51299a2dd95SBruce Richardson  * @param name
51399a2dd95SBruce Richardson  *   Event device name to select the event device identifier.
51499a2dd95SBruce Richardson  *
51599a2dd95SBruce Richardson  * @return
516d77c9cbfSBruce Richardson  *   Event device identifier (dev_id >= 0) on success.
517d77c9cbfSBruce Richardson  *   Negative error code on failure:
518d77c9cbfSBruce Richardson  *   - -EINVAL - input name parameter is invalid.
519d77c9cbfSBruce Richardson  *   - -ENODEV - no event device found with that name.
52099a2dd95SBruce Richardson  */
52199a2dd95SBruce Richardson int
52299a2dd95SBruce Richardson rte_event_dev_get_dev_id(const char *name);
52399a2dd95SBruce Richardson 
52499a2dd95SBruce Richardson /**
52599a2dd95SBruce Richardson  * Return the NUMA socket to which a device is connected.
52699a2dd95SBruce Richardson  *
52799a2dd95SBruce Richardson  * @param dev_id
52899a2dd95SBruce Richardson  *   The identifier of the device.
52999a2dd95SBruce Richardson  * @return
53099a2dd95SBruce Richardson  *   The NUMA socket id to which the device is connected or
53199a2dd95SBruce Richardson  *   a default of zero if the socket could not be determined.
532d77c9cbfSBruce Richardson  *   -EINVAL on error, where the given dev_id value does not
533d77c9cbfSBruce Richardson  *   correspond to any event device.
53499a2dd95SBruce Richardson  */
53599a2dd95SBruce Richardson int
53699a2dd95SBruce Richardson rte_event_dev_socket_id(uint8_t dev_id);
53799a2dd95SBruce Richardson 
53899a2dd95SBruce Richardson /**
53999a2dd95SBruce Richardson  * Event device information
54099a2dd95SBruce Richardson  */
54199a2dd95SBruce Richardson struct rte_event_dev_info {
542da4b9651SBruce Richardson 	const char *driver_name;	/**< Event driver name. */
543da4b9651SBruce Richardson 	struct rte_device *dev;	/**< Device information. */
54499a2dd95SBruce Richardson 	uint32_t min_dequeue_timeout_ns;
545da4b9651SBruce Richardson 	/**< Minimum global dequeue timeout(ns) supported by this device. */
54699a2dd95SBruce Richardson 	uint32_t max_dequeue_timeout_ns;
547da4b9651SBruce Richardson 	/**< Maximum global dequeue timeout(ns) supported by this device. */
54899a2dd95SBruce Richardson 	uint32_t dequeue_timeout_ns;
549da4b9651SBruce Richardson 	/**< Configured global dequeue timeout(ns) for this device. */
55099a2dd95SBruce Richardson 	uint8_t max_event_queues;
551da4b9651SBruce Richardson 	/**< Maximum event queues supported by this device.
552da4b9651SBruce Richardson 	 *
553da4b9651SBruce Richardson 	 * This count excludes any queues covered by @ref max_single_link_event_port_queue_pairs.
554da4b9651SBruce Richardson 	 */
55599a2dd95SBruce Richardson 	uint32_t max_event_queue_flows;
556da4b9651SBruce Richardson 	/**< Maximum number of flows within an event queue supported by this device. */
55799a2dd95SBruce Richardson 	uint8_t max_event_queue_priority_levels;
558da4b9651SBruce Richardson 	/**< Maximum number of event queue priority levels supported by this device.
559da4b9651SBruce Richardson 	 *
560da4b9651SBruce Richardson 	 * Valid when the device has @ref RTE_EVENT_DEV_CAP_QUEUE_QOS capability.
561da4b9651SBruce Richardson 	 *
562da4b9651SBruce Richardson 	 * The implementation shall normalize priority values specified between
563da4b9651SBruce Richardson 	 * @ref RTE_EVENT_DEV_PRIORITY_HIGHEST and @ref RTE_EVENT_DEV_PRIORITY_LOWEST
564da4b9651SBruce Richardson 	 * to map them internally to this range of priorities.
565da4b9651SBruce Richardson 	 * [For devices supporting a power-of-2 number of priority levels, this
566da4b9651SBruce Richardson 	 * normalization will be done via a right-shift operation, so only the top
567da4b9651SBruce Richardson 	 * log2(max_levels) bits will be used by the event device.]
568da4b9651SBruce Richardson 	 *
569da4b9651SBruce Richardson 	 * @see rte_event_queue_conf.priority
57099a2dd95SBruce Richardson 	 */
57199a2dd95SBruce Richardson 	uint8_t max_event_priority_levels;
57299a2dd95SBruce Richardson 	/**< Maximum number of event priority levels by this device.
573da4b9651SBruce Richardson 	 *
574da4b9651SBruce Richardson 	 * Valid when the device has @ref RTE_EVENT_DEV_CAP_EVENT_QOS capability.
575da4b9651SBruce Richardson 	 *
576da4b9651SBruce Richardson 	 * The implementation shall normalize priority values specified between
577da4b9651SBruce Richardson 	 * @ref RTE_EVENT_DEV_PRIORITY_HIGHEST and @ref RTE_EVENT_DEV_PRIORITY_LOWEST
578da4b9651SBruce Richardson 	 * to map them internally to this range of priorities.
579da4b9651SBruce Richardson 	 * [For devices supporting a power-of-2 number of priority levels, this
580da4b9651SBruce Richardson 	 * normalization will be done via a right-shift operation, so only the top
581da4b9651SBruce Richardson 	 * log2(max_levels) bits will be used by the event device.]
582da4b9651SBruce Richardson 	 *
583da4b9651SBruce Richardson 	 * @see rte_event.priority
58499a2dd95SBruce Richardson 	 */
58599a2dd95SBruce Richardson 	uint8_t max_event_ports;
586da4b9651SBruce Richardson 	/**< Maximum number of event ports supported by this device.
587da4b9651SBruce Richardson 	 *
588da4b9651SBruce Richardson 	 * This count excludes any ports covered by @ref max_single_link_event_port_queue_pairs.
589da4b9651SBruce Richardson 	 */
59099a2dd95SBruce Richardson 	uint8_t max_event_port_dequeue_depth;
591da4b9651SBruce Richardson 	/**< Maximum number of events that can be dequeued at a time from an event port
592da4b9651SBruce Richardson 	 * on this device.
593da4b9651SBruce Richardson 	 *
594da4b9651SBruce Richardson 	 * A device that does not support burst dequeue
595da4b9651SBruce Richardson 	 * (@ref RTE_EVENT_DEV_CAP_BURST_MODE) will set this to 1.
59699a2dd95SBruce Richardson 	 */
59799a2dd95SBruce Richardson 	uint32_t max_event_port_enqueue_depth;
598da4b9651SBruce Richardson 	/**< Maximum number of events that can be enqueued at a time to an event port
599da4b9651SBruce Richardson 	 * on this device.
600da4b9651SBruce Richardson 	 *
601da4b9651SBruce Richardson 	 * A device that does not support burst enqueue
602da4b9651SBruce Richardson 	 * (@ref RTE_EVENT_DEV_CAP_BURST_MODE) will set this to 1.
60399a2dd95SBruce Richardson 	 */
60499a2dd95SBruce Richardson 	uint8_t max_event_port_links;
605da4b9651SBruce Richardson 	/**< Maximum number of queues that can be linked to a single event port on this device.
60699a2dd95SBruce Richardson 	 */
60799a2dd95SBruce Richardson 	int32_t max_num_events;
60899a2dd95SBruce Richardson 	/**< A *closed system* event dev has a limit on the number of events it
609da4b9651SBruce Richardson 	 * can manage at a time.
610da4b9651SBruce Richardson 	 * Once the number of events tracked by an eventdev exceeds this number,
611da4b9651SBruce Richardson 	 * any enqueues of NEW events will fail.
612da4b9651SBruce Richardson 	 * An *open system* event dev does not have a limit and will specify this as -1.
61399a2dd95SBruce Richardson 	 */
61499a2dd95SBruce Richardson 	uint32_t event_dev_cap;
615da4b9651SBruce Richardson 	/**< Event device capabilities flags (RTE_EVENT_DEV_CAP_*). */
61699a2dd95SBruce Richardson 	uint8_t max_single_link_event_port_queue_pairs;
617da4b9651SBruce Richardson 	/**< Maximum number of event ports and queues, supported by this device,
618da4b9651SBruce Richardson 	 * that are optimized for (and only capable of) single-link configurations.
619da4b9651SBruce Richardson 	 * These ports and queues are not accounted for in @ref max_event_ports
620da4b9651SBruce Richardson 	 * or @ref max_event_queues.
62199a2dd95SBruce Richardson 	 */
622d007a7f3SPavan Nikhilesh 	uint8_t max_profiles_per_port;
623da4b9651SBruce Richardson 	/**< Maximum number of event queue link profiles per event port.
624d007a7f3SPavan Nikhilesh 	 * A device that doesn't support multiple profiles will set this as 1.
625d007a7f3SPavan Nikhilesh 	 */
62699a2dd95SBruce Richardson };
62799a2dd95SBruce Richardson 
62899a2dd95SBruce Richardson /**
629d77c9cbfSBruce Richardson  * Retrieve details of an event device's capabilities and configuration limits.
63099a2dd95SBruce Richardson  *
63199a2dd95SBruce Richardson  * @param dev_id
63299a2dd95SBruce Richardson  *   The identifier of the device.
63399a2dd95SBruce Richardson  *
63499a2dd95SBruce Richardson  * @param[out] dev_info
63599a2dd95SBruce Richardson  *   A pointer to a structure of type *rte_event_dev_info* to be filled with the
636d77c9cbfSBruce Richardson  *   information about the device's capabilities.
63799a2dd95SBruce Richardson  *
63899a2dd95SBruce Richardson  * @return
639d77c9cbfSBruce Richardson  *   - 0: Success, information about the event device is present in dev_info.
640d77c9cbfSBruce Richardson  *   - <0: Failure, error code returned by the function.
641d77c9cbfSBruce Richardson  *     - -EINVAL - invalid input parameters, e.g. incorrect device id.
642d77c9cbfSBruce Richardson  *     - -ENOTSUP - device does not support returning capabilities information.
64399a2dd95SBruce Richardson  */
64499a2dd95SBruce Richardson int
64599a2dd95SBruce Richardson rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info);
64699a2dd95SBruce Richardson 
64799a2dd95SBruce Richardson /**
64899a2dd95SBruce Richardson  * The count of ports.
64999a2dd95SBruce Richardson  */
65099a2dd95SBruce Richardson #define RTE_EVENT_DEV_ATTR_PORT_COUNT 0
65199a2dd95SBruce Richardson /**
65299a2dd95SBruce Richardson  * The count of queues.
65399a2dd95SBruce Richardson  */
65499a2dd95SBruce Richardson #define RTE_EVENT_DEV_ATTR_QUEUE_COUNT 1
65599a2dd95SBruce Richardson /**
65699a2dd95SBruce Richardson  * The status of the device, zero for stopped, non-zero for started.
65799a2dd95SBruce Richardson  */
65899a2dd95SBruce Richardson #define RTE_EVENT_DEV_ATTR_STARTED 2
65999a2dd95SBruce Richardson 
66099a2dd95SBruce Richardson /**
66199a2dd95SBruce Richardson  * Get an attribute from a device.
66299a2dd95SBruce Richardson  *
66399a2dd95SBruce Richardson  * @param dev_id Eventdev id
66499a2dd95SBruce Richardson  * @param attr_id The attribute ID to retrieve
66599a2dd95SBruce Richardson  * @param[out] attr_value A pointer that will be filled in with the attribute
66699a2dd95SBruce Richardson  *             value if successful.
66799a2dd95SBruce Richardson  *
66899a2dd95SBruce Richardson  * @return
66999a2dd95SBruce Richardson  *   - 0: Successfully retrieved attribute value
67099a2dd95SBruce Richardson  *   - -EINVAL: Invalid device or  *attr_id* provided, or *attr_value* is NULL
67199a2dd95SBruce Richardson  */
67299a2dd95SBruce Richardson int
67399a2dd95SBruce Richardson rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
67499a2dd95SBruce Richardson 		       uint32_t *attr_value);
67599a2dd95SBruce Richardson 
67699a2dd95SBruce Richardson 
67799a2dd95SBruce Richardson /* Event device configuration bitmap flags */
67899a2dd95SBruce Richardson #define RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT (1ULL << 0)
67999a2dd95SBruce Richardson /**< Override the global *dequeue_timeout_ns* and use per dequeue timeout in ns.
68099a2dd95SBruce Richardson  *  @see rte_event_dequeue_timeout_ticks(), rte_event_dequeue_burst()
68199a2dd95SBruce Richardson  */
68299a2dd95SBruce Richardson 
68399a2dd95SBruce Richardson /** Event device configuration structure */
68499a2dd95SBruce Richardson struct rte_event_dev_config {
68599a2dd95SBruce Richardson 	uint32_t dequeue_timeout_ns;
68699a2dd95SBruce Richardson 	/**< rte_event_dequeue_burst() timeout on this device.
6871203462cSBruce Richardson 	 * This value should be in the range of @ref rte_event_dev_info.min_dequeue_timeout_ns and
6881203462cSBruce Richardson 	 * @ref rte_event_dev_info.max_dequeue_timeout_ns returned by
6891203462cSBruce Richardson 	 * @ref rte_event_dev_info_get()
69099a2dd95SBruce Richardson 	 * The value 0 is allowed, in which case, default dequeue timeout used.
69199a2dd95SBruce Richardson 	 * @see RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT
69299a2dd95SBruce Richardson 	 */
69399a2dd95SBruce Richardson 	int32_t nb_events_limit;
69499a2dd95SBruce Richardson 	/**< In a *closed system* this field is the limit on maximum number of
69599a2dd95SBruce Richardson 	 * events that can be inflight in the eventdev at a given time. The
69699a2dd95SBruce Richardson 	 * limit is required to ensure that the finite space in a closed system
6971203462cSBruce Richardson 	 * is not exhausted.
6981203462cSBruce Richardson 	 * The value cannot exceed @ref rte_event_dev_info.max_num_events
6991203462cSBruce Richardson 	 * returned by rte_event_dev_info_get().
7001203462cSBruce Richardson 	 *
7011203462cSBruce Richardson 	 * This value should be set to -1 for *open systems*, that is,
7021203462cSBruce Richardson 	 * those systems returning -1 in @ref rte_event_dev_info.max_num_events.
7031203462cSBruce Richardson 	 *
7041203462cSBruce Richardson 	 * @see rte_event_port_conf.new_event_threshold
70599a2dd95SBruce Richardson 	 */
70699a2dd95SBruce Richardson 	uint8_t nb_event_queues;
70799a2dd95SBruce Richardson 	/**< Number of event queues to configure on this device.
7081203462cSBruce Richardson 	 * This value *includes* any single-link queue-port pairs to be used.
7091203462cSBruce Richardson 	 * This value cannot exceed @ref rte_event_dev_info.max_event_queues +
7101203462cSBruce Richardson 	 * @ref rte_event_dev_info.max_single_link_event_port_queue_pairs
7111203462cSBruce Richardson 	 * returned by rte_event_dev_info_get().
7121203462cSBruce Richardson 	 * The number of non-single-link queues i.e. this value less
7131203462cSBruce Richardson 	 * *nb_single_link_event_port_queues* in this struct, cannot exceed
7141203462cSBruce Richardson 	 * @ref rte_event_dev_info.max_event_queues
71599a2dd95SBruce Richardson 	 */
71699a2dd95SBruce Richardson 	uint8_t nb_event_ports;
71799a2dd95SBruce Richardson 	/**< Number of event ports to configure on this device.
7181203462cSBruce Richardson 	 * This value *includes* any single-link queue-port pairs to be used.
7191203462cSBruce Richardson 	 * This value cannot exceed @ref rte_event_dev_info.max_event_ports +
7201203462cSBruce Richardson 	 * @ref rte_event_dev_info.max_single_link_event_port_queue_pairs
7211203462cSBruce Richardson 	 * returned by rte_event_dev_info_get().
7221203462cSBruce Richardson 	 * The number of non-single-link ports i.e. this value less
7231203462cSBruce Richardson 	 * *nb_single_link_event_port_queues* in this struct, cannot exceed
7241203462cSBruce Richardson 	 * @ref rte_event_dev_info.max_event_ports
72599a2dd95SBruce Richardson 	 */
72699a2dd95SBruce Richardson 	uint32_t nb_event_queue_flows;
7271203462cSBruce Richardson 	/**< Max number of flows needed for a single event queue on this device.
7281203462cSBruce Richardson 	 * This value cannot exceed @ref rte_event_dev_info.max_event_queue_flows
7291203462cSBruce Richardson 	 * returned by rte_event_dev_info_get()
73099a2dd95SBruce Richardson 	 */
73199a2dd95SBruce Richardson 	uint32_t nb_event_port_dequeue_depth;
7321203462cSBruce Richardson 	/**< Max number of events that can be dequeued at a time from an event port on this device.
7331203462cSBruce Richardson 	 * This value cannot exceed @ref rte_event_dev_info.max_event_port_dequeue_depth
7341203462cSBruce Richardson 	 * returned by rte_event_dev_info_get().
73599a2dd95SBruce Richardson 	 * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
7361203462cSBruce Richardson 	 * @see rte_event_port_setup() rte_event_dequeue_burst()
73799a2dd95SBruce Richardson 	 */
73899a2dd95SBruce Richardson 	uint32_t nb_event_port_enqueue_depth;
7391203462cSBruce Richardson 	/**< Maximum number of events can be enqueued at a time to an event port on this device.
7401203462cSBruce Richardson 	 * This value cannot exceed @ref rte_event_dev_info.max_event_port_enqueue_depth
7411203462cSBruce Richardson 	 * returned by rte_event_dev_info_get().
74299a2dd95SBruce Richardson 	 * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
7431203462cSBruce Richardson 	 * @see rte_event_port_setup() rte_event_enqueue_burst()
74499a2dd95SBruce Richardson 	 */
74599a2dd95SBruce Richardson 	uint32_t event_dev_cfg;
74699a2dd95SBruce Richardson 	/**< Event device config flags(RTE_EVENT_DEV_CFG_)*/
74799a2dd95SBruce Richardson 	uint8_t nb_single_link_event_port_queues;
74899a2dd95SBruce Richardson 	/**< Number of event ports and queues that will be singly-linked to
74999a2dd95SBruce Richardson 	 * each other. These are a subset of the overall event ports and
75099a2dd95SBruce Richardson 	 * queues; this value cannot exceed *nb_event_ports* or
75199a2dd95SBruce Richardson 	 * *nb_event_queues*. If the device has ports and queues that are
75299a2dd95SBruce Richardson 	 * optimized for single-link usage, this field is a hint for how many
7531203462cSBruce Richardson 	 * to allocate; otherwise, regular event ports and queues will be used.
75499a2dd95SBruce Richardson 	 */
75599a2dd95SBruce Richardson };
75699a2dd95SBruce Richardson 
75799a2dd95SBruce Richardson /**
75899a2dd95SBruce Richardson  * Configure an event device.
75999a2dd95SBruce Richardson  *
760e48762b3SBruce Richardson  * This function must be invoked before any other configuration function in the
761e48762b3SBruce Richardson  * API, when preparing an event device for application use.
762e48762b3SBruce Richardson  * This function can also be re-invoked when a device is in the stopped state.
76399a2dd95SBruce Richardson  *
764e48762b3SBruce Richardson  * The caller should use rte_event_dev_info_get() to get the capabilities and
765e48762b3SBruce Richardson  * resource limits for this event device before calling this API.
766e48762b3SBruce Richardson  * Many values in the dev_conf input parameter are subject to limits given
767e48762b3SBruce Richardson  * in the device information returned from rte_event_dev_info_get().
76899a2dd95SBruce Richardson  *
76999a2dd95SBruce Richardson  * @param dev_id
77099a2dd95SBruce Richardson  *   The identifier of the device to configure.
77199a2dd95SBruce Richardson  * @param dev_conf
77299a2dd95SBruce Richardson  *   The event device configuration structure.
77399a2dd95SBruce Richardson  *
77499a2dd95SBruce Richardson  * @return
77599a2dd95SBruce Richardson  *   - 0: Success, device configured.
77699a2dd95SBruce Richardson  *   - <0: Error code returned by the driver configuration function.
777e48762b3SBruce Richardson  *     - -ENOTSUP - device does not support configuration.
778e48762b3SBruce Richardson  *     - -EINVAL  - invalid input parameter.
779e48762b3SBruce Richardson  *     - -EBUSY   - device has already been started.
78099a2dd95SBruce Richardson  */
78199a2dd95SBruce Richardson int
78299a2dd95SBruce Richardson rte_event_dev_configure(uint8_t dev_id,
78399a2dd95SBruce Richardson 			const struct rte_event_dev_config *dev_conf);
78499a2dd95SBruce Richardson 
78599a2dd95SBruce Richardson /* Event queue specific APIs */
78699a2dd95SBruce Richardson 
78799a2dd95SBruce Richardson /* Event queue configuration bitmap flags */
78899a2dd95SBruce Richardson #define RTE_EVENT_QUEUE_CFG_ALL_TYPES          (1ULL << 0)
789e48762b3SBruce Richardson /**< Allow events with schedule types ATOMIC, ORDERED, and PARALLEL to be enqueued to this queue.
79099a2dd95SBruce Richardson  *
791e48762b3SBruce Richardson  * The scheduling type to be used is that specified in each individual event.
792e48762b3SBruce Richardson  * This flag can only be set when configuring queues on devices reporting the
793e48762b3SBruce Richardson  * @ref RTE_EVENT_DEV_CAP_QUEUE_ALL_TYPES capability.
794e48762b3SBruce Richardson  *
795e48762b3SBruce Richardson  * Without this flag, only events with the specific scheduling type configured at queue setup
796e48762b3SBruce Richardson  * can be sent to the queue.
797e48762b3SBruce Richardson  *
798e48762b3SBruce Richardson  * @see RTE_EVENT_DEV_CAP_QUEUE_ALL_TYPES
79999a2dd95SBruce Richardson  * @see RTE_SCHED_TYPE_ORDERED, RTE_SCHED_TYPE_ATOMIC, RTE_SCHED_TYPE_PARALLEL
80099a2dd95SBruce Richardson  * @see rte_event_enqueue_burst()
80199a2dd95SBruce Richardson  */
80299a2dd95SBruce Richardson #define RTE_EVENT_QUEUE_CFG_SINGLE_LINK        (1ULL << 1)
80399a2dd95SBruce Richardson /**< This event queue links only to a single event port.
80499a2dd95SBruce Richardson  *
805e48762b3SBruce Richardson  * No load-balancing of events is performed, as all events
806e48762b3SBruce Richardson  * sent to this queue end up at the same event port.
807e48762b3SBruce Richardson  * The number of queues on which this flag is to be set must be
808e48762b3SBruce Richardson  * configured at device configuration time, by setting
809e48762b3SBruce Richardson  * @ref rte_event_dev_config.nb_single_link_event_port_queues
810e48762b3SBruce Richardson  * parameter appropriately.
811e48762b3SBruce Richardson  *
812e48762b3SBruce Richardson  * This flag serves as a hint only, any devices without specific
813e48762b3SBruce Richardson  * support for single-link queues can fall-back automatically to
814e48762b3SBruce Richardson  * using regular queues with a single destination port.
815e48762b3SBruce Richardson  *
816e48762b3SBruce Richardson  *  @see rte_event_dev_info.max_single_link_event_port_queue_pairs
817e48762b3SBruce Richardson  *  @see rte_event_dev_config.nb_single_link_event_port_queues
81899a2dd95SBruce Richardson  *  @see rte_event_port_setup(), rte_event_port_link()
81999a2dd95SBruce Richardson  */
82099a2dd95SBruce Richardson 
82199a2dd95SBruce Richardson /** Event queue configuration structure */
82299a2dd95SBruce Richardson struct rte_event_queue_conf {
82399a2dd95SBruce Richardson 	uint32_t nb_atomic_flows;
82499a2dd95SBruce Richardson 	/**< The maximum number of active flows this queue can track at any
825e48762b3SBruce Richardson 	 * given time.
826e48762b3SBruce Richardson 	 *
827e48762b3SBruce Richardson 	 * If the queue is configured for atomic scheduling (by
828e48762b3SBruce Richardson 	 * applying the @ref RTE_EVENT_QUEUE_CFG_ALL_TYPES flag to
829e48762b3SBruce Richardson 	 * @ref rte_event_queue_conf.event_queue_cfg
830e48762b3SBruce Richardson 	 * or @ref RTE_SCHED_TYPE_ATOMIC flag to @ref rte_event_queue_conf.schedule_type), then the
831e48762b3SBruce Richardson 	 * value must be in the range of [1, @ref rte_event_dev_config.nb_event_queue_flows],
832e48762b3SBruce Richardson 	 * which was previously provided in rte_event_dev_configure().
833e48762b3SBruce Richardson 	 *
834e48762b3SBruce Richardson 	 * If the queue is not configured for atomic scheduling this value is ignored.
83599a2dd95SBruce Richardson 	 */
83699a2dd95SBruce Richardson 	uint32_t nb_atomic_order_sequences;
83799a2dd95SBruce Richardson 	/**< The maximum number of outstanding events waiting to be
83899a2dd95SBruce Richardson 	 * reordered by this queue. In other words, the number of entries in
83999a2dd95SBruce Richardson 	 * this queue’s reorder buffer. When the number of events in the
84099a2dd95SBruce Richardson 	 * reorder buffer reaches to *nb_atomic_order_sequences* then the
841e48762b3SBruce Richardson 	 * scheduler cannot schedule the events from this queue and no
842e48762b3SBruce Richardson 	 * events will be returned from dequeue until one or more entries are
84399a2dd95SBruce Richardson 	 * freed up/released.
844e48762b3SBruce Richardson 	 *
84599a2dd95SBruce Richardson 	 * If the queue is configured for ordered scheduling (by applying the
846e48762b3SBruce Richardson 	 * @ref RTE_EVENT_QUEUE_CFG_ALL_TYPES flag to @ref rte_event_queue_conf.event_queue_cfg or
847e48762b3SBruce Richardson 	 * @ref RTE_SCHED_TYPE_ORDERED flag to @ref rte_event_queue_conf.schedule_type),
848e48762b3SBruce Richardson 	 * then the value must be in the range of
849e48762b3SBruce Richardson 	 * [1, @ref rte_event_dev_config.nb_event_queue_flows], which was
85099a2dd95SBruce Richardson 	 * previously supplied to rte_event_dev_configure().
851e48762b3SBruce Richardson 	 *
852e48762b3SBruce Richardson 	 * If the queue is not configured for ordered scheduling, then this value is ignored.
85399a2dd95SBruce Richardson 	 */
85499a2dd95SBruce Richardson 	uint32_t event_queue_cfg;
85599a2dd95SBruce Richardson 	/**< Queue cfg flags(EVENT_QUEUE_CFG_) */
85699a2dd95SBruce Richardson 	uint8_t schedule_type;
85799a2dd95SBruce Richardson 	/**< Queue schedule type(RTE_SCHED_TYPE_*).
858e48762b3SBruce Richardson 	 *
859e48762b3SBruce Richardson 	 * Valid when @ref RTE_EVENT_QUEUE_CFG_ALL_TYPES flag is not set in
860e48762b3SBruce Richardson 	 * @ref rte_event_queue_conf.event_queue_cfg.
861e48762b3SBruce Richardson 	 *
862e48762b3SBruce Richardson 	 * If the @ref RTE_EVENT_QUEUE_CFG_ALL_TYPES flag is set, then this field is ignored.
863e48762b3SBruce Richardson 	 *
864e48762b3SBruce Richardson 	 * @see RTE_SCHED_TYPE_ORDERED, RTE_SCHED_TYPE_ATOMIC, RTE_SCHED_TYPE_PARALLEL
86599a2dd95SBruce Richardson 	 */
86699a2dd95SBruce Richardson 	uint8_t priority;
86799a2dd95SBruce Richardson 	/**< Priority for this event queue relative to other event queues.
868e48762b3SBruce Richardson 	 *
86999a2dd95SBruce Richardson 	 * The requested priority should in the range of
870e48762b3SBruce Richardson 	 * [@ref RTE_EVENT_DEV_PRIORITY_HIGHEST, @ref RTE_EVENT_DEV_PRIORITY_LOWEST].
87199a2dd95SBruce Richardson 	 * The implementation shall normalize the requested priority to
87299a2dd95SBruce Richardson 	 * event device supported priority value.
873e48762b3SBruce Richardson 	 *
874e48762b3SBruce Richardson 	 * Valid when the device has @ref RTE_EVENT_DEV_CAP_QUEUE_QOS capability,
875e48762b3SBruce Richardson 	 * ignored otherwise
87699a2dd95SBruce Richardson 	 */
8772f279a1bSShijith Thotton 	uint8_t weight;
8782f279a1bSShijith Thotton 	/**< Weight of the event queue relative to other event queues.
879e48762b3SBruce Richardson 	 *
8802f279a1bSShijith Thotton 	 * The requested weight should be in the range of
881e48762b3SBruce Richardson 	 * [@ref RTE_EVENT_QUEUE_WEIGHT_HIGHEST, @ref RTE_EVENT_QUEUE_WEIGHT_LOWEST].
8822f279a1bSShijith Thotton 	 * The implementation shall normalize the requested weight to event
8832f279a1bSShijith Thotton 	 * device supported weight value.
884e48762b3SBruce Richardson 	 *
885e48762b3SBruce Richardson 	 * Valid when the device has @ref RTE_EVENT_DEV_CAP_QUEUE_QOS capability,
886e48762b3SBruce Richardson 	 * ignored otherwise.
8872f279a1bSShijith Thotton 	 */
8882f279a1bSShijith Thotton 	uint8_t affinity;
8892f279a1bSShijith Thotton 	/**< Affinity of the event queue relative to other event queues.
890e48762b3SBruce Richardson 	 *
8912f279a1bSShijith Thotton 	 * The requested affinity should be in the range of
892e48762b3SBruce Richardson 	 * [@ref RTE_EVENT_QUEUE_AFFINITY_HIGHEST, @ref RTE_EVENT_QUEUE_AFFINITY_LOWEST].
8932f279a1bSShijith Thotton 	 * The implementation shall normalize the requested affinity to event
8942f279a1bSShijith Thotton 	 * device supported affinity value.
895e48762b3SBruce Richardson 	 *
896e48762b3SBruce Richardson 	 * Valid when the device has @ref RTE_EVENT_DEV_CAP_QUEUE_QOS capability,
897e48762b3SBruce Richardson 	 * ignored otherwise.
8982f279a1bSShijith Thotton 	 */
89999a2dd95SBruce Richardson };
90099a2dd95SBruce Richardson 
90199a2dd95SBruce Richardson /**
90299a2dd95SBruce Richardson  * Retrieve the default configuration information of an event queue designated
90399a2dd95SBruce Richardson  * by its *queue_id* from the event driver for an event device.
90499a2dd95SBruce Richardson  *
90599a2dd95SBruce Richardson  * This function intended to be used in conjunction with rte_event_queue_setup()
90699a2dd95SBruce Richardson  * where caller needs to set up the queue by overriding few default values.
90799a2dd95SBruce Richardson  *
90899a2dd95SBruce Richardson  * @param dev_id
90999a2dd95SBruce Richardson  *   The identifier of the device.
91099a2dd95SBruce Richardson  * @param queue_id
91199a2dd95SBruce Richardson  *   The index of the event queue to get the configuration information.
912e48762b3SBruce Richardson  *   The value must be less than @ref rte_event_dev_config.nb_event_queues
91399a2dd95SBruce Richardson  *   previously supplied to rte_event_dev_configure().
91499a2dd95SBruce Richardson  * @param[out] queue_conf
91599a2dd95SBruce Richardson  *   The pointer to the default event queue configuration data.
91699a2dd95SBruce Richardson  * @return
91799a2dd95SBruce Richardson  *   - 0: Success, driver updates the default event queue configuration data.
91899a2dd95SBruce Richardson  *   - <0: Error code returned by the driver info get function.
91999a2dd95SBruce Richardson  *
92099a2dd95SBruce Richardson  * @see rte_event_queue_setup()
92199a2dd95SBruce Richardson  */
92299a2dd95SBruce Richardson int
92399a2dd95SBruce Richardson rte_event_queue_default_conf_get(uint8_t dev_id, uint8_t queue_id,
92499a2dd95SBruce Richardson 				 struct rte_event_queue_conf *queue_conf);
92599a2dd95SBruce Richardson 
92699a2dd95SBruce Richardson /**
92799a2dd95SBruce Richardson  * Allocate and set up an event queue for an event device.
92899a2dd95SBruce Richardson  *
92999a2dd95SBruce Richardson  * @param dev_id
93099a2dd95SBruce Richardson  *   The identifier of the device.
93199a2dd95SBruce Richardson  * @param queue_id
932e48762b3SBruce Richardson  *   The index of the event queue to setup. The value must be
933e48762b3SBruce Richardson  *   less than @ref rte_event_dev_config.nb_event_queues previously supplied to
934e48762b3SBruce Richardson  *   rte_event_dev_configure().
93599a2dd95SBruce Richardson  * @param queue_conf
93699a2dd95SBruce Richardson  *   The pointer to the configuration data to be used for the event queue.
93799a2dd95SBruce Richardson  *   NULL value is allowed, in which case default configuration	used.
93899a2dd95SBruce Richardson  *
93999a2dd95SBruce Richardson  * @see rte_event_queue_default_conf_get()
94099a2dd95SBruce Richardson  *
94199a2dd95SBruce Richardson  * @return
94299a2dd95SBruce Richardson  *   - 0: Success, event queue correctly set up.
943e48762b3SBruce Richardson  *   - <0: event queue configuration failed.
94499a2dd95SBruce Richardson  */
94599a2dd95SBruce Richardson int
94699a2dd95SBruce Richardson rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
94799a2dd95SBruce Richardson 		      const struct rte_event_queue_conf *queue_conf);
94899a2dd95SBruce Richardson 
94999a2dd95SBruce Richardson /**
950e48762b3SBruce Richardson  * Queue attribute id for the priority of the queue.
95199a2dd95SBruce Richardson  */
95299a2dd95SBruce Richardson #define RTE_EVENT_QUEUE_ATTR_PRIORITY 0
95399a2dd95SBruce Richardson /**
954e48762b3SBruce Richardson  * Queue attribute id for the number of atomic flows configured for the queue.
95599a2dd95SBruce Richardson  */
95699a2dd95SBruce Richardson #define RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_FLOWS 1
95799a2dd95SBruce Richardson /**
958e48762b3SBruce Richardson  * Queue attribute id for the number of atomic order sequences configured for the queue.
95999a2dd95SBruce Richardson  */
96099a2dd95SBruce Richardson #define RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_ORDER_SEQUENCES 2
96199a2dd95SBruce Richardson /**
962e48762b3SBruce Richardson  * Queue attribute id for the configuration flags for the queue.
96399a2dd95SBruce Richardson  */
96499a2dd95SBruce Richardson #define RTE_EVENT_QUEUE_ATTR_EVENT_QUEUE_CFG 3
96599a2dd95SBruce Richardson /**
966e48762b3SBruce Richardson  * Queue attribute id for the schedule type of the queue.
96799a2dd95SBruce Richardson  */
96899a2dd95SBruce Richardson #define RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE 4
96944516e6bSShijith Thotton /**
970e48762b3SBruce Richardson  * Queue attribute id for the weight of the queue.
97144516e6bSShijith Thotton  */
97244516e6bSShijith Thotton #define RTE_EVENT_QUEUE_ATTR_WEIGHT 5
97344516e6bSShijith Thotton /**
974e48762b3SBruce Richardson  * Queue attribute id for the affinity of the queue.
97544516e6bSShijith Thotton  */
97644516e6bSShijith Thotton #define RTE_EVENT_QUEUE_ATTR_AFFINITY 6
97799a2dd95SBruce Richardson 
97899a2dd95SBruce Richardson /**
979e48762b3SBruce Richardson  * Get an attribute of an event queue.
98099a2dd95SBruce Richardson  *
98199a2dd95SBruce Richardson  * @param dev_id
982e48762b3SBruce Richardson  *   The identifier of the device.
98399a2dd95SBruce Richardson  * @param queue_id
984e48762b3SBruce Richardson  *   The index of the event queue to query. The value must be less than
985e48762b3SBruce Richardson  *   @ref rte_event_dev_config.nb_event_queues previously supplied to rte_event_dev_configure().
98699a2dd95SBruce Richardson  * @param attr_id
987e48762b3SBruce Richardson  *   The attribute ID to retrieve (RTE_EVENT_QUEUE_ATTR_*).
98899a2dd95SBruce Richardson  * @param[out] attr_value
989e48762b3SBruce Richardson  *   A pointer that will be filled in with the attribute value if successful.
99099a2dd95SBruce Richardson  *
99199a2dd95SBruce Richardson  * @return
99299a2dd95SBruce Richardson  *   - 0: Successfully returned value
993e48762b3SBruce Richardson  *   - -EINVAL: invalid device, queue or attr_id provided, or attr_value was NULL.
99499a2dd95SBruce Richardson  *   - -EOVERFLOW: returned when attr_id is set to
995e48762b3SBruce Richardson  *   @ref RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE and @ref RTE_EVENT_QUEUE_CFG_ALL_TYPES is
996e48762b3SBruce Richardson  *   set in the queue configuration flags.
99799a2dd95SBruce Richardson  */
99899a2dd95SBruce Richardson int
99999a2dd95SBruce Richardson rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
100099a2dd95SBruce Richardson 			uint32_t *attr_value);
100199a2dd95SBruce Richardson 
100297b914f4SShijith Thotton /**
100397b914f4SShijith Thotton  * Set an event queue attribute.
100497b914f4SShijith Thotton  *
100597b914f4SShijith Thotton  * @param dev_id
1006e48762b3SBruce Richardson  *   The identifier of the device.
100797b914f4SShijith Thotton  * @param queue_id
1008e48762b3SBruce Richardson  *   The index of the event queue to configure. The value must be less than
1009e48762b3SBruce Richardson  *   @ref rte_event_dev_config.nb_event_queues previously supplied to rte_event_dev_configure().
101097b914f4SShijith Thotton  * @param attr_id
1011e48762b3SBruce Richardson  *   The attribute ID to set (RTE_EVENT_QUEUE_ATTR_*).
101297b914f4SShijith Thotton  * @param attr_value
1013e48762b3SBruce Richardson  *   The attribute value to set.
101497b914f4SShijith Thotton  *
101597b914f4SShijith Thotton  * @return
101697b914f4SShijith Thotton  *   - 0: Successfully set attribute.
1017e48762b3SBruce Richardson  *   - <0: failed to set event queue attribute.
101897b914f4SShijith Thotton  *   -   -EINVAL: invalid device, queue or attr_id.
101997b914f4SShijith Thotton  *   -   -ENOTSUP: device does not support setting the event attribute.
102097b914f4SShijith Thotton  */
102197b914f4SShijith Thotton int
102297b914f4SShijith Thotton rte_event_queue_attr_set(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
102397b914f4SShijith Thotton 			 uint64_t attr_value);
102497b914f4SShijith Thotton 
102599a2dd95SBruce Richardson /* Event port specific APIs */
102699a2dd95SBruce Richardson 
102799a2dd95SBruce Richardson /* Event port configuration bitmap flags */
102899a2dd95SBruce Richardson #define RTE_EVENT_PORT_CFG_DISABLE_IMPL_REL    (1ULL << 0)
102999a2dd95SBruce Richardson /**< Configure the port not to release outstanding events in
103099a2dd95SBruce Richardson  * rte_event_dev_dequeue_burst(). If set, all events received through
103199a2dd95SBruce Richardson  * the port must be explicitly released with RTE_EVENT_OP_RELEASE or
103299a2dd95SBruce Richardson  * RTE_EVENT_OP_FORWARD. Must be unset if the device is not
103399a2dd95SBruce Richardson  * RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE capable.
103499a2dd95SBruce Richardson  */
103599a2dd95SBruce Richardson #define RTE_EVENT_PORT_CFG_SINGLE_LINK         (1ULL << 1)
103699a2dd95SBruce Richardson /**< This event port links only to a single event queue.
1037e48762b3SBruce Richardson  * The queue it links with should be similarly configured with the
1038e48762b3SBruce Richardson  * @ref RTE_EVENT_QUEUE_CFG_SINGLE_LINK flag.
103999a2dd95SBruce Richardson  *
1040e48762b3SBruce Richardson  *  @see RTE_EVENT_QUEUE_CFG_SINGLE_LINK
104199a2dd95SBruce Richardson  *  @see rte_event_port_setup(), rte_event_port_link()
104299a2dd95SBruce Richardson  */
104397632958SHarry van Haaren #define RTE_EVENT_PORT_CFG_HINT_PRODUCER       (1ULL << 2)
104497632958SHarry van Haaren /**< Hint that this event port will primarily enqueue events to the system.
104597632958SHarry van Haaren  * A PMD can optimize its internal workings by assuming that this port is
104697632958SHarry van Haaren  * primarily going to enqueue NEW events.
104797632958SHarry van Haaren  *
104897632958SHarry van Haaren  * Note that this flag is only a hint, so PMDs must operate under the
104997632958SHarry van Haaren  * assumption that any port can enqueue an event with any type of op.
105097632958SHarry van Haaren  *
105197632958SHarry van Haaren  *  @see rte_event_port_setup()
105297632958SHarry van Haaren  */
105397632958SHarry van Haaren #define RTE_EVENT_PORT_CFG_HINT_CONSUMER       (1ULL << 3)
105497632958SHarry van Haaren /**< Hint that this event port will primarily dequeue events from the system.
105597632958SHarry van Haaren  * A PMD can optimize its internal workings by assuming that this port is
1056e48762b3SBruce Richardson  * primarily going to consume events, and not enqueue NEW or FORWARD
105797632958SHarry van Haaren  * events.
105897632958SHarry van Haaren  *
105997632958SHarry van Haaren  * Note that this flag is only a hint, so PMDs must operate under the
106097632958SHarry van Haaren  * assumption that any port can enqueue an event with any type of op.
106197632958SHarry van Haaren  *
106297632958SHarry van Haaren  *  @see rte_event_port_setup()
106397632958SHarry van Haaren  */
106497632958SHarry van Haaren #define RTE_EVENT_PORT_CFG_HINT_WORKER         (1ULL << 4)
106597632958SHarry van Haaren /**< Hint that this event port will primarily pass existing events through.
106697632958SHarry van Haaren  * A PMD can optimize its internal workings by assuming that this port is
106797632958SHarry van Haaren  * primarily going to FORWARD events, and not enqueue NEW or RELEASE events
106897632958SHarry van Haaren  * often.
106997632958SHarry van Haaren  *
107097632958SHarry van Haaren  * Note that this flag is only a hint, so PMDs must operate under the
107197632958SHarry van Haaren  * assumption that any port can enqueue an event with any type of op.
107297632958SHarry van Haaren  *
107397632958SHarry van Haaren  *  @see rte_event_port_setup()
107497632958SHarry van Haaren  */
107599a2dd95SBruce Richardson 
107699a2dd95SBruce Richardson /** Event port configuration structure */
107799a2dd95SBruce Richardson struct rte_event_port_conf {
107899a2dd95SBruce Richardson 	int32_t new_event_threshold;
107999a2dd95SBruce Richardson 	/**< A backpressure threshold for new event enqueues on this port.
108099a2dd95SBruce Richardson 	 * Use for *closed system* event dev where event capacity is limited,
108199a2dd95SBruce Richardson 	 * and cannot exceed the capacity of the event dev.
1082e48762b3SBruce Richardson 	 *
108399a2dd95SBruce Richardson 	 * Configuring ports with different thresholds can make higher priority
108499a2dd95SBruce Richardson 	 * traffic less likely to  be backpressured.
108599a2dd95SBruce Richardson 	 * For example, a port used to inject NIC Rx packets into the event dev
108699a2dd95SBruce Richardson 	 * can have a lower threshold so as not to overwhelm the device,
108799a2dd95SBruce Richardson 	 * while ports used for worker pools can have a higher threshold.
1088e48762b3SBruce Richardson 	 * This value cannot exceed the @ref rte_event_dev_config.nb_events_limit value
108999a2dd95SBruce Richardson 	 * which was previously supplied to rte_event_dev_configure().
1090e48762b3SBruce Richardson 	 *
1091e48762b3SBruce Richardson 	 * This should be set to '-1' for *open system*, i.e when
1092e48762b3SBruce Richardson 	 * @ref rte_event_dev_info.max_num_events == -1.
109399a2dd95SBruce Richardson 	 */
109499a2dd95SBruce Richardson 	uint16_t dequeue_depth;
1095e48762b3SBruce Richardson 	/**< Configure the maximum size of burst dequeues for this event port.
1096e48762b3SBruce Richardson 	 * This value cannot exceed the @ref rte_event_dev_config.nb_event_port_dequeue_depth value
1097e48762b3SBruce Richardson 	 * which was previously supplied to rte_event_dev_configure().
1098e48762b3SBruce Richardson 	 *
1099e48762b3SBruce Richardson 	 * Ignored when device does not support the @ref RTE_EVENT_DEV_CAP_BURST_MODE capability.
110099a2dd95SBruce Richardson 	 */
110199a2dd95SBruce Richardson 	uint16_t enqueue_depth;
1102e48762b3SBruce Richardson 	/**< Configure the maximum size of burst enqueues to this event port.
1103e48762b3SBruce Richardson 	 * This value cannot exceed the @ref rte_event_dev_config.nb_event_port_enqueue_depth value
1104e48762b3SBruce Richardson 	 * which was previously supplied to rte_event_dev_configure().
1105e48762b3SBruce Richardson 	 *
1106e48762b3SBruce Richardson 	 * Ignored when device does not support the @ref RTE_EVENT_DEV_CAP_BURST_MODE capability.
110799a2dd95SBruce Richardson 	 */
1108e48762b3SBruce Richardson 	uint32_t event_port_cfg; /**< Port configuration flags(EVENT_PORT_CFG_) */
110999a2dd95SBruce Richardson };
111099a2dd95SBruce Richardson 
111199a2dd95SBruce Richardson /**
111299a2dd95SBruce Richardson  * Retrieve the default configuration information of an event port designated
111399a2dd95SBruce Richardson  * by its *port_id* from the event driver for an event device.
111499a2dd95SBruce Richardson  *
1115e48762b3SBruce Richardson  * This function is intended to be used in conjunction with rte_event_port_setup()
1116e48762b3SBruce Richardson  * where the caller can set up the port by just overriding few default values.
111799a2dd95SBruce Richardson  *
111899a2dd95SBruce Richardson  * @param dev_id
111999a2dd95SBruce Richardson  *   The identifier of the device.
112099a2dd95SBruce Richardson  * @param port_id
112199a2dd95SBruce Richardson  *   The index of the event port to get the configuration information.
1122e48762b3SBruce Richardson  *   The value must be less than @ref rte_event_dev_config.nb_event_ports
112399a2dd95SBruce Richardson  *   previously supplied to rte_event_dev_configure().
112499a2dd95SBruce Richardson  * @param[out] port_conf
1125e48762b3SBruce Richardson  *   The pointer to a structure to store the default event port configuration data.
112699a2dd95SBruce Richardson  * @return
112799a2dd95SBruce Richardson  *   - 0: Success, driver updates the default event port configuration data.
112899a2dd95SBruce Richardson  *   - <0: Error code returned by the driver info get function.
1129e48762b3SBruce Richardson  *      - -EINVAL - invalid input parameter.
1130e48762b3SBruce Richardson  *      - -ENOTSUP - function is not supported for this device.
113199a2dd95SBruce Richardson  *
113299a2dd95SBruce Richardson  * @see rte_event_port_setup()
113399a2dd95SBruce Richardson  */
113499a2dd95SBruce Richardson int
113599a2dd95SBruce Richardson rte_event_port_default_conf_get(uint8_t dev_id, uint8_t port_id,
113699a2dd95SBruce Richardson 				struct rte_event_port_conf *port_conf);
113799a2dd95SBruce Richardson 
113899a2dd95SBruce Richardson /**
113999a2dd95SBruce Richardson  * Allocate and set up an event port for an event device.
114099a2dd95SBruce Richardson  *
114199a2dd95SBruce Richardson  * @param dev_id
114299a2dd95SBruce Richardson  *   The identifier of the device.
114399a2dd95SBruce Richardson  * @param port_id
1144e48762b3SBruce Richardson  *   The index of the event port to setup. The value must be less than
1145e48762b3SBruce Richardson  *   @ref rte_event_dev_config.nb_event_ports previously supplied to
1146e48762b3SBruce Richardson  *   rte_event_dev_configure().
114799a2dd95SBruce Richardson  * @param port_conf
1148e48762b3SBruce Richardson  *   The pointer to the configuration data to be used for the port.
1149e48762b3SBruce Richardson  *   NULL value is allowed, in which case the default configuration is used.
115099a2dd95SBruce Richardson  *
115199a2dd95SBruce Richardson  * @see rte_event_port_default_conf_get()
115299a2dd95SBruce Richardson  *
115399a2dd95SBruce Richardson  * @return
115499a2dd95SBruce Richardson  *   - 0: Success, event port correctly set up.
1155e48762b3SBruce Richardson  *   - <0: Port configuration failed.
1156e48762b3SBruce Richardson  *     - -EINVAL - Invalid input parameter.
1157e48762b3SBruce Richardson  *     - -EBUSY - Port already started.
1158e48762b3SBruce Richardson  *     - -ENOTSUP - Function not supported on this device, or a NULL pointer passed
1159e48762b3SBruce Richardson  *        as the port_conf parameter, and no default configuration function available
1160e48762b3SBruce Richardson  *        for this device.
1161e48762b3SBruce Richardson  *     - -EDQUOT - Application tried to link a queue configured
1162e48762b3SBruce Richardson  *      with @ref RTE_EVENT_QUEUE_CFG_SINGLE_LINK to more than one event port.
116399a2dd95SBruce Richardson  */
116499a2dd95SBruce Richardson int
116599a2dd95SBruce Richardson rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
116699a2dd95SBruce Richardson 		     const struct rte_event_port_conf *port_conf);
116799a2dd95SBruce Richardson 
11681ff23ce6SPavan Nikhilesh typedef void (*rte_eventdev_port_flush_t)(uint8_t dev_id,
11691ff23ce6SPavan Nikhilesh 					  struct rte_event event, void *arg);
11701ff23ce6SPavan Nikhilesh /**< Callback function prototype that can be passed during
11711ff23ce6SPavan Nikhilesh  * rte_event_port_release(), invoked once per a released event.
11721ff23ce6SPavan Nikhilesh  */
11731ff23ce6SPavan Nikhilesh 
11741ff23ce6SPavan Nikhilesh /**
11751ff23ce6SPavan Nikhilesh  * Quiesce any core specific resources consumed by the event port.
11761ff23ce6SPavan Nikhilesh  *
11771ff23ce6SPavan Nikhilesh  * Event ports are generally coupled with lcores, and a given Hardware
11781ff23ce6SPavan Nikhilesh  * implementation might require the PMD to store port specific data in the
11791ff23ce6SPavan Nikhilesh  * lcore.
11801ff23ce6SPavan Nikhilesh  * When the application decides to migrate the event port to another lcore
11811ff23ce6SPavan Nikhilesh  * or teardown the current lcore it may to call `rte_event_port_quiesce`
11821ff23ce6SPavan Nikhilesh  * to make sure that all the data associated with the event port are released
11831ff23ce6SPavan Nikhilesh  * from the lcore, this might also include any prefetched events.
11841ff23ce6SPavan Nikhilesh  * While releasing the event port from the lcore, this function calls the
11851ff23ce6SPavan Nikhilesh  * user-provided flush callback once per event.
11861ff23ce6SPavan Nikhilesh  *
11871ff23ce6SPavan Nikhilesh  * @note Invocation of this API does not affect the existing port configuration.
11881ff23ce6SPavan Nikhilesh  *
11891ff23ce6SPavan Nikhilesh  * @param dev_id
11901ff23ce6SPavan Nikhilesh  *   The identifier of the device.
11911ff23ce6SPavan Nikhilesh  * @param port_id
1192e48762b3SBruce Richardson  *   The index of the event port to quiesce. The value must be less than
1193e48762b3SBruce Richardson  *   @ref rte_event_dev_config.nb_event_ports previously supplied to rte_event_dev_configure().
11941ff23ce6SPavan Nikhilesh  * @param release_cb
11951ff23ce6SPavan Nikhilesh  *   Callback function invoked once per flushed event.
11961ff23ce6SPavan Nikhilesh  * @param args
11971ff23ce6SPavan Nikhilesh  *   Argument supplied to callback.
11981ff23ce6SPavan Nikhilesh  */
11991ff23ce6SPavan Nikhilesh void
12001ff23ce6SPavan Nikhilesh rte_event_port_quiesce(uint8_t dev_id, uint8_t port_id,
12011ff23ce6SPavan Nikhilesh 		       rte_eventdev_port_flush_t release_cb, void *args);
12021ff23ce6SPavan Nikhilesh 
120399a2dd95SBruce Richardson /**
120414d67a94SBruce Richardson  * Port attribute id for the maximum size of a burst enqueue operation supported on a port.
120599a2dd95SBruce Richardson  */
120699a2dd95SBruce Richardson #define RTE_EVENT_PORT_ATTR_ENQ_DEPTH 0
120799a2dd95SBruce Richardson /**
120814d67a94SBruce Richardson  * Port attribute id for the maximum size of a dequeue burst which can be returned from a port.
120999a2dd95SBruce Richardson  */
121099a2dd95SBruce Richardson #define RTE_EVENT_PORT_ATTR_DEQ_DEPTH 1
121199a2dd95SBruce Richardson /**
121214d67a94SBruce Richardson  * Port attribute id for the new event threshold of the port.
121314d67a94SBruce Richardson  * Once the number of events in the system exceeds this threshold, the enqueue of NEW-type
121414d67a94SBruce Richardson  * events will fail.
121599a2dd95SBruce Richardson  */
121699a2dd95SBruce Richardson #define RTE_EVENT_PORT_ATTR_NEW_EVENT_THRESHOLD 2
121799a2dd95SBruce Richardson /**
121814d67a94SBruce Richardson  * Port attribute id for the implicit release disable attribute of the port.
121999a2dd95SBruce Richardson  */
122099a2dd95SBruce Richardson #define RTE_EVENT_PORT_ATTR_IMPLICIT_RELEASE_DISABLE 3
122199a2dd95SBruce Richardson 
122299a2dd95SBruce Richardson /**
122399a2dd95SBruce Richardson  * Get an attribute from a port.
122499a2dd95SBruce Richardson  *
122599a2dd95SBruce Richardson  * @param dev_id
122614d67a94SBruce Richardson  *   The identifier of the device.
122799a2dd95SBruce Richardson  * @param port_id
122814d67a94SBruce Richardson  *   The index of the event port to query. The value must be less than
122914d67a94SBruce Richardson  *   @ref rte_event_dev_config.nb_event_ports previously supplied to rte_event_dev_configure().
123099a2dd95SBruce Richardson  * @param attr_id
123114d67a94SBruce Richardson  *   The attribute ID to retrieve (RTE_EVENT_PORT_ATTR_*)
123299a2dd95SBruce Richardson  * @param[out] attr_value
123399a2dd95SBruce Richardson  *   A pointer that will be filled in with the attribute value if successful
123499a2dd95SBruce Richardson  *
123599a2dd95SBruce Richardson  * @return
123614d67a94SBruce Richardson  *   - 0: Successfully returned value.
123714d67a94SBruce Richardson  *   - (-EINVAL) Invalid device, port or attr_id, or attr_value was NULL.
123899a2dd95SBruce Richardson  */
123999a2dd95SBruce Richardson int
124099a2dd95SBruce Richardson rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
124199a2dd95SBruce Richardson 			uint32_t *attr_value);
124299a2dd95SBruce Richardson 
124399a2dd95SBruce Richardson /**
124499a2dd95SBruce Richardson  * Start an event device.
124599a2dd95SBruce Richardson  *
124614d67a94SBruce Richardson  * The device start step is the last one in device setup, and enables the event
124714d67a94SBruce Richardson  * ports and queues to start accepting events and scheduling them to event ports.
124899a2dd95SBruce Richardson  *
124999a2dd95SBruce Richardson  * On success, all basic functions exported by the API (event enqueue,
125099a2dd95SBruce Richardson  * event dequeue and so on) can be invoked.
125199a2dd95SBruce Richardson  *
125299a2dd95SBruce Richardson  * @param dev_id
125314d67a94SBruce Richardson  *   Event device identifier.
125499a2dd95SBruce Richardson  * @return
125599a2dd95SBruce Richardson  *   - 0: Success, device started.
125614d67a94SBruce Richardson  *   - -EINVAL:  Invalid device id provided.
125714d67a94SBruce Richardson  *   - -ENOTSUP: Device does not support this operation.
125814d67a94SBruce Richardson  *   - -ESTALE : Not all ports of the device are configured.
125999a2dd95SBruce Richardson  *   - -ENOLINK: Not all queues are linked, which could lead to deadlock.
126099a2dd95SBruce Richardson  */
126199a2dd95SBruce Richardson int
126299a2dd95SBruce Richardson rte_event_dev_start(uint8_t dev_id);
126399a2dd95SBruce Richardson 
126499a2dd95SBruce Richardson /**
126599a2dd95SBruce Richardson  * Stop an event device.
126699a2dd95SBruce Richardson  *
126799a2dd95SBruce Richardson  * This function causes all queued events to be drained, including those
126899a2dd95SBruce Richardson  * residing in event ports. While draining events out of the device, this
126999a2dd95SBruce Richardson  * function calls the user-provided flush callback (if one was registered) once
127099a2dd95SBruce Richardson  * per event.
127199a2dd95SBruce Richardson  *
127299a2dd95SBruce Richardson  * The device can be restarted with a call to rte_event_dev_start(). Threads
127399a2dd95SBruce Richardson  * that continue to enqueue/dequeue while the device is stopped, or being
127499a2dd95SBruce Richardson  * stopped, will result in undefined behavior. This includes event adapters,
127599a2dd95SBruce Richardson  * which must be stopped prior to stopping the eventdev.
127699a2dd95SBruce Richardson  *
127799a2dd95SBruce Richardson  * @param dev_id
127899a2dd95SBruce Richardson  *   Event device identifier.
127999a2dd95SBruce Richardson  *
128099a2dd95SBruce Richardson  * @see rte_event_dev_stop_flush_callback_register()
128199a2dd95SBruce Richardson  */
128299a2dd95SBruce Richardson void
128399a2dd95SBruce Richardson rte_event_dev_stop(uint8_t dev_id);
128499a2dd95SBruce Richardson 
1285d986276fSPavan Nikhilesh typedef void (*rte_eventdev_stop_flush_t)(uint8_t dev_id,
1286d986276fSPavan Nikhilesh 					  struct rte_event event, void *arg);
128799a2dd95SBruce Richardson /**< Callback function called during rte_event_dev_stop(), invoked once per
128899a2dd95SBruce Richardson  * flushed event.
128999a2dd95SBruce Richardson  */
129099a2dd95SBruce Richardson 
129199a2dd95SBruce Richardson /**
129299a2dd95SBruce Richardson  * Registers a callback function to be invoked during rte_event_dev_stop() for
129399a2dd95SBruce Richardson  * each flushed event. This function can be used to properly dispose of queued
129499a2dd95SBruce Richardson  * events, for example events containing memory pointers.
129599a2dd95SBruce Richardson  *
129699a2dd95SBruce Richardson  * The callback function is only registered for the calling process. The
129799a2dd95SBruce Richardson  * callback function must be registered in every process that can call
129899a2dd95SBruce Richardson  * rte_event_dev_stop().
129999a2dd95SBruce Richardson  *
130014d67a94SBruce Richardson  * Only one callback function may be registered. Each new call replaces
130114d67a94SBruce Richardson  * the existing registered callback function with the new function passed in.
130214d67a94SBruce Richardson  *
130399a2dd95SBruce Richardson  * To unregister a callback, call this function with a NULL callback pointer.
130499a2dd95SBruce Richardson  *
130599a2dd95SBruce Richardson  * @param dev_id
130699a2dd95SBruce Richardson  *   The identifier of the device.
130799a2dd95SBruce Richardson  * @param callback
130814d67a94SBruce Richardson  *   Callback function to be invoked once per flushed event.
130914d67a94SBruce Richardson  *   Pass NULL to unset any previously-registered callback function.
131099a2dd95SBruce Richardson  * @param userdata
131199a2dd95SBruce Richardson  *   Argument supplied to callback.
131299a2dd95SBruce Richardson  *
131399a2dd95SBruce Richardson  * @return
131499a2dd95SBruce Richardson  *  - 0 on success.
131514d67a94SBruce Richardson  *  - -EINVAL if *dev_id* is invalid.
131699a2dd95SBruce Richardson  *
131799a2dd95SBruce Richardson  * @see rte_event_dev_stop()
131899a2dd95SBruce Richardson  */
1319d986276fSPavan Nikhilesh int rte_event_dev_stop_flush_callback_register(uint8_t dev_id,
1320d986276fSPavan Nikhilesh 					       rte_eventdev_stop_flush_t callback, void *userdata);
132199a2dd95SBruce Richardson 
132299a2dd95SBruce Richardson /**
132399a2dd95SBruce Richardson  * Close an event device. The device cannot be restarted!
132499a2dd95SBruce Richardson  *
132599a2dd95SBruce Richardson  * @param dev_id
132614d67a94SBruce Richardson  *   Event device identifier.
132799a2dd95SBruce Richardson  *
132899a2dd95SBruce Richardson  * @return
132999a2dd95SBruce Richardson  *  - 0 on successfully closing device
133014d67a94SBruce Richardson  *  - <0 on failure to close device.
133114d67a94SBruce Richardson  *    - -EINVAL - invalid device id.
133214d67a94SBruce Richardson  *    - -ENOTSUP - operation not supported for this device.
133314d67a94SBruce Richardson  *    - -EAGAIN - device is busy.
133499a2dd95SBruce Richardson  */
133599a2dd95SBruce Richardson int
133699a2dd95SBruce Richardson rte_event_dev_close(uint8_t dev_id);
133799a2dd95SBruce Richardson 
133899a2dd95SBruce Richardson /**
133999a2dd95SBruce Richardson  * Event vector structure.
134099a2dd95SBruce Richardson  */
1341*c6552d9aSTyler Retzlaff struct __rte_aligned(16) rte_event_vector {
134299a2dd95SBruce Richardson 	uint16_t nb_elem;
13430fbb55efSPavan Nikhilesh 	/**< Number of elements valid in this event vector. */
13440fbb55efSPavan Nikhilesh 	uint16_t elem_offset : 12;
13450fbb55efSPavan Nikhilesh 	/**< Offset into the vector array where valid elements start from. */
13460fbb55efSPavan Nikhilesh 	uint16_t rsvd : 3;
134799a2dd95SBruce Richardson 	/**< Reserved for future use */
134899a2dd95SBruce Richardson 	uint16_t attr_valid : 1;
134999a2dd95SBruce Richardson 	/**< Indicates that the below union attributes have valid information.
135099a2dd95SBruce Richardson 	 */
135199a2dd95SBruce Richardson 	union {
135299a2dd95SBruce Richardson 		/* Used by Rx/Tx adapter.
135399a2dd95SBruce Richardson 		 * Indicates that all the elements in this vector belong to the
135499a2dd95SBruce Richardson 		 * same port and queue pair when originating from Rx adapter,
135599a2dd95SBruce Richardson 		 * valid only when event type is ETHDEV_VECTOR or
135699a2dd95SBruce Richardson 		 * ETH_RX_ADAPTER_VECTOR.
135799a2dd95SBruce Richardson 		 * Can also be used to indicate the Tx adapter the destination
135899a2dd95SBruce Richardson 		 * port and queue of the mbufs in the vector
135999a2dd95SBruce Richardson 		 */
136099a2dd95SBruce Richardson 		struct {
1361f5746d3fSBruce Richardson 			uint16_t port;   /**< Ethernet device port id. */
1362f5746d3fSBruce Richardson 			uint16_t queue;  /**< Ethernet device queue id. */
136399a2dd95SBruce Richardson 		};
136499a2dd95SBruce Richardson 	};
136599a2dd95SBruce Richardson 	/**< Union to hold common attributes of the vector array. */
136699a2dd95SBruce Richardson 	uint64_t impl_opaque;
1367699155f2SBruce Richardson 
1368699155f2SBruce Richardson /* empty structures do not have zero size in C++ leading to compilation errors
1369699155f2SBruce Richardson  * with clang about structure having different sizes in C and C++.
1370699155f2SBruce Richardson  * Since these are all zero-sized arrays, we can omit the "union" wrapper for
1371699155f2SBruce Richardson  * C++ builds, removing the warning.
1372699155f2SBruce Richardson  */
1373699155f2SBruce Richardson #ifndef __cplusplus
137499a2dd95SBruce Richardson 	/**< Implementation specific opaque value.
137599a2dd95SBruce Richardson 	 * An implementation may use this field to hold implementation specific
137699a2dd95SBruce Richardson 	 * value to share between dequeue and enqueue operation.
137799a2dd95SBruce Richardson 	 * The application should not modify this field.
137899a2dd95SBruce Richardson 	 */
1379*c6552d9aSTyler Retzlaff 	union __rte_aligned(16) {
1380699155f2SBruce Richardson #endif
138199a2dd95SBruce Richardson 		struct rte_mbuf *mbufs[0];
138299a2dd95SBruce Richardson 		void *ptrs[0];
13835fa63911SPavan Nikhilesh 		uint64_t u64s[0];
1384699155f2SBruce Richardson #ifndef __cplusplus
1385*c6552d9aSTyler Retzlaff 	};
1386699155f2SBruce Richardson #endif
138799a2dd95SBruce Richardson 	/**< Start of the vector array union. Depending upon the event type the
138899a2dd95SBruce Richardson 	 * vector array can be an array of mbufs or pointers or opaque u64
138999a2dd95SBruce Richardson 	 * values.
139099a2dd95SBruce Richardson 	 */
1391f5746d3fSBruce Richardson };
139299a2dd95SBruce Richardson 
139399a2dd95SBruce Richardson /* Scheduler type definitions */
139499a2dd95SBruce Richardson #define RTE_SCHED_TYPE_ORDERED          0
139599a2dd95SBruce Richardson /**< Ordered scheduling
139699a2dd95SBruce Richardson  *
139799a2dd95SBruce Richardson  * Events from an ordered flow of an event queue can be scheduled to multiple
13980f524a02SBruce Richardson  * ports for concurrent processing while maintaining the original event order,
13990f524a02SBruce Richardson  * i.e. the order in which they were first enqueued to that queue.
14000f524a02SBruce Richardson  * This scheme allows events pertaining to the same, potentially large, flow to
14010f524a02SBruce Richardson  * be processed in parallel on multiple cores without incurring any
14020f524a02SBruce Richardson  * application-level order restoration logic overhead.
140399a2dd95SBruce Richardson  *
14040f524a02SBruce Richardson  * After events are dequeued from a set of ports, as those events are re-enqueued
14050f524a02SBruce Richardson  * to another queue (with the op field set to @ref RTE_EVENT_OP_FORWARD), the event
14060f524a02SBruce Richardson  * device restores the original event order - including events returned from all
14070f524a02SBruce Richardson  * ports in the set - before the events are placed on the destination queue,
14080f524a02SBruce Richardson  * for subsequent scheduling to ports.
140999a2dd95SBruce Richardson  *
14100f524a02SBruce Richardson  * Any events not forwarded i.e. dropped explicitly via RELEASE or implicitly
14110f524a02SBruce Richardson  * released by the next dequeue operation on a port, are skipped by the reordering
14120f524a02SBruce Richardson  * stage and do not affect the reordering of other returned events.
14130f524a02SBruce Richardson  *
14140f524a02SBruce Richardson  * Any NEW events sent on a port are not ordered with respect to FORWARD events sent
14150f524a02SBruce Richardson  * on the same port, since they have no original event order. They also are not
14160f524a02SBruce Richardson  * ordered with respect to NEW events enqueued on other ports.
14170f524a02SBruce Richardson  * However, NEW events to the same destination queue from the same port are guaranteed
14180f524a02SBruce Richardson  * to be enqueued in the order they were submitted via rte_event_enqueue_burst().
14190f524a02SBruce Richardson  *
14200f524a02SBruce Richardson  * NOTE:
14210f524a02SBruce Richardson  *   In restoring event order of forwarded events, the eventdev API guarantees that
14220f524a02SBruce Richardson  *   all events from the same flow (i.e. same @ref rte_event.flow_id,
14230f524a02SBruce Richardson  *   @ref rte_event.priority and @ref rte_event.queue_id) will be put in the original
14240f524a02SBruce Richardson  *   order before being forwarded to the destination queue.
14250f524a02SBruce Richardson  *   Some eventdevs may implement stricter ordering to achieve this aim,
14260f524a02SBruce Richardson  *   for example, restoring the order across *all* flows dequeued from the same ORDERED
14270f524a02SBruce Richardson  *   queue.
142899a2dd95SBruce Richardson  *
142999a2dd95SBruce Richardson  * @see rte_event_queue_setup(), rte_event_dequeue_burst(), RTE_EVENT_OP_RELEASE
143099a2dd95SBruce Richardson  */
143199a2dd95SBruce Richardson 
143299a2dd95SBruce Richardson #define RTE_SCHED_TYPE_ATOMIC           1
143399a2dd95SBruce Richardson /**< Atomic scheduling
143499a2dd95SBruce Richardson  *
14350f524a02SBruce Richardson  * Events from an atomic flow, identified by a combination of @ref rte_event.flow_id,
14360f524a02SBruce Richardson  * @ref rte_event.queue_id and @ref rte_event.priority, can be scheduled only to a
143799a2dd95SBruce Richardson  * single port at a time. The port is guaranteed to have exclusive (atomic)
143899a2dd95SBruce Richardson  * access to the associated flow context, which enables the user to avoid SW
14390f524a02SBruce Richardson  * synchronization. Atomic flows also maintain event ordering
14400f524a02SBruce Richardson  * since only one port at a time can process events from each flow of an
14410f524a02SBruce Richardson  * event queue, and events within a flow are not reordered within the scheduler.
144299a2dd95SBruce Richardson  *
14430f524a02SBruce Richardson  * An atomic flow is locked to a port when events from that flow are first
14440f524a02SBruce Richardson  * scheduled to that port. That lock remains in place until the
14450f524a02SBruce Richardson  * application calls rte_event_dequeue_burst() from the same port,
14460f524a02SBruce Richardson  * which implicitly releases the lock (if @ref RTE_EVENT_PORT_CFG_DISABLE_IMPL_REL flag is not set).
14470f524a02SBruce Richardson  * User may allow the scheduler to release the lock earlier than that by invoking
14480f524a02SBruce Richardson  * rte_event_enqueue_burst() with RTE_EVENT_OP_RELEASE operation for each event from that flow.
14490f524a02SBruce Richardson  *
14500f524a02SBruce Richardson  * NOTE: Where multiple events from the same queue and atomic flow are scheduled to a port,
14510f524a02SBruce Richardson  * the lock for that flow is only released once the last event from the flow is released,
14520f524a02SBruce Richardson  * or forwarded to another queue. So long as there is at least one event from an atomic
14530f524a02SBruce Richardson  * flow scheduled to a port/core (including any events in the port's dequeue queue, not yet read
14540f524a02SBruce Richardson  * by the application), that port will hold the synchronization lock for that flow.
145599a2dd95SBruce Richardson  *
145699a2dd95SBruce Richardson  * @see rte_event_queue_setup(), rte_event_dequeue_burst(), RTE_EVENT_OP_RELEASE
145799a2dd95SBruce Richardson  */
145899a2dd95SBruce Richardson 
145999a2dd95SBruce Richardson #define RTE_SCHED_TYPE_PARALLEL         2
146099a2dd95SBruce Richardson /**< Parallel scheduling
146199a2dd95SBruce Richardson  *
146299a2dd95SBruce Richardson  * The scheduler performs priority scheduling, load balancing, etc. functions
146399a2dd95SBruce Richardson  * but does not provide additional event synchronization or ordering.
146499a2dd95SBruce Richardson  * It is free to schedule events from a single parallel flow of an event queue
146599a2dd95SBruce Richardson  * to multiple events ports for concurrent processing.
146699a2dd95SBruce Richardson  * The application is responsible for flow context synchronization and
146799a2dd95SBruce Richardson  * event ordering (SW synchronization).
146899a2dd95SBruce Richardson  *
146999a2dd95SBruce Richardson  * @see rte_event_queue_setup(), rte_event_dequeue_burst()
147099a2dd95SBruce Richardson  */
147199a2dd95SBruce Richardson 
147299a2dd95SBruce Richardson /* Event types to classify the event source */
147399a2dd95SBruce Richardson #define RTE_EVENT_TYPE_ETHDEV           0x0
147499a2dd95SBruce Richardson /**< The event generated from ethdev subsystem */
147599a2dd95SBruce Richardson #define RTE_EVENT_TYPE_CRYPTODEV        0x1
147699a2dd95SBruce Richardson /**< The event generated from crypodev subsystem */
147799a2dd95SBruce Richardson #define RTE_EVENT_TYPE_TIMER		0x2
147899a2dd95SBruce Richardson /**< The event generated from event timer adapter */
147999a2dd95SBruce Richardson #define RTE_EVENT_TYPE_CPU              0x3
148099a2dd95SBruce Richardson /**< The event generated from cpu for pipelining.
148199a2dd95SBruce Richardson  * Application may use *sub_event_type* to further classify the event
148299a2dd95SBruce Richardson  */
148399a2dd95SBruce Richardson #define RTE_EVENT_TYPE_ETH_RX_ADAPTER   0x4
148499a2dd95SBruce Richardson /**< The event generated from event eth Rx adapter */
148566a30a29SAmit Prakash Shukla #define RTE_EVENT_TYPE_DMADEV           0x5
148666a30a29SAmit Prakash Shukla /**< The event generated from dma subsystem */
148799a2dd95SBruce Richardson #define RTE_EVENT_TYPE_VECTOR           0x8
148899a2dd95SBruce Richardson /**< Indicates that event is a vector.
148999a2dd95SBruce Richardson  * All vector event types should be a logical OR of EVENT_TYPE_VECTOR.
149099a2dd95SBruce Richardson  * This simplifies the pipeline design as one can split processing the events
149199a2dd95SBruce Richardson  * between vector events and normal event across event types.
149299a2dd95SBruce Richardson  * Example:
149399a2dd95SBruce Richardson  *	if (ev.event_type & RTE_EVENT_TYPE_VECTOR) {
149499a2dd95SBruce Richardson  *		// Classify and handle vector event.
149599a2dd95SBruce Richardson  *	} else {
149699a2dd95SBruce Richardson  *		// Classify and handle event.
149799a2dd95SBruce Richardson  *	}
149899a2dd95SBruce Richardson  */
149999a2dd95SBruce Richardson #define RTE_EVENT_TYPE_ETHDEV_VECTOR                                           \
150099a2dd95SBruce Richardson 	(RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_ETHDEV)
150199a2dd95SBruce Richardson /**< The event vector generated from ethdev subsystem */
150299a2dd95SBruce Richardson #define RTE_EVENT_TYPE_CPU_VECTOR (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_CPU)
150399a2dd95SBruce Richardson /**< The event vector generated from cpu for pipelining. */
150499a2dd95SBruce Richardson #define RTE_EVENT_TYPE_ETH_RX_ADAPTER_VECTOR                                   \
150599a2dd95SBruce Richardson 	(RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_ETH_RX_ADAPTER)
150699a2dd95SBruce Richardson /**< The event vector generated from eth Rx adapter. */
1507c1749bc5SVolodymyr Fialko #define RTE_EVENT_TYPE_CRYPTODEV_VECTOR                                        \
1508c1749bc5SVolodymyr Fialko 	(RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_CRYPTODEV)
1509c1749bc5SVolodymyr Fialko /**< The event vector generated from cryptodev adapter. */
151099a2dd95SBruce Richardson 
151199a2dd95SBruce Richardson #define RTE_EVENT_TYPE_MAX              0x10
151299a2dd95SBruce Richardson /**< Maximum number of event types */
151399a2dd95SBruce Richardson 
151499a2dd95SBruce Richardson /* Event enqueue operations */
151599a2dd95SBruce Richardson #define RTE_EVENT_OP_NEW                0
15165e467985SBruce Richardson /**< The @ref rte_event.op field must be set to this operation type to inject a new event,
15175e467985SBruce Richardson  * i.e. one not previously dequeued, into the event device, to be scheduled
15185e467985SBruce Richardson  * for processing.
151999a2dd95SBruce Richardson  */
152099a2dd95SBruce Richardson #define RTE_EVENT_OP_FORWARD            1
15215e467985SBruce Richardson /**< The application must set the @ref rte_event.op field to this operation type to return a
15225e467985SBruce Richardson  * previously dequeued event to the event device to be scheduled for further processing.
152399a2dd95SBruce Richardson  *
15245e467985SBruce Richardson  * This event *must* be enqueued to the same port that the
152599a2dd95SBruce Richardson  * event to be forwarded was dequeued from.
15265e467985SBruce Richardson  *
15275e467985SBruce Richardson  * The event's fields, including (but not limited to) flow_id, scheduling type,
15285e467985SBruce Richardson  * destination queue, and event payload e.g. mbuf pointer, may all be updated as
15295e467985SBruce Richardson  * desired by the application, but the @ref rte_event.impl_opaque field must
15305e467985SBruce Richardson  * be kept to the same value as was present when the event was dequeued.
153199a2dd95SBruce Richardson  */
153299a2dd95SBruce Richardson #define RTE_EVENT_OP_RELEASE            2
153399a2dd95SBruce Richardson /**< Release the flow context associated with the schedule type.
153499a2dd95SBruce Richardson  *
15355e467985SBruce Richardson  * If current flow's scheduler type method is @ref RTE_SCHED_TYPE_ATOMIC
15365e467985SBruce Richardson  * then this operation type hints the scheduler that the user has completed critical
15375e467985SBruce Richardson  * section processing for this event in the current atomic context, and that the
15385e467985SBruce Richardson  * scheduler may unlock any atomic locks held for this event.
15395e467985SBruce Richardson  * If this is the last event from an atomic flow, i.e. all flow locks are released
15405e467985SBruce Richardson  * (see @ref RTE_SCHED_TYPE_ATOMIC for details), the scheduler is now allowed to
15415e467985SBruce Richardson  * schedule events from that flow from to another port.
15425e467985SBruce Richardson  * However, the atomic locks may be still held until the next rte_event_dequeue_burst()
15435e467985SBruce Richardson  * call; enqueuing an event with opt type @ref RTE_EVENT_OP_RELEASE is a hint only,
15445e467985SBruce Richardson  * allowing the scheduler to release the atomic locks early, but not requiring it to do so.
154599a2dd95SBruce Richardson  *
15465e467985SBruce Richardson  * Early atomic lock release may increase parallelism and thus system
154799a2dd95SBruce Richardson  * performance, but the user needs to design carefully the split into critical
154899a2dd95SBruce Richardson  * vs non-critical sections.
154999a2dd95SBruce Richardson  *
15505e467985SBruce Richardson  * If current flow's scheduler type method is @ref RTE_SCHED_TYPE_ORDERED
15515e467985SBruce Richardson  * then this operation type informs the scheduler that the current event has
15525e467985SBruce Richardson  * completed processing and will not be returned to the scheduler, i.e.
15535e467985SBruce Richardson  * it has been dropped, and so the reordering context for that event
15545e467985SBruce Richardson  * should be considered filled.
155599a2dd95SBruce Richardson  *
15565e467985SBruce Richardson  * Events with this operation type must only be enqueued to the same port that the
15575e467985SBruce Richardson  * event to be released was dequeued from. The @ref rte_event.impl_opaque
15585e467985SBruce Richardson  * field in the release event must have the same value as that in the original dequeued event.
155999a2dd95SBruce Richardson  *
15605e467985SBruce Richardson  * If a dequeued event is re-enqueued with operation type of @ref RTE_EVENT_OP_RELEASE,
15615e467985SBruce Richardson  * then any subsequent enqueue of that event - or a copy of it - must be done as event of type
15625e467985SBruce Richardson  * @ref RTE_EVENT_OP_NEW, not @ref RTE_EVENT_OP_FORWARD. This is because any context for
15635e467985SBruce Richardson  * the originally dequeued event, i.e. atomic locks, or reorder buffer entries, will have
15645e467985SBruce Richardson  * been removed or invalidated by the release operation.
156599a2dd95SBruce Richardson  */
156699a2dd95SBruce Richardson 
156799a2dd95SBruce Richardson /**
156899a2dd95SBruce Richardson  * The generic *rte_event* structure to hold the event attributes
156999a2dd95SBruce Richardson  * for dequeue and enqueue operation
157099a2dd95SBruce Richardson  */
157199a2dd95SBruce Richardson struct rte_event {
15724c50f7afSBruce Richardson 	/* WORD0 */
157399a2dd95SBruce Richardson 	union {
157499a2dd95SBruce Richardson 		uint64_t event;
157599a2dd95SBruce Richardson 		/** Event attributes for dequeue or enqueue operation */
157699a2dd95SBruce Richardson 		struct {
157799a2dd95SBruce Richardson 			uint32_t flow_id:20;
15785e467985SBruce Richardson 			/**< Target flow identifier for the enqueue and dequeue operation.
15795e467985SBruce Richardson 			 *
15805e467985SBruce Richardson 			 * For @ref RTE_SCHED_TYPE_ATOMIC, this field is used to identify a
15815e467985SBruce Richardson 			 * flow for atomicity within a queue & priority level, such that events
15825e467985SBruce Richardson 			 * from each individual flow will only be scheduled to one port at a time.
15835e467985SBruce Richardson 			 *
15845e467985SBruce Richardson 			 * This field is preserved between enqueue and dequeue when
15855e467985SBruce Richardson 			 * a device reports the @ref RTE_EVENT_DEV_CAP_CARRY_FLOW_ID
15865e467985SBruce Richardson 			 * capability. Otherwise the value is implementation dependent
15875e467985SBruce Richardson 			 * on dequeue.
158899a2dd95SBruce Richardson 			 */
158999a2dd95SBruce Richardson 			uint32_t sub_event_type:8;
159099a2dd95SBruce Richardson 			/**< Sub-event types based on the event source.
15915e467985SBruce Richardson 			 *
15925e467985SBruce Richardson 			 * This field is preserved between enqueue and dequeue.
15935e467985SBruce Richardson 			 *
159499a2dd95SBruce Richardson 			 * @see RTE_EVENT_TYPE_CPU
159599a2dd95SBruce Richardson 			 */
159699a2dd95SBruce Richardson 			uint32_t event_type:4;
15975e467985SBruce Richardson 			/**< Event type to classify the event source. (RTE_EVENT_TYPE_*)
15985e467985SBruce Richardson 			 *
15995e467985SBruce Richardson 			 * This field is preserved between enqueue and dequeue
160099a2dd95SBruce Richardson 			 */
160199a2dd95SBruce Richardson 			uint8_t op:2;
16025e467985SBruce Richardson 			/**< The type of event enqueue operation - new/forward/ etc.
16035e467985SBruce Richardson 			 *
16045e467985SBruce Richardson 			 * This field is *not* preserved across an instance
16055e467985SBruce Richardson 			 * and is implementation dependent on dequeue.
16065e467985SBruce Richardson 			 *
16075e467985SBruce Richardson 			 * @see RTE_EVENT_OP_NEW
16085e467985SBruce Richardson 			 * @see RTE_EVENT_OP_FORWARD
16095e467985SBruce Richardson 			 * @see RTE_EVENT_OP_RELEASE
161099a2dd95SBruce Richardson 			 */
161199a2dd95SBruce Richardson 			uint8_t rsvd:4;
16125e467985SBruce Richardson 			/**< Reserved for future use.
16135e467985SBruce Richardson 			 *
16145e467985SBruce Richardson 			 * Should be set to zero when initializing event structures.
16155e467985SBruce Richardson 			 *
16165e467985SBruce Richardson 			 * When forwarding or releasing existing events dequeued from the scheduler,
16175e467985SBruce Richardson 			 * this field can be ignored.
16185e467985SBruce Richardson 			 */
161999a2dd95SBruce Richardson 			uint8_t sched_type:2;
162099a2dd95SBruce Richardson 			/**< Scheduler synchronization type (RTE_SCHED_TYPE_*)
162199a2dd95SBruce Richardson 			 * associated with flow id on a given event queue
162299a2dd95SBruce Richardson 			 * for the enqueue and dequeue operation.
16235e467985SBruce Richardson 			 *
16245e467985SBruce Richardson 			 * This field is used to determine the scheduling type
16255e467985SBruce Richardson 			 * for events sent to queues where @ref RTE_EVENT_QUEUE_CFG_ALL_TYPES
16265e467985SBruce Richardson 			 * is configured.
16275e467985SBruce Richardson 			 * For queues where only a single scheduling type is available,
16285e467985SBruce Richardson 			 * this field must be set to match the configured scheduling type.
16295e467985SBruce Richardson 			 *
16305e467985SBruce Richardson 			 * This field is preserved between enqueue and dequeue.
16315e467985SBruce Richardson 			 *
16325e467985SBruce Richardson 			 * @see RTE_SCHED_TYPE_ORDERED
16335e467985SBruce Richardson 			 * @see RTE_SCHED_TYPE_ATOMIC
16345e467985SBruce Richardson 			 * @see RTE_SCHED_TYPE_PARALLEL
163599a2dd95SBruce Richardson 			 */
163699a2dd95SBruce Richardson 			uint8_t queue_id;
163799a2dd95SBruce Richardson 			/**< Targeted event queue identifier for the enqueue or
163899a2dd95SBruce Richardson 			 * dequeue operation.
16395e467985SBruce Richardson 			 * The value must be less than @ref rte_event_dev_config.nb_event_queues
16405e467985SBruce Richardson 			 * which was previously supplied to rte_event_dev_configure().
16415e467985SBruce Richardson 			 *
16425e467985SBruce Richardson 			 * This field is preserved between enqueue on dequeue.
164399a2dd95SBruce Richardson 			 */
164499a2dd95SBruce Richardson 			uint8_t priority;
164599a2dd95SBruce Richardson 			/**< Event priority relative to other events in the
164699a2dd95SBruce Richardson 			 * event queue. The requested priority should in the
16475e467985SBruce Richardson 			 * range of  [@ref RTE_EVENT_DEV_PRIORITY_HIGHEST,
16485e467985SBruce Richardson 			 * @ref RTE_EVENT_DEV_PRIORITY_LOWEST].
16495e467985SBruce Richardson 			 *
165099a2dd95SBruce Richardson 			 * The implementation shall normalize the requested
165199a2dd95SBruce Richardson 			 * priority to supported priority value.
16525e467985SBruce Richardson 			 * [For devices with where the supported priority range is a power-of-2, the
16535e467985SBruce Richardson 			 * normalization will be done via bit-shifting, so only the highest
16545e467985SBruce Richardson 			 * log2(num_priorities) bits will be used by the event device]
16555e467985SBruce Richardson 			 *
16565e467985SBruce Richardson 			 * Valid when the device has @ref RTE_EVENT_DEV_CAP_EVENT_QOS capability
16575e467985SBruce Richardson 			 * and this field is preserved between enqueue and dequeue,
16585e467985SBruce Richardson 			 * though with possible loss of precision due to normalization and
16595e467985SBruce Richardson 			 * subsequent de-normalization. (For example, if a device only supports 8
16605e467985SBruce Richardson 			 * priority levels, only the high 3 bits of this field will be
16615e467985SBruce Richardson 			 * used by that device, and hence only the value of those 3 bits are
16625e467985SBruce Richardson 			 * guaranteed to be preserved between enqueue and dequeue.)
16635e467985SBruce Richardson 			 *
16645e467985SBruce Richardson 			 * Ignored when device does not support @ref RTE_EVENT_DEV_CAP_EVENT_QOS
16655e467985SBruce Richardson 			 * capability, and it is implementation dependent if this field is preserved
16665e467985SBruce Richardson 			 * between enqueue and dequeue.
166799a2dd95SBruce Richardson 			 */
166899a2dd95SBruce Richardson 			uint8_t impl_opaque;
16695e467985SBruce Richardson 			/**< Opaque field for event device use.
16705e467985SBruce Richardson 			 *
16715e467985SBruce Richardson 			 * An event driver implementation may use this field to hold an
167299a2dd95SBruce Richardson 			 * implementation specific value to share between
167399a2dd95SBruce Richardson 			 * dequeue and enqueue operation.
16745e467985SBruce Richardson 			 *
16755e467985SBruce Richardson 			 * The application must not modify this field.
16765e467985SBruce Richardson 			 * Its value is implementation dependent on dequeue,
16775e467985SBruce Richardson 			 * and must be returned unmodified on enqueue when
16785e467985SBruce Richardson 			 * op type is @ref RTE_EVENT_OP_FORWARD or @ref RTE_EVENT_OP_RELEASE.
16795e467985SBruce Richardson 			 * This field is ignored on events with op type
16805e467985SBruce Richardson 			 * @ref RTE_EVENT_OP_NEW.
168199a2dd95SBruce Richardson 			 */
168299a2dd95SBruce Richardson 		};
168399a2dd95SBruce Richardson 	};
16844c50f7afSBruce Richardson 	/* WORD1 */
168599a2dd95SBruce Richardson 	union {
168699a2dd95SBruce Richardson 		uint64_t u64;
168799a2dd95SBruce Richardson 		/**< Opaque 64-bit value */
168899a2dd95SBruce Richardson 		void *event_ptr;
168999a2dd95SBruce Richardson 		/**< Opaque event pointer */
169099a2dd95SBruce Richardson 		struct rte_mbuf *mbuf;
169199a2dd95SBruce Richardson 		/**< mbuf pointer if dequeued event is associated with mbuf */
169299a2dd95SBruce Richardson 		struct rte_event_vector *vec;
169399a2dd95SBruce Richardson 		/**< Event vector pointer. */
169499a2dd95SBruce Richardson 	};
169599a2dd95SBruce Richardson };
169699a2dd95SBruce Richardson 
169799a2dd95SBruce Richardson /* Ethdev Rx adapter capability bitmap flags */
169899a2dd95SBruce Richardson #define RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT	0x1
169999a2dd95SBruce Richardson /**< This flag is sent when the packet transfer mechanism is in HW.
170099a2dd95SBruce Richardson  * Ethdev can send packets to the event device using internal event port.
170199a2dd95SBruce Richardson  */
170299a2dd95SBruce Richardson #define RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ	0x2
170399a2dd95SBruce Richardson /**< Adapter supports multiple event queues per ethdev. Every ethdev
170499a2dd95SBruce Richardson  * Rx queue can be connected to a unique event queue.
170599a2dd95SBruce Richardson  */
170699a2dd95SBruce Richardson #define RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID	0x4
170799a2dd95SBruce Richardson /**< The application can override the adapter generated flow ID in the
170899a2dd95SBruce Richardson  * event. This flow ID can be specified when adding an ethdev Rx queue
1709a256a743SPavan Nikhilesh  * to the adapter using the ev.flow_id member.
171099a2dd95SBruce Richardson  * @see struct rte_event_eth_rx_adapter_queue_conf::ev
171199a2dd95SBruce Richardson  * @see struct rte_event_eth_rx_adapter_queue_conf::rx_queue_flags
171299a2dd95SBruce Richardson  */
171399a2dd95SBruce Richardson #define RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR	0x8
171499a2dd95SBruce Richardson /**< Adapter supports event vectorization per ethdev. */
171599a2dd95SBruce Richardson 
171699a2dd95SBruce Richardson /**
171799a2dd95SBruce Richardson  * Retrieve the event device's ethdev Rx adapter capabilities for the
171899a2dd95SBruce Richardson  * specified ethernet port
171999a2dd95SBruce Richardson  *
172099a2dd95SBruce Richardson  * @param dev_id
172199a2dd95SBruce Richardson  *   The identifier of the device.
172299a2dd95SBruce Richardson  *
172399a2dd95SBruce Richardson  * @param eth_port_id
172499a2dd95SBruce Richardson  *   The identifier of the ethernet device.
172599a2dd95SBruce Richardson  *
172699a2dd95SBruce Richardson  * @param[out] caps
172799a2dd95SBruce Richardson  *   A pointer to memory filled with Rx event adapter capabilities.
172899a2dd95SBruce Richardson  *
172999a2dd95SBruce Richardson  * @return
173099a2dd95SBruce Richardson  *   - 0: Success, driver provides Rx event adapter capabilities for the
173199a2dd95SBruce Richardson  *	ethernet device.
173299a2dd95SBruce Richardson  *   - <0: Error code returned by the driver function.
173399a2dd95SBruce Richardson  */
173499a2dd95SBruce Richardson int
173599a2dd95SBruce Richardson rte_event_eth_rx_adapter_caps_get(uint8_t dev_id, uint16_t eth_port_id,
173699a2dd95SBruce Richardson 				uint32_t *caps);
173799a2dd95SBruce Richardson 
173899a2dd95SBruce Richardson #define RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT (1ULL << 0)
173999a2dd95SBruce Richardson /**< This flag is set when the timer mechanism is in HW. */
174099a2dd95SBruce Richardson 
174199a2dd95SBruce Richardson #define RTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC      (1ULL << 1)
174299a2dd95SBruce Richardson /**< This flag is set if periodic mode is supported. */
174399a2dd95SBruce Richardson 
174499a2dd95SBruce Richardson /**
174599a2dd95SBruce Richardson  * Retrieve the event device's timer adapter capabilities.
174699a2dd95SBruce Richardson  *
174799a2dd95SBruce Richardson  * @param dev_id
174899a2dd95SBruce Richardson  *   The identifier of the device.
174999a2dd95SBruce Richardson  *
175099a2dd95SBruce Richardson  * @param[out] caps
175199a2dd95SBruce Richardson  *   A pointer to memory to be filled with event timer adapter capabilities.
175299a2dd95SBruce Richardson  *
175399a2dd95SBruce Richardson  * @return
175499a2dd95SBruce Richardson  *   - 0: Success, driver provided event timer adapter capabilities.
175599a2dd95SBruce Richardson  *   - <0: Error code returned by the driver function.
175699a2dd95SBruce Richardson  */
175799a2dd95SBruce Richardson int
175899a2dd95SBruce Richardson rte_event_timer_adapter_caps_get(uint8_t dev_id, uint32_t *caps);
175999a2dd95SBruce Richardson 
176099a2dd95SBruce Richardson /* Crypto adapter capability bitmap flag */
176199a2dd95SBruce Richardson #define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW   0x1
176299a2dd95SBruce Richardson /**< Flag indicates HW is capable of generating events in
176399a2dd95SBruce Richardson  * RTE_EVENT_OP_NEW enqueue operation. Cryptodev will send
176499a2dd95SBruce Richardson  * packets to the event device as new events using an internal
176599a2dd95SBruce Richardson  * event port.
176699a2dd95SBruce Richardson  */
176799a2dd95SBruce Richardson 
176899a2dd95SBruce Richardson #define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD   0x2
176999a2dd95SBruce Richardson /**< Flag indicates HW is capable of generating events in
177099a2dd95SBruce Richardson  * RTE_EVENT_OP_FORWARD enqueue operation. Cryptodev will send
177199a2dd95SBruce Richardson  * packets to the event device as forwarded event using an
177299a2dd95SBruce Richardson  * internal event port.
177399a2dd95SBruce Richardson  */
177499a2dd95SBruce Richardson 
177599a2dd95SBruce Richardson #define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND  0x4
177699a2dd95SBruce Richardson /**< Flag indicates HW is capable of mapping crypto queue pair to
177799a2dd95SBruce Richardson  * event queue.
177899a2dd95SBruce Richardson  */
177999a2dd95SBruce Richardson 
178099a2dd95SBruce Richardson #define RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA   0x8
178199a2dd95SBruce Richardson /**< Flag indicates HW/SW supports a mechanism to store and retrieve
178299a2dd95SBruce Richardson  * the private data information along with the crypto session.
178399a2dd95SBruce Richardson  */
178499a2dd95SBruce Richardson 
1785c1749bc5SVolodymyr Fialko #define RTE_EVENT_CRYPTO_ADAPTER_CAP_EVENT_VECTOR   0x10
1786c1749bc5SVolodymyr Fialko /**< Flag indicates HW is capable of aggregating processed
1787c1749bc5SVolodymyr Fialko  * crypto operations into rte_event_vector.
1788c1749bc5SVolodymyr Fialko  */
1789c1749bc5SVolodymyr Fialko 
179099a2dd95SBruce Richardson /**
179199a2dd95SBruce Richardson  * Retrieve the event device's crypto adapter capabilities for the
179299a2dd95SBruce Richardson  * specified cryptodev device
179399a2dd95SBruce Richardson  *
179499a2dd95SBruce Richardson  * @param dev_id
179599a2dd95SBruce Richardson  *   The identifier of the device.
179699a2dd95SBruce Richardson  *
179799a2dd95SBruce Richardson  * @param cdev_id
179899a2dd95SBruce Richardson  *   The identifier of the cryptodev device.
179999a2dd95SBruce Richardson  *
180099a2dd95SBruce Richardson  * @param[out] caps
180199a2dd95SBruce Richardson  *   A pointer to memory filled with event adapter capabilities.
180299a2dd95SBruce Richardson  *   It is expected to be pre-allocated & initialized by caller.
180399a2dd95SBruce Richardson  *
180499a2dd95SBruce Richardson  * @return
180599a2dd95SBruce Richardson  *   - 0: Success, driver provides event adapter capabilities for the
180699a2dd95SBruce Richardson  *     cryptodev device.
180799a2dd95SBruce Richardson  *   - <0: Error code returned by the driver function.
180899a2dd95SBruce Richardson  */
180999a2dd95SBruce Richardson int
181099a2dd95SBruce Richardson rte_event_crypto_adapter_caps_get(uint8_t dev_id, uint8_t cdev_id,
181199a2dd95SBruce Richardson 				  uint32_t *caps);
181299a2dd95SBruce Richardson 
181366a30a29SAmit Prakash Shukla /* DMA adapter capability bitmap flag */
181466a30a29SAmit Prakash Shukla #define RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_OP_NEW 0x1
181566a30a29SAmit Prakash Shukla /**< Flag indicates HW is capable of generating events in
181666a30a29SAmit Prakash Shukla  * RTE_EVENT_OP_NEW enqueue operation. DMADEV will send
181766a30a29SAmit Prakash Shukla  * packets to the event device as new events using an
181866a30a29SAmit Prakash Shukla  * internal event port.
181966a30a29SAmit Prakash Shukla  */
182066a30a29SAmit Prakash Shukla 
182166a30a29SAmit Prakash Shukla #define RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_OP_FWD 0x2
182266a30a29SAmit Prakash Shukla /**< Flag indicates HW is capable of generating events in
182366a30a29SAmit Prakash Shukla  * RTE_EVENT_OP_FORWARD enqueue operation. DMADEV will send
182466a30a29SAmit Prakash Shukla  * packets to the event device as forwarded event using an
182566a30a29SAmit Prakash Shukla  * internal event port.
182666a30a29SAmit Prakash Shukla  */
182766a30a29SAmit Prakash Shukla 
182866a30a29SAmit Prakash Shukla #define RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_VCHAN_EV_BIND 0x4
182966a30a29SAmit Prakash Shukla /**< Flag indicates HW is capable of mapping DMA vchan to event queue. */
183066a30a29SAmit Prakash Shukla 
183166a30a29SAmit Prakash Shukla /**
183266a30a29SAmit Prakash Shukla  * Retrieve the event device's DMA adapter capabilities for the
183366a30a29SAmit Prakash Shukla  * specified dmadev device
183466a30a29SAmit Prakash Shukla  *
183566a30a29SAmit Prakash Shukla  * @param dev_id
183666a30a29SAmit Prakash Shukla  *   The identifier of the device.
183766a30a29SAmit Prakash Shukla  *
183866a30a29SAmit Prakash Shukla  * @param dmadev_id
183966a30a29SAmit Prakash Shukla  *   The identifier of the dmadev device.
184066a30a29SAmit Prakash Shukla  *
184166a30a29SAmit Prakash Shukla  * @param[out] caps
184266a30a29SAmit Prakash Shukla  *   A pointer to memory filled with event adapter capabilities.
184366a30a29SAmit Prakash Shukla  *   It is expected to be pre-allocated & initialized by caller.
184466a30a29SAmit Prakash Shukla  *
184566a30a29SAmit Prakash Shukla  * @return
184666a30a29SAmit Prakash Shukla  *   - 0: Success, driver provides event adapter capabilities for the
184766a30a29SAmit Prakash Shukla  *     dmadev device.
184866a30a29SAmit Prakash Shukla  *   - <0: Error code returned by the driver function.
184966a30a29SAmit Prakash Shukla  *
185066a30a29SAmit Prakash Shukla  */
185166a30a29SAmit Prakash Shukla __rte_experimental
185266a30a29SAmit Prakash Shukla int
185366a30a29SAmit Prakash Shukla rte_event_dma_adapter_caps_get(uint8_t dev_id, uint8_t dmadev_id, uint32_t *caps);
185466a30a29SAmit Prakash Shukla 
185599a2dd95SBruce Richardson /* Ethdev Tx adapter capability bitmap flags */
185699a2dd95SBruce Richardson #define RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT	0x1
185799a2dd95SBruce Richardson /**< This flag is sent when the PMD supports a packet transmit callback
185899a2dd95SBruce Richardson  */
185999a2dd95SBruce Richardson #define RTE_EVENT_ETH_TX_ADAPTER_CAP_EVENT_VECTOR	0x2
186099a2dd95SBruce Richardson /**< Indicates that the Tx adapter is capable of handling event vector of
186199a2dd95SBruce Richardson  * mbufs.
186299a2dd95SBruce Richardson  */
186399a2dd95SBruce Richardson 
186499a2dd95SBruce Richardson /**
186599a2dd95SBruce Richardson  * Retrieve the event device's eth Tx adapter capabilities
186699a2dd95SBruce Richardson  *
186799a2dd95SBruce Richardson  * @param dev_id
186899a2dd95SBruce Richardson  *   The identifier of the device.
186999a2dd95SBruce Richardson  *
187099a2dd95SBruce Richardson  * @param eth_port_id
187199a2dd95SBruce Richardson  *   The identifier of the ethernet device.
187299a2dd95SBruce Richardson  *
187399a2dd95SBruce Richardson  * @param[out] caps
187499a2dd95SBruce Richardson  *   A pointer to memory filled with eth Tx adapter capabilities.
187599a2dd95SBruce Richardson  *
187699a2dd95SBruce Richardson  * @return
187799a2dd95SBruce Richardson  *   - 0: Success, driver provides eth Tx adapter capabilities.
187899a2dd95SBruce Richardson  *   - <0: Error code returned by the driver function.
187999a2dd95SBruce Richardson  */
188099a2dd95SBruce Richardson int
188199a2dd95SBruce Richardson rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint16_t eth_port_id,
188299a2dd95SBruce Richardson 				uint32_t *caps);
188399a2dd95SBruce Richardson 
188499a2dd95SBruce Richardson /**
188599a2dd95SBruce Richardson  * Converts nanoseconds to *timeout_ticks* value for rte_event_dequeue_burst()
188699a2dd95SBruce Richardson  *
188799a2dd95SBruce Richardson  * If the device is configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT flag
188899a2dd95SBruce Richardson  * then application can use this function to convert timeout value in
188999a2dd95SBruce Richardson  * nanoseconds to implementations specific timeout value supplied in
189099a2dd95SBruce Richardson  * rte_event_dequeue_burst()
189199a2dd95SBruce Richardson  *
189299a2dd95SBruce Richardson  * @param dev_id
189399a2dd95SBruce Richardson  *   The identifier of the device.
189499a2dd95SBruce Richardson  * @param ns
189599a2dd95SBruce Richardson  *   Wait time in nanosecond
189699a2dd95SBruce Richardson  * @param[out] timeout_ticks
189799a2dd95SBruce Richardson  *   Value for the *timeout_ticks* parameter in rte_event_dequeue_burst()
189899a2dd95SBruce Richardson  *
189999a2dd95SBruce Richardson  * @return
190099a2dd95SBruce Richardson  *  - 0 on success.
190199a2dd95SBruce Richardson  *  - -ENOTSUP if the device doesn't support timeouts
190299a2dd95SBruce Richardson  *  - -EINVAL if *dev_id* is invalid or *timeout_ticks* is NULL
190399a2dd95SBruce Richardson  *  - other values < 0 on failure.
190499a2dd95SBruce Richardson  *
190599a2dd95SBruce Richardson  * @see rte_event_dequeue_burst(), RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT
190699a2dd95SBruce Richardson  * @see rte_event_dev_configure()
190799a2dd95SBruce Richardson  */
190899a2dd95SBruce Richardson int
190999a2dd95SBruce Richardson rte_event_dequeue_timeout_ticks(uint8_t dev_id, uint64_t ns,
191099a2dd95SBruce Richardson 					uint64_t *timeout_ticks);
191199a2dd95SBruce Richardson 
191299a2dd95SBruce Richardson /**
191399a2dd95SBruce Richardson  * Link multiple source event queues supplied in *queues* to the destination
191499a2dd95SBruce Richardson  * event port designated by its *port_id* with associated service priority
191599a2dd95SBruce Richardson  * supplied in *priorities* on the event device designated by its *dev_id*.
191699a2dd95SBruce Richardson  *
191799a2dd95SBruce Richardson  * The link establishment shall enable the event port *port_id* from
191899a2dd95SBruce Richardson  * receiving events from the specified event queue(s) supplied in *queues*
191999a2dd95SBruce Richardson  *
192099a2dd95SBruce Richardson  * An event queue may link to one or more event ports.
192199a2dd95SBruce Richardson  * The number of links can be established from an event queue to event port is
192299a2dd95SBruce Richardson  * implementation defined.
192399a2dd95SBruce Richardson  *
192499a2dd95SBruce Richardson  * Event queue(s) to event port link establishment can be changed at runtime
192599a2dd95SBruce Richardson  * without re-configuring the device to support scaling and to reduce the
192699a2dd95SBruce Richardson  * latency of critical work by establishing the link with more event ports
192799a2dd95SBruce Richardson  * at runtime.
192899a2dd95SBruce Richardson  *
1929d007a7f3SPavan Nikhilesh  * When the value of ``rte_event_dev_info::max_profiles_per_port`` is greater
1930d007a7f3SPavan Nikhilesh  * than or equal to one, this function links the event queues to the default
1931d007a7f3SPavan Nikhilesh  * profile_id i.e. profile_id 0 of the event port.
1932d007a7f3SPavan Nikhilesh  *
193399a2dd95SBruce Richardson  * @param dev_id
193499a2dd95SBruce Richardson  *   The identifier of the device.
193599a2dd95SBruce Richardson  *
193699a2dd95SBruce Richardson  * @param port_id
193799a2dd95SBruce Richardson  *   Event port identifier to select the destination port to link.
193899a2dd95SBruce Richardson  *
193999a2dd95SBruce Richardson  * @param queues
194099a2dd95SBruce Richardson  *   Points to an array of *nb_links* event queues to be linked
194199a2dd95SBruce Richardson  *   to the event port.
194299a2dd95SBruce Richardson  *   NULL value is allowed, in which case this function links all the configured
194399a2dd95SBruce Richardson  *   event queues *nb_event_queues* which previously supplied to
194499a2dd95SBruce Richardson  *   rte_event_dev_configure() to the event port *port_id*
194599a2dd95SBruce Richardson  *
194699a2dd95SBruce Richardson  * @param priorities
194799a2dd95SBruce Richardson  *   Points to an array of *nb_links* service priorities associated with each
194899a2dd95SBruce Richardson  *   event queue link to event port.
194999a2dd95SBruce Richardson  *   The priority defines the event port's servicing priority for
195099a2dd95SBruce Richardson  *   event queue, which may be ignored by an implementation.
195199a2dd95SBruce Richardson  *   The requested priority should in the range of
195299a2dd95SBruce Richardson  *   [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST].
195399a2dd95SBruce Richardson  *   The implementation shall normalize the requested priority to
195499a2dd95SBruce Richardson  *   implementation supported priority value.
195599a2dd95SBruce Richardson  *   NULL value is allowed, in which case this function links the event queues
195699a2dd95SBruce Richardson  *   with RTE_EVENT_DEV_PRIORITY_NORMAL servicing priority
195799a2dd95SBruce Richardson  *
195899a2dd95SBruce Richardson  * @param nb_links
195999a2dd95SBruce Richardson  *   The number of links to establish. This parameter is ignored if queues is
196099a2dd95SBruce Richardson  *   NULL.
196199a2dd95SBruce Richardson  *
196299a2dd95SBruce Richardson  * @return
196399a2dd95SBruce Richardson  * The number of links actually established. The return value can be less than
196499a2dd95SBruce Richardson  * the value of the *nb_links* parameter when the implementation has the
196599a2dd95SBruce Richardson  * limitation on specific queue to port link establishment or if invalid
196699a2dd95SBruce Richardson  * parameters are specified in *queues*
196799a2dd95SBruce Richardson  * If the return value is less than *nb_links*, the remaining links at the end
196899a2dd95SBruce Richardson  * of link[] are not established, and the caller has to take care of them.
196999a2dd95SBruce Richardson  * If return value is less than *nb_links* then implementation shall update the
197099a2dd95SBruce Richardson  * rte_errno accordingly, Possible rte_errno values are
197199a2dd95SBruce Richardson  * (EDQUOT) Quota exceeded(Application tried to link the queue configured with
197299a2dd95SBruce Richardson  *  RTE_EVENT_QUEUE_CFG_SINGLE_LINK to more than one event ports)
197399a2dd95SBruce Richardson  * (EINVAL) Invalid parameter
197499a2dd95SBruce Richardson  */
197599a2dd95SBruce Richardson int
197699a2dd95SBruce Richardson rte_event_port_link(uint8_t dev_id, uint8_t port_id,
197799a2dd95SBruce Richardson 		    const uint8_t queues[], const uint8_t priorities[],
197899a2dd95SBruce Richardson 		    uint16_t nb_links);
197999a2dd95SBruce Richardson 
198099a2dd95SBruce Richardson /**
198199a2dd95SBruce Richardson  * Unlink multiple source event queues supplied in *queues* from the destination
198299a2dd95SBruce Richardson  * event port designated by its *port_id* on the event device designated
198399a2dd95SBruce Richardson  * by its *dev_id*.
198499a2dd95SBruce Richardson  *
198599a2dd95SBruce Richardson  * The unlink call issues an async request to disable the event port *port_id*
198699a2dd95SBruce Richardson  * from receiving events from the specified event queue *queue_id*.
198799a2dd95SBruce Richardson  * Event queue(s) to event port unlink establishment can be changed at runtime
198899a2dd95SBruce Richardson  * without re-configuring the device.
198999a2dd95SBruce Richardson  *
1990d007a7f3SPavan Nikhilesh  * When the value of ``rte_event_dev_info::max_profiles_per_port`` is greater
1991d007a7f3SPavan Nikhilesh  * than or equal to one, this function unlinks the event queues from the default
1992d007a7f3SPavan Nikhilesh  * profile identifier i.e. profile 0 of the event port.
1993d007a7f3SPavan Nikhilesh  *
199499a2dd95SBruce Richardson  * @see rte_event_port_unlinks_in_progress() to poll for completed unlinks.
199599a2dd95SBruce Richardson  *
199699a2dd95SBruce Richardson  * @param dev_id
199799a2dd95SBruce Richardson  *   The identifier of the device.
199899a2dd95SBruce Richardson  *
199999a2dd95SBruce Richardson  * @param port_id
200099a2dd95SBruce Richardson  *   Event port identifier to select the destination port to unlink.
200199a2dd95SBruce Richardson  *
200299a2dd95SBruce Richardson  * @param queues
200399a2dd95SBruce Richardson  *   Points to an array of *nb_unlinks* event queues to be unlinked
200499a2dd95SBruce Richardson  *   from the event port.
200599a2dd95SBruce Richardson  *   NULL value is allowed, in which case this function unlinks all the
200699a2dd95SBruce Richardson  *   event queue(s) from the event port *port_id*.
200799a2dd95SBruce Richardson  *
200899a2dd95SBruce Richardson  * @param nb_unlinks
200999a2dd95SBruce Richardson  *   The number of unlinks to establish. This parameter is ignored if queues is
201099a2dd95SBruce Richardson  *   NULL.
201199a2dd95SBruce Richardson  *
201299a2dd95SBruce Richardson  * @return
201399a2dd95SBruce Richardson  * The number of unlinks successfully requested. The return value can be less
201499a2dd95SBruce Richardson  * than the value of the *nb_unlinks* parameter when the implementation has the
201599a2dd95SBruce Richardson  * limitation on specific queue to port unlink establishment or
201699a2dd95SBruce Richardson  * if invalid parameters are specified.
201799a2dd95SBruce Richardson  * If the return value is less than *nb_unlinks*, the remaining queues at the
201899a2dd95SBruce Richardson  * end of queues[] are not unlinked, and the caller has to take care of them.
201999a2dd95SBruce Richardson  * If return value is less than *nb_unlinks* then implementation shall update
202099a2dd95SBruce Richardson  * the rte_errno accordingly, Possible rte_errno values are
202199a2dd95SBruce Richardson  * (EINVAL) Invalid parameter
202299a2dd95SBruce Richardson  */
202399a2dd95SBruce Richardson int
202499a2dd95SBruce Richardson rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
202599a2dd95SBruce Richardson 		      uint8_t queues[], uint16_t nb_unlinks);
202699a2dd95SBruce Richardson 
202799a2dd95SBruce Richardson /**
2028d007a7f3SPavan Nikhilesh  * Link multiple source event queues supplied in *queues* to the destination
2029d007a7f3SPavan Nikhilesh  * event port designated by its *port_id* with associated profile identifier
2030d007a7f3SPavan Nikhilesh  * supplied in *profile_id* with service priorities supplied in *priorities*
2031d007a7f3SPavan Nikhilesh  * on the event device designated by its *dev_id*.
2032d007a7f3SPavan Nikhilesh  *
2033d007a7f3SPavan Nikhilesh  * If *profile_id* is set to 0 then, the links created by the call `rte_event_port_link`
2034d007a7f3SPavan Nikhilesh  * will be overwritten.
2035d007a7f3SPavan Nikhilesh  *
2036d007a7f3SPavan Nikhilesh  * Event ports by default use profile_id 0 unless it is changed using the
2037d007a7f3SPavan Nikhilesh  * call ``rte_event_port_profile_switch()``.
2038d007a7f3SPavan Nikhilesh  *
2039d007a7f3SPavan Nikhilesh  * The link establishment shall enable the event port *port_id* from
2040d007a7f3SPavan Nikhilesh  * receiving events from the specified event queue(s) supplied in *queues*
2041d007a7f3SPavan Nikhilesh  *
2042d007a7f3SPavan Nikhilesh  * An event queue may link to one or more event ports.
2043d007a7f3SPavan Nikhilesh  * The number of links can be established from an event queue to event port is
2044d007a7f3SPavan Nikhilesh  * implementation defined.
2045d007a7f3SPavan Nikhilesh  *
2046d007a7f3SPavan Nikhilesh  * Event queue(s) to event port link establishment can be changed at runtime
2047d007a7f3SPavan Nikhilesh  * without re-configuring the device to support scaling and to reduce the
2048d007a7f3SPavan Nikhilesh  * latency of critical work by establishing the link with more event ports
2049d007a7f3SPavan Nikhilesh  * at runtime.
2050d007a7f3SPavan Nikhilesh  *
2051d007a7f3SPavan Nikhilesh  * @param dev_id
2052d007a7f3SPavan Nikhilesh  *   The identifier of the device.
2053d007a7f3SPavan Nikhilesh  *
2054d007a7f3SPavan Nikhilesh  * @param port_id
2055d007a7f3SPavan Nikhilesh  *   Event port identifier to select the destination port to link.
2056d007a7f3SPavan Nikhilesh  *
2057d007a7f3SPavan Nikhilesh  * @param queues
2058d007a7f3SPavan Nikhilesh  *   Points to an array of *nb_links* event queues to be linked
2059d007a7f3SPavan Nikhilesh  *   to the event port.
2060d007a7f3SPavan Nikhilesh  *   NULL value is allowed, in which case this function links all the configured
2061d007a7f3SPavan Nikhilesh  *   event queues *nb_event_queues* which previously supplied to
2062d007a7f3SPavan Nikhilesh  *   rte_event_dev_configure() to the event port *port_id*
2063d007a7f3SPavan Nikhilesh  *
2064d007a7f3SPavan Nikhilesh  * @param priorities
2065d007a7f3SPavan Nikhilesh  *   Points to an array of *nb_links* service priorities associated with each
2066d007a7f3SPavan Nikhilesh  *   event queue link to event port.
2067d007a7f3SPavan Nikhilesh  *   The priority defines the event port's servicing priority for
2068d007a7f3SPavan Nikhilesh  *   event queue, which may be ignored by an implementation.
2069d007a7f3SPavan Nikhilesh  *   The requested priority should in the range of
2070d007a7f3SPavan Nikhilesh  *   [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST].
2071d007a7f3SPavan Nikhilesh  *   The implementation shall normalize the requested priority to
2072d007a7f3SPavan Nikhilesh  *   implementation supported priority value.
2073d007a7f3SPavan Nikhilesh  *   NULL value is allowed, in which case this function links the event queues
2074d007a7f3SPavan Nikhilesh  *   with RTE_EVENT_DEV_PRIORITY_NORMAL servicing priority
2075d007a7f3SPavan Nikhilesh  *
2076d007a7f3SPavan Nikhilesh  * @param nb_links
2077d007a7f3SPavan Nikhilesh  *   The number of links to establish. This parameter is ignored if queues is
2078d007a7f3SPavan Nikhilesh  *   NULL.
2079d007a7f3SPavan Nikhilesh  *
2080d007a7f3SPavan Nikhilesh  * @param profile_id
2081d007a7f3SPavan Nikhilesh  *   The profile identifier associated with the links between event queues and
2082d007a7f3SPavan Nikhilesh  *   event port. Should be less than the max capability reported by
2083d007a7f3SPavan Nikhilesh  *   ``rte_event_dev_info::max_profiles_per_port``
2084d007a7f3SPavan Nikhilesh  *
2085d007a7f3SPavan Nikhilesh  * @return
2086d007a7f3SPavan Nikhilesh  * The number of links actually established. The return value can be less than
2087d007a7f3SPavan Nikhilesh  * the value of the *nb_links* parameter when the implementation has the
2088d007a7f3SPavan Nikhilesh  * limitation on specific queue to port link establishment or if invalid
2089d007a7f3SPavan Nikhilesh  * parameters are specified in *queues*
2090d007a7f3SPavan Nikhilesh  * If the return value is less than *nb_links*, the remaining links at the end
2091d007a7f3SPavan Nikhilesh  * of link[] are not established, and the caller has to take care of them.
2092d007a7f3SPavan Nikhilesh  * If return value is less than *nb_links* then implementation shall update the
2093d007a7f3SPavan Nikhilesh  * rte_errno accordingly, Possible rte_errno values are
2094d007a7f3SPavan Nikhilesh  * (EDQUOT) Quota exceeded(Application tried to link the queue configured with
2095d007a7f3SPavan Nikhilesh  *  RTE_EVENT_QUEUE_CFG_SINGLE_LINK to more than one event ports)
2096d007a7f3SPavan Nikhilesh  * (EINVAL) Invalid parameter
2097d007a7f3SPavan Nikhilesh  *
2098d007a7f3SPavan Nikhilesh  */
2099d007a7f3SPavan Nikhilesh __rte_experimental
2100d007a7f3SPavan Nikhilesh int
2101d007a7f3SPavan Nikhilesh rte_event_port_profile_links_set(uint8_t dev_id, uint8_t port_id, const uint8_t queues[],
2102d007a7f3SPavan Nikhilesh 				 const uint8_t priorities[], uint16_t nb_links, uint8_t profile_id);
2103d007a7f3SPavan Nikhilesh 
2104d007a7f3SPavan Nikhilesh /**
2105d007a7f3SPavan Nikhilesh  * Unlink multiple source event queues supplied in *queues* that belong to profile
2106d007a7f3SPavan Nikhilesh  * designated by *profile_id* from the destination event port designated by its
2107d007a7f3SPavan Nikhilesh  * *port_id* on the event device designated by its *dev_id*.
2108d007a7f3SPavan Nikhilesh  *
2109d007a7f3SPavan Nikhilesh  * If *profile_id* is set to 0 i.e., the default profile then, then this function
2110d007a7f3SPavan Nikhilesh  * will act as ``rte_event_port_unlink``.
2111d007a7f3SPavan Nikhilesh  *
2112d007a7f3SPavan Nikhilesh  * The unlink call issues an async request to disable the event port *port_id*
2113d007a7f3SPavan Nikhilesh  * from receiving events from the specified event queue *queue_id*.
2114d007a7f3SPavan Nikhilesh  * Event queue(s) to event port unlink establishment can be changed at runtime
2115d007a7f3SPavan Nikhilesh  * without re-configuring the device.
2116d007a7f3SPavan Nikhilesh  *
2117d007a7f3SPavan Nikhilesh  * @see rte_event_port_unlinks_in_progress() to poll for completed unlinks.
2118d007a7f3SPavan Nikhilesh  *
2119d007a7f3SPavan Nikhilesh  * @param dev_id
2120d007a7f3SPavan Nikhilesh  *   The identifier of the device.
2121d007a7f3SPavan Nikhilesh  *
2122d007a7f3SPavan Nikhilesh  * @param port_id
2123d007a7f3SPavan Nikhilesh  *   Event port identifier to select the destination port to unlink.
2124d007a7f3SPavan Nikhilesh  *
2125d007a7f3SPavan Nikhilesh  * @param queues
2126d007a7f3SPavan Nikhilesh  *   Points to an array of *nb_unlinks* event queues to be unlinked
2127d007a7f3SPavan Nikhilesh  *   from the event port.
2128d007a7f3SPavan Nikhilesh  *   NULL value is allowed, in which case this function unlinks all the
2129d007a7f3SPavan Nikhilesh  *   event queue(s) from the event port *port_id*.
2130d007a7f3SPavan Nikhilesh  *
2131d007a7f3SPavan Nikhilesh  * @param nb_unlinks
2132d007a7f3SPavan Nikhilesh  *   The number of unlinks to establish. This parameter is ignored if queues is
2133d007a7f3SPavan Nikhilesh  *   NULL.
2134d007a7f3SPavan Nikhilesh  *
2135d007a7f3SPavan Nikhilesh  * @param profile_id
2136d007a7f3SPavan Nikhilesh  *   The profile identifier associated with the links between event queues and
2137d007a7f3SPavan Nikhilesh  *   event port. Should be less than the max capability reported by
2138d007a7f3SPavan Nikhilesh  *   ``rte_event_dev_info::max_profiles_per_port``
2139d007a7f3SPavan Nikhilesh  *
2140d007a7f3SPavan Nikhilesh  * @return
2141d007a7f3SPavan Nikhilesh  * The number of unlinks successfully requested. The return value can be less
2142d007a7f3SPavan Nikhilesh  * than the value of the *nb_unlinks* parameter when the implementation has the
2143d007a7f3SPavan Nikhilesh  * limitation on specific queue to port unlink establishment or
2144d007a7f3SPavan Nikhilesh  * if invalid parameters are specified.
2145d007a7f3SPavan Nikhilesh  * If the return value is less than *nb_unlinks*, the remaining queues at the
2146d007a7f3SPavan Nikhilesh  * end of queues[] are not unlinked, and the caller has to take care of them.
2147d007a7f3SPavan Nikhilesh  * If return value is less than *nb_unlinks* then implementation shall update
2148d007a7f3SPavan Nikhilesh  * the rte_errno accordingly, Possible rte_errno values are
2149d007a7f3SPavan Nikhilesh  * (EINVAL) Invalid parameter
2150d007a7f3SPavan Nikhilesh  *
2151d007a7f3SPavan Nikhilesh  */
2152d007a7f3SPavan Nikhilesh __rte_experimental
2153d007a7f3SPavan Nikhilesh int
2154d007a7f3SPavan Nikhilesh rte_event_port_profile_unlink(uint8_t dev_id, uint8_t port_id, uint8_t queues[],
2155d007a7f3SPavan Nikhilesh 			      uint16_t nb_unlinks, uint8_t profile_id);
2156d007a7f3SPavan Nikhilesh 
2157d007a7f3SPavan Nikhilesh /**
215899a2dd95SBruce Richardson  * Returns the number of unlinks in progress.
215999a2dd95SBruce Richardson  *
216099a2dd95SBruce Richardson  * This function provides the application with a method to detect when an
216199a2dd95SBruce Richardson  * unlink has been completed by the implementation.
216299a2dd95SBruce Richardson  *
216399a2dd95SBruce Richardson  * @see rte_event_port_unlink() to issue unlink requests.
216499a2dd95SBruce Richardson  *
216599a2dd95SBruce Richardson  * @param dev_id
216699a2dd95SBruce Richardson  *   The identifier of the device.
216799a2dd95SBruce Richardson  *
216899a2dd95SBruce Richardson  * @param port_id
216999a2dd95SBruce Richardson  *   Event port identifier to select port to check for unlinks in progress.
217099a2dd95SBruce Richardson  *
217199a2dd95SBruce Richardson  * @return
217299a2dd95SBruce Richardson  * The number of unlinks that are in progress. A return of zero indicates that
217399a2dd95SBruce Richardson  * there are no outstanding unlink requests. A positive return value indicates
217499a2dd95SBruce Richardson  * the number of unlinks that are in progress, but are not yet complete.
217599a2dd95SBruce Richardson  * A negative return value indicates an error, -EINVAL indicates an invalid
217699a2dd95SBruce Richardson  * parameter passed for *dev_id* or *port_id*.
217799a2dd95SBruce Richardson  */
217899a2dd95SBruce Richardson int
217999a2dd95SBruce Richardson rte_event_port_unlinks_in_progress(uint8_t dev_id, uint8_t port_id);
218099a2dd95SBruce Richardson 
218199a2dd95SBruce Richardson /**
218299a2dd95SBruce Richardson  * Retrieve the list of source event queues and its associated service priority
218399a2dd95SBruce Richardson  * linked to the destination event port designated by its *port_id*
218499a2dd95SBruce Richardson  * on the event device designated by its *dev_id*.
218599a2dd95SBruce Richardson  *
218699a2dd95SBruce Richardson  * @param dev_id
218799a2dd95SBruce Richardson  *   The identifier of the device.
218899a2dd95SBruce Richardson  *
218999a2dd95SBruce Richardson  * @param port_id
219099a2dd95SBruce Richardson  *   Event port identifier.
219199a2dd95SBruce Richardson  *
219299a2dd95SBruce Richardson  * @param[out] queues
219399a2dd95SBruce Richardson  *   Points to an array of *queues* for output.
219499a2dd95SBruce Richardson  *   The caller has to allocate *RTE_EVENT_MAX_QUEUES_PER_DEV* bytes to
219599a2dd95SBruce Richardson  *   store the event queue(s) linked with event port *port_id*
219699a2dd95SBruce Richardson  *
219799a2dd95SBruce Richardson  * @param[out] priorities
219899a2dd95SBruce Richardson  *   Points to an array of *priorities* for output.
219999a2dd95SBruce Richardson  *   The caller has to allocate *RTE_EVENT_MAX_QUEUES_PER_DEV* bytes to
220099a2dd95SBruce Richardson  *   store the service priority associated with each event queue linked
220199a2dd95SBruce Richardson  *
220299a2dd95SBruce Richardson  * @return
220399a2dd95SBruce Richardson  * The number of links established on the event port designated by its
220499a2dd95SBruce Richardson  *  *port_id*.
220599a2dd95SBruce Richardson  * - <0 on failure.
220699a2dd95SBruce Richardson  */
220799a2dd95SBruce Richardson int
220899a2dd95SBruce Richardson rte_event_port_links_get(uint8_t dev_id, uint8_t port_id,
220999a2dd95SBruce Richardson 			 uint8_t queues[], uint8_t priorities[]);
221099a2dd95SBruce Richardson 
221199a2dd95SBruce Richardson /**
2212d007a7f3SPavan Nikhilesh  * Retrieve the list of source event queues and its service priority
2213d007a7f3SPavan Nikhilesh  * associated to a *profile_id* and linked to the destination event port
2214d007a7f3SPavan Nikhilesh  * designated by its *port_id* on the event device designated by its *dev_id*.
2215d007a7f3SPavan Nikhilesh  *
2216d007a7f3SPavan Nikhilesh  * @param dev_id
2217d007a7f3SPavan Nikhilesh  *   The identifier of the device.
2218d007a7f3SPavan Nikhilesh  *
2219d007a7f3SPavan Nikhilesh  * @param port_id
2220d007a7f3SPavan Nikhilesh  *   Event port identifier.
2221d007a7f3SPavan Nikhilesh  *
2222d007a7f3SPavan Nikhilesh  * @param[out] queues
2223d007a7f3SPavan Nikhilesh  *   Points to an array of *queues* for output.
2224d007a7f3SPavan Nikhilesh  *   The caller has to allocate *RTE_EVENT_MAX_QUEUES_PER_DEV* bytes to
2225d007a7f3SPavan Nikhilesh  *   store the event queue(s) linked with event port *port_id*
2226d007a7f3SPavan Nikhilesh  *
2227d007a7f3SPavan Nikhilesh  * @param[out] priorities
2228d007a7f3SPavan Nikhilesh  *   Points to an array of *priorities* for output.
2229d007a7f3SPavan Nikhilesh  *   The caller has to allocate *RTE_EVENT_MAX_QUEUES_PER_DEV* bytes to
2230d007a7f3SPavan Nikhilesh  *   store the service priority associated with each event queue linked
2231d007a7f3SPavan Nikhilesh  *
2232d007a7f3SPavan Nikhilesh  * @param profile_id
2233d007a7f3SPavan Nikhilesh  *   The profile identifier associated with the links between event queues and
2234d007a7f3SPavan Nikhilesh  *   event port. Should be less than the max capability reported by
2235d007a7f3SPavan Nikhilesh  *   ``rte_event_dev_info::max_profiles_per_port``
2236d007a7f3SPavan Nikhilesh  *
2237d007a7f3SPavan Nikhilesh  * @return
2238d007a7f3SPavan Nikhilesh  * The number of links established on the event port designated by its
2239d007a7f3SPavan Nikhilesh  *  *port_id*.
2240d007a7f3SPavan Nikhilesh  * - <0 on failure.
2241d007a7f3SPavan Nikhilesh  */
2242d007a7f3SPavan Nikhilesh __rte_experimental
2243d007a7f3SPavan Nikhilesh int
2244d007a7f3SPavan Nikhilesh rte_event_port_profile_links_get(uint8_t dev_id, uint8_t port_id, uint8_t queues[],
2245d007a7f3SPavan Nikhilesh 				 uint8_t priorities[], uint8_t profile_id);
2246d007a7f3SPavan Nikhilesh 
2247d007a7f3SPavan Nikhilesh /**
224899a2dd95SBruce Richardson  * Retrieve the service ID of the event dev. If the adapter doesn't use
224999a2dd95SBruce Richardson  * a rte_service function, this function returns -ESRCH.
225099a2dd95SBruce Richardson  *
225199a2dd95SBruce Richardson  * @param dev_id
225299a2dd95SBruce Richardson  *   The identifier of the device.
225399a2dd95SBruce Richardson  *
225499a2dd95SBruce Richardson  * @param [out] service_id
225599a2dd95SBruce Richardson  *   A pointer to a uint32_t, to be filled in with the service id.
225699a2dd95SBruce Richardson  *
225799a2dd95SBruce Richardson  * @return
225899a2dd95SBruce Richardson  *   - 0: Success
225999a2dd95SBruce Richardson  *   - <0: Error code on failure, if the event dev doesn't use a rte_service
226099a2dd95SBruce Richardson  *   function, this function returns -ESRCH.
226199a2dd95SBruce Richardson  */
226299a2dd95SBruce Richardson int
226399a2dd95SBruce Richardson rte_event_dev_service_id_get(uint8_t dev_id, uint32_t *service_id);
226499a2dd95SBruce Richardson 
226599a2dd95SBruce Richardson /**
226699a2dd95SBruce Richardson  * Dump internal information about *dev_id* to the FILE* provided in *f*.
226799a2dd95SBruce Richardson  *
226899a2dd95SBruce Richardson  * @param dev_id
226999a2dd95SBruce Richardson  *   The identifier of the device.
227099a2dd95SBruce Richardson  *
227199a2dd95SBruce Richardson  * @param f
227299a2dd95SBruce Richardson  *   A pointer to a file for output
227399a2dd95SBruce Richardson  *
227499a2dd95SBruce Richardson  * @return
227599a2dd95SBruce Richardson  *   - 0: on success
227699a2dd95SBruce Richardson  *   - <0: on failure.
227799a2dd95SBruce Richardson  */
227899a2dd95SBruce Richardson int
227999a2dd95SBruce Richardson rte_event_dev_dump(uint8_t dev_id, FILE *f);
228099a2dd95SBruce Richardson 
228199a2dd95SBruce Richardson /** Maximum name length for extended statistics counters */
228299a2dd95SBruce Richardson #define RTE_EVENT_DEV_XSTATS_NAME_SIZE 64
228399a2dd95SBruce Richardson 
228499a2dd95SBruce Richardson /**
228599a2dd95SBruce Richardson  * Selects the component of the eventdev to retrieve statistics from.
228699a2dd95SBruce Richardson  */
228799a2dd95SBruce Richardson enum rte_event_dev_xstats_mode {
228899a2dd95SBruce Richardson 	RTE_EVENT_DEV_XSTATS_DEVICE,
228999a2dd95SBruce Richardson 	RTE_EVENT_DEV_XSTATS_PORT,
229099a2dd95SBruce Richardson 	RTE_EVENT_DEV_XSTATS_QUEUE,
229199a2dd95SBruce Richardson };
229299a2dd95SBruce Richardson 
229399a2dd95SBruce Richardson /**
229499a2dd95SBruce Richardson  * A name-key lookup element for extended statistics.
229599a2dd95SBruce Richardson  *
229699a2dd95SBruce Richardson  * This structure is used to map between names and ID numbers
229799a2dd95SBruce Richardson  * for extended ethdev statistics.
229899a2dd95SBruce Richardson  */
229999a2dd95SBruce Richardson struct rte_event_dev_xstats_name {
230099a2dd95SBruce Richardson 	char name[RTE_EVENT_DEV_XSTATS_NAME_SIZE];
230199a2dd95SBruce Richardson };
230299a2dd95SBruce Richardson 
230399a2dd95SBruce Richardson /**
230499a2dd95SBruce Richardson  * Retrieve names of extended statistics of an event device.
230599a2dd95SBruce Richardson  *
230699a2dd95SBruce Richardson  * @param dev_id
230799a2dd95SBruce Richardson  *   The identifier of the event device.
230899a2dd95SBruce Richardson  * @param mode
230999a2dd95SBruce Richardson  *   The mode of statistics to retrieve. Choices include the device statistics,
231099a2dd95SBruce Richardson  *   port statistics or queue statistics.
231199a2dd95SBruce Richardson  * @param queue_port_id
231299a2dd95SBruce Richardson  *   Used to specify the port or queue number in queue or port mode, and is
231399a2dd95SBruce Richardson  *   ignored in device mode.
231499a2dd95SBruce Richardson  * @param[out] xstats_names
231599a2dd95SBruce Richardson  *   Block of memory to insert names into. Must be at least size in capacity.
231699a2dd95SBruce Richardson  *   If set to NULL, function returns required capacity.
231799a2dd95SBruce Richardson  * @param[out] ids
231899a2dd95SBruce Richardson  *   Block of memory to insert ids into. Must be at least size in capacity.
231999a2dd95SBruce Richardson  *   If set to NULL, function returns required capacity. The id values returned
232099a2dd95SBruce Richardson  *   can be passed to *rte_event_dev_xstats_get* to select statistics.
232199a2dd95SBruce Richardson  * @param size
232299a2dd95SBruce Richardson  *   Capacity of xstats_names (number of names).
232399a2dd95SBruce Richardson  * @return
232499a2dd95SBruce Richardson  *   - positive value lower or equal to size: success. The return value
232599a2dd95SBruce Richardson  *     is the number of entries filled in the stats table.
232699a2dd95SBruce Richardson  *   - positive value higher than size: error, the given statistics table
232799a2dd95SBruce Richardson  *     is too small. The return value corresponds to the size that should
232899a2dd95SBruce Richardson  *     be given to succeed. The entries in the table are not valid and
232999a2dd95SBruce Richardson  *     shall not be used by the caller.
233099a2dd95SBruce Richardson  *   - negative value on error:
233199a2dd95SBruce Richardson  *        -ENODEV for invalid *dev_id*
233299a2dd95SBruce Richardson  *        -EINVAL for invalid mode, queue port or id parameters
233399a2dd95SBruce Richardson  *        -ENOTSUP if the device doesn't support this function.
233499a2dd95SBruce Richardson  */
233599a2dd95SBruce Richardson int
233699a2dd95SBruce Richardson rte_event_dev_xstats_names_get(uint8_t dev_id,
233799a2dd95SBruce Richardson 			       enum rte_event_dev_xstats_mode mode,
233899a2dd95SBruce Richardson 			       uint8_t queue_port_id,
233999a2dd95SBruce Richardson 			       struct rte_event_dev_xstats_name *xstats_names,
23401bdfe4d7SPavan Nikhilesh 			       uint64_t *ids,
234199a2dd95SBruce Richardson 			       unsigned int size);
234299a2dd95SBruce Richardson 
234399a2dd95SBruce Richardson /**
234499a2dd95SBruce Richardson  * Retrieve extended statistics of an event device.
234599a2dd95SBruce Richardson  *
234699a2dd95SBruce Richardson  * @param dev_id
234799a2dd95SBruce Richardson  *   The identifier of the device.
234899a2dd95SBruce Richardson  * @param mode
234999a2dd95SBruce Richardson  *  The mode of statistics to retrieve. Choices include the device statistics,
235099a2dd95SBruce Richardson  *  port statistics or queue statistics.
235199a2dd95SBruce Richardson  * @param queue_port_id
235299a2dd95SBruce Richardson  *   Used to specify the port or queue number in queue or port mode, and is
235399a2dd95SBruce Richardson  *   ignored in device mode.
235499a2dd95SBruce Richardson  * @param ids
235599a2dd95SBruce Richardson  *   The id numbers of the stats to get. The ids can be got from the stat
235699a2dd95SBruce Richardson  *   position in the stat list from rte_event_dev_get_xstats_names(), or
235799a2dd95SBruce Richardson  *   by using rte_event_dev_xstats_by_name_get().
235899a2dd95SBruce Richardson  * @param[out] values
235999a2dd95SBruce Richardson  *   The values for each stats request by ID.
236099a2dd95SBruce Richardson  * @param n
236199a2dd95SBruce Richardson  *   The number of stats requested
236299a2dd95SBruce Richardson  * @return
236399a2dd95SBruce Richardson  *   - positive value: number of stat entries filled into the values array
236499a2dd95SBruce Richardson  *   - negative value on error:
236599a2dd95SBruce Richardson  *        -ENODEV for invalid *dev_id*
236699a2dd95SBruce Richardson  *        -EINVAL for invalid mode, queue port or id parameters
236799a2dd95SBruce Richardson  *        -ENOTSUP if the device doesn't support this function.
236899a2dd95SBruce Richardson  */
236999a2dd95SBruce Richardson int
237099a2dd95SBruce Richardson rte_event_dev_xstats_get(uint8_t dev_id,
237199a2dd95SBruce Richardson 			 enum rte_event_dev_xstats_mode mode,
237299a2dd95SBruce Richardson 			 uint8_t queue_port_id,
23731bdfe4d7SPavan Nikhilesh 			 const uint64_t ids[],
237499a2dd95SBruce Richardson 			 uint64_t values[], unsigned int n);
237599a2dd95SBruce Richardson 
237699a2dd95SBruce Richardson /**
237799a2dd95SBruce Richardson  * Retrieve the value of a single stat by requesting it by name.
237899a2dd95SBruce Richardson  *
237999a2dd95SBruce Richardson  * @param dev_id
238099a2dd95SBruce Richardson  *   The identifier of the device
238199a2dd95SBruce Richardson  * @param name
238299a2dd95SBruce Richardson  *   The stat name to retrieve
238399a2dd95SBruce Richardson  * @param[out] id
238499a2dd95SBruce Richardson  *   If non-NULL, the numerical id of the stat will be returned, so that further
238599a2dd95SBruce Richardson  *   requests for the stat can be got using rte_event_dev_xstats_get, which will
238699a2dd95SBruce Richardson  *   be faster as it doesn't need to scan a list of names for the stat.
238799a2dd95SBruce Richardson  *   If the stat cannot be found, the id returned will be (unsigned)-1.
238899a2dd95SBruce Richardson  * @return
238999a2dd95SBruce Richardson  *   - positive value or zero: the stat value
239099a2dd95SBruce Richardson  *   - negative value: -EINVAL if stat not found, -ENOTSUP if not supported.
239199a2dd95SBruce Richardson  */
239299a2dd95SBruce Richardson uint64_t
239399a2dd95SBruce Richardson rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
23941bdfe4d7SPavan Nikhilesh 				 uint64_t *id);
239599a2dd95SBruce Richardson 
239699a2dd95SBruce Richardson /**
239799a2dd95SBruce Richardson  * Reset the values of the xstats of the selected component in the device.
239899a2dd95SBruce Richardson  *
239999a2dd95SBruce Richardson  * @param dev_id
240099a2dd95SBruce Richardson  *   The identifier of the device
240199a2dd95SBruce Richardson  * @param mode
240299a2dd95SBruce Richardson  *   The mode of the statistics to reset. Choose from device, queue or port.
240399a2dd95SBruce Richardson  * @param queue_port_id
240499a2dd95SBruce Richardson  *   The queue or port to reset. 0 and positive values select ports and queues,
240599a2dd95SBruce Richardson  *   while -1 indicates all ports or queues.
240699a2dd95SBruce Richardson  * @param ids
240799a2dd95SBruce Richardson  *   Selects specific statistics to be reset. When NULL, all statistics selected
240899a2dd95SBruce Richardson  *   by *mode* will be reset. If non-NULL, must point to array of at least
240999a2dd95SBruce Richardson  *   *nb_ids* size.
241099a2dd95SBruce Richardson  * @param nb_ids
241199a2dd95SBruce Richardson  *   The number of ids available from the *ids* array. Ignored when ids is NULL.
241299a2dd95SBruce Richardson  * @return
241399a2dd95SBruce Richardson  *   - zero: successfully reset the statistics to zero
241499a2dd95SBruce Richardson  *   - negative value: -EINVAL invalid parameters, -ENOTSUP if not supported.
241599a2dd95SBruce Richardson  */
241699a2dd95SBruce Richardson int
241799a2dd95SBruce Richardson rte_event_dev_xstats_reset(uint8_t dev_id,
241899a2dd95SBruce Richardson 			   enum rte_event_dev_xstats_mode mode,
241999a2dd95SBruce Richardson 			   int16_t queue_port_id,
24201bdfe4d7SPavan Nikhilesh 			   const uint64_t ids[],
242199a2dd95SBruce Richardson 			   uint32_t nb_ids);
242299a2dd95SBruce Richardson 
242399a2dd95SBruce Richardson /**
242499a2dd95SBruce Richardson  * Trigger the eventdev self test.
242599a2dd95SBruce Richardson  *
242699a2dd95SBruce Richardson  * @param dev_id
242799a2dd95SBruce Richardson  *   The identifier of the device
242899a2dd95SBruce Richardson  * @return
242999a2dd95SBruce Richardson  *   - 0: Selftest successful
243099a2dd95SBruce Richardson  *   - -ENOTSUP if the device doesn't support selftest
243199a2dd95SBruce Richardson  *   - other values < 0 on failure.
243299a2dd95SBruce Richardson  */
243399a2dd95SBruce Richardson int rte_event_dev_selftest(uint8_t dev_id);
243499a2dd95SBruce Richardson 
243599a2dd95SBruce Richardson /**
243699a2dd95SBruce Richardson  * Get the memory required per event vector based on the number of elements per
243799a2dd95SBruce Richardson  * vector.
243899a2dd95SBruce Richardson  * This should be used to create the mempool that holds the event vectors.
243999a2dd95SBruce Richardson  *
244099a2dd95SBruce Richardson  * @param name
244199a2dd95SBruce Richardson  *   The name of the vector pool.
244299a2dd95SBruce Richardson  * @param n
244399a2dd95SBruce Richardson  *   The number of elements in the mbuf pool.
244499a2dd95SBruce Richardson  * @param cache_size
244599a2dd95SBruce Richardson  *   Size of the per-core object cache. See rte_mempool_create() for
244699a2dd95SBruce Richardson  *   details.
244799a2dd95SBruce Richardson  * @param nb_elem
244899a2dd95SBruce Richardson  *   The number of elements that a single event vector should be able to hold.
244999a2dd95SBruce Richardson  * @param socket_id
245099a2dd95SBruce Richardson  *   The socket identifier where the memory should be allocated. The
245199a2dd95SBruce Richardson  *   value can be *SOCKET_ID_ANY* if there is no NUMA constraint for the
245299a2dd95SBruce Richardson  *   reserved zone
245399a2dd95SBruce Richardson  *
245499a2dd95SBruce Richardson  * @return
245599a2dd95SBruce Richardson  *   The pointer to the newly allocated mempool, on success. NULL on error
245699a2dd95SBruce Richardson  *   with rte_errno set appropriately. Possible rte_errno values include:
245799a2dd95SBruce Richardson  *    - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
245899a2dd95SBruce Richardson  *    - E_RTE_SECONDARY - function was called from a secondary process instance
245999a2dd95SBruce Richardson  *    - EINVAL - cache size provided is too large, or priv_size is not aligned.
246099a2dd95SBruce Richardson  *    - ENOSPC - the maximum number of memzones has already been allocated
246199a2dd95SBruce Richardson  *    - EEXIST - a memzone with the same name already exists
246299a2dd95SBruce Richardson  *    - ENOMEM - no appropriate memory area found in which to create memzone
246399a2dd95SBruce Richardson  *    - ENAMETOOLONG - mempool name requested is too long.
246499a2dd95SBruce Richardson  */
246599a2dd95SBruce Richardson struct rte_mempool *
246699a2dd95SBruce Richardson rte_event_vector_pool_create(const char *name, unsigned int n,
246799a2dd95SBruce Richardson 			     unsigned int cache_size, uint16_t nb_elem,
246899a2dd95SBruce Richardson 			     int socket_id);
246999a2dd95SBruce Richardson 
247026f14535SPavan Nikhilesh #include <rte_eventdev_core.h>
247126f14535SPavan Nikhilesh 
247226f14535SPavan Nikhilesh static __rte_always_inline uint16_t
247326f14535SPavan Nikhilesh __rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id,
247426f14535SPavan Nikhilesh 			  const struct rte_event ev[], uint16_t nb_events,
247526f14535SPavan Nikhilesh 			  const event_enqueue_burst_t fn)
247626f14535SPavan Nikhilesh {
2477052e25d9SPavan Nikhilesh 	const struct rte_event_fp_ops *fp_ops;
2478052e25d9SPavan Nikhilesh 	void *port;
247926f14535SPavan Nikhilesh 
2480052e25d9SPavan Nikhilesh 	fp_ops = &rte_event_fp_ops[dev_id];
2481052e25d9SPavan Nikhilesh 	port = fp_ops->data[port_id];
248226f14535SPavan Nikhilesh #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
2483052e25d9SPavan Nikhilesh 	if (dev_id >= RTE_EVENT_MAX_DEVS ||
2484052e25d9SPavan Nikhilesh 	    port_id >= RTE_EVENT_MAX_PORTS_PER_DEV) {
248526f14535SPavan Nikhilesh 		rte_errno = EINVAL;
248626f14535SPavan Nikhilesh 		return 0;
248726f14535SPavan Nikhilesh 	}
248826f14535SPavan Nikhilesh 
2489052e25d9SPavan Nikhilesh 	if (port == NULL) {
249026f14535SPavan Nikhilesh 		rte_errno = EINVAL;
249126f14535SPavan Nikhilesh 		return 0;
249226f14535SPavan Nikhilesh 	}
249326f14535SPavan Nikhilesh #endif
2494153e7d88SBruce Richardson 	rte_eventdev_trace_enq_burst(dev_id, port_id, ev, nb_events, (void *)fn);
249526f14535SPavan Nikhilesh 	/*
249626f14535SPavan Nikhilesh 	 * Allow zero cost non burst mode routine invocation if application
249726f14535SPavan Nikhilesh 	 * requests nb_events as const one
249826f14535SPavan Nikhilesh 	 */
249926f14535SPavan Nikhilesh 	if (nb_events == 1)
2500052e25d9SPavan Nikhilesh 		return (fp_ops->enqueue)(port, ev);
250126f14535SPavan Nikhilesh 	else
2502052e25d9SPavan Nikhilesh 		return fn(port, ev, nb_events);
250326f14535SPavan Nikhilesh }
250426f14535SPavan Nikhilesh 
250526f14535SPavan Nikhilesh /**
250626f14535SPavan Nikhilesh  * Enqueue a burst of events objects or an event object supplied in *rte_event*
250726f14535SPavan Nikhilesh  * structure on an  event device designated by its *dev_id* through the event
250826f14535SPavan Nikhilesh  * port specified by *port_id*. Each event object specifies the event queue on
250926f14535SPavan Nikhilesh  * which it will be enqueued.
251026f14535SPavan Nikhilesh  *
251126f14535SPavan Nikhilesh  * The *nb_events* parameter is the number of event objects to enqueue which are
251226f14535SPavan Nikhilesh  * supplied in the *ev* array of *rte_event* structure.
251326f14535SPavan Nikhilesh  *
251426f14535SPavan Nikhilesh  * Event operations RTE_EVENT_OP_FORWARD and RTE_EVENT_OP_RELEASE must only be
251526f14535SPavan Nikhilesh  * enqueued to the same port that their associated events were dequeued from.
251626f14535SPavan Nikhilesh  *
251726f14535SPavan Nikhilesh  * The rte_event_enqueue_burst() function returns the number of
251826f14535SPavan Nikhilesh  * events objects it actually enqueued. A return value equal to *nb_events*
251926f14535SPavan Nikhilesh  * means that all event objects have been enqueued.
252026f14535SPavan Nikhilesh  *
252126f14535SPavan Nikhilesh  * @param dev_id
252226f14535SPavan Nikhilesh  *   The identifier of the device.
252326f14535SPavan Nikhilesh  * @param port_id
252426f14535SPavan Nikhilesh  *   The identifier of the event port.
252526f14535SPavan Nikhilesh  * @param ev
252626f14535SPavan Nikhilesh  *   Points to an array of *nb_events* objects of type *rte_event* structure
252726f14535SPavan Nikhilesh  *   which contain the event object enqueue operations to be processed.
252826f14535SPavan Nikhilesh  * @param nb_events
252926f14535SPavan Nikhilesh  *   The number of event objects to enqueue, typically number of
253026f14535SPavan Nikhilesh  *   rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
253126f14535SPavan Nikhilesh  *   available for this port.
253226f14535SPavan Nikhilesh  *
253326f14535SPavan Nikhilesh  * @return
253426f14535SPavan Nikhilesh  *   The number of event objects actually enqueued on the event device. The
253526f14535SPavan Nikhilesh  *   return value can be less than the value of the *nb_events* parameter when
253626f14535SPavan Nikhilesh  *   the event devices queue is full or if invalid parameters are specified in a
253726f14535SPavan Nikhilesh  *   *rte_event*. If the return value is less than *nb_events*, the remaining
253826f14535SPavan Nikhilesh  *   events at the end of ev[] are not consumed and the caller has to take care
253926f14535SPavan Nikhilesh  *   of them, and rte_errno is set accordingly. Possible errno values include:
254026f14535SPavan Nikhilesh  *   - EINVAL   The port ID is invalid, device ID is invalid, an event's queue
254126f14535SPavan Nikhilesh  *              ID is invalid, or an event's sched type doesn't match the
254226f14535SPavan Nikhilesh  *              capabilities of the destination queue.
254326f14535SPavan Nikhilesh  *   - ENOSPC   The event port was backpressured and unable to enqueue
254426f14535SPavan Nikhilesh  *              one or more events. This error code is only applicable to
254526f14535SPavan Nikhilesh  *              closed systems.
254626f14535SPavan Nikhilesh  * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH
254726f14535SPavan Nikhilesh  */
254826f14535SPavan Nikhilesh static inline uint16_t
254926f14535SPavan Nikhilesh rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id,
255026f14535SPavan Nikhilesh 			const struct rte_event ev[], uint16_t nb_events)
255126f14535SPavan Nikhilesh {
2552052e25d9SPavan Nikhilesh 	const struct rte_event_fp_ops *fp_ops;
255326f14535SPavan Nikhilesh 
2554052e25d9SPavan Nikhilesh 	fp_ops = &rte_event_fp_ops[dev_id];
255526f14535SPavan Nikhilesh 	return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
2556052e25d9SPavan Nikhilesh 					 fp_ops->enqueue_burst);
255726f14535SPavan Nikhilesh }
255826f14535SPavan Nikhilesh 
255926f14535SPavan Nikhilesh /**
256026f14535SPavan Nikhilesh  * Enqueue a burst of events objects of operation type *RTE_EVENT_OP_NEW* on
256126f14535SPavan Nikhilesh  * an event device designated by its *dev_id* through the event port specified
256226f14535SPavan Nikhilesh  * by *port_id*.
256326f14535SPavan Nikhilesh  *
256426f14535SPavan Nikhilesh  * Provides the same functionality as rte_event_enqueue_burst(), expect that
256526f14535SPavan Nikhilesh  * application can use this API when the all objects in the burst contains
256626f14535SPavan Nikhilesh  * the enqueue operation of the type *RTE_EVENT_OP_NEW*. This specialized
256726f14535SPavan Nikhilesh  * function can provide the additional hint to the PMD and optimize if possible.
256826f14535SPavan Nikhilesh  *
256926f14535SPavan Nikhilesh  * The rte_event_enqueue_new_burst() result is undefined if the enqueue burst
257026f14535SPavan Nikhilesh  * has event object of operation type != RTE_EVENT_OP_NEW.
257126f14535SPavan Nikhilesh  *
257226f14535SPavan Nikhilesh  * @param dev_id
257326f14535SPavan Nikhilesh  *   The identifier of the device.
257426f14535SPavan Nikhilesh  * @param port_id
257526f14535SPavan Nikhilesh  *   The identifier of the event port.
257626f14535SPavan Nikhilesh  * @param ev
257726f14535SPavan Nikhilesh  *   Points to an array of *nb_events* objects of type *rte_event* structure
257826f14535SPavan Nikhilesh  *   which contain the event object enqueue operations to be processed.
257926f14535SPavan Nikhilesh  * @param nb_events
258026f14535SPavan Nikhilesh  *   The number of event objects to enqueue, typically number of
258126f14535SPavan Nikhilesh  *   rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
258226f14535SPavan Nikhilesh  *   available for this port.
258326f14535SPavan Nikhilesh  *
258426f14535SPavan Nikhilesh  * @return
258526f14535SPavan Nikhilesh  *   The number of event objects actually enqueued on the event device. The
258626f14535SPavan Nikhilesh  *   return value can be less than the value of the *nb_events* parameter when
258726f14535SPavan Nikhilesh  *   the event devices queue is full or if invalid parameters are specified in a
258826f14535SPavan Nikhilesh  *   *rte_event*. If the return value is less than *nb_events*, the remaining
258926f14535SPavan Nikhilesh  *   events at the end of ev[] are not consumed and the caller has to take care
259026f14535SPavan Nikhilesh  *   of them, and rte_errno is set accordingly. Possible errno values include:
259126f14535SPavan Nikhilesh  *   - EINVAL   The port ID is invalid, device ID is invalid, an event's queue
259226f14535SPavan Nikhilesh  *              ID is invalid, or an event's sched type doesn't match the
259326f14535SPavan Nikhilesh  *              capabilities of the destination queue.
259426f14535SPavan Nikhilesh  *   - ENOSPC   The event port was backpressured and unable to enqueue
259526f14535SPavan Nikhilesh  *              one or more events. This error code is only applicable to
259626f14535SPavan Nikhilesh  *              closed systems.
259726f14535SPavan Nikhilesh  * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH
259826f14535SPavan Nikhilesh  * @see rte_event_enqueue_burst()
259926f14535SPavan Nikhilesh  */
260026f14535SPavan Nikhilesh static inline uint16_t
260126f14535SPavan Nikhilesh rte_event_enqueue_new_burst(uint8_t dev_id, uint8_t port_id,
260226f14535SPavan Nikhilesh 			    const struct rte_event ev[], uint16_t nb_events)
260326f14535SPavan Nikhilesh {
2604052e25d9SPavan Nikhilesh 	const struct rte_event_fp_ops *fp_ops;
260526f14535SPavan Nikhilesh 
2606052e25d9SPavan Nikhilesh 	fp_ops = &rte_event_fp_ops[dev_id];
260726f14535SPavan Nikhilesh 	return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
2608052e25d9SPavan Nikhilesh 					 fp_ops->enqueue_new_burst);
260926f14535SPavan Nikhilesh }
261026f14535SPavan Nikhilesh 
261126f14535SPavan Nikhilesh /**
261226f14535SPavan Nikhilesh  * Enqueue a burst of events objects of operation type *RTE_EVENT_OP_FORWARD*
261326f14535SPavan Nikhilesh  * on an event device designated by its *dev_id* through the event port
261426f14535SPavan Nikhilesh  * specified by *port_id*.
261526f14535SPavan Nikhilesh  *
261626f14535SPavan Nikhilesh  * Provides the same functionality as rte_event_enqueue_burst(), expect that
261726f14535SPavan Nikhilesh  * application can use this API when the all objects in the burst contains
261826f14535SPavan Nikhilesh  * the enqueue operation of the type *RTE_EVENT_OP_FORWARD*. This specialized
261926f14535SPavan Nikhilesh  * function can provide the additional hint to the PMD and optimize if possible.
262026f14535SPavan Nikhilesh  *
262126f14535SPavan Nikhilesh  * The rte_event_enqueue_new_burst() result is undefined if the enqueue burst
262226f14535SPavan Nikhilesh  * has event object of operation type != RTE_EVENT_OP_FORWARD.
262326f14535SPavan Nikhilesh  *
262426f14535SPavan Nikhilesh  * @param dev_id
262526f14535SPavan Nikhilesh  *   The identifier of the device.
262626f14535SPavan Nikhilesh  * @param port_id
262726f14535SPavan Nikhilesh  *   The identifier of the event port.
262826f14535SPavan Nikhilesh  * @param ev
262926f14535SPavan Nikhilesh  *   Points to an array of *nb_events* objects of type *rte_event* structure
263026f14535SPavan Nikhilesh  *   which contain the event object enqueue operations to be processed.
263126f14535SPavan Nikhilesh  * @param nb_events
263226f14535SPavan Nikhilesh  *   The number of event objects to enqueue, typically number of
263326f14535SPavan Nikhilesh  *   rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
263426f14535SPavan Nikhilesh  *   available for this port.
263526f14535SPavan Nikhilesh  *
263626f14535SPavan Nikhilesh  * @return
263726f14535SPavan Nikhilesh  *   The number of event objects actually enqueued on the event device. The
263826f14535SPavan Nikhilesh  *   return value can be less than the value of the *nb_events* parameter when
263926f14535SPavan Nikhilesh  *   the event devices queue is full or if invalid parameters are specified in a
264026f14535SPavan Nikhilesh  *   *rte_event*. If the return value is less than *nb_events*, the remaining
264126f14535SPavan Nikhilesh  *   events at the end of ev[] are not consumed and the caller has to take care
264226f14535SPavan Nikhilesh  *   of them, and rte_errno is set accordingly. Possible errno values include:
264326f14535SPavan Nikhilesh  *   - EINVAL   The port ID is invalid, device ID is invalid, an event's queue
264426f14535SPavan Nikhilesh  *              ID is invalid, or an event's sched type doesn't match the
264526f14535SPavan Nikhilesh  *              capabilities of the destination queue.
264626f14535SPavan Nikhilesh  *   - ENOSPC   The event port was backpressured and unable to enqueue
264726f14535SPavan Nikhilesh  *              one or more events. This error code is only applicable to
264826f14535SPavan Nikhilesh  *              closed systems.
264926f14535SPavan Nikhilesh  * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH
265026f14535SPavan Nikhilesh  * @see rte_event_enqueue_burst()
265126f14535SPavan Nikhilesh  */
265226f14535SPavan Nikhilesh static inline uint16_t
265326f14535SPavan Nikhilesh rte_event_enqueue_forward_burst(uint8_t dev_id, uint8_t port_id,
265426f14535SPavan Nikhilesh 				const struct rte_event ev[], uint16_t nb_events)
265526f14535SPavan Nikhilesh {
2656052e25d9SPavan Nikhilesh 	const struct rte_event_fp_ops *fp_ops;
265726f14535SPavan Nikhilesh 
2658052e25d9SPavan Nikhilesh 	fp_ops = &rte_event_fp_ops[dev_id];
265926f14535SPavan Nikhilesh 	return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
2660052e25d9SPavan Nikhilesh 					 fp_ops->enqueue_forward_burst);
266126f14535SPavan Nikhilesh }
266226f14535SPavan Nikhilesh 
266326f14535SPavan Nikhilesh /**
266426f14535SPavan Nikhilesh  * Dequeue a burst of events objects or an event object from the event port
266526f14535SPavan Nikhilesh  * designated by its *event_port_id*, on an event device designated
266626f14535SPavan Nikhilesh  * by its *dev_id*.
266726f14535SPavan Nikhilesh  *
266826f14535SPavan Nikhilesh  * rte_event_dequeue_burst() does not dictate the specifics of scheduling
266926f14535SPavan Nikhilesh  * algorithm as each eventdev driver may have different criteria to schedule
267026f14535SPavan Nikhilesh  * an event. However, in general, from an application perspective scheduler may
267126f14535SPavan Nikhilesh  * use the following scheme to dispatch an event to the port.
267226f14535SPavan Nikhilesh  *
267326f14535SPavan Nikhilesh  * 1) Selection of event queue based on
267426f14535SPavan Nikhilesh  *   a) The list of event queues are linked to the event port.
267526f14535SPavan Nikhilesh  *   b) If the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability then event
267626f14535SPavan Nikhilesh  *   queue selection from list is based on event queue priority relative to
267726f14535SPavan Nikhilesh  *   other event queue supplied as *priority* in rte_event_queue_setup()
267826f14535SPavan Nikhilesh  *   c) If the device has RTE_EVENT_DEV_CAP_EVENT_QOS capability then event
267926f14535SPavan Nikhilesh  *   queue selection from the list is based on event priority supplied as
268026f14535SPavan Nikhilesh  *   *priority* in rte_event_enqueue_burst()
268126f14535SPavan Nikhilesh  * 2) Selection of event
268226f14535SPavan Nikhilesh  *   a) The number of flows available in selected event queue.
268326f14535SPavan Nikhilesh  *   b) Schedule type method associated with the event
268426f14535SPavan Nikhilesh  *
268526f14535SPavan Nikhilesh  * The *nb_events* parameter is the maximum number of event objects to dequeue
268626f14535SPavan Nikhilesh  * which are returned in the *ev* array of *rte_event* structure.
268726f14535SPavan Nikhilesh  *
268826f14535SPavan Nikhilesh  * The rte_event_dequeue_burst() function returns the number of events objects
268926f14535SPavan Nikhilesh  * it actually dequeued. A return value equal to *nb_events* means that all
269026f14535SPavan Nikhilesh  * event objects have been dequeued.
269126f14535SPavan Nikhilesh  *
269226f14535SPavan Nikhilesh  * The number of events dequeued is the number of scheduler contexts held by
269326f14535SPavan Nikhilesh  * this port. These contexts are automatically released in the next
269426f14535SPavan Nikhilesh  * rte_event_dequeue_burst() invocation if the port supports implicit
269526f14535SPavan Nikhilesh  * releases, or invoking rte_event_enqueue_burst() with RTE_EVENT_OP_RELEASE
269626f14535SPavan Nikhilesh  * operation can be used to release the contexts early.
269726f14535SPavan Nikhilesh  *
269826f14535SPavan Nikhilesh  * Event operations RTE_EVENT_OP_FORWARD and RTE_EVENT_OP_RELEASE must only be
269926f14535SPavan Nikhilesh  * enqueued to the same port that their associated events were dequeued from.
270026f14535SPavan Nikhilesh  *
270126f14535SPavan Nikhilesh  * @param dev_id
270226f14535SPavan Nikhilesh  *   The identifier of the device.
270326f14535SPavan Nikhilesh  * @param port_id
270426f14535SPavan Nikhilesh  *   The identifier of the event port.
270526f14535SPavan Nikhilesh  * @param[out] ev
270626f14535SPavan Nikhilesh  *   Points to an array of *nb_events* objects of type *rte_event* structure
270726f14535SPavan Nikhilesh  *   for output to be populated with the dequeued event objects.
270826f14535SPavan Nikhilesh  * @param nb_events
270926f14535SPavan Nikhilesh  *   The maximum number of event objects to dequeue, typically number of
271026f14535SPavan Nikhilesh  *   rte_event_port_dequeue_depth() available for this port.
271126f14535SPavan Nikhilesh  *
271226f14535SPavan Nikhilesh  * @param timeout_ticks
271326f14535SPavan Nikhilesh  *   - 0 no-wait, returns immediately if there is no event.
271426f14535SPavan Nikhilesh  *   - >0 wait for the event, if the device is configured with
271526f14535SPavan Nikhilesh  *   RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT then this function will wait until
271626f14535SPavan Nikhilesh  *   at least one event is available or *timeout_ticks* time.
271726f14535SPavan Nikhilesh  *   if the device is not configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT
271826f14535SPavan Nikhilesh  *   then this function will wait until the event available or
271926f14535SPavan Nikhilesh  *   *dequeue_timeout_ns* ns which was previously supplied to
272026f14535SPavan Nikhilesh  *   rte_event_dev_configure()
272126f14535SPavan Nikhilesh  *
272226f14535SPavan Nikhilesh  * @return
272326f14535SPavan Nikhilesh  * The number of event objects actually dequeued from the port. The return
272426f14535SPavan Nikhilesh  * value can be less than the value of the *nb_events* parameter when the
272526f14535SPavan Nikhilesh  * event port's queue is not full.
272626f14535SPavan Nikhilesh  *
272726f14535SPavan Nikhilesh  * @see rte_event_port_dequeue_depth()
272826f14535SPavan Nikhilesh  */
272926f14535SPavan Nikhilesh static inline uint16_t
273026f14535SPavan Nikhilesh rte_event_dequeue_burst(uint8_t dev_id, uint8_t port_id, struct rte_event ev[],
273126f14535SPavan Nikhilesh 			uint16_t nb_events, uint64_t timeout_ticks)
273226f14535SPavan Nikhilesh {
2733052e25d9SPavan Nikhilesh 	const struct rte_event_fp_ops *fp_ops;
2734052e25d9SPavan Nikhilesh 	void *port;
273526f14535SPavan Nikhilesh 
2736052e25d9SPavan Nikhilesh 	fp_ops = &rte_event_fp_ops[dev_id];
2737052e25d9SPavan Nikhilesh 	port = fp_ops->data[port_id];
273826f14535SPavan Nikhilesh #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
2739052e25d9SPavan Nikhilesh 	if (dev_id >= RTE_EVENT_MAX_DEVS ||
2740052e25d9SPavan Nikhilesh 	    port_id >= RTE_EVENT_MAX_PORTS_PER_DEV) {
274126f14535SPavan Nikhilesh 		rte_errno = EINVAL;
274226f14535SPavan Nikhilesh 		return 0;
274326f14535SPavan Nikhilesh 	}
274426f14535SPavan Nikhilesh 
2745052e25d9SPavan Nikhilesh 	if (port == NULL) {
274626f14535SPavan Nikhilesh 		rte_errno = EINVAL;
274726f14535SPavan Nikhilesh 		return 0;
274826f14535SPavan Nikhilesh 	}
274926f14535SPavan Nikhilesh #endif
275026f14535SPavan Nikhilesh 	rte_eventdev_trace_deq_burst(dev_id, port_id, ev, nb_events);
275126f14535SPavan Nikhilesh 	/*
275226f14535SPavan Nikhilesh 	 * Allow zero cost non burst mode routine invocation if application
275326f14535SPavan Nikhilesh 	 * requests nb_events as const one
275426f14535SPavan Nikhilesh 	 */
275526f14535SPavan Nikhilesh 	if (nb_events == 1)
2756052e25d9SPavan Nikhilesh 		return (fp_ops->dequeue)(port, ev, timeout_ticks);
275726f14535SPavan Nikhilesh 	else
2758052e25d9SPavan Nikhilesh 		return (fp_ops->dequeue_burst)(port, ev, nb_events,
2759052e25d9SPavan Nikhilesh 					       timeout_ticks);
276026f14535SPavan Nikhilesh }
276126f14535SPavan Nikhilesh 
276254f17843SMattias Rönnblom #define RTE_EVENT_DEV_MAINT_OP_FLUSH          (1 << 0)
276354f17843SMattias Rönnblom /**< Force an immediately flush of any buffered events in the port,
276454f17843SMattias Rönnblom  * potentially at the cost of additional overhead.
276554f17843SMattias Rönnblom  *
276654f17843SMattias Rönnblom  * @see rte_event_maintain()
276754f17843SMattias Rönnblom  */
276854f17843SMattias Rönnblom 
276954f17843SMattias Rönnblom /**
277054f17843SMattias Rönnblom  * Maintain an event device.
277154f17843SMattias Rönnblom  *
2772bd991897SMattias Rönnblom  * This function is only relevant for event devices which do not have
2773bd991897SMattias Rönnblom  * the @ref RTE_EVENT_DEV_CAP_MAINTENANCE_FREE flag set. Such devices
277454f17843SMattias Rönnblom  * require an application thread using a particular port to
277554f17843SMattias Rönnblom  * periodically call rte_event_maintain() on that port during periods
277654f17843SMattias Rönnblom  * which it is neither attempting to enqueue events to nor dequeue
277754f17843SMattias Rönnblom  * events from the port. rte_event_maintain() is a low-overhead
277854f17843SMattias Rönnblom  * function and should be called at a high rate (e.g., in the
277954f17843SMattias Rönnblom  * application's poll loop).
278054f17843SMattias Rönnblom  *
278154f17843SMattias Rönnblom  * No port may be left unmaintained.
278254f17843SMattias Rönnblom  *
278354f17843SMattias Rönnblom  * At the application thread's convenience, rte_event_maintain() may
278454f17843SMattias Rönnblom  * (but is not required to) be called even during periods when enqueue
278554f17843SMattias Rönnblom  * or dequeue functions are being called, at the cost of a slight
278654f17843SMattias Rönnblom  * increase in overhead.
278754f17843SMattias Rönnblom  *
2788bd991897SMattias Rönnblom  * rte_event_maintain() may be called on event devices which have set
2789bd991897SMattias Rönnblom  * @ref RTE_EVENT_DEV_CAP_MAINTENANCE_FREE, in which case it is a
2790bd991897SMattias Rönnblom  * no-operation.
279154f17843SMattias Rönnblom  *
279254f17843SMattias Rönnblom  * @param dev_id
279354f17843SMattias Rönnblom  *   The identifier of the device.
279454f17843SMattias Rönnblom  * @param port_id
279554f17843SMattias Rönnblom  *   The identifier of the event port.
279654f17843SMattias Rönnblom  * @param op
279754f17843SMattias Rönnblom  *   0, or @ref RTE_EVENT_DEV_MAINT_OP_FLUSH.
279854f17843SMattias Rönnblom  * @return
279954f17843SMattias Rönnblom  *  - 0 on success.
280054f17843SMattias Rönnblom  *  - -EINVAL if *dev_id*,  *port_id*, or *op* is invalid.
280154f17843SMattias Rönnblom  *
2802bd991897SMattias Rönnblom  * @see RTE_EVENT_DEV_CAP_MAINTENANCE_FREE
280354f17843SMattias Rönnblom  */
280454f17843SMattias Rönnblom static inline int
280554f17843SMattias Rönnblom rte_event_maintain(uint8_t dev_id, uint8_t port_id, int op)
280654f17843SMattias Rönnblom {
280754f17843SMattias Rönnblom 	const struct rte_event_fp_ops *fp_ops;
280854f17843SMattias Rönnblom 	void *port;
280954f17843SMattias Rönnblom 
281054f17843SMattias Rönnblom 	fp_ops = &rte_event_fp_ops[dev_id];
281154f17843SMattias Rönnblom 	port = fp_ops->data[port_id];
281254f17843SMattias Rönnblom #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
281354f17843SMattias Rönnblom 	if (dev_id >= RTE_EVENT_MAX_DEVS ||
281454f17843SMattias Rönnblom 	    port_id >= RTE_EVENT_MAX_PORTS_PER_DEV)
281554f17843SMattias Rönnblom 		return -EINVAL;
281654f17843SMattias Rönnblom 
281754f17843SMattias Rönnblom 	if (port == NULL)
281854f17843SMattias Rönnblom 		return -EINVAL;
281954f17843SMattias Rönnblom 
282054f17843SMattias Rönnblom 	if (op & (~RTE_EVENT_DEV_MAINT_OP_FLUSH))
282154f17843SMattias Rönnblom 		return -EINVAL;
282254f17843SMattias Rönnblom #endif
282354f17843SMattias Rönnblom 	rte_eventdev_trace_maintain(dev_id, port_id, op);
282454f17843SMattias Rönnblom 
282554f17843SMattias Rönnblom 	if (fp_ops->maintain != NULL)
282654f17843SMattias Rönnblom 		fp_ops->maintain(port, op);
282754f17843SMattias Rönnblom 
282854f17843SMattias Rönnblom 	return 0;
282954f17843SMattias Rönnblom }
283054f17843SMattias Rönnblom 
2831d007a7f3SPavan Nikhilesh /**
2832d007a7f3SPavan Nikhilesh  * Change the active profile on an event port.
2833d007a7f3SPavan Nikhilesh  *
2834d007a7f3SPavan Nikhilesh  * This function is used to change the current active profile on an event port
2835d007a7f3SPavan Nikhilesh  * when multiple link profiles are configured on an event port through the
2836d007a7f3SPavan Nikhilesh  * function call ``rte_event_port_profile_links_set``.
2837d007a7f3SPavan Nikhilesh  *
2838d007a7f3SPavan Nikhilesh  * On the subsequent ``rte_event_dequeue_burst`` call, only the event queues
2839d007a7f3SPavan Nikhilesh  * that were associated with the newly active profile will participate in
2840d007a7f3SPavan Nikhilesh  * scheduling.
2841d007a7f3SPavan Nikhilesh  *
2842d007a7f3SPavan Nikhilesh  * @param dev_id
2843d007a7f3SPavan Nikhilesh  *   The identifier of the device.
2844d007a7f3SPavan Nikhilesh  * @param port_id
2845d007a7f3SPavan Nikhilesh  *   The identifier of the event port.
2846d007a7f3SPavan Nikhilesh  * @param profile_id
2847d007a7f3SPavan Nikhilesh  *   The identifier of the profile.
2848d007a7f3SPavan Nikhilesh  * @return
2849d007a7f3SPavan Nikhilesh  *  - 0 on success.
2850d007a7f3SPavan Nikhilesh  *  - -EINVAL if *dev_id*,  *port_id*, or *profile_id* is invalid.
2851d007a7f3SPavan Nikhilesh  */
2852d007a7f3SPavan Nikhilesh static inline uint8_t
2853d007a7f3SPavan Nikhilesh rte_event_port_profile_switch(uint8_t dev_id, uint8_t port_id, uint8_t profile_id)
2854d007a7f3SPavan Nikhilesh {
2855d007a7f3SPavan Nikhilesh 	const struct rte_event_fp_ops *fp_ops;
2856d007a7f3SPavan Nikhilesh 	void *port;
2857d007a7f3SPavan Nikhilesh 
2858d007a7f3SPavan Nikhilesh 	fp_ops = &rte_event_fp_ops[dev_id];
2859d007a7f3SPavan Nikhilesh 	port = fp_ops->data[port_id];
2860d007a7f3SPavan Nikhilesh 
2861d007a7f3SPavan Nikhilesh #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
2862d007a7f3SPavan Nikhilesh 	if (dev_id >= RTE_EVENT_MAX_DEVS ||
2863d007a7f3SPavan Nikhilesh 	    port_id >= RTE_EVENT_MAX_PORTS_PER_DEV)
2864d007a7f3SPavan Nikhilesh 		return -EINVAL;
2865d007a7f3SPavan Nikhilesh 
2866d007a7f3SPavan Nikhilesh 	if (port == NULL)
2867d007a7f3SPavan Nikhilesh 		return -EINVAL;
2868d007a7f3SPavan Nikhilesh 
2869d007a7f3SPavan Nikhilesh 	if (profile_id >= RTE_EVENT_MAX_PROFILES_PER_PORT)
2870d007a7f3SPavan Nikhilesh 		return -EINVAL;
2871d007a7f3SPavan Nikhilesh #endif
2872d007a7f3SPavan Nikhilesh 	rte_eventdev_trace_port_profile_switch(dev_id, port_id, profile_id);
2873d007a7f3SPavan Nikhilesh 
2874d007a7f3SPavan Nikhilesh 	return fp_ops->profile_switch(port, profile_id);
2875d007a7f3SPavan Nikhilesh }
2876d007a7f3SPavan Nikhilesh 
287799a2dd95SBruce Richardson #ifdef __cplusplus
287899a2dd95SBruce Richardson }
287999a2dd95SBruce Richardson #endif
288099a2dd95SBruce Richardson 
288199a2dd95SBruce Richardson #endif /* _RTE_EVENTDEV_H_ */
2882