DPDK  19.11.14
Data Structures | Macros | Typedefs | Enumerations | Functions
rte_ethdev.h File Reference
#include <stdint.h>
#include <rte_compat.h>
#include <rte_log.h>
#include <rte_interrupts.h>
#include <rte_dev.h>
#include <rte_devargs.h>
#include <rte_errno.h>
#include <rte_common.h>
#include <rte_config.h>
#include <rte_ether.h>
#include "rte_dev_info.h"
#include "rte_eth_ctrl.h"
#include <rte_ethdev_core.h>

Go to the source code of this file.

Data Structures

struct  rte_eth_stats
 
struct  rte_eth_link
 
struct  rte_eth_thresh
 
struct  rte_eth_rxmode
 
struct  rte_vlan_filter_conf
 
struct  rte_eth_rss_conf
 
struct  rte_eth_vlan_mirror
 
struct  rte_eth_mirror_conf
 
struct  rte_eth_rss_reta_entry64
 
struct  rte_eth_vmdq_dcb_conf
 
struct  rte_eth_vmdq_rx_conf
 
struct  rte_eth_txmode
 
struct  rte_eth_rxconf
 
struct  rte_eth_txconf
 
struct  rte_eth_hairpin_cap
 
struct  rte_eth_hairpin_peer
 
struct  rte_eth_hairpin_conf
 
struct  rte_eth_desc_lim
 
struct  rte_eth_fc_conf
 
struct  rte_eth_pfc_conf
 
struct  rte_fdir_conf
 
struct  rte_eth_udp_tunnel
 
struct  rte_intr_conf
 
struct  rte_eth_conf
 
struct  rte_eth_dev_portconf
 
struct  rte_eth_switch_info
 
struct  rte_eth_dev_info
 
struct  rte_eth_rxq_info
 
struct  rte_eth_txq_info
 
struct  rte_eth_burst_mode
 
struct  rte_eth_xstat
 
struct  rte_eth_xstat_name
 
struct  rte_eth_dcb_tc_queue_mapping
 
struct  rte_eth_dcb_info
 
struct  rte_eth_dev_tx_buffer
 
struct  rte_eth_event_ipsec_desc
 

Macros

#define RTE_ETH_FOREACH_MATCHING_DEV(id, devargs, iter)
 
#define ETH_LINK_SPEED_AUTONEG   (0 << 0)
 
#define ETH_LINK_SPEED_FIXED   (1 << 0)
 
#define ETH_LINK_SPEED_10M_HD   (1 << 1)
 
#define ETH_LINK_SPEED_10M   (1 << 2)
 
#define ETH_LINK_SPEED_100M_HD   (1 << 3)
 
#define ETH_LINK_SPEED_100M   (1 << 4)
 
#define ETH_LINK_SPEED_1G   (1 << 5)
 
#define ETH_LINK_SPEED_2_5G   (1 << 6)
 
#define ETH_LINK_SPEED_5G   (1 << 7)
 
#define ETH_LINK_SPEED_10G   (1 << 8)
 
#define ETH_LINK_SPEED_20G   (1 << 9)
 
#define ETH_LINK_SPEED_25G   (1 << 10)
 
#define ETH_LINK_SPEED_40G   (1 << 11)
 
#define ETH_LINK_SPEED_50G   (1 << 12)
 
#define ETH_LINK_SPEED_56G   (1 << 13)
 
#define ETH_LINK_SPEED_100G   (1 << 14)
 
#define ETH_SPEED_NUM_NONE   0
 
#define ETH_SPEED_NUM_10M   10
 
#define ETH_SPEED_NUM_100M   100
 
#define ETH_SPEED_NUM_1G   1000
 
#define ETH_SPEED_NUM_2_5G   2500
 
#define ETH_SPEED_NUM_5G   5000
 
#define ETH_SPEED_NUM_10G   10000
 
#define ETH_SPEED_NUM_20G   20000
 
#define ETH_SPEED_NUM_25G   25000
 
#define ETH_SPEED_NUM_40G   40000
 
#define ETH_SPEED_NUM_50G   50000
 
#define ETH_SPEED_NUM_56G   56000
 
#define ETH_SPEED_NUM_100G   100000
 
#define ETH_LINK_HALF_DUPLEX   0
 
#define ETH_LINK_FULL_DUPLEX   1
 
#define ETH_LINK_DOWN   0
 
#define ETH_LINK_UP   1
 
#define ETH_LINK_FIXED   0
 
#define ETH_LINK_AUTONEG   1
 
#define ETH_MQ_RX_RSS_FLAG   0x1
 
#define ETH_RSS   ETH_MQ_RX_RSS
 
#define ETH_DCB_NONE   ETH_MQ_TX_NONE
 
#define RTE_ETH_FLOW_PORT   18
 
#define RTE_ETH_FLOW_VXLAN   19
 
#define RTE_ETH_FLOW_GENEVE   20
 
#define RTE_ETH_FLOW_NVGRE   21
 
#define RTE_ETH_FLOW_VXLAN_GPE   22
 
#define RTE_ETH_FLOW_GTPU   23
 
#define ETH_RSS_TUNNEL
 
#define ETH_VMDQ_MAX_VLAN_FILTERS   64
 
#define ETH_DCB_NUM_USER_PRIORITIES   8
 
#define ETH_VMDQ_DCB_NUM_QUEUES   128
 
#define ETH_DCB_NUM_QUEUES   128
 
#define ETH_DCB_PG_SUPPORT   0x00000001
 
#define ETH_DCB_PFC_SUPPORT   0x00000002
 
#define ETH_VLAN_STRIP_OFFLOAD   0x0001
 
#define ETH_VLAN_FILTER_OFFLOAD   0x0002
 
#define ETH_VLAN_EXTEND_OFFLOAD   0x0004
 
#define ETH_QINQ_STRIP_OFFLOAD   0x0008
 
#define ETH_VLAN_STRIP_MASK   0x0001
 
#define ETH_VLAN_FILTER_MASK   0x0002
 
#define ETH_VLAN_EXTEND_MASK   0x0004
 
#define ETH_QINQ_STRIP_MASK   0x0008
 
#define ETH_VLAN_ID_MAX   0x0FFF
 
#define ETH_NUM_RECEIVE_MAC_ADDR   128
 
#define ETH_VMDQ_NUM_UC_HASH_ARRAY   128
 
#define ETH_VMDQ_ACCEPT_UNTAG   0x0001
 
#define ETH_VMDQ_ACCEPT_HASH_MC   0x0002
 
#define ETH_VMDQ_ACCEPT_HASH_UC   0x0004
 
#define ETH_VMDQ_ACCEPT_BROADCAST   0x0008
 
#define ETH_VMDQ_ACCEPT_MULTICAST   0x0010
 
#define ETH_MIRROR_MAX_VLANS   64
 
#define ETH_MIRROR_VIRTUAL_POOL_UP   0x01
 
#define ETH_MIRROR_UPLINK_PORT   0x02
 
#define ETH_MIRROR_DOWNLINK_PORT   0x04
 
#define ETH_MIRROR_VLAN   0x08
 
#define ETH_MIRROR_VIRTUAL_POOL_DOWN   0x10
 
#define DEV_RX_OFFLOAD_VLAN_STRIP   0x00000001
 
#define DEV_TX_OFFLOAD_VLAN_INSERT   0x00000001
 
#define DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM   0x00000080
 
#define DEV_TX_OFFLOAD_VXLAN_TNL_TSO   0x00000200
 
#define DEV_TX_OFFLOAD_GRE_TNL_TSO   0x00000400
 
#define DEV_TX_OFFLOAD_IPIP_TNL_TSO   0x00000800
 
#define DEV_TX_OFFLOAD_GENEVE_TNL_TSO   0x00001000
 
#define DEV_TX_OFFLOAD_MT_LOCKFREE   0x00004000
 
#define DEV_TX_OFFLOAD_MULTI_SEGS   0x00008000
 
#define DEV_TX_OFFLOAD_MBUF_FAST_FREE   0x00010000
 
#define DEV_TX_OFFLOAD_UDP_TNL_TSO   0x00040000
 
#define DEV_TX_OFFLOAD_IP_TNL_TSO   0x00080000
 
#define DEV_TX_OFFLOAD_OUTER_UDP_CKSUM   0x00100000
 
#define RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID   (UINT16_MAX)
 
#define RTE_ETH_BURST_FLAG_PER_QUEUE   (1ULL << 0)
 
#define RTE_ETH_BURST_MODE_INFO_SIZE   1024
 
#define RTE_ETH_XSTATS_NAME_SIZE   64
 
#define ETH_L2_TUNNEL_ENABLE_MASK   0x00000001
 
#define ETH_L2_TUNNEL_INSERTION_MASK   0x00000002
 
#define ETH_L2_TUNNEL_STRIPPING_MASK   0x00000004
 
#define RTE_ETH_DEV_CLOSE_REMOVE   0x0001
 
#define RTE_ETH_DEV_INTR_LSC   0x0002
 
#define RTE_ETH_DEV_BONDED_SLAVE   0x0004
 
#define RTE_ETH_DEV_INTR_RMV   0x0008
 
#define RTE_ETH_DEV_REPRESENTOR   0x0010
 
#define RTE_ETH_DEV_NOLIVE_MAC_ADDR   0x0020
 
#define RTE_ETH_FOREACH_DEV_OWNED_BY(p, o)
 
#define RTE_ETH_FOREACH_DEV(p)   RTE_ETH_FOREACH_DEV_OWNED_BY(p, RTE_ETH_DEV_NO_OWNER)
 
#define RTE_ETH_FOREACH_DEV_OF(port_id, parent)
 
#define RTE_ETH_FOREACH_DEV_SIBLING(port_id, ref_port_id)
 
#define RTE_ETH_TX_BUFFER_SIZE(sz)   (sizeof(struct rte_eth_dev_tx_buffer) + (sz) * sizeof(struct rte_mbuf *))
 
#define RTE_ETH_RX_DESC_AVAIL   0
 
#define RTE_ETH_RX_DESC_DONE   1
 
#define RTE_ETH_RX_DESC_UNAVAIL   2
 
#define RTE_ETH_TX_DESC_FULL   0
 
#define RTE_ETH_TX_DESC_DONE   1
 
#define RTE_ETH_TX_DESC_UNAVAIL   2
 
Device capabilities

Non-offload capabilities reported in rte_eth_dev_info.dev_capa.

#define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP   0x00000001
 
#define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP   0x00000002
 

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)
 

Enumerations

enum  rte_eth_rx_mq_mode {
  ETH_MQ_RX_NONE = 0, ETH_MQ_RX_RSS = ETH_MQ_RX_RSS_FLAG, ETH_MQ_RX_DCB = ETH_MQ_RX_DCB_FLAG, ETH_MQ_RX_DCB_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_DCB_FLAG,
  ETH_MQ_RX_VMDQ_ONLY = ETH_MQ_RX_VMDQ_FLAG, ETH_MQ_RX_VMDQ_RSS = ETH_MQ_RX_RSS_FLAG | ETH_MQ_RX_VMDQ_FLAG, ETH_MQ_RX_VMDQ_DCB = ETH_MQ_RX_VMDQ_FLAG | ETH_MQ_RX_DCB_FLAG, ETH_MQ_RX_VMDQ_DCB_RSS
}
 
enum  rte_eth_tx_mq_mode { ETH_MQ_TX_NONE = 0, ETH_MQ_TX_DCB, ETH_MQ_TX_VMDQ_DCB, ETH_MQ_TX_VMDQ_ONLY }
 
enum  rte_vlan_type { , ETH_VLAN_TYPE_INNER, ETH_VLAN_TYPE_OUTER }
 
enum  rte_eth_nb_tcs { ETH_4_TCS = 4, ETH_8_TCS = 8 }
 
enum  rte_eth_nb_pools { ETH_8_POOLS = 8, ETH_16_POOLS = 16, ETH_32_POOLS = 32, ETH_64_POOLS = 64 }
 
enum  rte_eth_fc_mode { RTE_FC_NONE = 0, RTE_FC_RX_PAUSE, RTE_FC_TX_PAUSE, RTE_FC_FULL }
 
enum  rte_eth_tunnel_type
 
enum  rte_fdir_pballoc_type { RTE_FDIR_PBALLOC_64K = 0, RTE_FDIR_PBALLOC_128K, RTE_FDIR_PBALLOC_256K }
 
enum  rte_fdir_status_mode { RTE_FDIR_NO_REPORT_STATUS = 0, RTE_FDIR_REPORT_STATUS, RTE_FDIR_REPORT_STATUS_ALWAYS }
 
enum  rte_eth_dev_state { RTE_ETH_DEV_UNUSED = 0, RTE_ETH_DEV_ATTACHED, RTE_ETH_DEV_REMOVED }
 
enum  rte_eth_event_ipsec_subtype {
  RTE_ETH_EVENT_IPSEC_UNKNOWN = 0, RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW, RTE_ETH_EVENT_IPSEC_SA_TIME_EXPIRY, RTE_ETH_EVENT_IPSEC_SA_BYTE_EXPIRY,
  RTE_ETH_EVENT_IPSEC_MAX
}
 
enum  rte_eth_event_type {
  RTE_ETH_EVENT_UNKNOWN, RTE_ETH_EVENT_INTR_LSC, RTE_ETH_EVENT_QUEUE_STATE, RTE_ETH_EVENT_INTR_RESET,
  RTE_ETH_EVENT_VF_MBOX, RTE_ETH_EVENT_MACSEC, RTE_ETH_EVENT_INTR_RMV, RTE_ETH_EVENT_NEW,
  RTE_ETH_EVENT_DESTROY, RTE_ETH_EVENT_IPSEC, RTE_ETH_EVENT_MAX
}
 

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)
 
__rte_experimental uint16_t rte_eth_find_next_of (uint16_t port_id_start, const struct rte_device *parent)
 
__rte_experimental uint16_t rte_eth_find_next_sibling (uint16_t port_id_start, uint16_t ref_port_id)
 
__rte_experimental int rte_eth_dev_owner_new (uint64_t *owner_id)
 
__rte_experimental int rte_eth_dev_owner_set (const uint16_t port_id, const struct rte_eth_dev_owner *owner)
 
__rte_experimental int rte_eth_dev_owner_unset (const uint16_t port_id, const uint64_t owner_id)
 
__rte_experimental int rte_eth_dev_owner_delete (const uint64_t owner_id)
 
__rte_experimental 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)
 
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)
 
__rte_experimental 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)
 
int rte_eth_dev_socket_id (uint16_t port_id)
 
int rte_eth_dev_is_valid_port (uint16_t port_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)
 
void 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)
 
void 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)
 
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)
 
int rte_eth_dev_info_get (uint16_t port_id, struct rte_eth_dev_info *dev_info)
 
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)
 
__rte_experimental 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)
 
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)
 
__rte_experimental 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)
 
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)
 
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_mirror_rule_set (uint16_t port_id, struct rte_eth_mirror_conf *mirror_conf, uint8_t rule_id, uint8_t on)
 
int rte_eth_mirror_rule_reset (uint16_t port_id, uint8_t rule_id)
 
int rte_eth_set_queue_rate_limit (uint16_t port_id, uint16_t queue_idx, uint16_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)
 
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)
 
__rte_deprecated int rte_eth_dev_filter_supported (uint16_t port_id, enum rte_filter_type filter_type)
 
__rte_deprecated int rte_eth_dev_filter_ctrl (uint16_t port_id, enum rte_filter_type filter_type, enum rte_filter_op filter_op, void *arg)
 
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_rx_burst_mode_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_burst_mode *mode)
 
__rte_experimental int rte_eth_tx_burst_mode_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_burst_mode *mode)
 
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_l2_tunnel_eth_type_conf (uint16_t port_id, struct rte_eth_l2_tunnel_conf *l2_tunnel)
 
int rte_eth_dev_l2_tunnel_offload_set (uint16_t port_id, struct rte_eth_l2_tunnel_conf *l2_tunnel, uint32_t mask, uint8_t en)
 
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)
 
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_done (uint16_t port_id, uint16_t queue_id, uint16_t offset)
 
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)
 

Detailed Description

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

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.

Macro Definition Documentation

◆ RTE_ETH_FOREACH_MATCHING_DEV

