vmbus: fix bug that breaks multiple netvsc vdevs 06/18006/2
authorMatthew Smith <mgsmith@netgate.com>
Mon, 4 Mar 2019 15:43:45 +0000 (09:43 -0600)
committerDamjan Marion <dmarion@me.com>
Wed, 6 Mar 2019 11:40:21 +0000 (11:40 +0000)
commitf6266b56ecd6bca3074886b37d48cf5c20f37fa3
treea63689a57a4c142d7afed710d24f6305b20b15d8
parenta79271fad186e806060e73131d9128bd9d7ea6a4
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>
src/vlib/linux/vmbus.c