---
name: "rte_rawdev_pmd.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_rawdev_pmd.h"
---

# rte\_rawdev\_pmd.h(3)

## NAME

rte\_rawdev\_pmd.h

## SYNOPSIS

`#include <string.h>`\
 `#include <dev_driver.h>`\
 `#include <rte_malloc.h>`\
 `#include <rte_log.h>`\
 `#include <rte_common.h>`\
 `#include 'rte_rawdev.h'`\

### Data Structures

struct **rte\_rawdev\_ops**\

### Typedefs

**typedef** int(\* **rawdev\_info\_get\_t**) (struct rte\_rawdev \*dev, rte\_rawdev\_obj\_t dev\_info, size\_t dev\_private\_size)\
 **typedef** int(\* **rawdev\_configure\_t**) (const struct rte\_rawdev \*dev, rte\_rawdev\_obj\_t config, size\_t config\_size)\
 **typedef** int(\* **rawdev\_start\_t**) (struct rte\_rawdev \*dev)\
 **typedef** void(\* **rawdev\_stop\_t**) (struct rte\_rawdev \*dev)\
 **typedef** int(\* **rawdev\_close\_t**) (struct rte\_rawdev \*dev)\
 **typedef** int(\* **rawdev\_reset\_t**) (struct rte\_rawdev \*dev)\
 **typedef** int(\* **rawdev\_queue\_conf\_get\_t**) (struct rte\_rawdev \*dev, uint16\_t queue\_id, rte\_rawdev\_obj\_t queue\_conf, size\_t queue\_conf\_size)\
 **typedef** int(\* **rawdev\_queue\_setup\_t**) (struct rte\_rawdev \*dev, uint16\_t queue\_id, rte\_rawdev\_obj\_t queue\_conf, size\_t queue\_conf\_size)\
 **typedef** int(\* **rawdev\_queue\_release\_t**) (struct rte\_rawdev \*dev, uint16\_t queue\_id)\
 **typedef** uint16\_t(\* **rawdev\_queue\_count\_t**) (struct rte\_rawdev \*dev)\
 **typedef** int(\* **rawdev\_enqueue\_bufs\_t**) (struct rte\_rawdev \*dev, struct rte\_rawdev\_buf \*\*buffers, unsigned int count, rte\_rawdev\_obj\_t context)\
 **typedef** int(\* **rawdev\_dequeue\_bufs\_t**) (struct rte\_rawdev \*dev, struct rte\_rawdev\_buf \*\*buffers, unsigned int count, rte\_rawdev\_obj\_t context)\
 **typedef** int(\* **rawdev\_dump\_t**) (struct rte\_rawdev \*dev, FILE \*f)\
 **typedef** int(\* **rawdev\_get\_attr\_t**) (struct rte\_rawdev \*dev, const char \*attr\_name, uint64\_t \*attr\_value)\
 **typedef** int(\* **rawdev\_set\_attr\_t**) (struct rte\_rawdev \*dev, const char \*attr\_name, const uint64\_t attr\_value)\
 **typedef** int(\* **rawdev\_xstats\_get\_t**) (const struct rte\_rawdev \*dev, const unsigned int ids\[\], uint64\_t values\[\], unsigned int n)\
 **typedef** int(\* **rawdev\_xstats\_reset\_t**) (struct rte\_rawdev \*dev, const uint32\_t ids\[\], uint32\_t nb\_ids)\
 **typedef** int(\* **rawdev\_xstats\_get\_names\_t**) (const struct rte\_rawdev \*dev, struct **rte\_rawdev\_xstats\_name** \*xstats\_names, unsigned int size)\
 **typedef** uint64\_t(\* **rawdev\_xstats\_get\_by\_name\_t**) (const struct rte\_rawdev \*dev, const char \*name, unsigned int \*id)\
 **typedef** int(\* **rawdev\_firmware\_status\_get\_t**) (struct rte\_rawdev \*dev, rte\_rawdev\_obj\_t status\_info)\
 **typedef** int(\* **rawdev\_firmware\_version\_get\_t**) (struct rte\_rawdev \*dev, rte\_rawdev\_obj\_t version\_info)\
 **typedef** int(\* **rawdev\_firmware\_load\_t**) (struct rte\_rawdev \*dev, rte\_rawdev\_obj\_t firmware\_buf)\
 **typedef** int(\* **rawdev\_firmware\_unload\_t**) (struct rte\_rawdev \*dev)\
 **typedef** int(\* **rawdev\_selftest\_t**) (uint16\_t dev\_id)\

### Functions

