Loading...
1/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
2/*
3 * Copyright 2013-2015 Freescale Semiconductor Inc.
4 */
5
6#undef TRACE_SYSTEM
7#define TRACE_SYSTEM dpaa_eth
8
9#if !defined(_DPAA_ETH_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
10#define _DPAA_ETH_TRACE_H
11
12#include <linux/skbuff.h>
13#include <linux/netdevice.h>
14#include "dpaa_eth.h"
15#include <linux/tracepoint.h>
16
17#define fd_format_name(format) { qm_fd_##format, #format }
18#define fd_format_list \
19 fd_format_name(contig), \
20 fd_format_name(sg)
21
22/* This is used to declare a class of events.
23 * individual events of this type will be defined below.
24 */
25
26/* Store details about a frame descriptor and the FQ on which it was
27 * transmitted/received.
28 */
29DECLARE_EVENT_CLASS(dpaa_eth_fd,
30 /* Trace function prototype */
31 TP_PROTO(struct net_device *netdev,
32 struct qman_fq *fq,
33 const struct qm_fd *fd),
34
35 /* Repeat argument list here */
36 TP_ARGS(netdev, fq, fd),
37
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.
41 */
42 TP_STRUCT__entry(
43 __field(u32, fqid)
44 __field(u64, fd_addr)
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)
50 ),
51
52 /* The function that assigns values to the above declared fields */
53 TP_fast_assign(
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 = fd->status;
60 __assign_str(name, netdev->name);
61 ),
62
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)
68);
69
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
72 */
73
74/* Tx (egress) fd */
75DEFINE_EVENT(dpaa_eth_fd, dpaa_tx_fd,
76
77 TP_PROTO(struct net_device *netdev,
78 struct qman_fq *fq,
79 const struct qm_fd *fd),
80
81 TP_ARGS(netdev, fq, fd)
82);
83
84/* Rx fd */
85DEFINE_EVENT(dpaa_eth_fd, dpaa_rx_fd,
86
87 TP_PROTO(struct net_device *netdev,
88 struct qman_fq *fq,
89 const struct qm_fd *fd),
90
91 TP_ARGS(netdev, fq, fd)
92);
93
94/* Tx confirmation fd */
95DEFINE_EVENT(dpaa_eth_fd, dpaa_tx_conf_fd,
96
97 TP_PROTO(struct net_device *netdev,
98 struct qman_fq *fq,
99 const struct qm_fd *fd),
100
101 TP_ARGS(netdev, fq, fd)
102);
103
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().
106 */
107
108#endif /* _DPAA_ETH_TRACE_H */
109
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>
1/* Copyright 2013-2015 Freescale Semiconductor Inc.
2 *
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.
13 *
14 *
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
18 * later version.
19 *
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.
30 */
31
32#undef TRACE_SYSTEM
33#define TRACE_SYSTEM dpaa_eth
34
35#if !defined(_DPAA_ETH_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
36#define _DPAA_ETH_TRACE_H
37
38#include <linux/skbuff.h>
39#include <linux/netdevice.h>
40#include "dpaa_eth.h"
41#include <linux/tracepoint.h>
42
43#define fd_format_name(format) { qm_fd_##format, #format }
44#define fd_format_list \
45 fd_format_name(contig), \
46 fd_format_name(sg)
47
48/* This is used to declare a class of events.
49 * individual events of this type will be defined below.
50 */
51
52/* Store details about a frame descriptor and the FQ on which it was
53 * transmitted/received.
54 */
55DECLARE_EVENT_CLASS(dpaa_eth_fd,
56 /* Trace function prototype */
57 TP_PROTO(struct net_device *netdev,
58 struct qman_fq *fq,
59 const struct qm_fd *fd),
60
61 /* Repeat argument list here */
62 TP_ARGS(netdev, fq, fd),
63
64 /* A structure containing the relevant information we want to record.
65 * Declare name and type for each normal element, name, type and size
66 * for arrays. Use __string for variable length strings.
67 */
68 TP_STRUCT__entry(
69 __field(u32, fqid)
70 __field(u64, fd_addr)
71 __field(u8, fd_format)
72 __field(u16, fd_offset)
73 __field(u32, fd_length)
74 __field(u32, fd_status)
75 __string(name, netdev->name)
76 ),
77
78 /* The function that assigns values to the above declared fields */
79 TP_fast_assign(
80 __entry->fqid = fq->fqid;
81 __entry->fd_addr = qm_fd_addr_get64(fd);
82 __entry->fd_format = qm_fd_get_format(fd);
83 __entry->fd_offset = qm_fd_get_offset(fd);
84 __entry->fd_length = qm_fd_get_length(fd);
85 __entry->fd_status = fd->status;
86 __assign_str(name, netdev->name);
87 ),
88
89 /* This is what gets printed when the trace event is triggered */
90 TP_printk("[%s] fqid=%d, fd: addr=0x%llx, format=%s, off=%u, len=%u, status=0x%08x",
91 __get_str(name), __entry->fqid, __entry->fd_addr,
92 __print_symbolic(__entry->fd_format, fd_format_list),
93 __entry->fd_offset, __entry->fd_length, __entry->fd_status)
94);
95
96/* Now declare events of the above type. Format is:
97 * DEFINE_EVENT(class, name, proto, args), with proto and args same as for class
98 */
99
100/* Tx (egress) fd */
101DEFINE_EVENT(dpaa_eth_fd, dpaa_tx_fd,
102
103 TP_PROTO(struct net_device *netdev,
104 struct qman_fq *fq,
105 const struct qm_fd *fd),
106
107 TP_ARGS(netdev, fq, fd)
108);
109
110/* Rx fd */
111DEFINE_EVENT(dpaa_eth_fd, dpaa_rx_fd,
112
113 TP_PROTO(struct net_device *netdev,
114 struct qman_fq *fq,
115 const struct qm_fd *fd),
116
117 TP_ARGS(netdev, fq, fd)
118);
119
120/* Tx confirmation fd */
121DEFINE_EVENT(dpaa_eth_fd, dpaa_tx_conf_fd,
122
123 TP_PROTO(struct net_device *netdev,
124 struct qman_fq *fq,
125 const struct qm_fd *fd),
126
127 TP_ARGS(netdev, fq, fd)
128);
129
130/* If only one event of a certain type needs to be declared, use TRACE_EVENT().
131 * The syntax is the same as for DECLARE_EVENT_CLASS().
132 */
133
134#endif /* _DPAA_ETH_TRACE_H */
135
136/* This must be outside ifdef _DPAA_ETH_TRACE_H */
137#undef TRACE_INCLUDE_PATH
138#define TRACE_INCLUDE_PATH .
139#undef TRACE_INCLUDE_FILE
140#define TRACE_INCLUDE_FILE dpaa_eth_trace
141#include <trace/define_trace.h>