summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/dpdk_priv.h
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2019-06-03 08:13:21 +0000
committerDamjan Marion <dmarion@me.com>2019-06-04 07:46:49 +0000
commitd5cf64f8c2a08d2f41327cc99dd2d96f77d82ca3 (patch)
treeb05746f3c7dbd7aa787a32781a14e614ff61fefc /src/plugins/dpdk/device/dpdk_priv.h
parentbbc0867b6322d63cd35dda8e7a836566d93f1f16 (diff)
dpdk: rework extended stats
Change-Id: I421192e1921d4c9c5486a6dcca745582aebf4e3e Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
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)