DPDK  23.03.0
Data Structures | Macros | Functions
rte_pci.h File Reference
#include <stdio.h>
#include <inttypes.h>
#include <sys/types.h>

Go to the source code of this file.

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

◆ PCI_PRI_FMT

#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 62 of file rte_pci.h.

◆ PCI_SHORT_PRI_FMT

#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 66 of file rte_pci.h.

◆ PCI_FMT_NVAL

#define PCI_FMT_NVAL   4

Nb. of values in PCI device identifier format string.

Definition at line 69 of file rte_pci.h.

◆ PCI_RESOURCE_FMT_NVAL

#define PCI_RESOURCE_FMT_NVAL   3

Nb. of values in PCI resource format.

Definition at line 72 of file rte_pci.h.

◆ PCI_MAX_RESOURCE

#define PCI_MAX_RESOURCE   6

Maximum number of PCI resources.

Definition at line 75 of file rte_pci.h.

◆ RTE_PCI_ANY_ID

#define RTE_PCI_ANY_ID   (0xffff)

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

Definition at line 100 of file rte_pci.h.

◆ PCI_ANY_ID

#define PCI_ANY_ID   RTE_DEPRECATED(PCI_ANY_ID) RTE_PCI_ANY_ID
Deprecated:
Replaced with RTE_PCI_ANY_ID

Definition at line 102 of file rte_pci.h.

Function Documentation

◆ rte_pci_device_name()

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 eal_parse_pci_* BDF helpers.

Parameters
addrThe PCI Bus-Device-Function address
outputThe output buffer string
sizeThe output buffer size

◆ rte_pci_addr_cmp()

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
addrThe PCI Bus-Device-Function address to compare
addr2The 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.

◆ rte_pci_addr_parse()

int rte_pci_addr_parse ( const char *  str,
struct rte_pci_addr addr 
)

Utility function to parse a string into a PCI location.

Parameters
strThe string to parse
addrThe reference to the structure where the location is stored.
Returns
0 on success <0 otherwise