From d6d940b4a57cefdfa8efe751480cd4e7a1c10613 Mon Sep 17 00:00:00 2001
From: wuchangsheng <wuchangsheng2@huawei.com>
Date: Thu, 6 Oct 2022 17:09:03 +0800
Subject: [PATCH] reinit support return ok

---
 lib/librte_eal/linux/eal/eal.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
index 92f1b56..7673b18 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -1081,6 +1081,7 @@ rte_eal_init(int argc, char **argv)
 	int i, fctret, ret;
 	pthread_t thread_id;
 	static rte_atomic32_t run_once = RTE_ATOMIC32_INIT(0);
+        static uint32_t reinit_ok = 0;
 	const char *p;
 	static char logid[PATH_MAX];
 	char cpuset[RTE_CPU_AFFINITY_STR_LEN];
@@ -1094,7 +1095,14 @@ rte_eal_init(int argc, char **argv)
 		return -1;
 	}
 
+        if (argc > 1 && !strncmp(argv[1], "reinit-ok", strlen("reinit-ok"))) {
+                reinit_ok = 1;
+        }
+
 	if (!rte_atomic32_test_and_set(&run_once)) {
+                if (reinit_ok) {
+                        return 0;
+                }
 		rte_eal_init_alert("already called initialization.");
 		rte_errno = EALREADY;
 		return -1;
-- 
2.27.0

