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 Don't sleep waiting for a CCB; if we get...



details:   https://anonhg.NetBSD.org/src/rev/95626cc8488a
branches:  thorpej_scsipi
changeset: 477285:95626cc8488a
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Oct 19 22:53:43 1999 +0000

description:
Don't sleep waiting for a CCB; if we get to the CCB allocation phase, we're
guaranteed to have one.

diffstat:

 sys/dev/ic/adv.c      |  41 ++++++-------------------------
 sys/dev/ic/adw.c      |  41 ++++++-------------------------
 sys/dev/ic/aha.c      |  40 ++++++------------------------
 sys/dev/ic/aic6360.c  |  43 ++++++++++----------------------
 sys/dev/ic/aic7xxx.c  |  67 +++++++++-----------------------------------------
 sys/dev/ic/dpt.c      |  35 +++++++-------------------
 sys/dev/ic/mb89352.c  |  25 ++++--------------
 sys/dev/ic/ncr53c9x.c |  33 ++++++------------------
 sys/dev/ic/uha.c      |  40 ++++++------------------------
 9 files changed, 84 insertions(+), 281 deletions(-)

diffs (truncated from 854 to 300 lines):

diff -r 75b4c1c0740b -r 95626cc8488a sys/dev/ic/adv.c
--- a/sys/dev/ic/adv.c  Tue Oct 19 22:48:31 1999 +0000
+++ b/sys/dev/ic/adv.c  Tue Oct 19 22:53:43 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: adv.c,v 1.14.2.1 1999/10/19 17:47:28 thorpej Exp $     */
+/*     $NetBSD: adv.c,v 1.14.2.2 1999/10/19 22:53:43 thorpej Exp $     */
 
 /*
  * Generic driver for the Advanced Systems Inc. Narrow SCSI controllers
@@ -78,7 +78,7 @@
 static void adv_free_ccb __P((ASC_SOFTC *, ADV_CCB *));
 static void adv_reset_ccb __P((ADV_CCB *));
 static int adv_init_ccb __P((ASC_SOFTC *, ADV_CCB *));
-static ADV_CCB *adv_get_ccb __P((ASC_SOFTC *, int));
+static ADV_CCB *adv_get_ccb __P((ASC_SOFTC *));
 static void adv_queue_ccb __P((ASC_SOFTC *, ADV_CCB *));
 static void adv_start_ccbs __P((ASC_SOFTC *));
 
@@ -193,17 +193,8 @@
        int             s;
 
        s = splbio();
-
        adv_reset_ccb(ccb);
        TAILQ_INSERT_HEAD(&sc->sc_free_ccb, ccb, chain);
-
-       /*
-         * If there were none, wake anybody waiting for one to come free,
-         * starting with queued entries.
-         */
-       if (ccb->chain.tqe_next == 0)
-               wakeup(&sc->sc_free_ccb);
-
        splx(s);
 }
 
@@ -258,34 +249,18 @@
  * If there are none, see if we can allocate a new one
  */
 static ADV_CCB *
-adv_get_ccb(sc, flags)
+adv_get_ccb(sc)
        ASC_SOFTC      *sc;
