summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/dpdk_priv.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/dpdk/device/dpdk_priv.h')
-rw-r--r--src/plugins/dpdk/device/dpdk_priv.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/plugins/dpdk/device/dpdk_priv.h b/src/plugins/dpdk/device/dpdk_priv.h
index e0e06826935..0b1fe92bf72 100644
--- a/src/plugins/dpdk/device/dpdk_priv.h
+++ b/src/plugins/dpdk/device/dpdk_priv.h
@@ -52,26 +52,26 @@ _(log-level)
static inline void
dpdk_get_xstats (dpdk_device_t * xd)
{
+ int len, ret;
+
if (!(xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP))
return;
- int len;
- if ((len = rte_eth_xstats_get (xd->port_id, NULL, 0)) > 0)
- {
- vec_validate (xd->xstats, len - 1);
- vec_validate (xd->last_cleared_xstats, len - 1);
- len =
- rte_eth_xstats_get (xd->port_id, xd->xstats, vec_len (xd->xstats));
-
- ASSERT (vec_len (xd->xstats) == len);
- ASSERT (vec_len (xd->last_cleared_xstats) == len);
+ len = rte_eth_xstats_get (xd->port_id, NULL, 0);
+ if (len < 0)
+ return;
- _vec_len (xd->xstats) = len;
- _vec_len (xd->last_cleared_xstats) = len;
+ vec_validate (xd->xstats, len - 1);
+ ret = rte_eth_xstats_get (xd->port_id, xd->xstats, len);
+ if (ret < 0 || ret > len)
+ {
+ _vec_len (xd->xstats) = 0;
+ return;
}
-}
+ _vec_len (xd->xstats) = len;
+}
static inline void
dpdk_update_counters (dpdk_device_t * xd, f64 now)