mirror of
https://github.com/libvirt/libvirt.git
synced 2026-07-29 23:58:02 -05:00
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
<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@redhat.com>
Signed-off-by: Chris Wright <chrisw@redhat.com>
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user