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, |
| 335 | TP_PROTO(struct hfi1_qp *qp, u32 flags), |
| 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, |
| 359 | TP_PROTO(struct hfi1_qp *qp, u32 flags), |
| 360 | TP_ARGS(qp, flags)); |
| 361 | |
| 362 | DEFINE_EVENT(hfi1_qpsleepwakeup_template, hfi1_qpsleep, |
| 363 | TP_PROTO(struct hfi1_qp *qp, u32 flags), |
| 364 | TP_ARGS(qp, flags)); |
| 365 | |
| 366 | #undef TRACE_SYSTEM |
| 367 | #define TRACE_SYSTEM hfi1_qphash |
| 368 | DECLARE_EVENT_CLASS(hfi1_qphash_template, |
| 369 | TP_PROTO(struct hfi1_qp *qp, u32 bucket), |
| 370 | TP_ARGS(qp, bucket), |
| 371 | TP_STRUCT__entry( |
| 372 | DD_DEV_ENTRY(dd_from_ibdev(qp->ibqp.device)) |
| 373 | __field(u32, qpn) |
| 374 | __field(u32, bucket) |
| 375 | ), |
| 376 | TP_fast_assign( |
| 377 | DD_DEV_ASSIGN(dd_from_ibdev(qp->ibqp.device)) |
| 378 | __entry->qpn = qp->ibqp.qp_num; |
| 379 | __entry->bucket = bucket; |
| 380 | ), |
| 381 | TP_printk( |
| 382 | "[%s] qpn 0x%x bucket %u", |
| 383 | __get_str(dev), |
| 384 | __entry->qpn, |
| 385 | __entry->bucket |
| 386 | ) |
| 387 | ); |
| 388 | |
| 389 | DEFINE_EVENT(hfi1_qphash_template, hfi1_qpinsert, |
| 390 | TP_PROTO(struct hfi1_qp *qp, u32 bucket), |
| 391 | TP_ARGS(qp, bucket)); |
| 392 | |
| 393 | DEFINE_EVENT(hfi1_qphash_template, hfi1_qpremove, |
| 394 | TP_PROTO(struct hfi1_qp *qp, u32 bucket), |
| 395 | TP_ARGS(qp, bucket)); |
| 396 | |
| 397 | #undef TRACE_SYSTEM |
| 398 | #define TRACE_SYSTEM hfi1_ibhdrs |
| 399 | |
| 400 | u8 ibhdr_exhdr_len(struct hfi1_ib_header *hdr); |
| 401 | const char *parse_everbs_hdrs( |
| 402 | struct trace_seq *p, |
| 403 | u8 opcode, |
| 404 | void *ehdrs); |
| 405 | |
| 406 | #define __parse_ib_ehdrs(op, ehdrs) parse_everbs_hdrs(p, op, ehdrs) |
| 407 | |
| 408 | const char *parse_sdma_flags( |
| 409 | struct trace_seq *p, |
| 410 | u64 desc0, u64 desc1); |
| 411 | |
| 412 | #define __parse_sdma_flags(desc0, desc1) parse_sdma_flags(p, desc0, desc1) |
| 413 | |
| 414 | |
| 415 | #define lrh_name(lrh) { HFI1_##lrh, #lrh } |
| 416 | #define show_lnh(lrh) \ |
| 417 | __print_symbolic(lrh, \ |
| 418 | lrh_name(LRH_BTH), \ |
| 419 | lrh_name(LRH_GRH)) |
| 420 | |
| 421 | #define ib_opcode_name(opcode) { IB_OPCODE_##opcode, #opcode } |
| 422 | #define show_ib_opcode(opcode) \ |
| 423 | __print_symbolic(opcode, \ |
| 424 | ib_opcode_name(RC_SEND_FIRST), \ |
| 425 | ib_opcode_name(RC_SEND_MIDDLE), \ |
| 426 | ib_opcode_name(RC_SEND_LAST), \ |
| 427 | ib_opcode_name(RC_SEND_LAST_WITH_IMMEDIATE), \ |
| 428 | ib_opcode_name(RC_SEND_ONLY), \ |
| 429 | ib_opcode_name(RC_SEND_ONLY_WITH_IMMEDIATE), \ |
| 430 | ib_opcode_name(RC_RDMA_WRITE_FIRST), \ |
| 431 | ib_opcode_name(RC_RDMA_WRITE_MIDDLE), \ |
| 432 | ib_opcode_name(RC_RDMA_WRITE_LAST), \ |
| 433 | ib_opcode_name(RC_RDMA_WRITE_LAST_WITH_IMMEDIATE), \ |
| 434 | ib_opcode_name(RC_RDMA_WRITE_ONLY), \ |
| 435 | ib_opcode_name(RC_RDMA_WRITE_ONLY_WITH_IMMEDIATE), \ |
| 436 | ib_opcode_name(RC_RDMA_READ_REQUEST), \ |
| 437 | ib_opcode_name(RC_RDMA_READ_RESPONSE_FIRST), \ |
| 438 | ib_opcode_name(RC_RDMA_READ_RESPONSE_MIDDLE), \ |
| 439 | ib_opcode_name(RC_RDMA_READ_RESPONSE_LAST), \ |
| 440 | ib_opcode_name(RC_RDMA_READ_RESPONSE_ONLY), \ |
| 441 | ib_opcode_name(RC_ACKNOWLEDGE), \ |
| 442 | ib_opcode_name(RC_ATOMIC_ACKNOWLEDGE), \ |
| 443 | ib_opcode_name(RC_COMPARE_SWAP), \ |
| 444 | ib_opcode_name(RC_FETCH_ADD), \ |
| 445 | ib_opcode_name(UC_SEND_FIRST), \ |
| 446 | ib_opcode_name(UC_SEND_MIDDLE), \ |
| 447 | ib_opcode_name(UC_SEND_LAST), \ |
| 448 | ib_opcode_name(UC_SEND_LAST_WITH_IMMEDIATE), \ |
| 449 | ib_opcode_name(UC_SEND_ONLY), \ |
| 450 | ib_opcode_name(UC_SEND_ONLY_WITH_IMMEDIATE), \ |
| 451 | ib_opcode_name(UC_RDMA_WRITE_FIRST), \ |
| 452 | ib_opcode_name(UC_RDMA_WRITE_MIDDLE), \ |
| 453 | ib_opcode_name(UC_RDMA_WRITE_LAST), \ |
| 454 | ib_opcode_name(UC_RDMA_WRITE_LAST_WITH_IMMEDIATE), \ |
| 455 | ib_opcode_name(UC_RDMA_WRITE_ONLY), \ |
| 456 | ib_opcode_name(UC_RDMA_WRITE_ONLY_WITH_IMMEDIATE), \ |
| 457 | ib_opcode_name(UD_SEND_ONLY), \ |
Dean Luick | 93990be | 2015-12-01 15:38:11 -0500 | [diff] [blame] | 458 | ib_opcode_name(UD_SEND_ONLY_WITH_IMMEDIATE), \ |
| 459 | ib_opcode_name(CNP)) |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 460 | |
| 461 | |
| 462 | #define LRH_PRN "vl %d lver %d sl %d lnh %d,%s dlid %.4x len %d slid %.4x" |
| 463 | #define BTH_PRN \ |
| 464 | "op 0x%.2x,%s se %d m %d pad %d tver %d pkey 0x%.4x " \ |
| 465 | "f %d b %d qpn 0x%.6x a %d psn 0x%.8x" |
| 466 | #define EHDR_PRN "%s" |
| 467 | |
| 468 | DECLARE_EVENT_CLASS(hfi1_ibhdr_template, |
| 469 | TP_PROTO(struct hfi1_devdata *dd, |
| 470 | struct hfi1_ib_header *hdr), |
| 471 | TP_ARGS(dd, hdr), |
| 472 | TP_STRUCT__entry( |
| 473 | DD_DEV_ENTRY(dd) |
| 474 | /* LRH */ |
| 475 | __field(u8, vl) |
| 476 | __field(u8, lver) |
| 477 | __field(u8, sl) |
| 478 | __field(u8, lnh) |
| 479 | __field(u16, dlid) |
| 480 | __field(u16, len) |
| 481 | __field(u16, slid) |
| 482 | /* BTH */ |
| 483 | __field(u8, opcode) |
| 484 | __field(u8, se) |
| 485 | __field(u8, m) |
| 486 | __field(u8, pad) |
| 487 | __field(u8, tver) |
| 488 | __field(u16, pkey) |
| 489 | __field(u8, f) |
| 490 | __field(u8, b) |
| 491 | __field(u32, qpn) |
| 492 | __field(u8, a) |
| 493 | __field(u32, psn) |
| 494 | /* extended headers */ |
| 495 | __dynamic_array(u8, ehdrs, ibhdr_exhdr_len(hdr)) |
| 496 | ), |
| 497 | TP_fast_assign( |
| 498 | struct hfi1_other_headers *ohdr; |
| 499 | |
| 500 | DD_DEV_ASSIGN(dd); |
| 501 | /* LRH */ |
| 502 | __entry->vl = |
| 503 | (u8)(be16_to_cpu(hdr->lrh[0]) >> 12); |
| 504 | __entry->lver = |
| 505 | (u8)(be16_to_cpu(hdr->lrh[0]) >> 8) & 0xf; |
| 506 | __entry->sl = |
| 507 | (u8)(be16_to_cpu(hdr->lrh[0]) >> 4) & 0xf; |
| 508 | __entry->lnh = |
| 509 | (u8)(be16_to_cpu(hdr->lrh[0]) & 3); |
| 510 | __entry->dlid = |
| 511 | be16_to_cpu(hdr->lrh[1]); |
| 512 | /* allow for larger len */ |
| 513 | __entry->len = |
| 514 | be16_to_cpu(hdr->lrh[2]); |
| 515 | __entry->slid = |
| 516 | be16_to_cpu(hdr->lrh[3]); |
| 517 | /* BTH */ |
| 518 | if (__entry->lnh == HFI1_LRH_BTH) |
| 519 | ohdr = &hdr->u.oth; |
| 520 | else |
| 521 | ohdr = &hdr->u.l.oth; |
| 522 | __entry->opcode = |
| 523 | (be32_to_cpu(ohdr->bth[0]) >> 24) & 0xff; |
| 524 | __entry->se = |
| 525 | (be32_to_cpu(ohdr->bth[0]) >> 23) & 1; |
| 526 | __entry->m = |
| 527 | (be32_to_cpu(ohdr->bth[0]) >> 22) & 1; |
| 528 | __entry->pad = |
| 529 | (be32_to_cpu(ohdr->bth[0]) >> 20) & 3; |
| 530 | __entry->tver = |
| 531 | (be32_to_cpu(ohdr->bth[0]) >> 16) & 0xf; |
| 532 | __entry->pkey = |
| 533 | be32_to_cpu(ohdr->bth[0]) & 0xffff; |
| 534 | __entry->f = |
| 535 | (be32_to_cpu(ohdr->bth[1]) >> HFI1_FECN_SHIFT) |
| 536 | & HFI1_FECN_MASK; |
| 537 | __entry->b = |
| 538 | (be32_to_cpu(ohdr->bth[1]) >> HFI1_BECN_SHIFT) |
| 539 | & HFI1_BECN_MASK; |
| 540 | __entry->qpn = |
| 541 | be32_to_cpu(ohdr->bth[1]) & HFI1_QPN_MASK; |
| 542 | __entry->a = |
| 543 | (be32_to_cpu(ohdr->bth[2]) >> 31) & 1; |
| 544 | /* allow for larger PSN */ |
| 545 | __entry->psn = |
| 546 | be32_to_cpu(ohdr->bth[2]) & 0x7fffffff; |
| 547 | /* extended headers */ |
| 548 | memcpy( |
| 549 | __get_dynamic_array(ehdrs), |
| 550 | &ohdr->u, |
| 551 | ibhdr_exhdr_len(hdr)); |
| 552 | ), |
| 553 | TP_printk("[%s] " LRH_PRN " " BTH_PRN " " EHDR_PRN, |
| 554 | __get_str(dev), |
| 555 | /* LRH */ |
| 556 | __entry->vl, |
| 557 | __entry->lver, |
| 558 | __entry->sl, |
| 559 | __entry->lnh, show_lnh(__entry->lnh), |
| 560 | __entry->dlid, |
| 561 | __entry->len, |
| 562 | __entry->slid, |
| 563 | /* BTH */ |
| 564 | __entry->opcode, show_ib_opcode(__entry->opcode), |
| 565 | __entry->se, |
| 566 | __entry->m, |
| 567 | __entry->pad, |
| 568 | __entry->tver, |
| 569 | __entry->pkey, |
| 570 | __entry->f, |
| 571 | __entry->b, |
| 572 | __entry->qpn, |
| 573 | __entry->a, |
| 574 | __entry->psn, |
| 575 | /* extended headers */ |
| 576 | __parse_ib_ehdrs( |
| 577 | __entry->opcode, |
| 578 | (void *)__get_dynamic_array(ehdrs)) |
| 579 | ) |
| 580 | ); |
| 581 | |
| 582 | DEFINE_EVENT(hfi1_ibhdr_template, input_ibhdr, |
| 583 | TP_PROTO(struct hfi1_devdata *dd, struct hfi1_ib_header *hdr), |
| 584 | TP_ARGS(dd, hdr)); |
| 585 | |
| 586 | DEFINE_EVENT(hfi1_ibhdr_template, output_ibhdr, |
| 587 | TP_PROTO(struct hfi1_devdata *dd, struct hfi1_ib_header *hdr), |
| 588 | TP_ARGS(dd, hdr)); |
| 589 | |
| 590 | #define SNOOP_PRN \ |
| 591 | "slid %.4x dlid %.4x qpn 0x%.6x opcode 0x%.2x,%s " \ |
| 592 | "svc lvl %d pkey 0x%.4x [header = %d bytes] [data = %d bytes]" |
| 593 | |
| 594 | #undef TRACE_SYSTEM |
| 595 | #define TRACE_SYSTEM hfi1_snoop |
| 596 | |
| 597 | |
| 598 | TRACE_EVENT(snoop_capture, |
| 599 | TP_PROTO(struct hfi1_devdata *dd, |
| 600 | int hdr_len, |
| 601 | struct hfi1_ib_header *hdr, |
| 602 | int data_len, |
| 603 | void *data), |
| 604 | TP_ARGS(dd, hdr_len, hdr, data_len, data), |
| 605 | TP_STRUCT__entry( |
| 606 | DD_DEV_ENTRY(dd) |
| 607 | __field(u16, slid) |
| 608 | __field(u16, dlid) |
| 609 | __field(u32, qpn) |
| 610 | __field(u8, opcode) |
| 611 | __field(u8, sl) |
| 612 | __field(u16, pkey) |
| 613 | __field(u32, hdr_len) |
| 614 | __field(u32, data_len) |
| 615 | __field(u8, lnh) |
| 616 | __dynamic_array(u8, raw_hdr, hdr_len) |
| 617 | __dynamic_array(u8, raw_pkt, data_len) |
| 618 | ), |
| 619 | TP_fast_assign( |
| 620 | struct hfi1_other_headers *ohdr; |
| 621 | |
| 622 | __entry->lnh = (u8)(be16_to_cpu(hdr->lrh[0]) & 3); |
| 623 | if (__entry->lnh == HFI1_LRH_BTH) |
| 624 | ohdr = &hdr->u.oth; |
| 625 | else |
| 626 | ohdr = &hdr->u.l.oth; |
| 627 | DD_DEV_ASSIGN(dd); |
| 628 | __entry->slid = be16_to_cpu(hdr->lrh[3]); |
| 629 | __entry->dlid = be16_to_cpu(hdr->lrh[1]); |
| 630 | __entry->qpn = be32_to_cpu(ohdr->bth[1]) & HFI1_QPN_MASK; |
| 631 | __entry->opcode = (be32_to_cpu(ohdr->bth[0]) >> 24) & 0xff; |
| 632 | __entry->sl = (u8)(be16_to_cpu(hdr->lrh[0]) >> 4) & 0xf; |
| 633 | __entry->pkey = be32_to_cpu(ohdr->bth[0]) & 0xffff; |
| 634 | __entry->hdr_len = hdr_len; |
| 635 | __entry->data_len = data_len; |
| 636 | memcpy(__get_dynamic_array(raw_hdr), hdr, hdr_len); |
| 637 | memcpy(__get_dynamic_array(raw_pkt), data, data_len); |
| 638 | ), |
| 639 | TP_printk("[%s] " SNOOP_PRN, |
| 640 | __get_str(dev), |
| 641 | __entry->slid, |
| 642 | __entry->dlid, |
| 643 | __entry->qpn, |
| 644 | __entry->opcode, |
| 645 | show_ib_opcode(__entry->opcode), |
| 646 | __entry->sl, |
| 647 | __entry->pkey, |
| 648 | __entry->hdr_len, |
| 649 | __entry->data_len |
| 650 | ) |
| 651 | ); |
| 652 | |
| 653 | #undef TRACE_SYSTEM |
| 654 | #define TRACE_SYSTEM hfi1_ctxts |
| 655 | |
| 656 | #define UCTXT_FMT \ |
| 657 | "cred:%u, credaddr:0x%llx, piobase:0x%llx, rcvhdr_cnt:%u, " \ |
| 658 | "rcvbase:0x%llx, rcvegrc:%u, rcvegrb:0x%llx" |
| 659 | TRACE_EVENT(hfi1_uctxtdata, |
| 660 | TP_PROTO(struct hfi1_devdata *dd, struct hfi1_ctxtdata *uctxt), |
| 661 | TP_ARGS(dd, uctxt), |
| 662 | TP_STRUCT__entry( |
| 663 | DD_DEV_ENTRY(dd) |
| 664 | __field(unsigned, ctxt) |
| 665 | __field(u32, credits) |
| 666 | __field(u64, hw_free) |
| 667 | __field(u64, piobase) |
| 668 | __field(u16, rcvhdrq_cnt) |
| 669 | __field(u64, rcvhdrq_phys) |
| 670 | __field(u32, eager_cnt) |
| 671 | __field(u64, rcvegr_phys) |
| 672 | ), |
| 673 | TP_fast_assign( |
| 674 | DD_DEV_ASSIGN(dd); |
| 675 | __entry->ctxt = uctxt->ctxt; |
| 676 | __entry->credits = uctxt->sc->credits; |
| 677 | __entry->hw_free = (u64)uctxt->sc->hw_free; |
| 678 | __entry->piobase = (u64)uctxt->sc->base_addr; |
| 679 | __entry->rcvhdrq_cnt = uctxt->rcvhdrq_cnt; |
| 680 | __entry->rcvhdrq_phys = uctxt->rcvhdrq_phys; |
| 681 | __entry->eager_cnt = uctxt->egrbufs.alloced; |
| 682 | __entry->rcvegr_phys = uctxt->egrbufs.rcvtids[0].phys; |
| 683 | ), |
| 684 | TP_printk( |
| 685 | "[%s] ctxt %u " UCTXT_FMT, |
| 686 | __get_str(dev), |
| 687 | __entry->ctxt, |
| 688 | __entry->credits, |
| 689 | __entry->hw_free, |
| 690 | __entry->piobase, |
| 691 | __entry->rcvhdrq_cnt, |
| 692 | __entry->rcvhdrq_phys, |
| 693 | __entry->eager_cnt, |
| 694 | __entry->rcvegr_phys |
| 695 | ) |
| 696 | ); |
| 697 | |
| 698 | #define CINFO_FMT \ |
| 699 | "egrtids:%u, egr_size:%u, hdrq_cnt:%u, hdrq_size:%u, sdma_ring_size:%u" |
| 700 | TRACE_EVENT(hfi1_ctxt_info, |
| 701 | TP_PROTO(struct hfi1_devdata *dd, unsigned ctxt, unsigned subctxt, |
| 702 | struct hfi1_ctxt_info cinfo), |
| 703 | TP_ARGS(dd, ctxt, subctxt, cinfo), |
| 704 | TP_STRUCT__entry( |
| 705 | DD_DEV_ENTRY(dd) |
| 706 | __field(unsigned, ctxt) |
| 707 | __field(unsigned, subctxt) |
| 708 | __field(u16, egrtids) |
| 709 | __field(u16, rcvhdrq_cnt) |
| 710 | __field(u16, rcvhdrq_size) |
| 711 | __field(u16, sdma_ring_size) |
| 712 | __field(u32, rcvegr_size) |
| 713 | ), |
| 714 | TP_fast_assign( |
| 715 | DD_DEV_ASSIGN(dd); |
| 716 | __entry->ctxt = ctxt; |
| 717 | __entry->subctxt = subctxt; |
| 718 | __entry->egrtids = cinfo.egrtids; |
| 719 | __entry->rcvhdrq_cnt = cinfo.rcvhdrq_cnt; |
| 720 | __entry->rcvhdrq_size = cinfo.rcvhdrq_entsize; |
| 721 | __entry->sdma_ring_size = cinfo.sdma_ring_size; |
| 722 | __entry->rcvegr_size = cinfo.rcvegr_size; |
| 723 | ), |
| 724 | TP_printk( |
| 725 | "[%s] ctxt %u:%u " CINFO_FMT, |
| 726 | __get_str(dev), |
| 727 | __entry->ctxt, |
| 728 | __entry->subctxt, |
| 729 | __entry->egrtids, |
| 730 | __entry->rcvegr_size, |
| 731 | __entry->rcvhdrq_cnt, |
| 732 | __entry->rcvhdrq_size, |
| 733 | __entry->sdma_ring_size |
| 734 | ) |
| 735 | ); |
| 736 | |
| 737 | #undef TRACE_SYSTEM |
| 738 | #define TRACE_SYSTEM hfi1_sma |
| 739 | |
| 740 | #define BCT_FORMAT \ |
| 741 | "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]" |
| 742 | |
| 743 | #define BCT(field) \ |
| 744 | be16_to_cpu( \ |
| 745 | ((struct buffer_control *)__get_dynamic_array(bct))->field \ |
| 746 | ) |
| 747 | |
| 748 | DECLARE_EVENT_CLASS(hfi1_bct_template, |
| 749 | TP_PROTO(struct hfi1_devdata *dd, struct buffer_control *bc), |
| 750 | TP_ARGS(dd, bc), |
| 751 | TP_STRUCT__entry( |
| 752 | DD_DEV_ENTRY(dd) |
| 753 | __dynamic_array(u8, bct, sizeof(*bc)) |
| 754 | ), |
| 755 | TP_fast_assign( |
| 756 | DD_DEV_ASSIGN(dd); |
| 757 | memcpy( |
| 758 | __get_dynamic_array(bct), |
| 759 | bc, |
| 760 | sizeof(*bc)); |
| 761 | ), |
| 762 | TP_printk(BCT_FORMAT, |
| 763 | BCT(overall_shared_limit), |
| 764 | |
| 765 | BCT(vl[0].dedicated), |
| 766 | BCT(vl[0].shared), |
| 767 | |
| 768 | BCT(vl[1].dedicated), |
| 769 | BCT(vl[1].shared), |
| 770 | |
| 771 | BCT(vl[2].dedicated), |
| 772 | BCT(vl[2].shared), |
| 773 | |
| 774 | BCT(vl[3].dedicated), |
| 775 | BCT(vl[3].shared), |
| 776 | |
| 777 | BCT(vl[4].dedicated), |
| 778 | BCT(vl[4].shared), |
| 779 | |
| 780 | BCT(vl[5].dedicated), |
| 781 | BCT(vl[5].shared), |
| 782 | |
| 783 | BCT(vl[6].dedicated), |
| 784 | BCT(vl[6].shared), |
| 785 | |
| 786 | BCT(vl[7].dedicated), |
| 787 | BCT(vl[7].shared), |
| 788 | |
| 789 | BCT(vl[15].dedicated), |
| 790 | BCT(vl[15].shared) |
| 791 | ) |
| 792 | ); |
| 793 | |
| 794 | |
| 795 | DEFINE_EVENT(hfi1_bct_template, bct_set, |
| 796 | TP_PROTO(struct hfi1_devdata *dd, struct buffer_control *bc), |
| 797 | TP_ARGS(dd, bc)); |
| 798 | |
| 799 | DEFINE_EVENT(hfi1_bct_template, bct_get, |
| 800 | TP_PROTO(struct hfi1_devdata *dd, struct buffer_control *bc), |
| 801 | TP_ARGS(dd, bc)); |
| 802 | |
| 803 | #undef TRACE_SYSTEM |
| 804 | #define TRACE_SYSTEM hfi1_sdma |
| 805 | |
| 806 | TRACE_EVENT(hfi1_sdma_descriptor, |
| 807 | TP_PROTO( |
| 808 | struct sdma_engine *sde, |
| 809 | u64 desc0, |
| 810 | u64 desc1, |
| 811 | u16 e, |
| 812 | void *descp), |
| 813 | TP_ARGS(sde, desc0, desc1, e, descp), |
| 814 | TP_STRUCT__entry( |
| 815 | DD_DEV_ENTRY(sde->dd) |
| 816 | __field(void *, descp) |
| 817 | __field(u64, desc0) |
| 818 | __field(u64, desc1) |
| 819 | __field(u16, e) |
| 820 | __field(u8, idx) |
| 821 | ), |
| 822 | TP_fast_assign( |
| 823 | DD_DEV_ASSIGN(sde->dd); |
| 824 | __entry->desc0 = desc0; |
| 825 | __entry->desc1 = desc1; |
| 826 | __entry->idx = sde->this_idx; |
| 827 | __entry->descp = descp; |
| 828 | __entry->e = e; |
| 829 | ), |
| 830 | TP_printk( |
| 831 | "[%s] SDE(%u) flags:%s addr:0x%016llx gen:%u len:%u d0:%016llx d1:%016llx to %p,%u", |
| 832 | __get_str(dev), |
| 833 | __entry->idx, |
| 834 | __parse_sdma_flags(__entry->desc0, __entry->desc1), |
| 835 | (__entry->desc0 >> SDMA_DESC0_PHY_ADDR_SHIFT) |
| 836 | & SDMA_DESC0_PHY_ADDR_MASK, |
| 837 | (u8)((__entry->desc1 >> SDMA_DESC1_GENERATION_SHIFT) |
| 838 | & SDMA_DESC1_GENERATION_MASK), |
| 839 | (u16)((__entry->desc0 >> SDMA_DESC0_BYTE_COUNT_SHIFT) |
| 840 | & SDMA_DESC0_BYTE_COUNT_MASK), |
| 841 | __entry->desc0, |
| 842 | __entry->desc1, |
| 843 | __entry->descp, |
| 844 | __entry->e |
| 845 | ) |
| 846 | ); |
| 847 | |
| 848 | TRACE_EVENT(hfi1_sdma_engine_select, |
| 849 | TP_PROTO(struct hfi1_devdata *dd, u32 sel, u8 vl, u8 idx), |
| 850 | TP_ARGS(dd, sel, vl, idx), |
| 851 | TP_STRUCT__entry( |
| 852 | DD_DEV_ENTRY(dd) |
| 853 | __field(u32, sel) |
| 854 | __field(u8, vl) |
| 855 | __field(u8, idx) |
| 856 | ), |
| 857 | TP_fast_assign( |
| 858 | DD_DEV_ASSIGN(dd); |
| 859 | __entry->sel = sel; |
| 860 | __entry->vl = vl; |
| 861 | __entry->idx = idx; |
| 862 | ), |
| 863 | TP_printk( |
| 864 | "[%s] selecting SDE %u sel 0x%x vl %u", |
| 865 | __get_str(dev), |
| 866 | __entry->idx, |
| 867 | __entry->sel, |
| 868 | __entry->vl |
| 869 | ) |
| 870 | ); |
| 871 | |
| 872 | DECLARE_EVENT_CLASS(hfi1_sdma_engine_class, |
| 873 | TP_PROTO( |
| 874 | struct sdma_engine *sde, |
| 875 | u64 status |
| 876 | ), |
| 877 | TP_ARGS(sde, status), |
| 878 | TP_STRUCT__entry( |
| 879 | DD_DEV_ENTRY(sde->dd) |
| 880 | __field(u64, status) |
| 881 | __field(u8, idx) |
| 882 | ), |
| 883 | TP_fast_assign( |
| 884 | DD_DEV_ASSIGN(sde->dd); |
| 885 | __entry->status = status; |
| 886 | __entry->idx = sde->this_idx; |
| 887 | ), |
| 888 | TP_printk( |
| 889 | "[%s] SDE(%u) status %llx", |
| 890 | __get_str(dev), |
| 891 | __entry->idx, |
| 892 | (unsigned long long)__entry->status |
| 893 | ) |
| 894 | ); |
| 895 | |
| 896 | DEFINE_EVENT(hfi1_sdma_engine_class, hfi1_sdma_engine_interrupt, |
| 897 | TP_PROTO( |
| 898 | struct sdma_engine *sde, |
| 899 | u64 status |
| 900 | ), |
| 901 | TP_ARGS(sde, status) |
| 902 | ); |
| 903 | |
| 904 | DEFINE_EVENT(hfi1_sdma_engine_class, hfi1_sdma_engine_progress, |
| 905 | TP_PROTO( |
| 906 | struct sdma_engine *sde, |
| 907 | u64 status |
| 908 | ), |
| 909 | TP_ARGS(sde, status) |
| 910 | ); |
| 911 | |
| 912 | DECLARE_EVENT_CLASS(hfi1_sdma_ahg_ad, |
| 913 | TP_PROTO( |
| 914 | struct sdma_engine *sde, |
| 915 | int aidx |
| 916 | ), |
| 917 | TP_ARGS(sde, aidx), |
| 918 | TP_STRUCT__entry( |
| 919 | DD_DEV_ENTRY(sde->dd) |
| 920 | __field(int, aidx) |
| 921 | __field(u8, idx) |
| 922 | ), |
| 923 | TP_fast_assign( |
| 924 | DD_DEV_ASSIGN(sde->dd); |
| 925 | __entry->idx = sde->this_idx; |
| 926 | __entry->aidx = aidx; |
| 927 | ), |
| 928 | TP_printk( |
| 929 | "[%s] SDE(%u) aidx %d", |
| 930 | __get_str(dev), |
| 931 | __entry->idx, |
| 932 | __entry->aidx |
| 933 | ) |
| 934 | ); |
| 935 | |
| 936 | DEFINE_EVENT(hfi1_sdma_ahg_ad, hfi1_ahg_allocate, |
| 937 | TP_PROTO( |
| 938 | struct sdma_engine *sde, |
| 939 | int aidx |
| 940 | ), |
| 941 | TP_ARGS(sde, aidx)); |
| 942 | |
| 943 | DEFINE_EVENT(hfi1_sdma_ahg_ad, hfi1_ahg_deallocate, |
| 944 | TP_PROTO( |
| 945 | struct sdma_engine *sde, |
| 946 | int aidx |
| 947 | ), |
| 948 | TP_ARGS(sde, aidx)); |
| 949 | |
| 950 | #ifdef CONFIG_HFI1_DEBUG_SDMA_ORDER |
| 951 | TRACE_EVENT(hfi1_sdma_progress, |
| 952 | TP_PROTO( |
| 953 | struct sdma_engine *sde, |
| 954 | u16 hwhead, |
| 955 | u16 swhead, |
| 956 | struct sdma_txreq *txp |
| 957 | ), |
| 958 | TP_ARGS(sde, hwhead, swhead, txp), |
| 959 | TP_STRUCT__entry( |
| 960 | DD_DEV_ENTRY(sde->dd) |
| 961 | __field(u64, sn) |
| 962 | __field(u16, hwhead) |
| 963 | __field(u16, swhead) |
| 964 | __field(u16, txnext) |
| 965 | __field(u16, tx_tail) |
| 966 | __field(u16, tx_head) |
| 967 | __field(u8, idx) |
| 968 | ), |
| 969 | TP_fast_assign( |
| 970 | DD_DEV_ASSIGN(sde->dd); |
| 971 | __entry->hwhead = hwhead; |
| 972 | __entry->swhead = swhead; |
| 973 | __entry->tx_tail = sde->tx_tail; |
| 974 | __entry->tx_head = sde->tx_head; |
| 975 | __entry->txnext = txp ? txp->next_descq_idx : ~0; |
| 976 | __entry->idx = sde->this_idx; |
| 977 | __entry->sn = txp ? txp->sn : ~0; |
| 978 | ), |
| 979 | TP_printk( |
| 980 | "[%s] SDE(%u) sn %llu hwhead %u swhead %u next_descq_idx %u tx_head %u tx_tail %u", |
| 981 | __get_str(dev), |
| 982 | __entry->idx, |
| 983 | __entry->sn, |
| 984 | __entry->hwhead, |
| 985 | __entry->swhead, |
| 986 | __entry->txnext, |
| 987 | __entry->tx_head, |
| 988 | __entry->tx_tail |
| 989 | ) |
| 990 | ); |
| 991 | #else |
| 992 | TRACE_EVENT(hfi1_sdma_progress, |
| 993 | TP_PROTO( |
| 994 | struct sdma_engine *sde, |
| 995 | u16 hwhead, |
| 996 | u16 swhead, |
| 997 | struct sdma_txreq *txp |
| 998 | ), |
| 999 | TP_ARGS(sde, hwhead, swhead, txp), |
| 1000 | TP_STRUCT__entry( |
| 1001 | DD_DEV_ENTRY(sde->dd) |
| 1002 | __field(u16, hwhead) |
| 1003 | __field(u16, swhead) |
| 1004 | __field(u16, txnext) |
| 1005 | __field(u16, tx_tail) |
| 1006 | __field(u16, tx_head) |
| 1007 | __field(u8, idx) |
| 1008 | ), |
| 1009 | TP_fast_assign( |
| 1010 | DD_DEV_ASSIGN(sde->dd); |
| 1011 | __entry->hwhead = hwhead; |
| 1012 | __entry->swhead = swhead; |
| 1013 | __entry->tx_tail = sde->tx_tail; |
| 1014 | __entry->tx_head = sde->tx_head; |
| 1015 | __entry->txnext = txp ? txp->next_descq_idx : ~0; |
| 1016 | __entry->idx = sde->this_idx; |
| 1017 | ), |
| 1018 | TP_printk( |
| 1019 | "[%s] SDE(%u) hwhead %u swhead %u next_descq_idx %u tx_head %u tx_tail %u", |
| 1020 | __get_str(dev), |
| 1021 | __entry->idx, |
| 1022 | __entry->hwhead, |
| 1023 | __entry->swhead, |
| 1024 | __entry->txnext, |
| 1025 | __entry->tx_head, |
| 1026 | __entry->tx_tail |
| 1027 | ) |
| 1028 | ); |
| 1029 | #endif |
| 1030 | |
| 1031 | DECLARE_EVENT_CLASS(hfi1_sdma_sn, |
| 1032 | TP_PROTO( |
| 1033 | struct sdma_engine *sde, |
| 1034 | u64 sn |
| 1035 | ), |
| 1036 | TP_ARGS(sde, sn), |
| 1037 | TP_STRUCT__entry( |
| 1038 | DD_DEV_ENTRY(sde->dd) |
| 1039 | __field(u64, sn) |
| 1040 | __field(u8, idx) |
| 1041 | ), |
| 1042 | TP_fast_assign( |
| 1043 | DD_DEV_ASSIGN(sde->dd); |
| 1044 | __entry->sn = sn; |
| 1045 | __entry->idx = sde->this_idx; |
| 1046 | ), |
| 1047 | TP_printk( |
| 1048 | "[%s] SDE(%u) sn %llu", |
| 1049 | __get_str(dev), |
| 1050 | __entry->idx, |
| 1051 | __entry->sn |
| 1052 | ) |
| 1053 | ); |
| 1054 | |
| 1055 | DEFINE_EVENT(hfi1_sdma_sn, hfi1_sdma_out_sn, |
| 1056 | TP_PROTO( |
| 1057 | struct sdma_engine *sde, |
| 1058 | u64 sn |
| 1059 | ), |
| 1060 | TP_ARGS(sde, sn) |
| 1061 | ); |
| 1062 | |
| 1063 | DEFINE_EVENT(hfi1_sdma_sn, hfi1_sdma_in_sn, |
| 1064 | TP_PROTO( |
| 1065 | struct sdma_engine *sde, |
| 1066 | u64 sn |
| 1067 | ), |
| 1068 | TP_ARGS(sde, sn) |
| 1069 | ); |
| 1070 | |
| 1071 | #define USDMA_HDR_FORMAT \ |
| 1072 | "[%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" |
| 1073 | |
| 1074 | TRACE_EVENT(hfi1_sdma_user_header, |
| 1075 | TP_PROTO(struct hfi1_devdata *dd, u16 ctxt, u8 subctxt, u16 req, |
| 1076 | struct hfi1_pkt_header *hdr, u32 tidval), |
| 1077 | TP_ARGS(dd, ctxt, subctxt, req, hdr, tidval), |
| 1078 | TP_STRUCT__entry( |
| 1079 | DD_DEV_ENTRY(dd) |
| 1080 | __field(u16, ctxt) |
| 1081 | __field(u8, subctxt) |
| 1082 | __field(u16, req) |
| 1083 | __field(__le32, pbc0) |
| 1084 | __field(__le32, pbc1) |
| 1085 | __field(__be32, lrh0) |
| 1086 | __field(__be32, lrh1) |
| 1087 | __field(__be32, bth0) |
| 1088 | __field(__be32, bth1) |
| 1089 | __field(__be32, bth2) |
| 1090 | __field(__le32, kdeth0) |
| 1091 | __field(__le32, kdeth1) |
| 1092 | __field(__le32, kdeth2) |
| 1093 | __field(__le32, kdeth3) |
| 1094 | __field(__le32, kdeth4) |
| 1095 | __field(__le32, kdeth5) |
| 1096 | __field(__le32, kdeth6) |
| 1097 | __field(__le32, kdeth7) |
| 1098 | __field(__le32, kdeth8) |
| 1099 | __field(u32, tidval) |
| 1100 | ), |
| 1101 | TP_fast_assign( |
| 1102 | __le32 *pbc = (__le32 *)hdr->pbc; |
| 1103 | __be32 *lrh = (__be32 *)hdr->lrh; |
| 1104 | __be32 *bth = (__be32 *)hdr->bth; |
| 1105 | __le32 *kdeth = (__le32 *)&hdr->kdeth; |
| 1106 | |
| 1107 | DD_DEV_ASSIGN(dd); |
| 1108 | __entry->ctxt = ctxt; |
| 1109 | __entry->subctxt = subctxt; |
| 1110 | __entry->req = req; |
| 1111 | __entry->pbc0 = pbc[0]; |
| 1112 | __entry->pbc1 = pbc[1]; |
| 1113 | __entry->lrh0 = be32_to_cpu(lrh[0]); |
| 1114 | __entry->lrh1 = be32_to_cpu(lrh[1]); |
| 1115 | __entry->bth0 = be32_to_cpu(bth[0]); |
| 1116 | __entry->bth1 = be32_to_cpu(bth[1]); |
| 1117 | __entry->bth2 = be32_to_cpu(bth[2]); |
| 1118 | __entry->kdeth0 = kdeth[0]; |
| 1119 | __entry->kdeth1 = kdeth[1]; |
| 1120 | __entry->kdeth2 = kdeth[2]; |
| 1121 | __entry->kdeth3 = kdeth[3]; |
| 1122 | __entry->kdeth4 = kdeth[4]; |
| 1123 | __entry->kdeth5 = kdeth[5]; |
| 1124 | __entry->kdeth6 = kdeth[6]; |
| 1125 | __entry->kdeth7 = kdeth[7]; |
| 1126 | __entry->kdeth8 = kdeth[8]; |
| 1127 | __entry->tidval = tidval; |
| 1128 | ), |
| 1129 | TP_printk(USDMA_HDR_FORMAT, |
| 1130 | __get_str(dev), |
| 1131 | __entry->ctxt, |
| 1132 | __entry->subctxt, |
| 1133 | __entry->req, |
| 1134 | __entry->pbc1, |
| 1135 | __entry->pbc0, |
| 1136 | __entry->lrh0, |
| 1137 | __entry->lrh1, |
| 1138 | __entry->bth0, |
| 1139 | __entry->bth1, |
| 1140 | __entry->bth2, |
| 1141 | __entry->kdeth0, |
| 1142 | __entry->kdeth1, |
| 1143 | __entry->kdeth2, |
| 1144 | __entry->kdeth3, |
| 1145 | __entry->kdeth4, |
| 1146 | __entry->kdeth5, |
| 1147 | __entry->kdeth6, |
| 1148 | __entry->kdeth7, |
| 1149 | __entry->kdeth8, |
| 1150 | __entry->tidval |
| 1151 | ) |
| 1152 | ); |
| 1153 | |
| 1154 | #define SDMA_UREQ_FMT \ |
| 1155 | "[%s:%u:%u] ver/op=0x%x, iovcnt=%u, npkts=%u, frag=%u, idx=%u" |
| 1156 | TRACE_EVENT(hfi1_sdma_user_reqinfo, |
| 1157 | TP_PROTO(struct hfi1_devdata *dd, u16 ctxt, u8 subctxt, u16 *i), |
| 1158 | TP_ARGS(dd, ctxt, subctxt, i), |
| 1159 | TP_STRUCT__entry( |
| 1160 | DD_DEV_ENTRY(dd); |
| 1161 | __field(u16, ctxt) |
| 1162 | __field(u8, subctxt) |
| 1163 | __field(u8, ver_opcode) |
| 1164 | __field(u8, iovcnt) |
| 1165 | __field(u16, npkts) |
| 1166 | __field(u16, fragsize) |
| 1167 | __field(u16, comp_idx) |
| 1168 | ), |
| 1169 | TP_fast_assign( |
| 1170 | DD_DEV_ASSIGN(dd); |
| 1171 | __entry->ctxt = ctxt; |
| 1172 | __entry->subctxt = subctxt; |
| 1173 | __entry->ver_opcode = i[0] & 0xff; |
| 1174 | __entry->iovcnt = (i[0] >> 8) & 0xff; |
| 1175 | __entry->npkts = i[1]; |
| 1176 | __entry->fragsize = i[2]; |
| 1177 | __entry->comp_idx = i[3]; |
| 1178 | ), |
| 1179 | TP_printk(SDMA_UREQ_FMT, |
| 1180 | __get_str(dev), |
| 1181 | __entry->ctxt, |
| 1182 | __entry->subctxt, |
| 1183 | __entry->ver_opcode, |
| 1184 | __entry->iovcnt, |
| 1185 | __entry->npkts, |
| 1186 | __entry->fragsize, |
| 1187 | __entry->comp_idx |
| 1188 | ) |
| 1189 | ); |
| 1190 | |
| 1191 | #define usdma_complete_name(st) { st, #st } |
| 1192 | #define show_usdma_complete_state(st) \ |
| 1193 | __print_symbolic(st, \ |
| 1194 | usdma_complete_name(FREE), \ |
| 1195 | usdma_complete_name(QUEUED), \ |
| 1196 | usdma_complete_name(COMPLETE), \ |
| 1197 | usdma_complete_name(ERROR)) |
| 1198 | |
| 1199 | TRACE_EVENT(hfi1_sdma_user_completion, |
| 1200 | TP_PROTO(struct hfi1_devdata *dd, u16 ctxt, u8 subctxt, u16 idx, |
| 1201 | u8 state, int code), |
| 1202 | TP_ARGS(dd, ctxt, subctxt, idx, state, code), |
| 1203 | TP_STRUCT__entry( |
| 1204 | DD_DEV_ENTRY(dd) |
| 1205 | __field(u16, ctxt) |
| 1206 | __field(u8, subctxt) |
| 1207 | __field(u16, idx) |
| 1208 | __field(u8, state) |
| 1209 | __field(int, code) |
| 1210 | ), |
| 1211 | TP_fast_assign( |
| 1212 | DD_DEV_ASSIGN(dd); |
| 1213 | __entry->ctxt = ctxt; |
| 1214 | __entry->subctxt = subctxt; |
| 1215 | __entry->idx = idx; |
| 1216 | __entry->state = state; |
| 1217 | __entry->code = code; |
| 1218 | ), |
| 1219 | TP_printk("[%s:%u:%u:%u] SDMA completion state %s (%d)", |
| 1220 | __get_str(dev), __entry->ctxt, __entry->subctxt, |
| 1221 | __entry->idx, show_usdma_complete_state(__entry->state), |
| 1222 | __entry->code) |
| 1223 | ); |
| 1224 | |
| 1225 | const char *print_u32_array(struct trace_seq *, u32 *, int); |
| 1226 | #define __print_u32_hex(arr, len) print_u32_array(p, arr, len) |
| 1227 | |
| 1228 | TRACE_EVENT(hfi1_sdma_user_header_ahg, |
| 1229 | TP_PROTO(struct hfi1_devdata *dd, u16 ctxt, u8 subctxt, u16 req, |
| 1230 | u8 sde, u8 ahgidx, u32 *ahg, int len, u32 tidval), |
| 1231 | TP_ARGS(dd, ctxt, subctxt, req, sde, ahgidx, ahg, len, tidval), |
| 1232 | TP_STRUCT__entry( |
| 1233 | DD_DEV_ENTRY(dd) |
| 1234 | __field(u16, ctxt) |
| 1235 | __field(u8, subctxt) |
| 1236 | __field(u16, req) |
| 1237 | __field(u8, sde) |
| 1238 | __field(u8, idx) |
| 1239 | __field(int, len) |
| 1240 | __field(u32, tidval) |
| 1241 | __array(u32, ahg, 10) |
| 1242 | ), |
| 1243 | TP_fast_assign( |
| 1244 | DD_DEV_ASSIGN(dd); |
| 1245 | __entry->ctxt = ctxt; |
| 1246 | __entry->subctxt = subctxt; |
| 1247 | __entry->req = req; |
| 1248 | __entry->sde = sde; |
| 1249 | __entry->idx = ahgidx; |
| 1250 | __entry->len = len; |
| 1251 | __entry->tidval = tidval; |
| 1252 | memcpy(__entry->ahg, ahg, len * sizeof(u32)); |
| 1253 | ), |
| 1254 | TP_printk("[%s:%u:%u:%u] (SDE%u/AHG%u) ahg[0-%d]=(%s) TIDVal=0x%x", |
| 1255 | __get_str(dev), |
| 1256 | __entry->ctxt, |
| 1257 | __entry->subctxt, |
| 1258 | __entry->req, |
| 1259 | __entry->sde, |
| 1260 | __entry->idx, |
| 1261 | __entry->len - 1, |
| 1262 | __print_u32_hex(__entry->ahg, __entry->len), |
| 1263 | __entry->tidval |
| 1264 | ) |
| 1265 | ); |
| 1266 | |
| 1267 | TRACE_EVENT(hfi1_sdma_state, |
| 1268 | TP_PROTO( |
| 1269 | struct sdma_engine *sde, |
| 1270 | const char *cstate, |
| 1271 | const char *nstate |
| 1272 | ), |
| 1273 | TP_ARGS(sde, cstate, nstate), |
| 1274 | TP_STRUCT__entry( |
| 1275 | DD_DEV_ENTRY(sde->dd) |
| 1276 | __string(curstate, cstate) |
| 1277 | __string(newstate, nstate) |
| 1278 | ), |
| 1279 | TP_fast_assign( |
| 1280 | DD_DEV_ASSIGN(sde->dd); |
| 1281 | __assign_str(curstate, cstate); |
| 1282 | __assign_str(newstate, nstate); |
| 1283 | ), |
| 1284 | TP_printk("[%s] current state %s new state %s", |
| 1285 | __get_str(dev), |
| 1286 | __get_str(curstate), |
| 1287 | __get_str(newstate) |
| 1288 | ) |
| 1289 | ); |
| 1290 | |
| 1291 | #undef TRACE_SYSTEM |
| 1292 | #define TRACE_SYSTEM hfi1_rc |
| 1293 | |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1294 | DECLARE_EVENT_CLASS(hfi1_rc_template, |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1295 | TP_PROTO(struct hfi1_qp *qp, u32 psn), |
| 1296 | TP_ARGS(qp, psn), |
| 1297 | TP_STRUCT__entry( |
| 1298 | DD_DEV_ENTRY(dd_from_ibdev(qp->ibqp.device)) |
| 1299 | __field(u32, qpn) |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1300 | __field(u32, s_flags) |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1301 | __field(u32, psn) |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1302 | __field(u32, s_psn) |
| 1303 | __field(u32, s_next_psn) |
| 1304 | __field(u32, s_sending_psn) |
| 1305 | __field(u32, s_sending_hpsn) |
| 1306 | __field(u32, r_psn) |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1307 | ), |
| 1308 | TP_fast_assign( |
| 1309 | DD_DEV_ASSIGN(dd_from_ibdev(qp->ibqp.device)) |
| 1310 | __entry->qpn = qp->ibqp.qp_num; |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1311 | __entry->s_flags = qp->s_flags; |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1312 | __entry->psn = psn; |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1313 | __entry->s_psn = qp->s_psn; |
| 1314 | __entry->s_next_psn = qp->s_next_psn; |
| 1315 | __entry->s_sending_psn = qp->s_sending_psn; |
| 1316 | __entry->s_sending_hpsn = qp->s_sending_hpsn; |
| 1317 | __entry->r_psn = qp->r_psn; |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1318 | ), |
| 1319 | TP_printk( |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1320 | "[%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] | 1321 | __get_str(dev), |
| 1322 | __entry->qpn, |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1323 | __entry->s_flags, |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1324 | __entry->psn, |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1325 | __entry->s_psn, |
| 1326 | __entry->s_next_psn, |
| 1327 | __entry->s_sending_psn, |
| 1328 | __entry->s_sending_hpsn, |
| 1329 | __entry->r_psn |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1330 | ) |
| 1331 | ); |
| 1332 | |
Mike Marciniszyn | 83525b6 | 2015-10-26 10:28:48 -0400 | [diff] [blame] | 1333 | DEFINE_EVENT(hfi1_rc_template, hfi1_rc_sendcomplete, |
| 1334 | TP_PROTO(struct hfi1_qp *qp, u32 psn), |
| 1335 | TP_ARGS(qp, psn) |
| 1336 | ); |
| 1337 | |
| 1338 | DEFINE_EVENT(hfi1_rc_template, hfi1_rc_ack, |
| 1339 | TP_PROTO(struct hfi1_qp *qp, u32 psn), |
| 1340 | TP_ARGS(qp, psn) |
| 1341 | ); |
| 1342 | |
| 1343 | DEFINE_EVENT(hfi1_rc_template, hfi1_rc_timeout, |
| 1344 | TP_PROTO(struct hfi1_qp *qp, u32 psn), |
| 1345 | TP_ARGS(qp, psn) |
| 1346 | ); |
| 1347 | |
| 1348 | DEFINE_EVENT(hfi1_rc_template, hfi1_rc_rcv_error, |
Mike Marciniszyn | 7724105 | 2015-07-30 15:17:43 -0400 | [diff] [blame] | 1349 | TP_PROTO(struct hfi1_qp *qp, u32 psn), |
| 1350 | TP_ARGS(qp, psn) |
| 1351 | ); |
| 1352 | |
| 1353 | #undef TRACE_SYSTEM |
| 1354 | #define TRACE_SYSTEM hfi1_misc |
| 1355 | |
| 1356 | TRACE_EVENT(hfi1_interrupt, |
| 1357 | TP_PROTO(struct hfi1_devdata *dd, const struct is_table *is_entry, |
| 1358 | int src), |
| 1359 | TP_ARGS(dd, is_entry, src), |
| 1360 | TP_STRUCT__entry( |
| 1361 | DD_DEV_ENTRY(dd) |
| 1362 | __array(char, buf, 64) |
| 1363 | __field(int, src) |
| 1364 | ), |
| 1365 | TP_fast_assign( |
| 1366 | DD_DEV_ASSIGN(dd) |
| 1367 | is_entry->is_name(__entry->buf, 64, src - is_entry->start); |
| 1368 | __entry->src = src; |
| 1369 | ), |
| 1370 | TP_printk("[%s] source: %s [%d]", __get_str(dev), __entry->buf, |
| 1371 | __entry->src) |
| 1372 | ); |
| 1373 | |
| 1374 | /* |
| 1375 | * Note: |
| 1376 | * This produces a REALLY ugly trace in the console output when the string is |
| 1377 | * too long. |
| 1378 | */ |
| 1379 | |
| 1380 | #undef TRACE_SYSTEM |
| 1381 | #define TRACE_SYSTEM hfi1_trace |
| 1382 | |
| 1383 | #define MAX_MSG_LEN 512 |
| 1384 | |
| 1385 | DECLARE_EVENT_CLASS(hfi1_trace_template, |
| 1386 | TP_PROTO(const char *function, struct va_format *vaf), |
| 1387 | TP_ARGS(function, vaf), |
| 1388 | TP_STRUCT__entry( |
| 1389 | __string(function, function) |
| 1390 | __dynamic_array(char, msg, MAX_MSG_LEN) |
| 1391 | ), |
| 1392 | TP_fast_assign( |
| 1393 | __assign_str(function, function); |
| 1394 | WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), |
| 1395 | MAX_MSG_LEN, vaf->fmt, |
| 1396 | *vaf->va) >= MAX_MSG_LEN); |
| 1397 | ), |
| 1398 | TP_printk("(%s) %s", |
| 1399 | __get_str(function), |
| 1400 | __get_str(msg)) |
| 1401 | ); |
| 1402 | |
| 1403 | /* |
| 1404 | * It may be nice to macroize the __hfi1_trace but the va_* stuff requires an |
| 1405 | * actual function to work and can not be in a macro. |
| 1406 | */ |
| 1407 | #define __hfi1_trace_def(lvl) \ |
| 1408 | void __hfi1_trace_##lvl(const char *funct, char *fmt, ...); \ |
| 1409 | \ |
| 1410 | DEFINE_EVENT(hfi1_trace_template, hfi1_ ##lvl, \ |
| 1411 | TP_PROTO(const char *function, struct va_format *vaf), \ |
| 1412 | TP_ARGS(function, vaf)) |
| 1413 | |
| 1414 | #define __hfi1_trace_fn(lvl) \ |
| 1415 | void __hfi1_trace_##lvl(const char *func, char *fmt, ...) \ |
| 1416 | { \ |
| 1417 | struct va_format vaf = { \ |
| 1418 | .fmt = fmt, \ |
| 1419 | }; \ |
| 1420 | va_list args; \ |
| 1421 | \ |
| 1422 | va_start(args, fmt); \ |
| 1423 | vaf.va = &args; \ |
| 1424 | trace_hfi1_ ##lvl(func, &vaf); \ |
| 1425 | va_end(args); \ |
| 1426 | return; \ |
| 1427 | } |
| 1428 | |
| 1429 | /* |
| 1430 | * To create a new trace level simply define it below and as a __hfi1_trace_fn |
| 1431 | * in trace.c. This will create all the hooks for calling |
| 1432 | * hfi1_cdbg(LVL, fmt, ...); as well as take care of all |
| 1433 | * the debugfs stuff. |
| 1434 | */ |
| 1435 | __hfi1_trace_def(PKT); |
| 1436 | __hfi1_trace_def(PROC); |
| 1437 | __hfi1_trace_def(SDMA); |
| 1438 | __hfi1_trace_def(LINKVERB); |
| 1439 | __hfi1_trace_def(DEBUG); |
| 1440 | __hfi1_trace_def(SNOOP); |
| 1441 | __hfi1_trace_def(CNTR); |
| 1442 | __hfi1_trace_def(PIO); |
| 1443 | __hfi1_trace_def(DC8051); |
| 1444 | __hfi1_trace_def(FIRMWARE); |
| 1445 | __hfi1_trace_def(RCVCTRL); |
| 1446 | __hfi1_trace_def(TID); |
| 1447 | |
| 1448 | #define hfi1_cdbg(which, fmt, ...) \ |
| 1449 | __hfi1_trace_##which(__func__, fmt, ##__VA_ARGS__) |
| 1450 | |
| 1451 | #define hfi1_dbg(fmt, ...) \ |
| 1452 | hfi1_cdbg(DEBUG, fmt, ##__VA_ARGS__) |
| 1453 | |
| 1454 | /* |
| 1455 | * Define HFI1_EARLY_DBG at compile time or here to enable early trace |
| 1456 | * messages. Do not check in an enablement for this. |
| 1457 | */ |
| 1458 | |
| 1459 | #ifdef HFI1_EARLY_DBG |
| 1460 | #define hfi1_dbg_early(fmt, ...) \ |
| 1461 | trace_printk(fmt, ##__VA_ARGS__) |
| 1462 | #else |
| 1463 | #define hfi1_dbg_early(fmt, ...) |
| 1464 | #endif |
| 1465 | |
| 1466 | #endif /* __HFI1_TRACE_H */ |
| 1467 | |
| 1468 | #undef TRACE_INCLUDE_PATH |
| 1469 | #undef TRACE_INCLUDE_FILE |
| 1470 | #define TRACE_INCLUDE_PATH . |
| 1471 | #define TRACE_INCLUDE_FILE trace |
| 1472 | #include <trace/define_trace.h> |