firewire: core: add tracepoints event for asynchronous inbound phy packet
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Tue, 30 Apr 2024 00:14:04 +0000 (09:14 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 6 May 2024 02:06:05 +0000 (11:06 +0900)
At the former commit, a pair of tracepoints events is added to trace
asynchronous outbound phy packet. This commit adds a tracepoints event
to trace inbound phy packet. It includes transaction status as well as
the content of phy packet.

This is an example for Remote Reply Packet as a response to Remote Access
Packet sent by lsfirewirephy command in linux-firewire-utils:

async_phy_inbound: \
  packet=0xffff955fc02b4e10 generation=1 status=1 timestamp=0x0619 \
  first_quadlet=0x001c8208 second_quadlet=0xffe37df7

Link: https://lore.kernel.org/r/20240430001404.734657-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
drivers/firewire/core-transaction.c
include/trace/events/firewire.h

index a828b7167d15babfbf905926e6c18cbf351af1b2..d3eefbf236636e4956f9b6db1860701fc403a98d 100644 (file)
@@ -995,6 +995,8 @@ void fw_core_handle_request(struct fw_card *card, struct fw_packet *p)
 
        tcode = async_header_get_tcode(p->header);
        if (tcode_is_link_internal(tcode)) {
+               trace_async_phy_inbound((uintptr_t)p, p->generation, p->ack, p->timestamp,
+                                        p->header[1], p->header[2]);
                fw_cdev_handle_phy_packet(card, p);
                return;
        }
index 3ade7d4b92686de59496f79517428373d8138705..db49b9828bd1df63232ee258024616ef7c48954a 100644 (file)
@@ -254,6 +254,36 @@ TRACE_EVENT(async_phy_outbound_complete,
        )
 );
 
+TRACE_EVENT(async_phy_inbound,
+       TP_PROTO(u64 packet, unsigned int generation, unsigned int status, unsigned int timestamp, u32 first_quadlet, u32 second_quadlet),
+       TP_ARGS(packet, generation, status, timestamp, first_quadlet, second_quadlet),
+       TP_STRUCT__entry(
+               __field(u64, packet)
+               __field(u8, generation)
+               __field(u8, status)
+               __field(u16, timestamp)
+               __field(u32, first_quadlet)
+               __field(u32, second_quadlet)
+       ),
+       TP_fast_assign(
+               __entry->packet = packet;
+               __entry->generation = generation;
+               __entry->status = status;
+               __entry->timestamp = timestamp;
+               __entry->first_quadlet = first_quadlet;
+               __entry->second_quadlet = second_quadlet
+       ),
+       TP_printk(
+               "packet=0x%016llx generation=%u status=%u timestamp=0x%04x first_quadlet=0x%08x second_quadlet=0x%08x",
+               __entry->packet,
+               __entry->generation,
+               __entry->status,
+               __entry->timestamp,
+               __entry->first_quadlet,
+               __entry->second_quadlet
+       )
+);
+
 #endif // _FIREWIRE_TRACE_EVENT_H
 
 #include <trace/define_trace.h>