blob: 3acda26a30caaaa425720a1169b1d775081f3590 [file] [log] [blame]
Sven Eckelmannd331a732018-08-10 23:36:16 +02001/* SPDX-License-Identifier: GPL-2.0 */
2/* Copyright (C) 2010-2018 B.A.T.M.A.N. contributors:
3 *
4 * Sven Eckelmann
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of version 2 of the GNU General Public
8 * License as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#if !defined(_NET_BATMAN_ADV_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
20#define _NET_BATMAN_ADV_TRACE_H_
21
22#include "main.h"
23
24#include <linux/tracepoint.h>
25
26#undef TRACE_SYSTEM
27#define TRACE_SYSTEM batadv
28
29/* provide dummy function when tracing is disabled */
30#if !defined(CONFIG_BATMAN_ADV_TRACING)
31
32#undef TRACE_EVENT
33#define TRACE_EVENT(name, proto, ...) \
34 static inline void trace_ ## name(proto) {}
35
36#endif /* CONFIG_BATMAN_ADV_TRACING */
37
38#define BATADV_MAX_MSG_LEN 256
39
40TRACE_EVENT(batadv_dbg,
41
42 TP_PROTO(struct batadv_priv *bat_priv,
43 struct va_format *vaf),
44
45 TP_ARGS(bat_priv, vaf),
46
47 TP_STRUCT__entry(
48 __string(device, bat_priv->soft_iface->name)
49 __string(driver, KBUILD_MODNAME)
50 __dynamic_array(char, msg, BATADV_MAX_MSG_LEN)
51 ),
52
53 TP_fast_assign(
54 __assign_str(device, bat_priv->soft_iface->name);
55 __assign_str(driver, KBUILD_MODNAME);
56 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
57 BATADV_MAX_MSG_LEN,
58 vaf->fmt,
59 *vaf->va) >= BATADV_MAX_MSG_LEN);
60 ),
61
62 TP_printk(
63 "%s %s %s",
64 __get_str(driver),
65 __get_str(device),
66 __get_str(msg)
67 )
68);
69
70#endif /* _NET_BATMAN_ADV_TRACE_H_ || TRACE_HEADER_MULTI_READ */
71
72#undef TRACE_INCLUDE_PATH
73#define TRACE_INCLUDE_PATH .
74#undef TRACE_INCLUDE_FILE
75#define TRACE_INCLUDE_FILE trace
76
77/* This part must be outside protection */
78#include <trace/define_trace.h>