diff options
author | mav <mav@FreeBSD.org> | 2017-03-06 06:38:26 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2017-03-06 06:38:26 +0000 |
commit | 4d592e5d3d9d8f5fc976ddd8c2026fc6c5e9868a (patch) | |
tree | 8442855aec8ddb2679e468976c9b0a1f8df20162 /sys/cam | |
parent | bced81fb9b8529d0f5454614b7f61a3139e2ce6e (diff) | |
download | FreeBSD-src-4d592e5d3d9d8f5fc976ddd8c2026fc6c5e9868a.zip FreeBSD-src-4d592e5d3d9d8f5fc976ddd8c2026fc6c5e9868a.tar.gz |
MFC r314299, r314300: Fix residual length reporting in target mode.
This allows to properly handle cases when target wants to receive or send
more data then initiator wants to send or receive. Previously in such
cases isp(4) returned CAM_DATA_RUN_ERR, while now it returns resid > 0.
Diffstat (limited to 'sys/cam')
-rw-r--r-- | sys/cam/ctl/scsi_ctl.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c index e00a5f7..c897ef8 100644 --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -1259,7 +1259,8 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) */ switch (done_ccb->ccb_h.status & CAM_STATUS_MASK) { case CAM_REQ_CMP: - io->scsiio.kern_data_resid -= csio->dxfer_len; + io->scsiio.kern_data_resid -= + csio->dxfer_len - csio->resid; io->io_hdr.port_status = 0; break; default: @@ -1286,8 +1287,8 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) * pieces, figure out where we are in the list, and * continue sending pieces if necessary. */ - if ((cmd_info->flags & CTLFE_CMD_PIECEWISE) - && (io->io_hdr.port_status == 0)) { + if ((cmd_info->flags & CTLFE_CMD_PIECEWISE) && + io->io_hdr.port_status == 0 && csio->resid == 0) { ccb_flags flags; uint8_t *data_ptr; uint32_t dxfer_len; |