[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260107141541.1985-1-kshitiz.bartariya@zohomail.in>
Date: Wed, 7 Jan 2026 19:45:36 +0530
From: Kshitiz Bartariya <kshitiz.bartariya@...omail.in>
To: netdev@...r.kernel.org
Cc: Willem de Bruijn <willemdebruijn.kernel@...il.com>,
"David S . Miller" <davem@...emloft.net>,
David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>,
Kshitiz Bartariya <kshitiz.bartariya@...omail.in>
Subject: [PATCHÂ net-next] __udp_enqueue_schedule_skb() drops packets when there is no buffer space available, but currently does not update UDP SNMP counters.
Update UDP_MIB_MEMERRORS and UDP_MIB_INERRORS when packets are dropped
due to memory pressure, for both UDP and UDPLite sockets.
This removes a long-standing TODO and makes UDP statistics consistent
with actual drop behavior.
Signed-off-by: Kshitiz Bartariya <kshitiz.bartariya@...omail.in>
---
net/ipv4/udp.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 9c87067c74bc..66c06f468240 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1794,11 +1794,16 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb)
}
if (unlikely(to_drop)) {
+ const bool is_udplite = IS_UDPLITE(sk);
+
for (nb = 0; to_drop != NULL; nb++) {
skb = to_drop;
to_drop = skb->next;
skb_mark_not_on_list(skb);
- /* TODO: update SNMP values. */
+
+ UDP_INC_STATS(sock_net(sk), UDP_MIB_MEMERRORS, is_udplite);
+ UDP_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
+
sk_skb_reason_drop(sk, skb, SKB_DROP_REASON_PROTO_MEM);
}
numa_drop_add(&udp_sk(sk)->drop_counters, nb);
--
2.50.1 (Apple Git-155)
Powered by blists - more mailing lists