net/dpaa: fix xstats implementation

Some of the applications are expecting that if n is 0, it shall
return the supported number of stats. e.g. VPP

Fixes: b21ed3e2a1 ("net/dpaa: support extended statistics")
Cc: stable@dpdk.org

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
This commit is contained in:
Hemant Agrawal 2018-04-25 18:27:01 +05:30 committed by Thomas Monjalon
parent 627b677014
commit 339c1025a8

View File

@ -379,12 +379,12 @@ dpaa_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
unsigned int i = 0, num = RTE_DIM(dpaa_xstats_strings);
uint64_t values[sizeof(struct dpaa_if_stats) / 8];
if (xstats == NULL)
return 0;
if (n < num)
return num;
if (xstats == NULL)
return 0;
fman_if_stats_get_all(dpaa_intf->fif, values,
sizeof(struct dpaa_if_stats) / 8);