Skip to content

Commit 89a11ea

Browse files
committed
net/netvsc: retry full probe when IB device not ready during hotplug
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. Signed-off-by: Long Li <longli@microsoft.com>
1 parent 5ceb9ea commit 89a11ea

1 file changed

Lines changed: 21 additions & 5 deletions

File tree

drivers/net/netvsc/hn_ethdev.c

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -709,17 +709,33 @@ static void netvsc_hotplug_retry(void *args)
709709
* parent device, restore its args.
710710
*/
711711
ret = rte_eal_hotplug_add(d->bus->name, d->name, drv_str ? drv_str : "");
712-
if (ret) {
713-
PMD_DRV_LOG(ERR,
714-
"Failed to add PCI device %s",
712+
free(drv_str);
713+
714+
if (ret == -ENODEV) {
715+
/* IB device not ready yet (mana_ib not probed).
716+
* Restart the full retry from PCI device check
717+
* so we re-verify the device and get fresh
718+
* interface names after any renames.
719+
*/
720+
PMD_DRV_LOG(NOTICE,
721+
"IB device not ready for %s, "
722+
"restarting probe in 1 second",
715723
d->name);
724+
closedir(di);
725+
rte_eal_alarm_set(NETVSC_HOTADD_RETRY_INTERVAL,
726+
netvsc_hotplug_retry,
727+
hot_ctx);
728+
return;
716729
}
717730

718-
free(drv_str);
731+
if (ret && ret != -EEXIST)
732+
PMD_DRV_LOG(NOTICE,
733+
"Failed to add PCI device %s (ret=%d)",
734+
d->name, ret);
719735

720736
ret = hn_vf_add(dev, hv);
721737
if (ret)
722-
PMD_DRV_LOG(ERR, "Failed to add VF in hotplug retry: %d", ret);
738+
PMD_DRV_LOG(ERR, "Failed to add VF: %d", ret);
723739
break;
724740
}
725741
}

0 commit comments

Comments
 (0)