scsi: lpfc: Change lpfc_nodelist nlp_flag member into a bitmask

In attempt to reduce the amount of unnecessary ndlp->lock acquisitions
in the lpfc driver, change nlpa_flag into an unsigned long bitmask and
use clear_bit/test_bit bitwise atomic APIs instead of reliance on
ndlp->lock for synchronization.

Signed-off-by: Justin Tee <justin.tee@broadcom.com>
Link: https://lore.kernel.org/r/20241031223219.152342-10-justintee8345@gmail.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Justin Tee 2024-10-31 15:32:17 -07:00 committed by Martin K. Petersen
parent 32566a6f1a
commit 92b99f1a73
13 changed files with 478 additions and 663 deletions

View File

@ -398,7 +398,11 @@ lpfc_bsg_send_mgmt_cmd(struct bsg_job *job)
/* in case no data is transferred */ /* in case no data is transferred */
bsg_reply->reply_payload_rcv_len = 0; bsg_reply->reply_payload_rcv_len = 0;
if (ndlp->nlp_flag & NLP_ELS_SND_MASK) if (test_bit(NLP_PLOGI_SND, &ndlp->nlp_flag) ||
test_bit(NLP_PRLI_SND, &ndlp->nlp_flag) ||
test_bit(NLP_ADISC_SND, &ndlp->nlp_flag) ||
test_bit(NLP_LOGO_SND, &ndlp->nlp_flag) ||
test_bit(NLP_RNID_SND, &ndlp->nlp_flag))
return -ENODEV; return -ENODEV;
/* allocate our bsg tracking structure */ /* allocate our bsg tracking structure */

View File

@ -735,7 +735,7 @@ lpfc_prep_node_fc4type(struct lpfc_vport *vport, uint32_t Did, uint8_t fc4_type)
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
"0238 Process x%06x NameServer Rsp " "0238 Process x%06x NameServer Rsp "
"Data: x%x x%x x%x x%lx x%x\n", Did, "Data: x%lx x%x x%x x%lx x%x\n", Did,
ndlp->nlp_flag, ndlp->nlp_fc4_type, ndlp->nlp_flag, ndlp->nlp_fc4_type,
ndlp->nlp_state, vport->fc_flag, ndlp->nlp_state, vport->fc_flag,
vport->fc_rscn_id_cnt); vport->fc_rscn_id_cnt);
@ -744,7 +744,7 @@ lpfc_prep_node_fc4type(struct lpfc_vport *vport, uint32_t Did, uint8_t fc4_type)
* state of ndlp hit devloss, change state to * state of ndlp hit devloss, change state to
* allow rediscovery. * allow rediscovery.
*/ */
if (ndlp->nlp_flag & NLP_NPR_2B_DISC && if (test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag) &&
ndlp->nlp_state == NLP_STE_UNUSED_NODE) { ndlp->nlp_state == NLP_STE_UNUSED_NODE) {
lpfc_nlp_set_state(vport, ndlp, lpfc_nlp_set_state(vport, ndlp,
NLP_STE_NPR_NODE); NLP_STE_NPR_NODE);
@ -832,12 +832,10 @@ lpfc_ns_rsp_audit_did(struct lpfc_vport *vport, uint32_t Did, uint8_t fc4_type)
if (ndlp->nlp_type != NLP_NVME_INITIATOR || if (ndlp->nlp_type != NLP_NVME_INITIATOR ||
ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) ndlp->nlp_state != NLP_STE_UNMAPPED_NODE)
continue; continue;
spin_lock_irq(&ndlp->lock);
if (ndlp->nlp_DID == Did) if (ndlp->nlp_DID == Did)
ndlp->nlp_flag &= ~NLP_NVMET_RECOV; clear_bit(NLP_NVMET_RECOV, &ndlp->nlp_flag);
else else
ndlp->nlp_flag |= NLP_NVMET_RECOV; set_bit(NLP_NVMET_RECOV, &ndlp->nlp_flag);
spin_unlock_irq(&ndlp->lock);
} }
} }
} }
@ -894,13 +892,11 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint8_t fc4_type,
*/ */
if (vport->phba->nvmet_support) { if (vport->phba->nvmet_support) {
list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) { list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
if (!(ndlp->nlp_flag & NLP_NVMET_RECOV)) if (!test_bit(NLP_NVMET_RECOV, &ndlp->nlp_flag))
continue; continue;
lpfc_disc_state_machine(vport, ndlp, NULL, lpfc_disc_state_machine(vport, ndlp, NULL,
NLP_EVT_DEVICE_RECOVERY); NLP_EVT_DEVICE_RECOVERY);
spin_lock_irq(&ndlp->lock); clear_bit(NLP_NVMET_RECOV, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_NVMET_RECOV;
spin_unlock_irq(&ndlp->lock);
} }
} }
@ -1440,7 +1436,7 @@ lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
if (ndlp) { if (ndlp) {
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
"0242 Process x%x GFF " "0242 Process x%x GFF "
"NameServer Rsp Data: x%x x%lx x%x\n", "NameServer Rsp Data: x%lx x%lx x%x\n",
did, ndlp->nlp_flag, vport->fc_flag, did, ndlp->nlp_flag, vport->fc_flag,
vport->fc_rscn_id_cnt); vport->fc_rscn_id_cnt);
} else { } else {

View File

@ -870,8 +870,8 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size)
wwn_to_u64(ndlp->nlp_nodename.u.wwn)); wwn_to_u64(ndlp->nlp_nodename.u.wwn));
len += scnprintf(buf+len, size-len, "RPI:x%04x ", len += scnprintf(buf+len, size-len, "RPI:x%04x ",
ndlp->nlp_rpi); ndlp->nlp_rpi);
len += scnprintf(buf+len, size-len, "flag:x%08x ", len += scnprintf(buf+len, size-len, "flag:x%08lx ",
ndlp->nlp_flag); ndlp->nlp_flag);
if (!ndlp->nlp_type) if (!ndlp->nlp_type)
len += scnprintf(buf+len, size-len, "UNKNOWN_TYPE "); len += scnprintf(buf+len, size-len, "UNKNOWN_TYPE ");
if (ndlp->nlp_type & NLP_FC_NODE) if (ndlp->nlp_type & NLP_FC_NODE)

View File

