xref: /linux/drivers/infiniband/ulp/rtrs/rtrs-srv-trace.h (revision fd7d598270724cc787982ea48bbe17ad383a8b7f)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * RDMA Network Block Driver
4  *
5  * Copyright (c) 2022 1&1 IONOS SE. All rights reserved.
6  */
7 #undef TRACE_SYSTEM
8 #define TRACE_SYSTEM rtrs_srv
9 
10 #if !defined(_TRACE_RTRS_SRV_H) || defined(TRACE_HEADER_MULTI_READ)
11 #define _TRACE_RTRS_SRV_H
12 
13 #include <linux/tracepoint.h>
14 
15 struct rtrs_srv_op;
16 struct rtrs_srv_con;
17 struct rtrs_srv_path;
18 
19 TRACE_DEFINE_ENUM(RTRS_SRV_CONNECTING);
20 TRACE_DEFINE_ENUM(RTRS_SRV_CONNECTED);
21 TRACE_DEFINE_ENUM(RTRS_SRV_CLOSING);
22 TRACE_DEFINE_ENUM(RTRS_SRV_CLOSED);
23 
24 #define show_rtrs_srv_state(x) \
25 	__print_symbolic(x, \
26 		{ RTRS_SRV_CONNECTING,	"CONNECTING" }, \
27 		{ RTRS_SRV_CONNECTED,	"CONNECTED" }, \
28 		{ RTRS_SRV_CLOSING,	"CLOSING" }, \
29 		{ RTRS_SRV_CLOSED,	"CLOSED" })
30 
31 TRACE_EVENT(send_io_resp_imm,
32 	TP_PROTO(struct rtrs_srv_op *id,
33 		 bool need_inval,
34 		 bool always_invalidate,
35 		 int errno),
36 
37 	TP_ARGS(id, need_inval, always_invalidate, errno),
38 
39 	TP_STRUCT__entry(
40 		__field(u8, dir)
41 		__field(bool, need_inval)
42 		__field(bool, always_invalidate)
43 		__field(u32, msg_id)
44 		__field(int, wr_cnt)
45 		__field(u32, signal_interval)
46 		__field(int, state)
47 		__field(int, errno)
48 		__array(char, sessname, NAME_MAX)
49 	),
50 
51 	TP_fast_assign(
52 		struct rtrs_srv_con *con = id->con;
53 		struct rtrs_path *s = con->c.path;
54 		struct rtrs_srv_path *srv_path = to_srv_path(s);
55 
56 		__entry->dir = id->dir;
57 		__entry->state = srv_path->state;
58 		__entry->errno = errno;
59 		__entry->need_inval = need_inval;
60 		__entry->always_invalidate = always_invalidate;
61 		__entry->msg_id = id->msg_id;
62 		__entry->wr_cnt = atomic_read(&con->c.wr_cnt);
63 		__entry->signal_interval = s->signal_interval;
64 		memcpy(__entry->sessname, kobject_name(&srv_path->kobj), NAME_MAX);
65 	),
66 
67 	TP_printk("sess='%s' state='%s' dir=%s err='%d' inval='%d' glob-inval='%d' msgid='%u' wrcnt='%d' sig-interval='%u'",
68 		   __entry->sessname,
69 		   show_rtrs_srv_state(__entry->state),
70 		   __print_symbolic(__entry->dir,
71 			 { READ,  "READ" },
72 			 { WRITE, "WRITE" }),
73 		   __entry->errno,
74 		   __entry->need_inval,
75 		   __entry->always_invalidate,
76 		   __entry->msg_id,
77 		   __entry->wr_cnt,
78 		   __entry->signal_interval
79 	)
80 );
81 
82 #endif /* _TRACE_RTRS_SRV_H */
83 
84 #undef TRACE_INCLUDE_PATH
85 #define TRACE_INCLUDE_PATH .
86 #define TRACE_INCLUDE_FILE rtrs-srv-trace
87 #include <trace/define_trace.h>
88 
89