[07/18] app/proc-info: check status of getting link info

Message ID 1568103959-25572-8-git-send-email-arybchenko@solarflare.com
State New
Delegated to: Ferruh Yigit
Headers show
Series
  • ethdev: change link status get functions return value to int
Related show

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/checkpatch success coding style OK

Commit Message

Andrew Rybchenko Sept. 10, 2019, 8:25 a.m.
From: Igor Romanov <igor.romanov@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@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 app/proc-info/main.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

Patch

diff --git a/app/proc-info/main.c b/app/proc-info/main.c
index 94e808dc6..a3f854b89 100644
--- a/app/proc-info/main.c
+++ b/app/proc-info/main.c
@@ -678,13 +678,18 @@  show_port(void)
 		printf("  - generic config\n");
 
 		printf("\t  -- Socket %d\n", rte_eth_dev_socket_id(i));
-		rte_eth_link_get(i, &link);
-		printf("\t  -- link speed %d duplex %d,"
-				" auto neg %d status %d\n",
-				link.link_speed,
-				link.link_duplex,
-				link.link_autoneg,
-				link.link_status);
+		ret = rte_eth_link_get(i, &link);
+		if (ret < 0) {
+			printf("Link get failed (port %u): %s\n",
+			       i, rte_strerror(-ret));
+		} else {
+			printf("\t  -- link speed %d duplex %d,"
+					" auto neg %d status %d\n",
+					link.link_speed,
+					link.link_duplex,
+					link.link_autoneg,
+					link.link_status);
+		}
 		printf("\t  -- promiscuous (%d)\n",
 				rte_eth_promiscuous_get(i));
 		ret = rte_eth_dev_get_mtu(i, &mtu);