Skip to content

Commit e1b3aca

Browse files
Justin Teemartinkpetersen
authored andcommitted
scsi: lpfc: Allow lpfc_plogi_confirm_nport() logic to execute for Fabric nodes
Remove the early return NLP_FABRIC check in lpfc_plogi_confirm_nport() because it is possible for switch domain controllers to change WWPN. As a result, allow lpfc_plogi_confirm_nport() to detect that a new ndlp should be initialized in such cases. The old ndlp object will be cleaned up when dev_loss_tmo callbk executes. Signed-off-by: Justin Tee <justin.tee@broadcom.com> Link: https://lore.kernel.org/r/20240131185112.149731-6-justintee8345@gmail.com Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent b76beac commit e1b3aca

File tree

1 file changed

+32
-17
lines changed

1 file changed

+32
-17
lines changed

drivers/scsi/lpfc/lpfc_els.c

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,18 +1696,13 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,
16961696
struct serv_parm *sp;
16971697
uint8_t name[sizeof(struct lpfc_name)];
16981698
uint32_t keepDID = 0, keep_nlp_flag = 0;
1699+
int rc;
16991700
uint32_t keep_new_nlp_flag = 0;
17001701
uint16_t keep_nlp_state;
17011702
u32 keep_nlp_fc4_type = 0;
17021703
struct lpfc_nvme_rport *keep_nrport = NULL;
17031704
unsigned long *active_rrqs_xri_bitmap = NULL;
17041705

1705-
/* Fabric nodes can have the same WWPN so we don't bother searching
1706-
* by WWPN. Just return the ndlp that was given to us.
1707-
*/
1708-
if (ndlp->nlp_type & NLP_FABRIC)
1709-
return ndlp;
1710-
17111706
sp = (struct serv_parm *) ((uint8_t *) prsp + sizeof(uint32_t));
17121707
memset(name, 0, sizeof(struct lpfc_name));
17131708

@@ -1717,15 +1712,9 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,
17171712
new_ndlp = lpfc_findnode_wwpn(vport, &sp->portName);
17181713

17191714
/* return immediately if the WWPN matches ndlp */
1720-
if (!new_ndlp || (new_ndlp == ndlp))
1715+
if (new_ndlp == ndlp)
17211716
return ndlp;
17221717

1723-
/*
1724-
* Unregister from backend if not done yet. Could have been skipped
1725-
* due to ADISC
1726-
*/
1727-
lpfc_nlp_unreg_node(vport, new_ndlp);
1728-
17291718
if (phba->sli_rev == LPFC_SLI_REV4) {
17301719
active_rrqs_xri_bitmap = mempool_alloc(phba->active_rrq_pool,
17311720
GFP_KERNEL);
@@ -1742,11 +1731,37 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,
17421731
(new_ndlp ? new_ndlp->nlp_flag : 0),
17431732
(new_ndlp ? new_ndlp->nlp_fc4_type : 0));
17441733

1745-
keepDID = new_ndlp->nlp_DID;
1734+
if (!new_ndlp) {
1735+
rc = memcmp(&ndlp->nlp_portname, name,
1736+
sizeof(struct lpfc_name));
1737+
if (!rc) {
1738+
if (active_rrqs_xri_bitmap)
1739+
mempool_free(active_rrqs_xri_bitmap,
1740+
phba->active_rrq_pool);
1741+
return ndlp;
1742+
}
1743+
new_ndlp = lpfc_nlp_init(vport, ndlp->nlp_DID);
1744+
if (!new_ndlp) {
1745+
if (active_rrqs_xri_bitmap)
1746+
mempool_free(active_rrqs_xri_bitmap,
1747+
phba->active_rrq_pool);
1748+
return ndlp;
1749+
}
1750+
} else {
1751+
if (phba->sli_rev == LPFC_SLI_REV4 &&
1752+
active_rrqs_xri_bitmap)
1753+
memcpy(active_rrqs_xri_bitmap,
1754+
new_ndlp->active_rrqs_xri_bitmap,
1755+
phba->cfg_rrq_xri_bitmap_sz);
17461756

1747-
if (phba->sli_rev == LPFC_SLI_REV4 && active_rrqs_xri_bitmap)
1748-
memcpy(active_rrqs_xri_bitmap, new_ndlp->active_rrqs_xri_bitmap,
1749-
phba->cfg_rrq_xri_bitmap_sz);
1757+
/*
1758+
* Unregister from backend if not done yet. Could have been
1759+
* skipped due to ADISC
1760+
*/
1761+
lpfc_nlp_unreg_node(vport, new_ndlp);
1762+
}
1763+
1764+
keepDID = new_ndlp->nlp_DID;
17501765

17511766
/* At this point in this routine, we know new_ndlp will be
17521767
* returned. however, any previous GID_FTs that were done

0 commit comments

Comments
 (0)