linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Collins <bcollins@debian.org>
To: Torrey Hoffman <thoffman@arnor.net>,
	Sam Bromley <sbromley@cogeco.ca>, gaxt <gaxt@rogers.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	linux firewire devel <linux1394-devel@lists.sourceforge.net>
Subject: Re: Firewire
Date: Fri, 25 Jul 2003 14:12:52 -0400	[thread overview]
Message-ID: <20030725181252.GA607@phunnypharm.org> (raw)
In-Reply-To: <20030725181303.GO23196@ruvolo.net>

Give this a try. It converts the abort_timedouts to a timer that runs
every 50ms while packets are pending. I'd bet this will increase
performance a good bit for 1394.

Expect some offsets for this patch, but it should apply without rejects.

Index: linux-2.6/drivers/ieee1394/ieee1394_core.c
===================================================================
--- linux-2.6/drivers/ieee1394/ieee1394_core.c	(revision 1013)
+++ linux-2.6/drivers/ieee1394/ieee1394_core.c	(working copy)
@@ -30,7 +30,6 @@
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/bitops.h>
-#include <linux/workqueue.h>
 #include <linux/kdev_t.h>
 #include <asm/byteorder.h>
 #include <asm/semaphore.h>
@@ -441,7 +440,10 @@
         spin_unlock_irqrestore(&host->pending_pkt_lock, flags);
 
         up(&packet->state_change);
-        schedule_work(&host->timeout_tq);
+	if (!timer_pending(&host->timeout)) {
+		host->timeout.expires = jiffies + IEEE1394_TIMEOUT_INTERVAL;
+		add_timer(&host->timeout);
+	}
 }
 
 /**
@@ -960,36 +957,33 @@
         }
 }
 
-void abort_timedouts(struct hpsb_host *host)
+void abort_timedouts(unsigned long __opaque)
 {
+	struct hpsb_host *host = (struct hpsb_host *)__opaque;
         unsigned long flags;
         struct hpsb_packet *packet;
         unsigned long expire;
-        struct list_head *lh, *next, *tlh;
+        struct list_head *lh, *tlh;
         LIST_HEAD(expiredlist);
 
         spin_lock_irqsave(&host->csr.lock, flags);
-        expire = (host->csr.split_timeout_hi * 8000 
-                  + (host->csr.split_timeout_lo >> 19))
-                * HZ / 8000;
-        /* Avoid shortening of timeout due to rounding errors: */
-        expire++;
+	expire = host->csr.expire;
         spin_unlock_irqrestore(&host->csr.lock, flags);
 
-
         spin_lock_irqsave(&host->pending_pkt_lock, flags);
 
-	for (lh = host->pending_packets.next; lh != &host->pending_packets; lh = next) {
+	list_for_each_safe(lh, tlh, &host->pending_packets) {
                 packet = list_entry(lh, struct hpsb_packet, list);
-		next = lh->next;
                 if (time_before(packet->sendtime + expire, jiffies)) {
                         list_del(&packet->list);
                         list_add(&packet->list, &expiredlist);
                 }
         }
 
-        if (!list_empty(&host->pending_packets))
-		schedule_work(&host->timeout_tq);
+        if (!list_empty(&host->pending_packets)) {
+		host->timeout.expires = jiffies + IEEE1394_TIMEOUT_INTERVAL;
+		add_timer(&host->timeout);
+	}
 
         spin_unlock_irqrestore(&host->pending_pkt_lock, flags);
 
Index: linux-2.6/drivers/ieee1394/ieee1394_core.h
===================================================================
--- linux-2.6/drivers/ieee1394/ieee1394_core.h	(revision 1013)
+++ linux-2.6/drivers/ieee1394/ieee1394_core.h	(working copy)
@@ -87,7 +87,7 @@
 	return list_entry(l, struct hpsb_packet, driver_list);
 }
 
-void abort_timedouts(struct hpsb_host *host);
+void abort_timedouts(unsigned long __opaque);
 void abort_requests(struct hpsb_host *host);
 
 struct hpsb_packet *alloc_hpsb_packet(size_t data_size);
Index: linux-2.6/drivers/ieee1394/hosts.c
===================================================================
--- linux-2.6/drivers/ieee1394/hosts.c	(revision 1013)
+++ linux-2.6/drivers/ieee1394/hosts.c	(working copy)
@@ -16,7 +16,6 @@
 #include <linux/list.h>
 #include <linux/init.h>
 #include <linux/slab.h>
-#include <linux/workqueue.h>
 
 #include "ieee1394_types.h"
 #include "hosts.h"
@@ -139,7 +138,9 @@
 
 	atomic_set(&h->generation, 0);
 
-	INIT_WORK(&h->timeout_tq, (void (*)(void*))abort_timedouts, h);
+	init_timer(&h->timeout);
+	h->timeout.data = (unsigned long) h;
+	h->timeout.function = abort_timedouts;
 
         h->topology_map = h->csr.topology_map + 3;
         h->speed_map = (u8 *)(h->csr.speed_map + 2);
