[v9,08/24] examples/bbdev_app: new link status print format

Message ID 20200811085246.28735-9-i.dyukov@samsung.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series ethdev: allow unknown link speed |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ivan Dyukov Aug. 11, 2020, 8:52 a.m. UTC
  Add usage of rte_eth_link_to_str function to example
applications

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
---
 examples/bbdev_app/main.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
  

Patch

diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index 68a46050c..2eff5441a 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -313,6 +313,7 @@  check_port_link_status(uint16_t port_id)
 	uint8_t count;
 	struct rte_eth_link link;
 	int link_get_err = -EINVAL;
+	char link_status_text[ETH_LINK_MAX_STR_LEN];
 
 	printf("\nChecking link status.");
 	fflush(stdout);
@@ -323,11 +324,9 @@  check_port_link_status(uint16_t port_id)
 		link_get_err = rte_eth_link_get_nowait(port_id, &link);
 
 		if (link_get_err >= 0 && link.link_status) {
-			const char *dp = (link.link_duplex ==
-				ETH_LINK_FULL_DUPLEX) ?
-				"full-duplex" : "half-duplex";
-			printf("\nPort %u Link Up - speed %u Mbps - %s\n",
-				port_id, link.link_speed, dp);
+			rte_eth_link_to_str(link_status_text,
+				sizeof(link_status_text), NULL, &link);
+			printf("\nPort %u %s\n", port_id, link_status_text);
 			return 0;
 		}
 		printf(".");