summaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-07-10 15:38:21 +0200
committerDamjan Marion <damarion@cisco.com>2017-07-10 15:42:27 +0200
commit191a1a407ebd299907d2890cbb0369a6d7c19a45 (patch)
tree51e8b72f3dc0fc42bb13d3c417210263d22b5879 /src/vlib
parentbb18ee6f1c7c172d30cb0c98153499af571777ee (diff)
vlib: fix issues with PCI handling code
- PCI devices not properly discovered - vlib_pci_bus_master_enable () not working Change-Id: I7433ab1b19b890b8900635b43037b9a2017a1921 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/pci/linux_pci.c12
-rw-r--r--src/vlib/pci/pci.h2
2 files changed, 7 insertions, 7 deletions
diff --git a/src/vlib/pci/linux_pci.c b/src/vlib/pci/linux_pci.c
index 623737d5355..2d3c0a8807d 100644
--- a/src/vlib/pci/linux_pci.c
+++ b/src/vlib/pci/linux_pci.c
@@ -562,8 +562,6 @@ scan_device (void *arg, u8 * dev_dir_name, u8 * ignored)
hash_set (pm->pci_dev_index_by_pci_addr, dev->bus_address.as_u32,
dev - pm->pci_devs);
- error = init_device (vm, dev, &pdev);
-
vec_reset_length (f);
f = format (f, "%v/vpd%c", dev_dir_name, 0);
fd = open ((char *) f, O_RDONLY);
@@ -601,10 +599,6 @@ scan_device (void *arg, u8 * dev_dir_name, u8 * ignored)
close (fd);
}
- vec_reset_length (f);
- f = format (f, "%v/driver%c", dev_dir_name, 0);
- dev->driver_name = vlib_sysfs_link_to_name ((char *) f);
-
dev->numa_node = -1;
vec_reset_length (f);
f = format (f, "%v/numa_node%c", dev_dir_name, 0);
@@ -625,6 +619,12 @@ scan_device (void *arg, u8 * dev_dir_name, u8 * ignored)
vlib_sysfs_read ((char *) f, "0x%x", &tmp);
dev->device_id = tmp;
+ error = init_device (vm, dev, &pdev);
+
+ vec_reset_length (f);
+ f = format (f, "%v/driver%c", dev_dir_name, 0);
+ dev->driver_name = vlib_sysfs_link_to_name ((char *) f);
+
done:
vec_free (f);
return error;
diff --git a/src/vlib/pci/pci.h b/src/vlib/pci/pci.h
index 811a6ff2336..2141080936d 100644
--- a/src/vlib/pci/pci.h
+++ b/src/vlib/pci/pci.h
@@ -215,7 +215,7 @@ vlib_pci_bus_master_enable (vlib_pci_device_t * dev)
if (err)
return err;
- if (!(command & PCI_COMMAND_BUS_MASTER))
+ if (command & PCI_COMMAND_BUS_MASTER)
return 0;
command |= PCI_COMMAND_BUS_MASTER;