* [PATCH net-next] udp: add drop count for packets in udp_prod_queue
@ 2026-01-29 8:38 Mahdi Faramarzpour
2026-01-29 17:17 ` Willem de Bruijn
2026-01-31 1:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Mahdi Faramarzpour @ 2026-01-29 8:38 UTC (permalink / raw)
To: netdev
Cc: Willem de Bruijn, David S. Miller, David Ahern, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, open list,
kshitiz.bartariya, Mahdi Faramarzpour
This commit adds SNMP drop count increment for the packets in
per NUMA queues which were introduced in commit b650bf0977d3
("udp: remove busylock and add per NUMA queues"). note that SNMP
counters are incremented currently by the caller for skb. And
that these skbs on the intermediate queue cannot be counted
there so need similar logic in their error path.
Signed-off-by: Mahdi Faramarzpour <mahdifrmx@gmail.com>
---
v7:
- revert the last change and fix style
v6: https://lore.kernel.org/netdev/20260128070311.48892-1-mahdifrmx@gmail.com/
- increasing a single counter based on socket family
v5: https://lore.kernel.org/netdev/20260122185357.50922-1-mahdifrmx@gmail.com/
- check if drop counts are non-zero before increasing countrers
v4: https://lore.kernel.org/netdev/20260108102950.49417-1-mahdifrmx@gmail.com/
- move all changes to unlikely(to_drop) branch
v3: https://lore.kernel.org/netdev/20260105114732.140719-1-mahdifrmx@gmail.com/
- remove the unreachable UDP_MIB_RCVBUFERRORS code
v2: https://lore.kernel.org/netdev/20260105071218.10785-1-mahdifrmx@gmail.com/
- change ENOMEM to ENOBUFS
v1: https://lore.kernel.org/netdev/20260104105732.427691-1-mahdifrmx@gmail.com/
---
net/ipv4/udp.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index ffe074cb5..6ad7296db 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1793,14 +1793,32 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb)
}
if (unlikely(to_drop)) {
+ int err_ipv4 = 0;
+ int err_ipv6 = 0;
+
for (nb = 0; to_drop != NULL; nb++) {
skb = to_drop;
+ if (skb->protocol == htons(ETH_P_IP))
+ err_ipv4++;
+ else
+ err_ipv6++;
to_drop = skb->next;
skb_mark_not_on_list(skb);
- /* TODO: update SNMP values. */
sk_skb_reason_drop(sk, skb, SKB_DROP_REASON_PROTO_MEM);
}
numa_drop_add(&udp_sk(sk)->drop_counters, nb);
+ if (err_ipv4 > 0) {
+ SNMP_ADD_STATS(__UDPX_MIB(sk, true), UDP_MIB_MEMERRORS,
+ err_ipv4);
+ SNMP_ADD_STATS(__UDPX_MIB(sk, true), UDP_MIB_INERRORS,
+ err_ipv4);
+ }
+ if (err_ipv6 > 0) {
+ SNMP_ADD_STATS(__UDPX_MIB(sk, false), UDP_MIB_MEMERRORS,
+ err_ipv6);
+ SNMP_ADD_STATS(__UDPX_MIB(sk, false), UDP_MIB_INERRORS,
+ err_ipv6);
+ }
}
atomic_sub(total_size, &udp_prod_queue->rmem_alloc);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net-next] udp: add drop count for packets in udp_prod_queue
2026-01-29 8:38 [PATCH net-next] udp: add drop count for packets in udp_prod_queue Mahdi Faramarzpour
@ 2026-01-29 17:17 ` Willem de Bruijn
2026-01-29 17:28 ` Eric Dumazet
2026-01-31 1:40 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: Willem de Bruijn @ 2026-01-29 17:17 UTC (permalink / raw)
To: Mahdi Faramarzpour, netdev
Cc: Willem de Bruijn, David S. Miller, David Ahern, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, open list,
kshitiz.bartariya, Mahdi Faramarzpour
Mahdi Faramarzpour wrote:
> This commit adds SNMP drop count increment for the packets in
> per NUMA queues which were introduced in commit b650bf0977d3
> ("udp: remove busylock and add per NUMA queues"). note that SNMP
> counters are incremented currently by the caller for skb. And
> that these skbs on the intermediate queue cannot be counted
> there so need similar logic in their error path.
>
> Signed-off-by: Mahdi Faramarzpour <mahdifrmx@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net-next] udp: add drop count for packets in udp_prod_queue
2026-01-29 17:17 ` Willem de Bruijn
@ 2026-01-29 17:28 ` Eric Dumazet
0 siblings, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2026-01-29 17:28 UTC (permalink / raw)
To: Willem de Bruijn
Cc: Mahdi Faramarzpour, netdev, David S. Miller, David Ahern,
Jakub Kicinski, Paolo Abeni, Simon Horman, open list,
kshitiz.bartariya
On Thu, Jan 29, 2026 at 6:17 PM Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
>
> Mahdi Faramarzpour wrote:
> > This commit adds SNMP drop count increment for the packets in
> > per NUMA queues which were introduced in commit b650bf0977d3
> > ("udp: remove busylock and add per NUMA queues"). note that SNMP
> > counters are incremented currently by the caller for skb. And
> > that these skbs on the intermediate queue cannot be counted
> > there so need similar logic in their error path.
> >
> > Signed-off-by: Mahdi Faramarzpour <mahdifrmx@gmail.com>
>
> Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] udp: add drop count for packets in udp_prod_queue
2026-01-29 8:38 [PATCH net-next] udp: add drop count for packets in udp_prod_queue Mahdi Faramarzpour
2026-01-29 17:17 ` Willem de Bruijn
@ 2026-01-31 1:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-31 1:40 UTC (permalink / raw)
To: Mahdi Faramarzpour
Cc: netdev, willemdebruijn.kernel, davem, dsahern, edumazet, kuba,
pabeni, horms, linux-kernel, kshitiz.bartariya
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 29 Jan 2026 12:08:06 +0330 you wrote:
> This commit adds SNMP drop count increment for the packets in
> per NUMA queues which were introduced in commit b650bf0977d3
> ("udp: remove busylock and add per NUMA queues"). note that SNMP
> counters are incremented currently by the caller for skb. And
> that these skbs on the intermediate queue cannot be counted
> there so need similar logic in their error path.
>
> [...]
Here is the summary with links:
- [net-next] udp: add drop count for packets in udp_prod_queue
https://git.kernel.org/netdev/net-next/c/820990d66577
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-01-31 1:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-29 8:38 [PATCH net-next] udp: add drop count for packets in udp_prod_queue Mahdi Faramarzpour
2026-01-29 17:17 ` Willem de Bruijn
2026-01-29 17:28 ` Eric Dumazet
2026-01-31 1:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox