---
name: "rte_ethdev.h"
section: "3"
platform: "linux"
package: "dpdk-doc"
version: "24.11.4-0+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/rte_ethdev.h"
---

# rte\_ethdev.h(3)

## NAME

rte\_ethdev.h

## SYNOPSIS

`#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>`\

### Data Structures

struct **rte\_eth\_stats**\
 struct **rte\_eth\_link**\
 struct **rte\_eth\_speed\_lanes\_capa**\
 struct **rte\_eth\_thresh**\
 struct **rte\_eth\_rxmode**\
 struct **rte\_vlan\_filter\_conf**\
 struct **rte\_eth\_rss\_conf**\
 struct **rte\_eth\_rss\_reta\_entry64**\
 struct **rte\_eth\_vmdq\_dcb\_conf**\
 struct **rte\_eth\_vmdq\_rx\_conf**\
 struct **rte\_eth\_txmode**\
 struct **rte\_eth\_rxseg\_split**\
 union **rte\_eth\_rxseg**\
 struct **rte\_eth\_rxconf**\
 struct **rte\_eth\_txconf**\
 struct **rte\_eth\_hairpin\_queue\_cap**\
 struct **rte\_eth\_hairpin\_cap**\
 struct **rte\_eth\_hairpin\_peer**\
 struct **rte\_eth\_hairpin\_conf**\
 struct **rte\_eth\_desc\_lim**\
 struct **rte\_eth\_fc\_conf**\
 struct **rte\_eth\_pfc\_conf**\
 struct **rte\_eth\_pfc\_queue\_info**\
 struct **rte\_eth\_pfc\_queue\_conf**\
 struct **rte\_eth\_udp\_tunnel**\
 struct **rte\_eth\_intr\_conf**\
 struct **rte\_eth\_conf**\
 struct **rte\_eth\_dev\_portconf**\
 struct **rte\_eth\_switch\_info**\
 struct **rte\_eth\_rxseg\_capa**\
 struct **rte\_eth\_dev\_info**\
 struct **rte\_eth\_rxq\_info**\
 struct **rte\_eth\_txq\_info**\
 struct **rte\_eth\_recycle\_rxq\_info**\
 struct **rte\_eth\_burst\_mode**\
 struct **rte\_eth\_xstat**\
 struct **rte\_eth\_xstat\_name**\
 struct **rte\_eth\_dcb\_tc\_queue\_mapping**\
 struct **rte\_eth\_dcb\_info**\
 struct **rte\_eth\_dev\_tx\_buffer**\
 struct **rte\_eth\_event\_macsec\_desc**\
 struct **rte\_eth\_event\_ipsec\_desc**\
 struct **rte\_eth\_representor\_range**\
 struct **rte\_eth\_representor\_info**\
 struct **rte\_eth\_ip\_reassembly\_params**\
 struct **rte\_eth\_ip\_reassembly\_dynfield\_t**\
 struct **rte\_eth\_cman\_info**\
 struct **rte\_eth\_cman\_config**\

### Macros

\#define **RTE\_ETH\_FOREACH\_MATCHING\_DEV**(id,  devargs,  iter)\
 \#define **RTE\_ETH\_SPEED\_LANES\_TO\_CAPA**(x)   **RTE\_BIT32**(x)\
 \#define **RTE\_ETH\_FLOW\_PORT**   18\
 \#define **RTE\_ETH\_FLOW\_VXLAN**   19\
 \#define **RTE\_ETH\_FLOW\_GENEVE**   20\
 \#define **RTE\_ETH\_FLOW\_NVGRE**   21\
 \#define **RTE\_ETH\_FLOW\_VXLAN\_GPE**   22\
 \#define **RTE\_ETH\_FLOW\_GTPU**   23\
 \#define **RTE\_ETH\_RSS\_L4\_CHKSUM**   **RTE\_BIT64**(35)\
 \#define **RTE\_ETH\_RSS\_LEVEL\_PMD\_DEFAULT**   (UINT64\_C(0) \<\< 50)\
 \#define **RTE\_ETH\_RSS\_LEVEL\_OUTERMOST**   (UINT64\_C(1) \<\< 50)\
 \#define **RTE\_ETH\_RSS\_LEVEL\_INNERMOST**   (UINT64\_C(2) \<\< 50)\
 \#define **RTE\_ETH\_RSS\_PROTO\_MASK**\
 \#define **RTE\_ETH\_NUM\_RECEIVE\_MAC\_ADDR**   128\
 \#define **RTE\_ETH\_VMDQ\_NUM\_UC\_HASH\_ARRAY**   128\
 \#define **RTE\_ETH\_RX\_OFFLOAD\_VLAN\_STRIP**   **RTE\_BIT64**(0)\
 \#define **RTE\_ETH\_RX\_OFFLOAD\_TIMESTAMP**   **RTE\_BIT64**(14)\
 \#define **RTE\_ETH\_TX\_OFFLOAD\_VLAN\_INSERT**   **RTE\_BIT64**(0)\
 \#define **RTE\_ETH\_TX\_OFFLOAD\_OUTER\_IPV4\_CKSUM**   **RTE\_BIT64**(7)\
 \#define **RTE\_ETH\_TX\_OFFLOAD\_VXLAN\_TNL\_TSO**   **RTE\_BIT64**(9)\
 \#define **RTE\_ETH\_TX\_OFFLOAD\_GRE\_TNL\_TSO**   **RTE\_BIT64**(10)\
 \#define **RTE\_ETH\_TX\_OFFLOAD\_IPIP\_TNL\_TSO**   **RTE\_BIT64**(11)\
 \#define **RTE\_ETH\_TX\_OFFLOAD\_GENEVE\_TNL\_TSO**   **RTE\_BIT64**(12)\
 \#define **RTE\_ETH\_TX\_OFFLOAD\_MT\_LOCKFREE**   **RTE\_BIT64**(14)\
 \#define **RTE\_ETH\_TX\_OFFLOAD\_MULTI\_SEGS**   **RTE\_BIT64**(15)\
 \#define **RTE\_ETH\_TX\_OFFLOAD\_MBUF\_FAST\_FREE**   **RTE\_BIT64**(16)\
 \#define **RTE\_ETH\_TX\_OFFLOAD\_UDP\_TNL\_TSO**   **RTE\_BIT64**(18)\
 \#define **RTE\_ETH\_TX\_OFFLOAD\_IP\_TNL\_TSO**   **RTE\_BIT64**(19)\
 \#define **RTE\_ETH\_TX\_OFFLOAD\_OUTER\_UDP\_CKSUM**   **RTE\_BIT64**(20)\
 \#define **RTE\_ETH\_TX\_OFFLOAD\_SEND\_ON\_TIMESTAMP**   **RTE\_BIT64**(21)\
 \#define **RTE\_ETH\_DEV\_SWITCH\_DOMAIN\_ID\_INVALID**   (UINT16\_MAX)\
 \#define **RTE\_ETH\_BURST\_FLAG\_PER\_QUEUE**   **RTE\_BIT64**(0)\
 \#define **RTE\_ETH\_BURST\_MODE\_INFO\_SIZE**   1024\
 \#define **RTE\_ETH\_XSTATS\_NAME\_SIZE**   64\
 \#define **RTE\_ETH\_FOREACH\_DEV\_OWNED\_BY**(p,  o)\
 \#define **RTE\_ETH\_FOREACH\_DEV**(p)   	**RTE\_ETH\_FOREACH\_DEV\_OWNED\_BY**(p, RTE\_ETH\_DEV\_NO\_OWNER)\
 \#define **RTE\_ETH\_FOREACH\_DEV\_OF**(port\_id,  parent)\
 \#define **RTE\_ETH\_FOREACH\_DEV\_SIBLING**(port\_id,  ref\_port\_id)\
 \#define **RTE\_ETH\_TX\_BUFFER\_SIZE**(sz)   	(sizeof(struct **rte\_eth\_dev\_tx\_buffer**) + (sz) \* sizeof(struct **rte\_mbuf** \*))\
 \#define **RTE\_ETH\_RX\_METADATA\_USER\_FLAG**   **RTE\_BIT64**(0)\
 \#define **RTE\_ETH\_RX\_METADATA\_USER\_MARK**   **RTE\_BIT64**(1)\
 \#define **RTE\_ETH\_RX\_METADATA\_TUNNEL\_ID**   **RTE\_BIT64**(2)\
 \#define **RTE\_ETH\_DEV\_REASSEMBLY\_F\_IPV4**   (**RTE\_BIT32**(0))\
 \#define **RTE\_ETH\_DEV\_REASSEMBLY\_F\_IPV6**   (**RTE\_BIT32**(1))\

**Link speed capabilities**\
 Device supported speeds bitmap flags

\#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)](/RTE_BIT32/3.md)\
 \#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)\

**Link speed**\
 Ethernet numeric link speeds in Mbps

\#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\_UNKNOWN**   UINT32\_MAX\

**Link negotiation**\
 Constants used in link management.

\#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)](/RTE_BIT32/3.md)\
 \#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)](/RTE_BIT64/3.md)\
 \#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 in rte\_eth\_dev\_data.dev\_flags and reported in **rte\_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)](/RTE_BIT32/3.md)\
 \#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

**typedef** uint16\_t(\* **rte\_rx\_callback\_fn**) (uint16\_t port\_id, uint16\_t queue, struct **rte\_mbuf** \*pkts\[\], uint16\_t nb\_pkts, uint16\_t max\_pkts, void \*user\_param)\
 **typedef** uint16\_t(\* **rte\_tx\_callback\_fn**) (uint16\_t port\_id, uint16\_t queue, struct **rte\_mbuf** \*pkts\[\], uint16\_t nb\_pkts, void \*user\_param)\
 **typedef** int(\* **rte\_eth\_dev\_cb\_fn**) (uint16\_t port\_id, enum **rte\_eth\_event\_type** event, void \*cb\_arg, void \*ret\_param)\

### Enumerations

enum **rte\_eth\_rx\_mq\_mode** { **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** }\
 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** }\
 enum **rte\_vlan\_type** {  }\
 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** }\
 enum **rte\_eth\_nb\_tcs** { **RTE\_ETH\_4\_TCS** = 4, **RTE\_ETH\_8\_TCS** = 8 }\
 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 }\
 enum **rte\_eth\_fc\_mode** { **RTE\_ETH\_FC\_NONE** = 0, **RTE\_ETH\_FC\_RX\_PAUSE**, **RTE\_ETH\_FC\_TX\_PAUSE**, **RTE\_ETH\_FC\_FULL** }\
 enum **rte\_eth\_tunnel\_type** \
 enum **rte\_eth\_representor\_type** { **RTE\_ETH\_REPRESENTOR\_NONE**, **RTE\_ETH\_REPRESENTOR\_VF**, **RTE\_ETH\_REPRESENTOR\_SF**, **RTE\_ETH\_REPRESENTOR\_PF** }\
 enum **rte\_eth\_err\_handle\_mode** { **RTE\_ETH\_ERROR\_HANDLE\_MODE\_NONE**, **RTE\_ETH\_ERROR\_HANDLE\_MODE\_PASSIVE**, **RTE\_ETH\_ERROR\_HANDLE\_MODE\_PROACTIVE** }\
 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** }\
 enum **rte\_eth\_dev\_state** { **RTE\_ETH\_DEV\_UNUSED** = 0, **RTE\_ETH\_DEV\_ATTACHED**, **RTE\_ETH\_DEV\_REMOVED** }\
 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** }\
 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** }\
 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** }\
 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** }\
 enum **rte\_eth\_cman\_obj** { **RTE\_ETH\_CMAN\_OBJ\_RX\_QUEUE** = RTE\_BIT32(0), **RTE\_ETH\_CMAN\_OBJ\_RX\_QUEUE\_MEMPOOL** = RTE\_BIT32(1) }\

### Functions

