[dpdk-dev] [PATCH 26/45] examples/multi_process: add eal cleanup

Min Hu (Connor) humin29 at huawei.com
Wed Apr 14 04:10:51 CEST 2021


From: Chengchang Tang <tangchengchang at huawei.com>

According to the programming guide, the rte_eal_init should be used pairs
with rte_eal_cleanup.

This patch add rte_eal_cleanup to this example to encourage new users of
DPDK to use it.

Fixes: aec9c13c5257 ("eal: add function to release internal resources")
Cc: stable at dpdk.org

Signed-off-by: Chengchang Tang <tangchengchang at huawei.com>
Signed-off-by: Min Hu (Connor) <humin29 at huawei.com>
---
 examples/multi_process/client_server_mp/mp_client/client.c | 3 +++
 examples/multi_process/client_server_mp/mp_server/main.c   | 4 ++++
 examples/multi_process/simple_mp/main.c                    | 4 ++++
 examples/multi_process/symmetric_mp/main.c                 | 3 +++
 4 files changed, 14 insertions(+)

diff --git a/examples/multi_process/client_server_mp/mp_client/client.c b/examples/multi_process/client_server_mp/mp_client/client.c
index 361d90b..6d4c246 100644
--- a/examples/multi_process/client_server_mp/mp_client/client.c
+++ b/examples/multi_process/client_server_mp/mp_client/client.c
@@ -268,4 +268,7 @@ main(int argc, char *argv[])
 
 		need_flush = 1;
 	}
+
+	/* clean up the EAL */
+	rte_eal_cleanup();
 }
diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c
index b18e12d..9bcee46 100644
--- a/examples/multi_process/client_server_mp/mp_server/main.c
+++ b/examples/multi_process/client_server_mp/mp_server/main.c
@@ -304,5 +304,9 @@ main(int argc, char *argv[])
 	rte_eal_mp_remote_launch(sleep_lcore, NULL, SKIP_MAIN);
 
 	do_packet_forwarding();
+
+	/* clean up the EAL */
+	rte_eal_cleanup();
+
 	return 0;
 }
diff --git a/examples/multi_process/simple_mp/main.c b/examples/multi_process/simple_mp/main.c
index 109b8bb..a05404f 100644
--- a/examples/multi_process/simple_mp/main.c
+++ b/examples/multi_process/simple_mp/main.c
@@ -121,5 +121,9 @@ main(int argc, char **argv)
 	cmdline_stdin_exit(cl);
 
 	rte_eal_mp_wait_lcore();
+
+	/* clean up the EAL */
+	rte_eal_cleanup();
+
 	return 0;
 }
diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c
index ae7f5e0..79e5c61 100644
--- a/examples/multi_process/symmetric_mp/main.c
+++ b/examples/multi_process/symmetric_mp/main.c
@@ -472,5 +472,8 @@ main(int argc, char **argv)
 
 	rte_eal_mp_remote_launch(lcore_main, NULL, CALL_MAIN);
 
+	/* clean up the EAL */
+	rte_eal_cleanup();
+
 	return 0;
 }
-- 
2.7.4



More information about the dev mailing list