Source-Changes-HG archive

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

[src/thorpej_scsipi]: src/sys/dev/ic - Eliminate sleeping from adapter routines.



details:   https://anonhg.NetBSD.org/src/rev/f88ee77df169
branches:  thorpej_scsipi
changeset: 477293:f88ee77df169
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Wed Oct 20 20:41:27 1999 +0000

description:
- Eliminate sleeping from adapter routines.
- On a LOOP DOWN event, freeze the channel queue.
- On a LOOP UP event, do a timed thaw on the channel queue.

diffstat:

 sys/dev/ic/isp_netbsd.c |  67 ++++++++----------------------------------------
 sys/dev/ic/isp_netbsd.h |   5 +--
 2 files changed, 12 insertions(+), 60 deletions(-)

diffs (132 lines):

diff -r 2d704549ccb5 -r f88ee77df169 sys/dev/ic/isp_netbsd.c
--- a/sys/dev/ic/isp_netbsd.c   Wed Oct 20 20:40:51 1999 +0000
+++ b/sys/dev/ic/isp_netbsd.c   Wed Oct 20 20:41:27 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_netbsd.c,v 1.18.2.3 1999/10/19 21:05:06 thorpej Exp $ */
+/* $NetBSD: isp_netbsd.c,v 1.18.2.4 1999/10/20 20:41:27 thorpej Exp $ */
 /*
  * Platform (NetBSD) dependent common attachment code for Qlogic adapters.
  * Matthew Jacob <mjacob%nas.nasa.gov@localhost>
@@ -42,7 +42,6 @@
 static int isp_poll __P((struct ispsoftc *, ISP_SCSI_XFER_T *, int));
 static void isp_watch __P((void *));
 static void isp_command_requeue __P((void *));
-static void isp_internal_restart __P((void *));
 
 /*
  * Complete attachment of hardware, include subdevices.
@@ -56,7 +55,6 @@
        int i;
 
        isp->isp_state = ISP_RUNSTATE;
-       TAILQ_INIT(&isp->isp_osinfo.waitq);     /* XXX 2nd Bus? */
 
        /*
         * Fill in the scsipi_adapter.
@@ -222,23 +220,6 @@
                        ENABLE_INTS(isp);
                }
 
-               /*
-                * Check for queue blockage...
-                * XXX Should be done in the mid-layer.
-                */
-               if (isp->isp_osinfo.blocked) {
-                       if (xs->xs_control & XS_CTL_POLL) {
-                               xs->error = XS_BUSY;
-                               scsipi_done(xs);
-                               splx(s);
-                               return;
-                       }
-                       TAILQ_INSERT_TAIL(&isp->isp_osinfo.waitq, xs,
-                           channel_q);
-                       splx(s);
-                       return;
-               }
-
                DISABLE_INTS(isp);
                result = ispscsicmd(xs);
                ENABLE_INTS(isp);
@@ -487,39 +468,6 @@
        (void) splx(s);
 }
 
-/*
- * Restart function after a LOOP UP event (e.g.),
- * done as a timeout for some hysteresis.
- */
-static void
-isp_internal_restart(arg)
-       void *arg;
-{
-       struct ispsoftc *isp = arg;
-       int result, nrestarted = 0, s;
-
-       s = splbio();
-       if (isp->isp_osinfo.blocked == 0) {
-               struct scsipi_xfer *xs;
-               while ((xs = TAILQ_FIRST(&isp->isp_osinfo.waitq)) != NULL) {
-                       TAILQ_REMOVE(&isp->isp_osinfo.waitq, xs, channel_q);
-                       DISABLE_INTS(isp);
-                       result = ispscsicmd(xs);
-                       ENABLE_INTS(isp);
-                       if (result != CMD_QUEUED) {
-                               printf("%s: botched command restart (0x%x)\n",
-                                   isp->isp_name, result);
-                               if (XS_ERR(xs) == XS_NOERROR)
-                                       XS_SETERR(xs, HBA_BOTCH);
-                               XS_CMD_DONE(xs);
-                       }
-                       nrestarted++;
-               }
-               printf("%s: requeued %d commands\n", isp->isp_name, nrestarted);
-       }
-       (void) splx(s);
-}
-
 int
 isp_async(isp, cmd, arg)
        struct ispsoftc *isp;
@@ -552,13 +500,20 @@
                /*
                 * Hopefully we get here in time to minimize the number
                 * of commands we are firing off that are sure to die.
+                *
+                * XXX Hard-code channel 0, but only one channel on FC
+                * XXX adapters, right?
                 */
-               isp->isp_osinfo.blocked = 1;
+               scsipi_channel_freeze(&isp->isp_osinfo._channels[0], 1);
                printf("%s: Loop DOWN\n", isp->isp_name);
                break;
         case ISPASYNC_LOOP_UP:
-               isp->isp_osinfo.blocked = 0;
-               timeout(isp_internal_restart, isp, 1);
+               /*
+                * XXX Hard-code channel 0, but only one channel on FC
+                * XXX adapters, right?
+                */
+               timeout(scsipi_channel_timed_thaw,
+                   &isp->isp_osinfo._channels[0], 1);
                printf("%s: Loop UP\n", isp->isp_name);
                break;
        case ISPASYNC_PDB_CHANGED:
diff -r 2d704549ccb5 -r f88ee77df169 sys/dev/ic/isp_netbsd.h
--- a/sys/dev/ic/isp_netbsd.h   Wed Oct 20 20:40:51 1999 +0000
+++ b/sys/dev/ic/isp_netbsd.h   Wed Oct 20 20:41:27 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_netbsd.h,v 1.18.2.2 1999/10/19 21:38:27 thorpej Exp $ */
+/* $NetBSD: isp_netbsd.h,v 1.18.2.3 1999/10/20 20:41:27 thorpej Exp $ */
 /* release_6_5_99 */
 /*
  * NetBSD Specific definitions for the Qlogic ISP Host Adapter
@@ -68,9 +68,6 @@
        struct scsipi_adapter   _adapter;
        struct scsipi_channel   _channels[2];
        int                     seed;
-       int                     blocked;
-
-       struct scsipi_xfer_queue waitq;
 };
 
 #define        MAXISPREQUEST   256



Home | Main Index | Thread Index | Old Index