Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * This file is provided under a dual BSD/GPLv2 license. When using or |
| 4 | * redistributing this file, you may do so under either license. |
| 5 | * |
| 6 | * GPL LICENSE SUMMARY |
| 7 | * |
| 8 | * Copyright(c) 2015 Intel Corporation. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of version 2 of the GNU General Public License as |
| 12 | * published by the Free Software Foundation. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, but |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 | * General Public License for more details. |
| 18 | * |
| 19 | * BSD LICENSE |
| 20 | * |
| 21 | * Copyright(c) 2015 Intel Corporation. |
| 22 | * |
| 23 | * Redistribution and use in source and binary forms, with or without |
| 24 | * modification, are permitted provided that the following conditions |
| 25 | * are met: |
| 26 | * |
| 27 | * - Redistributions of source code must retain the above copyright |
| 28 | * notice, this list of conditions and the following disclaimer. |
| 29 | * - Redistributions in binary form must reproduce the above copyright |
| 30 | * notice, this list of conditions and the following disclaimer in |
| 31 | * the documentation and/or other materials provided with the |
| 32 | * distribution. |
| 33 | * - Neither the name of Intel Corporation nor the names of its |
| 34 | * contributors may be used to endorse or promote products derived |
| 35 | * from this software without specific prior written permission. |
| 36 | * |
| 37 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 38 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 39 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 40 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 41 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 42 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 43 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 44 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 45 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 46 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 47 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 48 | * |
| 49 | */ |
| 50 | #undef TRACE_SYSTEM_VAR |
| 51 | #define TRACE_SYSTEM_VAR hfi1 |
| 52 | |
| 53 | #if !defined(__HFI1_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) |
| 54 | #define __HFI1_TRACE_H |
| 55 | |
| 56 | #include <linux/tracepoint.h> |
| 57 | #include <linux/trace_seq.h> |
| 58 | |
| 59 | #include "hfi.h" |
| 60 | #include "mad.h" |
| 61 | #include "sdma.h" |
| 62 | |
| 63 | #define DD_DEV_ENTRY(dd) __string(dev, dev_name(&(dd)->pcidev->dev)) |
| 64 | #define DD_DEV_ASSIGN(dd) __assign_str(dev, dev_name(&(dd)->pcidev->dev)) |
| 65 | |
| 66 | #define packettype_name(etype) { RHF_RCV_TYPE_##etype, #etype } |
| 67 | #define show_packettype(etype) \ |
| 68 | __print_symbolic(etype, \ |
| 69 | packettype_name(EXPECTED), \ |
| 70 | packettype_name(EAGER), \ |
| 71 | packettype_name(IB), \ |
| 72 | packettype_name(ERROR), \ |
| 73 | packettype_name(BYPASS)) |
| 74 | |
| 75 | #undef TRACE_SYSTEM |
| 76 | #define TRACE_SYSTEM hfi1_rx |
| 77 | |
| 78 | TRACE_EVENT(hfi1_rcvhdr, |
| 79 | TP_PROTO(struct hfi1_devdata *dd, |
| 80 | u64 eflags, |
| 81 | u32 ctxt, |
| 82 | u32 etype, |
| 83 | u32 hlen, |
| 84 | u32 tlen, |
| 85 | u32 updegr, |
| 86 | u32 etail), |
| 87 | TP_ARGS(dd, ctxt, eflags, etype, hlen, tlen, updegr, etail), |
| 88 | TP_STRUCT__entry( |
| 89 | DD_DEV_ENTRY(dd) |
| 90 | __field(u64, eflags) |
| 91 | __field(u32, ctxt) |
| 92 | __field(u32, etype) |
| 93 | __field(u32, hlen) |
| 94 | __field(u32, tlen) |
| 95 | __field(u32, updegr) |
| 96 | __field(u32, etail) |
| 97 | ), |
| 98 | TP_fast_assign( |
| 99 | DD_DEV_ASSIGN(dd); |
| 100 | __entry->eflags = eflags; |
| 101 | __entry->ctxt = ctxt; |
| 102 | __entry->etype = etype; |
| 103 | __entry->hlen = hlen; |
| 104 | __entry->tlen = tlen; |
| 105 | __entry->updegr = updegr; |
| 106 | __entry->etail = etail; |
| 107 | ), |
| 108 | TP_printk( |
| 109 | "[%s] ctxt %d eflags 0x%llx etype %d,%s hlen %d tlen %d updegr %d etail %d", |
| 110 | __get_str(dev), |
| 111 | __entry->ctxt, |
| 112 | __entry->eflags, |
| 113 | __entry->etype, show_packettype(__entry->etype), |
| 114 | __entry->hlen, |
| 115 | __entry->tlen, |
| 116 | __entry->updegr, |
| 117 | __entry->etail |
| 118 | ) |
| 119 | ); |
| 120 | |
| 121 | TRACE_EVENT(hfi1_receive_interrupt, |
| 122 | TP_PROTO(struct hfi1_devdata *dd, u32 ctxt), |
| 123 | TP_ARGS(dd, ctxt), |
| 124 | TP_STRUCT__entry( |
| 125 | DD_DEV_ENTRY(dd) |
| 126 | __field(u32, ctxt) |
| 127 | __field(u8, slow_path) |
| 128 | __field(u8, dma_rtail) |
| 129 | ), |
| 130 | TP_fast_assign( |
| 131 | DD_DEV_ASSIGN(dd); |
| 132 | __entry->ctxt = ctxt; |
| 133 | if (dd->rcd[ctxt]->do_interrupt == |
| 134 | &handle_receive_interrupt) { |
| 135 | __entry->slow_path = 1; |
| 136 | __entry->dma_rtail = 0xFF; |
| 137 | } else if (dd->rcd[ctxt]->do_interrupt == |
| 138 | &handle_receive_interrupt_dma_rtail){ |
| 139 | __entry->dma_rtail = 1; |
| 140 | __entry->slow_path = 0; |
| 141 | } else if (dd->rcd[ctxt]->do_interrupt == |
| 142 | &handle_receive_interrupt_nodma_rtail) { |
| 143 | __entry->dma_rtail = 0; |
| 144 | __entry->slow_path = 0; |
| 145 | } |
| 146 | ), |
| 147 | TP_printk( |
| 148 | "[%s] ctxt %d SlowPath: %d DmaRtail: %d", |
| 149 | __get_str(dev), |
| 150 | __entry->ctxt, |
| 151 | __entry->slow_path, |
| 152 | __entry->dma_rtail |
| 153 | ) |
| 154 | ); |
| 155 | |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 156 | TRACE_EVENT(hfi1_exp_tid_reg, |
| 157 | TP_PROTO(unsigned ctxt, u16 subctxt, u32 rarr, |
| 158 | u32 npages, unsigned long va, unsigned long pa, |
| 159 | dma_addr_t dma), |
| 160 | TP_ARGS(ctxt, subctxt, rarr, npages, va, pa, dma), |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 161 | TP_STRUCT__entry( |
| 162 | __field(unsigned, ctxt) |
| 163 | __field(u16, subctxt) |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 164 | __field(u32, rarr) |
| 165 | __field(u32, npages) |
| 166 | __field(unsigned long, va) |
| 167 | __field(unsigned long, pa) |
| 168 | __field(dma_addr_t, dma) |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 169 | ), |
| 170 | TP_fast_assign( |
| 171 | __entry->ctxt = ctxt; |
| 172 | __entry->subctxt = subctxt; |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 173 | __entry->rarr = rarr; |
| 174 | __entry->npages = npages; |
| 175 | __entry->va = va; |
| 176 | __entry->pa = pa; |
| 177 | __entry->dma = dma; |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 178 | ), |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 179 | TP_printk("[%u:%u] entry:%u, %u pages @ 0x%lx, va:0x%lx dma:0x%llx", |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 180 | __entry->ctxt, |
| 181 | __entry->subctxt, |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 182 | __entry->rarr, |
| 183 | __entry->npages, |
| 184 | __entry->pa, |
| 185 | __entry->va, |
| 186 | __entry->dma |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 187 | ) |
| 188 | ); |
| 189 | |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 190 | TRACE_EVENT(hfi1_exp_tid_unreg, |
| 191 | TP_PROTO(unsigned 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), |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 194 | TP_STRUCT__entry( |
| 195 | __field(unsigned, ctxt) |
| 196 | __field(u16, subctxt) |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 197 | __field(u32, rarr) |
| 198 | __field(u32, npages) |
| 199 | __field(unsigned long, va) |
| 200 | __field(unsigned long, pa) |
| 201 | __field(dma_addr_t, dma) |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 202 | ), |
| 203 | TP_fast_assign( |
| 204 | __entry->ctxt = ctxt; |
| 205 | __entry->subctxt = subctxt; |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 206 | __entry->rarr = rarr; |
| 207 | __entry->npages = npages; |
| 208 | __entry->va = va; |
| 209 | __entry->pa = pa; |
| 210 | __entry->dma = dma; |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 211 | ), |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 212 | TP_printk("[%u:%u] entry:%u, %u pages @ 0x%lx, va:0x%lx dma:0x%llx", |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 213 | __entry->ctxt, |
| 214 | __entry->subctxt, |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 215 | __entry->rarr, |
| 216 | __entry->npages, |
| 217 | __entry->pa, |
| 218 | __entry->va, |
| 219 | __entry->dma |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 220 | ) |
| 221 | ); |
| 222 | |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 223 | TRACE_EVENT(hfi1_exp_tid_inval, |
| 224 | TP_PROTO(unsigned ctxt, u16 subctxt, unsigned long va, u32 rarr, |
| 225 | u32 npages, dma_addr_t dma), |
| 226 | TP_ARGS(ctxt, subctxt, va, rarr, npages, dma), |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 227 | TP_STRUCT__entry( |
| 228 | __field(unsigned, ctxt) |
| 229 | __field(u16, subctxt) |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 230 | __field(unsigned long, va) |
| 231 | __field(u32, rarr) |
| 232 | __field(u32, npages) |
| 233 | __field(dma_addr_t, dma) |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 234 | ), |
| 235 | TP_fast_assign( |
| 236 | __entry->ctxt = ctxt; |
| 237 | __entry->subctxt = subctxt; |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 238 | __entry->va = va; |
| 239 | __entry->rarr = rarr; |
| 240 | __entry->npages = npages; |
| 241 | __entry->dma = dma; |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 242 | ), |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 243 | TP_printk("[%u:%u] entry:%u, %u pages @ 0x%lx dma: 0x%llx", |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 244 | __entry->ctxt, |
| 245 | __entry->subctxt, |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 246 | __entry->rarr, |
| 247 | __entry->npages, |
| 248 | __entry->va, |
| 249 | __entry->dma |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 250 | ) |
| 251 | ); |
Mitko Haralanov | 0b091fb | 2016-02-05 11:57:58 -0500 | [diff] [blame] | 252 | |
| 253 | TRACE_EVENT(hfi1_mmu_invalidate, |
| 254 | TP_PROTO(unsigned 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, 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 | |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 280 | #undef TRACE_SYSTEM |
| 281 | #define TRACE_SYSTEM hfi1_tx |
| 282 | |
| 283 | TRACE_EVENT(hfi1_piofree, |
| 284 | TP_PROTO(struct send_context *sc, int extra), |
| 285 | TP_ARGS(sc, extra), |
| 286 | TP_STRUCT__entry( |
| 287 | DD_DEV_ENTRY(sc->dd) |
| 288 | __field(u32, sw_index) |
| 289 | __field(u32, hw_context) |
| 290 | __field(int, extra) |
| 291 | ), |
| 292 | TP_fast_assign( |
| 293 | DD_DEV_ASSIGN(sc->dd); |
| 294 | __entry->sw_index = sc->sw_index; |
| 295 | __entry->hw_context = sc->hw_context; |
| 296 | __entry->extra = extra; |
| 297 | ), |
| 298 | TP_printk( |
| 299 | "[%s] ctxt %u(%u) extra %d", |
| 300 | __get_str(dev), |
| 301 | __entry->sw_index, |
| 302 | __entry->hw_context, |
| 303 | __entry->extra |
| 304 | ) |
| 305 | ); |
| 306 | |
| 307 | TRACE_EVENT(hfi1_wantpiointr, |
| 308 | TP_PROTO(struct send_context *sc, u32 needint, u64 credit_ctrl), |
| 309 | TP_ARGS(sc, needint, credit_ctrl), |
| 310 | TP_STRUCT__entry( |
| 311 | DD_DEV_ENTRY(sc->dd) |
| 312 | __field(u32, sw_index) |
| 313 | __field(u32, hw_context) |
| 314 | __field(u32, needint) |
| 315 | __field(u64, credit_ctrl) |
| 316 | ), |
| 317 | TP_fast_assign( |
| 318 | DD_DEV_ASSIGN(sc->dd); |
| 319 | __entry->sw_index = sc->sw_index; |
| 320 | __entry->hw_context = sc->hw_context; |
| 321 | __entry->needint = needint; |
| 322 | __entry->credit_ctrl = credit_ctrl; |
| 323 | ), |
| 324 | TP_printk( |
| 325 | "[%s] ctxt %u(%u) on %d credit_ctrl 0x%llx", |
| 326 | __get_str(dev), |
| 327 | __entry->sw_index, |
| 328 | __entry->hw_context, |
| 329 | __entry->needint, |
| 330 | (unsigned long long)__entry->credit_ctrl |
| 331 | ) |
| 332 | ); |
| 333 | |
| 334 | DECLARE_EVENT_CLASS(hfi1_qpsleepwakeup_template, |
Dennis Dalessandro | 895420d | 2016-01-19 14:42:28 -0800 | [diff] [blame] | 335 | TP_PROTO(struct rvt_qp *qp, u32 flags), |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 336 | TP_ARGS(qp, flags), |
| 337 | TP_STRUCT__entry( |
| 338 | DD_DEV_ENTRY(dd_from_ibdev(qp->ibqp.device)) |
| 339 | __field(u32, qpn) |
| 340 | __field(u32, flags) |
| 341 | __field(u32, s_flags) |
| 342 | ), |
| 343 | TP_fast_assign( |
| 344 | DD_DEV_ASSIGN(dd_from_ibdev(qp->ibqp.device)) |
| 345 | __entry->flags = flags; |
| 346 | __entry->qpn = qp->ibqp.qp_num; |
| 347 | __entry->s_flags = qp->s_flags; |
| 348 | ), |
| 349 | TP_printk( |
| 350 | "[%s] qpn 0x%x flags 0x%x s_flags 0x%x", |
| 351 | __get_str(dev), |
| 352 | __entry->qpn, |
| 353 | __entry->flags, |
| 354 | __entry->s_flags |
| 355 | ) |
| 356 | ); |
| 357 | |
| 358 | DEFINE_EVENT(hfi1_qpsleepwakeup_template, hfi1_qpwakeup, |
Dennis Dalessandro | 895420d | 2016-01-19 14:42:28 -0800 | [diff] [blame] | 359 | TP_PROTO(struct rvt_qp *qp, u32 flags), |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 360 | TP_ARGS(qp, flags)); |
| 361 | |
| 362 | DEFINE_EVENT(hfi1_qpsleepwakeup_template, hfi1_qpsleep, |
Dennis Dalessandro | 895420d | 2016-01-19 14:42:28 -0800 | [diff] [blame] | 363 | TP_PROTO(struct rvt_qp *qp, u32 flags), |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 364 | TP_ARGS(qp, flags)); |
| 365 | |
| 366 | #undef TRACE_SYSTEM |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 367 | #define TRACE_SYSTEM hfi1_ibhdrs |
| 368 | |
| 369 | u8 ibhdr_exhdr_len(struct hfi1_ib_header *hdr); |
| 370 | const char *parse_everbs_hdrs( |
| 371 | struct trace_seq *p, |
| 372 | u8 opcode, |
| 373 | void *ehdrs); |
| 374 | |
| 375 | #define __parse_ib_ehdrs(op, ehdrs) parse_everbs_hdrs(p, op, ehdrs) |
| 376 | |
| 377 | const char *parse_sdma_flags( |
| 378 | struct trace_seq *p, |
| 379 | u64 desc0, u64 desc1); |
| 380 | |
| 381 | #define __parse_sdma_flags(desc0, desc1) parse_sdma_flags(p, desc0, desc1) |
| 382 | |
| 383 | |
| 384 | #define lrh_name(lrh) { HFI1_##lrh, #lrh } |
| 385 | #define show_lnh(lrh) \ |
| 386 | __print_symbolic(lrh, \ |
| 387 | lrh_name(LRH_BTH), \ |
| 388 | lrh_name(LRH_GRH)) |
| 389 | |
| 390 | #define ib_opcode_name(opcode) { IB_OPCODE_##opcode, #opcode } |
| 391 | #define show_ib_opcode(opcode) \ |
| 392 | __print_symbolic(opcode, \ |
| 393 | ib_opcode_name(RC_SEND_FIRST), \ |
| 394 | ib_opcode_name(RC_SEND_MIDDLE), \ |
| 395 | ib_opcode_name(RC_SEND_LAST), \ |
| 396 | ib_opcode_name(RC_SEND_LAST_WITH_IMMEDIATE), \ |
| 397 | ib_opcode_name(RC_SEND_ONLY), \ |
| 398 | ib_opcode_name(RC_SEND_ONLY_WITH_IMMEDIATE), \ |
| 399 | ib_opcode_name(RC_RDMA_WRITE_FIRST), \ |
| 400 | ib_opcode_name(RC_RDMA_WRITE_MIDDLE), \ |
| 401 | ib_opcode_name(RC_RDMA_WRITE_LAST), \ |
| 402 | ib_opcode_name(RC_RDMA_WRITE_LAST_WITH_IMMEDIATE), \ |
| 403 | ib_opcode_name(RC_RDMA_WRITE_ONLY), \ |
| 404 | ib_opcode_name(RC_RDMA_WRITE_ONLY_WITH_IMMEDIATE), \ |
| 405 | ib_opcode_name(RC_RDMA_READ_REQUEST), \ |
| 406 | ib_opcode_name(RC_RDMA_READ_RESPONSE_FIRST), \ |
| 407 | ib_opcode_name(RC_RDMA_READ_RESPONSE_MIDDLE), \ |
| 408 | ib_opcode_name(RC_RDMA_READ_RESPONSE_LAST), \ |
| 409 | ib_opcode_name(RC_RDMA_READ_RESPONSE_ONLY), \ |
| 410 | ib_opcode_name(RC_ACKNOWLEDGE), \ |
| 411 | ib_opcode_name(RC_ATOMIC_ACKNOWLEDGE), \ |
| 412 | ib_opcode_name(RC_COMPARE_SWAP), \ |
| 413 | ib_opcode_name(RC_FETCH_ADD), \ |
| 414 | ib_opcode_name(UC_SEND_FIRST), \ |
| 415 | ib_opcode_name(UC_SEND_MIDDLE), \ |
| 416 | ib_opcode_name(UC_SEND_LAST), \ |
| 417 | ib_opcode_name(UC_SEND_LAST_WITH_IMMEDIATE), \ |
| 418 | ib_opcode_name(UC_SEND_ONLY), \ |
| 419 | ib_opcode_name(UC_SEND_ONLY_WITH_IMMEDIATE), \ |
| 420 | ib_opcode_name(UC_RDMA_WRITE_FIRST), \ |
| 421 | ib_opcode_name(UC_RDMA_WRITE_MIDDLE), \ |
| 422 | ib_opcode_name(UC_RDMA_WRITE_LAST), \ |
| 423 | ib_opcode_name(UC_RDMA_WRITE_LAST_WITH_IMMEDIATE), \ |
| 424 | ib_opcode_name(UC_RDMA_WRITE_ONLY), \ |
| 425 | ib_opcode_name(UC_RDMA_WRITE_ONLY_WITH_IMMEDIATE), \ |
| 426 | ib_opcode_name(UD_SEND_ONLY), \ |
Dean Luick | 93990be | 2015-12-01 15:38:11 -0500 | [diff] [blame] | 427 | ib_opcode_name(UD_SEND_ONLY_WITH_IMMEDIATE), \ |
| 428 | ib_opcode_name(CNP)) |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 429 | |
| 430 | |
| 431 | #define LRH_PRN "vl %d lver %d sl %d lnh %d,%s dlid %.4x len %d slid %.4x" |
| 432 | #define BTH_PRN \ |
| 433 | "op 0x%.2x,%s se %d m %d pad %d tver %d pkey 0x%.4x " \ |
| 434 | "f %d b %d qpn 0x%.6x a %d psn 0x%.8x" |
| 435 | #define EHDR_PRN "%s" |
| 436 | |
| 437 | DECLARE_EVENT_CLASS(hfi1_ibhdr_template, |
| 438 | TP_PROTO(struct hfi1_devdata *dd, |
| 439 | struct hfi1_ib_header *hdr), |
| 440 | TP_ARGS(dd, hdr), |
| 441 | TP_STRUCT__entry( |
| 442 | DD_DEV_ENTRY(dd) |
| 443 | /* LRH */ |
| 444 | __field(u8, vl) |
| 445 | __field(u8, lver) |
| 446 | __field(u8, sl) |
| 447 | __field(u8, lnh) |
| 448 | __field(u16, dlid) |
| 449 | __field(u16, len) |
| 450 | __field(u16, slid) |
| 451 | /* BTH */ |
| 452 | __field(u8, opcode) |
| 453 | __field(u8, se) |
| 454 | __field(u8, m) |
| 455 | __field(u8, pad) |
| 456 | __field(u8, tver) |
| 457 | __field(u16, pkey) |
| 458 | __field(u8, f) |
| 459 | __field(u8, b) |
| 460 | __field(u32, qpn) |
| 461 | __field(u8, a) |
| 462 | __field(u32, psn) |
| 463 | /* extended headers */ |
| 464 | __dynamic_array(u8, ehdrs, ibhdr_exhdr_len(hdr)) |
| 465 | ), |
| 466 | TP_fast_assign( |
| 467 | struct hfi1_other_headers *ohdr; |
| 468 | |
| 469 | DD_DEV_ASSIGN(dd); |
| 470 | /* LRH */ |
| 471 | __entry->vl = |
| 472 | (u8)(be16_to_cpu(hdr->lrh[0]) >> 12); |
| 473 | __entry->lver = |
| 474 | (u8)(be16_to_cpu(hdr->lrh[0]) >> 8) & 0xf; |
| 475 | __entry->sl = |
| 476 | (u8)(be16_to_cpu(hdr->lrh[0]) >> 4) & 0xf; |
| 477 | __entry->lnh = |
| 478 | (u8)(be16_to_cpu(hdr->lrh[0]) & 3); |
| 479 | __entry->dlid = |
| 480 | be16_to_cpu(hdr->lrh[1]); |
| 481 | /* allow for larger len */ |
| 482 | __entry->len = |
| 483 | be16_to_cpu(hdr->lrh[2]); |
| 484 | __entry->slid = |
| 485 | be16_to_cpu(hdr->lrh[3]); |
| 486 | /* BTH */ |
| 487 | if (__entry->lnh == HFI1_LRH_BTH) |
| 488 | ohdr = &hdr->u.oth; |
| 489 | else |
| 490 | ohdr = &hdr->u.l.oth; |
| 491 | __entry->opcode = |
| 492 | (be32_to_cpu(ohdr->bth[0]) >> 24) & 0xff; |
| 493 | __entry->se = |
| 494 | (be32_to_cpu(ohdr->bth[0]) >> 23) & 1; |
| 495 | __entry->m = |
| 496 | (be32_to_cpu(ohdr->bth[0]) >> 22) & 1; |
| 497 | __entry->pad = |
| 498 | (be32_to_cpu(ohdr->bth[0]) >> 20) & 3; |
| 499 | __entry->tver = |
| 500 | (be32_to_cpu(ohdr->bth[0]) >> 16) & 0xf; |
| 501 | __entry->pkey = |
| 502 | be32_to_cpu(ohdr->bth[0]) & 0xffff; |
| 503 | __entry->f = |
| 504 | (be32_to_cpu(ohdr->bth[1]) >> HFI1_FECN_SHIFT) |
| 505 | & HFI1_FECN_MASK; |
| 506 | __entry->b = |
| 507 | (be32_to_cpu(ohdr->bth[1]) >> HFI1_BECN_SHIFT) |
| 508 | & HFI1_BECN_MASK; |
| 509 | __entry->qpn = |
Dennis Dalessandro | ec4274f | 2016-01-19 14:43:44 -0800 | [diff] [blame] | 510 | be32_to_cpu(ohdr->bth[1]) & RVT_QPN_MASK; |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 511 | __entry->a = |
| 512 | (be32_to_cpu(ohdr->bth[2]) >> 31) & 1; |
| 513 | /* allow for larger PSN */ |
| 514 | __entry->psn = |
| 515 | be32_to_cpu(ohdr->bth[2]) & 0x7fffffff; |
| 516 | /* extended headers */ |
| 517 | memcpy( |
| 518 | __get_dynamic_array(ehdrs), |
| 519 | &ohdr->u, |
| 520 | ibhdr_exhdr_len(hdr)); |
| 521 | ), |
| 522 | TP_printk("[%s] " LRH_PRN " " BTH_PRN " " EHDR_PRN, |
| 523 | __get_str(dev), |
| 524 | /* LRH */ |
| 525 | __entry->vl, |
| 526 | __entry->lver, |
| 527 | __entry->sl, |
| 528 | __entry->lnh, show_lnh(__entry->lnh), |
| 529 | __entry->dlid, |
| 530 | __entry->len, |
| 531 | __entry->slid, |
| 532 | /* BTH */ |
| 533 | __entry->opcode, show_ib_opcode(__entry->opcode), |
| 534 | __entry->se, |
| 535 | __entry->m, |
| 536 | __entry->pad, |
| 537 | __entry->tver, |
| 538 | __entry->pkey, |
| 539 | __entry->f, |
| 540 | __entry->b, |
| 541 | __entry->qpn, |
| 542 | __entry->a, |
| 543 | __entry->psn, |
| 544 | /* extended headers */ |
| 545 | __parse_ib_ehdrs( |
| 546 | __entry->opcode, |
| 547 | (void *)__get_dynamic_array(ehdrs)) |
| 548 | ) |
| 549 | ); |
| 550 | |
| 551 | DEFINE_EVENT(hfi1_ibhdr_template, input_ibhdr, |
| 552 | TP_PROTO(struct hfi1_devdata *dd, struct hfi1_ib_header *hdr), |
| 553 | TP_ARGS(dd, hdr)); |
| 554 | |
| 555 | DEFINE_EVENT(hfi1_ibhdr_template, output_ibhdr, |
| 556 | TP_PROTO(struct hfi1_devdata *dd, struct hfi1_ib_header *hdr), |
| 557 | TP_ARGS(dd, hdr)); |
| 558 | |
| 559 | #define SNOOP_PRN \ |
| 560 | "slid %.4x dlid %.4x qpn 0x%.6x opcode 0x%.2x,%s " \ |
| 561 | "svc lvl %d pkey 0x%.4x [header = %d bytes] [data = %d bytes]" |
| 562 | |
| 563 | #undef TRACE_SYSTEM |
| 564 | #define TRACE_SYSTEM hfi1_snoop |
| 565 | |
| 566 | |
| 567 | TRACE_EVENT(snoop_capture, |
| 568 | TP_PROTO(struct hfi1_devdata *dd, |
| 569 | int hdr_len, |
| 570 | struct hfi1_ib_header *hdr, |
| 571 | int data_len, |
| 572 | void *data), |
| 573 | TP_ARGS(dd, hdr_len, hdr, data_len, data), |
| 574 | TP_STRUCT__entry( |
| 575 | DD_DEV_ENTRY(dd) |
| 576 | __field(u16, slid) |
| 577 | __field(u16, dlid) |
| 578 | __field(u32, qpn) |
| 579 | __field(u8, opcode) |
| 580 | __field(u8, sl) |
| 581 | __field(u16, pkey) |
| 582 | __field(u32, hdr_len) |
| 583 | __field(u32, data_len) |
| 584 | __field(u8, lnh) |
| 585 | __dynamic_array(u8, raw_hdr, hdr_len) |
| 586 | __dynamic_array(u8, raw_pkt, data_len) |
| 587 | ), |
| 588 | TP_fast_assign( |
| 589 | struct hfi1_other_headers *ohdr; |
| 590 | |
| 591 | __entry->lnh = (u8)(be16_to_cpu(hdr->lrh[0]) & 3); |
| 592 | if (__entry->lnh == HFI1_LRH_BTH) |
| 593 | ohdr = &hdr->u.oth; |
| 594 | else |
| 595 | ohdr = &hdr->u.l.oth; |
| 596 | DD_DEV_ASSIGN(dd); |
| 597 | __entry->slid = be16_to_cpu(hdr->lrh[3]); |
| 598 | __entry->dlid = be16_to_cpu(hdr->lrh[1]); |
Dennis Dalessandro | ec4274f | 2016-01-19 14:43:44 -0800 | [diff] [blame] | 599 | __entry->qpn = be32_to_cpu(ohdr->bth[1]) & RVT_QPN_MASK; |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 600 | __entry->opcode = (be32_to_cpu(ohdr->bth[0]) >> 24) & 0xff; |
| 601 | __entry->sl = (u8)(be16_to_cpu(hdr->lrh[0]) >> 4) & 0xf; |
| 602 | __entry->pkey = be32_to_cpu(ohdr->bth[0]) & 0xffff; |
| 603 | __entry->hdr_len = hdr_len; |
| 604 | __entry->data_len = data_len; |
| 605 | memcpy(__get_dynamic_array(raw_hdr), hdr, hdr_len); |
| 606 | memcpy(__get_dynamic_array(raw_pkt), data, data_len); |
| 607 | ), |
| 608 | TP_printk("[%s] " SNOOP_PRN, |
| 609 | __get_str(dev), |
| 610 | __entry->slid, |
| 611 | __entry->dlid, |
| 612 | __entry->qpn, |
| 613 | __entry->opcode, |
| 614 | show_ib_opcode(__entry->opcode), |
| 615 | __entry->sl, |
| 616 | __entry->pkey, |
| 617 | __entry->hdr_len, |
| 618 | __entry->data_len |
| 619 | ) |
| 620 | ); |
| 621 | |
| 622 | #undef TRACE_SYSTEM |
| 623 | #define TRACE_SYSTEM hfi1_ctxts |
| 624 | |
| 625 | #define UCTXT_FMT \ |
| 626 | "cred:%u, credaddr:0x%llx, piobase:0x%llx, rcvhdr_cnt:%u, " \ |
| 627 | "rcvbase:0x%llx, rcvegrc:%u, rcvegrb:0x%llx" |
| 628 | TRACE_EVENT(hfi1_uctxtdata, |
| 629 | TP_PROTO(struct hfi1_devdata *dd, struct hfi1_ctxtdata *uctxt), |
| 630 | TP_ARGS(dd, uctxt), |
| 631 | TP_STRUCT__entry( |
| 632 | DD_DEV_ENTRY(dd) |
| 633 | __field(unsigned, ctxt) |
| 634 | __field(u32, credits) |
| 635 | __field(u64, hw_free) |
| 636 | __field(u64, piobase) |
| 637 | __field(u16, rcvhdrq_cnt) |
| 638 | __field(u64, rcvhdrq_phys) |
| 639 | __field(u32, eager_cnt) |
| 640 | __field(u64, rcvegr_phys) |
| 641 | ), |
| 642 | TP_fast_assign( |
| 643 | DD_DEV_ASSIGN(dd); |
| 644 | __entry->ctxt = uctxt->ctxt; |
| 645 | __entry->credits = uctxt->sc->credits; |
| 646 | __entry->hw_free = (u64)uctxt->sc->hw_free; |
| 647 | __entry->piobase = (u64)uctxt->sc->base_addr; |
| 648 | __entry->rcvhdrq_cnt = uctxt->rcvhdrq_cnt; |
| 649 | __entry->rcvhdrq_phys = uctxt->rcvhdrq_phys; |
| 650 | __entry->eager_cnt = uctxt->egrbufs.alloced; |
| 651 | __entry->rcvegr_phys = uctxt->egrbufs.rcvtids[0].phys; |
| 652 | ), |
| 653 | TP_printk( |
| 654 | "[%s] ctxt %u " UCTXT_FMT, |
| 655 | __get_str(dev), |
| 656 | __entry->ctxt, |
| 657 | __entry->credits, |
| 658 | __entry->hw_free, |
| 659 | __entry->piobase, |
| 660 | __entry->rcvhdrq_cnt, |
| 661 | __entry->rcvhdrq_phys, |
| 662 | __entry->eager_cnt, |
| 663 | __entry->rcvegr_phys |
| 664 | ) |
| 665 | ); |
| 666 | |
| 667 | #define CINFO_FMT \ |
| 668 | "egrtids:%u, egr_size:%u, hdrq_cnt:%u, hdrq_size:%u, sdma_ring_size:%u" |
| 669 | TRACE_EVENT(hfi1_ctxt_info, |
| 670 | TP_PROTO(struct hfi1_devdata *dd, unsigned ctxt, unsigned subctxt, |
| 671 | struct hfi1_ctxt_info cinfo), |
| 672 | TP_ARGS(dd, ctxt, subctxt, cinfo), |
| 673 | TP_STRUCT__entry( |
| 674 | DD_DEV_ENTRY(dd) |
| 675 | __field(unsigned, ctxt) |
| 676 | __field(unsigned, subctxt) |
| 677 | __field(u16, egrtids) |
| 678 | __field(u16, rcvhdrq_cnt) |
| 679 | __field(u16, rcvhdrq_size) |
| 680 | __field(u16, sdma_ring_size) |
| 681 | __field(u32, rcvegr_size) |
| 682 | ), |
| 683 | TP_fast_assign( |
| 684 | DD_DEV_ASSIGN(dd); |
| 685 | __entry->ctxt = ctxt; |
| 686 | __entry->subctxt = subctxt; |
| 687 | __entry->egrtids = cinfo.egrtids; |
| 688 | __entry->rcvhdrq_cnt = cinfo.rcvhdrq_cnt; |
| 689 | __entry->rcvhdrq_size = cinfo.rcvhdrq_entsize; |
| 690 | __entry->sdma_ring_size = cinfo.sdma_ring_size; |
| 691 | __entry->rcvegr_size = cinfo.rcvegr_size; |
| 692 | ), |
| 693 | TP_printk( |
| 694 | "[%s] ctxt %u:%u " CINFO_FMT, |
| 695 | __get_str(dev), |
| 696 | __entry->ctxt, |
| 697 | __entry->subctxt, |
| 698 | __entry->egrtids, |
| 699 | __entry->rcvegr_size, |
| 700 | __entry->rcvhdrq_cnt, |
| 701 | __entry->rcvhdrq_size, |
| 702 | __entry->sdma_ring_size |
| 703 | ) |
| 704 | ); |
| 705 | |
| 706 | #undef TRACE_SYSTEM |
| 707 | #define TRACE_SYSTEM hfi1_sma |
| 708 | |
| 709 | #define BCT_FORMAT \ |
| 710 | "shared_limit %x vls 0-7 [%x,%x][%x,%x][%x,%x][%x,%x][%x,%x][%x,%x][%x,%x][%x,%x] 15 [%x,%x]" |
| 711 | |
| 712 | #define BCT(field) \ |
| 713 | be16_to_cpu( \ |
| 714 | ((struct buffer_control *)__get_dynamic_array(bct))->field \ |
| 715 | ) |
| 716 | |
| 717 | DECLARE_EVENT_CLASS(hfi1_bct_template, |
| 718 | TP_PROTO(struct hfi1_devdata *dd, struct buffer_control *bc), |
| 719 | TP_ARGS(dd, bc), |
| 720 | TP_STRUCT__entry( |
| 721 | DD_DEV_ENTRY(dd) |
| 722 | __dynamic_array(u8, bct, sizeof(*bc)) |
| 723 | ), |
| 724 | TP_fast_assign( |
| 725 | DD_DEV_ASSIGN(dd); |
| 726 | memcpy( |
| 727 | __get_dynamic_array(bct), |
| 728 | bc, |
| 729 | sizeof(*bc)); |
| 730 | ), |
| 731 | TP_printk(BCT_FORMAT, |
| 732 | BCT(overall_shared_limit), |
| 733 | |
| 734 | BCT(vl[0].dedicated), |
| 735 | BCT(vl[0].shared), |
| 736 | |
| 737 | BCT(vl[1].dedicated), |
| 738 | BCT(vl[1].shared), |
| 739 | |
| 740 | BCT(vl[2].dedicated), |
| 741 | BCT(vl[2].shared), |
| 742 | |
| 743 | BCT(vl[3].dedicated), |
| 744 | BCT(vl[3].shared), |
| 745 | |
| 746 | BCT(vl[4].dedicated), |
| 747 | BCT(vl[4].shared), |
| 748 | |
| 749 | BCT(vl[5].dedicated), |
| 750 | BCT(vl[5].shared), |
| 751 | |
| 752 | BCT(vl[6].dedicated), |
| 753 | BCT(vl[6].shared), |
| 754 | |
| 755 | BCT(vl[7].dedicated), |
| 756 | BCT(vl[7].shared), |
| 757 | |
| 758 | BCT(vl[15].dedicated), |
| 759 | BCT(vl[15].shared) |
| 760 | ) |
| 761 | ); |
| 762 | |
| 763 | |
| 764 | DEFINE_EVENT(hfi1_bct_template, bct_set, |
| 765 | TP_PROTO(struct hfi1_devdata *dd, struct buffer_control *bc), |
| 766 | TP_ARGS(dd, bc)); |
| 767 | |
| 768 | DEFINE_EVENT(hfi1_bct_template, bct_get, |
| 769 | TP_PROTO(struct hfi1_devdata *dd, struct buffer_control *bc), |
| 770 | TP_ARGS(dd, bc)); |
| 771 | |
| 772 | #undef TRACE_SYSTEM |
| 773 | #define TRACE_SYSTEM hfi1_sdma |
| 774 | |
| 775 | TRACE_EVENT(hfi1_sdma_descriptor, |
| 776 | TP_PROTO( |
| 777 | struct sdma_engine *sde, |
| 778 | u64 desc0, |
| 779 | u64 desc1, |
| 780 | u16 e, |
| 781 | void *descp), |
| 782 | TP_ARGS(sde, desc0, desc1, e, descp), |
| 783 | TP_STRUCT__entry( |
| 784 | DD_DEV_ENTRY(sde->dd) |
| 785 | __field(void *, descp) |
| 786 | __field(u64, desc0) |
| 787 | __field(u64, desc1) |
| 788 | __field(u16, e) |
| 789 | __field(u8, idx) |
| 790 | ), |
| 791 | TP_fast_assign( |
| 792 | DD_DEV_ASSIGN(sde->dd); |
| 793 | __entry->desc0 = desc0; |
| 794 | __entry->desc1 = desc1; |
| 795 | __entry->idx = sde->this_idx; |
| 796 | __entry->descp = descp; |
| 797 | __entry->e = e; |
| 798 | ), |
| 799 | TP_printk( |
| 800 | "[%s] SDE(%u) flags:%s addr:0x%016llx gen:%u len:%u d0:%016llx d1:%016llx to %p,%u", |
| 801 | __get_str(dev), |
| 802 | __entry->idx, |
| 803 | __parse_sdma_flags(__entry->desc0, __entry->desc1), |
| 804 | (__entry->desc0 >> SDMA_DESC0_PHY_ADDR_SHIFT) |
| 805 | & SDMA_DESC0_PHY_ADDR_MASK, |
| 806 | (u8)((__entry->desc1 >> SDMA_DESC1_GENERATION_SHIFT) |
| 807 | & SDMA_DESC1_GENERATION_MASK), |
| 808 | (u16)((__entry->desc0 >> SDMA_DESC0_BYTE_COUNT_SHIFT) |
| 809 | & SDMA_DESC0_BYTE_COUNT_MASK), |
| 810 | __entry->desc0, |
| 811 | __entry->desc1, |
| 812 | __entry->descp, |
| 813 | __entry->e |
| 814 | ) |
| 815 | ); |
| 816 | |
| 817 | TRACE_EVENT(hfi1_sdma_engine_select, |
| 818 | TP_PROTO(struct hfi1_devdata *dd, u32 sel, u8 vl, u8 idx), |
| 819 | TP_ARGS(dd, sel, vl, idx), |
| 820 | TP_STRUCT__entry( |
| 821 | DD_DEV_ENTRY(dd) |
| 822 | __field(u32, sel) |
| 823 | __field(u8, vl) |
| 824 | __field(u8, idx) |
| 825 | ), |
| 826 | TP_fast_assign( |
| 827 | DD_DEV_ASSIGN(dd); |
| 828 | __entry->sel = sel; |
| 829 | __entry->vl = vl; |
| 830 | __entry->idx = idx; |
| 831 | ), |
| 832 | TP_printk( |
| 833 | "[%s] selecting SDE %u sel 0x%x vl %u", |
| 834 | __get_str(dev), |
| 835 | __entry->idx, |
| 836 | __entry->sel, |
| 837 | __entry->vl |
| 838 | ) |
| 839 | ); |
| 840 | |
| 841 | DECLARE_EVENT_CLASS(hfi1_sdma_engine_class, |
| 842 | TP_PROTO( |
| 843 | struct sdma_engine *sde, |
| 844 | u64 status |
| 845 | ), |
| 846 | TP_ARGS(sde, status), |
| 847 | TP_STRUCT__entry( |
| 848 | DD_DEV_ENTRY(sde->dd) |
| 849 | __field(u64, status) |
| 850 | __field(u8, idx) |
| 851 | ), |
| 852 | TP_fast_assign( |
| 853 | DD_DEV_ASSIGN(sde->dd); |
| 854 | __entry->status = status; |
| 855 | __entry->idx = sde->this_idx; |
| 856 | ), |
| 857 | TP_printk( |
| 858 | "[%s] SDE(%u) status %llx", |
| 859 | __get_str(dev), |
| 860 | __entry->idx, |
| 861 | (unsigned long long)__entry->status |
| 862 | ) |
| 863 | ); |
| 864 | |
| 865 | DEFINE_EVENT(hfi1_sdma_engine_class, hfi1_sdma_engine_interrupt, |
| 866 | TP_PROTO( |
| 867 | struct sdma_engine *sde, |
| 868 | u64 status |
| 869 | ), |
| 870 | TP_ARGS(sde, status) |
| 871 | ); |
| 872 | |
| 873 | DEFINE_EVENT(hfi1_sdma_engine_class, hfi1_sdma_engine_progress, |
| 874 | TP_PROTO( |
| 875 | struct sdma_engine *sde, |
| 876 | u64 status |
| 877 | ), |
| 878 | TP_ARGS(sde, status) |
| 879 | ); |
| 880 | |
| 881 | DECLARE_EVENT_CLASS(hfi1_sdma_ahg_ad, |
| 882 | TP_PROTO( |
| 883 | struct sdma_engine *sde, |
| 884 | int aidx |
| 885 | ), |
| 886 | TP_ARGS(sde, aidx), |
| 887 | TP_STRUCT__entry( |
| 888 | DD_DEV_ENTRY(sde->dd) |
| 889 | __field(int, aidx) |
| 890 | __field(u8, idx) |
| 891 | ), |
| 892 | TP_fast_assign( |
| 893 | DD_DEV_ASSIGN(sde->dd); |
| 894 | __entry->idx = sde->this_idx; |
| 895 | __entry->aidx = aidx; |
| 896 | ), |
| 897 | TP_printk( |
| 898 | "[%s] SDE(%u) aidx %d", |
| 899 | __get_str(dev), |
| 900 | __entry->idx, |
| 901 | __entry->aidx |
| 902 | ) |
| 903 | ); |
| 904 | |
| 905 | DEFINE_EVENT(hfi1_sdma_ahg_ad, hfi1_ahg_allocate, |
| 906 | TP_PROTO( |
| 907 | struct sdma_engine *sde, |
| 908 | int aidx |
| 909 | ), |
| 910 | TP_ARGS(sde, aidx)); |
| 911 | |
| 912 | DEFINE_EVENT(hfi1_sdma_ahg_ad, hfi1_ahg_deallocate, |
| 913 | TP_PROTO( |
| 914 | struct sdma_engine *sde, |
| 915 | int aidx |
| 916 | ), |
| 917 | TP_ARGS(sde, aidx)); |
| 918 | |
| 919 | #ifdef CONFIG_HFI1_DEBUG_SDMA_ORDER |
| 920 | TRACE_EVENT(hfi1_sdma_progress, |
| 921 | TP_PROTO( |
| 922 | struct sdma_engine *sde, |
| 923 | u16 hwhead, |
| 924 | u16 swhead, |
| 925 | struct sdma_txreq *txp |
| 926 | ), |
| 927 | TP_ARGS(sde, hwhead, swhead, txp), |
| 928 | TP_STRUCT__entry( |
| 929 | DD_DEV_ENTRY(sde->dd) |
| 930 | __field(u64, sn) |
| 931 | __field(u16, hwhead) |
| 932 | __field(u16, swhead) |
| 933 | __field(u16, txnext) |
| 934 | __field(u16, tx_tail) |
| 935 | __field(u16, tx_head) |
| 936 | __field(u8, idx) |
| 937 | ), |
| 938 | TP_fast_assign( |
| 939 | DD_DEV_ASSIGN(sde->dd); |
| 940 | __entry->hwhead = hwhead; |
| 941 | __entry->swhead = swhead; |
| 942 | __entry->tx_tail = sde->tx_tail; |
| 943 | __entry->tx_head = sde->tx_head; |
| 944 | __entry->txnext = txp ? txp->next_descq_idx : ~0; |
| 945 | __entry->idx = sde->this_idx; |
| 946 | __entry->sn = txp ? txp->sn : ~0; |
| 947 | ), |
| 948 | TP_printk( |
| 949 | "[%s] SDE(%u) sn %llu hwhead %u swhead %u next_descq_idx %u tx_head %u tx_tail %u", |
| 950 | __get_str(dev), |
| 951 | __entry->idx, |
| 952 | __entry->sn, |
| 953 | __entry->hwhead, |
| 954 | __entry->swhead, |
| 955 | __entry->txnext, |
| 956 | __entry->tx_head, |
| 957 | __entry->tx_tail |
| 958 | ) |
| 959 | ); |
| 960 | #else |
| 961 | TRACE_EVENT(hfi1_sdma_progress, |
| 962 | TP_PROTO( |
| 963 | struct sdma_engine *sde, |
| 964 | u16 hwhead, |
| 965 | u16 swhead, |
| 966 | struct sdma_txreq *txp |
| 967 | ), |
| 968 | TP_ARGS(sde, hwhead, swhead, txp), |
| 969 | TP_STRUCT__entry( |
| 970 | DD_DEV_ENTRY(sde->dd) |
| 971 | __field(u16, hwhead) |
| 972 | __field(u16, swhead) |
| 973 | __field(u16, txnext) |
| 974 | __field(u16, tx_tail) |
| 975 | __field(u16, tx_head) |
| 976 | __field(u8, idx) |
| 977 | ), |
| 978 | TP_fast_assign( |
| 979 | DD_DEV_ASSIGN(sde->dd); |
| 980 | __entry->hwhead = hwhead; |
| 981 | __entry->swhead = swhead; |
| 982 | __entry->tx_tail = sde->tx_tail; |
| 983 | __entry->tx_head = sde->tx_head; |
| 984 | __entry->txnext = txp ? txp->next_descq_idx : ~0; |
| 985 | __entry->idx = sde->this_idx; |
| 986 | ), |
| 987 | TP_printk( |
| 988 | "[%s] SDE(%u) hwhead %u swhead %u next_descq_idx %u tx_head %u tx_tail %u", |
| 989 | __get_str(dev), |
| 990 | __entry->idx, |
| 991 | __entry->hwhead, |
| 992 | __entry->swhead, |
| 993 | __entry->txnext, |
| 994 | __entry->tx_head, |
| 995 | __entry->tx_tail |
| 996 | ) |
| 997 | ); |
| 998 | #endif |
| 999 | |
| 1000 | DECLARE_EVENT_CLASS(hfi1_sdma_sn, |
| 1001 | TP_PROTO( |
| 1002 | struct sdma_engine *sde, |
| 1003 | u64 sn |
| 1004 | ), |
| 1005 | TP_ARGS(sde, sn), |
| 1006 | TP_STRUCT__entry( |
| 1007 | DD_DEV_ENTRY(sde->dd) |
| 1008 | __field(u64, sn) |
| 1009 | __field(u8, idx) |
| 1010 | ), |
| 1011 | TP_fast_assign( |
| 1012 | DD_DEV_ASSIGN(sde->dd); |
| 1013 | __entry->sn = sn; |
| 1014 | __entry->idx = sde->this_idx; |
| 1015 | ), |
| 1016 | TP_printk( |
| 1017 | "[%s] SDE(%u) sn %llu", |
| 1018 | __get_str(dev), |
| 1019 | __entry->idx, |
| 1020 | __entry->sn |
| 1021 | ) |
| 1022 | ); |
| 1023 | |
| 1024 | DEFINE_EVENT(hfi1_sdma_sn, hfi1_sdma_out_sn, |
| 1025 | TP_PROTO( |
| 1026 | struct sdma_engine *sde, |
| 1027 | u64 sn |
| 1028 | ), |
| 1029 | TP_ARGS(sde, sn) |
| 1030 | ); |
| 1031 | |
| 1032 | DEFINE_EVENT(hfi1_sdma_sn, hfi1_sdma_in_sn, |
| 1033 | TP_PROTO( |
| 1034 | struct sdma_engine *sde, |
| 1035 | u64 sn |
| 1036 | ), |
| 1037 | TP_ARGS(sde, sn) |
| 1038 | ); |
| 1039 | |
| 1040 | #define USDMA_HDR_FORMAT \ |
| 1041 | "[%s:%u:%u:%u] PBC=(0x%x 0x%x) LRH=(0x%x 0x%x) BTH=(0x%x 0x%x 0x%x) KDETH=(0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x) TIDVal=0x%x" |
| 1042 | |
| 1043 | TRACE_EVENT(hfi1_sdma_user_header, |
| 1044 | TP_PROTO(struct hfi1_devdata *dd, u16 ctxt, u8 subctxt, u16 req, |
| 1045 | struct hfi1_pkt_header *hdr, u32 tidval), |
| 1046 | TP_ARGS(dd, ctxt, subctxt, req, hdr, tidval), |
| 1047 | TP_STRUCT__entry( |
| 1048 | DD_DEV_ENTRY(dd) |
| 1049 | __field(u16, ctxt) |
| 1050 | __field(u8, subctxt) |
| 1051 | __field(u16, req) |
| 1052 | __field(__le32, pbc0) |
| 1053 | __field(__le32, pbc1) |
| 1054 | __field(__be32, lrh0) |
| 1055 | __field(__be32, lrh1) |
| 1056 | __field(__be32, bth0) |
| 1057 | __field(__be32, bth1) |
| 1058 | __field(__be32, bth2) |
| 1059 | __field(__le32, kdeth0) |
| 1060 | __field(__le32, kdeth1) |
| 1061 | __field(__le32, kdeth2) |
| 1062 | __field(__le32, kdeth3) |
| 1063 | __field(__le32, kdeth4) |
| 1064 | __field(__le32, kdeth5) |
| 1065 | __field(__le32, kdeth6) |
| 1066 | __field(__le32, kdeth7) |
| 1067 | __field(__le32, kdeth8) |
| 1068 | __field(u32, tidval) |
| 1069 | ), |
| 1070 | TP_fast_assign( |
| 1071 | __le32 *pbc = (__le32 *)hdr->pbc; |
| 1072 | __be32 *lrh = (__be32 *)hdr->lrh; |
| 1073 | __be32 *bth = (__be32 *)hdr->bth; |
| 1074 | __le32 *kdeth = (__le32 *)&hdr->kdeth; |
| 1075 | |
| 1076 | DD_DEV_ASSIGN(dd); |
| 1077 | __entry->ctxt = ctxt; |
| 1078 | __entry->subctxt = subctxt; |
| 1079 | __entry->req = req; |
| 1080 | __entry->pbc0 = pbc[0]; |
| 1081 | __entry->pbc1 = pbc[1]; |
| 1082 | __entry->lrh0 = be32_to_cpu(lrh[0]); |
| 1083 | __entry->lrh1 = be32_to_cpu(lrh[1]); |
| 1084 | __entry->bth0 = be32_to_cpu(bth[0]); |
| 1085 | __entry->bth1 = be32_to_cpu(bth[1]); |
| 1086 | __entry->bth2 = be32_to_cpu(bth[2]); |
| 1087 | __entry->kdeth0 = kdeth[0]; |
| 1088 | __entry->kdeth1 = kdeth[1]; |
| 1089 | __entry->kdeth2 = kdeth[2]; |
| 1090 | __entry->kdeth3 = kdeth[3]; |
| 1091 | __entry->kdeth4 = kdeth[4]; |
| 1092 | __entry->kdeth5 = kdeth[5]; |
| 1093 | __entry->kdeth6 = kdeth[6]; |
| 1094 | __entry->kdeth7 = kdeth[7]; |
| 1095 | __entry->kdeth8 = kdeth[8]; |
| 1096 | __entry->tidval = tidval; |
| 1097 | ), |
| 1098 | TP_printk(USDMA_HDR_FORMAT, |
| 1099 | __get_str(dev), |
| 1100 | __entry->ctxt, |
| 1101 | __entry->subctxt, |
| 1102 | __entry->req, |
| 1103 | __entry->pbc1, |
| 1104 | __entry->pbc0, |
| 1105 | __entry->lrh0, |
| 1106 | __entry->lrh1, |
| 1107 | __entry->bth0, |
| 1108 | __entry->bth1, |
| 1109 | __entry->bth2, |
| 1110 | __entry->kdeth0, |
| 1111 | __entry->kdeth1, |
| 1112 | __entry->kdeth2, |
| 1113 | __entry->kdeth3, |
| 1114 | __entry->kdeth4, |
| 1115 | __entry->kdeth5, |
| 1116 | __entry->kdeth6, |
| 1117 | __entry->kdeth7, |
| 1118 | __entry->kdeth8, |
| 1119 | __entry->tidval |
| 1120 | ) |
| 1121 | ); |
| 1122 | |
| 1123 | #define SDMA_UREQ_FMT \ |
| 1124 | "[%s:%u:%u] ver/op=0x%x, iovcnt=%u, npkts=%u, frag=%u, idx=%u" |
| 1125 | TRACE_EVENT(hfi1_sdma_user_reqinfo, |
| 1126 | TP_PROTO(struct hfi1_devdata *dd, u16 ctxt, u8 subctxt, u16 *i), |
| 1127 | TP_ARGS(dd, ctxt, subctxt, i), |
| 1128 | TP_STRUCT__entry( |
| 1129 | DD_DEV_ENTRY(dd); |
| 1130 | __field(u16, ctxt) |
| 1131 | __field(u8, subctxt) |
| 1132 | __field(u8, ver_opcode) |
| 1133 | __field(u8, iovcnt) |
| 1134 | __field(u16, npkts) |
| 1135 | __field(u16, fragsize) |
| 1136 | __field(u16, comp_idx) |
| 1137 | ), |
| 1138 | TP_fast_assign( |
| 1139 | DD_DEV_ASSIGN(dd); |
| 1140 | __entry->ctxt = ctxt; |
| 1141 | __entry->subctxt = subctxt; |
| 1142 | __entry->ver_opcode = i[0] & 0xff; |
| 1143 | __entry->iovcnt = (i[0] >> 8) & 0xff; |
| 1144 | __entry->npkts = i[1]; |
| 1145 | __entry->fragsize = i[2]; |
| 1146 | __entry->comp_idx = i[3]; |
| 1147 | ), |
| 1148 | TP_printk(SDMA_UREQ_FMT, |
| 1149 | __get_str(dev), |
| 1150 | __entry->ctxt, |
| 1151 | __entry->subctxt, |
| 1152 | __entry->ver_opcode, |
| 1153 | __entry->iovcnt, |
| 1154 | __entry->npkts, |
| 1155 | __entry->fragsize, |
| 1156 | __entry->comp_idx |
| 1157 | ) |
| 1158 | ); |
| 1159 | |
| 1160 | #define usdma_complete_name(st) { st, #st } |
| 1161 | #define show_usdma_complete_state(st) \ |
| 1162 | __print_symbolic(st, \ |
| 1163 | usdma_complete_name(FREE), \ |
| 1164 | usdma_complete_name(QUEUED), \ |
| 1165 | usdma_complete_name(COMPLETE), \ |
| 1166 | usdma_complete_name(ERROR)) |
| 1167 | |
| 1168 | TRACE_EVENT(hfi1_sdma_user_completion, |
| 1169 | TP_PROTO(struct hfi1_devdata *dd, u16 ctxt, u8 subctxt, u16 idx, |
| 1170 | u8 state, int code), |
| 1171 | TP_ARGS(dd, ctxt, subctxt, idx, state, code), |
| 1172 | TP_STRUCT__entry( |
| 1173 | DD_DEV_ENTRY(dd) |
| 1174 | __field(u16, ctxt) |
| 1175 | __field(u8, subctxt) |
| 1176 | __field(u16, idx) |
| 1177 | __field(u8, state) |
| 1178 | __field(int, code) |
| 1179 | ), |
| 1180 | TP_fast_assign( |
| 1181 | DD_DEV_ASSIGN(dd); |
| 1182 | __entry->ctxt = ctxt; |
| 1183 | __entry->subctxt = subctxt; |
| 1184 | __entry->idx = idx; |
| 1185 | __entry->state = state; |
| 1186 | __entry->code = code; |
| 1187 | ), |
| 1188 | TP_printk("[%s:%u:%u:%u] SDMA completion state %s (%d)", |
| 1189 | __get_str(dev), __entry->ctxt, __entry->subctxt, |
| 1190 | __entry->idx, show_usdma_complete_state(__entry->state), |
| 1191 | __entry->code) |
| 1192 | ); |
| 1193 | |
| 1194 | const char *print_u32_array(struct trace_seq *, u32 *, int); |
| 1195 | #define __print_u32_hex(arr, len) print_u32_array(p, arr, len) |
| 1196 | |
| 1197 | TRACE_EVENT(hfi1_sdma_user_header_ahg, |
| 1198 | TP_PROTO(struct hfi1_devdata *dd, u16 ctxt, u8 subctxt, u16 req, |
| 1199 | u8 sde, u8 ahgidx, u32 *ahg, int len, u32 tidval), |
| 1200 | TP_ARGS(dd, ctxt, subctxt, req, sde, ahgidx, ahg, len, tidval), |
| 1201 | TP_STRUCT__entry( |
| 1202 | DD_DEV_ENTRY(dd) |
| 1203 | __field(u16, ctxt) |
| 1204 | __field(u8, subctxt) |
| 1205 | __field(u16, req) |
| 1206 | __field(u8, sde) |
| 1207 | __field(u8, idx) |
| 1208 | __field(int, len) |
| 1209 | __field(u32, tidval) |
| 1210 | __array(u32, ahg, 10) |
| 1211 | ), |
| 1212 | TP_fast_assign( |
| 1213 | DD_DEV_ASSIGN(dd); |
| 1214 | __entry->ctxt = ctxt; |
| 1215 | __entry->subctxt = subctxt; |
| 1216 | __entry->req = req; |
| 1217 | __entry->sde = sde; |
| 1218 | __entry->idx = ahgidx; |
| 1219 | __entry->len = len; |
| 1220 | __entry->tidval = tidval; |
| 1221 | memcpy(__entry->ahg, ahg, len * sizeof(u32)); |
| 1222 | ), |
| 1223 | TP_printk("[%s:%u:%u:%u] (SDE%u/AHG%u) ahg[0-%d]=(%s) TIDVal=0x%x", |
| 1224 | __get_str(dev), |
| 1225 | __entry->ctxt, |
| 1226 | __entry->subctxt, |
| 1227 | __entry->req, |
| 1228 | __entry->sde, |
| 1229 | __entry->idx, |
| 1230 | __entry->len - 1, |
| 1231 | __print_u32_hex(__entry->ahg, __entry->len), |
| 1232 | __entry->tidval |
| 1233 | ) |
| 1234 | ); |
| 1235 | |
| 1236 | TRACE_EVENT(hfi1_sdma_state, |
| 1237 | TP_PROTO( |
| 1238 | struct sdma_engine *sde, |
| 1239 | const char *cstate, |
| 1240 | const char *nstate |
| 1241 | ), |
| 1242 | TP_ARGS(sde, cstate, nstate), |
| 1243 | TP_STRUCT__entry( |
| 1244 | DD_DEV_ENTRY(sde->dd) |
| 1245 | __string(curstate, cstate) |
| 1246 | __string(newstate, nstate) |
| 1247 | ), |
| 1248 | TP_fast_assign( |
| 1249 | DD_DEV_ASSIGN(sde->dd); |
| 1250 | __assign_str(curstate, cstate); |
| 1251 | __assign_str(newstate, nstate); |
| 1252 | ), |
| 1253 | TP_printk("[%s] current state %s new state %s", |
| 1254 | __get_str(dev), |
| 1255 | __get_str(curstate), |
| 1256 | __get_str(newstate) |
| 1257 | ) |
| 1258 | ); |
| 1259 | |
| 1260 | #undef TRACE_SYSTEM |
| 1261 | #define TRACE_SYSTEM hfi1_rc |
| 1262 | |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1263 | DECLARE_EVENT_CLASS(hfi1_rc_template, |
Dennis Dalessandro | 895420d | 2016-01-19 14:42:28 -0800 | [diff] [blame] | 1264 | TP_PROTO(struct rvt_qp *qp, u32 psn), |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1265 | TP_ARGS(qp, psn), |
| 1266 | TP_STRUCT__entry( |
| 1267 | DD_DEV_ENTRY(dd_from_ibdev(qp->ibqp.device)) |
| 1268 | __field(u32, qpn) |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1269 | __field(u32, s_flags) |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1270 | __field(u32, psn) |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1271 | __field(u32, s_psn) |
| 1272 | __field(u32, s_next_psn) |
| 1273 | __field(u32, s_sending_psn) |
| 1274 | __field(u32, s_sending_hpsn) |
| 1275 | __field(u32, r_psn) |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1276 | ), |
| 1277 | TP_fast_assign( |
| 1278 | DD_DEV_ASSIGN(dd_from_ibdev(qp->ibqp.device)) |
| 1279 | __entry->qpn = qp->ibqp.qp_num; |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1280 | __entry->s_flags = qp->s_flags; |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1281 | __entry->psn = psn; |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1282 | __entry->s_psn = qp->s_psn; |
| 1283 | __entry->s_next_psn = qp->s_next_psn; |
| 1284 | __entry->s_sending_psn = qp->s_sending_psn; |
| 1285 | __entry->s_sending_hpsn = qp->s_sending_hpsn; |
| 1286 | __entry->r_psn = qp->r_psn; |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1287 | ), |
| 1288 | TP_printk( |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1289 | "[%s] qpn 0x%x s_flags 0x%x psn 0x%x s_psn 0x%x s_next_psn 0x%x s_sending_psn 0x%x sending_hpsn 0x%x r_psn 0x%x", |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1290 | __get_str(dev), |
| 1291 | __entry->qpn, |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1292 | __entry->s_flags, |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1293 | __entry->psn, |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1294 | __entry->s_psn, |
| 1295 | __entry->s_next_psn, |
| 1296 | __entry->s_sending_psn, |
| 1297 | __entry->s_sending_hpsn, |
| 1298 | __entry->r_psn |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1299 | ) |
| 1300 | ); |
| 1301 | |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1302 | DEFINE_EVENT(hfi1_rc_template, hfi1_rc_sendcomplete, |
Dennis Dalessandro | 895420d | 2016-01-19 14:42:28 -0800 | [diff] [blame] | 1303 | TP_PROTO(struct rvt_qp *qp, u32 psn), |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1304 | TP_ARGS(qp, psn) |
| 1305 | ); |
| 1306 | |
| 1307 | DEFINE_EVENT(hfi1_rc_template, hfi1_rc_ack, |
Dennis Dalessandro | 895420d | 2016-01-19 14:42:28 -0800 | [diff] [blame] | 1308 | TP_PROTO(struct rvt_qp *qp, u32 psn), |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1309 | TP_ARGS(qp, psn) |
| 1310 | ); |
| 1311 | |
| 1312 | DEFINE_EVENT(hfi1_rc_template, hfi1_rc_timeout, |
Dennis Dalessandro | 895420d | 2016-01-19 14:42:28 -0800 | [diff] [blame] | 1313 | TP_PROTO(struct rvt_qp *qp, u32 psn), |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1314 | TP_ARGS(qp, psn) |
| 1315 | ); |
| 1316 | |
| 1317 | DEFINE_EVENT(hfi1_rc_template, hfi1_rc_rcv_error, |
Dennis Dalessandro | 895420d | 2016-01-19 14:42:28 -0800 | [diff] [blame] | 1318 | TP_PROTO(struct rvt_qp *qp, u32 psn), |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1319 | TP_ARGS(qp, psn) |
| 1320 | ); |
| 1321 | |
| 1322 | #undef TRACE_SYSTEM |
| 1323 | #define TRACE_SYSTEM hfi1_misc |
| 1324 | |
| 1325 | TRACE_EVENT(hfi1_interrupt, |
| 1326 | TP_PROTO(struct hfi1_devdata *dd, const struct is_table *is_entry, |
| 1327 | int src), |
| 1328 | TP_ARGS(dd, is_entry, src), |
| 1329 | TP_STRUCT__entry( |
| 1330 | DD_DEV_ENTRY(dd) |
| 1331 | __array(char, buf, 64) |
| 1332 | __field(int, src) |
| 1333 | ), |
| 1334 | TP_fast_assign( |
| 1335 | DD_DEV_ASSIGN(dd) |
| 1336 | is_entry->is_name(__entry->buf, 64, src - is_entry->start); |
| 1337 | __entry->src = src; |
| 1338 | ), |
| 1339 | TP_printk("[%s] source: %s [%d]", __get_str(dev), __entry->buf, |
| 1340 | __entry->src) |
| 1341 | ); |
| 1342 | |
| 1343 | /* |
| 1344 | * Note: |
| 1345 | * This produces a REALLY ugly trace in the console output when the string is |
| 1346 | * too long. |
| 1347 | */ |
| 1348 | |
| 1349 | #undef TRACE_SYSTEM |
| 1350 | #define TRACE_SYSTEM hfi1_trace |
| 1351 | |
| 1352 | #define MAX_MSG_LEN 512 |
| 1353 | |
| 1354 | DECLARE_EVENT_CLASS(hfi1_trace_template, |
| 1355 | TP_PROTO(const char *function, struct va_format *vaf), |
| 1356 | TP_ARGS(function, vaf), |
| 1357 | TP_STRUCT__entry( |
| 1358 | __string(function, function) |
| 1359 | __dynamic_array(char, msg, MAX_MSG_LEN) |
| 1360 | ), |
| 1361 | TP_fast_assign( |
| 1362 | __assign_str(function, function); |
| 1363 | WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), |
| 1364 | MAX_MSG_LEN, vaf->fmt, |
| 1365 | *vaf->va) >= MAX_MSG_LEN); |
| 1366 | ), |
| 1367 | TP_printk("(%s) %s", |
| 1368 | __get_str(function), |
| 1369 | __get_str(msg)) |
| 1370 | ); |
| 1371 | |
| 1372 | /* |
| 1373 | * It may be nice to macroize the __hfi1_trace but the va_* stuff requires an |
| 1374 | * actual function to work and can not be in a macro. |
| 1375 | */ |
| 1376 | #define __hfi1_trace_def(lvl) \ |
| 1377 | void __hfi1_trace_##lvl(const char *funct, char *fmt, ...); \ |
| 1378 | \ |
| 1379 | DEFINE_EVENT(hfi1_trace_template, hfi1_ ##lvl, \ |
| 1380 | TP_PROTO(const char *function, struct va_format *vaf), \ |
| 1381 | TP_ARGS(function, vaf)) |
| 1382 | |
| 1383 | #define __hfi1_trace_fn(lvl) \ |
| 1384 | void __hfi1_trace_##lvl(const char *func, char *fmt, ...) \ |
| 1385 | { \ |
| 1386 | struct va_format vaf = { \ |
| 1387 | .fmt = fmt, \ |
| 1388 | }; \ |
| 1389 | va_list args; \ |
| 1390 | \ |
| 1391 | va_start(args, fmt); \ |
| 1392 | vaf.va = &args; \ |
| 1393 | trace_hfi1_ ##lvl(func, &vaf); \ |
| 1394 | va_end(args); \ |
| 1395 | return; \ |
| 1396 | } |
| 1397 | |
| 1398 | /* |
| 1399 | * To create a new trace level simply define it below and as a __hfi1_trace_fn |
| 1400 | * in trace.c. This will create all the hooks for calling |
| 1401 | * hfi1_cdbg(LVL, fmt, ...); as well as take care of all |
| 1402 | * the debugfs stuff. |
| 1403 | */ |
| 1404 | __hfi1_trace_def(PKT); |
| 1405 | __hfi1_trace_def(PROC); |
| 1406 | __hfi1_trace_def(SDMA); |
| 1407 | __hfi1_trace_def(LINKVERB); |
| 1408 | __hfi1_trace_def(DEBUG); |
| 1409 | __hfi1_trace_def(SNOOP); |
| 1410 | __hfi1_trace_def(CNTR); |
| 1411 | __hfi1_trace_def(PIO); |
| 1412 | __hfi1_trace_def(DC8051); |
| 1413 | __hfi1_trace_def(FIRMWARE); |
| 1414 | __hfi1_trace_def(RCVCTRL); |
| 1415 | __hfi1_trace_def(TID); |
| 1416 | |
| 1417 | #define hfi1_cdbg(which, fmt, ...) \ |
| 1418 | __hfi1_trace_##which(__func__, fmt, ##__VA_ARGS__) |
| 1419 | |
| 1420 | #define hfi1_dbg(fmt, ...) \ |
| 1421 | hfi1_cdbg(DEBUG, fmt, ##__VA_ARGS__) |
| 1422 | |
| 1423 | /* |
| 1424 | * Define HFI1_EARLY_DBG at compile time or here to enable early trace |
| 1425 | * messages. Do not check in an enablement for this. |
| 1426 | */ |
| 1427 | |
| 1428 | #ifdef HFI1_EARLY_DBG |
| 1429 | #define hfi1_dbg_early(fmt, ...) \ |
| 1430 | trace_printk(fmt, ##__VA_ARGS__) |
| 1431 | #else |
| 1432 | #define hfi1_dbg_early(fmt, ...) |
| 1433 | #endif |
| 1434 | |
| 1435 | #endif /* __HFI1_TRACE_H */ |
| 1436 | |
| 1437 | #undef TRACE_INCLUDE_PATH |
| 1438 | #undef TRACE_INCLUDE_FILE |
| 1439 | #define TRACE_INCLUDE_PATH . |
| 1440 | #define TRACE_INCLUDE_FILE trace |
| 1441 | #include <trace/define_trace.h> |