int **rte\_eth\_iterator\_init** (struct **rte\_dev\_iterator** \*iter, const char \*devargs)\
 uint16\_t **rte\_eth\_iterator\_next** (struct **rte\_dev\_iterator** \*iter)\
 void **rte\_eth\_iterator\_cleanup** (struct **rte\_dev\_iterator** \*iter)\
 static uint64\_t **rte\_eth\_rss\_hf\_refine** (uint64\_t rss\_hf)\
 uint64\_t **rte\_eth\_find\_next\_owned\_by** (uint16\_t port\_id, const uint64\_t owner\_id)\
 uint16\_t **rte\_eth\_find\_next** (uint16\_t port\_id)\
 uint16\_t **rte\_eth\_find\_next\_of** (uint16\_t port\_id\_start, const struct rte\_device \*parent)\
 uint16\_t **rte\_eth\_find\_next\_sibling** (uint16\_t port\_id\_start, uint16\_t ref\_port\_id)\
 int **rte\_eth\_dev\_owner\_new** (uint64\_t \*owner\_id)\
 int **rte\_eth\_dev\_owner\_set** (const uint16\_t port\_id, const struct rte\_eth\_dev\_owner \*owner)\
 int **rte\_eth\_dev\_owner\_unset** (const uint16\_t port\_id, const uint64\_t owner\_id)\
 int **rte\_eth\_dev\_owner\_delete** (const uint64\_t owner\_id)\
 int **rte\_eth\_dev\_owner\_get** (const uint16\_t port\_id, struct rte\_eth\_dev\_owner \*owner)\
 uint16\_t **rte\_eth\_dev\_count\_avail** (void)\
 uint16\_t **rte\_eth\_dev\_count\_total** (void)\
 uint32\_t **rte\_eth\_speed\_bitflag** (uint32\_t speed, int duplex)\
 const char \* **rte\_eth\_dev\_rx\_offload\_name** (uint64\_t offload)\
 const char \* **rte\_eth\_dev\_tx\_offload\_name** (uint64\_t offload)\
 \_\_rte\_experimental const char \* **rte\_eth\_dev\_capability\_name** (uint64\_t capability)\
 int **rte\_eth\_dev\_configure** (uint16\_t port\_id, uint16\_t nb\_rx\_queue, uint16\_t nb\_tx\_queue, const struct **rte\_eth\_conf** \*eth\_conf)\
 int **rte\_eth\_dev\_is\_removed** (uint16\_t port\_id)\
 int **rte\_eth\_rx\_queue\_setup** (uint16\_t port\_id, uint16\_t rx\_queue\_id, uint16\_t nb\_rx\_desc, unsigned int socket\_id, const struct **rte\_eth\_rxconf** \*rx\_conf, struct **rte\_mempool** \*mb\_pool)\
 \_\_rte\_experimental int **rte\_eth\_rx\_hairpin\_queue\_setup** (uint16\_t port\_id, uint16\_t rx\_queue\_id, uint16\_t nb\_rx\_desc, const struct **rte\_eth\_hairpin\_conf** \*conf)\
 int **rte\_eth\_tx\_queue\_setup** (uint16\_t port\_id, uint16\_t tx\_queue\_id, uint16\_t nb\_tx\_desc, unsigned int socket\_id, const struct **rte\_eth\_txconf** \*tx\_conf)\
 \_\_rte\_experimental int **rte\_eth\_tx\_hairpin\_queue\_setup** (uint16\_t port\_id, uint16\_t tx\_queue\_id, uint16\_t nb\_tx\_desc, const struct **rte\_eth\_hairpin\_conf** \*conf)\
 \_\_rte\_experimental int **rte\_eth\_hairpin\_get\_peer\_ports** (uint16\_t port\_id, uint16\_t \*peer\_ports, size\_t len, uint32\_t direction)\
 \_\_rte\_experimental int **rte\_eth\_hairpin\_bind** (uint16\_t tx\_port, uint16\_t rx\_port)\
 \_\_rte\_experimental int **rte\_eth\_hairpin\_unbind** (uint16\_t tx\_port, uint16\_t rx\_port)\
 \_\_rte\_experimental int **rte\_eth\_dev\_count\_aggr\_ports** (uint16\_t port\_id)\
 \_\_rte\_experimental int **rte\_eth\_dev\_map\_aggr\_tx\_affinity** (uint16\_t port\_id, uint16\_t tx\_queue\_id, uint8\_t affinity)\
 int **rte\_eth\_dev\_socket\_id** (uint16\_t port\_id)\
 int **rte\_eth\_dev\_is\_valid\_port** (uint16\_t port\_id)\
 \_\_rte\_experimental int **rte\_eth\_rx\_queue\_is\_valid** (uint16\_t port\_id, uint16\_t queue\_id)\
 \_\_rte\_experimental int **rte\_eth\_tx\_queue\_is\_valid** (uint16\_t port\_id, uint16\_t queue\_id)\
 int **rte\_eth\_dev\_rx\_queue\_start** (uint16\_t port\_id, uint16\_t rx\_queue\_id)\
 int **rte\_eth\_dev\_rx\_queue\_stop** (uint16\_t port\_id, uint16\_t rx\_queue\_id)\
 int **rte\_eth\_dev\_tx\_queue\_start** (uint16\_t port\_id, uint16\_t tx\_queue\_id)\
 int **rte\_eth\_dev\_tx\_queue\_stop** (uint16\_t port\_id, uint16\_t tx\_queue\_id)\
 int **rte\_eth\_dev\_start** (uint16\_t port\_id)\
 int **rte\_eth\_dev\_stop** (uint16\_t port\_id)\
 int **rte\_eth\_dev\_set\_link\_up** (uint16\_t port\_id)\
 int **rte\_eth\_dev\_set\_link\_down** (uint16\_t port\_id)\
 int **rte\_eth\_dev\_close** (uint16\_t port\_id)\
 int **rte\_eth\_dev\_reset** (uint16\_t port\_id)\
 int **rte\_eth\_promiscuous\_enable** (uint16\_t port\_id)\
 int **rte\_eth\_promiscuous\_disable** (uint16\_t port\_id)\
 int **rte\_eth\_promiscuous\_get** (uint16\_t port\_id)\
 int **rte\_eth\_allmulticast\_enable** (uint16\_t port\_id)\
 int **rte\_eth\_allmulticast\_disable** (uint16\_t port\_id)\
 int **rte\_eth\_allmulticast\_get** (uint16\_t port\_id)\
 int **rte\_eth\_link\_get** (uint16\_t port\_id, struct **rte\_eth\_link** \*link) **\_\_rte\_warn\_unused\_result**\
 int **rte\_eth\_link\_get\_nowait** (uint16\_t port\_id, struct **rte\_eth\_link** \*link) **\_\_rte\_warn\_unused\_result**\
 \_\_rte\_experimental const char \* **rte\_eth\_link\_speed\_to\_str** (uint32\_t link\_speed)\
 \_\_rte\_experimental int **rte\_eth\_link\_to\_str** (char \*str, size\_t len, const struct **rte\_eth\_link** \*eth\_link)\
 \_\_rte\_experimental int **rte\_eth\_speed\_lanes\_get** (uint16\_t port\_id, uint32\_t \*lanes)\
 \_\_rte\_experimental int **rte\_eth\_speed\_lanes\_set** (uint16\_t port\_id, uint32\_t 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)\
 int **rte\_eth\_stats\_get** (uint16\_t port\_id, struct **rte\_eth\_stats** \*stats)\
 int **rte\_eth\_stats\_reset** (uint16\_t port\_id)\
 int **rte\_eth\_xstats\_get\_names** (uint16\_t port\_id, struct **rte\_eth\_xstat\_name** \*xstats\_names, unsigned int size)\
 int **rte\_eth\_xstats\_get** (uint16\_t port\_id, struct **rte\_eth\_xstat** \*xstats, unsigned int n)\
 int **rte\_eth\_xstats\_get\_names\_by\_id** (uint16\_t port\_id, struct **rte\_eth\_xstat\_name** \*xstats\_names, unsigned int size, uint64\_t \*ids)\
 int **rte\_eth\_xstats\_get\_by\_id** (uint16\_t port\_id, const uint64\_t \*ids, uint64\_t \*values, unsigned int size)\
 int **rte\_eth\_xstats\_get\_id\_by\_name** (uint16\_t port\_id, const char \*xstat\_name, uint64\_t \*id)\
 int **rte\_eth\_xstats\_reset** (uint16\_t port\_id)\
 int **rte\_eth\_dev\_set\_tx\_queue\_stats\_mapping** (uint16\_t port\_id, uint16\_t tx\_queue\_id, uint8\_t stat\_idx)\
 int **rte\_eth\_dev\_set\_rx\_queue\_stats\_mapping** (uint16\_t port\_id, uint16\_t rx\_queue\_id, uint8\_t stat\_idx)\
 int **rte\_eth\_macaddr\_get** (uint16\_t port\_id, struct rte\_ether\_addr \*mac\_addr)\
 \_\_rte\_experimental int **rte\_eth\_macaddrs\_get** (uint16\_t port\_id, struct rte\_ether\_addr \*ma, unsigned int num)\
 int **rte\_eth\_dev\_info\_get** (uint16\_t port\_id, struct **rte\_eth\_dev\_info** \*dev\_info) **\_\_rte\_warn\_unused\_result**\
 \_\_rte\_experimental int **rte\_eth\_dev\_conf\_get** (uint16\_t port\_id, struct **rte\_eth\_conf** \*dev\_conf) **\_\_rte\_warn\_unused\_result**\
 int **rte\_eth\_dev\_fw\_version\_get** (uint16\_t port\_id, char \*fw\_version, size\_t fw\_size) **\_\_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**\
 int **rte\_eth\_dev\_set\_ptypes** (uint16\_t port\_id, uint32\_t ptype\_mask, uint32\_t \*set\_ptypes, unsigned int num)\
 int **rte\_eth\_dev\_get\_mtu** (uint16\_t port\_id, uint16\_t \*mtu)\
 int **rte\_eth\_dev\_set\_mtu** (uint16\_t port\_id, uint16\_t mtu)\
 int **rte\_eth\_dev\_vlan\_filter** (uint16\_t port\_id, uint16\_t vlan\_id, int on)\
 int **rte\_eth\_dev\_set\_vlan\_strip\_on\_queue** (uint16\_t port\_id, uint16\_t rx\_queue\_id, int on)\
 int **rte\_eth\_dev\_set\_vlan\_ether\_type** (uint16\_t port\_id, enum **rte\_vlan\_type** vlan\_type, uint16\_t tag\_type)\
 int **rte\_eth\_dev\_set\_vlan\_offload** (uint16\_t port\_id, int offload\_mask)\
 int **rte\_eth\_dev\_get\_vlan\_offload** (uint16\_t port\_id)\
 int **rte\_eth\_dev\_set\_vlan\_pvid** (uint16\_t port\_id, uint16\_t pvid, int on)\
 \_\_rte\_experimental int **rte\_eth\_rx\_avail\_thresh\_set** (uint16\_t port\_id, uint16\_t queue\_id, uint8\_t avail\_thresh)\
 \_\_rte\_experimental int **rte\_eth\_rx\_avail\_thresh\_query** (uint16\_t port\_id, uint16\_t \*queue\_id, uint8\_t \*avail\_thresh)\
 int **rte\_eth\_tx\_buffer\_init** (struct **rte\_eth\_dev\_tx\_buffer** \*buffer, uint16\_t size)\
 int **rte\_eth\_tx\_buffer\_set\_err\_callback** (struct **rte\_eth\_dev\_tx\_buffer** \*buffer, buffer\_tx\_error\_fn callback, void \*userdata)\
 void **rte\_eth\_tx\_buffer\_drop\_callback** (struct **rte\_mbuf** \*\*pkts, uint16\_t unsent, void \*userdata)\
 void **rte\_eth\_tx\_buffer\_count\_callback** (struct **rte\_mbuf** \*\*pkts, uint16\_t unsent, void \*userdata)\
 int **rte\_eth\_tx\_done\_cleanup** (uint16\_t port\_id, uint16\_t queue\_id, uint32\_t free\_cnt)\
 int **rte\_eth\_dev\_callback\_register** (uint16\_t port\_id, enum **rte\_eth\_event\_type** event, **rte\_eth\_dev\_cb\_fn** cb\_fn, void \*cb\_arg)\
 int **rte\_eth\_dev\_callback\_unregister** (uint16\_t port\_id, enum **rte\_eth\_event\_type** event, **rte\_eth\_dev\_cb\_fn** cb\_fn, void \*cb\_arg)\
 int **rte\_eth\_dev\_rx\_intr\_enable** (uint16\_t port\_id, uint16\_t queue\_id)\
 int **rte\_eth\_dev\_rx\_intr\_disable** (uint16\_t port\_id, uint16\_t queue\_id)\
 int **rte\_eth\_dev\_rx\_intr\_ctl** (uint16\_t port\_id, int epfd, int op, void \*data)\
 int **rte\_eth\_dev\_rx\_intr\_ctl\_q** (uint16\_t port\_id, uint16\_t queue\_id, int epfd, int op, void \*data)\
 int **rte\_eth\_dev\_rx\_intr\_ctl\_q\_get\_fd** (uint16\_t port\_id, uint16\_t queue\_id)\
 int **rte\_eth\_led\_on** (uint16\_t port\_id)\
 int **rte\_eth\_led\_off** (uint16\_t port\_id)\
 \_\_rte\_experimental int **rte\_eth\_fec\_get\_capability** (uint16\_t port\_id, struct rte\_eth\_fec\_capa \*speed\_fec\_capa, unsigned int num)\
 \_\_rte\_experimental int **rte\_eth\_fec\_get** (uint16\_t port\_id, uint32\_t \*fec\_capa)\
 \_\_rte\_experimental int **rte\_eth\_fec\_set** (uint16\_t port\_id, uint32\_t fec\_capa)\
 int **rte\_eth\_dev\_flow\_ctrl\_get** (uint16\_t port\_id, struct **rte\_eth\_fc\_conf** \*fc\_conf)\
 int **rte\_eth\_dev\_flow\_ctrl\_set** (uint16\_t port\_id, struct **rte\_eth\_fc\_conf** \*fc\_conf)\
 int **rte\_eth\_dev\_priority\_flow\_ctrl\_set** (uint16\_t port\_id, struct **rte\_eth\_pfc\_conf** \*pfc\_conf)\
 int **rte\_eth\_dev\_mac\_addr\_add** (uint16\_t port\_id, struct rte\_ether\_addr \*mac\_addr, uint32\_t pool)\
 \_\_rte\_experimental int **rte\_eth\_dev\_priority\_flow\_ctrl\_queue\_info\_get** (uint16\_t port\_id, struct **rte\_eth\_pfc\_queue\_info** \*pfc\_queue\_info)\
 \_\_rte\_experimental int **rte\_eth\_dev\_priority\_flow\_ctrl\_queue\_configure** (uint16\_t port\_id, struct **rte\_eth\_pfc\_queue\_conf** \*pfc\_queue\_conf)\
 int **rte\_eth\_dev\_mac\_addr\_remove** (uint16\_t port\_id, struct rte\_ether\_addr \*mac\_addr)\
 int **rte\_eth\_dev\_default\_mac\_addr\_set** (uint16\_t port\_id, struct rte\_ether\_addr \*mac\_addr)\
 int **rte\_eth\_dev\_rss\_reta\_update** (uint16\_t port\_id, struct **rte\_eth\_rss\_reta\_entry64** \*reta\_conf, uint16\_t reta\_size)\
 int **rte\_eth\_dev\_rss\_reta\_query** (uint16\_t port\_id, struct **rte\_eth\_rss\_reta\_entry64** \*reta\_conf, uint16\_t reta\_size)\
 int **rte\_eth\_dev\_uc\_hash\_table\_set** (uint16\_t port\_id, struct rte\_ether\_addr \*addr, uint8\_t on)\
 int **rte\_eth\_dev\_uc\_all\_hash\_table\_set** (uint16\_t port\_id, uint8\_t on)\
 int **rte\_eth\_set\_queue\_rate\_limit** (uint16\_t port\_id, uint16\_t queue\_idx, uint32\_t tx\_rate)\
 int **rte\_eth\_dev\_rss\_hash\_update** (uint16\_t port\_id, struct **rte\_eth\_rss\_conf** \*rss\_conf)\
 int **rte\_eth\_dev\_rss\_hash\_conf\_get** (uint16\_t port\_id, struct **rte\_eth\_rss\_conf** \*rss\_conf)\
 \_\_rte\_experimental const char \* **rte\_eth\_dev\_rss\_algo\_name** (enum **rte\_eth\_hash\_function** rss\_algo)\
 \_\_rte\_experimental int **rte\_eth\_find\_rss\_algo** (const char \*name, uint32\_t \*algo)\
 int **rte\_eth\_dev\_udp\_tunnel\_port\_add** (uint16\_t port\_id, struct **rte\_eth\_udp\_tunnel** \*tunnel\_udp)\
 int **rte\_eth\_dev\_udp\_tunnel\_port\_delete** (uint16\_t port\_id, struct **rte\_eth\_udp\_tunnel** \*tunnel\_udp)\
 int **rte\_eth\_dev\_get\_dcb\_info** (uint16\_t port\_id, struct **rte\_eth\_dcb\_info** \*dcb\_info)\
 const struct rte\_eth\_rxtx\_callback \* **rte\_eth\_add\_rx\_callback** (uint16\_t port\_id, uint16\_t queue\_id, **rte\_rx\_callback\_fn** fn, void \*user\_param)\
 const struct rte\_eth\_rxtx\_callback \* **rte\_eth\_add\_first\_rx\_callback** (uint16\_t port\_id, uint16\_t queue\_id, **rte\_rx\_callback\_fn** fn, void \*user\_param)\
 const struct rte\_eth\_rxtx\_callback \* **rte\_eth\_add\_tx\_callback** (uint16\_t port\_id, uint16\_t queue\_id, **rte\_tx\_callback\_fn** fn, void \*user\_param)\
 int **rte\_eth\_remove\_rx\_callback** (uint16\_t port\_id, uint16\_t queue\_id, const struct rte\_eth\_rxtx\_callback \*user\_cb)\
 int **rte\_eth\_remove\_tx\_callback** (uint16\_t port\_id, uint16\_t queue\_id, const struct rte\_eth\_rxtx\_callback \*user\_cb)\
 int **rte\_eth\_rx\_queue\_info\_get** (uint16\_t port\_id, uint16\_t queue\_id, struct **rte\_eth\_rxq\_info** \*qinfo)\
 int **rte\_eth\_tx\_queue\_info\_get** (uint16\_t port\_id, uint16\_t queue\_id, struct **rte\_eth\_txq\_info** \*qinfo)\
 \_\_rte\_experimental int **rte\_eth\_recycle\_rx\_queue\_info\_get** (uint16\_t port\_id, uint16\_t queue\_id, struct **rte\_eth\_recycle\_rxq\_info** \*recycle\_rxq\_info)\
 int **rte\_eth\_rx\_burst\_mode\_get** (uint16\_t port\_id, uint16\_t queue\_id, struct **rte\_eth\_burst\_mode** \*mode)\
 int **rte\_eth\_tx\_burst\_mode\_get** (uint16\_t port\_id, uint16\_t queue\_id, struct **rte\_eth\_burst\_mode** \*mode)\
 \_\_rte\_experimental int **rte\_eth\_get\_monitor\_addr** (uint16\_t port\_id, uint16\_t queue\_id, struct rte\_power\_monitor\_cond \*pmc)\
 \_\_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**\
 int **rte\_eth\_dev\_set\_mc\_addr\_list** (uint16\_t port\_id, struct rte\_ether\_addr \*mc\_addr\_set, uint32\_t nb\_mc\_addr)\
 int **rte\_eth\_timesync\_enable** (uint16\_t port\_id)\
 int **rte\_eth\_timesync\_disable** (uint16\_t port\_id)\
 int **rte\_eth\_timesync\_read\_rx\_timestamp** (uint16\_t port\_id, struct timespec \*timestamp, uint32\_t flags)\
 int **rte\_eth\_timesync\_read\_tx\_timestamp** (uint16\_t port\_id, struct timespec \*timestamp)\
 int **rte\_eth\_timesync\_adjust\_time** (uint16\_t port\_id, int64\_t delta)\
 \_\_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)\
 int **rte\_eth\_dev\_get\_port\_by\_name** (const char \*name, uint16\_t \*port\_id)\
 int **rte\_eth\_dev\_get\_name\_by\_port** (uint16\_t port\_id, char \*name)\
 int **rte\_eth\_dev\_adjust\_nb\_rx\_tx\_desc** (uint16\_t port\_id, uint16\_t \*nb\_rx\_desc, uint16\_t \*nb\_tx\_desc)\
 int **rte\_eth\_dev\_pool\_ops\_supported** (uint16\_t port\_id, const char \*pool)\
 void \* **rte\_eth\_dev\_get\_sec\_ctx** (uint16\_t port\_id)\
 \_\_rte\_experimental int **rte\_eth\_dev\_hairpin\_capability\_get** (uint16\_t port\_id, struct **rte\_eth\_hairpin\_cap** \*cap)\
 \_\_rte\_experimental int **rte\_eth\_representor\_info\_get** (uint16\_t port\_id, struct **rte\_eth\_representor\_info** \*info)\
 int **rte\_eth\_rx\_metadata\_negotiate** (uint16\_t port\_id, uint64\_t \*features)\
 \_\_rte\_experimental int **rte\_eth\_ip\_reassembly\_capability\_get** (uint16\_t port\_id, struct **rte\_eth\_ip\_reassembly\_params** \*capa)\
 \_\_rte\_experimental int **rte\_eth\_ip\_reassembly\_conf\_get** (uint16\_t port\_id, struct **rte\_eth\_ip\_reassembly\_params** \*conf)\
 \_\_rte\_experimental int **rte\_eth\_ip\_reassembly\_conf\_set** (uint16\_t port\_id, const struct **rte\_eth\_ip\_reassembly\_params** \*conf)\
 \_\_rte\_experimental int **rte\_eth\_dev\_priv\_dump** (uint16\_t port\_id, FILE \*file)\
 \_\_rte\_experimental int **rte\_eth\_rx\_descriptor\_dump** (uint16\_t port\_id, uint16\_t queue\_id, uint16\_t offset, uint16\_t num, FILE \*file)\
 \_\_rte\_experimental int **rte\_eth\_tx\_descriptor\_dump** (uint16\_t port\_id, uint16\_t queue\_id, uint16\_t offset, uint16\_t num, FILE \*file)\
 \_\_rte\_experimental int **rte\_eth\_cman\_info\_get** (uint16\_t port\_id, struct **rte\_eth\_cman\_info** \*info)\
 \_\_rte\_experimental int **rte\_eth\_cman\_config\_init** (uint16\_t port\_id, struct **rte\_eth\_cman\_config** \*config)\
 \_\_rte\_experimental int **rte\_eth\_cman\_config\_set** (uint16\_t port\_id, const struct **rte\_eth\_cman\_config** \*config)\
 \_\_rte\_experimental int **rte\_eth\_cman\_config\_get** (uint16\_t port\_id, struct **rte\_eth\_cman\_config** \*config)\
 static uint16\_t **rte\_eth\_rx\_burst** (uint16\_t port\_id, uint16\_t queue\_id, struct **rte\_mbuf** \*\*rx\_pkts, const uint16\_t nb\_pkts)\
 static int **rte\_eth\_rx\_queue\_count** (uint16\_t port\_id, uint16\_t queue\_id)\
 static int **rte\_eth\_rx\_descriptor\_status** (uint16\_t port\_id, uint16\_t queue\_id, uint16\_t offset)\
 static int **rte\_eth\_tx\_descriptor\_status** (uint16\_t port\_id, uint16\_t queue\_id, uint16\_t offset)\
 static uint16\_t **rte\_eth\_tx\_burst** (uint16\_t port\_id, uint16\_t queue\_id, struct **rte\_mbuf** \*\*tx\_pkts, uint16\_t nb\_pkts)\
 static uint16\_t **rte\_eth\_tx\_prepare** (uint16\_t port\_id, uint16\_t queue\_id, struct **rte\_mbuf** \*\*tx\_pkts, uint16\_t nb\_pkts)\
 static uint16\_t **rte\_eth\_tx\_buffer\_flush** (uint16\_t port\_id, uint16\_t queue\_id, struct **rte\_eth\_dev\_tx\_buffer** \*buffer)\
 static **\_\_rte\_always\_inline** uint16\_t **rte\_eth\_tx\_buffer** (uint16\_t port\_id, uint16\_t queue\_id, struct **rte\_eth\_dev\_tx\_buffer** \*buffer, struct **rte\_mbuf** \*tx\_pkt)\
 static \_\_rte\_experimental uint16\_t **rte\_eth\_recycle\_mbufs** (uint16\_t rx\_port\_id, uint16\_t rx\_queue\_id, uint16\_t tx\_port\_id, uint16\_t tx\_queue\_id, struct **rte\_eth\_recycle\_rxq\_info** \*recycle\_rxq\_info)\
 \_\_rte\_experimental int **rte\_eth\_buffer\_split\_get\_supported\_hdr\_ptypes** (uint16\_t port\_id, uint32\_t \*ptypes, int num) **\_\_rte\_warn\_unused\_result**\
 static \_\_rte\_experimental int **rte\_eth\_tx\_queue\_count** (uint16\_t port\_id, uint16\_t queue\_id)\

## Detailed Description

RTE Ethernet Device API

The Ethernet Device API is composed of two parts:

- •

  The application-oriented Ethernet API that includes functions to setup an Ethernet device (configure it, setup its Rx and Tx queues and 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 that exports functions allowing an Ethernet Poll Mode Driver (PMD) to allocate an Ethernet device instance, create memzone for HW rings and process registered callbacks, and so on. PMDs should include ethdev\_driver.h instead 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\]. Of course, this function can be invoked in parallel by different logical cores on different Rx queues. It is the responsibility of the upper level application to enforce this rule.

If needed, parallel accesses by multiple logical cores to shared queues shall be explicitly protected by dedicated inline lock-aware functions built on top of their corresponding lock-free functions of the PMD API.

In all functions of the Ethernet API, the Ethernet device is designated by an integer \>= 0 named the device port identifier.

At the Ethernet driver level, Ethernet devices are represented by a generic data structure of type *rte\_eth\_dev*.

Ethernet devices are dynamically registered during the PCI probing phase performed at EAL initialization time. When an Ethernet device is being probed, an *rte\_eth\_dev* structure and a new port identifier are allocated for that device. Then, the eth\_dev\_init() function supplied by the Ethernet driver matching the probed PCI device is invoked to properly initialize the device.

The role of the device init function consists of resetting the hardware, checking access to Non-volatile Memory (NVM), reading the MAC address from NVM etc.

If the device init operation is successful, the correspondence between the port identifier assigned to the new device and its associated *rte\_eth\_dev* structure is effectively registered. Otherwise, both the *rte\_eth\_dev* structure and the port identifier are freed.

The functions exported by the application Ethernet API to setup a device designated by its port identifier must be invoked in the following order:

- •

  **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. The transmit and receive functions should not be invoked when the device or the queue is stopped.

Please note that some configuration is not stored between calls to **rte\_eth\_dev\_stop()**/rte\_eth\_dev\_start(). The following configuration will be retained:

```
- MTU
- flow control settings
- receive mode configuration (promiscuous mode, all-multicast mode,
  hardware checksum mode, RSS/VMDq settings etc.)
- VLAN filtering configuration
- default MAC address
- MAC addresses supplied to MAC address array
- flow director filtering mode (but not filtering rules)
- NIC queue statistics mappings
```

 The following configuration may be retained or not depending on the device capabilities:

```
- flow rules
- flow-related shared objects, e.g. indirect actions
```

 Any other configuration will not be stored and will need to be re-entered before a call to **rte\_eth\_dev\_start()**.

Finally, a network application can close an Ethernet device by invoking the **rte\_eth\_dev\_close()** function.

Each function of the application Ethernet API invokes a specific function of the PMD that controls the target device designated by its port identifier. For this purpose, all device-specific functions of an Ethernet driver are supplied through a set of pointers contained in a generic structure of type *eth\_dev\_ops*. The address of the *eth\_dev\_ops* structure is stored in the *rte\_eth\_dev* structure by the device init function of the Ethernet driver, which is invoked during the PCI probing phase, as explained earlier.

In other words, each function of the Ethernet API simply retrieves the *rte\_eth\_dev* structure associated with the device port identifier and performs an indirect invocation of the corresponding driver function supplied in the *eth\_dev\_ops* structure of the *rte\_eth\_dev* structure.

For performance reasons, the address of the burst-oriented Rx and Tx functions of the Ethernet driver are not contained in the *eth\_dev\_ops* structure. Instead, they are directly stored at the beginning of the *rte\_eth\_dev* structure to avoid an extra indirect memory access during their invocation.

RTE Ethernet device drivers do not use interrupts for transmitting or receiving. Instead, Ethernet drivers export Poll-Mode receive and transmit functions to applications. Both receive and transmit functions are packet-burst oriented to minimize their cost per packet through the following optimizations:

- •

  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.

Definition in file **rte\_ethdev.h**.

## Macro Definition Documentation

### #define RTE\_ETH\_FOREACH\_MATCHING\_DEV(id, devargs, iter)

**Value:**.PP

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

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

Definition at line **291** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_FIXED RTE\_BIT32(0)

Disable autoneg (fixed speed)

Definition at line **292** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_10M\_HD RTE\_BIT32(1)

10 Mbps half-duplex

Definition at line **293** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_10M RTE\_BIT32(2)

10 Mbps full-duplex

Definition at line **294** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_100M\_HD RTE\_BIT32(3)

100 Mbps half-duplex

Definition at line **295** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_100M RTE\_BIT32(4)

100 Mbps full-duplex

Definition at line **296** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_1G RTE\_BIT32(5)

1 Gbps

Definition at line **297** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_2\_5G RTE\_BIT32(6)

2\.5 Gbps

Definition at line **298** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_5G RTE\_BIT32(7)

5 Gbps

Definition at line **299** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_10G RTE\_BIT32(8)

10 Gbps

Definition at line **300** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_20G RTE\_BIT32(9)

20 Gbps

Definition at line **301** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_25G RTE\_BIT32(10)

25 Gbps

Definition at line **302** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_40G RTE\_BIT32(11)

40 Gbps

Definition at line **303** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_50G RTE\_BIT32(12)

50 Gbps

Definition at line **304** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_56G RTE\_BIT32(13)

56 Gbps

Definition at line **305** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_100G RTE\_BIT32(14)

100 Gbps

Definition at line **306** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_200G RTE\_BIT32(15)

200 Gbps

Definition at line **307** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_SPEED\_400G RTE\_BIT32(16)

400 Gbps

Definition at line **308** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_NUM\_NONE 0

Not defined

Definition at line **314** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_NUM\_10M 10

10 Mbps

Definition at line **315** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_NUM\_100M 100

100 Mbps

Definition at line **316** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_NUM\_1G 1000

1 Gbps

Definition at line **317** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_NUM\_2\_5G 2500

2\.5 Gbps

Definition at line **318** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_NUM\_5G 5000

5 Gbps

Definition at line **319** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_NUM\_10G 10000

10 Gbps

Definition at line **320** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_NUM\_20G 20000

20 Gbps

Definition at line **321** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_NUM\_25G 25000

25 Gbps

Definition at line **322** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_NUM\_40G 40000

40 Gbps

Definition at line **323** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_NUM\_50G 50000

50 Gbps

Definition at line **324** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_NUM\_56G 56000

56 Gbps

Definition at line **325** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_NUM\_100G 100000

100 Gbps

Definition at line **326** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_NUM\_200G 200000

200 Gbps

Definition at line **327** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_NUM\_400G 400000

400 Gbps

Definition at line **328** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_NUM\_UNKNOWN UINT32\_MAX

Unknown

Definition at line **329** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_HALF\_DUPLEX 0

Half-duplex connection (see link\_duplex).

Definition at line **351** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_FULL\_DUPLEX 1

Full-duplex connection (see link\_duplex).

Definition at line **352** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_DOWN 0

Link is down (see link\_status).

Definition at line **353** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_UP 1

Link is up (see link\_status).

Definition at line **354** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_FIXED 0

No autonegotiation (see link\_autoneg).

Definition at line **355** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_AUTONEG 1

Autonegotiated (see link\_autoneg).

Definition at line **356** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_LINK\_MAX\_STR\_LEN 40

Max length of default link string.

Definition at line **357** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_SPEED\_LANES\_TO\_CAPA(x) RTE\_BIT32(x)

Translate from link speed lanes to speed lanes capabilities.

Definition at line **361** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_MQ\_RX\_RSS\_FLAG RTE\_BIT32(0)

Enable RSS.

**See also**

**rte\_eth\_rss\_conf**

Definition at line **382** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_MQ\_RX\_DCB\_FLAG RTE\_BIT32(1)

Enable DCB.

Definition at line **383** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_MQ\_RX\_VMDQ\_FLAG RTE\_BIT32(2)

Enable VMDq.

Definition at line **384** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_FLOW\_PORT 18

Consider device port number as a flow differentiator

Definition at line **544** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_FLOW\_VXLAN 19

VXLAN protocol based flow

Definition at line **545** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_FLOW\_GENEVE 20

GENEVE protocol based flow

Definition at line **546** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_FLOW\_NVGRE 21

NVGRE protocol based flow

Definition at line **547** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_FLOW\_VXLAN\_GPE 22

VXLAN-GPE protocol based flow

Definition at line **548** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_FLOW\_GTPU 23

GTPU protocol based flow

Definition at line **549** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_RSS\_L4\_CHKSUM RTE\_BIT64(35)

The RTE\_ETH\_RSS\_L4\_CHKSUM works on checksum field of any L4 header. It is similar to RTE\_ETH\_RSS\_PORT that they don't specify the specific type of L4 header. This macro is defined to replace some specific L4 (TCP/UDP/SCTP) checksum type for constructing the use of RSS offload bits.

Due to above reason, some old APIs (and configuration) don't support RTE\_ETH\_RSS\_L4\_CHKSUM. The rte\_flow RSS API supports it.

For the case that checksum is not used in an UDP header, it takes the reserved value 0 as input for the hash function.

Definition at line **601** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_RSS\_LEVEL\_PMD\_DEFAULT (UINT64\_C(0) \<\< 50)

level 0, requests the default behavior. Depending on the packet type, it can mean outermost, innermost, anything in between or even no RSS. It basically stands for the innermost encapsulation level RSS can be performed on according to PMD and device capabilities.

Definition at line **648** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_RSS\_LEVEL\_OUTERMOST (UINT64\_C(1) \<\< 50)

level 1, requests RSS to be performed on the outermost packet encapsulation level.

Definition at line **654** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_RSS\_LEVEL\_INNERMOST (UINT64\_C(2) \<\< 50)

level 2, requests RSS to be performed on the specified inner packet encapsulation level, from outermost to innermost (lower to higher values).

Definition at line **660** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_RSS\_PROTO\_MASK

**Value:**.PP

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

Mask of valid RSS hash protocols

Definition at line **816** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_VMDQ\_MAX\_VLAN\_FILTERS 64

Maximum nb. of VMDq VLAN filters.

Definition at line **851** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DCB\_NUM\_USER\_PRIORITIES 8

Maximum nb. of DCB priorities.

Definition at line **852** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_VMDQ\_DCB\_NUM\_QUEUES 128

Maximum nb. of VMDq DCB queues.

Definition at line **853** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DCB\_NUM\_QUEUES 128

Maximum nb. of DCB queues.

Definition at line **854** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DCB\_PG\_SUPPORT RTE\_BIT32(0)

Priority Group(ETS) support.

Definition at line **858** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DCB\_PFC\_SUPPORT RTE\_BIT32(1)

Priority Flow Control support.

Definition at line **859** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_VLAN\_STRIP\_OFFLOAD 0x0001

VLAN Strip On/Off

Definition at line **863** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_VLAN\_FILTER\_OFFLOAD 0x0002

VLAN Filter On/Off

Definition at line **864** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_VLAN\_EXTEND\_OFFLOAD 0x0004

VLAN Extend On/Off

Definition at line **865** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_QINQ\_STRIP\_OFFLOAD 0x0008

QINQ Strip On/Off

Definition at line **866** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_VLAN\_STRIP\_MASK 0x0001

VLAN Strip setting mask

Definition at line **868** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_VLAN\_FILTER\_MASK 0x0002

VLAN Filter setting mask

Definition at line **869** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_VLAN\_EXTEND\_MASK 0x0004

VLAN Extend setting mask

Definition at line **870** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_QINQ\_STRIP\_MASK 0x0008

QINQ Strip setting mask

Definition at line **871** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_VLAN\_ID\_MAX 0x0FFF

VLAN ID is in lower 12 bits

Definition at line **872** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_NUM\_RECEIVE\_MAC\_ADDR 128

Maximum nb. of receive mac addr.

Definition at line **876** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_VMDQ\_NUM\_UC\_HASH\_ARRAY 128

Maximum nb. of UC hash array.

Definition at line **879** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_VMDQ\_ACCEPT\_UNTAG RTE\_BIT32(0)

Accept untagged packets.

Definition at line **885** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_VMDQ\_ACCEPT\_HASH\_MC RTE\_BIT32(1)

Accept packets in multicast table.

Definition at line **887** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_VMDQ\_ACCEPT\_HASH\_UC RTE\_BIT32(2)

Accept packets in unicast table.

Definition at line **889** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_VMDQ\_ACCEPT\_BROADCAST RTE\_BIT32(3)

Accept broadcast packets.

Definition at line **891** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_VMDQ\_ACCEPT\_MULTICAST RTE\_BIT32(4)

Multicast promiscuous.

Definition at line **893** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_RX\_OFFLOAD\_VLAN\_STRIP RTE\_BIT64(0)

Rx offload capabilities of a device.

Definition at line **1552** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_RX\_OFFLOAD\_TIMESTAMP RTE\_BIT64(14)

Timestamp is set by the driver in RTE\_MBUF\_DYNFIELD\_TIMESTAMP\_NAME and RTE\_MBUF\_DYNFLAG\_RX\_TIMESTAMP\_NAME is set in ol\_flags. The mbuf field and flag are registered when the offload is configured.

Definition at line **1568** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_OFFLOAD\_VLAN\_INSERT RTE\_BIT64(0)

Tx offload capabilities of a device.

Definition at line **1592** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_OFFLOAD\_OUTER\_IPV4\_CKSUM RTE\_BIT64(7)

Used for tunneling packet.

Definition at line **1599** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_OFFLOAD\_VXLAN\_TNL\_TSO RTE\_BIT64(9)

Used for tunneling packet.

Definition at line **1601** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_OFFLOAD\_GRE\_TNL\_TSO RTE\_BIT64(10)

Used for tunneling packet.

Definition at line **1602** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_OFFLOAD\_IPIP\_TNL\_TSO RTE\_BIT64(11)

Used for tunneling packet.

Definition at line **1603** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_OFFLOAD\_GENEVE\_TNL\_TSO RTE\_BIT64(12)

Used for tunneling packet.

Definition at line **1604** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_OFFLOAD\_MT\_LOCKFREE RTE\_BIT64(14)

Multiple threads can invoke **rte\_eth\_tx\_burst()** concurrently on the same Tx queue without SW lock.

Definition at line **1610** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_OFFLOAD\_MULTI\_SEGS RTE\_BIT64(15)

Device supports multi segment send.

Definition at line **1612** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_OFFLOAD\_MBUF\_FAST\_FREE RTE\_BIT64(16)

Device supports optimization for fast release of mbufs. When set application must guarantee that per-queue all mbufs comes from the same mempool and has refcnt = 1.

Definition at line **1618** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_OFFLOAD\_UDP\_TNL\_TSO RTE\_BIT64(18)

Device supports generic UDP tunneled packet TSO. Application must set RTE\_MBUF\_F\_TX\_TUNNEL\_UDP and other mbuf fields required for tunnel TSO.

Definition at line **1625** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_OFFLOAD\_IP\_TNL\_TSO RTE\_BIT64(19)

Device supports generic IP tunneled packet TSO. Application must set RTE\_MBUF\_F\_TX\_TUNNEL\_IP and other mbuf fields required for tunnel TSO.

Definition at line **1631** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_OFFLOAD\_OUTER\_UDP\_CKSUM RTE\_BIT64(20)

Device supports outer UDP checksum

Definition at line **1633** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_OFFLOAD\_SEND\_ON\_TIMESTAMP RTE\_BIT64(21)

Device sends on time read from RTE\_MBUF\_DYNFIELD\_TIMESTAMP\_NAME if RTE\_MBUF\_DYNFLAG\_TX\_TIMESTAMP\_NAME is set in ol\_flags. The mbuf field and flag are registered when the offload is configured.

Definition at line **1639** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DEV\_CAPA\_RUNTIME\_RX\_QUEUE\_SETUP RTE\_BIT64(0)

Device supports Rx queue setup after device started.

Definition at line **1649** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DEV\_CAPA\_RUNTIME\_TX\_QUEUE\_SETUP RTE\_BIT64(1)

Device supports Tx queue setup after device started.

Definition at line **1651** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DEV\_CAPA\_RXQ\_SHARE RTE\_BIT64(2)

Device supports shared Rx queue among ports within Rx domain and switch domain. Mbufs are consumed by shared Rx queue instead of each queue. Multiple groups are supported by share\_group of Rx queue configuration. Shared Rx queue is identified by PMD using share\_qid of Rx queue configuration. Polling any port in the group receive packets of all member ports, source port identified by mbuf-\>port field.

Definition at line **1661** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DEV\_CAPA\_FLOW\_RULE\_KEEP RTE\_BIT64(3)

Device supports keeping flow rules across restart.

Definition at line **1663** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DEV\_CAPA\_FLOW\_SHARED\_OBJECT\_KEEP RTE\_BIT64(4)

Device supports keeping shared flow objects across restart.

Definition at line **1665** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DEV\_SWITCH\_DOMAIN\_ID\_INVALID (UINT16\_MAX)

Default values for switch domain ID when ethdev does not support switch domain definitions.

Definition at line **1693** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_QUEUE\_STATE\_STOPPED 0

Queue stopped.

Definition at line **1852** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_QUEUE\_STATE\_STARTED 1

Queue started.

Definition at line **1853** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_QUEUE\_STATE\_HAIRPIN 2

Queue used for hairpin.

Definition at line **1854** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_BURST\_FLAG\_PER\_QUEUE RTE\_BIT64(0)

If the queues have different burst mode description, this bit will be set by PMD, then the application can iterate to retrieve burst description for all other queues.

Definition at line **1918** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_BURST\_MODE\_INFO\_SIZE 1024

Maximum size for information

Definition at line **1927** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_XSTATS\_NAME\_SIZE 64

Maximum name length for extended statistics counters

Definition at line **1932** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DEV\_FLOW\_OPS\_THREAD\_SAFE RTE\_BIT32(0)

PMD supports thread-safe flow operations

Definition at line **2124** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DEV\_INTR\_LSC RTE\_BIT32(1)

Device supports link state interrupt

Definition at line **2126** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DEV\_BONDING\_MEMBER RTE\_BIT32(2)

Device is a bonding member

Definition at line **2128** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DEV\_INTR\_RMV RTE\_BIT32(3)

Device supports device removal interrupt

Definition at line **2130** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DEV\_REPRESENTOR RTE\_BIT32(4)

Device is port representor

Definition at line **2132** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DEV\_NOLIVE\_MAC\_ADDR RTE\_BIT32(5)

Device does not support MAC change after started

Definition at line **2134** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_DEV\_AUTOFILL\_QUEUE\_XSTATS RTE\_BIT32(6)

Queue xstats filled automatically by ethdev layer. PMDs filling the queue xstats themselves should not set this flag

Definition at line **2139** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_FOREACH\_DEV\_OWNED\_BY(p, o)

**Value:**.PP

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

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

