Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later */
0002 /*
0003  * Copyright 2013-2015 Freescale Semiconductor Inc.
0004  */
0005 
0006 #undef TRACE_SYSTEM
0007 #define TRACE_SYSTEM    dpaa_eth
0008 
0009 #if !defined(_DPAA_ETH_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
0010 #define _DPAA_ETH_TRACE_H
0011 
0012 #include <linux/skbuff.h>
0013 #include <linux/netdevice.h>
0014 #include "dpaa_eth.h"
0015 #include <linux/tracepoint.h>
0016 
0017 #define fd_format_name(format)  { qm_fd_##format, #format }
0018 #define fd_format_list  \
0019     fd_format_name(contig), \
0020     fd_format_name(sg)
0021 
0022 /* This is used to declare a class of events.
0023  * individual events of this type will be defined below.
0024  */
0025 
0026 /* Store details about a frame descriptor and the FQ on which it was
0027  * transmitted/received.
0028  */
0029 DECLARE_EVENT_CLASS(dpaa_eth_fd,
0030     /* Trace function prototype */
0031     TP_PROTO(struct net_device *netdev,
0032          struct qman_fq *fq,
0033          const struct qm_fd *fd),
0034 
0035     /* Repeat argument list here */
0036     TP_ARGS(netdev, fq, fd),
0037 
0038     /* A structure containing the relevant information we want to record.
0039      * Declare name and type for each normal element, name, type and size
0040      * for arrays. Use __string for variable length strings.
0041      */
0042     TP_STRUCT__entry(
0043         __field(u32,    fqid)
0044         __field(u64,    fd_addr)
0045         __field(u8, fd_format)
0046         __field(u16,    fd_offset)
0047         __field(u32,    fd_length)
0048         __field(u32,    fd_status)
0049         __string(name,  netdev->name)
0050     ),
0051 
0052     /* The function that assigns values to the above declared fields */
0053     TP_fast_assign(
0054         __entry->fqid = fq->fqid;
0055         __entry->fd_addr = qm_fd_addr_get64(fd);
0056         __entry->fd_format = qm_fd_get_format(fd);
0057         __entry->fd_offset = qm_fd_get_offset(fd);
0058         __entry->fd_length = qm_fd_get_length(fd);
0059         __entry->fd_status = fd->status;
0060         __assign_str(name, netdev->name);
0061     ),
0062 
0063     /* This is what gets printed when the trace event is triggered */
0064     TP_printk("[%s] fqid=%d, fd: addr=0x%llx, format=%s, off=%u, len=%u, status=0x%08x",
0065           __get_str(name), __entry->fqid, __entry->fd_addr,
0066           __print_symbolic(__entry->fd_format, fd_format_list),
0067           __entry->fd_offset, __entry->fd_length, __entry->fd_status)
0068 );
0069 
0070 /* Now declare events of the above type. Format is:
0071  * DEFINE_EVENT(class, name, proto, args), with proto and args same as for class
0072  */
0073 
0074 /* Tx (egress) fd */
0075 DEFINE_EVENT(dpaa_eth_fd, dpaa_tx_fd,
0076 
0077     TP_PROTO(struct net_device *netdev,
0078          struct qman_fq *fq,
0079          const struct qm_fd *fd),
0080 
0081     TP_ARGS(netdev, fq, fd)
0082 );
0083 
0084 /* Rx fd */
0085 DEFINE_EVENT(dpaa_eth_fd, dpaa_rx_fd,
0086 
0087     TP_PROTO(struct net_device *netdev,
0088          struct qman_fq *fq,
0089          const struct qm_fd *fd),
0090 
0091     TP_ARGS(netdev, fq, fd)
0092 );
0093 
0094 /* Tx confirmation fd */
0095 DEFINE_EVENT(dpaa_eth_fd, dpaa_tx_conf_fd,
0096 
0097     TP_PROTO(struct net_device *netdev,
0098          struct qman_fq *fq,
0099          const struct qm_fd *fd),
0100 
0101     TP_ARGS(netdev, fq, fd)
0102 );
0103 
0104 /* If only one event of a certain type needs to be declared, use TRACE_EVENT().
0105  * The syntax is the same as for DECLARE_EVENT_CLASS().
0106  */
0107 
0108 #endif /* _DPAA_ETH_TRACE_H */
0109 
0110 /* This must be outside ifdef _DPAA_ETH_TRACE_H */
0111 #undef TRACE_INCLUDE_PATH
0112 #define TRACE_INCLUDE_PATH .
0113 #undef TRACE_INCLUDE_FILE
0114 #define TRACE_INCLUDE_FILE  dpaa_eth_trace
0115 #include <trace/define_trace.h>