libvirt/src/node_device
Laine Stump f391889f4e nodedev: report maxCount for virtual_functions capability
A PCI device may have the capability to setup virtual functions (VFs)
but have them currently all disabled. Prior to this patch, if that was
the case the the node device XML for the device wouldn't report any
virtual_functions capability.

With this patch, if a file called "sriov_totalvfs" is found in the
device's sysfs directory, its contents will be interpreted as a
decimal number, and that value will be reported as "maxCount" in a
capability element of the device's XML, e.g.:

   <capability type='virtual_functions' maxCount='7'/>

This will be reported regardless of whether or not any VFs are
currently enabled for the device.

NB: sriov_numvfs (the number of VFs currently active) is also
available in sysfs, but that value is implied by the number of items
in the list that is inside the capability element, so there is no
reason to explicitly provide it as an attribute.

sriov_totalvfs and sriov_numvfs are available in kernels at least as far
back as the 2.6.32 that is in RHEL6.7, but in the case that they
simply aren't there, libvirt will behave as it did prior to this patch
- no maxCount will be displayed, and the virtual_functions capability
will be absent from the device's XML when 0 VFs are enabled.
2015-11-24 12:31:04 -05:00
..
node_device_driver.c nodedev: update netdev feature bits before each dumpxml 2015-06-17 13:51:33 -04:00
node_device_driver.h node device: prepare node_device_linux_sysfs.c to add more functions 2015-05-18 10:30:27 -04:00
node_device_hal.c node_device: fix libvirt build if WITH_HAL is defined 2015-05-21 14:25:20 -04:00
node_device_hal.h
node_device_linux_sysfs.c nodedev: report maxCount for virtual_functions capability 2015-11-24 12:31:04 -05:00
node_device_linux_sysfs.h node_device: new functions to get sriov/iommu info from sysfs 2015-05-18 10:31:58 -04:00
node_device_udev.c node_device: replace duplicated code in hal and udev backends 2015-05-18 10:34:01 -04:00
node_device_udev.h