-       int             flags;
 {
        ADV_CCB        *ccb = 0;
        int             s;
 
        s = splbio();
-
-       /*
-         * If we can and have to, sleep waiting for one to come free
-         * but only if we can't allocate a new one.
-         */
-       for (;;) {
-               ccb = sc->sc_free_ccb.tqh_first;
-               if (ccb) {
-                       TAILQ_REMOVE(&sc->sc_free_ccb, ccb, chain);
-                       break;
-               }
-               if ((flags & XS_CTL_NOSLEEP) != 0)
-                       goto out;
-
-               tsleep(&sc->sc_free_ccb, PRIBIO, "advccb", 0);
+       ccb = TAILQ_FIRST(&sc->sc_free_ccb);
+       if (ccb != NULL) {
+               TAILQ_REMOVE(&sc->sc_free_ccb, ccb, chain);
+               ccb->flags |= CCB_ALLOC;
        }
-
-       ccb->flags |= CCB_ALLOC;
-
-out:
        splx(s);
        return (ccb);
 }
@@ -559,7 +534,7 @@
                /*
                 * Get a CCB to use.
                 */
-               ccb = adv_get_ccb(sc, flags);
+               ccb = adv_get_ccb(sc);
 #ifdef DIAGNOSTIC
                /*
                 * This should never happen as we track the resources
diff -r 75b4c1c0740b -r 95626cc8488a sys/dev/ic/adw.c
--- a/sys/dev/ic/adw.c  Tue Oct 19 22:48:31 1999 +0000
+++ b/sys/dev/ic/adw.c  Tue Oct 19 22:53:43 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: adw.c,v 1.12.2.1 1999/10/19 17:47:30 thorpej Exp $  */
+/* $NetBSD: adw.c,v 1.12.2.2 1999/10/19 22:53:43 thorpej Exp $  */
 
 /*
  * Generic driver for the Advanced Systems Inc. SCSI controllers
@@ -75,7 +75,7 @@
 static void adw_free_ccb __P((ADW_SOFTC *, ADW_CCB *));
 static void adw_reset_ccb __P((ADW_CCB *));
 static int adw_init_ccb __P((ADW_SOFTC *, ADW_CCB *));
-static ADW_CCB *adw_get_ccb __P((ADW_SOFTC *, int));
+static ADW_CCB *adw_get_ccb __P((ADW_SOFTC *));
 static void adw_queue_ccb __P((ADW_SOFTC *, ADW_CCB *));
 static void adw_start_ccbs __P((ADW_SOFTC *));
 
@@ -184,17 +184,8 @@
        int             s;
 
        s = splbio();
-
        adw_reset_ccb(ccb);
        TAILQ_INSERT_HEAD(&sc->sc_free_ccb, ccb, chain);
-
-       /*
-         * If there were none, wake anybody waiting for one to come free,
-         * starting with queued entries.
-         */
-       if (ccb->chain.tqe_next == 0)
-               wakeup(&sc->sc_free_ccb);
-
        splx(s);
 }
 
@@ -248,34 +239,18 @@
  * If there are none, see if we can allocate a new one
  */
 static ADW_CCB *
-adw_get_ccb(sc, flags)
+adw_get_ccb(sc)
        ADW_SOFTC      *sc;
-       int             flags;
 {
        ADW_CCB        *ccb = 0;
        int             s;
 
        s = splbio();
-
-       /*
-         * If we can and have to, sleep waiting for one to come free
-         * but only if we can't allocate a new one.
-         */
-       for (;;) {
-               ccb = sc->sc_free_ccb.tqh_first;
-               if (ccb) {
-                       TAILQ_REMOVE(&sc->sc_free_ccb, ccb, chain);
-                       break;
-               }
-               if ((flags & XS_CTL_NOSLEEP) != 0)
-                       goto out;
-
-               tsleep(&sc->sc_free_ccb, PRIBIO, "adwccb", 0);
+       ccb = TAILQ_FIRST(&sc->sc_free_ccb);
+       if (ccb != NULL) {
+               TAILQ_REMOVE(&sc->sc_free_ccb, ccb, chain);
+               ccb->flags |= CCB_ALLOC;
        }
-
-       ccb->flags |= CCB_ALLOC;
-
-out:
        splx(s);
        return (ccb);
 }
@@ -509,7 +484,7 @@
                /*
                 * Get a CCB to use.
                 */
-               ccb = adw_get_ccb(sc, xs->xs_control);
+               ccb = adw_get_ccb(sc);
 #ifdef DIAGNOSTIC
                /*
                 * This should never happen as we track the resources
diff -r 75b4c1c0740b -r 95626cc8488a sys/dev/ic/aha.c
--- a/sys/dev/ic/aha.c  Tue Oct 19 22:48:31 1999 +0000
+++ b/sys/dev/ic/aha.c  Tue Oct 19 22:53:43 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aha.c,v 1.24.2.1 1999/10/19 17:47:31 thorpej Exp $     */
+/*     $NetBSD: aha.c,v 1.24.2.2 1999/10/19 22:53:43 thorpej Exp $     */
 
 #include "opt_ddb.h"
 
@@ -99,7 +99,7 @@
 integrate void aha_reset_ccb __P((struct aha_softc *, struct aha_ccb *));
 void aha_free_ccb __P((struct aha_softc *, struct aha_ccb *));
 integrate int aha_init_ccb __P((struct aha_softc *, struct aha_ccb *));
-struct aha_ccb *aha_get_ccb __P((struct aha_softc *, int));
+struct aha_ccb *aha_get_ccb __P((struct aha_softc *));
 struct aha_ccb *aha_ccb_phys_kv __P((struct aha_softc *, u_long));
 void aha_queue_ccb __P((struct aha_softc *, struct aha_ccb *));
 void aha_collect_mbo __P((struct aha_softc *));
@@ -466,17 +466,8 @@
        int s;
 
        s = splbio();
-
        aha_reset_ccb(sc, ccb);
        TAILQ_INSERT_HEAD(&sc->sc_free_ccb, ccb, chain);
-
-       /*
-        * If there were none, wake anybody waiting for one to come free,
-        * starting with queued entries.
-        */
-       if (ccb->chain.tqe_next == 0)
-               wakeup(&sc->sc_free_ccb);
-
        splx(s);
 }
 
