Skip to content

Commit

Permalink
net/ipn3ke: fix xstats get return if xstats is null
Browse files Browse the repository at this point in the history
[ upstream commit e17cb41 ]

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: 5a6d883 ("net/ipn3ke: implement statistics")

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
  • Loading branch information
fengchengwen authored and kevintraynor committed Jun 8, 2022
1 parent 0072520 commit 6682fda
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions drivers/net/ipn3ke/ipn3ke_representor.c
Expand Up @@ -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;
Expand Down

0 comments on commit 6682fda

Please sign in to comment.