Update lpfc to revision 14.4.0.6
Subsystems (2)
cover Update lpfc to revision 14.4.0.6
Update lpfc to revision 14.4.0.6
This patch set contains bug fixes related to congestion handling, accounting for internal remoteport objects, resource release during HBA unload and reset, and clean up regarding the abuse of a global spinlock.
The patches were cut against Martin's 6.13/scsi-queue tree.
Justin Tee (11):
lpfc: Modify cgn warning signal calculation based on EDC response
lpfc: Check devloss callbk done flag for potential stale ndlp ptrs
lpfc: Call lpfc_sli4_queue_unset in restart and rmmod paths
lpfc: Update lpfc_els_flush_cmd to check for SLI_ACTIVE before BSG
flag
lpfc: Check SLI_ACTIVE flag in FDMI cmpl before submitting follow up
FDMI
lpfc: Add cleanup of nvmels_wq after HBA reset
lpfc: Prevent ndlp reference count underflow in dev_loss_tmo callback
lpfc: Remove NLP_RELEASE_RPI flag from nodelist structure
lpfc: Change lpfc_nodelist nlp_flag member into a bitmask
lpfc: Update lpfc version to 14.4.0.6
lpfc: Copyright updates for 14.4.0.6 patches
drivers/scsi/lpfc/lpfc_bsg.c | 6 +- drivers/scsi/lpfc/lpfc_crtn.h | 5 +- drivers/scsi/lpfc/lpfc_ct.c | 39 +-- drivers/scsi/lpfc/lpfc_debugfs.c | 4 +- drivers/scsi/lpfc/lpfc_disc.h | 62 ++-- drivers/scsi/lpfc/lpfc_els.c | 459 ++++++++++++----------------- drivers/scsi/lpfc/lpfc_hbadisc.c | 311 ++++++++----------- drivers/scsi/lpfc/lpfc_init.c | 61 ++-- drivers/scsi/lpfc/lpfc_nportdisc.c | 329 +++++++++------------ drivers/scsi/lpfc/lpfc_nvme.c | 60 +++- drivers/scsi/lpfc/lpfc_nvmet.c | 2 +- drivers/scsi/lpfc/lpfc_scsi.c | 8 +- drivers/scsi/lpfc/lpfc_sli.c | 125 ++++---- drivers/scsi/lpfc/lpfc_version.h | 2 +- drivers/scsi/lpfc/lpfc_vport.c | 6 +- 15 files changed, 665 insertions(+), 814 deletions(-)
Signature · 1 line
2.38.0
PATCH 1/11 lpfc: Modify cgn warning signal calculation based on EDC response
CGN warning signals are currently statically fixed to a passed in driver parameter called lpfc_fabric_cgn_frequency. However, CGN frequency should be more correctly based on EDC responses from the fabric when available. Otherwise, still allow the driver to fall back on user configured lpfc_fabric_cgn_frequency driver parameter.
--- drivers/scsi/lpfc/lpfc_sli.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +4 -2
@@ -1932,7 +1932,7 @@ lpfc_issue_cmf_sync_wqe(struct lpfc_hba *phba, u32 ms, u64 total)union lpfc_wqe128 *wqe;struct lpfc_iocbq *sync_buf;unsigned long iflags; -u32 ret_val; +u32 ret_val, cgn_sig_freq;u32 atot, wtot, max;u8 warn_sync_period =0 ;
@@ -1987,8 +1987,10 @@ lpfc_issue_cmf_sync_wqe(struct lpfc_hba *phba, u32 ms, u64 total) }else if (wtot) {if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ONLY || phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ALARM ) { + cgn_sig_freq = phba->cgn_sig_freq ? phba->cgn_sig_freq : + lpfc_fabric_cgn_frequency;/* We hit an Signal warning condition */ - max =LPFC_SEC_TO_MSEC / lpfc_fabric_cgn_frequency * + max =LPFC_SEC_TO_MSEC / cgn_sig_freq * lpfc_acqe_cgn_frequency;bf_set (cmf_sync_wsigmax, &wqe->cmf_sync, max);bf_set (cmf_sync_wsigcnt, &wqe->cmf_sync, wtot);
Signature · 1 line
2.38.0
PATCH 2/11 lpfc: Check devloss callbk done flag for potential stale ndlp ptrs
In reply to Justin TeeShould an rport remain in the NOTPRESENT state it is possible that stgt_delete_work is scheduled after dev_loss_tmo_callbk. In such cases, dev_loss_tmo_callbk would have cleaned up the ndlp object resulting in stale ndlp pointers in lpfc_terminate_rport_io.
Check for the DEVLOSS_CALLBK_DONE flag to know if dev_loss_tmo_callbk has been called. This is a more reliable way to avoid dereferencing stale ndlp pointers.
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/scsi/lpfc/lpfc_hbadisc.c +6 -0
@@ -100,6 +100,12 @@ lpfc_rport_invalid(struct fc_rport *rport)return -EINVAL ; } +if (rport->flags &FC_RPORT_DEVLOSS_CALLBK_DONE ) { +pr_info ("**** %s: devloss_callbk_done rport x%px SID x%x\n" , + __func__, rport, rport->scsi_target_id); +return -EINVAL ; + } + rdata = rport->dd_data;if (!rdata) { pr_err("**** %s: NULL dd_data on rport x%px SID x%x\n",
Signature · 1 line
2.38.0
PATCH 3/11 lpfc: Call lpfc_sli4_queue_unset in restart and rmmod paths
In reply to Justin TeeDuring initialization, the driver allocates wq->pring in lpfc_wq_create and lpfc_sli4_queue_unset is the only place where kfree(wq->pring) is called.
There is a possible memory leak in lpfc_sli_brdrestart_s4 (restart) and lpfc_pci_remove_one_s4 (rmmod) paths because there are no calls to lpfc_sli4_queue_unset to kfree the wq->pring.
Fix by inserting a call to lpfc_sli4_queue_unset in lpfc_sli_brdrestart_s4 and lpfc_sli4_hba_unset routines. Also, add a check for the SLI_ACTIVE flag before issuing the Q_DESTROY mailbox command. If not set, then the mailbox command will obviously fail. In such cases, skip issuing the mailbox command and only execute the driver resource clean up portions of the lpfc_*q_destroy routines.
--- drivers/scsi/lpfc/lpfc_init.c | 2 ++ drivers/scsi/lpfc/lpfc_sli.c | 41 ++++++++++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +2 -0
@@ -13518,6 +13518,8 @@ lpfc_sli4_hba_unset(struct lpfc_hba *phba)/* Disable FW logging to host memory */ lpfc_ras_stop_fwlog (phba); +lpfc_sli4_queue_unset (phba); +/* Reset SLI4 HBA FCoE function */ lpfc_pci_function_reset (phba);
drivers/scsi/lpfc/lpfc_sli.c +36 -5
120 lines not on this page · raw message
Signature · 1 line
2.38.0
PATCH 4/11 lpfc: Update lpfc_els_flush_cmd to check for SLI_ACTIVE before BSG flag
In reply to Justin TeeDuring firmware errata events, the lpfc_els_flush_cmd routine is responsible for the clean up of outstanding ELS and CT command submissions. Thus, move the LPFC_SLI_ACTIVE flag check into the txcmplq list walk and mark a piocb object for canceling if determined the HBA is not active. Clean up should be regardless of application or driver layer origin.
--- drivers/scsi/lpfc/lpfc_els.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +16 -6
@@ -1236,9 +1236,9 @@ lpfc_cmpl_els_link_down(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,lpfc_printf_log (phba,KERN_INFO ,LOG_ELS ,"6445 ELS completes after LINK_DOWN: " -" Status %x/%x cmd x%x flg x%x\n" , +" Status %x/%x cmd x%x flg x%x iotag x%x\n" , ulp_status, ulp_word4, cmd, - cmdiocb->cmd_flag); + cmdiocb->cmd_flag, cmdiocb->iotag);if (cmdiocb->cmd_flag &LPFC_IO_FABRIC ) { cmdiocb->cmd_flag &= ~LPFC_IO_FABRIC ;
@@ -9642,14 +9642,24 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport) mbx_tmo_err =test_bit (MBX_TMO_ERR , &phba->bit_flags);/* First we need to issue aborts to outstanding cmds on txcmpl */ list_for_each_entry_safe (piocb, tmp_iocb, &pring->txcmplq, list) { -if (piocb->cmd_flag &LPFC_IO_LIBDFC && !mbx_tmo_err) -continue ; +lpfc_printf_vlog (vport,KERN_INFO ,LOG_ELS , +"2243 iotag = 0x%x cmd_flag = 0x%x " +"ulp_command = 0x%x this_vport %x " +"sli_flag = 0x%x\n" , + piocb->iotag, piocb->cmd_flag, +get_job_cmnd (phba, piocb), + (piocb->vport == vport), + phba->sli.sli_flag);if (piocb->vport != vport)continue ; -if (piocb->cmd_flag &LPFC_DRIVER_ABORTED && !mbx_tmo_err) -continue ; +if ((phba->sli.sli_flag &LPFC_SLI_ACTIVE ) && !mbx_tmo_err) { +if (piocb->cmd_flag &LPFC_IO_LIBDFC ) +continue ; +if (piocb->cmd_flag &LPFC_DRIVER_ABORTED ) +continue ; + }/* On the ELS ring we can have ELS_REQUESTs, ELS_RSPs, * or GEN_REQUESTs waiting for a CQE response.
Signature · 1 line
2.38.0
PATCH 5/11 lpfc: Check SLI_ACTIVE flag in FDMI cmpl before submitting follow up FDMI
In reply to Justin TeeThe lpfc_cmpl_ct_disc_fdmi routine has incorrect logic that treats an FDMI completion with error LOCAL_REJECT/SLI_ABORTED as a success status. Under the erroneous assumption of successful completion, the routine proceeds to issue follow up FDMI commands, which may never complete if the HBA is in an errata state as indicated by the errored completion status. Fix by freeing FDMI cmd resources and early return when the LPFC_SLI_ACTIVE flag is not set and a LOCAL_REJECT/SLI_ABORTED or SLI_DOWN status is received.
--- drivers/scsi/lpfc/lpfc_ct.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/scsi/lpfc/lpfc_ct.c +14 -7
@@ -2226,6 +2226,11 @@ lpfc_cmpl_ct_disc_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ulp_status, ulp_word4, latt);if (latt || ulp_status) { +lpfc_printf_vlog (vport,KERN_WARNING ,LOG_DISCOVERY , +"0229 FDMI cmd %04x failed, latt = %d " +"ulp_status: (x%x/x%x), sli_flag x%x\n" , +be16_to_cpu (fdmi_cmd), latt, ulp_status, + ulp_word4, phba->sli.sli_flag);/* Look for a retryable error */ if (ulp_status ==IOSTAT_LOCAL_REJECT ) {
@@ -2234,8 +2239,16 @@ lpfc_cmpl_ct_disc_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,case IOERR_SLI_DOWN :/* Driver aborted this IO. No retry as error * is likely Offline->Online or some adapter -* error. Recovery will try again. +* error. Recovery will try again, but if port +* is not active there's no point to continue +* issuing follow up FDMI commands. */ +if (!(phba->sli.sli_flag &LPFC_SLI_ACTIVE )) { + free_ndlp = cmdiocb->ndlp; +lpfc_ct_free_iocb (phba, cmdiocb); +lpfc_nlp_put (free_ndlp); +return ; + }break ;case IOERR_ABORT_IN_PROGRESS :case IOERR_SEQUENCE_TIMEOUT :
@@ -2256,12 +2269,6 @@ lpfc_cmpl_ct_disc_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,break ; } } - -lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY , -"0229 FDMI cmd %04x latt = %d " -"ulp_status: x%x, rid x%x\n" , -be16_to_cpu (fdmi_cmd), latt, ulp_status, - ulp_word4); } free_ndlp = cmdiocb->ndlp;
Signature · 1 line
2.38.0
PATCH 6/11 lpfc: Add cleanup of nvmels_wq after HBA reset
In reply to Justin TeeAn HBA reset request that is executed when there are outstanding NVME-LS commands can cause delays for the reset process to complete. Fix by introducing a new routine called lpfc_nvmels_flush_cmd that walks the phba->nvmels_wq list and cancels outstanding submitted NVME-LS requests speeding up the HBA reset process.
--- drivers/scsi/lpfc/lpfc_crtn.h | 1 + drivers/scsi/lpfc/lpfc_init.c | 1 + drivers/scsi/lpfc/lpfc_nvme.c | 51 +++++++++++++++++++++++++++++++++-- 3 files changed, 51 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_crtn.h +1 -0
@@ -660,6 +660,7 @@ 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,uint32_t stat,uint32_t param); +void lpfc_nvmels_flush_cmd (struct lpfc_hba *phba);extern int lpfc_enable_nvmet_cnt;extern unsigned long long lpfc_enable_nvmet[];extern int lpfc_no_hba_reset_cnt;
drivers/scsi/lpfc/lpfc_init.c +1 -0
@@ -1943,6 +1943,7 @@ lpfc_sli4_port_sta_fn_reset(struct lpfc_hba *phba, int mbx_action,lpfc_offline_prep (phba, mbx_action);lpfc_sli_flush_io_rings (phba); +lpfc_nvmels_flush_cmd (phba);lpfc_offline (phba);/* release interrupt for possible resource change */ lpfc_sli4_disable_intr (phba);
drivers/scsi/lpfc/lpfc_nvme.c +49 -2
80 lines not on this page · raw message
Signature · 1 line
2.38.0
PATCH 7/11 lpfc: Prevent ndlp reference count underflow in dev_loss_tmo callback
In reply to Justin TeeCurrent dev_loss_tmo handling checks whether there has been a previous call to unregister with SCSI transport. If so, the ndlp kref count is decremented a second time in dev_loss_tmo as the final kref release. However, this can sometimes result in a reference count underflow if there is also a race to unregister with NVME transport as well. Add a check for NVME transport registration before decrementing the final kref. If NVME transport is still registered, then the NVME transport unregistration is designated as the final kref decrement.
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 36 +++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 12 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +24 -12
@@ -161,6 +161,7 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)struct lpfc_hba *phba;struct lpfc_work_evt *evtp;unsigned long iflags; +bool nvme_reg = false; ndlp = ((struct lpfc_rport_data *)rport->dd_data)->pnode;if (!ndlp)
@@ -183,38 +184,49 @@ lpfc_dev_loss_tmo_callbk(struct fc_rport *rport)/* Don't schedule a worker thread event if the vport is going down. */ if (test_bit (FC_UNLOADING , &vport->load_flag) || !test_bit (HBA_SETUP , &phba->hba_flag)) { +spin_lock_irqsave (&ndlp->lock, iflags); ndlp->rport =NULL ; +if (ndlp->fc4_xpt_flags &NVME_XPT_REGD ) + nvme_reg = true; +/* The scsi_transport is done with the rport so lpfc cannot -* call to unregister. Remove the scsi transport reference -* and clean up the SCSI transport node details. +* call to unregister. */ -if (ndlp->fc4_xpt_flags & (NLP_XPT_REGD |SCSI_XPT_REGD )) { +if (ndlp->fc4_xpt_flags &SCSI_XPT_REGD ) { ndlp->fc4_xpt_flags &= ~SCSI_XPT_REGD ; -/* NVME transport-registered rports need the -* NLP_XPT_REGD flag to complete an unregister. +/* If NLP_XPT_REGD was cleared in lpfc_nlp_unreg_node, +* unregister calls were made to the scsi and nvme +* transports and refcnt was already decremented. Clear +* the NLP_XPT_REGD flag only if the NVME Rport is +* confirmed unregistered. */ -if (!(ndlp->fc4_xpt_flags &NVME_XPT_REGD )) +if (!nvme_reg && ndlp->fc4_xpt_flags &NLP_XPT_REGD ) { ndlp->fc4_xpt_flags &= ~NLP_XPT_REGD ; +spin_unlock_irqrestore (&ndlp->lock, iflags); +lpfc_nlp_put (ndlp);/* may free ndlp */ + }else { +spin_unlock_irqrestore (&ndlp->lock, iflags); + } + }else {spin_unlock_irqrestore (&ndlp->lock, iflags); -lpfc_nlp_put (ndlp); -spin_lock_irqsave (&ndlp->lock, iflags); } +spin_lock_irqsave (&ndlp->lock, iflags); +/* Only 1 thread can drop the initial node reference. If * another thread has set NLP_DROPPED, this thread is done. */ -if (!(ndlp->fc4_xpt_flags &NVME_XPT_REGD ) && - !(ndlp->nlp_flag &NLP_DROPPED )) { - ndlp->nlp_flag |=NLP_DROPPED ; +if (nvme_reg || (ndlp->nlp_flag &NLP_DROPPED )) {spin_unlock_irqrestore (&ndlp->lock, iflags); -lpfc_nlp_put (ndlp);return ; } + ndlp->nlp_flag |=NLP_DROPPED ;spin_unlock_irqrestore (&ndlp->lock, iflags); +lpfc_nlp_put (ndlp);return ; }
Signature · 1 line
2.38.0
PATCH 8/11 lpfc: Remove NLP_RELEASE_RPI flag from nodelist structure
In reply to Justin TeeAn RPI is tightly bound to an ndlp structure and is freed only upon release of an ndlp object. As such, there should be no logic that frees an RPI outside of the lpfc_nlp_release routine. In order to reinforce the original design usage of RPIs, this patch removes the NLP_RELEASE_RPI flag and related logic.
--- drivers/scsi/lpfc/lpfc_crtn.h | 2 +- drivers/scsi/lpfc/lpfc_disc.h | 1 - drivers/scsi/lpfc/lpfc_els.c | 32 +++----------------- drivers/scsi/lpfc/lpfc_hbadisc.c | 52 +++++++------------------------- drivers/scsi/lpfc/lpfc_init.c | 36 +++++++--------------- drivers/scsi/lpfc/lpfc_sli.c | 48 +++++++++++------------------ 6 files changed, 44 insertions(+), 127 deletions(-)
drivers/scsi/lpfc/lpfc_crtn.h +1 -1
@@ -571,7 +571,7 @@ int lpfc_issue_reg_vfi(struct lpfc_vport *);int lpfc_issue_unreg_vfi (struct lpfc_vport *);int lpfc_selective_reset (struct lpfc_hba *);int lpfc_sli4_read_config (struct lpfc_hba *); -void lpfc_sli4_node_prep (struct lpfc_hba *); +void lpfc_sli4_node_rpi_restore (struct lpfc_hba *phba);int lpfc_sli4_els_sgl_update (struct lpfc_hba *phba);int lpfc_sli4_nvmet_sgl_update (struct lpfc_hba *phba);int lpfc_io_buf_flush (struct lpfc_hba *phba,struct list_head *sglist);
drivers/scsi/lpfc/lpfc_disc.h +0 -1
@@ -185,7 +185,6 @@ struct lpfc_node_rrq {/* Defines for nlp_flag (uint32) */ #define NLP_IGNR_REG_CMPL 0x00000001/* Rcvd rscn before we cmpl reg login */ #define NLP_REG_LOGIN_SEND 0x00000002/* sent reglogin to adapter */ -#define NLP_RELEASE_RPI 0x00000004/* Release RPI to free pool */ #define NLP_SUPPRESS_RSP 0x00000010/* Remote NPort supports suppress rsp */ #define NLP_PLOGI_SND 0x00000020/* sent PLOGI request for this entry */ #define NLP_PRLI_SND 0x00000040/* sent PRLI request for this entry */
drivers/scsi/lpfc/lpfc_els.c +4 -28
@@ -3063,8 +3063,6 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,*/ if (ndlp->nlp_flag &NLP_TARGET_REMOVE ) {spin_lock_irq (&ndlp->lock); -if (phba->sli_rev ==LPFC_SLI_REV4 ) - ndlp->nlp_flag |=NLP_RELEASE_RPI ; ndlp->nlp_flag &= ~NLP_NPR_2B_DISC ;spin_unlock_irq (&ndlp->lock); lpfc_disc_state_machine(vport, ndlp, cmdiocb,
@@ -5456,24 +5454,14 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, }/* An SLI4 NPIV instance wants to drop the node at this point under -* these conditions and release the RPI. +* these conditions because it doesn't need the login. */ if (phba->sli_rev ==LPFC_SLI_REV4 && vport && vport->port_type ==LPFC_NPIV_PORT && !(ndlp->fc4_xpt_flags &SCSI_XPT_REGD )) { -if (ndlp->nlp_flag &NLP_RELEASE_RPI ) { -if (ndlp->nlp_state !=NLP_STE_PLOGI_ISSUE && - ndlp->nlp_state !=NLP_STE_REG_LOGIN_ISSUE ) { -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); - }else if (ndlp->nlp_state !=NLP_STE_PLOGI_ISSUE && - ndlp->nlp_state !=NLP_STE_REG_LOGIN_ISSUE && - ndlp->nlp_state !=NLP_STE_PRLI_ISSUE ) { +if (ndlp->nlp_state !=NLP_STE_PLOGI_ISSUE && + ndlp->nlp_state !=NLP_STE_REG_LOGIN_ISSUE && + ndlp->nlp_state !=NLP_STE_PRLI_ISSUE ) {/* Drop ndlp if there is no planned or outstanding * issued PRLI. *
@@ -5852,18 +5840,6 @@ lpfc_els_rsp_reject(struct lpfc_vport *vport, uint32_t rejectError,return 1 ; } -/* The NPIV instance is rejecting this unsolicited ELS. Make sure the -* node's assigned RPI gets released provided this node is not already -* registered with the transport. -*/ -if (phba->sli_rev ==LPFC_SLI_REV4 && - vport->port_type ==LPFC_NPIV_PORT && - !(ndlp->fc4_xpt_flags &SCSI_XPT_REGD )) { -spin_lock_irq (&ndlp->lock); - ndlp->nlp_flag |=NLP_RELEASE_RPI ; -spin_unlock_irq (&ndlp->lock); - } - rc =lpfc_sli_issue_iocb (phba,LPFC_ELS_RING , elsiocb,0 );if (rc ==IOCB_ERROR ) {lpfc_els_free_iocb (phba, elsiocb);
drivers/scsi/lpfc/lpfc_hbadisc.c +11 -41
97 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_init.c +11 -25
@@ -3380,7 +3380,7 @@ lpfc_block_mgmt_io(struct lpfc_hba *phba, int mbx_action) }/** -* lpfc_sli4_node_prep - Assign RPIs for active nodes. +* lpfc_sli4_node_rpi_restore - Recover assigned RPIs for active nodes. * @phba: pointer to lpfc hba data structure. * * Allocate RPIs for all active remote nodes. This is needed whenever
@@ -3388,7 +3388,7 @@ lpfc_block_mgmt_io(struct lpfc_hba *phba, int mbx_action)* is to fixup the temporary rpi assignments. **/ void -lpfc_sli4_node_prep (struct lpfc_hba *phba) +lpfc_sli4_node_rpi_restore (struct lpfc_hba *phba) {struct lpfc_nodelist *ndlp, *next_ndlp;struct lpfc_vport **vports;
@@ -3398,10 +3398,10 @@ lpfc_sli4_node_prep(struct lpfc_hba *phba)return ; vports =lpfc_create_vport_work_array (phba); -if (vports ==NULL ) +if (!vports)return ; -for (i =0 ; i <= phba->max_vports && vports[i] !=NULL ; i++) { +for (i =0 ; i <= phba->max_vports && vports[i]; i++) {if (test_bit (FC_UNLOADING , &vports[i]->load_flag))continue ;
@@ -3410,7 +3410,13 @@ lpfc_sli4_node_prep(struct lpfc_hba *phba) nlp_listp) { rpi =lpfc_sli4_alloc_rpi (phba);if (rpi ==LPFC_RPI_ALLOC_ERROR ) { -/* TODO print log? */ +lpfc_printf_vlog (ndlp->vport,KERN_INFO , +LOG_NODE |LOG_DISCOVERY , +"0099 RPI alloc error for " +"ndlp x%px DID:x%06x " +"flg:x%x\n" , + ndlp, ndlp->nlp_DID, + ndlp->nlp_flag);continue ; } ndlp->nlp_rpi = rpi;
@@ -3830,26 +3836,6 @@ lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) ndlp->nlp_flag &= ~(NLP_UNREG_INP |NLP_RPI_REGISTERED );spin_unlock_irq (&ndlp->lock); -if (phba->sli_rev ==LPFC_SLI_REV4 ) -lpfc_sli_rpi_release (vports[i], - ndlp); - }else { -lpfc_unreg_rpi (vports[i], ndlp); - } -/* -* Whenever an SLI4 port goes offline, free the -* RPI. Get a new RPI when the adapter port -* comes back online. -*/ -if (phba->sli_rev ==LPFC_SLI_REV4 ) { -lpfc_printf_vlog (vports[i],KERN_INFO , -LOG_NODE |LOG_DISCOVERY , -"0011 Free RPI x%x on " -"ndlp: x%px did x%x\n" , - ndlp->nlp_rpi, ndlp, - ndlp->nlp_DID); -lpfc_sli4_free_rpi (phba, ndlp->nlp_rpi); - ndlp->nlp_rpi =LPFC_RPI_ALLOC_ERROR ; }if (ndlp->nlp_type &NLP_FABRIC ) {
drivers/scsi/lpfc/lpfc_sli.c +17 -31
105 lines not on this page · raw message
Signature · 1 line
2.38.0
PATCH 9/11 lpfc: Change lpfc_nodelist nlp_flag member into a bitmask
In reply to Justin TeeIn attempt to reduce the amount of unnecessary ndlp->lock acquisitions in the lpfc driver, change nlpa_flag into an unsigned long bitmask and use clear_bit/test_bit bitwise atomic APIs instead of reliance on ndlp->lock for synchronization.
--- drivers/scsi/lpfc/lpfc_bsg.c | 6 +- drivers/scsi/lpfc/lpfc_ct.c | 18 +- drivers/scsi/lpfc/lpfc_debugfs.c | 4 +- drivers/scsi/lpfc/lpfc_disc.h | 59 ++--- drivers/scsi/lpfc/lpfc_els.c | 405 ++++++++++++----------------- drivers/scsi/lpfc/lpfc_hbadisc.c | 225 +++++++--------- drivers/scsi/lpfc/lpfc_init.c | 24 +- drivers/scsi/lpfc/lpfc_nportdisc.c | 329 ++++++++++------------- drivers/scsi/lpfc/lpfc_nvme.c | 9 +- drivers/scsi/lpfc/lpfc_nvmet.c | 2 +- drivers/scsi/lpfc/lpfc_scsi.c | 8 +- drivers/scsi/lpfc/lpfc_sli.c | 42 ++- drivers/scsi/lpfc/lpfc_vport.c | 6 +- 13 files changed, 476 insertions(+), 661 deletions(-)
drivers/scsi/lpfc/lpfc_bsg.c +5 -1
@@ -398,7 +398,11 @@ 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 ) +if (test_bit (NLP_PLOGI_SND , &ndlp->nlp_flag) || +test_bit (NLP_PRLI_SND , &ndlp->nlp_flag) || +test_bit (NLP_ADISC_SND , &ndlp->nlp_flag) || +test_bit (NLP_LOGO_SND , &ndlp->nlp_flag) || +test_bit (NLP_RNID_SND , &ndlp->nlp_flag))return -ENODEV ;/* allocate our bsg tracking structure */
drivers/scsi/lpfc/lpfc_ct.c +7 -11
@@ -735,7 +735,7 @@ lpfc_prep_node_fc4type(struct lpfc_vport *vport, uint32_t Did, uint8_t fc4_type)lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY ,"0238 Process x%06x NameServer Rsp " -"Data: x%x x%x x%x x%lx x%x\n" , Did, +"Data: x%lx x%x x%x x%lx x%x\n" , Did, ndlp->nlp_flag, ndlp->nlp_fc4_type, ndlp->nlp_state, vport->fc_flag, vport->fc_rscn_id_cnt);
@@ -744,7 +744,7 @@ lpfc_prep_node_fc4type(struct lpfc_vport *vport, uint32_t Did, uint8_t fc4_type)* state of ndlp hit devloss, change state to * allow rediscovery. */ -if (ndlp->nlp_flag &NLP_NPR_2B_DISC && +if (test_bit (NLP_NPR_2B_DISC , &ndlp->nlp_flag) && ndlp->nlp_state ==NLP_STE_UNUSED_NODE ) {lpfc_nlp_set_state (vport, ndlp,NLP_STE_NPR_NODE );
@@ -832,12 +832,10 @@ 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 (&ndlp->lock);if (ndlp->nlp_DID == Did) - ndlp->nlp_flag &= ~NLP_NVMET_RECOV ; +clear_bit (NLP_NVMET_RECOV , &ndlp->nlp_flag);else - ndlp->nlp_flag |=NLP_NVMET_RECOV ; -spin_unlock_irq (&ndlp->lock); +set_bit (NLP_NVMET_RECOV , &ndlp->nlp_flag); } } }
@@ -894,13 +892,11 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint8_t fc4_type,*/ if (vport->phba->nvmet_support) {list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) { -if (!(ndlp->nlp_flag &NLP_NVMET_RECOV )) +if (!test_bit (NLP_NVMET_RECOV , &ndlp->nlp_flag))continue ;lpfc_disc_state_machine (vport, ndlp,NULL ,NLP_EVT_DEVICE_RECOVERY ); -spin_lock_irq (&ndlp->lock); - ndlp->nlp_flag &= ~NLP_NVMET_RECOV ; -spin_unlock_irq (&ndlp->lock); +clear_bit (NLP_NVMET_RECOV , &ndlp->nlp_flag); } }
@@ -1440,7 +1436,7 @@ lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,if (ndlp) {lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY ,"0242 Process x%x GFF " -"NameServer Rsp Data: x%x x%lx x%x\n" , +"NameServer Rsp Data: x%lx x%lx x%x\n" , did, ndlp->nlp_flag, vport->fc_flag, vport->fc_rscn_id_cnt); }else {
drivers/scsi/lpfc/lpfc_debugfs.c +2 -2
@@ -870,8 +870,8 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) wwn_to_u64(ndlp->nlp_nodename.u.wwn)); len +=scnprintf (buf+len, size-len,"RPI:x%04x " , ndlp->nlp_rpi); - len +=scnprintf (buf+len, size-len,"flag:x%08x " , - ndlp->nlp_flag); + len +=scnprintf (buf+len, size-len,"flag:x%08lx " , + ndlp->nlp_flag);if (!ndlp->nlp_type) len +=scnprintf (buf+len, size-len,"UNKNOWN_TYPE " );if (ndlp->nlp_type &NLP_FC_NODE )
drivers/scsi/lpfc/lpfc_disc.h +30 -29
73 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_els.c +168 -237
1,159 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_hbadisc.c +94 -131
685 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_init.c +10 -14
@@ -3093,7 +3093,8 @@ lpfc_cleanup(struct lpfc_vport *vport) lpfc_printf_vlog(ndlp->vport, KERN_ERR, LOG_DISCOVERY, "0282 did:x%x ndlp:x%px " - "refcnt:%d xflags x%x nflag x%x\n", + "refcnt:%d xflags x%x " + "nflag x%lx\n", ndlp->nlp_DID, (void *)ndlp, kref_read(&ndlp->kref), ndlp->fc4_xpt_flags,
@@ -3414,7 +3415,7 @@ lpfc_sli4_node_rpi_restore(struct lpfc_hba *phba)LOG_NODE |LOG_DISCOVERY ,"0099 RPI alloc error for " "ndlp x%px DID:x%06x " -"flg:x%x\n" , +"flg:x%lx\n" , ndlp, ndlp->nlp_DID, ndlp->nlp_flag);continue ;
@@ -3423,7 +3424,7 @@ lpfc_sli4_node_rpi_restore(struct lpfc_hba *phba)lpfc_printf_vlog (ndlp->vport,KERN_INFO ,LOG_NODE |LOG_DISCOVERY ,"0009 Assign RPI x%x to ndlp x%px " -"DID:x%06x flg:x%x\n" , +"DID:x%06x flg:x%lx\n" , ndlp->nlp_rpi, ndlp, ndlp->nlp_DID, ndlp->nlp_flag); }
@@ -3827,15 +3828,12 @@ lpfc_offline_prep(struct lpfc_hba *phba, int mbx_action) &vports[i]->fc_nodes, nlp_listp) { -spin_lock_irq (&ndlp->lock); - ndlp->nlp_flag &= ~NLP_NPR_ADISC ; -spin_unlock_irq (&ndlp->lock); - +clear_bit (NLP_NPR_ADISC , &ndlp->nlp_flag);if (offline || hba_pci_err) { -spin_lock_irq (&ndlp->lock); - ndlp->nlp_flag &= ~(NLP_UNREG_INP | -NLP_RPI_REGISTERED ); -spin_unlock_irq (&ndlp->lock); +clear_bit (NLP_UNREG_INP , + &ndlp->nlp_flag); +clear_bit (NLP_RPI_REGISTERED , + &ndlp->nlp_flag); }if (ndlp->nlp_type &NLP_FABRIC ) {
@@ -6912,9 +6910,7 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,*/ mod_timer (&ndlp->nlp_delayfunc, jiffies +msecs_to_jiffies (1000 )); -spin_lock_irq (&ndlp->lock); - ndlp->nlp_flag |=NLP_DELAY_TMO ; -spin_unlock_irq (&ndlp->lock); +set_bit (NLP_DELAY_TMO , &ndlp->nlp_flag); ndlp->nlp_last_elscmd =ELS_CMD_FDISC ; vport->port_state =LPFC_FDISC ; }else {
drivers/scsi/lpfc/lpfc_nportdisc.c +134 -195
841 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_nvme.c +3 -6
@@ -1232,7 +1232,7 @@ lpfc_nvme_prep_io_cmd(struct lpfc_vport *vport,/* Word 5 */ if ((phba->cfg_nvme_enable_fb) && - (pnode->nlp_flag &NLP_FIRSTBURST )) { +test_bit (NLP_FIRSTBURST , &pnode->nlp_flag)) { req_len = lpfc_ncmd->nvmeCmd->payload_length;if (req_len < pnode->nvme_fb_size) wqe->fcp_iwrite.initial_xfer_len =
@@ -2651,14 +2651,11 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)* reference. Check if another thread has set * NLP_DROPPED. */ -spin_lock_irq (&ndlp->lock); -if (!(ndlp->nlp_flag &NLP_DROPPED )) { - ndlp->nlp_flag |=NLP_DROPPED ; -spin_unlock_irq (&ndlp->lock); +if (!test_and_set_bit (NLP_DROPPED , + &ndlp->nlp_flag)) {lpfc_nlp_put (ndlp);return ; } -spin_unlock_irq (&ndlp->lock); } } }
drivers/scsi/lpfc/lpfc_nvmet.c +1 -1
@@ -2854,7 +2854,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba,/* In template ar=1 wqes=0 sup=0 irsp=0 irsplen=0 */ if (rsp->rsplen ==LPFC_NVMET_SUCCESS_LEN ) { -if (ndlp->nlp_flag &NLP_SUPPRESS_RSP ) +if (test_bit (NLP_SUPPRESS_RSP , &ndlp->nlp_flag))bf_set (wqe_sup, &wqe->fcp_tsend.wqe_com,1 ); }else {
drivers/scsi/lpfc/lpfc_scsi.c +4 -4
@@ -4629,7 +4629,7 @@ static int lpfc_scsi_prep_cmnd_buf_s3(struct lpfc_vport *vport, iocb_cmd->ulpCommand =CMD_FCP_IWRITE64_CR ; iocb_cmd->ulpPU =PARM_READ_CHECK ;if (vport->cfg_first_burst_size && - (pnode->nlp_flag &NLP_FIRSTBURST )) { +test_bit (NLP_FIRSTBURST , &pnode->nlp_flag)) {u32 xrdy_len; fcpdl =scsi_bufflen (scsi_cmnd);
@@ -5829,7 +5829,7 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct fc_rport *rport,lpfc_printf_vlog (vport,KERN_INFO ,LOG_FCP ,"0702 Issue %s to TGT %d LUN %llu " -"rpi x%x nlp_flag x%x Data: x%x x%x\n" , +"rpi x%x nlp_flag x%lx Data: x%x x%x\n" ,lpfc_taskmgmt_name (task_mgmt_cmd), tgt_id, lun_id, pnode->nlp_rpi, pnode->nlp_flag, iocbq->sli4_xritag, iocbq->cmd_flag);
@@ -6094,8 +6094,8 @@ 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) { +clear_bit (NLP_NPR_ADISC , &pnode->nlp_flag);spin_lock_irqsave (&pnode->lock, flags); - pnode->nlp_flag &= ~NLP_NPR_ADISC ; pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE ;spin_unlock_irqrestore (&pnode->lock, flags); }
@@ -6124,7 +6124,7 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd) !pnode->logo_waitq) { pnode->logo_waitq = &waitq; pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE ; - pnode->nlp_flag |=NLP_ISSUE_LOGO ; +set_bit (NLP_ISSUE_LOGO , &pnode->nlp_flag); pnode->save_flags |=NLP_WAIT_FOR_LOGO ;spin_unlock_irqrestore (&pnode->lock, flags);lpfc_unreg_rpi (vport, pnode);
drivers/scsi/lpfc/lpfc_sli.c +15 -27
47 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.38.0
Part of the diff is not shown here. View the raw message.
PATCH 10/11 lpfc: Update lpfc version to 14.4.0.6
In reply to Justin TeeUpdate lpfc version to 14.4.0.6
--- 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 "14.4.0.5" +#define LPFC_DRIVER_VERSION "14.4.0.6"#define LPFC_DRIVER_NAME "lpfc"/* Used for SLI 2/3 */
Signature · 1 line
2.38.0
PATCH 11/11 lpfc: Copyright updates for 14.4.0.6 patches
In reply to Justin TeeUpdate copyrights to 2024 for files modified in the 14.4.0.6 patch set.
--- drivers/scsi/lpfc/lpfc_crtn.h | 2 +- drivers/scsi/lpfc/lpfc_disc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
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-2023 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2024 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_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-2022 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2024 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. *
Signature · 1 line
2.38.0
Martin K. Petersen
AppliedJustin,
Quoted 7 lines
Update lpfc to revision 14.4.0.6
This patch set contains bug fixes related to congestion handling, accounting for internal remoteport objects, resource release during HBA unload and reset, and clean up regarding the abuse of a global spinlock.
The patches were cut against Martin's 6.13/scsi-queue tree.
Applied to 6.13/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 9 lines · Justin Tee
Update lpfc to revision 14.4.0.6
This patch set contains bug fixes related to congestion handling, accounting for internal remoteport objects, resource release during HBA unload and reset, and clean up regarding the abuse of a global spinlock.
The patches were cut against Martin's 6.13/scsi-queue tree.
[...]
Applied to 6.13/scsi-queue, thanks!
[01/11] lpfc: Modify cgn warning signal calculation based on EDC response
https://git.kernel.org/mkp/scsi/c/29a64210c767 [02/11] lpfc: Check devloss callbk done flag for potential stale ndlp ptrs https://git.kernel.org/mkp/scsi/c/4c113ac05bb2 [03/11] lpfc: Call lpfc_sli4_queue_unset in restart and rmmod paths https://git.kernel.org/mkp/scsi/c/d35f7672715d [04/11] lpfc: Update lpfc_els_flush_cmd to check for SLI_ACTIVE before BSG flag https://git.kernel.org/mkp/scsi/c/940ddac89612 [05/11] lpfc: Check SLI_ACTIVE flag in FDMI cmpl before submitting follow up FDMI https://git.kernel.org/mkp/scsi/c/98f8d3588097 [06/11] lpfc: Add cleanup of nvmels_wq after HBA reset https://git.kernel.org/mkp/scsi/c/eb038363d8e9 [07/11] lpfc: Prevent ndlp reference count underflow in dev_loss_tmo callback https://git.kernel.org/mkp/scsi/c/4281f44ea8bf [08/11] lpfc: Remove NLP_RELEASE_RPI flag from nodelist structure https://git.kernel.org/mkp/scsi/c/32566a6f1ae5 [09/11] lpfc: Change lpfc_nodelist nlp_flag member into a bitmask https://git.kernel.org/mkp/scsi/c/92b99f1a73b7 [10/11] lpfc: Update lpfc version to 14.4.0.6 https://git.kernel.org/mkp/scsi/c/3f8175c0a859 [11/11] lpfc: Copyright updates for 14.4.0.6 patches https://git.kernel.org/mkp/scsi/c/5c169625d89e
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering