---
name: "rte_vdpa.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_vdpa.h"
---

# rte\_vdpa.h(3)

## NAME

rte\_vdpa.h

## SYNOPSIS

`#include <stdint.h>`\

### Data Structures

struct **rte\_vdpa\_stat**\
 struct **rte\_vdpa\_stat\_name**\

### Macros

\#define **RTE\_VDPA\_STATS\_NAME\_SIZE**   64\

### Functions

struct rte\_vdpa\_device \* **rte\_vdpa\_find\_device\_by\_name** (const char \*name)\
 struct rte\_device \* **rte\_vdpa\_get\_rte\_device** (struct rte\_vdpa\_device \*vdpa\_dev)\
 int **rte\_vdpa\_get\_queue\_num** (struct rte\_vdpa\_device \*dev, uint32\_t \*queue\_num)\
 int **rte\_vdpa\_get\_features** (struct rte\_vdpa\_device \*dev, uint64\_t \*features)\
 int **rte\_vdpa\_get\_protocol\_features** (struct rte\_vdpa\_device \*dev, uint64\_t \*features)\
 int **rte\_vdpa\_get\_stats\_names** (struct rte\_vdpa\_device \*dev, struct **rte\_vdpa\_stat\_name** \*stats\_names, unsigned int size)\
 int **rte\_vdpa\_get\_stats** (struct rte\_vdpa\_device \*dev, uint16\_t qid, struct **rte\_vdpa\_stat** \*stats, unsigned int n)\
 int **rte\_vdpa\_reset\_stats** (struct rte\_vdpa\_device \*dev, uint16\_t qid)\

## Detailed Description

Device specific vhost lib

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

## Macro Definition Documentation

### #define RTE\_VDPA\_STATS\_NAME\_SIZE 64

Maximum name length for statistics counters

Definition at line **21** of file **rte\_vdpa.h**.

## Function Documentation

### struct rte\_vdpa\_device \* rte\_vdpa\_find\_device\_by\_name (const char \* name)

Find the device id of a vdpa device from its name

**Parameters**

*name* the vdpa device name

**Returns**

vDPA device pointer on success, NULL on failure

### struct rte\_device \* rte\_vdpa\_get\_rte\_device (struct rte\_vdpa\_device \* vdpa\_dev)

Get the generic device from the vdpa device

**Parameters**

*vdpa\_dev* the vdpa device pointer

**Returns**

generic device pointer on success, NULL on failure

### int rte\_vdpa\_get\_queue\_num (struct rte\_vdpa\_device \* dev, uint32\_t \* queue\_num)

Get number of queue pairs supported by the vDPA device

**Parameters**

*dev* vDP device pointer \
 *queue\_num* pointer on where the number of queue is stored

**Returns**

0 on success, -1 on failure

### int rte\_vdpa\_get\_features (struct rte\_vdpa\_device \* dev, uint64\_t \* features)

Get the Virtio features supported by the vDPA device

**Parameters**

*dev* vDP device pointer \
 *features* pointer on where the supported features are stored

**Returns**

0 on success, -1 on failure

### int rte\_vdpa\_get\_protocol\_features (struct rte\_vdpa\_device \* dev, uint64\_t \* features)

Get the Vhost-user protocol features supported by the vDPA device

**Parameters**

*dev* vDP device pointer \
 *features* pointer on where the supported protocol features are stored

**Returns**

0 on success, -1 on failure

### int rte\_vdpa\_get\_stats\_names (struct rte\_vdpa\_device \* dev, struct rte\_vdpa\_stat\_name \* stats\_names, unsigned int size)

Retrieve names of statistics of a vDPA device.

There is an assumption that 'stat\_names' and 'stats' arrays are matched by array index: stats\_names\[i\].name =\> stats\[i\].value

And the array index is same with id field of 'struct **rte\_vdpa\_stat**': stats\[i\].id == i

**Parameters**

*dev* vDPA device pointer \
 *stats\_names* array of at least size elements to be filled. If set to NULL, the function returns the required number of elements. \
 *size* The number of elements in stats\_names array.

**Returns**

A negative value on error, otherwise the number of entries filled in the stats name array.

### int rte\_vdpa\_get\_stats (struct rte\_vdpa\_device \* dev, uint16\_t qid, struct rte\_vdpa\_stat \* stats, unsigned int n)

Retrieve statistics of a vDPA device.

There is an assumption that 'stat\_names' and 'stats' arrays are matched by array index: stats\_names\[i\].name =\> stats\[i\].value

And the array index is same with id field of 'struct **rte\_vdpa\_stat**': stats\[i\].id == i

**Parameters**

*dev* vDPA device pointer \
 *qid* queue id \
 *stats* A pointer to a table of structure of type **rte\_vdpa\_stat** to be filled with device statistics ids and values. \
 *n* The number of elements in stats array.

**Returns**

A negative value on error, otherwise the number of entries filled in the stats table.

### int rte\_vdpa\_reset\_stats (struct rte\_vdpa\_device \* dev, uint16\_t qid)

Reset statistics of a vDPA device.

**Parameters**

*dev* vDPA device pointer \
 *qid* queue id

**Returns**

0 on success, a negative value on error.

## Author

Generated automatically by Doxygen for DPDK from the source code.
