eal/linux: change log severity levels
[dpdk.git] / lib / librte_eal / linuxapp / eal / eal_pci_vfio.c
index ee9660f..cf5ac50 100644 (file)
@@ -41,7 +41,6 @@
 
 #include <rte_log.h>
 #include <rte_pci.h>
-#include <rte_tailq.h>
 #include <rte_eal_memconfig.h>
 #include <rte_malloc.h>
 #include <eal_private.h>
 #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"
@@ -290,7 +294,7 @@ pci_vfio_setup_interrupts(struct rte_pci_device *dev, int vfio_dev_fd)
                }
 
                /* set up an eventfd for interrupts */
-               fd = eventfd(0, 0);
+               fd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
                if (fd < 0) {
                        RTE_LOG(ERR, EAL, "  cannot set up eventfd, "
                                        "error %i (%s)\n", errno, strerror(errno));
@@ -547,6 +551,8 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
        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;
@@ -701,7 +707,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
                                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;
@@ -722,7 +728,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
                struct vfio_region_info reg = { .argsz = sizeof(reg) };
                void *bar_addr;
                struct memreg {
-                       uint32_t offset, size;
+                       unsigned long offset, size;
                } memreg[2] = {};
 
                reg.index = i;
@@ -765,7 +771,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
                                RTE_LOG(DEBUG, EAL,
                                        "Trying to map BAR %d that contains the MSI-X "
                                        "table. Trying offsets: "
-                                       "%04x:%04x, %04x:%04x\n", i,
+                                       "0x%04lx:0x%04lx, 0x%04lx:0x%04lx\n", i,
                                        memreg[0].offset, memreg[0].size,
                                        memreg[1].offset, memreg[1].size);
                        }
@@ -855,7 +861,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
        }
 
        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;
 }
@@ -893,7 +899,7 @@ pci_vfio_enable(void)
        if (vfio_cfg.vfio_container_fd != -1)
                vfio_cfg.vfio_enabled = 1;
        else
-               RTE_LOG(INFO, EAL, "VFIO support could not be initialized\n");
+               RTE_LOG(NOTICE, EAL, "VFIO support could not be initialized\n");
 
        return 0;
 }