blob: 614dfd08aa482cf88b6464306ab55d0937fa66c0 [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 Sakamoto64d0bf42019-05-19 19:01:06 +090017 TP_PROTO(const struct amdtp_stream *s, u32 cycles, const __be32 *cip_header, unsigned int payload_length, unsigned int data_blocks, unsigned int index),
18 TP_ARGS(s, cycles, cip_header, payload_length, data_blocks, 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)
Takashi Sakamotobde2bbd2019-05-19 19:01:08 +090025 __dynamic_array(u8, cip_header, cip_header ? 8 : 0)
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090026 __field(unsigned int, payload_quadlets)
Takashi Sakamoto64d0bf42019-05-19 19:01:06 +090027 __field(unsigned int, data_blocks)
28 __field(unsigned int, data_block_counter)
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090029 __field(unsigned int, packet_index)
Takashi Sakamoto17e17172016-05-18 22:27:43 +090030 __field(unsigned int, irq)
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090031 __field(unsigned int, index)
32 ),
33 TP_fast_assign(
34 __entry->second = cycles / CYCLES_PER_SECOND;
35 __entry->cycle = cycles % CYCLES_PER_SECOND;
36 __entry->channel = s->context->channel;
37 __entry->src = fw_parent_device(s->unit)->node_id;
38 __entry->dest = fw_parent_device(s->unit)->card->node_id;
Takashi Sakamotobde2bbd2019-05-19 19:01:08 +090039 if (cip_header) {
40 memcpy(__get_dynamic_array(cip_header), cip_header,
41 __get_dynamic_array_len(cip_header));
42 }
Takashi Sakamotoa8520f32019-05-19 19:01:07 +090043 __entry->payload_quadlets = payload_length / sizeof(__be32);
Takashi Sakamoto64d0bf42019-05-19 19:01:06 +090044 __entry->data_blocks = data_blocks;
45 __entry->data_block_counter = s->data_block_counter,
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090046 __entry->packet_index = s->packet_index;
Takashi Sakamoto17e17172016-05-18 22:27:43 +090047 __entry->irq = !!in_interrupt();
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090048 __entry->index = index;
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090049 ),
50 TP_printk(
Takashi Sakamotobde2bbd2019-05-19 19:01:08 +090051 "%02u %04u %04x %04x %02d %03u %02u %03u %02u %01u %02u %s",
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090052 __entry->second,
53 __entry->cycle,
54 __entry->src,
55 __entry->dest,
56 __entry->channel,
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090057 __entry->payload_quadlets,
Takashi Sakamoto64d0bf42019-05-19 19:01:06 +090058 __entry->data_blocks,
59 __entry->data_block_counter,
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090060 __entry->packet_index,
61 __entry->irq,
Takashi Sakamotobde2bbd2019-05-19 19:01:08 +090062 __entry->index,
63 __print_array(__get_dynamic_array(cip_header),
64 __get_dynamic_array_len(cip_header),
65 sizeof(u8)))
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090066);
67
68TRACE_EVENT(out_packet,
Takashi Sakamoto64d0bf42019-05-19 19:01:06 +090069 TP_PROTO(const struct amdtp_stream *s, u32 cycles, const __be32 *cip_header, unsigned int payload_length, unsigned int data_blocks, unsigned int index),
70 TP_ARGS(s, cycles, cip_header, payload_length, data_blocks, index),
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090071 TP_STRUCT__entry(
72 __field(unsigned int, second)
73 __field(unsigned int, cycle)
74 __field(int, channel)
75 __field(int, src)
76 __field(int, dest)
Takashi Sakamotobde2bbd2019-05-19 19:01:08 +090077 __dynamic_array(u8, cip_header, cip_header ? 8 : 0)
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090078 __field(unsigned int, payload_quadlets)
Takashi Sakamoto64d0bf42019-05-19 19:01:06 +090079 __field(unsigned int, data_blocks)
80 __field(unsigned int, data_block_counter)
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090081 __field(unsigned int, packet_index)
Takashi Sakamoto17e17172016-05-18 22:27:43 +090082 __field(unsigned int, irq)
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +090083 __field(unsigned int, index)
84 ),
85 TP_fast_assign(
86 __entry->second = cycles / CYCLES_PER_SECOND;
87 __entry->cycle = cycles % CYCLES_PER_SECOND;
88 __entry->channel = s->context->channel;
89 __entry->src = fw_parent_device(s->unit)->card->node_id;
90 __entry->dest = fw_parent_device(s->unit)->node_id;
Takashi Sakamotobde2bbd2019-05-19 19:01:08 +090091 if (cip_header) {
92 memcpy(__get_dynamic_array(cip_header), cip_header,
93 __get_dynamic_array_len(cip_header));
94 }
Takashi Sakamotoa8520f32019-05-19 19:01:07 +090095 __entry->payload_quadlets = payload_length / sizeof(__be32);
Takashi Sakamoto64d0bf42019-05-19 19:01:06 +090096 __entry->data_blocks = data_blocks;
97 __entry->data_block_counter = s->data_block_counter,
Takashi Sakamotoa9c42842016-05-11 07:33:27 +090098 __entry->packet_index = s->packet_index;
Takashi Sakamoto17e17172016-05-18 22:27:43 +090099 __entry->irq = !!in_interrupt();
Takashi Sakamotoa9c42842016-05-11 07:33:27 +0900100 __entry->index = index;
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +0900101 ),
102 TP_printk(
Takashi Sakamotobde2bbd2019-05-19 19:01:08 +0900103 "%02u %04u %04x %04x %02d %03u %02u %03u %02u %01u %02u %s",
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +0900104 __entry->second,
105 __entry->cycle,
106 __entry->src,
107 __entry->dest,
108 __entry->channel,
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +0900109 __entry->payload_quadlets,
Takashi Sakamoto64d0bf42019-05-19 19:01:06 +0900110 __entry->data_blocks,
111 __entry->data_block_counter,
Takashi Sakamotoa9c42842016-05-11 07:33:27 +0900112 __entry->packet_index,
113 __entry->irq,
Takashi Sakamotobde2bbd2019-05-19 19:01:08 +0900114 __entry->index,
115 __print_array(__get_dynamic_array(cip_header),
116 __get_dynamic_array_len(cip_header),
117 sizeof(u8)))
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +0900118);
119
Takashi Sakamotob164d2f2017-04-09 21:33:27 +0900120TRACE_EVENT(in_packet_without_header,
Takashi Sakamotoa8520f32019-05-19 19:01:07 +0900121 TP_PROTO(const struct amdtp_stream *s, u32 cycles, unsigned int payload_length, unsigned int data_blocks, unsigned int index),
122 TP_ARGS(s, cycles, payload_length, data_blocks, index),
Takashi Sakamotob164d2f2017-04-09 21:33:27 +0900123 TP_STRUCT__entry(
124 __field(unsigned int, second)
125 __field(unsigned int, cycle)
126 __field(int, channel)
127 __field(int, src)
128 __field(int, dest)
129 __field(unsigned int, payload_quadlets)
130 __field(unsigned int, data_blocks)
131 __field(unsigned int, data_block_counter)
132 __field(unsigned int, packet_index)
133 __field(unsigned int, irq)
134 __field(unsigned int, index)
135 ),
136 TP_fast_assign(
137 __entry->second = cycles / CYCLES_PER_SECOND;
138 __entry->cycle = cycles % CYCLES_PER_SECOND;
139 __entry->channel = s->context->channel;
140 __entry->src = fw_parent_device(s->unit)->node_id;
141 __entry->dest = fw_parent_device(s->unit)->card->node_id;
Takashi Sakamotoa8520f32019-05-19 19:01:07 +0900142 __entry->payload_quadlets = payload_length / sizeof(__be32);
Takashi Sakamotob164d2f2017-04-09 21:33:27 +0900143 __entry->data_blocks = data_blocks,
144 __entry->data_block_counter = s->data_block_counter,
145 __entry->packet_index = s->packet_index;
146 __entry->irq = !!in_interrupt();
147 __entry->index = index;
148 ),
149 TP_printk(
Takashi Sakamoto5ef108c2018-12-15 19:03:21 +0900150 "%02u %04u %04x %04x %02d %03u %02u %03u %02u %01u %02u",
Takashi Sakamotob164d2f2017-04-09 21:33:27 +0900151 __entry->second,
152 __entry->cycle,
153 __entry->src,
154 __entry->dest,
155 __entry->channel,
156 __entry->payload_quadlets,
157 __entry->data_blocks,
158 __entry->data_block_counter,
159 __entry->packet_index,
160 __entry->irq,
161 __entry->index)
162);
163
164TRACE_EVENT(out_packet_without_header,
165 TP_PROTO(const struct amdtp_stream *s, u32 cycles, unsigned int payload_length, unsigned int data_blocks, unsigned int index),
166 TP_ARGS(s, cycles, payload_length, data_blocks, index),
167 TP_STRUCT__entry(
168 __field(unsigned int, second)
169 __field(unsigned int, cycle)
170 __field(int, channel)
171 __field(int, src)
172 __field(int, dest)
173 __field(unsigned int, payload_quadlets)
174 __field(unsigned int, data_blocks)
175 __field(unsigned int, data_block_counter)
176 __field(unsigned int, packet_index)
177 __field(unsigned int, irq)
178 __field(unsigned int, index)
179 ),
180 TP_fast_assign(
181 __entry->second = cycles / CYCLES_PER_SECOND;
182 __entry->cycle = cycles % CYCLES_PER_SECOND;
183 __entry->channel = s->context->channel;
184 __entry->src = fw_parent_device(s->unit)->card->node_id;
185 __entry->dest = fw_parent_device(s->unit)->node_id;
Takashi Sakamotoa8520f32019-05-19 19:01:07 +0900186 __entry->payload_quadlets = payload_length / sizeof(__be32);
Takashi Sakamotob164d2f2017-04-09 21:33:27 +0900187 __entry->data_blocks = data_blocks,
Takashi Sakamotoaa9a9e32018-12-15 19:03:20 +0900188 __entry->data_block_counter = s->data_block_counter,
Takashi Sakamotob164d2f2017-04-09 21:33:27 +0900189 __entry->packet_index = s->packet_index;
190 __entry->irq = !!in_interrupt();
191 __entry->index = index;
192 ),
193 TP_printk(
194 "%02u %04u %04x %04x %02d %03u %02u %03u %02u %01u %02u",
195 __entry->second,
196 __entry->cycle,
197 __entry->src,
198 __entry->dest,
199 __entry->channel,
200 __entry->payload_quadlets,
201 __entry->data_blocks,
202 __entry->data_block_counter,
203 __entry->packet_index,
204 __entry->irq,
205 __entry->index)
206);
207
Takashi Sakamoto0c95c1d2016-05-09 21:12:46 +0900208#endif
209
210#undef TRACE_INCLUDE_PATH
211#define TRACE_INCLUDE_PATH .
212#undef TRACE_INCLUDE_FILE
213#define TRACE_INCLUDE_FILE amdtp-stream-trace
214#include <trace/define_trace.h>