Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Justin Tee <justintee8345@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: jsmart2021@gmail.com, justin.tee@broadcom.com,
	Justin Tee <justintee8345@gmail.com>
Subject: [PATCH 04/11] lpfc: Ensure unregistration of rpis for received PLOGIs
Date: Mon, 27 Oct 2025 16:54:39 -0700	[thread overview]
Message-ID: <20251027235446.77200-5-justintee8345@gmail.com> (raw)
In-Reply-To: <20251027235446.77200-1-justintee8345@gmail.com>

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>
---
 drivers/scsi/lpfc/lpfc_els.c       |  2 +-
 drivers/scsi/lpfc/lpfc_nportdisc.c | 17 ++++-------------
 2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index b4aba68afb66..8552b24b45a1 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -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;
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index 1e5ef93e67e3..a6da7c392405 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -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;
-- 
2.38.0


  parent reply	other threads:[~2025-10-27 23:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-27 23:54 [PATCH 00/11] Update lpfc to revision 14.4.0.12 Justin Tee
2025-10-27 23:54 ` [PATCH 01/11] lpfc: Update various NPIV diagnostic log messaging Justin Tee
2025-10-27 23:54 ` [PATCH 02/11] lpfc: Revise discovery related function headers and comments Justin Tee
2025-10-27 23:54 ` [PATCH 03/11] lpfc: Remove redundant NULL ptr assignment in lpfc_els_free_iocb Justin Tee
2025-10-27 23:54 ` Justin Tee [this message]
2025-10-27 23:54 ` [PATCH 05/11] lpfc: Fix leaked ndlp krefs when in point-to-point topology Justin Tee
2025-10-27 23:54 ` [PATCH 06/11] lpfc: Modify kref handling for Fabric Controller ndlps Justin Tee
2025-10-27 23:54 ` [PATCH 07/11] lpfc: Fix reusing an ndlp that is marked NLP_DROPPED during FLOGI Justin Tee
2025-10-27 23:54 ` [PATCH 08/11] lpfc: Allow support for BB credit recovery in point-to-point topology Justin Tee
2025-10-27 23:54 ` [PATCH 09/11] lpfc: Add capability to register Platform Name ID to fabric Justin Tee
2025-10-28  7:34   ` Krzysztof Kozlowski
2025-10-28 23:16     ` Justin Tee
2025-10-29  5:20       ` Krzysztof Kozlowski
2025-10-29 18:14         ` Justin Tee
2025-10-30  5:29           ` Krzysztof Kozlowski
2025-10-30 17:34             ` Justin Tee
2025-10-27 23:54 ` [PATCH 10/11] lpfc: Update lpfc version to 14.4.0.12 Justin Tee
2025-10-28  7:33   ` Krzysztof Kozlowski
2025-10-28 23:13     ` Justin Tee
2025-10-27 23:54 ` [PATCH 11/11] lpfc: Copyright updates for 14.4.0.12 patches Justin Tee
2025-10-28  7:32   ` Krzysztof Kozlowski
2025-10-28 23:13     ` Justin Tee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251027235446.77200-5-justintee8345@gmail.com \
    --to=justintee8345@gmail.com \
    --cc=jsmart2021@gmail.com \
    --cc=justin.tee@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox