DPDK 22.11.6
Data Structures | Macros | Typedefs | Functions
rte_event_eth_rx_adapter.h File Reference
#include <stdint.h>
#include <rte_compat.h>
#include <rte_service.h>
#include "rte_eventdev.h"

Go to the source code of this file.

Data Structures

struct  rte_event_eth_rx_adapter_conf
 
struct  rte_event_eth_rx_adapter_queue_conf
 
struct  rte_event_eth_rx_adapter_queue_stats
 
struct  rte_event_eth_rx_adapter_stats
 
struct  rte_event_eth_rx_adapter_vector_limits
 
struct  rte_event_eth_rx_adapter_params
 

Macros

#define RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID   0x1
 
#define RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR   0x2
 

Typedefs

typedef int(* rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t dev_id, struct rte_event_eth_rx_adapter_conf *conf, void *arg)
 
typedef uint16_t(* rte_event_eth_rx_adapter_cb_fn) (uint16_t eth_dev_id, uint16_t queue_id, uint32_t enqueue_buf_size, uint32_t enqueue_buf_count, struct rte_event *ev, uint16_t nb_event, void *cb_arg, uint16_t *nb_dropped)
 

Functions

int rte_event_eth_rx_adapter_create_ext (uint8_t id, uint8_t dev_id, rte_event_eth_rx_adapter_conf_cb conf_cb, void *conf_arg)
 
int rte_event_eth_rx_adapter_create (uint8_t id, uint8_t dev_id, struct rte_event_port_conf *port_config)
 
__rte_experimental int rte_event_eth_rx_adapter_create_with_params (uint8_t id, uint8_t dev_id, struct rte_event_port_conf *port_config, struct rte_event_eth_rx_adapter_params *rxa_params)
 
int rte_event_eth_rx_adapter_free (uint8_t id)
 
int rte_event_eth_rx_adapter_queue_add (uint8_t id, uint16_t eth_dev_id, int32_t rx_queue_id, const struct rte_event_eth_rx_adapter_queue_conf *conf)
 
int rte_event_eth_rx_adapter_queue_del (uint8_t id, uint16_t eth_dev_id, int32_t rx_queue_id)
 
int rte_event_eth_rx_adapter_start (uint8_t id)
 
int rte_event_eth_rx_adapter_stop (uint8_t id)
 
int rte_event_eth_rx_adapter_stats_get (uint8_t id, struct rte_event_eth_rx_adapter_stats *stats)
 
int rte_event_eth_rx_adapter_stats_reset (uint8_t id)
 
int rte_event_eth_rx_adapter_service_id_get (uint8_t id, uint32_t *service_id)
 
int rte_event_eth_rx_adapter_cb_register (uint8_t id, uint16_t eth_dev_id, rte_event_eth_rx_adapter_cb_fn cb_fn, void *cb_arg)
 
int rte_event_eth_rx_adapter_vector_limits_get (uint8_t dev_id, uint16_t eth_port_id, struct rte_event_eth_rx_adapter_vector_limits *limits)
 
