diff mbox series

scsi: fnic: set scsi_set_resid only for underflow

Message ID 20201121015134.18872-1-kartilak@cisco.com
State New
Headers show
Series scsi: fnic: set scsi_set_resid only for underflow | expand

Commit Message

Karan Tilak Kumar (kartilak) Nov. 21, 2020, 1:51 a.m. UTC
Fix to set scsi_set_resid() only if
FCPIO_ICMND_CMPL_RESID_UNDER is set.

Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
Signed-off-by: Satish Kharat <satishkh@cisco.com>
---
 drivers/scsi/fnic/fnic.h      | 2 +-
 drivers/scsi/fnic/fnic_scsi.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

Comments

Arulprabhu Ponnusamy (arulponn) Nov. 24, 2020, 1:27 a.m. UTC | #1
Looks good.
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>


On 11/20/20, 5:51 PM, "Karan Tilak Kumar" <kartilak@cisco.com> wrote:

    Fix to set scsi_set_resid() only if
    FCPIO_ICMND_CMPL_RESID_UNDER is set.

    Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>

    Signed-off-by: Satish Kharat <satishkh@cisco.com>

    ---
     drivers/scsi/fnic/fnic.h      | 2 +-
     drivers/scsi/fnic/fnic_scsi.c | 5 +++--
     2 files changed, 4 insertions(+), 3 deletions(-)

    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 16e66f5b833a..532c3c7ae372 100644
    --- a/drivers/scsi/fnic/fnic_scsi.c
    +++ b/drivers/scsi/fnic/fnic_scsi.c
    @@ -921,10 +921,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);
    -- 
    2.29.2
Martin K. Petersen Nov. 24, 2020, 3:48 a.m. UTC | #2
Karan,

> Fix to set scsi_set_resid() only if FCPIO_ICMND_CMPL_RESID_UNDER is

> set.


Applied to 5.11/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering
Martin K. Petersen Dec. 1, 2020, 5:04 a.m. UTC | #3
On Fri, 20 Nov 2020 17:51:34 -0800, Karan Tilak Kumar wrote:

> Fix to set scsi_set_resid() only if

> FCPIO_ICMND_CMPL_RESID_UNDER is set.


Applied to 5.11/scsi-queue, thanks!

[1/1] scsi: fnic: Set scsi_set_resid() only for underflow
      https://git.kernel.org/mkp/scsi/c/74ae6d6a6805

-- 
Martin K. Petersen	Oracle Linux Engineering
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 16e66f5b833a..532c3c7ae372 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -921,10 +921,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);