Definition at line **2159** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_FOREACH\_DEV(p) RTE\_ETH\_FOREACH\_DEV\_OWNED\_BY(p, RTE\_ETH\_DEV\_NO\_OWNER)

Macro to iterate over all enabled and ownerless ethdev ports.

Definition at line **2177** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_FOREACH\_DEV\_OF(port\_id, parent)

**Value:**.PP

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

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

**Parameters**

*port\_id* The ID of the matching port being iterated. \
 *parent* The rte\_device pointer matching the iterated ports.

Definition at line **2203** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_FOREACH\_DEV\_SIBLING(port\_id, ref\_port\_id)

**Value:**.PP

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

Macro to iterate over all ethdev ports sharing the same rte\_device as the specified port. Note: the specified reference port is part of the loop iterations.

**Parameters**

*port\_id* The ID of the matching port being iterated. \
 *ref\_port\_id* The ID of the port being compared.

Definition at line **2232** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_BUFFER\_SIZE(sz) (sizeof(struct rte\_eth\_dev\_tx\_buffer) + (sz) \* sizeof(struct rte\_mbuf \*))

Calculate the size of the Tx buffer.

**Parameters**

*sz* Number of stored packets.

Definition at line **3851** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_RX\_METADATA\_USER\_FLAG RTE\_BIT64(0)

The NIC is able to deliver flag (if set) with packets to the PMD.

Definition at line **5723** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_RX\_METADATA\_USER\_MARK RTE\_BIT64(1)

The NIC is able to deliver mark ID with packets to the PMD.

Definition at line **5726** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_RX\_METADATA\_TUNNEL\_ID RTE\_BIT64(2)

The NIC is able to deliver tunnel ID with packets to the PMD.

Definition at line **5729** 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 **5773** 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 **5775** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_RX\_DESC\_AVAIL 0

Desc available for hw.

Definition at line **6371** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_RX\_DESC\_DONE 1

Desc done, filled by hw.

Definition at line **6372** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_RX\_DESC\_UNAVAIL 2

Desc used by driver or hw.

Definition at line **6373** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_DESC\_FULL 0

Desc filled for hw, waiting xmit.

Definition at line **6443** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_DESC\_DONE 1

Desc done, packet is transmitted.

Definition at line **6444** of file **rte\_ethdev.h**.

### #define RTE\_ETH\_TX\_DESC\_UNAVAIL 2

Desc used by driver or hw.

Definition at line **6445** 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 **2061** 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 **2085** of file **rte\_ethdev.h**.

### typedef int(\* rte\_eth\_dev\_cb\_fn) (uint16\_t port\_id, enum rte\_eth\_event\_type event, void \*cb\_arg, void \*ret\_param)

User application callback to be registered for interrupts.

Note: there is no guarantee in the DPDK drivers that a callback won't be called in the middle of other parts of the ethdev API. For example, imagine that thread A calls **rte\_eth\_dev\_start()** and as part of this call, a RTE\_ETH\_EVENT\_INTR\_RESET event gets generated and the associated callback is ran on thread A. In that example, if the application protects its internal data using locks before calling **rte\_eth\_dev\_start()**, and the callback takes a same lock, a deadlock occurs. Because of this, it is highly recommended NOT to take locks in those callbacks.

Definition at line **4209** of file **rte\_ethdev.h**.

## Enumeration Type Documentation

### enum rte\_eth\_rx\_mq\_mode

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

**Enumerator**

- *RTE\_ETH\_MQ\_RX\_NONE*

  *None of DCB, RSS or VMDq mode*

- *RTE\_ETH\_MQ\_RX\_RSS*

  *For Rx side, only RSS is on*

- *RTE\_ETH\_MQ\_RX\_DCB*

  *For Rx side,only DCB is on.*

- *RTE\_ETH\_MQ\_RX\_DCB\_RSS*

  *Both DCB and RSS enable*

- *RTE\_ETH\_MQ\_RX\_VMDQ\_ONLY*

  *Only VMDq, no RSS nor DCB*

- *RTE\_ETH\_MQ\_RX\_VMDQ\_RSS*

  *RSS mode with VMDq*

- *RTE\_ETH\_MQ\_RX\_VMDQ\_DCB*

  *Use VMDq+DCB to route traffic to queues*

- *RTE\_ETH\_MQ\_RX\_VMDQ\_DCB\_RSS*

  *Enable both VMDq and DCB in VMDq*

*Definition at line* **391** *of file* **rte\_ethdev.h***.*

### enum rte\_eth\_tx\_mq\_mode

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

**Enumerator**

- *RTE\_ETH\_MQ\_TX\_NONE*

  *It is in neither DCB nor VT mode.*

- *RTE\_ETH\_MQ\_TX\_DCB*

  *For Tx side,only DCB is on.*

- *RTE\_ETH\_MQ\_TX\_VMDQ\_DCB*

  *For Tx side,both DCB and VT is on.*

- *RTE\_ETH\_MQ\_TX\_VMDQ\_ONLY*

  *Only VT on, no DCB*

*Definition at line* **417** *of file* **rte\_ethdev.h***.*

### enum rte\_vlan\_type

*VLAN types to indicate if it is for single VLAN, inner VLAN or outer VLAN. Note that single VLAN is treated the same as inner VLAN.*

**Enumerator**

- *RTE\_ETH\_VLAN\_TYPE\_INNER*

  *Inner VLAN.*

- *RTE\_ETH\_VLAN\_TYPE\_OUTER*

  *Single VLAN, or outer VLAN.*

*Definition at line* **448** *of file* **rte\_ethdev.h***.*

### enum rte\_eth\_hash\_function

*Hash function types.*

**Enumerator**

- *RTE\_ETH\_HASH\_FUNCTION\_DEFAULT*

  *DEFAULT means driver decides which hash algorithm to pick.*

- *RTE\_ETH\_HASH\_FUNCTION\_TOEPLITZ*

  *Toeplitz*

- *RTE\_ETH\_HASH\_FUNCTION\_SIMPLE\_XOR*

  *Simple XOR*

- *RTE\_ETH\_HASH\_FUNCTION\_SYMMETRIC\_TOEPLITZ*

  *Symmetric Toeplitz: src, dst will be replaced by xor(src, dst). For the case with src/dst only, src or dst address will xor with zero pair.*

- *RTE\_ETH\_HASH\_FUNCTION\_SYMMETRIC\_TOEPLITZ\_SORT*

  *Symmetric Toeplitz: L3 and L4 fields are sorted prior to the hash function. If src\_ip \> dst\_ip, swap src\_ip and dst\_ip. If src\_port \> dst\_port, swap src\_port and dst\_port.*

*Definition at line* **466** *of file* **rte\_ethdev.h***.*

### enum rte\_eth\_nb\_tcs

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

**Enumerator**

- *RTE\_ETH\_4\_TCS*

  *4 TCs with DCB.*

- *RTE\_ETH\_8\_TCS*

  *8 TCs with DCB.*

*Definition at line* **913** *of file* **rte\_ethdev.h***.*

### enum rte\_eth\_nb\_pools

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

**Enumerator**

- *RTE\_ETH\_8\_POOLS*

  *8 VMDq pools.*

- *RTE\_ETH\_16\_POOLS*

  *16 VMDq pools.*

- *RTE\_ETH\_32\_POOLS*

  *32 VMDq pools.*

- *RTE\_ETH\_64\_POOLS*

  *64 VMDq pools.*

*Definition at line* **922** *of file* **rte\_ethdev.h***.*

### enum rte\_eth\_fc\_mode

*This enum indicates the flow control mode*

**Enumerator**

- *RTE\_ETH\_FC\_NONE*

  *Disable flow control.*

- *RTE\_ETH\_FC\_RX\_PAUSE*

  *Rx pause frame, enable flowctrl on Tx side.*

- *RTE\_ETH\_FC\_TX\_PAUSE*

  *Tx pause frame, enable flowctrl on Rx side.*

- *RTE\_ETH\_FC\_FULL*

  *Enable flow control on both side.*

*Definition at line* **1365** *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* **1454** *of file* **rte\_ethdev.h***.*

### enum rte\_eth\_representor\_type

*Ethernet device information Ethernet device representor port type.*

**Enumerator**

- *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* **1739** *of file* **rte\_ethdev.h***.*

### enum rte\_eth\_err\_handle\_mode

**Warning**

**EXPERIMENTAL:** *this enumeration may change without prior notice.*

*Ethernet device error handling mode.*

**Enumerator**

- *RTE\_ETH\_ERROR\_HANDLE\_MODE\_NONE*

  *No error handling modes are supported.*

- *RTE\_ETH\_ERROR\_HANDLE\_MODE\_PASSIVE*

  *Passive error handling, after the PMD detects that a reset is required, the PMD reports*

**See also**

**RTE\_ETH\_EVENT\_INTR\_RESET** *event, and the application invokes*

**rte\_eth\_dev\_reset** *to recover the port.*

- *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\_RECOVERING** *event, do recovery internally, and finally reports the recovery result event (*

*RTE\_ETH\_EVENT\_RECOVERY\_\*).*

*Definition at line* **1752** *of file* **rte\_ethdev.h***.*

### enum rte\_eth\_fec\_mode

*This enum indicates the possible Forward Error Correction (FEC) modes of an ethdev port.*

**Enumerator**

- *RTE\_ETH\_FEC\_NOFEC*

  *FEC is off*

- *RTE\_ETH\_FEC\_AUTO*

  *FEC autonegotiation modes*

- *RTE\_ETH\_FEC\_BASER*

  *FEC using common algorithm*

- *RTE\_ETH\_FEC\_RS*

  *FEC using RS algorithm*

- *RTE\_ETH\_FEC\_LLRS*

  *FEC using LLRS algorithm*

*Definition at line* **2002** *of file* **rte\_ethdev.h***.*

### enum rte\_eth\_dev\_state

*Possible states of an ethdev port.*

**Enumerator**

- *RTE\_ETH\_DEV\_UNUSED*

  *Device is unused before being probed.*

- *RTE\_ETH\_DEV\_ATTACHED*

  *Device is attached when allocated in probing.*

- *RTE\_ETH\_DEV\_REMOVED*

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

*Definition at line* **2091** *of file* **rte\_ethdev.h***.*

### enum rte\_eth\_event\_macsec\_subtype

*Subtypes for MACsec offload event (***RTE\_ETH\_EVENT\_MACSEC***) raised by Ethernet device.*

**Enumerator**

- *RTE\_ETH\_SUBEVENT\_MACSEC\_UNKNOWN*

  *Notifies unknown MACsec subevent.*

- *RTE\_ETH\_SUBEVENT\_MACSEC\_RX\_SECTAG\_V\_EQ1*

  *Subevent of RTE\_ETH\_EVENT\_MACSEC\_SECTAG\_VAL\_ERR sectag validation events Validation check: SecTag.TCI.V = 1*

- *RTE\_ETH\_SUBEVENT\_MACSEC\_RX\_SECTAG\_E\_EQ0\_C\_EQ1*

  *Subevent of RTE\_ETH\_EVENT\_MACSEC\_SECTAG\_VAL\_ERR sectag validation events Validation check: SecTag.TCI.E = 0 && SecTag.TCI.C = 1*

- *RTE\_ETH\_SUBEVENT\_MACSEC\_RX\_SECTAG\_SL\_GTE48*

  *Subevent of RTE\_ETH\_EVENT\_MACSEC\_SECTAG\_VAL\_ERR sectag validation events Validation check: SecTag.SL \>= 'd48*

- *RTE\_ETH\_SUBEVENT\_MACSEC\_RX\_SECTAG\_ES\_EQ1\_SC\_EQ1*

  *Subevent of RTE\_ETH\_EVENT\_MACSEC\_SECTAG\_VAL\_ERR sectag validation events Validation check: SecTag.TCI.ES = 1 && SecTag.TCI.SC = 1*

- *RTE\_ETH\_SUBEVENT\_MACSEC\_RX\_SECTAG\_SC\_EQ1\_SCB\_EQ1*

  *Subevent of RTE\_ETH\_EVENT\_MACSEC\_SECTAG\_VAL\_ERR sectag validation events Validation check: SecTag.TCI.SC = 1 && SecTag.TCI.SCB = 1*

*Definition at line* **3980** *of file* **rte\_ethdev.h***.*

### enum rte\_eth\_event\_macsec\_type

*Event types for MACsec offload event (***RTE\_ETH\_EVENT\_MACSEC***) raised by eth device.*

**Enumerator**

- *RTE\_ETH\_EVENT\_MACSEC\_UNKNOWN*

  *Notifies 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 Invalid SA event.*

*Definition at line* **4014** *of file* **rte\_ethdev.h***.*

### enum rte\_eth\_event\_ipsec\_subtype

*Subtypes for IPsec offload event(***RTE\_ETH\_EVENT\_IPSEC***) raised by eth device.*

**Enumerator**

- *RTE\_ETH\_EVENT\_IPSEC\_PMD\_ERROR\_START*

  *PMD specific error start*

- *RTE\_ETH\_EVENT\_IPSEC\_PMD\_ERROR\_END*

  *PMD specific error end*

- *RTE\_ETH\_EVENT\_IPSEC\_UNKNOWN*

  *Unknown event type*

- *RTE\_ETH\_EVENT\_IPSEC\_ESN\_OVERFLOW*

  *Sequence number overflow*

- *RTE\_ETH\_EVENT\_IPSEC\_SA\_TIME\_EXPIRY*

  *Soft time expiry of SA*

- *RTE\_ETH\_EVENT\_IPSEC\_SA\_BYTE\_EXPIRY*

  *Soft byte expiry of SA determined by* **rte\_security\_ipsec\_lifetime::bytes\_soft\_limit**

- *RTE\_ETH\_EVENT\_IPSEC\_SA\_PKT\_EXPIRY*

  *Soft packet expiry of SA determined by* **rte\_security\_ipsec\_lifetime::packets\_soft\_limit**

- *RTE\_ETH\_EVENT\_IPSEC\_SA\_BYTE\_HARD\_EXPIRY*

  *Hard byte expiry of SA determined by* **rte\_security\_ipsec\_lifetime::bytes\_hard\_limit**

- *RTE\_ETH\_EVENT\_IPSEC\_SA\_PKT\_HARD\_EXPIRY*

  *Hard packet expiry of SA determined by* **rte\_security\_ipsec\_lifetime::packets\_hard\_limit**

- *RTE\_ETH\_EVENT\_IPSEC\_MAX*

  *Max value of this enum*

*Definition at line* **4056** *of file* **rte\_ethdev.h***.*

### enum rte\_eth\_event\_type

*The eth device event type for interrupt, and maybe others in the future.*

**Enumerator**

- *RTE\_ETH\_EVENT\_UNKNOWN*

  *unknown event type*

- *RTE\_ETH\_EVENT\_INTR\_LSC*

  *lsc interrupt event*

- *RTE\_ETH\_EVENT\_QUEUE\_STATE*

  *queue state event (enabled/disabled)*

- *RTE\_ETH\_EVENT\_INTR\_RESET*

  *reset interrupt event, sent to VF on PF reset*

- *RTE\_ETH\_EVENT\_VF\_MBOX*

  *message from the VF received by PF*

- *RTE\_ETH\_EVENT\_MACSEC*

  *MACsec offload related event*

- *RTE\_ETH\_EVENT\_INTR\_RMV*

  *device removal event*

- *RTE\_ETH\_EVENT\_NEW*

  *port is probed*

- *RTE\_ETH\_EVENT\_DESTROY*

  *port is released*

- *RTE\_ETH\_EVENT\_IPSEC*

  *IPsec offload related event*

- *RTE\_ETH\_EVENT\_FLOW\_AGED*

  *New aged-out flows is detected*

- *RTE\_ETH\_EVENT\_RX\_AVAIL\_THRESH*

  *Number of available Rx descriptors is smaller than the threshold.*

**See also**

**rte\_eth\_rx\_avail\_thresh\_set()**

- *RTE\_ETH\_EVENT\_ERR\_RECOVERING*

  *Port recovering from a hardware or firmware error. If PMD supports proactive error recovery, it should trigger this event to notify application that it detected an error and the recovery is being started. Upon receiving the event, the application should not invoke any control path API (such as rte\_eth\_dev\_configure/rte\_eth\_dev\_stop...) until receiving RTE\_ETH\_EVENT\_RECOVERY\_SUCCESS or RTE\_ETH\_EVENT\_RECOVERY\_FAILED event. The PMD will set the data path pointers to dummy functions, and re-set the data path pointers to non-dummy functions before reporting RTE\_ETH\_EVENT\_RECOVERY\_SUCCESS event. It means that the application cannot send or receive any packets during this period.*

**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*

  *Port recovers successfully from the error. The PMD already re-configured the port, and the effect is the same as a restart operation. a) The following operation will be retained: (alphabetically)*

- •

  *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) The following configuration maybe retained or not depending on the device capabilities:*

- •

  *flow rules (*

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

- *RTE\_ETH\_EVENT\_RECOVERY\_FAILED*

  *Port recovery failed. It means that the port should not be usable anymore. The application should close the port.*

- *RTE\_ETH\_EVENT\_MAX*

  *max value of this enum*

*Definition at line* **4121** *of file* **rte\_ethdev.h***.*

### enum rte\_eth\_cman\_obj

*Enumerate list of ethdev congestion management objects*

**Enumerator**

- *RTE\_ETH\_CMAN\_OBJ\_RX\_QUEUE*

  *Congestion management based on Rx queue depth*

- *RTE\_ETH\_CMAN\_OBJ\_RX\_QUEUE\_MEMPOOL*

  *Congestion management based on mempool depth associated with Rx queue*

**See also**

**rte\_eth\_rx\_queue\_setup()**

*Definition at line* **5977** *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 allows accessing a list of devices matching some devargs.*

**Parameters**

*iter Device iterator handle initialized by the function. The fields bus\_str and cls\_str might be dynamically allocated, and could be freed by calling* **rte\_eth\_iterator\_cleanup()***.*\
 *devargs Device description string.*

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

*The next port ID is returned, and the iterator is updated.*

**Parameters**

*iter Device iterator handle initialized by* **rte\_eth\_iterator\_init()***. Some fields bus\_str and cls\_str might be freed when no more port is found, by calling* **rte\_eth\_iterator\_cleanup()***.*

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

**Parameters**

*iter Device iterator handle initialized by* **rte\_eth\_iterator\_init()***. The fields bus\_str and cls\_str are freed if needed.*

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

**Parameters**

*rss\_hf RSS types with SRC/DST\_ONLY.*

**Returns**

*RSS types.*

*Definition at line* **676** *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\_OWNER means 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).*

**Parameters**

*port\_id\_start The ID of the next possible valid sibling port.* \
 *ref\_port\_id The ID of a reference port to compare rte\_device with.*

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

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

**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 Mbps* \
 *duplex 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.*

