[dpdk-dev] [PATCH v2 7/8] eal: hotplug: cleanup multiprocess resources

Stephen Hemminger stephen at networkplumber.org
Wed Apr 29 01:14:14 CEST 2020


When rte_eal_cleanup is called, hotplug should unregister the
resources associated with the multi-process server.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 lib/librte_eal/common/hotplug_mp.c | 5 +++++
 lib/librte_eal/common/hotplug_mp.h | 6 ++++++
 lib/librte_eal/linux/eal.c         | 1 +
 3 files changed, 12 insertions(+)

diff --git a/lib/librte_eal/common/hotplug_mp.c b/lib/librte_eal/common/hotplug_mp.c
index ee791903b3b7..a390c01fd41c 100644
--- a/lib/librte_eal/common/hotplug_mp.c
+++ b/lib/librte_eal/common/hotplug_mp.c
@@ -463,3 +463,8 @@ int eal_mp_dev_hotplug_init(void)
 
 	return 0;
 }
+
+void eal_mp_dev_hotplug_cleanup(void)
+{
+	rte_mp_action_unregister(EAL_DEV_MP_ACTION_REQUEST);
+}
diff --git a/lib/librte_eal/common/hotplug_mp.h b/lib/librte_eal/common/hotplug_mp.h
index 8fcf9b52e24c..4848446c852d 100644
--- a/lib/librte_eal/common/hotplug_mp.h
+++ b/lib/librte_eal/common/hotplug_mp.h
@@ -37,6 +37,12 @@ struct eal_dev_mp_req {
 int
 eal_mp_dev_hotplug_init(void);
 
+/**
+ * Unregister all mp action callbacks for hotplug.
+ */
+void
+eal_mp_dev_hotplug_cleanup(void);
+
 /**
  * This is a synchronous wrapper for secondary process send
  * request to primary process, this is invoked when an attach
diff --git a/lib/librte_eal/linux/eal.c b/lib/librte_eal/linux/eal.c
index 7c56dbf49508..ffb0678b864a 100644
--- a/lib/librte_eal/linux/eal.c
+++ b/lib/librte_eal/linux/eal.c
@@ -1350,6 +1350,7 @@ rte_eal_cleanup(void)
 	vfio_mp_sync_cleanup();
 #endif
 	rte_eal_alarm_cleanup();
+	eal_mp_dev_hotplug_cleanup();
 	rte_mp_channel_cleanup();
 	rte_trace_save();
 	eal_trace_fini();
-- 
2.20.1



More information about the dev mailing list