From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 38B482C2C for ; Fri, 1 Jul 2016 10:50:55 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP; 01 Jul 2016 01:50:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,556,1459839600"; d="scan'208";a="131802783" Received: from dpdk06.sh.intel.com ([10.239.128.225]) by fmsmga004.fm.intel.com with ESMTP; 01 Jul 2016 01:50:51 -0700 From: Jianfeng Tan To: dev@dpdk.org Cc: yuanhan.liu@linux.intel.com, huawei.xie@intel.com, Jianfeng Tan Date: Fri, 1 Jul 2016 08:50:31 +0000 Message-Id: <1467363031-106737-1-git-send-email-jianfeng.tan@intel.com> X-Mailer: git-send-email 2.1.4 Subject: [dpdk-dev] [PATCH] examples/vhost: fix failure without hints X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Jul 2016 08:50:55 -0000 When the specified cores and memory lie on different numa socket with physical NIC, vhost fails to set up rx queue, and exits without any hints. This could leads to confusion of users. This patch fixes it by adding some error messages when calling ether APIs returns errors. Fixes: 4796ad63ba1f ("examples/vhost: import userspace vhost application") Reported-by: Yulong Pei Signed-off-by: Jianfeng Tan --- examples/vhost/main.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 3aff2cc..3b98f42 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -332,8 +332,11 @@ port_init(uint8_t port) rx_rings = (uint16_t)dev_info.max_rx_queues; /* Configure ethernet device. */ retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf); - if (retval != 0) + if (retval != 0) { + RTE_LOG(ERR, VHOST_PORT, "Failed to configure port %u: %s.\n", + port, strerror(-retval)); return retval; + } /* Setup the queues. */ for (q = 0; q < rx_rings; q ++) { @@ -341,21 +344,30 @@ port_init(uint8_t port) rte_eth_dev_socket_id(port), rxconf, mbuf_pool); - if (retval < 0) + if (retval < 0) { + RTE_LOG(ERR, VHOST_PORT, + "Failed to setup rx queue %u of port %u: %s.\n", + q, port, strerror(-retval)); return retval; + } } for (q = 0; q < tx_rings; q ++) { retval = rte_eth_tx_queue_setup(port, q, tx_ring_size, rte_eth_dev_socket_id(port), txconf); - if (retval < 0) + if (retval < 0) { + RTE_LOG(ERR, VHOST_PORT, + "Failed to setup tx queue %u of port %u: %s.\n", + q, port, strerror(-retval)); return retval; + } } /* Start the device. */ retval = rte_eth_dev_start(port); if (retval < 0) { - RTE_LOG(ERR, VHOST_DATA, "Failed to start the device.\n"); + RTE_LOG(ERR, VHOST_PORT, "Failed to start port %u: %s\n", + port, strerror(-retval)); return retval; } -- 2.1.4