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
<device>
<name>pci_0000_09_00_0</name>
<parent>pci_0000_00_1c_0</parent>
<driver>
<name>vxge</name>
</driver>
<capability type='pci'>
<domain>0</domain>
<bus>9</bus>
<slot>0</slot>
<function>0</function>
<product id='0x5833'>X3100 Series 10 Gigabit Ethernet
PCIe</product>
<vendor id='0x17d5'>Neterion Inc.</vendor>
<capability type='virt_functions'>
<address domain='0x0000' bus='0x0a' slot='0x00'
function='0x1'/>
<address domain='0x0000' bus='0x0a' slot='0x00'
function='0x2'/>
<address domain='0x0000' bus='0x0a' slot='0x00'
function='0x3'/>
</capability>
</capability>
</device>
# virsh nodedev-dumpxml pci_0000_0a_00_1
<device>
<name>pci_0000_0a_00_1</name>
<parent>pci_0000_00_1c_0</parent>
<driver>
<name>vxge</name>
</driver>
<capability type='pci'>
<domain>0</domain>
<bus>10</bus>
<slot>0</slot>
<function>1</function>
<product id='0x5833'>X3100 Series 10 Gigabit Ethernet
PCIe</product>
<vendor id='0x17d5'>Neterion Inc.</vendor>
<capability type='phys_function'>
<address domain='0x0000' bus='0x09' slot='0x00'
function='0x0'/>
</capability>
</capability>
</device>
Cc: Dave Allan <dallan(a)redhat.com>
Signed-off-by: Chris Wright <chrisw(a)redhat.com>
---
src/node_device/node_device_udev.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 02e44a1..379af86 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: