DPDK  2.2.0
Data Structures | Macros | Typedefs | Enumerations | Functions
rte_ethdev.h File Reference
#include <stdint.h>
#include <rte_dev.h>
#include <rte_log.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
#include <rte_devargs.h>
#include "rte_ether.h"
#include "rte_eth_ctrl.h"
#include "rte_dev_info.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_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_txmode
struct  rte_eth_rxconf
struct  rte_eth_txconf
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_rxq_info
struct  rte_eth_txq_info
struct  rte_eth_xstats
struct  rte_eth_dcb_tc_queue_mapping
struct  rte_eth_dcb_info

Macros

#define ETH_LINK_SPEED_AUTONEG   0
#define ETH_LINK_SPEED_10   10
#define ETH_LINK_SPEED_100   100
#define ETH_LINK_SPEED_1000   1000
#define ETH_LINK_SPEED_10000   10000
#define ETH_LINK_SPEED_10G   10000
#define ETH_LINK_SPEED_20G   20000
#define ETH_LINK_SPEED_40G   40000
#define ETH_LINK_AUTONEG_DUPLEX   0
#define ETH_LINK_HALF_DUPLEX   1
#define ETH_LINK_FULL_DUPLEX   2
#define ETH_MQ_RX_RSS_FLAG   0x1
#define ETH_RSS   ETH_MQ_RX_RSS
#define ETH_DCB_NONE   ETH_MQ_TX_NONE
#define ETH_RSS_SCTP
#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_VLAN_STRIP_MASK   0x0001
#define ETH_VLAN_FILTER_MASK   0x0002
#define ETH_VLAN_EXTEND_MASK   0x0004
#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 ETH_TXQ_FLAGS_NOMULTSEGS   0x0001
#define ETH_TXQ_FLAGS_NOREFCOUNT   0x0002
#define ETH_TXQ_FLAGS_NOMULTMEMP   0x0004
#define ETH_TXQ_FLAGS_NOVLANOFFL   0x0100
#define ETH_TXQ_FLAGS_NOXSUMSCTP   0x0200
#define ETH_TXQ_FLAGS_NOXSUMUDP   0x0400
#define ETH_TXQ_FLAGS_NOXSUMTCP   0x0800
#define DEV_RX_OFFLOAD_VLAN_STRIP   0x00000001
#define DEV_TX_OFFLOAD_VLAN_INSERT   0x00000001
#define DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM   0x00000080
#define RTE_ETH_XSTATS_NAME_SIZE   64
#define RTE_ETH_QUEUE_STATE_STOPPED   0
#define RTE_ETH_DEV_DETACHABLE   0x0001
#define RTE_ETH_DEV_INTR_LSC   0x0002

Typedefs

typedef uint16_t(* rte_rx_callback_fn )(uint8_t port, 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 )(uint8_t port, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, void *user_param)
typedef void(* rte_eth_dev_cb_fn )(uint8_t port_id, enum rte_eth_event_type event, void *cb_arg)

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_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_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_type { RTE_ETH_DEV_UNKNOWN, RTE_ETH_DEV_PCI, RTE_ETH_DEV_VIRTUAL, RTE_ETH_DEV_MAX }
enum  rte_eth_event_type { RTE_ETH_EVENT_UNKNOWN, RTE_ETH_EVENT_INTR_LSC, RTE_ETH_EVENT_MAX }

Functions

