mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] firewire: fix resetting of bus manager retry counter
@ 2008-11-29 17:56 Stefan Richter
  2008-11-29 18:00 ` [PATCH] firewire: reorder struct fw_card for better cache efficiency Stefan Richter
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Richter @ 2008-11-29 17:56 UTC (permalink / raw)
  To: linux1394-devel; +Cc: linux-kernel

An earlier change, maybe long ago, removed the copying of self_id_count
into card->self_id_count.  Since then each bus reset cleared
card->bm_retries even when it shouldn't.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/firewire/fw-topology.c    |   14 ++++++--------
 drivers/firewire/fw-transaction.h |    1 -
 2 files changed, 6 insertions(+), 9 deletions(-)

Index: linux/drivers/firewire/fw-topology.c
===================================================================
--- linux.orig/drivers/firewire/fw-topology.c
+++ linux/drivers/firewire/fw-topology.c
@@ -355,6 +355,9 @@ report_lost_node(struct fw_card *card,
 {
 	fw_node_event(card, node, FW_NODE_DESTROYED);
 	fw_node_put(node);
+
+	/* Topology has changed - reset bus manager retry counter */
+	card->bm_retries = 0;
 }
 
 static void
@@ -374,6 +377,9 @@ report_found_node(struct fw_card *card,
 	}
 
 	fw_node_event(card, node, FW_NODE_CREATED);
+
+	/* Topology has changed - reset bus manager retry counter */
+	card->bm_retries = 0;
 }
 
 void fw_destroy_nodes(struct fw_card *card)
@@ -526,14 +532,6 @@ fw_core_handle_bus_reset(struct fw_card 
 
 	spin_lock_irqsave(&card->lock, flags);
 
-	/*
-	 * If the new topology has a different self_id_count the topology
-	 * changed, either nodes were added or removed. In that case we
-	 * reset the IRM reset counter.
-	 */
-	if (card->self_id_count != self_id_count)
-		card->bm_retries = 0;
-
 	card->node_id = node_id;
 	/*
 	 * Update node_id before generation to prevent anybody from using
Index: linux/drivers/firewire/fw-transaction.h
===================================================================
--- linux.orig/drivers/firewire/fw-transaction.h
+++ linux/drivers/firewire/fw-transaction.h
@@ -239,7 +239,6 @@ struct fw_card {
 	 * We need to store up to 4 self ID for a maximum of 63
 	 * devices plus 3 words for the topology map header.
 	 */
-	int self_id_count;
 	u32 topology_map[252 + 3];
 	u32 broadcast_channel;
 

-- 
Stefan Richter
-=====-==--- =-== ===-=
http://arcgraph.de/sr/


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] firewire: reorder struct fw_card for better cache efficiency
  2008-11-29 17:56 [PATCH] firewire: fix resetting of bus manager retry counter Stefan Richter
@ 2008-11-29 18:00 ` Stefan Richter
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Richter @ 2008-11-29 18:00 UTC (permalink / raw)
  To: linux1394-devel; +Cc: linux-kernel

topology_map is by far the largest member in struct fw_card.  Move it to
the very end of the struct so that card pointer dereferences have better
chances to hit the CPU cache.

This requires to increase the topology_map backing store to the size
specified in IEEE 1394, i.e. 256 rather than 255 quadlets.  Otherwise
the topology_map response handler may access invalid memory.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/firewire/fw-transaction.h |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

Index: linux/drivers/firewire/fw-transaction.h
===================================================================
--- linux.orig/drivers/firewire/fw-transaction.h
+++ linux/drivers/firewire/fw-transaction.h
@@ -235,13 +235,6 @@ struct fw_card {
 	int link_speed;
 	int config_rom_generation;
 
-	/*
-	 * We need to store up to 4 self ID for a maximum of 63
-	 * devices plus 3 words for the topology map header.
-	 */
-	u32 topology_map[252 + 3];
-	u32 broadcast_channel;
-
 	spinlock_t lock; /* Take this lock when handling the lists in
 			  * this struct. */
 	struct fw_node *local_node;
@@ -259,6 +252,9 @@ struct fw_card {
 	struct delayed_work work;
 	int bm_retries;
 	int bm_generation;
+
+	u32 broadcast_channel;
+	u32 topology_map[(CSR_TOPOLOGY_MAP_END - CSR_TOPOLOGY_MAP) / 4];
 };
 
 static inline struct fw_card *fw_card_get(struct fw_card *card)

-- 
Stefan Richter
-=====-==--- =-== ===-=
http://arcgraph.de/sr/


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-29 18:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-29 17:56 [PATCH] firewire: fix resetting of bus manager retry counter Stefan Richter
2008-11-29 18:00 ` [PATCH] firewire: reorder struct fw_card for better cache efficiency Stefan Richter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®