xref: /openbmc/linux/include/trace/events/nbd.h (revision c39f2d9db0fd81ea20bb5cce9b3f082ca63753e2)
1ea106722SMatt Mullins /* SPDX-License-Identifier: GPL-2.0 */
2ea106722SMatt Mullins #undef TRACE_SYSTEM
3ea106722SMatt Mullins #define TRACE_SYSTEM nbd
4ea106722SMatt Mullins 
5ea106722SMatt Mullins #if !defined(_TRACE_NBD_H) || defined(TRACE_HEADER_MULTI_READ)
6ea106722SMatt Mullins #define _TRACE_NBD_H
7ea106722SMatt Mullins 
8ea106722SMatt Mullins #include <linux/tracepoint.h>
9ea106722SMatt Mullins 
10*2abd2de7SAndrew Hall DECLARE_EVENT_CLASS(nbd_transport_event,
11*2abd2de7SAndrew Hall 
12*2abd2de7SAndrew Hall 	TP_PROTO(struct request *req, u64 handle),
13*2abd2de7SAndrew Hall 
14*2abd2de7SAndrew Hall 	TP_ARGS(req, handle),
15*2abd2de7SAndrew Hall 
16*2abd2de7SAndrew Hall 	TP_STRUCT__entry(
17*2abd2de7SAndrew Hall 		__field(struct request *, req)
18*2abd2de7SAndrew Hall 		__field(u64, handle)
19*2abd2de7SAndrew Hall 	),
20*2abd2de7SAndrew Hall 
21*2abd2de7SAndrew Hall 	TP_fast_assign(
22*2abd2de7SAndrew Hall 		__entry->req = req;
23*2abd2de7SAndrew Hall 		__entry->handle = handle;
24*2abd2de7SAndrew Hall 	),
25*2abd2de7SAndrew Hall 
26*2abd2de7SAndrew Hall 	TP_printk(
27*2abd2de7SAndrew Hall 		"nbd transport event: request %p, handle 0x%016llx",
28*2abd2de7SAndrew Hall 		__entry->req,
29*2abd2de7SAndrew Hall 		__entry->handle
30*2abd2de7SAndrew Hall 	)
31*2abd2de7SAndrew Hall );
32*2abd2de7SAndrew Hall 
33*2abd2de7SAndrew Hall DEFINE_EVENT(nbd_transport_event, nbd_header_sent,
34*2abd2de7SAndrew Hall 
35*2abd2de7SAndrew Hall 	TP_PROTO(struct request *req, u64 handle),
36*2abd2de7SAndrew Hall 
37*2abd2de7SAndrew Hall 	TP_ARGS(req, handle)
38*2abd2de7SAndrew Hall );
39*2abd2de7SAndrew Hall 
40*2abd2de7SAndrew Hall DEFINE_EVENT(nbd_transport_event, nbd_payload_sent,
41*2abd2de7SAndrew Hall 
42*2abd2de7SAndrew Hall 	TP_PROTO(struct request *req, u64 handle),
43*2abd2de7SAndrew Hall 
44*2abd2de7SAndrew Hall 	TP_ARGS(req, handle)
45*2abd2de7SAndrew Hall );
46*2abd2de7SAndrew Hall 
47*2abd2de7SAndrew Hall DEFINE_EVENT(nbd_transport_event, nbd_header_received,
48*2abd2de7SAndrew Hall 
49*2abd2de7SAndrew Hall 	TP_PROTO(struct request *req, u64 handle),
50*2abd2de7SAndrew Hall 
51*2abd2de7SAndrew Hall 	TP_ARGS(req, handle)
52*2abd2de7SAndrew Hall );
53*2abd2de7SAndrew Hall 
54*2abd2de7SAndrew Hall DEFINE_EVENT(nbd_transport_event, nbd_payload_received,
55*2abd2de7SAndrew Hall 
56*2abd2de7SAndrew Hall 	TP_PROTO(struct request *req, u64 handle),
57*2abd2de7SAndrew Hall 
58*2abd2de7SAndrew Hall 	TP_ARGS(req, handle)
59*2abd2de7SAndrew Hall );
60*2abd2de7SAndrew Hall 
61ea106722SMatt Mullins DECLARE_EVENT_CLASS(nbd_send_request,
62ea106722SMatt Mullins 
63ea106722SMatt Mullins 	TP_PROTO(struct nbd_request *nbd_request, int index,
64ea106722SMatt Mullins 		 struct request *rq),
65ea106722SMatt Mullins 
66ea106722SMatt Mullins 	TP_ARGS(nbd_request, index, rq),
67ea106722SMatt Mullins 
68ea106722SMatt Mullins 	TP_STRUCT__entry(
69ea106722SMatt Mullins 		__field(struct nbd_request *, nbd_request)
70ea106722SMatt Mullins 		__field(u64, dev_index)
71ea106722SMatt Mullins 		__field(struct request *, request)
72ea106722SMatt Mullins 	),
73ea106722SMatt Mullins 
74ea106722SMatt Mullins 	TP_fast_assign(
75ea106722SMatt Mullins 		__entry->nbd_request = 0;
76ea106722SMatt Mullins 		__entry->dev_index = index;
77ea106722SMatt Mullins 		__entry->request = rq;
78ea106722SMatt Mullins 	),
79ea106722SMatt Mullins 
80ea106722SMatt Mullins 	TP_printk("nbd%lld: request %p", __entry->dev_index, __entry->request)
81ea106722SMatt Mullins );
82ea106722SMatt Mullins 
83ea106722SMatt Mullins #ifdef DEFINE_EVENT_WRITABLE
84ea106722SMatt Mullins #undef NBD_DEFINE_EVENT
85ea106722SMatt Mullins #define NBD_DEFINE_EVENT(template, call, proto, args, size)		\
86ea106722SMatt Mullins 	DEFINE_EVENT_WRITABLE(template, call, PARAMS(proto),		\
87ea106722SMatt Mullins 			      PARAMS(args), size)
88ea106722SMatt Mullins #else
89ea106722SMatt Mullins #undef NBD_DEFINE_EVENT
90ea106722SMatt Mullins #define NBD_DEFINE_EVENT(template, call, proto, args, size)		\
91ea106722SMatt Mullins 	DEFINE_EVENT(template, call, PARAMS(proto), PARAMS(args))
92ea106722SMatt Mullins #endif
93ea106722SMatt Mullins 
94ea106722SMatt Mullins NBD_DEFINE_EVENT(nbd_send_request, nbd_send_request,
95ea106722SMatt Mullins 
96ea106722SMatt Mullins 	TP_PROTO(struct nbd_request *nbd_request, int index,
97ea106722SMatt Mullins 		 struct request *rq),
98ea106722SMatt Mullins 
99ea106722SMatt Mullins 	TP_ARGS(nbd_request, index, rq),
100ea106722SMatt Mullins 
101ea106722SMatt Mullins 	sizeof(struct nbd_request)
102ea106722SMatt Mullins );
103ea106722SMatt Mullins 
104ea106722SMatt Mullins #endif
105ea106722SMatt Mullins 
106ea106722SMatt Mullins /* This part must be outside protection */
107ea106722SMatt Mullins #include <trace/define_trace.h>
108