latency: check status of getting ethdev info
authorIvan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Thu, 12 Sep 2019 16:42:17 +0000 (17:42 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 7 Oct 2019 12:45:35 +0000 (14:45 +0200)
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@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
lib/librte_latencystats/rte_latencystats.c

index 06c6283..98e0189 100644 (file)
@@ -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);