#define RTE_ETH_FOREACH_MATCHING_DEV (   id,
  devargs,
  iter 
)
Value:
for (rte_eth_iterator_init(iter, devargs), \
id = rte_eth_iterator_next(iter); \
id != RTE_MAX_ETHPORTS; \
int rte_eth_iterator_init(struct rte_dev_iterator *iter, const char *devargs)
uint16_t rte_eth_iterator_next(struct rte_dev_iterator *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.

Parameters
idIterated port id of type uint16_t.
devargsDevice parameters input as string of type char*.
iterIterator handle of type struct rte_dev_iterator, used internally.

Definition at line 231 of file rte_ethdev.h.

◆ ETH_LINK_SPEED_AUTONEG

#define ETH_LINK_SPEED_AUTONEG   (0 << 0)

Device supported speeds bitmap flagsAutonegotiate (all speeds)

Definition at line 270 of file rte_ethdev.h.

◆ ETH_LINK_SPEED_FIXED

#define ETH_LINK_SPEED_FIXED   (1 << 0)

Disable autoneg (fixed speed)

Definition at line 271 of file rte_ethdev.h.

◆ ETH_LINK_SPEED_10M_HD

#define ETH_LINK_SPEED_10M_HD   (1 << 1)

10 Mbps half-duplex

Definition at line 272 of file rte_ethdev.h.

◆ ETH_LINK_SPEED_10M

#define ETH_LINK_SPEED_10M   (1 << 2)

10 Mbps full-duplex

Definition at line 273 of file rte_ethdev.h.

◆ ETH_LINK_SPEED_100M_HD

#define ETH_LINK_SPEED_100M_HD   (1 << 3)

100 Mbps half-duplex

Definition at line 274 of file rte_ethdev.h.

◆ ETH_LINK_SPEED_100M

#define ETH_LINK_SPEED_100M   (1 << 4)

100 Mbps full-duplex

Definition at line 275 of file rte_ethdev.h.

◆ ETH_LINK_SPEED_1G

#define ETH_LINK_SPEED_1G   (1 << 5)

1 Gbps

Definition at line 276 of file rte_ethdev.h.

◆ ETH_LINK_SPEED_2_5G

#define ETH_LINK_SPEED_2_5G   (1 << 6)

2.5 Gbps

Definition at line 277 of file rte_ethdev.h.

◆ ETH_LINK_SPEED_5G

#define ETH_LINK_SPEED_5G   (1 << 7)

5 Gbps

Definition at line 278 of file rte_ethdev.h.

◆ ETH_LINK_SPEED_10G

#define ETH_LINK_SPEED_10G   (1 << 8)

10 Gbps

Definition at line 279 of file rte_ethdev.h.

◆ ETH_LINK_SPEED_20G

#define ETH_LINK_SPEED_20G   (1 << 9)

20 Gbps

Definition at line 280 of file rte_ethdev.h.

◆ ETH_LINK_SPEED_25G

#define ETH_LINK_SPEED_25G   (1 << 10)

25 Gbps

Definition at line 281 of file rte_ethdev.h.

◆ ETH_LINK_SPEED_40G

#define ETH_LINK_SPEED_40G   (1 << 11)

40 Gbps

Definition at line 282 of file rte_ethdev.h.

◆ ETH_LINK_SPEED_50G

#define ETH_LINK_SPEED_50G   (1 << 12)

50 Gbps

Definition at line 283 of file rte_ethdev.h.

◆ ETH_LINK_SPEED_56G

#define ETH_LINK_SPEED_56G   (1 << 13)

56 Gbps

Definition at line 284 of file rte_ethdev.h.

◆ ETH_LINK_SPEED_100G

#define ETH_LINK_SPEED_100G   (1 << 14)

100 Gbps

Definition at line 285 of file rte_ethdev.h.

◆ ETH_SPEED_NUM_NONE

#define ETH_SPEED_NUM_NONE   0

Ethernet numeric link speeds in MbpsNot defined

Definition at line 290 of file rte_ethdev.h.

◆ ETH_SPEED_NUM_10M

#define ETH_SPEED_NUM_10M   10

10 Mbps

Definition at line 291 of file rte_ethdev.h.

◆ ETH_SPEED_NUM_100M

#define ETH_SPEED_NUM_100M   100

100 Mbps

Definition at line 292 of file rte_ethdev.h.

◆ ETH_SPEED_NUM_1G

#define ETH_SPEED_NUM_1G   1000

1 Gbps

Definition at line 293 of file rte_ethdev.h.

◆ ETH_SPEED_NUM_2_5G

#define ETH_SPEED_NUM_2_5G   2500

2.5 Gbps

Definition at line 294 of file rte_ethdev.h.

◆ ETH_SPEED_NUM_5G

#define ETH_SPEED_NUM_5G   5000

5 Gbps

Definition at line 295 of file rte_ethdev.h.

◆ ETH_SPEED_NUM_10G

#define ETH_SPEED_NUM_10G   10000

10 Gbps

Definition at line 296 of file rte_ethdev.h.

◆ ETH_SPEED_NUM_20G

#define ETH_SPEED_NUM_20G   20000

20 Gbps

Definition at line 297 of file rte_ethdev.h.

◆ ETH_SPEED_NUM_25G

#define ETH_SPEED_NUM_25G   25000

25 Gbps

Definition at line 298 of file rte_ethdev.h.

◆ ETH_SPEED_NUM_40G

#define ETH_SPEED_NUM_40G   40000

40 Gbps

Definition at line 299 of file rte_ethdev.h.

◆ ETH_SPEED_NUM_50G

#define ETH_SPEED_NUM_50G   50000

50 Gbps

Definition at line 300 of file rte_ethdev.h.

◆ ETH_SPEED_NUM_56G

#define ETH_SPEED_NUM_56G   56000

56 Gbps

Definition at line 301 of file rte_ethdev.h.

◆ ETH_SPEED_NUM_100G

#define ETH_SPEED_NUM_100G   100000

100 Gbps

Definition at line 302 of file rte_ethdev.h.

◆ ETH_LINK_HALF_DUPLEX

#define ETH_LINK_HALF_DUPLEX   0

Half-duplex connection (see link_duplex).

Definition at line 316 of file rte_ethdev.h.

◆ ETH_LINK_FULL_DUPLEX

#define ETH_LINK_FULL_DUPLEX   1

◆ ETH_LINK_DOWN

#define ETH_LINK_DOWN   0

◆ ETH_LINK_UP

#define ETH_LINK_UP   1

Link is up (see link_status).

Examples:
examples/flow_filtering/main.c, and examples/kni/main.c.

Definition at line 319 of file rte_ethdev.h.

◆ ETH_LINK_FIXED

#define ETH_LINK_FIXED   0

No autonegotiation (see link_autoneg).

Definition at line 320 of file rte_ethdev.h.

◆ ETH_LINK_AUTONEG

#define ETH_LINK_AUTONEG   1

Autonegotiated (see link_autoneg).

Definition at line 321 of file rte_ethdev.h.

◆ ETH_MQ_RX_RSS_FLAG

#define ETH_MQ_RX_RSS_FLAG   0x1

Simple flags are used for rte_eth_conf.rxmode.mq_mode.

Definition at line 336 of file rte_ethdev.h.

◆ ETH_RSS

#define ETH_RSS   ETH_MQ_RX_RSS

for rx mq mode backward compatible

Definition at line 369 of file rte_ethdev.h.

◆ ETH_DCB_NONE

#define ETH_DCB_NONE   ETH_MQ_TX_NONE

for tx mq mode backward compatible

Examples:
examples/qos_meter/main.c, and examples/qos_sched/init.c.

Definition at line 387 of file rte_ethdev.h.

◆ RTE_ETH_FLOW_PORT

#define RTE_ETH_FLOW_PORT   18

Consider device port number as a flow differentiator

Definition at line 480 of file rte_ethdev.h.

◆ RTE_ETH_FLOW_VXLAN

#define RTE_ETH_FLOW_VXLAN   19

VXLAN protocol based flow

Definition at line 482 of file rte_ethdev.h.

◆ RTE_ETH_FLOW_GENEVE

#define RTE_ETH_FLOW_GENEVE   20

GENEVE protocol based flow

Definition at line 483 of file rte_ethdev.h.

◆ RTE_ETH_FLOW_NVGRE

#define RTE_ETH_FLOW_NVGRE   21

NVGRE protocol based flow

Definition at line 484 of file rte_ethdev.h.

◆ RTE_ETH_FLOW_VXLAN_GPE

#define RTE_ETH_FLOW_VXLAN_GPE   22

VXLAN-GPE protocol based flow

Definition at line 485 of file rte_ethdev.h.

◆ RTE_ETH_FLOW_GTPU

#define RTE_ETH_FLOW_GTPU   23

GTPU protocol based flow

Definition at line 486 of file rte_ethdev.h.

◆ ETH_RSS_TUNNEL

#define ETH_RSS_TUNNEL
Value:
( \
ETH_RSS_VXLAN | \
ETH_RSS_GENEVE | \
ETH_RSS_NVGRE)

Mask of valid RSS hash protocols

Definition at line 574 of file rte_ethdev.h.

◆ ETH_VMDQ_MAX_VLAN_FILTERS

#define ETH_VMDQ_MAX_VLAN_FILTERS   64

Maximum nb. of VMDQ vlan filters.

Definition at line 614 of file rte_ethdev.h.

◆ ETH_DCB_NUM_USER_PRIORITIES

#define ETH_DCB_NUM_USER_PRIORITIES   8

Maximum nb. of DCB priorities.

Examples:
examples/vmdq_dcb/main.c.

Definition at line 615 of file rte_ethdev.h.

◆ ETH_VMDQ_DCB_NUM_QUEUES

#define ETH_VMDQ_DCB_NUM_QUEUES   128

Maximum nb. of VMDQ DCB queues.

Definition at line 616 of file rte_ethdev.h.

◆ ETH_DCB_NUM_QUEUES

#define ETH_DCB_NUM_QUEUES   128

Maximum nb. of DCB queues.

Definition at line 617 of file rte_ethdev.h.

◆ ETH_DCB_PG_SUPPORT

#define ETH_DCB_PG_SUPPORT   0x00000001

Priority Group(ETS) support.

Definition at line 620 of file rte_ethdev.h.

◆ ETH_DCB_PFC_SUPPORT

#define ETH_DCB_PFC_SUPPORT   0x00000002

Priority Flow Control support.

Definition at line 621 of file rte_ethdev.h.

◆ ETH_VLAN_STRIP_OFFLOAD

#define ETH_VLAN_STRIP_OFFLOAD   0x0001

VLAN Strip On/Off

Definition at line 624 of file rte_ethdev.h.

◆ ETH_VLAN_FILTER_OFFLOAD

#define ETH_VLAN_FILTER_OFFLOAD   0x0002

VLAN Filter On/Off

Definition at line 625 of file rte_ethdev.h.

◆ ETH_VLAN_EXTEND_OFFLOAD

#define ETH_VLAN_EXTEND_OFFLOAD   0x0004

VLAN Extend On/Off

Definition at line 626 of file rte_ethdev.h.

◆ ETH_QINQ_STRIP_OFFLOAD

#define ETH_QINQ_STRIP_OFFLOAD   0x0008

QINQ Strip On/Off

Definition at line 627 of file rte_ethdev.h.

◆ ETH_VLAN_STRIP_MASK

#define ETH_VLAN_STRIP_MASK   0x0001

VLAN Strip setting mask

Definition at line 630 of file rte_ethdev.h.

◆ ETH_VLAN_FILTER_MASK

#define ETH_VLAN_FILTER_MASK   0x0002

VLAN Filter setting mask

Examples:
examples/ethtool/lib/rte_ethtool.c.

Definition at line 631 of file rte_ethdev.h.

◆ ETH_VLAN_EXTEND_MASK

#define ETH_VLAN_EXTEND_MASK   0x0004

VLAN Extend setting mask

Definition at line 632 of file rte_ethdev.h.

◆ ETH_QINQ_STRIP_MASK

#define ETH_QINQ_STRIP_MASK   0x0008

QINQ Strip setting mask

Definition at line 633 of file rte_ethdev.h.

◆ ETH_VLAN_ID_MAX

#define ETH_VLAN_ID_MAX   0x0FFF

VLAN ID is in lower 12 bits

Definition at line 634 of file rte_ethdev.h.

◆ ETH_NUM_RECEIVE_MAC_ADDR

#define ETH_NUM_RECEIVE_MAC_ADDR   128

Maximum nb. of receive mac addr.

Definition at line 637 of file rte_ethdev.h.

◆ ETH_VMDQ_NUM_UC_HASH_ARRAY

#define ETH_VMDQ_NUM_UC_HASH_ARRAY   128

Maximum nb. of UC hash array.

Definition at line 640 of file rte_ethdev.h.

◆ ETH_VMDQ_ACCEPT_UNTAG

#define ETH_VMDQ_ACCEPT_UNTAG   0x0001

accept untagged packets.

Examples:
examples/ethtool/lib/rte_ethtool.c.

Definition at line 643 of file rte_ethdev.h.

◆ ETH_VMDQ_ACCEPT_HASH_MC

#define ETH_VMDQ_ACCEPT_HASH_MC   0x0002

accept packets in multicast table .

Definition at line 644 of file rte_ethdev.h.

◆ ETH_VMDQ_ACCEPT_HASH_UC

#define ETH_VMDQ_ACCEPT_HASH_UC   0x0004

accept packets in unicast table.

Definition at line 645 of file rte_ethdev.h.

◆ ETH_VMDQ_ACCEPT_BROADCAST

#define ETH_VMDQ_ACCEPT_BROADCAST   0x0008

accept broadcast packets.

Examples:
examples/vhost/main.c.

Definition at line 646 of file rte_ethdev.h.

◆ ETH_VMDQ_ACCEPT_MULTICAST

#define ETH_VMDQ_ACCEPT_MULTICAST   0x0010

multicast promiscuous.

Examples:
examples/vhost/main.c.

Definition at line 647 of file rte_ethdev.h.

◆ ETH_MIRROR_MAX_VLANS

#define ETH_MIRROR_MAX_VLANS   64

Maximum nb. of vlan per mirror rule

Definition at line 650 of file rte_ethdev.h.

◆ ETH_MIRROR_VIRTUAL_POOL_UP

#define ETH_MIRROR_VIRTUAL_POOL_UP   0x01

Virtual Pool uplink Mirroring.

Definition at line 652 of file rte_ethdev.h.

◆ ETH_MIRROR_UPLINK_PORT

#define ETH_MIRROR_UPLINK_PORT   0x02

Uplink Port Mirroring.

Definition at line 653 of file rte_ethdev.h.

◆ ETH_MIRROR_DOWNLINK_PORT

#define ETH_MIRROR_DOWNLINK_PORT   0x04

Downlink Port Mirroring.

Definition at line 654 of file rte_ethdev.h.

◆ ETH_MIRROR_VLAN

#define ETH_MIRROR_VLAN   0x08

VLAN Mirroring.

Definition at line 655 of file rte_ethdev.h.

◆ ETH_MIRROR_VIRTUAL_POOL_DOWN

#define ETH_MIRROR_VIRTUAL_POOL_DOWN   0x10

Virtual Pool downlink Mirroring.

Definition at line 656 of file rte_ethdev.h.

◆ DEV_RX_OFFLOAD_VLAN_STRIP

#define DEV_RX_OFFLOAD_VLAN_STRIP   0x00000001

RX offload capabilities of a device.

Examples:
examples/vhost/main.c.

Definition at line 1087 of file rte_ethdev.h.

◆ DEV_TX_OFFLOAD_VLAN_INSERT

#define DEV_TX_OFFLOAD_VLAN_INSERT   0x00000001

TX offload capabilities of a device.

Examples:
examples/flow_filtering/main.c, and examples/vhost/main.c.

Definition at line 1123 of file rte_ethdev.h.

◆ DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM

#define DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM   0x00000080

Used for tunneling packet.

Examples:
examples/tep_termination/vxlan_setup.c.

Definition at line 1130 of file rte_ethdev.h.

◆ DEV_TX_OFFLOAD_VXLAN_TNL_TSO

#define DEV_TX_OFFLOAD_VXLAN_TNL_TSO   0x00000200

Used for tunneling packet.

Examples:
examples/tep_termination/vxlan_setup.c.

Definition at line 1132 of file rte_ethdev.h.

◆ DEV_TX_OFFLOAD_GRE_TNL_TSO

#define DEV_TX_OFFLOAD_GRE_TNL_TSO   0x00000400

Used for tunneling packet.

Definition at line 1133 of file rte_ethdev.h.

◆ DEV_TX_OFFLOAD_IPIP_TNL_TSO

#define DEV_TX_OFFLOAD_IPIP_TNL_TSO   0x00000800

Used for tunneling packet.

Definition at line 1134 of file rte_ethdev.h.

◆ DEV_TX_OFFLOAD_GENEVE_TNL_TSO

#define DEV_TX_OFFLOAD_GENEVE_TNL_TSO   0x00001000

Used for tunneling packet.

Definition at line 1135 of file rte_ethdev.h.

◆ DEV_TX_OFFLOAD_MT_LOCKFREE

#define DEV_TX_OFFLOAD_MT_LOCKFREE   0x00004000

Multiple threads can invoke rte_eth_tx_burst() concurrently on the same tx queue without SW lock.

Definition at line 1137 of file rte_ethdev.h.

◆ DEV_TX_OFFLOAD_MULTI_SEGS

#define DEV_TX_OFFLOAD_MULTI_SEGS   0x00008000

◆ DEV_TX_OFFLOAD_MBUF_FAST_FREE

#define DEV_TX_OFFLOAD_MBUF_FAST_FREE   0x00010000

◆ DEV_TX_OFFLOAD_UDP_TNL_TSO

#define DEV_TX_OFFLOAD_UDP_TNL_TSO   0x00040000

Device supports generic UDP tunneled packet TSO. Application must set PKT_TX_TUNNEL_UDP and other mbuf fields required for tunnel TSO.

Definition at line 1154 of file rte_ethdev.h.

◆ DEV_TX_OFFLOAD_IP_TNL_TSO

#define DEV_TX_OFFLOAD_IP_TNL_TSO   0x00080000

Device supports generic IP tunneled packet TSO. Application must set PKT_TX_TUNNEL_IP and other mbuf fields required for tunnel TSO.

Definition at line 1160 of file rte_ethdev.h.

◆ DEV_TX_OFFLOAD_OUTER_UDP_CKSUM

#define DEV_TX_OFFLOAD_OUTER_UDP_CKSUM   0x00100000

Device supports outer UDP checksum

Definition at line 1162 of file rte_ethdev.h.

◆ RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP

#define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP   0x00000001

Device supports Rx queue setup after device started.

Definition at line 1172 of file rte_ethdev.h.

◆ RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP

#define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP   0x00000002

Device supports Tx queue setup after device started.

Definition at line 1174 of file rte_ethdev.h.

◆ RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID

#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 1202 of file rte_ethdev.h.

◆ RTE_ETH_BURST_FLAG_PER_QUEUE

#define RTE_ETH_BURST_FLAG_PER_QUEUE   (1ULL << 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 1315 of file rte_ethdev.h.

◆ RTE_ETH_BURST_MODE_INFO_SIZE

#define RTE_ETH_BURST_MODE_INFO_SIZE   1024

Maximum size for information

Definition at line 1324 of file rte_ethdev.h.

◆ RTE_ETH_XSTATS_NAME_SIZE

#define RTE_ETH_XSTATS_NAME_SIZE   64

Maximum name length for extended statistics counters

Examples:
examples/l3fwd-power/main.c.

Definition at line 1329 of file rte_ethdev.h.

◆ ETH_L2_TUNNEL_ENABLE_MASK

#define ETH_L2_TUNNEL_ENABLE_MASK   0x00000001

l2 tunnel configuration.< l2 tunnel enable mask l2 tunnel insertion mask

Definition at line 1410 of file rte_ethdev.h.

◆ ETH_L2_TUNNEL_INSERTION_MASK

#define ETH_L2_TUNNEL_INSERTION_MASK   0x00000002

l2 tunnel stripping mask

Definition at line 1412 of file rte_ethdev.h.

◆ ETH_L2_TUNNEL_STRIPPING_MASK

#define ETH_L2_TUNNEL_STRIPPING_MASK   0x00000004

l2 tunnel forwarding mask

Definition at line 1414 of file rte_ethdev.h.

◆ RTE_ETH_DEV_CLOSE_REMOVE

#define RTE_ETH_DEV_CLOSE_REMOVE   0x0001

Port is released (i.e. totally freed and data erased) on close. Temporary flag for PMD migration to new rte_eth_dev_close() behaviour.

Definition at line 1502 of file rte_ethdev.h.

◆ RTE_ETH_DEV_INTR_LSC

#define RTE_ETH_DEV_INTR_LSC   0x0002

Device supports link state interrupt

Definition at line 1504 of file rte_ethdev.h.

◆ RTE_ETH_DEV_BONDED_SLAVE

#define RTE_ETH_DEV_BONDED_SLAVE   0x0004

Device is a bonded slave

Definition at line 1506 of file rte_ethdev.h.

◆ RTE_ETH_DEV_INTR_RMV

#define RTE_ETH_DEV_INTR_RMV   0x0008

Device supports device removal interrupt

Definition at line 1508 of file rte_ethdev.h.

◆ RTE_ETH_DEV_REPRESENTOR

#define RTE_ETH_DEV_REPRESENTOR   0x0010

Device is port representor

Definition at line 1510 of file rte_ethdev.h.

◆ RTE_ETH_DEV_NOLIVE_MAC_ADDR

#define RTE_ETH_DEV_NOLIVE_MAC_ADDR   0x0020

Device does not support MAC change after started

Definition at line 1512 of file rte_ethdev.h.

◆ RTE_ETH_FOREACH_DEV_OWNED_BY

#define RTE_ETH_FOREACH_DEV_OWNED_BY (   p,
 
)
Value:
for (p = rte_eth_find_next_owned_by(0, o); \
(unsigned int)p < (unsigned int)RTE_MAX_ETHPORTS; \
uint64_t rte_eth_find_next_owned_by(uint16_t port_id, const uint64_t owner_id)

Macro to iterate over all enabled ethdev ports owned by a specific owner.

Definition at line 1531 of file rte_ethdev.h.

◆ RTE_ETH_FOREACH_DEV

#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.

Examples:
examples/bond/main.c, examples/distributor/main.c, examples/ethtool/ethtool-app/ethapp.c, examples/eventdev_pipeline/main.c, examples/eventdev_pipeline/pipeline_worker_generic.c, examples/eventdev_pipeline/pipeline_worker_tx.c, examples/flow_classify/flow_classify.c, examples/ioat/ioatfwd.c, examples/ip_fragmentation/main.c, examples/ip_reassembly/main.c, examples/ipsec-secgw/ipsec-secgw.c, examples/ipv4_multicast/main.c, examples/kni/main.c, examples/l2fwd-cat/l2fwd-cat.c, examples/l2fwd-crypto/main.c, examples/l2fwd-event/l2fwd_common.c, examples/l2fwd-event/l2fwd_event.c, examples/l2fwd-event/l2fwd_event_generic.c, examples/l2fwd-event/l2fwd_event_internal_port.c, examples/l2fwd-event/l2fwd_poll.c, examples/l2fwd-event/main.c, examples/l2fwd-jobstats/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, examples/l3fwd-acl/main.c, examples/l3fwd-power/main.c, examples/l3fwd/main.c, examples/multi_process/client_server_mp/mp_server/args.c, examples/multi_process/client_server_mp/mp_server/main.c, examples/multi_process/hotplug_mp/commands.c, examples/multi_process/symmetric_mp/main.c, examples/packet_ordering/main.c, examples/performance-thread/l3fwd-thread/main.c, examples/ptpclient/ptpclient.c, examples/rxtx_callbacks/main.c, examples/skeleton/basicfwd.c, examples/tep_termination/main.c, examples/vhost/main.c, examples/vm_power_manager/channel_monitor.c, examples/vm_power_manager/main.c, examples/vmdq/main.c, and examples/vmdq_dcb/main.c.

Definition at line 1549 of file rte_ethdev.h.

◆ RTE_ETH_FOREACH_DEV_OF

#define RTE_ETH_FOREACH_DEV_OF (   port_id,
  parent 
)
Value:
for (port_id = rte_eth_find_next_of(0, parent); \
port_id < RTE_MAX_ETHPORTS; \
port_id = rte_eth_find_next_of(port_id + 1, parent))
__rte_experimental uint16_t rte_eth_find_next_of(uint16_t port_id_start, const struct rte_device *parent)

Macro to iterate over all ethdev ports of a specified device.

Parameters
port_idThe id of the matching port being iterated.
parentThe rte_device pointer matching the iterated ports.

Definition at line 1579 of file rte_ethdev.h.

◆ RTE_ETH_FOREACH_DEV_SIBLING

#define RTE_ETH_FOREACH_DEV_SIBLING (   port_id,
  ref_port_id 
)
Value:
for (port_id = rte_eth_find_next_sibling(0, ref_port_id); \
port_id < RTE_MAX_ETHPORTS; \
port_id = rte_eth_find_next_sibling(port_id + 1, ref_port_id))
__rte_experimental uint16_t rte_eth_find_next_sibling(uint16_t port_id_start, uint16_t 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.

Parameters
port_idThe id of the matching port being iterated.
ref_port_idThe id of the port being compared.

Definition at line 1613 of file rte_ethdev.h.

◆ RTE_ETH_TX_BUFFER_SIZE

#define RTE_ETH_TX_BUFFER_SIZE (   sz)    (sizeof(struct rte_eth_dev_tx_buffer) + (sz) * sizeof(struct rte_mbuf *))

◆ RTE_ETH_RX_DESC_AVAIL

#define RTE_ETH_RX_DESC_AVAIL   0

Desc available for hw.

Definition at line 4487 of file rte_ethdev.h.

◆ RTE_ETH_RX_DESC_DONE

#define RTE_ETH_RX_DESC_DONE   1

Desc done, filled by hw.

Definition at line 4488 of file rte_ethdev.h.

◆ RTE_ETH_RX_DESC_UNAVAIL

#define RTE_ETH_RX_DESC_UNAVAIL   2

Desc used by driver or hw.

Definition at line 4489 of file rte_ethdev.h.

◆ RTE_ETH_TX_DESC_FULL

#define RTE_ETH_TX_DESC_FULL   0

Desc filled for hw, waiting xmit.

Definition at line 4545 of file rte_ethdev.h.

◆ RTE_ETH_TX_DESC_DONE

#define RTE_ETH_TX_DESC_DONE   1

Desc done, packet is transmitted.

Definition at line 4546 of file rte_ethdev.h.

◆ RTE_ETH_TX_DESC_UNAVAIL

#define RTE_ETH_TX_DESC_UNAVAIL   2

Desc used by driver or hw.

Definition at line 4547 of file rte_ethdev.h.

Typedef Documentation

◆ rte_rx_callback_fn

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.

Parameters
port_idThe Ethernet port on which RX is being performed.
queueThe queue on the Ethernet port which is being used to receive the packets.
pktsThe burst of packets that have just been received.
nb_pktsThe number of packets in the burst pointed to by "pkts".
max_pktsThe max number of packets that can be stored in the "pkts" array.
user_paramThe arbitrary user parameter passed in by the application when the callback was originally configured.
Returns
The number of packets returned to the user.
Examples:
examples/l3fwd/main.c.

Definition at line 1440 of file rte_ethdev.h.

◆ rte_tx_callback_fn

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.

Parameters
port_idThe Ethernet port on which TX is being performed.
queueThe queue on the Ethernet port which is being used to transmit the packets.
pktsThe burst of packets that are about to be transmitted.
nb_pktsThe number of packets in the burst pointed to by "pkts".
user_paramThe arbitrary user parameter passed in by the application when the callback was originally configured.
Returns
The number of packets to be written to the NIC.

Definition at line 1464 of file rte_ethdev.h.

◆ rte_eth_dev_cb_fn

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

Definition at line 3031 of file rte_ethdev.h.

Enumeration Type Documentation

◆ rte_eth_rx_mq_mode

A set of values to identify what method is to be used to route packets to multiple queues.

Enumerator
ETH_MQ_RX_NONE 

None of DCB,RSS or VMDQ mode

ETH_MQ_RX_RSS 

For RX side, only RSS is on

ETH_MQ_RX_DCB 

For RX side,only DCB is on.

ETH_MQ_RX_DCB_RSS 

Both DCB and RSS enable

ETH_MQ_RX_VMDQ_ONLY 

Only VMDQ, no RSS nor DCB

ETH_MQ_RX_VMDQ_RSS 

RSS mode with VMDQ

ETH_MQ_RX_VMDQ_DCB 

Use VMDQ+DCB to route traffic to queues

ETH_MQ_RX_VMDQ_DCB_RSS 

Enable both VMDQ and DCB in VMDq

Definition at line 344 of file rte_ethdev.h.

◆ rte_eth_tx_mq_mode

A set of values to identify what method is to be used to transmit packets using multi-TCs.

Enumerator
ETH_MQ_TX_NONE 

It is in neither DCB nor VT mode.

ETH_MQ_TX_DCB 

For TX side,only DCB is on.

ETH_MQ_TX_VMDQ_DCB 

For TX side,both DCB and VT is on.

ETH_MQ_TX_VMDQ_ONLY 

Only VT on, no DCB

Definition at line 377 of file rte_ethdev.h.

◆ 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
ETH_VLAN_TYPE_INNER 

Inner VLAN.

ETH_VLAN_TYPE_OUTER 

Single VLAN, or outer VLAN.

Definition at line 416 of file rte_ethdev.h.

◆ rte_eth_nb_tcs

This enum indicates the possible number of traffic classes in DCB configurations

Enumerator
ETH_4_TCS 

4 TCs with DCB.

ETH_8_TCS 

8 TCs with DCB.

Examples:
examples/vmdq_dcb/main.c.

Definition at line 695 of file rte_ethdev.h.

◆ rte_eth_nb_pools

This enum indicates the possible number of queue pools in VMDQ configurations.

Enumerator
ETH_8_POOLS 

8 VMDq pools.

ETH_16_POOLS 

16 VMDq pools.

ETH_32_POOLS 

32 VMDq pools.

ETH_64_POOLS 

64 VMDq pools.

Examples:
examples/vhost/main.c, examples/vmdq/main.c, and examples/vmdq_dcb/main.c.

Definition at line 704 of file rte_ethdev.h.

◆ rte_eth_fc_mode

This enum indicates the flow control mode

Enumerator
RTE_FC_NONE 

Disable flow control.

RTE_FC_RX_PAUSE 

RX pause frame, enable flowctrl on TX side.

RTE_FC_TX_PAUSE 

TX pause frame, enable flowctrl on RX side.

RTE_FC_FULL 

Enable flow control on both side.

Definition at line 930 of file rte_ethdev.h.

◆ rte_eth_tunnel_type

Tunneled type.

Definition at line 965 of file rte_ethdev.h.

◆ rte_fdir_pballoc_type

Memory space that can be configured to store Flow Director filters in the board memory.

Enumerator
RTE_FDIR_PBALLOC_64K 

64k.

RTE_FDIR_PBALLOC_128K 

128k.

RTE_FDIR_PBALLOC_256K 

256k.

Definition at line 984 of file rte_ethdev.h.

◆ rte_fdir_status_mode

Select report mode of FDIR hash information in RX descriptors.

Enumerator
RTE_FDIR_NO_REPORT_STATUS 

Never report FDIR hash.

RTE_FDIR_REPORT_STATUS 

Only report FDIR hash for matching pkts.

RTE_FDIR_REPORT_STATUS_ALWAYS 

Always report FDIR hash.

Definition at line 993 of file rte_ethdev.h.

◆ rte_eth_dev_state

Possible states of an ethdev port.

Enumerator
RTE_ETH_DEV_UNUSED 

Device is unused before being probed.

RTE_ETH_DEV_ATTACHED 

Device is attached when allocated in probing.

RTE_ETH_DEV_REMOVED 

Device is in removed state when plug-out is detected.

Definition at line 1470 of file rte_ethdev.h.

◆ rte_eth_event_ipsec_subtype

Subtypes for IPsec offload event(RTE_ETH_EVENT_IPSEC) raised by eth device.

Enumerator
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

RTE_ETH_EVENT_IPSEC_MAX 

Max value of this enum

Definition at line 2976 of file rte_ethdev.h.

◆ 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_MAX 

max value of this enum

Definition at line 3015 of file rte_ethdev.h.

Function Documentation

◆ rte_eth_iterator_init()

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.

Parameters
iterDevice 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().
devargsDevice description string.
Returns
0 on successful initialization, negative otherwise.

◆ rte_eth_iterator_next()

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.

Parameters
iterDevice iterator handle initialized by rte_eth_iterator_init(). Some fields bus_str and cls_str might be freed when no more port is found, by calling rte_eth_iterator_cleanup().
Returns
A port id if found, RTE_MAX_ETHPORTS otherwise.

◆ 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.

Parameters
iterDevice iterator handle initialized by rte_eth_iterator_init(). The fields bus_str and cls_str are freed if needed.

◆ rte_eth_rss_hf_refine()

static uint64_t rte_eth_rss_hf_refine ( uint64_t  rss_hf)
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.

Parameters
rss_hfRSS types with SRC/DST_ONLY.
Returns
RSS types.

Definition at line 540 of file rte_ethdev.h.

◆ rte_eth_find_next_owned_by()

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.

Parameters
port_idThe id of the next possible valid owned port.
owner_idThe owner identifier. RTE_ETH_DEV_NO_OWNER means iterate over all valid ownerless ports.
Returns
Next valid port id owned by owner_id, RTE_MAX_ETHPORTS if there is none.

◆ rte_eth_find_next()

uint16_t rte_eth_find_next ( uint16_t  port_id)

Iterates over valid ethdev ports.

Parameters
port_idThe id of the next possible valid port.
Returns
Next valid port id, RTE_MAX_ETHPORTS if there is none.
Examples:
examples/ntb/ntb_fwd.c.

◆ rte_eth_find_next_of()

__rte_experimental uint16_t rte_eth_find_next_of ( uint16_t  port_id_start,
const struct rte_device parent 
)
Warning
EXPERIMENTAL: this API may change without prior notice.

Iterates over ethdev ports of a specified device.

Parameters
port_id_startThe id of the next possible valid port.
parentThe generic device behind the ports to iterate.
Returns
Next port id of the device, possibly port_id_start, RTE_MAX_ETHPORTS if there is none.

◆ rte_eth_find_next_sibling()

__rte_experimental uint16_t rte_eth_find_next_sibling ( uint16_t  port_id_start,
uint16_t  ref_port_id 
)
Warning
EXPERIMENTAL: this API may change without prior notice.

Iterates over sibling ethdev ports (i.e. sharing the same rte_device).

Parameters
port_id_startThe id of the next possible valid sibling port.
ref_port_idThe id of a reference port to compare rte_device with.
Returns
Next sibling port id, possibly port_id_start or ref_port_id itself, RTE_MAX_ETHPORTS if there is none.

◆ rte_eth_dev_owner_new()

__rte_experimental int rte_eth_dev_owner_new ( uint64_t *  owner_id)
Warning
EXPERIMENTAL: this API may change without prior notice.

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.

Parameters
owner_idOwner identifier pointer.
Returns
Negative errno value on error, 0 on success.

◆ rte_eth_dev_owner_set()

__rte_experimental int rte_eth_dev_owner_set ( const uint16_t  port_id,
const struct rte_eth_dev_owner *  owner 
)
Warning
EXPERIMENTAL: this API may change without prior notice.

Set an Ethernet device owner.

Parameters
port_idThe identifier of the port to own.
ownerThe owner pointer.
Returns
Negative errno value on error, 0 on success.

◆ rte_eth_dev_owner_unset()

__rte_experimental int rte_eth_dev_owner_unset ( const uint16_t  port_id,
const uint64_t  owner_id 
)
Warning
EXPERIMENTAL: this API may change without prior notice.

Unset Ethernet device owner to make the device ownerless.

Parameters
port_idThe identifier of port to make ownerless.
owner_idThe owner identifier.
Returns
0 on success, negative errno value on error.

◆ rte_eth_dev_owner_delete()

__rte_experimental int rte_eth_dev_owner_delete ( const uint64_t  owner_id)
Warning
EXPERIMENTAL: this API may change without prior notice.

Remove owner from all Ethernet devices owned by a specific owner.

Parameters
owner_idThe owner identifier.
Returns
0 on success, negative errno value on error.

◆ rte_eth_dev_owner_get()

__rte_experimental int rte_eth_dev_owner_get ( const uint16_t  port_id,
struct rte_eth_dev_owner *  owner 
)
Warning
EXPERIMENTAL: this API may change without prior notice.

Get the owner of an Ethernet device.

Parameters
port_idThe port identifier.
ownerThe owner structure pointer to fill.
Returns
0 on success, negative errno value on error..

◆ rte_eth_dev_count_avail()

uint16_t rte_eth_dev_count_avail ( void  )

◆ rte_eth_dev_count_total()

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.

Returns
The total count of Ethernet devices.

◆ rte_eth_speed_bitflag()

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

Parameters
speedNumerical speed value in Mbps
duplexETH_LINK_[HALF/FULL]_DUPLEX (only for 10/100M speeds)
Returns
0 if the speed cannot be mapped

◆ rte_eth_dev_rx_offload_name()

const char* rte_eth_dev_rx_offload_name ( uint64_t  offload)

Get DEV_RX_OFFLOAD_* flag name.

Parameters
offloadOffload flag.
Returns
Offload name or 'UNKNOWN' if the flag cannot be recognised.

◆ rte_eth_dev_tx_offload_name()

const char* rte_eth_dev_tx_offload_name ( uint64_t  offload)

Get DEV_TX_OFFLOAD_* flag name.

Parameters
offloadOffload flag.
Returns
Offload name or 'UNKNOWN' if the flag cannot be recognised.

◆ rte_eth_dev_configure()

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.

Parameters
port_idThe port identifier of the Ethernet device to configure.
nb_rx_queueThe number of receive queues to set up for the Ethernet device.
nb_tx_queueThe number of transmit queues to set up for the Ethernet device.
eth_confThe pointer to the configuration data to be used for the Ethernet device. The rte_eth_conf structure includes:
  • the hardware offload features to activate, with dedicated fields for each statically configurable offload hardware feature provided by Ethernet devices, such as IP checksum or VLAN tag stripping for example. The Rx offload bitfield API is obsolete and will be deprecated. Applications should set the ignore_bitfield_offloads bit on rxmode structure and use offloads field to set per-port offloads instead.
  • Any offloading set in eth_conf->[rt]xmode.offloads must be within the [rt]x_offload_capa returned from rte_eth_dev_info_get(). Any type of device supported offloading set in the input argument eth_conf->[rt]xmode.offloads to rte_eth_dev_configure() is enabled on all queues and it can't be disabled in rte_eth_[rt]x_queue_setup()
  • the Receive Side Scaling (RSS) configuration when using multiple RX queues per port. Any RSS hash function set in eth_conf->rss_conf.rss_hf must be within the flow_type_rss_offloads provided by drivers via rte_eth_dev_info_get() API.

Embedding all configuration information in a single data structure is the more flexible method that allows the addition of new features without changing the syntax of the API.

Returns
  • 0: Success, device configured.
  • <0: Error code returned by the driver configuration function.
Examples:
examples/bbdev_app/main.c, examples/bond/main.c, examples/distributor/main.c, examples/ethtool/ethtool-app/main.c, examples/eventdev_pipeline/pipeline_worker_generic.c, examples/eventdev_pipeline/pipeline_worker_tx.c, examples/flow_classify/flow_classify.c, examples/flow_filtering/main.c, examples/ioat/ioatfwd.c, examples/ip_fragmentation/main.c, examples/ip_pipeline/link.c, examples/ip_reassembly/main.c, examples/ipsec-secgw/ipsec-secgw.c, examples/ipv4_multicast/main.c, examples/kni/main.c, examples/l2fwd-cat/l2fwd-cat.c, examples/l2fwd-crypto/main.c, examples/l2fwd-event/l2fwd_common.c, examples/l2fwd-jobstats/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, examples/l3fwd-acl/main.c, examples/l3fwd-power/main.c, examples/l3fwd/main.c, examples/link_status_interrupt/main.c, examples/multi_process/client_server_mp/mp_server/init.c, examples/multi_process/symmetric_mp/main.c, examples/ntb/ntb_fwd.c, examples/packet_ordering/main.c, examples/performance-thread/l3fwd-thread/main.c, examples/ptpclient/ptpclient.c, examples/qos_meter/main.c, examples/qos_sched/init.c, examples/rxtx_callbacks/main.c, examples/server_node_efd/server/init.c, examples/skeleton/basicfwd.c, examples/tep_termination/vxlan_setup.c, examples/vhost/main.c, examples/vm_power_manager/main.c, examples/vmdq/main.c, and examples/vmdq_dcb/main.c.

◆ rte_eth_dev_is_removed()

__rte_experimental int rte_eth_dev_is_removed ( uint16_t  port_id)
Warning
EXPERIMENTAL: this API may change without prior notice.

Check if an Ethernet device was physically removed.

Parameters
port_idThe port identifier of the Ethernet device.
Returns
1 when the Ethernet device is removed, otherwise 0.

◆ rte_eth_rx_queue_setup()

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.

Parameters
port_idThe port identifier of the Ethernet device.
rx_queue_idThe 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_descThe number of receive descriptors to allocate for the receive ring.
socket_idThe 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_confThe 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 DEV_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.
mb_poolThe pointer to the memory pool from which to allocate rte_mbuf network memory buffers to populate each descriptor of the receive ring.
Returns
  • 0: Success, receive queue correctly set up.
  • -EIO: if device is removed.
  • -EINVAL: The memory pool pointer is null or the size of network buffers which can be allocated from this memory pool does not fit the various buffer sizes allowed by the device controller.
  • -ENOMEM: Unable to allocate the receive ring descriptors or to allocate network memory buffers from the memory pool when initializing receive descriptors.
Examples:
examples/bbdev_app/main.c, examples/bond/main.c, examples/distributor/main.c, examples/ethtool/ethtool-app/main.c, examples/ethtool/lib/rte_ethtool.c, examples/eventdev_pipeline/pipeline_worker_generic.c, examples/eventdev_pipeline/pipeline_worker_tx.c, examples/flow_classify/flow_classify.c, examples/flow_filtering/main.c, examples/ioat/ioatfwd.c, examples/ip_fragmentation/main.c, examples/ip_pipeline/link.c, examples/ip_reassembly/main.c, examples/ipsec-secgw/ipsec-secgw.c, examples/ipv4_multicast/main.c, examples/kni/main.c, examples/l2fwd-cat/l2fwd-cat.c, examples/l2fwd-crypto/main.c, examples/l2fwd-event/l2fwd_common.c, examples/l2fwd-jobstats/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, examples/l3fwd-acl/main.c, examples/l3fwd-power/main.c, examples/l3fwd/main.c, examples/link_status_interrupt/main.c, examples/multi_process/client_server_mp/mp_server/init.c, examples/multi_process/symmetric_mp/main.c, examples/ntb/ntb_fwd.c, examples/packet_ordering/main.c, examples/performance-thread/l3fwd-thread/main.c, examples/ptpclient/ptpclient.c, examples/qos_meter/main.c, examples/qos_sched/init.c, examples/rxtx_callbacks/main.c, examples/server_node_efd/server/init.c, examples/skeleton/basicfwd.c, examples/tep_termination/vxlan_setup.c, examples/vhost/main.c, examples/vm_power_manager/main.c, examples/vmdq/main.c, and examples/vmdq_dcb/main.c.

◆ rte_eth_rx_hairpin_queue_setup()

__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 
)
Warning
EXPERIMENTAL: this API may change, or be removed, without prior notice

