Thomas Gleixner | da607e1 | 2019-05-29 16:57:59 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Takashi Sakamoto | 0c95c1d | 2016-05-09 21:12:46 +0900 | [diff] [blame] | 2 | /* |
| 3 | * amdtp-stream-trace.h - tracepoint definitions to dump a part of packet data |
| 4 | * |
| 5 | * Copyright (c) 2016 Takashi Sakamoto |
Takashi Sakamoto | 0c95c1d | 2016-05-09 21:12:46 +0900 | [diff] [blame] | 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 | |
Takashi Sakamoto | 8d3f1fd | 2019-05-19 19:01:09 +0900 | [diff] [blame] | 16 | TRACE_EVENT(amdtp_packet, |
Takashi Sakamoto | cdefaa44 | 2019-07-22 12:36:52 +0900 | [diff] [blame] | 17 | TP_PROTO(const struct amdtp_stream *s, u32 cycles, const __be32 *cip_header, unsigned int payload_length, unsigned int data_blocks, unsigned int data_block_counter, unsigned int index), |
| 18 | TP_ARGS(s, cycles, cip_header, payload_length, data_blocks, data_block_counter, index), |
Takashi Sakamoto | 0c95c1d | 2016-05-09 21:12:46 +0900 | [diff] [blame] | 19 | 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 Sakamoto | bde2bbd | 2019-05-19 19:01:08 +0900 | [diff] [blame] | 25 | __dynamic_array(u8, cip_header, cip_header ? 8 : 0) |
Takashi Sakamoto | 0c95c1d | 2016-05-09 21:12:46 +0900 | [diff] [blame] | 26 | __field(unsigned int, payload_quadlets) |
Takashi Sakamoto | 64d0bf4 | 2019-05-19 19:01:06 +0900 | [diff] [blame] | 27 | __field(unsigned int, data_blocks) |
| 28 | __field(unsigned int, data_block_counter) |
Takashi Sakamoto | a9c4284 | 2016-05-11 07:33:27 +0900 | [diff] [blame] | 29 | __field(unsigned int, packet_index) |
Takashi Sakamoto | 17e1717 | 2016-05-18 22:27:43 +0900 | [diff] [blame] | 30 | __field(unsigned int, irq) |
Takashi Sakamoto | 0c95c1d | 2016-05-09 21:12:46 +0900 | [diff] [blame] | 31 | __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; |
Takashi Sakamoto | 8d3f1fd | 2019-05-19 19:01:09 +0900 | [diff] [blame] | 37 | if (s->direction == AMDTP_IN_STREAM) { |
Takashi Sakamoto | e703965 | 2019-05-24 18:03:40 +0900 | [diff] [blame] | 38 | __entry->src = fw_parent_device(s->unit)->node_id; |
| 39 | __entry->dest = fw_parent_device(s->unit)->card->node_id; |
Takashi Sakamoto | eee22af | 2019-06-24 18:20:15 +0900 | [diff] [blame] | 40 | } else { |
| 41 | __entry->src = fw_parent_device(s->unit)->card->node_id; |
| 42 | __entry->dest = fw_parent_device(s->unit)->node_id; |
Takashi Sakamoto | 8d3f1fd | 2019-05-19 19:01:09 +0900 | [diff] [blame] | 43 | } |
Takashi Sakamoto | bde2bbd | 2019-05-19 19:01:08 +0900 | [diff] [blame] | 44 | if (cip_header) { |
| 45 | memcpy(__get_dynamic_array(cip_header), cip_header, |
| 46 | __get_dynamic_array_len(cip_header)); |
| 47 | } |
Takashi Sakamoto | a8520f3 | 2019-05-19 19:01:07 +0900 | [diff] [blame] | 48 | __entry->payload_quadlets = payload_length / sizeof(__be32); |
Takashi Sakamoto | 64d0bf4 | 2019-05-19 19:01:06 +0900 | [diff] [blame] | 49 | __entry->data_blocks = data_blocks; |
Takashi Sakamoto | cdefaa44 | 2019-07-22 12:36:52 +0900 | [diff] [blame] | 50 | __entry->data_block_counter = data_block_counter, |
Takashi Sakamoto | a9c4284 | 2016-05-11 07:33:27 +0900 | [diff] [blame] | 51 | __entry->packet_index = s->packet_index; |
Takashi Sakamoto | 17e1717 | 2016-05-18 22:27:43 +0900 | [diff] [blame] | 52 | __entry->irq = !!in_interrupt(); |
Takashi Sakamoto | a9c4284 | 2016-05-11 07:33:27 +0900 | [diff] [blame] | 53 | __entry->index = index; |
Takashi Sakamoto | 0c95c1d | 2016-05-09 21:12:46 +0900 | [diff] [blame] | 54 | ), |
| 55 | TP_printk( |
Takashi Sakamoto | bde2bbd | 2019-05-19 19:01:08 +0900 | [diff] [blame] | 56 | "%02u %04u %04x %04x %02d %03u %02u %03u %02u %01u %02u %s", |
Takashi Sakamoto | 0c95c1d | 2016-05-09 21:12:46 +0900 | [diff] [blame] | 57 | __entry->second, |
| 58 | __entry->cycle, |
| 59 | __entry->src, |
| 60 | __entry->dest, |
| 61 | __entry->channel, |
Takashi Sakamoto | 0c95c1d | 2016-05-09 21:12:46 +0900 | [diff] [blame] | 62 | __entry->payload_quadlets, |
Takashi Sakamoto | 64d0bf4 | 2019-05-19 19:01:06 +0900 | [diff] [blame] | 63 | __entry->data_blocks, |
| 64 | __entry->data_block_counter, |
Takashi Sakamoto | a9c4284 | 2016-05-11 07:33:27 +0900 | [diff] [blame] | 65 | __entry->packet_index, |
| 66 | __entry->irq, |
Takashi Sakamoto | bde2bbd | 2019-05-19 19:01:08 +0900 | [diff] [blame] | 67 | __entry->index, |
| 68 | __print_array(__get_dynamic_array(cip_header), |
| 69 | __get_dynamic_array_len(cip_header), |
| 70 | sizeof(u8))) |
Takashi Sakamoto | 0c95c1d | 2016-05-09 21:12:46 +0900 | [diff] [blame] | 71 | ); |
| 72 | |
Takashi Sakamoto | 0c95c1d | 2016-05-09 21:12:46 +0900 | [diff] [blame] | 73 | #endif |
| 74 | |
| 75 | #undef TRACE_INCLUDE_PATH |
| 76 | #define TRACE_INCLUDE_PATH . |
| 77 | #undef TRACE_INCLUDE_FILE |
| 78 | #define TRACE_INCLUDE_FILE amdtp-stream-trace |
| 79 | #include <trace/define_trace.h> |