Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ic Improve error paths in (e)siop_scsipi_request():
details: https://anonhg.NetBSD.org/src/rev/1751f65d3488
branches: trunk
changeset: 753776:1751f65d3488
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Fri Apr 09 19:25:52 2010 +0000
description:
Improve error paths in (e)siop_scsipi_request():
- When terminating the adapter request after the cmd has been removed
from the free list, put that cmd back on the free list before returing.
- Correctly indicate which bus_dma_load() failed.
Analysis and fix from Michael L. Hitch in PR/42844.
diffstat:
sys/dev/ic/esiop.c | 21 ++++++++++++++++-----
sys/dev/ic/siop.c | 23 ++++++++++++++++++-----
2 files changed, 34 insertions(+), 10 deletions(-)
diffs (145 lines):
diff -r 24b83a491dd9 -r 1751f65d3488 sys/dev/ic/esiop.c
--- a/sys/dev/ic/esiop.c Fri Apr 09 17:38:43 2010 +0000
+++ b/sys/dev/ic/esiop.c Fri Apr 09 19:25:52 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: esiop.c,v 1.51 2010/03/11 04:00:36 mrg Exp $ */
+/* $NetBSD: esiop.c,v 1.52 2010/04/09 19:25:52 jakllsch Exp $ */
/*
* Copyright (c) 2002 Manuel Bouyer.
@@ -28,7 +28,7 @@
/* SYM53c7/8xx PCI-SCSI I/O Processors driver */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: esiop.c,v 1.51 2010/03/11 04:00:36 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esiop.c,v 1.52 2010/04/09 19:25:52 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1533,6 +1533,8 @@
target);
xs->error = XS_RESOURCE_SHORTAGE;
scsipi_done(xs);
+ TAILQ_INSERT_TAIL(&sc->free_list,
+ esiop_cmd, next);
splx(s);
return;
}
@@ -1560,6 +1562,8 @@
target, lun);
xs->error = XS_RESOURCE_SHORTAGE;
scsipi_done(xs);
+ TAILQ_INSERT_TAIL(&sc->free_list,
+ esiop_cmd, next);
splx(s);
return;
}
@@ -1577,8 +1581,11 @@
aprint_error_dev(sc->sc_c.sc_dev,
"unable to load cmd DMA map: %d\n",
error);
- xs->error = XS_DRIVER_STUFFUP;
+ xs->error = (error == EAGAIN) ?
+ XS_RESOURCE_SHORTAGE : XS_DRIVER_STUFFUP;
scsipi_done(xs);
+ esiop_cmd->cmd_c.status = CMDST_FREE;
+ TAILQ_INSERT_TAIL(&sc->free_list, esiop_cmd, next);
splx(s);
return;
}
@@ -1590,12 +1597,16 @@
BUS_DMA_READ : BUS_DMA_WRITE));
if (error) {
aprint_error_dev(sc->sc_c.sc_dev,
- "unable to load cmd DMA map: %d",
+ "unable to load data DMA map: %d",
error);
- xs->error = XS_DRIVER_STUFFUP;
+ xs->error = (error == EAGAIN) ?
+ XS_RESOURCE_SHORTAGE : XS_DRIVER_STUFFUP;
scsipi_done(xs);
bus_dmamap_unload(sc->sc_c.sc_dmat,
esiop_cmd->cmd_c.dmamap_cmd);
+ esiop_cmd->cmd_c.status = CMDST_FREE;
+ TAILQ_INSERT_TAIL(&sc->free_list,
+ esiop_cmd, next);
splx(s);
return;
}
diff -r 24b83a491dd9 -r 1751f65d3488 sys/dev/ic/siop.c
--- a/sys/dev/ic/siop.c Fri Apr 09 17:38:43 2010 +0000
+++ b/sys/dev/ic/siop.c Fri Apr 09 19:25:52 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: siop.c,v 1.94 2009/10/19 18:41:13 bouyer Exp $ */
+/* $NetBSD: siop.c,v 1.95 2010/04/09 19:25:52 jakllsch Exp $ */
/*
* Copyright (c) 2000 Manuel Bouyer.
@@ -28,7 +28,7 @@
/* SYM53c7/8xx PCI-SCSI I/O Processors driver */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: siop.c,v 1.94 2009/10/19 18:41:13 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siop.c,v 1.95 2010/04/09 19:25:52 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1275,6 +1275,8 @@
"target %d\n", target);
xs->error = XS_RESOURCE_SHORTAGE;
scsipi_done(xs);
+ TAILQ_INSERT_TAIL(&sc->free_list,
+ siop_cmd, next);
splx(s);
return;
}
@@ -1295,6 +1297,8 @@
target);
xs->error = XS_RESOURCE_SHORTAGE;
scsipi_done(xs);
+ TAILQ_INSERT_TAIL(&sc->free_list,
+ siop_cmd, next);
splx(s);
return;
}
@@ -1313,6 +1317,8 @@
target, lun);
xs->error = XS_RESOURCE_SHORTAGE;
scsipi_done(xs);
+ TAILQ_INSERT_TAIL(&sc->free_list,
+ siop_cmd, next);
splx(s);
return;
}
@@ -1330,8 +1336,11 @@
aprint_error_dev(sc->sc_c.sc_dev,
"unable to load cmd DMA map: %d\n",
error);
- xs->error = XS_DRIVER_STUFFUP;
+ xs->error = (error == EAGAIN) ?
+ XS_RESOURCE_SHORTAGE : XS_DRIVER_STUFFUP;
scsipi_done(xs);
+ siop_cmd->cmd_c.status = CMDST_FREE;
+ TAILQ_INSERT_TAIL(&sc->free_list, siop_cmd, next);
splx(s);
return;
}
@@ -1343,12 +1352,16 @@
BUS_DMA_READ : BUS_DMA_WRITE));
if (error) {
aprint_error_dev(sc->sc_c.sc_dev,
- "unable to load cmd DMA map: %d",
+ "unable to load data DMA map: %d",
error);
- xs->error = XS_DRIVER_STUFFUP;
+ xs->error = (error == EAGAIN) ?
+ XS_RESOURCE_SHORTAGE : XS_DRIVER_STUFFUP;
scsipi_done(xs);
bus_dmamap_unload(sc->sc_c.sc_dmat,
siop_cmd->cmd_c.dmamap_cmd);
+ siop_cmd->cmd_c.status = CMDST_FREE;
+ TAILQ_INSERT_TAIL(&sc->free_list,
+ siop_cmd, next);
splx(s);
return;
}
Home |
Main Index |
Thread Index |
Old Index