netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Jakub Kicinski <kuba@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Breno Leitao <leitao@debian.org>,
	kernel-team@meta.com,  Breno Leitao <Leitao@debian.org>
Subject: [PATCH net-next 2/2] netdevsim: collect statistics at RX side
Date: Wed, 11 Jun 2025 08:06:20 -0700	[thread overview]
Message-ID: <20250611-netdevsim_stat-v1-2-c11b657d96bf@debian.org> (raw)
In-Reply-To: <20250611-netdevsim_stat-v1-0-c11b657d96bf@debian.org>

When the RX side of netdevsim was added, the RX statistics were missing,
making the driver unusable for GenerateTraffic() test framework.

This patch adds proper statistics tracking on RX side, complementing the
TX path.

Signed-off-by: Breno Leitao <Leitao@debian.org>
---
 drivers/net/netdevsim/netdev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index 67871d31252fe..590cb5bb0d20b 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -39,12 +39,16 @@ MODULE_IMPORT_NS("NETDEV_INTERNAL");
 
 static int nsim_napi_rx(struct nsim_rq *rq, struct sk_buff *skb)
 {
+	struct net_device *dev = rq->napi.dev;
+
 	if (skb_queue_len(&rq->skb_queue) > NSIM_RING_SIZE) {
 		dev_kfree_skb_any(skb);
+		dev_dstats_rx_dropped(dev);
 		return NET_RX_DROP;
 	}
 
 	skb_queue_tail(&rq->skb_queue, skb);
+	dev_dstats_rx_add(dev, skb->len);
 	return NET_RX_SUCCESS;
 }
 

-- 
2.47.1


  parent reply	other threads:[~2025-06-11 15:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-11 15:06 [PATCH net-next 0/2] netdevsim: implement RX statistics using NETDEV_PCPU_STAT_DSTATS Breno Leitao
2025-06-11 15:06 ` [PATCH net-next 1/2] netdevsim: migrate to dstats stats collection Breno Leitao
2025-06-12 14:12   ` Joe Damato
2025-06-11 15:06 ` Breno Leitao [this message]
2025-06-12 14:25   ` [PATCH net-next 2/2] netdevsim: collect statistics at RX side Joe Damato
2025-06-12 14:45     ` Jakub Kicinski
2025-06-12 18:04       ` Breno Leitao

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=20250611-netdevsim_stat-v1-2-c11b657d96bf@debian.org \
    --to=leitao@debian.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).