static struct rte\_rawdev \* **rte\_rawdev\_pmd\_get\_named\_dev** (const char \*name)\
 static struct rte\_rawdev \* **rte\_rawdev\_pmd\_get\_dev** (uint8\_t dev\_id)\
 static unsigned **rte\_rawdev\_pmd\_is\_valid\_dev** (uint8\_t dev\_id)\
 struct rte\_rawdev \* **rte\_rawdev\_pmd\_allocate** (const char \*name, size\_t dev\_private\_size, int socket\_id)\
 int **rte\_rawdev\_pmd\_release** (struct rte\_rawdev \*rawdev)\
 struct rte\_rawdev \* **rte\_rawdev\_pmd\_init** (const char \*name, size\_t dev\_private\_size, int socket\_id)\
 int **rte\_rawdev\_pmd\_uninit** (const char \*name)\

## Detailed Description

RTE RAW PMD APIs

**Note**

Driver facing APIs for a raw device. These are not to be called directly by any application.

Definition in file **rte\_rawdev\_pmd.h**.

## Typedef Documentation

### typedef int(\* rawdev\_info\_get\_t) (struct rte\_rawdev \*dev, rte\_rawdev\_obj\_t dev\_info, size\_t dev\_private\_size)

Definitions of all functions exported by a driver through the generic structure of type *rawdev\_ops* supplied in the *rte\_rawdev* structure associated with a device. Get device information of a device.

**Parameters**

*dev* Raw device pointer \
 *dev\_info* Raw device information structure \
 *dev\_private\_size* The size of the structure pointed to by dev\_info-\>dev\_private

**Returns**

Returns 0 on success, negative error code on failure

Definition at line **172** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_configure\_t) (const struct rte\_rawdev \*dev, rte\_rawdev\_obj\_t config, size\_t config\_size)

Configure a device.

**Parameters**

*dev* Raw device pointer \
 *config* Void object containing device specific configuration \
 *config\_size* Size of the memory allocated for the configuration

**Returns**

Returns 0 on success

Definition at line **189** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_start\_t) (struct rte\_rawdev \*dev)

Start a configured device.

**Parameters**

*dev* Raw device pointer

**Returns**

Returns 0 on success

Definition at line **202** of file **rte\_rawdev\_pmd.h**.

### typedef void(\* rawdev\_stop\_t) (struct rte\_rawdev \*dev)

Stop a configured device.

**Parameters**

*dev* Raw device pointer

Definition at line **210** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_close\_t) (struct rte\_rawdev \*dev)

Close a configured device.

**Parameters**

*dev* Raw device pointer

**Returns**

- •

  0 on success

- •

  (-EAGAIN) if can't close as device is busy

Definition at line **222** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_reset\_t) (struct rte\_rawdev \*dev)

Reset a configured device.

**Parameters**

*dev* Raw device pointer

**Returns**

0 for success !0 for failure

Definition at line **233** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_queue\_conf\_get\_t) (struct rte\_rawdev \*dev, uint16\_t queue\_id, rte\_rawdev\_obj\_t queue\_conf, size\_t queue\_conf\_size)

Retrieve the current raw queue configuration.

**Parameters**

*dev* Raw device pointer \
 *queue\_id* Raw device queue index \
 *queue\_conf* Raw device queue configuration structure \
 *queue\_conf\_size* Size of the memory allocated for the configuration

**Returns**

Returns 0 on success, negative errno on failure

Definition at line **250** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_queue\_setup\_t) (struct rte\_rawdev \*dev, uint16\_t queue\_id, rte\_rawdev\_obj\_t queue\_conf, size\_t queue\_conf\_size)

Setup an raw queue.

**Parameters**

*dev* Raw device pointer \
 *queue\_id* Rawqueue index \
 *queue\_conf* Rawqueue configuration structure \
 *queue\_conf\_size* Size of the memory allocated for the configuration

**Returns**

Returns 0 on success.

Definition at line **270** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_queue\_release\_t) (struct rte\_rawdev \*dev, uint16\_t queue\_id)

Release resources allocated by given raw queue.

**Parameters**

*dev* Raw device pointer \
 *queue\_id* Raw queue index

Definition at line **283** of file **rte\_rawdev\_pmd.h**.

### typedef uint16\_t(\* rawdev\_queue\_count\_t) (struct rte\_rawdev \*dev)

Get the count of number of queues configured on this device.

Another way to fetch this information is to fetch the device configuration. But, that assumes that the device configuration managed by the driver has that kind of information.

This function helps in getting queue count supported, independently. It can help in cases where iterator needs to be implemented.

**Parameters**

*dev* Raw device pointer

**Returns**

Number of queues; 0 is assumed to be a valid response.

