1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #undef TRACE_SYSTEM 2 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM skb 3 #define TRACE_SYSTEM skb 4 4 5 #if !defined(_TRACE_SKB_H) || defined(TRACE_HE 5 #if !defined(_TRACE_SKB_H) || defined(TRACE_HEADER_MULTI_READ) 6 #define _TRACE_SKB_H 6 #define _TRACE_SKB_H 7 7 8 #include <linux/skbuff.h> 8 #include <linux/skbuff.h> 9 #include <linux/netdevice.h> 9 #include <linux/netdevice.h> 10 #include <linux/tracepoint.h> 10 #include <linux/tracepoint.h> 11 11 12 #undef FN !! 12 #define TRACE_SKB_DROP_REASON \ 13 #define FN(reason) TRACE_DEFINE_ENUM(SKB_ !! 13 EM(SKB_DROP_REASON_NOT_SPECIFIED, NOT_SPECIFIED) \ 14 DEFINE_DROP_REASON(FN, FN) !! 14 EM(SKB_DROP_REASON_NO_SOCKET, NO_SOCKET) \ 15 !! 15 EM(SKB_DROP_REASON_PKT_TOO_SMALL, PKT_TOO_SMALL) \ 16 #undef FN !! 16 EM(SKB_DROP_REASON_TCP_CSUM, TCP_CSUM) \ 17 #undef FNe !! 17 EM(SKB_DROP_REASON_SOCKET_FILTER, SOCKET_FILTER) \ 18 #define FN(reason) { SKB_DROP_REASON_##re !! 18 EM(SKB_DROP_REASON_UDP_CSUM, UDP_CSUM) \ 19 #define FNe(reason) { SKB_DROP_REASON_##re !! 19 EM(SKB_DROP_REASON_NETFILTER_DROP, NETFILTER_DROP) \ >> 20 EM(SKB_DROP_REASON_OTHERHOST, OTHERHOST) \ >> 21 EM(SKB_DROP_REASON_IP_CSUM, IP_CSUM) \ >> 22 EM(SKB_DROP_REASON_IP_INHDR, IP_INHDR) \ >> 23 EM(SKB_DROP_REASON_IP_RPFILTER, IP_RPFILTER) \ >> 24 EM(SKB_DROP_REASON_UNICAST_IN_L2_MULTICAST, \ >> 25 UNICAST_IN_L2_MULTICAST) \ >> 26 EM(SKB_DROP_REASON_XFRM_POLICY, XFRM_POLICY) \ >> 27 EM(SKB_DROP_REASON_IP_NOPROTO, IP_NOPROTO) \ >> 28 EM(SKB_DROP_REASON_SOCKET_RCVBUFF, SOCKET_RCVBUFF) \ >> 29 EM(SKB_DROP_REASON_PROTO_MEM, PROTO_MEM) \ >> 30 EM(SKB_DROP_REASON_TCP_MD5NOTFOUND, TCP_MD5NOTFOUND) \ >> 31 EM(SKB_DROP_REASON_TCP_MD5UNEXPECTED, \ >> 32 TCP_MD5UNEXPECTED) \ >> 33 EM(SKB_DROP_REASON_TCP_MD5FAILURE, TCP_MD5FAILURE) \ >> 34 EM(SKB_DROP_REASON_SOCKET_BACKLOG, SOCKET_BACKLOG) \ >> 35 EM(SKB_DROP_REASON_TCP_FLAGS, TCP_FLAGS) \ >> 36 EM(SKB_DROP_REASON_TCP_ZEROWINDOW, TCP_ZEROWINDOW) \ >> 37 EM(SKB_DROP_REASON_TCP_OLD_DATA, TCP_OLD_DATA) \ >> 38 EM(SKB_DROP_REASON_TCP_OVERWINDOW, TCP_OVERWINDOW) \ >> 39 EM(SKB_DROP_REASON_TCP_OFOMERGE, TCP_OFOMERGE) \ >> 40 EM(SKB_DROP_REASON_IP_OUTNOROUTES, IP_OUTNOROUTES) \ >> 41 EM(SKB_DROP_REASON_BPF_CGROUP_EGRESS, \ >> 42 BPF_CGROUP_EGRESS) \ >> 43 EM(SKB_DROP_REASON_IPV6DISABLED, IPV6DISABLED) \ >> 44 EM(SKB_DROP_REASON_NEIGH_CREATEFAIL, NEIGH_CREATEFAIL) \ >> 45 EM(SKB_DROP_REASON_NEIGH_FAILED, NEIGH_FAILED) \ >> 46 EM(SKB_DROP_REASON_NEIGH_QUEUEFULL, NEIGH_QUEUEFULL) \ >> 47 EM(SKB_DROP_REASON_NEIGH_DEAD, NEIGH_DEAD) \ >> 48 EM(SKB_DROP_REASON_TC_EGRESS, TC_EGRESS) \ >> 49 EM(SKB_DROP_REASON_QDISC_DROP, QDISC_DROP) \ >> 50 EM(SKB_DROP_REASON_CPU_BACKLOG, CPU_BACKLOG) \ >> 51 EM(SKB_DROP_REASON_XDP, XDP) \ >> 52 EM(SKB_DROP_REASON_TC_INGRESS, TC_INGRESS) \ >> 53 EM(SKB_DROP_REASON_PTYPE_ABSENT, PTYPE_ABSENT) \ >> 54 EM(SKB_DROP_REASON_SKB_CSUM, SKB_CSUM) \ >> 55 EM(SKB_DROP_REASON_SKB_GSO_SEG, SKB_GSO_SEG) \ >> 56 EM(SKB_DROP_REASON_SKB_UCOPY_FAULT, SKB_UCOPY_FAULT) \ >> 57 EM(SKB_DROP_REASON_DEV_HDR, DEV_HDR) \ >> 58 EM(SKB_DROP_REASON_DEV_READY, DEV_READY) \ >> 59 EM(SKB_DROP_REASON_FULL_RING, FULL_RING) \ >> 60 EM(SKB_DROP_REASON_NOMEM, NOMEM) \ >> 61 EM(SKB_DROP_REASON_HDR_TRUNC, HDR_TRUNC) \ >> 62 EM(SKB_DROP_REASON_TAP_FILTER, TAP_FILTER) \ >> 63 EM(SKB_DROP_REASON_TAP_TXFILTER, TAP_TXFILTER) \ >> 64 EMe(SKB_DROP_REASON_MAX, MAX) >> 65 >> 66 #undef EM >> 67 #undef EMe >> 68 >> 69 #define EM(a, b) TRACE_DEFINE_ENUM(a); >> 70 #define EMe(a, b) TRACE_DEFINE_ENUM(a); >> 71 >> 72 TRACE_SKB_DROP_REASON >> 73 >> 74 #undef EM >> 75 #undef EMe >> 76 #define EM(a, b) { a, #b }, >> 77 #define EMe(a, b) { a, #b } 20 78 21 /* 79 /* 22 * Tracepoint for free an sk_buff: 80 * Tracepoint for free an sk_buff: 23 */ 81 */ 24 TRACE_EVENT(kfree_skb, 82 TRACE_EVENT(kfree_skb, 25 83 26 TP_PROTO(struct sk_buff *skb, void *lo 84 TP_PROTO(struct sk_buff *skb, void *location, 27 enum skb_drop_reason reason, !! 85 enum skb_drop_reason reason), 28 86 29 TP_ARGS(skb, location, reason, rx_sk), !! 87 TP_ARGS(skb, location, reason), 30 88 31 TP_STRUCT__entry( 89 TP_STRUCT__entry( 32 __field(void *, skbadd 90 __field(void *, skbaddr) 33 __field(void *, locati 91 __field(void *, location) 34 __field(void *, rx_sk) << 35 __field(unsigned short, protoc 92 __field(unsigned short, protocol) 36 __field(enum skb_drop_reason, 93 __field(enum skb_drop_reason, reason) 37 ), 94 ), 38 95 39 TP_fast_assign( 96 TP_fast_assign( 40 __entry->skbaddr = skb; 97 __entry->skbaddr = skb; 41 __entry->location = location; 98 __entry->location = location; 42 __entry->rx_sk = rx_sk; << 43 __entry->protocol = ntohs(skb- 99 __entry->protocol = ntohs(skb->protocol); 44 __entry->reason = reason; 100 __entry->reason = reason; 45 ), 101 ), 46 102 47 TP_printk("skbaddr=%p rx_sk=%p protoco !! 103 TP_printk("skbaddr=%p protocol=%u location=%p reason: %s", 48 __entry->skbaddr, __entry->r !! 104 __entry->skbaddr, __entry->protocol, __entry->location, 49 __entry->location, << 50 __print_symbolic(__entry->re 105 __print_symbolic(__entry->reason, 51 DEFINE_DROP !! 106 TRACE_SKB_DROP_REASON)) 52 ); 107 ); 53 108 54 #undef FN << 55 #undef FNe << 56 << 57 TRACE_EVENT(consume_skb, 109 TRACE_EVENT(consume_skb, 58 110 59 TP_PROTO(struct sk_buff *skb, void *lo !! 111 TP_PROTO(struct sk_buff *skb), 60 112 61 TP_ARGS(skb, location), !! 113 TP_ARGS(skb), 62 114 63 TP_STRUCT__entry( 115 TP_STRUCT__entry( 64 __field( void *, skbadd !! 116 __field( void *, skbaddr ) 65 __field( void *, locati << 66 ), 117 ), 67 118 68 TP_fast_assign( 119 TP_fast_assign( 69 __entry->skbaddr = skb; 120 __entry->skbaddr = skb; 70 __entry->location = location; << 71 ), 121 ), 72 122 73 TP_printk("skbaddr=%p location=%pS", _ !! 123 TP_printk("skbaddr=%p", __entry->skbaddr) 74 ); 124 ); 75 125 76 TRACE_EVENT(skb_copy_datagram_iovec, 126 TRACE_EVENT(skb_copy_datagram_iovec, 77 127 78 TP_PROTO(const struct sk_buff *skb, in 128 TP_PROTO(const struct sk_buff *skb, int len), 79 129 80 TP_ARGS(skb, len), 130 TP_ARGS(skb, len), 81 131 82 TP_STRUCT__entry( 132 TP_STRUCT__entry( 83 __field( const void *, 133 __field( const void *, skbaddr ) 84 __field( int, 134 __field( int, len ) 85 ), 135 ), 86 136 87 TP_fast_assign( 137 TP_fast_assign( 88 __entry->skbaddr = skb; 138 __entry->skbaddr = skb; 89 __entry->len = len; 139 __entry->len = len; 90 ), 140 ), 91 141 92 TP_printk("skbaddr=%p len=%d", __entry 142 TP_printk("skbaddr=%p len=%d", __entry->skbaddr, __entry->len) 93 ); 143 ); 94 144 95 #endif /* _TRACE_SKB_H */ 145 #endif /* _TRACE_SKB_H */ 96 146 97 /* This part must be outside protection */ 147 /* This part must be outside protection */ 98 #include <trace/define_trace.h> 148 #include <trace/define_trace.h> 99 149
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.