@@ -546,33 +537,18 @@
  * the hash table too otherwise either return an error or sleep.
  */
 struct aha_ccb *
-aha_get_ccb(sc, flags)
+aha_get_ccb(sc)
        struct aha_softc *sc;
-       int flags;
 {
        struct aha_ccb *ccb;
        int s;
 
        s = splbio();
-
-       /*
-        * If we can and have to, sleep waiting for one to come free
-        * but only if we can't allocate a new one.
-        */
-       for (;;) {
-               ccb = sc->sc_free_ccb.tqh_first;
-               if (ccb) {
-                       TAILQ_REMOVE(&sc->sc_free_ccb, ccb, chain);
-                       break;
-               }
-               if ((flags & XS_CTL_NOSLEEP) != 0)
-                       goto out;
-               tsleep(&sc->sc_free_ccb, PRIBIO, "ahaccb", 0);
+       ccb = TAILQ_FIRST(&sc->sc_free_ccb);
+       if (ccb != NULL) {
+               TAILQ_REMOVE(&sc->sc_free_ccb, ccb, chain);
+               ccb->flags |= CCB_ALLOC;
        }
-
-       ccb->flags |= CCB_ALLOC;
-
-out:
        splx(s);
        return (ccb);
 }
@@ -1182,7 +1158,7 @@
                flags = xs->xs_control;
 
                /* Get a CCB to use. */
-               ccb = aha_get_ccb(sc, flags);
+               ccb = aha_get_ccb(sc);
 #ifdef DIAGNOSTIC
                /*
                 * This should never happen as we track the resources
diff -r 75b4c1c0740b -r 95626cc8488a sys/dev/ic/aic6360.c
--- a/sys/dev/ic/aic6360.c      Tue Oct 19 22:48:31 1999 +0000
+++ b/sys/dev/ic/aic6360.c      Tue Oct 19 22:53:43 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aic6360.c,v 1.63.2.1 1999/10/19 17:47:32 thorpej Exp $ */
+/*     $NetBSD: aic6360.c,v 1.63.2.2 1999/10/19 23:15:30 thorpej Exp $ */
 
 #include "opt_ddb.h"
 #ifdef DDB
@@ -166,8 +166,8 @@
 void   aic_sched       __P((struct aic_softc *));
 void   aic_scsi_reset  __P((struct aic_softc *));
 void   aic_reset       __P((struct aic_softc *));
-void   aic_free_acb    __P((struct aic_softc *, struct aic_acb *, int));
-struct aic_acb* aic_get_acb __P((struct aic_softc *, int));
+void   aic_free_acb    __P((struct aic_softc *, struct aic_acb *));
+struct aic_acb* aic_get_acb __P((struct aic_softc *));
 int    aic_reselect    __P((struct aic_softc *, int));
 void   aic_sense       __P((struct aic_softc *, struct aic_acb *));
 void   aic_msgin       __P((struct aic_softc *));
@@ -455,48 +455,33 @@
 }
 
 void
-aic_free_acb(sc, acb, flags)
+aic_free_acb(sc, acb)
        struct aic_softc *sc;
        struct aic_acb *acb;
-       int flags;
 {
        int s;
 
        s = splbio();
-
        acb->flags = 0;
        TAILQ_INSERT_HEAD(&sc->free_list, acb, chain);
-
-       /*
-        * If there were none, wake anybody waiting for one to come free,
-        * starting with queued entries.
-        */
-       if (acb->chain.tqe_next == 0)
-               wakeup(&sc->free_list);
-
        splx(s);
 }



Home | Main Index | Thread Index | Old Index