igb_uio: add missing locking to config access
[dpdk.git] / lib / librte_eal / bsdapp / eal / eal_pci.c
index b560077..2bbbeb0 100644 (file)
@@ -211,13 +211,13 @@ pci_uio_map_resource(struct rte_pci_device *dev)
        if (rte_eal_process_type() != RTE_PROC_PRIMARY)
                return (pci_uio_map_secondary(dev));
 
-       rte_snprintf(devname, sizeof(devname), "/dev/uio@pci:%u:%u:%u",
+       snprintf(devname, sizeof(devname), "/dev/uio@pci:%u:%u:%u",
                        dev->addr.bus, dev->addr.devid, dev->addr.function);
 
        if (access(devname, O_RDWR) < 0) {
                RTE_LOG(WARNING, EAL, "  "PCI_PRI_FMT" not managed by UIO driver, "
                                "skipping\n", loc->domain, loc->bus, loc->devid, loc->function);
-               return -1;
+               return 1;
        }
 
        /* save fd if in primary process */
@@ -236,7 +236,7 @@ pci_uio_map_resource(struct rte_pci_device *dev)
                return (-1);
        }
 
-       rte_snprintf(uio_res->path, sizeof(uio_res->path), "%s", devname);
+       snprintf(uio_res->path, sizeof(uio_res->path), "%s", devname);
        memcpy(&uio_res->pci_addr, &dev->addr, sizeof(uio_res->pci_addr));
 
 
@@ -440,6 +440,7 @@ int
 rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *dev)
 {
        struct rte_pci_id *id_table;
+       int ret;
 
        for (id_table = dr->id_table ; id_table->vendor_id != 0; id_table++) {
 
@@ -474,10 +475,11 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d
                        return 0;
                }
 
-               if (dr->drv_flags & RTE_PCI_DRV_NEED_IGB_UIO) {
+               if (dr->drv_flags & RTE_PCI_DRV_NEED_MAPPING) {
                        /* map resources for devices that use igb_uio */
-                       if (pci_uio_map_resource(dev) < 0)
-                               return -1;
+                       ret = pci_uio_map_resource(dev);
+                       if (ret != 0)
+                               return ret;
                } else if (dr->drv_flags & RTE_PCI_DRV_FORCE_UNBIND &&
                           rte_eal_process_type() == RTE_PROC_PRIMARY) {
                        /* unbind current driver */