diff mbox series

[26/45] examples/multi_process: add eal cleanup

Message ID 1618366270-1862-27-git-send-email-humin29@huawei.com (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series add eal clean up to the example | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Min Hu (Connor) April 14, 2021, 2:10 a.m. UTC
From: Chengchang Tang <tangchengchang@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@dpdk.org

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@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 mbox series

Patch

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;
 }