[dpdk-dev] [PATCH 17/51] examples/qos_meter: check status of getting ethdev info

Andrew Rybchenko arybchenko at solarflare.com
Tue Aug 27 16:25:28 CEST 2019


From: Ivan Ilchenko <Ivan.Ilchenko at oktetlabs.ru>

rte_eth_dev_info_get() return value was changed from void to
int, so this patch modify rte_eth_dev_info_get() usage across
examples/qos_meter according to its new return type.

Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko at oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
---
 examples/qos_meter/main.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c
index da7afe8..13c85e9 100644
--- a/examples/qos_meter/main.c
+++ b/examples/qos_meter/main.c
@@ -329,7 +329,13 @@ static __attribute__((noreturn)) int
 
 	/* NIC init */
 	conf = port_conf;
-	rte_eth_dev_info_get(port_rx, &dev_info);
+
+	ret = rte_eth_dev_info_get(port_rx, &dev_info);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			"Error during getting device (port %u) info: %s\n",
+			port_rx, strerror(-ret));
+
 	if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
 		conf.txmode.offloads |= DEV_TX_OFFLOAD_MBUF_FAST_FREE;
 
@@ -369,7 +375,13 @@ static __attribute__((noreturn)) int
 	rte_exit(EXIT_FAILURE, "Port %d TX queue setup error (%d)\n", port_rx, ret);
 
 	conf = port_conf;
-	rte_eth_dev_info_get(port_tx, &dev_info);
+
+	ret = rte_eth_dev_info_get(port_tx, &dev_info);
+	if (ret != 0)
+		rte_exit(EXIT_FAILURE,
+			"Error during getting device (port %u) info: %s\n",
+			port_tx, strerror(-ret));
+
 	if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
 		conf.txmode.offloads |= DEV_TX_OFFLOAD_MBUF_FAST_FREE;
 
-- 
1.8.3.1



More information about the dev mailing list