1 #if IS_ENABLED(CONFIG_NET_DEVLINK)
4 #define TRACE_SYSTEM devlink
6 #if !defined(_TRACE_DEVLINK_H) || defined(TRACE_HEADER_MULTI_READ)
7 #define _TRACE_DEVLINK_H
9 #include <linux/device.h>
10 #include <net/devlink.h>
11 #include <linux/tracepoint.h>
14 * Tracepoint for devlink hardware message:
16 TRACE_EVENT(devlink_hwmsg
,
17 TP_PROTO(const struct devlink
*devlink
, bool incoming
,
18 unsigned long type
, const u8
*buf
, size_t len
),
20 TP_ARGS(devlink
, incoming
, type
, buf
, len
),
23 __string(bus_name
, devlink
->dev
->bus
->name
)
24 __string(dev_name
, dev_name(devlink
->dev
))
25 __string(driver_name
, devlink
->dev
->driver
->name
)
26 __field(bool, incoming
)
27 __field(unsigned long, type
)
28 __dynamic_array(u8
, buf
, len
)
33 __assign_str(bus_name
, devlink
->dev
->bus
->name
);
34 __assign_str(dev_name
, dev_name(devlink
->dev
));
35 __assign_str(driver_name
, devlink
->dev
->driver
->name
);
36 __entry
->incoming
= incoming
;
38 memcpy(__get_dynamic_array(buf
), buf
, len
);
42 TP_printk("bus_name=%s dev_name=%s driver_name=%s incoming=%d type=%lu buf=0x[%*phD] len=%zu",
43 __get_str(bus_name
), __get_str(dev_name
),
44 __get_str(driver_name
), __entry
->incoming
, __entry
->type
,
45 (int) __entry
->len
, __get_dynamic_array(buf
), __entry
->len
)
48 #endif /* _TRACE_DEVLINK_H */
50 /* This part must be outside protection */
51 #include <trace/define_trace.h>
53 #else /* CONFIG_NET_DEVLINK */
55 #if !defined(_TRACE_DEVLINK_H)
56 #define _TRACE_DEVLINK_H
58 #include <net/devlink.h>
60 static inline void trace_devlink_hwmsg(const struct devlink
*devlink
,
61 bool incoming
, unsigned long type
,
62 const u8
*buf
, size_t len
)
66 #endif /* _TRACE_DEVLINK_H */