lpfc: Update lpfc to revision 12.8.0.10
Subsystems (3)
cover lpfc: Update lpfc to revision 12.8.0.10
Update lpfc to revision 12.8.0.10
This patch set contains fixes, a new abort behavior, and an RDF enhancment.
The patches were cut against Martin's 5.14/scsi-queue tree
James Smart (11):
lpfc: Fix unreleased RPIs when NPIV ports are created
lpfc: Fix non-optimized ERSP handling
lpfc: Fix "Unexpected timeout" error in direct attach topology
lpfc: Add ndlp kref accounting for resume rpi path
lpfc: Fix Node recovery when driver is handling simultaneous PLOGIs
lpfc: Fix node handling for Fabric Controller and Domain Controller
lpfc: Ignore GID-FT response that may be received after a link flip
lpfc: Fix crash when lpfc_sli4_hba_setup fails to initialize the SGLs
lpfc: Add a option to enable interlocked ABTS before job completion
lpfc: Reregister FPIN types if receive ELS_RDF from fabric controller
lpfc: Update lpfc version to 12.8.0.10
drivers/scsi/lpfc/lpfc.h | 2 + drivers/scsi/lpfc/lpfc_attr.c | 11 ++ drivers/scsi/lpfc/lpfc_crtn.h | 1 + drivers/scsi/lpfc/lpfc_ct.c | 43 ++++- drivers/scsi/lpfc/lpfc_debugfs.c | 11 +- drivers/scsi/lpfc/lpfc_disc.h | 1 + drivers/scsi/lpfc/lpfc_els.c | 299 +++++++++++++++++++++++++++-- drivers/scsi/lpfc/lpfc_hbadisc.c | 81 +++++++- drivers/scsi/lpfc/lpfc_init.c | 7 - drivers/scsi/lpfc/lpfc_mbox.c | 3 +- drivers/scsi/lpfc/lpfc_nportdisc.c | 40 +++- drivers/scsi/lpfc/lpfc_nvme.c | 14 +- drivers/scsi/lpfc/lpfc_scsi.c | 45 ++++- drivers/scsi/lpfc/lpfc_sli.c | 39 +++- drivers/scsi/lpfc/lpfc_sli.h | 3 +- drivers/scsi/lpfc/lpfc_version.h | 2 +- 16 files changed, 529 insertions(+), 73 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/11 lpfc: Fix unreleased RPIs when NPIV ports are created
While testing NPIV and watching logins and used rpi levels, it was seen the used rpi count is much higher than the number of remote ports discovered.
Code inspection showed that remote port removals on any NPIV instance are releasing the RPI, but not performing an UNREG_RPI with the adapter thus the reference counting never fully drops and the rpi is never fully released. This was happening on NPIV nodes due to a log of fabric ELS's to fabric addresses. This lack of UNREG_RPI was introduced by a prior node rework patch that performed the UNREG_RPI as part of node cleanup.
To resolve the issue, the following changes were made:
- Restored the RPI release code, but moved the location to so that it is line with the new node cleanup design.
- NPIV ports now release the RPI and drop the node when the caller sets the NLP_RELEASE_RPI flag.
- Set the NLP_RELEASE_RPI flag in node cleanup which will trigger a release of RPI to free pool.
- Ensure there's an UNREG_RPI at LOGO completion so that rpi release is completed.
- Stop offline_prep from skipping nodes that are UNUSED. The rpi may not have been released.
- Stop the default rpi handling in lpfc_cmpl_els_rsp for SLI4
- Fixed up debugfs rpi displays for better debug
--- drivers/scsi/lpfc/lpfc_debugfs.c | 7 +-- drivers/scsi/lpfc/lpfc_els.c | 79 ++++++++++++++++++++++++------ drivers/scsi/lpfc/lpfc_hbadisc.c | 27 +++++++++- drivers/scsi/lpfc/lpfc_init.c | 7 --- drivers/scsi/lpfc/lpfc_nportdisc.c | 25 +++++++--- drivers/scsi/lpfc/lpfc_sli.c | 10 +++- 6 files changed, 115 insertions(+), 40 deletions(-)
drivers/scsi/lpfc/lpfc_debugfs.c +2 -5
@@ -868,11 +868,8 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) len +=scnprintf (buf+len, size-len,"WWNN x%llx " ,wwn_to_u64 (ndlp->nlp_nodename.u.wwn)); -if (ndlp->nlp_flag &NLP_RPI_REGISTERED ) - len +=scnprintf (buf+len, size-len,"RPI:%04d " , - ndlp->nlp_rpi); -else - len +=scnprintf (buf+len, size-len,"RPI:none " ); + len +=scnprintf (buf+len, size-len,"RPI:x%04x " , + ndlp->nlp_rpi); len +=scnprintf (buf+len, size-len,"flag:x%08x " , ndlp->nlp_flag);if (!ndlp->nlp_type)
drivers/scsi/lpfc/lpfc_els.c +63 -16
145 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_hbadisc.c +25 -2
@@ -4789,12 +4789,17 @@ lpfc_nlp_logo_unreg(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) ndlp->nlp_defer_did =NLP_EVT_NOTHING_PENDING ;lpfc_issue_els_plogi (vport, ndlp->nlp_DID,0 ); }else { +/* NLP_RELEASE_RPI is only set for SLI4 ports. */ if (ndlp->nlp_flag &NLP_RELEASE_RPI ) {lpfc_sli4_free_rpi (vport->phba, ndlp->nlp_rpi); +spin_lock_irq (&ndlp->lock); ndlp->nlp_flag &= ~NLP_RELEASE_RPI ; ndlp->nlp_rpi =LPFC_RPI_ALLOC_ERROR ; +spin_unlock_irq (&ndlp->lock); } +spin_lock_irq (&ndlp->lock); ndlp->nlp_flag &= ~NLP_UNREG_INP ; +spin_unlock_irq (&ndlp->lock); } }
@@ -5129,8 +5134,10 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)list_del_init (&ndlp->dev_loss_evt.evt_listp);list_del_init (&ndlp->recovery_evt.evt_listp);lpfc_cleanup_vports_rrqs (vport, ndlp); +if (phba->sli_rev ==LPFC_SLI_REV4 ) ndlp->nlp_flag |=NLP_RELEASE_RPI ; +return 0 ; }
@@ -6176,8 +6183,23 @@ lpfc_nlp_release(struct kref *kref)lpfc_cancel_retry_delay_tmo (vport, ndlp);lpfc_cleanup_node (vport, ndlp); -/* Clear Node key fields to give other threads notice -* that this node memory is not valid anymore. +/* Not all ELS transactions have registered the RPI with the port. +* In these cases the rpi usage is temporary and the node is +* released when the WQE is completed. Catch this case to free the +* RPI to the pool. Because this node is in the release path, a lock +* is unnecessary. All references are gone and the node has been +* dequeued. +*/ +if (ndlp->nlp_flag &NLP_RELEASE_RPI ) { +if (ndlp->nlp_rpi !=LPFC_RPI_ALLOC_ERROR && + !(ndlp->nlp_flag & (NLP_RPI_REGISTERED |NLP_UNREG_INP ))) { +lpfc_sli4_free_rpi (vport->phba, ndlp->nlp_rpi); + ndlp->nlp_rpi =LPFC_RPI_ALLOC_ERROR ; + } + } + +/* The node is not freed back to memory, it is released to a pool so +* the node fields need to be cleaned up. */ ndlp->vport =NULL ; ndlp->nlp_state =NLP_STE_FREED_NODE ;
@@ -6257,6 +6279,7 @@ lpfc_nlp_not_used(struct lpfc_nodelist *ndlp)"node not used: did:x%x flg:x%x refcnt:x%x" , ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref)); +if (kref_read (&ndlp->kref) ==1 )if (lpfc_nlp_put (ndlp))return 1 ;
drivers/scsi/lpfc/lpfc_init.c +0 -7
@@ -3532,13 +3532,6 @@ lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action)list_for_each_entry_safe (ndlp, next_ndlp, &vports[i]->fc_nodes, nlp_listp) { -if (ndlp->nlp_state ==NLP_STE_UNUSED_NODE ) { -/* Driver must assume RPI is invalid for -* any unused or inactive node. -*/ - ndlp->nlp_rpi =LPFC_RPI_ALLOC_ERROR ; -continue ; - }spin_lock_irq (&ndlp->lock); ndlp->nlp_flag &= ~NLP_NPR_ADISC ;
drivers/scsi/lpfc/lpfc_nportdisc.c +17 -8
@@ -567,15 +567,24 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,/* no deferred ACC */ kfree (save_iocb); -/* In order to preserve RPIs, we want to cleanup -* the default RPI the firmware created to rcv -* this ELS request. The only way to do this is -* to register, then unregister the RPI. +/* This is an NPIV SLI4 instance that does not need to register +* a default RPI. */ -spin_lock_irq (&ndlp->lock); - ndlp->nlp_flag |= (NLP_RM_DFLT_RPI |NLP_ACC_REGLOGIN | -NLP_RCV_PLOGI ); -spin_unlock_irq (&ndlp->lock); +if (phba->sli_rev ==LPFC_SLI_REV4 ) { +mempool_free (login_mbox, phba->mbox_mem_pool); + login_mbox =NULL ; + }else { +/* In order to preserve RPIs, we want to cleanup +* the default RPI the firmware created to rcv +* this ELS request. The only way to do this is +* to register, then unregister the RPI. +*/ +spin_lock_irq (&ndlp->lock); + ndlp->nlp_flag |= (NLP_RM_DFLT_RPI |NLP_ACC_REGLOGIN | +NLP_RCV_PLOGI ); +spin_unlock_irq (&ndlp->lock); + } + stat.un.b.lsRjtRsnCode =LSRJT_INVALID_CMD ; stat.un.b.lsRjtRsnCodeExp =LSEXP_NOTHING_MORE ; rc = lpfc_els_rsp_reject(vport, stat.un.lsRjtError, cmdiocb,
drivers/scsi/lpfc/lpfc_sli.c +8 -2
@@ -13625,9 +13625,15 @@ lpfc_sli4_sp_handle_mbox_event(struct lpfc_hba *phba, struct lpfc_mcqe *mcqe)if (mcqe_status ==MB_CQE_STATUS_SUCCESS ) { mp = (struct lpfc_dmabuf *)(pmb->ctx_buf); ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; -/* Reg_LOGIN of dflt RPI was successful. Now lets get -* RID of the PPI using the same mbox buffer. + +/* Reg_LOGIN of dflt RPI was successful. Mark the +* node as having an UNREG_LOGIN in progress to stop +* an unsolicited PLOGI from the same NPortId from +* starting another mailbox transaction. */ +spin_lock_irqsave (&ndlp->lock, iflags); + ndlp->nlp_flag |=NLP_UNREG_INP ; +spin_unlock_irqrestore (&ndlp->lock, iflags);lpfc_unreg_login (phba, vport->vpi, pmbox->un.varWords[0 ], pmb); pmb->mbox_cmpl = lpfc_mbx_cmpl_dflt_rpi;
Signature · 1 line
2.26.2
PATCH 2/11 lpfc: Fix non-optimized ERSP handling
In reply to James SmartWhen processing an nvme ERSP IU which didn't match the optimized CQE-only path, the status was being left to the WQE status. WQE status is non-zero as it is indicating a non-optimized completion that needs to be handled by the driver.
Fix by clearing the status field when falling into the non-optimized case. log message added to track optimized vs non-optimized debug.
--- drivers/scsi/lpfc/lpfc_nvme.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_nvme.c +12 -2
@@ -1049,9 +1049,19 @@ lpfc_nvme_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, nCmd->transferred_length = wcqe->total_data_placed; nCmd->rcv_rsplen = wcqe->parameter; nCmd->status =0 ; -/* Sanity check */ -if (nCmd->rcv_rsplen ==LPFC_NVME_ERSP_LEN ) + +/* Check if this is really an ERSP */ +if (nCmd->rcv_rsplen ==LPFC_NVME_ERSP_LEN ) { + lpfc_ncmd->status =IOSTAT_SUCCESS ; + lpfc_ncmd->result =0 ; + +lpfc_printf_vlog (vport,KERN_INFO ,LOG_NVME , +"6084 NVME Completion ERSP: " +"xri %x placed x%x\n" , + lpfc_ncmd->cur_iocbq.sli4_xritag, + wcqe->total_data_placed);break ; + }lpfc_printf_vlog (vport,KERN_ERR ,LOG_TRACE_EVENT ,"6081 NVME Completion Protocol Error: " "xri %x status x%x result x%x "
Signature · 1 line
2.26.2
PATCH 3/11 lpfc: Fix "Unexpected timeout" error in direct attach topology
In reply to James SmartAn 'unexpected timeout' message may be seen in a pt-2-pt topology. The message occurs when a PLOGI is received before the driver is notified of FLOGI completion. The FLOGI completion failure causes discovery to be triggered for a second time. The discovery timer is restarted but no new discovery activity is initiated, thus the timeout message eventually appears.
In pt-2-pt, when discovery has progressed before the FLOGI completion is processed, it is not a failure. Add code to FLOGI completion to detect that discovery has progressed and exit the FLOGI handling (noop'ing it).
--- drivers/scsi/lpfc/lpfc_els.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/scsi/lpfc/lpfc_els.c +9 -0
@@ -1175,6 +1175,15 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, phba->fcf.fcf_redisc_attempted =0 ;/* reset */ goto out; } + }else if (vport->port_state >LPFC_FLOGI && + vport->fc_flag &FC_PT2PT ) { +/* +* In a p2p topology, it is possible that discovery has +* already progressed, and this completion can be ignored. +* Recheck the indicated topology. +*/ +if (!sp->cmn.fPort) + goto out; } flogifail:
Signature · 1 line
2.26.2
PATCH 4/11 lpfc: Add ndlp kref accounting for resume rpi path
In reply to James SmartThe driver is crashing due to a bad pointer during driver load due in an adisc acc receive routine. The driver is missing node get/put in the mbx_resume_rpi paths.
Fix by adding the proper gets and puts into the resume_rpi path.
--- drivers/scsi/lpfc/lpfc_nportdisc.c | 4 ++++ drivers/scsi/lpfc/lpfc_sli.c | 23 ++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_nportdisc.c +4 -0
@@ -662,6 +662,10 @@ lpfc_mbx_cmpl_resume_rpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)lpfc_els_rsp_acc (vport,ELS_CMD_PLOGI , elsiocb, ndlp,NULL ); } + +/* This nlp_put pairs with lpfc_sli4_resume_rpi */ +lpfc_nlp_put (ndlp); +kfree (elsiocb);mempool_free (mboxq, phba->mbox_mem_pool); }
drivers/scsi/lpfc/lpfc_sli.c +22 -1
@@ -2679,6 +2679,12 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) } } +/* This nlp_put pairs with lpfc_sli4_resume_rpi */ +if (pmb->u.mb.mbxCommand ==MBX_RESUME_RPI ) { + ndlp = (struct lpfc_nodelist *)pmb->ctx_ndlp; +lpfc_nlp_put (ndlp); + } +/* Check security permission status on INIT_LINK mailbox command */ if ((pmb->u.mb.mbxCommand ==MBX_INIT_LINK ) && (pmb->u.mb.mbxStatus ==MBXERR_SEC_NO_PERMISSION ))
@@ -19037,14 +19043,28 @@ lpfc_sli4_resume_rpi(struct lpfc_nodelist *ndlp,if (!mboxq)return -ENOMEM ; +/* If cmpl assigned, then this nlp_get pairs with +* lpfc_mbx_cmpl_resume_rpi. +* +* Else cmpl is NULL, then this nlp_get pairs with +* lpfc_sli_def_mbox_cmpl. +*/ +if (!lpfc_nlp_get (ndlp)) { +lpfc_printf_log (phba,KERN_ERR ,LOG_TRACE_EVENT , +"2122 %s: Failed to get nlp ref\n" , + __func__); +mempool_free (mboxq, phba->mbox_mem_pool); +return -EIO ; + } +/* Post all rpi memory regions to the port. */ lpfc_resume_rpi (mboxq, ndlp);if (cmpl) { mboxq->mbox_cmpl = cmpl; mboxq->ctx_buf = arg; - mboxq->ctx_ndlp = ndlp; }else mboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; + mboxq->ctx_ndlp = ndlp; mboxq->vport = ndlp->vport; rc =lpfc_sli_issue_mbox (phba, mboxq,MBX_NOWAIT );if (rc ==MBX_NOT_FINISHED ) {
@@ -19052,6 +19072,7 @@ lpfc_sli4_resume_rpi(struct lpfc_nodelist *ndlp,"2010 Resume RPI Mailbox failed " "status %d, mbxStatus x%x\n" , rc, bf_get(lpfc_mqe_status, &mboxq->u.mqe)); +lpfc_nlp_put (ndlp);mempool_free (mboxq, phba->mbox_mem_pool);return -EIO ; }
Signature · 1 line
2.26.2
PATCH 5/11 lpfc: Fix Node recovery when driver is handling simultaneous PLOGIs
In reply to James SmartWhen lpfc is handling a solicited and unsolicited PLOGI with another initiator, the remote initiator is never recovered. The node for the initiator is erroneouosly removed and all resources released.
In lpfc_cmpl_els_plogi, when lpfc_els_retry returns a failure code, the driver is calling the state machine with a device remove event because the remote port is not currently registered with the SCSI or nvme transports. The issue is that on a PLOGI "collision" the driver correctly aborts the solicited PLOGI and allows the unsolicited PLOGI to complete the process, but this process is interrupted with a device_rm event.
Introduce logic in the PLOGI completion to capture the PLOGI collision event and jump out of the routine. This will avoid removal of the node. If there is no collision, the normal node removal will occur.
--- drivers/scsi/lpfc/lpfc_els.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +18 -3
@@ -2007,9 +2007,20 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,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 a PLOGI collision occurred, the node needs to continue +* with the reglogin process. +*/ +spin_lock_irq (&ndlp->lock); +if ((ndlp->nlp_flag & (NLP_ACC_REGLOGIN |NLP_RCV_PLOGI )) && + ndlp->nlp_state ==NLP_STE_REG_LOGIN_ISSUE ) { +spin_unlock_irq (&ndlp->lock); + goto out; + } +spin_unlock_irq (&ndlp->lock); + +/* No PLOGI collision and the node is not registered with the +* scsi or nvme transport. It is no longer an active node. Just +* start the device remove process. */ if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD |NVME_XPT_REGD ))) {spin_lock_irq (&ndlp->lock);
@@ -4629,6 +4640,10 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, (vport && vport->port_type == LPFC_NPIV_PORT) && ndlp->nlp_flag & NLP_RELEASE_RPI) {lpfc_sli4_free_rpi (phba, ndlp->nlp_rpi); +spin_lock_irq (&ndlp->lock); + ndlp->nlp_rpi =LPFC_RPI_ALLOC_ERROR ; + ndlp->nlp_flag &= ~NLP_RELEASE_RPI ; +spin_unlock_irq (&ndlp->lock);lpfc_drop_node (vport, ndlp); }
Signature · 1 line
2.26.2
PATCH 6/11 lpfc: Fix node handling for Fabric Controller and Domain Controller
In reply to James SmartDuring link bounce testing, rpi counts were seen to differ from the number of nodes For fabric and domain controllers, a temporary rpi is assigned, but the code isn't registering it. If the nodes do go away, such as on link down, the temporary rpi isn't being released.
Change the way these two fabric services are managed, make them behave like any other remote port. Register the rpi and register with the transport. Never leave the nodes in a NPR or UNUSED state where their rpi is in limbo. This allows them to follow normal dev_loss_tmo handling, rpi refcounting, and normal removal rules. It also allows fabric I/Os to use the rpi for traffic requests.
Note: There is some logic that still has a couple of exceptions when the Domain controller (0xfffcXX). There are cases where the fabric won't have a valid login but will send RDP. Other times, it will it send a LOGO then an RDP. It makes for adhoc behavior to manage the node. Exceptions are documented in the code.
--- drivers/scsi/lpfc/lpfc_crtn.h | 1 + drivers/scsi/lpfc/lpfc_debugfs.c | 4 +- drivers/scsi/lpfc/lpfc_disc.h | 1 + drivers/scsi/lpfc/lpfc_els.c | 137 ++++++++++++++++++++++++++--- drivers/scsi/lpfc/lpfc_hbadisc.c | 54 +++++++++++- drivers/scsi/lpfc/lpfc_nportdisc.c | 11 +++ drivers/scsi/lpfc/lpfc_sli.c | 1 - 7 files changed, 189 insertions(+), 20 deletions(-)
drivers/scsi/lpfc/lpfc_crtn.h +1 -0
@@ -80,6 +80,7 @@ void lpfc_mbx_cmpl_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);void lpfc_mbx_cmpl_dflt_rpi (struct lpfc_hba *,LPFC_MBOXQ_t *);void lpfc_mbx_cmpl_fabric_reg_login (struct lpfc_hba *,LPFC_MBOXQ_t *);void lpfc_mbx_cmpl_ns_reg_login (struct lpfc_hba *,LPFC_MBOXQ_t *); +void lpfc_mbx_cmpl_fc_reg_login (struct lpfc_hba *phba,LPFC_MBOXQ_t *pmb);void lpfc_mbx_cmpl_fdmi_reg_login (struct lpfc_hba *,LPFC_MBOXQ_t *);void lpfc_mbx_cmpl_reg_vfi (struct lpfc_hba *,LPFC_MBOXQ_t *);void lpfc_unregister_vfi_cmpl (struct lpfc_hba *,LPFC_MBOXQ_t *);
drivers/scsi/lpfc/lpfc_debugfs.c +2 -2
@@ -863,10 +863,10 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) len +=scnprintf (buf+len, size-len,"%s DID:x%06x " , statep, ndlp->nlp_DID); len +=scnprintf (buf+len, size-len, -"WWPN x%llx " , +"WWPN x%016llx " ,wwn_to_u64 (ndlp->nlp_portname.u.wwn)); len +=scnprintf (buf+len, size-len, -"WWNN x%llx " , +"WWNN x%016llx " ,wwn_to_u64 (ndlp->nlp_nodename.u.wwn)); len +=scnprintf (buf+len, size-len,"RPI:x%04x " , ndlp->nlp_rpi);
drivers/scsi/lpfc/lpfc_disc.h +1 -0
@@ -86,6 +86,7 @@ enum lpfc_fc4_xpt_flags {struct lpfc_nodelist {struct list_head nlp_listp; +struct serv_parm fc_sparam;/* buffer for service params */ struct lpfc_name nlp_portname;struct lpfc_name nlp_nodename;
drivers/scsi/lpfc/lpfc_els.c +124 -13
182 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_hbadisc.c +50 -4
72 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_nportdisc.c +11 -0
@@ -785,6 +785,15 @@ lpfc_rcv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,else lpfc_els_rsp_acc (vport,ELS_CMD_ACC , cmdiocb, ndlp,NULL ); +/* This clause allows the initiator to ACC the LOGO back to the +* Fabric Domain Controller. It does deliberately skip all other +* steps because some fabrics send RDP requests after logging out +* from the initiator. +*/ +if (ndlp->nlp_type &NLP_FABRIC && + ((ndlp->nlp_DID &WELL_KNOWN_DID_MASK ) !=WELL_KNOWN_DID_MASK )) +return 0 ; +/* Notify transport of connectivity loss to trigger cleanup. */ if (phba->nvmet_support && ndlp->nlp_state ==NLP_STE_UNMAPPED_NODE )
@@ -1423,6 +1432,8 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,switch (ndlp->nlp_DID) {case NameServer_DID: mbox->mbox_cmpl = lpfc_mbx_cmpl_ns_reg_login; +/* Fabric Controller Node needs these parameters. */ +memcpy (&ndlp->fc_sparam, sp,sizeof (struct serv_parm ));break ;case FDMI_DID : mbox->mbox_cmpl = lpfc_mbx_cmpl_fdmi_reg_login;
drivers/scsi/lpfc/lpfc_sli.c +0 -1
@@ -2755,7 +2755,6 @@ 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); } }
Signature · 1 line
2.26.2
PATCH 7/11 lpfc: Ignore GID-FT response that may be received after a link flip
In reply to James SmartWhen a link bounce happens, there is a possibility that responses to requests posted prior to the link bounce could be received. This is problematic as the counter to track reglogin completion after link up can become out of sync with the real state.
As there is no reason to process a request made in a prior link up context, eliminate all the disturbance by tagging the request with the event_tag maintained by the SLI Port for the link. The event_tag will change on every link state transition. As long as the tag matches the current event_tag, the response can be processed. If it doesn't match, just discard the response.
--- drivers/scsi/lpfc/lpfc_ct.c | 43 ++++++++++++++++++++++++++++++------ drivers/scsi/lpfc/lpfc_sli.h | 3 ++- 2 files changed, 38 insertions(+), 8 deletions(-)
drivers/scsi/lpfc/lpfc_ct.c +36 -7
@@ -587,7 +587,7 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp, struct lpfc_dmabuf *inp, struct lpfc_dmabuf *outp, void (*cmpl) (struct lpfc_hba *, struct lpfc_iocbq *,struct lpfc_iocbq *), - struct lpfc_nodelist *ndlp, uint32_t usr_flg, uint32_t num_entry, + struct lpfc_nodelist *ndlp, uint32_t event_tag, uint32_t num_entry, uint32_t tmo, uint8_t retry) { struct lpfc_hba *phba = vport->phba;
@@ -608,15 +608,14 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp, icmd->un.genreq64.bdl.bdeFlags =BUFF_TYPE_BLP_64 ; icmd->un.genreq64.bdl.bdeSize = (num_entry *sizeof (struct ulp_bde64 )); -if (usr_flg) - geniocb->context3 =NULL ; -else - geniocb->context3 = (uint8_t *) bmp; + geniocb->context3 = (uint8_t *) bmp;/* Save for completion so we can release these resources */ geniocb->context1 = (uint8_t *) inp; geniocb->context2 = (uint8_t *) outp; + geniocb->event_tag = event_tag; +/* Fill in payload, bp points to frame payload */ icmd->ulpCommand =CMD_GEN_REQUEST64_CR ;
@@ -707,8 +706,8 @@ lpfc_ct_cmd(struct lpfc_vport *vport, struct lpfc_dmabuf *inmp,* lpfc_alloc_ct_rsp. */ cnt +=1 ; - status =lpfc_gen_req (vport, bmp, inmp, outmp, cmpl, ndlp,0 , - cnt,0 , retry); + status =lpfc_gen_req (vport, bmp, inmp, outmp, cmpl, ndlp, + phba->fc_eventTag, cnt,0 , retry);if (status) {lpfc_free_ct_rsp (phba, outmp);return -ENOMEM ;
@@ -957,6 +956,13 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,"GID_FT cmpl: status:x%x/x%x rtry:%d" , irsp->ulpStatus, irsp->un.ulpWord[4], vport->fc_ns_retry); +/* Ignore response if link flipped after this request was made */ +if (cmdiocb->event_tag != phba->fc_eventTag) { +lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY , +"9043 Event tag mismatch. Ignoring NS rsp\n" ); + goto out; + } +/* Don't bother processing response if vport is being torn down. */ if (vport->load_flag &FC_UNLOADING ) {if (vport->fc_flag &FC_RSCN_MODE )
@@ -1167,6 +1173,13 @@ lpfc_cmpl_ct_cmd_gid_pt(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, irsp->ulpStatus, irsp->un.ulpWord[4 ], vport->fc_ns_retry); +/* Ignore response if link flipped after this request was made */ +if (cmdiocb->event_tag != phba->fc_eventTag) { +lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY , +"9044 Event tag mismatch. Ignoring NS rsp\n" ); + goto out; + } +/* Don't bother processing response if vport is being torn down. */ if (vport->load_flag &FC_UNLOADING ) {if (vport->fc_flag &FC_RSCN_MODE )
@@ -1366,6 +1379,13 @@ lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,"GFF_ID cmpl: status:x%x/x%x did:x%x" , irsp->ulpStatus, irsp->un.ulpWord[4], did); +/* Ignore response if link flipped after this request was made */ +if (cmdiocb->event_tag != phba->fc_eventTag) { +lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY , +"9045 Event tag mismatch. Ignoring NS rsp\n" ); + goto iocb_free; + } +if (irsp->ulpStatus ==IOSTAT_SUCCESS ) {/* Good status, continue checking */ CTrsp = (struct lpfc_sli_ct_request *) outp->virt;
@@ -1479,6 +1499,7 @@ lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,lpfc_disc_start (vport); } +iocb_free: free_ndlp = cmdiocb->context_un.ndlp;lpfc_ct_free_iocb (phba, cmdiocb);lpfc_nlp_put (free_ndlp);
@@ -1506,6 +1527,13 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,"GFT_ID cmpl: status:x%x/x%x did:x%x" , irsp->ulpStatus, irsp->un.ulpWord[4], did); +/* Ignore response if link flipped after this request was made */ +if ((uint32_t ) cmdiocb->event_tag != phba->fc_eventTag) { +lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY , +"9046 Event tag mismatch. Ignoring NS rsp\n" ); + goto out; + } +/* Preserve the nameserver node to release the reference. */ ns_ndlp = cmdiocb->context_un.ndlp;
@@ -1572,6 +1600,7 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,lpfc_printf_vlog (vport,KERN_ERR ,LOG_TRACE_EVENT ,"3065 GFT_ID failed x%08x\n" , irsp->ulpStatus); +out:lpfc_ct_free_iocb (phba, cmdiocb);lpfc_nlp_put (ns_ndlp); }
drivers/scsi/lpfc/lpfc_sli.h +2 -1
@@ -1,7 +1,7 @@/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * -* Copyright (C) 2017-2020 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2021 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. *
@@ -106,6 +106,7 @@ struct lpfc_iocbq {void *context1;/* caller context information */ void *context2;/* caller context information */ void *context3;/* caller context information */ +uint32_t event_tag;/* LA Event tag */ union {wait_queue_head_t *wait_queue;struct lpfc_iocbq *rsp_iocb;
Signature · 1 line
2.26.2
PATCH 8/11 lpfc: Fix crash when lpfc_sli4_hba_setup fails to initialize the SGLs
In reply to James SmartThe driver is encountering a crash in lpfc_free_iocb_list() while performing initial attachment.
Code review found this to be an errant failure path that was taken, jumping to a tag that then referenced structures that were uninitialized.
Fix the failure path.
--- drivers/scsi/lpfc/lpfc_sli.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +3 -2
@@ -7964,7 +7964,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)"0393 Error %d during rpi post operation\n" , rc); rc = -ENODEV ; - goto out_destroy_queue; + goto out_free_iocblist; }lpfc_sli4_node_prep (phba);
@@ -8130,8 +8130,9 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) out_unset_queue:/* Unset all the queues set up in this routine when error out */ lpfc_sli4_queue_unset (phba); -out_destroy_queue: +out_free_iocblist:lpfc_free_iocb_list (phba); +out_destroy_queue:lpfc_sli4_queue_destroy (phba); out_stop_timers:lpfc_stop_hba_timers (phba);
Signature · 1 line
2.26.2
PATCH 9/11 lpfc: Add a option to enable interlocked ABTS before job completion
In reply to James SmartDefault behavior for the driver, when aborting an io, is to terminate the io with the adapter. The adapter will initiate an ABTS to terminate the exchange on the link and mark the exchange is terminated so that no further use of the sgl or any traffic for the exchange is worked on. Completion on the Abort is then posted to the driver, which as the io is terminated can complete the I/O to the OS. This completion may occur prior to the ABTS handshake completing on the wire. The ABTS handshake can take a long time to complete with timeouts and retries reaching 60+ seconds. Note: if retries fail, LOGO occurs.
Some devices want to ensure that the ABTS handshake fully completes (this device has fully ack'd it) before the I/O completion is posted back to the OS, where a failed i/o may be retried via a different path.
To support this behavior, an option was added to the driver to change I/O completion from the Abort cmd completion to the Exchange termination (aka ABTS) completion.
--- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_attr.c | 11 +++++++++ drivers/scsi/lpfc/lpfc_mbox.c | 3 ++- drivers/scsi/lpfc/lpfc_scsi.c | 45 ++++++++++++++++++++++++++++++----- 4 files changed, 53 insertions(+), 7 deletions(-)
drivers/scsi/lpfc/lpfc.h +1 -0
@@ -915,6 +915,7 @@ struct lpfc_hba {uint32_t cfg_request_firmware_upgrade;uint32_t cfg_suppress_link_up;uint32_t cfg_rrq_xri_bitmap_sz; +u32 cfg_fcp_wait_abts_rsp;uint32_t cfg_delay_discovery;uint32_t cfg_sli_mode;#define LPFC_INITIALIZE_LINK 0/* do normal init_link mbox */
drivers/scsi/lpfc/lpfc_attr.c +11 -0
@@ -3448,6 +3448,15 @@ LPFC_ATTR_R(enable_npiv, 1, 0, 1,LPFC_ATTR_R (fcf_failover_policy,1 ,1 ,2 ,"FCF Fast failover=1 Priority failover=2" ); +/* +* lpfc_fcp_wait_abts_rsp: Modifies criteria for reporting completion of +* aborted IO. +* The range is [0,1]. Default value is 0 +* 0, IO completes after ABTS issued (default). +* 1, IO completes after receipt of ABTS response or timeout. +*/ +LPFC_ATTR_R (fcp_wait_abts_rsp,0 ,0 ,1 ,"Wait for FCP ABTS completion" ); +/* # lpfc_enable_rrq: Track XRI/OXID reuse after IO failures # 0x0 = disabled, XRI/OXID use not tracked.
@@ -6205,6 +6214,7 @@ struct device_attribute *lpfc_hba_attrs[] = { &dev_attr_lpfc_enable_npiv, &dev_attr_lpfc_fcf_failover_policy, &dev_attr_lpfc_enable_rrq, + &dev_attr_lpfc_fcp_wait_abts_rsp, &dev_attr_nport_evt_cnt, &dev_attr_board_mode, &dev_attr_max_vpi,
@@ -7332,6 +7342,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)lpfc_enable_npiv_init (phba, lpfc_enable_npiv);lpfc_fcf_failover_policy_init (phba, lpfc_fcf_failover_policy);lpfc_enable_rrq_init (phba, lpfc_enable_rrq); +lpfc_fcp_wait_abts_rsp_init (phba, lpfc_fcp_wait_abts_rsp);lpfc_fdmi_on_init (phba, lpfc_fdmi_on);lpfc_enable_SmartSAN_init (phba, lpfc_enable_SmartSAN);lpfc_use_msi_init (phba, lpfc_use_msi);
drivers/scsi/lpfc/lpfc_mbox.c +2 -1
@@ -522,7 +522,8 @@ lpfc_init_link(struct lpfc_hba * phba, }/* Enable asynchronous ABTS responses from firmware */ - mb->un.varInitLnk.link_flags |=FLAGS_IMED_ABORT ; +if (phba->sli_rev ==LPFC_SLI_REV3 && !phba->cfg_fcp_wait_abts_rsp) + mb->un.varInitLnk.link_flags |=FLAGS_IMED_ABORT ;/* NEW_FEATURE * Setting up the link speed
drivers/scsi/lpfc/lpfc_scsi.c +39 -6
103 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 10/11 lpfc: Reregister FPIN types if receive ELS_RDF from fabric controller
In reply to James SmartFC-LS-5 specifies that a received RDF implies a possible change to fabric supported diagnostic functions. Endpoints are to re-perform the RDF exchange with the fabric to enable possible new features or adapt to changes in values.
This patch adds the logic to RDF receive to re-perform the RDF exchange with the switch.
--- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_els.c | 75 ++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+)
drivers/scsi/lpfc/lpfc.h +1 -0
@@ -266,6 +266,7 @@ struct lpfc_stats {uint32_t elsRcvECHO;uint32_t elsRcvLCB;uint32_t elsRcvRDP; +uint32_t elsRcvRDF;uint32_t elsXmitFLOGI;uint32_t elsXmitFDISC;uint32_t elsXmitPLOGI;
drivers/scsi/lpfc/lpfc_els.c +75 -0
99 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 11/11 lpfc: Update lpfc version to 12.8.0.10
In reply to James SmartUpdate lpfc version to 12.8.0.10
--- drivers/scsi/lpfc/lpfc_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_version.h +1 -1
@@ -20,7 +20,7 @@* included with this package. * *******************************************************************/ -#define LPFC_DRIVER_VERSION "12.8.0.9" +#define LPFC_DRIVER_VERSION "12.8.0.10"#define LPFC_DRIVER_NAME "lpfc"/* Used for SLI 2/3 */
Signature · 1 line
2.26.2
Martin K. Petersen
AppliedJames,
Quoted 1 line
Update lpfc to revision 12.8.0.10
Applied to 5.14/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 8 lines · James Smart
Update lpfc to revision 12.8.0.10
This patch set contains fixes, a new abort behavior, and an RDF enhancment.
The patches were cut against Martin's 5.14/scsi-queue tree
[...]
Applied to 5.14/scsi-queue, thanks!
[01/11] lpfc: Fix unreleased RPIs when NPIV ports are created
https://git.kernel.org/mkp/scsi/c/01131e7aae5d [02/11] lpfc: Fix non-optimized ERSP handling https://git.kernel.org/mkp/scsi/c/fa21189db9ab [03/11] lpfc: Fix "Unexpected timeout" error in direct attach topology https://git.kernel.org/mkp/scsi/c/e30d55137ede [04/11] lpfc: Add ndlp kref accounting for resume rpi path https://git.kernel.org/mkp/scsi/c/1037e4b4f81d [05/11] lpfc: Fix Node recovery when driver is handling simultaneous PLOGIs https://git.kernel.org/mkp/scsi/c/4012baeab6ca [06/11] lpfc: Fix node handling for Fabric Controller and Domain Controller https://git.kernel.org/mkp/scsi/c/fe83e3b9b422 [07/11] lpfc: Ignore GID-FT response that may be received after a link flip https://git.kernel.org/mkp/scsi/c/04c1d9c50ae3 [08/11] lpfc: Fix crash when lpfc_sli4_hba_setup fails to initialize the SGLs https://git.kernel.org/mkp/scsi/c/5aa615d195f1 [09/11] lpfc: Add a option to enable interlocked ABTS before job completion https://git.kernel.org/mkp/scsi/c/3e49af9393c6 [10/11] lpfc: Reregister FPIN types if receive ELS_RDF from fabric controller https://git.kernel.org/mkp/scsi/c/8eced807077d [11/11] lpfc: Update lpfc version to 12.8.0.10 https://git.kernel.org/mkp/scsi/c/e5e0280db792
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering