[PATCH v3 01/10] ethdev: define retval when xstats is null of get xstats

Chengwen Feng fengchengwen at huawei.com
Thu May 5 10:02:24 CEST 2022


Currently the value returned when xstats is NULL of rte_eth_xstats_get()
is not specified, some PMDs (eg. hns3/ipn3ke/mvpp2/axgbe) return zero
while others return the required number of elements.

This patch defines that the return value should be the required number of
elements when xstats is NULL of rte_eth_xstats_get().

Fixes: ce757f5c9a4d ("ethdev: new method to retrieve extended statistics")
Cc: stable at dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
 lib/ethdev/rte_ethdev.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index 04cff8ee10..1aefc48532 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -3174,7 +3174,8 @@ int rte_eth_xstats_get_names(uint16_t port_id,
  * @param xstats
  *   A pointer to a table of structure of type *rte_eth_xstat*
  *   to be filled with device statistics ids and values.
- *   This parameter can be set to NULL if n is 0.
+ *   This parameter can be set to NULL if n is 0; If set to NULL, the
+ *   function returns the required number of elements.
  * @param n
  *   The size of the xstats array (number of elements).
  * @return
-- 
2.33.0



More information about the dev mailing list