Skip to content

Commit ee80d8c

Browse files
Justin Teemartinkpetersen
authored andcommitted
scsi: lpfc: Modify handling of ADISC based on ndlp state and RPI registration
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent bb33b07 commit ee80d8c

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

drivers/scsi/lpfc/lpfc_nportdisc.c

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ static int
6464
lpfc_check_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
6565
struct lpfc_name *nn, struct lpfc_name *pn)
6666
{
67-
/* First, we MUST have a RPI registered */
68-
if (!test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag))
69-
return 0;
7067

7168
/* Compare the ADISC rsp WWNN / WWPN matches our internal node
7269
* table entry for that node.
@@ -735,6 +732,7 @@ lpfc_rcv_padisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
735732
ADISC *ap;
736733
uint32_t *lp;
737734
uint32_t cmd;
735+
int rc;
738736

739737
pcmd = cmdiocb->cmd_dmabuf;
740738
lp = (uint32_t *) pcmd->virt;
@@ -759,21 +757,29 @@ lpfc_rcv_padisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
759757
* resume the RPI before the ACC goes out.
760758
*/
761759
if (vport->phba->sli_rev == LPFC_SLI_REV4) {
762-
elsiocb = kmalloc(sizeof(struct lpfc_iocbq),
763-
GFP_KERNEL);
764-
if (elsiocb) {
765-
/* Save info from cmd IOCB used in rsp */
766-
memcpy((uint8_t *)elsiocb, (uint8_t *)cmdiocb,
767-
sizeof(struct lpfc_iocbq));
768-
769-
/* Save the ELS cmd */
770-
elsiocb->drvrTimeout = cmd;
771-
772-
if (lpfc_sli4_resume_rpi(ndlp,
773-
lpfc_mbx_cmpl_resume_rpi,
774-
elsiocb))
775-
kfree(elsiocb);
776-
goto out;
760+
/* Don't resume an unregistered RPI - unnecessary
761+
* mailbox. Just send the ACC when the RPI is not
762+
* registered.
763+
*/
764+
if (test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag)) {
765+
elsiocb = kmalloc(sizeof(*elsiocb), GFP_KERNEL);
766+
if (elsiocb) {
767+
/* Save info from cmd IOCB used in
768+
* rsp
769+
*/
770+
memcpy(elsiocb, cmdiocb,
771+
sizeof(*elsiocb));
772+
773+
elsiocb->drvrTimeout = cmd;
774+
775+
rc = lpfc_sli4_resume_rpi(ndlp,
776+
lpfc_mbx_cmpl_resume_rpi,
777+
elsiocb);
778+
if (rc)
779+
kfree(elsiocb);
780+
781+
goto out;
782+
}
777783
}
778784
}
779785

@@ -815,7 +821,6 @@ lpfc_rcv_padisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
815821
set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag);
816822
ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
817823
ndlp->nlp_prev_state = ndlp->nlp_state;
818-
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
819824
return 0;
820825
}
821826

0 commit comments

Comments
 (0)