1da607e19SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 20c95c1d6STakashi Sakamoto /* 30c95c1d6STakashi Sakamoto * amdtp-stream-trace.h - tracepoint definitions to dump a part of packet data 40c95c1d6STakashi Sakamoto * 50c95c1d6STakashi Sakamoto * Copyright (c) 2016 Takashi Sakamoto 60c95c1d6STakashi Sakamoto */ 70c95c1d6STakashi Sakamoto 80c95c1d6STakashi Sakamoto #undef TRACE_SYSTEM 90c95c1d6STakashi Sakamoto #define TRACE_SYSTEM snd_firewire_lib 100c95c1d6STakashi Sakamoto 110c95c1d6STakashi Sakamoto #if !defined(_AMDTP_STREAM_TRACE_H) || defined(TRACE_HEADER_MULTI_READ) 120c95c1d6STakashi Sakamoto #define _AMDTP_STREAM_TRACE_H 130c95c1d6STakashi Sakamoto 140c95c1d6STakashi Sakamoto #include <linux/tracepoint.h> 150c95c1d6STakashi Sakamoto 168d3f1fdfSTakashi Sakamoto TRACE_EVENT(amdtp_packet, 17*fef4e61bSTakashi Sakamoto 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 packet_index, unsigned int index, u32 curr_cycle_time), 18*fef4e61bSTakashi Sakamoto TP_ARGS(s, cycles, cip_header, payload_length, data_blocks, data_block_counter, packet_index, index, curr_cycle_time), 190c95c1d6STakashi Sakamoto TP_STRUCT__entry( 20*fef4e61bSTakashi Sakamoto __field(unsigned int, cycle_time) 210c95c1d6STakashi Sakamoto __field(unsigned int, second) 220c95c1d6STakashi Sakamoto __field(unsigned int, cycle) 230c95c1d6STakashi Sakamoto __field(int, channel) 240c95c1d6STakashi Sakamoto __field(int, src) 250c95c1d6STakashi Sakamoto __field(int, dest) 26bde2bbdbSTakashi Sakamoto __dynamic_array(u8, cip_header, cip_header ? 8 : 0) 270c95c1d6STakashi Sakamoto __field(unsigned int, payload_quadlets) 2864d0bf4dSTakashi Sakamoto __field(unsigned int, data_blocks) 2964d0bf4dSTakashi Sakamoto __field(unsigned int, data_block_counter) 30a9c4284bSTakashi Sakamoto __field(unsigned int, packet_index) 3117e1717cSTakashi Sakamoto __field(unsigned int, irq) 320c95c1d6STakashi Sakamoto __field(unsigned int, index) 330c95c1d6STakashi Sakamoto ), 340c95c1d6STakashi Sakamoto TP_fast_assign( 35*fef4e61bSTakashi Sakamoto __entry->cycle_time = curr_cycle_time; 360c95c1d6STakashi Sakamoto __entry->second = cycles / CYCLES_PER_SECOND; 370c95c1d6STakashi Sakamoto __entry->cycle = cycles % CYCLES_PER_SECOND; 380c95c1d6STakashi Sakamoto __entry->channel = s->context->channel; 398d3f1fdfSTakashi Sakamoto if (s->direction == AMDTP_IN_STREAM) { 40e703965aSTakashi Sakamoto __entry->src = fw_parent_device(s->unit)->node_id; 41e703965aSTakashi Sakamoto __entry->dest = fw_parent_device(s->unit)->card->node_id; 42eee22af1STakashi Sakamoto } else { 43eee22af1STakashi Sakamoto __entry->src = fw_parent_device(s->unit)->card->node_id; 44eee22af1STakashi Sakamoto __entry->dest = fw_parent_device(s->unit)->node_id; 458d3f1fdfSTakashi Sakamoto } 46bde2bbdbSTakashi Sakamoto if (cip_header) { 47bde2bbdbSTakashi Sakamoto memcpy(__get_dynamic_array(cip_header), cip_header, 48bde2bbdbSTakashi Sakamoto __get_dynamic_array_len(cip_header)); 49bde2bbdbSTakashi Sakamoto } 50a8520f3eSTakashi Sakamoto __entry->payload_quadlets = payload_length / sizeof(__be32); 5164d0bf4dSTakashi Sakamoto __entry->data_blocks = data_blocks; 52cdefaa44STakashi Sakamoto __entry->data_block_counter = data_block_counter, 53814b4312STakashi Sakamoto __entry->packet_index = packet_index; 543b86ec63STakashi Sakamoto __entry->irq = !!in_softirq(); 55a9c4284bSTakashi Sakamoto __entry->index = index; 560c95c1d6STakashi Sakamoto ), 570c95c1d6STakashi Sakamoto TP_printk( 58*fef4e61bSTakashi Sakamoto "%08x %02u %04u %04x %04x %02d %03u %02u %03u %02u %01u %02u %s", 59*fef4e61bSTakashi Sakamoto __entry->cycle_time, 600c95c1d6STakashi Sakamoto __entry->second, 610c95c1d6STakashi Sakamoto __entry->cycle, 620c95c1d6STakashi Sakamoto __entry->src, 630c95c1d6STakashi Sakamoto __entry->dest, 640c95c1d6STakashi Sakamoto __entry->channel, 650c95c1d6STakashi Sakamoto __entry->payload_quadlets, 6664d0bf4dSTakashi Sakamoto __entry->data_blocks, 6764d0bf4dSTakashi Sakamoto __entry->data_block_counter, 68a9c4284bSTakashi Sakamoto __entry->packet_index, 69a9c4284bSTakashi Sakamoto __entry->irq, 70bde2bbdbSTakashi Sakamoto __entry->index, 71bde2bbdbSTakashi Sakamoto __print_array(__get_dynamic_array(cip_header), 7210348721STakashi Sakamoto __get_dynamic_array_len(cip_header), 1)) 730c95c1d6STakashi Sakamoto ); 740c95c1d6STakashi Sakamoto 750c95c1d6STakashi Sakamoto #endif 760c95c1d6STakashi Sakamoto 770c95c1d6STakashi Sakamoto #undef TRACE_INCLUDE_PATH 780c95c1d6STakashi Sakamoto #define TRACE_INCLUDE_PATH . 790c95c1d6STakashi Sakamoto #undef TRACE_INCLUDE_FILE 800c95c1d6STakashi Sakamoto #define TRACE_INCLUDE_FILE amdtp-stream-trace 810c95c1d6STakashi Sakamoto #include <trace/define_trace.h> 82