1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016 Cavium, Inc.
3 * Copyright(c) 2016-2018 Intel Corporation.
8 #ifndef _RTE_EVENTDEV_H_
9 #define _RTE_EVENTDEV_H_
14 * RTE Event Device API
16 * In a polling model, lcores poll ethdev ports and associated rx queues
17 * directly to look for packet. In an event driven model, by contrast, lcores
18 * call the scheduler that selects packets for them based on programmer
19 * specified criteria. Eventdev library adds support for event driven
20 * programming model, which offer applications automatic multicore scaling,
21 * dynamic load balancing, pipelining, packet ingress order maintenance and
22 * synchronization services to simplify application packet processing.
24 * The Event Device API is composed of two parts:
26 * - The application-oriented Event API that includes functions to setup
27 * an event device (configure it, setup its queues, ports and start it), to
28 * establish the link between queues to port and to receive events, and so on.
30 * - The driver-oriented Event API that exports a function allowing
31 * an event poll Mode Driver (PMD) to simultaneously register itself as
32 * an event device driver.
34 * Event device components:
38 * +-------+ | | flow 0 | |
39 * |Packet | | +-------------+ |
40 * |event | | +-------------+ |
41 * | | | | flow 1 | |port_link(port0, queue0)
42 * +-------+ | +-------------+ | | +--------+
43 * +-------+ | +-------------+ o-----v-----o |dequeue +------+
44 * |Crypto | | | flow n | | | event +------->|Core 0|
45 * |work | | +-------------+ o----+ | port 0 | | |
46 * |done ev| | event queue 0 | | +--------+ +------+
47 * +-------+ +-----------------+ |
49 * |Timer | +-----------------+ | +--------+
50 * |expiry | | +-------------+ | +------o |dequeue +------+
51 * |event | | | flow 0 | o-----------o event +------->|Core 1|
52 * +-------+ | +-------------+ | +----o port 1 | | |
53 * Event enqueue | +-------------+ | | +--------+ +------+
54 * o-------------> | | flow 1 | | |
55 * enqueue( | +-------------+ | |
56 * queue_id, | | | +--------+ +------+
57 * flow_id, | +-------------+ | | | |dequeue |Core 2|
58 * sched_type, | | flow n | o-----------o event +------->| |
59 * event_type, | +-------------+ | | | port 2 | +------+
60 * subev_type, | event queue 1 | | +--------+
61 * event) +-----------------+ | +--------+
62 * | | |dequeue +------+
63 * +-------+ +-----------------+ | | event +------->|Core n|
64 * |Core | | +-------------+ o-----------o port n | | |
65 * |(SW) | | | flow 0 | | | +--------+ +--+---+
66 * |event | | +-------------+ | | |
67 * +-------+ | +-------------+ | | |
68 * ^ | | flow 1 | | | |
69 * | | +-------------+ o------+ |
70 * | | +-------------+ | |
72 * | | +-------------+ | |
73 * | | event queue n | |
74 * | +-----------------+ |
76 * +-----------------------------------------------------------+
78 * Event device: A hardware or software-based event scheduler.
80 * Event: A unit of scheduling that encapsulates a packet or other datatype
81 * like SW generated event from the CPU, Crypto work completion notification,
82 * Timer expiry event notification etc as well as metadata.
83 * The metadata includes flow ID, scheduling type, event priority, event_type,
86 * Event queue: A queue containing events that are scheduled by the event dev.
87 * An event queue contains events of different flows associated with scheduling
88 * types, such as atomic, ordered, or parallel.
90 * Event port: An application's interface into the event dev for enqueue and
91 * dequeue operations. Each event port can be linked with one or more
92 * event queues for dequeue operations.
94 * By default, all the functions of the Event Device API exported by a PMD
95 * are lock-free functions which assume to not be invoked in parallel on
96 * different logical cores to work on the same target object. For instance,
97 * the dequeue function of a PMD cannot be invoked in parallel on two logical
98 * cores to operates on same event port. Of course, this function
99 * can be invoked in parallel by different logical cores on different ports.
100 * It is the responsibility of the upper level application to enforce this rule.
102 * In all functions of the Event API, the Event device is
103 * designated by an integer >= 0 named the device identifier *dev_id*
105 * At the Event driver level, Event devices are represented by a generic
106 * data structure of type *rte_event_dev*.
108 * Event devices are dynamically registered during the PCI/SoC device probing
109 * phase performed at EAL initialization time.
110 * When an Event device is being probed, a *rte_event_dev* structure and
111 * a new device identifier are allocated for that device. Then, the
112 * event_dev_init() function supplied by the Event driver matching the probed
113 * device is invoked to properly initialize the device.
115 * The role of the device init function consists of resetting the hardware or
116 * software event driver implementations.
118 * If the device init operation is successful, the correspondence between
119 * the device identifier assigned to the new device and its associated
120 * *rte_event_dev* structure is effectively registered.
121 * Otherwise, both the *rte_event_dev* structure and the device identifier are
124 * The functions exported by the application Event API to setup a device
125 * designated by its device identifier must be invoked in the following order:
126 * - rte_event_dev_configure()
127 * - rte_event_queue_setup()
128 * - rte_event_port_setup()
129 * - rte_event_port_link()
130 * - rte_event_dev_start()
132 * Then, the application can invoke, in any order, the functions
133 * exported by the Event API to schedule events, dequeue events, enqueue events,
134 * change event queue(s) to event port [un]link establishment and so on.
136 * Application may use rte_event_[queue/port]_default_conf_get() to get the
137 * default configuration to set up an event queue or event port by
138 * overriding few default values.
140 * If the application wants to change the configuration (i.e. call
141 * rte_event_dev_configure(), rte_event_queue_setup(), or
142 * rte_event_port_setup()), it must call rte_event_dev_stop() first to stop the
143 * device and then do the reconfiguration before calling rte_event_dev_start()
144 * again. The schedule, enqueue and dequeue functions should not be invoked
145 * when the device is stopped.
147 * Finally, an application can close an Event device by invoking the
148 * rte_event_dev_close() function.
150 * Each function of the application Event API invokes a specific function
151 * of the PMD that controls the target device designated by its device
154 * For this purpose, all device-specific functions of an Event driver are
155 * supplied through a set of pointers contained in a generic structure of type
157 * The address of the *event_dev_ops* structure is stored in the *rte_event_dev*
158 * structure by the device init function of the Event driver, which is
159 * invoked during the PCI/SoC device probing phase, as explained earlier.
161 * In other words, each function of the Event API simply retrieves the
162 * *rte_event_dev* structure associated with the device identifier and
163 * performs an indirect invocation of the corresponding driver function
164 * supplied in the *event_dev_ops* structure of the *rte_event_dev* structure.
166 * For performance reasons, the address of the fast-path functions of the
167 * Event driver is not contained in the *event_dev_ops* structure.
168 * Instead, they are directly stored at the beginning of the *rte_event_dev*
169 * structure to avoid an extra indirect memory access during their invocation.
171 * RTE event device drivers do not use interrupts for enqueue or dequeue
172 * operation. Instead, Event drivers export Poll-Mode enqueue and dequeue
173 * functions to applications.
175 * The events are injected to event device through *enqueue* operation by
176 * event producers in the system. The typical event producers are ethdev
177 * subsystem for generating packet events, CPU(SW) for generating events based
178 * on different stages of application processing, cryptodev for generating
179 * crypto work completion notification etc
181 * The *dequeue* operation gets one or more events from the event ports.
182 * The application process the events and send to downstream event queue through
183 * rte_event_enqueue_burst() if it is an intermediate stage of event processing,
184 * on the final stage, the application may use Tx adapter API for maintaining
185 * the ingress order and then send the packet/event on the wire.
187 * The point at which events are scheduled to ports depends on the device.
188 * For hardware devices, scheduling occurs asynchronously without any software
189 * intervention. Software schedulers can either be distributed
190 * (each worker thread schedules events to its own port) or centralized
191 * (a dedicated thread schedules to all ports). Distributed software schedulers
192 * perform the scheduling in rte_event_dequeue_burst(), whereas centralized
193 * scheduler logic need a dedicated service core for scheduling.
194 * The RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED capability flag is not set
195 * indicates the device is centralized and thus needs a dedicated scheduling
196 * thread that repeatedly calls software specific scheduling function.
198 * An event driven worker thread has following typical workflow on fastpath:
201 * rte_event_dequeue_burst(...);
203 * rte_event_enqueue_burst(...);
213 #include <rte_common.h>
214 #include <rte_config.h>
215 #include <rte_errno.h>
216 #include <rte_mbuf_pool_ops.h>
217 #include <rte_memory.h>
218 #include <rte_mempool.h>
220 #include "rte_eventdev_trace_fp.h"
222 struct rte_mbuf; /* we just use mbuf pointers; no need to include rte_mbuf.h */
225 /* Event device capability bitmap flags */
226 #define RTE_EVENT_DEV_CAP_QUEUE_QOS (1ULL << 0)
227 /**< Event scheduling prioritization is based on the priority associated with
230 * @see rte_event_queue_setup()
232 #define RTE_EVENT_DEV_CAP_EVENT_QOS (1ULL << 1)
233 /**< Event scheduling prioritization is based on the priority associated with
234 * each event. Priority of each event is supplied in *rte_event* structure
235 * on each enqueue operation.
237 * @see rte_event_enqueue_burst()
239 #define RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED (1ULL << 2)
240 /**< Event device operates in distributed scheduling mode.
241 * In distributed scheduling mode, event scheduling happens in HW or
242 * rte_event_dequeue_burst() or the combination of these two.
243 * If the flag is not set then eventdev is centralized and thus needs a
244 * dedicated service core that acts as a scheduling thread .
246 * @see rte_event_dequeue_burst()
248 #define RTE_EVENT_DEV_CAP_QUEUE_ALL_TYPES (1ULL << 3)
249 /**< Event device is capable of enqueuing events of any type to any queue.
250 * If this capability is not set, the queue only supports events of the
251 * *RTE_SCHED_TYPE_* type that it was created with.
253 * @see RTE_SCHED_TYPE_* values
255 #define RTE_EVENT_DEV_CAP_BURST_MODE (1ULL << 4)
256 /**< Event device is capable of operating in burst mode for enqueue(forward,
257 * release) and dequeue operation. If this capability is not set, application
258 * still uses the rte_event_dequeue_burst() and rte_event_enqueue_burst() but
259 * PMD accepts only one event at a time.
261 * @see rte_event_dequeue_burst() rte_event_enqueue_burst()
263 #define RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE (1ULL << 5)
264 /**< Event device ports support disabling the implicit release feature, in
265 * which the port will release all unreleased events in its dequeue operation.
266 * If this capability is set and the port is configured with implicit release
267 * disabled, the application is responsible for explicitly releasing events
268 * using either the RTE_EVENT_OP_FORWARD or the RTE_EVENT_OP_RELEASE event
269 * enqueue operations.
271 * @see rte_event_dequeue_burst() rte_event_enqueue_burst()
274 #define RTE_EVENT_DEV_CAP_NONSEQ_MODE (1ULL << 6)
275 /**< Event device is capable of operating in none sequential mode. The path
276 * of the event is not necessary to be sequential. Application can change
277 * the path of event at runtime. If the flag is not set, then event each event
278 * will follow a path from queue 0 to queue 1 to queue 2 etc. If the flag is
279 * set, events may be sent to queues in any order. If the flag is not set, the
280 * eventdev will return an error when the application enqueues an event for a
281 * qid which is not the next in the sequence.
284 #define RTE_EVENT_DEV_CAP_RUNTIME_PORT_LINK (1ULL << 7)
285 /**< Event device is capable of configuring the queue/port link at runtime.
286 * If the flag is not set, the eventdev queue/port link is only can be
287 * configured during initialization.
290 #define RTE_EVENT_DEV_CAP_MULTIPLE_QUEUE_PORT (1ULL << 8)
291 /**< Event device is capable of setting up the link between multiple queue
292 * with single port. If the flag is not set, the eventdev can only map a
293 * single queue to each port or map a single queue to many port.
296 #define RTE_EVENT_DEV_CAP_CARRY_FLOW_ID (1ULL << 9)
297 /**< Event device preserves the flow ID from the enqueued
298 * event to the dequeued event if the flag is set. Otherwise,
299 * the content of this field is implementation dependent.
302 #define RTE_EVENT_DEV_CAP_MAINTENANCE_FREE (1ULL << 10)
303 /**< Event device *does not* require calls to rte_event_maintain().
304 * An event device that does not set this flag requires calls to
305 * rte_event_maintain() during periods when neither
306 * rte_event_dequeue_burst() nor rte_event_enqueue_burst() are called
307 * on a port. This will allow the event device to perform internal
308 * processing, such as flushing buffered events, return credits to a
309 * global pool, or process signaling related to load balancing.
312 /* Event device priority levels */
313 #define RTE_EVENT_DEV_PRIORITY_HIGHEST 0
314 /**< Highest priority expressed across eventdev subsystem
315 * @see rte_event_queue_setup(), rte_event_enqueue_burst()
316 * @see rte_event_port_link()
318 #define RTE_EVENT_DEV_PRIORITY_NORMAL 128
319 /**< Normal priority expressed across eventdev subsystem
320 * @see rte_event_queue_setup(), rte_event_enqueue_burst()
321 * @see rte_event_port_link()
323 #define RTE_EVENT_DEV_PRIORITY_LOWEST 255
324 /**< Lowest priority expressed across eventdev subsystem
325 * @see rte_event_queue_setup(), rte_event_enqueue_burst()
326 * @see rte_event_port_link()
330 * Get the total number of event devices that have been successfully
334 * The total number of usable event devices.
337 rte_event_dev_count(void);
340 * Get the device identifier for the named event device.
343 * Event device name to select the event device identifier.
346 * Returns event device identifier on success.
347 * - <0: Failure to find named event device.
350 rte_event_dev_get_dev_id(const char *name);
353 * Return the NUMA socket to which a device is connected.
356 * The identifier of the device.
358 * The NUMA socket id to which the device is connected or
359 * a default of zero if the socket could not be determined.
360 * -(-EINVAL) dev_id value is out of range.
363 rte_event_dev_socket_id(uint8_t dev_id);
366 * Event device information
368 struct rte_event_dev_info {
369 const char *driver_name; /**< Event driver name */
370 struct rte_device *dev; /**< Device information */
371 uint32_t min_dequeue_timeout_ns;
372 /**< Minimum supported global dequeue timeout(ns) by this device */
373 uint32_t max_dequeue_timeout_ns;
374 /**< Maximum supported global dequeue timeout(ns) by this device */
375 uint32_t dequeue_timeout_ns;
376 /**< Configured global dequeue timeout(ns) for this device */
377 uint8_t max_event_queues;
378 /**< Maximum event_queues supported by this device */
379 uint32_t max_event_queue_flows;
380 /**< Maximum supported flows in an event queue by this device*/
381 uint8_t max_event_queue_priority_levels;
382 /**< Maximum number of event queue priority levels by this device.
383 * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability
385 uint8_t max_event_priority_levels;
386 /**< Maximum number of event priority levels by this device.
387 * Valid when the device has RTE_EVENT_DEV_CAP_EVENT_QOS capability
389 uint8_t max_event_ports;
390 /**< Maximum number of event ports supported by this device */
391 uint8_t max_event_port_dequeue_depth;
392 /**< Maximum number of events can be dequeued at a time from an
393 * event port by this device.
394 * A device that does not support bulk dequeue will set this as 1.
396 uint32_t max_event_port_enqueue_depth;
397 /**< Maximum number of events can be enqueued at a time from an
398 * event port by this device.
399 * A device that does not support bulk enqueue will set this as 1.
401 uint8_t max_event_port_links;
402 /**< Maximum number of queues that can be linked to a single event
403 * port by this device.
405 int32_t max_num_events;
406 /**< A *closed system* event dev has a limit on the number of events it
407 * can manage at a time. An *open system* event dev does not have a
408 * limit and will specify this as -1.
410 uint32_t event_dev_cap;
411 /**< Event device capabilities(RTE_EVENT_DEV_CAP_)*/
412 uint8_t max_single_link_event_port_queue_pairs;
413 /**< Maximum number of event ports and queues that are optimized for
414 * (and only capable of) single-link configurations supported by this
415 * device. These ports and queues are not accounted for in
416 * max_event_ports or max_event_queues.
421 * Retrieve the contextual information of an event device.
424 * The identifier of the device.
426 * @param[out] dev_info
427 * A pointer to a structure of type *rte_event_dev_info* to be filled with the
428 * contextual information of the device.
431 * - 0: Success, driver updates the contextual information of the event device
432 * - <0: Error code returned by the driver info get function.
436 rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info);
439 * The count of ports.
441 #define RTE_EVENT_DEV_ATTR_PORT_COUNT 0
443 * The count of queues.
445 #define RTE_EVENT_DEV_ATTR_QUEUE_COUNT 1
447 * The status of the device, zero for stopped, non-zero for started.
449 #define RTE_EVENT_DEV_ATTR_STARTED 2
452 * Get an attribute from a device.
454 * @param dev_id Eventdev id
455 * @param attr_id The attribute ID to retrieve
456 * @param[out] attr_value A pointer that will be filled in with the attribute
457 * value if successful.
460 * - 0: Successfully retrieved attribute value
461 * - -EINVAL: Invalid device or *attr_id* provided, or *attr_value* is NULL
464 rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
465 uint32_t *attr_value);
468 /* Event device configuration bitmap flags */
469 #define RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT (1ULL << 0)
470 /**< Override the global *dequeue_timeout_ns* and use per dequeue timeout in ns.
471 * @see rte_event_dequeue_timeout_ticks(), rte_event_dequeue_burst()
474 /** Event device configuration structure */
475 struct rte_event_dev_config {
476 uint32_t dequeue_timeout_ns;
477 /**< rte_event_dequeue_burst() timeout on this device.
478 * This value should be in the range of *min_dequeue_timeout_ns* and
479 * *max_dequeue_timeout_ns* which previously provided in
480 * rte_event_dev_info_get()
481 * The value 0 is allowed, in which case, default dequeue timeout used.
482 * @see RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT
484 int32_t nb_events_limit;
485 /**< In a *closed system* this field is the limit on maximum number of
486 * events that can be inflight in the eventdev at a given time. The
487 * limit is required to ensure that the finite space in a closed system
488 * is not overwhelmed. The value cannot exceed the *max_num_events*
489 * as provided by rte_event_dev_info_get().
490 * This value should be set to -1 for *open system*.
492 uint8_t nb_event_queues;
493 /**< Number of event queues to configure on this device.
494 * This value cannot exceed the *max_event_queues* which previously
495 * provided in rte_event_dev_info_get()
497 uint8_t nb_event_ports;
498 /**< Number of event ports to configure on this device.
499 * This value cannot exceed the *max_event_ports* which previously
500 * provided in rte_event_dev_info_get()
502 uint32_t nb_event_queue_flows;
503 /**< Number of flows for any event queue on this device.
504 * This value cannot exceed the *max_event_queue_flows* which previously
505 * provided in rte_event_dev_info_get()
507 uint32_t nb_event_port_dequeue_depth;
508 /**< Maximum number of events can be dequeued at a time from an
509 * event port by this device.
510 * This value cannot exceed the *max_event_port_dequeue_depth*
511 * which previously provided in rte_event_dev_info_get().
512 * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
513 * @see rte_event_port_setup()
515 uint32_t nb_event_port_enqueue_depth;
516 /**< Maximum number of events can be enqueued at a time from an
517 * event port by this device.
518 * This value cannot exceed the *max_event_port_enqueue_depth*
519 * which previously provided in rte_event_dev_info_get().
520 * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
521 * @see rte_event_port_setup()
523 uint32_t event_dev_cfg;
524 /**< Event device config flags(RTE_EVENT_DEV_CFG_)*/
525 uint8_t nb_single_link_event_port_queues;
526 /**< Number of event ports and queues that will be singly-linked to
527 * each other. These are a subset of the overall event ports and
528 * queues; this value cannot exceed *nb_event_ports* or
529 * *nb_event_queues*. If the device has ports and queues that are
530 * optimized for single-link usage, this field is a hint for how many
531 * to allocate; otherwise, regular event ports and queues can be used.
536 * Configure an event device.
538 * This function must be invoked first before any other function in the
539 * API. This function can also be re-invoked when a device is in the
542 * The caller may use rte_event_dev_info_get() to get the capability of each
543 * resources available for this event device.
546 * The identifier of the device to configure.
548 * The event device configuration structure.
551 * - 0: Success, device configured.
552 * - <0: Error code returned by the driver configuration function.
555 rte_event_dev_configure(uint8_t dev_id,
556 const struct rte_event_dev_config *dev_conf);
558 /* Event queue specific APIs */
560 /* Event queue configuration bitmap flags */
561 #define RTE_EVENT_QUEUE_CFG_ALL_TYPES (1ULL << 0)
562 /**< Allow ATOMIC,ORDERED,PARALLEL schedule type enqueue
564 * @see RTE_SCHED_TYPE_ORDERED, RTE_SCHED_TYPE_ATOMIC, RTE_SCHED_TYPE_PARALLEL
565 * @see rte_event_enqueue_burst()
567 #define RTE_EVENT_QUEUE_CFG_SINGLE_LINK (1ULL << 1)
568 /**< This event queue links only to a single event port.
570 * @see rte_event_port_setup(), rte_event_port_link()
573 /** Event queue configuration structure */
574 struct rte_event_queue_conf {
575 uint32_t nb_atomic_flows;
576 /**< The maximum number of active flows this queue can track at any
577 * given time. If the queue is configured for atomic scheduling (by
578 * applying the RTE_EVENT_QUEUE_CFG_ALL_TYPES flag to event_queue_cfg
579 * or RTE_SCHED_TYPE_ATOMIC flag to schedule_type), then the
580 * value must be in the range of [1, nb_event_queue_flows], which was
581 * previously provided in rte_event_dev_configure().
583 uint32_t nb_atomic_order_sequences;
584 /**< The maximum number of outstanding events waiting to be
585 * reordered by this queue. In other words, the number of entries in
586 * this queue’s reorder buffer.When the number of events in the
587 * reorder buffer reaches to *nb_atomic_order_sequences* then the
588 * scheduler cannot schedule the events from this queue and invalid
589 * event will be returned from dequeue until one or more entries are
591 * If the queue is configured for ordered scheduling (by applying the
592 * RTE_EVENT_QUEUE_CFG_ALL_TYPES flag to event_queue_cfg or
593 * RTE_SCHED_TYPE_ORDERED flag to schedule_type), then the value must
594 * be in the range of [1, nb_event_queue_flows], which was
595 * previously supplied to rte_event_dev_configure().
597 uint32_t event_queue_cfg;
598 /**< Queue cfg flags(EVENT_QUEUE_CFG_) */
599 uint8_t schedule_type;
600 /**< Queue schedule type(RTE_SCHED_TYPE_*).
601 * Valid when RTE_EVENT_QUEUE_CFG_ALL_TYPES bit is not set in
605 /**< Priority for this event queue relative to other event queues.
606 * The requested priority should in the range of
607 * [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST].
608 * The implementation shall normalize the requested priority to
609 * event device supported priority value.
610 * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability
615 * Retrieve the default configuration information of an event queue designated
616 * by its *queue_id* from the event driver for an event device.
618 * This function intended to be used in conjunction with rte_event_queue_setup()
619 * where caller needs to set up the queue by overriding few default values.
622 * The identifier of the device.
624 * The index of the event queue to get the configuration information.
625 * The value must be in the range [0, nb_event_queues - 1]
626 * previously supplied to rte_event_dev_configure().
627 * @param[out] queue_conf
628 * The pointer to the default event queue configuration data.
630 * - 0: Success, driver updates the default event queue configuration data.
631 * - <0: Error code returned by the driver info get function.
633 * @see rte_event_queue_setup()
637 rte_event_queue_default_conf_get(uint8_t dev_id, uint8_t queue_id,
638 struct rte_event_queue_conf *queue_conf);
641 * Allocate and set up an event queue for an event device.
644 * The identifier of the device.
646 * The index of the event queue to setup. The value must be in the range
647 * [0, nb_event_queues - 1] previously supplied to rte_event_dev_configure().
649 * The pointer to the configuration data to be used for the event queue.
650 * NULL value is allowed, in which case default configuration used.
652 * @see rte_event_queue_default_conf_get()
655 * - 0: Success, event queue correctly set up.
656 * - <0: event queue configuration failed
659 rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
660 const struct rte_event_queue_conf *queue_conf);
663 * The priority of the queue.
665 #define RTE_EVENT_QUEUE_ATTR_PRIORITY 0
667 * The number of atomic flows configured for the queue.
669 #define RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_FLOWS 1
671 * The number of atomic order sequences configured for the queue.
673 #define RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_ORDER_SEQUENCES 2
675 * The cfg flags for the queue.
677 #define RTE_EVENT_QUEUE_ATTR_EVENT_QUEUE_CFG 3
679 * The schedule type of the queue.
681 #define RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE 4
684 * Get an attribute from a queue.
691 * The attribute ID to retrieve
692 * @param[out] attr_value
693 * A pointer that will be filled in with the attribute value if successful
696 * - 0: Successfully returned value
697 * - -EINVAL: invalid device, queue or attr_id provided, or attr_value was
699 * - -EOVERFLOW: returned when attr_id is set to
700 * RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE and event_queue_cfg is set to
701 * RTE_EVENT_QUEUE_CFG_ALL_TYPES
704 rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
705 uint32_t *attr_value);
707 /* Event port specific APIs */
709 /* Event port configuration bitmap flags */
710 #define RTE_EVENT_PORT_CFG_DISABLE_IMPL_REL (1ULL << 0)
711 /**< Configure the port not to release outstanding events in
712 * rte_event_dev_dequeue_burst(). If set, all events received through
713 * the port must be explicitly released with RTE_EVENT_OP_RELEASE or
714 * RTE_EVENT_OP_FORWARD. Must be unset if the device is not
715 * RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE capable.
717 #define RTE_EVENT_PORT_CFG_SINGLE_LINK (1ULL << 1)
718 /**< This event port links only to a single event queue.
720 * @see rte_event_port_setup(), rte_event_port_link()
722 #define RTE_EVENT_PORT_CFG_HINT_PRODUCER (1ULL << 2)
723 /**< Hint that this event port will primarily enqueue events to the system.
724 * A PMD can optimize its internal workings by assuming that this port is
725 * primarily going to enqueue NEW events.
727 * Note that this flag is only a hint, so PMDs must operate under the
728 * assumption that any port can enqueue an event with any type of op.
730 * @see rte_event_port_setup()
732 #define RTE_EVENT_PORT_CFG_HINT_CONSUMER (1ULL << 3)
733 /**< Hint that this event port will primarily dequeue events from the system.
734 * A PMD can optimize its internal workings by assuming that this port is
735 * primarily going to consume events, and not enqueue FORWARD or RELEASE
738 * Note that this flag is only a hint, so PMDs must operate under the
739 * assumption that any port can enqueue an event with any type of op.
741 * @see rte_event_port_setup()
743 #define RTE_EVENT_PORT_CFG_HINT_WORKER (1ULL << 4)
744 /**< Hint that this event port will primarily pass existing events through.
745 * A PMD can optimize its internal workings by assuming that this port is
746 * primarily going to FORWARD events, and not enqueue NEW or RELEASE events
749 * Note that this flag is only a hint, so PMDs must operate under the
750 * assumption that any port can enqueue an event with any type of op.
752 * @see rte_event_port_setup()
755 /** Event port configuration structure */
756 struct rte_event_port_conf {
757 int32_t new_event_threshold;
758 /**< A backpressure threshold for new event enqueues on this port.
759 * Use for *closed system* event dev where event capacity is limited,
760 * and cannot exceed the capacity of the event dev.
761 * Configuring ports with different thresholds can make higher priority
762 * traffic less likely to be backpressured.
763 * For example, a port used to inject NIC Rx packets into the event dev
764 * can have a lower threshold so as not to overwhelm the device,
765 * while ports used for worker pools can have a higher threshold.
766 * This value cannot exceed the *nb_events_limit*
767 * which was previously supplied to rte_event_dev_configure().
768 * This should be set to '-1' for *open system*.
770 uint16_t dequeue_depth;
771 /**< Configure number of bulk dequeues for this event port.
772 * This value cannot exceed the *nb_event_port_dequeue_depth*
773 * which previously supplied to rte_event_dev_configure().
774 * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
776 uint16_t enqueue_depth;
777 /**< Configure number of bulk enqueues for this event port.
778 * This value cannot exceed the *nb_event_port_enqueue_depth*
779 * which previously supplied to rte_event_dev_configure().
780 * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
782 uint32_t event_port_cfg; /**< Port cfg flags(EVENT_PORT_CFG_) */
786 * Retrieve the default configuration information of an event port designated
787 * by its *port_id* from the event driver for an event device.
789 * This function intended to be used in conjunction with rte_event_port_setup()
790 * where caller needs to set up the port by overriding few default values.
793 * The identifier of the device.
795 * The index of the event port to get the configuration information.
796 * The value must be in the range [0, nb_event_ports - 1]
797 * previously supplied to rte_event_dev_configure().
798 * @param[out] port_conf
799 * The pointer to the default event port configuration data
801 * - 0: Success, driver updates the default event port configuration data.
802 * - <0: Error code returned by the driver info get function.
804 * @see rte_event_port_setup()
808 rte_event_port_default_conf_get(uint8_t dev_id, uint8_t port_id,
809 struct rte_event_port_conf *port_conf);
812 * Allocate and set up an event port for an event device.
815 * The identifier of the device.
817 * The index of the event port to setup. The value must be in the range
818 * [0, nb_event_ports - 1] previously supplied to rte_event_dev_configure().
820 * The pointer to the configuration data to be used for the queue.
821 * NULL value is allowed, in which case default configuration used.
823 * @see rte_event_port_default_conf_get()
826 * - 0: Success, event port correctly set up.
827 * - <0: Port configuration failed
828 * - (-EDQUOT) Quota exceeded(Application tried to link the queue configured
829 * with RTE_EVENT_QUEUE_CFG_SINGLE_LINK to more than one event ports)
832 rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
833 const struct rte_event_port_conf *port_conf);
836 * The queue depth of the port on the enqueue side
838 #define RTE_EVENT_PORT_ATTR_ENQ_DEPTH 0
840 * The queue depth of the port on the dequeue side
842 #define RTE_EVENT_PORT_ATTR_DEQ_DEPTH 1
844 * The new event threshold of the port
846 #define RTE_EVENT_PORT_ATTR_NEW_EVENT_THRESHOLD 2
848 * The implicit release disable attribute of the port
850 #define RTE_EVENT_PORT_ATTR_IMPLICIT_RELEASE_DISABLE 3
853 * Get an attribute from a port.
860 * The attribute ID to retrieve
861 * @param[out] attr_value
862 * A pointer that will be filled in with the attribute value if successful
865 * - 0: Successfully returned value
866 * - (-EINVAL) Invalid device, port or attr_id, or attr_value was NULL
869 rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
870 uint32_t *attr_value);
873 * Start an event device.
875 * The device start step is the last one and consists of setting the event
876 * queues to start accepting the events and schedules to event ports.
878 * On success, all basic functions exported by the API (event enqueue,
879 * event dequeue and so on) can be invoked.
882 * Event device identifier
884 * - 0: Success, device started.
885 * - -ESTALE : Not all ports of the device are configured
886 * - -ENOLINK: Not all queues are linked, which could lead to deadlock.
889 rte_event_dev_start(uint8_t dev_id);
892 * Stop an event device.
894 * This function causes all queued events to be drained, including those
895 * residing in event ports. While draining events out of the device, this
896 * function calls the user-provided flush callback (if one was registered) once
899 * The device can be restarted with a call to rte_event_dev_start(). Threads
900 * that continue to enqueue/dequeue while the device is stopped, or being
901 * stopped, will result in undefined behavior. This includes event adapters,
902 * which must be stopped prior to stopping the eventdev.
905 * Event device identifier.
907 * @see rte_event_dev_stop_flush_callback_register()
910 rte_event_dev_stop(uint8_t dev_id);
912 typedef void (*eventdev_stop_flush_t)(uint8_t dev_id, struct rte_event event,
914 /**< Callback function called during rte_event_dev_stop(), invoked once per
919 * Registers a callback function to be invoked during rte_event_dev_stop() for
920 * each flushed event. This function can be used to properly dispose of queued
921 * events, for example events containing memory pointers.
923 * The callback function is only registered for the calling process. The
924 * callback function must be registered in every process that can call
925 * rte_event_dev_stop().
927 * To unregister a callback, call this function with a NULL callback pointer.
930 * The identifier of the device.
932 * Callback function invoked once per flushed event.
934 * Argument supplied to callback.
938 * - -EINVAL if *dev_id* is invalid
940 * @see rte_event_dev_stop()
943 rte_event_dev_stop_flush_callback_register(uint8_t dev_id,
944 eventdev_stop_flush_t callback, void *userdata);
947 * Close an event device. The device cannot be restarted!
950 * Event device identifier
953 * - 0 on successfully closing device
954 * - <0 on failure to close device
955 * - (-EAGAIN) if device is busy
958 rte_event_dev_close(uint8_t dev_id);
961 * Event vector structure.
963 struct rte_event_vector {
965 /**< Number of elements in this event vector. */
967 /**< Reserved for future use */
968 uint16_t attr_valid : 1;
969 /**< Indicates that the below union attributes have valid information.
972 /* Used by Rx/Tx adapter.
973 * Indicates that all the elements in this vector belong to the
974 * same port and queue pair when originating from Rx adapter,
975 * valid only when event type is ETHDEV_VECTOR or
976 * ETH_RX_ADAPTER_VECTOR.
977 * Can also be used to indicate the Tx adapter the destination
978 * port and queue of the mbufs in the vector
982 /* Ethernet device port id. */
984 /* Ethernet device queue id. */
987 /**< Union to hold common attributes of the vector array. */
988 uint64_t impl_opaque;
989 /**< Implementation specific opaque value.
990 * An implementation may use this field to hold implementation specific
991 * value to share between dequeue and enqueue operation.
992 * The application should not modify this field.
995 struct rte_mbuf *mbufs[0];
999 /**< Start of the vector array union. Depending upon the event type the
1000 * vector array can be an array of mbufs or pointers or opaque u64
1005 /* Scheduler type definitions */
1006 #define RTE_SCHED_TYPE_ORDERED 0
1007 /**< Ordered scheduling
1009 * Events from an ordered flow of an event queue can be scheduled to multiple
1010 * ports for concurrent processing while maintaining the original event order.
1011 * This scheme enables the user to achieve high single flow throughput by
1012 * avoiding SW synchronization for ordering between ports which bound to cores.
1014 * The source flow ordering from an event queue is maintained when events are
1015 * enqueued to their destination queue within the same ordered flow context.
1016 * An event port holds the context until application call
1017 * rte_event_dequeue_burst() from the same port, which implicitly releases
1019 * User may allow the scheduler to release the context earlier than that
1020 * by invoking rte_event_enqueue_burst() with RTE_EVENT_OP_RELEASE operation.
1022 * Events from the source queue appear in their original order when dequeued
1023 * from a destination queue.
1024 * Event ordering is based on the received event(s), but also other
1025 * (newly allocated or stored) events are ordered when enqueued within the same
1026 * ordered context. Events not enqueued (e.g. released or stored) within the
1027 * context are considered missing from reordering and are skipped at this time
1028 * (but can be ordered again within another context).
1030 * @see rte_event_queue_setup(), rte_event_dequeue_burst(), RTE_EVENT_OP_RELEASE
1033 #define RTE_SCHED_TYPE_ATOMIC 1
1034 /**< Atomic scheduling
1036 * Events from an atomic flow of an event queue can be scheduled only to a
1037 * single port at a time. The port is guaranteed to have exclusive (atomic)
1038 * access to the associated flow context, which enables the user to avoid SW
1039 * synchronization. Atomic flows also help to maintain event ordering
1040 * since only one port at a time can process events from a flow of an
1043 * The atomic queue synchronization context is dedicated to the port until
1044 * application call rte_event_dequeue_burst() from the same port,
1045 * which implicitly releases the context. User may allow the scheduler to
1046 * release the context earlier than that by invoking rte_event_enqueue_burst()
1047 * with RTE_EVENT_OP_RELEASE operation.
1049 * @see rte_event_queue_setup(), rte_event_dequeue_burst(), RTE_EVENT_OP_RELEASE
1052 #define RTE_SCHED_TYPE_PARALLEL 2
1053 /**< Parallel scheduling
1055 * The scheduler performs priority scheduling, load balancing, etc. functions
1056 * but does not provide additional event synchronization or ordering.
1057 * It is free to schedule events from a single parallel flow of an event queue
1058 * to multiple events ports for concurrent processing.
1059 * The application is responsible for flow context synchronization and
1060 * event ordering (SW synchronization).
1062 * @see rte_event_queue_setup(), rte_event_dequeue_burst()
1065 /* Event types to classify the event source */
1066 #define RTE_EVENT_TYPE_ETHDEV 0x0
1067 /**< The event generated from ethdev subsystem */
1068 #define RTE_EVENT_TYPE_CRYPTODEV 0x1
1069 /**< The event generated from crypodev subsystem */
1070 #define RTE_EVENT_TYPE_TIMER 0x2
1071 /**< The event generated from event timer adapter */
1072 #define RTE_EVENT_TYPE_CPU 0x3
1073 /**< The event generated from cpu for pipelining.
1074 * Application may use *sub_event_type* to further classify the event
1076 #define RTE_EVENT_TYPE_ETH_RX_ADAPTER 0x4
1077 /**< The event generated from event eth Rx adapter */
1078 #define RTE_EVENT_TYPE_VECTOR 0x8
1079 /**< Indicates that event is a vector.
1080 * All vector event types should be a logical OR of EVENT_TYPE_VECTOR.
1081 * This simplifies the pipeline design as one can split processing the events
1082 * between vector events and normal event across event types.
1084 * if (ev.event_type & RTE_EVENT_TYPE_VECTOR) {
1085 * // Classify and handle vector event.
1087 * // Classify and handle event.
1090 #define RTE_EVENT_TYPE_ETHDEV_VECTOR \
1091 (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_ETHDEV)
1092 /**< The event vector generated from ethdev subsystem */
1093 #define RTE_EVENT_TYPE_CPU_VECTOR (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_CPU)
1094 /**< The event vector generated from cpu for pipelining. */
1095 #define RTE_EVENT_TYPE_ETH_RX_ADAPTER_VECTOR \
1096 (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_ETH_RX_ADAPTER)
1097 /**< The event vector generated from eth Rx adapter. */
1099 #define RTE_EVENT_TYPE_MAX 0x10
1100 /**< Maximum number of event types */
1102 /* Event enqueue operations */
1103 #define RTE_EVENT_OP_NEW 0
1104 /**< The event producers use this operation to inject a new event to the
1107 #define RTE_EVENT_OP_FORWARD 1
1108 /**< The CPU use this operation to forward the event to different event queue or
1109 * change to new application specific flow or schedule type to enable
1112 * This operation must only be enqueued to the same port that the
1113 * event to be forwarded was dequeued from.
1115 #define RTE_EVENT_OP_RELEASE 2
1116 /**< Release the flow context associated with the schedule type.
1118 * If current flow's scheduler type method is *RTE_SCHED_TYPE_ATOMIC*
1119 * then this function hints the scheduler that the user has completed critical
1120 * section processing in the current atomic context.
1121 * The scheduler is now allowed to schedule events from the same flow from
1122 * an event queue to another port. However, the context may be still held
1123 * until the next rte_event_dequeue_burst() call, this call allows but does not
1124 * force the scheduler to release the context early.
1126 * Early atomic context release may increase parallelism and thus system
1127 * performance, but the user needs to design carefully the split into critical
1128 * vs non-critical sections.
1130 * If current flow's scheduler type method is *RTE_SCHED_TYPE_ORDERED*
1131 * then this function hints the scheduler that the user has done all that need
1132 * to maintain event order in the current ordered context.
1133 * The scheduler is allowed to release the ordered context of this port and
1134 * avoid reordering any following enqueues.
1136 * Early ordered context release may increase parallelism and thus system
1139 * If current flow's scheduler type method is *RTE_SCHED_TYPE_PARALLEL*
1140 * or no scheduling context is held then this function may be an NOOP,
1141 * depending on the implementation.
1143 * This operation must only be enqueued to the same port that the
1144 * event to be released was dequeued from.
1149 * The generic *rte_event* structure to hold the event attributes
1150 * for dequeue and enqueue operation
1157 /** Event attributes for dequeue or enqueue operation */
1159 uint32_t flow_id:20;
1160 /**< Targeted flow identifier for the enqueue and
1161 * dequeue operation.
1162 * The value must be in the range of
1163 * [0, nb_event_queue_flows - 1] which
1164 * previously supplied to rte_event_dev_configure().
1166 uint32_t sub_event_type:8;
1167 /**< Sub-event types based on the event source.
1168 * @see RTE_EVENT_TYPE_CPU
1170 uint32_t event_type:4;
1171 /**< Event type to classify the event source.
1172 * @see RTE_EVENT_TYPE_ETHDEV, (RTE_EVENT_TYPE_*)
1175 /**< The type of event enqueue operation - new/forward/
1176 * etc.This field is not preserved across an instance
1177 * and is undefined on dequeue.
1178 * @see RTE_EVENT_OP_NEW, (RTE_EVENT_OP_*)
1181 /**< Reserved for future use */
1182 uint8_t sched_type:2;
1183 /**< Scheduler synchronization type (RTE_SCHED_TYPE_*)
1184 * associated with flow id on a given event queue
1185 * for the enqueue and dequeue operation.
1188 /**< Targeted event queue identifier for the enqueue or
1189 * dequeue operation.
1190 * The value must be in the range of
1191 * [0, nb_event_queues - 1] which previously supplied to
1192 * rte_event_dev_configure().
1195 /**< Event priority relative to other events in the
1196 * event queue. The requested priority should in the
1197 * range of [RTE_EVENT_DEV_PRIORITY_HIGHEST,
1198 * RTE_EVENT_DEV_PRIORITY_LOWEST].
1199 * The implementation shall normalize the requested
1200 * priority to supported priority value.
1201 * Valid when the device has
1202 * RTE_EVENT_DEV_CAP_EVENT_QOS capability.
1204 uint8_t impl_opaque;
1205 /**< Implementation specific opaque value.
1206 * An implementation may use this field to hold
1207 * implementation specific value to share between
1208 * dequeue and enqueue operation.
1209 * The application should not modify this field.
1216 /**< Opaque 64-bit value */
1218 /**< Opaque event pointer */
1219 struct rte_mbuf *mbuf;
1220 /**< mbuf pointer if dequeued event is associated with mbuf */
1221 struct rte_event_vector *vec;
1222 /**< Event vector pointer. */
1226 /* Ethdev Rx adapter capability bitmap flags */
1227 #define RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT 0x1
1228 /**< This flag is sent when the packet transfer mechanism is in HW.
1229 * Ethdev can send packets to the event device using internal event port.
1231 #define RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ 0x2
1232 /**< Adapter supports multiple event queues per ethdev. Every ethdev
1233 * Rx queue can be connected to a unique event queue.
1235 #define RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID 0x4
1236 /**< The application can override the adapter generated flow ID in the
1237 * event. This flow ID can be specified when adding an ethdev Rx queue
1238 * to the adapter using the ev.flow_id member.
1239 * @see struct rte_event_eth_rx_adapter_queue_conf::ev
1240 * @see struct rte_event_eth_rx_adapter_queue_conf::rx_queue_flags
1242 #define RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR 0x8
1243 /**< Adapter supports event vectorization per ethdev. */
1246 * Retrieve the event device's ethdev Rx adapter capabilities for the
1247 * specified ethernet port
1250 * The identifier of the device.
1252 * @param eth_port_id
1253 * The identifier of the ethernet device.
1256 * A pointer to memory filled with Rx event adapter capabilities.
1259 * - 0: Success, driver provides Rx event adapter capabilities for the
1261 * - <0: Error code returned by the driver function.
1265 rte_event_eth_rx_adapter_caps_get(uint8_t dev_id, uint16_t eth_port_id,
1268 #define RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT (1ULL << 0)
1269 /**< This flag is set when the timer mechanism is in HW. */
1271 #define RTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC (1ULL << 1)
1272 /**< This flag is set if periodic mode is supported. */
1275 * Retrieve the event device's timer adapter capabilities.
1278 * The identifier of the device.
1281 * A pointer to memory to be filled with event timer adapter capabilities.
1284 * - 0: Success, driver provided event timer adapter capabilities.
1285 * - <0: Error code returned by the driver function.
1288 rte_event_timer_adapter_caps_get(uint8_t dev_id, uint32_t *caps);
1290 /* Crypto adapter capability bitmap flag */
1291 #define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW 0x1
1292 /**< Flag indicates HW is capable of generating events in
1293 * RTE_EVENT_OP_NEW enqueue operation. Cryptodev will send
1294 * packets to the event device as new events using an internal
1298 #define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD 0x2
1299 /**< Flag indicates HW is capable of generating events in
1300 * RTE_EVENT_OP_FORWARD enqueue operation. Cryptodev will send
1301 * packets to the event device as forwarded event using an
1302 * internal event port.
1305 #define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND 0x4
1306 /**< Flag indicates HW is capable of mapping crypto queue pair to
1310 #define RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA 0x8
1311 /**< Flag indicates HW/SW supports a mechanism to store and retrieve
1312 * the private data information along with the crypto session.
1316 * Retrieve the event device's crypto adapter capabilities for the
1317 * specified cryptodev device
1320 * The identifier of the device.
1323 * The identifier of the cryptodev device.
1326 * A pointer to memory filled with event adapter capabilities.
1327 * It is expected to be pre-allocated & initialized by caller.
1330 * - 0: Success, driver provides event adapter capabilities for the
1332 * - <0: Error code returned by the driver function.
1336 rte_event_crypto_adapter_caps_get(uint8_t dev_id, uint8_t cdev_id,
1339 /* Ethdev Tx adapter capability bitmap flags */
1340 #define RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT 0x1
1341 /**< This flag is sent when the PMD supports a packet transmit callback
1343 #define RTE_EVENT_ETH_TX_ADAPTER_CAP_EVENT_VECTOR 0x2
1344 /**< Indicates that the Tx adapter is capable of handling event vector of
1349 * Retrieve the event device's eth Tx adapter capabilities
1352 * The identifier of the device.
1354 * @param eth_port_id
1355 * The identifier of the ethernet device.
1358 * A pointer to memory filled with eth Tx adapter capabilities.
1361 * - 0: Success, driver provides eth Tx adapter capabilities.
1362 * - <0: Error code returned by the driver function.
1366 rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint16_t eth_port_id,
1370 * Converts nanoseconds to *timeout_ticks* value for rte_event_dequeue_burst()
1372 * If the device is configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT flag
1373 * then application can use this function to convert timeout value in
1374 * nanoseconds to implementations specific timeout value supplied in
1375 * rte_event_dequeue_burst()
1378 * The identifier of the device.
1380 * Wait time in nanosecond
1381 * @param[out] timeout_ticks
1382 * Value for the *timeout_ticks* parameter in rte_event_dequeue_burst()
1386 * - -ENOTSUP if the device doesn't support timeouts
1387 * - -EINVAL if *dev_id* is invalid or *timeout_ticks* is NULL
1388 * - other values < 0 on failure.
1390 * @see rte_event_dequeue_burst(), RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT
1391 * @see rte_event_dev_configure()
1395 rte_event_dequeue_timeout_ticks(uint8_t dev_id, uint64_t ns,
1396 uint64_t *timeout_ticks);
1399 * Link multiple source event queues supplied in *queues* to the destination
1400 * event port designated by its *port_id* with associated service priority
1401 * supplied in *priorities* on the event device designated by its *dev_id*.
1403 * The link establishment shall enable the event port *port_id* from
1404 * receiving events from the specified event queue(s) supplied in *queues*
1406 * An event queue may link to one or more event ports.
1407 * The number of links can be established from an event queue to event port is
1408 * implementation defined.
1410 * Event queue(s) to event port link establishment can be changed at runtime
1411 * without re-configuring the device to support scaling and to reduce the
1412 * latency of critical work by establishing the link with more event ports
1416 * The identifier of the device.
1419 * Event port identifier to select the destination port to link.
1422 * Points to an array of *nb_links* event queues to be linked
1423 * to the event port.
1424 * NULL value is allowed, in which case this function links all the configured
1425 * event queues *nb_event_queues* which previously supplied to
1426 * rte_event_dev_configure() to the event port *port_id*
1429 * Points to an array of *nb_links* service priorities associated with each
1430 * event queue link to event port.
1431 * The priority defines the event port's servicing priority for
1432 * event queue, which may be ignored by an implementation.
1433 * The requested priority should in the range of
1434 * [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST].
1435 * The implementation shall normalize the requested priority to
1436 * implementation supported priority value.
1437 * NULL value is allowed, in which case this function links the event queues
1438 * with RTE_EVENT_DEV_PRIORITY_NORMAL servicing priority
1441 * The number of links to establish. This parameter is ignored if queues is
1445 * The number of links actually established. The return value can be less than
1446 * the value of the *nb_links* parameter when the implementation has the
1447 * limitation on specific queue to port link establishment or if invalid
1448 * parameters are specified in *queues*
1449 * If the return value is less than *nb_links*, the remaining links at the end
1450 * of link[] are not established, and the caller has to take care of them.
1451 * If return value is less than *nb_links* then implementation shall update the
1452 * rte_errno accordingly, Possible rte_errno values are
1453 * (EDQUOT) Quota exceeded(Application tried to link the queue configured with
1454 * RTE_EVENT_QUEUE_CFG_SINGLE_LINK to more than one event ports)
1455 * (EINVAL) Invalid parameter
1459 rte_event_port_link(uint8_t dev_id, uint8_t port_id,
1460 const uint8_t queues[], const uint8_t priorities[],
1464 * Unlink multiple source event queues supplied in *queues* from the destination
1465 * event port designated by its *port_id* on the event device designated
1468 * The unlink call issues an async request to disable the event port *port_id*
1469 * from receiving events from the specified event queue *queue_id*.
1470 * Event queue(s) to event port unlink establishment can be changed at runtime
1471 * without re-configuring the device.
1473 * @see rte_event_port_unlinks_in_progress() to poll for completed unlinks.
1476 * The identifier of the device.
1479 * Event port identifier to select the destination port to unlink.
1482 * Points to an array of *nb_unlinks* event queues to be unlinked
1483 * from the event port.
1484 * NULL value is allowed, in which case this function unlinks all the
1485 * event queue(s) from the event port *port_id*.
1488 * The number of unlinks to establish. This parameter is ignored if queues is
1492 * The number of unlinks successfully requested. The return value can be less
1493 * than the value of the *nb_unlinks* parameter when the implementation has the
1494 * limitation on specific queue to port unlink establishment or
1495 * if invalid parameters are specified.
1496 * If the return value is less than *nb_unlinks*, the remaining queues at the
1497 * end of queues[] are not unlinked, and the caller has to take care of them.
1498 * If return value is less than *nb_unlinks* then implementation shall update
1499 * the rte_errno accordingly, Possible rte_errno values are
1500 * (EINVAL) Invalid parameter
1503 rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
1504 uint8_t queues[], uint16_t nb_unlinks);
1507 * Returns the number of unlinks in progress.
1509 * This function provides the application with a method to detect when an
1510 * unlink has been completed by the implementation.
1512 * @see rte_event_port_unlink() to issue unlink requests.
1515 * The identifier of the device.
1518 * Event port identifier to select port to check for unlinks in progress.
1521 * The number of unlinks that are in progress. A return of zero indicates that
1522 * there are no outstanding unlink requests. A positive return value indicates
1523 * the number of unlinks that are in progress, but are not yet complete.
1524 * A negative return value indicates an error, -EINVAL indicates an invalid
1525 * parameter passed for *dev_id* or *port_id*.
1528 rte_event_port_unlinks_in_progress(uint8_t dev_id, uint8_t port_id);
1531 * Retrieve the list of source event queues and its associated service priority
1532 * linked to the destination event port designated by its *port_id*
1533 * on the event device designated by its *dev_id*.
1536 * The identifier of the device.
1539 * Event port identifier.
1541 * @param[out] queues
1542 * Points to an array of *queues* for output.
1543 * The caller has to allocate *RTE_EVENT_MAX_QUEUES_PER_DEV* bytes to
1544 * store the event queue(s) linked with event port *port_id*
1546 * @param[out] priorities
1547 * Points to an array of *priorities* for output.
1548 * The caller has to allocate *RTE_EVENT_MAX_QUEUES_PER_DEV* bytes to
1549 * store the service priority associated with each event queue linked
1552 * The number of links established on the event port designated by its
1558 rte_event_port_links_get(uint8_t dev_id, uint8_t port_id,
1559 uint8_t queues[], uint8_t priorities[]);
1562 * Retrieve the service ID of the event dev. If the adapter doesn't use
1563 * a rte_service function, this function returns -ESRCH.
1566 * The identifier of the device.
1568 * @param [out] service_id
1569 * A pointer to a uint32_t, to be filled in with the service id.
1573 * - <0: Error code on failure, if the event dev doesn't use a rte_service
1574 * function, this function returns -ESRCH.
1577 rte_event_dev_service_id_get(uint8_t dev_id, uint32_t *service_id);
1580 * Dump internal information about *dev_id* to the FILE* provided in *f*.
1583 * The identifier of the device.
1586 * A pointer to a file for output
1593 rte_event_dev_dump(uint8_t dev_id, FILE *f);
1595 /** Maximum name length for extended statistics counters */
1596 #define RTE_EVENT_DEV_XSTATS_NAME_SIZE 64
1599 * Selects the component of the eventdev to retrieve statistics from.
1601 enum rte_event_dev_xstats_mode {
1602 RTE_EVENT_DEV_XSTATS_DEVICE,
1603 RTE_EVENT_DEV_XSTATS_PORT,
1604 RTE_EVENT_DEV_XSTATS_QUEUE,
1608 * A name-key lookup element for extended statistics.
1610 * This structure is used to map between names and ID numbers
1611 * for extended ethdev statistics.
1613 struct rte_event_dev_xstats_name {
1614 char name[RTE_EVENT_DEV_XSTATS_NAME_SIZE];
1618 * Retrieve names of extended statistics of an event device.
1621 * The identifier of the event device.
1623 * The mode of statistics to retrieve. Choices include the device statistics,
1624 * port statistics or queue statistics.
1625 * @param queue_port_id
1626 * Used to specify the port or queue number in queue or port mode, and is
1627 * ignored in device mode.
1628 * @param[out] xstats_names
1629 * Block of memory to insert names into. Must be at least size in capacity.
1630 * If set to NULL, function returns required capacity.
1632 * Block of memory to insert ids into. Must be at least size in capacity.
1633 * If set to NULL, function returns required capacity. The id values returned
1634 * can be passed to *rte_event_dev_xstats_get* to select statistics.
1636 * Capacity of xstats_names (number of names).
1638 * - positive value lower or equal to size: success. The return value
1639 * is the number of entries filled in the stats table.
1640 * - positive value higher than size: error, the given statistics table
1641 * is too small. The return value corresponds to the size that should
1642 * be given to succeed. The entries in the table are not valid and
1643 * shall not be used by the caller.
1644 * - negative value on error:
1645 * -ENODEV for invalid *dev_id*
1646 * -EINVAL for invalid mode, queue port or id parameters
1647 * -ENOTSUP if the device doesn't support this function.
1650 rte_event_dev_xstats_names_get(uint8_t dev_id,
1651 enum rte_event_dev_xstats_mode mode,
1652 uint8_t queue_port_id,
1653 struct rte_event_dev_xstats_name *xstats_names,
1658 * Retrieve extended statistics of an event device.
1661 * The identifier of the device.
1663 * The mode of statistics to retrieve. Choices include the device statistics,
1664 * port statistics or queue statistics.
1665 * @param queue_port_id
1666 * Used to specify the port or queue number in queue or port mode, and is
1667 * ignored in device mode.
1669 * The id numbers of the stats to get. The ids can be got from the stat
1670 * position in the stat list from rte_event_dev_get_xstats_names(), or
1671 * by using rte_event_dev_xstats_by_name_get().
1672 * @param[out] values
1673 * The values for each stats request by ID.
1675 * The number of stats requested
1677 * - positive value: number of stat entries filled into the values array
1678 * - negative value on error:
1679 * -ENODEV for invalid *dev_id*
1680 * -EINVAL for invalid mode, queue port or id parameters
1681 * -ENOTSUP if the device doesn't support this function.
1684 rte_event_dev_xstats_get(uint8_t dev_id,
1685 enum rte_event_dev_xstats_mode mode,
1686 uint8_t queue_port_id,
1687 const unsigned int ids[],
1688 uint64_t values[], unsigned int n);
1691 * Retrieve the value of a single stat by requesting it by name.
1694 * The identifier of the device
1696 * The stat name to retrieve
1698 * If non-NULL, the numerical id of the stat will be returned, so that further
1699 * requests for the stat can be got using rte_event_dev_xstats_get, which will
1700 * be faster as it doesn't need to scan a list of names for the stat.
1701 * If the stat cannot be found, the id returned will be (unsigned)-1.
1703 * - positive value or zero: the stat value
1704 * - negative value: -EINVAL if stat not found, -ENOTSUP if not supported.
1707 rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
1711 * Reset the values of the xstats of the selected component in the device.
1714 * The identifier of the device
1716 * The mode of the statistics to reset. Choose from device, queue or port.
1717 * @param queue_port_id
1718 * The queue or port to reset. 0 and positive values select ports and queues,
1719 * while -1 indicates all ports or queues.
1721 * Selects specific statistics to be reset. When NULL, all statistics selected
1722 * by *mode* will be reset. If non-NULL, must point to array of at least
1725 * The number of ids available from the *ids* array. Ignored when ids is NULL.
1727 * - zero: successfully reset the statistics to zero
1728 * - negative value: -EINVAL invalid parameters, -ENOTSUP if not supported.
1731 rte_event_dev_xstats_reset(uint8_t dev_id,
1732 enum rte_event_dev_xstats_mode mode,
1733 int16_t queue_port_id,
1734 const uint32_t ids[],
1738 * Trigger the eventdev self test.
1741 * The identifier of the device
1743 * - 0: Selftest successful
1744 * - -ENOTSUP if the device doesn't support selftest
1745 * - other values < 0 on failure.
1747 int rte_event_dev_selftest(uint8_t dev_id);
1750 * Get the memory required per event vector based on the number of elements per
1752 * This should be used to create the mempool that holds the event vectors.
1755 * The name of the vector pool.
1757 * The number of elements in the mbuf pool.
1759 * Size of the per-core object cache. See rte_mempool_create() for
1762 * The number of elements that a single event vector should be able to hold.
1764 * The socket identifier where the memory should be allocated. The
1765 * value can be *SOCKET_ID_ANY* if there is no NUMA constraint for the
1769 * The pointer to the newly allocated mempool, on success. NULL on error
1770 * with rte_errno set appropriately. Possible rte_errno values include:
1771 * - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
1772 * - E_RTE_SECONDARY - function was called from a secondary process instance
1773 * - EINVAL - cache size provided is too large, or priv_size is not aligned.
1774 * - ENOSPC - the maximum number of memzones has already been allocated
1775 * - EEXIST - a memzone with the same name already exists
1776 * - ENOMEM - no appropriate memory area found in which to create memzone
1777 * - ENAMETOOLONG - mempool name requested is too long.
1779 struct rte_mempool *
1780 rte_event_vector_pool_create(const char *name, unsigned int n,
1781 unsigned int cache_size, uint16_t nb_elem,
1784 #include <rte_eventdev_core.h>
1786 static __rte_always_inline uint16_t
1787 __rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id,
1788 const struct rte_event ev[], uint16_t nb_events,
1789 const event_enqueue_burst_t fn)
1791 const struct rte_event_fp_ops *fp_ops;
1794 fp_ops = &rte_event_fp_ops[dev_id];
1795 port = fp_ops->data[port_id];
1796 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
1797 if (dev_id >= RTE_EVENT_MAX_DEVS ||
1798 port_id >= RTE_EVENT_MAX_PORTS_PER_DEV) {
1808 rte_eventdev_trace_enq_burst(dev_id, port_id, ev, nb_events, fn);
1810 * Allow zero cost non burst mode routine invocation if application
1811 * requests nb_events as const one
1814 return (fp_ops->enqueue)(port, ev);
1816 return fn(port, ev, nb_events);
1820 * Enqueue a burst of events objects or an event object supplied in *rte_event*
1821 * structure on an event device designated by its *dev_id* through the event
1822 * port specified by *port_id*. Each event object specifies the event queue on
1823 * which it will be enqueued.
1825 * The *nb_events* parameter is the number of event objects to enqueue which are
1826 * supplied in the *ev* array of *rte_event* structure.
1828 * Event operations RTE_EVENT_OP_FORWARD and RTE_EVENT_OP_RELEASE must only be
1829 * enqueued to the same port that their associated events were dequeued from.
1831 * The rte_event_enqueue_burst() function returns the number of
1832 * events objects it actually enqueued. A return value equal to *nb_events*
1833 * means that all event objects have been enqueued.
1836 * The identifier of the device.
1838 * The identifier of the event port.
1840 * Points to an array of *nb_events* objects of type *rte_event* structure
1841 * which contain the event object enqueue operations to be processed.
1843 * The number of event objects to enqueue, typically number of
1844 * rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
1845 * available for this port.
1848 * The number of event objects actually enqueued on the event device. The
1849 * return value can be less than the value of the *nb_events* parameter when
1850 * the event devices queue is full or if invalid parameters are specified in a
1851 * *rte_event*. If the return value is less than *nb_events*, the remaining
1852 * events at the end of ev[] are not consumed and the caller has to take care
1853 * of them, and rte_errno is set accordingly. Possible errno values include:
1854 * - EINVAL The port ID is invalid, device ID is invalid, an event's queue
1855 * ID is invalid, or an event's sched type doesn't match the
1856 * capabilities of the destination queue.
1857 * - ENOSPC The event port was backpressured and unable to enqueue
1858 * one or more events. This error code is only applicable to
1860 * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH
1862 static inline uint16_t
1863 rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id,
1864 const struct rte_event ev[], uint16_t nb_events)
1866 const struct rte_event_fp_ops *fp_ops;
1868 fp_ops = &rte_event_fp_ops[dev_id];
1869 return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
1870 fp_ops->enqueue_burst);
1874 * Enqueue a burst of events objects of operation type *RTE_EVENT_OP_NEW* on
1875 * an event device designated by its *dev_id* through the event port specified
1878 * Provides the same functionality as rte_event_enqueue_burst(), expect that
1879 * application can use this API when the all objects in the burst contains
1880 * the enqueue operation of the type *RTE_EVENT_OP_NEW*. This specialized
1881 * function can provide the additional hint to the PMD and optimize if possible.
1883 * The rte_event_enqueue_new_burst() result is undefined if the enqueue burst
1884 * has event object of operation type != RTE_EVENT_OP_NEW.
1887 * The identifier of the device.
1889 * The identifier of the event port.
1891 * Points to an array of *nb_events* objects of type *rte_event* structure
1892 * which contain the event object enqueue operations to be processed.
1894 * The number of event objects to enqueue, typically number of
1895 * rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
1896 * available for this port.
1899 * The number of event objects actually enqueued on the event device. The
1900 * return value can be less than the value of the *nb_events* parameter when
1901 * the event devices queue is full or if invalid parameters are specified in a
1902 * *rte_event*. If the return value is less than *nb_events*, the remaining
1903 * events at the end of ev[] are not consumed and the caller has to take care
1904 * of them, and rte_errno is set accordingly. Possible errno values include:
1905 * - EINVAL The port ID is invalid, device ID is invalid, an event's queue
1906 * ID is invalid, or an event's sched type doesn't match the
1907 * capabilities of the destination queue.
1908 * - ENOSPC The event port was backpressured and unable to enqueue
1909 * one or more events. This error code is only applicable to
1911 * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH
1912 * @see rte_event_enqueue_burst()
1914 static inline uint16_t
1915 rte_event_enqueue_new_burst(uint8_t dev_id, uint8_t port_id,
1916 const struct rte_event ev[], uint16_t nb_events)
1918 const struct rte_event_fp_ops *fp_ops;
1920 fp_ops = &rte_event_fp_ops[dev_id];
1921 return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
1922 fp_ops->enqueue_new_burst);
1926 * Enqueue a burst of events objects of operation type *RTE_EVENT_OP_FORWARD*
1927 * on an event device designated by its *dev_id* through the event port
1928 * specified by *port_id*.
1930 * Provides the same functionality as rte_event_enqueue_burst(), expect that
1931 * application can use this API when the all objects in the burst contains
1932 * the enqueue operation of the type *RTE_EVENT_OP_FORWARD*. This specialized
1933 * function can provide the additional hint to the PMD and optimize if possible.
1935 * The rte_event_enqueue_new_burst() result is undefined if the enqueue burst
1936 * has event object of operation type != RTE_EVENT_OP_FORWARD.
1939 * The identifier of the device.
1941 * The identifier of the event port.
1943 * Points to an array of *nb_events* objects of type *rte_event* structure
1944 * which contain the event object enqueue operations to be processed.
1946 * The number of event objects to enqueue, typically number of
1947 * rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
1948 * available for this port.
1951 * The number of event objects actually enqueued on the event device. The
1952 * return value can be less than the value of the *nb_events* parameter when
1953 * the event devices queue is full or if invalid parameters are specified in a
1954 * *rte_event*. If the return value is less than *nb_events*, the remaining
1955 * events at the end of ev[] are not consumed and the caller has to take care
1956 * of them, and rte_errno is set accordingly. Possible errno values include:
1957 * - EINVAL The port ID is invalid, device ID is invalid, an event's queue
1958 * ID is invalid, or an event's sched type doesn't match the
1959 * capabilities of the destination queue.
1960 * - ENOSPC The event port was backpressured and unable to enqueue
1961 * one or more events. This error code is only applicable to
1963 * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH
1964 * @see rte_event_enqueue_burst()
1966 static inline uint16_t
1967 rte_event_enqueue_forward_burst(uint8_t dev_id, uint8_t port_id,
1968 const struct rte_event ev[], uint16_t nb_events)
1970 const struct rte_event_fp_ops *fp_ops;
1972 fp_ops = &rte_event_fp_ops[dev_id];
1973 return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
1974 fp_ops->enqueue_forward_burst);
1978 * Dequeue a burst of events objects or an event object from the event port
1979 * designated by its *event_port_id*, on an event device designated
1982 * rte_event_dequeue_burst() does not dictate the specifics of scheduling
1983 * algorithm as each eventdev driver may have different criteria to schedule
1984 * an event. However, in general, from an application perspective scheduler may
1985 * use the following scheme to dispatch an event to the port.
1987 * 1) Selection of event queue based on
1988 * a) The list of event queues are linked to the event port.
1989 * b) If the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability then event
1990 * queue selection from list is based on event queue priority relative to
1991 * other event queue supplied as *priority* in rte_event_queue_setup()
1992 * c) If the device has RTE_EVENT_DEV_CAP_EVENT_QOS capability then event
1993 * queue selection from the list is based on event priority supplied as
1994 * *priority* in rte_event_enqueue_burst()
1995 * 2) Selection of event
1996 * a) The number of flows available in selected event queue.
1997 * b) Schedule type method associated with the event
1999 * The *nb_events* parameter is the maximum number of event objects to dequeue
2000 * which are returned in the *ev* array of *rte_event* structure.
2002 * The rte_event_dequeue_burst() function returns the number of events objects
2003 * it actually dequeued. A return value equal to *nb_events* means that all
2004 * event objects have been dequeued.
2006 * The number of events dequeued is the number of scheduler contexts held by
2007 * this port. These contexts are automatically released in the next
2008 * rte_event_dequeue_burst() invocation if the port supports implicit
2009 * releases, or invoking rte_event_enqueue_burst() with RTE_EVENT_OP_RELEASE
2010 * operation can be used to release the contexts early.
2012 * Event operations RTE_EVENT_OP_FORWARD and RTE_EVENT_OP_RELEASE must only be
2013 * enqueued to the same port that their associated events were dequeued from.
2016 * The identifier of the device.
2018 * The identifier of the event port.
2020 * Points to an array of *nb_events* objects of type *rte_event* structure
2021 * for output to be populated with the dequeued event objects.
2023 * The maximum number of event objects to dequeue, typically number of
2024 * rte_event_port_dequeue_depth() available for this port.
2026 * @param timeout_ticks
2027 * - 0 no-wait, returns immediately if there is no event.
2028 * - >0 wait for the event, if the device is configured with
2029 * RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT then this function will wait until
2030 * at least one event is available or *timeout_ticks* time.
2031 * if the device is not configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT
2032 * then this function will wait until the event available or
2033 * *dequeue_timeout_ns* ns which was previously supplied to
2034 * rte_event_dev_configure()
2037 * The number of event objects actually dequeued from the port. The return
2038 * value can be less than the value of the *nb_events* parameter when the
2039 * event port's queue is not full.
2041 * @see rte_event_port_dequeue_depth()
2043 static inline uint16_t
2044 rte_event_dequeue_burst(uint8_t dev_id, uint8_t port_id, struct rte_event ev[],
2045 uint16_t nb_events, uint64_t timeout_ticks)
2047 const struct rte_event_fp_ops *fp_ops;
2050 fp_ops = &rte_event_fp_ops[dev_id];
2051 port = fp_ops->data[port_id];
2052 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
2053 if (dev_id >= RTE_EVENT_MAX_DEVS ||
2054 port_id >= RTE_EVENT_MAX_PORTS_PER_DEV) {
2064 rte_eventdev_trace_deq_burst(dev_id, port_id, ev, nb_events);
2066 * Allow zero cost non burst mode routine invocation if application
2067 * requests nb_events as const one
2070 return (fp_ops->dequeue)(port, ev, timeout_ticks);
2072 return (fp_ops->dequeue_burst)(port, ev, nb_events,
2076 #define RTE_EVENT_DEV_MAINT_OP_FLUSH (1 << 0)
2077 /**< Force an immediately flush of any buffered events in the port,
2078 * potentially at the cost of additional overhead.
2080 * @see rte_event_maintain()
2084 * Maintain an event device.
2086 * This function is only relevant for event devices which do not have
2087 * the @ref RTE_EVENT_DEV_CAP_MAINTENANCE_FREE flag set. Such devices
2088 * require an application thread using a particular port to
2089 * periodically call rte_event_maintain() on that port during periods
2090 * which it is neither attempting to enqueue events to nor dequeue
2091 * events from the port. rte_event_maintain() is a low-overhead
2092 * function and should be called at a high rate (e.g., in the
2093 * application's poll loop).
2095 * No port may be left unmaintained.
2097 * At the application thread's convenience, rte_event_maintain() may
2098 * (but is not required to) be called even during periods when enqueue
2099 * or dequeue functions are being called, at the cost of a slight
2100 * increase in overhead.
2102 * rte_event_maintain() may be called on event devices which have set
2103 * @ref RTE_EVENT_DEV_CAP_MAINTENANCE_FREE, in which case it is a
2107 * The identifier of the device.
2109 * The identifier of the event port.
2111 * 0, or @ref RTE_EVENT_DEV_MAINT_OP_FLUSH.
2114 * - -EINVAL if *dev_id*, *port_id*, or *op* is invalid.
2116 * @see RTE_EVENT_DEV_CAP_MAINTENANCE_FREE
2120 rte_event_maintain(uint8_t dev_id, uint8_t port_id, int op)
2122 const struct rte_event_fp_ops *fp_ops;
2125 fp_ops = &rte_event_fp_ops[dev_id];
2126 port = fp_ops->data[port_id];
2127 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
2128 if (dev_id >= RTE_EVENT_MAX_DEVS ||
2129 port_id >= RTE_EVENT_MAX_PORTS_PER_DEV)
2135 if (op & (~RTE_EVENT_DEV_MAINT_OP_FLUSH))
2138 rte_eventdev_trace_maintain(dev_id, port_id, op);
2140 if (fp_ops->maintain != NULL)
2141 fp_ops->maintain(port, op);
2150 #endif /* _RTE_EVENTDEV_H_ */