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 <linux/tracepoint.h>
15 #define TR_FMT "[%s] fd: addr=0x%llx, len=%u, off=%u"
16 /* trace_printk format for raw buffer event class */
17 #define TR_BUF_FMT "[%s] vaddr=%p size=%zu dma_addr=%pad map_size=%zu bpid=%d"
19 /* This is used to declare a class of events.
20 * individual events of this type will be defined below.
23 /* Store details about a frame descriptor */
24 DECLARE_EVENT_CLASS(dpaa2_eth_fd,
25 /* Trace function prototype */
26 TP_PROTO(struct net_device *netdev,
27 const struct dpaa2_fd *fd),
29 /* Repeat argument list here */
32 /* A structure containing the relevant information we want
33 * to record. Declare name and type for each normal element,
34 * name, type and size for arrays. Use __string for variable
40 __field(u16, fd_offset)
41 __string(name, netdev->name)
44 /* The function that assigns values to the above declared
48 __entry->fd_addr = dpaa2_fd_get_addr(fd);
49 __entry->fd_len = dpaa2_fd_get_len(fd);
50 __entry->fd_offset = dpaa2_fd_get_offset(fd);
51 __assign_str(name, netdev->name);
54 /* This is what gets printed when the trace event is
64 /* Now declare events of the above type. Format is:
65 * DEFINE_EVENT(class, name, proto, args), with proto and args same as for class
69 DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_fd,
70 TP_PROTO(struct net_device *netdev,
71 const struct dpaa2_fd *fd),
76 /* Tx (egress) XSK fd */
77 DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_xsk_fd,
78 TP_PROTO(struct net_device *netdev,
79 const struct dpaa2_fd *fd),
85 DEFINE_EVENT(dpaa2_eth_fd, dpaa2_rx_fd,
86 TP_PROTO(struct net_device *netdev,
87 const struct dpaa2_fd *fd),
93 DEFINE_EVENT(dpaa2_eth_fd, dpaa2_rx_xsk_fd,
94 TP_PROTO(struct net_device *netdev,
95 const struct dpaa2_fd *fd),
100 /* Tx confirmation fd */
101 DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_conf_fd,
102 TP_PROTO(struct net_device *netdev,
103 const struct dpaa2_fd *fd),
108 /* Log data about raw buffers. Useful for tracing DPBP content. */
109 DECLARE_EVENT_CLASS(dpaa2_eth_buf,
110 /* Trace function prototype */
111 TP_PROTO(struct net_device *netdev,
112 /* virtual address and size */
115 /* dma map address and size */
118 /* buffer pool id, if relevant */
121 /* Repeat argument list here */
122 TP_ARGS(netdev, vaddr, size, dma_addr, map_size, bpid),
124 /* A structure containing the relevant information we want
125 * to record. Declare name and type for each normal element,
126 * name, type and size for arrays. Use __string for variable
130 __field(void *, vaddr)
131 __field(size_t, size)
132 __field(dma_addr_t, dma_addr)
133 __field(size_t, map_size)
135 __string(name, netdev->name)
138 /* The function that assigns values to the above declared
142 __entry->vaddr = vaddr;
143 __entry->size = size;
144 __entry->dma_addr = dma_addr;
145 __entry->map_size = map_size;
146 __entry->bpid = bpid;
147 __assign_str(name, netdev->name);
150 /* This is what gets printed when the trace event is
153 TP_printk(TR_BUF_FMT,
162 /* Main memory buff seeding */
163 DEFINE_EVENT(dpaa2_eth_buf, dpaa2_eth_buf_seed,
164 TP_PROTO(struct net_device *netdev,
171 TP_ARGS(netdev, vaddr, size, dma_addr, map_size, bpid)
174 /* UMEM buff seeding on AF_XDP fast path */
175 DEFINE_EVENT(dpaa2_eth_buf, dpaa2_xsk_buf_seed,
176 TP_PROTO(struct net_device *netdev,
183 TP_ARGS(netdev, vaddr, size, dma_addr, map_size, bpid)
186 /* If only one event of a certain type needs to be declared, use TRACE_EVENT().
187 * The syntax is the same as for DECLARE_EVENT_CLASS().
190 #endif /* _DPAA2_ETH_TRACE_H */
192 /* This must be outside ifdef _DPAA2_ETH_TRACE_H */
193 #undef TRACE_INCLUDE_PATH
194 #define TRACE_INCLUDE_PATH .
195 #undef TRACE_INCLUDE_FILE
196 #define TRACE_INCLUDE_FILE dpaa2-eth-trace
197 #include <trace/define_trace.h>