[PATCH v2] dev: skip multi-process in hotplug

David Marchand david.marchand at redhat.com
Sun Jun 28 16:05:57 CEST 2026


If multi-process is disabled (--no-shconf/--in-memory),
there is no need to build a multi-process message.

Signed-off-by: David Marchand <david.marchand at redhat.com>
---
 lib/eal/common/eal_common_dev.c | 46 ++++++++++++++++++++++++---------
 1 file changed, 34 insertions(+), 12 deletions(-)

diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 762ed09e21..47fc45aa3e 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -267,10 +267,16 @@ RTE_EXPORT_SYMBOL(rte_dev_probe)
 int
 rte_dev_probe(const char *devargs)
 {
+	const struct internal_config *internal_conf =
+		eal_get_internal_configuration();
+	bool do_mp = internal_conf->no_shconf == 0;
 	struct eal_dev_mp_req req;
 	struct rte_device *dev;
 	int ret;
 
+	if (!do_mp)
+		goto skip_mp_req;
+
 	memset(&req, 0, sizeof(req));
 	req.t = EAL_DEV_REQ_TYPE_ATTACH;
 	strlcpy(req.devargs, devargs, EAL_DEV_MP_DEV_ARGS_MAX_LEN);
@@ -294,6 +300,7 @@ rte_dev_probe(const char *devargs)
 
 	/* attach a shared device from primary start from here: */
 
+skip_mp_req:
 	/* primary attach the new device itself. */
 	ret = local_dev_probe(devargs, &dev);
 
@@ -311,6 +318,9 @@ rte_dev_probe(const char *devargs)
 			return ret;
 	}
 
+	if (!do_mp)
+		goto skip_mp_notify;
+
 	/* primary send attach sync request to secondary. */
 	ret = eal_dev_hotplug_request_to_secondary(&req);
 
@@ -337,16 +347,19 @@ rte_dev_probe(const char *devargs)
 		goto rollback;
 	}
 
+skip_mp_notify:
 	return 0;
 
 rollback:
-	req.t = EAL_DEV_REQ_TYPE_ATTACH_ROLLBACK;
+	if (do_mp) {
+		req.t = EAL_DEV_REQ_TYPE_ATTACH_ROLLBACK;
 
-	/* primary send rollback request to secondary. */
-	if (eal_dev_hotplug_request_to_secondary(&req) != 0)
-		EAL_LOG(WARNING,
-			"Failed to rollback device attach on secondary."
-			"Devices in secondary may not sync with primary");
+		/* primary send rollback request to secondary. */
+		if (eal_dev_hotplug_request_to_secondary(&req) != 0)
+			EAL_LOG(WARNING,
+				"Failed to rollback device attach on secondary."
+				"Devices in secondary may not sync with primary");
+	}
 
 	/* primary rollback itself. */
 	if (local_dev_remove(dev) != 0)
@@ -407,6 +420,9 @@ RTE_EXPORT_SYMBOL(rte_dev_remove)
 int
 rte_dev_remove(struct rte_device *dev)
 {
+	const struct internal_config *internal_conf =
+		eal_get_internal_configuration();
+	bool do_mp = internal_conf->no_shconf == 0;
 	struct eal_dev_mp_req req;
 	char *devargs;
 	int ret;
@@ -416,6 +432,9 @@ rte_dev_remove(struct rte_device *dev)
 		return -ENOENT;
 	}
 
+	if (!do_mp)
+		goto skip_mp_req;
+
 	ret = build_devargs(dev->bus->name, dev->name, "", &devargs);
 	if (ret != 0)
 		return ret;
@@ -474,6 +493,7 @@ rte_dev_remove(struct rte_device *dev)
 			goto rollback;
 	}
 
+skip_mp_req:
 	/* primary detach the device itself. */
 	ret = local_dev_remove(dev);
 
@@ -490,13 +510,15 @@ rte_dev_remove(struct rte_device *dev)
 	return 0;
 
 rollback:
-	req.t = EAL_DEV_REQ_TYPE_DETACH_ROLLBACK;
+	if (do_mp) {
+		req.t = EAL_DEV_REQ_TYPE_DETACH_ROLLBACK;
 
-	/* primary send rollback request to secondary. */
-	if (eal_dev_hotplug_request_to_secondary(&req) != 0)
-		EAL_LOG(WARNING,
-			"Failed to rollback device detach on secondary."
-			"Devices in secondary may not sync with primary");
+		/* primary send rollback request to secondary. */
+		if (eal_dev_hotplug_request_to_secondary(&req) != 0)
+			EAL_LOG(WARNING,
+				"Failed to rollback device detach on secondary."
+				"Devices in secondary may not sync with primary");
+	}
 
 	return ret;
 }
-- 
2.54.0



More information about the dev mailing list