#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
#include <sys/queue.h>
#include <stdint.h>
#include <inttypes.h>
#include <rte_interrupts.h>
Go to the source code of this file.
Functions |
| TAILQ_HEAD (pci_device_list, rte_pci_device) |
| TAILQ_HEAD (pci_driver_list, rte_pci_driver) |
| 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 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) |
Detailed Description
RTE PCI Interface
Definition in file rte_pci.h.
Macro Definition Documentation
#define SYSFS_PCI_DEVICES "/sys/bus/pci/devices" |
Pathname of PCI devices directory.
Definition at line 94 of 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 97 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 100 of file rte_pci.h.
Nb. of values in PCI device identifier format string.
Definition at line 103 of file rte_pci.h.
#define PCI_RESOURCE_FMT_NVAL 3 |
Nb. of values in PCI resource format.
Definition at line 106 of file rte_pci.h.
#define IORESOURCE_MEM 0x00000200 |
IO resource type: memory address space
Definition at line 109 of file rte_pci.h.
#define PCI_MAX_RESOURCE 6 |
Maximum number of PCI resources.
Definition at line 121 of file rte_pci.h.
#define PCI_ANY_ID (0xffff) |
Any PCI device identifier (vendor, device, ...)
Definition at line 172 of file rte_pci.h.
#define RTE_PCI_DEVICE |
( |
|
vend, |
|
|
|
dev |
|
) |
| |
Value:.vendor_id = (vend), \
.device_id = (dev), \
Macro used to help building up tables of device IDs
Definition at line 183 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 215 of file rte_pci.h.
#define RTE_PCI_DRV_FORCE_UNBIND 0x0004 |
Device driver must be registered several times until failure - deprecated Device needs to be unbound even if no module is provided
Definition at line 219 of file rte_pci.h.
#define RTE_PCI_DRV_INTR_LSC 0x0008 |
Device driver supports link state interrupt
Definition at line 221 of file rte_pci.h.
#define RTE_PCI_DRV_DETACHABLE 0x0010 |
Device driver supports detaching capability
Definition at line 223 of file rte_pci.h.
Typedef Documentation
Initialisation function for the driver called during PCI probing.
Definition at line 195 of file rte_pci.h.
Uninitialisation function for the driver called during hotplugging.
Definition at line 200 of file rte_pci.h.
Function Documentation
PCI devices in D-linked Q.
PCI drivers in D-linked Q.
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 280 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 302 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 326 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 devuninit() 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 |
Initialises 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.
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. |
Variable Documentation
struct pci_driver_list pci_driver_list |
Global list of PCI drivers.
struct pci_device_list pci_device_list |
Global list of PCI devices.