* [spp] [PATCH] spp_vf: initialize variable master_lcore
@ 2019-07-03 8:37 yasufum.o
0 siblings, 0 replies; only message in thread
From: yasufum.o @ 2019-07-03 8:37 UTC (permalink / raw)
To: spp, ferruh.yigit, yasufum.o
From: Yasufumi Ogawa <yasufum.o@gmail.com>
Compilation of spp_vf is failed because of uninitialization of
`master_lcore` variable if using optimize option. This patch is to fix
the issue not only spp_vf but also spp_mirror and spp_pcap.
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
src/mirror/spp_mirror.c | 8 ++++++--
src/pcap/spp_pcap.c | 7 ++++++-
src/vf/spp_vf.c | 7 ++++++-
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c
index e6352cf..b57dd57 100644
--- a/src/mirror/spp_mirror.c
+++ b/src/mirror/spp_mirror.c
@@ -505,6 +505,12 @@ main(int argc, char *argv[])
signal(SIGTERM, stop_process);
signal(SIGINT, stop_process);
+ /**
+ * It should be initialized outside of while loop, or failed to
+ * compile because it is referred when finalize `g_core_info`.
+ */
+ master_lcore = rte_get_master_lcore();
+
while (1) {
int ret_dpdk = rte_eal_init(argc, argv);
if (unlikely(ret_dpdk < 0))
@@ -518,8 +524,6 @@ main(int argc, char *argv[])
if (unlikely(ret_parse != 0))
break;
- master_lcore = rte_get_master_lcore();
-
if (sppwk_set_mng_data(&g_iface_info, g_component_info,
g_core_info, g_change_core,
g_change_component,
diff --git a/src/pcap/spp_pcap.c b/src/pcap/spp_pcap.c
index 79d155c..e8b2724 100644
--- a/src/pcap/spp_pcap.c
+++ b/src/pcap/spp_pcap.c
@@ -927,6 +927,12 @@ main(int argc, char *argv[])
signal(SIGTERM, stop_process);
signal(SIGINT, stop_process);
+ /**
+ * It should be initialized outside of while loop, or failed to
+ * compile because it is referred when finalize `g_core_info`.
+ */
+ master_lcore = rte_get_master_lcore();
+
while (1) {
int ret_eal = rte_eal_init(argc, argv);
if (unlikely(ret_eal < 0))
@@ -1032,7 +1038,6 @@ main(int argc, char *argv[])
}
/* Set the status of main thread to idle */
- master_lcore = rte_get_master_lcore();
g_core_info[master_lcore].status = SPPWK_LCORE_IDLING;
int ret_wait = check_core_status_wait(SPPWK_LCORE_IDLING);
if (unlikely(ret_wait != 0))
diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index d7dd5d0..415d790 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -220,6 +220,12 @@ main(int argc, char *argv[])
signal(SIGTERM, stop_process);
signal(SIGINT, stop_process);
+ /**
+ * It should be initialized outside of while loop, or failed to
+ * compile because it is referred when finalize `g_core_info`.
+ */
+ master_lcore = rte_get_master_lcore();
+
while (1) {
int ret_dpdk = rte_eal_init(argc, argv);
if (unlikely(ret_dpdk < 0))
@@ -274,7 +280,6 @@ main(int argc, char *argv[])
}
/* Set the status of main thread to idle */
- master_lcore = rte_get_master_lcore();
g_core_info[master_lcore].status = SPPWK_LCORE_IDLING;
int ret_wait = check_core_status_wait(SPPWK_LCORE_IDLING);
if (unlikely(ret_wait != SPP_RET_OK))
--
2.17.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-07-03 8:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03 8:37 [spp] [PATCH] spp_vf: initialize variable master_lcore yasufum.o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).