1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #define TRACE_SYSTEM l2tp
5 #if !defined(_TRACE_L2TP_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/tracepoint.h>
9 #include <linux/l2tp.h>
10 #include "l2tp_core.h"
12 #define encap_type_name(e) { L2TP_ENCAPTYPE_##e, #e }
13 #define show_encap_type_name(val) \
14 __print_symbolic(val, \
15 encap_type_name(UDP), \
18 #define pw_type_name(p) { L2TP_PWTYPE_##p, #p }
19 #define show_pw_type_name(val) \
20 __print_symbolic(val, \
21 pw_type_name(ETH_VLAN), \
24 pw_type_name(PPP_AC), \
27 DECLARE_EVENT_CLASS(tunnel_only_evt
,
28 TP_PROTO(struct l2tp_tunnel
*tunnel
),
31 __array(char, name
, L2TP_TUNNEL_NAME_MAX
)
34 memcpy(__entry
->name
, tunnel
->name
, L2TP_TUNNEL_NAME_MAX
);
36 TP_printk("%s", __entry
->name
)
39 DECLARE_EVENT_CLASS(session_only_evt
,
40 TP_PROTO(struct l2tp_session
*session
),
43 __array(char, name
, L2TP_SESSION_NAME_MAX
)
46 memcpy(__entry
->name
, session
->name
, L2TP_SESSION_NAME_MAX
);
48 TP_printk("%s", __entry
->name
)
51 TRACE_EVENT(register_tunnel
,
52 TP_PROTO(struct l2tp_tunnel
*tunnel
),
55 __array(char, name
, L2TP_TUNNEL_NAME_MAX
)
60 __field(enum l2tp_encap_type
, encap
)
63 memcpy(__entry
->name
, tunnel
->name
, L2TP_TUNNEL_NAME_MAX
);
64 __entry
->fd
= tunnel
->fd
;
65 __entry
->tid
= tunnel
->tunnel_id
;
66 __entry
->ptid
= tunnel
->peer_tunnel_id
;
67 __entry
->version
= tunnel
->version
;
68 __entry
->encap
= tunnel
->encap
;
70 TP_printk("%s: type=%s encap=%s version=L2TPv%d tid=%u ptid=%u fd=%d",
72 __entry
->fd
> 0 ? "managed" : "unmanaged",
73 show_encap_type_name(__entry
->encap
),
80 DEFINE_EVENT(tunnel_only_evt
, delete_tunnel
,
81 TP_PROTO(struct l2tp_tunnel
*tunnel
),
85 DEFINE_EVENT(tunnel_only_evt
, free_tunnel
,
86 TP_PROTO(struct l2tp_tunnel
*tunnel
),
90 TRACE_EVENT(register_session
,
91 TP_PROTO(struct l2tp_session
*session
),
94 __array(char, name
, L2TP_SESSION_NAME_MAX
)
99 __field(enum l2tp_pwtype
, pwtype
)
102 memcpy(__entry
->name
, session
->name
, L2TP_SESSION_NAME_MAX
);
103 __entry
->tid
= session
->tunnel
? session
->tunnel
->tunnel_id
: 0;
104 __entry
->ptid
= session
->tunnel
? session
->tunnel
->peer_tunnel_id
: 0;
105 __entry
->sid
= session
->session_id
;
106 __entry
->psid
= session
->peer_session_id
;
107 __entry
->pwtype
= session
->pwtype
;
109 TP_printk("%s: pseudowire=%s sid=%u psid=%u tid=%u ptid=%u",
111 show_pw_type_name(__entry
->pwtype
),
118 DEFINE_EVENT(session_only_evt
, delete_session
,
119 TP_PROTO(struct l2tp_session
*session
),
123 DEFINE_EVENT(session_only_evt
, free_session
,
124 TP_PROTO(struct l2tp_session
*session
),
128 DEFINE_EVENT(session_only_evt
, session_seqnum_lns_enable
,
129 TP_PROTO(struct l2tp_session
*session
),
133 DEFINE_EVENT(session_only_evt
, session_seqnum_lns_disable
,
134 TP_PROTO(struct l2tp_session
*session
),
138 DECLARE_EVENT_CLASS(session_seqnum_evt
,
139 TP_PROTO(struct l2tp_session
*session
),
142 __array(char, name
, L2TP_SESSION_NAME_MAX
)
147 memcpy(__entry
->name
, session
->name
, L2TP_SESSION_NAME_MAX
);
148 __entry
->ns
= session
->ns
;
149 __entry
->nr
= session
->nr
;
151 TP_printk("%s: ns=%u nr=%u",
157 DEFINE_EVENT(session_seqnum_evt
, session_seqnum_update
,
158 TP_PROTO(struct l2tp_session
*session
),
162 DEFINE_EVENT(session_seqnum_evt
, session_seqnum_reset
,
163 TP_PROTO(struct l2tp_session
*session
),
167 DECLARE_EVENT_CLASS(session_pkt_discard_evt
,
168 TP_PROTO(struct l2tp_session
*session
, u32 pkt_ns
),
169 TP_ARGS(session
, pkt_ns
),
171 __array(char, name
, L2TP_SESSION_NAME_MAX
)
174 __field(u32
, reorder_q_len
)
177 memcpy(__entry
->name
, session
->name
, L2TP_SESSION_NAME_MAX
);
178 __entry
->pkt_ns
= pkt_ns
,
179 __entry
->my_nr
= session
->nr
;
180 __entry
->reorder_q_len
= skb_queue_len(&session
->reorder_q
);
182 TP_printk("%s: pkt_ns=%u my_nr=%u reorder_q_len=%u",
186 __entry
->reorder_q_len
)
189 DEFINE_EVENT(session_pkt_discard_evt
, session_pkt_expired
,
190 TP_PROTO(struct l2tp_session
*session
, u32 pkt_ns
),
191 TP_ARGS(session
, pkt_ns
)
194 DEFINE_EVENT(session_pkt_discard_evt
, session_pkt_outside_rx_window
,
195 TP_PROTO(struct l2tp_session
*session
, u32 pkt_ns
),
196 TP_ARGS(session
, pkt_ns
)
199 DEFINE_EVENT(session_pkt_discard_evt
, session_pkt_oos
,
200 TP_PROTO(struct l2tp_session
*session
, u32 pkt_ns
),
201 TP_ARGS(session
, pkt_ns
)
204 #endif /* _TRACE_L2TP_H */
206 /* This part must be outside protection */
207 #undef TRACE_INCLUDE_PATH
208 #define TRACE_INCLUDE_PATH .
209 #undef TRACE_INCLUDE_FILE
210 #define TRACE_INCLUDE_FILE trace
211 #include <trace/define_trace.h>