When rte_eal_hotplug_add returns -ENODEV during VF hot-add, it means the
MANA IB/verbs device is not yet registered by the mana_ib kernel module.
This happens because the mana_ib auxiliary driver probes asynchronously
after the MANA net driver creates the network interface.
On Azure VMs, the gap between netdev registration and IB device
registration can be several seconds. Previously, netvsc would log the
error and give up after finding the matching MAC address.
Now, on -ENODEV, restart the full retry loop from the PCI device
existence check. This re-scans the net directory to pick up any
interface renames (e.g. eth1 -> ens1) and retries until the IB device
is ready.
The -EEXIST return (device already probed by another netvsc port on the
same PCI device) is handled silently, as hn_vf_add will find the
already-probed VF port.
Fixes: a2a23a794b3a ("net/netvsc: support VF device hot add/remove")
Cc: [email protected]
Signed-off-by: Long Li <[email protected]>
---
drivers/net/netvsc/hn_ethdev.c | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 8bb2df3c19..5d1ef10eff 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -709,17 +709,33 @@ static void netvsc_hotplug_retry(void *args)
* parent device, restore its args.
*/
ret = rte_eal_hotplug_add(d->bus->name, d->name,
drv_str ? drv_str : "");
- if (ret) {
- PMD_DRV_LOG(ERR,
- "Failed to add PCI device %s",
+ free(drv_str);
+
+ if (ret == -ENODEV) {
+ /* IB device not ready yet (mana_ib not probed).
+ * Restart the full retry from PCI device check
+ * so we re-verify the device and get fresh
+ * interface names after any renames.
+ */
+ PMD_DRV_LOG(NOTICE,
+ "IB device not ready for %s, "
+ "restarting probe in 1 second",
d->name);
+ closedir(di);
+ rte_eal_alarm_set(NETVSC_HOTADD_RETRY_INTERVAL,
+ netvsc_hotplug_retry,
+ hot_ctx);
+ return;
}
- free(drv_str);
+ if (ret && ret != -EEXIST)
+ PMD_DRV_LOG(NOTICE,
+ "Failed to add PCI device %s
(ret=%d)",
+ d->name, ret);
ret = hn_vf_add(dev, hv);
if (ret)
- PMD_DRV_LOG(ERR, "Failed to add VF in hotplug
retry: %d", ret);
+ PMD_DRV_LOG(ERR, "Failed to add VF: %d", ret);
break;
}
}
--
2.43.0