Index: linux-2.6/drivers/ieee1394/hosts.h
===================================================================
--- linux-2.6/drivers/ieee1394/hosts.h	(revision 1013)
+++ linux-2.6/drivers/ieee1394/hosts.h	(working copy)
@@ -4,7 +4,7 @@
 #include <linux/device.h>
 #include <linux/wait.h>
 #include <linux/list.h>
-#include <linux/workqueue.h>
+#include <linux/timer.h>
 #include <asm/semaphore.h>
 
 #include "ieee1394_types.h"
@@ -19,6 +19,11 @@
 */
 #define CSR_CONFIG_ROM_SIZE       0x100
 
+/* The interval which our timer checks for pending packets that have timed
+ * out. This is pretty much 50ms, which is half our default split_timeout
+ * value. */
+#define IEEE1394_TIMEOUT_INTERVAL (HZ / 20)
+
 struct hpsb_packet;
 struct hpsb_iso;
 
@@ -33,7 +38,7 @@
 
         struct list_head pending_packets;
         spinlock_t pending_pkt_lock;
-        struct work_struct timeout_tq;
+        struct timer_list timeout;
 
         unsigned char iso_listen_count[64];
 

-- 
Debian     - http://www.debian.org/
Linux 1394 - http://www.linux1394.org/
Subversion - http://subversion.tigris.org/

  reply	other threads:[~2003-07-25 18:10 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-24 13:34 Firewire gaxt
2003-07-24 22:35 ` Firewire Chris Ruvolo
2003-07-24 22:36   ` Firewire Ben Collins
2003-07-24 23:09     ` Firewire Chris Ruvolo
2003-07-24 23:14       ` Firewire Ben Collins
2003-07-24 23:48         ` Firewire Chris Ruvolo
2003-07-24 23:45           ` Firewire Ben Collins
2003-07-25  0:07             ` Firewire Chris Ruvolo
2003-07-25  0:14           ` Firewire Chris Ruvolo
2003-07-25  1:13       ` Firewire Torrey Hoffman
2003-07-25  1:27         ` Firewire Chris Ruvolo
2003-07-25  1:29           ` Firewire Ben Collins
2003-07-25  2:00             ` Firewire Chris Ruvolo
2003-07-25  2:19               ` Firewire Ben Collins
2003-07-25  3:23             ` Firewire Sam Bromley
2003-07-25  4:12               ` Firewire Ben Collins
2003-07-25  5:39                 ` Firewire Chris Ruvolo
2003-07-25 13:34                   ` Firewire Ben Collins
2003-07-25 14:06                     ` Firewire gaxt
2003-07-25 13:47                       ` Firewire Ben Collins
2003-07-25 14:23                         ` Firewire gaxt
2003-07-25 15:28                           ` Firewire gaxt
2003-07-25 14:29                     ` Firewire Chris Ruvolo
2003-07-25 14:29                       ` Firewire Ben Collins
2003-07-25 15:40                         ` Firewire Ben Collins
2003-07-25 16:07                           ` Firewire Chris Ruvolo
2003-07-25 16:18                             ` Firewire Ben Collins
2003-07-25 17:02                               ` Firewire Chris Ruvolo
2003-07-25 17:07                                 ` Firewire Ben Collins
2003-07-25 17:51                               ` Firewire Torrey Hoffman
2003-07-25 18:13                                 ` Firewire Chris Ruvolo
2003-07-25 18:12                                   ` Ben Collins [this message]
2003-07-25 18:43                                     ` Firewire gaxt
2003-07-25 18:26                                       ` Firewire Ben Collins
2003-07-25 18:45                                         ` Firewire Ben Collins
2003-07-25 19:16                                           ` Firewire gaxt
2003-07-25 19:35                                           ` Firewire Chris Ruvolo
2003-07-25 20:11                                             ` Firewire Ben Collins
2003-07-25 21:48                                               ` Firewire gaxt
2003-07-26  4:41                                               ` Firewire (One fix worked, now getting oops) Sam Bromley
2003-07-26 15:12                                                 ` Ben Collins
2003-07-26 17:41                                                   ` Sam Bromley
2003-07-26 17:45                                                     ` Ben Collins
2003-07-26 16:52                                               ` Firewire Chris Ruvolo
2003-07-26 17:45                                                 ` Firewire Ben Collins
2003-07-25 20:48                                             ` Firewire Torrey Hoffman
2003-07-25 20:44                                               ` Firewire Ben Collins
2003-07-25 18:18                                   ` Firewire Torrey Hoffman
2003-07-25 18:33                                   ` Firewire gaxt
2003-07-25 16:28                           ` Firewire gaxt
2003-07-25 15:53                         ` Firewire Chris Ruvolo
2003-07-25 15:47                           ` Firewire Ben Collins
2003-07-25 16:14                             ` Firewire Chris Ruvolo
2003-07-25 13:34                   ` Firewire Ben Collins

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=20030725181252.GA607@phunnypharm.org \
    --to=bcollins@debian.org \
    --cc=gaxt@rogers.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=sbromley@cogeco.ca \
    --cc=thoffman@arnor.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).