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