1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * RDMA Network Block Driver
5 * Copyright (c) 2022 1&1 IONOS SE. All rights reserved.
8 #define TRACE_SYSTEM rnbd_srv
10 #if !defined(_TRACE_RNBD_SRV_H) || defined(TRACE_HEADER_MULTI_READ)
11 #define _TRACE_RNBD_SRV_H
13 #include <linux/tracepoint.h>
15 struct rnbd_srv_session
;
18 DECLARE_EVENT_CLASS(rnbd_srv_link_class
,
19 TP_PROTO(struct rnbd_srv_session
*srv
),
25 __string(sessname
, srv
->sessname
)
29 __entry
->qdepth
= srv
->queue_depth
;
30 __assign_str(sessname
);
33 TP_printk("sessname: %s qdepth: %d",
39 #define DEFINE_LINK_EVENT(name) \
40 DEFINE_EVENT(rnbd_srv_link_class, name, \
41 TP_PROTO(struct rnbd_srv_session *srv), \
44 DEFINE_LINK_EVENT(create_sess
);
45 DEFINE_LINK_EVENT(destroy_sess
);
47 TRACE_DEFINE_ENUM(RNBD_OP_READ
);
48 TRACE_DEFINE_ENUM(RNBD_OP_WRITE
);
49 TRACE_DEFINE_ENUM(RNBD_OP_FLUSH
);
50 TRACE_DEFINE_ENUM(RNBD_OP_DISCARD
);
51 TRACE_DEFINE_ENUM(RNBD_OP_SECURE_ERASE
);
52 TRACE_DEFINE_ENUM(RNBD_F_SYNC
);
53 TRACE_DEFINE_ENUM(RNBD_F_FUA
);
55 #define show_rnbd_rw_flags(x) \
56 __print_flags(x, "|", \
57 { RNBD_OP_READ, "READ" }, \
58 { RNBD_OP_WRITE, "WRITE" }, \
59 { RNBD_OP_FLUSH, "FLUSH" }, \
60 { RNBD_OP_DISCARD, "DISCARD" }, \
61 { RNBD_OP_SECURE_ERASE, "SECURE_ERASE" }, \
62 { RNBD_F_SYNC, "SYNC" }, \
63 { RNBD_F_FUA, "FUA" })
65 TRACE_EVENT(process_rdma
,
66 TP_PROTO(struct rnbd_srv_session
*srv
,
67 const struct rnbd_msg_io
*msg
,
68 struct rtrs_srv_op
*id
,
72 TP_ARGS(srv
, msg
, id
, datalen
, usrlen
),
75 __string(sessname
, srv
->sessname
)
78 __field(u32
, device_id
)
84 __field(size_t, usrlen
)
88 __assign_str(sessname
);
89 __entry
->dir
= id
->dir
;
90 __entry
->ver
= srv
->ver
;
91 __entry
->device_id
= le32_to_cpu(msg
->device_id
);
92 __entry
->sector
= le64_to_cpu(msg
->sector
);
93 __entry
->bi_size
= le32_to_cpu(msg
->bi_size
);
94 __entry
->flags
= le32_to_cpu(msg
->rw
);
95 __entry
->ioprio
= le16_to_cpu(msg
->prio
);
96 __entry
->datalen
= datalen
;
97 __entry
->usrlen
= usrlen
;
100 TP_printk("I/O req: sess: %s, type: %s, ver: %d, devid: %u, sector: %llu, bsize: %u, flags: %s, ioprio: %d, datalen: %u, usrlen: %zu",
102 __print_symbolic(__entry
->dir
,
109 show_rnbd_rw_flags(__entry
->flags
),
116 TRACE_EVENT(process_msg_sess_info
,
117 TP_PROTO(struct rnbd_srv_session
*srv
,
118 const struct rnbd_msg_sess_info
*msg
),
123 __field(u8
, proto_ver
)
126 __string(sessname
, srv
->sessname
)
130 __entry
->proto_ver
= srv
->ver
;
131 __entry
->clt_ver
= msg
->ver
;
132 __entry
->srv_ver
= RNBD_PROTO_VER_MAJOR
;
133 __assign_str(sessname
);
136 TP_printk("Session %s using proto-ver %d (clt-ver: %d, srv-ver: %d)",
144 TRACE_DEFINE_ENUM(RNBD_ACCESS_RO
);
145 TRACE_DEFINE_ENUM(RNBD_ACCESS_RW
);
146 TRACE_DEFINE_ENUM(RNBD_ACCESS_MIGRATION
);
148 #define show_rnbd_access_mode(x) \
149 __print_symbolic(x, \
150 { RNBD_ACCESS_RO, "RO" }, \
151 { RNBD_ACCESS_RW, "RW" }, \
152 { RNBD_ACCESS_MIGRATION, "MIGRATION" })
154 TRACE_EVENT(process_msg_open
,
155 TP_PROTO(struct rnbd_srv_session
*srv
,
156 const struct rnbd_msg_open
*msg
),
161 __field(u8
, access_mode
)
162 __string(sessname
, srv
->sessname
)
163 __string(dev_name
, msg
->dev_name
)
167 __entry
->access_mode
= msg
->access_mode
;
168 __assign_str(sessname
);
169 __assign_str(dev_name
);
172 TP_printk("Open message received: session='%s' path='%s' access_mode=%s",
175 show_rnbd_access_mode(__entry
->access_mode
)
179 TRACE_EVENT(process_msg_close
,
180 TP_PROTO(struct rnbd_srv_session
*srv
,
181 const struct rnbd_msg_close
*msg
),
186 __field(u32
, device_id
)
187 __string(sessname
, srv
->sessname
)
191 __entry
->device_id
= le32_to_cpu(msg
->device_id
);
192 __assign_str(sessname
);
195 TP_printk("Close message received: session='%s' device id='%d'",
201 #endif /* _TRACE_RNBD_SRV_H */
203 #undef TRACE_INCLUDE_PATH
204 #define TRACE_INCLUDE_PATH .
205 #define TRACE_INCLUDE_FILE rnbd-srv-trace
206 #include <trace/define_trace.h>