1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM skb 4 5 #if !defined(_TRACE_SKB_H) || defined(TRACE_HEADER_MULTI_READ) 6 #define _TRACE_SKB_H 7 8 #include <linux/skbuff.h> 9 #include <linux/netdevice.h> 10 #include <linux/tracepoint.h> 11 12 #define TRACE_SKB_DROP_REASON \ 13 EM(SKB_DROP_REASON_NOT_SPECIFIED, NOT_SPECIFIED) \ 14 EM(SKB_DROP_REASON_NO_SOCKET, NO_SOCKET) \ 15 EM(SKB_DROP_REASON_PKT_TOO_SMALL, PKT_TOO_SMALL) \ 16 EM(SKB_DROP_REASON_TCP_CSUM, TCP_CSUM) \ 17 EM(SKB_DROP_REASON_TCP_FILTER, TCP_FILTER) \ 18 EM(SKB_DROP_REASON_UDP_CSUM, UDP_CSUM) \ 19 EMe(SKB_DROP_REASON_MAX, MAX) 20 21 #undef EM 22 #undef EMe 23 24 #define EM(a, b) TRACE_DEFINE_ENUM(a); 25 #define EMe(a, b) TRACE_DEFINE_ENUM(a); 26 27 TRACE_SKB_DROP_REASON 28 29 #undef EM 30 #undef EMe 31 #define EM(a, b) { a, #b }, 32 #define EMe(a, b) { a, #b } 33 34 /* 35 * Tracepoint for free an sk_buff: 36 */ 37 TRACE_EVENT(kfree_skb, 38 39 TP_PROTO(struct sk_buff *skb, void *location, 40 enum skb_drop_reason reason), 41 42 TP_ARGS(skb, location, reason), 43 44 TP_STRUCT__entry( 45 __field(void *, skbaddr) 46 __field(void *, location) 47 __field(unsigned short, protocol) 48 __field(enum skb_drop_reason, reason) 49 ), 50 51 TP_fast_assign( 52 __entry->skbaddr = skb; 53 __entry->location = location; 54 __entry->protocol = ntohs(skb->protocol); 55 __entry->reason = reason; 56 ), 57 58 TP_printk("skbaddr=%p protocol=%u location=%p reason: %s", 59 __entry->skbaddr, __entry->protocol, __entry->location, 60 __print_symbolic(__entry->reason, 61 TRACE_SKB_DROP_REASON)) 62 ); 63 64 TRACE_EVENT(consume_skb, 65 66 TP_PROTO(struct sk_buff *skb), 67 68 TP_ARGS(skb), 69 70 TP_STRUCT__entry( 71 __field( void *, skbaddr ) 72 ), 73 74 TP_fast_assign( 75 __entry->skbaddr = skb; 76 ), 77 78 TP_printk("skbaddr=%p", __entry->skbaddr) 79 ); 80 81 TRACE_EVENT(skb_copy_datagram_iovec, 82 83 TP_PROTO(const struct sk_buff *skb, int len), 84 85 TP_ARGS(skb, len), 86 87 TP_STRUCT__entry( 88 __field( const void *, skbaddr ) 89 __field( int, len ) 90 ), 91 92 TP_fast_assign( 93 __entry->skbaddr = skb; 94 __entry->len = len; 95 ), 96 97 TP_printk("skbaddr=%p len=%d", __entry->skbaddr, __entry->len) 98 ); 99 100 #endif /* _TRACE_SKB_H */ 101 102 /* This part must be outside protection */ 103 #include <trace/define_trace.h> 104