rte_event_dma_adapter.h(3)
πΈ rte_event_dma_adapter.h πΈ
okay bestie, welcome to the DMA Event Adapter API β it's a C header from the rte_event_dma_adapter.h manual (section 3, Library Functions Manual), and it is so much. grab a snack, we're doing this. π«Ά
β¨ NAME β¨
rte_event_dma_adapter.h β literally the DMA Event Adapter API, right there in the name, no notes π
β¨ SYNOPSIS β¨
#include <stdint.h>
#include <rte_common.h>
#include <rte_dmadev.h>
#include <rte_eventdev.h>
π Data Structures
struct rte_event_dma_adapter_confstruct rte_event_dma_adapter_runtime_paramsstruct rte_event_dma_adapter_stats
π Typedefs
typedef int(* rte_event_dma_adapter_conf_cb) (uint8_t id, uint8_t evdev_id, struct rte_event_dma_adapter_conf *conf, void *arg)
π Enumerations
enum rte_event_dma_adapter_mode { RTE_EVENT_DMA_ADAPTER_OP_NEW, RTE_EVENT_DMA_ADAPTER_OP_FORWARD }
π Functions
__rte_experimental int rte_event_dma_adapter_create_ext (uint8_t id, uint8_t evdev_id, rte_event_dma_adapter_conf_cb conf_cb, enum rte_event_dma_adapter_mode mode, void *conf_arg)__rte_experimental int rte_event_dma_adapter_create (uint8_t id, uint8_t evdev_id, struct rte_event_port_conf *port_config, enum rte_event_dma_adapter_mode mode)__rte_experimental int rte_event_dma_adapter_free (uint8_t id)__rte_experimental int rte_event_dma_adapter_event_port_get (uint8_t id, uint8_t *event_port_id)__rte_experimental int rte_event_dma_adapter_vchan_add (uint8_t id, int16_t dmadev_id, uint16_t vchan, const struct rte_event *event)__rte_experimental int rte_event_dma_adapter_vchan_del (uint8_t id, int16_t dmadev_id, uint16_t vchan)__rte_experimental int rte_event_dma_adapter_service_id_get (uint8_t id, uint32_t *service_id)__rte_experimental int rte_event_dma_adapter_start (uint8_t id)__rte_experimental int rte_event_dma_adapter_stop (uint8_t id)__rte_experimental int rte_event_dma_adapter_runtime_params_init (struct rte_event_dma_adapter_runtime_params *params)__rte_experimental int rte_event_dma_adapter_runtime_params_set (uint8_t id, struct rte_event_dma_adapter_runtime_params *params)__rte_experimental int rte_event_dma_adapter_runtime_params_get (uint8_t id, struct rte_event_dma_adapter_runtime_params *params)__rte_experimental int rte_event_dma_adapter_stats_get (uint8_t id, struct rte_event_dma_adapter_stats *stats)__rte_experimental int rte_event_dma_adapter_stats_reset (uint8_t id)__rte_experimental uint16_t rte_event_dma_adapter_enqueue (uint8_t evdev_id, uint8_t port_id, struct rte_event ev[], uint16_t nb_events)
β¨ Detailed Description β¨
β οΈ Warning β EXPERIMENTAL: all functions in this file may be changed or removed without prior notice. bestie that is not a drill, they said without prior notice π
DMA Event Adapter API. that's the whole vibe.
So here's the tea: the eventdev library ships adapters that bridge between different components so you get a brand new event source. The event DMA adapter is one of those adapters, and its whole job is bridging between event devices and DMA devices. iconic behavior honestly π¦
The DMA adapter adds support for enqueue / dequeue DMA operations to / from the event device. The packet flow between the DMA device and the event device can be done with both SW and HW based transfer mechanisms. For SW based packet transfer, the adapter uses an EAL service core function; for HW based packet transfer between the DMA device and the event device, it uses the eventdev PMD functions to configure it. two paths, one adapter, we love range β¨
The application can choose to submit a DMA operation directly to a DMA device, or send it to the DMA adapter via eventdev β that choice hinges on the RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_OP_FWD capability. First mode = the event new mode (RTE_EVENT_DMA_ADAPTER_OP_NEW), second = the event forward mode (RTE_EVENT_DMA_ADAPTER_OP_FORWARD). You pick the mode while creating the adapter. In the former mode, it is an application responsibility to enable ingress packet ordering. In the latter mode, it is the adapter responsibility to enable the ingress packet ordering. know the difference, it matters π
Working model of RTE_EVENT_DMA_ADAPTER_OP_NEW mode:
+--------------+ +--------------+
| | | DMA stage |
| Application |---[2]-->| + enqueue to |
| | | dmadev |
+--------------+ +--------------+
^ ^ |
| | [3]
[6] [1] |
| | |
+--------------+ |
| | |
| Event device | |
| | |
+--------------+ |
^ |
| |
[5] |
| v
+--------------+ +--------------+
| | | |
| DMA adapter |<--[4]---| dmadev |
| | | |
+--------------+ +--------------+
[1]Application dequeues events from the previous stage.[2]Application prepares the DMA operations.[3]DMA operations are submitted to dmadev by application.[4]DMA adapter dequeues DMA completions from dmadev.[5]DMA adapter enqueues events to the eventdev.[6]Application dequeues from eventdev for further processing.
In the RTE_EVENT_DMA_ADAPTER_OP_NEW mode, the application submits DMA operations directly to the DMA device. Then the DMA adapter dequeues DMA completions from the DMA device and enqueues events to the event device. π«Ά
β οΈ heads up: this mode does not ensure ingress ordering if the application directly enqueues to dmadev without going through a DMA / atomic stage β i.e. if you remove item[1]and[2]. so don't do that and then act surprised, bestie π
Events dequeued from the adapter will be treated as new events. In this mode, the application needs to specify event information (response information) which is needed to enqueue an event after the DMA operation is completed.
Working model of RTE_EVENT_DMA_ADAPTER_OP_FORWARD mode:
+--------------+ +--------------+
--[1]-->| |---[2]-->| Application |
| Event device | | in |
<--[8]--| |<--[3]---| Ordered stage|
+--------------+ +--------------+
^ |
| [4]
[7] |
| v
+----------------+ +--------------+
| |--[5]->| |
| DMA adapter | | dmadev |
| |<-[6]--| |
+----------------+ +--------------+
[1]Events from the previous stage.[2]Application in ordered stage dequeues events from eventdev.[3]Application enqueues DMA operations as events to eventdev.[4]DMA adapter dequeues event from eventdev.[5]DMA adapter submits DMA operations to dmadev (Atomic stage).[6]DMA adapter dequeues DMA completions from dmadev[7]DMA adapter enqueues events to the eventdev[8]Events to the next stage
In the event forward (RTE_EVENT_DMA_ADAPTER_OP_FORWARD) mode, if the HW supports the capability RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_OP_FWD, the application can directly submit the DMA operations to the dmadev. If the HW does not support it, the application retrieves the event port of the DMA adapter through the API rte_event_DMA_adapter_event_port_get(), then links its event queue to this port and starts enqueuing DMA operations as events to the eventdev. The adapter then dequeues the events and submits the DMA operations to the dmadev. After the DMA completions, the adapter enqueues events to the event device. chef's kiss pipeline π₯
Application can use this mode when ingress packet ordering is needed. Events dequeued from the adapter will be treated as forwarded events. In this mode, the application needs to specify the dmadev ID and queue pair ID (request information) needed to enqueue a DMA operation, in addition to the event information (response information) needed to enqueue an event after the DMA operation has completed.
The event DMA adapter provides common APIs to configure the packet flow from the DMA device to event devices for both SW and HW based transfers. The DMA event adapter's functions are:
rte_event_dma_adapter_create_ext()rte_event_dma_adapter_create()rte_event_dma_adapter_free()rte_event_dma_adapter_vchan_add()rte_event_dma_adapter_vchan_del()rte_event_dma_adapter_start()rte_event_dma_adapter_stop()rte_event_dma_adapter_stats_get()rte_event_dma_adapter_stats_reset()
The application creates an instance using rte_event_dma_adapter_create() or rte_event_dma_adapter_create_ext().
dmadev queue pair addition / deletion is done using the rte_event_dma_adapter_vchan_add() / rte_event_dma_adapter_vchan_del() APIs. If HW supports the capability RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_VCHAN_EV_BIND, event information must be passed to the add API. no skipping that, fr fr πΈ
Definition in file rte_event_dma_adapter.h.
β¨ Typedef Documentation β¨
π¦ typedef int(* rte_event_dma_adapter_conf_cb) (uint8_t id, uint8_t evdev_id, struct rte_event_dma_adapter_conf *conf, void *arg)
Function type used for the adapter configuration callback. The callback is used to fill in members of the struct rte_event_dma_adapter_conf. It gets invoked when creating a SW service for packet transfer from dmadev vchan to the event device. That SW service is created inside the function rte_event_dma_adapter_vchan_add() β but only if SW based packet transfers from dmadev vchan to the event device are actually required. lowkey conditional, highkey important π
Parameters
idβ Adapter identifier.evdev_idβ Event device identifier.confβ Structure that needs to be populated by this callback.argβ Argument to the callback. This is the same as theconf_argpassed to therte_event_dma_adapter_create_ext().
Definition at line 234 of file rte_event_dma_adapter.h.
β¨ Enumeration Type Documentation β¨
π enum rte_event_dma_adapter_mode
DMA event adapter mode. two modes, choose wisely bestie β¨
Enumerator
π RTE_EVENT_DMA_ADAPTER_OP_NEW
Start the DMA adapter in event new mode.
See also: RTE_EVENT_OP_NEW.
The application submits DMA operations to the dmadev. The adapter only dequeues the DMA completions from dmadev and enqueues events to the eventdev. that's it, that's the job π«Ά
π RTE_EVENT_DMA_ADAPTER_OP_FORWARD
Start the DMA adapter in event forward mode.
See also: RTE_EVENT_OP_FORWARD.
The application submits DMA requests as events to the DMA adapter or the DMA device, based on the RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_OP_FWD capability. DMA completions are enqueued back to the eventdev by the DMA adapter. iconic teamwork π
Definition at line 157 of file rte_event_dma_adapter.h.
β¨ Function Documentation β¨
okay bestie, this is the part where we meet the actual functions β every single one, no skips, no cap π
π rte_event_dma_adapter_create_ext()
__rte_experimental int rte_event_dma_adapter_create_ext(uint8_t id, uint8_t evdev_id, rte_event_dma_adapter_conf_cb conf_cb, enum rte_event_dma_adapter_mode mode, void * conf_arg)
Create a new event DMA adapter with the specified identifier. It's giving βbuild me an adapter, Iβll handle the configβ energy β¨
Parameters:
idβ Adapter identifier.evdev_idβ Event device identifier.conf_cbβ Callback function that fills in members of astruct rte_event_dma_adapter_confstruct passed into it.modeβ Flag to indicate the mode of the adapter.
See also: rte_event_dma_adapter_mode
More parameters:
conf_argβ Argument that is passed to theconf_cbfunction.
Returns:
0: Success π<0: Error code on failure π
π¦ rte_event_dma_adapter_create()
__rte_experimental int rte_event_dma_adapter_create(uint8_t id, uint8_t evdev_id, struct rte_event_port_conf * port_config, enum rte_event_dma_adapter_mode mode)
Create a new event DMA adapter with the specified identifier. This function uses an internal configuration function that creates an event port. This default function reconfigures the event device with an additional event port and set up the event port using the port_config parameter passed into this function. In case the application needs more control in configuration of the service, it should use the rte_event_dma_adapter_create_ext() version. That's the tea β
Parameters:
idβ Adapter identifier.evdev_idβ Event device identifier.port_configβ Argument of typerte_event_port_confthat is passed to theconf_cbfunction.modeβ Flag to indicate the mode of the adapter.
See also: rte_event_dma_adapter_mode
Returns:
0: Success β¨<0: Error code on failure π
π§ rte_event_dma_adapter_free()
__rte_experimental int rte_event_dma_adapter_free(uint8_t id)
Free an event DMA adapter. Say bye bestie π
Parameters:
idβ Adapter identifier.
Returns:
0: Success<0: Error code on failure, If the adapter still has queue pairs added to it, the function returns-EBUSY.
πΈ rte_event_dma_adapter_event_port_get()
__rte_experimental int rte_event_dma_adapter_event_port_get(uint8_t id, uint8_t * event_port_id)
Retrieve the event port of an adapter.
Parameters:
idβ Adapter identifier.event_port_idβ Application links its event queue to this adapter port which is used inRTE_EVENT_DMA_ADAPTER_OP_FORWARDmode.
Returns:
0: Success<0: Error code on failure.
π rte_event_dma_adapter_vchan_add()
__rte_experimental int rte_event_dma_adapter_vchan_add(uint8_t id, int16_t dmadev_id, uint16_t vchan, const struct rte_event * event)
Add a vchan to an event DMA adapter.
Parameters:
idβ Adapter identifier.dmadev_idβ dmadev identifier.vchanβ DMA device vchan identifier. If vchan is set-1, adapter adds all the preconfigured vchan to the instance.eventβ If HW supports dmadev vchan to event queue binding, application is expected to fill in event information, else it will beNULL.
See also: RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_VCHAN_EV_BIND
Returns:
0: Success, vchan added correctly.<0: Error code on failure.
π rte_event_dma_adapter_vchan_del()
__rte_experimental int rte_event_dma_adapter_vchan_del(uint8_t id, int16_t dmadev_id, uint16_t vchan)
Delete a vchan from an event DMA adapter. Not me deleting my exes π
Parameters:
idβ Adapter identifier.dmadev_idβ DMA device identifier.vchanβ DMA device vchan identifier.
Returns:
0: Success, vchan deleted successfully.<0: Error code on failure.
π rte_event_dma_adapter_service_id_get()
__rte_experimental int rte_event_dma_adapter_service_id_get(uint8_t id, uint32_t * service_id)
Retrieve the service ID of an adapter. If the adapter doesn't use a rte_service function, this function returns -ESRCH.
Parameters:
idβ Adapter identifier.service_idβ A pointer to auint32_t, to be filled in with the service id.
Returns:
0: Success<0: Error code on failure, if the adapter doesn't use arte_servicefunction, this function returns-ESRCH.
π₯ rte_event_dma_adapter_start()
__rte_experimental int rte_event_dma_adapter_start(uint8_t id)
Start event DMA adapter. Let's gooo π
Parameters:
idβ Adapter identifier.
Returns:
0: Success, adapter started successfully.<0: Error code on failure.
Note: The eventdev and dmadev to which theevent_dma_adapteris connected should be started before callingrte_event_dma_adapter_start().
π rte_event_dma_adapter_stop()
__rte_experimental int rte_event_dma_adapter_stop(uint8_t id)
Stop event DMA adapter. Put it in park bestie β
Parameters:
idβ Adapter identifier.
Returns:
0: Success, adapter stopped successfully.<0: Error code on failure.
β rte_event_dma_adapter_runtime_params_init()
__rte_experimental int rte_event_dma_adapter_runtime_params_init(struct rte_event_dma_adapter_runtime_params * params)
Initialize the adapter runtime configuration parameters.
Parameters:
paramsβ A pointer to structure of typestruct rte_event_dma_adapter_runtime_params
Returns:
0: Success<0: Error code on failure
β¨ rte_event_dma_adapter_runtime_params_set()
__rte_experimental int rte_event_dma_adapter_runtime_params_set(uint8_t id, struct rte_event_dma_adapter_runtime_params * params)
Set the adapter runtime configuration parameters.
Parameters:
idβ Adapter identifierparamsβ A pointer to structure of typestruct rte_event_dma_adapter_runtime_paramswith configuration parameter values. The reserved fields of this structure must be initialized to zero and the valid fields need to be set appropriately. This struct can be initialized usingrte_event_dma_adapter_runtime_params_init()API to default values or application may reset this struct and update required fields.
Returns:
0: Success<0: Error code on failure
π¦ rte_event_dma_adapter_runtime_params_get()
__rte_experimental int rte_event_dma_adapter_runtime_params_get(uint8_t id, struct rte_event_dma_adapter_runtime_params * params)
Get the adapter runtime configuration parameters.
Parameters:
idβ Adapter identifierparamsβ A pointer to structure of typestruct rte_event_dma_adapter_runtime_paramscontaining valid adapter parameters when return value is0.
Returns:
0: Success<0: Error code on failure
π rte_event_dma_adapter_stats_get()
__rte_experimental int rte_event_dma_adapter_stats_get(uint8_t id, struct rte_event_dma_adapter_stats * stats)
Retrieve statistics for an adapter.
Parameters:
idβ Adapter identifier.statsβ A pointer to structure used to retrieve statistics for an adapter.
Returns:
0: Success, retrieved successfully.<0: Error code on failure.
π rte_event_dma_adapter_stats_reset()
__rte_experimental int rte_event_dma_adapter_stats_reset(uint8_t id)
Reset statistics for an adapter.
Parameters:
idβ Adapter identifier.
Returns:
0: Success, statistics reset successfully.<0: Error code on failure.
π rte_event_dma_adapter_enqueue()
__rte_experimental uint16_t rte_event_dma_adapter_enqueue(uint8_t evdev_id, uint8_t port_id, struct rte_event ev[], uint16_t nb_events)
Enqueue a burst of DMA operations as event objects supplied in rte_event structure on an event DMA adapter designated by its event evdev_id through the event port specified by port_id. This function is supported if the eventdev PMD has the RTE_EVENT_DMA_ADAPTER_CAP_INTERNAL_PORT_OP_FWD capability flag set.
The nb_events parameter is the number of event objects to enqueue that are supplied in the ev array of rte_event structure.
The rte_event_dma_adapter_enqueue() function returns the number of event objects it actually enqueued. A return value equal to nb_events means that all event objects have been enqueued.
Parameters:
evdev_idβ The identifier of the device.port_idβ The identifier of the event port.evβ Points to an array ofnb_eventsobjects of typerte_eventstructure which contain the event object enqueue operations to be processed.nb_eventsβ The number of event objects to enqueue, typically number ofrte_event_port_attr_get(...RTE_EVENT_PORT_ATTR_ENQ_DEPTH...)available for this port.
Returns: The number of event objects actually enqueued on the event device. The return value can be less than the value of the nb_events parameter when the event devices queue is full or if invalid parameters are specified in a rte_event. If the return value is less than nb_events, the remaining events at the end of ev[] are not consumed and the caller has to take care of them, and rte_errno is set accordingly. Possible errno values include:
EINVAL: The port ID is invalid, device ID is invalid, an event's queue ID is invalid, or an event's sched type doesn't match the capabilities of the destination queue.ENOSPC: The event port was backpressured and unable to enqueue one or more events. This error code is only applicable to closed systems.
π Author π
Generated automatically by Doxygen for DPDK from the source code. Doxygen really said βI got you bestieβ π
Anyway, this iconic page is from DPDK Version 25.11.3, and it's rte_event_dma_adapter.h(3) β the footer didnβt show a date, but the source/version vibe is immaculate. Periodt. Bye bestie! πβ¨
π¦ where this page comes from
- ubuntu resolute: dpdk-doc 25.11.3-0ubuntu0.26.04.1 Β· BSD-3-Clause
- ubuntu stonking: dpdk-doc 25.11.3-1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms