blob: ea0d486652c838cb08a424eed7d347315bceda42 [file] [log] [blame]
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +09001/*
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
8#undef TRACE_SYSTEM
9#define TRACE_SYSTEM snd_firewire_lib
10
11#if !defined(_AMDTP_STREAM_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
12#define _AMDTP_STREAM_TRACE_H
13
14#include <linux/tracepoint.h>
15
16TRACE_EVENT(in_packet,
Takashi Sakamotoff0fb5a2017-03-31 22:06:06 +090017 TP_PROTO(const struct amdtp_stream *s, u32 cycles, u32 cip_header[2], unsigned int payload_length, unsigned int index),
18 TP_ARGS(s, cycles, cip_header, payload_length, index),
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090019 TP_STRUCT__entry(
20 __field(unsigned int, second)
21 __field(unsigned int, cycle)
22 __field(int, channel)
23 __field(int, src)
24 __field(int, dest)
25 __field(u32, cip_header0)
26 __field(u32, cip_header1)
27 __field(unsigned int, payload_quadlets)
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090028 __field(unsigned int, packet_index)
Takashi Sakamoto17e17172016-05-18 22:27:43 +090029 __field(unsigned int, irq)
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090030 __field(unsigned int, index)
31 ),
32 TP_fast_assign(
33 __entry->second = cycles / CYCLES_PER_SECOND;
34 __entry->cycle = cycles % CYCLES_PER_SECOND;
35 __entry->channel = s->context->channel;
36 __entry->src = fw_parent_device(s->unit)->node_id;
37 __entry->dest = fw_parent_device(s->unit)->card->node_id;
38 __entry->cip_header0 = cip_header[0];
39 __entry->cip_header1 = cip_header[1];
Takashi Sakamotoff0fb5a2017-03-31 22:06:06 +090040 __entry->payload_quadlets = payload_length / 4;
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090041 __entry->packet_index = s->packet_index;
Takashi Sakamoto17e17172016-05-18 22:27:43 +090042 __entry->irq = !!in_interrupt();
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090043 __entry->index = index;
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090044 ),
45 TP_printk(
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090046 "%02u %04u %04x %04x %02d %08x %08x %03u %02u %01u %02u",
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090047 __entry->second,
48 __entry->cycle,
49 __entry->src,
50 __entry->dest,
51 __entry->channel,
52 __entry->cip_header0,
53 __entry->cip_header1,
54 __entry->payload_quadlets,
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090055 __entry->packet_index,
56 __entry->irq,
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090057 __entry->index)
58);
59
60TRACE_EVENT(out_packet,
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090061 TP_PROTO(const struct amdtp_stream *s, u32 cycles, __be32 *cip_header, unsigned int payload_length, unsigned int index),
62 TP_ARGS(s, cycles, cip_header, payload_length, index),
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090063 TP_STRUCT__entry(
64 __field(unsigned int, second)
65 __field(unsigned int, cycle)
66 __field(int, channel)
67 __field(int, src)
68 __field(int, dest)
69 __field(u32, cip_header0)
70 __field(u32, cip_header1)
71 __field(unsigned int, payload_quadlets)
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090072 __field(unsigned int, packet_index)
Takashi Sakamoto17e17172016-05-18 22:27:43 +090073 __field(unsigned int, irq)
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090074 __field(unsigned int, index)
75 ),
76 TP_fast_assign(
77 __entry->second = cycles / CYCLES_PER_SECOND;
78 __entry->cycle = cycles % CYCLES_PER_SECOND;
79 __entry->channel = s->context->channel;
80 __entry->src = fw_parent_device(s->unit)->card->node_id;
81 __entry->dest = fw_parent_device(s->unit)->node_id;
82 __entry->cip_header0 = be32_to_cpu(cip_header[0]);
83 __entry->cip_header1 = be32_to_cpu(cip_header[1]);
84 __entry->payload_quadlets = payload_length / 4;
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090085 __entry->packet_index = s->packet_index;
Takashi Sakamoto17e17172016-05-18 22:27:43 +090086 __entry->irq = !!in_interrupt();
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090087 __entry->index = index;
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090088 ),
89 TP_printk(
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090090 "%02u %04u %04x %04x %02d %08x %08x %03u %02u %01u %02u",
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090091 __entry->second,
92 __entry->cycle,
93 __entry->src,
94 __entry->dest,
95 __entry->channel,
96 __entry->cip_header0,
97 __entry->cip_header1,
98 __entry->payload_quadlets,
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090099 __entry->packet_index,
100 __entry->irq,
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +0900101 __entry->index)
102);
103
Takashi Sakamotob164d2f2017-04-09 21:33:27 +0900104TRACE_EVENT(in_packet_without_header,
105 TP_PROTO(const struct amdtp_stream *s, u32 cycles, unsigned int payload_quadlets, unsigned int data_blocks, unsigned int index),
106 TP_ARGS(s, cycles, payload_quadlets, data_blocks, index),
107 TP_STRUCT__entry(
108 __field(unsigned int, second)
109 __field(unsigned int, cycle)
110 __field(int, channel)
111 __field(int, src)
112 __field(int, dest)
113 __field(unsigned int, payload_quadlets)
114 __field(unsigned int, data_blocks)
115 __field(unsigned int, data_block_counter)
116 __field(unsigned int, packet_index)
117 __field(unsigned int, irq)
118 __field(unsigned int, index)
119 ),
120 TP_fast_assign(
121 __entry->second = cycles / CYCLES_PER_SECOND;
122 __entry->cycle = cycles % CYCLES_PER_SECOND;
123 __entry->channel = s->context->channel;
124 __entry->src = fw_parent_device(s->unit)->node_id;
125 __entry->dest = fw_parent_device(s->unit)->card->node_id;
126 __entry->payload_quadlets = payload_quadlets;
127 __entry->data_blocks = data_blocks,
128 __entry->data_block_counter = s->data_block_counter,
129 __entry->packet_index = s->packet_index;
130 __entry->irq = !!in_interrupt();
131 __entry->index = index;
132 ),
133 TP_printk(
134 "%02u %04u %04x %04x %02d %03u %3u %3u %02u %01u %02u",
135 __entry->second,
136 __entry->cycle,
137 __entry->src,
138 __entry->dest,
139 __entry->channel,
140 __entry->payload_quadlets,
141 __entry->data_blocks,
142 __entry->data_block_counter,
143 __entry->packet_index,
144 __entry->irq,
145 __entry->index)
146);
147
148TRACE_EVENT(out_packet_without_header,
149 TP_PROTO(const struct amdtp_stream *s, u32 cycles, unsigned int payload_length, unsigned int data_blocks, unsigned int index),
150 TP_ARGS(s, cycles, payload_length, data_blocks, index),
151 TP_STRUCT__entry(
152 __field(unsigned int, second)
153 __field(unsigned int, cycle)
154 __field(int, channel)
155 __field(int, src)
156 __field(int, dest)
157 __field(unsigned int, payload_quadlets)
158 __field(unsigned int, data_blocks)
159 __field(unsigned int, data_block_counter)
160 __field(unsigned int, packet_index)
161 __field(unsigned int, irq)
162 __field(unsigned int, index)
163 ),
164 TP_fast_assign(
165 __entry->second = cycles / CYCLES_PER_SECOND;
166 __entry->cycle = cycles % CYCLES_PER_SECOND;
167 __entry->channel = s->context->channel;
168 __entry->src = fw_parent_device(s->unit)->card->node_id;
169 __entry->dest = fw_parent_device(s->unit)->node_id;
170 __entry->payload_quadlets = payload_length / 4;
171 __entry->data_blocks = data_blocks,
172 __entry->data_blocks = s->data_block_counter,
173 __entry->packet_index = s->packet_index;
174 __entry->irq = !!in_interrupt();
175 __entry->index = index;
176 ),
177 TP_printk(
178 "%02u %04u %04x %04x %02d %03u %02u %03u %02u %01u %02u",
179 __entry->second,
180 __entry->cycle,
181 __entry->src,
182 __entry->dest,
183 __entry->channel,
184 __entry->payload_quadlets,
185 __entry->data_blocks,
186 __entry->data_block_counter,
187 __entry->packet_index,
188 __entry->irq,
189 __entry->index)
190);
191
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +0900192#endif
193
194#undef TRACE_INCLUDE_PATH
195#define TRACE_INCLUDE_PATH .
196#undef TRACE_INCLUDE_FILE
197#define TRACE_INCLUDE_FILE amdtp-stream-trace
198#include <trace/define_trace.h>