[v3,7/8] eal: hotplug: cleanup multiprocess resources
diff mbox series

Message ID 20200428235827.15383-8-stephen@networkplumber.org
State New
Delegated to: Thomas Monjalon
Headers show
Series
  • eal: cleanup resources on shutdown
Related show

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger April 28, 2020, 11:58 p.m. UTC
When rte_eal_cleanup is called, hotplug should unregister the
resources associated with the multi-process server.

Signed-off-by: Stephen Hemminger <stephen@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(+)

Patch
diff mbox series

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();