blob: 44acfbca12661d817a26ed6b2955ccdbbc60a9bf [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Jiri Pirkoe5224f02016-07-12 18:05:03 +02002#if IS_ENABLED(CONFIG_NET_DEVLINK)
3
4#undef TRACE_SYSTEM
5#define TRACE_SYSTEM devlink
6
7#if !defined(_TRACE_DEVLINK_H) || defined(TRACE_HEADER_MULTI_READ)
8#define _TRACE_DEVLINK_H
9
10#include <linux/device.h>
11#include <net/devlink.h>
12#include <linux/tracepoint.h>
13
14/*
15 * Tracepoint for devlink hardware message:
16 */
17TRACE_EVENT(devlink_hwmsg,
18 TP_PROTO(const struct devlink *devlink, bool incoming,
19 unsigned long type, const u8 *buf, size_t len),
20
21 TP_ARGS(devlink, incoming, type, buf, len),
22
23 TP_STRUCT__entry(
24 __string(bus_name, devlink->dev->bus->name)
25 __string(dev_name, dev_name(devlink->dev))
Jiri Pirko0e1824c2016-07-14 11:37:28 +020026 __string(driver_name, devlink->dev->driver->name)
Jiri Pirkoe5224f02016-07-12 18:05:03 +020027 __field(bool, incoming)
28 __field(unsigned long, type)
29 __dynamic_array(u8, buf, len)
30 __field(size_t, len)
31 ),
32
33 TP_fast_assign(
34 __assign_str(bus_name, devlink->dev->bus->name);
35 __assign_str(dev_name, dev_name(devlink->dev));
Jiri Pirko0e1824c2016-07-14 11:37:28 +020036 __assign_str(driver_name, devlink->dev->driver->name);
Jiri Pirkoe5224f02016-07-12 18:05:03 +020037 __entry->incoming = incoming;
38 __entry->type = type;
39 memcpy(__get_dynamic_array(buf), buf, len);
40 __entry->len = len;
41 ),
42
Arnd Bergmanncaeccd52016-07-14 11:37:29 +020043 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 +020044 __get_str(bus_name), __get_str(dev_name),
Jiri Pirko0e1824c2016-07-14 11:37:28 +020045 __get_str(driver_name), __entry->incoming, __entry->type,
Jiri Pirkoe5224f02016-07-12 18:05:03 +020046 (int) __entry->len, __get_dynamic_array(buf), __entry->len)
47);
48
49#endif /* _TRACE_DEVLINK_H */
50
51/* This part must be outside protection */
52#include <trace/define_trace.h>
53
54#else /* CONFIG_NET_DEVLINK */
55
56#if !defined(_TRACE_DEVLINK_H)
57#define _TRACE_DEVLINK_H
58
59#include <net/devlink.h>
60
61static inline void trace_devlink_hwmsg(const struct devlink *devlink,
62 bool incoming, unsigned long type,
63 const u8 *buf, size_t len)
64{
65}
66
67#endif /* _TRACE_DEVLINK_H */
68
69#endif