---
name: "rte_pci_addr_parse"
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_pci.h"
---

# rte\_pci\_addr\_parse(3)

Part of [rte\_pci.h(3)](/rte_pci.h/3.md).

## NAME

rte\_pci.h

## SYNOPSIS

`#include <stdio.h>`\
 `#include <inttypes.h>`\
 `#include <sys/types.h>`\

### Data Structures

struct **rte\_pci\_id**\
 struct **rte\_pci\_addr**\

### Macros

\#define **PCI\_PRI\_FMT**   '%.4' PRIx32 ':%.2' PRIx8 ':%.2' PRIx8 '.%' PRIx8\
 \#define **PCI\_SHORT\_PRI\_FMT**   '%.2' PRIx8 ':%.2' PRIx8 '.%' PRIx8\
 \#define **PCI\_FMT\_NVAL**   4\
 \#define **PCI\_RESOURCE\_FMT\_NVAL**   3\
 \#define **PCI\_MAX\_RESOURCE**   6\
 \#define **RTE\_PCI\_ANY\_ID**   (0xffff)\
 \#define **PCI\_ANY\_ID**   **RTE\_DEPRECATED**(PCI\_ANY\_ID) **RTE\_PCI\_ANY\_ID**\

### Functions

void **rte\_pci\_device\_name** (const struct **rte\_pci\_addr** \*addr, char \*output, size\_t size)\
 int **rte\_pci\_addr\_cmp** (const struct **rte\_pci\_addr** \*addr, const struct **rte\_pci\_addr** \*addr2)\
 int **rte\_pci\_addr\_parse** (const char \*str, struct **rte\_pci\_addr** \*addr)\

## Detailed Description

RTE PCI Library

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

## Macro Definition Documentation

### #define PCI\_PRI\_FMT '%.4' PRIx32 ':%.2' PRIx8 ':%.2' PRIx8 '.%' PRIx8

Formatting string for PCI device identifier: Ex: 0000:00:01.0

Definition at line **141** of file **rte\_pci.h**.

### #define PCI\_SHORT\_PRI\_FMT '%.2' PRIx8 ':%.2' PRIx8 '.%' PRIx8

Short formatting string, without domain, for PCI device: Ex: 00:01.0

Definition at line **145** of file **rte\_pci.h**.

### #define PCI\_FMT\_NVAL 4

Nb. of values in PCI device identifier format string.

Definition at line **148** of file **rte\_pci.h**.

### #define PCI\_RESOURCE\_FMT\_NVAL 3

Nb. of values in PCI resource format.

Definition at line **151** of file **rte\_pci.h**.

### #define PCI\_MAX\_RESOURCE 6

Maximum number of PCI resources.

Definition at line **154** of file **rte\_pci.h**.

### #define RTE\_PCI\_ANY\_ID (0xffff)

Any PCI device identifier (vendor, device, ...)

Definition at line **179** of file **rte\_pci.h**.

### #define PCI\_ANY\_ID RTE\_DEPRECATED(PCI\_ANY\_ID) RTE\_PCI\_ANY\_ID

**Deprecated**

Replaced with RTE\_PCI\_ANY\_ID

Definition at line **181** of file **rte\_pci.h**.

## Function Documentation

### void rte\_pci\_device\_name (const struct rte\_pci\_addr \* addr, char \* output, size\_t size)

Utility function to write a pci device name, this device name can later be used to retrieve the corresponding **rte\_pci\_addr** using **rte\_pci\_addr\_parse()**.

**Parameters**

*addr* The PCI Bus-Device-Function address \
 *output* The output buffer string \
 *size* The output buffer size

### int rte\_pci\_addr\_cmp (const struct rte\_pci\_addr \* addr, const struct rte\_pci\_addr \* addr2)

Utility function to compare two PCI device addresses.

**Parameters**

*addr* The PCI Bus-Device-Function address to compare \
 *addr2* The PCI Bus-Device-Function address to compare

**Returns**

0 on equal PCI address. Positive on addr is greater than addr2. Negative on addr is less than addr2, or error.

### int rte\_pci\_addr\_parse (const char \* str, struct rte\_pci\_addr \* addr)

Utility function to parse a string into a PCI location.

**Parameters**

*str* The string to parse \
 *addr* The reference to the structure where the location is stored.

**Returns**

0 on success \<0 otherwise

## Author

Generated automatically by Doxygen for DPDK from the source code.
