1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
|
/* SPDX-License-Identifier: GPL-2.0-only */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM l2tp
#if !defined(_TRACE_L2TP_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_L2TP_H
#include <linux/tracepoint.h>
#include <linux/l2tp.h>
#include "l2tp_core.h"
#define encap_type_name(e) { L2TP_ENCAPTYPE_##e, #e }
#define show_encap_type_name(val) \
__print_symbolic(val, \
encap_type_name(UDP), \
encap_type_name(IP))
#define pw_type_name(p) { L2TP_PWTYPE_##p, #p }
#define show_pw_type_name(val) \
__print_symbolic(val, \
pw_type_name(ETH_VLAN), \
pw_type_name(ETH), \
pw_type_name(PPP), \
pw_type_name(PPP_AC), \
pw_type_name(IP))
DECLARE_EVENT_CLASS(tunnel_only_evt,
TP_PROTO(struct l2tp_tunnel *tunnel),
TP_ARGS(tunnel),
TP_STRUCT__entry(
__array(char, name, L2TP_TUNNEL_NAME_MAX)
),
TP_fast_assign(
memcpy(__entry->name, tunnel->name, L2TP_TUNNEL_NAME_MAX);
),
TP_printk("%s", __entry->name)
);
DECLARE_EVENT_CLASS(session_only_evt,
TP_PROTO(struct l2tp_session *session),
TP_ARGS(session),
TP_STRUCT__entry(
__array(char, name, L2TP_SESSION_NAME_MAX)
),
TP_fast_assign(
memcpy(__entry->name, session->name, L2TP_SESSION_NAME_MAX);
),
TP_printk("%s", __entry->name)
);
TRACE_EVENT(register_tunnel,
TP_PROTO(struct l2tp_tunnel *tunnel),
TP_ARGS(tunnel),
TP_STRUCT__entry(
__array(char, name, L2TP_TUNNEL_NAME_MAX)
__field(int, fd)
__field(u32, tid)
__field(u32, ptid)
__field(int, version)
__field(enum l2tp_encap_type, encap)
),
TP_fast_assign(
memcpy(__entry->name, tunnel->name, L2TP_TUNNEL_NAME_MAX);
__entry->fd = tunnel->fd;
__entry->tid = tunnel->tunnel_id;
__entry->ptid = tunnel->peer_tunnel_id;
__entry->version = tunnel->version;
__entry->encap = tunnel->encap;
),
TP_printk("%s: type=%s encap=%s version=L2TPv%d tid=%u ptid=%u fd=%d",
__entry->name,
__entry->fd > 0 ? "managed" : "unmanaged",
show_encap_type_name(__entry->encap),
__entry->version,
__entry->tid,
__entry->ptid,
__entry->fd)
);
DEFINE_EVENT(tunnel_only_evt, delete_tunnel,
TP_PROTO(struct l2tp_tunnel *tunnel),
TP_ARGS(tunnel)
);
DEFINE_EVENT(tunnel_only_evt, free_tunnel,
TP_PROTO(struct l2tp_tunnel *tunnel),
TP_ARGS(tunnel)
);
TRACE_EVENT(register_session,
TP_PROTO(struct l2tp_session *session),
TP_ARGS(session),
TP_STRUCT__entry(
__array(char, name, L2TP_SESSION_NAME_MAX)
__field(u32, tid)
__field(u32, ptid)
__field(u32, sid)
__field(u32, psid)
__field(enum l2tp_pwtype, pwtype)
),
TP_fast_assign(
memcpy(__entry->name, session->name, L2TP_SESSION_NAME_MAX);
__entry->tid = session->tunnel ? session->tunnel->tunnel_id : 0;
__entry->ptid = session->tunnel ? session->tunnel->peer_tunnel_id : 0;
__entry->sid = session->session_id;
__entry->psid = session->peer_session_id;
__entry->pwtype = session->pwtype;
),
TP_printk("%s: pseudowire=%s sid=%u psid=%u tid=%u ptid=%u",
__entry->name,
show_pw_type_name(__entry->pwtype),
__entry->sid,
__entry->psid,
__entry->sid,
__entry->psid)
);
DEFINE_EVENT(session_only_evt, delete_session,
TP_PROTO(struct l2tp_session *session),
TP_ARGS(session)
);
DEFINE_EVENT(session_only_evt, free_session,
TP_PROTO(struct l2tp_session *session),
TP_ARGS(session)
);
DEFINE_EVENT(session_only_evt, session_seqnum_lns_enable,
TP_PROTO(struct l2tp_session *session),
TP_ARGS(session)
);
DEFINE_EVENT(session_only_evt, session_seqnum_lns_disable,
TP_PROTO(struct l2tp_session *session),
TP_ARGS(session)
);
DECLARE_EVENT_CLASS(session_seqnum_evt,
TP_PROTO(struct l2tp_session *session),
TP_ARGS(session),
TP_STRUCT__entry(
__array(char, name, L2TP_SESSION_NAME_MAX)
__field(u32, ns)
__field(u32, nr)
),
TP_fast_assign(
memcpy(__entry->name, session->name, L2TP_SESSION_NAME_MAX);
__entry->ns = session->ns;
__entry->nr = session->nr;
),
TP_printk("%s: ns=%u nr=%u",
__entry->name,
__entry->ns,
__entry->nr)
);
DEFINE_EVENT(session_seqnum_evt, session_seqnum_update,
TP_PROTO(struct l2tp_session *session),
TP_ARGS(session)
);
DEFINE_EVENT(session_seqnum_evt, session_seqnum_reset,
TP_PROTO(struct l2tp_session *session),
TP_ARGS(session)
);
DECLARE_EVENT_CLASS(session_pkt_discard_evt,
TP_PROTO(struct l2tp_session *session, u32 pkt_ns),
TP_ARGS(session, pkt_ns),
TP_STRUCT__entry(
__array(char, name, L2TP_SESSION_NAME_MAX)
__field(u32, pkt_ns)
__field(u32, my_nr)
__field(u32, reorder_q_len)
),
TP_fast_assign(
memcpy(__entry->name, session->name, L2TP_SESSION_NAME_MAX);
__entry->pkt_ns = pkt_ns,
__entry->my_nr = session->nr;
__entry->reorder_q_len = skb_queue_len(&session->reorder_q);
),
TP_printk("%s: pkt_ns=%u my_nr=%u reorder_q_len=%u",
__entry->name,
__entry->pkt_ns,
__entry->my_nr,
__entry->reorder_q_len)
);
DEFINE_EVENT(session_pkt_discard_evt, session_pkt_expired,
TP_PROTO(struct l2tp_session *session, u32 pkt_ns),
TP_ARGS(session, pkt_ns)
);
DEFINE_EVENT(session_pkt_discard_evt, session_pkt_outside_rx_window,
TP_PROTO(struct l2tp_session *session, u32 pkt_ns),
TP_ARGS(session, pkt_ns)
);
DEFINE_EVENT(session_pkt_discard_evt, session_pkt_oos,
TP_PROTO(struct l2tp_session *session, u32 pkt_ns),
TP_ARGS(session, pkt_ns)
);
#endif /* _TRACE_L2TP_H */
/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH .
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE trace
#include <trace/define_trace.h>
|