[dpdk-dev,v5] app/testpmd: fix port_numa and ring_numa not initialize issue

Message ID 1493807387-135918-1-git-send-email-yulong.pei@intel.com (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Pei, Yulong May 3, 2017, 10:29 a.m. UTC
  Previous numa_support = 0 by default, it need to add --numa to testpmd
command line to enable numa, so port_numa and ring_numa were initialized
at function launch_args_parse(), now testpmd change numa_support = 1 as
default, so port_numa and ring_numa also need to initialize by default,
otherwise port->socket_id will be probed to wrong value.

Fixes: 999b2ee0fe45 ("app/testpmd: enable NUMA support by default")

Signed-off-by: Yulong Pei <yulong.pei@intel.com>
---
 app/test-pmd/parameters.c | 6 +-----
 app/test-pmd/testpmd.c    | 7 +++++++
 2 files changed, 8 insertions(+), 5 deletions(-)
  

Comments

Jingjing Wu May 6, 2017, 12:52 a.m. UTC | #1
> -----Original Message-----
> From: Pei, Yulong
> Sent: Wednesday, May 3, 2017 6:30 PM
> To: dev@dpdk.org
> Cc: Wu, Jingjing <jingjing.wu@intel.com>; thomas@monjalon.net
> Subject: [PATCH v5] app/testpmd: fix port_numa and ring_numa not initialize
> issue
> 
> Previous numa_support = 0 by default, it need to add --numa to testpmd
> command line to enable numa, so port_numa and ring_numa were initialized at
> function launch_args_parse(), now testpmd change numa_support = 1 as default,
> so port_numa and ring_numa also need to initialize by default, otherwise port-
> >socket_id will be probed to wrong value.
> 
> Fixes: 999b2ee0fe45 ("app/testpmd: enable NUMA support by default")
> 
> Signed-off-by: Yulong Pei <yulong.pei@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
  
Thomas Monjalon May 6, 2017, 8:30 a.m. UTC | #2
06/05/2017 02:52, Wu, Jingjing:
> From: Pei, Yulong
> > 
> > Previous numa_support = 0 by default, it need to add --numa to testpmd
> > command line to enable numa, so port_numa and ring_numa were initialized at
> > function launch_args_parse(), now testpmd change numa_support = 1 as default,
> > so port_numa and ring_numa also need to initialize by default, otherwise port-
> > >socket_id will be probed to wrong value.
> > 
> > Fixes: 999b2ee0fe45 ("app/testpmd: enable NUMA support by default")
> > 
> > Signed-off-by: Yulong Pei <yulong.pei@intel.com>
> Acked-by: Jingjing Wu <jingjing.wu@intel.com>

Applied, thanks
  

Patch

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 787e143..36f7dd8 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -680,12 +680,8 @@  launch_args_parse(int argc, char** argv)
 				parse_fwd_portmask(optarg);
 			if (!strcmp(lgopts[opt_idx].name, "no-numa"))
 				numa_support = 0;
-			if (!strcmp(lgopts[opt_idx].name, "numa")) {
+			if (!strcmp(lgopts[opt_idx].name, "numa"))
 				numa_support = 1;
-				memset(port_numa,NUMA_NO_CONFIG,RTE_MAX_ETHPORTS);
-				memset(rxring_numa,NUMA_NO_CONFIG,RTE_MAX_ETHPORTS);
-				memset(txring_numa,NUMA_NO_CONFIG,RTE_MAX_ETHPORTS);
-			}
 			if (!strcmp(lgopts[opt_idx].name, "mp-anon")) {
 				mp_anon = 1;
 			}
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index dfe6442..78423ee 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -529,6 +529,13 @@  init_config(void)
 	uint8_t port_per_socket[RTE_MAX_NUMA_NODES];
 
 	memset(port_per_socket,0,RTE_MAX_NUMA_NODES);
+
+	if (numa_support) {
+		memset(port_numa, NUMA_NO_CONFIG, RTE_MAX_ETHPORTS);
+		memset(rxring_numa, NUMA_NO_CONFIG, RTE_MAX_ETHPORTS);
+		memset(txring_numa, NUMA_NO_CONFIG, RTE_MAX_ETHPORTS);
+	}
+
 	/* Configuration of logical cores. */
 	fwd_lcores = rte_zmalloc("testpmd: fwd_lcores",
 				sizeof(struct fwd_lcore *) * nb_lcores,