xref: /openbmc/linux/net/batman-adv/trace.h (revision 83b975b5)
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/netdevice.h>
13 #include <linux/percpu.h>
14 #include <linux/printk.h>
15 #include <linux/tracepoint.h>
16 
17 #undef TRACE_SYSTEM
18 #define TRACE_SYSTEM batadv
19 
20 /* provide dummy function when tracing is disabled */
21 #if !defined(CONFIG_BATMAN_ADV_TRACING)
22 
23 #undef TRACE_EVENT
24 #define TRACE_EVENT(name, proto, ...) \
25 	static inline void trace_ ## name(proto) {}
26 
27 #endif /* CONFIG_BATMAN_ADV_TRACING */
28 
29 TRACE_EVENT(batadv_dbg,
30 
31 	    TP_PROTO(struct batadv_priv *bat_priv,
32 		     struct va_format *vaf),
33 
34 	    TP_ARGS(bat_priv, vaf),
35 
36 	    TP_STRUCT__entry(
37 		    __string(device, bat_priv->soft_iface->name)
38 		    __string(driver, KBUILD_MODNAME)
39 		    __vstring(msg, vaf->fmt, vaf->va)
40 	    ),
41 
42 	    TP_fast_assign(
43 		    __assign_str(device, bat_priv->soft_iface->name);
44 		    __assign_str(driver, KBUILD_MODNAME);
45 		    __assign_vstr(msg, vaf->fmt, vaf->va);
46 	    ),
47 
48 	    TP_printk(
49 		    "%s %s %s",
50 		    __get_str(driver),
51 		    __get_str(device),
52 		    __get_str(msg)
53 	    )
54 );
55 
56 #endif /* _NET_BATMAN_ADV_TRACE_H_ || TRACE_HEADER_MULTI_READ */
57 
58 #undef TRACE_INCLUDE_PATH
59 #define TRACE_INCLUDE_PATH .
60 #undef TRACE_INCLUDE_FILE
61 #define TRACE_INCLUDE_FILE trace
62 
63 /* This part must be outside protection */
64 #include <trace/define_trace.h>
65