From: yasufum.o@gmail.com
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH] spp_vf: initialize variable master_lcore
Date: Wed, 3 Jul 2019 17:37:56 +0900 [thread overview]
Message-ID: <20190703083756.1503-1-yasufum.o@gmail.com> (raw)
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
reply other threads:[~2019-07-03 8:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190703083756.1503-1-yasufum.o@gmail.com \
--to=yasufum.o@gmail.com \
--cc=ferruh.yigit@intel.com \
--cc=spp@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).