vmbus: fix bug that breaks multiple netvsc vdevs
VPP supports two DPDK drivers for managing netvsc devices on
Azure/Hyper-V. The new netvsc PMD looks a lot like other PCI-based
PMDs but it requires recently added kernel support (>=4.17). The
older vdev_netvsc is an abstraction that manages the mlx4 VF
and tap device underlying the netvsc interface using the failsafe PMD.
Distros with older kernels (e.g. RHEL/CentOS 7.x) have to use vdev_netvsc.
At startup, netvsc devices are processed and an attempt is made to
initialize them for management by the netvsc PMD. If that fails, then
vlib_vmbus_bind_to_uio() returns early and the device can be initialized
for management by vdev_netvsc.
The operation that is supposed to fail if the netvsc PMD cannot be used
is registration of the netvsc device type ID with the uio_hv_generic
driver. This operation is attempted exactly once so it does not fail
for netvsc devices processed after the first one and they end up in a
state where they cannot be initialized for use by vdev_netvsc.
Only unset uio_new_id_needed if uio_hv_generic registration succeeds.
Change-Id: I6be925d422b87ed24e0f4611304cc3a6b07a34fd
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
diff --git a/src/vlib/linux/vmbus.c b/src/vlib/linux/vmbus.c
index c1d8eb9..2dba802 100644
--- a/src/vlib/linux/vmbus.c
+++ b/src/vlib/linux/vmbus.c
@@ -287,8 +287,6 @@
/* tell uio_hv_generic about netvsc device type */
if (uio_new_id_needed)
{
- uio_new_id_needed = 0;
-
vec_reset_length (s);
s = format (s, "%s/%s/new_id%c", sysfs_vmbus_drv_path, uio_drv_name, 0);
error = clib_sysfs_write ((char *) s, "%s", netvsc_uuid);
@@ -296,6 +294,8 @@
if (error)
goto done;
+ uio_new_id_needed = 0;
+
}
/* prefer the simplier driver_override model */