]> git.droids-corp.org - dpdk.git/commit
net/mvpp2: fix xstats get return if xstats is null
authorChengwen Feng <fengchengwen@huawei.com>
Fri, 13 May 2022 02:53:53 +0000 (10:53 +0800)
committerAndrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Fri, 20 May 2022 14:45:46 +0000 (16:45 +0200)
commitd853d24b27d6524f26a2a830c7ef678ba739cfce
tree6dbd5c6ab12c1a17e92df0523c867204ea1aa902
parente17cb41db7656121f5809e353f8db126b026fbb4
net/mvpp2: 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 mvpp2 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: a77b5378cd41 ("net/mrvl: add extended 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>
drivers/net/mvpp2/mrvl_ethdev.c