__rte_experimental int rte_event_eth_rx_adapter_queue_conf_get (uint8_t id, uint16_t eth_dev_id, uint16_t rx_queue_id, struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
 
__rte_experimental int rte_event_eth_rx_adapter_queue_stats_get (uint8_t id, uint16_t eth_dev_id, uint16_t rx_queue_id, struct rte_event_eth_rx_adapter_queue_stats *stats)
 
__rte_experimental int rte_event_eth_rx_adapter_queue_stats_reset (uint8_t id, uint16_t eth_dev_id, uint16_t rx_queue_id)
 
__rte_experimental int rte_event_eth_rx_adapter_event_port_get (uint8_t id, uint8_t *event_port_id)
 
__rte_experimental int rte_event_eth_rx_adapter_instance_get (uint16_t eth_dev_id, uint16_t rx_queue_id, uint8_t *rxa_inst_id)
 

Detailed Description

RTE Event Ethernet Rx Adapter

An eventdev-based packet processing application enqueues/dequeues mbufs to/from the event device. Packet flow from the ethernet device to the event device can be accomplished using either HW or SW mechanisms depending on the platform and the particular combination of ethernet and event devices. The event ethernet Rx adapter provides common APIs to configure the packet flow from the ethernet devices to event devices across both these transfer mechanisms.

The adapter uses a EAL service core function for SW based packet transfer and uses the eventdev PMD functions to configure HW based packet transfer between the ethernet device and the event device.

The ethernet Rx event adapter's functions are:

The application creates an ethernet to event adapter using rte_event_eth_rx_adapter_create_ext() or rte_event_eth_rx_adapter_create() or rte_event_eth_rx_adapter_create_with_params() functions. The adapter needs to know which ethernet rx queues to poll for mbufs as well as event device parameters such as the event queue identifier, event priority and scheduling type that the adapter should use when constructing events. The rte_event_eth_rx_adapter_queue_add() function is provided for this purpose. The servicing weight parameter in the rte_event_eth_rx_adapter_queue_conf is applicable when the Rx adapter uses a service core function and is intended to provide application control of the frequency of polling ethernet device receive queues, for example, the application may want to poll higher priority queues with a higher frequency but at the same time not starve lower priority queues completely. If this parameter is zero and the receive interrupt is enabled when configuring the device, the receive queue is interrupt driven; else, the queue is assigned a servicing weight of one.

The application can start/stop the adapter using the rte_event_eth_rx_adapter_start() and the rte_event_eth_rx_adapter_stop() functions. If the adapter uses a rte_service function, then the application is also required to assign a core to the service function and control the service core using the rte_service APIs. The rte_event_eth_rx_adapter_service_id_get() function can be used to retrieve the service function ID of the adapter in this case.

For SW based packet transfers, i.e., when the RTE_EVENT_ETH_RX_ADAPTER_CAP_INTERNAL_PORT is not set in the adapter's capabilities flags for a particular ethernet device, the service function temporarily enqueues events to an event buffer before batch enqueuing these to the event device. If the buffer fills up, the service function stops dequeuing packets from the ethernet device. The application may want to monitor the buffer fill level and instruct the service function to selectively buffer events. The application may also use some other criteria to decide which packets should enter the event device even when the event buffer fill level is low or may want to enqueue packets to an internal event port. The rte_event_eth_rx_adapter_cb_register() function allows the application to register a callback that selects which packets are enqueued to the event device by the SW adapter. The callback interface is event based so the callback can also modify the event data if it needs to.

Definition in file rte_event_eth_rx_adapter.h.

Macro Definition Documentation

◆ RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID

#define RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID   0x1

This flag indicates the flow identifier is valid

See also
rte_event_eth_rx_adapter_queue_conf::rx_queue_flags

Definition at line 101 of file rte_event_eth_rx_adapter.h.

◆ RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR

#define RTE_EVENT_ETH_RX_ADAPTER_QUEUE_EVENT_VECTOR   0x2

Typedef Documentation

◆ rte_event_eth_rx_adapter_conf_cb

typedef int(* rte_event_eth_rx_adapter_conf_cb) (uint8_t id, uint8_t dev_id, struct rte_event_eth_rx_adapter_conf *conf, void *arg)

Function type used for adapter configuration callback. The callback is used to fill in members of the struct rte_event_eth_rx_adapter_conf, this callback is invoked when creating a SW service for packet transfer from ethdev queues to the event device. The SW service is created within the rte_event_eth_rx_adapter_queue_add() function if SW based packet transfers from ethdev queues to the event device are required.

Parameters
idAdapter identifier.
dev_idEvent device identifier.
[out]confStructure that needs to be populated by this callback.
argArgument to the callback. This is the same as the conf_arg passed to the rte_event_eth_rx_adapter_create_ext().

Definition at line 145 of file rte_event_eth_rx_adapter.h.

◆ rte_event_eth_rx_adapter_cb_fn

typedef uint16_t(* rte_event_eth_rx_adapter_cb_fn) (uint16_t eth_dev_id, uint16_t queue_id, uint32_t enqueue_buf_size, uint32_t enqueue_buf_count, struct rte_event *ev, uint16_t nb_event, void *cb_arg, uint16_t *nb_dropped)

Callback function invoked by the SW adapter before it continues to process events. The callback is passed the size of the enqueue buffer in the SW adapter and the occupancy of the buffer. The callback can use these values to decide which events are enqueued to the event device by the SW adapter. The callback may also enqueue events internally using its own event port. The SW adapter populates the event information based on the Rx queue configuration in the adapter. The callback can modify the this event information for the events to be enqueued by the SW adapter.

The callback return value is the number of events from the beginning of the event array that are to be enqueued by the SW adapter. It is the callback's responsibility to arrange these events at the beginning of the array, if these events are not contiguous in the original array. The nb_dropped parameter is a pointer to the number of events dropped by the callback, this number is used by the adapter to indicate the number of dropped packets as part of its statistics.

Parameters
eth_dev_idPort identifier of the Ethernet device.
queue_idReceive queue index.
enqueue_buf_sizeTotal enqueue buffer size.
enqueue_buf_countEvent count in enqueue buffer.
[in,out]evEvent array.
nb_eventEvent array length.
cb_argCallback argument.
[out]nb_droppedPackets dropped by callback.
Returns
  • The number of events to be enqueued by the SW adapter.

Definition at line 342 of file rte_event_eth_rx_adapter.h.

Function Documentation

◆ rte_event_eth_rx_adapter_create_ext()

int rte_event_eth_rx_adapter_create_ext ( uint8_t  id,
uint8_t  dev_id,
rte_event_eth_rx_adapter_conf_cb  conf_cb,
void *  conf_arg 
)

Create a new ethernet Rx event adapter with the specified identifier.

Parameters
idThe identifier of the ethernet Rx event adapter.
dev_idThe identifier of the device to configure.
conf_cbCallback function that fills in members of a struct rte_event_eth_rx_adapter_conf struct passed into it.
conf_argArgument that is passed to the conf_cb function.
Returns
  • 0: Success
  • <0: Error code on failure

◆ rte_event_eth_rx_adapter_create()

int rte_event_eth_rx_adapter_create ( uint8_t  id,
uint8_t  dev_id,
struct rte_event_port_conf port_config 
)

Create a new ethernet Rx event 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 setups 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_eth_rx_adapter_create_ext() version.

Parameters
idThe identifier of the ethernet Rx event adapter.
dev_idThe identifier of the device to configure.
port_configArgument of type rte_event_port_conf that is passed to the conf_cb function.
Returns
  • 0: Success
  • <0: Error code on failure
Examples
examples/eventdev_pipeline/pipeline_worker_generic.c, examples/eventdev_pipeline/pipeline_worker_tx.c, examples/ipsec-secgw/event_helper.c, examples/l2fwd-event/l2fwd_event_generic.c, examples/l2fwd-event/l2fwd_event_internal_port.c, examples/l3fwd/l3fwd_event_generic.c, and examples/l3fwd/l3fwd_event_internal_port.c.

◆ rte_event_eth_rx_adapter_create_with_params()

__rte_experimental int rte_event_eth_rx_adapter_create_with_params ( uint8_t  id,
uint8_t  dev_id,
struct rte_event_port_conf port_config,
struct rte_event_eth_rx_adapter_params rxa_params 
)

This is a variant of rte_event_eth_rx_adapter_create() with additional adapter params specified in struct rte_event_eth_rx_adapter_params.

Parameters
idThe identifier of the ethernet Rx event adapter.
dev_idThe identifier of the event device to configure.
port_configArgument of type rte_event_port_conf that is passed to the conf_cb function.
rxa_paramsPointer to struct rte_event_eth_rx_adapter_params. In case of NULL, default values are used.
Returns
  • 0: Success
  • <0: Error code on failure

◆ rte_event_eth_rx_adapter_free()

int rte_event_eth_rx_adapter_free ( uint8_t  id)

Free an event adapter

Parameters
idAdapter identifier.
Returns
  • 0: Success
  • <0: Error code on failure, If the adapter still has Rx queues added to it, the function returns -EBUSY.
Examples
examples/ipsec-secgw/event_helper.c.

◆ rte_event_eth_rx_adapter_queue_add()

int rte_event_eth_rx_adapter_queue_add ( uint8_t  id,
uint16_t  eth_dev_id,
int32_t  rx_queue_id,
const struct rte_event_eth_rx_adapter_queue_conf conf 
)

Add receive queue to an event adapter. After a queue has been added to the event adapter, the result of the application calling rte_eth_rx_burst(eth_dev_id, rx_queue_id, ..) is undefined.

Parameters
idAdapter identifier.
eth_dev_idPort identifier of Ethernet device.
rx_queue_idEthernet device receive queue index. If rx_queue_id is -1, then all Rx queues configured for the device are added. If the ethdev Rx queues can only be connected to a single event queue then rx_queue_id is required to be -1.
See also
RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ
Parameters
confAdditional configuration structure of type rte_event_eth_rx_adapter_queue_conf
Returns
  • 0: Success, Receive queue added correctly.
  • <0: Error code on failure.
  • (-EIO) device reconfiguration and restart error. The adapter reconfigures the event device with an additional port if it is required to use a service function for packet transfer from the ethernet device to the event device. If the device had been started before this call, this error code indicates an error in restart following an error in reconfiguration, i.e., a combination of the two error codes.
Examples
examples/eventdev_pipeline/pipeline_worker_generic.c, examples/eventdev_pipeline/pipeline_worker_tx.c, examples/ipsec-secgw/event_helper.c, examples/l2fwd-event/l2fwd_event_generic.c, examples/l2fwd-event/l2fwd_event_internal_port.c, examples/l3fwd/l3fwd_event_generic.c, and examples/l3fwd/l3fwd_event_internal_port.c.

◆ rte_event_eth_rx_adapter_queue_del()

int rte_event_eth_rx_adapter_queue_del ( uint8_t  id,
uint16_t  eth_dev_id,
int32_t  rx_queue_id 
)

Delete receive queue from an event adapter.

Parameters
idAdapter identifier.
eth_dev_idPort identifier of Ethernet device.
rx_queue_idEthernet device receive queue index. If rx_queue_id is -1, then all Rx queues configured for the device are deleted. If the ethdev Rx queues can only be connected to a single event queue then rx_queue_id is required to be -1.
See also
RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ
Returns
  • 0: Success, Receive queue deleted correctly.
  • <0: Error code on failure.
Examples
examples/ipsec-secgw/event_helper.c.

◆ rte_event_eth_rx_adapter_start()

int rte_event_eth_rx_adapter_start ( uint8_t  id)

Start ethernet Rx event adapter

Parameters
idAdapter identifier.
Returns
  • 0: Success, Adapter started correctly.
  • <0: Error code on failure.
Note
The eventdev to which the event_eth_rx_adapter is connected needs to be started before calling rte_event_eth_rx_adapter_start().
Examples
examples/eventdev_pipeline/pipeline_worker_generic.c, examples/eventdev_pipeline/pipeline_worker_tx.c, examples/ipsec-secgw/event_helper.c, examples/l2fwd-event/l2fwd_event_generic.c, examples/l2fwd-event/l2fwd_event_internal_port.c, examples/l3fwd/l3fwd_event_generic.c, and examples/l3fwd/l3fwd_event_internal_port.c.

◆ rte_event_eth_rx_adapter_stop()

int rte_event_eth_rx_adapter_stop ( uint8_t  id)

Stop ethernet Rx event adapter

Parameters
idAdapter identifier.
Returns
  • 0: Success, Adapter started correctly.
  • <0: Error code on failure.
Examples
examples/eventdev_pipeline/main.c, examples/ipsec-secgw/event_helper.c, examples/l2fwd-event/main.c, and examples/l3fwd/main.c.

◆ rte_event_eth_rx_adapter_stats_get()

int rte_event_eth_rx_adapter_stats_get ( uint8_t  id,
struct rte_event_eth_rx_adapter_stats stats 
)

Retrieve statistics for an adapter

Parameters
idAdapter identifier.
[out]statsA pointer to structure used to retrieve statistics for an adapter.
Returns
  • 0: Success, retrieved successfully.
  • <0: Error code on failure.
Examples
examples/l2fwd-event/main.c.

◆ rte_event_eth_rx_adapter_stats_reset()

int rte_event_eth_rx_adapter_stats_reset ( uint8_t  id)

Reset statistics for an adapter.

Parameters
idAdapter identifier.
Returns
  • 0: Success, statistics reset successfully.
  • <0: Error code on failure.

◆ rte_event_eth_rx_adapter_service_id_get()

int rte_event_eth_rx_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
idAdapter identifier.
[out]service_idA pointer to a uint32_t, to be filled in with the service id.
Returns
  • 0: Success
  • <0: Error code on failure, if the adapter doesn't use a rte_service function, this function returns -ESRCH.
Examples
examples/eventdev_pipeline/pipeline_worker_generic.c, examples/eventdev_pipeline/pipeline_worker_tx.c, examples/ipsec-secgw/event_helper.c, examples/l2fwd-event/l2fwd_event.c, examples/l2fwd-event/l2fwd_event_generic.c, examples/l3fwd/l3fwd_event_generic.c, and examples/l3fwd/main.c.

◆ rte_event_eth_rx_adapter_cb_register()

int rte_event_eth_rx_adapter_cb_register ( uint8_t  id,
uint16_t  eth_dev_id,
rte_event_eth_rx_adapter_cb_fn  cb_fn,
void *  cb_arg 
)

Register callback to process Rx packets, this is supported for SW based packet transfers.

See also
rte_event_eth_rx_cb_fn
Parameters
idAdapter identifier.
eth_dev_idPort identifier of Ethernet device.
cb_fnCallback function.
cb_argCallback arg.
Returns
  • 0: Success
  • <0: Error code on failure.

◆ rte_event_eth_rx_adapter_vector_limits_get()

int rte_event_eth_rx_adapter_vector_limits_get ( uint8_t  dev_id,
uint16_t  eth_port_id,
struct rte_event_eth_rx_adapter_vector_limits limits 
)

Retrieve vector limits for a given event dev and eth dev pair.

See also
rte_event_eth_rx_adapter_vector_limits
Parameters
dev_idEvent device identifier.
eth_port_idPort identifier of the ethernet device.
[out]limitsA pointer to rte_event_eth_rx_adapter_vector_limits structure that has to be filled.
Returns
  • 0: Success.
  • <0: Error code on failure.
Examples
examples/ipsec-secgw/event_helper.c.

◆ rte_event_eth_rx_adapter_queue_conf_get()

__rte_experimental int rte_event_eth_rx_adapter_queue_conf_get ( uint8_t  id,
uint16_t  eth_dev_id,
uint16_t  rx_queue_id,
struct rte_event_eth_rx_adapter_queue_conf queue_conf 
)

Retrieve Rx queue config information.

Parameters
idAdapter identifier.
eth_dev_idPort identifier of Ethernet device.
rx_queue_idEthernet device receive queue index.
[out]queue_confPointer to struct rte_event_eth_rx_adapter_queue_conf
Returns
  • 0: Success, Receive queue added correctly.
  • <0: Error code on failure.

◆ rte_event_eth_rx_adapter_queue_stats_get()

__rte_experimental int rte_event_eth_rx_adapter_queue_stats_get ( uint8_t  id,
uint16_t  eth_dev_id,
uint16_t  rx_queue_id,
struct rte_event_eth_rx_adapter_queue_stats stats 
)

Retrieve Rx queue statistics.

Parameters
idAdapter identifier.
eth_dev_idPort identifier of Ethernet device.
rx_queue_idEthernet device receive queue index.
[out]statsPointer to struct rte_event_eth_rx_adapter_queue_stats
Returns
  • 0: Success, queue buffer stats retrieved.
  • <0: Error code on failure.

◆ rte_event_eth_rx_adapter_queue_stats_reset()

__rte_experimental int rte_event_eth_rx_adapter_queue_stats_reset ( uint8_t  id,
uint16_t  eth_dev_id,
uint16_t  rx_queue_id 
)

Reset Rx queue statistics.

Parameters
idAdapter identifier.
eth_dev_idPort identifier of Ethernet device.
rx_queue_idEthernet device receive queue index.
Returns
  • 0: Success, queue buffer stats retrieved.
  • <0: Error code on failure.

◆ rte_event_eth_rx_adapter_event_port_get()

__rte_experimental int rte_event_eth_rx_adapter_event_port_get ( uint8_t  id,
uint8_t *  event_port_id 
)

Retrieve the event port ID of an adapter. If the adapter doesn't use a rte_service function, this function returns -ESRCH.

Parameters
idAdapter identifier.
[out]event_port_idA pointer to a uint8_t, to be filled in with the port id.
Returns
  • 0: Success
  • <0: Error code on failure, if the adapter doesn't use a rte_service function, this function returns -ESRCH.

◆ rte_event_eth_rx_adapter_instance_get()

__rte_experimental int rte_event_eth_rx_adapter_instance_get ( uint16_t  eth_dev_id,
uint16_t  rx_queue_id,
uint8_t *  rxa_inst_id 
)

Get RX adapter instance ID for a RX queue

Parameters
eth_dev_idPort identifier of Ethernet device.
rx_queue_idEthernet device receive queue index.
[out]rxa_inst_idPointer to store RX adapter instance identifier. Contains valid Rx adapter instance id when return value is 0
Returns
  • 0: Success
  • <0: Error code on failure