*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. 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. The* **rte\_eth\_conf structure includes:**

- •

  **the hardware offload features to activate, with dedicated fields for each statically configurable offload hardware feature provided by Ethernet devices, such as IP checksum or VLAN tag stripping for example. The Rx offload bitfield API is obsolete and will be deprecated. Applications should set the ignore\_bitfield\_offloads bit on** *rxmode* **structure and use offloads field to set per-port offloads instead.**

- •

  **Any offloading set in eth\_conf-\>\[rt\]xmode.offloads must be within the \[rt\]x\_offload\_capa returned from rte\_eth\_dev\_info\_get(). Any type of device supported offloading set in the input argument eth\_conf-\>\[rt\]xmode.offloads to rte\_eth\_dev\_configure() is enabled on all queues and it can't be disabled in rte\_eth\_\[rt\]x\_queue\_setup()**

- •

  **the Receive Side Scaling (RSS) configuration when using multiple Rx queues per port. Any RSS hash function set in eth\_conf-\>rss\_conf.rss\_hf must be within the flow\_type\_rss\_offloads provided by drivers via rte\_eth\_dev\_info\_get() API.**

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

**Returns**

- •

  **0: Success, device configured.**

- •

  **\<0: Error code returned by the driver configuration function.**

### int rte\_eth\_dev\_is\_removed (uint16\_t port\_id)

**Check if an Ethernet device was physically removed.**

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

**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 to rte\_eth\_dev\_configure().** \
 *nb\_rx\_desc* **The number of receive descriptors to allocate for the receive ring.** \
 *socket\_id* **The** *socket\_id* **argument is the socket identifier in case of NUMA. The value can be** *SOCKET\_ID\_ANY* **if there is no NUMA constraint for the DMA memory allocated for the receive descriptors of the ring.** \
 *rx\_conf* **The pointer to the configuration data to be used for the receive queue. NULL value is allowed, in which case default Rx configuration will be used. The** *rx\_conf* **structure contains an** *rx\_thresh* **structure with the values of the Prefetch, Host, and Write-Back threshold registers of the receive ring. In addition it contains the hardware offloads features to activate using the RTE\_ETH\_RX\_OFFLOAD\_\* flags. If an offloading set in rx\_conf-\>offloads hasn't been set in the input argument eth\_conf-\>rxmode.offloads to rte\_eth\_dev\_configure(), it is a new added offloading, it must be per-queue type and it is enabled for the queue. No need to repeat any bit in rx\_conf-\>offloads which has already been enabled in rte\_eth\_dev\_configure() at port level. An offloading enabled at port level can't be disabled at queue level. The configuration structure also contains the pointer to the array of the receiving buffer segment descriptions, see rx\_seg and rx\_nseg fields, this extended configuration might be used by split offloads like RTE\_ETH\_RX\_OFFLOAD\_BUFFER\_SPLIT. If mb\_pool is not NULL, the extended configuration fields must be set to NULL and zero.** \
 *mb\_pool* **The pointer to the memory pool from which to allocate rte\_mbuf network memory buffers to populate each descriptor of the receive ring. There are two options to provide Rx buffer configuration:**

- •

  **single pool: mb\_pool is not NULL, rx\_conf.rx\_nseg is 0.**

- •

  **multiple segments description: mb\_pool is NULL, rx\_conf.rx\_seg is not NULL, rx\_conf.rx\_nseg is not 0. Taken only if flag RTE\_ETH\_RX\_OFFLOAD\_BUFFER\_SPLIT is set in offloads.**

**Returns**

- •

  **0: Success, receive queue correctly set up.**

- •

  **-EIO: if device is removed.**

- •

  **-ENODEV: if** *port\_id* **is 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**

**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 to rte\_eth\_dev\_configure().** \
 *nb\_rx\_desc* **The number of receive descriptors to allocate for the receive ring. 0 means the PMD will use default value.** \
 *conf* **The pointer to the hairpin configuration.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENODEV) if** *port\_id* **is 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 to rte\_eth\_dev\_configure().** \
 *nb\_tx\_desc* **The number of transmit descriptors to allocate for the transmit ring.** \
 *socket\_id* **The** *socket\_id* **argument is the socket identifier in case of NUMA. Its value can be** *SOCKET\_ID\_ANY* **if there is no NUMA constraint for the DMA memory allocated for the transmit descriptors of the ring.** \
 *tx\_conf* **The pointer to the configuration data to be used for the transmit queue. NULL value is allowed, in which case default Tx configuration will be used. The** *tx\_conf* **structure contains the following data:**

- •

  **The** *tx\_thresh* **structure with the values of the Prefetch, Host, and Write-Back threshold registers of the transmit ring. When setting Write-Back threshold to the value greater then zero,** *tx\_rs\_thresh* **value should be explicitly set to one.**

- •

  **The** *tx\_free\_thresh* **value indicates the \[minimum\] number of network buffers that must be pending in the transmit ring to trigger their \[implicit\] freeing by the driver transmit function.**

- •

  **The** *tx\_rs\_thresh* **value indicates the \[minimum\] number of transmit descriptors that must be pending in the transmit ring before setting the RS bit on a descriptor by the driver transmit function. The** *tx\_rs\_thresh* **value should be less or equal then** *tx\_free\_thresh* **value, and both of them should be less then** *nb\_tx\_desc* **- 3.**

- •

  **The** *offloads* **member contains Tx offloads to be enabled. If an offloading set in tx\_conf-\>offloads hasn't been set in the input argument eth\_conf-\>txmode.offloads to rte\_eth\_dev\_configure(), it is a new added offloading, it must be per-queue type and it is enabled for the queue. No need to repeat any bit in tx\_conf-\>offloads which has already been enabled in rte\_eth\_dev\_configure() at port level. An offloading enabled at port level can't be disabled at queue level.**

**Note that setting** *tx\_free\_thresh* **or** *tx\_rs\_thresh* **value to 0 forces the transmit function to use default values.**

**Returns**

- •

  **0: Success, the transmit queue is correctly set up.**

- •

  **-ENOMEM: Unable to allocate the transmit ring descriptors.**

### \_\_rte\_experimental int rte\_eth\_tx\_hairpin\_queue\_setup (uint16\_t port\_id, uint16\_t tx\_queue\_id, uint16\_t nb\_tx\_desc, const struct rte\_eth\_hairpin\_conf \* conf)

**Warning**

**EXPERIMENTAL: this API may change, or be removed, without prior notice**

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

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *tx\_queue\_id* **The index of the transmit queue to set up. The value must be in the range \[0, nb\_tx\_queue - 1\] previously supplied to rte\_eth\_dev\_configure().** \
 *nb\_tx\_desc* **The number of transmit descriptors to allocate for the transmit ring. 0 to set default PMD value.** \
 *conf* **The hairpin configuration.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENODEV) if** *port\_id* **is 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**

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

**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) if** *port\_id* **invalid**

- •

  **(-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.**

**Parameters**

*tx\_port* **The identifier of the Tx port.** \
 *rx\_port* **The identifier of peer Rx port. RTE\_MAX\_ETHPORTS is allowed for the traversal of all devices. Rx port ID could have the same value as Tx port ID.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENODEV) if Tx port ID is invalid.**

- •

  **(-EBUSY) if device is not in started state.**

- •

  **(-ENOTSUP) if hardware doesn't support.**

- •

  **Others detailed errors from PMDs.**

### \_\_rte\_experimental int rte\_eth\_hairpin\_unbind (uint16\_t tx\_port, uint16\_t rx\_port)

**Warning**

**EXPERIMENTAL: this API may change, or be removed, without prior notice**

**Unbind all hairpin Tx queues of one port from the Rx queues of the peer port. This should be called before closing the Tx or Rx devices, if the bind function is called before. After unbinding the hairpin ports pair, it is allowed to bind them again. Changing queues configuration should be after stopping the device(s).**

**Parameters**

*tx\_port* **The identifier of the Tx port.** \
 *rx\_port* **The identifier of peer Rx port. RTE\_MAX\_ETHPORTS is allowed for traversal of all devices. Rx port ID could have the same value as Tx port ID.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENODEV) if Tx port ID is invalid.**

- •

  **(-EBUSY) if device is in stopped state.**

- •

  **(-ENOTSUP) if hardware doesn't support.**

- •

  **Others detailed errors from PMDs.**

### \_\_rte\_experimental int rte\_eth\_dev\_count\_aggr\_ports (uint16\_t port\_id)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Get the number of aggregated ports of the DPDK port (specified with port\_id). It is used when multiple ports are aggregated into a single one.**

**For the regular physical port doesn't have aggregated ports, the number of aggregated ports is reported as 0.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.**

**Returns**

- •

  **(\>=0) the number of aggregated port if success.**

### \_\_rte\_experimental int rte\_eth\_dev\_map\_aggr\_tx\_affinity (uint16\_t port\_id, uint16\_t tx\_queue\_id, uint8\_t affinity)

**Warning**

**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, it allows to choose which port to use for Tx via a queue.**

**The application should use rte\_eth\_dev\_map\_aggr\_tx\_affinity() after rte\_eth\_dev\_configure(), rte\_eth\_tx\_queue\_setup(), and before rte\_eth\_dev\_start().**

**Parameters**

*port\_id* **The identifier of the port used in rte\_eth\_tx\_burst().** \
 *tx\_queue\_id* **The index of the transmit queue used in rte\_eth\_tx\_burst(). The value must be in the range \[0, nb\_tx\_queue - 1\] previously supplied to rte\_eth\_dev\_configure().** \
 *affinity* **The number of the aggregated port. Value 0 means no affinity and traffic could be routed to any aggregated port. The first aggregated port is number 1 and so on. The maximum number is given by rte\_eth\_dev\_count\_aggr\_ports().**

**Returns**

**Zero if successful. Non-zero otherwise.**

### 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 to SOCKET\_ID\_ANY) if the socket could not be determined. rte\_errno is then set to:**

- •

  **EINVAL is the port\_id is invalid,**

- •

  **0 is the socket could not be determined,**

### int rte\_eth\_dev\_is\_valid\_port (uint16\_t port\_id)

**Check if port\_id of device is attached**

**Parameters**

*port\_id* **The port identifier of the Ethernet device**

**Returns**

- •

  **0 if port is out of range or not attached**

- •

  **1 if device is attached**

### \_\_rte\_experimental int rte\_eth\_rx\_queue\_is\_valid (uint16\_t port\_id, uint16\_t queue\_id)

**Warning**

**EXPERIMENTAL: this API may change, or be removed, without prior notice.**

**Check if Rx queue is valid. 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 receive queue.**

**Returns**

- •

  **-ENODEV: if port\_id is invalid.**

- •

  **-EINVAL: if queue\_id is out of range or queue has not been setup.**

- •

  **0 if Rx queue is valid.**

### \_\_rte\_experimental int rte\_eth\_tx\_queue\_is\_valid (uint16\_t port\_id, uint16\_t queue\_id)

**Warning**

**EXPERIMENTAL: this API may change, or be removed, without prior notice.**

**Check if Tx queue is valid. 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: if port\_id is invalid.**

- •

  **-EINVAL: if queue\_id is out of range or queue has not been setup.**

- •

  **0 if Tx queue is valid.**

### int rte\_eth\_dev\_rx\_queue\_start (uint16\_t port\_id, uint16\_t rx\_queue\_id)

**Start specified Rx queue of a port. It is used when rx\_deferred\_start flag of the specified queue is true.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device** \
 *rx\_queue\_id* **The index of the Rx queue to update the ring. The value must be in the range \[0, nb\_rx\_queue - 1\] previously supplied to rte\_eth\_dev\_configure().**

**Returns**

- •

  **0: Success, the receive queue is started.**

- •

  **-ENODEV: if** *port\_id* **is invalid.**

- •

  **-EINVAL: The queue\_id out of range or belong to hairpin.**

- •

  **-EIO: if device is removed.**

- •

  **-ENOTSUP: The function not supported in PMD.**

### int rte\_eth\_dev\_rx\_queue\_stop (uint16\_t port\_id, uint16\_t rx\_queue\_id)

**Stop specified Rx queue of a port**

**Parameters**

*port\_id* **The port identifier of the Ethernet device** \
 *rx\_queue\_id* **The index of the Rx queue to update the ring. The value must be in the range \[0, nb\_rx\_queue - 1\] previously supplied to rte\_eth\_dev\_configure().**

**Returns**

- •

  **0: Success, the receive queue is stopped.**

- •

  **-ENODEV: if** *port\_id* **is invalid.**

- •

  **-EINVAL: The queue\_id out of range or belong to hairpin.**

- •

  **-EIO: if device is removed.**

- •

  **-ENOTSUP: The function not supported in PMD.**

### int rte\_eth\_dev\_tx\_queue\_start (uint16\_t port\_id, uint16\_t tx\_queue\_id)

**Start Tx for specified queue of a port. It is used when tx\_deferred\_start flag of the specified queue is true.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device** \
 *tx\_queue\_id* **The index of the Tx queue to update the ring. The value must be in the range \[0, nb\_tx\_queue - 1\] previously supplied to rte\_eth\_dev\_configure().**

**Returns**

- •

  **0: Success, the transmit queue is started.**

- •

  **-ENODEV: if** *port\_id* **is invalid.**

- •

  **-EINVAL: The queue\_id out of range or belong to hairpin.**

- •

  **-EIO: if device is removed.**

- •

  **-ENOTSUP: The function not supported in PMD.**

### 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 device** \
 *tx\_queue\_id* **The index of the Tx queue to update the ring. The value must be in the range \[0, nb\_tx\_queue - 1\] previously supplied to rte\_eth\_dev\_configure().**

**Returns**

- •

  **0: Success, the transmit queue is stopped.**

- •

  **-ENODEV: if** *port\_id* **is invalid.**

- •

  **-EINVAL: The queue\_id out of range or belong to hairpin.**

- •

  **-EIO: if device is removed.**

- •

  **-ENOTSUP: The function not supported in PMD.**

### int rte\_eth\_dev\_start (uint16\_t port\_id)

**Start an Ethernet device.**

**The device start step is the last one and consists of setting the configured offload features and in starting the transmit and the receive units of the device.**

**Device RTE\_ETH\_DEV\_NOLIVE\_MAC\_ADDR flag causes MAC address to be set before PMD port start callback function is invoked.**

**All device queues (except form deferred start queues) status should be** `RTE_ETH_QUEUE_STATE_STARTED` **after start.**

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

**Parameters**

*port\_id* **The port identifier of the Ethernet device.**

**Returns**

- •

  **0: Success, Ethernet device started.**

- •

  **-EAGAIN: If start operation must be retried.**

- •

  **\<0: Error code of the driver device start function.**

### int rte\_eth\_dev\_stop (uint16\_t port\_id)

**Stop an Ethernet device. The device can be restarted with a call to rte\_eth\_dev\_start()**

**All device queues status should be** `RTE_ETH_QUEUE_STATE_STOPPED` **after stop.**

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

### int rte\_eth\_dev\_set\_link\_up (uint16\_t port\_id)

**Link up an Ethernet device.**

**Set device link up will re-enable the device Rx/Tx functionality after it is previously set device linked down.**

**Parameters**

*port\_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.**

### int rte\_eth\_dev\_set\_link\_down (uint16\_t port\_id)

**Link down an Ethernet device. The device Rx/Tx functionality will be disabled if success, and it can be re-enabled with a call to rte\_eth\_dev\_set\_link\_up()**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.**

### int rte\_eth\_dev\_close (uint16\_t port\_id)

**Close a stopped Ethernet device. The device cannot be restarted! The function frees all port resources.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.**

**Returns**

- •

  **Zero if the port is closed successfully.**

- •

  **Negative if something went wrong.**

### int rte\_eth\_dev\_reset (uint16\_t port\_id)

**Reset a Ethernet device and keep its port ID.**

**When a port has to be reset passively, the DPDK application can invoke this function. For example when a PF is reset, all its VFs should also be reset. Normally a DPDK application can invoke this function when RTE\_ETH\_EVENT\_INTR\_RESET event is detected, but can also use it to start a port reset in other circumstances.**

**When this function is called, it first stops the port and then calls the PMD specific dev\_uninit( ) and dev\_init( ) to return the port to initial state, in which no Tx and Rx queues are setup, as if the port has been reset and not started. The port keeps the port ID it had before the function call.**

**After calling rte\_eth\_dev\_reset( ), the application should use rte\_eth\_dev\_configure( ), rte\_eth\_rx\_queue\_setup( ), rte\_eth\_tx\_queue\_setup( ), and rte\_eth\_dev\_start( ) to reconfigure the device as appropriate.**

**Note: To avoid unexpected behavior, the application should stop calling Tx and Rx functions before calling rte\_eth\_dev\_reset( ). For thread safety, all these controlling functions should be called from the same thread.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENODEV) if** *port\_id* **is invalid.**

- •

  **(-ENOTSUP) if hardware doesn't support this function.**

- •

  **(-EPERM) if not ran from the primary process.**

- •

  **(-EIO) if re-initialisation failed or device is removed.**

- •

  **(-ENOMEM) if the reset failed due to OOM.**

- •

  **(-EAGAIN) if the reset temporarily failed and should be retried later.**

### int rte\_eth\_promiscuous\_enable (uint16\_t port\_id)

**Enable receipt in promiscuous mode for an Ethernet device.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if support for promiscuous\_enable() does not exist for the device.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

### int rte\_eth\_promiscuous\_disable (uint16\_t port\_id)

**Disable receipt in promiscuous mode for an Ethernet device.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if support for promiscuous\_disable() does not exist for the device.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

### int rte\_eth\_promiscuous\_get (uint16\_t port\_id)

**Return the value of promiscuous mode for an Ethernet device.**

**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 for allmulticast\_enable() does not exist for the device.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

### 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 for allmulticast\_disable() does not exist for the device.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

### int rte\_eth\_allmulticast\_get (uint16\_t port\_id)

**Return the value of allmulticast mode for an Ethernet device.**

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

**See also**

**rte\_eth\_link\_get\_nowait.**

**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) if** *port\_id* **invalid.**

- •

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

**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) if** *port\_id* **invalid.**

- •

  **(-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.**

**The function converts a link\_speed to a string. It handles all special values like unknown or none speed.**

**Parameters**

*link\_speed* **link\_speed of rte\_eth\_link struct**

**Returns**

**Link speed in textual format. It's pointer to immutable memory. No free is required.**

### \_\_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 least RTE\_ETH\_LINK\_MAX\_STR\_LEN bytes should be allocated to store default link status text.** \
 *len* **Length of available memory at 'str' string.** \
 *eth\_link* **Link status returned by rte\_eth\_link\_get function**

**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 updates lanes with the number of active lanes. On a supported NIC on link up, lanes will be a non-zero value irrespective 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) if** *port\_id* **invalid.**

