1 /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
2 /* Copyright 2014-2015 Freescale Semiconductor Inc.
6 #define TRACE_SYSTEM dpaa2_eth
8 #if !defined(_DPAA2_ETH_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
9 #define _DPAA2_ETH_TRACE_H
11 #include <linux/skbuff.h>
12 #include <linux/netdevice.h>
13 #include "dpaa2-eth.h"
14 #include <linux/tracepoint.h>
16 #define TR_FMT "[%s] fd: addr=0x%llx, len=%u, off=%u"
17 /* trace_printk format for raw buffer event class */
18 #define TR_BUF_FMT "[%s] vaddr=%p size=%zu dma_addr=%pad map_size=%zu bpid=%d"
20 /* This is used to declare a class of events.
21 * individual events of this type will be defined below.
24 /* Store details about a frame descriptor */
25 DECLARE_EVENT_CLASS(dpaa2_eth_fd,
26 /* Trace function prototype */
27 TP_PROTO(struct net_device *netdev,
28 const struct dpaa2_fd *fd),
30 /* Repeat argument list here */
33 /* A structure containing the relevant information we want
34 * to record. Declare name and type for each normal element,
35 * name, type and size for arrays. Use __string for variable
41 __field(u16, fd_offset)
42 __string(name, netdev->name)
45 /* The function that assigns values to the above declared
49 __entry->fd_addr = dpaa2_fd_get_addr(fd);
50 __entry->fd_len = dpaa2_fd_get_len(fd);
51 __entry->fd_offset = dpaa2_fd_get_offset(fd);
52 __assign_str(name, netdev->name);
55 /* This is what gets printed when the trace event is
65 /* Now declare events of the above type. Format is:
66 * DEFINE_EVENT(class, name, proto, args), with proto and args same as for class
70 DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_fd,
71 TP_PROTO(struct net_device *netdev,
72 const struct dpaa2_fd *fd),
78 DEFINE_EVENT(dpaa2_eth_fd, dpaa2_rx_fd,
79 TP_PROTO(struct net_device *netdev,
80 const struct dpaa2_fd *fd),
85 /* Tx confirmation fd */
86 DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_conf_fd,
87 TP_PROTO(struct net_device *netdev,
88 const struct dpaa2_fd *fd),
93 /* Log data about raw buffers. Useful for tracing DPBP content. */
94 TRACE_EVENT(dpaa2_eth_buf_seed,
95 /* Trace function prototype */
96 TP_PROTO(struct net_device *netdev,
97 /* virtual address and size */
100 /* dma map address and size */
103 /* buffer pool id, if relevant */
106 /* Repeat argument list here */
107 TP_ARGS(netdev, vaddr, size, dma_addr, map_size, bpid),
109 /* A structure containing the relevant information we want
110 * to record. Declare name and type for each normal element,
111 * name, type and size for arrays. Use __string for variable
115 __field(void *, vaddr)
116 __field(size_t, size)
117 __field(dma_addr_t, dma_addr)
118 __field(size_t, map_size)
120 __string(name, netdev->name)
123 /* The function that assigns values to the above declared
127 __entry->vaddr = vaddr;
128 __entry->size = size;
129 __entry->dma_addr = dma_addr;
130 __entry->map_size = map_size;
131 __entry->bpid = bpid;
132 __assign_str(name, netdev->name);
135 /* This is what gets printed when the trace event is
138 TP_printk(TR_BUF_FMT,
147 /* If only one event of a certain type needs to be declared, use TRACE_EVENT().
148 * The syntax is the same as for DECLARE_EVENT_CLASS().
151 #endif /* _DPAA2_ETH_TRACE_H */
153 /* This must be outside ifdef _DPAA2_ETH_TRACE_H */
154 #undef TRACE_INCLUDE_PATH
155 #define TRACE_INCLUDE_PATH .
156 #undef TRACE_INCLUDE_FILE
157 #define TRACE_INCLUDE_FILE dpaa2-eth-trace
158 #include <trace/define_trace.h>