Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/thorpej_scsipi]: src/sys/dev/scsipi Don't let the chan_qfreeze count go ...



details:   https://anonhg.NetBSD.org/src/rev/91855429d789
branches:  thorpej_scsipi
changeset: 477482:91855429d789
user:      mjacob <mjacob%NetBSD.org@localhost>
date:      Mon Apr 23 01:03:34 2001 +0000

description:
Don't let the chan_qfreeze count go negative.

It's possible that the adapters shouldn't do this. But if you think about
it, this is a function that could be called from anywhere. In any case,
the specific reason here was that there is *sometimes* one more Loop UP
message from QLogic FC cards than then Loop Down, so making the chan_qfreeze
go negative blocked the queue needlessly.

Add a splbio/splx around the test against XS_STS_DONE in scsipi_execute_xs
for the non-async case so we don't do the classic sleep after test crock.

diffstat:

 sys/dev/scsipi/scsipi_base.c |  19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diffs (54 lines):

diff -r 2bb8ae149750 -r 91855429d789 sys/dev/scsipi/scsipi_base.c
--- a/sys/dev/scsipi/scsipi_base.c      Mon Apr 23 00:57:48 2001 +0000
+++ b/sys/dev/scsipi/scsipi_base.c      Mon Apr 23 01:03:34 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scsipi_base.c,v 1.26.2.15 2001/04/22 16:40:29 bouyer Exp $     */
+/*     $NetBSD: scsipi_base.c,v 1.26.2.16 2001/04/23 01:03:34 mjacob Exp $     */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -555,6 +555,16 @@
 
        s = splbio();
        chan->chan_qfreeze -= count;
+       /*
+        * Don't let the freeze count go negative.
+        *
+        * Presumably the adapter driver could keep track of this,
+        * but it might just be easier to do this here so as to allow
+        * multiple callers, including those outside the adapter driver.
+        */
+       if (chan->chan_qfreeze < 0) {
+               chan->chan_qfreeze = 0;
+       }
        splx(s);
 }
 
@@ -1597,6 +1607,11 @@
                                        /* We'll panic shortly... */
                                }
                                splx(s);
+                               
+                               /*
+                                * XXX: We should be able to note that
+                                * XXX: that resources are needed here!
+                                */
                                return;
                        }
                        /*
@@ -1758,6 +1773,7 @@
        /*
         * Not an asynchronous command; wait for it to complete.
         */
+       s = splbio();
        while ((xs->xs_status & XS_STS_DONE) == 0) {
                if (poll) {
                        scsipi_printaddr(periph);
@@ -1766,6 +1782,7 @@
                }
                (void) tsleep(xs, PRIBIO, "xscmd", 0);
        }
+       splx(s);
 
        /*
         * Command is complete.  scsipi_done() has awakened us to perform



Home | Main Index | Thread Index | Old Index