]> git.ipfire.org Git - thirdparty/libvirt.git/commit
nodedev: Fix failing to parse PCI address for non-PCI network devices
authorJim Fehlig <jfehlig@suse.com>
Sat, 6 Jan 2018 00:10:47 +0000 (17:10 -0700)
committerJim Fehlig <jfehlig@suse.com>
Fri, 19 Jan 2018 16:53:01 +0000 (09:53 -0700)
commit71d56a397925a1bd55d3aee30afdbdcd1a14f9a8
tree49cc18a494dd1b4f959aa963ceb646d22927686e
parent72adaf2f10509c3682f2c65ffad4176e00e5a2fb
nodedev: Fix failing to parse PCI address for non-PCI network devices

Commit 8708ca01c added virNetDevSwitchdevFeature() to check if a network
device has Switchdev capabilities. virNetDevSwitchdevFeature() attempts
to retrieve the PCI device associated with the network device, ignoring
non-PCI devices. It does so via the following call chain

  virNetDevSwitchdevFeature()->virNetDevGetPCIDevice()->
  virPCIGetDeviceAddressFromSysfsLink()

For non-PCI network devices (qeth, Xen vif, etc),
virPCIGetDeviceAddressFromSysfsLink() will report an error when
virPCIDeviceAddressParse() fails. virPCIDeviceAddressParse() also
logs an error. After commit 8708ca01c there are now two errors reported
for each non-PCI network device even though the errors are harmless.

To avoid the errors, introduce virNetDevIsPCIDevice() and use it in
virNetDevGetPCIDevice() before attempting to retrieve the associated
PCI device. virNetDevIsPCIDevice() uses the 'subsystem' property of the
device to determine if it is PCI. See the sysfs rules in kernel
documentation for more details

https://www.kernel.org/doc/html/latest/admin-guide/sysfs-rules.html
src/util/virnetdev.c