From mboxrd@z Thu Jan 1 00:00:00 1970 From: Phil Yang Subject: [PATCH] app/testpmd: fix vdev socket initialization Date: Fri, 12 Oct 2018 17:34:55 +0800 Message-ID: <1539336895-22691-1-git-send-email-phil.yang@arm.com> Cc: nd@arm.com, anatoly.burakov@intel.com, ferruh.yigit@intel.com To: dev@dpdk.org Return-path: Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by dpdk.org (Postfix) with ESMTP id 4A3811B395 for ; Fri, 12 Oct 2018 11:35:08 +0200 (CEST) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The cmdline settings of port-numa-config and rxring-numa-config have been flushed by the following init_config. If we don't configure the port-numa-config, the virtual device will allocate the device ports to socket 0. It will cause failure when the socket 0 is unavailable. eg: testpmd -l --vdev net_pcap0,iface=lo --socket-mem=64 -- --numa --port-numa-config="(0,1)" --ring-numa-config="(0,1,1),(0,2,1)" -i ... Configuring Port 0 (socket 0) Failed to setup RX queue:No mempool allocation on the socket 0 EAL: Error - exiting with code: 1 Cause: Start ports failed Fix by allocate the devices port to the first available socket or the socket configured in port-numa-config. Fixes: 487f9a5 ("app/testpmd: fix NUMA structures initialization") Signed-off-by: Phil Yang Reviewed-by: Gavin Hu --- app/test-pmd/testpmd.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index d550bda..1279cd5 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1024,12 +1024,6 @@ init_config(void) 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, @@ -1066,9 +1060,12 @@ init_config(void) else { uint32_t socket_id = rte_eth_dev_socket_id(pid); - /* if socket_id is invalid, set to 0 */ + /* + * if socket_id is invalid, + * set to the first available socket. + */ if (check_socket_id(socket_id) < 0) - socket_id = 0; + socket_id = socket_ids[0]; port_per_socket[socket_id]++; } } @@ -1224,9 +1221,12 @@ init_fwd_streams(void) else { port->socket_id = rte_eth_dev_socket_id(pid); - /* if socket_id is invalid, set to 0 */ + /* + * if socket_id is invalid, + * set to the first available socket. + */ if (check_socket_id(port->socket_id) < 0) - port->socket_id = 0; + port->socket_id = socket_ids[0]; } } else { @@ -2330,9 +2330,9 @@ attach_port(char *identifier) return; socket_id = (unsigned)rte_eth_dev_socket_id(pi); - /* if socket_id is invalid, set to 0 */ + /* if socket_id is invalid, set to the first available socket. */ if (check_socket_id(socket_id) < 0) - socket_id = 0; + socket_id = socket_ids[0]; reconfig(pi, socket_id); rte_eth_promiscuous_enable(pi); @@ -2971,6 +2971,11 @@ init_port(void) "rte_zmalloc(%d struct rte_port) failed\n", RTE_MAX_ETHPORTS); } + + /* Initialize ports NUMA structures */ + 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); } static void -- 2.7.4