[v11,20/24] examples/ntb: new link status print format
diff mbox series

Message ID 20200915190728.18143-21-i.dyukov@samsung.com
State Accepted
Delegated to: Ferruh Yigit
Headers show
Series
  • ethdev: allow unknown link speed
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ivan Dyukov Sept. 15, 2020, 7:07 p.m. UTC
Add usage of rte_eth_link_strf function to example
applications

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
---
 examples/ntb/ntb_fwd.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Patch
diff mbox series

diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c
index eba8ebf9f..6d9b3b45c 100644
--- a/examples/ntb/ntb_fwd.c
+++ b/examples/ntb/ntb_fwd.c
@@ -729,6 +729,7 @@  start_pkt_fwd(void)
 	struct rte_eth_link eth_link;
 	uint32_t lcore_id;
 	int ret, i;
+	char link_status_text[RTE_ETH_LINK_MAX_STR_LEN];
 
 	ret = ntb_fwd_config_setup();
 	if (ret < 0) {
@@ -747,11 +748,11 @@  start_pkt_fwd(void)
 				return;
 			}
 			if (eth_link.link_status) {
-				printf("Eth%u Link Up. Speed %u Mbps - %s\n",
-					eth_port_id, eth_link.link_speed,
-					(eth_link.link_duplex ==
-					 ETH_LINK_FULL_DUPLEX) ?
-					("full-duplex") : ("half-duplex"));
+				rte_eth_link_to_str(link_status_text,
+					sizeof(link_status_text),
+					&eth_link);
+				printf("Eth%u %s\n", eth_port_id,
+				       link_status_text);
 				break;
 			}
 		}