Soft Patch Panel
 help / color / Atom feed
* [spp] [PATCH 0/3] Fix assigning wrong master lcore
@ 2019-07-18  5:01 yasufum.o
  2019-07-18  5:01 ` [spp] [PATCH 1/3] spp_vf: fix wrong master lcore other than 0 yasufum.o
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: yasufum.o @ 2019-07-18  5:01 UTC (permalink / raw)
  To: spp, ferruh.yigit, yasufum.o

From: Yasufumi Ogawa <yasufum.o@gmail.com>

In spp_vf, spp_mirror and spp_pcap, master lcore is always set as 0 and
cannot to others. It is because rte_get_master_lcore() returns 0 if it
is called before rte_eal_init().

This series of patches is to fix the issue for each of processes by
moving rte_eal_init() before rte_get_master_lcore().

Yasufumi Ogawa (3):
  spp_vf: fix wrong master lcore other than 0
  spp_mirror: fix wrong master lcore other than 0
  spp_pcap: fix wrong master lcore other than 0

 src/mirror/spp_mirror.c | 20 ++++++++++++--------
 src/pcap/spp_pcap.c     | 20 ++++++++++++--------
 src/vf/spp_vf.c         | 20 ++++++++++++--------
 3 files changed, 36 insertions(+), 24 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [spp] [PATCH 1/3] spp_vf: fix wrong master lcore other than 0
  2019-07-18  5:01 [spp] [PATCH 0/3] Fix assigning wrong master lcore yasufum.o
@ 2019-07-18  5:01 ` yasufum.o
  2019-07-18  5:01 ` [spp] [PATCH 2/3] spp_mirror: " yasufum.o
  2019-07-18  5:01 ` [spp] [PATCH 3/3] spp_pcap: " yasufum.o
  2 siblings, 0 replies; 4+ messages in thread
From: yasufum.o @ 2019-07-18  5:01 UTC (permalink / raw)
  To: spp, ferruh.yigit, yasufum.o

From: Yasufumi Ogawa <yasufum.o@gmail.com>

Master lcore of spp_vf is always set as 0 and cannot to others. It is
because rte_get_master_lcore() returns 0 if it is called before
rte_eal_init(). This update is to move rte_eal_init() before.

