Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

udp: add tracepoints for queueing skb to rcvbuf

This patch adds a tracepoint to __udp_queue_rcv_skb to get the
return value of ip_queue_rcv_skb. It indicates why kernel drops
a packet at this point.

ip_queue_rcv_skb returns following values in the packet drop case:

rcvbuf is full : -ENOMEM
sk_filter returns error : -EINVAL, -EACCESS, -ENOMEM, etc.
__sk_mem_schedule returns error: -ENOBUF

Signed-off-by: Satoru Moriya <satoru.moriya@hds.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Satoru Moriya and committed by
David S. Miller
296f7ea7 dec17b74

+35
+32
include/trace/events/udp.h
··· 1 + #undef TRACE_SYSTEM 2 + #define TRACE_SYSTEM udp 3 + 4 + #if !defined(_TRACE_UDP_H) || defined(TRACE_HEADER_MULTI_READ) 5 + #define _TRACE_UDP_H 6 + 7 + #include <linux/udp.h> 8 + #include <linux/tracepoint.h> 9 + 10 + TRACE_EVENT(udp_fail_queue_rcv_skb, 11 + 12 + TP_PROTO(int rc, struct sock *sk), 13 + 14 + TP_ARGS(rc, sk), 15 + 16 + TP_STRUCT__entry( 17 + __field(int, rc) 18 + __field(__u16, lport) 19 + ), 20 + 21 + TP_fast_assign( 22 + __entry->rc = rc; 23 + __entry->lport = inet_sk(sk)->inet_num; 24 + ), 25 + 26 + TP_printk("rc=%d port=%hu", __entry->rc, __entry->lport) 27 + ); 28 + 29 + #endif /* _TRACE_UDP_H */ 30 + 31 + /* This part must be outside protection */ 32 + #include <trace/define_trace.h>
+1
net/core/net-traces.c
··· 28 28 #include <trace/events/skb.h> 29 29 #include <trace/events/net.h> 30 30 #include <trace/events/napi.h> 31 + #include <trace/events/udp.h> 31 32 32 33 EXPORT_TRACEPOINT_SYMBOL_GPL(kfree_skb); 33 34
+2
net/ipv4/udp.c
··· 105 105 #include <net/route.h> 106 106 #include <net/checksum.h> 107 107 #include <net/xfrm.h> 108 + #include <trace/events/udp.h> 108 109 #include "udp_impl.h" 109 110 110 111 struct udp_table udp_table __read_mostly; ··· 1364 1363 is_udplite); 1365 1364 UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite); 1366 1365 kfree_skb(skb); 1366 + trace_udp_fail_queue_rcv_skb(rc, sk); 1367 1367 return -1; 1368 1368 } 1369 1369