[dpdk-dev] [PATCH v5 10/25] examples/ioat: new link status print format

Ivan Dyukov i.dyukov at samsung.com
Mon Jul 6 22:26:00 CEST 2020


Add usage of rte_eth_link_strf function to example
applications

Signed-off-by: Ivan Dyukov <i.dyukov at samsung.com>
---
 examples/ioat/ioatfwd.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/examples/ioat/ioatfwd.c b/examples/ioat/ioatfwd.c
index b66ee73bc..8bf80c262 100644
--- a/examples/ioat/ioatfwd.c
+++ b/examples/ioat/ioatfwd.c
@@ -700,6 +700,7 @@ check_link_status(uint32_t port_mask)
 	uint16_t portid;
 	struct rte_eth_link link;
 	int ret, link_status = 0;
+	char link_status_text[60];
 
 	printf("\nChecking link status\n");
 	RTE_ETH_FOREACH_DEV(portid) {
@@ -715,15 +716,11 @@ check_link_status(uint32_t port_mask)
 		}
 
 		/* Print link status */
-		if (link.link_status) {
-			printf(
-				"Port %d Link Up. Speed %u Mbps - %s\n",
-				portid, link.link_speed,
-				(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
-				("full-duplex") : ("half-duplex"));
+		rte_eth_link_strf(link_status_text, 60, NULL, &link);
+		printf("Port %d %s", portid, link_status_text);
+
+		if (link.link_status)
 			link_status = 1;
-		} else
-			printf("Port %d Link Down\n", portid);
 	}
 	return link_status;
 }
-- 
2.17.1



More information about the dev mailing list