aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_nportdisc.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 19:57:23 -0500
commitc9f8735beadfba403045c4423c91bbcf594b6ef2 (patch)
tree472f7053abdfe1b18fecddf3caacdd2976e7baeb /drivers/scsi/lpfc/lpfc_nportdisc.c
parentb28485acb930f67c014024bc3b9c01129124e566 (diff)
[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_nportdisc.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_nportdisc.c283
1 files changed, 166 insertions, 117 deletions
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index 1c04ea353ffa..a580e1e50672 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -46,13 +46,13 @@ lpfc_check_adisc(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
46 * table entry for that node. 46 * table entry for that node.
47 */ 47 */
48 if (memcmp(nn, &ndlp->nlp_nodename, sizeof (struct lpfc_name)) != 0) 48 if (memcmp(nn, &ndlp->nlp_nodename, sizeof (struct lpfc_name)) != 0)
49 return (0); 49 return 0;
50 50
51 if (memcmp(pn, &ndlp->nlp_portname, sizeof (struct lpfc_name)) != 0) 51 if (memcmp(pn, &ndlp->nlp_portname, sizeof (struct lpfc_name)) != 0)
52 return (0); 52 return 0;
53 53
54 /* we match, return success */ 54 /* we match, return success */
55 return (1); 55 return 1;
56} 56}
57 57
58int 58int
@@ -159,7 +159,7 @@ lpfc_check_elscmpl_iocb(struct lpfc_hba * phba,
159 } 159 }
160 ptr = NULL; 160 ptr = NULL;
161 } 161 }
162 return (ptr); 162 return ptr;
163} 163}
164 164
165 165
@@ -266,7 +266,7 @@ lpfc_els_abort(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
266 if (!list_empty(&ndlp->els_retry_evt.evt_listp)) 266 if (!list_empty(&ndlp->els_retry_evt.evt_listp))
267 list_del_init(&ndlp->els_retry_evt.evt_listp); 267 list_del_init(&ndlp->els_retry_evt.evt_listp);
268 } 268 }
269 return (0); 269 return 0;
270} 270}
271 271
272static int 272static int
@@ -321,7 +321,7 @@ lpfc_rcv_plogi(struct lpfc_hba * phba,
321 stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC; 321 stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC;
322 stat.un.b.lsRjtRsnCodeExp = LSEXP_SPARM_OPTIONS; 322 stat.un.b.lsRjtRsnCodeExp = LSEXP_SPARM_OPTIONS;
323 lpfc_els_rsp_reject(phba, stat.un.lsRjtError, cmdiocb, ndlp); 323 lpfc_els_rsp_reject(phba, stat.un.lsRjtError, cmdiocb, ndlp);
324 return (0); 324 return 0;
325 } 325 }
326 icmd = &cmdiocb->iocb; 326 icmd = &cmdiocb->iocb;
327 327
@@ -362,7 +362,7 @@ lpfc_rcv_plogi(struct lpfc_hba * phba,
362 case NLP_STE_UNMAPPED_NODE: 362 case NLP_STE_UNMAPPED_NODE:
363 case NLP_STE_MAPPED_NODE: 363 case NLP_STE_MAPPED_NODE:
364 lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL, 0); 364 lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL, 0);
365 return (1); 365 return 1;
366 } 366 }
367 367
368 if ((phba->fc_flag & FC_PT2PT) 368 if ((phba->fc_flag & FC_PT2PT)
@@ -409,13 +409,13 @@ lpfc_rcv_plogi(struct lpfc_hba * phba,
409 } 409 }
410 ndlp->nlp_flag |= NLP_RCV_PLOGI; 410 ndlp->nlp_flag |= NLP_RCV_PLOGI;
411 lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox, 0); 411 lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox, 0);
412 return (1); 412 return 1;
413 413
414out: 414out:
415 stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC; 415 stat.un.b.lsRjtRsnCode = LSRJT_UNABLE_TPC;
416 stat.un.b.lsRjtRsnCodeExp = LSEXP_OUT_OF_RESOURCE; 416 stat.un.b.lsRjtRsnCodeExp = LSEXP_OUT_OF_RESOURCE;
417 lpfc_els_rsp_reject(phba, stat.un.lsRjtError, cmdiocb, ndlp); 417 lpfc_els_rsp_reject(phba, stat.un.lsRjtError, cmdiocb, ndlp);
418 return (0); 418 return 0;
419} 419}
420 420
421static int 421static int
@@ -456,7 +456,7 @@ lpfc_rcv_padisc(struct lpfc_hba * phba,
456 lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp, 456 lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp,
457 NULL, 0); 457 NULL, 0);
458 } 458 }
459 return (1); 459 return 1;
460 } 460 }
461 /* Reject this request because invalid parameters */ 461 /* Reject this request because invalid parameters */
462 stat.un.b.lsRjtRsvd0 = 0; 462 stat.un.b.lsRjtRsvd0 = 0;
@@ -474,7 +474,7 @@ lpfc_rcv_padisc(struct lpfc_hba * phba,
474 spin_unlock_irq(phba->host->host_lock); 474 spin_unlock_irq(phba->host->host_lock);
475 ndlp->nlp_state = NLP_STE_NPR_NODE; 475 ndlp->nlp_state = NLP_STE_NPR_NODE;
476 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 476 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
477 return (0); 477 return 0;
478} 478}
479 479
480static int 480static int
@@ -489,25 +489,31 @@ lpfc_rcv_logo(struct lpfc_hba * phba,
489 ndlp->nlp_flag |= NLP_LOGO_ACC; 489 ndlp->nlp_flag |= NLP_LOGO_ACC;
490 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 490 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
491 491
492 if (!(ndlp->nlp_type & NLP_FABRIC)) { 492 if (!(ndlp->nlp_type & NLP_FABRIC) ||
493 (ndlp->nlp_state == NLP_STE_ADISC_ISSUE)) {
493 /* Only try to re-login if this is NOT a Fabric Node */ 494 /* Only try to re-login if this is NOT a Fabric Node */
494 ndlp->nlp_last_elscmd = (unsigned long)ELS_CMD_PLOGI; 495 ndlp->nlp_last_elscmd = (unsigned long)ELS_CMD_PLOGI;
495 mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1); 496 mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1);
496 spin_lock_irq(phba->host->host_lock); 497 spin_lock_irq(phba->host->host_lock);
497 ndlp->nlp_flag |= NLP_DELAY_TMO; 498 ndlp->nlp_flag |= NLP_DELAY_TMO;
498 spin_unlock_irq(phba->host->host_lock); 499 spin_unlock_irq(phba->host->host_lock);
499 }
500 500
501 ndlp->nlp_state = NLP_STE_NPR_NODE; 501 ndlp->nlp_state = NLP_STE_NPR_NODE;
502 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 502 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
503 } else {
504 ndlp->nlp_state = NLP_STE_UNUSED_NODE;
505 lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST);
506 }
503 507
508 spin_lock_irq(phba->host->host_lock);
504 ndlp->nlp_flag &= ~NLP_NPR_ADISC; 509 ndlp->nlp_flag &= ~NLP_NPR_ADISC;
510 spin_unlock_irq(phba->host->host_lock);
505 /* The driver has to wait until the ACC completes before it continues 511 /* The driver has to wait until the ACC completes before it continues
506 * processing the LOGO. The action will resume in 512 * processing the LOGO. The action will resume in
507 * lpfc_cmpl_els_logo_acc routine. Since part of processing includes an 513 * lpfc_cmpl_els_logo_acc routine. Since part of processing includes an
508 * unreg_login, the driver waits so the ACC does not get aborted. 514 * unreg_login, the driver waits so the ACC does not get aborted.
509 */ 515 */
510 return (0); 516 return 0;
511} 517}
512 518
513static void 519static void
@@ -555,20 +561,12 @@ lpfc_disc_set_adisc(struct lpfc_hba * phba,
555 if ((phba->cfg_use_adisc == 0) && 561 if ((phba->cfg_use_adisc == 0) &&
556 !(phba->fc_flag & FC_RSCN_MODE)) { 562 !(phba->fc_flag & FC_RSCN_MODE)) {
557 if (!(ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE)) 563 if (!(ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE))
558 return (0); 564 return 0;
559 } 565 }
560 spin_lock_irq(phba->host->host_lock); 566 spin_lock_irq(phba->host->host_lock);
561 ndlp->nlp_flag |= NLP_NPR_ADISC; 567 ndlp->nlp_flag |= NLP_NPR_ADISC;
562 spin_unlock_irq(phba->host->host_lock); 568 spin_unlock_irq(phba->host->host_lock);
563 return (1); 569 return 1;
564}
565
566static uint32_t
567lpfc_disc_noop(struct lpfc_hba * phba,
568 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
569{
570 /* This routine does nothing, just return the current state */
571 return (ndlp->nlp_state);
572} 570}
573 571
574static uint32_t 572static uint32_t
@@ -583,7 +581,7 @@ lpfc_disc_illegal(struct lpfc_hba * phba,
583 phba->brd_no, 581 phba->brd_no,
584 ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi, 582 ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi,
585 ndlp->nlp_flag); 583 ndlp->nlp_flag);
586 return (ndlp->nlp_state); 584 return ndlp->nlp_state;
587} 585}
588 586
589/* Start of Discovery State Machine routines */ 587/* Start of Discovery State Machine routines */
@@ -599,10 +597,10 @@ lpfc_rcv_plogi_unused_node(struct lpfc_hba * phba,
599 if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) { 597 if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) {
600 ndlp->nlp_state = NLP_STE_UNUSED_NODE; 598 ndlp->nlp_state = NLP_STE_UNUSED_NODE;
601 lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); 599 lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST);
602 return (ndlp->nlp_state); 600 return ndlp->nlp_state;
603 } 601 }
604 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 602 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
605 return (NLP_STE_FREED_NODE); 603 return NLP_STE_FREED_NODE;
606} 604}
607 605
608static uint32_t 606static uint32_t
@@ -611,7 +609,7 @@ lpfc_rcv_els_unused_node(struct lpfc_hba * phba,
611{ 609{
612 lpfc_issue_els_logo(phba, ndlp, 0); 610 lpfc_issue_els_logo(phba, ndlp, 0);
613 lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); 611 lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST);
614 return (ndlp->nlp_state); 612 return ndlp->nlp_state;
615} 613}
616 614
617static uint32_t 615static uint32_t
@@ -628,7 +626,7 @@ lpfc_rcv_logo_unused_node(struct lpfc_hba * phba,
628 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 626 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
629 lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); 627 lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST);
630 628
631 return (ndlp->nlp_state); 629 return ndlp->nlp_state;
632} 630}
633 631
634static uint32_t 632static uint32_t
@@ -636,7 +634,7 @@ lpfc_cmpl_logo_unused_node(struct lpfc_hba * phba,
636 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) 634 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
637{ 635{
638 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 636 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
639 return (NLP_STE_FREED_NODE); 637 return NLP_STE_FREED_NODE;
640} 638}
641 639
642static uint32_t 640static uint32_t
@@ -644,7 +642,7 @@ lpfc_device_rm_unused_node(struct lpfc_hba * phba,
644 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) 642 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
645{ 643{
646 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 644 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
647 return (NLP_STE_FREED_NODE); 645 return NLP_STE_FREED_NODE;
648} 646}
649 647
650static uint32_t 648static uint32_t
@@ -682,7 +680,22 @@ lpfc_rcv_plogi_plogi_issue(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
682 lpfc_rcv_plogi(phba, ndlp, cmdiocb); 680 lpfc_rcv_plogi(phba, ndlp, cmdiocb);
683 } /* if our portname was less */ 681 } /* if our portname was less */
684 682
685 return (ndlp->nlp_state); 683 return ndlp->nlp_state;
684}
685
686static uint32_t
687lpfc_rcv_logo_plogi_issue(struct lpfc_hba * phba,
688 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
689{
690 struct lpfc_iocbq *cmdiocb;
691
692 cmdiocb = (struct lpfc_iocbq *) arg;
693
694 /* software abort outstanding PLOGI */
695 lpfc_els_abort(phba, ndlp, 1);
696
697 lpfc_rcv_logo(phba, ndlp, cmdiocb);
698 return ndlp->nlp_state;
686} 699}
687 700
688static uint32_t 701static uint32_t
@@ -712,7 +725,7 @@ lpfc_rcv_els_plogi_issue(struct lpfc_hba * phba,
712 ndlp->nlp_state = NLP_STE_NPR_NODE; 725 ndlp->nlp_state = NLP_STE_NPR_NODE;
713 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 726 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
714 727
715 return (ndlp->nlp_state); 728 return ndlp->nlp_state;
716} 729}
717 730
718static uint32_t 731static uint32_t
@@ -731,7 +744,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_hba * phba,
731 rspiocb = cmdiocb->context_un.rsp_iocb; 744 rspiocb = cmdiocb->context_un.rsp_iocb;
732 745
733 if (ndlp->nlp_flag & NLP_ACC_REGLOGIN) { 746 if (ndlp->nlp_flag & NLP_ACC_REGLOGIN) {
734 return (ndlp->nlp_state); 747 return ndlp->nlp_state;
735 } 748 }
736 749
737 irsp = &rspiocb->iocb; 750 irsp = &rspiocb->iocb;
@@ -812,7 +825,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_hba * phba,
812 NLP_STE_REG_LOGIN_ISSUE; 825 NLP_STE_REG_LOGIN_ISSUE;
813 lpfc_nlp_list(phba, ndlp, 826 lpfc_nlp_list(phba, ndlp,
814 NLP_REGLOGIN_LIST); 827 NLP_REGLOGIN_LIST);
815 return (ndlp->nlp_state); 828 return ndlp->nlp_state;
816 } 829 }
817 mempool_free(mbox, phba->mbox_mem_pool); 830 mempool_free(mbox, phba->mbox_mem_pool);
818 } else { 831 } else {
@@ -824,7 +837,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_hba * phba,
824 /* Free this node since the driver cannot login or has the wrong 837 /* Free this node since the driver cannot login or has the wrong
825 sparm */ 838 sparm */
826 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 839 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
827 return (NLP_STE_FREED_NODE); 840 return NLP_STE_FREED_NODE;
828} 841}
829 842
830static uint32_t 843static uint32_t
@@ -835,7 +848,7 @@ lpfc_device_rm_plogi_issue(struct lpfc_hba * phba,
835 lpfc_els_abort(phba, ndlp, 1); 848 lpfc_els_abort(phba, ndlp, 1);
836 849
837 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 850 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
838 return (NLP_STE_FREED_NODE); 851 return NLP_STE_FREED_NODE;
839} 852}
840 853
841static uint32_t 854static uint32_t
@@ -852,7 +865,7 @@ lpfc_device_recov_plogi_issue(struct lpfc_hba * phba,
852 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 865 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
853 spin_unlock_irq(phba->host->host_lock); 866 spin_unlock_irq(phba->host->host_lock);
854 867
855 return (ndlp->nlp_state); 868 return ndlp->nlp_state;
856} 869}
857 870
858static uint32_t 871static uint32_t
@@ -868,13 +881,13 @@ lpfc_rcv_plogi_adisc_issue(struct lpfc_hba * phba,
868 cmdiocb = (struct lpfc_iocbq *) arg; 881 cmdiocb = (struct lpfc_iocbq *) arg;
869 882
870 if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) { 883 if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) {
871 return (ndlp->nlp_state); 884 return ndlp->nlp_state;
872 } 885 }
873 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; 886 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE;
874 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); 887 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
875 lpfc_issue_els_plogi(phba, ndlp, 0); 888 lpfc_issue_els_plogi(phba, ndlp, 0);
876 889
877 return (ndlp->nlp_state); 890 return ndlp->nlp_state;
878} 891}
879 892
880static uint32_t 893static uint32_t
@@ -887,7 +900,7 @@ lpfc_rcv_prli_adisc_issue(struct lpfc_hba * phba,
887 cmdiocb = (struct lpfc_iocbq *) arg; 900 cmdiocb = (struct lpfc_iocbq *) arg;
888 901
889 lpfc_els_rsp_prli_acc(phba, cmdiocb, ndlp); 902 lpfc_els_rsp_prli_acc(phba, cmdiocb, ndlp);
890 return (ndlp->nlp_state); 903 return ndlp->nlp_state;
891} 904}
892 905
893static uint32_t 906static uint32_t
@@ -903,7 +916,7 @@ lpfc_rcv_logo_adisc_issue(struct lpfc_hba * phba,
903 lpfc_els_abort(phba, ndlp, 0); 916 lpfc_els_abort(phba, ndlp, 0);
904 917
905 lpfc_rcv_logo(phba, ndlp, cmdiocb); 918 lpfc_rcv_logo(phba, ndlp, cmdiocb);
906 return (ndlp->nlp_state); 919 return ndlp->nlp_state;
907} 920}
908 921
909static uint32_t 922static uint32_t
@@ -916,7 +929,7 @@ lpfc_rcv_padisc_adisc_issue(struct lpfc_hba * phba,
916 cmdiocb = (struct lpfc_iocbq *) arg; 929 cmdiocb = (struct lpfc_iocbq *) arg;
917 930
918 lpfc_rcv_padisc(phba, ndlp, cmdiocb); 931 lpfc_rcv_padisc(phba, ndlp, cmdiocb);
919 return (ndlp->nlp_state); 932 return ndlp->nlp_state;
920} 933}
921 934
922static uint32_t 935static uint32_t
@@ -930,7 +943,7 @@ lpfc_rcv_prlo_adisc_issue(struct lpfc_hba * phba,
930 943
931 /* Treat like rcv logo */ 944 /* Treat like rcv logo */
932 lpfc_rcv_logo(phba, ndlp, cmdiocb); 945 lpfc_rcv_logo(phba, ndlp, cmdiocb);
933 return (ndlp->nlp_state); 946 return ndlp->nlp_state;
934} 947}
935 948
936static uint32_t 949static uint32_t
@@ -963,7 +976,7 @@ lpfc_cmpl_adisc_adisc_issue(struct lpfc_hba * phba,
963 ndlp->nlp_state = NLP_STE_NPR_NODE; 976 ndlp->nlp_state = NLP_STE_NPR_NODE;
964 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 977 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
965 lpfc_unreg_rpi(phba, ndlp); 978 lpfc_unreg_rpi(phba, ndlp);
966 return (ndlp->nlp_state); 979 return ndlp->nlp_state;
967 } 980 }
968 if (ndlp->nlp_type & NLP_FCP_TARGET) { 981 if (ndlp->nlp_type & NLP_FCP_TARGET) {
969 ndlp->nlp_state = NLP_STE_MAPPED_NODE; 982 ndlp->nlp_state = NLP_STE_MAPPED_NODE;
@@ -972,7 +985,7 @@ lpfc_cmpl_adisc_adisc_issue(struct lpfc_hba * phba,
972 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; 985 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE;
973 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); 986 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST);
974 } 987 }
975 return (ndlp->nlp_state); 988 return ndlp->nlp_state;
976} 989}
977 990
978static uint32_t 991static uint32_t
@@ -984,7 +997,7 @@ lpfc_device_rm_adisc_issue(struct lpfc_hba * phba,
984 lpfc_els_abort(phba, ndlp, 1); 997 lpfc_els_abort(phba, ndlp, 1);
985 998
986 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 999 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
987 return (NLP_STE_FREED_NODE); 1000 return NLP_STE_FREED_NODE;
988} 1001}
989 1002
990static uint32_t 1003static uint32_t
@@ -999,10 +1012,10 @@ lpfc_device_recov_adisc_issue(struct lpfc_hba * phba,
999 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1012 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1000 spin_lock_irq(phba->host->host_lock); 1013 spin_lock_irq(phba->host->host_lock);
1001 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1014 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
1015 ndlp->nlp_flag |= NLP_NPR_ADISC;
1002 spin_unlock_irq(phba->host->host_lock); 1016 spin_unlock_irq(phba->host->host_lock);
1003 1017
1004 lpfc_disc_set_adisc(phba, ndlp); 1018 return ndlp->nlp_state;
1005 return (ndlp->nlp_state);
1006} 1019}
1007 1020
1008static uint32_t 1021static uint32_t
@@ -1015,7 +1028,7 @@ lpfc_rcv_plogi_reglogin_issue(struct lpfc_hba * phba,
1015 cmdiocb = (struct lpfc_iocbq *) arg; 1028 cmdiocb = (struct lpfc_iocbq *) arg;
1016 1029
1017 lpfc_rcv_plogi(phba, ndlp, cmdiocb); 1030 lpfc_rcv_plogi(phba, ndlp, cmdiocb);
1018 return (ndlp->nlp_state); 1031 return ndlp->nlp_state;
1019} 1032}
1020 1033
1021static uint32_t 1034static uint32_t
@@ -1028,7 +1041,7 @@ lpfc_rcv_prli_reglogin_issue(struct lpfc_hba * phba,
1028 cmdiocb = (struct lpfc_iocbq *) arg; 1041 cmdiocb = (struct lpfc_iocbq *) arg;
1029 1042
1030 lpfc_els_rsp_prli_acc(phba, cmdiocb, ndlp); 1043 lpfc_els_rsp_prli_acc(phba, cmdiocb, ndlp);
1031 return (ndlp->nlp_state); 1044 return ndlp->nlp_state;
1032} 1045}
1033 1046
1034static uint32_t 1047static uint32_t
@@ -1041,7 +1054,7 @@ lpfc_rcv_logo_reglogin_issue(struct lpfc_hba * phba,
1041 cmdiocb = (struct lpfc_iocbq *) arg; 1054 cmdiocb = (struct lpfc_iocbq *) arg;
1042 1055
1043 lpfc_rcv_logo(phba, ndlp, cmdiocb); 1056 lpfc_rcv_logo(phba, ndlp, cmdiocb);
1044 return (ndlp->nlp_state); 1057 return ndlp->nlp_state;
1045} 1058}
1046 1059
1047static uint32_t 1060static uint32_t
@@ -1054,7 +1067,7 @@ lpfc_rcv_padisc_reglogin_issue(struct lpfc_hba * phba,
1054 cmdiocb = (struct lpfc_iocbq *) arg; 1067 cmdiocb = (struct lpfc_iocbq *) arg;
1055 1068
1056 lpfc_rcv_padisc(phba, ndlp, cmdiocb); 1069 lpfc_rcv_padisc(phba, ndlp, cmdiocb);
1057 return (ndlp->nlp_state); 1070 return ndlp->nlp_state;
1058} 1071}
1059 1072
1060static uint32_t 1073static uint32_t
@@ -1066,7 +1079,7 @@ lpfc_rcv_prlo_reglogin_issue(struct lpfc_hba * phba,
1066 1079
1067 cmdiocb = (struct lpfc_iocbq *) arg; 1080 cmdiocb = (struct lpfc_iocbq *) arg;
1068 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 1081 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
1069 return (ndlp->nlp_state); 1082 return ndlp->nlp_state;
1070} 1083}
1071 1084
1072static uint32_t 1085static uint32_t
@@ -1100,7 +1113,7 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_hba * phba,
1100 ndlp->nlp_last_elscmd = (unsigned long)ELS_CMD_PLOGI; 1113 ndlp->nlp_last_elscmd = (unsigned long)ELS_CMD_PLOGI;
1101 ndlp->nlp_state = NLP_STE_NPR_NODE; 1114 ndlp->nlp_state = NLP_STE_NPR_NODE;
1102 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1115 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1103 return (ndlp->nlp_state); 1116 return ndlp->nlp_state;
1104 } 1117 }
1105 1118
1106 ndlp->nlp_rpi = mb->un.varWords[0]; 1119 ndlp->nlp_rpi = mb->un.varWords[0];
@@ -1114,7 +1127,7 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_hba * phba,
1114 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; 1127 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE;
1115 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); 1128 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST);
1116 } 1129 }
1117 return (ndlp->nlp_state); 1130 return ndlp->nlp_state;
1118} 1131}
1119 1132
1120static uint32_t 1133static uint32_t
@@ -1123,7 +1136,7 @@ lpfc_device_rm_reglogin_issue(struct lpfc_hba * phba,
1123 uint32_t evt) 1136 uint32_t evt)
1124{ 1137{
1125 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1138 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
1126 return (NLP_STE_FREED_NODE); 1139 return NLP_STE_FREED_NODE;
1127} 1140}
1128 1141
1129static uint32_t 1142static uint32_t
@@ -1136,7 +1149,7 @@ lpfc_device_recov_reglogin_issue(struct lpfc_hba * phba,
1136 spin_lock_irq(phba->host->host_lock); 1149 spin_lock_irq(phba->host->host_lock);
1137 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1150 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
1138 spin_unlock_irq(phba->host->host_lock); 1151 spin_unlock_irq(phba->host->host_lock);
1139 return (ndlp->nlp_state); 1152 return ndlp->nlp_state;
1140} 1153}
1141 1154
1142static uint32_t 1155static uint32_t
@@ -1148,7 +1161,7 @@ lpfc_rcv_plogi_prli_issue(struct lpfc_hba * phba,
1148 cmdiocb = (struct lpfc_iocbq *) arg; 1161 cmdiocb = (struct lpfc_iocbq *) arg;
1149 1162
1150 lpfc_rcv_plogi(phba, ndlp, cmdiocb); 1163 lpfc_rcv_plogi(phba, ndlp, cmdiocb);
1151 return (ndlp->nlp_state); 1164 return ndlp->nlp_state;
1152} 1165}
1153 1166
1154static uint32_t 1167static uint32_t
@@ -1160,7 +1173,7 @@ lpfc_rcv_prli_prli_issue(struct lpfc_hba * phba,
1160 cmdiocb = (struct lpfc_iocbq *) arg; 1173 cmdiocb = (struct lpfc_iocbq *) arg;
1161 1174
1162 lpfc_els_rsp_prli_acc(phba, cmdiocb, ndlp); 1175 lpfc_els_rsp_prli_acc(phba, cmdiocb, ndlp);
1163 return (ndlp->nlp_state); 1176 return ndlp->nlp_state;
1164} 1177}
1165 1178
1166static uint32_t 1179static uint32_t
@@ -1175,7 +1188,7 @@ lpfc_rcv_logo_prli_issue(struct lpfc_hba * phba,
1175 lpfc_els_abort(phba, ndlp, 1); 1188 lpfc_els_abort(phba, ndlp, 1);
1176 1189
1177 lpfc_rcv_logo(phba, ndlp, cmdiocb); 1190 lpfc_rcv_logo(phba, ndlp, cmdiocb);
1178 return (ndlp->nlp_state); 1191 return ndlp->nlp_state;
1179} 1192}
1180 1193
1181static uint32_t 1194static uint32_t
@@ -1187,7 +1200,7 @@ lpfc_rcv_padisc_prli_issue(struct lpfc_hba * phba,
1187 cmdiocb = (struct lpfc_iocbq *) arg; 1200 cmdiocb = (struct lpfc_iocbq *) arg;
1188 1201
1189 lpfc_rcv_padisc(phba, ndlp, cmdiocb); 1202 lpfc_rcv_padisc(phba, ndlp, cmdiocb);
1190 return (ndlp->nlp_state); 1203 return ndlp->nlp_state;
1191} 1204}
1192 1205
1193/* This routine is envoked when we rcv a PRLO request from a nport 1206/* This routine is envoked when we rcv a PRLO request from a nport
@@ -1203,7 +1216,7 @@ lpfc_rcv_prlo_prli_issue(struct lpfc_hba * phba,
1203 1216
1204 cmdiocb = (struct lpfc_iocbq *) arg; 1217 cmdiocb = (struct lpfc_iocbq *) arg;
1205 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 1218 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
1206 return (ndlp->nlp_state); 1219 return ndlp->nlp_state;
1207} 1220}
1208 1221
1209static uint32_t 1222static uint32_t
@@ -1222,7 +1235,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_hba * phba,
1222 if (irsp->ulpStatus) { 1235 if (irsp->ulpStatus) {
1223 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; 1236 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE;
1224 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); 1237 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST);
1225 return (ndlp->nlp_state); 1238 return ndlp->nlp_state;
1226 } 1239 }
1227 1240
1228 /* Check out PRLI rsp */ 1241 /* Check out PRLI rsp */
@@ -1240,7 +1253,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_hba * phba,
1240 1253
1241 ndlp->nlp_state = NLP_STE_MAPPED_NODE; 1254 ndlp->nlp_state = NLP_STE_MAPPED_NODE;
1242 lpfc_nlp_list(phba, ndlp, NLP_MAPPED_LIST); 1255 lpfc_nlp_list(phba, ndlp, NLP_MAPPED_LIST);
1243 return (ndlp->nlp_state); 1256 return ndlp->nlp_state;
1244} 1257}
1245 1258
1246/*! lpfc_device_rm_prli_issue 1259/*! lpfc_device_rm_prli_issue
@@ -1268,7 +1281,7 @@ lpfc_device_rm_prli_issue(struct lpfc_hba * phba,
1268 lpfc_els_abort(phba, ndlp, 1); 1281 lpfc_els_abort(phba, ndlp, 1);
1269 1282
1270 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1283 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
1271 return (NLP_STE_FREED_NODE); 1284 return NLP_STE_FREED_NODE;
1272} 1285}
1273 1286
1274 1287
@@ -1300,7 +1313,7 @@ lpfc_device_recov_prli_issue(struct lpfc_hba * phba,
1300 spin_lock_irq(phba->host->host_lock); 1313 spin_lock_irq(phba->host->host_lock);
1301 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1314 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
1302 spin_unlock_irq(phba->host->host_lock); 1315 spin_unlock_irq(phba->host->host_lock);
1303 return (ndlp->nlp_state); 1316 return ndlp->nlp_state;
1304} 1317}
1305 1318
1306static uint32_t 1319static uint32_t
@@ -1312,7 +1325,7 @@ lpfc_rcv_plogi_unmap_node(struct lpfc_hba * phba,
1312 cmdiocb = (struct lpfc_iocbq *) arg; 1325 cmdiocb = (struct lpfc_iocbq *) arg;
1313 1326
1314 lpfc_rcv_plogi(phba, ndlp, cmdiocb); 1327 lpfc_rcv_plogi(phba, ndlp, cmdiocb);
1315 return (ndlp->nlp_state); 1328 return ndlp->nlp_state;
1316} 1329}
1317 1330
1318static uint32_t 1331static uint32_t
@@ -1325,7 +1338,7 @@ lpfc_rcv_prli_unmap_node(struct lpfc_hba * phba,
1325 1338
1326 lpfc_rcv_prli(phba, ndlp, cmdiocb); 1339 lpfc_rcv_prli(phba, ndlp, cmdiocb);
1327 lpfc_els_rsp_prli_acc(phba, cmdiocb, ndlp); 1340 lpfc_els_rsp_prli_acc(phba, cmdiocb, ndlp);
1328 return (ndlp->nlp_state); 1341 return ndlp->nlp_state;
1329} 1342}
1330 1343
1331static uint32_t 1344static uint32_t
@@ -1337,7 +1350,7 @@ lpfc_rcv_logo_unmap_node(struct lpfc_hba * phba,
1337 cmdiocb = (struct lpfc_iocbq *) arg; 1350 cmdiocb = (struct lpfc_iocbq *) arg;
1338 1351
1339 lpfc_rcv_logo(phba, ndlp, cmdiocb); 1352 lpfc_rcv_logo(phba, ndlp, cmdiocb);
1340 return (ndlp->nlp_state); 1353 return ndlp->nlp_state;
1341} 1354}
1342 1355
1343static uint32_t 1356static uint32_t
@@ -1349,7 +1362,7 @@ lpfc_rcv_padisc_unmap_node(struct lpfc_hba * phba,
1349 cmdiocb = (struct lpfc_iocbq *) arg; 1362 cmdiocb = (struct lpfc_iocbq *) arg;
1350 1363
1351 lpfc_rcv_padisc(phba, ndlp, cmdiocb); 1364 lpfc_rcv_padisc(phba, ndlp, cmdiocb);
1352 return (ndlp->nlp_state); 1365 return ndlp->nlp_state;
1353} 1366}
1354 1367
1355static uint32_t 1368static uint32_t
@@ -1360,9 +1373,8 @@ lpfc_rcv_prlo_unmap_node(struct lpfc_hba * phba,
1360 1373
1361 cmdiocb = (struct lpfc_iocbq *) arg; 1374 cmdiocb = (struct lpfc_iocbq *) arg;
1362 1375
1363 /* Treat like rcv logo */ 1376 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
1364 lpfc_rcv_logo(phba, ndlp, cmdiocb); 1377 return ndlp->nlp_state;
1365 return (ndlp->nlp_state);
1366} 1378}
1367 1379
1368static uint32_t 1380static uint32_t
@@ -1374,7 +1386,7 @@ lpfc_device_recov_unmap_node(struct lpfc_hba * phba,
1374 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1386 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
1375 lpfc_disc_set_adisc(phba, ndlp); 1387 lpfc_disc_set_adisc(phba, ndlp);
1376 1388
1377 return (ndlp->nlp_state); 1389 return ndlp->nlp_state;
1378} 1390}
1379 1391
1380static uint32_t 1392static uint32_t
@@ -1386,7 +1398,7 @@ lpfc_rcv_plogi_mapped_node(struct lpfc_hba * phba,
1386 cmdiocb = (struct lpfc_iocbq *) arg; 1398 cmdiocb = (struct lpfc_iocbq *) arg;
1387 1399
1388 lpfc_rcv_plogi(phba, ndlp, cmdiocb); 1400 lpfc_rcv_plogi(phba, ndlp, cmdiocb);
1389 return (ndlp->nlp_state); 1401 return ndlp->nlp_state;
1390} 1402}
1391 1403
1392static uint32_t 1404static uint32_t
@@ -1398,7 +1410,7 @@ lpfc_rcv_prli_mapped_node(struct lpfc_hba * phba,
1398 cmdiocb = (struct lpfc_iocbq *) arg; 1410 cmdiocb = (struct lpfc_iocbq *) arg;
1399 1411
1400 lpfc_els_rsp_prli_acc(phba, cmdiocb, ndlp); 1412 lpfc_els_rsp_prli_acc(phba, cmdiocb, ndlp);
1401 return (ndlp->nlp_state); 1413 return ndlp->nlp_state;
1402} 1414}
1403 1415
1404static uint32_t 1416static uint32_t
@@ -1410,7 +1422,7 @@ lpfc_rcv_logo_mapped_node(struct lpfc_hba * phba,
1410 cmdiocb = (struct lpfc_iocbq *) arg; 1422 cmdiocb = (struct lpfc_iocbq *) arg;
1411 1423
1412 lpfc_rcv_logo(phba, ndlp, cmdiocb); 1424 lpfc_rcv_logo(phba, ndlp, cmdiocb);
1413 return (ndlp->nlp_state); 1425 return ndlp->nlp_state;
1414} 1426}
1415 1427
1416static uint32_t 1428static uint32_t
@@ -1423,7 +1435,7 @@ lpfc_rcv_padisc_mapped_node(struct lpfc_hba * phba,
1423 cmdiocb = (struct lpfc_iocbq *) arg; 1435 cmdiocb = (struct lpfc_iocbq *) arg;
1424 1436
1425 lpfc_rcv_padisc(phba, ndlp, cmdiocb); 1437 lpfc_rcv_padisc(phba, ndlp, cmdiocb);
1426 return (ndlp->nlp_state); 1438 return ndlp->nlp_state;
1427} 1439}
1428 1440
1429static uint32_t 1441static uint32_t
@@ -1442,7 +1454,7 @@ lpfc_rcv_prlo_mapped_node(struct lpfc_hba * phba,
1442 1454
1443 /* Treat like rcv logo */ 1455 /* Treat like rcv logo */
1444 lpfc_rcv_logo(phba, ndlp, cmdiocb); 1456 lpfc_rcv_logo(phba, ndlp, cmdiocb);
1445 return (ndlp->nlp_state); 1457 return ndlp->nlp_state;
1446} 1458}
1447 1459
1448static uint32_t 1460static uint32_t
@@ -1456,7 +1468,7 @@ lpfc_device_recov_mapped_node(struct lpfc_hba * phba,
1456 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1468 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
1457 spin_unlock_irq(phba->host->host_lock); 1469 spin_unlock_irq(phba->host->host_lock);
1458 lpfc_disc_set_adisc(phba, ndlp); 1470 lpfc_disc_set_adisc(phba, ndlp);
1459 return (ndlp->nlp_state); 1471 return ndlp->nlp_state;
1460} 1472}
1461 1473
1462static uint32_t 1474static uint32_t
@@ -1470,14 +1482,14 @@ lpfc_rcv_plogi_npr_node(struct lpfc_hba * phba,
1470 1482
1471 /* Ignore PLOGI if we have an outstanding LOGO */ 1483 /* Ignore PLOGI if we have an outstanding LOGO */
1472 if (ndlp->nlp_flag & NLP_LOGO_SND) { 1484 if (ndlp->nlp_flag & NLP_LOGO_SND) {
1473 return (ndlp->nlp_state); 1485 return ndlp->nlp_state;
1474 } 1486 }
1475 1487
1476 if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) { 1488 if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) {
1477 spin_lock_irq(phba->host->host_lock); 1489 spin_lock_irq(phba->host->host_lock);
1478 ndlp->nlp_flag &= ~(NLP_NPR_ADISC | NLP_NPR_2B_DISC); 1490 ndlp->nlp_flag &= ~(NLP_NPR_ADISC | NLP_NPR_2B_DISC);
1479 spin_unlock_irq(phba->host->host_lock); 1491 spin_unlock_irq(phba->host->host_lock);
1480 return (ndlp->nlp_state); 1492 return ndlp->nlp_state;
1481 } 1493 }
1482 1494
1483 /* send PLOGI immediately, move to PLOGI issue state */ 1495 /* send PLOGI immediately, move to PLOGI issue state */
@@ -1486,7 +1498,7 @@ lpfc_rcv_plogi_npr_node(struct lpfc_hba * phba,
1486 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); 1498 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
1487 lpfc_issue_els_plogi(phba, ndlp, 0); 1499 lpfc_issue_els_plogi(phba, ndlp, 0);
1488 } 1500 }
1489 return (ndlp->nlp_state); 1501 return ndlp->nlp_state;
1490} 1502}
1491 1503
1492static uint32_t 1504static uint32_t
@@ -1506,6 +1518,9 @@ lpfc_rcv_prli_npr_node(struct lpfc_hba * phba,
1506 1518
1507 if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) { 1519 if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) {
1508 if (ndlp->nlp_flag & NLP_NPR_ADISC) { 1520 if (ndlp->nlp_flag & NLP_NPR_ADISC) {
1521 spin_lock_irq(phba->host->host_lock);
1522 ndlp->nlp_flag &= ~NLP_NPR_ADISC;
1523 spin_unlock_irq(phba->host->host_lock);
1509 ndlp->nlp_state = NLP_STE_ADISC_ISSUE; 1524 ndlp->nlp_state = NLP_STE_ADISC_ISSUE;
1510 lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST); 1525 lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST);
1511 lpfc_issue_els_adisc(phba, ndlp, 0); 1526 lpfc_issue_els_adisc(phba, ndlp, 0);
@@ -1515,7 +1530,7 @@ lpfc_rcv_prli_npr_node(struct lpfc_hba * phba,
1515 lpfc_issue_els_plogi(phba, ndlp, 0); 1530 lpfc_issue_els_plogi(phba, ndlp, 0);
1516 } 1531 }
1517 } 1532 }
1518 return (ndlp->nlp_state); 1533 return ndlp->nlp_state;
1519} 1534}
1520 1535
1521static uint32_t 1536static uint32_t
@@ -1528,7 +1543,7 @@ lpfc_rcv_logo_npr_node(struct lpfc_hba * phba,
1528 cmdiocb = (struct lpfc_iocbq *) arg; 1543 cmdiocb = (struct lpfc_iocbq *) arg;
1529 1544
1530 lpfc_rcv_logo(phba, ndlp, cmdiocb); 1545 lpfc_rcv_logo(phba, ndlp, cmdiocb);
1531 return (ndlp->nlp_state); 1546 return ndlp->nlp_state;
1532} 1547}
1533 1548
1534static uint32_t 1549static uint32_t
@@ -1553,7 +1568,7 @@ lpfc_rcv_padisc_npr_node(struct lpfc_hba * phba,
1553 lpfc_issue_els_plogi(phba, ndlp, 0); 1568 lpfc_issue_els_plogi(phba, ndlp, 0);
1554 } 1569 }
1555 } 1570 }
1556 return (ndlp->nlp_state); 1571 return ndlp->nlp_state;
1557} 1572}
1558 1573
1559static uint32_t 1574static uint32_t
@@ -1565,25 +1580,46 @@ lpfc_rcv_prlo_npr_node(struct lpfc_hba * phba,
1565 1580
1566 cmdiocb = (struct lpfc_iocbq *) arg; 1581 cmdiocb = (struct lpfc_iocbq *) arg;
1567 1582
1583 spin_lock_irq(phba->host->host_lock);
1584 ndlp->nlp_flag |= NLP_LOGO_ACC;
1585 spin_unlock_irq(phba->host->host_lock);
1586
1568 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 1587 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
1569 1588
1570 if (ndlp->nlp_flag & NLP_DELAY_TMO) { 1589 if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) {
1571 if (ndlp->nlp_last_elscmd == (unsigned long)ELS_CMD_PLOGI) { 1590 mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1);
1572 return (ndlp->nlp_state); 1591 spin_lock_irq(phba->host->host_lock);
1573 } else { 1592 ndlp->nlp_flag |= NLP_DELAY_TMO;
1574 spin_lock_irq(phba->host->host_lock); 1593 ndlp->nlp_flag &= ~NLP_NPR_ADISC;
1575 ndlp->nlp_flag &= ~NLP_DELAY_TMO; 1594 spin_unlock_irq(phba->host->host_lock);
1576 spin_unlock_irq(phba->host->host_lock); 1595 } else {
1577 del_timer_sync(&ndlp->nlp_delayfunc); 1596 spin_lock_irq(phba->host->host_lock);
1578 if (!list_empty(&ndlp->els_retry_evt.evt_listp)) 1597 ndlp->nlp_flag &= ~NLP_NPR_ADISC;
1579 list_del_init(&ndlp->els_retry_evt.evt_listp); 1598 spin_unlock_irq(phba->host->host_lock);
1580 }
1581 } 1599 }
1600 return ndlp->nlp_state;
1601}
1582 1602
1583 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; 1603static uint32_t
1584 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); 1604lpfc_cmpl_plogi_npr_node(struct lpfc_hba * phba,
1585 lpfc_issue_els_plogi(phba, ndlp, 0); 1605 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
1586 return (ndlp->nlp_state); 1606{
1607 struct lpfc_iocbq *cmdiocb, *rspiocb;
1608
1609 cmdiocb = (struct lpfc_iocbq *) arg;
1610 rspiocb = cmdiocb->context_un.rsp_iocb;
1611 return ndlp->nlp_state;
1612}
1613
1614static uint32_t
1615lpfc_cmpl_prli_npr_node(struct lpfc_hba * phba,
1616 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
1617{
1618 struct lpfc_iocbq *cmdiocb, *rspiocb;
1619
1620 cmdiocb = (struct lpfc_iocbq *) arg;
1621 rspiocb = cmdiocb->context_un.rsp_iocb;
1622 return ndlp->nlp_state;
1587} 1623}
1588 1624
1589static uint32_t 1625static uint32_t
@@ -1592,7 +1628,19 @@ lpfc_cmpl_logo_npr_node(struct lpfc_hba * phba,
1592{ 1628{
1593 lpfc_unreg_rpi(phba, ndlp); 1629 lpfc_unreg_rpi(phba, ndlp);
1594 /* This routine does nothing, just return the current state */ 1630 /* This routine does nothing, just return the current state */
1595 return (ndlp->nlp_state); 1631 return ndlp->nlp_state;
1632}
1633
1634static uint32_t
1635lpfc_cmpl_adisc_npr_node(struct lpfc_hba * phba,
1636 struct lpfc_nodelist * ndlp, void *arg,
1637 uint32_t evt)
1638{
1639 struct lpfc_iocbq *cmdiocb, *rspiocb;
1640
1641 cmdiocb = (struct lpfc_iocbq *) arg;
1642 rspiocb = cmdiocb->context_un.rsp_iocb;
1643 return ndlp->nlp_state;
1596} 1644}
1597 1645
1598static uint32_t 1646static uint32_t
@@ -1606,9 +1654,10 @@ lpfc_cmpl_reglogin_npr_node(struct lpfc_hba * phba,
1606 pmb = (LPFC_MBOXQ_t *) arg; 1654 pmb = (LPFC_MBOXQ_t *) arg;
1607 mb = &pmb->mb; 1655 mb = &pmb->mb;
1608 1656
1609 ndlp->nlp_rpi = mb->un.varWords[0]; 1657 if (!mb->mbxStatus)
1658 ndlp->nlp_rpi = mb->un.varWords[0];
1610 1659
1611 return (ndlp->nlp_state); 1660 return ndlp->nlp_state;
1612} 1661}
1613 1662
1614static uint32_t 1663static uint32_t
@@ -1617,7 +1666,7 @@ lpfc_device_rm_npr_node(struct lpfc_hba * phba,
1617 uint32_t evt) 1666 uint32_t evt)
1618{ 1667{
1619 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1668 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST);
1620 return (NLP_STE_FREED_NODE); 1669 return NLP_STE_FREED_NODE;
1621} 1670}
1622 1671
1623static uint32_t 1672static uint32_t
@@ -1633,10 +1682,10 @@ lpfc_device_recov_npr_node(struct lpfc_hba * phba,
1633 list_del_init(&ndlp->els_retry_evt.evt_listp); 1682 list_del_init(&ndlp->els_retry_evt.evt_listp);
1634 spin_unlock_irq(phba->host->host_lock); 1683 spin_unlock_irq(phba->host->host_lock);
1635 del_timer_sync(&ndlp->nlp_delayfunc); 1684 del_timer_sync(&ndlp->nlp_delayfunc);
1636 return (ndlp->nlp_state); 1685 return ndlp->nlp_state;
1637 } 1686 }
1638 spin_unlock_irq(phba->host->host_lock); 1687 spin_unlock_irq(phba->host->host_lock);
1639 return (ndlp->nlp_state); 1688 return ndlp->nlp_state;
1640} 1689}
1641 1690
1642 1691
@@ -1715,7 +1764,7 @@ static uint32_t (*lpfc_disc_action[NLP_STE_MAX_STATE * NLP_EVT_MAX_EVENT])
1715 1764
1716 lpfc_rcv_plogi_plogi_issue, /* RCV_PLOGI PLOGI_ISSUE */ 1765 lpfc_rcv_plogi_plogi_issue, /* RCV_PLOGI PLOGI_ISSUE */
1717 lpfc_rcv_els_plogi_issue, /* RCV_PRLI */ 1766 lpfc_rcv_els_plogi_issue, /* RCV_PRLI */
1718 lpfc_rcv_els_plogi_issue, /* RCV_LOGO */ 1767 lpfc_rcv_logo_plogi_issue, /* RCV_LOGO */
1719 lpfc_rcv_els_plogi_issue, /* RCV_ADISC */ 1768 lpfc_rcv_els_plogi_issue, /* RCV_ADISC */
1720 lpfc_rcv_els_plogi_issue, /* RCV_PDISC */ 1769 lpfc_rcv_els_plogi_issue, /* RCV_PDISC */
1721 lpfc_rcv_els_plogi_issue, /* RCV_PRLO */ 1770 lpfc_rcv_els_plogi_issue, /* RCV_PRLO */
@@ -1803,10 +1852,10 @@ static uint32_t (*lpfc_disc_action[NLP_STE_MAX_STATE * NLP_EVT_MAX_EVENT])
1803 lpfc_rcv_padisc_npr_node, /* RCV_ADISC */ 1852 lpfc_rcv_padisc_npr_node, /* RCV_ADISC */
1804 lpfc_rcv_padisc_npr_node, /* RCV_PDISC */ 1853 lpfc_rcv_padisc_npr_node, /* RCV_PDISC */
1805 lpfc_rcv_prlo_npr_node, /* RCV_PRLO */ 1854 lpfc_rcv_prlo_npr_node, /* RCV_PRLO */
1806 lpfc_disc_noop, /* CMPL_PLOGI */ 1855 lpfc_cmpl_plogi_npr_node, /* CMPL_PLOGI */
1807 lpfc_disc_noop, /* CMPL_PRLI */ 1856 lpfc_cmpl_prli_npr_node, /* CMPL_PRLI */
1808 lpfc_cmpl_logo_npr_node, /* CMPL_LOGO */ 1857 lpfc_cmpl_logo_npr_node, /* CMPL_LOGO */
1809 lpfc_disc_noop, /* CMPL_ADISC */ 1858 lpfc_cmpl_adisc_npr_node, /* CMPL_ADISC */
1810 lpfc_cmpl_reglogin_npr_node, /* CMPL_REG_LOGIN */ 1859 lpfc_cmpl_reglogin_npr_node, /* CMPL_REG_LOGIN */
1811 lpfc_device_rm_npr_node, /* DEVICE_RM */ 1860 lpfc_device_rm_npr_node, /* DEVICE_RM */
1812 lpfc_device_recov_npr_node, /* DEVICE_RECOVERY */ 1861 lpfc_device_recov_npr_node, /* DEVICE_RECOVERY */
@@ -1852,10 +1901,10 @@ lpfc_disc_state_machine(struct lpfc_hba * phba,
1852 ndlp->nlp_flag &= ~NLP_DELAY_REMOVE; 1901 ndlp->nlp_flag &= ~NLP_DELAY_REMOVE;
1853 spin_unlock_irq(phba->host->host_lock); 1902 spin_unlock_irq(phba->host->host_lock);
1854 lpfc_nlp_remove(phba, ndlp); 1903 lpfc_nlp_remove(phba, ndlp);
1855 return (NLP_STE_FREED_NODE); 1904 return NLP_STE_FREED_NODE;
1856 } 1905 }
1857 if (rc == NLP_STE_FREED_NODE) 1906 if (rc == NLP_STE_FREED_NODE)
1858 return (NLP_STE_FREED_NODE); 1907 return NLP_STE_FREED_NODE;
1859 ndlp->nlp_state = rc; 1908 ndlp->nlp_state = rc;
1860 return (rc); 1909 return rc;
1861} 1910}