mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Evanchik <evanchsa@clarkson.edu>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 2.5.54] hermes: serialization fixes
Date: Fri, 3 Jan 2003 12:39:29 -0500	[thread overview]
Message-ID: <200301031239.29226.evanchsa@clarkson.edu> (raw)

The hermes MAC controller module wasn't serializing BAP seek calls. This 
caused an eventual Rx/Tx failure which equates tens of thousands of errors on 
the wireless interface. A simple spinlock is used to keep things in line.

Any comments are appreciated, I don't believe this is the best solution, but 
it is working well. Patches can be downloaded from here:

http://www.clarkson.edu/~evanchsa/software/kernel/patches/hermes.patch-2.4.20
http://www.clarkson.edu/~evanchsa/software/kernel/patches/hermes.patch-2.5.54



--- linux-2.5.54/drivers/net/wireless/hermes.h	2003-01-01 22:21:02.000000000 
-0500
+++ linux-2.5.54-devel/drivers/net/wireless/hermes.h	2003-01-03 
11:38:25.000000000 -0500
@@ -288,6 +288,9 @@
 
 	u16 inten; /* Which interrupts should be enabled? */
 
+	/* Lock to avoid tripping over ourselves */
+	spinlock_t baplock;
+
 #ifdef HERMES_DEBUG_BUFFER
 	struct hermes_debug_entry dbuf[HERMES_DEBUG_BUFSIZE];
 	unsigned long dbufp;
--- linux-2.5.54/drivers/net/wireless/hermes.c	2003-01-01 22:21:13.000000000 
-0500
+++ linux-2.5.54-devel/drivers/net/wireless/hermes.c	2003-01-03 
11:41:51.000000000 -0500
@@ -407,11 +407,18 @@
 {
 	int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
 	int err = 0;
+	unsigned long flags;
 
 	if ( (len < 0) || (len % 2) )
 		return -EINVAL;
 
+	/* Without this, system instability occurs */
+	spin_lock_irqsave((&hw->baplock), flags);
+
 	err = hermes_bap_seek(hw, bap, id, offset);
+
+	spin_unlock_irqrestore((&hw->baplock), flags);
+
 	if (err)
 		goto out;
 
@@ -433,11 +440,17 @@
 {
 	int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
 	int err = 0;
+	unsigned long flags;
 
 	if ( (len < 0) || (len % 2) )
 		return -EINVAL;
 
+	spin_lock_irqsave((&hw->baplock), flags);
+
 	err = hermes_bap_seek(hw, bap, id, offset);
+
+	spin_unlock_irqrestore((&hw->baplock), flags);
+
 	if (err)
 		goto out;
 	
@@ -463,6 +476,7 @@
 	int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
 	u16 rlength, rtype;
 	int nwords;
+	unsigned long flags;
 
 	if ( (bufsize < 0) || (bufsize % 2) )
 		return -EINVAL;
@@ -471,7 +485,12 @@
 	if (err)
 		goto out;
 
+	spin_lock_irqsave((&hw->baplock), flags);
+
 	err = hermes_bap_seek(hw, bap, rid, 0);
+
+	spin_unlock_irqrestore((&hw->baplock), flags);
+
 	if (err)
 		goto out;
 
@@ -505,8 +524,14 @@
 	int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
 	int err = 0;
 	int count;
+	unsigned long flags;
 	
+	spin_lock_irqsave((&hw->baplock), flags);
+
 	err = hermes_bap_seek(hw, bap, rid, 0);
+
+	spin_unlock_irqrestore((&hw->baplock), flags);
+
 	if (err)
 		goto out;

             reply	other threads:[~2003-01-03 17:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-03 17:39 Stephen Evanchik [this message]
2003-01-03 17:47 ` Benjamin LaHaise
2003-01-03 17:56   ` Stephen Evanchik
2003-01-06 17:40     ` Alexander Hoogerhuis
2003-01-06 18:36       ` Stephen Evanchik

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=200301031239.29226.evanchsa@clarkson.edu \
    --to=evanchsa@clarkson.edu \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®