lpfc: Update lpfc to revision 12.8.0.6
Subsystems (2)
cover lpfc: Update lpfc to revision 12.8.0.6
Update lpfc to revision 12.8.0.6
This patch set contains several sets of recoding and refactoring.
A close look was taken at the driver to identify what was causing continual small state machine errors as well other repeatitive issues. Code review showed several things and this is the first set of changes to address the deficiencies.
This set of changes addresses the following items:
Remote Port (node/ndlp) handling in the discovery engine:
It was rather clear that the implementation of refcounting on the remote port node was improper. A refcount going to zero didn't simply release the node. Instead other logic kicked into play. This then caused other code to be placed within the discovery engine to for node removal, ... if it was actually removed. What happened in many cases was the node structure continued to exist beyond the existence of the remote port. It was stored in a node list that could then be matched by re-discovery events. And it also caused multiple structures to exist on the node list for the same device.
So this area has been significantly reworked to go back to a standard ref counting scheme, which of course meant that the base model for when and how to take references had to be re-addressed in the different code flows.
And of course, once one thing starts working right, new issues were seen. This brought out inconsistencies on when the node is "freed" around transport devloss callbacks which led to stale pointer accesses which had to be addressed. Another example was NPIV, where it brought out a different handling for nodes on an NPIV vport vs the same nodes on a standard physical port. So this was corrected as well.
While working on the above, it was rather clear that global host locks were taken for node-specific structure changes and the locking was too coarse. Discovery code was reworked to support a node-level lock.
Native SLI-4 WQE use:
The other area that was rather ugly was sli-4 handling. Discovery and SCSI io paths were implemented as iocb's, which is a SLI-3 construct. The code then, when on SLI-4 hardware, converted to SLI-4 WQEs to then talk to the hardware. However, the nvme path, which is only supported on SLI-4, was only implemnted with WQEs. What it meant was: there were very subtle bugs creeping in as SLI-4 data structures didn't fully overlay on the SLI-3 structures; there was a lot of duplication of code in different areas; and with the duplication came differences and confusion.
This patch set reorganizes the IO paths, which includes abort paths, into a formal division between SLI-3 and SLI-4. The basic style is a common routine is called by a code path, which identifies the hw type, and then vectors into SLI-type specific routines which deal specifically with iocbs or WQEs. With different command types also comes different completion handlers. Although these changes look like a lot of change it is mostly a large refactoring. Old common layers that performed iocb-specific work was moved to SLI-3-specific routines, and routines were created for SLI-4. For SLI-4, a lot of code came from the nvme routines.
The end result is the common routines, with SLI-4 being natively supported for ELS and SCSI & NVME initiator io paths.
The patches were cut against Martin's 5.11/scsi-queue tree
James Smart (17):
lpfc: Rework remote port ref counting and node freeing
lpfc: Rework locations of ndlp reference taking
lpfc: Fix removal of scsi transport device get and put on dev
structure
lpfc: Fix refcounting around scsi and nvme transport apis
lpfc: Rework remote port lock handling
lpfc: Remove ndlp when a PLOGI/ADISC/PRLI/REG_RPI ultimately fails
lpfc: Unsolicited ELS leaves node in incorrect state while dropping it
lpfc: Fix NPIV discovery and Fabric Node detection
lpfc: Fix NPIV Fabric Node reference counting
lpfc: Refactor wqe structure definitions for common use
lpfc: Enable common wqe_template support for both scsi and nvme
lpfc: Enable common send_io interface for SCSI and NVME
lpfc: convert scsi path to use common io submission path
lpfc: convert scsi io completions to sli-3 and sli-4 handlers
lpfc: Convert abort handling to sli-3 and sli-4 handlers
lpfc: Update lpfc version to 12.8.0.6
lpfc: Update changed file copyrights for 2020
drivers/scsi/lpfc/lpfc.h | 9 +- drivers/scsi/lpfc/lpfc_attr.c | 19 +- drivers/scsi/lpfc/lpfc_bsg.c | 79 +- drivers/scsi/lpfc/lpfc_crtn.h | 18 +- drivers/scsi/lpfc/lpfc_ct.c | 81 +- drivers/scsi/lpfc/lpfc_debugfs.c | 8 +- drivers/scsi/lpfc/lpfc_disc.h | 45 +- drivers/scsi/lpfc/lpfc_els.c | 1285 +++++++++++++++------------- drivers/scsi/lpfc/lpfc_hbadisc.c | 754 +++++----------- drivers/scsi/lpfc/lpfc_hw4.h | 12 +- drivers/scsi/lpfc/lpfc_init.c | 121 ++- drivers/scsi/lpfc/lpfc_nportdisc.c | 215 ++--- drivers/scsi/lpfc/lpfc_nvme.c | 326 ++----- drivers/scsi/lpfc/lpfc_nvme.h | 4 +- drivers/scsi/lpfc/lpfc_nvmet.c | 60 +- drivers/scsi/lpfc/lpfc_scsi.c | 1133 ++++++++++++++++++------ drivers/scsi/lpfc/lpfc_sli.c | 659 +++++++++----- drivers/scsi/lpfc/lpfc_sli.h | 7 +- drivers/scsi/lpfc/lpfc_version.h | 4 +- drivers/scsi/lpfc/lpfc_vport.c | 128 +-- 20 files changed, 2719 insertions(+), 2248 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/17 lpfc: Rework remote port ref counting and node freeing
When a remote port is disconnected and disappears, its node structure (ndlp) stays allocated and on a vport node list. While on the list it can be matched, thus requires validation checks on state to be added in numerous code paths. If the node comes back, its possible for there to be multiple node structures for the same device on the vport node list. There is no reason to keep the node structure around after it is no longer in existence, and the current implementation creates problems for itself (multiple nodes) and lots of unnecessary code for state validation.
Additionally, the reference taking on the node structure didn't follow the normal model used by the kernel kref api. It included lots of odd logic to match state with reference count. The combination of this odd logic plus the way it was implicitly used in the discovery engine made its reference taking implementation suspect and extremely hard to follow.
Change the driver such that the the reference taking routines are now normal ref increments/decrements and callout on refcount=0.
With this in place, the rework can be done such that the node structure is fully removed and deallocated when the remote port no longer exists and all references are removed. This removal logic, and the basic ref counting are intrically tied, thus in a single patch.
--- drivers/scsi/lpfc/lpfc_attr.c | 11 +- drivers/scsi/lpfc/lpfc_bsg.c | 2 +- drivers/scsi/lpfc/lpfc_crtn.h | 2 - drivers/scsi/lpfc/lpfc_ct.c | 15 +- drivers/scsi/lpfc/lpfc_debugfs.c | 2 - drivers/scsi/lpfc/lpfc_disc.h | 33 +-- drivers/scsi/lpfc/lpfc_els.c | 210 +++++-------------- drivers/scsi/lpfc/lpfc_hbadisc.c | 321 +++++------------------------ drivers/scsi/lpfc/lpfc_init.c | 63 ++---- drivers/scsi/lpfc/lpfc_nportdisc.c | 2 +- drivers/scsi/lpfc/lpfc_nvme.c | 12 +- drivers/scsi/lpfc/lpfc_nvmet.c | 10 +- drivers/scsi/lpfc/lpfc_scsi.c | 28 ++- drivers/scsi/lpfc/lpfc_sli.c | 32 +-- drivers/scsi/lpfc/lpfc_vport.c | 57 +---- 15 files changed, 170 insertions(+), 630 deletions(-)
drivers/scsi/lpfc/lpfc_attr.c +3 -8
@@ -3627,8 +3627,6 @@ lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport) shost =lpfc_shost_from_vport (vport);spin_lock_irq (shost->host_lock);list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) { -if (!NLP_CHK_NODE_ACT (ndlp)) -continue ;if (ndlp->rport) ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo;#if (IS_ENABLED (CONFIG_NVME_FC ))
@@ -4393,7 +4391,7 @@ sysfs_drvr_stat_data_read(struct file *filp, struct kobject *kobj,spin_lock_irq (shost->host_lock);list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) { -if (!NLP_CHK_NODE_ACT (ndlp) || !ndlp->lat_data) +if (!ndlp->lat_data)continue ;if (nport_index >0 ) {
@@ -5459,8 +5457,6 @@ lpfc_max_scsicmpl_time_set(struct lpfc_vport *vport, int val)spin_lock_irq (shost->host_lock);list_for_each_entry_safe (ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { -if (!NLP_CHK_NODE_ACT (ndlp)) -continue ;if (ndlp->nlp_state ==NLP_STE_UNUSED_NODE )continue ; ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth;
@@ -6969,8 +6965,7 @@ lpfc_get_node_by_target(struct scsi_target *starget)spin_lock_irq (shost->host_lock);/* Search for this, mapped, target ID */ list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) { -if (NLP_CHK_NODE_ACT (ndlp) && - ndlp->nlp_state ==NLP_STE_MAPPED_NODE && +if (ndlp->nlp_state ==NLP_STE_MAPPED_NODE && starget->id == ndlp->nlp_sid) {spin_unlock_irq (shost->host_lock);return ndlp;
@@ -7045,7 +7040,7 @@ lpfc_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)else rport->dev_loss_tmo =1 ; -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp)) { +if (!ndlp) {dev_info (&rport->dev,"Cannot find remote node to " "set rport dev loss tmo, port_id x%x\n" , rport->port_id);
drivers/scsi/lpfc/lpfc_bsg.c +1 -1
@@ -1522,7 +1522,7 @@ lpfc_issue_ct_rsp(struct lpfc_hba *phba, struct bsg_job *job, uint32_t tag, }/* Check if the ndlp is active */ -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp)) { +if (!ndlp) { rc =IOCB_ERROR ; goto issue_ct_rsp_exit; }
drivers/scsi/lpfc/lpfc_crtn.h +0 -2
@@ -88,8 +88,6 @@ void lpfc_mbx_cmpl_reg_vfi(struct lpfc_hba *, LPFC_MBOXQ_t *);void lpfc_unregister_vfi_cmpl (struct lpfc_hba *,LPFC_MBOXQ_t *);void lpfc_enqueue_node (struct lpfc_vport *,struct lpfc_nodelist *);void lpfc_dequeue_node (struct lpfc_vport *,struct lpfc_nodelist *); -struct lpfc_nodelist *lpfc_enable_node (struct lpfc_vport *, -struct lpfc_nodelist *,int );void lpfc_nlp_set_state (struct lpfc_vport *,struct lpfc_nodelist *,int );void lpfc_drop_node (struct lpfc_vport *,struct lpfc_nodelist *);void lpfc_set_disctmo (struct lpfc_vport *);
drivers/scsi/lpfc/lpfc_ct.c +7 -8
@@ -740,7 +740,7 @@ lpfc_prep_node_fc4type(struct lpfc_vport *vport, uint32_t Did, uint8_t fc4_type) ndlp =lpfc_setup_disc_node (vport, Did); -if (ndlp &&NLP_CHK_NODE_ACT (ndlp)) { +if (ndlp) {lpfc_debugfs_disc_trc (vport,LPFC_DISC_TRC_CT ,"Parse GID_FTrsp: did:x%x flg:x%x x%x" , Did, ndlp->nlp_flag, vport->fc_flag);
@@ -791,7 +791,7 @@ lpfc_prep_node_fc4type(struct lpfc_vport *vport, uint32_t Did, uint8_t fc4_type)* Don't even bother to send GFF_ID. */ ndlp =lpfc_findnode_did (vport, Did); -if (ndlp &&NLP_CHK_NODE_ACT (ndlp) && +if (ndlp && (ndlp->nlp_type & (NLP_FCP_TARGET |NLP_NVME_TARGET ))) {if (fc4_type ==FC_TYPE_FCP )
@@ -1437,7 +1437,7 @@ lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,/* This is a target port, unregistered port, or the GFF_ID failed */ ndlp =lpfc_setup_disc_node (vport, did); -if (ndlp &&NLP_CHK_NODE_ACT (ndlp)) { +if (ndlp) { lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY, "0242 Process x%x GFF " "NameServer Rsp Data: x%x x%x x%x\n",
@@ -1872,8 +1872,7 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode,int rc =0 ; ndlp =lpfc_findnode_did (vport, NameServer_DID); -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp) - || ndlp->nlp_state !=NLP_STE_UNMAPPED_NODE ) { +if (!ndlp || ndlp->nlp_state !=NLP_STE_UNMAPPED_NODE ) { rc=1 ; goto ns_cmd_exit; }
@@ -2204,7 +2203,7 @@ lpfc_cmpl_ct_disc_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,lpfc_ct_free_iocb (phba, cmdiocb); ndlp =lpfc_findnode_did (vport,FDMI_DID ); -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp)) +if (!ndlp)return ;/* Check for a CT LS_RJT response */
@@ -2343,7 +2342,7 @@ lpfc_fdmi_change_check(struct lpfc_vport *vport)return ; ndlp =lpfc_findnode_did (vport,FDMI_DID ); -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp)) +if (!ndlp)return ;/* Check if system hostname changed */
@@ -3389,7 +3388,7 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,void (*cmpl)(struct lpfc_hba *,struct lpfc_iocbq *,struct lpfc_iocbq *); -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp)) +if (!ndlp)return 0 ; cmpl = lpfc_cmpl_ct_disc_fdmi;/* called from discovery */
drivers/scsi/lpfc/lpfc_debugfs.c +0 -2
@@ -895,8 +895,6 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size)if (ndlp->nlp_type &NLP_NVME_INITIATOR ) len +=scnprintf (buf + len, size - len,"NVME_INITIATOR " ); - len +=scnprintf (buf+len, size-len,"usgmap:%x " , - ndlp->nlp_usg_map); len +=scnprintf (buf+len, size-len,"refcnt:%x" ,kref_read (&ndlp->kref));if (iocnt) {
drivers/scsi/lpfc/lpfc_disc.h +1 -32
@@ -116,12 +116,6 @@ struct lpfc_nodelist {u8 nlp_nvme_info;/* NVME NSLER Support */ #define NLP_NVME_NSLER 0x1/* NVME NSLER device */ -uint16_t nlp_usg_map;/* ndlp management usage bitmap */ -#define NLP_USG_NODE_ACT_BIT 0x1/* Indicate ndlp is actively used */ -#define NLP_USG_IACT_REQ_BIT 0x2/* Request to inactivate ndlp */ -#define NLP_USG_FREE_REQ_BIT 0x4/* Request to invoke ndlp memory free */ -#define NLP_USG_FREE_ACK_BIT 0x8/* Indicate ndlp memory free invoked */ -struct timer_list nlp_delayfunc;/* Used for delayed ELS cmds */ struct lpfc_hba *phba;struct fc_rport *rport;/* scsi_transport_fc port structure */
@@ -173,6 +167,7 @@ struct lpfc_node_rrq {#define NLP_FCP_PRLI_RJT 0x00002000/* Rport does not support FCP PRLI. */ #define NLP_UNREG_INP 0x00008000/* UNREG_RPI cmd is in progress */ #define NLP_DEFER_RM 0x00010000/* Remove this ndlp if no longer used */ +#define NLP_DROPPED 0x00000008/* Init ref count has been dropped */ #define NLP_DELAY_TMO 0x00020000/* delay timeout is running for node */ #define NLP_NPR_2B_DISC 0x00040000/* node is included in num_disc_nodes */ #define NLP_RCV_PLOGI 0x00080000/* Rcv'ed PLOGI from remote system */
@@ -191,32 +186,6 @@ struct lpfc_node_rrq {#define NLP_FIRSTBURST 0x40000000/* Target supports FirstBurst */ #define NLP_RPI_REGISTERED 0x80000000/* nlp_rpi is valid */ - -/* ndlp usage management macros */ -#define NLP_CHK_NODE_ACT (ndlp) (((ndlp)->nlp_usg_map \ - & NLP_USG_NODE_ACT_BIT) \ - && \ - !((ndlp)->nlp_usg_map \ - & NLP_USG_FREE_ACK_BIT)) -#define NLP_SET_NODE_ACT (ndlp) ((ndlp)->nlp_usg_map \ - |= NLP_USG_NODE_ACT_BIT) -#define NLP_INT_NODE_ACT (ndlp) ((ndlp)->nlp_usg_map \ - = NLP_USG_NODE_ACT_BIT) -#define NLP_CLR_NODE_ACT (ndlp) ((ndlp)->nlp_usg_map \ - &= ~NLP_USG_NODE_ACT_BIT) -#define NLP_CHK_IACT_REQ (ndlp) ((ndlp)->nlp_usg_map \ - & NLP_USG_IACT_REQ_BIT) -#define NLP_SET_IACT_REQ (ndlp) ((ndlp)->nlp_usg_map \ - |= NLP_USG_IACT_REQ_BIT) -#define NLP_CHK_FREE_REQ (ndlp) ((ndlp)->nlp_usg_map \ - & NLP_USG_FREE_REQ_BIT) -#define NLP_SET_FREE_REQ (ndlp) ((ndlp)->nlp_usg_map \ - |= NLP_USG_FREE_REQ_BIT) -#define NLP_CHK_FREE_ACK (ndlp) ((ndlp)->nlp_usg_map \ - & NLP_USG_FREE_ACK_BIT) -#define NLP_SET_FREE_ACK (ndlp) ((ndlp)->nlp_usg_map \ - |= NLP_USG_FREE_ACK_BIT) -/* There are 4 different double linked lists nodelist entries can reside on. * The Port Login (PLOGI) list and Address Discovery (ADISC) list are used * when Link Up discovery or Registered State Change Notification (RSCN)
drivers/scsi/lpfc/lpfc_els.c +53 -157
476 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_hbadisc.c +51 -270
512 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_init.c +14 -49
126 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_nportdisc.c +1 -1
@@ -1907,7 +1907,7 @@ lpfc_rcv_logo_reglogin_issue(struct lpfc_vport *vport,/* software abort if any GID_FT is outstanding */ if (vport->cfg_enable_fc4_type !=LPFC_ENABLE_FCP ) { ns_ndlp =lpfc_findnode_did (vport, NameServer_DID); -if (ns_ndlp &&NLP_CHK_NODE_ACT (ns_ndlp)) +if (ns_ndlp)lpfc_els_abort (phba, ns_ndlp); }
drivers/scsi/lpfc/lpfc_nvme.c +4 -8
@@ -695,7 +695,7 @@ __lpfc_nvme_ls_req(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,int ret;uint16_t ntype, nstate; -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp)) { +if (!ndlp) { lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, "6051 NVMEx LS REQ: Bad NDLP x%px, Failing " "LS Req\n",
@@ -1134,7 +1134,7 @@ lpfc_nvme_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn,* transport is still transitioning. */ ndlp = lpfc_ncmd->ndlp; -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp)) { +if (!ndlp) {lpfc_printf_vlog (vport,KERN_ERR ,LOG_TRACE_EVENT ,"6062 Ignoring NVME cmpl. No ndlp\n" ); goto out_err;
@@ -1316,9 +1316,6 @@ lpfc_nvme_prep_io_cmd(struct lpfc_vport *vport,union lpfc_wqe128 *wqe = &pwqeq->wqe;uint32_t req_len; -if (!NLP_CHK_NODE_ACT (pnode)) -return -EINVAL ; -/* * There are three possibilities here - use scatter-gather segment, use * the single mapping, or neither.
@@ -1670,7 +1667,7 @@ lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport,* transport is still transitioning. */ ndlp = rport->ndlp; -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp)) { +if (!ndlp) { lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE | LOG_NVME_IOERR, "6053 Busy IO, ndlp not ready: rport x%px " "ndlp x%px, DID x%06x\n",
@@ -2503,8 +2500,7 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)* reference would cause a premature cleanup. */ if (prev_ndlp && prev_ndlp != ndlp) { -if ((!NLP_CHK_NODE_ACT (prev_ndlp)) || - (!prev_ndlp->nrport)) +if (!prev_ndlp->nrport)lpfc_nlp_put (prev_ndlp); } }
drivers/scsi/lpfc/lpfc_nvmet.c +5 -5
@@ -1807,7 +1807,7 @@ lpfc_sli4_nvmet_xri_aborted(struct lpfc_hba *phba, rrq_empty =list_empty (&phba->active_rrq_list);spin_unlock_irqrestore (&phba->hbalock, iflag); ndlp =lpfc_findnode_did (phba->pport, ctxp->sid); -if (ndlp &&NLP_CHK_NODE_ACT (ndlp) && +if (ndlp && (ndlp->nlp_state ==NLP_STE_UNMAPPED_NODE || ndlp->nlp_state ==NLP_STE_MAPPED_NODE )) { lpfc_set_rrq_active(phba, ndlp,
@@ -2597,7 +2597,7 @@ lpfc_nvmet_prep_ls_wqe(struct lpfc_hba *phba, } ndlp =lpfc_findnode_did (phba->pport, ctxp->sid); -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp) || +if (!ndlp || ((ndlp->nlp_state !=NLP_STE_UNMAPPED_NODE ) && (ndlp->nlp_state !=NLP_STE_MAPPED_NODE ))) { lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
@@ -2717,7 +2717,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba, } ndlp =lpfc_findnode_did (phba->pport, ctxp->sid); -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp) || +if (!ndlp || ((ndlp->nlp_state !=NLP_STE_UNMAPPED_NODE ) && (ndlp->nlp_state !=NLP_STE_MAPPED_NODE ))) { lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT,
@@ -3249,7 +3249,7 @@ lpfc_nvmet_unsol_issue_abort(struct lpfc_hba *phba, tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private; ndlp =lpfc_findnode_did (phba->pport, sid); -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp) || +if (!ndlp || ((ndlp->nlp_state !=NLP_STE_UNMAPPED_NODE ) && (ndlp->nlp_state !=NLP_STE_MAPPED_NODE ))) {if (tgtp)
@@ -3347,7 +3347,7 @@ lpfc_nvmet_sol_fcp_issue_abort(struct lpfc_hba *phba, } ndlp =lpfc_findnode_did (phba->pport, sid); -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp) || +if (!ndlp || ((ndlp->nlp_state !=NLP_STE_UNMAPPED_NODE ) && (ndlp->nlp_state !=NLP_STE_MAPPED_NODE ))) {atomic_inc (&tgtp->xmt_abort_rsp_error);
drivers/scsi/lpfc/lpfc_scsi.c +12 -16
@@ -3496,7 +3496,7 @@ lpfc_send_scsi_error_event(struct lpfc_hba *phba, struct lpfc_vport *vport,struct lpfc_nodelist *pnode = lpfc_cmd->rdata->pnode;unsigned long flags; -if (!pnode || !NLP_CHK_NODE_ACT (pnode)) +if (!pnode)return ;/* If there is queuefull or busy condition send a scsi event */
@@ -3916,7 +3916,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, fast_path_evt->un.fabric_evt.subcategory = (lpfc_cmd->status ==IOSTAT_NPORT_BSY ) ?LPFC_EVENT_PORT_BUSY :LPFC_EVENT_FABRIC_BUSY ; -if (pnode &&NLP_CHK_NODE_ACT (pnode)) { +if (pnode) {memcpy (&fast_path_evt->un.fabric_evt.wwpn, &pnode->nlp_portname,sizeof (struct lpfc_name ));
@@ -3971,7 +3971,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, }if ((lpfc_cmd->status ==IOSTAT_REMOTE_STOP ) && (phba->sli_rev ==LPFC_SLI_REV4 ) - && (pnode &&NLP_CHK_NODE_ACT (pnode))) { + && pnode) {/* This IO was aborted by the target, we don't * know the rxid and because we did not send the * ABTS we cannot generate and RRQ.
@@ -3986,8 +3986,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,break ; } -if (!pnode || !NLP_CHK_NODE_ACT (pnode) - || (pnode->nlp_state !=NLP_STE_MAPPED_NODE )) +if (!pnode || (pnode->nlp_state !=NLP_STE_MAPPED_NODE )) cmd->result =DID_TRANSPORT_DISRUPTED <<16 |SAM_STAT_BUSY ; }else
@@ -4009,7 +4008,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, time_after(jiffies, lpfc_cmd->start_time + msecs_to_jiffies(vport->cfg_max_scsicmpl_time))) {spin_lock_irqsave (shost->host_lock, flags); -if (pnode &&NLP_CHK_NODE_ACT (pnode)) { +if (pnode) { if (pnode->cmd_qdepth > atomic_read(&pnode->cmd_pending) && (atomic_read(&pnode->cmd_pending) >
@@ -4095,7 +4094,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_io_buf *lpfc_cmd,bool sli4;uint32_t fcpdl; -if (!pnode || !NLP_CHK_NODE_ACT (pnode)) +if (!pnode)return ; lpfc_cmd->fcp_rsp->rspSnsLen =0 ;
@@ -4206,8 +4205,7 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_vport *vport,struct lpfc_rport_data *rdata = lpfc_cmd->rdata;struct lpfc_nodelist *ndlp = rdata->pnode; -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp) || - ndlp->nlp_state !=NLP_STE_MAPPED_NODE ) +if (!ndlp || ndlp->nlp_state !=NLP_STE_MAPPED_NODE )return 0 ; piocbq = &(lpfc_cmd->cur_iocbq);
@@ -4543,7 +4541,7 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)* Catch race where our node has transitioned, but the * transport is still transitioning. */ -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp)) +if (!ndlp) goto out_tgt_busy;if (lpfc_ndlp_check_qdepth (phba, ndlp)) {if (atomic_read (&ndlp->cmd_pending) >= ndlp->cmd_qdepth) {
@@ -5042,7 +5040,7 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct scsi_cmnd *cmnd,int status; rdata =lpfc_rport_data_from_scsi_device (cmnd->device); -if (!rdata || !rdata->pnode || !NLP_CHK_NODE_ACT (rdata->pnode)) +if (!rdata || !rdata->pnode)return FAILED ; pnode = rdata->pnode;
@@ -5146,7 +5144,7 @@ lpfc_chk_tgt_mapped(struct lpfc_vport *vport, struct scsi_cmnd *cmnd)*/ later =msecs_to_jiffies (2 * vport->cfg_devloss_tmo *1000 ) + jiffies;while (time_after (later, jiffies)) { -if (!pnode || !NLP_CHK_NODE_ACT (pnode)) +if (!pnode)return FAILED ;if (pnode->nlp_state ==NLP_STE_MAPPED_NODE )return SUCCESS ;
@@ -5156,8 +5154,7 @@ lpfc_chk_tgt_mapped(struct lpfc_vport *vport, struct scsi_cmnd *cmnd)return FAILED ; pnode = rdata->pnode; } -if (!pnode || !NLP_CHK_NODE_ACT (pnode) || - (pnode->nlp_state !=NLP_STE_MAPPED_NODE )) +if (!pnode || (pnode->nlp_state !=NLP_STE_MAPPED_NODE ))return FAILED ;return SUCCESS ; }
@@ -5401,8 +5398,7 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd) match =0 ;spin_lock_irq (shost->host_lock);list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) { -if (!NLP_CHK_NODE_ACT (ndlp)) -continue ; +if (vport->phba->cfg_fcp2_no_tgt_reset && (ndlp->nlp_fcp_info &NLP_FCP_2_DEVICE ))continue ;
drivers/scsi/lpfc/lpfc_sli.c +11 -21
@@ -860,7 +860,7 @@ lpfc_clr_rrq_active(struct lpfc_hba *phba, {struct lpfc_nodelist *ndlp =NULL ; -if ((rrq->vport) &&NLP_CHK_NODE_ACT (rrq->ndlp)) +if (rrq->vport) ndlp =lpfc_findnode_did (rrq->vport, rrq->nlp_DID);/* The target DID could have been swapped (cable swap)
@@ -1061,12 +1061,6 @@ lpfc_set_rrq_active(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, goto out; } -/* -* set the active bit even if there is no mem available. -*/ -if (NLP_CHK_FREE_REQ (ndlp)) - goto out; -if (ndlp->vport && (ndlp->vport->load_flag &FC_UNLOADING )) goto out;
@@ -1289,6 +1283,11 @@ __lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) (sglq->state != SGL_XRI_ABORTED)) {spin_lock_irqsave (&phba->sli4_hba.sgl_list_lock, iflag); + +/* Check if we can get a reference on ndlp */ +if (sglq->ndlp && !lpfc_nlp_get (sglq->ndlp)) + sglq->ndlp =NULL ; +list_add (&sglq->list, &phba->sli4_hba.lpfc_abts_els_sgl_list); spin_unlock_irqrestore(
@@ -2589,11 +2588,11 @@ lpfc_sli4_unreg_rpi_cmpl_clr(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) vport,KERN_INFO ,LOG_MBOX |LOG_SLI ,"0010 UNREG_LOGIN vpi:%x " "rpi:%x DID:%x defer x%x flg x%x " -"map:%x %px\n" , +"%px\n" , vport->vpi, ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_defer_did, ndlp->nlp_flag, - ndlp->nlp_usg_map, ndlp); + ndlp); ndlp->nlp_flag &= ~NLP_LOGO_ACC ;lpfc_nlp_put (ndlp);
@@ -2852,7 +2851,7 @@ lpfc_nvme_unsol_ls_handler(struct lpfc_hba *phba, struct lpfc_iocbq *piocb)/* validate the source of the LS is logged in */ ndlp =lpfc_findnode_did (phba->pport, sid); -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp) || +if (!ndlp || ((ndlp->nlp_state !=NLP_STE_UNMAPPED_NODE ) && (ndlp->nlp_state !=NLP_STE_MAPPED_NODE ))) { lpfc_printf_log(phba, KERN_ERR, LOG_NVME_DISC,
@@ -10426,7 +10425,7 @@ lpfc_sli_abts_err_handler(struct lpfc_hba *phba,if (!vport) goto err_exit; ndlp =lpfc_findnode_rpi (vport, rpi); -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp)) +if (!ndlp) goto err_exit;if (iocbq->iocb.ulpStatus ==IOSTAT_LOCAL_REJECT )
@@ -10459,7 +10458,7 @@ lpfc_sli4_abts_err_handler(struct lpfc_hba *phba,struct lpfc_vport *vport;uint32_t ext_status =0 ; -if (!ndlp || !NLP_CHK_NODE_ACT (ndlp)) { +if (!ndlp) {lpfc_printf_log (phba,KERN_INFO ,LOG_SLI ,"3115 Node Context not found, driver " "ignoring abts err event\n" );
@@ -17901,15 +17900,6 @@ lpfc_sli4_seq_abort_rsp(struct lpfc_vport *vport, }/* Put ndlp onto pport node list */ lpfc_enqueue_node (vport, ndlp); - }else if (!NLP_CHK_NODE_ACT (ndlp)) { -/* re-setup ndlp without removing from node list */ - ndlp =lpfc_enable_node (vport, ndlp,NLP_STE_UNUSED_NODE ); -if (!ndlp) { -lpfc_printf_vlog (vport,KERN_WARNING ,LOG_ELS , -"3275 Failed to active ndlp found " -"for oxid:x%x SID:x%x\n" , oxid, sid); -return ; - } }/* Allocate buffer for rsp iocb */
drivers/scsi/lpfc/lpfc_vport.c +7 -50
131 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 2/17 lpfc: Rework locations of ndlp reference taking
In reply to James SmartNow that the driver has gone to a normal ref interface (with no odd logic) the discovery logic needs to be updated to reworked so that it properly takes references when it should and give them up when it should.
Rework the driver for the following get/put model:
- Move gets to just before an IO is issued. Add gets for places where an IO was issued without one.
- Ensure that failures from lpfc_nlp_get() are handled by the driver.
- Check and fix the placement of lpfc_nlp_puts relative to io completions.
Note: some of these paths may not release the reference on the exact io completion as the reference is held as the code takes another step in the discovery thread and which may cause another io to be issued.
- Rearrange some code for error processing and calling lpfc_nlp_put.
- Fix some places of incorrect reference freeing that was causing the premature releasing of the structure.
- Nvmet plogi handling performs unreg_rpi's. The reference counts were unbalanced resulting in premature node removal. In some cases this caused loss of node discovery. Corrected the reftaking around nvmet plogis.
Nodes that experience devloss now get released from the node list now that there is a proper reference taking.
--- drivers/scsi/lpfc/lpfc_bsg.c | 71 +-- drivers/scsi/lpfc/lpfc_ct.c | 56 ++- drivers/scsi/lpfc/lpfc_disc.h | 3 +- drivers/scsi/lpfc/lpfc_els.c | 693 +++++++++++++++++++---------- drivers/scsi/lpfc/lpfc_hbadisc.c | 12 +- drivers/scsi/lpfc/lpfc_nportdisc.c | 28 +- drivers/scsi/lpfc/lpfc_nvme.c | 13 +- drivers/scsi/lpfc/lpfc_sli.c | 9 +- 8 files changed, 569 insertions(+), 316 deletions(-)
drivers/scsi/lpfc/lpfc_bsg.c +41 -30
@@ -329,7 +329,7 @@ lpfc_bsg_send_mgmt_cmd_cmp(struct lpfc_hba *phba,spin_unlock_irqrestore (&phba->hbalock, flags); iocb = &dd_data->context_un.iocb; - ndlp = iocb->ndlp; + ndlp = iocb->cmdiocbq->context_un.ndlp; rmp = iocb->rmp; cmp = cmdiocbq->context2; bmp = cmdiocbq->context3;
@@ -366,8 +366,8 @@ lpfc_bsg_send_mgmt_cmd_cmp(struct lpfc_hba *phba,lpfc_free_bsg_buffers (phba, rmp);lpfc_mbuf_free (phba, bmp->virt, bmp->phys);kfree (bmp); -lpfc_sli_release_iocbq (phba, cmdiocbq);lpfc_nlp_put (ndlp); +lpfc_sli_release_iocbq (phba, cmdiocbq);kfree (dd_data);/* Complete the job if the job is still active */
@@ -408,6 +408,9 @@ lpfc_bsg_send_mgmt_cmd(struct bsg_job *job)/* in case no data is transferred */ bsg_reply->reply_payload_rcv_len =0 ; +if (ndlp->nlp_flag &NLP_ELS_SND_MASK ) +return -ENODEV ; +/* allocate our bsg tracking structure */ dd_data =kmalloc (sizeof (struct bsg_job_data ),GFP_KERNEL );if (!dd_data) {
@@ -417,20 +420,10 @@ lpfc_bsg_send_mgmt_cmd(struct bsg_job *job) goto no_dd_data; } -if (!lpfc_nlp_get (ndlp)) { - rc = -ENODEV ; - goto no_ndlp; - } - -if (ndlp->nlp_flag &NLP_ELS_SND_MASK ) { - rc = -ENODEV ; - goto free_ndlp; - } - cmdiocbq =lpfc_sli_get_iocbq (phba);if (!cmdiocbq) { rc = -ENOMEM ; - goto free_ndlp; + goto free_dd; } cmd = &cmdiocbq->iocb;
@@ -496,11 +489,10 @@ lpfc_bsg_send_mgmt_cmd(struct bsg_job *job) cmdiocbq->context1 = dd_data; cmdiocbq->context2 = cmp; cmdiocbq->context3 = bmp; - cmdiocbq->context_un.ndlp = ndlp; + dd_data->type =TYPE_IOCB ; dd_data->set_job = job; dd_data->context_un.iocb.cmdiocbq = cmdiocbq; - dd_data->context_un.iocb.ndlp = ndlp; dd_data->context_un.iocb.rmp = rmp; job->dd_data = dd_data;
@@ -514,8 +506,13 @@ lpfc_bsg_send_mgmt_cmd(struct bsg_job *job)readl (phba->HCregaddr);/* flush */ } - iocb_stat =lpfc_sli_issue_iocb (phba,LPFC_ELS_RING , cmdiocbq,0 ); + cmdiocbq->context_un.ndlp =lpfc_nlp_get (ndlp); +if (!cmdiocbq->context_un.ndlp) { + rc = -ENODEV ; + goto free_rmp; + } + iocb_stat =lpfc_sli_issue_iocb (phba,LPFC_ELS_RING , cmdiocbq,0 );if (iocb_stat ==IOCB_SUCCESS ) {spin_lock_irqsave (&phba->hbalock, flags);/* make sure the I/O had not been completed yet */
@@ -532,7 +529,7 @@ lpfc_bsg_send_mgmt_cmd(struct bsg_job *job) }/* iocb failed so cleanup */ - job->dd_data =NULL ; +lpfc_nlp_put (ndlp); free_rmp:lpfc_free_bsg_buffers (phba, rmp);
@@ -544,9 +541,7 @@ lpfc_bsg_send_mgmt_cmd(struct bsg_job *job)kfree (bmp); free_cmdiocbq:lpfc_sli_release_iocbq (phba, cmdiocbq); -free_ndlp: -lpfc_nlp_put (ndlp); -no_ndlp: +free_dd:kfree (dd_data); no_dd_data:/* make error code available to userspace */
@@ -640,8 +635,9 @@ lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba, } } -lpfc_nlp_put (ndlp);lpfc_els_free_iocb (phba, cmdiocbq); + +lpfc_nlp_put (ndlp);kfree (dd_data);/* Complete the job if the job is still active */
@@ -718,15 +714,14 @@ lpfc_bsg_rport_els(struct bsg_job *job) goto release_ndlp; } - rpi = ndlp->nlp_rpi; -/* Transfer the request payload to allocated command dma buffer */ -sg_copy_to_buffer (job->request_payload.sg_list, job->request_payload.sg_cnt, ((struct lpfc_dmabuf *)cmdiocbq->context2)->virt, cmdsize); + rpi = ndlp->nlp_rpi; +if (phba->sli_rev ==LPFC_SLI_REV4 ) cmdiocbq->iocb.ulpContext = phba->sli4_hba.rpi_ids[rpi];else
@@ -752,8 +747,13 @@ lpfc_bsg_rport_els(struct bsg_job *job)readl (phba->HCregaddr);/* flush */ } - rc =lpfc_sli_issue_iocb (phba,LPFC_ELS_RING , cmdiocbq,0 ); + cmdiocbq->context1 =lpfc_nlp_get (ndlp); +if (!cmdiocbq->context1) { + rc = -EIO ; + goto linkdown_err; + } + rc =lpfc_sli_issue_iocb (phba,LPFC_ELS_RING , cmdiocbq,0 );if (rc ==IOCB_SUCCESS ) {spin_lock_irqsave (&phba->hbalock, flags);/* make sure the I/O had not been completed/released */
@@ -769,11 +769,9 @@ lpfc_bsg_rport_els(struct bsg_job *job) rc = -EIO ; } -/* iocb failed so cleanup */ - job->dd_data =NULL ; +/* IO issue failed. Cleanup resources. */ linkdown_err: - cmdiocbq->context1 = ndlp;lpfc_els_free_iocb (phba, cmdiocbq); release_ndlp:
@@ -1471,6 +1469,15 @@ lpfc_issue_ct_rsp(struct lpfc_hba *phba, struct bsg_job *job, uint32_t tag,unsigned long flags;uint32_t creg_val; + ndlp =lpfc_findnode_did (phba->pport, phba->ct_ctx[tag].SID); +if (!ndlp) { +lpfc_printf_log (phba,KERN_WARNING ,LOG_ELS , +"2721 ndlp null for oxid %x SID %x\n" , + phba->ct_ctx[tag].rxid, + phba->ct_ctx[tag].SID); +return IOCB_ERROR ; + } +/* allocate our bsg tracking structure */ dd_data =kmalloc (sizeof (struct bsg_job_data ),GFP_KERNEL );if (!dd_data) {
@@ -1561,7 +1568,11 @@ lpfc_issue_ct_rsp(struct lpfc_hba *phba, struct bsg_job *job, uint32_t tag, dd_data->type =TYPE_IOCB ; dd_data->set_job = job; dd_data->context_un.iocb.cmdiocbq = ctiocb; - dd_data->context_un.iocb.ndlp = ndlp; + dd_data->context_un.iocb.ndlp =lpfc_nlp_get (ndlp); +if (!dd_data->context_un.iocb.ndlp) { + rc = -IOCB_ERROR ; + goto issue_ct_rsp_exit; + } dd_data->context_un.iocb.rmp =NULL ; job->dd_data = dd_data;
@@ -1576,7 +1587,6 @@ lpfc_issue_ct_rsp(struct lpfc_hba *phba, struct bsg_job *job, uint32_t tag, } rc =lpfc_sli_issue_iocb (phba,LPFC_ELS_RING , ctiocb,0 ); -if (rc ==IOCB_SUCCESS ) {spin_lock_irqsave (&phba->hbalock, flags);/* make sure the I/O had not been completed/released */
@@ -1590,6 +1600,7 @@ lpfc_issue_ct_rsp(struct lpfc_hba *phba, struct bsg_job *job, uint32_t tag,/* iocb failed so cleanup */ job->dd_data =NULL ; +lpfc_nlp_put (ndlp); issue_ct_rsp_exit:lpfc_sli_release_iocbq (phba, ctiocb);
drivers/scsi/lpfc/lpfc_ct.c +32 -24
172 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_disc.h +1 -2
@@ -166,8 +166,7 @@ struct lpfc_node_rrq {#define NLP_NVMET_RECOV 0x00001000/* NVMET auditing node for recovery. */ #define NLP_FCP_PRLI_RJT 0x00002000/* Rport does not support FCP PRLI. */ #define NLP_UNREG_INP 0x00008000/* UNREG_RPI cmd is in progress */ -#define NLP_DEFER_RM 0x00010000/* Remove this ndlp if no longer used */ -#define NLP_DROPPED 0x00000008/* Init ref count has been dropped */ +#define NLP_DROPPED 0x00010000/* Init ref count has been dropped */ #define NLP_DELAY_TMO 0x00020000/* delay timeout is running for node */ #define NLP_NPR_2B_DISC 0x00040000/* node is included in num_disc_nodes */ #define NLP_RCV_PLOGI 0x00080000/* Rcv'ed PLOGI from remote system */
drivers/scsi/lpfc/lpfc_els.c +453 -240
1,286 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_hbadisc.c +9 -3
@@ -178,7 +178,7 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)/* We need to hold the node by incrementing the reference * count until this queued work is done */ - evtp->evt_arg1 =lpfc_nlp_get (ndlp); + evtp->evt_arg1 =lpfc_nlp_get (ndlp);spin_lock_irqsave (&phba->hbalock, iflags);if (evtp->evt_arg1) {
@@ -4214,6 +4214,13 @@ lpfc_register_remote_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) rport->supported_classes = ndlp->nlp_class_sup; rdata = rport->dd_data; rdata->pnode =lpfc_nlp_get (ndlp); +if (!rdata->pnode) { +dev_warn (&phba->pcidev->dev, +"Warning - node ref failed. Unreg rport\n" ); +fc_remote_port_delete (rport); + ndlp->rport =NULL ; +return ; + }if (ndlp->nlp_type &NLP_FCP_TARGET ) rport_ids.roles |=FC_PORT_ROLE_FCP_TARGET ;
@@ -5157,8 +5164,7 @@ lpfc_nlp_remove(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)int rc;lpfc_cancel_retry_delay_tmo (vport, ndlp); -if ((ndlp->nlp_flag &NLP_DEFER_RM ) && - !(ndlp->nlp_flag &NLP_REG_LOGIN_SEND ) && +if (!(ndlp->nlp_flag &NLP_REG_LOGIN_SEND ) && !(ndlp->nlp_flag &NLP_RPI_REGISTERED ) && phba->sli_rev !=LPFC_SLI_REV4 ) {/* For this case we need to cleanup the default rpi
drivers/scsi/lpfc/lpfc_nportdisc.c +14 -14
@@ -357,7 +357,6 @@ lpfc_defer_acc_rsp(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)* Complete the unreg rpi mbx request, and update flags. * This will also restart any deferred events. */ -lpfc_nlp_get (ndlp);lpfc_sli4_unreg_rpi_cmpl_clr (phba, pmb);if (!piocb) {
@@ -365,7 +364,7 @@ lpfc_defer_acc_rsp(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) "4578 PLOGI ACC fail\n");if (mbox)mempool_free (mbox, phba->mbox_mem_pool); - goto out; +return ; } rc =lpfc_els_rsp_acc (vport,ELS_CMD_PLOGI , piocb, ndlp, mbox);
@@ -376,8 +375,6 @@ lpfc_defer_acc_rsp(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)mempool_free (mbox, phba->mbox_mem_pool); }kfree (piocb); -out: -lpfc_nlp_put (ndlp); } static int
@@ -588,7 +585,10 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, rpi = phba->sli4_hba.rpi_ids[ndlp->nlp_rpi];lpfc_unreg_login (phba, vport->vpi, rpi, link_mbox); link_mbox->vport = vport; - link_mbox->ctx_ndlp = ndlp; + link_mbox->ctx_ndlp =lpfc_nlp_get (ndlp); +if (!link_mbox->ctx_ndlp) + goto out; + link_mbox->mbox_cmpl = lpfc_defer_acc_rsp; if (((ndlp->nlp_DID & Fabric_DID_MASK) != Fabric_DID_MASK) &&
@@ -1104,7 +1104,11 @@ lpfc_release_rpi(struct lpfc_hba *phba, struct lpfc_vport *vport,lpfc_unreg_login (phba, vport->vpi, rpi, pmb); pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; pmb->vport = vport; - pmb->ctx_ndlp = ndlp; + pmb->ctx_ndlp =lpfc_nlp_get (ndlp); +if (!pmb->ctx_ndlp) { +mempool_free (pmb, phba->mbox_mem_pool); +return ; + }if (((ndlp->nlp_DID & Fabric_DID_MASK) != Fabric_DID_MASK) && (!(vport->fc_flag &FC_OFFLINE_MODE )))
@@ -1342,7 +1346,6 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, uint32_t evt) {struct lpfc_hba *phba = vport->phba; -struct Scsi_Host *shost =lpfc_shost_from_vport (vport);struct lpfc_iocbq *cmdiocb, *rspiocb;struct lpfc_dmabuf *pcmd, *prsp, *mp;uint32_t *lp;
@@ -1488,7 +1491,11 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, ndlp->nlp_flag |=NLP_REG_LOGIN_SEND ; mbox->mbox_cmpl = lpfc_mbx_cmpl_reg_login; } + mbox->ctx_ndlp =lpfc_nlp_get (ndlp); +if (!mbox->ctx_ndlp) + goto out; + mbox->vport = vport;if (lpfc_sli_issue_mbox (phba, mbox,MBX_NOWAIT ) !=MBX_NOT_FINISHED ) {
@@ -1537,9 +1544,6 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, ndlp->nlp_prev_state = ndlp->nlp_state;lpfc_nlp_set_state (vport, ndlp,NLP_STE_NPR_NODE ); -spin_lock_irq (shost->host_lock); - ndlp->nlp_flag |=NLP_DEFER_RM ; -spin_unlock_irq (shost->host_lock);return NLP_STE_FREED_NODE ; }
@@ -2797,16 +2801,12 @@ lpfc_cmpl_plogi_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, {struct lpfc_iocbq *cmdiocb, *rspiocb;IOCB_t *irsp; -struct Scsi_Host *shost =lpfc_shost_from_vport (vport); cmdiocb = (struct lpfc_iocbq *) arg; rspiocb = cmdiocb->context_un.rsp_iocb; irsp = &rspiocb->iocb;if (irsp->ulpStatus) { -spin_lock_irq (shost->host_lock); - ndlp->nlp_flag |=NLP_DEFER_RM ; -spin_unlock_irq (shost->host_lock);return NLP_STE_FREED_NODE ; }return ndlp->nlp_state;
drivers/scsi/lpfc/lpfc_nvme.c +12 -1
@@ -567,6 +567,13 @@ lpfc_nvme_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp,/* Save for completion so we can release these resources */ genwqe->context1 =lpfc_nlp_get (ndlp); +if (!genwqe->context1) { +dev_warn (&phba->pcidev->dev, +"Warning: Failed node ref, not sending LS_REQ\n" ); +lpfc_sli_release_iocbq (phba, genwqe); +return 1 ; + } + genwqe->context2 = (uint8_t *)pnvme_lsreq;/* Fill in payload, bp points to frame payload */
@@ -2466,7 +2473,11 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)spin_unlock_irq (&vport->phba->hbalock); }else {spin_unlock_irq (&vport->phba->hbalock); -lpfc_nlp_get (ndlp); +if (!lpfc_nlp_get (ndlp)) { +dev_warn (&vport->phba->pcidev->dev, +"Warning - No node ref - exit register\n" ); +return 0 ; + } } ret =nvme_fc_register_remoteport (localport, &rpinfo, &remote_port);
drivers/scsi/lpfc/lpfc_sli.c +7 -2
@@ -2594,7 +2594,6 @@ lpfc_sli4_unreg_rpi_cmpl_clr(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) ndlp->nlp_flag, ndlp); ndlp->nlp_flag &= ~NLP_LOGO_ACC ; -lpfc_nlp_put (ndlp);/* Check to see if there are any deferred * events to process
@@ -2617,6 +2616,8 @@ lpfc_sli4_unreg_rpi_cmpl_clr(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) }else {__lpfc_sli_rpi_release (vport, ndlp); } + +lpfc_nlp_put (ndlp); } } }
@@ -11352,11 +11353,11 @@ lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,"x%x x%x x%x\n" , irsp->ulpIoTag, irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpTimeout); +lpfc_nlp_put ((struct lpfc_nodelist *)cmdiocb->context1);if (cmdiocb->iocb.ulpCommand ==CMD_GEN_REQUEST64_CR )lpfc_ct_free_iocb (phba, cmdiocb);else lpfc_els_free_iocb (phba, cmdiocb); -return ; }/**
@@ -17924,6 +17925,10 @@ lpfc_sli4_seq_abort_rsp(struct lpfc_vport *vport, icmd->ulpClass =CLASS3 ; icmd->ulpContext = phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]; ctiocb->context1 =lpfc_nlp_get (ndlp); +if (!ctiocb->context1) { +lpfc_sli_release_iocbq (phba, ctiocb); +return ; + } ctiocb->vport = phba->pport; ctiocb->iocb_cmpl = lpfc_sli4_seq_abort_rsp_cmpl;
Signature · 1 line
2.26.2
PATCH 3/17 lpfc: Fix removal of scsi transport device get and put on dev structure
In reply to James SmartThe lpfc driver is calling get_device and put_device on scsi_fc_transport device structure. When this code was removed, the driver triggered an Oops in "scsi_is_host_dev" when the first scsi target was unregistered from the transport.
The reason the calls were necessary is that the driver is calling scsi_remove_host too early, before the target rports are unregistered and the scsi devices disconnected from the scsi_host. The fc_host was torn down during fc_remove_host.
Fix by moving the lpfc_pci_remove_one_s3/s4 calls to scsi_remove_host to after the nodes are cleaned up. Remove the get_device and put_device calls and the supporting code.
--- drivers/scsi/lpfc/lpfc_els.c | 4 ---- drivers/scsi/lpfc/lpfc_hbadisc.c | 12 ++---------- drivers/scsi/lpfc/lpfc_init.c | 14 +++++++++----- drivers/scsi/lpfc/lpfc_vport.c | 6 ++++-- 4 files changed, 15 insertions(+), 21 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +0 -4
@@ -1601,7 +1601,6 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,u32 keep_nlp_fc4_type =0 ;struct lpfc_nvme_rport *keep_nrport =NULL ;int put_node; -int put_rport;unsigned long *active_rrqs_xri_bitmap =NULL ;/* Fabric nodes can have the same WWPN so we don't bother searching
@@ -1804,13 +1803,10 @@ lpfc_plogi_confirm_nport(struct lpfc_hba *phba, uint32_t *prsp,if (rport) { rdata = rport->dd_data; put_node = rdata->pnode !=NULL ; - put_rport = ndlp->rport !=NULL ; rdata->pnode =NULL ; ndlp->rport =NULL ;if (put_node)lpfc_nlp_put (ndlp); -if (put_rport) -put_device (&rport->dev); } }
drivers/scsi/lpfc/lpfc_hbadisc.c +2 -10
@@ -117,7 +117,6 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)struct lpfc_hba *phba;struct lpfc_work_evt *evtp;int put_node; -int put_rport;unsigned long iflags; rdata = rport->dd_data;
@@ -142,13 +141,10 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)*/ if (vport->load_flag &FC_UNLOADING ) { put_node = rdata->pnode !=NULL ; - put_rport = ndlp->rport !=NULL ; rdata->pnode =NULL ; ndlp->rport =NULL ;if (put_node)lpfc_nlp_put (ndlp); -if (put_rport) -put_device (&rport->dev);return ; }
@@ -263,7 +259,6 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp) ndlp->rport =NULL ;if (put_node)lpfc_nlp_put (ndlp); -put_device (&rport->dev);return fcf_inuse; }
@@ -284,7 +279,6 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp) ndlp->rport =NULL ;if (put_node)lpfc_nlp_put (ndlp); -put_device (&rport->dev);if (ndlp->nlp_type &NLP_FABRIC )return fcf_inuse;
@@ -4190,8 +4184,6 @@ lpfc_register_remote_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)lpfc_nlp_put (ndlp); rdata->pnode =NULL ; } -/* drop reference for earlier registeration */ -put_device (&rport->dev); } lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_RPORT,
@@ -4203,7 +4195,7 @@ lpfc_register_remote_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)return ; ndlp->rport = rport =fc_remote_port_add (shost,0 , &rport_ids); -if (!rport || !get_device (&rport->dev)) { +if (!rport) {dev_printk (KERN_WARNING , &phba->pcidev->dev,"Warning: fc_remote_port_add failed\n" );return ;
@@ -4244,6 +4236,7 @@ lpfc_register_remote_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) (rport->scsi_target_id < LPFC_MAX_TARGET)) { ndlp->nlp_sid = rport->scsi_target_id; } +return ; }
@@ -5217,7 +5210,6 @@ lpfc_nlp_remove(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) rdata = rport->dd_data; rdata->pnode =NULL ; ndlp->rport =NULL ; -put_device (&rport->dev); } }
drivers/scsi/lpfc/lpfc_init.c +9 -5
@@ -12499,12 +12499,15 @@ lpfc_pci_remove_one_s3(struct pci_dev *pdev) }lpfc_destroy_vport_work_array (phba, vports); -/* Remove FC host and then SCSI host with the physical port */ +/* Remove FC host with the physical port */ fc_remove_host (shost); -scsi_remove_host (shost); +/* Clean up all nodes, mailboxes and IOs. */ lpfc_cleanup (vport); +/* Remove the shost now that the devices connections are lost. */ +scsi_remove_host (shost); +/* * Bring down the SLI Layer. This step disable all interrupts, * clears the rings, discards all mailbox commands, and resets
@@ -13342,7 +13345,6 @@ lpfc_pci_remove_one_s4(struct pci_dev *pdev) vport->load_flag |=FC_UNLOADING ;spin_unlock_irq (&phba->hbalock); -/* Free the HBA sysfs attributes */ lpfc_free_sysfs_attr (vport);/* Release all the vports against this physical port */
@@ -13355,9 +13357,8 @@ lpfc_pci_remove_one_s4(struct pci_dev *pdev) }lpfc_destroy_vport_work_array (phba, vports); -/* Remove FC host and then SCSI host with the physical port */ +/* Remove FC host with the physical port */ fc_remove_host (shost); -scsi_remove_host (shost);/* Perform ndlp cleanup on the physical port. The nvme and nvmet * localports are destroyed after to cleanup all transport memory.
@@ -13370,6 +13371,9 @@ lpfc_pci_remove_one_s4(struct pci_dev *pdev)if (phba->cfg_xri_rebalancing)lpfc_destroy_multixri_pools (phba); +/* Remove the shost now that the devices connections are lost. */ +scsi_remove_host (shost); +/* * Bring down the SLI Layer. This step disables all interrupts, * clears the rings, discards all mailbox commands, and resets
drivers/scsi/lpfc/lpfc_vport.c +4 -2
@@ -664,9 +664,8 @@ lpfc_vport_delete(struct fc_vport *fc_vport) ns_ndlp_referenced = true; } -/* Remove FC host and then SCSI host with the vport */ +/* Remove FC host to break driver binding. */ fc_remove_host (shost); -scsi_remove_host (shost); ndlp =lpfc_findnode_did (phba->pport, Fabric_DID);
@@ -747,6 +746,9 @@ lpfc_vport_delete(struct fc_vport *fc_vport) }lpfc_cleanup (vport); + +/* Remove scsi host now. The nodes are cleaned up. */ +scsi_remove_host (shost);lpfc_sli_host_down (vport);lpfc_stop_vport_timers (vport);
Signature · 1 line
2.26.2
PATCH 4/17 lpfc: Fix refcounting around scsi and nvme transport apis
In reply to James SmartDue to bug history and code review, the node reference counting approach in the driver isn't implemented consistently with how the scsi and nvme transport perform registrations and unregistrations and their callbacks. This resulted in many bad/stale node pointers.
Reword the driver so that reference handling is performed as follows:
- The initial node reference is taken on structure allocation
- Take a reference on any add/register call to the transport
- Remove a reference on any delete/unregister call to the transport
- After the node has fully removed from both the scsi and nvme transports (dev_loss_callbacks have called back) call the discovery engine DEVICE_RM event which will remove the final reference and release the node structure.
- Alter dev_loss handling when a vport or base port is unloading.
- Remove the put_node handling - no longer needed.
- Rewrite the vport_delete handling on reference counts. Part of this effort was driven from the FDISC not registering with the transport and disrupting the model for node reference counting.
- Deleted lpfc_nlp_remove. Pushed it's remaining ops into lpfc_nlp_release.
- Several other small code cleanups.
--- drivers/scsi/lpfc/lpfc_disc.h | 6 ++- drivers/scsi/lpfc/lpfc_els.c | 89 +++++++++++----------------------- drivers/scsi/lpfc/lpfc_init.c | 49 ++++++++++++------- drivers/scsi/lpfc/lpfc_nvme.c | 62 +++++++++++++++-------- drivers/scsi/lpfc/lpfc_nvme.h | 2 +- drivers/scsi/lpfc/lpfc_sli.c | 13 +++-- drivers/scsi/lpfc/lpfc_vport.c | 73 +++++----------------------- 7 files changed, 130 insertions(+), 164 deletions(-)
drivers/scsi/lpfc/lpfc_disc.h +5 -1
@@ -131,13 +131,17 @@ struct lpfc_nodelist {unsigned long *active_rrqs_xri_bitmap;struct lpfc_scsicmd_bkt *lat_data;/* Latency data */ uint32_t fc4_prli_sent; -uint32_t upcall_flags; +uint32_t fc4_xpt_flags;#define NLP_WAIT_FOR_UNREG 0x1 +#define SCSI_XPT_REGD 0x2 +#define NVME_XPT_REGD 0x4 +uint32_t nvme_fb_size;/* NVME target's supported byte cnt */ #define NVME_FB_BIT_SHIFT 9/* PRLI Rsp first burst in 512B units. */ uint32_t nlp_defer_did; }; +struct lpfc_node_rrq {struct list_head list;uint16_t xritag;
drivers/scsi/lpfc/lpfc_els.c +29 -60
194 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_init.c +31 -18
100 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_nvme.c +41 -21
132 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_nvme.h +1 -1
@@ -38,7 +38,7 @@#define LPFC_NVME_INFO_MORE_STR "\nCould be more info...\n"#define lpfc_ndlp_get_nrport (ndlp) \ - ((!ndlp->nrport || (ndlp->upcall_flags & NLP_WAIT_FOR_UNREG)) \ + ((!ndlp->nrport || (ndlp->fc4_xpt_flags & NLP_WAIT_FOR_UNREG)) \ ? NULL : ndlp->nrport)struct lpfc_nvme_qhandle {
drivers/scsi/lpfc/lpfc_sli.c +10 -3
@@ -2528,9 +2528,10 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) vport,KERN_INFO ,LOG_MBOX |LOG_DISCOVERY ,"1438 UNREG cmpl deferred mbox x%x " -"on NPort x%x Data: x%x x%x %px\n" , +"on NPort x%x Data: x%x x%x %px x%x x%x\n" , ndlp->nlp_rpi, ndlp->nlp_DID, - ndlp->nlp_flag, ndlp->nlp_defer_did, ndlp); + ndlp->nlp_flag, ndlp->nlp_defer_did, + ndlp, vport->load_flag, kref_read(&ndlp->kref));if ((ndlp->nlp_flag &NLP_UNREG_INP ) && (ndlp->nlp_defer_did !=NLP_EVT_NOTHING_PENDING )) {
@@ -2585,7 +2586,7 @@ lpfc_sli4_unreg_rpi_cmpl_clr(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) LPFC_SLI_INTF_IF_TYPE_2)) {if (ndlp) { lpfc_printf_vlog( - vport, KERN_INFO, LOG_MBOX | LOG_SLI, + vport, KERN_INFO, LOG_MBOX | LOG_SLI, "0010 UNREG_LOGIN vpi:%x " "rpi:%x DID:%x defer x%x flg x%x " "%px\n",
@@ -13415,6 +13416,12 @@ lpfc_sli4_sp_handle_mbox_event(struct lpfc_hba *phba, struct lpfc_mcqe *mcqe) pmbox->un.varWords[0], pmb); pmb->mbox_cmpl = lpfc_mbx_cmpl_dflt_rpi; pmb->ctx_buf = mp; + +/* No reference taken here. This is a default +* RPI reg/immediate unreg cycle. The reference was +* taken in the reg rpi path and is released when +* this mailbox completes. +*/ pmb->ctx_ndlp = ndlp; pmb->vport = vport; rc =lpfc_sli_issue_mbox (phba, pmb,MBX_NOWAIT );
drivers/scsi/lpfc/lpfc_vport.c +13 -60
136 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 5/17 lpfc: Rework remote port lock handling
In reply to James SmartCurrently the discovery layers within the driver use the scsi midlayer host_lock to access node-specific structures. This can contend with the io path and is too coarse of a lock.
Rework the driver so that it uses a lock specific to the remote port node structure when accessing the structure contents. A few of the changes brought out spots were some slightly reorganized routines worked better.
--- drivers/scsi/lpfc/lpfc.h | 2 - drivers/scsi/lpfc/lpfc_attr.c | 8 +- drivers/scsi/lpfc/lpfc_ct.c | 10 +- drivers/scsi/lpfc/lpfc_debugfs.c | 4 +- drivers/scsi/lpfc/lpfc_disc.h | 3 + drivers/scsi/lpfc/lpfc_els.c | 168 +++++++------ drivers/scsi/lpfc/lpfc_hbadisc.c | 372 ++++++++++++----------------- drivers/scsi/lpfc/lpfc_init.c | 11 +- drivers/scsi/lpfc/lpfc_nportdisc.c | 181 ++++++-------- drivers/scsi/lpfc/lpfc_nvme.c | 30 +-- drivers/scsi/lpfc/lpfc_scsi.c | 4 +- drivers/scsi/lpfc/lpfc_sli.c | 17 +- 12 files changed, 345 insertions(+), 465 deletions(-)
drivers/scsi/lpfc/lpfc.h +0 -2
@@ -1131,8 +1131,6 @@ struct lpfc_hba {uint8_t hb_outstanding;struct timer_list rrq_tmr;enum hba_temp_state over_temp_state; -/* ndlp reference management */ -spinlock_t ndlp_lock;/* * Following bit will be set for all buffer tags which are not * associated with any HBQ.
drivers/scsi/lpfc/lpfc_attr.c +4 -4
@@ -368,11 +368,11 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) { nrport =NULL ; -spin_lock (&vport->phba->hbalock); +spin_lock (&ndlp->lock); rport =lpfc_ndlp_get_nrport (ndlp);if (rport) nrport = rport->remoteport; -spin_unlock (&vport->phba->hbalock); +spin_unlock (&ndlp->lock);if (!nrport)continue ;
@@ -3630,11 +3630,11 @@ lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport)if (ndlp->rport) ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo;#if (IS_ENABLED (CONFIG_NVME_FC )) -spin_lock (&vport->phba->hbalock); +spin_lock (&ndlp->lock); rport =lpfc_ndlp_get_nrport (ndlp);if (rport) remoteport = rport->remoteport; -spin_unlock (&vport->phba->hbalock); +spin_unlock (&ndlp->lock);if (rport && remoteport)nvme_fc_set_remoteport_devloss (remoteport, vport->cfg_devloss_tmo);
drivers/scsi/lpfc/lpfc_ct.c +4 -6
@@ -825,7 +825,6 @@ lpfc_ns_rsp_audit_did(struct lpfc_vport *vport, uint32_t Did, uint8_t fc4_type) {struct lpfc_hba *phba = vport->phba;struct lpfc_nodelist *ndlp =NULL ; -struct Scsi_Host *shost =lpfc_shost_from_vport (vport);char *str;if (phba->cfg_ns_query ==LPFC_NS_QUERY_GID_FT )
@@ -854,12 +853,12 @@ lpfc_ns_rsp_audit_did(struct lpfc_vport *vport, uint32_t Did, uint8_t fc4_type)if (ndlp->nlp_type !=NLP_NVME_INITIATOR || ndlp->nlp_state !=NLP_STE_UNMAPPED_NODE )continue ; -spin_lock_irq (shost->host_lock); +spin_lock_irq (&ndlp->lock);if (ndlp->nlp_DID == Did) ndlp->nlp_flag &= ~NLP_NVMET_RECOV ;else ndlp->nlp_flag |=NLP_NVMET_RECOV ; -spin_unlock_irq (shost->host_lock); +spin_unlock_irq (&ndlp->lock); } } }
@@ -875,7 +874,6 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint8_t fc4_type,uint32_t Did, CTentry;int Cnt;struct list_head head; -struct Scsi_Host *shost =lpfc_shost_from_vport (vport);struct lpfc_nodelist *ndlp =NULL ;lpfc_set_disctmo (vport);
@@ -921,9 +919,9 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint8_t fc4_type,continue ;lpfc_disc_state_machine (vport, ndlp,NULL ,NLP_EVT_DEVICE_RECOVERY ); -spin_lock_irq (shost->host_lock); +spin_lock_irq (&ndlp->lock); ndlp->nlp_flag &= ~NLP_NVMET_RECOV ; -spin_unlock_irq (shost->host_lock); +spin_unlock_irq (&ndlp->lock); } }
drivers/scsi/lpfc/lpfc_debugfs.c +2 -2
@@ -955,13 +955,13 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) len +=scnprintf (buf + len, size - len,"\tRport List:\n" );list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) {/* local short-hand pointer. */ -spin_lock (&phba->hbalock); +spin_lock (&ndlp->lock); rport =lpfc_ndlp_get_nrport (ndlp);if (rport) nrport = rport->remoteport;else nrport =NULL ; -spin_unlock (&phba->hbalock); +spin_unlock (&ndlp->lock);if (!nrport)continue ;
drivers/scsi/lpfc/lpfc_disc.h +3 -0
@@ -81,6 +81,9 @@ struct lpfc_nodelist {struct list_head nlp_listp;struct lpfc_name nlp_portname;struct lpfc_name nlp_nodename; + +spinlock_t lock;/* Node management lock */ +uint32_t nlp_flag;/* entry flags */ uint32_t nlp_DID;/* FC D_ID of entry */ uint32_t nlp_last_elscmd;/* Last ELS cmd sent */
drivers/scsi/lpfc/lpfc_els.c +80 -88
524 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_hbadisc.c +151 -221
620 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_init.c +4 -7
@@ -3497,9 +3497,9 @@ lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action)continue ; } -spin_lock_irq (shost->host_lock); +spin_lock_irq (&ndlp->lock); ndlp->nlp_flag &= ~NLP_NPR_ADISC ; -spin_unlock_irq (shost->host_lock); +spin_unlock_irq (&ndlp->lock);/* * Whenever an SLI4 port goes offline, free the * RPI. Get a new RPI when the adapter port
@@ -5828,9 +5828,9 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,mod_timer (&ndlp->nlp_delayfunc, jiffies +msecs_to_jiffies (1000 )); shost =lpfc_shost_from_vport (vport); -spin_lock_irq (shost->host_lock); +spin_lock_irq (&ndlp->lock); ndlp->nlp_flag |=NLP_DELAY_TMO ; -spin_unlock_irq (shost->host_lock); +spin_unlock_irq (&ndlp->lock); ndlp->nlp_last_elscmd =ELS_CMD_FDISC ; vport->port_state =LPFC_FDISC ; }else {
@@ -6280,9 +6280,6 @@ lpfc_setup_driver_resource_phase1(struct lpfc_hba *phba)atomic_set (&phba->dbg_log_dmping,0 );spin_lock_init (&phba->hbalock); -/* Initialize ndlp management spinlock */ -spin_lock_init (&phba->ndlp_lock); -/* Initialize port_list spinlock */ spin_lock_init (&phba->port_list_lock);INIT_LIST_HEAD (&phba->port_list);
drivers/scsi/lpfc/lpfc_nportdisc.c +72 -109
539 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_nvme.c +15 -15
@@ -382,7 +382,7 @@ lpfc_nvme_remoteport_delete(struct nvme_fc_remote_port *remoteport)lpfc_printf_vlog (vport,KERN_INFO ,LOG_NVME_DISC ,"6146 remoteport delete of remoteport %p\n" , remoteport); -spin_lock_irq (&vport->phba->hbalock); +spin_lock_irq (&ndlp->lock);/* The register rebind might have occurred before the delete * downcall. Guard against this race.
@@ -390,7 +390,7 @@ lpfc_nvme_remoteport_delete(struct nvme_fc_remote_port *remoteport)if (ndlp->fc4_xpt_flags &NLP_WAIT_FOR_UNREG ) ndlp->fc4_xpt_flags &= ~(NLP_WAIT_FOR_UNREG |NVME_XPT_REGD ); -spin_unlock_irq (&vport->phba->hbalock); +spin_unlock_irq (&ndlp->lock);/* On a devloss timeout event, one more put is executed provided the * NVME and SCSI rport unregister requests are complete. If the vport
@@ -2475,13 +2475,13 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)else rpinfo.dev_loss_tmo = vport->cfg_devloss_tmo; -spin_lock_irq (&vport->phba->hbalock); +spin_lock_irq (&ndlp->lock); oldrport =lpfc_ndlp_get_nrport (ndlp);if (oldrport) { prev_ndlp = oldrport->ndlp; -spin_unlock_irq (&vport->phba->hbalock); +spin_unlock_irq (&ndlp->lock); }else { -spin_unlock_irq (&vport->phba->hbalock); +spin_unlock_irq (&ndlp->lock);if (!lpfc_nlp_get (ndlp)) {dev_warn (&vport->phba->pcidev->dev,"Warning - No node ref - exit register\n" );
@@ -2498,10 +2498,10 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)/* Guard against an unregister/reregister * race that leaves the WAIT flag set. */ -spin_lock_irq (&vport->phba->hbalock); +spin_lock_irq (&ndlp->lock); ndlp->fc4_xpt_flags &= ~NLP_WAIT_FOR_UNREG ; ndlp->fc4_xpt_flags |=NVME_XPT_REGD ; -spin_unlock_irq (&vport->phba->hbalock); +spin_unlock_irq (&ndlp->lock); rport = remote_port->private;if (oldrport) {
@@ -2509,10 +2509,10 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)* before dropping the ndlp ref from * register. */ -spin_lock_irq (&vport->phba->hbalock); +spin_lock_irq (&ndlp->lock); ndlp->nrport =NULL ; ndlp->fc4_xpt_flags &= ~NLP_WAIT_FOR_UNREG ; -spin_unlock_irq (&vport->phba->hbalock); +spin_unlock_irq (&ndlp->lock); rport->ndlp =NULL ; rport->remoteport =NULL ;
@@ -2530,9 +2530,9 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) rport->remoteport = remote_port; rport->lport = lport; rport->ndlp = ndlp; -spin_lock_irq (&vport->phba->hbalock); +spin_lock_irq (&ndlp->lock); ndlp->nrport = rport; -spin_unlock_irq (&vport->phba->hbalock); +spin_unlock_irq (&ndlp->lock);lpfc_printf_vlog (vport,KERN_INFO ,LOG_NVME_DISC |LOG_NODE , "6022 Bind lport x%px to remoteport x%px "
@@ -2571,11 +2571,11 @@ lpfc_nvme_rescan_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)struct lpfc_nvme_rport *nrport;struct nvme_fc_remote_port *remoteport =NULL ; -spin_lock_irq (&vport->phba->hbalock); +spin_lock_irq (&ndlp->lock); nrport =lpfc_ndlp_get_nrport (ndlp);if (nrport) remoteport = nrport->remoteport; -spin_unlock_irq (&vport->phba->hbalock); +spin_unlock_irq (&ndlp->lock);lpfc_printf_vlog (vport,KERN_INFO ,LOG_NVME_DISC , "6170 Rescan NPort DID x%06x type x%x "
@@ -2638,11 +2638,11 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)if (!lport) goto input_err; -spin_lock_irq (&vport->phba->hbalock); +spin_lock_irq (&ndlp->lock); rport =lpfc_ndlp_get_nrport (ndlp);if (rport) remoteport = rport->remoteport; -spin_unlock_irq (&vport->phba->hbalock); +spin_unlock_irq (&ndlp->lock);if (!remoteport) goto input_err;
drivers/scsi/lpfc/lpfc_scsi.c +2 -2
@@ -5316,10 +5316,10 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd)lpfc_printf_vlog (vport,KERN_ERR ,LOG_TRACE_EVENT ,"0722 Target Reset rport failure: rdata x%px\n" , rdata);if (pnode) { -spin_lock_irq (shost->host_lock); +spin_lock_irq (&pnode->lock); pnode->nlp_flag &= ~NLP_NPR_ADISC ; pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE ; -spin_unlock_irq (shost->host_lock); +spin_unlock_irq (&pnode->lock); }lpfc_reset_flush_io_context (vport, tgt_id, lun_id,LPFC_CTX_TGT );
drivers/scsi/lpfc/lpfc_sli.c +8 -9
@@ -2448,10 +2448,10 @@ __lpfc_sli_rpi_release(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)if (ndlp->nlp_flag &NLP_RELEASE_RPI ) {lpfc_sli4_free_rpi (vport->phba, ndlp->nlp_rpi); -spin_lock_irqsave (&vport->phba->ndlp_lock, iflags); +spin_lock_irqsave (&ndlp->lock, iflags); ndlp->nlp_flag &= ~NLP_RELEASE_RPI ; ndlp->nlp_rpi =LPFC_RPI_ALLOC_ERROR ; -spin_unlock_irqrestore (&vport->phba->ndlp_lock, iflags); +spin_unlock_irqrestore (&ndlp->lock, iflags); } ndlp->nlp_flag &= ~NLP_UNREG_INP ; }
@@ -19879,7 +19879,6 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport)struct lpfc_dmabuf *mp;struct lpfc_nodelist *ndlp;struct lpfc_nodelist *act_mbx_ndlp =NULL ; -struct Scsi_Host *shost =lpfc_shost_from_vport (vport);LIST_HEAD (mbox_cmd_list);uint8_t restart_loop;
@@ -19933,9 +19932,9 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport) mb->mbox_flag |=LPFC_MBX_IMED_UNREG ; restart_loop =1 ;spin_unlock_irq (&phba->hbalock); -spin_lock (shost->host_lock); +spin_lock (&ndlp->lock); ndlp->nlp_flag &= ~NLP_IGNR_REG_CMPL ; -spin_unlock (shost->host_lock); +spin_unlock (&ndlp->lock);spin_lock_irq (&phba->hbalock);break ; }
@@ -19957,9 +19956,9 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport) ndlp = (struct lpfc_nodelist *)mb->ctx_ndlp; mb->ctx_ndlp =NULL ;if (ndlp) { -spin_lock (shost->host_lock); +spin_lock (&ndlp->lock); ndlp->nlp_flag &= ~NLP_IGNR_REG_CMPL ; -spin_unlock (shost->host_lock); +spin_unlock (&ndlp->lock);lpfc_nlp_put (ndlp); } }
@@ -19968,9 +19967,9 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport)/* Release the ndlp with the cleaned-up active mailbox command */ if (act_mbx_ndlp) { -spin_lock (shost->host_lock); +spin_lock (&act_mbx_ndlp->lock); act_mbx_ndlp->nlp_flag &= ~NLP_IGNR_REG_CMPL ; -spin_unlock (shost->host_lock); +spin_unlock (&act_mbx_ndlp->lock);lpfc_nlp_put (act_mbx_ndlp); } }
Signature · 1 line
2.26.2
PATCH 6/17 lpfc: Remove ndlp when a PLOGI/ADISC/PRLI/REG_RPI ultimately fails
In reply to James SmartWhen a PLOGI/ADISC/PRLI/REG_RPI fails, the node remains in the nodelist in that state. Although the driver now frees a node when the ref count goes to zero, in this case the ref cnt doesn't reach zero because there isn't a mechanism to release the final reference. Discovery just stops.
Fix by calling the node discovery state machine DEVICE_RM event whenever one of these commands fail. This will remove the final reference count and trigger node release.
--- drivers/scsi/lpfc/lpfc_els.c | 66 +++++++++++++++++++++++++++++--- drivers/scsi/lpfc/lpfc_hbadisc.c | 39 +++++++++++-------- 2 files changed, 85 insertions(+), 20 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +61 -5
@@ -1988,12 +1988,25 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,"2753 PLOGI failure DID:%06X Status:x%x/x%x\n" , ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4]); -/* Do not call DSM for lpfc_els_abort'ed ELS cmds. Just execute -* the final node put to free it to the pool. + +/* Do not call DSM for lpfc_els_abort'ed ELS cmds */ +if (lpfc_error_lost_link (irsp)) + goto check_plogi; +else +lpfc_disc_state_machine (vport, ndlp, cmdiocb, +NLP_EVT_CMPL_PLOGI ); + +/* As long as this node is not registered with the scsi or nvme +* transport, it is no longer an active node. Otherwise +* devloss handles the final cleanup. */ -if (!lpfc_error_lost_link (irsp)) +if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD |NVME_XPT_REGD ))) { +spin_lock_irq (&ndlp->lock); + ndlp->nlp_flag &= ~NLP_NPR_2B_DISC ; +spin_unlock_irq (&ndlp->lock);lpfc_disc_state_machine (vport, ndlp, cmdiocb,NLP_EVT_DEVICE_RM ); + } }else {/* Good status, call state machine */ prsp = list_entry(((struct lpfc_dmabuf *)
@@ -2004,6 +2017,7 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, NLP_EVT_CMPL_PLOGI); } + check_plogi:if (disc && vport->num_disc_nodes) {/* Check to see if there are more PLOGIs to be sent */ lpfc_more_plogi (vport);
@@ -2243,6 +2257,20 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,else lpfc_disc_state_machine (vport, ndlp, cmdiocb,NLP_EVT_CMPL_PRLI ); + +/* As long as this node is not registered with the scsi +* or nvme transport and no other PRLIs are outstanding, +* it is no longer an active node. Otherwise devloss +* handles the final cleanup. +*/ +if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD |NVME_XPT_REGD )) && + !ndlp->fc4_prli_sent) { +spin_lock_irq (&ndlp->lock); + ndlp->nlp_flag &= ~NLP_NPR_2B_DISC ; +spin_unlock_irq (&ndlp->lock); +lpfc_disc_state_machine (vport, ndlp, cmdiocb, +NLP_EVT_DEVICE_RM ); + } }else {/* Good status, call state machine. However, if another * PRLI is outstanding, don't call the state machine
@@ -2655,14 +2683,29 @@ lpfc_cmpl_els_adisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4]);/* Do not call DSM for lpfc_els_abort'ed ELS cmds */ -if (!lpfc_error_lost_link (irsp)) +if (lpfc_error_lost_link (irsp)) + goto check_adisc; +else lpfc_disc_state_machine (vport, ndlp, cmdiocb,NLP_EVT_CMPL_ADISC ); + +/* As long as this node is not registered with the scsi or nvme +* transport, it is no longer an active node. Otherwise +* devloss handles the final cleanup. +*/ +if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD |NVME_XPT_REGD ))) { +spin_lock_irq (&ndlp->lock); + ndlp->nlp_flag &= ~NLP_NPR_2B_DISC ; +spin_unlock_irq (&ndlp->lock); +lpfc_disc_state_machine (vport, ndlp, cmdiocb, +NLP_EVT_DEVICE_RM ); + } }else /* Good status, call state machine */ lpfc_disc_state_machine (vport, ndlp, cmdiocb,NLP_EVT_CMPL_ADISC ); + check_adisc:/* Check to see if there are more ADISCs to be sent */ if (disc && vport->num_disc_nodes)lpfc_more_adisc (vport);
@@ -2879,8 +2922,21 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, irsp->un.ulpWord[4 ], irsp->ulpTimeout, vport->num_disc_nodes);lpfc_disc_start (vport); +return ; + } + +/* Cleanup path for failed REG_RPI handling. If REG_RPI fails, the +* driver sends a LOGO to the rport to cleanup. For fabric and +* initiator ports cleanup the node as long as it the node is not +* register with the transport. +*/ +if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD |NVME_XPT_REGD ))) { +spin_lock_irq (&ndlp->lock); + ndlp->nlp_flag &= ~NLP_NPR_2B_DISC ; +spin_unlock_irq (&ndlp->lock); +lpfc_disc_state_machine (vport, ndlp, cmdiocb, +NLP_EVT_DEVICE_RM ); } -return ; }/**
drivers/scsi/lpfc/lpfc_hbadisc.c +24 -15
@@ -204,10 +204,13 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)spin_lock_irqsave (&ndlp->lock, iflags); ndlp->nlp_flag |=NLP_IN_DEV_LOSS ; + ndlp->nlp_flag &= ~NLP_NPR_2B_DISC ; +/* -* The backend does not expect any more calls assoicated with this -* rport, Remove the association between rport and ndlp +* The backend does not expect any more calls associated with this +* rport. Remove the association between rport and ndlp. */ + ndlp->fc4_xpt_flags &= ~SCSI_XPT_REGD ; ((struct lpfc_rport_data *)rport->dd_data)->pnode =NULL ; ndlp->rport =NULL ;spin_unlock_irqrestore (&ndlp->lock, iflags);
@@ -248,7 +251,6 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)int warn_on =0 ;int fcf_inuse =0 ;unsigned long iflags; -u32 fc4_xpt_flags; vport = ndlp->vport; shost =lpfc_shost_from_vport (vport);
@@ -267,10 +269,11 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp) ndlp->nlp_DID, ndlp->nlp_type, ndlp->nlp_sid);lpfc_printf_vlog (ndlp->vport,KERN_INFO ,LOG_NODE , -"3182 %s x%06x, nflag x%x xflags x%x\n" , +"3182 %s x%06x, nflag x%x xflags x%x refcnt %d\n" , __func__, ndlp->nlp_DID, ndlp->nlp_flag, - ndlp->fc4_xpt_flags); + ndlp->fc4_xpt_flags,kref_read (&ndlp->kref)); +/* If the driver is recovering the rport, ignore devloss. */ if (ndlp->nlp_state ==NLP_STE_MAPPED_NODE ) {lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY , "0284 Devloss timeout Ignored on "
@@ -282,8 +285,11 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)return fcf_inuse; } -if (ndlp->nlp_type &NLP_FABRIC ) +/* Fabric nodes are done. */ +if (ndlp->nlp_type &NLP_FABRIC ) { +lpfc_nlp_put (ndlp);return fcf_inuse; + }if (ndlp->nlp_sid !=NLP_NO_SID ) { warn_on =1 ;
@@ -311,12 +317,7 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp) ndlp->nlp_state, ndlp->nlp_rpi); } -/* Should be final reference removal triggering a node free. */ -spin_lock_irqsave (shost->host_lock, iflags); - fc4_xpt_flags = ndlp->fc4_xpt_flags; -spin_unlock_irqrestore (shost->host_lock, iflags); - -if (!(fc4_xpt_flags & (NVME_XPT_REGD |SCSI_XPT_REGD ))) +if (!(ndlp->fc4_xpt_flags &NVME_XPT_REGD ))lpfc_disc_state_machine (vport, ndlp,NULL ,NLP_EVT_DEVICE_RM );return fcf_inuse;
@@ -3587,7 +3588,7 @@ lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) pmb->ctx_buf =NULL ; pmb->ctx_ndlp =NULL ; - lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, + lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI | LOG_NODE | LOG_DISCOVERY, "0002 rpi:%x DID:%x flg:%x %d x%px\n", ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref),
@@ -4079,8 +4080,16 @@ lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)kfree (mp);mempool_free (pmb, phba->mbox_mem_pool); -/* If no other thread is using the ndlp, free it */ -lpfc_nlp_not_used (ndlp); +/* If the node is not registered with the scsi or nvme +* transport, remove the fabric node. The failed reg_login +* is terminal. +*/ +if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD |NVME_XPT_REGD ))) { +spin_lock_irq (&ndlp->lock); + ndlp->nlp_flag &= ~NLP_NPR_2B_DISC ; +spin_unlock_irq (&ndlp->lock); +lpfc_nlp_not_used (ndlp); + }if (phba->fc_topology ==LPFC_TOPOLOGY_LOOP ) {/*
Signature · 1 line
2.26.2
PATCH 7/17 lpfc: Unsolicited ELS leaves node in incorrect state while dropping it
In reply to James SmartWhen a target swap happens, under certain conditions the node sends a LOGO. The unsolicited ELS logic responds with a reject. The logic may allocate a new node to handle this. Afterward, the new nodes are dropped incorrectly leaving them in a mis-matched state and refcounting causes a use-after-free situation leading to a crash.
It is also possible that the unsolicited els handling finds a node which is in an UNUSED state. The handling moves these nodes to NPR state with a refcount of 1. Although the end of the discovery logic assumes a final put will free such a node, there are codes paths which could increment the reference count, thus the node is in NPR state and not released. Eventually this mismatch in state and refcount leads to premature release of the node causing a crash.
Fix by always using the discovery engine DEVICE RM event to decrement and release the nodes (rather than explicit code that tried to do it before). This will take care of moving the node to the UNUSED state and then removes the final ref count. If there is a trigger to reuse this node, the transition from the UNUSED state clearly indicates that the initial reference is then incremented and use can continue.
--- drivers/scsi/lpfc/lpfc_els.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +22 -11
@@ -8728,7 +8728,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,lpfc_els_rcv_flogi (vport, elsiocb, ndlp);if (newnode) -lpfc_nlp_put (ndlp); +lpfc_disc_state_machine (vport, ndlp,NULL , +NLP_EVT_DEVICE_RM );break ;case ELS_CMD_LOGO : lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
@@ -8770,7 +8771,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, phba->fc_stat.elsRcvRSCN++;lpfc_els_rcv_rscn (vport, elsiocb, ndlp);if (newnode) -lpfc_nlp_put (ndlp); +lpfc_disc_state_machine (vport, ndlp,NULL , +NLP_EVT_DEVICE_RM );break ;case ELS_CMD_ADISC : lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
@@ -8848,7 +8850,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, phba->fc_stat.elsRcvLIRR++;lpfc_els_rcv_lirr (vport, elsiocb, ndlp);if (newnode) -lpfc_nlp_put (ndlp); +lpfc_disc_state_machine (vport, ndlp,NULL , +NLP_EVT_DEVICE_RM );break ;case ELS_CMD_RLS : lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
@@ -8858,7 +8861,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, phba->fc_stat.elsRcvRLS++;lpfc_els_rcv_rls (vport, elsiocb, ndlp);if (newnode) -lpfc_nlp_put (ndlp); +lpfc_disc_state_machine (vport, ndlp,NULL , +NLP_EVT_DEVICE_RM );break ;case ELS_CMD_RPL : lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
@@ -8868,7 +8872,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, phba->fc_stat.elsRcvRPL++;lpfc_els_rcv_rpl (vport, elsiocb, ndlp);if (newnode) -lpfc_nlp_put (ndlp); +lpfc_disc_state_machine (vport, ndlp,NULL , +NLP_EVT_DEVICE_RM );break ;case ELS_CMD_RNID : lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
@@ -8878,7 +8883,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, phba->fc_stat.elsRcvRNID++;lpfc_els_rcv_rnid (vport, elsiocb, ndlp);if (newnode) -lpfc_nlp_put (ndlp); +lpfc_disc_state_machine (vport, ndlp,NULL , +NLP_EVT_DEVICE_RM );break ;case ELS_CMD_RTV : lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
@@ -8887,7 +8893,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, phba->fc_stat.elsRcvRTV++;lpfc_els_rcv_rtv (vport, elsiocb, ndlp);if (newnode) -lpfc_nlp_put (ndlp); +lpfc_disc_state_machine (vport, ndlp,NULL , +NLP_EVT_DEVICE_RM );break ;case ELS_CMD_RRQ : lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
@@ -8897,7 +8904,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, phba->fc_stat.elsRcvRRQ++;lpfc_els_rcv_rrq (vport, elsiocb, ndlp);if (newnode) -lpfc_nlp_put (ndlp); +lpfc_disc_state_machine (vport, ndlp,NULL , +NLP_EVT_DEVICE_RM );break ;case ELS_CMD_ECHO : lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
@@ -8907,7 +8915,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, phba->fc_stat.elsRcvECHO++;lpfc_els_rcv_echo (vport, elsiocb, ndlp);if (newnode) -lpfc_nlp_put (ndlp); +lpfc_disc_state_machine (vport, ndlp,NULL , +NLP_EVT_DEVICE_RM );break ;case ELS_CMD_REC :/* receive this due to exchange closed */
@@ -8938,7 +8947,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,"0115 Unknown ELS command x%x " "received from NPORT x%x\n", cmd, did);if (newnode) -lpfc_nlp_put (ndlp); +lpfc_disc_state_machine (vport, ndlp,NULL , +NLP_EVT_DEVICE_RM );break ; }
@@ -8952,7 +8962,8 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, NULL);/* Remove the reference from above for new nodes. */ if (newnode) -lpfc_nlp_put (ndlp); +lpfc_disc_state_machine (vport, ndlp,NULL , +NLP_EVT_DEVICE_RM ); }/* Release the reference on this elsiocb, not the ndlp. */
Signature · 1 line
2.26.2
PATCH 8/17 lpfc: Fix NPIV discovery and Fabric Node detection
In reply to James SmartWhile testing NPIV and link bounces, the vport would not show a fabric node for the F_Port, would not transition into NPR state during a link fault, or leave the FDMI node untouched during error injection. Cause for this was determined to be an inconsistent manner in which F_Port, Nameserver, and FDMI controller nodes were created and linked. In some cases, the nodes would never be unregistered from the transport, leaving references active. In other cases, the fabric nodes may register with the transport multiple times while still registered.
The following changes were made:
- Fix the FDISC issue routine, which starts vport (re)creation, to mark the F_Port as a fabric node (NLP_FABRIC) and allow the F_Port node to fully be created and show up in the node list.
- When remote ports are cleaned up on vport termination, cleanup the nameserver and FDMI controller nodes on the vport so they unregister from the transport.
- On link bounces, don't exclude the NPIV Fabric remote ports from transitioning to the NPR state, allowing them to avoid re-registration if already registered.
--- drivers/scsi/lpfc/lpfc_els.c | 4 ++++ drivers/scsi/lpfc/lpfc_hbadisc.c | 11 +++++------ 2 files changed, 9 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +4 -0
@@ -1508,6 +1508,10 @@ lpfc_initial_fdisc(struct lpfc_vport *vport) 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); }
drivers/scsi/lpfc/lpfc_hbadisc.c +5 -6
@@ -818,12 +818,13 @@ lpfc_cleanup_rpis(struct lpfc_vport *vport, int remove)struct lpfc_nodelist *ndlp, *next_ndlp;list_for_each_entry_safe (ndlp, next_ndlp, &vport->fc_nodes, nlp_listp) { -if (ndlp->nlp_state ==NLP_STE_UNUSED_NODE )continue ; +if ((phba->sli3_options &LPFC_SLI3_VPORT_TEARDOWN ) || - ((vport->port_type ==LPFC_NPIV_PORT ) && - (ndlp->nlp_DID == NameServer_DID))) + ((vport->port_type ==LPFC_NPIV_PORT ) && + ((ndlp->nlp_DID == NameServer_DID) || + (ndlp->nlp_DID ==FDMI_DID ))))lpfc_unreg_rpi (vport, ndlp);/* Leave Fabric nodes alone on link down */
@@ -1037,9 +1038,7 @@ lpfc_linkup_port(struct lpfc_vport *vport) vport->fc_ns_retry =0 ;spin_unlock_irq (shost->host_lock); -if (vport->fc_flag &FC_LBIT ) -lpfc_linkup_cleanup_nodes (vport); - +lpfc_linkup_cleanup_nodes (vport); } static int
Signature · 1 line
2.26.2
PATCH 9/17 lpfc: Fix NPIV Fabric Node reference counting
In reply to James SmartWhile testing initiator-side cable swaps with NPIV, oops occur. The reference counts for the Fabric nodes on the NPIV vports isn't balanced, resulting in premature node removal.
The following fixes were made:
- Removed the FC_LBIT check in lpfc_linkup_port. This removed the special case for vports that didn't have them clean up just like the physical port.
- Removed the unreg_rpi call in lpfc_cleanup_node. In this section, the node is being removed in the context of a reference count release and a mailbox command can't be issued at this point.
- Remove special case handling in the default mailbox completion handler that allowed the skipping of a node reference. Now, reference counting always requires the removal of the reference.
- Move the location of the DEVICE_RM event is done during LOGO handling as the driver has additional work to do on the ndlp before puts/releases can be performed.
--- drivers/scsi/lpfc/lpfc_els.c | 47 +++++++++++++++++--------------- drivers/scsi/lpfc/lpfc_hbadisc.c | 29 ++++++++------------ drivers/scsi/lpfc/lpfc_init.c | 6 ++-- drivers/scsi/lpfc/lpfc_sli.c | 10 +++++-- 4 files changed, 46 insertions(+), 46 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +25 -22
@@ -2835,8 +2835,9 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,/* LOGO completes to NPort <nlp_DID> */ lpfc_printf_vlog (vport,KERN_INFO ,LOG_ELS ,"0105 LOGO completes to NPort x%x " -"Data: x%x x%x x%x x%x\n" , - ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4 ], +"refcnt %d nflags x%x Data: x%x x%x x%x x%x\n" , + ndlp->nlp_DID,kref_read (&ndlp->kref), ndlp->nlp_flag, + irsp->ulpStatus, irsp->un.ulpWord[4 ], irsp->ulpTimeout, vport->num_disc_nodes);if (lpfc_els_chk_latt (vport)) {
@@ -2844,17 +2845,6 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, goto out; } -/* Check to see if link went down during discovery */ -if (ndlp->nlp_flag &NLP_TARGET_REMOVE ) { -/* NLP_EVT_DEVICE_RM should unregister the RPI -* which should abort all outstanding IOs. -*/ -lpfc_disc_state_machine (vport, ndlp, cmdiocb, -NLP_EVT_DEVICE_RM ); - skip_recovery =1 ; - goto out; - } -/* The LOGO will not be retried on failure. A LOGO was * issued to the remote rport and a ACC or RJT or no Answer are * all acceptable. Note the failure and move forward with
@@ -2876,6 +2866,19 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,/* Call state machine. This will unregister the rpi if needed. */ lpfc_disc_state_machine (vport, ndlp, cmdiocb,NLP_EVT_CMPL_LOGO ); +/* The driver sets this flag for an NPIV instance that doesn't want to +* log into the remote port. +*/ +if (ndlp->nlp_flag &NLP_TARGET_REMOVE ) { +lpfc_disc_state_machine (vport, ndlp, cmdiocb, +NLP_EVT_DEVICE_RM ); +lpfc_els_free_iocb (phba, cmdiocb); +lpfc_nlp_put (ndlp); + +/* Presume the node was released. */ +return ; + } + out:/* Driver is done with the IO. */ lpfc_els_free_iocb (phba, cmdiocb);
@@ -4399,10 +4402,10 @@ lpfc_cmpl_els_logo_acc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, irsp->ulpStatus, irsp->un.ulpWord[4], ndlp->nlp_DID);/* ACC to LOGO completes to NPort <nlp_DID> */ lpfc_printf_vlog (vport,KERN_INFO ,LOG_ELS , -"0109 ACC to LOGO completes to NPort x%x " +"0109 ACC to LOGO completes to NPort x%x refcnt %d" "Data: x%x x%x x%x\n" , - ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, - ndlp->nlp_rpi); + ndlp->nlp_DID,kref_read (&ndlp->kref), ndlp->nlp_flag, + ndlp->nlp_state, ndlp->nlp_rpi);if (ndlp->nlp_state ==NLP_STE_NPR_NODE ) {/* NPort Recovery mode or node is just allocated */
@@ -8650,9 +8653,9 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,/* ELS command <elsCmd> received from NPORT <did> */ lpfc_printf_vlog (vport,KERN_INFO ,LOG_ELS ,"0112 ELS command x%x received from NPORT x%x " -"Data: x%x x%x x%x x%x\n" , - cmd, did, vport->port_state, vport->fc_flag, - vport->fc_myDID, vport->fc_prevDID); +"refcnt %d Data: x%x x%x x%x x%x\n" , + cmd, did,kref_read (&ndlp->kref), vport->port_state, + vport->fc_flag, vport->fc_myDID, vport->fc_prevDID);/* reject till our FLOGI completes or PLOGI assigned DID via PT2PT */ if ((vport->port_state < LPFC_FABRIC_CFG_LINK) &&
@@ -9144,9 +9147,9 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport)spin_lock_irq (shost->host_lock);if (vport->fc_flag &FC_DISC_DELAYED ) {spin_unlock_irq (shost->host_lock); -lpfc_printf_log (phba,KERN_ERR ,LOG_TRACE_EVENT , -"3334 Delay fc port discovery for %d seconds\n" , - phba->fc_ratov); +lpfc_printf_vlog (vport,KERN_ERR ,LOG_TRACE_EVENT , +"3334 Delay fc port discovery for %d secs\n" , + phba->fc_ratov);mod_timer (&vport->delayed_disc_tmo, jiffies +msecs_to_jiffies (1000 * phba->fc_ratov));return ;
drivers/scsi/lpfc/lpfc_hbadisc.c +12 -17
@@ -4810,8 +4810,14 @@ lpfc_set_unreg_login_mbx_cmpl(struct lpfc_hba *phba, struct lpfc_vport *vport, {unsigned long iflags; +/* Driver always gets a reference on the mailbox job +* in support of async jobs. +*/ + mbox->ctx_ndlp =lpfc_nlp_get (ndlp); +if (!mbox->ctx_ndlp) +return ; +if (ndlp->nlp_flag &NLP_ISSUE_LOGO ) { - mbox->ctx_ndlp = ndlp; mbox->mbox_cmpl = lpfc_nlp_logo_unreg; } else if (phba->sli_rev == LPFC_SLI_REV4 &&
@@ -4819,7 +4825,6 @@ lpfc_set_unreg_login_mbx_cmpl(struct lpfc_hba *phba, struct lpfc_vport *vport, (bf_get (lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) >=LPFC_SLI_INTF_IF_TYPE_2 ) && (kref_read(&ndlp->kref) > 0)) { - mbox->ctx_ndlp = lpfc_nlp_get(ndlp); mbox->mbox_cmpl = lpfc_sli4_unreg_rpi_cmpl_clr; } else {if (vport->load_flag &FC_UNLOADING ) {
@@ -4828,9 +4833,7 @@ lpfc_set_unreg_login_mbx_cmpl(struct lpfc_hba *phba, struct lpfc_vport *vport, ndlp->nlp_flag |=NLP_RELEASE_RPI ;spin_unlock_irqrestore (&ndlp->lock, iflags); } -lpfc_nlp_get (ndlp); } - mbox->ctx_ndlp = ndlp; mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; } }
@@ -4888,6 +4891,11 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)lpfc_unreg_login (phba, vport->vpi, rpi, mbox); mbox->vport = vport;lpfc_set_unreg_login_mbx_cmpl (phba, vport, ndlp, mbox); +if (!mbox->ctx_ndlp) { +mempool_free (mbox, phba->mbox_mem_pool); +return 1 ; + } +if (mbox->mbox_cmpl == lpfc_sli4_unreg_rpi_cmpl_clr)/* * accept PLOGIs after unreg_rpi_cmpl
@@ -5057,7 +5065,6 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)struct lpfc_hba *phba = vport->phba;LPFC_MBOXQ_t *mb, *nextmb;struct lpfc_dmabuf *mp; -unsigned long iflags;/* Cleanup node for NPort <nlp_DID> */ lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
@@ -5125,18 +5132,6 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)lpfc_cleanup_vports_rrqs (vport, ndlp);if (phba->sli_rev ==LPFC_SLI_REV4 ) ndlp->nlp_flag |=NLP_RELEASE_RPI ; -if (!lpfc_unreg_rpi (vport, ndlp)) { -/* Clean up unregistered and non freed rpis */ -if ((ndlp->nlp_flag &NLP_RELEASE_RPI ) && - !(ndlp->nlp_rpi ==LPFC_RPI_ALLOC_ERROR )) { -lpfc_sli4_free_rpi (vport->phba, - ndlp->nlp_rpi); -spin_lock_irqsave (&ndlp->lock, iflags); - ndlp->nlp_flag &= ~NLP_RELEASE_RPI ; - ndlp->nlp_rpi =LPFC_RPI_ALLOC_ERROR ; -spin_unlock_irqrestore (&ndlp->lock, iflags); - } - }return 0 ; }
drivers/scsi/lpfc/lpfc_init.c +2 -4
@@ -2851,10 +2851,8 @@ lpfc_cleanup(struct lpfc_vport *vport)continue ; } -/* take care of nodes in unused state before the state -* machine taking action. -*/ -if (ndlp->nlp_state ==NLP_STE_UNUSED_NODE ) { +if (ndlp->nlp_DID == Fabric_Cntl_DID && + ndlp->nlp_state ==NLP_STE_UNUSED_NODE ) {lpfc_nlp_put (ndlp);continue ; }
drivers/scsi/lpfc/lpfc_sli.c +7 -3
@@ -2541,8 +2541,12 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) }else {__lpfc_sli_rpi_release (vport, ndlp); } -if (vport->load_flag &FC_UNLOADING ) -lpfc_nlp_put (ndlp); + +/* The unreg_login mailbox is complete and had a +* reference that has to be released. The PLOGI +* got its own ref. +*/ +lpfc_nlp_put (ndlp); pmb->ctx_ndlp =NULL ; } }
@@ -2566,7 +2570,7 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)* * This function is the unreg rpi mailbox completion handler. It * frees the memory resources associated with the completed mailbox -* command. An additional refrenece is put on the ndlp to prevent +* command. An additional reference is put on the ndlp to prevent * lpfc_nlp_release from freeing the rpi bit in the bitmask before * the unreg mailbox command completes, this routine puts the * reference back.
Signature · 1 line
2.26.2
PATCH 10/17 lpfc: Refactor wqe structure definitions for common use
In reply to James SmartIn preparation of reworking the driver to use a native SLI-4 WQE interface for the SCSI and NVME io paths, start by commonizing the WQE exchange type and command type attributes.
While adjusting these options also noted the variance in the pbde field. Fix this by setting templates to 0 and in nvme, which explicitly uses this option, setting the value.
--- drivers/scsi/lpfc/lpfc_hw4.h | 10 +++++++--- drivers/scsi/lpfc/lpfc_nvme.c | 20 +++++++++++--------- drivers/scsi/lpfc/lpfc_nvmet.c | 6 +++--- 3 files changed, 21 insertions(+), 15 deletions(-)
drivers/scsi/lpfc/lpfc_hw4.h +7 -3
@@ -4386,9 +4386,11 @@ struct wqe_common {#define wqe_ebde_cnt_SHIFT 0#define wqe_ebde_cnt_MASK 0x0000000f#define wqe_ebde_cnt_WORD word10 -#define wqe_nvme_SHIFT 4 -#define wqe_nvme_MASK 0x00000001 -#define wqe_nvme_WORD word10 +#define wqe_xchg_SHIFT 4 +#define wqe_xchg_MASK 0x00000001 +#define wqe_xchg_WORD word10 +#define LPFC_SCSI_XCHG 0x0 +#define LPFC_NVME_XCHG 0x1#define wqe_oas_SHIFT 6#define wqe_oas_MASK 0x00000001#define wqe_oas_WORD word10
@@ -4886,6 +4888,8 @@ struct lpfc_grp_hdr {#define NVME_READ_CMD 0x0#define FCP_COMMAND_DATA_OUT 0x1#define NVME_WRITE_CMD 0x1 +#define COMMAND_DATA_IN 0x0 +#define COMMAND_DATA_OUT 0x1#define FCP_COMMAND_TRECEIVE 0x2#define FCP_COMMAND_TRSP 0x3#define FCP_COMMAND_TSEND 0x7
drivers/scsi/lpfc/lpfc_nvme.c +11 -9
@@ -98,16 +98,16 @@ lpfc_nvme_cmd_template(void)/* Word 10 - dbde, wqes is variable */ bf_set (wqe_qosd, &wqe->fcp_iread.wqe_com,0 ); -bf_set (wqe_nvme, &wqe->fcp_iread.wqe_com,1 ); +bf_set (wqe_xchg, &wqe->fcp_iread.wqe_com,LPFC_NVME_XCHG );bf_set (wqe_iod, &wqe->fcp_iread.wqe_com,LPFC_WQE_IOD_READ );bf_set (wqe_lenloc, &wqe->fcp_iread.wqe_com,LPFC_WQE_LENLOC_WORD4 );bf_set (wqe_dbde, &wqe->fcp_iread.wqe_com,0 );bf_set (wqe_wqes, &wqe->fcp_iread.wqe_com,1 );/* Word 11 - pbde is variable */ -bf_set (wqe_cmd_type, &wqe->fcp_iread.wqe_com,NVME_READ_CMD ); +bf_set (wqe_cmd_type, &wqe->fcp_iread.wqe_com,COMMAND_DATA_IN );bf_set (wqe_cqid, &wqe->fcp_iread.wqe_com,LPFC_WQE_CQ_ID_DEFAULT ); -bf_set (wqe_pbde, &wqe->fcp_iread.wqe_com,1 ); +bf_set (wqe_pbde, &wqe->fcp_iread.wqe_com,0 );/* Word 12 - is zero */
@@ -139,16 +139,16 @@ lpfc_nvme_cmd_template(void)/* Word 10 - dbde, wqes is variable */ bf_set (wqe_qosd, &wqe->fcp_iwrite.wqe_com,0 ); -bf_set (wqe_nvme, &wqe->fcp_iwrite.wqe_com,1 ); +bf_set (wqe_xchg, &wqe->fcp_iwrite.wqe_com,LPFC_NVME_XCHG );bf_set (wqe_iod, &wqe->fcp_iwrite.wqe_com,LPFC_WQE_IOD_WRITE );bf_set (wqe_lenloc, &wqe->fcp_iwrite.wqe_com,LPFC_WQE_LENLOC_WORD4 );bf_set (wqe_dbde, &wqe->fcp_iwrite.wqe_com,0 );bf_set (wqe_wqes, &wqe->fcp_iwrite.wqe_com,1 );/* Word 11 - pbde is variable */ -bf_set (wqe_cmd_type, &wqe->fcp_iwrite.wqe_com,NVME_WRITE_CMD ); +bf_set (wqe_cmd_type, &wqe->fcp_iwrite.wqe_com,COMMAND_DATA_OUT );bf_set (wqe_cqid, &wqe->fcp_iwrite.wqe_com,LPFC_WQE_CQ_ID_DEFAULT ); -bf_set (wqe_pbde, &wqe->fcp_iwrite.wqe_com,1 ); +bf_set (wqe_pbde, &wqe->fcp_iwrite.wqe_com,0 );/* Word 12 - is zero */
@@ -178,14 +178,14 @@ lpfc_nvme_cmd_template(void)/* Word 10 - dbde, wqes is variable */ bf_set (wqe_qosd, &wqe->fcp_icmd.wqe_com,1 ); -bf_set (wqe_nvme, &wqe->fcp_icmd.wqe_com,1 ); +bf_set (wqe_xchg, &wqe->fcp_icmd.wqe_com,LPFC_NVME_XCHG );bf_set (wqe_iod, &wqe->fcp_icmd.wqe_com,LPFC_WQE_IOD_NONE );bf_set (wqe_lenloc, &wqe->fcp_icmd.wqe_com,LPFC_WQE_LENLOC_NONE );bf_set (wqe_dbde, &wqe->fcp_icmd.wqe_com,0 );bf_set (wqe_wqes, &wqe->fcp_icmd.wqe_com,1 );/* Word 11 */ -bf_set (wqe_cmd_type, &wqe->fcp_icmd.wqe_com,FCP_COMMAND ); +bf_set (wqe_cmd_type, &wqe->fcp_icmd.wqe_com,COMMAND_DATA_IN );bf_set (wqe_cqid, &wqe->fcp_icmd.wqe_com,LPFC_WQE_CQ_ID_DEFAULT );bf_set (wqe_pbde, &wqe->fcp_icmd.wqe_com,0 );
@@ -1570,7 +1570,9 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport,le32_to_cpu (first_data_sgl->sge_len); bde->tus.f.bdeFlags =BUFF_TYPE_BDE_64 ; bde->tus.w =cpu_to_le32 (bde->tus.w); -/* wqe_pbde is 1 in template */ + +/* Word 11 */ +bf_set (wqe_pbde, &wqe->generic.wqe_com,1 ); }else {memset (&wqe->words[13 ],0 , (sizeof (uint32_t ) *3 ));bf_set (wqe_pbde, &wqe->generic.wqe_com,0 );
drivers/scsi/lpfc/lpfc_nvmet.c +3 -3
@@ -105,7 +105,7 @@ lpfc_nvmet_cmd_template(void)/* Word 9 - reqtag, rcvoxid is variable */ /* Word 10 - wqes, xc is variable */ -bf_set (wqe_nvme, &wqe->fcp_tsend.wqe_com,1 ); +bf_set (wqe_xchg, &wqe->fcp_tsend.wqe_com,LPFC_NVME_XCHG );bf_set (wqe_dbde, &wqe->fcp_tsend.wqe_com,1 );bf_set (wqe_wqes, &wqe->fcp_tsend.wqe_com,0 );bf_set (wqe_xc, &wqe->fcp_tsend.wqe_com,1 );
@@ -153,7 +153,7 @@ lpfc_nvmet_cmd_template(void)/* Word 10 - xc is variable */ bf_set (wqe_dbde, &wqe->fcp_treceive.wqe_com,1 );bf_set (wqe_wqes, &wqe->fcp_treceive.wqe_com,0 ); -bf_set (wqe_nvme, &wqe->fcp_treceive.wqe_com,1 ); +bf_set (wqe_xchg, &wqe->fcp_treceive.wqe_com,LPFC_NVME_XCHG );bf_set (wqe_iod, &wqe->fcp_treceive.wqe_com,LPFC_WQE_IOD_READ );bf_set (wqe_lenloc, &wqe->fcp_treceive.wqe_com,LPFC_WQE_LENLOC_WORD12 );bf_set (wqe_xc, &wqe->fcp_tsend.wqe_com,1 );
@@ -195,7 +195,7 @@ lpfc_nvmet_cmd_template(void)/* Word 10 wqes, xc is variable */ bf_set (wqe_dbde, &wqe->fcp_trsp.wqe_com,1 ); -bf_set (wqe_nvme, &wqe->fcp_trsp.wqe_com,1 ); +bf_set (wqe_xchg, &wqe->fcp_trsp.wqe_com,LPFC_NVME_XCHG );bf_set (wqe_wqes, &wqe->fcp_trsp.wqe_com,0 );bf_set (wqe_xc, &wqe->fcp_trsp.wqe_com,0 );bf_set (wqe_iod, &wqe->fcp_trsp.wqe_com,LPFC_WQE_IOD_NONE );
Signature · 1 line
2.26.2
PATCH 11/17 lpfc: Enable common wqe_template support for both scsi and nvme
In reply to James SmartThe driver is currently using sli-4 wqe templates only for NVME. Refactor the template and the placement of the service routine so that it can be used by both SCSI and NVME.
--- drivers/scsi/lpfc/lpfc_crtn.h | 5 +- drivers/scsi/lpfc/lpfc_init.c | 2 +- drivers/scsi/lpfc/lpfc_nvme.c | 133 +--------------------------------- drivers/scsi/lpfc/lpfc_sli.c | 126 ++++++++++++++++++++++++++++++++ 4 files changed, 134 insertions(+), 132 deletions(-)
drivers/scsi/lpfc/lpfc_crtn.h +4 -1
@@ -590,7 +590,7 @@ struct lpfc_io_buf *lpfc_get_io_buf(struct lpfc_hba *phba,void lpfc_release_io_buf (struct lpfc_hba *phba,struct lpfc_io_buf *ncmd,struct lpfc_sli4_hdw_queue *qp);void lpfc_io_ktime (struct lpfc_hba *phba,struct lpfc_io_buf *ncmd); -void lpfc_nvme_cmd_template (void ); +void lpfc_wqe_cmd_template (void );void lpfc_nvmet_cmd_template (void );void lpfc_nvme_cancel_iocb (struct lpfc_hba *phba,struct lpfc_iocbq *pwqeIn);void lpfc_nvme_prep_abort_wqe (struct lpfc_iocbq *pwqeq,u16 xritag,u8 opt);
@@ -598,3 +598,6 @@ extern int lpfc_enable_nvmet_cnt;extern unsigned long long lpfc_enable_nvmet[];extern int lpfc_no_hba_reset_cnt;extern unsigned long lpfc_no_hba_reset[]; +extern union lpfc_wqe128 lpfc_iread_cmd_template; +extern union lpfc_wqe128 lpfc_iwrite_cmd_template; +extern union lpfc_wqe128 lpfc_icmnd_cmd_template;
drivers/scsi/lpfc/lpfc_init.c +1 -1
@@ -14120,7 +14120,7 @@ lpfc_init(void)fc_release_transport (lpfc_transport_template); goto unregister; } -lpfc_nvme_cmd_template (); +lpfc_wqe_cmd_template ();lpfc_nvmet_cmd_template ();/* Initialize in case vector mapping is needed */
drivers/scsi/lpfc/lpfc_nvme.c +3 -130
145 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_sli.c +126 -0
138 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 12/17 lpfc: Enable common send_io interface for SCSI and NVME
In reply to James SmartTo setup up common use by the SCSI and NVME io paths, create a new routine that issues FCP io commands which can be used by either protocol. The new routine addresses sli-3 vs sli-4 differences within its implementation.
Replace the (sli-3 centric) iocb routine in the scsi path with this new wqe-centric common routine.
--- drivers/scsi/lpfc/lpfc.h | 3 ++ drivers/scsi/lpfc/lpfc_crtn.h | 2 + drivers/scsi/lpfc/lpfc_scsi.c | 6 ++- drivers/scsi/lpfc/lpfc_sli.c | 87 +++++++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc.h +3 -0
@@ -669,6 +669,9 @@ struct lpfc_hba {int (*__lpfc_sli_issue_iocb) (struct lpfc_hba *,uint32_t ,struct lpfc_iocbq *,uint32_t ); +int (*__lpfc_sli_issue_fcp_io) + (struct lpfc_hba *phba,uint32_t ring_number, +struct lpfc_iocbq *piocb,uint32_t flag);void (*__lpfc_sli_release_iocbq)(struct lpfc_hba *,struct lpfc_iocbq *);int (*lpfc_hba_down_post)(struct lpfc_hba *phba);
drivers/scsi/lpfc/lpfc_crtn.h +2 -0
@@ -320,6 +320,8 @@ void lpfc_sli_def_mbox_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *);void lpfc_sli4_unreg_rpi_cmpl_clr (struct lpfc_hba *,LPFC_MBOXQ_t *);int lpfc_sli_issue_iocb (struct lpfc_hba *,uint32_t ,struct lpfc_iocbq *,uint32_t ); +int lpfc_sli_issue_fcp_io (struct lpfc_hba *phba,uint32_t ring_number, +struct lpfc_iocbq *piocb,uint32_t flag);int lpfc_sli4_issue_wqe (struct lpfc_hba *phba,struct lpfc_sli4_hdw_queue *qp,struct lpfc_iocbq *pwqe);struct lpfc_sglq *__lpfc_clear_active_sglq (struct lpfc_hba *phba,uint16_t xri);
drivers/scsi/lpfc/lpfc_scsi.c +4 -2
@@ -4634,8 +4634,10 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd)if (unlikely (phba->hdwqstat_on &LPFC_CHECK_SCSI_IO ))this_cpu_inc (phba->sli4_hba.c_stat->xmt_io);#endif - err =lpfc_sli_issue_iocb (phba,LPFC_FCP_RING , - &lpfc_cmd->cur_iocbq,SLI_IOCB_RET_IOCB ); +/* Issue IO to adapter */ + err =lpfc_sli_issue_fcp_io (phba,LPFC_FCP_RING , + &lpfc_cmd->cur_iocbq, +SLI_IOCB_RET_IOCB );#ifdef CONFIG_SCSI_LPFC_DEBUG_FS if (start) { lpfc_cmd->ts_cmd_start = start;
drivers/scsi/lpfc/lpfc_sli.c +87 -0
115 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 13/17 lpfc: convert scsi path to use common io submission path
In reply to James SmartThis patch converts the scsi io path from the iocb-centric interfaces to the common io submission path which supports native SLI-4 WQEs.
A wrapper routine is put in place to distinguish SLI-3 from SLI. If SLI-3, the same iocb-centric paths are used, perhaps with refactored code that is explicitly for SLI-3. For SLI-4, any iocb-related formatting is replaced by wqe-based formatting, although much of that is addressed by the common wqe templates in the SLI-4 path.
--- drivers/scsi/lpfc/lpfc.h | 4 + drivers/scsi/lpfc/lpfc_scsi.c | 455 ++++++++++++++++++++++++---------- drivers/scsi/lpfc/lpfc_sli.c | 55 ++-- 3 files changed, 365 insertions(+), 149 deletions(-)
drivers/scsi/lpfc/lpfc.h +4 -0
@@ -664,6 +664,10 @@ struct lpfc_hba {void (*lpfc_scsi_prep_cmnd) (struct lpfc_vport *,struct lpfc_io_buf *,struct lpfc_nodelist *); +int (*lpfc_scsi_prep_cmnd_buf) + (struct lpfc_vport *vport, +struct lpfc_io_buf *lpfc_cmd, +uint8_t tmo);/* IOCB interface function jump table entries */ int (*__lpfc_sli_issue_iocb)
drivers/scsi/lpfc/lpfc_scsi.c +320 -135
640 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_sli.c +41 -14
86 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 14/17 lpfc: convert scsi io completions to sli-3 and sli-4 handlers
In reply to James SmartThe current driver implementation uses sli-4 wqe to iocb conversion before calling the cmpl callback function.
Rework the fcp io completion path to utilize the sli-4 wqe.
This patch converts the scsi io completion paths from the iocb-centric interfaces to the routines are native for whether ios are iocb-based (sli-3) or wqe-based (sli-4).
Most existing routines were iocb-based, so this creates a lot of SLI-4 specific routines to provide the functionality.
--- drivers/scsi/lpfc/lpfc_scsi.c | 490 +++++++++++++++++++++++++++++++++- drivers/scsi/lpfc/lpfc_sli.c | 5 +- 2 files changed, 481 insertions(+), 14 deletions(-)
drivers/scsi/lpfc/lpfc_scsi.c +477 -13
@@ -2882,6 +2882,150 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) } } +/* +* This function checks for BlockGuard errors detected by +* the HBA. In case of errors, the ASC/ASCQ fields in the +* sense buffer will be set accordingly, paired with +* ILLEGAL_REQUEST to signal to the kernel that the HBA +* detected corruption. +* +* Returns: +* 0 - No error found +* 1 - BlockGuard error found +* -1 - Internal error (bad profile, ...etc) +*/ +static int +lpfc_sli4_parse_bg_err (struct lpfc_hba *phba,struct lpfc_io_buf *lpfc_cmd, +struct lpfc_wcqe_complete *wcqe) +{ +struct scsi_cmnd *cmd = lpfc_cmd->pCmd; +int ret =0 ; +u32 status =bf_get (lpfc_wcqe_c_status, wcqe); +u32 bghm =0 ; +u32 bgstat =0 ; +u64 failing_sector =0 ; + +if (status ==CQE_STATUS_DI_ERROR ) { +if (bf_get (lpfc_wcqe_c_bg_ge, wcqe))/* Guard Check failed */ + bgstat |=BGS_GUARD_ERR_MASK ; +if (bf_get (lpfc_wcqe_c_bg_ae, wcqe))/* AppTag Check failed */ + bgstat |=BGS_APPTAG_ERR_MASK ; +if (bf_get (lpfc_wcqe_c_bg_re, wcqe))/* RefTag Check failed */ + bgstat |=BGS_REFTAG_ERR_MASK ; + +/* Check to see if there was any good data before the error */ +if (bf_get (lpfc_wcqe_c_bg_tdpv, wcqe)) { + bgstat |=BGS_HI_WATER_MARK_PRESENT_MASK ; + bghm = wcqe->total_data_placed; + } + +/* +* Set ALL the error bits to indicate we don't know what +* type of error it is. +*/ +if (!bgstat) + bgstat |= (BGS_REFTAG_ERR_MASK |BGS_APPTAG_ERR_MASK | +BGS_GUARD_ERR_MASK ); + } + +if (lpfc_bgs_get_guard_err (bgstat)) { + ret =1 ; + +scsi_build_sense_buffer (1 , cmd->sense_buffer,ILLEGAL_REQUEST , +0x10 ,0x1 ); + cmd->result =DRIVER_SENSE <<24 |DID_ABORT <<16 | +SAM_STAT_CHECK_CONDITION ; + phba->bg_guard_err_cnt++; +lpfc_printf_log (phba,KERN_WARNING ,LOG_FCP |LOG_BG , +"9059 BLKGRD: Guard Tag error in cmd" +" 0x%x lba 0x%llx blk cnt 0x%x " +"bgstat=x%x bghm=x%x\n" , cmd->cmnd[0 ], + (unsigned long long )scsi_get_lba (cmd), +blk_rq_sectors (cmd->request), bgstat, bghm); + } + +if (lpfc_bgs_get_reftag_err (bgstat)) { + ret =1 ; + +scsi_build_sense_buffer (1 , cmd->sense_buffer,ILLEGAL_REQUEST , +0x10 ,0x3 ); + cmd->result =DRIVER_SENSE <<24 |DID_ABORT <<16 | +SAM_STAT_CHECK_CONDITION ; + + phba->bg_reftag_err_cnt++; +lpfc_printf_log (phba,KERN_WARNING ,LOG_FCP |LOG_BG , +"9060 BLKGRD: Ref Tag error in cmd" +" 0x%x lba 0x%llx blk cnt 0x%x " +"bgstat=x%x bghm=x%x\n" , cmd->cmnd[0 ], + (unsigned long long )scsi_get_lba (cmd), +blk_rq_sectors (cmd->request), bgstat, bghm); + } + +if (lpfc_bgs_get_apptag_err (bgstat)) { + ret =1 ; + +scsi_build_sense_buffer (1 , cmd->sense_buffer,ILLEGAL_REQUEST , +0x10 ,0x2 ); + cmd->result =DRIVER_SENSE <<24 |DID_ABORT <<16 | +SAM_STAT_CHECK_CONDITION ; + + phba->bg_apptag_err_cnt++; +lpfc_printf_log (phba,KERN_WARNING ,LOG_FCP |LOG_BG , +"9062 BLKGRD: App Tag error in cmd" +" 0x%x lba 0x%llx blk cnt 0x%x " +"bgstat=x%x bghm=x%x\n" , cmd->cmnd[0 ], + (unsigned long long )scsi_get_lba (cmd), +blk_rq_sectors (cmd->request), bgstat, bghm); + } + +if (lpfc_bgs_get_hi_water_mark_present (bgstat)) { +/* +* setup sense data descriptor 0 per SPC-4 as an information +* field, and put the failing LBA in it. +* This code assumes there was also a guard/app/ref tag error +* indication. +*/ + cmd->sense_buffer[7 ] =0xc ;/* Additional sense length */ + cmd->sense_buffer[8 ] =0 ;/* Information descriptor type */ + cmd->sense_buffer[9 ] =0xa ;/* Additional descriptor length */ + cmd->sense_buffer[10 ] =0x80 ;/* Validity bit */ + +/* bghm is a "on the wire" FC frame based count */ +switch (scsi_get_prot_op (cmd)) { +case SCSI_PROT_READ_INSERT : +case SCSI_PROT_WRITE_STRIP : + bghm /= cmd->device->sector_size; +break ; +case SCSI_PROT_READ_STRIP : +case SCSI_PROT_WRITE_INSERT : +case SCSI_PROT_READ_PASS : +case SCSI_PROT_WRITE_PASS : + bghm /= (cmd->device->sector_size + +sizeof (struct scsi_dif_tuple )); +break ; + } + + failing_sector =scsi_get_lba (cmd); + failing_sector += bghm; + +/* Descriptor Information */ +put_unaligned_be64 (failing_sector, &cmd->sense_buffer[12 ]); + } + +if (!ret) { +/* No error was reported - problem in FW? */ +lpfc_printf_log (phba,KERN_WARNING ,LOG_FCP |LOG_BG , +"9068 BLKGRD: Unknown error in cmd" +" 0x%x lba 0x%llx blk cnt 0x%x " +"bgstat=x%x bghm=x%x\n" , cmd->cmnd[0 ], + (unsigned long long )scsi_get_lba (cmd), +blk_rq_sectors (cmd->request), bgstat, bghm); + +/* Calcuate what type of error it was */ +lpfc_calc_bg_err (phba, lpfc_cmd); + } +return ret; +}/* * This function checks for BlockGuard errors detected by
@@ -3561,12 +3705,11 @@ lpfc_scsi_prep_cmnd_buf(struct lpfc_vport *vport, struct lpfc_io_buf *lpfc_cmd,**/ static void lpfc_send_scsi_error_event (struct lpfc_hba *phba,struct lpfc_vport *vport, -struct lpfc_io_buf *lpfc_cmd,struct lpfc_iocbq *rsp_iocb) { +struct lpfc_io_buf *lpfc_cmd,uint32_t fcpi_parm) {struct scsi_cmnd *cmnd = lpfc_cmd->pCmd;struct fcp_rsp *fcprsp = lpfc_cmd->fcp_rsp;uint32_t resp_info = fcprsp->rspStatus2;uint32_t scsi_status = fcprsp->rspStatus3; -uint32_t fcpi_parm = rsp_iocb->iocb.un.fcpi.fcpi_parm;struct lpfc_fast_path_event *fast_path_evt =NULL ;struct lpfc_nodelist *pnode = lpfc_cmd->rdata->pnode;unsigned long flags;
@@ -3681,13 +3824,11 @@ lpfc_scsi_unprep_dma_buf(struct lpfc_hba *phba, struct lpfc_io_buf *psb)**/ static void lpfc_handle_fcp_err (struct lpfc_vport *vport,struct lpfc_io_buf *lpfc_cmd, -struct lpfc_iocbq *rsp_iocb) +uint32_t fcpi_parm) { -struct lpfc_hba *phba = vport->phba;struct scsi_cmnd *cmnd = lpfc_cmd->pCmd;struct fcp_cmnd *fcpcmd = lpfc_cmd->fcp_cmnd;struct fcp_rsp *fcprsp = lpfc_cmd->fcp_rsp; -uint32_t fcpi_parm = rsp_iocb->iocb.un.fcpi.fcpi_parm;uint32_t resp_info = fcprsp->rspStatus2;uint32_t scsi_status = fcprsp->rspStatus3;uint32_t *lp;
@@ -3822,13 +3963,10 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_io_buf *lpfc_cmd,*/ }else if (fcpi_parm) {lpfc_printf_vlog (vport,KERN_WARNING ,LOG_FCP |LOG_FCP_ERROR , -"9029 FCP %s Check Error xri x%x Data: " +"9029 FCP %s Check Error Data: " "x%x x%x x%x x%x x%x\n" , ((cmnd->sc_data_direction ==DMA_FROM_DEVICE ) ?"Read" :"Write" ), - ((phba->sli_rev ==LPFC_SLI_REV4 ) ? - lpfc_cmd->cur_iocbq.sli4_xritag : - rsp_iocb->iocb.ulpContext), fcpDl,be32_to_cpu (fcprsp->rspResId), fcpi_parm, cmnd->cmnd[0 ], scsi_status);
@@ -3855,7 +3993,333 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_io_buf *lpfc_cmd, out: cmnd->result = host_status <<16 | scsi_status; -lpfc_send_scsi_error_event (vport->phba, vport, lpfc_cmd, rsp_iocb); +lpfc_send_scsi_error_event (vport->phba, vport, lpfc_cmd, fcpi_parm); +} + +/** +* lpfc_fcp_io_cmd_wqe_cmpl - Complete a FCP IO +* @phba: The hba for which this call is being executed. +* @pwqeIn: The command WQE for the scsi cmnd. +* @pwqeOut: The response WQE for the scsi cmnd. +* +* This routine assigns scsi command result by looking into response WQE +* status field appropriately. This routine handles QUEUE FULL condition as +* well by ramping down device queue depth. +**/ +static void +lpfc_fcp_io_cmd_wqe_cmpl (struct lpfc_hba *phba,struct lpfc_iocbq *pwqeIn, +struct lpfc_wcqe_complete *wcqe) +{ +struct lpfc_io_buf *lpfc_cmd = + (struct lpfc_io_buf *)pwqeIn->context1; +struct lpfc_vport *vport = pwqeIn->vport; +struct lpfc_rport_data *rdata = lpfc_cmd->rdata; +struct lpfc_nodelist *ndlp = rdata->pnode; +struct scsi_cmnd *cmd; +unsigned long flags; +struct lpfc_fast_path_event *fast_path_evt; +struct Scsi_Host *shost; +u32 logit =LOG_FCP ; +u32 status, idx; +unsigned long iflags =0 ; + +/* Sanity check on return of outstanding command */ +if (!lpfc_cmd) { +lpfc_printf_vlog (vport,KERN_ERR ,LOG_TRACE_EVENT , +"9032 Null lpfc_cmd pointer. No " +"release, skip completion\n" ); +return ; + } + +if (bf_get (lpfc_wcqe_c_xb, wcqe)) { +/* TOREMOVE - currently this flag is checked during +* the release of lpfc_iocbq. Remove once we move +* to lpfc_wqe_job construct. +* +* This needs to be done outside buf_lock +*/ +spin_lock_irqsave (&phba->hbalock, iflags); + lpfc_cmd->cur_iocbq.iocb_flag |=LPFC_EXCHANGE_BUSY ; +spin_unlock_irqrestore (&phba->hbalock, iflags); + } + +/* Guard against abort handler being called at same time */ +spin_lock (&lpfc_cmd->buf_lock); + +/* Sanity check on return of outstanding command */ + cmd = lpfc_cmd->pCmd; +if (!cmd || !phba) { +lpfc_printf_vlog (vport,KERN_ERR ,LOG_TRACE_EVENT , +"9042 IO completion: Not an active IO\n" ); +spin_unlock (&lpfc_cmd->buf_lock); +lpfc_release_scsi_buf (phba, lpfc_cmd); +return ; + } + idx = lpfc_cmd->cur_iocbq.hba_wqidx; +if (phba->sli4_hba.hdwq) + phba->sli4_hba.hdwq[idx].scsi_cstat.io_cmpls++; + +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS +if (unlikely (phba->hdwqstat_on &LPFC_CHECK_SCSI_IO )) +this_cpu_inc (phba->sli4_hba.c_stat->cmpl_io); +#endif + shost = cmd->device->host; + + status =bf_get (lpfc_wcqe_c_status, wcqe); + lpfc_cmd->status = (status &LPFC_IOCB_STATUS_MASK ); + lpfc_cmd->result = (wcqe->parameter &IOERR_PARAM_MASK ); + + lpfc_cmd->flags &= ~LPFC_SBUF_XBUSY ; +if (bf_get (lpfc_wcqe_c_xb, wcqe)) + lpfc_cmd->flags |=LPFC_SBUF_XBUSY ; + +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS +if (lpfc_cmd->prot_data_type) { +struct scsi_dif_tuple *src =NULL ; + + src = (struct scsi_dif_tuple *)lpfc_cmd->prot_data_segment; +/* +* Used to restore any changes to protection +* data for error injection. +*/ +switch (lpfc_cmd->prot_data_type) { +case LPFC_INJERR_REFTAG : + src->ref_tag = + lpfc_cmd->prot_data; +break ; +case LPFC_INJERR_APPTAG : + src->app_tag = + (uint16_t )lpfc_cmd->prot_data; +break ; +case LPFC_INJERR_GUARD : + src->guard_tag = + (uint16_t )lpfc_cmd->prot_data; +break ; +default : +break ; + } + + lpfc_cmd->prot_data =0 ; + lpfc_cmd->prot_data_type =0 ; + lpfc_cmd->prot_data_segment =NULL ; + } +#endif +if (unlikely (lpfc_cmd->status)) { +if (lpfc_cmd->status ==IOSTAT_LOCAL_REJECT && + (lpfc_cmd->result &IOERR_DRVR_MASK )) + lpfc_cmd->status =IOSTAT_DRIVER_REJECT ; +else if (lpfc_cmd->status >=IOSTAT_CNT ) + lpfc_cmd->status =IOSTAT_DEFAULT ; +if (lpfc_cmd->status ==IOSTAT_FCP_RSP_ERROR && + !lpfc_cmd->fcp_rsp->rspStatus3 && + (lpfc_cmd->fcp_rsp->rspStatus2 &RESID_UNDER ) && + !(vport->cfg_log_verbose &LOG_FCP_UNDER )) + logit =0 ; +else + logit =LOG_FCP |LOG_FCP_UNDER ; +lpfc_printf_vlog (vport,KERN_WARNING , logit, +"9034 FCP cmd x%x failed <%d/%lld> " +"status: x%x result: x%x " +"sid: x%x did: x%x oxid: x%x " +"Data: x%x x%x x%x\n" , + cmd->cmnd[0 ], + cmd->device ? cmd->device->id :0xffff , + cmd->device ? cmd->device->lun :0xffff , + lpfc_cmd->status, lpfc_cmd->result, + vport->fc_myDID, + (ndlp) ? ndlp->nlp_DID :0 , + lpfc_cmd->cur_iocbq.sli4_xritag, + wcqe->parameter, wcqe->total_data_placed, + lpfc_cmd->cur_iocbq.iotag); + } + +switch (lpfc_cmd->status) { +case IOSTAT_SUCCESS : + cmd->result =DID_OK <<16 ; +break ; +case IOSTAT_FCP_RSP_ERROR : +lpfc_handle_fcp_err (vport, lpfc_cmd, + pwqeIn->wqe.fcp_iread.total_xfer_len - + wcqe->total_data_placed); +break ; +case IOSTAT_NPORT_BSY : +case IOSTAT_FABRIC_BSY : + cmd->result =DID_TRANSPORT_DISRUPTED <<16 ; + fast_path_evt =lpfc_alloc_fast_evt (phba); +if (!fast_path_evt) +break ; + fast_path_evt->un.fabric_evt.event_type = +FC_REG_FABRIC_EVENT ; + fast_path_evt->un.fabric_evt.subcategory = + (lpfc_cmd->status ==IOSTAT_NPORT_BSY ) ? +LPFC_EVENT_PORT_BUSY :LPFC_EVENT_FABRIC_BUSY ; +if (ndlp) { +memcpy (&fast_path_evt->un.fabric_evt.wwpn, + &ndlp->nlp_portname, +sizeof (struct lpfc_name )); +memcpy (&fast_path_evt->un.fabric_evt.wwnn, + &ndlp->nlp_nodename, +sizeof (struct lpfc_name )); + } + fast_path_evt->vport = vport; + fast_path_evt->work_evt.evt = +LPFC_EVT_FASTPATH_MGMT_EVT ; +spin_lock_irqsave (&phba->hbalock, flags); +list_add_tail (&fast_path_evt->work_evt.evt_listp, + &phba->work_list); +spin_unlock_irqrestore (&phba->hbalock, flags); +lpfc_worker_wake_up (phba); +lpfc_printf_vlog (vport,KERN_WARNING , logit, +"9035 Fabric/Node busy FCP cmd x%x failed" +" <%d/%lld> " +"status: x%x result: x%x " +"sid: x%x did: x%x oxid: x%x " +"Data: x%x x%x x%x\n" , + cmd->cmnd[0 ], + cmd->device ? cmd->device->id :0xffff , + cmd->device ? cmd->device->lun :0xffff , + lpfc_cmd->status, lpfc_cmd->result, + vport->fc_myDID, + (ndlp) ? ndlp->nlp_DID :0 , + lpfc_cmd->cur_iocbq.sli4_xritag, + wcqe->parameter, + wcqe->total_data_placed, + lpfc_cmd->cur_iocbq.iocb.ulpIoTag); +break ; +case IOSTAT_REMOTE_STOP : +if (ndlp) { +/* This IO was aborted by the target, we don't +* know the rxid and because we did not send the +* ABTS we cannot generate and RRQ. +*/ +lpfc_set_rrq_active (phba, ndlp, + lpfc_cmd->cur_iocbq.sli4_lxritag, +0 ,0 ); + } + fallthrough; +case IOSTAT_LOCAL_REJECT : +if (lpfc_cmd->result &IOERR_DRVR_MASK ) + lpfc_cmd->status =IOSTAT_DRIVER_REJECT ; +if (lpfc_cmd->result ==IOERR_ELXSEC_KEY_UNWRAP_ERROR || + lpfc_cmd->result == +IOERR_ELXSEC_KEY_UNWRAP_COMPARE_ERROR || + lpfc_cmd->result ==IOERR_ELXSEC_CRYPTO_ERROR || + lpfc_cmd->result == +IOERR_ELXSEC_CRYPTO_COMPARE_ERROR ) { + cmd->result =DID_NO_CONNECT <<16 ; +break ; + } +if (lpfc_cmd->result ==IOERR_INVALID_RPI || + lpfc_cmd->result ==IOERR_NO_RESOURCES || + lpfc_cmd->result ==IOERR_ABORT_REQUESTED || + lpfc_cmd->result ==IOERR_SLER_CMD_RCV_FAILURE ) { + cmd->result =DID_REQUEUE <<16 ; +break ; + } +if ((lpfc_cmd->result ==IOERR_RX_DMA_FAILED || + lpfc_cmd->result ==IOERR_TX_DMA_FAILED ) && + status ==CQE_STATUS_DI_ERROR ) { +if (scsi_get_prot_op (cmd) != +SCSI_PROT_NORMAL ) { +/* +* This is a response for a BG enabled +* cmd. Parse BG error +*/ +lpfc_sli4_parse_bg_err (phba, lpfc_cmd, + wcqe); +break ; + } +lpfc_printf_vlog (vport,KERN_WARNING ,LOG_BG , +"9040 non-zero BGSTAT on unprotected cmd\n" ); + } +lpfc_printf_vlog (vport,KERN_WARNING , logit, +"9036 Local Reject FCP cmd x%x failed" +" <%d/%lld> " +"status: x%x result: x%x " +"sid: x%x did: x%x oxid: x%x " +"Data: x%x x%x x%x\n" , + cmd->cmnd[0 ], + cmd->device ? cmd->device->id :0xffff , + cmd->device ? cmd->device->lun :0xffff , + lpfc_cmd->status, lpfc_cmd->result, + vport->fc_myDID, + (ndlp) ? ndlp->nlp_DID :0 , + lpfc_cmd->cur_iocbq.sli4_xritag, + wcqe->parameter, + wcqe->total_data_placed, + lpfc_cmd->cur_iocbq.iocb.ulpIoTag); + fallthrough; +default : +if (lpfc_cmd->status >=IOSTAT_CNT ) + lpfc_cmd->status =IOSTAT_DEFAULT ; + cmd->result =DID_ERROR <<16 ; +lpfc_printf_vlog (vport,KERN_INFO ,LOG_NVME_IOERR , +"9037 FCP Completion Error: xri %x " +"status x%x result x%x [x%x] " +"placed x%x\n" , + lpfc_cmd->cur_iocbq.sli4_xritag, + lpfc_cmd->status, lpfc_cmd->result, + wcqe->parameter, + wcqe->total_data_placed); + } +if (cmd->result || lpfc_cmd->fcp_rsp->rspSnsLen) { +u32 *lp = (u32 *)cmd->sense_buffer; + +lpfc_printf_vlog (vport,KERN_INFO ,LOG_FCP , +"9039 Iodone <%d/%llu> cmd x%p, error " +"x%x SNS x%x x%x Data: x%x x%x\n" , + cmd->device->id, cmd->device->lun, cmd, + cmd->result, *lp, *(lp +3 ), cmd->retries, +scsi_get_resid (cmd)); + } + +lpfc_update_stats (vport, lpfc_cmd); + +if (vport->cfg_max_scsicmpl_time && +time_after (jiffies, lpfc_cmd->start_time + +msecs_to_jiffies (vport->cfg_max_scsicmpl_time))) { +spin_lock_irqsave (shost->host_lock, flags); +if (ndlp) { +if (ndlp->cmd_qdepth > +atomic_read (&ndlp->cmd_pending) && + (atomic_read (&ndlp->cmd_pending) > +LPFC_MIN_TGT_QDEPTH ) && + (cmd->cmnd[0 ] ==READ_10 || + cmd->cmnd[0 ] ==WRITE_10 )) + ndlp->cmd_qdepth = +atomic_read (&ndlp->cmd_pending); + + ndlp->last_change_time = jiffies; + } +spin_unlock_irqrestore (shost->host_lock, flags); + } +lpfc_scsi_unprep_dma_buf (phba, lpfc_cmd); + +#ifdef CONFIG_SCSI_LPFC_DEBUG_FS +if (lpfc_cmd->ts_cmd_start) { + lpfc_cmd->ts_isr_cmpl = lpfc_cmd->cur_iocbq.isr_timestamp; + lpfc_cmd->ts_data_io =ktime_get_ns (); + phba->ktime_last_cmd = lpfc_cmd->ts_data_io; +lpfc_io_ktime (phba, lpfc_cmd); + } +#endif + lpfc_cmd->pCmd =NULL ; +spin_unlock (&lpfc_cmd->buf_lock); + +/* The sdev is not guaranteed to be valid post scsi_done upcall. */ + cmd->scsi_done (cmd); + +/* +* If there is an abort thread waiting for command completion +* wake up the thread. +*/ +spin_lock (&lpfc_cmd->buf_lock); + lpfc_cmd->cur_iocbq.iocb_flag &= ~LPFC_DRIVER_ABORTED ; +if (lpfc_cmd->waitq) +wake_up (lpfc_cmd->waitq); +spin_unlock (&lpfc_cmd->buf_lock); + +lpfc_release_scsi_buf (phba, lpfc_cmd); }/**
@@ -3978,7 +4442,8 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,switch (lpfc_cmd->status) {case IOSTAT_FCP_RSP_ERROR :/* Call FCP RSP handler to determine result */ -lpfc_handle_fcp_err (vport, lpfc_cmd, pIocbOut); +lpfc_handle_fcp_err (vport, lpfc_cmd, + pIocbOut->iocb.un.fcpi.fcpi_parm);break ;case IOSTAT_NPORT_BSY :case IOSTAT_FABRIC_BSY :
@@ -4305,8 +4770,7 @@ static int lpfc_scsi_prep_cmnd_buf_s4(struct lpfc_vport *vport, pwqeq->vport = vport; pwqeq->context1 = lpfc_cmd; pwqeq->hba_wqidx = lpfc_cmd->hdwq_no; -if (!pwqeq->iocb_cmpl) - pwqeq->iocb_cmpl = lpfc_scsi_cmd_iocb_cmpl; + pwqeq->wqe_cmpl = lpfc_fcp_io_cmd_wqe_cmpl;return 0 ; }
drivers/scsi/lpfc/lpfc_sli.c +4 -1
@@ -14339,7 +14339,9 @@ lpfc_sli4_fp_handle_fcp_wcqe(struct lpfc_hba *phba, struct lpfc_queue *cq,#endif if (cmdiocbq->iocb_cmpl ==NULL ) {if (cmdiocbq->wqe_cmpl) { -if (cmdiocbq->iocb_flag &LPFC_DRIVER_ABORTED ) { +/* For FCP the flag is cleared in wqe_cmpl */ +if (!(cmdiocbq->iocb_flag &LPFC_IO_FCP ) && + cmdiocbq->iocb_flag &LPFC_DRIVER_ABORTED ) {spin_lock_irqsave (&phba->hbalock, iflags); cmdiocbq->iocb_flag &= ~LPFC_DRIVER_ABORTED ;spin_unlock_irqrestore (&phba->hbalock, iflags);
@@ -14356,6 +14358,7 @@ lpfc_sli4_fp_handle_fcp_wcqe(struct lpfc_hba *phba, struct lpfc_queue *cq,return ; } +/* Only SLI4 non-IO commands stil use IOCB */ /* Fake the irspiocb and copy necessary response information */ lpfc_sli4_iocb_param_transfer (phba, &irspiocbq, cmdiocbq, wcqe);
Signature · 1 line
2.26.2
PATCH 15/17 lpfc: Convert abort handling to sli-3 and sli-4 handlers
In reply to James SmartThis patch reworks the abort interfaces such that SLI-3 retains the iocb-based formatting and completions and SLI-4 now uses native WQEs and completion routines.
The following changes are made:
- The code is refactored from a confusing 2 routine sequence of xx_abort_iotag_issue(), which creates/formats and abort cmd, and xx_issue_abort_tag(), which then issues and handles the completion of the abort cmd - into a single interface of xx_issue_abort_iotag(). The new interface will determine whether sli-3 or sli-4 and then call the appropriate handler. A completion handler can now be specified to address the differences in completion handling.
note: original code is all iocb based, with sli-4 converting to sli-3 for the scsi/els path, and nvme natively using wqes.
- The sli-3 side is refactored:
The older iocb-base lpfc_sli_issue_abort_iotag() routine is combined with the logic of lpfc_sli_abort_iotag_issue() as well as the iocb-specific code in lpfc_abort_handler() and lpfc_sli_abort_iocb() to create the new single sli-3 abort routine that formats and issues the iocb.
- The sli-4 side is refactored and added to:
The native WQE abort code in nvme is moved to the new sli-4 issue_abort_iotag() routine. Items in scsi that set fields not set by nvme is migrated into the new routine. Thus the routine supports nvme and scsi initiators. The nvmet block (target) formats the abort slightly different (like the old nvme initiator) thus it has its own prep routine stolen from nvme initiator and it retains the current code it has for issuing the wqe (does not use the commonized routine the initiators do). sli-4 completion handlers were also added.
- lpfc_abort_handler now becomes a wrapper that determines whether SLI-3 or SLI-4 and calls the proper abort handler.
--- drivers/scsi/lpfc/lpfc_bsg.c | 4 +- drivers/scsi/lpfc/lpfc_crtn.h | 7 +- drivers/scsi/lpfc/lpfc_els.c | 7 +- drivers/scsi/lpfc/lpfc_hbadisc.c | 2 +- drivers/scsi/lpfc/lpfc_nportdisc.c | 2 +- drivers/scsi/lpfc/lpfc_nvme.c | 72 +------ drivers/scsi/lpfc/lpfc_nvmet.c | 42 +++- drivers/scsi/lpfc/lpfc_scsi.c | 62 +----- drivers/scsi/lpfc/lpfc_sli.c | 329 ++++++++++++++++------------- drivers/scsi/lpfc/lpfc_sli.h | 5 + 10 files changed, 253 insertions(+), 279 deletions(-)
drivers/scsi/lpfc/lpfc_bsg.c +2 -2
@@ -5927,7 +5927,7 @@ lpfc_bsg_timeout(struct bsg_job *job) } }if (list_empty (&completions)) -lpfc_sli_issue_abort_iotag (phba, pring, cmdiocb); +lpfc_sli_issue_abort_iotag (phba, pring, cmdiocb,NULL );spin_unlock_irqrestore (&phba->hbalock, flags);if (!list_empty (&completions)) { lpfc_sli_cancel_iocbs(phba, &completions,
@@ -5964,7 +5964,7 @@ lpfc_bsg_timeout(struct bsg_job *job) } }if (list_empty (&completions)) -lpfc_sli_issue_abort_iotag (phba, pring, cmdiocb); +lpfc_sli_issue_abort_iotag (phba, pring, cmdiocb,NULL );spin_unlock_irqrestore (&phba->hbalock, flags);if (!list_empty (&completions)) { lpfc_sli_cancel_iocbs(phba, &completions,
drivers/scsi/lpfc/lpfc_crtn.h +5 -2
@@ -324,6 +324,8 @@ int lpfc_sli_issue_fcp_io(struct lpfc_hba *phba, uint32_t ring_number, struct lpfc_iocbq *piocb, uint32_t flag);int lpfc_sli4_issue_wqe (struct lpfc_hba *phba,struct lpfc_sli4_hdw_queue *qp,struct lpfc_iocbq *pwqe); +int lpfc_sli4_issue_abort_iotag (struct lpfc_hba *phba, +struct lpfc_iocbq *cmdiocb,void *cmpl);struct lpfc_sglq *__lpfc_clear_active_sglq (struct lpfc_hba *phba,uint16_t xri);struct lpfc_sglq *__lpfc_sli_get_nvmet_sglq (struct lpfc_hba *phba,struct lpfc_iocbq *piocbq);
@@ -348,7 +350,7 @@ int lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *, uint32_t);void lpfc_sli_hbqbuf_free_all (struct lpfc_hba *);int lpfc_sli_hbq_size (void );int lpfc_sli_issue_abort_iotag (struct lpfc_hba *,struct lpfc_sli_ring *, -struct lpfc_iocbq *); +struct lpfc_iocbq *,void *);int lpfc_sli_sum_iocb (struct lpfc_vport *,uint16_t ,uint64_t ,lpfc_ctx_cmd );int lpfc_sli_abort_iocb (struct lpfc_vport *,struct lpfc_sli_ring *,uint16_t ,uint64_t ,lpfc_ctx_cmd );
@@ -371,6 +373,8 @@ int lpfc_sli_issue_iocb_wait(struct lpfc_hba *, uint32_t, uint32_t);void lpfc_sli_abort_fcp_cmpl (struct lpfc_hba *,struct lpfc_iocbq *,struct lpfc_iocbq *); +void lpfc_sli4_abort_fcp_cmpl (struct lpfc_hba *h,struct lpfc_iocbq *i, +struct lpfc_wcqe_complete *w);void lpfc_sli_free_hbq (struct lpfc_hba *,struct hbq_dmabuf *);
@@ -595,7 +599,6 @@ void lpfc_io_ktime(struct lpfc_hba *phba, struct lpfc_io_buf *ncmd);void lpfc_wqe_cmd_template (void );void lpfc_nvmet_cmd_template (void );void lpfc_nvme_cancel_iocb (struct lpfc_hba *phba,struct lpfc_iocbq *pwqeIn); -void lpfc_nvme_prep_abort_wqe (struct lpfc_iocbq *pwqeq,u16 xritag,u8 opt);extern int lpfc_enable_nvmet_cnt;extern unsigned long long lpfc_enable_nvmet[];extern int lpfc_no_hba_reset_cnt;
drivers/scsi/lpfc/lpfc_els.c +4 -3
@@ -1424,7 +1424,8 @@ lpfc_els_abort_flogi(struct lpfc_hba *phba)if (icmd->ulpCommand ==CMD_ELS_REQUEST64_CR ) { ndlp = (struct lpfc_nodelist *)(iocb->context1);if (ndlp && (ndlp->nlp_DID == Fabric_DID)) -lpfc_sli_issue_abort_iotag (phba, pring, iocb); +lpfc_sli_issue_abort_iotag (phba, pring, iocb, +NULL ); } }spin_unlock_irq (&phba->hbalock);
@@ -8135,7 +8136,7 @@ lpfc_els_timeout_handler(struct lpfc_vport *vport) remote_ID, cmd->ulpCommand, cmd->ulpIoTag);spin_lock_irq (&phba->hbalock);list_del_init (&piocb->dlist); -lpfc_sli_issue_abort_iotag (phba, pring, piocb); +lpfc_sli_issue_abort_iotag (phba, pring, piocb,NULL );spin_unlock_irq (&phba->hbalock); }
@@ -8235,7 +8236,7 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport)list_for_each_entry_safe (piocb, tmp_iocb, &abort_list, dlist) {spin_lock_irqsave (&phba->hbalock, iflags);list_del_init (&piocb->dlist); -lpfc_sli_issue_abort_iotag (phba, pring, piocb); +lpfc_sli_issue_abort_iotag (phba, pring, piocb,NULL );spin_unlock_irqrestore (&phba->hbalock, iflags); }if (!list_empty (&abort_list))
drivers/scsi/lpfc/lpfc_hbadisc.c +1 -1
@@ -5610,7 +5610,7 @@ lpfc_free_tx(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) icmd = &iocb->iocb;if (icmd->ulpCommand ==CMD_ELS_REQUEST64_CR || icmd->ulpCommand ==CMD_XMIT_ELS_RSP64_CX ) { -lpfc_sli_issue_abort_iotag (phba, pring, iocb); +lpfc_sli_issue_abort_iotag (phba, pring, iocb,NULL ); } }spin_unlock_irq (&phba->hbalock);
drivers/scsi/lpfc/lpfc_nportdisc.c +1 -1
@@ -247,7 +247,7 @@ lpfc_els_abort(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)list_for_each_entry_safe (iocb, next_iocb, &abort_list, dlist) {spin_lock_irq (&phba->hbalock);list_del_init (&iocb->dlist); -lpfc_sli_issue_abort_iotag (phba, pring, iocb); +lpfc_sli_issue_abort_iotag (phba, pring, iocb,NULL );spin_unlock_irq (&phba->hbalock); }
drivers/scsi/lpfc/lpfc_nvme.c +6 -66
108 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_nvmet.c +41 -1
54 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_scsi.c +11 -51
93 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_sli.c +177 -152
439 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_sli.h +5 -0
@@ -130,6 +130,9 @@ struct lpfc_iocbq {#define IOCB_BUSY 1#define IOCB_ERROR 2#define IOCB_TIMEDOUT 3 +#define IOCB_ABORTED 4 +#define IOCB_ABORTING 5 +#define IOCB_NORESOURCE 6#define SLI_WQE_RET_WQE 1/* Return WQE if cmd ring full */
@@ -138,6 +141,8 @@ struct lpfc_iocbq {#define WQE_ERROR 2#define WQE_TIMEDOUT 3#define WQE_ABORTED 4 +#define WQE_ABORTING 5 +#define WQE_NORESOURCE 6#define LPFC_MBX_WAKE 1#define LPFC_MBX_IMED_UNREG 2
Signature · 1 line
2.26.2
PATCH 16/17 lpfc: Update lpfc version to 12.8.0.6
In reply to James SmartUpdate lpfc version to 12.8.0.6
--- drivers/scsi/lpfc/lpfc_version.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_version.h +2 -2
@@ -20,7 +20,7 @@* included with this package. * *******************************************************************/ -#define LPFC_DRIVER_VERSION "12.8.0.5" +#define LPFC_DRIVER_VERSION "12.8.0.6"#define LPFC_DRIVER_NAME "lpfc"/* Used for SLI 2/3 */
@@ -32,6 +32,6 @@#define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \ LPFC_DRIVER_VERSION -#define LPFC_COPYRIGHT "Copyright (C) 2017-2019 Broadcom. All Rights " \ +#define LPFC_COPYRIGHT "Copyright (C) 2017-2020 Broadcom. All Rights " \ "Reserved. The term \"Broadcom\" refers to Broadcom Inc. " \ "and/or its subsidiaries."
Signature · 1 line
2.26.2
PATCH 17/17 lpfc: Update changed file copyrights for 2020
In reply to James SmartUpdate Copyright in files changed by the 12.8.0.6 patch set to 2020
--- drivers/scsi/lpfc/lpfc_bsg.c | 2 +- drivers/scsi/lpfc/lpfc_crtn.h | 2 +- drivers/scsi/lpfc/lpfc_debugfs.c | 2 +- drivers/scsi/lpfc/lpfc_disc.h | 2 +- drivers/scsi/lpfc/lpfc_hw4.h | 2 +- drivers/scsi/lpfc/lpfc_nportdisc.c | 2 +- drivers/scsi/lpfc/lpfc_nvme.c | 2 +- drivers/scsi/lpfc/lpfc_nvme.h | 2 +- drivers/scsi/lpfc/lpfc_nvmet.c | 2 +- drivers/scsi/lpfc/lpfc_sli.h | 2 +- drivers/scsi/lpfc/lpfc_vport.c | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-)
drivers/scsi/lpfc/lpfc_bsg.c +1 -1
@@ -1,7 +1,7 @@/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * -* Copyright (C) 2017-2019 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2020 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * * Copyright (C) 2009-2015 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex. *
drivers/scsi/lpfc/lpfc_crtn.h +1 -1
@@ -1,7 +1,7 @@/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * -* Copyright (C) 2017-2019 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2020 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. *
drivers/scsi/lpfc/lpfc_debugfs.c +1 -1
@@ -1,7 +1,7 @@/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * -* Copyright (C) 2017-2019 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2020 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * * Copyright (C) 2007-2015 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex. *
drivers/scsi/lpfc/lpfc_disc.h +1 -1
@@ -1,7 +1,7 @@/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * -* Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2020 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * * Copyright (C) 2004-2013 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex. *
drivers/scsi/lpfc/lpfc_hw4.h +1 -1
@@ -1,7 +1,7 @@/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * -* Copyright (C) 2017-2019 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2020 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * * Copyright (C) 2009-2016 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex. *
drivers/scsi/lpfc/lpfc_nportdisc.c +1 -1
@@ -1,7 +1,7 @@/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * -* Copyright (C) 2017-2019 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2020 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. *
drivers/scsi/lpfc/lpfc_nvme.c +1 -1
@@ -1,7 +1,7 @@/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * -* Copyright (C) 2017-2019 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2020 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. *
drivers/scsi/lpfc/lpfc_nvme.h +1 -1
@@ -1,7 +1,7 @@/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * -* Copyright (C) 2017-2019 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2020 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. *
drivers/scsi/lpfc/lpfc_nvmet.c +1 -1
@@ -1,7 +1,7 @@/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channsel Host Bus Adapters. * -* Copyright (C) 2017-2019 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2020 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. *
drivers/scsi/lpfc/lpfc_sli.h +1 -1
@@ -1,7 +1,7 @@/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * -* Copyright (C) 2017-2019 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2020 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. *
drivers/scsi/lpfc/lpfc_vport.c +1 -1
@@ -1,7 +1,7 @@/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * -* Copyright (C) 2017-2019 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2020 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. *
Signature · 1 line
2.26.2
Martin K. Petersen
AppliedJames,
Quoted 1 line
Update lpfc to revision 12.8.0.6
Applied to 5.11/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 10 lines · James Smart
Update lpfc to revision 12.8.0.6
This patch set contains several sets of recoding and refactoring.
A close look was taken at the driver to identify what was causing continual small state machine errors as well other repeatitive issues. Code review showed several things and this is the first set of changes to address the deficiencies.
[...]
Applied to 5.11/scsi-queue, thanks!
[01/17] scsi: lpfc: Rework remote port ref counting and node freeing
https://git.kernel.org/mkp/scsi/c/307e338097dc [02/17] scsi: lpfc: Rework locations of ndlp reference taking https://git.kernel.org/mkp/scsi/c/4430f7fd09ec [03/17] scsi: lpfc: Fix removal of SCSI transport device get and put on dev structure https://git.kernel.org/mkp/scsi/c/95f0ef8a8368 [04/17] scsi: lpfc: Fix refcounting around SCSI and NVMe transport APIs https://git.kernel.org/mkp/scsi/c/e9b1108316b9 [05/17] scsi: lpfc: Rework remote port lock handling https://git.kernel.org/mkp/scsi/c/c6adba150191 [06/17] scsi: lpfc: Remove ndlp when a PLOGI/ADISC/PRLI/REG_RPI ultimately fails https://git.kernel.org/mkp/scsi/c/52edb2caf675 [07/17] scsi: lpfc: Unsolicited ELS leaves node in incorrect state while dropping it https://git.kernel.org/mkp/scsi/c/9d76d4675159 [08/17] scsi: lpfc: Fix NPIV discovery and Fabric Node detection https://git.kernel.org/mkp/scsi/c/b3f2e67cc2dd [09/17] scsi: lpfc: Fix NPIV Fabric Node reference counting https://git.kernel.org/mkp/scsi/c/a70e63eee1c1 [10/17] scsi: lpfc: Refactor WQE structure definitions for common use https://git.kernel.org/mkp/scsi/c/b101eb27fde0 [11/17] scsi: lpfc: Enable common wqe_template support for both SCSI and NVMe https://git.kernel.org/mkp/scsi/c/840a470181c7 [12/17] scsi: lpfc: Enable common send_io interface for SCSI and NVMe https://git.kernel.org/mkp/scsi/c/47ff4c510f02 [13/17] scsi: lpfc: Convert SCSI path to use common I/O submission path https://git.kernel.org/mkp/scsi/c/da255e2e7cc8 [14/17] scsi: lpfc: Convert SCSI I/O completions to SLI-3 and SLI-4 handlers https://git.kernel.org/mkp/scsi/c/96e209be6ecb [15/17] scsi: lpfc: Convert abort handling to SLI-3 and SLI-4 handlers https://git.kernel.org/mkp/scsi/c/db7531d2b377 [16/17] scsi: lpfc: Update lpfc version to 12.8.0.6 https://git.kernel.org/mkp/scsi/c/ab4dfa4dd5a1 [17/17] scsi: lpfc: Update changed file copyrights for 2020 https://git.kernel.org/mkp/scsi/c/983f761cd5c5
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering