summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJianfeng Tan <jianfeng.tan@intel.com>2016-07-01 08:50:31 +0000
committerYuanhan Liu <yuanhan.liu@linux.intel.com>2016-07-11 04:57:15 +0200
commitbb7085b46ac502e9b494e30d2961400d4baf7a4f (patch)
treeee9b723c19f99ba0079d66517fa8fb5cf9cc2c6d /examples
parent3bd60a27e9f2afacff70f6aafdca0fc18685633f (diff)
downloaddpdk-bb7085b46ac502e9b494e30d2961400d4baf7a4f.zip
dpdk-bb7085b46ac502e9b494e30d2961400d4baf7a4f.tar.gz
dpdk-bb7085b46ac502e9b494e30d2961400d4baf7a4f.tar.xz
examples/vhost: print error logs on failure
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. Suggested-by: Yulong Pei <yulong.pei@intel.com> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com> Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/vhost/main.c20
1 files 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;
}