xref: /openbmc/linux/include/trace/events/handshake.h (revision 726ccdba)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM handshake
4 
5 #if !defined(_TRACE_HANDSHAKE_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_HANDSHAKE_H
7 
8 #include <linux/net.h>
9 #include <linux/tracepoint.h>
10 
11 DECLARE_EVENT_CLASS(handshake_event_class,
12 	TP_PROTO(
13 		const struct net *net,
14 		const struct handshake_req *req,
15 		const struct sock *sk
16 	),
17 	TP_ARGS(net, req, sk),
18 	TP_STRUCT__entry(
19 		__field(const void *, req)
20 		__field(const void *, sk)
21 		__field(unsigned int, netns_ino)
22 	),
23 	TP_fast_assign(
24 		__entry->req = req;
25 		__entry->sk = sk;
26 		__entry->netns_ino = net->ns.inum;
27 	),
28 	TP_printk("req=%p sk=%p",
29 		__entry->req, __entry->sk
30 	)
31 );
32 #define DEFINE_HANDSHAKE_EVENT(name)				\
33 	DEFINE_EVENT(handshake_event_class, name,		\
34 		TP_PROTO(					\
35 			const struct net *net,			\
36 			const struct handshake_req *req,	\
37 			const struct sock *sk			\
38 		),						\
39 		TP_ARGS(net, req, sk))
40 
41 DECLARE_EVENT_CLASS(handshake_fd_class,
42 	TP_PROTO(
43 		const struct net *net,
44 		const struct handshake_req *req,
45 		const struct sock *sk,
46 		int fd
47 	),
48 	TP_ARGS(net, req, sk, fd),
49 	TP_STRUCT__entry(
50 		__field(const void *, req)
51 		__field(const void *, sk)
52 		__field(int, fd)
53 		__field(unsigned int, netns_ino)
54 	),
55 	TP_fast_assign(
56 		__entry->req = req;
57 		__entry->sk = req->hr_sk;
58 		__entry->fd = fd;
59 		__entry->netns_ino = net->ns.inum;
60 	),
61 	TP_printk("req=%p sk=%p fd=%d",
62 		__entry->req, __entry->sk, __entry->fd
63 	)
64 );
65 #define DEFINE_HANDSHAKE_FD_EVENT(name)				\
66 	DEFINE_EVENT(handshake_fd_class, name,			\
67 		TP_PROTO(					\
68 			const struct net *net,			\
69 			const struct handshake_req *req,	\
70 			const struct sock *sk,			\
71 			int fd					\
72 		),						\
73 		TP_ARGS(net, req, sk, fd))
74 
75 DECLARE_EVENT_CLASS(handshake_error_class,
76 	TP_PROTO(
77 		const struct net *net,
78 		const struct handshake_req *req,
79 		const struct sock *sk,
80 		int err
81 	),
82 	TP_ARGS(net, req, sk, err),
83 	TP_STRUCT__entry(
84 		__field(const void *, req)
85 		__field(const void *, sk)
86 		__field(int, err)
87 		__field(unsigned int, netns_ino)
88 	),
89 	TP_fast_assign(
90 		__entry->req = req;
91 		__entry->sk = sk;
92 		__entry->err = err;
93 		__entry->netns_ino = net->ns.inum;
94 	),
95 	TP_printk("req=%p sk=%p err=%d",
96 		__entry->req, __entry->sk, __entry->err
97 	)
98 );
99 #define DEFINE_HANDSHAKE_ERROR(name)				\
100 	DEFINE_EVENT(handshake_error_class, name,		\
101 		TP_PROTO(					\
102 			const struct net *net,			\
103 			const struct handshake_req *req,	\
104 			const struct sock *sk,			\
105 			int err					\
106 		),						\
107 		TP_ARGS(net, req, sk, err))
108 
109 
110 /*
111  * Request lifetime events
112  */
113 
114 DEFINE_HANDSHAKE_EVENT(handshake_submit);
115 DEFINE_HANDSHAKE_ERROR(handshake_submit_err);
116 DEFINE_HANDSHAKE_EVENT(handshake_cancel);
117 DEFINE_HANDSHAKE_EVENT(handshake_cancel_none);
118 DEFINE_HANDSHAKE_EVENT(handshake_cancel_busy);
119 DEFINE_HANDSHAKE_EVENT(handshake_destruct);
120 
121 
122 TRACE_EVENT(handshake_complete,
123 	TP_PROTO(
124 		const struct net *net,
125 		const struct handshake_req *req,
126 		const struct sock *sk,
127 		int status
128 	),
129 	TP_ARGS(net, req, sk, status),
130 	TP_STRUCT__entry(
131 		__field(const void *, req)
132 		__field(const void *, sk)
133 		__field(int, status)
134 		__field(unsigned int, netns_ino)
135 	),
136 	TP_fast_assign(
137 		__entry->req = req;
138 		__entry->sk = sk;
139 		__entry->status = status;
140 		__entry->netns_ino = net->ns.inum;
141 	),
142 	TP_printk("req=%p sk=%p status=%d",
143 		__entry->req, __entry->sk, __entry->status
144 	)
145 );
146 
147 /*
148  * Netlink events
149  */
150 
151 DEFINE_HANDSHAKE_ERROR(handshake_notify_err);
152 DEFINE_HANDSHAKE_FD_EVENT(handshake_cmd_accept);
153 DEFINE_HANDSHAKE_ERROR(handshake_cmd_accept_err);
154 DEFINE_HANDSHAKE_FD_EVENT(handshake_cmd_done);
155 DEFINE_HANDSHAKE_ERROR(handshake_cmd_done_err);
156 
157 #endif /* _TRACE_HANDSHAKE_H */
158 
159 #include <trace/define_trace.h>
160