]> git.ipfire.org Git - thirdparty/linux.git/commit
netdevsim: account dropped packet length in stats on queue free
authorBreno Leitao <leitao@debian.org>
Wed, 18 Jun 2025 08:32:45 +0000 (01:32 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 19 Jun 2025 23:15:34 +0000 (16:15 -0700)
commit2a68a22304f90e5ee960cccd86895a50cf154723
treef199bdb5dad768b794508c3253fefd0f526ce5bf
parent27480a7c8f0274f8f2fc6c40e4522f38e52bd05f
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.

local_bh_{disable, enable}() protection is used to disable preemption,
which is necessary given that dev_dstats_rx_dropped_add() access
this_cpu_ptr(). See discussion in [1].

Link: https://lore.kernel.org/all/20250617055934.3fd9d322@kernel.org/
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Breno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20250618-netdevsim_stat-v4-4-19fe0d35e28e@debian.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/netdevsim/netdev.c