On Tue,  8 Oct 2024 08:59:58 -0700
Stephen Hemminger <step...@networkplumber.org> wrote:

> 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: 5538990924f2 ("net/octeontx: add basic stats support")
> Cc: jerin.ja...@caviumnetworks.com
> Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
> ---
>  drivers/net/octeontx/octeontx_ethdev.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/octeontx/octeontx_ethdev.c 
> b/drivers/net/octeontx/octeontx_ethdev.c
> index 3b8d717797..51093cc815 100644
> --- a/drivers/net/octeontx/octeontx_ethdev.c
> +++ b/drivers/net/octeontx/octeontx_ethdev.c
> @@ -1016,6 +1016,9 @@ octeontx_dev_xstats_get(struct rte_eth_dev *dev,
>       struct octeontx_nic *nic = octeontx_pmd_priv(dev);
>  
>       PMD_INIT_FUNC_TRACE();
> +     if (n < NUM_BGX_XSTAT)
> +             return NUM_BGX_XSTAT;
> +
>       return octeontx_port_xstats(nic, xstats, n);
>  }
>  

Jerin or someone with access to this NIC, could you check
that it works?

Reply via email to