Skip to content

Commit 1f3c0d7

Browse files
committed
firewire: core: add tracepoints events for queueing packets of isochronous context
It is helpful to trace the queueing packets of isochronous context when the core function is requested them by both in-kernel unit drivers and userspace applications. This commit adds some tracepoints events for the aim. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Sakamoto <[email protected]>
1 parent 8320b63 commit 1f3c0d7

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed

drivers/firewire/core-iso.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@ int fw_iso_context_queue(struct fw_iso_context *ctx,
191191
struct fw_iso_buffer *buffer,
192192
unsigned long payload)
193193
{
194+
trace_isoc_outbound_queue(ctx, payload, packet);
195+
trace_isoc_inbound_single_queue(ctx, payload, packet);
196+
trace_isoc_inbound_multiple_queue(ctx, payload, packet);
197+
194198
return ctx->card->driver->queue_iso(ctx, packet, buffer, payload);
195199
}
196200
EXPORT_SYMBOL(fw_iso_context_queue);

include/trace/events/firewire.h

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,85 @@ DEFINE_EVENT_CONDITION(isoc_flush_completions_template, isoc_inbound_multiple_fl
742742
TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL)
743743
);
744744

745+
#define TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet) \
746+
TP_STRUCT__entry( \
747+
__field(u64, context) \
748+
__field(u8, card_index) \
749+
__field(u32, buffer_offset) \
750+
__field(bool, interrupt) \
751+
__field(bool, skip) \
752+
__field(u8, sy) \
753+
__field(u8, tag) \
754+
__dynamic_array(u32, header, packet->header_length / QUADLET_SIZE) \
755+
)
756+
757+
#define TP_fast_assign_iso_packet(ctx, buffer_offset, packet) \
758+
TP_fast_assign( \
759+
__entry->context = (uintptr_t)ctx; \
760+
__entry->card_index = ctx->card->index; \
761+
__entry->buffer_offset = buffer_offset; \
762+
__entry->interrupt = packet->interrupt; \
763+
__entry->skip = packet->skip; \
764+
__entry->sy = packet->sy; \
765+
__entry->tag = packet->tag; \
766+
memcpy(__get_dynamic_array(header), packet->header, \
767+
__get_dynamic_array_len(header)); \
768+
)
769+
770+
TRACE_EVENT_CONDITION(isoc_outbound_queue,
771+
TP_PROTO(const struct fw_iso_context *ctx, unsigned long buffer_offset, const struct fw_iso_packet *packet),
772+
TP_ARGS(ctx, buffer_offset, packet),
773+
TP_CONDITION(ctx->type == FW_ISO_CONTEXT_TRANSMIT),
774+
TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet),
775+
TP_fast_assign_iso_packet(ctx, buffer_offset, packet),
776+
TP_printk(
777+
"context=0x%llx card_index=%u buffer_offset=0x%x interrupt=%s skip=%s sy=%d tag=%u header=%s",
778+
__entry->context,
779+
__entry->card_index,
780+
__entry->buffer_offset,
781+
__entry->interrupt ? "true" : "false",
782+
__entry->skip ? "true" : "false",
783+
__entry->sy,
784+
__entry->tag,
785+
__print_array(__get_dynamic_array(header),
786+
__get_dynamic_array_len(header) / QUADLET_SIZE, QUADLET_SIZE)
787+
)
788+
);
789+
790+
TRACE_EVENT_CONDITION(isoc_inbound_single_queue,
791+
TP_PROTO(const struct fw_iso_context *ctx, unsigned long buffer_offset, const struct fw_iso_packet *packet),
792+
TP_ARGS(ctx, buffer_offset, packet),
793+
TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE),
794+
TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet),
795+
TP_fast_assign_iso_packet(ctx, buffer_offset, packet),
796+
TP_printk(
797+
"context=0x%llx card_index=%u buffer_offset=0x%x interrupt=%s skip=%s",
798+
__entry->context,
799+
__entry->card_index,
800+
__entry->buffer_offset,
801+
__entry->interrupt ? "true" : "false",
802+
__entry->skip ? "true" : "false"
803+
)
804+
);
805+
806+
TRACE_EVENT_CONDITION(isoc_inbound_multiple_queue,
807+
TP_PROTO(const struct fw_iso_context *ctx, unsigned long buffer_offset, const struct fw_iso_packet *packet),
808+
TP_ARGS(ctx, buffer_offset, packet),
809+
TP_CONDITION(ctx->type == FW_ISO_CONTEXT_RECEIVE_MULTICHANNEL),
810+
TP_STRUCT__entry_iso_packet(ctx, buffer_offset, packet),
811+
TP_fast_assign_iso_packet(ctx, buffer_offset, packet),
812+
TP_printk(
813+
"context=0x%llx card_index=%u buffer_offset=0x%x interrupt=%s",
814+
__entry->context,
815+
__entry->card_index,
816+
__entry->buffer_offset,
817+
__entry->interrupt ? "true" : "false"
818+
)
819+
);
820+
821+
#undef TP_STRUCT__entry_iso_packet
822+
#undef TP_fast_assign_iso_packet
823+
745824
#undef QUADLET_SIZE
746825

747826
#endif // _FIREWIRE_TRACE_EVENT_H

0 commit comments

Comments
 (0)