aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_els.c
diff options
context:
space:
mode:
authorJamie Wellnitz <Jamie.Wellnitz@emulex.com>2006-02-28 19:25:23 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-02-28 18:57:23 -0600
commitc9f8735beadfba403045c4423c91bbcf594b6ef2 (patch)
tree472f7053abdfe1b18fecddf3caacdd2976e7baeb /drivers/scsi/lpfc/lpfc_els.c
parent[SCSI] lpfc 8.1.2: Add module parameter to limit number of outstanding commands per lpfc HBA (diff)
downloadlinux-dev-c9f8735beadfba403045c4423c91bbcf594b6ef2.tar.xz
linux-dev-c9f8735beadfba403045c4423c91bbcf594b6ef2.zip
[SCSI] lpfc 8.1.2: Misc FC Discovery changes :
Misc FC Discovery changes : - Added FC_BYPASSED_MODE statistic - Corrected some log message data - Fix up Discovery infrastructure to support FAN: Allow Fabric entities to flow thru DSM Fix up linkup/linkdown unregister login processing for Fabric entities Clean up Discovery code Utilize nodev_tmo for Fabric entities - Use of 3 * ratov for CT handling timeouts - Fix up DSM to make more appropriate decisions and clean up code. Signed-off-by: Jamie Wellnitz <Jamie.Wellnitz@emulex.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_els.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_els.c330
1 files changed, 144 insertions, 186 deletions
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 056f9157d2c8..70581b9eafaf 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -92,7 +92,7 @@ lpfc_els_chk_latt(struct lpfc_hba * phba)
}
}
- return (1);
+ return 1;
}
@@ -235,7 +235,7 @@ lpfc_prep_els_iocb(struct lpfc_hba * phba,
ndlp->nlp_DID, icmd->ulpIoTag, cmdSize);
}
- return (elsiocb);
+ return elsiocb;
}
@@ -446,9 +446,10 @@ lpfc_cmpl_els_flogi(struct lpfc_hba * phba,
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;
}
@@ -517,7 +518,7 @@ lpfc_issue_els_flogi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
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;
@@ -552,9 +553,9 @@ lpfc_issue_els_flogi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
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
@@ -611,29 +612,21 @@ lpfc_initial_flogi(struct lpfc_hba * phba)
{
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
@@ -675,22 +668,23 @@ lpfc_cmpl_els_plogi(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
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)) {
@@ -722,7 +716,7 @@ lpfc_cmpl_els_plogi(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
((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,
@@ -747,18 +741,11 @@ lpfc_cmpl_els_plogi(struct lpfc_hba * phba, struct lpfc_iocbq * 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
@@ -796,10 +783,10 @@ lpfc_issue_els_plogi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
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);
@@ -824,10 +811,10 @@ lpfc_issue_els_plogi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
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
@@ -851,9 +838,10 @@ lpfc_cmpl_els_prli(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
/* 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 */
@@ -906,7 +894,7 @@ lpfc_issue_els_prli(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
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;
@@ -943,11 +931,11 @@ lpfc_issue_els_prli(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
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
@@ -1016,21 +1004,22 @@ lpfc_cmpl_els_adisc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
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)) {
@@ -1054,13 +1043,10 @@ lpfc_cmpl_els_adisc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
}
/* 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);
}
@@ -1112,9 +1098,6 @@ lpfc_cmpl_els_adisc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
}
}
}
- 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;
@@ -1138,7 +1121,7 @@ lpfc_issue_els_adisc(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
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;
@@ -1163,10 +1146,10 @@ lpfc_issue_els_adisc(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
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
@@ -1190,9 +1173,10 @@ lpfc_cmpl_els_logo(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
/* 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))
@@ -1247,7 +1231,7 @@ lpfc_issue_els_logo(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
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;
@@ -1268,10 +1252,10 @@ lpfc_issue_els_logo(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
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
@@ -1286,9 +1270,10 @@ lpfc_cmpl_els_cmd(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
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);
@@ -1310,16 +1295,16 @@ lpfc_issue_els_scr(struct lpfc_hba * phba, uint32_t nportid, uint8_t retry)
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;
@@ -1339,11 +1324,11 @@ lpfc_issue_els_scr(struct lpfc_hba * phba, uint32_t nportid, uint8_t retry)
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
@@ -1363,15 +1348,15 @@ lpfc_issue_els_farpr(struct lpfc_hba * phba, uint32_t nportid, uint8_t retry)
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;
@@ -1405,11 +1390,11 @@ lpfc_issue_els_farpr(struct lpfc_hba * phba, uint32_t nportid, uint8_t retry)
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
@@ -1541,11 +1526,6 @@ lpfc_els_retry(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
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:
@@ -1654,32 +1634,32 @@ lpfc_els_retry(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
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;
}
}
@@ -1690,7 +1670,7 @@ lpfc_els_retry(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
phba->brd_no,
cmd, ndlp->nlp_DID, cmdiocb->retry, ndlp->nlp_flag);
- return (0);
+ return 0;
}
int
@@ -1780,11 +1760,12 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
/* 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)
@@ -1846,7 +1827,7 @@ lpfc_els_rsp_acc(struct lpfc_hba * phba, uint32_t flag,
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 */
@@ -1859,7 +1840,7 @@ lpfc_els_rsp_acc(struct lpfc_hba * phba, uint32_t flag,
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 */
@@ -1873,7 +1854,7 @@ lpfc_els_rsp_acc(struct lpfc_hba * phba, uint32_t flag,
memcpy(pcmd, &phba->fc_sparam, sizeof (struct serv_parm));
break;
default:
- return (1);
+ return 1;
}
if (newnode)
@@ -1889,6 +1870,9 @@ lpfc_els_rsp_acc(struct lpfc_hba * phba, uint32_t flag,
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;
@@ -1900,9 +1884,9 @@ lpfc_els_rsp_acc(struct lpfc_hba * phba, uint32_t flag,
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
@@ -1924,7 +1908,7 @@ lpfc_els_rsp_reject(struct lpfc_hba * phba, uint32_t rejectError,
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;
@@ -1952,9 +1936,9 @@ lpfc_els_rsp_reject(struct lpfc_hba * phba, uint32_t rejectError,
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
@@ -1977,7 +1961,7 @@ lpfc_els_rsp_adisc_acc(struct lpfc_hba * phba,
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> */
@@ -2010,9 +1994,9 @@ lpfc_els_rsp_adisc_acc(struct lpfc_hba * phba,
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
@@ -2034,13 +2018,10 @@ lpfc_els_rsp_prli_acc(struct lpfc_hba * phba,
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,
@@ -2090,9 +2071,9 @@ lpfc_els_rsp_prli_acc(struct lpfc_hba * phba,
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
@@ -2120,7 +2101,7 @@ lpfc_els_rsp_rnid_acc(struct lpfc_hba * phba,
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> */
@@ -2173,9 +2154,9 @@ lpfc_els_rsp_rnid_acc(struct lpfc_hba * phba,
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
@@ -2268,7 +2249,7 @@ lpfc_els_flush_rscn(struct lpfc_hba * phba)
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
@@ -2289,7 +2270,7 @@ lpfc_rscn_payload_check(struct lpfc_hba * phba, uint32_t did)
/* 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++) {
@@ -2337,7 +2318,7 @@ lpfc_rscn_payload_check(struct lpfc_hba * phba, uint32_t did)
}
}
}
- return (match);
+ return match;
}
static int
@@ -2379,7 +2360,7 @@ lpfc_rscn_recovery_check(struct lpfc_hba * phba)
}
}
}
- return (0);
+ return 0;
}
static int
@@ -2415,7 +2396,7 @@ lpfc_els_rcv_rscn(struct lpfc_hba * phba,
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
@@ -2457,7 +2438,7 @@ lpfc_els_rcv_rscn(struct lpfc_hba * phba,
/* 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;
@@ -2476,7 +2457,7 @@ lpfc_els_rcv_rscn(struct lpfc_hba * phba,
/* 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
@@ -2498,27 +2479,27 @@ lpfc_els_handle_rscn(struct lpfc_hba * phba)
/* 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;
@@ -2526,12 +2507,12 @@ lpfc_els_handle_rscn(struct lpfc_hba * phba)
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
@@ -2565,7 +2546,7 @@ lpfc_els_rcv_flogi(struct lpfc_hba * phba,
"%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;
@@ -2581,7 +2562,7 @@ lpfc_els_rcv_flogi(struct lpfc_hba * phba,
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,
@@ -2594,7 +2575,7 @@ lpfc_els_rcv_flogi(struct lpfc_hba * phba,
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);
@@ -2610,13 +2591,13 @@ lpfc_els_rcv_flogi(struct lpfc_hba * phba,
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
@@ -2654,7 +2635,7 @@ lpfc_els_rcv_rnid(struct lpfc_hba * phba,
stat.un.b.vendorUnique = 0;
lpfc_els_rsp_reject(phba, stat.un.lsRjtError, cmdiocb, ndlp);
}
- return (0);
+ return 0;
}
static int
@@ -2702,10 +2683,10 @@ lpfc_els_rsp_rps_acc(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
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;
@@ -2926,7 +2907,7 @@ lpfc_els_rcv_farp(struct lpfc_hba * phba,
/* We will only support match on WWPN or WWNN */
if (fp->Mflags & ~(FARP_MATCH_NODE | FARP_MATCH_PORT)) {
- return (0);
+ return 0;
}
cnt = 0;
@@ -2960,7 +2941,7 @@ lpfc_els_rcv_farp(struct lpfc_hba * phba,
}
}
}
- return (0);
+ return 0;
}
static int
@@ -3026,14 +3007,14 @@ lpfc_els_rcv_fan(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
/* 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
@@ -3156,7 +3137,6 @@ lpfc_els_flush_cmd(struct lpfc_hba * phba)
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);
@@ -3179,18 +3159,6 @@ lpfc_els_flush_cmd(struct lpfc_hba * phba)
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--;
@@ -3216,18 +3184,6 @@ lpfc_els_flush_cmd(struct lpfc_hba * phba)
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--;
@@ -3311,10 +3267,11 @@ lpfc_els_unsol_event(struct lpfc_hba * phba,
}
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;
@@ -3475,8 +3432,9 @@ dropit:
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;