Commit d7223aa5 authored by David S. Miller's avatar David S. Miller

Merge branch 'l2tp-replace-custom-logging-code-with-tracepoints'

Tom Parkin says:

====================
l2tp: replace custom logging code with tracepoints

The l2tp subsystem implemented custom logging macros for debugging
purposes which were controlled using a set of debugging flags in each
tunnel and session structure.

A more standard and easier-to-use approach is to use tracepoints.

This patchset refactors l2tp to:

 * remove excessive logging
 * tweak useful log messages to use the standard pr_* calls for logging
   rather than the l2tp wrappers
 * replace debug-level logging with tracepoints
 * add tracepoints for capturing tunnel and session lifetime events

I note that checkpatch.pl warns about the layout of code in the
newly-added file net/l2tp/trace.h.  When adding this file I followed the
example(s) of other tracepoint files in the net/ subtree since it seemed
preferable to adhere to the prevailing style rather than follow
checkpatch.pl's advice in this instance.  If that's the wrong
approach please let me know.

v1 -> v2

 * Fix up a build warning found by the kernel test robot
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 1aecbf18 9d048e5e
......@@ -455,31 +455,16 @@ l2tp help`` for more information.
Debugging
---------
The L2TP subsystem offers a debug scheme where kernel trace messages
may be optionally enabled per tunnel and per session. Care is needed
when debugging a live system since the messages are not rate-limited
and a busy system could be swamped. Userspace uses setsockopt on the
PPPoX socket to set a debug mask, or ``L2TP_ATTR_DEBUG`` in netlink
Create and Modify commands.
The L2TP subsystem offers a range of debugging interfaces through the
debugfs filesystem.
The following debug mask bits are defined:-
================ ==============================
L2TP_MSG_DEBUG verbose debug (if compiled in)
L2TP_MSG_CONTROL userspace - kernel interface
L2TP_MSG_SEQ sequence numbers handling
L2TP_MSG_DATA data packets
================ ==============================
Sessions inherit default debug flags from the parent tunnel.
If enabled, files under a l2tp debugfs directory can be used to dump
kernel state about L2TP tunnels and sessions. To access it, the
debugfs filesystem must first be mounted::
To access these interfaces, the debugfs filesystem must first be mounted::
# mount -t debugfs debugfs /debug
Files under the l2tp directory can then be accessed::
Files under the l2tp directory can then be accessed, providing a summary
of the current population of tunnel and session contexts existing in the
kernel::
# cat /debug/l2tp/tunnels
......@@ -488,8 +473,14 @@ state information because the file format is subject to change. It is
implemented to provide extra debug information to help diagnose
problems. Applications should instead use the netlink API.
/proc/net/pppol2tp is also provided for backwards compatibility with
the original pppol2tp code. It lists information about L2TPv2
In addition the L2TP subsystem implements tracepoints using the standard
kernel event tracing API. The available L2TP events can be reviewed as
follows::
# find /debug/tracing/events/l2tp
Finally, /proc/net/pppol2tp is also provided for backwards compatibility
with the original pppol2tp code. It lists information about L2TPv2
tunnels and sessions only. Its use is discouraged.
Internal Implementation
......
......@@ -75,7 +75,7 @@ struct pppol2tpv3in6_addr {
};
/* Socket options:
* DEBUG - bitmask of debug message categories
* DEBUG - bitmask of debug message categories (not used)
* SENDSEQ - 0 => don't send packets with sequence numbers
* 1 => send packets with sequence numbers
* RECVSEQ - 0 => receive packet sequence numbers are optional
......
......@@ -108,7 +108,7 @@ enum {
L2TP_ATTR_VLAN_ID, /* u16 (not used) */
L2TP_ATTR_COOKIE, /* 0, 4 or 8 bytes */
L2TP_ATTR_PEER_COOKIE, /* 0, 4 or 8 bytes */
L2TP_ATTR_DEBUG, /* u32, enum l2tp_debug_flags */
L2TP_ATTR_DEBUG, /* u32, enum l2tp_debug_flags (not used) */
L2TP_ATTR_RECV_SEQ, /* u8 */
L2TP_ATTR_SEND_SEQ, /* u8 */
L2TP_ATTR_LNS_MODE, /* u8 */
......@@ -177,7 +177,9 @@ enum l2tp_seqmode {
};
/**
* enum l2tp_debug_flags - debug message categories for L2TP tunnels/sessions
* enum l2tp_debug_flags - debug message categories for L2TP tunnels/sessions.
*
* Unused.
*
* @L2TP_MSG_DEBUG: verbose debug (if compiled in)
* @L2TP_MSG_CONTROL: userspace - kernel interface
......
......@@ -5,6 +5,8 @@
obj-$(CONFIG_L2TP) += l2tp_core.o
CFLAGS_l2tp_core.o += -I$(src)
# Build l2tp as modules if L2TP is M
obj-$(subst y,$(CONFIG_L2TP),$(CONFIG_PPPOL2TP)) += l2tp_ppp.o
obj-$(subst y,$(CONFIG_L2TP),$(CONFIG_L2TP_IP)) += l2tp_ip.o
......
This diff is collapsed.
......@@ -51,7 +51,6 @@ struct l2tp_session_cfg {
unsigned int lns_mode:1; /* behave as LNS?
* LAC enables sequence numbers under LNS control.
*/
int debug; /* bitmask of debug message categories */
u16 l2specific_type; /* Layer 2 specific type */
u8 cookie[8]; /* optional cookie */
int cookie_len; /* 0, 4 or 8 bytes */
......@@ -66,6 +65,7 @@ struct l2tp_session_cfg {
* Is linked into a per-tunnel session hashlist; and in the case of an L2TPv3 session into
* an additional per-net ("global") hashlist.
*/
#define L2TP_SESSION_NAME_MAX 32
struct l2tp_session {
int magic; /* should be L2TP_SESSION_MAGIC */
long dead;
......@@ -90,14 +90,13 @@ struct l2tp_session {
struct hlist_node hlist; /* hash list node */
refcount_t ref_count;
char name[32]; /* for logging */
char name[L2TP_SESSION_NAME_MAX]; /* for logging */
char ifname[IFNAMSIZ];
unsigned int recv_seq:1; /* expect receive packets with sequence numbers? */
unsigned int send_seq:1; /* send packets with sequence numbers? */
unsigned int lns_mode:1; /* behave as LNS?
* LAC enables sequence numbers under LNS control.
*/
int debug; /* bitmask of debug message categories */
int reorder_timeout; /* configured reorder timeout (in jiffies) */
int reorder_skip; /* set if skip to next nr */
enum l2tp_pwtype pwtype;
......@@ -131,7 +130,6 @@ struct l2tp_session {
/* L2TP tunnel configuration */
struct l2tp_tunnel_cfg {
int debug; /* bitmask of debug message categories */
enum l2tp_encap_type encap;
/* Used only for kernel-created sockets */
......@@ -154,6 +152,7 @@ struct l2tp_tunnel_cfg {
* Maintains a hashlist of sessions belonging to the tunnel instance.
* Is linked into a per-net list of tunnels.
*/
#define L2TP_TUNNEL_NAME_MAX 20
struct l2tp_tunnel {
int magic; /* Should be L2TP_TUNNEL_MAGIC */
......@@ -170,8 +169,7 @@ struct l2tp_tunnel {
u32 peer_tunnel_id;
int version; /* 2=>L2TPv2, 3=>L2TPv3 */
char name[20]; /* for logging */
int debug; /* bitmask of debug message categories */
char name[L2TP_TUNNEL_NAME_MAX]; /* for logging */
enum l2tp_encap_type encap;
struct l2tp_stats stats;
......@@ -337,19 +335,6 @@ static inline int l2tp_v3_ensure_opt_in_linear(struct l2tp_session *session, str
return 0;
}
#define l2tp_printk(ptr, type, func, fmt, ...) \
do { \
if (((ptr)->debug) & (type)) \
func(fmt, ##__VA_ARGS__); \
} while (0)
#define l2tp_warn(ptr, type, fmt, ...) \
l2tp_printk(ptr, type, pr_warn, fmt, ##__VA_ARGS__)
#define l2tp_info(ptr, type, fmt, ...) \
l2tp_printk(ptr, type, pr_info, fmt, ##__VA_ARGS__)
#define l2tp_dbg(ptr, type, fmt, ...) \
l2tp_printk(ptr, type, pr_debug, fmt, ##__VA_ARGS__)
#define MODULE_ALIAS_L2TP_PWTYPE(type) \
MODULE_ALIAS("net-l2tp-type-" __stringify(type))
......
......@@ -167,7 +167,7 @@ static void l2tp_dfs_seq_tunnel_show(struct seq_file *m, void *v)
tunnel->sock ? refcount_read(&tunnel->sock->sk_refcnt) : 0,
refcount_read(&tunnel->ref_count));
seq_printf(m, " %08x rx %ld/%ld/%ld rx %ld/%ld/%ld\n",
tunnel->debug,
0,
atomic_long_read(&tunnel->stats.tx_packets),
atomic_long_read(&tunnel->stats.tx_bytes),
atomic_long_read(&tunnel->stats.tx_errors),
......@@ -192,7 +192,7 @@ static void l2tp_dfs_seq_session_show(struct seq_file *m, void *v)
session->recv_seq ? 'R' : '-',
session->send_seq ? 'S' : '-',
session->lns_mode ? "LNS" : "LAC",
session->debug,
0,
jiffies_to_msecs(session->reorder_timeout));
seq_printf(m, " offset 0 l2specific %hu/%hu\n",
session->l2specific_type, l2tp_get_l2specific_len(session));
......
......@@ -128,17 +128,6 @@ static void l2tp_eth_dev_recv(struct l2tp_session *session, struct sk_buff *skb,
struct net_device *dev;
struct l2tp_eth *priv;
if (session->debug & L2TP_MSG_DATA) {
unsigned int length;
length = min(32u, skb->len);
if (!pskb_may_pull(skb, length))
goto error;
pr_debug("%s: eth recv\n", session->name);
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, skb->data, length);
}
if (!pskb_may_pull(skb, ETH_HLEN))
goto error;
......
......@@ -118,7 +118,6 @@ static int l2tp_ip_recv(struct sk_buff *skb)
struct l2tp_session *session;
struct l2tp_tunnel *tunnel = NULL;
struct iphdr *iph;
int length;
if (!pskb_may_pull(skb, 4))
goto discard;
......@@ -147,20 +146,6 @@ static int l2tp_ip_recv(struct sk_buff *skb)
if (!tunnel)
goto discard_sess;
/* Trace packet contents, if enabled */
if (tunnel->debug & L2TP_MSG_DATA) {
length = min(32u, skb->len);
if (!pskb_may_pull(skb, length))
goto discard_sess;
/* Point to L2TP header */
optr = skb->data;
ptr = skb->data;
ptr += 4;
pr_debug("%s: ip recv\n", tunnel->name);
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, ptr, length);
}
if (l2tp_v3_ensure_opt_in_linear(session, skb, &ptr, &optr))
goto discard_sess;
......
......@@ -131,7 +131,6 @@ static int l2tp_ip6_recv(struct sk_buff *skb)
struct l2tp_session *session;
struct l2tp_tunnel *tunnel = NULL;
struct ipv6hdr *iph;
int length;
if (!pskb_may_pull(skb, 4))
goto discard;
......@@ -160,20 +159,6 @@ static int l2tp_ip6_recv(struct sk_buff *skb)
if (!tunnel)
goto discard_sess;
/* Trace packet contents, if enabled */
if (tunnel->debug & L2TP_MSG_DATA) {
length = min(32u, skb->len);
if (!pskb_may_pull(skb, length))
goto discard_sess;
/* Point to L2TP header */
optr = skb->data;
ptr = skb->data;
ptr += 4;
pr_debug("%s: ip recv\n", tunnel->name);
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, ptr, length);
}
if (l2tp_v3_ensure_opt_in_linear(session, skb, &ptr, &optr))
goto discard_sess;
......
......@@ -229,9 +229,6 @@ static int l2tp_nl_cmd_tunnel_create(struct sk_buff *skb, struct genl_info *info
goto out;
}
if (attrs[L2TP_ATTR_DEBUG])
cfg.debug = nla_get_u32(attrs[L2TP_ATTR_DEBUG]);
ret = -EINVAL;
switch (cfg.encap) {
case L2TP_ENCAPTYPE_UDP:
......@@ -307,9 +304,6 @@ static int l2tp_nl_cmd_tunnel_modify(struct sk_buff *skb, struct genl_info *info
goto out;
}
if (info->attrs[L2TP_ATTR_DEBUG])
tunnel->debug = nla_get_u32(info->attrs[L2TP_ATTR_DEBUG]);
ret = l2tp_tunnel_notify(&l2tp_nl_family, info,
tunnel, L2TP_CMD_TUNNEL_MODIFY);
......@@ -400,7 +394,7 @@ static int l2tp_nl_tunnel_send(struct sk_buff *skb, u32 portid, u32 seq, int fla
if (nla_put_u8(skb, L2TP_ATTR_PROTO_VERSION, tunnel->version) ||
nla_put_u32(skb, L2TP_ATTR_CONN_ID, tunnel->tunnel_id) ||
nla_put_u32(skb, L2TP_ATTR_PEER_CONN_ID, tunnel->peer_tunnel_id) ||
nla_put_u32(skb, L2TP_ATTR_DEBUG, tunnel->debug) ||
nla_put_u32(skb, L2TP_ATTR_DEBUG, 0) ||
nla_put_u16(skb, L2TP_ATTR_ENCAP_TYPE, tunnel->encap))
goto nla_put_failure;
......@@ -605,9 +599,6 @@ static int l2tp_nl_cmd_session_create(struct sk_buff *skb, struct genl_info *inf
cfg.ifname = nla_data(info->attrs[L2TP_ATTR_IFNAME]);
}
if (info->attrs[L2TP_ATTR_DEBUG])
cfg.debug = nla_get_u32(info->attrs[L2TP_ATTR_DEBUG]);
if (info->attrs[L2TP_ATTR_RECV_SEQ])
cfg.recv_seq = nla_get_u8(info->attrs[L2TP_ATTR_RECV_SEQ]);
......@@ -689,9 +680,6 @@ static int l2tp_nl_cmd_session_modify(struct sk_buff *skb, struct genl_info *inf
goto out;
}
if (info->attrs[L2TP_ATTR_DEBUG])
session->debug = nla_get_u32(info->attrs[L2TP_ATTR_DEBUG]);
if (info->attrs[L2TP_ATTR_RECV_SEQ])
session->recv_seq = nla_get_u8(info->attrs[L2TP_ATTR_RECV_SEQ]);
......@@ -730,7 +718,7 @@ static int l2tp_nl_session_send(struct sk_buff *skb, u32 portid, u32 seq, int fl
nla_put_u32(skb, L2TP_ATTR_SESSION_ID, session->session_id) ||
nla_put_u32(skb, L2TP_ATTR_PEER_CONN_ID, tunnel->peer_tunnel_id) ||
nla_put_u32(skb, L2TP_ATTR_PEER_SESSION_ID, session->peer_session_id) ||
nla_put_u32(skb, L2TP_ATTR_DEBUG, session->debug) ||
nla_put_u32(skb, L2TP_ATTR_DEBUG, 0) ||
nla_put_u16(skb, L2TP_ATTR_PW_TYPE, session->pwtype))
goto nla_put_failure;
......
......@@ -237,17 +237,9 @@ static void pppol2tp_recv(struct l2tp_session *session, struct sk_buff *skb, int
if (sk->sk_state & PPPOX_BOUND) {
struct pppox_sock *po;
l2tp_dbg(session, L2TP_MSG_DATA,
"%s: recv %d byte data frame, passing to ppp\n",
session->name, data_len);
po = pppox_sk(sk);
ppp_input(&po->chan, skb);
} else {
l2tp_dbg(session, L2TP_MSG_DATA,
"%s: recv %d byte data frame, passing to L2TP socket\n",
session->name, data_len);
if (sock_queue_rcv_skb(sk, skb) < 0) {
atomic_long_inc(&session->stats.rx_errors);
kfree_skb(skb);
......@@ -259,7 +251,7 @@ static void pppol2tp_recv(struct l2tp_session *session, struct sk_buff *skb, int
no_sock:
rcu_read_unlock();
l2tp_info(session, L2TP_MSG_DATA, "%s: no socket\n", session->name);
pr_warn_ratelimited("%s: no socket in recv\n", session->name);
kfree_skb(skb);
}
......@@ -710,7 +702,6 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
if (!tunnel) {
struct l2tp_tunnel_cfg tcfg = {
.encap = L2TP_ENCAPTYPE_UDP,
.debug = 0,
};
/* Prevent l2tp_tunnel_register() from trying to set up
......@@ -840,8 +831,6 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
drop_refcnt = false;
sk->sk_state = PPPOX_CONNECTED;
l2tp_info(session, L2TP_MSG_CONTROL, "%s: created\n",
session->name);
end:
if (error) {
......@@ -1157,9 +1146,7 @@ static int pppol2tp_tunnel_setsockopt(struct sock *sk,
switch (optname) {
case PPPOL2TP_SO_DEBUG:
tunnel->debug = val;
l2tp_info(tunnel, L2TP_MSG_CONTROL, "%s: set debug=%x\n",
tunnel->name, tunnel->debug);
/* Tunnel debug flags option is deprecated */
break;
default:
......@@ -1185,9 +1172,6 @@ static int pppol2tp_session_setsockopt(struct sock *sk,
break;
}
session->recv_seq = !!val;
l2tp_info(session, L2TP_MSG_CONTROL,
"%s: set recv_seq=%d\n",
session->name, session->recv_seq);
break;
case PPPOL2TP_SO_SENDSEQ:
......@@ -1203,9 +1187,6 @@ static int pppol2tp_session_setsockopt(struct sock *sk,
PPPOL2TP_L2TP_HDR_SIZE_NOSEQ;
}
l2tp_session_set_header_len(session, session->tunnel->version);
l2tp_info(session, L2TP_MSG_CONTROL,
"%s: set send_seq=%d\n",
session->name, session->send_seq);
break;
case PPPOL2TP_SO_LNSMODE:
......@@ -1214,22 +1195,14 @@ static int pppol2tp_session_setsockopt(struct sock *sk,
break;
}
session->lns_mode = !!val;
l2tp_info(session, L2TP_MSG_CONTROL,
"%s: set lns_mode=%d\n",
session->name, session->lns_mode);
break;
case PPPOL2TP_SO_DEBUG:
session->debug = val;
l2tp_info(session, L2TP_MSG_CONTROL, "%s: set debug=%x\n",
session->name, session->debug);
/* Session debug flags option is deprecated */
break;
case PPPOL2TP_SO_REORDERTO:
session->reorder_timeout = msecs_to_jiffies(val);
l2tp_info(session, L2TP_MSG_CONTROL,
"%s: set reorder_timeout=%d\n",
session->name, session->reorder_timeout);
break;
default:
......@@ -1297,9 +1270,8 @@ static int pppol2tp_tunnel_getsockopt(struct sock *sk,
switch (optname) {
case PPPOL2TP_SO_DEBUG:
*val = tunnel->debug;
l2tp_info(tunnel, L2TP_MSG_CONTROL, "%s: get debug=%x\n",
tunnel->name, tunnel->debug);
/* Tunnel debug flags option is deprecated */
*val = 0;
break;
default:
......@@ -1321,32 +1293,23 @@ static int pppol2tp_session_getsockopt(struct sock *sk,
switch (optname) {
case PPPOL2TP_SO_RECVSEQ:
*val = session->recv_seq;
l2tp_info(session, L2TP_MSG_CONTROL,
"%s: get recv_seq=%d\n", session->name, *val);
break;
case PPPOL2TP_SO_SENDSEQ:
*val = session->send_seq;
l2tp_info(session, L2TP_MSG_CONTROL,
"%s: get send_seq=%d\n", session->name, *val);
break;
case PPPOL2TP_SO_LNSMODE:
*val = session->lns_mode;
l2tp_info(session, L2TP_MSG_CONTROL,
"%s: get lns_mode=%d\n", session->name, *val);
break;
case PPPOL2TP_SO_DEBUG:
*val = session->debug;
l2tp_info(session, L2TP_MSG_CONTROL, "%s: get debug=%d\n",
session->name, *val);
/* Session debug flags option is deprecated */
*val = 0;
break;
case PPPOL2TP_SO_REORDERTO:
*val = (int)jiffies_to_msecs(session->reorder_timeout);
l2tp_info(session, L2TP_MSG_CONTROL,
"%s: get reorder_timeout=%d\n", session->name, *val);
break;
default:
......@@ -1534,7 +1497,7 @@ static void pppol2tp_seq_tunnel_show(struct seq_file *m, void *v)
(tunnel == tunnel->sock->sk_user_data) ? 'Y' : 'N',
refcount_read(&tunnel->ref_count) - 1);
seq_printf(m, " %08x %ld/%ld/%ld %ld/%ld/%ld\n",
tunnel->debug,
0,
atomic_long_read(&tunnel->stats.tx_packets),
atomic_long_read(&tunnel->stats.tx_bytes),
atomic_long_read(&tunnel->stats.tx_errors),
......@@ -1580,7 +1543,7 @@ static void pppol2tp_seq_session_show(struct seq_file *m, void *v)
session->recv_seq ? 'R' : '-',
session->send_seq ? 'S' : '-',
session->lns_mode ? "LNS" : "LAC",
session->debug,
0,
jiffies_to_msecs(session->reorder_timeout));
seq_printf(m, " %hu/%hu %ld/%ld/%ld %ld/%ld/%ld\n",
session->nr, session->ns,
......
/* 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>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment