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 /* Event device priority levels */
303 #define RTE_EVENT_DEV_PRIORITY_HIGHEST 0
304 /**< Highest priority expressed across eventdev subsystem
305 * @see rte_event_queue_setup(), rte_event_enqueue_burst()
306 * @see rte_event_port_link()
308 #define RTE_EVENT_DEV_PRIORITY_NORMAL 128
309 /**< Normal priority expressed across eventdev subsystem
310 * @see rte_event_queue_setup(), rte_event_enqueue_burst()
311 * @see rte_event_port_link()
313 #define RTE_EVENT_DEV_PRIORITY_LOWEST 255
314 /**< Lowest priority expressed across eventdev subsystem
315 * @see rte_event_queue_setup(), rte_event_enqueue_burst()
316 * @see rte_event_port_link()
320 * Get the total number of event devices that have been successfully
324 * The total number of usable event devices.
327 rte_event_dev_count(void);
330 * Get the device identifier for the named event device.
333 * Event device name to select the event device identifier.
336 * Returns event device identifier on success.
337 * - <0: Failure to find named event device.
340 rte_event_dev_get_dev_id(const char *name);
343 * Return the NUMA socket to which a device is connected.
346 * The identifier of the device.
348 * The NUMA socket id to which the device is connected or
349 * a default of zero if the socket could not be determined.
350 * -(-EINVAL) dev_id value is out of range.
353 rte_event_dev_socket_id(uint8_t dev_id);
356 * Event device information
358 struct rte_event_dev_info {
359 const char *driver_name; /**< Event driver name */
360 struct rte_device *dev; /**< Device information */
361 uint32_t min_dequeue_timeout_ns;
362 /**< Minimum supported global dequeue timeout(ns) by this device */
363 uint32_t max_dequeue_timeout_ns;
364 /**< Maximum supported global dequeue timeout(ns) by this device */
365 uint32_t dequeue_timeout_ns;
366 /**< Configured global dequeue timeout(ns) for this device */
367 uint8_t max_event_queues;
368 /**< Maximum event_queues supported by this device */
369 uint32_t max_event_queue_flows;
370 /**< Maximum supported flows in an event queue by this device*/
371 uint8_t max_event_queue_priority_levels;
372 /**< Maximum number of event queue priority levels by this device.
373 * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability
375 uint8_t max_event_priority_levels;
376 /**< Maximum number of event priority levels by this device.
377 * Valid when the device has RTE_EVENT_DEV_CAP_EVENT_QOS capability
379 uint8_t max_event_ports;
380 /**< Maximum number of event ports supported by this device */
381 uint8_t max_event_port_dequeue_depth;
382 /**< Maximum number of events can be dequeued at a time from an
383 * event port by this device.
384 * A device that does not support bulk dequeue will set this as 1.
386 uint32_t max_event_port_enqueue_depth;
387 /**< Maximum number of events can be enqueued at a time from an
388 * event port by this device.
389 * A device that does not support bulk enqueue will set this as 1.
391 uint8_t max_event_port_links;
392 /**< Maximum number of queues that can be linked to a single event
393 * port by this device.
395 int32_t max_num_events;
396 /**< A *closed system* event dev has a limit on the number of events it
397 * can manage at a time. An *open system* event dev does not have a
398 * limit and will specify this as -1.
400 uint32_t event_dev_cap;
401 /**< Event device capabilities(RTE_EVENT_DEV_CAP_)*/
402 uint8_t max_single_link_event_port_queue_pairs;
403 /**< Maximum number of event ports and queues that are optimized for
404 * (and only capable of) single-link configurations supported by this
405 * device. These ports and queues are not accounted for in
406 * max_event_ports or max_event_queues.
411 * Retrieve the contextual information of an event device.
414 * The identifier of the device.
416 * @param[out] dev_info
417 * A pointer to a structure of type *rte_event_dev_info* to be filled with the
418 * contextual information of the device.
421 * - 0: Success, driver updates the contextual information of the event device
422 * - <0: Error code returned by the driver info get function.
426 rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info);
429 * The count of ports.
431 #define RTE_EVENT_DEV_ATTR_PORT_COUNT 0
433 * The count of queues.
435 #define RTE_EVENT_DEV_ATTR_QUEUE_COUNT 1
437 * The status of the device, zero for stopped, non-zero for started.
439 #define RTE_EVENT_DEV_ATTR_STARTED 2
442 * Get an attribute from a device.
444 * @param dev_id Eventdev id
445 * @param attr_id The attribute ID to retrieve
446 * @param[out] attr_value A pointer that will be filled in with the attribute
447 * value if successful.
450 * - 0: Successfully retrieved attribute value
451 * - -EINVAL: Invalid device or *attr_id* provided, or *attr_value* is NULL
454 rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id,
455 uint32_t *attr_value);
458 /* Event device configuration bitmap flags */
459 #define RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT (1ULL << 0)
460 /**< Override the global *dequeue_timeout_ns* and use per dequeue timeout in ns.
461 * @see rte_event_dequeue_timeout_ticks(), rte_event_dequeue_burst()
464 /** Event device configuration structure */
465 struct rte_event_dev_config {
466 uint32_t dequeue_timeout_ns;
467 /**< rte_event_dequeue_burst() timeout on this device.
468 * This value should be in the range of *min_dequeue_timeout_ns* and
469 * *max_dequeue_timeout_ns* which previously provided in
470 * rte_event_dev_info_get()
471 * The value 0 is allowed, in which case, default dequeue timeout used.
472 * @see RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT
474 int32_t nb_events_limit;
475 /**< In a *closed system* this field is the limit on maximum number of
476 * events that can be inflight in the eventdev at a given time. The
477 * limit is required to ensure that the finite space in a closed system
478 * is not overwhelmed. The value cannot exceed the *max_num_events*
479 * as provided by rte_event_dev_info_get().
480 * This value should be set to -1 for *open system*.
482 uint8_t nb_event_queues;
483 /**< Number of event queues to configure on this device.
484 * This value cannot exceed the *max_event_queues* which previously
485 * provided in rte_event_dev_info_get()
487 uint8_t nb_event_ports;
488 /**< Number of event ports to configure on this device.
489 * This value cannot exceed the *max_event_ports* which previously
490 * provided in rte_event_dev_info_get()
492 uint32_t nb_event_queue_flows;
493 /**< Number of flows for any event queue on this device.
494 * This value cannot exceed the *max_event_queue_flows* which previously
495 * provided in rte_event_dev_info_get()
497 uint32_t nb_event_port_dequeue_depth;
498 /**< Maximum number of events can be dequeued at a time from an
499 * event port by this device.
500 * This value cannot exceed the *max_event_port_dequeue_depth*
501 * which previously provided in rte_event_dev_info_get().
502 * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
503 * @see rte_event_port_setup()
505 uint32_t nb_event_port_enqueue_depth;
506 /**< Maximum number of events can be enqueued at a time from an
507 * event port by this device.
508 * This value cannot exceed the *max_event_port_enqueue_depth*
509 * which previously provided in rte_event_dev_info_get().
510 * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
511 * @see rte_event_port_setup()
513 uint32_t event_dev_cfg;
514 /**< Event device config flags(RTE_EVENT_DEV_CFG_)*/
515 uint8_t nb_single_link_event_port_queues;
516 /**< Number of event ports and queues that will be singly-linked to
517 * each other. These are a subset of the overall event ports and
518 * queues; this value cannot exceed *nb_event_ports* or
519 * *nb_event_queues*. If the device has ports and queues that are
520 * optimized for single-link usage, this field is a hint for how many
521 * to allocate; otherwise, regular event ports and queues can be used.
526 * Configure an event device.
528 * This function must be invoked first before any other function in the
529 * API. This function can also be re-invoked when a device is in the
532 * The caller may use rte_event_dev_info_get() to get the capability of each
533 * resources available for this event device.
536 * The identifier of the device to configure.
538 * The event device configuration structure.
541 * - 0: Success, device configured.
542 * - <0: Error code returned by the driver configuration function.
545 rte_event_dev_configure(uint8_t dev_id,
546 const struct rte_event_dev_config *dev_conf);
548 /* Event queue specific APIs */
550 /* Event queue configuration bitmap flags */
551 #define RTE_EVENT_QUEUE_CFG_ALL_TYPES (1ULL << 0)
552 /**< Allow ATOMIC,ORDERED,PARALLEL schedule type enqueue
554 * @see RTE_SCHED_TYPE_ORDERED, RTE_SCHED_TYPE_ATOMIC, RTE_SCHED_TYPE_PARALLEL
555 * @see rte_event_enqueue_burst()
557 #define RTE_EVENT_QUEUE_CFG_SINGLE_LINK (1ULL << 1)
558 /**< This event queue links only to a single event port.
560 * @see rte_event_port_setup(), rte_event_port_link()
563 /** Event queue configuration structure */
564 struct rte_event_queue_conf {
565 uint32_t nb_atomic_flows;
566 /**< The maximum number of active flows this queue can track at any
567 * given time. If the queue is configured for atomic scheduling (by
568 * applying the RTE_EVENT_QUEUE_CFG_ALL_TYPES flag to event_queue_cfg
569 * or RTE_SCHED_TYPE_ATOMIC flag to schedule_type), then the
570 * value must be in the range of [1, nb_event_queue_flows], which was
571 * previously provided in rte_event_dev_configure().
573 uint32_t nb_atomic_order_sequences;
574 /**< The maximum number of outstanding events waiting to be
575 * reordered by this queue. In other words, the number of entries in
576 * this queue’s reorder buffer.When the number of events in the
577 * reorder buffer reaches to *nb_atomic_order_sequences* then the
578 * scheduler cannot schedule the events from this queue and invalid
579 * event will be returned from dequeue until one or more entries are
581 * If the queue is configured for ordered scheduling (by applying the
582 * RTE_EVENT_QUEUE_CFG_ALL_TYPES flag to event_queue_cfg or
583 * RTE_SCHED_TYPE_ORDERED flag to schedule_type), then the value must
584 * be in the range of [1, nb_event_queue_flows], which was
585 * previously supplied to rte_event_dev_configure().
587 uint32_t event_queue_cfg;
588 /**< Queue cfg flags(EVENT_QUEUE_CFG_) */
589 uint8_t schedule_type;
590 /**< Queue schedule type(RTE_SCHED_TYPE_*).
591 * Valid when RTE_EVENT_QUEUE_CFG_ALL_TYPES bit is not set in
595 /**< Priority for this event queue relative to other event queues.
596 * The requested priority should in the range of
597 * [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST].
598 * The implementation shall normalize the requested priority to
599 * event device supported priority value.
600 * Valid when the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability
605 * Retrieve the default configuration information of an event queue designated
606 * by its *queue_id* from the event driver for an event device.
608 * This function intended to be used in conjunction with rte_event_queue_setup()
609 * where caller needs to set up the queue by overriding few default values.
612 * The identifier of the device.
614 * The index of the event queue to get the configuration information.
615 * The value must be in the range [0, nb_event_queues - 1]
616 * previously supplied to rte_event_dev_configure().
617 * @param[out] queue_conf
618 * The pointer to the default event queue configuration data.
620 * - 0: Success, driver updates the default event queue configuration data.
621 * - <0: Error code returned by the driver info get function.
623 * @see rte_event_queue_setup()
627 rte_event_queue_default_conf_get(uint8_t dev_id, uint8_t queue_id,
628 struct rte_event_queue_conf *queue_conf);
631 * Allocate and set up an event queue for an event device.
634 * The identifier of the device.
636 * The index of the event queue to setup. The value must be in the range
637 * [0, nb_event_queues - 1] previously supplied to rte_event_dev_configure().
639 * The pointer to the configuration data to be used for the event queue.
640 * NULL value is allowed, in which case default configuration used.
642 * @see rte_event_queue_default_conf_get()
645 * - 0: Success, event queue correctly set up.
646 * - <0: event queue configuration failed
649 rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id,
650 const struct rte_event_queue_conf *queue_conf);
653 * The priority of the queue.
655 #define RTE_EVENT_QUEUE_ATTR_PRIORITY 0
657 * The number of atomic flows configured for the queue.
659 #define RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_FLOWS 1
661 * The number of atomic order sequences configured for the queue.
663 #define RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_ORDER_SEQUENCES 2
665 * The cfg flags for the queue.
667 #define RTE_EVENT_QUEUE_ATTR_EVENT_QUEUE_CFG 3
669 * The schedule type of the queue.
671 #define RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE 4
674 * Get an attribute from a queue.
681 * The attribute ID to retrieve
682 * @param[out] attr_value
683 * A pointer that will be filled in with the attribute value if successful
686 * - 0: Successfully returned value
687 * - -EINVAL: invalid device, queue or attr_id provided, or attr_value was
689 * - -EOVERFLOW: returned when attr_id is set to
690 * RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE and event_queue_cfg is set to
691 * RTE_EVENT_QUEUE_CFG_ALL_TYPES
694 rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id,
695 uint32_t *attr_value);
697 /* Event port specific APIs */
699 /* Event port configuration bitmap flags */
700 #define RTE_EVENT_PORT_CFG_DISABLE_IMPL_REL (1ULL << 0)
701 /**< Configure the port not to release outstanding events in
702 * rte_event_dev_dequeue_burst(). If set, all events received through
703 * the port must be explicitly released with RTE_EVENT_OP_RELEASE or
704 * RTE_EVENT_OP_FORWARD. Must be unset if the device is not
705 * RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE capable.
707 #define RTE_EVENT_PORT_CFG_SINGLE_LINK (1ULL << 1)
708 /**< This event port links only to a single event queue.
710 * @see rte_event_port_setup(), rte_event_port_link()
713 /** Event port configuration structure */
714 struct rte_event_port_conf {
715 int32_t new_event_threshold;
716 /**< A backpressure threshold for new event enqueues on this port.
717 * Use for *closed system* event dev where event capacity is limited,
718 * and cannot exceed the capacity of the event dev.
719 * Configuring ports with different thresholds can make higher priority
720 * traffic less likely to be backpressured.
721 * For example, a port used to inject NIC Rx packets into the event dev
722 * can have a lower threshold so as not to overwhelm the device,
723 * while ports used for worker pools can have a higher threshold.
724 * This value cannot exceed the *nb_events_limit*
725 * which was previously supplied to rte_event_dev_configure().
726 * This should be set to '-1' for *open system*.
728 uint16_t dequeue_depth;
729 /**< Configure number of bulk dequeues for this event port.
730 * This value cannot exceed the *nb_event_port_dequeue_depth*
731 * which previously supplied to rte_event_dev_configure().
732 * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
734 uint16_t enqueue_depth;
735 /**< Configure number of bulk enqueues for this event port.
736 * This value cannot exceed the *nb_event_port_enqueue_depth*
737 * which previously supplied to rte_event_dev_configure().
738 * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable.
740 uint32_t event_port_cfg; /**< Port cfg flags(EVENT_PORT_CFG_) */
744 * Retrieve the default configuration information of an event port designated
745 * by its *port_id* from the event driver for an event device.
747 * This function intended to be used in conjunction with rte_event_port_setup()
748 * where caller needs to set up the port by overriding few default values.
751 * The identifier of the device.
753 * The index of the event port to get the configuration information.
754 * The value must be in the range [0, nb_event_ports - 1]
755 * previously supplied to rte_event_dev_configure().
756 * @param[out] port_conf
757 * The pointer to the default event port configuration data
759 * - 0: Success, driver updates the default event port configuration data.
760 * - <0: Error code returned by the driver info get function.
762 * @see rte_event_port_setup()
766 rte_event_port_default_conf_get(uint8_t dev_id, uint8_t port_id,
767 struct rte_event_port_conf *port_conf);
770 * Allocate and set up an event port for an event device.
773 * The identifier of the device.
775 * The index of the event port to setup. The value must be in the range
776 * [0, nb_event_ports - 1] previously supplied to rte_event_dev_configure().
778 * The pointer to the configuration data to be used for the queue.
779 * NULL value is allowed, in which case default configuration used.
781 * @see rte_event_port_default_conf_get()
784 * - 0: Success, event port correctly set up.
785 * - <0: Port configuration failed
786 * - (-EDQUOT) Quota exceeded(Application tried to link the queue configured
787 * with RTE_EVENT_QUEUE_CFG_SINGLE_LINK to more than one event ports)
790 rte_event_port_setup(uint8_t dev_id, uint8_t port_id,
791 const struct rte_event_port_conf *port_conf);
794 * The queue depth of the port on the enqueue side
796 #define RTE_EVENT_PORT_ATTR_ENQ_DEPTH 0
798 * The queue depth of the port on the dequeue side
800 #define RTE_EVENT_PORT_ATTR_DEQ_DEPTH 1
802 * The new event threshold of the port
804 #define RTE_EVENT_PORT_ATTR_NEW_EVENT_THRESHOLD 2
806 * The implicit release disable attribute of the port
808 #define RTE_EVENT_PORT_ATTR_IMPLICIT_RELEASE_DISABLE 3
811 * Get an attribute from a port.
818 * The attribute ID to retrieve
819 * @param[out] attr_value
820 * A pointer that will be filled in with the attribute value if successful
823 * - 0: Successfully returned value
824 * - (-EINVAL) Invalid device, port or attr_id, or attr_value was NULL
827 rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id,
828 uint32_t *attr_value);
831 * Start an event device.
833 * The device start step is the last one and consists of setting the event
834 * queues to start accepting the events and schedules to event ports.
836 * On success, all basic functions exported by the API (event enqueue,
837 * event dequeue and so on) can be invoked.
840 * Event device identifier
842 * - 0: Success, device started.
843 * - -ESTALE : Not all ports of the device are configured
844 * - -ENOLINK: Not all queues are linked, which could lead to deadlock.
847 rte_event_dev_start(uint8_t dev_id);
850 * Stop an event device.
852 * This function causes all queued events to be drained, including those
853 * residing in event ports. While draining events out of the device, this
854 * function calls the user-provided flush callback (if one was registered) once
857 * The device can be restarted with a call to rte_event_dev_start(). Threads
858 * that continue to enqueue/dequeue while the device is stopped, or being
859 * stopped, will result in undefined behavior. This includes event adapters,
860 * which must be stopped prior to stopping the eventdev.
863 * Event device identifier.
865 * @see rte_event_dev_stop_flush_callback_register()
868 rte_event_dev_stop(uint8_t dev_id);
870 typedef void (*eventdev_stop_flush_t)(uint8_t dev_id, struct rte_event event,
872 /**< Callback function called during rte_event_dev_stop(), invoked once per
877 * Registers a callback function to be invoked during rte_event_dev_stop() for
878 * each flushed event. This function can be used to properly dispose of queued
879 * events, for example events containing memory pointers.
881 * The callback function is only registered for the calling process. The
882 * callback function must be registered in every process that can call
883 * rte_event_dev_stop().
885 * To unregister a callback, call this function with a NULL callback pointer.
888 * The identifier of the device.
890 * Callback function invoked once per flushed event.
892 * Argument supplied to callback.
896 * - -EINVAL if *dev_id* is invalid
898 * @see rte_event_dev_stop()
901 rte_event_dev_stop_flush_callback_register(uint8_t dev_id,
902 eventdev_stop_flush_t callback, void *userdata);
905 * Close an event device. The device cannot be restarted!
908 * Event device identifier
911 * - 0 on successfully closing device
912 * - <0 on failure to close device
913 * - (-EAGAIN) if device is busy
916 rte_event_dev_close(uint8_t dev_id);
919 * Event vector structure.
921 struct rte_event_vector {
923 /**< Number of elements in this event vector. */
925 /**< Reserved for future use */
926 uint16_t attr_valid : 1;
927 /**< Indicates that the below union attributes have valid information.
930 /* Used by Rx/Tx adapter.
931 * Indicates that all the elements in this vector belong to the
932 * same port and queue pair when originating from Rx adapter,
933 * valid only when event type is ETHDEV_VECTOR or
934 * ETH_RX_ADAPTER_VECTOR.
935 * Can also be used to indicate the Tx adapter the destination
936 * port and queue of the mbufs in the vector
940 /* Ethernet device port id. */
942 /* Ethernet device queue id. */
945 /**< Union to hold common attributes of the vector array. */
946 uint64_t impl_opaque;
947 /**< Implementation specific opaque value.
948 * An implementation may use this field to hold implementation specific
949 * value to share between dequeue and enqueue operation.
950 * The application should not modify this field.
953 struct rte_mbuf *mbufs[0];
957 /**< Start of the vector array union. Depending upon the event type the
958 * vector array can be an array of mbufs or pointers or opaque u64
963 /* Scheduler type definitions */
964 #define RTE_SCHED_TYPE_ORDERED 0
965 /**< Ordered scheduling
967 * Events from an ordered flow of an event queue can be scheduled to multiple
968 * ports for concurrent processing while maintaining the original event order.
969 * This scheme enables the user to achieve high single flow throughput by
970 * avoiding SW synchronization for ordering between ports which bound to cores.
972 * The source flow ordering from an event queue is maintained when events are
973 * enqueued to their destination queue within the same ordered flow context.
974 * An event port holds the context until application call
975 * rte_event_dequeue_burst() from the same port, which implicitly releases
977 * User may allow the scheduler to release the context earlier than that
978 * by invoking rte_event_enqueue_burst() with RTE_EVENT_OP_RELEASE operation.
980 * Events from the source queue appear in their original order when dequeued
981 * from a destination queue.
982 * Event ordering is based on the received event(s), but also other
983 * (newly allocated or stored) events are ordered when enqueued within the same
984 * ordered context. Events not enqueued (e.g. released or stored) within the
985 * context are considered missing from reordering and are skipped at this time
986 * (but can be ordered again within another context).
988 * @see rte_event_queue_setup(), rte_event_dequeue_burst(), RTE_EVENT_OP_RELEASE
991 #define RTE_SCHED_TYPE_ATOMIC 1
992 /**< Atomic scheduling
994 * Events from an atomic flow of an event queue can be scheduled only to a
995 * single port at a time. The port is guaranteed to have exclusive (atomic)
996 * access to the associated flow context, which enables the user to avoid SW
997 * synchronization. Atomic flows also help to maintain event ordering
998 * since only one port at a time can process events from a flow of an
1001 * The atomic queue synchronization context is dedicated to the port until
1002 * application call rte_event_dequeue_burst() from the same port,
1003 * which implicitly releases the context. User may allow the scheduler to
1004 * release the context earlier than that by invoking rte_event_enqueue_burst()
1005 * with RTE_EVENT_OP_RELEASE operation.
1007 * @see rte_event_queue_setup(), rte_event_dequeue_burst(), RTE_EVENT_OP_RELEASE
1010 #define RTE_SCHED_TYPE_PARALLEL 2
1011 /**< Parallel scheduling
1013 * The scheduler performs priority scheduling, load balancing, etc. functions
1014 * but does not provide additional event synchronization or ordering.
1015 * It is free to schedule events from a single parallel flow of an event queue
1016 * to multiple events ports for concurrent processing.
1017 * The application is responsible for flow context synchronization and
1018 * event ordering (SW synchronization).
1020 * @see rte_event_queue_setup(), rte_event_dequeue_burst()
1023 /* Event types to classify the event source */
1024 #define RTE_EVENT_TYPE_ETHDEV 0x0
1025 /**< The event generated from ethdev subsystem */
1026 #define RTE_EVENT_TYPE_CRYPTODEV 0x1
1027 /**< The event generated from crypodev subsystem */
1028 #define RTE_EVENT_TYPE_TIMER 0x2
1029 /**< The event generated from event timer adapter */
1030 #define RTE_EVENT_TYPE_CPU 0x3
1031 /**< The event generated from cpu for pipelining.
1032 * Application may use *sub_event_type* to further classify the event
1034 #define RTE_EVENT_TYPE_ETH_RX_ADAPTER 0x4
1035 /**< The event generated from event eth Rx adapter */
1036 #define RTE_EVENT_TYPE_VECTOR 0x8
1037 /**< Indicates that event is a vector.
1038 * All vector event types should be a logical OR of EVENT_TYPE_VECTOR.
1039 * This simplifies the pipeline design as one can split processing the events
1040 * between vector events and normal event across event types.
1042 * if (ev.event_type & RTE_EVENT_TYPE_VECTOR) {
1043 * // Classify and handle vector event.
1045 * // Classify and handle event.
1048 #define RTE_EVENT_TYPE_ETHDEV_VECTOR \
1049 (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_ETHDEV)
1050 /**< The event vector generated from ethdev subsystem */
1051 #define RTE_EVENT_TYPE_CPU_VECTOR (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_CPU)
1052 /**< The event vector generated from cpu for pipelining. */
1053 #define RTE_EVENT_TYPE_ETH_RX_ADAPTER_VECTOR \
1054 (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_ETH_RX_ADAPTER)
1055 /**< The event vector generated from eth Rx adapter. */
1057 #define RTE_EVENT_TYPE_MAX 0x10
1058 /**< Maximum number of event types */
1060 /* Event enqueue operations */
1061 #define RTE_EVENT_OP_NEW 0
1062 /**< The event producers use this operation to inject a new event to the
1065 #define RTE_EVENT_OP_FORWARD 1
1066 /**< The CPU use this operation to forward the event to different event queue or
1067 * change to new application specific flow or schedule type to enable
1070 * This operation must only be enqueued to the same port that the
1071 * event to be forwarded was dequeued from.
1073 #define RTE_EVENT_OP_RELEASE 2
1074 /**< Release the flow context associated with the schedule type.
1076 * If current flow's scheduler type method is *RTE_SCHED_TYPE_ATOMIC*
1077 * then this function hints the scheduler that the user has completed critical
1078 * section processing in the current atomic context.
1079 * The scheduler is now allowed to schedule events from the same flow from
1080 * an event queue to another port. However, the context may be still held
1081 * until the next rte_event_dequeue_burst() call, this call allows but does not
1082 * force the scheduler to release the context early.
1084 * Early atomic context release may increase parallelism and thus system
1085 * performance, but the user needs to design carefully the split into critical
1086 * vs non-critical sections.
1088 * If current flow's scheduler type method is *RTE_SCHED_TYPE_ORDERED*
1089 * then this function hints the scheduler that the user has done all that need
1090 * to maintain event order in the current ordered context.
1091 * The scheduler is allowed to release the ordered context of this port and
1092 * avoid reordering any following enqueues.
1094 * Early ordered context release may increase parallelism and thus system
1097 * If current flow's scheduler type method is *RTE_SCHED_TYPE_PARALLEL*
1098 * or no scheduling context is held then this function may be an NOOP,
1099 * depending on the implementation.
1101 * This operation must only be enqueued to the same port that the
1102 * event to be released was dequeued from.
1107 * The generic *rte_event* structure to hold the event attributes
1108 * for dequeue and enqueue operation
1115 /** Event attributes for dequeue or enqueue operation */
1117 uint32_t flow_id:20;
1118 /**< Targeted flow identifier for the enqueue and
1119 * dequeue operation.
1120 * The value must be in the range of
1121 * [0, nb_event_queue_flows - 1] which
1122 * previously supplied to rte_event_dev_configure().
1124 uint32_t sub_event_type:8;
1125 /**< Sub-event types based on the event source.
1126 * @see RTE_EVENT_TYPE_CPU
1128 uint32_t event_type:4;
1129 /**< Event type to classify the event source.
1130 * @see RTE_EVENT_TYPE_ETHDEV, (RTE_EVENT_TYPE_*)
1133 /**< The type of event enqueue operation - new/forward/
1134 * etc.This field is not preserved across an instance
1135 * and is undefined on dequeue.
1136 * @see RTE_EVENT_OP_NEW, (RTE_EVENT_OP_*)
1139 /**< Reserved for future use */
1140 uint8_t sched_type:2;
1141 /**< Scheduler synchronization type (RTE_SCHED_TYPE_*)
1142 * associated with flow id on a given event queue
1143 * for the enqueue and dequeue operation.
1146 /**< Targeted event queue identifier for the enqueue or
1147 * dequeue operation.
1148 * The value must be in the range of
1149 * [0, nb_event_queues - 1] which previously supplied to
1150 * rte_event_dev_configure().
1153 /**< Event priority relative to other events in the
1154 * event queue. The requested priority should in the
1155 * range of [RTE_EVENT_DEV_PRIORITY_HIGHEST,
1156 * RTE_EVENT_DEV_PRIORITY_LOWEST].
1157 * The implementation shall normalize the requested
1158 * priority to supported priority value.
1159 * Valid when the device has
1160 * RTE_EVENT_DEV_CAP_EVENT_QOS capability.
1162 uint8_t impl_opaque;
1163 /**< Implementation specific opaque value.
1164 * An implementation may use this field to hold
1165 * implementation specific value to share between
1166 * dequeue and enqueue operation.
1167 * The application should not modify this field.
1174 /**< Opaque 64-bit value */
1176 /**< Opaque event pointer */
1177 struct rte_mbuf *mbuf;
1178 /**< mbuf pointer if dequeued event is associated with mbuf */
1179 struct rte_event_vector *vec;
1180 /**< Event vector pointer. */
1184 /* Ethdev Rx adapter capability bitmap flags */
1185 #define RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT 0x1
1186 /**< This flag is sent when the packet transfer mechanism is in HW.
1187 * Ethdev can send packets to the event device using internal event port.
1189 #define RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ 0x2
1190 /**< Adapter supports multiple event queues per ethdev. Every ethdev
1191 * Rx queue can be connected to a unique event queue.
1193 #define RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID 0x4
1194 /**< The application can override the adapter generated flow ID in the
1195 * event. This flow ID can be specified when adding an ethdev Rx queue
1196 * to the adapter using the ev member of struct rte_event_eth_rx_adapter
1197 * @see struct rte_event_eth_rx_adapter_queue_conf::ev
1198 * @see struct rte_event_eth_rx_adapter_queue_conf::rx_queue_flags
1200 #define RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR 0x8
1201 /**< Adapter supports event vectorization per ethdev. */
1204 * Retrieve the event device's ethdev Rx adapter capabilities for the
1205 * specified ethernet port
1208 * The identifier of the device.
1210 * @param eth_port_id
1211 * The identifier of the ethernet device.
1214 * A pointer to memory filled with Rx event adapter capabilities.
1217 * - 0: Success, driver provides Rx event adapter capabilities for the
1219 * - <0: Error code returned by the driver function.
1223 rte_event_eth_rx_adapter_caps_get(uint8_t dev_id, uint16_t eth_port_id,
1226 #define RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT (1ULL << 0)
1227 /**< This flag is set when the timer mechanism is in HW. */
1229 #define RTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC (1ULL << 1)
1230 /**< This flag is set if periodic mode is supported. */
1233 * Retrieve the event device's timer adapter capabilities.
1236 * The identifier of the device.
1239 * A pointer to memory to be filled with event timer adapter capabilities.
1242 * - 0: Success, driver provided event timer adapter capabilities.
1243 * - <0: Error code returned by the driver function.
1246 rte_event_timer_adapter_caps_get(uint8_t dev_id, uint32_t *caps);
1248 /* Crypto adapter capability bitmap flag */
1249 #define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW 0x1
1250 /**< Flag indicates HW is capable of generating events in
1251 * RTE_EVENT_OP_NEW enqueue operation. Cryptodev will send
1252 * packets to the event device as new events using an internal
1256 #define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD 0x2
1257 /**< Flag indicates HW is capable of generating events in
1258 * RTE_EVENT_OP_FORWARD enqueue operation. Cryptodev will send
1259 * packets to the event device as forwarded event using an
1260 * internal event port.
1263 #define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND 0x4
1264 /**< Flag indicates HW is capable of mapping crypto queue pair to
1268 #define RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA 0x8
1269 /**< Flag indicates HW/SW supports a mechanism to store and retrieve
1270 * the private data information along with the crypto session.
1274 * Retrieve the event device's crypto adapter capabilities for the
1275 * specified cryptodev device
1278 * The identifier of the device.
1281 * The identifier of the cryptodev device.
1284 * A pointer to memory filled with event adapter capabilities.
1285 * It is expected to be pre-allocated & initialized by caller.
1288 * - 0: Success, driver provides event adapter capabilities for the
1290 * - <0: Error code returned by the driver function.
1294 rte_event_crypto_adapter_caps_get(uint8_t dev_id, uint8_t cdev_id,
1297 /* Ethdev Tx adapter capability bitmap flags */
1298 #define RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT 0x1
1299 /**< This flag is sent when the PMD supports a packet transmit callback
1301 #define RTE_EVENT_ETH_TX_ADAPTER_CAP_EVENT_VECTOR 0x2
1302 /**< Indicates that the Tx adapter is capable of handling event vector of
1307 * Retrieve the event device's eth Tx adapter capabilities
1310 * The identifier of the device.
1312 * @param eth_port_id
1313 * The identifier of the ethernet device.
1316 * A pointer to memory filled with eth Tx adapter capabilities.
1319 * - 0: Success, driver provides eth Tx adapter capabilities.
1320 * - <0: Error code returned by the driver function.
1324 rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint16_t eth_port_id,
1327 struct rte_eventdev_ops;
1328 struct rte_eventdev;
1330 typedef uint16_t (*event_enqueue_t)(void *port, const struct rte_event *ev);
1331 /**< @internal Enqueue event on port of a device */
1333 typedef uint16_t (*event_enqueue_burst_t)(void *port,
1334 const struct rte_event ev[], uint16_t nb_events);
1335 /**< @internal Enqueue burst of events on port of a device */
1337 typedef uint16_t (*event_dequeue_t)(void *port, struct rte_event *ev,
1338 uint64_t timeout_ticks);
1339 /**< @internal Dequeue event from port of a device */
1341 typedef uint16_t (*event_dequeue_burst_t)(void *port, struct rte_event ev[],
1342 uint16_t nb_events, uint64_t timeout_ticks);
1343 /**< @internal Dequeue burst of events from port of a device */
1345 typedef uint16_t (*event_tx_adapter_enqueue)(void *port,
1346 struct rte_event ev[], uint16_t nb_events);
1347 /**< @internal Enqueue burst of events on port of a device */
1349 typedef uint16_t (*event_tx_adapter_enqueue_same_dest)(void *port,
1350 struct rte_event ev[], uint16_t nb_events);
1351 /**< @internal Enqueue burst of events on port of a device supporting
1352 * burst having same destination Ethernet port & Tx queue.
1355 typedef uint16_t (*event_crypto_adapter_enqueue)(void *port,
1356 struct rte_event ev[], uint16_t nb_events);
1357 /**< @internal Enqueue burst of events on crypto adapter */
1359 #define RTE_EVENTDEV_NAME_MAX_LEN (64)
1360 /**< @internal Max length of name of event PMD */
1364 * The data part, with no function pointers, associated with each device.
1366 * This structure is safe to place in shared memory to be common among
1367 * different processes in a multi-process configuration.
1369 struct rte_eventdev_data {
1371 /**< Socket ID where memory is allocated */
1373 /**< Device ID for this instance */
1375 /**< Number of event queues. */
1377 /**< Number of event ports. */
1379 /**< Array of pointers to ports. */
1380 struct rte_event_port_conf *ports_cfg;
1381 /**< Array of port configuration structures. */
1382 struct rte_event_queue_conf *queues_cfg;
1383 /**< Array of queue configuration structures. */
1384 uint16_t *links_map;
1385 /**< Memory to store queues to port connections. */
1387 /**< PMD-specific private data */
1388 uint32_t event_dev_cap;
1389 /**< Event device capabilities(RTE_EVENT_DEV_CAP_)*/
1390 struct rte_event_dev_config dev_conf;
1391 /**< Configuration applied to device. */
1392 uint8_t service_inited;
1393 /* Service initialization state */
1394 uint32_t service_id;
1396 void *dev_stop_flush_arg;
1397 /**< User-provided argument for event flush function */
1400 uint8_t dev_started : 1;
1401 /**< Device state: STARTED(1)/STOPPED(0) */
1403 char name[RTE_EVENTDEV_NAME_MAX_LEN];
1404 /**< Unique identifier name */
1406 uint64_t reserved_64s[4]; /**< Reserved for future fields */
1407 void *reserved_ptrs[4]; /**< Reserved for future fields */
1408 } __rte_cache_aligned;
1410 /** @internal The data structure associated with each event device. */
1411 struct rte_eventdev {
1412 event_enqueue_t enqueue;
1413 /**< Pointer to PMD enqueue function. */
1414 event_enqueue_burst_t enqueue_burst;
1415 /**< Pointer to PMD enqueue burst function. */
1416 event_enqueue_burst_t enqueue_new_burst;
1417 /**< Pointer to PMD enqueue burst function(op new variant) */
1418 event_enqueue_burst_t enqueue_forward_burst;
1419 /**< Pointer to PMD enqueue burst function(op forward variant) */
1420 event_dequeue_t dequeue;
1421 /**< Pointer to PMD dequeue function. */
1422 event_dequeue_burst_t dequeue_burst;
1423 /**< Pointer to PMD dequeue burst function. */
1424 event_tx_adapter_enqueue_same_dest txa_enqueue_same_dest;
1425 /**< Pointer to PMD eth Tx adapter burst enqueue function with
1426 * events destined to same Eth port & Tx queue.
1428 event_tx_adapter_enqueue txa_enqueue;
1429 /**< Pointer to PMD eth Tx adapter enqueue function. */
1430 struct rte_eventdev_data *data;
1431 /**< Pointer to device data */
1432 struct rte_eventdev_ops *dev_ops;
1433 /**< Functions exported by PMD */
1434 struct rte_device *dev;
1435 /**< Device info. supplied by probing */
1438 uint8_t attached : 1;
1439 /**< Flag indicating the device is attached */
1441 event_crypto_adapter_enqueue ca_enqueue;
1442 /**< Pointer to PMD crypto adapter enqueue function. */
1444 uint64_t reserved_64s[4]; /**< Reserved for future fields */
1445 void *reserved_ptrs[3]; /**< Reserved for future fields */
1446 } __rte_cache_aligned;
1448 extern struct rte_eventdev *rte_eventdevs;
1449 /** @internal The pool of rte_eventdev structures. */
1451 static __rte_always_inline uint16_t
1452 __rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id,
1453 const struct rte_event ev[], uint16_t nb_events,
1454 const event_enqueue_burst_t fn)
1456 const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
1458 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
1459 if (dev_id >= RTE_EVENT_MAX_DEVS || !rte_eventdevs[dev_id].attached) {
1464 if (port_id >= dev->data->nb_ports) {
1469 rte_eventdev_trace_enq_burst(dev_id, port_id, ev, nb_events, fn);
1471 * Allow zero cost non burst mode routine invocation if application
1472 * requests nb_events as const one
1475 return (*dev->enqueue)(dev->data->ports[port_id], ev);
1477 return fn(dev->data->ports[port_id], ev, nb_events);
1481 * Enqueue a burst of events objects or an event object supplied in *rte_event*
1482 * structure on an event device designated by its *dev_id* through the event
1483 * port specified by *port_id*. Each event object specifies the event queue on
1484 * which it will be enqueued.
1486 * The *nb_events* parameter is the number of event objects to enqueue which are
1487 * supplied in the *ev* array of *rte_event* structure.
1489 * Event operations RTE_EVENT_OP_FORWARD and RTE_EVENT_OP_RELEASE must only be
1490 * enqueued to the same port that their associated events were dequeued from.
1492 * The rte_event_enqueue_burst() function returns the number of
1493 * events objects it actually enqueued. A return value equal to *nb_events*
1494 * means that all event objects have been enqueued.
1497 * The identifier of the device.
1499 * The identifier of the event port.
1501 * Points to an array of *nb_events* objects of type *rte_event* structure
1502 * which contain the event object enqueue operations to be processed.
1504 * The number of event objects to enqueue, typically number of
1505 * rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
1506 * available for this port.
1509 * The number of event objects actually enqueued on the event device. The
1510 * return value can be less than the value of the *nb_events* parameter when
1511 * the event devices queue is full or if invalid parameters are specified in a
1512 * *rte_event*. If the return value is less than *nb_events*, the remaining
1513 * events at the end of ev[] are not consumed and the caller has to take care
1514 * of them, and rte_errno is set accordingly. Possible errno values include:
1515 * - EINVAL The port ID is invalid, device ID is invalid, an event's queue
1516 * ID is invalid, or an event's sched type doesn't match the
1517 * capabilities of the destination queue.
1518 * - ENOSPC The event port was backpressured and unable to enqueue
1519 * one or more events. This error code is only applicable to
1521 * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH
1523 static inline uint16_t
1524 rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id,
1525 const struct rte_event ev[], uint16_t nb_events)
1527 const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
1529 return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
1530 dev->enqueue_burst);
1534 * Enqueue a burst of events objects of operation type *RTE_EVENT_OP_NEW* on
1535 * an event device designated by its *dev_id* through the event port specified
1538 * Provides the same functionality as rte_event_enqueue_burst(), expect that
1539 * application can use this API when the all objects in the burst contains
1540 * the enqueue operation of the type *RTE_EVENT_OP_NEW*. This specialized
1541 * function can provide the additional hint to the PMD and optimize if possible.
1543 * The rte_event_enqueue_new_burst() result is undefined if the enqueue burst
1544 * has event object of operation type != RTE_EVENT_OP_NEW.
1547 * The identifier of the device.
1549 * The identifier of the event port.
1551 * Points to an array of *nb_events* objects of type *rte_event* structure
1552 * which contain the event object enqueue operations to be processed.
1554 * The number of event objects to enqueue, typically number of
1555 * rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
1556 * available for this port.
1559 * The number of event objects actually enqueued on the event device. The
1560 * return value can be less than the value of the *nb_events* parameter when
1561 * the event devices queue is full or if invalid parameters are specified in a
1562 * *rte_event*. If the return value is less than *nb_events*, the remaining
1563 * events at the end of ev[] are not consumed and the caller has to take care
1564 * of them, and rte_errno is set accordingly. Possible errno values include:
1565 * - EINVAL The port ID is invalid, device ID is invalid, an event's queue
1566 * ID is invalid, or an event's sched type doesn't match the
1567 * capabilities of the destination queue.
1568 * - ENOSPC The event port was backpressured and unable to enqueue
1569 * one or more events. This error code is only applicable to
1571 * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH
1572 * @see rte_event_enqueue_burst()
1574 static inline uint16_t
1575 rte_event_enqueue_new_burst(uint8_t dev_id, uint8_t port_id,
1576 const struct rte_event ev[], uint16_t nb_events)
1578 const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
1580 return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
1581 dev->enqueue_new_burst);
1585 * Enqueue a burst of events objects of operation type *RTE_EVENT_OP_FORWARD*
1586 * on an event device designated by its *dev_id* through the event port
1587 * specified by *port_id*.
1589 * Provides the same functionality as rte_event_enqueue_burst(), expect that
1590 * application can use this API when the all objects in the burst contains
1591 * the enqueue operation of the type *RTE_EVENT_OP_FORWARD*. This specialized
1592 * function can provide the additional hint to the PMD and optimize if possible.
1594 * The rte_event_enqueue_new_burst() result is undefined if the enqueue burst
1595 * has event object of operation type != RTE_EVENT_OP_FORWARD.
1598 * The identifier of the device.
1600 * The identifier of the event port.
1602 * Points to an array of *nb_events* objects of type *rte_event* structure
1603 * which contain the event object enqueue operations to be processed.
1605 * The number of event objects to enqueue, typically number of
1606 * rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)
1607 * available for this port.
1610 * The number of event objects actually enqueued on the event device. The
1611 * return value can be less than the value of the *nb_events* parameter when
1612 * the event devices queue is full or if invalid parameters are specified in a
1613 * *rte_event*. If the return value is less than *nb_events*, the remaining
1614 * events at the end of ev[] are not consumed and the caller has to take care
1615 * of them, and rte_errno is set accordingly. Possible errno values include:
1616 * - EINVAL The port ID is invalid, device ID is invalid, an event's queue
1617 * ID is invalid, or an event's sched type doesn't match the
1618 * capabilities of the destination queue.
1619 * - ENOSPC The event port was backpressured and unable to enqueue
1620 * one or more events. This error code is only applicable to
1622 * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH
1623 * @see rte_event_enqueue_burst()
1625 static inline uint16_t
1626 rte_event_enqueue_forward_burst(uint8_t dev_id, uint8_t port_id,
1627 const struct rte_event ev[], uint16_t nb_events)
1629 const struct rte_eventdev *dev = &rte_eventdevs[dev_id];
1631 return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events,
1632 dev->enqueue_forward_burst);
1636 * Converts nanoseconds to *timeout_ticks* value for rte_event_dequeue_burst()
1638 * If the device is configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT flag
1639 * then application can use this function to convert timeout value in
1640 * nanoseconds to implementations specific timeout value supplied in
1641 * rte_event_dequeue_burst()
1644 * The identifier of the device.
1646 * Wait time in nanosecond
1647 * @param[out] timeout_ticks
1648 * Value for the *timeout_ticks* parameter in rte_event_dequeue_burst()
1652 * - -ENOTSUP if the device doesn't support timeouts
1653 * - -EINVAL if *dev_id* is invalid or *timeout_ticks* is NULL
1654 * - other values < 0 on failure.
1656 * @see rte_event_dequeue_burst(), RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT
1657 * @see rte_event_dev_configure()
1661 rte_event_dequeue_timeout_ticks(uint8_t dev_id, uint64_t ns,
1662 uint64_t *timeout_ticks);
1665 * Dequeue a burst of events objects or an event object from the event port
1666 * designated by its *event_port_id*, on an event device designated
1669 * rte_event_dequeue_burst() does not dictate the specifics of scheduling
1670 * algorithm as each eventdev driver may have different criteria to schedule
1671 * an event. However, in general, from an application perspective scheduler may
1672 * use the following scheme to dispatch an event to the port.
1674 * 1) Selection of event queue based on
1675 * a) The list of event queues are linked to the event port.
1676 * b) If the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability then event
1677 * queue selection from list is based on event queue priority relative to
1678 * other event queue supplied as *priority* in rte_event_queue_setup()
1679 * c) If the device has RTE_EVENT_DEV_CAP_EVENT_QOS capability then event
1680 * queue selection from the list is based on event priority supplied as
1681 * *priority* in rte_event_enqueue_burst()
1682 * 2) Selection of event
1683 * a) The number of flows available in selected event queue.
1684 * b) Schedule type method associated with the event
1686 * The *nb_events* parameter is the maximum number of event objects to dequeue
1687 * which are returned in the *ev* array of *rte_event* structure.
1689 * The rte_event_dequeue_burst() function returns the number of events objects
1690 * it actually dequeued. A return value equal to *nb_events* means that all
1691 * event objects have been dequeued.
1693 * The number of events dequeued is the number of scheduler contexts held by
1694 * this port. These contexts are automatically released in the next
1695 * rte_event_dequeue_burst() invocation if the port supports implicit
1696 * releases, or invoking rte_event_enqueue_burst() with RTE_EVENT_OP_RELEASE
1697 * operation can be used to release the contexts early.
1699 * Event operations RTE_EVENT_OP_FORWARD and RTE_EVENT_OP_RELEASE must only be
1700 * enqueued to the same port that their associated events were dequeued from.
1703 * The identifier of the device.
1705 * The identifier of the event port.
1707 * Points to an array of *nb_events* objects of type *rte_event* structure
1708 * for output to be populated with the dequeued event objects.
1710 * The maximum number of event objects to dequeue, typically number of
1711 * rte_event_port_dequeue_depth() available for this port.
1713 * @param timeout_ticks
1714 * - 0 no-wait, returns immediately if there is no event.
1715 * - >0 wait for the event, if the device is configured with
1716 * RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT then this function will wait until
1717 * at least one event is available or *timeout_ticks* time.
1718 * if the device is not configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT
1719 * then this function will wait until the event available or
1720 * *dequeue_timeout_ns* ns which was previously supplied to
1721 * rte_event_dev_configure()
1724 * The number of event objects actually dequeued from the port. The return
1725 * value can be less than the value of the *nb_events* parameter when the
1726 * event port's queue is not full.
1728 * @see rte_event_port_dequeue_depth()
1730 static inline uint16_t
1731 rte_event_dequeue_burst(uint8_t dev_id, uint8_t port_id, struct rte_event ev[],
1732 uint16_t nb_events, uint64_t timeout_ticks)
1734 struct rte_eventdev *dev = &rte_eventdevs[dev_id];
1736 #ifdef RTE_LIBRTE_EVENTDEV_DEBUG
1737 if (dev_id >= RTE_EVENT_MAX_DEVS || !rte_eventdevs[dev_id].attached) {
1742 if (port_id >= dev->data->nb_ports) {
1747 rte_eventdev_trace_deq_burst(dev_id, port_id, ev, nb_events);
1749 * Allow zero cost non burst mode routine invocation if application
1750 * requests nb_events as const one
1753 return (*dev->dequeue)(
1754 dev->data->ports[port_id], ev, timeout_ticks);
1756 return (*dev->dequeue_burst)(
1757 dev->data->ports[port_id], ev, nb_events,
1762 * Link multiple source event queues supplied in *queues* to the destination
1763 * event port designated by its *port_id* with associated service priority
1764 * supplied in *priorities* on the event device designated by its *dev_id*.
1766 * The link establishment shall enable the event port *port_id* from
1767 * receiving events from the specified event queue(s) supplied in *queues*
1769 * An event queue may link to one or more event ports.
1770 * The number of links can be established from an event queue to event port is
1771 * implementation defined.
1773 * Event queue(s) to event port link establishment can be changed at runtime
1774 * without re-configuring the device to support scaling and to reduce the
1775 * latency of critical work by establishing the link with more event ports
1779 * The identifier of the device.
1782 * Event port identifier to select the destination port to link.
1785 * Points to an array of *nb_links* event queues to be linked
1786 * to the event port.
1787 * NULL value is allowed, in which case this function links all the configured
1788 * event queues *nb_event_queues* which previously supplied to
1789 * rte_event_dev_configure() to the event port *port_id*
1792 * Points to an array of *nb_links* service priorities associated with each
1793 * event queue link to event port.
1794 * The priority defines the event port's servicing priority for
1795 * event queue, which may be ignored by an implementation.
1796 * The requested priority should in the range of
1797 * [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST].
1798 * The implementation shall normalize the requested priority to
1799 * implementation supported priority value.
1800 * NULL value is allowed, in which case this function links the event queues
1801 * with RTE_EVENT_DEV_PRIORITY_NORMAL servicing priority
1804 * The number of links to establish. This parameter is ignored if queues is
1808 * The number of links actually established. The return value can be less than
1809 * the value of the *nb_links* parameter when the implementation has the
1810 * limitation on specific queue to port link establishment or if invalid
1811 * parameters are specified in *queues*
1812 * If the return value is less than *nb_links*, the remaining links at the end
1813 * of link[] are not established, and the caller has to take care of them.
1814 * If return value is less than *nb_links* then implementation shall update the
1815 * rte_errno accordingly, Possible rte_errno values are
1816 * (EDQUOT) Quota exceeded(Application tried to link the queue configured with
1817 * RTE_EVENT_QUEUE_CFG_SINGLE_LINK to more than one event ports)
1818 * (EINVAL) Invalid parameter
1822 rte_event_port_link(uint8_t dev_id, uint8_t port_id,
1823 const uint8_t queues[], const uint8_t priorities[],
1827 * Unlink multiple source event queues supplied in *queues* from the destination
1828 * event port designated by its *port_id* on the event device designated
1831 * The unlink call issues an async request to disable the event port *port_id*
1832 * from receiving events from the specified event queue *queue_id*.
1833 * Event queue(s) to event port unlink establishment can be changed at runtime
1834 * without re-configuring the device.
1836 * @see rte_event_port_unlinks_in_progress() to poll for completed unlinks.
1839 * The identifier of the device.
1842 * Event port identifier to select the destination port to unlink.
1845 * Points to an array of *nb_unlinks* event queues to be unlinked
1846 * from the event port.
1847 * NULL value is allowed, in which case this function unlinks all the
1848 * event queue(s) from the event port *port_id*.
1851 * The number of unlinks to establish. This parameter is ignored if queues is
1855 * The number of unlinks successfully requested. The return value can be less
1856 * than the value of the *nb_unlinks* parameter when the implementation has the
1857 * limitation on specific queue to port unlink establishment or
1858 * if invalid parameters are specified.
1859 * If the return value is less than *nb_unlinks*, the remaining queues at the
1860 * end of queues[] are not unlinked, and the caller has to take care of them.
1861 * If return value is less than *nb_unlinks* then implementation shall update
1862 * the rte_errno accordingly, Possible rte_errno values are
1863 * (EINVAL) Invalid parameter
1866 rte_event_port_unlink(uint8_t dev_id, uint8_t port_id,
1867 uint8_t queues[], uint16_t nb_unlinks);
1870 * Returns the number of unlinks in progress.
1872 * This function provides the application with a method to detect when an
1873 * unlink has been completed by the implementation.
1875 * @see rte_event_port_unlink() to issue unlink requests.
1878 * The identifier of the device.
1881 * Event port identifier to select port to check for unlinks in progress.
1884 * The number of unlinks that are in progress. A return of zero indicates that
1885 * there are no outstanding unlink requests. A positive return value indicates
1886 * the number of unlinks that are in progress, but are not yet complete.
1887 * A negative return value indicates an error, -EINVAL indicates an invalid
1888 * parameter passed for *dev_id* or *port_id*.
1891 rte_event_port_unlinks_in_progress(uint8_t dev_id, uint8_t port_id);
1894 * Retrieve the list of source event queues and its associated service priority
1895 * linked to the destination event port designated by its *port_id*
1896 * on the event device designated by its *dev_id*.
1899 * The identifier of the device.
1902 * Event port identifier.
1904 * @param[out] queues
1905 * Points to an array of *queues* for output.
1906 * The caller has to allocate *RTE_EVENT_MAX_QUEUES_PER_DEV* bytes to
1907 * store the event queue(s) linked with event port *port_id*
1909 * @param[out] priorities
1910 * Points to an array of *priorities* for output.
1911 * The caller has to allocate *RTE_EVENT_MAX_QUEUES_PER_DEV* bytes to
1912 * store the service priority associated with each event queue linked
1915 * The number of links established on the event port designated by its
1921 rte_event_port_links_get(uint8_t dev_id, uint8_t port_id,
1922 uint8_t queues[], uint8_t priorities[]);
1925 * Retrieve the service ID of the event dev. If the adapter doesn't use
1926 * a rte_service function, this function returns -ESRCH.
1929 * The identifier of the device.
1931 * @param [out] service_id
1932 * A pointer to a uint32_t, to be filled in with the service id.
1936 * - <0: Error code on failure, if the event dev doesn't use a rte_service
1937 * function, this function returns -ESRCH.
1940 rte_event_dev_service_id_get(uint8_t dev_id, uint32_t *service_id);
1943 * Dump internal information about *dev_id* to the FILE* provided in *f*.
1946 * The identifier of the device.
1949 * A pointer to a file for output
1956 rte_event_dev_dump(uint8_t dev_id, FILE *f);
1958 /** Maximum name length for extended statistics counters */
1959 #define RTE_EVENT_DEV_XSTATS_NAME_SIZE 64
1962 * Selects the component of the eventdev to retrieve statistics from.
1964 enum rte_event_dev_xstats_mode {
1965 RTE_EVENT_DEV_XSTATS_DEVICE,
1966 RTE_EVENT_DEV_XSTATS_PORT,
1967 RTE_EVENT_DEV_XSTATS_QUEUE,
1971 * A name-key lookup element for extended statistics.
1973 * This structure is used to map between names and ID numbers
1974 * for extended ethdev statistics.
1976 struct rte_event_dev_xstats_name {
1977 char name[RTE_EVENT_DEV_XSTATS_NAME_SIZE];
1981 * Retrieve names of extended statistics of an event device.
1984 * The identifier of the event device.
1986 * The mode of statistics to retrieve. Choices include the device statistics,
1987 * port statistics or queue statistics.
1988 * @param queue_port_id
1989 * Used to specify the port or queue number in queue or port mode, and is
1990 * ignored in device mode.
1991 * @param[out] xstats_names
1992 * Block of memory to insert names into. Must be at least size in capacity.
1993 * If set to NULL, function returns required capacity.
1995 * Block of memory to insert ids into. Must be at least size in capacity.
1996 * If set to NULL, function returns required capacity. The id values returned
1997 * can be passed to *rte_event_dev_xstats_get* to select statistics.
1999 * Capacity of xstats_names (number of names).
2001 * - positive value lower or equal to size: success. The return value
2002 * is the number of entries filled in the stats table.
2003 * - positive value higher than size: error, the given statistics table
2004 * is too small. The return value corresponds to the size that should
2005 * be given to succeed. The entries in the table are not valid and
2006 * shall not be used by the caller.
2007 * - negative value on error:
2008 * -ENODEV for invalid *dev_id*
2009 * -EINVAL for invalid mode, queue port or id parameters
2010 * -ENOTSUP if the device doesn't support this function.
2013 rte_event_dev_xstats_names_get(uint8_t dev_id,
2014 enum rte_event_dev_xstats_mode mode,
2015 uint8_t queue_port_id,
2016 struct rte_event_dev_xstats_name *xstats_names,
2021 * Retrieve extended statistics of an event device.
2024 * The identifier of the device.
2026 * The mode of statistics to retrieve. Choices include the device statistics,
2027 * port statistics or queue statistics.
2028 * @param queue_port_id
2029 * Used to specify the port or queue number in queue or port mode, and is
2030 * ignored in device mode.
2032 * The id numbers of the stats to get. The ids can be got from the stat
2033 * position in the stat list from rte_event_dev_get_xstats_names(), or
2034 * by using rte_event_dev_xstats_by_name_get().
2035 * @param[out] values
2036 * The values for each stats request by ID.
2038 * The number of stats requested
2040 * - positive value: number of stat entries filled into the values array
2041 * - negative value on error:
2042 * -ENODEV for invalid *dev_id*
2043 * -EINVAL for invalid mode, queue port or id parameters
2044 * -ENOTSUP if the device doesn't support this function.
2047 rte_event_dev_xstats_get(uint8_t dev_id,
2048 enum rte_event_dev_xstats_mode mode,
2049 uint8_t queue_port_id,
2050 const unsigned int ids[],
2051 uint64_t values[], unsigned int n);
2054 * Retrieve the value of a single stat by requesting it by name.
2057 * The identifier of the device
2059 * The stat name to retrieve
2061 * If non-NULL, the numerical id of the stat will be returned, so that further
2062 * requests for the stat can be got using rte_event_dev_xstats_get, which will
2063 * be faster as it doesn't need to scan a list of names for the stat.
2064 * If the stat cannot be found, the id returned will be (unsigned)-1.
2066 * - positive value or zero: the stat value
2067 * - negative value: -EINVAL if stat not found, -ENOTSUP if not supported.
2070 rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name,
2074 * Reset the values of the xstats of the selected component in the device.
2077 * The identifier of the device
2079 * The mode of the statistics to reset. Choose from device, queue or port.
2080 * @param queue_port_id
2081 * The queue or port to reset. 0 and positive values select ports and queues,
2082 * while -1 indicates all ports or queues.
2084 * Selects specific statistics to be reset. When NULL, all statistics selected
2085 * by *mode* will be reset. If non-NULL, must point to array of at least
2088 * The number of ids available from the *ids* array. Ignored when ids is NULL.
2090 * - zero: successfully reset the statistics to zero
2091 * - negative value: -EINVAL invalid parameters, -ENOTSUP if not supported.
2094 rte_event_dev_xstats_reset(uint8_t dev_id,
2095 enum rte_event_dev_xstats_mode mode,
2096 int16_t queue_port_id,
2097 const uint32_t ids[],
2101 * Trigger the eventdev self test.
2104 * The identifier of the device
2106 * - 0: Selftest successful
2107 * - -ENOTSUP if the device doesn't support selftest
2108 * - other values < 0 on failure.
2110 int rte_event_dev_selftest(uint8_t dev_id);
2113 * Get the memory required per event vector based on the number of elements per
2115 * This should be used to create the mempool that holds the event vectors.
2118 * The name of the vector pool.
2120 * The number of elements in the mbuf pool.
2122 * Size of the per-core object cache. See rte_mempool_create() for
2125 * The number of elements that a single event vector should be able to hold.
2127 * The socket identifier where the memory should be allocated. The
2128 * value can be *SOCKET_ID_ANY* if there is no NUMA constraint for the
2132 * The pointer to the newly allocated mempool, on success. NULL on error
2133 * with rte_errno set appropriately. Possible rte_errno values include:
2134 * - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
2135 * - E_RTE_SECONDARY - function was called from a secondary process instance
2136 * - EINVAL - cache size provided is too large, or priv_size is not aligned.
2137 * - ENOSPC - the maximum number of memzones has already been allocated
2138 * - EEXIST - a memzone with the same name already exists
2139 * - ENOMEM - no appropriate memory area found in which to create memzone
2140 * - ENAMETOOLONG - mempool name requested is too long.
2143 struct rte_mempool *
2144 rte_event_vector_pool_create(const char *name, unsigned int n,
2145 unsigned int cache_size, uint16_t nb_elem,
2152 #endif /* _RTE_EVENTDEV_H_ */