Daniel Wagner 514c26
From: James Smart <jsmart2021@gmail.com>
Daniel Wagner 514c26
Date: Fri, 14 May 2021 12:55:50 -0700
Daniel Wagner 514c26
Subject: scsi: lpfc: Fix non-optimized ERSP handling
Daniel Wagner 514c26
Patch-mainline: Queued in subsystem maintainer repository
Daniel Wagner 514c26
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
Daniel Wagner 514c26
Git-commit: fa21189db9ab022080e056cc6da219975da48fd6
Daniel Wagner 514c26
References: bsc#1186451
Daniel Wagner 514c26
Daniel Wagner 514c26
When processing an NVMe ERSP IU which didn't match the optimized CQE-only
Daniel Wagner 514c26
path, the status was being left to the WQE status. WQE status is non-zero
Daniel Wagner 514c26
as it is indicating a non-optimized completion that needs to be handled by
Daniel Wagner 514c26
the driver.
Daniel Wagner 514c26
Daniel Wagner 514c26
Fix by clearing the status field when falling into the non-optimized
Daniel Wagner 514c26
case. Log message added to track optimized vs non-optimized debug.
Daniel Wagner 514c26
Daniel Wagner 514c26
Link: https://lore.kernel.org/r/20210514195559.119853-3-jsmart2021@gmail.com
Daniel Wagner 514c26
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Daniel Wagner 514c26
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Daniel Wagner 514c26
Signed-off-by: James Smart <jsmart2021@gmail.com>
Daniel Wagner 514c26
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Daniel Wagner 514c26
Acked-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner 514c26
---
Daniel Wagner 514c26
 drivers/scsi/lpfc/lpfc_nvme.c |   14 ++++++++++++--
Daniel Wagner 514c26
 1 file changed, 12 insertions(+), 2 deletions(-)
Daniel Wagner 514c26
Daniel Wagner 514c26
--- a/drivers/scsi/lpfc/lpfc_nvme.c
Daniel Wagner 514c26
+++ b/drivers/scsi/lpfc/lpfc_nvme.c
Daniel Wagner 514c26
@@ -1049,9 +1049,19 @@ lpfc_nvme_io_cmd_wqe_cmpl(struct lpfc_hb
Daniel Wagner 514c26
 			nCmd->transferred_length = wcqe->total_data_placed;
Daniel Wagner 514c26
 			nCmd->rcv_rsplen = wcqe->parameter;
Daniel Wagner 514c26
 			nCmd->status = 0;
Daniel Wagner 514c26
-			/* Sanity check */
Daniel Wagner 514c26
-			if (nCmd->rcv_rsplen == LPFC_NVME_ERSP_LEN)
Daniel Wagner 514c26
+
Daniel Wagner 514c26
+			/* Check if this is really an ERSP */
Daniel Wagner 514c26
+			if (nCmd->rcv_rsplen == LPFC_NVME_ERSP_LEN) {
Daniel Wagner 514c26
+				lpfc_ncmd->status = IOSTAT_SUCCESS;
Daniel Wagner 514c26
+				lpfc_ncmd->result = 0;
Daniel Wagner 514c26
+
Daniel Wagner 514c26
+				lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME,
Daniel Wagner 514c26
+					 "6084 NVME Completion ERSP: "
Daniel Wagner 514c26
+					 "xri %x placed x%x\n",
Daniel Wagner 514c26
+					 lpfc_ncmd->cur_iocbq.sli4_xritag,
Daniel Wagner 514c26
+					 wcqe->total_data_placed);
Daniel Wagner 514c26
 				break;
Daniel Wagner 514c26
+			}
Daniel Wagner 514c26
 			lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
Daniel Wagner 514c26
 					 "6081 NVME Completion Protocol Error: "
Daniel Wagner 514c26
 					 "xri %x status x%x result x%x "