DPDK
2.0.0
|
#include <stdint.h>
#include <rte_log.h>
#include <rte_interrupts.h>
#include <rte_pci.h>
#include <rte_dev.h>
#include <rte_devargs.h>
#include <rte_mbuf.h>
#include "rte_ether.h"
#include "rte_eth_ctrl.h"
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_vmdq_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_fc_conf |
struct | rte_eth_pfc_conf |
struct | rte_fdir_conf |
struct | rte_eth_udp_tunnel |
struct | rte_fdir_filter |
struct | rte_fdir_masks |
struct | rte_eth_fdir |
struct | rte_intr_conf |
struct | rte_eth_conf |
struct | rte_eth_xstats |
Typedefs | |
typedef uint32_t(* | eth_rx_queue_count_t )(struct rte_eth_dev *dev, uint16_t rx_queue_id) |
typedef int(* | eth_rx_descriptor_done_t )(void *rxq, uint16_t offset) |
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) |
Functions | |
uint8_t | rte_eth_dev_count (void) |
struct rte_eth_dev * | rte_eth_dev_allocated (const char *name) |
struct rte_eth_dev * | rte_eth_dev_allocate (const char *name, enum rte_eth_dev_type type) |
int | rte_eth_dev_release_port (struct rte_eth_dev *eth_dev) |
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 uint32_t | 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_fdir_add_signature_filter (uint8_t port_id, struct rte_fdir_filter *fdir_filter, uint8_t rx_queue) |
int | rte_eth_dev_fdir_update_signature_filter (uint8_t port_id, struct rte_fdir_filter *fdir_ftr, uint8_t rx_queue) |
int | rte_eth_dev_fdir_remove_signature_filter (uint8_t port_id, struct rte_fdir_filter *fdir_ftr) |
int | rte_eth_dev_fdir_get_infos (uint8_t port_id, struct rte_eth_fdir *fdir) |
int | rte_eth_dev_fdir_add_perfect_filter (uint8_t port_id, struct rte_fdir_filter *fdir_filter, uint16_t soft_id, uint8_t rx_queue, uint8_t drop) |
int | rte_eth_dev_fdir_update_perfect_filter (uint8_t port_id, struct rte_fdir_filter *fdir_filter, uint16_t soft_id, uint8_t rx_queue, uint8_t drop) |
int | rte_eth_dev_fdir_remove_perfect_filter (uint8_t port_id, struct rte_fdir_filter *fdir_filter, uint16_t soft_id) |
int | rte_eth_dev_fdir_set_masks (uint8_t port_id, struct rte_fdir_masks *fdir_mask) |
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_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_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_vmdq_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) |
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) |
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.
#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.
#define DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM 0x00000080 |
Used for tunneling packet.
#define DEV_TX_OFFLOAD_VLAN_INSERT 0x00000001 |
TX offload capabilities of a device.
#define ETH_DCB_NONE ETH_MQ_TX_NONE |
for tx mq mode backward compatible
#define ETH_DCB_NUM_QUEUES 128 |
Maximum nb. of DCB queues.
#define ETH_DCB_NUM_USER_PRIORITIES 8 |
Maximum nb. of DCB priorities.
#define ETH_DCB_PFC_SUPPORT 0x00000002 |
Priority Flow Control support.
#define ETH_DCB_PG_SUPPORT 0x00000001 |
Priority Group(ETS) support.
#define ETH_LINK_AUTONEG_DUPLEX 0 |
Auto-negotiate duplex.
#define ETH_LINK_FULL_DUPLEX 2 |
Full-duplex connection.
#define ETH_LINK_HALF_DUPLEX 1 |
Half-duplex connection.
#define ETH_LINK_SPEED_10 10 |
10 megabits/second.
#define ETH_LINK_SPEED_100 100 |
100 megabits/second.
#define ETH_LINK_SPEED_1000 1000 |
1 gigabits/second.
#define ETH_LINK_SPEED_10000 10000 |
10 gigabits/second.
#define ETH_LINK_SPEED_10G 10000 |
alias of 10 gigabits/second.
#define ETH_LINK_SPEED_20G 20000 |
20 gigabits/second.
#define ETH_LINK_SPEED_40G 40000 |
40 gigabits/second.
#define ETH_LINK_SPEED_AUTONEG 0 |
Auto-negotiate link speed.
#define ETH_MQ_RX_RSS_FLAG 0x1 |
Simple flags are used for rte_eth_conf.rxmode.mq_mode.
#define ETH_NUM_RECEIVE_MAC_ADDR 128 |
Maximum nb. of receive mac addr.
#define ETH_RSS ETH_MQ_RX_RSS |
for rx mq mode backward compatible
#define ETH_RSS_SCTP |
Mask of valid RSS hash protocols
#define ETH_TXQ_FLAGS_NOMULTMEMP 0x0004 |
all bufs come from same mempool
#define ETH_TXQ_FLAGS_NOMULTSEGS 0x0001 |
nb_segs=1 for all mbufs
#define ETH_TXQ_FLAGS_NOREFCOUNT 0x0002 |
refcnt can be ignored
#define ETH_TXQ_FLAGS_NOVLANOFFL 0x0100 |
disable VLAN offload
#define ETH_TXQ_FLAGS_NOXSUMSCTP 0x0200 |
disable SCTP checksum offload
#define ETH_TXQ_FLAGS_NOXSUMTCP 0x0800 |
disable TCP checksum offload
#define ETH_TXQ_FLAGS_NOXSUMUDP 0x0400 |
disable UDP checksum offload
#define ETH_VLAN_EXTEND_MASK 0x0004 |
VLAN Extend setting mask
#define ETH_VLAN_EXTEND_OFFLOAD 0x0004 |
VLAN Extend On/Off
#define ETH_VLAN_FILTER_MASK 0x0002 |
VLAN Filter setting mask
#define ETH_VLAN_FILTER_OFFLOAD 0x0002 |
VLAN Filter On/Off
#define ETH_VLAN_ID_MAX 0x0FFF |
VLAN ID is in lower 12 bits
#define ETH_VLAN_STRIP_MASK 0x0001 |
VLAN Strip setting mask
#define ETH_VLAN_STRIP_OFFLOAD 0x0001 |
VLAN Strip On/Off
#define ETH_VMDQ_ACCEPT_BROADCAST 0x0008 |
accept broadcast packets.
#define ETH_VMDQ_ACCEPT_HASH_MC 0x0002 |
accept packets in multicast table .
#define ETH_VMDQ_ACCEPT_HASH_UC 0x0004 |
accept packets in unicast table.
#define ETH_VMDQ_ACCEPT_MULTICAST 0x0010 |
multicast promiscuous.
#define ETH_VMDQ_ACCEPT_UNTAG 0x0001 |
accept untagged packets.
#define ETH_VMDQ_DCB_NUM_QUEUES 128 |
Maximum nb. of VMDQ DCB queues.
#define ETH_VMDQ_DOWNLIN_MIRROR 0x0004 |
Downlink Port Mirroring.
#define ETH_VMDQ_MAX_VLAN_FILTERS 64 |
Maximum nb. of VMDQ vlan filters.
#define ETH_VMDQ_NUM_MIRROR_RULE 4 |
Maximum nb. of mirror rules. .
#define ETH_VMDQ_NUM_UC_HASH_ARRAY 128 |
Maximum nb. of UC hash array.
#define ETH_VMDQ_POOL_MIRROR 0x0001 |
Virtual Pool Mirroring.
#define ETH_VMDQ_UPLINK_MIRROR 0x0002 |
Uplink Port Mirroring.
#define ETH_VMDQ_VLAN_MIRROR 0x0008 |
VLAN Mirroring.
#define RTE_ETH_XSTATS_NAME_SIZE 64 |
Maximum name length for extended statistics counters
typedef int(* eth_rx_descriptor_done_t)(void *rxq, uint16_t offset) |
DD bit of specific RX descriptor
typedef uint32_t(* eth_rx_queue_count_t)(struct rte_eth_dev *dev, uint16_t rx_queue_id) |
number of available descriptors on a receive queue of an Ethernet device.
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
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.
port | The Ethernet port on which RX is being performed. |
queue | The queue on the Ethernet port which is being used to receive the packets. |
pkts | The burst of packets that have just been received. |
nb_pkts | The number of packets in the burst pointed to by "pkts". |
max_pkts | The max number of packets that can be stored in the "pkts" array. |
user_param | The arbitrary user parameter passed in by the application when the callback was originally configured. |
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.
port | The Ethernet port on which TX is being performed. |
queue | The queue on the Ethernet port which is being used to transmit the packets. |
pkts | The burst of packets that are about to be transmitted. |
nb_pkts | The number of packets in the burst pointed to by "pkts". |
user_param | The arbitrary user parameter passed in by the application when the callback was originally configured. |
enum rte_eth_dev_type |
enum rte_eth_event_type |
enum rte_eth_fc_mode |
enum rte_eth_nb_pools |
enum rte_eth_nb_tcs |
enum rte_eth_rx_mq_mode |
A set of values to identify what method is to be used to route packets to multiple queues.
enum rte_eth_tx_mq_mode |
enum rte_fdir_status_mode |
enum rte_iptype |
enum rte_l4type |
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().
port_id | The port identifier of the Ethernet device. |
queue_id | The queue on the Ethernet device on which the callback is to be added. |
fn | The callback function |
user_param | A generic pointer parameter which will be passed to each invocation of the callback function on this port and queue. |
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().
port_id | The port identifier of the Ethernet device. |
queue_id | The queue on the Ethernet device on which the callback is to be added. |
fn | The callback function |
user_param | A generic pointer parameter which will be passed to each invocation of the callback function on this port and queue. |
void rte_eth_allmulticast_disable | ( | uint8_t | port_id | ) |
Disable the receipt of all multicast frames by an Ethernet device.
port_id | The port identifier of the Ethernet device. |
void rte_eth_allmulticast_enable | ( | uint8_t | port_id | ) |
Enable the receipt of any multicast frame by an Ethernet device.
port_id | The port identifier of the Ethernet device. |
int rte_eth_allmulticast_get | ( | uint8_t | port_id | ) |
Return the value of allmulticast mode for an Ethernet device.
port_id | The port identifier of the Ethernet device. |
|
read |
Function for internal use by dummy drivers primarily, e.g. ring-based driver. Allocates a new ethdev slot for an ethernet device and returns the pointer to that slot for the driver to use.
name | Unique identifier name for each Ethernet device |
type | Device type of this Ethernet device |
|
read |
Function for internal use by port hotplug functions. Returns a ethdev slot specified by the unique identifier name.
name | The pointer to the Unique identifier name for each Ethernet device |
int rte_eth_dev_attach | ( | const char * | devargs, |
uint8_t * | port_id | ||
) |
Attach a new Ethernet device specified by aruguments.
devargs | A 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_id | A pointer to a port identifier actually attached. |
int rte_eth_dev_bypass_event_show | ( | uint8_t | port, |
uint32_t | event, | ||
uint32_t * | state | ||
) |
Return bypass state when given event occurs.
port | The port identifier of the Ethernet device. |
event | The bypass event
|
state | The bypass state when given event occurred.
|
int rte_eth_dev_bypass_event_store | ( | uint8_t | port, |
uint32_t | event, | ||
uint32_t | state | ||
) |
Set bypass state when given event occurs.
port | The port identifier of the Ethernet device. |
event | The bypass event
|
state | The assigned state when given event occurs.
|
int rte_eth_dev_bypass_init | ( | uint8_t | port | ) |
Initialize bypass logic. This function needs to be called before executing any other bypass API.
port | The port identifier of the Ethernet device. |
int rte_eth_dev_bypass_state_set | ( | uint8_t | port, |
uint32_t * | new_state | ||
) |
Set bypass state
port | The port identifier of the Ethernet device. |
state | The current bypass state.
|
int rte_eth_dev_bypass_state_show | ( | uint8_t | port, |
uint32_t * | state | ||
) |
Return bypass state.
port | The port identifier of the Ethernet device. |
state | The return bypass state.
|
int rte_eth_dev_bypass_ver_show | ( | uint8_t | port, |
uint32_t * | ver | ||
) |
Get bypass firmware version.
port | The port identifier of the Ethernet device. |
ver | The firmware version |
int rte_eth_dev_bypass_wd_reset | ( | uint8_t | port | ) |
Reset bypass watchdog timer
port | The port identifier of the Ethernet device. |
int rte_eth_dev_bypass_wd_timeout_show | ( | uint8_t | port, |
uint32_t * | wd_timeout | ||
) |
Return bypass watchdog timeout in seconds
port | The port identifier of the Ethernet device. |
wd_timeout | The return watchdog timeout. "0" represents timer expired
|
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.
port_id | Port id. |
event | Event interested. |
cb_fn | User supplied callback function to be called. |
cb_arg | Pointer to the parameters for the registered callback. |
int rte_eth_dev_callback_unregister | ( | 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.
port_id | Port id. |
event | Event interested. |
cb_fn | User supplied callback function to be called. |
cb_arg | Pointer to the parameters for the registered callback. -1 means to remove all for the same callback address and same event. |
void rte_eth_dev_close | ( | uint8_t | port_id | ) |
Close an Ethernet device. The device cannot be restarted!
port_id | The port identifier of the Ethernet device. |
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.
port_id | The port identifier of the Ethernet device to configure. |
nb_rx_queue | The number of receive queues to set up for the Ethernet device. |
nb_tx_queue | The number of transmit queues to set up for the Ethernet device. |
eth_conf | The pointer to the configuration data to be used for the Ethernet device. The rte_eth_conf structure includes:
|
Embedding all configuration information in a single data structure is the more flexible method that allows the addition of new features without changing the syntax of the API.
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.
int rte_eth_dev_detach | ( | uint8_t | port_id, |
char * | devname | ||
) |
Detach a Ethernet device specified by port identifier.
port_id | The port identifier of the device to detach. |
addr | A pointer to a device name actually detached. |
int rte_eth_dev_fdir_add_perfect_filter | ( | uint8_t | port_id, |
struct rte_fdir_filter * | fdir_filter, | ||
uint16_t | soft_id, | ||
uint8_t | rx_queue, | ||
uint8_t | drop | ||
) |
Add a new perfect filter rule on an Ethernet device.
port_id | The port identifier of the Ethernet device. |
fdir_filter | The pointer to the structure describing the perfect filter rule. The rte_fdir_filter structure includes the values of the different fields to match: source and destination IP addresses, vlan id, flexbytes, source and destination ports, and so on. IPv6 are not supported. |
soft_id | The 16-bit value supplied in the field hash.fdir.id of mbuf for RX packets matching the perfect filter. |
rx_queue | The index of the RX queue where to store RX packets matching the added perfect filter defined in fdir_filter. |
drop | If drop is set to 1, matching RX packets are stored into the RX drop queue defined in the rte_fdir_conf. |
int rte_eth_dev_fdir_add_signature_filter | ( | uint8_t | port_id, |
struct rte_fdir_filter * | fdir_filter, | ||
uint8_t | rx_queue | ||
) |
Setup a new signature filter rule on an Ethernet device
port_id | The port identifier of the Ethernet device. |
fdir_filter | The pointer to the fdir filter structure describing the signature filter rule. The rte_fdir_filter structure includes the values of the different fields to match: source and destination IP addresses, vlan id, flexbytes, source and destination ports, and so on. |
rx_queue | The index of the RX queue where to store RX packets matching the added signature filter defined in fdir_filter. |
int rte_eth_dev_fdir_get_infos | ( | uint8_t | port_id, |
struct rte_eth_fdir * | fdir | ||
) |
Retrieve the flow director information of an Ethernet device.
port_id | The port identifier of the Ethernet device. |
fdir | A pointer to a structure of type rte_eth_dev_fdir to be filled with the flow director information of the Ethernet device. |
int rte_eth_dev_fdir_remove_perfect_filter | ( | uint8_t | port_id, |
struct rte_fdir_filter * | fdir_filter, | ||
uint16_t | soft_id | ||
) |
Remove a perfect filter rule on an Ethernet device.
port_id | The port identifier of the Ethernet device. |
fdir_filter | The pointer to the structure describing the perfect filter rule. The rte_fdir_filter structure includes the values of the different fields to match: source and destination IP addresses, vlan id, flexbytes, source and destination ports, and so on. IPv6 are not supported. |
soft_id | The soft_id value provided when adding/updating the removed filter. |
int rte_eth_dev_fdir_remove_signature_filter | ( | uint8_t | port_id, |
struct rte_fdir_filter * | fdir_ftr | ||
) |
Remove a signature filter rule on an Ethernet device.
port_id | The port identifier of the Ethernet device. |
fdir_ftr | The pointer to the structure describing the signature filter rule. The rte_fdir_filter structure includes the values of the different fields to match: source and destination IP addresses, vlan id, flexbytes, source and destination ports, and so on. |
int rte_eth_dev_fdir_set_masks | ( | uint8_t | port_id, |
struct rte_fdir_masks * | fdir_mask | ||
) |
Configure globally the masks for flow director mode for an Ethernet device. For example, the device can match packets with only the first 24 bits of the IPv4 source address.
The following fields can be masked: IPv4 addresses and L4 port numbers. The following fields can be either enabled or disabled completely for the matching functionality: VLAN ID tag; VLAN Priority + CFI bit; Flexible 2-byte tuple. IPv6 masks are not supported.
All filters must comply with the masks previously configured. For example, with a mask equal to 255.255.255.0 for the source IPv4 address, all IPv4 filters must be created with a source IPv4 address that fits the "X.X.X.0" format.
This function flushes all filters that have been previously added in the device.
port_id | The port identifier of the Ethernet device. |
fdir_mask | The pointer to the fdir mask structure describing relevant headers fields and relevant bits to use when matching packets addresses and ports. IPv6 masks are not supported. |
int rte_eth_dev_fdir_update_perfect_filter | ( | uint8_t | port_id, |
struct rte_fdir_filter * | fdir_filter, | ||
uint16_t | soft_id, | ||
uint8_t | rx_queue, | ||
uint8_t | drop | ||
) |
Update a perfect filter rule on an Ethernet device. If the rule doesn't exits, it is created.
port_id | The port identifier of the Ethernet device. |
fdir_filter | The pointer to the structure describing the perfect filter rule. The rte_fdir_filter structure includes the values of the different fields to match: source and destination IP addresses, vlan id, flexbytes, source and destination ports, and so on. IPv6 are not supported. |
soft_id | The 16-bit value supplied in the field hash.fdir.id of mbuf for RX packets matching the perfect filter. |
rx_queue | The index of the RX queue where to store RX packets matching the added perfect filter defined in fdir_filter. |
drop | If drop is set to 1, matching RX packets are stored into the RX drop queue defined in the rte_fdir_conf. |
int rte_eth_dev_fdir_update_signature_filter | ( | uint8_t | port_id, |
struct rte_fdir_filter * | fdir_ftr, | ||
uint8_t | rx_queue | ||
) |
Update a signature filter rule on an Ethernet device. If the rule doesn't exits, it is created.
port_id | The port identifier of the Ethernet device. |
fdir_ftr | The pointer to the structure describing the signature filter rule. The rte_fdir_filter structure includes the values of the different fields to match: source and destination IP addresses, vlan id, flexbytes, source and destination ports, and so on. |
rx_queue | The index of the RX queue where to store RX packets matching the added signature filter defined in fdir_ftr. |
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'.
port_id | The port identifier of the Ethernet device. |
filter_type | Filter type. |
filter_op | Type of operation. |
arg | A pointer to arguments defined specifically for the operation. |
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'.
port_id | The port identifier of the Ethernet device. |
filter_type | Filter type. |
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
port_id | The port identifier of the Ethernet device. |
fc_conf | The pointer to the structure where to store the flow control parameters. |
int rte_eth_dev_flow_ctrl_set | ( | uint8_t | port_id, |
struct rte_eth_fc_conf * | fc_conf | ||
) |
Configure the Ethernet link flow control for Ethernet device
port_id | The port identifier of the Ethernet device. |
fc_conf | The pointer to the structure of the flow control parameters. |
int rte_eth_dev_get_mtu | ( | uint8_t | port_id, |
uint16_t * | mtu | ||
) |
Retrieve the MTU of an Ethernet device.
port_id | The port identifier of the Ethernet device. |
mtu | A pointer to a uint16_t where the retrieved MTU is to be stored. |
int rte_eth_dev_get_vlan_offload | ( | uint8_t | port_id | ) |
Read VLAN Offload configuration from an Ethernet device
port_id | The port identifier of the Ethernet device. |
void rte_eth_dev_info_get | ( | uint8_t | port_id, |
struct rte_eth_dev_info * | dev_info | ||
) |
Retrieve the contextual information of an Ethernet device.
port_id | The port identifier of the Ethernet device. |
dev_info | A pointer to a structure of type rte_eth_dev_info to be filled with the contextual information of the Ethernet device. |
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.
port | The port identifier of the Ethernet device. |
mac_addr | The MAC address to add. |
pool | VMDq pool index to associate address with (if VMDq is enabled). If VMDq is not enabled, this should be set to 0. |
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.
port | The port identifier of the Ethernet device. |
mac_addr | MAC address to remove. |
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.
port_id | The port identifier of the Ethernet device. |
pfc_conf | The pointer to the structure of the priority flow control parameters. |
int rte_eth_dev_release_port | ( | struct rte_eth_dev * | eth_dev | ) |
Function for internal use by dummy drivers primarily, e.g. ring-based driver. Release the specified ethdev port.
eth_dev | The eth_dev pointer is the address of the rte_eth_dev structure. |
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.
port_id | The port identifier of the Ethernet device. |
rss_conf | Where to store the current RSS hash configuration of the Ethernet device. |
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.
port_id | The port identifier of the Ethernet device. |
rss_conf | The new configuration to use for RSS hash computation on the port. |
int rte_eth_dev_rss_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.
port | The port identifier of the Ethernet device. |
reta_conf | RETA to query. |
reta_size | Redirection table size. The table size can be queried by rte_eth_dev_info_get(). |
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.
port | The port identifier of the Ethernet device. |
reta_conf | RETA to update. |
reta_size | Redirection table size. The table size can be queried by rte_eth_dev_info_get(). |
int rte_eth_dev_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()
port_id | The port identifier of the Ethernet device. |
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.
port_id | The port identifier of the Ethernet device. |
int rte_eth_dev_set_mtu | ( | uint8_t | port_id, |
uint16_t | mtu | ||
) |
Change the MTU of an Ethernet device.
port_id | The port identifier of the Ethernet device. |
mtu | A uint16_t for the MTU to be applied. |
int rte_eth_dev_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.
port_id | The port identifier of the Ethernet device. |
rx_queue_id | The index of the receive queue for which a queue stats mapping is required. The value must be in the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure(). |
stat_idx | The per-queue packet statistics functionality number that the receive queue is to be assigned. The value must be in the range [0, RTE_MAX_ETHPORT_QUEUE_STATS_MAPS - 1]. |
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.
port_id | The port identifier of the Ethernet device. |
tx_queue_id | The index of the transmit queue for which a queue stats mapping is required. The value must be in the range [0, nb_tx_queue - 1] previously supplied to rte_eth_dev_configure(). |
stat_idx | The per-queue packet statistics functionality number that the transmit queue is to be assigned. The value must be in the range [0, RTE_MAX_ETHPORT_QUEUE_STATS_MAPS - 1]. |
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.
port | The port identifier of the Ethernet device. |
vf | VF id. |
on | 1 - Enable a VF traffic receive. 0 - Disable a VF traffic receive. |
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.
port | The port identifier of the Ethernet device. |
vf | VF id. |
rx_mode | The 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. |
on | 1 - Enable a VF RX mode. 0 - Disable a VF RX mode. |
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.
port | The port identifier of the Ethernet device. |
vf | VF id. |
on | 1 - Enable a VF traffic transmit. 0 - Disable a VF traffic transmit. |
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.
port | id The port identifier of the Ethernet device. |
vlan_id | The VLAN Tag Identifier whose filtering must be enabled or disabled. |
vf_mask | Bitmap listing which VFs participate in the VLAN filtering. |
vlan_on | 1 - Enable VFs VLAN filtering. 0 - Disable VFs VLAN filtering. |
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.
port_id | The port identifier of the Ethernet device. |
tag_type | The Tag Protocol ID |
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.
port_id | The port identifier of the Ethernet device. |
offload_mask | The VLAN Offload bit mask can be mixed use with "OR" ETH_VLAN_STRIP_OFFLOAD ETH_VLAN_FILTER_OFFLOAD ETH_VLAN_EXTEND_OFFLOAD |
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.
port_id | The port identifier of the Ethernet device. |
pvid | Port based TX VLAN identifier togeth with user priority. |
on | Turn on or off the port based TX VLAN insertion. |
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
port_id | The port identifier of the Ethernet device. |
rx_queue_id | The index of the receive queue for which a queue stats mapping is required. The value must be in the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure(). |
on | If 1, Enable VLAN Stripping of the receive queue of the Ethernet port. If 0, Disable VLAN Stripping of the receive queue of the Ethernet port. |
int rte_eth_dev_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.
port_id | The port identifier of the Ethernet device. |
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()
port_id | The port identifier of the Ethernet device. |
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.
port | The port identifier of the Ethernet device. |
on | 1 - Set all unicast hash bitmaps for receiving all the Ethernet MAC addresses 0 - Clear all unicast hash bitmaps |
int rte_eth_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.
port | The port identifier of the Ethernet device. |
addr | Unicast MAC address. |
on | 1 - Set an unicast hash bit for receiving packets with the MAC address. 0 - Clear an unicast hash bit. |
int rte_eth_dev_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.
port_id | The port identifier of the Ethernet device. |
tunnel_udp | UDP tunneling configuration. |
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
port_id | The port identifier of the Ethernet device. |
tunnel_udp | UDP tunneling configuration. |
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.
port_id | The port identifier of the Ethernet device. |
vlan_id | The VLAN Tag Identifier whose filtering must be enabled or disabled. |
on | If > 0, enable VLAN filtering of VLAN packets tagged with vlan_id. Otherwise, disable VLAN filtering of VLAN packets tagged with vlan_id. |
int rte_eth_dev_wd_timeout_store | ( | uint8_t | port, |
uint32_t | timeout | ||
) |
Set bypass watchdog timeout count.
port | The port identifier of the Ethernet device. |
state | The timeout to be set.
|
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.
port_id | The port identifier of the Ethernet device. |
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.
port_id | The port identifier of the Ethernet device. |
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.
port_id | The port identifier of the Ethernet device. |
link | A pointer to an rte_eth_link structure to be filled with the status, the speed and the mode of the Ethernet device link. |
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().
port_id | The port identifier of the Ethernet device. |
link | A pointer to an rte_eth_link structure to be filled with the status, the speed and the mode of the Ethernet device link. |
void rte_eth_macaddr_get | ( | uint8_t | port_id, |
struct ether_addr * | mac_addr | ||
) |
Retrieve the Ethernet address of an Ethernet device.
port_id | The port identifier of the Ethernet device. |
mac_addr | A pointer to a structure of type ether_addr to be filled with the Ethernet address of the Ethernet device. |
int rte_eth_mirror_rule_reset | ( | uint8_t | port_id, |
uint8_t | rule_id | ||
) |
Reset a traffic mirroring rule on an Ethernet device.
port_id | The port identifier of the Ethernet device. |
rule_id | The index of traffic mirroring rule, we support four separated rules. |
int rte_eth_mirror_rule_set | ( | uint8_t | port_id, |
struct rte_eth_vmdq_mirror_conf * | mirror_conf, | ||
uint8_t | rule_id, | ||
uint8_t | on | ||
) |
Set a traffic mirroring rule on an Ethernet device
port_id | The port identifier of the Ethernet device. |
mirror_conf | The 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_id | The index of traffic mirroring rule, we support four separated rules. |
on | 1 - Enable a mirroring rule. 0 - Disable a mirroring rule. |
void rte_eth_promiscuous_disable | ( | uint8_t | port_id | ) |
Disable receipt in promiscuous mode for an Ethernet device.
port_id | The port identifier of the Ethernet device. |
void rte_eth_promiscuous_enable | ( | uint8_t | port_id | ) |
Enable receipt in promiscuous mode for an Ethernet device.
port_id | The port identifier of the Ethernet device. |
int rte_eth_promiscuous_get | ( | uint8_t | port_id | ) |
Return the value of promiscuous mode for an Ethernet device.
port_id | The port identifier of the Ethernet device. |
int rte_eth_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():
port_id | The port identifier of the Ethernet device. |
queue_id | The queue on the Ethernet device from which the callback is to be removed. |
user_cb | User supplied callback created via rte_eth_add_rx_callback(). |
int rte_eth_remove_tx_callback | ( | 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():
port_id | The port identifier of the Ethernet device. |
queue_id | The queue on the Ethernet device from which the callback is to be removed. |
user_cb | User supplied callback created via rte_eth_add_tx_callback(). |
|
inlinestatic |
Retrieve a burst of input packets from a receive queue of an Ethernet device. The retrieved packets are stored in rte_mbuf structures whose pointers are supplied in the rx_pkts array.
The rte_eth_rx_burst() function loops, parsing the RX ring of the receive queue, up to nb_pkts packets, and for each completed RX descriptor in the ring, it performs the following operations:
When retrieving an input packet that was scattered by the controller into multiple receive descriptors, the rte_eth_rx_burst() function appends the associated rte_mbuf buffers to the first buffer of the packet.
The rte_eth_rx_burst() function returns the number of packets actually retrieved, which is the number of rte_mbuf data structures effectively supplied into the rx_pkts array. A return value equal to nb_pkts indicates that the RX queue contained at least rx_pkts packets, and this is likely to signify that other received packets remain in the input queue. Applications implementing a "retrieve as much received packets as possible" policy can check this specific case and keep invoking the rte_eth_rx_burst() function until a value less than nb_pkts is returned.
This receive method has the following advantages:
To summarize, the proposed receive API enables many burst-oriented optimizations in both synchronous and asynchronous packet processing environments with no overhead in both cases.
The rte_eth_rx_burst() function does not provide any error notification to avoid the corresponding overhead. As a hint, the upper-level application might check the status of the device link once being systematically returned a 0 value for a given number of tries.
port_id | The port identifier of the Ethernet device. |
queue_id | The index of the receive queue from which to retrieve input packets. The value must be in the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure(). |
rx_pkts | The address of an array of pointers to rte_mbuf structures that must be large enough to store nb_pkts pointers in it. |
nb_pkts | The maximum number of packets to retrieve. |
|
inlinestatic |
Check if the DD bit of the specific RX descriptor in the queue has been set
port_id | The port identifier of the Ethernet device. |
queue_id | The queue id on the specific port. The offset of the descriptor ID from tail. |
|
inlinestatic |
Get the number of used descriptors in a specific queue
port_id | The port identifier of the Ethernet device. |
queue_id | The queue id on the specific port. |
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.
port_id | The port identifier of the Ethernet device. |
rx_queue_id | The index of the receive queue to set up. The value must be in the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure(). |
nb_rx_desc | The number of receive descriptors to allocate for the receive ring. |
socket_id | The socket_id argument is the socket identifier in case of NUMA. The value can be SOCKET_ID_ANY if there is no NUMA constraint for the DMA memory allocated for the receive descriptors of the ring. |
rx_conf | The pointer to the configuration data to be used for the receive queue. NULL value is allowed, in which case default RX configuration will be used. The rx_conf structure contains an rx_thresh structure with the values of the Prefetch, Host, and Write-Back threshold registers of the receive ring. |
mb_pool | The pointer to the memory pool from which to allocate rte_mbuf network memory buffers to populate each descriptor of the receive ring. |
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.
port_id | The port identifier of the Ethernet device. |
queue_idx | The queue id. |
tx_rate | The tx rate allocated from the total link speed for this queue. |
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.
port_id | The port identifier of the Ethernet device. |
vf | VF id. |
tx_rate | The tx rate allocated from the total link speed for this VF id. |
q_msk | The queue mask which need to set the rate. |
int rte_eth_stats_get | ( | uint8_t | port_id, |
struct rte_eth_stats * | stats | ||
) |
Retrieve the general I/O statistics of an Ethernet device.
port_id | The port identifier of the Ethernet device. |
stats | A pointer to a structure of type rte_eth_stats to be filled with the values of device counters for the following set of statistics:
|
void rte_eth_stats_reset | ( | uint8_t | port_id | ) |
Reset the general I/O statistics of an Ethernet device.
port_id | The port identifier of the Ethernet device. |
|
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:
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 previously sent packets reached the "minimum transmit packets to free" threshold, the rte_eth_tx_burst() function must [attempt to] free the rte_mbuf buffers of those packets whose transmission was effectively completed.
port_id | The port identifier of the Ethernet device. |
queue_id | The index of the transmit queue through which output packets must be sent. The value must be in the range [0, nb_tx_queue - 1] previously supplied to rte_eth_dev_configure(). |
tx_pkts | The address of an array of nb_pkts pointers to rte_mbuf structures which contain the output packets. |
nb_pkts | The maximum number of packets to transmit. |
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.
port_id | The port identifier of the Ethernet device. |
tx_queue_id | The index of the transmit queue to set up. The value must be in the range [0, nb_tx_queue - 1] previously supplied to rte_eth_dev_configure(). |
nb_tx_desc | The number of transmit descriptors to allocate for the transmit ring. |
socket_id | The socket_id argument is the socket identifier in case of NUMA. Its value can be SOCKET_ID_ANY if there is no NUMA constraint for the DMA memory allocated for the transmit descriptors of the ring. |
tx_conf | The pointer to the configuration data to be used for the transmit queue. NULL value is allowed, in which case default RX configuration will be used. The tx_conf structure contains the following data:
|
int rte_eth_xstats_get | ( | uint8_t | port_id, |
struct rte_eth_xstats * | xstats, | ||
unsigned | n | ||
) |
Retrieve extended statistics of an Ethernet device.
port_id | The port identifier of the Ethernet device. |
xstats | A 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. |
n | The size of the stats table, which should be large enough to store all the statistics of the device. |
void rte_eth_xstats_reset | ( | uint8_t | port_id | ) |
Reset extended statistics of an Ethernet device.
port_id | The port identifier of the Ethernet device. |