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