[libvirt] [PATCH] util: skip RDMA detection for non-PCI network devices

Pavel Hrdina posted 1 patch 5 years, 1 month ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/23dcbac5712e690f58be082ca07bb9c305680520.1551979183.git.phrdina@redhat.com
src/util/virnetdev.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
[libvirt] [PATCH] util: skip RDMA detection for non-PCI network devices
Posted by Pavel Hrdina 5 years, 1 month ago
Only PCI devices have '/sys/class/net/<ifname>/device/resource' so we
need to skip this check for all other network devices.

Without this patch and RDMA enabled libvirt will not detect any network
device that doesn't have the path above which includes 'lo', 'virbr',
'tun', etc.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1639258

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 src/util/virnetdev.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index aeb9caab2a..699f2a0acb 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -2914,8 +2914,14 @@ virNetDevRDMAFeature(const char *ifname,
 
     if (virAsprintf(&eth_devpath, SYSFS_NET_DIR "%s/device/resource", ifname) < 0)
         goto cleanup;
-    if (!virFileExists(eth_devpath))
+
+    /* If /sys/class/net/<ifname>/device/resource doesn't exist it is not a PCI
+     * device and therefore it will not have RDMA. */
+    if (!virFileExists(eth_devpath)) {
+        ret = 0;
         goto cleanup;
+    }
+
     if (virFileReadAll(eth_devpath, RESOURCE_FILE_LEN, &eth_res_buf) < 0)
         goto cleanup;
 
-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] util: skip RDMA detection for non-PCI network devices
Posted by Andrea Bolognani 5 years, 1 month ago
On Thu, 2019-03-07 at 18:19 +0100, Pavel Hrdina wrote:
> Only PCI devices have '/sys/class/net/<ifname>/device/resource' so we
> need to skip this check for all other network devices.
> 
> Without this patch and RDMA enabled libvirt will not detect any network
> device that doesn't have the path above which includes 'lo', 'virbr',
> 'tun', etc.
> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1639258
> 
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>  src/util/virnetdev.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list