diff mbox series

[SRU,F,4/5] scsi: fnic: Set scsi_set_resid() only for underflow

Message ID 20220813001057.34877-5-michael.reed@canonical.com
State New
Headers show
Series fnic driver on needs to be updated to 1.6.0.53 on Focal | expand

Commit Message

Michael Reed Aug. 13, 2022, 12:10 a.m. UTC
From: Karan Tilak Kumar <kartilak@cisco.com>

Set scsi_set_resid() only if FCPIO_ICMND_CMPL_RESID_UNDER is set.

BugLink:  https://launchpad.net/bugs/1984011

Link: https://lore.kernel.org/r/20201121015134.18872-1-kartilak@cisco.com
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Satish Kharat <satishkh@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 74ae6d6a6805f9fe162e4527d8ff0f7d2f9bc0d0)
Signed-off-by: Michael Reed <Michael.Reed@canonical.com>
---
 drivers/scsi/fnic/fnic.h      | 2 +-
 drivers/scsi/fnic/fnic_scsi.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index 7c5c911b2673..e4d399f41a0a 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -39,7 +39,7 @@ 
 
 #define DRV_NAME		"fnic"
 #define DRV_DESCRIPTION		"Cisco FCoE HBA Driver"
-#define DRV_VERSION		"1.6.0.51"
+#define DRV_VERSION		"1.6.0.52"
 #define PFX			DRV_NAME ": "
 #define DFX                     DRV_NAME "%d: "
 
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 9b23f9701f91..486ff8a18a37 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -920,10 +920,11 @@  static void fnic_fcpio_icmnd_cmpl_handler(struct fnic *fnic,
 	case FCPIO_SUCCESS:
 		sc->result = (DID_OK << 16) | icmnd_cmpl->scsi_status;
 		xfer_len = scsi_bufflen(sc);
-		scsi_set_resid(sc, icmnd_cmpl->residual);
 
-		if (icmnd_cmpl->flags & FCPIO_ICMND_CMPL_RESID_UNDER)
+		if (icmnd_cmpl->flags & FCPIO_ICMND_CMPL_RESID_UNDER) {
 			xfer_len -= icmnd_cmpl->residual;
+			scsi_set_resid(sc, icmnd_cmpl->residual);
+		}
 
 		if (icmnd_cmpl->scsi_status == SAM_STAT_CHECK_CONDITION)
 			atomic64_inc(&fnic_stats->misc_stats.check_condition);