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