[v2,3/9] net/ipn3ke: adjust retval when xstats is null of get xstats
Checks
Commit Message
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.
This patch adjusts that the return value was the required number of
elements when stats 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 | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
@@ -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;
@@ -2258,7 +2255,7 @@ ipn3ke_rpst_xstats_get
port_id = atoi(ch);
count = ipn3ke_rpst_xstats_calc_num();
- if (n < count)
+ if (xstats == NULL || n < count)
return count;
if (hw->retimer.mac_type == IFPGA_RAWDEV_RETIMER_MAC_TYPE_25GE_25GAUI) {