Allocate and set up a hairpin receive queue for an Ethernet device.

The function set up the selected queue to be used in hairpin.

Parameters
port_idThe port identifier of the Ethernet device.
rx_queue_idThe 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_descThe number of receive descriptors to allocate for the receive ring. 0 means the PMD will use default value.
confThe pointer to the hairpin configuration.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
  • (-ENOMEM) if unable to allocate the resources.

◆ rte_eth_tx_queue_setup()

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.

Parameters
port_idThe port identifier of the Ethernet device.
tx_queue_idThe 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_descThe number of transmit descriptors to allocate for the transmit ring.
socket_idThe 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_confThe pointer to the configuration data to be used for the transmit queue. NULL value is allowed, in which case default TX configuration will be used. The tx_conf structure contains the following data:
  • The tx_thresh structure with the values of the Prefetch, Host, and Write-Back threshold registers of the transmit ring. When setting Write-Back threshold to the value greater then zero, tx_rs_thresh value should be explicitly set to one.
  • The tx_free_thresh value indicates the [minimum] number of network buffers that must be pending in the transmit ring to trigger their [implicit] freeing by the driver transmit function.
  • The tx_rs_thresh value indicates the [minimum] number of transmit descriptors that must be pending in the transmit ring before setting the RS bit on a descriptor by the driver transmit function. The tx_rs_thresh value should be less or equal then tx_free_thresh value, and both of them should be less then nb_tx_desc - 3.
  • The offloads member contains Tx offloads to be enabled. If an offloading set in tx_conf->offloads hasn't been set in the input argument eth_conf->txmode.offloads to rte_eth_dev_configure(), it is a new added offloading, it must be per-queue type and it is enabled for the queue. No need to repeat any bit in tx_conf->offloads which has already been enabled in rte_eth_dev_configure() at port level. An offloading enabled at port level can't be disabled at queue level.

    Note that setting tx_free_thresh or tx_rs_thresh value to 0 forces the transmit function to use default values.

