#define FC_SCSI_SCAN_TMO 0x4000 /* scsi scan timer running */
#define FC_ABORT_DISCOVERY 0x8000 /* we want to abort discovery */
#define FC_NDISC_ACTIVE 0x10000 /* NPort discovery active */
+#define FC_BYPASSED_MODE 0x20000 /* NPort is in bypassed mode */
uint32_t fc_topology; /* link topology, from LINK INIT */
icmd->un.genreq64.w5.hcsw.Rctl = FC_UNSOL_CTL;
icmd->un.genreq64.w5.hcsw.Type = FC_COMMON_TRANSPORT_ULP;
- if (!tmo)
- tmo = (2 * phba->fc_ratov) + 1;
+ if (!tmo) {
+ /* FC spec states we need 3 * ratov for CT requests */
+ tmo = (3 * phba->fc_ratov);
+ }
icmd->ulpTimeout = tmo;
icmd->ulpBdeCount = 1;
icmd->ulpLe = 1;
CTrsp = (struct lpfc_sli_ct_request *) outp->virt;
if (CTrsp->CommandResponse.bits.CmdRsp ==
be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) {
+ lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
+ "%d:0239 NameServer Rsp "
+ "Data: x%x\n",
+ phba->brd_no,
+ phba->fc_flag);
lpfc_ns_rsp(phba, outp,
(uint32_t) (irsp->un.genreq64.bdl.bdeSize));
} else if (CTrsp->CommandResponse.bits.CmdRsp ==
}
}
- return (1);
+ return 1;
}
ndlp->nlp_DID, icmd->ulpIoTag, cmdSize);
}
- return (elsiocb);
+ return elsiocb;
}
lpfc_printf_log(phba,
KERN_INFO,
LOG_ELS,
- "%d:0100 FLOGI failure Data: x%x x%x\n",
+ "%d:0100 FLOGI failure Data: x%x x%x x%x\n",
phba->brd_no,
- irsp->ulpStatus, irsp->un.ulpWord[4]);
+ irsp->ulpStatus, irsp->un.ulpWord[4],
+ irsp->ulpTimeout);
goto flogifail;
}
cmdsize = (sizeof (uint32_t) + sizeof (struct serv_parm));
if ((elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry,
ndlp, ELS_CMD_FLOGI)) == 0) {
- return (1);
+ return 1;
}
icmd = &elsiocb->iocb;
spin_unlock_irq(phba->host->host_lock);
if (rc == IOCB_ERROR) {
lpfc_els_free_iocb(phba, elsiocb);
- return (1);
+ return 1;
}
- return (0);
+ return 0;
}
int
{
struct lpfc_nodelist *ndlp;
- /* First look for Fabric ndlp on the unmapped list */
-
- if ((ndlp =
- lpfc_findnode_did(phba, NLP_SEARCH_UNMAPPED,
- Fabric_DID)) == 0) {
+ /* First look for the Fabric ndlp */
+ ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, Fabric_DID);
+ if (!ndlp) {
/* Cannot find existing Fabric ndlp, so allocate a new one */
- if ((ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL))
- == 0) {
- return (0);
- }
+ ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
+ if (!ndlp)
+ return 0;
lpfc_nlp_init(phba, ndlp, Fabric_DID);
- }
- else {
- phba->fc_unmap_cnt--;
- list_del(&ndlp->nlp_listp);
- spin_lock_irq(phba->host->host_lock);
- ndlp->nlp_flag &= ~NLP_LIST_MASK;
- spin_unlock_irq(phba->host->host_lock);
+ } else {
+ lpfc_nlp_list(phba, ndlp, NLP_JUST_DQ);
}
if (lpfc_issue_els_flogi(phba, ndlp, 0)) {
mempool_free( ndlp, phba->nlp_mem_pool);
}
- return (1);
+ return 1;
}
static void
irsp = &rspiocb->iocb;
ndlp = (struct lpfc_nodelist *) cmdiocb->context1;
- spin_lock_irq(phba->host->host_lock);
- ndlp->nlp_flag &= ~NLP_PLOGI_SND;
- spin_unlock_irq(phba->host->host_lock);
/* Since ndlp can be freed in the disc state machine, note if this node
* is being used during discovery.
*/
disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC);
+ spin_lock_irq(phba->host->host_lock);
+ ndlp->nlp_flag &= ~(NLP_PLOGI_SND | NLP_NPR_2B_DISC);
+ spin_unlock_irq(phba->host->host_lock);
rc = 0;
/* PLOGI completes to NPort <nlp_DID> */
lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
"%d:0102 PLOGI completes to NPort x%x "
- "Data: x%x x%x x%x x%x\n",
+ "Data: x%x x%x x%x x%x x%x\n",
phba->brd_no, ndlp->nlp_DID, irsp->ulpStatus,
- irsp->un.ulpWord[4], disc, phba->num_disc_nodes);
+ irsp->un.ulpWord[4], irsp->ulpTimeout, disc,
+ phba->num_disc_nodes);
/* Check to see if link went down during discovery */
if (lpfc_els_chk_latt(phba)) {
((irsp->un.ulpWord[4] == IOERR_SLI_ABORTED) ||
(irsp->un.ulpWord[4] == IOERR_LINK_DOWN) ||
(irsp->un.ulpWord[4] == IOERR_SLI_DOWN))) {
- disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC);
+ rc = NLP_STE_FREED_NODE;
}
else {
rc = lpfc_disc_state_machine(phba, ndlp, cmdiocb,
lpfc_more_plogi(phba);
}
- if (rc != NLP_STE_FREED_NODE) {
+ if (phba->num_disc_nodes == 0) {
spin_lock_irq(phba->host->host_lock);
- ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
+ phba->fc_flag &= ~FC_NDISC_ACTIVE;
spin_unlock_irq(phba->host->host_lock);
- }
- if (phba->num_disc_nodes == 0) {
- if(disc) {
- spin_lock_irq(phba->host->host_lock);
- phba->fc_flag &= ~FC_NDISC_ACTIVE;
- spin_unlock_irq(phba->host->host_lock);
- }
lpfc_can_disctmo(phba);
if (phba->fc_flag & FC_RSCN_MODE) {
/* Check to see if more RSCNs came in while we were
pring = &psli->ring[LPFC_ELS_RING]; /* ELS ring */
cmdsize = (sizeof (uint32_t) + sizeof (struct serv_parm));
- if ((elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry,
- ndlp, ELS_CMD_PLOGI)) == 0) {
- return (1);
- }
+ elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry, ndlp,
+ ELS_CMD_PLOGI);
+ if (!elsiocb)
+ return 1;
icmd = &elsiocb->iocb;
pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt);
ndlp->nlp_flag &= ~NLP_PLOGI_SND;
spin_unlock_irq(phba->host->host_lock);
lpfc_els_free_iocb(phba, elsiocb);
- return (1);
+ return 1;
}
spin_unlock_irq(phba->host->host_lock);
- return (0);
+ return 0;
}
static void
/* PRLI completes to NPort <nlp_DID> */
lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
"%d:0103 PRLI completes to NPort x%x "
- "Data: x%x x%x x%x\n",
+ "Data: x%x x%x x%x x%x\n",
phba->brd_no, ndlp->nlp_DID, irsp->ulpStatus,
- irsp->un.ulpWord[4], phba->num_disc_nodes);
+ irsp->un.ulpWord[4], irsp->ulpTimeout,
+ phba->num_disc_nodes);
phba->fc_prli_sent--;
/* Check to see if link went down during discovery */
cmdsize = (sizeof (uint32_t) + sizeof (PRLI));
if ((elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry,
ndlp, ELS_CMD_PRLI)) == 0) {
- return (1);
+ return 1;
}
icmd = &elsiocb->iocb;
ndlp->nlp_flag &= ~NLP_PRLI_SND;
spin_unlock_irq(phba->host->host_lock);
lpfc_els_free_iocb(phba, elsiocb);
- return (1);
+ return 1;
}
spin_unlock_irq(phba->host->host_lock);
phba->fc_prli_sent++;
- return (0);
+ return 0;
}
static void
irsp = &(rspiocb->iocb);
ndlp = (struct lpfc_nodelist *) cmdiocb->context1;
- spin_lock_irq(phba->host->host_lock);
- ndlp->nlp_flag &= ~NLP_ADISC_SND;
- spin_unlock_irq(phba->host->host_lock);
/* Since ndlp can be freed in the disc state machine, note if this node
* is being used during discovery.
*/
disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC);
+ spin_lock_irq(phba->host->host_lock);
+ ndlp->nlp_flag &= ~(NLP_ADISC_SND | NLP_NPR_2B_DISC);
+ spin_unlock_irq(phba->host->host_lock);
/* ADISC completes to NPort <nlp_DID> */
lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
"%d:0104 ADISC completes to NPort x%x "
- "Data: x%x x%x x%x x%x\n",
+ "Data: x%x x%x x%x x%x x%x\n",
phba->brd_no, ndlp->nlp_DID, irsp->ulpStatus,
- irsp->un.ulpWord[4], disc, phba->num_disc_nodes);
+ irsp->un.ulpWord[4], irsp->ulpTimeout, disc,
+ phba->num_disc_nodes);
/* Check to see if link went down during discovery */
if (lpfc_els_chk_latt(phba)) {
}
/* ADISC failed */
/* Do not call DSM for lpfc_els_abort'ed ELS cmds */
- if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) &&
- ((irsp->un.ulpWord[4] == IOERR_SLI_ABORTED) ||
- (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) ||
- (irsp->un.ulpWord[4] == IOERR_SLI_DOWN))) {
- disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC);
- }
- else {
+ if ((irsp->ulpStatus != IOSTAT_LOCAL_REJECT) ||
+ ((irsp->un.ulpWord[4] != IOERR_SLI_ABORTED) &&
+ (irsp->un.ulpWord[4] != IOERR_LINK_DOWN) &&
+ (irsp->un.ulpWord[4] != IOERR_SLI_DOWN))) {
lpfc_disc_state_machine(phba, ndlp, cmdiocb,
NLP_EVT_CMPL_ADISC);
}
}
}
}
- spin_lock_irq(phba->host->host_lock);
- ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
- spin_unlock_irq(phba->host->host_lock);
out:
lpfc_els_free_iocb(phba, cmdiocb);
return;
cmdsize = (sizeof (uint32_t) + sizeof (ADISC));
if ((elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry,
ndlp, ELS_CMD_ADISC)) == 0) {
- return (1);
+ return 1;
}
icmd = &elsiocb->iocb;
ndlp->nlp_flag &= ~NLP_ADISC_SND;
spin_unlock_irq(phba->host->host_lock);
lpfc_els_free_iocb(phba, elsiocb);
- return (1);
+ return 1;
}
spin_unlock_irq(phba->host->host_lock);
- return (0);
+ return 0;
}
static void
/* LOGO completes to NPort <nlp_DID> */
lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
"%d:0105 LOGO completes to NPort x%x "
- "Data: x%x x%x x%x\n",
+ "Data: x%x x%x x%x x%x\n",
phba->brd_no, ndlp->nlp_DID, irsp->ulpStatus,
- irsp->un.ulpWord[4], phba->num_disc_nodes);
+ irsp->un.ulpWord[4], irsp->ulpTimeout,
+ phba->num_disc_nodes);
/* Check to see if link went down during discovery */
if (lpfc_els_chk_latt(phba))
cmdsize = 2 * (sizeof (uint32_t) + sizeof (struct lpfc_name));
if ((elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry,
ndlp, ELS_CMD_LOGO)) == 0) {
- return (1);
+ return 1;
}
icmd = &elsiocb->iocb;
ndlp->nlp_flag &= ~NLP_LOGO_SND;
spin_unlock_irq(phba->host->host_lock);
lpfc_els_free_iocb(phba, elsiocb);
- return (1);
+ return 1;
}
spin_unlock_irq(phba->host->host_lock);
- return (0);
+ return 0;
}
static void
lpfc_printf_log(phba,
KERN_INFO,
LOG_ELS,
- "%d:0106 ELS cmd tag x%x completes Data: x%x x%x\n",
+ "%d:0106 ELS cmd tag x%x completes Data: x%x x%x x%x\n",
phba->brd_no,
- irsp->ulpIoTag, irsp->ulpStatus, irsp->un.ulpWord[4]);
+ irsp->ulpIoTag, irsp->ulpStatus,
+ irsp->un.ulpWord[4], irsp->ulpTimeout);
/* Check to see if link went down during discovery */
lpfc_els_chk_latt(phba);
psli = &phba->sli;
pring = &psli->ring[LPFC_ELS_RING]; /* ELS ring */
cmdsize = (sizeof (uint32_t) + sizeof (SCR));
- if ((ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL)) == 0) {
- return (1);
- }
+ ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
+ if (!ndlp)
+ return 1;
lpfc_nlp_init(phba, ndlp, nportid);
if ((elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry,
ndlp, ELS_CMD_SCR)) == 0) {
mempool_free( ndlp, phba->nlp_mem_pool);
- return (1);
+ return 1;
}
icmd = &elsiocb->iocb;
spin_unlock_irq(phba->host->host_lock);
mempool_free( ndlp, phba->nlp_mem_pool);
lpfc_els_free_iocb(phba, elsiocb);
- return (1);
+ return 1;
}
spin_unlock_irq(phba->host->host_lock);
mempool_free( ndlp, phba->nlp_mem_pool);
- return (0);
+ return 0;
}
static int
psli = &phba->sli;
pring = &psli->ring[LPFC_ELS_RING]; /* ELS ring */
cmdsize = (sizeof (uint32_t) + sizeof (FARP));
- if ((ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL)) == 0) {
- return (1);
- }
+ ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
+ if (!ndlp)
+ return 1;
lpfc_nlp_init(phba, ndlp, nportid);
if ((elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry,
ndlp, ELS_CMD_RNID)) == 0) {
mempool_free( ndlp, phba->nlp_mem_pool);
- return (1);
+ return 1;
}
icmd = &elsiocb->iocb;
spin_unlock_irq(phba->host->host_lock);
mempool_free( ndlp, phba->nlp_mem_pool);
lpfc_els_free_iocb(phba, elsiocb);
- return (1);
+ return 1;
}
spin_unlock_irq(phba->host->host_lock);
mempool_free( ndlp, phba->nlp_mem_pool);
- return (0);
+ return 0;
}
void
case IOERR_SEQUENCE_TIMEOUT:
retry = 1;
- if ((cmd == ELS_CMD_FLOGI)
- && (phba->fc_topology != TOPOLOGY_LOOP)) {
- delay = 1;
- maxretry = 48;
- }
break;
case IOERR_NO_RESOURCES:
lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
ndlp->nlp_last_elscmd = cmd;
- return (1);
+ return 1;
}
switch (cmd) {
case ELS_CMD_FLOGI:
lpfc_issue_els_flogi(phba, ndlp, cmdiocb->retry);
- return (1);
+ return 1;
case ELS_CMD_PLOGI:
ndlp->nlp_state = NLP_STE_PLOGI_ISSUE;
lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
lpfc_issue_els_plogi(phba, ndlp, cmdiocb->retry);
- return (1);
+ return 1;
case ELS_CMD_ADISC:
ndlp->nlp_state = NLP_STE_ADISC_ISSUE;
lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST);
lpfc_issue_els_adisc(phba, ndlp, cmdiocb->retry);
- return (1);
+ return 1;
case ELS_CMD_PRLI:
ndlp->nlp_state = NLP_STE_PRLI_ISSUE;
lpfc_nlp_list(phba, ndlp, NLP_PRLI_LIST);
lpfc_issue_els_prli(phba, ndlp, cmdiocb->retry);
- return (1);
+ return 1;
case ELS_CMD_LOGO:
ndlp->nlp_state = NLP_STE_NPR_NODE;
lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
lpfc_issue_els_logo(phba, ndlp, cmdiocb->retry);
- return (1);
+ return 1;
}
}
phba->brd_no,
cmd, ndlp->nlp_DID, cmdiocb->retry, ndlp->nlp_flag);
- return (0);
+ return 0;
}
int
/* ELS response tag <ulpIoTag> completes */
lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
"%d:0110 ELS response tag x%x completes "
- "Data: x%x x%x x%x x%x x%x x%x\n",
+ "Data: x%x x%x x%x x%x x%x x%x x%x\n",
phba->brd_no,
cmdiocb->iocb.ulpIoTag, rspiocb->iocb.ulpStatus,
- rspiocb->iocb.un.ulpWord[4], ndlp->nlp_DID,
- ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi);
+ rspiocb->iocb.un.ulpWord[4], rspiocb->iocb.ulpTimeout,
+ ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
+ ndlp->nlp_rpi);
if (mbox) {
if ((rspiocb->iocb.ulpStatus == 0)
if ((elsiocb =
lpfc_prep_els_iocb(phba, 0, cmdsize, oldiocb->retry,
ndlp, ELS_CMD_ACC)) == 0) {
- return (1);
+ return 1;
}
icmd = &elsiocb->iocb;
icmd->ulpContext = oldcmd->ulpContext; /* Xri */
if ((elsiocb =
lpfc_prep_els_iocb(phba, 0, cmdsize, oldiocb->retry,
ndlp, ELS_CMD_ACC)) == 0) {
- return (1);
+ return 1;
}
icmd = &elsiocb->iocb;
icmd->ulpContext = oldcmd->ulpContext; /* Xri */
memcpy(pcmd, &phba->fc_sparam, sizeof (struct serv_parm));
break;
default:
- return (1);
+ return 1;
}
if (newnode)
ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi);
if (ndlp->nlp_flag & NLP_LOGO_ACC) {
+ spin_lock_irq(phba->host->host_lock);
+ ndlp->nlp_flag &= ~NLP_LOGO_ACC;
+ spin_unlock_irq(phba->host->host_lock);
elsiocb->iocb_cmpl = lpfc_cmpl_els_logo_acc;
} else {
elsiocb->iocb_cmpl = lpfc_cmpl_els_acc;
spin_unlock_irq(phba->host->host_lock);
if (rc == IOCB_ERROR) {
lpfc_els_free_iocb(phba, elsiocb);
- return (1);
+ return 1;
}
- return (0);
+ return 0;
}
int
cmdsize = 2 * sizeof (uint32_t);
if ((elsiocb = lpfc_prep_els_iocb(phba, 0, cmdsize, oldiocb->retry,
ndlp, ELS_CMD_LS_RJT)) == 0) {
- return (1);
+ return 1;
}
icmd = &elsiocb->iocb;
spin_unlock_irq(phba->host->host_lock);
if (rc == IOCB_ERROR) {
lpfc_els_free_iocb(phba, elsiocb);
- return (1);
+ return 1;
}
- return (0);
+ return 0;
}
int
cmdsize = sizeof (uint32_t) + sizeof (ADISC);
if ((elsiocb = lpfc_prep_els_iocb(phba, 0, cmdsize, oldiocb->retry,
ndlp, ELS_CMD_ACC)) == 0) {
- return (1);
+ return 1;
}
/* Xmit ADISC ACC response tag <ulpIoTag> */
spin_unlock_irq(phba->host->host_lock);
if (rc == IOCB_ERROR) {
lpfc_els_free_iocb(phba, elsiocb);
- return (1);
+ return 1;
}
- return (0);
+ return 0;
}
int
pring = &psli->ring[LPFC_ELS_RING]; /* ELS ring */
cmdsize = sizeof (uint32_t) + sizeof (PRLI);
- if ((elsiocb = lpfc_prep_els_iocb(phba, 0, cmdsize, oldiocb->retry,
- ndlp,
- (ELS_CMD_ACC |
- (ELS_CMD_PRLI & ~ELS_RSP_MASK)))) ==
- 0) {
- return (1);
- }
+ elsiocb = lpfc_prep_els_iocb(phba, 0, cmdsize, oldiocb->retry, ndlp,
+ (ELS_CMD_ACC | (ELS_CMD_PRLI & ~ELS_RSP_MASK)));
+ if (!elsiocb)
+ return 1;
/* Xmit PRLI ACC response tag <ulpIoTag> */
lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
spin_unlock_irq(phba->host->host_lock);
if (rc == IOCB_ERROR) {
lpfc_els_free_iocb(phba, elsiocb);
- return (1);
+ return 1;
}
- return (0);
+ return 0;
}
static int
if ((elsiocb = lpfc_prep_els_iocb(phba, 0, cmdsize, oldiocb->retry,
ndlp, ELS_CMD_ACC)) == 0) {
- return (1);
+ return 1;
}
/* Xmit RNID ACC response tag <ulpIoTag> */
spin_unlock_irq(phba->host->host_lock);
if (rc == IOCB_ERROR) {
lpfc_els_free_iocb(phba, elsiocb);
- return (1);
+ return 1;
}
- return (0);
+ return 0;
}
int
phba->fc_flag &= ~(FC_RSCN_MODE | FC_RSCN_DISCOVERY);
spin_unlock_irq(phba->host->host_lock);
lpfc_can_disctmo(phba);
- return (0);
+ return 0;
}
int
/* If we are doing a FULL RSCN rediscovery, match everything */
if (phba->fc_flag & FC_RSCN_DISCOVERY) {
- return (did);
+ return did;
}
for (i = 0; i < phba->fc_rscn_id_cnt; i++) {
}
}
}
- return (match);
+ return match;
}
static int
}
}
}
- return (0);
+ return 0;
}
static int
if (phba->hba_state < LPFC_NS_QRY) {
lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL,
newnode);
- return (0);
+ return 0;
}
/* If we are already processing an RSCN, save the received
/* send RECOVERY event for ALL nodes that match RSCN payload */
lpfc_rscn_recovery_check(phba);
- return (0);
+ return 0;
}
phba->fc_flag |= FC_RSCN_MODE;
/* send RECOVERY event for ALL nodes that match RSCN payload */
lpfc_rscn_recovery_check(phba);
- return (lpfc_els_handle_rscn(phba));
+ return lpfc_els_handle_rscn(phba);
}
int
/* To process RSCN, first compare RSCN data with NameServer */
phba->fc_ns_retry = 0;
- if ((ndlp = lpfc_findnode_did(phba, NLP_SEARCH_UNMAPPED,
- NameServer_DID))) {
+ ndlp = lpfc_findnode_did(phba, NLP_SEARCH_UNMAPPED, NameServer_DID);
+ if (ndlp) {
/* Good ndlp, issue CT Request to NameServer */
if (lpfc_ns_cmd(phba, ndlp, SLI_CTNS_GID_FT) == 0) {
/* Wait for NameServer query cmpl before we can
continue */
- return (1);
+ return 1;
}
} else {
/* If login to NameServer does not exist, issue one */
/* Good status, issue PLOGI to NameServer */
- if ((ndlp =
- lpfc_findnode_did(phba, NLP_SEARCH_ALL, NameServer_DID))) {
+ ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, NameServer_DID);
+ if (ndlp) {
/* Wait for NameServer login cmpl before we can
continue */
- return (1);
+ return 1;
}
- if ((ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL))
- == 0) {
+ ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
+ if (!ndlp) {
lpfc_els_flush_rscn(phba);
- return (0);
+ return 0;
} else {
lpfc_nlp_init(phba, ndlp, NameServer_DID);
ndlp->nlp_type |= NLP_FABRIC;
lpfc_issue_els_plogi(phba, ndlp, 0);
/* Wait for NameServer login cmpl before we can
continue */
- return (1);
+ return 1;
}
}
lpfc_els_flush_rscn(phba);
- return (0);
+ return 0;
}
static int
"%d:0113 An FLOGI ELS command x%x was received "
"from DID x%x in Loop Mode\n",
phba->brd_no, cmd, did);
- return (1);
+ return 1;
}
did = Fabric_DID;
if (!rc) {
if ((mbox = mempool_alloc(phba->mbox_mem_pool,
GFP_KERNEL)) == 0) {
- return (1);
+ return 1;
}
lpfc_linkdown(phba);
lpfc_init_link(phba, mbox,
if (rc == MBX_NOT_FINISHED) {
mempool_free( mbox, phba->mbox_mem_pool);
}
- return (1);
+ return 1;
}
else if (rc > 0) { /* greater than */
spin_lock_irq(phba->host->host_lock);
stat.un.b.lsRjtRsnCodeExp = LSEXP_SPARM_OPTIONS;
stat.un.b.vendorUnique = 0;
lpfc_els_rsp_reject(phba, stat.un.lsRjtError, cmdiocb, ndlp);
- return (1);
+ return 1;
}
/* Send back ACC */
lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL, newnode);
- return (0);
+ return 0;
}
static int
stat.un.b.vendorUnique = 0;
lpfc_els_rsp_reject(phba, stat.un.lsRjtError, cmdiocb, ndlp);
}
- return (0);
+ return 0;
}
static int
cmdsize = sizeof(RPS_RSP) + sizeof(uint32_t);
mempool_free( pmb, phba->mbox_mem_pool);
- if ((elsiocb = lpfc_prep_els_iocb(phba, 0, cmdsize, 3,
- ndlp, ELS_CMD_ACC)) == 0) {
+ elsiocb = lpfc_prep_els_iocb(phba, 0, cmdsize, lpfc_max_els_tries,
+ ndlp, ELS_CMD_ACC);
+ if (!elsiocb)
return;
- }
icmd = &elsiocb->iocb;
icmd->ulpContext = xri;
/* We will only support match on WWPN or WWNN */
if (fp->Mflags & ~(FARP_MATCH_NODE | FARP_MATCH_PORT)) {
- return (0);
+ return 0;
}
cnt = 0;
}
}
}
- return (0);
+ return 0;
}
static int
/* This node has switched fabrics. An FLOGI is required
* after the timeout
*/
- return (0);
+ return 0;
}
/* Start discovery */
lpfc_disc_start(phba);
}
- return (0);
+ return 0;
}
void
struct lpfc_dmabuf *pcmd;
uint32_t *elscmd;
uint32_t els_command;
- uint32_t remote_ID;
pring = &phba->sli.ring[LPFC_ELS_RING];
spin_lock_irq(phba->host->host_lock);
elscmd = (uint32_t *) (pcmd->virt);
els_command = *elscmd;
- if (cmd->ulpCommand == CMD_GEN_REQUEST64_CR) {
- struct lpfc_nodelist *ndlp;
-
- ndlp = lpfc_findnode_rpi(phba, cmd->ulpContext);
- remote_ID = ndlp->nlp_DID;
- if (phba->hba_state == LPFC_HBA_READY) {
- continue;
- }
- } else {
- remote_ID = cmd->un.elsreq64.remoteID;
- }
-
list_del(&piocb->list);
pring->txcmplq_cnt--;
elscmd = (uint32_t *) (pcmd->virt);
els_command = *elscmd;
- if (cmd->ulpCommand == CMD_GEN_REQUEST64_CR) {
- struct lpfc_nodelist *ndlp;
-
- ndlp = lpfc_findnode_rpi(phba, cmd->ulpContext);
- remote_ID = ndlp->nlp_DID;
- if (phba->hba_state == LPFC_HBA_READY) {
- continue;
- }
- } else {
- remote_ID = cmd->un.elsreq64.remoteID;
- }
-
list_del(&piocb->list);
pring->txcmplq_cnt--;
}
did = icmd->un.rcvels.remoteID;
- if ((ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, did)) == 0) {
+ ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, did);
+ if (!ndlp) {
/* Cannot find existing Fabric ndlp, so allocate a new one */
- if ((ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL))
- == 0) {
+ ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
+ if (!ndlp) {
lpfc_mbuf_free(phba, mp->virt, mp->phys);
kfree(mp);
drop_cmd = 1;
if (drop_cmd == 1) {
lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
"%d:0111 Dropping received ELS cmd "
- "Data: x%x x%x\n", phba->brd_no,
- icmd->ulpStatus, icmd->un.ulpWord[4]);
+ "Data: x%x x%x x%x\n", phba->brd_no,
+ icmd->ulpStatus, icmd->un.ulpWord[4],
+ icmd->ulpTimeout);
phba->fc_stat.elsRcvDrop++;
}
return;
{
struct lpfc_sli *psli;
struct lpfc_nodelist *ndlp, *next_ndlp;
- struct list_head *listp;
- struct list_head *node_list[7];
+ struct list_head *listp, *node_list[7];
LPFC_MBOXQ_t *mb;
int rc, i;
psli = &phba->sli;
- spin_lock_irq(phba->host->host_lock);
- phba->hba_state = LPFC_LINK_DOWN;
- spin_unlock_irq(phba->host->host_lock);
+ /* sysfs or selective reset may call this routine to clean up */
+ if (phba->hba_state > LPFC_LINK_DOWN) {
+ spin_lock_irq(phba->host->host_lock);
+ phba->hba_state = LPFC_LINK_DOWN;
+ spin_unlock_irq(phba->host->host_lock);
+ }
/* Clean up any firmware default rpi's */
if ((mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL))) {
continue;
list_for_each_entry_safe(ndlp, next_ndlp, listp, nlp_listp) {
- /* Fabric nodes are not handled thru state machine for
- link down */
- if (ndlp->nlp_type & NLP_FABRIC) {
- /* Remove ALL Fabric nodes except Fabric_DID */
- if (ndlp->nlp_DID != Fabric_DID) {
- /* Take it off current list and free */
- lpfc_nlp_list(phba, ndlp,
- NLP_NO_LIST);
- }
- }
- else {
-
- rc = lpfc_disc_state_machine(phba, ndlp, NULL,
- NLP_EVT_DEVICE_RECOVERY);
-
- /* Check config parameter use-adisc or FCP-2 */
- if ((rc != NLP_STE_FREED_NODE) &&
- (phba->cfg_use_adisc == 0) &&
- !(ndlp->nlp_fcp_info &
- NLP_FCP_2_DEVICE)) {
- /* We know we will have to relogin, so
- * unreglogin the rpi right now to fail
- * any outstanding I/Os quickly.
- */
- lpfc_unreg_rpi(phba, ndlp);
- }
+
+ rc = lpfc_disc_state_machine(phba, ndlp, NULL,
+ NLP_EVT_DEVICE_RECOVERY);
+
+ /* Check config parameter use-adisc or FCP-2 */
+ if ((rc != NLP_STE_FREED_NODE) &&
+ (phba->cfg_use_adisc == 0) &&
+ !(ndlp->nlp_fcp_info &
+ NLP_FCP_2_DEVICE)) {
+ /* We know we will have to relogin, so
+ * unreglogin the rpi right now to fail
+ * any outstanding I/Os quickly.
+ */
+ lpfc_unreg_rpi(phba, ndlp);
}
}
}
lpfc_linkup(struct lpfc_hba * phba)
{
struct lpfc_nodelist *ndlp, *next_ndlp;
+ struct list_head *listp, *node_list[7];
+ int i;
spin_lock_irq(phba->host->host_lock);
phba->hba_state = LPFC_LINK_UP;
spin_unlock_irq(phba->host->host_lock);
- /*
- * Clean up old Fabric NLP_FABRIC logins.
- */
- list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nlpunmap_list,
- nlp_listp) {
- if (ndlp->nlp_DID == Fabric_DID) {
- /* Take it off current list and free */
- lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
+ node_list[0] = &phba->fc_plogi_list;
+ node_list[1] = &phba->fc_adisc_list;
+ node_list[2] = &phba->fc_reglogin_list;
+ node_list[3] = &phba->fc_prli_list;
+ node_list[4] = &phba->fc_nlpunmap_list;
+ node_list[5] = &phba->fc_nlpmap_list;
+ node_list[6] = &phba->fc_npr_list;
+ for (i = 0; i < 7; i++) {
+ listp = node_list[i];
+ if (list_empty(listp))
+ continue;
+
+ list_for_each_entry_safe(ndlp, next_ndlp, listp, nlp_listp) {
+ if (phba->fc_flag & FC_LBIT) {
+ if (ndlp->nlp_type & NLP_FABRIC) {
+ /* On Linkup its safe to clean up the
+ * ndlp from Fabric connections.
+ */
+ lpfc_nlp_list(phba, ndlp,
+ NLP_UNUSED_LIST);
+ } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) {
+ /* Fail outstanding IO now since device
+ * is marked for PLOGI.
+ */
+ lpfc_unreg_rpi(phba, ndlp);
+ }
+ }
}
}
memcpy(&phba->alpa_map[0], mp->virt, 128);
+ spin_lock_irq(phba->host->host_lock);
+ if (la->pb)
+ phba->fc_flag |= FC_BYPASSED_MODE;
+ else
+ phba->fc_flag &= ~FC_BYPASSED_MODE;
+ spin_unlock_irq(phba->host->host_lock);
+
if (((phba->fc_eventTag + 1) < la->eventTag) ||
(phba->fc_eventTag == la->eventTag)) {
phba->fc_stat.LinkMultiEvent++;
*/
lpfc_issue_els_scr(phba, SCR_DID, 0);
- /* Allocate a new node instance. If the pool is empty, just
- * start the discovery process and skip the Nameserver login
- * process. This is attempted again later on. Otherwise, issue
- * a Port Login (PLOGI) to the NameServer
- */
- if ((ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL))
- == 0) {
- lpfc_disc_start(phba);
- } else {
- lpfc_nlp_init(phba, ndlp, NameServer_DID);
- ndlp->nlp_type |= NLP_FABRIC;
- ndlp->nlp_state = NLP_STE_PLOGI_ISSUE;
- lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
- lpfc_issue_els_plogi(phba, ndlp, 0);
- if (phba->cfg_fdmi_on) {
- if ((ndlp_fdmi = mempool_alloc(
- phba->nlp_mem_pool,
- GFP_KERNEL))) {
- lpfc_nlp_init(phba, ndlp_fdmi,
- FDMI_DID);
- ndlp_fdmi->nlp_type |= NLP_FABRIC;
- ndlp_fdmi->nlp_state =
- NLP_STE_PLOGI_ISSUE;
- lpfc_issue_els_plogi(phba, ndlp_fdmi,
- 0);
- }
+ ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, NameServer_DID);
+ if (!ndlp) {
+ /* Allocate a new node instance. If the pool is empty,
+ * start the discovery process and skip the Nameserver
+ * login process. This is attempted again later on.
+ * Otherwise, issue a Port Login (PLOGI) to NameServer.
+ */
+ ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_ATOMIC);
+ if (!ndlp) {
+ lpfc_disc_start(phba);
+ lpfc_mbuf_free(phba, mp->virt, mp->phys);
+ kfree(mp);
+ mempool_free( pmb, phba->mbox_mem_pool);
+ return;
+ } else {
+ lpfc_nlp_init(phba, ndlp, NameServer_DID);
+ ndlp->nlp_type |= NLP_FABRIC;
+ }
+ }
+ ndlp->nlp_state = NLP_STE_PLOGI_ISSUE;
+ lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
+ lpfc_issue_els_plogi(phba, ndlp, 0);
+ if (phba->cfg_fdmi_on) {
+ ndlp_fdmi = mempool_alloc(phba->nlp_mem_pool,
+ GFP_KERNEL);
+ if (ndlp_fdmi) {
+ lpfc_nlp_init(phba, ndlp_fdmi, FDMI_DID);
+ ndlp_fdmi->nlp_type |= NLP_FABRIC;
+ ndlp_fdmi->nlp_state = NLP_STE_PLOGI_ISSUE;
+ lpfc_issue_els_plogi(phba, ndlp_fdmi, 0);
}
}
}
lpfc_mbuf_free(phba, mp->virt, mp->phys);
kfree(mp);
mempool_free( pmb, phba->mbox_mem_pool);
-
return;
}
list_add_tail(&nlp->nlp_listp, &phba->fc_npr_list);
phba->fc_npr_cnt++;
- /*
- * Sanity check for Fabric entity.
- * Set nodev_tmo for NPR state, for Fabric use 1 sec.
- */
- if (nlp->nlp_type & NLP_FABRIC) {
- mod_timer(&nlp->nlp_tmofunc, jiffies + HZ);
- }
- else {
+ if (!(nlp->nlp_flag & NLP_NODEV_TMO)) {
mod_timer(&nlp->nlp_tmofunc,
- jiffies + HZ * phba->cfg_nodev_tmo);
+ jiffies + HZ * phba->cfg_nodev_tmo);
}
spin_lock_irq(phba->host->host_lock);
nlp->nlp_flag |= NLP_NODEV_TMO;
{
uint32_t tmo;
- tmo = ((phba->fc_ratov * 2) + 1);
+ if (phba->hba_state == LPFC_LOCAL_CFG_LINK) {
+ /* For FAN, timeout should be greater then edtov */
+ tmo = (((phba->fc_edtov + 999) / 1000) + 1);
+ } else {
+ /* Normal discovery timeout should be > then ELS/CT timeout
+ * FC spec states we need 3 * ratov for CT requests
+ */
+ tmo = ((phba->fc_ratov * 3) + 3);
+ }
mod_timer(&phba->fc_disctmo, jiffies + HZ * tmo);
spin_lock_irq(phba->host->host_lock);
struct lpfc_nodelist *ndlp;
uint32_t flg;
- if ((ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, did)) == 0) {
- if ((phba->hba_state == LPFC_HBA_READY) &&
+ ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, did);
+ if (!ndlp) {
+ if ((phba->fc_flag & FC_RSCN_MODE) &&
((lpfc_rscn_payload_check(phba, did) == 0)))
return NULL;
ndlp = (struct lpfc_nodelist *)
ndlp->nlp_flag |= NLP_NPR_2B_DISC;
return ndlp;
}
- if ((phba->hba_state == LPFC_HBA_READY) &&
- (phba->fc_flag & FC_RSCN_MODE)) {
+ if (phba->fc_flag & FC_RSCN_MODE) {
if (lpfc_rscn_payload_check(phba, did)) {
ndlp->nlp_flag |= NLP_NPR_2B_DISC;
+
+ /* Since this node is marked for discovery,
+ * delay timeout is not needed.
+ */
+ if (ndlp->nlp_flag & NLP_DELAY_TMO) {
+ ndlp->nlp_flag &= ~NLP_DELAY_TMO;
+ spin_unlock_irq(phba->host->host_lock);
+ del_timer_sync(&ndlp->nlp_delayfunc);
+ spin_lock_irq(phba->host->host_lock);
+ if (!list_empty(&ndlp->els_retry_evt.
+ evt_listp))
+ list_del_init(&ndlp->els_retry_evt.
+ evt_listp);
+ }
}
else {
ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
}
else {
flg = ndlp->nlp_flag & NLP_LIST_MASK;
- if ((flg == NLP_ADISC_LIST) ||
- (flg == NLP_PLOGI_LIST)) {
+ if ((flg == NLP_ADISC_LIST) || (flg == NLP_PLOGI_LIST))
return NULL;
- }
ndlp->nlp_state = NLP_STE_NPR_NODE;
lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
ndlp->nlp_flag |= NLP_NPR_2B_DISC;
lpfc_disc_timeout_handler(struct lpfc_hba *phba)
{
struct lpfc_sli *psli;
- struct lpfc_nodelist *ndlp;
+ struct lpfc_nodelist *ndlp, *next_ndlp;
LPFC_MBOXQ_t *clearlambox, *initlinkmbox;
int rc, clrlaerr = 0;
"%d:0221 FAN timeout\n",
phba->brd_no);
- /* Forget about FAN, Start discovery by sending a FLOGI
- * hba_state is identically LPFC_FLOGI while waiting for FLOGI
- * cmpl
- */
+ /* Start discovery by sending FLOGI, clean up old rpis */
+ list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_npr_list,
+ nlp_listp) {
+ if (ndlp->nlp_type & NLP_FABRIC) {
+ /* Clean up the ndlp on Fabric connections */
+ lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
+ }
+ else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) {
+ /* Fail outstanding IO now since device
+ * is marked for PLOGI.
+ */
+ lpfc_unreg_rpi(phba, ndlp);
+ }
+ }
phba->hba_state = LPFC_FLOGI;
lpfc_set_disctmo(phba);
lpfc_initial_flogi(phba);
* table entry for that node.
*/
if (memcmp(nn, &ndlp->nlp_nodename, sizeof (struct lpfc_name)) != 0)
- return (0);
+ return 0;
if (memcmp(pn, &ndlp->nlp_portname, sizeof (struct lpfc_name)) != 0)
- return (0);
+ return 0;
/* we match, return success */
- return (1);
+ return 1;
}
int
}
ptr = NULL;
}
- return (ptr);
+ return ptr;
}
if (!list_empty(&ndlp->els_retry_evt.evt_listp))
list_del_init(&ndlp->els_retry_evt.evt_listp);
}
- return (0);
+ return 0;
}
static int
stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC;
stat.un.b.lsRjtRsnCodeExp = LSEXP_SPARM_OPTIONS;
lpfc_els_rsp_reject(phba, stat.un.lsRjtError, cmdiocb, ndlp);
- return (0);
+ return 0;
}
icmd = &cmdiocb->iocb;
case NLP_STE_UNMAPPED_NODE:
case NLP_STE_MAPPED_NODE:
lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL, 0);
- return (1);
+ return 1;
}
if ((phba->fc_flag & FC_PT2PT)
}
ndlp->nlp_flag |= NLP_RCV_PLOGI;
lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox, 0);
- return (1);
+ return 1;
out:
stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC;
stat.un.b.lsRjtRsnCodeExp = LSEXP_OUT_OF_RESOURCE;
lpfc_els_rsp_reject(phba, stat.un.lsRjtError, cmdiocb, ndlp);
- return (0);
+ return 0;
}
static int
lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp,
NULL, 0);
}
- return (1);
+ return 1;
}
/* Reject this request because invalid parameters */
stat.un.b.lsRjtRsvd0 = 0;
spin_unlock_irq(phba->host->host_lock);
ndlp->nlp_state = NLP_STE_NPR_NODE;
lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
- return (0);
+ return 0;
}
static int
ndlp->nlp_flag |= NLP_LOGO_ACC;
lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
- if (!(ndlp->nlp_type & NLP_FABRIC)) {
+ if (!(ndlp->nlp_type & NLP_FABRIC) ||
+ (ndlp->nlp_state == NLP_STE_ADISC_ISSUE)) {
/* Only try to re-login if this is NOT a Fabric Node */
ndlp->nlp_last_elscmd = (unsigned long)ELS_CMD_PLOGI;
mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1);
spin_lock_irq(phba->host->host_lock);
ndlp->nlp_flag |= NLP_DELAY_TMO;
spin_unlock_irq(phba->host->host_lock);
- }
- ndlp->nlp_state = NLP_STE_NPR_NODE;
- lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
+ ndlp->nlp_state = NLP_STE_NPR_NODE;
+ lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
+ } else {
+ ndlp->nlp_state = NLP_STE_UNUSED_NODE;
+ lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST);
+ }
+ spin_lock_irq(phba->host->host_lock);
ndlp->nlp_flag &= ~NLP_NPR_ADISC;
+ spin_unlock_irq(phba->host->host_lock);
/* The driver has to wait until the ACC completes before it continues
* processing the LOGO. The action will resume in
* lpfc_cmpl_els_logo_acc routine. Since part of processing includes an
* unreg_login, the driver waits so the ACC does not get aborted.
*/
- return (0);
+ return 0;
}
static void
if ((phba->cfg_use_adisc == 0) &&
!(phba->fc_flag & FC_RSCN_MODE)) {
if (!(ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE))
- return (0);
+ return 0;
}
spin_lock_irq(phba->host->host_lock);
ndlp->nlp_flag |= NLP_NPR_ADISC;
spin_unlock_irq(phba->host->host_lock);
- return (1);
-}
-
-static uint32_t
-lpfc_disc_noop(struct lpfc_hba * phba,
- struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
-{
- /* This routine does nothing, just return the current state */
- return (ndlp->nlp_state);
+ return 1;
}
static uint32_t
phba->brd_no,
ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi,
ndlp->nlp_flag);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
/* Start of Discovery State Machine routines */
if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) {
ndlp->nlp_state = NLP_STE_UNUSED_NODE;
lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
- return (NLP_STE_FREED_NODE);
+ return NLP_STE_FREED_NODE;
}
static uint32_t
{
lpfc_issue_els_logo(phba, ndlp, 0);
lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
{
lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
- return (NLP_STE_FREED_NODE);
+ return NLP_STE_FREED_NODE;
}
static uint32_t
struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
{
lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
- return (NLP_STE_FREED_NODE);
+ return NLP_STE_FREED_NODE;
}
static uint32_t
lpfc_rcv_plogi(phba, ndlp, cmdiocb);
} /* if our portname was less */
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
+}
+
+static uint32_t
+lpfc_rcv_logo_plogi_issue(struct lpfc_hba * phba,
+ struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
+{
+ struct lpfc_iocbq *cmdiocb;
+
+ cmdiocb = (struct lpfc_iocbq *) arg;
+
+ /* software abort outstanding PLOGI */
+ lpfc_els_abort(phba, ndlp, 1);
+
+ lpfc_rcv_logo(phba, ndlp, cmdiocb);
+ return ndlp->nlp_state;
}
static uint32_t
ndlp->nlp_state = NLP_STE_NPR_NODE;
lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
rspiocb = cmdiocb->context_un.rsp_iocb;
if (ndlp->nlp_flag & NLP_ACC_REGLOGIN) {
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
irsp = &rspiocb->iocb;
NLP_STE_REG_LOGIN_ISSUE;
lpfc_nlp_list(phba, ndlp,
NLP_REGLOGIN_LIST);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
mempool_free(mbox, phba->mbox_mem_pool);
} else {
/* Free this node since the driver cannot login or has the wrong
sparm */
lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
- return (NLP_STE_FREED_NODE);
+ return NLP_STE_FREED_NODE;
}
static uint32_t
lpfc_els_abort(phba, ndlp, 1);
lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
- return (NLP_STE_FREED_NODE);
+ return NLP_STE_FREED_NODE;
}
static uint32_t
ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
spin_unlock_irq(phba->host->host_lock);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) {
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
ndlp->nlp_state = NLP_STE_PLOGI_ISSUE;
lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
lpfc_issue_els_plogi(phba, ndlp, 0);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_els_rsp_prli_acc(phba, cmdiocb, ndlp);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
lpfc_els_abort(phba, ndlp, 0);
lpfc_rcv_logo(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_rcv_padisc(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
/* Treat like rcv logo */
lpfc_rcv_logo(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
ndlp->nlp_state = NLP_STE_NPR_NODE;
lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
lpfc_unreg_rpi(phba, ndlp);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
if (ndlp->nlp_type & NLP_FCP_TARGET) {
ndlp->nlp_state = NLP_STE_MAPPED_NODE;
ndlp->nlp_state = NLP_STE_UNMAPPED_NODE;
lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST);
}
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
lpfc_els_abort(phba, ndlp, 1);
lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
- return (NLP_STE_FREED_NODE);
+ return NLP_STE_FREED_NODE;
}
static uint32_t
lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
spin_lock_irq(phba->host->host_lock);
ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
+ ndlp->nlp_flag |= NLP_NPR_ADISC;
spin_unlock_irq(phba->host->host_lock);
- lpfc_disc_set_adisc(phba, ndlp);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_rcv_plogi(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_els_rsp_prli_acc(phba, cmdiocb, ndlp);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_rcv_logo(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_rcv_padisc(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
ndlp->nlp_last_elscmd = (unsigned long)ELS_CMD_PLOGI;
ndlp->nlp_state = NLP_STE_NPR_NODE;
lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
ndlp->nlp_rpi = mb->un.varWords[0];
ndlp->nlp_state = NLP_STE_UNMAPPED_NODE;
lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST);
}
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
uint32_t evt)
{
lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
- return (NLP_STE_FREED_NODE);
+ return NLP_STE_FREED_NODE;
}
static uint32_t
spin_lock_irq(phba->host->host_lock);
ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
spin_unlock_irq(phba->host->host_lock);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_rcv_plogi(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_els_rsp_prli_acc(phba, cmdiocb, ndlp);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
lpfc_els_abort(phba, ndlp, 1);
lpfc_rcv_logo(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_rcv_padisc(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
/* This routine is envoked when we rcv a PRLO request from a nport
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
if (irsp->ulpStatus) {
ndlp->nlp_state = NLP_STE_UNMAPPED_NODE;
lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
/* Check out PRLI rsp */
ndlp->nlp_state = NLP_STE_MAPPED_NODE;
lpfc_nlp_list(phba, ndlp, NLP_MAPPED_LIST);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
/*! lpfc_device_rm_prli_issue
lpfc_els_abort(phba, ndlp, 1);
lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
- return (NLP_STE_FREED_NODE);
+ return NLP_STE_FREED_NODE;
}
spin_lock_irq(phba->host->host_lock);
ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
spin_unlock_irq(phba->host->host_lock);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_rcv_plogi(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
lpfc_rcv_prli(phba, ndlp, cmdiocb);
lpfc_els_rsp_prli_acc(phba, cmdiocb, ndlp);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_rcv_logo(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_rcv_padisc(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
- /* Treat like rcv logo */
- lpfc_rcv_logo(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
+ return ndlp->nlp_state;
}
static uint32_t
ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
lpfc_disc_set_adisc(phba, ndlp);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_rcv_plogi(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_els_rsp_prli_acc(phba, cmdiocb, ndlp);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_rcv_logo(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_rcv_padisc(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
/* Treat like rcv logo */
lpfc_rcv_logo(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
spin_unlock_irq(phba->host->host_lock);
lpfc_disc_set_adisc(phba, ndlp);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
/* Ignore PLOGI if we have an outstanding LOGO */
if (ndlp->nlp_flag & NLP_LOGO_SND) {
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) {
spin_lock_irq(phba->host->host_lock);
ndlp->nlp_flag &= ~(NLP_NPR_ADISC | NLP_NPR_2B_DISC);
spin_unlock_irq(phba->host->host_lock);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
/* send PLOGI immediately, move to PLOGI issue state */
lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
lpfc_issue_els_plogi(phba, ndlp, 0);
}
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) {
if (ndlp->nlp_flag & NLP_NPR_ADISC) {
+ spin_lock_irq(phba->host->host_lock);
+ ndlp->nlp_flag &= ~NLP_NPR_ADISC;
+ spin_unlock_irq(phba->host->host_lock);
ndlp->nlp_state = NLP_STE_ADISC_ISSUE;
lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST);
lpfc_issue_els_adisc(phba, ndlp, 0);
lpfc_issue_els_plogi(phba, ndlp, 0);
}
}
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
lpfc_rcv_logo(phba, ndlp, cmdiocb);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
lpfc_issue_els_plogi(phba, ndlp, 0);
}
}
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
cmdiocb = (struct lpfc_iocbq *) arg;
+ spin_lock_irq(phba->host->host_lock);
+ ndlp->nlp_flag |= NLP_LOGO_ACC;
+ spin_unlock_irq(phba->host->host_lock);
+
lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
- if (ndlp->nlp_flag & NLP_DELAY_TMO) {
- if (ndlp->nlp_last_elscmd == (unsigned long)ELS_CMD_PLOGI) {
- return (ndlp->nlp_state);
- } else {
- spin_lock_irq(phba->host->host_lock);
- ndlp->nlp_flag &= ~NLP_DELAY_TMO;
- spin_unlock_irq(phba->host->host_lock);
- del_timer_sync(&ndlp->nlp_delayfunc);
- if (!list_empty(&ndlp->els_retry_evt.evt_listp))
- list_del_init(&ndlp->els_retry_evt.evt_listp);
- }
+ if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) {
+ mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1);
+ spin_lock_irq(phba->host->host_lock);
+ ndlp->nlp_flag |= NLP_DELAY_TMO;
+ ndlp->nlp_flag &= ~NLP_NPR_ADISC;
+ spin_unlock_irq(phba->host->host_lock);
+ } else {
+ spin_lock_irq(phba->host->host_lock);
+ ndlp->nlp_flag &= ~NLP_NPR_ADISC;
+ spin_unlock_irq(phba->host->host_lock);
}
+ return ndlp->nlp_state;
+}
- ndlp->nlp_state = NLP_STE_PLOGI_ISSUE;
- lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
- lpfc_issue_els_plogi(phba, ndlp, 0);
- return (ndlp->nlp_state);
+static uint32_t
+lpfc_cmpl_plogi_npr_node(struct lpfc_hba * phba,
+ struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
+{
+ struct lpfc_iocbq *cmdiocb, *rspiocb;
+
+ cmdiocb = (struct lpfc_iocbq *) arg;
+ rspiocb = cmdiocb->context_un.rsp_iocb;
+ return ndlp->nlp_state;
+}
+
+static uint32_t
+lpfc_cmpl_prli_npr_node(struct lpfc_hba * phba,
+ struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
+{
+ struct lpfc_iocbq *cmdiocb, *rspiocb;
+
+ cmdiocb = (struct lpfc_iocbq *) arg;
+ rspiocb = cmdiocb->context_un.rsp_iocb;
+ return ndlp->nlp_state;
}
static uint32_t
{
lpfc_unreg_rpi(phba, ndlp);
/* This routine does nothing, just return the current state */
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
+}
+
+static uint32_t
+lpfc_cmpl_adisc_npr_node(struct lpfc_hba * phba,
+ struct lpfc_nodelist * ndlp, void *arg,
+ uint32_t evt)
+{
+ struct lpfc_iocbq *cmdiocb, *rspiocb;
+
+ cmdiocb = (struct lpfc_iocbq *) arg;
+ rspiocb = cmdiocb->context_un.rsp_iocb;
+ return ndlp->nlp_state;
}
static uint32_t
pmb = (LPFC_MBOXQ_t *) arg;
mb = &pmb->mb;
- ndlp->nlp_rpi = mb->un.varWords[0];
+ if (!mb->mbxStatus)
+ ndlp->nlp_rpi = mb->un.varWords[0];
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
static uint32_t
uint32_t evt)
{
lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
- return (NLP_STE_FREED_NODE);
+ return NLP_STE_FREED_NODE;
}
static uint32_t
list_del_init(&ndlp->els_retry_evt.evt_listp);
spin_unlock_irq(phba->host->host_lock);
del_timer_sync(&ndlp->nlp_delayfunc);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
spin_unlock_irq(phba->host->host_lock);
- return (ndlp->nlp_state);
+ return ndlp->nlp_state;
}
lpfc_rcv_plogi_plogi_issue, /* RCV_PLOGI PLOGI_ISSUE */
lpfc_rcv_els_plogi_issue, /* RCV_PRLI */
- lpfc_rcv_els_plogi_issue, /* RCV_LOGO */
+ lpfc_rcv_logo_plogi_issue, /* RCV_LOGO */
lpfc_rcv_els_plogi_issue, /* RCV_ADISC */
lpfc_rcv_els_plogi_issue, /* RCV_PDISC */
lpfc_rcv_els_plogi_issue, /* RCV_PRLO */
lpfc_rcv_padisc_npr_node, /* RCV_ADISC */
lpfc_rcv_padisc_npr_node, /* RCV_PDISC */
lpfc_rcv_prlo_npr_node, /* RCV_PRLO */
- lpfc_disc_noop, /* CMPL_PLOGI */
- lpfc_disc_noop, /* CMPL_PRLI */
+ lpfc_cmpl_plogi_npr_node, /* CMPL_PLOGI */
+ lpfc_cmpl_prli_npr_node, /* CMPL_PRLI */
lpfc_cmpl_logo_npr_node, /* CMPL_LOGO */
- lpfc_disc_noop, /* CMPL_ADISC */
+ lpfc_cmpl_adisc_npr_node, /* CMPL_ADISC */
lpfc_cmpl_reglogin_npr_node, /* CMPL_REG_LOGIN */
lpfc_device_rm_npr_node, /* DEVICE_RM */
lpfc_device_recov_npr_node, /* DEVICE_RECOVERY */
ndlp->nlp_flag &= ~NLP_DELAY_REMOVE;
spin_unlock_irq(phba->host->host_lock);
lpfc_nlp_remove(phba, ndlp);
- return (NLP_STE_FREED_NODE);
+ return NLP_STE_FREED_NODE;
}
if (rc == NLP_STE_FREED_NODE)
- return (NLP_STE_FREED_NODE);
+ return NLP_STE_FREED_NODE;
ndlp->nlp_state = rc;
- return (rc);
+ return rc;
}