[PATCH 1/3] ethdev: fix telemetry xstats return null with some PMDs
Chengwen Feng
fengchengwen at huawei.com
Sat Apr 16 03:07:45 CEST 2022
Currently the telemetry xstats uses rte_eth_xstats_get() to retrieve
the number of elements. But the value to be returned when the parameter
'xstats' is NULL is not specified, some PMDs (eg. hns3/ipn3ke/mvpp2/
axgbe) return zero while others return the required number of elements.
This patch uses rte_eth_xstats_get_names() instead of
rte_eth_xstats_get() because it returns the required number of elements
when the parameter 'xstats_name' is NULL.
Fixes: c190daedb9b1 ("ethdev: add telemetry callbacks")
Cc: stable at dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
lib/ethdev/rte_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 29a3d80466..615383bde2 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -5558,7 +5558,7 @@ eth_dev_handle_port_xstats(const char *cmd __rte_unused,
if (!rte_eth_dev_is_valid_port(port_id))
return -1;
- num_xstats = rte_eth_xstats_get(port_id, NULL, 0);
+ num_xstats = rte_eth_xstats_get_names(port_id, NULL, 0);
if (num_xstats < 0)
return -1;
--
2.33.0
More information about the dev
mailing list