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

Andrew Rybchenko arybchenko at solarflare.com
Tue Sep 10 10:25:54 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/flow_filtering/main.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c
index c40cfd098..cc9e7e780 100644
--- a/examples/flow_filtering/main.c
+++ b/examples/flow_filtering/main.c
@@ -100,15 +100,19 @@ assert_link_status(void)
 {
 	struct rte_eth_link link;
 	uint8_t rep_cnt = MAX_REPEAT_TIMES;
+	int link_get_err = -EINVAL;
 
 	memset(&link, 0, sizeof(link));
 	do {
-		rte_eth_link_get(port_id, &link);
-		if (link.link_status == ETH_LINK_UP)
+		link_get_err = rte_eth_link_get(port_id, &link);
+		if (link_get_err == 0 && link.link_status == ETH_LINK_UP)
 			break;
 		rte_delay_ms(CHECK_INTERVAL);
 	} while (--rep_cnt);
 
+	if (link_get_err < 0)
+		rte_exit(EXIT_FAILURE, ":: error: link get is failing: %s\n",
+			 rte_strerror(-link_get_err));
 	if (link.link_status == ETH_LINK_DOWN)
 		rte_exit(EXIT_FAILURE, ":: error: link is still down\n");
 }
-- 
2.17.1



More information about the dev mailing list