Definition at line **301** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_enqueue\_bufs\_t) (struct rte\_rawdev \*dev, struct rte\_rawdev\_buf \*\*buffers, unsigned int count, rte\_rawdev\_obj\_t context)

Enqueue an array of raw buffers to the device.

Buffer being used is opaque - it can be obtained from mempool or from any other source. Interpretation of buffer is responsibility of driver.

**Parameters**

*dev* Raw device pointer \
 *buffers* array of buffers \
 *count* number of buffers passed \
 *context* an opaque object representing context of the call; for example, an application can pass information about the queues on which enqueue needs to be done. Or, the enqueue operation might be passed reference to an object containing a callback (agreed upon between application and driver).

**Returns**

\>=0 Count of buffers successfully enqueued (0: no buffers enqueued) \<0 Error count in case of error

Definition at line **325** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_dequeue\_bufs\_t) (struct rte\_rawdev \*dev, struct rte\_rawdev\_buf \*\*buffers, unsigned int count, rte\_rawdev\_obj\_t context)

Dequeue an array of raw buffers from the device.

**Parameters**

*dev* Raw device pointer \
 *buffers* array of buffers \
 *count* Max buffers expected to be dequeued \
 *context* an opaque object representing context of the call. Based on this object, the application and driver can coordinate for dequeue operation involving agreed upon semantics. For example, queue information/id on which Dequeue needs to be performed.

**Returns**

\>0, ~0: Count of buffers returned \<0: Error Whether short dequeue is success or failure is decided between app and driver.

Definition at line **350** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_dump\_t) (struct rte\_rawdev \*dev, FILE \*f)

Dump internal information

**Parameters**

*dev* Raw device pointer \
 *f* A pointer to a file for output

**Returns**

0 for success, !0 Error

Definition at line **366** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_get\_attr\_t) (struct rte\_rawdev \*dev, const char \*attr\_name, uint64\_t \*attr\_value)

Get an attribute value from implementation. Attribute is an opaque handle agreed upon between application and PMD.

**Parameters**

*dev* Raw device pointer \
 *attr\_name* Opaque object representing an attribute in implementation. \
 *attr\_value* \[out\] Opaque response to the attribute value. In case of error, this remains untouched. This is double pointer of void type.

**Returns**

0 for success !0 Error; attr\_value remains untouched in case of error.

Definition at line **383** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_set\_attr\_t) (struct rte\_rawdev \*dev, const char \*attr\_name, const uint64\_t attr\_value)

Set an attribute value. Attribute is an opaque handle agreed upon between application and PMD.

**Parameters**

*dev* Raw device pointer \
 *attr\_name* Opaque object representing an attribute in implementation. \
 *attr\_value* Value of the attribute represented by attr\_name

**Returns**

0 for success !0 Error

Definition at line **401** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_xstats\_get\_t) (const struct rte\_rawdev \*dev, const unsigned int ids\[\], uint64\_t values\[\], unsigned int n)

Retrieve a set of statistics from device. Note: Being a raw device, the stats are specific to the device being implemented thus represented as xstats.

**Parameters**

*dev* Raw device pointer \
 *ids* The stat ids to retrieve \
 *values* The returned stat values \
 *n* The number of id values and entries in the values array

**Returns**

The number of stat values successfully filled into the values array

Definition at line **421** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_xstats\_reset\_t) (struct rte\_rawdev \*dev, const uint32\_t ids\[\], uint32\_t nb\_ids)

Resets the statistic values in xstats for the device.

Definition at line **427** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_xstats\_get\_names\_t) (const struct rte\_rawdev \*dev, struct rte\_rawdev\_xstats\_name \*xstats\_names, unsigned int size)

Get names of extended stats of an raw device

**Parameters**

*dev* Raw device pointer \
 *xstats\_names* Array of name values to be filled in \
 *size* Number of values in the xstats\_names array

**Returns**

When size \>= the number of stats, return the number of stat values filled into the array. When size \< the number of available stats, return the number of stats values, and do not fill in any data into xstats\_names.

Definition at line **446** of file **rte\_rawdev\_pmd.h**.

### typedef uint64\_t(\* rawdev\_xstats\_get\_by\_name\_t) (const struct rte\_rawdev \*dev, const char \*name, unsigned int \*id)

Get value of one stats and optionally return its id

**Parameters**

*dev* Raw device pointer \
 *name* The name of the stat to retrieve \
 *id* Pointer to an unsigned int where we store the stat-id. This pointer may be null if the id is not required.

**Returns**

The value of the stat, or (uint64\_t)-1 if the stat is not found. If the stat is not found, the id value will be returned as (unsigned)-1, if id pointer is non-NULL

