net/ipn3ke: fix xstats get return if xstats is null

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.

Dedicated check for xstats vs null is not required, since ethdev layer
guarantees that it may be null only if number of entries n is 0 (which
is definitely smaller than total xstats count).

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

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
This commit is contained in:
Chengwen Feng 2022-05-13 10:53:52 +08:00 committed by Andrew Rybchenko
parent e15401f362
commit e17cb41db7

View File

@ -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;