1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
3 * Copyright 2013-2015 Freescale Semiconductor Inc.
7 #define TRACE_SYSTEM dpaa_eth
9 #if !defined(_DPAA_ETH_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
10 #define _DPAA_ETH_TRACE_H
12 #include <linux/skbuff.h>
13 #include <linux/netdevice.h>
15 #include <linux/tracepoint.h>
17 #define fd_format_name(format) { qm_fd_##format, #format }
18 #define fd_format_list \
19 fd_format_name(contig), \
22 /* This is used to declare a class of events.
23 * individual events of this type will be defined below.
26 /* Store details about a frame descriptor and the FQ on which it was
27 * transmitted/received.
29 DECLARE_EVENT_CLASS(dpaa_eth_fd,
30 /* Trace function prototype */
31 TP_PROTO(struct net_device *netdev,
33 const struct qm_fd *fd),
35 /* Repeat argument list here */
36 TP_ARGS(netdev, fq, fd),
38 /* A structure containing the relevant information we want to record.
39 * Declare name and type for each normal element, name, type and size
40 * for arrays. Use __string for variable length strings.
45 __field(u8, fd_format)
46 __field(u16, fd_offset)
47 __field(u32, fd_length)
48 __field(u32, fd_status)
49 __string(name, netdev->name)
52 /* The function that assigns values to the above declared fields */
54 __entry->fqid = fq->fqid;
55 __entry->fd_addr = qm_fd_addr_get64(fd);
56 __entry->fd_format = qm_fd_get_format(fd);
57 __entry->fd_offset = qm_fd_get_offset(fd);
58 __entry->fd_length = qm_fd_get_length(fd);
59 __entry->fd_status = __be32_to_cpu(fd->status);
63 /* This is what gets printed when the trace event is triggered */
64 TP_printk("[%s] fqid=%d, fd: addr=0x%llx, format=%s, off=%u, len=%u, status=0x%08x",
65 __get_str(name), __entry->fqid, __entry->fd_addr,
66 __print_symbolic(__entry->fd_format, fd_format_list),
67 __entry->fd_offset, __entry->fd_length, __entry->fd_status)
70 /* Now declare events of the above type. Format is:
71 * DEFINE_EVENT(class, name, proto, args), with proto and args same as for class
75 DEFINE_EVENT(dpaa_eth_fd, dpaa_tx_fd,
77 TP_PROTO(struct net_device *netdev,
79 const struct qm_fd *fd),
81 TP_ARGS(netdev, fq, fd)
85 DEFINE_EVENT(dpaa_eth_fd, dpaa_rx_fd,
87 TP_PROTO(struct net_device *netdev,
89 const struct qm_fd *fd),
91 TP_ARGS(netdev, fq, fd)
94 /* Tx confirmation fd */
95 DEFINE_EVENT(dpaa_eth_fd, dpaa_tx_conf_fd,
97 TP_PROTO(struct net_device *netdev,
99 const struct qm_fd *fd),
101 TP_ARGS(netdev, fq, fd)
104 /* If only one event of a certain type needs to be declared, use TRACE_EVENT().
105 * The syntax is the same as for DECLARE_EVENT_CLASS().
108 #endif /* _DPAA_ETH_TRACE_H */
110 /* This must be outside ifdef _DPAA_ETH_TRACE_H */
111 #undef TRACE_INCLUDE_PATH
112 #define TRACE_INCLUDE_PATH .
113 #undef TRACE_INCLUDE_FILE
114 #define TRACE_INCLUDE_FILE dpaa_eth_trace
115 #include <trace/define_trace.h>