All of lore.kernel.org
 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/10] lpfc: Modify handling of ADISC based on ndlp state and RPI registration
Date: Thu, 12 Dec 2024 15:33:03 -0800	[thread overview]
Message-ID: <20241212233309.71356-5-justintee8345@gmail.com> (raw)
In-Reply-To: <20241212233309.71356-1-justintee8345@gmail.com>

In lpfc_check_adisc, remove the requirement that the ndlp object must have
been RPI registered.  Whether or not the ndlp is RPI registered is
unrelated to verifying that the received ADISC is intended for that ndlp
rport object.

After ADISC receipt, there's no need to put the ndlp state into NPR.  Let
the cmpl routines from the actions taken earlier in ADISC handling set the
proper ndlp state.

Also, refactor when a RESUME_RPI mailbox command should be sent.  It should
only be sent if the RPI registered flag is set.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
---
 drivers/scsi/lpfc/lpfc_nportdisc.c | 43 +++++++++++++++++-------------
 1 file changed, 24 insertions(+), 19 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index 71c76d90e8e7..5aa21c683ac6 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -64,9 +64,6 @@ static int
 lpfc_check_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 		 struct lpfc_name *nn, struct lpfc_name *pn)
 {
-	/* First, we MUST have a RPI registered */
-	if (!test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag))
-		return 0;
 
 	/* Compare the ADISC rsp WWNN / WWPN matches our internal node
 	 * table entry for that node.
@@ -735,6 +732,7 @@ lpfc_rcv_padisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 	ADISC *ap;
 	uint32_t *lp;
 	uint32_t cmd;
+	int rc;
 
 	pcmd = cmdiocb->cmd_dmabuf;
 	lp = (uint32_t *) pcmd->virt;
@@ -759,21 +757,29 @@ lpfc_rcv_padisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 		 * resume the RPI before the ACC goes out.
 		 */
 		if (vport->phba->sli_rev == LPFC_SLI_REV4) {
-			elsiocb = kmalloc(sizeof(struct lpfc_iocbq),
-				GFP_KERNEL);
-			if (elsiocb) {
-				/* Save info from cmd IOCB used in rsp */
-				memcpy((uint8_t *)elsiocb, (uint8_t *)cmdiocb,
-					sizeof(struct lpfc_iocbq));
-
-				/* Save the ELS cmd */
-				elsiocb->drvrTimeout = cmd;
-
-				if (lpfc_sli4_resume_rpi(ndlp,
-						lpfc_mbx_cmpl_resume_rpi,
-						elsiocb))
-					kfree(elsiocb);
-				goto out;
+			/* Don't resume an unregistered RPI - unnecessary
+			 * mailbox. Just send the ACC when the RPI is not
+			 * registered.
+			 */
+			if (test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag)) {
+				elsiocb = kmalloc(sizeof(*elsiocb), GFP_KERNEL);
+				if (elsiocb) {
+					/* Save info from cmd IOCB used in
+					 * rsp
+					 */
+					memcpy(elsiocb, cmdiocb,
+					       sizeof(*elsiocb));
+
+					elsiocb->drvrTimeout = cmd;
+
+					rc = lpfc_sli4_resume_rpi(ndlp,
+								  lpfc_mbx_cmpl_resume_rpi,
+								  elsiocb);
+					if (rc)
+						kfree(elsiocb);
+
+					goto out;
+				}
 			}
 		}
 
@@ -815,7 +821,6 @@ lpfc_rcv_padisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 	set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag);
 	ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
 	ndlp->nlp_prev_state = ndlp->nlp_state;
-	lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
 	return 0;
 }
 
-- 
2.38.0


  parent reply	other threads:[~2024-12-12 23:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12 23:32 [PATCH 00/10] Update lpfc to revision 14.4.0.7 Justin Tee
2024-12-12 23:33 ` [PATCH 01/10] lpfc: Redefine incorrect type in lpfc_create_device_data Justin Tee
2024-12-12 23:33 ` [PATCH 02/10] lpfc: Restrict the REG_FCFI MAM field to FCoE adapters only Justin Tee
2024-12-12 23:33 ` [PATCH 03/10] lpfc: Delete NLP_TARGET_REMOVE flag due to obsolete usage Justin Tee
2024-12-12 23:33 ` Justin Tee [this message]
2024-12-12 23:33 ` [PATCH 05/10] lpfc: Add handling for LS_RJT reason explanation authentication required Justin Tee
2024-12-12 23:33 ` [PATCH 06/10] lpfc: Change lpfc_nodelist save_flags member into a bitmask Justin Tee
2024-12-12 23:33 ` [PATCH 07/10] lpfc: Update definition of firmware configuration mbox cmds Justin Tee
2024-12-12 23:33 ` [PATCH 08/10] lpfc: Add support for large fw object application layer reads Justin Tee
2024-12-12 23:33 ` [PATCH 09/10] lpfc: Update lpfc version to 14.4.0.7 Justin Tee
2024-12-12 23:33 ` [PATCH 10/10] lpfc: Copyright updates for 14.4.0.7 patches Justin Tee
2025-01-02 20:03 ` [PATCH 00/10] Update lpfc to revision 14.4.0.7 Martin K. Petersen
2025-01-10 21:16 ` Martin K. Petersen

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=20241212233309.71356-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.