[dpdk-dev] [PATCH 17/18] examples/qos_sched: check status of getting link info

Andrew Rybchenko arybchenko at solarflare.com
Tue Sep 10 10:25:57 CEST 2019


From: Igor Romanov <igor.romanov at oktetlabs.ru>

The return value of rte_eth_link_get() and rte_eth_link_get_nowait()
was changed from void to int. Update the usage of the functions
according to the new return type.

Signed-off-by: Igor Romanov <igor.romanov at oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
---
 examples/qos_sched/init.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c
index dbdbdefea..32e6e1ba2 100644
--- a/examples/qos_sched/init.c
+++ b/examples/qos_sched/init.c
@@ -154,7 +154,12 @@ app_init_port(uint16_t portid, struct rte_mempool *mp)
 	printf("done: ");
 
 	/* get link status */
-	rte_eth_link_get(portid, &link);
+	ret = rte_eth_link_get(portid, &link);
+	if (ret < 0)
+		rte_exit(EXIT_FAILURE,
+			 "rte_eth_link_get: err=%d, port=%u: %s\n",
+			 ret, portid, rte_strerror(-ret));
+
 	if (link.link_status) {
 		printf(" Link Up - speed %u Mbps - %s\n",
 			(uint32_t) link.link_speed,
@@ -295,7 +300,11 @@ app_init_sched_port(uint32_t portid, uint32_t socketid)
 	uint32_t pipe, subport;
 	int err;
 
-	rte_eth_link_get(portid, &link);
+	err = rte_eth_link_get(portid, &link);
+	if (err < 0)
+		rte_exit(EXIT_FAILURE,
+			 "rte_eth_link_get: err=%d, port=%u: %s\n",
+			 err, portid, rte_strerror(-err));
 
 	port_params.socket = socketid;
 	port_params.rate = (uint64_t) link.link_speed * 1000 * 1000 / 8;
-- 
2.17.1



More information about the dev mailing list