diff options
author | James Smart <James.Smart@Emulex.Com> | 2007-04-25 09:52:27 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-05-06 10:33:14 -0400 |
commit | de0c5b32b50ef2673f4cd434b9c2732237d715dd (patch) | |
tree | b531709da0a9e6a1cc8d18992a7681db4d163f23 /drivers/scsi/lpfc | |
parent | 2534ba756ec407d343af45168273d3a64825a7ba (diff) |
[SCSI] lpfc 8.1.12 : Reorganize lpfc_nlp_list() and callers to prepare for nodelist simplification
Reorganize lpfc_nlp_list() and callers to prepare for nodelist simplification.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_crtn.h | 4 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_disc.h | 2 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_els.c | 116 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hbadisc.c | 297 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 2 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_nportdisc.c | 128 |
6 files changed, 266 insertions, 283 deletions
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index 80dcfaa37867..b80ddb80030c 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -43,7 +43,9 @@ void lpfc_mbx_cmpl_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); | |||
43 | void lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); | 43 | void lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); |
44 | void lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); | 44 | void lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); |
45 | void lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); | 45 | void lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *); |
46 | int lpfc_nlp_list(struct lpfc_hba *, struct lpfc_nodelist *, int); | 46 | void lpfc_dequeue_node(struct lpfc_hba *, struct lpfc_nodelist *); |
47 | void lpfc_nlp_set_state(struct lpfc_hba *, struct lpfc_nodelist *, int); | ||
48 | void lpfc_drop_node(struct lpfc_hba *, struct lpfc_nodelist *); | ||
47 | void lpfc_set_disctmo(struct lpfc_hba *); | 49 | void lpfc_set_disctmo(struct lpfc_hba *); |
48 | int lpfc_can_disctmo(struct lpfc_hba *); | 50 | int lpfc_can_disctmo(struct lpfc_hba *); |
49 | int lpfc_unreg_rpi(struct lpfc_hba *, struct lpfc_nodelist *); | 51 | int lpfc_unreg_rpi(struct lpfc_hba *, struct lpfc_nodelist *); |
diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h index cfafff09dcfe..30b2ba0b06f7 100644 --- a/drivers/scsi/lpfc/lpfc_disc.h +++ b/drivers/scsi/lpfc/lpfc_disc.h | |||
@@ -83,7 +83,6 @@ struct lpfc_nodelist { | |||
83 | }; | 83 | }; |
84 | 84 | ||
85 | /* Defines for nlp_flag (uint32) */ | 85 | /* Defines for nlp_flag (uint32) */ |
86 | #define NLP_NO_LIST 0x0 /* Indicates immediately free node */ | ||
87 | #define NLP_UNUSED_LIST 0x1 /* Flg to indicate node will be freed */ | 86 | #define NLP_UNUSED_LIST 0x1 /* Flg to indicate node will be freed */ |
88 | #define NLP_PLOGI_LIST 0x2 /* Flg to indicate sent PLOGI */ | 87 | #define NLP_PLOGI_LIST 0x2 /* Flg to indicate sent PLOGI */ |
89 | #define NLP_ADISC_LIST 0x3 /* Flg to indicate sent ADISC */ | 88 | #define NLP_ADISC_LIST 0x3 /* Flg to indicate sent ADISC */ |
@@ -92,7 +91,6 @@ struct lpfc_nodelist { | |||
92 | #define NLP_UNMAPPED_LIST 0x6 /* Node is now unmapped */ | 91 | #define NLP_UNMAPPED_LIST 0x6 /* Node is now unmapped */ |
93 | #define NLP_MAPPED_LIST 0x7 /* Node is now mapped */ | 92 | #define NLP_MAPPED_LIST 0x7 /* Node is now mapped */ |
94 | #define NLP_NPR_LIST 0x8 /* Node is in NPort Recovery state */ | 93 | #define NLP_NPR_LIST 0x8 /* Node is in NPort Recovery state */ |
95 | #define NLP_JUST_DQ 0x9 /* just deque ndlp in lpfc_nlp_list */ | ||
96 | #define NLP_LIST_MASK 0xf /* mask to see what list node is on */ | 94 | #define NLP_LIST_MASK 0xf /* mask to see what list node is on */ |
97 | #define NLP_PLOGI_SND 0x20 /* sent PLOGI request for this entry */ | 95 | #define NLP_PLOGI_SND 0x20 /* sent PLOGI request for this entry */ |
98 | #define NLP_PRLI_SND 0x40 /* sent PRLI request for this entry */ | 96 | #define NLP_PRLI_SND 0x40 /* sent PRLI request for this entry */ |
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index e3bebf9ee832..14266dfb35db 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -387,8 +387,7 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, | |||
387 | sizeof(struct lpfc_name)); | 387 | sizeof(struct lpfc_name)); |
388 | memcpy(&ndlp->nlp_nodename, &sp->nodeName, | 388 | memcpy(&ndlp->nlp_nodename, &sp->nodeName, |
389 | sizeof(struct lpfc_name)); | 389 | sizeof(struct lpfc_name)); |
390 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 390 | 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; | 391 | ndlp->nlp_flag |= NLP_NPR_2B_DISC; |
393 | } else { | 392 | } else { |
394 | /* This side will wait for the PLOGI */ | 393 | /* This side will wait for the PLOGI */ |
@@ -605,7 +604,7 @@ lpfc_initial_flogi(struct lpfc_hba * phba) | |||
605 | return 0; | 604 | return 0; |
606 | lpfc_nlp_init(phba, ndlp, Fabric_DID); | 605 | lpfc_nlp_init(phba, ndlp, Fabric_DID); |
607 | } else { | 606 | } else { |
608 | lpfc_nlp_list(phba, ndlp, NLP_JUST_DQ); | 607 | lpfc_dequeue_node(phba, ndlp); |
609 | } | 608 | } |
610 | if (lpfc_issue_els_flogi(phba, ndlp, 0)) { | 609 | if (lpfc_issue_els_flogi(phba, ndlp, 0)) { |
611 | mempool_free( ndlp, phba->nlp_mem_pool); | 610 | mempool_free( ndlp, phba->nlp_mem_pool); |
@@ -679,18 +678,15 @@ lpfc_plogi_confirm_nport(struct lpfc_hba * phba, struct lpfc_dmabuf *prsp, | |||
679 | lpfc_unreg_rpi(phba, new_ndlp); | 678 | lpfc_unreg_rpi(phba, new_ndlp); |
680 | new_ndlp->nlp_DID = ndlp->nlp_DID; | 679 | new_ndlp->nlp_DID = ndlp->nlp_DID; |
681 | new_ndlp->nlp_prev_state = ndlp->nlp_prev_state; | 680 | new_ndlp->nlp_prev_state = ndlp->nlp_prev_state; |
682 | new_ndlp->nlp_state = ndlp->nlp_state; | 681 | lpfc_nlp_set_state(phba, new_ndlp, ndlp->nlp_state); |
683 | lpfc_nlp_list(phba, new_ndlp, ndlp->nlp_flag & NLP_LIST_MASK); | ||
684 | 682 | ||
685 | /* Move this back to NPR list */ | 683 | /* Move this back to NPR list */ |
686 | if (memcmp(&ndlp->nlp_portname, name, sizeof(struct lpfc_name)) == 0) { | 684 | if (memcmp(&ndlp->nlp_portname, name, sizeof(struct lpfc_name)) == 0) |
687 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 685 | lpfc_drop_node(phba, ndlp); |
688 | } | ||
689 | else { | 686 | else { |
690 | lpfc_unreg_rpi(phba, ndlp); | 687 | lpfc_unreg_rpi(phba, ndlp); |
691 | ndlp->nlp_DID = 0; /* Two ndlps cannot have the same did */ | 688 | ndlp->nlp_DID = 0; /* Two ndlps cannot have the same did */ |
692 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 689 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
693 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
694 | } | 690 | } |
695 | return new_ndlp; | 691 | return new_ndlp; |
696 | } | 692 | } |
@@ -704,7 +700,6 @@ lpfc_cmpl_els_plogi(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
704 | struct lpfc_dmabuf *prsp; | 700 | struct lpfc_dmabuf *prsp; |
705 | int disc, rc, did, type; | 701 | int disc, rc, did, type; |
706 | 702 | ||
707 | |||
708 | /* we pass cmdiocb to state machine which needs rspiocb as well */ | 703 | /* we pass cmdiocb to state machine which needs rspiocb as well */ |
709 | cmdiocb->context_un.rsp_iocb = rspiocb; | 704 | cmdiocb->context_un.rsp_iocb = rspiocb; |
710 | 705 | ||
@@ -1538,29 +1533,25 @@ lpfc_els_retry_delay_handler(struct lpfc_nodelist *ndlp) | |||
1538 | case ELS_CMD_PLOGI: | 1533 | case ELS_CMD_PLOGI: |
1539 | if(!lpfc_issue_els_plogi(phba, ndlp->nlp_DID, retry)) { | 1534 | if(!lpfc_issue_els_plogi(phba, ndlp->nlp_DID, retry)) { |
1540 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1535 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1541 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 1536 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE); |
1542 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | ||
1543 | } | 1537 | } |
1544 | break; | 1538 | break; |
1545 | case ELS_CMD_ADISC: | 1539 | case ELS_CMD_ADISC: |
1546 | if (!lpfc_issue_els_adisc(phba, ndlp, retry)) { | 1540 | if (!lpfc_issue_els_adisc(phba, ndlp, retry)) { |
1547 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1541 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1548 | ndlp->nlp_state = NLP_STE_ADISC_ISSUE; | 1542 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_ADISC_ISSUE); |
1549 | lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST); | ||
1550 | } | 1543 | } |
1551 | break; | 1544 | break; |
1552 | case ELS_CMD_PRLI: | 1545 | case ELS_CMD_PRLI: |
1553 | if (!lpfc_issue_els_prli(phba, ndlp, retry)) { | 1546 | if (!lpfc_issue_els_prli(phba, ndlp, retry)) { |
1554 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1547 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1555 | ndlp->nlp_state = NLP_STE_PRLI_ISSUE; | 1548 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PRLI_ISSUE); |
1556 | lpfc_nlp_list(phba, ndlp, NLP_PRLI_LIST); | ||
1557 | } | 1549 | } |
1558 | break; | 1550 | break; |
1559 | case ELS_CMD_LOGO: | 1551 | case ELS_CMD_LOGO: |
1560 | if (!lpfc_issue_els_logo(phba, ndlp, retry)) { | 1552 | if (!lpfc_issue_els_logo(phba, ndlp, retry)) { |
1561 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1553 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1562 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1554 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1563 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1564 | } | 1555 | } |
1565 | break; | 1556 | break; |
1566 | } | 1557 | } |
@@ -1730,8 +1721,7 @@ lpfc_els_retry(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1730 | ndlp->nlp_flag |= NLP_DELAY_TMO; | 1721 | ndlp->nlp_flag |= NLP_DELAY_TMO; |
1731 | 1722 | ||
1732 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1723 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1733 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1724 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1734 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1735 | ndlp->nlp_last_elscmd = cmd; | 1725 | ndlp->nlp_last_elscmd = cmd; |
1736 | 1726 | ||
1737 | return 1; | 1727 | return 1; |
@@ -1743,27 +1733,24 @@ lpfc_els_retry(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1743 | case ELS_CMD_PLOGI: | 1733 | case ELS_CMD_PLOGI: |
1744 | if (ndlp) { | 1734 | if (ndlp) { |
1745 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1735 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1746 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 1736 | lpfc_nlp_set_state(phba, ndlp, |
1747 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | 1737 | NLP_STE_PLOGI_ISSUE); |
1748 | } | 1738 | } |
1749 | lpfc_issue_els_plogi(phba, did, cmdiocb->retry); | 1739 | lpfc_issue_els_plogi(phba, did, cmdiocb->retry); |
1750 | return 1; | 1740 | return 1; |
1751 | case ELS_CMD_ADISC: | 1741 | case ELS_CMD_ADISC: |
1752 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1742 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1753 | ndlp->nlp_state = NLP_STE_ADISC_ISSUE; | 1743 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_ADISC_ISSUE); |
1754 | lpfc_nlp_list(phba, ndlp, NLP_ADISC_LIST); | ||
1755 | lpfc_issue_els_adisc(phba, ndlp, cmdiocb->retry); | 1744 | lpfc_issue_els_adisc(phba, ndlp, cmdiocb->retry); |
1756 | return 1; | 1745 | return 1; |
1757 | case ELS_CMD_PRLI: | 1746 | case ELS_CMD_PRLI: |
1758 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1747 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1759 | ndlp->nlp_state = NLP_STE_PRLI_ISSUE; | 1748 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PRLI_ISSUE); |
1760 | lpfc_nlp_list(phba, ndlp, NLP_PRLI_LIST); | ||
1761 | lpfc_issue_els_prli(phba, ndlp, cmdiocb->retry); | 1749 | lpfc_issue_els_prli(phba, ndlp, cmdiocb->retry); |
1762 | return 1; | 1750 | return 1; |
1763 | case ELS_CMD_LOGO: | 1751 | case ELS_CMD_LOGO: |
1764 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1752 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1765 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1753 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1766 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1767 | lpfc_issue_els_logo(phba, ndlp, cmdiocb->retry); | 1754 | lpfc_issue_els_logo(phba, ndlp, cmdiocb->retry); |
1768 | return 1; | 1755 | return 1; |
1769 | } | 1756 | } |
@@ -1827,7 +1814,7 @@ lpfc_cmpl_els_logo_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1827 | 1814 | ||
1828 | switch (ndlp->nlp_state) { | 1815 | switch (ndlp->nlp_state) { |
1829 | case NLP_STE_UNUSED_NODE: /* node is just allocated */ | 1816 | case NLP_STE_UNUSED_NODE: /* node is just allocated */ |
1830 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1817 | lpfc_drop_node(phba, ndlp); |
1831 | break; | 1818 | break; |
1832 | case NLP_STE_NPR_NODE: /* NPort Recovery mode */ | 1819 | case NLP_STE_NPR_NODE: /* NPort Recovery mode */ |
1833 | lpfc_unreg_rpi(phba, ndlp); | 1820 | lpfc_unreg_rpi(phba, ndlp); |
@@ -1885,8 +1872,7 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1885 | mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; | 1872 | mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; |
1886 | mbox->context2 = ndlp; | 1873 | mbox->context2 = ndlp; |
1887 | ndlp->nlp_prev_state = ndlp->nlp_state; | 1874 | ndlp->nlp_prev_state = ndlp->nlp_state; |
1888 | ndlp->nlp_state = NLP_STE_REG_LOGIN_ISSUE; | 1875 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_REG_LOGIN_ISSUE); |
1889 | lpfc_nlp_list(phba, ndlp, NLP_REGLOGIN_LIST); | ||
1890 | if (lpfc_sli_issue_mbox(phba, mbox, | 1876 | if (lpfc_sli_issue_mbox(phba, mbox, |
1891 | (MBX_NOWAIT | MBX_STOP_IOCB)) | 1877 | (MBX_NOWAIT | MBX_STOP_IOCB)) |
1892 | != MBX_NOT_FINISHED) { | 1878 | != MBX_NOT_FINISHED) { |
@@ -1901,7 +1887,7 @@ lpfc_cmpl_els_acc(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
1901 | (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) || | 1887 | (irsp->un.ulpWord[4] == IOERR_LINK_DOWN) || |
1902 | (irsp->un.ulpWord[4] == IOERR_SLI_DOWN)))) { | 1888 | (irsp->un.ulpWord[4] == IOERR_SLI_DOWN)))) { |
1903 | if (ndlp->nlp_flag & NLP_ACC_REGLOGIN) { | 1889 | if (ndlp->nlp_flag & NLP_ACC_REGLOGIN) { |
1904 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1890 | lpfc_drop_node(phba, ndlp); |
1905 | ndlp = NULL; | 1891 | ndlp = NULL; |
1906 | } | 1892 | } |
1907 | } | 1893 | } |
@@ -2311,9 +2297,8 @@ lpfc_els_disc_adisc(struct lpfc_hba * phba) | |||
2311 | if (ndlp->nlp_flag & NLP_NPR_ADISC) { | 2297 | if (ndlp->nlp_flag & NLP_NPR_ADISC) { |
2312 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; | 2298 | ndlp->nlp_flag &= ~NLP_NPR_ADISC; |
2313 | ndlp->nlp_prev_state = ndlp->nlp_state; | 2299 | ndlp->nlp_prev_state = ndlp->nlp_state; |
2314 | ndlp->nlp_state = NLP_STE_ADISC_ISSUE; | 2300 | lpfc_nlp_set_state(phba, ndlp, |
2315 | lpfc_nlp_list(phba, ndlp, | 2301 | NLP_STE_ADISC_ISSUE); |
2316 | NLP_ADISC_LIST); | ||
2317 | lpfc_issue_els_adisc(phba, ndlp, 0); | 2302 | lpfc_issue_els_adisc(phba, ndlp, 0); |
2318 | sentadisc++; | 2303 | sentadisc++; |
2319 | phba->num_disc_nodes++; | 2304 | phba->num_disc_nodes++; |
@@ -2349,8 +2334,8 @@ lpfc_els_disc_plogi(struct lpfc_hba * phba) | |||
2349 | (!(ndlp->nlp_flag & NLP_DELAY_TMO))) { | 2334 | (!(ndlp->nlp_flag & NLP_DELAY_TMO))) { |
2350 | if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { | 2335 | if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { |
2351 | ndlp->nlp_prev_state = ndlp->nlp_state; | 2336 | ndlp->nlp_prev_state = ndlp->nlp_state; |
2352 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 2337 | lpfc_nlp_set_state(phba, ndlp, |
2353 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | 2338 | NLP_STE_PLOGI_ISSUE); |
2354 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); | 2339 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); |
2355 | sentplogi++; | 2340 | sentplogi++; |
2356 | phba->num_disc_nodes++; | 2341 | phba->num_disc_nodes++; |
@@ -2647,8 +2632,7 @@ lpfc_els_handle_rscn(struct lpfc_hba * phba) | |||
2647 | lpfc_nlp_init(phba, ndlp, NameServer_DID); | 2632 | lpfc_nlp_init(phba, ndlp, NameServer_DID); |
2648 | ndlp->nlp_type |= NLP_FABRIC; | 2633 | ndlp->nlp_type |= NLP_FABRIC; |
2649 | ndlp->nlp_prev_state = ndlp->nlp_state; | 2634 | ndlp->nlp_prev_state = ndlp->nlp_state; |
2650 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 2635 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE); |
2651 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | ||
2652 | lpfc_issue_els_plogi(phba, NameServer_DID, 0); | 2636 | lpfc_issue_els_plogi(phba, NameServer_DID, 0); |
2653 | /* Wait for NameServer login cmpl before we can | 2637 | /* Wait for NameServer login cmpl before we can |
2654 | continue */ | 2638 | continue */ |
@@ -3074,8 +3058,8 @@ lpfc_els_rcv_farp(struct lpfc_hba * phba, | |||
3074 | /* Log back into the node before sending the FARP. */ | 3058 | /* Log back into the node before sending the FARP. */ |
3075 | if (fp->Rflags & FARP_REQUEST_PLOGI) { | 3059 | if (fp->Rflags & FARP_REQUEST_PLOGI) { |
3076 | ndlp->nlp_prev_state = ndlp->nlp_state; | 3060 | ndlp->nlp_prev_state = ndlp->nlp_state; |
3077 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 3061 | lpfc_nlp_set_state(phba, ndlp, |
3078 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | 3062 | NLP_STE_PLOGI_ISSUE); |
3079 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); | 3063 | lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0); |
3080 | } | 3064 | } |
3081 | 3065 | ||
@@ -3159,7 +3143,7 @@ lpfc_els_rcv_fan(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
3159 | * Clean up old Fabric, Nameserver and | 3143 | * Clean up old Fabric, Nameserver and |
3160 | * other NLP_FABRIC logins | 3144 | * other NLP_FABRIC logins |
3161 | */ | 3145 | */ |
3162 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3146 | lpfc_drop_node(phba, ndlp); |
3163 | } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { | 3147 | } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { |
3164 | /* Fail outstanding I/O now since this | 3148 | /* Fail outstanding I/O now since this |
3165 | * device is marked for PLOGI | 3149 | * device is marked for PLOGI |
@@ -3182,14 +3166,14 @@ lpfc_els_rcv_fan(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb, | |||
3182 | switch (ndlp->nlp_prev_state) { | 3166 | switch (ndlp->nlp_prev_state) { |
3183 | case NLP_STE_UNMAPPED_NODE: | 3167 | case NLP_STE_UNMAPPED_NODE: |
3184 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; | 3168 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; |
3185 | ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; | 3169 | lpfc_nlp_set_state(phba, ndlp, |
3186 | lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); | 3170 | NLP_STE_UNMAPPED_NODE); |
3187 | break; | 3171 | break; |
3188 | 3172 | ||
3189 | case NLP_STE_MAPPED_NODE: | 3173 | case NLP_STE_MAPPED_NODE: |
3190 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; | 3174 | ndlp->nlp_prev_state = NLP_STE_NPR_NODE; |
3191 | ndlp->nlp_state = NLP_STE_MAPPED_NODE; | 3175 | lpfc_nlp_set_state(phba, ndlp, |
3192 | lpfc_nlp_list(phba, ndlp, NLP_MAPPED_LIST); | 3176 | NLP_STE_MAPPED_NODE); |
3193 | break; | 3177 | break; |
3194 | 3178 | ||
3195 | default: | 3179 | default: |
@@ -3431,8 +3415,7 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3431 | if ((did & Fabric_DID_MASK) == Fabric_DID_MASK) { | 3415 | if ((did & Fabric_DID_MASK) == Fabric_DID_MASK) { |
3432 | ndlp->nlp_type |= NLP_FABRIC; | 3416 | ndlp->nlp_type |= NLP_FABRIC; |
3433 | } | 3417 | } |
3434 | ndlp->nlp_state = NLP_STE_UNUSED_NODE; | 3418 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNUSED_NODE); |
3435 | lpfc_nlp_list(phba, ndlp, NLP_UNUSED_LIST); | ||
3436 | } | 3419 | } |
3437 | 3420 | ||
3438 | phba->fc_stat.elsRcvFrame++; | 3421 | phba->fc_stat.elsRcvFrame++; |
@@ -3460,9 +3443,8 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3460 | case ELS_CMD_FLOGI: | 3443 | case ELS_CMD_FLOGI: |
3461 | phba->fc_stat.elsRcvFLOGI++; | 3444 | phba->fc_stat.elsRcvFLOGI++; |
3462 | lpfc_els_rcv_flogi(phba, elsiocb, ndlp, newnode); | 3445 | lpfc_els_rcv_flogi(phba, elsiocb, ndlp, newnode); |
3463 | if (newnode) { | 3446 | if (newnode) |
3464 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3447 | lpfc_drop_node(phba, ndlp); |
3465 | } | ||
3466 | break; | 3448 | break; |
3467 | case ELS_CMD_LOGO: | 3449 | case ELS_CMD_LOGO: |
3468 | phba->fc_stat.elsRcvLOGO++; | 3450 | phba->fc_stat.elsRcvLOGO++; |
@@ -3483,9 +3465,8 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3483 | case ELS_CMD_RSCN: | 3465 | case ELS_CMD_RSCN: |
3484 | phba->fc_stat.elsRcvRSCN++; | 3466 | phba->fc_stat.elsRcvRSCN++; |
3485 | lpfc_els_rcv_rscn(phba, elsiocb, ndlp, newnode); | 3467 | lpfc_els_rcv_rscn(phba, elsiocb, ndlp, newnode); |
3486 | if (newnode) { | 3468 | if (newnode) |
3487 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3469 | lpfc_drop_node(phba, ndlp); |
3488 | } | ||
3489 | break; | 3470 | break; |
3490 | case ELS_CMD_ADISC: | 3471 | case ELS_CMD_ADISC: |
3491 | phba->fc_stat.elsRcvADISC++; | 3472 | phba->fc_stat.elsRcvADISC++; |
@@ -3526,30 +3507,26 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3526 | case ELS_CMD_LIRR: | 3507 | case ELS_CMD_LIRR: |
3527 | phba->fc_stat.elsRcvLIRR++; | 3508 | phba->fc_stat.elsRcvLIRR++; |
3528 | lpfc_els_rcv_lirr(phba, elsiocb, ndlp); | 3509 | lpfc_els_rcv_lirr(phba, elsiocb, ndlp); |
3529 | if (newnode) { | 3510 | if (newnode) |
3530 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3511 | lpfc_drop_node(phba, ndlp); |
3531 | } | ||
3532 | break; | 3512 | break; |
3533 | case ELS_CMD_RPS: | 3513 | case ELS_CMD_RPS: |
3534 | phba->fc_stat.elsRcvRPS++; | 3514 | phba->fc_stat.elsRcvRPS++; |
3535 | lpfc_els_rcv_rps(phba, elsiocb, ndlp); | 3515 | lpfc_els_rcv_rps(phba, elsiocb, ndlp); |
3536 | if (newnode) { | 3516 | if (newnode) |
3537 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3517 | lpfc_drop_node(phba, ndlp); |
3538 | } | ||
3539 | break; | 3518 | break; |
3540 | case ELS_CMD_RPL: | 3519 | case ELS_CMD_RPL: |
3541 | phba->fc_stat.elsRcvRPL++; | 3520 | phba->fc_stat.elsRcvRPL++; |
3542 | lpfc_els_rcv_rpl(phba, elsiocb, ndlp); | 3521 | lpfc_els_rcv_rpl(phba, elsiocb, ndlp); |
3543 | if (newnode) { | 3522 | if (newnode) |
3544 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3523 | lpfc_drop_node(phba, ndlp); |
3545 | } | ||
3546 | break; | 3524 | break; |
3547 | case ELS_CMD_RNID: | 3525 | case ELS_CMD_RNID: |
3548 | phba->fc_stat.elsRcvRNID++; | 3526 | phba->fc_stat.elsRcvRNID++; |
3549 | lpfc_els_rcv_rnid(phba, elsiocb, ndlp); | 3527 | lpfc_els_rcv_rnid(phba, elsiocb, ndlp); |
3550 | if (newnode) { | 3528 | if (newnode) |
3551 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3529 | lpfc_drop_node(phba, ndlp); |
3552 | } | ||
3553 | break; | 3530 | break; |
3554 | default: | 3531 | default: |
3555 | /* Unsupported ELS command, reject */ | 3532 | /* Unsupported ELS command, reject */ |
@@ -3559,9 +3536,8 @@ lpfc_els_unsol_event(struct lpfc_hba * phba, | |||
3559 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, | 3536 | lpfc_printf_log(phba, KERN_ERR, LOG_ELS, |
3560 | "%d:0115 Unknown ELS command x%x received from " | 3537 | "%d:0115 Unknown ELS command x%x received from " |
3561 | "NPORT x%x\n", phba->brd_no, cmd, did); | 3538 | "NPORT x%x\n", phba->brd_no, cmd, did); |
3562 | if (newnode) { | 3539 | if (newnode) |
3563 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 3540 | lpfc_drop_node(phba, ndlp); |
3564 | } | ||
3565 | break; | 3541 | break; |
3566 | } | 3542 | } |
3567 | 3543 | ||
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 2c21641265b5..fda8f07f1d0b 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -429,9 +429,8 @@ lpfc_linkdown(struct lpfc_hba * phba) | |||
429 | 429 | ||
430 | /* free any ndlp's on unused list */ | 430 | /* free any ndlp's on unused list */ |
431 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_unused_list, | 431 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_unused_list, |
432 | nlp_listp) { | 432 | nlp_listp) |
433 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 433 | lpfc_drop_node(phba, ndlp); |
434 | } | ||
435 | 434 | ||
436 | /* Setup myDID for link up if we are in pt2pt mode */ | 435 | /* Setup myDID for link up if we are in pt2pt mode */ |
437 | if (phba->fc_flag & FC_PT2PT) { | 436 | if (phba->fc_flag & FC_PT2PT) { |
@@ -497,8 +496,8 @@ lpfc_linkup(struct lpfc_hba * phba) | |||
497 | /* On Linkup its safe to clean up the | 496 | /* On Linkup its safe to clean up the |
498 | * ndlp from Fabric connections. | 497 | * ndlp from Fabric connections. |
499 | */ | 498 | */ |
500 | lpfc_nlp_list(phba, ndlp, | 499 | lpfc_nlp_set_state(phba, ndlp, |
501 | NLP_UNUSED_LIST); | 500 | NLP_STE_UNUSED_NODE); |
502 | } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { | 501 | } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { |
503 | /* Fail outstanding IO now since device | 502 | /* Fail outstanding IO now since device |
504 | * is marked for PLOGI. | 503 | * is marked for PLOGI. |
@@ -511,9 +510,8 @@ lpfc_linkup(struct lpfc_hba * phba) | |||
511 | 510 | ||
512 | /* free any ndlp's on unused list */ | 511 | /* free any ndlp's on unused list */ |
513 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_unused_list, | 512 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_unused_list, |
514 | nlp_listp) { | 513 | nlp_listp) |
515 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 514 | lpfc_drop_node(phba, ndlp); |
516 | } | ||
517 | 515 | ||
518 | return 0; | 516 | return 0; |
519 | } | 517 | } |
@@ -993,8 +991,7 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
993 | 991 | ||
994 | ndlp->nlp_rpi = mb->un.varWords[0]; | 992 | ndlp->nlp_rpi = mb->un.varWords[0]; |
995 | ndlp->nlp_type |= NLP_FABRIC; | 993 | ndlp->nlp_type |= NLP_FABRIC; |
996 | ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; | 994 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNMAPPED_NODE); |
997 | lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); | ||
998 | 995 | ||
999 | if (phba->hba_state == LPFC_FABRIC_CFG_LINK) { | 996 | if (phba->hba_state == LPFC_FABRIC_CFG_LINK) { |
1000 | /* This NPort has been assigned an NPort_ID by the fabric as a | 997 | /* This NPort has been assigned an NPort_ID by the fabric as a |
@@ -1024,8 +1021,7 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
1024 | ndlp->nlp_type |= NLP_FABRIC; | 1021 | ndlp->nlp_type |= NLP_FABRIC; |
1025 | } | 1022 | } |
1026 | } | 1023 | } |
1027 | ndlp->nlp_state = NLP_STE_PLOGI_ISSUE; | 1024 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE); |
1028 | lpfc_nlp_list(phba, ndlp, NLP_PLOGI_LIST); | ||
1029 | lpfc_issue_els_plogi(phba, NameServer_DID, 0); | 1025 | lpfc_issue_els_plogi(phba, NameServer_DID, 0); |
1030 | if (phba->cfg_fdmi_on) { | 1026 | if (phba->cfg_fdmi_on) { |
1031 | ndlp_fdmi = mempool_alloc(phba->nlp_mem_pool, | 1027 | ndlp_fdmi = mempool_alloc(phba->nlp_mem_pool, |
@@ -1068,8 +1064,8 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
1068 | if (mb->mbxStatus) { | 1064 | if (mb->mbxStatus) { |
1069 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 1065 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
1070 | kfree(mp); | 1066 | kfree(mp); |
1071 | mempool_free( pmb, phba->mbox_mem_pool); | 1067 | mempool_free(pmb, phba->mbox_mem_pool); |
1072 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1068 | lpfc_drop_node(phba, ndlp); |
1073 | 1069 | ||
1074 | /* RegLogin failed, so just use loop map to make discovery | 1070 | /* RegLogin failed, so just use loop map to make discovery |
1075 | list */ | 1071 | list */ |
@@ -1084,8 +1080,7 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
1084 | 1080 | ||
1085 | ndlp->nlp_rpi = mb->un.varWords[0]; | 1081 | ndlp->nlp_rpi = mb->un.varWords[0]; |
1086 | ndlp->nlp_type |= NLP_FABRIC; | 1082 | ndlp->nlp_type |= NLP_FABRIC; |
1087 | ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; | 1083 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNMAPPED_NODE); |
1088 | lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); | ||
1089 | 1084 | ||
1090 | if (phba->hba_state < LPFC_HBA_READY) { | 1085 | if (phba->hba_state < LPFC_HBA_READY) { |
1091 | /* Link up discovery requires Fabrib registration. */ | 1086 | /* Link up discovery requires Fabrib registration. */ |
@@ -1170,72 +1165,82 @@ lpfc_unregister_remote_port(struct lpfc_hba * phba, | |||
1170 | return; | 1165 | return; |
1171 | } | 1166 | } |
1172 | 1167 | ||
1173 | int | 1168 | static void |
1174 | lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list) | 1169 | lpfc_nlp_counters(struct lpfc_hba *phba, int state, int count) |
1175 | { | 1170 | { |
1176 | enum { none, unmapped, mapped } rport_add = none, rport_del = none; | 1171 | switch (state) { |
1177 | struct lpfc_sli *psli; | 1172 | case NLP_STE_UNUSED_NODE: |
1178 | 1173 | phba->fc_unused_cnt += count; | |
1179 | psli = &phba->sli; | 1174 | break; |
1180 | /* Sanity check to ensure we are not moving to / from the same list */ | 1175 | case NLP_STE_PLOGI_ISSUE: |
1181 | if ((nlp->nlp_flag & NLP_LIST_MASK) == list) | 1176 | phba->fc_plogi_cnt += count; |
1182 | if (list != NLP_NO_LIST) | 1177 | break; |
1183 | return 0; | 1178 | case NLP_STE_ADISC_ISSUE: |
1184 | 1179 | phba->fc_adisc_cnt += count; | |
1185 | spin_lock_irq(phba->host->host_lock); | ||
1186 | switch (nlp->nlp_flag & NLP_LIST_MASK) { | ||
1187 | case NLP_NO_LIST: /* Not on any list */ | ||
1188 | break; | 1180 | break; |
1181 | case NLP_STE_REG_LOGIN_ISSUE: | ||
1182 | phba->fc_reglogin_cnt += count; | ||
1183 | break; | ||
1184 | case NLP_STE_PRLI_ISSUE: | ||
1185 | phba->fc_prli_cnt += count; | ||
1186 | break; | ||
1187 | case NLP_STE_UNMAPPED_NODE: | ||
1188 | phba->fc_unmap_cnt += count; | ||
1189 | break; | ||
1190 | case NLP_STE_MAPPED_NODE: | ||
1191 | phba->fc_map_cnt += count; | ||
1192 | break; | ||
1193 | case NLP_STE_NPR_NODE: | ||
1194 | phba->fc_npr_cnt += count; | ||
1195 | break; | ||
1196 | } | ||
1197 | } | ||
1198 | |||
1199 | void | ||
1200 | lpfc_delink_node(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | ||
1201 | { | ||
1202 | switch (ndlp->nlp_flag & NLP_LIST_MASK) { | ||
1189 | case NLP_UNUSED_LIST: | 1203 | case NLP_UNUSED_LIST: |
1190 | phba->fc_unused_cnt--; | 1204 | list_del_init(&ndlp->nlp_listp); |
1191 | list_del(&nlp->nlp_listp); | ||
1192 | break; | 1205 | break; |
1193 | case NLP_PLOGI_LIST: | 1206 | case NLP_PLOGI_LIST: |
1194 | phba->fc_plogi_cnt--; | 1207 | list_del_init(&ndlp->nlp_listp); |
1195 | list_del(&nlp->nlp_listp); | ||
1196 | break; | 1208 | break; |
1197 | case NLP_ADISC_LIST: | 1209 | case NLP_ADISC_LIST: |
1198 | phba->fc_adisc_cnt--; | 1210 | list_del_init(&ndlp->nlp_listp); |
1199 | list_del(&nlp->nlp_listp); | ||
1200 | break; | 1211 | break; |
1201 | case NLP_REGLOGIN_LIST: | 1212 | case NLP_REGLOGIN_LIST: |
1202 | phba->fc_reglogin_cnt--; | 1213 | list_del_init(&ndlp->nlp_listp); |
1203 | list_del(&nlp->nlp_listp); | ||
1204 | break; | 1214 | break; |
1205 | case NLP_PRLI_LIST: | 1215 | case NLP_PRLI_LIST: |
1206 | phba->fc_prli_cnt--; | 1216 | list_del_init(&ndlp->nlp_listp); |
1207 | list_del(&nlp->nlp_listp); | ||
1208 | break; | 1217 | break; |
1209 | case NLP_UNMAPPED_LIST: | 1218 | case NLP_UNMAPPED_LIST: |
1210 | phba->fc_unmap_cnt--; | 1219 | list_del_init(&ndlp->nlp_listp); |
1211 | list_del(&nlp->nlp_listp); | ||
1212 | nlp->nlp_flag &= ~NLP_TGT_NO_SCSIID; | ||
1213 | nlp->nlp_type &= ~NLP_FC_NODE; | ||
1214 | phba->nport_event_cnt++; | ||
1215 | if (nlp->rport) | ||
1216 | rport_del = unmapped; | ||
1217 | break; | 1220 | break; |
1218 | case NLP_MAPPED_LIST: | 1221 | case NLP_MAPPED_LIST: |
1219 | phba->fc_map_cnt--; | 1222 | list_del_init(&ndlp->nlp_listp); |
1220 | list_del(&nlp->nlp_listp); | ||
1221 | phba->nport_event_cnt++; | ||
1222 | if (nlp->rport) | ||
1223 | rport_del = mapped; | ||
1224 | break; | 1223 | break; |
1225 | case NLP_NPR_LIST: | 1224 | case NLP_NPR_LIST: |
1226 | phba->fc_npr_cnt--; | 1225 | list_del_init(&ndlp->nlp_listp); |
1227 | list_del(&nlp->nlp_listp); | ||
1228 | /* Stop delay tmo if taking node off NPR list */ | ||
1229 | if ((nlp->nlp_flag & NLP_DELAY_TMO) && | ||
1230 | (list != NLP_NPR_LIST)) { | ||
1231 | spin_unlock_irq(phba->host->host_lock); | ||
1232 | lpfc_cancel_retry_delay_tmo(phba, nlp); | ||
1233 | spin_lock_irq(phba->host->host_lock); | ||
1234 | } | ||
1235 | break; | 1226 | break; |
1236 | } | 1227 | } |
1237 | 1228 | ||
1238 | nlp->nlp_flag &= ~NLP_LIST_MASK; | 1229 | ndlp->nlp_flag &= ~NLP_LIST_MASK; |
1230 | } | ||
1231 | |||
1232 | static int | ||
1233 | lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list) | ||
1234 | { | ||
1235 | struct lpfc_sli *psli; | ||
1236 | |||
1237 | psli = &phba->sli; | ||
1238 | /* Sanity check to ensure we are not moving to / from the same list */ | ||
1239 | if ((nlp->nlp_flag & NLP_LIST_MASK) == list) | ||
1240 | return 0; | ||
1241 | |||
1242 | spin_lock_irq(phba->host->host_lock); | ||
1243 | lpfc_delink_node(phba, nlp); | ||
1239 | 1244 | ||
1240 | /* Add NPort <did> to <num> list */ | 1245 | /* Add NPort <did> to <num> list */ |
1241 | lpfc_printf_log(phba, | 1246 | lpfc_printf_log(phba, |
@@ -1246,102 +1251,85 @@ lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list) | |||
1246 | nlp->nlp_DID, list, nlp->nlp_flag); | 1251 | nlp->nlp_DID, list, nlp->nlp_flag); |
1247 | 1252 | ||
1248 | switch (list) { | 1253 | switch (list) { |
1249 | case NLP_NO_LIST: /* No list, just remove it */ | ||
1250 | spin_unlock_irq(phba->host->host_lock); | ||
1251 | lpfc_nlp_remove(phba, nlp); | ||
1252 | spin_lock_irq(phba->host->host_lock); | ||
1253 | /* as node removed - stop further transport calls */ | ||
1254 | rport_del = none; | ||
1255 | break; | ||
1256 | case NLP_UNUSED_LIST: | 1254 | case NLP_UNUSED_LIST: |
1257 | nlp->nlp_flag |= list; | 1255 | nlp->nlp_flag |= list; |
1258 | /* Put it at the end of the unused list */ | 1256 | /* Put it at the end of the unused list */ |
1259 | list_add_tail(&nlp->nlp_listp, &phba->fc_unused_list); | 1257 | list_add_tail(&nlp->nlp_listp, &phba->fc_unused_list); |
1260 | phba->fc_unused_cnt++; | ||
1261 | break; | 1258 | break; |
1262 | case NLP_PLOGI_LIST: | 1259 | case NLP_PLOGI_LIST: |
1263 | nlp->nlp_flag |= list; | 1260 | nlp->nlp_flag |= list; |
1264 | /* Put it at the end of the plogi list */ | 1261 | /* Put it at the end of the plogi list */ |
1265 | list_add_tail(&nlp->nlp_listp, &phba->fc_plogi_list); | 1262 | list_add_tail(&nlp->nlp_listp, &phba->fc_plogi_list); |
1266 | phba->fc_plogi_cnt++; | ||
1267 | break; | 1263 | break; |
1268 | case NLP_ADISC_LIST: | 1264 | case NLP_ADISC_LIST: |
1269 | nlp->nlp_flag |= list; | 1265 | nlp->nlp_flag |= list; |
1270 | /* Put it at the end of the adisc list */ | 1266 | /* Put it at the end of the adisc list */ |
1271 | list_add_tail(&nlp->nlp_listp, &phba->fc_adisc_list); | 1267 | list_add_tail(&nlp->nlp_listp, &phba->fc_adisc_list); |
1272 | phba->fc_adisc_cnt++; | ||
1273 | break; | 1268 | break; |
1274 | case NLP_REGLOGIN_LIST: | 1269 | case NLP_REGLOGIN_LIST: |
1275 | nlp->nlp_flag |= list; | 1270 | nlp->nlp_flag |= list; |
1276 | /* Put it at the end of the reglogin list */ | 1271 | /* Put it at the end of the reglogin list */ |
1277 | list_add_tail(&nlp->nlp_listp, &phba->fc_reglogin_list); | 1272 | list_add_tail(&nlp->nlp_listp, &phba->fc_reglogin_list); |
1278 | phba->fc_reglogin_cnt++; | ||
1279 | break; | 1273 | break; |
1280 | case NLP_PRLI_LIST: | 1274 | case NLP_PRLI_LIST: |
1281 | nlp->nlp_flag |= list; | 1275 | nlp->nlp_flag |= list; |
1282 | /* Put it at the end of the prli list */ | 1276 | /* Put it at the end of the prli list */ |
1283 | list_add_tail(&nlp->nlp_listp, &phba->fc_prli_list); | 1277 | list_add_tail(&nlp->nlp_listp, &phba->fc_prli_list); |
1284 | phba->fc_prli_cnt++; | ||
1285 | break; | 1278 | break; |
1286 | case NLP_UNMAPPED_LIST: | 1279 | case NLP_UNMAPPED_LIST: |
1287 | rport_add = unmapped; | ||
1288 | /* ensure all vestiges of "mapped" significance are gone */ | ||
1289 | nlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR); | ||
1290 | nlp->nlp_flag |= list; | 1280 | nlp->nlp_flag |= list; |
1291 | /* Put it at the end of the unmap list */ | 1281 | /* Put it at the end of the unmap list */ |
1292 | list_add_tail(&nlp->nlp_listp, &phba->fc_nlpunmap_list); | 1282 | list_add_tail(&nlp->nlp_listp, &phba->fc_nlpunmap_list); |
1293 | phba->fc_unmap_cnt++; | ||
1294 | phba->nport_event_cnt++; | ||
1295 | nlp->nlp_flag &= ~NLP_NODEV_REMOVE; | ||
1296 | nlp->nlp_type |= NLP_FC_NODE; | ||
1297 | break; | 1283 | break; |
1298 | case NLP_MAPPED_LIST: | 1284 | case NLP_MAPPED_LIST: |
1299 | rport_add = mapped; | ||
1300 | nlp->nlp_flag |= list; | 1285 | nlp->nlp_flag |= list; |
1301 | /* Put it at the end of the map list */ | 1286 | /* Put it at the end of the map list */ |
1302 | list_add_tail(&nlp->nlp_listp, &phba->fc_nlpmap_list); | 1287 | list_add_tail(&nlp->nlp_listp, &phba->fc_nlpmap_list); |
1303 | phba->fc_map_cnt++; | ||
1304 | phba->nport_event_cnt++; | ||
1305 | nlp->nlp_flag &= ~NLP_NODEV_REMOVE; | ||
1306 | break; | 1288 | break; |
1307 | case NLP_NPR_LIST: | 1289 | case NLP_NPR_LIST: |
1308 | nlp->nlp_flag |= list; | 1290 | nlp->nlp_flag |= list; |
1309 | /* Put it at the end of the npr list */ | 1291 | /* Put it at the end of the npr list */ |
1310 | list_add_tail(&nlp->nlp_listp, &phba->fc_npr_list); | 1292 | list_add_tail(&nlp->nlp_listp, &phba->fc_npr_list); |
1311 | phba->fc_npr_cnt++; | ||
1312 | |||
1313 | nlp->nlp_flag &= ~NLP_RCV_PLOGI; | ||
1314 | break; | ||
1315 | case NLP_JUST_DQ: | ||
1316 | break; | 1293 | break; |
1317 | } | 1294 | } |
1318 | 1295 | ||
1319 | spin_unlock_irq(phba->host->host_lock); | 1296 | spin_unlock_irq(phba->host->host_lock); |
1297 | return 0; | ||
1298 | } | ||
1320 | 1299 | ||
1321 | /* | 1300 | static void |
1322 | * We make all the calls into the transport after we have | 1301 | lpfc_nlp_state_cleanup(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, |
1323 | * moved the node between lists. This so that we don't | 1302 | int old_state, int new_state) |
1324 | * release the lock while in-between lists. | 1303 | { |
1325 | */ | 1304 | if (new_state == NLP_STE_UNMAPPED_NODE) { |
1326 | 1305 | ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR); | |
1327 | /* Don't upcall midlayer if we're unloading */ | 1306 | ndlp->nlp_flag &= ~NLP_NODEV_REMOVE; |
1328 | if (!(phba->fc_flag & FC_UNLOADING)) { | 1307 | ndlp->nlp_type |= NLP_FC_NODE; |
1329 | /* | 1308 | } |
1330 | * We revalidate the rport pointer as the "add" function | 1309 | if (new_state == NLP_STE_MAPPED_NODE) |
1331 | * may have removed the remote port. | 1310 | ndlp->nlp_flag &= ~NLP_NODEV_REMOVE; |
1332 | */ | 1311 | if (new_state == NLP_STE_NPR_NODE) |
1333 | if ((rport_del != none) && nlp->rport) | 1312 | ndlp->nlp_flag &= ~NLP_RCV_PLOGI; |
1334 | lpfc_unregister_remote_port(phba, nlp); | 1313 | |
1314 | /* Transport interface */ | ||
1315 | if (ndlp->rport && (old_state == NLP_STE_MAPPED_NODE || | ||
1316 | old_state == NLP_STE_UNMAPPED_NODE)) { | ||
1317 | phba->nport_event_cnt++; | ||
1318 | lpfc_unregister_remote_port(phba, ndlp); | ||
1319 | } | ||
1335 | 1320 | ||
1336 | if (rport_add != none) { | 1321 | if (new_state == NLP_STE_MAPPED_NODE || |
1322 | new_state == NLP_STE_UNMAPPED_NODE) { | ||
1323 | phba->nport_event_cnt++; | ||
1337 | /* | 1324 | /* |
1338 | * Tell the fc transport about the port, if we haven't | 1325 | * Tell the fc transport about the port, if we haven't |
1339 | * already. If we have, and it's a scsi entity, be | 1326 | * already. If we have, and it's a scsi entity, be |
1340 | * sure to unblock any attached scsi devices | 1327 | * sure to unblock any attached scsi devices |
1341 | */ | 1328 | */ |
1342 | if ((!nlp->rport) || (nlp->rport->port_state == | 1329 | if (!ndlp->rport || |
1343 | FC_PORTSTATE_BLOCKED)) | 1330 | ndlp->rport->port_state == FC_PORTSTATE_BLOCKED) |
1344 | lpfc_register_remote_port(phba, nlp); | 1331 | lpfc_register_remote_port(phba, ndlp); |
1332 | } | ||
1345 | 1333 | ||
1346 | /* | 1334 | /* |
1347 | * if we added to Mapped list, but the remote port | 1335 | * if we added to Mapped list, but the remote port |
@@ -1349,19 +1337,75 @@ lpfc_nlp_list(struct lpfc_hba * phba, struct lpfc_nodelist * nlp, int list) | |||
1349 | * our presentable range - move the node to the | 1337 | * our presentable range - move the node to the |
1350 | * Unmapped List | 1338 | * Unmapped List |
1351 | */ | 1339 | */ |
1352 | if ((rport_add == mapped) && | 1340 | if (new_state == NLP_STE_MAPPED_NODE && |
1353 | ((!nlp->rport) || | 1341 | (!ndlp->rport || |
1354 | (nlp->rport->scsi_target_id == -1) || | 1342 | ndlp->rport->scsi_target_id == -1 || |
1355 | (nlp->rport->scsi_target_id >= LPFC_MAX_TARGET))) { | 1343 | ndlp->rport->scsi_target_id >= LPFC_MAX_TARGET)) { |
1356 | nlp->nlp_state = NLP_STE_UNMAPPED_NODE; | 1344 | spin_lock_irq(phba->host->host_lock); |
1357 | spin_lock_irq(phba->host->host_lock); | 1345 | ndlp->nlp_flag |= NLP_TGT_NO_SCSIID; |
1358 | nlp->nlp_flag |= NLP_TGT_NO_SCSIID; | 1346 | spin_unlock_irq(phba->host->host_lock); |
1359 | spin_unlock_irq(phba->host->host_lock); | 1347 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNMAPPED_NODE); |
1360 | lpfc_nlp_list(phba, nlp, NLP_UNMAPPED_LIST); | ||
1361 | } | ||
1362 | } | ||
1363 | } | 1348 | } |
1364 | return 0; | 1349 | } |
1350 | |||
1351 | void | ||
1352 | lpfc_nlp_set_state(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, int state) | ||
1353 | { | ||
1354 | int old_state = ndlp->nlp_state; | ||
1355 | static int list_id[] = { | ||
1356 | [NLP_STE_UNUSED_NODE] = NLP_UNUSED_LIST, | ||
1357 | [NLP_STE_PLOGI_ISSUE] = NLP_PLOGI_LIST, | ||
1358 | [NLP_STE_ADISC_ISSUE] = NLP_ADISC_LIST, | ||
1359 | [NLP_STE_REG_LOGIN_ISSUE] = NLP_REGLOGIN_LIST, | ||
1360 | [NLP_STE_PRLI_ISSUE] = NLP_PRLI_LIST, | ||
1361 | [NLP_STE_UNMAPPED_NODE] = NLP_UNMAPPED_LIST, | ||
1362 | [NLP_STE_MAPPED_NODE] = NLP_MAPPED_LIST, | ||
1363 | [NLP_STE_NPR_NODE] = NLP_NPR_LIST, | ||
1364 | }; | ||
1365 | |||
1366 | if (old_state == NLP_STE_NPR_NODE && | ||
1367 | (ndlp->nlp_flag & NLP_DELAY_TMO) != 0 && | ||
1368 | state != NLP_STE_NPR_NODE) | ||
1369 | lpfc_cancel_retry_delay_tmo(phba, ndlp); | ||
1370 | if (old_state == NLP_STE_UNMAPPED_NODE) { | ||
1371 | ndlp->nlp_flag &= ~NLP_TGT_NO_SCSIID; | ||
1372 | ndlp->nlp_type &= ~NLP_FC_NODE; | ||
1373 | } | ||
1374 | |||
1375 | if (old_state && !list_empty(&ndlp->nlp_listp)) | ||
1376 | lpfc_nlp_counters(phba, old_state, -1); | ||
1377 | |||
1378 | ndlp->nlp_state = state; | ||
1379 | lpfc_nlp_list(phba, ndlp, list_id[state]); | ||
1380 | lpfc_nlp_counters(phba, state, 1); | ||
1381 | |||
1382 | lpfc_nlp_state_cleanup(phba, ndlp, old_state, state); | ||
1383 | } | ||
1384 | |||
1385 | void | ||
1386 | lpfc_dequeue_node(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | ||
1387 | { | ||
1388 | if ((ndlp->nlp_flag & NLP_DELAY_TMO) != 0) | ||
1389 | lpfc_cancel_retry_delay_tmo(phba, ndlp); | ||
1390 | spin_lock_irq(phba->host->host_lock); | ||
1391 | if (ndlp->nlp_state && !list_empty(&ndlp->nlp_listp)) | ||
1392 | lpfc_nlp_counters(phba, ndlp->nlp_state, -1); | ||
1393 | lpfc_delink_node(phba, ndlp); | ||
1394 | spin_unlock_irq(phba->host->host_lock); | ||
1395 | lpfc_nlp_state_cleanup(phba, ndlp, ndlp->nlp_state, 0); | ||
1396 | } | ||
1397 | |||
1398 | void | ||
1399 | lpfc_drop_node(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | ||
1400 | { | ||
1401 | if ((ndlp->nlp_flag & NLP_DELAY_TMO) != 0) | ||
1402 | lpfc_cancel_retry_delay_tmo(phba, ndlp); | ||
1403 | spin_lock_irq(phba->host->host_lock); | ||
1404 | if (ndlp->nlp_state && !list_empty(&ndlp->nlp_listp)) | ||
1405 | lpfc_nlp_counters(phba, ndlp->nlp_state, -1); | ||
1406 | lpfc_delink_node(phba, ndlp); | ||
1407 | spin_unlock_irq(phba->host->host_lock); | ||
1408 | lpfc_nlp_remove(phba, ndlp); | ||
1365 | } | 1409 | } |
1366 | 1410 | ||
1367 | /* | 1411 | /* |
@@ -1577,7 +1621,7 @@ lpfc_freenode(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp) | |||
1577 | phba->brd_no, ndlp->nlp_DID, ndlp->nlp_flag, | 1621 | phba->brd_no, ndlp->nlp_DID, ndlp->nlp_flag, |
1578 | ndlp->nlp_state, ndlp->nlp_rpi); | 1622 | ndlp->nlp_state, ndlp->nlp_rpi); |
1579 | 1623 | ||
1580 | lpfc_nlp_list(phba, ndlp, NLP_JUST_DQ); | 1624 | lpfc_dequeue_node(phba, ndlp); |
1581 | 1625 | ||
1582 | /* cleanup any ndlp on mbox q waiting for reglogin cmpl */ | 1626 | /* cleanup any ndlp on mbox q waiting for reglogin cmpl */ |
1583 | if ((mb = phba->sli.mbox_active)) { | 1627 | if ((mb = phba->sli.mbox_active)) { |
@@ -1771,8 +1815,7 @@ lpfc_setup_disc_node(struct lpfc_hba * phba, uint32_t did) | |||
1771 | if (!ndlp) | 1815 | if (!ndlp) |
1772 | return NULL; | 1816 | return NULL; |
1773 | lpfc_nlp_init(phba, ndlp, did); | 1817 | lpfc_nlp_init(phba, ndlp, did); |
1774 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1818 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1775 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1776 | ndlp->nlp_flag |= NLP_NPR_2B_DISC; | 1819 | ndlp->nlp_flag |= NLP_NPR_2B_DISC; |
1777 | return ndlp; | 1820 | return ndlp; |
1778 | } | 1821 | } |
@@ -1791,8 +1834,7 @@ lpfc_setup_disc_node(struct lpfc_hba * phba, uint32_t did) | |||
1791 | flg = ndlp->nlp_flag & NLP_LIST_MASK; | 1834 | flg = ndlp->nlp_flag & NLP_LIST_MASK; |
1792 | if ((flg == NLP_ADISC_LIST) || (flg == NLP_PLOGI_LIST)) | 1835 | if ((flg == NLP_ADISC_LIST) || (flg == NLP_PLOGI_LIST)) |
1793 | return NULL; | 1836 | return NULL; |
1794 | ndlp->nlp_state = NLP_STE_NPR_NODE; | 1837 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_NPR_NODE); |
1795 | lpfc_nlp_list(phba, ndlp, NLP_NPR_LIST); | ||
1796 | ndlp->nlp_flag |= NLP_NPR_2B_DISC; | 1838 | ndlp->nlp_flag |= NLP_NPR_2B_DISC; |
1797 | } | 1839 | } |
1798 | return ndlp; | 1840 | return ndlp; |
@@ -2099,7 +2141,7 @@ lpfc_disc_timeout_handler(struct lpfc_hba *phba) | |||
2099 | nlp_listp) { | 2141 | nlp_listp) { |
2100 | if (ndlp->nlp_type & NLP_FABRIC) { | 2142 | if (ndlp->nlp_type & NLP_FABRIC) { |
2101 | /* Clean up the ndlp on Fabric connections */ | 2143 | /* Clean up the ndlp on Fabric connections */ |
2102 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 2144 | lpfc_drop_node(phba, ndlp); |
2103 | } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { | 2145 | } else if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) { |
2104 | /* Fail outstanding IO now since device | 2146 | /* Fail outstanding IO now since device |
2105 | * is marked for PLOGI. | 2147 | * is marked for PLOGI. |
@@ -2304,8 +2346,7 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
2304 | 2346 | ||
2305 | ndlp->nlp_rpi = mb->un.varWords[0]; | 2347 | ndlp->nlp_rpi = mb->un.varWords[0]; |
2306 | ndlp->nlp_type |= NLP_FABRIC; | 2348 | ndlp->nlp_type |= NLP_FABRIC; |
2307 | ndlp->nlp_state = NLP_STE_UNMAPPED_NODE; | 2349 | lpfc_nlp_set_state(phba, ndlp, NLP_STE_UNMAPPED_NODE); |
2308 | lpfc_nlp_list(phba, ndlp, NLP_UNMAPPED_LIST); | ||
2309 | 2350 | ||
2310 | /* Start issuing Fabric-Device Management Interface (FDMI) | 2351 | /* Start issuing Fabric-Device Management Interface (FDMI) |
2311 | * command to 0xfffffa (FDMI well known port) | 2352 | * command to 0xfffffa (FDMI well known port) |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index dc0fd2e36de1..5f013f1cdead 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -1196,7 +1196,7 @@ lpfc_cleanup(struct lpfc_hba * phba) | |||
1196 | 1196 | ||
1197 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_unused_list, | 1197 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_unused_list, |
1198 | nlp_listp) { | 1198 | nlp_listp) { |
1199 | lpfc_nlp_list(phba, ndlp, NLP_NO_LIST); | 1199 | lpfc_drop_node(phba, ndlp); |
1200 | } | 1200 | } |
1201 | 1201 | ||
1202 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_plogi_list, | 1202 | list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_plogi_list, |
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 | |||
602 | lpfc_cmpl_logo_unused_node(struct lpfc_hba * phba, | 598 | lpfc_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 | |||
610 | lpfc_device_rm_unused_node(struct lpfc_hba * phba, | 606 | lpfc_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 | ||