@ -102,7 +102,7 @@ struct lpfc_nodelist {
spinlock_t lock; /* Node management lock */ spinlock_t lock; /* Node management lock */
uint32_t nlp_flag; /* entry flags */ unsigned long nlp_flag; /* entry flags */
uint32_t nlp_DID; /* FC D_ID of entry */ uint32_t nlp_DID; /* FC D_ID of entry */
uint32_t nlp_last_elscmd; /* Last ELS cmd sent */ uint32_t nlp_last_elscmd; /* Last ELS cmd sent */
uint16_t nlp_type; uint16_t nlp_type;
@ -182,36 +182,37 @@ struct lpfc_node_rrq {
#define lpfc_ndlp_check_qdepth(phba, ndlp) \ #define lpfc_ndlp_check_qdepth(phba, ndlp) \
(ndlp->cmd_qdepth < phba->sli4_hba.max_cfg_param.max_xri) (ndlp->cmd_qdepth < phba->sli4_hba.max_cfg_param.max_xri)
/* Defines for nlp_flag (uint32) */ /* nlp_flag mask bits */
#define NLP_IGNR_REG_CMPL 0x00000001 /* Rcvd rscn before we cmpl reg login */ enum lpfc_nlp_flag {
#define NLP_REG_LOGIN_SEND 0x00000002 /* sent reglogin to adapter */ NLP_IGNR_REG_CMPL = 0, /* Rcvd rscn before we cmpl reg login */
#define NLP_SUPPRESS_RSP 0x00000010 /* Remote NPort supports suppress rsp */ NLP_REG_LOGIN_SEND = 1, /* sent reglogin to adapter */
#define NLP_PLOGI_SND 0x00000020 /* sent PLOGI request for this entry */ NLP_SUPPRESS_RSP = 4, /* Remote NPort supports suppress rsp */
#define NLP_PRLI_SND 0x00000040 /* sent PRLI request for this entry */ NLP_PLOGI_SND = 5, /* sent PLOGI request for this entry */
#define NLP_ADISC_SND 0x00000080 /* sent ADISC request for this entry */ NLP_PRLI_SND = 6, /* sent PRLI request for this entry */
#define NLP_LOGO_SND 0x00000100 /* sent LOGO request for this entry */ NLP_ADISC_SND = 7, /* sent ADISC request for this entry */
#define NLP_RNID_SND 0x00000400 /* sent RNID request for this entry */ NLP_LOGO_SND = 8, /* sent LOGO request for this entry */
#define NLP_ELS_SND_MASK 0x000007e0 /* sent ELS request for this entry */ NLP_RNID_SND = 10, /* sent RNID request for this entry */
#define NLP_NVMET_RECOV 0x00001000 /* NVMET auditing node for recovery. */ NLP_NVMET_RECOV = 12, /* NVMET auditing node for recovery. */
#define NLP_UNREG_INP 0x00008000 /* UNREG_RPI cmd is in progress */ NLP_UNREG_INP = 15, /* UNREG_RPI cmd is in progress */
#define NLP_DROPPED 0x00010000 /* Init ref count has been dropped */ NLP_DROPPED = 16, /* Init ref count has been dropped */
#define NLP_DELAY_TMO 0x00020000 /* delay timeout is running for node */ NLP_DELAY_TMO = 17, /* delay timeout is running for node */
#define NLP_NPR_2B_DISC 0x00040000 /* node is included in num_disc_nodes */ NLP_NPR_2B_DISC = 18, /* node is included in num_disc_nodes */
#define NLP_RCV_PLOGI 0x00080000 /* Rcv'ed PLOGI from remote system */ NLP_RCV_PLOGI = 19, /* Rcv'ed PLOGI from remote system */
#define NLP_LOGO_ACC 0x00100000 /* Process LOGO after ACC completes */ NLP_LOGO_ACC = 20, /* Process LOGO after ACC completes */
#define NLP_TGT_NO_SCSIID 0x00200000 /* good PRLI but no binding for scsid */ NLP_TGT_NO_SCSIID = 21, /* good PRLI but no binding for scsid */
#define NLP_ISSUE_LOGO 0x00400000 /* waiting to issue a LOGO */ NLP_ISSUE_LOGO = 22, /* waiting to issue a LOGO */
#define NLP_IN_DEV_LOSS 0x00800000 /* devloss in progress */ NLP_IN_DEV_LOSS = 23, /* devloss in progress */
#define NLP_ACC_REGLOGIN 0x01000000 /* Issue Reg Login after successful NLP_ACC_REGLOGIN = 24, /* Issue Reg Login after successful
ACC */ ACC */
#define NLP_NPR_ADISC 0x02000000 /* Issue ADISC when dq'ed from NLP_NPR_ADISC = 25, /* Issue ADISC when dq'ed from
NPR list */ NPR list */
#define NLP_RM_DFLT_RPI 0x04000000 /* need to remove leftover dflt RPI */ NLP_RM_DFLT_RPI = 26, /* need to remove leftover dflt RPI */
#define NLP_NODEV_REMOVE 0x08000000 /* Defer removal till discovery ends */ NLP_NODEV_REMOVE = 27, /* Defer removal till discovery ends */
#define NLP_TARGET_REMOVE 0x10000000 /* Target remove in process */ NLP_TARGET_REMOVE = 28, /* Target remove in process */
#define NLP_SC_REQ 0x20000000 /* Target requires authentication */ NLP_SC_REQ = 29, /* Target requires authentication */
#define NLP_FIRSTBURST 0x40000000 /* Target supports FirstBurst */ NLP_FIRSTBURST = 30, /* Target supports FirstBurst */
#define NLP_RPI_REGISTERED 0x80000000 /* nlp_rpi is valid */ NLP_RPI_REGISTERED = 31 /* nlp_rpi is valid */
};
/* There are 4 different double linked lists nodelist entries can reside on. /* There are 4 different double linked lists nodelist entries can reside on.
* The Port Login (PLOGI) list and Address Discovery (ADISC) list are used * The Port Login (PLOGI) list and Address Discovery (ADISC) list are used

File diff suppressed because it is too large Load Diff

View File

@ -143,7 +143,7 @@ lpfc_terminate_rport_io(struct fc_rport *rport)
ndlp = rdata->pnode; ndlp = rdata->pnode;
vport = ndlp->vport; vport = ndlp->vport;
lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT, lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT,
"rport terminate: sid:x%x did:x%x flg:x%x", "rport terminate: sid:x%x did:x%x flg:x%lx",
ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag); ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag);
if (ndlp->nlp_sid != NLP_NO_SID) if (ndlp->nlp_sid != NLP_NO_SID)
@ -171,11 +171,11 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)
phba = vport->phba; phba = vport->phba;
lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT, lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT,
"rport devlosscb: sid:x%x did:x%x flg:x%x", "rport devlosscb: sid:x%x did:x%x flg:x%lx",
ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag); ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag);
lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE,
"3181 dev_loss_callbk x%06x, rport x%px flg x%x " "3181 dev_loss_callbk x%06x, rport x%px flg x%lx "
"load_flag x%lx refcnt %u state %d xpt x%x\n", "load_flag x%lx refcnt %u state %d xpt x%x\n",
ndlp->nlp_DID, ndlp->rport, ndlp->nlp_flag, ndlp->nlp_DID, ndlp->rport, ndlp->nlp_flag,
vport->load_flag, kref_read(&ndlp->kref), vport->load_flag, kref_read(&ndlp->kref),
@ -214,18 +214,13 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)
spin_unlock_irqrestore(&ndlp->lock, iflags); spin_unlock_irqrestore(&ndlp->lock, iflags);
} }
spin_lock_irqsave(&ndlp->lock, iflags);
/* Only 1 thread can drop the initial node reference. If /* Only 1 thread can drop the initial node reference. If
* another thread has set NLP_DROPPED, this thread is done. * another thread has set NLP_DROPPED, this thread is done.
*/ */
if (nvme_reg || (ndlp->nlp_flag & NLP_DROPPED)) { if (nvme_reg || test_bit(NLP_DROPPED, &ndlp->nlp_flag))
spin_unlock_irqrestore(&ndlp->lock, iflags);
return; return;
}
ndlp->nlp_flag |= NLP_DROPPED; set_bit(NLP_DROPPED, &ndlp->nlp_flag);
spin_unlock_irqrestore(&ndlp->lock, iflags);
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
return; return;
} }
@ -253,14 +248,14 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)
return; return;
} }
spin_lock_irqsave(&ndlp->lock, iflags); set_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_IN_DEV_LOSS;
spin_lock_irqsave(&ndlp->lock, iflags);
/* If there is a PLOGI in progress, and we are in a /* If there is a PLOGI in progress, and we are in a
* NLP_NPR_2B_DISC state, don't turn off the flag. * NLP_NPR_2B_DISC state, don't turn off the flag.
*/ */
if (ndlp->nlp_state != NLP_STE_PLOGI_ISSUE) if (ndlp->nlp_state != NLP_STE_PLOGI_ISSUE)
ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
/* /*
* The backend does not expect any more calls associated with this * The backend does not expect any more calls associated with this
@ -289,15 +284,13 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)
} else { } else {
lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE,
"3188 worker thread is stopped %s x%06x, " "3188 worker thread is stopped %s x%06x, "
" rport x%px flg x%x load_flag x%lx refcnt " " rport x%px flg x%lx load_flag x%lx refcnt "
"%d\n", __func__, ndlp->nlp_DID, "%d\n", __func__, ndlp->nlp_DID,
ndlp->rport, ndlp->nlp_flag, ndlp->rport, ndlp->nlp_flag,
vport->load_flag, kref_read(&ndlp->kref)); vport->load_flag, kref_read(&ndlp->kref));
if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD)) { if (!(ndlp->fc4_xpt_flags & NVME_XPT_REGD)) {
spin_lock_irqsave(&ndlp->lock, iflags);
/* Node is in dev loss. No further transaction. */ /* Node is in dev loss. No further transaction. */
ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS; clear_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag);
spin_unlock_irqrestore(&ndlp->lock, iflags);
lpfc_disc_state_machine(vport, ndlp, NULL, lpfc_disc_state_machine(vport, ndlp, NULL,
NLP_EVT_DEVICE_RM); NLP_EVT_DEVICE_RM);
} }
@ -430,7 +423,7 @@ lpfc_check_nlp_post_devloss(struct lpfc_vport *vport,
lpfc_nlp_get(ndlp); lpfc_nlp_get(ndlp);
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY | LOG_NODE, lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY | LOG_NODE,
"8438 Devloss timeout reversed on DID x%x " "8438 Devloss timeout reversed on DID x%x "
"refcnt %d ndlp %p flag x%x " "refcnt %d ndlp %p flag x%lx "
"port_state = x%x\n", "port_state = x%x\n",
ndlp->nlp_DID, kref_read(&ndlp->kref), ndlp, ndlp->nlp_DID, kref_read(&ndlp->kref), ndlp,
ndlp->nlp_flag, vport->port_state); ndlp->nlp_flag, vport->port_state);
@ -473,7 +466,7 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
ndlp->nlp_DID, ndlp->nlp_type, ndlp->nlp_sid); ndlp->nlp_DID, ndlp->nlp_type, ndlp->nlp_sid);
lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE, lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE,
"3182 %s x%06x, nflag x%x xflags x%x refcnt %d\n", "3182 %s x%06x, nflag x%lx xflags x%x refcnt %d\n",
__func__, ndlp->nlp_DID, ndlp->nlp_flag, __func__, ndlp->nlp_DID, ndlp->nlp_flag,
ndlp->fc4_xpt_flags, kref_read(&ndlp->kref)); ndlp->fc4_xpt_flags, kref_read(&ndlp->kref));
@ -487,9 +480,7 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
*(name+4), *(name+5), *(name+6), *(name+7), *(name+4), *(name+5), *(name+6), *(name+7),
ndlp->nlp_DID); ndlp->nlp_DID);
spin_lock_irqsave(&ndlp->lock, iflags); clear_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS;
spin_unlock_irqrestore(&ndlp->lock, iflags);
return fcf_inuse; return fcf_inuse;
} }
@ -517,7 +508,7 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
} }
break; break;
case Fabric_Cntl_DID: case Fabric_Cntl_DID:
if (ndlp->nlp_flag & NLP_REG_LOGIN_SEND) if (test_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag))
recovering = true; recovering = true;
break; break;
case FDMI_DID: case FDMI_DID:
@ -545,15 +536,13 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
* the following lpfc_nlp_put is necessary after fabric node is * the following lpfc_nlp_put is necessary after fabric node is
* recovered. * recovered.
*/ */
spin_lock_irqsave(&ndlp->lock, iflags); clear_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS;
spin_unlock_irqrestore(&ndlp->lock, iflags);
if (recovering) { if (recovering) {
lpfc_printf_vlog(vport, KERN_INFO, lpfc_printf_vlog(vport, KERN_INFO,
LOG_DISCOVERY | LOG_NODE, LOG_DISCOVERY | LOG_NODE,
"8436 Devloss timeout marked on " "8436 Devloss timeout marked on "
"DID x%x refcnt %d ndlp %p " "DID x%x refcnt %d ndlp %p "
"flag x%x port_state = x%x\n", "flag x%lx port_state = x%x\n",
ndlp->nlp_DID, kref_read(&ndlp->kref), ndlp->nlp_DID, kref_read(&ndlp->kref),
ndlp, ndlp->nlp_flag, ndlp, ndlp->nlp_flag,
vport->port_state); vport->port_state);
@ -570,7 +559,7 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
LOG_DISCOVERY | LOG_NODE, LOG_DISCOVERY | LOG_NODE,
"8437 Devloss timeout ignored on " "8437 Devloss timeout ignored on "
"DID x%x refcnt %d ndlp %p " "DID x%x refcnt %d ndlp %p "
"flag x%x port_state = x%x\n", "flag x%lx port_state = x%x\n",
ndlp->nlp_DID, kref_read(&ndlp->kref), ndlp->nlp_DID, kref_read(&ndlp->kref),
ndlp, ndlp->nlp_flag, ndlp, ndlp->nlp_flag,
vport->port_state); vport->port_state);
@ -590,7 +579,7 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
"0203 Devloss timeout on " "0203 Devloss timeout on "
"WWPN %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x " "WWPN %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x "
"NPort x%06x Data: x%x x%x x%x refcnt %d\n", "NPort x%06x Data: x%lx x%x x%x refcnt %d\n",
*name, *(name+1), *(name+2), *(name+3), *name, *(name+1), *(name+2), *(name+3),
*(name+4), *(name+5), *(name+6), *(name+7), *(name+4), *(name+5), *(name+6), *(name+7),
ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_DID, ndlp->nlp_flag,
@ -600,15 +589,13 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
lpfc_printf_vlog(vport, KERN_INFO, LOG_TRACE_EVENT, lpfc_printf_vlog(vport, KERN_INFO, LOG_TRACE_EVENT,
"0204 Devloss timeout on " "0204 Devloss timeout on "
"WWPN %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x " "WWPN %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x "
"NPort x%06x Data: x%x x%x x%x\n", "NPort x%06x Data: x%lx x%x x%x\n",
*name, *(name+1), *(name+2), *(name+3), *name, *(name+1), *(name+2), *(name+3),
*(name+4), *(name+5), *(name+6), *(name+7), *(name+4), *(name+5), *(name+6), *(name+7),
ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_DID, ndlp->nlp_flag,
ndlp->nlp_state, ndlp->nlp_rpi); ndlp->nlp_state, ndlp->nlp_rpi);
} }
spin_lock_irqsave(&ndlp->lock, iflags); clear_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_IN_DEV_LOSS;
spin_unlock_irqrestore(&ndlp->lock, iflags);
/* If we are devloss, but we are in the process of rediscovering the /* If we are devloss, but we are in the process of rediscovering the
* ndlp, don't issue a NLP_EVT_DEVICE_RM event. * ndlp, don't issue a NLP_EVT_DEVICE_RM event.
@ -1373,7 +1360,7 @@ lpfc_linkup_cleanup_nodes(struct lpfc_vport *vport)
if (ndlp->nlp_DID != Fabric_DID) if (ndlp->nlp_DID != Fabric_DID)
lpfc_unreg_rpi(vport, ndlp); lpfc_unreg_rpi(vport, ndlp);
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
} else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { } else if (!test_bit(NLP_NPR_ADISC, &ndlp->nlp_flag)) {
/* Fail outstanding IO now since device is /* Fail outstanding IO now since device is
* marked for PLOGI. * marked for PLOGI.
*/ */
@ -3882,14 +3869,13 @@ lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
pmb->ctx_ndlp = NULL; pmb->ctx_ndlp = NULL;
lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI | LOG_NODE | LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI | LOG_NODE | LOG_DISCOVERY,
"0002 rpi:%x DID:%x flg:%x %d x%px\n", "0002 rpi:%x DID:%x flg:%lx %d x%px\n",
ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag,
kref_read(&ndlp->kref), kref_read(&ndlp->kref),
ndlp); ndlp);
if (ndlp->nlp_flag & NLP_REG_LOGIN_SEND) clear_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND;
if (ndlp->nlp_flag & NLP_IGNR_REG_CMPL || if (test_bit(NLP_IGNR_REG_CMPL, &ndlp->nlp_flag) ||
ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE) { ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE) {
/* We rcvd a rscn after issuing this /* We rcvd a rscn after issuing this
* mbox reg login, we may have cycled * mbox reg login, we may have cycled
@ -3899,16 +3885,14 @@ lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
* there is another reg login in * there is another reg login in
* process. * process.
*/ */
spin_lock_irq(&ndlp->lock); clear_bit(NLP_IGNR_REG_CMPL, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_IGNR_REG_CMPL;
spin_unlock_irq(&ndlp->lock);
/* /*
* We cannot leave the RPI registered because * We cannot leave the RPI registered because
* if we go thru discovery again for this ndlp * if we go thru discovery again for this ndlp
* a subsequent REG_RPI will fail. * a subsequent REG_RPI will fail.
*/ */
ndlp->nlp_flag |= NLP_RPI_REGISTERED; set_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag);
lpfc_unreg_rpi(vport, ndlp); lpfc_unreg_rpi(vport, ndlp);
} }
@ -4221,7 +4205,7 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
if (phba->sli_rev < LPFC_SLI_REV4) if (phba->sli_rev < LPFC_SLI_REV4)
ndlp->nlp_rpi = mb->un.varWords[0]; ndlp->nlp_rpi = mb->un.varWords[0];
ndlp->nlp_flag |= NLP_RPI_REGISTERED; set_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag);
ndlp->nlp_type |= NLP_FABRIC; ndlp->nlp_type |= NLP_FABRIC;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
@ -4352,9 +4336,7 @@ out:
* reference. * reference.
*/ */
if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD))) { if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD))) {
spin_lock_irq(&ndlp->lock); clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
spin_unlock_irq(&ndlp->lock);
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
} }
@ -4375,11 +4357,11 @@ out:
if (phba->sli_rev < LPFC_SLI_REV4) if (phba->sli_rev < LPFC_SLI_REV4)
ndlp->nlp_rpi = mb->un.varWords[0]; ndlp->nlp_rpi = mb->un.varWords[0];
ndlp->nlp_flag |= NLP_RPI_REGISTERED; set_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag);
ndlp->nlp_type |= NLP_FABRIC; ndlp->nlp_type |= NLP_FABRIC;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE | LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE | LOG_DISCOVERY,
"0003 rpi:%x DID:%x flg:%x %d x%px\n", "0003 rpi:%x DID:%x flg:%lx %d x%px\n",
ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag,
kref_read(&ndlp->kref), kref_read(&ndlp->kref),
ndlp); ndlp);
@ -4471,8 +4453,8 @@ lpfc_mbx_cmpl_fc_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
__func__, ndlp->nlp_DID, ndlp->nlp_rpi, __func__, ndlp->nlp_DID, ndlp->nlp_rpi,
ndlp->nlp_state); ndlp->nlp_state);
ndlp->nlp_flag |= NLP_RPI_REGISTERED; set_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; clear_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag);
ndlp->nlp_type |= NLP_FABRIC; ndlp->nlp_type |= NLP_FABRIC;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
@ -4506,7 +4488,7 @@ lpfc_register_remote_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT, lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT,
"rport add: did:x%x flg:x%x type x%x", "rport add: did:x%x flg:x%lx type x%x",
ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type); ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type);
/* Don't add the remote port if unloading. */ /* Don't add the remote port if unloading. */
@ -4574,7 +4556,7 @@ lpfc_unregister_remote_port(struct lpfc_nodelist *ndlp)
return; return;
lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT, lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT,
"rport delete: did:x%x flg:x%x type x%x", "rport delete: did:x%x flg:x%lx type x%x",
ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type); ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type);
lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
@ -4690,7 +4672,7 @@ lpfc_nlp_unreg_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
lpfc_printf_vlog(vport, KERN_INFO, lpfc_printf_vlog(vport, KERN_INFO,
LOG_ELS | LOG_NODE | LOG_DISCOVERY, LOG_ELS | LOG_NODE | LOG_DISCOVERY,
"0999 %s Not regd: ndlp x%px rport x%px DID " "0999 %s Not regd: ndlp x%px rport x%px DID "
"x%x FLG x%x XPT x%x\n", "x%x FLG x%lx XPT x%x\n",
__func__, ndlp, ndlp->rport, ndlp->nlp_DID, __func__, ndlp, ndlp->rport, ndlp->nlp_DID,
ndlp->nlp_flag, ndlp->fc4_xpt_flags); ndlp->nlp_flag, ndlp->fc4_xpt_flags);
return; return;
@ -4706,7 +4688,7 @@ lpfc_nlp_unreg_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
} else if (!ndlp->rport) { } else if (!ndlp->rport) {
lpfc_printf_vlog(vport, KERN_INFO, lpfc_printf_vlog(vport, KERN_INFO,
LOG_ELS | LOG_NODE | LOG_DISCOVERY, LOG_ELS | LOG_NODE | LOG_DISCOVERY,
"1999 %s NDLP in devloss x%px DID x%x FLG x%x" "1999 %s NDLP in devloss x%px DID x%x FLG x%lx"
" XPT x%x refcnt %u\n", " XPT x%x refcnt %u\n",
__func__, ndlp, ndlp->nlp_DID, ndlp->nlp_flag, __func__, ndlp, ndlp->nlp_DID, ndlp->nlp_flag,
ndlp->fc4_xpt_flags, ndlp->fc4_xpt_flags,
@ -4751,7 +4733,7 @@ lpfc_handle_adisc_state(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
ndlp->nlp_type |= NLP_FC_NODE; ndlp->nlp_type |= NLP_FC_NODE;
fallthrough; fallthrough;
case NLP_STE_MAPPED_NODE: case NLP_STE_MAPPED_NODE:
ndlp->nlp_flag &= ~NLP_NODEV_REMOVE; clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag);
lpfc_nlp_reg_node(vport, ndlp); lpfc_nlp_reg_node(vport, ndlp);
break; break;
@ -4762,7 +4744,7 @@ lpfc_handle_adisc_state(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
* backend, attempt it now * backend, attempt it now
*/ */
case NLP_STE_NPR_NODE: case NLP_STE_NPR_NODE:
ndlp->nlp_flag &= ~NLP_RCV_PLOGI; clear_bit(NLP_RCV_PLOGI, &ndlp->nlp_flag);
fallthrough; fallthrough;
default: default:
lpfc_nlp_unreg_node(vport, ndlp); lpfc_nlp_unreg_node(vport, ndlp);
@ -4783,13 +4765,13 @@ lpfc_nlp_state_cleanup(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
} }
if (new_state == NLP_STE_UNMAPPED_NODE) { if (new_state == NLP_STE_UNMAPPED_NODE) {
ndlp->nlp_flag &= ~NLP_NODEV_REMOVE; clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag);
ndlp->nlp_type |= NLP_FC_NODE; ndlp->nlp_type |= NLP_FC_NODE;
} }
if (new_state == NLP_STE_MAPPED_NODE) if (new_state == NLP_STE_MAPPED_NODE)
ndlp->nlp_flag &= ~NLP_NODEV_REMOVE; clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag);
if (new_state == NLP_STE_NPR_NODE) if (new_state == NLP_STE_NPR_NODE)
ndlp->nlp_flag &= ~NLP_RCV_PLOGI; clear_bit(NLP_RCV_PLOGI, &ndlp->nlp_flag);
/* Reg/Unreg for FCP and NVME Transport interface */ /* Reg/Unreg for FCP and NVME Transport interface */
if ((old_state == NLP_STE_MAPPED_NODE || if ((old_state == NLP_STE_MAPPED_NODE ||
@ -4797,7 +4779,7 @@ lpfc_nlp_state_cleanup(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
/* For nodes marked for ADISC, Handle unreg in ADISC cmpl /* For nodes marked for ADISC, Handle unreg in ADISC cmpl
* if linkup. In linkdown do unreg_node * if linkup. In linkdown do unreg_node
*/ */
if (!(ndlp->nlp_flag & NLP_NPR_ADISC) || if (!test_bit(NLP_NPR_ADISC, &ndlp->nlp_flag) ||
!lpfc_is_link_up(vport->phba)) !lpfc_is_link_up(vport->phba))
lpfc_nlp_unreg_node(vport, ndlp); lpfc_nlp_unreg_node(vport, ndlp);
} }
@ -4817,9 +4799,7 @@ lpfc_nlp_state_cleanup(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
(!ndlp->rport || (!ndlp->rport ||
ndlp->rport->scsi_target_id == -1 || ndlp->rport->scsi_target_id == -1 ||
ndlp->rport->scsi_target_id >= LPFC_MAX_TARGET)) { ndlp->rport->scsi_target_id >= LPFC_MAX_TARGET)) {
spin_lock_irq(&ndlp->lock); set_bit(NLP_TGT_NO_SCSIID, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_TGT_NO_SCSIID;
spin_unlock_irq(&ndlp->lock);
lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
} }
} }
@ -4851,7 +4831,7 @@ lpfc_nlp_set_state(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
int state) int state)
{ {
int old_state = ndlp->nlp_state; int old_state = ndlp->nlp_state;
int node_dropped = ndlp->nlp_flag & NLP_DROPPED; bool node_dropped = test_bit(NLP_DROPPED, &ndlp->nlp_flag);
char name1[16], name2[16]; char name1[16], name2[16];
unsigned long iflags; unsigned long iflags;
@ -4867,7 +4847,7 @@ lpfc_nlp_set_state(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
if (node_dropped && old_state == NLP_STE_UNUSED_NODE && if (node_dropped && old_state == NLP_STE_UNUSED_NODE &&
state != NLP_STE_UNUSED_NODE) { state != NLP_STE_UNUSED_NODE) {
ndlp->nlp_flag &= ~NLP_DROPPED; clear_bit(NLP_DROPPED, &ndlp->nlp_flag);
lpfc_nlp_get(ndlp); lpfc_nlp_get(ndlp);
} }
@ -4875,7 +4855,7 @@ lpfc_nlp_set_state(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
state != NLP_STE_NPR_NODE) state != NLP_STE_NPR_NODE)
lpfc_cancel_retry_delay_tmo(vport, ndlp); lpfc_cancel_retry_delay_tmo(vport, ndlp);
if (old_state == NLP_STE_UNMAPPED_NODE) { if (old_state == NLP_STE_UNMAPPED_NODE) {
ndlp->nlp_flag &= ~NLP_TGT_NO_SCSIID; clear_bit(NLP_TGT_NO_SCSIID, &ndlp->nlp_flag);
ndlp->nlp_type &= ~NLP_FC_NODE; ndlp->nlp_type &= ~NLP_FC_NODE;
} }
@ -4972,14 +4952,8 @@ lpfc_drop_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
* reference from lpfc_nlp_init. If set, don't drop it again and * reference from lpfc_nlp_init. If set, don't drop it again and
* introduce an imbalance. * introduce an imbalance.
*/ */
spin_lock_irq(&ndlp->lock); if (!test_and_set_bit(NLP_DROPPED, &ndlp->nlp_flag))
if (!(ndlp->nlp_flag & NLP_DROPPED)) {
ndlp->nlp_flag |= NLP_DROPPED;
spin_unlock_irq(&ndlp->lock);
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
return;
}
spin_unlock_irq(&ndlp->lock);
} }
/* /*
@ -5094,9 +5068,9 @@ lpfc_check_sli_ndlp(struct lpfc_hba *phba,
} else if (pring->ringno == LPFC_FCP_RING) { } else if (pring->ringno == LPFC_FCP_RING) {
/* Skip match check if waiting to relogin to FCP target */ /* Skip match check if waiting to relogin to FCP target */
if ((ndlp->nlp_type & NLP_FCP_TARGET) && if ((ndlp->nlp_type & NLP_FCP_TARGET) &&
(ndlp->nlp_flag & NLP_DELAY_TMO)) { test_bit(NLP_DELAY_TMO, &ndlp->nlp_flag))
return 0; return 0;
}
if (ulp_context == ndlp->nlp_rpi) if (ulp_context == ndlp->nlp_rpi)
return 1; return 1;
} }
@ -5166,7 +5140,7 @@ lpfc_no_rpi(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
* Everything that matches on txcmplq will be returned * Everything that matches on txcmplq will be returned
* by firmware with a no rpi error. * by firmware with a no rpi error.
*/ */
if (ndlp->nlp_flag & NLP_RPI_REGISTERED) { if (test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag)) {
if (phba->sli_rev != LPFC_SLI_REV4) if (phba->sli_rev != LPFC_SLI_REV4)
lpfc_sli3_dequeue_nport_iocbs(phba, ndlp, &completions); lpfc_sli3_dequeue_nport_iocbs(phba, ndlp, &completions);
else else
@ -5200,21 +5174,19 @@ lpfc_nlp_logo_unreg(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
lpfc_issue_els_logo(vport, ndlp, 0); lpfc_issue_els_logo(vport, ndlp, 0);
/* Check to see if there are any deferred events to process */ /* Check to see if there are any deferred events to process */
if ((ndlp->nlp_flag & NLP_UNREG_INP) && if (test_bit(NLP_UNREG_INP, &ndlp->nlp_flag) &&
(ndlp->nlp_defer_did != NLP_EVT_NOTHING_PENDING)) { ndlp->nlp_defer_did != NLP_EVT_NOTHING_PENDING) {
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
"1434 UNREG cmpl deferred logo x%x " "1434 UNREG cmpl deferred logo x%x "
"on NPort x%x Data: x%x x%px\n", "on NPort x%x Data: x%x x%px\n",
ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_rpi, ndlp->nlp_DID,
ndlp->nlp_defer_did, ndlp); ndlp->nlp_defer_did, ndlp);
ndlp->nlp_flag &= ~NLP_UNREG_INP; clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag);
ndlp->nlp_defer_did = NLP_EVT_NOTHING_PENDING; ndlp->nlp_defer_did = NLP_EVT_NOTHING_PENDING;
lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0); lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
} else { } else {
spin_lock_irq(&ndlp->lock); clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_UNREG_INP;
spin_unlock_irq(&ndlp->lock);
} }
/* The node has an outstanding reference for the unreg. Now /* The node has an outstanding reference for the unreg. Now
@ -5241,9 +5213,8 @@ lpfc_set_unreg_login_mbx_cmpl(struct lpfc_hba *phba, struct lpfc_vport *vport,
if (!mbox->ctx_ndlp) if (!mbox->ctx_ndlp)
return; return;
if (ndlp->nlp_flag & NLP_ISSUE_LOGO) { if (test_bit(NLP_ISSUE_LOGO, &ndlp->nlp_flag)) {
mbox->mbox_cmpl = lpfc_nlp_logo_unreg; mbox->mbox_cmpl = lpfc_nlp_logo_unreg;
} else if (phba->sli_rev == LPFC_SLI_REV4 && } else if (phba->sli_rev == LPFC_SLI_REV4 &&
!test_bit(FC_UNLOADING, &vport->load_flag) && !test_bit(FC_UNLOADING, &vport->load_flag) &&
(bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >= (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >=
@ -5272,13 +5243,13 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
int rc, acc_plogi = 1; int rc, acc_plogi = 1;
uint16_t rpi; uint16_t rpi;
if (ndlp->nlp_flag & NLP_RPI_REGISTERED || if (test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag) ||
ndlp->nlp_flag & NLP_REG_LOGIN_SEND) { test_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag)) {
if (ndlp->nlp_flag & NLP_REG_LOGIN_SEND) if (test_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag))
lpfc_printf_vlog(vport, KERN_INFO, lpfc_printf_vlog(vport, KERN_INFO,
LOG_NODE | LOG_DISCOVERY, LOG_NODE | LOG_DISCOVERY,
"3366 RPI x%x needs to be " "3366 RPI x%x needs to be "
"unregistered nlp_flag x%x " "unregistered nlp_flag x%lx "
"did x%x\n", "did x%x\n",
ndlp->nlp_rpi, ndlp->nlp_flag, ndlp->nlp_rpi, ndlp->nlp_flag,
ndlp->nlp_DID); ndlp->nlp_DID);
@ -5286,11 +5257,11 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
/* If there is already an UNREG in progress for this ndlp, /* If there is already an UNREG in progress for this ndlp,
* no need to queue up another one. * no need to queue up another one.
*/ */
if (ndlp->nlp_flag & NLP_UNREG_INP) { if (test_bit(NLP_UNREG_INP, &ndlp->nlp_flag)) {
lpfc_printf_vlog(vport, KERN_INFO, lpfc_printf_vlog(vport, KERN_INFO,
LOG_NODE | LOG_DISCOVERY, LOG_NODE | LOG_DISCOVERY,
"1436 unreg_rpi SKIP UNREG x%x on " "1436 unreg_rpi SKIP UNREG x%x on "
"NPort x%x deferred x%x flg x%x " "NPort x%x deferred x%x flg x%lx "
"Data: x%px\n", "Data: x%px\n",
ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_rpi, ndlp->nlp_DID,
ndlp->nlp_defer_did, ndlp->nlp_defer_did,
@ -5318,19 +5289,19 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
acc_plogi = 0; acc_plogi = 0;
if (!test_bit(FC_OFFLINE_MODE, &vport->fc_flag)) if (!test_bit(FC_OFFLINE_MODE, &vport->fc_flag))
ndlp->nlp_flag |= NLP_UNREG_INP; set_bit(NLP_UNREG_INP, &ndlp->nlp_flag);
lpfc_printf_vlog(vport, KERN_INFO, lpfc_printf_vlog(vport, KERN_INFO,
LOG_NODE | LOG_DISCOVERY, LOG_NODE | LOG_DISCOVERY,
"1433 unreg_rpi UNREG x%x on " "1433 unreg_rpi UNREG x%x on "
"NPort x%x deferred flg x%x " "NPort x%x deferred flg x%lx "
"Data:x%px\n", "Data:x%px\n",
ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_rpi, ndlp->nlp_DID,
ndlp->nlp_flag, ndlp); ndlp->nlp_flag, ndlp);
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT);
if (rc == MBX_NOT_FINISHED) { if (rc == MBX_NOT_FINISHED) {
ndlp->nlp_flag &= ~NLP_UNREG_INP; clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag);
mempool_free(mbox, phba->mbox_mem_pool); mempool_free(mbox, phba->mbox_mem_pool);
acc_plogi = 1; acc_plogi = 1;
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
@ -5340,7 +5311,7 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
LOG_NODE | LOG_DISCOVERY, LOG_NODE | LOG_DISCOVERY,
"1444 Failed to allocate mempool " "1444 Failed to allocate mempool "
"unreg_rpi UNREG x%x, " "unreg_rpi UNREG x%x, "
"DID x%x, flag x%x, " "DID x%x, flag x%lx, "
"ndlp x%px\n", "ndlp x%px\n",
ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_rpi, ndlp->nlp_DID,
ndlp->nlp_flag, ndlp); ndlp->nlp_flag, ndlp);
@ -5350,7 +5321,7 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
* not unloading. * not unloading.
*/ */
if (!test_bit(FC_UNLOADING, &vport->load_flag)) { if (!test_bit(FC_UNLOADING, &vport->load_flag)) {
ndlp->nlp_flag &= ~NLP_UNREG_INP; clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag);
lpfc_issue_els_logo(vport, ndlp, 0); lpfc_issue_els_logo(vport, ndlp, 0);
ndlp->nlp_prev_state = ndlp->nlp_state; ndlp->nlp_prev_state = ndlp->nlp_state;
lpfc_nlp_set_state(vport, ndlp, lpfc_nlp_set_state(vport, ndlp,
@ -5363,13 +5334,13 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
out: out:
if (phba->sli_rev != LPFC_SLI_REV4) if (phba->sli_rev != LPFC_SLI_REV4)
ndlp->nlp_rpi = 0; ndlp->nlp_rpi = 0;
ndlp->nlp_flag &= ~NLP_RPI_REGISTERED; clear_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_NPR_ADISC; clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag);
if (acc_plogi) if (acc_plogi)
ndlp->nlp_flag &= ~NLP_LOGO_ACC; clear_bit(NLP_LOGO_ACC, &ndlp->nlp_flag);
return 1; return 1;
} }
ndlp->nlp_flag &= ~NLP_LOGO_ACC; clear_bit(NLP_LOGO_ACC, &ndlp->nlp_flag);
return 0; return 0;
} }
@ -5397,7 +5368,7 @@ lpfc_unreg_hba_rpis(struct lpfc_hba *phba)
for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) { for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
spin_lock_irqsave(&vports[i]->fc_nodes_list_lock, iflags); spin_lock_irqsave(&vports[i]->fc_nodes_list_lock, iflags);
list_for_each_entry(ndlp, &vports[i]->fc_nodes, nlp_listp) { list_for_each_entry(ndlp, &vports[i]->fc_nodes, nlp_listp) {
if (ndlp->nlp_flag & NLP_RPI_REGISTERED) { if (test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag)) {
/* The mempool_alloc might sleep */ /* The mempool_alloc might sleep */
spin_unlock_irqrestore(&vports[i]->fc_nodes_list_lock, spin_unlock_irqrestore(&vports[i]->fc_nodes_list_lock,
iflags); iflags);
@ -5485,7 +5456,7 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
/* Cleanup node for NPort <nlp_DID> */ /* Cleanup node for NPort <nlp_DID> */
lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
"0900 Cleanup node for NPort x%x " "0900 Cleanup node for NPort x%x "
"Data: x%x x%x x%x\n", "Data: x%lx x%x x%x\n",
ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_DID, ndlp->nlp_flag,
ndlp->nlp_state, ndlp->nlp_rpi); ndlp->nlp_state, ndlp->nlp_rpi);
lpfc_dequeue_node(vport, ndlp); lpfc_dequeue_node(vport, ndlp);
@ -5530,9 +5501,7 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
lpfc_els_abort(phba, ndlp); lpfc_els_abort(phba, ndlp);
spin_lock_irq(&ndlp->lock); clear_bit(NLP_DELAY_TMO, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_DELAY_TMO;
spin_unlock_irq(&ndlp->lock);
ndlp->nlp_last_elscmd = 0; ndlp->nlp_last_elscmd = 0;
del_timer_sync(&ndlp->nlp_delayfunc); del_timer_sync(&ndlp->nlp_delayfunc);
@ -5614,7 +5583,7 @@ __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did)
); );
lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE_VERBOSE, lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE_VERBOSE,
"0929 FIND node DID " "0929 FIND node DID "
"Data: x%px x%x x%x x%x x%x x%px\n", "Data: x%px x%x x%lx x%x x%x x%px\n",
ndlp, ndlp->nlp_DID, ndlp, ndlp->nlp_DID,
ndlp->nlp_flag, data1, ndlp->nlp_rpi, ndlp->nlp_flag, data1, ndlp->nlp_rpi,
ndlp->active_rrqs_xri_bitmap); ndlp->active_rrqs_xri_bitmap);
@ -5661,7 +5630,7 @@ lpfc_findnode_mapped(struct lpfc_vport *vport)
iflags); iflags);
lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE_VERBOSE, lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE_VERBOSE,
"2025 FIND node DID MAPPED " "2025 FIND node DID MAPPED "
"Data: x%px x%x x%x x%x x%px\n", "Data: x%px x%x x%lx x%x x%px\n",
ndlp, ndlp->nlp_DID, ndlp, ndlp->nlp_DID,
ndlp->nlp_flag, data1, ndlp->nlp_flag, data1,
ndlp->active_rrqs_xri_bitmap); ndlp->active_rrqs_xri_bitmap);
@ -5695,13 +5664,11 @@ lpfc_setup_disc_node(struct lpfc_vport *vport, uint32_t did)
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
"6453 Setup New Node 2B_DISC x%x " "6453 Setup New Node 2B_DISC x%x "
"Data:x%x x%x x%lx\n", "Data:x%lx x%x x%lx\n",
ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_DID, ndlp->nlp_flag,
ndlp->nlp_state, vport->fc_flag); ndlp->nlp_state, vport->fc_flag);
spin_lock_irq(&ndlp->lock); set_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_NPR_2B_DISC;
spin_unlock_irq(&ndlp->lock);
return ndlp; return ndlp;
} }
@ -5720,7 +5687,7 @@ lpfc_setup_disc_node(struct lpfc_vport *vport, uint32_t did)
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
"6455 Setup RSCN Node 2B_DISC x%x " "6455 Setup RSCN Node 2B_DISC x%x "
"Data:x%x x%x x%lx\n", "Data:x%lx x%x x%lx\n",
ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_DID, ndlp->nlp_flag,
ndlp->nlp_state, vport->fc_flag); ndlp->nlp_state, vport->fc_flag);
@ -5738,13 +5705,11 @@ lpfc_setup_disc_node(struct lpfc_vport *vport, uint32_t did)
NLP_EVT_DEVICE_RECOVERY); NLP_EVT_DEVICE_RECOVERY);
} }
spin_lock_irq(&ndlp->lock); set_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_NPR_2B_DISC;
spin_unlock_irq(&ndlp->lock);
} else { } else {
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
"6456 Skip Setup RSCN Node x%x " "6456 Skip Setup RSCN Node x%x "
"Data:x%x x%x x%lx\n", "Data:x%lx x%x x%lx\n",
ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_DID, ndlp->nlp_flag,
ndlp->nlp_state, vport->fc_flag); ndlp->nlp_state, vport->fc_flag);
ndlp = NULL; ndlp = NULL;
@ -5752,7 +5717,7 @@ lpfc_setup_disc_node(struct lpfc_vport *vport, uint32_t did)
} else { } else {
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
"6457 Setup Active Node 2B_DISC x%x " "6457 Setup Active Node 2B_DISC x%x "
"Data:x%x x%x x%lx\n", "Data:x%lx x%x x%lx\n",
ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_DID, ndlp->nlp_flag,
ndlp->nlp_state, vport->fc_flag); ndlp->nlp_state, vport->fc_flag);
@ -5763,7 +5728,7 @@ lpfc_setup_disc_node(struct lpfc_vport *vport, uint32_t did)
if (ndlp->nlp_state == NLP_STE_ADISC_ISSUE || if (ndlp->nlp_state == NLP_STE_ADISC_ISSUE ||
ndlp->nlp_state == NLP_STE_PLOGI_ISSUE || ndlp->nlp_state == NLP_STE_PLOGI_ISSUE ||
(!vport->phba->nvmet_support && (!vport->phba->nvmet_support &&
ndlp->nlp_flag & NLP_RCV_PLOGI)) test_bit(NLP_RCV_PLOGI, &ndlp->nlp_flag)))
return NULL; return NULL;
if (vport->phba->nvmet_support) if (vport->phba->nvmet_support)
@ -5773,10 +5738,7 @@ lpfc_setup_disc_node(struct lpfc_vport *vport, uint32_t did)
* allows for rediscovery * allows for rediscovery
*/ */
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
set_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
spin_lock_irq(&ndlp->lock);
ndlp->nlp_flag |= NLP_NPR_2B_DISC;
spin_unlock_irq(&ndlp->lock);
} }
return ndlp; return ndlp;
} }
@ -6147,7 +6109,7 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
/* Clean up the ndlp on Fabric connections */ /* Clean up the ndlp on Fabric connections */
lpfc_drop_node(vport, ndlp); lpfc_drop_node(vport, ndlp);
} else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { } else if (!test_bit(NLP_NPR_ADISC, &ndlp->nlp_flag)) {
/* Fail outstanding IO now since device /* Fail outstanding IO now since device
* is marked for PLOGI. * is marked for PLOGI.
*/ */
@ -6360,11 +6322,11 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
if (phba->sli_rev < LPFC_SLI_REV4) if (phba->sli_rev < LPFC_SLI_REV4)
ndlp->nlp_rpi = mb->un.varWords[0]; ndlp->nlp_rpi = mb->un.varWords[0];
ndlp->nlp_flag |= NLP_RPI_REGISTERED; set_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag);
ndlp->nlp_type |= NLP_FABRIC; ndlp->nlp_type |= NLP_FABRIC;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE | LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE | LOG_DISCOVERY,
"0004 rpi:%x DID:%x flg:%x %d x%px\n", "0004 rpi:%x DID:%x flg:%lx %d x%px\n",
ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag,
kref_read(&ndlp->kref), kref_read(&ndlp->kref),
ndlp); ndlp);
@ -6414,7 +6376,7 @@ __lpfc_find_node(struct lpfc_vport *vport, node_filter filter, void *param)
if (filter(ndlp, param)) { if (filter(ndlp, param)) {
lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE_VERBOSE, lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE_VERBOSE,
"3185 FIND node filter %ps DID " "3185 FIND node filter %ps DID "
"ndlp x%px did x%x flg x%x st x%x " "ndlp x%px did x%x flg x%lx st x%x "
"xri x%x type x%x rpi x%x\n", "xri x%x type x%x rpi x%x\n",
filter, ndlp, ndlp->nlp_DID, filter, ndlp, ndlp->nlp_DID,
ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_flag, ndlp->nlp_state,
@ -6552,7 +6514,7 @@ lpfc_nlp_init(struct lpfc_vport *vport, uint32_t did)
lpfc_printf_vlog(vport, KERN_INFO, lpfc_printf_vlog(vport, KERN_INFO,
LOG_ELS | LOG_NODE | LOG_DISCOVERY, LOG_ELS | LOG_NODE | LOG_DISCOVERY,
"0007 Init New ndlp x%px, rpi:x%x DID:x%x " "0007 Init New ndlp x%px, rpi:x%x DID:x%x "
"flg:x%x refcnt:%d\n", "flg:x%lx refcnt:%d\n",
ndlp, ndlp->nlp_rpi, ndlp->nlp_DID, ndlp, ndlp->nlp_rpi, ndlp->nlp_DID,
ndlp->nlp_flag, kref_read(&ndlp->kref)); ndlp->nlp_flag, kref_read(&ndlp->kref));
@ -6584,7 +6546,7 @@ lpfc_nlp_release(struct kref *kref)
struct lpfc_vport *vport = ndlp->vport; struct lpfc_vport *vport = ndlp->vport;
lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE,
"node release: did:x%x flg:x%x type:x%x", "node release: did:x%x flg:x%lx type:x%x",
ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type); ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type);
lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE, lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
@ -6630,7 +6592,7 @@ lpfc_nlp_get(struct lpfc_nodelist *ndlp)
if (ndlp) { if (ndlp) {
lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE,
"node get: did:x%x flg:x%x refcnt:x%x", "node get: did:x%x flg:x%lx refcnt:x%x",
ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_DID, ndlp->nlp_flag,
kref_read(&ndlp->kref)); kref_read(&ndlp->kref));
@ -6662,7 +6624,7 @@ lpfc_nlp_put(struct lpfc_nodelist *ndlp)
{ {
if (ndlp) { if (ndlp) {
lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE,
"node put: did:x%x flg:x%x refcnt:x%x", "node put: did:x%x flg:x%lx refcnt:x%x",
ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_DID, ndlp->nlp_flag,
kref_read(&ndlp->kref)); kref_read(&ndlp->kref));
} else { } else {
@ -6715,11 +6677,12 @@ lpfc_fcf_inuse(struct lpfc_hba *phba)
spin_unlock_irqrestore(&vports[i]->fc_nodes_list_lock, spin_unlock_irqrestore(&vports[i]->fc_nodes_list_lock,
iflags); iflags);
goto out; goto out;
} else if (ndlp->nlp_flag & NLP_RPI_REGISTERED) { } else if (test_bit(NLP_RPI_REGISTERED,
&ndlp->nlp_flag)) {
ret = 1; ret = 1;
lpfc_printf_log(phba, KERN_INFO, lpfc_printf_log(phba, KERN_INFO,
LOG_NODE | LOG_DISCOVERY, LOG_NODE | LOG_DISCOVERY,
"2624 RPI %x DID %x flag %x " "2624 RPI %x DID %x flag %lx "
"still logged in\n", "still logged in\n",
ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_rpi, ndlp->nlp_DID,
ndlp->nlp_flag); ndlp->nlp_flag);

View File

@ -3093,7 +3093,8 @@ lpfc_cleanup(struct lpfc_vport *vport)
lpfc_printf_vlog(ndlp->vport, KERN_ERR, lpfc_printf_vlog(ndlp->vport, KERN_ERR,
LOG_DISCOVERY, LOG_DISCOVERY,
"0282 did:x%x ndlp:x%px " "0282 did:x%x ndlp:x%px "
"refcnt:%d xflags x%x nflag x%x\n", "refcnt:%d xflags x%x "
"nflag x%lx\n",
ndlp->nlp_DID, (void *)ndlp, ndlp->nlp_DID, (void *)ndlp,
kref_read(&ndlp->kref), kref_read(&ndlp->kref),
ndlp->fc4_xpt_flags, ndlp->fc4_xpt_flags,
@ -3414,7 +3415,7 @@ lpfc_sli4_node_rpi_restore(struct lpfc_hba *phba)
LOG_NODE | LOG_DISCOVERY, LOG_NODE | LOG_DISCOVERY,
"0099 RPI alloc error for " "0099 RPI alloc error for "
"ndlp x%px DID:x%06x " "ndlp x%px DID:x%06x "
"flg:x%x\n", "flg:x%lx\n",
ndlp, ndlp->nlp_DID, ndlp, ndlp->nlp_DID,
ndlp->nlp_flag); ndlp->nlp_flag);
continue; continue;
@ -3423,7 +3424,7 @@ lpfc_sli4_node_rpi_restore(struct lpfc_hba *phba)
lpfc_printf_vlog(ndlp->vport, KERN_INFO, lpfc_printf_vlog(ndlp->vport, KERN_INFO,
LOG_NODE | LOG_DISCOVERY, LOG_NODE | LOG_DISCOVERY,
"0009 Assign RPI x%x to ndlp x%px " "0009 Assign RPI x%x to ndlp x%px "
"DID:x%06x flg:x%x\n", "DID:x%06x flg:x%lx\n",
ndlp->nlp_rpi, ndlp, ndlp->nlp_DID, ndlp->nlp_rpi, ndlp, ndlp->nlp_DID,
ndlp->nlp_flag); ndlp->nlp_flag);
} }
@ -3827,15 +3828,12 @@ lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action)
&vports[i]->fc_nodes, &vports[i]->fc_nodes,
nlp_listp) { nlp_listp) {
spin_lock_irq(&ndlp->lock); clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_NPR_ADISC;
spin_unlock_irq(&ndlp->lock);
if (offline || hba_pci_err) { if (offline || hba_pci_err) {
spin_lock_irq(&ndlp->lock); clear_bit(NLP_UNREG_INP,
ndlp->nlp_flag &= ~(NLP_UNREG_INP | &ndlp->nlp_flag);
NLP_RPI_REGISTERED); clear_bit(NLP_RPI_REGISTERED,
spin_unlock_irq(&ndlp->lock); &ndlp->nlp_flag);
} }
if (ndlp->nlp_type & NLP_FABRIC) { if (ndlp->nlp_type & NLP_FABRIC) {
@ -6912,9 +6910,7 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
*/ */
mod_timer(&ndlp->nlp_delayfunc, mod_timer(&ndlp->nlp_delayfunc,
jiffies + msecs_to_jiffies(1000)); jiffies + msecs_to_jiffies(1000));
spin_lock_irq(&ndlp->lock); set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_DELAY_TMO;
spin_unlock_irq(&ndlp->lock);
ndlp->nlp_last_elscmd = ELS_CMD_FDISC; ndlp->nlp_last_elscmd = ELS_CMD_FDISC;
vport->port_state = LPFC_FDISC; vport->port_state = LPFC_FDISC;
} else { } else {

View File

@ -65,7 +65,7 @@ lpfc_check_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
struct lpfc_name *nn, struct lpfc_name *pn) struct lpfc_name *nn, struct lpfc_name *pn)
{ {
/* First, we MUST have a RPI registered */ /* First, we MUST have a RPI registered */
if (!(ndlp->nlp_flag & NLP_RPI_REGISTERED)) if (!test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag))
return 0; return 0;
/* Compare the ADISC rsp WWNN / WWPN matches our internal node /* Compare the ADISC rsp WWNN / WWPN matches our internal node
@ -239,7 +239,7 @@ lpfc_els_abort(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
/* Abort outstanding I/O on NPort <nlp_DID> */ /* Abort outstanding I/O on NPort <nlp_DID> */
lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_DISCOVERY, lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_DISCOVERY,
"2819 Abort outstanding I/O on NPort x%x " "2819 Abort outstanding I/O on NPort x%x "
"Data: x%x x%x x%x\n", "Data: x%lx x%x x%x\n",
ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
ndlp->nlp_rpi); ndlp->nlp_rpi);
/* Clean up all fabric IOs first.*/ /* Clean up all fabric IOs first.*/
@ -340,7 +340,7 @@ lpfc_defer_plogi_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *login_mbox)
/* Now process the REG_RPI cmpl */ /* Now process the REG_RPI cmpl */
lpfc_mbx_cmpl_reg_login(phba, login_mbox); lpfc_mbx_cmpl_reg_login(phba, login_mbox);
ndlp->nlp_flag &= ~NLP_ACC_REGLOGIN; clear_bit(NLP_ACC_REGLOGIN, &ndlp->nlp_flag);
kfree(save_iocb); kfree(save_iocb);
} }
@ -404,7 +404,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
/* PLOGI chkparm OK */ /* PLOGI chkparm OK */
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
"0114 PLOGI chkparm OK Data: x%x x%x x%x " "0114 PLOGI chkparm OK Data: x%x x%x x%lx "
"x%x x%x x%lx\n", "x%x x%x x%lx\n",
ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag, ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag,
ndlp->nlp_rpi, vport->port_state, ndlp->nlp_rpi, vport->port_state,
@ -429,7 +429,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
/* if already logged in, do implicit logout */ /* if already logged in, do implicit logout */
switch (ndlp->nlp_state) { switch (ndlp->nlp_state) {
case NLP_STE_NPR_NODE: case NLP_STE_NPR_NODE:
if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) if (!test_bit(NLP_NPR_ADISC, &ndlp->nlp_flag))
break; break;
fallthrough; fallthrough;
case NLP_STE_REG_LOGIN_ISSUE: case NLP_STE_REG_LOGIN_ISSUE:
@ -449,7 +449,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR); ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR);
ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
ndlp->nlp_nvme_info &= ~NLP_NVME_NSLER; ndlp->nlp_nvme_info &= ~NLP_NVME_NSLER;
ndlp->nlp_flag &= ~NLP_FIRSTBURST; clear_bit(NLP_FIRSTBURST, &ndlp->nlp_flag);
lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb,
ndlp, NULL); ndlp, NULL);
@ -480,7 +480,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR); ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR);
ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
ndlp->nlp_nvme_info &= ~NLP_NVME_NSLER; ndlp->nlp_nvme_info &= ~NLP_NVME_NSLER;
ndlp->nlp_flag &= ~NLP_FIRSTBURST; clear_bit(NLP_FIRSTBURST, &ndlp->nlp_flag);
login_mbox = NULL; login_mbox = NULL;
link_mbox = NULL; link_mbox = NULL;
@ -552,13 +552,13 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
lpfc_can_disctmo(vport); lpfc_can_disctmo(vport);
} }
ndlp->nlp_flag &= ~NLP_SUPPRESS_RSP; clear_bit(NLP_SUPPRESS_RSP, &ndlp->nlp_flag);
if ((phba->sli.sli_flag & LPFC_SLI_SUPPRESS_RSP) && if ((phba->sli.sli_flag & LPFC_SLI_SUPPRESS_RSP) &&
sp->cmn.valid_vendor_ver_level) { sp->cmn.valid_vendor_ver_level) {
vid = be32_to_cpu(sp->un.vv.vid); vid = be32_to_cpu(sp->un.vv.vid);
flag = be32_to_cpu(sp->un.vv.flags); flag = be32_to_cpu(sp->un.vv.flags);
if ((vid == LPFC_VV_EMLX_ID) && (flag & LPFC_VV_SUPPRESS_RSP)) if ((vid == LPFC_VV_EMLX_ID) && (flag & LPFC_VV_SUPPRESS_RSP))
ndlp->nlp_flag |= NLP_SUPPRESS_RSP; set_bit(NLP_SUPPRESS_RSP, &ndlp->nlp_flag);
} }
login_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); login_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
@ -627,10 +627,9 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
* this ELS request. The only way to do this is * this ELS request. The only way to do this is
* to register, then unregister the RPI. * to register, then unregister the RPI.
*/ */
spin_lock_irq(&ndlp->lock); set_bit(NLP_RM_DFLT_RPI, &ndlp->nlp_flag);
ndlp->nlp_flag |= (NLP_RM_DFLT_RPI | NLP_ACC_REGLOGIN | set_bit(NLP_ACC_REGLOGIN, &ndlp->nlp_flag);
NLP_RCV_PLOGI); set_bit(NLP_RCV_PLOGI, &ndlp->nlp_flag);
spin_unlock_irq(&ndlp->lock);
} }
stat.un.b.lsRjtRsnCode = LSRJT_INVALID_CMD; stat.un.b.lsRjtRsnCode = LSRJT_INVALID_CMD;
@ -665,9 +664,8 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
login_mbox->ctx_u.save_iocb = save_iocb; /* For PLOGI ACC */ login_mbox->ctx_u.save_iocb = save_iocb; /* For PLOGI ACC */
spin_lock_irq(&ndlp->lock); set_bit(NLP_ACC_REGLOGIN, &ndlp->nlp_flag);
ndlp->nlp_flag |= (NLP_ACC_REGLOGIN | NLP_RCV_PLOGI); set_bit(NLP_RCV_PLOGI, &ndlp->nlp_flag);
spin_unlock_irq(&ndlp->lock);
/* Start the ball rolling by issuing REG_LOGIN here */ /* Start the ball rolling by issuing REG_LOGIN here */
rc = lpfc_sli_issue_mbox(phba, login_mbox, MBX_NOWAIT); rc = lpfc_sli_issue_mbox(phba, login_mbox, MBX_NOWAIT);
@ -797,7 +795,7 @@ out:
*/ */
if (ndlp->nlp_type & (NLP_FCP_TARGET | NLP_NVME_TARGET)) { if (ndlp->nlp_type & (NLP_FCP_TARGET | NLP_NVME_TARGET)) {
if ((ndlp->nlp_state != NLP_STE_MAPPED_NODE) && if ((ndlp->nlp_state != NLP_STE_MAPPED_NODE) &&
!(ndlp->nlp_flag & NLP_NPR_ADISC)) !test_bit(NLP_NPR_ADISC, &ndlp->nlp_flag))
lpfc_nlp_set_state(vport, ndlp, lpfc_nlp_set_state(vport, ndlp,
NLP_STE_MAPPED_NODE); NLP_STE_MAPPED_NODE);
} }
@ -814,9 +812,7 @@ out:
/* 1 sec timeout */ /* 1 sec timeout */
mod_timer(&ndlp->nlp_delayfunc, jiffies + msecs_to_jiffies(1000)); mod_timer(&ndlp->nlp_delayfunc, jiffies + msecs_to_jiffies(1000));
spin_lock_irq(&ndlp->lock); set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_DELAY_TMO;
spin_unlock_irq(&ndlp->lock);
ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
ndlp->nlp_prev_state = ndlp->nlp_state; ndlp->nlp_prev_state = ndlp->nlp_state;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
@ -835,9 +831,7 @@ lpfc_rcv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
/* Only call LOGO ACC for first LOGO, this avoids sending unnecessary /* Only call LOGO ACC for first LOGO, this avoids sending unnecessary
* PLOGIs during LOGO storms from a device. * PLOGIs during LOGO storms from a device.
*/ */
spin_lock_irq(&ndlp->lock); set_bit(NLP_LOGO_ACC, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_LOGO_ACC;
spin_unlock_irq(&ndlp->lock);
if (els_cmd == ELS_CMD_PRLO) if (els_cmd == ELS_CMD_PRLO)
lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL); lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL);
else else
@ -890,9 +884,7 @@ lpfc_rcv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
*/ */
mod_timer(&ndlp->nlp_delayfunc, mod_timer(&ndlp->nlp_delayfunc,
jiffies + msecs_to_jiffies(1000)); jiffies + msecs_to_jiffies(1000));
spin_lock_irq(&ndlp->lock); set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_DELAY_TMO;
spin_unlock_irq(&ndlp->lock);
ndlp->nlp_last_elscmd = ELS_CMD_FDISC; ndlp->nlp_last_elscmd = ELS_CMD_FDISC;
vport->port_state = LPFC_FDISC; vport->port_state = LPFC_FDISC;
} else { } else {
@ -915,14 +907,12 @@ lpfc_rcv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
ndlp->nlp_state <= NLP_STE_PRLI_ISSUE)) { ndlp->nlp_state <= NLP_STE_PRLI_ISSUE)) {
mod_timer(&ndlp->nlp_delayfunc, mod_timer(&ndlp->nlp_delayfunc,
jiffies + msecs_to_jiffies(1000 * 1)); jiffies + msecs_to_jiffies(1000 * 1));
spin_lock_irq(&ndlp->lock); set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_DELAY_TMO;
spin_unlock_irq(&ndlp->lock);
ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
lpfc_printf_vlog(vport, KERN_INFO, lpfc_printf_vlog(vport, KERN_INFO,
LOG_NODE | LOG_ELS | LOG_DISCOVERY, LOG_NODE | LOG_ELS | LOG_DISCOVERY,
"3204 Start nlpdelay on DID x%06x " "3204 Start nlpdelay on DID x%06x "
"nflag x%x lastels x%x ref cnt %u", "nflag x%lx lastels x%x ref cnt %u",
ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_DID, ndlp->nlp_flag,
ndlp->nlp_last_elscmd, ndlp->nlp_last_elscmd,
kref_read(&ndlp->kref)); kref_read(&ndlp->kref));
@ -935,9 +925,7 @@ out:
ndlp->nlp_prev_state = ndlp->nlp_state; ndlp->nlp_prev_state = ndlp->nlp_state;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
spin_lock_irq(&ndlp->lock); clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_NPR_ADISC;
spin_unlock_irq(&ndlp->lock);
/* The driver has to wait until the ACC completes before it continues /* The driver has to wait until the ACC completes before it continues
* processing the LOGO. The action will resume in * processing the LOGO. The action will resume in
* lpfc_cmpl_els_logo_acc routine. Since part of processing includes an * lpfc_cmpl_els_logo_acc routine. Since part of processing includes an
@ -978,7 +966,7 @@ lpfc_rcv_prli_support_check(struct lpfc_vport *vport,
out: out:
lpfc_printf_vlog(vport, KERN_WARNING, LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_WARNING, LOG_DISCOVERY,
"6115 Rcv PRLI (%x) check failed: ndlp rpi %d " "6115 Rcv PRLI (%x) check failed: ndlp rpi %d "
"state x%x flags x%x port_type: x%x " "state x%x flags x%lx port_type: x%x "
"npr->initfcn: x%x npr->tgtfcn: x%x\n", "npr->initfcn: x%x npr->tgtfcn: x%x\n",
cmd, ndlp->nlp_rpi, ndlp->nlp_state, cmd, ndlp->nlp_rpi, ndlp->nlp_state,
ndlp->nlp_flag, vport->port_type, ndlp->nlp_flag, vport->port_type,
@ -1020,7 +1008,7 @@ lpfc_rcv_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
if (npr->prliType == PRLI_NVME_TYPE) if (npr->prliType == PRLI_NVME_TYPE)
ndlp->nlp_type |= NLP_NVME_TARGET; ndlp->nlp_type |= NLP_NVME_TARGET;
if (npr->writeXferRdyDis) if (npr->writeXferRdyDis)
ndlp->nlp_flag |= NLP_FIRSTBURST; set_bit(NLP_FIRSTBURST, &ndlp->nlp_flag);
} }
if (npr->Retry && ndlp->nlp_type & if (npr->Retry && ndlp->nlp_type &
(NLP_FCP_INITIATOR | NLP_FCP_TARGET)) (NLP_FCP_INITIATOR | NLP_FCP_TARGET))
@ -1057,7 +1045,7 @@ lpfc_rcv_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
roles |= FC_RPORT_ROLE_FCP_TARGET; roles |= FC_RPORT_ROLE_FCP_TARGET;
lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT, lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT,
"rport rolechg: role:x%x did:x%x flg:x%x", "rport rolechg: role:x%x did:x%x flg:x%lx",
roles, ndlp->nlp_DID, ndlp->nlp_flag); roles, ndlp->nlp_DID, ndlp->nlp_flag);
if (vport->cfg_enable_fc4_type != LPFC_ENABLE_NVME) if (vport->cfg_enable_fc4_type != LPFC_ENABLE_NVME)
@ -1068,10 +1056,8 @@ lpfc_rcv_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
static uint32_t static uint32_t
lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
{ {
if (!(ndlp->nlp_flag & NLP_RPI_REGISTERED)) { if (!test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag)) {
spin_lock_irq(&ndlp->lock); clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_NPR_ADISC;
spin_unlock_irq(&ndlp->lock);
return 0; return 0;
} }
@ -1081,16 +1067,12 @@ lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
(test_bit(FC_RSCN_MODE, &vport->fc_flag) || (test_bit(FC_RSCN_MODE, &vport->fc_flag) ||
((ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) && ((ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) &&
(ndlp->nlp_type & NLP_FCP_TARGET)))) { (ndlp->nlp_type & NLP_FCP_TARGET)))) {
spin_lock_irq(&ndlp->lock); set_bit(NLP_NPR_ADISC, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_NPR_ADISC;
spin_unlock_irq(&ndlp->lock);
return 1; return 1;
} }
} }
spin_lock_irq(&ndlp->lock); clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_NPR_ADISC;
spin_unlock_irq(&ndlp->lock);
lpfc_unreg_rpi(vport, ndlp); lpfc_unreg_rpi(vport, ndlp);
return 0; return 0;
} }
@ -1115,10 +1097,10 @@ lpfc_release_rpi(struct lpfc_hba *phba, struct lpfc_vport *vport,
/* If there is already an UNREG in progress for this ndlp, /* If there is already an UNREG in progress for this ndlp,
* no need to queue up another one. * no need to queue up another one.
*/ */
if (ndlp->nlp_flag & NLP_UNREG_INP) { if (test_bit(NLP_UNREG_INP, &ndlp->nlp_flag)) {
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
"1435 release_rpi SKIP UNREG x%x on " "1435 release_rpi SKIP UNREG x%x on "
"NPort x%x deferred x%x flg x%x " "NPort x%x deferred x%x flg x%lx "
"Data: x%px\n", "Data: x%px\n",
ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_rpi, ndlp->nlp_DID,
ndlp->nlp_defer_did, ndlp->nlp_defer_did,
@ -1143,11 +1125,11 @@ lpfc_release_rpi(struct lpfc_hba *phba, struct lpfc_vport *vport,
if (((ndlp->nlp_DID & Fabric_DID_MASK) != Fabric_DID_MASK) && if (((ndlp->nlp_DID & Fabric_DID_MASK) != Fabric_DID_MASK) &&
(!test_bit(FC_OFFLINE_MODE, &vport->fc_flag))) (!test_bit(FC_OFFLINE_MODE, &vport->fc_flag)))
ndlp->nlp_flag |= NLP_UNREG_INP; set_bit(NLP_UNREG_INP, &ndlp->nlp_flag);
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
"1437 release_rpi UNREG x%x " "1437 release_rpi UNREG x%x "
"on NPort x%x flg x%x\n", "on NPort x%x flg x%lx\n",
ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag); ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag);
rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
@ -1175,7 +1157,7 @@ lpfc_disc_illegal(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
} }
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
"0271 Illegal State Transition: node x%x " "0271 Illegal State Transition: node x%x "
"event x%x, state x%x Data: x%x x%x\n", "event x%x, state x%x Data: x%x x%lx\n",
ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi, ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi,
ndlp->nlp_flag); ndlp->nlp_flag);
return ndlp->nlp_state; return ndlp->nlp_state;
@ -1190,13 +1172,12 @@ lpfc_cmpl_plogi_illegal(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
* working on the same NPortID, do nothing for this thread * working on the same NPortID, do nothing for this thread
* to stop it. * to stop it.
*/ */
if (!(ndlp->nlp_flag & NLP_RCV_PLOGI)) { if (!test_bit(NLP_RCV_PLOGI, &ndlp->nlp_flag))
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
"0272 Illegal State Transition: node x%x " "0272 Illegal State Transition: node x%x "
"event x%x, state x%x Data: x%x x%x\n", "event x%x, state x%x Data: x%x x%lx\n",
ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_DID, evt, ndlp->nlp_state,
ndlp->nlp_rpi, ndlp->nlp_flag); ndlp->nlp_rpi, ndlp->nlp_flag);
}
return ndlp->nlp_state; return ndlp->nlp_state;
} }
@ -1230,9 +1211,7 @@ lpfc_rcv_logo_unused_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
{ {
struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg;
spin_lock_irq(&ndlp->lock); set_bit(NLP_LOGO_ACC, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_LOGO_ACC;
spin_unlock_irq(&ndlp->lock);
lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
return ndlp->nlp_state; return ndlp->nlp_state;
@ -1290,11 +1269,9 @@ lpfc_rcv_plogi_plogi_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
NULL); NULL);
} else { } else {
if (lpfc_rcv_plogi(vport, ndlp, cmdiocb) && if (lpfc_rcv_plogi(vport, ndlp, cmdiocb) &&
(ndlp->nlp_flag & NLP_NPR_2B_DISC) && test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag) &&
(vport->num_disc_nodes)) { vport->num_disc_nodes) {
spin_lock_irq(&ndlp->lock); clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
spin_unlock_irq(&ndlp->lock);
/* Check if there are more PLOGIs to be sent */ /* Check if there are more PLOGIs to be sent */
lpfc_more_plogi(vport); lpfc_more_plogi(vport);
if (vport->num_disc_nodes == 0) { if (vport->num_disc_nodes == 0) {
@ -1356,9 +1333,7 @@ lpfc_rcv_els_plogi_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
/* Put ndlp in npr state set plogi timer for 1 sec */ /* Put ndlp in npr state set plogi timer for 1 sec */
mod_timer(&ndlp->nlp_delayfunc, jiffies + msecs_to_jiffies(1000 * 1)); mod_timer(&ndlp->nlp_delayfunc, jiffies + msecs_to_jiffies(1000 * 1));
spin_lock_irq(&ndlp->lock); set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_DELAY_TMO;
spin_unlock_irq(&ndlp->lock);
ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE; ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
@ -1389,7 +1364,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
ulp_status = get_job_ulpstatus(phba, rspiocb); ulp_status = get_job_ulpstatus(phba, rspiocb);
if (ndlp->nlp_flag & NLP_ACC_REGLOGIN) { if (test_bit(NLP_ACC_REGLOGIN, &ndlp->nlp_flag)) {
/* Recovery from PLOGI collision logic */ /* Recovery from PLOGI collision logic */
return ndlp->nlp_state; return ndlp->nlp_state;
} }
@ -1418,7 +1393,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
goto out; goto out;
/* PLOGI chkparm OK */ /* PLOGI chkparm OK */
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
"0121 PLOGI chkparm OK Data: x%x x%x x%x x%x\n", "0121 PLOGI chkparm OK Data: x%x x%x x%lx x%x\n",
ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_DID, ndlp->nlp_state,
ndlp->nlp_flag, ndlp->nlp_rpi); ndlp->nlp_flag, ndlp->nlp_rpi);
if (vport->cfg_fcp_class == 2 && (sp->cls2.classValid)) if (vport->cfg_fcp_class == 2 && (sp->cls2.classValid))
@ -1446,14 +1421,14 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
ed_tov = (phba->fc_edtov + 999999) / 1000000; ed_tov = (phba->fc_edtov + 999999) / 1000000;
} }
ndlp->nlp_flag &= ~NLP_SUPPRESS_RSP; clear_bit(NLP_SUPPRESS_RSP, &ndlp->nlp_flag);
if ((phba->sli.sli_flag & LPFC_SLI_SUPPRESS_RSP) && if ((phba->sli.sli_flag & LPFC_SLI_SUPPRESS_RSP) &&
sp->cmn.valid_vendor_ver_level) { sp->cmn.valid_vendor_ver_level) {
vid = be32_to_cpu(sp->un.vv.vid); vid = be32_to_cpu(sp->un.vv.vid);
flag = be32_to_cpu(sp->un.vv.flags); flag = be32_to_cpu(sp->un.vv.flags);
if ((vid == LPFC_VV_EMLX_ID) && if ((vid == LPFC_VV_EMLX_ID) &&
(flag & LPFC_VV_SUPPRESS_RSP)) (flag & LPFC_VV_SUPPRESS_RSP))
ndlp->nlp_flag |= NLP_SUPPRESS_RSP; set_bit(NLP_SUPPRESS_RSP, &ndlp->nlp_flag);
} }
/* /*
@ -1476,7 +1451,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
LOG_TRACE_EVENT, LOG_TRACE_EVENT,
"0133 PLOGI: no memory " "0133 PLOGI: no memory "
"for config_link " "for config_link "
"Data: x%x x%x x%x x%x\n", "Data: x%x x%x x%lx x%x\n",
ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_DID, ndlp->nlp_state,
ndlp->nlp_flag, ndlp->nlp_rpi); ndlp->nlp_flag, ndlp->nlp_rpi);
goto out; goto out;
@ -1500,7 +1475,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
if (!mbox) { if (!mbox) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
"0018 PLOGI: no memory for reg_login " "0018 PLOGI: no memory for reg_login "
"Data: x%x x%x x%x x%x\n", "Data: x%x x%x x%lx x%x\n",
ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_DID, ndlp->nlp_state,
ndlp->nlp_flag, ndlp->nlp_rpi); ndlp->nlp_flag, ndlp->nlp_rpi);
goto out; goto out;
@ -1520,7 +1495,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
mbox->mbox_cmpl = lpfc_mbx_cmpl_fdmi_reg_login; mbox->mbox_cmpl = lpfc_mbx_cmpl_fdmi_reg_login;
break; break;
default: default:
ndlp->nlp_flag |= NLP_REG_LOGIN_SEND; set_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag);
mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login;
} }
@ -1535,8 +1510,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
NLP_STE_REG_LOGIN_ISSUE); NLP_STE_REG_LOGIN_ISSUE);
return ndlp->nlp_state; return ndlp->nlp_state;
} }
if (ndlp->nlp_flag & NLP_REG_LOGIN_SEND) clear_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND;
/* decrement node reference count to the failed mbox /* decrement node reference count to the failed mbox
* command * command
*/ */
@ -1544,7 +1518,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
lpfc_mbox_rsrc_cleanup(phba, mbox, MBOX_THD_UNLOCKED); lpfc_mbox_rsrc_cleanup(phba, mbox, MBOX_THD_UNLOCKED);
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
"0134 PLOGI: cannot issue reg_login " "0134 PLOGI: cannot issue reg_login "
"Data: x%x x%x x%x x%x\n", "Data: x%x x%x x%lx x%x\n",
ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_DID, ndlp->nlp_state,
ndlp->nlp_flag, ndlp->nlp_rpi); ndlp->nlp_flag, ndlp->nlp_rpi);
} else { } else {
@ -1552,7 +1526,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
"0135 PLOGI: cannot format reg_login " "0135 PLOGI: cannot format reg_login "
"Data: x%x x%x x%x x%x\n", "Data: x%x x%x x%lx x%x\n",
ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_DID, ndlp->nlp_state,
ndlp->nlp_flag, ndlp->nlp_rpi); ndlp->nlp_flag, ndlp->nlp_rpi);
} }
@ -1605,18 +1579,15 @@ static uint32_t
lpfc_device_rm_plogi_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, lpfc_device_rm_plogi_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
void *arg, uint32_t evt) void *arg, uint32_t evt)
{ {
if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { if (test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) {
spin_lock_irq(&ndlp->lock); set_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_NODEV_REMOVE;
spin_unlock_irq(&ndlp->lock);
return ndlp->nlp_state; return ndlp->nlp_state;
} else {
/* software abort outstanding PLOGI */
lpfc_els_abort(vport->phba, ndlp);
lpfc_drop_node(vport, ndlp);
return NLP_STE_FREED_NODE;
} }
/* software abort outstanding PLOGI */
lpfc_els_abort(vport->phba, ndlp);
lpfc_drop_node(vport, ndlp);
return NLP_STE_FREED_NODE;
} }
static uint32_t static uint32_t
@ -1636,9 +1607,8 @@ lpfc_device_recov_plogi_issue(struct lpfc_vport *vport,
ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE; ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
spin_lock_irq(&ndlp->lock); clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
spin_unlock_irq(&ndlp->lock);
return ndlp->nlp_state; return ndlp->nlp_state;
} }
@ -1656,10 +1626,7 @@ lpfc_rcv_plogi_adisc_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
cmdiocb = (struct lpfc_iocbq *) arg; cmdiocb = (struct lpfc_iocbq *) arg;
if (lpfc_rcv_plogi(vport, ndlp, cmdiocb)) { if (lpfc_rcv_plogi(vport, ndlp, cmdiocb)) {
if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { if (test_and_clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) {
spin_lock_irq(&ndlp->lock);
ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
spin_unlock_irq(&ndlp->lock);
if (vport->num_disc_nodes) if (vport->num_disc_nodes)
lpfc_more_adisc(vport); lpfc_more_adisc(vport);
} }
@ -1748,9 +1715,7 @@ lpfc_cmpl_adisc_adisc_issue(struct lpfc_vport *vport,
/* 1 sec timeout */ /* 1 sec timeout */
mod_timer(&ndlp->nlp_delayfunc, mod_timer(&ndlp->nlp_delayfunc,
jiffies + msecs_to_jiffies(1000)); jiffies + msecs_to_jiffies(1000));
spin_lock_irq(&ndlp->lock); set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_DELAY_TMO;
spin_unlock_irq(&ndlp->lock);
ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE;
@ -1789,18 +1754,15 @@ static uint32_t
lpfc_device_rm_adisc_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, lpfc_device_rm_adisc_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
void *arg, uint32_t evt) void *arg, uint32_t evt)
{ {
if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { if (test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) {
spin_lock_irq(&ndlp->lock); set_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_NODEV_REMOVE;
spin_unlock_irq(&ndlp->lock);
return ndlp->nlp_state; return ndlp->nlp_state;
} else {
/* software abort outstanding ADISC */
lpfc_els_abort(vport->phba, ndlp);
lpfc_drop_node(vport, ndlp);
return NLP_STE_FREED_NODE;
} }
/* software abort outstanding ADISC */
lpfc_els_abort(vport->phba, ndlp);
lpfc_drop_node(vport, ndlp);
return NLP_STE_FREED_NODE;
} }
static uint32_t static uint32_t
@ -1820,9 +1782,8 @@ lpfc_device_recov_adisc_issue(struct lpfc_vport *vport,
ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
spin_lock_irq(&ndlp->lock); clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
spin_unlock_irq(&ndlp->lock);
lpfc_disc_set_adisc(vport, ndlp); lpfc_disc_set_adisc(vport, ndlp);
return ndlp->nlp_state; return ndlp->nlp_state;
} }
@ -1856,7 +1817,7 @@ lpfc_rcv_prli_reglogin_issue(struct lpfc_vport *vport,
* transition to UNMAPPED provided the RPI has completed * transition to UNMAPPED provided the RPI has completed
* registration. * registration.
*/ */
if (ndlp->nlp_flag & NLP_RPI_REGISTERED) { if (test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag)) {
lpfc_rcv_prli(vport, ndlp, cmdiocb); lpfc_rcv_prli(vport, ndlp, cmdiocb);
lpfc_els_rsp_prli_acc(vport, cmdiocb, ndlp); lpfc_els_rsp_prli_acc(vport, cmdiocb, ndlp);
} else { } else {
@ -1895,7 +1856,7 @@ lpfc_rcv_logo_reglogin_issue(struct lpfc_vport *vport,
if ((mb = phba->sli.mbox_active)) { if ((mb = phba->sli.mbox_active)) {
if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) &&
(ndlp == mb->ctx_ndlp)) { (ndlp == mb->ctx_ndlp)) {
ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; clear_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag);
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
mb->ctx_ndlp = NULL; mb->ctx_ndlp = NULL;
mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
@ -1906,7 +1867,7 @@ lpfc_rcv_logo_reglogin_issue(struct lpfc_vport *vport,
list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) { list_for_each_entry_safe(mb, nextmb, &phba->sli.mboxq, list) {
if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) && if ((mb->u.mb.mbxCommand == MBX_REG_LOGIN64) &&
(ndlp == mb->ctx_ndlp)) { (ndlp == mb->ctx_ndlp)) {
ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND; clear_bit(NLP_REG_LOGIN_SEND, &ndlp->nlp_flag);
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
list_del(&mb->list); list_del(&mb->list);
phba->sli.mboxq_cnt--; phba->sli.mboxq_cnt--;
@ -1976,9 +1937,7 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport,
/* Put ndlp in npr state set plogi timer for 1 sec */ /* Put ndlp in npr state set plogi timer for 1 sec */
mod_timer(&ndlp->nlp_delayfunc, mod_timer(&ndlp->nlp_delayfunc,
jiffies + msecs_to_jiffies(1000 * 1)); jiffies + msecs_to_jiffies(1000 * 1));
spin_lock_irq(&ndlp->lock); set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_DELAY_TMO;
spin_unlock_irq(&ndlp->lock);
ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
lpfc_issue_els_logo(vport, ndlp, 0); lpfc_issue_els_logo(vport, ndlp, 0);
@ -1989,7 +1948,7 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport,
if (phba->sli_rev < LPFC_SLI_REV4) if (phba->sli_rev < LPFC_SLI_REV4)
ndlp->nlp_rpi = mb->un.varWords[0]; ndlp->nlp_rpi = mb->un.varWords[0];
ndlp->nlp_flag |= NLP_RPI_REGISTERED; set_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag);
/* Only if we are not a fabric nport do we issue PRLI */ /* Only if we are not a fabric nport do we issue PRLI */
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
@ -2061,15 +2020,12 @@ lpfc_device_rm_reglogin_issue(struct lpfc_vport *vport,
void *arg, void *arg,
uint32_t evt) uint32_t evt)
{ {
if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { if (test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) {
spin_lock_irq(&ndlp->lock); set_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_NODEV_REMOVE;
spin_unlock_irq(&ndlp->lock);
return ndlp->nlp_state; return ndlp->nlp_state;
} else {
lpfc_drop_node(vport, ndlp);
return NLP_STE_FREED_NODE;
} }
lpfc_drop_node(vport, ndlp);
return NLP_STE_FREED_NODE;
} }
static uint32_t static uint32_t
@ -2084,17 +2040,16 @@ lpfc_device_recov_reglogin_issue(struct lpfc_vport *vport,
ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
spin_lock_irq(&ndlp->lock);
/* If we are a target we won't immediately transition into PRLI, /* If we are a target we won't immediately transition into PRLI,
* so if REG_LOGIN already completed we don't need to ignore it. * so if REG_LOGIN already completed we don't need to ignore it.
*/ */
if (!(ndlp->nlp_flag & NLP_RPI_REGISTERED) || if (!test_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag) ||
!vport->phba->nvmet_support) !vport->phba->nvmet_support)
ndlp->nlp_flag |= NLP_IGNR_REG_CMPL; set_bit(NLP_IGNR_REG_CMPL, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag);
spin_unlock_irq(&ndlp->lock); clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
lpfc_disc_set_adisc(vport, ndlp); lpfc_disc_set_adisc(vport, ndlp);
return ndlp->nlp_state; return ndlp->nlp_state;
} }
@ -2228,7 +2183,8 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
if (npr->targetFunc) { if (npr->targetFunc) {
ndlp->nlp_type |= NLP_FCP_TARGET; ndlp->nlp_type |= NLP_FCP_TARGET;
if (npr->writeXferRdyDis) if (npr->writeXferRdyDis)
ndlp->nlp_flag |= NLP_FIRSTBURST; set_bit(NLP_FIRSTBURST,
&ndlp->nlp_flag);
} }
if (npr->Retry) if (npr->Retry)
ndlp->nlp_fcp_info |= NLP_FCP_2_DEVICE; ndlp->nlp_fcp_info |= NLP_FCP_2_DEVICE;
@ -2272,7 +2228,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
/* Both sides support FB. The target's first /* Both sides support FB. The target's first
* burst size is a 512 byte encoded value. * burst size is a 512 byte encoded value.
*/ */
ndlp->nlp_flag |= NLP_FIRSTBURST; set_bit(NLP_FIRSTBURST, &ndlp->nlp_flag);
ndlp->nvme_fb_size = bf_get_be32(prli_fb_sz, ndlp->nvme_fb_size = bf_get_be32(prli_fb_sz,
nvpr); nvpr);
@ -2287,7 +2243,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC, lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC,
"6029 NVME PRLI Cmpl w1 x%08x " "6029 NVME PRLI Cmpl w1 x%08x "
"w4 x%08x w5 x%08x flag x%x, " "w4 x%08x w5 x%08x flag x%lx, "
"fcp_info x%x nlp_type x%x\n", "fcp_info x%x nlp_type x%x\n",
be32_to_cpu(nvpr->word1), be32_to_cpu(nvpr->word1),
be32_to_cpu(nvpr->word4), be32_to_cpu(nvpr->word4),
@ -2299,9 +2255,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
(vport->port_type == LPFC_NPIV_PORT) && (vport->port_type == LPFC_NPIV_PORT) &&
vport->cfg_restrict_login) { vport->cfg_restrict_login) {
out: out:
spin_lock_irq(&ndlp->lock); set_bit(NLP_TARGET_REMOVE, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_TARGET_REMOVE;
spin_unlock_irq(&ndlp->lock);
lpfc_issue_els_logo(vport, ndlp, 0); lpfc_issue_els_logo(vport, ndlp, 0);
ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE;
@ -2353,18 +2307,15 @@ static uint32_t
lpfc_device_rm_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, lpfc_device_rm_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
void *arg, uint32_t evt) void *arg, uint32_t evt)
{ {
if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { if (test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) {
spin_lock_irq(&ndlp->lock); set_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_NODEV_REMOVE;
spin_unlock_irq(&ndlp->lock);
return ndlp->nlp_state; return ndlp->nlp_state;
} else {
/* software abort outstanding PLOGI */
lpfc_els_abort(vport->phba, ndlp);
lpfc_drop_node(vport, ndlp);
return NLP_STE_FREED_NODE;
} }
/* software abort outstanding PLOGI */
lpfc_els_abort(vport->phba, ndlp);
lpfc_drop_node(vport, ndlp);
return NLP_STE_FREED_NODE;
} }
@ -2401,9 +2352,8 @@ lpfc_device_recov_prli_issue(struct lpfc_vport *vport,
ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
spin_lock_irq(&ndlp->lock); clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
spin_unlock_irq(&ndlp->lock);
lpfc_disc_set_adisc(vport, ndlp); lpfc_disc_set_adisc(vport, ndlp);
return ndlp->nlp_state; return ndlp->nlp_state;
} }
@ -2442,9 +2392,7 @@ lpfc_rcv_logo_logo_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
{ {
struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *)arg; struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *)arg;
spin_lock_irq(&ndlp->lock); set_bit(NLP_LOGO_ACC, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_LOGO_ACC;
spin_unlock_irq(&ndlp->lock);
lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
return ndlp->nlp_state; return ndlp->nlp_state;
} }
@ -2483,9 +2431,8 @@ lpfc_cmpl_logo_logo_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
{ {
ndlp->nlp_prev_state = NLP_STE_LOGO_ISSUE; ndlp->nlp_prev_state = NLP_STE_LOGO_ISSUE;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
spin_lock_irq(&ndlp->lock); clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
spin_unlock_irq(&ndlp->lock);
lpfc_disc_set_adisc(vport, ndlp); lpfc_disc_set_adisc(vport, ndlp);
return ndlp->nlp_state; return ndlp->nlp_state;
} }
@ -2591,8 +2538,9 @@ lpfc_device_recov_unmap_node(struct lpfc_vport *vport,
{ {
ndlp->nlp_prev_state = NLP_STE_UNMAPPED_NODE; ndlp->nlp_prev_state = NLP_STE_UNMAPPED_NODE;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag);
clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
spin_lock_irq(&ndlp->lock); spin_lock_irq(&ndlp->lock);
ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME); ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME);
spin_unlock_irq(&ndlp->lock); spin_unlock_irq(&ndlp->lock);
lpfc_disc_set_adisc(vport, ndlp); lpfc_disc_set_adisc(vport, ndlp);
@ -2653,9 +2601,7 @@ lpfc_rcv_prlo_mapped_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
lpfc_sli_abort_iocb(vport, ndlp->nlp_sid, 0, LPFC_CTX_TGT); lpfc_sli_abort_iocb(vport, ndlp->nlp_sid, 0, LPFC_CTX_TGT);
/* Send PRLO_ACC */ /* Send PRLO_ACC */
spin_lock_irq(&ndlp->lock); set_bit(NLP_LOGO_ACC, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_LOGO_ACC;
spin_unlock_irq(&ndlp->lock);
lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL); lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL);
/* Save ELS_CMD_PRLO as the last elscmd and then set to NPR. /* Save ELS_CMD_PRLO as the last elscmd and then set to NPR.
@ -2665,7 +2611,7 @@ lpfc_rcv_prlo_mapped_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
ndlp->nlp_prev_state = ndlp->nlp_state; ndlp->nlp_prev_state = ndlp->nlp_state;
lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE | LOG_ELS | LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE | LOG_ELS | LOG_DISCOVERY,
"3422 DID x%06x nflag x%x lastels x%x ref cnt %u\n", "3422 DID x%06x nflag x%lx lastels x%x ref cnt %u\n",
ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_DID, ndlp->nlp_flag,
ndlp->nlp_last_elscmd, ndlp->nlp_last_elscmd,
kref_read(&ndlp->kref)); kref_read(&ndlp->kref));
@ -2685,8 +2631,9 @@ lpfc_device_recov_mapped_node(struct lpfc_vport *vport,
ndlp->nlp_prev_state = NLP_STE_MAPPED_NODE; ndlp->nlp_prev_state = NLP_STE_MAPPED_NODE;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag);
clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
spin_lock_irq(&ndlp->lock); spin_lock_irq(&ndlp->lock);
ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME); ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME);
spin_unlock_irq(&ndlp->lock); spin_unlock_irq(&ndlp->lock);
return ndlp->nlp_state; return ndlp->nlp_state;
@ -2699,16 +2646,16 @@ lpfc_rcv_plogi_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg;
/* Ignore PLOGI if we have an outstanding LOGO */ /* Ignore PLOGI if we have an outstanding LOGO */
if (ndlp->nlp_flag & (NLP_LOGO_SND | NLP_LOGO_ACC)) if (test_bit(NLP_LOGO_SND, &ndlp->nlp_flag) ||
test_bit(NLP_LOGO_ACC, &ndlp->nlp_flag))
return ndlp->nlp_state; return ndlp->nlp_state;
if (lpfc_rcv_plogi(vport, ndlp, cmdiocb)) { if (lpfc_rcv_plogi(vport, ndlp, cmdiocb)) {
lpfc_cancel_retry_delay_tmo(vport, ndlp); lpfc_cancel_retry_delay_tmo(vport, ndlp);
spin_lock_irq(&ndlp->lock); clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~(NLP_NPR_ADISC | NLP_NPR_2B_DISC); clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
spin_unlock_irq(&ndlp->lock); } else if (!test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) {
} else if (!(ndlp->nlp_flag & NLP_NPR_2B_DISC)) {
/* send PLOGI immediately, move to PLOGI issue state */ /* send PLOGI immediately, move to PLOGI issue state */
if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) { if (!test_bit(NLP_DELAY_TMO, &ndlp->nlp_flag)) {
ndlp->nlp_prev_state = NLP_STE_NPR_NODE; ndlp->nlp_prev_state = NLP_STE_NPR_NODE;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0); lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
@ -2729,14 +2676,14 @@ lpfc_rcv_prli_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE; stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE;
lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, NULL); lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, NULL);
if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) { if (!test_bit(NLP_DELAY_TMO, &ndlp->nlp_flag)) {
/* /*
* ADISC nodes will be handled in regular discovery path after * ADISC nodes will be handled in regular discovery path after
* receiving response from NS. * receiving response from NS.
* *
* For other nodes, Send PLOGI to trigger an implicit LOGO. * For other nodes, Send PLOGI to trigger an implicit LOGO.
*/ */
if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { if (!test_bit(NLP_NPR_ADISC, &ndlp->nlp_flag)) {
ndlp->nlp_prev_state = NLP_STE_NPR_NODE; ndlp->nlp_prev_state = NLP_STE_NPR_NODE;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0); lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
@ -2767,15 +2714,15 @@ lpfc_rcv_padisc_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
* or discovery in progress for this node. Starting discovery * or discovery in progress for this node. Starting discovery
* here will affect the counting of discovery threads. * here will affect the counting of discovery threads.
*/ */
if (!(ndlp->nlp_flag & NLP_DELAY_TMO) && if (!test_bit(NLP_DELAY_TMO, &ndlp->nlp_flag) &&
!(ndlp->nlp_flag & NLP_NPR_2B_DISC)) { !test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) {
/* /*
* ADISC nodes will be handled in regular discovery path after * ADISC nodes will be handled in regular discovery path after
* receiving response from NS. * receiving response from NS.
* *
* For other nodes, Send PLOGI to trigger an implicit LOGO. * For other nodes, Send PLOGI to trigger an implicit LOGO.
*/ */
if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { if (!test_bit(NLP_NPR_ADISC, &ndlp->nlp_flag)) {
ndlp->nlp_prev_state = NLP_STE_NPR_NODE; ndlp->nlp_prev_state = NLP_STE_NPR_NODE;
lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE); lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0); lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
@ -2790,24 +2737,18 @@ lpfc_rcv_prlo_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
{ {
struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg; struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg;
spin_lock_irq(&ndlp->lock); set_bit(NLP_LOGO_ACC, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_LOGO_ACC;
spin_unlock_irq(&ndlp->lock);
lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL); lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
if ((ndlp->nlp_flag & NLP_DELAY_TMO) == 0) { if (!test_bit(NLP_DELAY_TMO, &ndlp->nlp_flag)) {
mod_timer(&ndlp->nlp_delayfunc, mod_timer(&ndlp->nlp_delayfunc,
jiffies + msecs_to_jiffies(1000 * 1)); jiffies + msecs_to_jiffies(1000 * 1));
spin_lock_irq(&ndlp->lock); set_bit(NLP_DELAY_TMO, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_DELAY_TMO; clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_NPR_ADISC;
spin_unlock_irq(&ndlp->lock);
ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
} else { } else {
spin_lock_irq(&ndlp->lock); clear_bit(NLP_NPR_ADISC, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_NPR_ADISC;
spin_unlock_irq(&ndlp->lock);
} }
return ndlp->nlp_state; return ndlp->nlp_state;
} }
@ -2844,7 +2785,7 @@ lpfc_cmpl_prli_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
ulp_status = get_job_ulpstatus(phba, rspiocb); ulp_status = get_job_ulpstatus(phba, rspiocb);
if (ulp_status && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) { if (ulp_status && test_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag)) {
lpfc_drop_node(vport, ndlp); lpfc_drop_node(vport, ndlp);
return NLP_STE_FREED_NODE; return NLP_STE_FREED_NODE;
} }
@ -2877,7 +2818,7 @@ lpfc_cmpl_adisc_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
ulp_status = get_job_ulpstatus(phba, rspiocb); ulp_status = get_job_ulpstatus(phba, rspiocb);
if (ulp_status && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) { if (ulp_status && test_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag)) {
lpfc_drop_node(vport, ndlp); lpfc_drop_node(vport, ndlp);
return NLP_STE_FREED_NODE; return NLP_STE_FREED_NODE;
} }
@ -2896,12 +2837,11 @@ lpfc_cmpl_reglogin_npr_node(struct lpfc_vport *vport,
/* SLI4 ports have preallocated logical rpis. */ /* SLI4 ports have preallocated logical rpis. */
if (vport->phba->sli_rev < LPFC_SLI_REV4) if (vport->phba->sli_rev < LPFC_SLI_REV4)
ndlp->nlp_rpi = mb->un.varWords[0]; ndlp->nlp_rpi = mb->un.varWords[0];
ndlp->nlp_flag |= NLP_RPI_REGISTERED; set_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag);
if (ndlp->nlp_flag & NLP_LOGO_ACC) { if (test_bit(NLP_LOGO_ACC, &ndlp->nlp_flag))
lpfc_unreg_rpi(vport, ndlp); lpfc_unreg_rpi(vport, ndlp);
}
} else { } else {
if (ndlp->nlp_flag & NLP_NODEV_REMOVE) { if (test_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag)) {
lpfc_drop_node(vport, ndlp); lpfc_drop_node(vport, ndlp);
return NLP_STE_FREED_NODE; return NLP_STE_FREED_NODE;
} }
@ -2913,10 +2853,8 @@ static uint32_t
lpfc_device_rm_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, lpfc_device_rm_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
void *arg, uint32_t evt) void *arg, uint32_t evt)
{ {
if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { if (test_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag)) {
spin_lock_irq(&ndlp->lock); set_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_NODEV_REMOVE;
spin_unlock_irq(&ndlp->lock);
return ndlp->nlp_state; return ndlp->nlp_state;
} }
lpfc_drop_node(vport, ndlp); lpfc_drop_node(vport, ndlp);
@ -2932,8 +2870,9 @@ lpfc_device_recov_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
return ndlp->nlp_state; return ndlp->nlp_state;
lpfc_cancel_retry_delay_tmo(vport, ndlp); lpfc_cancel_retry_delay_tmo(vport, ndlp);
clear_bit(NLP_NODEV_REMOVE, &ndlp->nlp_flag);
clear_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
spin_lock_irq(&ndlp->lock); spin_lock_irq(&ndlp->lock);
ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME); ndlp->nlp_fc4_type &= ~(NLP_FC4_FCP | NLP_FC4_NVME);
spin_unlock_irq(&ndlp->lock); spin_unlock_irq(&ndlp->lock);
return ndlp->nlp_state; return ndlp->nlp_state;
@ -3146,7 +3085,7 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
/* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */ /* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
"0211 DSM in event x%x on NPort x%x in " "0211 DSM in event x%x on NPort x%x in "
"state %d rpi x%x Data: x%x x%x\n", "state %d rpi x%x Data: x%lx x%x\n",
evt, ndlp->nlp_DID, cur_state, ndlp->nlp_rpi, evt, ndlp->nlp_DID, cur_state, ndlp->nlp_rpi,
ndlp->nlp_flag, data1); ndlp->nlp_flag, data1);
@ -3163,12 +3102,12 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
((uint32_t)ndlp->nlp_type)); ((uint32_t)ndlp->nlp_type));
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
"0212 DSM out state %d on NPort x%x " "0212 DSM out state %d on NPort x%x "
"rpi x%x Data: x%x x%x\n", "rpi x%x Data: x%lx x%x\n",
rc, ndlp->nlp_DID, ndlp->nlp_rpi, ndlp->nlp_flag, rc, ndlp->nlp_DID, ndlp->nlp_rpi, ndlp->nlp_flag,
data1); data1);
lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM, lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM,
"DSM out: ste:%d did:x%x flg:x%x", "DSM out: ste:%d did:x%x flg:x%lx",
rc, ndlp->nlp_DID, ndlp->nlp_flag); rc, ndlp->nlp_DID, ndlp->nlp_flag);
/* Decrement the ndlp reference count held for this function */ /* Decrement the ndlp reference count held for this function */
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);

View File

@ -1232,7 +1232,7 @@ lpfc_nvme_prep_io_cmd(struct lpfc_vport *vport,
/* Word 5 */ /* Word 5 */
if ((phba->cfg_nvme_enable_fb) && if ((phba->cfg_nvme_enable_fb) &&
(pnode->nlp_flag & NLP_FIRSTBURST)) { test_bit(NLP_FIRSTBURST, &pnode->nlp_flag)) {
req_len = lpfc_ncmd->nvmeCmd->payload_length; req_len = lpfc_ncmd->nvmeCmd->payload_length;
if (req_len < pnode->nvme_fb_size) if (req_len < pnode->nvme_fb_size)
wqe->fcp_iwrite.initial_xfer_len = wqe->fcp_iwrite.initial_xfer_len =
@ -2651,14 +2651,11 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
* reference. Check if another thread has set * reference. Check if another thread has set
* NLP_DROPPED. * NLP_DROPPED.
*/ */
spin_lock_irq(&ndlp->lock); if (!test_and_set_bit(NLP_DROPPED,
if (!(ndlp->nlp_flag & NLP_DROPPED)) { &ndlp->nlp_flag)) {
ndlp->nlp_flag |= NLP_DROPPED;
spin_unlock_irq(&ndlp->lock);
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
return; return;
} }
spin_unlock_irq(&ndlp->lock);
} }
} }
} }

