[dpdk-dev] [PATCH 12/18] examples/ip_pipeline: check status of getting link info
Andrew Rybchenko
arybchenko at solarflare.com
Tue Sep 10 10:25:52 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/ip_pipeline/cli.c | 9 ++++++++-
examples/ip_pipeline/link.c | 3 ++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/examples/ip_pipeline/cli.c b/examples/ip_pipeline/cli.c
index c6cf4204e..4930310cc 100644
--- a/examples/ip_pipeline/cli.c
+++ b/examples/ip_pipeline/cli.c
@@ -248,12 +248,19 @@ print_link_info(struct link *link, char *out, size_t out_size)
struct rte_ether_addr mac_addr;
struct rte_eth_link eth_link;
uint16_t mtu;
+ int ret;
memset(&stats, 0, sizeof(stats));
rte_eth_stats_get(link->port_id, &stats);
rte_eth_macaddr_get(link->port_id, &mac_addr);
- rte_eth_link_get(link->port_id, ð_link);
+ ret = rte_eth_link_get(link->port_id, ð_link);
+ if (ret < 0) {
+ snprintf(out, out_size, "\n%s: link get failed: %s",
+ link->name, rte_strerror(-ret));
+ return;
+ }
+
rte_eth_dev_get_mtu(link->port_id, &mtu);
snprintf(out, out_size,
diff --git a/examples/ip_pipeline/link.c b/examples/ip_pipeline/link.c
index 744abf394..16bcffe35 100644
--- a/examples/ip_pipeline/link.c
+++ b/examples/ip_pipeline/link.c
@@ -264,7 +264,8 @@ link_is_up(const char *name)
return 0;
/* Resource */
- rte_eth_link_get(link->port_id, &link_params);
+ if (rte_eth_link_get(link->port_id, &link_params) < 0)
+ return 0;
return (link_params.link_status == ETH_LINK_DOWN) ? 0 : 1;
}
--
2.17.1
More information about the dev
mailing list