[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250613-netdevsim_stat-v2-4-98fa38836c48@debian.org>
Date: Fri, 13 Jun 2025 03:40:01 -0700
From: Breno Leitao <leitao@...ian.org>
To: Jakub Kicinski <kuba@...nel.org>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>, David Wei <dw@...idwei.uk>,
Shuah Khan <shuah@...nel.org>, Simon Horman <horms@...nel.org>, joe@...a.to
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, Breno Leitao <leitao@...ian.org>,
kernel-team@...a.com
Subject: [PATCH net-next v2 4/4] netdevsim: account dropped packet length
in stats on queue free
Add a call to dev_dstats_rx_dropped_add() in nsim_queue_free() to
account for the number of packets dropped when purging the skb queue.
This improves the accuracy of RX drop statistics reported by
netdevsim.
Suggested-by: Jakub Kicinski <kuba@...nel.org>
Signed-off-by: Breno Leitao <leitao@...ian.org>
---
drivers/net/netdevsim/netdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index de309ff69e43e..6e8fb8922ace2 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -634,7 +634,10 @@ static struct nsim_rq *nsim_queue_alloc(void)
static void nsim_queue_free(struct nsim_rq *rq)
{
+ struct net_device *dev = rq->napi.dev;
+
hrtimer_cancel(&rq->napi_timer);
+ dev_dstats_rx_dropped_add(dev, rq->skb_queue.qlen);
skb_queue_purge_reason(&rq->skb_queue, SKB_DROP_REASON_QUEUE_PURGE);
kfree(rq);
}
--
2.47.1
Powered by blists - more mailing lists