All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: linux1394-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Subject: [RFC PATCH 10/13] firewire: core: add tracepoints events for asynchronous outbound request
Date: Thu, 18 Apr 2024 18:23:00 +0900	[thread overview]
Message-ID: <20240418092303.19725-11-o-takashi@sakamocchi.jp> (raw)
In-Reply-To: <20240418092303.19725-10-o-takashi@sakamocchi.jp>

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@sakamocchi.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


  reply	other threads:[~2024-04-18  9:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-18  9:22 [RFC PATCH 00/13] firewire: add tracepoints events for asynchronous communication Takashi Sakamoto
2024-04-18  9:22 ` [RFC PATCH 01/13] firewire: core: add common inline functions to serialize/deserialize asynchronous packet header Takashi Sakamoto
2024-04-18  9:22   ` [RFC PATCH 02/13] firewire: core: replace local macros with common inline functions for " Takashi Sakamoto
2024-04-18  9:22     ` [RFC PATCH 03/13] firewire: ohci: " Takashi Sakamoto
2024-04-18  9:22       ` [RFC PATCH 04/13] firewire: ohci: replace hard-coded values with " Takashi Sakamoto
2024-04-18  9:22         ` [RFC PATCH 05/13] firewire: ohci: replace hard-coded values with common macros Takashi Sakamoto
2024-04-18  9:22           ` [RFC PATCH 06/13] firewire: core: obsolete tcode check macros with inline functions Takashi Sakamoto
2024-04-18  9:22             ` [RFC PATCH 07/13] firewire: core: add common macro to serialize/deserialize isochronous packet header Takashi Sakamoto
2024-04-18  9:22               ` [RFC PATCH 08/13] firewire: core: replace local macros with common inline functions for " Takashi Sakamoto
2024-04-18  9:22                 ` [RFC PATCH 09/13] firewire: core: add support for Linux kernel tracepoints Takashi Sakamoto
2024-04-18  9:23                   ` Takashi Sakamoto [this message]
2024-04-18  9:23                     ` [RFC PATCH 11/13] firewire: core: add tracepoints event for asynchronous inbound response Takashi Sakamoto
2024-04-18  9:23                       ` [RFC PATCH 12/13] firewire: core: add tracepoint event for asynchronous inbound request Takashi Sakamoto
2024-04-18  9:23                         ` [RFC PATCH 13/13] firewire: core: add tracepoints events for asynchronous outbound response Takashi Sakamoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240418092303.19725-11-o-takashi@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.