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 Keep track of the number of commands...
details: https://anonhg.NetBSD.org/src/rev/c79119883cdd
branches: thorpej_scsipi
changeset: 477480:c79119883cdd
user: bouyer <bouyer%NetBSD.org@localhost>
date: Sun Apr 22 16:40:29 2001 +0000
description:
Keep track of the number of commands per periph really sent to the adapter.
In scsipi_run_queue(), compare this to periph_openings instead of periph_active
When a drive reject all queued commands with QUEUE FULL (my IBM DDRS34560D
does this on large writes) we end up with all commands in the queue, and
periph_active > periph_openings.
While doing this I found a bug in scsipi_async_event_channel_reset(): calling
scsipi_done() would corrupt accounting.
diffstat:
sys/dev/scsipi/scsipi_base.c | 15 ++++++++++++---
sys/dev/scsipi/scsipiconf.h | 3 ++-
2 files changed, 14 insertions(+), 4 deletions(-)
diffs (83 lines):
diff -r 39c5f8466841 -r c79119883cdd sys/dev/scsipi/scsipi_base.c
--- a/sys/dev/scsipi/scsipi_base.c Sun Apr 22 13:20:17 2001 +0000
+++ b/sys/dev/scsipi/scsipi_base.c Sun Apr 22 16:40:29 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scsipi_base.c,v 1.26.2.14 2001/04/11 01:16:05 mjacob Exp $ */
+/* $NetBSD: scsipi_base.c,v 1.26.2.15 2001/04/22 16:40:29 bouyer Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -1077,6 +1077,7 @@
* The resource this command was using is now free.
*/
scsipi_put_resource(chan);
+ xs->xs_periph->periph_sent--;
/*
* If the command was tagged, free the tag.
@@ -1551,7 +1552,8 @@
xs = TAILQ_NEXT(xs, channel_q)) {
periph = xs->xs_periph;
- if ((periph->periph_active > periph->periph_openings) || periph->periph_qfreeze != 0 ||
+ if ((periph->periph_sent >= periph->periph_openings) ||
+ periph->periph_qfreeze != 0 ||
(periph->periph_flags & PERIPH_UNTAG) != 0)
continue;
@@ -1616,6 +1618,7 @@
scsipi_get_tag(xs);
else
periph->periph_flags |= PERIPH_UNTAG;
+ periph->periph_sent++;
splx(s);
scsipi_adapter_request(chan, ADAPTER_REQ_RUN_XFER, xs);
@@ -2091,6 +2094,7 @@
* scsipi_channel_reset:
*
* handle scsi bus reset
+ * called at splbio
*/
void
scsipi_async_event_channel_reset(chan)
@@ -2103,6 +2107,8 @@
/*
* Channel has been reset. Also mark as reset pending REQUEST_SENSE
* commands; as the sense is not available any more.
+ * can't call scsipi_done() from here, as the command has not been
+ * sent to the adapter yet (this would corrupt accounting).
*/
for (xs = TAILQ_FIRST(&chan->chan_queue); xs != NULL; xs = xs_next) {
@@ -2110,9 +2116,12 @@
if (xs->xs_control & XS_CTL_REQSENSE) {
TAILQ_REMOVE(&chan->chan_queue, xs, channel_q);
xs->error = XS_RESET;
- scsipi_done(xs);
+ if ((xs->xs_control & XS_CTL_ASYNC) != 0)
+ TAILQ_INSERT_TAIL(&chan->chan_complete, xs,
+ channel_q);
}
}
+ wakeup(&chan->chan_complete);
/* Catch xs with pending sense which may not have a REQSENSE xs yet */
for (target = 0; target < chan->chan_ntargets; target++) {
if (target == chan->chan_id)
diff -r 39c5f8466841 -r c79119883cdd sys/dev/scsipi/scsipiconf.h
--- a/sys/dev/scsipi/scsipiconf.h Sun Apr 22 13:20:17 2001 +0000
+++ b/sys/dev/scsipi/scsipiconf.h Sun Apr 22 16:40:29 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scsipiconf.h,v 1.32.2.13 2001/04/11 01:16:05 mjacob Exp $ */
+/* $NetBSD: scsipiconf.h,v 1.32.2.14 2001/04/22 16:40:29 bouyer Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -337,6 +337,7 @@
points */
int periph_openings; /* max # of outstanding commands */
int periph_active; /* current # of outstanding commands */
+ int periph_sent; /* current # of commands sent to adapt*/
int periph_mode; /* operation modes, CAP bits */
int periph_period; /* sync period (factor) */
Home |
Main Index |
Thread Index |
Old Index