From e8dc971b63a4a70daafb5cd5a6378b194d65f9cf Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Sat, 13 Nov 2021 09:22:56 -0800 Subject: [PATCH] eal: cleanup multiprocess hotplug resources When rte_eal_cleanup is called, hotplug should unregister the resources associated with the multi-process server. Signed-off-by: Stephen Hemminger --- lib/eal/common/hotplug_mp.c | 5 +++++ lib/eal/common/hotplug_mp.h | 6 ++++++ lib/eal/linux/eal.c | 1 + 3 files changed, 12 insertions(+) diff --git a/lib/eal/common/hotplug_mp.c b/lib/eal/common/hotplug_mp.c index bf55056f59..bde0de196e 100644 --- a/lib/eal/common/hotplug_mp.c +++ b/lib/eal/common/hotplug_mp.c @@ -462,3 +462,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/eal/common/hotplug_mp.h b/lib/eal/common/hotplug_mp.h index 8fcf9b52e2..4848446c85 100644 --- a/lib/eal/common/hotplug_mp.h +++ b/lib/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/eal/linux/eal.c b/lib/eal/linux/eal.c index d77cd871be..5583ba9f37 100644 --- a/lib/eal/linux/eal.c +++ b/lib/eal/linux/eal.c @@ -1284,6 +1284,7 @@ rte_eal_cleanup(void) rte_mp_channel_cleanup(); /* after this point, any DPDK pointers will become dangling */ rte_eal_memory_detach(); + eal_mp_dev_hotplug_cleanup(); rte_eal_alarm_cleanup(); rte_trace_save(); eal_trace_fini(); -- 2.39.5