TAILQ_HEAD(uio_res_list, uio_resource);
-static struct uio_res_list *uio_res_list = NULL;
-
-static struct rte_tailq_elem rte_pci_tailq = {
- .name = "PCI_RESOURCE_LIST",
+static struct rte_tailq_elem rte_uio_tailq = {
+ .name = "UIO_RESOURCE_LIST",
};
-EAL_REGISTER_TAILQ(rte_pci_tailq)
+EAL_REGISTER_TAILQ(rte_uio_tailq)
/* unbind kernel driver for this device */
static int
{
size_t i;
struct uio_resource *uio_res;
+ struct uio_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, uio_res_list);
TAILQ_FOREACH(uio_res, uio_res_list, next) {
uint64_t pagesz;
struct rte_pci_addr *loc = &dev->addr;
struct uio_resource *uio_res;
+ struct uio_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, uio_res_list);
struct uio_map *maps;
dev->intr_handle.fd = -1;
{
TAILQ_INIT(&pci_driver_list);
TAILQ_INIT(&pci_device_list);
- uio_res_list = RTE_TAILQ_CAST(rte_pci_tailq.head, uio_res_list);
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
* IGB_UIO driver (or doesn't initialize, if the device wasn't bound to it).
*/
-struct mapped_pci_res_list *pci_res_list = NULL;
-
-static struct rte_tailq_elem rte_pci_tailq = {
- .name = "PCI_RESOURCE_LIST",
-};
-EAL_REGISTER_TAILQ(rte_pci_tailq)
-
/* unbind kernel driver for this device */
static int
pci_unbind_kernel_driver(struct rte_pci_device *dev)
{
TAILQ_INIT(&pci_driver_list);
TAILQ_INIT(&pci_device_list);
- pci_res_list = RTE_TAILQ_CAST(rte_pci_tailq.head, mapped_pci_res_list);
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
};
TAILQ_HEAD(mapped_pci_res_list, mapped_pci_resource);
-extern struct mapped_pci_res_list *pci_res_list;
/*
* Helper function to map PCI resources right after hugepages in virtual memory
#include <rte_log.h>
#include <rte_pci.h>
+#include <rte_eal_memconfig.h>
#include <rte_common.h>
#include <rte_malloc.h>
void *pci_map_addr = NULL;
+static struct rte_tailq_elem rte_uio_tailq = {
+ .name = "UIO_RESOURCE_LIST",
+};
+EAL_REGISTER_TAILQ(rte_uio_tailq)
#define OFF_MAX ((uint64_t)(off_t)-1)
{
int fd, i;
struct mapped_pci_resource *uio_res;
+ struct mapped_pci_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list);
- TAILQ_FOREACH(uio_res, pci_res_list, next) {
+ TAILQ_FOREACH(uio_res, uio_res_list, next) {
/* skip this element if it doesn't match our PCI address */
if (rte_eal_compare_pci_addr(&uio_res->pci_addr, &dev->addr))
uint64_t phaddr;
struct rte_pci_addr *loc = &dev->addr;
struct mapped_pci_resource *uio_res;
+ struct mapped_pci_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list);
struct pci_map *maps;
dev->intr_handle.fd = -1;
uio_res->nb_maps = map_idx;
- TAILQ_INSERT_TAIL(pci_res_list, uio_res, next);
+ TAILQ_INSERT_TAIL(uio_res_list, uio_res, next);
return 0;
}
pci_uio_find_resource(struct rte_pci_device *dev)
{
struct mapped_pci_resource *uio_res;
+ struct mapped_pci_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list);
if (dev == NULL)
return NULL;
- TAILQ_FOREACH(uio_res, pci_res_list, next) {
+ TAILQ_FOREACH(uio_res, uio_res_list, next) {
/* skip this element if it doesn't match our PCI address */
if (!rte_eal_compare_pci_addr(&uio_res->pci_addr, &dev->addr))
pci_uio_unmap_resource(struct rte_pci_device *dev)
{
struct mapped_pci_resource *uio_res;
+ struct mapped_pci_res_list *uio_res_list = RTE_TAILQ_CAST(rte_uio_tailq.head, mapped_pci_res_list);
if (dev == NULL)
return;
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return pci_uio_unmap(uio_res);
- TAILQ_REMOVE(pci_res_list, uio_res, next);
+ TAILQ_REMOVE(uio_res_list, uio_res, next);
/* unmap all resources */
pci_uio_unmap(uio_res);
#define PAGE_SIZE (sysconf(_SC_PAGESIZE))
#define PAGE_MASK (~(PAGE_SIZE - 1))
+static struct rte_tailq_elem rte_vfio_tailq = {
+ .name = "VFIO_RESOURCE_LIST",
+};
+EAL_REGISTER_TAILQ(rte_vfio_tailq)
+
#define VFIO_DIR "/dev/vfio"
#define VFIO_CONTAINER_PATH "/dev/vfio/vfio"
#define VFIO_GROUP_FMT "/dev/vfio/%u"
struct rte_pci_addr *loc = &dev->addr;
int i, ret, msix_bar;
struct mapped_pci_resource *vfio_res = NULL;
+ struct mapped_pci_res_list *vfio_res_list = RTE_TAILQ_CAST(rte_vfio_tailq.head, mapped_pci_res_list);
+
struct pci_map *maps;
uint32_t msix_table_offset = 0;
uint32_t msix_table_size = 0;
VFIO_PCI_BAR5_REGION_INDEX + 1);
} else {
/* if we're in a secondary process, just find our tailq entry */
- TAILQ_FOREACH(vfio_res, pci_res_list, next) {
+ TAILQ_FOREACH(vfio_res, vfio_res_list, next) {
if (memcmp(&vfio_res->pci_addr, &dev->addr, sizeof(dev->addr)))
continue;
break;
}
if (internal_config.process_type == RTE_PROC_PRIMARY)
- TAILQ_INSERT_TAIL(pci_res_list, vfio_res, next);
+ TAILQ_INSERT_TAIL(vfio_res_list, vfio_res, next);
return 0;
}