aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_nportdisc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_nportdisc.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_nportdisc.c128
1 files changed, 47 insertions, 81 deletions
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index 1c78a71b404d..5595c612e223 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -434,8 +434,7 @@ lpfc_rcv_padisc(struct lpfc_hba * phba,
434 spin_unlock_irq(phba->host->host_lock); 434 spin_unlock_irq(phba->host->host_lock);
435 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; 435 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
436 ndlp->nlp_prev_state = ndlp->nlp_state; 436 ndlp->nlp_prev_state = ndlp->nlp_state;
437 ndlp->nlp_state = NLP_STE_NPR_NODE; 437 lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE);
438 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
439 return 0; 438 return 0;
440} 439}
441 440
@@ -465,12 +464,10 @@ lpfc_rcv_logo(struct lpfc_hba * phba,
465 464
466 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; 465 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
467 ndlp->nlp_prev_state = ndlp->nlp_state; 466 ndlp->nlp_prev_state = ndlp->nlp_state;
468 ndlp->nlp_state = NLP_STE_NPR_NODE; 467 lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE);
469 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
470 } else { 468 } else {
471 ndlp->nlp_prev_state = ndlp->nlp_state; 469 ndlp->nlp_prev_state = ndlp->nlp_state;
472 ndlp->nlp_state = NLP_STE_UNUSED_NODE; 470 lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNUSED_NODE);
473 lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST);
474 } 471 }
475 472
476 spin_lock_irq(phba->host->host_lock); 473 spin_lock_irq(phba->host->host_lock);
@@ -564,11 +561,10 @@ lpfc_rcv_plogi_unused_node(struct lpfc_hba * phba,
564 561
565 if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) { 562 if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) {
566 ndlp->nlp_prev_state = NLP_STE_UNUSED_NODE; 563 ndlp->nlp_prev_state = NLP_STE_UNUSED_NODE;
567 ndlp->nlp_state = NLP_STE_UNUSED_NODE; 564 lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNUSED_NODE);
568 lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST);
569 return ndlp->nlp_state; 565 return ndlp->nlp_state;
570 } 566 }
571 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 567 lpfc_drop_node(phba, ndlp);
572 return NLP_STE_FREED_NODE; 568 return NLP_STE_FREED_NODE;
573} 569}
574 570
@@ -577,7 +573,7 @@ lpfc_rcv_els_unused_node(struct lpfc_hba * phba,
577 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) 573 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
578{ 574{
579 lpfc_issue_els_logo(phba, ndlp, 0); 575 lpfc_issue_els_logo(phba, ndlp, 0);
580 lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); 576 lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNUSED_NODE);
581 return ndlp->nlp_state; 577 return ndlp->nlp_state;
582} 578}
583 579
@@ -593,7 +589,7 @@ lpfc_rcv_logo_unused_node(struct lpfc_hba * phba,
593 ndlp->nlp_flag |= NLP_LOGO_ACC; 589 ndlp->nlp_flag |= NLP_LOGO_ACC;
594 spin_unlock_irq(phba->host->host_lock); 590 spin_unlock_irq(phba->host->host_lock);
595 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 591 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
596 lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); 592 lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNUSED_NODE);
597 593
598 return ndlp->nlp_state; 594 return ndlp->nlp_state;
599} 595}
@@ -602,7 +598,7 @@ static uint32_t
602lpfc_cmpl_logo_unused_node(struct lpfc_hba * phba, 598lpfc_cmpl_logo_unused_node(struct lpfc_hba * phba,
603 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) 599 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
604{ 600{
605 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 601 lpfc_drop_node(phba, ndlp);
606 return NLP_STE_FREED_NODE; 602 return NLP_STE_FREED_NODE;
607} 603}
608 604
@@ -610,7 +606,7 @@ static uint32_t
610lpfc_device_rm_unused_node(struct lpfc_hba * phba, 606lpfc_device_rm_unused_node(struct lpfc_hba * phba,
611 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) 607 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
612{ 608{
613 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 609 lpfc_drop_node(phba, ndlp);
614 return NLP_STE_FREED_NODE; 610 return NLP_STE_FREED_NODE;
615} 611}
616 612
@@ -690,8 +686,7 @@ lpfc_rcv_els_plogi_issue(struct lpfc_hba * phba,
690 spin_unlock_irq(phba->host->host_lock); 686 spin_unlock_irq(phba->host->host_lock);
691 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI; 687 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
692 ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE; 688 ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE;
693 ndlp->nlp_state = NLP_STE_NPR_NODE; 689 lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE);
694 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
695 690
696 return ndlp->nlp_state; 691 return ndlp->nlp_state;
697} 692}
@@ -766,30 +761,23 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_hba * phba,
766 goto out; 761 goto out;
767 762
768 lpfc_unreg_rpi(phba, ndlp); 763 lpfc_unreg_rpi(phba, ndlp);
769 if (lpfc_reg_login 764 if (lpfc_reg_login(phba, irsp->un.elsreq64.remoteID, (uint8_t *) sp,
770 (phba, irsp->un.elsreq64.remoteID, 765 mbox, 0) == 0) {
771 (uint8_t *) sp, mbox, 0) == 0) {
772 switch (ndlp->nlp_DID) { 766 switch (ndlp->nlp_DID) {
773 case NameServer_DID: 767 case NameServer_DID:
774 mbox->mbox_cmpl = 768 mbox->mbox_cmpl = lpfc_mbx_cmpl_ns_reg_login;
775 lpfc_mbx_cmpl_ns_reg_login;
776 break; 769 break;
777 case FDMI_DID: 770 case FDMI_DID:
778 mbox->mbox_cmpl = 771 mbox->mbox_cmpl = lpfc_mbx_cmpl_fdmi_reg_login;
779 lpfc_mbx_cmpl_fdmi_reg_login;
780 break; 772 break;
781 default: 773 default:
782 mbox->mbox_cmpl = 774 mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login;
783 lpfc_mbx_cmpl_reg_login;
784 } 775 }
785 mbox->context2 = ndlp; 776 mbox->context2 = ndlp;
786 if (lpfc_sli_issue_mbox(phba, mbox, 777 if (lpfc_sli_issue_mbox(phba, mbox,
787 (MBX_NOWAIT | MBX_STOP_IOCB)) 778 (MBX_NOWAIT | MBX_STOP_IOCB))
788 != MBX_NOT_FINISHED) { 779 != MBX_NOT_FINISHED) {
789 ndlp->nlp_state = 780 lpfc_nlp_set_state(phba, ndlp, NLP_STE_REG_LOGIN_ISSUE);
790 NLP_STE_REG_LOGIN_ISSUE;
791 lpfc_nlp_list(phba, ndlp,
792 NLP_REGLOGIN_LIST);
793 return ndlp->nlp_state; 781 return ndlp->nlp_state;
794 } 782 }
795 mp = (struct lpfc_dmabuf *)mbox->context1; 783 mp = (struct lpfc_dmabuf *)mbox->context1;
@@ -804,7 +792,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_hba * phba,
804 out: 792 out:
805 /* Free this node since the driver cannot login or has the wrong 793 /* Free this node since the driver cannot login or has the wrong
806 sparm */ 794 sparm */
807 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 795 lpfc_drop_node(phba, ndlp);
808 return NLP_STE_FREED_NODE; 796 return NLP_STE_FREED_NODE;
809} 797}
810 798
@@ -820,7 +808,7 @@ lpfc_device_rm_plogi_issue(struct lpfc_hba * phba,
820 /* software abort outstanding PLOGI */ 808 /* software abort outstanding PLOGI */
821 lpfc_els_abort(phba, ndlp); 809 lpfc_els_abort(phba, ndlp);
822 810
823 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 811 lpfc_drop_node(phba, ndlp);
824 return NLP_STE_FREED_NODE; 812 return NLP_STE_FREED_NODE;
825 } 813 }
826} 814}
@@ -834,8 +822,7 @@ lpfc_device_recov_plogi_issue(struct lpfc_hba * phba,
834 lpfc_els_abort(phba, ndlp); 822 lpfc_els_abort(phba, ndlp);
835 823
836 ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE; 824 ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE;
837 ndlp->nlp_state = NLP_STE_NPR_NODE; 825 lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE);
838 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
839 spin_lock_irq(phba->host->host_lock); 826 spin_lock_irq(phba->host->host_lock);
840 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 827 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
841 spin_unlock_irq(phba->host->host_lock); 828 spin_unlock_irq(phba->host->host_lock);
@@ -859,8 +846,7 @@ lpfc_rcv_plogi_adisc_issue(struct lpfc_hba * phba,
859 return ndlp->nlp_state; 846 return ndlp->nlp_state;
860 } 847 }
861 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; 848 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE;
862 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; 849 lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE);
863 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
864 lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); 850 lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0);
865 851
866 return ndlp->nlp_state; 852 return ndlp->nlp_state;
@@ -950,20 +936,17 @@ lpfc_cmpl_adisc_adisc_issue(struct lpfc_hba * phba,
950 memset(&ndlp->nlp_portname, 0, sizeof (struct lpfc_name)); 936 memset(&ndlp->nlp_portname, 0, sizeof (struct lpfc_name));
951 937
952 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; 938 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE;
953 ndlp->nlp_state = NLP_STE_NPR_NODE; 939 lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE);
954 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
955 lpfc_unreg_rpi(phba, ndlp); 940 lpfc_unreg_rpi(phba, ndlp);
956 return ndlp->nlp_state; 941 return ndlp->nlp_state;
957 } 942 }
958 943
959 if (ndlp->nlp_type & NLP_FCP_TARGET) { 944 if (ndlp->nlp_type & NLP_FCP_TARGET) {
960 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; 945 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE;
961 ndlp->nlp_state = NLP_STE_MAPPED_NODE; 946 lpfc_nlp_set_state(phba, ndlp, NLP_STE_MAPPED_NODE);
962 lpfc_nlp_list(phba, ndlp, NLP_MAPPED_LIST);
963 } else { 947 } else {
964 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; 948 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE;
965 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; 949 lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNMAPPED_NODE);
966 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST);
967 } 950 }
968 return ndlp->nlp_state; 951 return ndlp->nlp_state;
969} 952}
@@ -981,7 +964,7 @@ lpfc_device_rm_adisc_issue(struct lpfc_hba * phba,
981 /* software abort outstanding ADISC */ 964 /* software abort outstanding ADISC */
982 lpfc_els_abort(phba, ndlp); 965 lpfc_els_abort(phba, ndlp);
983 966
984 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 967 lpfc_drop_node(phba, ndlp);
985 return NLP_STE_FREED_NODE; 968 return NLP_STE_FREED_NODE;
986 } 969 }
987} 970}
@@ -995,8 +978,7 @@ lpfc_device_recov_adisc_issue(struct lpfc_hba * phba,
995 lpfc_els_abort(phba, ndlp); 978 lpfc_els_abort(phba, ndlp);
996 979
997 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE; 980 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE;
998 ndlp->nlp_state = NLP_STE_NPR_NODE; 981 lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE);
999 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1000 spin_lock_irq(phba->host->host_lock); 982 spin_lock_irq(phba->host->host_lock);
1001 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 983 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
1002 ndlp->nlp_flag |= NLP_NPR_ADISC; 984 ndlp->nlp_flag |= NLP_NPR_ADISC;
@@ -1096,8 +1078,7 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_hba * phba,
1096 */ 1078 */
1097 if (mb->mbxStatus == MBXERR_RPI_FULL) { 1079 if (mb->mbxStatus == MBXERR_RPI_FULL) {
1098 ndlp->nlp_prev_state = NLP_STE_UNUSED_NODE; 1080 ndlp->nlp_prev_state = NLP_STE_UNUSED_NODE;
1099 ndlp->nlp_state = NLP_STE_UNUSED_NODE; 1081 lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNUSED_NODE);
1100 lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST);
1101 return ndlp->nlp_state; 1082 return ndlp->nlp_state;
1102 } 1083 }
1103 1084
@@ -1110,8 +1091,7 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_hba * phba,
1110 1091
1111 lpfc_issue_els_logo(phba, ndlp, 0); 1092 lpfc_issue_els_logo(phba, ndlp, 0);
1112 ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; 1093 ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE;
1113 ndlp->nlp_state = NLP_STE_NPR_NODE; 1094 lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE);
1114 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1115 return ndlp->nlp_state; 1095 return ndlp->nlp_state;
1116 } 1096 }
1117 1097
@@ -1120,13 +1100,11 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_hba * phba,
1120 /* Only if we are not a fabric nport do we issue PRLI */ 1100 /* Only if we are not a fabric nport do we issue PRLI */
1121 if (!(ndlp->nlp_type & NLP_FABRIC)) { 1101 if (!(ndlp->nlp_type & NLP_FABRIC)) {
1122 ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; 1102 ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE;
1123 ndlp->nlp_state = NLP_STE_PRLI_ISSUE; 1103 lpfc_nlp_set_state(phba, ndlp, NLP_STE_PRLI_ISSUE);
1124 lpfc_nlp_list(phba, ndlp, NLP_PRLI_LIST);
1125 lpfc_issue_els_prli(phba, ndlp, 0); 1104 lpfc_issue_els_prli(phba, ndlp, 0);
1126 } else { 1105 } else {
1127 ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; 1106 ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE;
1128 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; 1107 lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNMAPPED_NODE);
1129 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST);
1130 } 1108 }
1131 return ndlp->nlp_state; 1109 return ndlp->nlp_state;
1132} 1110}
@@ -1141,7 +1119,7 @@ lpfc_device_rm_reglogin_issue(struct lpfc_hba * phba,
1141 return ndlp->nlp_state; 1119 return ndlp->nlp_state;
1142 } 1120 }
1143 else { 1121 else {
1144 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1122 lpfc_drop_node(phba, ndlp);
1145 return NLP_STE_FREED_NODE; 1123 return NLP_STE_FREED_NODE;
1146 } 1124 }
1147} 1125}
@@ -1152,8 +1130,7 @@ lpfc_device_recov_reglogin_issue(struct lpfc_hba * phba,
1152 uint32_t evt) 1130 uint32_t evt)
1153{ 1131{
1154 ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE; 1132 ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE;
1155 ndlp->nlp_state = NLP_STE_NPR_NODE; 1133 lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE);
1156 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1157 spin_lock_irq(phba->host->host_lock); 1134 spin_lock_irq(phba->host->host_lock);
1158 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 1135 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
1159 spin_unlock_irq(phba->host->host_lock); 1136 spin_unlock_irq(phba->host->host_lock);
@@ -1242,8 +1219,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_hba * phba,
1242 irsp = &rspiocb->iocb; 1219 irsp = &rspiocb->iocb;
1243 if (irsp->ulpStatus) { 1220 if (irsp->ulpStatus) {
1244 ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; 1221 ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE;
1245 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; 1222 lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNMAPPED_NODE);
1246 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST);
1247 return ndlp->nlp_state; 1223 return ndlp->nlp_state;
1248 } 1224 }
1249 1225
@@ -1261,8 +1237,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_hba * phba,
1261 } 1237 }
1262 1238
1263 ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; 1239 ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE;
1264 ndlp->nlp_state = NLP_STE_MAPPED_NODE; 1240 lpfc_nlp_set_state(phba, ndlp, NLP_STE_MAPPED_NODE);
1265 lpfc_nlp_list(phba, ndlp, NLP_MAPPED_LIST);
1266 return ndlp->nlp_state; 1241 return ndlp->nlp_state;
1267} 1242}
1268 1243
@@ -1295,7 +1270,7 @@ lpfc_device_rm_prli_issue(struct lpfc_hba * phba,
1295 /* software abort outstanding PLOGI */ 1270 /* software abort outstanding PLOGI */
1296 lpfc_els_abort(phba, ndlp); 1271 lpfc_els_abort(phba, ndlp);
1297 1272
1298 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1273 lpfc_drop_node(phba, ndlp);
1299 return NLP_STE_FREED_NODE; 1274 return NLP_STE_FREED_NODE;
1300 } 1275 }
1301} 1276}
@@ -1325,8 +1300,7 @@ lpfc_device_recov_prli_issue(struct lpfc_hba * phba,
1325 lpfc_els_abort(phba, ndlp); 1300 lpfc_els_abort(phba, ndlp);
1326 1301
1327 ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE; 1302 ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE;
1328 ndlp->nlp_state = NLP_STE_NPR_NODE; 1303 lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE);
1329 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1330 spin_lock_irq(phba->host->host_lock); 1304 spin_lock_irq(phba->host->host_lock);
1331 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 1305 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
1332 spin_unlock_irq(phba->host->host_lock); 1306 spin_unlock_irq(phba->host->host_lock);
@@ -1399,8 +1373,7 @@ lpfc_device_recov_unmap_node(struct lpfc_hba * phba,
1399 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) 1373 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
1400{ 1374{
1401 ndlp->nlp_prev_state = NLP_STE_UNMAPPED_NODE; 1375 ndlp->nlp_prev_state = NLP_STE_UNMAPPED_NODE;
1402 ndlp->nlp_state = NLP_STE_NPR_NODE; 1376 lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE);
1403 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1404 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 1377 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
1405 lpfc_disc_set_adisc(phba, ndlp); 1378 lpfc_disc_set_adisc(phba, ndlp);
1406 1379
@@ -1481,8 +1454,7 @@ lpfc_device_recov_mapped_node(struct lpfc_hba * phba,
1481 uint32_t evt) 1454 uint32_t evt)
1482{ 1455{
1483 ndlp->nlp_prev_state = NLP_STE_MAPPED_NODE; 1456 ndlp->nlp_prev_state = NLP_STE_MAPPED_NODE;
1484 ndlp->nlp_state = NLP_STE_NPR_NODE; 1457 lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE);
1485 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1486 spin_lock_irq(phba->host->host_lock); 1458 spin_lock_irq(phba->host->host_lock);
1487 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC); 1459 ndlp->nlp_flag &= ~(NLP_NODEV_REMOVE | NLP_NPR_2B_DISC);
1488 spin_unlock_irq(phba->host->host_lock); 1460 spin_unlock_irq(phba->host->host_lock);
@@ -1514,8 +1486,7 @@ lpfc_rcv_plogi_npr_node(struct lpfc_hba * phba,
1514 /* send PLOGI immediately, move to PLOGI issue state */ 1486 /* send PLOGI immediately, move to PLOGI issue state */
1515 if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) { 1487 if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) {
1516 ndlp->nlp_prev_state = NLP_STE_NPR_NODE; 1488 ndlp->nlp_prev_state = NLP_STE_NPR_NODE;
1517 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; 1489 lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE);
1518 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
1519 lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); 1490 lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0);
1520 } 1491 }
1521 1492
@@ -1543,16 +1514,13 @@ lpfc_rcv_prli_npr_node(struct lpfc_hba * phba,
1543 ndlp->nlp_flag &= ~NLP_NPR_ADISC; 1514 ndlp->nlp_flag &= ~NLP_NPR_ADISC;
1544 spin_unlock_irq(phba->host->host_lock); 1515 spin_unlock_irq(phba->host->host_lock);
1545 ndlp->nlp_prev_state = NLP_STE_NPR_NODE; 1516 ndlp->nlp_prev_state = NLP_STE_NPR_NODE;
1546 ndlp->nlp_state = NLP_STE_ADISC_ISSUE; 1517 lpfc_nlp_set_state(phba, ndlp, NLP_STE_ADISC_ISSUE);
1547 lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST);
1548 lpfc_issue_els_adisc(phba, ndlp, 0); 1518 lpfc_issue_els_adisc(phba, ndlp, 0);
1549 } else { 1519 } else {
1550 ndlp->nlp_prev_state = NLP_STE_NPR_NODE; 1520 ndlp->nlp_prev_state = NLP_STE_NPR_NODE;
1551 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; 1521 lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE);
1552 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
1553 lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); 1522 lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0);
1554 } 1523 }
1555
1556 } 1524 }
1557 return ndlp->nlp_state; 1525 return ndlp->nlp_state;
1558} 1526}
@@ -1590,13 +1558,11 @@ lpfc_rcv_padisc_npr_node(struct lpfc_hba * phba,
1590 !(ndlp->nlp_flag & NLP_NPR_2B_DISC)){ 1558 !(ndlp->nlp_flag & NLP_NPR_2B_DISC)){
1591 if (ndlp->nlp_flag & NLP_NPR_ADISC) { 1559 if (ndlp->nlp_flag & NLP_NPR_ADISC) {
1592 ndlp->nlp_prev_state = NLP_STE_NPR_NODE; 1560 ndlp->nlp_prev_state = NLP_STE_NPR_NODE;
1593 ndlp->nlp_state = NLP_STE_ADISC_ISSUE; 1561 lpfc_nlp_set_state(phba, ndlp, NLP_STE_ADISC_ISSUE);
1594 lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST);
1595 lpfc_issue_els_adisc(phba, ndlp, 0); 1562 lpfc_issue_els_adisc(phba, ndlp, 0);
1596 } else { 1563 } else {
1597 ndlp->nlp_prev_state = NLP_STE_NPR_NODE; 1564 ndlp->nlp_prev_state = NLP_STE_NPR_NODE;
1598 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; 1565 lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE);
1599 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
1600 lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); 1566 lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0);
1601 } 1567 }
1602 } 1568 }
@@ -1645,7 +1611,7 @@ lpfc_cmpl_plogi_npr_node(struct lpfc_hba * phba,
1645 1611
1646 irsp = &rspiocb->iocb; 1612 irsp = &rspiocb->iocb;
1647 if (irsp->ulpStatus) { 1613 if (irsp->ulpStatus) {
1648 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1614 lpfc_drop_node(phba, ndlp);
1649 return NLP_STE_FREED_NODE; 1615 return NLP_STE_FREED_NODE;
1650 } 1616 }
1651 return ndlp->nlp_state; 1617 return ndlp->nlp_state;
@@ -1663,7 +1629,7 @@ lpfc_cmpl_prli_npr_node(struct lpfc_hba * phba,
1663 1629
1664 irsp = &rspiocb->iocb; 1630 irsp = &rspiocb->iocb;
1665 if (irsp->ulpStatus && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) { 1631 if (irsp->ulpStatus && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) {
1666 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1632 lpfc_drop_node(phba, ndlp);
1667 return NLP_STE_FREED_NODE; 1633 return NLP_STE_FREED_NODE;
1668 } 1634 }
1669 return ndlp->nlp_state; 1635 return ndlp->nlp_state;
@@ -1691,7 +1657,7 @@ lpfc_cmpl_adisc_npr_node(struct lpfc_hba * phba,
1691 1657
1692 irsp = &rspiocb->iocb; 1658 irsp = &rspiocb->iocb;
1693 if (irsp->ulpStatus && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) { 1659 if (irsp->ulpStatus && (ndlp->nlp_flag & NLP_NODEV_REMOVE)) {
1694 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1660 lpfc_drop_node(phba, ndlp);
1695 return NLP_STE_FREED_NODE; 1661 return NLP_STE_FREED_NODE;
1696 } 1662 }
1697 return ndlp->nlp_state; 1663 return ndlp->nlp_state;
@@ -1712,7 +1678,7 @@ lpfc_cmpl_reglogin_npr_node(struct lpfc_hba * phba,
1712 ndlp->nlp_rpi = mb->un.varWords[0]; 1678 ndlp->nlp_rpi = mb->un.varWords[0];
1713 else { 1679 else {
1714 if (ndlp->nlp_flag & NLP_NODEV_REMOVE) { 1680 if (ndlp->nlp_flag & NLP_NODEV_REMOVE) {
1715 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1681 lpfc_drop_node(phba, ndlp);
1716 return NLP_STE_FREED_NODE; 1682 return NLP_STE_FREED_NODE;
1717 } 1683 }
1718 } 1684 }
@@ -1728,7 +1694,7 @@ lpfc_device_rm_npr_node(struct lpfc_hba * phba,
1728 ndlp->nlp_flag |= NLP_NODEV_REMOVE; 1694 ndlp->nlp_flag |= NLP_NODEV_REMOVE;
1729 return ndlp->nlp_state; 1695 return ndlp->nlp_state;
1730 } 1696 }
1731 lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); 1697 lpfc_drop_node(phba, ndlp);
1732 return NLP_STE_FREED_NODE; 1698 return NLP_STE_FREED_NODE;
1733} 1699}
1734 1700