1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2010-2020 B.A.T.M.A.N. contributors:
7 #if !defined(_NET_BATMAN_ADV_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
8 #define _NET_BATMAN_ADV_TRACE_H_
12 #include <linux/bug.h>
13 #include <linux/kernel.h>
14 #include <linux/netdevice.h>
15 #include <linux/percpu.h>
16 #include <linux/printk.h>
17 #include <linux/tracepoint.h>
18 #include <linux/types.h>
21 #define TRACE_SYSTEM batadv
23 /* provide dummy function when tracing is disabled */
24 #if !defined(CONFIG_BATMAN_ADV_TRACING)
27 #define TRACE_EVENT(name, proto, ...) \
28 static inline void trace_ ## name(proto) {}
30 #endif /* CONFIG_BATMAN_ADV_TRACING */
32 #define BATADV_MAX_MSG_LEN 256
34 TRACE_EVENT(batadv_dbg
,
36 TP_PROTO(struct batadv_priv
*bat_priv
,
37 struct va_format
*vaf
),
39 TP_ARGS(bat_priv
, vaf
),
42 __string(device
, bat_priv
->soft_iface
->name
)
43 __string(driver
, KBUILD_MODNAME
)
44 __dynamic_array(char, msg
, BATADV_MAX_MSG_LEN
)
48 __assign_str(device
, bat_priv
->soft_iface
->name
);
49 __assign_str(driver
, KBUILD_MODNAME
);
50 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
53 *vaf
->va
) >= BATADV_MAX_MSG_LEN
);
64 #endif /* _NET_BATMAN_ADV_TRACE_H_ || TRACE_HEADER_MULTI_READ */
66 #undef TRACE_INCLUDE_PATH
67 #define TRACE_INCLUDE_PATH .
68 #undef TRACE_INCLUDE_FILE
69 #define TRACE_INCLUDE_FILE trace
71 /* This part must be outside protection */
72 #include <trace/define_trace.h>