From 51798a5d1cb931f2605685cc01c2b9ac6b5af078 Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Fri, 24 Dec 2010 10:41:52 -0800 Subject: [PATCH] node_device: udev driver does not handle SR-IOV devices The udev driver does not update a PCI device with its SR-IOV capabilities, when applicable, the way the hal driver does. As a result, dumping the device's XML will not include the relevant physical or virtual function information. With this patch, the XML is correct: # virsh nodedev-dumpxml pci_0000_09_00_0 pci_0000_09_00_0 pci_0000_00_1c_0 vxge 0 9 0 0 X3100 Series 10 Gigabit Ethernet PCIe Neterion Inc.
# virsh nodedev-dumpxml pci_0000_0a_00_1 pci_0000_0a_00_1 pci_0000_00_1c_0 vxge 0 10 0 1 X3100 Series 10 Gigabit Ethernet PCIe Neterion Inc.
Cc: Dave Allan Signed-off-by: Chris Wright --- src/node_device/node_device_udev.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 02e44a1cde..379af86f56 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -419,11 +419,11 @@ out: static int udevProcessPCI(struct udev_device *device, virNodeDeviceDefPtr def) { - const char *devpath = NULL; + const char *syspath = NULL; union _virNodeDevCapData *data = &def->caps->data; int ret = -1; - devpath = udev_device_get_devpath(device); + syspath = udev_device_get_syspath(device); if (udevGetUintProperty(device, "PCI_CLASS", @@ -432,7 +432,7 @@ static int udevProcessPCI(struct udev_device *device, goto out; } - char *p = strrchr(devpath, '/'); + char *p = strrchr(syspath, '/'); if ((p == NULL) || (udevStrToLong_ui(p+1, &p, @@ -487,6 +487,9 @@ static int udevProcessPCI(struct udev_device *device, goto out; } + get_physical_function(syspath, data); + get_virtual_functions(syspath, data); + ret = 0; out: