]> git.droids-corp.org - dpdk.git/commit
net/axgbe: fix xstats get return if xstats is null
authorChengwen Feng <fengchengwen@huawei.com>
Fri, 13 May 2022 02:53:54 +0000 (10:53 +0800)
committerAndrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Fri, 20 May 2022 14:45:48 +0000 (16:45 +0200)
commit93041fd5149a4f8cc795ea8ebb229415e2994e51
tree5e6250bd2ef79e5981664e18a9f53a97e4fec1cc
parentd853d24b27d6524f26a2a830c7ef678ba739cfce
net/axgbe: 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 axgbe PMD
returns zero when xstats is null.

Remove the logic of "return zero when xstats is NULL", and add the logic
of "return the required number of entries when n is lower than the
required number of entries".

Fixes: 9d1ef6b2e731 ("net/axgbe: add xstats")
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>
drivers/net/axgbe/axgbe_ethdev.c