aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk
diff options
context:
space:
mode:
authorOle Troan <otroan@employees.org>2024-06-19 21:07:37 +0200
committerFlorin Coras <florin.coras@gmail.com>2024-06-19 23:35:25 +0000
commitcbf3888ca80c0abaeec22b43c6ae08081b73c5f9 (patch)
tree1c0e8d2db8fa084837a9a8cf59746d0948b065b2 /src/plugins/dpdk
parentb4516bbccf1fb39fbe1e589296d1162e714862e9 (diff)
dpdk: xstats vecor stuck at 0 elements
Fixes: dd6fb60f1794fc08ec40598a67dc70f942c200d1 Type: fix Change-Id: I2429715a954361ceea969191493c15bef21e2040 Signed-off-by: Ole Troan <otroan@employees.org>
Diffstat (limited to 'src/plugins/dpdk')
-rw-r--r--src/plugins/dpdk/device/dpdk_priv.h26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/plugins/dpdk/device/dpdk_priv.h b/src/plugins/dpdk/device/dpdk_priv.h
index 0af435767d2..e5b5a35df80 100644
--- a/src/plugins/dpdk/device/dpdk_priv.h
+++ b/src/plugins/dpdk/device/dpdk_priv.h
@@ -54,14 +54,19 @@ dpdk_get_xstats (dpdk_device_t *xd, u32 thread_index)
{
int ret;
int i;
- int len = vec_len (xd->xstats);
+ int len;
if (!(xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP))
return;
if (xd->driver == 0)
return;
+ len = rte_eth_xstats_get (xd->port_id, NULL, 0);
+ if (len < 0)
+ return;
+
+ vec_validate (xd->xstats, len - 1);
ret = rte_eth_xstats_get (xd->port_id, xd->xstats, len);
- if (ret < 0 || ret > len || len != vec_len (xd->driver->xstats_counters))
+ if (ret < 0 || ret > len)
{
/* Failed, expand vector and try again on next time around the track. */
vec_validate (xd->xstats, ret - 1);
@@ -69,13 +74,20 @@ dpdk_get_xstats (dpdk_device_t *xd, u32 thread_index)
dpdk_log_warn ("rte_eth_xstats_get(%d) failed: %d", xd->port_id, ret);
return;
}
- vec_foreach_index (i, xd->xstats)
+ if (len == vec_len (xd->driver->xstats_counters))
{
- vlib_set_simple_counter (&xd->driver->xstats_counters[i], thread_index,
- xd->sw_if_index, xd->xstats[i].value);
+ vec_foreach_index (i, xd->xstats)
+ {
+ vlib_set_simple_counter (&xd->driver->xstats_counters[i],
+ thread_index, xd->sw_if_index,
+ xd->xstats[i].value);
+ }
+ }
+ else
+ {
+ dpdk_log_warn ("rte_eth_xstats_get vector size mismatch (%d/%d", len,
+ vec_len (xd->driver->xstats_counters));
}
-
- vec_set_len (xd->xstats, ret);
}
#define DPDK_UPDATE_COUNTER(vnm, tidx, xd, stat, cnt) \