Fixes: 310c51b918e9 ("spp_vf: initialize variable master_lcore")

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/vf/spp_vf.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/vf/spp_vf.c b/src/vf/spp_vf.c
index e2711d1..bc2a403 100644
--- a/src/vf/spp_vf.c
+++ b/src/vf/spp_vf.c
@@ -199,7 +199,7 @@ slave_main(void *arg __attribute__ ((unused)))
 int
 main(int argc, char *argv[])
 {
-	int ret = SPP_RET_NG;
+	int ret;
 	char ctl_ip[IPADDR_LEN] = { 0 };
 	int ctl_port;
 	int ret_cmd_init;
@@ -220,20 +220,24 @@ main(int argc, char *argv[])
 	signal(SIGTERM, stop_process);
 	signal(SIGINT,  stop_process);
 
+	ret = rte_eal_init(argc, argv);
+	if (unlikely(ret < 0))
+		rte_exit(EXIT_FAILURE, "Invalid EAL arguments.\n");
+
+	argc -= ret;
+	argv += ret;
+
 	/**
 	 * 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();
 
+	/**
+	 * If any failure is occured in the while block, break to go the end
+	 * of the block to finalize.
+	 */
 	while (1) {
-		int ret_dpdk = rte_eal_init(argc, argv);
-		if (unlikely(ret_dpdk < 0))
-			break;
-
-		argc -= ret_dpdk;
-		argv += ret_dpdk;
-
 		/* Parse spp_vf specific parameters */
 		int ret_parse = parse_app_args(argc, argv);
 		if (unlikely(ret_parse != SPP_RET_OK))
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [spp] [PATCH 2/3] spp_mirror: fix wrong master lcore other than 0
  2019-07-18  5:01 [spp] [PATCH 0/3] Fix assigning wrong master lcore yasufum.o
  2019-07-18  5:01 ` [spp] [PATCH 1/3] spp_vf: fix wrong master lcore other than 0 yasufum.o
@ 2019-07-18  5:01 ` " yasufum.o
  2019-07-18  5:01 ` [spp] [PATCH 3/3] spp_pcap: " yasufum.o
  2 siblings, 0 replies; 4+ messages in thread
From: yasufum.o @ 2019-07-18  5:01 UTC (permalink / raw)
  To: spp, ferruh.yigit, yasufum.o

From: Yasufumi Ogawa <yasufum.o@gmail.com>

As previous patch, fix assigning wrong master lcore by moving
rte_eal_init() before rte_get_master_lcore().

Fixes: 310c51b918e9 ("spp_vf: initialize variable master_lcore")

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/mirror/spp_mirror.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/mirror/spp_mirror.c b/src/mirror/spp_mirror.c
index 5cee655..4b62349 100644
--- a/src/mirror/spp_mirror.c
+++ b/src/mirror/spp_mirror.c
@@ -484,7 +484,7 @@ slave_main(void *arg __attribute__ ((unused)))
 int
 main(int argc, char *argv[])
 {
-	int ret = SPP_RET_NG;
+	int ret;
 	char ctl_ip[IPADDR_LEN] = { 0 };
 	int ctl_port;
 	int ret_cmd_init;
@@ -505,20 +505,24 @@ main(int argc, char *argv[])
 	signal(SIGTERM, stop_process);
 	signal(SIGINT,  stop_process);
 
+	ret = rte_eal_init(argc, argv);
+	if (unlikely(ret < 0))
+		rte_exit(EXIT_FAILURE, "Invalid EAL arguments.\n");
+
+	argc -= ret;
+	argv += ret;
+
 	/**
 	 * 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();
 
+	/**
+	 * If any failure is occured in the while block, break to go the end
+	 * of the block to finalize.
+	 */
 	while (1) {
-		int ret_dpdk = rte_eal_init(argc, argv);
-		if (unlikely(ret_dpdk < 0))
-			break;
-
-		argc -= ret_dpdk;
-		argv += ret_dpdk;
-
 		/* Parse spp_mirror specific parameters */
 		int ret_parse = parse_app_args(argc, argv);
 		if (unlikely(ret_parse != 0))
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [spp] [PATCH 3/3] spp_pcap: fix wrong master lcore other than 0
  2019-07-18  5:01 [spp] [PATCH 0/3] Fix assigning wrong master lcore yasufum.o
  2019-07-18  5:01 ` [spp] [PATCH 1/3] spp_vf: fix wrong master lcore other than 0 yasufum.o
  2019-07-18  5:01 ` [spp] [PATCH 2/3] spp_mirror: " yasufum.o
@ 2019-07-18  5:01 ` " yasufum.o
  2 siblings, 0 replies; 4+ messages in thread
From: yasufum.o @ 2019-07-18  5:01 UTC (permalink / raw)
  To: spp, ferruh.yigit, yasufum.o

From: Yasufumi Ogawa <yasufum.o@gmail.com>

As previous patch, fix assigning wrong master lcore by moving
rte_eal_init() before rte_get_master_lcore().

Fixes: 310c51b918e9 ("spp_vf: initialize variable master_lcore")

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/pcap/spp_pcap.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/pcap/spp_pcap.c b/src/pcap/spp_pcap.c
index e8b2724..39667d8 100644
--- a/src/pcap/spp_pcap.c
+++ b/src/pcap/spp_pcap.c
@@ -905,7 +905,7 @@ slave_main(void *arg __attribute__ ((unused)))
 int
 main(int argc, char *argv[])
 {
-	int ret = SPPWK_RET_NG;
+	int ret;
 	char ctl_ip[IPADDR_LEN] = { 0 };
 	int ctl_port;
 	int ret_cmd_init;
@@ -927,20 +927,24 @@ main(int argc, char *argv[])
 	signal(SIGTERM, stop_process);
 	signal(SIGINT,  stop_process);
 
+	ret = rte_eal_init(argc, argv);
+	if (unlikely(ret < 0))
+		rte_exit(EXIT_FAILURE, "Invalid EAL arguments.\n");
+
+	argc -= ret;
+	argv += ret;
+
 	/**
 	 * 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();
 
+	/**
+	 * If any failure is occured in the while block, break to go the end
+	 * of the block to finalize.
+	 */
 	while (1) {
-		int ret_eal = rte_eal_init(argc, argv);
-		if (unlikely(ret_eal < 0))
-			break;
-
-		argc -= ret_eal;
-		argv += ret_eal;
-
 		/* Parse spp_pcap specific parameters */
 		int ret_parse = parse_app_args(argc, argv);
 		if (unlikely(ret_parse != 0))
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-18  5:01 [spp] [PATCH 0/3] Fix assigning wrong master lcore yasufum.o
2019-07-18  5:01 ` [spp] [PATCH 1/3] spp_vf: fix wrong master lcore other than 0 yasufum.o
2019-07-18  5:01 ` [spp] [PATCH 2/3] spp_mirror: " yasufum.o
2019-07-18  5:01 ` [spp] [PATCH 3/3] spp_pcap: " yasufum.o

Soft Patch Panel

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/spp/0 spp/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 spp spp/ http://inbox.dpdk.org/spp \
		spp@dpdk.org
	public-inbox-index spp


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.spp


AGPL code for this site: git clone https://public-inbox.org/ public-inbox