Skip to content

Commit 2c945b1

Browse files
committed
firewire: core: add tracepoint event for asynchronous inbound request
This commit adds an event for asynchronous inbound request. The following example is for asynchronous block write request as IEC 61883-1 FCP request from node 0xffc1. async_request_inbound: \ transaction=0xffff89fa08cf16c0 generation=4 scode=2 status=2 \ timestamp=0x00b3 dst_id=0xffc0 tlabel=19 tcode=1 src_id=0xffc1 \ offset=0xfffff0000d00 header={0xffc04d10,0xffc1ffff,0xf0000d00,0x80000} \ data={0x19ff08,0xffff0090} Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Sakamoto <[email protected]>
1 parent 06cc078 commit 2c945b1

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

drivers/firewire/core-transaction.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -973,11 +973,13 @@ void fw_core_handle_request(struct fw_card *card, struct fw_packet *p)
973973
{
974974
struct fw_request *request;
975975
unsigned long long offset;
976+
unsigned int tcode;
976977

977978
if (p->ack != ACK_PENDING && p->ack != ACK_COMPLETE)
978979
return;
979980

980-
if (tcode_is_link_internal(async_header_get_tcode(p->header))) {
981+
tcode = async_header_get_tcode(p->header);
982+
if (tcode_is_link_internal(tcode)) {
981983
fw_cdev_handle_phy_packet(card, p);
982984
return;
983985
}
@@ -988,6 +990,10 @@ void fw_core_handle_request(struct fw_card *card, struct fw_packet *p)
988990
return;
989991
}
990992

993+
trace_async_request_inbound((uintptr_t)request, p->generation, p->speed, p->ack,
994+
p->timestamp, p->header, request->data,
995+
tcode_is_read_request(tcode) ? 0 : request->length / 4);
996+
991997
offset = async_header_get_offset(p->header);
992998

993999
if (!is_in_fcp_region(offset, request->length))

include/trace/events/firewire.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,27 @@ DEFINE_EVENT(async_inbound_template, async_response_inbound,
153153
TP_ARGS(transaction, generation, scode, status, timestamp, header, data, data_count)
154154
);
155155

156+
DEFINE_EVENT_PRINT(async_inbound_template, async_request_inbound,
157+
TP_PROTO(u64 transaction, unsigned int generation, unsigned int scode, unsigned int status, unsigned int timestamp, const u32 *header, const u32 *data, unsigned int data_count),
158+
TP_ARGS(transaction, generation, scode, status, timestamp, header, data, data_count),
159+
TP_printk(
160+
"transaction=0x%llx generation=%u scode=%u status=%u timestamp=0x%04x dst_id=0x%04x tlabel=%u tcode=%u src_id=0x%04x offset=0x%012llx header=%s data=%s",
161+
__entry->transaction,
162+
__entry->generation,
163+
__entry->scode,
164+
__entry->status,
165+
__entry->timestamp,
166+
ASYNC_HEADER_GET_DESTINATION(__entry->header),
167+
ASYNC_HEADER_GET_TLABEL(__entry->header),
168+
ASYNC_HEADER_GET_TCODE(__entry->header),
169+
ASYNC_HEADER_GET_SOURCE(__entry->header),
170+
ASYNC_HEADER_GET_OFFSET(__entry->header),
171+
__print_array(__entry->header, ASYNC_HEADER_QUADLET_COUNT, QUADLET_SIZE),
172+
__print_array(__get_dynamic_array(data),
173+
__get_dynamic_array_len(data) / QUADLET_SIZE, QUADLET_SIZE)
174+
)
175+
);
176+
156177
#undef ASYNC_HEADER_GET_DESTINATION
157178
#undef ASYNC_HEADER_GET_TLABEL
158179
#undef ASYNC_HEADER_GET_TCODE

0 commit comments

Comments
 (0)