Returns
  • 0: Success, the transmit queue is correctly set up.
  • -ENOMEM: Unable to allocate the transmit ring descriptors.
Examples:
examples/bbdev_app/main.c, examples/bond/main.c, examples/distributor/main.c, examples/ethtool/ethtool-app/main.c, examples/ethtool/lib/rte_ethtool.c, examples/eventdev_pipeline/pipeline_worker_generic.c, examples/eventdev_pipeline/pipeline_worker_tx.c, examples/flow_classify/flow_classify.c, examples/flow_filtering/main.c, examples/ioat/ioatfwd.c, examples/ip_fragmentation/main.c, examples/ip_pipeline/link.c, examples/ip_reassembly/main.c, examples/ipsec-secgw/ipsec-secgw.c, examples/ipv4_multicast/main.c, examples/kni/main.c, examples/l2fwd-cat/l2fwd-cat.c, examples/l2fwd-crypto/main.c, examples/l2fwd-event/l2fwd_common.c, examples/l2fwd-jobstats/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, examples/l3fwd-acl/main.c, examples/l3fwd-power/main.c, examples/l3fwd/main.c, examples/link_status_interrupt/main.c, examples/multi_process/client_server_mp/mp_server/init.c, examples/multi_process/symmetric_mp/main.c, examples/ntb/ntb_fwd.c, examples/packet_ordering/main.c, examples/performance-thread/l3fwd-thread/main.c, examples/ptpclient/ptpclient.c, examples/qos_meter/main.c, examples/qos_sched/init.c, examples/rxtx_callbacks/main.c, examples/server_node_efd/server/init.c, examples/skeleton/basicfwd.c, examples/tep_termination/vxlan_setup.c, examples/vhost/main.c, examples/vm_power_manager/main.c, examples/vmdq/main.c, and examples/vmdq_dcb/main.c.

◆ rte_eth_tx_hairpin_queue_setup()

__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 
)
Warning
EXPERIMENTAL: this API may change, or be removed, without prior notice

Allocate and set up a transmit hairpin queue for an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
tx_queue_idThe 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_descThe number of transmit descriptors to allocate for the transmit ring. 0 to set default PMD value.
confThe hairpin configuration.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
  • (-ENOMEM) if unable to allocate the resources.

◆ rte_eth_dev_socket_id()

int rte_eth_dev_socket_id ( uint16_t  port_id)

Return the NUMA socket to which an Ethernet device is connected

Parameters
port_idThe port identifier of the Ethernet device
Returns
The NUMA socket id to which the Ethernet device is connected or a default of zero if the socket could not be determined. -1 is returned is the port_id value is out of range.
Examples:
examples/bbdev_app/main.c, examples/bond/main.c, examples/distributor/main.c, examples/ethtool/ethtool-app/main.c, examples/eventdev_pipeline/pipeline_worker_generic.c, examples/eventdev_pipeline/pipeline_worker_tx.c, examples/flow_classify/flow_classify.c, examples/flow_filtering/main.c, examples/ioat/ioatfwd.c, examples/ip_pipeline/link.c, examples/ipv4_multicast/main.c, examples/kni/main.c, examples/l2fwd-cat/l2fwd-cat.c, examples/l2fwd-crypto/main.c, examples/l2fwd-event/l2fwd_common.c, examples/l2fwd-event/l2fwd_poll.c, examples/l2fwd-jobstats/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, examples/l3fwd-acl/main.c, examples/l3fwd-power/main.c, examples/link_status_interrupt/main.c, examples/multi_process/client_server_mp/mp_client/client.c, examples/multi_process/client_server_mp/mp_server/init.c, examples/multi_process/symmetric_mp/main.c, examples/ntb/ntb_fwd.c, examples/packet_ordering/main.c, examples/ptpclient/ptpclient.c, examples/qos_meter/main.c, examples/qos_sched/init.c, examples/rxtx_callbacks/main.c, examples/server_node_efd/node/node.c, examples/server_node_efd/server/init.c, examples/skeleton/basicfwd.c, examples/tep_termination/vxlan_setup.c, examples/vhost/main.c, examples/vm_power_manager/main.c, examples/vmdq/main.c, and examples/vmdq_dcb/main.c.

◆ rte_eth_dev_is_valid_port()

int rte_eth_dev_is_valid_port ( uint16_t  port_id)

◆ rte_eth_dev_rx_queue_start()

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.

Parameters
port_idThe port identifier of the Ethernet device
rx_queue_idThe index of the rx queue to update the ring. The value must be in the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
Returns
  • 0: Success, the receive queue is started.
  • -EINVAL: The port_id or the queue_id out of range or belong to hairpin.
  • -EIO: if device is removed.
  • -ENOTSUP: The function not supported in PMD driver.

◆ rte_eth_dev_rx_queue_stop()

int rte_eth_dev_rx_queue_stop ( uint16_t  port_id,
uint16_t  rx_queue_id 
)

Stop specified RX queue of a port

Parameters
port_idThe port identifier of the Ethernet device
rx_queue_idThe index of the rx queue to update the ring. The value must be in the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
Returns
  • 0: Success, the receive queue is stopped.
  • -EINVAL: The port_id or the queue_id out of range or belong to hairpin.
  • -EIO: if device is removed.
  • -ENOTSUP: The function not supported in PMD driver.

◆ rte_eth_dev_tx_queue_start()

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.

Parameters
port_idThe port identifier of the Ethernet device
tx_queue_idThe index of the tx queue to update the ring. The value must be in the range [0, nb_tx_queue - 1] previously supplied to rte_eth_dev_configure().
Returns
  • 0: Success, the transmit queue is started.
  • -EINVAL: The port_id or the queue_id out of range or belong to hairpin.
  • -EIO: if device is removed.
  • -ENOTSUP: The function not supported in PMD driver.

◆ rte_eth_dev_tx_queue_stop()

int rte_eth_dev_tx_queue_stop ( uint16_t  port_id,
uint16_t  tx_queue_id 
)

Stop specified TX queue of a port

Parameters
port_idThe port identifier of the Ethernet device
tx_queue_idThe index of the tx queue to update the ring. The value must be in the range [0, nb_tx_queue - 1] previously supplied to rte_eth_dev_configure().
Returns
  • 0: Success, the transmit queue is stopped.
  • -EINVAL: The port_id or the queue_id out of range or belong to hairpin.
  • -EIO: if device is removed.
  • -ENOTSUP: The function not supported in PMD driver.

◆ rte_eth_dev_start()

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.

On success, all basic functions exported by the Ethernet API (link status, receive/transmit, and so on) can be invoked.

Parameters
port_idThe port identifier of the Ethernet device.
Returns
  • 0: Success, Ethernet device started.
  • <0: Error code of the driver device start function.
Examples:
examples/bbdev_app/main.c, examples/bond/main.c, examples/distributor/main.c, examples/ethtool/ethtool-app/main.c, examples/ethtool/lib/rte_ethtool.c, examples/eventdev_pipeline/main.c, examples/flow_classify/flow_classify.c, examples/flow_filtering/main.c, examples/ioat/ioatfwd.c, examples/ip_fragmentation/main.c, examples/ip_pipeline/link.c, examples/ip_reassembly/main.c, examples/ipsec-secgw/ipsec-secgw.c, examples/ipv4_multicast/main.c, examples/kni/main.c, examples/l2fwd-cat/l2fwd-cat.c, examples/l2fwd-crypto/main.c, examples/l2fwd-event/main.c, examples/l2fwd-jobstats/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, examples/l3fwd-acl/main.c, examples/l3fwd-power/main.c, examples/l3fwd/main.c, examples/link_status_interrupt/main.c, examples/multi_process/client_server_mp/mp_server/init.c, examples/multi_process/symmetric_mp/main.c, examples/ntb/ntb_fwd.c, examples/packet_ordering/main.c, examples/performance-thread/l3fwd-thread/main.c, examples/ptpclient/ptpclient.c, examples/qos_meter/main.c, examples/qos_sched/init.c, examples/rxtx_callbacks/main.c, examples/server_node_efd/server/init.c, examples/skeleton/basicfwd.c, examples/tep_termination/vxlan_setup.c, examples/vhost/main.c, examples/vm_power_manager/main.c, examples/vmdq/main.c, and examples/vmdq_dcb/main.c.

◆ rte_eth_dev_stop()

void rte_eth_dev_stop ( uint16_t  port_id)

◆ rte_eth_dev_set_link_up()

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.

Parameters
port_idThe port identifier of the Ethernet device.
Returns
  • 0: Success, Ethernet device linked up.
  • <0: Error code of the driver device link up function.
Examples:
examples/ip_pipeline/kni.c, and examples/ip_pipeline/link.c.

◆ rte_eth_dev_set_link_down()

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()

Parameters
port_idThe port identifier of the Ethernet device.
Examples:
examples/ip_pipeline/kni.c.

◆ rte_eth_dev_close()

void rte_eth_dev_close ( uint16_t  port_id)

Close a stopped Ethernet device. The device cannot be restarted! The function frees all port resources if the driver supports the flag RTE_ETH_DEV_CLOSE_REMOVE.

Parameters
port_idThe port identifier of the Ethernet device.
Examples:
examples/eventdev_pipeline/main.c, examples/flow_filtering/main.c, examples/ioat/ioatfwd.c, examples/l2fwd-event/main.c, examples/l2fwd/main.c, examples/l3fwd-power/main.c, examples/l3fwd/main.c, examples/multi_process/client_server_mp/mp_server/main.c, and examples/ntb/ntb_fwd.c.

◆ rte_eth_dev_reset()

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.

Parameters
port_idThe port identifier of the Ethernet device.
Returns
  • (0) if successful.
  • (-EINVAL) if port identifier is invalid.
  • (-ENOTSUP) if hardware doesn't support this function.
  • (-EPERM) if not ran from the primary process.
  • (-EIO) if re-initialisation failed or device is removed.
  • (-ENOMEM) if the reset failed due to OOM.
  • (-EAGAIN) if the reset temporarily failed and should be retried later.

◆ rte_eth_promiscuous_enable()

int rte_eth_promiscuous_enable ( uint16_t  port_id)

◆ rte_eth_promiscuous_disable()

int rte_eth_promiscuous_disable ( uint16_t  port_id)

Disable receipt in promiscuous mode for an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
Returns
  • (0) if successful.
  • (-ENOTSUP) if support for promiscuous_disable() does not exist for the device.
  • (-ENODEV) if port_id invalid.

◆ rte_eth_promiscuous_get()

int rte_eth_promiscuous_get ( uint16_t  port_id)

Return the value of promiscuous mode for an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
Returns
  • (1) if promiscuous is enabled
  • (0) if promiscuous is disabled.
  • (-1) on error

◆ rte_eth_allmulticast_enable()

int rte_eth_allmulticast_enable ( uint16_t  port_id)

Enable the receipt of any multicast frame by an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
Returns
  • (0) if successful.
  • (-ENOTSUP) if support for allmulticast_enable() does not exist for the device.
  • (-ENODEV) if port_id invalid.
Examples:
examples/ipv4_multicast/main.c.

◆ rte_eth_allmulticast_disable()

int rte_eth_allmulticast_disable ( uint16_t  port_id)

Disable the receipt of all multicast frames by an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
Returns
  • (0) if successful.
  • (-ENOTSUP) if support for allmulticast_disable() does not exist for the device.
  • (-ENODEV) if port_id invalid.

◆ rte_eth_allmulticast_get()

int rte_eth_allmulticast_get ( uint16_t  port_id)

Return the value of allmulticast mode for an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
Returns
  • (1) if allmulticast is enabled
  • (0) if allmulticast is disabled.
  • (-1) on error

◆ rte_eth_link_get()

int rte_eth_link_get ( uint16_t  port_id,
struct rte_eth_link link 
)

Retrieve the status (ON/OFF), the speed (in Mbps) and the mode (HALF-DUPLEX or FULL-DUPLEX) of the physical link of an Ethernet device. It might need to wait up to 9 seconds in it.

Parameters
port_idThe port identifier of the Ethernet device.
linkA pointer to an rte_eth_link structure to be filled with the status, the speed and the mode of the Ethernet device link.
Returns
  • (0) if successful.
  • (-ENOTSUP) if the function is not supported in PMD driver.
  • (-ENODEV) if port_id invalid.
Examples:
examples/ethtool/lib/rte_ethtool.c, examples/flow_filtering/main.c, examples/ioat/ioatfwd.c, examples/ip_pipeline/cli.c, examples/ip_pipeline/link.c, examples/ntb/ntb_fwd.c, and examples/qos_sched/init.c.

◆ rte_eth_link_get_nowait()

int rte_eth_link_get_nowait ( uint16_t  port_id,
struct rte_eth_link link 
)

Retrieve the status (ON/OFF), the speed (in Mbps) and the mode (HALF-DUPLEX or FULL-DUPLEX) of the physical link of an Ethernet device. It is a no-wait version of rte_eth_link_get().

Parameters
port_idThe port identifier of the Ethernet device.
linkA pointer to an rte_eth_link structure to be filled with the status, the speed and the mode of the Ethernet device link.
Returns
  • (0) if successful.
  • (-ENOTSUP) if the function is not supported in PMD driver.
  • (-ENODEV) if port_id invalid.
Examples:
examples/bbdev_app/main.c, examples/distributor/main.c, examples/ip_fragmentation/main.c, examples/ip_reassembly/main.c, examples/ipsec-secgw/ipsec-secgw.c, examples/ipv4_multicast/main.c, examples/kni/main.c, examples/l2fwd-crypto/main.c, examples/l2fwd-event/main.c, examples/l2fwd-jobstats/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, examples/l3fwd-acl/main.c, examples/l3fwd-power/main.c, examples/l3fwd/main.c, examples/link_status_interrupt/main.c, examples/multi_process/client_server_mp/mp_server/init.c, examples/multi_process/symmetric_mp/main.c, examples/performance-thread/l3fwd-thread/main.c, examples/server_node_efd/server/init.c, and examples/vm_power_manager/main.c.

◆ rte_eth_stats_get()

int rte_eth_stats_get ( uint16_t  port_id,
struct rte_eth_stats stats 
)

Retrieve the general I/O statistics of an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
statsA pointer to a structure of type rte_eth_stats to be filled with the values of device counters for the following set of statistics:
  • ipackets with the total of successfully received packets.
  • opackets with the total of successfully transmitted packets.
  • ibytes with the total of successfully received bytes.
  • obytes with the total of successfully transmitted bytes.
  • ierrors with the total of erroneous received packets.
  • oerrors with the total of failed transmitted packets.
Returns
Zero if successful. Non-zero otherwise.
Examples:
examples/distributor/main.c, examples/ethtool/lib/rte_ethtool.c, examples/ip_pipeline/cli.c, examples/ntb/ntb_fwd.c, examples/packet_ordering/main.c, and examples/qos_sched/main.c.

◆ rte_eth_stats_reset()

int rte_eth_stats_reset ( uint16_t  port_id)

Reset the general I/O statistics of an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
Returns
  • (0) if device notified to reset stats.
  • (-ENOTSUP) if hardware doesn't support.
  • (-ENODEV) if port_id invalid.
  • (<0): Error code of the driver stats reset function.
Examples:
examples/ntb/ntb_fwd.c.

◆ rte_eth_xstats_get_names()

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.

Parameters
port_idThe port identifier of the Ethernet device.
xstats_namesAn 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.
sizeThe size of the xstats_names array (number of elements).
Returns
  • A positive value lower or equal to size: success. The return value is the number of entries filled in the stats table.
  • A positive value higher than size: error, the given statistics table is too small. The return value corresponds to the size that should be given to succeed. The entries in the table are not valid and shall not be used by the caller.
  • A negative value on error (invalid port id).
Examples:
examples/bbdev_app/main.c.

◆ rte_eth_xstats_get()

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.

Parameters
port_idThe port identifier of the Ethernet device.
xstatsA 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.
nThe 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.
Returns
  • A positive value lower or equal to n: success. The return value is the number of entries filled in the stats table.
  • A positive value higher than n: error, the given statistics table is too small. The return value corresponds to the size that should be given to succeed. The entries in the table are not valid and shall not be used by the caller.
  • A negative value on error (invalid port id).
Examples:
examples/bbdev_app/main.c.

◆ rte_eth_xstats_get_names_by_id()

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.

Parameters
port_idThe port identifier of the Ethernet device.
xstats_namesArray to be filled in with names of requested device statistics. Must not be NULL if ids are specified (not NULL).
sizeNumber 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.
idsIDs array given by app to retrieve specific statistics. May be NULL to retrieve names of all available statistics or, if xstats_names is NULL as well, just the number of available statistics.
Returns
  • A positive value lower or equal to size: success. The return value is the number of entries filled in the stats table.
  • A positive value higher than size: success. The given statistics table is too small. The return value corresponds to the size that should be given to succeed. The entries in the table are not valid and shall not be used by the caller.
  • A negative value on error.

◆ rte_eth_xstats_get_by_id()

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.

Parameters
port_idThe port identifier of the Ethernet device.
idsIDs 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.
valuesArray to be filled in with requested device statistics. Must not be NULL if ids are specified (not NULL).
sizeNumber of elements in values array (if not NULL) and in ids array (if not NULL). Must be 0 if both array pointers are NULL.
Returns
  • A positive value lower or equal to size: success. The return value is the number of entries filled in the stats table.
  • A positive value higher than size: success: The given statistics table is too small. The return value corresponds to the size that should be given to succeed. The entries in the table are not valid and shall not be used by the caller.
  • A negative value on error.

◆ rte_eth_xstats_get_id_by_name()

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()

Parameters
port_idThe port to look up statistics from
xstat_nameThe name of the statistic to return
[out]idA pointer to an app-supplied uint64_t which should be set to the ID of the stat if the stat exists.
Returns
0 on success -ENODEV for invalid port_id, -EIO if device is removed, -EINVAL if the xstat_name doesn't exist in port_id

◆ rte_eth_xstats_reset()

int rte_eth_xstats_reset ( uint16_t  port_id)

Reset extended statistics of an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
Returns
  • (0) if device notified to reset extended stats.
  • (-ENOTSUP) if pmd doesn't support both extended stats and basic stats reset.
  • (-ENODEV) if port_id invalid.
  • (<0): Error code of the driver xstats reset function.

◆ rte_eth_dev_set_tx_queue_stats_mapping()

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.

Parameters
port_idThe port identifier of the Ethernet device.
tx_queue_idThe 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_idxThe 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].
Returns
Zero if successful. Non-zero otherwise.

◆ rte_eth_dev_set_rx_queue_stats_mapping()

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.

Parameters
port_idThe port identifier of the Ethernet device.
rx_queue_idThe 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_idxThe 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].
Returns
Zero if successful. Non-zero otherwise.

◆ rte_eth_macaddr_get()

int rte_eth_macaddr_get ( uint16_t  port_id,
struct rte_ether_addr mac_addr 
)

Retrieve the Ethernet address of an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
mac_addrA pointer to a structure of type ether_addr to be filled with the Ethernet address of the Ethernet device.
Returns
  • (0) if successful
  • (-ENODEV) if port_id invalid.
Examples:
examples/bbdev_app/main.c, examples/bond/main.c, examples/distributor/main.c, examples/ethtool/ethtool-app/main.c, examples/ethtool/lib/rte_ethtool.c, examples/eventdev_pipeline/pipeline_worker_generic.c, examples/eventdev_pipeline/pipeline_worker_tx.c, examples/flow_classify/flow_classify.c, examples/ioat/ioatfwd.c, examples/ip_fragmentation/main.c, examples/ip_pipeline/cli.c, examples/ip_reassembly/main.c, examples/ipsec-secgw/ipsec-secgw.c, examples/ipv4_multicast/main.c, examples/kni/main.c, examples/l2fwd-cat/l2fwd-cat.c, examples/l2fwd-crypto/main.c, examples/l2fwd-event/l2fwd_common.c, examples/l2fwd-jobstats/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, examples/l3fwd-acl/main.c, examples/l3fwd-power/main.c, examples/l3fwd/main.c, examples/link_status_interrupt/main.c, examples/multi_process/client_server_mp/mp_server/main.c, examples/packet_ordering/main.c, examples/performance-thread/l3fwd-thread/main.c, examples/ptpclient/ptpclient.c, examples/rxtx_callbacks/main.c, examples/server_node_efd/server/main.c, examples/skeleton/basicfwd.c, examples/tep_termination/vxlan_setup.c, examples/vhost/main.c, examples/vm_power_manager/guest_cli/vm_power_cli_guest.c, examples/vm_power_manager/main.c, examples/vmdq/main.c, and examples/vmdq_dcb/main.c.

◆ rte_eth_dev_info_get()

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.

As part of this function, a number of of fields in dev_info will be initialized as follows:

rx_desc_lim = lim tx_desc_lim = lim

Where lim is defined within the rte_eth_dev_info_get as

const struct rte_eth_desc_lim lim = { .nb_max = UINT16_MAX, .nb_min = 0, .nb_align = 1, .nb_seg_max = UINT16_MAX, .nb_mtu_seg_max = UINT16_MAX, };

device = dev->device min_mtu = RTE_ETHER_MIN_MTU max_mtu = UINT16_MAX

The following fields will be populated if support for dev_infos_get() exists for the device and the rte_eth_dev 'dev' has been populated successfully with a call to it:

driver_name = dev->device->driver->name nb_rx_queues = dev->data->nb_rx_queues nb_tx_queues = dev->data->nb_tx_queues dev_flags = &dev->data->dev_flags

Parameters
port_idThe port identifier of the Ethernet device.
dev_infoA pointer to a structure of type rte_eth_dev_info to be filled with the contextual information of the Ethernet device.
Returns
  • (0) if successful.
  • (-ENOTSUP) if support for dev_infos_get() does not exist for the device.
  • (-ENODEV) if port_id invalid.
Examples:
examples/bond/main.c, examples/distributor/main.c, examples/ethtool/ethtool-app/main.c, examples/ethtool/lib/rte_ethtool.c, examples/eventdev_pipeline/pipeline_worker_generic.c, examples/eventdev_pipeline/pipeline_worker_tx.c, examples/flow_classify/flow_classify.c, examples/flow_filtering/main.c, examples/ioat/ioatfwd.c, examples/ip_fragmentation/main.c, examples/ip_pipeline/kni.c, examples/ip_pipeline/link.c, examples/ip_reassembly/main.c, examples/ipsec-secgw/ipsec-secgw.c, examples/ipsec-secgw/ipsec.c, examples/ipsec-secgw/sa.c, examples/ipv4_multicast/main.c, examples/kni/main.c, examples/l2fwd-crypto/main.c, examples/l2fwd-event/l2fwd_common.c, examples/l2fwd-jobstats/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, examples/l3fwd-acl/main.c, examples/l3fwd-power/main.c, examples/l3fwd/main.c, examples/link_status_interrupt/main.c, examples/multi_process/symmetric_mp/main.c, examples/ntb/ntb_fwd.c, examples/packet_ordering/main.c, examples/performance-thread/l3fwd-thread/main.c, examples/ptpclient/ptpclient.c, examples/qos_meter/main.c, examples/qos_sched/init.c, examples/rxtx_callbacks/main.c, examples/server_node_efd/server/init.c, examples/skeleton/basicfwd.c, examples/tep_termination/vxlan_setup.c, examples/vhost/main.c, examples/vm_power_manager/main.c, examples/vmdq/main.c, and examples/vmdq_dcb/main.c.

◆ rte_eth_dev_fw_version_get()

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.

