63 lines
1.6 KiB
Diff
63 lines
1.6 KiB
Diff
From 561a37288d629398f976dfa4e57854b7ea484cc7 Mon Sep 17 00:00:00 2001
|
|
From: yuanyunkang <yuanyunkang@huawei.com>
|
|
Date: Sat, 22 Aug 2020 14:39:16 +0800
|
|
Subject: [PATCH] dpdk:fix coredump when primary process attach without shared
|
|
file
|
|
|
|
Signed-off-by: yuanyunkang <yuanyunkang@huawei.com>
|
|
---
|
|
lib/librte_eal/linux/eal/eal.c | 16 +++++++++++++---
|
|
1 file changed, 13 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
|
|
index a1f2b42..ff86ff9 100644
|
|
--- a/lib/librte_eal/linux/eal/eal.c
|
|
+++ b/lib/librte_eal/linux/eal/eal.c
|
|
@@ -569,22 +569,28 @@ rte_config_init(void)
|
|
return 0;
|
|
}
|
|
|
|
-static void
|
|
+static int
|
|
rte_sec_config_init(const int sec_idx)
|
|
{
|
|
int mem_cfg_fd = -1;
|
|
int mmap_flags = PROT_READ | PROT_WRITE;
|
|
+ int ret = -1;
|
|
|
|
struct rte_config *rte_cfg = rte_eal_sec_get_configuration(sec_idx);
|
|
struct internal_config *internal_cfg = rte_eal_sec_get_internal_config(sec_idx);
|
|
|
|
rte_cfg->process_type = internal_cfg->process_type;
|
|
|
|
- __rte_eal_config_attach(mmap_flags, &mem_cfg_fd,
|
|
+ ret = __rte_eal_config_attach(mmap_flags, &mem_cfg_fd,
|
|
rte_eal_sec_get_runtime_dir(sec_idx),
|
|
internal_cfg, rte_cfg);
|
|
+ if (ret < 0) {
|
|
+ RTE_LOG(ERR, EAL, "Cannot attach shared memory\n");
|
|
+ return -1;
|
|
+ }
|
|
|
|
close(mem_cfg_fd);
|
|
+ return 0;
|
|
}
|
|
|
|
static int
|
|
@@ -1553,7 +1559,11 @@ rte_eal_sec_attach(int argc, char **argv)
|
|
return -1;
|
|
}
|
|
|
|
- rte_sec_config_init(sec_idx);
|
|
+ ret = rte_sec_config_init(sec_idx);
|
|
+ if (ret < 0) {
|
|
+ RTE_LOG(ERR, EAL, "Cannot init sec config\n");
|
|
+ return -1;
|
|
+ }
|
|
|
|
ret = rte_eal_sec_memory_init(sec_idx);
|
|
if (ret < 0) {
|
|
--
|
|
2.19.1
|
|
|