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:28 -0500
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-02-28 20:01:51 -0500
commit5024ab179c13d763f95c8391f45f22309609f479 (patch)
tree7c22b094371c8831f8724d7a2e8580a3ed394c1f /drivers/scsi/lpfc/lpfc_nportdisc.c
parent41415862a23f422b80eccc92cf885935139e2415 (diff)
[SCSI] lpfc 8.1.2: Added support for FAN
Added support for FAN 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.c61
1 files changed, 41 insertions, 20 deletions
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
index a580e1e50672..4bf232a9adc9 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -262,6 +262,7 @@ lpfc_els_abort(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp,
262 /* If we are delaying issuing an ELS command, cancel it */ 262 /* If we are delaying issuing an ELS command, cancel it */
263 if (ndlp->nlp_flag & NLP_DELAY_TMO) { 263 if (ndlp->nlp_flag & NLP_DELAY_TMO) {
264 ndlp->nlp_flag &= ~NLP_DELAY_TMO; 264 ndlp->nlp_flag &= ~NLP_DELAY_TMO;
265 ndlp->nlp_last_elscmd = 0;
265 del_timer_sync(&ndlp->nlp_delayfunc); 266 del_timer_sync(&ndlp->nlp_delayfunc);
266 if (!list_empty(&ndlp->els_retry_evt.evt_listp)) 267 if (!list_empty(&ndlp->els_retry_evt.evt_listp))
267 list_del_init(&ndlp->els_retry_evt.evt_listp); 268 list_del_init(&ndlp->els_retry_evt.evt_listp);
@@ -398,16 +399,8 @@ lpfc_rcv_plogi(struct lpfc_hba * phba,
398 */ 399 */
399 mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; 400 mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login;
400 mbox->context2 = ndlp; 401 mbox->context2 = ndlp;
401 ndlp->nlp_flag |= NLP_ACC_REGLOGIN; 402 ndlp->nlp_flag |= (NLP_ACC_REGLOGIN | NLP_RCV_PLOGI);
402 403
403 /* If there is an outstanding PLOGI issued, abort it before
404 * sending ACC rsp to PLOGI recieved.
405 */
406 if (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE) {
407 /* software abort outstanding PLOGI */
408 lpfc_els_abort(phba, ndlp, 1);
409 }
410 ndlp->nlp_flag |= NLP_RCV_PLOGI;
411 lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox, 0); 404 lpfc_els_rsp_acc(phba, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox, 0);
412 return 1; 405 return 1;
413 406
@@ -465,13 +458,14 @@ lpfc_rcv_padisc(struct lpfc_hba * phba,
465 stat.un.b.vendorUnique = 0; 458 stat.un.b.vendorUnique = 0;
466 lpfc_els_rsp_reject(phba, stat.un.lsRjtError, cmdiocb, ndlp); 459 lpfc_els_rsp_reject(phba, stat.un.lsRjtError, cmdiocb, ndlp);
467 460
468 ndlp->nlp_last_elscmd = (unsigned long)ELS_CMD_PLOGI;
469 /* 1 sec timeout */ 461 /* 1 sec timeout */
470 mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ); 462 mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ);
471 463
472 spin_lock_irq(phba->host->host_lock); 464 spin_lock_irq(phba->host->host_lock);
473 ndlp->nlp_flag |= NLP_DELAY_TMO; 465 ndlp->nlp_flag |= NLP_DELAY_TMO;
474 spin_unlock_irq(phba->host->host_lock); 466 spin_unlock_irq(phba->host->host_lock);
467 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
468 ndlp->nlp_prev_state = ndlp->nlp_state;
475 ndlp->nlp_state = NLP_STE_NPR_NODE; 469 ndlp->nlp_state = NLP_STE_NPR_NODE;
476 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 470 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
477 return 0; 471 return 0;
@@ -492,15 +486,17 @@ lpfc_rcv_logo(struct lpfc_hba * phba,
492 if (!(ndlp->nlp_type & NLP_FABRIC) || 486 if (!(ndlp->nlp_type & NLP_FABRIC) ||
493 (ndlp->nlp_state == NLP_STE_ADISC_ISSUE)) { 487 (ndlp->nlp_state == NLP_STE_ADISC_ISSUE)) {
494 /* Only try to re-login if this is NOT a Fabric Node */ 488 /* Only try to re-login if this is NOT a Fabric Node */
495 ndlp->nlp_last_elscmd = (unsigned long)ELS_CMD_PLOGI;
496 mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1); 489 mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1);
497 spin_lock_irq(phba->host->host_lock); 490 spin_lock_irq(phba->host->host_lock);
498 ndlp->nlp_flag |= NLP_DELAY_TMO; 491 ndlp->nlp_flag |= NLP_DELAY_TMO;
499 spin_unlock_irq(phba->host->host_lock); 492 spin_unlock_irq(phba->host->host_lock);
500 493
494 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
495 ndlp->nlp_prev_state = ndlp->nlp_state;
501 ndlp->nlp_state = NLP_STE_NPR_NODE; 496 ndlp->nlp_state = NLP_STE_NPR_NODE;
502 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 497 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
503 } else { 498 } else {
499 ndlp->nlp_prev_state = ndlp->nlp_state;
504 ndlp->nlp_state = NLP_STE_UNUSED_NODE; 500 ndlp->nlp_state = NLP_STE_UNUSED_NODE;
505 lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); 501 lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST);
506 } 502 }
@@ -595,6 +591,7 @@ lpfc_rcv_plogi_unused_node(struct lpfc_hba * phba,
595 cmdiocb = (struct lpfc_iocbq *) arg; 591 cmdiocb = (struct lpfc_iocbq *) arg;
596 592
597 if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) { 593 if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) {
594 ndlp->nlp_prev_state = NLP_STE_UNUSED_NODE;
598 ndlp->nlp_state = NLP_STE_UNUSED_NODE; 595 ndlp->nlp_state = NLP_STE_UNUSED_NODE;
599 lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); 596 lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST);
600 return ndlp->nlp_state; 597 return ndlp->nlp_state;
@@ -708,10 +705,6 @@ lpfc_rcv_els_plogi_issue(struct lpfc_hba * phba,
708 705
709 /* software abort outstanding PLOGI */ 706 /* software abort outstanding PLOGI */
710 lpfc_els_abort(phba, ndlp, 1); 707 lpfc_els_abort(phba, ndlp, 1);
711 mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1);
712 spin_lock_irq(phba->host->host_lock);
713 ndlp->nlp_flag |= NLP_DELAY_TMO;
714 spin_unlock_irq(phba->host->host_lock);
715 708
716 if (evt == NLP_EVT_RCV_LOGO) { 709 if (evt == NLP_EVT_RCV_LOGO) {
717 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0); 710 lpfc_els_rsp_acc(phba, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
@@ -721,7 +714,12 @@ lpfc_rcv_els_plogi_issue(struct lpfc_hba * phba,
721 } 714 }
722 715
723 /* Put ndlp in npr list set plogi timer for 1 sec */ 716 /* Put ndlp in npr list set plogi timer for 1 sec */
724 ndlp->nlp_last_elscmd = (unsigned long)ELS_CMD_PLOGI; 717 mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1);
718 spin_lock_irq(phba->host->host_lock);
719 ndlp->nlp_flag |= NLP_DELAY_TMO;
720 spin_unlock_irq(phba->host->host_lock);
721 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
722 ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE;
725 ndlp->nlp_state = NLP_STE_NPR_NODE; 723 ndlp->nlp_state = NLP_STE_NPR_NODE;
726 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 724 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
727 725
@@ -744,6 +742,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_hba * phba,
744 rspiocb = cmdiocb->context_un.rsp_iocb; 742 rspiocb = cmdiocb->context_un.rsp_iocb;
745 743
746 if (ndlp->nlp_flag & NLP_ACC_REGLOGIN) { 744 if (ndlp->nlp_flag & NLP_ACC_REGLOGIN) {
745 /* Recovery from PLOGI collision logic */
747 return ndlp->nlp_state; 746 return ndlp->nlp_state;
748 } 747 }
749 748
@@ -859,6 +858,7 @@ lpfc_device_recov_plogi_issue(struct lpfc_hba * phba,
859 /* software abort outstanding PLOGI */ 858 /* software abort outstanding PLOGI */
860 lpfc_els_abort(phba, ndlp, 1); 859 lpfc_els_abort(phba, ndlp, 1);
861 860
861 ndlp->nlp_prev_state = NLP_STE_PLOGI_ISSUE;
862 ndlp->nlp_state = NLP_STE_NPR_NODE; 862 ndlp->nlp_state = NLP_STE_NPR_NODE;
863 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 863 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
864 spin_lock_irq(phba->host->host_lock); 864 spin_lock_irq(phba->host->host_lock);
@@ -883,6 +883,7 @@ lpfc_rcv_plogi_adisc_issue(struct lpfc_hba * phba,
883 if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) { 883 if (lpfc_rcv_plogi(phba, ndlp, cmdiocb)) {
884 return ndlp->nlp_state; 884 return ndlp->nlp_state;
885 } 885 }
886 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE;
886 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; 887 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE;
887 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); 888 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
888 lpfc_issue_els_plogi(phba, ndlp, 0); 889 lpfc_issue_els_plogi(phba, ndlp, 0);
@@ -963,25 +964,29 @@ lpfc_cmpl_adisc_adisc_issue(struct lpfc_hba * phba,
963 964
964 if ((irsp->ulpStatus) || 965 if ((irsp->ulpStatus) ||
965 (!lpfc_check_adisc(phba, ndlp, &ap->nodeName, &ap->portName))) { 966 (!lpfc_check_adisc(phba, ndlp, &ap->nodeName, &ap->portName))) {
966 ndlp->nlp_last_elscmd = (unsigned long)ELS_CMD_PLOGI;
967 /* 1 sec timeout */ 967 /* 1 sec timeout */
968 mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ); 968 mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ);
969 spin_lock_irq(phba->host->host_lock); 969 spin_lock_irq(phba->host->host_lock);
970 ndlp->nlp_flag |= NLP_DELAY_TMO; 970 ndlp->nlp_flag |= NLP_DELAY_TMO;
971 spin_unlock_irq(phba->host->host_lock); 971 spin_unlock_irq(phba->host->host_lock);
972 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
972 973
973 memset(&ndlp->nlp_nodename, 0, sizeof (struct lpfc_name)); 974 memset(&ndlp->nlp_nodename, 0, sizeof (struct lpfc_name));
974 memset(&ndlp->nlp_portname, 0, sizeof (struct lpfc_name)); 975 memset(&ndlp->nlp_portname, 0, sizeof (struct lpfc_name));
975 976
977 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE;
976 ndlp->nlp_state = NLP_STE_NPR_NODE; 978 ndlp->nlp_state = NLP_STE_NPR_NODE;
977 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 979 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
978 lpfc_unreg_rpi(phba, ndlp); 980 lpfc_unreg_rpi(phba, ndlp);
979 return ndlp->nlp_state; 981 return ndlp->nlp_state;
980 } 982 }
983
981 if (ndlp->nlp_type & NLP_FCP_TARGET) { 984 if (ndlp->nlp_type & NLP_FCP_TARGET) {
985 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE;
982 ndlp->nlp_state = NLP_STE_MAPPED_NODE; 986 ndlp->nlp_state = NLP_STE_MAPPED_NODE;
983 lpfc_nlp_list(phba, ndlp, NLP_MAPPED_LIST); 987 lpfc_nlp_list(phba, ndlp, NLP_MAPPED_LIST);
984 } else { 988 } else {
989 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE;
985 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; 990 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE;
986 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); 991 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST);
987 } 992 }
@@ -1008,6 +1013,7 @@ lpfc_device_recov_adisc_issue(struct lpfc_hba * phba,
1008 /* software abort outstanding ADISC */ 1013 /* software abort outstanding ADISC */
1009 lpfc_els_abort(phba, ndlp, 1); 1014 lpfc_els_abort(phba, ndlp, 1);
1010 1015
1016 ndlp->nlp_prev_state = NLP_STE_ADISC_ISSUE;
1011 ndlp->nlp_state = NLP_STE_NPR_NODE; 1017 ndlp->nlp_state = NLP_STE_NPR_NODE;
1012 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1018 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1013 spin_lock_irq(phba->host->host_lock); 1019 spin_lock_irq(phba->host->host_lock);
@@ -1103,14 +1109,15 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_hba * phba,
1103 phba->brd_no, 1109 phba->brd_no,
1104 did, mb->mbxStatus, phba->hba_state); 1110 did, mb->mbxStatus, phba->hba_state);
1105 1111
1112 /* Put ndlp in npr list set plogi timer for 1 sec */
1106 mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1); 1113 mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1);
1107 spin_lock_irq(phba->host->host_lock); 1114 spin_lock_irq(phba->host->host_lock);
1108 ndlp->nlp_flag |= NLP_DELAY_TMO; 1115 ndlp->nlp_flag |= NLP_DELAY_TMO;
1109 spin_unlock_irq(phba->host->host_lock); 1116 spin_unlock_irq(phba->host->host_lock);
1117 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
1110 1118
1111 lpfc_issue_els_logo(phba, ndlp, 0); 1119 lpfc_issue_els_logo(phba, ndlp, 0);
1112 /* Put ndlp in npr list set plogi timer for 1 sec */ 1120 ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE;
1113 ndlp->nlp_last_elscmd = (unsigned long)ELS_CMD_PLOGI;
1114 ndlp->nlp_state = NLP_STE_NPR_NODE; 1121 ndlp->nlp_state = NLP_STE_NPR_NODE;
1115 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1122 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1116 return ndlp->nlp_state; 1123 return ndlp->nlp_state;
@@ -1120,10 +1127,12 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_hba * phba,
1120 1127
1121 /* Only if we are not a fabric nport do we issue PRLI */ 1128 /* Only if we are not a fabric nport do we issue PRLI */
1122 if (!(ndlp->nlp_type & NLP_FABRIC)) { 1129 if (!(ndlp->nlp_type & NLP_FABRIC)) {
1130 ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE;
1123 ndlp->nlp_state = NLP_STE_PRLI_ISSUE; 1131 ndlp->nlp_state = NLP_STE_PRLI_ISSUE;
1124 lpfc_nlp_list(phba, ndlp, NLP_PRLI_LIST); 1132 lpfc_nlp_list(phba, ndlp, NLP_PRLI_LIST);
1125 lpfc_issue_els_prli(phba, ndlp, 0); 1133 lpfc_issue_els_prli(phba, ndlp, 0);
1126 } else { 1134 } else {
1135 ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE;
1127 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; 1136 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE;
1128 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); 1137 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST);
1129 } 1138 }
@@ -1144,6 +1153,7 @@ lpfc_device_recov_reglogin_issue(struct lpfc_hba * phba,
1144 struct lpfc_nodelist * ndlp, void *arg, 1153 struct lpfc_nodelist * ndlp, void *arg,
1145 uint32_t evt) 1154 uint32_t evt)
1146{ 1155{
1156 ndlp->nlp_prev_state = NLP_STE_REG_LOGIN_ISSUE;
1147 ndlp->nlp_state = NLP_STE_NPR_NODE; 1157 ndlp->nlp_state = NLP_STE_NPR_NODE;
1148 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1158 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1149 spin_lock_irq(phba->host->host_lock); 1159 spin_lock_irq(phba->host->host_lock);
@@ -1233,6 +1243,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_hba * phba,
1233 1243
1234 irsp = &rspiocb->iocb; 1244 irsp = &rspiocb->iocb;
1235 if (irsp->ulpStatus) { 1245 if (irsp->ulpStatus) {
1246 ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE;
1236 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; 1247 ndlp->nlp_state = NLP_STE_UNMAPPED_NODE;
1237 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); 1248 lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST);
1238 return ndlp->nlp_state; 1249 return ndlp->nlp_state;
@@ -1251,6 +1262,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_hba * phba,
1251 ndlp->nlp_fcp_info |= NLP_FCP_2_DEVICE; 1262 ndlp->nlp_fcp_info |= NLP_FCP_2_DEVICE;
1252 } 1263 }
1253 1264
1265 ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE;
1254 ndlp->nlp_state = NLP_STE_MAPPED_NODE; 1266 ndlp->nlp_state = NLP_STE_MAPPED_NODE;
1255 lpfc_nlp_list(phba, ndlp, NLP_MAPPED_LIST); 1267 lpfc_nlp_list(phba, ndlp, NLP_MAPPED_LIST);
1256 return ndlp->nlp_state; 1268 return ndlp->nlp_state;
@@ -1308,6 +1320,7 @@ lpfc_device_recov_prli_issue(struct lpfc_hba * phba,
1308 /* software abort outstanding PRLI */ 1320 /* software abort outstanding PRLI */
1309 lpfc_els_abort(phba, ndlp, 1); 1321 lpfc_els_abort(phba, ndlp, 1);
1310 1322
1323 ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE;
1311 ndlp->nlp_state = NLP_STE_NPR_NODE; 1324 ndlp->nlp_state = NLP_STE_NPR_NODE;
1312 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1325 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1313 spin_lock_irq(phba->host->host_lock); 1326 spin_lock_irq(phba->host->host_lock);
@@ -1381,6 +1394,7 @@ static uint32_t
1381lpfc_device_recov_unmap_node(struct lpfc_hba * phba, 1394lpfc_device_recov_unmap_node(struct lpfc_hba * phba,
1382 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt) 1395 struct lpfc_nodelist * ndlp, void *arg, uint32_t evt)
1383{ 1396{
1397 ndlp->nlp_prev_state = NLP_STE_UNMAPPED_NODE;
1384 ndlp->nlp_state = NLP_STE_NPR_NODE; 1398 ndlp->nlp_state = NLP_STE_NPR_NODE;
1385 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1399 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1386 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC; 1400 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
@@ -1462,6 +1476,7 @@ lpfc_device_recov_mapped_node(struct lpfc_hba * phba,
1462 struct lpfc_nodelist * ndlp, void *arg, 1476 struct lpfc_nodelist * ndlp, void *arg,
1463 uint32_t evt) 1477 uint32_t evt)
1464{ 1478{
1479 ndlp->nlp_prev_state = NLP_STE_MAPPED_NODE;
1465 ndlp->nlp_state = NLP_STE_NPR_NODE; 1480 ndlp->nlp_state = NLP_STE_NPR_NODE;
1466 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); 1481 lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST);
1467 spin_lock_irq(phba->host->host_lock); 1482 spin_lock_irq(phba->host->host_lock);
@@ -1494,6 +1509,7 @@ lpfc_rcv_plogi_npr_node(struct lpfc_hba * phba,
1494 1509
1495 /* send PLOGI immediately, move to PLOGI issue state */ 1510 /* send PLOGI immediately, move to PLOGI issue state */
1496 if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) { 1511 if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) {
1512 ndlp->nlp_prev_state = NLP_STE_NPR_NODE;
1497 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; 1513 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE;
1498 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); 1514 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
1499 lpfc_issue_els_plogi(phba, ndlp, 0); 1515 lpfc_issue_els_plogi(phba, ndlp, 0);
@@ -1521,10 +1537,12 @@ lpfc_rcv_prli_npr_node(struct lpfc_hba * phba,
1521 spin_lock_irq(phba->host->host_lock); 1537 spin_lock_irq(phba->host->host_lock);
1522 ndlp->nlp_flag &= ~NLP_NPR_ADISC; 1538 ndlp->nlp_flag &= ~NLP_NPR_ADISC;
1523 spin_unlock_irq(phba->host->host_lock); 1539 spin_unlock_irq(phba->host->host_lock);
1540 ndlp->nlp_prev_state = NLP_STE_NPR_NODE;
1524 ndlp->nlp_state = NLP_STE_ADISC_ISSUE; 1541 ndlp->nlp_state = NLP_STE_ADISC_ISSUE;
1525 lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST); 1542 lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST);
1526 lpfc_issue_els_adisc(phba, ndlp, 0); 1543 lpfc_issue_els_adisc(phba, ndlp, 0);
1527 } else { 1544 } else {
1545 ndlp->nlp_prev_state = NLP_STE_NPR_NODE;
1528 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; 1546 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE;
1529 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); 1547 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
1530 lpfc_issue_els_plogi(phba, ndlp, 0); 1548 lpfc_issue_els_plogi(phba, ndlp, 0);
@@ -1559,10 +1577,12 @@ lpfc_rcv_padisc_npr_node(struct lpfc_hba * phba,
1559 1577
1560 if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) { 1578 if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) {
1561 if (ndlp->nlp_flag & NLP_NPR_ADISC) { 1579 if (ndlp->nlp_flag & NLP_NPR_ADISC) {
1580 ndlp->nlp_prev_state = NLP_STE_NPR_NODE;
1562 ndlp->nlp_state = NLP_STE_ADISC_ISSUE; 1581 ndlp->nlp_state = NLP_STE_ADISC_ISSUE;
1563 lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST); 1582 lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST);
1564 lpfc_issue_els_adisc(phba, ndlp, 0); 1583 lpfc_issue_els_adisc(phba, ndlp, 0);
1565 } else { 1584 } else {
1585 ndlp->nlp_prev_state = NLP_STE_NPR_NODE;
1566 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; 1586 ndlp->nlp_state = NLP_STE_PLOGI_ISSUE;
1567 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); 1587 lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST);
1568 lpfc_issue_els_plogi(phba, ndlp, 0); 1588 lpfc_issue_els_plogi(phba, ndlp, 0);
@@ -1592,6 +1612,7 @@ lpfc_rcv_prlo_npr_node(struct lpfc_hba * phba,
1592 ndlp->nlp_flag |= NLP_DELAY_TMO; 1612 ndlp->nlp_flag |= NLP_DELAY_TMO;
1593 ndlp->nlp_flag &= ~NLP_NPR_ADISC; 1613 ndlp->nlp_flag &= ~NLP_NPR_ADISC;
1594 spin_unlock_irq(phba->host->host_lock); 1614 spin_unlock_irq(phba->host->host_lock);
1615 ndlp->nlp_last_elscmd = ELS_CMD_PLOGI;
1595 } else { 1616 } else {
1596 spin_lock_irq(phba->host->host_lock); 1617 spin_lock_irq(phba->host->host_lock);
1597 ndlp->nlp_flag &= ~NLP_NPR_ADISC; 1618 ndlp->nlp_flag &= ~NLP_NPR_ADISC;
@@ -1681,6 +1702,7 @@ lpfc_device_recov_npr_node(struct lpfc_hba * phba,
1681 if (!list_empty(&ndlp->els_retry_evt.evt_listp)) 1702 if (!list_empty(&ndlp->els_retry_evt.evt_listp))
1682 list_del_init(&ndlp->els_retry_evt.evt_listp); 1703 list_del_init(&ndlp->els_retry_evt.evt_listp);
1683 spin_unlock_irq(phba->host->host_lock); 1704 spin_unlock_irq(phba->host->host_lock);
1705 ndlp->nlp_last_elscmd = 0;
1684 del_timer_sync(&ndlp->nlp_delayfunc); 1706 del_timer_sync(&ndlp->nlp_delayfunc);
1685 return ndlp->nlp_state; 1707 return ndlp->nlp_state;
1686 } 1708 }
@@ -1905,6 +1927,5 @@ lpfc_disc_state_machine(struct lpfc_hba * phba,
1905 } 1927 }
1906 if (rc == NLP_STE_FREED_NODE) 1928 if (rc == NLP_STE_FREED_NODE)
1907 return NLP_STE_FREED_NODE; 1929 return NLP_STE_FREED_NODE;
1908 ndlp->nlp_state = rc;
1909 return rc; 1930 return rc;
1910} 1931}