Jiri Pirko | e5224f0 | 2016-07-12 18:05:03 +0200 | [diff] [blame] | 1 | #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 | */ |
| 16 | TRACE_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 Pirko | 0e1824c | 2016-07-14 11:37:28 +0200 | [diff] [blame] | 25 | __string(driver_name, devlink->dev->driver->name) |
Jiri Pirko | e5224f0 | 2016-07-12 18:05:03 +0200 | [diff] [blame] | 26 | __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 Pirko | 0e1824c | 2016-07-14 11:37:28 +0200 | [diff] [blame] | 35 | __assign_str(driver_name, devlink->dev->driver->name); |
Jiri Pirko | e5224f0 | 2016-07-12 18:05:03 +0200 | [diff] [blame] | 36 | __entry->incoming = incoming; |
| 37 | __entry->type = type; |
| 38 | memcpy(__get_dynamic_array(buf), buf, len); |
| 39 | __entry->len = len; |
| 40 | ), |
| 41 | |
Arnd Bergmann | caeccd5 | 2016-07-14 11:37:29 +0200 | [diff] [blame] | 42 | TP_printk("bus_name=%s dev_name=%s driver_name=%s incoming=%d type=%lu buf=0x[%*phD] len=%zu", |
Jiri Pirko | e5224f0 | 2016-07-12 18:05:03 +0200 | [diff] [blame] | 43 | __get_str(bus_name), __get_str(dev_name), |
Jiri Pirko | 0e1824c | 2016-07-14 11:37:28 +0200 | [diff] [blame] | 44 | __get_str(driver_name), __entry->incoming, __entry->type, |
Jiri Pirko | e5224f0 | 2016-07-12 18:05:03 +0200 | [diff] [blame] | 45 | (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 | |
| 60 | static 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 |