1 /* Copyright 2014-2015 Freescale Semiconductor Inc.
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are met:
5 * * Redistributions of source code must retain the above copyright
6 * notice, this list of conditions and the following disclaimer.
7 * * Redistributions in binary form must reproduce the above copyright
8 * notice, this list of conditions and the following disclaimer in the
9 * documentation and/or other materials provided with the distribution.
10 * * Neither the name of Freescale Semiconductor nor the
11 * names of its contributors may be used to endorse or promote products
12 * derived from this software without specific prior written permission.
15 * ALTERNATIVELY, this software may be distributed under the terms of the
16 * GNU General Public License ("GPL") as published by the Free Software
17 * Foundation, either version 2 of that License or (at your option) any
20 * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
21 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #define TRACE_SYSTEM dpaa2_eth
35 #if !defined(_DPAA2_ETH_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
36 #define _DPAA2_ETH_TRACE_H
38 #include <linux/skbuff.h>
39 #include <linux/netdevice.h>
40 #include "dpaa2-eth.h"
41 #include <linux/tracepoint.h>
43 #define TR_FMT "[%s] fd: addr=0x%llx, len=%u, off=%u"
44 /* trace_printk format for raw buffer event class */
45 #define TR_BUF_FMT "[%s] vaddr=%p size=%zu dma_addr=%pad map_size=%zu bpid=%d"
47 /* This is used to declare a class of events.
48 * individual events of this type will be defined below.
51 /* Store details about a frame descriptor */
52 DECLARE_EVENT_CLASS(dpaa2_eth_fd,
53 /* Trace function prototype */
54 TP_PROTO(struct net_device *netdev,
55 const struct dpaa2_fd *fd),
57 /* Repeat argument list here */
60 /* A structure containing the relevant information we want
61 * to record. Declare name and type for each normal element,
62 * name, type and size for arrays. Use __string for variable
68 __field(u16, fd_offset)
69 __string(name, netdev->name)
72 /* The function that assigns values to the above declared
76 __entry->fd_addr = dpaa2_fd_get_addr(fd);
77 __entry->fd_len = dpaa2_fd_get_len(fd);
78 __entry->fd_offset = dpaa2_fd_get_offset(fd);
79 __assign_str(name, netdev->name);
82 /* This is what gets printed when the trace event is
92 /* Now declare events of the above type. Format is:
93 * DEFINE_EVENT(class, name, proto, args), with proto and args same as for class
97 DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_fd,
98 TP_PROTO(struct net_device *netdev,
99 const struct dpaa2_fd *fd),
105 DEFINE_EVENT(dpaa2_eth_fd, dpaa2_rx_fd,
106 TP_PROTO(struct net_device *netdev,
107 const struct dpaa2_fd *fd),
112 /* Tx confirmation fd */
113 DEFINE_EVENT(dpaa2_eth_fd, dpaa2_tx_conf_fd,
114 TP_PROTO(struct net_device *netdev,
115 const struct dpaa2_fd *fd),
120 /* Log data about raw buffers. Useful for tracing DPBP content. */
121 TRACE_EVENT(dpaa2_eth_buf_seed,
122 /* Trace function prototype */
123 TP_PROTO(struct net_device *netdev,
124 /* virtual address and size */
127 /* dma map address and size */
130 /* buffer pool id, if relevant */
133 /* Repeat argument list here */
134 TP_ARGS(netdev, vaddr, size, dma_addr, map_size, bpid),
136 /* A structure containing the relevant information we want
137 * to record. Declare name and type for each normal element,
138 * name, type and size for arrays. Use __string for variable
142 __field(void *, vaddr)
143 __field(size_t, size)
144 __field(dma_addr_t, dma_addr)
145 __field(size_t, map_size)
147 __string(name, netdev->name)
150 /* The function that assigns values to the above declared
154 __entry->vaddr = vaddr;
155 __entry->size = size;
156 __entry->dma_addr = dma_addr;
157 __entry->map_size = map_size;
158 __entry->bpid = bpid;
159 __assign_str(name, netdev->name);
162 /* This is what gets printed when the trace event is
165 TP_printk(TR_BUF_FMT,
174 /* If only one event of a certain type needs to be declared, use TRACE_EVENT().
175 * The syntax is the same as for DECLARE_EVENT_CLASS().
178 #endif /* _DPAA2_ETH_TRACE_H */
180 /* This must be outside ifdef _DPAA2_ETH_TRACE_H */
181 #undef TRACE_INCLUDE_PATH
182 #define TRACE_INCLUDE_PATH .
183 #undef TRACE_INCLUDE_FILE
184 #define TRACE_INCLUDE_FILE dpaa2-eth-trace
185 #include <trace/define_trace.h>