xref: /openbmc/linux/net/batman-adv/trace.h (revision 7cc39531)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) B.A.T.M.A.N. contributors:
3  *
4  * Sven Eckelmann
5  */
6 
7 #if !defined(_NET_BATMAN_ADV_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
8 #define _NET_BATMAN_ADV_TRACE_H_
9 
10 #include "main.h"
11 
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 
19 #undef TRACE_SYSTEM
20 #define TRACE_SYSTEM batadv
21 
22 /* provide dummy function when tracing is disabled */
23 #if !defined(CONFIG_BATMAN_ADV_TRACING)
24 
25 #undef TRACE_EVENT
26 #define TRACE_EVENT(name, proto, ...) \
27 	static inline void trace_ ## name(proto) {}
28 
29 #endif /* CONFIG_BATMAN_ADV_TRACING */
30 
31 TRACE_EVENT(batadv_dbg,
32 
33 	    TP_PROTO(struct batadv_priv *bat_priv,
34 		     struct va_format *vaf),
35 
36 	    TP_ARGS(bat_priv, vaf),
37 
38 	    TP_STRUCT__entry(
39 		    __string(device, bat_priv->soft_iface->name)
40 		    __string(driver, KBUILD_MODNAME)
41 		    __vstring(msg, vaf->fmt, vaf->va)
42 	    ),
43 
44 	    TP_fast_assign(
45 		    __assign_str(device, bat_priv->soft_iface->name);
46 		    __assign_str(driver, KBUILD_MODNAME);
47 		    __assign_vstr(msg, vaf->fmt, vaf->va);
48 	    ),
49 
50 	    TP_printk(
51 		    "%s %s %s",
52 		    __get_str(driver),
53 		    __get_str(device),
54 		    __get_str(msg)
55 	    )
56 );
57 
58 #endif /* _NET_BATMAN_ADV_TRACE_H_ || TRACE_HEADER_MULTI_READ */
59 
60 #undef TRACE_INCLUDE_PATH
61 #define TRACE_INCLUDE_PATH .
62 #undef TRACE_INCLUDE_FILE
63 #define TRACE_INCLUDE_FILE trace
64 
65 /* This part must be outside protection */
66 #include <trace/define_trace.h>
67