Blame SOURCES/0140-scsi-scsi-qla2xxx-Retry-PLOGI-on-FC-NVMe-PRLI-failur.patch

3d7c23
From 763456ffa66380cd4591c58d5b50ae04103166a2 Mon Sep 17 00:00:00 2001
3d7c23
From: Himanshu Madhani <hmadhani@redhat.com>
3d7c23
Date: Thu, 21 Nov 2019 16:36:50 -0500
3d7c23
Subject: [PATCH 140/155] [scsi] scsi: qla2xxx: Retry PLOGI on FC-NVMe PRLI
3d7c23
 failure
3d7c23
3d7c23
Message-id: <20191121163701.43688-16-hmadhani@redhat.com>
3d7c23
Patchwork-id: 287858
3d7c23
O-Subject: [RHLE 7.8 e-stor PATCH v3 15/26] scsi: qla2xxx: Retry PLOGI on FC-NVMe PRLI failure
3d7c23
Bugzilla: 1731581
3d7c23
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
3d7c23
RH-Acked-by: Ewan Milne <emilne@redhat.com>
3d7c23
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
3d7c23
3d7c23
From: Quinn Tran <qutran@marvell.com>
3d7c23
3d7c23
Bugzilla 1731581
3d7c23
3d7c23
Current code will send PRLI with FC-NVMe bit set for the targets which
3d7c23
support only FCP. This may result into issue with targets which do not
3d7c23
understand NVMe and will go into a strange state. This patch would restart
3d7c23
the login process by going back to PLOGI state. The PLOGI state will force
3d7c23
the target to respond to correct PRLI request.
3d7c23
3d7c23
Fixes: c76ae845ea836 ("scsi: qla2xxx: Add error handling for PLOGI ELS passthrough")
3d7c23
Cc: stable@vger.kernel.org # 5.4
3d7c23
Link: https://lore.kernel.org/r/20191105150657.8092-2-hmadhani@marvell.com
3d7c23
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
3d7c23
Signed-off-by: Quinn Tran <qutran@marvell.com>
3d7c23
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
3d7c23
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3d7c23
(cherry picked from commit 983f127603fac650fa34ee69db363e4615eaf9e7)
3d7c23
Signed-off-by: Himanshu Madhani <hmadhani@redhat.com>
3d7c23
Signed-off-by: Jan Stancek <jstancek@redhat.com>
3d7c23
---
3d7c23
 drivers/scsi/qla2xxx/qla_init.c | 37 ++++++++-----------------------------
3d7c23
 drivers/scsi/qla2xxx/qla_iocb.c |  6 +++++-
3d7c23
 2 files changed, 13 insertions(+), 30 deletions(-)
3d7c23
3d7c23
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
3d7c23
index 9584da53e715..10a1690a802d 100644
3d7c23
--- a/drivers/scsi/qla2xxx/qla_init.c
3d7c23
+++ b/drivers/scsi/qla2xxx/qla_init.c
3d7c23
@@ -1878,42 +1878,21 @@ qla24xx_handle_prli_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
3d7c23
 		 * FCP/NVMe port
3d7c23
 		 */
3d7c23
 		if (NVME_FCP_TARGET(ea->fcport)) {
3d7c23
-			if (vha->hw->fc4_type_priority == FC4_PRIORITY_NVME)
3d7c23
-				ea->fcport->fc4_type &= ~FS_FC4TYPE_NVME;
3d7c23
-			else
3d7c23
-				ea->fcport->fc4_type &= ~FS_FC4TYPE_FCP;
3d7c23
 			ql_dbg(ql_dbg_disc, vha, 0x2118,
3d7c23
 				"%s %d %8phC post %s prli\n",
3d7c23
 				__func__, __LINE__, ea->fcport->port_name,
3d7c23
 				(ea->fcport->fc4_type & FS_FC4TYPE_NVME) ?
3d7c23
 				"NVMe" : "FCP");
3d7c23
-			qla24xx_post_prli_work(vha, ea->fcport);
3d7c23
-			break;
3d7c23
+			if (vha->hw->fc4_type_priority == FC4_PRIORITY_NVME)
3d7c23
+				ea->fcport->fc4_type &= ~FS_FC4TYPE_NVME;
3d7c23
+			else
3d7c23
+				ea->fcport->fc4_type &= ~FS_FC4TYPE_FCP;
3d7c23
 		}
