blob: a8a64b97504d8a5d0a743a58c4cd5cb2625f0a83 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Li Zefand0b6e042009-07-13 10:33:21 +08002#undef TRACE_SYSTEM
3#define TRACE_SYSTEM skb
4
Steven Rostedtea20d922009-04-10 08:54:16 -04005#if !defined(_TRACE_SKB_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_SKB_H
Neil Horman4893d392009-03-11 09:48:26 +00007
Josh Stone5393f312009-03-24 09:44:28 +00008#include <linux/skbuff.h>
Neil Hormane9b3cc12009-08-13 05:19:44 +00009#include <linux/netdevice.h>
Josh Stone5393f312009-03-24 09:44:28 +000010#include <linux/tracepoint.h>
11
Menglong Dongc504e5c2022-01-09 14:36:26 +080012#define TRACE_SKB_DROP_REASON \
13 EM(SKB_DROP_REASON_NOT_SPECIFIED, NOT_SPECIFIED) \
Menglong Dong85125592022-01-09 14:36:27 +080014 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) \
Menglong Dong364df532022-01-27 17:13:01 +080017 EM(SKB_DROP_REASON_SOCKET_FILTER, SOCKET_FILTER) \
Menglong Dong1c7fab72022-01-09 14:36:28 +080018 EM(SKB_DROP_REASON_UDP_CSUM, UDP_CSUM) \
Menglong Dongc504e5c2022-01-09 14:36:26 +080019 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
27TRACE_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
Steven Rostedtea20d922009-04-10 08:54:16 -040034/*
35 * Tracepoint for free an sk_buff:
36 */
37TRACE_EVENT(kfree_skb,
38
Menglong Dongc504e5c2022-01-09 14:36:26 +080039 TP_PROTO(struct sk_buff *skb, void *location,
40 enum skb_drop_reason reason),
Steven Rostedtea20d922009-04-10 08:54:16 -040041
Menglong Dongc504e5c2022-01-09 14:36:26 +080042 TP_ARGS(skb, location, reason),
Steven Rostedtea20d922009-04-10 08:54:16 -040043
44 TP_STRUCT__entry(
Menglong Dongc504e5c2022-01-09 14:36:26 +080045 __field(void *, skbaddr)
46 __field(void *, location)
47 __field(unsigned short, protocol)
48 __field(enum skb_drop_reason, reason)
Steven Rostedtea20d922009-04-10 08:54:16 -040049 ),
50
51 TP_fast_assign(
52 __entry->skbaddr = skb;
Steven Rostedtea20d922009-04-10 08:54:16 -040053 __entry->location = location;
David Sharpca9da2d2010-12-03 16:13:23 -080054 __entry->protocol = ntohs(skb->protocol);
Menglong Dongc504e5c2022-01-09 14:36:26 +080055 __entry->reason = reason;
Steven Rostedtea20d922009-04-10 08:54:16 -040056 ),
57
Menglong Dongc504e5c2022-01-09 14:36:26 +080058 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))
Steven Rostedtea20d922009-04-10 08:54:16 -040062);
63
Koki Sanagi07dc22e2010-08-23 18:46:12 +090064TRACE_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
Neil Hormane9b3cc12009-08-13 05:19:44 +000081TRACE_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
Steven Rostedtea20d922009-04-10 08:54:16 -0400100#endif /* _TRACE_SKB_H */
Steven Rostedta8d154b2009-04-10 09:36:00 -0400101
102/* This part must be outside protection */
103#include <trace/define_trace.h>