scsi: lpfc: Fix FLOGI ACC with wrong SID in PT2PT topology
authorJames Smart <jsmart2021@gmail.com>
Sun, 11 Sep 2022 22:14:54 +0000 (15:14 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 16 Sep 2022 02:18:26 +0000 (22:18 -0400)
When a FLOGI is received before we have issued our FLOGI, the ACC response
to the received FLOGI is issued with SID 2 instead of the expected fabric
controller SID.  Certain target vendors ignore the malformed ACC with SID 2
and wait for a properly filled ACC with a fabric controller SID.

The lpfc_sli_prep_wqe() routine depends on the FC_PT2PT flag to fill in the
fabric controller SID when in PT2PT mode, but due to a previous commit the
flag was getting cleared.  Fix by adding a check for the defer_flogi_acc
flag to know whether or not to clear the FC_PT2PT flag on link up.

Link: https://lore.kernel.org/r/20220911221505.117655-3-jsmart2021@gmail.com
Fixes: 439b93293ff2 ("scsi: lpfc: Fix unsolicited FLOGI receive handling during PT2PT discovery")
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>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_hbadisc.c

index 83d2b29..24d533c 100644 (file)
@@ -1353,8 +1353,13 @@ lpfc_linkup_port(struct lpfc_vport *vport)
                                   FCH_EVT_LINKUP, 0);
 
        spin_lock_irq(shost->host_lock);
-       vport->fc_flag &= ~(FC_PT2PT | FC_PT2PT_PLOGI | FC_ABORT_DISCOVERY |
-                           FC_RSCN_MODE | FC_NLP_MORE | FC_RSCN_DISCOVERY);
+       if (phba->defer_flogi_acc_flag)
+               vport->fc_flag &= ~(FC_ABORT_DISCOVERY | FC_RSCN_MODE |
+                                   FC_NLP_MORE | FC_RSCN_DISCOVERY);
+       else
+               vport->fc_flag &= ~(FC_PT2PT | FC_PT2PT_PLOGI |
+                                   FC_ABORT_DISCOVERY | FC_RSCN_MODE |
+                                   FC_NLP_MORE | FC_RSCN_DISCOVERY);
        vport->fc_flag |= FC_NDISC_ACTIVE;
        vport->fc_ns_retry = 0;
        spin_unlock_irq(shost->host_lock);