[dpdk-dev] [PATCH 29/45] examples/performance-thread: add eal cleanup

Min Hu (Connor) humin29 at huawei.com
Wed Apr 14 04:10:54 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/performance-thread/l3fwd-thread/main.c | 3 +++
 examples/performance-thread/pthread_shim/main.c | 4 ++++
 2 files changed, 7 insertions(+)

diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c
index b16c19b..2f593ab 100644
--- a/examples/performance-thread/l3fwd-thread/main.c
+++ b/examples/performance-thread/l3fwd-thread/main.c
@@ -3781,5 +3781,8 @@ main(int argc, char **argv)
 		}
 	}
 
+	/* clean up the EAL */
+	rte_eal_cleanup();
+
 	return 0;
 }
diff --git a/examples/performance-thread/pthread_shim/main.c b/examples/performance-thread/pthread_shim/main.c
index 23e3b5e..241267f 100644
--- a/examples/performance-thread/pthread_shim/main.c
+++ b/examples/performance-thread/pthread_shim/main.c
@@ -258,5 +258,9 @@ int main(int argc, char **argv)
 	RTE_LCORE_FOREACH_WORKER(lcore_id) {
 		rte_eal_wait_lcore(lcore_id);
 	}
+
+	/* clean up the EAL */
+	rte_eal_cleanup();
+
 	return 0;
 }
-- 
2.7.4



More information about the dev mailing list