199a2dd95SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause 299a2dd95SBruce Richardson * Copyright(c) 2016 Cavium, Inc. 399a2dd95SBruce Richardson * Copyright(c) 2016-2018 Intel Corporation. 499a2dd95SBruce Richardson * Copyright 2016 NXP 599a2dd95SBruce Richardson * All rights reserved. 699a2dd95SBruce Richardson */ 799a2dd95SBruce Richardson 899a2dd95SBruce Richardson #ifndef _RTE_EVENTDEV_H_ 999a2dd95SBruce Richardson #define _RTE_EVENTDEV_H_ 1099a2dd95SBruce Richardson 1199a2dd95SBruce Richardson /** 1299a2dd95SBruce Richardson * @file 1399a2dd95SBruce Richardson * 1499a2dd95SBruce Richardson * RTE Event Device API 159d22ced0SBruce Richardson * ==================== 1699a2dd95SBruce Richardson * 179d22ced0SBruce Richardson * In a traditional DPDK application model, the application polls Ethdev port RX 189d22ced0SBruce Richardson * queues to look for work, and processing is done in a run-to-completion manner, 199d22ced0SBruce Richardson * after which the packets are transmitted on a Ethdev TX queue. Load is 209d22ced0SBruce Richardson * distributed by statically assigning ports and queues to lcores, and NIC 219d22ced0SBruce Richardson * receive-side scaling (RSS), or similar, is employed to distribute network flows 229d22ced0SBruce Richardson * (and thus work) on the same port across multiple RX queues. 239d22ced0SBruce Richardson * 249d22ced0SBruce Richardson * In contrast, in an event-driven model, as supported by this "eventdev" library, 259d22ced0SBruce Richardson * incoming packets (or other input events) are fed into an event device, which 269d22ced0SBruce Richardson * schedules those packets across the available lcores, in accordance with its configuration. 279d22ced0SBruce Richardson * This event-driven programming model offers applications automatic multicore scaling, 289d22ced0SBruce Richardson * dynamic load balancing, pipelining, packet order maintenance, synchronization, 299d22ced0SBruce Richardson * and prioritization/quality of service. 3099a2dd95SBruce Richardson * 3199a2dd95SBruce Richardson * The Event Device API is composed of two parts: 3299a2dd95SBruce Richardson * 3399a2dd95SBruce Richardson * - The application-oriented Event API that includes functions to setup 3499a2dd95SBruce Richardson * an event device (configure it, setup its queues, ports and start it), to 359d22ced0SBruce Richardson * establish the links between queues and ports to receive events, and so on. 3699a2dd95SBruce Richardson * 3799a2dd95SBruce Richardson * - The driver-oriented Event API that exports a function allowing 389d22ced0SBruce Richardson * an event poll Mode Driver (PMD) to register itself as 3999a2dd95SBruce Richardson * an event device driver. 4099a2dd95SBruce Richardson * 419d22ced0SBruce Richardson * Application-oriented Event API 429d22ced0SBruce Richardson * ------------------------------ 439d22ced0SBruce Richardson * 4499a2dd95SBruce Richardson * Event device components: 4599a2dd95SBruce Richardson * 4699a2dd95SBruce Richardson * +-----------------+ 4799a2dd95SBruce Richardson * | +-------------+ | 4899a2dd95SBruce Richardson * +-------+ | | flow 0 | | 4999a2dd95SBruce Richardson * |Packet | | +-------------+ | 5099a2dd95SBruce Richardson * |event | | +-------------+ | 5199a2dd95SBruce Richardson * | | | | flow 1 | |port_link(port0, queue0) 5299a2dd95SBruce Richardson * +-------+ | +-------------+ | | +--------+ 5399a2dd95SBruce Richardson * +-------+ | +-------------+ o-----v-----o |dequeue +------+ 5499a2dd95SBruce Richardson * |Crypto | | | flow n | | | event +------->|Core 0| 5599a2dd95SBruce Richardson * |work | | +-------------+ o----+ | port 0 | | | 5699a2dd95SBruce Richardson * |done ev| | event queue 0 | | +--------+ +------+ 5799a2dd95SBruce Richardson * +-------+ +-----------------+ | 5899a2dd95SBruce Richardson * +-------+ | 5999a2dd95SBruce Richardson * |Timer | +-----------------+ | +--------+ 6099a2dd95SBruce Richardson * |expiry | | +-------------+ | +------o |dequeue +------+ 6199a2dd95SBruce Richardson * |event | | | flow 0 | o-----------o event +------->|Core 1| 6299a2dd95SBruce Richardson * +-------+ | +-------------+ | +----o port 1 | | | 6399a2dd95SBruce Richardson * Event enqueue | +-------------+ | | +--------+ +------+ 6499a2dd95SBruce Richardson * o-------------> | | flow 1 | | | 6599a2dd95SBruce Richardson * enqueue( | +-------------+ | | 6699a2dd95SBruce Richardson * queue_id, | | | +--------+ +------+ 6799a2dd95SBruce Richardson * flow_id, | +-------------+ | | | |dequeue |Core 2| 6899a2dd95SBruce Richardson * sched_type, | | flow n | o-----------o event +------->| | 6999a2dd95SBruce Richardson * event_type, | +-------------+ | | | port 2 | +------+ 7099a2dd95SBruce Richardson * subev_type, | event queue 1 | | +--------+ 7199a2dd95SBruce Richardson * event) +-----------------+ | +--------+ 7299a2dd95SBruce Richardson * | | |dequeue +------+ 7399a2dd95SBruce Richardson * +-------+ +-----------------+ | | event +------->|Core n| 7499a2dd95SBruce Richardson * |Core | | +-------------+ o-----------o port n | | | 7599a2dd95SBruce Richardson * |(SW) | | | flow 0 | | | +--------+ +--+---+ 7699a2dd95SBruce Richardson * |event | | +-------------+ | | | 7799a2dd95SBruce Richardson * +-------+ | +-------------+ | | | 7899a2dd95SBruce Richardson * ^ | | flow 1 | | | | 7999a2dd95SBruce Richardson * | | +-------------+ o------+ | 8099a2dd95SBruce Richardson * | | +-------------+ | | 8199a2dd95SBruce Richardson * | | | flow n | | | 8299a2dd95SBruce Richardson * | | +-------------+ | | 8399a2dd95SBruce Richardson * | | event queue n | | 8499a2dd95SBruce Richardson * | +-----------------+ | 8599a2dd95SBruce Richardson * | | 8699a2dd95SBruce Richardson * +-----------------------------------------------------------+ 8799a2dd95SBruce Richardson * 889d22ced0SBruce Richardson * **Event device**: A hardware or software-based event scheduler. 8999a2dd95SBruce Richardson * 909d22ced0SBruce Richardson * **Event**: Represents an item of work and is the smallest unit of scheduling. 919d22ced0SBruce Richardson * An event carries metadata, such as queue ID, scheduling type, and event priority, 929d22ced0SBruce Richardson * and data such as one or more packets or other kinds of buffers. 939d22ced0SBruce Richardson * Some examples of events are: 949d22ced0SBruce Richardson * - a software-generated item of work originating from a lcore, 959d22ced0SBruce Richardson * perhaps carrying a packet to be processed. 969d22ced0SBruce Richardson * - a crypto work completion notification. 979d22ced0SBruce Richardson * - a timer expiry notification. 9899a2dd95SBruce Richardson * 999d22ced0SBruce Richardson * **Event queue**: A queue containing events that are to be scheduled by the event device. 10099a2dd95SBruce Richardson * An event queue contains events of different flows associated with scheduling 10199a2dd95SBruce Richardson * types, such as atomic, ordered, or parallel. 1029d22ced0SBruce Richardson * Each event given to an event device must have a valid event queue id field in the metadata, 1039d22ced0SBruce Richardson * to specify on which event queue in the device the event must be placed, 1049d22ced0SBruce Richardson * for later scheduling. 10599a2dd95SBruce Richardson * 1069d22ced0SBruce Richardson * **Event port**: An application's interface into the event dev for enqueue and 10799a2dd95SBruce Richardson * dequeue operations. Each event port can be linked with one or more 10899a2dd95SBruce Richardson * event queues for dequeue operations. 1099d22ced0SBruce Richardson * Enqueue and dequeue from a port is not thread-safe, and the expected use-case is 1109d22ced0SBruce Richardson * that each port is polled by only a single lcore. [If this is not the case, 1119d22ced0SBruce Richardson * a suitable synchronization mechanism should be used to prevent simultaneous 1129d22ced0SBruce Richardson * access from multiple lcores.] 1139d22ced0SBruce Richardson * To schedule events to an lcore, the event device will schedule them to the event port(s) 1149d22ced0SBruce Richardson * being polled by that lcore. 11599a2dd95SBruce Richardson * 1169d22ced0SBruce Richardson * *NOTE*: By default, all the functions of the Event Device API exported by a PMD 1179d22ced0SBruce Richardson * are non-thread-safe functions, which must not be invoked on the same object in parallel on 1189d22ced0SBruce Richardson * different logical cores. 1199d22ced0SBruce Richardson * For instance, the dequeue function of a PMD cannot be invoked in parallel on two logical 1209d22ced0SBruce Richardson * cores to operate on same event port. Of course, this function 12199a2dd95SBruce Richardson * can be invoked in parallel by different logical cores on different ports. 12299a2dd95SBruce Richardson * It is the responsibility of the upper level application to enforce this rule. 12399a2dd95SBruce Richardson * 12499a2dd95SBruce Richardson * In all functions of the Event API, the Event device is 12599a2dd95SBruce Richardson * designated by an integer >= 0 named the device identifier *dev_id* 12699a2dd95SBruce Richardson * 12799a2dd95SBruce Richardson * The functions exported by the application Event API to setup a device 1289d22ced0SBruce Richardson * must be invoked in the following order: 12999a2dd95SBruce Richardson * - rte_event_dev_configure() 13099a2dd95SBruce Richardson * - rte_event_queue_setup() 13199a2dd95SBruce Richardson * - rte_event_port_setup() 13299a2dd95SBruce Richardson * - rte_event_port_link() 13399a2dd95SBruce Richardson * - rte_event_dev_start() 13499a2dd95SBruce Richardson * 13599a2dd95SBruce Richardson * Then, the application can invoke, in any order, the functions 1369d22ced0SBruce Richardson * exported by the Event API to dequeue events, enqueue events, 1379d22ced0SBruce Richardson * and link and unlink event queue(s) to event ports. 13899a2dd95SBruce Richardson * 1399d22ced0SBruce Richardson * Before configuring a device, an application should call rte_event_dev_info_get() 1409d22ced0SBruce Richardson * to determine the capabilities of the event device, and any queue or port 1419d22ced0SBruce Richardson * limits of that device. The parameters set in the various device configuration 1429d22ced0SBruce Richardson * structures may need to be adjusted based on the max values provided in the 1439d22ced0SBruce Richardson * device information structure returned from the rte_event_dev_info_get() API. 1449d22ced0SBruce Richardson * An application may use rte_event_queue_default_conf_get() or 1459d22ced0SBruce Richardson * rte_event_port_default_conf_get() to get the default configuration 1469d22ced0SBruce Richardson * to set up an event queue or event port by overriding few default values. 14799a2dd95SBruce Richardson * 14899a2dd95SBruce Richardson * If the application wants to change the configuration (i.e. call 14999a2dd95SBruce Richardson * rte_event_dev_configure(), rte_event_queue_setup(), or 15099a2dd95SBruce Richardson * rte_event_port_setup()), it must call rte_event_dev_stop() first to stop the 15199a2dd95SBruce Richardson * device and then do the reconfiguration before calling rte_event_dev_start() 15299a2dd95SBruce Richardson * again. The schedule, enqueue and dequeue functions should not be invoked 15399a2dd95SBruce Richardson * when the device is stopped. 15499a2dd95SBruce Richardson * 15599a2dd95SBruce Richardson * Finally, an application can close an Event device by invoking the 1569d22ced0SBruce Richardson * rte_event_dev_close() function. Once closed, a device cannot be 1579d22ced0SBruce Richardson * reconfigured or restarted. 1589d22ced0SBruce Richardson * 1599d22ced0SBruce Richardson * Driver-Oriented Event API 1609d22ced0SBruce Richardson * ------------------------- 16199a2dd95SBruce Richardson * 162de972a78SBruce Richardson * At the Event driver level, Event devices are represented by a generic 163de972a78SBruce Richardson * data structure of type *rte_event_dev*. 164de972a78SBruce Richardson * 165de972a78SBruce Richardson * Event devices are dynamically registered during the PCI/SoC device probing 166de972a78SBruce Richardson * phase performed at EAL initialization time. 167de972a78SBruce Richardson * When an Event device is being probed, an *rte_event_dev* structure is allocated 168de972a78SBruce Richardson * for it and the event_dev_init() function supplied by the Event driver 169de972a78SBruce Richardson * is invoked to properly initialize the device. 170de972a78SBruce Richardson * 171de972a78SBruce Richardson * The role of the device init function is to reset the device hardware or 172de972a78SBruce Richardson * to initialize the software event driver implementation. 173de972a78SBruce Richardson * 174de972a78SBruce Richardson * If the device init operation is successful, the device is assigned a device 175de972a78SBruce Richardson * id (dev_id) for application use. 176de972a78SBruce Richardson * Otherwise, the *rte_event_dev* structure is freed. 177de972a78SBruce Richardson * 17899a2dd95SBruce Richardson * Each function of the application Event API invokes a specific function 17999a2dd95SBruce Richardson * of the PMD that controls the target device designated by its device 18099a2dd95SBruce Richardson * identifier. 18199a2dd95SBruce Richardson * 18299a2dd95SBruce Richardson * For this purpose, all device-specific functions of an Event driver are 18399a2dd95SBruce Richardson * supplied through a set of pointers contained in a generic structure of type 18499a2dd95SBruce Richardson * *event_dev_ops*. 18599a2dd95SBruce Richardson * The address of the *event_dev_ops* structure is stored in the *rte_event_dev* 18699a2dd95SBruce Richardson * structure by the device init function of the Event driver, which is 18799a2dd95SBruce Richardson * invoked during the PCI/SoC device probing phase, as explained earlier. 18899a2dd95SBruce Richardson * 18999a2dd95SBruce Richardson * In other words, each function of the Event API simply retrieves the 19099a2dd95SBruce Richardson * *rte_event_dev* structure associated with the device identifier and 19199a2dd95SBruce Richardson * performs an indirect invocation of the corresponding driver function 19299a2dd95SBruce Richardson * supplied in the *event_dev_ops* structure of the *rte_event_dev* structure. 19399a2dd95SBruce Richardson * 1949d22ced0SBruce Richardson * For performance reasons, the addresses of the fast-path functions of the 1959d22ced0SBruce Richardson * event driver are not contained in the *event_dev_ops* structure. 19699a2dd95SBruce Richardson * Instead, they are directly stored at the beginning of the *rte_event_dev* 19799a2dd95SBruce Richardson * structure to avoid an extra indirect memory access during their invocation. 19899a2dd95SBruce Richardson * 1999d22ced0SBruce Richardson * Event Enqueue, Dequeue and Scheduling 2009d22ced0SBruce Richardson * ------------------------------------- 2019d22ced0SBruce Richardson * 20299a2dd95SBruce Richardson * RTE event device drivers do not use interrupts for enqueue or dequeue 20399a2dd95SBruce Richardson * operation. Instead, Event drivers export Poll-Mode enqueue and dequeue 20499a2dd95SBruce Richardson * functions to applications. 20599a2dd95SBruce Richardson * 20699a2dd95SBruce Richardson * The events are injected to event device through *enqueue* operation by 20799a2dd95SBruce Richardson * event producers in the system. The typical event producers are ethdev 20899a2dd95SBruce Richardson * subsystem for generating packet events, CPU(SW) for generating events based 20999a2dd95SBruce Richardson * on different stages of application processing, cryptodev for generating 21099a2dd95SBruce Richardson * crypto work completion notification etc 21199a2dd95SBruce Richardson * 21299a2dd95SBruce Richardson * The *dequeue* operation gets one or more events from the event ports. 2139d22ced0SBruce Richardson * The application processes the events and sends them to a downstream event queue through 2149d22ced0SBruce Richardson * rte_event_enqueue_burst(), if it is an intermediate stage of event processing. 2159d22ced0SBruce Richardson * On the final stage of processing, the application may use the Tx adapter API for maintaining 2169d22ced0SBruce Richardson * the event ingress order while sending the packet/event on the wire via NIC Tx. 21799a2dd95SBruce Richardson * 21899a2dd95SBruce Richardson * The point at which events are scheduled to ports depends on the device. 21999a2dd95SBruce Richardson * For hardware devices, scheduling occurs asynchronously without any software 22099a2dd95SBruce Richardson * intervention. Software schedulers can either be distributed 22199a2dd95SBruce Richardson * (each worker thread schedules events to its own port) or centralized 22299a2dd95SBruce Richardson * (a dedicated thread schedules to all ports). Distributed software schedulers 2239d22ced0SBruce Richardson * perform the scheduling inside the enqueue or dequeue functions, whereas centralized 2249d22ced0SBruce Richardson * software schedulers need a dedicated service core for scheduling. 2259d22ced0SBruce Richardson * The absence of the RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED capability flag 2269d22ced0SBruce Richardson * indicates that the device is centralized and thus needs a dedicated scheduling 2279d22ced0SBruce Richardson * thread (generally an RTE service that should be mapped to one or more service cores) 2289d22ced0SBruce Richardson * that repeatedly calls the software specific scheduling function. 22999a2dd95SBruce Richardson * 23099a2dd95SBruce Richardson * An event driven worker thread has following typical workflow on fastpath: 23199a2dd95SBruce Richardson * \code{.c} 23299a2dd95SBruce Richardson * while (1) { 23399a2dd95SBruce Richardson * rte_event_dequeue_burst(...); 23499a2dd95SBruce Richardson * (event processing) 23599a2dd95SBruce Richardson * rte_event_enqueue_burst(...); 23699a2dd95SBruce Richardson * } 23799a2dd95SBruce Richardson * \endcode 23899a2dd95SBruce Richardson */ 23999a2dd95SBruce Richardson 2401094dd94SDavid Marchand #include <rte_compat.h> 24199a2dd95SBruce Richardson #include <rte_common.h> 24299a2dd95SBruce Richardson #include <rte_errno.h> 24399a2dd95SBruce Richardson #include <rte_mbuf_pool_ops.h> 24499a2dd95SBruce Richardson #include <rte_mempool.h> 24599a2dd95SBruce Richardson 24699a2dd95SBruce Richardson #include "rte_eventdev_trace_fp.h" 24799a2dd95SBruce Richardson 24899a2dd95SBruce Richardson struct rte_mbuf; /* we just use mbuf pointers; no need to include rte_mbuf.h */ 24999a2dd95SBruce Richardson struct rte_event; 25099a2dd95SBruce Richardson 25199a2dd95SBruce Richardson /* Event device capability bitmap flags */ 25299a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_QUEUE_QOS (1ULL << 0) 25344516e6bSShijith Thotton /**< Event scheduling prioritization is based on the priority and weight 254bccda56aSBruce Richardson * associated with each event queue. 255bccda56aSBruce Richardson * 256bccda56aSBruce Richardson * Events from a queue with highest priority 257bccda56aSBruce Richardson * are scheduled first. If the queues are of same priority, weight of the queues 25844516e6bSShijith Thotton * are considered to select a queue in a weighted round robin fashion. 25944516e6bSShijith Thotton * Subsequent dequeue calls from an event port could see events from the same 26044516e6bSShijith Thotton * event queue, if the queue is configured with an affinity count. Affinity 26144516e6bSShijith Thotton * count is the number of subsequent dequeue calls, in which an event port 26244516e6bSShijith Thotton * should use the same event queue if the queue is non-empty 26399a2dd95SBruce Richardson * 264bccda56aSBruce Richardson * NOTE: A device may use both queue prioritization and event prioritization 265bccda56aSBruce Richardson * (@ref RTE_EVENT_DEV_CAP_EVENT_QOS capability) when making packet scheduling decisions. 266bccda56aSBruce Richardson * 267bccda56aSBruce Richardson * @see rte_event_queue_setup() 268bccda56aSBruce Richardson * @see rte_event_queue_attr_set() 26999a2dd95SBruce Richardson */ 27099a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_EVENT_QOS (1ULL << 1) 27199a2dd95SBruce Richardson /**< Event scheduling prioritization is based on the priority associated with 272bccda56aSBruce Richardson * each event. 27399a2dd95SBruce Richardson * 274bccda56aSBruce Richardson * Priority of each event is supplied in *rte_event* structure 275bccda56aSBruce Richardson * on each enqueue operation. 276bccda56aSBruce Richardson * If this capability is not set, the priority field of the event structure 277bccda56aSBruce Richardson * is ignored for each event. 278bccda56aSBruce Richardson * 279bccda56aSBruce Richardson * NOTE: A device may use both queue prioritization (@ref RTE_EVENT_DEV_CAP_QUEUE_QOS capability) 280bccda56aSBruce Richardson * and event prioritization when making packet scheduling decisions. 281bccda56aSBruce Richardson 28299a2dd95SBruce Richardson * @see rte_event_enqueue_burst() 28399a2dd95SBruce Richardson */ 28499a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_DISTRIBUTED_SCHED (1ULL << 2) 28599a2dd95SBruce Richardson /**< Event device operates in distributed scheduling mode. 286bccda56aSBruce Richardson * 28799a2dd95SBruce Richardson * In distributed scheduling mode, event scheduling happens in HW or 288bccda56aSBruce Richardson * rte_event_dequeue_burst() / rte_event_enqueue_burst() or the combination of these two. 28999a2dd95SBruce Richardson * If the flag is not set then eventdev is centralized and thus needs a 29099a2dd95SBruce Richardson * dedicated service core that acts as a scheduling thread. 29199a2dd95SBruce Richardson * 292bccda56aSBruce Richardson * @see rte_event_dev_service_id_get() 29399a2dd95SBruce Richardson */ 29499a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_QUEUE_ALL_TYPES (1ULL << 3) 295ef0646ceSBruce Richardson /**< Event device is capable of accepting enqueued events, of any type 296ef0646ceSBruce Richardson * advertised as supported by the device, to all destination queues. 29799a2dd95SBruce Richardson * 298bccda56aSBruce Richardson * When this capability is set, and @ref RTE_EVENT_QUEUE_CFG_ALL_TYPES flag is set 299bccda56aSBruce Richardson * in @ref rte_event_queue_conf.event_queue_cfg, the "schedule_type" field of the 300bccda56aSBruce Richardson * @ref rte_event_queue_conf structure is ignored when a queue is being configured. 301ef0646ceSBruce Richardson * Instead the "sched_type" field of each event enqueued is used to 302ef0646ceSBruce Richardson * select the scheduling to be performed on that event. 303ef0646ceSBruce Richardson * 304bccda56aSBruce Richardson * If this capability is not set, or the configuration flag is not set, 305bccda56aSBruce Richardson * the queue only supports events of the *RTE_SCHED_TYPE_* type specified 306bccda56aSBruce Richardson * in the @ref rte_event_queue_conf structure at time of configuration. 307bccda56aSBruce Richardson * The behaviour when events of other scheduling types are sent to the queue is 308bccda56aSBruce Richardson * undefined. 309ef0646ceSBruce Richardson * 310bccda56aSBruce Richardson * @see RTE_EVENT_QUEUE_CFG_ALL_TYPES 311ef0646ceSBruce Richardson * @see RTE_SCHED_TYPE_ATOMIC 312ef0646ceSBruce Richardson * @see RTE_SCHED_TYPE_ORDERED 313ef0646ceSBruce Richardson * @see RTE_SCHED_TYPE_PARALLEL 314bccda56aSBruce Richardson * @see rte_event_queue_conf.event_queue_cfg 315ef0646ceSBruce Richardson * @see rte_event_queue_conf.schedule_type 316bccda56aSBruce Richardson * @see rte_event_enqueue_burst() 31799a2dd95SBruce Richardson */ 31899a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_BURST_MODE (1ULL << 4) 31999a2dd95SBruce Richardson /**< Event device is capable of operating in burst mode for enqueue(forward, 320bccda56aSBruce Richardson * release) and dequeue operation. 32199a2dd95SBruce Richardson * 322bccda56aSBruce Richardson * If this capability is not set, application 323bccda56aSBruce Richardson * can still use the rte_event_dequeue_burst() and rte_event_enqueue_burst() but 324bccda56aSBruce Richardson * PMD accepts or returns only one event at a time. 325bccda56aSBruce Richardson * 326bccda56aSBruce Richardson * @see rte_event_dequeue_burst() 327bccda56aSBruce Richardson * @see rte_event_enqueue_burst() 32899a2dd95SBruce Richardson */ 32999a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE (1ULL << 5) 33099a2dd95SBruce Richardson /**< Event device ports support disabling the implicit release feature, in 33199a2dd95SBruce Richardson * which the port will release all unreleased events in its dequeue operation. 332bccda56aSBruce Richardson * 33399a2dd95SBruce Richardson * If this capability is set and the port is configured with implicit release 33499a2dd95SBruce Richardson * disabled, the application is responsible for explicitly releasing events 335bccda56aSBruce Richardson * using either the @ref RTE_EVENT_OP_FORWARD or the @ref RTE_EVENT_OP_RELEASE event 33699a2dd95SBruce Richardson * enqueue operations. 33799a2dd95SBruce Richardson * 338bccda56aSBruce Richardson * @see rte_event_dequeue_burst() 339bccda56aSBruce Richardson * @see rte_event_enqueue_burst() 34099a2dd95SBruce Richardson */ 34199a2dd95SBruce Richardson 34299a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_NONSEQ_MODE (1ULL << 6) 343bccda56aSBruce Richardson /**< Event device is capable of operating in non-sequential mode. 344bccda56aSBruce Richardson * 345bccda56aSBruce Richardson * The path of the event is not necessary to be sequential. Application can change 346bccda56aSBruce Richardson * the path of event at runtime and events may be sent to queues in any order. 347bccda56aSBruce Richardson * 348bccda56aSBruce Richardson * If the flag is not set, then event each event will follow a path from queue 0 349bccda56aSBruce Richardson * to queue 1 to queue 2 etc. 350bccda56aSBruce Richardson * The eventdev will return an error when the application enqueues an event for a 35199a2dd95SBruce Richardson * qid which is not the next in the sequence. 35299a2dd95SBruce Richardson */ 35399a2dd95SBruce Richardson 35499a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_RUNTIME_PORT_LINK (1ULL << 7) 355bccda56aSBruce Richardson /**< Event device is capable of reconfiguring the queue/port link at runtime. 356bccda56aSBruce Richardson * 35799a2dd95SBruce Richardson * If the flag is not set, the eventdev queue/port link is only can be 358bccda56aSBruce Richardson * configured during initialization, or by stopping the device and 359bccda56aSBruce Richardson * then later restarting it after reconfiguration. 360bccda56aSBruce Richardson * 361bccda56aSBruce Richardson * @see rte_event_port_link() 362bccda56aSBruce Richardson * @see rte_event_port_unlink() 36399a2dd95SBruce Richardson */ 36499a2dd95SBruce Richardson 36599a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_MULTIPLE_QUEUE_PORT (1ULL << 8) 366bccda56aSBruce Richardson /**< Event device is capable of setting up links between multiple queues and a single port. 367bccda56aSBruce Richardson * 368bccda56aSBruce Richardson * If the flag is not set, each port may only be linked to a single queue, and 369bccda56aSBruce Richardson * so can only receive events from that queue. 370bccda56aSBruce Richardson * However, each queue may be linked to multiple ports. 371bccda56aSBruce Richardson * 372bccda56aSBruce Richardson * @see rte_event_port_link() 37399a2dd95SBruce Richardson */ 37499a2dd95SBruce Richardson 37599a2dd95SBruce Richardson #define RTE_EVENT_DEV_CAP_CARRY_FLOW_ID (1ULL << 9) 376bccda56aSBruce Richardson /**< Event device preserves the flow ID from the enqueued event to the dequeued event. 377bccda56aSBruce Richardson * 378bccda56aSBruce Richardson * If this flag is not set, 379bccda56aSBruce Richardson * the content of the flow-id field in dequeued events is implementation dependent. 380bccda56aSBruce Richardson * 381bccda56aSBruce Richardson * @see rte_event_dequeue_burst() 38299a2dd95SBruce Richardson */ 38399a2dd95SBruce Richardson 384bd991897SMattias Rönnblom #define RTE_EVENT_DEV_CAP_MAINTENANCE_FREE (1ULL << 10) 385bd991897SMattias Rönnblom /**< Event device *does not* require calls to rte_event_maintain(). 386bccda56aSBruce Richardson * 387bd991897SMattias Rönnblom * An event device that does not set this flag requires calls to 388bd991897SMattias Rönnblom * rte_event_maintain() during periods when neither 389bd991897SMattias Rönnblom * rte_event_dequeue_burst() nor rte_event_enqueue_burst() are called 390bd991897SMattias Rönnblom * on a port. This will allow the event device to perform internal 391bd991897SMattias Rönnblom * processing, such as flushing buffered events, return credits to a 392bd991897SMattias Rönnblom * global pool, or process signaling related to load balancing. 393bccda56aSBruce Richardson * 394bccda56aSBruce Richardson * @see rte_event_maintain() 39554f17843SMattias Rönnblom */ 39654f17843SMattias Rönnblom 39797b914f4SShijith Thotton #define RTE_EVENT_DEV_CAP_RUNTIME_QUEUE_ATTR (1ULL << 11) 39897b914f4SShijith Thotton /**< Event device is capable of changing the queue attributes at runtime i.e 399bccda56aSBruce Richardson * after rte_event_queue_setup() or rte_event_dev_start() call sequence. 400bccda56aSBruce Richardson * 401bccda56aSBruce Richardson * If this flag is not set, event queue attributes can only be configured during 40297b914f4SShijith Thotton * rte_event_queue_setup(). 403bccda56aSBruce Richardson * 404bccda56aSBruce Richardson * @see rte_event_queue_setup() 40597b914f4SShijith Thotton */ 40697b914f4SShijith Thotton 407d007a7f3SPavan Nikhilesh #define RTE_EVENT_DEV_CAP_PROFILE_LINK (1ULL << 12) 408bccda56aSBruce Richardson /**< Event device is capable of supporting multiple link profiles per event port. 409bccda56aSBruce Richardson * 410bccda56aSBruce Richardson * When set, the value of `rte_event_dev_info::max_profiles_per_port` is greater 411bccda56aSBruce Richardson * than one, and multiple profiles may be configured and then switched at runtime. 412bccda56aSBruce Richardson * If not set, only a single profile may be configured, which may itself be 413bccda56aSBruce Richardson * runtime adjustable (if @ref RTE_EVENT_DEV_CAP_RUNTIME_PORT_LINK is set). 414bccda56aSBruce Richardson * 415bccda56aSBruce Richardson * @see rte_event_port_profile_links_set() 416bccda56aSBruce Richardson * @see rte_event_port_profile_links_get() 417bccda56aSBruce Richardson * @see rte_event_port_profile_switch() 418bccda56aSBruce Richardson * @see RTE_EVENT_DEV_CAP_RUNTIME_PORT_LINK 419d007a7f3SPavan Nikhilesh */ 420d007a7f3SPavan Nikhilesh 421eaa8fb6cSBruce Richardson #define RTE_EVENT_DEV_CAP_ATOMIC (1ULL << 13) 422eaa8fb6cSBruce Richardson /**< Event device is capable of atomic scheduling. 423eaa8fb6cSBruce Richardson * When this flag is set, the application can configure queues with scheduling type 424eaa8fb6cSBruce Richardson * atomic on this event device. 425bccda56aSBruce Richardson * 426eaa8fb6cSBruce Richardson * @see RTE_SCHED_TYPE_ATOMIC 427eaa8fb6cSBruce Richardson */ 428eaa8fb6cSBruce Richardson 429eaa8fb6cSBruce Richardson #define RTE_EVENT_DEV_CAP_ORDERED (1ULL << 14) 430eaa8fb6cSBruce Richardson /**< Event device is capable of ordered scheduling. 431eaa8fb6cSBruce Richardson * When this flag is set, the application can configure queues with scheduling type 432eaa8fb6cSBruce Richardson * ordered on this event device. 433bccda56aSBruce Richardson * 434eaa8fb6cSBruce Richardson * @see RTE_SCHED_TYPE_ORDERED 435eaa8fb6cSBruce Richardson */ 436eaa8fb6cSBruce Richardson 437eaa8fb6cSBruce Richardson #define RTE_EVENT_DEV_CAP_PARALLEL (1ULL << 15) 438eaa8fb6cSBruce Richardson /**< Event device is capable of parallel scheduling. 439eaa8fb6cSBruce Richardson * When this flag is set, the application can configure queues with scheduling type 440eaa8fb6cSBruce Richardson * parallel on this event device. 441bccda56aSBruce Richardson * 442eaa8fb6cSBruce Richardson * @see RTE_SCHED_TYPE_PARALLEL 443eaa8fb6cSBruce Richardson */ 444eaa8fb6cSBruce Richardson 44579ca24a4SAbdullah Sevincer #define RTE_EVENT_DEV_CAP_INDEPENDENT_ENQ (1ULL << 16) 44679ca24a4SAbdullah Sevincer /**< Event device is capable of independent enqueue. 44779ca24a4SAbdullah Sevincer * A new capability, RTE_EVENT_DEV_CAP_INDEPENDENT_ENQ, will indicate that Eventdev 44879ca24a4SAbdullah Sevincer * supports the enqueue in any order or specifically in a different order than the 44979ca24a4SAbdullah Sevincer * dequeue. Eventdev PMD can either dequeue events in the changed order in which 45079ca24a4SAbdullah Sevincer * they are enqueued or restore the original order before sending them to the 45179ca24a4SAbdullah Sevincer * underlying hardware device. A flag is provided during the port configuration to 45279ca24a4SAbdullah Sevincer * inform Eventdev PMD that the application intends to use an independent enqueue 45379ca24a4SAbdullah Sevincer * order on a particular port. Note that this capability only matters for eventdevs 45479ca24a4SAbdullah Sevincer * supporting burst mode. 45579ca24a4SAbdullah Sevincer * 45679ca24a4SAbdullah Sevincer * When an implicit release is enabled on a port, Eventdev PMD will also handle 45779ca24a4SAbdullah Sevincer * the insertion of RELEASE events in place of dropped events. The independent enqueue 45879ca24a4SAbdullah Sevincer * feature only applies to FORWARD and RELEASE events. New events (op=RTE_EVENT_OP_NEW) 45979ca24a4SAbdullah Sevincer * will be dequeued in the order the application enqueues them and do not maintain 46079ca24a4SAbdullah Sevincer * any order relative to FORWARD/RELEASE events. FORWARD vs NEW relaxed ordering 46179ca24a4SAbdullah Sevincer * only applies to ports that have enabled independent enqueue feature. 46279ca24a4SAbdullah Sevincer */ 46379ca24a4SAbdullah Sevincer 464acc65ee3SPavan Nikhilesh #define RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE (1ULL << 17) 465acc65ee3SPavan Nikhilesh /**< Event device supports event pre-scheduling. 466acc65ee3SPavan Nikhilesh * 467acc65ee3SPavan Nikhilesh * When this capability is available, the application can enable event pre-scheduling on the event 468acc65ee3SPavan Nikhilesh * device to pre-schedule events to a event port when `rte_event_dequeue_burst()` 469acc65ee3SPavan Nikhilesh * is issued. 470acc65ee3SPavan Nikhilesh * The pre-schedule process starts with the `rte_event_dequeue_burst()` call and the 471acc65ee3SPavan Nikhilesh * pre-scheduled events are returned on the next `rte_event_dequeue_burst()` call. 472acc65ee3SPavan Nikhilesh * 473acc65ee3SPavan Nikhilesh * @see rte_event_dev_configure() 474acc65ee3SPavan Nikhilesh */ 475acc65ee3SPavan Nikhilesh 476acc65ee3SPavan Nikhilesh #define RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE_ADAPTIVE (1ULL << 18) 477acc65ee3SPavan Nikhilesh /**< Event device supports adaptive event pre-scheduling. 478acc65ee3SPavan Nikhilesh * 479acc65ee3SPavan Nikhilesh * When this capability is available, the application can enable adaptive pre-scheduling 480acc65ee3SPavan Nikhilesh * on the event device where the events are pre-scheduled when there are no forward 481acc65ee3SPavan Nikhilesh * progress constraints with the currently held flow contexts. 482acc65ee3SPavan Nikhilesh * The pre-schedule process starts with the `rte_event_dequeue_burst()` call and the 483acc65ee3SPavan Nikhilesh * pre-scheduled events are returned on the next `rte_event_dequeue_burst()` call. 484acc65ee3SPavan Nikhilesh * 485acc65ee3SPavan Nikhilesh * @see rte_event_dev_configure() 486acc65ee3SPavan Nikhilesh */ 487acc65ee3SPavan Nikhilesh 488c1bdd86dSPavan Nikhilesh #define RTE_EVENT_DEV_CAP_PER_PORT_PRESCHEDULE (1ULL << 19) 489c1bdd86dSPavan Nikhilesh /**< Event device supports event pre-scheduling per event port. 490c1bdd86dSPavan Nikhilesh * 491c1bdd86dSPavan Nikhilesh * When this flag is set, the event device allows controlling the event 492c1bdd86dSPavan Nikhilesh * pre-scheduling at a event port granularity. 493c1bdd86dSPavan Nikhilesh * 494c1bdd86dSPavan Nikhilesh * @see rte_event_dev_configure() 495c1bdd86dSPavan Nikhilesh * @see rte_event_port_preschedule_modify() 496c1bdd86dSPavan Nikhilesh */ 497c1bdd86dSPavan Nikhilesh 4984ade669cSPavan Nikhilesh #define RTE_EVENT_DEV_CAP_PRESCHEDULE_EXPLICIT (1ULL << 20) 4994ade669cSPavan Nikhilesh /**< Event device supports explicit pre-scheduling. 5004ade669cSPavan Nikhilesh * 5014ade669cSPavan Nikhilesh * When this flag is set, the application can issue pre-schedule request on 5024ade669cSPavan Nikhilesh * a event port. 5034ade669cSPavan Nikhilesh * 5044ade669cSPavan Nikhilesh * @see rte_event_port_preschedule() 5054ade669cSPavan Nikhilesh */ 5064ade669cSPavan Nikhilesh 50799a2dd95SBruce Richardson /* Event device priority levels */ 50899a2dd95SBruce Richardson #define RTE_EVENT_DEV_PRIORITY_HIGHEST 0 509bccda56aSBruce Richardson /**< Highest priority level for events and queues. 510bccda56aSBruce Richardson * 511bccda56aSBruce Richardson * @see rte_event_queue_setup() 512bccda56aSBruce Richardson * @see rte_event_enqueue_burst() 51399a2dd95SBruce Richardson * @see rte_event_port_link() 51499a2dd95SBruce Richardson */ 51599a2dd95SBruce Richardson #define RTE_EVENT_DEV_PRIORITY_NORMAL 128 516bccda56aSBruce Richardson /**< Normal priority level for events and queues. 517bccda56aSBruce Richardson * 518bccda56aSBruce Richardson * @see rte_event_queue_setup() 519bccda56aSBruce Richardson * @see rte_event_enqueue_burst() 52099a2dd95SBruce Richardson * @see rte_event_port_link() 52199a2dd95SBruce Richardson */ 52299a2dd95SBruce Richardson #define RTE_EVENT_DEV_PRIORITY_LOWEST 255 523bccda56aSBruce Richardson /**< Lowest priority level for events and queues. 524bccda56aSBruce Richardson * 525bccda56aSBruce Richardson * @see rte_event_queue_setup() 526bccda56aSBruce Richardson * @see rte_event_enqueue_burst() 52799a2dd95SBruce Richardson * @see rte_event_port_link() 52899a2dd95SBruce Richardson */ 52999a2dd95SBruce Richardson 53044516e6bSShijith Thotton /* Event queue scheduling weights */ 53144516e6bSShijith Thotton #define RTE_EVENT_QUEUE_WEIGHT_HIGHEST 255 532bccda56aSBruce Richardson /**< Highest weight of an event queue. 533bccda56aSBruce Richardson * 534bccda56aSBruce Richardson * @see rte_event_queue_attr_get() 535bccda56aSBruce Richardson * @see rte_event_queue_attr_set() 53644516e6bSShijith Thotton */ 53744516e6bSShijith Thotton #define RTE_EVENT_QUEUE_WEIGHT_LOWEST 0 538bccda56aSBruce Richardson /**< Lowest weight of an event queue. 539bccda56aSBruce Richardson * 540bccda56aSBruce Richardson * @see rte_event_queue_attr_get() 541bccda56aSBruce Richardson * @see rte_event_queue_attr_set() 54244516e6bSShijith Thotton */ 54344516e6bSShijith Thotton 54444516e6bSShijith Thotton /* Event queue scheduling affinity */ 54544516e6bSShijith Thotton #define RTE_EVENT_QUEUE_AFFINITY_HIGHEST 255 546bccda56aSBruce Richardson /**< Highest scheduling affinity of an event queue. 547bccda56aSBruce Richardson * 548bccda56aSBruce Richardson * @see rte_event_queue_attr_get() 549bccda56aSBruce Richardson * @see rte_event_queue_attr_set() 55044516e6bSShijith Thotton */ 55144516e6bSShijith Thotton #define RTE_EVENT_QUEUE_AFFINITY_LOWEST 0 552bccda56aSBruce Richardson /**< Lowest scheduling affinity of an event queue. 553bccda56aSBruce Richardson * 554bccda56aSBruce Richardson * @see rte_event_queue_attr_get() 555bccda56aSBruce Richardson * @see rte_event_queue_attr_set() 55644516e6bSShijith Thotton */ 55744516e6bSShijith Thotton 55899a2dd95SBruce Richardson /** 559d77c9cbfSBruce Richardson * Get the total number of event devices. 56099a2dd95SBruce Richardson * 56199a2dd95SBruce Richardson * @return 56299a2dd95SBruce Richardson * The total number of usable event devices. 56399a2dd95SBruce Richardson */ 56499a2dd95SBruce Richardson uint8_t 56599a2dd95SBruce Richardson rte_event_dev_count(void); 56699a2dd95SBruce Richardson 56799a2dd95SBruce Richardson /** 56899a2dd95SBruce Richardson * Get the device identifier for the named event device. 56999a2dd95SBruce Richardson * 57099a2dd95SBruce Richardson * @param name 57199a2dd95SBruce Richardson * Event device name to select the event device identifier. 57299a2dd95SBruce Richardson * 57399a2dd95SBruce Richardson * @return 574d77c9cbfSBruce Richardson * Event device identifier (dev_id >= 0) on success. 575d77c9cbfSBruce Richardson * Negative error code on failure: 576d77c9cbfSBruce Richardson * - -EINVAL - input name parameter is invalid. 577d77c9cbfSBruce Richardson * - -ENODEV - no event device found with that name. 57899a2dd95SBruce Richardson */ 57999a2dd95SBruce Richardson int 58099a2dd95SBruce Richardson rte_event_dev_get_dev_id(const char *name); 58199a2dd95SBruce Richardson 58299a2dd95SBruce Richardson /** 58399a2dd95SBruce Richardson * Return the NUMA socket to which a device is connected. 58499a2dd95SBruce Richardson * 58599a2dd95SBruce Richardson * @param dev_id 58699a2dd95SBruce Richardson * The identifier of the device. 58799a2dd95SBruce Richardson * @return 58899a2dd95SBruce Richardson * The NUMA socket id to which the device is connected or 58999a2dd95SBruce Richardson * a default of zero if the socket could not be determined. 590d77c9cbfSBruce Richardson * -EINVAL on error, where the given dev_id value does not 591d77c9cbfSBruce Richardson * correspond to any event device. 59299a2dd95SBruce Richardson */ 59399a2dd95SBruce Richardson int 59499a2dd95SBruce Richardson rte_event_dev_socket_id(uint8_t dev_id); 59599a2dd95SBruce Richardson 59699a2dd95SBruce Richardson /** 59799a2dd95SBruce Richardson * Event device information 59899a2dd95SBruce Richardson */ 59999a2dd95SBruce Richardson struct rte_event_dev_info { 600da4b9651SBruce Richardson const char *driver_name; /**< Event driver name. */ 601da4b9651SBruce Richardson struct rte_device *dev; /**< Device information. */ 60299a2dd95SBruce Richardson uint32_t min_dequeue_timeout_ns; 603da4b9651SBruce Richardson /**< Minimum global dequeue timeout(ns) supported by this device. */ 60499a2dd95SBruce Richardson uint32_t max_dequeue_timeout_ns; 605da4b9651SBruce Richardson /**< Maximum global dequeue timeout(ns) supported by this device. */ 60699a2dd95SBruce Richardson uint32_t dequeue_timeout_ns; 607da4b9651SBruce Richardson /**< Configured global dequeue timeout(ns) for this device. */ 60899a2dd95SBruce Richardson uint8_t max_event_queues; 609da4b9651SBruce Richardson /**< Maximum event queues supported by this device. 610da4b9651SBruce Richardson * 611da4b9651SBruce Richardson * This count excludes any queues covered by @ref max_single_link_event_port_queue_pairs. 612da4b9651SBruce Richardson */ 61399a2dd95SBruce Richardson uint32_t max_event_queue_flows; 614da4b9651SBruce Richardson /**< Maximum number of flows within an event queue supported by this device. */ 61599a2dd95SBruce Richardson uint8_t max_event_queue_priority_levels; 616da4b9651SBruce Richardson /**< Maximum number of event queue priority levels supported by this device. 617da4b9651SBruce Richardson * 618da4b9651SBruce Richardson * Valid when the device has @ref RTE_EVENT_DEV_CAP_QUEUE_QOS capability. 619da4b9651SBruce Richardson * 620da4b9651SBruce Richardson * The implementation shall normalize priority values specified between 621da4b9651SBruce Richardson * @ref RTE_EVENT_DEV_PRIORITY_HIGHEST and @ref RTE_EVENT_DEV_PRIORITY_LOWEST 622da4b9651SBruce Richardson * to map them internally to this range of priorities. 623da4b9651SBruce Richardson * [For devices supporting a power-of-2 number of priority levels, this 624da4b9651SBruce Richardson * normalization will be done via a right-shift operation, so only the top 625da4b9651SBruce Richardson * log2(max_levels) bits will be used by the event device.] 626da4b9651SBruce Richardson * 627da4b9651SBruce Richardson * @see rte_event_queue_conf.priority 62899a2dd95SBruce Richardson */ 62999a2dd95SBruce Richardson uint8_t max_event_priority_levels; 63099a2dd95SBruce Richardson /**< Maximum number of event priority levels by this device. 631da4b9651SBruce Richardson * 632da4b9651SBruce Richardson * Valid when the device has @ref RTE_EVENT_DEV_CAP_EVENT_QOS capability. 633da4b9651SBruce Richardson * 634da4b9651SBruce Richardson * The implementation shall normalize priority values specified between 635da4b9651SBruce Richardson * @ref RTE_EVENT_DEV_PRIORITY_HIGHEST and @ref RTE_EVENT_DEV_PRIORITY_LOWEST 636da4b9651SBruce Richardson * to map them internally to this range of priorities. 637da4b9651SBruce Richardson * [For devices supporting a power-of-2 number of priority levels, this 638da4b9651SBruce Richardson * normalization will be done via a right-shift operation, so only the top 639da4b9651SBruce Richardson * log2(max_levels) bits will be used by the event device.] 640da4b9651SBruce Richardson * 641da4b9651SBruce Richardson * @see rte_event.priority 64299a2dd95SBruce Richardson */ 64399a2dd95SBruce Richardson uint8_t max_event_ports; 644da4b9651SBruce Richardson /**< Maximum number of event ports supported by this device. 645da4b9651SBruce Richardson * 646da4b9651SBruce Richardson * This count excludes any ports covered by @ref max_single_link_event_port_queue_pairs. 647da4b9651SBruce Richardson */ 64899a2dd95SBruce Richardson uint8_t max_event_port_dequeue_depth; 649da4b9651SBruce Richardson /**< Maximum number of events that can be dequeued at a time from an event port 650da4b9651SBruce Richardson * on this device. 651da4b9651SBruce Richardson * 652da4b9651SBruce Richardson * A device that does not support burst dequeue 653da4b9651SBruce Richardson * (@ref RTE_EVENT_DEV_CAP_BURST_MODE) will set this to 1. 65499a2dd95SBruce Richardson */ 65599a2dd95SBruce Richardson uint32_t max_event_port_enqueue_depth; 656da4b9651SBruce Richardson /**< Maximum number of events that can be enqueued at a time to an event port 657da4b9651SBruce Richardson * on this device. 658da4b9651SBruce Richardson * 659da4b9651SBruce Richardson * A device that does not support burst enqueue 660da4b9651SBruce Richardson * (@ref RTE_EVENT_DEV_CAP_BURST_MODE) will set this to 1. 66199a2dd95SBruce Richardson */ 66299a2dd95SBruce Richardson uint8_t max_event_port_links; 663da4b9651SBruce Richardson /**< Maximum number of queues that can be linked to a single event port on this device. 66499a2dd95SBruce Richardson */ 66599a2dd95SBruce Richardson int32_t max_num_events; 66699a2dd95SBruce Richardson /**< A *closed system* event dev has a limit on the number of events it 667da4b9651SBruce Richardson * can manage at a time. 668da4b9651SBruce Richardson * Once the number of events tracked by an eventdev exceeds this number, 669da4b9651SBruce Richardson * any enqueues of NEW events will fail. 670da4b9651SBruce Richardson * An *open system* event dev does not have a limit and will specify this as -1. 67199a2dd95SBruce Richardson */ 67299a2dd95SBruce Richardson uint32_t event_dev_cap; 673da4b9651SBruce Richardson /**< Event device capabilities flags (RTE_EVENT_DEV_CAP_*). */ 67499a2dd95SBruce Richardson uint8_t max_single_link_event_port_queue_pairs; 675da4b9651SBruce Richardson /**< Maximum number of event ports and queues, supported by this device, 676da4b9651SBruce Richardson * that are optimized for (and only capable of) single-link configurations. 677da4b9651SBruce Richardson * These ports and queues are not accounted for in @ref max_event_ports 678da4b9651SBruce Richardson * or @ref max_event_queues. 67999a2dd95SBruce Richardson */ 680d007a7f3SPavan Nikhilesh uint8_t max_profiles_per_port; 681da4b9651SBruce Richardson /**< Maximum number of event queue link profiles per event port. 682d007a7f3SPavan Nikhilesh * A device that doesn't support multiple profiles will set this as 1. 683d007a7f3SPavan Nikhilesh */ 68499a2dd95SBruce Richardson }; 68599a2dd95SBruce Richardson 68699a2dd95SBruce Richardson /** 687d77c9cbfSBruce Richardson * Retrieve details of an event device's capabilities and configuration limits. 68899a2dd95SBruce Richardson * 68999a2dd95SBruce Richardson * @param dev_id 69099a2dd95SBruce Richardson * The identifier of the device. 69199a2dd95SBruce Richardson * 69299a2dd95SBruce Richardson * @param[out] dev_info 69399a2dd95SBruce Richardson * A pointer to a structure of type *rte_event_dev_info* to be filled with the 694d77c9cbfSBruce Richardson * information about the device's capabilities. 69599a2dd95SBruce Richardson * 69699a2dd95SBruce Richardson * @return 697d77c9cbfSBruce Richardson * - 0: Success, information about the event device is present in dev_info. 698d77c9cbfSBruce Richardson * - <0: Failure, error code returned by the function. 699d77c9cbfSBruce Richardson * - -EINVAL - invalid input parameters, e.g. incorrect device id. 700d77c9cbfSBruce Richardson * - -ENOTSUP - device does not support returning capabilities information. 70199a2dd95SBruce Richardson */ 70299a2dd95SBruce Richardson int 70399a2dd95SBruce Richardson rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info); 70499a2dd95SBruce Richardson 70599a2dd95SBruce Richardson /** 70699a2dd95SBruce Richardson * The count of ports. 70799a2dd95SBruce Richardson */ 70899a2dd95SBruce Richardson #define RTE_EVENT_DEV_ATTR_PORT_COUNT 0 70999a2dd95SBruce Richardson /** 71099a2dd95SBruce Richardson * The count of queues. 71199a2dd95SBruce Richardson */ 71299a2dd95SBruce Richardson #define RTE_EVENT_DEV_ATTR_QUEUE_COUNT 1 71399a2dd95SBruce Richardson /** 71499a2dd95SBruce Richardson * The status of the device, zero for stopped, non-zero for started. 71599a2dd95SBruce Richardson */ 71699a2dd95SBruce Richardson #define RTE_EVENT_DEV_ATTR_STARTED 2 71799a2dd95SBruce Richardson 71899a2dd95SBruce Richardson /** 71999a2dd95SBruce Richardson * Get an attribute from a device. 72099a2dd95SBruce Richardson * 72199a2dd95SBruce Richardson * @param dev_id Eventdev id 72299a2dd95SBruce Richardson * @param attr_id The attribute ID to retrieve 72399a2dd95SBruce Richardson * @param[out] attr_value A pointer that will be filled in with the attribute 72499a2dd95SBruce Richardson * value if successful. 72599a2dd95SBruce Richardson * 72699a2dd95SBruce Richardson * @return 72799a2dd95SBruce Richardson * - 0: Successfully retrieved attribute value 72899a2dd95SBruce Richardson * - -EINVAL: Invalid device or *attr_id* provided, or *attr_value* is NULL 72999a2dd95SBruce Richardson */ 73099a2dd95SBruce Richardson int 73199a2dd95SBruce Richardson rte_event_dev_attr_get(uint8_t dev_id, uint32_t attr_id, 73299a2dd95SBruce Richardson uint32_t *attr_value); 73399a2dd95SBruce Richardson 73499a2dd95SBruce Richardson 73599a2dd95SBruce Richardson /* Event device configuration bitmap flags */ 73699a2dd95SBruce Richardson #define RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT (1ULL << 0) 73799a2dd95SBruce Richardson /**< Override the global *dequeue_timeout_ns* and use per dequeue timeout in ns. 73899a2dd95SBruce Richardson * @see rte_event_dequeue_timeout_ticks(), rte_event_dequeue_burst() 73999a2dd95SBruce Richardson */ 74099a2dd95SBruce Richardson 741acc65ee3SPavan Nikhilesh /** Event device pre-schedule type enumeration. */ 742acc65ee3SPavan Nikhilesh enum rte_event_dev_preschedule_type { 743acc65ee3SPavan Nikhilesh RTE_EVENT_PRESCHEDULE_NONE, 744acc65ee3SPavan Nikhilesh /**< Disable pre-schedule across the event device or on a given event port. 745acc65ee3SPavan Nikhilesh * @ref rte_event_dev_config.preschedule_type 746c1bdd86dSPavan Nikhilesh * @ref rte_event_port_preschedule_modify() 747acc65ee3SPavan Nikhilesh */ 748acc65ee3SPavan Nikhilesh RTE_EVENT_PRESCHEDULE, 749acc65ee3SPavan Nikhilesh /**< Enable pre-schedule always across the event device or a given event port. 750acc65ee3SPavan Nikhilesh * @ref rte_event_dev_config.preschedule_type 751c1bdd86dSPavan Nikhilesh * @ref rte_event_port_preschedule_modify() 752acc65ee3SPavan Nikhilesh * @see RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE 753c1bdd86dSPavan Nikhilesh * @see RTE_EVENT_DEV_CAP_PER_PORT_PRESCHEDULE 754acc65ee3SPavan Nikhilesh */ 755acc65ee3SPavan Nikhilesh RTE_EVENT_PRESCHEDULE_ADAPTIVE, 756acc65ee3SPavan Nikhilesh /**< Enable adaptive pre-schedule across the event device or a given event port. 757acc65ee3SPavan Nikhilesh * Delay issuing pre-schedule until there are no forward progress constraints with 758acc65ee3SPavan Nikhilesh * the held flow contexts. 759acc65ee3SPavan Nikhilesh * @ref rte_event_dev_config.preschedule_type 760c1bdd86dSPavan Nikhilesh * @ref rte_event_port_preschedule_modify() 761acc65ee3SPavan Nikhilesh * @see RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE_ADAPTIVE 762c1bdd86dSPavan Nikhilesh * @see RTE_EVENT_DEV_CAP_PER_PORT_PRESCHEDULE 763acc65ee3SPavan Nikhilesh */ 764acc65ee3SPavan Nikhilesh }; 765acc65ee3SPavan Nikhilesh 76699a2dd95SBruce Richardson /** Event device configuration structure */ 76799a2dd95SBruce Richardson struct rte_event_dev_config { 76899a2dd95SBruce Richardson uint32_t dequeue_timeout_ns; 76999a2dd95SBruce Richardson /**< rte_event_dequeue_burst() timeout on this device. 7701203462cSBruce Richardson * This value should be in the range of @ref rte_event_dev_info.min_dequeue_timeout_ns and 7711203462cSBruce Richardson * @ref rte_event_dev_info.max_dequeue_timeout_ns returned by 7721203462cSBruce Richardson * @ref rte_event_dev_info_get() 77399a2dd95SBruce Richardson * The value 0 is allowed, in which case, default dequeue timeout used. 77499a2dd95SBruce Richardson * @see RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT 77599a2dd95SBruce Richardson */ 77699a2dd95SBruce Richardson int32_t nb_events_limit; 77799a2dd95SBruce Richardson /**< In a *closed system* this field is the limit on maximum number of 77899a2dd95SBruce Richardson * events that can be inflight in the eventdev at a given time. The 77999a2dd95SBruce Richardson * limit is required to ensure that the finite space in a closed system 7801203462cSBruce Richardson * is not exhausted. 7811203462cSBruce Richardson * The value cannot exceed @ref rte_event_dev_info.max_num_events 7821203462cSBruce Richardson * returned by rte_event_dev_info_get(). 7831203462cSBruce Richardson * 7841203462cSBruce Richardson * This value should be set to -1 for *open systems*, that is, 7851203462cSBruce Richardson * those systems returning -1 in @ref rte_event_dev_info.max_num_events. 7861203462cSBruce Richardson * 7871203462cSBruce Richardson * @see rte_event_port_conf.new_event_threshold 78899a2dd95SBruce Richardson */ 78999a2dd95SBruce Richardson uint8_t nb_event_queues; 79099a2dd95SBruce Richardson /**< Number of event queues to configure on this device. 7911203462cSBruce Richardson * This value *includes* any single-link queue-port pairs to be used. 7921203462cSBruce Richardson * This value cannot exceed @ref rte_event_dev_info.max_event_queues + 7931203462cSBruce Richardson * @ref rte_event_dev_info.max_single_link_event_port_queue_pairs 7941203462cSBruce Richardson * returned by rte_event_dev_info_get(). 7951203462cSBruce Richardson * The number of non-single-link queues i.e. this value less 7961203462cSBruce Richardson * *nb_single_link_event_port_queues* in this struct, cannot exceed 7971203462cSBruce Richardson * @ref rte_event_dev_info.max_event_queues 79899a2dd95SBruce Richardson */ 79999a2dd95SBruce Richardson uint8_t nb_event_ports; 80099a2dd95SBruce Richardson /**< Number of event ports to configure on this device. 8011203462cSBruce Richardson * This value *includes* any single-link queue-port pairs to be used. 8021203462cSBruce Richardson * This value cannot exceed @ref rte_event_dev_info.max_event_ports + 8031203462cSBruce Richardson * @ref rte_event_dev_info.max_single_link_event_port_queue_pairs 8041203462cSBruce Richardson * returned by rte_event_dev_info_get(). 8051203462cSBruce Richardson * The number of non-single-link ports i.e. this value less 8061203462cSBruce Richardson * *nb_single_link_event_port_queues* in this struct, cannot exceed 8071203462cSBruce Richardson * @ref rte_event_dev_info.max_event_ports 80899a2dd95SBruce Richardson */ 80999a2dd95SBruce Richardson uint32_t nb_event_queue_flows; 8101203462cSBruce Richardson /**< Max number of flows needed for a single event queue on this device. 8111203462cSBruce Richardson * This value cannot exceed @ref rte_event_dev_info.max_event_queue_flows 8121203462cSBruce Richardson * returned by rte_event_dev_info_get() 81399a2dd95SBruce Richardson */ 81499a2dd95SBruce Richardson uint32_t nb_event_port_dequeue_depth; 8151203462cSBruce Richardson /**< Max number of events that can be dequeued at a time from an event port on this device. 8161203462cSBruce Richardson * This value cannot exceed @ref rte_event_dev_info.max_event_port_dequeue_depth 8171203462cSBruce Richardson * returned by rte_event_dev_info_get(). 81899a2dd95SBruce Richardson * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable. 8191203462cSBruce Richardson * @see rte_event_port_setup() rte_event_dequeue_burst() 82099a2dd95SBruce Richardson */ 82199a2dd95SBruce Richardson uint32_t nb_event_port_enqueue_depth; 8221203462cSBruce Richardson /**< Maximum number of events can be enqueued at a time to an event port on this device. 8231203462cSBruce Richardson * This value cannot exceed @ref rte_event_dev_info.max_event_port_enqueue_depth 8241203462cSBruce Richardson * returned by rte_event_dev_info_get(). 82599a2dd95SBruce Richardson * Ignored when device is not RTE_EVENT_DEV_CAP_BURST_MODE capable. 8261203462cSBruce Richardson * @see rte_event_port_setup() rte_event_enqueue_burst() 82799a2dd95SBruce Richardson */ 82899a2dd95SBruce Richardson uint32_t event_dev_cfg; 82999a2dd95SBruce Richardson /**< Event device config flags(RTE_EVENT_DEV_CFG_)*/ 83099a2dd95SBruce Richardson uint8_t nb_single_link_event_port_queues; 83199a2dd95SBruce Richardson /**< Number of event ports and queues that will be singly-linked to 83299a2dd95SBruce Richardson * each other. These are a subset of the overall event ports and 83399a2dd95SBruce Richardson * queues; this value cannot exceed *nb_event_ports* or 83499a2dd95SBruce Richardson * *nb_event_queues*. If the device has ports and queues that are 83599a2dd95SBruce Richardson * optimized for single-link usage, this field is a hint for how many 8361203462cSBruce Richardson * to allocate; otherwise, regular event ports and queues will be used. 83799a2dd95SBruce Richardson */ 838acc65ee3SPavan Nikhilesh enum rte_event_dev_preschedule_type preschedule_type; 839acc65ee3SPavan Nikhilesh /**< Event pre-schedule type to use across the event device, if supported. 840acc65ee3SPavan Nikhilesh * @see RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE 841acc65ee3SPavan Nikhilesh * @see RTE_EVENT_DEV_CAP_EVENT_PRESCHEDULE_ADAPTIVE 842acc65ee3SPavan Nikhilesh */ 84399a2dd95SBruce Richardson }; 84499a2dd95SBruce Richardson 84599a2dd95SBruce Richardson /** 84699a2dd95SBruce Richardson * Configure an event device. 84799a2dd95SBruce Richardson * 848e48762b3SBruce Richardson * This function must be invoked before any other configuration function in the 849e48762b3SBruce Richardson * API, when preparing an event device for application use. 850e48762b3SBruce Richardson * This function can also be re-invoked when a device is in the stopped state. 85199a2dd95SBruce Richardson * 852e48762b3SBruce Richardson * The caller should use rte_event_dev_info_get() to get the capabilities and 853e48762b3SBruce Richardson * resource limits for this event device before calling this API. 854e48762b3SBruce Richardson * Many values in the dev_conf input parameter are subject to limits given 855e48762b3SBruce Richardson * in the device information returned from rte_event_dev_info_get(). 85699a2dd95SBruce Richardson * 85799a2dd95SBruce Richardson * @param dev_id 85899a2dd95SBruce Richardson * The identifier of the device to configure. 85999a2dd95SBruce Richardson * @param dev_conf 86099a2dd95SBruce Richardson * The event device configuration structure. 86199a2dd95SBruce Richardson * 86299a2dd95SBruce Richardson * @return 86399a2dd95SBruce Richardson * - 0: Success, device configured. 86499a2dd95SBruce Richardson * - <0: Error code returned by the driver configuration function. 865e48762b3SBruce Richardson * - -ENOTSUP - device does not support configuration. 866e48762b3SBruce Richardson * - -EINVAL - invalid input parameter. 867e48762b3SBruce Richardson * - -EBUSY - device has already been started. 86899a2dd95SBruce Richardson */ 86999a2dd95SBruce Richardson int 87099a2dd95SBruce Richardson rte_event_dev_configure(uint8_t dev_id, 87199a2dd95SBruce Richardson const struct rte_event_dev_config *dev_conf); 87299a2dd95SBruce Richardson 87399a2dd95SBruce Richardson /* Event queue specific APIs */ 87499a2dd95SBruce Richardson 87599a2dd95SBruce Richardson /* Event queue configuration bitmap flags */ 87699a2dd95SBruce Richardson #define RTE_EVENT_QUEUE_CFG_ALL_TYPES (1ULL << 0) 877e48762b3SBruce Richardson /**< Allow events with schedule types ATOMIC, ORDERED, and PARALLEL to be enqueued to this queue. 87899a2dd95SBruce Richardson * 879e48762b3SBruce Richardson * The scheduling type to be used is that specified in each individual event. 880e48762b3SBruce Richardson * This flag can only be set when configuring queues on devices reporting the 881e48762b3SBruce Richardson * @ref RTE_EVENT_DEV_CAP_QUEUE_ALL_TYPES capability. 882e48762b3SBruce Richardson * 883e48762b3SBruce Richardson * Without this flag, only events with the specific scheduling type configured at queue setup 884e48762b3SBruce Richardson * can be sent to the queue. 885e48762b3SBruce Richardson * 886e48762b3SBruce Richardson * @see RTE_EVENT_DEV_CAP_QUEUE_ALL_TYPES 88799a2dd95SBruce Richardson * @see RTE_SCHED_TYPE_ORDERED, RTE_SCHED_TYPE_ATOMIC, RTE_SCHED_TYPE_PARALLEL 88899a2dd95SBruce Richardson * @see rte_event_enqueue_burst() 88999a2dd95SBruce Richardson */ 89099a2dd95SBruce Richardson #define RTE_EVENT_QUEUE_CFG_SINGLE_LINK (1ULL << 1) 89199a2dd95SBruce Richardson /**< This event queue links only to a single event port. 89299a2dd95SBruce Richardson * 893e48762b3SBruce Richardson * No load-balancing of events is performed, as all events 894e48762b3SBruce Richardson * sent to this queue end up at the same event port. 895e48762b3SBruce Richardson * The number of queues on which this flag is to be set must be 896e48762b3SBruce Richardson * configured at device configuration time, by setting 897e48762b3SBruce Richardson * @ref rte_event_dev_config.nb_single_link_event_port_queues 898e48762b3SBruce Richardson * parameter appropriately. 899e48762b3SBruce Richardson * 900e48762b3SBruce Richardson * This flag serves as a hint only, any devices without specific 901e48762b3SBruce Richardson * support for single-link queues can fall-back automatically to 902e48762b3SBruce Richardson * using regular queues with a single destination port. 903e48762b3SBruce Richardson * 904e48762b3SBruce Richardson * @see rte_event_dev_info.max_single_link_event_port_queue_pairs 905e48762b3SBruce Richardson * @see rte_event_dev_config.nb_single_link_event_port_queues 90699a2dd95SBruce Richardson * @see rte_event_port_setup(), rte_event_port_link() 90799a2dd95SBruce Richardson */ 90899a2dd95SBruce Richardson 90999a2dd95SBruce Richardson /** Event queue configuration structure */ 91099a2dd95SBruce Richardson struct rte_event_queue_conf { 91199a2dd95SBruce Richardson uint32_t nb_atomic_flows; 91299a2dd95SBruce Richardson /**< The maximum number of active flows this queue can track at any 913e48762b3SBruce Richardson * given time. 914e48762b3SBruce Richardson * 915e48762b3SBruce Richardson * If the queue is configured for atomic scheduling (by 916e48762b3SBruce Richardson * applying the @ref RTE_EVENT_QUEUE_CFG_ALL_TYPES flag to 917e48762b3SBruce Richardson * @ref rte_event_queue_conf.event_queue_cfg 918e48762b3SBruce Richardson * or @ref RTE_SCHED_TYPE_ATOMIC flag to @ref rte_event_queue_conf.schedule_type), then the 919e48762b3SBruce Richardson * value must be in the range of [1, @ref rte_event_dev_config.nb_event_queue_flows], 920e48762b3SBruce Richardson * which was previously provided in rte_event_dev_configure(). 921e48762b3SBruce Richardson * 922e48762b3SBruce Richardson * If the queue is not configured for atomic scheduling this value is ignored. 92399a2dd95SBruce Richardson */ 92499a2dd95SBruce Richardson uint32_t nb_atomic_order_sequences; 92599a2dd95SBruce Richardson /**< The maximum number of outstanding events waiting to be 92699a2dd95SBruce Richardson * reordered by this queue. In other words, the number of entries in 92799a2dd95SBruce Richardson * this queue’s reorder buffer. When the number of events in the 92899a2dd95SBruce Richardson * reorder buffer reaches to *nb_atomic_order_sequences* then the 929e48762b3SBruce Richardson * scheduler cannot schedule the events from this queue and no 930e48762b3SBruce Richardson * events will be returned from dequeue until one or more entries are 93199a2dd95SBruce Richardson * freed up/released. 932e48762b3SBruce Richardson * 93399a2dd95SBruce Richardson * If the queue is configured for ordered scheduling (by applying the 934e48762b3SBruce Richardson * @ref RTE_EVENT_QUEUE_CFG_ALL_TYPES flag to @ref rte_event_queue_conf.event_queue_cfg or 935e48762b3SBruce Richardson * @ref RTE_SCHED_TYPE_ORDERED flag to @ref rte_event_queue_conf.schedule_type), 936e48762b3SBruce Richardson * then the value must be in the range of 937e48762b3SBruce Richardson * [1, @ref rte_event_dev_config.nb_event_queue_flows], which was 93899a2dd95SBruce Richardson * previously supplied to rte_event_dev_configure(). 939e48762b3SBruce Richardson * 940e48762b3SBruce Richardson * If the queue is not configured for ordered scheduling, then this value is ignored. 94199a2dd95SBruce Richardson */ 94299a2dd95SBruce Richardson uint32_t event_queue_cfg; 94399a2dd95SBruce Richardson /**< Queue cfg flags(EVENT_QUEUE_CFG_) */ 94499a2dd95SBruce Richardson uint8_t schedule_type; 94599a2dd95SBruce Richardson /**< Queue schedule type(RTE_SCHED_TYPE_*). 946e48762b3SBruce Richardson * 947e48762b3SBruce Richardson * Valid when @ref RTE_EVENT_QUEUE_CFG_ALL_TYPES flag is not set in 948e48762b3SBruce Richardson * @ref rte_event_queue_conf.event_queue_cfg. 949e48762b3SBruce Richardson * 950e48762b3SBruce Richardson * If the @ref RTE_EVENT_QUEUE_CFG_ALL_TYPES flag is set, then this field is ignored. 951e48762b3SBruce Richardson * 952e48762b3SBruce Richardson * @see RTE_SCHED_TYPE_ORDERED, RTE_SCHED_TYPE_ATOMIC, RTE_SCHED_TYPE_PARALLEL 95399a2dd95SBruce Richardson */ 95499a2dd95SBruce Richardson uint8_t priority; 95599a2dd95SBruce Richardson /**< Priority for this event queue relative to other event queues. 956e48762b3SBruce Richardson * 95799a2dd95SBruce Richardson * The requested priority should in the range of 958e48762b3SBruce Richardson * [@ref RTE_EVENT_DEV_PRIORITY_HIGHEST, @ref RTE_EVENT_DEV_PRIORITY_LOWEST]. 95999a2dd95SBruce Richardson * The implementation shall normalize the requested priority to 96099a2dd95SBruce Richardson * event device supported priority value. 961e48762b3SBruce Richardson * 962e48762b3SBruce Richardson * Valid when the device has @ref RTE_EVENT_DEV_CAP_QUEUE_QOS capability, 963e48762b3SBruce Richardson * ignored otherwise 96499a2dd95SBruce Richardson */ 9652f279a1bSShijith Thotton uint8_t weight; 9662f279a1bSShijith Thotton /**< Weight of the event queue relative to other event queues. 967e48762b3SBruce Richardson * 9682f279a1bSShijith Thotton * The requested weight should be in the range of 969e48762b3SBruce Richardson * [@ref RTE_EVENT_QUEUE_WEIGHT_HIGHEST, @ref RTE_EVENT_QUEUE_WEIGHT_LOWEST]. 9702f279a1bSShijith Thotton * The implementation shall normalize the requested weight to event 9712f279a1bSShijith Thotton * device supported weight value. 972e48762b3SBruce Richardson * 973e48762b3SBruce Richardson * Valid when the device has @ref RTE_EVENT_DEV_CAP_QUEUE_QOS capability, 974e48762b3SBruce Richardson * ignored otherwise. 9752f279a1bSShijith Thotton */ 9762f279a1bSShijith Thotton uint8_t affinity; 9772f279a1bSShijith Thotton /**< Affinity of the event queue relative to other event queues. 978e48762b3SBruce Richardson * 9792f279a1bSShijith Thotton * The requested affinity should be in the range of 980e48762b3SBruce Richardson * [@ref RTE_EVENT_QUEUE_AFFINITY_HIGHEST, @ref RTE_EVENT_QUEUE_AFFINITY_LOWEST]. 9812f279a1bSShijith Thotton * The implementation shall normalize the requested affinity to event 9822f279a1bSShijith Thotton * device supported affinity value. 983e48762b3SBruce Richardson * 984e48762b3SBruce Richardson * Valid when the device has @ref RTE_EVENT_DEV_CAP_QUEUE_QOS capability, 985e48762b3SBruce Richardson * ignored otherwise. 9862f279a1bSShijith Thotton */ 98799a2dd95SBruce Richardson }; 98899a2dd95SBruce Richardson 98999a2dd95SBruce Richardson /** 99099a2dd95SBruce Richardson * Retrieve the default configuration information of an event queue designated 99199a2dd95SBruce Richardson * by its *queue_id* from the event driver for an event device. 99299a2dd95SBruce Richardson * 99399a2dd95SBruce Richardson * This function intended to be used in conjunction with rte_event_queue_setup() 99499a2dd95SBruce Richardson * where caller needs to set up the queue by overriding few default values. 99599a2dd95SBruce Richardson * 99699a2dd95SBruce Richardson * @param dev_id 99799a2dd95SBruce Richardson * The identifier of the device. 99899a2dd95SBruce Richardson * @param queue_id 99999a2dd95SBruce Richardson * The index of the event queue to get the configuration information. 1000e48762b3SBruce Richardson * The value must be less than @ref rte_event_dev_config.nb_event_queues 100199a2dd95SBruce Richardson * previously supplied to rte_event_dev_configure(). 100299a2dd95SBruce Richardson * @param[out] queue_conf 100399a2dd95SBruce Richardson * The pointer to the default event queue configuration data. 100499a2dd95SBruce Richardson * @return 100599a2dd95SBruce Richardson * - 0: Success, driver updates the default event queue configuration data. 100699a2dd95SBruce Richardson * - <0: Error code returned by the driver info get function. 100799a2dd95SBruce Richardson * 100899a2dd95SBruce Richardson * @see rte_event_queue_setup() 100999a2dd95SBruce Richardson */ 101099a2dd95SBruce Richardson int 101199a2dd95SBruce Richardson rte_event_queue_default_conf_get(uint8_t dev_id, uint8_t queue_id, 101299a2dd95SBruce Richardson struct rte_event_queue_conf *queue_conf); 101399a2dd95SBruce Richardson 101499a2dd95SBruce Richardson /** 101599a2dd95SBruce Richardson * Allocate and set up an event queue for an event device. 101699a2dd95SBruce Richardson * 101799a2dd95SBruce Richardson * @param dev_id 101899a2dd95SBruce Richardson * The identifier of the device. 101999a2dd95SBruce Richardson * @param queue_id 1020e48762b3SBruce Richardson * The index of the event queue to setup. The value must be 1021e48762b3SBruce Richardson * less than @ref rte_event_dev_config.nb_event_queues previously supplied to 1022e48762b3SBruce Richardson * rte_event_dev_configure(). 102399a2dd95SBruce Richardson * @param queue_conf 102499a2dd95SBruce Richardson * The pointer to the configuration data to be used for the event queue. 102599a2dd95SBruce Richardson * NULL value is allowed, in which case default configuration used. 102699a2dd95SBruce Richardson * 102799a2dd95SBruce Richardson * @see rte_event_queue_default_conf_get() 102899a2dd95SBruce Richardson * 102999a2dd95SBruce Richardson * @return 103099a2dd95SBruce Richardson * - 0: Success, event queue correctly set up. 1031e48762b3SBruce Richardson * - <0: event queue configuration failed. 103299a2dd95SBruce Richardson */ 103399a2dd95SBruce Richardson int 103499a2dd95SBruce Richardson rte_event_queue_setup(uint8_t dev_id, uint8_t queue_id, 103599a2dd95SBruce Richardson const struct rte_event_queue_conf *queue_conf); 103699a2dd95SBruce Richardson 103799a2dd95SBruce Richardson /** 1038e48762b3SBruce Richardson * Queue attribute id for the priority of the queue. 103999a2dd95SBruce Richardson */ 104099a2dd95SBruce Richardson #define RTE_EVENT_QUEUE_ATTR_PRIORITY 0 104199a2dd95SBruce Richardson /** 1042e48762b3SBruce Richardson * Queue attribute id for the number of atomic flows configured for the queue. 104399a2dd95SBruce Richardson */ 104499a2dd95SBruce Richardson #define RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_FLOWS 1 104599a2dd95SBruce Richardson /** 1046e48762b3SBruce Richardson * Queue attribute id for the number of atomic order sequences configured for the queue. 104799a2dd95SBruce Richardson */ 104899a2dd95SBruce Richardson #define RTE_EVENT_QUEUE_ATTR_NB_ATOMIC_ORDER_SEQUENCES 2 104999a2dd95SBruce Richardson /** 1050e48762b3SBruce Richardson * Queue attribute id for the configuration flags for the queue. 105199a2dd95SBruce Richardson */ 105299a2dd95SBruce Richardson #define RTE_EVENT_QUEUE_ATTR_EVENT_QUEUE_CFG 3 105399a2dd95SBruce Richardson /** 1054e48762b3SBruce Richardson * Queue attribute id for the schedule type of the queue. 105599a2dd95SBruce Richardson */ 105699a2dd95SBruce Richardson #define RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE 4 105744516e6bSShijith Thotton /** 1058e48762b3SBruce Richardson * Queue attribute id for the weight of the queue. 105944516e6bSShijith Thotton */ 106044516e6bSShijith Thotton #define RTE_EVENT_QUEUE_ATTR_WEIGHT 5 106144516e6bSShijith Thotton /** 1062e48762b3SBruce Richardson * Queue attribute id for the affinity of the queue. 106344516e6bSShijith Thotton */ 106444516e6bSShijith Thotton #define RTE_EVENT_QUEUE_ATTR_AFFINITY 6 106599a2dd95SBruce Richardson 106699a2dd95SBruce Richardson /** 1067e48762b3SBruce Richardson * Get an attribute of an event queue. 106899a2dd95SBruce Richardson * 106999a2dd95SBruce Richardson * @param dev_id 1070e48762b3SBruce Richardson * The identifier of the device. 107199a2dd95SBruce Richardson * @param queue_id 1072e48762b3SBruce Richardson * The index of the event queue to query. The value must be less than 1073e48762b3SBruce Richardson * @ref rte_event_dev_config.nb_event_queues previously supplied to rte_event_dev_configure(). 107499a2dd95SBruce Richardson * @param attr_id 1075e48762b3SBruce Richardson * The attribute ID to retrieve (RTE_EVENT_QUEUE_ATTR_*). 107699a2dd95SBruce Richardson * @param[out] attr_value 1077e48762b3SBruce Richardson * A pointer that will be filled in with the attribute value if successful. 107899a2dd95SBruce Richardson * 107999a2dd95SBruce Richardson * @return 108099a2dd95SBruce Richardson * - 0: Successfully returned value 1081e48762b3SBruce Richardson * - -EINVAL: invalid device, queue or attr_id provided, or attr_value was NULL. 108299a2dd95SBruce Richardson * - -EOVERFLOW: returned when attr_id is set to 1083e48762b3SBruce Richardson * @ref RTE_EVENT_QUEUE_ATTR_SCHEDULE_TYPE and @ref RTE_EVENT_QUEUE_CFG_ALL_TYPES is 1084e48762b3SBruce Richardson * set in the queue configuration flags. 108599a2dd95SBruce Richardson */ 108699a2dd95SBruce Richardson int 108799a2dd95SBruce Richardson rte_event_queue_attr_get(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id, 108899a2dd95SBruce Richardson uint32_t *attr_value); 108999a2dd95SBruce Richardson 109097b914f4SShijith Thotton /** 109197b914f4SShijith Thotton * Set an event queue attribute. 109297b914f4SShijith Thotton * 109397b914f4SShijith Thotton * @param dev_id 1094e48762b3SBruce Richardson * The identifier of the device. 109597b914f4SShijith Thotton * @param queue_id 1096e48762b3SBruce Richardson * The index of the event queue to configure. The value must be less than 1097e48762b3SBruce Richardson * @ref rte_event_dev_config.nb_event_queues previously supplied to rte_event_dev_configure(). 109897b914f4SShijith Thotton * @param attr_id 1099e48762b3SBruce Richardson * The attribute ID to set (RTE_EVENT_QUEUE_ATTR_*). 110097b914f4SShijith Thotton * @param attr_value 1101e48762b3SBruce Richardson * The attribute value to set. 110297b914f4SShijith Thotton * 110397b914f4SShijith Thotton * @return 110497b914f4SShijith Thotton * - 0: Successfully set attribute. 1105e48762b3SBruce Richardson * - <0: failed to set event queue attribute. 110697b914f4SShijith Thotton * - -EINVAL: invalid device, queue or attr_id. 110797b914f4SShijith Thotton * - -ENOTSUP: device does not support setting the event attribute. 110897b914f4SShijith Thotton */ 110997b914f4SShijith Thotton int 111097b914f4SShijith Thotton rte_event_queue_attr_set(uint8_t dev_id, uint8_t queue_id, uint32_t attr_id, 111197b914f4SShijith Thotton uint64_t attr_value); 111297b914f4SShijith Thotton 111399a2dd95SBruce Richardson /* Event port specific APIs */ 111499a2dd95SBruce Richardson 111599a2dd95SBruce Richardson /* Event port configuration bitmap flags */ 111699a2dd95SBruce Richardson #define RTE_EVENT_PORT_CFG_DISABLE_IMPL_REL (1ULL << 0) 111799a2dd95SBruce Richardson /**< Configure the port not to release outstanding events in 111899a2dd95SBruce Richardson * rte_event_dev_dequeue_burst(). If set, all events received through 111999a2dd95SBruce Richardson * the port must be explicitly released with RTE_EVENT_OP_RELEASE or 112099a2dd95SBruce Richardson * RTE_EVENT_OP_FORWARD. Must be unset if the device is not 112199a2dd95SBruce Richardson * RTE_EVENT_DEV_CAP_IMPLICIT_RELEASE_DISABLE capable. 112299a2dd95SBruce Richardson */ 112399a2dd95SBruce Richardson #define RTE_EVENT_PORT_CFG_SINGLE_LINK (1ULL << 1) 112499a2dd95SBruce Richardson /**< This event port links only to a single event queue. 1125e48762b3SBruce Richardson * The queue it links with should be similarly configured with the 1126e48762b3SBruce Richardson * @ref RTE_EVENT_QUEUE_CFG_SINGLE_LINK flag. 112799a2dd95SBruce Richardson * 1128e48762b3SBruce Richardson * @see RTE_EVENT_QUEUE_CFG_SINGLE_LINK 112999a2dd95SBruce Richardson * @see rte_event_port_setup(), rte_event_port_link() 113099a2dd95SBruce Richardson */ 113197632958SHarry van Haaren #define RTE_EVENT_PORT_CFG_HINT_PRODUCER (1ULL << 2) 113297632958SHarry van Haaren /**< Hint that this event port will primarily enqueue events to the system. 113397632958SHarry van Haaren * A PMD can optimize its internal workings by assuming that this port is 113497632958SHarry van Haaren * primarily going to enqueue NEW events. 113597632958SHarry van Haaren * 113697632958SHarry van Haaren * Note that this flag is only a hint, so PMDs must operate under the 113797632958SHarry van Haaren * assumption that any port can enqueue an event with any type of op. 113897632958SHarry van Haaren * 113997632958SHarry van Haaren * @see rte_event_port_setup() 114097632958SHarry van Haaren */ 114197632958SHarry van Haaren #define RTE_EVENT_PORT_CFG_HINT_CONSUMER (1ULL << 3) 114297632958SHarry van Haaren /**< Hint that this event port will primarily dequeue events from the system. 114397632958SHarry van Haaren * A PMD can optimize its internal workings by assuming that this port is 1144e48762b3SBruce Richardson * primarily going to consume events, and not enqueue NEW or FORWARD 114597632958SHarry van Haaren * events. 114697632958SHarry van Haaren * 114797632958SHarry van Haaren * Note that this flag is only a hint, so PMDs must operate under the 114897632958SHarry van Haaren * assumption that any port can enqueue an event with any type of op. 114997632958SHarry van Haaren * 115097632958SHarry van Haaren * @see rte_event_port_setup() 115197632958SHarry van Haaren */ 115297632958SHarry van Haaren #define RTE_EVENT_PORT_CFG_HINT_WORKER (1ULL << 4) 115397632958SHarry van Haaren /**< Hint that this event port will primarily pass existing events through. 115497632958SHarry van Haaren * A PMD can optimize its internal workings by assuming that this port is 115597632958SHarry van Haaren * primarily going to FORWARD events, and not enqueue NEW or RELEASE events 115697632958SHarry van Haaren * often. 115797632958SHarry van Haaren * 115897632958SHarry van Haaren * Note that this flag is only a hint, so PMDs must operate under the 115997632958SHarry van Haaren * assumption that any port can enqueue an event with any type of op. 116097632958SHarry van Haaren * 116197632958SHarry van Haaren * @see rte_event_port_setup() 116297632958SHarry van Haaren */ 116379ca24a4SAbdullah Sevincer #define RTE_EVENT_PORT_CFG_INDEPENDENT_ENQ (1ULL << 5) 116479ca24a4SAbdullah Sevincer /**< Flag to enable independent enqueue. Must not be set if the device 116579ca24a4SAbdullah Sevincer * is not RTE_EVENT_DEV_CAP_INDEPENDENT_ENQ capable. This feature 116679ca24a4SAbdullah Sevincer * allows an application to enqueue RTE_EVENT_OP_FORWARD or 116779ca24a4SAbdullah Sevincer * RTE_EVENT_OP_RELEASE in an order different than the order the 116879ca24a4SAbdullah Sevincer * events were dequeued from the event device, while maintaining 116979ca24a4SAbdullah Sevincer * RTE_SCHED_TYPE_ATOMIC or RTE_SCHED_TYPE_ORDERED semantics. 117079ca24a4SAbdullah Sevincer * 117179ca24a4SAbdullah Sevincer * Note that this flag only matters for Eventdevs supporting burst mode. 117279ca24a4SAbdullah Sevincer * 117379ca24a4SAbdullah Sevincer * @see rte_event_port_setup() 117479ca24a4SAbdullah Sevincer */ 117599a2dd95SBruce Richardson 117699a2dd95SBruce Richardson /** Event port configuration structure */ 117799a2dd95SBruce Richardson struct rte_event_port_conf { 117899a2dd95SBruce Richardson int32_t new_event_threshold; 117999a2dd95SBruce Richardson /**< A backpressure threshold for new event enqueues on this port. 118099a2dd95SBruce Richardson * Use for *closed system* event dev where event capacity is limited, 118199a2dd95SBruce Richardson * and cannot exceed the capacity of the event dev. 1182e48762b3SBruce Richardson * 118399a2dd95SBruce Richardson * Configuring ports with different thresholds can make higher priority 118499a2dd95SBruce Richardson * traffic less likely to be backpressured. 118599a2dd95SBruce Richardson * For example, a port used to inject NIC Rx packets into the event dev 118699a2dd95SBruce Richardson * can have a lower threshold so as not to overwhelm the device, 118799a2dd95SBruce Richardson * while ports used for worker pools can have a higher threshold. 1188e48762b3SBruce Richardson * This value cannot exceed the @ref rte_event_dev_config.nb_events_limit value 118999a2dd95SBruce Richardson * which was previously supplied to rte_event_dev_configure(). 1190e48762b3SBruce Richardson * 1191e48762b3SBruce Richardson * This should be set to '-1' for *open system*, i.e when 1192e48762b3SBruce Richardson * @ref rte_event_dev_info.max_num_events == -1. 119399a2dd95SBruce Richardson */ 119499a2dd95SBruce Richardson uint16_t dequeue_depth; 1195e48762b3SBruce Richardson /**< Configure the maximum size of burst dequeues for this event port. 1196e48762b3SBruce Richardson * This value cannot exceed the @ref rte_event_dev_config.nb_event_port_dequeue_depth value 1197e48762b3SBruce Richardson * which was previously supplied to rte_event_dev_configure(). 1198e48762b3SBruce Richardson * 1199e48762b3SBruce Richardson * Ignored when device does not support the @ref RTE_EVENT_DEV_CAP_BURST_MODE capability. 120099a2dd95SBruce Richardson */ 120199a2dd95SBruce Richardson uint16_t enqueue_depth; 1202e48762b3SBruce Richardson /**< Configure the maximum size of burst enqueues to this event port. 1203e48762b3SBruce Richardson * This value cannot exceed the @ref rte_event_dev_config.nb_event_port_enqueue_depth value 1204e48762b3SBruce Richardson * which was previously supplied to rte_event_dev_configure(). 1205e48762b3SBruce Richardson * 1206e48762b3SBruce Richardson * Ignored when device does not support the @ref RTE_EVENT_DEV_CAP_BURST_MODE capability. 120799a2dd95SBruce Richardson */ 1208e48762b3SBruce Richardson uint32_t event_port_cfg; /**< Port configuration flags(EVENT_PORT_CFG_) */ 120999a2dd95SBruce Richardson }; 121099a2dd95SBruce Richardson 121199a2dd95SBruce Richardson /** 121299a2dd95SBruce Richardson * Retrieve the default configuration information of an event port designated 121399a2dd95SBruce Richardson * by its *port_id* from the event driver for an event device. 121499a2dd95SBruce Richardson * 1215e48762b3SBruce Richardson * This function is intended to be used in conjunction with rte_event_port_setup() 1216e48762b3SBruce Richardson * where the caller can set up the port by just overriding few default values. 121799a2dd95SBruce Richardson * 121899a2dd95SBruce Richardson * @param dev_id 121999a2dd95SBruce Richardson * The identifier of the device. 122099a2dd95SBruce Richardson * @param port_id 122199a2dd95SBruce Richardson * The index of the event port to get the configuration information. 1222e48762b3SBruce Richardson * The value must be less than @ref rte_event_dev_config.nb_event_ports 122399a2dd95SBruce Richardson * previously supplied to rte_event_dev_configure(). 122499a2dd95SBruce Richardson * @param[out] port_conf 1225e48762b3SBruce Richardson * The pointer to a structure to store the default event port configuration data. 122699a2dd95SBruce Richardson * @return 122799a2dd95SBruce Richardson * - 0: Success, driver updates the default event port configuration data. 122899a2dd95SBruce Richardson * - <0: Error code returned by the driver info get function. 1229e48762b3SBruce Richardson * - -EINVAL - invalid input parameter. 1230e48762b3SBruce Richardson * - -ENOTSUP - function is not supported for this device. 123199a2dd95SBruce Richardson * 123299a2dd95SBruce Richardson * @see rte_event_port_setup() 123399a2dd95SBruce Richardson */ 123499a2dd95SBruce Richardson int 123599a2dd95SBruce Richardson rte_event_port_default_conf_get(uint8_t dev_id, uint8_t port_id, 123699a2dd95SBruce Richardson struct rte_event_port_conf *port_conf); 123799a2dd95SBruce Richardson 123899a2dd95SBruce Richardson /** 123999a2dd95SBruce Richardson * Allocate and set up an event port for an event device. 124099a2dd95SBruce Richardson * 124199a2dd95SBruce Richardson * @param dev_id 124299a2dd95SBruce Richardson * The identifier of the device. 124399a2dd95SBruce Richardson * @param port_id 1244e48762b3SBruce Richardson * The index of the event port to setup. The value must be less than 1245e48762b3SBruce Richardson * @ref rte_event_dev_config.nb_event_ports previously supplied to 1246e48762b3SBruce Richardson * rte_event_dev_configure(). 124799a2dd95SBruce Richardson * @param port_conf 1248e48762b3SBruce Richardson * The pointer to the configuration data to be used for the port. 1249e48762b3SBruce Richardson * NULL value is allowed, in which case the default configuration is used. 125099a2dd95SBruce Richardson * 125199a2dd95SBruce Richardson * @see rte_event_port_default_conf_get() 125299a2dd95SBruce Richardson * 125399a2dd95SBruce Richardson * @return 125499a2dd95SBruce Richardson * - 0: Success, event port correctly set up. 1255e48762b3SBruce Richardson * - <0: Port configuration failed. 1256e48762b3SBruce Richardson * - -EINVAL - Invalid input parameter. 1257e48762b3SBruce Richardson * - -EBUSY - Port already started. 1258e48762b3SBruce Richardson * - -ENOTSUP - Function not supported on this device, or a NULL pointer passed 1259e48762b3SBruce Richardson * as the port_conf parameter, and no default configuration function available 1260e48762b3SBruce Richardson * for this device. 1261e48762b3SBruce Richardson * - -EDQUOT - Application tried to link a queue configured 1262e48762b3SBruce Richardson * with @ref RTE_EVENT_QUEUE_CFG_SINGLE_LINK to more than one event port. 126399a2dd95SBruce Richardson */ 126499a2dd95SBruce Richardson int 126599a2dd95SBruce Richardson rte_event_port_setup(uint8_t dev_id, uint8_t port_id, 126699a2dd95SBruce Richardson const struct rte_event_port_conf *port_conf); 126799a2dd95SBruce Richardson 12681ff23ce6SPavan Nikhilesh typedef void (*rte_eventdev_port_flush_t)(uint8_t dev_id, 12691ff23ce6SPavan Nikhilesh struct rte_event event, void *arg); 12701ff23ce6SPavan Nikhilesh /**< Callback function prototype that can be passed during 12711ff23ce6SPavan Nikhilesh * rte_event_port_release(), invoked once per a released event. 12721ff23ce6SPavan Nikhilesh */ 12731ff23ce6SPavan Nikhilesh 12741ff23ce6SPavan Nikhilesh /** 12751ff23ce6SPavan Nikhilesh * Quiesce any core specific resources consumed by the event port. 12761ff23ce6SPavan Nikhilesh * 12771ff23ce6SPavan Nikhilesh * Event ports are generally coupled with lcores, and a given Hardware 12781ff23ce6SPavan Nikhilesh * implementation might require the PMD to store port specific data in the 12791ff23ce6SPavan Nikhilesh * lcore. 12801ff23ce6SPavan Nikhilesh * When the application decides to migrate the event port to another lcore 12811ff23ce6SPavan Nikhilesh * or teardown the current lcore it may to call `rte_event_port_quiesce` 12821ff23ce6SPavan Nikhilesh * to make sure that all the data associated with the event port are released 12831ff23ce6SPavan Nikhilesh * from the lcore, this might also include any prefetched events. 12841ff23ce6SPavan Nikhilesh * While releasing the event port from the lcore, this function calls the 12851ff23ce6SPavan Nikhilesh * user-provided flush callback once per event. 12861ff23ce6SPavan Nikhilesh * 12871ff23ce6SPavan Nikhilesh * @note Invocation of this API does not affect the existing port configuration. 12881ff23ce6SPavan Nikhilesh * 12891ff23ce6SPavan Nikhilesh * @param dev_id 12901ff23ce6SPavan Nikhilesh * The identifier of the device. 12911ff23ce6SPavan Nikhilesh * @param port_id 1292e48762b3SBruce Richardson * The index of the event port to quiesce. The value must be less than 1293e48762b3SBruce Richardson * @ref rte_event_dev_config.nb_event_ports previously supplied to rte_event_dev_configure(). 12941ff23ce6SPavan Nikhilesh * @param release_cb 12951ff23ce6SPavan Nikhilesh * Callback function invoked once per flushed event. 12961ff23ce6SPavan Nikhilesh * @param args 12971ff23ce6SPavan Nikhilesh * Argument supplied to callback. 12981ff23ce6SPavan Nikhilesh */ 12991ff23ce6SPavan Nikhilesh void 13001ff23ce6SPavan Nikhilesh rte_event_port_quiesce(uint8_t dev_id, uint8_t port_id, 13011ff23ce6SPavan Nikhilesh rte_eventdev_port_flush_t release_cb, void *args); 13021ff23ce6SPavan Nikhilesh 130399a2dd95SBruce Richardson /** 130414d67a94SBruce Richardson * Port attribute id for the maximum size of a burst enqueue operation supported on a port. 130599a2dd95SBruce Richardson */ 130699a2dd95SBruce Richardson #define RTE_EVENT_PORT_ATTR_ENQ_DEPTH 0 130799a2dd95SBruce Richardson /** 130814d67a94SBruce Richardson * Port attribute id for the maximum size of a dequeue burst which can be returned from a port. 130999a2dd95SBruce Richardson */ 131099a2dd95SBruce Richardson #define RTE_EVENT_PORT_ATTR_DEQ_DEPTH 1 131199a2dd95SBruce Richardson /** 131214d67a94SBruce Richardson * Port attribute id for the new event threshold of the port. 131314d67a94SBruce Richardson * Once the number of events in the system exceeds this threshold, the enqueue of NEW-type 131414d67a94SBruce Richardson * events will fail. 131599a2dd95SBruce Richardson */ 131699a2dd95SBruce Richardson #define RTE_EVENT_PORT_ATTR_NEW_EVENT_THRESHOLD 2 131799a2dd95SBruce Richardson /** 131814d67a94SBruce Richardson * Port attribute id for the implicit release disable attribute of the port. 131999a2dd95SBruce Richardson */ 132099a2dd95SBruce Richardson #define RTE_EVENT_PORT_ATTR_IMPLICIT_RELEASE_DISABLE 3 132199a2dd95SBruce Richardson 132299a2dd95SBruce Richardson /** 132399a2dd95SBruce Richardson * Get an attribute from a port. 132499a2dd95SBruce Richardson * 132599a2dd95SBruce Richardson * @param dev_id 132614d67a94SBruce Richardson * The identifier of the device. 132799a2dd95SBruce Richardson * @param port_id 132814d67a94SBruce Richardson * The index of the event port to query. The value must be less than 132914d67a94SBruce Richardson * @ref rte_event_dev_config.nb_event_ports previously supplied to rte_event_dev_configure(). 133099a2dd95SBruce Richardson * @param attr_id 133114d67a94SBruce Richardson * The attribute ID to retrieve (RTE_EVENT_PORT_ATTR_*) 133299a2dd95SBruce Richardson * @param[out] attr_value 133399a2dd95SBruce Richardson * A pointer that will be filled in with the attribute value if successful 133499a2dd95SBruce Richardson * 133599a2dd95SBruce Richardson * @return 133614d67a94SBruce Richardson * - 0: Successfully returned value. 133714d67a94SBruce Richardson * - (-EINVAL) Invalid device, port or attr_id, or attr_value was NULL. 133899a2dd95SBruce Richardson */ 133999a2dd95SBruce Richardson int 134099a2dd95SBruce Richardson rte_event_port_attr_get(uint8_t dev_id, uint8_t port_id, uint32_t attr_id, 134199a2dd95SBruce Richardson uint32_t *attr_value); 134299a2dd95SBruce Richardson 134399a2dd95SBruce Richardson /** 134499a2dd95SBruce Richardson * Start an event device. 134599a2dd95SBruce Richardson * 134614d67a94SBruce Richardson * The device start step is the last one in device setup, and enables the event 134714d67a94SBruce Richardson * ports and queues to start accepting events and scheduling them to event ports. 134899a2dd95SBruce Richardson * 134999a2dd95SBruce Richardson * On success, all basic functions exported by the API (event enqueue, 135099a2dd95SBruce Richardson * event dequeue and so on) can be invoked. 135199a2dd95SBruce Richardson * 135299a2dd95SBruce Richardson * @param dev_id 135314d67a94SBruce Richardson * Event device identifier. 135499a2dd95SBruce Richardson * @return 135599a2dd95SBruce Richardson * - 0: Success, device started. 135614d67a94SBruce Richardson * - -EINVAL: Invalid device id provided. 135714d67a94SBruce Richardson * - -ENOTSUP: Device does not support this operation. 135814d67a94SBruce Richardson * - -ESTALE : Not all ports of the device are configured. 135999a2dd95SBruce Richardson * - -ENOLINK: Not all queues are linked, which could lead to deadlock. 136099a2dd95SBruce Richardson */ 136199a2dd95SBruce Richardson int 136299a2dd95SBruce Richardson rte_event_dev_start(uint8_t dev_id); 136399a2dd95SBruce Richardson 136499a2dd95SBruce Richardson /** 136599a2dd95SBruce Richardson * Stop an event device. 136699a2dd95SBruce Richardson * 136799a2dd95SBruce Richardson * This function causes all queued events to be drained, including those 136899a2dd95SBruce Richardson * residing in event ports. While draining events out of the device, this 136999a2dd95SBruce Richardson * function calls the user-provided flush callback (if one was registered) once 137099a2dd95SBruce Richardson * per event. 137199a2dd95SBruce Richardson * 137299a2dd95SBruce Richardson * The device can be restarted with a call to rte_event_dev_start(). Threads 137399a2dd95SBruce Richardson * that continue to enqueue/dequeue while the device is stopped, or being 137499a2dd95SBruce Richardson * stopped, will result in undefined behavior. This includes event adapters, 137599a2dd95SBruce Richardson * which must be stopped prior to stopping the eventdev. 137699a2dd95SBruce Richardson * 137799a2dd95SBruce Richardson * @param dev_id 137899a2dd95SBruce Richardson * Event device identifier. 137999a2dd95SBruce Richardson * 138099a2dd95SBruce Richardson * @see rte_event_dev_stop_flush_callback_register() 138199a2dd95SBruce Richardson */ 138299a2dd95SBruce Richardson void 138399a2dd95SBruce Richardson rte_event_dev_stop(uint8_t dev_id); 138499a2dd95SBruce Richardson 1385d986276fSPavan Nikhilesh typedef void (*rte_eventdev_stop_flush_t)(uint8_t dev_id, 1386d986276fSPavan Nikhilesh struct rte_event event, void *arg); 138799a2dd95SBruce Richardson /**< Callback function called during rte_event_dev_stop(), invoked once per 138899a2dd95SBruce Richardson * flushed event. 138999a2dd95SBruce Richardson */ 139099a2dd95SBruce Richardson 139199a2dd95SBruce Richardson /** 139299a2dd95SBruce Richardson * Registers a callback function to be invoked during rte_event_dev_stop() for 139399a2dd95SBruce Richardson * each flushed event. This function can be used to properly dispose of queued 139499a2dd95SBruce Richardson * events, for example events containing memory pointers. 139599a2dd95SBruce Richardson * 139699a2dd95SBruce Richardson * The callback function is only registered for the calling process. The 139799a2dd95SBruce Richardson * callback function must be registered in every process that can call 139899a2dd95SBruce Richardson * rte_event_dev_stop(). 139999a2dd95SBruce Richardson * 140014d67a94SBruce Richardson * Only one callback function may be registered. Each new call replaces 140114d67a94SBruce Richardson * the existing registered callback function with the new function passed in. 140214d67a94SBruce Richardson * 140399a2dd95SBruce Richardson * To unregister a callback, call this function with a NULL callback pointer. 140499a2dd95SBruce Richardson * 140599a2dd95SBruce Richardson * @param dev_id 140699a2dd95SBruce Richardson * The identifier of the device. 140799a2dd95SBruce Richardson * @param callback 140814d67a94SBruce Richardson * Callback function to be invoked once per flushed event. 140914d67a94SBruce Richardson * Pass NULL to unset any previously-registered callback function. 141099a2dd95SBruce Richardson * @param userdata 141199a2dd95SBruce Richardson * Argument supplied to callback. 141299a2dd95SBruce Richardson * 141399a2dd95SBruce Richardson * @return 141499a2dd95SBruce Richardson * - 0 on success. 141514d67a94SBruce Richardson * - -EINVAL if *dev_id* is invalid. 141699a2dd95SBruce Richardson * 141799a2dd95SBruce Richardson * @see rte_event_dev_stop() 141899a2dd95SBruce Richardson */ 1419d986276fSPavan Nikhilesh int rte_event_dev_stop_flush_callback_register(uint8_t dev_id, 1420d986276fSPavan Nikhilesh rte_eventdev_stop_flush_t callback, void *userdata); 142199a2dd95SBruce Richardson 142299a2dd95SBruce Richardson /** 142399a2dd95SBruce Richardson * Close an event device. The device cannot be restarted! 142499a2dd95SBruce Richardson * 142599a2dd95SBruce Richardson * @param dev_id 142614d67a94SBruce Richardson * Event device identifier. 142799a2dd95SBruce Richardson * 142899a2dd95SBruce Richardson * @return 142999a2dd95SBruce Richardson * - 0 on successfully closing device 143014d67a94SBruce Richardson * - <0 on failure to close device. 143114d67a94SBruce Richardson * - -EINVAL - invalid device id. 143214d67a94SBruce Richardson * - -ENOTSUP - operation not supported for this device. 143314d67a94SBruce Richardson * - -EAGAIN - device is busy. 143499a2dd95SBruce Richardson */ 143599a2dd95SBruce Richardson int 143699a2dd95SBruce Richardson rte_event_dev_close(uint8_t dev_id); 143799a2dd95SBruce Richardson 143899a2dd95SBruce Richardson /** 143999a2dd95SBruce Richardson * Event vector structure. 144099a2dd95SBruce Richardson */ 1441c6552d9aSTyler Retzlaff struct __rte_aligned(16) rte_event_vector { 144299a2dd95SBruce Richardson uint16_t nb_elem; 14430fbb55efSPavan Nikhilesh /**< Number of elements valid in this event vector. */ 14440fbb55efSPavan Nikhilesh uint16_t elem_offset : 12; 14450fbb55efSPavan Nikhilesh /**< Offset into the vector array where valid elements start from. */ 14460fbb55efSPavan Nikhilesh uint16_t rsvd : 3; 144799a2dd95SBruce Richardson /**< Reserved for future use */ 144899a2dd95SBruce Richardson uint16_t attr_valid : 1; 144999a2dd95SBruce Richardson /**< Indicates that the below union attributes have valid information. 145099a2dd95SBruce Richardson */ 145199a2dd95SBruce Richardson union { 145299a2dd95SBruce Richardson /* Used by Rx/Tx adapter. 145399a2dd95SBruce Richardson * Indicates that all the elements in this vector belong to the 145499a2dd95SBruce Richardson * same port and queue pair when originating from Rx adapter, 145599a2dd95SBruce Richardson * valid only when event type is ETHDEV_VECTOR or 145699a2dd95SBruce Richardson * ETH_RX_ADAPTER_VECTOR. 145799a2dd95SBruce Richardson * Can also be used to indicate the Tx adapter the destination 145899a2dd95SBruce Richardson * port and queue of the mbufs in the vector 145999a2dd95SBruce Richardson */ 146099a2dd95SBruce Richardson struct { 1461f5746d3fSBruce Richardson uint16_t port; /**< Ethernet device port id. */ 1462f5746d3fSBruce Richardson uint16_t queue; /**< Ethernet device queue id. */ 146399a2dd95SBruce Richardson }; 146499a2dd95SBruce Richardson }; 146599a2dd95SBruce Richardson /**< Union to hold common attributes of the vector array. */ 146699a2dd95SBruce Richardson uint64_t impl_opaque; 1467699155f2SBruce Richardson 1468699155f2SBruce Richardson /* empty structures do not have zero size in C++ leading to compilation errors 1469699155f2SBruce Richardson * with clang about structure having different sizes in C and C++. 1470699155f2SBruce Richardson * Since these are all zero-sized arrays, we can omit the "union" wrapper for 1471699155f2SBruce Richardson * C++ builds, removing the warning. 1472699155f2SBruce Richardson */ 1473699155f2SBruce Richardson #ifndef __cplusplus 147499a2dd95SBruce Richardson /**< Implementation specific opaque value. 147599a2dd95SBruce Richardson * An implementation may use this field to hold implementation specific 147699a2dd95SBruce Richardson * value to share between dequeue and enqueue operation. 147799a2dd95SBruce Richardson * The application should not modify this field. 147899a2dd95SBruce Richardson */ 1479c6552d9aSTyler Retzlaff union __rte_aligned(16) { 1480699155f2SBruce Richardson #endif 148199a2dd95SBruce Richardson struct rte_mbuf *mbufs[0]; 148299a2dd95SBruce Richardson void *ptrs[0]; 14835fa63911SPavan Nikhilesh uint64_t u64s[0]; 1484699155f2SBruce Richardson #ifndef __cplusplus 1485c6552d9aSTyler Retzlaff }; 1486699155f2SBruce Richardson #endif 148799a2dd95SBruce Richardson /**< Start of the vector array union. Depending upon the event type the 148899a2dd95SBruce Richardson * vector array can be an array of mbufs or pointers or opaque u64 148999a2dd95SBruce Richardson * values. 149099a2dd95SBruce Richardson */ 1491f5746d3fSBruce Richardson }; 149299a2dd95SBruce Richardson 149399a2dd95SBruce Richardson /* Scheduler type definitions */ 149499a2dd95SBruce Richardson #define RTE_SCHED_TYPE_ORDERED 0 149599a2dd95SBruce Richardson /**< Ordered scheduling 149699a2dd95SBruce Richardson * 149799a2dd95SBruce Richardson * Events from an ordered flow of an event queue can be scheduled to multiple 14980f524a02SBruce Richardson * ports for concurrent processing while maintaining the original event order, 14990f524a02SBruce Richardson * i.e. the order in which they were first enqueued to that queue. 15000f524a02SBruce Richardson * This scheme allows events pertaining to the same, potentially large, flow to 15010f524a02SBruce Richardson * be processed in parallel on multiple cores without incurring any 15020f524a02SBruce Richardson * application-level order restoration logic overhead. 150399a2dd95SBruce Richardson * 15040f524a02SBruce Richardson * After events are dequeued from a set of ports, as those events are re-enqueued 15050f524a02SBruce Richardson * to another queue (with the op field set to @ref RTE_EVENT_OP_FORWARD), the event 15060f524a02SBruce Richardson * device restores the original event order - including events returned from all 15070f524a02SBruce Richardson * ports in the set - before the events are placed on the destination queue, 15080f524a02SBruce Richardson * for subsequent scheduling to ports. 150999a2dd95SBruce Richardson * 15100f524a02SBruce Richardson * Any events not forwarded i.e. dropped explicitly via RELEASE or implicitly 15110f524a02SBruce Richardson * released by the next dequeue operation on a port, are skipped by the reordering 15120f524a02SBruce Richardson * stage and do not affect the reordering of other returned events. 15130f524a02SBruce Richardson * 15140f524a02SBruce Richardson * Any NEW events sent on a port are not ordered with respect to FORWARD events sent 15150f524a02SBruce Richardson * on the same port, since they have no original event order. They also are not 15160f524a02SBruce Richardson * ordered with respect to NEW events enqueued on other ports. 15170f524a02SBruce Richardson * However, NEW events to the same destination queue from the same port are guaranteed 15180f524a02SBruce Richardson * to be enqueued in the order they were submitted via rte_event_enqueue_burst(). 15190f524a02SBruce Richardson * 15200f524a02SBruce Richardson * NOTE: 15210f524a02SBruce Richardson * In restoring event order of forwarded events, the eventdev API guarantees that 15220f524a02SBruce Richardson * all events from the same flow (i.e. same @ref rte_event.flow_id, 15230f524a02SBruce Richardson * @ref rte_event.priority and @ref rte_event.queue_id) will be put in the original 15240f524a02SBruce Richardson * order before being forwarded to the destination queue. 15250f524a02SBruce Richardson * Some eventdevs may implement stricter ordering to achieve this aim, 15260f524a02SBruce Richardson * for example, restoring the order across *all* flows dequeued from the same ORDERED 15270f524a02SBruce Richardson * queue. 152899a2dd95SBruce Richardson * 152999a2dd95SBruce Richardson * @see rte_event_queue_setup(), rte_event_dequeue_burst(), RTE_EVENT_OP_RELEASE 153099a2dd95SBruce Richardson */ 153199a2dd95SBruce Richardson 153299a2dd95SBruce Richardson #define RTE_SCHED_TYPE_ATOMIC 1 153399a2dd95SBruce Richardson /**< Atomic scheduling 153499a2dd95SBruce Richardson * 15350f524a02SBruce Richardson * Events from an atomic flow, identified by a combination of @ref rte_event.flow_id, 15360f524a02SBruce Richardson * @ref rte_event.queue_id and @ref rte_event.priority, can be scheduled only to a 153799a2dd95SBruce Richardson * single port at a time. The port is guaranteed to have exclusive (atomic) 153899a2dd95SBruce Richardson * access to the associated flow context, which enables the user to avoid SW 15390f524a02SBruce Richardson * synchronization. Atomic flows also maintain event ordering 15400f524a02SBruce Richardson * since only one port at a time can process events from each flow of an 15410f524a02SBruce Richardson * event queue, and events within a flow are not reordered within the scheduler. 154299a2dd95SBruce Richardson * 15430f524a02SBruce Richardson * An atomic flow is locked to a port when events from that flow are first 15440f524a02SBruce Richardson * scheduled to that port. That lock remains in place until the 15450f524a02SBruce Richardson * application calls rte_event_dequeue_burst() from the same port, 15460f524a02SBruce Richardson * which implicitly releases the lock (if @ref RTE_EVENT_PORT_CFG_DISABLE_IMPL_REL flag is not set). 15470f524a02SBruce Richardson * User may allow the scheduler to release the lock earlier than that by invoking 15480f524a02SBruce Richardson * rte_event_enqueue_burst() with RTE_EVENT_OP_RELEASE operation for each event from that flow. 15490f524a02SBruce Richardson * 15500f524a02SBruce Richardson * NOTE: Where multiple events from the same queue and atomic flow are scheduled to a port, 15510f524a02SBruce Richardson * the lock for that flow is only released once the last event from the flow is released, 15520f524a02SBruce Richardson * or forwarded to another queue. So long as there is at least one event from an atomic 15530f524a02SBruce Richardson * flow scheduled to a port/core (including any events in the port's dequeue queue, not yet read 15540f524a02SBruce Richardson * by the application), that port will hold the synchronization lock for that flow. 155599a2dd95SBruce Richardson * 155699a2dd95SBruce Richardson * @see rte_event_queue_setup(), rte_event_dequeue_burst(), RTE_EVENT_OP_RELEASE 155799a2dd95SBruce Richardson */ 155899a2dd95SBruce Richardson 155999a2dd95SBruce Richardson #define RTE_SCHED_TYPE_PARALLEL 2 156099a2dd95SBruce Richardson /**< Parallel scheduling 156199a2dd95SBruce Richardson * 156299a2dd95SBruce Richardson * The scheduler performs priority scheduling, load balancing, etc. functions 156399a2dd95SBruce Richardson * but does not provide additional event synchronization or ordering. 156499a2dd95SBruce Richardson * It is free to schedule events from a single parallel flow of an event queue 156599a2dd95SBruce Richardson * to multiple events ports for concurrent processing. 156699a2dd95SBruce Richardson * The application is responsible for flow context synchronization and 156799a2dd95SBruce Richardson * event ordering (SW synchronization). 156899a2dd95SBruce Richardson * 156999a2dd95SBruce Richardson * @see rte_event_queue_setup(), rte_event_dequeue_burst() 157099a2dd95SBruce Richardson */ 157199a2dd95SBruce Richardson 157299a2dd95SBruce Richardson /* Event types to classify the event source */ 157399a2dd95SBruce Richardson #define RTE_EVENT_TYPE_ETHDEV 0x0 157499a2dd95SBruce Richardson /**< The event generated from ethdev subsystem */ 157599a2dd95SBruce Richardson #define RTE_EVENT_TYPE_CRYPTODEV 0x1 157699a2dd95SBruce Richardson /**< The event generated from crypodev subsystem */ 157799a2dd95SBruce Richardson #define RTE_EVENT_TYPE_TIMER 0x2 157899a2dd95SBruce Richardson /**< The event generated from event timer adapter */ 157999a2dd95SBruce Richardson #define RTE_EVENT_TYPE_CPU 0x3 158099a2dd95SBruce Richardson /**< The event generated from cpu for pipelining. 158199a2dd95SBruce Richardson * Application may use *sub_event_type* to further classify the event 158299a2dd95SBruce Richardson */ 158399a2dd95SBruce Richardson #define RTE_EVENT_TYPE_ETH_RX_ADAPTER 0x4 158499a2dd95SBruce Richardson /**< The event generated from event eth Rx adapter */ 158566a30a29SAmit Prakash Shukla #define RTE_EVENT_TYPE_DMADEV 0x5 158666a30a29SAmit Prakash Shukla /**< The event generated from dma subsystem */ 158799a2dd95SBruce Richardson #define RTE_EVENT_TYPE_VECTOR 0x8 158899a2dd95SBruce Richardson /**< Indicates that event is a vector. 158999a2dd95SBruce Richardson * All vector event types should be a logical OR of EVENT_TYPE_VECTOR. 159099a2dd95SBruce Richardson * This simplifies the pipeline design as one can split processing the events 159199a2dd95SBruce Richardson * between vector events and normal event across event types. 159299a2dd95SBruce Richardson * Example: 159399a2dd95SBruce Richardson * if (ev.event_type & RTE_EVENT_TYPE_VECTOR) { 159499a2dd95SBruce Richardson * // Classify and handle vector event. 159599a2dd95SBruce Richardson * } else { 159699a2dd95SBruce Richardson * // Classify and handle event. 159799a2dd95SBruce Richardson * } 159899a2dd95SBruce Richardson */ 159999a2dd95SBruce Richardson #define RTE_EVENT_TYPE_ETHDEV_VECTOR \ 160099a2dd95SBruce Richardson (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_ETHDEV) 160199a2dd95SBruce Richardson /**< The event vector generated from ethdev subsystem */ 160299a2dd95SBruce Richardson #define RTE_EVENT_TYPE_CPU_VECTOR (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_CPU) 160399a2dd95SBruce Richardson /**< The event vector generated from cpu for pipelining. */ 160499a2dd95SBruce Richardson #define RTE_EVENT_TYPE_ETH_RX_ADAPTER_VECTOR \ 160599a2dd95SBruce Richardson (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_ETH_RX_ADAPTER) 160699a2dd95SBruce Richardson /**< The event vector generated from eth Rx adapter. */ 1607c1749bc5SVolodymyr Fialko #define RTE_EVENT_TYPE_CRYPTODEV_VECTOR \ 1608c1749bc5SVolodymyr Fialko (RTE_EVENT_TYPE_VECTOR | RTE_EVENT_TYPE_CRYPTODEV) 1609c1749bc5SVolodymyr Fialko /**< The event vector generated from cryptodev adapter. */ 161099a2dd95SBruce Richardson 161199a2dd95SBruce Richardson #define RTE_EVENT_TYPE_MAX 0x10 161299a2dd95SBruce Richardson /**< Maximum number of event types */ 161399a2dd95SBruce Richardson 161499a2dd95SBruce Richardson /* Event enqueue operations */ 161599a2dd95SBruce Richardson #define RTE_EVENT_OP_NEW 0 16165e467985SBruce Richardson /**< The @ref rte_event.op field must be set to this operation type to inject a new event, 16175e467985SBruce Richardson * i.e. one not previously dequeued, into the event device, to be scheduled 16185e467985SBruce Richardson * for processing. 161999a2dd95SBruce Richardson */ 162099a2dd95SBruce Richardson #define RTE_EVENT_OP_FORWARD 1 16215e467985SBruce Richardson /**< The application must set the @ref rte_event.op field to this operation type to return a 16225e467985SBruce Richardson * previously dequeued event to the event device to be scheduled for further processing. 162399a2dd95SBruce Richardson * 16245e467985SBruce Richardson * This event *must* be enqueued to the same port that the 162599a2dd95SBruce Richardson * event to be forwarded was dequeued from. 16265e467985SBruce Richardson * 16275e467985SBruce Richardson * The event's fields, including (but not limited to) flow_id, scheduling type, 16285e467985SBruce Richardson * destination queue, and event payload e.g. mbuf pointer, may all be updated as 16295e467985SBruce Richardson * desired by the application, but the @ref rte_event.impl_opaque field must 16305e467985SBruce Richardson * be kept to the same value as was present when the event was dequeued. 163199a2dd95SBruce Richardson */ 163299a2dd95SBruce Richardson #define RTE_EVENT_OP_RELEASE 2 163399a2dd95SBruce Richardson /**< Release the flow context associated with the schedule type. 163499a2dd95SBruce Richardson * 16355e467985SBruce Richardson * If current flow's scheduler type method is @ref RTE_SCHED_TYPE_ATOMIC 16365e467985SBruce Richardson * then this operation type hints the scheduler that the user has completed critical 16375e467985SBruce Richardson * section processing for this event in the current atomic context, and that the 16385e467985SBruce Richardson * scheduler may unlock any atomic locks held for this event. 16395e467985SBruce Richardson * If this is the last event from an atomic flow, i.e. all flow locks are released 16405e467985SBruce Richardson * (see @ref RTE_SCHED_TYPE_ATOMIC for details), the scheduler is now allowed to 16415e467985SBruce Richardson * schedule events from that flow from to another port. 16425e467985SBruce Richardson * However, the atomic locks may be still held until the next rte_event_dequeue_burst() 16435e467985SBruce Richardson * call; enqueuing an event with opt type @ref RTE_EVENT_OP_RELEASE is a hint only, 16445e467985SBruce Richardson * allowing the scheduler to release the atomic locks early, but not requiring it to do so. 164599a2dd95SBruce Richardson * 16465e467985SBruce Richardson * Early atomic lock release may increase parallelism and thus system 164799a2dd95SBruce Richardson * performance, but the user needs to design carefully the split into critical 164899a2dd95SBruce Richardson * vs non-critical sections. 164999a2dd95SBruce Richardson * 16505e467985SBruce Richardson * If current flow's scheduler type method is @ref RTE_SCHED_TYPE_ORDERED 16515e467985SBruce Richardson * then this operation type informs the scheduler that the current event has 16525e467985SBruce Richardson * completed processing and will not be returned to the scheduler, i.e. 16535e467985SBruce Richardson * it has been dropped, and so the reordering context for that event 16545e467985SBruce Richardson * should be considered filled. 165599a2dd95SBruce Richardson * 16565e467985SBruce Richardson * Events with this operation type must only be enqueued to the same port that the 16575e467985SBruce Richardson * event to be released was dequeued from. The @ref rte_event.impl_opaque 16585e467985SBruce Richardson * field in the release event must have the same value as that in the original dequeued event. 165999a2dd95SBruce Richardson * 16605e467985SBruce Richardson * If a dequeued event is re-enqueued with operation type of @ref RTE_EVENT_OP_RELEASE, 16615e467985SBruce Richardson * then any subsequent enqueue of that event - or a copy of it - must be done as event of type 16625e467985SBruce Richardson * @ref RTE_EVENT_OP_NEW, not @ref RTE_EVENT_OP_FORWARD. This is because any context for 16635e467985SBruce Richardson * the originally dequeued event, i.e. atomic locks, or reorder buffer entries, will have 16645e467985SBruce Richardson * been removed or invalidated by the release operation. 166599a2dd95SBruce Richardson */ 166699a2dd95SBruce Richardson 166799a2dd95SBruce Richardson /** 166899a2dd95SBruce Richardson * The generic *rte_event* structure to hold the event attributes 166999a2dd95SBruce Richardson * for dequeue and enqueue operation 167099a2dd95SBruce Richardson */ 167199a2dd95SBruce Richardson struct rte_event { 16724c50f7afSBruce Richardson /* WORD0 */ 167399a2dd95SBruce Richardson union { 167499a2dd95SBruce Richardson uint64_t event; 167599a2dd95SBruce Richardson /** Event attributes for dequeue or enqueue operation */ 167699a2dd95SBruce Richardson struct { 167799a2dd95SBruce Richardson uint32_t flow_id:20; 16785e467985SBruce Richardson /**< Target flow identifier for the enqueue and dequeue operation. 16795e467985SBruce Richardson * 16805e467985SBruce Richardson * For @ref RTE_SCHED_TYPE_ATOMIC, this field is used to identify a 16815e467985SBruce Richardson * flow for atomicity within a queue & priority level, such that events 16825e467985SBruce Richardson * from each individual flow will only be scheduled to one port at a time. 16835e467985SBruce Richardson * 16845e467985SBruce Richardson * This field is preserved between enqueue and dequeue when 16855e467985SBruce Richardson * a device reports the @ref RTE_EVENT_DEV_CAP_CARRY_FLOW_ID 16865e467985SBruce Richardson * capability. Otherwise the value is implementation dependent 16875e467985SBruce Richardson * on dequeue. 168899a2dd95SBruce Richardson */ 168999a2dd95SBruce Richardson uint32_t sub_event_type:8; 169099a2dd95SBruce Richardson /**< Sub-event types based on the event source. 16915e467985SBruce Richardson * 16925e467985SBruce Richardson * This field is preserved between enqueue and dequeue. 16935e467985SBruce Richardson * 169499a2dd95SBruce Richardson * @see RTE_EVENT_TYPE_CPU 169599a2dd95SBruce Richardson */ 169699a2dd95SBruce Richardson uint32_t event_type:4; 16975e467985SBruce Richardson /**< Event type to classify the event source. (RTE_EVENT_TYPE_*) 16985e467985SBruce Richardson * 16995e467985SBruce Richardson * This field is preserved between enqueue and dequeue 170099a2dd95SBruce Richardson */ 170199a2dd95SBruce Richardson uint8_t op:2; 17025e467985SBruce Richardson /**< The type of event enqueue operation - new/forward/ etc. 17035e467985SBruce Richardson * 17045e467985SBruce Richardson * This field is *not* preserved across an instance 17055e467985SBruce Richardson * and is implementation dependent on dequeue. 17065e467985SBruce Richardson * 17075e467985SBruce Richardson * @see RTE_EVENT_OP_NEW 17085e467985SBruce Richardson * @see RTE_EVENT_OP_FORWARD 17095e467985SBruce Richardson * @see RTE_EVENT_OP_RELEASE 171099a2dd95SBruce Richardson */ 171199a2dd95SBruce Richardson uint8_t rsvd:4; 17125e467985SBruce Richardson /**< Reserved for future use. 17135e467985SBruce Richardson * 17145e467985SBruce Richardson * Should be set to zero when initializing event structures. 17155e467985SBruce Richardson * 17165e467985SBruce Richardson * When forwarding or releasing existing events dequeued from the scheduler, 17175e467985SBruce Richardson * this field can be ignored. 17185e467985SBruce Richardson */ 171999a2dd95SBruce Richardson uint8_t sched_type:2; 172099a2dd95SBruce Richardson /**< Scheduler synchronization type (RTE_SCHED_TYPE_*) 172199a2dd95SBruce Richardson * associated with flow id on a given event queue 172299a2dd95SBruce Richardson * for the enqueue and dequeue operation. 17235e467985SBruce Richardson * 17245e467985SBruce Richardson * This field is used to determine the scheduling type 17255e467985SBruce Richardson * for events sent to queues where @ref RTE_EVENT_QUEUE_CFG_ALL_TYPES 17265e467985SBruce Richardson * is configured. 17275e467985SBruce Richardson * For queues where only a single scheduling type is available, 17285e467985SBruce Richardson * this field must be set to match the configured scheduling type. 17295e467985SBruce Richardson * 17305e467985SBruce Richardson * This field is preserved between enqueue and dequeue. 17315e467985SBruce Richardson * 17325e467985SBruce Richardson * @see RTE_SCHED_TYPE_ORDERED 17335e467985SBruce Richardson * @see RTE_SCHED_TYPE_ATOMIC 17345e467985SBruce Richardson * @see RTE_SCHED_TYPE_PARALLEL 173599a2dd95SBruce Richardson */ 173699a2dd95SBruce Richardson uint8_t queue_id; 173799a2dd95SBruce Richardson /**< Targeted event queue identifier for the enqueue or 173899a2dd95SBruce Richardson * dequeue operation. 17395e467985SBruce Richardson * The value must be less than @ref rte_event_dev_config.nb_event_queues 17405e467985SBruce Richardson * which was previously supplied to rte_event_dev_configure(). 17415e467985SBruce Richardson * 17425e467985SBruce Richardson * This field is preserved between enqueue on dequeue. 174399a2dd95SBruce Richardson */ 174499a2dd95SBruce Richardson uint8_t priority; 174599a2dd95SBruce Richardson /**< Event priority relative to other events in the 174699a2dd95SBruce Richardson * event queue. The requested priority should in the 17475e467985SBruce Richardson * range of [@ref RTE_EVENT_DEV_PRIORITY_HIGHEST, 17485e467985SBruce Richardson * @ref RTE_EVENT_DEV_PRIORITY_LOWEST]. 17495e467985SBruce Richardson * 175099a2dd95SBruce Richardson * The implementation shall normalize the requested 175199a2dd95SBruce Richardson * priority to supported priority value. 17525e467985SBruce Richardson * [For devices with where the supported priority range is a power-of-2, the 17535e467985SBruce Richardson * normalization will be done via bit-shifting, so only the highest 17545e467985SBruce Richardson * log2(num_priorities) bits will be used by the event device] 17555e467985SBruce Richardson * 17565e467985SBruce Richardson * Valid when the device has @ref RTE_EVENT_DEV_CAP_EVENT_QOS capability 17575e467985SBruce Richardson * and this field is preserved between enqueue and dequeue, 17585e467985SBruce Richardson * though with possible loss of precision due to normalization and 17595e467985SBruce Richardson * subsequent de-normalization. (For example, if a device only supports 8 17605e467985SBruce Richardson * priority levels, only the high 3 bits of this field will be 17615e467985SBruce Richardson * used by that device, and hence only the value of those 3 bits are 17625e467985SBruce Richardson * guaranteed to be preserved between enqueue and dequeue.) 17635e467985SBruce Richardson * 17645e467985SBruce Richardson * Ignored when device does not support @ref RTE_EVENT_DEV_CAP_EVENT_QOS 17655e467985SBruce Richardson * capability, and it is implementation dependent if this field is preserved 17665e467985SBruce Richardson * between enqueue and dequeue. 176799a2dd95SBruce Richardson */ 176899a2dd95SBruce Richardson uint8_t impl_opaque; 17695e467985SBruce Richardson /**< Opaque field for event device use. 17705e467985SBruce Richardson * 17715e467985SBruce Richardson * An event driver implementation may use this field to hold an 177299a2dd95SBruce Richardson * implementation specific value to share between 177399a2dd95SBruce Richardson * dequeue and enqueue operation. 17745e467985SBruce Richardson * 17755e467985SBruce Richardson * The application must not modify this field. 17765e467985SBruce Richardson * Its value is implementation dependent on dequeue, 17775e467985SBruce Richardson * and must be returned unmodified on enqueue when 17785e467985SBruce Richardson * op type is @ref RTE_EVENT_OP_FORWARD or @ref RTE_EVENT_OP_RELEASE. 17795e467985SBruce Richardson * This field is ignored on events with op type 17805e467985SBruce Richardson * @ref RTE_EVENT_OP_NEW. 178199a2dd95SBruce Richardson */ 178299a2dd95SBruce Richardson }; 178399a2dd95SBruce Richardson }; 17844c50f7afSBruce Richardson /* WORD1 */ 178599a2dd95SBruce Richardson union { 178699a2dd95SBruce Richardson uint64_t u64; 178799a2dd95SBruce Richardson /**< Opaque 64-bit value */ 178899a2dd95SBruce Richardson void *event_ptr; 178999a2dd95SBruce Richardson /**< Opaque event pointer */ 179099a2dd95SBruce Richardson struct rte_mbuf *mbuf; 179199a2dd95SBruce Richardson /**< mbuf pointer if dequeued event is associated with mbuf */ 179299a2dd95SBruce Richardson struct rte_event_vector *vec; 179399a2dd95SBruce Richardson /**< Event vector pointer. */ 179499a2dd95SBruce Richardson }; 179599a2dd95SBruce Richardson }; 179699a2dd95SBruce Richardson 179799a2dd95SBruce Richardson /* Ethdev Rx adapter capability bitmap flags */ 179899a2dd95SBruce Richardson #define RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT 0x1 179999a2dd95SBruce Richardson /**< This flag is sent when the packet transfer mechanism is in HW. 180099a2dd95SBruce Richardson * Ethdev can send packets to the event device using internal event port. 180199a2dd95SBruce Richardson */ 180299a2dd95SBruce Richardson #define RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ 0x2 180399a2dd95SBruce Richardson /**< Adapter supports multiple event queues per ethdev. Every ethdev 180499a2dd95SBruce Richardson * Rx queue can be connected to a unique event queue. 180599a2dd95SBruce Richardson */ 180699a2dd95SBruce Richardson #define RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID 0x4 180799a2dd95SBruce Richardson /**< The application can override the adapter generated flow ID in the 180899a2dd95SBruce Richardson * event. This flow ID can be specified when adding an ethdev Rx queue 1809a256a743SPavan Nikhilesh * to the adapter using the ev.flow_id member. 181099a2dd95SBruce Richardson * @see struct rte_event_eth_rx_adapter_queue_conf::ev 181199a2dd95SBruce Richardson * @see struct rte_event_eth_rx_adapter_queue_conf::rx_queue_flags 181299a2dd95SBruce Richardson */ 181399a2dd95SBruce Richardson #define RTE_EVENT_ETH_RX_ADAPTER_CAP_EVENT_VECTOR 0x8 181499a2dd95SBruce Richardson /**< Adapter supports event vectorization per ethdev. */ 181599a2dd95SBruce Richardson 181699a2dd95SBruce Richardson /** 181799a2dd95SBruce Richardson * Retrieve the event device's ethdev Rx adapter capabilities for the 181899a2dd95SBruce Richardson * specified ethernet port 181999a2dd95SBruce Richardson * 182099a2dd95SBruce Richardson * @param dev_id 182199a2dd95SBruce Richardson * The identifier of the device. 182299a2dd95SBruce Richardson * 182399a2dd95SBruce Richardson * @param eth_port_id 182499a2dd95SBruce Richardson * The identifier of the ethernet device. 182599a2dd95SBruce Richardson * 182699a2dd95SBruce Richardson * @param[out] caps 182799a2dd95SBruce Richardson * A pointer to memory filled with Rx event adapter capabilities. 182899a2dd95SBruce Richardson * 182999a2dd95SBruce Richardson * @return 183099a2dd95SBruce Richardson * - 0: Success, driver provides Rx event adapter capabilities for the 183199a2dd95SBruce Richardson * ethernet device. 183299a2dd95SBruce Richardson * - <0: Error code returned by the driver function. 183399a2dd95SBruce Richardson */ 183499a2dd95SBruce Richardson int 183599a2dd95SBruce Richardson rte_event_eth_rx_adapter_caps_get(uint8_t dev_id, uint16_t eth_port_id, 183699a2dd95SBruce Richardson uint32_t *caps); 183799a2dd95SBruce Richardson 183899a2dd95SBruce Richardson #define RTE_EVENT_TIMER_ADAPTER_CAP_INTERNAL_PORT (1ULL << 0) 183999a2dd95SBruce Richardson /**< This flag is set when the timer mechanism is in HW. */ 184099a2dd95SBruce Richardson 184199a2dd95SBruce Richardson #define RTE_EVENT_TIMER_ADAPTER_CAP_PERIODIC (1ULL << 1) 184299a2dd95SBruce Richardson /**< This flag is set if periodic mode is supported. */ 184399a2dd95SBruce Richardson 184499a2dd95SBruce Richardson /** 184599a2dd95SBruce Richardson * Retrieve the event device's timer adapter capabilities. 184699a2dd95SBruce Richardson * 184799a2dd95SBruce Richardson * @param dev_id 184899a2dd95SBruce Richardson * The identifier of the device. 184999a2dd95SBruce Richardson * 185099a2dd95SBruce Richardson * @param[out] caps 185199a2dd95SBruce Richardson * A pointer to memory to be filled with event timer adapter capabilities. 185299a2dd95SBruce Richardson * 185399a2dd95SBruce Richardson * @return 185499a2dd95SBruce Richardson * - 0: Success, driver provided event timer adapter capabilities. 185599a2dd95SBruce Richardson * - <0: Error code returned by the driver function. 185699a2dd95SBruce Richardson */ 185799a2dd95SBruce Richardson int 185899a2dd95SBruce Richardson rte_event_timer_adapter_caps_get(uint8_t dev_id, uint32_t *caps); 185999a2dd95SBruce Richardson 186099a2dd95SBruce Richardson /* Crypto adapter capability bitmap flag */ 186199a2dd95SBruce Richardson #define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_NEW 0x1 186299a2dd95SBruce Richardson /**< Flag indicates HW is capable of generating events in 186399a2dd95SBruce Richardson * RTE_EVENT_OP_NEW enqueue operation. Cryptodev will send 186499a2dd95SBruce Richardson * packets to the event device as new events using an internal 186599a2dd95SBruce Richardson * event port. 186699a2dd95SBruce Richardson */ 186799a2dd95SBruce Richardson 186899a2dd95SBruce Richardson #define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD 0x2 186999a2dd95SBruce Richardson /**< Flag indicates HW is capable of generating events in 187099a2dd95SBruce Richardson * RTE_EVENT_OP_FORWARD enqueue operation. Cryptodev will send 187199a2dd95SBruce Richardson * packets to the event device as forwarded event using an 187299a2dd95SBruce Richardson * internal event port. 187399a2dd95SBruce Richardson */ 187499a2dd95SBruce Richardson 187599a2dd95SBruce Richardson #define RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_QP_EV_BIND 0x4 187699a2dd95SBruce Richardson /**< Flag indicates HW is capable of mapping crypto queue pair to 187799a2dd95SBruce Richardson * event queue. 187899a2dd95SBruce Richardson */ 187999a2dd95SBruce Richardson 188099a2dd95SBruce Richardson #define RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA 0x8 188199a2dd95SBruce Richardson /**< Flag indicates HW/SW supports a mechanism to store and retrieve 188299a2dd95SBruce Richardson * the private data information along with the crypto session. 188399a2dd95SBruce Richardson */ 188499a2dd95SBruce Richardson 1885c1749bc5SVolodymyr Fialko #define RTE_EVENT_CRYPTO_ADAPTER_CAP_EVENT_VECTOR 0x10 1886c1749bc5SVolodymyr Fialko /**< Flag indicates HW is capable of aggregating processed 1887c1749bc5SVolodymyr Fialko * crypto operations into rte_event_vector. 1888c1749bc5SVolodymyr Fialko */ 1889c1749bc5SVolodymyr Fialko 189099a2dd95SBruce Richardson /** 189199a2dd95SBruce Richardson * Retrieve the event device's crypto adapter capabilities for the 189299a2dd95SBruce Richardson * specified cryptodev device 189399a2dd95SBruce Richardson * 189499a2dd95SBruce Richardson * @param dev_id 189599a2dd95SBruce Richardson * The identifier of the device. 189699a2dd95SBruce Richardson * 189799a2dd95SBruce Richardson * @param cdev_id 189899a2dd95SBruce Richardson * The identifier of the cryptodev device. 189999a2dd95SBruce Richardson * 190099a2dd95SBruce Richardson * @param[out] caps 190199a2dd95SBruce Richardson * A pointer to memory filled with event adapter capabilities. 190299a2dd95SBruce Richardson * It is expected to be pre-allocated & initialized by caller. 190399a2dd95SBruce Richardson * 190499a2dd95SBruce Richardson * @return 190599a2dd95SBruce Richardson * - 0: Success, driver provides event adapter capabilities for the 190699a2dd95SBruce Richardson * cryptodev device. 190799a2dd95SBruce Richardson * - <0: Error code returned by the driver function. 190899a2dd95SBruce Richardson */ 190999a2dd95SBruce Richardson int 191099a2dd95SBruce Richardson rte_event_crypto_adapter_caps_get(uint8_t dev_id, uint8_t cdev_id, 191199a2dd95SBruce Richardson uint32_t *caps); 191299a2dd95SBruce Richardson 191366a30a29SAmit Prakash Shukla /* DMA adapter capability bitmap flag */ 191466a30a29SAmit Prakash Shukla #define RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_OP_NEW 0x1 191566a30a29SAmit Prakash Shukla /**< Flag indicates HW is capable of generating events in 191666a30a29SAmit Prakash Shukla * RTE_EVENT_OP_NEW enqueue operation. DMADEV will send 191766a30a29SAmit Prakash Shukla * packets to the event device as new events using an 191866a30a29SAmit Prakash Shukla * internal event port. 191966a30a29SAmit Prakash Shukla */ 192066a30a29SAmit Prakash Shukla 192166a30a29SAmit Prakash Shukla #define RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_OP_FWD 0x2 192266a30a29SAmit Prakash Shukla /**< Flag indicates HW is capable of generating events in 192366a30a29SAmit Prakash Shukla * RTE_EVENT_OP_FORWARD enqueue operation. DMADEV will send 192466a30a29SAmit Prakash Shukla * packets to the event device as forwarded event using an 192566a30a29SAmit Prakash Shukla * internal event port. 192666a30a29SAmit Prakash Shukla */ 192766a30a29SAmit Prakash Shukla 192866a30a29SAmit Prakash Shukla #define RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_VCHAN_EV_BIND 0x4 192966a30a29SAmit Prakash Shukla /**< Flag indicates HW is capable of mapping DMA vchan to event queue. */ 193066a30a29SAmit Prakash Shukla 193166a30a29SAmit Prakash Shukla /** 193266a30a29SAmit Prakash Shukla * Retrieve the event device's DMA adapter capabilities for the 193366a30a29SAmit Prakash Shukla * specified dmadev device 193466a30a29SAmit Prakash Shukla * 193566a30a29SAmit Prakash Shukla * @param dev_id 193666a30a29SAmit Prakash Shukla * The identifier of the device. 193766a30a29SAmit Prakash Shukla * 193866a30a29SAmit Prakash Shukla * @param dmadev_id 193966a30a29SAmit Prakash Shukla * The identifier of the dmadev device. 194066a30a29SAmit Prakash Shukla * 194166a30a29SAmit Prakash Shukla * @param[out] caps 194266a30a29SAmit Prakash Shukla * A pointer to memory filled with event adapter capabilities. 194366a30a29SAmit Prakash Shukla * It is expected to be pre-allocated & initialized by caller. 194466a30a29SAmit Prakash Shukla * 194566a30a29SAmit Prakash Shukla * @return 194666a30a29SAmit Prakash Shukla * - 0: Success, driver provides event adapter capabilities for the 194766a30a29SAmit Prakash Shukla * dmadev device. 194866a30a29SAmit Prakash Shukla * - <0: Error code returned by the driver function. 194966a30a29SAmit Prakash Shukla * 195066a30a29SAmit Prakash Shukla */ 195166a30a29SAmit Prakash Shukla __rte_experimental 195266a30a29SAmit Prakash Shukla int 195366a30a29SAmit Prakash Shukla rte_event_dma_adapter_caps_get(uint8_t dev_id, uint8_t dmadev_id, uint32_t *caps); 195466a30a29SAmit Prakash Shukla 195599a2dd95SBruce Richardson /* Ethdev Tx adapter capability bitmap flags */ 195699a2dd95SBruce Richardson #define RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT 0x1 195799a2dd95SBruce Richardson /**< This flag is sent when the PMD supports a packet transmit callback 195899a2dd95SBruce Richardson */ 195999a2dd95SBruce Richardson #define RTE_EVENT_ETH_TX_ADAPTER_CAP_EVENT_VECTOR 0x2 196099a2dd95SBruce Richardson /**< Indicates that the Tx adapter is capable of handling event vector of 196199a2dd95SBruce Richardson * mbufs. 196299a2dd95SBruce Richardson */ 196399a2dd95SBruce Richardson 196499a2dd95SBruce Richardson /** 196599a2dd95SBruce Richardson * Retrieve the event device's eth Tx adapter capabilities 196699a2dd95SBruce Richardson * 196799a2dd95SBruce Richardson * @param dev_id 196899a2dd95SBruce Richardson * The identifier of the device. 196999a2dd95SBruce Richardson * 197099a2dd95SBruce Richardson * @param eth_port_id 197199a2dd95SBruce Richardson * The identifier of the ethernet device. 197299a2dd95SBruce Richardson * 197399a2dd95SBruce Richardson * @param[out] caps 197499a2dd95SBruce Richardson * A pointer to memory filled with eth Tx adapter capabilities. 197599a2dd95SBruce Richardson * 197699a2dd95SBruce Richardson * @return 197799a2dd95SBruce Richardson * - 0: Success, driver provides eth Tx adapter capabilities. 197899a2dd95SBruce Richardson * - <0: Error code returned by the driver function. 197999a2dd95SBruce Richardson */ 198099a2dd95SBruce Richardson int 198199a2dd95SBruce Richardson rte_event_eth_tx_adapter_caps_get(uint8_t dev_id, uint16_t eth_port_id, 198299a2dd95SBruce Richardson uint32_t *caps); 198399a2dd95SBruce Richardson 198499a2dd95SBruce Richardson /** 198599a2dd95SBruce Richardson * Converts nanoseconds to *timeout_ticks* value for rte_event_dequeue_burst() 198699a2dd95SBruce Richardson * 198799a2dd95SBruce Richardson * If the device is configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT flag 198899a2dd95SBruce Richardson * then application can use this function to convert timeout value in 198999a2dd95SBruce Richardson * nanoseconds to implementations specific timeout value supplied in 199099a2dd95SBruce Richardson * rte_event_dequeue_burst() 199199a2dd95SBruce Richardson * 199299a2dd95SBruce Richardson * @param dev_id 199399a2dd95SBruce Richardson * The identifier of the device. 199499a2dd95SBruce Richardson * @param ns 199599a2dd95SBruce Richardson * Wait time in nanosecond 199699a2dd95SBruce Richardson * @param[out] timeout_ticks 199799a2dd95SBruce Richardson * Value for the *timeout_ticks* parameter in rte_event_dequeue_burst() 199899a2dd95SBruce Richardson * 199999a2dd95SBruce Richardson * @return 200099a2dd95SBruce Richardson * - 0 on success. 200199a2dd95SBruce Richardson * - -ENOTSUP if the device doesn't support timeouts 200299a2dd95SBruce Richardson * - -EINVAL if *dev_id* is invalid or *timeout_ticks* is NULL 200399a2dd95SBruce Richardson * - other values < 0 on failure. 200499a2dd95SBruce Richardson * 200599a2dd95SBruce Richardson * @see rte_event_dequeue_burst(), RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT 200699a2dd95SBruce Richardson * @see rte_event_dev_configure() 200799a2dd95SBruce Richardson */ 200899a2dd95SBruce Richardson int 200999a2dd95SBruce Richardson rte_event_dequeue_timeout_ticks(uint8_t dev_id, uint64_t ns, 201099a2dd95SBruce Richardson uint64_t *timeout_ticks); 201199a2dd95SBruce Richardson 201299a2dd95SBruce Richardson /** 201399a2dd95SBruce Richardson * Link multiple source event queues supplied in *queues* to the destination 201499a2dd95SBruce Richardson * event port designated by its *port_id* with associated service priority 201599a2dd95SBruce Richardson * supplied in *priorities* on the event device designated by its *dev_id*. 201699a2dd95SBruce Richardson * 201799a2dd95SBruce Richardson * The link establishment shall enable the event port *port_id* from 201899a2dd95SBruce Richardson * receiving events from the specified event queue(s) supplied in *queues* 201999a2dd95SBruce Richardson * 202099a2dd95SBruce Richardson * An event queue may link to one or more event ports. 202199a2dd95SBruce Richardson * The number of links can be established from an event queue to event port is 202299a2dd95SBruce Richardson * implementation defined. 202399a2dd95SBruce Richardson * 202499a2dd95SBruce Richardson * Event queue(s) to event port link establishment can be changed at runtime 202599a2dd95SBruce Richardson * without re-configuring the device to support scaling and to reduce the 202699a2dd95SBruce Richardson * latency of critical work by establishing the link with more event ports 202799a2dd95SBruce Richardson * at runtime. 202899a2dd95SBruce Richardson * 2029d007a7f3SPavan Nikhilesh * When the value of ``rte_event_dev_info::max_profiles_per_port`` is greater 2030d007a7f3SPavan Nikhilesh * than or equal to one, this function links the event queues to the default 2031d007a7f3SPavan Nikhilesh * profile_id i.e. profile_id 0 of the event port. 2032d007a7f3SPavan Nikhilesh * 203399a2dd95SBruce Richardson * @param dev_id 203499a2dd95SBruce Richardson * The identifier of the device. 203599a2dd95SBruce Richardson * 203699a2dd95SBruce Richardson * @param port_id 203799a2dd95SBruce Richardson * Event port identifier to select the destination port to link. 203899a2dd95SBruce Richardson * 203999a2dd95SBruce Richardson * @param queues 204099a2dd95SBruce Richardson * Points to an array of *nb_links* event queues to be linked 204199a2dd95SBruce Richardson * to the event port. 204299a2dd95SBruce Richardson * NULL value is allowed, in which case this function links all the configured 204399a2dd95SBruce Richardson * event queues *nb_event_queues* which previously supplied to 204499a2dd95SBruce Richardson * rte_event_dev_configure() to the event port *port_id* 204599a2dd95SBruce Richardson * 204699a2dd95SBruce Richardson * @param priorities 204799a2dd95SBruce Richardson * Points to an array of *nb_links* service priorities associated with each 204899a2dd95SBruce Richardson * event queue link to event port. 204999a2dd95SBruce Richardson * The priority defines the event port's servicing priority for 205099a2dd95SBruce Richardson * event queue, which may be ignored by an implementation. 205199a2dd95SBruce Richardson * The requested priority should in the range of 205299a2dd95SBruce Richardson * [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST]. 205399a2dd95SBruce Richardson * The implementation shall normalize the requested priority to 205499a2dd95SBruce Richardson * implementation supported priority value. 205599a2dd95SBruce Richardson * NULL value is allowed, in which case this function links the event queues 205699a2dd95SBruce Richardson * with RTE_EVENT_DEV_PRIORITY_NORMAL servicing priority 205799a2dd95SBruce Richardson * 205899a2dd95SBruce Richardson * @param nb_links 205999a2dd95SBruce Richardson * The number of links to establish. This parameter is ignored if queues is 206099a2dd95SBruce Richardson * NULL. 206199a2dd95SBruce Richardson * 206299a2dd95SBruce Richardson * @return 206399a2dd95SBruce Richardson * The number of links actually established. The return value can be less than 206499a2dd95SBruce Richardson * the value of the *nb_links* parameter when the implementation has the 206599a2dd95SBruce Richardson * limitation on specific queue to port link establishment or if invalid 206699a2dd95SBruce Richardson * parameters are specified in *queues* 206799a2dd95SBruce Richardson * If the return value is less than *nb_links*, the remaining links at the end 206899a2dd95SBruce Richardson * of link[] are not established, and the caller has to take care of them. 206999a2dd95SBruce Richardson * If return value is less than *nb_links* then implementation shall update the 207099a2dd95SBruce Richardson * rte_errno accordingly, Possible rte_errno values are 207199a2dd95SBruce Richardson * (EDQUOT) Quota exceeded(Application tried to link the queue configured with 207299a2dd95SBruce Richardson * RTE_EVENT_QUEUE_CFG_SINGLE_LINK to more than one event ports) 207399a2dd95SBruce Richardson * (EINVAL) Invalid parameter 207499a2dd95SBruce Richardson */ 207599a2dd95SBruce Richardson int 207699a2dd95SBruce Richardson rte_event_port_link(uint8_t dev_id, uint8_t port_id, 207799a2dd95SBruce Richardson const uint8_t queues[], const uint8_t priorities[], 207899a2dd95SBruce Richardson uint16_t nb_links); 207999a2dd95SBruce Richardson 208099a2dd95SBruce Richardson /** 208199a2dd95SBruce Richardson * Unlink multiple source event queues supplied in *queues* from the destination 208299a2dd95SBruce Richardson * event port designated by its *port_id* on the event device designated 208399a2dd95SBruce Richardson * by its *dev_id*. 208499a2dd95SBruce Richardson * 208599a2dd95SBruce Richardson * The unlink call issues an async request to disable the event port *port_id* 208699a2dd95SBruce Richardson * from receiving events from the specified event queue *queue_id*. 208799a2dd95SBruce Richardson * Event queue(s) to event port unlink establishment can be changed at runtime 208899a2dd95SBruce Richardson * without re-configuring the device. 208999a2dd95SBruce Richardson * 2090d007a7f3SPavan Nikhilesh * When the value of ``rte_event_dev_info::max_profiles_per_port`` is greater 2091d007a7f3SPavan Nikhilesh * than or equal to one, this function unlinks the event queues from the default 2092d007a7f3SPavan Nikhilesh * profile identifier i.e. profile 0 of the event port. 2093d007a7f3SPavan Nikhilesh * 209499a2dd95SBruce Richardson * @see rte_event_port_unlinks_in_progress() to poll for completed unlinks. 209599a2dd95SBruce Richardson * 209699a2dd95SBruce Richardson * @param dev_id 209799a2dd95SBruce Richardson * The identifier of the device. 209899a2dd95SBruce Richardson * 209999a2dd95SBruce Richardson * @param port_id 210099a2dd95SBruce Richardson * Event port identifier to select the destination port to unlink. 210199a2dd95SBruce Richardson * 210299a2dd95SBruce Richardson * @param queues 210399a2dd95SBruce Richardson * Points to an array of *nb_unlinks* event queues to be unlinked 210499a2dd95SBruce Richardson * from the event port. 210599a2dd95SBruce Richardson * NULL value is allowed, in which case this function unlinks all the 210699a2dd95SBruce Richardson * event queue(s) from the event port *port_id*. 210799a2dd95SBruce Richardson * 210899a2dd95SBruce Richardson * @param nb_unlinks 210999a2dd95SBruce Richardson * The number of unlinks to establish. This parameter is ignored if queues is 211099a2dd95SBruce Richardson * NULL. 211199a2dd95SBruce Richardson * 211299a2dd95SBruce Richardson * @return 211399a2dd95SBruce Richardson * The number of unlinks successfully requested. The return value can be less 211499a2dd95SBruce Richardson * than the value of the *nb_unlinks* parameter when the implementation has the 211599a2dd95SBruce Richardson * limitation on specific queue to port unlink establishment or 211699a2dd95SBruce Richardson * if invalid parameters are specified. 211799a2dd95SBruce Richardson * If the return value is less than *nb_unlinks*, the remaining queues at the 211899a2dd95SBruce Richardson * end of queues[] are not unlinked, and the caller has to take care of them. 211999a2dd95SBruce Richardson * If return value is less than *nb_unlinks* then implementation shall update 212099a2dd95SBruce Richardson * the rte_errno accordingly, Possible rte_errno values are 212199a2dd95SBruce Richardson * (EINVAL) Invalid parameter 212299a2dd95SBruce Richardson */ 212399a2dd95SBruce Richardson int 212499a2dd95SBruce Richardson rte_event_port_unlink(uint8_t dev_id, uint8_t port_id, 212599a2dd95SBruce Richardson uint8_t queues[], uint16_t nb_unlinks); 212699a2dd95SBruce Richardson 212799a2dd95SBruce Richardson /** 2128d007a7f3SPavan Nikhilesh * Link multiple source event queues supplied in *queues* to the destination 2129d007a7f3SPavan Nikhilesh * event port designated by its *port_id* with associated profile identifier 2130d007a7f3SPavan Nikhilesh * supplied in *profile_id* with service priorities supplied in *priorities* 2131d007a7f3SPavan Nikhilesh * on the event device designated by its *dev_id*. 2132d007a7f3SPavan Nikhilesh * 2133d007a7f3SPavan Nikhilesh * If *profile_id* is set to 0 then, the links created by the call `rte_event_port_link` 2134d007a7f3SPavan Nikhilesh * will be overwritten. 2135d007a7f3SPavan Nikhilesh * 2136d007a7f3SPavan Nikhilesh * Event ports by default use profile_id 0 unless it is changed using the 2137d007a7f3SPavan Nikhilesh * call ``rte_event_port_profile_switch()``. 2138d007a7f3SPavan Nikhilesh * 2139d007a7f3SPavan Nikhilesh * The link establishment shall enable the event port *port_id* from 2140d007a7f3SPavan Nikhilesh * receiving events from the specified event queue(s) supplied in *queues* 2141d007a7f3SPavan Nikhilesh * 2142d007a7f3SPavan Nikhilesh * An event queue may link to one or more event ports. 2143d007a7f3SPavan Nikhilesh * The number of links can be established from an event queue to event port is 2144d007a7f3SPavan Nikhilesh * implementation defined. 2145d007a7f3SPavan Nikhilesh * 2146d007a7f3SPavan Nikhilesh * Event queue(s) to event port link establishment can be changed at runtime 2147d007a7f3SPavan Nikhilesh * without re-configuring the device to support scaling and to reduce the 2148d007a7f3SPavan Nikhilesh * latency of critical work by establishing the link with more event ports 2149d007a7f3SPavan Nikhilesh * at runtime. 2150d007a7f3SPavan Nikhilesh * 2151d007a7f3SPavan Nikhilesh * @param dev_id 2152d007a7f3SPavan Nikhilesh * The identifier of the device. 2153d007a7f3SPavan Nikhilesh * 2154d007a7f3SPavan Nikhilesh * @param port_id 2155d007a7f3SPavan Nikhilesh * Event port identifier to select the destination port to link. 2156d007a7f3SPavan Nikhilesh * 2157d007a7f3SPavan Nikhilesh * @param queues 2158d007a7f3SPavan Nikhilesh * Points to an array of *nb_links* event queues to be linked 2159d007a7f3SPavan Nikhilesh * to the event port. 2160d007a7f3SPavan Nikhilesh * NULL value is allowed, in which case this function links all the configured 2161d007a7f3SPavan Nikhilesh * event queues *nb_event_queues* which previously supplied to 2162d007a7f3SPavan Nikhilesh * rte_event_dev_configure() to the event port *port_id* 2163d007a7f3SPavan Nikhilesh * 2164d007a7f3SPavan Nikhilesh * @param priorities 2165d007a7f3SPavan Nikhilesh * Points to an array of *nb_links* service priorities associated with each 2166d007a7f3SPavan Nikhilesh * event queue link to event port. 2167d007a7f3SPavan Nikhilesh * The priority defines the event port's servicing priority for 2168d007a7f3SPavan Nikhilesh * event queue, which may be ignored by an implementation. 2169d007a7f3SPavan Nikhilesh * The requested priority should in the range of 2170d007a7f3SPavan Nikhilesh * [RTE_EVENT_DEV_PRIORITY_HIGHEST, RTE_EVENT_DEV_PRIORITY_LOWEST]. 2171d007a7f3SPavan Nikhilesh * The implementation shall normalize the requested priority to 2172d007a7f3SPavan Nikhilesh * implementation supported priority value. 2173d007a7f3SPavan Nikhilesh * NULL value is allowed, in which case this function links the event queues 2174d007a7f3SPavan Nikhilesh * with RTE_EVENT_DEV_PRIORITY_NORMAL servicing priority 2175d007a7f3SPavan Nikhilesh * 2176d007a7f3SPavan Nikhilesh * @param nb_links 2177d007a7f3SPavan Nikhilesh * The number of links to establish. This parameter is ignored if queues is 2178d007a7f3SPavan Nikhilesh * NULL. 2179d007a7f3SPavan Nikhilesh * 2180d007a7f3SPavan Nikhilesh * @param profile_id 2181d007a7f3SPavan Nikhilesh * The profile identifier associated with the links between event queues and 2182d007a7f3SPavan Nikhilesh * event port. Should be less than the max capability reported by 2183d007a7f3SPavan Nikhilesh * ``rte_event_dev_info::max_profiles_per_port`` 2184d007a7f3SPavan Nikhilesh * 2185d007a7f3SPavan Nikhilesh * @return 2186d007a7f3SPavan Nikhilesh * The number of links actually established. The return value can be less than 2187d007a7f3SPavan Nikhilesh * the value of the *nb_links* parameter when the implementation has the 2188d007a7f3SPavan Nikhilesh * limitation on specific queue to port link establishment or if invalid 2189d007a7f3SPavan Nikhilesh * parameters are specified in *queues* 2190d007a7f3SPavan Nikhilesh * If the return value is less than *nb_links*, the remaining links at the end 2191d007a7f3SPavan Nikhilesh * of link[] are not established, and the caller has to take care of them. 2192d007a7f3SPavan Nikhilesh * If return value is less than *nb_links* then implementation shall update the 2193d007a7f3SPavan Nikhilesh * rte_errno accordingly, Possible rte_errno values are 2194d007a7f3SPavan Nikhilesh * (EDQUOT) Quota exceeded(Application tried to link the queue configured with 2195d007a7f3SPavan Nikhilesh * RTE_EVENT_QUEUE_CFG_SINGLE_LINK to more than one event ports) 2196d007a7f3SPavan Nikhilesh * (EINVAL) Invalid parameter 2197d007a7f3SPavan Nikhilesh * 2198d007a7f3SPavan Nikhilesh */ 2199d007a7f3SPavan Nikhilesh __rte_experimental 2200d007a7f3SPavan Nikhilesh int 2201d007a7f3SPavan Nikhilesh rte_event_port_profile_links_set(uint8_t dev_id, uint8_t port_id, const uint8_t queues[], 2202d007a7f3SPavan Nikhilesh const uint8_t priorities[], uint16_t nb_links, uint8_t profile_id); 2203d007a7f3SPavan Nikhilesh 2204d007a7f3SPavan Nikhilesh /** 2205d007a7f3SPavan Nikhilesh * Unlink multiple source event queues supplied in *queues* that belong to profile 2206d007a7f3SPavan Nikhilesh * designated by *profile_id* from the destination event port designated by its 2207d007a7f3SPavan Nikhilesh * *port_id* on the event device designated by its *dev_id*. 2208d007a7f3SPavan Nikhilesh * 2209d007a7f3SPavan Nikhilesh * If *profile_id* is set to 0 i.e., the default profile then, then this function 2210d007a7f3SPavan Nikhilesh * will act as ``rte_event_port_unlink``. 2211d007a7f3SPavan Nikhilesh * 2212d007a7f3SPavan Nikhilesh * The unlink call issues an async request to disable the event port *port_id* 2213d007a7f3SPavan Nikhilesh * from receiving events from the specified event queue *queue_id*. 2214d007a7f3SPavan Nikhilesh * Event queue(s) to event port unlink establishment can be changed at runtime 2215d007a7f3SPavan Nikhilesh * without re-configuring the device. 2216d007a7f3SPavan Nikhilesh * 2217d007a7f3SPavan Nikhilesh * @see rte_event_port_unlinks_in_progress() to poll for completed unlinks. 2218d007a7f3SPavan Nikhilesh * 2219d007a7f3SPavan Nikhilesh * @param dev_id 2220d007a7f3SPavan Nikhilesh * The identifier of the device. 2221d007a7f3SPavan Nikhilesh * 2222d007a7f3SPavan Nikhilesh * @param port_id 2223d007a7f3SPavan Nikhilesh * Event port identifier to select the destination port to unlink. 2224d007a7f3SPavan Nikhilesh * 2225d007a7f3SPavan Nikhilesh * @param queues 2226d007a7f3SPavan Nikhilesh * Points to an array of *nb_unlinks* event queues to be unlinked 2227d007a7f3SPavan Nikhilesh * from the event port. 2228d007a7f3SPavan Nikhilesh * NULL value is allowed, in which case this function unlinks all the 2229d007a7f3SPavan Nikhilesh * event queue(s) from the event port *port_id*. 2230d007a7f3SPavan Nikhilesh * 2231d007a7f3SPavan Nikhilesh * @param nb_unlinks 2232d007a7f3SPavan Nikhilesh * The number of unlinks to establish. This parameter is ignored if queues is 2233d007a7f3SPavan Nikhilesh * NULL. 2234d007a7f3SPavan Nikhilesh * 2235d007a7f3SPavan Nikhilesh * @param profile_id 2236d007a7f3SPavan Nikhilesh * The profile identifier associated with the links between event queues and 2237d007a7f3SPavan Nikhilesh * event port. Should be less than the max capability reported by 2238d007a7f3SPavan Nikhilesh * ``rte_event_dev_info::max_profiles_per_port`` 2239d007a7f3SPavan Nikhilesh * 2240d007a7f3SPavan Nikhilesh * @return 2241d007a7f3SPavan Nikhilesh * The number of unlinks successfully requested. The return value can be less 2242d007a7f3SPavan Nikhilesh * than the value of the *nb_unlinks* parameter when the implementation has the 2243d007a7f3SPavan Nikhilesh * limitation on specific queue to port unlink establishment or 2244d007a7f3SPavan Nikhilesh * if invalid parameters are specified. 2245d007a7f3SPavan Nikhilesh * If the return value is less than *nb_unlinks*, the remaining queues at the 2246d007a7f3SPavan Nikhilesh * end of queues[] are not unlinked, and the caller has to take care of them. 2247d007a7f3SPavan Nikhilesh * If return value is less than *nb_unlinks* then implementation shall update 2248d007a7f3SPavan Nikhilesh * the rte_errno accordingly, Possible rte_errno values are 2249d007a7f3SPavan Nikhilesh * (EINVAL) Invalid parameter 2250d007a7f3SPavan Nikhilesh * 2251d007a7f3SPavan Nikhilesh */ 2252d007a7f3SPavan Nikhilesh __rte_experimental 2253d007a7f3SPavan Nikhilesh int 2254d007a7f3SPavan Nikhilesh rte_event_port_profile_unlink(uint8_t dev_id, uint8_t port_id, uint8_t queues[], 2255d007a7f3SPavan Nikhilesh uint16_t nb_unlinks, uint8_t profile_id); 2256d007a7f3SPavan Nikhilesh 2257d007a7f3SPavan Nikhilesh /** 225899a2dd95SBruce Richardson * Returns the number of unlinks in progress. 225999a2dd95SBruce Richardson * 226099a2dd95SBruce Richardson * This function provides the application with a method to detect when an 226199a2dd95SBruce Richardson * unlink has been completed by the implementation. 226299a2dd95SBruce Richardson * 226399a2dd95SBruce Richardson * @see rte_event_port_unlink() to issue unlink requests. 226499a2dd95SBruce Richardson * 226599a2dd95SBruce Richardson * @param dev_id 226699a2dd95SBruce Richardson * The identifier of the device. 226799a2dd95SBruce Richardson * 226899a2dd95SBruce Richardson * @param port_id 226999a2dd95SBruce Richardson * Event port identifier to select port to check for unlinks in progress. 227099a2dd95SBruce Richardson * 227199a2dd95SBruce Richardson * @return 227299a2dd95SBruce Richardson * The number of unlinks that are in progress. A return of zero indicates that 227399a2dd95SBruce Richardson * there are no outstanding unlink requests. A positive return value indicates 227499a2dd95SBruce Richardson * the number of unlinks that are in progress, but are not yet complete. 227599a2dd95SBruce Richardson * A negative return value indicates an error, -EINVAL indicates an invalid 227699a2dd95SBruce Richardson * parameter passed for *dev_id* or *port_id*. 227799a2dd95SBruce Richardson */ 227899a2dd95SBruce Richardson int 227999a2dd95SBruce Richardson rte_event_port_unlinks_in_progress(uint8_t dev_id, uint8_t port_id); 228099a2dd95SBruce Richardson 228199a2dd95SBruce Richardson /** 228299a2dd95SBruce Richardson * Retrieve the list of source event queues and its associated service priority 228399a2dd95SBruce Richardson * linked to the destination event port designated by its *port_id* 228499a2dd95SBruce Richardson * on the event device designated by its *dev_id*. 228599a2dd95SBruce Richardson * 228699a2dd95SBruce Richardson * @param dev_id 228799a2dd95SBruce Richardson * The identifier of the device. 228899a2dd95SBruce Richardson * 228999a2dd95SBruce Richardson * @param port_id 229099a2dd95SBruce Richardson * Event port identifier. 229199a2dd95SBruce Richardson * 229299a2dd95SBruce Richardson * @param[out] queues 229399a2dd95SBruce Richardson * Points to an array of *queues* for output. 229499a2dd95SBruce Richardson * The caller has to allocate *RTE_EVENT_MAX_QUEUES_PER_DEV* bytes to 229599a2dd95SBruce Richardson * store the event queue(s) linked with event port *port_id* 229699a2dd95SBruce Richardson * 229799a2dd95SBruce Richardson * @param[out] priorities 229899a2dd95SBruce Richardson * Points to an array of *priorities* for output. 229999a2dd95SBruce Richardson * The caller has to allocate *RTE_EVENT_MAX_QUEUES_PER_DEV* bytes to 230099a2dd95SBruce Richardson * store the service priority associated with each event queue linked 230199a2dd95SBruce Richardson * 230299a2dd95SBruce Richardson * @return 230399a2dd95SBruce Richardson * The number of links established on the event port designated by its 230499a2dd95SBruce Richardson * *port_id*. 230599a2dd95SBruce Richardson * - <0 on failure. 230699a2dd95SBruce Richardson */ 230799a2dd95SBruce Richardson int 230899a2dd95SBruce Richardson rte_event_port_links_get(uint8_t dev_id, uint8_t port_id, 230999a2dd95SBruce Richardson uint8_t queues[], uint8_t priorities[]); 231099a2dd95SBruce Richardson 231199a2dd95SBruce Richardson /** 2312d007a7f3SPavan Nikhilesh * Retrieve the list of source event queues and its service priority 2313d007a7f3SPavan Nikhilesh * associated to a *profile_id* and linked to the destination event port 2314d007a7f3SPavan Nikhilesh * designated by its *port_id* on the event device designated by its *dev_id*. 2315d007a7f3SPavan Nikhilesh * 2316d007a7f3SPavan Nikhilesh * @param dev_id 2317d007a7f3SPavan Nikhilesh * The identifier of the device. 2318d007a7f3SPavan Nikhilesh * 2319d007a7f3SPavan Nikhilesh * @param port_id 2320d007a7f3SPavan Nikhilesh * Event port identifier. 2321d007a7f3SPavan Nikhilesh * 2322d007a7f3SPavan Nikhilesh * @param[out] queues 2323d007a7f3SPavan Nikhilesh * Points to an array of *queues* for output. 2324d007a7f3SPavan Nikhilesh * The caller has to allocate *RTE_EVENT_MAX_QUEUES_PER_DEV* bytes to 2325d007a7f3SPavan Nikhilesh * store the event queue(s) linked with event port *port_id* 2326d007a7f3SPavan Nikhilesh * 2327d007a7f3SPavan Nikhilesh * @param[out] priorities 2328d007a7f3SPavan Nikhilesh * Points to an array of *priorities* for output. 2329d007a7f3SPavan Nikhilesh * The caller has to allocate *RTE_EVENT_MAX_QUEUES_PER_DEV* bytes to 2330d007a7f3SPavan Nikhilesh * store the service priority associated with each event queue linked 2331d007a7f3SPavan Nikhilesh * 2332d007a7f3SPavan Nikhilesh * @param profile_id 2333d007a7f3SPavan Nikhilesh * The profile identifier associated with the links between event queues and 2334d007a7f3SPavan Nikhilesh * event port. Should be less than the max capability reported by 2335d007a7f3SPavan Nikhilesh * ``rte_event_dev_info::max_profiles_per_port`` 2336d007a7f3SPavan Nikhilesh * 2337d007a7f3SPavan Nikhilesh * @return 2338d007a7f3SPavan Nikhilesh * The number of links established on the event port designated by its 2339d007a7f3SPavan Nikhilesh * *port_id*. 2340d007a7f3SPavan Nikhilesh * - <0 on failure. 2341d007a7f3SPavan Nikhilesh */ 2342d007a7f3SPavan Nikhilesh __rte_experimental 2343d007a7f3SPavan Nikhilesh int 2344d007a7f3SPavan Nikhilesh rte_event_port_profile_links_get(uint8_t dev_id, uint8_t port_id, uint8_t queues[], 2345d007a7f3SPavan Nikhilesh uint8_t priorities[], uint8_t profile_id); 2346d007a7f3SPavan Nikhilesh 2347d007a7f3SPavan Nikhilesh /** 234899a2dd95SBruce Richardson * Retrieve the service ID of the event dev. If the adapter doesn't use 234999a2dd95SBruce Richardson * a rte_service function, this function returns -ESRCH. 235099a2dd95SBruce Richardson * 235199a2dd95SBruce Richardson * @param dev_id 235299a2dd95SBruce Richardson * The identifier of the device. 235399a2dd95SBruce Richardson * 235499a2dd95SBruce Richardson * @param [out] service_id 235599a2dd95SBruce Richardson * A pointer to a uint32_t, to be filled in with the service id. 235699a2dd95SBruce Richardson * 235799a2dd95SBruce Richardson * @return 235899a2dd95SBruce Richardson * - 0: Success 235999a2dd95SBruce Richardson * - <0: Error code on failure, if the event dev doesn't use a rte_service 236099a2dd95SBruce Richardson * function, this function returns -ESRCH. 236199a2dd95SBruce Richardson */ 236299a2dd95SBruce Richardson int 236399a2dd95SBruce Richardson rte_event_dev_service_id_get(uint8_t dev_id, uint32_t *service_id); 236499a2dd95SBruce Richardson 236599a2dd95SBruce Richardson /** 236699a2dd95SBruce Richardson * Dump internal information about *dev_id* to the FILE* provided in *f*. 236799a2dd95SBruce Richardson * 236899a2dd95SBruce Richardson * @param dev_id 236999a2dd95SBruce Richardson * The identifier of the device. 237099a2dd95SBruce Richardson * 237199a2dd95SBruce Richardson * @param f 237299a2dd95SBruce Richardson * A pointer to a file for output 237399a2dd95SBruce Richardson * 237499a2dd95SBruce Richardson * @return 237599a2dd95SBruce Richardson * - 0: on success 237699a2dd95SBruce Richardson * - <0: on failure. 237799a2dd95SBruce Richardson */ 237899a2dd95SBruce Richardson int 237999a2dd95SBruce Richardson rte_event_dev_dump(uint8_t dev_id, FILE *f); 238099a2dd95SBruce Richardson 238199a2dd95SBruce Richardson /** Maximum name length for extended statistics counters */ 238299a2dd95SBruce Richardson #define RTE_EVENT_DEV_XSTATS_NAME_SIZE 64 238399a2dd95SBruce Richardson 238499a2dd95SBruce Richardson /** 238599a2dd95SBruce Richardson * Selects the component of the eventdev to retrieve statistics from. 238699a2dd95SBruce Richardson */ 238799a2dd95SBruce Richardson enum rte_event_dev_xstats_mode { 238899a2dd95SBruce Richardson RTE_EVENT_DEV_XSTATS_DEVICE, 238999a2dd95SBruce Richardson RTE_EVENT_DEV_XSTATS_PORT, 239099a2dd95SBruce Richardson RTE_EVENT_DEV_XSTATS_QUEUE, 239199a2dd95SBruce Richardson }; 239299a2dd95SBruce Richardson 239399a2dd95SBruce Richardson /** 239499a2dd95SBruce Richardson * A name-key lookup element for extended statistics. 239599a2dd95SBruce Richardson * 239699a2dd95SBruce Richardson * This structure is used to map between names and ID numbers 239799a2dd95SBruce Richardson * for extended ethdev statistics. 239899a2dd95SBruce Richardson */ 239999a2dd95SBruce Richardson struct rte_event_dev_xstats_name { 240099a2dd95SBruce Richardson char name[RTE_EVENT_DEV_XSTATS_NAME_SIZE]; 240199a2dd95SBruce Richardson }; 240299a2dd95SBruce Richardson 240399a2dd95SBruce Richardson /** 240499a2dd95SBruce Richardson * Retrieve names of extended statistics of an event device. 240599a2dd95SBruce Richardson * 240699a2dd95SBruce Richardson * @param dev_id 240799a2dd95SBruce Richardson * The identifier of the event device. 240899a2dd95SBruce Richardson * @param mode 240999a2dd95SBruce Richardson * The mode of statistics to retrieve. Choices include the device statistics, 241099a2dd95SBruce Richardson * port statistics or queue statistics. 241199a2dd95SBruce Richardson * @param queue_port_id 241299a2dd95SBruce Richardson * Used to specify the port or queue number in queue or port mode, and is 241399a2dd95SBruce Richardson * ignored in device mode. 241499a2dd95SBruce Richardson * @param[out] xstats_names 241599a2dd95SBruce Richardson * Block of memory to insert names into. Must be at least size in capacity. 241699a2dd95SBruce Richardson * If set to NULL, function returns required capacity. 241799a2dd95SBruce Richardson * @param[out] ids 241899a2dd95SBruce Richardson * Block of memory to insert ids into. Must be at least size in capacity. 241999a2dd95SBruce Richardson * If set to NULL, function returns required capacity. The id values returned 242099a2dd95SBruce Richardson * can be passed to *rte_event_dev_xstats_get* to select statistics. 242199a2dd95SBruce Richardson * @param size 242299a2dd95SBruce Richardson * Capacity of xstats_names (number of names). 242399a2dd95SBruce Richardson * @return 242499a2dd95SBruce Richardson * - positive value lower or equal to size: success. The return value 242599a2dd95SBruce Richardson * is the number of entries filled in the stats table. 242699a2dd95SBruce Richardson * - positive value higher than size: error, the given statistics table 242799a2dd95SBruce Richardson * is too small. The return value corresponds to the size that should 242899a2dd95SBruce Richardson * be given to succeed. The entries in the table are not valid and 242999a2dd95SBruce Richardson * shall not be used by the caller. 243099a2dd95SBruce Richardson * - negative value on error: 243199a2dd95SBruce Richardson * -ENODEV for invalid *dev_id* 243299a2dd95SBruce Richardson * -EINVAL for invalid mode, queue port or id parameters 243399a2dd95SBruce Richardson * -ENOTSUP if the device doesn't support this function. 243499a2dd95SBruce Richardson */ 243599a2dd95SBruce Richardson int 243699a2dd95SBruce Richardson rte_event_dev_xstats_names_get(uint8_t dev_id, 243799a2dd95SBruce Richardson enum rte_event_dev_xstats_mode mode, 243899a2dd95SBruce Richardson uint8_t queue_port_id, 243999a2dd95SBruce Richardson struct rte_event_dev_xstats_name *xstats_names, 24401bdfe4d7SPavan Nikhilesh uint64_t *ids, 244199a2dd95SBruce Richardson unsigned int size); 244299a2dd95SBruce Richardson 244399a2dd95SBruce Richardson /** 244499a2dd95SBruce Richardson * Retrieve extended statistics of an event device. 244599a2dd95SBruce Richardson * 244699a2dd95SBruce Richardson * @param dev_id 244799a2dd95SBruce Richardson * The identifier of the device. 244899a2dd95SBruce Richardson * @param mode 244999a2dd95SBruce Richardson * The mode of statistics to retrieve. Choices include the device statistics, 245099a2dd95SBruce Richardson * port statistics or queue statistics. 245199a2dd95SBruce Richardson * @param queue_port_id 245299a2dd95SBruce Richardson * Used to specify the port or queue number in queue or port mode, and is 245399a2dd95SBruce Richardson * ignored in device mode. 245499a2dd95SBruce Richardson * @param ids 245599a2dd95SBruce Richardson * The id numbers of the stats to get. The ids can be got from the stat 245699a2dd95SBruce Richardson * position in the stat list from rte_event_dev_get_xstats_names(), or 245799a2dd95SBruce Richardson * by using rte_event_dev_xstats_by_name_get(). 245899a2dd95SBruce Richardson * @param[out] values 245999a2dd95SBruce Richardson * The values for each stats request by ID. 246099a2dd95SBruce Richardson * @param n 246199a2dd95SBruce Richardson * The number of stats requested 246299a2dd95SBruce Richardson * @return 246399a2dd95SBruce Richardson * - positive value: number of stat entries filled into the values array 246499a2dd95SBruce Richardson * - negative value on error: 246599a2dd95SBruce Richardson * -ENODEV for invalid *dev_id* 246699a2dd95SBruce Richardson * -EINVAL for invalid mode, queue port or id parameters 246799a2dd95SBruce Richardson * -ENOTSUP if the device doesn't support this function. 246899a2dd95SBruce Richardson */ 246999a2dd95SBruce Richardson int 247099a2dd95SBruce Richardson rte_event_dev_xstats_get(uint8_t dev_id, 247199a2dd95SBruce Richardson enum rte_event_dev_xstats_mode mode, 247299a2dd95SBruce Richardson uint8_t queue_port_id, 24731bdfe4d7SPavan Nikhilesh const uint64_t ids[], 247499a2dd95SBruce Richardson uint64_t values[], unsigned int n); 247599a2dd95SBruce Richardson 247699a2dd95SBruce Richardson /** 247799a2dd95SBruce Richardson * Retrieve the value of a single stat by requesting it by name. 247899a2dd95SBruce Richardson * 247999a2dd95SBruce Richardson * @param dev_id 248099a2dd95SBruce Richardson * The identifier of the device 248199a2dd95SBruce Richardson * @param name 248299a2dd95SBruce Richardson * The stat name to retrieve 248399a2dd95SBruce Richardson * @param[out] id 248499a2dd95SBruce Richardson * If non-NULL, the numerical id of the stat will be returned, so that further 248599a2dd95SBruce Richardson * requests for the stat can be got using rte_event_dev_xstats_get, which will 248699a2dd95SBruce Richardson * be faster as it doesn't need to scan a list of names for the stat. 248799a2dd95SBruce Richardson * If the stat cannot be found, the id returned will be (unsigned)-1. 248899a2dd95SBruce Richardson * @return 248999a2dd95SBruce Richardson * - positive value or zero: the stat value 249099a2dd95SBruce Richardson * - negative value: -EINVAL if stat not found, -ENOTSUP if not supported. 249199a2dd95SBruce Richardson */ 249299a2dd95SBruce Richardson uint64_t 249399a2dd95SBruce Richardson rte_event_dev_xstats_by_name_get(uint8_t dev_id, const char *name, 24941bdfe4d7SPavan Nikhilesh uint64_t *id); 249599a2dd95SBruce Richardson 249699a2dd95SBruce Richardson /** 249799a2dd95SBruce Richardson * Reset the values of the xstats of the selected component in the device. 249899a2dd95SBruce Richardson * 249999a2dd95SBruce Richardson * @param dev_id 250099a2dd95SBruce Richardson * The identifier of the device 250199a2dd95SBruce Richardson * @param mode 250299a2dd95SBruce Richardson * The mode of the statistics to reset. Choose from device, queue or port. 250399a2dd95SBruce Richardson * @param queue_port_id 250499a2dd95SBruce Richardson * The queue or port to reset. 0 and positive values select ports and queues, 250599a2dd95SBruce Richardson * while -1 indicates all ports or queues. 250699a2dd95SBruce Richardson * @param ids 250799a2dd95SBruce Richardson * Selects specific statistics to be reset. When NULL, all statistics selected 250899a2dd95SBruce Richardson * by *mode* will be reset. If non-NULL, must point to array of at least 250999a2dd95SBruce Richardson * *nb_ids* size. 251099a2dd95SBruce Richardson * @param nb_ids 251199a2dd95SBruce Richardson * The number of ids available from the *ids* array. Ignored when ids is NULL. 251299a2dd95SBruce Richardson * @return 251399a2dd95SBruce Richardson * - zero: successfully reset the statistics to zero 251499a2dd95SBruce Richardson * - negative value: -EINVAL invalid parameters, -ENOTSUP if not supported. 251599a2dd95SBruce Richardson */ 251699a2dd95SBruce Richardson int 251799a2dd95SBruce Richardson rte_event_dev_xstats_reset(uint8_t dev_id, 251899a2dd95SBruce Richardson enum rte_event_dev_xstats_mode mode, 251999a2dd95SBruce Richardson int16_t queue_port_id, 25201bdfe4d7SPavan Nikhilesh const uint64_t ids[], 252199a2dd95SBruce Richardson uint32_t nb_ids); 252299a2dd95SBruce Richardson 252399a2dd95SBruce Richardson /** 252499a2dd95SBruce Richardson * Trigger the eventdev self test. 252599a2dd95SBruce Richardson * 252699a2dd95SBruce Richardson * @param dev_id 252799a2dd95SBruce Richardson * The identifier of the device 252899a2dd95SBruce Richardson * @return 252999a2dd95SBruce Richardson * - 0: Selftest successful 253099a2dd95SBruce Richardson * - -ENOTSUP if the device doesn't support selftest 253199a2dd95SBruce Richardson * - other values < 0 on failure. 253299a2dd95SBruce Richardson */ 253399a2dd95SBruce Richardson int rte_event_dev_selftest(uint8_t dev_id); 253499a2dd95SBruce Richardson 253599a2dd95SBruce Richardson /** 253699a2dd95SBruce Richardson * Get the memory required per event vector based on the number of elements per 253799a2dd95SBruce Richardson * vector. 253899a2dd95SBruce Richardson * This should be used to create the mempool that holds the event vectors. 253999a2dd95SBruce Richardson * 254099a2dd95SBruce Richardson * @param name 254199a2dd95SBruce Richardson * The name of the vector pool. 254299a2dd95SBruce Richardson * @param n 254399a2dd95SBruce Richardson * The number of elements in the mbuf pool. 254499a2dd95SBruce Richardson * @param cache_size 254599a2dd95SBruce Richardson * Size of the per-core object cache. See rte_mempool_create() for 254699a2dd95SBruce Richardson * details. 254799a2dd95SBruce Richardson * @param nb_elem 254899a2dd95SBruce Richardson * The number of elements that a single event vector should be able to hold. 254999a2dd95SBruce Richardson * @param socket_id 255099a2dd95SBruce Richardson * The socket identifier where the memory should be allocated. The 255199a2dd95SBruce Richardson * value can be *SOCKET_ID_ANY* if there is no NUMA constraint for the 255299a2dd95SBruce Richardson * reserved zone 255399a2dd95SBruce Richardson * 255499a2dd95SBruce Richardson * @return 255599a2dd95SBruce Richardson * The pointer to the newly allocated mempool, on success. NULL on error 255699a2dd95SBruce Richardson * with rte_errno set appropriately. Possible rte_errno values include: 255799a2dd95SBruce Richardson * - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure 255899a2dd95SBruce Richardson * - E_RTE_SECONDARY - function was called from a secondary process instance 255999a2dd95SBruce Richardson * - EINVAL - cache size provided is too large, or priv_size is not aligned. 256099a2dd95SBruce Richardson * - ENOSPC - the maximum number of memzones has already been allocated 256199a2dd95SBruce Richardson * - EEXIST - a memzone with the same name already exists 256299a2dd95SBruce Richardson * - ENOMEM - no appropriate memory area found in which to create memzone 256399a2dd95SBruce Richardson * - ENAMETOOLONG - mempool name requested is too long. 256499a2dd95SBruce Richardson */ 256599a2dd95SBruce Richardson struct rte_mempool * 256699a2dd95SBruce Richardson rte_event_vector_pool_create(const char *name, unsigned int n, 256799a2dd95SBruce Richardson unsigned int cache_size, uint16_t nb_elem, 256899a2dd95SBruce Richardson int socket_id); 256999a2dd95SBruce Richardson 257026f14535SPavan Nikhilesh #include <rte_eventdev_core.h> 257126f14535SPavan Nikhilesh 2572719834a6SMattias Rönnblom #ifdef __cplusplus 2573719834a6SMattias Rönnblom extern "C" { 2574719834a6SMattias Rönnblom #endif 2575719834a6SMattias Rönnblom 257626f14535SPavan Nikhilesh static __rte_always_inline uint16_t 257726f14535SPavan Nikhilesh __rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id, 257826f14535SPavan Nikhilesh const struct rte_event ev[], uint16_t nb_events, 257926f14535SPavan Nikhilesh const event_enqueue_burst_t fn) 258026f14535SPavan Nikhilesh { 2581052e25d9SPavan Nikhilesh const struct rte_event_fp_ops *fp_ops; 2582052e25d9SPavan Nikhilesh void *port; 258326f14535SPavan Nikhilesh 2584052e25d9SPavan Nikhilesh fp_ops = &rte_event_fp_ops[dev_id]; 2585052e25d9SPavan Nikhilesh port = fp_ops->data[port_id]; 258626f14535SPavan Nikhilesh #ifdef RTE_LIBRTE_EVENTDEV_DEBUG 2587052e25d9SPavan Nikhilesh if (dev_id >= RTE_EVENT_MAX_DEVS || 2588052e25d9SPavan Nikhilesh port_id >= RTE_EVENT_MAX_PORTS_PER_DEV) { 258926f14535SPavan Nikhilesh rte_errno = EINVAL; 259026f14535SPavan Nikhilesh return 0; 259126f14535SPavan Nikhilesh } 259226f14535SPavan Nikhilesh 2593052e25d9SPavan Nikhilesh if (port == NULL) { 259426f14535SPavan Nikhilesh rte_errno = EINVAL; 259526f14535SPavan Nikhilesh return 0; 259626f14535SPavan Nikhilesh } 259726f14535SPavan Nikhilesh #endif 2598153e7d88SBruce Richardson rte_eventdev_trace_enq_burst(dev_id, port_id, ev, nb_events, (void *)fn); 2599*34e3ad3aSMattias Rönnblom 2600052e25d9SPavan Nikhilesh return fn(port, ev, nb_events); 260126f14535SPavan Nikhilesh } 260226f14535SPavan Nikhilesh 260326f14535SPavan Nikhilesh /** 260426f14535SPavan Nikhilesh * Enqueue a burst of events objects or an event object supplied in *rte_event* 260526f14535SPavan Nikhilesh * structure on an event device designated by its *dev_id* through the event 260626f14535SPavan Nikhilesh * port specified by *port_id*. Each event object specifies the event queue on 260726f14535SPavan Nikhilesh * which it will be enqueued. 260826f14535SPavan Nikhilesh * 260926f14535SPavan Nikhilesh * The *nb_events* parameter is the number of event objects to enqueue which are 261026f14535SPavan Nikhilesh * supplied in the *ev* array of *rte_event* structure. 261126f14535SPavan Nikhilesh * 261226f14535SPavan Nikhilesh * Event operations RTE_EVENT_OP_FORWARD and RTE_EVENT_OP_RELEASE must only be 261326f14535SPavan Nikhilesh * enqueued to the same port that their associated events were dequeued from. 261426f14535SPavan Nikhilesh * 261526f14535SPavan Nikhilesh * The rte_event_enqueue_burst() function returns the number of 261626f14535SPavan Nikhilesh * events objects it actually enqueued. A return value equal to *nb_events* 261726f14535SPavan Nikhilesh * means that all event objects have been enqueued. 261826f14535SPavan Nikhilesh * 261926f14535SPavan Nikhilesh * @param dev_id 262026f14535SPavan Nikhilesh * The identifier of the device. 262126f14535SPavan Nikhilesh * @param port_id 262226f14535SPavan Nikhilesh * The identifier of the event port. 262326f14535SPavan Nikhilesh * @param ev 262426f14535SPavan Nikhilesh * Points to an array of *nb_events* objects of type *rte_event* structure 262526f14535SPavan Nikhilesh * which contain the event object enqueue operations to be processed. 262626f14535SPavan Nikhilesh * @param nb_events 262726f14535SPavan Nikhilesh * The number of event objects to enqueue, typically number of 262826f14535SPavan Nikhilesh * rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...) 262926f14535SPavan Nikhilesh * available for this port. 263026f14535SPavan Nikhilesh * 263126f14535SPavan Nikhilesh * @return 263226f14535SPavan Nikhilesh * The number of event objects actually enqueued on the event device. The 263326f14535SPavan Nikhilesh * return value can be less than the value of the *nb_events* parameter when 263426f14535SPavan Nikhilesh * the event devices queue is full or if invalid parameters are specified in a 263526f14535SPavan Nikhilesh * *rte_event*. If the return value is less than *nb_events*, the remaining 263626f14535SPavan Nikhilesh * events at the end of ev[] are not consumed and the caller has to take care 263726f14535SPavan Nikhilesh * of them, and rte_errno is set accordingly. Possible errno values include: 263826f14535SPavan Nikhilesh * - EINVAL The port ID is invalid, device ID is invalid, an event's queue 263926f14535SPavan Nikhilesh * ID is invalid, or an event's sched type doesn't match the 264026f14535SPavan Nikhilesh * capabilities of the destination queue. 264126f14535SPavan Nikhilesh * - ENOSPC The event port was backpressured and unable to enqueue 264226f14535SPavan Nikhilesh * one or more events. This error code is only applicable to 264326f14535SPavan Nikhilesh * closed systems. 264426f14535SPavan Nikhilesh * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH 264526f14535SPavan Nikhilesh */ 264626f14535SPavan Nikhilesh static inline uint16_t 264726f14535SPavan Nikhilesh rte_event_enqueue_burst(uint8_t dev_id, uint8_t port_id, 264826f14535SPavan Nikhilesh const struct rte_event ev[], uint16_t nb_events) 264926f14535SPavan Nikhilesh { 2650052e25d9SPavan Nikhilesh const struct rte_event_fp_ops *fp_ops; 265126f14535SPavan Nikhilesh 2652052e25d9SPavan Nikhilesh fp_ops = &rte_event_fp_ops[dev_id]; 265326f14535SPavan Nikhilesh return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events, 2654052e25d9SPavan Nikhilesh fp_ops->enqueue_burst); 265526f14535SPavan Nikhilesh } 265626f14535SPavan Nikhilesh 265726f14535SPavan Nikhilesh /** 265826f14535SPavan Nikhilesh * Enqueue a burst of events objects of operation type *RTE_EVENT_OP_NEW* on 265926f14535SPavan Nikhilesh * an event device designated by its *dev_id* through the event port specified 266026f14535SPavan Nikhilesh * by *port_id*. 266126f14535SPavan Nikhilesh * 266226f14535SPavan Nikhilesh * Provides the same functionality as rte_event_enqueue_burst(), expect that 266326f14535SPavan Nikhilesh * application can use this API when the all objects in the burst contains 266426f14535SPavan Nikhilesh * the enqueue operation of the type *RTE_EVENT_OP_NEW*. This specialized 266526f14535SPavan Nikhilesh * function can provide the additional hint to the PMD and optimize if possible. 266626f14535SPavan Nikhilesh * 266726f14535SPavan Nikhilesh * The rte_event_enqueue_new_burst() result is undefined if the enqueue burst 266826f14535SPavan Nikhilesh * has event object of operation type != RTE_EVENT_OP_NEW. 266926f14535SPavan Nikhilesh * 267026f14535SPavan Nikhilesh * @param dev_id 267126f14535SPavan Nikhilesh * The identifier of the device. 267226f14535SPavan Nikhilesh * @param port_id 267326f14535SPavan Nikhilesh * The identifier of the event port. 267426f14535SPavan Nikhilesh * @param ev 267526f14535SPavan Nikhilesh * Points to an array of *nb_events* objects of type *rte_event* structure 267626f14535SPavan Nikhilesh * which contain the event object enqueue operations to be processed. 267726f14535SPavan Nikhilesh * @param nb_events 267826f14535SPavan Nikhilesh * The number of event objects to enqueue, typically number of 267926f14535SPavan Nikhilesh * rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...) 268026f14535SPavan Nikhilesh * available for this port. 268126f14535SPavan Nikhilesh * 268226f14535SPavan Nikhilesh * @return 268326f14535SPavan Nikhilesh * The number of event objects actually enqueued on the event device. The 268426f14535SPavan Nikhilesh * return value can be less than the value of the *nb_events* parameter when 268526f14535SPavan Nikhilesh * the event devices queue is full or if invalid parameters are specified in a 268626f14535SPavan Nikhilesh * *rte_event*. If the return value is less than *nb_events*, the remaining 268726f14535SPavan Nikhilesh * events at the end of ev[] are not consumed and the caller has to take care 268826f14535SPavan Nikhilesh * of them, and rte_errno is set accordingly. Possible errno values include: 268926f14535SPavan Nikhilesh * - EINVAL The port ID is invalid, device ID is invalid, an event's queue 269026f14535SPavan Nikhilesh * ID is invalid, or an event's sched type doesn't match the 269126f14535SPavan Nikhilesh * capabilities of the destination queue. 269226f14535SPavan Nikhilesh * - ENOSPC The event port was backpressured and unable to enqueue 269326f14535SPavan Nikhilesh * one or more events. This error code is only applicable to 269426f14535SPavan Nikhilesh * closed systems. 269526f14535SPavan Nikhilesh * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH 269626f14535SPavan Nikhilesh * @see rte_event_enqueue_burst() 269726f14535SPavan Nikhilesh */ 269826f14535SPavan Nikhilesh static inline uint16_t 269926f14535SPavan Nikhilesh rte_event_enqueue_new_burst(uint8_t dev_id, uint8_t port_id, 270026f14535SPavan Nikhilesh const struct rte_event ev[], uint16_t nb_events) 270126f14535SPavan Nikhilesh { 2702052e25d9SPavan Nikhilesh const struct rte_event_fp_ops *fp_ops; 270326f14535SPavan Nikhilesh 2704052e25d9SPavan Nikhilesh fp_ops = &rte_event_fp_ops[dev_id]; 270526f14535SPavan Nikhilesh return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events, 2706052e25d9SPavan Nikhilesh fp_ops->enqueue_new_burst); 270726f14535SPavan Nikhilesh } 270826f14535SPavan Nikhilesh 270926f14535SPavan Nikhilesh /** 271026f14535SPavan Nikhilesh * Enqueue a burst of events objects of operation type *RTE_EVENT_OP_FORWARD* 271126f14535SPavan Nikhilesh * on an event device designated by its *dev_id* through the event port 271226f14535SPavan Nikhilesh * specified by *port_id*. 271326f14535SPavan Nikhilesh * 271426f14535SPavan Nikhilesh * Provides the same functionality as rte_event_enqueue_burst(), expect that 271526f14535SPavan Nikhilesh * application can use this API when the all objects in the burst contains 271626f14535SPavan Nikhilesh * the enqueue operation of the type *RTE_EVENT_OP_FORWARD*. This specialized 271726f14535SPavan Nikhilesh * function can provide the additional hint to the PMD and optimize if possible. 271826f14535SPavan Nikhilesh * 271926f14535SPavan Nikhilesh * The rte_event_enqueue_new_burst() result is undefined if the enqueue burst 272026f14535SPavan Nikhilesh * has event object of operation type != RTE_EVENT_OP_FORWARD. 272126f14535SPavan Nikhilesh * 272226f14535SPavan Nikhilesh * @param dev_id 272326f14535SPavan Nikhilesh * The identifier of the device. 272426f14535SPavan Nikhilesh * @param port_id 272526f14535SPavan Nikhilesh * The identifier of the event port. 272626f14535SPavan Nikhilesh * @param ev 272726f14535SPavan Nikhilesh * Points to an array of *nb_events* objects of type *rte_event* structure 272826f14535SPavan Nikhilesh * which contain the event object enqueue operations to be processed. 272926f14535SPavan Nikhilesh * @param nb_events 273026f14535SPavan Nikhilesh * The number of event objects to enqueue, typically number of 273126f14535SPavan Nikhilesh * rte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...) 273226f14535SPavan Nikhilesh * available for this port. 273326f14535SPavan Nikhilesh * 273426f14535SPavan Nikhilesh * @return 273526f14535SPavan Nikhilesh * The number of event objects actually enqueued on the event device. The 273626f14535SPavan Nikhilesh * return value can be less than the value of the *nb_events* parameter when 273726f14535SPavan Nikhilesh * the event devices queue is full or if invalid parameters are specified in a 273826f14535SPavan Nikhilesh * *rte_event*. If the return value is less than *nb_events*, the remaining 273926f14535SPavan Nikhilesh * events at the end of ev[] are not consumed and the caller has to take care 274026f14535SPavan Nikhilesh * of them, and rte_errno is set accordingly. Possible errno values include: 274126f14535SPavan Nikhilesh * - EINVAL The port ID is invalid, device ID is invalid, an event's queue 274226f14535SPavan Nikhilesh * ID is invalid, or an event's sched type doesn't match the 274326f14535SPavan Nikhilesh * capabilities of the destination queue. 274426f14535SPavan Nikhilesh * - ENOSPC The event port was backpressured and unable to enqueue 274526f14535SPavan Nikhilesh * one or more events. This error code is only applicable to 274626f14535SPavan Nikhilesh * closed systems. 274726f14535SPavan Nikhilesh * @see rte_event_port_attr_get(), RTE_EVENT_PORT_ATTR_ENQ_DEPTH 274826f14535SPavan Nikhilesh * @see rte_event_enqueue_burst() 274926f14535SPavan Nikhilesh */ 275026f14535SPavan Nikhilesh static inline uint16_t 275126f14535SPavan Nikhilesh rte_event_enqueue_forward_burst(uint8_t dev_id, uint8_t port_id, 275226f14535SPavan Nikhilesh const struct rte_event ev[], uint16_t nb_events) 275326f14535SPavan Nikhilesh { 2754052e25d9SPavan Nikhilesh const struct rte_event_fp_ops *fp_ops; 275526f14535SPavan Nikhilesh 2756052e25d9SPavan Nikhilesh fp_ops = &rte_event_fp_ops[dev_id]; 275726f14535SPavan Nikhilesh return __rte_event_enqueue_burst(dev_id, port_id, ev, nb_events, 2758052e25d9SPavan Nikhilesh fp_ops->enqueue_forward_burst); 275926f14535SPavan Nikhilesh } 276026f14535SPavan Nikhilesh 276126f14535SPavan Nikhilesh /** 276226f14535SPavan Nikhilesh * Dequeue a burst of events objects or an event object from the event port 276326f14535SPavan Nikhilesh * designated by its *event_port_id*, on an event device designated 276426f14535SPavan Nikhilesh * by its *dev_id*. 276526f14535SPavan Nikhilesh * 276626f14535SPavan Nikhilesh * rte_event_dequeue_burst() does not dictate the specifics of scheduling 276726f14535SPavan Nikhilesh * algorithm as each eventdev driver may have different criteria to schedule 276826f14535SPavan Nikhilesh * an event. However, in general, from an application perspective scheduler may 276926f14535SPavan Nikhilesh * use the following scheme to dispatch an event to the port. 277026f14535SPavan Nikhilesh * 277126f14535SPavan Nikhilesh * 1) Selection of event queue based on 277226f14535SPavan Nikhilesh * a) The list of event queues are linked to the event port. 277326f14535SPavan Nikhilesh * b) If the device has RTE_EVENT_DEV_CAP_QUEUE_QOS capability then event 277426f14535SPavan Nikhilesh * queue selection from list is based on event queue priority relative to 277526f14535SPavan Nikhilesh * other event queue supplied as *priority* in rte_event_queue_setup() 277626f14535SPavan Nikhilesh * c) If the device has RTE_EVENT_DEV_CAP_EVENT_QOS capability then event 277726f14535SPavan Nikhilesh * queue selection from the list is based on event priority supplied as 277826f14535SPavan Nikhilesh * *priority* in rte_event_enqueue_burst() 277926f14535SPavan Nikhilesh * 2) Selection of event 278026f14535SPavan Nikhilesh * a) The number of flows available in selected event queue. 278126f14535SPavan Nikhilesh * b) Schedule type method associated with the event 278226f14535SPavan Nikhilesh * 278326f14535SPavan Nikhilesh * The *nb_events* parameter is the maximum number of event objects to dequeue 278426f14535SPavan Nikhilesh * which are returned in the *ev* array of *rte_event* structure. 278526f14535SPavan Nikhilesh * 278626f14535SPavan Nikhilesh * The rte_event_dequeue_burst() function returns the number of events objects 278726f14535SPavan Nikhilesh * it actually dequeued. A return value equal to *nb_events* means that all 278826f14535SPavan Nikhilesh * event objects have been dequeued. 278926f14535SPavan Nikhilesh * 279026f14535SPavan Nikhilesh * The number of events dequeued is the number of scheduler contexts held by 279126f14535SPavan Nikhilesh * this port. These contexts are automatically released in the next 279226f14535SPavan Nikhilesh * rte_event_dequeue_burst() invocation if the port supports implicit 279326f14535SPavan Nikhilesh * releases, or invoking rte_event_enqueue_burst() with RTE_EVENT_OP_RELEASE 279426f14535SPavan Nikhilesh * operation can be used to release the contexts early. 279526f14535SPavan Nikhilesh * 279626f14535SPavan Nikhilesh * Event operations RTE_EVENT_OP_FORWARD and RTE_EVENT_OP_RELEASE must only be 279726f14535SPavan Nikhilesh * enqueued to the same port that their associated events were dequeued from. 279826f14535SPavan Nikhilesh * 279926f14535SPavan Nikhilesh * @param dev_id 280026f14535SPavan Nikhilesh * The identifier of the device. 280126f14535SPavan Nikhilesh * @param port_id 280226f14535SPavan Nikhilesh * The identifier of the event port. 280326f14535SPavan Nikhilesh * @param[out] ev 280426f14535SPavan Nikhilesh * Points to an array of *nb_events* objects of type *rte_event* structure 280526f14535SPavan Nikhilesh * for output to be populated with the dequeued event objects. 280626f14535SPavan Nikhilesh * @param nb_events 280726f14535SPavan Nikhilesh * The maximum number of event objects to dequeue, typically number of 280826f14535SPavan Nikhilesh * rte_event_port_dequeue_depth() available for this port. 280926f14535SPavan Nikhilesh * 281026f14535SPavan Nikhilesh * @param timeout_ticks 281126f14535SPavan Nikhilesh * - 0 no-wait, returns immediately if there is no event. 281226f14535SPavan Nikhilesh * - >0 wait for the event, if the device is configured with 281326f14535SPavan Nikhilesh * RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT then this function will wait until 281426f14535SPavan Nikhilesh * at least one event is available or *timeout_ticks* time. 281526f14535SPavan Nikhilesh * if the device is not configured with RTE_EVENT_DEV_CFG_PER_DEQUEUE_TIMEOUT 281626f14535SPavan Nikhilesh * then this function will wait until the event available or 281726f14535SPavan Nikhilesh * *dequeue_timeout_ns* ns which was previously supplied to 281826f14535SPavan Nikhilesh * rte_event_dev_configure() 281926f14535SPavan Nikhilesh * 282026f14535SPavan Nikhilesh * @return 282126f14535SPavan Nikhilesh * The number of event objects actually dequeued from the port. The return 282226f14535SPavan Nikhilesh * value can be less than the value of the *nb_events* parameter when the 282326f14535SPavan Nikhilesh * event port's queue is not full. 282426f14535SPavan Nikhilesh * 282526f14535SPavan Nikhilesh * @see rte_event_port_dequeue_depth() 282626f14535SPavan Nikhilesh */ 282726f14535SPavan Nikhilesh static inline uint16_t 282826f14535SPavan Nikhilesh rte_event_dequeue_burst(uint8_t dev_id, uint8_t port_id, struct rte_event ev[], 282926f14535SPavan Nikhilesh uint16_t nb_events, uint64_t timeout_ticks) 283026f14535SPavan Nikhilesh { 2831052e25d9SPavan Nikhilesh const struct rte_event_fp_ops *fp_ops; 2832052e25d9SPavan Nikhilesh void *port; 283326f14535SPavan Nikhilesh 2834052e25d9SPavan Nikhilesh fp_ops = &rte_event_fp_ops[dev_id]; 2835052e25d9SPavan Nikhilesh port = fp_ops->data[port_id]; 283626f14535SPavan Nikhilesh #ifdef RTE_LIBRTE_EVENTDEV_DEBUG 2837052e25d9SPavan Nikhilesh if (dev_id >= RTE_EVENT_MAX_DEVS || 2838052e25d9SPavan Nikhilesh port_id >= RTE_EVENT_MAX_PORTS_PER_DEV) { 283926f14535SPavan Nikhilesh rte_errno = EINVAL; 284026f14535SPavan Nikhilesh return 0; 284126f14535SPavan Nikhilesh } 284226f14535SPavan Nikhilesh 2843052e25d9SPavan Nikhilesh if (port == NULL) { 284426f14535SPavan Nikhilesh rte_errno = EINVAL; 284526f14535SPavan Nikhilesh return 0; 284626f14535SPavan Nikhilesh } 284726f14535SPavan Nikhilesh #endif 284826f14535SPavan Nikhilesh rte_eventdev_trace_deq_burst(dev_id, port_id, ev, nb_events); 2849*34e3ad3aSMattias Rönnblom 2850*34e3ad3aSMattias Rönnblom return (fp_ops->dequeue_burst)(port, ev, nb_events, timeout_ticks); 285126f14535SPavan Nikhilesh } 285226f14535SPavan Nikhilesh 285354f17843SMattias Rönnblom #define RTE_EVENT_DEV_MAINT_OP_FLUSH (1 << 0) 285454f17843SMattias Rönnblom /**< Force an immediately flush of any buffered events in the port, 285554f17843SMattias Rönnblom * potentially at the cost of additional overhead. 285654f17843SMattias Rönnblom * 285754f17843SMattias Rönnblom * @see rte_event_maintain() 285854f17843SMattias Rönnblom */ 285954f17843SMattias Rönnblom 286054f17843SMattias Rönnblom /** 286154f17843SMattias Rönnblom * Maintain an event device. 286254f17843SMattias Rönnblom * 2863bd991897SMattias Rönnblom * This function is only relevant for event devices which do not have 2864bd991897SMattias Rönnblom * the @ref RTE_EVENT_DEV_CAP_MAINTENANCE_FREE flag set. Such devices 286554f17843SMattias Rönnblom * require an application thread using a particular port to 286654f17843SMattias Rönnblom * periodically call rte_event_maintain() on that port during periods 286754f17843SMattias Rönnblom * which it is neither attempting to enqueue events to nor dequeue 286854f17843SMattias Rönnblom * events from the port. rte_event_maintain() is a low-overhead 286954f17843SMattias Rönnblom * function and should be called at a high rate (e.g., in the 287054f17843SMattias Rönnblom * application's poll loop). 287154f17843SMattias Rönnblom * 287254f17843SMattias Rönnblom * No port may be left unmaintained. 287354f17843SMattias Rönnblom * 287454f17843SMattias Rönnblom * At the application thread's convenience, rte_event_maintain() may 287554f17843SMattias Rönnblom * (but is not required to) be called even during periods when enqueue 287654f17843SMattias Rönnblom * or dequeue functions are being called, at the cost of a slight 287754f17843SMattias Rönnblom * increase in overhead. 287854f17843SMattias Rönnblom * 2879bd991897SMattias Rönnblom * rte_event_maintain() may be called on event devices which have set 2880bd991897SMattias Rönnblom * @ref RTE_EVENT_DEV_CAP_MAINTENANCE_FREE, in which case it is a 2881bd991897SMattias Rönnblom * no-operation. 288254f17843SMattias Rönnblom * 288354f17843SMattias Rönnblom * @param dev_id 288454f17843SMattias Rönnblom * The identifier of the device. 288554f17843SMattias Rönnblom * @param port_id 288654f17843SMattias Rönnblom * The identifier of the event port. 288754f17843SMattias Rönnblom * @param op 288854f17843SMattias Rönnblom * 0, or @ref RTE_EVENT_DEV_MAINT_OP_FLUSH. 288954f17843SMattias Rönnblom * @return 289054f17843SMattias Rönnblom * - 0 on success. 289154f17843SMattias Rönnblom * - -EINVAL if *dev_id*, *port_id*, or *op* is invalid. 289254f17843SMattias Rönnblom * 2893bd991897SMattias Rönnblom * @see RTE_EVENT_DEV_CAP_MAINTENANCE_FREE 289454f17843SMattias Rönnblom */ 289554f17843SMattias Rönnblom static inline int 289654f17843SMattias Rönnblom rte_event_maintain(uint8_t dev_id, uint8_t port_id, int op) 289754f17843SMattias Rönnblom { 289854f17843SMattias Rönnblom const struct rte_event_fp_ops *fp_ops; 289954f17843SMattias Rönnblom void *port; 290054f17843SMattias Rönnblom 290154f17843SMattias Rönnblom fp_ops = &rte_event_fp_ops[dev_id]; 290254f17843SMattias Rönnblom port = fp_ops->data[port_id]; 290354f17843SMattias Rönnblom #ifdef RTE_LIBRTE_EVENTDEV_DEBUG 290454f17843SMattias Rönnblom if (dev_id >= RTE_EVENT_MAX_DEVS || 290554f17843SMattias Rönnblom port_id >= RTE_EVENT_MAX_PORTS_PER_DEV) 290654f17843SMattias Rönnblom return -EINVAL; 290754f17843SMattias Rönnblom 290854f17843SMattias Rönnblom if (port == NULL) 290954f17843SMattias Rönnblom return -EINVAL; 291054f17843SMattias Rönnblom 291154f17843SMattias Rönnblom if (op & (~RTE_EVENT_DEV_MAINT_OP_FLUSH)) 291254f17843SMattias Rönnblom return -EINVAL; 291354f17843SMattias Rönnblom #endif 291454f17843SMattias Rönnblom rte_eventdev_trace_maintain(dev_id, port_id, op); 291554f17843SMattias Rönnblom 291654f17843SMattias Rönnblom if (fp_ops->maintain != NULL) 291754f17843SMattias Rönnblom fp_ops->maintain(port, op); 291854f17843SMattias Rönnblom 291954f17843SMattias Rönnblom return 0; 292054f17843SMattias Rönnblom } 292154f17843SMattias Rönnblom 2922d007a7f3SPavan Nikhilesh /** 2923d007a7f3SPavan Nikhilesh * Change the active profile on an event port. 2924d007a7f3SPavan Nikhilesh * 2925d007a7f3SPavan Nikhilesh * This function is used to change the current active profile on an event port 2926d007a7f3SPavan Nikhilesh * when multiple link profiles are configured on an event port through the 2927d007a7f3SPavan Nikhilesh * function call ``rte_event_port_profile_links_set``. 2928d007a7f3SPavan Nikhilesh * 2929d007a7f3SPavan Nikhilesh * On the subsequent ``rte_event_dequeue_burst`` call, only the event queues 2930d007a7f3SPavan Nikhilesh * that were associated with the newly active profile will participate in 2931d007a7f3SPavan Nikhilesh * scheduling. 2932d007a7f3SPavan Nikhilesh * 2933d007a7f3SPavan Nikhilesh * @param dev_id 2934d007a7f3SPavan Nikhilesh * The identifier of the device. 2935d007a7f3SPavan Nikhilesh * @param port_id 2936d007a7f3SPavan Nikhilesh * The identifier of the event port. 2937d007a7f3SPavan Nikhilesh * @param profile_id 2938d007a7f3SPavan Nikhilesh * The identifier of the profile. 2939d007a7f3SPavan Nikhilesh * @return 2940d007a7f3SPavan Nikhilesh * - 0 on success. 2941d007a7f3SPavan Nikhilesh * - -EINVAL if *dev_id*, *port_id*, or *profile_id* is invalid. 2942d007a7f3SPavan Nikhilesh */ 2943d007a7f3SPavan Nikhilesh static inline uint8_t 2944d007a7f3SPavan Nikhilesh rte_event_port_profile_switch(uint8_t dev_id, uint8_t port_id, uint8_t profile_id) 2945d007a7f3SPavan Nikhilesh { 2946d007a7f3SPavan Nikhilesh const struct rte_event_fp_ops *fp_ops; 2947d007a7f3SPavan Nikhilesh void *port; 2948d007a7f3SPavan Nikhilesh 2949d007a7f3SPavan Nikhilesh fp_ops = &rte_event_fp_ops[dev_id]; 2950d007a7f3SPavan Nikhilesh port = fp_ops->data[port_id]; 2951d007a7f3SPavan Nikhilesh 2952d007a7f3SPavan Nikhilesh #ifdef RTE_LIBRTE_EVENTDEV_DEBUG 2953d007a7f3SPavan Nikhilesh if (dev_id >= RTE_EVENT_MAX_DEVS || 2954d007a7f3SPavan Nikhilesh port_id >= RTE_EVENT_MAX_PORTS_PER_DEV) 2955d007a7f3SPavan Nikhilesh return -EINVAL; 2956d007a7f3SPavan Nikhilesh 2957d007a7f3SPavan Nikhilesh if (port == NULL) 2958d007a7f3SPavan Nikhilesh return -EINVAL; 2959d007a7f3SPavan Nikhilesh 2960d007a7f3SPavan Nikhilesh if (profile_id >= RTE_EVENT_MAX_PROFILES_PER_PORT) 2961d007a7f3SPavan Nikhilesh return -EINVAL; 2962d007a7f3SPavan Nikhilesh #endif 2963d007a7f3SPavan Nikhilesh rte_eventdev_trace_port_profile_switch(dev_id, port_id, profile_id); 2964d007a7f3SPavan Nikhilesh 2965d007a7f3SPavan Nikhilesh return fp_ops->profile_switch(port, profile_id); 2966d007a7f3SPavan Nikhilesh } 2967d007a7f3SPavan Nikhilesh 2968c1bdd86dSPavan Nikhilesh /** 2969c1bdd86dSPavan Nikhilesh * Modify the pre-schedule type to use on an event port. 2970c1bdd86dSPavan Nikhilesh * 2971c1bdd86dSPavan Nikhilesh * This function is used to change the current pre-schedule type configured 2972c1bdd86dSPavan Nikhilesh * on an event port, the pre-schedule type can be set to none to disable pre-scheduling. 2973c1bdd86dSPavan Nikhilesh * This effects the subsequent ``rte_event_dequeue_burst`` call. 2974c1bdd86dSPavan Nikhilesh * The event device should support RTE_EVENT_DEV_CAP_PER_PORT_PRESCHEDULE capability. 2975c1bdd86dSPavan Nikhilesh * 2976c1bdd86dSPavan Nikhilesh * To avoid fastpath capability checks if an event device does not support 2977c1bdd86dSPavan Nikhilesh * RTE_EVENT_DEV_CAP_PER_PORT_PRESCHEDULE capability, then this function will 2978c1bdd86dSPavan Nikhilesh * return -ENOTSUP. 2979c1bdd86dSPavan Nikhilesh * 2980c1bdd86dSPavan Nikhilesh * @param dev_id 2981c1bdd86dSPavan Nikhilesh * The identifier of the device. 2982c1bdd86dSPavan Nikhilesh * @param port_id 2983c1bdd86dSPavan Nikhilesh * The identifier of the event port. 2984c1bdd86dSPavan Nikhilesh * @param type 2985c1bdd86dSPavan Nikhilesh * The preschedule type to use on the event port. 2986c1bdd86dSPavan Nikhilesh * @return 2987c1bdd86dSPavan Nikhilesh * - 0 on success. 2988c1bdd86dSPavan Nikhilesh * - -EINVAL if *dev_id*, *port_id*, or *type* is invalid. 2989c1bdd86dSPavan Nikhilesh * - -ENOTSUP if the device does not support per port preschedule capability. 2990c1bdd86dSPavan Nikhilesh */ 2991c1bdd86dSPavan Nikhilesh __rte_experimental 2992c1bdd86dSPavan Nikhilesh static inline int 2993c1bdd86dSPavan Nikhilesh rte_event_port_preschedule_modify(uint8_t dev_id, uint8_t port_id, 2994c1bdd86dSPavan Nikhilesh enum rte_event_dev_preschedule_type type) 2995c1bdd86dSPavan Nikhilesh { 2996c1bdd86dSPavan Nikhilesh const struct rte_event_fp_ops *fp_ops; 2997c1bdd86dSPavan Nikhilesh void *port; 2998c1bdd86dSPavan Nikhilesh 2999c1bdd86dSPavan Nikhilesh fp_ops = &rte_event_fp_ops[dev_id]; 3000c1bdd86dSPavan Nikhilesh port = fp_ops->data[port_id]; 3001c1bdd86dSPavan Nikhilesh 3002c1bdd86dSPavan Nikhilesh #ifdef RTE_LIBRTE_EVENTDEV_DEBUG 3003c1bdd86dSPavan Nikhilesh if (dev_id >= RTE_EVENT_MAX_DEVS || port_id >= RTE_EVENT_MAX_PORTS_PER_DEV) 3004c1bdd86dSPavan Nikhilesh return -EINVAL; 3005c1bdd86dSPavan Nikhilesh 3006c1bdd86dSPavan Nikhilesh if (port == NULL) 3007c1bdd86dSPavan Nikhilesh return -EINVAL; 3008c1bdd86dSPavan Nikhilesh #endif 3009c1bdd86dSPavan Nikhilesh rte_eventdev_trace_port_preschedule_modify(dev_id, port_id, type); 3010c1bdd86dSPavan Nikhilesh 3011c1bdd86dSPavan Nikhilesh return fp_ops->preschedule_modify(port, type); 3012c1bdd86dSPavan Nikhilesh } 3013c1bdd86dSPavan Nikhilesh 30144ade669cSPavan Nikhilesh /** 30154ade669cSPavan Nikhilesh * Provide a hint to the event device to pre-schedule events to event port . 30164ade669cSPavan Nikhilesh * 30174ade669cSPavan Nikhilesh * Hint the event device to pre-schedule events to the event port. 30184ade669cSPavan Nikhilesh * The call doesn't not guarantee that the events will be pre-scheduleed. 30194ade669cSPavan Nikhilesh * The call doesn't release the flow context currently held by the event port. 30204ade669cSPavan Nikhilesh * The event device should support RTE_EVENT_DEV_CAP_PRESCHEDULE_EXPLICIT capability. 30214ade669cSPavan Nikhilesh * 30224ade669cSPavan Nikhilesh * When pre-scheduling is enabled at an event device/port level or if 30234ade669cSPavan Nikhilesh * the capability is not supported, then the hint is ignored. 30244ade669cSPavan Nikhilesh * 30254ade669cSPavan Nikhilesh * Subsequent calls to rte_event_dequeue_burst() will dequeue the pre-schedule 30264ade669cSPavan Nikhilesh * events but pre-schedule operation is not issued again. 30274ade669cSPavan Nikhilesh * 30284ade669cSPavan Nikhilesh * @param dev_id 30294ade669cSPavan Nikhilesh * The identifier of the device. 30304ade669cSPavan Nikhilesh * @param port_id 30314ade669cSPavan Nikhilesh * The identifier of the event port. 30324ade669cSPavan Nikhilesh * @param type 30334ade669cSPavan Nikhilesh * The pre-schedule type to use on the event port. 30344ade669cSPavan Nikhilesh */ 30354ade669cSPavan Nikhilesh __rte_experimental 30364ade669cSPavan Nikhilesh static inline void 30374ade669cSPavan Nikhilesh rte_event_port_preschedule(uint8_t dev_id, uint8_t port_id, 30384ade669cSPavan Nikhilesh enum rte_event_dev_preschedule_type type) 30394ade669cSPavan Nikhilesh { 30404ade669cSPavan Nikhilesh const struct rte_event_fp_ops *fp_ops; 30414ade669cSPavan Nikhilesh void *port; 30424ade669cSPavan Nikhilesh 30434ade669cSPavan Nikhilesh fp_ops = &rte_event_fp_ops[dev_id]; 30444ade669cSPavan Nikhilesh port = fp_ops->data[port_id]; 30454ade669cSPavan Nikhilesh 30464ade669cSPavan Nikhilesh #ifdef RTE_LIBRTE_EVENTDEV_DEBUG 30474ade669cSPavan Nikhilesh if (dev_id >= RTE_EVENT_MAX_DEVS || port_id >= RTE_EVENT_MAX_PORTS_PER_DEV) 30484ade669cSPavan Nikhilesh return; 30494ade669cSPavan Nikhilesh if (port == NULL) 30504ade669cSPavan Nikhilesh return; 30514ade669cSPavan Nikhilesh #endif 30524ade669cSPavan Nikhilesh rte_eventdev_trace_port_preschedule(dev_id, port_id, type); 30534ade669cSPavan Nikhilesh 30544ade669cSPavan Nikhilesh fp_ops->preschedule(port, type); 30554ade669cSPavan Nikhilesh } 305699a2dd95SBruce Richardson #ifdef __cplusplus 305799a2dd95SBruce Richardson } 305899a2dd95SBruce Richardson #endif 305999a2dd95SBruce Richardson 306099a2dd95SBruce Richardson #endif /* _RTE_EVENTDEV_H_ */ 3061