Lines Matching refs:ndlp
56 struct lpfc_nodelist *ndlp, uint8_t retry);
140 * @ndlp: pointer to a node-list data structure.
154 * ndlp is incremented by 1 and the reference to the ndlp is put into
155 * ndlp of the IOCB data structure for this IOCB to hold the ndlp
165 struct lpfc_nodelist *ndlp, u32 did,
297 vport->port_state, ndlp->nlp_rpi,
305 elscmd, ndlp->nlp_DID, elsiocb->iotag,
307 ndlp->nlp_rpi, vport->fc_flag);
332 * active ndlp node with Fabric_DID must already exist for this @vport.
348 struct lpfc_nodelist *ndlp;
354 ndlp = lpfc_findnode_did(vport, Fabric_DID);
355 if (!ndlp) {
383 ndlp->nlp_rpi);
391 /* increment the reference count on ndlp to hold reference
394 mbox->ctx_ndlp = lpfc_nlp_get(ndlp);
409 /* decrement the reference count on ndlp just incremented
412 lpfc_nlp_put(ndlp);
439 struct lpfc_nodelist *ndlp;
447 ndlp = lpfc_findnode_did(vport, Fabric_DID);
448 if (!ndlp) {
606 * @ndlp: pointer to a node-list data structure.
612 * port in a fabric topology. It properly sets up the parameters to the @ndlp
624 lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
651 memcpy(&ndlp->nlp_portname, &sp->portName, sizeof(struct lpfc_name));
652 memcpy(&ndlp->nlp_nodename, &sp->nodeName, sizeof(struct lpfc_name));
653 ndlp->nlp_class_sup = 0;
655 ndlp->nlp_class_sup |= FC_COS_CLASS1;
657 ndlp->nlp_class_sup |= FC_COS_CLASS2;
659 ndlp->nlp_class_sup |= FC_COS_CLASS3;
661 ndlp->nlp_class_sup |= FC_COS_CLASS4;
662 ndlp->nlp_maxframe = ((sp->cmn.bbRcvSizeMsb & 0x0F) << 8) |
765 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
766 lpfc_register_new_vport(phba, vport, ndlp);
771 lpfc_nlp_set_state(vport, ndlp, NLP_STE_REG_LOGIN_ISSUE);
774 lpfc_register_new_vport(phba, vport, ndlp);
778 ndlp->nlp_type |= NLP_FABRIC;
779 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
799 * @ndlp: pointer to a node-list data structure.
817 lpfc_cmpl_els_flogi_nport(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
861 /* If not registered with a transport, decrement ndlp reference
862 * count indicating that ndlp can be safely released when other
865 if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD)))
866 lpfc_nlp_put(ndlp);
868 ndlp = lpfc_findnode_did(vport, PT2PT_RemoteID);
869 if (!ndlp) {
871 * Cannot find existing Fabric ndlp, so allocate a
874 ndlp = lpfc_nlp_init(vport, PT2PT_RemoteID);
875 if (!ndlp)
879 memcpy(&ndlp->nlp_portname, &sp->portName,
881 memcpy(&ndlp->nlp_nodename, &sp->nodeName,
883 /* Set state will put ndlp onto node list if not already done */
884 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
885 spin_lock_irq(&ndlp->lock);
886 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
887 spin_unlock_irq(&ndlp->lock);
905 * ndlp can be released when other references are removed.
907 if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD)))
908 lpfc_nlp_put(ndlp);
931 * number of retries), one additional decrement of ndlp reference shall be
934 * invoke one decrement of ndlp reference count). If no error reported in
948 struct lpfc_nodelist *ndlp = cmdiocb->ndlp;
962 if (!(ndlp->fc4_xpt_flags & SCSI_XPT_REGD))
963 lpfc_nlp_put(ndlp);
1031 lpfc_check_nlp_post_devloss(vport, ndlp);
1040 if (!(ndlp->nlp_flag & NLP_IN_DEV_LOSS) &&
1041 !(ndlp->fc4_xpt_flags & SCSI_XPT_REGD))
1042 lpfc_nlp_put(ndlp);
1048 tmo, kref_read(&ndlp->kref));
1120 sp->cmn.priority_tagging, kref_read(&ndlp->kref));
1134 lpfc_check_nlp_post_devloss(vport, ndlp);
1141 rc = lpfc_cmpl_els_flogi_fabric(vport, ndlp, sp,
1144 rc = lpfc_cmpl_els_flogi_nport(vport, ndlp, sp);
1170 lpfc_nlp_put(ndlp);
1229 lpfc_nlp_put(ndlp);
1270 * @ndlp: pointer to a node-list data structure.
1280 * Note that the ndlp reference count will be incremented by 1 for holding the
1281 * ndlp and the reference to ndlp will be stored into the ndlp field of
1289 lpfc_issue_els_flogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1304 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
1305 ndlp->nlp_DID, ELS_CMD_FLOGI);
1389 elsiocb->ndlp = lpfc_nlp_get(ndlp);
1390 if (!elsiocb->ndlp) {
1402 lpfc_nlp_put(ndlp);
1411 /* lookup ndlp for received FLOGI */
1412 ndlp = lpfc_findnode_did(vport, 0);
1413 if (!ndlp)
1443 ndlp, NULL);
1448 /* Decrement ndlp reference count to indicate the node can be
1451 lpfc_nlp_put(ndlp);
1464 * contains a active Fabric_DID ndlp. Note that this function is to issue
1476 struct lpfc_nodelist *ndlp;
1496 ndlp = iocb->ndlp;
1497 if (ndlp && ndlp->nlp_DID == Fabric_DID) {
1520 * specified. It first searches the ndlp with the Fabric_DID (0xfffffe) from
1521 * the @vport's ndlp list. If no such ndlp found, it will create an ndlp and
1522 * put it into the @vport's ndlp list. If an inactive ndlp found on the list,
1524 * is then invoked with the @vport and the ndlp to perform the FLOGI for the
1534 struct lpfc_nodelist *ndlp;
1539 /* First look for the Fabric ndlp */
1540 ndlp = lpfc_findnode_did(vport, Fabric_DID);
1541 if (!ndlp) {
1542 /* Cannot find existing Fabric ndlp, so allocate a new one */
1543 ndlp = lpfc_nlp_init(vport, Fabric_DID);
1544 if (!ndlp)
1547 ndlp->nlp_type |= NLP_FABRIC;
1549 /* Put ndlp onto node list */
1550 lpfc_enqueue_node(vport, ndlp);
1555 if (lpfc_issue_els_flogi(vport, ndlp, 0)) {
1560 if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD)) &&
1561 !(ndlp->nlp_flag & NLP_IN_DEV_LOSS))
1562 lpfc_nlp_put(ndlp);
1573 * specified. It first searches the ndlp with the Fabric_DID (0xfffffe) from
1574 * the @vport's ndlp list. If no such ndlp found, it will create an ndlp and
1575 * put it into the @vport's ndlp list. If an inactive ndlp found on the list,
1577 * is then invoked with the @vport and the ndlp to perform the FDISC for the
1587 struct lpfc_nodelist *ndlp;
1589 /* First look for the Fabric ndlp */
1590 ndlp = lpfc_findnode_did(vport, Fabric_DID);
1591 if (!ndlp) {
1592 /* Cannot find existing Fabric ndlp, so allocate a new one */
1593 ndlp = lpfc_nlp_init(vport, Fabric_DID);
1594 if (!ndlp)
1598 ndlp->nlp_type |= NLP_FABRIC;
1600 /* Put ndlp onto node list */
1601 lpfc_enqueue_node(vport, ndlp);
1604 if (lpfc_issue_els_fdisc(vport, ndlp, 0)) {
1609 if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD)) &&
1610 !(ndlp->nlp_flag & NLP_IN_DEV_LOSS))
1611 lpfc_nlp_put(ndlp);
1649 * lpfc_plogi_confirm_nport - Confirm plogi wwpn matches stored ndlp
1652 * @ndlp: pointer to a node-list data structure.
1655 * from a PLOGI, matches the WWPN that is stored in the @ndlp for that N_POrt.
1657 * 1) The N_Port is a Fabric ndlp; 2) The @ndlp is on vport list and matches
1658 * the WWPN of the N_Port logged into; 3) The @ndlp is not on vport list but
1660 * pointer to the @ndlp will be returned. If the WWPN is not confirmed:
1661 * 1) if there is a node on vport list other than the @ndlp with the same
1666 * parameters of the @ndlp shall be copied to the new_ndlp, the @ndlp shall
1670 * Note that before the @ndlp got "released", the keepDID from not-matching
1672 * of the @ndlp. This is because the release of @ndlp is actually to put it
1677 * pointer to the PLOGI N_Port @ndlp
1681 struct lpfc_nodelist *ndlp)
1683 struct lpfc_vport *vport = ndlp->vport;
1695 * by WWPN. Just return the ndlp that was given to us.
1697 if (ndlp->nlp_type & NLP_FABRIC)
1698 return ndlp;
1704 * we have for that ndlp. If not, we have some work to do.
1708 /* return immediately if the WWPN matches ndlp */
1709 if (!new_ndlp || (new_ndlp == ndlp))
1710 return ndlp;
1727 "3178 PLOGI confirm: ndlp x%x x%x x%x: "
1729 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_fc4_type,
1742 * would have updated nlp_fc4_type in ndlp, so we must ensure
1747 new_ndlp->nlp_fc4_type = ndlp->nlp_fc4_type;
1751 new_ndlp->nlp_DID = ndlp->nlp_DID;
1752 new_ndlp->nlp_prev_state = ndlp->nlp_prev_state;
1755 ndlp->active_rrqs_xri_bitmap,
1759 spin_lock_irq(&ndlp->lock);
1762 keep_nlp_flag = ndlp->nlp_flag;
1763 new_ndlp->nlp_flag = ndlp->nlp_flag;
1786 ndlp->nlp_flag = keep_new_nlp_flag;
1788 /* if ndlp had NLP_UNREG_INP set, keep it */
1790 ndlp->nlp_flag |= NLP_UNREG_INP;
1792 ndlp->nlp_flag &= ~NLP_UNREG_INP;
1794 /* if ndlp had NLP_RPI_REGISTERED set, keep it */
1796 ndlp->nlp_flag |= NLP_RPI_REGISTERED;
1798 ndlp->nlp_flag &= ~NLP_RPI_REGISTERED;
1805 ndlp->nlp_flag |= NLP_DROPPED;
1807 ndlp->nlp_flag &= ~NLP_DROPPED;
1810 spin_unlock_irq(&ndlp->lock);
1814 lpfc_nlp_set_state(vport, new_ndlp, ndlp->nlp_state);
1818 new_ndlp->nrport = ndlp->nrport;
1821 if (memcmp(&ndlp->nlp_portname, name, sizeof(struct lpfc_name)) == 0) {
1822 /* The ndlp doesn't have a portname yet, but does have an
1824 * portname. Reinstantiate the new_ndlp and reset the ndlp.
1832 * because ndlp is inflight with no WWPN.
1834 ndlp->nlp_DID = keepDID;
1835 ndlp->nlp_fc4_type = keep_nlp_fc4_type;
1836 lpfc_nlp_set_state(vport, ndlp, keep_nlp_state);
1839 memcpy(ndlp->active_rrqs_xri_bitmap,
1848 lpfc_unreg_rpi(vport, ndlp);
1850 /* The ndlp and new_ndlp both have WWPNs but are swapping
1853 ndlp->nlp_DID = keepDID;
1854 ndlp->nlp_fc4_type = keep_nlp_fc4_type;
1858 memcpy(ndlp->active_rrqs_xri_bitmap,
1863 * reset the old ndlp state
1865 if ((ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) ||
1866 (ndlp->nlp_state == NLP_STE_MAPPED_NODE))
1868 lpfc_nlp_set_state(vport, ndlp, keep_nlp_state);
1869 ndlp->nrport = keep_nrport;
1873 * If ndlp is not associated with any rport we can drop it here else
1876 if (!ndlp->rport && (ndlp->nlp_state == NLP_STE_NPR_NODE))
1877 lpfc_disc_state_machine(vport, ndlp, NULL, NLP_EVT_DEVICE_RM);
1931 * clear the xri's bit in the ndlp's xri_bitmap. If the ndlp does not
1941 struct lpfc_nodelist *ndlp = cmdiocb->ndlp;
1960 ndlp->nlp_DID, ulp_status, ulp_word4,
1973 ndlp->nlp_DID, ulp_status,
1979 lpfc_nlp_put(ndlp);
1990 * ndlp on the vport node list that matches the remote node ID from the
1991 * PLOGI response IOCB. If such ndlp does not exist, the PLOGI is simply
1996 * the ndlp and the NLP_EVT_CMPL_PLOGI state to the Discover State Machine
2009 struct lpfc_nodelist *ndlp, *free_ndlp;
2034 ndlp = lpfc_findnode_did(vport, did);
2035 if (!ndlp) {
2038 "with no ndlp. Data: x%x x%x x%x\n",
2043 /* Since ndlp can be freed in the disc state machine, note if this node
2046 spin_lock_irq(&ndlp->lock);
2047 disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC);
2048 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
2049 spin_unlock_irq(&ndlp->lock);
2055 ndlp->nlp_DID, ndlp->nlp_fc4_type,
2061 spin_lock_irq(&ndlp->lock);
2062 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
2063 spin_unlock_irq(&ndlp->lock);
2072 spin_lock_irq(&ndlp->lock);
2073 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
2074 spin_unlock_irq(&ndlp->lock);
2086 ndlp->nlp_DID, ulp_status,
2091 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
2097 spin_lock_irq(&ndlp->lock);
2098 if ((ndlp->nlp_flag & (NLP_ACC_REGLOGIN | NLP_RCV_PLOGI)) &&
2099 ndlp->nlp_state == NLP_STE_REG_LOGIN_ISSUE) {
2100 spin_unlock_irq(&ndlp->lock);
2108 if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD))) {
2109 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
2110 if (!(ndlp->nlp_flag & NLP_IN_DEV_LOSS))
2113 spin_unlock_irq(&ndlp->lock);
2116 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
2122 ndlp = lpfc_plogi_confirm_nport(phba, prsp->virt, ndlp);
2127 ndlp->vmid_support = 0;
2135 ndlp->nlp_DID);
2136 /* if the dest port supports VMID, mark it in ndlp */
2137 ndlp->vmid_support = 1;
2140 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
2161 ndlp->nlp_DID, kref_read(&ndlp->kref), 0);
2165 free_ndlp = cmdiocb->ndlp;
2180 * the ndlp with the remote N_Port DID must exist on the @vport's ndlp list.
2184 * Note that the ndlp reference count will be incremented by 1 for holding
2185 * the ndlp and the reference to ndlp will be stored into the ndlp field
2197 struct lpfc_nodelist *ndlp;
2203 ndlp = lpfc_findnode_did(vport, did);
2204 if (!ndlp)
2211 if ((ndlp->nlp_flag & (NLP_IGNR_REG_CMPL | NLP_UNREG_INP)) &&
2212 ((ndlp->nlp_DID & Fabric_DID_MASK) != Fabric_DID_MASK) &&
2218 ndlp->nlp_defer_did, ndlp->nlp_DID,
2219 ndlp->nlp_rpi, ndlp->nlp_flag, ndlp);
2222 if (ndlp->nlp_defer_did == NLP_EVT_NOTHING_PENDING)
2223 ndlp->nlp_defer_did = did;
2228 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp, did,
2259 ndlp->vmid_support = 0;
2284 did, kref_read(&ndlp->kref), 0);
2285 elsiocb->ndlp = lpfc_nlp_get(ndlp);
2286 if (!elsiocb->ndlp) {
2294 lpfc_nlp_put(ndlp);
2312 * ndlp to mark the PRLI completion.
2319 struct lpfc_nodelist *ndlp;
2329 ndlp = cmdiocb->ndlp;
2334 spin_lock_irq(&ndlp->lock);
2335 ndlp->nlp_flag &= ~NLP_PRLI_SND;
2339 ndlp->fc4_prli_sent--;
2340 spin_unlock_irq(&ndlp->lock);
2345 ndlp->nlp_DID);
2351 ndlp->nlp_DID, ulp_status, ulp_word4,
2352 vport->num_disc_nodes, ndlp->fc4_prli_sent);
2381 ndlp->nlp_DID, ulp_status,
2382 ulp_word4, ndlp->nlp_state,
2383 ndlp->fc4_prli_sent, ndlp->nlp_flag);
2387 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
2394 if ((ndlp->nlp_state >= NLP_STE_PLOGI_ISSUE &&
2395 ndlp->nlp_state <= NLP_STE_REG_LOGIN_ISSUE) ||
2396 (ndlp->nlp_state == NLP_STE_NPR_NODE &&
2397 ndlp->nlp_flag & NLP_DELAY_TMO)) {
2401 ndlp->nlp_DID, ndlp->nlp_state,
2402 ndlp->nlp_flag);
2418 spin_lock_irq(&ndlp->lock);
2419 if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD)) &&
2420 !ndlp->fc4_prli_sent) {
2421 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
2422 if (!(ndlp->nlp_flag & NLP_IN_DEV_LOSS))
2425 spin_unlock_irq(&ndlp->lock);
2428 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
2436 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
2442 lpfc_nlp_put(ndlp);
2449 * @ndlp: pointer to a node-list data structure.
2458 * Note that the ndlp reference count will be incremented by 1 for holding the
2459 * ndlp and the reference to ndlp will be stored into the ndlp field of
2467 lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
2488 ndlp->nlp_fc4_type |= NLP_FC4_NVME;
2489 local_nlp_type = ndlp->nlp_fc4_type;
2491 /* This routine will issue 1 or 2 PRLIs, so zero all the ndlp
2494 ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR);
2495 ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR);
2496 ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
2497 ndlp->nlp_flag &= ~(NLP_FIRSTBURST | NLP_NPR_2B_DISC);
2498 ndlp->nvme_fb_size = 0;
2511 "3083 Unknown FC_TYPE x%x ndlp x%06x\n",
2512 ndlp->nlp_fc4_type, ndlp->nlp_DID);
2520 ndlp->nlp_fc4_type == NLP_FC4_NVME) {
2523 ndlp->nlp_type);
2524 lpfc_disc_state_machine(vport, ndlp, NULL, NLP_EVT_DEVICE_RM);
2528 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
2529 ndlp->nlp_DID, elscmd);
2610 ndlp->nlp_DID, kref_read(&ndlp->kref), 0);
2611 elsiocb->ndlp = lpfc_nlp_get(ndlp);
2612 if (!elsiocb->ndlp) {
2620 lpfc_nlp_put(ndlp);
2625 * the ndlp is used to track outstanding PRLIs for different
2628 spin_lock_irq(&ndlp->lock);
2629 ndlp->nlp_flag |= NLP_PRLI_SND;
2631 ndlp->fc4_prli_sent++;
2632 spin_unlock_irq(&ndlp->lock);
2791 struct lpfc_nodelist *ndlp;
2799 ndlp = cmdiocb->ndlp;
2814 ndlp->nlp_DID);
2816 /* Since ndlp can be freed in the disc state machine, note if this node
2819 spin_lock_irq(&ndlp->lock);
2820 disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC);
2821 ndlp->nlp_flag &= ~(NLP_ADISC_SND | NLP_NPR_2B_DISC);
2822 spin_unlock_irq(&ndlp->lock);
2827 ndlp->nlp_DID, ulp_status, ulp_word4,
2831 spin_lock_irq(&ndlp->lock);
2832 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
2833 spin_unlock_irq(&ndlp->lock);
2842 spin_lock_irq(&ndlp->lock);
2843 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
2844 spin_unlock_irq(&ndlp->lock);
2852 ndlp->nlp_DID, ulp_status,
2854 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
2861 spin_lock_irq(&ndlp->lock);
2862 if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD))) {
2863 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
2864 if (!(ndlp->nlp_flag & NLP_IN_DEV_LOSS))
2867 spin_unlock_irq(&ndlp->lock);
2870 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
2874 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
2882 lpfc_nlp_put(ndlp);
2889 * @ndlp: pointer to a node-list data structure.
2892 * This routine issues an Address Discover (ADISC) for an @ndlp on a
2894 * and states of the ndlp, and invokes the lpfc_sli_issue_iocb() routine
2897 * Note that the ndlp reference count will be incremented by 1 for holding the
2898 * ndlp and the reference to ndlp will be stored into the ndlp field of
2906 lpfc_issue_els_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
2917 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
2918 ndlp->nlp_DID, ELS_CMD_ADISC);
2937 spin_lock_irq(&ndlp->lock);
2938 ndlp->nlp_flag |= NLP_ADISC_SND;
2939 spin_unlock_irq(&ndlp->lock);
2940 elsiocb->ndlp = lpfc_nlp_get(ndlp);
2941 if (!elsiocb->ndlp) {
2948 ndlp->nlp_DID, kref_read(&ndlp->kref), 0);
2953 lpfc_nlp_put(ndlp);
2960 spin_lock_irq(&ndlp->lock);
2961 ndlp->nlp_flag &= ~NLP_ADISC_SND;
2962 spin_unlock_irq(&ndlp->lock);
2974 * state machine of the associated ndlp shall be invoked for transition with
2981 struct lpfc_nodelist *ndlp = cmdiocb->ndlp;
2982 struct lpfc_vport *vport = ndlp->vport;
3004 spin_lock_irq(&ndlp->lock);
3005 ndlp->nlp_flag &= ~NLP_LOGO_SND;
3006 if (ndlp->save_flags & NLP_WAIT_FOR_LOGO) {
3008 ndlp->save_flags &= ~NLP_WAIT_FOR_LOGO;
3010 spin_unlock_irq(&ndlp->lock);
3015 ndlp->nlp_DID);
3021 ndlp->nlp_DID, kref_read(&ndlp->kref), ndlp->nlp_flag,
3040 ndlp->nlp_DID, ulp_status,
3048 lpfc_disc_state_machine(vport, ndlp, cmdiocb, NLP_EVT_CMPL_LOGO);
3056 if (ndlp->nlp_flag & NLP_TARGET_REMOVE) {
3057 spin_lock_irq(&ndlp->lock);
3059 ndlp->nlp_flag |= NLP_RELEASE_RPI;
3060 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
3061 spin_unlock_irq(&ndlp->lock);
3062 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
3074 if (wake_up_waiter && ndlp->logo_waitq)
3075 wake_up(ndlp->logo_waitq);
3081 if (ndlp->nlp_type & (NLP_FCP_TARGET | NLP_NVME_TARGET) &&
3083 lpfc_cancel_retry_delay_tmo(vport, ndlp);
3084 spin_lock_irqsave(&ndlp->lock, flags);
3085 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
3086 spin_unlock_irqrestore(&ndlp->lock, flags);
3091 ndlp->nlp_DID, ulp_status,
3096 lpfc_nlp_put(ndlp);
3107 if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD))) {
3108 spin_lock_irq(&ndlp->lock);
3109 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
3110 spin_unlock_irq(&ndlp->lock);
3111 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
3117 lpfc_nlp_put(ndlp);
3123 * @ndlp: pointer to a node-list data structure.
3127 * to a remote node, referred by an @ndlp on a @vport. It constructs the
3128 * payload of the IOCB, properly sets up the @ndlp state, and invokes the
3131 * Note that the ndlp reference count will be incremented by 1 for holding the
3132 * ndlp and the reference to ndlp will be stored into the ndlp field of
3142 lpfc_issue_els_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
3151 spin_lock_irq(&ndlp->lock);
3152 if (ndlp->nlp_flag & NLP_LOGO_SND) {
3153 spin_unlock_irq(&ndlp->lock);
3156 spin_unlock_irq(&ndlp->lock);
3159 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
3160 ndlp->nlp_DID, ELS_CMD_LOGO);
3175 spin_lock_irq(&ndlp->lock);
3176 ndlp->nlp_flag |= NLP_LOGO_SND;
3177 ndlp->nlp_flag &= ~NLP_ISSUE_LOGO;
3178 spin_unlock_irq(&ndlp->lock);
3179 elsiocb->ndlp = lpfc_nlp_get(ndlp);
3180 if (!elsiocb->ndlp) {
3187 ndlp->nlp_DID, kref_read(&ndlp->kref), 0);
3192 lpfc_nlp_put(ndlp);
3196 spin_lock_irq(&ndlp->lock);
3197 ndlp->nlp_prev_state = ndlp->nlp_state;
3198 spin_unlock_irq(&ndlp->lock);
3199 lpfc_nlp_set_state(vport, ndlp, NLP_STE_LOGO_ISSUE);
3203 spin_lock_irq(&ndlp->lock);
3204 ndlp->nlp_flag &= ~NLP_LOGO_SND;
3205 spin_unlock_irq(&ndlp->lock);
3258 free_ndlp = cmdiocb->ndlp;
3367 struct lpfc_nodelist *ndlp = cmdiocb->ndlp;
3465 lpfc_nlp_put(ndlp);
3476 * first search the @vport node list to find the matching ndlp. If no such
3477 * ndlp is found, a new ndlp shall be created for this (SCR) purpose. An
3481 * Note that the ndlp reference count will be incremented by 1 for holding the
3482 * ndlp and the reference to ndlp will be stored into the ndlp field of
3497 struct lpfc_nodelist *ndlp;
3501 ndlp = lpfc_findnode_did(vport, Fabric_Cntl_DID);
3502 if (!ndlp) {
3503 ndlp = lpfc_nlp_init(vport, Fabric_Cntl_DID);
3504 if (!ndlp)
3506 lpfc_enqueue_node(vport, ndlp);
3509 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
3510 ndlp->nlp_DID, ELS_CMD_SCR);
3515 rc = lpfc_reg_fab_ctrl_node(vport, ndlp);
3535 ndlp->nlp_DID, 0, 0);
3539 elsiocb->ndlp = lpfc_nlp_get(ndlp);
3540 if (!elsiocb->ndlp) {
3547 ndlp->nlp_DID, kref_read(&ndlp->kref), 0);
3552 lpfc_nlp_put(ndlp);
3570 * Note that the ndlp reference count will be incremented by 1 for holding the
3571 * ndlp and the reference to ndlp will be stored into the ndlp field of
3584 struct lpfc_nodelist *ndlp;
3599 ndlp = lpfc_findnode_mapped(vport);
3600 if (!ndlp)
3605 ndlp = lpfc_findnode_did(vport, nportid);
3606 if (!ndlp) {
3608 ndlp = lpfc_nlp_init(vport, nportid);
3609 if (!ndlp)
3611 lpfc_enqueue_node(vport, ndlp);
3615 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
3616 ndlp->nlp_DID, ELS_CMD_RSCN_XMT);
3636 elsiocb->ndlp = lpfc_nlp_get(ndlp);
3637 if (!elsiocb->ndlp) {
3644 ndlp->nlp_DID, 0, 0);
3649 lpfc_nlp_put(ndlp);
3665 * the matching ndlp. If no such ndlp is found, a new ndlp shall be created
3669 * Note that the ndlp reference count will be incremented by 1 for holding the
3670 * ndlp and the reference to ndlp will be stored into the ndlp field of
3688 struct lpfc_nodelist *ndlp;
3692 ndlp = lpfc_findnode_did(vport, nportid);
3693 if (!ndlp) {
3694 ndlp = lpfc_nlp_init(vport, nportid);
3695 if (!ndlp)
3697 lpfc_enqueue_node(vport, ndlp);
3700 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
3701 ndlp->nlp_DID, ELS_CMD_FARPR);
3731 ndlp->nlp_DID, 0, 0);
3735 elsiocb->ndlp = lpfc_nlp_get(ndlp);
3736 if (!elsiocb->ndlp) {
3748 lpfc_nlp_put(ndlp);
3766 * Note that the ndlp reference count will be incremented by 1 for holding the
3767 * ndlp and the reference to ndlp will be stored into the ndlp field of
3780 struct lpfc_nodelist *ndlp;
3786 ndlp = lpfc_findnode_did(vport, Fabric_Cntl_DID);
3787 if (!ndlp) {
3788 ndlp = lpfc_nlp_init(vport, Fabric_Cntl_DID);
3789 if (!ndlp)
3791 lpfc_enqueue_node(vport, ndlp);
3798 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
3799 ndlp->nlp_DID, ELS_CMD_RDF);
3820 ndlp->nlp_DID, phba->cgn_reg_signal,
3825 elsiocb->ndlp = lpfc_nlp_get(ndlp);
3826 if (!elsiocb->ndlp) {
3833 ndlp->nlp_DID, kref_read(&ndlp->kref), 0);
3838 lpfc_nlp_put(ndlp);
3848 * @ndlp: pointer to a node-list data structure.
3860 struct lpfc_nodelist *ndlp)
3863 if (lpfc_els_rsp_acc(vport, ELS_CMD_RDF, cmdiocb, ndlp, NULL)) {
3866 ndlp->nlp_DID, vport->fc_myDID);
3991 struct lpfc_nodelist *ndlp;
3994 ndlp = cmdiocb->ndlp;
4162 ndlp->nlp_DID, kref_read(&ndlp->kref), 0);
4164 lpfc_nlp_put(ndlp);
4278 struct lpfc_nodelist *ndlp;
4286 ndlp = lpfc_findnode_did(vport, Fabric_DID);
4287 if (!ndlp || ndlp->nlp_state != NLP_STE_UNMAPPED_NODE)
4301 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
4302 ndlp->nlp_DID, ELS_CMD_EDC);
4326 ndlp->nlp_DID, phba->cgn_reg_signal,
4330 elsiocb->ndlp = lpfc_nlp_get(ndlp);
4331 if (!elsiocb->ndlp) {
4338 ndlp->nlp_DID, kref_read(&ndlp->kref), 0);
4346 lpfc_nlp_put(ndlp);
4363 * a @vport's @ndlp. It stops the timer for the delayed function retrial and
4413 * lpfc_els_retry_delay - Timer function with a ndlp delayed function timer
4414 * @t: pointer to the timer function associated data (ndlp).
4416 * This routine is invoked by the ndlp delayed-function timer to check
4422 * the work list to hold reference count of ndlp so that it guarantees the
4423 * reference to ndlp will still be available when the worker thread gets
4424 * to the event associated with the ndlp.
4429 struct lpfc_nodelist *ndlp = from_timer(ndlp, t, nlp_delayfunc);
4430 struct lpfc_vport *vport = ndlp->vport;
4433 struct lpfc_work_evt *evtp = &ndlp->els_retry_evt;
4444 evtp->evt_arg1 = lpfc_nlp_get(ndlp);
4455 * lpfc_els_retry_delay_handler - Work thread handler for ndlp delayed function
4456 * @ndlp: pointer to a node-list data structure.
4458 * This routine is the worker-thread handler for processing the @ndlp delayed
4460 * the last ELS command from the associated ndlp and invokes the proper ELS
4464 lpfc_els_retry_delay_handler(struct lpfc_nodelist *ndlp)
4466 struct lpfc_vport *vport = ndlp->vport;
4469 spin_lock_irq(&ndlp->lock);
4470 cmd = ndlp->nlp_last_elscmd;
4471 ndlp->nlp_last_elscmd = 0;
4473 if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) {
4474 spin_unlock_irq(&ndlp->lock);
4478 ndlp->nlp_flag &= ~NLP_DELAY_TMO;
4479 spin_unlock_irq(&ndlp->lock);
4485 del_timer_sync(&ndlp->nlp_delayfunc);
4486 retry = ndlp->nlp_retry;
4487 ndlp->nlp_retry = 0;
4491 lpfc_issue_els_flogi(vport, ndlp, retry);
4494 if (!lpfc_issue_els_plogi(vport, ndlp->nlp_DID, retry)) {
4495 ndlp->nlp_prev_state = ndlp->nlp_state;
4496 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
4500 if (!lpfc_issue_els_adisc(vport, ndlp, retry)) {
4501 ndlp->nlp_prev_state = ndlp->nlp_state;
4502 lpfc_nlp_set_state(vport, ndlp, NLP_STE_ADISC_ISSUE);
4507 if (!lpfc_issue_els_prli(vport, ndlp, retry)) {
4508 ndlp->nlp_prev_state = ndlp->nlp_state;
4509 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PRLI_ISSUE);
4513 if (!lpfc_issue_els_logo(vport, ndlp, retry)) {
4514 ndlp->nlp_prev_state = ndlp->nlp_state;
4515 lpfc_nlp_set_state(vport, ndlp, NLP_STE_LOGO_ISSUE);
4520 lpfc_issue_els_fdisc(vport, ndlp, retry);
4596 * be posted to the ndlp delayed event and delayed function timer set to the
4597 * ndlp for the delayed command issusing.
4609 struct lpfc_nodelist *ndlp = cmdiocb->ndlp;
4631 if (ndlp)
4632 did = ndlp->nlp_DID;
4636 ndlp = lpfc_findnode_did(vport, did);
4637 if (!ndlp && (cmd != ELS_CMD_PLOGI))
4654 lpfc_set_rrq_active(phba, ndlp,
4699 ndlp->nlp_state != NLP_STE_PRLI_ISSUE) {
4728 if (ndlp &&
4729 ndlp->nlp_state != NLP_STE_PLOGI_ISSUE)
4998 if (ndlp && delay) {
5000 ndlp->nlp_retry = cmdiocb->retry;
5003 mod_timer(&ndlp->nlp_delayfunc,
5005 spin_lock_irq(&ndlp->lock);
5006 ndlp->nlp_flag |= NLP_DELAY_TMO;
5007 spin_unlock_irq(&ndlp->lock);
5009 ndlp->nlp_prev_state = ndlp->nlp_state;
5012 lpfc_nlp_set_state(vport, ndlp,
5015 lpfc_nlp_set_state(vport, ndlp,
5017 ndlp->nlp_last_elscmd = cmd;
5023 lpfc_issue_els_flogi(vport, ndlp, cmdiocb->retry);
5026 lpfc_issue_els_fdisc(vport, ndlp, cmdiocb->retry);
5029 if (ndlp) {
5030 ndlp->nlp_prev_state = ndlp->nlp_state;
5031 lpfc_nlp_set_state(vport, ndlp,
5037 ndlp->nlp_prev_state = ndlp->nlp_state;
5038 lpfc_nlp_set_state(vport, ndlp, NLP_STE_ADISC_ISSUE);
5039 lpfc_issue_els_adisc(vport, ndlp, cmdiocb->retry);
5043 ndlp->nlp_prev_state = ndlp->nlp_state;
5044 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PRLI_ISSUE);
5045 lpfc_issue_els_prli(vport, ndlp, cmdiocb->retry);
5048 ndlp->nlp_prev_state = ndlp->nlp_state;
5049 lpfc_nlp_set_state(vport, ndlp, NLP_STE_LOGO_ISSUE);
5050 lpfc_issue_els_logo(vport, ndlp, cmdiocb->retry);
5138 * It first properly decrements the reference count held on ndlp for the
5157 elsiocb->ndlp = NULL;
5218 struct lpfc_nodelist *ndlp = cmdiocb->ndlp;
5227 ulp_status, ulp_word4, ndlp->nlp_DID);
5232 ndlp->nlp_DID, kref_read(&ndlp->kref), ndlp->nlp_flag,
5233 ndlp->nlp_state, ndlp->nlp_rpi);
5240 if (ndlp->nlp_type & NLP_FABRIC &&
5241 ((ndlp->nlp_DID & WELL_KNOWN_DID_MASK) != WELL_KNOWN_DID_MASK))
5244 if (ndlp->nlp_state == NLP_STE_NPR_NODE) {
5249 if ((ndlp->nlp_flag & NLP_DELAY_TMO) &&
5250 (ndlp->nlp_last_elscmd == ELS_CMD_PLOGI))
5253 if (ndlp->nlp_flag & NLP_RPI_REGISTERED)
5254 lpfc_unreg_rpi(vport, ndlp);
5263 lpfc_nlp_put(ndlp);
5274 * decrements the ndlp reference count held for this completion callback
5281 struct lpfc_nodelist *ndlp = pmb->ctx_ndlp;
5285 if (ndlp) {
5286 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE,
5289 ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag,
5290 kref_read(&ndlp->kref), ndlp, mbx_cmd,
5294 * ndlp and the node and rpi needs to be released. Free the rpi
5298 spin_lock_irq(&ndlp->lock);
5299 ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND;
5301 ndlp->nlp_flag &= ~NLP_UNREG_INP;
5302 spin_unlock_irq(&ndlp->lock);
5303 lpfc_nlp_put(ndlp);
5304 lpfc_drop_node(ndlp->vport, ndlp);
5318 * nlp_flag bitmap in the ndlp data structure, if the mbox command reference
5327 struct lpfc_nodelist *ndlp = cmdiocb->ndlp;
5328 struct lpfc_vport *vport = ndlp ? ndlp->vport : NULL;
5356 if (!ndlp || lpfc_els_chk_latt(vport)) {
5370 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
5371 ndlp->nlp_rpi, kref_read(&ndlp->kref), mbox, ndlp);
5374 && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) {
5375 if (!lpfc_unreg_rpi(vport, ndlp) &&
5377 if (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE ||
5378 ndlp->nlp_state ==
5385 ndlp->nlp_DID,
5386 ndlp->nlp_state,
5387 ndlp->nlp_rpi,
5388 ndlp->nlp_flag);
5393 /* Increment reference count to ndlp to hold the
5394 * reference to ndlp for the callback function.
5396 mbox->ctx_ndlp = lpfc_nlp_get(ndlp);
5401 if (ndlp->nlp_flag & NLP_RM_DFLT_RPI) {
5407 ndlp->nlp_prev_state = ndlp->nlp_state;
5408 lpfc_nlp_set_state(vport, ndlp,
5412 ndlp->nlp_flag |= NLP_REG_LOGIN_SEND;
5417 /* Decrement the ndlp reference count we
5420 lpfc_nlp_put(ndlp);
5421 ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND;
5427 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
5428 ndlp->nlp_rpi);
5434 if (ndlp && shost) {
5435 spin_lock_irq(&ndlp->lock);
5437 ndlp->nlp_flag &= ~NLP_ACC_REGLOGIN;
5438 ndlp->nlp_flag &= ~NLP_RM_DFLT_RPI;
5439 spin_unlock_irq(&ndlp->lock);
5447 !(ndlp->fc4_xpt_flags & SCSI_XPT_REGD)) {
5448 if (ndlp->nlp_flag & NLP_RELEASE_RPI) {
5449 if (ndlp->nlp_state != NLP_STE_PLOGI_ISSUE &&
5450 ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE) {
5451 lpfc_sli4_free_rpi(phba, ndlp->nlp_rpi);
5452 spin_lock_irq(&ndlp->lock);
5453 ndlp->nlp_rpi = LPFC_RPI_ALLOC_ERROR;
5454 ndlp->nlp_flag &= ~NLP_RELEASE_RPI;
5455 spin_unlock_irq(&ndlp->lock);
5457 lpfc_drop_node(vport, ndlp);
5458 } else if (ndlp->nlp_state != NLP_STE_PLOGI_ISSUE &&
5459 ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE &&
5460 ndlp->nlp_state != NLP_STE_PRLI_ISSUE) {
5461 /* Drop ndlp if there is no planned or outstanding
5464 * In cases when the ndlp is acting as both an initiator
5466 * the final ndlp kref drop.
5468 lpfc_drop_node(vport, ndlp);
5474 lpfc_nlp_put(ndlp);
5483 * @ndlp: pointer to a node-list data structure.
5494 * Note that the ndlp reference count will be incremented by 1 for holding the
5495 * ndlp and the reference to ndlp will be stored into the ndlp field of
5505 struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp,
5525 ndlp, ndlp->nlp_DID, ELS_CMD_ACC);
5527 spin_lock_irq(&ndlp->lock);
5528 ndlp->nlp_flag &= ~NLP_LOGO_ACC;
5529 spin_unlock_irq(&ndlp->lock);
5558 ndlp->nlp_DID, ndlp->nlp_flag, 0);
5564 ndlp, ndlp->nlp_DID, ELS_CMD_ACC);
5637 ndlp->nlp_DID, ndlp->nlp_flag, 0);
5642 ndlp, ndlp->nlp_DID, ELS_CMD_PRLO);
5675 ndlp->nlp_DID, ndlp->nlp_flag, 0);
5680 ndlp, ndlp->nlp_DID, ELS_CMD_ACC);
5719 if (ndlp->nlp_flag & NLP_LOGO_ACC) {
5720 spin_lock_irq(&ndlp->lock);
5721 if (!(ndlp->nlp_flag & NLP_RPI_REGISTERED ||
5722 ndlp->nlp_flag & NLP_REG_LOGIN_SEND))
5723 ndlp->nlp_flag &= ~NLP_LOGO_ACC;
5724 spin_unlock_irq(&ndlp->lock);
5731 elsiocb->ndlp = lpfc_nlp_get(ndlp);
5732 if (!elsiocb->ndlp) {
5740 lpfc_nlp_put(ndlp);
5750 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
5751 ndlp->nlp_rpi, vport->fc_flag, kref_read(&ndlp->kref));
5760 * @ndlp: pointer to a node-list data structure.
5768 * Note that the ndlp reference count will be incremented by 1 for holding the
5769 * ndlp and the reference to ndlp will be stored into the ndlp field of
5779 struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp,
5792 elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, oldiocb->retry, ndlp,
5793 ndlp->nlp_DID, ELS_CMD_LS_RJT);
5825 get_job_ulpcontext(phba, elsiocb), ndlp->nlp_DID,
5826 ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi);
5829 ndlp->nlp_DID, ndlp->nlp_flag, rejectError);
5833 elsiocb->ndlp = lpfc_nlp_get(ndlp);
5834 if (!elsiocb->ndlp) {
5845 !(ndlp->fc4_xpt_flags & SCSI_XPT_REGD)) {
5846 spin_lock_irq(&ndlp->lock);
5847 ndlp->nlp_flag |= NLP_RELEASE_RPI;
5848 spin_unlock_irq(&ndlp->lock);
5854 lpfc_nlp_put(ndlp);
5865 * @ndlp: NPort to where rsp is directed
5877 struct lpfc_nodelist *ndlp)
5896 ndlp, ndlp->nlp_DID, ELS_CMD_ACC);
5932 ndlp->nlp_DID, ndlp->nlp_flag,
5933 kref_read(&ndlp->kref));
5937 elsiocb->ndlp = lpfc_nlp_get(ndlp);
5938 if (!elsiocb->ndlp) {
5946 lpfc_nlp_put(ndlp);
5956 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
5957 ndlp->nlp_rpi, vport->fc_flag);
5966 * @ndlp: pointer to a node-list data structure.
5972 * Note that the ndlp reference count will be incremented by 1 for holding the
5973 * ndlp and the reference to ndlp will be stored into the ndlp field of
5983 struct lpfc_nodelist *ndlp)
5996 elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, oldiocb->retry, ndlp,
5997 ndlp->nlp_DID, ELS_CMD_ACC);
6024 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
6025 ndlp->nlp_rpi);
6039 ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref));
6043 elsiocb->ndlp = lpfc_nlp_get(ndlp);
6044 if (!elsiocb->ndlp) {
6052 lpfc_nlp_put(ndlp);
6063 * @ndlp: pointer to a node-list data structure.
6069 * Note that the ndlp reference count will be incremented by 1 for holding the
6070 * ndlp and the reference to ndlp will be stored into the ndlp field of
6080 struct lpfc_nodelist *ndlp)
6120 elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, oldiocb->retry, ndlp,
6121 ndlp->nlp_DID, elsrspcmd);
6146 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
6147 ndlp->nlp_rpi);
6164 if ((ndlp->nlp_type & NLP_FCP_TARGET) &&
6173 if (ndlp->nlp_type & NLP_FCP_TARGET)
6218 npr_nvme->word5, ndlp->nlp_flag,
6219 ndlp->nlp_fcp_info, ndlp->nlp_type);
6225 "6128 Unknown FC_TYPE x%x x%x ndlp x%06x\n",
6226 prli_fc4_req, ndlp->nlp_fc4_type,
6227 ndlp->nlp_DID);
6231 ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref));
6235 elsiocb->ndlp = lpfc_nlp_get(ndlp);
6236 if (!elsiocb->ndlp) {
6244 lpfc_nlp_put(ndlp);
6256 * @ndlp: pointer to a node-list data structure.
6263 * Note that the ndlp reference count will be incremented by 1 for holding the
6264 * ndlp and the reference to ndlp will be stored into the ndlp field of
6273 struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp)
6290 elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, oldiocb->retry, ndlp,
6291 ndlp->nlp_DID, ELS_CMD_ACC);
6345 ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref));
6349 elsiocb->ndlp = lpfc_nlp_get(ndlp);
6350 if (!elsiocb->ndlp) {
6358 lpfc_nlp_put(ndlp);
6369 * @ndlp: pointer to a node-list data structure.
6375 struct lpfc_iocbq *iocb, struct lpfc_nodelist *ndlp)
6402 ndlp->nlp_DID, ndlp->nlp_flag, rrq->rrq_exchg);
6407 prrq = lpfc_get_active_rrq(vport, xri, ndlp->nlp_DID);
6418 * @ndlp: pointer to a node-list data structure.
6426 struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp)
6447 elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, oldiocb->retry, ndlp,
6448 ndlp->nlp_DID, ELS_CMD_ACC);
6479 ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref));
6483 elsiocb->ndlp = lpfc_nlp_get(ndlp);
6484 if (!elsiocb->ndlp) {
6492 lpfc_nlp_put(ndlp);
6522 struct lpfc_nodelist *ndlp, *next_ndlp;
6526 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
6528 if (ndlp->nlp_state != NLP_STE_NPR_NODE ||
6529 !(ndlp->nlp_flag & NLP_NPR_ADISC))
6532 spin_lock_irq(&ndlp->lock);
6533 ndlp->nlp_flag &= ~NLP_NPR_ADISC;
6534 spin_unlock_irq(&ndlp->lock);
6536 if (!(ndlp->nlp_flag & NLP_NPR_2B_DISC)) {
6544 lpfc_nlp_unreg_node(vport, ndlp);
6545 lpfc_unreg_rpi(vport, ndlp);
6549 ndlp->nlp_prev_state = ndlp->nlp_state;
6550 lpfc_nlp_set_state(vport, ndlp, NLP_STE_ADISC_ISSUE);
6551 lpfc_issue_els_adisc(vport, ndlp, 0);
6594 struct lpfc_nodelist *ndlp, *next_ndlp;
6598 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
6599 if (ndlp->nlp_state == NLP_STE_NPR_NODE &&
6600 (ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 &&
6601 (ndlp->nlp_flag & NLP_DELAY_TMO) == 0 &&
6602 (ndlp->nlp_flag & NLP_NPR_ADISC) == 0) {
6603 ndlp->nlp_prev_state = ndlp->nlp_state;
6604 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
6605 lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
7036 struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
7047 memcpy(desc->port_names.wwnn, &ndlp->nlp_nodename,
7050 memcpy(desc->port_names.wwpn, &ndlp->nlp_portname,
7062 struct lpfc_nodelist *ndlp = rdp_context->ndlp;
7063 struct lpfc_vport *vport = ndlp->vport;
7083 lpfc_max_els_tries, rdp_context->ndlp,
7084 rdp_context->ndlp->nlp_DID, ELS_CMD_ACC);
7106 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
7107 ndlp->nlp_rpi);
7133 (len + pcmd), vport, ndlp);
7166 elsiocb->ndlp = lpfc_nlp_get(ndlp);
7167 if (!elsiocb->ndlp) {
7175 lpfc_nlp_put(ndlp);
7183 ndlp, ndlp->nlp_DID, ELS_CMD_LS_RJT);
7209 elsiocb->ndlp = lpfc_nlp_get(ndlp);
7210 if (!elsiocb->ndlp) {
7218 lpfc_nlp_put(ndlp);
7225 lpfc_nlp_put(ndlp);
7244 mbox->vport = rdp_context->ndlp->vport;
7392 * @ndlp: pointer to a node-list data structure.
7407 struct lpfc_nodelist *ndlp)
7457 rdp_context->ndlp = lpfc_nlp_get(ndlp);
7458 if (!rdp_context->ndlp) {
7469 lpfc_printf_vlog(ndlp->vport, KERN_WARNING, LOG_ELS,
7473 lpfc_nlp_put(ndlp);
7486 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, NULL);
7499 struct lpfc_nodelist *ndlp;
7509 ndlp = lcb_context->ndlp;
7534 lpfc_max_els_tries, ndlp,
7535 ndlp->nlp_DID, ELS_CMD_ACC);
7537 /* Decrement the ndlp reference count from previous mbox command */
7538 lpfc_nlp_put(ndlp);
7568 elsiocb->ndlp = lpfc_nlp_get(ndlp);
7569 if (!elsiocb->ndlp) {
7577 lpfc_nlp_put(ndlp);
7586 lpfc_max_els_tries, ndlp,
7587 ndlp->nlp_DID, ELS_CMD_LS_RJT);
7588 lpfc_nlp_put(ndlp);
7614 elsiocb->ndlp = lpfc_nlp_get(ndlp);
7615 if (!elsiocb->ndlp) {
7623 lpfc_nlp_put(ndlp);
7705 * @ndlp: pointer to a node-list data structure.
7717 struct lpfc_nodelist *ndlp)
7769 lcb_context->ndlp = lpfc_nlp_get(ndlp);
7770 if (!lcb_context->ndlp) {
7776 lpfc_printf_vlog(ndlp->vport, KERN_ERR, LOG_TRACE_EVENT,
7778 lpfc_nlp_put(ndlp);
7789 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, NULL);
7924 struct lpfc_nodelist *ndlp = NULL, *n;
7927 list_for_each_entry_safe(ndlp, n, &vport->fc_nodes, nlp_listp) {
7928 if ((ndlp->nlp_state == NLP_STE_UNUSED_NODE) ||
7929 !lpfc_rscn_payload_check(vport, ndlp->nlp_DID))
7939 switch (ndlp->nlp_state) {
7948 lpfc_disc_state_machine(vport, ndlp, NULL,
7950 lpfc_cancel_retry_delay_tmo(vport, ndlp);
8002 * @ndlp: pointer to a node-list data structure.
8022 struct lpfc_nodelist *ndlp)
8057 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
8062 if (ndlp->nlp_fc4_type & NLP_FC4_NVME &&
8063 ndlp->nlp_type & (NLP_NVME_TARGET | NLP_NVME_DISCOVERY))
8064 lpfc_nvme_rescan_port(vport, ndlp);
8074 ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag);
8076 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
8104 ndlp->nlp_DID, vport->port_state,
8105 ndlp->nlp_flag);
8108 ndlp, NULL);
8126 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
8140 ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag);
8192 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
8199 ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag);
8214 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
8225 * (RSCN) for a @vport. If login to NameServer does not exist, a new ndlp shall
8227 * if the ndlp to NameServer exists, a Common Transport (CT) command to the
8239 struct lpfc_nodelist *ndlp;
8262 ndlp = lpfc_findnode_did(vport, NameServer_DID);
8263 if (ndlp && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) {
8264 /* Good ndlp, issue CT Request to NameServer. Need to
8280 if (ndlp) {
8281 ndlp->nlp_prev_state = NLP_STE_UNUSED_NODE;
8282 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
8284 ndlp = lpfc_nlp_init(vport, NameServer_DID);
8285 if (!ndlp) {
8289 ndlp->nlp_prev_state = ndlp->nlp_state;
8290 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
8292 ndlp->nlp_type |= NLP_FABRIC;
8308 * @ndlp: pointer to a node-list data structure.
8331 struct lpfc_nodelist *ndlp)
8368 (void) lpfc_check_sparm(vport, ndlp, sp, CLASS3, 1);
8478 lpfc_els_rsp_acc(vport, ELS_CMD_FLOGI, cmdiocb, ndlp, NULL);
8490 * @ndlp: pointer to a node-list data structure.
8504 struct lpfc_nodelist *ndlp)
8523 lpfc_els_rsp_rnid_acc(vport, rn->Format, cmdiocb, ndlp);
8531 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp,
8541 * @ndlp: pointer to a node-list data structure.
8548 struct lpfc_nodelist *ndlp)
8557 lpfc_els_rsp_echo_acc(vport, pcmd, cmdiocb, ndlp);
8565 * @ndlp: pointer to a node-list data structure.
8576 struct lpfc_nodelist *ndlp)
8585 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, NULL);
8593 * @ndlp: pointer to a node-list data structure.
8607 struct lpfc_nodelist *ndlp)
8609 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
8611 lpfc_els_clear_rrq(vport, cmdiocb, ndlp);
8627 * Note that the ndlp reference count will be incremented by 1 for holding the
8628 * ndlp and the reference to ndlp will be stored into the ndlp field of
8643 struct lpfc_nodelist *ndlp;
8651 ndlp = pmb->ctx_ndlp;
8664 lpfc_max_els_tries, ndlp,
8665 ndlp->nlp_DID, ELS_CMD_ACC);
8667 /* Decrement the ndlp reference count from previous mbox command */
8668 lpfc_nlp_put(ndlp);
8700 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_ELS,
8704 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
8705 ndlp->nlp_rpi);
8708 elsiocb->ndlp = lpfc_nlp_get(ndlp);
8709 if (!elsiocb->ndlp) {
8717 lpfc_nlp_put(ndlp);
8726 * @ndlp: pointer to a node-list data structure.
8742 struct lpfc_nodelist *ndlp)
8750 if ((ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) &&
8751 (ndlp->nlp_state != NLP_STE_MAPPED_NODE))
8760 mbox->ctx_ndlp = lpfc_nlp_get(ndlp);
8772 lpfc_nlp_put(ndlp);
8782 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, NULL);
8790 * @ndlp: pointer to a node-list data structure.
8799 * Note that the ndlp reference count will be incremented by 1 for holding the
8800 * ndlp and the reference to ndlp will be stored into the ndlp field of
8809 struct lpfc_nodelist *ndlp)
8822 if ((ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) &&
8823 (ndlp->nlp_state != NLP_STE_MAPPED_NODE))
8829 lpfc_max_els_tries, ndlp,
8830 ndlp->nlp_DID, ELS_CMD_ACC);
8863 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_ELS,
8868 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
8869 ndlp->nlp_rpi,
8873 elsiocb->ndlp = lpfc_nlp_get(ndlp);
8874 if (!elsiocb->ndlp) {
8882 lpfc_nlp_put(ndlp);
8892 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, NULL);
8898 * @ndlp: pointer to a node-list data structure.
8910 lpfc_issue_els_rrq(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
8920 if (!ndlp)
8923 /* If ndlp is not NULL, we will bump the reference count on it */
8925 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, 0, ndlp, did,
8950 elsiocb->ndlp = lpfc_nlp_get(ndlp);
8951 if (!elsiocb->ndlp)
8956 lpfc_nlp_put(ndlp);
8981 struct lpfc_nodelist *ndlp = lpfc_findnode_did(rrq->vport,
8983 if (!ndlp)
8986 if (lpfc_test_rrq_active(phba, ndlp, rrq->xritag))
8987 return lpfc_issue_els_rrq(rrq->vport, ndlp,
8998 * @ndlp: pointer to a node-list data structure.
9003 * Note that the ndlp reference count will be incremented by 1 for holding the
9004 * ndlp and the reference to ndlp will be stored into the ndlp field of
9014 struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp)
9025 elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, oldiocb->retry, ndlp,
9026 ndlp->nlp_DID, ELS_CMD_ACC);
9065 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
9066 ndlp->nlp_rpi);
9069 elsiocb->ndlp = lpfc_nlp_get(ndlp);
9070 if (!elsiocb->ndlp) {
9078 lpfc_nlp_put(ndlp);
9089 * @ndlp: pointer to a node-list data structure.
9103 struct lpfc_nodelist *ndlp)
9112 if ((ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) &&
9113 (ndlp->nlp_state != NLP_STE_MAPPED_NODE)) {
9119 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp,
9138 lpfc_els_rsp_rpl_acc(vport, cmdsize, cmdiocb, ndlp);
9147 * @ndlp: pointer to a node-list data structure.
9169 struct lpfc_nodelist *ndlp)
9206 if ((ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) ||
9207 (ndlp->nlp_state == NLP_STE_MAPPED_NODE)) {
9210 ndlp->nlp_prev_state = ndlp->nlp_state;
9211 lpfc_nlp_set_state(vport, ndlp,
9213 lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
9228 * @ndlp: pointer to a node-list data structure.
9240 struct lpfc_nodelist *ndlp)
9250 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
9314 * @ndlp: pointer to a node-list data structure.
9321 struct lpfc_nodelist *ndlp)
9436 lpfc_issue_els_edc_rsp(vport, cmdiocb, ndlp);
9551 struct lpfc_nodelist *ndlp;
9552 ndlp = __lpfc_findnode_rpi(vport, ulp_context);
9553 if (ndlp)
9554 remote_ID = ndlp->nlp_DID;
9792 struct lpfc_nodelist *ndlp;
9796 ndlp = cmdiocbp->ndlp;
9797 if (!ndlp)
9806 memcpy(lsrjt_event.header.wwpn, &ndlp->nlp_portname,
9808 memcpy(lsrjt_event.header.wwnn, &ndlp->nlp_nodename,
9829 memcpy(fabric_event.wwpn, &ndlp->nlp_portname,
9831 memcpy(fabric_event.wwnn, &ndlp->nlp_nodename,
9846 * @ndlp: Pointer FC node object.
9854 struct lpfc_nodelist *ndlp,
9901 memcpy(els_data->wwpn, &ndlp->nlp_portname, sizeof(struct lpfc_name));
9902 memcpy(els_data->wwnn, &ndlp->nlp_nodename, sizeof(struct lpfc_name));
10328 * event. It first determines whether there is an existing ndlp that matches
10338 struct lpfc_nodelist *ndlp;
10382 ndlp = lpfc_findnode_did(vport, did);
10383 if (!ndlp) {
10384 /* Cannot find existing Fabric ndlp, so allocate a new one */
10385 ndlp = lpfc_nlp_init(vport, did);
10386 if (!ndlp)
10388 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
10391 ndlp->nlp_type |= NLP_FABRIC;
10392 } else if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) {
10393 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
10401 * if the ndlp is in DEV_LOSS
10403 spin_lock_irq(&ndlp->lock);
10404 if (ndlp->nlp_flag & NLP_IN_DEV_LOSS) {
10405 spin_unlock_irq(&ndlp->lock);
10407 lpfc_nlp_put(ndlp);
10410 spin_unlock_irq(&ndlp->lock);
10412 elsiocb->ndlp = lpfc_nlp_get(ndlp);
10413 if (!elsiocb->ndlp)
10424 cmd, did, kref_read(&ndlp->kref), vport->port_state,
10440 did, vport->port_state, ndlp->nlp_flag);
10443 ndlp = lpfc_plogi_confirm_nport(phba, payload, ndlp);
10460 lpfc_send_els_event(vport, ndlp, payload);
10478 spin_lock_irq(&ndlp->lock);
10479 ndlp->nlp_flag &= ~NLP_TARGET_REMOVE;
10480 spin_unlock_irq(&ndlp->lock);
10482 lpfc_disc_state_machine(vport, ndlp, elsiocb,
10489 did, vport->port_state, ndlp->nlp_flag);
10505 lpfc_els_rcv_flogi(vport, elsiocb, ndlp);
10510 lpfc_disc_state_machine(vport, ndlp, NULL,
10516 did, vport->port_state, ndlp->nlp_flag);
10519 lpfc_send_els_event(vport, ndlp, payload);
10525 lpfc_disc_state_machine(vport, ndlp, elsiocb, NLP_EVT_RCV_LOGO);
10527 lpfc_disc_state_machine(vport, ndlp, NULL,
10533 did, vport->port_state, ndlp->nlp_flag);
10536 lpfc_send_els_event(vport, ndlp, payload);
10542 lpfc_disc_state_machine(vport, ndlp, elsiocb, NLP_EVT_RCV_PRLO);
10546 lpfc_els_rcv_lcb(vport, elsiocb, ndlp);
10550 lpfc_els_rcv_rdp(vport, elsiocb, ndlp);
10554 lpfc_els_rcv_rscn(vport, elsiocb, ndlp);
10556 lpfc_disc_state_machine(vport, ndlp, NULL,
10562 did, vport->port_state, ndlp->nlp_flag);
10564 lpfc_send_els_event(vport, ndlp, payload);
10571 lpfc_disc_state_machine(vport, ndlp, elsiocb,
10577 did, vport->port_state, ndlp->nlp_flag);
10585 lpfc_disc_state_machine(vport, ndlp, elsiocb,
10591 did, vport->port_state, ndlp->nlp_flag);
10594 lpfc_els_rcv_farpr(vport, elsiocb, ndlp);
10599 did, vport->port_state, ndlp->nlp_flag);
10602 lpfc_els_rcv_farp(vport, elsiocb, ndlp);
10607 did, vport->port_state, ndlp->nlp_flag);
10610 lpfc_els_rcv_fan(vport, elsiocb, ndlp);
10616 did, vport->port_state, ndlp->nlp_flag);
10625 lpfc_disc_state_machine(vport, ndlp, elsiocb, NLP_EVT_RCV_PRLI);
10630 did, vport->port_state, ndlp->nlp_flag);
10633 lpfc_els_rcv_lirr(vport, elsiocb, ndlp);
10635 lpfc_disc_state_machine(vport, ndlp, NULL,
10641 did, vport->port_state, ndlp->nlp_flag);
10644 lpfc_els_rcv_rls(vport, elsiocb, ndlp);
10646 lpfc_disc_state_machine(vport, ndlp, NULL,
10652 did, vport->port_state, ndlp->nlp_flag);
10655 lpfc_els_rcv_rpl(vport, elsiocb, ndlp);
10657 lpfc_disc_state_machine(vport, ndlp, NULL,
10663 did, vport->port_state, ndlp->nlp_flag);
10666 lpfc_els_rcv_rnid(vport, elsiocb, ndlp);
10668 lpfc_disc_state_machine(vport, ndlp, NULL,
10674 did, vport->port_state, ndlp->nlp_flag);
10676 lpfc_els_rcv_rtv(vport, elsiocb, ndlp);
10678 lpfc_disc_state_machine(vport, ndlp, NULL,
10684 did, vport->port_state, ndlp->nlp_flag);
10687 lpfc_els_rcv_rrq(vport, elsiocb, ndlp);
10689 lpfc_disc_state_machine(vport, ndlp, NULL,
10695 did, vport->port_state, ndlp->nlp_flag);
10698 lpfc_els_rcv_echo(vport, elsiocb, ndlp);
10700 lpfc_disc_state_machine(vport, ndlp, NULL,
10711 did, vport->port_state, ndlp->nlp_flag);
10719 lpfc_els_rcv_edc(vport, elsiocb, ndlp);
10733 lpfc_els_rcv_rdf(vport, elsiocb, ndlp);
10749 lpfc_disc_state_machine(vport, ndlp, NULL,
10760 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, elsiocb, ndlp,
10764 lpfc_disc_state_machine(vport, ndlp, NULL,
10768 /* Release the reference on this elsiocb, not the ndlp. */
10769 lpfc_nlp_put(elsiocb->ndlp);
10770 elsiocb->ndlp = NULL;
10912 struct lpfc_nodelist *ndlp;
10914 /* If this is the first time, allocate an ndlp and initialize
10918 ndlp = lpfc_findnode_did(vport, FDMI_DID);
10919 if (!ndlp) {
10920 ndlp = lpfc_nlp_init(vport, FDMI_DID);
10921 if (ndlp) {
10922 ndlp->nlp_type |= NLP_FABRIC;
10928 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
10929 lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
10939 * ndlp for the Name Server associated to the @vport if such node does
10948 struct lpfc_nodelist *ndlp;
10968 ndlp = lpfc_findnode_did(vport, NameServer_DID);
10969 if (!ndlp) {
10970 ndlp = lpfc_nlp_init(vport, NameServer_DID);
10971 if (!ndlp) {
10983 ndlp->nlp_type |= NLP_FABRIC;
10985 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
10987 if (lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0)) {
11017 struct lpfc_nodelist *ndlp = pmb->ctx_ndlp;
11061 lpfc_nlp_put(ndlp);
11107 /* Now, we decrement the ndlp reference count held for this
11110 lpfc_nlp_put(ndlp);
11128 * @ndlp: pointer to a node-list data structure.
11135 struct lpfc_nodelist *ndlp)
11144 mbox->ctx_ndlp = lpfc_nlp_get(ndlp);
11153 /* mailbox command not success, decrement ndlp
11156 lpfc_nlp_put(ndlp);
11188 struct lpfc_nodelist *ndlp;
11201 ndlp = lpfc_findnode_did(vports[i], Fabric_DID);
11202 if (ndlp)
11203 lpfc_cancel_retry_delay_tmo(vports[i], ndlp);
11221 struct lpfc_nodelist *ndlp;
11227 ndlp = lpfc_findnode_did(phba->pport, Fabric_DID);
11228 if (!ndlp)
11231 mod_timer(&ndlp->nlp_delayfunc, jiffies + msecs_to_jiffies(1000));
11232 spin_lock_irq(&ndlp->lock);
11233 ndlp->nlp_flag |= NLP_DELAY_TMO;
11234 spin_unlock_irq(&ndlp->lock);
11235 ndlp->nlp_last_elscmd = ELS_CMD_FLOGI;
11290 struct lpfc_nodelist *ndlp = cmdiocb->ndlp;
11335 lpfc_check_nlp_post_devloss(vport, ndlp);
11367 spin_lock_irq(&ndlp->lock);
11369 spin_unlock_irq(&ndlp->lock);
11391 lpfc_register_new_vport(phba, vport, ndlp);
11392 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
11399 lpfc_register_new_vport(phba, vport, ndlp);
11403 /* The FDISC completed successfully. Move the fabric ndlp to
11406 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
11417 lpfc_nlp_put(ndlp);
11423 * @ndlp: pointer to a node-list data structure.
11427 * a remote node (@ndlp) off a @vport. It uses the lpfc_issue_fabric_iocb()
11431 * Note that the ndlp reference count will be incremented by 1 for holding the
11432 * ndlp and the reference to ndlp will be stored into the ndlp field of
11440 lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
11450 int did = ndlp->nlp_DID;
11456 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp, did,
11509 elsiocb->ndlp = lpfc_nlp_get(ndlp);
11510 if (!elsiocb->ndlp)
11515 lpfc_nlp_put(ndlp);
11538 * reference count held on ndlp for this completion function, indicating that
11539 * the reference to the ndlp is no long needed. Note that the
11540 * lpfc_els_free_iocb() routine decrements the ndlp reference held for this
11541 * callback function and an additional explicit ndlp reference decrementation
11542 * will trigger the actual release of the ndlp.
11550 struct lpfc_nodelist *ndlp;
11554 ndlp = cmdiocb->ndlp;
11576 ndlp->nlp_DID, ulp_status, ulp_word4,
11578 kref_read(&ndlp->kref), ndlp->nlp_flag,
11579 ndlp->fc4_xpt_flags);
11589 if (ndlp->save_flags & NLP_WAIT_FOR_LOGO) {
11591 if (ndlp->logo_waitq)
11592 wake_up(ndlp->logo_waitq);
11593 spin_lock_irq(&ndlp->lock);
11594 ndlp->nlp_flag &= ~(NLP_ISSUE_LOGO | NLP_LOGO_SND);
11595 ndlp->save_flags &= ~NLP_WAIT_FOR_LOGO;
11596 spin_unlock_irq(&ndlp->lock);
11601 lpfc_nlp_put(ndlp);
11607 * @ndlp: pointer to a node-list data structure.
11609 * This routine issues a LOGO ELS command to an @ndlp off a @vport.
11611 * Note that the ndlp reference count will be incremented by 1 for holding the
11612 * ndlp and the reference to ndlp will be stored into the ndlp field of
11620 lpfc_issue_els_npiv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
11629 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, 0, ndlp, ndlp->nlp_DID,
11645 ndlp->nlp_DID, ndlp->nlp_flag, 0);
11648 spin_lock_irq(&ndlp->lock);
11649 ndlp->nlp_flag |= NLP_LOGO_SND;
11650 spin_unlock_irq(&ndlp->lock);
11651 elsiocb->ndlp = lpfc_nlp_get(ndlp);
11652 if (!elsiocb->ndlp) {
11660 lpfc_nlp_put(ndlp);
11666 spin_lock_irq(&ndlp->lock);
11667 ndlp->nlp_flag &= ~NLP_LOGO_SND;
11668 spin_unlock_irq(&ndlp->lock);
11955 * lpfc_fabric_abort_nport - Abort a ndlp's iocbs from driver fabric iocb list
11956 * @ndlp: pointer to a node-list data structure.
11958 * This routine aborts all the IOCBs associated with an @ndlp from the
11961 * list, removes each IOCB associated with the @ndlp off the list, set the
11965 void lpfc_fabric_abort_nport(struct lpfc_nodelist *ndlp)
11968 struct lpfc_hba *phba = ndlp->phba;
11980 if ((lpfc_check_sli_ndlp(phba, pring, piocb, ndlp))) {
12017 * lpfc_sli4_vport_delete_els_xri_aborted -Remove all ndlp references for vport
12021 * for an ndlp on removal.
12028 struct lpfc_nodelist *ndlp = NULL;
12034 if (sglq_entry->ndlp && sglq_entry->ndlp->vport == vport) {
12035 lpfc_nlp_put(sglq_entry->ndlp);
12036 ndlp = sglq_entry->ndlp;
12037 sglq_entry->ndlp = NULL;
12044 ndlp->nlp_DID == Fabric_DID) {
12074 struct lpfc_nodelist *ndlp;
12084 ndlp = sglq_entry->ndlp;
12085 sglq_entry->ndlp = NULL;
12092 if (ndlp) {
12093 lpfc_set_rrq_active(phba, ndlp,
12096 lpfc_nlp_put(ndlp);
12123 * @ndlp: nodelist pointer for the impacted node.
12132 struct lpfc_nodelist *ndlp)
12140 if (ndlp->nlp_state != NLP_STE_MAPPED_NODE) {
12143 "rport in state 0x%x\n", ndlp->nlp_state);
12150 shost->host_no, ndlp->nlp_DID,
12151 vport->vpi, ndlp->nlp_rpi, ndlp->nlp_state,
12152 ndlp->nlp_flag);
12157 spin_lock_irqsave(&ndlp->lock, flags);
12158 ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
12159 ndlp->nlp_flag |= NLP_ISSUE_LOGO;
12160 spin_unlock_irqrestore(&ndlp->lock, flags);
12161 lpfc_unreg_rpi(vport, ndlp);
12216 struct lpfc_nodelist *ndlp = cmdiocb->ndlp;
12292 lpfc_nlp_put(ndlp);
12298 struct lpfc_nodelist *ndlp;
12303 ndlp = lpfc_findnode_did(phba->pport, Fabric_DID);
12304 if (!ndlp || ndlp->nlp_state != NLP_STE_UNMAPPED_NODE)
12307 elsiocb = lpfc_prep_els_iocb(vport, 1, LPFC_QFPA_SIZE, 2, ndlp,
12308 ndlp->nlp_DID, ELS_CMD_QFPA);
12319 elsiocb->ndlp = lpfc_nlp_get(ndlp);
12320 if (!elsiocb->ndlp) {
12328 lpfc_nlp_put(ndlp);
12340 struct lpfc_nodelist *ndlp;
12348 ndlp = lpfc_findnode_did(vport, Fabric_DID);
12349 if (!ndlp || ndlp->nlp_state != NLP_STE_UNMAPPED_NODE)
12356 ndlp, Fabric_DID, ELS_CMD_UVEM);
12364 vmid_context->nlp = ndlp;
12403 elsiocb->ndlp = lpfc_nlp_get(ndlp);
12404 if (!elsiocb->ndlp) {
12412 lpfc_nlp_put(ndlp);
12430 struct lpfc_nodelist *ndlp = icmdiocb->ndlp;
12439 if (!ndlp || ndlp->nlp_state != NLP_STE_UNMAPPED_NODE)
12440 ndlp = NULL;
12474 lpfc_nlp_put(ndlp);