summaryrefslogtreecommitdiff
path: root/drivers/scsi/megaraid/megaraid_sas_fusion.c
diff options
context:
space:
mode:
authorShivasharan S <shivasharan.srikanteshwara@broadcom.com>2017-02-10 11:59:14 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2017-02-13 15:26:22 +0300
commit31d9a57b419d8ef8fa391009819f940778ce6245 (patch)
tree6f39e72eec51f5fe187047d3de9233f49d2f61d8 /drivers/scsi/megaraid/megaraid_sas_fusion.c
parenta48ba0eca0456d45e920169930569caa3fc57124 (diff)
downloadlinux-31d9a57b419d8ef8fa391009819f940778ce6245.tar.xz
scsi: megaraid_sas: set residual bytes count during IO completion
Fixing issue of not setting residual bytes correctly. Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com> Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Tomas Henzl <thenzl@redhat.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/megaraid/megaraid_sas_fusion.c')
-rw-r--r--drivers/scsi/megaraid/megaraid_sas_fusion.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index edbecc531f33..46286719c0aa 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -1445,6 +1445,7 @@ map_cmd_status(struct fusion_context *fusion,
struct scsi_cmnd *scmd, u8 status, u8 ext_status,
u32 data_length, u8 *sense)
{
+ int resid;
switch (status) {
@@ -1467,6 +1468,15 @@ map_cmd_status(struct fusion_context *fusion,
SCSI_SENSE_BUFFERSIZE);
scmd->result |= DRIVER_SENSE << 24;
}
+
+ /*
+ * If the IO request is partially completed, then MR FW will
+ * update "io_request->DataLength" field with actual number of
+ * bytes transferred.Driver will set residual bytes count in
+ * SCSI command structure.
+ */
+ resid = (scsi_bufflen(scmd) - data_length);
+ scsi_set_resid(scmd, resid);
break;
case MFI_STAT_LD_OFFLINE: