The xstats_get function in this driver did not act the same
as other drivers when queried. The correct check is to look
at the requested number of stats and compare it to the available
stats and if the request is too small, return the correct size.

Fixes: fbe059e87209 ("net/atlantic: implement device statistics")
Cc: pavel.bel...@aquantia.com

Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
---
 drivers/net/atlantic/atl_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/atlantic/atl_ethdev.c 
b/drivers/net/atlantic/atl_ethdev.c
index 9cde935834..eac6f5a7b9 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -1029,7 +1029,7 @@ atl_dev_xstats_get(struct rte_eth_dev *dev, struct 
rte_eth_xstat *stats,
        unsigned int i;
        unsigned int count = atl_dev_xstats_get_count(dev);
 
-       if (!stats)
+       if (n < count)
                return count;
 
        if (hw->aq_fw_ops->send_macsec_req != NULL) {
-- 
2.45.2

Reply via email to