[dpdk-dev] [PATCH v4 06/54] latency: check status of getting ethdev info
Andrew Rybchenko
arybchenko at solarflare.com
Thu Sep 12 18:42:17 CEST 2019
From: Ivan Ilchenko <Ivan.Ilchenko at oktetlabs.com>
rte_eth_dev_info_get() return value was changed from void to
int, so this patch modify rte_eth_dev_info_get() usage across
latency component according to its new return type.
Signed-off-by: Ivan Ilchenko <Ivan.Ilchenko at oktetlabs.com>
Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
---
lib/librte_latencystats/rte_latencystats.c | 23 ++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/lib/librte_latencystats/rte_latencystats.c b/lib/librte_latencystats/rte_latencystats.c
index 06c62831b..98e018939 100644
--- a/lib/librte_latencystats/rte_latencystats.c
+++ b/lib/librte_latencystats/rte_latencystats.c
@@ -208,6 +208,7 @@ rte_latencystats_init(uint64_t app_samp_intvl,
const char *ptr_strings[NUM_LATENCY_STATS] = {0};
const struct rte_memzone *mz = NULL;
const unsigned int flags = 0;
+ int ret;
if (rte_memzone_lookup(MZ_RTE_LATENCY_STATS))
return -EEXIST;
@@ -239,7 +240,16 @@ rte_latencystats_init(uint64_t app_samp_intvl,
/** Register Rx/Tx callbacks */
RTE_ETH_FOREACH_DEV(pid) {
struct rte_eth_dev_info dev_info;
- rte_eth_dev_info_get(pid, &dev_info);
+
+ ret = rte_eth_dev_info_get(pid, &dev_info);
+ if (ret != 0) {
+ RTE_LOG(INFO, LATENCY_STATS,
+ "Error during getting device (port %u) info: %s\n",
+ pid, strerror(-ret));
+
+ continue;
+ }
+
for (qid = 0; qid < dev_info.nb_rx_queues; qid++) {
cbs = &rx_cbs[pid][qid];
cbs->cb = rte_eth_add_first_rx_callback(pid, qid,
@@ -274,7 +284,16 @@ rte_latencystats_uninit(void)
/** De register Rx/Tx callbacks */
RTE_ETH_FOREACH_DEV(pid) {
struct rte_eth_dev_info dev_info;
- rte_eth_dev_info_get(pid, &dev_info);
+
+ ret = rte_eth_dev_info_get(pid, &dev_info);
+ if (ret != 0) {
+ RTE_LOG(INFO, LATENCY_STATS,
+ "Error during getting device (port %u) info: %s\n",
+ pid, strerror(-ret));
+
+ continue;
+ }
+
for (qid = 0; qid < dev_info.nb_rx_queues; qid++) {
cbs = &rx_cbs[pid][qid];
ret = rte_eth_remove_rx_callback(pid, qid, cbs->cb);
--
2.17.1
More information about the dev
mailing list