### \_\_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 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.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if underlying hardware OR driver doesn't support. that operation.**

- •

  **(-EIO) if device is removed.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-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 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 the speed\_lanes\_capa array. The size is equal to the supported speeds list size. Value of num is derived by calling this api with speed\_lanes\_capa=NULL and num=0**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if underlying hardware OR driver doesn't support. that operation.**

- •

  **(-EIO) if device is removed.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EINVAL) if** *speed\_lanes* **invalid**

### int rte\_eth\_stats\_get (uint16\_t port\_id, struct rte\_eth\_stats \* stats)

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

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *stats* **A pointer to a structure of type rte\_eth\_stats to be filled with the values of device counters for the following set of statistics:**

- •

  *ipackets* **with the total of successfully received packets.**

- •

  *opackets* **with the total of successfully transmitted packets.**

- •

  *ibytes* **with the total of successfully received bytes.**

- •

  *obytes* **with the total of successfully transmitted bytes.**

- •

  *ierrors* **with the total of erroneous received packets.**

- •

  *oerrors* **with the total of failed transmitted packets.**

**Returns**

**Zero if successful. Non-zero otherwise.**

### int rte\_eth\_stats\_reset (uint16\_t port\_id)

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

**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) if** *port\_id* **invalid.**

- •

  **(\<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.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *xstats\_names* **An rte\_eth\_xstat\_name array of at least** *size* **elements to be filled. If set to NULL, the function returns the required number of elements.** \
 *size* **The size of the xstats\_names array (number of elements).**

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

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *xstats* **A pointer to a table of structure of type rte\_eth\_xstat to be filled with device statistics ids and values. This parameter can be set to NULL if and only if n is 0.** \
 *n* **The size of the xstats array (number of elements). If lower than the required number of elements, the function returns the required number of elements. If equal to zero, the xstats must be NULL, the function returns the required number of elements.**

**Returns**

- •

  **A positive value lower or equal to n: success. The return value is the number of entries filled in the stats table.**

- •

  **A positive value higher than n: error, the given statistics table is too small. The return value corresponds to the size that should be given to succeed. The entries in the table are not valid and shall not be used by the caller.**

- •

  **A negative value on error (invalid port ID).**

### 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 be NULL if** `ids` **are specified (not NULL).** \
 *size* **Number of elements in** `xstats_names` **array (if not NULL) and in** `ids` **array (if not NULL). Must be 0 if both array pointers are NULL.** \
 *ids* **IDs array given by app to retrieve specific statistics. May be NULL to retrieve names of all available statistics or, if** `xstats_names` **is NULL as well, just the number of available statistics.**

**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\_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 app to retrieve specific statistics. May be NULL to retrieve all available statistics or, if** `values` **is NULL as well, just the number of available statistics.** \
 *values* **Array to be filled in with requested device statistics. Must not be NULL if ids are specified (not NULL).** \
 *size* **Number of elements in** `values` **array (if not NULL) and in** `ids` **array (if not NULL). Must be 0 if both array pointers are NULL.**

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

**This function searches for the statistics using string compares, and as such should not be used on the fast-path. For fast-path retrieval of specific statistics, store the ID as provided in** *id* **from this function, and pass the ID to rte\_eth\_xstats\_get()**

**Parameters**

*port\_id* **The port to look up statistics from** \
 *xstat\_name* **The name of the statistic to return** \
 *id* **A pointer to an app-supplied uint64\_t which should be set to the ID of the stat if the stat exists.**

**Returns**

**0 on success -ENODEV for invalid port\_id, -EIO if device is removed, -EINVAL if the xstat\_name doesn't exist in port\_id -ENOMEM if bad parameter.**

### 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) if** *port\_id* **invalid.**

- •

  **(\<0): Error code of the driver xstats reset function.**

### int rte\_eth\_dev\_set\_tx\_queue\_stats\_mapping (uint16\_t port\_id, uint16\_t tx\_queue\_id, uint8\_t stat\_idx)

**Set a mapping for the specified transmit queue to the specified per-queue statistics counter.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *tx\_queue\_id* **The index of the transmit queue for which a queue stats mapping is required. The value must be in the range \[0, nb\_tx\_queue - 1\] previously supplied to rte\_eth\_dev\_configure().** \
 *stat\_idx* **The per-queue packet statistics functionality number that the transmit queue is to be assigned. The value must be in the range \[0, RTE\_ETHDEV\_QUEUE\_STAT\_CNTRS - 1\]. Max RTE\_ETHDEV\_QUEUE\_STAT\_CNTRS being 256.**

**Returns**

**Zero if successful. Non-zero otherwise.**

### int rte\_eth\_dev\_set\_rx\_queue\_stats\_mapping (uint16\_t port\_id, uint16\_t rx\_queue\_id, uint8\_t stat\_idx)

**Set a mapping for the specified receive queue to the specified per-queue statistics counter.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *rx\_queue\_id* **The index of the receive queue for which a queue stats mapping is required. The value must be in the range \[0, nb\_rx\_queue - 1\] previously supplied to rte\_eth\_dev\_configure().** \
 *stat\_idx* **The per-queue packet statistics functionality number that the receive queue is to be assigned. The value must be in the range \[0, RTE\_ETHDEV\_QUEUE\_STAT\_CNTRS - 1\]. Max RTE\_ETHDEV\_QUEUE\_STAT\_CNTRS being 256.**

**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 type** *ether\_addr* **to be filled with the Ethernet address of the Ethernet device.**

**Returns**

- •

  **(0) if successful**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-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.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *ma* **A pointer to an array of structures of type** *ether\_addr* **to be filled with the Ethernet addresses of the Ethernet device.** \
 *num* **Number of elements in the** `ma` **array. Note that rte\_eth\_dev\_info::max\_mac\_addrs can be used to retrieve max number of Ethernet addresses for given port.**

**Returns**

- •

  **number of retrieved addresses if successful**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-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.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *dev\_info* **A pointer to a structure of type rte\_eth\_dev\_info to be filled with the contextual information of the Ethernet device.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if support for dev\_infos\_get() does not exist for the device.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-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.**

**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) if** *port\_id* **invalid.**

- •

  **(-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.** \
 *fw\_size* **The size of the string array pointed by fw\_version, which should be large enough to store firmware version of the device.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if operation is not supported.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EIO) if device is removed.**

- •

  **(-EINVAL) if bad parameter.**

- •

  **(\>0) if** *fw\_size* **is not enough to store firmware version, return the size of the non truncated string.**

### int rte\_eth\_dev\_get\_supported\_ptypes (uint16\_t port\_id, uint32\_t ptype\_mask, uint32\_t \* ptypes, int num)

**Retrieve the supported packet types of an Ethernet device.**

**When a packet type is announced as supported, it** *must* **be recognized by the PMD. For instance, if RTE\_PTYPE\_L2\_ETHER, RTE\_PTYPE\_L2\_ETHER\_VLAN and RTE\_PTYPE\_L3\_IPV4 are announced, the PMD must return the following packet types for these packets:**

- •

  **Ether/IPv4 -\> RTE\_PTYPE\_L2\_ETHER \| RTE\_PTYPE\_L3\_IPV4**

- •

  **Ether/VLAN/IPv4 -\> RTE\_PTYPE\_L2\_ETHER\_VLAN \| RTE\_PTYPE\_L3\_IPV4**

- •

  **Ether/\[anything else\] -\> RTE\_PTYPE\_L2\_ETHER**

- •

  **Ether/VLAN/\[anything else\] -\> RTE\_PTYPE\_L2\_ETHER\_VLAN**

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

**Note**

**Better to invoke this API after the device is already started or Rx burst function is decided, to obtain correct supported ptypes.**

**if a given PMD does not report what ptypes it supports, then the supported ptype count is reported as 0.**

**Parameters**

*port\_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.**

**Application can use this function to set only specific ptypes that it's interested. This information can be used by the PMD to optimize Rx path.**

**The function accepts an array** `set_ptypes` **allocated by the caller to store the packet types set by the driver, the last element of the array is set to RTE\_PTYPE\_UNKNOWN. The size of the** `set_ptype` **array should be rte\_eth\_dev\_get\_supported\_ptypes()**` + 1` **else it might only be filled partially.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *ptype\_mask* **The ptype family that application is interested in should be bitwise OR of RTE\_PTYPE\_\*\_MASK or 0.** \
 *set\_ptypes* **An array pointer to store set packet types, allocated by caller. The function marks the end of array with RTE\_PTYPE\_UNKNOWN.** \
 *num* **Size of the array pointed by param ptypes. Should be rte\_eth\_dev\_get\_supported\_ptypes() + 1 to accommodate the set ptypes.**

**Returns**

- •

  **(0) if Success.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EINVAL) if** *ptype\_mask* **is invalid (or) set\_ptypes is NULL and num \> 0.**

### int rte\_eth\_dev\_get\_mtu (uint16\_t port\_id, uint16\_t \* mtu)

**Retrieve the MTU of an Ethernet device.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *mtu* **A pointer to a uint16\_t where 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.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *mtu* **A uint16\_t for the MTU to be applied.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if operation is not supported.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EIO) if device is removed.**

- •

  **(-EINVAL) if** *mtu* **invalid, validation of mtu can occur within rte\_eth\_dev\_set\_mtu if dev\_infos\_get is supported by the device or when the mtu is set using dev-\>dev\_ops-\>mtu\_set.**

- •

  **(-EBUSY) if operation is not allowed when the port is running**

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

**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 to rte\_eth\_dev\_configure().** \
 *on* **If 1, Enable VLAN Stripping of the receive queue of the Ethernet port. If 0, Disable VLAN Stripping of the receive queue of the Ethernet port.**

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

**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\_OFFLOAD RTE\_ETH\_VLAN\_FILTER\_OFFLOAD RTE\_ETH\_VLAN\_EXTEND\_OFFLOAD RTE\_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**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.**

**Returns**

- •

  **(\>0) if successful. Bit mask to indicate RTE\_ETH\_VLAN\_STRIP\_OFFLOAD RTE\_ETH\_VLAN\_FILTER\_OFFLOAD RTE\_ETH\_VLAN\_EXTEND\_OFFLOAD RTE\_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\_THRESH is triggered. \[1-99\] to set a new available descriptors threshold. 0 to disable threshold monitoring.**

**Returns**

- •

  **0 if 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 is 1, Rx queue index with the event pending.** \
 *avail\_thresh* **Location for available descriptors threshold of the found Rx queue.**

**Returns**

- •

  **1 if an Rx queue with pending event is found.**

- •

  **0 if no Rx queue with pending event is found.**

- •

  **(-ENODEV) if** `port_id` **is invalid.**

- •

  **(-EINVAL) if bad parameter (e.g.** `queue_id` **is NULL).**

- •

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

**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**

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

**Parameters**

*buffer* **The port identifier of the Ethernet device.** \
 *callback* **The function to be used as the callback.** \
 *userdata* **Arbitrary parameter to be passed to the callback function**

**Returns**

**0 on success, or -EINVAL if bad parameter**

### void rte\_eth\_tx\_buffer\_drop\_callback (struct rte\_mbuf \*\* pkts, uint16\_t unsent, void \* userdata)

**Callback function for silently dropping unsent buffered packets.**

**This function can be passed to rte\_eth\_tx\_buffer\_set\_err\_callback() to adjust the default behavior when buffered packets cannot be sent. This function drops any unsent packets silently and is used by Tx buffered operations as default behavior.**

**NOTE: this function should not be called directly, instead it should be used as a callback for packet buffering.**

**NOTE: when configuring this function as a callback with rte\_eth\_tx\_buffer\_set\_err\_callback(), the final, userdata parameter should point to an uint64\_t value.**

**Parameters**

*pkts* **The previously buffered packets which could not be sent** \
 *unsent* **The number of unsent packets in the pkts array** \
 *userdata* **Not used**

### void rte\_eth\_tx\_buffer\_count\_callback (struct rte\_mbuf \*\* pkts, uint16\_t unsent, void \* userdata)

**Callback function for tracking unsent buffered packets.**

**This function can be passed to rte\_eth\_tx\_buffer\_set\_err\_callback() to adjust the default behavior when buffered packets cannot be sent. This function drops any unsent packets, but also updates a user-supplied counter to track the overall number of packets dropped. The counter should be an uint64\_t variable.**

**NOTE: this function should not be called directly, instead it should be used as a callback for packet buffering.**

**NOTE: when configuring this function as a callback with rte\_eth\_tx\_buffer\_set\_err\_callback(), the final, userdata parameter should point to an uint64\_t value.**

**Parameters**

*pkts* **The previously buffered packets which could not be sent** \
 *unsent* **The number of unsent packets in the pkts array** \
 *userdata* **Pointer to an uint64\_t value, which will be incremented by unsent**

### int rte\_eth\_tx\_done\_cleanup (uint16\_t port\_id, uint16\_t queue\_id, uint32\_t free\_cnt)

**Request the driver to free mbufs currently cached by the driver. The driver will only free the mbuf if it is no longer in use. It is the application's responsibility to ensure rte\_eth\_tx\_buffer\_flush(..) is called if needed.**

**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 to rte\_eth\_dev\_configure().** \
 *free\_cnt* **Maximum number of packets to free. Use 0 to indicate all possible packets should be freed. Note that a packet may be using multiple mbufs.**

**Returns**

**Failure: \< 0 -ENODEV: Invalid interface -EIO: device is removed -ENOTSUP: Driver does not support function Success: \>= 0 0-n: Number of packets freed. More packets may still remain in ring that are in use.**

### 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\_ALL means register the event for all port ids.** \
 *event* **Event interested.** \
 *cb\_fn* **User supplied callback function to be called.** \
 *cb\_arg* **Pointer to the parameters for the registered callback.**

**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\_ALL means unregister the event for all port ids.** \
 *event* **Event interested.** \
 *cb\_fn* **User supplied callback function to be called.** \
 *cb\_arg* **Pointer to the parameters for the registered callback. -1 means to remove all for the same callback address and same event.**

**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 is no Rx packet coming in Rx Queue for a long time, we can sleep lcore related to Rx Queue for power saving, and enable Rx interrupt to be triggered when Rx packet arrives.**

**The rte\_eth\_dev\_rx\_intr\_enable() function enables Rx queue interrupt on specific Rx queue of a port.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *queue\_id* **The index of the receive queue from which to retrieve input packets. The value must be in the range \[0, nb\_rx\_queue - 1\] previously supplied to rte\_eth\_dev\_configure().**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if underlying hardware OR driver doesn't support that operation.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EIO) if device is removed.**

### int rte\_eth\_dev\_rx\_intr\_disable (uint16\_t port\_id, uint16\_t queue\_id)

**When lcore wakes up from Rx interrupt indicating packet coming, disable Rx interrupt and returns to polling mode.**

**The rte\_eth\_dev\_rx\_intr\_disable() function disables Rx queue interrupt on specific Rx queue of a port.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *queue\_id* **The index of the receive queue from which to retrieve input packets. The value must be in the range \[0, nb\_rx\_queue - 1\] previously supplied to rte\_eth\_dev\_configure().**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if underlying hardware OR driver doesn't support that operation.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EIO) if device is removed.**

### 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. Using RTE\_EPOLL\_PER\_THREAD allows to use per thread epoll instance.** \
 *op* **The operation be performed for the vector. Operation type of {RTE\_INTR\_EVENT\_ADD, RTE\_INTR\_EVENT\_DEL}.** \
 *data* **User raw data.**

**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 to rte\_eth\_dev\_configure().** \
 *epfd* **Epoll instance fd which the intr vector associated to. Using RTE\_EPOLL\_PER\_THREAD allows to use per thread epoll instance.** \
 *op* **The operation be performed for the vector. Operation type of {RTE\_INTR\_EVENT\_ADD, RTE\_INTR\_EVENT\_DEL}.** \
 *data* **User raw data.**

**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 to rte\_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) if** *port\_id* **invalid.**

- •

  **(-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) if** *port\_id* **invalid.**

- •

  **(-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\_capa is out only with per-speed capabilities. If set to NULL, the function returns the required number of required array entries.** \
 *num* **a number of elements in an speed\_fec\_capa array.**

**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 the num that 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) if** *port\_id* **invalid.**

- •

  **(-EINVAL) if** *num* **or** *speed\_fec\_capa* **invalid**

### \_\_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, configured FEC mode is returned. If link is up, 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) if** *port\_id* **invalid.**

### \_\_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.** \
 *fec\_capa* **A bitmask of allowed FEC modes. If only the AUTO bit is set, the decision on which FEC mode to use will be made by HW/FW or driver. If the AUTO bit is set with some FEC modes, only specified FEC modes can be set. If AUTO bit is clear, specify FEC mode to be used (only one valid mode per speed may be set).**

**Returns**

- •

  **(0) if successful.**

- •

  **(-EINVAL) if the FEC mode is not valid.**

- •

  **(-ENOTSUP) if underlying hardware OR driver doesn't support.**

- •

  **(-EIO) if device is removed.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

### int rte\_eth\_dev\_flow\_ctrl\_get (uint16\_t port\_id, struct rte\_eth\_fc\_conf \* fc\_conf)

**Get current status of the Ethernet link flow control for Ethernet device**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *fc\_conf* **The pointer to the structure where to store the flow control parameters.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if hardware doesn't support flow control.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EIO) if device is removed.**

- •

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

**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) if** *port\_id* **invalid.**

- •

  **(-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.**

**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) if** *port\_id* **invalid.**

- •

  **(-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.**

**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 to 0.**

**Returns**

- •

  **(0) if successfully added or** *mac\_addr* **was already added.**

- •

  **(-ENOTSUP) if hardware doesn't support this feature.**

- •

  **(-ENODEV) if** *port* **is invalid.**

- •

  **(-EIO) if device is removed.**

- •

  **(-ENOSPC) if no more MAC addresses can be added.**

- •

  **(-EINVAL) if MAC address is invalid.**

### \_\_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.**

**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 type rte\_eth\_pfc\_queue\_info to be filled with the information about queue based PFC.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if support for priority\_flow\_ctrl\_queue\_info\_get does not exist.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-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.**

**Configure the queue based priority flow control for a given queue for Ethernet device.**

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

**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) if** *port\_id* **invalid.**

