1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright (C) 2021 Intel Corporation. */ 3 4 /* Modeled on trace-events-sample.h */ 5 6 /* The trace subsystem name for ice will be "ice". 7 * 8 * This file is named ice_trace.h. 9 * 10 * Since this include file's name is different from the trace 11 * subsystem name, we'll have to define TRACE_INCLUDE_FILE at the end 12 * of this file. 13 */ 14 #undef TRACE_SYSTEM 15 #define TRACE_SYSTEM ice 16 17 /* See trace-events-sample.h for a detailed description of why this 18 * guard clause is different from most normal include files. 19 */ 20 #if !defined(_ICE_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ) 21 #define _ICE_TRACE_H_ 22 23 #include <linux/tracepoint.h> 24 25 /* ice_trace() macro enables shared code to refer to trace points 26 * like: 27 * 28 * trace_ice_example(args...) 29 * 30 * ... as: 31 * 32 * ice_trace(example, args...) 33 * 34 * ... to resolve to the PF version of the tracepoint without 35 * ifdefs, and to allow tracepoints to be disabled entirely at build 36 * time. 37 * 38 * Trace point should always be referred to in the driver via this 39 * macro. 40 * 41 * Similarly, ice_trace_enabled(trace_name) wraps references to 42 * trace_ice_<trace_name>_enabled() functions. 43 * @trace_name: name of tracepoint 44 */ 45 #define _ICE_TRACE_NAME(trace_name) (trace_##ice##_##trace_name) 46 #define ICE_TRACE_NAME(trace_name) _ICE_TRACE_NAME(trace_name) 47 48 #define ice_trace(trace_name, args...) ICE_TRACE_NAME(trace_name)(args) 49 50 #define ice_trace_enabled(trace_name) ICE_TRACE_NAME(trace_name##_enabled)() 51 52 /* This is for events common to PF. Corresponding versions will be named 53 * trace_ice_*. The ice_trace() macro above will select the right trace point 54 * name for the driver. 55 */ 56 57 /* Begin tracepoints */ 58 59 /* Global tracepoints */ 60 61 /* Events related to DIM, q_vectors and ring containers */ 62 DECLARE_EVENT_CLASS(ice_rx_dim_template, 63 TP_PROTO(struct ice_q_vector *q_vector, struct dim *dim), 64 TP_ARGS(q_vector, dim), 65 TP_STRUCT__entry(__field(struct ice_q_vector *, q_vector) 66 __field(struct dim *, dim) 67 __string(devname, q_vector->rx.rx_ring->netdev->name)), 68 69 TP_fast_assign(__entry->q_vector = q_vector; 70 __entry->dim = dim; 71 __assign_str(devname, q_vector->rx.rx_ring->netdev->name);), 72 73 TP_printk("netdev: %s Rx-Q: %d dim-state: %d dim-profile: %d dim-tune: %d dim-st-right: %d dim-st-left: %d dim-tired: %d", 74 __get_str(devname), 75 __entry->q_vector->rx.rx_ring->q_index, 76 __entry->dim->state, 77 __entry->dim->profile_ix, 78 __entry->dim->tune_state, 79 __entry->dim->steps_right, 80 __entry->dim->steps_left, 81 __entry->dim->tired) 82 ); 83 84 DEFINE_EVENT(ice_rx_dim_template, ice_rx_dim_work, 85 TP_PROTO(struct ice_q_vector *q_vector, struct dim *dim), 86 TP_ARGS(q_vector, dim) 87 ); 88 89 DECLARE_EVENT_CLASS(ice_tx_dim_template, 90 TP_PROTO(struct ice_q_vector *q_vector, struct dim *dim), 91 TP_ARGS(q_vector, dim), 92 TP_STRUCT__entry(__field(struct ice_q_vector *, q_vector) 93 __field(struct dim *, dim) 94 __string(devname, q_vector->tx.tx_ring->netdev->name)), 95 96 TP_fast_assign(__entry->q_vector = q_vector; 97 __entry->dim = dim; 98 __assign_str(devname, q_vector->tx.tx_ring->netdev->name);), 99 100 TP_printk("netdev: %s Tx-Q: %d dim-state: %d dim-profile: %d dim-tune: %d dim-st-right: %d dim-st-left: %d dim-tired: %d", 101 __get_str(devname), 102 __entry->q_vector->tx.tx_ring->q_index, 103 __entry->dim->state, 104 __entry->dim->profile_ix, 105 __entry->dim->tune_state, 106 __entry->dim->steps_right, 107 __entry->dim->steps_left, 108 __entry->dim->tired) 109 ); 110 111 DEFINE_EVENT(ice_tx_dim_template, ice_tx_dim_work, 112 TP_PROTO(struct ice_q_vector *q_vector, struct dim *dim), 113 TP_ARGS(q_vector, dim) 114 ); 115 116 /* Events related to a vsi & ring */ 117 DECLARE_EVENT_CLASS(ice_tx_template, 118 TP_PROTO(struct ice_tx_ring *ring, struct ice_tx_desc *desc, 119 struct ice_tx_buf *buf), 120 121 TP_ARGS(ring, desc, buf), 122 TP_STRUCT__entry(__field(void *, ring) 123 __field(void *, desc) 124 __field(void *, buf) 125 __string(devname, ring->netdev->name)), 126 127 TP_fast_assign(__entry->ring = ring; 128 __entry->desc = desc; 129 __entry->buf = buf; 130 __assign_str(devname, ring->netdev->name);), 131 132 TP_printk("netdev: %s ring: %pK desc: %pK buf %pK", __get_str(devname), 133 __entry->ring, __entry->desc, __entry->buf) 134 ); 135 136 #define DEFINE_TX_TEMPLATE_OP_EVENT(name) \ 137 DEFINE_EVENT(ice_tx_template, name, \ 138 TP_PROTO(struct ice_tx_ring *ring, \ 139 struct ice_tx_desc *desc, \ 140 struct ice_tx_buf *buf), \ 141 TP_ARGS(ring, desc, buf)) 142 143 DEFINE_TX_TEMPLATE_OP_EVENT(ice_clean_tx_irq); 144 DEFINE_TX_TEMPLATE_OP_EVENT(ice_clean_tx_irq_unmap); 145 DEFINE_TX_TEMPLATE_OP_EVENT(ice_clean_tx_irq_unmap_eop); 146 147 DECLARE_EVENT_CLASS(ice_rx_template, 148 TP_PROTO(struct ice_rx_ring *ring, union ice_32b_rx_flex_desc *desc), 149 150 TP_ARGS(ring, desc), 151 152 TP_STRUCT__entry(__field(void *, ring) 153 __field(void *, desc) 154 __string(devname, ring->netdev->name)), 155 156 TP_fast_assign(__entry->ring = ring; 157 __entry->desc = desc; 158 __assign_str(devname, ring->netdev->name);), 159 160 TP_printk("netdev: %s ring: %pK desc: %pK", __get_str(devname), 161 __entry->ring, __entry->desc) 162 ); 163 DEFINE_EVENT(ice_rx_template, ice_clean_rx_irq, 164 TP_PROTO(struct ice_rx_ring *ring, union ice_32b_rx_flex_desc *desc), 165 TP_ARGS(ring, desc) 166 ); 167 168 DECLARE_EVENT_CLASS(ice_rx_indicate_template, 169 TP_PROTO(struct ice_rx_ring *ring, union ice_32b_rx_flex_desc *desc, 170 struct sk_buff *skb), 171 172 TP_ARGS(ring, desc, skb), 173 174 TP_STRUCT__entry(__field(void *, ring) 175 __field(void *, desc) 176 __field(void *, skb) 177 __string(devname, ring->netdev->name)), 178 179 TP_fast_assign(__entry->ring = ring; 180 __entry->desc = desc; 181 __entry->skb = skb; 182 __assign_str(devname, ring->netdev->name);), 183 184 TP_printk("netdev: %s ring: %pK desc: %pK skb %pK", __get_str(devname), 185 __entry->ring, __entry->desc, __entry->skb) 186 ); 187 188 DEFINE_EVENT(ice_rx_indicate_template, ice_clean_rx_irq_indicate, 189 TP_PROTO(struct ice_rx_ring *ring, union ice_32b_rx_flex_desc *desc, 190 struct sk_buff *skb), 191 TP_ARGS(ring, desc, skb) 192 ); 193 194 DECLARE_EVENT_CLASS(ice_xmit_template, 195 TP_PROTO(struct ice_tx_ring *ring, struct sk_buff *skb), 196 197 TP_ARGS(ring, skb), 198 199 TP_STRUCT__entry(__field(void *, ring) 200 __field(void *, skb) 201 __string(devname, ring->netdev->name)), 202 203 TP_fast_assign(__entry->ring = ring; 204 __entry->skb = skb; 205 __assign_str(devname, ring->netdev->name);), 206 207 TP_printk("netdev: %s skb: %pK ring: %pK", __get_str(devname), 208 __entry->skb, __entry->ring) 209 ); 210 211 #define DEFINE_XMIT_TEMPLATE_OP_EVENT(name) \ 212 DEFINE_EVENT(ice_xmit_template, name, \ 213 TP_PROTO(struct ice_tx_ring *ring, struct sk_buff *skb), \ 214 TP_ARGS(ring, skb)) 215 216 DEFINE_XMIT_TEMPLATE_OP_EVENT(ice_xmit_frame_ring); 217 DEFINE_XMIT_TEMPLATE_OP_EVENT(ice_xmit_frame_ring_drop); 218 219 /* End tracepoints */ 220 221 #endif /* _ICE_TRACE_H_ */ 222 /* This must be outside ifdef _ICE_TRACE_H */ 223 224 /* This trace include file is not located in the .../include/trace 225 * with the kernel tracepoint definitions, because we're a loadable 226 * module. 227 */ 228 #undef TRACE_INCLUDE_PATH 229 #define TRACE_INCLUDE_PATH . 230 #undef TRACE_INCLUDE_FILE 231 #define TRACE_INCLUDE_FILE ../../drivers/net/ethernet/intel/ice/ice_trace 232 #include <trace/define_trace.h> 233