]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
scsi: lpfc: Ensure unregistration of rpis for received PLOGIs
authorJustin Tee <justin.tee@broadcom.com>
Thu, 6 Nov 2025 22:46:33 +0000 (14:46 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sat, 8 Nov 2025 18:18:00 +0000 (13:18 -0500)
Unregistration of an rpi object should be done when a PLOGI is received
as PLOGI receipt implies an implicit LOGO.  Previously, the driver would
continue using the same, already registered, rpi and ACC the received
PLOGI.

Replace the ACC and early return statement with break to execute the
rest of the lpfc_rcv_plogi logic outside the switch case statement.
This ensures unregistration and reregistration of an rpi after PLOGI_ACC
completion.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://patch.msgid.link/20251106224639.139176-5-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/lpfc/lpfc_nportdisc.c

index b4aba68afb6621d5ffc61f5e0f5c24016eda4abe..8552b24b45a146a50142b02272141437f8d2f75f 100644 (file)
@@ -3263,7 +3263,7 @@ lpfc_reg_fab_ctrl_node(struct lpfc_vport *vport, struct lpfc_nodelist *fc_ndlp)
                return -ENOMEM;
        }
        rc = lpfc_reg_rpi(phba, vport->vpi, fc_ndlp->nlp_DID,
-                         (u8 *)&vport->fc_sparam, mbox, fc_ndlp->nlp_rpi);
+                         (u8 *)&ns_ndlp->fc_sparam, mbox, fc_ndlp->nlp_rpi);
        if (rc) {
                rc = -EACCES;
                goto out;
index 1e5ef93e67e3126c1f6df0a50b5e62357f8d34ac..a6da7c3924052fef23bd6436e8d9208c5917b808 100644 (file)
@@ -452,18 +452,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
                 */
                if (!(ndlp->nlp_type & NLP_FABRIC) &&
                    !(phba->nvmet_support)) {
-                       /* Clear ndlp info, since follow up PRLI may have
-                        * updated ndlp information
-                        */
-                       ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR);
-                       ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR);
-                       ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
-                       ndlp->nlp_nvme_info &= ~NLP_NVME_NSLER;
-                       clear_bit(NLP_FIRSTBURST, &ndlp->nlp_flag);
-
-                       lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb,
-                                        ndlp, NULL);
-                       return 1;
+                       break;
                }
                if (nlp_portwwn != 0 &&
                    nlp_portwwn != wwn_to_u64(sp->portName.u.wwn))
@@ -485,7 +474,9 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
                lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
                break;
        }
-
+       /* Clear ndlp info, since follow up processes may have
+        * updated ndlp information
+        */
        ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR);
        ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR);
        ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;