[PATCH 03/11] lpfc: Fix "Unexpected timeout" error in direct attach topology

James Smart
2021-05-14T19:56:09Z

An 'unexpected timeout' message may be seen in a pt-2-pt topology.
The message occurs when a PLOGI is received before the driver is
notified of FLOGI completion. The FLOGI completion failure causes
discovery to be triggered for a second time. The discovery timer is
restarted but no new discovery activity is initiated, thus the
timeout message eventually appears.

In pt-2-pt, when discovery has progressed before the FLOGI completion
is processed, it is not a failure. Add code to FLOGI completion to
detect that discovery has progressed and exit the FLOGI handling
(noop'ing it).

Co-developed-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
---
drivers/scsi/lpfc/lpfc_els.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index a0ff15e63109..118f0d50968a 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -1175,6 +1175,15 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
phba->fcf.fcf_redisc_attempted = 0; /* reset */
goto out;
}
+ } else if (vport->port_state > LPFC_FLOGI &&
+ vport->fc_flag & FC_PT2PT) {
+ /*
+ * In a p2p topology, it is possible that discovery has
+ * already progressed, and this completion can be ignored.
+ * Recheck the indicated topology.
+ */
+ if (!sp->cmn.fPort)
+ goto out;
}

flogifail:
--
2.26.2