DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	pavel.belous@aquantia.com
Subject: [RFC 3/5] net/atlantic: fix handling of xstats_get
Date: Tue,  8 Oct 2024 08:59:57 -0700	[thread overview]
Message-ID: <20241008160209.68000-4-stephen@networkplumber.org> (raw)
In-Reply-To: <20241008160209.68000-1-stephen@networkplumber.org>

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.belous@aquantia.com

Signed-off-by: Stephen Hemminger <stephen@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


  parent reply	other threads:[~2024-10-08 16:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-08 15:59 [RFC 0/5] make PMD xstat_get alike Stephen Hemminger
2024-10-08 15:59 ` [RFC 1/5] net/txgbe: fix query handling in xstats_get Stephen Hemminger
2024-10-09  8:00   ` Jiawen Wu
2024-10-08 15:59 ` [RFC 2/5] net/ngbe: " Stephen Hemminger
2024-10-08 15:59 ` Stephen Hemminger [this message]
2024-10-08 15:59 ` [RFC 4/5] net/octeontx: fix handling of xstats_get Stephen Hemminger
2024-10-08 15:59 ` [RFC 5/5] net/sfc: fix handling of xstats_get queries Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241008160209.68000-4-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=pavel.belous@aquantia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).