trace_tx.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. /*
  2. * Copyright(c) 2015, 2016 Intel Corporation.
  3. *
  4. * This file is provided under a dual BSD/GPLv2 license. When using or
  5. * redistributing this file, you may do so under either license.
  6. *
  7. * GPL LICENSE SUMMARY
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of version 2 of the GNU General Public License as
  11. * published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * BSD LICENSE
  19. *
  20. * Redistribution and use in source and binary forms, with or without
  21. * modification, are permitted provided that the following conditions
  22. * are met:
  23. *
  24. * - Redistributions of source code must retain the above copyright
  25. * notice, this list of conditions and the following disclaimer.
  26. * - Redistributions in binary form must reproduce the above copyright
  27. * notice, this list of conditions and the following disclaimer in
  28. * the documentation and/or other materials provided with the
  29. * distribution.
  30. * - Neither the name of Intel Corporation nor the names of its
  31. * contributors may be used to endorse or promote products derived
  32. * from this software without specific prior written permission.
  33. *
  34. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  35. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  36. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  37. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  38. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  39. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  40. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  41. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  42. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  43. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  44. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  45. *
  46. */
  47. #if !defined(__HFI1_TRACE_TX_H) || defined(TRACE_HEADER_MULTI_READ)
  48. #define __HFI1_TRACE_TX_H
  49. #include <linux/tracepoint.h>
  50. #include <linux/trace_seq.h>
  51. #include "hfi.h"
  52. #include "mad.h"
  53. #include "sdma.h"
  54. const char *parse_sdma_flags(struct trace_seq *p, u64 desc0, u64 desc1);
  55. #define __parse_sdma_flags(desc0, desc1) parse_sdma_flags(p, desc0, desc1)
  56. #undef TRACE_SYSTEM
  57. #define TRACE_SYSTEM hfi1_tx
  58. TRACE_EVENT(hfi1_piofree,
  59. TP_PROTO(struct send_context *sc, int extra),
  60. TP_ARGS(sc, extra),
  61. TP_STRUCT__entry(DD_DEV_ENTRY(sc->dd)
  62. __field(u32, sw_index)
  63. __field(u32, hw_context)
  64. __field(int, extra)
  65. ),
  66. TP_fast_assign(DD_DEV_ASSIGN(sc->dd);
  67. __entry->sw_index = sc->sw_index;
  68. __entry->hw_context = sc->hw_context;
  69. __entry->extra = extra;
  70. ),
  71. TP_printk("[%s] ctxt %u(%u) extra %d",
  72. __get_str(dev),
  73. __entry->sw_index,
  74. __entry->hw_context,
  75. __entry->extra
  76. )
  77. );
  78. TRACE_EVENT(hfi1_wantpiointr,
  79. TP_PROTO(struct send_context *sc, u32 needint, u64 credit_ctrl),
  80. TP_ARGS(sc, needint, credit_ctrl),
  81. TP_STRUCT__entry(DD_DEV_ENTRY(sc->dd)
  82. __field(u32, sw_index)
  83. __field(u32, hw_context)
  84. __field(u32, needint)
  85. __field(u64, credit_ctrl)
  86. ),
  87. TP_fast_assign(DD_DEV_ASSIGN(sc->dd);
  88. __entry->sw_index = sc->sw_index;
  89. __entry->hw_context = sc->hw_context;
  90. __entry->needint = needint;
  91. __entry->credit_ctrl = credit_ctrl;
  92. ),
  93. TP_printk("[%s] ctxt %u(%u) on %d credit_ctrl 0x%llx",
  94. __get_str(dev),
  95. __entry->sw_index,
  96. __entry->hw_context,
  97. __entry->needint,
  98. (unsigned long long)__entry->credit_ctrl
  99. )
  100. );
  101. DECLARE_EVENT_CLASS(hfi1_qpsleepwakeup_template,
  102. TP_PROTO(struct rvt_qp *qp, u32 flags),
  103. TP_ARGS(qp, flags),
  104. TP_STRUCT__entry(
  105. DD_DEV_ENTRY(dd_from_ibdev(qp->ibqp.device))
  106. __field(u32, qpn)
  107. __field(u32, flags)
  108. __field(u32, s_flags)
  109. ),
  110. TP_fast_assign(
  111. DD_DEV_ASSIGN(dd_from_ibdev(qp->ibqp.device))
  112. __entry->flags = flags;
  113. __entry->qpn = qp->ibqp.qp_num;
  114. __entry->s_flags = qp->s_flags;
  115. ),
  116. TP_printk(
  117. "[%s] qpn 0x%x flags 0x%x s_flags 0x%x",
  118. __get_str(dev),
  119. __entry->qpn,
  120. __entry->flags,
  121. __entry->s_flags
  122. )
  123. );
  124. DEFINE_EVENT(hfi1_qpsleepwakeup_template, hfi1_qpwakeup,
  125. TP_PROTO(struct rvt_qp *qp, u32 flags),
  126. TP_ARGS(qp, flags));
  127. DEFINE_EVENT(hfi1_qpsleepwakeup_template, hfi1_qpsleep,
  128. TP_PROTO(struct rvt_qp *qp, u32 flags),
  129. TP_ARGS(qp, flags));
  130. TRACE_EVENT(hfi1_sdma_descriptor,
  131. TP_PROTO(struct sdma_engine *sde,
  132. u64 desc0,
  133. u64 desc1,
  134. u16 e,
  135. void *descp),
  136. TP_ARGS(sde, desc0, desc1, e, descp),
  137. TP_STRUCT__entry(DD_DEV_ENTRY(sde->dd)
  138. __field(void *, descp)
  139. __field(u64, desc0)
  140. __field(u64, desc1)
  141. __field(u16, e)
  142. __field(u8, idx)
  143. ),
  144. TP_fast_assign(DD_DEV_ASSIGN(sde->dd);
  145. __entry->desc0 = desc0;
  146. __entry->desc1 = desc1;
  147. __entry->idx = sde->this_idx;
  148. __entry->descp = descp;
  149. __entry->e = e;
  150. ),
  151. TP_printk(
  152. "[%s] SDE(%u) flags:%s addr:0x%016llx gen:%u len:%u d0:%016llx d1:%016llx to %p,%u",
  153. __get_str(dev),
  154. __entry->idx,
  155. __parse_sdma_flags(__entry->desc0, __entry->desc1),
  156. (__entry->desc0 >> SDMA_DESC0_PHY_ADDR_SHIFT) &
  157. SDMA_DESC0_PHY_ADDR_MASK,
  158. (u8)((__entry->desc1 >> SDMA_DESC1_GENERATION_SHIFT) &
  159. SDMA_DESC1_GENERATION_MASK),
  160. (u16)((__entry->desc0 >> SDMA_DESC0_BYTE_COUNT_SHIFT) &
  161. SDMA_DESC0_BYTE_COUNT_MASK),
  162. __entry->desc0,
  163. __entry->desc1,
  164. __entry->descp,
  165. __entry->e
  166. )
  167. );
  168. TRACE_EVENT(hfi1_sdma_engine_select,
  169. TP_PROTO(struct hfi1_devdata *dd, u32 sel, u8 vl, u8 idx),
  170. TP_ARGS(dd, sel, vl, idx),
  171. TP_STRUCT__entry(DD_DEV_ENTRY(dd)
  172. __field(u32, sel)
  173. __field(u8, vl)
  174. __field(u8, idx)
  175. ),
  176. TP_fast_assign(DD_DEV_ASSIGN(dd);
  177. __entry->sel = sel;
  178. __entry->vl = vl;
  179. __entry->idx = idx;
  180. ),
  181. TP_printk("[%s] selecting SDE %u sel 0x%x vl %u",
  182. __get_str(dev),
  183. __entry->idx,
  184. __entry->sel,
  185. __entry->vl
  186. )
  187. );
  188. DECLARE_EVENT_CLASS(hfi1_sdma_engine_class,
  189. TP_PROTO(struct sdma_engine *sde, u64 status),
  190. TP_ARGS(sde, status),
  191. TP_STRUCT__entry(DD_DEV_ENTRY(sde->dd)
  192. __field(u64, status)
  193. __field(u8, idx)
  194. ),
  195. TP_fast_assign(DD_DEV_ASSIGN(sde->dd);
  196. __entry->status = status;
  197. __entry->idx = sde->this_idx;
  198. ),
  199. TP_printk("[%s] SDE(%u) status %llx",
  200. __get_str(dev),
  201. __entry->idx,
  202. (unsigned long long)__entry->status
  203. )
  204. );
  205. DEFINE_EVENT(hfi1_sdma_engine_class, hfi1_sdma_engine_interrupt,
  206. TP_PROTO(struct sdma_engine *sde, u64 status),
  207. TP_ARGS(sde, status)
  208. );
  209. DEFINE_EVENT(hfi1_sdma_engine_class, hfi1_sdma_engine_progress,
  210. TP_PROTO(struct sdma_engine *sde, u64 status),
  211. TP_ARGS(sde, status)
  212. );
  213. DECLARE_EVENT_CLASS(hfi1_sdma_ahg_ad,
  214. TP_PROTO(struct sdma_engine *sde, int aidx),
  215. TP_ARGS(sde, aidx),
  216. TP_STRUCT__entry(DD_DEV_ENTRY(sde->dd)
  217. __field(int, aidx)
  218. __field(u8, idx)
  219. ),
  220. TP_fast_assign(DD_DEV_ASSIGN(sde->dd);
  221. __entry->idx = sde->this_idx;
  222. __entry->aidx = aidx;
  223. ),
  224. TP_printk("[%s] SDE(%u) aidx %d",
  225. __get_str(dev),
  226. __entry->idx,
  227. __entry->aidx
  228. )
  229. );
  230. DEFINE_EVENT(hfi1_sdma_ahg_ad, hfi1_ahg_allocate,
  231. TP_PROTO(struct sdma_engine *sde, int aidx),
  232. TP_ARGS(sde, aidx));
  233. DEFINE_EVENT(hfi1_sdma_ahg_ad, hfi1_ahg_deallocate,
  234. TP_PROTO(struct sdma_engine *sde, int aidx),
  235. TP_ARGS(sde, aidx));
  236. #ifdef CONFIG_HFI1_DEBUG_SDMA_ORDER
  237. TRACE_EVENT(hfi1_sdma_progress,
  238. TP_PROTO(struct sdma_engine *sde,
  239. u16 hwhead,
  240. u16 swhead,
  241. struct sdma_txreq *txp
  242. ),
  243. TP_ARGS(sde, hwhead, swhead, txp),
  244. TP_STRUCT__entry(DD_DEV_ENTRY(sde->dd)
  245. __field(u64, sn)
  246. __field(u16, hwhead)
  247. __field(u16, swhead)
  248. __field(u16, txnext)
  249. __field(u16, tx_tail)
  250. __field(u16, tx_head)
  251. __field(u8, idx)
  252. ),
  253. TP_fast_assign(DD_DEV_ASSIGN(sde->dd);
  254. __entry->hwhead = hwhead;
  255. __entry->swhead = swhead;
  256. __entry->tx_tail = sde->tx_tail;
  257. __entry->tx_head = sde->tx_head;
  258. __entry->txnext = txp ? txp->next_descq_idx : ~0;
  259. __entry->idx = sde->this_idx;
  260. __entry->sn = txp ? txp->sn : ~0;
  261. ),
  262. TP_printk(
  263. "[%s] SDE(%u) sn %llu hwhead %u swhead %u next_descq_idx %u tx_head %u tx_tail %u",
  264. __get_str(dev),
  265. __entry->idx,
  266. __entry->sn,
  267. __entry->hwhead,
  268. __entry->swhead,
  269. __entry->txnext,
  270. __entry->tx_head,
  271. __entry->tx_tail
  272. )
  273. );
  274. #else
  275. TRACE_EVENT(hfi1_sdma_progress,
  276. TP_PROTO(struct sdma_engine *sde,
  277. u16 hwhead, u16 swhead,
  278. struct sdma_txreq *txp
  279. ),
  280. TP_ARGS(sde, hwhead, swhead, txp),
  281. TP_STRUCT__entry(DD_DEV_ENTRY(sde->dd)
  282. __field(u16, hwhead)
  283. __field(u16, swhead)
  284. __field(u16, txnext)
  285. __field(u16, tx_tail)
  286. __field(u16, tx_head)
  287. __field(u8, idx)
  288. ),
  289. TP_fast_assign(DD_DEV_ASSIGN(sde->dd);
  290. __entry->hwhead = hwhead;
  291. __entry->swhead = swhead;
  292. __entry->tx_tail = sde->tx_tail;
  293. __entry->tx_head = sde->tx_head;
  294. __entry->txnext = txp ? txp->next_descq_idx : ~0;
  295. __entry->idx = sde->this_idx;
  296. ),
  297. TP_printk(
  298. "[%s] SDE(%u) hwhead %u swhead %u next_descq_idx %u tx_head %u tx_tail %u",
  299. __get_str(dev),
  300. __entry->idx,
  301. __entry->hwhead,
  302. __entry->swhead,
  303. __entry->txnext,
  304. __entry->tx_head,
  305. __entry->tx_tail
  306. )
  307. );
  308. #endif
  309. DECLARE_EVENT_CLASS(hfi1_sdma_sn,
  310. TP_PROTO(struct sdma_engine *sde, u64 sn),
  311. TP_ARGS(sde, sn),
  312. TP_STRUCT__entry(DD_DEV_ENTRY(sde->dd)
  313. __field(u64, sn)
  314. __field(u8, idx)
  315. ),
  316. TP_fast_assign(DD_DEV_ASSIGN(sde->dd);
  317. __entry->sn = sn;
  318. __entry->idx = sde->this_idx;
  319. ),
  320. TP_printk("[%s] SDE(%u) sn %llu",
  321. __get_str(dev),
  322. __entry->idx,
  323. __entry->sn
  324. )
  325. );
  326. DEFINE_EVENT(hfi1_sdma_sn, hfi1_sdma_out_sn,
  327. TP_PROTO(
  328. struct sdma_engine *sde,
  329. u64 sn
  330. ),
  331. TP_ARGS(sde, sn)
  332. );
  333. DEFINE_EVENT(hfi1_sdma_sn, hfi1_sdma_in_sn,
  334. TP_PROTO(struct sdma_engine *sde, u64 sn),
  335. TP_ARGS(sde, sn)
  336. );
  337. #define USDMA_HDR_FORMAT \
  338. "[%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"
  339. TRACE_EVENT(hfi1_sdma_user_header,
  340. TP_PROTO(struct hfi1_devdata *dd, u16 ctxt, u8 subctxt, u16 req,
  341. struct hfi1_pkt_header *hdr, u32 tidval),
  342. TP_ARGS(dd, ctxt, subctxt, req, hdr, tidval),
  343. TP_STRUCT__entry(
  344. DD_DEV_ENTRY(dd)
  345. __field(u16, ctxt)
  346. __field(u8, subctxt)
  347. __field(u16, req)
  348. __field(u32, pbc0)
  349. __field(u32, pbc1)
  350. __field(u32, lrh0)
  351. __field(u32, lrh1)
  352. __field(u32, bth0)
  353. __field(u32, bth1)
  354. __field(u32, bth2)
  355. __field(u32, kdeth0)
  356. __field(u32, kdeth1)
  357. __field(u32, kdeth2)
  358. __field(u32, kdeth3)
  359. __field(u32, kdeth4)
  360. __field(u32, kdeth5)
  361. __field(u32, kdeth6)
  362. __field(u32, kdeth7)
  363. __field(u32, kdeth8)
  364. __field(u32, tidval)
  365. ),
  366. TP_fast_assign(
  367. __le32 *pbc = (__le32 *)hdr->pbc;
  368. __be32 *lrh = (__be32 *)hdr->lrh;
  369. __be32 *bth = (__be32 *)hdr->bth;
  370. __le32 *kdeth = (__le32 *)&hdr->kdeth;
  371. DD_DEV_ASSIGN(dd);
  372. __entry->ctxt = ctxt;
  373. __entry->subctxt = subctxt;
  374. __entry->req = req;
  375. __entry->pbc0 = le32_to_cpu(pbc[0]);
  376. __entry->pbc1 = le32_to_cpu(pbc[1]);
  377. __entry->lrh0 = be32_to_cpu(lrh[0]);
  378. __entry->lrh1 = be32_to_cpu(lrh[1]);
  379. __entry->bth0 = be32_to_cpu(bth[0]);
  380. __entry->bth1 = be32_to_cpu(bth[1]);
  381. __entry->bth2 = be32_to_cpu(bth[2]);
  382. __entry->kdeth0 = le32_to_cpu(kdeth[0]);
  383. __entry->kdeth1 = le32_to_cpu(kdeth[1]);
  384. __entry->kdeth2 = le32_to_cpu(kdeth[2]);
  385. __entry->kdeth3 = le32_to_cpu(kdeth[3]);
  386. __entry->kdeth4 = le32_to_cpu(kdeth[4]);
  387. __entry->kdeth5 = le32_to_cpu(kdeth[5]);
  388. __entry->kdeth6 = le32_to_cpu(kdeth[6]);
  389. __entry->kdeth7 = le32_to_cpu(kdeth[7]);
  390. __entry->kdeth8 = le32_to_cpu(kdeth[8]);
  391. __entry->tidval = tidval;
  392. ),
  393. TP_printk(USDMA_HDR_FORMAT,
  394. __get_str(dev),
  395. __entry->ctxt,
  396. __entry->subctxt,
  397. __entry->req,
  398. __entry->pbc1,
  399. __entry->pbc0,
  400. __entry->lrh0,
  401. __entry->lrh1,
  402. __entry->bth0,
  403. __entry->bth1,
  404. __entry->bth2,
  405. __entry->kdeth0,
  406. __entry->kdeth1,
  407. __entry->kdeth2,
  408. __entry->kdeth3,
  409. __entry->kdeth4,
  410. __entry->kdeth5,
  411. __entry->kdeth6,
  412. __entry->kdeth7,
  413. __entry->kdeth8,
  414. __entry->tidval
  415. )
  416. );
  417. #define SDMA_UREQ_FMT \
  418. "[%s:%u:%u] ver/op=0x%x, iovcnt=%u, npkts=%u, frag=%u, idx=%u"
  419. TRACE_EVENT(hfi1_sdma_user_reqinfo,
  420. TP_PROTO(struct hfi1_devdata *dd, u16 ctxt, u8 subctxt, u16 *i),
  421. TP_ARGS(dd, ctxt, subctxt, i),
  422. TP_STRUCT__entry(
  423. DD_DEV_ENTRY(dd);
  424. __field(u16, ctxt)
  425. __field(u8, subctxt)
  426. __field(u8, ver_opcode)
  427. __field(u8, iovcnt)
  428. __field(u16, npkts)
  429. __field(u16, fragsize)
  430. __field(u16, comp_idx)
  431. ),
  432. TP_fast_assign(
  433. DD_DEV_ASSIGN(dd);
  434. __entry->ctxt = ctxt;
  435. __entry->subctxt = subctxt;
  436. __entry->ver_opcode = i[0] & 0xff;
  437. __entry->iovcnt = (i[0] >> 8) & 0xff;
  438. __entry->npkts = i[1];
  439. __entry->fragsize = i[2];
  440. __entry->comp_idx = i[3];
  441. ),
  442. TP_printk(SDMA_UREQ_FMT,
  443. __get_str(dev),
  444. __entry->ctxt,
  445. __entry->subctxt,
  446. __entry->ver_opcode,
  447. __entry->iovcnt,
  448. __entry->npkts,
  449. __entry->fragsize,
  450. __entry->comp_idx
  451. )
  452. );
  453. #define usdma_complete_name(st) { st, #st }
  454. #define show_usdma_complete_state(st) \
  455. __print_symbolic(st, \
  456. usdma_complete_name(FREE), \
  457. usdma_complete_name(QUEUED), \
  458. usdma_complete_name(COMPLETE), \
  459. usdma_complete_name(ERROR))
  460. TRACE_EVENT(hfi1_sdma_user_completion,
  461. TP_PROTO(struct hfi1_devdata *dd, u16 ctxt, u8 subctxt, u16 idx,
  462. u8 state, int code),
  463. TP_ARGS(dd, ctxt, subctxt, idx, state, code),
  464. TP_STRUCT__entry(
  465. DD_DEV_ENTRY(dd)
  466. __field(u16, ctxt)
  467. __field(u8, subctxt)
  468. __field(u16, idx)
  469. __field(u8, state)
  470. __field(int, code)
  471. ),
  472. TP_fast_assign(
  473. DD_DEV_ASSIGN(dd);
  474. __entry->ctxt = ctxt;
  475. __entry->subctxt = subctxt;
  476. __entry->idx = idx;
  477. __entry->state = state;
  478. __entry->code = code;
  479. ),
  480. TP_printk("[%s:%u:%u:%u] SDMA completion state %s (%d)",
  481. __get_str(dev), __entry->ctxt, __entry->subctxt,
  482. __entry->idx, show_usdma_complete_state(__entry->state),
  483. __entry->code)
  484. );
  485. const char *print_u32_array(struct trace_seq *, u32 *, int);
  486. #define __print_u32_hex(arr, len) print_u32_array(p, arr, len)
  487. TRACE_EVENT(hfi1_sdma_user_header_ahg,
  488. TP_PROTO(struct hfi1_devdata *dd, u16 ctxt, u8 subctxt, u16 req,
  489. u8 sde, u8 ahgidx, u32 *ahg, int len, u32 tidval),
  490. TP_ARGS(dd, ctxt, subctxt, req, sde, ahgidx, ahg, len, tidval),
  491. TP_STRUCT__entry(
  492. DD_DEV_ENTRY(dd)
  493. __field(u16, ctxt)
  494. __field(u8, subctxt)
  495. __field(u16, req)
  496. __field(u8, sde)
  497. __field(u8, idx)
  498. __field(int, len)
  499. __field(u32, tidval)
  500. __array(u32, ahg, 10)
  501. ),
  502. TP_fast_assign(
  503. DD_DEV_ASSIGN(dd);
  504. __entry->ctxt = ctxt;
  505. __entry->subctxt = subctxt;
  506. __entry->req = req;
  507. __entry->sde = sde;
  508. __entry->idx = ahgidx;
  509. __entry->len = len;
  510. __entry->tidval = tidval;
  511. memcpy(__entry->ahg, ahg, len * sizeof(u32));
  512. ),
  513. TP_printk("[%s:%u:%u:%u] (SDE%u/AHG%u) ahg[0-%d]=(%s) TIDVal=0x%x",
  514. __get_str(dev),
  515. __entry->ctxt,
  516. __entry->subctxt,
  517. __entry->req,
  518. __entry->sde,
  519. __entry->idx,
  520. __entry->len - 1,
  521. __print_u32_hex(__entry->ahg, __entry->len),
  522. __entry->tidval
  523. )
  524. );
  525. TRACE_EVENT(hfi1_sdma_state,
  526. TP_PROTO(struct sdma_engine *sde,
  527. const char *cstate,
  528. const char *nstate
  529. ),
  530. TP_ARGS(sde, cstate, nstate),
  531. TP_STRUCT__entry(DD_DEV_ENTRY(sde->dd)
  532. __string(curstate, cstate)
  533. __string(newstate, nstate)
  534. ),
  535. TP_fast_assign(DD_DEV_ASSIGN(sde->dd);
  536. __assign_str(curstate, cstate);
  537. __assign_str(newstate, nstate);
  538. ),
  539. TP_printk("[%s] current state %s new state %s",
  540. __get_str(dev),
  541. __get_str(curstate),
  542. __get_str(newstate)
  543. )
  544. );
  545. #define BCT_FORMAT \
  546. "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]"
  547. #define BCT(field) \
  548. be16_to_cpu( \
  549. ((struct buffer_control *)__get_dynamic_array(bct))->field \
  550. )
  551. DECLARE_EVENT_CLASS(hfi1_bct_template,
  552. TP_PROTO(struct hfi1_devdata *dd,
  553. struct buffer_control *bc),
  554. TP_ARGS(dd, bc),
  555. TP_STRUCT__entry(DD_DEV_ENTRY(dd)
  556. __dynamic_array(u8, bct, sizeof(*bc))
  557. ),
  558. TP_fast_assign(DD_DEV_ASSIGN(dd);
  559. memcpy(__get_dynamic_array(bct), bc,
  560. sizeof(*bc));
  561. ),
  562. TP_printk(BCT_FORMAT,
  563. BCT(overall_shared_limit),
  564. BCT(vl[0].dedicated),
  565. BCT(vl[0].shared),
  566. BCT(vl[1].dedicated),
  567. BCT(vl[1].shared),
  568. BCT(vl[2].dedicated),
  569. BCT(vl[2].shared),
  570. BCT(vl[3].dedicated),
  571. BCT(vl[3].shared),
  572. BCT(vl[4].dedicated),
  573. BCT(vl[4].shared),
  574. BCT(vl[5].dedicated),
  575. BCT(vl[5].shared),
  576. BCT(vl[6].dedicated),
  577. BCT(vl[6].shared),
  578. BCT(vl[7].dedicated),
  579. BCT(vl[7].shared),
  580. BCT(vl[15].dedicated),
  581. BCT(vl[15].shared)
  582. )
  583. );
  584. DEFINE_EVENT(hfi1_bct_template, bct_set,
  585. TP_PROTO(struct hfi1_devdata *dd, struct buffer_control *bc),
  586. TP_ARGS(dd, bc));
  587. DEFINE_EVENT(hfi1_bct_template, bct_get,
  588. TP_PROTO(struct hfi1_devdata *dd, struct buffer_control *bc),
  589. TP_ARGS(dd, bc));
  590. #endif /* __HFI1_TRACE_TX_H */
  591. #undef TRACE_INCLUDE_PATH
  592. #undef TRACE_INCLUDE_FILE
  593. #define TRACE_INCLUDE_PATH .
  594. #define TRACE_INCLUDE_FILE trace_tx
  595. #include <trace/define_trace.h>