Lines Matching refs:ndlp

55 				struct lpfc_nodelist *ndlp, uint8_t retry);
130 * @ndlp: pointer to a node-list data structure.
144 * ndlp is incremented by 1 and the reference to the ndlp is put into
145 * context1 of the IOCB data structure for this IOCB to hold the ndlp
155 struct lpfc_nodelist *ndlp, uint32_t did,
303 /* prevent preparing iocb with NULL ndlp reference */
304 elsiocb->context1 = lpfc_nlp_get(ndlp);
323 vport->port_state, ndlp->nlp_rpi,
331 elscmd, ndlp->nlp_DID, elsiocb->iotag,
333 ndlp->nlp_rpi, vport->fc_flag);
357 * active ndlp node with Fabric_DID must already exist for this @vport.
374 struct lpfc_nodelist *ndlp;
380 ndlp = lpfc_findnode_did(vport, Fabric_DID);
381 if (!ndlp || !NLP_CHK_NODE_ACT(ndlp)) {
409 ndlp->nlp_rpi);
417 /* increment the reference count on ndlp to hold reference
420 mbox->ctx_ndlp = lpfc_nlp_get(ndlp);
431 /* decrement the reference count on ndlp just incremented
434 lpfc_nlp_put(ndlp);
465 struct lpfc_nodelist *ndlp;
473 ndlp = lpfc_findnode_did(vport, Fabric_DID);
474 if (!ndlp || !NLP_CHK_NODE_ACT(ndlp)) {
640 * @ndlp: pointer to a node-list data structure.
646 * port in a fabric topology. It properly sets up the parameters to the @ndlp
658 lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
685 memcpy(&ndlp->nlp_portname, &sp->portName, sizeof(struct lpfc_name));
686 memcpy(&ndlp->nlp_nodename, &sp->nodeName, sizeof(struct lpfc_name));
687 ndlp->nlp_class_sup = 0;
689 ndlp->nlp_class_sup |= FC_COS_CLASS1;
691 ndlp->nlp_class_sup |= FC_COS_CLASS2;
693 ndlp->nlp_class_sup |= FC_COS_CLASS3;
695 ndlp->nlp_class_sup |= FC_COS_CLASS4;
696 ndlp->nlp_maxframe = ((sp->cmn.bbRcvSizeMsb & 0x0F) << 8) |
801 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
802 lpfc_register_new_vport(phba, vport, ndlp);
807 lpfc_nlp_set_state(vport, ndlp, NLP_STE_REG_LOGIN_ISSUE);
810 lpfc_register_new_vport(phba, vport, ndlp);
814 ndlp->nlp_type |= NLP_FABRIC;
815 lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
835 * @ndlp: pointer to a node-list data structure.
853 lpfc_cmpl_els_flogi_nport(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
897 /* Decrement ndlp reference count indicating that ndlp can be
900 lpfc_nlp_put(ndlp);
902 ndlp = lpfc_findnode_did(vport, PT2PT_RemoteID);
903 if (!ndlp) {
905 * Cannot find existing Fabric ndlp, so allocate a
908 ndlp = lpfc_nlp_init(vport, PT2PT_RemoteID);
909 if (!ndlp)
911 } else if (!NLP_CHK_NODE_ACT(ndlp)) {
912 ndlp = lpfc_enable_node(vport, ndlp,
914 if(!ndlp)
918 memcpy(&ndlp->nlp_portname, &sp->portName,
920 memcpy(&ndlp->nlp_nodename, &sp->nodeName,
922 /* Set state will put ndlp onto node list if not already done */
923 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
925 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
942 /* This side will wait for the PLOGI, decrement ndlp reference
943 * count indicating that ndlp can be released when other
946 lpfc_nlp_put(ndlp);
969 * number of retries), one additional decrement of ndlp reference shall be
972 * invoke one decrement of ndlp reference count). If no error reported in
987 struct lpfc_nodelist *ndlp = cmdiocb->context1;
998 lpfc_nlp_put(ndlp);
1099 lpfc_nlp_put(ndlp);
1133 rc = lpfc_cmpl_els_flogi_fabric(vport, ndlp, sp, irsp);
1135 rc = lpfc_cmpl_els_flogi_nport(vport, ndlp, sp);
1160 lpfc_nlp_put(ndlp);
1199 lpfc_nlp_put(ndlp);
1256 * @ndlp: pointer to a node-list data structure.
1266 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
1267 * will be incremented by 1 for holding the ndlp and the reference to ndlp
1276 lpfc_issue_els_flogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
1290 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
1291 ndlp->nlp_DID, ELS_CMD_FLOGI);
1380 ndlp, NULL);
1401 * contains a active Fabric_DID ndlp. Note that this function is to issue
1413 struct lpfc_nodelist *ndlp;
1433 ndlp = (struct lpfc_nodelist *)(iocb->context1);
1434 if (ndlp && NLP_CHK_NODE_ACT(ndlp) &&
1435 (ndlp->nlp_DID == Fabric_DID))
1449 * specified. It first searches the ndlp with the Fabric_DID (0xfffffe) from
1450 * the @vport's ndlp list. If no such ndlp found, it will create an ndlp and
1451 * put it into the @vport's ndlp list. If an inactive ndlp found on the list,
1453 * is then invoked with the @vport and the ndlp to perform the FLOGI for the
1463 struct lpfc_nodelist *ndlp;
1468 /* First look for the Fabric ndlp */
1469 ndlp = lpfc_findnode_did(vport, Fabric_DID);
1470 if (!ndlp) {
1471 /* Cannot find existing Fabric ndlp, so allocate a new one */
1472 ndlp = lpfc_nlp_init(vport, Fabric_DID);
1473 if (!ndlp)
1476 ndlp->nlp_type |= NLP_FABRIC;
1477 /* Put ndlp onto node list */
1478 lpfc_enqueue_node(vport, ndlp);
1479 } else if (!NLP_CHK_NODE_ACT(ndlp)) {
1480 /* re-setup ndlp without removing from node list */
1481 ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_UNUSED_NODE);
1482 if (!ndlp)
1486 if (lpfc_issue_els_flogi(vport, ndlp, 0)) {
1490 lpfc_nlp_put(ndlp);
1501 * specified. It first searches the ndlp with the Fabric_DID (0xfffffe) from
1502 * the @vport's ndlp list. If no such ndlp found, it will create an ndlp and
1503 * put it into the @vport's ndlp list. If an inactive ndlp found on the list,
1505 * is then invoked with the @vport and the ndlp to perform the FDISC for the
1515 struct lpfc_nodelist *ndlp;
1517 /* First look for the Fabric ndlp */
1518 ndlp = lpfc_findnode_did(vport, Fabric_DID);
1519 if (!ndlp) {
1520 /* Cannot find existing Fabric ndlp, so allocate a new one */
1521 ndlp = lpfc_nlp_init(vport, Fabric_DID);
1522 if (!ndlp)
1524 /* Put ndlp onto node list */
1525 lpfc_enqueue_node(vport, ndlp);
1526 } else if (!NLP_CHK_NODE_ACT(ndlp)) {
1527 /* re-setup ndlp without removing from node list */
1528 ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_UNUSED_NODE);
1529 if (!ndlp)
1533 if (lpfc_issue_els_fdisc(vport, ndlp, 0)) {
1537 lpfc_nlp_put(ndlp);
1575 * lpfc_plogi_confirm_nport - Confirm pologi wwpn matches stored ndlp
1578 * @ndlp: pointer to a node-list data structure.
1581 * from a PLOGI, matches the WWPN that is stored in the @ndlp for that N_POrt.
1583 * 1) The N_Port is a Fabric ndlp; 2) The @ndlp is on vport list and matches
1584 * the WWPN of the N_Port logged into; 3) The @ndlp is not on vport list but
1586 * pointer to the @ndlp will be returned. If the WWPN is not confirmed:
1587 * 1) if there is a node on vport list other than the @ndlp with the same
1592 * parameters of the @ndlp shall be copied to the new_ndlp, the @ndlp shall
1596 * Note that before the @ndlp got "released", the keepDID from not-matching
1598 * of the @ndlp. This is because the release of @ndlp is actually to put it
1603 * pointer to the PLOGI N_Port @ndlp
1607 struct lpfc_nodelist *ndlp)
1609 struct lpfc_vport *vport = ndlp->vport;
1626 * by WWPN. Just return the ndlp that was given to us.
1628 if (ndlp->nlp_type & NLP_FABRIC)
1629 return ndlp;
1635 * we have for that ndlp. If not, we have some work to do.
1639 /* return immediately if the WWPN matches ndlp */
1640 if (new_ndlp == ndlp && NLP_CHK_NODE_ACT(new_ndlp))
1641 return ndlp;
1652 "3178 PLOGI confirm: ndlp x%x x%x x%x: "
1654 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_fc4_type,
1660 rc = memcmp(&ndlp->nlp_portname, name,
1666 return ndlp;
1668 new_ndlp = lpfc_nlp_init(vport, ndlp->nlp_DID);
1673 return ndlp;
1676 rc = memcmp(&ndlp->nlp_portname, name,
1682 return ndlp;
1690 return ndlp;
1708 * would have updated nlp_fc4_type in ndlp, so we must ensure
1713 new_ndlp->nlp_fc4_type = ndlp->nlp_fc4_type;
1717 new_ndlp->nlp_DID = ndlp->nlp_DID;
1718 new_ndlp->nlp_prev_state = ndlp->nlp_prev_state;
1721 ndlp->active_rrqs_xri_bitmap,
1726 keep_nlp_flag = ndlp->nlp_flag;
1727 new_ndlp->nlp_flag = ndlp->nlp_flag;
1741 ndlp->nlp_flag = keep_new_nlp_flag;
1743 /* if ndlp had NLP_UNREG_INP set, keep it */
1745 ndlp->nlp_flag |= NLP_UNREG_INP;
1747 ndlp->nlp_flag &= ~NLP_UNREG_INP;
1749 /* if ndlp had NLP_RPI_REGISTERED set, keep it */
1751 ndlp->nlp_flag |= NLP_RPI_REGISTERED;
1753 ndlp->nlp_flag &= ~NLP_RPI_REGISTERED;
1759 lpfc_nlp_set_state(vport, new_ndlp, ndlp->nlp_state);
1763 new_ndlp->nrport = ndlp->nrport;
1766 if (memcmp(&ndlp->nlp_portname, name, sizeof(struct lpfc_name)) == 0) {
1767 /* The new_ndlp is replacing ndlp totally, so we need
1768 * to put ndlp on UNUSED list and try to free it.
1775 rport = ndlp->rport;
1778 if (rdata->pnode == ndlp) {
1780 ndlp->rport = NULL;
1781 lpfc_nlp_put(ndlp);
1785 new_ndlp->nlp_type = ndlp->nlp_type;
1789 if (ndlp->nrport) {
1790 ndlp->nrport = NULL;
1791 lpfc_nlp_put(ndlp);
1794 /* We shall actually free the ndlp with both nlp_DID and
1795 * nlp_portname fields equals 0 to avoid any ndlp on the
1798 if (ndlp->nlp_DID == 0) {
1800 NLP_SET_FREE_REQ(ndlp);
1805 * Note: for this case, ndlp has a NULL WWPN so setting
1808 ndlp->nlp_DID = keepDID;
1809 lpfc_nlp_set_state(vport, ndlp, keep_nlp_state);
1812 memcpy(ndlp->active_rrqs_xri_bitmap,
1816 if (!NLP_CHK_NODE_ACT(ndlp))
1817 lpfc_drop_node(vport, ndlp);
1824 lpfc_unreg_rpi(vport, ndlp);
1827 * type must be transferred because the ndlp is in
1830 ndlp->nlp_DID = keepDID;
1831 ndlp->nlp_fc4_type = keep_nlp_fc4_type;
1835 memcpy(ndlp->active_rrqs_xri_bitmap,
1840 * reset the old ndlp state
1842 if ((ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) ||
1843 (ndlp->nlp_state == NLP_STE_MAPPED_NODE))
1845 lpfc_nlp_set_state(vport, ndlp, keep_nlp_state);
1847 /* Previous ndlp no longer active with nvme host transport.
1851 if (ndlp->nrport)
1852 lpfc_nlp_put(ndlp);
1853 ndlp->nrport = keep_nrport;
1856 rport = ndlp->rport;
1860 put_rport = ndlp->rport != NULL;
1862 ndlp->rport = NULL;
1864 lpfc_nlp_put(ndlp);
1921 * clear the xri's bit in the ndlp's xri_bitmap. If the ndlp does not
1932 struct lpfc_nodelist *ndlp;
1945 ndlp = lpfc_findnode_did(vport, irsp->un.elsreq64.remoteID);
1946 if (!ndlp || !NLP_CHK_NODE_ACT(ndlp) || ndlp != rrq->ndlp) {
1949 "with no ndlp. Data: x%x x%x x%x\n",
1960 ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4],
1973 ndlp->nlp_DID, irsp->ulpStatus,
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;
2022 ndlp = lpfc_findnode_did(vport, irsp->un.elsreq64.remoteID);
2023 if (!ndlp || !NLP_CHK_NODE_ACT(ndlp)) {
2026 "with no ndlp. Data: x%x x%x x%x\n",
2033 /* Since ndlp can be freed in the disc state machine, note if this node
2037 disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC);
2038 ndlp->nlp_flag &= ~NLP_NPR_2B_DISC;
2045 ndlp->nlp_DID, ndlp->nlp_fc4_type,
2052 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
2063 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
2075 ndlp->nlp_DID, irsp->ulpStatus,
2079 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
2086 ndlp = lpfc_plogi_confirm_nport(phba, prsp->virt, ndlp);
2087 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
2118 * the ndlp with the remote N_Port DID must exist on the @vport's ndlp list.
2122 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
2123 * will be incremented by 1 for holding the ndlp and the reference to ndlp
2137 struct lpfc_nodelist *ndlp;
2143 ndlp = lpfc_findnode_did(vport, did);
2145 if (ndlp) {
2150 if ((ndlp->nlp_flag & NLP_UNREG_INP) &&
2151 ((ndlp->nlp_DID & Fabric_DID_MASK) != Fabric_DID_MASK) &&
2156 ndlp->nlp_defer_did, ndlp->nlp_DID,
2157 ndlp->nlp_rpi, ndlp);
2160 if (ndlp->nlp_defer_did == NLP_EVT_NOTHING_PENDING)
2161 ndlp->nlp_defer_did = did;
2164 if (!NLP_CHK_NODE_ACT(ndlp))
2165 ndlp = NULL;
2168 /* If ndlp is not NULL, we will bump the reference count on it */
2170 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp, did,
2177 ndlp->nlp_flag &= ~NLP_FCP_PRLI_RJT;
2240 * ndlp to mark the PRLI completion.
2249 struct lpfc_nodelist *ndlp;
2257 ndlp = (struct lpfc_nodelist *) cmdiocb->context1;
2259 ndlp->nlp_flag &= ~NLP_PRLI_SND;
2263 ndlp->fc4_prli_sent--;
2269 ndlp->nlp_DID);
2275 ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4],
2276 vport->num_disc_nodes, ndlp->fc4_prli_sent);
2305 ndlp->nlp_DID, irsp->ulpStatus,
2306 irsp->un.ulpWord[4], ndlp->fc4_prli_sent);
2312 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
2320 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
2332 * @ndlp: pointer to a node-list data structure.
2341 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
2342 * will be incremented by 1 for holding the ndlp and the reference to ndlp
2351 lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
2372 ndlp->nlp_fc4_type |= NLP_FC4_NVME;
2373 local_nlp_type = ndlp->nlp_fc4_type;
2375 /* This routine will issue 1 or 2 PRLIs, so zero all the ndlp
2378 ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR);
2379 ndlp->nlp_type &= ~(NLP_NVME_TARGET | NLP_NVME_INITIATOR);
2380 ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
2381 ndlp->nlp_flag &= ~(NLP_FIRSTBURST | NLP_NPR_2B_DISC);
2382 ndlp->nvme_fb_size = 0;
2395 "3083 Unknown FC_TYPE x%x ndlp x%06x\n",
2396 ndlp->nlp_fc4_type, ndlp->nlp_DID);
2404 ndlp->nlp_fc4_type == NLP_FC4_NVME) {
2407 ndlp->nlp_type);
2408 lpfc_disc_state_machine(vport, ndlp, NULL, NLP_EVT_DEVICE_RM);
2412 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
2413 ndlp->nlp_DID, elscmd);
2491 ndlp->nlp_DID, 0, 0);
2496 ndlp->nlp_flag |= NLP_PRLI_SND;
2499 * the ndlp is used to track outstanding PRLIs for different
2503 ndlp->fc4_prli_sent++;
2508 ndlp->nlp_flag &= ~NLP_PRLI_SND;
2665 struct lpfc_nodelist *ndlp;
2672 ndlp = (struct lpfc_nodelist *) cmdiocb->context1;
2677 ndlp->nlp_DID);
2679 /* Since ndlp can be freed in the disc state machine, note if this node
2683 disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC);
2684 ndlp->nlp_flag &= ~(NLP_ADISC_SND | NLP_NPR_2B_DISC);
2690 ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4],
2695 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
2706 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
2715 ndlp->nlp_DID, irsp->ulpStatus,
2719 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
2723 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
2737 * @ndlp: pointer to a node-list data structure.
2740 * This routine issues an Address Discover (ADISC) for an @ndlp on a
2742 * and states of the ndlp, and invokes the lpfc_sli_issue_iocb() routine
2745 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
2746 * will be incremented by 1 for holding the ndlp and the reference to ndlp
2755 lpfc_issue_els_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
2766 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
2767 ndlp->nlp_DID, ELS_CMD_ADISC);
2786 ndlp->nlp_DID, 0, 0);
2791 ndlp->nlp_flag |= NLP_ADISC_SND;
2796 ndlp->nlp_flag &= ~NLP_ADISC_SND;
2812 * state machine of the associated ndlp shall be invoked for transition with
2820 struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) cmdiocb->context1;
2821 struct lpfc_vport *vport = ndlp->vport;
2833 ndlp->nlp_flag &= ~NLP_LOGO_SND;
2839 ndlp->nlp_DID);
2845 ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4],
2854 if (ndlp->nlp_flag & NLP_TARGET_REMOVE) {
2858 lpfc_disc_state_machine(vport, ndlp, cmdiocb,
2873 ndlp->nlp_DID, irsp->ulpStatus,
2883 lpfc_disc_state_machine(vport, ndlp, cmdiocb, NLP_EVT_CMPL_LOGO);
2918 if (ndlp->nlp_type & (NLP_FCP_TARGET | NLP_NVME_TARGET) &&
2920 lpfc_cancel_retry_delay_tmo(vport, ndlp);
2922 ndlp->nlp_flag |= NLP_NPR_2B_DISC;
2928 ndlp->nlp_DID, irsp->ulpStatus,
2939 * @ndlp: pointer to a node-list data structure.
2943 * to a remote node, referred by an @ndlp on a @vport. It constructs the
2944 * payload of the IOCB, properly sets up the @ndlp state, and invokes the
2947 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
2948 * will be incremented by 1 for holding the ndlp and the reference to ndlp
2959 lpfc_issue_els_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
2970 if (ndlp->nlp_flag & NLP_LOGO_SND) {
2977 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
2978 ndlp->nlp_DID, ELS_CMD_LOGO);
2993 ndlp->nlp_DID, 0, 0);
2998 ndlp->nlp_flag |= NLP_LOGO_SND;
2999 ndlp->nlp_flag &= ~NLP_ISSUE_LOGO;
3004 ndlp->nlp_flag &= ~NLP_LOGO_SND;
3011 ndlp->nlp_prev_state = ndlp->nlp_state;
3013 lpfc_nlp_set_state(vport, ndlp, NLP_STE_LOGO_ISSUE);
3113 cmdiocb->context1 = NULL; /* save ndlp refcnt */
3166 * first search the @vport node list to find the matching ndlp. If no such
3167 * ndlp is found, a new ndlp shall be created for this (SCR) purpose. An
3171 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
3172 * will be incremented by 1 for holding the ndlp and the reference to ndlp
3187 struct lpfc_nodelist *ndlp;
3191 ndlp = lpfc_findnode_did(vport, Fabric_Cntl_DID);
3192 if (!ndlp) {
3193 ndlp = lpfc_nlp_init(vport, Fabric_Cntl_DID);
3194 if (!ndlp)
3196 lpfc_enqueue_node(vport, ndlp);
3197 } else if (!NLP_CHK_NODE_ACT(ndlp)) {
3198 ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_UNUSED_NODE);
3199 if (!ndlp)
3203 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
3204 ndlp->nlp_DID, ELS_CMD_SCR);
3210 lpfc_nlp_put(ndlp);
3225 ndlp->nlp_DID, 0, 0);
3235 lpfc_nlp_put(ndlp);
3243 lpfc_nlp_put(ndlp);
3258 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
3259 * will be incremented by 1 for holding the ndlp and the reference to ndlp
3272 struct lpfc_nodelist *ndlp;
3287 ndlp = lpfc_findnode_mapped(vport);
3288 if (!ndlp)
3293 ndlp = lpfc_findnode_did(vport, nportid);
3294 if (!ndlp) {
3296 ndlp = lpfc_nlp_init(vport, nportid);
3297 if (!ndlp)
3299 lpfc_enqueue_node(vport, ndlp);
3300 } else if (!NLP_CHK_NODE_ACT(ndlp)) {
3301 ndlp = lpfc_enable_node(vport, ndlp,
3303 if (!ndlp)
3308 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
3309 ndlp->nlp_DID, ELS_CMD_RSCN_XMT);
3315 lpfc_nlp_put(ndlp);
3334 ndlp->nlp_DID, 0, 0);
3344 lpfc_nlp_put(ndlp);
3352 lpfc_nlp_put(ndlp);
3366 * the matching ndlp. If no such ndlp is found, a new ndlp shall be created
3370 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
3371 * will be incremented by 1 for holding the ndlp and the reference to ndlp
3389 struct lpfc_nodelist *ndlp;
3393 ndlp = lpfc_findnode_did(vport, nportid);
3394 if (!ndlp) {
3395 ndlp = lpfc_nlp_init(vport, nportid);
3396 if (!ndlp)
3398 lpfc_enqueue_node(vport, ndlp);
3399 } else if (!NLP_CHK_NODE_ACT(ndlp)) {
3400 ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_UNUSED_NODE);
3401 if (!ndlp)
3405 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
3406 ndlp->nlp_DID, ELS_CMD_RNID);
3411 lpfc_nlp_put(ndlp);
3441 ndlp->nlp_DID, 0, 0);
3451 lpfc_nlp_put(ndlp);
3470 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
3471 * will be incremented by 1 for holding the ndlp and the reference to ndlp
3485 struct lpfc_nodelist *ndlp;
3490 ndlp = lpfc_findnode_did(vport, Fabric_Cntl_DID);
3491 if (!ndlp) {
3492 ndlp = lpfc_nlp_init(vport, Fabric_Cntl_DID);
3493 if (!ndlp)
3495 lpfc_enqueue_node(vport, ndlp);
3496 } else if (!NLP_CHK_NODE_ACT(ndlp)) {
3497 ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_UNUSED_NODE);
3498 if (!ndlp)
3504 lpfc_nlp_put(ndlp);
3508 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
3509 ndlp->nlp_DID, ELS_CMD_RDF);
3514 lpfc_nlp_put(ndlp);
3536 ndlp->nlp_DID, 0, 0);
3540 ndlp->nlp_DID);
3549 lpfc_nlp_put(ndlp);
3554 /* An RDF was issued - this put ensures the ndlp is cleaned up
3557 lpfc_nlp_put(ndlp);
3567 * a @vport's @ndlp. It stops the timer for the delayed function retrial and
3617 * lpfc_els_retry_delay - Timer function with a ndlp delayed function timer
3618 * @t: pointer to the timer function associated data (ndlp).
3620 * This routine is invoked by the ndlp delayed-function timer to check
3626 * the work list to hold reference count of ndlp so that it guarantees the
3627 * reference to ndlp will still be available when the worker thread gets
3628 * to the event associated with the ndlp.
3633 struct lpfc_nodelist *ndlp = from_timer(ndlp, t, nlp_delayfunc);
3634 struct lpfc_vport *vport = ndlp->vport;
3637 struct lpfc_work_evt *evtp = &ndlp->els_retry_evt;
3648 evtp->evt_arg1 = lpfc_nlp_get(ndlp);
3659 * lpfc_els_retry_delay_handler - Work thread handler for ndlp delayed function
3660 * @ndlp: pointer to a node-list data structure.
3662 * This routine is the worker-thread handler for processing the @ndlp delayed
3664 * the last ELS command from the associated ndlp and invokes the proper ELS
3668 lpfc_els_retry_delay_handler(struct lpfc_nodelist *ndlp)
3670 struct lpfc_vport *vport = ndlp->vport;
3675 cmd = ndlp->nlp_last_elscmd;
3676 ndlp->nlp_last_elscmd = 0;
3678 if (!(ndlp->nlp_flag & NLP_DELAY_TMO)) {
3683 ndlp->nlp_flag &= ~NLP_DELAY_TMO;
3690 del_timer_sync(&ndlp->nlp_delayfunc);
3691 retry = ndlp->nlp_retry;
3692 ndlp->nlp_retry = 0;
3696 lpfc_issue_els_flogi(vport, ndlp, retry);
3699 if (!lpfc_issue_els_plogi(vport, ndlp->nlp_DID, retry)) {
3700 ndlp->nlp_prev_state = ndlp->nlp_state;
3701 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
3705 if (!lpfc_issue_els_adisc(vport, ndlp, retry)) {
3706 ndlp->nlp_prev_state = ndlp->nlp_state;
3707 lpfc_nlp_set_state(vport, ndlp, NLP_STE_ADISC_ISSUE);
3712 if (!lpfc_issue_els_prli(vport, ndlp, retry)) {
3713 ndlp->nlp_prev_state = ndlp->nlp_state;
3714 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PRLI_ISSUE);
3718 if (!lpfc_issue_els_logo(vport, ndlp, retry)) {
3719 ndlp->nlp_prev_state = ndlp->nlp_state;
3720 lpfc_nlp_set_state(vport, ndlp, NLP_STE_LOGO_ISSUE);
3725 lpfc_issue_els_fdisc(vport, ndlp, retry);
3801 * be posted to the ndlp delayed event and delayed function timer set to the
3802 * ndlp for the delayed command issusing.
3815 struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) cmdiocb->context1;
3835 if (ndlp && NLP_CHK_NODE_ACT(ndlp))
3836 did = ndlp->nlp_DID;
3840 ndlp = lpfc_findnode_did(vport, did);
3841 if ((!ndlp || !NLP_CHK_NODE_ACT(ndlp))
3848 *(((uint32_t *) irsp) + 7), irsp->un.ulpWord[4], ndlp->nlp_DID);
3859 lpfc_set_rrq_active(phba, ndlp,
4090 ndlp->nlp_flag |= NLP_FCP_PRLI_RJT;
4187 if (ndlp && NLP_CHK_NODE_ACT(ndlp) && delay) {
4189 ndlp->nlp_retry = cmdiocb->retry;
4192 mod_timer(&ndlp->nlp_delayfunc,
4195 ndlp->nlp_flag |= NLP_DELAY_TMO;
4198 ndlp->nlp_prev_state = ndlp->nlp_state;
4201 lpfc_nlp_set_state(vport, ndlp,
4204 lpfc_nlp_set_state(vport, ndlp,
4206 ndlp->nlp_last_elscmd = cmd;
4212 lpfc_issue_els_flogi(vport, ndlp, cmdiocb->retry);
4215 lpfc_issue_els_fdisc(vport, ndlp, cmdiocb->retry);
4218 if (ndlp && NLP_CHK_NODE_ACT(ndlp)) {
4219 ndlp->nlp_prev_state = ndlp->nlp_state;
4220 lpfc_nlp_set_state(vport, ndlp,
4226 ndlp->nlp_prev_state = ndlp->nlp_state;
4227 lpfc_nlp_set_state(vport, ndlp, NLP_STE_ADISC_ISSUE);
4228 lpfc_issue_els_adisc(vport, ndlp, cmdiocb->retry);
4232 ndlp->nlp_prev_state = ndlp->nlp_state;
4233 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PRLI_ISSUE);
4234 lpfc_issue_els_prli(vport, ndlp, cmdiocb->retry);
4237 ndlp->nlp_prev_state = ndlp->nlp_state;
4238 lpfc_nlp_set_state(vport, ndlp, NLP_STE_LOGO_ISSUE);
4239 lpfc_issue_els_logo(vport, ndlp, cmdiocb->retry);
4322 * context1 - reference to ndlp
4327 * It first properly decrements the reference count held on ndlp for the
4344 struct lpfc_nodelist *ndlp;
4346 ndlp = (struct lpfc_nodelist *)elsiocb->context1;
4347 if (ndlp) {
4348 if (ndlp->nlp_flag & NLP_DEFER_RM) {
4349 lpfc_nlp_put(ndlp);
4351 /* If the ndlp is not being used by another discovery
4354 if (!lpfc_nlp_not_used(ndlp)) {
4355 /* If ndlp is being used by another discovery
4358 ndlp->nlp_flag &= ~NLP_DEFER_RM;
4362 lpfc_nlp_put(ndlp);
4417 * release the ndlp if it has the last reference remaining (reference count
4418 * is 1). If succeeded (meaning ndlp released), it sets the IOCB context1
4420 * ndlp reference count needs to be decremented. Otherwise, the ndlp
4429 struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) cmdiocb->context1;
4436 irsp->ulpStatus, irsp->un.ulpWord[4], ndlp->nlp_DID);
4441 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
4442 ndlp->nlp_rpi);
4444 if (ndlp->nlp_state == NLP_STE_NPR_NODE) {
4446 if (!lpfc_nlp_not_used(ndlp)) {
4447 /* If the ndlp is being used by another discovery
4450 lpfc_unreg_rpi(vport, ndlp);
4474 * decrements the ndlp reference count held for this completion callback
4476 * whether there is only one reference left on the ndlp. If so, it will
4477 * perform one more decrement and trigger the release of the ndlp.
4483 struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp;
4491 if (ndlp) {
4492 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE,
4494 ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag,
4495 kref_read(&ndlp->kref),
4496 ndlp->nlp_usg_map, ndlp);
4497 if (NLP_CHK_NODE_ACT(ndlp)) {
4498 lpfc_nlp_put(ndlp);
4500 * this ndlp. If no other discovery threads are using
4501 * this ndlp, free all resources associated with it.
4503 lpfc_nlp_not_used(ndlp);
4505 lpfc_drop_node(ndlp->vport, ndlp);
4520 * nlp_flag bitmap in the ndlp data structure, if the mbox command reference
4525 * routine shall be invoked trying to release the ndlp if no other threads
4532 struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) cmdiocb->context1;
4533 struct lpfc_vport *vport = ndlp ? ndlp->vport : NULL;
4552 * function can have cmdiocb->contest1 (ndlp) field set to NULL.
4555 if (ndlp && NLP_CHK_NODE_ACT(ndlp) &&
4560 if (!(ndlp->nlp_flag & NLP_RM_DFLT_RPI))
4565 if (!ndlp || !NLP_CHK_NODE_ACT(ndlp) || lpfc_els_chk_latt(vport)) {
4574 if (ndlp && NLP_CHK_NODE_ACT(ndlp) &&
4575 (ndlp->nlp_flag & NLP_RM_DFLT_RPI))
4576 if (lpfc_nlp_not_used(ndlp)) {
4577 ndlp = NULL;
4597 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
4598 ndlp->nlp_rpi);
4601 && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) {
4602 if (!lpfc_unreg_rpi(vport, ndlp) &&
4604 (ndlp->nlp_state == NLP_STE_PLOGI_ISSUE ||
4605 ndlp->nlp_state == NLP_STE_REG_LOGIN_ISSUE)) {
4610 ndlp->nlp_DID, ndlp->nlp_state,
4611 ndlp->nlp_rpi, ndlp->nlp_flag);
4622 /* Increment reference count to ndlp to hold the
4623 * reference to ndlp for the callback function.
4625 mbox->ctx_ndlp = lpfc_nlp_get(ndlp);
4627 if (ndlp->nlp_flag & NLP_RM_DFLT_RPI) {
4633 ndlp->nlp_prev_state = ndlp->nlp_state;
4634 lpfc_nlp_set_state(vport, ndlp,
4638 ndlp->nlp_flag |= NLP_REG_LOGIN_SEND;
4643 /* Decrement the ndlp reference count we
4646 lpfc_nlp_put(ndlp);
4647 ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND;
4653 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
4654 ndlp->nlp_rpi);
4656 if (lpfc_nlp_not_used(ndlp)) {
4657 ndlp = NULL;
4667 ndlp->nlp_flag & NLP_ACC_REGLOGIN) {
4668 if (lpfc_nlp_not_used(ndlp)) {
4669 ndlp = NULL;
4687 if (ndlp && NLP_CHK_NODE_ACT(ndlp) && shost) {
4690 ndlp->nlp_flag &= ~NLP_ACC_REGLOGIN;
4691 ndlp->nlp_flag &= ~NLP_RM_DFLT_RPI;
4700 if (lpfc_nlp_not_used(ndlp))
4718 * @ndlp: pointer to a node-list data structure.
4729 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
4730 * will be incremented by 1 for holding the ndlp and the reference to ndlp
4740 struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp,
4760 ndlp, ndlp->nlp_DID, ELS_CMD_ACC);
4763 ndlp->nlp_flag &= ~NLP_LOGO_ACC;
4777 ndlp->nlp_DID, ndlp->nlp_flag, 0);
4783 ndlp, ndlp->nlp_DID, ELS_CMD_ACC);
4840 ndlp->nlp_DID, ndlp->nlp_flag, 0);
4845 ndlp, ndlp->nlp_DID, ELS_CMD_PRLO);
4862 ndlp->nlp_DID, ndlp->nlp_flag, 0);
4867 if (ndlp->nlp_flag & NLP_LOGO_ACC) {
4869 if (!(ndlp->nlp_flag & NLP_RPI_REGISTERED ||
4870 ndlp->nlp_flag & NLP_REG_LOGIN_SEND))
4871 ndlp->nlp_flag &= ~NLP_LOGO_ACC;
4892 * @ndlp: pointer to a node-list data structure.
4900 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
4901 * will be incremented by 1 for holding the ndlp and the reference to ndlp
4911 struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp,
4923 elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, oldiocb->retry, ndlp,
4924 ndlp->nlp_DID, ELS_CMD_LS_RJT);
4947 elsiocb->iocb.ulpContext, ndlp->nlp_DID,
4948 ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi);
4951 ndlp->nlp_DID, ndlp->nlp_flag, rejectError);
4968 * @ndlp: pointer to a node-list data structure.
4974 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
4975 * will be incremented by 1 for holding the ndlp and the reference to ndlp
4985 struct lpfc_nodelist *ndlp)
4996 elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, oldiocb->retry, ndlp,
4997 ndlp->nlp_DID, ELS_CMD_ACC);
5011 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
5012 ndlp->nlp_rpi);
5026 ndlp->nlp_DID, ndlp->nlp_flag, 0);
5042 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
5043 ndlp->nlp_rpi, vport->fc_flag);
5051 * @ndlp: pointer to a node-list data structure.
5057 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
5058 * will be incremented by 1 for holding the ndlp and the reference to ndlp
5068 struct lpfc_nodelist *ndlp)
5107 elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, oldiocb->retry, ndlp,
5108 ndlp->nlp_DID, elsrspcmd);
5122 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
5123 ndlp->nlp_rpi);
5140 if ((ndlp->nlp_type & NLP_FCP_TARGET) &&
5180 npr_nvme->word5, ndlp->nlp_flag,
5181 ndlp->nlp_fcp_info, ndlp->nlp_type);
5187 "6128 Unknown FC_TYPE x%x x%x ndlp x%06x\n",
5188 prli_fc4_req, ndlp->nlp_fc4_type,
5189 ndlp->nlp_DID);
5193 ndlp->nlp_DID, ndlp->nlp_flag, 0);
5211 * @ndlp: pointer to a node-list data structure.
5216 * issue the response. Note that this command does not need to hold the ndlp
5217 * reference count for the callback. So, the ndlp reference count taken by
5220 * there is no ndlp reference available.
5222 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
5223 * will be incremented by 1 for holding the ndlp and the reference to ndlp
5234 struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp)
5249 elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, oldiocb->retry, ndlp,
5250 ndlp->nlp_DID, ELS_CMD_ACC);
5293 ndlp->nlp_DID, ndlp->nlp_flag, 0);
5310 * @ndlp: pointer to a node-list data structure.
5316 struct lpfc_iocbq *iocb, struct lpfc_nodelist *ndlp)
5342 ndlp->nlp_DID, ndlp->nlp_flag, rrq->rrq_exchg);
5347 prrq = lpfc_get_active_rrq(vport, xri, ndlp->nlp_DID);
5358 * @ndlp: pointer to a node-list data structure.
5366 struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp)
5381 elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, oldiocb->retry, ndlp,
5382 ndlp->nlp_DID, ELS_CMD_ACC);
5400 ndlp->nlp_DID, ndlp->nlp_flag, 0);
5436 struct lpfc_nodelist *ndlp, *next_ndlp;
5440 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
5441 if (!NLP_CHK_NODE_ACT(ndlp))
5443 if (ndlp->nlp_state == NLP_STE_NPR_NODE &&
5444 (ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 &&
5445 (ndlp->nlp_flag & NLP_NPR_ADISC) != 0) {
5447 ndlp->nlp_flag &= ~NLP_NPR_ADISC;
5449 ndlp->nlp_prev_state = ndlp->nlp_state;
5450 lpfc_nlp_set_state(vport, ndlp, NLP_STE_ADISC_ISSUE);
5451 lpfc_issue_els_adisc(vport, ndlp, 0);
5494 struct lpfc_nodelist *ndlp, *next_ndlp;
5498 list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) {
5499 if (!NLP_CHK_NODE_ACT(ndlp))
5501 if (ndlp->nlp_state == NLP_STE_NPR_NODE &&
5502 (ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 &&
5503 (ndlp->nlp_flag & NLP_DELAY_TMO) == 0 &&
5504 (ndlp->nlp_flag & NLP_NPR_ADISC) == 0) {
5505 ndlp->nlp_prev_state = ndlp->nlp_state;
5506 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
5507 lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
5930 struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
5941 memcpy(desc->port_names.wwnn, &ndlp->nlp_nodename,
5944 memcpy(desc->port_names.wwpn, &ndlp->nlp_portname,
5956 struct lpfc_nodelist *ndlp = rdp_context->ndlp;
5957 struct lpfc_vport *vport = ndlp->vport;
5975 lpfc_max_els_tries, rdp_context->ndlp,
5976 rdp_context->ndlp->nlp_DID, ELS_CMD_ACC);
5977 lpfc_nlp_put(ndlp);
5989 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
5990 ndlp->nlp_rpi);
6017 (len + pcmd), vport, ndlp);
6061 ndlp, ndlp->nlp_DID, ELS_CMD_LS_RJT);
6062 lpfc_nlp_put(ndlp);
6100 mbox->vport = rdp_context->ndlp->vport;
6119 * @ndlp: pointer to a node-list data structure.
6134 struct lpfc_nodelist *ndlp)
6184 rdp_context->ndlp = lpfc_nlp_get(ndlp);
6189 lpfc_printf_vlog(ndlp->vport, KERN_WARNING, LOG_ELS,
6193 lpfc_nlp_put(ndlp);
6206 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, NULL);
6218 struct lpfc_nodelist *ndlp;
6228 ndlp = lcb_context->ndlp;
6253 lpfc_max_els_tries, ndlp,
6254 ndlp->nlp_DID, ELS_CMD_ACC);
6256 /* Decrement the ndlp reference count from previous mbox command */
6257 lpfc_nlp_put(ndlp);
6289 lpfc_max_els_tries, ndlp,
6290 ndlp->nlp_DID, ELS_CMD_LS_RJT);
6291 lpfc_nlp_put(ndlp);
6392 * @ndlp: pointer to a node-list data structure.
6404 struct lpfc_nodelist *ndlp)
6456 lcb_context->ndlp = lpfc_nlp_get(ndlp);
6458 lpfc_printf_vlog(ndlp->vport, KERN_ERR, LOG_TRACE_EVENT,
6461 lpfc_nlp_put(ndlp);
6469 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, NULL);
6604 struct lpfc_nodelist *ndlp = NULL;
6607 list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
6608 if (!NLP_CHK_NODE_ACT(ndlp) ||
6609 (ndlp->nlp_state == NLP_STE_UNUSED_NODE) ||
6610 !lpfc_rscn_payload_check(vport, ndlp->nlp_DID))
6620 switch (ndlp->nlp_state) {
6632 if (ndlp->nlp_fc4_type & NLP_FC4_NVME &&
6633 ndlp->nlp_type & (NLP_NVME_TARGET | NLP_NVME_DISCOVERY))
6634 lpfc_nvme_rescan_port(vport, ndlp);
6636 lpfc_disc_state_machine(vport, ndlp, NULL,
6638 lpfc_cancel_retry_delay_tmo(vport, ndlp);
6690 * @ndlp: pointer to a node-list data structure.
6710 struct lpfc_nodelist *ndlp)
6745 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
6750 if (ndlp->nlp_fc4_type & NLP_FC4_NVME &&
6751 ndlp->nlp_type & (NLP_NVME_TARGET | NLP_NVME_DISCOVERY))
6752 lpfc_nvme_rescan_port(vport, ndlp);
6762 ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag);
6764 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
6792 ndlp->nlp_DID, vport->port_state,
6793 ndlp->nlp_flag);
6796 ndlp, NULL);
6807 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
6821 ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag);
6873 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
6880 ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag);
6895 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
6906 * (RSCN) for a @vport. If login to NameServer does not exist, a new ndlp shall
6908 * if the ndlp to NameServer exists, a Common Transport (CT) command to the
6920 struct lpfc_nodelist *ndlp;
6943 ndlp = lpfc_findnode_did(vport, NameServer_DID);
6944 if (ndlp && NLP_CHK_NODE_ACT(ndlp)
6945 && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) {
6946 /* Good ndlp, issue CT Request to NameServer. Need to
6962 if (ndlp) {
6963 ndlp = lpfc_enable_node(vport, ndlp,
6965 if (!ndlp) {
6969 ndlp->nlp_prev_state = NLP_STE_UNUSED_NODE;
6971 ndlp = lpfc_nlp_init(vport, NameServer_DID);
6972 if (!ndlp) {
6976 ndlp->nlp_prev_state = ndlp->nlp_state;
6977 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
6979 ndlp->nlp_type |= NLP_FABRIC;
6995 * @ndlp: pointer to a node-list data structure.
7018 struct lpfc_nodelist *ndlp)
7052 (void) lpfc_check_sparm(vport, ndlp, sp, CLASS3, 1);
7155 lpfc_els_rsp_acc(vport, ELS_CMD_FLOGI, cmdiocb, ndlp, NULL);
7167 * @ndlp: pointer to a node-list data structure.
7181 struct lpfc_nodelist *ndlp)
7200 lpfc_els_rsp_rnid_acc(vport, rn->Format, cmdiocb, ndlp);
7208 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp,
7218 * @ndlp: pointer to a node-list data structure.
7225 struct lpfc_nodelist *ndlp)
7234 lpfc_els_rsp_echo_acc(vport, pcmd, cmdiocb, ndlp);
7242 * @ndlp: pointer to a node-list data structure.
7253 struct lpfc_nodelist *ndlp)
7262 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, NULL);
7270 * @ndlp: pointer to a node-list data structure.
7284 struct lpfc_nodelist *ndlp)
7286 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
7288 lpfc_els_clear_rrq(vport, cmdiocb, ndlp);
7304 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
7305 * will be incremented by 1 for holding the ndlp and the reference to ndlp
7318 struct lpfc_nodelist *ndlp;
7325 ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp;
7338 lpfc_max_els_tries, ndlp,
7339 ndlp->nlp_DID, ELS_CMD_ACC);
7341 /* Decrement the ndlp reference count from previous mbox command */
7342 lpfc_nlp_put(ndlp);
7366 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_ELS,
7370 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
7371 ndlp->nlp_rpi);
7382 * @ndlp: pointer to a node-list data structure.
7398 struct lpfc_nodelist *ndlp)
7404 if ((ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) &&
7405 (ndlp->nlp_state != NLP_STE_MAPPED_NODE))
7415 mbox->ctx_ndlp = lpfc_nlp_get(ndlp);
7425 lpfc_nlp_put(ndlp);
7434 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, NULL);
7442 * @ndlp: pointer to a node-list data structure.
7451 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
7452 * will be incremented by 1 for holding the ndlp and the reference to ndlp
7461 struct lpfc_nodelist *ndlp)
7471 if ((ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) &&
7472 (ndlp->nlp_state != NLP_STE_MAPPED_NODE))
7478 lpfc_max_els_tries, ndlp,
7479 ndlp->nlp_DID, ELS_CMD_ACC);
7502 lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_ELS,
7507 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
7508 ndlp->nlp_rpi,
7522 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp, NULL);
7528 * @ndlp: pointer to a node-list data structure.
7540 lpfc_issue_els_rrq(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
7551 if (ndlp != rrq->ndlp)
7552 ndlp = rrq->ndlp;
7553 if (!ndlp || !NLP_CHK_NODE_ACT(ndlp))
7556 /* If ndlp is not NULL, we will bump the reference count on it */
7558 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, 0, ndlp, did,
7606 struct lpfc_nodelist *ndlp = lpfc_findnode_did(rrq->vport,
7608 if (!ndlp)
7611 if (lpfc_test_rrq_active(phba, ndlp, rrq->xritag))
7612 return lpfc_issue_els_rrq(rrq->vport, ndlp,
7623 * @ndlp: pointer to a node-list data structure.
7628 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
7629 * will be incremented by 1 for holding the ndlp and the reference to ndlp
7639 struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp)
7647 elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize, oldiocb->retry, ndlp,
7648 ndlp->nlp_DID, ELS_CMD_ACC);
7678 ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
7679 ndlp->nlp_rpi);
7694 * @ndlp: pointer to a node-list data structure.
7708 struct lpfc_nodelist *ndlp)
7717 if ((ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) &&
7718 (ndlp->nlp_state != NLP_STE_MAPPED_NODE)) {
7724 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb, ndlp,
7743 lpfc_els_rsp_rpl_acc(vport, cmdsize, cmdiocb, ndlp);
7752 * @ndlp: pointer to a node-list data structure.
7774 struct lpfc_nodelist *ndlp)
7813 if ((ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) ||
7814 (ndlp->nlp_state == NLP_STE_MAPPED_NODE)) {
7817 ndlp->nlp_prev_state = ndlp->nlp_state;
7818 lpfc_nlp_set_state(vport, ndlp,
7820 lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
7835 * @ndlp: pointer to a node-list data structure.
7847 struct lpfc_nodelist *ndlp)
7864 lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
8022 struct lpfc_nodelist *ndlp;
8023 ndlp = __lpfc_findnode_rpi(vport, cmd->ulpContext);
8024 if (ndlp && NLP_CHK_NODE_ACT(ndlp))
8025 remote_ID = ndlp->nlp_DID;
8247 struct lpfc_nodelist *ndlp;
8250 ndlp = cmdiocbp->context1;
8251 if (!ndlp || !NLP_CHK_NODE_ACT(ndlp))
8257 memcpy(lsrjt_event.header.wwpn, &ndlp->nlp_portname,
8259 memcpy(lsrjt_event.header.wwnn, &ndlp->nlp_nodename,
8281 memcpy(fabric_event.wwpn, &ndlp->nlp_portname,
8283 memcpy(fabric_event.wwnn, &ndlp->nlp_nodename,
8298 * @ndlp: Pointer FC node object.
8306 struct lpfc_nodelist *ndlp,
8353 memcpy(els_data->wwpn, &ndlp->nlp_portname, sizeof(struct lpfc_name));
8354 memcpy(els_data->wwnn, &ndlp->nlp_nodename, sizeof(struct lpfc_name));
8467 * event. It first determines whether there is an existing ndlp that matches
8478 struct lpfc_nodelist *ndlp;
8517 ndlp = lpfc_findnode_did(vport, did);
8518 if (!ndlp) {
8519 /* Cannot find existing Fabric ndlp, so allocate a new one */
8520 ndlp = lpfc_nlp_init(vport, did);
8521 if (!ndlp)
8523 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
8526 ndlp->nlp_type |= NLP_FABRIC;
8527 } else if (!NLP_CHK_NODE_ACT(ndlp)) {
8528 ndlp = lpfc_enable_node(vport, ndlp,
8530 if (!ndlp)
8532 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
8535 ndlp->nlp_type |= NLP_FABRIC;
8536 } else if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) {
8538 ndlp = lpfc_nlp_get(ndlp);
8539 if (!ndlp)
8541 lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
8549 * if the ndlp is in DEV_LOSS
8553 if (ndlp->nlp_flag & NLP_IN_DEV_LOSS) {
8556 lpfc_nlp_put(ndlp);
8561 elsiocb->context1 = lpfc_nlp_get(ndlp);
8587 did, vport->port_state, ndlp->nlp_flag);
8590 ndlp = lpfc_plogi_confirm_nport(phba, payload, ndlp);
8605 lpfc_send_els_event(vport, ndlp, payload);
8624 ndlp->nlp_flag &= ~NLP_TARGET_REMOVE;
8627 lpfc_disc_state_machine(vport, ndlp, elsiocb,
8634 did, vport->port_state, ndlp->nlp_flag);
8650 lpfc_els_rcv_flogi(vport, elsiocb, ndlp);
8652 lpfc_nlp_put(ndlp);
8657 did, vport->port_state, ndlp->nlp_flag);
8660 lpfc_send_els_event(vport, ndlp, payload);
8666 lpfc_disc_state_machine(vport, ndlp, elsiocb, NLP_EVT_RCV_LOGO);
8671 did, vport->port_state, ndlp->nlp_flag);
8674 lpfc_send_els_event(vport, ndlp, payload);
8680 lpfc_disc_state_machine(vport, ndlp, elsiocb, NLP_EVT_RCV_PRLO);
8684 lpfc_els_rcv_lcb(vport, elsiocb, ndlp);
8688 lpfc_els_rcv_rdp(vport, elsiocb, ndlp);
8692 lpfc_els_rcv_rscn(vport, elsiocb, ndlp);
8694 lpfc_nlp_put(ndlp);
8699 did, vport->port_state, ndlp->nlp_flag);
8701 lpfc_send_els_event(vport, ndlp, payload);
8708 lpfc_disc_state_machine(vport, ndlp, elsiocb,
8714 did, vport->port_state, ndlp->nlp_flag);
8722 lpfc_disc_state_machine(vport, ndlp, elsiocb,
8728 did, vport->port_state, ndlp->nlp_flag);
8731 lpfc_els_rcv_farpr(vport, elsiocb, ndlp);
8736 did, vport->port_state, ndlp->nlp_flag);
8739 lpfc_els_rcv_farp(vport, elsiocb, ndlp);
8744 did, vport->port_state, ndlp->nlp_flag);
8747 lpfc_els_rcv_fan(vport, elsiocb, ndlp);
8753 did, vport->port_state, ndlp->nlp_flag);
8762 lpfc_disc_state_machine(vport, ndlp, elsiocb, NLP_EVT_RCV_PRLI);
8767 did, vport->port_state, ndlp->nlp_flag);
8770 lpfc_els_rcv_lirr(vport, elsiocb, ndlp);
8772 lpfc_nlp_put(ndlp);
8777 did, vport->port_state, ndlp->nlp_flag);
8780 lpfc_els_rcv_rls(vport, elsiocb, ndlp);
8782 lpfc_nlp_put(ndlp);
8787 did, vport->port_state, ndlp->nlp_flag);
8790 lpfc_els_rcv_rpl(vport, elsiocb, ndlp);
8792 lpfc_nlp_put(ndlp);
8797 did, vport->port_state, ndlp->nlp_flag);
8800 lpfc_els_rcv_rnid(vport, elsiocb, ndlp);
8802 lpfc_nlp_put(ndlp);
8807 did, vport->port_state, ndlp->nlp_flag);
8809 lpfc_els_rcv_rtv(vport, elsiocb, ndlp);
8811 lpfc_nlp_put(ndlp);
8816 did, vport->port_state, ndlp->nlp_flag);
8819 lpfc_els_rcv_rrq(vport, elsiocb, ndlp);
8821 lpfc_nlp_put(ndlp);
8826 did, vport->port_state, ndlp->nlp_flag);
8829 lpfc_els_rcv_echo(vport, elsiocb, ndlp);
8831 lpfc_nlp_put(ndlp);
8841 did, vport->port_state, ndlp->nlp_flag);
8862 lpfc_nlp_put(ndlp);
8872 lpfc_els_rsp_reject(vport, stat.un.lsRjtError, elsiocb, ndlp,
9002 struct lpfc_nodelist *ndlp;
9004 /* If this is the first time, allocate an ndlp and initialize
9008 ndlp = lpfc_findnode_did(vport, FDMI_DID);
9009 if (!ndlp) {
9010 ndlp = lpfc_nlp_init(vport, FDMI_DID);
9011 if (ndlp) {
9012 ndlp->nlp_type |= NLP_FABRIC;
9017 if (!NLP_CHK_NODE_ACT(ndlp))
9018 ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_NPR_NODE);
9020 if (ndlp) {
9021 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
9022 lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
9033 * ndlp for the Name Server associated to the @vport if such node does
9042 struct lpfc_nodelist *ndlp;
9062 ndlp = lpfc_findnode_did(vport, NameServer_DID);
9063 if (!ndlp) {
9064 ndlp = lpfc_nlp_init(vport, NameServer_DID);
9065 if (!ndlp) {
9075 } else if (!NLP_CHK_NODE_ACT(ndlp)) {
9076 ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_UNUSED_NODE);
9077 if (!ndlp) {
9088 ndlp->nlp_type |= NLP_FABRIC;
9090 lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
9092 if (lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0)) {
9122 struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp;
9166 lpfc_nlp_put(ndlp);
9211 /* Now, we decrement the ndlp reference count held for this
9214 lpfc_nlp_put(ndlp);
9224 * @ndlp: pointer to a node-list data structure.
9231 struct lpfc_nodelist *ndlp)
9240 mbox->ctx_ndlp = lpfc_nlp_get(ndlp);
9244 /* mailbox command not success, decrement ndlp
9247 lpfc_nlp_put(ndlp);
9279 struct lpfc_nodelist *ndlp;
9292 ndlp = lpfc_findnode_did(vports[i], Fabric_DID);
9293 if (ndlp)
9294 lpfc_cancel_retry_delay_tmo(vports[i], ndlp);
9312 struct lpfc_nodelist *ndlp;
9319 ndlp = lpfc_findnode_did(phba->pport, Fabric_DID);
9320 if (!ndlp)
9324 mod_timer(&ndlp->nlp_delayfunc, jiffies + msecs_to_jiffies(1000));
9326 ndlp->nlp_flag |= NLP_DELAY_TMO;
9328 ndlp->nlp_last_elscmd = ELS_CMD_FLOGI;
9381 struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) cmdiocb->context1;
9449 if (!NLP_CHK_NODE_ACT(ndlp) ||
9477 lpfc_register_new_vport(phba, vport, ndlp);
9484 lpfc_register_new_vport(phba, vport, ndlp);
9494 lpfc_nlp_put(ndlp);
9502 * @ndlp: pointer to a node-list data structure.
9506 * a remote node (@ndlp) off a @vport. It uses the lpfc_issue_fabric_iocb()
9510 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
9511 * will be incremented by 1 for holding the ndlp and the reference to ndlp
9520 lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
9529 int did = ndlp->nlp_DID;
9535 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp, did,
9609 * reference count held on ndlp for this completion function, indicating that
9610 * the reference to the ndlp is no long needed. Note that the
9611 * lpfc_els_free_iocb() routine decrements the ndlp reference held for this
9612 * callback function and an additional explicit ndlp reference decrementation
9613 * will trigger the actual release of the ndlp.
9621 struct lpfc_nodelist *ndlp;
9624 ndlp = (struct lpfc_nodelist *)cmdiocb->context1;
9633 /* Trigger the release of the ndlp after logo */
9634 lpfc_nlp_put(ndlp);
9640 ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4],
9655 * @ndlp: pointer to a node-list data structure.
9657 * This routine issues a LOGO ELS command to an @ndlp off a @vport.
9659 * Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp
9660 * will be incremented by 1 for holding the ndlp and the reference to ndlp
9669 lpfc_issue_els_npiv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
9678 elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, 0, ndlp, ndlp->nlp_DID,
9694 ndlp->nlp_DID, ndlp->nlp_flag, 0);
9698 ndlp->nlp_flag |= NLP_LOGO_SND;
9703 ndlp->nlp_flag &= ~NLP_LOGO_SND;
9997 * lpfc_fabric_abort_nport - Abort a ndlp's iocbs from driver fabric iocb list
9998 * @ndlp: pointer to a node-list data structure.
10000 * This routine aborts all the IOCBs associated with an @ndlp from the
10003 * list, removes each IOCB associated with the @ndlp off the list, set the
10007 void lpfc_fabric_abort_nport(struct lpfc_nodelist *ndlp)
10010 struct lpfc_hba *phba = ndlp->phba;
10022 if ((lpfc_check_sli_ndlp(phba, pring, piocb, ndlp))) {
10059 * lpfc_sli4_vport_delete_els_xri_aborted -Remove all ndlp references for vport
10063 * for an ndlp on removal.
10076 if (sglq_entry->ndlp && sglq_entry->ndlp->vport == vport)
10077 sglq_entry->ndlp = NULL;
10102 struct lpfc_nodelist *ndlp;
10113 ndlp = sglq_entry->ndlp;
10114 sglq_entry->ndlp = NULL;
10120 lpfc_set_rrq_active(phba, ndlp,
10151 * @ndlp: nodelist pointer for the impacted node.
10160 struct lpfc_nodelist *ndlp)
10168 if (ndlp->nlp_state != NLP_STE_MAPPED_NODE) {
10171 "rport in state 0x%x\n", ndlp->nlp_state);
10178 shost->host_no, ndlp->nlp_DID,
10179 vport->vpi, ndlp->nlp_rpi, ndlp->nlp_state,
10180 ndlp->nlp_flag);
10186 ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
10187 ndlp->nlp_flag |= NLP_ISSUE_LOGO;
10189 lpfc_unreg_rpi(vport, ndlp);