amdtp-stream-trace.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * amdtp-stream-trace.h - tracepoint definitions to dump a part of packet data
  3. *
  4. * Copyright (c) 2016 Takashi Sakamoto
  5. * Licensed under the terms of the GNU General Public License, version 2.
  6. */
  7. #undef TRACE_SYSTEM
  8. #define TRACE_SYSTEM snd_firewire_lib
  9. #if !defined(_AMDTP_STREAM_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  10. #define _AMDTP_STREAM_TRACE_H
  11. #include <linux/tracepoint.h>
  12. TRACE_EVENT(in_packet,
  13. TP_PROTO(const struct amdtp_stream *s, u32 cycles, u32 cip_header[2], unsigned int payload_quadlets, unsigned int index),
  14. TP_ARGS(s, cycles, cip_header, payload_quadlets, index),
  15. TP_STRUCT__entry(
  16. __field(unsigned int, second)
  17. __field(unsigned int, cycle)
  18. __field(int, channel)
  19. __field(int, src)
  20. __field(int, dest)
  21. __field(u32, cip_header0)
  22. __field(u32, cip_header1)
  23. __field(unsigned int, payload_quadlets)
  24. __field(unsigned int, packet_index)
  25. __field(unsigned int, irq)
  26. __field(unsigned int, index)
  27. ),
  28. TP_fast_assign(
  29. __entry->second = cycles / CYCLES_PER_SECOND;
  30. __entry->cycle = cycles % CYCLES_PER_SECOND;
  31. __entry->channel = s->context->channel;
  32. __entry->src = fw_parent_device(s->unit)->node_id;
  33. __entry->dest = fw_parent_device(s->unit)->card->node_id;
  34. __entry->cip_header0 = cip_header[0];
  35. __entry->cip_header1 = cip_header[1];
  36. __entry->payload_quadlets = payload_quadlets;
  37. __entry->packet_index = s->packet_index;
  38. __entry->irq = !!in_interrupt();
  39. __entry->index = index;
  40. ),
  41. TP_printk(
  42. "%02u %04u %04x %04x %02d %08x %08x %03u %02u %01u %02u",
  43. __entry->second,
  44. __entry->cycle,
  45. __entry->src,
  46. __entry->dest,
  47. __entry->channel,
  48. __entry->cip_header0,
  49. __entry->cip_header1,
  50. __entry->payload_quadlets,
  51. __entry->packet_index,
  52. __entry->irq,
  53. __entry->index)
  54. );
  55. TRACE_EVENT(out_packet,
  56. TP_PROTO(const struct amdtp_stream *s, u32 cycles, __be32 *cip_header, unsigned int payload_length, unsigned int index),
  57. TP_ARGS(s, cycles, cip_header, payload_length, index),
  58. TP_STRUCT__entry(
  59. __field(unsigned int, second)
  60. __field(unsigned int, cycle)
  61. __field(int, channel)
  62. __field(int, src)
  63. __field(int, dest)
  64. __field(u32, cip_header0)
  65. __field(u32, cip_header1)
  66. __field(unsigned int, payload_quadlets)
  67. __field(unsigned int, packet_index)
  68. __field(unsigned int, irq)
  69. __field(unsigned int, index)
  70. ),
  71. TP_fast_assign(
  72. __entry->second = cycles / CYCLES_PER_SECOND;
  73. __entry->cycle = cycles % CYCLES_PER_SECOND;
  74. __entry->channel = s->context->channel;
  75. __entry->src = fw_parent_device(s->unit)->card->node_id;
  76. __entry->dest = fw_parent_device(s->unit)->node_id;
  77. __entry->cip_header0 = be32_to_cpu(cip_header[0]);
  78. __entry->cip_header1 = be32_to_cpu(cip_header[1]);
  79. __entry->payload_quadlets = payload_length / 4;
  80. __entry->packet_index = s->packet_index;
  81. __entry->irq = !!in_interrupt();
  82. __entry->index = index;
  83. ),
  84. TP_printk(
  85. "%02u %04u %04x %04x %02d %08x %08x %03u %02u %01u %02u",
  86. __entry->second,
  87. __entry->cycle,
  88. __entry->src,
  89. __entry->dest,
  90. __entry->channel,
  91. __entry->cip_header0,
  92. __entry->cip_header1,
  93. __entry->payload_quadlets,
  94. __entry->packet_index,
  95. __entry->irq,
  96. __entry->index)
  97. );
  98. #endif
  99. #undef TRACE_INCLUDE_PATH
  100. #define TRACE_INCLUDE_PATH .
  101. #undef TRACE_INCLUDE_FILE
  102. #define TRACE_INCLUDE_FILE amdtp-stream-trace
  103. #include <trace/define_trace.h>