#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
#include <sys/queue.h>
#include <stdint.h>
#include <inttypes.h>
#include <rte_debug.h>
#include <rte_interrupts.h>
#include <rte_dev.h>
Go to the source code of this file.
|
| TAILQ_HEAD (pci_device_list, rte_pci_device) |
|
| TAILQ_HEAD (pci_driver_list, rte_pci_driver) |
|
const char * | pci_get_sysfs_path (void) |
|
| TAILQ_HEAD (mapped_pci_res_list, mapped_pci_resource) |
|
static int | eal_parse_pci_BDF (const char *input, struct rte_pci_addr *dev_addr) |
|
static int | eal_parse_pci_DomBDF (const char *input, struct rte_pci_addr *dev_addr) |
|
static void | rte_eal_pci_device_name (const struct rte_pci_addr *addr, char *output, size_t size) |
|
static int | rte_eal_compare_pci_addr (const struct rte_pci_addr *addr, const struct rte_pci_addr *addr2) |
|
int | rte_eal_pci_scan (void) |
|
int | rte_eal_pci_probe (void) |
|
int | rte_eal_pci_map_device (struct rte_pci_device *dev) |
|
void | rte_eal_pci_unmap_device (struct rte_pci_device *dev) |
|
int | rte_eal_pci_probe_one (const struct rte_pci_addr *addr) |
|
int | rte_eal_pci_detach (const struct rte_pci_addr *addr) |
|
void | rte_eal_pci_dump (FILE *f) |
|
void | rte_eal_pci_register (struct rte_pci_driver *driver) |
|
void | rte_eal_pci_unregister (struct rte_pci_driver *driver) |
|
int | rte_eal_pci_read_config (const struct rte_pci_device *device, void *buf, size_t len, off_t offset) |
|
int | rte_eal_pci_write_config (const struct rte_pci_device *device, const void *buf, size_t len, off_t offset) |
|
int | rte_eal_pci_ioport_map (struct rte_pci_device *dev, int bar, struct rte_pci_ioport *p) |
|
int | rte_eal_pci_ioport_unmap (struct rte_pci_ioport *p) |
|
void | rte_eal_pci_ioport_read (struct rte_pci_ioport *p, void *data, size_t len, off_t offset) |
|
void | rte_eal_pci_ioport_write (struct rte_pci_ioport *p, const void *data, size_t len, off_t offset) |
|
RTE PCI Interface
Definition in file rte_pci.h.
#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8 |
Formatting string for PCI device identifier: Ex: 0000:00:01.0
Definition at line 99 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 103 of file rte_pci.h.
Nb. of values in PCI device identifier format string.
Definition at line 106 of file rte_pci.h.
#define PCI_RESOURCE_FMT_NVAL 3 |
Nb. of values in PCI resource format.
Definition at line 109 of file rte_pci.h.
#define PCI_MAX_RESOURCE 6 |
Maximum number of PCI resources.
Definition at line 112 of file rte_pci.h.
#define PCI_ANY_ID (0xffff) |
Any PCI device identifier (vendor, device, ...)
Definition at line 164 of file rte_pci.h.
#define RTE_PCI_DEVICE |
( |
|
vend, |
|
|
|
dev |
|
) |
| |
Value:.class_id = RTE_CLASS_ANY_ID, \
.vendor_id = (vend), \
.device_id = (dev), \
Macro used to help building up tables of device IDs
Definition at line 177 of file rte_pci.h.
#define RTE_PCI_DRV_NEED_MAPPING 0x0001 |
Device needs PCI BAR mapping (done with either IGB_UIO or VFIO)
Definition at line 210 of file rte_pci.h.
#define RTE_PCI_DRV_FORCE_UNBIND 0x0004 |
Device needs to be unbound even if no module is provided
Definition at line 212 of file rte_pci.h.
#define RTE_PCI_DRV_INTR_LSC 0x0008 |
Device driver supports link state interrupt
Definition at line 214 of file rte_pci.h.
#define RTE_PCI_DRV_DETACHABLE 0x0010 |
Device driver supports detaching capability
Definition at line 216 of file rte_pci.h.
#define RTE_PMD_REGISTER_PCI |
( |
|
nm, |
|
|
|
pci_drv |
|
) |
| |
Value:RTE_INIT(pciinitfn_ ##nm); \
static void pciinitfn_ ##nm(void) \
{\
} \
RTE_PMD_EXPORT_NAME(nm, __COUNTER__)
void rte_eal_pci_register(struct rte_pci_driver *driver)
Helper for PCI device registration from driver (eth, crypto) instance
Definition at line 492 of file rte_pci.h.
Initialisation function for the driver called during PCI probing.
Definition at line 190 of file rte_pci.h.
Uninitialisation function for the driver called during hotplugging.
Definition at line 195 of file rte_pci.h.
PCI devices in D-linked Q.
PCI drivers in D-linked Q.
const char* pci_get_sysfs_path |
( |
void |
| ) |
|
Pathname of PCI devices directory.
mapped pci device list Internal use only - Macro used by pci addr parsing functions
static int eal_parse_pci_BDF |
( |
const char * |
input, |
|
|
struct rte_pci_addr * |
dev_addr |
|
) |
| |
|
inlinestatic |
Utility function to produce a PCI Bus-Device-Function value given a string representation. Assumes that the BDF is provided without a domain prefix (i.e. domain returned is always 0)
- Parameters
-
input | The input string to be parsed. Should have the format XX:XX.X |
dev_addr | The PCI Bus-Device-Function address to be returned. Domain will always be returned as 0 |
- Returns
- 0 on success, negative on error.
Definition at line 275 of file rte_pci.h.
static int eal_parse_pci_DomBDF |
( |
const char * |
input, |
|
|
struct rte_pci_addr * |
dev_addr |
|
) |
| |
|
inlinestatic |
Utility function to produce a PCI Bus-Device-Function value given a string representation. Assumes that the BDF is provided including a domain prefix.
- Parameters
-
input | The input string to be parsed. Should have the format XXXX:XX:XX.X |
dev_addr | The PCI Bus-Device-Function address to be returned |
- Returns
- 0 on success, negative on error.
Definition at line 297 of file rte_pci.h.
static void rte_eal_pci_device_name |
( |
const struct rte_pci_addr * |
addr, |
|
|
char * |
output, |
|
|
size_t |
size |
|
) |
| |
|
inlinestatic |
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
-
addr | The PCI Bus-Device-Function address |
output | The output buffer string |
size | The output buffer size |
Definition at line 320 of file rte_pci.h.
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.
Definition at line 343 of file rte_pci.h.
int rte_eal_pci_scan |
( |
void |
| ) |
|
Scan the content of the PCI bus, and the devices in the devices list
- Returns
- 0 on success, negative on error
int rte_eal_pci_probe |
( |
void |
| ) |
|
Probe the PCI bus for registered drivers.
Scan the content of the PCI bus, and call the probe() function for all registered drivers that have a matching entry in its id_table for discovered devices.
- Returns
- 0 on success.
- Negative on error.
Map the PCI device resources in user space virtual memory address
Note that driver should not call this function when flag RTE_PCI_DRV_NEED_MAPPING is set, as EAL will do that for you when it's on.
- Parameters
-
dev | A pointer to a rte_pci_device structure describing the device to use |
- Returns
- 0 on success, negative on error and positive if no driver is found for the device.
Unmap this device
- Parameters
-
dev | A pointer to a rte_pci_device structure describing the device to use |
int rte_eal_pci_probe_one |
( |
const struct rte_pci_addr * |
addr | ) |
|
Probe the single PCI device.
Scan the content of the PCI bus, and find the pci device specified by pci address, then call the probe() function for registered driver that has a matching entry in its id_table for discovered device.
- Parameters
-
addr | The PCI Bus-Device-Function address to probe. |
- Returns
- 0 on success.
- Negative on error.
Close the single PCI device.
Scan the content of the PCI bus, and find the pci device specified by pci address, then call the remove() function for registered driver that has a matching entry in its id_table for discovered device.
- Parameters
-
addr | The PCI Bus-Device-Function address to close. |
- Returns
- 0 on success.
- Negative on error.
void rte_eal_pci_dump |
( |
FILE * |
f | ) |
|
Dump the content of the PCI bus.
- Parameters
-
f | A pointer to a file for output |
Register a PCI driver.
- Parameters
-
driver | A pointer to a rte_pci_driver structure describing the driver to be registered. |
Unregister a PCI driver.
- Parameters
-
driver | A pointer to a rte_pci_driver structure describing the driver to be unregistered. |
int rte_eal_pci_read_config |
( |
const struct rte_pci_device * |
device, |
|
|
void * |
buf, |
|
|
size_t |
len, |
|
|
off_t |
offset |
|
) |
| |
Read PCI config space.
- Parameters
-
device | A pointer to a rte_pci_device structure describing the device to use |
buf | A data buffer where the bytes should be read into |
len | The length of the data buffer. |
offset | The offset into PCI config space |
int rte_eal_pci_write_config |
( |
const struct rte_pci_device * |
device, |
|
|
const void * |
buf, |
|
|
size_t |
len, |
|
|
off_t |
offset |
|
) |
| |
Write PCI config space.
- Parameters
-
device | A pointer to a rte_pci_device structure describing the device to use |
buf | A data buffer containing the bytes should be written |
len | The length of the data buffer. |
offset | The offset into PCI config space |
Initialize a rte_pci_ioport object for a pci device io resource.
This object is then used to gain access to those io resources (see below).
- Parameters
-
dev | A pointer to a rte_pci_device structure describing the device to use. |
bar | Index of the io pci resource we want to access. |
p | The rte_pci_ioport object to be initialized. |
- Returns
- 0 on success, negative on error.
Release any resources used in a rte_pci_ioport object.
- Parameters
-
- Returns
- 0 on success, negative on error.
void rte_eal_pci_ioport_read |
( |
struct rte_pci_ioport * |
p, |
|
|
void * |
data, |
|
|
size_t |
len, |
|
|
off_t |
offset |
|
) |
| |
Read from a io pci resource.
- Parameters
-
p | The rte_pci_ioport object from which we want to read. |
data | A data buffer where the bytes should be read into |
len | The length of the data buffer. |
offset | The offset into the pci io resource. |
void rte_eal_pci_ioport_write |
( |
struct rte_pci_ioport * |
p, |
|
|
const void * |
data, |
|
|
size_t |
len, |
|
|
off_t |
offset |
|
) |
| |
Write to a io pci resource.
- Parameters
-
p | The rte_pci_ioport object to which we want to write. |
data | A data buffer where the bytes should be read into |
len | The length of the data buffer. |
offset | The offset into the pci io resource. |
struct pci_driver_list pci_driver_list |
Global list of PCI drivers.
struct pci_device_list pci_device_list |
Global list of PCI devices.