rte_ethdev.h(3)
๐ rte_ethdev.h โ the Library Functions Manual โจ
okay bestie, sit DOWN. this is the Ethernet device (ethdev) API header from DPDK, and honestly? it's giving main character energy for the entire packet-processing universe. every port, every queue, every offload bit lives here. we're gonna walk through it together, no cap. this is part 1 of 22, so hydrate and stay with me. ๐
๐ธ NAME ๐ธ
rte_ethdev.h โ the one, the only, the header that runs the whole Ethernet show ๐ซถ
โจ SYNOPSIS โจ
you get all of this the moment you pull her in:
#include <stdint.h>
#include <rte_cman.h>
#include <rte_compat.h>
#include <rte_log.h>
#include <rte_interrupts.h>
#include <rte_dev.h>
#include <rte_devargs.h>
#include <rte_bitops.h>
#include <rte_errno.h>
#include <rte_common.h>
#include <rte_config.h>
#include <rte_power_intrinsics.h>
#include 'rte_ethdev_trace_fp.h'
#include 'rte_dev_info.h'
#include 'rte_eth_ctrl.h'
#include <rte_ethdev_core.h>
(yes those quote-style includes are literally in the original, we do not edit the queen's wardrobe ๐)
๐ Data Structures ๐
here's the whole squad of structs and the one union that comes along. every single one, in order, no skips, because we do NOT leave people out:
struct rte_eth_statsstruct rte_eth_linkstruct rte_eth_speed_lanes_capastruct rte_eth_threshstruct rte_eth_rxmodestruct rte_vlan_filter_confstruct rte_eth_rss_confstruct rte_eth_rss_reta_entry64struct rte_eth_vmdq_dcb_confstruct rte_eth_vmdq_rx_confstruct rte_eth_txmodestruct rte_eth_rxseg_splitunion rte_eth_rxsegstruct rte_eth_rxconfstruct rte_eth_txconfstruct rte_eth_hairpin_queue_capstruct rte_eth_hairpin_capstruct rte_eth_hairpin_peerstruct rte_eth_hairpin_confstruct rte_eth_desc_limstruct rte_eth_fc_confstruct rte_eth_pfc_confstruct rte_eth_pfc_queue_infostruct rte_eth_pfc_queue_confstruct rte_eth_udp_tunnelstruct rte_eth_intr_confstruct rte_eth_confstruct rte_eth_dev_portconfstruct rte_eth_switch_infostruct rte_eth_rxseg_capastruct rte_eth_dev_infostruct rte_eth_rxq_infostruct rte_eth_txq_infostruct rte_eth_recycle_rxq_infostruct rte_eth_burst_modestruct rte_eth_xstatstruct rte_eth_xstat_namestruct rte_eth_dcb_tc_queue_mappingstruct rte_eth_dcb_infostruct rte_eth_dev_tx_bufferstruct rte_eth_event_macsec_descstruct rte_eth_event_ipsec_descstruct rte_eth_representor_rangestruct rte_eth_representor_infostruct rte_eth_ip_reassembly_paramsstruct rte_eth_ip_reassembly_dynfield_tstruct rte_eth_cman_infostruct rte_eth_cman_config
๐ Macros ๐
these are the constants and helper macros that live at the top level of the header. soak them in โจ
RTE_ETH_FOREACH_MATCHING_DEV(id, devargs, iter)โ iterate over every device matchingdevargsRTE_ETH_SPEED_LANES_TO_CAPA(x)โ turn a lane speed into capability formRTE_ETH_FLOW_PORTโ18RTE_ETH_FLOW_VXLANโ19RTE_ETH_FLOW_GENEVEโ20RTE_ETH_FLOW_NVGREโ21RTE_ETH_FLOW_VXLAN_GPEโ22RTE_ETH_FLOW_GTPUโ23RTE_ETH_RSS_L4_CHKSUMโRTE_BIT64(35)RTE_ETH_RSS_IB_BTHโRTE_BIT64(38)RTE_ETH_RSS_LEVEL_PMD_DEFAULTโ(UINT64_C(0) << 50)RTE_ETH_RSS_LEVEL_OUTERMOSTโ(UINT64_C(1) << 50)RTE_ETH_RSS_LEVEL_INNERMOSTโ(UINT64_C(2) << 50)RTE_ETH_RSS_PROTO_MASKโ the RSS protocol maskRTE_ETH_NUM_RECEIVE_MAC_ADDRโ128RTE_ETH_VMDQ_NUM_UC_HASH_ARRAYโ128RTE_ETH_RX_OFFLOAD_VLAN_STRIPโRTE_BIT64(0)RTE_ETH_RX_OFFLOAD_TIMESTAMPโRTE_BIT64(14)RTE_ETH_TX_OFFLOAD_VLAN_INSERTโRTE_BIT64(0)RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUMโRTE_BIT64(7)RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSOโRTE_BIT64(9)RTE_ETH_TX_OFFLOAD_GRE_TNL_TSOโRTE_BIT64(10)RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSOโRTE_BIT64(11)RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSOโRTE_BIT64(12)RTE_ETH_TX_OFFLOAD_MT_LOCKFREEโRTE_BIT64(14)RTE_ETH_TX_OFFLOAD_MULTI_SEGSโRTE_BIT64(15)RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREEโRTE_BIT64(16)RTE_ETH_TX_OFFLOAD_UDP_TNL_TSOโRTE_BIT64(18)RTE_ETH_TX_OFFLOAD_IP_TNL_TSOโRTE_BIT64(19)RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUMโRTE_BIT64(20)RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMPโRTE_BIT64(21)RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALIDโ(UINT16_MAX)RTE_ETH_BURST_FLAG_PER_QUEUEโRTE_BIT64(0)RTE_ETH_BURST_MODE_INFO_SIZEโ1024RTE_ETH_XSTATS_NAME_SIZEโ64RTE_ETH_FOREACH_DEV_OWNED_BY(p, o)โ loop over the devices owned byoRTE_ETH_FOREACH_DEV(p)โ loop over every dev, periodtRTE_ETH_FOREACH_DEV_OF(port_id, parent)โ loop over the devices that belong to aparentRTE_ETH_FOREACH_DEV_SIBLING(port_id, ref_port_id)โ loop over siblings ofref_port_idRTE_ETH_TX_BUFFER_SIZE(sz)โ the tx buffer size macroRTE_ETH_RX_METADATA_USER_FLAGโRTE_BIT64(0)RTE_ETH_RX_METADATA_USER_MARKโRTE_BIT64(1)RTE_ETH_RX_METADATA_TUNNEL_IDโRTE_BIT64(2)RTE_ETH_DEV_REASSEMBLY_F_IPV4โ(RTE_BIT32(0))RTE_ETH_DEV_REASSEMBLY_F_IPV6โ(RTE_BIT32(1))
๐ Link speed capabilities ๐
Device supported speeds bitmap flags โ like a mood board but for how fast your NIC can go ๐ฆ
#define RTE_ETH_LINK_SPEED_AUTONEG 0
#define RTE_ETH_LINK_SPEED_FIXED RTE_BIT32(0)
#define RTE_ETH_LINK_SPEED_10M_HD RTE_BIT32(1)
#define RTE_ETH_LINK_SPEED_10M RTE_BIT32(2)
#define RTE_ETH_LINK_SPEED_100M_HD RTE_BIT32(3)
#define RTE_ETH_LINK_SPEED_100M RTE_BIT32(4)
#define RTE_ETH_LINK_SPEED_1G RTE_BIT32(5)
#define RTE_ETH_LINK_SPEED_2_5G RTE_BIT32(6)
#define RTE_ETH_LINK_SPEED_5G RTE_BIT32(7)
#define RTE_ETH_LINK_SPEED_10G RTE_BIT32(8)
#define RTE_ETH_LINK_SPEED_20G RTE_BIT32(9)
#define RTE_ETH_LINK_SPEED_25G RTE_BIT32(10)
#define RTE_ETH_LINK_SPEED_40G RTE_BIT32(11)
#define RTE_ETH_LINK_SPEED_50G RTE_BIT32(12)
#define RTE_ETH_LINK_SPEED_56G RTE_BIT32(13)
#define RTE_ETH_LINK_SPEED_100G RTE_BIT32(14)
#define RTE_ETH_LINK_SPEED_200G RTE_BIT32(15)
#define RTE_ETH_LINK_SPEED_400G RTE_BIT32(16)
#define RTE_ETH_LINK_SPEED_800G RTE_BIT32(17)
๐ซ Link speed ๐ซ
Ethernet numeric link speeds in Mbps โ the numbers themselves, in case you needed the actual digits ๐
#define RTE_ETH_SPEED_NUM_NONE 0
#define RTE_ETH_SPEED_NUM_10M 10
#define RTE_ETH_SPEED_NUM_100M 100
#define RTE_ETH_SPEED_NUM_1G 1000
#define RTE_ETH_SPEED_NUM_2_5G 2500
#define RTE_ETH_SPEED_NUM_5G 5000
#define RTE_ETH_SPEED_NUM_10G 10000
#define RTE_ETH_SPEED_NUM_20G 20000
#define RTE_ETH_SPEED_NUM_25G 25000
#define RTE_ETH_SPEED_NUM_40G 40000
#define RTE_ETH_SPEED_NUM_50G 50000
#define RTE_ETH_SPEED_NUM_56G 56000
#define RTE_ETH_SPEED_NUM_100G 100000
#define RTE_ETH_SPEED_NUM_200G 200000
#define RTE_ETH_SPEED_NUM_400G 400000
#define RTE_ETH_SPEED_NUM_800G 800000
#define RTE_ETH_SPEED_NUM_UNKNOWN UINT32_MAX
๐ Link negotiation ๐
Constants used in link management. โ duplex, up/down, fixed vs autoneg, that whole situation ๐
#define RTE_ETH_LINK_HALF_DUPLEX 0
#define RTE_ETH_LINK_FULL_DUPLEX 1
#define RTE_ETH_LINK_DOWN 0
#define RTE_ETH_LINK_UP 1
#define RTE_ETH_LINK_FIXED 0
#define RTE_ETH_LINK_AUTONEG 1
#define RTE_ETH_LINK_MAX_STR_LEN 40
๐ธ Multi-queue mode ๐ธ
See also: rte_eth_conf.rxmode.mq_mode.
#define RTE_ETH_MQ_RX_RSS_FLAG RTE_BIT32(0)
#define RTE_ETH_MQ_RX_DCB_FLAG RTE_BIT32(1)
#define RTE_ETH_MQ_RX_VMDQ_FLAG RTE_BIT32(2)
๐ VMDq and DCB maximums ๐
#define RTE_ETH_VMDQ_MAX_VLAN_FILTERS 64
#define RTE_ETH_DCB_NUM_USER_PRIORITIES 8
#define RTE_ETH_VMDQ_DCB_NUM_QUEUES 128
#define RTE_ETH_DCB_NUM_QUEUES 128
โจ DCB capabilities โจ
#define RTE_ETH_DCB_PG_SUPPORT RTE_BIT32(0)
#define RTE_ETH_DCB_PFC_SUPPORT RTE_BIT32(1)
๐ฆ VLAN offload bits ๐ฆ
#define RTE_ETH_VLAN_STRIP_OFFLOAD 0x0001
#define RTE_ETH_VLAN_FILTER_OFFLOAD 0x0002
#define RTE_ETH_VLAN_EXTEND_OFFLOAD 0x0004
#define RTE_ETH_QINQ_STRIP_OFFLOAD 0x0008
#define RTE_ETH_VLAN_STRIP_MASK 0x0001
#define RTE_ETH_VLAN_FILTER_MASK 0x0002
#define RTE_ETH_VLAN_EXTEND_MASK 0x0004
#define RTE_ETH_QINQ_STRIP_MASK 0x0008
#define RTE_ETH_VLAN_ID_MAX 0x0FFF
๐ VMDq Rx mode ๐
See also: rte_eth_vmdq_rx_conf.rx_mode
#define RTE_ETH_VMDQ_ACCEPT_UNTAG RTE_BIT32(0)
#define RTE_ETH_VMDQ_ACCEPT_HASH_MC RTE_BIT32(1)
#define RTE_ETH_VMDQ_ACCEPT_HASH_UC RTE_BIT32(2)
#define RTE_ETH_VMDQ_ACCEPT_BROADCAST RTE_BIT32(3)
#define RTE_ETH_VMDQ_ACCEPT_MULTICAST RTE_BIT32(4)
๐ Device capabilities ๐
Non-offload capabilities reported in rte_eth_dev_info.dev_capa.
#define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP RTE_BIT64(0)
#define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP RTE_BIT64(1)
#define RTE_ETH_DEV_CAPA_RXQ_SHARE RTE_BIT64(2)
#define RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP RTE_BIT64(3)
#define RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP RTE_BIT64(4)
๐ฏ Rx/Tx queue states ๐ฏ
#define RTE_ETH_QUEUE_STATE_STOPPED 0
#define RTE_ETH_QUEUE_STATE_STARTED 1
#define RTE_ETH_QUEUE_STATE_HAIRPIN 2
๐ Device flags ๐
Flags internally saved inrte_eth_dev_data.dev_flagsand reported inrte_eth_dev_info.dev_flags.
#define RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE RTE_BIT32(0)
#define RTE_ETH_DEV_INTR_LSC RTE_BIT32(1)
#define RTE_ETH_DEV_BONDING_MEMBER RTE_BIT32(2)
#define RTE_ETH_DEV_INTR_RMV RTE_BIT32(3)
#define RTE_ETH_DEV_REPRESENTOR RTE_BIT32(4)
#define RTE_ETH_DEV_NOLIVE_MAC_ADDR RTE_BIT32(5)
#define RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS RTE_BIT32(6)
๐ฅ Rx hardware descriptor states ๐ฅ
See also: rte_eth_rx_descriptor_status
#define RTE_ETH_RX_DESC_AVAIL 0
#define RTE_ETH_RX_DESC_DONE 1
#define RTE_ETH_RX_DESC_UNAVAIL 2
๐ Tx hardware descriptor states ๐
See also: rte_eth_tx_descriptor_status
#define RTE_ETH_TX_DESC_FULL 0
#define RTE_ETH_TX_DESC_DONE 1
#define RTE_ETH_TX_DESC_UNAVAIL 2
๐ Typedefs ๐
the callback function types, bestie โ these are the little function-pointer glow-ups you'll be handing to the library:
typedef uint16_t(* rte_rx_callback_fn) (uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, uint16_t max_pkts, void *user_param)typedef uint16_t(* rte_tx_callback_fn) (uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, void *user_param)typedef int(* rte_eth_dev_cb_fn) (uint16_t port_id, enum rte_eth_event_type event, void *cb_arg, void *ret_param)
okay that's the header of the header, we're just getting started and there's SO much more coming ๐ stay tuned for part 2, it only gets more iconic from here ๐ฆโจ
โจ Enumerations โจ
okay bestie, buckle UP, because this is the big vibe-check section โ every enum this header rolls with, in order, nothing skipped, no crumbs left behind. these are the little enum lists that decide which flavour of everything you get. let's go ๐
๐ enum rte_eth_link_connector ๐
the connector menu. every physical port type that could possibly be plugged into your NIC:
enum rte_eth_link_connector {
RTE_ETH_LINK_CONNECTOR_NONE = 0,
RTE_ETH_LINK_CONNECTOR_TP,
RTE_ETH_LINK_CONNECTOR_AUI,
RTE_ETH_LINK_CONNECTOR_MII,
RTE_ETH_LINK_CONNECTOR_FIBER,
RTE_ETH_LINK_CONNECTOR_BNC,
RTE_ETH_LINK_CONNECTOR_DAC,
RTE_ETH_LINK_CONNECTOR_SGMII,
RTE_ETH_LINK_CONNECTOR_QSGMII,
RTE_ETH_LINK_CONNECTOR_XFI,
RTE_ETH_LINK_CONNECTOR_SFI,
RTE_ETH_LINK_CONNECTOR_XLAUI,
RTE_ETH_LINK_CONNECTOR_GAUI,
RTE_ETH_LINK_CONNECTOR_XAUI,
RTE_ETH_LINK_CONNECTOR_CAUI,
RTE_ETH_LINK_CONNECTOR_LAUI,
RTE_ETH_LINK_CONNECTOR_SFP,
RTE_ETH_LINK_CONNECTOR_SFP_PLUS,
RTE_ETH_LINK_CONNECTOR_SFP28,
RTE_ETH_LINK_CONNECTOR_SFP_DD,
RTE_ETH_LINK_CONNECTOR_QSFP,
RTE_ETH_LINK_CONNECTOR_QSFP_PLUS,
RTE_ETH_LINK_CONNECTOR_QSFP28,
RTE_ETH_LINK_CONNECTOR_QSFP56,
RTE_ETH_LINK_CONNECTOR_QSFP_DD,
RTE_ETH_LINK_CONNECTOR_OTHER = 63
};
RTE_ETH_LINK_CONNECTOR_NONEโ0, the "no connector, no thoughts, head empty" default ๐ซถRTE_ETH_LINK_CONNECTOR_TPโ next in line, no explicit value, so she just chains onto the one before herRTE_ETH_LINK_CONNECTOR_AUIโ keeping the streak going, auto-numberedRTE_ETH_LINK_CONNECTOR_MIIโ still counting up, no explicit value hereRTE_ETH_LINK_CONNECTOR_FIBERโ auto-numbered, she's the glow-up eraRTE_ETH_LINK_CONNECTOR_BNCโ no explicit value, just vibing in sequenceRTE_ETH_LINK_CONNECTOR_DACโ same deal, implicit numberRTE_ETH_LINK_CONNECTOR_SGMIIโ implicit value, next pleaseRTE_ETH_LINK_CONNECTOR_QSGMIIโ implicit again, the sequel eraRTE_ETH_LINK_CONNECTOR_XFIโ still implicit, still iconicRTE_ETH_LINK_CONNECTOR_SFIโ implicit valueRTE_ETH_LINK_CONNECTOR_XLAUIโ implicit valueRTE_ETH_LINK_CONNECTOR_GAUIโ implicit valueRTE_ETH_LINK_CONNECTOR_XAUIโ implicit valueRTE_ETH_LINK_CONNECTOR_CAUIโ implicit valueRTE_ETH_LINK_CONNECTOR_LAUIโ implicit valueRTE_ETH_LINK_CONNECTOR_SFPโ implicit valueRTE_ETH_LINK_CONNECTOR_SFP_PLUSโ implicit valueRTE_ETH_LINK_CONNECTOR_SFP28โ implicit valueRTE_ETH_LINK_CONNECTOR_SFP_DDโ implicit valueRTE_ETH_LINK_CONNECTOR_QSFPโ implicit valueRTE_ETH_LINK_CONNECTOR_QSFP_PLUSโ implicit valueRTE_ETH_LINK_CONNECTOR_QSFP28โ implicit valueRTE_ETH_LINK_CONNECTOR_QSFP56โ implicit valueRTE_ETH_LINK_CONNECTOR_QSFP_DDโ implicit valueRTE_ETH_LINK_CONNECTOR_OTHERโ and then she hard-stops at63. a whole lotta room for "none of the above" ๐
๐ธ enum rte_eth_rx_mq_mode ๐ธ
receive-side multi-queue modes. heads up bestie โ these values are literally built by OR-ing flag constants together, so the numbers are doing gymnastics:
enum rte_eth_rx_mq_mode {
RTE_ETH_MQ_RX_NONE = 0,
RTE_ETH_MQ_RX_RSS = RTE_ETH_MQ_RX_RSS_FLAG,
RTE_ETH_MQ_RX_DCB = RTE_ETH_MQ_RX_DCB_FLAG,
RTE_ETH_MQ_RX_DCB_RSS = RTE_ETH_MQ_RX_RSS_FLAG | RTE_ETH_MQ_RX_DCB_FLAG,
RTE_ETH_MQ_RX_VMDQ_ONLY = RTE_ETH_MQ_RX_VMDQ_FLAG,
RTE_ETH_MQ_RX_VMDQ_RSS = RTE_ETH_MQ_RX_RSS_FLAG | RTE_ETH_MQ_RX_VMDQ_FLAG,
RTE_ETH_MQ_RX_VMDQ_DCB = RTE_ETH_MQ_RX_VMDQ_FLAG | RTE_ETH_MQ_RX_DCB_FLAG,
RTE_ETH_MQ_RX_VMDQ_DCB_RSS
};
RTE_ETH_MQ_RX_NONEโ0, nothing enabled, empty inbox energyRTE_ETH_MQ_RX_RSSโ equalsRTE_ETH_MQ_RX_RSS_FLAGRTE_ETH_MQ_RX_DCBโ equalsRTE_ETH_MQ_RX_DCB_FLAGRTE_ETH_MQ_RX_DCB_RSSโ equalsRTE_ETH_MQ_RX_RSS_FLAG | RTE_ETH_MQ_RX_DCB_FLAG, the collab nobody expected but everyone needed โจRTE_ETH_MQ_RX_VMDQ_ONLYโ equalsRTE_ETH_MQ_RX_VMDQ_FLAGRTE_ETH_MQ_RX_VMDQ_RSSโ equalsRTE_ETH_MQ_RX_RSS_FLAG | RTE_ETH_MQ_RX_VMDQ_FLAGRTE_ETH_MQ_RX_VMDQ_DCBโ equalsRTE_ETH_MQ_RX_VMDQ_FLAG | RTE_ETH_MQ_RX_DCB_FLAGRTE_ETH_MQ_RX_VMDQ_DCB_RSSโ the final one, no explicit value, so she just follows the last member ๐
๐ฆ enum rte_eth_tx_mq_mode ๐ฆ
the transmit-side sibling. same energy, fewer flavours:
enum rte_eth_tx_mq_mode {
RTE_ETH_MQ_TX_NONE = 0,
RTE_ETH_MQ_TX_DCB,
RTE_ETH_MQ_TX_VMDQ_DCB,
RTE_ETH_MQ_TX_VMDQ_ONLY
};
RTE_ETH_MQ_TX_NONEโ0, the "I'm not doing all that" starter packRTE_ETH_MQ_TX_DCBโ implicit value, next upRTE_ETH_MQ_TX_VMDQ_DCBโ implicit value, the crossover episodeRTE_ETH_MQ_TX_VMDQ_ONLYโ implicit value, closing out the group chat
๐ enum rte_vlan_type ๐
enum rte_vlan_type { }
no members. none. zero. the enum said "I'm just here for the aesthetic" and honestly? respect ๐
โญ enum rte_eth_hash_function โญ
the hash function catalogue. choose your fighter:
enum rte_eth_hash_function {
RTE_ETH_HASH_FUNCTION_DEFAULT = 0,
RTE_ETH_HASH_FUNCTION_TOEPLITZ,
RTE_ETH_HASH_FUNCTION_SIMPLE_XOR,
RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ,
RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORT,
RTE_ETH_HASH_FUNCTION_MAX
};
RTE_ETH_HASH_FUNCTION_DEFAULTโ0, the "let the driver decide, I trust the process" pickRTE_ETH_HASH_FUNCTION_TOEPLITZโ implicit value, the classicRTE_ETH_HASH_FUNCTION_SIMPLE_XORโ implicit value, the low-effort iconRTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZโ implicit value, Toeplitz but make it symmetrical โจRTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORTโ implicit value, the remixRTE_ETH_HASH_FUNCTION_MAXโ implicit value, the "you've gone too far" sentinel ๐ฉ
๐ง enum rte_eth_nb_tcs ๐ง
enum rte_eth_nb_tcs {
RTE_ETH_4_TCS = 4,
RTE_ETH_8_TCS = 8
};
RTE_ETH_4_TCSโ4RTE_ETH_8_TCSโ8
four or eight, choose wisely, no in-between bestie ๐
๐ enum rte_eth_nb_pools ๐
enum rte_eth_nb_pools {
RTE_ETH_8_POOLS = 8,
RTE_ETH_16_POOLS = 16,
RTE_ETH_32_POOLS = 32,
RTE_ETH_64_POOLS = 64
};
RTE_ETH_8_POOLSโ8RTE_ETH_16_POOLSโ16RTE_ETH_32_POOLSโ32RTE_ETH_64_POOLSโ64, doubling down all the way to the top ๐
๐ฅ enum rte_eth_fc_mode ๐ฅ
flow control modes. the traffic-shaping drama:
enum rte_eth_fc_mode {
RTE_ETH_FC_NONE = 0,
RTE_ETH_FC_RX_PAUSE,
RTE_ETH_FC_TX_PAUSE,
RTE_ETH_FC_FULL
};
RTE_ETH_FC_NONEโ0, no pausing, everybody yapping at full volumeRTE_ETH_FC_RX_PAUSEโ implicit value, pause on the receiving endRTE_ETH_FC_TX_PAUSEโ implicit value, pause on the sending endRTE_ETH_FC_FULLโ implicit value, both sides pausing, full commitment ๐
๐ enum rte_eth_tunnel_type ๐
just the type name, bestie โ no members are spelled out here. the guest list lives elsewhere.
๐ enum rte_eth_representor_type ๐
enum rte_eth_representor_type {
RTE_ETH_REPRESENTOR_NONE,
RTE_ETH_REPRESENTOR_VF,
RTE_ETH_REPRESENTOR_SF,
RTE_ETH_REPRESENTOR_PF
};
RTE_ETH_REPRESENTOR_NONEโ first one, so it's the implicit0RTE_ETH_REPRESENTOR_VFโ implicit value, next in the queueRTE_ETH_REPRESENTOR_SFโ implicit value, still rollingRTE_ETH_REPRESENTOR_PFโ implicit value, the finale
๐ซถ enum rte_eth_err_handle_mode ๐ซถ
how your device handles an oopsie:
enum rte_eth_err_handle_mode {
RTE_ETH_ERROR_HANDLE_MODE_NONE,
RTE_ETH_ERROR_HANDLE_MODE_PASSIVE,
RTE_ETH_ERROR_HANDLE_MODE_PROACTIVE
};
RTE_ETH_ERROR_HANDLE_MODE_NONEโ first, implicit0, "errors? never heard of her"RTE_ETH_ERROR_HANDLE_MODE_PASSIVEโ implicit value, let it happen, observe, no commentRTE_ETH_ERROR_HANDLE_MODE_PROACTIVEโ implicit value, actually doing something about it?? growth ๐
โจ enum rte_eth_fec_mode โจ
FEC modes, the error-correction menu:
enum rte_eth_fec_mode {
RTE_ETH_FEC_NOFEC = 0,
RTE_ETH_FEC_AUTO,
RTE_ETH_FEC_BASER,
RTE_ETH_FEC_RS,
RTE_ETH_FEC_LLRS
};
RTE_ETH_FEC_NOFECโ0, raw dogging the wire, no correction, no safety net ๐ญRTE_ETH_FEC_AUTOโ implicit value, "you pick for me, I'm indecisive"RTE_ETH_FEC_BASERโ implicit valueRTE_ETH_FEC_RSโ implicit valueRTE_ETH_FEC_LLRSโ implicit value, rounding out the set
๐ enum rte_eth_dev_state ๐
the three moods of a device:
enum rte_eth_dev_state {
RTE_ETH_DEV_UNUSED = 0,
RTE_ETH_DEV_ATTACHED,
RTE_ETH_DEV_REMOVED
};
RTE_ETH_DEV_UNUSEDโ0, unbothered, unplugged, unproblematicRTE_ETH_DEV_ATTACHEDโ implicit value, she's HERE and she's presentRTE_ETH_DEV_REMOVEDโ implicit value, gone, blocked, deleted ๐ซ
๐ enum rte_eth_event_macsec_subtype ๐
MACsec sub-events. warning: these names are LONG, but every single one matters:
enum rte_eth_event_macsec_subtype {
RTE_ETH_SUBEVENT_MACSEC_UNKNOWN,
RTE_ETH_SUBEVENT_MACSEC_RX_SECTAG_V_EQ1,
RTE_ETH_SUBEVENT_MACSEC_RX_SECTAG_E_EQ0_C_EQ1,
RTE_ETH_SUBEVENT_MACSEC_RX_SECTAG_SL_GTE48,
RTE_ETH_SUBEVENT_MACSEC_RX_SECTAG_ES_EQ1_SC_EQ1,
RTE_ETH_SUBEVENT_MACSEC_RX_SECTAG_SC_EQ1_SCB_EQ1
};
RTE_ETH_SUBEVENT_MACSEC_UNKNOWNโ first, implicit0, "no idea what happened honestly"RTE_ETH_SUBEVENT_MACSEC_RX_SECTAG_V_EQ1โ implicit valueRTE_ETH_SUBEVENT_MACSEC_RX_SECTAG_E_EQ0_C_EQ1โ implicit valueRTE_ETH_SUBEVENT_MACSEC_RX_SECTAG_SL_GTE48โ implicit valueRTE_ETH_SUBEVENT_MACSEC_RX_SECTAG_ES_EQ1_SC_EQ1โ implicit valueRTE_ETH_SUBEVENT_MACSEC_RX_SECTAG_SC_EQ1_SCB_EQ1โ implicit value, last one, she did that ๐
๐ enum rte_eth_event_macsec_type ๐
the MACsec event types themselves:
enum rte_eth_event_macsec_type {
RTE_ETH_EVENT_MACSEC_UNKNOWN,
RTE_ETH_EVENT_MACSEC_SECTAG_VAL_ERR,
RTE_ETH_EVENT_MACSEC_RX_SA_PN_HARD_EXP,
RTE_ETH_EVENT_MACSEC_RX_SA_PN_SOFT_EXP,
RTE_ETH_EVENT_MACSEC_TX_SA_PN_HARD_EXP,
RTE_ETH_EVENT_MACSEC_TX_SA_PN_SOFT_EXP,
RTE_ETH_EVENT_MACSEC_SA_NOT_VALID
};
RTE_ETH_EVENT_MACSEC_UNKNOWNโ first, implicit0RTE_ETH_EVENT_MACSEC_SECTAG_VAL_ERRโ implicit valueRTE_ETH_EVENT_MACSEC_RX_SA_PN_HARD_EXPโ implicit valueRTE_ETH_EVENT_MACSEC_RX_SA_PN_SOFT_EXPโ implicit value, the gentler sibling of the hard one aboveRTE_ETH_EVENT_MACSEC_TX_SA_PN_HARD_EXPโ implicit valueRTE_ETH_EVENT_MACSEC_TX_SA_PN_SOFT_EXPโ implicit valueRTE_ETH_EVENT_MACSEC_SA_NOT_VALIDโ implicit value, "this SA is not it" ๐
๐ enum rte_eth_event_ipsec_subtype ๐
IPsec sub-events โ and bestie, LOOK at the negative numbers, this one gets spicy:
enum rte_eth_event_ipsec_subtype {
RTE_ETH_EVENT_IPSEC_PMD_ERROR_START = -256,
RTE_ETH_EVENT_IPSEC_PMD_ERROR_END = -1,
RTE_ETH_EVENT_IPSEC_UNKNOWN = 0,
RTE_ETH_EVENT_IPSEC_ESN_OVERFLOW,
RTE_ETH_EVENT_IPSEC_SA_TIME_EXPIRY,
RTE_ETH_EVENT_IPSEC_SA_BYTE_EXPIRY,
RTE_ETH_EVENT_IPSEC_SA_PKT_EXPIRY,
RTE_ETH_EVENT_IPSEC_SA_BYTE_HARD_EXPIRY,
RTE_ETH_EVENT_IPSEC_SA_PKT_HARD_EXPIRY,
RTE_ETH_EVENT_IPSEC_MAX
};
RTE_ETH_EVENT_IPSEC_PMD_ERROR_STARTโ equals-256, yes NEGATIVE, the opening bracket of the driver-error range ๐ญRTE_ETH_EVENT_IPSEC_PMD_ERROR_ENDโ equals-1, the closing bracket. that whole range is reserved territory, don't go wandering inRTE_ETH_EVENT_IPSEC_UNKNOWNโ equals0, back to zero, we're safeRTE_ETH_EVENT_IPSEC_ESN_OVERFLOWโ implicit valueRTE_ETH_EVENT_IPSEC_SA_TIME_EXPIRYโ implicit valueRTE_ETH_EVENT_IPSEC_SA_BYTE_EXPIRYโ implicit valueRTE_ETH_EVENT_IPSEC_SA_PKT_EXPIRYโ implicit valueRTE_ETH_EVENT_IPSEC_SA_BYTE_HARD_EXPIRYโ implicit valueRTE_ETH_EVENT_IPSEC_SA_PKT_HARD_EXPIRYโ implicit valueRTE_ETH_EVENT_IPSEC_MAXโ implicit value, the ceiling, don't go above it
๐ฅ enum rte_eth_event_type ๐ฅ
THE event enum. the one every callback cares about. big list, big energy:
enum rte_eth_event_type {
RTE_ETH_EVENT_UNKNOWN,
RTE_ETH_EVENT_INTR_LSC,
RTE_ETH_EVENT_QUEUE_STATE,
RTE_ETH_EVENT_INTR_RESET,
RTE_ETH_EVENT_VF_MBOX,
RTE_ETH_EVENT_MACSEC,
RTE_ETH_EVENT_INTR_RMV,
RTE_ETH_EVENT_NEW,
RTE_ETH_EVENT_DESTROY,
RTE_ETH_EVENT_IPSEC,
RTE_ETH_EVENT_FLOW_AGED,
RTE_ETH_EVENT_RX_AVAIL_THRESH,
RTE_ETH_EVENT_ERR_RECOVERING,
RTE_ETH_EVENT_RECOVERY_SUCCESS,
RTE_ETH_EVENT_RECOVERY_FAILED,
RTE_ETH_EVENT_MAX
};
RTE_ETH_EVENT_UNKNOWNโ first, implicit0, the mystery boxRTE_ETH_EVENT_INTR_LSCโ implicit valueRTE_ETH_EVENT_QUEUE_STATEโ implicit valueRTE_ETH_EVENT_INTR_RESETโ implicit valueRTE_ETH_EVENT_VF_MBOXโ implicit valueRTE_ETH_EVENT_MACSECโ implicit valueRTE_ETH_EVENT_INTR_RMVโ implicit valueRTE_ETH_EVENT_NEWโ implicit value, a baby device just dropped ๐RTE_ETH_EVENT_DESTROYโ implicit value, and now it's gone, RIPRTE_ETH_EVENT_IPSECโ implicit valueRTE_ETH_EVENT_FLOW_AGEDโ implicit valueRTE_ETH_EVENT_RX_AVAIL_THRESHโ implicit valueRTE_ETH_EVENT_ERR_RECOVERINGโ implicit valueRTE_ETH_EVENT_RECOVERY_SUCCESSโ implicit value, the redemption arc โจRTE_ETH_EVENT_RECOVERY_FAILEDโ implicit value, the arc where it did NOT work out ๐ญRTE_ETH_EVENT_MAXโ implicit value, the sentinel, the end, periodt
๐ง enum rte_eth_cman_obj ๐ง
congestion-management objects, defined with RTE_BIT32 bit values instead of plain integers, which is a whole flex:
enum rte_eth_cman_obj {
RTE_ETH_CMAN_OBJ_RX_QUEUE = RTE_BIT32(0),
RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOL = RTE_BIT32(1)
};
RTE_ETH_CMAN_OBJ_RX_QUEUEโ equalsRTE_BIT32(0)RTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOLโ equalsRTE_BIT32(1), bit-shifted one to the left, she's different ๐int rte_eth_iterator_init (struct rte_dev_iterator *iter, const char *devargs)โ the setup arc for the iterator era. you hand ititeranddevargsand it gets everything ready โจuint16_t rte_eth_iterator_next (struct rte_eth_iterator *iter)โ the "and then??" of the iterator saga. takes youriterand gives you the next one ๐ซvoid rte_eth_iterator_cleanup (struct rte_eth_iterator *iter)โ cleanup era, no return value, just closure. give ititerand it tidies up ๐งนstatic uint64_t rte_eth_rss_hf_refine (uint64_t rss_hf)โ static, lowkey private, refine-coded. takesrss_hfin, hands back auint64_t๐uint64_t rte_eth_find_next_owned_by (uint16_t port_id, const uint64_t owner_id)โ the finder that only vibes with a specific owner.port_id+owner_id, returns auint64_t๐uint16_t rte_eth_find_next (uint16_t port_id)โ the iconic find-next. give it aport_id, get auint16_tback ๐uint16_t rte_eth_find_next_of (uint16_t port_id_start, const struct rte_device *parent)โ find-next but make it family-coded: starting fromport_id_start, matched byparent๐uint16_t rte_eth_find_next_sibling (uint16_t port_id_start, uint16_t ref_port_id)โ the sibling search, usingport_id_startandref_port_idto find its kin ๐ซถint rte_eth_dev_owner_new (uint64_t *owner_id)โ brand new owner, freshly minted, written out throughowner_idโจint rte_eth_dev_owner_set (const uint16_t port_id, const struct rte_eth_dev_owner *owner)โ setting the owner on aport_id, usingowner. the commitment ceremony ๐int rte_eth_dev_owner_unset (const uint16_t port_id, const uint64_t owner_id)โ unsetting that owner.port_idandowner_idboth invited ๐ฅint rte_eth_dev_owner_delete (const uint64_t owner_id)โ straight up deleting the owner identified byowner_id. gone, blocked, no contact ๐int rte_eth_dev_owner_get (const uint16_t port_id, struct rte_eth_dev_owner *owner)โ the gossip function. peek theownerof aport_id๐uint16_t rte_eth_dev_count_avail (void)โ how many are available. no arguments, pure vibes, returns auint16_tโญuint16_t rte_eth_dev_count_total (void)โ the total headcount, every single one, no skips ๐ธuint32_t rte_eth_speed_bitflag (uint32_t speed, int duplex)โ turnsspeedandduplexinto auint32_tbitflag. math but cute ๐ฅconst char * rte_eth_dev_rx_offload_name (uint64_t offload)โ name reveal for an rx offload. give itoffload, get aconst char *back ๐const char * rte_eth_dev_tx_offload_name (uint64_t offload)โ same energy, tx edition.offloadin, name out ๐__rte_experimental const char * rte_eth_dev_capability_name (uint64_t capability)โ experimental, so don't build your whole life on it yet! names acapability๐int rte_eth_dev_configure (uint16_t port_id, uint16_t nb_rx_queue, uint16_t nb_tx_queue, const struct rte_eth_conf *eth_conf)โ THE main character.port_id,nb_rx_queue,nb_tx_queue, andeth_confall walk in and the port gets configured ๐int rte_eth_dev_is_removed (uint16_t port_id)โ vibe check: is thisport_idremoved? ๐int rte_eth_rx_queue_setup (uint16_t port_id, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mb_pool)โ the big rx queue setup.port_id,rx_queue_id,nb_rx_desc,socket_id,rx_conf,mb_pool. six whole arguments, she's committed โจ__rte_experimental int rte_eth_rx_hairpin_queue_setup (uint16_t port_id, uint16_t rx_queue_id, uint16_t nb_rx_desc, const struct rte_eth_hairpin_conf *conf)โ experimental hairpin rx setup:port_id,rx_queue_id,nb_rx_desc,conf๐int rte_eth_tx_queue_setup (uint16_t port_id, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf)โ tx queue setup, same ritual:port_id,tx_queue_id,nb_tx_desc,socket_id,tx_conf๐__rte_experimental int rte_eth_tx_hairpin_queue_setup (uint16_t port_id, uint16_t tx_queue_id, uint16_t nb_tx_desc, const struct rte_eth_hairpin_conf *conf)โ hairpin tx setup, experimental cutie:port_id,tx_queue_id,nb_tx_desc,conf๐ฆ__rte_experimental int rte_eth_hairpin_get_peer_ports (uint16_t port_id, uint16_t *peer_ports, size_t len, uint32_t direction)โ experimental. who's your peer?port_id,peer_ports,len,direction๐ซถ__rte_experimental int rte_eth_hairpin_bind (uint16_t tx_port, uint16_t rx_port)โ experimental binding:tx_portandrx_port, officially linked ๐__rte_experimental int rte_eth_hairpin_unbind (uint16_t tx_port, uint16_t rx_port)โ experimental unbinding. same two,tx_portandrx_port, but now it's over ๐__rte_experimental int rte_eth_dev_count_aggr_ports (uint16_t port_id)โ experimental count of aggr ports for aport_idโญ__rte_experimental int rte_eth_dev_map_aggr_tx_affinity (uint16_t port_id, uint16_t tx_queue_id, uint8_t affinity)โ experimental mapping of aggr tx affinity:port_id,tx_queue_id,affinity๐งint rte_eth_dev_socket_id (uint16_t port_id)โ which socket is thisport_idon? returns anint๐int rte_eth_dev_is_valid_port (uint16_t port_id)โ the classic vibe check. isport_idvalid or not ๐__rte_experimental int rte_eth_rx_queue_is_valid (uint16_t port_id, uint16_t queue_id)โ experimental rx queue vibe check:port_id+queue_idโ__rte_experimental int rte_eth_tx_queue_is_valid (uint16_t port_id, uint16_t queue_id)โ experimental tx queue vibe check, same two args ๐int rte_eth_dev_rx_queue_start (uint16_t port_id, uint16_t rx_queue_id)โ start that rx queue.port_id,rx_queue_id, go ๐ธint rte_eth_dev_rx_queue_stop (uint16_t port_id, uint16_t rx_queue_id)โ stop that rx queue. same args, opposite mood ๐int rte_eth_dev_tx_queue_start (uint16_t port_id, uint16_t tx_queue_id)โ tx queue start,port_idandtx_queue_id๐int rte_eth_dev_tx_queue_stop (uint16_t port_id, uint16_t tx_queue_id)โ tx queue stop, same pair, we love symmetry โint rte_eth_dev_start (uint16_t port_id)โ the moment. oneport_id, and the device is started. iconic ๐int rte_eth_dev_stop (uint16_t port_id)โ and now she's stopped.port_id, that's it ๐คint rte_eth_dev_set_link_up (uint16_t port_id)โ link up forport_id. we're so back ๐int rte_eth_dev_set_link_down (uint16_t port_id)โ link down forport_id. it's over (temporarily) ๐ญint rte_eth_dev_close (uint16_t port_id)โ closing theport_id. goodbye era, doors shut ๐ชint rte_eth_dev_reset (uint16_t port_id)โ reset forport_id. fresh start energy ๐งผint rte_eth_promiscuous_enable (uint16_t port_id)โ enabling promiscuous mode onport_id. she's seeing everyone, no cap ๐int rte_eth_promiscuous_disable (uint16_t port_id)โ disabling it.port_idis loyal again ๐int rte_eth_promiscuous_get (uint16_t port_id)โ are we promiscuous onport_idor not? the question ๐ซฃint rte_eth_allmulticast_enable (uint16_t port_id)โ allmulticast on forport_id๐ฃint rte_eth_allmulticast_disable (uint16_t port_id)โ allmulticast off forport_id๐int rte_eth_allmulticast_get (uint16_t port_id)โ checking the allmulticast status ofport_id๐int rte_eth_link_get (uint16_t port_id, struct rte_eth_link *link) __rte_warn_unused_resultโ grab the link forport_idintolink. marked__rte_warn_unused_resultso literally check that return value or the compiler WILL side-eye you ๐int rte_eth_link_get_nowait (uint16_t port_id, struct rte_eth_link *link) __rte_warn_unused_resultโ the impatient version, also__rte_warn_unused_result.port_id,link, no waiting โฑ๏ธ__rte_experimental const char * rte_eth_link_speed_to_str (uint32_t link_speed)โ experimental stringifier forlink_speed๐__rte_experimental const char * rte_eth_link_connector_to_str (enum rte_eth_link_connector link_connector)โ experimental stringifier for alink_connector๐__rte_experimental int rte_eth_link_to_str (char *str, size_t len, const struct rte_eth_link *eth_link)โ experimental link-to-string intostrwithlen, readingeth_linkโจ__rte_experimental int rte_eth_speed_lanes_get (uint16_t port_id, uint32_t *lanes)โ experimental speed lanes get forport_idintolanes๐ค๏ธ__rte_experimental int rte_eth_speed_lanes_set (uint16_t port_id, uint32_t speed_lanes)โ experimental speed lanes set.port_id,speed_lanes๐ง__rte_experimental int rte_eth_speed_lanes_get_capability (uint16_t port_id, struct rte_eth_speed_lanes_capa *speed_lanes_capa, unsigned int num)โ experimental capability grab:port_id,speed_lanes_capa,numโญint rte_eth_stats_get (uint16_t port_id, struct rte_eth_stats *stats)โ stats forport_id, dumped intostats. numbers, we love them ๐int rte_eth_stats_reset (uint16_t port_id)โ zeroing those stats forport_id๐งผint rte_eth_xstats_get_names (uint16_t port_id, struct rte_eth_xstat_name *xstats_names, unsigned int size)โ the extended stats name list:port_id,xstats_names,size๐ท๏ธint rte_eth_xstats_get (uint16_t port_id, struct rte_eth_xstat *xstats, unsigned int n)โ extended stats values:port_id,xstats,n๐int rte_eth_xstats_get_names_by_id (uint16_t port_id, struct rte_eth_xstat_name *xstats_names, unsigned int size, uint64_t *ids)โ names, but you're queryingids:port_id,xstats_names,size๐int rte_eth_xstats_get_by_id (uint16_t port_id, const uint64_t *ids, uint64_t *values, unsigned int size)โ values byids:port_id,values,size๐ขint rte_eth_xstats_get_id_by_name (uint16_t port_id, const char *xstat_name, uint64_t *id)โ reverse lookup moment.port_id,xstat_name, and out comesid๐__rte_experimental int rte_eth_xstats_set_counter (uint16_t port_id, uint64_t id, int on_off)โ experimental counter toggling:port_id,id,on_off๐๏ธ__rte_experimental int rte_eth_xstats_query_state (uint16_t port_id, uint64_t id)โ experimental state query onport_idforid๐ซงint rte_eth_xstats_reset (uint16_t port_id)โ extended stats reset forport_id. back to zero ๐ซ__rte_deprecated int rte_eth_dev_set_tx_queue_stats_mapping (uint16_t port_id, uint16_t tx_queue_id, uint8_t stat_idx)โ deprecated, bestie, so don't go falling in love with it.port_id,tx_queue_id,stat_idx๐__rte_deprecated int rte_eth_dev_set_rx_queue_stats_mapping (uint16_t port_id, uint16_t rx_queue_id, uint8_t stat_idx)โ also deprecated.port_id,rx_queue_id,stat_idx. legacy behavior fr ๐ซint rte_eth_macaddr_get (uint16_t port_id, struct rte_ether_addr *mac_addr)โ snag the MAC forport_idintomac_addr๐__rte_experimental int rte_eth_macaddrs_get (uint16_t port_id, struct rte_ether_addr *ma, unsigned int num)โ experimental, and yes, plural.port_id,ma,num๐int rte_eth_dev_info_get (uint16_t port_id, struct rte_eth_dev_info *dev_info) __rte_warn_unused_resultโ the dev info scoop forport_id, intodev_info.__rte_warn_unused_result, so actually look at what it returns ๐__rte_experimental int rte_eth_dev_conf_get (uint16_t port_id, struct rte_eth_conf *dev_conf) __rte_warn_unused_resultโ experimental +__rte_warn_unused_result. config ofport_idout throughdev_confโ๏ธint rte_eth_dev_fw_version_get (uint16_t port_id, char *fw_version, size_t fw_size) __rte_warn_unused_resultโ firmware version intofw_versionwithfw_size, forport_id.__rte_warn_unused_result๐งint rte_eth_dev_get_supported_ptypes (uint16_t port_id, uint32_t ptype_mask, uint32_t *ptypes, int num) __rte_warn_unused_resultโ supported ptypes forport_id, filtered byptype_mask, out throughptypesandnum.__rte_warn_unused_result๐ท๏ธint rte_eth_dev_set_ptypes (uint16_t port_id, uint32_t ptype_mask, uint32_t *set_ptypes, unsigned int num)โ setting ptypes:port_id,ptype_mask,set_ptypes,num๐ฏint rte_eth_dev_get_mtu (uint16_t port_id, uint16_t *mtu)โ MTU check forport_id, written tomtu๐int rte_eth_dev_set_mtu (uint16_t port_id, uint16_t mtu)โ set that MTU.port_id+mtu๐int rte_eth_dev_vlan_filter (uint16_t port_id, uint16_t vlan_id, int on)โ VLAN filtering forport_idonvlan_id, toggled byon๐ท๏ธint rte_eth_dev_set_vlan_strip_on_queue (uint16_t port_id, uint16_t rx_queue_id, int on)โ VLAN strip on a queue:port_id,rx_queue_id,onโ๏ธint rte_eth_dev_set_vlan_ether_type (uint16_t port_id, enum rte_vlan_type vlan_type, uint16_t tag_type)โ VLAN ether type setting:port_id,vlan_type,tag_type๐int rte_eth_dev_set_vlan_offload (uint16_t port_id, int offload_mask)โ VLAN offload config onport_idusingoffload_mask. yes it's a bitmask situation ๐๏ธint rte_eth_dev_get_vlan_offload (uint16_t port_id)โ what's the VLAN offload status onport_id? returns anint๐ซงint rte_eth_dev_set_vlan_pvid (uint16_t port_id, uint16_t pvid, int on)โ PVID setting:port_id,pvid,on๐งท__rte_experimental int rte_eth_rx_avail_thresh_set (uint16_t port_id, uint16_t queue_id, uint8_t avail_thresh)โ experimental rx availability threshold, set edition:port_id,queue_id,avail_thresh๐ถ__rte_experimental int rte_eth_rx_avail_thresh_query (uint16_t port_id, uint16_t *queue_id, uint8_t *avail_thresh)โ experimental, query edition:port_id,queue_id,avail_thresh๐int rte_eth_tx_buffer_init (struct rte_eth_dev_tx_buffer *buffer, uint16_t size)โ tx buffer init.bufferandsize, starting fresh ๐int rte_eth_tx_buffer_set_err_callback (struct rte_eth_dev_tx_buffer *buffer, buffer_tx_error_fn callback, void *userdata)โ giving thatbufferan errorcallbackplususerdata. safety net era ๐ธ๏ธvoid rte_eth_tx_buffer_drop_callback (struct rte_mbuf **pkts, uint16_t unsent, void *userdata)โ the drop callback.pkts,unsent,userdata, and avoidreturn because it's done talking ๐void rte_eth_tx_buffer_count_callback (struct rte_mbuf **pkts, uint16_t unsent, void *userdata)โ the counting callback, same trio of args, also returningvoid๐ขint rte_eth_tx_done_cleanup (uint16_t port_id, uint16_t queue_id, uint32_t free_cnt)โ tx done cleanup:port_id,queue_id,free_cnt๐งนint rte_eth_dev_callback_register (uint16_t port_id, enum rte_eth_event_type event, rte_eth_dev_cb_fn cb_fn, void *cb_arg)โ registering a callback for aneventonport_id, withcb_fnandcb_arg๐๏ธint rte_eth_dev_callback_unregister (uint16_t port_id, enum rte_eth_event_type event, rte_eth_dev_cb_fn cb_fn, void *cb_arg)โ unregistering it. same four, we're unsubscribing ๐ชint rte_eth_dev_rx_intr_enable (uint16_t port_id, uint16_t queue_id)โ rx interrupt enable:port_id,queue_id๐int rte_eth_dev_rx_intr_disable (uint16_t port_id, uint16_t queue_id)โ rx interrupt disable, same pair ๐int rte_eth_dev_rx_intr_ctl (uint16_t port_id, int epfd, int op, void *data)โ rx interrupt control:port_id,epfd,op,data๐๏ธint rte_eth_dev_rx_intr_ctl_q (uint16_t port_id, uint16_t queue_id, int epfd, int op, void *data)โ the per-queue version:port_id,queue_id,epfd,op,data๐งตint rte_eth_dev_rx_intr_ctl_q_get_fd (uint16_t port_id, uint16_t queue_id)โ grabbing the fd for that queue's intr ctl:port_id+queue_id๐ซint rte_eth_led_on (uint16_t port_id)โ lights ON forport_id. sparkle time โจint rte_eth_led_off (uint16_t port_id)โ lights off. cozy mode forport_id๐__rte_experimental int rte_eth_fec_get_capability (uint16_t port_id, struct rte_eth_fec_capa *speed_fec_capa, unsigned int num)โ experimental FEC capability:port_id,speed_fec_capa,num๐งฌ__rte_experimental int rte_eth_fec_get (uint16_t port_id, uint32_t *fec_capa)โ experimental FEC get forport_idout throughfec_capa๐__rte_experimental int rte_eth_fec_set (uint16_t port_id, uint32_t fec_capa)โ experimental FEC set:port_id,fec_capa๐ธint rte_eth_dev_flow_ctrl_get (uint16_t port_id, struct rte_eth_fc_conf *fc_conf)โ flow control get forport_idintofc_conf๐int rte_eth_dev_flow_ctrl_set (uint16_t port_id, struct rte_eth_fc_conf *fc_conf)โ flow control set.port_id,fc_conf๐int rte_eth_dev_priority_flow_ctrl_set (uint16_t port_id, struct rte_eth_pfc_conf *pfc_conf)โ priority flow control set:port_idwithpfc_confโกint rte_eth_dev_mac_addr_add (uint16_t port_id, struct rte_ether_addr *mac_addr, uint32_t pool)โ adding a MAC address toport_id,mac_addrplus apool๐__rte_experimental int rte_eth_dev_priority_flow_ctrl_queue_info_get (uint16_t port_id, struct rte_eth_pfc_queue_info *pfc_queue_info)โ experimental pfc queue info grab forport_idintopfc_queue_info๐__rte_experimental int rte_eth_dev_priority_flow_ctrl_queue_configure (uint16_t port_id, struct rte_eth_pfc_queue_conf *pfc_queue_conf)โ experimental pfc queue configure:port_id+pfc_queue_conf๐ ๏ธint rte_eth_dev_mac_addr_remove (uint16_t port_id, struct rte_ether_addr *mac_addr)โ removing thatmac_addrfromport_id๐int rte_eth_dev_default_mac_addr_set (uint16_t port_id, struct rte_ether_addr *mac_addr)โ makingmac_addrthe default forport_id. main character MAC ๐int rte_eth_dev_rss_reta_update (uint16_t port_id, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size)โ RSS RETA update:port_id,reta_conf,reta_size๐งฎint rte_eth_dev_rss_reta_query (uint16_t port_id, struct rte_eth_rss_reta_entry64 *reta_conf, uint16_t reta_size)โ RSS RETA query, same three args, but asking instead of telling ๐ซงint rte_eth_dev_uc_hash_table_set (uint16_t port_id, struct rte_ether_addr *addr, uint8_t on)โ unicast hash table set:port_id,addr,on๐๏ธint rte_eth_dev_uc_all_hash_table_set (uint16_t port_id, uint8_t on)โ the all unicast hash table version:port_idandon๐๏ธint rte_eth_set_queue_rate_limit (uint16_t port_id, uint16_t queue_idx, uint32_t tx_rate)โ rate limiting a queue:port_id,queue_idx,tx_rate๐ฆint rte_eth_dev_rss_hash_update (uint16_t port_id, struct rte_eth_rss_conf *rss_conf)โ RSS hash update forport_idusingrss_conf๐ฏint rte_eth_dev_rss_hash_conf_get (uint16_t port_id, struct rte_eth_rss_conf *rss_conf)โ RSS hash config get,port_idintorss_conf๐งพ__rte_experimental const char * rte_eth_dev_rss_algo_name (enum rte_eth_hash_function rss_algo)โ experimental name reveal for anrss_algo๐ท๏ธ__rte_experimental int rte_eth_find_rss_algo (const char *name, uint32_t *algo)โ experimental reverse lookup: give it aname, get analgoback ๐
okay bestie we are STILL in the SYNOPSIS era and honestly this part is giving "the whole friend group shows up at once" ๐๐
the prototypes keep coming and they do NOT stop. hold my iced coffee, let's go.
first lil batch: tunnel ports, DCB info, and the callback girlies โ adding and removing RX/TX callbacks like they're RSVPs at a party ๐
int rte_eth_dev_udp_tunnel_port_add (uint16_t port_id, struct rte_eth_udp_tunnel *tunnel_udp)
int rte_eth_dev_udp_tunnel_port_delete (uint16_t port_id, struct rte_eth_udp_tunnel *tunnel_udp)
int rte_eth_dev_get_dcb_info (uint16_t port_id, struct rte_eth_dcb_info *dcb_info)
const struct rte_eth_rxtx_callback * rte_eth_add_rx_callback (uint16_t port_id, uint16_t queue_id, rte_rx_callback_fn fn, void *user_param)
const struct rte_eth_rxtx_callback * rte_eth_add_first_rx_callback (uint16_t port_id, uint16_t queue_id, rte_rx_callback_fn fn, void *user_param)
const struct rte_eth_rxtx_callback * rte_eth_add_tx_callback (uint16_t port_id, uint16_t queue_id, rte_tx_callback_fn fn, void *user_param)
int rte_eth_remove_rx_callback (uint16_t port_id, uint16_t queue_id, const struct rte_eth_rxtx_callback *user_cb)
int rte_eth_remove_tx_callback (uint16_t port_id, uint16_t queue_id, const struct rte_eth_rxtx_callback *user_cb)
โจ note the rte_eth_add_first_rx_callback โ that one is literally the main character, it goes FIRST. nobody asked but she said it anyway. periodt.
next up, the queue-info queens ๐ฅ every queue wants its info got, and the recycle girl is wearing an __rte_experimental badge like it's a limited-edition drop:
int rte_eth_rx_queue_info_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_rxq_info *qinfo)
int rte_eth_tx_queue_info_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_txq_info *qinfo)
__rte_experimental int rte_eth_recycle_rx_queue_info_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_recycle_rxq_info *recycle_rxq_info)
int rte_eth_rx_burst_mode_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_burst_mode *mode)
int rte_eth_tx_burst_mode_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_burst_mode *mode)
__rte_experimental int rte_eth_get_monitor_addr (uint16_t port_id, uint16_t queue_id, struct rte_power_monitor_cond *pmc)
then the hardware-inspection era ๐ง regs, eeproms, modules โ it's giving "let me look inside ur hardware, respectfully":
__rte_experimental int rte_eth_dev_get_reg_info_ext (uint16_t port_id, struct rte_dev_reg_info *info)
int rte_eth_dev_get_reg_info (uint16_t port_id, struct rte_dev_reg_info *info) __rte_warn_unused_result
int rte_eth_dev_get_eeprom_length (uint16_t port_id)
int rte_eth_dev_get_eeprom (uint16_t port_id, struct rte_dev_eeprom_info *info)
int rte_eth_dev_set_eeprom (uint16_t port_id, struct rte_dev_eeprom_info *info)
__rte_experimental int rte_eth_dev_get_module_info (uint16_t port_id, struct rte_eth_dev_module_info *modinfo) __rte_warn_unused_result
__rte_experimental int rte_eth_dev_get_module_eeprom (uint16_t port_id, struct rte_dev_eeprom_info *info) __rte_warn_unused_result
and a mc addr list moment, because multicast addresses deserve a whole set:
int rte_eth_dev_set_mc_addr_list (uint16_t port_id, struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr)
clock check โฐโฐโฐ the timesync section is here and it is LOWKEY obsessed with time (which, fair, so is every girl with a deadline):
int rte_eth_timesync_enable (uint16_t port_id)
int rte_eth_timesync_disable (uint16_t port_id)
int rte_eth_timesync_read_rx_timestamp (uint16_t port_id, struct timespec *timestamp, uint32_t flags)
int rte_eth_timesync_read_tx_timestamp (uint16_t port_id, struct timespec *timestamp)
int rte_eth_timesync_adjust_time (uint16_t port_id, int64_t delta)
__rte_experimental int rte_eth_timesync_adjust_freq (uint16_t port_id, int64_t ppm)
int rte_eth_timesync_read_time (uint16_t port_id, struct timespec *time)
int rte_eth_timesync_write_time (uint16_t port_id, const struct timespec *time)
__rte_experimental int rte_eth_read_clock (uint16_t port_id, uint64_t *clock)
the "who are you and what is ur name" batch ๐ ports by name, names by port, plus the desc-adjusting, pool-ops-checking, security-context-having icons:
int rte_eth_dev_get_port_by_name (const char *name, uint16_t *port_id)
int rte_eth_dev_get_name_by_port (uint16_t port_id, char *name)
int rte_eth_dev_adjust_nb_rx_tx_desc (uint16_t port_id, uint16_t *nb_rx_desc, uint16_t *nb_tx_desc)
int rte_eth_dev_pool_ops_supported (uint16_t port_id, const char *pool)
void * rte_eth_dev_get_sec_ctx (uint16_t port_id)
now the โจspecial featuresโจ aisle: hairpin, representors, metadata, and the IP reassembly trio (capa, conf get, conf set โ a whole lil love triangle). also __rte_experimental EVERYWHERE, we love a beta feature:
__rte_experimental int rte_eth_dev_hairpin_capability_get (uint16_t port_id, struct rte_eth_hairpin_cap *cap)
__rte_experimental int rte_eth_representor_info_get (uint16_t port_id, struct rte_eth_representor_info *info)
int rte_eth_rx_metadata_negotiate (uint16_t port_id, uint64_t *features)
__rte_experimental int rte_eth_ip_reassembly_capability_get (uint16_t port_id, struct rte_eth_ip_reassembly_params *capa)
__rte_experimental int rte_eth_ip_reassembly_conf_get (uint16_t port_id, struct rte_eth_ip_reassembly_params *conf)
__rte_experimental int rte_eth_ip_reassembly_conf_set (uint16_t port_id, const struct rte_eth_ip_reassembly_params *conf)
debug/dump era ๐ because sometimes u just have to look at the vibes directly. there's also the cman clique (info get, config init, config set, config get โ the full four-piece set ๐):
__rte_experimental int rte_eth_dev_priv_dump (uint16_t port_id, FILE *file)
__rte_experimental int rte_eth_rx_descriptor_dump (uint16_t port_id, uint16_t queue_id, uint16_t offset, uint16_t num, FILE *file)
__rte_experimental int rte_eth_tx_descriptor_dump (uint16_t port_id, uint16_t queue_id, uint16_t offset, uint16_t num, FILE *file)
__rte_experimental int rte_eth_cman_info_get (uint16_t port_id, struct rte_eth_cman_info *info)
__rte_experimental int rte_eth_cman_config_init (uint16_t port_id, struct rte_eth_cman_config *config)
__rte_experimental int rte_eth_cman_config_set (uint16_t port_id, const struct rte_eth_cman_config *config)
__rte_experimental int rte_eth_cman_config_get (uint16_t port_id, struct rte_eth_cman_config *config)
and FINALLY the data path girls โ the ones that are literally built different ๐ซถ static and __rte_always_inline doing the absolute most. rx burst, tx burst, counts, descriptor status, prepare, buffer, buffer flush, recycle, buffer split headers, tx queue count. this is the group chat that never sleeps:
static uint16_t rte_eth_rx_burst (uint16_t port_id, uint16_t queue_id, struct rte_mbuf **rx_pkts, const uint16_t nb_pkts)
static int rte_eth_rx_queue_count (uint16_t port_id, uint16_t queue_id)
static int rte_eth_rx_descriptor_status (uint16_t port_id, uint16_t queue_id, uint16_t offset)
static int rte_eth_tx_descriptor_status (uint16_t port_id, uint16_t queue_id, uint16_t offset)
static uint16_t rte_eth_tx_burst (uint16_t port_id, uint16_t queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
static uint16_t rte_eth_tx_prepare (uint16_t port_id, uint16_t queue_id, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
static uint16_t rte_eth_tx_buffer_flush (uint16_t port_id, uint16_t queue_id, struct rte_eth_dev_tx_buffer *buffer)
static __rte_always_inline uint16_t rte_eth_tx_buffer (uint16_t port_id, uint16_t queue_id, struct rte_eth_dev_tx_buffer *buffer, struct rte_mbuf *tx_pkt)
static __rte_experimental uint16_t rte_eth_recycle_mbufs (uint16_t rx_port_id, uint16_t rx_queue_id, uint16_t tx_port_id, uint16_t tx_queue_id, struct rte_eth_recycle_rxq_info *recycle_rxq_info)
__rte_experimental int rte_eth_buffer_split_get_supported_hdr_ptypes (uint16_t port_id, uint32_t *ptypes, int num) __rte_warn_unused_result
static __rte_experimental int rte_eth_tx_queue_count (uint16_t port_id, uint16_t queue_id)
๐ and that's the end of this batch of callback prototypes bestie โ don't worry, there are MORE parts coming, we are not done queening yet. stay tuned ๐
๐ Detailed Description ๐
okay so this is the RTE Ethernet Device API and bestie, it comes in two parts, both iconic in their own way โจ
- the application-oriented Ethernet API โ this one's packing all the functions to set up an Ethernet device (configure it, set up its Rx and Tx queues, start it), to get its MAC address, the speed and the status of its physical link, to receive and to transmit packets, and so on ๐
- the driver-oriented Ethernet API โ this one exports functions that let an Ethernet Poll Mode Driver (PMD) allocate an Ethernet device instance, create memzone for HW rings and process registered callbacks, and so on. Quick heads up though: PMDs should include
ethdev_driver.hinstead of this header ๐
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]. And of course, that same 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. like, not our problem, that's on you bestie.
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. no cap.
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:
rte_eth_dev_configure()rte_eth_tx_queue_setup()rte_eth_rx_queue_setup()rte_eth_dev_start()
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. And the transmit and receive functions should not be invoked when the device or the queue is stopped, okay? periodt.
Please note that some configuration is not stored between calls to rte_eth_dev_stop()/rte_eth_dev_start(). The following configuration will be retained:
- MTU
- flow control settings
- receive mode configuration (promiscuous mode, all-multicast mode, hardware checksum mode, RSS/VMDq settings etc.)
- VLAN filtering configuration
- default MAC address
- MAC addresses supplied to MAC address array
- flow director filtering mode (but not filtering rules)
- NIC queue statistics mappings
The following configuration may be retained or not depending on the device capabilities:
- flow rules
- flow-related shared objects, e.g. indirect actions
Any other configuration will not be stored and will need to be re-entered before a call to rte_eth_dev_start(). you've been warned ๐
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. see, they skipped a whole middleman for speed, iconic fr ๐ฅ
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:
- Sharing among multiple packets the incompressible cost of the invocation of receive/transmit functions.
- Enabling receive/transmit functions to take advantage of burst-oriented hardware features (L1 cache, prefetch instructions, NIC head/tail registers) to minimize the number of CPU cycles per packet, for instance, by avoiding useless read memory accesses to ring descriptors, or by systematically using arrays of pointers that exactly fit L1 cache line boundaries and sizes.
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 ๐ like if it keeps handing you zeros, go check that link bestie.
Definition in file rte_ethdev.h.
โจ Macro Definition Documentation โจ
#define RTE_ETH_FOREACH_MATCHING_DEV( id, devargs, iter)
Value:
for (rte_eth_iterator_init(iter, devargs), \
id = rte_eth_iterator_next(iter); \
id != RTE_MAX_ETHPORTS; \
id = rte_eth_iterator_next(iter))
Macro to iterate over all ethdev ports matching some devargs ๐ฆ
If a break is done before the end of the loop, the function rte_eth_iterator_cleanup() must be called. don't forget her, she'll be waiting ๐ญ
Parameters
- id โ Iterated port ID of type
uint16_t. - devargs โ Device parameters input as string of type
char*. - iter โ Iterator handle of type
struct rte_dev_iterator, used internally.
Definition at line 247 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_AUTONEG 0
Autonegotiate (all speeds) โ let the link work it out itself ๐ซ
Definition at line 280 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_FIXED RTE_BIT32(0)
Disable autoneg (fixed speed) โ you're picking, not the link ๐
Definition at line 281 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_10M_HD RTE_BIT32(1)
10 Mbps half-duplex
Definition at line 282 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_10M RTE_BIT32(2)
10 Mbps full-duplex
Definition at line 283 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_100M_HD RTE_BIT32(3)
100 Mbps half-duplex
Definition at line 284 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_100M RTE_BIT32(4)
100 Mbps full-duplex
Definition at line 285 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_1G RTE_BIT32(5)
1 Gbps
Definition at line 286 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_2_5G RTE_BIT32(6)
2.5 Gbps
Definition at line 287 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_5G RTE_BIT32(7)
5 Gbps
Definition at line 288 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_10G RTE_BIT32(8)
10 Gbps
Definition at line 289 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_20G RTE_BIT32(9)
20 Gbps
Definition at line 290 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_25G RTE_BIT32(10)
25 Gbps
Definition at line 291 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_40G RTE_BIT32(11)
40 Gbps
Definition at line 292 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_50G RTE_BIT32(12)
50 Gbps
Definition at line 293 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_56G RTE_BIT32(13)
56 Gbps
Definition at line 294 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_100G RTE_BIT32(14)
100 Gbps
Definition at line 295 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_200G RTE_BIT32(15)
200 Gbps
Definition at line 296 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_400G RTE_BIT32(16)
400 Gbps
Definition at line 297 of file rte_ethdev.h.
#define RTE_ETH_LINK_SPEED_800G RTE_BIT32(17)
800 Gbps
Definition at line 298 of file rte_ethdev.h.
๐ Macro Definition Documentation (cont.) ๐
#define RTE_ETH_SPEED_NUM_NONE 0
Not defined ๐คทโโ๏ธ
Definition at line 304 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_10M 10
10 Mbps
Definition at line 305 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_100M 100
100 Mbps
Definition at line 306 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_1G 1000
1 Gbps
Definition at line 307 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_2_5G 2500
2.5 Gbps
Definition at line 308 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_5G 5000
5 Gbps
Definition at line 309 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_10G 10000
10 Gbps
Definition at line 310 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_20G 20000
20 Gbps
Definition at line 311 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_25G 25000
25 Gbps
Definition at line 312 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_40G 40000
40 Gbps
Definition at line 313 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_50G 50000
50 Gbps
Definition at line 314 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_56G 56000
56 Gbps
Definition at line 315 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_100G 100000
100 Gbps
Definition at line 316 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_200G 200000
200 Gbps
Definition at line 317 of file rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_400G 400000
400 Gbps ๐
okay bestie we're back in the macro aisle of rte_ethdev.h and there's SO much more ๐
keep scrolling, it's all here.
#define RTE_ETH_SPEED_NUM_800G800000โ that's 800 Gbps</p>, yes really, the speed of light but make it ethernet โจ
Defined at line 318 of rte_ethdev.h.
#define RTE_ETH_SPEED_NUM_UNKNOWNUINT32_MAXโ Unknown, the "we literally don't know her" speed ๐ซ
Defined at line 320 of rte_ethdev.h.
#define RTE_ETH_LINK_HALF_DUPLEX0โ half-duplex connection (peeplink_duplex) ๐
Defined at line 379 of rte_ethdev.h.
#define RTE_ETH_LINK_FULL_DUPLEX1โ full-duplex connection (alsolink_duplex) โ full duplex is the main character here no cap ๐
Defined at line 380 of rte_ethdev.h.
#define RTE_ETH_LINK_DOWN0โ the link is down (seelink_status) ๐ญ
Defined at line 381 of rte_ethdev.h.
#define RTE_ETH_LINK_UP1โ the link is up (seelink_status) ๐ฆ
Defined at line 382 of rte_ethdev.h.
#define RTE_ETH_LINK_FIXED0โ no autonegotiation, it just commits (seelink_autoneg) ๐
Defined at line 383 of rte_ethdev.h.
#define RTE_ETH_LINK_AUTONEG1โ autonegotiated, the link and the port are in a healthy communicative relationship (seelink_autoneg) ๐
Defined at line 384 of rte_ethdev.h.
#define RTE_ETH_LINK_MAX_STR_LEN40โ max length of the default link string. that's the whole budget bestie, 40 chars โจ
Defined at line 385 of rte_ethdev.h.
#define RTE_ETH_SPEED_LANES_TO_CAPA( x)โ value is:
RTE_BIT32(x)
it translates from link speed lanes to speed lanes capabilities ๐
Defined at line 389 of rte_ethdev.h.
#define RTE_ETH_MQ_RX_RSS_FLAGRTE_BIT32(0)โ enables RSS ๐ซ
Peep also rte_eth_rss_conf for the whole situation.
Defined at line 410 of rte_ethdev.h.
#define RTE_ETH_MQ_RX_DCB_FLAGRTE_BIT32(1)โ enables DCB โจ
Defined at line 411 of rte_ethdev.h.
#define RTE_ETH_MQ_RX_VMDQ_FLAGRTE_BIT32(2)โ enables VMDq, the virtual machine queen ๐
Defined at line 412 of rte_ethdev.h.
#define RTE_ETH_FLOW_PORT18โ treats the device port number as its own flow differentiator, like "whose port is this, actually" ๐ซถ
Defined at line 572 of rte_ethdev.h.
#define RTE_ETH_FLOW_VXLAN19โ VXLAN protocol based flow ๐ธ
Defined at line 573 of rte_ethdev.h.
#define RTE_ETH_FLOW_GENEVE20โ GENEVE protocol based flow ๐ง
Defined at line 574 of rte_ethdev.h.
#define RTE_ETH_FLOW_NVGRE21โ NVGRE protocol based flow ๐
Defined at line 575 of rte_ethdev.h.
#define RTE_ETH_FLOW_VXLAN_GPE22โ VXLAN-GPE protocol based flow ๐
Defined at line 576 of rte_ethdev.h.
#define RTE_ETH_FLOW_GTPU23โ GTPU protocol based flow ๐ฅ
Defined at line 577 of rte_ethdev.h.
#define RTE_ETH_RSS_L4_CHKSUMRTE_BIT64(35)โ okay soRTE_ETH_RSS_L4_CHKSUMworks on the checksum field of any L4 header. it's givingRTE_ETH_RSS_PORTenergy, in that neither of them specifies the specific type of L4 header. this macro exists to replace some specific L4 (TCP/UDP/SCTP) checksum type, for constructing the use of RSS offload bits ๐
Due to the above reason, some old APIs (and configuration) don't support RTE_ETH_RSS_L4_CHKSUM. The rte_flow RSS API does support it, periodt.
For the case that checksum is not used in an UDP header, it takes the reserved value 0 as input for the hash function ๐ซ
Defined at line 629 of rte_ethdev.h.
#define RTE_ETH_RSS_IB_BTHRTE_BIT64(38)โ RSS with RoCE InfiniBand BTH (Base Transport Header) โจ
Defined at line 635 of rte_ethdev.h.
#define RTE_ETH_RSS_LEVEL_PMD_DEFAULT(UINT64_C(0) << 50)โ level 0, it requests the default behavior. Depending on the packet type, that can mean outermost, innermost, anything in between, or even no RSS at all. Basically it stands for the innermost encapsulation level RSS can be performed on, according to PMD and device capabilities ๐
Defined at line 679 of rte_ethdev.h.
#define RTE_ETH_RSS_LEVEL_OUTERMOST(UINT64_C(1) << 50)โ level 1, requests RSS to be performed on the outermost packet encapsulation level ๐ธ
Defined at line 685 of rte_ethdev.h.
#define RTE_ETH_RSS_LEVEL_INNERMOST(UINT64_C(2) << 50)โ level 2, requests RSS to be performed on the specified inner packet encapsulation level, going from outermost to innermost (lower to higher values) ๐ฆ
Defined at line 691 of rte_ethdev.h.
#define RTE_ETH_RSS_PROTO_MASKโ the value is this whole entire vibe:
( \
RTE_ETH_RSS_IPV4 | \
RTE_ETH_RSS_FRAG_IPV4 | \
RTE_ETH_RSS_NONFRAG_IPV4_TCP | \
RTE_ETH_RSS_NONFRAG_IPV4_UDP | \
RTE_ETH_RSS_NONFRAG_IPV4_SCTP | \
RTE_ETH_RSS_NONFRAG_IPV4_OTHER | \
RTE_ETH_RSS_IPV6 | \
RTE_ETH_RSS_FRAG_IPV6 | \
RTE_ETH_RSS_NONFRAG_IPV6_TCP | \
RTE_ETH_RSS_NONFRAG_IPV6_UDP | \
RTE_ETH_RSS_NONFRAG_IPV6_SCTP | \
RTE_ETH_RSS_NONFRAG_IPV6_OTHER | \
RTE_ETH_RSS_L2_PAYLOAD | \
RTE_ETH_RSS_IPV6_EX | \
RTE_ETH_RSS_IPV6_TCP_EX | \
RTE_ETH_RSS_IPV6_UDP_EX | \
RTE_ETH_RSS_PORT | \
RTE_ETH_RSS_VXLAN | \
RTE_ETH_RSS_GENEVE | \
RTE_ETH_RSS_NVGRE | \
RTE_ETH_RSS_MPLS)
it's the mask of valid RSS hash protocols ๐ฅ
Defined at line 847 of rte_ethdev.h.
#define RTE_ETH_VMDQ_MAX_VLAN_FILTERS64โ maximum nb. of VMDq VLAN filters ๐
Defined at line 882 of rte_ethdev.h.
#define RTE_ETH_DCB_NUM_USER_PRIORITIES8โ maximum nb. of DCB priorities โจ
Defined at line 883 of rte_ethdev.h.
#define RTE_ETH_VMDQ_DCB_NUM_QUEUES128โ maximum nb. of VMDq DCB queues ๐
Defined at line 884 of rte_ethdev.h.
#define RTE_ETH_DCB_NUM_QUEUES128โ maximum nb. of DCB queues ๐
Defined at line 885 of rte_ethdev.h.
#define RTE_ETH_DCB_PG_SUPPORTRTE_BIT32(0)โ Priority Group (ETS) support ๐
Defined at line 889 of rte_ethdev.h.
#define RTE_ETH_DCB_PFC_SUPPORTRTE_BIT32(1)โ Priority Flow Control support ๐ธ
Defined at line 890 of rte_ethdev.h.
#define RTE_ETH_VLAN_STRIP_OFFLOAD0x0001โ VLAN Strip On/Off ๐
Defined at line 894 of rte_ethdev.h.
#define RTE_ETH_VLAN_FILTER_OFFLOAD0x0002โ VLAN Filter On/Off ๐ฆ
Defined at line 895 of rte_ethdev.h.
#define RTE_ETH_VLAN_EXTEND_OFFLOAD0x0004โ VLAN Extend On/Off โจ
Defined at line 896 of rte_ethdev.h.
#define RTE_ETH_QINQ_STRIP_OFFLOAD0x0008โ QINQ Strip On/Off ๐
Defined at line 897 of rte_ethdev.h.
#define RTE_ETH_VLAN_STRIP_MASK0x0001โ VLAN Strip setting mask ๐ซ
Defined at line 899 of rte_ethdev.h.
#define RTE_ETH_VLAN_FILTER_MASK0x0002โ VLAN Filter setting mask ๐ธ
Defined at line 900 of rte_ethdev.h.
#define RTE_ETH_VLAN_EXTEND_MASK0x0004โ VLAN Extend setting mask ๐
Defined at line 901 of rte_ethdev.h.
#define RTE_ETH_QINQ_STRIP_MASK0x0008โ QINQ Strip setting mask ๐ง
Defined at line 902 of rte_ethdev.h.
#define RTE_ETH_VLAN_ID_MAX0x0FFFโ the VLAN ID lives in the lower 12 bits, that's just where she resides ๐
Defined at line 903 of rte_ethdev.h.
#define RTE_ETH_NUM_RECEIVE_MAC_ADDR128โ maximum nb. of receive mac addr ๐ซถ
Defined at line 907 of rte_ethdev.h.
#define RTE_ETH_VMDQ_NUM_UC_HASH_ARRAY128โ maximum nb. of UC hash array ๐
Defined at line 910 of rte_ethdev.h.
#define RTE_ETH_VMDQ_ACCEPT_UNTAGRTE_BIT32(0)โ accept untagged packets, respect the no-label lifestyle ๐
Defined at line 916 of rte_ethdev.h.
#define RTE_ETH_VMDQ_ACCEPT_HASH_MCRTE_BIT32(1)โ accept packets in the multicast table โจ
Defined at line 918 of rte_ethdev.h.
#define RTE_ETH_VMDQ_ACCEPT_HASH_UCRTE_BIT32(2)โ accept packets in the unicast table ๐ฆ
Defined at line 920 of rte_ethdev.h.
#define RTE_ETH_VMDQ_ACCEPT_BROADCASTRTE_BIT32(3)โ accept broadcast packets ๐ฃ
Defined at line 922 of rte_ethdev.h.
#define RTE_ETH_VMDQ_ACCEPT_MULTICASTRTE_BIT32(4)โ multicast promiscuous ๐
Defined at line 924 of rte_ethdev.h.
#define RTE_ETH_RX_OFFLOAD_VLAN_STRIPRTE_BIT64(0)โ Rx offload capabilities/configuration of a device or queue ๐
Defined at line 1583 of rte_ethdev.h.
#define RTE_ETH_RX_OFFLOAD_TIMESTAMPRTE_BIT64(14)โ the timestamp is set by the driver inRTE_MBUF_DYNFIELD_TIMESTAMP_NAME, andRTE_MBUF_DYNFLAG_RX_TIMESTAMP_NAMEis set inol_flags. The mbuf field and flag get registered when the offload is configured โฐโจ
Defined at line 1599 of rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_VLAN_INSERTRTE_BIT64(0)โ Tx offload capabilities/configuration of a device or queue ๐
Defined at line 1623 of rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_OUTER_IPV4_CKSUMRTE_BIT64(7)โ used for tunneling packet ๐
Defined at line 1630 of rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSORTE_BIT64(9)โ used for tunneling packet ๐ฅ
Defined at line 1632 of rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_GRE_TNL_TSORTE_BIT64(10)โ used for tunneling packet ๐
Defined at line 1633 of rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_IPIP_TNL_TSORTE_BIT64(11)โ used for tunneling packet ๐ธ
Defined at line 1634 of rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_GENEVE_TNL_TSORTE_BIT64(12)โ used for tunneling packet ๐ฆ
Defined at line 1635 of rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_MT_LOCKFREERTE_BIT64(14)โ multiple threads can invokerte_eth_tx_burst()concurrently on the same Tx queue without SW lock. the girls are free ๐
Defined at line 1641 of rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_MULTI_SEGSRTE_BIT64(15)โ multi segment send โจ
Defined at line 1643 of rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREERTE_BIT64(16)โ optimization for fast release of mbufs. When it's set, the application must guarantee that per-queue all mbufs come from the same mempool, haverefcnt=1, and are direct ๐ซ
Peep also rte_mbuf_raw_free_bulk().
Defined at line 1651 of rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_UDP_TNL_TSORTE_BIT64(18)โ generic UDP tunneled packet TSO. The application must setRTE_MBUF_F_TX_TUNNEL_UDPand other mbuf fields required for tunnel TSO ๐
Defined at line 1658 of rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_IP_TNL_TSORTE_BIT64(19)โ generic IP tunneled packet TSO. The application must setRTE_MBUF_F_TX_TUNNEL_IPand other mbuf fields required for tunnel TSO ๐
Defined at line 1664 of rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUMRTE_BIT64(20)โ outer UDP checksum. Used for tunneling packet ๐ฆ
Defined at line 1666 of rte_ethdev.h.
#define RTE_ETH_TX_OFFLOAD_SEND_ON_TIMESTAMPRTE_BIT64(21)โ send on time read fromRTE_MBUF_DYNFIELD_TIMESTAMP_NAMEifRTE_MBUF_DYNFLAG_TX_TIMESTAMP_NAMEis set inol_flags. The mbuf field and flag get registered when the offload is configured โฐ๐
Defined at line 1672 of rte_ethdev.h.
#define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUPRTE_BIT64(0)โ device supports Rx queue setup after the device started ๐
Defined at line 1682 of rte_ethdev.h.
#define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUPRTE_BIT64(1)โ device supports Tx queue setup after the device started โจ
Defined at line 1684 of rte_ethdev.h.
#define RTE_ETH_DEV_CAPA_RXQ_SHARE RTE_BIT64(2)โ bestie the device can share an Rx queue between ports inside the same Rx domain and switch domain ๐ซถ. Mbufs get consumed by the shared Rx queue instead of by each queue individually. You can have multiple groups, and that's whatshare_groupin the Rx queue configuration is for. The PMD figures out which shared Rx queue is which usingshare_qidfrom the Rx queue configuration. Poll any port in the group and you receive packets from all the member ports โ the source port is identified by thembuf->portfield.Definition at line 1694 of file rte_ethdev.h.
#define RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP RTE_BIT64(3)โ the device keeps its flow rules across a restart. Iconic ๐Definition at line 1696 of file rte_ethdev.h.
#define RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP RTE_BIT64(4)โ the device keeps shared flow objects across a restart. Also iconic.Definition at line 1698 of file rte_ethdev.h.
#define RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID (UINT16_MAX)โ the default value for the switch domain ID, used when ethdev doesn't support switch domain definitions at all. (It's giving "we don't do that here" ๐)Definition at line 1726 of file rte_ethdev.h.
#define RTE_ETH_QUEUE_STATE_STOPPED 0โ queue stopped. She's resting ๐ดDefinition at line 1885 of file rte_ethdev.h.
#define RTE_ETH_QUEUE_STATE_STARTED 1โ queue started. She's up ๐Definition at line 1886 of file rte_ethdev.h.
#define RTE_ETH_QUEUE_STATE_HAIRPIN 2โ queue used for hairpin. Main character queue, honestly.Definition at line 1887 of file rte_ethdev.h.
#define RTE_ETH_BURST_FLAG_PER_QUEUE RTE_BIT64(0)โ if the queues have different burst mode descriptions, the PMD sets this bit, and then your app can iterate to grab the burst description for all the other queues too โจDefinition at line 1951 of file rte_ethdev.h.
#define RTE_ETH_BURST_MODE_INFO_SIZE 1024โ max size for info. That's the whole vibe:1024.Definition at line 1960 of file rte_ethdev.h.
#define RTE_ETH_XSTATS_NAME_SIZE 64โ maximum name length for extended statistics counters ๐Definition at line 1965 of file rte_ethdev.h.
#define RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE RTE_BIT32(0)โ the PMD supports thread-safe flow operations. Slay.Definition at line 2157 of file rte_ethdev.h.
#define RTE_ETH_DEV_INTR_LSC RTE_BIT32(1)โ the device supports link state interrupt ๐ฅDefinition at line 2159 of file rte_ethdev.h.
#define RTE_ETH_DEV_BONDING_MEMBER RTE_BIT32(2)โ the device is a bonding member. Found family, kinda ๐ซถDefinition at line 2161 of file rte_ethdev.h.
#define RTE_ETH_DEV_INTR_RMV RTE_BIT32(3)โ the device supports device removal interrupt ๐ she can leave, and she'll tell youDefinition at line 2163 of file rte_ethdev.h.
#define RTE_ETH_DEV_REPRESENTOR RTE_BIT32(4)โ the device is a port representor. Representing ๐Definition at line 2165 of file rte_ethdev.h.
#define RTE_ETH_DEV_NOLIVE_MAC_ADDR RTE_BIT32(5)โ the device does not support MAC change after it's started. Once she's dressed, she's not changing, no cap.Definition at line 2167 of file rte_ethdev.h.
#define RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS RTE_BIT32(6)โ queue xstats get filled automatically by the ethdev layer ๐. Lowkey important caveat: PMDs that fill the queue xstats themselves should NOT set this flag.Definition at line 2172 of file rte_ethdev.h.
#define RTE_ETH_FOREACH_DEV_OWNED_BY(p, o)โ macro to iterate over all enabled ethdev ports owned by a specific owner. Value:
for (p = rte_eth_find_next_owned_by(0, o); \
(unsigned int)p < (unsigned int)RTE_MAX_ETHPORTS; \
p = rte_eth_find_next_owned_by(p + 1, o))
Definition at line 2192 of file rte_ethdev.h.
#define RTE_ETH_FOREACH_DEV(p)โ macro to iterate over all enabled and ownerless ethdev ports. Value:
RTE_ETH_FOREACH_DEV_OWNED_BY(p, RTE_ETH_DEV_NO_OWNER)
Definition at line 2210 of file rte_ethdev.h.
#define RTE_ETH_FOREACH_DEV_OF(port_id, parent)โ macro to iterate over all ethdev ports of a specified device. Value:
for (port_id = rte_eth_find_next_of(0, parent); \
port_id < RTE_MAX_ETHPORTS; \
port_id = rte_eth_find_next_of(port_id + 1, parent))
- Parameters:
port_idโ the ID of the matching port being iterated.parentโ therte_devicepointer matching the iterated ports.
Definition at line 2236 of file rte_ethdev.h.
#define RTE_ETH_FOREACH_DEV_SIBLING(port_id, ref_port_id)โ macro to iterate over all ethdev ports sharing the samerte_deviceas the specified port. Note: the specified reference port is part of the loop iterations ๐ซก. Value:
for (port_id = rte_eth_find_next_sibling(0, ref_port_id); \
port_id < RTE_MAX_ETHPORTS; \
port_id = rte_eth_find_next_sibling(port_id + 1, ref_port_id))
- Parameters:
port_idโ the ID of the matching port being iterated.ref_port_idโ the ID of the port being compared.
Definition at line 2265 of file rte_ethdev.h.
#define RTE_ETH_TX_BUFFER_SIZE(sz)โ calculate the size of the Tx buffer ๐ . Value:
(sizeof(struct rte_eth_dev_tx_buffer) + (sz) * sizeof(struct rte_mbuf *))
- Parameters:
szโ number of stored packets.
Definition at line 3931 of file rte_ethdev.h.
#define RTE_ETH_RX_METADATA_USER_FLAG RTE_BIT64(0)โ the NIC is able to deliver the flag (if set) with packets to the PMD โจDefinition at line 5809 of file rte_ethdev.h.
#define RTE_ETH_RX_METADATA_USER_MARK RTE_BIT64(1)โ the NIC is able to deliver the mark ID with packets to the PMD.Definition at line 5812 of file rte_ethdev.h.
#define RTE_ETH_RX_METADATA_TUNNEL_ID RTE_BIT64(2)โ the NIC is able to deliver the tunnel ID with packets to the PMD ๐ฆDefinition at line 5815 of file rte_ethdev.h.
#define RTE_ETH_DEV_REASSEMBLY_F_IPV4 (RTE_BIT32(0))โ flag to offload IP reassembly for IPv4 packets.Definition at line 5859 of file rte_ethdev.h.
#define RTE_ETH_DEV_REASSEMBLY_F_IPV6 (RTE_BIT32(1))โ flag to offload IP reassembly for IPv6 packets.Definition at line 5861 of file rte_ethdev.h.
#define RTE_ETH_RX_DESC_AVAIL 0โ desc available for hw.Definition at line 6457 of file rte_ethdev.h.
#define RTE_ETH_RX_DESC_DONE 1โ desc done, filled by hw.Definition at line 6458 of file rte_ethdev.h.
#define RTE_ETH_RX_DESC_UNAVAIL 2โ desc used by driver or hw.Definition at line 6459 of file rte_ethdev.h.
#define RTE_ETH_TX_DESC_FULL 0โ desc filled for hw, waiting xmit.Definition at line 6527 of file rte_ethdev.h.
#define RTE_ETH_TX_DESC_DONE 1โ desc done, packet is transmitted ๐Definition at line 6528 of file rte_ethdev.h.
#define RTE_ETH_TX_DESC_UNAVAIL 2โ desc used by driver or hw.Definition at line 6529 of file rte_ethdev.h.
โจ Typedef Documentation โจ
typedef uint16_t(* rte_rx_callback_fn) (uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, uint16_t max_pkts, void *user_param)โ function type used for Rx packet processing packet callbacks ๐
The callback function is called on Rx with a burst of packets that have been received on the given port and queue.
Parameters:
port_idโ the Ethernet port on which Rx is being performed.queueโ the queue on the Ethernet port which is being used to receive the packets.pktsโ the burst of packets that have just been received.nb_pktsโ the number of packets in the burst pointed to by"pkts".max_pktsโ the max number of packets that can be stored in the"pkts"array.user_paramโ the arbitrary user parameter passed in by the application when the callback was originally configured.
Returns โ the number of packets returned to the user.
Definition at line 2094 of file rte_ethdev.h.
typedef uint16_t(* rte_tx_callback_fn) (uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[], uint16_t nb_pkts, void *user_param)โ function type used for Tx packet processing packet callbacks โจ
The callback function is called on Tx with a burst of packets immediately before the packets are put onto the hardware queue for transmission.
Parameters:
port_idโ the Ethernet port on which Tx is being performed.queueโ the queue on the Ethernet port which is being used to transmit the packets.pktsโ the burst of packets that are about to be transmitted.nb_pktsโ the number of packets in the burst pointed to by"pkts".user_paramโ the arbitrary user parameter passed in by the application when the callback was originally configured.
Returns โ the number of packets to be written to the NIC.
Definition at line 2118 of file rte_ethdev.h.
typedef int(* rte_eth_dev_cb_fn) (uint16_t port_id, enum rte_eth_event_type event, void *cb_arg, void *ret_param)โ user application callback to be registered for interrupts ๐
Note, and this one is IMPORTANT bestie: there is no guarantee in the DPDK drivers that a callback won't be called in the middle of other parts of the ethdev API. For example, imagine that thread A callsrte_eth_dev_start()and, as part of this call, anRTE_ETH_EVENT_INTR_RESETevent gets generated and the associated callback is ran on thread A. In that example, if the application protects its internal data using locks before callingrte_eth_dev_start(), and the callback takes a same lock, a deadlock occurs ๐. Because of this, it is highly recommended NOT to take locks in those callbacks.
Definition at line 4295 of file rte_ethdev.h.
๐ Enumeration Type Documentation ๐
enum rte_eth_link_connectorโ Ethernet port link connector type. (Basically: what kind of little cable situation is this port in ๐)
Enumerator:
RTE_ETH_LINK_CONNECTOR_NONEโ None. Default unless driver specifies it.RTE_ETH_LINK_CONNECTOR_TPโ Twisted Pair.RTE_ETH_LINK_CONNECTOR_AUIโ Attachment Unit Interface.RTE_ETH_LINK_CONNECTOR_MIIโ Media Independent Interface.RTE_ETH_LINK_CONNECTOR_FIBERโ Optical Fiber Link.RTE_ETH_LINK_CONNECTOR_BNCโ BNC Link type for RF connection.RTE_ETH_LINK_CONNECTOR_DACโ Direct Attach copper.RTE_ETH_LINK_CONNECTOR_SGMIIโ Serial Gigabit Media Independent Interface.RTE_ETH_LINK_CONNECTOR_QSGMIIโ Link to multiplex 4 SGMII over one serial link.RTE_ETH_LINK_CONNECTOR_XFIโ 10 Gigabit Attachment Unit Interface.RTE_ETH_LINK_CONNECTOR_SFIโ 10 Gigabit Serial Interface for optical network.RTE_ETH_LINK_CONNECTOR_XLAUIโ 40 Gigabit Attachment Unit Interface.RTE_ETH_LINK_CONNECTOR_GAUIโ Gigabit Interface for 50/100/200 Gbps.RTE_ETH_LINK_CONNECTOR_XAUIโ 10 Gigabit Attachment Unit Interface.RTE_ETH_LINK_CONNECTOR_CAUIโ 100 Gigabit Attachment Unit Interface.RTE_ETH_LINK_CONNECTOR_LAUIโ 50 Gigabit Attachment Unit Interface.RTE_ETH_LINK_CONNECTOR_SFPโ Pluggable module for 1 Gigabit.RTE_ETH_LINK_CONNECTOR_SFP_PLUSโ Pluggable module for 10 Gigabit.RTE_ETH_LINK_CONNECTOR_SFP28โ Pluggable module for 25 Gigabit.RTE_ETH_LINK_CONNECTOR_SFP_DDโ Pluggable module for 100 Gigabit.RTE_ETH_LINK_CONNECTOR_QSFPโ Module to mutiplex 4 SFP i.e. 4*1=4 Gbps.RTE_ETH_LINK_CONNECTOR_QSFP_PLUSโ Module to mutiplex 4 SFP_PLUS i.e. 4*10=40 Gbps.
RTE_ETH_LINK_CONNECTOR_QSFP28โ a module that mutiplexes 4 SFP28, like, 4*25=100 Gbps bestie ๐ซRTE_ETH_LINK_CONNECTOR_QSFP56โ module mutiplexing 4 SFP56, so 4*50=200 GbpsRTE_ETH_LINK_CONNECTOR_QSFP_DDโ module mutiplexing 4 SFP_DD, that's 4*100=400 Gbps ๐ฅRTE_ETH_LINK_CONNECTOR_OTHERโ the non-physical interfaces, like virtio, ring, etc. Also catches unknown connector types, aka physical connectors that just haven't been defined in this list of connector types yet ๐
Definition at line 326 of file rte_ethdev.h.
enum rte_eth_rx_mq_mode
so this is the whole squad of values that say which method we're using to route packets to multiple queues โจ
Enumerators:
RTE_ETH_MQ_RX_NONEโ absolutely none of DCB, RSS or VMDq mode. just vibes, no routing magic ๐RTE_ETH_MQ_RX_RSSโ on the Rx side, only RSS is onRTE_ETH_MQ_RX_DCBโ on the Rx side, only DCB is on.RTE_ETH_MQ_RX_DCB_RSSโ both DCB and RSS are enabled ๐RTE_ETH_MQ_RX_VMDQ_ONLYโ only VMDq, no RSS, no DCBRTE_ETH_MQ_RX_VMDQ_RSSโ RSS mode but with VMDqRTE_ETH_MQ_RX_VMDQ_DCBโ using VMDq+DCB to route traffic to queuesRTE_ETH_MQ_RX_VMDQ_DCB_RSSโ both VMDq and DCB enabled in VMDq
Definition at line 419 of file rte_ethdev.h.
enum rte_eth_tx_mq_mode
the matching set of values for what method transmits packets using multi-TCs ๐
Enumerators:
RTE_ETH_MQ_TX_NONEโ it's in neither DCB nor VT mode.RTE_ETH_MQ_TX_DCBโ on the Tx side, only DCB is on.RTE_ETH_MQ_TX_VMDQ_DCBโ on the Tx side, both DCB and VT are on.RTE_ETH_MQ_TX_VMDQ_ONLYโ only VT on, no DCB
Definition at line 445 of file rte_ethdev.h.
enum rte_eth_vlan_type
VLAN types, telling you if it's for single VLAN, inner VLAN, or outer VLAN. Real talk tho: single VLAN is treated the same as inner VLAN. periodt ๐
Enumerators:
RTE_ETH_VLAN_TYPE_INNERโ inner VLAN.RTE_ETH_VLAN_TYPE_OUTERโ single VLAN, or outer VLAN.
Definition at line 476 of file rte_ethdev.h.
enum rte_eth_hash_function
the hash function types, bestie ๐ง
Enumerators:
RTE_ETH_HASH_FUNCTION_DEFAULTโ DEFAULT means the driver decides which hash algorithm to pick. main character energy, letting the driver cook ๐RTE_ETH_HASH_FUNCTION_TOEPLITZโ ToeplitzRTE_ETH_HASH_FUNCTION_SIMPLE_XORโ simple XORRTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZโ symmetric Toeplitz:src,dstwill be replaced byxor(src, dst). For the case withsrc/dstonly, thesrcordstaddress will xor with a zero pair.RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ_SORTโ symmetric Toeplitz: L3 and L4 fields are sorted prior to the hash function. Ifsrc_ip > dst_ip, swapsrc_ipanddst_ip. Ifsrc_port > dst_port, swapsrc_portanddst_port.
Definition at line 494 of file rte_ethdev.h.
enum rte_eth_nb_tcs
this one tells you the possible number of traffic classes in DCB configurations โจ
Enumerators:
RTE_ETH_4_TCSโ 4 TCs with DCB.RTE_ETH_8_TCSโ 8 TCs with DCB.
Definition at line 944 of file rte_ethdev.h.
enum rte_eth_nb_pools
and this one is the possible number of queue pools in VMDq configurations ๐ธ
Enumerators:
RTE_ETH_8_POOLSโ 8 VMDq pools.RTE_ETH_16_POOLSโ 16 VMDq pools.RTE_ETH_32_POOLSโ 32 VMDq pools.RTE_ETH_64_POOLSโ 64 VMDq pools.
Definition at line 953 of file rte_ethdev.h.
enum rte_eth_fc_mode
this enum is literally just the flow control mode ๐
Enumerators:
RTE_ETH_FC_NONEโ disable flow control.RTE_ETH_FC_RX_PAUSEโ Rx pause frame, enables flowctrl on the Tx side.RTE_ETH_FC_TX_PAUSEโ Tx pause frame, enables flowctrl on the Rx side.RTE_ETH_FC_FULLโ enable flow control on both sides ๐ซถ
Definition at line 1396 of file rte_ethdev.h.
enum rte_eth_tunnel_type
tunnel type for device-specific classifier configuration ๐
See also: rte_eth_udp_tunnel
Definition at line 1485 of file rte_ethdev.h.
enum rte_eth_representor_type
Ethernet device information, Ethernet device representor port type. yes it's a mouthful, we move ๐
Enumerators:
RTE_ETH_REPRESENTOR_NONEโ not a representor.RTE_ETH_REPRESENTOR_VFโ representor of Virtual Function.RTE_ETH_REPRESENTOR_SFโ representor of Sub Function.RTE_ETH_REPRESENTOR_PFโ representor of Physical Function.
Definition at line 1772 of file rte_ethdev.h.
enum rte_eth_err_handle_mode
โ ๏ธ WARNING: EXPERIMENTAL: this enumeration may change without prior notice. no cap, it could switch up on you ๐ญ
Ethernet device error handling mode.
Enumerators:
RTE_ETH_ERROR_HANDLE_MODE_NONEโ no error handling modes are supported. nothing, nada ๐RTE_ETH_ERROR_HANDLE_MODE_PASSIVEโ passive error handling: after the PMD detects that a reset is required, the PMD reports- See also:
RTE_ETH_EVENT_INTR_RESETevent, and the application invokes rte_eth_dev_resetto recover the port.
- See also:
RTE_ETH_ERROR_HANDLE_MODE_PROACTIVEโ proactive error handling: after the PMD detects that a reset is required, the PMD reports- See also:
RTE_ETH_EVENT_ERR_RECOVERINGevent, does recovery internally, and finally reports the recovery result event ( RTE_ETH_EVENT_RECOVERY_*).
- See also:
Definition at line 1785 of file rte_ethdev.h.
enum rte_eth_fec_mode
this enum shows the possible Forward Error Correction (FEC) modes of an ethdev port โจ
Enumerators:
RTE_ETH_FEC_NOFECโ FEC is offRTE_ETH_FEC_AUTOโ FEC autonegotiation modesRTE_ETH_FEC_BASERโ FEC using the common algorithmRTE_ETH_FEC_RSโ FEC using the RS algorithmRTE_ETH_FEC_LLRSโ FEC using the LLRS algorithm
Definition at line 2035 of file rte_ethdev.h.
enum rte_eth_dev_state
possible states of an ethdev port, the whole glow-up timeline ๐ฑ
Enumerators:
RTE_ETH_DEV_UNUSEDโ device is unused before being probed.RTE_ETH_DEV_ATTACHEDโ device is attached when allocated in probing.RTE_ETH_DEV_REMOVEDโ device is in the removed state when plug-out is detected. it's giving ghosted ๐
Definition at line 2124 of file rte_ethdev.h.
enum rte_eth_event_macsec_subtype
subtypes for the MACsec offload event (RTE_ETH_EVENT_MACSEC) raised by the Ethernet device ๐
Enumerators:
RTE_ETH_SUBEVENT_MACSEC_UNKNOWNโ notifies an unknown MACsec subevent.RTE_ETH_SUBEVENT_MACSEC_RX_SECTAG_V_EQ1โ subevent ofRTE_ETH_EVENT_MACSEC_SECTAG_VAL_ERRsectag validation events. Validation check:SecTag.TCI.V = 1RTE_ETH_SUBEVENT_MACSEC_RX_SECTAG_E_EQ0_C_EQ1โ subevent ofRTE_ETH_EVENT_MACSEC_SECTAG_VAL_ERRsectag validation events. Validation check:SecTag.TCI.E = 0 && SecTag.TCI.C = 1RTE_ETH_SUBEVENT_MACSEC_RX_SECTAG_SL_GTE48โ subevent ofRTE_ETH_EVENT_MACSEC_SECTAG_VAL_ERRsectag validation events. Validation check:SecTag.SL >= 'd48RTE_ETH_SUBEVENT_MACSEC_RX_SECTAG_ES_EQ1_SC_EQ1โ subevent ofRTE_ETH_EVENT_MACSEC_SECTAG_VAL_ERRsectag validation events. Validation check:SecTag.TCI.ES = 1 && SecTag.TCI.SC = 1RTE_ETH_SUBEVENT_MACSEC_RX_SECTAG_SC_EQ1_SCB_EQ1โ subevent ofRTE_ETH_EVENT_MACSEC_SECTAG_VAL_ERRsectag validation events. Validation check:SecTag.TCI.SC = 1 && SecTag.TCI.SCB = 1
Definition at line 4060 of file rte_ethdev.h.
enum rte_eth_event_macsec_type
event types for the MACsec offload event (RTE_ETH_EVENT_MACSEC) raised by the eth device ๐ซ
Enumerators:
RTE_ETH_EVENT_MACSEC_UNKNOWNโ notifies an unknown MACsec event.RTE_ETH_EVENT_MACSEC_SECTAG_VAL_ERRโ notifies Sectag validation failure events.RTE_ETH_EVENT_MACSEC_RX_SA_PN_HARD_EXPโ notifies Rx SA hard expiry events.RTE_ETH_EVENT_MACSEC_RX_SA_PN_SOFT_EXPโ notifies Rx SA soft expiry events.RTE_ETH_EVENT_MACSEC_TX_SA_PN_HARD_EXPโ notifies Tx SA hard expiry events.RTE_ETH_EVENT_MACSEC_TX_SA_PN_SOFT_EXPโ notifies Tx SA soft events.RTE_ETH_EVENT_MACSEC_SA_NOT_VALIDโ notifies an Invalid SA event.
Definition at line 4094 of file rte_ethdev.h.
enum rte_eth_event_ipsec_subtype
subtypes for the IPsec offload event (RTE_ETH_EVENT_IPSEC) raised by the eth device ๐ก๏ธ
Enumerators:
RTE_ETH_EVENT_IPSEC_PMD_ERROR_STARTโ PMD specific error startRTE_ETH_EVENT_IPSEC_PMD_ERROR_ENDโ PMD specific error endRTE_ETH_EVENT_IPSEC_UNKNOWNโ unknown event typeRTE_ETH_EVENT_IPSEC_ESN_OVERFLOWโ sequence number overflow ๐ญRTE_ETH_EVENT_IPSEC_SA_TIME_EXPIRYโ soft time expiry of SARTE_ETH_EVENT_IPSEC_SA_BYTE_EXPIRYโ soft byte expiry of SA, determined bybytes_soft_limitRTE_ETH_EVENT_IPSEC_SA_PKT_EXPIRYโ soft packet expiry of SA, determined bypackets_soft_limitRTE_ETH_EVENT_IPSEC_SA_BYTE_HARD_EXPIRYโ hard byte expiry of SA, determined bybytes_hard_limitRTE_ETH_EVENT_IPSEC_SA_PKT_HARD_EXPIRYโ hard packet expiry of SA, determined bypackets_hard_limitRTE_ETH_EVENT_IPSEC_MAXโ max value of this enum
Definition at line 4136 of file rte_ethdev.h.
enum rte_eth_event_type
the eth device event type for interrupts, and maybe other stuff in the future. manifesting โจ
Enumerators:
RTE_ETH_EVENT_UNKNOWNโ unknown event typeRTE_ETH_EVENT_INTR_LSCโ lsc interrupt eventRTE_ETH_EVENT_QUEUE_STATEโ queue state event (enabled/disabled)RTE_ETH_EVENT_INTR_RESETโ reset interrupt event, sent to VF on PF resetRTE_ETH_EVENT_VF_MBOXโ message from the VF received by PFRTE_ETH_EVENT_MACSECโ MACsec offload related eventRTE_ETH_EVENT_INTR_RMVโ device removal eventRTE_ETH_EVENT_NEWโ the port is being probed, i.e. allocated and not yet available. It is too early to check validity, query infos, and configure the port. But some functions, likerte_eth_dev_socket_id()andrte_eth_dev_owner_*()are available to the application. it's in its soft-launch era, not ready for the public ๐RTE_ETH_EVENT_DESTROYโ port is releasedRTE_ETH_EVENT_IPSECโ IPsec offload related eventRTE_ETH_EVENT_FLOW_AGEDโ new aged-out flows is detectedRTE_ETH_EVENT_RX_AVAIL_THRESHโ number of available Rx descriptors is smaller than the threshold.
See also: rte_eth_rx_avail_thresh_set()
RTE_ETH_EVENT_ERR_RECOVERINGโ bestie the port is recovering from a hardware or firmware error ๐ญ if the PMD supports proactive error recovery it should fire off this event to tell the app "hey, I clocked an error and the recovery is starting now". And when you get this event? Do NOT touch any control path API (likerte_eth_dev_configure/rte_eth_dev_stop...) until you get eitherRTE_ETH_EVENT_RECOVERY_SUCCESSorRTE_ETH_EVENT_RECOVERY_FAILED. While it's going down, the PMD sets the data path pointers to dummy functions, then swaps them back to non-dummy functions right before reportingRTE_ETH_EVENT_RECOVERY_SUCCESS. Translation: you literally cannot send or receive any packets during this period ๐
Note ๐ โ Before the PMD reports the recovery result, the PMD may report the RTE_ETH_EVENT_ERR_RECOVERING event again, because a larger error may occur during the recovery.
RTE_ETH_EVENT_RECOVERY_SUCCESSโ the port recovered successfully from the error โจ the PMD already re-configured the port, and honestly the effect is the same as a restart operation.- a) These operations will be retained (alphabetically):
- DCB configuration
- FEC configuration
- Flow control configuration
- LRO configuration
- LSC configuration
- MTU
- MAC address (default and those supplied by MAC address array)
- Promiscuous and allmulticast mode
- PTP configuration
- Queue (Rx/Tx) settings
- Queue statistics mappings
- RSS configuration by
rte_eth_dev_rss_xxx()family - Rx checksum configuration
- Rx interrupt settings
- Traffic management configuration
- VLAN configuration (including filtering, tpid, strip, pvid)
- VMDq configuration
- b) These ones maybe retained, maybe not, it's giving depends on the device capabilities energy:
- flow rules (
- a) These operations will be retained (alphabetically):
See also โ RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP
)
- shared flow objects (
See also โ RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP
)
- c) Any other configuration will not be stored and will need to be re-configured. Sorry bestie, you're redoing it ๐
RTE_ETH_EVENT_RECOVERY_FAILEDโ recovery failed ๐ meaning the port should not be usable anymore. The application should close the port.RTE_ETH_EVENT_MAXโ max value of this enum, the ceiling, the limit, periodt.
Definition at line 4201 of file rte_ethdev.h.
๐ enum rte_eth_cman_obj
Enumerate list of ethdev congestion management objects ๐ธ
Enumerator
RTE_ETH_CMAN_OBJ_RX_QUEUEโ congestion management based on Rx queue depthRTE_ETH_CMAN_OBJ_RX_QUEUE_MEMPOOLโ congestion management based on mempool depth associated with the Rx queue
See also โ rte_eth_rx_queue_setup()
Definition at line 6063 of file rte_ethdev.h.
๐ Function Documentation ๐
int rte_eth_iterator_init (struct rte_dev_iterator * iter, const char * devargs)
Initializes a device iterator ๐ฆ
This iterator lets you access a list of devices matching some devargs.
Parameters
iterโ Device iterator handle initialized by the function. The fieldsbus_strandcls_strmight be dynamically allocated, and could be freed by callingrte_eth_iterator_cleanup().devargsโ Device description string.
Returns
0 on successful initialization, negative otherwise.
uint16_t rte_eth_iterator_next (struct rte_dev_iterator * iter)
Iterates on devices with devargs filter. The ownership is not checked, fyi.
The next port ID is returned, and the iterator is updated โจ
Parameters
iterโ Device iterator handle initialized byrte_eth_iterator_init(). Some fieldsbus_strandcls_strmight be freed when no more port is found, by callingrte_eth_iterator_cleanup().
Returns
A port ID if found, RTE_MAX_ETHPORTS otherwise.
void rte_eth_iterator_cleanup (struct rte_dev_iterator * iter)
Free some allocated fields of the iterator ๐งน
This function is automatically called by rte_eth_iterator_next() on the last iteration (i.e. when no more matching port is found).
It is safe to call this function twice; it will do nothing more. (We love an idempotent girlie ๐ซถ)
Parameters
iterโ Device iterator handle initialized byrte_eth_iterator_init(). The fieldsbus_strandcls_strare freed if needed.
uint64_t rte_eth_rss_hf_refine (uint64_t rss_hf) [inline], [static]
For input set change of hash filter, if SRC_ONLY and DST_ONLY of the same level are used simultaneously, it is the same case as none of them are added. No cap ๐งข
Parameters
rss_hfโ RSS types withSRC/DST_ONLY.
Returns
RSS types.
Definition at line 707 of file rte_ethdev.h.
uint64_t rte_eth_find_next_owned_by (uint16_t port_id, const uint64_t owner_id)
Iterates over valid ethdev ports owned by a specific owner ๐
Parameters
port_idโ The ID of the next possible valid owned port.owner_idโ The owner identifier.RTE_ETH_DEV_NO_OWNERmeans iterate over all valid ownerless ports.
Returns
Next valid port ID owned by owner_id, RTE_MAX_ETHPORTS if there is none.
uint16_t rte_eth_find_next (uint16_t port_id)
Iterates over valid ethdev ports ๐
Parameters
port_idโ The ID of the next possible valid port.
Returns
Next valid port ID, RTE_MAX_ETHPORTS if there is none.
uint16_t rte_eth_find_next_of (uint16_t port_id_start, const struct rte_device * parent)
Iterates over ethdev ports of a specified device ๐
Parameters
port_id_startโ The ID of the next possible valid port.parentโ The generic device behind the ports to iterate.
Returns
Next port ID of the device, possibly port_id_start, RTE_MAX_ETHPORTS if there is none.
uint16_t rte_eth_find_next_sibling (uint16_t port_id_start, uint16_t ref_port_id)
Iterates over sibling ethdev ports (i.e. sharing the same rte_device). Siblings!! ๐ฏโโ๏ธ
Parameters
port_id_startโ The ID of the next possible valid sibling port.ref_port_idโ The ID of a reference port to comparerte_devicewith.
Returns
Next sibling port ID, possibly port_id_start or ref_port_id itself, RTE_MAX_ETHPORTS if there is none.
int rte_eth_dev_owner_new (uint64_t * owner_id)
Get a new unique owner identifier. An owner identifier is used to owns Ethernet devices by only one DPDK entity to avoid multiple management of device by different entities. Like, one owner only, no sharing custody bestie ๐
Parameters
owner_idโ Owner identifier pointer.
Returns
Negative errno value on error, 0 on success.
int rte_eth_dev_owner_set (const uint16_t port_id, const struct rte_eth_dev_owner * owner)
Set an Ethernet device owner ๐
Parameters
port_idโ The identifier of the port to own.ownerโ The owner pointer.
Returns
Negative errno value on error, 0 on success.
int rte_eth_dev_owner_unset (const uint16_t port_id, const uint64_t owner_id)
Unset Ethernet device owner to make the device ownerless ๐๏ธ
Parameters
port_idโ The identifier of port to make ownerless.owner_idโ The owner identifier.
Returns
0 on success, negative errno value on error.
int rte_eth_dev_owner_delete (const uint64_t owner_id)
Remove owner from all Ethernet devices owned by a specific owner ๐
Parameters
owner_idโ The owner identifier.
Returns
0 on success, negative errno value on error.
int rte_eth_dev_owner_get (const uint16_t port_id, struct rte_eth_dev_owner * owner)
Get the owner of an Ethernet device ๐
Parameters
port_idโ The port identifier.ownerโ The owner structure pointer to fill.
Returns
0 on success, negative errno value on error..
uint16_t rte_eth_dev_count_avail (void )
Get the number of ports which are usable for the application โจ
These devices must be iterated by using the macro RTE_ETH_FOREACH_DEV or RTE_ETH_FOREACH_DEV_OWNED_BY to deal with non-contiguous ranges of devices.
Returns
The count of available Ethernet devices.
uint16_t rte_eth_dev_count_total (void )
Get the total number of ports which are allocated.
Some devices may not be available for the application, just so you know ๐ซถ
Returns
The total count of Ethernet devices.
uint32_t rte_eth_speed_bitflag (uint32_t speed, int duplex)
Convert a numerical speed in Mbps to a bitmap flag that can be used in the bitmap link_speeds of the struct rte_eth_conf ๐ฅ
Parameters
speedโ Numerical speed value in MbpsduplexโRTE_ETH_LINK_[HALF/FULL]_DUPLEX(only for 10/100M speeds)
Returns
0 if the speed cannot be mapped
const char * rte_eth_dev_rx_offload_name (uint64_t offload)
Get RTE_ETH_RX_OFFLOAD_* flag name ๐
Parameters
offloadโ Offload flag.
Returns
Offload name or 'UNKNOWN' if the flag cannot be recognised.
const char * rte_eth_dev_tx_offload_name (uint64_t offload)
Get RTE_ETH_TX_OFFLOAD_* flag name ๐
Parameters
offloadโ Offload flag.
Returns
Offload name or 'UNKNOWN' if the flag cannot be recognised.
__rte_experimental const char * rte_eth_dev_capability_name (uint64_t capability)
Warning โ ๏ธ โ EXPERIMENTAL: this API may change without prior notice. She's still in her testing era, don't build your whole life on her ๐
Get RTE_ETH_DEV_CAPA_* flag name ๐ท๏ธ
Parameters
capabilityโ Capability flag.
Returns
Capability name or 'UNKNOWN' if the flag cannot be recognized.
int rte_eth_dev_configure (uint16_t port_id, uint16_t nb_rx_queue, uint16_t nb_tx_queue, const struct rte_eth_conf * eth_conf)
Configure an Ethernet device ๐ This function must be invoked first before any other function in the Ethernet API. It's the main character fr. This function can also be re-invoked when a device is in the stopped state.
Parameters
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. Therte_eth_confstructure includes:- the hardware offload features to activate, with dedicated fields for each statically configurable offload hardware feature provided by Ethernet devices, such as IP checksum or VLAN tag stripping for example. The Rx offload bitfield API is obsolete and will be deprecated ๐ญ applications should set the
ignore_bitfield_offloadsbit onrxmodestructure and useoffloadsfield to set per-port offloads instead.
- the hardware offload features to activate, with dedicated fields for each statically configurable offload hardware feature provided by Ethernet devices, such as IP checksum or VLAN tag stripping for example. The Rx offload bitfield API is obsolete and will be deprecated ๐ญ applications should set the
- Any offloading you set in
eth_conf->[rt]xmode.offloadshas to live inside the[rt]x_offload_capathat came back fromrte_eth_dev_info_get(). Bestie, no sneaking in extras. And any device-supported offloading you pass in the input argumenteth_conf->[rt]xmode.offloadstorte_eth_dev_configure()gets enabled on all queues and literally can't be disabled later inrte_eth_[rt]x_queue_setup()๐ - the Receive Side Scaling (RSS) configuration when you're using multiple Rx queues per port. Any RSS hash function you set in
eth_conf->rss_conf.rss_hfmust be within theflow_type_rss_offloadsthat drivers hand over via therte_eth_dev_info_get()API.
Embedding every bit of configuration info in a single data structure is the more flexible method, and it's the one that lets new features get added without changing the syntax of the API. iconic behavior tbh โจ
Returns
0: Success, device configured. ๐<0: Error code returned by the driver configuration function.
int rte_eth_dev_is_removed (uint16_t port_id)
Check if an Ethernet device was physically removed. (rip bozo ๐)
Parameters
port_idโ The port identifier of the Ethernet device.
Returns
1 when the Ethernet device is removed, otherwise 0.
int rte_eth_rx_queue_setup (uint16_t port_id, uint16_t rx_queue_id, uint16_t nb_rx_desc, unsigned int socket_id, const struct rte_eth_rxconf * rx_conf, struct rte_mempool * mb_pool)
Allocate and set up a receive queue for an Ethernet device. ๐ธ
The function allocates a contiguous block of memory for nb_rx_desc receive descriptors from a memory zone associated with socket_id, and initializes each receive descriptor with a network buffer allocated from the memory pool mb_pool. cute, right?
Parameters
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 torte_eth_dev_configure().nb_rx_descโ The number of receive descriptors to allocate for the receive ring.socket_idโ Thesocket_idargument is the socket identifier in case of NUMA. The value can beSOCKET_ID_ANYif 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.NULLvalue is allowed, in which case default Rx configuration will be used. Therx_confstructure contains anrx_threshstructure with the values of the Prefetch, Host, and Write-Back threshold registers of the receive ring. In addition it contains the hardware offloads features to activate using theRTE_ETH_RX_OFFLOAD_*flags. If an offloading set inrx_conf->offloadshasn't been set in the input argumenteth_conf->rxmode.offloadstorte_eth_dev_configure(), it is a new added offloading, it must be per-queue type and it is enabled for the queue. No need to repeat any bit inrx_conf->offloadswhich has already been enabled inrte_eth_dev_configure()at port level. An offloading enabled at port level can't be disabled at queue level. The configuration structure also contains the pointer to the array of the receiving buffer segment descriptions, seerx_segandrx_nsegfields, this extended configuration might be used by split offloads likeRTE_ETH_RX_OFFLOAD_BUFFER_SPLIT. Ifmb_poolis notNULL, the extended configuration fields must be set toNULLand zero.mb_poolโ The pointer to the memory pool from which to allocaterte_mbufnetwork memory buffers to populate each descriptor of the receive ring. There are two options to provide Rx buffer configuration:- single pool:
mb_poolis notNULL,rx_conf.rx_nsegis0. - multiple segments description:
mb_poolisNULL,rx_conf.rx_segis notNULL,rx_conf.rx_nsegis not0. Taken only if flagRTE_ETH_RX_OFFLOAD_BUFFER_SPLITis set inoffloads.
- single pool:
Returns
0: Success, receive queue correctly set up. ๐ซถ-EIO: if device is removed.-ENODEV: ifport_idis invalid.-EINVAL: The memory pool pointer is null or the size of network buffers which can be allocated from this memory pool does not fit the various buffer sizes allowed by the device controller.-ENOMEM: Unable to allocate the receive ring descriptors or to allocate network memory buffers from the memory pool when initializing receive descriptors.
__rte_experimental int rte_eth_rx_hairpin_queue_setup (uint16_t port_id, uint16_t rx_queue_id, uint16_t nb_rx_desc, const struct rte_eth_hairpin_conf * conf)
โ ๏ธ Warning: EXPERIMENTAL: this API may change, or be removed, without prior notice. she's โจunstableโจ bestie, love that for her but don't build your whole life on it.
Allocate and set up a hairpin receive queue for an Ethernet device.
The function set up the selected queue to be used in hairpin.
Parameters
port_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 torte_eth_dev_configure().nb_rx_descโ The number of receive descriptors to allocate for the receive ring.0means the PMD will use default value.confโ The pointer to the hairpin configuration.
Returns
(0)if successful.(-ENODEV)ifport_idis invalid.(-ENOTSUP)if hardware doesn't support.(-EINVAL)if bad parameter.(-ENOMEM)if unable to allocate the resources.
int rte_eth_tx_queue_setup (uint16_t port_id, uint16_t tx_queue_id, uint16_t nb_tx_desc, unsigned int socket_id, const struct rte_eth_txconf * tx_conf)
Allocate and set up a transmit queue for an Ethernet device. ๐ฆ
Parameters
port_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 torte_eth_dev_configure().nb_tx_descโ The number of transmit descriptors to allocate for the transmit ring.socket_idโ Thesocket_idargument is the socket identifier in case of NUMA. Its value can beSOCKET_ID_ANYif 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.NULLvalue is allowed, in which case default Tx configuration will be used. Thetx_confstructure contains the following data:- The
tx_threshstructure 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_threshvalue should be explicitly set to one. - The
tx_free_threshvalue 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_threshvalue 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. Thetx_rs_threshvalue should be less or equal thentx_free_threshvalue, and both of them should be less thennb_tx_desc - 3. - The
offloadsmember contains Tx offloads to be enabled. If an offloading set intx_conf->offloadshasn't been set in the input argumenteth_conf->txmode.offloadstorte_eth_dev_configure(), it is a new added offloading, it must be per-queue type and it is enabled for the queue. No need to repeat any bit intx_conf->offloadswhich has already been enabled inrte_eth_dev_configure()at port level. An offloading enabled at port level can't be disabled at queue level.
- The
Note that setting tx_free_thresh or tx_rs_thresh value to 0 forces the transmit function to use default values. periodt ๐
Returns
0: Success, the transmit queue is correctly set up. โจ-ENOMEM: Unable to allocate the transmit ring descriptors.
__rte_experimental int rte_eth_tx_hairpin_queue_setup (uint16_t port_id, uint16_t tx_queue_id, uint16_t nb_tx_desc, const struct rte_eth_hairpin_conf * conf)
โ ๏ธ Warning: EXPERIMENTAL: this API may change, or be removed, without prior notice. yes bestie she's giving experimental, proceed with caution ๐
Allocate and set up a transmit hairpin queue for an Ethernet device.
Parameters
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 torte_eth_dev_configure().nb_tx_descโ The number of transmit descriptors to allocate for the transmit ring.0to set default PMD value.confโ The hairpin configuration.
Returns
(0)if successful.(-ENODEV)ifport_idis invalid.(-ENOTSUP)if hardware doesn't support.(-EINVAL)if bad parameter.(-ENOMEM)if unable to allocate the resources.
__rte_experimental int rte_eth_hairpin_get_peer_ports (uint16_t port_id, uint16_t * peer_ports, size_t len, uint32_t direction)
โ ๏ธ Warning: EXPERIMENTAL: this API may change, or be removed, without prior notice. okay she's experimental AND she gossips about everyone's peers, obsessed ๐ญ
Get all the hairpin peer Rx / Tx ports of the current port. The caller should ensure that the array is large enough to save the ports list. (fr fr, size it correctly or it's over)
Parameters
port_idโ The port identifier of the Ethernet device.peer_portsโ Pointer to the array to store the peer ports list.lenโ Length of the array to store the port identifiers.directionโ Current port to peer port direction positive - current used as Tx to get all peer Rx ports. zero - current used as Rx to get all peer Tx ports.
Returns
(0 or positive)actual peer ports number.(-EINVAL)if bad parameter.(-ENODEV)ifport_idinvalid(-ENOTSUP)if hardware doesn't support.- Others detailed errors from PMDs.
__rte_experimental int rte_eth_hairpin_bind (uint16_t tx_port, uint16_t rx_port)
โ ๏ธ Warning: EXPERIMENTAL: this API may change, or be removed, without prior notice. ๐ง
Bind all hairpin Tx queues of one port to the Rx queues of the peer port. It is only allowed to call this function after all hairpin queues are configured properly and the devices are in started state. lowkey a rule, highkey a boundary โ
Parameters
tx_portโ The identifier of the Tx port.rx_portโ The identifier of peer Rx port.RTE_MAX_ETHPORTSis allowed for the traversal of all devices. Rx port ID could have the same value as Tx port ID.
Returns
(0)if successful.(-ENODEV)if Tx port ID is invalid.-EBUSYโ the device isn't in started state, bestie ๐ญ-ENOTSUPโ the hardware literally doesn't support it, no cap ๐- others โ detailed errors straight from the PMDs ๐ซถ
rte_eth_hairpin_unbind
__rte_experimental int rte_eth_hairpin_unbind (uint16_t tx_port, uint16_t rx_port)
โ ๏ธ EXPERIMENTAL: this API may change, or be removed, without prior notice ๐
Okay so this one unbinds all the hairpin Tx queues of one port from the Rx queues of the peer port โจ If you called the bind function before, you gotta call this before closing the Tx or Rx devices โ that's the order, periodt ๐ And good news: after you unbind a hairpin port pair, you're allowed to bind them again, iconic behavior honestly ๐ Just remember that changing queues configuration should happen after stopping the device(s). Don't skip that step, it's giving undefined chaos otherwise ๐ญ
Parameters ๐
tx_portโ the identifier of the Tx port.rx_portโ the identifier of peer Rx port.RTE_MAX_ETHPORTSis allowed for traversal of all devices. Also, the Rx port ID could totally have the same value as the Tx port ID, that's fine bestie ๐
Returns
0if successful โจ-ENODEVif the Tx port ID is invalid.-EBUSYif the device is in stopped state.-ENOTSUPif the hardware doesn't support it.- Others โ detailed errors from PMDs.
rte_eth_dev_count_aggr_ports
__rte_experimental int rte_eth_dev_count_aggr_ports (uint16_t port_id)
โ ๏ธ EXPERIMENTAL: this API may change without prior notice.
Get you the number of aggregated ports of the DPDK port (the one you specify with port_id) ๐ซ It's used when multiple ports are aggregated into a single one, iykyk.
And for a regular physical port that doesn't have aggregated ports? The number of aggregated ports is reported as 0. Simple as that, no drama ๐ฆ
Parameters ๐
port_idโ the port identifier of the Ethernet device.
Returns
>=0โ the number of aggregated port if success ๐ธ
rte_eth_dev_map_aggr_tx_affinity
__rte_experimental int rte_eth_dev_map_aggr_tx_affinity (uint16_t port_id, uint16_t tx_queue_id, uint8_t affinity)
โ ๏ธ EXPERIMENTAL: this API may change without prior notice.
Map a Tx queue with an aggregated port of the DPDK port (specified with port_id) ๐บ๏ธ When multiple ports are aggregated into a single one, this lets you choose which port to use for Tx via a queue. Main character energy, choosing your own lane fr fr ๐
Timing matters here, bestie โ the application should use rte_eth_dev_map_aggr_tx_affinity() after rte_eth_dev_configure(), after rte_eth_tx_queue_setup(), and before rte_eth_dev_start() โฐ
Parameters ๐
port_idโ the identifier of the port used inrte_eth_tx_burst().tx_queue_idโ the index of the transmit queue used inrte_eth_tx_burst(). The value must be in the range[0, nb_tx_queue - 1]previously supplied torte_eth_dev_configure().affinityโ the number of the aggregated port. Value 0 means no affinity and traffic could be routed to any aggregated port. The first aggregated port is number 1 and so on. The maximum number is given byrte_eth_dev_count_aggr_ports().
Returns
Zero if successful. Non-zero otherwise. That's the whole vibe โจ
rte_eth_dev_socket_id
int rte_eth_dev_socket_id (uint16_t port_id)
Return the NUMA socket to which an Ethernet device is connected ๐ง
Parameters ๐
port_idโ the port identifier of the Ethernet device
Returns
- The NUMA socket ID which the Ethernet device is connected to.
-1(which translates toSOCKET_ID_ANY) if the socket could not be determined.rte_errnois then set to:EINVALis theport_idis invalid,0is the socket could not be determined,
(Yes, that's exactly how the original words it โ I'm not fixing it, I'm just delivering it ๐ญ๐)
rte_eth_dev_is_valid_port
int rte_eth_dev_is_valid_port (uint16_t port_id)
Check if port_id of device is attached ๐ vibe check on the port basically.
Parameters ๐
port_idโ the port identifier of the Ethernet device
Returns
0if port is out of range or not attached1if device is attached ๐
rte_eth_rx_queue_is_valid
__rte_experimental int rte_eth_rx_queue_is_valid (uint16_t port_id, uint16_t queue_id)
โ ๏ธ EXPERIMENTAL: this API may change, or be removed, without prior notice.
Check if the Rx queue is valid โ If the queue has been setup, it is considered valid. That's the rule, that's the law ๐
Parameters ๐
port_idโ the port identifier of the Ethernet device.queue_idโ the index of the receive queue.
Returns
-ENODEV: ifport_idis invalid.-EINVAL: ifqueue_idis out of range or queue has not been setup.0if Rx queue is valid โจ
rte_eth_tx_queue_is_valid
__rte_experimental int rte_eth_tx_queue_is_valid (uint16_t port_id, uint16_t queue_id)
โ ๏ธ EXPERIMENTAL: this API may change, or be removed, without prior notice.
Same energy, but for the Tx queue ๐ค Check if it's valid โ and again, if the queue has been setup, it is considered valid ๐ซ
Parameters ๐
port_idโ the port identifier of the Ethernet device.queue_idโ the index of the transmit queue.
Returns
-ENODEV: ifport_idis invalid.-EINVAL: ifqueue_idis out of range or queue has not been setup.0if Tx queue is valid ๐ธ
rte_eth_dev_rx_queue_start
int rte_eth_dev_rx_queue_start (uint16_t port_id, uint16_t rx_queue_id)
Start specified Rx queue of a port ๐ It is used when the rx_deferred_start flag of the specified queue is true. (Deferred start girlies, this one's for you ๐
)
Parameters ๐
port_idโ the port identifier of the Ethernet devicerx_queue_idโ the index of the Rx queue to update the ring. The value must be in the range[0, nb_rx_queue - 1]previously supplied torte_eth_dev_configure().
Returns
0: Success, the receive queue is started โจ-ENODEV: ifport_idis invalid.-EINVAL: Thequeue_idout of range or belong to hairpin.-EIO: if device is removed.-ENOTSUP: The function not supported in PMD.
rte_eth_dev_rx_queue_stop
int rte_eth_dev_rx_queue_stop (uint16_t port_id, uint16_t rx_queue_id)
Stop specified Rx queue of a port ๐ The opposite of the one above, obviously.
Parameters ๐
port_idโ the port identifier of the Ethernet devicerx_queue_idโ the index of the Rx queue to update the ring. The value must be in the range[0, nb_rx_queue - 1]previously supplied torte_eth_dev_configure().
Returns
0: Success, the receive queue is stopped โจ-ENODEV: ifport_idis invalid.-EINVAL: Thequeue_idout of range or belong to hairpin.-EIO: if device is removed.-ENOTSUP: The function not supported in PMD.
rte_eth_dev_tx_queue_start
int rte_eth_dev_tx_queue_start (uint16_t port_id, uint16_t tx_queue_id)
Start Tx for the specified queue of a port ๐ค It is used when the tx_deferred_start flag of the specified queue is true.
Parameters ๐
port_idโ the port identifier of the Ethernet devicetx_queue_idโ the index of the Tx queue to update the ring. The value must be in the range[0, nb_tx_queue - 1]previously supplied torte_eth_dev_configure().
Returns
0: Success, the transmit queue is started โจ-ENODEV: ifport_idis invalid.-EINVAL: Thequeue_idout of range or belong to hairpin.-EIO: if device is removed.-ENOTSUP: The function not supported in PMD.
rte_eth_dev_tx_queue_stop
int rte_eth_dev_tx_queue_stop (uint16_t port_id, uint16_t tx_queue_id)
Stop specified Tx queue of a port ๐
Parameters ๐
port_idโ the port identifier of the Ethernet devicetx_queue_idโ the index of the Tx queue to update the ring. The value must be in the range[0, nb_tx_queue - 1]previously supplied torte_eth_dev_configure().
Returns
0: Success, the transmit queue is stopped โจ-ENODEV: ifport_idis invalid.-EINVAL: Thequeue_idout of range or belong to hairpin.-EIO: if device is removed.-ENOTSUP: The function not supported in PMD.
rte_eth_dev_start
int rte_eth_dev_start (uint16_t port_id)
Start an Ethernet device ๐ฅ This is the moment, bestie, the glow-up finale โจ
The device start step is the last one and consists of setting the configured offload features and in starting the transmit and the receive units of the device.
Device RTE_ETH_DEV_NOLIVE_MAC_ADDR flag causes MAC address to be set before PMD port start callback function is invoked ๐
All device queues (except form deferred start queues) status should be RTE_ETH_QUEUE_STATE_STARTED after start.
On success, all basic functions exported by the Ethernet API (link status, receive/transmit, and so on) can be invoked ๐
Parameters ๐
port_idโ the port identifier of the Ethernet device.
Returns
0: Success, Ethernet device started ๐-EAGAIN: If start operation must be retried. (Not a fail, just a "run it back" ๐ )<0: Error code of the driver device start function.
rte_eth_dev_stop
int rte_eth_dev_stop (uint16_t port_id)
Stop an Ethernet device ๐ And the good news โ the device can be restarted with a call to rte_eth_dev_start() ๐ซ
All device queues status should be RTE_ETH_QUEUE_STATE_STOPPED after stop.
Parameters ๐
port_idโ the port identifier of the Ethernet device.
Returns
0: Success, Ethernet device stopped โจ-EBUSY: If stopping the port is not allowed in current state.<0: Error code of the driver device stop function.
rte_eth_dev_set_link_up
int rte_eth_dev_set_link_up (uint16_t port_id)
Link up an Ethernet device ๐
Set device link up will re-enable the device Rx/Tx functionality after it is previously set device linked down. It's giving revival arc ๐ฆ
Parameters ๐
port_idโ the port identifier of the Ethernet device.
Returns
0: Success, Ethernet device linked up โจ<0: Error code of the driver device link up function.
rte_eth_dev_set_link_down
int rte_eth_dev_set_link_down (uint16_t port_id)
Link down an Ethernet device ๐ด The device Rx/Tx functionality will be disabled if success, and it can be re-enabled with a call to rte_eth_dev_set_link_up(). So don't panic, it's reversible ๐
Parameters ๐
port_idโ the port identifier of the Ethernet device.
rte_eth_dev_close
int rte_eth_dev_close (uint16_t port_id)
Close a stopped Ethernet device ๐ช
The device cannot be restarted! ๐ญ Like, fr fr, this is the end of the line. The function frees all port resources. No take-backs, no undo button, periodt ๐
Parameters ๐
port_idโ the port identifier of the Ethernet device.
Returns
- Zero if the port is closed successfully โจ
- Negative if something went wrong.
rte_eth_dev_reset
int rte_eth_dev_reset (uint16_t port_id)
Reset an Ethernet device and keep its port ID ๐
When a port has to be reset passively, the DPDK application can invoke this function. For example when a PF is reset, all its VFs should also be reset. Normally a DPDK application can invoke this function when RTE_ETH_EVENT_INTR_RESET event is detected, but can also use it to start a port reset in other circumstances ๐คท
When this function is called, it first stops the port and then calls the PMD specific dev_uninit( ) and dev_init( ) to return the port to initial state, in which no Tx and Rx queues are setup, as if the port has been reset and not started. The port keeps the port ID it had before the function call ๐
After calling rte_eth_dev_reset( ), the application should use rte_eth_dev_configure( ), rte_eth_rx_queue_setup( ), rte_eth_tx_queue_setup( ), and rte_eth_dev_start( ) to reconfigure the device as appropriate. Full re-glow-up routine ๐
โจ
Note: To avoid unexpected behavior, the application should stop calling Tx and Rx functions before calling rte_eth_dev_reset( ) ๐ญ And for thread safety, all these controlling functions should be called from the same thread. Don't be messy with threads here, bestie.
โจ to be continued, bestie โจ
port_idโ the port identifier of the Ethernet device, bestie. That's the one you're poking. ๐ซถ
Returns
(0)โ if successful โจ(-ENODEV)โ ifport_idis invalid ๐ญ(-ENOTSUP)โ if hardware doesn't support this function ๐(-EPERM)โ if not ran from the primary process ๐(-EIO)โ if re-initialisation failed or device is removed ๐(-ENOMEM)โ if the reset failed due to OOM(-EAGAIN)โ if the reset temporarily failed and should be retried later ๐
int rte_eth_promiscuous_enable (uint16_t port_id)
Enable receipt in promiscuous mode for an Ethernet device. Yes she's nosy, she wants everything. ๐
Parameters
port_idโ the port identifier of the Ethernet device.
Returns
(0)โ if successful โจ(-ENOTSUP)โ if support forpromiscuous_enable()does not exist for the device(-ENODEV)โ ifport_idinvalid
int rte_eth_promiscuous_disable (uint16_t port_id)
Disable receipt in promiscuous mode for an Ethernet device. Put the blindfold on, babe, we're minding our own business now. ๐
Parameters
port_idโ the port identifier of the Ethernet device.
Returns
(0)โ if successful โจ(-ENOTSUP)โ if support forpromiscuous_disable()does not exist for the device(-ENODEV)โ ifport_idinvalid
int rte_eth_promiscuous_get (uint16_t port_id)
Return the value of promiscuous mode for an Ethernet device. A little vibe check, if you will. ๐ธ
Parameters
port_idโ the port identifier of the Ethernet device.
Returns
(1)โ if promiscuous is enabled ๐(0)โ if promiscuous is disabled(-1)โ on error ๐ญ
int rte_eth_allmulticast_enable (uint16_t port_id)
Enable the receipt of any multicast frame by an Ethernet device.
Parameters
port_idโ the port identifier of the Ethernet device.
Returns
(0)โ if successful โจ(-ENOTSUP)โ if support forallmulticast_enable()does not exist for the device(-ENODEV)โ ifport_idinvalid
int rte_eth_allmulticast_disable (uint16_t port_id)
Disable the receipt of all multicast frames by an Ethernet device.
Parameters
port_idโ the port identifier of the Ethernet device.
Returns
(0)โ if successful โจ(-ENOTSUP)โ if support forallmulticast_disable()does not exist for the device(-ENODEV)โ ifport_idinvalid
int rte_eth_allmulticast_get (uint16_t port_id)
Return the value of allmulticast mode for an Ethernet device. Another vibe check, we stay checking vibes. ๐ฆ
Parameters
port_idโ the port identifier of the Ethernet device.
Returns
(1)โ if allmulticast is enabled ๐(0)โ if allmulticast is disabled(-1)โ on error ๐ญ
int rte_eth_link_get (uint16_t port_id, struct rte_eth_link * link)
Retrieve the link status (up/down), the duplex mode (half/full), the negotiation (auto/fixed), and if available, the speed (Mbps).
It might need to wait up to 9 seconds. Nine!! That's a whole skincare routine, bestie, so maybe don't call this in a hot loop. ๐ญ
See also: rte_eth_link_get_nowait โ the impatient sibling we're about to meet.
Parameters
port_idโ the port identifier of the Ethernet device.linkโ link information written back.
Returns
(0)โ if successful โจ(-ENOTSUP)โ if the function is not supported in PMD(-ENODEV)โ ifport_idinvalid(-EINVAL)โ if bad parameter ๐ซ
int rte_eth_link_get_nowait (uint16_t port_id, struct rte_eth_link * link)
Retrieve the link status (up/down), the duplex mode (half/full), the negotiation (auto/fixed), and if available, the speed (Mbps).
Same info, zero waiting. She said "I'm not standing in line for anybody." ๐
Parameters
port_idโ the port identifier of the Ethernet device.linkโ link information written back.
Returns
(0)โ if successful โจ(-ENOTSUP)โ if the function is not supported in PMD(-ENODEV)โ ifport_idinvalid(-EINVAL)โ if bad parameter ๐ซ
__rte_experimental const char * rte_eth_link_speed_to_str (uint32_t link_speed)
โ ๏ธ Warning: EXPERIMENTAL: this API may change without prior notice. Not a drill, she's still in her testing era. ๐งช
The function converts a link_speed to a string. It handles all the special values, like unknown or none speed. No edge case left behind, periodt. โจ
Parameters
link_speedโlink_speedofrte_eth_linkstruct
Returns
Link speed in textual format. It's a pointer to immutable memory. No free is required. Don't you dare free() her, she's not yours. ๐ซถ
__rte_experimental const char * rte_eth_link_connector_to_str (enum rte_eth_link_connector link_connector)
โ ๏ธ Warning: EXPERIMENTAL: this API may change without prior notice. ๐งช
This function converts an Ethernet link type to a string.
Parameters
link_connectorโ the link type to convert.
Returns
NULL for invalid link connector values, otherwise the string representation of the link type. ๐
__rte_experimental int rte_eth_link_to_str (char * str, size_t len, const struct rte_eth_link * eth_link)
โ ๏ธ Warning: EXPERIMENTAL: this API may change without prior notice. ๐งช
The function converts a rte_eth_link struct representing a link status to a string.
Parameters
strโ a pointer to a string to be filled with textual representation of device status. At leastRTE_ETH_LINK_MAX_STR_LENbytes should be allocated to store default link status text. Don't be stingy with the buffer, she needs room. ๐lenโ length of available memory at'str'string.eth_linkโ link status returned byrte_eth_link_getfunction
Returns
Number of bytes written to str array, or -EINVAL if bad parameter. ๐ญ
__rte_experimental int rte_eth_speed_lanes_get (uint16_t port_id, uint32_t * lanes)
โ ๏ธ Warning: EXPERIMENTAL: this API may change, or be removed, without prior notice. ๐งช
Get Active lanes.
Parameters
port_idโ the port identifier of the Ethernet device.lanesโ driver updateslaneswith the number of active lanes. On a supported NIC on link up,laneswill be a non-zero value irrespective of whether the link is Autonegotiated or Fixed speed. No information is displayed for error. ๐
Returns
(0)โ if successful โจ(-ENOTSUP)โ if underlying hardware OR driver doesn't support that operation(-EIO)โ if device is removed ๐(-ENODEV)โ ifport_idinvalid
__rte_experimental int rte_eth_speed_lanes_set (uint16_t port_id, uint32_t speed_lanes)
โ ๏ธ Warning: EXPERIMENTAL: this API may change, or be removed, without prior notice. ๐งช
Set the speed lanes supported by the NIC.
Parameters
port_idโ the port identifier of the Ethernet device.speed_lanesโ a non-zero number of speed lanes, that will be applied to the ethernet PHY along with the fixed speed configuration. Driver returns error if the user lanes is not in speeds capability list. So check the list first, iykyk. ๐ซถ
Returns
(0)โ if successful โจ(-ENOTSUP)โ if underlying hardware OR driver doesn't support that operation(-EIO)โ if device is removed ๐(-ENODEV)โ ifport_idinvalid(-EINVAL)โ if lanes count not in speeds capability list ๐ซ
__rte_experimental int rte_eth_speed_lanes_get_capability (uint16_t port_id, struct rte_eth_speed_lanes_capa * speed_lanes_capa, unsigned int num)
โ ๏ธ Warning: EXPERIMENTAL: this API may change, or be removed, without prior notice. ๐งช
Get the speed lanes supported by the NIC.
Parameters
port_idโ the port identifier of the Ethernet device.speed_lanes_capaโ an array of supported speed and its supported lanes.numโ size of thespeed_lanes_capaarray. The size is equal to the supported speeds list size. Value ofnumis derived by calling this api withspeed_lanes_capa=NULLandnum=0. Yes bestie, you probe first, then you allocate. Classic two-step. ๐
Returns
(0)โ if successful โจ(-ENOTSUP)โ if underlying hardware OR driver doesn't support that operation(-EIO)โ if device is removed ๐(-ENODEV)โ ifport_idinvalid(-EINVAL)โ ifspeed_lanesinvalid ๐ซ
int rte_eth_stats_get (uint16_t port_id, struct rte_eth_stats * stats)
Retrieve the general I/O statistics of an Ethernet device. Numbers time, we love numbers. ๐
Parameters
port_idโ the port identifier of the Ethernet device.statsโ a pointer to a structure of typerte_eth_statsto be filled with the values of device counters for the following set of statistics:ipacketswith the total of successfully received packets. ๐opacketswith the total of successfully transmitted packets.ibyteswith the total of successfully received bytes.obyteswith the total of successfully transmitted bytes.ierrorswith the total of erroneous received packets. ๐ญoerrorswith the total of failed transmitted packets. ๐ญ
Returns
Zero if successful. Non-zero otherwise.
int rte_eth_stats_reset (uint16_t port_id)
Reset the general I/O statistics of an Ethernet device. Fresh start, clean slate, new me era. โจ
Parameters
port_idโ the port identifier of the Ethernet device.
Returns
(0)โ if device notified to reset stats ๐(-ENOTSUP)โ if hardware doesn't support(-ENODEV)โ ifport_idinvalid(<0)โ error code of the driver stats reset function ๐
int rte_eth_xstats_get_names (uint16_t port_id, struct rte_eth_xstat_name * xstats_names, unsigned int size)
Retrieve names of extended statistics of an Ethernet device.
There is an assumption that 'xstat_names' and 'xstats' arrays are matched by array index:
xstats_names[i].name => xstats[i].value
And the array index is same with id field of 'struct rte_eth_xstat':
xstats[i].id == i
This assumption makes key-value pair matching less flexible but simpler. She's not complicated, she's consistent. ๐
Parameters
port_idโ the port identifier of the Ethernet device.xstats_namesโ anrte_eth_xstat_namearray of at leastsizeelements to be filled. If set toNULL, the function returns the required number of elements. ๐sizeโ the size of thexstats_namesarray (number of elements).
Returns
- A positive value lower or equal to
size: success. The return value is the number of entries filled in the stats table. โจ - A positive value higher than
size: error, the given statistics table is too small. The return value corresponds to the size that should be given to succeed. The entries in the table are not valid and shall not be used by the caller. ๐ซ - A negative value on error (invalid port ID). ๐ญ
int rte_eth_xstats_get (uint16_t port_id, struct rte_eth_xstat * xstats, unsigned int n)
Retrieve extended statistics of an Ethernet device.
There is an assumption that 'xstat_names' and 'xstats' arrays are matched by array index:
xstats_names[i].name => xstats[i].value
And the array index is same with id field of 'struct rte_eth_xstat':
xstats[i].id == i
This assumption makes key-value pair matching less flexible but simpler. Same deal, same energy. ๐ธ
Parameters
port_idโ the port identifier of the Ethernet device ๐xstatsโ a pointer to a table of structure of typerte_eth_xstatthat's gonna get filled with device statistics ids and values. Bestie, this one can beNULLif and only ifnis 0, no cap.nโ the size of thexstatsarray (aka the number of elements). If it's lower than the required number of elements, the function returns the required number of elements. And if it equals zero? Thenxstatsmust beNULL, and the function returns the required number of elements. periodt.
Returns
- A positive value lower or equal to
n: success ๐ the return value is the number of entries filled in the stats table. - A positive value higher than
n: error, the given statistics table is too small ๐ญ the return value corresponds to the size that should be given to succeed. And the entries in the table are not valid and shall not be used by the caller โ read that again, don't use them. - A negative value on error (invalid port ID).
int rte_eth_xstats_get_names_by_id (uint16_t port_id, struct rte_eth_xstat_name * xstats_names, unsigned int size, uint64_t * ids)
Retrieve names of extended statistics of an Ethernet device โจ
Parameters
port_idโ the port identifier of the Ethernet device.xstats_namesโ array to be filled in with names of requested device statistics. Must not beNULLifidsare specified (notNULL).sizeโ number of elements in thexstats_namesarray (if notNULL) and in theidsarray (if notNULL). Must be 0 if both array pointers areNULL.idsโ IDs array given by the app to retrieve specific statistics. May beNULLto retrieve names of all available statistics or, ifxstats_namesisNULLas well, just the number of available statistics. iykyk ๐
Returns
- A positive value lower or equal to
size: success ๐ the return value is the number of entries filled in the stats table. - A positive value higher than
size: success (yes, still success bestie) ๐ซถ the given statistics table is too small. The return value corresponds to the size that should be given to succeed. The entries in the table are not valid and shall not be used by the caller. - A negative value on error.
int rte_eth_xstats_get_by_id (uint16_t port_id, const uint64_t * ids, uint64_t * values, unsigned int size)
Retrieve extended statistics of an Ethernet device ๐ธ
Parameters
port_idโ the port identifier of the Ethernet device.idsโ IDs array given by the app to retrieve specific statistics. May beNULLto retrieve all available statistics or, ifvaluesisNULLas well, just the number of available statistics.valuesโ array to be filled in with requested device statistics. Must not beNULLifidsare specified (notNULL).sizeโ number of elements in thevaluesarray (if notNULL) and in theidsarray (if notNULL). Must be 0 if both array pointers areNULL.
Returns
- A positive value lower or equal to
size: success โจ the return value is the number of entries filled in the stats table. - A positive value higher than
size: success: the given statistics table is too small. The return value corresponds to the size that should be given to succeed. The entries in the table are not valid and shall not be used by the caller. - A negative value on error.
int rte_eth_xstats_get_id_by_name (uint16_t port_id, const char * xstat_name, uint64_t * id)
Gets the ID of a statistic from its name ๐
Okay so real talk: this function searches for the statistics using string compares, and as such should not be used on the fast-path ๐ For fast-path retrieval of specific statistics, store the ID as provided in id from this function, and pass the ID to rte_eth_xstats_get(). Do that. It's the move. ๐
Parameters
port_idโ the port to look up statistics from.xstat_nameโ the name of the statistic to return.idโ a pointer to an app-supplieduint64_twhich should be set to the ID of the stat if the stat exists.
Returns
0 on success, -ENODEV for invalid port_id, -EIO if device is removed, -EINVAL if the xstat_name doesn't exist in port_id, -ENOMEM if bad parameter.
__rte_experimental int rte_eth_xstats_set_counter (uint16_t port_id, uint64_t id, int on_off)
Enable/Disable the xstat counter of the given id ๐๏ธ
Warning โ EXPERIMENTAL: this API may change without prior notice. Lock in, bestie, it could shift under you ๐
Parameters
port_idโ the port to look up statistics from.idโ the ID of the counter to enable.on_offโ the state to set the counter to.
Returns
(0)on success ๐(-EEXIST)counter already enabled(-ENOTSUP)enable/disable is not implemented(-EINVAL)xstat id is invalid(-EPERM)enabling this counter is not permitted ๐(-ENOSPC)no resources
__rte_experimental int rte_eth_xstats_query_state (uint16_t port_id, uint64_t id)
Query the state of the xstat counter ๐ต๏ธโโ๏ธ
Warning โ EXPERIMENTAL: this API may change without prior notice. Yeah yeah, same energy as above ๐ญ
Parameters
port_idโ the port to look up statistics from.idโ the ID of the counter to query.
Returns
(0)xstat is enabled โญ(1)xstat is disabled(-ENOTSUP)enable/disabling is not implemented(-EINVAL)xstat id is invalid
int rte_eth_xstats_reset (uint16_t port_id)
Reset extended statistics of an Ethernet device ๐
Parameters
port_idโ the port identifier of the Ethernet device.
Returns
(0)if device notified to reset extended stats ๐(-ENOTSUP)if pmd doesn't support both extended stats and basic stats reset.(-ENODEV)ifport_idinvalid.(<0)โ error code of the driver xstats reset function.
__rte_deprecated int rte_eth_dev_set_tx_queue_stats_mapping (uint16_t port_id, uint16_t tx_queue_id, uint8_t stat_idx)
Set a mapping for the specified transmit queue to the specified per-queue statistics counter ๐บ๏ธ
Warning โ this one is __rte_deprecated, bestie. It's giving legacy. It's still here and still documented, but don't go building your whole personality around it ๐
Parameters
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 torte_eth_dev_configure().stat_idxโ the per-queue packet statistics functionality number that the transmit queue is to be assigned. The value must be in the range[0, RTE_ETHDEV_QUEUE_STAT_CNTRS - 1]. MaxRTE_ETHDEV_QUEUE_STAT_CNTRSbeing 256.
Returns
Zero if successful. Non-zero otherwise.
__rte_deprecated int rte_eth_dev_set_rx_queue_stats_mapping (uint16_t port_id, uint16_t rx_queue_id, uint8_t stat_idx)
Set a mapping for the specified receive queue to the specified per-queue statistics counter ๐บ๏ธ
Warning โ __rte_deprecated again, same vibe check failure as its sibling above. It's the rx twin, ok? Don't say I didn't tell you ๐ญ
Parameters
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 torte_eth_dev_configure().stat_idxโ the per-queue packet statistics functionality number that the receive queue is to be assigned. The value must be in the range[0, RTE_ETHDEV_QUEUE_STAT_CNTRS - 1]. MaxRTE_ETHDEV_QUEUE_STAT_CNTRSbeing 256.
Returns
Zero if successful. Non-zero otherwise.
int rte_eth_macaddr_get (uint16_t port_id, struct rte_ether_addr * mac_addr)
Retrieve the Ethernet address of an Ethernet device ๐ฌ
Parameters
port_idโ the port identifier of the Ethernet device.mac_addrโ a pointer to a structure of typeether_addrto be filled with the Ethernet address of the Ethernet device.
Returns
(0)if successful โจ(-ENODEV)ifport_idinvalid.(-EINVAL)if bad parameter.
__rte_experimental int rte_eth_macaddrs_get (uint16_t port_id, struct rte_ether_addr * ma, unsigned int num)
Warning โ EXPERIMENTAL: this API may change without prior notice ๐ซ
Retrieve the Ethernet addresses of an Ethernet device โ plural, bestie, it's giving all the addresses ๐
Parameters
port_idโ the port identifier of the Ethernet device.maโ a pointer to an array of structures of typeether_addrto be filled with the Ethernet addresses of the Ethernet device.numโ number of elements in themaarray. Note thatrte_eth_dev_info::max_mac_addrscan be used to retrieve max number of Ethernet addresses for given port.
Returns
- number of retrieved addresses if successful ๐
(-ENODEV)ifport_idinvalid.(-EINVAL)if bad parameter.
int rte_eth_dev_info_get (uint16_t port_id, struct rte_eth_dev_info * dev_info)
Retrieve the contextual information of an Ethernet device ๐
This function returns the Ethernet device information based on the values stored internally in the device specific data. For example: number of queues, descriptor limits, device capabilities and offload flags. It's literally the info dump of your dreams, no cap.
Parameters
port_idโ the port identifier of the Ethernet device.dev_infoโ a pointer to a structure of typerte_eth_dev_infoto be filled with the contextual information of the Ethernet device.
Returns
(0)if successful. ๐(-ENOTSUP)if support fordev_infos_get()does not exist for the device.(-ENODEV)ifport_idinvalid.(-EINVAL)if bad parameter.
__rte_experimental int rte_eth_dev_conf_get (uint16_t port_id, struct rte_eth_conf * dev_conf)
Warning โ EXPERIMENTAL: this API may change without prior notice. Yes, this one has a period at the end of the warning and the last one didn't. I noticed. You're welcome. ๐
Retrieve the configuration of an Ethernet device โ๏ธ
Parameters
port_idโ the port identifier of the Ethernet device.dev_confโ location for Ethernet device configuration to be filled in.
Returns
(0)if successful. โจ(-ENODEV)ifport_idinvalid.(-EINVAL)if bad parameter.
int rte_eth_dev_fw_version_get (uint16_t port_id, char * fw_version, size_t fw_size)
Retrieve the firmware version of a device ๐ง
Parameters
port_idโ the port identifier of the device.fw_versionโ a pointer to a string array storing the firmware version of a device, the string includes terminating null. This pointer is allocated by caller โ that's on you, bestie ๐ซถfw_sizeโ the size of the string array pointed byfw_version, which should be large enough to store firmware version of the device.
Returns
(0)if successful. ๐(-ENOTSUP)if operation is not supported.(-ENODEV)ifport_idinvalid.(-EIO)if device is removed.(-EINVAL)if bad parameter.(>0)iffw_sizeis not enough to store firmware version, return the size of the non truncated string. Sneaky little positive return, keep an eye on it ๐
int rte_eth_dev_get_supported_ptypes (uint16_t port_id, uint32_t ptype_mask, uint32_t * ptypes, int num)
Retrieve the supported packet types of an Ethernet device ๐ฅ
okay so real talk bestie: when a packet type gets announced as supported, the PMD has to actually recognize it. no take-backs, no vibes-only promises. so like, if RTE_PTYPE_L2_ETHER, RTE_PTYPE_L2_ETHER_VLAN and RTE_PTYPE_L3_IPV4 are all announced, then the PMD is contractually obligated to hand back these packet types for these packets:
Ether/IPv4->RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4Ether/VLAN/IPv4->RTE_PTYPE_L2_ETHER_VLAN | RTE_PTYPE_L3_IPV4Ether/[anything else]->RTE_PTYPE_L2_ETHEREther/VLAN/[anything else]->RTE_PTYPE_L2_ETHER_VLAN
and when a packet shows up at a PMD, it's gotta return the most precise type it can, out of the ones it supports. โจ but here's the tea โ a PMD is allowed to set a packet type that isn't even on the supported list, as long as it's more precise. so yeah, a PMD that announces literally zero supported packet types can still set a matching packet type on a received packet. iconique loophole behavior, honestly. ๐
Note ๐ซถ
- Better to invoke this API after the device is already started or the Rx burst function is decided, so you get the correct supported ptypes. timing matters, babes.
- if a given PMD does not report what ptypes it supports, then the supported ptype count gets reported as
0. that's just the situation. ๐ญ
Parameters ๐ธ
- port_id โ The port identifier of the Ethernet device.
- ptype_mask โ A hint of what kind of packet type which the caller is interested in.
- ptypes โ An array pointer to store adequate packet types, allocated by caller.
- num โ Size of the array pointed by param
ptypes.
Returns โญ
- (
>=0) Number of supported ptypes. If the number of types exceeds num, only num entries will be filled into the ptypes array, but the full count of supported ptypes will be returned. - (
-ENODEV) if port_id invalid. - (
-EINVAL) if bad parameter.
int rte_eth_dev_set_ptypes(uint16_t port_id, uint32_t ptype_mask, uint32_t * set_ptypes, unsigned int num)
Inform Ethernet device about reduced range of packet types to handle. ๐
The application can use this function to set only specific ptypes that it's interested in. This information can be used by the PMD to optimize the Rx path. basically you're telling the driver "bestie, only worry about these" and it can go feral optimizing. ๐ฅ
The function accepts an array set_ptypes allocated by the caller to store the packet types set by the driver, and the last element of the array is set to RTE_PTYPE_UNKNOWN. The size of the set_ptype array should be rte_eth_dev_get_supported_ptypes() + 1 else it might only be filled partially. yes, size it right or you get crumbs. ๐
Parameters ๐ธ
- port_id โ The port identifier of the Ethernet device.
- ptype_mask โ The ptype family that application is interested in should be bitwise OR of
RTE_PTYPE_*_MASKor0. - set_ptypes โ An array pointer to store set packet types, allocated by caller. The function marks the end of array with
RTE_PTYPE_UNKNOWN. - num โ Size of the array pointed by param
ptypes. Should berte_eth_dev_get_supported_ptypes() + 1to accommodate the set ptypes.
Returns โญ
- (
0) if Success. - (
-ENODEV) if port_id invalid. - (
-EINVAL) if ptype_mask is invalid (or) set_ptypes isNULLand num > 0.
int rte_eth_dev_get_mtu(uint16_t port_id, uint16_t * mtu)
Retrieve the MTU of an Ethernet device. just, like, asking the NIC how big it's willing to go. ๐
Parameters ๐ธ
- port_id โ The port identifier of the Ethernet device.
- mtu โ A pointer to a
uint16_twhere the retrieved MTU is to be stored.
Returns โญ
- (
0) if successful. - (
-ENODEV) if port_id invalid. - (
-EINVAL) if bad parameter.
int rte_eth_dev_set_mtu(uint16_t port_id, uint16_t mtu)
Change the MTU of an Ethernet device. glow-up time for your frame size. โจ
Parameters ๐ธ
- port_id โ The port identifier of the Ethernet device.
- mtu โ A
uint16_tfor the MTU to be applied.
Returns โญ
- (
0) if successful. - (
-ENOTSUP) if operation is not supported. - (
-ENODEV) if port_id invalid. - (
-EIO) if device is removed. - (
-EINVAL) if mtu invalid, validation of mtu can occur withinrte_eth_dev_set_mtuifdev_infos_getis supported by the device or when the mtu is set usingdev->dev_ops->mtu_set. - (
-EBUSY) if operation is not allowed when the port is running
int rte_eth_dev_vlan_filter(uint16_t port_id, uint16_t vlan_id, int on)
Enable/Disable hardware filtering by an Ethernet device of received VLAN packets tagged with a given VLAN Tag Identifier. ๐
Parameters ๐ธ
- port_id โ The port identifier of the Ethernet device.
- vlan_id โ The VLAN Tag Identifier whose filtering must be enabled or disabled.
- on โ If > 0, enable VLAN filtering of VLAN packets tagged with vlan_id. Otherwise, disable VLAN filtering of VLAN packets tagged with vlan_id.
Returns โญ
- (
0) if successful. - (
-ENOTSUP) if hardware-assisted VLAN filtering not configured. - (
-ENODEV) if port_id invalid. - (
-EIO) if device is removed. - (
-ENOSYS) if VLAN filtering on port_id disabled. - (
-EINVAL) if vlan_id > 4095.
int rte_eth_dev_set_vlan_strip_on_queue(uint16_t port_id, uint16_t rx_queue_id, int on)
Enable/Disable hardware VLAN Strip by a Rx queue of an Ethernet device. peeling that tag off before anyone even sees it. ๐ง
Parameters ๐ธ
- port_id โ The port identifier of the Ethernet device.
- rx_queue_id โ The index of the receive queue on which to enable/disable VLAN stripping. The value must be in the range
[0, nb_rx_queue - 1]previously supplied torte_eth_dev_configure(). - on โ If
1, Enable VLAN Stripping of the receive queue of the Ethernet port. If0, Disable VLAN Stripping of the receive queue of the Ethernet port.
Returns โญ
- (
0) if successful. - (
-ENOTSUP) if hardware-assisted VLAN stripping not configured. - (
-ENODEV) if port_id invalid. - (
-EINVAL) if rx_queue_id invalid.
int rte_eth_dev_set_vlan_ether_type(uint16_t port_id, enum rte_vlan_type vlan_type, uint16_t tag_type)
Set the Outer VLAN Ether Type by an Ethernet device, it can be inserted to the VLAN header. your TPID era. ๐
Parameters ๐ธ
- port_id โ The port identifier of the Ethernet device.
- vlan_type โ The VLAN type.
- tag_type โ The Tag Protocol ID
Returns โญ
- (
0) if successful. - (
-ENOTSUP) if hardware-assisted VLAN TPID setup is not supported. - (
-ENODEV) if port_id invalid. - (
-EIO) if device is removed.
int rte_eth_dev_set_vlan_offload(uint16_t port_id, int offload_mask)
Set VLAN offload configuration on an Ethernet device. ๐ฆ
Parameters ๐ธ
- port_id โ The port identifier of the Ethernet device.
- offload_mask โ The VLAN Offload bit mask can be mixed use with "OR"
RTE_ETH_VLAN_STRIP_OFFLOADRTE_ETH_VLAN_FILTER_OFFLOADRTE_ETH_VLAN_EXTEND_OFFLOADRTE_ETH_QINQ_STRIP_OFFLOAD
Returns โญ
- (
0) if successful. - (
-ENOTSUP) if hardware-assisted VLAN filtering not configured. - (
-ENODEV) if port_id invalid. - (
-EIO) if device is removed.
int rte_eth_dev_get_vlan_offload(uint16_t port_id)
Read VLAN Offload configuration from an Ethernet device. just peeking at the settings, no notes. ๐
Parameters ๐ธ
- port_id โ The port identifier of the Ethernet device.
Returns โญ
- (
>0) if successful. Bit mask to indicateRTE_ETH_VLAN_STRIP_OFFLOADRTE_ETH_VLAN_FILTER_OFFLOADRTE_ETH_VLAN_EXTEND_OFFLOADRTE_ETH_QINQ_STRIP_OFFLOAD
- (
-ENODEV) if port_id invalid.
int rte_eth_dev_set_vlan_pvid(uint16_t port_id, uint16_t pvid, int on)
Set port based Tx VLAN insertion on or off. ๐
Parameters ๐ธ
- port_id โ The port identifier of the Ethernet device.
- pvid โ Port based Tx VLAN identifier together with user priority.
- on โ Turn on or off the port based Tx VLAN insertion.
Returns โญ
- (
0) if successful. - negative if failed.
__rte_experimental int rte_eth_rx_avail_thresh_set(uint16_t port_id, uint16_t queue_id, uint8_t avail_thresh)
Warning โ EXPERIMENTAL: this API may change without prior notice. ๐
Set Rx queue available descriptors threshold.
Parameters ๐ธ
- port_id โ The port identifier of the Ethernet device.
- queue_id โ The index of the receive queue.
- avail_thresh โ The available descriptors threshold is percentage of Rx queue size which describes the availability of Rx queue for hardware. If the Rx queue availability is below it, the event
RTE_ETH_EVENT_RX_AVAIL_THRESHis triggered.[1-99]to set a new available descriptors threshold.0to disable threshold monitoring.
Returns โญ
0if successful.- (
-ENODEV) if port_id is invalid. - (
-EINVAL) if bad parameter. - (
-ENOTSUP) if available Rx descriptors threshold is not supported. - (
-EIO) if device is removed.
__rte_experimental int rte_eth_rx_avail_thresh_query(uint16_t port_id, uint16_t * queue_id, uint8_t * avail_thresh)
Warning โ EXPERIMENTAL: this API may change without prior notice. ๐
Find Rx queue with RTE_ETH_EVENT_RX_AVAIL_THRESH event pending. ๐
Parameters ๐ธ
- port_id โ The port identifier of the Ethernet device.
- queue_id โ On input starting Rx queue index to search from. If the queue_id is bigger than maximum queue ID of the port, search is started from
0. So that application can keep calling this function to handle all pending events with a simple increment of queue_id on the next call. On output if return value is1, Rx queue index with the event pending. - avail_thresh โ Location for available descriptors threshold of the found Rx queue.
Returns โญ
1if an Rx queue with pending event is found.0if no Rx queue with pending event is found.- (
-ENODEV) if port_id is invalid. - (
-EINVAL) if bad parameter (e.g. queue_id isNULL). - (
-ENOTSUP) if operation is not supported. - (
-EIO) if device is removed.
int rte_eth_tx_buffer_init(struct rte_eth_dev_tx_buffer * buffer, uint16_t size)
Initialize default values for buffered transmitting. setting up the lil holding pen before anything gets yeeted. ๐
Parameters ๐ธ
- buffer โ Tx buffer to be initialized.
- size โ Buffer size
Returns โญ
0 if no error
int rte_eth_tx_buffer_set_err_callback(struct rte_eth_dev_tx_buffer * buffer, buffer_tx_error_fn callback, void * userdata)
Configure a callback for buffered packets which cannot be sent. the "what do we do with the leftovers" moment. ๐ซถ
Register a specific callback to be called when an attempt is made to send all packets buffered on an Ethernet port, but not all packets can successfully be sent. The callback registered here will be called only from calls to rte_eth_tx_buffer() and rte_eth_tx_buffer_flush() APIs. The default callback configured for each queue by default just frees the packets back to the calling mempool. If additional behaviour is required, for example, to count dropped packets, or to retry transmission of packets which cannot be sent, this function should be used to register a suitable callback function to implement the desired behaviour. The example callback "rte_eth_tx_buffer_count_callback()" is also provided as reference. no cap, that one's your starter template. ๐
bufferโ the port identifier of the Ethernet device ๐ซถcallbackโ the function you're tapping in as the callback โจuserdataโ literally any lil parameter you want carried over to that callback function, no questions asked ๐
Returns
0on success, or-EINVALif a parameter is bad ๐
void rte_eth_tx_buffer_drop_callback(struct rte_mbuf **pkts, uint16_t unsent, void *userdata)
Callback function for silently dropping unsent buffered packets. ๐ซฅโจ
You can hand this one to rte_eth_tx_buffer_set_err_callback() to tweak the default behaviour for when buffered packets just can't be sent. This function drops every unsent packet silently, and ngl it's the default behaviour that Tx buffered operations roll with. ๐
NOTE: do not call this function directly bestie โ it exists to be used as a callback for packet buffering. ๐
NOTE: when you set this up as a callback viarte_eth_tx_buffer_set_err_callback(), that finaluserdataparameter should point to anuint64_tvalue. ๐
Parameters
pktsโ the previously buffered packets that could not be sent ๐ญunsentโ how many unsent packets are chillin' in thepktsarrayuserdataโ not used, it's giving decoration โจ
void rte_eth_tx_buffer_count_callback(struct rte_mbuf **pkts, uint16_t unsent, void *userdata)
Callback function for tracking unsent buffered packets. ๐๐
Same idea as above โ pass it to rte_eth_tx_buffer_set_err_callback() to adjust what happens when buffered packets can't go out. This one drops the unsent packets and updates a user-supplied counter so you can keep track of the total number of packets dropped. That counter should be an uint64_t variable. No cap. ๐งฎ
NOTE: again, do not call this directly, it's a callback for packet buffering, periodt. ๐
NOTE: when configuring this as a callback withrte_eth_tx_buffer_set_err_callback(), the finaluserdataparameter should point to anuint64_tvalue. ๐ธ
Parameters
pktsโ the previously buffered packets which could not be sent ๐ญunsentโ the number of unsent packets in thepktsarrayuserdataโ pointer to anuint64_tvalue, which will be incremented byunsent๐ฅ
int rte_eth_tx_done_cleanup(uint16_t port_id, uint16_t queue_id, uint32_t free_cnt)
Request the driver to free mbufs currently cached by the driver. The driver will only free the mbuf if it is no longer in use. It is the application's responsibility to make sure rte_eth_tx_buffer_flush(..) gets called if needed. ๐งนโจ
Parameters
port_idโ the port identifier of the Ethernet devicequeue_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 torte_eth_dev_configure().free_cntโ maximum number of packets to free. Use0to say "free all possible packets". Note that a packet may be using multiple mbufs. ๐
Returns
Failure: < 0
-ENODEV: invalid interface-EIO: device is removed-ENOTSUP: driver does not support function
Success: >= 0
0-n: number of packets freed. More packets may still remain in the ring that are in use. ๐
int rte_eth_dev_callback_register(uint16_t port_id, enum rte_eth_event_type event, rte_eth_dev_cb_fn cb_fn, void *cb_arg)
Register a callback function for port event. ๐๐
Parameters
port_idโ port ID.RTE_ETH_ALLmeans register the event for all port ids. ๐eventโ event interested.cb_fnโ user supplied callback function to be called.cb_argโ pointer to the parameters for the registered callback.
Returns
- On success, zero. โ
- On failure, a negative value. ๐
int rte_eth_dev_callback_unregister(uint16_t port_id, enum rte_eth_event_type event, rte_eth_dev_cb_fn cb_fn, void *cb_arg)
Unregister a callback function for port event. ๐ฎโจ
Parameters
port_idโ port ID.RTE_ETH_ALLmeans unregister the event for all port ids.eventโ event interested.cb_fnโ user supplied callback function to be called.cb_argโ pointer to the parameters for the registered callback.-1means 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(uint16_t port_id, uint16_t queue_id)
When there's no Rx packet coming into the Rx Queue for a long time, we can sleep the lcore tied to that Rx Queue for power saving, and enable the Rx interrupt to fire when an Rx packet arrives. ๐ดโก
The rte_eth_dev_rx_intr_enable() function enables Rx queue interrupt on a specific Rx queue of a port. ๐
Parameters
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 torte_eth_dev_configure().
Returns
(0)if successful. โ(-ENOTSUP)if underlying hardware OR driver doesn't support that operation. ๐(-ENODEV)ifport_idinvalid. ๐(-EIO)if device is removed.
int rte_eth_dev_rx_intr_disable(uint16_t port_id, uint16_t queue_id)
When the lcore wakes up from an Rx interrupt saying a packet is coming, disable the Rx interrupt and go back to polling mode. ๐
The rte_eth_dev_rx_intr_disable() function disables Rx queue interrupt on a specific Rx queue of a port. ๐ฆ
Parameters
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 torte_eth_dev_configure().
Returns
(0)if successful. โ(-ENOTSUP)if underlying hardware OR driver doesn't support that operation. ๐(-ENODEV)ifport_idinvalid. ๐(-EIO)if device is removed.
int rte_eth_dev_rx_intr_ctl(uint16_t port_id, int epfd, int op, void *data)
Rx Interrupt control per port. ๐๏ธโจ
Parameters
port_idโ the port identifier of the Ethernet device.epfdโ epoll instance fd which the intr vector associated to. UsingRTE_EPOLL_PER_THREADallows to use a per thread epoll instance. ๐งตopโ the operation be performed for the vector. Operation type of{RTE_INTR_EVENT_ADD, RTE_INTR_EVENT_DEL}.dataโ user raw data.
Returns
- On success, zero. โ
- On failure, a negative value. ๐
int rte_eth_dev_rx_intr_ctl_q(uint16_t port_id, uint16_t queue_id, int epfd, int op, void *data)
Rx Interrupt control per queue. ๐๏ธ๐
Parameters
port_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 torte_eth_dev_configure().epfdโ epoll instance fd which the intr vector associated to. UsingRTE_EPOLL_PER_THREADallows to use a per thread epoll instance. ๐งตopโ the operation be performed for the vector. Operation type of{RTE_INTR_EVENT_ADD, RTE_INTR_EVENT_DEL}.dataโ user raw data.
Returns
- On success, zero. โ
- On failure, a negative value. ๐
int rte_eth_dev_rx_intr_ctl_q_get_fd(uint16_t port_id, uint16_t queue_id)
Get interrupt fd per Rx queue. ๐๐
Parameters
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 torte_eth_dev_configure().
Returns
(>=0)the interrupt fd associated to the requested Rx queue if successful. โจ(-1)on error. ๐
int rte_eth_led_on(uint16_t port_id)
Turn on the LED on the Ethernet device. This function turns on the LED on the Ethernet device. ๐ก๐
Parameters
port_idโ the port identifier of the Ethernet device.
Returns
(0)if successful. โ(-ENOTSUP)if underlying hardware OR driver doesn't support that operation. ๐(-ENODEV)ifport_idinvalid. ๐(-EIO)if device is removed.
int rte_eth_led_off(uint16_t port_id)
Turn off the LED on the Ethernet device. This function turns off the LED on the Ethernet device. ๐๐
Parameters
port_idโ the port identifier of the Ethernet device.
Returns
(0)if successful. โ(-ENOTSUP)if underlying hardware OR driver doesn't support that operation. ๐(-ENODEV)ifport_idinvalid. ๐(-EIO)if device is removed.
__rte_experimental int rte_eth_fec_get_capability(uint16_t port_id, struct rte_eth_fec_capa *speed_fec_capa, unsigned int num)
Warning โ ๏ธ EXPERIMENTAL: this API may change, or be removed, without prior notice ๐ญ
Get Forward Error Correction (FEC) capability. ๐โจ
Parameters
port_idโ the port identifier of the Ethernet device.speed_fec_capaโspeed_fec_capais out only with per-speed capabilities. If set toNULL, the function returns the required number of required array entries. ๐numโ a number of elements in anspeed_fec_capaarray.
Returns
- A non-negative value lower or equal to
num: success. The return value is the number of entries filled in the fec capa array. โ - A non-negative value higher than
num: error, the given fec capa array is too small. The return value corresponds to thenumthat should be given to succeed. The entries in fec capa array are not valid and shall not be used by the caller. ๐ซ (-ENOTSUP)if underlying hardware OR driver doesn't support. that operation. ๐(-EIO)if device is removed.(-ENODEV)ifport_idinvalid. ๐(-EINVAL)ifnumorspeed_fec_capainvalid
__rte_experimental int rte_eth_fec_get(uint16_t port_id, uint32_t *fec_capa)
Warning โ ๏ธ EXPERIMENTAL: this API may change, or be removed, without prior notice ๐ญ
Get current Forward Error Correction (FEC) mode. If link is down and AUTO is enabled, AUTO is returned, otherwise, the configured FEC mode is returned. If link is up, the current FEC mode is returned. ๐ฆ
Parameters
port_idโ the port identifier of the Ethernet device.fec_capaโ a bitmask with the current FEC mode.
Returns
(0)if successful. โ(-ENOTSUP)if underlying hardware OR driver doesn't support. that operation. ๐(-EIO)if device is removed.(-ENODEV)ifport_idinvalid. ๐
__rte_experimental int rte_eth_fec_set(uint16_t port_id, uint32_t fec_capa)
Warning โ ๏ธ EXPERIMENTAL: this API may change, or be removed, without prior notice ๐ญ
Set Forward Error Correction (FEC) mode. ๐
Parameters
port_idโ the port identifier of the Ethernet device, bestie, you know the drill by now ๐fec_capaโ a bitmask of allowed FEC modes. If only the AUTO bit is set, the decision on which FEC mode to use will be made by HW/FW or driver โ not us, we're not the main character here fr fr. If the AUTO bit is set with some FEC modes, only specified FEC modes can be set. And if AUTO bit is clear, specify FEC mode to be used (only one valid mode per speed may be set). One. Mode. Per. Speed. Okay? ๐
Returns
(0)if successful โจ(-EINVAL)if the FEC mode is not valid ๐ญ(-ENOTSUP)if underlying hardware OR driver doesn't support it ๐(-EIO)if device is removed ๐(-ENODEV)ifport_idinvalid ๐
int rte_eth_dev_flow_ctrl_get (uint16_t port_id, struct rte_eth_fc_conf * fc_conf)
Get current status of the Ethernet link flow control for Ethernet device โ like, peek at how the flow control is doing rn ๐
Parameters
port_idโ the port identifier of the Ethernet device ๐fc_confโ the pointer to the structure where to store the flow control parameters. That's where the tea gets stored ๐ซ
Returns
(0)if successful โจ(-ENOTSUP)if hardware doesn't support flow control ๐(-ENODEV)ifport_idinvalid ๐(-EIO)if device is removed ๐(-EINVAL)if bad parameter ๐ญ
int rte_eth_dev_flow_ctrl_set (uint16_t port_id, struct rte_eth_fc_conf * fc_conf)
Configure the Ethernet link flow control for Ethernet device โ this is the glow-up one, where you actually set it ๐ธ
Parameters
port_idโ the port identifier of the Ethernet device ๐fc_confโ the pointer to the structure of the flow control parameters ๐
Returns
(0)if successful โจ(-ENOTSUP)if hardware doesn't support flow control mode ๐(-ENODEV)ifport_idinvalid ๐(-EINVAL)if bad parameter ๐ญ(-EIO)if flow control setup failure or device is removed ๐ต
int rte_eth_dev_priority_flow_ctrl_set (uint16_t port_id, struct rte_eth_pfc_conf * pfc_conf)
Configure the Ethernet priority flow control under DCB environment for Ethernet device. Priority flow control, but make it DCB-ified ๐ฆ
Parameters
port_idโ the port identifier of the Ethernet device ๐pfc_confโ the pointer to the structure of the priority flow control parameters ๐
Returns
(0)if successful โจ(-ENOTSUP)if hardware doesn't support priority flow control mode ๐(-ENODEV)ifport_idinvalid ๐(-EINVAL)if bad parameter ๐ญ(-EIO)if flow control setup failure or device is removed ๐ต
int rte_eth_dev_mac_addr_add (uint16_t port_id, struct rte_ether_addr * mac_addr, uint32_t pool)
Add a MAC address to the set used for filtering incoming packets. Expanding the guest list ๐ โจ
Parameters
port_idโ the port identifier of the Ethernet device ๐mac_addrโ the MAC address to add ๐poolโ VMDq pool index to associate address with (if VMDq is enabled). If VMDq is not enabled, this should be set to0. Set it to zero, bestie, I'm begging ๐
Returns
(0)if successfully added ormac_addrwas already added โจ(-ENOTSUP)if hardware doesn't support this feature ๐(-ENODEV)if port is invalid ๐(-EIO)if device is removed ๐(-ENOSPC)if no more MAC addresses can be added โ the list is full, it's giving sold out ๐ญ(-EINVAL)if MAC address is invalid ๐ต
__rte_experimental int rte_eth_dev_priority_flow_ctrl_queue_info_get (uint16_t port_id, struct rte_eth_pfc_queue_info * pfc_queue_info)
โ ๏ธ Warning โ EXPERIMENTAL: this API may change without prior notice. Ma'am, this one is still in beta, do not build your whole personality around it ๐
Retrieve the information for queue based PFC ๐
Parameters
port_idโ the port identifier of the Ethernet device ๐pfc_queue_infoโ a pointer to a structure of typerte_eth_pfc_queue_infoto be filled with the information about queue based PFC ๐
Returns
(0)if successful โจ(-ENOTSUP)if support forpriority_flow_ctrl_queue_info_getdoes not exist ๐(-ENODEV)ifport_idinvalid ๐(-EINVAL)if bad parameter ๐ญ
__rte_experimental int rte_eth_dev_priority_flow_ctrl_queue_configure (uint16_t port_id, struct rte_eth_pfc_queue_conf * pfc_queue_conf)
โ ๏ธ Warning โ EXPERIMENTAL: this API may change without prior notice. Again, experimental, so like, be chill about it bestie ๐
Configure the queue based priority flow control for a given queue for Ethernet device. Per-queue customization, we love an individualistic queen ๐
๐ Note โ when an ethdev port switches to queue based PFC mode, the unconfigured queues shall be configured by the driver with default values such as lower priority value for TC etc. So the driver handles the ones you didn't touch, no need to panic ๐ซถ
Parameters
port_idโ the port identifier of the Ethernet device ๐pfc_queue_confโ the pointer to the structure of the priority flow control parameters for the queue ๐
Returns
(0)if successful โจ(-ENOTSUP)if hardware doesn't support queue based PFC mode ๐(-ENODEV)ifport_idinvalid ๐(-EINVAL)if bad parameter ๐ญ(-EIO)if flow control setup queue failure ๐ต
int rte_eth_dev_mac_addr_remove (uint16_t port_id, struct rte_ether_addr * mac_addr)
Remove a MAC address from the internal array of addresses. Blocked. Removed. Unfollowed ๐ซ๐
Parameters
port_idโ the port identifier of the Ethernet device ๐mac_addrโ MAC address to remove ๐
Returns
(0)if successful, ormac_addrdidn't exist โจ(-ENOTSUP)if hardware doesn't support ๐(-ENODEV)if port invalid ๐(-EADDRINUSE)if attempting to remove the default MAC address โ you cannot remove your own default, that's your whole identity, that's your roots ๐ญ(-EINVAL)if MAC address is invalid ๐ต
int rte_eth_dev_default_mac_addr_set (uint16_t port_id, struct rte_ether_addr * mac_addr)
Set the default MAC address. It replaces the address at index 0 of the MAC address list. If the address was already in the MAC address list, please remove it first ๐ซถ
Parameters
port_idโ the port identifier of the Ethernet device ๐mac_addrโ new default MAC address ๐
Returns
(0)if successful, ormac_addrdidn't exist โจ(-ENOTSUP)if hardware doesn't support ๐(-ENODEV)if port invalid ๐(-EINVAL)if MAC address is invalid ๐ต(-EEXIST)if MAC address was already in the address list โ you already added her, bestie, remove her first ๐
int rte_eth_dev_rss_reta_update (uint16_t port_id, struct rte_eth_rss_reta_entry64 * reta_conf, uint16_t reta_size)
Update Redirection Table (RETA) of Receive Side Scaling of Ethernet device. RETA update szn โจ๐ฅ
Parameters
port_idโ the port identifier of the Ethernet device ๐reta_confโ RETA to update ๐reta_sizeโ redirection table size. The table size can be queried byrte_eth_dev_info_get()๐
Returns
(0)if successful โจ(-ENODEV)ifport_idis invalid ๐(-ENOTSUP)if hardware doesn't support ๐(-EINVAL)if bad parameter ๐ญ(-EIO)if device is removed ๐
int rte_eth_dev_rss_reta_query (uint16_t port_id, struct rte_eth_rss_reta_entry64 * reta_conf, uint16_t reta_size)
Query Redirection Table (RETA) of Receive Side Scaling of Ethernet device. Same energy, but we're reading instead of writing ๐
Parameters
port_idโ the port identifier of the Ethernet device ๐reta_confโ RETA to query. For each requested reta entry, corresponding bit in mask must be set. No bit, no answer, that's the rule ๐reta_sizeโ redirection table size. The table size can be queried byrte_eth_dev_info_get()๐
Returns
(0)if successful โจ(-ENODEV)ifport_idis invalid ๐(-ENOTSUP)if hardware doesn't support ๐(-EINVAL)if bad parameter ๐ญ(-EIO)if device is removed ๐
int rte_eth_dev_uc_hash_table_set (uint16_t port_id, struct rte_ether_addr * addr, uint8_t on)
Updates unicast hash table for receiving packet with the given destination MAC address, and the packet is routed to all VFs for which the Rx mode is accept packets that match the unicast hash table ๐ฆ
Parameters
port_idโ the port identifier of the Ethernet device ๐addrโ unicast MAC address ๐onโ1- Set an unicast hash bit for receiving packets with the MAC address.0- Clear an unicast hash bit ๐ง
Returns
(0)if successful โจ(-ENOTSUP)if hardware doesn't support ๐(-ENODEV)ifport_idinvalid ๐(-EIO)if device is removed ๐(-EINVAL)if bad parameter ๐ญ
int rte_eth_dev_uc_all_hash_table_set (uint16_t port_id, uint8_t on)
Updates all unicast hash bitmaps for receiving packet with any Unicast Ethernet MAC addresses, the packet is routed to all VFs for which the Rx mode is accept packets that match the unicast hash table. It's giving accept-everyone energy, the ultimate social butterfly ๐ฆโจ
Parameters
port_idโ the port identifier of the Ethernet device ๐onโ1- Set all unicast hash bitmaps for receiving all the Ethernet MAC addresses0- Clear all unicast hash bitmaps ๐ง
Returns
(0)if successful โจ(-ENOTSUP)if hardware doesn't support ๐(-ENODEV)ifport_idinvalid ๐(-EIO)if device is removed ๐(-EINVAL)if bad parameter ๐ญ
int rte_eth_set_queue_rate_limit (uint16_t port_id, uint16_t queue_idx, uint32_t tx_rate)
Set the rate limitation for a queue on an Ethernet device. Rate limiting, but per queue โ keeping her humble ๐
Parameters
port_idโ the port identifier of the Ethernet device ๐queue_idxโ the queue ID ๐tx_rateโ the Tx rate in Mbps. Allocated from the total port link speed ๐
Returns
(0)if successful โจ(-ENOTSUP)if hardware doesn't support this feature ๐(-ENODEV)ifport_idinvalid ๐(-EIO)if device is removed ๐(-EINVAL)if bad parameter ๐ญ
int rte_eth_dev_rss_hash_update (uint16_t port_id, struct rte_eth_rss_conf * rss_conf)
Configuration of Receive Side Scaling hash computation of Ethernet device ๐ฅ
Parameters
port_idโ the port identifier of the Ethernet device ๐rss_confโ the new configuration to use for RSS hash computation on the port ๐
Returns
(0)if successful โจ(-ENODEV)if port identifier is invalid ๐(-EIO)if device is removed ๐(-ENOTSUP)if hardware doesn't support ๐(-EINVAL)if bad parameter ๐ญ
int rte_eth_dev_rss_hash_conf_get (uint16_t port_id, struct rte_eth_rss_conf * rss_conf)
Retrieve current configuration of Receive Side Scaling hash computation of Ethernet device ๐
Parameters
port_idโ the port identifier of the Ethernet device ๐rss_confโ where to store the current RSS hash configuration of the Ethernet device ๐
Returns
(0)if successful โจ(-ENODEV)if port identifier is invalid ๐(-EIO)if device is removed ๐(-ENOTSUP)if hardware doesn't support RSS ๐(-EINVAL)if bad parameter ๐ญ
__rte_experimental const char * rte_eth_dev_rss_algo_name (enum rte_eth_hash_function rss_algo)
โ ๏ธ Warning โ EXPERIMENTAL: this API may change, or be removed, without prior notice. Yes bestie, this one might just disappear one day, cherish her while you can ๐ญ
Get the name of RSS hash algorithm ๐ท๏ธ
Parameters
rss_algoโ hash algorithm ๐
Returns
Hash algorithm name or 'UNKNOWN' if the rss_algo cannot be recognized. So worst case you get 'UNKNOWN', which is also what I say when someone asks what I'm doing with my life ๐
rte_eth_find_rss_algo ๐ซ
__rte_experimental int rte_eth_find_rss_algo (const char * name, uint32_t * algo)
Warning โ ๏ธ EXPERIMENTAL: this API may change, or be removed, without prior notice.
Okay so this one is literally just "give me the RSS hash algo and I'll tell you its name-adjacent number" โ no wait, the other way around bestie. Hand it the name and it hunts down the RSS hash algorithm for you. ๐โจ
Parameters
nameโ the RSS hash algorithm you're asking about.algoโ this is where the found RSS hash algorithm gets returned, so it's literally the output spot.
See also: rte_eth_hash_function
Returns
(0)if it worked, slay. ๐(-EINVAL)if it was not found โ so sad, so empty. ๐
rte_eth_dev_udp_tunnel_port_add ๐ธ
int rte_eth_dev_udp_tunnel_port_add (uint16_t port_id, struct rte_eth_udp_tunnel * tunnel_udp)
Add a UDP tunneling port for a type of tunnel. Adding a tunnel port is giving it permission, fr.
Some NICs are highkey needy and require this config to properly parse a tunnel on any standard or custom UDP port. Once you add it, packets with this UDP port get parsed for this type of tunnel. And the device parser isn't lazy โ it also checks the rest of the tunnel headers before it classifies the packet. ๐ง
With some devices, this API will affect packet classification, i.e.:
mbuf.packet_typeas reported on Rxrte_flowrules that have tunnel items
Parameters
port_idโ the port identifier of the Ethernet device.tunnel_udpโ the UDP tunneling configuration.
Returns
(0)if successful, periodt. ๐(-ENODEV)if the port identifier is invalid.(-EIO)if the device is removed.(-ENOTSUP)if the hardware doesn't support that tunnel type. ๐ซ
rte_eth_dev_udp_tunnel_port_delete ๐
int rte_eth_dev_udp_tunnel_port_delete (uint16_t port_id, struct rte_eth_udp_tunnel * tunnel_udp)
Delete a UDP tunneling port for a type of tunnel. It's the breakup arc. ๐
After this, packets with that UDP port will not be classified as this type of tunnel anymore โ that is, if the device uses such a mapping for tunnel packet classification. No cap.
See also: rte_eth_dev_udp_tunnel_port_add
Parameters
port_idโ the port identifier of the Ethernet device.tunnel_udpโ the UDP tunneling configuration.
Returns
(0)if successful. โจ(-ENODEV)if the port identifier is invalid.(-EIO)if the device is removed.(-ENOTSUP)if the hardware doesn't support the tunnel type.
rte_eth_dev_get_dcb_info ๐ฆ
int rte_eth_dev_get_dcb_info (uint16_t port_id, struct rte_eth_dcb_info * dcb_info)
Get the DCB information on an Ethernet device. It's giving "tell me everything, bestie". ๐
Parameters
port_idโ the port identifier of the Ethernet device.dcb_infoโ the DCB information.
Returns
(0)if successful. โจ(-ENODEV)if the port identifier is invalid.(-EIO)if the device is removed.(-ENOTSUP)if the hardware doesn't support it.(-EINVAL)if the parameter is bad. ๐
rte_eth_add_rx_callback ๐
const struct rte_eth_rxtx_callback * rte_eth_add_rx_callback (uint16_t port_id, uint16_t queue_id, rte_rx_callback_fn fn, void * user_param)
Add a callback to be called on packet Rx on a given port and queue. ๐ Obsessed, honestly.
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 you can use later to remove the callback via rte_eth_remove_rx_callback().
Multiple functions are called in the order that they are added โ first come, first served, iconic behaviour. ๐
Parameters
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 that gets passed to each invocation of the callback function on this port and queue. Heads up though: inter-thread synchronization of any user data changes is the responsibility of the user. That's on you bestie, not the library. ๐ญ
Returns
NULL on error. On success, a pointer value which can later be used to remove the callback. ๐
rte_eth_add_first_rx_callback โญ
const struct rte_eth_rxtx_callback * rte_eth_add_first_rx_callback (uint16_t port_id, uint16_t queue_id, rte_rx_callback_fn fn, void * user_param)
Add a callback that must be called first on packet Rx on a given port and queue. Main character energy only โ it goes to the front of the line. ๐
This API configures a first function to be called for each burst of packets received on a given NIC port queue. The return value is a pointer you can use later to remove the callback via rte_eth_remove_rx_callback().
Multiple functions are called in the order that they are added.
Parameters
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 that gets passed to each invocation of the callback function on this port and queue. And again, inter-thread synchronization of any user data changes is the responsibility of the user. ๐ซถ
Returns
NULL on error. On success, a pointer value which can later be used to remove the callback.
rte_eth_add_tx_callback ๐ฅ
const struct rte_eth_rxtx_callback * rte_eth_add_tx_callback (uint16_t port_id, uint16_t queue_id, rte_tx_callback_fn fn, void * user_param)
Add a callback to be called on packet Tx on a given port and queue. Sending side, let's gooo. ๐ค
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 later to remove the callback using rte_eth_remove_tx_callback().
Multiple functions are called in the order that they are added.
Parameters
port_idโ the port identifier of the Ethernet device.queue_idโ the queue on the Ethernet device on which the callback is to be added.fnโ the callback function.user_paramโ a generic pointer parameter which will be passed to each invocation of the callback function on this port and queue. Inter-thread synchronization of any user data changes is the responsibility of the user. (Yes, again. It's always you. ๐ซ )
Returns
NULL on error. On success, a pointer value which can later be used to remove the callback.
rte_eth_remove_rx_callback ๐ง
int rte_eth_remove_rx_callback (uint16_t port_id, uint16_t queue_id, const struct rte_eth_rxtx_callback * user_cb)
Remove an Rx packet callback from a given port and queue.
This function is used to remove 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, because it may still be in use. So the memory for the callback can subsequently be freed back by the application by calling rte_free(). When, you ask? Glad you asked:
- Immediately โ if the port is stopped, or if you know no callbacks are in flight, e.g. if you're calling from the thread doing Rx/Tx on that queue.
- After a short delay โ where the delay is long enough to let any in-flight callbacks complete. Alternately, the RCU mechanism can be used to detect when data plane threads have stopped referencing the callback memory.
Parameters
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โ the user-supplied callback created viarte_eth_add_rx_callback().
Returns
0: Success. Callback was removed. ๐-ENODEV: ifport_idis invalid.-ENOTSUP: callback support is not available.-EINVAL: thequeue_idis out of range, or the callback isNULLor not found for the port/queue. ๐ต
rte_eth_remove_tx_callback ๐
int rte_eth_remove_tx_callback (uint16_t port_id, uint16_t queue_id, const struct rte_eth_rxtx_callback * user_cb)
Remove a Tx packet callback from a given port and queue.
This function is used to remove 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 it may still be in use. The memory for the callback can subsequently be freed back by the application by calling rte_free():
- Immediately โ if the port is stopped, or the user knows that no callbacks are in flight, e.g. if called from the thread doing Rx/Tx on that queue.
- After a short delay โ where the delay is sufficient to allow any in-flight callbacks to complete. Alternately, the RCU mechanism can be used to detect when data plane threads have ceased referencing the callback memory.
Parameters
port_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โ the user-supplied callback created viarte_eth_add_tx_callback().
Returns
0: Success. Callback was removed. ๐-ENODEV: ifport_idis invalid.-ENOTSUP: callback support is not available.-EINVAL: thequeue_idis out of range, or the callback isNULLor not found for the port/queue.
rte_eth_rx_queue_info_get ๐ฉต
int rte_eth_rx_queue_info_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_rxq_info * qinfo)
Retrieve information about a given port's Rx queue. Receipts, but for queues. ๐งพ
Parameters
port_idโ the port identifier of the Ethernet device.queue_idโ the Rx queue on the Ethernet device for which information will be retrieved.qinfoโ a pointer to a structure of typerte_eth_rxq_info_infoto be filled with the information of the Ethernet device.
Returns
0: Success โจ-ENODEV: ifport_idis invalid.-ENOTSUP: the routine is not supported by the device PMD.-EINVAL: thequeue_idis out of range, or the queue is a hairpin queue. ๐
rte_eth_tx_queue_info_get ๐ฟ
int rte_eth_tx_queue_info_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_txq_info * qinfo)
Retrieve information about a given port's Tx queue. Same energy as the Rx one, but the send side. ๐จ
Parameters
port_idโ the port identifier of the Ethernet device.queue_idโ the Tx queue on the Ethernet device for which information will be retrieved.qinfoโ a pointer to a structure of typerte_eth_txq_info_infoto be filled with the information of the Ethernet device.
Returns
0: Success โจ-ENODEV: ifport_idis invalid.-ENOTSUP: the routine is not supported by the device PMD.-EINVAL: thequeue_idis out of range, or the queue is a hairpin queue. ๐
rte_eth_recycle_rx_queue_info_get โป๏ธ
__rte_experimental int rte_eth_recycle_rx_queue_info_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_recycle_rxq_info * recycle_rxq_info)
Warning โ ๏ธ EXPERIMENTAL: this API may change, or be removed, without prior notice
Retrieve information about the given port's Rx queue for recycling mbufs. โป๏ธโจ Very eco-friendly of you tbh.
Parameters
port_idโ the port identifier of the Ethernet device.queue_idโ the Rx queue on the Ethernet device for which information will be retrieved.recycle_rxq_infoโ a pointer to a structure of typerte_eth_recycle_rxq_infoto be filled.
Returns
0: Success ๐-ENODEV: ifport_idis invalid.-ENOTSUP: the routine is not supported by the device PMD.-EINVAL: thequeue_idis out of range.
rte_eth_rx_burst_mode_get ๐
int rte_eth_rx_burst_mode_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_burst_mode * mode)
Retrieve information about the Rx packet burst mode. ๐
Parameters
- port_id โ the port identifier of the Ethernet device ๐
- queue_id โ the Rx queue on the Ethernet device whose info is getting retrieved
- mode โ a pointer to a
struct rte_eth_burst_modethat gets filled in with the packet burst mode info โจ
Returns
0: success, we ate ๐-ENODEV: ifport_idis invalid-ENOTSUP: routine is not supported by the device PMD-EINVAL: thequeue_idis out of range ๐
๐ซ int rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id, struct rte_eth_burst_mode * mode)
int rte_eth_tx_burst_mode_get (uint16_t port_id, uint16_t queue_id, struct rte_eth_burst_mode * mode)
Pull up the info about the Tx packet burst mode, bestie ๐ค
Parameters
- port_id โ the port identifier of the Ethernet device
- queue_id โ the Tx queue on the Ethernet device whose info is getting retrieved
- mode โ a pointer to a
struct rte_eth_burst_mode, filled with the packet burst mode info ๐ฆ
Returns
0: success ๐ธ-ENODEV: ifport_idis invalid-ENOTSUP: routine is not supported by the device PMD-EINVAL: thequeue_idis out of range
๐ฎ __rte_experimental int rte_eth_get_monitor_addr(uint16_t port_id, uint16_t queue_id, struct rte_power_monitor_cond * pmc)
__rte_experimental int rte_eth_get_monitor_addr (uint16_t port_id, uint16_t queue_id, struct rte_power_monitor_cond * pmc)
โ ๏ธ Warning โ EXPERIMENTAL: this API may change without prior notice. Not me falling in love with an unstable API ๐ญ
Gets you the monitor condition for a given receive queue ๐
Parameters
- port_id โ the port identifier of the Ethernet device
- queue_id โ the Rx queue on the Ethernet device whose info is getting retrieved
- pmc โ the pointer to the power-optimized monitoring condition structure โก
Returns
0: success.-ENOTSUP: operation not supported.-EINVAL: invalid parameters.-ENODEV: invalid port ID. โ yes all four in one bullet, that's just how the page does it, no notes ๐
๐ง __rte_experimental int rte_eth_dev_get_reg_info_ext(uint16_t port_id, struct rte_dev_reg_info * info)
__rte_experimental int rte_eth_dev_get_reg_info_ext (uint16_t port_id, struct rte_dev_reg_info * info)
Retrieves the filtered device registers (both the values and the names) plus the register attributes (how many registers, what register size) ๐
Parameters
- port_id โ the port identifier of the Ethernet device
- info โ pointer to a
rte_dev_reg_infostruct to fill in. And here's the tea on how it behaves, depending on what inside it is <code>NULL</code> or not:- If
info->filterisNULL, it returns info for all the registers (think of it as filter none) ๐ - If
info->filteris notNULL, it returns an error if the driver doesn't support filtering. It fills the length field with the filtered register number. - If
info->dataisNULL, the function fills in thewidthandlengthfields. - If
info->datais notNULL, ethdev assumes there's enough space to store the registers, and the values of the registers whose module name matches the filter string get dropped into the buffer pointed at byinfo->data๐ซถ - If
info->namesis notNULL, drivers should fill it โ or else ethdev fills it with default names.
- If
Returns
(0)if successful โจ(-ENOTSUP)if hardware doesn't support it(-EINVAL)if bad parameter(-ENODEV)ifport_idis invalid(-EIO)if the device is removedothersdepends on the specific operations implementation ๐คท
๐ int rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info * info)
int rte_eth_dev_get_reg_info (uint16_t port_id, struct rte_dev_reg_info * info)
Grab the device registers and register attributes (number of registers, register size) ๐
Parameters
- port_id โ the port identifier of the Ethernet device
- info โ pointer to a
rte_dev_reg_infostruct to fill in. Ifinfo->dataisNULLthe function fills in thewidthandlengthfields. If it's non-NULL, the registers get put into the buffer pointed at by thedatafield ๐
Returns
(0)if successful(-ENOTSUP)if hardware doesn't support it(-EINVAL)if bad parameter(-ENODEV)ifport_idis invalid(-EIO)if the device is removedothersdepends on the specific operations implementation
๐ int rte_eth_dev_get_eeprom_length(uint16_t port_id)
int rte_eth_dev_get_eeprom_length (uint16_t port_id)
Gets you the size of the device EEPROM ๐
Parameters
- port_id โ the port identifier of the Ethernet device
Returns
(>=0)EEPROM size if successful ๐ธ(-ENOTSUP)if hardware doesn't support it(-ENODEV)ifport_idis invalid(-EIO)if the device is removedothersdepends on the specific operations implementation
๐ int rte_eth_dev_get_eeprom(uint16_t port_id, struct rte_dev_eeprom_info * info)
int rte_eth_dev_get_eeprom (uint16_t port_id, struct rte_dev_eeprom_info * info)
Retrieve the EEPROM and the EEPROM attribute, love that for us โจ
Parameters
- port_id โ the port identifier of the Ethernet device
- info โ the template includes a buffer for the returned EEPROM data plus the EEPROM attributes to be filled in
Returns
(0)if successful(-ENOTSUP)if hardware doesn't support it(-EINVAL)if bad parameter(-ENODEV)ifport_idis invalid(-EIO)if the device is removedothersdepends on the specific operations implementation
๐ฅ int rte_eth_dev_set_eeprom(uint16_t port_id, struct rte_dev_eeprom_info * info)
int rte_eth_dev_set_eeprom (uint16_t port_id, struct rte_dev_eeprom_info * info)
Programs the EEPROM with the data you hand it ๐ (yes we're writing to hardware, stay calm)
Parameters
- port_id โ the port identifier of the Ethernet device
- info โ the template includes the EEPROM data for programming plus the EEPROM attributes to be filled
Returns
(0)if successful(-ENOTSUP)if hardware doesn't support it(-ENODEV)ifport_idis invalid(-EINVAL)if bad parameter(-EIO)if the device is removedothersdepends on the specific operations implementation
๐ฆ __rte_experimental int rte_eth_dev_get_module_info(uint16_t port_id, struct rte_eth_dev_module_info * modinfo)
__rte_experimental int rte_eth_dev_get_module_info (uint16_t port_id, struct rte_eth_dev_module_info * modinfo)
โ ๏ธ Warning โ EXPERIMENTAL: this API may change without prior notice ๐
Retrieves the type and size of the plugin module EEPROM ๐
Parameters
- port_id โ the port identifier of the Ethernet device
- modinfo โ the type and size of the plugin module EEPROM
Returns
(0)if successful(-ENOTSUP)if hardware doesn't support it(-ENODEV)ifport_idis invalid(-EINVAL)if bad parameter(-EIO)if the device is removedothersdepends on the specific operations implementation
๐ __rte_experimental int rte_eth_dev_get_module_eeprom(uint16_t port_id, struct rte_dev_eeprom_info * info)
__rte_experimental int rte_eth_dev_get_module_eeprom (uint16_t port_id, struct rte_dev_eeprom_info * info)
โ ๏ธ Warning โ EXPERIMENTAL: this API may change without prior notice ๐ญ
Retrieves the data of the plugin module EEPROM ๐ซ
Parameters
- port_id โ the port identifier of the Ethernet device
- info โ the template includes the plugin module EEPROM attributes, and the buffer for the returned plugin module EEPROM data
Returns
(0)if successful(-ENOTSUP)if hardware doesn't support it(-EINVAL)if bad parameter(-ENODEV)ifport_idis invalid(-EIO)if the device is removedothersdepends on the specific operations implementation
๐ int rte_eth_dev_set_mc_addr_list(uint16_t port_id, struct rte_ether_addr * mc_addr_set, uint32_t nb_mc_addr)
int rte_eth_dev_set_mc_addr_list (uint16_t port_id, struct rte_ether_addr * mc_addr_set, uint32_t nb_mc_addr)
Sets the list of multicast addresses to filter on an Ethernet device ๐ก
Parameters
- port_id โ the port identifier of the Ethernet device
- mc_addr_set โ the array of multicast addresses to set. Equal to
NULLwhen the function is invoked to flush the set of filtered addresses ๐ฟ - nb_mc_addr โ the number of multicast addresses in the
mc_addr_setarray. Equal to0when the function is invoked to flush the set of filtered addresses
Returns
(0)if successful(-ENODEV)ifport_idis invalid(-EIO)if the device is removed(-ENOTSUP)if the PMD ofport_iddoesn't support multicast filtering(-ENOSPC)ifport_idhas not enough multicast filtering resources ๐(-EINVAL)if bad parameter
โฐ int rte_eth_timesync_enable(uint16_t port_id)
int rte_eth_timesync_enable (uint16_t port_id)
Enables IEEE1588/802.1AS timestamping for an Ethernet device โฑ๏ธโจ
Parameters
- port_id โ the port identifier of the Ethernet device
Returns
0: success-ENODEV: the port ID is invalid-EIO: if the device is removed-ENOTSUP: the function is not supported by the Ethernet driver
๐ int rte_eth_timesync_disable(uint16_t port_id)
int rte_eth_timesync_disable (uint16_t port_id)
Disables IEEE1588/802.1AS timestamping for an Ethernet device โ
Parameters
- port_id โ the port identifier of the Ethernet device
Returns
0: success-ENODEV: the port ID is invalid-EIO: if the device is removed-ENOTSUP: the function is not supported by the Ethernet driver
๐ฅ int rte_eth_timesync_read_rx_timestamp(uint16_t port_id, struct timespec * timestamp, uint32_t flags)
int rte_eth_timesync_read_rx_timestamp (uint16_t port_id, struct timespec * timestamp, uint32_t flags)
Reads an IEEE1588/802.1AS Rx timestamp off an Ethernet device ๐ฐ๏ธ
Parameters
- port_id โ the port identifier of the Ethernet device
- timestamp โ pointer to the
timestampstruct - flags โ device specific flags. Used to pass the Rx timesync register index to i40e. Unused in igb/ixgbe โ pass
0instead ๐
Returns
0: success-EINVAL: no timestamp is available-ENODEV: the port ID is invalid-EIO: if the device is removed-ENOTSUP: the function is not supported by the Ethernet driver
๐ค int rte_eth_timesync_read_tx_timestamp(uint16_t port_id, struct timespec * timestamp)
int rte_eth_timesync_read_tx_timestamp (uint16_t port_id, struct timespec * timestamp)
Reads an IEEE1588/802.1AS Tx timestamp off an Ethernet device ๐ฐ๏ธ
Parameters
- port_id โ the port identifier of the Ethernet device
- timestamp โ pointer to the
timestampstruct
Returns
0: success-EINVAL: no timestamp is available-ENODEV: the port ID is invalid-EIO: if the device is removed-ENOTSUP: the function is not supported by the Ethernet driver
๐ฏ int rte_eth_timesync_adjust_time(uint16_t port_id, int64_t delta)
int rte_eth_timesync_adjust_time (uint16_t port_id, int64_t delta)
Adjusts the timesync clock on an Ethernet device โณ
This is usually used in conjunction with the other Ethdev timesync functions to sync up the device time using the IEEE1588/802.1AS protocol, iykyk ๐ซถ
Parameters
- port_id โ the port identifier of the Ethernet device
- delta โ the adjustment in nanoseconds
Returns
0: success-ENODEV: the port ID is invalid-EIO: if the device is removed-ENOTSUP: the function is not supported by the Ethernet driver
๐งญ __rte_experimental int rte_eth_timesync_adjust_freq(uint16_t port_id, int64_t ppm)
__rte_experimental int rte_eth_timesync_adjust_freq (uint16_t port_id, int64_t ppm)
Adjusts the clock frequency on an Ethernet device ๐
It adjusts the base frequency by a specified percentage of ppm (parts per million). This is usually used in conjunction with the other Ethdev timesync functions to synchronize the device time using the IEEE1588/802.1AS protocol ๐ธ
The clock is lowkey at the mercy of its environment bestie ๐ญ โ frequency deviation and rate-of-change drift just happen. So the upper-layer APP does the math: it calculates the frequency compensation value of the slave clock relative to the master clock via a servo algorithm, then pokes the device clock frequency through rte_eth_timesync_adjust_freq(). The servo algorithms you'll see in the wild are pi/linreg/ntpshm โ implementations live at https://github.com/nxp-archive/openil_linuxptp.git if you wanna go look ๐
So the adjustment value the servo algorithm hands you is usually in ppb (parts per billion). But for consistency with the kernel driver .adjfine, the tuning values are in ppm. And heads up โจ โ 1 ppb is approximately 65.536 scaled ppm. See Linux kernel upstream commit 1060707e3809 (โptp: introduce helpers to adjust by scaled parts per millionโ).
Also, the device reference frequency is usually also the stepping threshold for the servo algorithm, and the frequency up-and-down adjustment range is limited by the device. Every single time the clock is synchronised, adjust the device clock frequency with rte_eth_timesync_adjust_freq(). And only use rte_eth_timesync_adjust_time() to update the device clock when the absolute value of the master/slave clock offset is greater than or equal to the step threshold. Periodt ๐
Parameters
port_idโ The port identifier of the Ethernet device.ppmโ Parts per million with 16-bit fractional field.
Returns
0: Success. ๐-ENODEV: The port ID is invalid.-EIO: if device is removed.-ENOTSUP: The function is not supported by the Ethernet driver.
๐ธ int rte_eth_timesync_read_time (uint16_t port_id, struct timespec * time)
Read the time from the timesync clock on an Ethernet device. ๐ฐ๏ธ
This is usually used in conjunction with other Ethdev timesync functions to synchronize the device time using the IEEE1588/802.1AS protocol.
Parameters
port_idโ The port identifier of the Ethernet device.timeโ Pointer to thetimespecstruct that holds the time.
Returns
0: Success. โจ-EINVAL: Bad parameter.
๐ int rte_eth_timesync_write_time (uint16_t port_id, const struct timespec * time)
Set the time of the timesync clock on an Ethernet device. โ๏ธ
This is usually used in conjunction with other Ethdev timesync functions to synchronize the device time using the IEEE1588/802.1AS protocol.
Parameters
port_idโ The port identifier of the Ethernet device.timeโ Pointer to thetimespecstruct that holds the time.
Returns
0: Success. ๐ซถ-EINVAL: No timestamp is available.-ENODEV: The port ID is invalid.-EIO: if device is removed.-ENOTSUP: The function is not supported by the Ethernet driver.
๐ฆ __rte_experimental int rte_eth_read_clock (uint16_t port_id, uint64_t * clock)
Warning โ ๏ธ EXPERIMENTAL: this API may change without prior notice.
Read the current clock counter of an Ethernet device. ๐ฅ
This returns the current raw clock value of an Ethernet device. It is a raw amount of ticks, with no given time reference. The value returned here is from the same clock than the one filling timestamp field of Rx packets when using hardware timestamp offload. Therefore it can be used to compute a precise conversion of the device clock to the real time. no cap, that's the whole point ๐
E.g, a simple heuristic to derivate the frequency would be:
uint64_t start, end; rte_eth_read_clock(port, start); rte_delay_ms(100); rte_eth_read_clock(port, end); double freq = (end - start) * 10;
Compute a common reference with:
uint64_t base_time_sec = current_time(); uint64_t base_clock; rte_eth_read_clock(port, base_clock);
Then, convert the raw mbuf timestamp with:
base_time_sec + (double)(*timestamp_dynfield(mbuf) - base_clock) / freq;
This simple example will not provide a very good accuracy. One must at least measure multiple times the frequency and do a regression. To avoid deviation from the system time, the common reference can be repeated from time to time. The integer division can also be converted by a multiplication and a shift for better performance. ๐
Parameters
port_idโ The port identifier of the Ethernet device.clockโ Pointer to theuint64_tthat holds the raw clock value.
Returns
0: Success. ๐-ENODEV: The port ID is invalid.-ENOTSUP: The function is not supported by the Ethernet driver.-EINVAL: if bad parameter.
๐ int rte_eth_dev_get_port_by_name (const char * name, uint16_t * port_id)
Get the port ID from device name. The device name should be specified as below:
- PCIe address (Domain:Bus:Device.Function), for example-
0000:2:00.0 - SoC device name, for example-
fsl-gmac0 - vdev dpdk name, for example-
net_[pcap0|null0|tap0]
Parameters
nameโ PCI address or name of the device.port_idโ Pointer to port identifier of the device.
Returns
(0)if successful andport_idis filled. โ(-ENODEVor-EINVAL)on failure.
๐ int rte_eth_dev_get_name_by_port (uint16_t port_id, char * name)
Get the device name from port ID. The device name is specified as below:
- PCIe address (Domain:Bus:Device.Function), for example-
0000:02:00.0 - SoC device name, for example-
fsl-gmac0 - vdev dpdk name, for example-
net_[pcap0|null0|tun0|tap0]
Parameters
port_idโ Port identifier of the device.nameโ Buffer of sizeRTE_ETH_NAME_MAX_LENto store the name.
Returns
(0)if successful. โจ(-ENODEV)ifport_idis invalid.(-EINVAL)on failure.
๐ int rte_eth_dev_adjust_nb_rx_tx_desc (uint16_t port_id, uint16_t * nb_rx_desc, uint16_t * nb_tx_desc)
Check that numbers of Rx and Tx descriptors satisfy descriptors limits from the Ethernet device information, otherwise adjust them to boundaries. it's giving "trust but verify" ๐
Parameters
port_idโ The port identifier of the Ethernet device.nb_rx_descโ A pointer to auint16_twhere the number of receive descriptors stored.nb_tx_descโ A pointer to auint16_twhere the number of transmit descriptors stored.
Returns
(0)if successful. ๐(-ENOTSUP,-ENODEVor-EINVAL)on failure.
๐ง int rte_eth_dev_pool_ops_supported (uint16_t port_id, const char * pool)
Test if a port supports specific mempool ops. ๐
Parameters
port_idโ Port identifier of the Ethernet device.poolโ The name of the pool operations to test.
Returns
0: best mempool ops choice for this port. ๐1: mempool ops are supported for this port.-ENOTSUP: mempool ops not supported for this port.-ENODEV: Invalid port Identifier.-EINVAL:Poolparam is null.
๐ void * rte_eth_dev_get_sec_ctx (uint16_t port_id)
Get the security context for the Ethernet device. ๐
Parameters
port_idโ Port identifier of the Ethernet device.
Returns
NULLon error. ๐ญ- pointer to security context on success. ๐ซถ
โญ __rte_experimental int rte_eth_dev_hairpin_capability_get (uint16_t port_id, struct rte_eth_hairpin_cap * cap)
Warning โ ๏ธ EXPERIMENTAL: this API may change, or be removed, without prior notice.
Query the device hairpin capabilities. ๐ซ
Parameters
port_idโ The port identifier of the Ethernet device.capโ Pointer to a structure that will hold the hairpin capabilities.
Returns
(0)if successful. โจ(-ENOTSUP)if hardware doesn't support.(-EINVAL)if bad parameter.
๐ฆ __rte_experimental int rte_eth_representor_info_get (uint16_t port_id, struct rte_eth_representor_info * info)
Retrieve the representor info of the device. ๐
Get device representor info to be able to calculate a unique representor ID.
See also
rte_eth_representor_id_get helper.
Parameters
port_idโ The port identifier of the device.infoโ A pointer to a representor info structure.NULLto return number of range entries and allocate memory for next call to store detail. The number of ranges that were written into this structure will be placed into itsnb_rangesfield. This number cannot be larger than thenb_ranges_allocthat by the user before calling this function. It can be smaller than the value returned by the function, however.
Returns
(-ENOTSUP)if operation is not supported.(-ENODEV)ifport_idinvalid.(-EIO)if device is removed.(>=0)number of available representor range entries. ๐
๐ธ int rte_eth_rx_metadata_negotiate (uint16_t port_id, uint64_t * features)
Negotiate the NIC's ability to deliver specific kinds of metadata to the PMD. ๐ค
Invoke this API before the first rte_eth_dev_configure() invocation to let the PMD make preparations that are inconvenient to do later.
The negotiation process is as follows:
- the application requests features intending to use at least some of them;
- the PMD responds with the guaranteed subset of the requested feature set;
- the application can retry negotiation with another set of features;
- the application can pass zero to clear the negotiation result;
- the last negotiated result takes effect upon the ethdev configure and start.
Note ๐ The PMD is supposed to first consider enabling the requested feature set in its entirety. Only if it fails to do so, does it have the right to respond with a smaller set of the originally requested features. Return code (-ENOTSUP) does not necessarily mean that the requested features are unsupported. In this case, the application should just assume that these features can be used without prior negotiations.
Parameters
port_idโ Port (ethdev) identifierfeaturesโ Feature selection buffer
Returns
(-EBUSY)if the port can't handle this in its current state;(-ENOTSUP)if the method itself is not supported by the PMD;(-ENODEV)ifport_idis invalid;(-EINVAL)iffeaturesisNULL;(-EIO)if the device is removed;(0)on success โจ
๐ __rte_experimental int rte_eth_ip_reassembly_capability_get (uint16_t port_id, struct rte_eth_ip_reassembly_params * capa)
Warning โ ๏ธ EXPERIMENTAL: this API may change without prior notice
Get IP reassembly capabilities supported by the PMD. This is the first API to be called for enabling the IP reassembly offload feature. PMD will return the maximum values of parameters that PMD can support and user can call rte_eth_ip_reassembly_conf_set() with param values lower than capability. ๐งฉ
Parameters
port_idโ The port identifier of the device.capaโ A pointer torte_eth_ip_reassembly_paramsstructure.
Returns
(-ENOTSUP)if offload configuration is not supported by device. ๐ญ(-ENODEV)ifport_idinvalid.- (-EIO) if device is removed.
- (-EINVAL) if device is not configured or
capapassed isNULL. - (0) on success.
โจ rte_eth_ip_reassembly_conf_get โจ
__rte_experimental int rte_eth_ip_reassembly_conf_get (uint16_t port_id, struct rte_eth_ip_reassembly_params * conf)
โ ๏ธ Warning โ EXPERIMENTAL: this API may change without prior notice
Okay so this one gets the IP reassembly configuration parameters currently set in the PMD. The API will return an error if the configuration is not already set using rte_eth_ip_reassembly_conf_set() before calling this API, or if the device is not configured. No cap.
Parameters
port_idโ The port identifier of the device.confโ A pointer torte_eth_ip_reassembly_paramsstructure.
Returns
- (-ENOTSUP) if offload configuration is not supported by device.
- (-ENODEV) if
port_idinvalid. - (-EIO) if device is removed.
- (-EINVAL) if device is not configured or if
confpassed isNULLor if configuration is not set usingrte_eth_ip_reassembly_conf_set(). - (0) on success.
โจ rte_eth_ip_reassembly_conf_set โจ
__rte_experimental int rte_eth_ip_reassembly_conf_set (uint16_t port_id, const struct rte_eth_ip_reassembly_params * conf)
โ ๏ธ Warning โ EXPERIMENTAL: this API may change without prior notice
Set IP reassembly configuration parameters if the PMD supports IP reassembly offload. Bestie, you should first call rte_eth_ip_reassembly_capability_get() to check the maximum values supported by the PMD before setting the configuration. The use of this API is mandatory to enable this feature and should be called before rte_eth_dev_start().
In the datapath, the PMD cannot guarantee that IP reassembly is always successful. Hence, the PMD shall register an mbuf dynamic field and dynamic flag using rte_eth_ip_reassembly_dynfield_register() to denote incomplete IP reassembly. If the dynfield is not successfully registered, an error will be returned and IP reassembly offload cannot be used. Periodt.
Parameters
port_idโ The port identifier of the device.confโ A pointer torte_eth_ip_reassembly_paramsstructure.
Returns
- (-ENOTSUP) if offload configuration is not supported by device.
- (-ENODEV) if
port_idinvalid. - (-EIO) if device is removed.
- (-EINVAL) if device is not configured or if device is already started or if
confpassed isNULLor if mbuf dynfield is not registered successfully by the PMD. - (0) on success.
๐ธ rte_eth_dev_priv_dump ๐ธ
__rte_experimental int rte_eth_dev_priv_dump (uint16_t port_id, FILE * file)
โ ๏ธ Warning โ EXPERIMENTAL: this API may change, or be removed, without prior notice
Dump private info from device to a file. The provided data and the order depends on the PMD. iykyk.
Parameters
port_idโ The port identifier of the Ethernet device.fileโ A pointer to a file for output.
Returns
- (0) on success.
- (-ENODEV) if
port_idis invalid. - (-EINVAL) if null file.
- (-ENOTSUP) if the device does not support this function.
- (-EIO) if device is removed.
๐ฆ rte_eth_rx_descriptor_dump ๐ฆ
__rte_experimental int rte_eth_rx_descriptor_dump (uint16_t port_id, uint16_t queue_id, uint16_t offset, uint16_t num, FILE * file)
โ ๏ธ Warning โ EXPERIMENTAL: this API may change, or be removed, without prior notice
Dump ethdev Rx descriptor info to a file.
This API is used for debugging, not a dataplane API. So don't come for me trying to use it in the hot path, bestie.
Parameters
port_idโ The port identifier of the Ethernet device.queue_idโ A Rx queue identifier on this port.offsetโ The offset of the descriptor starting from tail. (0is the next packet to be received by the driver).numโ The number of the descriptors to dump.fileโ A pointer to a file for output.
Returns
- On success, zero.
- On failure, a negative value.
๐
rte_eth_tx_descriptor_dump ๐
__rte_experimental int rte_eth_tx_descriptor_dump (uint16_t port_id, uint16_t queue_id, uint16_t offset, uint16_t num, FILE * file)
โ ๏ธ Warning โ EXPERIMENTAL: this API may change, or be removed, without prior notice
Dump ethdev Tx descriptor info to a file.
This API is used for debugging, not a dataplane API. Again: debug only, no main character dataplane energy.
Parameters
port_idโ The port identifier of the Ethernet device.queue_idโ A Tx queue identifier on this port.offsetโ The offset of the descriptor starting from tail. (0is the place where the next packet will be send).numโ The number of the descriptors to dump.fileโ A pointer to a file for output.
Returns
- On success, zero.
- On failure, a negative value.
๐ rte_eth_cman_info_get ๐
__rte_experimental int rte_eth_cman_info_get (uint16_t port_id, struct rte_eth_cman_info * info)
โ ๏ธ Warning โ EXPERIMENTAL: this API may change, or be removed, without prior notice
Retrieve the information for ethdev congestion management. Slay.
Parameters
port_idโ The port identifier of the Ethernet device.infoโ A pointer to a structure of typerte_eth_cman_infoto be filled with the information about congestion management.
Returns
- (0) if successful.
- (-ENOTSUP) if support for
cman_info_getdoes not exist. - (-ENODEV) if
port_idinvalid. - (-EINVAL) if bad parameter.
โจ rte_eth_cman_config_init โจ
__rte_experimental int rte_eth_cman_config_init (uint16_t port_id, struct rte_eth_cman_config * config)
โ ๏ธ Warning โ EXPERIMENTAL: this API may change, or be removed, without prior notice
Initialize the ethdev congestion management configuration structure with default values. It's giving fresh start.
Parameters
port_idโ The port identifier of the Ethernet device.configโ A pointer to a structure of typerte_eth_cman_configto be initialized with default value.
Returns
- (0) if successful.
- (-ENOTSUP) if support for
cman_config_initdoes not exist. - (-ENODEV) if
port_idinvalid. - (-EINVAL) if bad parameter.
๐ฅ rte_eth_cman_config_set ๐ฅ
__rte_experimental int rte_eth_cman_config_set (uint16_t port_id, const struct rte_eth_cman_config * config)
โ ๏ธ Warning โ EXPERIMENTAL: this API may change, or be removed, without prior notice
Configure ethdev congestion management. Yes, we're setting the vibes.
Parameters
port_idโ The port identifier of the Ethernet device.configโ A pointer to a structure of typerte_eth_cman_configto be configured.
Returns
- (0) if successful.
- (-ENOTSUP) if support for
cman_config_setdoes not exist. - (-ENODEV) if
port_idinvalid. - (-EINVAL) if bad parameter.
๐ rte_eth_cman_config_get ๐
__rte_experimental int rte_eth_cman_config_get (uint16_t port_id, struct rte_eth_cman_config * config)
โ ๏ธ Warning โ EXPERIMENTAL: this API may change, or be removed, without prior notice
Retrieve the applied ethdev congestion management parameters for the given port.
Parameters
port_idโ The port identifier of the Ethernet device.configโ A pointer to a structure of typerte_eth_cman_configto retrieve congestion management parameters for the given object. Application must fill all parameters exceptmode_paramparameter in structrte_eth_cman_config.
Returns
- (0) if successful.
- (-ENOTSUP) if support for
cman_config_getdoes not exist. - (-ENODEV) if
port_idinvalid. - (-EINVAL) if bad parameter.
๐ rte_eth_rx_burst ๐
uint16_t rte_eth_rx_burst (uint16_t port_id, uint16_t queue_id, struct rte_mbuf ** rx_pkts, const uint16_t nb_pkts) [inline], [static]
Okay bestie, this is the iconic one. 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_mbufdata structure associated with the Rx descriptor according to the information provided by the NIC into that Rx descriptor. - Store the
rte_mbufdata structure into the next entry of therx_pktsarray. - Replenish the Rx descriptor with a new
rte_mbufbuffer allocated from the memory pool associated with the receive queue at initialization time.
When retrieving an input packet that was scattered by the controller into multiple receive descriptors, the rte_eth_rx_burst() function appends the associated rte_mbuf buffers to the first buffer of the packet.
The rte_eth_rx_burst() function returns the number of packets actually retrieved, which is the number of rte_mbuf data structures effectively supplied into the rx_pkts array. A return value equal to nb_pkts indicates that the Rx queue contained at least rx_pkts packets, and this is likely to signify that other received packets remain in the input queue. Applications implementing a "retrieve as much received packets as possible" policy can check this specific case and keep invoking the rte_eth_rx_burst() function until a value less than nb_pkts is returned.
This receive method has the following advantages:
- It allows a run-to-completion network stack engine to retrieve and to immediately process received packets in a fast burst-oriented approach, avoiding the overhead of unnecessary intermediate packet queue/dequeue operations.
- Conversely, it also allows an asynchronous-oriented processing method to retrieve bursts of received packets and to immediately queue them for further parallel processing by another logical core, for instance. However, instead of having received packets being individually queued by the driver, this approach allows the caller of the
rte_eth_rx_burst()function to queue a burst of retrieved packets at a time and therefore dramatically reduce the cost of enqueue/dequeue operations per packet. - It allows the
rte_eth_rx_burst()function of the driver to take advantage of burst-oriented hardware features (CPU cache, prefetch instructions, and so on) to minimize the number of CPU cycles per packet.
To summarize, the proposed receive API enables many burst-oriented optimizations in both synchronous and asynchronous packet processing environments with no overhead in both cases.
๐ Note โ Some drivers using vector instructions require thatnb_pktsis divisible by4or8, depending on the driver implementation.
The rte_eth_rx_burst() function does not provide any error notification to avoid the corresponding overhead. As a hint, the upper-level application might check the status of the device link once being systematically returned a 0 value for a given number of tries.
Parameters
port_idโ the port identifier of the Ethernet device ๐ซถqueue_idโ the index of the receive queue you're pulling input packets from. It has to be in the range[0, nb_rx_queue - 1], the same one you already handed torte_eth_dev_configure(). no random numbers bestie.rx_pktsโ the address of an array of pointers torte_mbufstructures, and it must be big enough to holdnb_pktspointers. size it right or perish ๐nb_pktsโ the max number of packets to retrieve. this value must be divisible by 8 to work with any driver. yes, any driver. so like, please.
Returns
The number of packets actually retrieved โ which is literally just the number of pointers to rte_mbuf structures that got effectively dropped into the rx_pkts array. โจ
Definition at line 6348 of file rte_ethdev.h.
int rte_eth_rx_queue_count (uint16_t port_id, uint16_t queue_id) [inline], [static]
Get the number of used descriptors of a Rx queue ๐
okay so since this is a dataplane function, there is no check performed on port_id and queue_id. none. zero. so the caller has to make sure the port is enabled and the queue is configured and running. that's on you, bestie. ๐ซถ
Parameters
port_idโ the port identifier of the Ethernet device.queue_idโ the queue ID on the specific port.
Returns
The number of used descriptors in the specific queue, or:
(-ENODEV)ifport_idis invalid.(-EINVAL)ifqueue_idis invalid(-ENOTSUP)if the device does not support this function
Definition at line 6426 of file rte_ethdev.h.
int rte_eth_rx_descriptor_status (uint16_t port_id, uint16_t queue_id, uint16_t offset) [inline], [static]
Check the status of a Rx descriptor in the queue ๐
It should be called in a similar context to the Rx function, so:
- on a dataplane core
- not concurrently on the same queue
And since it's a dataplane function, no check is performed on port_id and queue_id โ the caller must therefore ensure that the port is enabled and the queue is configured and running. iykyk ๐ธ
Note: accessing a random descriptor in the ring may trigger cache misses and have a performance impact. lowkey a vibe killer fr fr ๐ญ
Parameters
port_idโ a valid port identifier of the Ethernet device which.queue_idโ a valid Rx queue identifier on this port.offsetโ the offset of the descriptor starting from tail (0is the next packet to be received by the driver).
Returns
- (
RTE_ETH_RX_DESC_AVAIL): descriptor is available for the hardware to receive a packet. โ - (
RTE_ETH_RX_DESC_DONE): descriptor is done, it is filled by hw, but not yet processed by the driver (i.e. in the receive queue). - (
RTE_ETH_RX_DESC_UNAVAIL): descriptor is unavailable, either held by the driver and not yet returned to hw, or reserved by the hw. (-EINVAL)bad descriptor offset.(-ENOTSUP)if the device does not support this function.(-ENODEV)bad port or queue (only if compiled with debug).
Definition at line 6496 of file rte_ethdev.h.
int rte_eth_tx_descriptor_status (uint16_t port_id, uint16_t queue_id, uint16_t offset) [inline], [static]
Check the status of a Tx descriptor in the queue. ๐ฅ
Call it in a similar context to the Tx function:
- on a dataplane core
- not concurrently on the same queue
Since it's a dataplane function, no check is performed on port_id and queue_id, so the caller must ensure that the port is enabled and the queue is configured and running. ๐
Note: accessing a random descriptor in the ring may trigger cache misses and have a performance impact. same warning, same pain ๐
Parameters
port_idโ a valid port identifier of the Ethernet device which.queue_idโ a valid Tx queue identifier on this port.offsetโ the offset of the descriptor starting from tail (0is the place where the next packet will be send).
Returns
- (
RTE_ETH_TX_DESC_FULL) descriptor is being processed by the hw, i.e. in the transmit queue. - (
RTE_ETH_TX_DESC_DONE) hardware is done with this descriptor, it can be reused by the driver. โป๏ธ - (
RTE_ETH_TX_DESC_UNAVAIL): descriptor is unavailable, reserved by the driver or the hardware. (-EINVAL)bad descriptor offset.(-ENOTSUP)if the device does not support this function.(-ENODEV)bad port or queue (only if compiled with debug).
Definition at line 6565 of file rte_ethdev.h.
uint16_t rte_eth_tx_burst (uint16_t port_id, uint16_t queue_id, struct rte_mbuf ** tx_pkts, uint16_t nb_pkts) [inline], [static]
Send a burst of output packets on a transmit queue of an Ethernet device. ๐ this is the main character of the Tx world ngl
The rte_eth_tx_burst() function is invoked to transmit output packets on the output queue queue_id of the Ethernet device designated by its port_id. The nb_pkts parameter is the number of packets to send, which are supplied in the tx_pkts array of rte_mbuf structures, each of them allocated from a pool created with rte_pktmbuf_pool_create(). The rte_eth_tx_burst() function loops, sending nb_pkts packets, up to the number of transmit descriptors available in the Tx ring of the transmit queue. For each packet to send, the rte_eth_tx_burst() function performs the following operations:
- Pick up the next available descriptor in the transmit ring.
- Free the network buffer previously sent with that descriptor, if any. ๐งน
- Initialize the transmit descriptor with the information provided in the
*rte_mbufdata 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. ๐ periodt.
It is the responsibility of the rte_eth_tx_burst() function to transparently free the memory buffers of packets previously sent. This feature is driven by the tx_free_thresh value supplied to the rte_eth_dev_configure() function at device configuration time. When the number of free Tx descriptors drops below this threshold, the rte_eth_tx_burst() function must [attempt to] free the rte_mbuf buffers of those packets whose transmission was effectively completed.
If the PMD is RTE_ETH_TX_OFFLOAD_MT_LOCKFREE capable, multiple threads can invoke this function concurrently on the same Tx queue without SW lock. ๐
safe and unbothered.
See also
rte_eth_dev_info_get,struct rte_eth_txconf::offloadsrte_eth_tx_prepareto perform some prior checks or adjustments for offloads.
Note: this function must not modify mbufs (including packets data) unless therefcntis1. An exception is the bonding PMD, which does not have "Tx prepare" support โ in this case, mbufs may be modified. don't be weird about it ๐ซถ
Parameters
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 torte_eth_dev_configure().tx_pktsโ the address of an array ofnb_pktspointers torte_mbufstructures which contain the output packets.nb_pktsโ the 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. ๐ญ that's not a bug, that's the ring.
Definition at line 6687 of file rte_ethdev.h.
uint16_t rte_eth_tx_prepare (uint16_t port_id, uint16_t queue_id, struct rte_mbuf ** tx_pkts, uint16_t nb_pkts) [inline], [static]
Process a burst of output packets on a transmit queue of an Ethernet device. โจ the lil pre-game ritual before the actual send
The rte_eth_tx_prepare() function is invoked to prepare output packets to be transmitted on the output queue queue_id of the Ethernet device designated by its port_id. The nb_pkts parameter is the number of packets to be prepared, which are supplied in the tx_pkts array of rte_mbuf structures, each of them allocated from a pool created with rte_pktmbuf_pool_create(). For each packet to send, the rte_eth_tx_prepare() function performs the following operations:
- Check if packet meets devices requirements for Tx offloads.
- Check limitations about number of segments.
- Check additional requirements when debug is enabled.
- Update and/or reset required checksums when Tx offload is set for packet.
Since this function can modify packet data, provided mbufs must be safely writable (e.g. modified data cannot be in shared segment). โ ๏ธ fr fr, don't hand it shared memory.
The rte_eth_tx_prepare() function returns the number of packets ready to be sent. A return value equal to nb_pkts means that all packets are valid and ready to be sent, otherwise it stops processing on the first invalid packet and leaves the rest of the packets untouched.
When this functionality is not implemented in the driver, all packets are are returned untouched.
Parameters
port_idโ the port identifier of the Ethernet device. The value must be a valid port ID.queue_idโ the index of the transmit queue through which output packets must be sent. The value must be in the range[0, nb_tx_queue - 1]previously supplied torte_eth_dev_configure().tx_pktsโ the address of an array ofnb_pktspointers torte_mbufstructures which contain the output packets.nb_pktsโ the maximum number of packets to process.
Returns
The number of packets correct and ready to be sent. The return value can be less than the value of the tx_pkts parameter when some packet doesn't meet devices requirements with rte_errno set appropriately:
EINVAL: offload flags are not correctly setENOTSUP: the offload feature is not supported by the hardwareENODEV: ifport_idis invalid (with debug enabled only)
Definition at line 6804 of file rte_ethdev.h.
uint16_t rte_eth_tx_buffer_flush (uint16_t port_id, uint16_t queue_id, struct rte_eth_dev_tx_buffer * buffer) [inline], [static]
Send any packets queued up for transmission on a port and HW queue ๐
This causes an explicit flush of packets previously buffered via the rte_eth_tx_buffer() function. It returns the number of packets successfully sent to the NIC, and calls the error callback for any unsent packets. Unless explicitly set up otherwise, the default callback simply frees the unsent packets back to the owning mempool. ๐ง iconic cleanup behaviour, honestly.
Parameters
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 torte_eth_dev_configure(), bestie, so pls respect the range ๐bufferโ buffer of packets to be transmit. (yes, "to be transmit", iconic grammar, we move ๐ )
Returns
The number of packets successfully sent to the Ethernet device, periodt. The error callback is called for any packets which could not be sent.
Definition at line 6888 of file rte_ethdev.h.
__rte_always_inline uint16_t rte_eth_tx_buffer ๐
__rte_always_inline uint16_t rte_eth_tx_buffer (uint16_t port_id, uint16_t
queue_id, struct rte_eth_dev_tx_buffer * buffer, struct rte_mbuf *
tx_pkt)
[static] โ buffer a single packet for future transmission on a port and queue โจ
Okay so this function takes one mbuf/packet and buffers it for later transmission on the particular port and queue you specified. Once the buffer is full of packets, an attempt will be made to transmit all the buffered packets. In case of error, where not all packets can be transmitted, a callback is called with the unsent packets as a parameter. If no callback is explicitly set up, the unsent packets are just freed back to the owning mempool. The function returns the number of packets actually sent, i.e. 0 if no buffer flush occurred, otherwise the number of packets successfully flushed. literally the receipts ๐งพ
Parameters
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 torte_eth_dev_configure().bufferโ buffer used to collect packets to be sent.tx_pktโ pointer to the packet mbuf to be sent. ๐ฆ
Returns
0= packet has been buffered for later transmissionN > 0= packet has been buffered, and the buffer was subsequently flushed, causingNpackets to be sent, and the error callback to be called for the rest. ๐
Definition at line 6941 of file rte_ethdev.h.
__rte_experimental uint16_t rte_eth_recycle_mbufs โป๏ธ
__rte_experimental uint16_t rte_eth_recycle_mbufs (uint16_t rx_port_id,
uint16_t rx_queue_id, uint16_t tx_port_id, uint16_t tx_queue_id, struct
rte_eth_recycle_rxq_info * recycle_rxq_info)
[inline], [static]
Warning โ EXPERIMENTAL: this API may change, or be removed, without prior notice ๐ so don't get too attached, bestie
Recycle used mbufs from a transmit queue of an Ethernet device, and move these mbufs into a mbuf ring for a receive queue of an Ethernet device. This can bypass the mempool path to save CPU cycles. no cap, it's giving efficiency ๐ธ
The rte_eth_recycle_mbufs() function loops, with rte_eth_rx_burst() and rte_eth_tx_burst() functions, freeing Tx used mbufs and replenishing Rx descriptors. The number of recycling mbufs depends on the request of the Rx mbuf ring, with the constraint of enough used mbufs from the Tx mbuf ring.
For each recycling mbufs, the rte_eth_recycle_mbufs() function performs the following operations:
- Copy used
rte_mbufbuffer pointers from Tx mbuf ring into Rx mbuf ring. ๐ - Replenish the Rx descriptors with the recycling
rte_mbufmbufs freed from the Tx mbuf ring. โจ
This function spilts Rx and Tx path with different callback functions. The callback function recycle_tx_mbufs_reuse is for Tx driver. The callback function recycle_rx_descriptors_refill is for Rx driver. rte_eth_recycle_mbufs() can support the case that Rx Ethernet device is different from Tx Ethernet device.
It is the responsibility of users to select the Rx/Tx queue pair to recycle mbufs. Before call this function, users must call rte_eth_recycle_rxq_info_get function to retrieve selected Rx queue information. yes that's on you ๐
See also
rte_eth_recycle_rxq_info_get,struct rte_eth_recycle_rxq_info
Currently, the rte_eth_recycle_mbufs() function can support to feed 1 Rx queue from 2 Tx queues in the same thread. Do not pair the Rx queue and Tx queue in different threads, in order to avoid memory error rewriting. seriously bestie, same thread only, that's not a vibe you want to risk ๐ญ
Parameters
rx_port_idโ port identifying the receive side.rx_queue_idโ the index of the receive queue identifying the receive side. The value must be in the range[0, nb_rx_queue - 1]previously supplied torte_eth_dev_configure().tx_port_idโ port identifying the transmit side.tx_queue_idโ the index of the transmit queue identifying the transmit side. The value must be in the range[0, nb_tx_queue - 1]previously supplied torte_eth_dev_configure().recycle_rxq_infoโ a pointer to a structure of typerte_eth_recycle_rxq_infowhich contains the information of the Rx queue mbuf ring. ๐ซถ
Returns
The number of recycling mbufs. โป๏ธ
Definition at line 7006 of file rte_ethdev.h.
__rte_experimental int rte_eth_buffer_split_get_supported_hdr_ptypes ๐ง
__rte_experimental int rte_eth_buffer_split_get_supported_hdr_ptypes
(uint16_t port_id, uint32_t * ptypes, int num)
Warning โ EXPERIMENTAL: this API may change without prior notice ๐ (not even the "or be removed" this time, it's just vibes)
Get supported header protocols to split on Rx.
When a packet type is announced to be split, it must be supported by the PMD. For instance, if eth-ipv4, eth-ipv4-udp is announced, the PMD must return the following packet types for these packets:
- Ether/IPv4 ->
RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4๐ - Ether/IPv4/UDP ->
RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 | RTE_PTYPE_L4_UDP๐
Parameters
port_idโ the port identifier of the device.ptypesโ an array pointer to store supported protocol headers, allocated by caller. These ptypes are composed withRTE_PTYPE_*.numโ size of the array pointed by paramptypes.
Returns
(>=0)โ number of supported ptypes. If the number of types exceedsnum, onlynumentries will be filled into theptypesarray, but the full count of supported ptypes will be returned.(-ENOTSUP)โ if header protocol is not supported by device.(-ENODEV)โ ifport_idinvalid.(-EINVAL)โ if bad parameter.
__rte_experimental int rte_eth_tx_queue_count ๐ฅ
__rte_experimental int rte_eth_tx_queue_count (uint16_t port_id, uint16_t
queue_id)
[inline], [static]
Warning โ EXPERIMENTAL: this API may change, or be removed, without prior notice. ๐
Get the number of used descriptors of a Tx queue. ๐
This function retrieves the number of used descriptors of a transmit queue. Applications can use this API in the fast path to inspect Tx queue occupancy and take appropriate actions based on the available free descriptors. An example action could be implementing Random Early Discard (RED). main character congestion control, honestly ๐
Since it's a fast-path function, no check is performed on port_id and queue_id. The caller must therefore ensure that the port is enabled and the queue is configured and running. yeah bestie, that's your job now ๐
Parameters
port_idโ the port identifier of the device.queue_idโ the index of the transmit queue. The value must be in the range[0, nb_tx_queue - 1]previously supplied torte_eth_dev_configure().
Returns
The number of used descriptors in the specific queue, or:
(-ENODEV)โ ifport_idis invalid. Enabled only whenRTE_ETHDEV_DEBUG_TXis enabled.(-EINVAL)โ ifqueue_idis invalid. Enabled only whenRTE_ETHDEV_DEBUG_TXis enabled.(-ENOTSUP)โ if the device does not support this function.
Note
- This function is designed for fast-path use. โจ
- There is no requirement to call this function before
rte_eth_tx_burst()invocation. - Utilize this function exclusively when the caller needs to determine the used queue count across all descriptors of a Tx queue. If the use case only involves checking the status of a specific descriptor slot, opt for
rte_eth_tx_descriptor_status()instead. ๐ฆ
Definition at line 7146 of file rte_ethdev.h.
๐ธ Author ๐ธ
Generated automatically by Doxygen for DPDK from the source code.
and that's a wrap onrte_ethdev.h(3), bestie!! ๐โจ you just read the whole entire thing and honestly? obsessed. this manual page came from DPDK, Version 25.11.3, and it's therte_ethdev.h(3)page โ the queen of the ethernet dev API, no notes. now go configure a port and slay ๐ ๐๐ฆ
๐ฆ where this page comes from
- ubuntu resolute: dpdk-doc 25.11.3-0ubuntu0.26.04.1 ยท BSD-3-Clause
- ubuntu stonking: dpdk-doc 25.11.3-1 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms