1 /* SPDX-License-Identifier: GPL-2.0 */
2 #if IS_ENABLED(CONFIG_NET_DEVLINK)
5 #define TRACE_SYSTEM devlink
7 #if !defined(_TRACE_DEVLINK_H) || defined(TRACE_HEADER_MULTI_READ)
8 #define _TRACE_DEVLINK_H
10 #include <linux/device.h>
11 #include <net/devlink.h>
12 #include <linux/tracepoint.h>
15 * Tracepoint for devlink hardware message:
17 TRACE_EVENT(devlink_hwmsg
,
18 TP_PROTO(const struct devlink
*devlink
, bool incoming
,
19 unsigned long type
, const u8
*buf
, size_t len
),
21 TP_ARGS(devlink
, incoming
, type
, buf
, len
),
24 __string(bus_name
, devlink
->dev
->bus
->name
)
25 __string(dev_name
, dev_name(devlink
->dev
))
26 __string(driver_name
, devlink
->dev
->driver
->name
)
27 __field(bool, incoming
)
28 __field(unsigned long, type
)
29 __dynamic_array(u8
, buf
, len
)
34 __assign_str(bus_name
, devlink
->dev
->bus
->name
);
35 __assign_str(dev_name
, dev_name(devlink
->dev
));
36 __assign_str(driver_name
, devlink
->dev
->driver
->name
);
37 __entry
->incoming
= incoming
;
39 memcpy(__get_dynamic_array(buf
), buf
, len
);
43 TP_printk("bus_name=%s dev_name=%s driver_name=%s incoming=%d type=%lu buf=0x[%*phD] len=%zu",
44 __get_str(bus_name
), __get_str(dev_name
),
45 __get_str(driver_name
), __entry
->incoming
, __entry
->type
,
46 (int) __entry
->len
, __get_dynamic_array(buf
), __entry
->len
)
49 #endif /* _TRACE_DEVLINK_H */
51 /* This part must be outside protection */
52 #include <trace/define_trace.h>
54 #else /* CONFIG_NET_DEVLINK */
56 #if !defined(_TRACE_DEVLINK_H)
57 #define _TRACE_DEVLINK_H
59 #include <net/devlink.h>
61 static inline void trace_devlink_hwmsg(const struct devlink
*devlink
,
62 bool incoming
, unsigned long type
,
63 const u8
*buf
, size_t len
)
67 #endif /* _TRACE_DEVLINK_H */