diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_els.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_els.c | 552 |
1 files changed, 239 insertions, 313 deletions
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index a5f33a0dd4e7..638b3cd677bd 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2007 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -182,6 +182,7 @@ lpfc_prep_els_iocb(struct lpfc_hba * phba, uint8_t expectRsp, | |||
182 | icmd->un.elsreq64.bdl.bdeSize = (2 * sizeof (struct ulp_bde64)); | 182 | icmd->un.elsreq64.bdl.bdeSize = (2 * sizeof (struct ulp_bde64)); |
183 | icmd->un.elsreq64.remoteID = did; /* DID */ | 183 | icmd->un.elsreq64.remoteID = did; /* DID */ |
184 | icmd->ulpCommand = CMD_ELS_REQUEST64_CR; | 184 | icmd->ulpCommand = CMD_ELS_REQUEST64_CR; |
185 | icmd->ulpTimeout = phba->fc_ratov * 2; | ||
185 | } else { | 186 | } else { |
186 | icmd->un.elsreq64.bdl.bdeSize = sizeof (struct ulp_bde64); | 187 | icmd->un.elsreq64.bdl.bdeSize = sizeof (struct ulp_bde64); |
187 | icmd->ulpCommand = CMD_XMIT_ELS_RSP64_CX; | 188 | icmd->ulpCommand = CMD_XMIT_ELS_RSP64_CX; |
@@ -208,9 +209,9 @@ lpfc_prep_els_iocb(struct lpfc_hba * phba, uint8_t expectRsp, | |||
208 | } | 209 | } |
209 | 210 | ||
210 | /* Save for completion so we can release these resources */ | 211 | /* Save for completion so we can release these resources */ |
211 | elsiocb->context1 = (uint8_t *) ndlp; | 212 | elsiocb->context1 = lpfc_nlp_get(ndlp); |
212 | elsiocb->context2 = (uint8_t *) pcmd; | 213 | elsiocb->context2 = pcmd; |
213 | elsiocb->context3 = (uint8_t *) pbuflist; | 214 | elsiocb->context3 = pbuflist; |
214 | elsiocb->retry = retry; | 215 | elsiocb->retry = retry; |
215 | elsiocb->drvrTimeout = (phba->fc_ratov << 1) + LPFC_DRVR_TIMEOUT; | 216 | elsiocb->drvrTimeout = (phba->fc_ratov << 1) + LPFC_DRVR_TIMEOUT; |
216 | 217 | ||
@@ -222,16 +223,16 @@ lpfc_prep_els_iocb(struct lpfc_hba * phba, uint8_t expectRsp, | |||
222 | /* Xmit ELS command <elsCmd> to remote NPORT <did> */ | 223 | /* Xmit ELS command <elsCmd> to remote NPORT <did> */ |
223 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 224 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
224 | "%d:0116 Xmit ELS command x%x to remote " | 225 | "%d:0116 Xmit ELS command x%x to remote " |
225 | "NPORT x%x Data: x%x x%x\n", | 226 | "NPORT x%x I/O tag: x%x, HBA state: x%x\n", |
226 | phba->brd_no, elscmd, | 227 | phba->brd_no, elscmd, |
227 | did, icmd->ulpIoTag, phba->hba_state); | 228 | did, elsiocb->iotag, phba->hba_state); |
228 | } else { | 229 | } else { |
229 | /* Xmit ELS response <elsCmd> to remote NPORT <did> */ | 230 | /* Xmit ELS response <elsCmd> to remote NPORT <did> */ |
230 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 231 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
231 | "%d:0117 Xmit ELS response x%x to remote " | 232 | "%d:0117 Xmit ELS response x%x to remote " |
232 | "NPORT x%x Data: x%x x%x\n", | 233 | "NPORT x%x I/O tag: x%x, size: x%x\n", |
233 | phba->brd_no, elscmd, | 234 | phba->brd_no, elscmd, |
234 | ndlp->nlp_DID, icmd->ulpIoTag, cmdSize); | 235 | ndlp->nlp_DID, elsiocb->iotag, cmdSize); |
235 | } | 236 | } |
236 | 237 | ||
237 | return elsiocb; | 238 | return elsiocb; |
@@ -304,7 +305,7 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, | |||
304 | goto fail_free_mbox; | 305 | goto fail_free_mbox; |
305 | 306 | ||
306 | mbox->mbox_cmpl = lpfc_mbx_cmpl_fabric_reg_login; | 307 | mbox->mbox_cmpl = lpfc_mbx_cmpl_fabric_reg_login; |
307 | mbox->context2 = ndlp; | 308 | mbox->context2 = lpfc_nlp_get(ndlp); |
308 | 309 | ||
309 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT | MBX_STOP_IOCB); | 310 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT | MBX_STOP_IOCB); |
310 | if (rc == MBX_NOT_FINISHED) | 311 | if (rc == MBX_NOT_FINISHED) |
@@ -313,6 +314,7 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, | |||
313 | return 0; | 314 | return 0; |
314 | 315 | ||
315 | fail_issue_reg_login: | 316 | fail_issue_reg_login: |
317 | lpfc_nlp_put(ndlp); | ||
316 | mp = (struct lpfc_dmabuf *) mbox->context1; | 318 | mp = (struct lpfc_dmabuf *) mbox->context1; |
317 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 319 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
318 | kfree(mp); | 320 | kfree(mp); |
@@ -368,9 +370,9 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, | |||
368 | mempool_free(mbox, phba->mbox_mem_pool); | 370 | mempool_free(mbox, phba->mbox_mem_pool); |
369 | goto fail; | 371 | goto fail; |
370 | } | 372 | } |
371 | mempool_free(ndlp, phba->nlp_mem_pool); | 373 | lpfc_nlp_put(ndlp); |
372 | 374 | ||
373 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, PT2PT_RemoteID); | 375 | ndlp = lpfc_findnode_did(phba, PT2PT_RemoteID); |
374 | if (!ndlp) { | 376 | if (!ndlp) { |
375 | /* | 377 | /* |
376 | * Cannot find existing Fabric ndlp, so allocate a | 378 | * Cannot find existing Fabric ndlp, so allocate a |
@@ -387,12 +389,11 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, | |||
387 | sizeof(struct lpfc_name)); | 389 | sizeof(struct lpfc_name)); |
388 | memcpy(&ndlp->nlp_nodename, &sp->nodeName, | 390 | memcpy(&ndlp->nlp_nodename, &sp->nodeName, |
389 | sizeof(struct lpfc_name)); | 391 | sizeof(struct lpfc_name)); |
390 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 392 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
391 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
392 | ndlp->nlp_flag |= NLP_NPR_2B_DISC; | 393 | ndlp->nlp_flag |= NLP_NPR_2B_DISC; |
393 | } else { | 394 | } else { |
394 | /* This side will wait for the PLOGI */ | 395 | /* This side will wait for the PLOGI */ |
395 | mempool_free( ndlp, phba->nlp_mem_pool); | 396 | lpfc_nlp_put(ndlp); |
396 | } | 397 | } |
397 | 398 | ||
398 | spin_lock_irq(phba->host->host_lock); | 399 | spin_lock_irq(phba->host->host_lock); |
@@ -407,8 +408,8 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, | |||
407 | } | 408 | } |
408 | 409 | ||
409 | static void | 410 | static void |
410 | lpfc_cmpl_els_flogi(struct lpfc_hba * phba, | 411 | lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
411 | struct lpfc_iocbq * cmdiocb, struct lpfc_iocbq * rspiocb) | 412 | struct lpfc_iocbq *rspiocb) |
412 | { | 413 | { |
413 | IOCB_t *irsp = &rspiocb->iocb; | 414 | IOCB_t *irsp = &rspiocb->iocb; |
414 | struct lpfc_nodelist *ndlp = cmdiocb->context1; | 415 | struct lpfc_nodelist *ndlp = cmdiocb->context1; |
@@ -418,7 +419,7 @@ lpfc_cmpl_els_flogi(struct lpfc_hba * phba, | |||
418 | 419 | ||
419 | /* Check to see if link went down during discovery */ | 420 | /* Check to see if link went down during discovery */ |
420 | if (lpfc_els_chk_latt(phba)) { | 421 | if (lpfc_els_chk_latt(phba)) { |
421 | lpfc_nlp_remove(phba, ndlp); | 422 | lpfc_nlp_put(ndlp); |
422 | goto out; | 423 | goto out; |
423 | } | 424 | } |
424 | 425 | ||
@@ -433,13 +434,12 @@ lpfc_cmpl_els_flogi(struct lpfc_hba * phba, | |||
433 | phba->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP); | 434 | phba->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP); |
434 | spin_unlock_irq(phba->host->host_lock); | 435 | spin_unlock_irq(phba->host->host_lock); |
435 | 436 | ||
436 | /* If private loop, then allow max outstandting els to be | 437 | /* If private loop, then allow max outstanding els to be |
437 | * LPFC_MAX_DISC_THREADS (32). Scanning in the case of no | 438 | * LPFC_MAX_DISC_THREADS (32). Scanning in the case of no |
438 | * alpa map would take too long otherwise. | 439 | * alpa map would take too long otherwise. |
439 | */ | 440 | */ |
440 | if (phba->alpa_map[0] == 0) { | 441 | if (phba->alpa_map[0] == 0) { |
441 | phba->cfg_discovery_threads = | 442 | phba->cfg_discovery_threads = LPFC_MAX_DISC_THREADS; |
442 | LPFC_MAX_DISC_THREADS; | ||
443 | } | 443 | } |
444 | 444 | ||
445 | /* FLOGI failure */ | 445 | /* FLOGI failure */ |
@@ -484,7 +484,7 @@ lpfc_cmpl_els_flogi(struct lpfc_hba * phba, | |||
484 | } | 484 | } |
485 | 485 | ||
486 | flogifail: | 486 | flogifail: |
487 | lpfc_nlp_remove(phba, ndlp); | 487 | lpfc_nlp_put(ndlp); |
488 | 488 | ||
489 | if (irsp->ulpStatus != IOSTAT_LOCAL_REJECT || | 489 | if (irsp->ulpStatus != IOSTAT_LOCAL_REJECT || |
490 | (irsp->un.ulpWord[4] != IOERR_SLI_ABORTED && | 490 | (irsp->un.ulpWord[4] != IOERR_SLI_ABORTED && |
@@ -582,24 +582,8 @@ lpfc_els_abort_flogi(struct lpfc_hba * phba) | |||
582 | icmd = &iocb->iocb; | 582 | icmd = &iocb->iocb; |
583 | if (icmd->ulpCommand == CMD_ELS_REQUEST64_CR) { | 583 | if (icmd->ulpCommand == CMD_ELS_REQUEST64_CR) { |
584 | ndlp = (struct lpfc_nodelist *)(iocb->context1); | 584 | ndlp = (struct lpfc_nodelist *)(iocb->context1); |
585 | if (ndlp && (ndlp->nlp_DID == Fabric_DID)) { | 585 | if (ndlp && (ndlp->nlp_DID == Fabric_DID)) |
586 | list_del(&iocb->list); | 586 | lpfc_sli_issue_abort_iotag(phba, pring, iocb); |
587 | pring->txcmplq_cnt--; | ||
588 | |||
589 | if ((icmd->un.elsreq64.bdl.ulpIoTag32)) { | ||
590 | lpfc_sli_issue_abort_iotag32 | ||
591 | (phba, pring, iocb); | ||
592 | } | ||
593 | if (iocb->iocb_cmpl) { | ||
594 | icmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
595 | icmd->un.ulpWord[4] = | ||
596 | IOERR_SLI_ABORTED; | ||
597 | spin_unlock_irq(phba->host->host_lock); | ||
598 | (iocb->iocb_cmpl) (phba, iocb, iocb); | ||
599 | spin_lock_irq(phba->host->host_lock); | ||
600 | } else | ||
601 | lpfc_sli_release_iocbq(phba, iocb); | ||
602 | } | ||
603 | } | 587 | } |
604 | } | 588 | } |
605 | spin_unlock_irq(phba->host->host_lock); | 589 | spin_unlock_irq(phba->host->host_lock); |
@@ -608,12 +592,12 @@ lpfc_els_abort_flogi(struct lpfc_hba * phba) | |||
608 | } | 592 | } |
609 | 593 | ||
610 | int | 594 | int |
611 | lpfc_initial_flogi(struct lpfc_hba * phba) | 595 | lpfc_initial_flogi(struct lpfc_hba *phba) |
612 | { | 596 | { |
613 | struct lpfc_nodelist *ndlp; | 597 | struct lpfc_nodelist *ndlp; |
614 | 598 | ||
615 | /* First look for the Fabric ndlp */ | 599 | /* First look for the Fabric ndlp */ |
616 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, Fabric_DID); | 600 | ndlp = lpfc_findnode_did(phba, Fabric_DID); |
617 | if (!ndlp) { | 601 | if (!ndlp) { |
618 | /* Cannot find existing Fabric ndlp, so allocate a new one */ | 602 | /* Cannot find existing Fabric ndlp, so allocate a new one */ |
619 | ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); | 603 | ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); |
@@ -621,10 +605,10 @@ lpfc_initial_flogi(struct lpfc_hba * phba) | |||
621 | return 0; | 605 | return 0; |
622 | lpfc_nlp_init(phba, ndlp, Fabric_DID); | 606 | lpfc_nlp_init(phba, ndlp, Fabric_DID); |
623 | } else { | 607 | } else { |
624 | lpfc_nlp_list(phba, ndlp, NLP_JUST_DQ); | 608 | lpfc_dequeue_node(phba, ndlp); |
625 | } | 609 | } |
626 | if (lpfc_issue_els_flogi(phba, ndlp, 0)) { | 610 | if (lpfc_issue_els_flogi(phba, ndlp, 0)) { |
627 | mempool_free( ndlp, phba->nlp_mem_pool); | 611 | lpfc_nlp_put(ndlp); |
628 | } | 612 | } |
629 | return 1; | 613 | return 1; |
630 | } | 614 | } |
@@ -653,7 +637,7 @@ lpfc_more_plogi(struct lpfc_hba * phba) | |||
653 | } | 637 | } |
654 | 638 | ||
655 | static struct lpfc_nodelist * | 639 | static struct lpfc_nodelist * |
656 | lpfc_plogi_confirm_nport(struct lpfc_hba * phba, struct lpfc_dmabuf *prsp, | 640 | lpfc_plogi_confirm_nport(struct lpfc_hba *phba, struct lpfc_dmabuf *prsp, |
657 | struct lpfc_nodelist *ndlp) | 641 | struct lpfc_nodelist *ndlp) |
658 | { | 642 | { |
659 | struct lpfc_nodelist *new_ndlp; | 643 | struct lpfc_nodelist *new_ndlp; |
@@ -670,12 +654,12 @@ lpfc_plogi_confirm_nport(struct lpfc_hba * phba, struct lpfc_dmabuf *prsp, | |||
670 | 654 | ||
671 | lp = (uint32_t *) prsp->virt; | 655 | lp = (uint32_t *) prsp->virt; |
672 | sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t)); | 656 | sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t)); |
673 | memset(name, 0, sizeof (struct lpfc_name)); | 657 | memset(name, 0, sizeof(struct lpfc_name)); |
674 | 658 | ||
675 | /* Now we to find out if the NPort we are logging into, matches the WWPN | 659 | /* Now we find out if the NPort we are logging into, matches the WWPN |
676 | * we have for that ndlp. If not, we have some work to do. | 660 | * we have for that ndlp. If not, we have some work to do. |
677 | */ | 661 | */ |
678 | new_ndlp = lpfc_findnode_wwpn(phba, NLP_SEARCH_ALL, &sp->portName); | 662 | new_ndlp = lpfc_findnode_wwpn(phba, &sp->portName); |
679 | 663 | ||
680 | if (new_ndlp == ndlp) | 664 | if (new_ndlp == ndlp) |
681 | return ndlp; | 665 | return ndlp; |
@@ -695,18 +679,15 @@ lpfc_plogi_confirm_nport(struct lpfc_hba * phba, struct lpfc_dmabuf *prsp, | |||
695 | lpfc_unreg_rpi(phba, new_ndlp); | 679 | lpfc_unreg_rpi(phba, new_ndlp); |
696 | new_ndlp->nlp_DID = ndlp->nlp_DID; | 680 | new_ndlp->nlp_DID = ndlp->nlp_DID; |
697 | new_ndlp->nlp_prev_state = ndlp->nlp_prev_state; | 681 | new_ndlp->nlp_prev_state = ndlp->nlp_prev_state; |
698 | new_ndlp->nlp_state = ndlp->nlp_state; | 682 | lpfc_nlp_set_state(phba, new_ndlp, ndlp->nlp_state); |
699 | lpfc_nlp_list(phba, new_ndlp, ndlp->nlp_flag & NLP_LIST_MASK); | ||
700 | 683 | ||
701 | /* Move this back to NPR list */ | 684 | /* Move this back to NPR list */ |
702 | if (memcmp(&ndlp->nlp_portname, name, sizeof(struct lpfc_name)) == 0) { | 685 | if (memcmp(&ndlp->nlp_portname, name, sizeof(struct lpfc_name)) == 0) |
703 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 686 | lpfc_drop_node(phba, ndlp); |
704 | } | ||
705 | else { | 687 | else { |
706 | lpfc_unreg_rpi(phba, ndlp); | 688 | lpfc_unreg_rpi(phba, ndlp); |
707 | ndlp->nlp_DID = 0; /* Two ndlps cannot have the same did */ | 689 | ndlp->nlp_DID = 0; /* Two ndlps cannot have the same did */ |
708 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 690 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
709 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
710 | } | 691 | } |
711 | return new_ndlp; | 692 | return new_ndlp; |
712 | } | 693 | } |
@@ -720,13 +701,11 @@ lpfc_cmpl_els_plogi(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
720 | struct lpfc_dmabuf *prsp; | 701 | struct lpfc_dmabuf *prsp; |
721 | int disc, rc, did, type; | 702 | int disc, rc, did, type; |
722 | 703 | ||
723 | |||
724 | /* we pass cmdiocb to state machine which needs rspiocb as well */ | 704 | /* we pass cmdiocb to state machine which needs rspiocb as well */ |
725 | cmdiocb->context_un.rsp_iocb = rspiocb; | 705 | cmdiocb->context_un.rsp_iocb = rspiocb; |
726 | 706 | ||
727 | irsp = &rspiocb->iocb; | 707 | irsp = &rspiocb->iocb; |
728 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, | 708 | ndlp = lpfc_findnode_did(phba, irsp->un.elsreq64.remoteID); |
729 | irsp->un.elsreq64.remoteID); | ||
730 | if (!ndlp) | 709 | if (!ndlp) |
731 | goto out; | 710 | goto out; |
732 | 711 | ||
@@ -1354,7 +1333,7 @@ lpfc_issue_els_scr(struct lpfc_hba * phba, uint32_t nportid, uint8_t retry) | |||
1354 | elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry, ndlp, | 1333 | elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry, ndlp, |
1355 | ndlp->nlp_DID, ELS_CMD_SCR); | 1334 | ndlp->nlp_DID, ELS_CMD_SCR); |
1356 | if (!elsiocb) { | 1335 | if (!elsiocb) { |
1357 | mempool_free( ndlp, phba->nlp_mem_pool); | 1336 | lpfc_nlp_put(ndlp); |
1358 | return 1; | 1337 | return 1; |
1359 | } | 1338 | } |
1360 | 1339 | ||
@@ -1373,12 +1352,12 @@ lpfc_issue_els_scr(struct lpfc_hba * phba, uint32_t nportid, uint8_t retry) | |||
1373 | spin_lock_irq(phba->host->host_lock); | 1352 | spin_lock_irq(phba->host->host_lock); |
1374 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { | 1353 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { |
1375 | spin_unlock_irq(phba->host->host_lock); | 1354 | spin_unlock_irq(phba->host->host_lock); |
1376 | mempool_free( ndlp, phba->nlp_mem_pool); | 1355 | lpfc_nlp_put(ndlp); |
1377 | lpfc_els_free_iocb(phba, elsiocb); | 1356 | lpfc_els_free_iocb(phba, elsiocb); |
1378 | return 1; | 1357 | return 1; |
1379 | } | 1358 | } |
1380 | spin_unlock_irq(phba->host->host_lock); | 1359 | spin_unlock_irq(phba->host->host_lock); |
1381 | mempool_free( ndlp, phba->nlp_mem_pool); | 1360 | lpfc_nlp_put(ndlp); |
1382 | return 0; | 1361 | return 0; |
1383 | } | 1362 | } |
1384 | 1363 | ||
@@ -1407,7 +1386,7 @@ lpfc_issue_els_farpr(struct lpfc_hba * phba, uint32_t nportid, uint8_t retry) | |||
1407 | elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry, ndlp, | 1386 | elsiocb = lpfc_prep_els_iocb(phba, 1, cmdsize, retry, ndlp, |
1408 | ndlp->nlp_DID, ELS_CMD_RNID); | 1387 | ndlp->nlp_DID, ELS_CMD_RNID); |
1409 | if (!elsiocb) { | 1388 | if (!elsiocb) { |
1410 | mempool_free( ndlp, phba->nlp_mem_pool); | 1389 | lpfc_nlp_put(ndlp); |
1411 | return 1; | 1390 | return 1; |
1412 | } | 1391 | } |
1413 | 1392 | ||
@@ -1428,7 +1407,7 @@ lpfc_issue_els_farpr(struct lpfc_hba * phba, uint32_t nportid, uint8_t retry) | |||
1428 | 1407 | ||
1429 | memcpy(&fp->RportName, &phba->fc_portname, sizeof (struct lpfc_name)); | 1408 | memcpy(&fp->RportName, &phba->fc_portname, sizeof (struct lpfc_name)); |
1430 | memcpy(&fp->RnodeName, &phba->fc_nodename, sizeof (struct lpfc_name)); | 1409 | memcpy(&fp->RnodeName, &phba->fc_nodename, sizeof (struct lpfc_name)); |
1431 | if ((ondlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, nportid))) { | 1410 | if ((ondlp = lpfc_findnode_did(phba, nportid))) { |
1432 | memcpy(&fp->OportName, &ondlp->nlp_portname, | 1411 | memcpy(&fp->OportName, &ondlp->nlp_portname, |
1433 | sizeof (struct lpfc_name)); | 1412 | sizeof (struct lpfc_name)); |
1434 | memcpy(&fp->OnodeName, &ondlp->nlp_nodename, | 1413 | memcpy(&fp->OnodeName, &ondlp->nlp_nodename, |
@@ -1440,12 +1419,12 @@ lpfc_issue_els_farpr(struct lpfc_hba * phba, uint32_t nportid, uint8_t retry) | |||
1440 | spin_lock_irq(phba->host->host_lock); | 1419 | spin_lock_irq(phba->host->host_lock); |
1441 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { | 1420 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { |
1442 | spin_unlock_irq(phba->host->host_lock); | 1421 | spin_unlock_irq(phba->host->host_lock); |
1443 | mempool_free( ndlp, phba->nlp_mem_pool); | 1422 | lpfc_nlp_put(ndlp); |
1444 | lpfc_els_free_iocb(phba, elsiocb); | 1423 | lpfc_els_free_iocb(phba, elsiocb); |
1445 | return 1; | 1424 | return 1; |
1446 | } | 1425 | } |
1447 | spin_unlock_irq(phba->host->host_lock); | 1426 | spin_unlock_irq(phba->host->host_lock); |
1448 | mempool_free( ndlp, phba->nlp_mem_pool); | 1427 | lpfc_nlp_put(ndlp); |
1449 | return 0; | 1428 | return 0; |
1450 | } | 1429 | } |
1451 | 1430 | ||
@@ -1554,29 +1533,25 @@ lpfc_els_retry_delay_handler(struct lpfc_nodelist *ndlp) | |||
1554 | case ELS_CMD_PLOGI: | 1533 | case ELS_CMD_PLOGI: |
1555 | if(!lpfc_issue_els_plogi(phba, ndlp->nlp_DID, retry)) { | 1534 | if(!lpfc_issue_els_plogi(phba, ndlp->nlp_DID, retry)) { |
1556 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1535 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1557 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 1536 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE); |
1558 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | ||
1559 | } | 1537 | } |
1560 | break; | 1538 | break; |
1561 | case ELS_CMD_ADISC: | 1539 | case ELS_CMD_ADISC: |
1562 | if (!lpfc_issue_els_adisc(phba, ndlp, retry)) { | 1540 | if (!lpfc_issue_els_adisc(phba, ndlp, retry)) { |
1563 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1541 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1564 | ndlp->nlp_state = NLP_STE_ADISC_ISSUE; | 1542 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_ADISC_ISSUE); |
1565 | lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST); | ||
1566 | } | 1543 | } |
1567 | break; | 1544 | break; |
1568 | case ELS_CMD_PRLI: | 1545 | case ELS_CMD_PRLI: |
1569 | if (!lpfc_issue_els_prli(phba, ndlp, retry)) { | 1546 | if (!lpfc_issue_els_prli(phba, ndlp, retry)) { |
1570 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1547 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1571 | ndlp->nlp_state = NLP_STE_PRLI_ISSUE; | 1548 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PRLI_ISSUE); |
1572 | lpfc_nlp_list(phba, ndlp, NLP_PRLI_LIST); | ||
1573 | } | 1549 | } |
1574 | break; | 1550 | break; |
1575 | case ELS_CMD_LOGO: | 1551 | case ELS_CMD_LOGO: |
1576 | if (!lpfc_issue_els_logo(phba, ndlp, retry)) { | 1552 | if (!lpfc_issue_els_logo(phba, ndlp, retry)) { |
1577 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1553 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1578 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1554 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1579 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1580 | } | 1555 | } |
1581 | break; | 1556 | break; |
1582 | } | 1557 | } |
@@ -1614,12 +1589,12 @@ lpfc_els_retry(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1614 | cmd = *elscmd++; | 1589 | cmd = *elscmd++; |
1615 | } | 1590 | } |
1616 | 1591 | ||
1617 | if(ndlp) | 1592 | if (ndlp) |
1618 | did = ndlp->nlp_DID; | 1593 | did = ndlp->nlp_DID; |
1619 | else { | 1594 | else { |
1620 | /* We should only hit this case for retrying PLOGI */ | 1595 | /* We should only hit this case for retrying PLOGI */ |
1621 | did = irsp->un.elsreq64.remoteID; | 1596 | did = irsp->un.elsreq64.remoteID; |
1622 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, did); | 1597 | ndlp = lpfc_findnode_did(phba, did); |
1623 | if (!ndlp && (cmd != ELS_CMD_PLOGI)) | 1598 | if (!ndlp && (cmd != ELS_CMD_PLOGI)) |
1624 | return 1; | 1599 | return 1; |
1625 | } | 1600 | } |
@@ -1746,8 +1721,7 @@ lpfc_els_retry(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1746 | ndlp->nlp_flag |= NLP_DELAY_TMO; | 1721 | ndlp->nlp_flag |= NLP_DELAY_TMO; |
1747 | 1722 | ||
1748 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1723 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1749 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1724 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1750 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1751 | ndlp->nlp_last_elscmd = cmd; | 1725 | ndlp->nlp_last_elscmd = cmd; |
1752 | 1726 | ||
1753 | return 1; | 1727 | return 1; |
@@ -1759,27 +1733,24 @@ lpfc_els_retry(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1759 | case ELS_CMD_PLOGI: | 1733 | case ELS_CMD_PLOGI: |
1760 | if (ndlp) { | 1734 | if (ndlp) { |
1761 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1735 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1762 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 1736 | lpfc_nlp_set_state(phba, ndlp, |
1763 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | 1737 | NLP_STE_PLOGI_ISSUE); |
1764 | } | 1738 | } |
1765 | lpfc_issue_els_plogi(phba, did, cmdiocb->retry); | 1739 | lpfc_issue_els_plogi(phba, did, cmdiocb->retry); |
1766 | return 1; | 1740 | return 1; |
1767 | case ELS_CMD_ADISC: | 1741 | case ELS_CMD_ADISC: |
1768 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1742 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1769 | ndlp->nlp_state = NLP_STE_ADISC_ISSUE; | 1743 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_ADISC_ISSUE); |
1770 | lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST); | ||
1771 | lpfc_issue_els_adisc(phba, ndlp, cmdiocb->retry); | 1744 | lpfc_issue_els_adisc(phba, ndlp, cmdiocb->retry); |
1772 | return 1; | 1745 | return 1; |
1773 | case ELS_CMD_PRLI: | 1746 | case ELS_CMD_PRLI: |
1774 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1747 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1775 | ndlp->nlp_state = NLP_STE_PRLI_ISSUE; | 1748 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PRLI_ISSUE); |
1776 | lpfc_nlp_list(phba, ndlp, NLP_PRLI_LIST); | ||
1777 | lpfc_issue_els_prli(phba, ndlp, cmdiocb->retry); | 1749 | lpfc_issue_els_prli(phba, ndlp, cmdiocb->retry); |
1778 | return 1; | 1750 | return 1; |
1779 | case ELS_CMD_LOGO: | 1751 | case ELS_CMD_LOGO: |
1780 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1752 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1781 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1753 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1782 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1783 | lpfc_issue_els_logo(phba, ndlp, cmdiocb->retry); | 1754 | lpfc_issue_els_logo(phba, ndlp, cmdiocb->retry); |
1784 | return 1; | 1755 | return 1; |
1785 | } | 1756 | } |
@@ -1796,10 +1767,14 @@ lpfc_els_retry(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1796 | } | 1767 | } |
1797 | 1768 | ||
1798 | int | 1769 | int |
1799 | lpfc_els_free_iocb(struct lpfc_hba * phba, struct lpfc_iocbq * elsiocb) | 1770 | lpfc_els_free_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *elsiocb) |
1800 | { | 1771 | { |
1801 | struct lpfc_dmabuf *buf_ptr, *buf_ptr1; | 1772 | struct lpfc_dmabuf *buf_ptr, *buf_ptr1; |
1802 | 1773 | ||
1774 | if (elsiocb->context1) { | ||
1775 | lpfc_nlp_put(elsiocb->context1); | ||
1776 | elsiocb->context1 = NULL; | ||
1777 | } | ||
1803 | /* context2 = cmd, context2->next = rsp, context3 = bpl */ | 1778 | /* context2 = cmd, context2->next = rsp, context3 = bpl */ |
1804 | if (elsiocb->context2) { | 1779 | if (elsiocb->context2) { |
1805 | buf_ptr1 = (struct lpfc_dmabuf *) elsiocb->context2; | 1780 | buf_ptr1 = (struct lpfc_dmabuf *) elsiocb->context2; |
@@ -1843,7 +1818,7 @@ lpfc_cmpl_els_logo_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1843 | 1818 | ||
1844 | switch (ndlp->nlp_state) { | 1819 | switch (ndlp->nlp_state) { |
1845 | case NLP_STE_UNUSED_NODE: /* node is just allocated */ | 1820 | case NLP_STE_UNUSED_NODE: /* node is just allocated */ |
1846 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1821 | lpfc_drop_node(phba, ndlp); |
1847 | break; | 1822 | break; |
1848 | case NLP_STE_NPR_NODE: /* NPort Recovery mode */ | 1823 | case NLP_STE_NPR_NODE: /* NPort Recovery mode */ |
1849 | lpfc_unreg_rpi(phba, ndlp); | 1824 | lpfc_unreg_rpi(phba, ndlp); |
@@ -1856,8 +1831,8 @@ lpfc_cmpl_els_logo_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1856 | } | 1831 | } |
1857 | 1832 | ||
1858 | static void | 1833 | static void |
1859 | lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | 1834 | lpfc_cmpl_els_acc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
1860 | struct lpfc_iocbq * rspiocb) | 1835 | struct lpfc_iocbq *rspiocb) |
1861 | { | 1836 | { |
1862 | IOCB_t *irsp; | 1837 | IOCB_t *irsp; |
1863 | struct lpfc_nodelist *ndlp; | 1838 | struct lpfc_nodelist *ndlp; |
@@ -1872,14 +1847,14 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1872 | 1847 | ||
1873 | 1848 | ||
1874 | /* Check to see if link went down during discovery */ | 1849 | /* Check to see if link went down during discovery */ |
1875 | if ((lpfc_els_chk_latt(phba)) || !ndlp) { | 1850 | if (lpfc_els_chk_latt(phba) || !ndlp) { |
1876 | if (mbox) { | 1851 | if (mbox) { |
1877 | mp = (struct lpfc_dmabuf *) mbox->context1; | 1852 | mp = (struct lpfc_dmabuf *) mbox->context1; |
1878 | if (mp) { | 1853 | if (mp) { |
1879 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 1854 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
1880 | kfree(mp); | 1855 | kfree(mp); |
1881 | } | 1856 | } |
1882 | mempool_free( mbox, phba->mbox_mem_pool); | 1857 | mempool_free(mbox, phba->mbox_mem_pool); |
1883 | } | 1858 | } |
1884 | goto out; | 1859 | goto out; |
1885 | } | 1860 | } |
@@ -1899,15 +1874,15 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1899 | && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) { | 1874 | && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) { |
1900 | lpfc_unreg_rpi(phba, ndlp); | 1875 | lpfc_unreg_rpi(phba, ndlp); |
1901 | mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; | 1876 | mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; |
1902 | mbox->context2 = ndlp; | 1877 | mbox->context2 = lpfc_nlp_get(ndlp); |
1903 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1878 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1904 | ndlp->nlp_state = NLP_STE_REG_LOGIN_ISSUE; | 1879 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_REG_LOGIN_ISSUE); |
1905 | lpfc_nlp_list(phba, ndlp, NLP_REGLOGIN_LIST); | ||
1906 | if (lpfc_sli_issue_mbox(phba, mbox, | 1880 | if (lpfc_sli_issue_mbox(phba, mbox, |
1907 | (MBX_NOWAIT | MBX_STOP_IOCB)) | 1881 | (MBX_NOWAIT | MBX_STOP_IOCB)) |
1908 | != MBX_NOT_FINISHED) { | 1882 | != MBX_NOT_FINISHED) { |
1909 | goto out; | 1883 | goto out; |
1910 | } | 1884 | } |
1885 | lpfc_nlp_put(ndlp); | ||
1911 | /* NOTE: we should have messages for unsuccessful | 1886 | /* NOTE: we should have messages for unsuccessful |
1912 | reglogin */ | 1887 | reglogin */ |
1913 | } else { | 1888 | } else { |
@@ -1917,7 +1892,7 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1917 | (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) || | 1892 | (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) || |
1918 | (irsp->un.ulpWord[4] == IOERR_SLI_DOWN)))) { | 1893 | (irsp->un.ulpWord[4] == IOERR_SLI_DOWN)))) { |
1919 | if (ndlp->nlp_flag & NLP_ACC_REGLOGIN) { | 1894 | if (ndlp->nlp_flag & NLP_ACC_REGLOGIN) { |
1920 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1895 | lpfc_drop_node(phba, ndlp); |
1921 | ndlp = NULL; | 1896 | ndlp = NULL; |
1922 | } | 1897 | } |
1923 | } | 1898 | } |
@@ -2012,15 +1987,16 @@ lpfc_els_rsp_acc(struct lpfc_hba * phba, uint32_t flag, | |||
2012 | return 1; | 1987 | return 1; |
2013 | } | 1988 | } |
2014 | 1989 | ||
2015 | if (newnode) | 1990 | if (newnode) { |
1991 | lpfc_nlp_put(ndlp); | ||
2016 | elsiocb->context1 = NULL; | 1992 | elsiocb->context1 = NULL; |
1993 | } | ||
2017 | 1994 | ||
2018 | /* Xmit ELS ACC response tag <ulpIoTag> */ | 1995 | /* Xmit ELS ACC response tag <ulpIoTag> */ |
2019 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 1996 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
2020 | "%d:0128 Xmit ELS ACC response tag x%x " | 1997 | "%d:0128 Xmit ELS ACC response tag x%x, XRI: x%x, " |
2021 | "Data: x%x x%x x%x x%x x%x\n", | 1998 | "DID: x%x, nlp_flag: x%x nlp_state: x%x RPI: x%x\n", |
2022 | phba->brd_no, | 1999 | phba->brd_no, elsiocb->iotag, |
2023 | elsiocb->iocb.ulpIoTag, | ||
2024 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 2000 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, |
2025 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2001 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); |
2026 | 2002 | ||
@@ -2077,10 +2053,9 @@ lpfc_els_rsp_reject(struct lpfc_hba * phba, uint32_t rejectError, | |||
2077 | 2053 | ||
2078 | /* Xmit ELS RJT <err> response tag <ulpIoTag> */ | 2054 | /* Xmit ELS RJT <err> response tag <ulpIoTag> */ |
2079 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2055 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
2080 | "%d:0129 Xmit ELS RJT x%x response tag x%x " | 2056 | "%d:0129 Xmit ELS RJT x%x response tag x%x xri x%x, " |
2081 | "Data: x%x x%x x%x x%x x%x\n", | 2057 | "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", |
2082 | phba->brd_no, | 2058 | phba->brd_no, rejectError, elsiocb->iotag, |
2083 | rejectError, elsiocb->iocb.ulpIoTag, | ||
2084 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 2059 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, |
2085 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2060 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); |
2086 | 2061 | ||
@@ -2119,18 +2094,18 @@ lpfc_els_rsp_adisc_acc(struct lpfc_hba * phba, | |||
2119 | if (!elsiocb) | 2094 | if (!elsiocb) |
2120 | return 1; | 2095 | return 1; |
2121 | 2096 | ||
2097 | icmd = &elsiocb->iocb; | ||
2098 | oldcmd = &oldiocb->iocb; | ||
2099 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ | ||
2100 | |||
2122 | /* Xmit ADISC ACC response tag <ulpIoTag> */ | 2101 | /* Xmit ADISC ACC response tag <ulpIoTag> */ |
2123 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2102 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
2124 | "%d:0130 Xmit ADISC ACC response tag x%x " | 2103 | "%d:0130 Xmit ADISC ACC response iotag x%x xri: " |
2125 | "Data: x%x x%x x%x x%x x%x\n", | 2104 | "x%x, did x%x, nlp_flag x%x, nlp_state x%x rpi x%x\n", |
2126 | phba->brd_no, | 2105 | phba->brd_no, elsiocb->iotag, |
2127 | elsiocb->iocb.ulpIoTag, | ||
2128 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 2106 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, |
2129 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2107 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); |
2130 | 2108 | ||
2131 | icmd = &elsiocb->iocb; | ||
2132 | oldcmd = &oldiocb->iocb; | ||
2133 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ | ||
2134 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); | 2109 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); |
2135 | 2110 | ||
2136 | *((uint32_t *) (pcmd)) = ELS_CMD_ACC; | 2111 | *((uint32_t *) (pcmd)) = ELS_CMD_ACC; |
@@ -2155,8 +2130,8 @@ lpfc_els_rsp_adisc_acc(struct lpfc_hba * phba, | |||
2155 | } | 2130 | } |
2156 | 2131 | ||
2157 | int | 2132 | int |
2158 | lpfc_els_rsp_prli_acc(struct lpfc_hba * phba, | 2133 | lpfc_els_rsp_prli_acc(struct lpfc_hba *phba, struct lpfc_iocbq *oldiocb, |
2159 | struct lpfc_iocbq * oldiocb, struct lpfc_nodelist * ndlp) | 2134 | struct lpfc_nodelist *ndlp) |
2160 | { | 2135 | { |
2161 | PRLI *npr; | 2136 | PRLI *npr; |
2162 | lpfc_vpd_t *vpd; | 2137 | lpfc_vpd_t *vpd; |
@@ -2178,18 +2153,18 @@ lpfc_els_rsp_prli_acc(struct lpfc_hba * phba, | |||
2178 | if (!elsiocb) | 2153 | if (!elsiocb) |
2179 | return 1; | 2154 | return 1; |
2180 | 2155 | ||
2156 | icmd = &elsiocb->iocb; | ||
2157 | oldcmd = &oldiocb->iocb; | ||
2158 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ | ||
2159 | |||
2181 | /* Xmit PRLI ACC response tag <ulpIoTag> */ | 2160 | /* Xmit PRLI ACC response tag <ulpIoTag> */ |
2182 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2161 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
2183 | "%d:0131 Xmit PRLI ACC response tag x%x " | 2162 | "%d:0131 Xmit PRLI ACC response tag x%x xri x%x, " |
2184 | "Data: x%x x%x x%x x%x x%x\n", | 2163 | "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", |
2185 | phba->brd_no, | 2164 | phba->brd_no, elsiocb->iotag, |
2186 | elsiocb->iocb.ulpIoTag, | ||
2187 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 2165 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, |
2188 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2166 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); |
2189 | 2167 | ||
2190 | icmd = &elsiocb->iocb; | ||
2191 | oldcmd = &oldiocb->iocb; | ||
2192 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ | ||
2193 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); | 2168 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); |
2194 | 2169 | ||
2195 | *((uint32_t *) (pcmd)) = (ELS_CMD_ACC | (ELS_CMD_PRLI & ~ELS_RSP_MASK)); | 2170 | *((uint32_t *) (pcmd)) = (ELS_CMD_ACC | (ELS_CMD_PRLI & ~ELS_RSP_MASK)); |
@@ -2232,9 +2207,8 @@ lpfc_els_rsp_prli_acc(struct lpfc_hba * phba, | |||
2232 | } | 2207 | } |
2233 | 2208 | ||
2234 | static int | 2209 | static int |
2235 | lpfc_els_rsp_rnid_acc(struct lpfc_hba * phba, | 2210 | lpfc_els_rsp_rnid_acc(struct lpfc_hba *phba, uint8_t format, |
2236 | uint8_t format, | 2211 | struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp) |
2237 | struct lpfc_iocbq * oldiocb, struct lpfc_nodelist * ndlp) | ||
2238 | { | 2212 | { |
2239 | RNID *rn; | 2213 | RNID *rn; |
2240 | IOCB_t *icmd; | 2214 | IOCB_t *icmd; |
@@ -2259,17 +2233,17 @@ lpfc_els_rsp_rnid_acc(struct lpfc_hba * phba, | |||
2259 | if (!elsiocb) | 2233 | if (!elsiocb) |
2260 | return 1; | 2234 | return 1; |
2261 | 2235 | ||
2236 | icmd = &elsiocb->iocb; | ||
2237 | oldcmd = &oldiocb->iocb; | ||
2238 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ | ||
2239 | |||
2262 | /* Xmit RNID ACC response tag <ulpIoTag> */ | 2240 | /* Xmit RNID ACC response tag <ulpIoTag> */ |
2263 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2241 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
2264 | "%d:0132 Xmit RNID ACC response tag x%x " | 2242 | "%d:0132 Xmit RNID ACC response tag x%x " |
2265 | "Data: x%x\n", | 2243 | "xri x%x\n", |
2266 | phba->brd_no, | 2244 | phba->brd_no, elsiocb->iotag, |
2267 | elsiocb->iocb.ulpIoTag, | ||
2268 | elsiocb->iocb.ulpContext); | 2245 | elsiocb->iocb.ulpContext); |
2269 | 2246 | ||
2270 | icmd = &elsiocb->iocb; | ||
2271 | oldcmd = &oldiocb->iocb; | ||
2272 | icmd->ulpContext = oldcmd->ulpContext; /* Xri */ | ||
2273 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); | 2247 | pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt); |
2274 | 2248 | ||
2275 | *((uint32_t *) (pcmd)) = ELS_CMD_ACC; | 2249 | *((uint32_t *) (pcmd)) = ELS_CMD_ACC; |
@@ -2301,6 +2275,7 @@ lpfc_els_rsp_rnid_acc(struct lpfc_hba * phba, | |||
2301 | 2275 | ||
2302 | phba->fc_stat.elsXmitACC++; | 2276 | phba->fc_stat.elsXmitACC++; |
2303 | elsiocb->iocb_cmpl = lpfc_cmpl_els_acc; | 2277 | elsiocb->iocb_cmpl = lpfc_cmpl_els_acc; |
2278 | lpfc_nlp_put(ndlp); | ||
2304 | elsiocb->context1 = NULL; /* Don't need ndlp for cmpl, | 2279 | elsiocb->context1 = NULL; /* Don't need ndlp for cmpl, |
2305 | * it could be freed */ | 2280 | * it could be freed */ |
2306 | 2281 | ||
@@ -2315,32 +2290,31 @@ lpfc_els_rsp_rnid_acc(struct lpfc_hba * phba, | |||
2315 | } | 2290 | } |
2316 | 2291 | ||
2317 | int | 2292 | int |
2318 | lpfc_els_disc_adisc(struct lpfc_hba * phba) | 2293 | lpfc_els_disc_adisc(struct lpfc_hba *phba) |
2319 | { | 2294 | { |
2320 | int sentadisc; | 2295 | int sentadisc; |
2321 | struct lpfc_nodelist *ndlp, *next_ndlp; | 2296 | struct lpfc_nodelist *ndlp, *next_ndlp; |
2322 | 2297 | ||
2323 | sentadisc = 0; | 2298 | sentadisc = 0; |
2324 | /* go thru NPR list and issue any remaining ELS ADISCs */ | 2299 | /* go thru NPR nodes and issue any remaining ELS ADISCs */ |
2325 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_npr_list, | 2300 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, nlp_listp) { |
2326 | nlp_listp) { | 2301 | if (ndlp->nlp_state == NLP_STE_NPR_NODE && |
2327 | if (ndlp->nlp_flag & NLP_NPR_2B_DISC) { | 2302 | (ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 && |
2328 | if (ndlp->nlp_flag & NLP_NPR_ADISC) { | 2303 | (ndlp->nlp_flag & NLP_NPR_ADISC) != 0) { |
2329 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; | 2304 | spin_lock_irq(phba->host->host_lock); |
2330 | ndlp->nlp_prev_state = ndlp->nlp_state; | 2305 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; |
2331 | ndlp->nlp_state = NLP_STE_ADISC_ISSUE; | 2306 | spin_unlock_irq(phba->host->host_lock); |
2332 | lpfc_nlp_list(phba, ndlp, | 2307 | ndlp->nlp_prev_state = ndlp->nlp_state; |
2333 | NLP_ADISC_LIST); | 2308 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_ADISC_ISSUE); |
2334 | lpfc_issue_els_adisc(phba, ndlp, 0); | 2309 | lpfc_issue_els_adisc(phba, ndlp, 0); |
2335 | sentadisc++; | 2310 | sentadisc++; |
2336 | phba->num_disc_nodes++; | 2311 | phba->num_disc_nodes++; |
2337 | if (phba->num_disc_nodes >= | 2312 | if (phba->num_disc_nodes >= |
2338 | phba->cfg_discovery_threads) { | 2313 | phba->cfg_discovery_threads) { |
2339 | spin_lock_irq(phba->host->host_lock); | 2314 | spin_lock_irq(phba->host->host_lock); |
2340 | phba->fc_flag |= FC_NLP_MORE; | 2315 | phba->fc_flag |= FC_NLP_MORE; |
2341 | spin_unlock_irq(phba->host->host_lock); | 2316 | spin_unlock_irq(phba->host->host_lock); |
2342 | break; | 2317 | break; |
2343 | } | ||
2344 | } | 2318 | } |
2345 | } | 2319 | } |
2346 | } | 2320 | } |
@@ -2360,24 +2334,22 @@ lpfc_els_disc_plogi(struct lpfc_hba * phba) | |||
2360 | 2334 | ||
2361 | sentplogi = 0; | 2335 | sentplogi = 0; |
2362 | /* go thru NPR list and issue any remaining ELS PLOGIs */ | 2336 | /* go thru NPR list and issue any remaining ELS PLOGIs */ |
2363 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_npr_list, | 2337 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, nlp_listp) { |
2364 | nlp_listp) { | 2338 | if (ndlp->nlp_state == NLP_STE_NPR_NODE && |
2365 | if ((ndlp->nlp_flag & NLP_NPR_2B_DISC) && | 2339 | (ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 && |
2366 | (!(ndlp->nlp_flag & NLP_DELAY_TMO))) { | 2340 | (ndlp->nlp_flag & NLP_DELAY_TMO) == 0 && |
2367 | if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { | 2341 | (ndlp->nlp_flag & NLP_NPR_ADISC) == 0) { |
2368 | ndlp->nlp_prev_state = ndlp->nlp_state; | 2342 | ndlp->nlp_prev_state = ndlp->nlp_state; |
2369 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 2343 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE); |
2370 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | 2344 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); |
2371 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); | 2345 | sentplogi++; |
2372 | sentplogi++; | 2346 | phba->num_disc_nodes++; |
2373 | phba->num_disc_nodes++; | 2347 | if (phba->num_disc_nodes >= |
2374 | if (phba->num_disc_nodes >= | 2348 | phba->cfg_discovery_threads) { |
2375 | phba->cfg_discovery_threads) { | 2349 | spin_lock_irq(phba->host->host_lock); |
2376 | spin_lock_irq(phba->host->host_lock); | 2350 | phba->fc_flag |= FC_NLP_MORE; |
2377 | phba->fc_flag |= FC_NLP_MORE; | 2351 | spin_unlock_irq(phba->host->host_lock); |
2378 | spin_unlock_irq(phba->host->host_lock); | 2352 | break; |
2379 | break; | ||
2380 | } | ||
2381 | } | 2353 | } |
2382 | } | 2354 | } |
2383 | } | 2355 | } |
@@ -2479,42 +2451,30 @@ lpfc_rscn_payload_check(struct lpfc_hba * phba, uint32_t did) | |||
2479 | } | 2451 | } |
2480 | 2452 | ||
2481 | static int | 2453 | static int |
2482 | lpfc_rscn_recovery_check(struct lpfc_hba * phba) | 2454 | lpfc_rscn_recovery_check(struct lpfc_hba *phba) |
2483 | { | 2455 | { |
2484 | struct lpfc_nodelist *ndlp = NULL, *next_ndlp; | 2456 | struct lpfc_nodelist *ndlp = NULL; |
2485 | struct list_head *listp; | ||
2486 | struct list_head *node_list[7]; | ||
2487 | int i; | ||
2488 | 2457 | ||
2489 | /* Look at all nodes effected by pending RSCNs and move | 2458 | /* Look at all nodes effected by pending RSCNs and move |
2490 | * them to NPR list. | 2459 | * them to NPR state. |
2491 | */ | 2460 | */ |
2492 | node_list[0] = &phba->fc_npr_list; /* MUST do this list first */ | ||
2493 | node_list[1] = &phba->fc_nlpmap_list; | ||
2494 | node_list[2] = &phba->fc_nlpunmap_list; | ||
2495 | node_list[3] = &phba->fc_prli_list; | ||
2496 | node_list[4] = &phba->fc_reglogin_list; | ||
2497 | node_list[5] = &phba->fc_adisc_list; | ||
2498 | node_list[6] = &phba->fc_plogi_list; | ||
2499 | for (i = 0; i < 7; i++) { | ||
2500 | listp = node_list[i]; | ||
2501 | if (list_empty(listp)) | ||
2502 | continue; | ||
2503 | 2461 | ||
2504 | list_for_each_entry_safe(ndlp, next_ndlp, listp, nlp_listp) { | 2462 | list_for_each_entry(ndlp, &phba->fc_nodes, nlp_listp) { |
2505 | if (!(lpfc_rscn_payload_check(phba, ndlp->nlp_DID))) | 2463 | if (ndlp->nlp_state == NLP_STE_UNUSED_NODE || |
2506 | continue; | 2464 | lpfc_rscn_payload_check(phba, ndlp->nlp_DID) == 0) |
2465 | continue; | ||
2507 | 2466 | ||
2508 | lpfc_disc_state_machine(phba, ndlp, NULL, | 2467 | lpfc_disc_state_machine(phba, ndlp, NULL, |
2509 | NLP_EVT_DEVICE_RECOVERY); | 2468 | NLP_EVT_DEVICE_RECOVERY); |
2510 | 2469 | ||
2511 | /* Make sure NLP_DELAY_TMO is NOT running | 2470 | /* |
2512 | * after a device recovery event. | 2471 | * Make sure NLP_DELAY_TMO is NOT running after a device |
2513 | */ | 2472 | * recovery event. |
2514 | if (ndlp->nlp_flag & NLP_DELAY_TMO) | 2473 | */ |
2515 | lpfc_cancel_retry_delay_tmo(phba, ndlp); | 2474 | if (ndlp->nlp_flag & NLP_DELAY_TMO) |
2516 | } | 2475 | lpfc_cancel_retry_delay_tmo(phba, ndlp); |
2517 | } | 2476 | } |
2477 | |||
2518 | return 0; | 2478 | return 0; |
2519 | } | 2479 | } |
2520 | 2480 | ||
@@ -2639,8 +2599,8 @@ lpfc_els_handle_rscn(struct lpfc_hba * phba) | |||
2639 | 2599 | ||
2640 | /* To process RSCN, first compare RSCN data with NameServer */ | 2600 | /* To process RSCN, first compare RSCN data with NameServer */ |
2641 | phba->fc_ns_retry = 0; | 2601 | phba->fc_ns_retry = 0; |
2642 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_UNMAPPED, NameServer_DID); | 2602 | ndlp = lpfc_findnode_did(phba, NameServer_DID); |
2643 | if (ndlp) { | 2603 | if (ndlp && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) { |
2644 | /* Good ndlp, issue CT Request to NameServer */ | 2604 | /* Good ndlp, issue CT Request to NameServer */ |
2645 | if (lpfc_ns_cmd(phba, ndlp, SLI_CTNS_GID_FT) == 0) { | 2605 | if (lpfc_ns_cmd(phba, ndlp, SLI_CTNS_GID_FT) == 0) { |
2646 | /* Wait for NameServer query cmpl before we can | 2606 | /* Wait for NameServer query cmpl before we can |
@@ -2650,7 +2610,7 @@ lpfc_els_handle_rscn(struct lpfc_hba * phba) | |||
2650 | } else { | 2610 | } else { |
2651 | /* If login to NameServer does not exist, issue one */ | 2611 | /* If login to NameServer does not exist, issue one */ |
2652 | /* Good status, issue PLOGI to NameServer */ | 2612 | /* Good status, issue PLOGI to NameServer */ |
2653 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, NameServer_DID); | 2613 | ndlp = lpfc_findnode_did(phba, NameServer_DID); |
2654 | if (ndlp) { | 2614 | if (ndlp) { |
2655 | /* Wait for NameServer login cmpl before we can | 2615 | /* Wait for NameServer login cmpl before we can |
2656 | continue */ | 2616 | continue */ |
@@ -2664,8 +2624,7 @@ lpfc_els_handle_rscn(struct lpfc_hba * phba) | |||
2664 | lpfc_nlp_init(phba, ndlp, NameServer_DID); | 2624 | lpfc_nlp_init(phba, ndlp, NameServer_DID); |
2665 | ndlp->nlp_type |= NLP_FABRIC; | 2625 | ndlp->nlp_type |= NLP_FABRIC; |
2666 | ndlp->nlp_prev_state = ndlp->nlp_state; | 2626 | ndlp->nlp_prev_state = ndlp->nlp_state; |
2667 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 2627 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE); |
2668 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | ||
2669 | lpfc_issue_els_plogi(phba, NameServer_DID, 0); | 2628 | lpfc_issue_els_plogi(phba, NameServer_DID, 0); |
2670 | /* Wait for NameServer login cmpl before we can | 2629 | /* Wait for NameServer login cmpl before we can |
2671 | continue */ | 2630 | continue */ |
@@ -2734,8 +2693,9 @@ lpfc_els_rcv_flogi(struct lpfc_hba * phba, | |||
2734 | mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 2693 | mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
2735 | rc = lpfc_sli_issue_mbox | 2694 | rc = lpfc_sli_issue_mbox |
2736 | (phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB)); | 2695 | (phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB)); |
2696 | lpfc_set_loopback_flag(phba); | ||
2737 | if (rc == MBX_NOT_FINISHED) { | 2697 | if (rc == MBX_NOT_FINISHED) { |
2738 | mempool_free( mbox, phba->mbox_mem_pool); | 2698 | mempool_free(mbox, phba->mbox_mem_pool); |
2739 | } | 2699 | } |
2740 | return 1; | 2700 | return 1; |
2741 | } else if (rc > 0) { /* greater than */ | 2701 | } else if (rc > 0) { /* greater than */ |
@@ -2800,8 +2760,8 @@ lpfc_els_rcv_rnid(struct lpfc_hba * phba, | |||
2800 | } | 2760 | } |
2801 | 2761 | ||
2802 | static int | 2762 | static int |
2803 | lpfc_els_rcv_lirr(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | 2763 | lpfc_els_rcv_lirr(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, |
2804 | struct lpfc_nodelist * ndlp) | 2764 | struct lpfc_nodelist *ndlp) |
2805 | { | 2765 | { |
2806 | struct ls_rjt stat; | 2766 | struct ls_rjt stat; |
2807 | 2767 | ||
@@ -2815,7 +2775,7 @@ lpfc_els_rcv_lirr(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
2815 | } | 2775 | } |
2816 | 2776 | ||
2817 | static void | 2777 | static void |
2818 | lpfc_els_rsp_rps_acc(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | 2778 | lpfc_els_rsp_rps_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) |
2819 | { | 2779 | { |
2820 | struct lpfc_sli *psli; | 2780 | struct lpfc_sli *psli; |
2821 | struct lpfc_sli_ring *pring; | 2781 | struct lpfc_sli_ring *pring; |
@@ -2838,14 +2798,15 @@ lpfc_els_rsp_rps_acc(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
2838 | pmb->context2 = NULL; | 2798 | pmb->context2 = NULL; |
2839 | 2799 | ||
2840 | if (mb->mbxStatus) { | 2800 | if (mb->mbxStatus) { |
2841 | mempool_free( pmb, phba->mbox_mem_pool); | 2801 | mempool_free(pmb, phba->mbox_mem_pool); |
2842 | return; | 2802 | return; |
2843 | } | 2803 | } |
2844 | 2804 | ||
2845 | cmdsize = sizeof(RPS_RSP) + sizeof(uint32_t); | 2805 | cmdsize = sizeof(RPS_RSP) + sizeof(uint32_t); |
2846 | mempool_free( pmb, phba->mbox_mem_pool); | 2806 | mempool_free(pmb, phba->mbox_mem_pool); |
2847 | elsiocb = lpfc_prep_els_iocb(phba, 0, cmdsize, lpfc_max_els_tries, ndlp, | 2807 | elsiocb = lpfc_prep_els_iocb(phba, 0, cmdsize, lpfc_max_els_tries, ndlp, |
2848 | ndlp->nlp_DID, ELS_CMD_ACC); | 2808 | ndlp->nlp_DID, ELS_CMD_ACC); |
2809 | lpfc_nlp_put(ndlp); | ||
2849 | if (!elsiocb) | 2810 | if (!elsiocb) |
2850 | return; | 2811 | return; |
2851 | 2812 | ||
@@ -2875,15 +2836,15 @@ lpfc_els_rsp_rps_acc(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
2875 | 2836 | ||
2876 | /* Xmit ELS RPS ACC response tag <ulpIoTag> */ | 2837 | /* Xmit ELS RPS ACC response tag <ulpIoTag> */ |
2877 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2838 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
2878 | "%d:0118 Xmit ELS RPS ACC response tag x%x " | 2839 | "%d:0118 Xmit ELS RPS ACC response tag x%x xri x%x, " |
2879 | "Data: x%x x%x x%x x%x x%x\n", | 2840 | "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", |
2880 | phba->brd_no, | 2841 | phba->brd_no, elsiocb->iotag, |
2881 | elsiocb->iocb.ulpIoTag, | ||
2882 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 2842 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, |
2883 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2843 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); |
2884 | 2844 | ||
2885 | elsiocb->iocb_cmpl = lpfc_cmpl_els_acc; | 2845 | elsiocb->iocb_cmpl = lpfc_cmpl_els_acc; |
2886 | phba->fc_stat.elsXmitACC++; | 2846 | phba->fc_stat.elsXmitACC++; |
2847 | |||
2887 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { | 2848 | if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) { |
2888 | lpfc_els_free_iocb(phba, elsiocb); | 2849 | lpfc_els_free_iocb(phba, elsiocb); |
2889 | } | 2850 | } |
@@ -2923,13 +2884,14 @@ lpfc_els_rcv_rps(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
2923 | lpfc_read_lnk_stat(phba, mbox); | 2884 | lpfc_read_lnk_stat(phba, mbox); |
2924 | mbox->context1 = | 2885 | mbox->context1 = |
2925 | (void *)((unsigned long)cmdiocb->iocb.ulpContext); | 2886 | (void *)((unsigned long)cmdiocb->iocb.ulpContext); |
2926 | mbox->context2 = ndlp; | 2887 | mbox->context2 = lpfc_nlp_get(ndlp); |
2927 | mbox->mbox_cmpl = lpfc_els_rsp_rps_acc; | 2888 | mbox->mbox_cmpl = lpfc_els_rsp_rps_acc; |
2928 | if (lpfc_sli_issue_mbox (phba, mbox, | 2889 | if (lpfc_sli_issue_mbox (phba, mbox, |
2929 | (MBX_NOWAIT | MBX_STOP_IOCB)) != MBX_NOT_FINISHED) { | 2890 | (MBX_NOWAIT | MBX_STOP_IOCB)) != MBX_NOT_FINISHED) { |
2930 | /* Mbox completion will send ELS Response */ | 2891 | /* Mbox completion will send ELS Response */ |
2931 | return 0; | 2892 | return 0; |
2932 | } | 2893 | } |
2894 | lpfc_nlp_put(ndlp); | ||
2933 | mempool_free(mbox, phba->mbox_mem_pool); | 2895 | mempool_free(mbox, phba->mbox_mem_pool); |
2934 | } | 2896 | } |
2935 | } | 2897 | } |
@@ -2984,10 +2946,9 @@ lpfc_els_rsp_rpl_acc(struct lpfc_hba * phba, uint16_t cmdsize, | |||
2984 | 2946 | ||
2985 | /* Xmit ELS RPL ACC response tag <ulpIoTag> */ | 2947 | /* Xmit ELS RPL ACC response tag <ulpIoTag> */ |
2986 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, | 2948 | lpfc_printf_log(phba, KERN_INFO, LOG_ELS, |
2987 | "%d:0120 Xmit ELS RPL ACC response tag x%x " | 2949 | "%d:0120 Xmit ELS RPL ACC response tag x%x xri x%x, " |
2988 | "Data: x%x x%x x%x x%x x%x\n", | 2950 | "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n", |
2989 | phba->brd_no, | 2951 | phba->brd_no, elsiocb->iotag, |
2990 | elsiocb->iocb.ulpIoTag, | ||
2991 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, | 2952 | elsiocb->iocb.ulpContext, ndlp->nlp_DID, |
2992 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); | 2953 | ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); |
2993 | 2954 | ||
@@ -3091,8 +3052,8 @@ lpfc_els_rcv_farp(struct lpfc_hba * phba, | |||
3091 | /* Log back into the node before sending the FARP. */ | 3052 | /* Log back into the node before sending the FARP. */ |
3092 | if (fp->Rflags & FARP_REQUEST_PLOGI) { | 3053 | if (fp->Rflags & FARP_REQUEST_PLOGI) { |
3093 | ndlp->nlp_prev_state = ndlp->nlp_state; | 3054 | ndlp->nlp_prev_state = ndlp->nlp_state; |
3094 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 3055 | lpfc_nlp_set_state(phba, ndlp, |
3095 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | 3056 | NLP_STE_PLOGI_ISSUE); |
3096 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); | 3057 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); |
3097 | } | 3058 | } |
3098 | 3059 | ||
@@ -3169,14 +3130,15 @@ lpfc_els_rcv_fan(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
3169 | */ | 3130 | */ |
3170 | 3131 | ||
3171 | list_for_each_entry_safe(ndlp, next_ndlp, | 3132 | list_for_each_entry_safe(ndlp, next_ndlp, |
3172 | &phba->fc_npr_list, nlp_listp) { | 3133 | &phba->fc_nodes, nlp_listp) { |
3173 | 3134 | if (ndlp->nlp_state != NLP_STE_NPR_NODE) | |
3135 | continue; | ||
3174 | if (ndlp->nlp_type & NLP_FABRIC) { | 3136 | if (ndlp->nlp_type & NLP_FABRIC) { |
3175 | /* | 3137 | /* |
3176 | * Clean up old Fabric, Nameserver and | 3138 | * Clean up old Fabric, Nameserver and |
3177 | * other NLP_FABRIC logins | 3139 | * other NLP_FABRIC logins |
3178 | */ | 3140 | */ |
3179 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3141 | lpfc_drop_node(phba, ndlp); |
3180 | } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { | 3142 | } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { |
3181 | /* Fail outstanding I/O now since this | 3143 | /* Fail outstanding I/O now since this |
3182 | * device is marked for PLOGI | 3144 | * device is marked for PLOGI |
@@ -3193,20 +3155,22 @@ lpfc_els_rcv_fan(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
3193 | /* Discovery not needed, | 3155 | /* Discovery not needed, |
3194 | * move the nodes to their original state. | 3156 | * move the nodes to their original state. |
3195 | */ | 3157 | */ |
3196 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_npr_list, | 3158 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, |
3197 | nlp_listp) { | 3159 | nlp_listp) { |
3160 | if (ndlp->nlp_state != NLP_STE_NPR_NODE) | ||
3161 | continue; | ||
3198 | 3162 | ||
3199 | switch (ndlp->nlp_prev_state) { | 3163 | switch (ndlp->nlp_prev_state) { |
3200 | case NLP_STE_UNMAPPED_NODE: | 3164 | case NLP_STE_UNMAPPED_NODE: |
3201 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; | 3165 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; |
3202 | ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; | 3166 | lpfc_nlp_set_state(phba, ndlp, |
3203 | lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); | 3167 | NLP_STE_UNMAPPED_NODE); |
3204 | break; | 3168 | break; |
3205 | 3169 | ||
3206 | case NLP_STE_MAPPED_NODE: | 3170 | case NLP_STE_MAPPED_NODE: |
3207 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; | 3171 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; |
3208 | ndlp->nlp_state = NLP_STE_MAPPED_NODE; | 3172 | lpfc_nlp_set_state(phba, ndlp, |
3209 | lpfc_nlp_list(phba, ndlp, NLP_MAPPED_LIST); | 3173 | NLP_STE_MAPPED_NODE); |
3210 | break; | 3174 | break; |
3211 | 3175 | ||
3212 | default: | 3176 | default: |
@@ -3246,9 +3210,8 @@ lpfc_els_timeout_handler(struct lpfc_hba *phba) | |||
3246 | struct lpfc_iocbq *tmp_iocb, *piocb; | 3210 | struct lpfc_iocbq *tmp_iocb, *piocb; |
3247 | IOCB_t *cmd = NULL; | 3211 | IOCB_t *cmd = NULL; |
3248 | struct lpfc_dmabuf *pcmd; | 3212 | struct lpfc_dmabuf *pcmd; |
3249 | struct list_head *dlp; | ||
3250 | uint32_t *elscmd; | 3213 | uint32_t *elscmd; |
3251 | uint32_t els_command; | 3214 | uint32_t els_command=0; |
3252 | uint32_t timeout; | 3215 | uint32_t timeout; |
3253 | uint32_t remote_ID; | 3216 | uint32_t remote_ID; |
3254 | 3217 | ||
@@ -3263,17 +3226,20 @@ lpfc_els_timeout_handler(struct lpfc_hba *phba) | |||
3263 | timeout = (uint32_t)(phba->fc_ratov << 1); | 3226 | timeout = (uint32_t)(phba->fc_ratov << 1); |
3264 | 3227 | ||
3265 | pring = &phba->sli.ring[LPFC_ELS_RING]; | 3228 | pring = &phba->sli.ring[LPFC_ELS_RING]; |
3266 | dlp = &pring->txcmplq; | ||
3267 | 3229 | ||
3268 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { | 3230 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { |
3269 | cmd = &piocb->iocb; | 3231 | cmd = &piocb->iocb; |
3270 | 3232 | ||
3271 | if (piocb->iocb_flag & LPFC_IO_LIBDFC) { | 3233 | if ((piocb->iocb_flag & LPFC_IO_LIBDFC) || |
3234 | (piocb->iocb.ulpCommand == CMD_ABORT_XRI_CN) || | ||
3235 | (piocb->iocb.ulpCommand == CMD_CLOSE_XRI_CN)) { | ||
3272 | continue; | 3236 | continue; |
3273 | } | 3237 | } |
3274 | pcmd = (struct lpfc_dmabuf *) piocb->context2; | 3238 | pcmd = (struct lpfc_dmabuf *) piocb->context2; |
3275 | elscmd = (uint32_t *) (pcmd->virt); | 3239 | if (pcmd) { |
3276 | els_command = *elscmd; | 3240 | elscmd = (uint32_t *) (pcmd->virt); |
3241 | els_command = *elscmd; | ||
3242 | } | ||
3277 | 3243 | ||
3278 | if ((els_command == ELS_CMD_FARP) | 3244 | if ((els_command == ELS_CMD_FARP) |
3279 | || (els_command == ELS_CMD_FARPR)) { | 3245 | || (els_command == ELS_CMD_FARPR)) { |
@@ -3289,19 +3255,10 @@ lpfc_els_timeout_handler(struct lpfc_hba *phba) | |||
3289 | continue; | 3255 | continue; |
3290 | } | 3256 | } |
3291 | 3257 | ||
3292 | list_del(&piocb->list); | ||
3293 | pring->txcmplq_cnt--; | ||
3294 | |||
3295 | if (cmd->ulpCommand == CMD_GEN_REQUEST64_CR) { | 3258 | if (cmd->ulpCommand == CMD_GEN_REQUEST64_CR) { |
3296 | struct lpfc_nodelist *ndlp; | 3259 | struct lpfc_nodelist *ndlp; |
3297 | spin_unlock_irq(phba->host->host_lock); | 3260 | ndlp = __lpfc_findnode_rpi(phba, cmd->ulpContext); |
3298 | ndlp = lpfc_findnode_rpi(phba, cmd->ulpContext); | ||
3299 | spin_lock_irq(phba->host->host_lock); | ||
3300 | remote_ID = ndlp->nlp_DID; | 3261 | remote_ID = ndlp->nlp_DID; |
3301 | if (cmd->un.elsreq64.bdl.ulpIoTag32) { | ||
3302 | lpfc_sli_issue_abort_iotag32(phba, | ||
3303 | pring, piocb); | ||
3304 | } | ||
3305 | } else { | 3262 | } else { |
3306 | remote_ID = cmd->un.elsreq64.remoteID; | 3263 | remote_ID = cmd->un.elsreq64.remoteID; |
3307 | } | 3264 | } |
@@ -3313,17 +3270,7 @@ lpfc_els_timeout_handler(struct lpfc_hba *phba) | |||
3313 | phba->brd_no, els_command, | 3270 | phba->brd_no, els_command, |
3314 | remote_ID, cmd->ulpCommand, cmd->ulpIoTag); | 3271 | remote_ID, cmd->ulpCommand, cmd->ulpIoTag); |
3315 | 3272 | ||
3316 | /* | 3273 | lpfc_sli_issue_abort_iotag(phba, pring, piocb); |
3317 | * The iocb has timed out; abort it. | ||
3318 | */ | ||
3319 | if (piocb->iocb_cmpl) { | ||
3320 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
3321 | cmd->un.ulpWord[4] = IOERR_SLI_ABORTED; | ||
3322 | spin_unlock_irq(phba->host->host_lock); | ||
3323 | (piocb->iocb_cmpl) (phba, piocb, piocb); | ||
3324 | spin_lock_irq(phba->host->host_lock); | ||
3325 | } else | ||
3326 | lpfc_sli_release_iocbq(phba, piocb); | ||
3327 | } | 3274 | } |
3328 | if (phba->sli.ring[LPFC_ELS_RING].txcmplq_cnt) | 3275 | if (phba->sli.ring[LPFC_ELS_RING].txcmplq_cnt) |
3329 | mod_timer(&phba->els_tmofunc, jiffies + HZ * timeout); | 3276 | mod_timer(&phba->els_tmofunc, jiffies + HZ * timeout); |
@@ -3332,16 +3279,13 @@ lpfc_els_timeout_handler(struct lpfc_hba *phba) | |||
3332 | } | 3279 | } |
3333 | 3280 | ||
3334 | void | 3281 | void |
3335 | lpfc_els_flush_cmd(struct lpfc_hba * phba) | 3282 | lpfc_els_flush_cmd(struct lpfc_hba *phba) |
3336 | { | 3283 | { |
3337 | struct lpfc_sli_ring *pring; | 3284 | LIST_HEAD(completions); |
3285 | struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; | ||
3338 | struct lpfc_iocbq *tmp_iocb, *piocb; | 3286 | struct lpfc_iocbq *tmp_iocb, *piocb; |
3339 | IOCB_t *cmd = NULL; | 3287 | IOCB_t *cmd = NULL; |
3340 | struct lpfc_dmabuf *pcmd; | ||
3341 | uint32_t *elscmd; | ||
3342 | uint32_t els_command; | ||
3343 | 3288 | ||
3344 | pring = &phba->sli.ring[LPFC_ELS_RING]; | ||
3345 | spin_lock_irq(phba->host->host_lock); | 3289 | spin_lock_irq(phba->host->host_lock); |
3346 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txq, list) { | 3290 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txq, list) { |
3347 | cmd = &piocb->iocb; | 3291 | cmd = &piocb->iocb; |
@@ -3351,29 +3295,15 @@ lpfc_els_flush_cmd(struct lpfc_hba * phba) | |||
3351 | } | 3295 | } |
3352 | 3296 | ||
3353 | /* Do not flush out the QUE_RING and ABORT/CLOSE iocbs */ | 3297 | /* Do not flush out the QUE_RING and ABORT/CLOSE iocbs */ |
3354 | if ((cmd->ulpCommand == CMD_QUE_RING_BUF_CN) || | 3298 | if (cmd->ulpCommand == CMD_QUE_RING_BUF_CN || |
3355 | (cmd->ulpCommand == CMD_QUE_RING_BUF64_CN) || | 3299 | cmd->ulpCommand == CMD_QUE_RING_BUF64_CN || |
3356 | (cmd->ulpCommand == CMD_CLOSE_XRI_CN) || | 3300 | cmd->ulpCommand == CMD_CLOSE_XRI_CN || |
3357 | (cmd->ulpCommand == CMD_ABORT_XRI_CN)) { | 3301 | cmd->ulpCommand == CMD_ABORT_XRI_CN) |
3358 | continue; | 3302 | continue; |
3359 | } | ||
3360 | 3303 | ||
3361 | pcmd = (struct lpfc_dmabuf *) piocb->context2; | 3304 | list_move_tail(&piocb->list, &completions); |
3362 | elscmd = (uint32_t *) (pcmd->virt); | 3305 | pring->txq_cnt--; |
3363 | els_command = *elscmd; | ||
3364 | 3306 | ||
3365 | list_del(&piocb->list); | ||
3366 | pring->txcmplq_cnt--; | ||
3367 | |||
3368 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
3369 | cmd->un.ulpWord[4] = IOERR_SLI_ABORTED; | ||
3370 | |||
3371 | if (piocb->iocb_cmpl) { | ||
3372 | spin_unlock_irq(phba->host->host_lock); | ||
3373 | (piocb->iocb_cmpl) (phba, piocb, piocb); | ||
3374 | spin_lock_irq(phba->host->host_lock); | ||
3375 | } else | ||
3376 | lpfc_sli_release_iocbq(phba, piocb); | ||
3377 | } | 3307 | } |
3378 | 3308 | ||
3379 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { | 3309 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { |
@@ -3382,24 +3312,24 @@ lpfc_els_flush_cmd(struct lpfc_hba * phba) | |||
3382 | if (piocb->iocb_flag & LPFC_IO_LIBDFC) { | 3312 | if (piocb->iocb_flag & LPFC_IO_LIBDFC) { |
3383 | continue; | 3313 | continue; |
3384 | } | 3314 | } |
3385 | pcmd = (struct lpfc_dmabuf *) piocb->context2; | ||
3386 | elscmd = (uint32_t *) (pcmd->virt); | ||
3387 | els_command = *elscmd; | ||
3388 | 3315 | ||
3389 | list_del(&piocb->list); | 3316 | lpfc_sli_issue_abort_iotag(phba, pring, piocb); |
3390 | pring->txcmplq_cnt--; | 3317 | } |
3318 | spin_unlock_irq(phba->host->host_lock); | ||
3391 | 3319 | ||
3392 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; | 3320 | while(!list_empty(&completions)) { |
3393 | cmd->un.ulpWord[4] = IOERR_SLI_ABORTED; | 3321 | piocb = list_get_first(&completions, struct lpfc_iocbq, list); |
3322 | cmd = &piocb->iocb; | ||
3323 | list_del(&piocb->list); | ||
3394 | 3324 | ||
3395 | if (piocb->iocb_cmpl) { | 3325 | if (piocb->iocb_cmpl) { |
3396 | spin_unlock_irq(phba->host->host_lock); | 3326 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; |
3327 | cmd->un.ulpWord[4] = IOERR_SLI_ABORTED; | ||
3397 | (piocb->iocb_cmpl) (phba, piocb, piocb); | 3328 | (piocb->iocb_cmpl) (phba, piocb, piocb); |
3398 | spin_lock_irq(phba->host->host_lock); | ||
3399 | } else | 3329 | } else |
3400 | lpfc_sli_release_iocbq(phba, piocb); | 3330 | lpfc_sli_release_iocbq(phba, piocb); |
3401 | } | 3331 | } |
3402 | spin_unlock_irq(phba->host->host_lock); | 3332 | |
3403 | return; | 3333 | return; |
3404 | } | 3334 | } |
3405 | 3335 | ||
@@ -3468,7 +3398,7 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3468 | } | 3398 | } |
3469 | 3399 | ||
3470 | did = icmd->un.rcvels.remoteID; | 3400 | did = icmd->un.rcvels.remoteID; |
3471 | ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, did); | 3401 | ndlp = lpfc_findnode_did(phba, did); |
3472 | if (!ndlp) { | 3402 | if (!ndlp) { |
3473 | /* Cannot find existing Fabric ndlp, so allocate a new one */ | 3403 | /* Cannot find existing Fabric ndlp, so allocate a new one */ |
3474 | ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); | 3404 | ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); |
@@ -3484,12 +3414,13 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3484 | if ((did & Fabric_DID_MASK) == Fabric_DID_MASK) { | 3414 | if ((did & Fabric_DID_MASK) == Fabric_DID_MASK) { |
3485 | ndlp->nlp_type |= NLP_FABRIC; | 3415 | ndlp->nlp_type |= NLP_FABRIC; |
3486 | } | 3416 | } |
3487 | ndlp->nlp_state = NLP_STE_UNUSED_NODE; | 3417 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNUSED_NODE); |
3488 | lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); | ||
3489 | } | 3418 | } |
3490 | 3419 | ||
3491 | phba->fc_stat.elsRcvFrame++; | 3420 | phba->fc_stat.elsRcvFrame++; |
3492 | elsiocb->context1 = ndlp; | 3421 | if (elsiocb->context1) |
3422 | lpfc_nlp_put(elsiocb->context1); | ||
3423 | elsiocb->context1 = lpfc_nlp_get(ndlp); | ||
3493 | elsiocb->context2 = mp; | 3424 | elsiocb->context2 = mp; |
3494 | 3425 | ||
3495 | if ((cmd & ELS_CMD_MASK) == ELS_CMD_RSCN) { | 3426 | if ((cmd & ELS_CMD_MASK) == ELS_CMD_RSCN) { |
@@ -3513,9 +3444,8 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3513 | case ELS_CMD_FLOGI: | 3444 | case ELS_CMD_FLOGI: |
3514 | phba->fc_stat.elsRcvFLOGI++; | 3445 | phba->fc_stat.elsRcvFLOGI++; |
3515 | lpfc_els_rcv_flogi(phba, elsiocb, ndlp, newnode); | 3446 | lpfc_els_rcv_flogi(phba, elsiocb, ndlp, newnode); |
3516 | if (newnode) { | 3447 | if (newnode) |
3517 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3448 | lpfc_drop_node(phba, ndlp); |
3518 | } | ||
3519 | break; | 3449 | break; |
3520 | case ELS_CMD_LOGO: | 3450 | case ELS_CMD_LOGO: |
3521 | phba->fc_stat.elsRcvLOGO++; | 3451 | phba->fc_stat.elsRcvLOGO++; |
@@ -3536,9 +3466,8 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3536 | case ELS_CMD_RSCN: | 3466 | case ELS_CMD_RSCN: |
3537 | phba->fc_stat.elsRcvRSCN++; | 3467 | phba->fc_stat.elsRcvRSCN++; |
3538 | lpfc_els_rcv_rscn(phba, elsiocb, ndlp, newnode); | 3468 | lpfc_els_rcv_rscn(phba, elsiocb, ndlp, newnode); |
3539 | if (newnode) { | 3469 | if (newnode) |
3540 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3470 | lpfc_drop_node(phba, ndlp); |
3541 | } | ||
3542 | break; | 3471 | break; |
3543 | case ELS_CMD_ADISC: | 3472 | case ELS_CMD_ADISC: |
3544 | phba->fc_stat.elsRcvADISC++; | 3473 | phba->fc_stat.elsRcvADISC++; |
@@ -3579,30 +3508,26 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3579 | case ELS_CMD_LIRR: | 3508 | case ELS_CMD_LIRR: |
3580 | phba->fc_stat.elsRcvLIRR++; | 3509 | phba->fc_stat.elsRcvLIRR++; |
3581 | lpfc_els_rcv_lirr(phba, elsiocb, ndlp); | 3510 | lpfc_els_rcv_lirr(phba, elsiocb, ndlp); |
3582 | if (newnode) { | 3511 | if (newnode) |
3583 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3512 | lpfc_drop_node(phba, ndlp); |
3584 | } | ||
3585 | break; | 3513 | break; |
3586 | case ELS_CMD_RPS: | 3514 | case ELS_CMD_RPS: |
3587 | phba->fc_stat.elsRcvRPS++; | 3515 | phba->fc_stat.elsRcvRPS++; |
3588 | lpfc_els_rcv_rps(phba, elsiocb, ndlp); | 3516 | lpfc_els_rcv_rps(phba, elsiocb, ndlp); |
3589 | if (newnode) { | 3517 | if (newnode) |
3590 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3518 | lpfc_drop_node(phba, ndlp); |
3591 | } | ||
3592 | break; | 3519 | break; |
3593 | case ELS_CMD_RPL: | 3520 | case ELS_CMD_RPL: |
3594 | phba->fc_stat.elsRcvRPL++; | 3521 | phba->fc_stat.elsRcvRPL++; |
3595 | lpfc_els_rcv_rpl(phba, elsiocb, ndlp); | 3522 | lpfc_els_rcv_rpl(phba, elsiocb, ndlp); |
3596 | if (newnode) { | 3523 | if (newnode) |
3597 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3524 | lpfc_drop_node(phba, ndlp); |
3598 | } | ||
3599 | break; | 3525 | break; |
3600 | case ELS_CMD_RNID: | 3526 | case ELS_CMD_RNID: |
3601 | phba->fc_stat.elsRcvRNID++; | 3527 | phba->fc_stat.elsRcvRNID++; |
3602 | lpfc_els_rcv_rnid(phba, elsiocb, ndlp); | 3528 | lpfc_els_rcv_rnid(phba, elsiocb, ndlp); |
3603 | if (newnode) { | 3529 | if (newnode) |
3604 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3530 | lpfc_drop_node(phba, ndlp); |
3605 | } | ||
3606 | break; | 3531 | break; |
3607 | default: | 3532 | default: |
3608 | /* Unsupported ELS command, reject */ | 3533 | /* Unsupported ELS command, reject */ |
@@ -3612,9 +3537,8 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3612 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 3537 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, |
3613 | "%d:0115 Unknown ELS command x%x received from " | 3538 | "%d:0115 Unknown ELS command x%x received from " |
3614 | "NPORT x%x\n", phba->brd_no, cmd, did); | 3539 | "NPORT x%x\n", phba->brd_no, cmd, did); |
3615 | if (newnode) { | 3540 | if (newnode) |
3616 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3541 | lpfc_drop_node(phba, ndlp); |
3617 | } | ||
3618 | break; | 3542 | break; |
3619 | } | 3543 | } |
3620 | 3544 | ||
@@ -3627,6 +3551,8 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3627 | lpfc_els_rsp_reject(phba, stat.un.lsRjtError, elsiocb, ndlp); | 3551 | lpfc_els_rsp_reject(phba, stat.un.lsRjtError, elsiocb, ndlp); |
3628 | } | 3552 | } |
3629 | 3553 | ||
3554 | lpfc_nlp_put(elsiocb->context1); | ||
3555 | elsiocb->context1 = NULL; | ||
3630 | if (elsiocb->context2) { | 3556 | if (elsiocb->context2) { |
3631 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 3557 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
3632 | kfree(mp); | 3558 | kfree(mp); |