- •

  **(-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.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *mac\_addr* **MAC address to remove.**

**Returns**

- •

  **(0) if successful, or** *mac\_addr* **didn't exist.**

- •

  **(-ENOTSUP) if hardware doesn't support.**

- •

  **(-ENODEV) if** *port* **invalid.**

- •

  **(-EADDRINUSE) if attempting to remove the default MAC address.**

- •

  **(-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, or** *mac\_addr* **didn'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.**

### int rte\_eth\_dev\_rss\_reta\_update (uint16\_t port\_id, struct rte\_eth\_rss\_reta\_entry64 \* reta\_conf, uint16\_t reta\_size)

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

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *reta\_conf* **RETA to update.** \
 *reta\_size* **Redirection table size. The table size can be queried by rte\_eth\_dev\_info\_get().**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENODEV) if** *port\_id* **is 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.**

**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.** \
 *reta\_size* **Redirection table size. The table size can be queried by rte\_eth\_dev\_info\_get().**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENODEV) if** *port\_id* **is 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) if** *port\_id* **invalid.**

- •

  **(-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.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *on* **1 - Set all unicast hash bitmaps for receiving all the Ethernet MAC addresses 0 - Clear all unicast hash bitmaps**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if hardware doesn't support.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-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.**

**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) if** *port\_id* **invalid.**

- •

  **(-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.**

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

### \_\_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.**

**Get RSS hash algorithm by its name.**

**Parameters**

*name* **RSS hash algorithm.**\
 *algo* **Return the RSS hash algorithm found,**

**See also**

**rte\_eth\_hash\_function.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-EINVAL) if not found.**

### int rte\_eth\_dev\_udp\_tunnel\_port\_add (uint16\_t port\_id, struct rte\_eth\_udp\_tunnel \* tunnel\_udp)

**Add UDP tunneling port for a type of tunnel.**

**Some NICs may require such configuration to properly parse a tunnel with any standard or custom UDP port. The packets with this UDP port will be parsed for this type of tunnel. The device parser will also check the rest of the tunnel headers before classifying the packet.**

**With some devices, this API will affect packet classification, i.e.:**

- •

  **mbuf.packet\_type reported on Rx**

- •

  **rte\_flow rules with tunnel items**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *tunnel\_udp* **UDP tunneling configuration.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENODEV) if port identifier is invalid.**

- •

  **(-EIO) if device is removed.**

- •

  **(-ENOTSUP) if hardware doesn't support tunnel type.**

### int rte\_eth\_dev\_udp\_tunnel\_port\_delete (uint16\_t port\_id, struct rte\_eth\_udp\_tunnel \* tunnel\_udp)

**Delete UDP tunneling port for a type of tunnel.**

**The packets with this UDP port will not be classified as this type of tunnel anymore if the device use such mapping for tunnel packet classification.**

**See also**

**rte\_eth\_dev\_udp\_tunnel\_port\_add**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *tunnel\_udp* **UDP tunneling configuration.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENODEV) if port identifier is invalid.**

- •

  **(-EIO) if device is removed.**

- •

  **(-ENOTSUP) if hardware doesn't support tunnel type.**

### int rte\_eth\_dev\_get\_dcb\_info (uint16\_t port\_id, struct rte\_eth\_dcb\_info \* dcb\_info)

**Get DCB information on an Ethernet device.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *dcb\_info* **DCB information.**

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

### const struct rte\_eth\_rxtx\_callback \* rte\_eth\_add\_rx\_callback (uint16\_t port\_id, uint16\_t queue\_id, rte\_rx\_callback\_fn fn, void \* user\_param)

**Add a callback to be called on packet Rx on a given port and queue.**

**This API configures a function to be called for each burst of packets received on a given NIC port queue. The return value is a pointer that can be used to later remove the callback using rte\_eth\_remove\_rx\_callback().**

**Multiple functions are called in the order that they are added.**

**Parameters**

*port\_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.**

**Returns**

**NULL on error. On success, a pointer value which can later be used to remove the callback.**

### const struct rte\_eth\_rxtx\_callback \* rte\_eth\_add\_first\_rx\_callback (uint16\_t port\_id, uint16\_t queue\_id, rte\_rx\_callback\_fn fn, void \* user\_param)

**Add a callback that must be called first on packet Rx on a given port and queue.**

**This API configures a first function to be called for each burst of packets received on a given NIC port queue. The return value is a pointer that can be used to later remove the callback using rte\_eth\_remove\_rx\_callback().**

**Multiple functions are called in the order that they are added.**

**Parameters**

*port\_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.**

**Returns**

**NULL on error. On success, a pointer value which can later be used to remove the callback.**

### const struct rte\_eth\_rxtx\_callback \* rte\_eth\_add\_tx\_callback (uint16\_t port\_id, uint16\_t queue\_id, rte\_tx\_callback\_fn fn, void \* user\_param)

**Add a callback to be called on packet Tx on a given port and queue.**

**This API configures a function to be called for each burst of packets sent on a given NIC port queue. The return value is a pointer that can be used to later remove the callback using rte\_eth\_remove\_tx\_callback().**

**Multiple functions are called in the order that they are added.**

**Parameters**

*port\_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.**

**Returns**

**NULL on error. On success, a pointer value which can later be used to remove the callback.**

### int rte\_eth\_remove\_rx\_callback (uint16\_t port\_id, uint16\_t queue\_id, const struct rte\_eth\_rxtx\_callback \* user\_cb)

**Remove an Rx packet callback from a given port and queue.**

**This function is used to removed callbacks that were added to a NIC port queue using rte\_eth\_add\_rx\_callback().**

**Note: the callback is removed from the callback list but it isn't freed since the it may still be in use. The memory for the callback can be subsequently freed back by the application by calling rte\_free():**

- •

  **Immediately - if the port is stopped, or the user knows that no callbacks are in flight e.g. if called from the thread doing Rx/Tx on that queue.**

- •

  **After a short delay - where the delay is sufficient to allow any in-flight callbacks to complete. Alternately, the RCU mechanism can be used to detect when data plane threads have ceased referencing the callback memory.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *queue\_id* **The queue on the Ethernet device from which the callback is to be removed.** \
 *user\_cb* **User supplied callback created via rte\_eth\_add\_rx\_callback().**

**Returns**

- •

  **0: Success. Callback was removed.**

- •

  **-ENODEV: If** *port\_id* **is invalid.**

- •

  **-ENOTSUP: Callback support is not available.**

- •

  **-EINVAL: The queue\_id is out of range, or the callback is NULL or not found for the port/queue.**

### int rte\_eth\_remove\_tx\_callback (uint16\_t port\_id, uint16\_t queue\_id, const struct rte\_eth\_rxtx\_callback \* user\_cb)

**Remove a Tx packet callback from a given port and queue.**

**This function is used to removed callbacks that were added to a NIC port queue using rte\_eth\_add\_tx\_callback().**

**Note: the callback is removed from the callback list but it isn't freed since the it may still be in use. The memory for the callback can be subsequently freed back by the application by calling rte\_free():**

- •

  **Immediately - if the port is stopped, or the user knows that no callbacks are in flight e.g. if called from the thread doing Rx/Tx on that queue.**

- •

  **After a short delay - where the delay is sufficient to allow any in-flight callbacks to complete. Alternately, the RCU mechanism can be used to detect when data plane threads have ceased referencing the callback memory.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *queue\_id* **The queue on the Ethernet device from which the callback is to be removed.** \
 *user\_cb* **User supplied callback created via rte\_eth\_add\_tx\_callback().**

**Returns**

- •

  **0: Success. Callback was removed.**

- •

  **-ENODEV: If** *port\_id* **is invalid.**

- •

  **-ENOTSUP: Callback support is not available.**

- •

  **-EINVAL: The queue\_id is out of range, or the callback is NULL or not found for the port/queue.**

### int rte\_eth\_rx\_queue\_info\_get (uint16\_t port\_id, uint16\_t queue\_id, struct rte\_eth\_rxq\_info \* qinfo)

**Retrieve information about given port's Rx queue.**

**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 type** *rte\_eth\_rxq\_info\_info* **to be filled with the information of the Ethernet device.**

**Returns**

- •

  **0: Success**

- •

  **-ENODEV: If** *port\_id* **is invalid.**

- •

  **-ENOTSUP: routine is not supported by the device PMD.**

- •

  **-EINVAL: The queue\_id is out of range, or the queue is hairpin queue.**

### int rte\_eth\_tx\_queue\_info\_get (uint16\_t port\_id, uint16\_t queue\_id, struct rte\_eth\_txq\_info \* qinfo)

**Retrieve information about given port's Tx queue.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *queue\_id* **The Tx queue on the Ethernet device for which information will be retrieved.** \
 *qinfo* **A pointer to a structure of type** *rte\_eth\_txq\_info\_info* **to be filled with the information of the Ethernet device.**

**Returns**

- •

  **0: Success**

- •

  **-ENODEV: If** *port\_id* **is invalid.**

- •

  **-ENOTSUP: routine is not supported by the device PMD.**

- •

  **-EINVAL: The queue\_id is out of range, or the queue is hairpin queue.**

### \_\_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 given ports's Rx queue for recycling mbufs.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *queue\_id* **The Rx queue on the Ethernet devicefor which information will be retrieved.** \
 *recycle\_rxq\_info* **A pointer to a structure of type rte\_eth\_recycle\_rxq\_info to be filled.**

**Returns**

- •

  **0: Success**

- •

  **-ENODEV: If** *port\_id* **is invalid.**

- •

  **-ENOTSUP: routine is not supported by the device PMD.**

- •

  **-EINVAL: The queue\_id is out of range.**

### 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 for which information will be retrieved.** \
 *mode* **A pointer to a structure of type rte\_eth\_burst\_mode to be filled with the information of the packet burst mode.**

**Returns**

- •

  **0: Success**

- •

  **-ENODEV: If** *port\_id* **is invalid.**

- •

  **-ENOTSUP: routine is not supported by the device PMD.**

- •

  **-EINVAL: The queue\_id is out of range.**

### int rte\_eth\_tx\_burst\_mode\_get (uint16\_t port\_id, uint16\_t queue\_id, struct rte\_eth\_burst\_mode \* mode)

**Retrieve information about the Tx packet burst mode.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *queue\_id* **The Tx queue on the Ethernet device for which information will be retrieved.** \
 *mode* **A pointer to a structure of type rte\_eth\_burst\_mode to be filled with the information of the packet burst mode.**

**Returns**

- •

  **0: Success**

- •

  **-ENODEV: If** *port\_id* **is invalid.**

- •

  **-ENOTSUP: routine is not supported by the device PMD.**

- •

  **-EINVAL: The queue\_id is 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)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Retrieve 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 for which information will be retrieved.** \
 *pmc* **The pointer to power-optimized monitoring condition structure.**

**Returns**

- •

  **0: Success. -ENOTSUP: Operation not supported. -EINVAL: Invalid parameters. -ENODEV: Invalid port ID.**

### \_\_rte\_experimental int rte\_eth\_dev\_get\_reg\_info\_ext (uint16\_t port\_id, struct rte\_dev\_reg\_info \* info)

**Retrieve the filtered device registers (values and names) and register attributes (number of registers and register size)**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *info* **Pointer to rte\_dev\_reg\_info structure to fill in.**

- •

  **If info-\>filter is NULL, return info for all registers (seen as filter none).**

- •

  **If info-\>filter is not NULL, return error if the driver does not support filter. Fill the length field with filtered register number.**

- •

  **If info-\>data is NULL, the function fills in the width and length fields.**

- •

  **If info-\>data is not NULL, ethdev considers there are enough spaces to store the registers, and the values of registers with the filter string as the module name are put into the buffer pointed at by info-\>data.**

- •

  **If info-\>names is not NULL, drivers should fill it or the ethdev fills it with default names.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if hardware doesn't support.**

- •

  **(-EINVAL) if bad parameter.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EIO) if device is removed.**

- •

  **others depends on the specific operations implementation.**

### int rte\_eth\_dev\_get\_reg\_info (uint16\_t port\_id, struct rte\_dev\_reg\_info \* info)

**Retrieve device registers and register attributes (number of registers and register size)**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *info* **Pointer to rte\_dev\_reg\_info structure to fill in. If info-\>data is NULL the function fills in the width and length fields. If non-NULL the registers are put into the buffer pointed at by the data field.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if hardware doesn't support.**

- •

  **(-EINVAL) if bad parameter.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EIO) if device is removed.**

- •

  **others depends on the specific operations implementation.**

### int rte\_eth\_dev\_get\_eeprom\_length (uint16\_t port\_id)

**Retrieve size of device EEPROM**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.**

**Returns**

- •

  **(\>=0) EEPROM size if successful.**

- •

  **(-ENOTSUP) if hardware doesn't support.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EIO) if device is removed.**

- •

  **others depends on the specific operations implementation.**

### int rte\_eth\_dev\_get\_eeprom (uint16\_t port\_id, struct rte\_dev\_eeprom\_info \* info)

**Retrieve EEPROM and EEPROM attribute**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *info* **The template includes buffer for return EEPROM data and EEPROM attributes to be filled.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if hardware doesn't support.**

- •

  **(-EINVAL) if bad parameter.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EIO) if device is removed.**

- •

  **others depends on the specific operations implementation.**

### int rte\_eth\_dev\_set\_eeprom (uint16\_t port\_id, struct rte\_dev\_eeprom\_info \* info)

**Program EEPROM with provided data**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *info* **The template includes EEPROM data for programming and EEPROM attributes to be filled**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if hardware doesn't support.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EINVAL) if bad parameter.**

- •

  **(-EIO) if device is removed.**

- •

  **others depends 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)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Retrieve the type and size of plugin module EEPROM**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *modinfo* **The type and size of plugin module EEPROM.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if hardware doesn't support.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EINVAL) if bad parameter.**

- •

  **(-EIO) if device is removed.**

- •

  **others depends on the specific operations implementation.**

### \_\_rte\_experimental int rte\_eth\_dev\_get\_module\_eeprom (uint16\_t port\_id, struct rte\_dev\_eeprom\_info \* info)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Retrieve the data of plugin module EEPROM**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *info* **The template includes the plugin module EEPROM attributes, and the buffer for return plugin module EEPROM data.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if hardware doesn't support.**

- •

  **(-EINVAL) if bad parameter.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EIO) if device is removed.**

- •

  **others depends on the specific operations implementation.**

### int rte\_eth\_dev\_set\_mc\_addr\_list (uint16\_t port\_id, struct rte\_ether\_addr \* mc\_addr\_set, uint32\_t nb\_mc\_addr)

**Set the list of multicast addresses to filter on an Ethernet device.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *mc\_addr\_set* **The array of multicast addresses to set. Equal to NULL when the function is invoked to flush the set of filtered addresses.** \
 *nb\_mc\_addr* **The number of multicast addresses in the** *mc\_addr\_set* **array. Equal to 0 when the function is invoked to flush the set of filtered addresses.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EIO) if device is removed.**

- •

  **(-ENOTSUP) if PMD of** *port\_id* **doesn't support multicast filtering.**

- •

  **(-ENOSPC) if** *port\_id* **has not enough multicast filtering resources.**

- •

  **(-EINVAL) if bad parameter.**

### int rte\_eth\_timesync\_enable (uint16\_t port\_id)

**Enable 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 device is removed.**

- •

  **-ENOTSUP: The function is not supported by the Ethernet driver.**

### int rte\_eth\_timesync\_disable (uint16\_t port\_id)

**Disable 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 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)

**Read an IEEE1588/802.1AS Rx timestamp from an Ethernet device.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *timestamp* **Pointer to the timestamp struct.** \
 *flags* **Device specific flags. Used to pass the Rx timesync register index to i40e. Unused in igb/ixgbe, pass 0 instead.**

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

### int rte\_eth\_timesync\_read\_tx\_timestamp (uint16\_t port\_id, struct timespec \* timestamp)

**Read an IEEE1588/802.1AS Tx timestamp from an Ethernet device.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *timestamp* **Pointer to the timestamp struct.**

**Returns**

- •

  **0: Success.**

- •

  **-EINVAL: No timestamp is available.**

- •

  **-ENODEV: The port ID is invalid.**

- •

  **-EIO: if device is removed.**

- •

  **-ENOTSUP: The function is not supported by the Ethernet driver.**

### int rte\_eth\_timesync\_adjust\_time (uint16\_t port\_id, int64\_t delta)

**Adjust the timesync clock on an Ethernet device.**

**This is usually used in conjunction with other Ethdev timesync functions to synchronize the device time using the IEEE1588/802.1AS protocol.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *delta* **The adjustment in nanoseconds.**

**Returns**

- •

  **0: Success.**

- •

  **-ENODEV: The port ID is invalid.**

- •

  **-EIO: if device is removed.**

- •

  **-ENOTSUP: The function is not supported by the Ethernet driver.**

### \_\_rte\_experimental int rte\_eth\_timesync\_adjust\_freq (uint16\_t port\_id, int64\_t ppm)

**Adjust the clock frequency on an Ethernet device.**

**Adjusts the base frequency by a specified percentage of ppm (parts per million). This is usually used in conjunction with other Ethdev timesync functions to synchronize the device time using the IEEE1588/802.1AS protocol.**

**The clock is subject to frequency deviation and rate of change drift due to the environment. The upper layer APP calculates the frequency compensation value of the slave clock relative to the master clock via a servo algorithm and adjusts the device clock frequency via 'rte\_eth\_timesync\_adjust\_freq()'. Commonly used servo algorithms are pi/linreg/ntpshm, for implementation see: https://github.com/nxp-archive/openil\_linuxptp.git.**

**The adjustment value obtained by the servo algorithm is usually in ppb (parts per billion). For consistency with the kernel driver .adjfine, the tuning values are in ppm. Note that 1 ppb is approximately 65.536 scaled ppm, see Linux kernel upstream commit 1060707e3809 (‘ptp: introduce helpers to adjust by scaled parts per million’).**

**In addition, 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. The device clock frequency should be adjusted with 'rte\_eth\_timesync\_adjust\_freq()' every time the clock is synchronised. Also use ‘rte\_eth\_timesync\_adjust\_time()’ to update the device clock only if the absolute value of the master/slave clock offset is greater than or equal to the step threshold.**

**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 the timespec struct 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 the timespec struct that holds the time.**

**Returns**

- •

  **0: Success.**

- •

  **-EINVAL: No timestamp is available.**

- •

  **-ENODEV: The port ID is invalid.**

- •

  **-EIO: if device is removed.**

- •

  **-ENOTSUP: The function is not supported by the Ethernet driver.**

### \_\_rte\_experimental int rte\_eth\_read\_clock (uint16\_t port\_id, uint64\_t \* clock)

**Warning**

**EXPERIMENTAL: this API may change without prior notice.**

**Read the current clock counter of an Ethernet device**

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

**E.g, a simple heuristic to derivate the frequency would be: uint64\_t start, end; rte\_eth\_read\_clock(port, start); rte\_delay\_ms(100); rte\_eth\_read\_clock(port, end); double freq = (end - start) \* 10;**