3d7c23
 
3d7c23
-		/* at this point both PRLI NVME & PRLI FCP failed */
3d7c23
-		if (N2N_TOPO(vha->hw)) {
3d7c23
-			if (ea->fcport->n2n_link_reset_cnt < 3) {
3d7c23
-				ea->fcport->n2n_link_reset_cnt++;
3d7c23
-				/*
3d7c23
-				 * remote port is not sending Plogi. Reset
3d7c23
-				 * link to kick start his state machine
3d7c23
-				 */
3d7c23
-				set_bit(N2N_LINK_RESET, &vha->dpc_flags);
3d7c23
-			} else {
3d7c23
-				ql_log(ql_log_warn, vha, 0x2119,
3d7c23
-				    "%s %d %8phC Unable to reconnect\n",
3d7c23
-				    __func__, __LINE__, ea->fcport->port_name);
3d7c23
-			}
3d7c23
-		} else {
3d7c23
-			/*
3d7c23
-			 * switch connect. login failed. Take connection
3d7c23
-			 * down and allow relogin to retrigger
3d7c23
-			 */
3d7c23
-			ea->fcport->flags &= ~FCF_ASYNC_SENT;
3d7c23
-			ea->fcport->keep_nport_handle = 0;
3d7c23
-			qlt_schedule_sess_for_deletion(ea->fcport);
3d7c23
-		}
3d7c23
+		ea->fcport->flags &= ~FCF_ASYNC_SENT;
3d7c23
+		ea->fcport->keep_nport_handle = 0;
3d7c23
+		ea->fcport->logout_on_delete = 1;
3d7c23
+		qlt_schedule_sess_for_deletion(ea->fcport);
3d7c23
 		break;
3d7c23
 	}
3d7c23
 }
3d7c23
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
3d7c23
index 52673965ca37..186ee5825651 100644
3d7c23
--- a/drivers/scsi/qla2xxx/qla_iocb.c
3d7c23
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
3d7c23
@@ -2859,6 +2859,7 @@ qla2x00_els_dcmd2_sp_done(void *ptr, int res)
3d7c23
 			ea.rc = res;
3d7c23
 			qla24xx_handle_plogi_done_event(vha, &ea);
3d7c23
 			break;
3d7c23
+
3d7c23
 		case CS_IOCB_ERROR:
3d7c23
 			switch (fw_status[1]) {
3d7c23
 			case LSC_SCODE_PORTID_USED:
3d7c23
@@ -2929,6 +2930,7 @@ qla2x00_els_dcmd2_sp_done(void *ptr, int res)
3d7c23
 				    fw_status[0], fw_status[1], fw_status[2]);
3d7c23
 
3d7c23
 				fcport->flags &= ~FCF_ASYNC_SENT;
3d7c23
+				fcport->disc_state = DSC_LOGIN_FAILED;
3d7c23
 				set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
3d7c23
 				break;
3d7c23
 			}
3d7c23
@@ -2941,6 +2943,7 @@ qla2x00_els_dcmd2_sp_done(void *ptr, int res)
3d7c23
 			    fw_status[0], fw_status[1], fw_status[2]);
3d7c23
 
3d7c23
 			sp->fcport->flags &= ~FCF_ASYNC_SENT;
3d7c23
+			sp->fcport->disc_state = DSC_LOGIN_FAILED;
3d7c23
 			set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
3d7c23
 			break;
3d7c23
 		}
3d7c23
@@ -2985,11 +2988,12 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode,
3d7c23
 		return -ENOMEM;
3d7c23
 	}
3d7c23
 
3d7c23
+	fcport->flags |= FCF_ASYNC_SENT;
3d7c23
+	fcport->disc_state = DSC_LOGIN_PEND;
3d7c23
 	elsio = &sp->u.iocb_cmd;
3d7c23
 	ql_dbg(ql_dbg_io, vha, 0x3073,
3d7c23
 	    "Enter: PLOGI portid=%06x\n", fcport->d_id.b24);
3d7c23
 
3d7c23
-	fcport->flags |= FCF_ASYNC_SENT;
3d7c23
 	sp->type = SRB_ELS_DCMD;
3d7c23
 	sp->name = "ELS_DCMD";
3d7c23
 	sp->fcport = fcport;
3d7c23
-- 
3d7c23
2.13.6
3d7c23