[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240418092303.19725-11-o-takashi@sakamocchi.jp>
Date: Thu, 18 Apr 2024 18:23:00 +0900
From: Takashi Sakamoto <o-takashi@...amocchi.jp>
To: linux1394-devel@...ts.sourceforge.net
Cc: linux-kernel@...r.kernel.org
Subject: [RFC PATCH 10/13] firewire: core: add tracepoints events for asynchronous outbound request
In a view of core transaction service, the asynchronous outbound request
consists of two stages; initiation and completion.
This commit adds a pair of event for them.
Signed-off-by: Takashi Sakamoto <o-takashi@...amocchi.jp>
---
drivers/firewire/core-transaction.c | 6 +++
drivers/firewire/trace.h | 80 ++++++++++++++++++++++++++++-
2 files changed, 85 insertions(+), 1 deletion(-)
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index 52d8d483c178..11a60094182a 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -29,6 +29,7 @@
#include <asm/byteorder.h>
#include "core.h"
+#include "trace.h"
#include "packet-header-definitions.h"
#define HEADER_DESTINATION_IS_BROADCAST(header) \
@@ -173,6 +174,8 @@ static void transmit_complete_callback(struct fw_packet *packet,
struct fw_transaction *t =
container_of(packet, struct fw_transaction, packet);
+ trace_async_request_outbound_complete(card, t, packet);
+
switch (status) {
case ACK_COMPLETE:
close_transaction(t, card, RCODE_COMPLETE, packet->timestamp);
@@ -394,6 +397,9 @@ void __fw_send_request(struct fw_card *card, struct fw_transaction *t, int tcode
spin_unlock_irqrestore(&card->lock, flags);
+ trace_async_request_outbound_initiate(card, t, &t->packet, payload,
+ tcode_is_read_request(tcode) ? 0 : length / 4);
+
card->driver->send_request(card, &t->packet);
}
EXPORT_SYMBOL_GPL(__fw_send_request);
diff --git a/drivers/firewire/trace.h b/drivers/firewire/trace.h
index d36a10460301..0f7d176ba647 100644
--- a/drivers/firewire/trace.h
+++ b/drivers/firewire/trace.h
@@ -7,8 +7,86 @@
#define _FIREWIRE_TRACE_EVENT_H
#include <linux/tracepoint.h>
+#include <linux/firewire.h>
-// Placeholder for future use.
+#include <linux/firewire-constants.h>
+
+#include "packet-header-definitions.h"
+
+TRACE_EVENT(async_request_outbound_initiate,
+ TP_PROTO(const struct fw_card *card, const struct fw_transaction *transaction,
+ const struct fw_packet *packet, const u32 *data, size_t data_count),
+ TP_ARGS(card, transaction, packet, data, data_count),
+ TP_STRUCT__entry(
+ __field(u64, transaction)
+ __field(u8, scode)
+ __field(u8, generation)
+ __field(u16, destination)
+ __field(u8, tlabel)
+ __field(u8, retry)
+ __field(u8, tcode)
+ __field(u8, priority)
+ __field(u16, source)
+ __field(u64, offset)
+ __dynamic_array(u32, data, data_count)
+ ),
+ TP_fast_assign(
+ __entry->transaction = (u64)transaction;
+ __entry->scode = packet->speed;
+ __entry->generation = packet->generation;
+ __entry->destination = async_header_get_destination(packet->header);
+ __entry->tlabel = async_header_get_tlabel(packet->header);
+ __entry->retry = async_header_get_retry(packet->header);
+ __entry->tcode = async_header_get_tcode(packet->header);
+ __entry->priority = async_header_get_priority(packet->header);
+ __entry->source = async_header_get_source(packet->header);
+ __entry->offset = async_header_get_offset(packet->header);
+ memcpy(__get_dynamic_array(data), data, __get_dynamic_array_len(data));
+ ),
+ TP_printk(
+ "transaction=0x%llx scode=%u generation=%u dst_id=0x%04x tlabel=%u retry=%u tcode=%u priority=%u src_id=0x%04x offset=0x%012llx data=%s",
+ __entry->transaction,
+ __entry->scode,
+ __entry->generation,
+ __entry->destination,
+ __entry->tlabel,
+ __entry->retry,
+ __entry->tcode,
+ __entry->priority,
+ __entry->source,
+ __entry->offset,
+ __print_array(__get_dynamic_array(data),
+ __get_dynamic_array_len(data) / sizeof(u32), sizeof(u32))
+ )
+)
+
+TRACE_EVENT(async_request_outbound_complete,
+ TP_PROTO(const struct fw_card *card, const struct fw_transaction *transaction,
+ const struct fw_packet *packet),
+ TP_ARGS(card, transaction, packet),
+ TP_STRUCT__entry(
+ __field(u64, transaction)
+ __field(u8, scode)
+ __field(u8, generation)
+ __field(u8, ack)
+ __field(u16, timestamp)
+ ),
+ TP_fast_assign(
+ __entry->transaction = (u64)transaction;
+ __entry->scode = packet->speed;
+ __entry->generation = packet->generation;
+ __entry->ack = packet->ack;
+ __entry->timestamp = packet->timestamp;
+ ),
+ TP_printk(
+ "transaction=0x%llx scode=%u generation=%u ack=%u timestamp=0x%04x",
+ __entry->transaction,
+ __entry->scode,
+ __entry->generation,
+ __entry->ack,
+ __entry->timestamp
+ )
+)
#endif // _FIREWIRE_TRACE_EVENT_H
--
2.43.0
Powered by blists - more mailing lists