**Compute a common reference with: uint64\_t base\_time\_sec = current\_time(); uint64\_t base\_clock; rte\_eth\_read\_clock(port, base\_clock);**

**Then, convert the raw mbuf timestamp with: base\_time\_sec + (double)(\*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 the uint64\_t that holds the raw clock value.**

**Returns**

- •

  **0: Success.**

- •

  **-ENODEV: The port ID is invalid.**

- •

  **-ENOTSUP: The function is not supported by the Ethernet driver.**

- •

  **-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 and port\_id is filled.**

- •

  **(-ENODEV or -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 size RTE\_ETH\_NAME\_MAX\_LEN to store the name.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENODEV) if** *port\_id* **is 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.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *nb\_rx\_desc* **A pointer to a uint16\_t where the number of receive descriptors stored.** \
 *nb\_tx\_desc* **A pointer to a uint16\_t where the number of transmit descriptors stored.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP, -ENODEV or -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: Pool param 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**

- •

  **NULL on 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. NULL to return number of range entries and allocate memory for next call to store detail. The number of ranges that were written into this structure will be placed into its nb\_ranges field. This number cannot be larger than the nb\_ranges\_alloc that by the user before calling this function. It can be smaller than the value returned by the function, however.**

**Returns**

- •

  **(-ENOTSUP) if operation is not supported.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-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) identifier**\
 *features* **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) if** *port\_id* **is invalid;**

- •

  **(-EINVAL) if** *features* **is NULL;**

- •

  **(-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 to rte\_eth\_ip\_reassembly\_params structure.**

**Returns**

- •

  **(-ENOTSUP) if offload configuration is not supported by device.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EIO) if device is removed.**

- •

  **(-EINVAL) if device is not configured or** *capa* **passed is NULL.**

- •

  **(0) on success.**

### \_\_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**

**Get IP reassembly configuration parameters currently set in PMD. The API will return error if the configuration is not already set using rte\_eth\_ip\_reassembly\_conf\_set() before calling this API or if the device is not configured.**

**Parameters**

*port\_id* **The port identifier of the device.** \
 *conf* **A pointer to rte\_eth\_ip\_reassembly\_params structure.**

**Returns**

- •

  **(-ENOTSUP) if offload configuration is not supported by device.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EIO) if device is removed.**

- •

  **(-EINVAL) if device is not configured or if** *conf* **passed is NULL or if configuration is not set using rte\_eth\_ip\_reassembly\_conf\_set().**

- •

  **(0) on success.**

### \_\_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. User should first call rte\_eth\_ip\_reassembly\_capability\_get() to check the maximum values supported by the PMD before setting the configuration. The use of this API is mandatory to enable this feature and should be called before rte\_eth\_dev\_start().**

**In datapath, PMD cannot guarantee that IP reassembly is always successful. Hence, PMD shall register mbuf dynamic field and dynamic flag using rte\_eth\_ip\_reassembly\_dynfield\_register() to denote incomplete IP reassembly. If dynfield is not successfully registered, error will be returned and IP reassembly offload cannot be used.**

**Parameters**

*port\_id* **The port identifier of the device.** \
 *conf* **A pointer to rte\_eth\_ip\_reassembly\_params structure.**

**Returns**

- •

  **(-ENOTSUP) if offload configuration is not supported by device.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EIO) if device is removed.**

- •

  **(-EINVAL) if device is not configured or if device is already started or if** *conf* **passed is NULL or if mbuf dynfield is not registered successfully by the PMD.**

- •

  **(0) on success.**

### \_\_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. Provided data and the order depends on the PMD.**

**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\_id* **is invalid.**

- •

  **(-EINVAL) if null file.**

- •

  **(-ENOTSUP) if the device does not support this function.**

- •

  **(-EIO) if device is removed.**

### \_\_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.**

**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. (0 is the next packet to be received by the driver).** \
 *num* **The number of the descriptors to dump.** \
 *file* **A pointer to a file for output.**

**Returns**

- •

  **On success, zero.**

- •

  **On failure, a negative value.**

### \_\_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.**

**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. (0 is the place where the next packet will be send).** \
 *num* **The number of the descriptors to dump.** \
 *file* **A pointer to a file for output.**

**Returns**

- •

  **On success, zero.**

- •

  **On failure, a negative value.**

### \_\_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**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *info* **A pointer to a structure of type rte\_eth\_cman\_info to be filled with the information about congestion management.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if support for cman\_info\_get does not exist.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EINVAL) if bad parameter.**

### \_\_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.**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *config* **A pointer to a structure of type rte\_eth\_cman\_config to be initialized with default value.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if support for cman\_config\_init does not exist.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EINVAL) if bad parameter.**

### \_\_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**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *config* **A pointer to a structure of type rte\_eth\_cman\_config to be configured.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if support for cman\_config\_set does not exist.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EINVAL) if bad parameter.**

### \_\_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 type rte\_eth\_cman\_config to retrieve congestion management parameters for the given object. Application must fill all parameters except mode\_param parameter in struct rte\_eth\_cman\_config.**

**Returns**

- •

  **(0) if successful.**

- •

  **(-ENOTSUP) if support for cman\_config\_get does not exist.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EINVAL) if bad parameter.**

### 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)` [inline]`, ` [static]`

**Retrieve a burst of input packets from a receive queue of an Ethernet device. The retrieved packets are stored in rte\_mbuf structures whose pointers are supplied in the** *rx\_pkts* **array.**

**The rte\_eth\_rx\_burst() function loops, parsing the Rx ring of the receive queue, up to** *nb\_pkts* **packets, and for each completed Rx descriptor in the ring, it performs the following operations:**

- •

  **Initialize the rte\_mbuf data structure associated with the Rx descriptor according to the information provided by the NIC into that Rx descriptor.**

- •

  **Store the rte\_mbuf data structure into the next entry of the** *rx\_pkts* **array.**

- •

  **Replenish the Rx descriptor with a new rte\_mbuf buffer allocated from the memory pool associated with the receive queue at initialization time.**

**When retrieving an input packet that was scattered by the controller into multiple receive descriptors, the rte\_eth\_rx\_burst() function appends the associated rte\_mbuf buffers to the first buffer of the packet.**

**The rte\_eth\_rx\_burst() function returns the number of packets actually retrieved, which is the number of rte\_mbuf data structures effectively supplied into the** *rx\_pkts* **array. A return value equal to** *nb\_pkts* **indicates that the Rx queue contained at least** *rx\_pkts* **packets, and this is likely to signify that other received packets remain in the input queue. Applications implementing a 'retrieve as much received packets as possible' policy can check this specific case and keep invoking the rte\_eth\_rx\_burst() function until a value less than** *nb\_pkts* **is returned.**

**This receive method has the following advantages:**

- •

  **It allows a run-to-completion network stack engine to retrieve and to immediately process received packets in a fast burst-oriented approach, avoiding the overhead of unnecessary intermediate packet queue/dequeue operations.**

- •

  **Conversely, it also allows an asynchronous-oriented processing method to retrieve bursts of received packets and to immediately queue them for further parallel processing by another logical core, for instance. However, instead of having received packets being individually queued by the driver, this approach allows the caller of the rte\_eth\_rx\_burst() function to queue a burst of retrieved packets at a time and therefore dramatically reduce the cost of enqueue/dequeue operations per packet.**

- •

  **It allows the rte\_eth\_rx\_burst() function of the driver to take advantage of burst-oriented hardware features (CPU cache, prefetch instructions, and so on) to minimize the number of CPU cycles per packet.**

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

**Note**

**Some drivers using vector instructions require that** *nb\_pkts* **is divisible by 4 or 8, 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 from which to retrieve input packets. The value must be in the range \[0, nb\_rx\_queue - 1\] previously supplied to rte\_eth\_dev\_configure().** \
 *rx\_pkts* **The address of an array of pointers to rte\_mbuf structures that must be large enough to store** *nb\_pkts* **pointers in it.** \
 *nb\_pkts* **The maximum number of packets to retrieve. The value must be divisible by 8 in order to work with any driver.**

**Returns**

**The number of packets actually retrieved, which is the number of pointers to rte\_mbuf structures effectively supplied to the** *rx\_pkts* **array.**

**Definition at line 6262 of file rte\_ethdev.h.**

### static 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**

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

**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) if** *port\_id* **is invalid.**

- •

  **(-EINVAL) if** *queue\_id* **is invalid**

- •

  **(-ENOTSUP) if the device does not support this function**

**Definition at line 6338 of file rte\_ethdev.h.**

### static 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 than the Rx function:**

- •

  **on a dataplane core**

- •

  **not concurrently on the same queue**

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

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

**Parameters**

*port\_id* **A valid port identifier of the Ethernet device which.** \
 *queue\_id* **A valid Rx queue identifier on this port.** \
 *offset* **The offset of the descriptor starting from tail (0 is the next packet to be received by the driver).**

**Returns**

- •

  **(RTE\_ETH\_RX\_DESC\_AVAIL): Descriptor is available for the hardware to receive a packet.**

- •

  **(RTE\_ETH\_RX\_DESC\_DONE): Descriptor is done, it is filled by hw, but not yet processed by the driver (i.e. in the receive queue).**

- •

  **(RTE\_ETH\_RX\_DESC\_UNAVAIL): Descriptor is unavailable, either hold by the driver and not yet returned to hw, or reserved by the hw.**

- •

  **(-EINVAL) bad descriptor offset.**

- •

  **(-ENOTSUP) if the device does not support this function.**

- •

  **(-ENODEV) bad port or queue (only if compiled with debug).**

**Definition at line 6410 of file rte\_ethdev.h.**

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

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

- •

  **on a dataplane core**

- •

  **not concurrently on the same queue**

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

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

**Parameters**

*port\_id* **A valid port identifier of the Ethernet device which.** \
 *queue\_id* **A valid Tx queue identifier on this port.** \
 *offset* **The offset of the descriptor starting from tail (0 is the place where the next packet will be send).**

**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 6481 of file rte\_ethdev.h.**

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

**The rte\_eth\_tx\_burst() function is invoked to transmit output packets on the output queue** *queue\_id* **of the Ethernet device designated by its** *port\_id***. The** *nb\_pkts* **parameter is the number of packets to send which are supplied in the** *tx\_pkts* **array of rte\_mbuf structures, each of them allocated from a pool created with rte\_pktmbuf\_pool\_create(). The rte\_eth\_tx\_burst() function loops, sending** *nb\_pkts* **packets, up to the number of transmit descriptors available in the Tx ring of the transmit queue. For each packet to send, the rte\_eth\_tx\_burst() function performs the following operations:**

- •

  **Pick up the next available descriptor in the transmit ring.**

- •

  **Free the network buffer previously sent with that descriptor, if any.**

- •

  **Initialize the transmit descriptor with the information provided in the \*rte\_mbuf data structure.**

**In the case of a segmented packet composed of a list of rte\_mbuf buffers, the rte\_eth\_tx\_burst() function uses several transmit descriptors of the ring.**

**The rte\_eth\_tx\_burst() function returns the number of packets it actually sent. A return value equal to** *nb\_pkts* **means that all packets have been sent, and this is likely to signify that other output packets could be immediately transmitted again. Applications that implement a 'send as many packets to transmit as possible' policy can check this specific case and keep invoking the rte\_eth\_tx\_burst() function until a value less than** *nb\_pkts* **is returned.**

**It is the responsibility of the rte\_eth\_tx\_burst() function to transparently free the memory buffers of packets previously sent. This feature is driven by the** *tx\_free\_thresh* **value supplied to the rte\_eth\_dev\_configure() function at device configuration time. When the number of free Tx descriptors drops below this threshold, the rte\_eth\_tx\_burst() function must \[attempt to\] free the rte\_mbuf buffers of those packets whose transmission was effectively completed.**

**If the PMD is RTE\_ETH\_TX\_OFFLOAD\_MT\_LOCKFREE capable, multiple threads can invoke this function concurrently on the same Tx queue without SW lock.**

**See also**

**rte\_eth\_dev\_info\_get, struct rte\_eth\_txconf::offloads**

**rte\_eth\_tx\_prepare to perform some prior checks or adjustments for offloads.**

**Note**

**This function must not modify mbufs (including packets data) unless the refcnt is 1. An exception is the bonding PMD, which does not have 'Tx prepare' support, in this case, mbufs may be modified.**

**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 to rte\_eth\_dev\_configure().** \
 *tx\_pkts* **The address of an array of** *nb\_pkts* **pointers to rte\_mbuf structures which contain the output packets.** \
 *nb\_pkts* **The maximum number of packets to transmit.**

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

**Definition at line 6605 of file rte\_ethdev.h.**

### static 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 rte\_eth\_tx\_prepare() function is invoked to prepare output packets to be transmitted on the output queue** *queue\_id* **of the Ethernet device designated by its** *port\_id***. The** *nb\_pkts* **parameter is the number of packets to be prepared which are supplied in the** *tx\_pkts* **array of rte\_mbuf structures, each of them allocated from a pool created with rte\_pktmbuf\_pool\_create(). For each packet to send, the rte\_eth\_tx\_prepare() function performs the following operations:**

- •

  **Check if packet meets devices requirements for Tx offloads.**

- •

  **Check limitations about number of segments.**

- •

  **Check additional requirements when debug is enabled.**

- •

  **Update and/or reset required checksums when Tx offload is set for packet.**

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

**The rte\_eth\_tx\_prepare() function returns the number of packets ready to be sent. A return value equal to** *nb\_pkts* **means that all packets are valid and ready to be sent, otherwise stops processing on the first invalid packet and leaves the rest packets untouched.**

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

**Parameters**

*port\_id* **The port identifier of the Ethernet device. The value must be a valid port ID.** \
 *queue\_id* **The index of the transmit queue through which output packets must be sent. The value must be in the range \[0, nb\_tx\_queue - 1\] previously supplied to rte\_eth\_dev\_configure().** \
 *tx\_pkts* **The address of an array of** *nb\_pkts* **pointers to rte\_mbuf structures which contain the output packets.** \
 *nb\_pkts* **The maximum number of packets to process.**

**Returns**

**The number of packets correct and ready to be sent. The return value can be less than the value of the** *tx\_pkts* **parameter when some packet doesn't meet devices requirements with rte\_errno set appropriately:**

- •

  **EINVAL: offload flags are not correctly set**

- •

  **ENOTSUP: the offload feature is not supported by the hardware**

- •

  **ENODEV: if** *port\_id* **is invalid (with debug enabled only)**

**Definition at line 6715 of file rte\_ethdev.h.**

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

**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 to rte\_eth\_dev\_configure().** \
 *buffer* **Buffer of packets to be transmit.**

**Returns**

**The number of packets successfully sent to the Ethernet device. The error callback is called for any packets which could not be sent.**

**Definition at line 6800 of file rte\_ethdev.h.**

### static \_\_rte\_always\_inline uint16\_t rte\_eth\_tx\_buffer (uint16\_t port\_id, uint16\_t queue\_id, struct rte\_eth\_dev\_tx\_buffer \* buffer, struct rte\_mbuf \* tx\_pkt)` [static]`

**Buffer a single packet for future transmission on a port and queue**

**This function takes a single mbuf/packet and buffers it for later transmission on the particular port and queue specified. Once the buffer is full of packets, an attempt will be made to transmit all the buffered packets. In case of error, where not all packets can be transmitted, a callback is called with the unsent packets as a parameter. If no callback is explicitly set up, the unsent packets are just freed back to the owning mempool. The function returns the number of packets actually sent i.e. 0 if no buffer flush occurred, otherwise the number of packets successfully flushed**

**Parameters**

*port\_id* **The port identifier of the Ethernet device.** \
 *queue\_id* **The index of the transmit queue through which output packets must be sent. The value must be in the range \[0, nb\_tx\_queue - 1\] previously supplied to rte\_eth\_dev\_configure().** \
 *buffer* **Buffer used to collect packets to be sent.** \
 *tx\_pkt* **Pointer to the packet mbuf to be sent.**

**Returns**

**0 = packet has been buffered for later transmission N \> 0 = packet has been buffered, and the buffer was subsequently flushed, causing N packets to be sent, and the error callback to be called for the rest.**

**Definition at line 6853 of file rte\_ethdev.h.**

### 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)` [inline]`, ` [static]`

**Warning**

**EXPERIMENTAL: this API may change, or be removed, without prior notice**

**Recycle used mbufs from a transmit queue of an Ethernet device, and move these mbufs into a mbuf ring for a receive queue of an Ethernet device. This can bypass mempool path to save CPU cycles.**

**The rte\_eth\_recycle\_mbufs() function loops, with rte\_eth\_rx\_burst() and rte\_eth\_tx\_burst() functions, freeing Tx used mbufs and replenishing Rx descriptors. The number of recycling mbufs depends on the request of Rx mbuf ring, with the constraint of enough used mbufs from Tx mbuf ring.**

**For each recycling mbufs, the rte\_eth\_recycle\_mbufs() function performs the following operations:**

- •

  **Copy used rte\_mbuf buffer pointers from Tx mbuf ring into Rx mbuf ring.**

- •

  **Replenish the Rx descriptors with the recycling rte\_mbuf mbufs 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.**

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

**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 to rte\_eth\_dev\_configure().** \
 *tx\_port\_id* **Port identifying the transmit side.** \
 *tx\_queue\_id* **The index of the transmit queue identifying the transmit side. The value must be in the range \[0, nb\_tx\_queue - 1\] previously supplied to rte\_eth\_dev\_configure().** \
 *recycle\_rxq\_info* **A pointer to a structure of type rte\_eth\_recycle\_rxq\_info which contains the information of the Rx queue mbuf ring.**

**Returns**

**The number of recycling mbufs.**

**Definition at line 6918 of file rte\_ethdev.h.**

### \_\_rte\_experimental int rte\_eth\_buffer\_split\_get\_supported\_hdr\_ptypes (uint16\_t port\_id, uint32\_t \* ptypes, int num)

**Warning**

**EXPERIMENTAL: this API may change without prior notice**

**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 with RTE\_PTYPE\_\*.** \
 *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.**

- •

  **(-ENOTSUP) if header protocol is not supported by device.**

- •

  **(-ENODEV) if** *port\_id* **invalid.**

- •

  **(-EINVAL) if bad parameter.**

### static \_\_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).**

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

**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 to rte\_eth\_dev\_configure().**

**Returns**

**The number of used descriptors in the specific queue, or:**

- •

  **(-ENODEV) if** *port\_id* **is invalid. Enabled only when RTE\_ETHDEV\_DEBUG\_TX is enabled.**

- •

  **(-EINVAL) if** *queue\_id* **is invalid. Enabled only when RTE\_ETHDEV\_DEBUG\_TX is 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 7062 of file rte\_ethdev.h.**

## Author

**Generated automatically by Doxygen for DPDK from the source code.**
