Daniel Wagner 521d52
From: James Smart <jsmart2021@gmail.com>
Daniel Wagner 521d52
Date: Fri, 14 May 2021 12:55:51 -0700
Daniel Wagner 521d52
Subject: scsi: lpfc: Fix "Unexpected timeout" error in direct attach topology
Daniel Wagner 521d52
Patch-mainline: Queued in subsystem maintainer repository
Daniel Wagner 521d52
Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git
Daniel Wagner 521d52
Git-commit: e30d55137edef47434c40d7570276a0846fe922c
Daniel Wagner 521d52
References: bsc#1186452
Daniel Wagner 521d52
Daniel Wagner 521d52
An 'unexpected timeout' message may be seen in a point-2-point topology.
Daniel Wagner 521d52
The message occurs when a PLOGI is received before the driver is notified
Daniel Wagner 521d52
of FLOGI completion. The FLOGI completion failure causes discovery to be
Daniel Wagner 521d52
triggered for a second time. The discovery timer is restarted but no new
Daniel Wagner 521d52
discovery activity is initiated, thus the timeout message eventually
Daniel Wagner 521d52
appears.
Daniel Wagner 521d52
Daniel Wagner 521d52
In point-2-point, when discovery has progressed before the FLOGI completion
Daniel Wagner 521d52
is processed, it is not a failure. Add code to FLOGI completion to detect
Daniel Wagner 521d52
that discovery has progressed and exit the FLOGI handling (noop'ing it).
Daniel Wagner 521d52
Daniel Wagner 521d52
Link: https://lore.kernel.org/r/20210514195559.119853-4-jsmart2021@gmail.com
Daniel Wagner 521d52
Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Daniel Wagner 521d52
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Daniel Wagner 521d52
Signed-off-by: James Smart <jsmart2021@gmail.com>
Daniel Wagner 521d52
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Daniel Wagner 521d52
Acked-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner 521d52
---
Daniel Wagner 521d52
 drivers/scsi/lpfc/lpfc_els.c |    9 +++++++++
Daniel Wagner 521d52
 1 file changed, 9 insertions(+)
Daniel Wagner 521d52
Daniel Wagner 521d52
--- a/drivers/scsi/lpfc/lpfc_els.c
Daniel Wagner 521d52
+++ b/drivers/scsi/lpfc/lpfc_els.c
Daniel Wagner 521d52
@@ -1175,6 +1175,15 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phb
Daniel Wagner 521d52
 			phba->fcf.fcf_redisc_attempted = 0; /* reset */
Daniel Wagner 521d52
 			goto out;
Daniel Wagner 521d52
 		}
Daniel Wagner 521d52
+	} else if (vport->port_state > LPFC_FLOGI &&
Daniel Wagner 521d52
+		   vport->fc_flag & FC_PT2PT) {
Daniel Wagner 521d52
+		/*
Daniel Wagner 521d52
+		 * In a p2p topology, it is possible that discovery has
Daniel Wagner 521d52
+		 * already progressed, and this completion can be ignored.
Daniel Wagner 521d52
+		 * Recheck the indicated topology.
Daniel Wagner 521d52
+		 */
Daniel Wagner 521d52
+		if (!sp->cmn.fPort)
Daniel Wagner 521d52
+			goto out;
Daniel Wagner 521d52
 	}
Daniel Wagner 521d52
 
Daniel Wagner 521d52
 flogifail: