diff options
| author | 2016-08-17 01:02:31 +0000 | |
|---|---|---|
| committer | 2016-08-17 01:02:31 +0000 | |
| commit | 8e9b01db2c51baf1a5093b7dded6335187cd51a6 (patch) | |
| tree | 3804f58ac2f481055ee2261ba9c5949f75b598d1 /sys/dev/ic/mpi.c | |
| parent | KNF and clean up many comments. (diff) | |
| download | wireguard-openbsd-8e9b01db2c51baf1a5093b7dded6335187cd51a6.tar.xz wireguard-openbsd-8e9b01db2c51baf1a5093b7dded6335187cd51a6.zip | |
Make error handling (esp. DATA_UNDERRUN) clearer and avoid losing resid
value.
Specs from mikeb@, ok dlg@
Diffstat (limited to 'sys/dev/ic/mpi.c')
| -rw-r--r-- | sys/dev/ic/mpi.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c index 3689881f254..1234a88f546 100644 --- a/sys/dev/ic/mpi.c +++ b/sys/dev/ic/mpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpi.c,v 1.204 2016/08/14 04:08:03 dlg Exp $ */ +/* $OpenBSD: mpi.c,v 1.205 2016/08/17 01:02:31 krw Exp $ */ /* * Copyright (c) 2005, 2006, 2009 David Gwynne <dlg@openbsd.org> @@ -1449,20 +1449,21 @@ mpi_scsi_cmd_done(struct mpi_ccb *ccb) DNPRINTF(MPI_D_CMD, "%s: tag: 0x%04x\n", DEVNAME(sc), letoh16(sie->tag)); - xs->status = sie->scsi_status; + if (sie->scsi_state & MPI_SCSIIO_ERR_STATE_NO_SCSI_STATUS) + xs->status = SCSI_TERMINATED; + else + xs->status = sie->scsi_status; + xs->resid = 0; + switch (lemtoh16(&sie->ioc_status)) { case MPI_IOCSTATUS_SCSI_DATA_UNDERRUN: xs->resid = xs->datalen - lemtoh32(&sie->transfer_count); - if (sie->scsi_state & MPI_SCSIIO_ERR_STATE_NO_SCSI_STATUS) { - xs->error = XS_DRIVER_STUFFUP; - break; - } /* FALLTHROUGH */ case MPI_IOCSTATUS_SUCCESS: case MPI_IOCSTATUS_SCSI_RECOVERED_ERROR: switch (xs->status) { case SCSI_OK: - xs->resid = 0; + xs->error = XS_NOERROR; break; case SCSI_CHECK: |
