blob: 09f1df228f2ce8ce060817b2f80d3a21391371a5 [file] [log] [blame]
Jiri Pirkoe5224f02016-07-12 18:05:03 +02001#if IS_ENABLED(CONFIG_NET_DEVLINK)
2
3#undef TRACE_SYSTEM
4#define TRACE_SYSTEM devlink
5
6#if !defined(_TRACE_DEVLINK_H) || defined(TRACE_HEADER_MULTI_READ)
7#define _TRACE_DEVLINK_H
8
9#include <linux/device.h>
10#include <net/devlink.h>
11#include <linux/tracepoint.h>
12
13/*
14 * Tracepoint for devlink hardware message:
15 */
16TRACE_EVENT(devlink_hwmsg,
17 TP_PROTO(const struct devlink *devlink, bool incoming,
18 unsigned long type, const u8 *buf, size_t len),
19
20 TP_ARGS(devlink, incoming, type, buf, len),
21
22 TP_STRUCT__entry(
23 __string(bus_name, devlink->dev->bus->name)
24 __string(dev_name, dev_name(devlink->dev))
Jiri Pirko0e1824c2016-07-14 11:37:28 +020025 __string(driver_name, devlink->dev->driver->name)
Jiri Pirkoe5224f02016-07-12 18:05:03 +020026 __field(bool, incoming)
27 __field(unsigned long, type)
28 __dynamic_array(u8, buf, len)
29 __field(size_t, len)
30 ),
31
32 TP_fast_assign(
33 __assign_str(bus_name, devlink->dev->bus->name);
34 __assign_str(dev_name, dev_name(devlink->dev));
Jiri Pirko0e1824c2016-07-14 11:37:28 +020035 __assign_str(driver_name, devlink->dev->driver->name);
Jiri Pirkoe5224f02016-07-12 18:05:03 +020036 __entry->incoming = incoming;
37 __entry->type = type;
38 memcpy(__get_dynamic_array(buf), buf, len);
39 __entry->len = len;
40 ),
41
Arnd Bergmanncaeccd52016-07-14 11:37:29 +020042 TP_printk("bus_name=%s dev_name=%s driver_name=%s incoming=%d type=%lu buf=0x[%*phD] len=%zu",
Jiri Pirkoe5224f02016-07-12 18:05:03 +020043 __get_str(bus_name), __get_str(dev_name),
Jiri Pirko0e1824c2016-07-14 11:37:28 +020044 __get_str(driver_name), __entry->incoming, __entry->type,
Jiri Pirkoe5224f02016-07-12 18:05:03 +020045 (int) __entry->len, __get_dynamic_array(buf), __entry->len)
46);
47
48#endif /* _TRACE_DEVLINK_H */
49
50/* This part must be outside protection */
51#include <trace/define_trace.h>
52
53#else /* CONFIG_NET_DEVLINK */
54
55#if !defined(_TRACE_DEVLINK_H)
56#define _TRACE_DEVLINK_H
57
58#include <net/devlink.h>
59
60static inline void trace_devlink_hwmsg(const struct devlink *devlink,
61 bool incoming, unsigned long type,
62 const u8 *buf, size_t len)
63{
64}
65
66#endif /* _TRACE_DEVLINK_H */
67
68#endif