summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYasufumi Ogawa <yasufum.o@gmail.com>2019-07-03 17:37:56 +0900
committerYasufumi Ogawa <yasufum.o@gmail.com>2019-07-03 20:39:20 +0900
commit310c51b918e96c80d6859ce1c34e12322860dd8f (patch)
tree5800df758497b7adb0acc7a485ae5f815974034c
parentcbd9774cde2ed1c4121441daaac39e23703416c3 (diff)
downloadspp-310c51b918e96c80d6859ce1c34e12322860dd8f.zip
spp-310c51b918e96c80d6859ce1c34e12322860dd8f.tar.gz
spp-310c51b918e96c80d6859ce1c34e12322860dd8f.tar.xz
spp_vf: initialize variable master_lcore
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>
-rw-r--r--src/mirror/spp_mirror.c8
-rw-r--r--src/pcap/spp_pcap.c7
-rw-r--r--src/vf/spp_vf.c7
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))