[v4,4/9] net/ipn3ke: adjust return value of xstats-get ops

Message ID 20220513025357.52275-5-fengchengwen@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Andrew Rybchenko
Headers
Series bugfix for ethdev telemetry |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chengwen Feng May 13, 2022, 2:53 a.m. UTC
  Many user (e.g. telemetry) invokes rte_eth_xstats_get(port_id, NULL, 0)
to retrieve the required number of elements, but currently ipn3ke PMD
returns zero when xstats is NULL.

In the previous patch, the framework defines that the required number
of entries should be returned when xstats is NULL and n is zero. And
xstats is NULL if and only if n is zero.

Based on the preceding constraints, this patch removes the logic of
"return zero when xstats is NULL".

Fixes: 5a6d883878db ("net/ipn3ke: implement statistics")
Cc: stable@dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
 drivers/net/ipn3ke/ipn3ke_representor.c | 3 ---
 1 file changed, 3 deletions(-)
  

Patch

diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c
index c9dde1d82e..abbecfdf2e 100644
--- a/drivers/net/ipn3ke/ipn3ke_representor.c
+++ b/drivers/net/ipn3ke/ipn3ke_representor.c
@@ -2218,9 +2218,6 @@  ipn3ke_rpst_xstats_get
 	struct ipn3ke_rpst_hw_port_stats hw_stats;
 	struct rte_eth_stats stats;
 
-	if (!xstats)
-		return 0;
-
 	if (!ethdev) {
 		IPN3KE_AFU_PMD_ERR("ethernet device to get statistics is NULL");
 		return -EINVAL;