dpdk/0019-reinit-support-return-ok.patch

41 lines
1.1 KiB
Diff
Raw Normal View History

2023-10-23 15:39:28 +08:00
From 12a22b874a4852996dcec56ae30c7a17551bfeeb Mon Sep 17 00:00:00 2001
2022-10-06 17:13:02 +08:00
From: wuchangsheng <wuchangsheng2@huawei.com>
2023-10-23 15:39:28 +08:00
Date: Thu, 6 Oct 2022 16:35:16 +0800
2022-10-06 17:13:02 +08:00
Subject: [PATCH] reinit support return ok
---
2023-10-23 15:39:28 +08:00
lib/eal/linux/eal.c | 8 ++++++++
2022-10-06 17:13:02 +08:00
1 file changed, 8 insertions(+)
2023-10-23 15:39:28 +08:00
diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c
index 7ca8bb2..fc2a7fd 100644
--- a/lib/eal/linux/eal.c
+++ b/lib/eal/linux/eal.c
@@ -1055,6 +1055,7 @@ rte_eal_init(int argc, char **argv)
2022-10-06 17:13:02 +08:00
int i, fctret, ret;
pthread_t thread_id;
2023-10-23 15:39:28 +08:00
static uint32_t run_once;
+ static uint32_t reinit_ok = 0;
uint32_t has_run = 0;
2022-10-06 17:13:02 +08:00
const char *p;
static char logid[PATH_MAX];
2023-10-23 15:39:28 +08:00
@@ -1072,8 +1073,15 @@ rte_eal_init(int argc, char **argv)
2022-10-06 17:13:02 +08:00
return -1;
}
2023-10-23 15:39:28 +08:00
+ if (argc > 1 && !strncmp(argv[1], "reinit-ok", strlen("reinit-ok"))) {
+ reinit_ok = 1;
+ }
2022-10-06 17:13:02 +08:00
+
2023-10-23 15:39:28 +08:00
if (!__atomic_compare_exchange_n(&run_once, &has_run, 1, 0,
__ATOMIC_RELAXED, __ATOMIC_RELAXED)) {
+ if (reinit_ok) {
+ return 0;
+ }
2022-10-06 17:13:02 +08:00
rte_eal_init_alert("already called initialization.");
rte_errno = EALREADY;
return -1;
--
2.27.0