Skip to content

Commit 6b0b708

Browse files
committed
firewire: core: add tracepoint event for handling bus reset
The core function expects hardware drivers to call fw_core_handle_bus_reset() when changing bus topology. The 1394 OHCI driver calls it when handling selfID event as a result of any bus-reset. This commit adds a tracepoints event for it. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Sakamoto <[email protected]>
1 parent 01d8604 commit 6b0b708

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

drivers/firewire/core-topology.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <asm/byteorder.h>
2121

2222
#include "core.h"
23+
#include <trace/events/firewire.h>
2324

2425
#define SELF_ID_PHY_ID(q) (((q) >> 24) & 0x3f)
2526
#define SELF_ID_EXTENDED(q) (((q) >> 23) & 0x01)
@@ -507,6 +508,8 @@ void fw_core_handle_bus_reset(struct fw_card *card, int node_id, int generation,
507508
struct fw_node *local_node;
508509
unsigned long flags;
509510

511+
trace_bus_reset_handle(generation, node_id, bm_abdicate, self_ids, self_id_count);
512+
510513
spin_lock_irqsave(&card->lock, flags);
511514

512515
/*

include/trace/events/firewire.h

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ DEFINE_EVENT(async_outbound_complete_template, async_response_outbound_complete,
204204
#undef ASYNC_HEADER_GET_SOURCE
205205
#undef ASYNC_HEADER_GET_OFFSET
206206
#undef ASYNC_HEADER_GET_RCODE
207-
#undef QUADLET_SIZE
208207

209208
TRACE_EVENT(async_phy_outbound_initiate,
210209
TP_PROTO(u64 packet, unsigned int generation, u32 first_quadlet, u32 second_quadlet),
@@ -317,6 +316,33 @@ DEFINE_EVENT(bus_reset_arrange_template, bus_reset_postpone,
317316
TP_ARGS(generation, short_reset)
318317
);
319318

319+
TRACE_EVENT(bus_reset_handle,
320+
TP_PROTO(unsigned int generation, unsigned int node_id, bool bm_abdicate, u32 *self_ids, unsigned int self_id_count),
321+
TP_ARGS(generation, node_id, bm_abdicate, self_ids, self_id_count),
322+
TP_STRUCT__entry(
323+
__field(u8, generation)
324+
__field(u8, node_id)
325+
__field(bool, bm_abdicate)
326+
__dynamic_array(u32, self_ids, self_id_count)
327+
),
328+
TP_fast_assign(
329+
__entry->generation = generation;
330+
__entry->node_id = node_id;
331+
__entry->bm_abdicate = bm_abdicate;
332+
memcpy(__get_dynamic_array(self_ids), self_ids, __get_dynamic_array_len(self_ids));
333+
),
334+
TP_printk(
335+
"generation=%u node_id=0x%04x bm_abdicate=%s self_ids=%s",
336+
__entry->generation,
337+
__entry->node_id,
338+
__entry->bm_abdicate ? "true" : "false",
339+
__print_array(__get_dynamic_array(self_ids),
340+
__get_dynamic_array_len(self_ids) / QUADLET_SIZE, QUADLET_SIZE)
341+
)
342+
);
343+
344+
#undef QUADLET_SIZE
345+
320346
#endif // _FIREWIRE_TRACE_EVENT_H
321347

322348
#include <trace/define_trace.h>

0 commit comments

Comments
 (0)