DPDK
24.07.0
|
#include <stdint.h>
#include <rte_cman.h>
#include <rte_compat.h>
#include <rte_log.h>
#include <rte_interrupts.h>
#include <rte_dev.h>
#include <rte_devargs.h>
#include <rte_bitops.h>
#include <rte_errno.h>
#include <rte_common.h>
#include <rte_config.h>
#include <rte_power_intrinsics.h>
#include "rte_ethdev_trace_fp.h"
#include "rte_dev_info.h"
#include "rte_eth_ctrl.h"
#include <rte_ethdev_core.h>
Go to the source code of this file.
Typedefs | |
typedef uint16_t(* | rte_rx_callback_fn) (uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, uint16_t max_pkts, void *user_param) |
typedef uint16_t(* | rte_tx_callback_fn) (uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, void *user_param) |
typedef int(* | rte_eth_dev_cb_fn) (uint16_t port_id, enum rte_eth_event_type event, void *cb_arg, void *ret_param) |
Functions | |
int | rte_eth_iterator_init (struct rte_dev_iterator *iter, const char *devargs) |
uint16_t | rte_eth_iterator_next (struct rte_dev_iterator *iter) |
void | rte_eth_iterator_cleanup (struct rte_dev_iterator *iter) |
static uint64_t | rte_eth_rss_hf_refine (uint64_t rss_hf) |
uint64_t | rte_eth_find_next_owned_by (uint16_t port_id, const uint64_t owner_id) |
uint16_t | rte_eth_find_next (uint16_t port_id) |
uint16_t | rte_eth_find_next_of (uint16_t port_id_start, const struct rte_device *parent) |
uint16_t | rte_eth_find_next_sibling (uint16_t port_id_start, uint16_t ref_port_id) |
int | rte_eth_dev_owner_new (uint64_t *owner_id) |
int | rte_eth_dev_owner_set (const uint16_t port_id, const struct rte_eth_dev_owner *owner) |
int | rte_eth_dev_owner_unset (const uint16_t port_id, const uint64_t owner_id) |
int | rte_eth_dev_owner_delete (const uint64_t owner_id) |
int | rte_eth_dev_owner_get (const uint16_t port_id, struct rte_eth_dev_owner *owner) |
uint16_t | rte_eth_dev_count_avail (void) |
uint16_t | rte_eth_dev_count_total (void) |
uint32_t | rte_eth_speed_bitflag (uint32_t speed, int duplex) |
const char * | rte_eth_dev_rx_offload_name (uint64_t offload) |
const char * | rte_eth_dev_tx_offload_name (uint64_t offload) |
__rte_experimental const char * | rte_eth_dev_capability_name (uint64_t capability) |
int | rte_eth_dev_configure (uint16_t port_id, uint16_t nb_rx_queue, uint16_t nb_tx_queue, const struct rte_eth_conf *eth_conf) |
int | rte_eth_dev_is_removed (uint16_t port_id) |
int | rte_eth_rx_queue_setup (uint16_t port_id, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mb_pool) |
__rte_experimental int | rte_eth_rx_hairpin_queue_setup (uint16_t port_id, uint16_t rx_queue_id, uint16_t nb_rx_desc, const struct rte_eth_hairpin_conf *conf) |
int | rte_eth_tx_queue_setup (uint16_t port_id, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf) |
__rte_experimental int | rte_eth_tx_hairpin_queue_setup (uint16_t port_id, uint16_t tx_queue_id, uint16_t nb_tx_desc, const struct rte_eth_hairpin_conf *conf) |
__rte_experimental int | rte_eth_hairpin_get_peer_ports (uint16_t port_id, uint16_t *peer_ports, size_t len, uint32_t direction) |
__rte_experimental int | rte_eth_hairpin_bind (uint16_t tx_port, uint16_t rx_port) |
__rte_experimental int | rte_eth_hairpin_unbind (uint16_t tx_port, uint16_t rx_port) |
__rte_experimental int | rte_eth_dev_count_aggr_ports (uint16_t port_id) |
__rte_experimental int | rte_eth_dev_map_aggr_tx_affinity (uint16_t port_id, uint16_t tx_queue_id, uint8_t affinity) |
int | rte_eth_dev_socket_id (uint16_t port_id) |
int | rte_eth_dev_is_valid_port (uint16_t port_id) |
__rte_experimental int | rte_eth_rx_queue_is_valid (uint16_t port_id, uint16_t queue_id) |
__rte_experimental int | rte_eth_tx_queue_is_valid (uint16_t port_id, uint16_t queue_id) |
int | rte_eth_dev_rx_queue_start (uint16_t port_id, uint16_t rx_queue_id) |
int | rte_eth_dev_rx_queue_stop (uint16_t port_id, uint16_t rx_queue_id) |
int | rte_eth_dev_tx_queue_start (uint16_t port_id, uint16_t tx_queue_id) |
int | rte_eth_dev_tx_queue_stop (uint16_t port_id, uint16_t tx_queue_id) |
int | rte_eth_dev_start (uint16_t port_id) |
int | rte_eth_dev_stop (uint16_t port_id) |
int | rte_eth_dev_set_link_up (uint16_t port_id) |
int | rte_eth_dev_set_link_down (uint16_t port_id) |
int | rte_eth_dev_close (uint16_t port_id) |
int | rte_eth_dev_reset (uint16_t port_id) |
int | rte_eth_promiscuous_enable (uint16_t port_id) |
int | rte_eth_promiscuous_disable (uint16_t port_id) |
int | rte_eth_promiscuous_get (uint16_t port_id) |
int | rte_eth_allmulticast_enable (uint16_t port_id) |
int | rte_eth_allmulticast_disable (uint16_t port_id) |
int | rte_eth_allmulticast_get (uint16_t port_id) |
int | rte_eth_link_get (uint16_t port_id, struct rte_eth_link *link) |
int | rte_eth_link_get_nowait (uint16_t port_id, struct rte_eth_link *link) |
__rte_experimental const char * | rte_eth_link_speed_to_str (uint32_t link_speed) |
__rte_experimental int | rte_eth_link_to_str (char *str, size_t len, const struct rte_eth_link *eth_link) |
int | rte_eth_stats_get (uint16_t port_id, struct rte_eth_stats *stats) |
int | rte_eth_stats_reset (uint16_t port_id) |
int | rte_eth_xstats_get_names (uint16_t port_id, struct rte_eth_xstat_name *xstats_names, unsigned int size) |
int | rte_eth_xstats_get (uint16_t port_id, struct rte_eth_xstat *xstats, unsigned int n) |
int | rte_eth_xstats_get_names_by_id (uint16_t port_id, struct rte_eth_xstat_name *xstats_names, unsigned int size, uint64_t *ids) |
int | rte_eth_xstats_get_by_id (uint16_t port_id, const uint64_t *ids, uint64_t *values, unsigned int size) |
int | rte_eth_xstats_get_id_by_name (uint16_t port_id, const char *xstat_name, uint64_t *id) |
int | rte_eth_xstats_reset (uint16_t port_id) |
int | rte_eth_dev_set_tx_queue_stats_mapping (uint16_t port_id, uint16_t tx_queue_id, uint8_t stat_idx) |
int | rte_eth_dev_set_rx_queue_stats_mapping (uint16_t port_id, uint16_t rx_queue_id, uint8_t stat_idx) |
int | rte_eth_macaddr_get (uint16_t port_id, struct rte_ether_addr *mac_addr) |
__rte_experimental int | rte_eth_macaddrs_get (uint16_t port_id, struct rte_ether_addr *ma, unsigned int num) |
int | rte_eth_dev_info_get (uint16_t port_id, struct rte_eth_dev_info *dev_info) |
__rte_experimental int | rte_eth_dev_conf_get (uint16_t port_id, struct rte_eth_conf *dev_conf) |
int | rte_eth_dev_fw_version_get (uint16_t port_id, char *fw_version, size_t fw_size) |
int | rte_eth_dev_get_supported_ptypes (uint16_t port_id, uint32_t ptype_mask, uint32_t *ptypes, int num) |
int | rte_eth_dev_set_ptypes (uint16_t port_id, uint32_t ptype_mask, uint32_t *set_ptypes, unsigned int num) |
int | rte_eth_dev_get_mtu (uint16_t port_id, uint16_t *mtu) |
int | rte_eth_dev_set_mtu (uint16_t port_id, uint16_t mtu) |
int | rte_eth_dev_vlan_filter (uint16_t port_id, uint16_t vlan_id, int on) |
int | rte_eth_dev_set_vlan_strip_on_queue (uint16_t port_id, uint16_t rx_queue_id, int on) |
int | rte_eth_dev_set_vlan_ether_type (uint16_t port_id, enum rte_vlan_type vlan_type, uint16_t tag_type) |
int | rte_eth_dev_set_vlan_offload (uint16_t port_id, int offload_mask) |
int | rte_eth_dev_get_vlan_offload (uint16_t port_id) |
int | rte_eth_dev_set_vlan_pvid (uint16_t port_id, uint16_t pvid, int on) |
__rte_experimental int | rte_eth_rx_avail_thresh_set (uint16_t port_id, uint16_t queue_id, uint8_t avail_thresh) |
__rte_experimental int | rte_eth_rx_avail_thresh_query (uint16_t port_id, uint16_t *queue_id, uint8_t *avail_thresh) |
int | rte_eth_tx_buffer_init (struct rte_eth_dev_tx_buffer *buffer, uint16_t size) |
int | rte_eth_tx_buffer_set_err_callback (struct rte_eth_dev_tx_buffer *buffer, buffer_tx_error_fn callback, void *userdata) |
void | rte_eth_tx_buffer_drop_callback (struct rte_mbuf **pkts, uint16_t unsent, void *userdata) |
void | rte_eth_tx_buffer_count_callback (struct rte_mbuf **pkts, uint16_t unsent, void *userdata) |
int | rte_eth_tx_done_cleanup (uint16_t port_id, uint16_t queue_id, uint32_t free_cnt) |
int | rte_eth_dev_callback_register (uint16_t port_id, enum rte_eth_event_type event, rte_eth_dev_cb_fn cb_fn, void *cb_arg) |
int | rte_eth_dev_callback_unregister (uint16_t port_id, enum rte_eth_event_type event, rte_eth_dev_cb_fn cb_fn, void *cb_arg) |
int | rte_eth_dev_rx_intr_enable (uint16_t port_id, uint16_t queue_id) |
int | rte_eth_dev_rx_intr_disable (uint16_t port_id, uint16_t queue_id) |
int | rte_eth_dev_rx_intr_ctl (uint16_t port_id, int epfd, int op, void *data) |
int | rte_eth_dev_rx_intr_ctl_q (uint16_t port_id, uint16_t queue_id, int epfd, int op, void *data) |
int | rte_eth_dev_rx_intr_ctl_q_get_fd (uint16_t port_id, uint16_t queue_id) |
int | rte_eth_led_on (uint16_t port_id) |
int | rte_eth_led_off (uint16_t port_id) |
__rte_experimental int | rte_eth_fec_get_capability (uint16_t port_id, struct rte_eth_fec_capa *speed_fec_capa, unsigned int num) |
__rte_experimental int | rte_eth_fec_get (uint16_t port_id, uint32_t *fec_capa) |
__rte_experimental int | rte_eth_fec_set (uint16_t port_id, uint32_t fec_capa) |
int | rte_eth_dev_flow_ctrl_get (uint16_t port_id, struct rte_eth_fc_conf *fc_conf) |
int | rte_eth_dev_flow_ctrl_set (uint16_t port_id, struct rte_eth_fc_conf *fc_conf) |
int | rte_eth_dev_priority_flow_ctrl_set (uint16_t port_id, struct rte_eth_pfc_conf *pfc_conf) |
int | rte_eth_dev_mac_addr_add (uint16_t port_id, struct rte_ether_addr *mac_addr, uint32_t pool) |
__rte_experimental int | rte_eth_dev_priority_flow_ctrl_queue_info_get (uint16_t port_id, struct rte_eth_pfc_queue_info *pfc_queue_info) |
__rte_experimental int | rte_eth_dev_priority_flow_ctrl_queue_configure (uint16_t port_id, struct rte_eth_pfc_queue_conf *pfc_queue_conf) |
int | rte_eth_dev_mac_addr_remove (uint16_t port_id, struct rte_ether_addr *mac_addr) |
int | rte_eth_dev_default_mac_addr_set (uint16_t port_id, struct rte_ether_addr *mac_addr) |
int | rte_eth_dev_rss_reta_update (uint16_t port_id, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) |
int | rte_eth_dev_rss_reta_query (uint16_t port_id, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size) |
int | rte_eth_dev_uc_hash_table_set (uint16_t port_id, struct rte_ether_addr *addr, uint8_t on) |
int | rte_eth_dev_uc_all_hash_table_set (uint16_t port_id, uint8_t on) |
int | rte_eth_set_queue_rate_limit (uint16_t port_id, uint16_t queue_idx, uint32_t tx_rate) |
int | rte_eth_dev_rss_hash_update (uint16_t port_id, struct rte_eth_rss_conf *rss_conf) |
int | rte_eth_dev_rss_hash_conf_get (uint16_t port_id, struct rte_eth_rss_conf *rss_conf) |
__rte_experimental const char * | rte_eth_dev_rss_algo_name (enum rte_eth_hash_function rss_algo) |
__rte_experimental int | rte_eth_find_rss_algo (const char *name, uint32_t *algo) |
int | rte_eth_dev_udp_tunnel_port_add (uint16_t port_id, struct rte_eth_udp_tunnel *tunnel_udp) |
int | rte_eth_dev_udp_tunnel_port_delete (uint16_t port_id, struct rte_eth_udp_tunnel *tunnel_udp) |
int | rte_eth_dev_get_dcb_info (uint16_t port_id, struct rte_eth_dcb_info *dcb_info) |
const struct rte_eth_rxtx_callback * | rte_eth_add_rx_callback (uint16_t port_id, uint16_t queue_id, rte_rx_callback_fn fn, void *user_param) |
const struct rte_eth_rxtx_callback * | rte_eth_add_first_rx_callback (uint16_t port_id, uint16_t queue_id, rte_rx_callback_fn fn, void *user_param) |
const struct rte_eth_rxtx_callback * | rte_eth_add_tx_callback (uint16_t port_id, uint16_t queue_id, rte_tx_callback_fn fn, void *user_param) |
int | rte_eth_remove_rx_callback (uint16_t port_id, uint16_t queue_id, const struct rte_eth_rxtx_callback *user_cb) |
int | rte_eth_remove_tx_callback (uint16_t port_id, uint16_t queue_id, const struct rte_eth_rxtx_callback *user_cb) |
int | rte_eth_rx_queue_info_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_rxq_info *qinfo) |
int | rte_eth_tx_queue_info_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_txq_info *qinfo) |
__rte_experimental int | rte_eth_recycle_rx_queue_info_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_recycle_rxq_info *recycle_rxq_info) |
int | rte_eth_rx_burst_mode_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_burst_mode *mode) |
int | rte_eth_tx_burst_mode_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_burst_mode *mode) |
__rte_experimental int | rte_eth_get_monitor_addr (uint16_t port_id, uint16_t queue_id, struct rte_power_monitor_cond *pmc) |
int | rte_eth_dev_get_reg_info (uint16_t port_id, struct rte_dev_reg_info *info) |
int | rte_eth_dev_get_eeprom_length (uint16_t port_id) |
int | rte_eth_dev_get_eeprom (uint16_t port_id, struct rte_dev_eeprom_info *info) |
int | rte_eth_dev_set_eeprom (uint16_t port_id, struct rte_dev_eeprom_info *info) |
__rte_experimental int | rte_eth_dev_get_module_info (uint16_t port_id, struct rte_eth_dev_module_info *modinfo) |
__rte_experimental int | rte_eth_dev_get_module_eeprom (uint16_t port_id, struct rte_dev_eeprom_info *info) |
int | rte_eth_dev_set_mc_addr_list (uint16_t port_id, struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) |
int | rte_eth_timesync_enable (uint16_t port_id) |
int | rte_eth_timesync_disable (uint16_t port_id) |
int | rte_eth_timesync_read_rx_timestamp (uint16_t port_id, struct timespec *timestamp, uint32_t flags) |
int | rte_eth_timesync_read_tx_timestamp (uint16_t port_id, struct timespec *timestamp) |
int | rte_eth_timesync_adjust_time (uint16_t port_id, int64_t delta) |
int | rte_eth_timesync_read_time (uint16_t port_id, struct timespec *time) |
int | rte_eth_timesync_write_time (uint16_t port_id, const struct timespec *time) |
__rte_experimental int | rte_eth_read_clock (uint16_t port_id, uint64_t *clock) |
int | rte_eth_dev_get_port_by_name (const char *name, uint16_t *port_id) |
int | rte_eth_dev_get_name_by_port (uint16_t port_id, char *name) |
int | rte_eth_dev_adjust_nb_rx_tx_desc (uint16_t port_id, uint16_t *nb_rx_desc, uint16_t *nb_tx_desc) |
int | rte_eth_dev_pool_ops_supported (uint16_t port_id, const char *pool) |
void * | rte_eth_dev_get_sec_ctx (uint16_t port_id) |
__rte_experimental int | rte_eth_dev_hairpin_capability_get (uint16_t port_id, struct rte_eth_hairpin_cap *cap) |
__rte_experimental int | rte_eth_representor_info_get (uint16_t port_id, struct rte_eth_representor_info *info) |
int | rte_eth_rx_metadata_negotiate (uint16_t port_id, uint64_t *features) |
__rte_experimental int | rte_eth_ip_reassembly_capability_get (uint16_t port_id, struct rte_eth_ip_reassembly_params *capa) |
__rte_experimental int | rte_eth_ip_reassembly_conf_get (uint16_t port_id, struct rte_eth_ip_reassembly_params *conf) |
__rte_experimental int | rte_eth_ip_reassembly_conf_set (uint16_t port_id, const struct rte_eth_ip_reassembly_params *conf) |
__rte_experimental int | rte_eth_dev_priv_dump (uint16_t port_id, FILE *file) |
__rte_experimental int | rte_eth_rx_descriptor_dump (uint16_t port_id, uint16_t queue_id, uint16_t offset, uint16_t num, FILE *file) |
__rte_experimental int | rte_eth_tx_descriptor_dump (uint16_t port_id, uint16_t queue_id, uint16_t offset, uint16_t num, FILE *file) |
__rte_experimental int | rte_eth_cman_info_get (uint16_t port_id, struct rte_eth_cman_info *info) |
__rte_experimental int | rte_eth_cman_config_init (uint16_t port_id, struct rte_eth_cman_config *config) |
__rte_experimental int | rte_eth_cman_config_set (uint16_t port_id, const struct rte_eth_cman_config *config) |
__rte_experimental int | rte_eth_cman_config_get (uint16_t port_id, struct rte_eth_cman_config *config) |
static uint16_t | rte_eth_rx_burst (uint16_t port_id, uint16_t queue_id, struct rte_mbuf **rx_pkts, const uint16_t nb_pkts) |
static int | rte_eth_rx_queue_count (uint16_t port_id, uint16_t queue_id) |
static int | rte_eth_rx_descriptor_status (uint16_t port_id, uint16_t queue_id, uint16_t offset) |
static int | rte_eth_tx_descriptor_status (uint16_t port_id, uint16_t queue_id, uint16_t offset) |
static uint16_t | rte_eth_tx_burst (uint16_t port_id, uint16_t queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) |
static uint16_t | rte_eth_tx_prepare (uint16_t port_id, uint16_t queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) |
static uint16_t | rte_eth_tx_buffer_flush (uint16_t port_id, uint16_t queue_id, struct rte_eth_dev_tx_buffer *buffer) |
static __rte_always_inline uint16_t | rte_eth_tx_buffer (uint16_t port_id, uint16_t queue_id, struct rte_eth_dev_tx_buffer *buffer, struct rte_mbuf *tx_pkt) |
static __rte_experimental uint16_t | rte_eth_recycle_mbufs (uint16_t rx_port_id, uint16_t rx_queue_id, uint16_t tx_port_id, uint16_t tx_queue_id, struct rte_eth_recycle_rxq_info *recycle_rxq_info) |
__rte_experimental int | rte_eth_buffer_split_get_supported_hdr_ptypes (uint16_t port_id, uint32_t *ptypes, int num) |
static __rte_experimental int | rte_eth_tx_queue_count (uint16_t port_id, uint16_t queue_id) |
RTE Ethernet Device API
The Ethernet Device API is composed of two parts:
By default, all the functions of the Ethernet Device API exported by a PMD are lock-free functions which assume to not be invoked in parallel on different logical cores to work on the same target object. For instance, the receive function of a PMD cannot be invoked in parallel on two logical cores to poll the same Rx queue [of the same port]. Of course, this function can be invoked in parallel by different logical cores on different Rx queues. It is the responsibility of the upper level application to enforce this rule.
If needed, parallel accesses by multiple logical cores to shared queues shall be explicitly protected by dedicated inline lock-aware functions built on top of their corresponding lock-free functions of the PMD API.
In all functions of the Ethernet API, the Ethernet device is designated by an integer >= 0 named the device port identifier.
At the Ethernet driver level, Ethernet devices are represented by a generic data structure of type rte_eth_dev.
Ethernet devices are dynamically registered during the PCI probing phase performed at EAL initialization time. When an Ethernet device is being probed, an rte_eth_dev structure and a new port identifier are allocated for that device. Then, the eth_dev_init() function supplied by the Ethernet driver matching the probed PCI device is invoked to properly initialize the device.
The role of the device init function consists of resetting the hardware, checking access to Non-volatile Memory (NVM), reading the MAC address from NVM etc.
If the device init operation is successful, the correspondence between the port identifier assigned to the new device and its associated rte_eth_dev structure is effectively registered. Otherwise, both the rte_eth_dev structure and the port identifier are freed.
The functions exported by the application Ethernet API to setup a device designated by its port identifier must be invoked in the following order:
Then, the network application can invoke, in any order, the functions exported by the Ethernet API to get the MAC address of a given device, to get the speed and the status of a device physical link, to receive/transmit [burst of] packets, and so on.
If the application wants to change the configuration (i.e. call rte_eth_dev_configure(), rte_eth_tx_queue_setup(), or rte_eth_rx_queue_setup()), it must call rte_eth_dev_stop() first to stop the device and then do the reconfiguration before calling rte_eth_dev_start() again. The transmit and receive functions should not be invoked when the device or the queue is stopped.
Please note that some configuration is not stored between calls to rte_eth_dev_stop()/rte_eth_dev_start(). The following configuration will be retained:
- MTU - flow control settings - receive mode configuration (promiscuous mode, all-multicast mode, hardware checksum mode, RSS/VMDq settings etc.) - VLAN filtering configuration - default MAC address - MAC addresses supplied to MAC address array - flow director filtering mode (but not filtering rules) - NIC queue statistics mappings
The following configuration may be retained or not depending on the device capabilities:
- flow rules - flow-related shared objects, e.g. indirect actions
Any other configuration will not be stored and will need to be re-entered before a call to rte_eth_dev_start().
Finally, a network application can close an Ethernet device by invoking the rte_eth_dev_close() function.
Each function of the application Ethernet API invokes a specific function of the PMD that controls the target device designated by its port identifier. For this purpose, all device-specific functions of an Ethernet driver are supplied through a set of pointers contained in a generic structure of type eth_dev_ops. The address of the eth_dev_ops structure is stored in the rte_eth_dev structure by the device init function of the Ethernet driver, which is invoked during the PCI probing phase, as explained earlier.
In other words, each function of the Ethernet API simply retrieves the rte_eth_dev structure associated with the device port identifier and performs an indirect invocation of the corresponding driver function supplied in the eth_dev_ops structure of the rte_eth_dev structure.
For performance reasons, the address of the burst-oriented Rx and Tx functions of the Ethernet driver are not contained in the eth_dev_ops structure. Instead, they are directly stored at the beginning of the rte_eth_dev structure to avoid an extra indirect memory access during their invocation.
RTE Ethernet device drivers do not use interrupts for transmitting or receiving. Instead, Ethernet drivers export Poll-Mode receive and transmit functions to applications. Both receive and transmit functions are packet-burst oriented to minimize their cost per packet through the following optimizations:
The burst-oriented receive 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 by the receive function of the driver for a given number of tries.
Definition in file rte_ethdev.h.
#define RTE_ETH_FOREACH_MATCHING_DEV | ( | id, | |
devargs, | |||
iter | |||
) |
Macro to iterate over all ethdev ports matching some devargs.
If a break is done before the end of the loop, the function rte_eth_iterator_cleanup() must be called.
id | Iterated port ID of type uint16_t. |
devargs | Device parameters input as string of type char*. |
iter | Iterator handle of type struct rte_dev_iterator, used internally. |
Definition at line 247 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_AUTONEG 0 |
Autonegotiate (all speeds)
Definition at line 291 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_FIXED RTE_BIT32(0) |
Disable autoneg (fixed speed)
Definition at line 292 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_10M_HD RTE_BIT32(1) |
10 Mbps half-duplex
Definition at line 293 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_10M RTE_BIT32(2) |
10 Mbps full-duplex
Definition at line 294 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_100M_HD RTE_BIT32(3) |
100 Mbps half-duplex
Definition at line 295 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_100M RTE_BIT32(4) |
100 Mbps full-duplex
Definition at line 296 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_1G RTE_BIT32(5) |
1 Gbps
Definition at line 297 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_2_5G RTE_BIT32(6) |
2.5 Gbps
Definition at line 298 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_5G RTE_BIT32(7) |
5 Gbps
Definition at line 299 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_10G RTE_BIT32(8) |
10 Gbps
Definition at line 300 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_20G RTE_BIT32(9) |
20 Gbps
Definition at line 301 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_25G RTE_BIT32(10) |
25 Gbps
Definition at line 302 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_40G RTE_BIT32(11) |
40 Gbps
Definition at line 303 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_50G RTE_BIT32(12) |
50 Gbps
Definition at line 304 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_56G RTE_BIT32(13) |
56 Gbps
Definition at line 305 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_100G RTE_BIT32(14) |
100 Gbps
Definition at line 306 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_200G RTE_BIT32(15) |
200 Gbps
Definition at line 307 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_400G RTE_BIT32(16) |
400 Gbps
Definition at line 308 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_NONE 0 |
Not defined
Definition at line 314 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_10M 10 |
10 Mbps
Definition at line 315 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_100M 100 |
100 Mbps
Definition at line 316 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_1G 1000 |
1 Gbps
Definition at line 317 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_2_5G 2500 |
2.5 Gbps
Definition at line 318 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_5G 5000 |
5 Gbps
Definition at line 319 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_10G 10000 |
10 Gbps
Definition at line 320 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_20G 20000 |
20 Gbps
Definition at line 321 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_25G 25000 |
25 Gbps
Definition at line 322 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_40G 40000 |
40 Gbps
Definition at line 323 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_50G 50000 |
50 Gbps
Definition at line 324 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_56G 56000 |
56 Gbps
Definition at line 325 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_100G 100000 |
100 Gbps
Definition at line 326 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_200G 200000 |
200 Gbps
Definition at line 327 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_400G 400000 |
400 Gbps
Definition at line 328 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_UNKNOWN UINT32_MAX |
Unknown
Definition at line 329 of file rte_ethdev.h.
#define RTE_ETH_LINK_HALF_DUPLEX 0 |
Half-duplex connection (see link_duplex).
Definition at line 351 of file rte_ethdev.h.
#define RTE_ETH_LINK_FULL_DUPLEX 1 |
Full-duplex connection (see link_duplex).
Definition at line 352 of file rte_ethdev.h.
#define RTE_ETH_LINK_DOWN 0 |
Link is down (see link_status).
Definition at line 353 of file rte_ethdev.h.
#define RTE_ETH_LINK_UP 1 |
Link is up (see link_status).
Definition at line 354 of file rte_ethdev.h.
#define RTE_ETH_LINK_FIXED 0 |
No autonegotiation (see link_autoneg).
Definition at line 355 of file rte_ethdev.h.
#define RTE_ETH_LINK_AUTONEG 1 |
Autonegotiated (see link_autoneg).
Definition at line 356 of file rte_ethdev.h.
#define RTE_ETH_LINK_MAX_STR_LEN 40 |
Max length of default link string.
Definition at line 357 of file rte_ethdev.h.
#define RTE_ETH_MQ_RX_RSS_FLAG RTE_BIT32(0) |
#define RTE_ETH_MQ_RX_DCB_FLAG RTE_BIT32(1) |
Enable DCB.
Definition at line 374 of file rte_ethdev.h.
#define RTE_ETH_MQ_RX_VMDQ_FLAG RTE_BIT32(2) |
Enable VMDq.
Definition at line 375 of file rte_ethdev.h.
#define RTE_ETH_FLOW_PORT 18 |
Consider device port number as a flow differentiator
Definition at line 535 of file rte_ethdev.h.
#define RTE_ETH_FLOW_VXLAN 19 |
VXLAN protocol based flow
Definition at line 536 of file rte_ethdev.h.
#define RTE_ETH_FLOW_GENEVE 20 |
GENEVE protocol based flow
Definition at line 537 of file rte_ethdev.h.
#define RTE_ETH_FLOW_NVGRE 21 |
NVGRE protocol based flow
Definition at line 538 of file rte_ethdev.h.
#define RTE_ETH_FLOW_VXLAN_GPE 22 |
VXLAN-GPE protocol based flow
Definition at line 539 of file rte_ethdev.h.
#define RTE_ETH_FLOW_GTPU 23 |
GTPU protocol based flow
Definition at line 540 of file rte_ethdev.h.
#define RTE_ETH_RSS_L4_CHKSUM RTE_BIT64(35) |
The RTE_ETH_RSS_L4_CHKSUM works on checksum field of any L4 header. It is similar to RTE_ETH_RSS_PORT that they don't specify the specific type of L4 header. This macro is defined to replace some specific L4 (TCP/UDP/SCTP) checksum type for constructing the use of RSS offload bits.
Due to above reason, some old APIs (and configuration) don't support RTE_ETH_RSS_L4_CHKSUM. The rte_flow RSS API supports it.
For the case that checksum is not used in an UDP header, it takes the reserved value 0 as input for the hash function.
Definition at line 592 of file rte_ethdev.h.
#define RTE_ETH_RSS_LEVEL_PMD_DEFAULT (UINT64_C(0) << 50) |
level 0, requests the default behavior. Depending on the packet type, it can mean outermost, innermost, anything in between or even no RSS. It basically stands for the innermost encapsulation level RSS can be performed on according to PMD and device capabilities.
Definition at line 639 of file rte_ethdev.h.
#define RTE_ETH_RSS_LEVEL_OUTERMOST (UINT64_C(1) << 50) |
level 1, requests RSS to be performed on the outermost packet encapsulation level.
Definition at line 645 of file rte_ethdev.h.
#define RTE_ETH_RSS_LEVEL_INNERMOST (UINT64_C(2) << 50) |
level 2, requests RSS to be performed on the specified inner packet encapsulation level, from outermost to innermost (lower to higher values).
Definition at line 651 of file rte_ethdev.h.
#define RTE_ETH_RSS_PROTO_MASK |
Mask of valid RSS hash protocols
Definition at line 807 of file rte_ethdev.h.
#define RTE_ETH_VMDQ_MAX_VLAN_FILTERS 64 |
Maximum nb. of VMDq VLAN filters.
Definition at line 842 of file rte_ethdev.h.
#define RTE_ETH_DCB_NUM_USER_PRIORITIES 8 |
Maximum nb. of DCB priorities.
Definition at line 843 of file rte_ethdev.h.
#define RTE_ETH_VMDQ_DCB_NUM_QUEUES 128 |
Maximum nb. of VMDq DCB queues.
Definition at line 844 of file rte_ethdev.h.
#define RTE_ETH_DCB_NUM_QUEUES 128 |
Maximum nb. of DCB queues.
Definition at line 845 of file rte_ethdev.h.
#define RTE_ETH_DCB_PG_SUPPORT RTE_BIT32(0) |
Priority Group(ETS) support.
Definition at line 849 of file rte_ethdev.h.
#define RTE_ETH_DCB_PFC_SUPPORT RTE_BIT32(1) |
Priority Flow Control support.
Definition at line 850 of file rte_ethdev.h.
#define RTE_ETH_VLAN_STRIP_OFFLOAD 0x0001 |
VLAN Strip On/Off
Definition at line 854 of file rte_ethdev.h.
#define RTE_ETH_VLAN_FILTER_OFFLOAD 0x0002 |
VLAN Filter On/Off
Definition at line 855 of file rte_ethdev.h.
#define RTE_ETH_VLAN_EXTEND_OFFLOAD 0x0004 |
VLAN Extend On/Off
Definition at line 856 of file rte_ethdev.h.
#define RTE_ETH_QINQ_STRIP_OFFLOAD 0x0008 |
QINQ Strip On/Off
Definition at line 857 of file rte_ethdev.h.
#define RTE_ETH_VLAN_STRIP_MASK 0x0001 |
VLAN Strip setting mask
Definition at line 859 of file rte_ethdev.h.
#define RTE_ETH_VLAN_FILTER_MASK 0x0002 |
VLAN Filter setting mask
Definition at line 860 of file rte_ethdev.h.
#define RTE_ETH_VLAN_EXTEND_MASK 0x0004 |
VLAN Extend setting mask
Definition at line 861 of file rte_ethdev.h.
#define RTE_ETH_QINQ_STRIP_MASK 0x0008 |
QINQ Strip setting mask
Definition at line 862 of file rte_ethdev.h.
#define RTE_ETH_VLAN_ID_MAX 0x0FFF |
VLAN ID is in lower 12 bits
Definition at line 863 of file rte_ethdev.h.
#define RTE_ETH_NUM_RECEIVE_MAC_ADDR 128 |
Maximum nb. of receive mac addr.
Definition at line 867 of file rte_ethdev.h.
#define RTE_ETH_VMDQ_NUM_UC_HASH_ARRAY 128 |
Maximum nb. of UC hash array.
Definition at line 870 of file rte_ethdev.h.
#define RTE_ETH_VMDQ_ACCEPT_UNTAG RTE_BIT32(0) |
Accept untagged packets.
Definition at line 876 of file rte_ethdev.h.
#define RTE_ETH_VMDQ_ACCEPT_HASH_MC RTE_BIT32(1) |
Accept packets in multicast table.
Definition at line 878 of file rte_ethdev.h.
#define RTE_ETH_VMDQ_ACCEPT_HASH_UC RTE_BIT32(2) |
Accept packets in unicast table.
Definition at line 880 of file rte_ethdev.h.
#define RTE_ETH_VMDQ_ACCEPT_BROADCAST RTE_BIT32(3) |
Accept broadcast packets.
Definition at line 882 of file rte_ethdev.h.
#define RTE_ETH_VMDQ_ACCEPT_MULTICAST RTE_BIT32(4) |
Multicast promiscuous.
Definition at line 884 of file rte_ethdev.h.
#define RTE_ETH_RX_OFFLOAD_VLAN_STRIP RTE_BIT64(0) |
Rx offload capabilities of a device.
Definition at line 1535 of file rte_ethdev.h.
#define RTE_ETH_RX_OFFLOAD_TIMESTAMP RTE_BIT64(14) |
Timestamp is set by the driver in RTE_MBUF_DYNFIELD_TIMESTAMP_NAME and RTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAME is set in ol_flags. The mbuf field and flag are registered when the offload is configured.
Definition at line 1551 of file rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_VLAN_INSERT RTE_BIT64(0) |
Tx offload capabilities of a device.
Definition at line 1575 of file rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUM RTE_BIT64(7) |
Used for tunneling packet.
Definition at line 1582 of file rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO RTE_BIT64(9) |
Used for tunneling packet.
Definition at line 1584 of file rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO RTE_BIT64(10) |
Used for tunneling packet.
Definition at line 1585 of file rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSO RTE_BIT64(11) |
Used for tunneling packet.
Definition at line 1586 of file rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSO RTE_BIT64(12) |
Used for tunneling packet.
Definition at line 1587 of file rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_MT_LOCKFREE RTE_BIT64(14) |
Multiple threads can invoke rte_eth_tx_burst() concurrently on the same Tx queue without SW lock.
Definition at line 1593 of file rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_MULTI_SEGS RTE_BIT64(15) |
Device supports multi segment send.
Definition at line 1595 of file rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE RTE_BIT64(16) |
Device supports optimization for fast release of mbufs. When set application must guarantee that per-queue all mbufs comes from the same mempool and has refcnt = 1.
Definition at line 1601 of file rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_UDP_TNL_TSO RTE_BIT64(18) |
Device supports generic UDP tunneled packet TSO. Application must set RTE_MBUF_F_TX_TUNNEL_UDP and other mbuf fields required for tunnel TSO.
Definition at line 1608 of file rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_IP_TNL_TSO RTE_BIT64(19) |
Device supports generic IP tunneled packet TSO. Application must set RTE_MBUF_F_TX_TUNNEL_IP and other mbuf fields required for tunnel TSO.
Definition at line 1614 of file rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM RTE_BIT64(20) |
Device supports outer UDP checksum
Definition at line 1616 of file rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMP RTE_BIT64(21) |
Device sends on time read from RTE_MBUF_DYNFIELD_TIMESTAMP_NAME if RTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAME is set in ol_flags. The mbuf field and flag are registered when the offload is configured.
Definition at line 1622 of file rte_ethdev.h.
#define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP RTE_BIT64(0) |
Device supports Rx queue setup after device started.
Definition at line 1632 of file rte_ethdev.h.
#define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP RTE_BIT64(1) |
Device supports Tx queue setup after device started.
Definition at line 1634 of file rte_ethdev.h.
#define RTE_ETH_DEV_CAPA_RXQ_SHARE RTE_BIT64(2) |
Device supports shared Rx queue among ports within Rx domain and switch domain. Mbufs are consumed by shared Rx queue instead of each queue. Multiple groups are supported by share_group of Rx queue configuration. Shared Rx queue is identified by PMD using share_qid of Rx queue configuration. Polling any port in the group receive packets of all member ports, source port identified by mbuf->port field.
Definition at line 1644 of file rte_ethdev.h.
#define RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP RTE_BIT64(3) |
Device supports keeping flow rules across restart.
Definition at line 1646 of file rte_ethdev.h.
#define RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP RTE_BIT64(4) |
Device supports keeping shared flow objects across restart.
Definition at line 1648 of file rte_ethdev.h.
#define RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID (UINT16_MAX) |
Default values for switch domain ID when ethdev does not support switch domain definitions.
Definition at line 1676 of file rte_ethdev.h.
#define RTE_ETH_QUEUE_STATE_STOPPED 0 |
Queue stopped.
Definition at line 1835 of file rte_ethdev.h.
#define RTE_ETH_QUEUE_STATE_STARTED 1 |
Queue started.
Definition at line 1836 of file rte_ethdev.h.
#define RTE_ETH_QUEUE_STATE_HAIRPIN 2 |
Queue used for hairpin.
Definition at line 1837 of file rte_ethdev.h.
#define RTE_ETH_BURST_FLAG_PER_QUEUE RTE_BIT64(0) |
If the queues have different burst mode description, this bit will be set by PMD, then the application can iterate to retrieve burst description for all other queues.
Definition at line 1901 of file rte_ethdev.h.
#define RTE_ETH_BURST_MODE_INFO_SIZE 1024 |
Maximum size for information
Definition at line 1910 of file rte_ethdev.h.
#define RTE_ETH_XSTATS_NAME_SIZE 64 |
Maximum name length for extended statistics counters
Definition at line 1915 of file rte_ethdev.h.
#define RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE RTE_BIT32(0) |
PMD supports thread-safe flow operations
Definition at line 2107 of file rte_ethdev.h.
#define RTE_ETH_DEV_INTR_LSC RTE_BIT32(1) |
Device supports link state interrupt
Definition at line 2109 of file rte_ethdev.h.
#define RTE_ETH_DEV_BONDING_MEMBER RTE_BIT32(2) |
Device is a bonding member
Definition at line 2111 of file rte_ethdev.h.
#define RTE_ETH_DEV_INTR_RMV RTE_BIT32(3) |
Device supports device removal interrupt
Definition at line 2113 of file rte_ethdev.h.
#define RTE_ETH_DEV_REPRESENTOR RTE_BIT32(4) |
Device is port representor
Definition at line 2115 of file rte_ethdev.h.
#define RTE_ETH_DEV_NOLIVE_MAC_ADDR RTE_BIT32(5) |
Device does not support MAC change after started
Definition at line 2117 of file rte_ethdev.h.
#define RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS RTE_BIT32(6) |
Queue xstats filled automatically by ethdev layer. PMDs filling the queue xstats themselves should not set this flag
Definition at line 2122 of file rte_ethdev.h.
#define RTE_ETH_FOREACH_DEV_OWNED_BY | ( | p, | |
o | |||
) |
Macro to iterate over all enabled ethdev ports owned by a specific owner.
Definition at line 2142 of file rte_ethdev.h.
#define RTE_ETH_FOREACH_DEV | ( | p | ) | RTE_ETH_FOREACH_DEV_OWNED_BY(p, RTE_ETH_DEV_NO_OWNER) |
Macro to iterate over all enabled and ownerless ethdev ports.
Definition at line 2160 of file rte_ethdev.h.
#define RTE_ETH_FOREACH_DEV_OF | ( | port_id, | |
parent | |||
) |
Macro to iterate over all ethdev ports of a specified device.
port_id | The ID of the matching port being iterated. |
parent | The rte_device pointer matching the iterated ports. |
Definition at line 2186 of file rte_ethdev.h.
#define RTE_ETH_FOREACH_DEV_SIBLING | ( | port_id, | |
ref_port_id | |||
) |
Macro to iterate over all ethdev ports sharing the same rte_device as the specified port. Note: the specified reference port is part of the loop iterations.
port_id | The ID of the matching port being iterated. |
ref_port_id | The ID of the port being compared. |
Definition at line 2215 of file rte_ethdev.h.
#define RTE_ETH_TX_BUFFER_SIZE | ( | sz | ) | (sizeof(struct rte_eth_dev_tx_buffer) + (sz) * sizeof(struct rte_mbuf *)) |
Calculate the size of the Tx buffer.
sz | Number of stored packets. |
Definition at line 3754 of file rte_ethdev.h.
#define RTE_ETH_RX_METADATA_USER_FLAG RTE_BIT64(0) |
The NIC is able to deliver flag (if set) with packets to the PMD.
Definition at line 5553 of file rte_ethdev.h.
#define RTE_ETH_RX_METADATA_USER_MARK RTE_BIT64(1) |
The NIC is able to deliver mark ID with packets to the PMD.
Definition at line 5556 of file rte_ethdev.h.
#define RTE_ETH_RX_METADATA_TUNNEL_ID RTE_BIT64(2) |
The NIC is able to deliver tunnel ID with packets to the PMD.
Definition at line 5559 of file rte_ethdev.h.
#define RTE_ETH_DEV_REASSEMBLY_F_IPV4 (RTE_BIT32(0)) |
Flag to offload IP reassembly for IPv4 packets.
Definition at line 5603 of file rte_ethdev.h.
#define RTE_ETH_DEV_REASSEMBLY_F_IPV6 (RTE_BIT32(1)) |
Flag to offload IP reassembly for IPv6 packets.
Definition at line 5605 of file rte_ethdev.h.
#define RTE_ETH_RX_DESC_AVAIL 0 |
Desc available for hw.
Definition at line 6190 of file rte_ethdev.h.
#define RTE_ETH_RX_DESC_DONE 1 |
Desc done, filled by hw.
Definition at line 6191 of file rte_ethdev.h.
#define RTE_ETH_RX_DESC_UNAVAIL 2 |
Desc used by driver or hw.
Definition at line 6192 of file rte_ethdev.h.
#define RTE_ETH_TX_DESC_FULL 0 |
Desc filled for hw, waiting xmit.
Definition at line 6262 of file rte_ethdev.h.
#define RTE_ETH_TX_DESC_DONE 1 |
Desc done, packet is transmitted.
Definition at line 6263 of file rte_ethdev.h.
#define RTE_ETH_TX_DESC_UNAVAIL 2 |
Desc used by driver or hw.
Definition at line 6264 of file rte_ethdev.h.
typedef uint16_t(* rte_rx_callback_fn) (uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, uint16_t max_pkts, void *user_param) |
Function type used for Rx packet processing packet callbacks.
The callback function is called on Rx with a burst of packets that have been received on the given port and queue.
port_id | The Ethernet port on which Rx is being performed. |
queue | The queue on the Ethernet port which is being used to receive the packets. |
pkts | The burst of packets that have just been received. |
nb_pkts | The number of packets in the burst pointed to by "pkts". |
max_pkts | The max number of packets that can be stored in the "pkts" array. |
user_param | The arbitrary user parameter passed in by the application when the callback was originally configured. |
Definition at line 2044 of file rte_ethdev.h.
typedef uint16_t(* rte_tx_callback_fn) (uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, void *user_param) |
Function type used for Tx packet processing packet callbacks.
The callback function is called on Tx with a burst of packets immediately before the packets are put onto the hardware queue for transmission.
port_id | The Ethernet port on which Tx is being performed. |
queue | The queue on the Ethernet port which is being used to transmit the packets. |
pkts | The burst of packets that are about to be transmitted. |
nb_pkts | The number of packets in the burst pointed to by "pkts". |
user_param | The arbitrary user parameter passed in by the application when the callback was originally configured. |
Definition at line 2068 of file rte_ethdev.h.
typedef int(* rte_eth_dev_cb_fn) (uint16_t port_id, enum rte_eth_event_type event, void *cb_arg, void *ret_param) |
User application callback to be registered for interrupts.
Note: there is no guarantee in the DPDK drivers that a callback won't be called in the middle of other parts of the ethdev API. For example, imagine that thread A calls rte_eth_dev_start() and as part of this call, a RTE_ETH_EVENT_INTR_RESET event gets generated and the associated callback is ran on thread A. In that example, if the application protects its internal data using locks before calling rte_eth_dev_start(), and the callback takes a same lock, a deadlock occurs. Because of this, it is highly recommended NOT to take locks in those callbacks.
Definition at line 4112 of file rte_ethdev.h.
enum rte_eth_rx_mq_mode |
A set of values to identify what method is to be used to route packets to multiple queues.
Definition at line 382 of file rte_ethdev.h.
enum rte_eth_tx_mq_mode |
A set of values to identify what method is to be used to transmit packets using multi-TCs.
Definition at line 408 of file rte_ethdev.h.
enum rte_vlan_type |
VLAN types to indicate if it is for single VLAN, inner VLAN or outer VLAN. Note that single VLAN is treated the same as inner VLAN.
Enumerator | |
---|---|
RTE_ETH_VLAN_TYPE_INNER | Inner VLAN. |
RTE_ETH_VLAN_TYPE_OUTER | Single VLAN, or outer VLAN. |
Definition at line 439 of file rte_ethdev.h.
Hash function types.
Definition at line 457 of file rte_ethdev.h.
enum rte_eth_nb_tcs |
This enum indicates the possible number of traffic classes in DCB configurations
Enumerator | |
---|---|
RTE_ETH_4_TCS | 4 TCs with DCB. |
RTE_ETH_8_TCS | 8 TCs with DCB. |
Definition at line 904 of file rte_ethdev.h.
enum rte_eth_nb_pools |
This enum indicates the possible number of queue pools in VMDq configurations.
Enumerator | |
---|---|
RTE_ETH_8_POOLS | 8 VMDq pools. |
RTE_ETH_16_POOLS | 16 VMDq pools. |
RTE_ETH_32_POOLS | 32 VMDq pools. |
RTE_ETH_64_POOLS | 64 VMDq pools. |
Definition at line 913 of file rte_ethdev.h.
enum rte_eth_fc_mode |
This enum indicates the flow control mode
Definition at line 1356 of file rte_ethdev.h.
enum rte_eth_tunnel_type |
Tunnel type for device-specific classifier configuration.
Definition at line 1445 of file rte_ethdev.h.
Ethernet device information Ethernet device representor port type.
Definition at line 1722 of file rte_ethdev.h.
Ethernet device error handling mode.
Enumerator | |
---|---|
RTE_ETH_ERROR_HANDLE_MODE_NONE | No error handling modes are supported. |
RTE_ETH_ERROR_HANDLE_MODE_PASSIVE | Passive error handling, after the PMD detects that a reset is required, the PMD reports
|
RTE_ETH_ERROR_HANDLE_MODE_PROACTIVE | Proactive error handling, after the PMD detects that a reset is required, the PMD reports
|
Definition at line 1735 of file rte_ethdev.h.
enum rte_eth_fec_mode |
This enum indicates the possible Forward Error Correction (FEC) modes of an ethdev port.
Definition at line 1985 of file rte_ethdev.h.
enum rte_eth_dev_state |
Possible states of an ethdev port.
Definition at line 2074 of file rte_ethdev.h.
Subtypes for MACsec offload event (RTE_ETH_EVENT_MACSEC) raised by Ethernet device.
Definition at line 3883 of file rte_ethdev.h.
Event types for MACsec offload event (RTE_ETH_EVENT_MACSEC) raised by eth device.
Definition at line 3917 of file rte_ethdev.h.
Subtypes for IPsec offload event(RTE_ETH_EVENT_IPSEC) raised by eth device.
Enumerator | |
---|---|
RTE_ETH_EVENT_IPSEC_PMD_ERROR_START | PMD specific error start |
RTE_ETH_EVENT_IPSEC_PMD_ERROR_END | PMD specific error end |
RTE_ETH_EVENT_IPSEC_UNKNOWN | Unknown event type |
RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW | Sequence number overflow |
RTE_ETH_EVENT_IPSEC_SA_TIME_EXPIRY | Soft time expiry of SA |
RTE_ETH_EVENT_IPSEC_SA_BYTE_EXPIRY | Soft byte expiry of SA determined by rte_security_ipsec_lifetime::bytes_soft_limit |
RTE_ETH_EVENT_IPSEC_SA_PKT_EXPIRY | Soft packet expiry of SA determined by rte_security_ipsec_lifetime::packets_soft_limit |
RTE_ETH_EVENT_IPSEC_SA_BYTE_HARD_EXPIRY | Hard byte expiry of SA determined by rte_security_ipsec_lifetime::bytes_hard_limit |
RTE_ETH_EVENT_IPSEC_SA_PKT_HARD_EXPIRY | Hard packet expiry of SA determined by rte_security_ipsec_lifetime::packets_hard_limit |
RTE_ETH_EVENT_IPSEC_MAX | Max value of this enum |
Definition at line 3959 of file rte_ethdev.h.
enum rte_eth_event_type |
The eth device event type for interrupt, and maybe others in the future.
Enumerator | |
---|---|
RTE_ETH_EVENT_UNKNOWN | unknown event type |
RTE_ETH_EVENT_INTR_LSC | lsc interrupt event |
RTE_ETH_EVENT_QUEUE_STATE | queue state event (enabled/disabled) |
RTE_ETH_EVENT_INTR_RESET | reset interrupt event, sent to VF on PF reset |
RTE_ETH_EVENT_VF_MBOX | message from the VF received by PF |
RTE_ETH_EVENT_MACSEC | MACsec offload related event |
RTE_ETH_EVENT_INTR_RMV | device removal event |
RTE_ETH_EVENT_NEW | port is probed |
RTE_ETH_EVENT_DESTROY | port is released |
RTE_ETH_EVENT_IPSEC | IPsec offload related event |
RTE_ETH_EVENT_FLOW_AGED | New aged-out flows is detected |
RTE_ETH_EVENT_RX_AVAIL_THRESH | Number of available Rx descriptors is smaller than the threshold.
|
RTE_ETH_EVENT_ERR_RECOVERING | Port recovering from a hardware or firmware error. If PMD supports proactive error recovery, it should trigger this event to notify application that it detected an error and the recovery is being started. Upon receiving the event, the application should not invoke any control path API (such as rte_eth_dev_configure/rte_eth_dev_stop...) until receiving RTE_ETH_EVENT_RECOVERY_SUCCESS or RTE_ETH_EVENT_RECOVERY_FAILED event. The PMD will set the data path pointers to dummy functions, and re-set the data path pointers to non-dummy functions before reporting RTE_ETH_EVENT_RECOVERY_SUCCESS event. It means that the application cannot send or receive any packets during this period.
|
RTE_ETH_EVENT_RECOVERY_SUCCESS | Port recovers successfully from the error. The PMD already re-configured the port, and the effect is the same as a restart operation. a) The following operation will be retained: (alphabetically)
|
RTE_ETH_EVENT_RECOVERY_FAILED | Port recovery failed. It means that the port should not be usable anymore. The application should close the port. |
RTE_ETH_EVENT_MAX | max value of this enum |
Definition at line 4024 of file rte_ethdev.h.
enum rte_eth_cman_obj |
Enumerate list of ethdev congestion management objects
Enumerator | |
---|---|
RTE_ETH_CMAN_OBJ_RX_QUEUE | Congestion management based on Rx queue depth |
RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL | Congestion management based on mempool depth associated with Rx queue
|
Definition at line 5807 of file rte_ethdev.h.
int rte_eth_iterator_init | ( | struct rte_dev_iterator * | iter, |
const char * | devargs | ||
) |
Initializes a device iterator.
This iterator allows accessing a list of devices matching some devargs.
iter | 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. |
uint16_t rte_eth_iterator_next | ( | struct rte_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.
iter | 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(). |
void rte_eth_iterator_cleanup | ( | struct rte_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.
iter | Device iterator handle initialized by rte_eth_iterator_init(). The fields bus_str and cls_str are freed if needed. |
|
inlinestatic |
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.
rss_hf | RSS types with SRC/DST_ONLY. |
Definition at line 667 of file rte_ethdev.h.
uint64_t rte_eth_find_next_owned_by | ( | uint16_t | port_id, |
const uint64_t | owner_id | ||
) |
Iterates over valid ethdev ports owned by a specific owner.
port_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. |
uint16_t rte_eth_find_next | ( | uint16_t | port_id | ) |
Iterates over valid ethdev ports.
port_id | The ID of the next possible valid port. |
uint16_t rte_eth_find_next_of | ( | uint16_t | port_id_start, |
const struct rte_device * | parent | ||
) |
Iterates over ethdev ports of a specified device.
port_id_start | The ID of the next possible valid port. |
parent | The generic device behind the ports to iterate. |
uint16_t rte_eth_find_next_sibling | ( | uint16_t | port_id_start, |
uint16_t | ref_port_id | ||
) |
Iterates over sibling ethdev ports (i.e. sharing the same rte_device).
port_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. |
int rte_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.
owner_id | Owner identifier pointer. |
int rte_eth_dev_owner_set | ( | const uint16_t | port_id, |
const struct rte_eth_dev_owner * | owner | ||
) |
Set an Ethernet device owner.
port_id | The identifier of the port to own. |
owner | The owner pointer. |
int rte_eth_dev_owner_unset | ( | const uint16_t | port_id, |
const uint64_t | owner_id | ||
) |
Unset Ethernet device owner to make the device ownerless.
port_id | The identifier of port to make ownerless. |
owner_id | The owner identifier. |
int rte_eth_dev_owner_delete | ( | const uint64_t | owner_id | ) |
Remove owner from all Ethernet devices owned by a specific owner.
owner_id | The owner identifier. |
int rte_eth_dev_owner_get | ( | const uint16_t | port_id, |
struct rte_eth_dev_owner * | owner | ||
) |
Get the owner of an Ethernet device.
port_id | The port identifier. |
owner | The owner structure pointer to fill. |
uint16_t rte_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.
uint16_t rte_eth_dev_count_total | ( | void | ) |
Get the total number of ports which are allocated.
Some devices may not be available for the application.
uint32_t rte_eth_speed_bitflag | ( | uint32_t | speed, |
int | duplex | ||
) |
Convert a numerical speed in Mbps to a bitmap flag that can be used in the bitmap link_speeds of the struct rte_eth_conf
speed | Numerical speed value in Mbps |
duplex | RTE_ETH_LINK_[HALF/FULL]_DUPLEX (only for 10/100M speeds) |
const char* rte_eth_dev_rx_offload_name | ( | uint64_t | offload | ) |
Get RTE_ETH_RX_OFFLOAD_* flag name.
offload | Offload flag. |
const char* rte_eth_dev_tx_offload_name | ( | uint64_t | offload | ) |
Get RTE_ETH_TX_OFFLOAD_* flag name.
offload | Offload flag. |
__rte_experimental const char* rte_eth_dev_capability_name | ( | uint64_t | capability | ) |
Get RTE_ETH_DEV_CAPA_* flag name.
capability | Capability flag. |
int rte_eth_dev_configure | ( | uint16_t | port_id, |
uint16_t | nb_rx_queue, | ||
uint16_t | nb_tx_queue, | ||
const struct rte_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.
port_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_conf structure includes:
|
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.
int rte_eth_dev_is_removed | ( | uint16_t | port_id | ) |
Check if an Ethernet device was physically removed.
port_id | The port identifier of the Ethernet device. |
int rte_eth_rx_queue_setup | ( | uint16_t | port_id, |
uint16_t | rx_queue_id, | ||
uint16_t | nb_rx_desc, | ||
unsigned int | socket_id, | ||
const struct rte_eth_rxconf * | rx_conf, | ||
struct rte_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.
port_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_mbuf network memory buffers to populate each descriptor of the receive ring. There are two options to provide Rx buffer configuration:
|
__rte_experimental int rte_eth_rx_hairpin_queue_setup | ( | uint16_t | port_id, |
uint16_t | rx_queue_id, | ||
uint16_t | nb_rx_desc, | ||
const struct rte_eth_hairpin_conf * | conf | ||
) |
Allocate and set up a hairpin receive queue for an Ethernet device.
The function set up the selected queue to be used in hairpin.
port_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. |
int rte_eth_tx_queue_setup | ( | uint16_t | port_id, |
uint16_t | tx_queue_id, | ||
uint16_t | nb_tx_desc, | ||
unsigned int | socket_id, | ||
const struct rte_eth_txconf * | tx_conf | ||
) |
Allocate and set up a transmit queue for an Ethernet device.
port_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:
|
__rte_experimental int rte_eth_tx_hairpin_queue_setup | ( | uint16_t | port_id, |
uint16_t | tx_queue_id, | ||
uint16_t | nb_tx_desc, | ||
const struct rte_eth_hairpin_conf * | conf | ||
) |
Allocate and set up a transmit hairpin queue for an Ethernet device.
port_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. |
__rte_experimental int rte_eth_hairpin_get_peer_ports | ( | uint16_t | port_id, |
uint16_t * | peer_ports, | ||
size_t | len, | ||
uint32_t | direction | ||
) |
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.
port_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. |
__rte_experimental int rte_eth_hairpin_bind | ( | uint16_t | tx_port, |
uint16_t | rx_port | ||
) |
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.
tx_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. |
__rte_experimental int rte_eth_hairpin_unbind | ( | uint16_t | tx_port, |
uint16_t | rx_port | ||
) |
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).
tx_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. |
__rte_experimental int rte_eth_dev_count_aggr_ports | ( | uint16_t | port_id | ) |
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.
port_id | The port identifier of the Ethernet device. |
__rte_experimental int rte_eth_dev_map_aggr_tx_affinity | ( | uint16_t | port_id, |
uint16_t | tx_queue_id, | ||
uint8_t | affinity | ||
) |
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().
port_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(). |
int rte_eth_dev_socket_id | ( | uint16_t | port_id | ) |
Return the NUMA socket to which an Ethernet device is connected
port_id | The port identifier of the Ethernet device |
int rte_eth_dev_is_valid_port | ( | uint16_t | port_id | ) |
Check if port_id of device is attached
port_id | The port identifier of the Ethernet device |
__rte_experimental int rte_eth_rx_queue_is_valid | ( | uint16_t | port_id, |
uint16_t | queue_id | ||
) |
Check if Rx queue is valid. If the queue has been setup, it is considered valid.
port_id | The port identifier of the Ethernet device. |
queue_id | The index of the receive queue. |
__rte_experimental int rte_eth_tx_queue_is_valid | ( | uint16_t | port_id, |
uint16_t | queue_id | ||
) |
Check if Tx queue is valid. If the queue has been setup, it is considered valid.
port_id | The port identifier of the Ethernet device. |
queue_id | The index of the transmit queue. |
int rte_eth_dev_rx_queue_start | ( | uint16_t | port_id, |
uint16_t | rx_queue_id | ||
) |
Start specified Rx queue of a port. It is used when rx_deferred_start flag of the specified queue is true.
port_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(). |
int rte_eth_dev_rx_queue_stop | ( | uint16_t | port_id, |
uint16_t | rx_queue_id | ||
) |
Stop specified Rx queue of a port
port_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(). |
int rte_eth_dev_tx_queue_start | ( | uint16_t | port_id, |
uint16_t | tx_queue_id | ||
) |
Start Tx for specified queue of a port. It is used when tx_deferred_start flag of the specified queue is true.
port_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(). |
int rte_eth_dev_tx_queue_stop | ( | uint16_t | port_id, |
uint16_t | tx_queue_id | ||
) |
Stop specified Tx queue of a port
port_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(). |
int rte_eth_dev_start | ( | uint16_t | port_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.
port_id | The port identifier of the Ethernet device. |
int rte_eth_dev_stop | ( | uint16_t | port_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.
port_id | The port identifier of the Ethernet device. |
int rte_eth_dev_set_link_up | ( | uint16_t | port_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.
port_id | The port identifier of the Ethernet device. |
int rte_eth_dev_set_link_down | ( | uint16_t | port_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()
port_id | The port identifier of the Ethernet device. |
int rte_eth_dev_close | ( | uint16_t | port_id | ) |
Close a stopped Ethernet device. The device cannot be restarted! The function frees all port resources.
port_id | The port identifier of the Ethernet device. |
int rte_eth_dev_reset | ( | uint16_t | port_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.
port_id | The port identifier of the Ethernet device. |
int rte_eth_promiscuous_enable | ( | uint16_t | port_id | ) |
Enable receipt in promiscuous mode for an Ethernet device.
port_id | The port identifier of the Ethernet device. |
int rte_eth_promiscuous_disable | ( | uint16_t | port_id | ) |
Disable receipt in promiscuous mode for an Ethernet device.
port_id | The port identifier of the Ethernet device. |
int rte_eth_promiscuous_get | ( | uint16_t | port_id | ) |
Return the value of promiscuous mode for an Ethernet device.
port_id | The port identifier of the Ethernet device. |
int rte_eth_allmulticast_enable | ( | uint16_t | port_id | ) |
Enable the receipt of any multicast frame by an Ethernet device.
port_id | The port identifier of the Ethernet device. |
int rte_eth_allmulticast_disable | ( | uint16_t | port_id | ) |
Disable the receipt of all multicast frames by an Ethernet device.
port_id | The port identifier of the Ethernet device. |
int rte_eth_allmulticast_get | ( | uint16_t | port_id | ) |
Return the value of allmulticast mode for an Ethernet device.
port_id | The port identifier of the Ethernet device. |
int rte_eth_link_get | ( | uint16_t | port_id, |
struct rte_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.
port_id | The port identifier of the Ethernet device. |
link | Link information written back. |
int rte_eth_link_get_nowait | ( | uint16_t | port_id, |
struct rte_eth_link * | link | ||
) |
Retrieve the link status (up/down), the duplex mode (half/full), the negotiation (auto/fixed), and if available, the speed (Mbps).
port_id | The port identifier of the Ethernet device. |
link | Link information written back. |
__rte_experimental const char* rte_eth_link_speed_to_str | ( | uint32_t | link_speed | ) |
The function converts a link_speed to a string. It handles all special values like unknown or none speed.
link_speed | link_speed of rte_eth_link struct |
__rte_experimental int rte_eth_link_to_str | ( | char * | str, |
size_t | len, | ||
const struct rte_eth_link * | eth_link | ||
) |
The function converts a rte_eth_link struct representing a link status to a string.
str | 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 |
int rte_eth_stats_get | ( | uint16_t | port_id, |
struct rte_eth_stats * | stats | ||
) |
Retrieve the general I/O statistics of an Ethernet device.
port_id | The port identifier of the Ethernet device. |
stats | A pointer to a structure of type rte_eth_stats to be filled with the values of device counters for the following set of statistics:
|
int rte_eth_stats_reset | ( | uint16_t | port_id | ) |
Reset the general I/O statistics of an Ethernet device.
port_id | The port identifier of the Ethernet device. |
int rte_eth_xstats_get_names | ( | uint16_t | port_id, |
struct rte_eth_xstat_name * | xstats_names, | ||
unsigned int | size | ||
) |
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.
port_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). |
int rte_eth_xstats_get | ( | uint16_t | port_id, |
struct rte_eth_xstat * | xstats, | ||
unsigned int | n | ||
) |
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.
port_id | The port identifier of the Ethernet device. |
xstats | A pointer to a table of structure of type rte_eth_xstat to be filled with device statistics ids and values. This parameter can be set to NULL if and only if n is 0. |
n | The size of the xstats array (number of elements). If lower than the required number of elements, the function returns the required number of elements. If equal to zero, the xstats must be NULL, the function returns the required number of elements. |
int rte_eth_xstats_get_names_by_id | ( | uint16_t | port_id, |
struct rte_eth_xstat_name * | xstats_names, | ||
unsigned int | size, | ||
uint64_t * | ids | ||
) |
Retrieve names of extended statistics of an Ethernet device.
port_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. |
int rte_eth_xstats_get_by_id | ( | uint16_t | port_id, |
const uint64_t * | ids, | ||
uint64_t * | values, | ||
unsigned int | size | ||
) |
Retrieve extended statistics of an Ethernet device.
port_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. |
int rte_eth_xstats_get_id_by_name | ( | uint16_t | port_id, |
const char * | 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()
port_id | The port to look up statistics from | |
xstat_name | The name of the statistic to return | |
[out] | id | A pointer to an app-supplied uint64_t which should be set to the ID of the stat if the stat exists. |
int rte_eth_xstats_reset | ( | uint16_t | port_id | ) |
Reset extended statistics of an Ethernet device.
port_id | The port identifier of the Ethernet device. |
int rte_eth_dev_set_tx_queue_stats_mapping | ( | uint16_t | port_id, |
uint16_t | tx_queue_id, | ||
uint8_t | stat_idx | ||
) |
Set a mapping for the specified transmit queue to the specified per-queue statistics counter.
port_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. |
int rte_eth_dev_set_rx_queue_stats_mapping | ( | uint16_t | port_id, |
uint16_t | rx_queue_id, | ||
uint8_t | stat_idx | ||
) |
Set a mapping for the specified receive queue to the specified per-queue statistics counter.
port_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. |
int rte_eth_macaddr_get | ( | uint16_t | port_id, |
struct rte_ether_addr * | mac_addr | ||
) |
Retrieve the Ethernet address of an Ethernet device.
port_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. |
__rte_experimental int rte_eth_macaddrs_get | ( | uint16_t | port_id, |
struct rte_ether_addr * | ma, | ||
unsigned int | num | ||
) |
Retrieve the Ethernet addresses of an Ethernet device.
port_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. |
int rte_eth_dev_info_get | ( | uint16_t | port_id, |
struct rte_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.
port_id | The port identifier of the Ethernet device. |
dev_info | A pointer to a structure of type rte_eth_dev_info to be filled with the contextual information of the Ethernet device. |
__rte_experimental int rte_eth_dev_conf_get | ( | uint16_t | port_id, |
struct rte_eth_conf * | dev_conf | ||
) |
Retrieve the configuration of an Ethernet device.
port_id | The port identifier of the Ethernet device. |
dev_conf | Location for Ethernet device configuration to be filled in. |
int rte_eth_dev_fw_version_get | ( | uint16_t | port_id, |
char * | fw_version, | ||
size_t | fw_size | ||
) |
Retrieve the firmware version of a device.
port_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. |
int rte_eth_dev_get_supported_ptypes | ( | uint16_t | port_id, |
uint32_t | ptype_mask, | ||
uint32_t * | ptypes, | ||
int | num | ||
) |
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:
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.
port_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. |
int rte_eth_dev_set_ptypes | ( | uint16_t | port_id, |
uint32_t | ptype_mask, | ||
uint32_t * | set_ptypes, | ||
unsigned int | num | ||
) |
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
else it might only be filled partially.
port_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. |
int rte_eth_dev_get_mtu | ( | uint16_t | port_id, |
uint16_t * | mtu | ||
) |
Retrieve the MTU of an Ethernet device.
port_id | The port identifier of the Ethernet device. |
mtu | A pointer to a uint16_t where the retrieved MTU is to be stored. |
int rte_eth_dev_set_mtu | ( | uint16_t | port_id, |
uint16_t | mtu | ||
) |
Change the MTU of an Ethernet device.
port_id | The port identifier of the Ethernet device. |
mtu | A uint16_t for the MTU to be applied. |
int rte_eth_dev_vlan_filter | ( | uint16_t | port_id, |
uint16_t | vlan_id, | ||
int | on | ||
) |
Enable/Disable hardware filtering by an Ethernet device of received VLAN packets tagged with a given VLAN Tag Identifier.
port_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. |
int rte_eth_dev_set_vlan_strip_on_queue | ( | uint16_t | port_id, |
uint16_t | rx_queue_id, | ||
int | on | ||
) |
Enable/Disable hardware VLAN Strip by a Rx queue of an Ethernet device.
port_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. |
int rte_eth_dev_set_vlan_ether_type | ( | uint16_t | port_id, |
enum rte_vlan_type | vlan_type, | ||
uint16_t | tag_type | ||
) |
Set the Outer VLAN Ether Type by an Ethernet device, it can be inserted to the VLAN header.
port_id | The port identifier of the Ethernet device. |
vlan_type | The VLAN type. |
tag_type | The Tag Protocol ID |
int rte_eth_dev_set_vlan_offload | ( | uint16_t | port_id, |
int | offload_mask | ||
) |
Set VLAN offload configuration on an Ethernet device.
port_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 |
int rte_eth_dev_get_vlan_offload | ( | uint16_t | port_id | ) |
Read VLAN Offload configuration from an Ethernet device
port_id | The port identifier of the Ethernet device. |
int rte_eth_dev_set_vlan_pvid | ( | uint16_t | port_id, |
uint16_t | pvid, | ||
int | on | ||
) |
Set port based Tx VLAN insertion on or off.
port_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. |
__rte_experimental int rte_eth_rx_avail_thresh_set | ( | uint16_t | port_id, |
uint16_t | queue_id, | ||
uint8_t | avail_thresh | ||
) |
Set Rx queue available descriptors threshold.
port_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. |
port_id
is invalid.__rte_experimental int rte_eth_rx_avail_thresh_query | ( | uint16_t | port_id, |
uint16_t * | queue_id, | ||
uint8_t * | avail_thresh | ||
) |
Find Rx queue with RTE_ETH_EVENT_RX_AVAIL_THRESH event pending.
port_id | The port identifier of the Ethernet device. | |
[in,out] | 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. |
[out] | avail_thresh | Location for available descriptors threshold of the found Rx queue. |
port_id
is invalid.queue_id
is NULL).int rte_eth_tx_buffer_init | ( | struct rte_eth_dev_tx_buffer * | buffer, |
uint16_t | size | ||
) |
Initialize default values for buffered transmitting
buffer | Tx buffer to be initialized. |
size | Buffer size |
int rte_eth_tx_buffer_set_err_callback | ( | struct rte_eth_dev_tx_buffer * | buffer, |
buffer_tx_error_fn | callback, | ||
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.
buffer | 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 |
void rte_eth_tx_buffer_drop_callback | ( | struct rte_mbuf ** | pkts, |
uint16_t | unsent, | ||
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.
pkts | The previously buffered packets which could not be sent |
unsent | The number of unsent packets in the pkts array |
userdata | Not used |
void rte_eth_tx_buffer_count_callback | ( | struct rte_mbuf ** | pkts, |
uint16_t | unsent, | ||
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.
pkts | 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 |
int rte_eth_tx_done_cleanup | ( | uint16_t | port_id, |
uint16_t | queue_id, | ||
uint32_t | free_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.
port_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. |
int rte_eth_dev_callback_register | ( | uint16_t | port_id, |
enum rte_eth_event_type | event, | ||
rte_eth_dev_cb_fn | cb_fn, | ||
void * | cb_arg | ||
) |
Register a callback function for port event.
port_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. |
int rte_eth_dev_callback_unregister | ( | uint16_t | port_id, |
enum rte_eth_event_type | event, | ||
rte_eth_dev_cb_fn | cb_fn, | ||
void * | cb_arg | ||
) |
Unregister a callback function for port event.
port_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. |
int rte_eth_dev_rx_intr_enable | ( | uint16_t | port_id, |
uint16_t | queue_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.
port_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(). |
int rte_eth_dev_rx_intr_disable | ( | uint16_t | port_id, |
uint16_t | queue_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.
port_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(). |
int rte_eth_dev_rx_intr_ctl | ( | uint16_t | port_id, |
int | epfd, | ||
int | op, | ||
void * | data | ||
) |
Rx Interrupt control per port.
port_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. |
int rte_eth_dev_rx_intr_ctl_q | ( | uint16_t | port_id, |
uint16_t | queue_id, | ||
int | epfd, | ||
int | op, | ||
void * | data | ||
) |
Rx Interrupt control per queue.
port_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. |
int rte_eth_dev_rx_intr_ctl_q_get_fd | ( | uint16_t | port_id, |
uint16_t | queue_id | ||
) |
Get interrupt fd per Rx queue.
port_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(). |
int rte_eth_led_on | ( | uint16_t | port_id | ) |
Turn on the LED on the Ethernet device. This function turns on the LED on the Ethernet device.
port_id | The port identifier of the Ethernet device. |
int rte_eth_led_off | ( | uint16_t | port_id | ) |
Turn off the LED on the Ethernet device. This function turns off the LED on the Ethernet device.
port_id | The port identifier of the Ethernet device. |
__rte_experimental int rte_eth_fec_get_capability | ( | uint16_t | port_id, |
struct rte_eth_fec_capa * | speed_fec_capa, | ||
unsigned int | num | ||
) |
Get Forward Error Correction(FEC) capability.
port_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. |
__rte_experimental int rte_eth_fec_get | ( | uint16_t | port_id, |
uint32_t * | fec_capa | ||
) |
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.
port_id | The port identifier of the Ethernet device. |
fec_capa | A bitmask with the current FEC mode. |
__rte_experimental int rte_eth_fec_set | ( | uint16_t | port_id, |
uint32_t | fec_capa | ||
) |
Set Forward Error Correction(FEC) mode.
port_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). |
int rte_eth_dev_flow_ctrl_get | ( | uint16_t | port_id, |
struct rte_eth_fc_conf * | fc_conf | ||
) |
Get current status of the Ethernet link flow control for Ethernet device
port_id | The port identifier of the Ethernet device. |
fc_conf | The pointer to the structure where to store the flow control parameters. |
int rte_eth_dev_flow_ctrl_set | ( | uint16_t | port_id, |
struct rte_eth_fc_conf * | fc_conf | ||
) |
Configure the Ethernet link flow control for Ethernet device
port_id | The port identifier of the Ethernet device. |
fc_conf | The pointer to the structure of the flow control parameters. |
int rte_eth_dev_priority_flow_ctrl_set | ( | uint16_t | port_id, |
struct rte_eth_pfc_conf * | pfc_conf | ||
) |
Configure the Ethernet priority flow control under DCB environment for Ethernet device.
port_id | The port identifier of the Ethernet device. |
pfc_conf | The pointer to the structure of the priority flow control parameters. |
int rte_eth_dev_mac_addr_add | ( | uint16_t | port_id, |
struct rte_ether_addr * | mac_addr, | ||
uint32_t | pool | ||
) |
Add a MAC address to the set used for filtering incoming packets.
port_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. |
__rte_experimental int rte_eth_dev_priority_flow_ctrl_queue_info_get | ( | uint16_t | port_id, |
struct rte_eth_pfc_queue_info * | pfc_queue_info | ||
) |
Retrieve the information for queue based PFC.
port_id | The port identifier of the Ethernet device. |
pfc_queue_info | A pointer to a structure of type rte_eth_pfc_queue_info to be filled with the information about queue based PFC. |
__rte_experimental int rte_eth_dev_priority_flow_ctrl_queue_configure | ( | uint16_t | port_id, |
struct rte_eth_pfc_queue_conf * | pfc_queue_conf | ||
) |
Configure the queue based priority flow control for a given queue for Ethernet device.
port_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. |
int rte_eth_dev_mac_addr_remove | ( | uint16_t | port_id, |
struct rte_ether_addr * | mac_addr | ||
) |
Remove a MAC address from the internal array of addresses.
port_id | The port identifier of the Ethernet device. |
mac_addr | MAC address to remove. |
int rte_eth_dev_default_mac_addr_set | ( | uint16_t | port_id, |
struct rte_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.
port_id | The port identifier of the Ethernet device. |
mac_addr | New default MAC address. |
int rte_eth_dev_rss_reta_update | ( | uint16_t | port_id, |
struct rte_eth_rss_reta_entry64 * | reta_conf, | ||
uint16_t | reta_size | ||
) |
Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device.
port_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(). |
int rte_eth_dev_rss_reta_query | ( | uint16_t | port_id, |
struct rte_eth_rss_reta_entry64 * | reta_conf, | ||
uint16_t | reta_size | ||
) |
Query Redirection Table(RETA) of Receive Side Scaling of Ethernet device.
port_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(). |
int rte_eth_dev_uc_hash_table_set | ( | uint16_t | port_id, |
struct rte_ether_addr * | addr, | ||
uint8_t | on | ||
) |
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.
port_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. |
int rte_eth_dev_uc_all_hash_table_set | ( | uint16_t | port_id, |
uint8_t | on | ||
) |
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.
port_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 |
int rte_eth_set_queue_rate_limit | ( | uint16_t | port_id, |
uint16_t | queue_idx, | ||
uint32_t | tx_rate | ||
) |
Set the rate limitation for a queue on an Ethernet device.
port_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. |
int rte_eth_dev_rss_hash_update | ( | uint16_t | port_id, |
struct rte_eth_rss_conf * | rss_conf | ||
) |
Configuration of Receive Side Scaling hash computation of Ethernet device.
port_id | The port identifier of the Ethernet device. |
rss_conf | The new configuration to use for RSS hash computation on the port. |
int rte_eth_dev_rss_hash_conf_get | ( | uint16_t | port_id, |
struct rte_eth_rss_conf * | rss_conf | ||
) |
Retrieve current configuration of Receive Side Scaling hash computation of Ethernet device.
port_id | The port identifier of the Ethernet device. |
rss_conf | Where to store the current RSS hash configuration of the Ethernet device. |
__rte_experimental const char* rte_eth_dev_rss_algo_name | ( | enum rte_eth_hash_function | rss_algo | ) |
Get the name of RSS hash algorithm.
rss_algo | Hash algorithm. |
__rte_experimental int rte_eth_find_rss_algo | ( | const char * | name, |
uint32_t * | algo | ||
) |
Get RSS hash algorithm by its name.
name | RSS hash algorithm. |
algo | Return the RSS hash algorithm found, |
int rte_eth_dev_udp_tunnel_port_add | ( | uint16_t | port_id, |
struct rte_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.:
port_id | The port identifier of the Ethernet device. |
tunnel_udp | UDP tunneling configuration. |
int rte_eth_dev_udp_tunnel_port_delete | ( | uint16_t | port_id, |
struct rte_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.
port_id | The port identifier of the Ethernet device. |
tunnel_udp | UDP tunneling configuration. |
int rte_eth_dev_get_dcb_info | ( | uint16_t | port_id, |
struct rte_eth_dcb_info * | dcb_info | ||
) |
Get DCB information on an Ethernet device.
port_id | The port identifier of the Ethernet device. |
dcb_info | DCB information. |
const struct rte_eth_rxtx_callback* rte_eth_add_rx_callback | ( | uint16_t | port_id, |
uint16_t | queue_id, | ||
rte_rx_callback_fn | fn, | ||
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.
port_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. |
const struct rte_eth_rxtx_callback* rte_eth_add_first_rx_callback | ( | uint16_t | port_id, |
uint16_t | queue_id, | ||
rte_rx_callback_fn | fn, | ||
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.
port_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. |
const struct rte_eth_rxtx_callback* rte_eth_add_tx_callback | ( | uint16_t | port_id, |
uint16_t | queue_id, | ||
rte_tx_callback_fn | fn, | ||
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.
port_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. |
int rte_eth_remove_rx_callback | ( | uint16_t | port_id, |
uint16_t | queue_id, | ||
const struct rte_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():
port_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(). |
int rte_eth_remove_tx_callback | ( | uint16_t | port_id, |
uint16_t | queue_id, | ||
const struct rte_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():
port_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(). |
int rte_eth_rx_queue_info_get | ( | uint16_t | port_id, |
uint16_t | queue_id, | ||
struct rte_eth_rxq_info * | qinfo | ||
) |
Retrieve information about given port's Rx queue.
port_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. |
int rte_eth_tx_queue_info_get | ( | uint16_t | port_id, |
uint16_t | queue_id, | ||
struct rte_eth_txq_info * | qinfo | ||
) |
Retrieve information about given port's Tx queue.
port_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. |
__rte_experimental int rte_eth_recycle_rx_queue_info_get | ( | uint16_t | port_id, |
uint16_t | queue_id, | ||
struct rte_eth_recycle_rxq_info * | recycle_rxq_info | ||
) |
Retrieve information about given ports's Rx queue for recycling mbufs.
port_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_info to be filled. |
int rte_eth_rx_burst_mode_get | ( | uint16_t | port_id, |
uint16_t | queue_id, | ||
struct rte_eth_burst_mode * | mode | ||
) |
Retrieve information about the Rx packet burst mode.
port_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_mode to be filled with the information of the packet burst mode. |
int rte_eth_tx_burst_mode_get | ( | uint16_t | port_id, |
uint16_t | queue_id, | ||
struct rte_eth_burst_mode * | mode | ||
) |
Retrieve information about the Tx packet burst mode.
port_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_mode to be filled with the information of the packet burst mode. |
__rte_experimental int rte_eth_get_monitor_addr | ( | uint16_t | port_id, |
uint16_t | queue_id, | ||
struct rte_power_monitor_cond * | pmc | ||
) |
Retrieve the monitor condition for a given receive queue.
port_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. |
int rte_eth_dev_get_reg_info | ( | uint16_t | port_id, |
struct rte_dev_reg_info * | info | ||
) |
Retrieve device registers and register attributes (number of registers and register size)
port_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. |
int rte_eth_dev_get_eeprom_length | ( | uint16_t | port_id | ) |
Retrieve size of device EEPROM
port_id | The port identifier of the Ethernet device. |
int rte_eth_dev_get_eeprom | ( | uint16_t | port_id, |
struct rte_dev_eeprom_info * | info | ||
) |
Retrieve EEPROM and EEPROM attribute
port_id | The port identifier of the Ethernet device. |
info | The template includes buffer for return EEPROM data and EEPROM attributes to be filled. |
int rte_eth_dev_set_eeprom | ( | uint16_t | port_id, |
struct rte_dev_eeprom_info * | info | ||
) |
Program EEPROM with provided data
port_id | The port identifier of the Ethernet device. |
info | The template includes EEPROM data for programming and EEPROM attributes to be filled |
__rte_experimental int rte_eth_dev_get_module_info | ( | uint16_t | port_id, |
struct rte_eth_dev_module_info * | modinfo | ||
) |
Retrieve the type and size of plugin module EEPROM
port_id | The port identifier of the Ethernet device. |
modinfo | The type and size of plugin module EEPROM. |
__rte_experimental int rte_eth_dev_get_module_eeprom | ( | uint16_t | port_id, |
struct rte_dev_eeprom_info * | info | ||
) |
Retrieve the data of plugin module EEPROM
port_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. |
int rte_eth_dev_set_mc_addr_list | ( | uint16_t | port_id, |
struct rte_ether_addr * | mc_addr_set, | ||
uint32_t | nb_mc_addr | ||
) |
Set the list of multicast addresses to filter on an Ethernet device.
port_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. |
int rte_eth_timesync_enable | ( | uint16_t | port_id | ) |
Enable IEEE1588/802.1AS timestamping for an Ethernet device.
port_id | The port identifier of the Ethernet device. |
int rte_eth_timesync_disable | ( | uint16_t | port_id | ) |
Disable IEEE1588/802.1AS timestamping for an Ethernet device.
port_id | The port identifier of the Ethernet device. |
int rte_eth_timesync_read_rx_timestamp | ( | uint16_t | port_id, |
struct timespec * | timestamp, | ||
uint32_t | flags | ||
) |
Read an IEEE1588/802.1AS Rx timestamp from an Ethernet device.
port_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. |
int rte_eth_timesync_read_tx_timestamp | ( | uint16_t | port_id, |
struct timespec * | timestamp | ||
) |
Read an IEEE1588/802.1AS Tx timestamp from an Ethernet device.
port_id | The port identifier of the Ethernet device. |
timestamp | Pointer to the timestamp struct. |
int rte_eth_timesync_adjust_time | ( | uint16_t | port_id, |
int64_t | delta | ||
) |
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.
port_id | The port identifier of the Ethernet device. |
delta | The adjustment in nanoseconds. |
int rte_eth_timesync_read_time | ( | uint16_t | port_id, |
struct timespec * | 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.
port_id | The port identifier of the Ethernet device. |
time | Pointer to the timespec struct that holds the time. |
int rte_eth_timesync_write_time | ( | uint16_t | port_id, |
const struct timespec * | 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.
port_id | The port identifier of the Ethernet device. |
time | Pointer to the timespec struct that holds the time. |
__rte_experimental int rte_eth_read_clock | ( | uint16_t | port_id, |
uint64_t * | clock | ||
) |
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.
port_id | The port identifier of the Ethernet device. |
clock | Pointer to the uint64_t that holds the raw clock value. |
int rte_eth_dev_get_port_by_name | ( | const char * | name, |
uint16_t * | port_id | ||
) |
Get the port ID from device name. The device name should be specified as below:
name | PCI address or name of the device. |
port_id | Pointer to port identifier of the device. |
int rte_eth_dev_get_name_by_port | ( | uint16_t | port_id, |
char * | name | ||
) |
Get the device name from port ID. The device name is specified as below:
port_id | Port identifier of the device. |
name | Buffer of size RTE_ETH_NAME_MAX_LEN to store the name. |
int rte_eth_dev_adjust_nb_rx_tx_desc | ( | uint16_t | port_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.
port_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. |
int rte_eth_dev_pool_ops_supported | ( | uint16_t | port_id, |
const char * | pool | ||
) |
Test if a port supports specific mempool ops.
port_id | Port identifier of the Ethernet device. | |
[in] | pool | The name of the pool operations to test. |
void* rte_eth_dev_get_sec_ctx | ( | uint16_t | port_id | ) |
Get the security context for the Ethernet device.
port_id | Port identifier of the Ethernet device |
__rte_experimental int rte_eth_dev_hairpin_capability_get | ( | uint16_t | port_id, |
struct rte_eth_hairpin_cap * | cap | ||
) |
Query the device hairpin capabilities.
port_id | The port identifier of the Ethernet device. |
cap | Pointer to a structure that will hold the hairpin capabilities. |
__rte_experimental int rte_eth_representor_info_get | ( | uint16_t | port_id, |
struct rte_eth_representor_info * | info | ||
) |
Retrieve the representor info of the device.
Get device representor info to be able to calculate a unique representor ID.
port_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. |
int rte_eth_rx_metadata_negotiate | ( | uint16_t | port_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:
port_id | Port (ethdev) identifier | |
[in,out] | features | Feature selection buffer |
__rte_experimental int rte_eth_ip_reassembly_capability_get | ( | uint16_t | port_id, |
struct rte_eth_ip_reassembly_params * | capa | ||
) |
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.
port_id | The port identifier of the device. |
capa | A pointer to rte_eth_ip_reassembly_params structure. |
__rte_experimental int rte_eth_ip_reassembly_conf_get | ( | uint16_t | port_id, |
struct rte_eth_ip_reassembly_params * | conf | ||
) |
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.
port_id | The port identifier of the device. |
conf | A pointer to rte_eth_ip_reassembly_params structure. |
__rte_experimental int rte_eth_ip_reassembly_conf_set | ( | uint16_t | port_id, |
const struct rte_eth_ip_reassembly_params * | conf | ||
) |
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.
port_id | The port identifier of the device. |
conf | A pointer to rte_eth_ip_reassembly_params structure. |
__rte_experimental int rte_eth_dev_priv_dump | ( | uint16_t | port_id, |
FILE * | file | ||
) |
Dump private info from device to a file. Provided data and the order depends on the PMD.
port_id | The port identifier of the Ethernet device. |
file | A pointer to a file for output. |
__rte_experimental int rte_eth_rx_descriptor_dump | ( | uint16_t | port_id, |
uint16_t | queue_id, | ||
uint16_t | offset, | ||
uint16_t | num, | ||
FILE * | file | ||
) |
Dump ethdev Rx descriptor info to a file.
This API is used for debugging, not a dataplane API.
port_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. |
__rte_experimental int rte_eth_tx_descriptor_dump | ( | uint16_t | port_id, |
uint16_t | queue_id, | ||
uint16_t | offset, | ||
uint16_t | num, | ||
FILE * | file | ||
) |
Dump ethdev Tx descriptor info to a file.
This API is used for debugging, not a dataplane API.
port_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. |
__rte_experimental int rte_eth_cman_info_get | ( | uint16_t | port_id, |
struct rte_eth_cman_info * | info | ||
) |
Retrieve the information for ethdev congestion management
port_id | The port identifier of the Ethernet device. |
info | A pointer to a structure of type rte_eth_cman_info to be filled with the information about congestion management. |
__rte_experimental int rte_eth_cman_config_init | ( | uint16_t | port_id, |
struct rte_eth_cman_config * | config | ||
) |
Initialize the ethdev congestion management configuration structure with default values.
port_id | The port identifier of the Ethernet device. |
config | A pointer to a structure of type rte_eth_cman_config to be initialized with default value. |
__rte_experimental int rte_eth_cman_config_set | ( | uint16_t | port_id, |
const struct rte_eth_cman_config * | config | ||
) |
Configure ethdev congestion management
port_id | The port identifier of the Ethernet device. |
config | A pointer to a structure of type rte_eth_cman_config to be configured. |
__rte_experimental int rte_eth_cman_config_get | ( | uint16_t | port_id, |
struct rte_eth_cman_config * | config | ||
) |
Retrieve the applied ethdev congestion management parameters for the given port.
port_id | The port identifier of the Ethernet device. |
config | A pointer to a structure of type rte_eth_cman_config to retrieve congestion management parameters for the given object. Application must fill all parameters except mode_param parameter in struct rte_eth_cman_config. |
|
inlinestatic |
Retrieve a burst of input packets from a receive queue of an Ethernet device. The retrieved packets are stored in rte_mbuf structures whose pointers are supplied in the rx_pkts array.
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:
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_mbuf buffers to the first buffer of the packet.
The rte_eth_rx_burst() function returns the number of packets actually retrieved, which is the number of rte_mbuf data structures effectively supplied into the rx_pkts array. A return value equal to nb_pkts indicates that the Rx queue contained at least rx_pkts packets, and this is likely to signify that other received packets remain in the input queue. Applications implementing a "retrieve as much received packets as possible" policy can check this specific case and keep invoking the rte_eth_rx_burst() function until a value less than nb_pkts is returned.
This receive method has the following advantages:
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.
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.
port_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_mbuf structures that must be large enough to store nb_pkts pointers in it. |
nb_pkts | The maximum number of packets to retrieve. The value must be divisible by 8 in order to work with any driver. |
Definition at line 6084 of file rte_ethdev.h.
|
inlinestatic |
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.
port_id | The port identifier of the Ethernet device. |
queue_id | The queue ID on the specific port. |
Definition at line 6157 of file rte_ethdev.h.
|
inlinestatic |
Check the status of a Rx descriptor in the queue
It should be called in a similar context than the Rx function:
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.
port_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). |
Definition at line 6229 of file rte_ethdev.h.
|
inlinestatic |
Check the status of a Tx descriptor in the queue.
It should be called in a similar context than the Tx function:
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.
port_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). |
Definition at line 6300 of file rte_ethdev.h.
|
inlinestatic |
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_mbuf structures, each of them allocated from a pool created with rte_pktmbuf_pool_create(). The rte_eth_tx_burst() function loops, sending nb_pkts packets, up to the number of transmit descriptors available in the Tx ring of the transmit queue. For each packet to send, the rte_eth_tx_burst() function performs the following operations:
In the case of a segmented packet composed of a list of rte_mbuf buffers, the rte_eth_tx_burst() function uses several transmit descriptors of the ring.
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_mbuf buffers of those packets whose transmission was effectively completed.
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.
port_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_mbuf structures which contain the output packets. |
nb_pkts | The maximum number of packets to transmit. |
Definition at line 6424 of file rte_ethdev.h.
|
inlinestatic |
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_mbuf structures, each of them allocated from a pool created with rte_pktmbuf_pool_create(). For each packet to send, the rte_eth_tx_prepare() function performs the following operations:
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.
port_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_mbuf structures which contain the output packets. |
nb_pkts | The maximum number of packets to process. |
Definition at line 6534 of file rte_ethdev.h.
|
inlinestatic |
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.
port_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. |
Definition at line 6619 of file rte_ethdev.h.
|
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
port_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. |
Definition at line 6672 of file rte_ethdev.h.
|
inlinestatic |
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:
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.
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.
rx_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_info which contains the information of the Rx queue mbuf ring. |
Definition at line 6737 of file rte_ethdev.h.
__rte_experimental int rte_eth_buffer_split_get_supported_hdr_ptypes | ( | uint16_t | port_id, |
uint32_t * | ptypes, | ||
int | num | ||
) |
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:
port_id | The port identifier of the device. | |
[out] | 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. |
|
inlinestatic |
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.
port_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(). |
Definition at line 6880 of file rte_ethdev.h.