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 */ 29 DECLARE_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 */ 75 DEFINE_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 */ 85 DEFINE_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 */ 95 DEFINE_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> 116