Definition at line **465** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_firmware\_status\_get\_t) (struct rte\_rawdev \*dev, rte\_rawdev\_obj\_t status\_info)

Get firmware/device-stack status. Implementation to allocate buffer for returning information.

**Parameters**

*dev* Raw device pointer \
 *status\_info* void block containing device specific status information

**Returns**

0 for success, !0 for failure, with undefined value in `status_info`

Definition at line **481** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_firmware\_version\_get\_t) (struct rte\_rawdev \*dev, rte\_rawdev\_obj\_t version\_info)

Get firmware version information

**Parameters**

*dev* Raw device pointer \
 *version\_info* void pointer to version information returned by device

**Returns**

0 for success, !0 for failure, with undefined value in `version_info`

Definition at line **495** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_firmware\_load\_t) (struct rte\_rawdev \*dev, rte\_rawdev\_obj\_t firmware\_buf)

Load firmware from a buffer (DMA'able)

**Parameters**

*dev* Raw device pointer \
 *firmware\_buf* Pointer to firmware image

**Returns**

\>0, ~0: for successful load \<0: for failure

**See also**

Application may use `firmware_version_get` for ascertaining successful load

Definition at line **512** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_firmware\_unload\_t) (struct rte\_rawdev \*dev)

Unload firmware

**Parameters**

*dev* Raw device pointer

**Returns**

\>0, ~0 for successful unloading \<0 for failure in unloading

Note: Application can use the `firmware_status_get` or `firmware_version_get` to get result of unload.

Definition at line **527** of file **rte\_rawdev\_pmd.h**.

### typedef int(\* rawdev\_selftest\_t) (uint16\_t dev\_id)

Start rawdev selftest

**Returns**

Return 0 on success

Definition at line **535** of file **rte\_rawdev\_pmd.h**.

## Function Documentation

### static struct rte\_rawdev \* rte\_rawdev\_pmd\_get\_named\_dev (const char \* name)` [inline]`, ` [static]`

The pool of rte\_rawdev structures. Get the rte\_rawdev structure device pointer for the named device.

**Parameters**

*name* device name to select the device structure.

**Returns**

- •

  The rte\_rawdev structure pointer for the given device ID.

Definition at line **87** of file **rte\_rawdev\_pmd.h**.

### static struct rte\_rawdev \* rte\_rawdev\_pmd\_get\_dev (uint8\_t dev\_id)` [inline]`, ` [static]`

Get the rte\_rawdev structure device pointer for given device ID.

**Parameters**

*dev\_id* raw device index.

**Returns**

- •

  The rte\_rawdev structure pointer for the given device ID.

Definition at line **115** of file **rte\_rawdev\_pmd.h**.

### static unsigned rte\_rawdev\_pmd\_is\_valid\_dev (uint8\_t dev\_id)` [inline]`, ` [static]`

Validate if the raw device index is a valid attached raw device.

**Parameters**

*dev\_id* raw device index.

**Returns**

- •

  If the device index is valid (1) or not (0).

Definition at line **139** of file **rte\_rawdev\_pmd.h**.

### struct rte\_rawdev \* rte\_rawdev\_pmd\_allocate (const char \* name, size\_t dev\_private\_size, int socket\_id)

Allocates a new rawdev slot for an raw device and returns the pointer to that slot for the driver to use.

**Parameters**

*name* Unique identifier name for each device \
 *dev\_private\_size* Size of private data memory allocated within rte\_rawdev object. Set to 0 to disable internal memory allocation and allow for self-allocation. \
 *socket\_id* Socket to allocate resources on.

**Returns**

- •

  Slot in the rte\_dev\_devices array for a new device;

### int rte\_rawdev\_pmd\_release (struct rte\_rawdev \* rawdev)

Release the specified rawdev device.

**Parameters**

*rawdev* The *rawdev* pointer is the address of the *rte\_rawdev* structure.

**Returns**

- •

  0 on success, negative on error

### struct rte\_rawdev \* rte\_rawdev\_pmd\_init (const char \* name, size\_t dev\_private\_size, int socket\_id)

Creates a new raw device and returns the pointer to that device.

**Parameters**

*name* Pointer to a character array containing name of the device \
 *dev\_private\_size* Size of raw PMDs private data \
 *socket\_id* Socket to allocate resources on.

**Returns**

- •

  Raw device pointer if device is successfully created.

- •

  NULL if device cannot be created.

### int rte\_rawdev\_pmd\_uninit (const char \* name)

Destroy a raw device

**Parameters**

*name* Name of the device

**Returns**

- •

  0 on success, negative on error

## Author

Generated automatically by Doxygen for DPDK from the source code.