Parameters
port_idThe port identifier of the device.
fw_versionA pointer to a string array storing the firmware version of a device, the string includes terminating null. This pointer is allocated by caller.
fw_sizeThe size of the string array pointed by fw_version, which should be large enough to store firmware version of the device.
Returns
  • (0) if successful.
  • (-ENOTSUP) if operation is not supported.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
  • (>0) if fw_size is not enough to store firmware version, return the size of the non truncated string.
Examples:
examples/ethtool/lib/rte_ethtool.c.

◆ rte_eth_dev_get_supported_ptypes()

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:

  • Ether/IPv4 -> RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4
  • Ether/Vlan/IPv4 -> RTE_PTYPE_L2_ETHER_VLAN | RTE_PTYPE_L3_IPV4
  • Ether/[anything else] -> RTE_PTYPE_L2_ETHER
  • Ether/Vlan/[anything else] -> RTE_PTYPE_L2_ETHER_VLAN

When a packet is received by a PMD, the most precise type must be returned among the ones supported. However a PMD is allowed to set packet type that is not in the supported list, at the condition that it is more precise. Therefore, a PMD announcing no supported packet types can still set a matching packet type in a received packet.

Note
Better to invoke this API after the device is already started or rx burst function is decided, to obtain correct supported ptypes.
if a given PMD does not report what ptypes it supports, then the supported ptype count is reported as 0.
Parameters
port_idThe port identifier of the Ethernet device.
ptype_maskA hint of what kind of packet type which the caller is interested in.
ptypesAn array pointer to store adequate packet types, allocated by caller.
numSize of the array pointed by param ptypes.
Returns
  • (>=0) Number of supported ptypes. If the number of types exceeds num, only num entries will be filled into the ptypes array, but the full count of supported ptypes will be returned.
  • (-ENODEV) if port_id invalid.
Examples:
examples/ip_fragmentation/main.c, examples/l3fwd-power/main.c, examples/l3fwd/l3fwd_em.c, examples/l3fwd/l3fwd_lpm.c, and examples/performance-thread/l3fwd-thread/main.c.

◆ rte_eth_dev_set_ptypes()

__rte_experimental int rte_eth_dev_set_ptypes ( uint16_t  port_id,
uint32_t  ptype_mask,
uint32_t *  set_ptypes,
unsigned int  num 
)
Warning
EXPERIMENTAL: this API may change without prior notice.

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.

Parameters
port_idThe port identifier of the Ethernet device.
ptype_maskThe ptype family that application is interested in should be bitwise OR of RTE_PTYPE_*_MASK or 0.
set_ptypesAn array pointer to store set packet types, allocated by caller. The function marks the end of array with RTE_PTYPE_UNKNOWN.
numSize of the array pointed by param ptypes. Should be rte_eth_dev_get_supported_ptypes() + 1 to accommodate the set ptypes.
Returns
  • (0) if Success.
  • (-ENODEV) if port_id invalid.
  • (-EINVAL) if ptype_mask is invalid (or) set_ptypes is NULL and num > 0.
Examples:
examples/l2fwd/main.c.

◆ rte_eth_dev_get_mtu()

int rte_eth_dev_get_mtu ( uint16_t  port_id,
uint16_t *  mtu 
)

Retrieve the MTU of an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
mtuA pointer to a uint16_t where the retrieved MTU is to be stored.
Returns
  • (0) if successful.
  • (-ENODEV) if port_id invalid.
Examples:
examples/ip_pipeline/cli.c, and examples/kni/main.c.

◆ rte_eth_dev_set_mtu()

int rte_eth_dev_set_mtu ( uint16_t  port_id,
uint16_t  mtu 
)

Change the MTU of an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
mtuA uint16_t for the MTU to be applied.
Returns
  • (0) if successful.
  • (-ENOTSUP) if operation is not supported.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
  • (-EINVAL) if mtu invalid, validation of mtu can occur within rte_eth_dev_set_mtu if dev_infos_get is supported by the device or when the mtu is set using dev->dev_ops->mtu_set.
  • (-EBUSY) if operation is not allowed when the port is running
Examples:
examples/ethtool/lib/rte_ethtool.c, examples/ip_fragmentation/main.c, and examples/ip_pipeline/kni.c.

◆ rte_eth_dev_vlan_filter()

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.

Parameters
port_idThe port identifier of the Ethernet device.
vlan_idThe VLAN Tag Identifier whose filtering must be enabled or disabled.
onIf > 0, enable VLAN filtering of VLAN packets tagged with vlan_id. Otherwise, disable VLAN filtering of VLAN packets tagged with vlan_id.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware-assisted VLAN filtering not configured.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
  • (-ENOSYS) if VLAN filtering on port_id disabled.
  • (-EINVAL) if vlan_id > 4095.
Examples:
examples/ethtool/lib/rte_ethtool.c.

◆ rte_eth_dev_set_vlan_strip_on_queue()

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. 82599/X540/X550 can support VLAN stripping at the rx queue level

Parameters
port_idThe port identifier of the Ethernet device.
rx_queue_idThe 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().
onIf 1, Enable VLAN Stripping of the receive queue of the Ethernet port. If 0, Disable VLAN Stripping of the receive queue of the Ethernet port.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware-assisted VLAN stripping not configured.
  • (-ENODEV) if port_id invalid.
  • (-EINVAL) if rx_queue_id invalid.
Examples:
examples/vhost/main.c.

◆ rte_eth_dev_set_vlan_ether_type()

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. This is a register setup available on some Intel NIC, not but all, please check the data sheet for availability.

Parameters
port_idThe port identifier of the Ethernet device.
vlan_typeThe vlan type.
tag_typeThe Tag Protocol ID
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware-assisted VLAN TPID setup is not supported.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.

◆ rte_eth_dev_set_vlan_offload()

int rte_eth_dev_set_vlan_offload ( uint16_t  port_id,
int  offload_mask 
)

Set VLAN offload configuration on an Ethernet device Enable/Disable Extended VLAN by an Ethernet device, This is a register setup available on some Intel NIC, not but all, please check the data sheet for availability. Enable/Disable VLAN Strip can be done on rx queue for certain NIC, but here the configuration is applied on the port level.

Parameters
port_idThe port identifier of the Ethernet device.
offload_maskThe VLAN Offload bit mask can be mixed use with "OR" ETH_VLAN_STRIP_OFFLOAD ETH_VLAN_FILTER_OFFLOAD ETH_VLAN_EXTEND_OFFLOAD ETH_QINQ_STRIP_OFFLOAD
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware-assisted VLAN filtering not configured.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
Examples:
examples/ethtool/lib/rte_ethtool.c.

◆ rte_eth_dev_get_vlan_offload()

int rte_eth_dev_get_vlan_offload ( uint16_t  port_id)

Read VLAN Offload configuration from an Ethernet device

Parameters
port_idThe port identifier of the Ethernet device.
Returns
  • (>0) if successful. Bit mask to indicate ETH_VLAN_STRIP_OFFLOAD ETH_VLAN_FILTER_OFFLOAD ETH_VLAN_EXTEND_OFFLOAD ETH_QINQ_STRIP_OFFLOAD
  • (-ENODEV) if port_id invalid.

◆ rte_eth_dev_set_vlan_pvid()

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.

Parameters
port_idThe port identifier of the Ethernet device.
pvidPort based TX VLAN identifier together with user priority.
onTurn on or off the port based TX VLAN insertion.
Returns
  • (0) if successful.
  • negative if failed.

◆ rte_eth_tx_buffer_init()

int rte_eth_tx_buffer_init ( struct rte_eth_dev_tx_buffer buffer,
uint16_t  size 
)

◆ rte_eth_tx_buffer_set_err_callback()

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_count_unsent_packet_callback()" is also provided as reference.

Parameters
bufferThe port identifier of the Ethernet device.
callbackThe function to be used as the callback.
userdataArbitrary parameter to be passed to the callback function
Returns
0 on success, or -1 on error with rte_errno set appropriately
Examples:
examples/ioat/ioatfwd.c, examples/l2fwd-event/l2fwd_poll.c, examples/l2fwd-jobstats/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, examples/link_status_interrupt/main.c, examples/multi_process/client_server_mp/mp_client/client.c, examples/packet_ordering/main.c, and examples/server_node_efd/node/node.c.

◆ rte_eth_tx_buffer_drop_callback()

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.

Parameters
pktsThe previously buffered packets which could not be sent
unsentThe number of unsent packets in the pkts array
userdataNot used

◆ rte_eth_tx_buffer_count_callback()

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.

Parameters
pktsThe previously buffered packets which could not be sent
unsentThe number of unsent packets in the pkts array
userdataPointer to an uint64_t value, which will be incremented by unsent
Examples:
examples/ioat/ioatfwd.c, examples/l2fwd-event/l2fwd_poll.c, examples/l2fwd-jobstats/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, and examples/link_status_interrupt/main.c.

◆ rte_eth_tx_done_cleanup()

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.

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe 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_cntMaximum number of packets to free. Use 0 to indicate all possible packets should be freed. Note that a packet may be using multiple mbufs.
Returns
Failure: < 0 -ENODEV: Invalid interface -EIO: device is removed -ENOTSUP: Driver does not support function Success: >= 0 0-n: Number of packets freed. More packets may still remain in ring that are in use.

◆ rte_eth_dev_callback_register()

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.

Parameters
port_idPort id. RTE_ETH_ALL means register the event for all port ids.
eventEvent interested.
cb_fnUser supplied callback function to be called.
cb_argPointer to the parameters for the registered callback.
Returns
  • On success, zero.
  • On failure, a negative value.
Examples:
examples/ipsec-secgw/ipsec-secgw.c, and examples/link_status_interrupt/main.c.

◆ rte_eth_dev_callback_unregister()

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.

Parameters
port_idPort id. RTE_ETH_ALL means unregister the event for all port ids.
eventEvent interested.
cb_fnUser supplied callback function to be called.
cb_argPointer to the parameters for the registered callback. -1 means to remove all for the same callback address and same event.
Returns
  • On success, zero.
  • On failure, a negative value.

◆ rte_eth_dev_rx_intr_enable()

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.

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe index of the receive queue from which to retrieve input packets. The value must be in the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
Returns
  • (0) if successful.
  • (-ENOTSUP) if underlying hardware OR driver doesn't support that operation.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
Examples:
examples/l3fwd-power/main.c.

◆ rte_eth_dev_rx_intr_disable()

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.

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe index of the receive queue from which to retrieve input packets. The value must be in the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
Returns
  • (0) if successful.
  • (-ENOTSUP) if underlying hardware OR driver doesn't support that operation.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
Examples:
examples/l3fwd-power/main.c.

◆ rte_eth_dev_rx_intr_ctl()

int rte_eth_dev_rx_intr_ctl ( uint16_t  port_id,
int  epfd,
int  op,
void *  data 
)

RX Interrupt control per port.

Parameters
port_idThe port identifier of the Ethernet device.
epfdEpoll instance fd which the intr vector associated to. Using RTE_EPOLL_PER_THREAD allows to use per thread epoll instance.
opThe operation be performed for the vector. Operation type of {RTE_INTR_EVENT_ADD, RTE_INTR_EVENT_DEL}.
dataUser raw data.
Returns
  • On success, zero.
  • On failure, a negative value.

◆ rte_eth_dev_rx_intr_ctl_q()

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.

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe 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().
epfdEpoll instance fd which the intr vector associated to. Using RTE_EPOLL_PER_THREAD allows to use per thread epoll instance.
opThe operation be performed for the vector. Operation type of {RTE_INTR_EVENT_ADD, RTE_INTR_EVENT_DEL}.
dataUser raw data.
Returns
  • On success, zero.
  • On failure, a negative value.
Examples:
examples/l3fwd-power/main.c.

◆ rte_eth_dev_rx_intr_ctl_q_get_fd()

__rte_experimental int rte_eth_dev_rx_intr_ctl_q_get_fd ( uint16_t  port_id,
uint16_t  queue_id 
)
Warning
EXPERIMENTAL: this API may change without prior notice.

Get interrupt fd per Rx queue.

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe index of the receive queue from which to retrieve input packets. The value must be in the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
Returns
  • (>=0) the interrupt fd associated to the requested Rx queue if successful.
  • (-1) on error.

◆ rte_eth_led_on()

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.

Parameters
port_idThe port identifier of the Ethernet device.
Returns
  • (0) if successful.
  • (-ENOTSUP) if underlying hardware OR driver doesn't support that operation.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.

◆ rte_eth_led_off()

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.

Parameters
port_idThe port identifier of the Ethernet device.
Returns
  • (0) if successful.
  • (-ENOTSUP) if underlying hardware OR driver doesn't support that operation.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.

◆ rte_eth_dev_flow_ctrl_get()

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

Parameters
port_idThe port identifier of the Ethernet device.
fc_confThe pointer to the structure where to store the flow control parameters.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support flow control.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
Examples:
examples/ethtool/lib/rte_ethtool.c.

◆ rte_eth_dev_flow_ctrl_set()

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

Parameters
port_idThe port identifier of the Ethernet device.
fc_confThe pointer to the structure of the flow control parameters.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support flow control mode.
  • (-ENODEV) if port_id invalid.
  • (-EINVAL) if bad parameter
  • (-EIO) if flow control setup failure or device is removed.
Examples:
examples/ethtool/lib/rte_ethtool.c.

◆ rte_eth_dev_priority_flow_ctrl_set()

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.

Parameters
port_idThe port identifier of the Ethernet device.
pfc_confThe pointer to the structure of the priority flow control parameters.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support priority flow control mode.
  • (-ENODEV) if port_id invalid.
  • (-EINVAL) if bad parameter
  • (-EIO) if flow control setup failure or device is removed.

◆ rte_eth_dev_mac_addr_add()

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 an internal array of addresses used to enable whitelist filtering to accept packets only if the destination MAC address matches.

Parameters
port_idThe port identifier of the Ethernet device.
mac_addrThe MAC address to add.
poolVMDq pool index to associate address with (if VMDq is enabled). If VMDq is not enabled, this should be set to 0.
Returns
  • (0) if successfully added or mac_addr was already added.
  • (-ENOTSUP) if hardware doesn't support this feature.
  • (-ENODEV) if port is invalid.
  • (-EIO) if device is removed.
  • (-ENOSPC) if no more MAC addresses can be added.
  • (-EINVAL) if MAC address is invalid.
Examples:
examples/vhost/main.c, examples/vmdq/main.c, and examples/vmdq_dcb/main.c.

◆ rte_eth_dev_mac_addr_remove()

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.

Parameters
port_idThe port identifier of the Ethernet device.
mac_addrMAC address to remove.
Returns
  • (0) if successful, or mac_addr didn't exist.
  • (-ENOTSUP) if hardware doesn't support.
  • (-ENODEV) if port invalid.
  • (-EADDRINUSE) if attempting to remove the default MAC address
Examples:
examples/vhost/main.c.

◆ rte_eth_dev_default_mac_addr_set()

int rte_eth_dev_default_mac_addr_set ( uint16_t  port_id,
struct rte_ether_addr mac_addr 
)

Set the default MAC address.

Parameters
port_idThe port identifier of the Ethernet device.
mac_addrNew default MAC address.
Returns
  • (0) if successful, or mac_addr didn't exist.
  • (-ENOTSUP) if hardware doesn't support.
  • (-ENODEV) if port invalid.
  • (-EINVAL) if MAC address is invalid.
Examples:
examples/ethtool/lib/rte_ethtool.c, and examples/kni/main.c.

◆ rte_eth_dev_rss_reta_update()

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.

Parameters
port_idThe port identifier of the Ethernet device.
reta_confRETA to update.
reta_sizeRedirection table size. The table size can be queried by rte_eth_dev_info_get().
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
  • (-EIO) if device is removed.
Examples:
examples/ip_pipeline/link.c.

◆ rte_eth_dev_rss_reta_query()

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.

Parameters
port_idThe port identifier of the Ethernet device.
reta_confRETA to query. For each requested reta entry, corresponding bit in mask must be set.
reta_sizeRedirection table size. The table size can be queried by rte_eth_dev_info_get().
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
  • (-EIO) if device is removed.

◆ rte_eth_dev_uc_hash_table_set()

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.

Parameters
port_idThe port identifier of the Ethernet device.
addrUnicast MAC address.
on1 - Set an unicast hash bit for receiving packets with the MAC address. 0 - Clear an unicast hash bit.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
  • (-EINVAL) if bad parameter.

◆ rte_eth_dev_uc_all_hash_table_set()

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.

Parameters
port_idThe port identifier of the Ethernet device.
on1 - Set all unicast hash bitmaps for receiving all the Ethernet MAC addresses 0 - Clear all unicast hash bitmaps
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
  • (-EINVAL) if bad parameter.

◆ rte_eth_mirror_rule_set()

int rte_eth_mirror_rule_set ( uint16_t  port_id,
struct rte_eth_mirror_conf mirror_conf,
uint8_t  rule_id,
uint8_t  on 
)

Set a traffic mirroring rule on an Ethernet device

Parameters
port_idThe port identifier of the Ethernet device.
mirror_confThe pointer to the traffic mirroring structure describing the mirroring rule. The rte_eth_vm_mirror_conf structure includes the type of mirroring rule, destination pool and the value of rule if enable vlan or pool mirroring.
rule_idThe index of traffic mirroring rule, we support four separated rules.
on1 - Enable a mirroring rule. 0 - Disable a mirroring rule.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support this feature.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
  • (-EINVAL) if the mr_conf information is not correct.

