Skip to contentSkip to conversation

udp : increments sk_drops in __udp_queue_rcv_skb()

PATCH In review Eric Dumazet 2 participants 2 messages Feb 2, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 udp : increments sk_drops in __udp_queue_rcv_skb()

Hi David

While investigating with Kenny Chang multicast drops problems, I found sk_drops field was not anymore updated in current kernels for UDP IPV4 sockets.

Thank you

[PATCH] udp: increments sk_drops in __udp_queue_rcv_skb()

Commit 93821778def10ec1e69aa3ac10adee975dad4ff3
(udp: Fix rcv socket locking) accidentally removed sk_drops increments for UDP IPV4 sockets.

This field can be used to detect incorrect sizing of socket receive buffers.

---

net/ipv4/udp.c +3 -1
index b7faffe..997c418 100644
@@ -1015,9 +1015,11 @@ static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
 
 	if ((rc = sock_queue_rcv_skb(sk, skb)) < 0) {
 		/* Note that an ENOMEM error is charged twice */
-		if (rc == -ENOMEM)
+		if (rc == -ENOMEM) {
 			UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS,
 					 is_udplite);
+			atomic_inc(&sk->sk_drops);
+		}
 		goto drop;
 	}
 
maintainer
#1 lore raw

From: Eric Dumazet <[email protected]>
Date: Mon, 02 Feb 2009 16:32:51 +0100

Quoted 9 lines

udp: increments sk_drops in __udp_queue_rcv_skb()

Commit 93821778def10ec1e69aa3ac10adee975dad4ff3
(udp: Fix rcv socket locking) accidentally removed sk_drops increments for UDP IPV4 sockets.

This field can be used to detect incorrect sizing of socket receive buffers.

Yikes, good catch Eric.

Applied and queued up for -stable.