intrte_eth_iterator_init(structrte_dev_iterator*iter,constchar*devargs)
Initializes a device iterator.
This iterator allows accessing a list of devices matching some devargs.
Parametersiter Device iterator handle initialized by the function. The fields bus_str and cls_str might be
dynamically allocated, and could be freed by calling rte_eth_iterator_cleanup().
devargs Device description string.
Returns
0 on successful initialization, negative otherwise.
uint16_trte_eth_iterator_next(structrte_dev_iterator*iter)
Iterates on devices with devargs filter. The ownership is not checked.
The next port ID is returned, and the iterator is updated.
Parametersiter Device iterator handle initialized by rte_eth_iterator_init(). Some fields bus_str and cls_str
might be freed when no more port is found, by calling rte_eth_iterator_cleanup().
Returns
A port ID if found, RTE_MAX_ETHPORTS otherwise.
voidrte_eth_iterator_cleanup(structrte_dev_iterator*iter)
Free some allocated fields of the iterator.
This function is automatically called by rte_eth_iterator_next() on the last iteration (i.e. when no more
matching port is found).
It is safe to call this function twice; it will do nothing more.
Parametersiter Device iterator handle initialized by rte_eth_iterator_init(). The fields bus_str and cls_str
are freed if needed.
staticuint64_trte_eth_rss_hf_refine(uint64_trss_hf)[inline],[static]
For input set change of hash filter, if SRC_ONLY and DST_ONLY of the same level are used simultaneously,
it is the same case as none of them are added.
Parametersrss_hf RSS types with SRC/DST_ONLY.
Returns
RSS types.
Definition at line 676 of file rte_ethdev.h.
uint64_trte_eth_find_next_owned_by(uint16_tport_id,constuint64_towner_id)
Iterates over valid ethdev ports owned by a specific owner.
Parametersport_id The ID of the next possible valid owned port.
owner_id The owner identifier. RTE_ETH_DEV_NO_OWNER means iterate over all valid ownerless ports.
Returns
Next valid port ID owned by owner_id, RTE_MAX_ETHPORTS if there is none.
uint16_trte_eth_find_next(uint16_tport_id)
Iterates over valid ethdev ports.
Parametersport_id The ID of the next possible valid port.
Returns
Next valid port ID, RTE_MAX_ETHPORTS if there is none.
uint16_trte_eth_find_next_of(uint16_tport_id_start,conststructrte_device*parent)
Iterates over ethdev ports of a specified device.
Parametersport_id_start The ID of the next possible valid port.
parent The generic device behind the ports to iterate.
Returns
Next port ID of the device, possibly port_id_start, RTE_MAX_ETHPORTS if there is none.
uint16_trte_eth_find_next_sibling(uint16_tport_id_start,uint16_tref_port_id)
Iterates over sibling ethdev ports (i.e. sharing the same rte_device).
Parametersport_id_start The ID of the next possible valid sibling port.
ref_port_id The ID of a reference port to compare rte_device with.
Returns
Next sibling port ID, possibly port_id_start or ref_port_id itself, RTE_MAX_ETHPORTS if there is
none.
intrte_eth_dev_owner_new(uint64_t*owner_id)
Get a new unique owner identifier. An owner identifier is used to owns Ethernet devices by only one DPDK
entity to avoid multiple management of device by different entities.
Parametersowner_id Owner identifier pointer.
Returns
Negative errno value on error, 0 on success.
intrte_eth_dev_owner_set(constuint16_tport_id,conststructrte_eth_dev_owner*owner)
Set an Ethernet device owner.
Parametersport_id The identifier of the port to own.
owner The owner pointer.
Returns
Negative errno value on error, 0 on success.
intrte_eth_dev_owner_unset(constuint16_tport_id,constuint64_towner_id)
Unset Ethernet device owner to make the device ownerless.
Parametersport_id The identifier of port to make ownerless.
owner_id The owner identifier.
Returns
0 on success, negative errno value on error.
intrte_eth_dev_owner_delete(constuint64_towner_id)
Remove owner from all Ethernet devices owned by a specific owner.
Parametersowner_id The owner identifier.
Returns
0 on success, negative errno value on error.
intrte_eth_dev_owner_get(constuint16_tport_id,structrte_eth_dev_owner*owner)
Get the owner of an Ethernet device.
Parametersport_id The port identifier.
owner The owner structure pointer to fill.
Returns
0 on success, negative errno value on error..
uint16_trte_eth_dev_count_avail(void)
Get the number of ports which are usable for the application.
These devices must be iterated by using the macro RTE_ETH_FOREACH_DEV or RTE_ETH_FOREACH_DEV_OWNED_BY to
deal with non-contiguous ranges of devices.
Returns
The count of available Ethernet devices.
uint16_trte_eth_dev_count_total(void)
Get the total number of ports which are allocated.
Some devices may not be available for the application.
Returns
The total count of Ethernet devices.
uint32_trte_eth_speed_bitflag(uint32_tspeed,intduplex)
Convert a numerical speed in Mbps to a bitmap flag that can be used in the bitmap link_speeds of the
struct rte_eth_confParametersspeed Numerical speed value in Mbps
duplex RTE_ETH_LINK_[HALF/FULL]_DUPLEX (only for 10/100M speeds)
Returns
0 if the speed cannot be mapped
constchar*rte_eth_dev_rx_offload_name(uint64_toffload)
Get RTE_ETH_RX_OFFLOAD_* flag name.
Parametersoffload Offload flag.
Returns
Offload name or 'UNKNOWN' if the flag cannot be recognised.
constchar*rte_eth_dev_tx_offload_name(uint64_toffload)
Get RTE_ETH_TX_OFFLOAD_* flag name.
Parametersoffload Offload flag.
Returns
Offload name or 'UNKNOWN' if the flag cannot be recognised.
__rte_experimentalconstchar*rte_eth_dev_capability_name(uint64_tcapability)WarningEXPERIMENTAL: this API may change without prior notice.
Get RTE_ETH_DEV_CAPA_* flag name.
Parameterscapability Capability flag.
Returns
Capability name or 'UNKNOWN' if the flag cannot be recognized.
intrte_eth_dev_configure(uint16_tport_id,uint16_tnb_rx_queue,uint16_tnb_tx_queue,conststructrte_eth_conf*eth_conf)
Configure an Ethernet device. This function must be invoked first before any other function in the
Ethernet API. This function can also be re-invoked when a device is in the stopped state.
Parametersport_id The port identifier of the Ethernet device to configure.
nb_rx_queue The number of receive queues to set up for the Ethernet device.
nb_tx_queue The number of transmit queues to set up for the Ethernet device.
eth_conf The pointer to the configuration data to be used for the Ethernet device. The rte_eth_confstructureincludes:
• the hardware offload features to activate, with dedicated fields for each statically configurable
offload hardware feature provided by Ethernet devices, such as IP checksum or VLAN tag stripping
for example. The Rx offload bitfield API is obsolete and will be deprecated. Applications should
set the ignore_bitfield_offloads bit on rxmode structure and use offloads field to set per-port
offloads instead.
• Any offloading set in eth_conf->[rt]xmode.offloads must be within the [rt]x_offload_capa returned
from rte_eth_dev_info_get(). Any type of device supported offloading set in the input argument
eth_conf->[rt]xmode.offloads to rte_eth_dev_configure() is enabled on all queues and it can't be
disabled in rte_eth_[rt]x_queue_setup()
• the Receive Side Scaling (RSS) configuration when using multiple Rx queues per port. Any RSS hash
function set in eth_conf->rss_conf.rss_hf must be within the flow_type_rss_offloads provided by
drivers via rte_eth_dev_info_get() API.
Embedding all configuration information in a single data structure is the more flexible method that
allows the addition of new features without changing the syntax of the API.
Returns
• 0: Success, device configured.
• <0: Error code returned by the driver configuration function.
intrte_eth_dev_is_removed(uint16_tport_id)
Check if an Ethernet device was physically removed.
Parametersport_id The port identifier of the Ethernet device.
Returns
1 when the Ethernet device is removed, otherwise 0.
intrte_eth_rx_queue_setup(uint16_tport_id,uint16_trx_queue_id,uint16_tnb_rx_desc,unsignedintsocket_id,conststructrte_eth_rxconf*rx_conf,structrte_mempool*mb_pool)
Allocate and set up a receive queue for an Ethernet device.
The function allocates a contiguous block of memory for nb_rx_desc receive descriptors from a memory zone
associated with socket_id and initializes each receive descriptor with a network buffer allocated from
the memory pool mb_pool.
Parametersport_id The port identifier of the Ethernet device.
rx_queue_id The index of the receive queue to set up. The value must be in the range [0, nb_rx_queue
- 1] previously supplied to rte_eth_dev_configure().
nb_rx_desc The number of receive descriptors to allocate for the receive ring.
socket_id The socket_id argument is the socket identifier in case of NUMA. The value can be
SOCKET_ID_ANY if there is no NUMA constraint for the DMA memory allocated for the receive descriptors
of the ring.
rx_conf The pointer to the configuration data to be used for the receive queue. NULL value is
allowed, in which case default Rx configuration will be used. The rx_conf structure contains an
rx_thresh structure with the values of the Prefetch, Host, and Write-Back threshold registers of the
receive ring. In addition it contains the hardware offloads features to activate using the
RTE_ETH_RX_OFFLOAD_* flags. If an offloading set in rx_conf->offloads hasn't been set in the input
argument eth_conf->rxmode.offloads to rte_eth_dev_configure(), it is a new added offloading, it must
be per-queue type and it is enabled for the queue. No need to repeat any bit in rx_conf->offloads
which has already been enabled in rte_eth_dev_configure() at port level. An offloading enabled at
port level can't be disabled at queue level. The configuration structure also contains the pointer to
the array of the receiving buffer segment descriptions, see rx_seg and rx_nseg fields, this extended
configuration might be used by split offloads like RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT. If mb_pool is not
NULL, the extended configuration fields must be set to NULL and zero.
mb_pool The pointer to the memory pool from which to allocate rte_mbufnetworkmemorybufferstopopulateeachdescriptorofthereceivering.TherearetwooptionstoprovideRxbufferconfiguration:
• single pool: mb_pool is not NULL, rx_conf.rx_nseg is 0.
• multiple segments description: mb_pool is NULL, rx_conf.rx_seg is not NULL, rx_conf.rx_nseg is not
0. Taken only if flag RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT is set in offloads.
Returns
• 0: Success, receive queue correctly set up.
• -EIO: if device is removed.
• -ENODEV: if port_id is invalid.
• -EINVAL: The memory pool pointer is null or the size of network buffers which can be allocated from
this memory pool does not fit the various buffer sizes allowed by the device controller.
• -ENOMEM: Unable to allocate the receive ring descriptors or to allocate network memory buffers from
the memory pool when initializing receive descriptors.
__rte_experimentalintrte_eth_rx_hairpin_queue_setup(uint16_tport_id,uint16_trx_queue_id,uint16_tnb_rx_desc,conststructrte_eth_hairpin_conf*conf)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Allocate and set up a hairpin receive queue for an Ethernet device.
The function set up the selected queue to be used in hairpin.
Parametersport_id The port identifier of the Ethernet device.
rx_queue_id The index of the receive queue to set up. The value must be in the range [0, nb_rx_queue
- 1] previously supplied to rte_eth_dev_configure().
nb_rx_desc The number of receive descriptors to allocate for the receive ring. 0 means the PMD will
use default value.
conf The pointer to the hairpin configuration.
Returns
• (0) if successful.
• (-ENODEV) if port_id is invalid.
• (-ENOTSUP) if hardware doesn't support.
• (-EINVAL) if bad parameter.
• (-ENOMEM) if unable to allocate the resources.
intrte_eth_tx_queue_setup(uint16_tport_id,uint16_ttx_queue_id,uint16_tnb_tx_desc,unsignedintsocket_id,conststructrte_eth_txconf*tx_conf)
Allocate and set up a transmit queue for an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
tx_queue_id The index of the transmit queue to set up. The value must be in the range [0, nb_tx_queue
- 1] previously supplied to rte_eth_dev_configure().
nb_tx_desc The number of transmit descriptors to allocate for the transmit ring.
socket_id The socket_id argument is the socket identifier in case of NUMA. Its value can be
SOCKET_ID_ANY if there is no NUMA constraint for the DMA memory allocated for the transmit
descriptors of the ring.
tx_conf The pointer to the configuration data to be used for the transmit queue. NULL value is
allowed, in which case default Tx configuration will be used. The tx_conf structure contains the
following data:
• The tx_thresh structure with the values of the Prefetch, Host, and Write-Back threshold registers
of the transmit ring. When setting Write-Back threshold to the value greater then zero,
tx_rs_thresh value should be explicitly set to one.
• The tx_free_thresh value indicates the [minimum] number of network buffers that must be pending in
the transmit ring to trigger their [implicit] freeing by the driver transmit function.
• The tx_rs_thresh value indicates the [minimum] number of transmit descriptors that must be pending
in the transmit ring before setting the RS bit on a descriptor by the driver transmit function. The
tx_rs_thresh value should be less or equal then tx_free_thresh value, and both of them should be
less then nb_tx_desc - 3.
• The offloads member contains Tx offloads to be enabled. If an offloading set in tx_conf->offloads
hasn't been set in the input argument eth_conf->txmode.offloads to rte_eth_dev_configure(), it is a
new added offloading, it must be per-queue type and it is enabled for the queue. No need to repeat
any bit in tx_conf->offloads which has already been enabled in rte_eth_dev_configure() at port
level. An offloading enabled at port level can't be disabled at queue level.
Note that setting tx_free_thresh or tx_rs_thresh value to 0 forces the transmit function to use
default values.
Returns
• 0: Success, the transmit queue is correctly set up.
• -ENOMEM: Unable to allocate the transmit ring descriptors.
__rte_experimentalintrte_eth_tx_hairpin_queue_setup(uint16_tport_id,uint16_ttx_queue_id,uint16_tnb_tx_desc,conststructrte_eth_hairpin_conf*conf)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Allocate and set up a transmit hairpin queue for an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
tx_queue_id The index of the transmit queue to set up. The value must be in the range [0, nb_tx_queue
- 1] previously supplied to rte_eth_dev_configure().
nb_tx_desc The number of transmit descriptors to allocate for the transmit ring. 0 to set default PMD
value.
conf The hairpin configuration.
Returns
• (0) if successful.
• (-ENODEV) if port_id is invalid.
• (-ENOTSUP) if hardware doesn't support.
• (-EINVAL) if bad parameter.
• (-ENOMEM) if unable to allocate the resources.
__rte_experimentalintrte_eth_hairpin_get_peer_ports(uint16_tport_id,uint16_t*peer_ports,size_tlen,uint32_tdirection)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Get all the hairpin peer Rx / Tx ports of the current port. The caller should ensure that the array is
large enough to save the ports list.
Parametersport_id The port identifier of the Ethernet device.
peer_ports Pointer to the array to store the peer ports list.
len Length of the array to store the port identifiers.
direction Current port to peer port direction positive - current used as Tx to get all peer Rx ports.
zero - current used as Rx to get all peer Tx ports.
Returns
• (0 or positive) actual peer ports number.
• (-EINVAL) if bad parameter.
• (-ENODEV) if port_id invalid
• (-ENOTSUP) if hardware doesn't support.
• Others detailed errors from PMDs.
__rte_experimentalintrte_eth_hairpin_bind(uint16_ttx_port,uint16_trx_port)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Bind all hairpin Tx queues of one port to the Rx queues of the peer port. It is only allowed to call this
function after all hairpin queues are configured properly and the devices are in started state.
Parameterstx_port The identifier of the Tx port.
rx_port The identifier of peer Rx port. RTE_MAX_ETHPORTS is allowed for the traversal of all devices.
Rx port ID could have the same value as Tx port ID.
Returns
• (0) if successful.
• (-ENODEV) if Tx port ID is invalid.
• (-EBUSY) if device is not in started state.
• (-ENOTSUP) if hardware doesn't support.
• Others detailed errors from PMDs.
__rte_experimentalintrte_eth_hairpin_unbind(uint16_ttx_port,uint16_trx_port)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Unbind all hairpin Tx queues of one port from the Rx queues of the peer port. This should be called
before closing the Tx or Rx devices, if the bind function is called before. After unbinding the hairpin
ports pair, it is allowed to bind them again. Changing queues configuration should be after stopping the
device(s).
Parameterstx_port The identifier of the Tx port.
rx_port The identifier of peer Rx port. RTE_MAX_ETHPORTS is allowed for traversal of all devices. Rx
port ID could have the same value as Tx port ID.
Returns
• (0) if successful.
• (-ENODEV) if Tx port ID is invalid.
• (-EBUSY) if device is in stopped state.
• (-ENOTSUP) if hardware doesn't support.
• Others detailed errors from PMDs.
__rte_experimentalintrte_eth_dev_count_aggr_ports(uint16_tport_id)WarningEXPERIMENTAL: this API may change without prior notice.
Get the number of aggregated ports of the DPDK port (specified with port_id). It is used when multiple
ports are aggregated into a single one.
For the regular physical port doesn't have aggregated ports, the number of aggregated ports is reported
as 0.
Parametersport_id The port identifier of the Ethernet device.
Returns
• (>=0) the number of aggregated port if success.
__rte_experimentalintrte_eth_dev_map_aggr_tx_affinity(uint16_tport_id,uint16_ttx_queue_id,uint8_taffinity)WarningEXPERIMENTAL: this API may change without prior notice.
Map a Tx queue with an aggregated port of the DPDK port (specified with port_id). When multiple ports are
aggregated into a single one, it allows to choose which port to use for Tx via a queue.
The application should use rte_eth_dev_map_aggr_tx_affinity() after rte_eth_dev_configure(),
rte_eth_tx_queue_setup(), and before rte_eth_dev_start().
Parametersport_id The identifier of the port used in rte_eth_tx_burst().
tx_queue_id The index of the transmit queue used in rte_eth_tx_burst(). The value must be in the
range [0, nb_tx_queue - 1] previously supplied to rte_eth_dev_configure().
affinity The number of the aggregated port. Value 0 means no affinity and traffic could be routed to
any aggregated port. The first aggregated port is number 1 and so on. The maximum number is given by
rte_eth_dev_count_aggr_ports().
Returns
Zero if successful. Non-zero otherwise.
intrte_eth_dev_socket_id(uint16_tport_id)
Return the NUMA socket to which an Ethernet device is connected
Parametersport_id The port identifier of the Ethernet device
Returns
• The NUMA socket ID which the Ethernet device is connected to.
• -1 (which translates to SOCKET_ID_ANY) if the socket could not be determined. rte_errno is then set
to:
• EINVAL is the port_id is invalid,
• 0 is the socket could not be determined,
intrte_eth_dev_is_valid_port(uint16_tport_id)
Check if port_id of device is attached
Parametersport_id The port identifier of the Ethernet device
Returns
• 0 if port is out of range or not attached
• 1 if device is attached
__rte_experimentalintrte_eth_rx_queue_is_valid(uint16_tport_id,uint16_tqueue_id)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice.
Check if Rx queue is valid. If the queue has been setup, it is considered valid.
Parametersport_id The port identifier of the Ethernet device.
queue_id The index of the receive queue.
Returns
• -ENODEV: if port_id is invalid.
• -EINVAL: if queue_id is out of range or queue has not been setup.
• 0 if Rx queue is valid.
__rte_experimentalintrte_eth_tx_queue_is_valid(uint16_tport_id,uint16_tqueue_id)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice.
Check if Tx queue is valid. If the queue has been setup, it is considered valid.
Parametersport_id The port identifier of the Ethernet device.
queue_id The index of the transmit queue.
Returns
• -ENODEV: if port_id is invalid.
• -EINVAL: if queue_id is out of range or queue has not been setup.
• 0 if Tx queue is valid.
intrte_eth_dev_rx_queue_start(uint16_tport_id,uint16_trx_queue_id)
Start specified Rx queue of a port. It is used when rx_deferred_start flag of the specified queue is
true.
Parametersport_id The port identifier of the Ethernet device
rx_queue_id The index of the Rx queue to update the ring. The value must be in the range [0,
nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
Returns
• 0: Success, the receive queue is started.
• -ENODEV: if port_id is invalid.
• -EINVAL: The queue_id out of range or belong to hairpin.
• -EIO: if device is removed.
• -ENOTSUP: The function not supported in PMD.
intrte_eth_dev_rx_queue_stop(uint16_tport_id,uint16_trx_queue_id)
Stop specified Rx queue of a port
Parametersport_id The port identifier of the Ethernet device
rx_queue_id The index of the Rx queue to update the ring. The value must be in the range [0,
nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
Returns
• 0: Success, the receive queue is stopped.
• -ENODEV: if port_id is invalid.
• -EINVAL: The queue_id out of range or belong to hairpin.
• -EIO: if device is removed.
• -ENOTSUP: The function not supported in PMD.
intrte_eth_dev_tx_queue_start(uint16_tport_id,uint16_ttx_queue_id)
Start Tx for specified queue of a port. It is used when tx_deferred_start flag of the specified queue is
true.
Parametersport_id The port identifier of the Ethernet device
tx_queue_id The index of the Tx queue to update the ring. The value must be in the range [0,
nb_tx_queue - 1] previously supplied to rte_eth_dev_configure().
Returns
• 0: Success, the transmit queue is started.
• -ENODEV: if port_id is invalid.
• -EINVAL: The queue_id out of range or belong to hairpin.
• -EIO: if device is removed.
• -ENOTSUP: The function not supported in PMD.
intrte_eth_dev_tx_queue_stop(uint16_tport_id,uint16_ttx_queue_id)
Stop specified Tx queue of a port
Parametersport_id The port identifier of the Ethernet device
tx_queue_id The index of the Tx queue to update the ring. The value must be in the range [0,
nb_tx_queue - 1] previously supplied to rte_eth_dev_configure().
Returns
• 0: Success, the transmit queue is stopped.
• -ENODEV: if port_id is invalid.
• -EINVAL: The queue_id out of range or belong to hairpin.
• -EIO: if device is removed.
• -ENOTSUP: The function not supported in PMD.
intrte_eth_dev_start(uint16_tport_id)
Start an Ethernet device.
The device start step is the last one and consists of setting the configured offload features and in
starting the transmit and the receive units of the device.
Device RTE_ETH_DEV_NOLIVE_MAC_ADDR flag causes MAC address to be set before PMD port start callback
function is invoked.
All device queues (except form deferred start queues) status should be RTE_ETH_QUEUE_STATE_STARTED after
start.
On success, all basic functions exported by the Ethernet API (link status, receive/transmit, and so on)
can be invoked.
Parametersport_id The port identifier of the Ethernet device.
Returns
• 0: Success, Ethernet device started.
• -EAGAIN: If start operation must be retried.
• <0: Error code of the driver device start function.
intrte_eth_dev_stop(uint16_tport_id)
Stop an Ethernet device. The device can be restarted with a call to rte_eth_dev_start()
All device queues status should be RTE_ETH_QUEUE_STATE_STOPPED after stop.
Parametersport_id The port identifier of the Ethernet device.
Returns
• 0: Success, Ethernet device stopped.
• -EBUSY: If stopping the port is not allowed in current state.
• <0: Error code of the driver device stop function.
intrte_eth_dev_set_link_up(uint16_tport_id)
Link up an Ethernet device.
Set device link up will re-enable the device Rx/Tx functionality after it is previously set device linked
down.
Parametersport_id The port identifier of the Ethernet device.
Returns
• 0: Success, Ethernet device linked up.
• <0: Error code of the driver device link up function.
intrte_eth_dev_set_link_down(uint16_tport_id)
Link down an Ethernet device. The device Rx/Tx functionality will be disabled if success, and it can be
re-enabled with a call to rte_eth_dev_set_link_up()Parametersport_id The port identifier of the Ethernet device.
intrte_eth_dev_close(uint16_tport_id)
Close a stopped Ethernet device. The device cannot be restarted! The function frees all port resources.
Parametersport_id The port identifier of the Ethernet device.
Returns
• Zero if the port is closed successfully.
• Negative if something went wrong.
intrte_eth_dev_reset(uint16_tport_id)
Reset a Ethernet device and keep its port ID.
When a port has to be reset passively, the DPDK application can invoke this function. For example when a
PF is reset, all its VFs should also be reset. Normally a DPDK application can invoke this function when
RTE_ETH_EVENT_INTR_RESET event is detected, but can also use it to start a port reset in other
circumstances.
When this function is called, it first stops the port and then calls the PMD specific dev_uninit( ) and
dev_init( ) to return the port to initial state, in which no Tx and Rx queues are setup, as if the port
has been reset and not started. The port keeps the port ID it had before the function call.
After calling rte_eth_dev_reset(), the application should use rte_eth_dev_configure(),
rte_eth_rx_queue_setup(), rte_eth_tx_queue_setup(), and rte_eth_dev_start() to reconfigure the device
as appropriate.
Note: To avoid unexpected behavior, the application should stop calling Tx and Rx functions before
calling rte_eth_dev_reset(). For thread safety, all these controlling functions should be called from
the same thread.
Parametersport_id The port identifier of the Ethernet device.
Returns
• (0) if successful.
• (-ENODEV) if port_id is invalid.
• (-ENOTSUP) if hardware doesn't support this function.
• (-EPERM) if not ran from the primary process.
• (-EIO) if re-initialisation failed or device is removed.
• (-ENOMEM) if the reset failed due to OOM.
• (-EAGAIN) if the reset temporarily failed and should be retried later.
intrte_eth_promiscuous_enable(uint16_tport_id)
Enable receipt in promiscuous mode for an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
Returns
• (0) if successful.
• (-ENOTSUP) if support for promiscuous_enable() does not exist for the device.
• (-ENODEV) if port_id invalid.
intrte_eth_promiscuous_disable(uint16_tport_id)
Disable receipt in promiscuous mode for an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
Returns
• (0) if successful.
• (-ENOTSUP) if support for promiscuous_disable() does not exist for the device.
• (-ENODEV) if port_id invalid.
intrte_eth_promiscuous_get(uint16_tport_id)
Return the value of promiscuous mode for an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
Returns
• (1) if promiscuous is enabled
• (0) if promiscuous is disabled.
• (-1) on error
intrte_eth_allmulticast_enable(uint16_tport_id)
Enable the receipt of any multicast frame by an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
Returns
• (0) if successful.
• (-ENOTSUP) if support for allmulticast_enable() does not exist for the device.
• (-ENODEV) if port_id invalid.
intrte_eth_allmulticast_disable(uint16_tport_id)
Disable the receipt of all multicast frames by an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
Returns
• (0) if successful.
• (-ENOTSUP) if support for allmulticast_disable() does not exist for the device.
• (-ENODEV) if port_id invalid.
intrte_eth_allmulticast_get(uint16_tport_id)
Return the value of allmulticast mode for an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
Returns
• (1) if allmulticast is enabled
• (0) if allmulticast is disabled.
• (-1) on error
intrte_eth_link_get(uint16_tport_id,structrte_eth_link*link)
Retrieve the link status (up/down), the duplex mode (half/full), the negotiation (auto/fixed), and if
available, the speed (Mbps).
It might need to wait up to 9 seconds.
Seealsorte_eth_link_get_nowait.
Parametersport_id The port identifier of the Ethernet device.
link Link information written back.
Returns
• (0) if successful.
• (-ENOTSUP) if the function is not supported in PMD.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter.
intrte_eth_link_get_nowait(uint16_tport_id,structrte_eth_link*link)
Retrieve the link status (up/down), the duplex mode (half/full), the negotiation (auto/fixed), and if
available, the speed (Mbps).
Parametersport_id The port identifier of the Ethernet device.
link Link information written back.
Returns
• (0) if successful.
• (-ENOTSUP) if the function is not supported in PMD.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter.
__rte_experimentalconstchar*rte_eth_link_speed_to_str(uint32_tlink_speed)WarningEXPERIMENTAL: this API may change without prior notice.
The function converts a link_speed to a string. It handles all special values like unknown or none speed.
Parameterslink_speed link_speed of rte_eth_link struct
Returns
Link speed in textual format. It's pointer to immutable memory. No free is required.
__rte_experimentalintrte_eth_link_to_str(char*str,size_tlen,conststructrte_eth_link*eth_link)WarningEXPERIMENTAL: this API may change without prior notice.
The function converts a rte_eth_link struct representing a link status to a string.
Parametersstr A pointer to a string to be filled with textual representation of device status. At least
RTE_ETH_LINK_MAX_STR_LEN bytes should be allocated to store default link status text.
len Length of available memory at 'str' string.
eth_link Link status returned by rte_eth_link_get function
Returns
Number of bytes written to str array or -EINVAL if bad parameter.
__rte_experimentalintrte_eth_speed_lanes_get(uint16_tport_id,uint32_t*lanes)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Get Active lanes.
Parametersport_id The port identifier of the Ethernet device.
lanes Driver updates lanes with the number of active lanes. On a supported NIC on link up, lanes will
be a non-zero value irrespective whether the link is Autonegotiated or Fixed speed. No information is
displayed for error.
Returns
• (0) if successful.
• (-ENOTSUP) if underlying hardware OR driver doesn't support. that operation.
• (-EIO) if device is removed.
• (-ENODEV) if port_id invalid.
__rte_experimentalintrte_eth_speed_lanes_set(uint16_tport_id,uint32_tspeed_lanes)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Set speed lanes supported by the NIC.
Parametersport_id The port identifier of the Ethernet device.
speed_lanes A non-zero number of speed lanes, that will be applied to the ethernet PHY along with the
fixed speed configuration. Driver returns error if the user lanes is not in speeds capability list.
Returns
• (0) if successful.
• (-ENOTSUP) if underlying hardware OR driver doesn't support. that operation.
• (-EIO) if device is removed.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if lanes count not in speeds capability list.
__rte_experimentalintrte_eth_speed_lanes_get_capability(uint16_tport_id,structrte_eth_speed_lanes_capa*speed_lanes_capa,unsignedintnum)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Get speed lanes supported by the NIC.
Parametersport_id The port identifier of the Ethernet device.
speed_lanes_capa An array of supported speed and its supported lanes.
num Size of the speed_lanes_capa array. The size is equal to the supported speeds list size. Value of
num is derived by calling this api with speed_lanes_capa=NULL and num=0
Returns
• (0) if successful.
• (-ENOTSUP) if underlying hardware OR driver doesn't support. that operation.
• (-EIO) if device is removed.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if speed_lanes invalid
intrte_eth_stats_get(uint16_tport_id,structrte_eth_stats*stats)
Retrieve the general I/O statistics of an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
stats A pointer to a structure of type rte_eth_statstobefilledwiththevaluesofdevicecountersforthefollowingsetofstatistics:
• ipackets with the total of successfully received packets.
• opackets with the total of successfully transmitted packets.
• ibytes with the total of successfully received bytes.
• obytes with the total of successfully transmitted bytes.
• ierrors with the total of erroneous received packets.
• oerrors with the total of failed transmitted packets.
Returns
Zero if successful. Non-zero otherwise.
intrte_eth_stats_reset(uint16_tport_id)
Reset the general I/O statistics of an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
Returns
• (0) if device notified to reset stats.
• (-ENOTSUP) if hardware doesn't support.
• (-ENODEV) if port_id invalid.
• (<0): Error code of the driver stats reset function.
intrte_eth_xstats_get_names(uint16_tport_id,structrte_eth_xstat_name*xstats_names,unsignedintsize)
Retrieve names of extended statistics of an Ethernet device.
There is an assumption that 'xstat_names' and 'xstats' arrays are matched by array index:
xstats_names[i].name => xstats[i].value
And the array index is same with id field of 'struct rte_eth_xstat': xstats[i].id == i
This assumption makes key-value pair matching less flexible but simpler.
Parametersport_id The port identifier of the Ethernet device.
xstats_names An rte_eth_xstat_name array of at least size elements to be filled. If set to NULL, the
function returns the required number of elements.
size The size of the xstats_names array (number of elements).
Returns
• A positive value lower or equal to size: success. The return value is the number of entries filled
in the stats table.
• A positive value higher than size: error, the given statistics table is too small. The return value
corresponds to the size that should be given to succeed. The entries in the table are not valid and
shall not be used by the caller.
• A negative value on error (invalid port ID).
intrte_eth_xstats_get(uint16_tport_id,structrte_eth_xstat*xstats,unsignedintn)
Retrieve extended statistics of an Ethernet device.
There is an assumption that 'xstat_names' and 'xstats' arrays are matched by array index:
xstats_names[i].name => xstats[i].value
And the array index is same with id field of 'struct rte_eth_xstat': xstats[i].id == i
This assumption makes key-value pair matching less flexible but simpler.
Parametersport_id The port identifier of the Ethernet device.
xstats A pointer to a table of structure of type rte_eth_xstattobefilledwithdevicestatisticsidsandvalues.ThisparametercanbesettoNULLifandonlyifnis0.nThesizeofthexstatsarray(numberofelements).Iflowerthantherequirednumberofelements,thefunctionreturnstherequirednumberofelements.Ifequaltozero,thexstatsmustbeNULL,thefunctionreturnstherequirednumberofelements.Returns
• A positive value lower or equal to n: success. The return value is the number of entries filled in
the stats table.
• A positive value higher than n: error, the given statistics table is too small. The return value
corresponds to the size that should be given to succeed. The entries in the table are not valid and
shall not be used by the caller.
• A negative value on error (invalid port ID).
intrte_eth_xstats_get_names_by_id(uint16_tport_id,structrte_eth_xstat_name*xstats_names,unsignedintsize,uint64_t*ids)
Retrieve names of extended statistics of an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
xstats_names Array to be filled in with names of requested device statistics. Must not be NULL if ids
are specified (not NULL).
size Number of elements in xstats_names array (if not NULL) and in ids array (if not NULL). Must be 0
if both array pointers are NULL.
ids IDs array given by app to retrieve specific statistics. May be NULL to retrieve names of all
available statistics or, if xstats_names is NULL as well, just the number of available statistics.
Returns
• A positive value lower or equal to size: success. The return value is the number of entries filled
in the stats table.
• A positive value higher than size: success. The given statistics table is too small. The return
value corresponds to the size that should be given to succeed. The entries in the table are not
valid and shall not be used by the caller.
• A negative value on error.
intrte_eth_xstats_get_by_id(uint16_tport_id,constuint64_t*ids,uint64_t*values,unsignedintsize)
Retrieve extended statistics of an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
ids IDs array given by app to retrieve specific statistics. May be NULL to retrieve all available
statistics or, if values is NULL as well, just the number of available statistics.
values Array to be filled in with requested device statistics. Must not be NULL if ids are specified
(not NULL).
size Number of elements in values array (if not NULL) and in ids array (if not NULL). Must be 0 if
both array pointers are NULL.
Returns
• A positive value lower or equal to size: success. The return value is the number of entries filled
in the stats table.
• A positive value higher than size: success: The given statistics table is too small. The return
value corresponds to the size that should be given to succeed. The entries in the table are not
valid and shall not be used by the caller.
• A negative value on error.
intrte_eth_xstats_get_id_by_name(uint16_tport_id,constchar*xstat_name,uint64_t*id)
Gets the ID of a statistic from its name.
This function searches for the statistics using string compares, and as such should not be used on the
fast-path. For fast-path retrieval of specific statistics, store the ID as provided in id from this
function, and pass the ID to rte_eth_xstats_get()Parametersport_id The port to look up statistics from
xstat_name The name of the statistic to return
id A pointer to an app-supplied uint64_t which should be set to the ID of the stat if the stat
exists.
Returns
0 on success -ENODEV for invalid port_id, -EIO if device is removed, -EINVAL if the xstat_name
doesn't exist in port_id -ENOMEM if bad parameter.
intrte_eth_xstats_reset(uint16_tport_id)
Reset extended statistics of an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
Returns
• (0) if device notified to reset extended stats.
• (-ENOTSUP) if pmd doesn't support both extended stats and basic stats reset.
• (-ENODEV) if port_id invalid.
• (<0): Error code of the driver xstats reset function.
intrte_eth_dev_set_tx_queue_stats_mapping(uint16_tport_id,uint16_ttx_queue_id,uint8_tstat_idx)
Set a mapping for the specified transmit queue to the specified per-queue statistics counter.
Parametersport_id The port identifier of the Ethernet device.
tx_queue_id The index of the transmit queue for which a queue stats mapping is required. The value
must be in the range [0, nb_tx_queue - 1] previously supplied to rte_eth_dev_configure().
stat_idx The per-queue packet statistics functionality number that the transmit queue is to be
assigned. The value must be in the range [0, RTE_ETHDEV_QUEUE_STAT_CNTRS - 1]. Max
RTE_ETHDEV_QUEUE_STAT_CNTRS being 256.
Returns
Zero if successful. Non-zero otherwise.
intrte_eth_dev_set_rx_queue_stats_mapping(uint16_tport_id,uint16_trx_queue_id,uint8_tstat_idx)
Set a mapping for the specified receive queue to the specified per-queue statistics counter.
Parametersport_id The port identifier of the Ethernet device.
rx_queue_id The index of the receive queue for which a queue stats mapping is required. The value
must be in the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
stat_idx The per-queue packet statistics functionality number that the receive queue is to be
assigned. The value must be in the range [0, RTE_ETHDEV_QUEUE_STAT_CNTRS - 1]. Max
RTE_ETHDEV_QUEUE_STAT_CNTRS being 256.
Returns
Zero if successful. Non-zero otherwise.
intrte_eth_macaddr_get(uint16_tport_id,structrte_ether_addr*mac_addr)
Retrieve the Ethernet address of an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
mac_addr A pointer to a structure of type ether_addr to be filled with the Ethernet address of the
Ethernet device.
Returns
• (0) if successful
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter.
__rte_experimentalintrte_eth_macaddrs_get(uint16_tport_id,structrte_ether_addr*ma,unsignedintnum)WarningEXPERIMENTAL: this API may change without prior notice
Retrieve the Ethernet addresses of an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
ma A pointer to an array of structures of type ether_addr to be filled with the Ethernet addresses of
the Ethernet device.
num Number of elements in the ma array. Note that rte_eth_dev_info::max_mac_addrs can be used to
retrieve max number of Ethernet addresses for given port.
Returns
• number of retrieved addresses if successful
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter.
intrte_eth_dev_info_get(uint16_tport_id,structrte_eth_dev_info*dev_info)
Retrieve the contextual information of an Ethernet device.
This function returns the Ethernet device information based on the values stored internally in the device
specific data. For example: number of queues, descriptor limits, device capabilities and offload flags.
Parametersport_id The port identifier of the Ethernet device.
dev_info A pointer to a structure of type rte_eth_dev_infotobefilledwiththecontextualinformationoftheEthernetdevice.Returns
• (0) if successful.
• (-ENOTSUP) if support for dev_infos_get() does not exist for the device.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter.
__rte_experimentalintrte_eth_dev_conf_get(uint16_tport_id,structrte_eth_conf*dev_conf)WarningEXPERIMENTAL: this API may change without prior notice.
Retrieve the configuration of an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
dev_conf Location for Ethernet device configuration to be filled in.
Returns
• (0) if successful.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter.
intrte_eth_dev_fw_version_get(uint16_tport_id,char*fw_version,size_tfw_size)
Retrieve the firmware version of a device.
Parametersport_id The port identifier of the device.
fw_version A pointer to a string array storing the firmware version of a device, the string includes
terminating null. This pointer is allocated by caller.
fw_size The size of the string array pointed by fw_version, which should be large enough to store
firmware version of the device.
Returns
• (0) if successful.
• (-ENOTSUP) if operation is not supported.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• (-EINVAL) if bad parameter.
• (>0) if fw_size is not enough to store firmware version, return the size of the non truncated
string.
intrte_eth_dev_get_supported_ptypes(uint16_tport_id,uint32_tptype_mask,uint32_t*ptypes,intnum)
Retrieve the supported packet types of an Ethernet device.
When a packet type is announced as supported, it must be recognized by the PMD. For instance, if
RTE_PTYPE_L2_ETHER, RTE_PTYPE_L2_ETHER_VLAN and RTE_PTYPE_L3_IPV4 are announced, the PMD must return the
following packet types for these packets:
• Ether/IPv4 -> RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4
• Ether/VLAN/IPv4 -> RTE_PTYPE_L2_ETHER_VLAN | RTE_PTYPE_L3_IPV4
• Ether/[anything else] -> RTE_PTYPE_L2_ETHER
• Ether/VLAN/[anything else] -> RTE_PTYPE_L2_ETHER_VLAN
When a packet is received by a PMD, the most precise type must be returned among the ones supported.
However a PMD is allowed to set packet type that is not in the supported list, at the condition that it
is more precise. Therefore, a PMD announcing no supported packet types can still set a matching packet
type in a received packet.
Note
Better to invoke this API after the device is already started or Rx burst function is decided, to
obtain correct supported ptypes.
if a given PMD does not report what ptypes it supports, then the supported ptype count is reported as
0.
Parametersport_id The port identifier of the Ethernet device.
ptype_mask A hint of what kind of packet type which the caller is interested in.
ptypes An array pointer to store adequate packet types, allocated by caller.
num Size of the array pointed by param ptypes.
Returns
• (>=0) Number of supported ptypes. If the number of types exceeds num, only num entries will be
filled into the ptypes array, but the full count of supported ptypes will be returned.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter.
intrte_eth_dev_set_ptypes(uint16_tport_id,uint32_tptype_mask,uint32_t*set_ptypes,unsignedintnum)
Inform Ethernet device about reduced range of packet types to handle.
Application can use this function to set only specific ptypes that it's interested. This information can
be used by the PMD to optimize Rx path.
The function accepts an array set_ptypes allocated by the caller to store the packet types set by the
driver, the last element of the array is set to RTE_PTYPE_UNKNOWN. The size of the set_ptype array should
be rte_eth_dev_get_supported_ptypes() + 1 elseitmightonlybefilledpartially.Parametersport_id The port identifier of the Ethernet device.
ptype_mask The ptype family that application is interested in should be bitwise OR of
RTE_PTYPE_*_MASK or 0.
set_ptypes An array pointer to store set packet types, allocated by caller. The function marks the
end of array with RTE_PTYPE_UNKNOWN.
num Size of the array pointed by param ptypes. Should be rte_eth_dev_get_supported_ptypes() + 1 to
accommodate the set ptypes.
Returns
• (0) if Success.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if ptype_mask is invalid (or) set_ptypes is NULL and num > 0.
intrte_eth_dev_get_mtu(uint16_tport_id,uint16_t*mtu)
Retrieve the MTU of an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
mtu A pointer to a uint16_t where the retrieved MTU is to be stored.
Returns
• (0) if successful.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter.
intrte_eth_dev_set_mtu(uint16_tport_id,uint16_tmtu)
Change the MTU of an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
mtu A uint16_t for the MTU to be applied.
Returns
• (0) if successful.
• (-ENOTSUP) if operation is not supported.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• (-EINVAL) if mtu invalid, validation of mtu can occur within rte_eth_dev_set_mtu if dev_infos_get
is supported by the device or when the mtu is set using dev->dev_ops->mtu_set.
• (-EBUSY) if operation is not allowed when the port is running
intrte_eth_dev_vlan_filter(uint16_tport_id,uint16_tvlan_id,inton)
Enable/Disable hardware filtering by an Ethernet device of received VLAN packets tagged with a given VLAN
Tag Identifier.
Parametersport_id The port identifier of the Ethernet device.
vlan_id The VLAN Tag Identifier whose filtering must be enabled or disabled.
on If > 0, enable VLAN filtering of VLAN packets tagged with vlan_id. Otherwise, disable VLAN
filtering of VLAN packets tagged with vlan_id.
Returns
• (0) if successful.
• (-ENOTSUP) if hardware-assisted VLAN filtering not configured.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• (-ENOSYS) if VLAN filtering on port_id disabled.
• (-EINVAL) if vlan_id > 4095.
intrte_eth_dev_set_vlan_strip_on_queue(uint16_tport_id,uint16_trx_queue_id,inton)
Enable/Disable hardware VLAN Strip by a Rx queue of an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
rx_queue_id The index of the receive queue for which a queue stats mapping is required. The value
must be in the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
on If 1, Enable VLAN Stripping of the receive queue of the Ethernet port. If 0, Disable VLAN
Stripping of the receive queue of the Ethernet port.
Returns
• (0) if successful.
• (-ENOTSUP) if hardware-assisted VLAN stripping not configured.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if rx_queue_id invalid.
intrte_eth_dev_set_vlan_ether_type(uint16_tport_id,enumrte_vlan_typevlan_type,uint16_ttag_type)
Set the Outer VLAN Ether Type by an Ethernet device, it can be inserted to the VLAN header.
Parametersport_id The port identifier of the Ethernet device.
vlan_type The VLAN type.
tag_type The Tag Protocol ID
Returns
• (0) if successful.
• (-ENOTSUP) if hardware-assisted VLAN TPID setup is not supported.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
intrte_eth_dev_set_vlan_offload(uint16_tport_id,intoffload_mask)
Set VLAN offload configuration on an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
offload_mask The VLAN Offload bit mask can be mixed use with 'OR' RTE_ETH_VLAN_STRIP_OFFLOAD
RTE_ETH_VLAN_FILTER_OFFLOAD RTE_ETH_VLAN_EXTEND_OFFLOAD RTE_ETH_QINQ_STRIP_OFFLOAD
Returns
• (0) if successful.
• (-ENOTSUP) if hardware-assisted VLAN filtering not configured.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
intrte_eth_dev_get_vlan_offload(uint16_tport_id)
Read VLAN Offload configuration from an Ethernet device
Parametersport_id The port identifier of the Ethernet device.
Returns
• (>0) if successful. Bit mask to indicate RTE_ETH_VLAN_STRIP_OFFLOAD RTE_ETH_VLAN_FILTER_OFFLOAD
RTE_ETH_VLAN_EXTEND_OFFLOAD RTE_ETH_QINQ_STRIP_OFFLOAD
• (-ENODEV) if port_id invalid.
intrte_eth_dev_set_vlan_pvid(uint16_tport_id,uint16_tpvid,inton)
Set port based Tx VLAN insertion on or off.
Parametersport_id The port identifier of the Ethernet device.
pvid Port based Tx VLAN identifier together with user priority.
on Turn on or off the port based Tx VLAN insertion.
Returns
• (0) if successful.
• negative if failed.
__rte_experimentalintrte_eth_rx_avail_thresh_set(uint16_tport_id,uint16_tqueue_id,uint8_tavail_thresh)WarningEXPERIMENTAL: this API may change without prior notice.
Set Rx queue available descriptors threshold.
Parametersport_id The port identifier of the Ethernet device.
queue_id The index of the receive queue.
avail_thresh The available descriptors threshold is percentage of Rx queue size which describes the
availability of Rx queue for hardware. If the Rx queue availability is below it, the event
RTE_ETH_EVENT_RX_AVAIL_THRESH is triggered. [1-99] to set a new available descriptors threshold. 0 to
disable threshold monitoring.
Returns
• 0 if successful.
• (-ENODEV) if port_id is invalid.
• (-EINVAL) if bad parameter.
• (-ENOTSUP) if available Rx descriptors threshold is not supported.
• (-EIO) if device is removed.
__rte_experimentalintrte_eth_rx_avail_thresh_query(uint16_tport_id,uint16_t*queue_id,uint8_t*avail_thresh)WarningEXPERIMENTAL: this API may change without prior notice.
Find Rx queue with RTE_ETH_EVENT_RX_AVAIL_THRESH event pending.
Parametersport_id The port identifier of the Ethernet device.
queue_id On input starting Rx queue index to search from. If the queue_id is bigger than maximum
queue ID of the port, search is started from 0. So that application can keep calling this function to
handle all pending events with a simple increment of queue_id on the next call. On output if return
value is 1, Rx queue index with the event pending.
avail_thresh Location for available descriptors threshold of the found Rx queue.
Returns
• 1 if an Rx queue with pending event is found.
• 0 if no Rx queue with pending event is found.
• (-ENODEV) if port_id is invalid.
• (-EINVAL) if bad parameter (e.g. queue_id is NULL).
• (-ENOTSUP) if operation is not supported.
• (-EIO) if device is removed.
intrte_eth_tx_buffer_init(structrte_eth_dev_tx_buffer*buffer,uint16_tsize)
Initialize default values for buffered transmitting
Parametersbuffer Tx buffer to be initialized.
size Buffer size
Returns
0 if no error
intrte_eth_tx_buffer_set_err_callback(structrte_eth_dev_tx_buffer*buffer,buffer_tx_error_fncallback,void*userdata)
Configure a callback for buffered packets which cannot be sent
Register a specific callback to be called when an attempt is made to send all packets buffered on an
Ethernet port, but not all packets can successfully be sent. The callback registered here will be called
only from calls to rte_eth_tx_buffer() and rte_eth_tx_buffer_flush() APIs. The default callback
configured for each queue by default just frees the packets back to the calling mempool. If additional
behaviour is required, for example, to count dropped packets, or to retry transmission of packets which
cannot be sent, this function should be used to register a suitable callback function to implement the
desired behaviour. The example callback 'rte_eth_tx_buffer_count_callback()' is also provided as
reference.
Parametersbuffer The port identifier of the Ethernet device.
callback The function to be used as the callback.
userdata Arbitrary parameter to be passed to the callback function
Returns
0 on success, or -EINVAL if bad parameter
voidrte_eth_tx_buffer_drop_callback(structrte_mbuf**pkts,uint16_tunsent,void*userdata)
Callback function for silently dropping unsent buffered packets.
This function can be passed to rte_eth_tx_buffer_set_err_callback() to adjust the default behavior when
buffered packets cannot be sent. This function drops any unsent packets silently and is used by Tx
buffered operations as default behavior.
NOTE: this function should not be called directly, instead it should be used as a callback for packet
buffering.
NOTE: when configuring this function as a callback with rte_eth_tx_buffer_set_err_callback(), the final,
userdata parameter should point to an uint64_t value.
Parameterspkts The previously buffered packets which could not be sent
unsent The number of unsent packets in the pkts array
userdata Not used
voidrte_eth_tx_buffer_count_callback(structrte_mbuf**pkts,uint16_tunsent,void*userdata)
Callback function for tracking unsent buffered packets.
This function can be passed to rte_eth_tx_buffer_set_err_callback() to adjust the default behavior when
buffered packets cannot be sent. This function drops any unsent packets, but also updates a user-supplied
counter to track the overall number of packets dropped. The counter should be an uint64_t variable.
NOTE: this function should not be called directly, instead it should be used as a callback for packet
buffering.
NOTE: when configuring this function as a callback with rte_eth_tx_buffer_set_err_callback(), the final,
userdata parameter should point to an uint64_t value.
Parameterspkts The previously buffered packets which could not be sent
unsent The number of unsent packets in the pkts array
userdata Pointer to an uint64_t value, which will be incremented by unsent
intrte_eth_tx_done_cleanup(uint16_tport_id,uint16_tqueue_id,uint32_tfree_cnt)
Request the driver to free mbufs currently cached by the driver. The driver will only free the mbuf if it
is no longer in use. It is the application's responsibility to ensure rte_eth_tx_buffer_flush(..) is
called if needed.
Parametersport_id The port identifier of the Ethernet device.
queue_id The index of the transmit queue through which output packets must be sent. The value must be
in the range [0, nb_tx_queue - 1] previously supplied to rte_eth_dev_configure().
free_cnt Maximum number of packets to free. Use 0 to indicate all possible packets should be freed.
Note that a packet may be using multiple mbufs.
Returns
Failure: < 0 -ENODEV: Invalid interface -EIO: device is removed -ENOTSUP: Driver does not support
function Success: >= 0 0-n: Number of packets freed. More packets may still remain in ring that are
in use.
intrte_eth_dev_callback_register(uint16_tport_id,enumrte_eth_event_typeevent,rte_eth_dev_cb_fncb_fn,void*cb_arg)
Register a callback function for port event.
Parametersport_id Port ID. RTE_ETH_ALL means register the event for all port ids.
event Event interested.
cb_fn User supplied callback function to be called.
cb_arg Pointer to the parameters for the registered callback.
Returns
• On success, zero.
• On failure, a negative value.
intrte_eth_dev_callback_unregister(uint16_tport_id,enumrte_eth_event_typeevent,rte_eth_dev_cb_fncb_fn,void*cb_arg)
Unregister a callback function for port event.
Parametersport_id Port ID. RTE_ETH_ALL means unregister the event for all port ids.
event Event interested.
cb_fn User supplied callback function to be called.
cb_arg Pointer to the parameters for the registered callback. -1 means to remove all for the same
callback address and same event.
Returns
• On success, zero.
• On failure, a negative value.
intrte_eth_dev_rx_intr_enable(uint16_tport_id,uint16_tqueue_id)
When there is no Rx packet coming in Rx Queue for a long time, we can sleep lcore related to Rx Queue for
power saving, and enable Rx interrupt to be triggered when Rx packet arrives.
The rte_eth_dev_rx_intr_enable() function enables Rx queue interrupt on specific Rx queue of a port.
Parametersport_id The port identifier of the Ethernet device.
queue_id The index of the receive queue from which to retrieve input packets. The value must be in
the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
Returns
• (0) if successful.
• (-ENOTSUP) if underlying hardware OR driver doesn't support that operation.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
intrte_eth_dev_rx_intr_disable(uint16_tport_id,uint16_tqueue_id)
When lcore wakes up from Rx interrupt indicating packet coming, disable Rx interrupt and returns to
polling mode.
The rte_eth_dev_rx_intr_disable() function disables Rx queue interrupt on specific Rx queue of a port.
Parametersport_id The port identifier of the Ethernet device.
queue_id The index of the receive queue from which to retrieve input packets. The value must be in
the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
Returns
• (0) if successful.
• (-ENOTSUP) if underlying hardware OR driver doesn't support that operation.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
intrte_eth_dev_rx_intr_ctl(uint16_tport_id,intepfd,intop,void*data)
Rx Interrupt control per port.
Parametersport_id The port identifier of the Ethernet device.
epfd Epoll instance fd which the intr vector associated to. Using RTE_EPOLL_PER_THREAD allows to use
per thread epoll instance.
op The operation be performed for the vector. Operation type of {RTE_INTR_EVENT_ADD,
RTE_INTR_EVENT_DEL}.
data User raw data.
Returns
• On success, zero.
• On failure, a negative value.
intrte_eth_dev_rx_intr_ctl_q(uint16_tport_id,uint16_tqueue_id,intepfd,intop,void*data)
Rx Interrupt control per queue.
Parametersport_id The port identifier of the Ethernet device.
queue_id The index of the receive queue from which to retrieve input packets. The value must be in
the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
epfd Epoll instance fd which the intr vector associated to. Using RTE_EPOLL_PER_THREAD allows to use
per thread epoll instance.
op The operation be performed for the vector. Operation type of {RTE_INTR_EVENT_ADD,
RTE_INTR_EVENT_DEL}.
data User raw data.
Returns
• On success, zero.
• On failure, a negative value.
intrte_eth_dev_rx_intr_ctl_q_get_fd(uint16_tport_id,uint16_tqueue_id)
Get interrupt fd per Rx queue.
Parametersport_id The port identifier of the Ethernet device.
queue_id The index of the receive queue from which to retrieve input packets. The value must be in
the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
Returns
• (>=0) the interrupt fd associated to the requested Rx queue if successful.
• (-1) on error.
intrte_eth_led_on(uint16_tport_id)
Turn on the LED on the Ethernet device. This function turns on the LED on the Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
Returns
• (0) if successful.
• (-ENOTSUP) if underlying hardware OR driver doesn't support that operation.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
intrte_eth_led_off(uint16_tport_id)
Turn off the LED on the Ethernet device. This function turns off the LED on the Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
Returns
• (0) if successful.
• (-ENOTSUP) if underlying hardware OR driver doesn't support that operation.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
__rte_experimentalintrte_eth_fec_get_capability(uint16_tport_id,structrte_eth_fec_capa*speed_fec_capa,unsignedintnum)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Get Forward Error Correction(FEC) capability.
Parametersport_id The port identifier of the Ethernet device.
speed_fec_capa speed_fec_capa is out only with per-speed capabilities. If set to NULL, the function
returns the required number of required array entries.
num a number of elements in an speed_fec_capa array.
Returns
• A non-negative value lower or equal to num: success. The return value is the number of entries
filled in the fec capa array.
• A non-negative value higher than num: error, the given fec capa array is too small. The return
value corresponds to the num that should be given to succeed. The entries in fec capa array are not
valid and shall not be used by the caller.
• (-ENOTSUP) if underlying hardware OR driver doesn't support. that operation.
• (-EIO) if device is removed.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if num or speed_fec_capa invalid
__rte_experimentalintrte_eth_fec_get(uint16_tport_id,uint32_t*fec_capa)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Get current Forward Error Correction(FEC) mode. If link is down and AUTO is enabled, AUTO is returned,
otherwise, configured FEC mode is returned. If link is up, current FEC mode is returned.
Parametersport_id The port identifier of the Ethernet device.
fec_capa A bitmask with the current FEC mode.
Returns
• (0) if successful.
• (-ENOTSUP) if underlying hardware OR driver doesn't support. that operation.
• (-EIO) if device is removed.
• (-ENODEV) if port_id invalid.
__rte_experimentalintrte_eth_fec_set(uint16_tport_id,uint32_tfec_capa)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Set Forward Error Correction(FEC) mode.
Parametersport_id The port identifier of the Ethernet device.
fec_capa A bitmask of allowed FEC modes. If only the AUTO bit is set, the decision on which FEC mode
to use will be made by HW/FW or driver. If the AUTO bit is set with some FEC modes, only specified
FEC modes can be set. If AUTO bit is clear, specify FEC mode to be used (only one valid mode per
speed may be set).
Returns
• (0) if successful.
• (-EINVAL) if the FEC mode is not valid.
• (-ENOTSUP) if underlying hardware OR driver doesn't support.
• (-EIO) if device is removed.
• (-ENODEV) if port_id invalid.
intrte_eth_dev_flow_ctrl_get(uint16_tport_id,structrte_eth_fc_conf*fc_conf)
Get current status of the Ethernet link flow control for Ethernet device
Parametersport_id The port identifier of the Ethernet device.
fc_conf The pointer to the structure where to store the flow control parameters.
Returns
• (0) if successful.
• (-ENOTSUP) if hardware doesn't support flow control.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• (-EINVAL) if bad parameter.
intrte_eth_dev_flow_ctrl_set(uint16_tport_id,structrte_eth_fc_conf*fc_conf)
Configure the Ethernet link flow control for Ethernet device
Parametersport_id The port identifier of the Ethernet device.
fc_conf The pointer to the structure of the flow control parameters.
Returns
• (0) if successful.
• (-ENOTSUP) if hardware doesn't support flow control mode.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter
• (-EIO) if flow control setup failure or device is removed.
intrte_eth_dev_priority_flow_ctrl_set(uint16_tport_id,structrte_eth_pfc_conf*pfc_conf)
Configure the Ethernet priority flow control under DCB environment for Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
pfc_conf The pointer to the structure of the priority flow control parameters.
Returns
• (0) if successful.
• (-ENOTSUP) if hardware doesn't support priority flow control mode.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter
• (-EIO) if flow control setup failure or device is removed.
intrte_eth_dev_mac_addr_add(uint16_tport_id,structrte_ether_addr*mac_addr,uint32_tpool)
Add a MAC address to the set used for filtering incoming packets.
Parametersport_id The port identifier of the Ethernet device.
mac_addr The MAC address to add.
pool VMDq pool index to associate address with (if VMDq is enabled). If VMDq is not enabled, this
should be set to 0.
Returns
• (0) if successfully added or mac_addr was already added.
• (-ENOTSUP) if hardware doesn't support this feature.
• (-ENODEV) if port is invalid.
• (-EIO) if device is removed.
• (-ENOSPC) if no more MAC addresses can be added.
• (-EINVAL) if MAC address is invalid.
__rte_experimentalintrte_eth_dev_priority_flow_ctrl_queue_info_get(uint16_tport_id,structrte_eth_pfc_queue_info*pfc_queue_info)WarningEXPERIMENTAL: this API may change without prior notice.
Retrieve the information for queue based PFC.
Parametersport_id The port identifier of the Ethernet device.
pfc_queue_info A pointer to a structure of type rte_eth_pfc_queue_infotobefilledwiththeinformationaboutqueuebasedPFC.Returns
• (0) if successful.
• (-ENOTSUP) if support for priority_flow_ctrl_queue_info_get does not exist.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter.
__rte_experimentalintrte_eth_dev_priority_flow_ctrl_queue_configure(uint16_tport_id,structrte_eth_pfc_queue_conf*pfc_queue_conf)WarningEXPERIMENTAL: this API may change without prior notice.
Configure the queue based priority flow control for a given queue for Ethernet device.
Note
When an ethdev port switches to queue based PFC mode, the unconfigured queues shall be configured by
the driver with default values such as lower priority value for TC etc.
Parametersport_id The port identifier of the Ethernet device.
pfc_queue_conf The pointer to the structure of the priority flow control parameters for the queue.
Returns
• (0) if successful.
• (-ENOTSUP) if hardware doesn't support queue based PFC mode.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter
• (-EIO) if flow control setup queue failure
intrte_eth_dev_mac_addr_remove(uint16_tport_id,structrte_ether_addr*mac_addr)
Remove a MAC address from the internal array of addresses.
Parametersport_id The port identifier of the Ethernet device.
mac_addr MAC address to remove.
Returns
• (0) if successful, or mac_addr didn't exist.
• (-ENOTSUP) if hardware doesn't support.
• (-ENODEV) if port invalid.
• (-EADDRINUSE) if attempting to remove the default MAC address.
• (-EINVAL) if MAC address is invalid.
intrte_eth_dev_default_mac_addr_set(uint16_tport_id,structrte_ether_addr*mac_addr)
Set the default MAC address. It replaces the address at index 0 of the MAC address list. If the address
was already in the MAC address list, please remove it first.
Parametersport_id The port identifier of the Ethernet device.
mac_addr New default MAC address.
Returns
• (0) if successful, or mac_addr didn't exist.
• (-ENOTSUP) if hardware doesn't support.
• (-ENODEV) if port invalid.
• (-EINVAL) if MAC address is invalid.
• (-EEXIST) if MAC address was already in the address list.
intrte_eth_dev_rss_reta_update(uint16_tport_id,structrte_eth_rss_reta_entry64*reta_conf,uint16_treta_size)
Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
reta_conf RETA to update.
reta_size Redirection table size. The table size can be queried by rte_eth_dev_info_get().
Returns
• (0) if successful.
• (-ENODEV) if port_id is invalid.
• (-ENOTSUP) if hardware doesn't support.
• (-EINVAL) if bad parameter.
• (-EIO) if device is removed.
intrte_eth_dev_rss_reta_query(uint16_tport_id,structrte_eth_rss_reta_entry64*reta_conf,uint16_treta_size)
Query Redirection Table(RETA) of Receive Side Scaling of Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
reta_conf RETA to query. For each requested reta entry, corresponding bit in mask must be set.
reta_size Redirection table size. The table size can be queried by rte_eth_dev_info_get().
Returns
• (0) if successful.
• (-ENODEV) if port_id is invalid.
• (-ENOTSUP) if hardware doesn't support.
• (-EINVAL) if bad parameter.
• (-EIO) if device is removed.
intrte_eth_dev_uc_hash_table_set(uint16_tport_id,structrte_ether_addr*addr,uint8_ton)
Updates unicast hash table for receiving packet with the given destination MAC address, and the packet is
routed to all VFs for which the Rx mode is accept packets that match the unicast hash table.
Parametersport_id The port identifier of the Ethernet device.
addr Unicast MAC address.
on 1 - Set an unicast hash bit for receiving packets with the MAC address. 0 - Clear an unicast hash
bit.
Returns
• (0) if successful.
• (-ENOTSUP) if hardware doesn't support.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• (-EINVAL) if bad parameter.
intrte_eth_dev_uc_all_hash_table_set(uint16_tport_id,uint8_ton)
Updates all unicast hash bitmaps for receiving packet with any Unicast Ethernet MAC addresses,the packet
is routed to all VFs for which the Rx mode is accept packets that match the unicast hash table.
Parametersport_id The port identifier of the Ethernet device.
on 1 - Set all unicast hash bitmaps for receiving all the Ethernet MAC addresses 0 - Clear all
unicast hash bitmaps
Returns
• (0) if successful.
• (-ENOTSUP) if hardware doesn't support.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• (-EINVAL) if bad parameter.
intrte_eth_set_queue_rate_limit(uint16_tport_id,uint16_tqueue_idx,uint32_ttx_rate)
Set the rate limitation for a queue on an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
queue_idx The queue ID.
tx_rate The Tx rate in Mbps. Allocated from the total port link speed.
Returns
• (0) if successful.
• (-ENOTSUP) if hardware doesn't support this feature.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• (-EINVAL) if bad parameter.
intrte_eth_dev_rss_hash_update(uint16_tport_id,structrte_eth_rss_conf*rss_conf)
Configuration of Receive Side Scaling hash computation of Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
rss_conf The new configuration to use for RSS hash computation on the port.
Returns
• (0) if successful.
• (-ENODEV) if port identifier is invalid.
• (-EIO) if device is removed.
• (-ENOTSUP) if hardware doesn't support.
• (-EINVAL) if bad parameter.
intrte_eth_dev_rss_hash_conf_get(uint16_tport_id,structrte_eth_rss_conf*rss_conf)
Retrieve current configuration of Receive Side Scaling hash computation of Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
rss_conf Where to store the current RSS hash configuration of the Ethernet device.
Returns
• (0) if successful.
• (-ENODEV) if port identifier is invalid.
• (-EIO) if device is removed.
• (-ENOTSUP) if hardware doesn't support RSS.
• (-EINVAL) if bad parameter.
__rte_experimentalconstchar*rte_eth_dev_rss_algo_name(enumrte_eth_hash_functionrss_algo)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice.
Get the name of RSS hash algorithm.
Parametersrss_algo Hash algorithm.
Returns
Hash algorithm name or 'UNKNOWN' if the rss_algo cannot be recognized.
__rte_experimentalintrte_eth_find_rss_algo(constchar*name,uint32_t*algo)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice.
Get RSS hash algorithm by its name.
Parametersname RSS hash algorithm.
algo Return the RSS hash algorithm found,
Seealsorte_eth_hash_function.
Returns
• (0) if successful.
• (-EINVAL) if not found.
intrte_eth_dev_udp_tunnel_port_add(uint16_tport_id,structrte_eth_udp_tunnel*tunnel_udp)
Add UDP tunneling port for a type of tunnel.
Some NICs may require such configuration to properly parse a tunnel with any standard or custom UDP port.
The packets with this UDP port will be parsed for this type of tunnel. The device parser will also check
the rest of the tunnel headers before classifying the packet.
With some devices, this API will affect packet classification, i.e.:
• mbuf.packet_type reported on Rx
• rte_flow rules with tunnel items
Parametersport_id The port identifier of the Ethernet device.
tunnel_udp UDP tunneling configuration.
Returns
• (0) if successful.
• (-ENODEV) if port identifier is invalid.
• (-EIO) if device is removed.
• (-ENOTSUP) if hardware doesn't support tunnel type.
intrte_eth_dev_udp_tunnel_port_delete(uint16_tport_id,structrte_eth_udp_tunnel*tunnel_udp)
Delete UDP tunneling port for a type of tunnel.
The packets with this UDP port will not be classified as this type of tunnel anymore if the device use
such mapping for tunnel packet classification.
Seealsorte_eth_dev_udp_tunnel_port_addParametersport_id The port identifier of the Ethernet device.
tunnel_udp UDP tunneling configuration.
Returns
• (0) if successful.
• (-ENODEV) if port identifier is invalid.
• (-EIO) if device is removed.
• (-ENOTSUP) if hardware doesn't support tunnel type.
intrte_eth_dev_get_dcb_info(uint16_tport_id,structrte_eth_dcb_info*dcb_info)
Get DCB information on an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
dcb_info DCB information.
Returns
• (0) if successful.
• (-ENODEV) if port identifier is invalid.
• (-EIO) if device is removed.
• (-ENOTSUP) if hardware doesn't support.
• (-EINVAL) if bad parameter.
conststructrte_eth_rxtx_callback*rte_eth_add_rx_callback(uint16_tport_id,uint16_tqueue_id,rte_rx_callback_fnfn,void*user_param)
Add a callback to be called on packet Rx on a given port and queue.
This API configures a function to be called for each burst of packets received on a given NIC port queue.
The return value is a pointer that can be used to later remove the callback using
rte_eth_remove_rx_callback().
Multiple functions are called in the order that they are added.
Parametersport_id The port identifier of the Ethernet device.
queue_id The queue on the Ethernet device on which the callback is to be added.
fn The callback function
user_param A generic pointer parameter which will be passed to each invocation of the callback
function on this port and queue. Inter-thread synchronization of any user data changes is the
responsibility of the user.
Returns
NULL on error. On success, a pointer value which can later be used to remove the callback.
conststructrte_eth_rxtx_callback*rte_eth_add_first_rx_callback(uint16_tport_id,uint16_tqueue_id,rte_rx_callback_fnfn,void*user_param)
Add a callback that must be called first on packet Rx on a given port and queue.
This API configures a first function to be called for each burst of packets received on a given NIC port
queue. The return value is a pointer that can be used to later remove the callback using
rte_eth_remove_rx_callback().
Multiple functions are called in the order that they are added.
Parametersport_id The port identifier of the Ethernet device.
queue_id The queue on the Ethernet device on which the callback is to be added.
fn The callback function
user_param A generic pointer parameter which will be passed to each invocation of the callback
function on this port and queue. Inter-thread synchronization of any user data changes is the
responsibility of the user.
Returns
NULL on error. On success, a pointer value which can later be used to remove the callback.
conststructrte_eth_rxtx_callback*rte_eth_add_tx_callback(uint16_tport_id,uint16_tqueue_id,rte_tx_callback_fnfn,void*user_param)
Add a callback to be called on packet Tx on a given port and queue.
This API configures a function to be called for each burst of packets sent on a given NIC port queue. The
return value is a pointer that can be used to later remove the callback using
rte_eth_remove_tx_callback().
Multiple functions are called in the order that they are added.
Parametersport_id The port identifier of the Ethernet device.
queue_id The queue on the Ethernet device on which the callback is to be added.
fn The callback function
user_param A generic pointer parameter which will be passed to each invocation of the callback
function on this port and queue. Inter-thread synchronization of any user data changes is the
responsibility of the user.
Returns
NULL on error. On success, a pointer value which can later be used to remove the callback.
intrte_eth_remove_rx_callback(uint16_tport_id,uint16_tqueue_id,conststructrte_eth_rxtx_callback*user_cb)
Remove an Rx packet callback from a given port and queue.
This function is used to removed callbacks that were added to a NIC port queue using
rte_eth_add_rx_callback().
Note: the callback is removed from the callback list but it isn't freed since the it may still be in use.
The memory for the callback can be subsequently freed back by the application by calling rte_free():
• Immediately - if the port is stopped, or the user knows that no callbacks are in flight e.g. if called
from the thread doing Rx/Tx on that queue.
• After a short delay - where the delay is sufficient to allow any in-flight callbacks to complete.
Alternately, the RCU mechanism can be used to detect when data plane threads have ceased referencing
the callback memory.
Parametersport_id The port identifier of the Ethernet device.
queue_id The queue on the Ethernet device from which the callback is to be removed.
user_cb User supplied callback created via rte_eth_add_rx_callback().
Returns
• 0: Success. Callback was removed.
• -ENODEV: If port_id is invalid.
• -ENOTSUP: Callback support is not available.
• -EINVAL: The queue_id is out of range, or the callback is NULL or not found for the port/queue.
intrte_eth_remove_tx_callback(uint16_tport_id,uint16_tqueue_id,conststructrte_eth_rxtx_callback*user_cb)
Remove a Tx packet callback from a given port and queue.
This function is used to removed callbacks that were added to a NIC port queue using
rte_eth_add_tx_callback().
Note: the callback is removed from the callback list but it isn't freed since the it may still be in use.
The memory for the callback can be subsequently freed back by the application by calling rte_free():
• Immediately - if the port is stopped, or the user knows that no callbacks are in flight e.g. if called
from the thread doing Rx/Tx on that queue.
• After a short delay - where the delay is sufficient to allow any in-flight callbacks to complete.
Alternately, the RCU mechanism can be used to detect when data plane threads have ceased referencing
the callback memory.
Parametersport_id The port identifier of the Ethernet device.
queue_id The queue on the Ethernet device from which the callback is to be removed.
user_cb User supplied callback created via rte_eth_add_tx_callback().
Returns
• 0: Success. Callback was removed.
• -ENODEV: If port_id is invalid.
• -ENOTSUP: Callback support is not available.
• -EINVAL: The queue_id is out of range, or the callback is NULL or not found for the port/queue.
intrte_eth_rx_queue_info_get(uint16_tport_id,uint16_tqueue_id,structrte_eth_rxq_info*qinfo)
Retrieve information about given port's Rx queue.
Parametersport_id The port identifier of the Ethernet device.
queue_id The Rx queue on the Ethernet device for which information will be retrieved.
qinfo A pointer to a structure of type rte_eth_rxq_info_info to be filled with the information of the
Ethernet device.
Returns
• 0: Success
• -ENODEV: If port_id is invalid.
• -ENOTSUP: routine is not supported by the device PMD.
• -EINVAL: The queue_id is out of range, or the queue is hairpin queue.
intrte_eth_tx_queue_info_get(uint16_tport_id,uint16_tqueue_id,structrte_eth_txq_info*qinfo)
Retrieve information about given port's Tx queue.
Parametersport_id The port identifier of the Ethernet device.
queue_id The Tx queue on the Ethernet device for which information will be retrieved.
qinfo A pointer to a structure of type rte_eth_txq_info_info to be filled with the information of the
Ethernet device.
Returns
• 0: Success
• -ENODEV: If port_id is invalid.
• -ENOTSUP: routine is not supported by the device PMD.
• -EINVAL: The queue_id is out of range, or the queue is hairpin queue.
__rte_experimentalintrte_eth_recycle_rx_queue_info_get(uint16_tport_id,uint16_tqueue_id,structrte_eth_recycle_rxq_info*recycle_rxq_info)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Retrieve information about given ports's Rx queue for recycling mbufs.
Parametersport_id The port identifier of the Ethernet device.
queue_id The Rx queue on the Ethernet devicefor which information will be retrieved.
recycle_rxq_info A pointer to a structure of type rte_eth_recycle_rxq_infotobefilled.Returns
• 0: Success
• -ENODEV: If port_id is invalid.
• -ENOTSUP: routine is not supported by the device PMD.
• -EINVAL: The queue_id is out of range.
intrte_eth_rx_burst_mode_get(uint16_tport_id,uint16_tqueue_id,structrte_eth_burst_mode*mode)
Retrieve information about the Rx packet burst mode.
Parametersport_id The port identifier of the Ethernet device.
queue_id The Rx queue on the Ethernet device for which information will be retrieved.
mode A pointer to a structure of type rte_eth_burst_modetobefilledwiththeinformationofthepacketburstmode.Returns
• 0: Success
• -ENODEV: If port_id is invalid.
• -ENOTSUP: routine is not supported by the device PMD.
• -EINVAL: The queue_id is out of range.
intrte_eth_tx_burst_mode_get(uint16_tport_id,uint16_tqueue_id,structrte_eth_burst_mode*mode)
Retrieve information about the Tx packet burst mode.
Parametersport_id The port identifier of the Ethernet device.
queue_id The Tx queue on the Ethernet device for which information will be retrieved.
mode A pointer to a structure of type rte_eth_burst_modetobefilledwiththeinformationofthepacketburstmode.Returns
• 0: Success
• -ENODEV: If port_id is invalid.
• -ENOTSUP: routine is not supported by the device PMD.
• -EINVAL: The queue_id is out of range.
__rte_experimentalintrte_eth_get_monitor_addr(uint16_tport_id,uint16_tqueue_id,structrte_power_monitor_cond*pmc)WarningEXPERIMENTAL: this API may change without prior notice.
Retrieve the monitor condition for a given receive queue.
Parametersport_id The port identifier of the Ethernet device.
queue_id The Rx queue on the Ethernet device for which information will be retrieved.
pmc The pointer to power-optimized monitoring condition structure.
Returns
• 0: Success. -ENOTSUP: Operation not supported. -EINVAL: Invalid parameters. -ENODEV: Invalid port
ID.
__rte_experimentalintrte_eth_dev_get_reg_info_ext(uint16_tport_id,structrte_dev_reg_info*info)
Retrieve the filtered device registers (values and names) and register attributes (number of registers
and register size)
Parametersport_id The port identifier of the Ethernet device.
info Pointer to rte_dev_reg_info structure to fill in.
• If info->filter is NULL, return info for all registers (seen as filter none).
• If info->filter is not NULL, return error if the driver does not support filter. Fill the length
field with filtered register number.
• If info->data is NULL, the function fills in the width and length fields.
• If info->data is not NULL, ethdev considers there are enough spaces to store the registers, and the
values of registers with the filter string as the module name are put into the buffer pointed at by
info->data.
• If info->names is not NULL, drivers should fill it or the ethdev fills it with default names.
Returns
• (0) if successful.
• (-ENOTSUP) if hardware doesn't support.
• (-EINVAL) if bad parameter.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• others depends on the specific operations implementation.
intrte_eth_dev_get_reg_info(uint16_tport_id,structrte_dev_reg_info*info)
Retrieve device registers and register attributes (number of registers and register size)
Parametersport_id The port identifier of the Ethernet device.
info Pointer to rte_dev_reg_info structure to fill in. If info->data is NULL the function fills in
the width and length fields. If non-NULL the registers are put into the buffer pointed at by the data
field.
Returns
• (0) if successful.
• (-ENOTSUP) if hardware doesn't support.
• (-EINVAL) if bad parameter.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• others depends on the specific operations implementation.
intrte_eth_dev_get_eeprom_length(uint16_tport_id)
Retrieve size of device EEPROM
Parametersport_id The port identifier of the Ethernet device.
Returns
• (>=0) EEPROM size if successful.
• (-ENOTSUP) if hardware doesn't support.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• others depends on the specific operations implementation.
intrte_eth_dev_get_eeprom(uint16_tport_id,structrte_dev_eeprom_info*info)
Retrieve EEPROM and EEPROM attribute
Parametersport_id The port identifier of the Ethernet device.
info The template includes buffer for return EEPROM data and EEPROM attributes to be filled.
Returns
• (0) if successful.
• (-ENOTSUP) if hardware doesn't support.
• (-EINVAL) if bad parameter.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• others depends on the specific operations implementation.
intrte_eth_dev_set_eeprom(uint16_tport_id,structrte_dev_eeprom_info*info)
Program EEPROM with provided data
Parametersport_id The port identifier of the Ethernet device.
info The template includes EEPROM data for programming and EEPROM attributes to be filled
Returns
• (0) if successful.
• (-ENOTSUP) if hardware doesn't support.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter.
• (-EIO) if device is removed.
• others depends on the specific operations implementation.
__rte_experimentalintrte_eth_dev_get_module_info(uint16_tport_id,structrte_eth_dev_module_info*modinfo)WarningEXPERIMENTAL: this API may change without prior notice.
Retrieve the type and size of plugin module EEPROM
Parametersport_id The port identifier of the Ethernet device.
modinfo The type and size of plugin module EEPROM.
Returns
• (0) if successful.
• (-ENOTSUP) if hardware doesn't support.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter.
• (-EIO) if device is removed.
• others depends on the specific operations implementation.
__rte_experimentalintrte_eth_dev_get_module_eeprom(uint16_tport_id,structrte_dev_eeprom_info*info)WarningEXPERIMENTAL: this API may change without prior notice.
Retrieve the data of plugin module EEPROM
Parametersport_id The port identifier of the Ethernet device.
info The template includes the plugin module EEPROM attributes, and the buffer for return plugin
module EEPROM data.
Returns
• (0) if successful.
• (-ENOTSUP) if hardware doesn't support.
• (-EINVAL) if bad parameter.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• others depends on the specific operations implementation.
intrte_eth_dev_set_mc_addr_list(uint16_tport_id,structrte_ether_addr*mc_addr_set,uint32_tnb_mc_addr)
Set the list of multicast addresses to filter on an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
mc_addr_set The array of multicast addresses to set. Equal to NULL when the function is invoked to
flush the set of filtered addresses.
nb_mc_addr The number of multicast addresses in the mc_addr_set array. Equal to 0 when the function
is invoked to flush the set of filtered addresses.
Returns
• (0) if successful.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• (-ENOTSUP) if PMD of port_id doesn't support multicast filtering.
• (-ENOSPC) if port_id has not enough multicast filtering resources.
• (-EINVAL) if bad parameter.
intrte_eth_timesync_enable(uint16_tport_id)
Enable IEEE1588/802.1AS timestamping for an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
Returns
• 0: Success.
• -ENODEV: The port ID is invalid.
• -EIO: if device is removed.
• -ENOTSUP: The function is not supported by the Ethernet driver.
intrte_eth_timesync_disable(uint16_tport_id)
Disable IEEE1588/802.1AS timestamping for an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
Returns
• 0: Success.
• -ENODEV: The port ID is invalid.
• -EIO: if device is removed.
• -ENOTSUP: The function is not supported by the Ethernet driver.
intrte_eth_timesync_read_rx_timestamp(uint16_tport_id,structtimespec*timestamp,uint32_tflags)
Read an IEEE1588/802.1AS Rx timestamp from an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
timestamp Pointer to the timestamp struct.
flags Device specific flags. Used to pass the Rx timesync register index to i40e. Unused in
igb/ixgbe, pass 0 instead.
Returns
• 0: Success.
• -EINVAL: No timestamp is available.
• -ENODEV: The port ID is invalid.
• -EIO: if device is removed.
• -ENOTSUP: The function is not supported by the Ethernet driver.
intrte_eth_timesync_read_tx_timestamp(uint16_tport_id,structtimespec*timestamp)
Read an IEEE1588/802.1AS Tx timestamp from an Ethernet device.
Parametersport_id The port identifier of the Ethernet device.
timestamp Pointer to the timestamp struct.
Returns
• 0: Success.
• -EINVAL: No timestamp is available.
• -ENODEV: The port ID is invalid.
• -EIO: if device is removed.
• -ENOTSUP: The function is not supported by the Ethernet driver.
intrte_eth_timesync_adjust_time(uint16_tport_id,int64_tdelta)
Adjust the timesync clock on an Ethernet device.
This is usually used in conjunction with other Ethdev timesync functions to synchronize the device time
using the IEEE1588/802.1AS protocol.
Parametersport_id The port identifier of the Ethernet device.
delta The adjustment in nanoseconds.
Returns
• 0: Success.
• -ENODEV: The port ID is invalid.
• -EIO: if device is removed.
• -ENOTSUP: The function is not supported by the Ethernet driver.
__rte_experimentalintrte_eth_timesync_adjust_freq(uint16_tport_id,int64_tppm)
Adjust the clock frequency on an Ethernet device.
Adjusts the base frequency by a specified percentage of ppm (parts per million). This is usually used in
conjunction with other Ethdev timesync functions to synchronize the device time using the
IEEE1588/802.1AS protocol.
The clock is subject to frequency deviation and rate of change drift due to the environment. The upper
layer APP calculates the frequency compensation value of the slave clock relative to the master clock via
a servo algorithm and adjusts the device clock frequency via 'rte_eth_timesync_adjust_freq()'. Commonly
used servo algorithms are pi/linreg/ntpshm, for implementation see: https://github.com/nxp-
archive/openil_linuxptp.git.
The adjustment value obtained by the servo algorithm is usually in ppb (parts per billion). For
consistency with the kernel driver .adjfine, the tuning values are in ppm. Note that 1 ppb is
approximately 65.536 scaled ppm, see Linux kernel upstream commit 1060707e3809 (‘ptp: introduce helpers
to adjust by scaled parts per million’).
In addition, the device reference frequency is usually also the stepping threshold for the servo
algorithm, and the frequency up and down adjustment range is limited by the device. The device clock
frequency should be adjusted with 'rte_eth_timesync_adjust_freq()' every time the clock is synchronised.
Also use ‘rte_eth_timesync_adjust_time()’ to update the device clock only if the absolute value of the
master/slave clock offset is greater than or equal to the step threshold.
Parametersport_id The port identifier of the Ethernet device.
ppm Parts per million with 16-bit fractional field
Returns
• 0: Success.
• -ENODEV: The port ID is invalid.
• -EIO: if device is removed.
• -ENOTSUP: The function is not supported by the Ethernet driver.
intrte_eth_timesync_read_time(uint16_tport_id,structtimespec*time)
Read the time from the timesync clock on an Ethernet device.
This is usually used in conjunction with other Ethdev timesync functions to synchronize the device time
using the IEEE1588/802.1AS protocol.
Parametersport_id The port identifier of the Ethernet device.
time Pointer to the timespec struct that holds the time.
Returns
• 0: Success.
• -EINVAL: Bad parameter.
intrte_eth_timesync_write_time(uint16_tport_id,conststructtimespec*time)
Set the time of the timesync clock on an Ethernet device.
This is usually used in conjunction with other Ethdev timesync functions to synchronize the device time
using the IEEE1588/802.1AS protocol.
Parametersport_id The port identifier of the Ethernet device.
time Pointer to the timespec struct that holds the time.
Returns
• 0: Success.
• -EINVAL: No timestamp is available.
• -ENODEV: The port ID is invalid.
• -EIO: if device is removed.
• -ENOTSUP: The function is not supported by the Ethernet driver.
__rte_experimentalintrte_eth_read_clock(uint16_tport_id,uint64_t*clock)WarningEXPERIMENTAL: this API may change without prior notice.
Read the current clock counter of an Ethernet device
This returns the current raw clock value of an Ethernet device. It is a raw amount of ticks, with no
given time reference. The value returned here is from the same clock than the one filling timestamp field
of Rx packets when using hardware timestamp offload. Therefore it can be used to compute a precise
conversion of the device clock to the real time.
E.g, a simple heuristic to derivate the frequency would be: uint64_t start, end; rte_eth_read_clock(port,
start); rte_delay_ms(100); rte_eth_read_clock(port, end); double freq = (end - start) * 10;
Compute a common reference with: uint64_t base_time_sec = current_time(); uint64_t base_clock;
rte_eth_read_clock(port, base_clock);
Then, convert the raw mbuf timestamp with: base_time_sec + (double)(*timestamp_dynfield(mbuf) -
base_clock) / freq;
This simple example will not provide a very good accuracy. One must at least measure multiple times the
frequency and do a regression. To avoid deviation from the system time, the common reference can be
repeated from time to time. The integer division can also be converted by a multiplication and a shift
for better performance.
Parametersport_id The port identifier of the Ethernet device.
clock Pointer to the uint64_t that holds the raw clock value.
Returns
• 0: Success.
• -ENODEV: The port ID is invalid.
• -ENOTSUP: The function is not supported by the Ethernet driver.
• -EINVAL: if bad parameter.
intrte_eth_dev_get_port_by_name(constchar*name,uint16_t*port_id)
Get the port ID from device name. The device name should be specified as below:
• PCIe address (Domain:Bus:Device.Function), for example- 0000:2:00.0
• SoC device name, for example- fsl-gmac0
• vdev dpdk name, for example- net_[pcap0|null0|tap0]
Parametersname PCI address or name of the device.
port_id Pointer to port identifier of the device.
Returns
• (0) if successful and port_id is filled.
• (-ENODEV or -EINVAL) on failure.
intrte_eth_dev_get_name_by_port(uint16_tport_id,char*name)
Get the device name from port ID. The device name is specified as below:
• PCIe address (Domain:Bus:Device.Function), for example- 0000:02:00.0
• SoC device name, for example- fsl-gmac0
• vdev dpdk name, for example- net_[pcap0|null0|tun0|tap0]
Parametersport_id Port identifier of the device.
name Buffer of size RTE_ETH_NAME_MAX_LEN to store the name.
Returns
• (0) if successful.
• (-ENODEV) if port_id is invalid.
• (-EINVAL) on failure.
intrte_eth_dev_adjust_nb_rx_tx_desc(uint16_tport_id,uint16_t*nb_rx_desc,uint16_t*nb_tx_desc)
Check that numbers of Rx and Tx descriptors satisfy descriptors limits from the Ethernet device
information, otherwise adjust them to boundaries.
Parametersport_id The port identifier of the Ethernet device.
nb_rx_desc A pointer to a uint16_t where the number of receive descriptors stored.
nb_tx_desc A pointer to a uint16_t where the number of transmit descriptors stored.
Returns
• (0) if successful.
• (-ENOTSUP, -ENODEV or -EINVAL) on failure.
intrte_eth_dev_pool_ops_supported(uint16_tport_id,constchar*pool)
Test if a port supports specific mempool ops.
Parametersport_id Port identifier of the Ethernet device.
pool The name of the pool operations to test.
Returns
• 0: best mempool ops choice for this port.
• 1: mempool ops are supported for this port.
• -ENOTSUP: mempool ops not supported for this port.
• -ENODEV: Invalid port Identifier.
• -EINVAL: Pool param is null.
void*rte_eth_dev_get_sec_ctx(uint16_tport_id)
Get the security context for the Ethernet device.
Parametersport_id Port identifier of the Ethernet device
Returns
• NULL on error.
• pointer to security context on success.
__rte_experimentalintrte_eth_dev_hairpin_capability_get(uint16_tport_id,structrte_eth_hairpin_cap*cap)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Query the device hairpin capabilities.
Parametersport_id The port identifier of the Ethernet device.
cap Pointer to a structure that will hold the hairpin capabilities.
Returns
• (0) if successful.
• (-ENOTSUP) if hardware doesn't support.
• (-EINVAL) if bad parameter.
__rte_experimentalintrte_eth_representor_info_get(uint16_tport_id,structrte_eth_representor_info*info)
Retrieve the representor info of the device.
Get device representor info to be able to calculate a unique representor ID.
Seealso
rte_eth_representor_id_get helper.
Parametersport_id The port identifier of the device.
info A pointer to a representor info structure. NULL to return number of range entries and allocate
memory for next call to store detail. The number of ranges that were written into this structure will
be placed into its nb_ranges field. This number cannot be larger than the nb_ranges_alloc that by the
user before calling this function. It can be smaller than the value returned by the function,
however.
Returns
• (-ENOTSUP) if operation is not supported.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• (>=0) number of available representor range entries.
intrte_eth_rx_metadata_negotiate(uint16_tport_id,uint64_t*features)
Negotiate the NIC's ability to deliver specific kinds of metadata to the PMD.
Invoke this API before the first rte_eth_dev_configure() invocation to let the PMD make preparations that
are inconvenient to do later.
The negotiation process is as follows:
• the application requests features intending to use at least some of them;
• the PMD responds with the guaranteed subset of the requested feature set;
• the application can retry negotiation with another set of features;
• the application can pass zero to clear the negotiation result;
• the last negotiated result takes effect upon the ethdev configure and start.
Note
The PMD is supposed to first consider enabling the requested feature set in its entirety. Only if it
fails to do so, does it have the right to respond with a smaller set of the originally requested
features.
Return code (-ENOTSUP) does not necessarily mean that the requested features are unsupported. In this
case, the application should just assume that these features can be used without prior negotiations.
Parametersport_id Port (ethdev) identifier
features Feature selection buffer
Returns
• (-EBUSY) if the port can't handle this in its current state;
• (-ENOTSUP) if the method itself is not supported by the PMD;
• (-ENODEV) if port_id is invalid;
• (-EINVAL) if features is NULL;
• (-EIO) if the device is removed;
• (0) on success
__rte_experimentalintrte_eth_ip_reassembly_capability_get(uint16_tport_id,structrte_eth_ip_reassembly_params*capa)WarningEXPERIMENTAL: this API may change without prior notice
Get IP reassembly capabilities supported by the PMD. This is the first API to be called for enabling the
IP reassembly offload feature. PMD will return the maximum values of parameters that PMD can support and
user can call rte_eth_ip_reassembly_conf_set() with param values lower than capability.
Parametersport_id The port identifier of the device.
capa A pointer to rte_eth_ip_reassembly_params structure.
Returns
• (-ENOTSUP) if offload configuration is not supported by device.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• (-EINVAL) if device is not configured or capa passed is NULL.
• (0) on success.
__rte_experimentalintrte_eth_ip_reassembly_conf_get(uint16_tport_id,structrte_eth_ip_reassembly_params*conf)WarningEXPERIMENTAL: this API may change without prior notice
Get IP reassembly configuration parameters currently set in PMD. The API will return error if the
configuration is not already set using rte_eth_ip_reassembly_conf_set() before calling this API or if the
device is not configured.
Parametersport_id The port identifier of the device.
conf A pointer to rte_eth_ip_reassembly_params structure.
Returns
• (-ENOTSUP) if offload configuration is not supported by device.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• (-EINVAL) if device is not configured or if conf passed is NULL or if configuration is not set
using rte_eth_ip_reassembly_conf_set().
• (0) on success.
__rte_experimentalintrte_eth_ip_reassembly_conf_set(uint16_tport_id,conststructrte_eth_ip_reassembly_params*conf)WarningEXPERIMENTAL: this API may change without prior notice
Set IP reassembly configuration parameters if the PMD supports IP reassembly offload. User should first
call rte_eth_ip_reassembly_capability_get() to check the maximum values supported by the PMD before
setting the configuration. The use of this API is mandatory to enable this feature and should be called
before rte_eth_dev_start().
In datapath, PMD cannot guarantee that IP reassembly is always successful. Hence, PMD shall register mbuf
dynamic field and dynamic flag using rte_eth_ip_reassembly_dynfield_register() to denote incomplete IP
reassembly. If dynfield is not successfully registered, error will be returned and IP reassembly offload
cannot be used.
Parametersport_id The port identifier of the device.
conf A pointer to rte_eth_ip_reassembly_params structure.
Returns
• (-ENOTSUP) if offload configuration is not supported by device.
• (-ENODEV) if port_id invalid.
• (-EIO) if device is removed.
• (-EINVAL) if device is not configured or if device is already started or if conf passed is NULL or
if mbuf dynfield is not registered successfully by the PMD.
• (0) on success.
__rte_experimentalintrte_eth_dev_priv_dump(uint16_tport_id,FILE*file)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Dump private info from device to a file. Provided data and the order depends on the PMD.
Parametersport_id The port identifier of the Ethernet device.
file A pointer to a file for output.
Returns
• (0) on success.
• (-ENODEV) if port_id is invalid.
• (-EINVAL) if null file.
• (-ENOTSUP) if the device does not support this function.
• (-EIO) if device is removed.
__rte_experimentalintrte_eth_rx_descriptor_dump(uint16_tport_id,uint16_tqueue_id,uint16_toffset,uint16_tnum,FILE*file)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Dump ethdev Rx descriptor info to a file.
This API is used for debugging, not a dataplane API.
Parametersport_id The port identifier of the Ethernet device.
queue_id A Rx queue identifier on this port.
offset The offset of the descriptor starting from tail. (0 is the next packet to be received by the
driver).
num The number of the descriptors to dump.
file A pointer to a file for output.
Returns
• On success, zero.
• On failure, a negative value.
__rte_experimentalintrte_eth_tx_descriptor_dump(uint16_tport_id,uint16_tqueue_id,uint16_toffset,uint16_tnum,FILE*file)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Dump ethdev Tx descriptor info to a file.
This API is used for debugging, not a dataplane API.
Parametersport_id The port identifier of the Ethernet device.
queue_id A Tx queue identifier on this port.
offset The offset of the descriptor starting from tail. (0 is the place where the next packet will be
send).
num The number of the descriptors to dump.
file A pointer to a file for output.
Returns
• On success, zero.
• On failure, a negative value.
__rte_experimentalintrte_eth_cman_info_get(uint16_tport_id,structrte_eth_cman_info*info)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Retrieve the information for ethdev congestion management
Parametersport_id The port identifier of the Ethernet device.
info A pointer to a structure of type rte_eth_cman_infotobefilledwiththeinformationaboutcongestionmanagement.Returns
• (0) if successful.
• (-ENOTSUP) if support for cman_info_get does not exist.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter.
__rte_experimentalintrte_eth_cman_config_init(uint16_tport_id,structrte_eth_cman_config*config)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Initialize the ethdev congestion management configuration structure with default values.
Parametersport_id The port identifier of the Ethernet device.
config A pointer to a structure of type rte_eth_cman_configtobeinitializedwithdefaultvalue.Returns
• (0) if successful.
• (-ENOTSUP) if support for cman_config_init does not exist.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter.
__rte_experimentalintrte_eth_cman_config_set(uint16_tport_id,conststructrte_eth_cman_config*config)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Configure ethdev congestion management
Parametersport_id The port identifier of the Ethernet device.
config A pointer to a structure of type rte_eth_cman_configtobeconfigured.Returns
• (0) if successful.
• (-ENOTSUP) if support for cman_config_set does not exist.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter.
__rte_experimentalintrte_eth_cman_config_get(uint16_tport_id,structrte_eth_cman_config*config)WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Retrieve the applied ethdev congestion management parameters for the given port.
Parametersport_id The port identifier of the Ethernet device.
config A pointer to a structure of type rte_eth_cman_configtoretrievecongestionmanagementparametersforthegivenobject.Applicationmustfillallparametersexceptmode_paramparameterinstructrte_eth_cman_config.Returns
• (0) if successful.
• (-ENOTSUP) if support for cman_config_get does not exist.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter.
staticuint16_trte_eth_rx_burst(uint16_tport_id,uint16_tqueue_id,structrte_mbuf**rx_pkts,constuint16_tnb_pkts)[inline],[static]
Retrieve a burst of input packets from a receive queue of an Ethernet device. The retrieved packets are
stored in rte_mbufstructureswhosepointersaresuppliedintherx_pktsarray.
The rte_eth_rx_burst() function loops, parsing the Rx ring of the receive queue, up to nb_pkts packets,
and for each completed Rx descriptor in the ring, it performs the following operations:
• Initialize the rte_mbufdatastructureassociatedwiththeRxdescriptoraccordingtotheinformationprovidedbytheNICintothatRxdescriptor.
• Store the rte_mbufdatastructureintothenextentryoftherx_pktsarray.
• Replenish the Rx descriptor with a new rte_mbufbufferallocatedfromthememorypoolassociatedwiththereceivequeueatinitializationtime.
When retrieving an input packet that was scattered by the controller into multiple receive descriptors,
the rte_eth_rx_burst() function appends the associated rte_mbufbufferstothefirstbufferofthepacket.
The rte_eth_rx_burst() function returns the number of packets actually retrieved, which is the number of
rte_mbufdatastructureseffectivelysuppliedintotherx_pktsarray.Areturnvalueequaltonb_pktsindicatesthattheRxqueuecontainedatleastrx_pktspackets,andthisislikelytosignifythatotherreceivedpacketsremainintheinputqueue.Applicationsimplementinga'retrieveasmuchreceivedpacketsaspossible'policycancheckthisspecificcaseandkeepinvokingtherte_eth_rx_burst()functionuntilavaluelessthannb_pktsisreturned.
This receive method has the following advantages:
• It allows a run-to-completion network stack engine to retrieve and to immediately process received
packets in a fast burst-oriented approach, avoiding the overhead of unnecessary intermediate packet
queue/dequeue operations.
• Conversely, it also allows an asynchronous-oriented processing method to retrieve bursts of received
packets and to immediately queue them for further parallel processing by another logical core, for
instance. However, instead of having received packets being individually queued by the driver, this
approach allows the caller of the rte_eth_rx_burst() function to queue a burst of retrieved packets at
a time and therefore dramatically reduce the cost of enqueue/dequeue operations per packet.
• It allows the rte_eth_rx_burst() function of the driver to take advantage of burst-oriented hardware
features (CPU cache, prefetch instructions, and so on) to minimize the number of CPU cycles per packet.
To summarize, the proposed receive API enables many burst-oriented optimizations in both synchronous and
asynchronous packet processing environments with no overhead in both cases.
Note
Some drivers using vector instructions require that nb_pkts is divisible by 4 or 8, depending on the
driver implementation.
The rte_eth_rx_burst() function does not provide any error notification to avoid the corresponding
overhead. As a hint, the upper-level application might check the status of the device link once being
systematically returned a 0 value for a given number of tries.
Parametersport_id The port identifier of the Ethernet device.
queue_id The index of the receive queue from which to retrieve input packets. The value must be in
the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
rx_pkts The address of an array of pointers to rte_mbufstructuresthatmustbelargeenoughtostorenb_pktspointersinit.nb_pktsThemaximumnumberofpacketstoretrieve.Thevaluemustbedivisibleby8inordertoworkwithanydriver.Returns
The number of packets actually retrieved, which is the number of pointers to rte_mbufstructureseffectivelysuppliedtotherx_pktsarray.
Definition at line 6262 of file rte_ethdev.h.
staticintrte_eth_rx_queue_count(uint16_tport_id,uint16_tqueue_id)[inline],[static]
Get the number of used descriptors of a Rx queue
Since it's a dataplane function, no check is performed on port_id and queue_id. The caller must therefore
ensure that the port is enabled and the queue is configured and running.
Parametersport_id The port identifier of the Ethernet device.
queue_id The queue ID on the specific port.
Returns
The number of used descriptors in the specific queue, or:
• (-ENODEV) if port_id is invalid.
• (-EINVAL) if queue_id is invalid
• (-ENOTSUP) if the device does not support this function
Definition at line 6338 of file rte_ethdev.h.
staticintrte_eth_rx_descriptor_status(uint16_tport_id,uint16_tqueue_id,uint16_toffset)[inline],[static]
Check the status of a Rx descriptor in the queue
It should be called in a similar context than the Rx function:
• on a dataplane core
• not concurrently on the same queue
Since it's a dataplane function, no check is performed on port_id and queue_id. The caller must therefore
ensure that the port is enabled and the queue is configured and running.
Note: accessing to a random descriptor in the ring may trigger cache misses and have a performance
impact.
Parametersport_id A valid port identifier of the Ethernet device which.
queue_id A valid Rx queue identifier on this port.
offset The offset of the descriptor starting from tail (0 is the next packet to be received by the
driver).
Returns
• (RTE_ETH_RX_DESC_AVAIL): Descriptor is available for the hardware to receive a packet.
• (RTE_ETH_RX_DESC_DONE): Descriptor is done, it is filled by hw, but not yet processed by the driver
(i.e. in the receive queue).
• (RTE_ETH_RX_DESC_UNAVAIL): Descriptor is unavailable, either hold by the driver and not yet
returned to hw, or reserved by the hw.
• (-EINVAL) bad descriptor offset.
• (-ENOTSUP) if the device does not support this function.
• (-ENODEV) bad port or queue (only if compiled with debug).
Definition at line 6410 of file rte_ethdev.h.
staticintrte_eth_tx_descriptor_status(uint16_tport_id,uint16_tqueue_id,uint16_toffset)[inline],[static]
Check the status of a Tx descriptor in the queue.
It should be called in a similar context than the Tx function:
• on a dataplane core
• not concurrently on the same queue
Since it's a dataplane function, no check is performed on port_id and queue_id. The caller must therefore
ensure that the port is enabled and the queue is configured and running.
Note: accessing to a random descriptor in the ring may trigger cache misses and have a performance
impact.
Parametersport_id A valid port identifier of the Ethernet device which.
queue_id A valid Tx queue identifier on this port.
offset The offset of the descriptor starting from tail (0 is the place where the next packet will be
send).
Returns
• (RTE_ETH_TX_DESC_FULL) Descriptor is being processed by the hw, i.e. in the transmit queue.
• (RTE_ETH_TX_DESC_DONE) Hardware is done with this descriptor, it can be reused by the driver.
• (RTE_ETH_TX_DESC_UNAVAIL): Descriptor is unavailable, reserved by the driver or the hardware.
• (-EINVAL) bad descriptor offset.
• (-ENOTSUP) if the device does not support this function.
• (-ENODEV) bad port or queue (only if compiled with debug).
Definition at line 6481 of file rte_ethdev.h.
staticuint16_trte_eth_tx_burst(uint16_tport_id,uint16_tqueue_id,structrte_mbuf**tx_pkts,uint16_tnb_pkts)[inline],[static]
Send a burst of output packets on a transmit queue of an Ethernet device.
The rte_eth_tx_burst() function is invoked to transmit output packets on the output queue queue_id of the
Ethernet device designated by its port_id. The nb_pkts parameter is the number of packets to send which
are supplied in the tx_pkts array of rte_mbufstructures,eachofthemallocatedfromapoolcreatedwithrte_pktmbuf_pool_create().Therte_eth_tx_burst()functionloops,sendingnb_pktspackets,uptothenumberoftransmitdescriptorsavailableintheTxringofthetransmitqueue.Foreachpackettosend,therte_eth_tx_burst()functionperformsthefollowingoperations:
• Pick up the next available descriptor in the transmit ring.
• Free the network buffer previously sent with that descriptor, if any.
• Initialize the transmit descriptor with the information provided in the *rte_mbuf data structure.
In the case of a segmented packet composed of a list of rte_mbufbuffers,therte_eth_tx_burst()functionusesseveraltransmitdescriptorsofthering.
The rte_eth_tx_burst() function returns the number of packets it actually sent. A return value equal to
nb_pkts means that all packets have been sent, and this is likely to signify that other output packets
could be immediately transmitted again. Applications that implement a 'send as many packets to transmit
as possible' policy can check this specific case and keep invoking the rte_eth_tx_burst() function until
a value less than nb_pkts is returned.
It is the responsibility of the rte_eth_tx_burst() function to transparently free the memory buffers of
packets previously sent. This feature is driven by the tx_free_thresh value supplied to the
rte_eth_dev_configure() function at device configuration time. When the number of free Tx descriptors
drops below this threshold, the rte_eth_tx_burst() function must [attempt to] free the rte_mbufbuffersofthosepacketswhosetransmissionwaseffectivelycompleted.
If the PMD is RTE_ETH_TX_OFFLOAD_MT_LOCKFREE capable, multiple threads can invoke this function
concurrently on the same Tx queue without SW lock.
Seealsorte_eth_dev_info_get, struct rte_eth_txconf::offloadsrte_eth_tx_prepare to perform some prior checks or adjustments for offloads.
Note
This function must not modify mbufs (including packets data) unless the refcnt is 1. An exception is
the bonding PMD, which does not have 'Tx prepare' support, in this case, mbufs may be modified.
Parametersport_id The port identifier of the Ethernet device.
queue_id The index of the transmit queue through which output packets must be sent. The value must be
in the range [0, nb_tx_queue - 1] previously supplied to rte_eth_dev_configure().
tx_pkts The address of an array of nb_pkts pointers to rte_mbufstructureswhichcontaintheoutputpackets.nb_pktsThemaximumnumberofpacketstotransmit.Returns
The number of output packets actually stored in transmit descriptors of the transmit ring. The return
value can be less than the value of the tx_pkts parameter when the transmit ring is full or has been
filled up.
Definition at line 6605 of file rte_ethdev.h.
staticuint16_trte_eth_tx_prepare(uint16_tport_id,uint16_tqueue_id,structrte_mbuf**tx_pkts,uint16_tnb_pkts)[inline],[static]
Process a burst of output packets on a transmit queue of an Ethernet device.
The rte_eth_tx_prepare() function is invoked to prepare output packets to be transmitted on the output
queue queue_id of the Ethernet device designated by its port_id. The nb_pkts parameter is the number of
packets to be prepared which are supplied in the tx_pkts array of rte_mbufstructures,eachofthemallocatedfromapoolcreatedwithrte_pktmbuf_pool_create().Foreachpackettosend,therte_eth_tx_prepare()functionperformsthefollowingoperations:
• Check if packet meets devices requirements for Tx offloads.
• Check limitations about number of segments.
• Check additional requirements when debug is enabled.
• Update and/or reset required checksums when Tx offload is set for packet.
Since this function can modify packet data, provided mbufs must be safely writable (e.g. modified data
cannot be in shared segment).
The rte_eth_tx_prepare() function returns the number of packets ready to be sent. A return value equal to
nb_pkts means that all packets are valid and ready to be sent, otherwise stops processing on the first
invalid packet and leaves the rest packets untouched.
When this functionality is not implemented in the driver, all packets are are returned untouched.
Parametersport_id The port identifier of the Ethernet device. The value must be a valid port ID.
queue_id The index of the transmit queue through which output packets must be sent. The value must be
in the range [0, nb_tx_queue - 1] previously supplied to rte_eth_dev_configure().
tx_pkts The address of an array of nb_pkts pointers to rte_mbufstructureswhichcontaintheoutputpackets.nb_pktsThemaximumnumberofpacketstoprocess.Returns
The number of packets correct and ready to be sent. The return value can be less than the value of
the tx_pkts parameter when some packet doesn't meet devices requirements with rte_errno set
appropriately:
• EINVAL: offload flags are not correctly set
• ENOTSUP: the offload feature is not supported by the hardware
• ENODEV: if port_id is invalid (with debug enabled only)
Definition at line 6715 of file rte_ethdev.h.
staticuint16_trte_eth_tx_buffer_flush(uint16_tport_id,uint16_tqueue_id,structrte_eth_dev_tx_buffer*buffer)[inline],[static]
Send any packets queued up for transmission on a port and HW queue
This causes an explicit flush of packets previously buffered via the rte_eth_tx_buffer() function. It
returns the number of packets successfully sent to the NIC, and calls the error callback for any unsent
packets. Unless explicitly set up otherwise, the default callback simply frees the unsent packets back to
the owning mempool.
Parametersport_id The port identifier of the Ethernet device.
queue_id The index of the transmit queue through which output packets must be sent. The value must be
in the range [0, nb_tx_queue - 1] previously supplied to rte_eth_dev_configure().
buffer Buffer of packets to be transmit.
Returns
The number of packets successfully sent to the Ethernet device. The error callback is called for any
packets which could not be sent.
Definition at line 6800 of file rte_ethdev.h.
static__rte_always_inlineuint16_trte_eth_tx_buffer(uint16_tport_id,uint16_tqueue_id,structrte_eth_dev_tx_buffer*buffer,structrte_mbuf*tx_pkt)[static]
Buffer a single packet for future transmission on a port and queue
This function takes a single mbuf/packet and buffers it for later transmission on the particular port and
queue specified. Once the buffer is full of packets, an attempt will be made to transmit all the buffered
packets. In case of error, where not all packets can be transmitted, a callback is called with the unsent
packets as a parameter. If no callback is explicitly set up, the unsent packets are just freed back to
the owning mempool. The function returns the number of packets actually sent i.e. 0 if no buffer flush
occurred, otherwise the number of packets successfully flushed
Parametersport_id The port identifier of the Ethernet device.
queue_id The index of the transmit queue through which output packets must be sent. The value must be
in the range [0, nb_tx_queue - 1] previously supplied to rte_eth_dev_configure().
buffer Buffer used to collect packets to be sent.
tx_pkt Pointer to the packet mbuf to be sent.
Returns
0 = packet has been buffered for later transmission N > 0 = packet has been buffered, and the buffer
was subsequently flushed, causing N packets to be sent, and the error callback to be called for the
rest.
Definition at line 6853 of file rte_ethdev.h.
static__rte_experimentaluint16_trte_eth_recycle_mbufs(uint16_trx_port_id,uint16_trx_queue_id,uint16_ttx_port_id,uint16_ttx_queue_id,structrte_eth_recycle_rxq_info*recycle_rxq_info)[inline],[static]WarningEXPERIMENTAL: this API may change, or be removed, without prior notice
Recycle used mbufs from a transmit queue of an Ethernet device, and move these mbufs into a mbuf ring for
a receive queue of an Ethernet device. This can bypass mempool path to save CPU cycles.
The rte_eth_recycle_mbufs() function loops, with rte_eth_rx_burst() and rte_eth_tx_burst() functions,
freeing Tx used mbufs and replenishing Rx descriptors. The number of recycling mbufs depends on the
request of Rx mbuf ring, with the constraint of enough used mbufs from Tx mbuf ring.
For each recycling mbufs, the rte_eth_recycle_mbufs() function performs the following operations:
• Copy used rte_mbufbufferpointersfromTxmbufringintoRxmbufring.
• Replenish the Rx descriptors with the recycling rte_mbufmbufsfreedfromtheTxmbufring.
This function spilts Rx and Tx path with different callback functions. The callback function
recycle_tx_mbufs_reuse is for Tx driver. The callback function recycle_rx_descriptors_refill is for Rx
driver. rte_eth_recycle_mbufs() can support the case that Rx Ethernet device is different from Tx
Ethernet device.
It is the responsibility of users to select the Rx/Tx queue pair to recycle mbufs. Before call this
function, users must call rte_eth_recycle_rxq_info_get function to retrieve selected Rx queue
information.
Seealso
rte_eth_recycle_rxq_info_get, struct rte_eth_recycle_rxq_info
Currently, the rte_eth_recycle_mbufs() function can support to feed 1 Rx queue from 2 Tx queues in the
same thread. Do not pair the Rx queue and Tx queue in different threads, in order to avoid memory error
rewriting.
Parametersrx_port_id Port identifying the receive side.
rx_queue_id The index of the receive queue identifying the receive side. The value must be in the
range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
tx_port_id Port identifying the transmit side.
tx_queue_id The index of the transmit queue identifying the transmit side. The value must be in the
range [0, nb_tx_queue - 1] previously supplied to rte_eth_dev_configure().
recycle_rxq_info A pointer to a structure of type rte_eth_recycle_rxq_infowhichcontainstheinformationoftheRxqueuembufring.Returns
The number of recycling mbufs.
Definition at line 6918 of file rte_ethdev.h.
__rte_experimentalintrte_eth_buffer_split_get_supported_hdr_ptypes(uint16_tport_id,uint32_t*ptypes,intnum)WarningEXPERIMENTAL: this API may change without prior notice
Get supported header protocols to split on Rx.
When a packet type is announced to be split, it must be supported by the PMD. For instance, if eth-ipv4,
eth-ipv4-udp is announced, the PMD must return the following packet types for these packets:
• Ether/IPv4 -> RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4
• Ether/IPv4/UDP -> RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_UDP
Parametersport_id The port identifier of the device.
ptypes An array pointer to store supported protocol headers, allocated by caller. These ptypes are
composed with RTE_PTYPE_*.
num Size of the array pointed by param ptypes.
Returns
• (>=0) Number of supported ptypes. If the number of types exceeds num, only num entries will be
filled into the ptypes array, but the full count of supported ptypes will be returned.
• (-ENOTSUP) if header protocol is not supported by device.
• (-ENODEV) if port_id invalid.
• (-EINVAL) if bad parameter.
static__rte_experimentalintrte_eth_tx_queue_count(uint16_tport_id,uint16_tqueue_id)[inline],[static]WarningEXPERIMENTAL: this API may change, or be removed, without prior notice.
Get the number of used descriptors of a Tx queue.
This function retrieves the number of used descriptors of a transmit queue. Applications can use this API
in the fast path to inspect Tx queue occupancy and take appropriate actions based on the available free
descriptors. An example action could be implementing Random Early Discard (RED).
Since it's a fast-path function, no check is performed on port_id and queue_id. The caller must therefore
ensure that the port is enabled and the queue is configured and running.
Parametersport_id The port identifier of the device.
queue_id The index of the transmit queue. The value must be in the range [0, nb_tx_queue - 1]
previously supplied to rte_eth_dev_configure().
Returns
The number of used descriptors in the specific queue, or:
• (-ENODEV) if port_id is invalid. Enabled only when RTE_ETHDEV_DEBUG_TX is enabled.
• (-EINVAL) if queue_id is invalid. Enabled only when RTE_ETHDEV_DEBUG_TX is enabled.
• (-ENOTSUP) if the device does not support this function.
Note
This function is designed for fast-path use.
There is no requirement to call this function before rte_eth_tx_burst() invocation.
Utilize this function exclusively when the caller needs to determine the used queue count across all
descriptors of a Tx queue. If the use case only involves checking the status of a specific descriptor
slot, opt for rte_eth_tx_descriptor_status() instead.
Definition at line 7062 of file rte_ethdev.h.