◆ rte_eth_mirror_rule_reset()

int rte_eth_mirror_rule_reset ( uint16_t  port_id,
uint8_t  rule_id 
)

Reset a traffic mirroring rule on an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
rule_idThe index of traffic mirroring rule, we support four separated rules.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support this feature.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
  • (-EINVAL) if bad parameter.

◆ rte_eth_set_queue_rate_limit()

int rte_eth_set_queue_rate_limit ( uint16_t  port_id,
uint16_t  queue_idx,
uint16_t  tx_rate 
)

Set the rate limitation for a queue on an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
queue_idxThe queue id.
tx_rateThe tx rate in Mbps. Allocated from the total port link speed.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support this feature.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
  • (-EINVAL) if bad parameter.

◆ rte_eth_dev_rss_hash_update()

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.

Parameters
port_idThe port identifier of the Ethernet device.
rss_confThe new configuration to use for RSS hash computation on the port.
Returns
  • (0) if successful.
  • (-ENODEV) if port identifier is invalid.
  • (-EIO) if device is removed.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.

◆ rte_eth_dev_rss_hash_conf_get()

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.

Parameters
port_idThe port identifier of the Ethernet device.
rss_confWhere to store the current RSS hash configuration of the Ethernet device.
Returns
  • (0) if successful.
  • (-ENODEV) if port identifier is invalid.
  • (-EIO) if device is removed.
  • (-ENOTSUP) if hardware doesn't support RSS.
Examples:
examples/ipsec-secgw/ipsec.c.

◆ rte_eth_dev_udp_tunnel_port_add()

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 specific type of tunnel. The packets with this UDP port will be identified as this type of tunnel. Before enabling any offloading function for a tunnel, users can call this API to change or add more UDP port for the tunnel. So the offloading function can take effect on the packets with the specific UDP port.

Parameters
port_idThe port identifier of the Ethernet device.
tunnel_udpUDP tunneling configuration.
Returns
  • (0) if successful.
  • (-ENODEV) if port identifier is invalid.
  • (-EIO) if device is removed.
  • (-ENOTSUP) if hardware doesn't support tunnel type.
Examples:
examples/tep_termination/vxlan_setup.c.

◆ rte_eth_dev_udp_tunnel_port_delete()

int rte_eth_dev_udp_tunnel_port_delete ( uint16_t  port_id,
struct rte_eth_udp_tunnel tunnel_udp 
)

Delete UDP tunneling port a specific type of tunnel. The packets with this UDP port will not be identified as this type of tunnel any more. Before enabling any offloading function for a tunnel, users can call this API to delete a UDP port for the tunnel. So the offloading function will not take effect on the packets with the specific UDP port.

Parameters
port_idThe port identifier of the Ethernet device.
tunnel_udpUDP tunneling configuration.
Returns
  • (0) if successful.
  • (-ENODEV) if port identifier is invalid.
  • (-EIO) if device is removed.
  • (-ENOTSUP) if hardware doesn't support tunnel type.

◆ rte_eth_dev_filter_supported()

__rte_deprecated int rte_eth_dev_filter_supported ( uint16_t  port_id,
enum rte_filter_type  filter_type 
)

Check whether the filter type is supported on an Ethernet device. All the supported filter types are defined in 'rte_eth_ctrl.h'.

Parameters
port_idThe port identifier of the Ethernet device.
filter_typeFilter type.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support this filter type.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.

◆ rte_eth_dev_filter_ctrl()

__rte_deprecated int rte_eth_dev_filter_ctrl ( uint16_t  port_id,
enum rte_filter_type  filter_type,
enum rte_filter_op  filter_op,
void *  arg 
)

Take operations to assigned filter type on an Ethernet device. All the supported operations and filter types are defined in 'rte_eth_ctrl.h'.

Parameters
port_idThe port identifier of the Ethernet device.
filter_typeFilter type.
filter_opType of operation.
argA pointer to arguments defined specifically for the operation.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
  • others depends on the specific operations implementation.
Examples:
examples/tep_termination/vxlan_setup.c.

◆ rte_eth_dev_get_dcb_info()

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.

Parameters
port_idThe port identifier of the Ethernet device.
dcb_infodcb information.
Returns
  • (0) if successful.
  • (-ENODEV) if port identifier is invalid.
  • (-EIO) if device is removed.
  • (-ENOTSUP) if hardware doesn't support.

◆ rte_eth_add_rx_callback()

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.

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe queue on the Ethernet device on which the callback is to be added.
fnThe callback function
user_paramA generic pointer parameter which will be passed to each invocation of the callback function on this port and queue. Inter-thread synchronization of any user data changes is the responsibility of the user.
Returns
NULL on error. On success, a pointer value which can later be used to remove the callback.
Examples:
examples/ip_fragmentation/main.c, examples/ipsec-secgw/ipsec-secgw.c, examples/l3fwd-power/main.c, examples/l3fwd/main.c, examples/performance-thread/l3fwd-thread/main.c, and examples/rxtx_callbacks/main.c.

◆ rte_eth_add_first_rx_callback()

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.

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe queue on the Ethernet device on which the callback is to be added.
fnThe callback function
user_paramA generic pointer parameter which will be passed to each invocation of the callback function on this port and queue. Inter-thread synchronization of any user data changes is the responsibility of the user.
Returns
NULL on error. On success, a pointer value which can later be used to remove the callback.

◆ rte_eth_add_tx_callback()

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.

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe queue on the Ethernet device on which the callback is to be added.
fnThe callback function
user_paramA generic pointer parameter which will be passed to each invocation of the callback function on this port and queue. Inter-thread synchronization of any user data changes is the responsibility of the user.
Returns
NULL on error. On success, a pointer value which can later be used to remove the callback.
Examples:
examples/rxtx_callbacks/main.c.

◆ rte_eth_remove_rx_callback()

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():

  • Immediately - if the port is stopped, or the user knows that no callbacks are in flight e.g. if called from the thread doing RX/TX on that queue.
  • After a short delay - where the delay is sufficient to allow any in-flight callbacks to complete. Alternately, the RCU mechanism can be used to detect when data plane threads have ceased referencing the callback memory.
Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe queue on the Ethernet device from which the callback is to be removed.
user_cbUser supplied callback created via rte_eth_add_rx_callback().
Returns
  • 0: Success. Callback was removed.
  • -ENOTSUP: Callback support is not available.
  • -EINVAL: The port_id or the queue_id is out of range, or the callback is NULL or not found for the port/queue.

◆ rte_eth_remove_tx_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():

  • Immediately - if the port is stopped, or the user knows that no callbacks are in flight e.g. if called from the thread doing RX/TX on that queue.
  • After a short delay - where the delay is sufficient to allow any in-flight callbacks to complete. Alternately, the RCU mechanism can be used to detect when data plane threads have ceased referencing the callback memory.
Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe queue on the Ethernet device from which the callback is to be removed.
user_cbUser supplied callback created via rte_eth_add_tx_callback().
Returns
  • 0: Success. Callback was removed.
  • -ENOTSUP: Callback support is not available.
  • -EINVAL: The port_id or the queue_id is out of range, or the callback is NULL or not found for the port/queue.

◆ rte_eth_rx_queue_info_get()

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.

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe RX queue on the Ethernet device for which information will be retrieved.
qinfoA pointer to a structure of type rte_eth_rxq_info_info to be filled with the information of the Ethernet device.
Returns
  • 0: Success
  • -ENOTSUP: routine is not supported by the device PMD.
  • -EINVAL: The port_id or the queue_id is out of range, or the queue is hairpin queue.
Examples:
examples/ethtool/lib/rte_ethtool.c.

◆ rte_eth_tx_queue_info_get()

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.

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe TX queue on the Ethernet device for which information will be retrieved.
qinfoA pointer to a structure of type rte_eth_txq_info_info to be filled with the information of the Ethernet device.
Returns
  • 0: Success
  • -ENOTSUP: routine is not supported by the device PMD.
  • -EINVAL: The port_id or the queue_id is out of range, or the queue is hairpin queue.
Examples:
examples/ethtool/lib/rte_ethtool.c.

◆ rte_eth_rx_burst_mode_get()

__rte_experimental 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.

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe Rx queue on the Ethernet device for which information will be retrieved.
modeA pointer to a structure of type rte_eth_burst_mode to be filled with the information of the packet burst mode.
Returns
  • 0: Success
  • -ENOTSUP: routine is not supported by the device PMD.
  • -EINVAL: The port_id or the queue_id is out of range.

◆ rte_eth_tx_burst_mode_get()

__rte_experimental 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.

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe Tx queue on the Ethernet device for which information will be retrieved.
modeA pointer to a structure of type rte_eth_burst_mode to be filled with the information of the packet burst mode.
Returns
  • 0: Success
  • -ENOTSUP: routine is not supported by the device PMD.
  • -EINVAL: The port_id or the queue_id is out of range.

◆ rte_eth_dev_get_reg_info()

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)

Parameters
port_idThe port identifier of the Ethernet device.
infoPointer to rte_dev_reg_info structure to fill in. If info->data is NULL the function fills in the width and length fields. If non-NULL the registers are put into the buffer pointed at by the data field.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-ENODEV) if port_id invalid.
  • (-EINVAL) if bad parameter.
  • (-EIO) if device is removed.
  • others depends on the specific operations implementation.
Examples:
examples/ethtool/lib/rte_ethtool.c.

◆ rte_eth_dev_get_eeprom_length()

int rte_eth_dev_get_eeprom_length ( uint16_t  port_id)

Retrieve size of device EEPROM

Parameters
port_idThe port identifier of the Ethernet device.
Returns
  • (>=0) EEPROM size if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
  • others depends on the specific operations implementation.
Examples:
examples/ethtool/lib/rte_ethtool.c.

◆ rte_eth_dev_get_eeprom()

int rte_eth_dev_get_eeprom ( uint16_t  port_id,
struct rte_dev_eeprom_info *  info 
)

Retrieve EEPROM and EEPROM attribute

Parameters
port_idThe port identifier of the Ethernet device.
infoThe template includes buffer for return EEPROM data and EEPROM attributes to be filled.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
  • others depends on the specific operations implementation.
Examples:
examples/ethtool/lib/rte_ethtool.c.

◆ rte_eth_dev_set_eeprom()

int rte_eth_dev_set_eeprom ( uint16_t  port_id,
struct rte_dev_eeprom_info *  info 
)

Program EEPROM with provided data

Parameters
port_idThe port identifier of the Ethernet device.
infoThe template includes EEPROM data for programming and EEPROM attributes to be filled
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
  • others depends on the specific operations implementation.
Examples:
examples/ethtool/lib/rte_ethtool.c.

◆ rte_eth_dev_get_module_info()

__rte_experimental int rte_eth_dev_get_module_info ( uint16_t  port_id,
struct rte_eth_dev_module_info modinfo 
)
Warning
EXPERIMENTAL: this API may change without prior notice.

Retrieve the type and size of plugin module EEPROM

Parameters
port_idThe port identifier of the Ethernet device.
modinfoThe type and size of plugin module EEPROM.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-ENODEV) if port_id invalid.
  • (-EINVAL) if bad parameter.
  • (-EIO) if device is removed.
  • others depends on the specific operations implementation.
Examples:
examples/ethtool/lib/rte_ethtool.c.

◆ rte_eth_dev_get_module_eeprom()

__rte_experimental int rte_eth_dev_get_module_eeprom ( uint16_t  port_id,
struct rte_dev_eeprom_info *  info 
)
Warning
EXPERIMENTAL: this API may change without prior notice.

Retrieve the data of plugin module EEPROM

Parameters
port_idThe port identifier of the Ethernet device.
infoThe template includes the plugin module EEPROM attributes, and the buffer for return plugin module EEPROM data.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
  • others depends on the specific operations implementation.
Examples:
examples/ethtool/lib/rte_ethtool.c.

◆ rte_eth_dev_set_mc_addr_list()

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.

Parameters
port_idThe port identifier of the Ethernet device.
mc_addr_setThe array of multicast addresses to set. Equal to NULL when the function is invoked to flush the set of filtered addresses.
nb_mc_addrThe number of multicast addresses in the mc_addr_set array. Equal to 0 when the function is invoked to flush the set of filtered addresses.
Returns
  • (0) if successful.
  • (-ENODEV) if port_id invalid.
  • (-EIO) if device is removed.
  • (-ENOTSUP) if PMD of port_id doesn't support multicast filtering.
  • (-ENOSPC) if port_id has not enough multicast filtering resources.

◆ rte_eth_timesync_enable()

int rte_eth_timesync_enable ( uint16_t  port_id)

Enable IEEE1588/802.1AS timestamping for an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
Returns
  • 0: Success.
  • -ENODEV: The port ID is invalid.
  • -EIO: if device is removed.
  • -ENOTSUP: The function is not supported by the Ethernet driver.
Examples:
examples/ptpclient/ptpclient.c.

◆ rte_eth_timesync_disable()

int rte_eth_timesync_disable ( uint16_t  port_id)

Disable IEEE1588/802.1AS timestamping for an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
Returns
  • 0: Success.
  • -ENODEV: The port ID is invalid.
  • -EIO: if device is removed.
  • -ENOTSUP: The function is not supported by the Ethernet driver.

◆ rte_eth_timesync_read_rx_timestamp()

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.

Parameters
port_idThe port identifier of the Ethernet device.
timestampPointer to the timestamp struct.
flagsDevice specific flags. Used to pass the RX timesync register index to i40e. Unused in igb/ixgbe, pass 0 instead.
Returns
  • 0: Success.
  • -EINVAL: No timestamp is available.
  • -ENODEV: The port ID is invalid.
  • -EIO: if device is removed.
  • -ENOTSUP: The function is not supported by the Ethernet driver.
Examples:
examples/ptpclient/ptpclient.c.

◆ rte_eth_timesync_read_tx_timestamp()

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.

Parameters
port_idThe port identifier of the Ethernet device.
timestampPointer to the timestamp struct.
Returns
  • 0: Success.
  • -EINVAL: No timestamp is available.
  • -ENODEV: The port ID is invalid.
  • -EIO: if device is removed.
  • -ENOTSUP: The function is not supported by the Ethernet driver.
Examples:
examples/ptpclient/ptpclient.c.

◆ rte_eth_timesync_adjust_time()

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.

Parameters
port_idThe port identifier of the Ethernet device.
deltaThe adjustment in nanoseconds.
Returns
  • 0: Success.
  • -ENODEV: The port ID is invalid.
  • -EIO: if device is removed.
  • -ENOTSUP: The function is not supported by the Ethernet driver.
Examples:
examples/ptpclient/ptpclient.c.

◆ rte_eth_timesync_read_time()

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.

Parameters
port_idThe port identifier of the Ethernet device.
timePointer to the timespec struct that holds the time.
Returns
  • 0: Success.
Examples:
examples/ptpclient/ptpclient.c.

◆ rte_eth_timesync_write_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.

Parameters
port_idThe port identifier of the Ethernet device.
timePointer to the timespec struct that holds the time.
Returns
  • 0: Success.
  • -EINVAL: No timestamp is available.
  • -ENODEV: The port ID is invalid.
  • -EIO: if device is removed.
  • -ENOTSUP: The function is not supported by the Ethernet driver.

◆ rte_eth_read_clock()

__rte_experimental int rte_eth_read_clock ( uint16_t  port_id,
uint64_t *  clock 
)
Warning
EXPERIMENTAL: this API may change without prior notice.

Read the current clock counter of an Ethernet device

This returns the current raw clock value of an Ethernet device. It is a raw amount of ticks, with no given time reference. The value returned here is from the same clock than the one filling timestamp field of Rx packets when using hardware timestamp offload. Therefore it can be used to compute a precise conversion of the device clock to the real time.

E.g, a simple heuristic to derivate the frequency would be: uint64_t start, end; rte_eth_read_clock(port, start); rte_delay_ms(100); rte_eth_read_clock(port, end); double freq = (end - start) * 10;

Compute a common reference with: uint64_t base_time_sec = current_time(); uint64_t base_clock; rte_eth_read_clock(port, base_clock);

