summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2017-03-06 06:37:44 +0000
committermav <mav@FreeBSD.org>2017-03-06 06:37:44 +0000
commit05661f148e795f48b01d625022278f490c433af1 (patch)
tree76f169c9274e2bdaaba558e24b5d313df4bc1898 /sys/cam
parent56ab8713da065b1fd9a52e039a2be799d398c9af (diff)
downloadFreeBSD-src-05661f148e795f48b01d625022278f490c433af1.zip
FreeBSD-src-05661f148e795f48b01d625022278f490c433af1.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.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c
index b4a65e5..7e56249 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;
OpenPOWER on IntegriCloud