uint8_t rte_eth_dev_count (void)
int rte_eth_dev_attach (const char *devargs, uint8_t *port_id)
int rte_eth_dev_detach (uint8_t port_id, char *devname)
int rte_eth_dev_configure (uint8_t port_id, uint16_t nb_rx_queue, uint16_t nb_tx_queue, const struct rte_eth_conf *eth_conf)
int rte_eth_rx_queue_setup (uint8_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)
int rte_eth_tx_queue_setup (uint8_t port_id, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf)
int rte_eth_dev_start (uint8_t port_id)
void rte_eth_dev_stop (uint8_t port_id)
int rte_eth_dev_set_link_up (uint8_t port_id)
int rte_eth_dev_set_link_down (uint8_t port_id)
void rte_eth_dev_close (uint8_t port_id)
void rte_eth_promiscuous_enable (uint8_t port_id)
void rte_eth_promiscuous_disable (uint8_t port_id)
int rte_eth_promiscuous_get (uint8_t port_id)
void rte_eth_allmulticast_enable (uint8_t port_id)
void rte_eth_allmulticast_disable (uint8_t port_id)
int rte_eth_allmulticast_get (uint8_t port_id)
void rte_eth_link_get (uint8_t port_id, struct rte_eth_link *link)
void rte_eth_link_get_nowait (uint8_t port_id, struct rte_eth_link *link)
int rte_eth_stats_get (uint8_t port_id, struct rte_eth_stats *stats)
void rte_eth_stats_reset (uint8_t port_id)
int rte_eth_xstats_get (uint8_t port_id, struct rte_eth_xstats *xstats, unsigned n)
void rte_eth_xstats_reset (uint8_t port_id)
int rte_eth_dev_set_tx_queue_stats_mapping (uint8_t port_id, uint16_t tx_queue_id, uint8_t stat_idx)
int rte_eth_dev_set_rx_queue_stats_mapping (uint8_t port_id, uint16_t rx_queue_id, uint8_t stat_idx)
void rte_eth_macaddr_get (uint8_t port_id, struct ether_addr *mac_addr)
void rte_eth_dev_info_get (uint8_t port_id, struct rte_eth_dev_info *dev_info)
int rte_eth_dev_get_mtu (uint8_t port_id, uint16_t *mtu)
int rte_eth_dev_set_mtu (uint8_t port_id, uint16_t mtu)
int rte_eth_dev_vlan_filter (uint8_t port_id, uint16_t vlan_id, int on)
int rte_eth_dev_set_vlan_strip_on_queue (uint8_t port_id, uint16_t rx_queue_id, int on)
int rte_eth_dev_set_vlan_ether_type (uint8_t port_id, uint16_t tag_type)
int rte_eth_dev_set_vlan_offload (uint8_t port_id, int offload_mask)
int rte_eth_dev_get_vlan_offload (uint8_t port_id)
int rte_eth_dev_set_vlan_pvid (uint8_t port_id, uint16_t pvid, int on)
static uint16_t rte_eth_rx_burst (uint8_t port_id, uint16_t queue_id, struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
static int rte_eth_rx_queue_count (uint8_t port_id, uint16_t queue_id)
static int rte_eth_rx_descriptor_done (uint8_t port_id, uint16_t queue_id, uint16_t offset)
static uint16_t rte_eth_tx_burst (uint8_t port_id, uint16_t queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
int rte_eth_dev_callback_register (uint8_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 (uint8_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 (uint8_t port_id, uint16_t queue_id)
int rte_eth_dev_rx_intr_disable (uint8_t port_id, uint16_t queue_id)
int rte_eth_dev_rx_intr_ctl (uint8_t port_id, int epfd, int op, void *data)
int rte_eth_dev_rx_intr_ctl_q (uint8_t port_id, uint16_t queue_id, int epfd, int op, void *data)
int rte_eth_led_on (uint8_t port_id)
int rte_eth_led_off (uint8_t port_id)
int rte_eth_dev_flow_ctrl_get (uint8_t port_id, struct rte_eth_fc_conf *fc_conf)
int rte_eth_dev_flow_ctrl_set (uint8_t port_id, struct rte_eth_fc_conf *fc_conf)
int rte_eth_dev_priority_flow_ctrl_set (uint8_t port_id, struct rte_eth_pfc_conf *pfc_conf)
int rte_eth_dev_mac_addr_add (uint8_t port, struct ether_addr *mac_addr, uint32_t pool)
int rte_eth_dev_mac_addr_remove (uint8_t port, struct ether_addr *mac_addr)
int rte_eth_dev_default_mac_addr_set (uint8_t port, struct ether_addr *mac_addr)
int rte_eth_dev_rss_reta_update (uint8_t port, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size)
int rte_eth_dev_rss_reta_query (uint8_t port, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size)
int rte_eth_dev_uc_hash_table_set (uint8_t port, struct ether_addr *addr, uint8_t on)
int rte_eth_dev_uc_all_hash_table_set (uint8_t port, uint8_t on)
int rte_eth_dev_set_vf_rxmode (uint8_t port, uint16_t vf, uint16_t rx_mode, uint8_t on)
int rte_eth_dev_set_vf_tx (uint8_t port, uint16_t vf, uint8_t on)
int rte_eth_dev_set_vf_rx (uint8_t port, uint16_t vf, uint8_t on)
int rte_eth_dev_set_vf_vlan_filter (uint8_t port, uint16_t vlan_id, uint64_t vf_mask, uint8_t vlan_on)
int rte_eth_mirror_rule_set (uint8_t port_id, struct rte_eth_mirror_conf *mirror_conf, uint8_t rule_id, uint8_t on)
int rte_eth_mirror_rule_reset (uint8_t port_id, uint8_t rule_id)
int rte_eth_set_queue_rate_limit (uint8_t port_id, uint16_t queue_idx, uint16_t tx_rate)
int rte_eth_set_vf_rate_limit (uint8_t port_id, uint16_t vf, uint16_t tx_rate, uint64_t q_msk)
int rte_eth_dev_bypass_init (uint8_t port)
int rte_eth_dev_bypass_state_show (uint8_t port, uint32_t *state)
int rte_eth_dev_bypass_state_set (uint8_t port, uint32_t *new_state)
int rte_eth_dev_bypass_event_show (uint8_t port, uint32_t event, uint32_t *state)
int rte_eth_dev_bypass_event_store (uint8_t port, uint32_t event, uint32_t state)
int rte_eth_dev_wd_timeout_store (uint8_t port, uint32_t timeout)
int rte_eth_dev_bypass_ver_show (uint8_t port, uint32_t *ver)
int rte_eth_dev_bypass_wd_timeout_show (uint8_t port, uint32_t *wd_timeout)
int rte_eth_dev_bypass_wd_reset (uint8_t port)
int rte_eth_dev_rss_hash_update (uint8_t port_id, struct rte_eth_rss_conf *rss_conf)
int rte_eth_dev_rss_hash_conf_get (uint8_t port_id, struct rte_eth_rss_conf *rss_conf)
int rte_eth_dev_udp_tunnel_add (uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp)
int rte_eth_dev_udp_tunnel_delete (uint8_t port_id, struct rte_eth_udp_tunnel *tunnel_udp)
int rte_eth_dev_filter_supported (uint8_t port_id, enum rte_filter_type filter_type)
int rte_eth_dev_filter_ctrl (uint8_t port_id, enum rte_filter_type filter_type, enum rte_filter_op filter_op, void *arg)
int rte_eth_dev_get_dcb_info (uint8_t port_id, struct rte_eth_dcb_info *dcb_info)
void * rte_eth_add_rx_callback (uint8_t port_id, uint16_t queue_id, rte_rx_callback_fn fn, void *user_param)
void * rte_eth_add_tx_callback (uint8_t port_id, uint16_t queue_id, rte_tx_callback_fn fn, void *user_param)
int rte_eth_remove_rx_callback (uint8_t port_id, uint16_t queue_id, struct rte_eth_rxtx_callback *user_cb)
int rte_eth_remove_tx_callback (uint8_t port_id, uint16_t queue_id, struct rte_eth_rxtx_callback *user_cb)
int rte_eth_rx_queue_info_get (uint8_t port_id, uint16_t queue_id, struct rte_eth_rxq_info *qinfo)
int rte_eth_tx_queue_info_get (uint8_t port_id, uint16_t queue_id, struct rte_eth_txq_info *qinfo)
int rte_eth_dev_get_reg_info (uint8_t port_id, struct rte_dev_reg_info *info)
int rte_eth_dev_get_eeprom_length (uint8_t port_id)
int rte_eth_dev_get_eeprom (uint8_t port_id, struct rte_dev_eeprom_info *info)
int rte_eth_dev_set_eeprom (uint8_t port_id, struct rte_dev_eeprom_info *info)
int rte_eth_dev_set_mc_addr_list (uint8_t port_id, struct ether_addr *mc_addr_set, uint32_t nb_mc_addr)
int rte_eth_timesync_enable (uint8_t port_id)
int rte_eth_timesync_disable (uint8_t port_id)
int rte_eth_timesync_read_rx_timestamp (uint8_t port_id, struct timespec *timestamp, uint32_t flags)
int rte_eth_timesync_read_tx_timestamp (uint8_t port_id, struct timespec *timestamp)
int rte_eth_timesync_adjust_time (uint8_t port_id, int64_t delta)
int rte_eth_timesync_read_time (uint8_t port_id, struct timespec *time)
int rte_eth_timesync_write_time (uint8_t port_id, const struct timespec *time)
void rte_eth_copy_pci_info (struct rte_eth_dev *eth_dev, struct rte_pci_device *pci_dev)
struct rte_memzonerte_eth_dma_zone_reserve (const struct rte_eth_dev *eth_dev, const char *name, uint16_t queue_id, size_t size, unsigned align, int socket_id)

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 tramsit and receive functions should not be invoked when the device 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:

- flow control settings
- receive mode configuration (promiscuous mode, hardware checksum mode,
  RSS/VMDQ settings etc.)
- VLAN filtering configuration
- 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 after 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

#define ETH_LINK_SPEED_AUTONEG   0

Auto-negotiate link speed.

Definition at line 253 of file rte_ethdev.h.

#define ETH_LINK_SPEED_10   10

10 megabits/second.

Definition at line 254 of file rte_ethdev.h.

#define ETH_LINK_SPEED_100   100

100 megabits/second.

Definition at line 255 of file rte_ethdev.h.

#define ETH_LINK_SPEED_1000   1000

1 gigabits/second.

Definition at line 256 of file rte_ethdev.h.

#define ETH_LINK_SPEED_10000   10000

10 gigabits/second.

Definition at line 257 of file rte_ethdev.h.

#define ETH_LINK_SPEED_10G   10000

alias of 10 gigabits/second.

Definition at line 258 of file rte_ethdev.h.

#define ETH_LINK_SPEED_20G   20000

20 gigabits/second.

Definition at line 259 of file rte_ethdev.h.

#define ETH_LINK_SPEED_40G   40000

40 gigabits/second.

Definition at line 260 of file rte_ethdev.h.

#define ETH_LINK_AUTONEG_DUPLEX   0

Auto-negotiate duplex.

Definition at line 262 of file rte_ethdev.h.

#define ETH_LINK_HALF_DUPLEX   1

Half-duplex connection.

Definition at line 263 of file rte_ethdev.h.

#define ETH_LINK_FULL_DUPLEX   2
#define ETH_MQ_RX_RSS_FLAG   0x1

Simple flags are used for rte_eth_conf.rxmode.mq_mode.

Definition at line 279 of file rte_ethdev.h.

#define ETH_RSS   ETH_MQ_RX_RSS

for rx mq mode backward compatible

Definition at line 312 of file rte_ethdev.h.

#define ETH_DCB_NONE   ETH_MQ_TX_NONE

for tx mq mode backward compatible

Examples:
qos_meter/main.c, qos_sched/init.c, and quota_watermark/qw/init.c.

Definition at line 330 of file rte_ethdev.h.

#define ETH_RSS_SCTP
Value:
( \
ETH_RSS_NONFRAG_IPV4_SCTP | \
ETH_RSS_NONFRAG_IPV6_SCTP)

Mask of valid RSS hash protocols

Examples:
distributor/main.c, and l3fwd-acl/main.c.

Definition at line 418 of file rte_ethdev.h.

#define ETH_VMDQ_MAX_VLAN_FILTERS   64

Maximum nb. of VMDQ vlan filters.

Definition at line 452 of file rte_ethdev.h.

#define ETH_DCB_NUM_USER_PRIORITIES   8

Maximum nb. of DCB priorities.

Examples:
vmdq_dcb/main.c.

Definition at line 453 of file rte_ethdev.h.

#define ETH_VMDQ_DCB_NUM_QUEUES   128

Maximum nb. of VMDQ DCB queues.

Examples:
vmdq_dcb/main.c.

Definition at line 454 of file rte_ethdev.h.

#define ETH_DCB_NUM_QUEUES   128

Maximum nb. of DCB queues.

Definition at line 455 of file rte_ethdev.h.

#define ETH_DCB_PG_SUPPORT   0x00000001

Priority Group(ETS) support.

Definition at line 458 of file rte_ethdev.h.

#define ETH_DCB_PFC_SUPPORT   0x00000002

Priority Flow Control support.

Definition at line 459 of file rte_ethdev.h.

#define ETH_VLAN_STRIP_OFFLOAD   0x0001

VLAN Strip On/Off

Definition at line 462 of file rte_ethdev.h.

#define ETH_VLAN_FILTER_OFFLOAD   0x0002

VLAN Filter On/Off

Definition at line 463 of file rte_ethdev.h.

#define ETH_VLAN_EXTEND_OFFLOAD   0x0004

VLAN Extend On/Off

Definition at line 464 of file rte_ethdev.h.

#define ETH_VLAN_STRIP_MASK   0x0001

VLAN Strip setting mask

Definition at line 467 of file rte_ethdev.h.

#define ETH_VLAN_FILTER_MASK   0x0002

VLAN Filter setting mask

Examples:
ethtool/lib/rte_ethtool.c.

Definition at line 468 of file rte_ethdev.h.

#define ETH_VLAN_EXTEND_MASK   0x0004

VLAN Extend setting mask

Definition at line 469 of file rte_ethdev.h.

#define ETH_VLAN_ID_MAX   0x0FFF

VLAN ID is in lower 12 bits

Definition at line 470 of file rte_ethdev.h.

#define ETH_NUM_RECEIVE_MAC_ADDR   128

Maximum nb. of receive mac addr.

Definition at line 473 of file rte_ethdev.h.

#define ETH_VMDQ_NUM_UC_HASH_ARRAY   128

Maximum nb. of UC hash array.

Definition at line 476 of file rte_ethdev.h.

#define ETH_VMDQ_ACCEPT_UNTAG   0x0001

accept untagged packets.

Examples:
ethtool/lib/rte_ethtool.c.

Definition at line 479 of file rte_ethdev.h.

#define ETH_VMDQ_ACCEPT_HASH_MC   0x0002

accept packets in multicast table .

Definition at line 480 of file rte_ethdev.h.

#define ETH_VMDQ_ACCEPT_HASH_UC   0x0004

accept packets in unicast table.

Definition at line 481 of file rte_ethdev.h.

#define ETH_VMDQ_ACCEPT_BROADCAST   0x0008

accept broadcast packets.

Examples:
vhost/main.c.

Definition at line 482 of file rte_ethdev.h.

#define ETH_VMDQ_ACCEPT_MULTICAST   0x0010

multicast promiscuous.

Examples:
vhost/main.c.

Definition at line 483 of file rte_ethdev.h.

#define ETH_MIRROR_MAX_VLANS   64

Maximum nb. of vlan per mirror rule

Definition at line 486 of file rte_ethdev.h.

#define ETH_MIRROR_VIRTUAL_POOL_UP   0x01

Virtual Pool uplink Mirroring.

Definition at line 488 of file rte_ethdev.h.

#define ETH_MIRROR_UPLINK_PORT   0x02

Uplink Port Mirroring.

Definition at line 489 of file rte_ethdev.h.

#define ETH_MIRROR_DOWNLINK_PORT   0x04

Downlink Port Mirroring.

Definition at line 490 of file rte_ethdev.h.

#define ETH_MIRROR_VLAN   0x08

VLAN Mirroring.

Definition at line 491 of file rte_ethdev.h.

#define ETH_MIRROR_VIRTUAL_POOL_DOWN   0x10

Virtual Pool downlink Mirroring.

Definition at line 492 of file rte_ethdev.h.

#define ETH_TXQ_FLAGS_NOMULTSEGS   0x0001

nb_segs=1 for all mbufs

Examples:
ip_pipeline/config_parse.c, ip_pipeline/init.c, and qos_sched/init.c.

Definition at line 633 of file rte_ethdev.h.

#define ETH_TXQ_FLAGS_NOREFCOUNT   0x0002

refcnt can be ignored

Definition at line 634 of file rte_ethdev.h.

#define ETH_TXQ_FLAGS_NOMULTMEMP   0x0004

all bufs come from same mempool

Definition at line 635 of file rte_ethdev.h.

#define ETH_TXQ_FLAGS_NOVLANOFFL   0x0100

disable VLAN offload

Examples:
vhost/main.c.

Definition at line 636 of file rte_ethdev.h.

#define ETH_TXQ_FLAGS_NOXSUMSCTP   0x0200

disable SCTP checksum offload

Definition at line 637 of file rte_ethdev.h.

#define ETH_TXQ_FLAGS_NOXSUMUDP   0x0400

disable UDP checksum offload

Definition at line 638 of file rte_ethdev.h.

#define ETH_TXQ_FLAGS_NOXSUMTCP   0x0800

disable TCP checksum offload

Definition at line 639 of file rte_ethdev.h.

#define DEV_RX_OFFLOAD_VLAN_STRIP   0x00000001

A structure used to retrieve the contextual information of an Ethernet device, such as the controlling driver of the device, its PCI context, etc... RX offload capabilities of a device.

Definition at line 807 of file rte_ethdev.h.

#define DEV_TX_OFFLOAD_VLAN_INSERT   0x00000001

TX offload capabilities of a device.

Definition at line 817 of file rte_ethdev.h.

#define DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM   0x00000080

Used for tunneling packet.

Definition at line 824 of file rte_ethdev.h.

#define RTE_ETH_XSTATS_NAME_SIZE   64

Maximum name length for extended statistics counters

Definition at line 878 of file rte_ethdev.h.

#define RTE_ETH_QUEUE_STATE_STOPPED   0

RX/TX queue states

Definition at line 927 of file rte_ethdev.h.

#define RTE_ETH_DEV_DETACHABLE   0x0001

Device supports hotplug detach

Definition at line 1616 of file rte_ethdev.h.

#define RTE_ETH_DEV_INTR_LSC   0x0002

Device supports link state interrupt

Definition at line 1618 of file rte_ethdev.h.

Typedef Documentation

typedef uint16_t(* rte_rx_callback_fn)(uint8_t port, 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
portThe 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.

Definition at line 1470 of file rte_ethdev.h.

typedef uint16_t(* rte_tx_callback_fn)(uint8_t port, 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
portThe 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 1494 of file rte_ethdev.h.

typedef void(* rte_eth_dev_cb_fn)(uint8_t port_id, enum rte_eth_event_type event, void *cb_arg)

user application callback to be registered for interrupts

Definition at line 2672 of file rte_ethdev.h.

Enumeration Type Documentation

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

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

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

Enumerator:
ETH_4_TCS 

4 TCs with DCB.

ETH_8_TCS 

8 TCs with DCB.

Definition at line 531 of file rte_ethdev.h.

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:
vhost/main.c, vhost_xen/main.c, and vmdq/main.c.

Definition at line 540 of file rte_ethdev.h.

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

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

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

The eth device type.

Enumerator:
RTE_ETH_DEV_UNKNOWN 

unknown device type

RTE_ETH_DEV_PCI 

Physical function and Virtual function of PCI devices

RTE_ETH_DEV_VIRTUAL 

non hardware device

RTE_ETH_DEV_MAX 

max value of this enum

Definition at line 1514 of file rte_ethdev.h.

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_MAX 

max value of this enum

Definition at line 2666 of file rte_ethdev.h.

Function Documentation

uint8_t rte_eth_dev_count ( void  )

Get the total number of Ethernet devices that have been successfully initialized by the [matching] Ethernet driver during the PCI probing phase. All devices whose port identifier is in the range [0, rte_eth_dev_count() - 1] can be operated on by network applications immediately after invoking rte_eal_init(). If the application unplugs a port using hotplug function, The enabled port numbers may be noncontiguous. In the case, the applications need to manage enabled port by themselves.

Returns
  • The total number of usable Ethernet devices.
Examples:
bond/main.c, distributor/main.c, dpdk_qat/main.c, ethtool/ethtool-app/ethapp.c, ethtool/ethtool-app/main.c, exception_path/main.c, ip_fragmentation/main.c, ip_reassembly/main.c, ipv4_multicast/main.c, kni/main.c, l2fwd-crypto/main.c, l2fwd-ivshmem/host/host.c, l2fwd-jobstats/main.c, l2fwd-keepalive/main.c, l2fwd/main.c, l3fwd-acl/main.c, l3fwd-power/main.c, l3fwd-vf/main.c, l3fwd/main.c, link_status_interrupt/main.c, multi_process/client_server_mp/mp_client/client.c, multi_process/client_server_mp/mp_server/init.c, multi_process/l2fwd_fork/main.c, multi_process/symmetric_mp/main.c, netmap_compat/bridge/bridge.c, packet_ordering/main.c, performance-thread/l3fwd-thread/main.c, ptpclient/ptpclient.c, qos_sched/init.c, quota_watermark/qw/init.c, rxtx_callbacks/main.c, skeleton/basicfwd.c, tep_termination/main.c, tep_termination/vxlan_setup.c, vhost/main.c, vhost_xen/main.c, vmdq/main.c, and vmdq_dcb/main.c.
int rte_eth_dev_attach ( const char *  devargs,
uint8_t *  port_id 
)

Attach a new Ethernet device specified by aruguments.

Parameters
devargsA pointer to a strings array describing the new device to be attached. The strings should be a pci address like '0000:01:00.0' or virtual device name like 'eth_pcap0'.
port_idA pointer to a port identifier actually attached.
Returns
0 on success and port_id is filled, negative on error
int rte_eth_dev_detach ( uint8_t  port_id,
char *  devname 
)

Detach a Ethernet device specified by port identifier. This function must be called when the device is in the closed state.

Parameters
port_idThe port identifier of the device to detach.
devnameA pointer to a device name actually detached.
Returns
0 on success and devname is filled, negative on error
int rte_eth_dev_configure ( uint8_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 Receive Side Scaling (RSS) configuration when using multiple RX queues per port.

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:
bond/main.c, distributor/main.c, dpdk_qat/main.c, ethtool/ethtool-app/main.c, exception_path/main.c, ip_fragmentation/main.c, ip_pipeline/init.c, ip_reassembly/main.c, ipv4_multicast/main.c, kni/main.c, l2fwd-crypto/main.c, l2fwd-ivshmem/host/host.c, l2fwd-jobstats/main.c, l2fwd-keepalive/main.c, l2fwd/main.c, l3fwd-acl/main.c, l3fwd-power/main.c, l3fwd-vf/main.c, l3fwd/main.c, link_status_interrupt/main.c, load_balancer/init.c, multi_process/client_server_mp/mp_server/init.c, multi_process/l2fwd_fork/main.c, multi_process/symmetric_mp/main.c, netmap_compat/lib/compat_netmap.c, packet_ordering/main.c, performance-thread/l3fwd-thread/main.c, ptpclient/ptpclient.c, qos_meter/main.c, qos_sched/init.c, quota_watermark/qw/init.c, rxtx_callbacks/main.c, skeleton/basicfwd.c, tep_termination/vxlan_setup.c, vhost/main.c, vhost_xen/main.c, vmdq/main.c, and vmdq_dcb/main.c.
int rte_eth_rx_queue_setup ( uint8_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.
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.
  • -EINVAL: The size of network buffers which can be allocated from the 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:
bond/main.c, distributor/main.c, dpdk_qat/main.c, ethtool/ethtool-app/main.c, ethtool/lib/rte_ethtool.c, exception_path/main.c, ip_fragmentation/main.c, ip_pipeline/init.c, ip_reassembly/main.c, ipv4_multicast/main.c, kni/main.c, l2fwd-crypto/main.c, l2fwd-ivshmem/host/host.c, l2fwd-jobstats/main.c, l2fwd-keepalive/main.c, l2fwd/main.c, l3fwd-acl/main.c, l3fwd-power/main.c, l3fwd-vf/main.c, l3fwd/main.c, link_status_interrupt/main.c, load_balancer/init.c, multi_process/client_server_mp/mp_server/init.c, multi_process/l2fwd_fork/main.c, multi_process/symmetric_mp/main.c, netmap_compat/lib/compat_netmap.c, packet_ordering/main.c, performance-thread/l3fwd-thread/main.c, ptpclient/ptpclient.c, qos_meter/main.c, qos_sched/init.c, quota_watermark/qw/init.c, rxtx_callbacks/main.c, skeleton/basicfwd.c, tep_termination/vxlan_setup.c, vhost/main.c, vhost_xen/main.c, vmdq/main.c, and vmdq_dcb/main.c.
int rte_eth_tx_queue_setup ( uint8_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 RX 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 txq_flags member contains flags to pass to the TX queue setup function to configure the behavior of the TX queue. This should be set to 0 if no special configuration is required.

    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:
bond/main.c, distributor/main.c, dpdk_qat/main.c, ethtool/ethtool-app/main.c, ethtool/lib/rte_ethtool.c, exception_path/main.c, ip_fragmentation/main.c, ip_pipeline/init.c, ip_reassembly/main.c, ipv4_multicast/main.c, kni/main.c, l2fwd-crypto/main.c, l2fwd-ivshmem/host/host.c, l2fwd-jobstats/main.c, l2fwd-keepalive/main.c, l2fwd/main.c, l3fwd-acl/main.c, l3fwd-power/main.c, l3fwd-vf/main.c, l3fwd/main.c, link_status_interrupt/main.c, load_balancer/init.c, multi_process/client_server_mp/mp_server/init.c, multi_process/l2fwd_fork/main.c, multi_process/symmetric_mp/main.c, netmap_compat/lib/compat_netmap.c, packet_ordering/main.c, performance-thread/l3fwd-thread/main.c, ptpclient/ptpclient.c, qos_meter/main.c, qos_sched/init.c, quota_watermark/qw/init.c, rxtx_callbacks/main.c, skeleton/basicfwd.c, tep_termination/vxlan_setup.c, vhost/main.c, vhost_xen/main.c, vmdq/main.c, and vmdq_dcb/main.c.
int rte_eth_dev_start ( uint8_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. 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:
bond/main.c, distributor/main.c, dpdk_qat/main.c, ethtool/ethtool-app/main.c, ethtool/lib/rte_ethtool.c, exception_path/main.c, ip_fragmentation/main.c, ip_pipeline/init.c, ip_reassembly/main.c, ipv4_multicast/main.c, kni/main.c, l2fwd-crypto/main.c, l2fwd-ivshmem/host/host.c, l2fwd-jobstats/main.c, l2fwd-keepalive/main.c, l2fwd/main.c, l3fwd-acl/main.c, l3fwd-power/main.c, l3fwd-vf/main.c, l3fwd/main.c, link_status_interrupt/main.c, load_balancer/init.c, multi_process/client_server_mp/mp_server/init.c, multi_process/l2fwd_fork/main.c, multi_process/symmetric_mp/main.c, netmap_compat/lib/compat_netmap.c, packet_ordering/main.c, performance-thread/l3fwd-thread/main.c, ptpclient/ptpclient.c, qos_meter/main.c, qos_sched/init.c, quota_watermark/qw/init.c, rxtx_callbacks/main.c, skeleton/basicfwd.c, tep_termination/vxlan_setup.c, vhost/main.c, vhost_xen/main.c, vmdq/main.c, and vmdq_dcb/main.c.
void rte_eth_dev_stop ( uint8_t  port_id)

Stop an Ethernet device. The device can be restarted with a call to rte_eth_dev_start()

Parameters
port_idThe port identifier of the Ethernet device.
Examples:
ethtool/lib/rte_ethtool.c, kni/main.c, multi_process/l2fwd_fork/main.c, netmap_compat/lib/compat_netmap.c, and quota_watermark/qw/init.c.
int rte_eth_dev_set_link_up ( uint8_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:
ip_pipeline/init.c.
int rte_eth_dev_set_link_down ( uint8_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:
ip_pipeline/init.c.
void rte_eth_dev_close ( uint8_t  port_id)

Close a stopped Ethernet device. The device cannot be restarted! The function frees all resources except for needed by the closed state. To free these resources, call rte_eth_dev_detach().

Parameters
port_idThe port identifier of the Ethernet device.
Examples:
l3fwd-vf/main.c.
void rte_eth_promiscuous_enable ( uint8_t  port_id)
void rte_eth_promiscuous_disable ( uint8_t  port_id)

Disable receipt in promiscuous mode for an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
int rte_eth_promiscuous_get ( uint8_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
void rte_eth_allmulticast_enable ( uint8_t  port_id)

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

Parameters
port_idThe port identifier of the Ethernet device.
void rte_eth_allmulticast_disable ( uint8_t  port_id)

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

Parameters
port_idThe port identifier of the Ethernet device.
int rte_eth_allmulticast_get ( uint8_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
void rte_eth_link_get ( uint8_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.
Examples:
dpdk_qat/main.c, ethtool/lib/rte_ethtool.c, ip_pipeline/init.c, and qos_sched/init.c.
void rte_eth_link_get_nowait ( uint8_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.
Examples:
distributor/main.c, exception_path/main.c, ip_fragmentation/main.c, ip_reassembly/main.c, ipv4_multicast/main.c, kni/main.c, l2fwd-crypto/main.c, l2fwd-ivshmem/host/host.c, l2fwd-jobstats/main.c, l2fwd-keepalive/main.c, l2fwd/main.c, l3fwd-acl/main.c, l3fwd-power/main.c, l3fwd/main.c, link_status_interrupt/main.c, load_balancer/init.c, multi_process/client_server_mp/mp_server/init.c, multi_process/l2fwd_fork/main.c, multi_process/symmetric_mp/main.c, and performance-thread/l3fwd-thread/main.c.
int rte_eth_stats_get ( uint8_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:
distributor/main.c, ethtool/lib/rte_ethtool.c, ip_pipeline/pipeline/pipeline_common_fe.c, load_balancer/runtime.c, packet_ordering/main.c, and qos_sched/main.c.
void rte_eth_stats_reset ( uint8_t  port_id)

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

Parameters
port_idThe port identifier of the Ethernet device.
int rte_eth_xstats_get ( uint8_t  port_id,
struct rte_eth_xstats xstats,
unsigned  n 
)

Retrieve extended statistics of an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
xstatsA pointer to a table of structure of type rte_eth_xstats to be filled with device statistics names and values. This parameter can be set to NULL if n is 0.
nThe size of the stats table, which should be large enough to store all the statistics of the device.
Returns
  • positive value lower or equal to n: success. The return value is the number of entries filled in the stats table.
  • 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.
  • negative value on error (invalid port id)
void rte_eth_xstats_reset ( uint8_t  port_id)

Reset extended statistics of an Ethernet device.

Parameters
port_idThe port identifier of the Ethernet device.
int rte_eth_dev_set_tx_queue_stats_mapping ( uint8_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_MAX_ETHPORT_QUEUE_STATS_MAPS - 1].
Returns
Zero if successful. Non-zero otherwise.
int rte_eth_dev_set_rx_queue_stats_mapping ( uint8_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_MAX_ETHPORT_QUEUE_STATS_MAPS - 1].
Returns
Zero if successful. Non-zero otherwise.
void rte_eth_macaddr_get ( uint8_t  port_id,
struct ether_addr mac_addr 
)
void rte_eth_dev_info_get ( uint8_t  port_id,
struct rte_eth_dev_info *  dev_info 
)
int rte_eth_dev_get_mtu ( uint8_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.
int rte_eth_dev_set_mtu ( uint8_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.
  • (-EINVAL) if mtu invalid.
Examples:
ethtool/lib/rte_ethtool.c.
int rte_eth_dev_vlan_filter ( uint8_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.
  • (-ENOSUP) if hardware-assisted VLAN filtering not configured.
  • (-ENODEV) if port_id invalid.
  • (-ENOSYS) if VLAN filtering on port_id disabled.
  • (-EINVAL) if vlan_id > 4095.
Examples:
ethtool/lib/rte_ethtool.c.
int rte_eth_dev_set_vlan_strip_on_queue ( uint8_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.
  • (-ENOSUP) if hardware-assisted VLAN stripping not configured.
  • (-ENODEV) if port_id invalid.
  • (-EINVAL) if rx_queue_id invalid.
Examples:
vhost/main.c, and vhost_xen/main.c.
int rte_eth_dev_set_vlan_ether_type ( uint8_t  port_id,
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.
tag_typeThe Tag Protocol ID
Returns
  • (0) if successful.
  • (-ENOSUP) if hardware-assisted VLAN TPID setup is not supported.
  • (-ENODEV) if port_id invalid.
int rte_eth_dev_set_vlan_offload ( uint8_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
Returns
  • (0) if successful.
  • (-ENOSUP) if hardware-assisted VLAN filtering not configured.
  • (-ENODEV) if port_id invalid.
Examples:
ethtool/lib/rte_ethtool.c.
int rte_eth_dev_get_vlan_offload ( uint8_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
  • (-ENODEV) if port_id invalid.
int rte_eth_dev_set_vlan_pvid ( uint8_t  port_id,
uint16_t  pvid,
int  on 
)

Set port based TX VLAN insersion on or off.

Parameters
port_idThe port identifier of the Ethernet device.
pvidPort based TX VLAN identifier togeth with user priority.
onTurn on or off the port based TX VLAN insertion.
Returns
  • (0) if successful.
  • negative if failed.
static uint16_t rte_eth_rx_burst ( uint8_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 invoker 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:
bond/main.c, distributor/main.c, dpdk_qat/main.c, ethtool/ethtool-app/main.c, exception_path/main.c, ip_fragmentation/main.c, ip_reassembly/main.c, ipv4_multicast/main.c, kni/main.c, l2fwd-crypto/main.c, l2fwd-ivshmem/host/host.c, l2fwd-jobstats/main.c, l2fwd-keepalive/main.c, l2fwd/main.c, l3fwd-acl/main.c, l3fwd-power/main.c, l3fwd-vf/main.c, l3fwd/main.c, link_status_interrupt/main.c, load_balancer/runtime.c, multi_process/client_server_mp/mp_server/main.c, multi_process/l2fwd_fork/main.c, multi_process/symmetric_mp/main.c, netmap_compat/lib/compat_netmap.c, packet_ordering/main.c, performance-thread/l3fwd-thread/main.c, ptpclient/ptpclient.c, qos_meter/main.c, qos_sched/app_thread.c, quota_watermark/qw/main.c, rxtx_callbacks/main.c, skeleton/basicfwd.c, tep_termination/main.c, tep_termination/vxlan_setup.c, vhost/main.c, vhost_xen/main.c, vmdq/main.c, and vmdq_dcb/main.c.

Definition at line 2496 of file rte_ethdev.h.

static int rte_eth_rx_queue_count ( uint8_t  port_id,
uint16_t  queue_id 
)
inlinestatic

Get the number of used descriptors in a specific 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 is invalid (-ENOTSUP) if the device does not support this function

Definition at line 2541 of file rte_ethdev.h.

static int rte_eth_rx_descriptor_done ( uint8_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
Examples:
l3fwd-power/main.c.

Definition at line 2565 of file rte_ethdev.h.

static uint16_t rte_eth_tx_burst ( uint8_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. 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.

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:
bond/main.c, distributor/main.c, dpdk_qat/main.c, ethtool/ethtool-app/main.c, exception_path/main.c, ip_fragmentation/main.c, ip_reassembly/main.c, ipv4_multicast/main.c, kni/main.c, l2fwd-crypto/main.c, l2fwd-ivshmem/host/host.c, l2fwd-jobstats/main.c, l2fwd-keepalive/main.c, l2fwd/main.c, l3fwd-acl/main.c, l3fwd-power/main.c, l3fwd-vf/main.c, l3fwd/main.c, link_status_interrupt/main.c, load_balancer/runtime.c, multi_process/client_server_mp/mp_client/client.c, multi_process/l2fwd_fork/main.c, multi_process/symmetric_mp/main.c, netmap_compat/lib/compat_netmap.c, packet_ordering/main.c, performance-thread/l3fwd-thread/main.c, ptpclient/ptpclient.c, qos_meter/main.c, qos_sched/app_thread.c, quota_watermark/qw/main.c, rxtx_callbacks/main.c, skeleton/basicfwd.c, tep_termination/vxlan_setup.c, vhost/main.c, vhost_xen/main.c, vmdq/main.c, and vmdq_dcb/main.c.

Definition at line 2633 of file rte_ethdev.h.

int rte_eth_dev_callback_register ( uint8_t  port_id,
enum rte_eth_event_type  event,
rte_eth_dev_cb_fn  cb_fn,
void *  cb_arg 
)

Register a callback function for specific port id.

Parameters
port_idPort id.
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:
link_status_interrupt/main.c.
int rte_eth_dev_callback_unregister ( uint8_t  port_id,
enum rte_eth_event_type  event,
rte_eth_dev_cb_fn  cb_fn,
void *  cb_arg 
)

Unregister a callback function for specific port id.

Parameters
port_idPort id.
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.
int rte_eth_dev_rx_intr_enable ( uint8_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 packect 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.
Examples:
l3fwd-power/main.c.
int rte_eth_dev_rx_intr_disable ( uint8_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.
Examples:
l3fwd-power/main.c.
int rte_eth_dev_rx_intr_ctl ( uint8_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.
int rte_eth_dev_rx_intr_ctl_q ( uint8_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:
l3fwd-power/main.c.
int rte_eth_led_on ( uint8_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.
int rte_eth_led_off ( uint8_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.
int rte_eth_dev_flow_ctrl_get ( uint8_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.
Examples:
ethtool/lib/rte_ethtool.c.
int rte_eth_dev_flow_ctrl_set ( uint8_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
Examples:
ethtool/lib/rte_ethtool.c, and quota_watermark/qw/init.c.
int rte_eth_dev_priority_flow_ctrl_set ( uint8_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
int rte_eth_dev_mac_addr_add ( uint8_t  port,
struct 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
portThe 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.
  • (-ENOSPC) if no more MAC addresses can be added.
  • (-EINVAL) if MAC address is invalid.
Examples:
vhost/main.c, vhost_xen/main.c, and vmdq/main.c.
int rte_eth_dev_mac_addr_remove ( uint8_t  port,
struct ether_addr mac_addr 
)

Remove a MAC address from the internal array of addresses.

Parameters
portThe 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:
vhost/main.c, and vhost_xen/main.c.
int rte_eth_dev_default_mac_addr_set ( uint8_t  port,
struct ether_addr mac_addr 
)

Set the default MAC address.

Parameters
portThe 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:
ethtool/lib/rte_ethtool.c.
int rte_eth_dev_rss_reta_update ( uint8_t  port,
struct rte_eth_rss_reta_entry64 reta_conf,
uint16_t  reta_size 
)

Update Redirection Table(RETA) of Receive Side Scaling of Ethernet device.

Parameters
portThe 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.
int rte_eth_dev_rss_reta_query ( uint8_t  port,
struct rte_eth_rss_reta_entry64 reta_conf,
uint16_t  reta_size 
)

Query Redirection Table(RETA) of Receive Side Scaling of Ethernet device.

Parameters
portThe port identifier of the Ethernet device.
reta_confRETA to query.
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.
int rte_eth_dev_uc_hash_table_set ( uint8_t  port,
struct 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
portThe 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.
  • (-EINVAL) if bad parameter.
int rte_eth_dev_uc_all_hash_table_set ( uint8_t  port,
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
portThe 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.
  • (-EINVAL) if bad parameter.
int rte_eth_dev_set_vf_rxmode ( uint8_t  port,
uint16_t  vf,
uint16_t  rx_mode,
uint8_t  on 
)

Set RX L2 Filtering mode of a VF of an Ethernet device.

Parameters
portThe port identifier of the Ethernet device.
vfVF id.
rx_modeThe RX mode mask, which is one or more of accepting Untagged Packets, packets that match the PFUTA table, Broadcast and Multicast Promiscuous. ETH_VMDQ_ACCEPT_UNTAG,ETH_VMDQ_ACCEPT_HASH_UC, ETH_VMDQ_ACCEPT_BROADCAST and ETH_VMDQ_ACCEPT_MULTICAST will be used in rx_mode.
on1 - Enable a VF RX mode. 0 - Disable a VF RX mode.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
Examples:
ethtool/lib/rte_ethtool.c.
int rte_eth_dev_set_vf_tx ( uint8_t  port,
uint16_t  vf,
uint8_t  on 
)

Enable or disable a VF traffic transmit of the Ethernet device.

Parameters
portThe port identifier of the Ethernet device.
vfVF id.
on1 - Enable a VF traffic transmit. 0 - Disable a VF traffic transmit.
Returns
  • (0) if successful.
  • (-ENODEV) if port_id invalid.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
int rte_eth_dev_set_vf_rx ( uint8_t  port,
uint16_t  vf,
uint8_t  on 
)

Enable or disable a VF traffic receive of an Ethernet device.

Parameters
portThe port identifier of the Ethernet device.
vfVF id.
on1 - Enable a VF traffic receive. 0 - Disable a VF traffic receive.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-ENODEV) if port_id invalid.
  • (-EINVAL) if bad parameter.
int rte_eth_dev_set_vf_vlan_filter ( uint8_t  port,
uint16_t  vlan_id,
uint64_t  vf_mask,
uint8_t  vlan_on 
)

Enable/Disable hardware VF VLAN filtering by an Ethernet device of received VLAN packets tagged with a given VLAN Tag Identifier.

Parameters
portid The port identifier of the Ethernet device.
vlan_idThe VLAN Tag Identifier whose filtering must be enabled or disabled.
vf_maskBitmap listing which VFs participate in the VLAN filtering.
vlan_on1 - Enable VFs VLAN filtering. 0 - Disable VFs VLAN filtering.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-ENODEV) if port_id invalid.
  • (-EINVAL) if bad parameter.
int rte_eth_mirror_rule_set ( uint8_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.
  • (-EINVAL) if the mr_conf information is not correct.
int rte_eth_mirror_rule_reset ( uint8_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.
  • (-EINVAL) if bad parameter.
int rte_eth_set_queue_rate_limit ( uint8_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.
  • (-EINVAL) if bad parameter.
int rte_eth_set_vf_rate_limit ( uint8_t  port_id,
uint16_t  vf,
uint16_t  tx_rate,
uint64_t  q_msk 
)

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

Parameters
port_idThe port identifier of the Ethernet device.
vfVF id.
tx_rateThe tx rate allocated from the total link speed for this VF id.
q_mskThe queue mask which need to set the rate.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support this feature.
  • (-ENODEV) if port_id invalid.
  • (-EINVAL) if bad parameter.
int rte_eth_dev_bypass_init ( uint8_t  port)

Initialize bypass logic. This function needs to be called before executing any other bypass API.

Parameters
portThe port identifier of the Ethernet device.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
int rte_eth_dev_bypass_state_show ( uint8_t  port,
uint32_t *  state 
)

Return bypass state.

Parameters
portThe port identifier of the Ethernet device.
stateThe return bypass state.
  • (1) Normal mode
  • (2) Bypass mode
  • (3) Isolate mode
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
int rte_eth_dev_bypass_state_set ( uint8_t  port,
uint32_t *  new_state 
)

Set bypass state

Parameters
portThe port identifier of the Ethernet device.
new_stateThe current bypass state.
  • (1) Normal mode
  • (2) Bypass mode
  • (3) Isolate mode
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
int rte_eth_dev_bypass_event_show ( uint8_t  port,
uint32_t  event,
uint32_t *  state 
)

Return bypass state when given event occurs.

Parameters
portThe port identifier of the Ethernet device.
eventThe bypass event
  • (1) Main power on (power button is pushed)
  • (2) Auxiliary power on (power supply is being plugged)
  • (3) Main power off (system shutdown and power supply is left plugged in)
  • (4) Auxiliary power off (power supply is being unplugged)
  • (5) Display or set the watchdog timer
stateThe bypass state when given event occurred.
  • (1) Normal mode
  • (2) Bypass mode
  • (3) Isolate mode
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
int rte_eth_dev_bypass_event_store ( uint8_t  port,
uint32_t  event,
uint32_t  state 
)

Set bypass state when given event occurs.

Parameters
portThe port identifier of the Ethernet device.
eventThe bypass event
  • (1) Main power on (power button is pushed)
  • (2) Auxiliary power on (power supply is being plugged)
  • (3) Main power off (system shutdown and power supply is left plugged in)
  • (4) Auxiliary power off (power supply is being unplugged)
  • (5) Display or set the watchdog timer
stateThe assigned state when given event occurs.
  • (1) Normal mode
  • (2) Bypass mode
  • (3) Isolate mode
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
int rte_eth_dev_wd_timeout_store ( uint8_t  port,
uint32_t  timeout 
)

Set bypass watchdog timeout count.

Parameters
portThe port identifier of the Ethernet device.
timeoutThe timeout to be set.
  • (0) 0 seconds (timer is off)
  • (1) 1.5 seconds
  • (2) 2 seconds
  • (3) 3 seconds
  • (4) 4 seconds
  • (5) 8 seconds
  • (6) 16 seconds
  • (7) 32 seconds
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
int rte_eth_dev_bypass_ver_show ( uint8_t  port,
uint32_t *  ver 
)

Get bypass firmware version.

Parameters
portThe port identifier of the Ethernet device.
verThe firmware version
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
int rte_eth_dev_bypass_wd_timeout_show ( uint8_t  port,
uint32_t *  wd_timeout 
)

Return bypass watchdog timeout in seconds

Parameters
portThe port identifier of the Ethernet device.
wd_timeoutThe return watchdog timeout. "0" represents timer expired
  • (0) 0 seconds (timer is off)
  • (1) 1.5 seconds
  • (2) 2 seconds
  • (3) 3 seconds
  • (4) 4 seconds
  • (5) 8 seconds
  • (6) 16 seconds
  • (7) 32 seconds
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
int rte_eth_dev_bypass_wd_reset ( uint8_t  port)

Reset bypass watchdog timer

Parameters
portThe port identifier of the Ethernet device.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
int rte_eth_dev_rss_hash_update ( uint8_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.
  • (-ENOTSUP) if hardware doesn't support.
  • (-EINVAL) if bad parameter.
int rte_eth_dev_rss_hash_conf_get ( uint8_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.
  • (-ENOTSUP) if hardware doesn't support RSS.
int rte_eth_dev_udp_tunnel_add ( uint8_t  port_id,
struct rte_eth_udp_tunnel tunnel_udp 
)

Add UDP tunneling port of an Ethernet device for filtering a specific tunneling packet by UDP port number.

Parameters
port_idThe port identifier of the Ethernet device.
tunnel_udpUDP tunneling configuration.
Returns
  • (0) if successful.
  • (-ENODEV) if port identifier is invalid.
  • (-ENOTSUP) if hardware doesn't support tunnel type.
Examples:
tep_termination/vxlan_setup.c.
int rte_eth_dev_udp_tunnel_delete ( uint8_t  port_id,
struct rte_eth_udp_tunnel tunnel_udp 
)

Detete UDP tunneling port configuration of Ethernet device

Parameters
port_idThe port identifier of the Ethernet device.
tunnel_udpUDP tunneling configuration.
Returns
  • (0) if successful.
  • (-ENODEV) if port identifier is invalid.
  • (-ENOTSUP) if hardware doesn't support tunnel type.
int rte_eth_dev_filter_supported ( uint8_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.
int rte_eth_dev_filter_ctrl ( uint8_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.
  • others depends on the specific operations implementation.
Examples:
ip_pipeline/init.c, and tep_termination/vxlan_setup.c.
int rte_eth_dev_get_dcb_info ( uint8_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.
  • (-ENOTSUP) if hardware doesn't support.
void* rte_eth_add_rx_callback ( uint8_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.
Returns
NULL on error. On success, a pointer value which can later be used to remove the callback.
Examples:
rxtx_callbacks/main.c.
void* rte_eth_add_tx_callback ( uint8_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.
Returns
NULL on error. On success, a pointer value which can later be used to remove the callback.
Examples:
rxtx_callbacks/main.c.
int rte_eth_remove_rx_callback ( uint8_t  port_id,
uint16_t  queue_id,
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.
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.
int rte_eth_remove_tx_callback ( uint8_t  port_id,
uint16_t  queue_id,
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.
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.
int rte_eth_rx_queue_info_get ( uint8_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.
Examples:
ethtool/lib/rte_ethtool.c.
int rte_eth_tx_queue_info_get ( uint8_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.
Examples:
ethtool/lib/rte_ethtool.c.
int rte_eth_dev_get_reg_info ( uint8_t  port_id,
struct rte_dev_reg_info *  info 
)

Retrieve device registers and register attributes

Parameters
port_idThe port identifier of the Ethernet device.
infoThe template includes buffer for register data and attribute to be filled.
Returns
  • (0) if successful.
  • (-ENOTSUP) if hardware doesn't support.
  • (-ENODEV) if port_id invalid.
  • others depends on the specific operations implementation.
Examples:
ethtool/lib/rte_ethtool.c.
int rte_eth_dev_get_eeprom_length ( uint8_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.
  • others depends on the specific operations implementation.
Examples:
ethtool/lib/rte_ethtool.c.
int rte_eth_dev_get_eeprom ( uint8_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.
  • (-ENODEV) if port_id invalid.
  • others depends on the specific operations implementation.
Examples:
ethtool/lib/rte_ethtool.c.
int rte_eth_dev_set_eeprom ( uint8_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.
  • (-ENODEV) if port_id invalid.
  • others depends on the specific operations implementation.
Examples:
ethtool/lib/rte_ethtool.c.
int rte_eth_dev_set_mc_addr_list ( uint8_t  port_id,
struct 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.
  • (-ENOTSUP) if PMD of port_id doesn't support multicast filtering.
  • (-ENOSPC) if port_id has not enough multicast filtering resources.
int rte_eth_timesync_enable ( uint8_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.
  • -ENOTSUP: The function is not supported by the Ethernet driver.
Examples:
ptpclient/ptpclient.c.
int rte_eth_timesync_disable ( uint8_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.
  • -ENOTSUP: The function is not supported by the Ethernet driver.
int rte_eth_timesync_read_rx_timestamp ( uint8_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.
  • -ENOTSUP: The function is not supported by the Ethernet driver.
Examples:
ptpclient/ptpclient.c.
int rte_eth_timesync_read_tx_timestamp ( uint8_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.
  • -ENOTSUP: The function is not supported by the Ethernet driver.
Examples:
ptpclient/ptpclient.c.
int rte_eth_timesync_adjust_time ( uint8_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.
  • -ENOTSUP: The function is not supported by the Ethernet driver.
Examples:
ptpclient/ptpclient.c.
int rte_eth_timesync_read_time ( uint8_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:
ptpclient/ptpclient.c.
int rte_eth_timesync_write_time ( uint8_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.
  • -ENOTSUP: The function is not supported by the Ethernet driver.
void rte_eth_copy_pci_info ( struct rte_eth_dev *  eth_dev,
struct rte_pci_device pci_dev 
)

Copy pci device info to the Ethernet device data.

Parameters
eth_devThe eth_dev pointer is the address of the rte_eth_dev structure.
pci_devThe pci_dev pointer is the address of the rte_pci_device structure.
Returns
  • 0 on success, negative on error
struct rte_memzone* rte_eth_dma_zone_reserve ( const struct rte_eth_dev *  eth_dev,
const char *  name,
uint16_t  queue_id,
size_t  size,
unsigned  align,
int  socket_id 
)
read

Create memzone for HW rings. malloc can't be used as the physical address is needed. If the memzone is already created, then this function returns a ptr to the old one.

Parameters
eth_devThe eth_dev pointer is the address of the rte_eth_dev structure
nameThe name of the memory zone
queue_idThe index of the queue to add to name
sizeThe sizeof of the memory area
alignAlignment for resulting memzone. Must be a power of 2.
socket_idThe socket_id argument is the socket identifier in case of NUMA.