Mention branches and keyring.
[releases.git] / rtrs / rtrs-clt-trace.h
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_clt
9
10 #if !defined(_TRACE_RTRS_CLT_H) || defined(TRACE_HEADER_MULTI_READ)
11 #define _TRACE_RTRS_CLT_H
12
13 #include <linux/tracepoint.h>
14
15 struct rtrs_clt_path;
16 struct rtrs_clt_sess;
17
18 TRACE_DEFINE_ENUM(RTRS_CLT_CONNECTING);
19 TRACE_DEFINE_ENUM(RTRS_CLT_CONNECTING_ERR);
20 TRACE_DEFINE_ENUM(RTRS_CLT_RECONNECTING);
21 TRACE_DEFINE_ENUM(RTRS_CLT_CONNECTED);
22 TRACE_DEFINE_ENUM(RTRS_CLT_CLOSING);
23 TRACE_DEFINE_ENUM(RTRS_CLT_CLOSED);
24 TRACE_DEFINE_ENUM(RTRS_CLT_DEAD);
25
26 #define show_rtrs_clt_state(x) \
27         __print_symbolic(x, \
28                 { RTRS_CLT_CONNECTING,          "CONNECTING" }, \
29                 { RTRS_CLT_CONNECTING_ERR,      "CONNECTING_ERR" }, \
30                 { RTRS_CLT_RECONNECTING,        "RECONNECTING" }, \
31                 { RTRS_CLT_CONNECTED,           "CONNECTED" }, \
32                 { RTRS_CLT_CLOSING,             "CLOSING" }, \
33                 { RTRS_CLT_CLOSED,              "CLOSED" }, \
34                 { RTRS_CLT_DEAD,                "DEAD" })
35
36 DECLARE_EVENT_CLASS(rtrs_clt_conn_class,
37         TP_PROTO(struct rtrs_clt_path *clt_path),
38
39         TP_ARGS(clt_path),
40
41         TP_STRUCT__entry(
42                 __field(int, state)
43                 __field(int, reconnect_attempts)
44                 __field(int, max_reconnect_attempts)
45                 __field(int, fail_cnt)
46                 __field(int, success_cnt)
47                 __array(char, sessname, NAME_MAX)
48         ),
49
50         TP_fast_assign(
51                 struct rtrs_clt_sess *clt = clt_path->clt;
52
53                 __entry->state = clt_path->state;
54                 __entry->reconnect_attempts = clt_path->reconnect_attempts;
55                 __entry->max_reconnect_attempts = clt->max_reconnect_attempts;
56                 __entry->fail_cnt = clt_path->stats->reconnects.fail_cnt;
57                 __entry->success_cnt = clt_path->stats->reconnects.successful_cnt;
58                 memcpy(__entry->sessname, kobject_name(&clt_path->kobj), NAME_MAX);
59         ),
60
61         TP_printk("RTRS-CLT: sess='%s' state=%s attempts='%d' max-attempts='%d' fail='%d' success='%d'",
62                    __entry->sessname,
63                    show_rtrs_clt_state(__entry->state),
64                    __entry->reconnect_attempts,
65                    __entry->max_reconnect_attempts,
66                    __entry->fail_cnt,
67                    __entry->success_cnt
68         )
69 );
70
71 #define DEFINE_CLT_CONN_EVENT(name) \
72 DEFINE_EVENT(rtrs_clt_conn_class, rtrs_##name, \
73         TP_PROTO(struct rtrs_clt_path *clt_path), \
74         TP_ARGS(clt_path))
75
76 DEFINE_CLT_CONN_EVENT(clt_reconnect_work);
77 DEFINE_CLT_CONN_EVENT(clt_close_conns);
78 DEFINE_CLT_CONN_EVENT(rdma_error_recovery);
79
80 #endif /* _TRACE_RTRS_CLT_H */
81
82 #undef TRACE_INCLUDE_PATH
83 #define TRACE_INCLUDE_PATH .
84 #define TRACE_INCLUDE_FILE rtrs-clt-trace
85 #include <trace/define_trace.h>
86