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

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