1 /* 2 * Copyright(c) 2015, 2016 Intel Corporation. 3 * 4 * This file is provided under a dual BSD/GPLv2 license. When using or 5 * redistributing this file, you may do so under either license. 6 * 7 * GPL LICENSE SUMMARY 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of version 2 of the GNU General Public License as 11 * published by the Free Software Foundation. 12 * 13 * This program is distributed in the hope that it will be useful, but 14 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * General Public License for more details. 17 * 18 * BSD LICENSE 19 * 20 * Redistribution and use in source and binary forms, with or without 21 * modification, are permitted provided that the following conditions 22 * are met: 23 * 24 * - Redistributions of source code must retain the above copyright 25 * notice, this list of conditions and the following disclaimer. 26 * - Redistributions in binary form must reproduce the above copyright 27 * notice, this list of conditions and the following disclaimer in 28 * the documentation and/or other materials provided with the 29 * distribution. 30 * - Neither the name of Intel Corporation nor the names of its 31 * contributors may be used to endorse or promote products derived 32 * from this software without specific prior written permission. 33 * 34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 35 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 36 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 37 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 38 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 39 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 40 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 41 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 42 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 43 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 44 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 45 * 46 */ 47 #if !defined(__HFI1_TRACE_RX_H) || defined(TRACE_HEADER_MULTI_READ) 48 #define __HFI1_TRACE_RX_H 49 50 #include <linux/tracepoint.h> 51 #include <linux/trace_seq.h> 52 53 #include "hfi.h" 54 55 #define tidtype_name(type) { PT_##type, #type } 56 #define show_tidtype(type) \ 57 __print_symbolic(type, \ 58 tidtype_name(EXPECTED), \ 59 tidtype_name(EAGER), \ 60 tidtype_name(INVALID)) \ 61 62 #undef TRACE_SYSTEM 63 #define TRACE_SYSTEM hfi1_rx 64 65 #define packettype_name(etype) { RHF_RCV_TYPE_##etype, #etype } 66 #define show_packettype(etype) \ 67 __print_symbolic(etype, \ 68 packettype_name(EXPECTED), \ 69 packettype_name(EAGER), \ 70 packettype_name(IB), \ 71 packettype_name(ERROR), \ 72 packettype_name(BYPASS)) 73 74 TRACE_EVENT(hfi1_rcvhdr, 75 TP_PROTO(struct hfi1_devdata *dd, 76 u32 ctxt, 77 u64 eflags, 78 u32 etype, 79 u32 hlen, 80 u32 tlen, 81 u32 updegr, 82 u32 etail 83 ), 84 TP_ARGS(dd, ctxt, eflags, etype, hlen, tlen, updegr, etail), 85 TP_STRUCT__entry(DD_DEV_ENTRY(dd) 86 __field(u64, eflags) 87 __field(u32, ctxt) 88 __field(u32, etype) 89 __field(u32, hlen) 90 __field(u32, tlen) 91 __field(u32, updegr) 92 __field(u32, etail) 93 ), 94 TP_fast_assign(DD_DEV_ASSIGN(dd); 95 __entry->eflags = eflags; 96 __entry->ctxt = ctxt; 97 __entry->etype = etype; 98 __entry->hlen = hlen; 99 __entry->tlen = tlen; 100 __entry->updegr = updegr; 101 __entry->etail = etail; 102 ), 103 TP_printk( 104 "[%s] ctxt %d eflags 0x%llx etype %d,%s hlen %d tlen %d updegr %d etail %d", 105 __get_str(dev), 106 __entry->ctxt, 107 __entry->eflags, 108 __entry->etype, show_packettype(__entry->etype), 109 __entry->hlen, 110 __entry->tlen, 111 __entry->updegr, 112 __entry->etail 113 ) 114 ); 115 116 TRACE_EVENT(hfi1_receive_interrupt, 117 TP_PROTO(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd), 118 TP_ARGS(dd, rcd), 119 TP_STRUCT__entry(DD_DEV_ENTRY(dd) 120 __field(u32, ctxt) 121 __field(u8, slow_path) 122 __field(u8, dma_rtail) 123 ), 124 TP_fast_assign(DD_DEV_ASSIGN(dd); 125 __entry->ctxt = rcd->ctxt; 126 if (rcd->do_interrupt == 127 &handle_receive_interrupt) { 128 __entry->slow_path = 1; 129 __entry->dma_rtail = 0xFF; 130 } else if (rcd->do_interrupt == 131 &handle_receive_interrupt_dma_rtail){ 132 __entry->dma_rtail = 1; 133 __entry->slow_path = 0; 134 } else if (rcd->do_interrupt == 135 &handle_receive_interrupt_nodma_rtail) { 136 __entry->dma_rtail = 0; 137 __entry->slow_path = 0; 138 } 139 ), 140 TP_printk("[%s] ctxt %d SlowPath: %d DmaRtail: %d", 141 __get_str(dev), 142 __entry->ctxt, 143 __entry->slow_path, 144 __entry->dma_rtail 145 ) 146 ); 147 148 DECLARE_EVENT_CLASS( 149 hfi1_exp_tid_reg_unreg, 150 TP_PROTO(unsigned int ctxt, u16 subctxt, u32 rarr, 151 u32 npages, unsigned long va, unsigned long pa, 152 dma_addr_t dma), 153 TP_ARGS(ctxt, subctxt, rarr, npages, va, pa, dma), 154 TP_STRUCT__entry( 155 __field(unsigned int, ctxt) 156 __field(u16, subctxt) 157 __field(u32, rarr) 158 __field(u32, npages) 159 __field(unsigned long, va) 160 __field(unsigned long, pa) 161 __field(dma_addr_t, dma) 162 ), 163 TP_fast_assign( 164 __entry->ctxt = ctxt; 165 __entry->subctxt = subctxt; 166 __entry->rarr = rarr; 167 __entry->npages = npages; 168 __entry->va = va; 169 __entry->pa = pa; 170 __entry->dma = dma; 171 ), 172 TP_printk("[%u:%u] entry:%u, %u pages @ 0x%lx, va:0x%lx dma:0x%llx", 173 __entry->ctxt, 174 __entry->subctxt, 175 __entry->rarr, 176 __entry->npages, 177 __entry->pa, 178 __entry->va, 179 __entry->dma 180 ) 181 ); 182 183 DEFINE_EVENT( 184 hfi1_exp_tid_reg_unreg, hfi1_exp_tid_unreg, 185 TP_PROTO(unsigned int ctxt, u16 subctxt, u32 rarr, u32 npages, 186 unsigned long va, unsigned long pa, dma_addr_t dma), 187 TP_ARGS(ctxt, subctxt, rarr, npages, va, pa, dma)); 188 189 DEFINE_EVENT( 190 hfi1_exp_tid_reg_unreg, hfi1_exp_tid_reg, 191 TP_PROTO(unsigned int ctxt, u16 subctxt, u32 rarr, u32 npages, 192 unsigned long va, unsigned long pa, dma_addr_t dma), 193 TP_ARGS(ctxt, subctxt, rarr, npages, va, pa, dma)); 194 195 TRACE_EVENT( 196 hfi1_put_tid, 197 TP_PROTO(struct hfi1_devdata *dd, 198 u32 index, u32 type, unsigned long pa, u16 order), 199 TP_ARGS(dd, index, type, pa, order), 200 TP_STRUCT__entry( 201 DD_DEV_ENTRY(dd) 202 __field(unsigned long, pa); 203 __field(u32, index); 204 __field(u32, type); 205 __field(u16, order); 206 ), 207 TP_fast_assign( 208 DD_DEV_ASSIGN(dd); 209 __entry->pa = pa; 210 __entry->index = index; 211 __entry->type = type; 212 __entry->order = order; 213 ), 214 TP_printk("[%s] type %s pa %lx index %u order %u", 215 __get_str(dev), 216 show_tidtype(__entry->type), 217 __entry->pa, 218 __entry->index, 219 __entry->order 220 ) 221 ); 222 223 TRACE_EVENT(hfi1_exp_tid_inval, 224 TP_PROTO(unsigned int ctxt, u16 subctxt, unsigned long va, u32 rarr, 225 u32 npages, dma_addr_t dma), 226 TP_ARGS(ctxt, subctxt, va, rarr, npages, dma), 227 TP_STRUCT__entry( 228 __field(unsigned int, ctxt) 229 __field(u16, subctxt) 230 __field(unsigned long, va) 231 __field(u32, rarr) 232 __field(u32, npages) 233 __field(dma_addr_t, dma) 234 ), 235 TP_fast_assign( 236 __entry->ctxt = ctxt; 237 __entry->subctxt = subctxt; 238 __entry->va = va; 239 __entry->rarr = rarr; 240 __entry->npages = npages; 241 __entry->dma = dma; 242 ), 243 TP_printk("[%u:%u] entry:%u, %u pages @ 0x%lx dma: 0x%llx", 244 __entry->ctxt, 245 __entry->subctxt, 246 __entry->rarr, 247 __entry->npages, 248 __entry->va, 249 __entry->dma 250 ) 251 ); 252 253 TRACE_EVENT(hfi1_mmu_invalidate, 254 TP_PROTO(unsigned int ctxt, u16 subctxt, const char *type, 255 unsigned long start, unsigned long end), 256 TP_ARGS(ctxt, subctxt, type, start, end), 257 TP_STRUCT__entry( 258 __field(unsigned int, ctxt) 259 __field(u16, subctxt) 260 __string(type, type) 261 __field(unsigned long, start) 262 __field(unsigned long, end) 263 ), 264 TP_fast_assign( 265 __entry->ctxt = ctxt; 266 __entry->subctxt = subctxt; 267 __assign_str(type, type); 268 __entry->start = start; 269 __entry->end = end; 270 ), 271 TP_printk("[%3u:%02u] MMU Invalidate (%s) 0x%lx - 0x%lx", 272 __entry->ctxt, 273 __entry->subctxt, 274 __get_str(type), 275 __entry->start, 276 __entry->end 277 ) 278 ); 279 280 #endif /* __HFI1_TRACE_RX_H */ 281 282 #undef TRACE_INCLUDE_PATH 283 #undef TRACE_INCLUDE_FILE 284 #define TRACE_INCLUDE_PATH . 285 #define TRACE_INCLUDE_FILE trace_rx 286 #include <trace/define_trace.h> 287