View File

@ -2854,7 +2854,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba,
/* In template ar=1 wqes=0 sup=0 irsp=0 irsplen=0 */ /* In template ar=1 wqes=0 sup=0 irsp=0 irsplen=0 */
if (rsp->rsplen == LPFC_NVMET_SUCCESS_LEN) { if (rsp->rsplen == LPFC_NVMET_SUCCESS_LEN) {
if (ndlp->nlp_flag & NLP_SUPPRESS_RSP) if (test_bit(NLP_SUPPRESS_RSP, &ndlp->nlp_flag))
bf_set(wqe_sup, bf_set(wqe_sup,
&wqe->fcp_tsend.wqe_com, 1); &wqe->fcp_tsend.wqe_com, 1);
} else { } else {

View File

@ -4629,7 +4629,7 @@ static int lpfc_scsi_prep_cmnd_buf_s3(struct lpfc_vport *vport,
iocb_cmd->ulpCommand = CMD_FCP_IWRITE64_CR; iocb_cmd->ulpCommand = CMD_FCP_IWRITE64_CR;
iocb_cmd->ulpPU = PARM_READ_CHECK; iocb_cmd->ulpPU = PARM_READ_CHECK;
if (vport->cfg_first_burst_size && if (vport->cfg_first_burst_size &&
(pnode->nlp_flag & NLP_FIRSTBURST)) { test_bit(NLP_FIRSTBURST, &pnode->nlp_flag)) {
u32 xrdy_len; u32 xrdy_len;
fcpdl = scsi_bufflen(scsi_cmnd); fcpdl = scsi_bufflen(scsi_cmnd);
@ -5829,7 +5829,7 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct fc_rport *rport,
lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
"0702 Issue %s to TGT %d LUN %llu " "0702 Issue %s to TGT %d LUN %llu "
"rpi x%x nlp_flag x%x Data: x%x x%x\n", "rpi x%x nlp_flag x%lx Data: x%x x%x\n",
lpfc_taskmgmt_name(task_mgmt_cmd), tgt_id, lun_id, lpfc_taskmgmt_name(task_mgmt_cmd), tgt_id, lun_id,
pnode->nlp_rpi, pnode->nlp_flag, iocbq->sli4_xritag, pnode->nlp_rpi, pnode->nlp_flag, iocbq->sli4_xritag,
iocbq->cmd_flag); iocbq->cmd_flag);
@ -6094,8 +6094,8 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd)
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT,
"0722 Target Reset rport failure: rdata x%px\n", rdata); "0722 Target Reset rport failure: rdata x%px\n", rdata);
if (pnode) { if (pnode) {
clear_bit(NLP_NPR_ADISC, &pnode->nlp_flag);
spin_lock_irqsave(&pnode->lock, flags); spin_lock_irqsave(&pnode->lock, flags);
pnode->nlp_flag &= ~NLP_NPR_ADISC;
pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
spin_unlock_irqrestore(&pnode->lock, flags); spin_unlock_irqrestore(&pnode->lock, flags);
} }
@ -6124,7 +6124,7 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd)
!pnode->logo_waitq) { !pnode->logo_waitq) {
pnode->logo_waitq = &waitq; pnode->logo_waitq = &waitq;
pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
pnode->nlp_flag |= NLP_ISSUE_LOGO; set_bit(NLP_ISSUE_LOGO, &pnode->nlp_flag);
pnode->save_flags |= NLP_WAIT_FOR_LOGO; pnode->save_flags |= NLP_WAIT_FOR_LOGO;
spin_unlock_irqrestore(&pnode->lock, flags); spin_unlock_irqrestore(&pnode->lock, flags);
lpfc_unreg_rpi(vport, pnode); lpfc_unreg_rpi(vport, pnode);

View File

@ -2913,14 +2913,14 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
vport, vport,
KERN_INFO, LOG_MBOX | LOG_DISCOVERY, KERN_INFO, LOG_MBOX | LOG_DISCOVERY,
"1438 UNREG cmpl deferred mbox x%x " "1438 UNREG cmpl deferred mbox x%x "
"on NPort x%x Data: x%x x%x x%px x%lx x%x\n", "on NPort x%x Data: x%lx x%x x%px x%lx x%x\n",
ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_rpi, ndlp->nlp_DID,
ndlp->nlp_flag, ndlp->nlp_defer_did, ndlp->nlp_flag, ndlp->nlp_defer_did,
ndlp, vport->load_flag, kref_read(&ndlp->kref)); ndlp, vport->load_flag, kref_read(&ndlp->kref));
if ((ndlp->nlp_flag & NLP_UNREG_INP) && if (test_bit(NLP_UNREG_INP, &ndlp->nlp_flag) &&
(ndlp->nlp_defer_did != NLP_EVT_NOTHING_PENDING)) { ndlp->nlp_defer_did != NLP_EVT_NOTHING_PENDING) {
ndlp->nlp_flag &= ~NLP_UNREG_INP; clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag);
ndlp->nlp_defer_did = NLP_EVT_NOTHING_PENDING; ndlp->nlp_defer_did = NLP_EVT_NOTHING_PENDING;
lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0); lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
} }
@ -2970,7 +2970,7 @@ lpfc_sli4_unreg_rpi_cmpl_clr(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
{ {
struct lpfc_vport *vport = pmb->vport; struct lpfc_vport *vport = pmb->vport;
struct lpfc_nodelist *ndlp; struct lpfc_nodelist *ndlp;
u32 unreg_inp; bool unreg_inp;
ndlp = pmb->ctx_ndlp; ndlp = pmb->ctx_ndlp;
if (pmb->u.mb.mbxCommand == MBX_UNREG_LOGIN) { if (pmb->u.mb.mbxCommand == MBX_UNREG_LOGIN) {
@ -2983,7 +2983,7 @@ lpfc_sli4_unreg_rpi_cmpl_clr(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
vport, KERN_INFO, vport, KERN_INFO,
LOG_MBOX | LOG_SLI | LOG_NODE, LOG_MBOX | LOG_SLI | LOG_NODE,
"0010 UNREG_LOGIN vpi:x%x " "0010 UNREG_LOGIN vpi:x%x "
"rpi:%x DID:%x defer x%x flg x%x " "rpi:%x DID:%x defer x%x flg x%lx "
"x%px\n", "x%px\n",
vport->vpi, ndlp->nlp_rpi, vport->vpi, ndlp->nlp_rpi,
ndlp->nlp_DID, ndlp->nlp_defer_did, ndlp->nlp_DID, ndlp->nlp_defer_did,
@ -2993,11 +2993,9 @@ lpfc_sli4_unreg_rpi_cmpl_clr(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
/* Cleanup the nlp_flag now that the UNREG RPI /* Cleanup the nlp_flag now that the UNREG RPI
* has completed. * has completed.
*/ */
spin_lock_irq(&ndlp->lock); unreg_inp = test_and_clear_bit(NLP_UNREG_INP,
unreg_inp = ndlp->nlp_flag & NLP_UNREG_INP; &ndlp->nlp_flag);
ndlp->nlp_flag &= clear_bit(NLP_LOGO_ACC, &ndlp->nlp_flag);
~(NLP_UNREG_INP | NLP_LOGO_ACC);
spin_unlock_irq(&ndlp->lock);
/* Check to see if there are any deferred /* Check to see if there are any deferred
* events to process * events to process
@ -14342,9 +14340,7 @@ lpfc_sli4_sp_handle_mbox_event(struct lpfc_hba *phba, struct lpfc_mcqe *mcqe)
* an unsolicited PLOGI from the same NPortId from * an unsolicited PLOGI from the same NPortId from
* starting another mailbox transaction. * starting another mailbox transaction.
*/ */
spin_lock_irqsave(&ndlp->lock, iflags); set_bit(NLP_UNREG_INP, &ndlp->nlp_flag);
ndlp->nlp_flag |= NLP_UNREG_INP;
spin_unlock_irqrestore(&ndlp->lock, iflags);
lpfc_unreg_login(phba, vport->vpi, lpfc_unreg_login(phba, vport->vpi,
pmbox->un.varWords[0], pmb); pmbox->un.varWords[0], pmb);
pmb->mbox_cmpl = lpfc_mbx_cmpl_dflt_rpi; pmb->mbox_cmpl = lpfc_mbx_cmpl_dflt_rpi;
@ -19093,9 +19089,9 @@ lpfc_sli4_seq_abort_rsp(struct lpfc_vport *vport,
* to free ndlp when transmit completes * to free ndlp when transmit completes
*/ */
if (ndlp->nlp_state == NLP_STE_UNUSED_NODE && if (ndlp->nlp_state == NLP_STE_UNUSED_NODE &&
!(ndlp->nlp_flag & NLP_DROPPED) && !test_bit(NLP_DROPPED, &ndlp->nlp_flag) &&
!(ndlp->fc4_xpt_flags & (NVME_XPT_REGD | SCSI_XPT_REGD))) { !(ndlp->fc4_xpt_flags & (NVME_XPT_REGD | SCSI_XPT_REGD))) {
ndlp->nlp_flag |= NLP_DROPPED; set_bit(NLP_DROPPED, &ndlp->nlp_flag);
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
} }
} }
@ -21113,11 +21109,7 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport)
/* Unregister the RPI when mailbox complete */ /* Unregister the RPI when mailbox complete */
mb->mbox_flag |= LPFC_MBX_IMED_UNREG; mb->mbox_flag |= LPFC_MBX_IMED_UNREG;
restart_loop = 1; restart_loop = 1;
spin_unlock_irq(&phba->hbalock); clear_bit(NLP_IGNR_REG_CMPL, &ndlp->nlp_flag);
spin_lock(&ndlp->lock);
ndlp->nlp_flag &= ~NLP_IGNR_REG_CMPL;
spin_unlock(&ndlp->lock);
spin_lock_irq(&phba->hbalock);
break; break;
} }
} }
@ -21132,9 +21124,7 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport)
ndlp = mb->ctx_ndlp; ndlp = mb->ctx_ndlp;
mb->ctx_ndlp = NULL; mb->ctx_ndlp = NULL;
if (ndlp) { if (ndlp) {
spin_lock(&ndlp->lock); clear_bit(NLP_IGNR_REG_CMPL, &ndlp->nlp_flag);
ndlp->nlp_flag &= ~NLP_IGNR_REG_CMPL;
spin_unlock(&ndlp->lock);
lpfc_nlp_put(ndlp); lpfc_nlp_put(ndlp);
} }
} }
@ -21143,9 +21133,7 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport)
/* Release the ndlp with the cleaned-up active mailbox command */ /* Release the ndlp with the cleaned-up active mailbox command */
if (act_mbx_ndlp) { if (act_mbx_ndlp) {
spin_lock(&act_mbx_ndlp->lock); clear_bit(NLP_IGNR_REG_CMPL, &act_mbx_ndlp->nlp_flag);
act_mbx_ndlp->nlp_flag &= ~NLP_IGNR_REG_CMPL;
spin_unlock(&act_mbx_ndlp->lock);
lpfc_nlp_put(act_mbx_ndlp); lpfc_nlp_put(act_mbx_ndlp);
} }
} }

