patch 'net/netvsc: retry when no matching MAC found' has been queued to stable release 24.11.7

luca.boccassi at gmail.com luca.boccassi at gmail.com
Thu Jun 11 15:19:40 CEST 2026


Hi,

FYI, your patch has been queued to stable release 24.11.7

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 06/13/26. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/da0b626f305a133e0a2bfe1ac2b70d8e722307be

Thanks.

Luca Boccassi

---
>From da0b626f305a133e0a2bfe1ac2b70d8e722307be Mon Sep 17 00:00:00 2001
From: Long Li <longli at microsoft.com>
Date: Fri, 15 May 2026 12:28:39 -0700
Subject: [PATCH] net/netvsc: retry when no matching MAC found
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[ upstream commit f5d76ab02f19cd102d1d781ad182238791b80360 ]

On multi-NIC Azure VMs, a single MANA PCI device (7870:00:00.0) hosts
multiple VF interfaces. After PCI rescan, these interfaces register
at different times — the management NIC's VF appears first, followed
by the test NIC's VF.

Previously, when netvsc_hotplug_retry scanned the net/ directory and
found interfaces with non-matching MACs, it would exit the readdir
loop and free the hotadd context, permanently giving up. The matching
VF interface had not appeared yet.

Now, when the readdir loop ends without finding a matching MAC (dir
is NULL after loop), schedule another retry instead of giving up.
This uses a separate mac_retry counter (limit 120, ~2 minutes) so
the main retry loop remains unlimited.

Fixes: a2a23a794b3a ("net/netvsc: support VF device hot add/remove")

Signed-off-by: Long Li <longli at microsoft.com>
---
 drivers/net/netvsc/hn_ethdev.c | 36 +++++++++++++++++++++++++++++++++-
 drivers/net/netvsc/hn_var.h    |  1 +
 2 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index efa83726e4..f35d6c2436 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -85,6 +85,12 @@ struct netvsc_mp_param {
 /* Retry interval for hot-add VF device (microseconds) */
 #define NETVSC_HOTADD_RETRY_INTERVAL 1000000
 
+/* Max retries when net/ directory exists but no matching MAC found.
+ * On multi-NIC PCI devices, a second VF may register later.
+ * 120 retries = ~2 minutes.
+ */
+#define NETVSC_MAX_MAC_RETRY 120
+
 struct hn_xstats_name_off {
 	char name[RTE_ETH_XSTATS_NAME_SIZE];
 	unsigned int offset;
@@ -718,8 +724,36 @@ static void netvsc_hotplug_retry(void *args)
 		}
 	}
 
+	/* If we opened the net directory but didn't find a matching MAC,
+	 * the VF interface may not have appeared yet (e.g. on a multi-NIC
+	 * PCI device, the second VF registers later). Retry.
+	 */
+	if (di != NULL) {
+		closedir(di);
+		di = NULL;
+		if (dir == NULL) {
+			/* readdir returned NULL — loop ended without match */
+			hot_ctx->mac_retry++;
+			if (hot_ctx->mac_retry < NETVSC_MAX_MAC_RETRY) {
+				PMD_DRV_LOG(DEBUG,
+					    "%s: no matching MAC found in %s, "
+					    "retrying in 1 second (mac_retry %d/%d)",
+					    __func__, buf,
+					    hot_ctx->mac_retry,
+					    NETVSC_MAX_MAC_RETRY);
+				rte_eal_alarm_set(NETVSC_HOTADD_RETRY_INTERVAL,
+						  netvsc_hotplug_retry,
+						  hot_ctx);
+				return;
+			}
+			PMD_DRV_LOG(NOTICE,
+				    "%s: no matching MAC found after %d retries, giving up",
+				    __func__, hot_ctx->mac_retry);
+		}
+	}
+
 free_hotadd_ctx:
-	if (di)
+	if (di != NULL)
 		closedir(di);
 
 	rte_spinlock_lock(&hv->hotadd_lock);
diff --git a/drivers/net/netvsc/hn_var.h b/drivers/net/netvsc/hn_var.h
index cd3e686d2b..65a9fca436 100644
--- a/drivers/net/netvsc/hn_var.h
+++ b/drivers/net/netvsc/hn_var.h
@@ -127,6 +127,7 @@ struct hv_hotadd_context {
 	struct hn_data *hv;
 	struct rte_devargs da;
 	int eal_hot_plug_retry;
+	int mac_retry;
 };
 
 struct hn_data {
-- 
2.47.3

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-06-11 14:20:02.583815226 +0100
+++ 0031-net-netvsc-retry-when-no-matching-MAC-found.patch	2026-06-11 14:20:01.198745593 +0100
@@ -1 +1 @@
-From f5d76ab02f19cd102d1d781ad182238791b80360 Mon Sep 17 00:00:00 2001
+From da0b626f305a133e0a2bfe1ac2b70d8e722307be Mon Sep 17 00:00:00 2001
@@ -8,0 +9,2 @@
+[ upstream commit f5d76ab02f19cd102d1d781ad182238791b80360 ]
+
@@ -25 +26,0 @@
-Cc: stable at dpdk.org
@@ -34 +35 @@
-index 16fb2b344d..72743872bb 100644
+index efa83726e4..f35d6c2436 100644
@@ -37 +38 @@
-@@ -92,6 +92,12 @@ struct netvsc_mp_param {
+@@ -85,6 +85,12 @@ struct netvsc_mp_param {
@@ -50,2 +51,2 @@
-@@ -768,8 +774,36 @@ static void netvsc_hotplug_retry(void *args)
- 			    RTE_ETHER_ADDR_BYTES(dev->data->mac_addrs));
+@@ -718,8 +724,36 @@ static void netvsc_hotplug_retry(void *args)
+ 		}
@@ -87 +88 @@
- 	PMD_DRV_LOG(DEBUG, "%s: retry loop exiting for device %s (retry %d)",
+ 	rte_spinlock_lock(&hv->hotadd_lock);
@@ -89 +90 @@
-index ef55dee28e..574b909c82 100644
+index cd3e686d2b..65a9fca436 100644


More information about the stable mailing list