Hi,
In IEEE 1394 bus, the type of asynchronous packet without any offset to
node address space is called as phy packet. The destination of packet is
IEEE 1394 phy itself. This type of packet is used for several purposes,
mainly for selfID at the state of bus reset, to force selection of root
node, and to adjust gap count.
This series of changes is to add tracepoints events for this kind of
asynchronous packets.
Takashi Sakamoto (2):
firewire: core/cdev: add tracepoints events for asynchronous phy
packet
firewire: core: add tracepoints event for asynchronous inbound phy
packet
drivers/firewire/core-cdev.c | 7 +++
drivers/firewire/core-transaction.c | 8 +++
include/trace/events/firewire.h | 78 +++++++++++++++++++++++++++++
3 files changed, 93 insertions(+)
--
2.43.0
In IEEE 1394 bus, the type of asynchronous packet without any offset to
node address space is called as phy packet. The destination of packet is
IEEE 1394 phy itself. This type of packet is used for several purposes,
mainly for selfID at the state of bus reset, to force selection of root
node, and to adjust gap count.
This commit adds tracepoints events for the type of asynchronous outbound
packet. Like asynchronous outbound transaction packets, a pair of events
are added to trace initiation and completion of transmission.
In the case that the phy packet is sent by kernel API, the match between
the initiation and completion is not so easy, since the data of
'struct fw_packet' is allocated statically. In the case that it is sent by
userspace applications via cdev, the match is easy, since the data is
allocated per each.
This example is for Remote Access Packet by lsfirewirephy command in
linux-firewire-utils:
async_phy_outbound_initiate: \
packet=0xffff89fb34e42e78 generation=1 first_quadlet=0x00148200 \
second_quadlet=0xffeb7dff
async_phy_outbound_complete: \
packet=0xffff89fb34e42e78 generation=1 status=1 timestamp=0x0619
Signed-off-by: Takashi Sakamoto <[email protected]>
---
drivers/firewire/core-cdev.c | 7 +++++
drivers/firewire/core-transaction.c | 6 ++++
include/trace/events/firewire.h | 48 +++++++++++++++++++++++++++++
3 files changed, 61 insertions(+)
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c
index 6274b86eb943..55993c9e0b90 100644
--- a/drivers/firewire/core-cdev.c
+++ b/drivers/firewire/core-cdev.c
@@ -35,6 +35,7 @@
#include "core.h"
+#include <trace/events/firewire.h>
/*
* ABI version history is documented in linux/firewire-cdev.h.
@@ -1558,6 +1559,9 @@ static void outbound_phy_packet_callback(struct fw_packet *packet,
struct client *e_client = e->client;
u32 rcode;
+ trace_async_phy_outbound_complete((uintptr_t)packet, status, packet->generation,
+ packet->timestamp);
+
switch (status) {
// expected:
case ACK_COMPLETE:
@@ -1655,6 +1659,9 @@ static int ioctl_send_phy_packet(struct client *client, union ioctl_arg *arg)
memcpy(pp->data, a->data, sizeof(a->data));
}
+ trace_async_phy_outbound_initiate((uintptr_t)&e->p, e->p.generation, e->p.header[1],
+ e->p.header[2]);
+
card->driver->send_request(card, &e->p);
return 0;
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index 0e49ebf52500..a828b7167d15 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -463,6 +463,8 @@ static DECLARE_COMPLETION(phy_config_done);
static void transmit_phy_packet_callback(struct fw_packet *packet,
struct fw_card *card, int status)
{
+ trace_async_phy_outbound_complete((uintptr_t)packet, packet->generation, status,
+ packet->timestamp);
complete(&phy_config_done);
}
@@ -501,6 +503,10 @@ void fw_send_phy_config(struct fw_card *card,
phy_config_packet.generation = generation;
reinit_completion(&phy_config_done);
+ trace_async_phy_outbound_initiate((uintptr_t)&phy_config_packet,
+ phy_config_packet.generation, phy_config_packet.header[1],
+ phy_config_packet.header[2]);
+
card->driver->send_request(card, &phy_config_packet);
wait_for_completion_timeout(&phy_config_done, timeout);
diff --git a/include/trace/events/firewire.h b/include/trace/events/firewire.h
index d4688e341837..3ade7d4b9268 100644
--- a/include/trace/events/firewire.h
+++ b/include/trace/events/firewire.h
@@ -206,6 +206,54 @@ DEFINE_EVENT(async_outbound_complete_template, async_response_outbound_complete,
#undef ASYNC_HEADER_GET_RCODE
#undef QUADLET_SIZE
+TRACE_EVENT(async_phy_outbound_initiate,
+ TP_PROTO(u64 packet, unsigned int generation, u32 first_quadlet, u32 second_quadlet),
+ TP_ARGS(packet, generation, first_quadlet, second_quadlet),
+ TP_STRUCT__entry(
+ __field(u64, packet)
+ __field(u8, generation)
+ __field(u32, first_quadlet)
+ __field(u32, second_quadlet)
+ ),
+ TP_fast_assign(
+ __entry->packet = packet;
+ __entry->generation = generation;
+ __entry->first_quadlet = first_quadlet;
+ __entry->second_quadlet = second_quadlet
+ ),
+ TP_printk(
+ "packet=0x%016llx generation=%u first_quadlet=0x%08x second_quadlet=0x%08x",
+ __entry->packet,
+ __entry->generation,
+ __entry->first_quadlet,
+ __entry->second_quadlet
+ )
+);
+
+TRACE_EVENT(async_phy_outbound_complete,
+ TP_PROTO(u64 packet, unsigned int generation, unsigned int status, unsigned int timestamp),
+ TP_ARGS(packet, generation, status, timestamp),
+ TP_STRUCT__entry(
+ __field(u64, packet)
+ __field(u8, generation)
+ __field(u8, status)
+ __field(u16, timestamp)
+ ),
+ TP_fast_assign(
+ __entry->packet = packet;
+ __entry->generation = generation;
+ __entry->status = status;
+ __entry->timestamp = timestamp;
+ ),
+ TP_printk(
+ "packet=0x%016llx generation=%u status=%u timestamp=0x%04x",
+ __entry->packet,
+ __entry->generation,
+ __entry->status,
+ __entry->timestamp
+ )
+);
+
#endif // _FIREWIRE_TRACE_EVENT_H
#include <trace/define_trace.h>
--
2.43.0
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 <[email protected]>
---
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
On Tue, Apr 30, 2024 at 09:14:02AM +0900, Takashi Sakamoto wrote:
> Hi,
>
> In IEEE 1394 bus, the type of asynchronous packet without any offset to
> node address space is called as phy packet. The destination of packet is
> IEEE 1394 phy itself. This type of packet is used for several purposes,
> mainly for selfID at the state of bus reset, to force selection of root
> node, and to adjust gap count.
>
> This series of changes is to add tracepoints events for this kind of
> asynchronous packets.
>
> Takashi Sakamoto (2):
> firewire: core/cdev: add tracepoints events for asynchronous phy
> packet
> firewire: core: add tracepoints event for asynchronous inbound phy
> packet
>
> drivers/firewire/core-cdev.c | 7 +++
> drivers/firewire/core-transaction.c | 8 +++
> include/trace/events/firewire.h | 78 +++++++++++++++++++++++++++++
> 3 files changed, 93 insertions(+)
Applied to for-next branch.
Regards
Takashi Sakamoto