[PATCH 2/2] firewire: core: add tracepoints event for asynchronous inbound phy packet

From: Takashi Sakamoto
Date: Mon Apr 29 2024 - 20:14:39 EST


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

Signed-off-by: Takashi Sakamoto <o-takashi@xxxxxxxxxxxxx>
---
drivers/firewire/core-transaction.c | 2 ++
include/trace/events/firewire.h | 30 +++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)

diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index a828b7167d15..d3eefbf23663 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -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;
}
diff --git a/include/trace/events/firewire.h b/include/trace/events/firewire.h
index 3ade7d4b9268..db49b9828bd1 100644
--- a/include/trace/events/firewire.h
+++ b/include/trace/events/firewire.h
@@ -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>
--
2.43.0