Then, convert the raw mbuf timestamp with: base_time_sec + (double)(mbuf->timestamp - 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.

Parameters
port_idThe port identifier of the Ethernet device.
clockPointer to the uint64_t that holds the raw clock value.
Returns
  • 0: Success.
  • -ENODEV: The port ID is invalid.
  • -ENOTSUP: The function is not supported by the Ethernet driver.
Examples:
examples/rxtx_callbacks/main.c.

◆ rte_eth_dev_l2_tunnel_eth_type_conf()

int rte_eth_dev_l2_tunnel_eth_type_conf ( uint16_t  port_id,
struct rte_eth_l2_tunnel_conf l2_tunnel 
)

Config l2 tunnel ether type of an Ethernet device for filtering specific tunnel packets by ether type.

Parameters
port_idThe port identifier of the Ethernet device.
l2_tunnell2 tunnel configuration.
Returns
  • (0) if successful.
  • (-ENODEV) if port identifier is invalid.
  • (-EIO) if device is removed.
  • (-ENOTSUP) if hardware doesn't support tunnel type.

◆ rte_eth_dev_l2_tunnel_offload_set()

int rte_eth_dev_l2_tunnel_offload_set ( uint16_t  port_id,
struct rte_eth_l2_tunnel_conf l2_tunnel,
uint32_t  mask,
uint8_t  en 
)

Enable/disable l2 tunnel offload functions. Include, 1, The ability of parsing a type of l2 tunnel of an Ethernet device. Filtering, forwarding and offloading this type of tunnel packets depend on this ability. 2, Stripping the l2 tunnel tag. 3, Insertion of the l2 tunnel tag. 4, Forwarding the packets based on the l2 tunnel tag.

Parameters
port_idThe port identifier of the Ethernet device.
l2_tunnell2 tunnel parameters.
maskIndicate the offload function.
enEnable or disable this function.
Returns
  • (0) if successful.
  • (-ENODEV) if port identifier is invalid.
  • (-EIO) if device is removed.
  • (-ENOTSUP) if hardware doesn't support tunnel type.

◆ rte_eth_dev_get_port_by_name()

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:

  • PCIe address (Domain:Bus:Device.Function), for example- 0000:2:00.0
  • SoC device name, for example- fsl-gmac0
  • vdev dpdk name, for example- net_[pcap0|null0|tap0]
Parameters
namepci address or name of the device
port_idpointer to port identifier of the device
Returns
  • (0) if successful and port_id is filled.
  • (-ENODEV or -EINVAL) on failure.
Examples:
examples/ip_pipeline/link.c.

◆ rte_eth_dev_get_name_by_port()

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:

  • PCIe address (Domain:Bus:Device.Function), for example- 0000:02:00.0
  • SoC device name, for example- fsl-gmac0
  • vdev dpdk name, for example- net_[pcap0|null0|tun0|tap0]
Parameters
port_idPort identifier of the device.
nameBuffer of size RTE_ETH_NAME_MAX_LEN to store the name.
Returns
  • (0) if successful.
  • (-EINVAL) on failure.
Examples:
examples/multi_process/hotplug_mp/commands.c.

◆ rte_eth_dev_adjust_nb_rx_tx_desc()

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.

Parameters
port_idThe port identifier of the Ethernet device.
nb_rx_descA pointer to a uint16_t where the number of receive descriptors stored.
nb_tx_descA pointer to a uint16_t where the number of transmit descriptors stored.
Returns
  • (0) if successful.
  • (-ENOTSUP, -ENODEV or -EINVAL) on failure.
Examples:
examples/bond/main.c, examples/distributor/main.c, examples/ethtool/ethtool-app/main.c, examples/ioat/ioatfwd.c, examples/ip_fragmentation/main.c, examples/ip_reassembly/main.c, examples/ipsec-secgw/ipsec-secgw.c, examples/ipv4_multicast/main.c, examples/kni/main.c, examples/l2fwd-cat/l2fwd-cat.c, examples/l2fwd-crypto/main.c, examples/l2fwd-event/l2fwd_common.c, examples/l2fwd-jobstats/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, examples/l3fwd-acl/main.c, examples/l3fwd-power/main.c, examples/l3fwd/main.c, examples/link_status_interrupt/main.c, examples/multi_process/client_server_mp/mp_server/init.c, examples/multi_process/symmetric_mp/main.c, examples/packet_ordering/main.c, examples/performance-thread/l3fwd-thread/main.c, examples/ptpclient/ptpclient.c, examples/qos_meter/main.c, examples/qos_sched/init.c, examples/rxtx_callbacks/main.c, examples/server_node_efd/server/init.c, examples/skeleton/basicfwd.c, examples/tep_termination/vxlan_setup.c, examples/vhost/main.c, examples/vmdq/main.c, and examples/vmdq_dcb/main.c.

◆ rte_eth_dev_pool_ops_supported()

int rte_eth_dev_pool_ops_supported ( uint16_t  port_id,
const char *  pool 
)

Test if a port supports specific mempool ops.

Parameters
port_idPort identifier of the Ethernet device.
[in]poolThe name of the pool operations to test.
Returns
  • 0: best mempool ops choice for this port.
  • 1: mempool ops are supported for this port.
  • -ENOTSUP: mempool ops not supported for this port.
  • -ENODEV: Invalid port Identifier.
  • -EINVAL: Pool param is null.

◆ rte_eth_dev_get_sec_ctx()

void* rte_eth_dev_get_sec_ctx ( uint16_t  port_id)

Get the security context for the Ethernet device.

Parameters
port_idPort identifier of the Ethernet device
Returns
  • NULL on error.
  • pointer to security context on success.
Examples:
examples/ipsec-secgw/ipsec-secgw.c, and examples/ipsec-secgw/ipsec.c.

◆ rte_eth_dev_hairpin_capability_get()

__rte_experimental int rte_eth_dev_hairpin_capability_get ( uint16_t  port_id,
struct rte_eth_hairpin_cap cap 
)
Warning
EXPERIMENTAL: this API may change, or be removed, without prior notice

Query the device hairpin capabilities.

Parameters
port_idThe port identifier of the Ethernet device.
capPointer to a structure that will hold the hairpin capabilities.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.

◆ rte_eth_rx_burst()

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 
)
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:

  • Initialize the rte_mbuf data structure associated with the RX descriptor according to the information provided by the NIC into that RX descriptor.
  • Store the rte_mbuf data structure into the next entry of the rx_pkts array.
  • Replenish the RX descriptor with a new rte_mbuf buffer allocated from the memory pool associated with the receive queue at initialization time.

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:

  • It allows a run-to-completion network stack engine to retrieve and to immediately process received packets in a fast burst-oriented approach, avoiding the overhead of unnecessary intermediate packet queue/dequeue operations.
  • Conversely, it also allows an asynchronous-oriented processing method to retrieve bursts of received packets and to immediately queue them for further parallel processing by another logical core, for instance. However, instead of having received packets being individually queued by the driver, this approach allows the caller of the rte_eth_rx_burst() function to queue a burst of retrieved packets at a time and therefore dramatically reduce the cost of enqueue/dequeue operations per packet.
  • It allows the rte_eth_rx_burst() function of the driver to take advantage of burst-oriented hardware features (CPU cache, prefetch instructions, and so on) to minimize the number of CPU cycles per packet.

To summarize, the proposed receive API enables many burst-oriented optimizations in both synchronous and asynchronous packet processing environments with no overhead in both cases.

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.

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe 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_pktsThe address of an array of pointers to rte_mbuf structures that must be large enough to store nb_pkts pointers in it.
nb_pktsThe maximum number of packets to retrieve.
Returns
The number of packets actually retrieved, which is the number of pointers to rte_mbuf structures effectively supplied to the rx_pkts array.
Examples:
examples/bbdev_app/main.c, examples/bond/main.c, examples/distributor/main.c, examples/ethtool/ethtool-app/main.c, examples/flow_classify/flow_classify.c, examples/flow_filtering/main.c, examples/ioat/ioatfwd.c, examples/ip_fragmentation/main.c, examples/ip_reassembly/main.c, examples/ipsec-secgw/ipsec-secgw.c, examples/ipv4_multicast/main.c, examples/kni/main.c, examples/l2fwd-cat/l2fwd-cat.c, examples/l2fwd-crypto/main.c, examples/l2fwd-event/l2fwd_poll.c, examples/l2fwd-jobstats/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, examples/l3fwd-acl/main.c, examples/l3fwd-power/main.c, examples/l3fwd/l3fwd_em.c, examples/l3fwd/l3fwd_lpm.c, examples/link_status_interrupt/main.c, examples/multi_process/client_server_mp/mp_server/main.c, examples/multi_process/symmetric_mp/main.c, examples/ntb/ntb_fwd.c, examples/packet_ordering/main.c, examples/performance-thread/l3fwd-thread/main.c, examples/ptpclient/ptpclient.c, examples/qos_meter/main.c, examples/qos_sched/app_thread.c, examples/rxtx_callbacks/main.c, examples/server_node_efd/server/main.c, examples/skeleton/basicfwd.c, examples/tep_termination/main.c, examples/tep_termination/vxlan_setup.c, examples/vhost/main.c, examples/vmdq/main.c, and examples/vmdq_dcb/main.c.

Definition at line 4394 of file rte_ethdev.h.

◆ rte_eth_rx_queue_count()

static int rte_eth_rx_queue_count ( uint16_t  port_id,
uint16_t  queue_id 
)
inlinestatic

Get the number of used descriptors of a rx queue

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe queue id on the specific port.
Returns
The number of used descriptors in the specific queue, or: (-EINVAL) if port_id or queue_id is invalid (-ENOTSUP) if the device does not support this function
Examples:
examples/l3fwd-power/main.c.

Definition at line 4449 of file rte_ethdev.h.

◆ rte_eth_rx_descriptor_done()

static int rte_eth_rx_descriptor_done ( uint16_t  port_id,
uint16_t  queue_id,
uint16_t  offset 
)
inlinestatic

Check if the DD bit of the specific RX descriptor in the queue has been set

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe queue id on the specific port.
offsetThe offset of the descriptor ID from tail.
Returns
  • (1) if the specific DD bit is set.
  • (0) if the specific DD bit is not set.
  • (-ENODEV) if port_id invalid.
  • (-ENOTSUP) if the device does not support this function

Definition at line 4478 of file rte_ethdev.h.

◆ rte_eth_rx_descriptor_status()

static int rte_eth_rx_descriptor_status ( uint16_t  port_id,
uint16_t  queue_id,
uint16_t  offset 
)
inlinestatic

Check the status of a Rx descriptor in the queue

It should be called in a similar context than the Rx function:

  • on a dataplane core
  • not concurrently on the same queue

Since it's a dataplane function, no check is performed on port_id and queue_id. The caller must therefore ensure that the port is enabled and the queue is configured and running.

Note: accessing to a random descriptor in the ring may trigger cache misses and have a performance impact.

Parameters
port_idA valid port identifier of the Ethernet device which.
queue_idA valid Rx queue identifier on this port.
offsetThe offset of the descriptor starting from tail (0 is the next packet to be received by the driver).
Returns
  • (RTE_ETH_RX_DESC_AVAIL): Descriptor is available for the hardware to receive a packet.
  • (RTE_ETH_RX_DESC_DONE): Descriptor is done, it is filled by hw, but not yet processed by the driver (i.e. in the receive queue).
  • (RTE_ETH_RX_DESC_UNAVAIL): Descriptor is unavailable, either hold by the driver and not yet returned to hw, or reserved by the hw.
  • (-EINVAL) bad descriptor offset.
  • (-ENOTSUP) if the device does not support this function.
  • (-ENODEV) bad port or queue (only if compiled with debug).

Definition at line 4525 of file rte_ethdev.h.

◆ rte_eth_tx_descriptor_status()

static int rte_eth_tx_descriptor_status ( uint16_t  port_id,
uint16_t  queue_id,
uint16_t  offset 
)
inlinestatic

Check the status of a Tx descriptor in the queue.

It should be called in a similar context than the Tx function:

  • on a dataplane core
  • not concurrently on the same queue

Since it's a dataplane function, no check is performed on port_id and queue_id. The caller must therefore ensure that the port is enabled and the queue is configured and running.

Note: accessing to a random descriptor in the ring may trigger cache misses and have a performance impact.

Parameters
port_idA valid port identifier of the Ethernet device which.
queue_idA valid Tx queue identifier on this port.
offsetThe offset of the descriptor starting from tail (0 is the place where the next packet will be send).
Returns
  • (RTE_ETH_TX_DESC_FULL) Descriptor is being processed by the hw, i.e. in the transmit queue.
  • (RTE_ETH_TX_DESC_DONE) Hardware is done with this descriptor, it can be reused by the driver.
  • (RTE_ETH_TX_DESC_UNAVAIL): Descriptor is unavailable, reserved by the driver or the hardware.
  • (-EINVAL) bad descriptor offset.
  • (-ENOTSUP) if the device does not support this function.
  • (-ENODEV) bad port or queue (only if compiled with debug).

Definition at line 4582 of file rte_ethdev.h.

◆ rte_eth_tx_burst()

static uint16_t rte_eth_tx_burst ( uint16_t  port_id,
uint16_t  queue_id,
struct rte_mbuf **  tx_pkts,
uint16_t  nb_pkts 
)
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:

  • Pick up the next available descriptor in the transmit ring.
  • Free the network buffer previously sent with that descriptor, if any.
  • Initialize the transmit descriptor with the information provided in the *rte_mbuf data structure.

In the case of a segmented packet composed of a list of rte_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 DEV_TX_OFFLOAD_MT_LOCKFREE capable, multiple threads can invoke this function concurrently on the same tx queue without SW lock.

See also
rte_eth_dev_info_get, struct rte_eth_txconf::offloads
rte_eth_tx_prepare to perform some prior checks or adjustments for offloads.
Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe 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_pktsThe address of an array of nb_pkts pointers to rte_mbuf structures which contain the output packets.
nb_pktsThe maximum number of packets to transmit.
Returns
The number of output packets actually stored in transmit descriptors of the transmit ring. The return value can be less than the value of the tx_pkts parameter when the transmit ring is full or has been filled up.
Examples:
examples/bbdev_app/main.c, examples/bond/main.c, examples/distributor/main.c, examples/ethtool/ethtool-app/main.c, examples/flow_classify/flow_classify.c, examples/ioat/ioatfwd.c, examples/ip_fragmentation/main.c, examples/ip_reassembly/main.c, examples/ipsec-secgw/ipsec-secgw.c, examples/ipv4_multicast/main.c, examples/kni/main.c, examples/l2fwd-cat/l2fwd-cat.c, examples/l2fwd-crypto/main.c, examples/multi_process/symmetric_mp/main.c, examples/ntb/ntb_fwd.c, examples/packet_ordering/main.c, examples/performance-thread/l3fwd-thread/main.c, examples/ptpclient/ptpclient.c, examples/qos_sched/app_thread.c, examples/rxtx_callbacks/main.c, examples/skeleton/basicfwd.c, examples/tep_termination/vxlan_setup.c, examples/vhost/main.c, examples/vmdq/main.c, and examples/vmdq_dcb/main.c.

Definition at line 4669 of file rte_ethdev.h.

◆ rte_eth_tx_prepare()

static uint16_t rte_eth_tx_prepare ( uint16_t  port_id,
uint16_t  queue_id,
struct rte_mbuf **  tx_pkts,
uint16_t  nb_pkts 
)
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:

  • Check if packet meets devices requirements for tx offloads.
  • Check limitations about number of segments.
  • Check additional requirements when debug is enabled.
  • Update and/or reset required checksums when tx offload is set for packet.

Since this function can modify packet data, provided mbufs must be safely writable (e.g. modified data cannot be in shared segment).

The rte_eth_tx_prepare() function returns the number of packets ready to be sent. A return value equal to nb_pkts means that all packets are valid and ready to be sent, otherwise stops processing on the first invalid packet and leaves the rest packets untouched.

When this functionality is not implemented in the driver, all packets are are returned untouched.

Parameters
port_idThe port identifier of the Ethernet device. The value must be a valid port id.
queue_idThe 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_pktsThe address of an array of nb_pkts pointers to rte_mbuf structures which contain the output packets.
nb_pktsThe maximum number of packets to process.
Returns
The number of packets correct and ready to be sent. The return value can be less than the value of the tx_pkts parameter when some packet doesn't meet devices requirements with rte_errno set appropriately:
  • EINVAL: offload flags are not correctly set
  • ENOTSUP: the offload feature is not supported by the hardware

Definition at line 4764 of file rte_ethdev.h.

◆ rte_eth_tx_buffer_flush()

static uint16_t rte_eth_tx_buffer_flush ( uint16_t  port_id,
uint16_t  queue_id,
struct rte_eth_dev_tx_buffer buffer 
)
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.

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe 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().
bufferBuffer of packets to be transmit.
Returns
The number of packets successfully sent to the Ethernet device. The error callback is called for any packets which could not be sent.
Examples:
examples/l2fwd-event/l2fwd_poll.c, examples/l2fwd-jobstats/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, examples/l3fwd-acl/main.c, examples/l3fwd-power/main.c, examples/link_status_interrupt/main.c, examples/multi_process/client_server_mp/mp_client/client.c, examples/qos_meter/main.c, and examples/server_node_efd/node/node.c.

Definition at line 4838 of file rte_ethdev.h.

◆ rte_eth_tx_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

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

Parameters
port_idThe port identifier of the Ethernet device.
queue_idThe 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().
bufferBuffer used to collect packets to be sent.
tx_pktPointer to the packet mbuf to be sent.
Returns
0 = packet has been buffered for later transmission N > 0 = packet has been buffered, and the buffer was subsequently flushed, causing N packets to be sent, and the error callback to be called for the rest.
Examples:
examples/l2fwd-event/l2fwd_poll.c, examples/l2fwd-jobstats/main.c, examples/l2fwd-keepalive/main.c, examples/l2fwd/main.c, examples/l3fwd-acl/main.c, examples/l3fwd-power/main.c, examples/link_status_interrupt/main.c, examples/multi_process/client_server_mp/mp_client/client.c, examples/packet_ordering/main.c, examples/qos_meter/main.c, and examples/server_node_efd/node/node.c.

Definition at line 4891 of file rte_ethdev.h.