From: Ivan Ilchenko Date: Thu, 12 Sep 2019 16:42:17 +0000 (+0100) Subject: latency: check status of getting ethdev info X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d00a52acf9a07d392ad1093cfb6d46a6737fe1ae;p=dpdk.git latency: check status of getting ethdev info 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 Signed-off-by: Andrew Rybchenko Reviewed-by: Ferruh Yigit --- diff --git a/lib/librte_latencystats/rte_latencystats.c b/lib/librte_latencystats/rte_latencystats.c index 06c62831b4..98e018939e 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);