/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * * Copyright (C) 2017-2025 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * * Copyright (C) 2004-2016 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex. * * www.broadcom.com * * Portions Copyright (C) 2004-2005 Christoph Hellwig * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of version 2 of the GNU General * * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful. * * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND * * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE * * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD * * TO BE LEGALLY INVALID. See the GNU General Public License for * * more details, a copy of which can be found in the file COPYING * * included with this package. *
*******************************************************************/ /* See Fibre Channel protocol T11 FC-LS for details */ #include <linux/blkdev.h> #include <linux/pci.h> #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/delay.h>
/** * lpfc_els_chk_latt - Check host link attention event for a vport * @vport: pointer to a host virtual N_Port data structure. * * This routine checks whether there is an outstanding host link * attention event during the discovery process with the @vport. It is done * by reading the HBA's Host Attention (HA) register. If there is any host * link attention events during this @vport's discovery process, the @vport * shall be marked as FC_ABORT_DISCOVERY, a host link attention clear shall * be issued if the link state is not already in host link cleared state, * and a return code shall indicate whether the host link attention event * had happened. * * Note that, if either the host link is in state LPFC_LINK_DOWN or @vport * state in LPFC_VPORT_READY, the request for checking host link attention * event will be ignored and a return code shall indicate no host link * attention event had happened. * * Return codes * 0 - no host link attention event happened * 1 - host link attention event happened
**/ int
lpfc_els_chk_latt(struct lpfc_vport *vport)
{ struct lpfc_hba *phba = vport->phba;
uint32_t ha_copy;
/* Read the HBA Host Attention Register */ if (lpfc_readl(phba->HAregaddr, &ha_copy)) return 1;
if (!(ha_copy & HA_LATT)) return 0;
/* Pending Link Event during Discovery */
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, "0237 Pending Link Event during " "Discovery: State x%x\n",
phba->pport->port_state);
/* CLEAR_LA should re-enable link attention events and * we should then immediately take a LATT event. The * LATT processing should call lpfc_linkdown() which * will cleanup any left over in-progress discovery * events.
*/
set_bit(FC_ABORT_DISCOVERY, &vport->fc_flag);
if (phba->link_state != LPFC_CLEAR_LA)
lpfc_issue_clear_la(phba, vport);
if (rsp && rsp->la_cmd == ELS_LS_ACC) returntrue; returnfalse;
}
/** * lpfc_prep_els_iocb - Allocate and prepare a lpfc iocb data structure * @vport: pointer to a host virtual N_Port data structure. * @expect_rsp: flag indicating whether response is expected. * @cmd_size: size of the ELS command. * @retry: number of retries to the command when it fails. * @ndlp: pointer to a node-list data structure. * @did: destination identifier. * @elscmd: the ELS command code. * * This routine is used for allocating a lpfc-IOCB data structure from * the driver lpfc-IOCB free-list and prepare the IOCB with the parameters * passed into the routine for discovery state machine to issue an Extended * Link Service (ELS) commands. It is a generic lpfc-IOCB allocation * and preparation routine that is used by all the discovery state machine * routines and the ELS command-specific fields will be later set up by * the individual discovery machine routines after calling this routine * allocating and preparing a generic IOCB data structure. It fills in the * Buffer Descriptor Entries (BDEs), allocates buffers for both command * payload and response payload (if expected). The reference count on the * ndlp is incremented by 1 and the reference to the ndlp is put into * ndlp of the IOCB data structure for this IOCB to hold the ndlp * reference for the command's callback function to access later. * * Return code * Pointer to the newly allocated/prepared els iocb data structure * NULL - when els iocb data structure allocation/preparation failed
**/ struct lpfc_iocbq *
lpfc_prep_els_iocb(struct lpfc_vport *vport, u8 expect_rsp,
u16 cmd_size, u8 retry, struct lpfc_nodelist *ndlp, u32 did,
u32 elscmd)
{ struct lpfc_hba *phba = vport->phba; struct lpfc_iocbq *elsiocb; struct lpfc_dmabuf *pcmd, *prsp, *pbuflist, *bmp; struct ulp_bde64_le *bpl;
u32 timeout = 0;
if (!lpfc_is_link_up(phba)) return NULL;
/* Allocate buffer for command iocb */
elsiocb = lpfc_sli_get_iocbq(phba); if (!elsiocb) return NULL;
/* * If this command is for fabric controller and HBA running * in FIP mode send FLOGI, FDISC and LOGO as FIP frames.
*/ if (did == Fabric_DID &&
test_bit(HBA_FIP_SUPPORT, &phba->hba_flag) &&
(elscmd == ELS_CMD_FLOGI ||
elscmd == ELS_CMD_FDISC ||
elscmd == ELS_CMD_LOGO)) switch (elscmd) { case ELS_CMD_FLOGI:
elsiocb->cmd_flag |=
((LPFC_ELS_ID_FLOGI << LPFC_FIP_ELS_ID_SHIFT)
& LPFC_FIP_ELS_ID_MASK); break; case ELS_CMD_FDISC:
elsiocb->cmd_flag |=
((LPFC_ELS_ID_FDISC << LPFC_FIP_ELS_ID_SHIFT)
& LPFC_FIP_ELS_ID_MASK); break; case ELS_CMD_LOGO:
elsiocb->cmd_flag |=
((LPFC_ELS_ID_LOGO << LPFC_FIP_ELS_ID_SHIFT)
& LPFC_FIP_ELS_ID_MASK); break;
} else
elsiocb->cmd_flag &= ~LPFC_FIP_ELS_ID_MASK;
/* fill in BDEs for command */ /* Allocate buffer for command payload */
pcmd = kmalloc(sizeof(*pcmd), GFP_KERNEL); if (pcmd)
pcmd->virt = lpfc_mbuf_alloc(phba, MEM_PRI, &pcmd->phys); if (!pcmd || !pcmd->virt) goto els_iocb_free_pcmb_exit;
INIT_LIST_HEAD(&pcmd->list);
/* Allocate buffer for response payload */ if (expect_rsp) {
prsp = kmalloc(sizeof(*prsp), GFP_KERNEL); if (prsp)
prsp->virt = lpfc_mbuf_alloc(phba, MEM_PRI,
&prsp->phys); if (!prsp || !prsp->virt) goto els_iocb_free_prsp_exit;
INIT_LIST_HEAD(&prsp->list);
} else {
prsp = NULL;
}
/* Allocate buffer for Buffer ptr list */
pbuflist = kmalloc(sizeof(*pbuflist), GFP_KERNEL); if (pbuflist)
pbuflist->virt = lpfc_mbuf_alloc(phba, MEM_PRI,
&pbuflist->phys); if (!pbuflist || !pbuflist->virt) goto els_iocb_free_pbuf_exit;
INIT_LIST_HEAD(&pbuflist->list);
if (expect_rsp) { switch (elscmd) { case ELS_CMD_FLOGI:
timeout = FF_DEF_RATOV * 2; break; case ELS_CMD_LOGO:
timeout = phba->fc_ratov; break; default:
timeout = phba->fc_ratov * 2;
}
/* Fill SGE for the num bde count */
elsiocb->num_bdes = 2;
}
/** * lpfc_issue_fabric_reglogin - Issue fabric registration login for a vport * @vport: pointer to a host virtual N_Port data structure. * * This routine issues a fabric registration login for a @vport. An * active ndlp node with Fabric_DID must already exist for this @vport. * The routine invokes two mailbox commands to carry out fabric registration * login through the HBA firmware: the first mailbox command requests the * HBA to perform link configuration for the @vport; and the second mailbox * command requests the HBA to perform the actual fabric registration login * with the @vport. * * Return code * 0 - successfully issued fabric registration login for @vport * -ENXIO -- failed to issue fabric registration login for @vport
**/ int
lpfc_issue_fabric_reglogin(struct lpfc_vport *vport)
{ struct lpfc_hba *phba = vport->phba;
LPFC_MBOXQ_t *mbox; struct lpfc_nodelist *ndlp; struct serv_parm *sp; int rc; int err = 0;
mbox->mbox_cmpl = lpfc_mbx_cmpl_fabric_reg_login;
mbox->vport = vport; /* increment the reference count on ndlp to hold reference * for the callback routine.
*/
mbox->ctx_ndlp = lpfc_nlp_get(ndlp); if (!mbox->ctx_ndlp) {
err = 6; goto fail_free_mbox;
}
fail_issue_reg_login: /* decrement the reference count on ndlp just incremented * for the failed mbox command.
*/
lpfc_nlp_put(ndlp);
fail_free_mbox:
lpfc_mbox_rsrc_cleanup(phba, mbox, MBOX_THD_UNLOCKED);
fail:
lpfc_vport_set_state(vport, FC_VPORT_FAILED);
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, "0249 Cannot issue Register Fabric login: Err %d\n",
err); return -ENXIO;
}
/** * lpfc_issue_reg_vfi - Register VFI for this vport's fabric login * @vport: pointer to a host virtual N_Port data structure. * * This routine issues a REG_VFI mailbox for the vfi, vpi, fcfi triplet for * the @vport. This mailbox command is necessary for SLI4 port only. * * Return code * 0 - successfully issued REG_VFI for @vport * A failure code otherwise.
**/ int
lpfc_issue_reg_vfi(struct lpfc_vport *vport)
{ struct lpfc_hba *phba = vport->phba;
LPFC_MBOXQ_t *mboxq = NULL; struct lpfc_nodelist *ndlp; struct lpfc_dmabuf *dmabuf = NULL; int rc = 0;
/* move forward in case of SLI4 FC port loopback test and pt2pt mode */ if ((phba->sli_rev == LPFC_SLI_REV4) &&
!(phba->link_flag & LS_LOOPBACK_MODE) &&
!test_bit(FC_PT2PT, &vport->fc_flag)) {
ndlp = lpfc_findnode_did(vport, Fabric_DID); if (!ndlp) {
rc = -ENODEV; goto fail;
}
}
/** * lpfc_issue_unreg_vfi - Unregister VFI for this vport's fabric login * @vport: pointer to a host virtual N_Port data structure. * * This routine issues a UNREG_VFI mailbox with the vfi, vpi, fcfi triplet for * the @vport. This mailbox command is necessary for SLI4 port only. * * Return code * 0 - successfully issued REG_VFI for @vport * A failure code otherwise.
**/ int
lpfc_issue_unreg_vfi(struct lpfc_vport *vport)
{ struct lpfc_hba *phba = vport->phba;
LPFC_MBOXQ_t *mboxq; int rc;
/** * lpfc_check_clean_addr_bit - Check whether assigned FCID is clean. * @vport: pointer to a host virtual N_Port data structure. * @sp: pointer to service parameter data structure. * * This routine is called from FLOGI/FDISC completion handler functions. * lpfc_check_clean_addr_bit return 1 when FCID/Fabric portname/ Fabric * node nodename is changed in the completion service parameter else return * 0. This function also set flag in the vport data structure to delay * NP_Port discovery after the FLOGI/FDISC completion if Clean address bit * in FLOGI/FDISC response is cleared and FCID/Fabric portname/ Fabric * node nodename is changed in the completion service parameter. * * Return code * 0 - FCID and Fabric Nodename and Fabric portname is not changed. * 1 - FCID or Fabric Nodename or Fabric portname is changed. *
**/ static uint8_t
lpfc_check_clean_addr_bit(struct lpfc_vport *vport, struct serv_parm *sp)
{ struct lpfc_hba *phba = vport->phba;
uint8_t fabric_param_changed = 0;
if ((vport->fc_prevDID != vport->fc_myDID) ||
memcmp(&vport->fabric_portname, &sp->portName, sizeof(struct lpfc_name)) ||
memcmp(&vport->fabric_nodename, &sp->nodeName, sizeof(struct lpfc_name)) ||
(vport->vport_flag & FAWWPN_PARAM_CHG)) {
fabric_param_changed = 1;
vport->vport_flag &= ~FAWWPN_PARAM_CHG;
} /* * Word 1 Bit 31 in common service parameter is overloaded. * Word 1 Bit 31 in FLOGI request is multiple NPort request * Word 1 Bit 31 in FLOGI response is clean address bit * * If fabric parameter is changed and clean address bit is * cleared delay nport discovery if * - vport->fc_prevDID != 0 (not initial discovery) OR * - lpfc_delay_discovery module parameter is set.
*/ if (fabric_param_changed && !sp->cmn.clean_address_bit &&
(vport->fc_prevDID || phba->cfg_delay_discovery))
set_bit(FC_DISC_DELAYED, &vport->fc_flag);
return fabric_param_changed;
}
/** * lpfc_cmpl_els_flogi_fabric - Completion function for flogi to a fabric port * @vport: pointer to a host virtual N_Port data structure. * @ndlp: pointer to a node-list data structure. * @sp: pointer to service parameter data structure. * @ulp_word4: command response value * * This routine is invoked by the lpfc_cmpl_els_flogi() completion callback * function to handle the completion of a Fabric Login (FLOGI) into a fabric * port in a fabric topology. It properly sets up the parameters to the @ndlp * from the IOCB response. It also check the newly assigned N_Port ID to the * @vport against the previously assigned N_Port ID. If it is different from * the previously assigned Destination ID (DID), the lpfc_unreg_rpi() routine * is invoked on all the remaining nodes with the @vport to unregister the * Remote Port Indicators (RPIs). Finally, the lpfc_issue_fabric_reglogin() * is invoked to register login to the fabric. * * Return code * 0 - Success (currently, always return 0)
**/ staticint
lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, struct serv_parm *sp, uint32_t ulp_word4)
{ struct lpfc_hba *phba = vport->phba; struct lpfc_nodelist *np; struct lpfc_nodelist *next_np;
uint8_t fabric_param_changed;
set_bit(FC_FABRIC, &vport->fc_flag);
phba->fc_edtov = be32_to_cpu(sp->cmn.e_d_tov); if (sp->cmn.edtovResolution) /* E_D_TOV ticks are in nanoseconds */
phba->fc_edtov = (phba->fc_edtov + 999999) / 1000000;
if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) { if (sp->cmn.response_multiple_NPort) {
lpfc_printf_vlog(vport, KERN_WARNING,
LOG_ELS | LOG_VPORT, "1816 FLOGI NPIV supported, " "response data 0x%x\n",
sp->cmn.response_multiple_NPort);
spin_lock_irq(&phba->hbalock);
phba->link_flag |= LS_NPIV_FAB_SUPPORTED;
spin_unlock_irq(&phba->hbalock);
} else { /* Because we asked f/w for NPIV it still expects us
to call reg_vnpid at least for the physical host */
lpfc_printf_vlog(vport, KERN_WARNING,
LOG_ELS | LOG_VPORT, "1817 Fabric does not support NPIV " "- configuring single port mode.\n");
spin_lock_irq(&phba->hbalock);
phba->link_flag &= ~LS_NPIV_FAB_SUPPORTED;
spin_unlock_irq(&phba->hbalock);
}
}
/* * For FC we need to do some special processing because of the SLI * Port's default settings of the Common Service Parameters.
*/ if ((phba->sli_rev == LPFC_SLI_REV4) &&
(phba->sli4_hba.lnk_info.lnk_tp == LPFC_LNK_TYPE_FC)) { /* If physical FC port changed, unreg VFI and ALL VPIs / RPIs */ if (fabric_param_changed)
lpfc_unregister_fcf_prep(phba);
/* This should just update the VFI CSPs*/ if (test_bit(FC_VFI_REGISTERED, &vport->fc_flag))
lpfc_issue_reg_vfi(vport);
}
if (fabric_param_changed &&
!test_bit(FC_VPORT_NEEDS_REG_VPI, &vport->fc_flag)) {
/* If our NportID changed, we need to ensure all * remaining NPORTs get unreg_login'ed.
*/
list_for_each_entry_safe(np, next_np,
&vport->fc_nodes, nlp_listp) { if ((np->nlp_state != NLP_STE_NPR_NODE) ||
!test_bit(NLP_NPR_ADISC, &np->nlp_flag)) continue;
clear_bit(NLP_NPR_ADISC, &np->nlp_flag);
lpfc_unreg_rpi(vport, np);
}
lpfc_cleanup_pending_mbox(vport);
if (phba->sli_rev == LPFC_SLI_REV4) {
lpfc_sli4_unreg_all_rpis(vport);
lpfc_mbx_unreg_vpi(vport);
set_bit(FC_VPORT_NEEDS_INIT_VPI, &vport->fc_flag);
}
/* * For SLI3 and SLI4, the VPI needs to be reregistered in * response to this fabric parameter change event.
*/
set_bit(FC_VPORT_NEEDS_REG_VPI, &vport->fc_flag);
} elseif ((phba->sli_rev == LPFC_SLI_REV4) &&
!test_bit(FC_VPORT_NEEDS_REG_VPI, &vport->fc_flag)) { /* * Driver needs to re-reg VPI in order for f/w * to update the MAC address.
*/
lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
lpfc_register_new_vport(phba, vport, ndlp); return 0;
}
/** * lpfc_cmpl_els_flogi_nport - Completion function for flogi to an N_Port * @vport: pointer to a host virtual N_Port data structure. * @ndlp: pointer to a node-list data structure. * @sp: pointer to service parameter data structure. * * This routine is invoked by the lpfc_cmpl_els_flogi() completion callback * function to handle the completion of a Fabric Login (FLOGI) into an N_Port * in a point-to-point topology. First, the @vport's N_Port Name is compared * with the received N_Port Name: if the @vport's N_Port Name is greater than * the received N_Port Name lexicographically, this node shall assign local * N_Port ID (PT2PT_LocalID: 1) and remote N_Port ID (PT2PT_RemoteID: 2) and * will send out Port Login (PLOGI) with the N_Port IDs assigned. Otherwise, * this node shall just wait for the remote node to issue PLOGI and assign * N_Port IDs. * * Return code * 0 - Success * -ENXIO - Fail
**/ staticint
lpfc_cmpl_els_flogi_nport(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, struct serv_parm *sp)
{ struct lpfc_hba *phba = vport->phba;
LPFC_MBOXQ_t *mbox; int rc;
/* If we are pt2pt with another NPort, force NPIV off! */
phba->sli3_options &= ~LPFC_SLI3_NPIV_ENABLED;
/* If physical FC port changed, unreg VFI and ALL VPIs / RPIs */ if ((phba->sli_rev == LPFC_SLI_REV4) && phba->fc_topology_changed) {
lpfc_unregister_fcf_prep(phba);
clear_bit(FC_VFI_REGISTERED, &vport->fc_flag);
phba->fc_topology_changed = 0;
}
if (rc >= 0) { /* This side will initiate the PLOGI */
set_bit(FC_PT2PT_PLOGI, &vport->fc_flag);
/* * N_Port ID cannot be 0, set our Id to LocalID * the other side will be RemoteID.
*/
/* not equal */ if (rc)
vport->fc_myDID = PT2PT_LocalID;
/* If not registered with a transport, decrement ndlp reference * count indicating that ndlp can be safely released when other * references are removed.
*/ if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD)))
lpfc_nlp_put(ndlp);
ndlp = lpfc_findnode_did(vport, PT2PT_RemoteID); if (!ndlp) { /* * Cannot find existing Fabric ndlp, so allocate a * new one
*/
ndlp = lpfc_nlp_init(vport, PT2PT_RemoteID); if (!ndlp) goto fail;
}
memcpy(&ndlp->nlp_portname, &sp->portName, sizeof(struct lpfc_name));
memcpy(&ndlp->nlp_nodename, &sp->nodeName, sizeof(struct lpfc_name)); /* Set state will put ndlp onto node list if not already done */
lpfc_nlp_set_state(vport, ndlp, NLP_STE_NPR_NODE);
set_bit(NLP_NPR_2B_DISC, &ndlp->nlp_flag);
mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); if (!mbox) goto fail;
lpfc_config_link(phba, mbox);
mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link;
mbox->vport = vport;
rc = lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); if (rc == MBX_NOT_FINISHED) {
mempool_free(mbox, phba->mbox_mem_pool); goto fail;
}
} else { /* This side will wait for the PLOGI. If not registered with * a transport, decrement node reference count indicating that * ndlp can be released when other references are removed.
*/ if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD)))
lpfc_nlp_put(ndlp);
/* Start discovery - this should just do CLEAR_LA */
lpfc_disc_start(vport);
}
return 0;
fail: return -ENXIO;
}
/** * lpfc_cmpl_els_flogi - Completion callback function for flogi * @phba: pointer to lpfc hba data structure. * @cmdiocb: pointer to lpfc command iocb data structure. * @rspiocb: pointer to lpfc response iocb data structure. * * This routine is the top-level completion callback function for issuing * a Fabric Login (FLOGI) command. If the response IOCB reported error, * the lpfc_els_retry() routine shall be invoked to retry the FLOGI. If * retry has been made (either immediately or delayed with lpfc_els_retry() * returning 1), the command IOCB will be released and function returned. * If the retry attempt has been given up (possibly reach the maximum * number of retries), one additional decrement of ndlp reference shall be * invoked before going out after releasing the command IOCB. This will * actually release the remote node (Note, lpfc_els_free_iocb() will also * invoke one decrement of ndlp reference count). If no error reported in * the IOCB status, the command Port ID field is used to determine whether * this is a point-to-point topology or a fabric topology: if the Port ID * field is assigned, it is a fabric topology; otherwise, it is a * point-to-point topology. The routine lpfc_cmpl_els_flogi_fabric() or * lpfc_cmpl_els_flogi_nport() shall be invoked accordingly to handle the * specific topology completion conditions.
**/ staticvoid
lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, struct lpfc_iocbq *rspiocb)
{ struct lpfc_vport *vport = cmdiocb->vport; struct lpfc_nodelist *ndlp = cmdiocb->ndlp;
IOCB_t *irsp; struct lpfc_dmabuf *pcmd = cmdiocb->cmd_dmabuf, *prsp; struct serv_parm *sp;
uint16_t fcf_index; int rc;
u32 ulp_status, ulp_word4, tmo; bool flogi_in_retry = false;
/* Check to see if link went down during discovery */ if (lpfc_els_chk_latt(vport)) { /* One additional decrement on node reference count to * trigger the release of the node
*/ if (!(ndlp->fc4_xpt_flags & SCSI_XPT_REGD))
lpfc_nlp_put(ndlp); goto out;
}
/* Check for retry */ if (lpfc_els_retry(phba, cmdiocb, rspiocb)) { /* Address a timing race with dev_loss. If dev_loss * is active on this FPort node, put the initial ref * count back to stop premature node release actions.
*/
lpfc_check_nlp_post_devloss(vport, ndlp);
flogi_in_retry = true; goto out;
}
/* The FLOGI will not be retried. If the FPort node is not * registered with the SCSI transport, remove the initial * reference to trigger node release.
*/ if (!test_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag) &&
!(ndlp->fc4_xpt_flags & SCSI_XPT_REGD))
lpfc_nlp_put(ndlp);
/* If this is not a loop open failure, bail out */ if (!(ulp_status == IOSTAT_LOCAL_REJECT &&
((ulp_word4 & IOERR_PARAM_MASK) ==
IOERR_LOOP_OPEN_FAILURE))) { /* Warn FLOGI status */
lpfc_vlog_msg(vport, KERN_WARNING, LOG_ELS, "0100 FLOGI Status:x%x/x%x " "TMO:x%x\n",
ulp_status, ulp_word4, tmo); goto flogifail;
}
/* FLOGI failed, so there is no fabric */
clear_bit(FC_FABRIC, &vport->fc_flag);
clear_bit(FC_PUBLIC_LOOP, &vport->fc_flag);
clear_bit(FC_PT2PT_NO_NVME, &vport->fc_flag);
/* If private loop, then allow max outstanding els to be * LPFC_MAX_DISC_THREADS (32). Scanning in the case of no * alpa map would take too long otherwise.
*/ if (phba->alpa_map[0] == 0)
vport->cfg_discovery_threads = LPFC_MAX_DISC_THREADS; if ((phba->sli_rev == LPFC_SLI_REV4) &&
(!test_bit(FC_VFI_REGISTERED, &vport->fc_flag) ||
(vport->fc_prevDID != vport->fc_myDID) ||
phba->fc_topology_changed)) { if (test_bit(FC_VFI_REGISTERED, &vport->fc_flag)) { if (phba->fc_topology_changed) {
lpfc_unregister_fcf_prep(phba);
clear_bit(FC_VFI_REGISTERED,
&vport->fc_flag);
phba->fc_topology_changed = 0;
} else {
lpfc_sli4_unreg_all_rpis(vport);
}
}
/* Do not register VFI if the driver aborted FLOGI */ if (!lpfc_error_lost_link(vport, ulp_status, ulp_word4))
lpfc_issue_reg_vfi(vport);
/* * The FLOGI succeeded. Sync the data for the CPU before * accessing it.
*/
prsp = list_get_first(&pcmd->list, struct lpfc_dmabuf, list); if (!prsp) goto out; if (!lpfc_is_els_acc_rsp(prsp)) goto out;
sp = prsp->virt + sizeof(uint32_t);
/* reinitialize the VMID datastructure before returning */ if (lpfc_is_vmid_enabled(phba)) {
lpfc_reinit_vmid(vport);
vport->vmid_flag = 0;
} if (sp->cmn.priority_tagging)
vport->phba->pport->vmid_flag |= (LPFC_VMID_ISSUE_QFPA |
LPFC_VMID_TYPE_PRIO);
/* * Address a timing race with dev_loss. If dev_loss is active on * this FPort node, put the initial ref count back to stop premature * node release actions.
*/
lpfc_check_nlp_post_devloss(vport, ndlp); if (vport->port_state == LPFC_FLOGI) { /* * If Common Service Parameters indicate Nport * we are point to point, if Fport we are Fabric.
*/ if (sp->cmn.fPort)
rc = lpfc_cmpl_els_flogi_fabric(vport, ndlp, sp,
ulp_word4); elseif (!test_bit(HBA_FCOE_MODE, &phba->hba_flag))
rc = lpfc_cmpl_els_flogi_nport(vport, ndlp, sp); else {
lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, "2831 FLOGI response with cleared Fabric " "bit fcf_index 0x%x " "Switch Name %02x%02x%02x%02x%02x%02x%02x%02x " "Fabric Name " "%02x%02x%02x%02x%02x%02x%02x%02x\n",
phba->fcf.current_rec.fcf_indx,
phba->fcf.current_rec.switch_name[0],
phba->fcf.current_rec.switch_name[1],
phba->fcf.current_rec.switch_name[2],
phba->fcf.current_rec.switch_name[3],
phba->fcf.current_rec.switch_name[4],
phba->fcf.current_rec.switch_name[5],
phba->fcf.current_rec.switch_name[6],
phba->fcf.current_rec.switch_name[7],
phba->fcf.current_rec.fabric_name[0],
phba->fcf.current_rec.fabric_name[1],
phba->fcf.current_rec.fabric_name[2],
phba->fcf.current_rec.fabric_name[3],
phba->fcf.current_rec.fabric_name[4],
phba->fcf.current_rec.fabric_name[5],
phba->fcf.current_rec.fabric_name[6],
phba->fcf.current_rec.fabric_name[7]);
lpfc_nlp_put(ndlp);
spin_lock_irq(&phba->hbalock);
phba->fcf.fcf_flag &= ~FCF_DISCOVERY;
spin_unlock_irq(&phba->hbalock);
clear_bit(FCF_RR_INPROG, &phba->hba_flag);
clear_bit(HBA_DEVLOSS_TMO, &phba->hba_flag);
phba->fcf.fcf_redisc_attempted = 0; /* reset */ goto out;
} if (!rc) { /* Mark the FCF discovery process done */ if (test_bit(HBA_FIP_SUPPORT, &phba->hba_flag))
lpfc_printf_vlog(vport, KERN_INFO, LOG_FIP |
LOG_ELS, "2769 FLOGI to FCF (x%x) " "completed successfully\n",
phba->fcf.current_rec.fcf_indx);
spin_lock_irq(&phba->hbalock);
phba->fcf.fcf_flag &= ~FCF_DISCOVERY;
spin_unlock_irq(&phba->hbalock);
clear_bit(FCF_RR_INPROG, &phba->hba_flag);
clear_bit(HBA_DEVLOSS_TMO, &phba->hba_flag);
phba->fcf.fcf_redisc_attempted = 0; /* reset */ goto out;
}
} elseif (vport->port_state > LPFC_FLOGI &&
test_bit(FC_PT2PT, &vport->fc_flag)) { /* * In a p2p topology, it is possible that discovery has * already progressed, and this completion can be ignored. * Recheck the indicated topology.
*/ if (!sp->cmn.fPort) goto out;
}
if (!lpfc_error_lost_link(vport, ulp_status, ulp_word4)) { /* FLOGI failed, so just use loop map to make discovery list */
lpfc_disc_list_loopmap(vport);
/** * lpfc_cmpl_els_link_down - Completion callback function for ELS command * aborted during a link down * @phba: pointer to lpfc hba data structure. * @cmdiocb: pointer to lpfc command iocb data structure. * @rspiocb: pointer to lpfc response iocb data structure. *
*/ staticvoid
lpfc_cmpl_els_link_down(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, struct lpfc_iocbq *rspiocb)
{
uint32_t *pcmd;
uint32_t cmd;
u32 ulp_status, ulp_word4;
/** * lpfc_issue_els_flogi - Issue an flogi iocb command for a vport * @vport: pointer to a host virtual N_Port data structure. * @ndlp: pointer to a node-list data structure. * @retry: number of retries to the command IOCB. * * This routine issues a Fabric Login (FLOGI) Request ELS command * for a @vport. The initiator service parameters are put into the payload * of the FLOGI Request IOCB and the top-level callback function pointer * to lpfc_cmpl_els_flogi() routine is put to the IOCB completion callback * function field. The lpfc_issue_fabric_iocb routine is invoked to send * out FLOGI ELS command with one outstanding fabric IOCB at a time. * * Note that the ndlp reference count will be incremented by 1 for holding the * ndlp and the reference to ndlp will be stored into the ndlp field of * the IOCB for the completion callback function to the FLOGI ELS command. * * Return code * 0 - successfully issued flogi iocb for @vport * 1 - failed to issue flogi iocb for @vport
**/ staticint
lpfc_issue_els_flogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
uint8_t retry)
{ struct lpfc_hba *phba = vport->phba; struct serv_parm *sp; union lpfc_wqe128 *wqe = NULL;
IOCB_t *icmd = NULL; struct lpfc_iocbq *elsiocb; struct lpfc_iocbq defer_flogi_acc;
u8 *pcmd, ct;
uint16_t cmdsize;
uint32_t tmo, did; int rc;
/* Check for a deferred FLOGI ACC condition */ if (phba->defer_flogi_acc.flag) { /* lookup ndlp for received FLOGI */
ndlp = lpfc_findnode_did(vport, 0); if (!ndlp) return 0;
did = vport->fc_myDID;
vport->fc_myDID = Fabric_DID;
/* Decrement the held ndlp that was incremented when the * deferred flogi acc flag was set.
*/ if (phba->defer_flogi_acc.ndlp) {
lpfc_nlp_put(phba->defer_flogi_acc.ndlp);
phba->defer_flogi_acc.ndlp = NULL;
}
vport->fc_myDID = did;
}
return 0;
}
/** * lpfc_els_abort_flogi - Abort all outstanding flogi iocbs * @phba: pointer to lpfc hba data structure. * * This routine aborts all the outstanding Fabric Login (FLOGI) IOCBs * with a @phba. This routine walks all the outstanding IOCBs on the txcmplq * list and issues an abort IOCB commond on each outstanding IOCB that * contains a active Fabric_DID ndlp. Note that this function is to issue * the abort IOCB command on all the outstanding IOCBs, thus when this * function returns, it does not guarantee all the IOCBs are actually aborted. * * Return code * 0 - Successfully issued abort iocb on all outstanding flogis (Always 0)
**/ int
lpfc_els_abort_flogi(struct lpfc_hba *phba)
{ struct lpfc_sli_ring *pring; struct lpfc_iocbq *iocb, *next_iocb; struct lpfc_nodelist *ndlp;
u32 ulp_command;
/* Abort outstanding I/O on NPort <nlp_DID> */
lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY, "0201 Abort outstanding I/O on NPort x%x\n",
Fabric_DID);
pring = lpfc_phba_elsring(phba); if (unlikely(!pring)) return -EIO;
/* * Check the txcmplq for an iocb that matches the nport the driver is * searching for.
*/
spin_lock_irq(&phba->hbalock);
list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list) {
ulp_command = get_job_cmnd(phba, iocb); if (ulp_command == CMD_ELS_REQUEST64_CR) {
ndlp = iocb->ndlp; if (ndlp && ndlp->nlp_DID == Fabric_DID) { if (test_bit(FC_PT2PT, &phba->pport->fc_flag) &&
!test_bit(FC_PT2PT_PLOGI,
&phba->pport->fc_flag))
iocb->fabric_cmd_cmpl =
lpfc_ignore_els_cmpl;
lpfc_sli_issue_abort_iotag(phba, pring, iocb,
NULL);
}
}
} /* Make sure HBA is alive */
lpfc_issue_hb_tmo(phba);
spin_unlock_irq(&phba->hbalock);
return 0;
}
/** * lpfc_initial_flogi - Issue an initial fabric login for a vport * @vport: pointer to a host virtual N_Port data structure. * * This routine issues an initial Fabric Login (FLOGI) for the @vport * specified. It first searches the ndlp with the Fabric_DID (0xfffffe) from * the @vport's ndlp list. If no such ndlp found, it will create an ndlp and * put it into the @vport's ndlp list. If an inactive ndlp found on the list, * it will just be enabled and made active. The lpfc_issue_els_flogi() routine * is then invoked with the @vport and the ndlp to perform the FLOGI for the * @vport. * * Return code * 0 - failed to issue initial flogi for @vport * 1 - successfully issued initial flogi for @vport
**/ int
lpfc_initial_flogi(struct lpfc_vport *vport)
{ struct lpfc_nodelist *ndlp;
/* First look for the Fabric ndlp */
ndlp = lpfc_findnode_did(vport, Fabric_DID); if (!ndlp) { /* Cannot find existing Fabric ndlp, so allocate a new one */
ndlp = lpfc_nlp_init(vport, Fabric_DID); if (!ndlp) return 0; /* Set the node type */
ndlp->nlp_type |= NLP_FABRIC;
/* Put ndlp onto node list */
lpfc_enqueue_node(vport, ndlp);
}
/* Reset the Fabric flag, topology change may have happened */
clear_bit(FC_FABRIC, &vport->fc_flag); if (lpfc_issue_els_flogi(vport, ndlp, 0)) { /* A node reference should be retained while registered with a * transport or dev-loss-evt work is pending. * Otherwise, decrement node reference to trigger release.
*/ if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD)) &&
!test_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag))
lpfc_nlp_put(ndlp); return 0;
} return 1;
}
/** * lpfc_initial_fdisc - Issue an initial fabric discovery for a vport * @vport: pointer to a host virtual N_Port data structure. * * This routine issues an initial Fabric Discover (FDISC) for the @vport * specified. It first searches the ndlp with the Fabric_DID (0xfffffe) from * the @vport's ndlp list. If no such ndlp found, it will create an ndlp and * put it into the @vport's ndlp list. If an inactive ndlp found on the list, * it will just be enabled and made active. The lpfc_issue_els_fdisc() routine * is then invoked with the @vport and the ndlp to perform the FDISC for the * @vport. * * Return code * 0 - failed to issue initial fdisc for @vport * 1 - successfully issued initial fdisc for @vport
**/ int
lpfc_initial_fdisc(struct lpfc_vport *vport)
{ struct lpfc_nodelist *ndlp;
/* First look for the Fabric ndlp */
ndlp = lpfc_findnode_did(vport, Fabric_DID); if (!ndlp) { /* Cannot find existing Fabric ndlp, so allocate a new one */
ndlp = lpfc_nlp_init(vport, Fabric_DID); if (!ndlp) return 0;
/* NPIV is only supported in Fabrics. */
ndlp->nlp_type |= NLP_FABRIC;
/* Put ndlp onto node list */
lpfc_enqueue_node(vport, ndlp);
}
if (lpfc_issue_els_fdisc(vport, ndlp, 0)) { /* A node reference should be retained while registered with a * transport or dev-loss-evt work is pending. * Otherwise, decrement node reference to trigger release.
*/ if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD | NVME_XPT_REGD)) &&
!test_bit(NLP_IN_DEV_LOSS, &ndlp->nlp_flag))
lpfc_nlp_put(ndlp); return 0;
} return 1;
}
/** * lpfc_more_plogi - Check and issue remaining plogis for a vport * @vport: pointer to a host virtual N_Port data structure. * * This routine checks whether there are more remaining Port Logins * (PLOGI) to be issued for the @vport. If so, it will invoke the routine * lpfc_els_disc_plogi() to go through the Node Port Recovery (NPR) nodes * to issue ELS PLOGIs up to the configured discover threads with the * @vport (@vport->cfg_discovery_threads). The function also decrement * the @vport's num_disc_node by 1 if it is not already 0.
**/ void
lpfc_more_plogi(struct lpfc_vport *vport)
{ if (vport->num_disc_nodes)
vport->num_disc_nodes--;
/* Continue discovery with <num_disc_nodes> PLOGIs to go */
lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, "0232 Continue discovery with %d PLOGIs to go " "Data: x%x x%lx x%x\n",
vport->num_disc_nodes,
atomic_read(&vport->fc_plogi_cnt),
vport->fc_flag, vport->port_state); /* Check to see if there are more PLOGIs to be sent */ if (test_bit(FC_NLP_MORE, &vport->fc_flag)) /* go thru NPR nodes and issue any remaining ELS PLOGIs */
lpfc_els_disc_plogi(vport);
return;
}
/** * lpfc_plogi_confirm_nport - Confirm plogi wwpn matches stored ndlp * @phba: pointer to lpfc hba data structure. * @prsp: pointer to response IOCB payload. * @ndlp: pointer to a node-list data structure. * * This routine checks and indicates whether the WWPN of an N_Port, retrieved * from a PLOGI, matches the WWPN that is stored in the @ndlp for that N_POrt. * The following cases are considered N_Port confirmed: * 1) The N_Port is a Fabric ndlp; 2) The @ndlp is on vport list and matches * the WWPN of the N_Port logged into; 3) The @ndlp is not on vport list but * it does not have WWPN assigned either. If the WWPN is confirmed, the * pointer to the @ndlp will be returned. If the WWPN is not confirmed: * 1) if there is a node on vport list other than the @ndlp with the same * WWPN of the N_Port PLOGI logged into, the lpfc_unreg_rpi() will be invoked * on that node to release the RPI associated with the node; 2) if there is * no node found on vport list with the same WWPN of the N_Port PLOGI logged * into, a new node shall be allocated (or activated). In either case, the * parameters of the @ndlp shall be copied to the new_ndlp, the @ndlp shall * be released and the new_ndlp shall be put on to the vport node list and * its pointer returned as the confirmed node. * * Note that before the @ndlp got "released", the keepDID from not-matching * or inactive "new_ndlp" on the vport node list is assigned to the nlp_DID * of the @ndlp. This is because the release of @ndlp is actually to put it * into an inactive state on the vport node list and the vport node list * management algorithm does not allow two node with a same DID. * * Return code * pointer to the PLOGI N_Port @ndlp
**/ staticstruct lpfc_nodelist *
lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp, struct lpfc_nodelist *ndlp)
{ struct lpfc_vport *vport = ndlp->vport; struct lpfc_nodelist *new_ndlp; struct serv_parm *sp;
uint8_t name[sizeof(struct lpfc_name)];
uint32_t keepDID = 0; int rc; unsignedlong keep_nlp_flag = 0, keep_new_nlp_flag = 0;
uint16_t keep_nlp_state;
u32 keep_nlp_fc4_type = 0; struct lpfc_nvme_rport *keep_nrport = NULL; unsignedlong *active_rrqs_xri_bitmap = NULL;
/* Now we find out if the NPort we are logging into, matches the WWPN * we have for that ndlp. If not, we have some work to do.
*/
new_ndlp = lpfc_findnode_wwpn(vport, &sp->portName);
/* return immediately if the WWPN matches ndlp */ if (new_ndlp == ndlp) return ndlp;
if (phba->sli_rev == LPFC_SLI_REV4) {
active_rrqs_xri_bitmap = mempool_alloc(phba->active_rrq_pool,
GFP_KERNEL); if (active_rrqs_xri_bitmap)
memset(active_rrqs_xri_bitmap, 0,
phba->cfg_rrq_xri_bitmap_sz);
}
if (!new_ndlp) {
rc = memcmp(&ndlp->nlp_portname, name, sizeof(struct lpfc_name)); if (!rc) { if (active_rrqs_xri_bitmap)
mempool_free(active_rrqs_xri_bitmap,
phba->active_rrq_pool); return ndlp;
}
new_ndlp = lpfc_nlp_init(vport, ndlp->nlp_DID); if (!new_ndlp) { if (active_rrqs_xri_bitmap)
mempool_free(active_rrqs_xri_bitmap,
phba->active_rrq_pool); return ndlp;
}
} else { if (phba->sli_rev == LPFC_SLI_REV4 &&
active_rrqs_xri_bitmap)
memcpy(active_rrqs_xri_bitmap,
new_ndlp->active_rrqs_xri_bitmap,
phba->cfg_rrq_xri_bitmap_sz);
/* * Unregister from backend if not done yet. Could have been * skipped due to ADISC
*/
lpfc_nlp_unreg_node(vport, new_ndlp);
}
keepDID = new_ndlp->nlp_DID;
/* At this point in this routine, we know new_ndlp will be * returned. however, any previous GID_FTs that were done * would have updated nlp_fc4_type in ndlp, so we must ensure * new_ndlp has the right value.
*/ if (test_bit(FC_FABRIC, &vport->fc_flag)) {
keep_nlp_fc4_type = new_ndlp->nlp_fc4_type;
new_ndlp->nlp_fc4_type = ndlp->nlp_fc4_type;
}
/* if new_ndlp had NLP_UNREG_INP set, keep it */ if (test_bit(NLP_UNREG_INP, &keep_new_nlp_flag))
set_bit(NLP_UNREG_INP, &new_ndlp->nlp_flag); else
clear_bit(NLP_UNREG_INP, &new_ndlp->nlp_flag);
/* if new_ndlp had NLP_RPI_REGISTERED set, keep it */ if (test_bit(NLP_RPI_REGISTERED, &keep_new_nlp_flag))
set_bit(NLP_RPI_REGISTERED, &new_ndlp->nlp_flag); else
clear_bit(NLP_RPI_REGISTERED, &new_ndlp->nlp_flag);
/* * Retain the DROPPED flag. This will take care of the init * refcount when affecting the state change
*/ if (test_bit(NLP_DROPPED, &keep_new_nlp_flag))
set_bit(NLP_DROPPED, &new_ndlp->nlp_flag); else
clear_bit(NLP_DROPPED, &new_ndlp->nlp_flag);
ndlp->nlp_flag = keep_new_nlp_flag;
/* if ndlp had NLP_UNREG_INP set, keep it */ if (test_bit(NLP_UNREG_INP, &keep_nlp_flag))
set_bit(NLP_UNREG_INP, &ndlp->nlp_flag); else
clear_bit(NLP_UNREG_INP, &ndlp->nlp_flag);
/* if ndlp had NLP_RPI_REGISTERED set, keep it */ if (test_bit(NLP_RPI_REGISTERED, &keep_nlp_flag))
set_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag); else
clear_bit(NLP_RPI_REGISTERED, &ndlp->nlp_flag);
/* * Retain the DROPPED flag. This will take care of the init * refcount when affecting the state change
*/ if (test_bit(NLP_DROPPED, &keep_nlp_flag))
set_bit(NLP_DROPPED, &ndlp->nlp_flag); else
clear_bit(NLP_DROPPED, &ndlp->nlp_flag);
/* Move this back to NPR state */ if (memcmp(&ndlp->nlp_portname, name, sizeof(struct lpfc_name)) == 0) { /* The ndlp doesn't have a portname yet, but does have an * NPort ID. The new_ndlp portname matches the Rport's * portname. Reinstantiate the new_ndlp and reset the ndlp.
*/
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, "3179 PLOGI confirm NEW: %x %x\n",
new_ndlp->nlp_DID, keepDID);
/* Two ndlps cannot have the same did on the nodelist. * The KeepDID and keep_nlp_fc4_type need to be swapped * because ndlp is inflight with no WWPN.
*/
ndlp->nlp_DID = keepDID;
ndlp->nlp_fc4_type = keep_nlp_fc4_type;
lpfc_nlp_set_state(vport, ndlp, keep_nlp_state); if (phba->sli_rev == LPFC_SLI_REV4 &&
active_rrqs_xri_bitmap)
memcpy(ndlp->active_rrqs_xri_bitmap,
active_rrqs_xri_bitmap,
phba->cfg_rrq_xri_bitmap_sz);
/* The ndlp and new_ndlp both have WWPNs but are swapping * NPort Ids and attributes.
*/
ndlp->nlp_DID = keepDID;
ndlp->nlp_fc4_type = keep_nlp_fc4_type;
if (phba->sli_rev == LPFC_SLI_REV4 &&
active_rrqs_xri_bitmap)
memcpy(ndlp->active_rrqs_xri_bitmap,
active_rrqs_xri_bitmap,
phba->cfg_rrq_xri_bitmap_sz);
/* Since we are switching over to the new_ndlp, * reset the old ndlp state
*/ if ((ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) ||
(ndlp->nlp_state == NLP_STE_MAPPED_NODE))
keep_nlp_state = NLP_STE_NPR_NODE;
lpfc_nlp_set_state(vport, ndlp, keep_nlp_state);
ndlp->nrport = keep_nrport;
}
/* * If ndlp is not associated with any rport we can drop it here else * let dev_loss_tmo_callbk trigger DEVICE_RM event
*/ if (!ndlp->rport && (ndlp->nlp_state == NLP_STE_NPR_NODE))
lpfc_disc_state_machine(vport, ndlp, NULL, NLP_EVT_DEVICE_RM);
if (phba->sli_rev == LPFC_SLI_REV4 &&
active_rrqs_xri_bitmap)
mempool_free(active_rrqs_xri_bitmap,
phba->active_rrq_pool);
/** * lpfc_end_rscn - Check and handle more rscn for a vport * @vport: pointer to a host virtual N_Port data structure. * * This routine checks whether more Registration State Change * Notifications (RSCNs) came in while the discovery state machine was in * the FC_RSCN_MODE. If so, the lpfc_els_handle_rscn() routine will be * invoked to handle the additional RSCNs for the @vport. Otherwise, the * FC_RSCN_MODE bit will be cleared with the @vport to mark as the end of * handling the RSCNs.
**/ void
lpfc_end_rscn(struct lpfc_vport *vport)
{
if (test_bit(FC_RSCN_MODE, &vport->fc_flag)) { /* * Check to see if more RSCNs came in while we were * processing this one.
*/ if (vport->fc_rscn_id_cnt ||
test_bit(FC_RSCN_DISCOVERY, &vport->fc_flag))
lpfc_els_handle_rscn(vport); else
clear_bit(FC_RSCN_MODE, &vport->fc_flag);
}
}
/** * lpfc_cmpl_els_rrq - Completion handled for els RRQs. * @phba: pointer to lpfc hba data structure. * @cmdiocb: pointer to lpfc command iocb data structure. * @rspiocb: pointer to lpfc response iocb data structure. * * This routine will call the clear rrq function to free the rrq and * clear the xri's bit in the ndlp's xri_bitmap. If the ndlp does not * exist then the clear_rrq is still called because the rrq needs to * be freed.
**/
/* rrq completes to NPort <nlp_DID> */
lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS, "2880 RRQ completes to DID x%x " "Data: x%x x%x x%x x%x x%x\n",
ndlp->nlp_DID, ulp_status, ulp_word4,
get_wqe_tmo(cmdiocb), rrq->xritag, rrq->rxid);
if (ulp_status) { /* Check for retry */ /* Warn RRQ status Don't print the vport to vport rjts */ if (ulp_status != IOSTAT_LS_RJT ||
(((ulp_word4) >> 16 != LSRJT_INVALID_CMD) &&
((ulp_word4) >> 16 != LSRJT_UNABLE_TPC)) ||
(phba)->pport->cfg_log_verbose & LOG_ELS)
lpfc_vlog_msg(vport, KERN_WARNING, LOG_ELS, "2881 RRQ DID:%06X Status:" "x%x/x%x\n",
ndlp->nlp_DID, ulp_status,
ulp_word4);
}
lpfc_clr_rrq_active(phba, rrq->xritag, rrq);
lpfc_els_free_iocb(phba, cmdiocb);
lpfc_nlp_put(ndlp); return;
} /** * lpfc_cmpl_els_plogi - Completion callback function for plogi * @phba: pointer to lpfc hba data structure. * @cmdiocb: pointer to lpfc command iocb data structure. * @rspiocb: pointer to lpfc response iocb data structure. * * This routine is the completion callback function for issuing the Port * Login (PLOGI) command. For PLOGI completion, there must be an active * ndlp on the vport node list that matches the remote node ID from the * PLOGI response IOCB. If such ndlp does not exist, the PLOGI is simply * ignored and command IOCB released. The PLOGI response IOCB status is * checked for error conditions. If there is error status reported, PLOGI * retry shall be attempted by invoking the lpfc_els_retry() routine. * Otherwise, the lpfc_plogi_confirm_nport() routine shall be invoked on * the ndlp and the NLP_EVT_CMPL_PLOGI state to the Discover State Machine * (DSM) is set for this PLOGI completion. Finally, it checks whether * there are additional N_Port nodes with the vport that need to perform * PLOGI. If so, the lpfc_more_plogi() routine is invoked to issue addition * PLOGIs.
**/ staticvoid
lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, struct lpfc_iocbq *rspiocb)
{ struct lpfc_vport *vport = cmdiocb->vport;
IOCB_t *irsp; struct lpfc_nodelist *ndlp, *free_ndlp; struct lpfc_dmabuf *prsp; bool disc; struct serv_parm *sp = NULL;
u32 ulp_status, ulp_word4, did, iotag; bool release_node = false;
--> --------------------
--> maximum size reached
--> --------------------
Messung V0.5
¤ Dauer der Verarbeitung: 0.59 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.