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>
20 #define TRACE_SYSTEM batadv
22 /* provide dummy function when tracing is disabled */
23 #if !defined(CONFIG_BATMAN_ADV_TRACING)
26 #define TRACE_EVENT(name, proto, ...) \
27 static inline void trace_ ## name(proto) {}
29 #endif /* CONFIG_BATMAN_ADV_TRACING */
31 #define BATADV_MAX_MSG_LEN 256
33 TRACE_EVENT(batadv_dbg
,
35 TP_PROTO(struct batadv_priv
*bat_priv
,
36 struct va_format
*vaf
),
38 TP_ARGS(bat_priv
, vaf
),
41 __string(device
, bat_priv
->soft_iface
->name
)
42 __string(driver
, KBUILD_MODNAME
)
43 __dynamic_array(char, msg
, BATADV_MAX_MSG_LEN
)
47 __assign_str(device
, bat_priv
->soft_iface
->name
);
48 __assign_str(driver
, KBUILD_MODNAME
);
49 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg
),
52 *vaf
->va
) >= BATADV_MAX_MSG_LEN
);
63 #endif /* _NET_BATMAN_ADV_TRACE_H_ || TRACE_HEADER_MULTI_READ */
65 #undef TRACE_INCLUDE_PATH
66 #define TRACE_INCLUDE_PATH .
67 #undef TRACE_INCLUDE_FILE
68 #define TRACE_INCLUDE_FILE trace
70 /* This part must be outside protection */
71 #include <trace/define_trace.h>