Takashi Sakamoto | 0c95c1d | 2016-05-09 21:12:46 +0900 | [diff] [blame^] | 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 | |
| 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 | |
| 16 | TRACE_EVENT(in_packet, |
| 17 | TP_PROTO(const struct amdtp_stream *s, u32 cycles, u32 cip_header[2], unsigned int payload_quadlets), |
| 18 | TP_ARGS(s, cycles, cip_header, payload_quadlets), |
| 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) |
| 25 | __field(u32, cip_header0) |
| 26 | __field(u32, cip_header1) |
| 27 | __field(unsigned int, payload_quadlets) |
| 28 | __field(unsigned int, index) |
| 29 | ), |
| 30 | TP_fast_assign( |
| 31 | __entry->second = cycles / CYCLES_PER_SECOND; |
| 32 | __entry->cycle = cycles % CYCLES_PER_SECOND; |
| 33 | __entry->channel = s->context->channel; |
| 34 | __entry->src = fw_parent_device(s->unit)->node_id; |
| 35 | __entry->dest = fw_parent_device(s->unit)->card->node_id; |
| 36 | __entry->cip_header0 = cip_header[0]; |
| 37 | __entry->cip_header1 = cip_header[1]; |
| 38 | __entry->payload_quadlets = payload_quadlets; |
| 39 | __entry->index = s->packet_index; |
| 40 | ), |
| 41 | TP_printk( |
| 42 | "%02u %04u %04x %04x %02d %08x %08x %03u %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->index) |
| 52 | ); |
| 53 | |
| 54 | TRACE_EVENT(out_packet, |
| 55 | TP_PROTO(const struct amdtp_stream *s, u32 cycles, __be32 *cip_header, unsigned int payload_length), |
| 56 | TP_ARGS(s, cycles, cip_header, payload_length), |
| 57 | TP_STRUCT__entry( |
| 58 | __field(unsigned int, second) |
| 59 | __field(unsigned int, cycle) |
| 60 | __field(int, channel) |
| 61 | __field(int, src) |
| 62 | __field(int, dest) |
| 63 | __field(u32, cip_header0) |
| 64 | __field(u32, cip_header1) |
| 65 | __field(unsigned int, payload_quadlets) |
| 66 | __field(unsigned int, index) |
| 67 | ), |
| 68 | TP_fast_assign( |
| 69 | __entry->second = cycles / CYCLES_PER_SECOND; |
| 70 | __entry->cycle = cycles % CYCLES_PER_SECOND; |
| 71 | __entry->channel = s->context->channel; |
| 72 | __entry->src = fw_parent_device(s->unit)->card->node_id; |
| 73 | __entry->dest = fw_parent_device(s->unit)->node_id; |
| 74 | __entry->cip_header0 = be32_to_cpu(cip_header[0]); |
| 75 | __entry->cip_header1 = be32_to_cpu(cip_header[1]); |
| 76 | __entry->payload_quadlets = payload_length / 4; |
| 77 | __entry->index = s->packet_index; |
| 78 | ), |
| 79 | TP_printk( |
| 80 | "%02u %04u %04x %04x %02d %08x %08x %03u %02u", |
| 81 | __entry->second, |
| 82 | __entry->cycle, |
| 83 | __entry->src, |
| 84 | __entry->dest, |
| 85 | __entry->channel, |
| 86 | __entry->cip_header0, |
| 87 | __entry->cip_header1, |
| 88 | __entry->payload_quadlets, |
| 89 | __entry->index) |
| 90 | ); |
| 91 | |
| 92 | #endif |
| 93 | |
| 94 | #undef TRACE_INCLUDE_PATH |
| 95 | #define TRACE_INCLUDE_PATH . |
| 96 | #undef TRACE_INCLUDE_FILE |
| 97 | #define TRACE_INCLUDE_FILE amdtp-stream-trace |
| 98 | #include <trace/define_trace.h> |