login
Header Space

 
 

Re: [PATCH] firewire: unnecessary BM delay after generation rollover

Previous thread: [PATCH] firewire: fw-ohci: missing PPC PMac feature calls in failure path by Stefan Richter on Monday, March 24, 2008 - 3:55 pm. (1 message)

Next thread: [ANNOUNCE] Stacked GIT 0.14.2 by Catalin Marinas on Monday, March 24, 2008 - 3:59 pm. (12 messages)
To: <linux1394-devel@...>
Cc: <linux-kernel@...>
Date: Monday, March 24, 2008 - 3:56 pm

Noticed by Jarod Wilson:  The bus manager work was unnecessarily delayed
each time the bus generation counter rolled over.

Signed-off-by: Stefan Richter &lt;stefanr@s5r6.in-berlin.de&gt;
---
 drivers/firewire/fw-card.c        |    2 +-
 drivers/firewire/fw-topology.c    |    2 +-
 drivers/firewire/fw-transaction.h |    9 +++++++++
 3 files changed, 11 insertions(+), 2 deletions(-)

Index: linux/drivers/firewire/fw-card.c
===================================================================
--- linux.orig/drivers/firewire/fw-card.c
+++ linux/drivers/firewire/fw-card.c
@@ -240,7 +240,7 @@ fw_card_bm_work(struct work_struct *work
 	root_id = root_node-&gt;node_id;
 	grace = time_after(jiffies, card-&gt;reset_jiffies + DIV_ROUND_UP(HZ, 10));
 
-	if (card-&gt;bm_generation + 1 == generation ||
+	if (is_next_generation(generation, card-&gt;bm_generation) ||
 	    (card-&gt;bm_generation != generation &amp;&amp; grace)) {
 		/*
 		 * This first step is to figure out who is IRM and
Index: linux/drivers/firewire/fw-topology.c
===================================================================
--- linux.orig/drivers/firewire/fw-topology.c
+++ linux/drivers/firewire/fw-topology.c
@@ -518,7 +518,7 @@ fw_core_handle_bus_reset(struct fw_card 
 	 * previously processed one, we cannot reliably compare the
 	 * old and new topologies.
 	 */
-	if ((generation &amp; 0xff) != ((card-&gt;generation + 1) &amp; 0xff) &amp;&amp;
+	if (!is_next_generation(generation, card-&gt;generation) &amp;&amp;
 	    card-&gt;local_node != NULL) {
 		fw_notify("skipped bus generations, destroying all nodes\n");
 		fw_destroy_nodes(card);
Index: linux/drivers/firewire/fw-transaction.h
===================================================================
--- linux.orig/drivers/firewire/fw-transaction.h
+++ linux/drivers/firewire/fw-transaction.h
@@ -261,6 +261,15 @@ struct fw_card {
 };
 
 /*
+ * Check whether new_generation is the immediate successor of old_generation.
+ * Take counter roll-over at 255 (as per...
To: <linux1394-devel@...>
Cc: Stefan Richter <stefanr@...>, <linux-kernel@...>
Date: Monday, March 24, 2008 - 4:11 pm

Much nicer than the crappy patch I had in mind (just adding another &amp;&amp; 
0xff). :)

Signed-off-by: Jarod Wilson &lt;jwilson@redhat.com&gt;


-- 
Jarod Wilson
jwilson@redhat.com
--
Previous thread: [PATCH] firewire: fw-ohci: missing PPC PMac feature calls in failure path by Stefan Richter on Monday, March 24, 2008 - 3:55 pm. (1 message)

Next thread: [ANNOUNCE] Stacked GIT 0.14.2 by Catalin Marinas on Monday, March 24, 2008 - 3:59 pm. (12 messages)
speck-geostationary