View File

@ -496,7 +496,7 @@ lpfc_send_npiv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
!ndlp->logo_waitq) { !ndlp->logo_waitq) {
ndlp->logo_waitq = &waitq; ndlp->logo_waitq = &waitq;
ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE; ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
ndlp->nlp_flag |= NLP_ISSUE_LOGO; set_bit(NLP_ISSUE_LOGO, &ndlp->nlp_flag);
ndlp->save_flags |= NLP_WAIT_FOR_LOGO; ndlp->save_flags |= NLP_WAIT_FOR_LOGO;
} }
spin_unlock_irq(&ndlp->lock); spin_unlock_irq(&ndlp->lock);
@ -515,8 +515,8 @@ lpfc_send_npiv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
} }
/* Error - clean up node flags. */ /* Error - clean up node flags. */
clear_bit(NLP_ISSUE_LOGO, &ndlp->nlp_flag);
spin_lock_irq(&ndlp->lock); spin_lock_irq(&ndlp->lock);
ndlp->nlp_flag &= ~NLP_ISSUE_LOGO;
ndlp->save_flags &= ~NLP_WAIT_FOR_LOGO; ndlp->save_flags &= ~NLP_WAIT_FOR_LOGO;
spin_unlock_irq(&ndlp->lock); spin_unlock_irq(&ndlp->lock);
@ -708,7 +708,7 @@ lpfc_vport_delete(struct fc_vport *fc_vport)
lpfc_printf_vlog(vport, KERN_INFO, LOG_VPORT | LOG_ELS, lpfc_printf_vlog(vport, KERN_INFO, LOG_VPORT | LOG_ELS,
"1829 DA_ID issue status %d. " "1829 DA_ID issue status %d. "
"SFlag x%x NState x%x, NFlag x%x " "SFlag x%x NState x%x, NFlag x%lx "
"Rpi x%x\n", "Rpi x%x\n",
rc, ndlp->save_flags, ndlp->nlp_state, rc, ndlp->save_flags, ndlp->nlp_state,
ndlp->nlp_flag, ndlp->nlp_rpi); ndlp->nlp_flag, ndlp->nlp_rpi);