Linux 5.7.7
[linux/fpc-iii.git] / net / batman-adv / trace.h
blobf631b1e01b89172c4030a5de2274d8915af56688
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2010-2020 B.A.T.M.A.N. contributors:
4 * Sven Eckelmann
5 */
7 #if !defined(_NET_BATMAN_ADV_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
8 #define _NET_BATMAN_ADV_TRACE_H_
10 #include "main.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>
20 #undef TRACE_SYSTEM
21 #define TRACE_SYSTEM batadv
23 /* provide dummy function when tracing is disabled */
24 #if !defined(CONFIG_BATMAN_ADV_TRACING)
26 #undef TRACE_EVENT
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),
41 TP_STRUCT__entry(
42 __string(device, bat_priv->soft_iface->name)
43 __string(driver, KBUILD_MODNAME)
44 __dynamic_array(char, msg, BATADV_MAX_MSG_LEN)
47 TP_fast_assign(
48 __assign_str(device, bat_priv->soft_iface->name);
49 __assign_str(driver, KBUILD_MODNAME);
50 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
51 BATADV_MAX_MSG_LEN,
52 vaf->fmt,
53 *vaf->va) >= BATADV_MAX_MSG_LEN);
56 TP_printk(
57 "%s %s %s",
58 __get_str(driver),
59 __get_str(device),
60 __get_str(msg)
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>