lpfc: Update lpfc to revision 14.2.0.2
Subsystems (2)
cover lpfc: Update lpfc to revision 14.2.0.2
Update lpfc to revision 14.2.0.2
This patch set a bunch of small fixes, several discovery fixes, a few logging enhancements, and a rework patch to get rid of overloaded structure fields.
The patches were cut against Martin's 5.18/scsi-queue tree
James Smart (26):
lpfc: Tweak message log categories for ELS/FDMI/NVME Rescan
lpfc: Move cfg_log_verbose check before calling lpfc_dmp_dbg
lpfc: Fix diagnostic fw logging after a function reset
lpfc: Zero SLI4 fcp_cmnd buffer's fcpCntl0 field
lpfc: Requeue SCSI I/O to upper layer when fw reports link down
lpfc: Fix SCSI I/O completion and abort handler deadlock
lpfc: Clear fabric topology flag before initiating a new FLOGI
lpfc: Fix null pointer dereference after failing to issue FLOGI and
PLOGI
lpfc: Protect memory leak for NPIV ports sending PLOGI_RJT
lpfc: Update fc_prli_sent outstanding only after guaranteed IOCB
submit
lpfc: Transition to NPR state upon LOGO cmpl if link down or aborted
lpfc: Remove unnecessary NULL pointer assignment for ELS_RDF path
lpfc: Move MI module parameter check to handle dynamic disable
lpfc: Correct CRC32 calculation for congestion stats
lpfc: Fix call trace observed during I/O with CMF enabled
lpfc: Revise FDMI reporting of supported port speed for trunk groups
lpfc: Remove false FDMI NVME FC-4 support for NPIV ports
lpfc: Register for Application Services FC-4 type in Fabric topology
lpfc: Introduce FC_RSCN_MEMENTO flag for tracking post RSCN completion
lpfc: Fix field overload in lpfc_iocbq data structure
lpfc: Refactor cleanup of mailbox commands
lpfc: Change FA-PWWN detection methodology
lpfc: Update stat accounting for READ_STATUS mbox command
lpfc: Expand setting ELS_ID field in ELS_REQUEST64_WQE
lpfc: Update lpfc version to 14.2.0.2
lpfc: Copyright updates for 14.2.0.2 patches
drivers/scsi/lpfc/lpfc.h | 6 +- drivers/scsi/lpfc/lpfc_attr.c | 55 ++- drivers/scsi/lpfc/lpfc_bsg.c | 79 ++-- drivers/scsi/lpfc/lpfc_crtn.h | 4 +- drivers/scsi/lpfc/lpfc_ct.c | 252 ++++++----- drivers/scsi/lpfc/lpfc_els.c | 644 ++++++++++++++--------------- drivers/scsi/lpfc/lpfc_hbadisc.c | 143 +++---- drivers/scsi/lpfc/lpfc_hw.h | 75 ++-- drivers/scsi/lpfc/lpfc_hw4.h | 17 +- drivers/scsi/lpfc/lpfc_init.c | 209 +++++----- drivers/scsi/lpfc/lpfc_logmsg.h | 8 +- drivers/scsi/lpfc/lpfc_mbox.c | 203 +++++---- drivers/scsi/lpfc/lpfc_nportdisc.c | 64 ++- drivers/scsi/lpfc/lpfc_nvme.c | 35 +- drivers/scsi/lpfc/lpfc_nvmet.c | 73 ++-- drivers/scsi/lpfc/lpfc_scsi.c | 55 ++- drivers/scsi/lpfc/lpfc_sli.c | 226 +++++----- drivers/scsi/lpfc/lpfc_sli.h | 34 +- drivers/scsi/lpfc/lpfc_sli4.h | 3 + drivers/scsi/lpfc/lpfc_version.h | 2 +- drivers/scsi/lpfc/lpfc_vport.c | 31 +- 21 files changed, 1112 insertions(+), 1106 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/26 lpfc: Tweak message log categories for ELS/FDMI/NVME Rescan
Several log message categories were updated:
- Enable msg 4623 (Xmit of ECD) to display for ELS logging.
- Change msg 0220 (FDMI cmd failed) to display for ELS logging.
- Change msg 6460 (FDMI RPA failure) to be warning not hard error.
- Change msg 6172 (NVME rescan of DID) to be logged under NVME discovery.
--- drivers/scsi/lpfc/lpfc_ct.c | 6 +++--- drivers/scsi/lpfc/lpfc_els.c | 2 +- drivers/scsi/lpfc/lpfc_nvme.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc_ct.c +3 -3
@@ -2236,7 +2236,7 @@ lpfc_cmpl_ct_disc_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, cmd =be16_to_cpu (fdmi_cmd);if (fdmi_rsp ==cpu_to_be16 (SLI_CT_RESPONSE_FS_RJT )) {/* FDMI rsp failed */ -lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY , +lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY |LOG_ELS ,"0220 FDMI cmd failed FS_RJT Data: x%x" , cmd);/* Should we fallback to FDMI-2 / FDMI-1 ? */
@@ -2272,9 +2272,9 @@ lpfc_cmpl_ct_disc_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, phba->link_flag &= ~LS_CT_VEN_RPA ;if (phba->cmf_active_mode ==LPFC_CFG_OFF )return ; -lpfc_printf_log (phba,KERN_ERR , +lpfc_printf_log (phba,KERN_WARNING ,LOG_DISCOVERY |LOG_ELS , -"6460 VEN FDMI RPA failure\n" ); +"6460 VEN FDMI RPA RJT\n" );return ; }if (vport->fdmi_port_mask ==LPFC_FDMI2_PORT_ATTR ) {
drivers/scsi/lpfc/lpfc_els.c +1 -1
@@ -4257,7 +4257,7 @@ lpfc_issue_els_edc(struct lpfc_vport *vport, uint8_t retry) phba->cgn_sig_freq = lpfc_fabric_cgn_frequency; - lpfc_printf_vlog(vport, KERN_INFO, LOG_CGN_MGMT, + lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS | LOG_CGN_MGMT, "4623 Xmit EDC to remote " "NPORT x%x reg_sig x%x reg_fpin:x%x\n", ndlp->nlp_DID, phba->cgn_reg_signal,
drivers/scsi/lpfc/lpfc_nvme.c +2 -2
@@ -2466,12 +2466,12 @@ lpfc_nvme_rescan_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)if (!nrport || !remoteport) goto rescan_exit; -/* Only rescan if we are an NVME target in the MAPPED state */ +/* Rescan an NVME target in MAPPED state with DISCOVERY role set */ if (remoteport->port_role &FC_PORT_ROLE_NVME_DISCOVERY && ndlp->nlp_state ==NLP_STE_MAPPED_NODE ) {nvme_fc_rescan_remoteport (remoteport); -lpfc_printf_vlog (vport,KERN_ERR ,LOG_TRACE_EVENT , +lpfc_printf_vlog (vport,KERN_INFO ,LOG_NVME_DISC ,"6172 NVME rescanned DID x%06x " "port_state x%x\n" , ndlp->nlp_DID, remoteport->port_state);
Signature · 1 line
2.26.2
PATCH 2/26 lpfc: Move cfg_log_verbose check before calling lpfc_dmp_dbg
In reply to James SmartIn an attempt to log message 0126 with LOG_TRACE_EVENT, the following hard lockup call trace hangs the system.
Call Trace: _raw_spin_lock_irqsave+0x32/0x40 lpfc_dmp_dbg.part.32+0x28/0x220 [lpfc] lpfc_cmpl_els_fdisc+0x145/0x460 [lpfc] lpfc_sli_cancel_jobs+0x92/0xd0 [lpfc] lpfc_els_flush_cmd+0x43c/0x670 [lpfc] lpfc_els_flush_all_cmd+0x37/0x60 [lpfc] lpfc_sli4_async_event_proc+0x956/0x1720 [lpfc] lpfc_do_work+0x1485/0x1d70 [lpfc] kthread+0x112/0x130 ret_from_fork+0x1f/0x40 Kernel panic - not syncing: Hard LOCKUP
The same CPU tries to claim the phba->port_list_lock twice.
Move the cfg_log_verbose checks as part of the lpfc_printf_vlog and lpfc_printf_log macros before calling lpfc_dmp_dbg. There is no need to take the phba->port_list_lock within lpfc_dmp_dbg.
--- drivers/scsi/lpfc/lpfc_init.c | 29 +---------------------------- drivers/scsi/lpfc/lpfc_logmsg.h | 6 +++--- 2 files changed, 4 insertions(+), 31 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +1 -28
@@ -15700,34 +15700,7 @@ void lpfc_dmp_dbg(struct lpfc_hba *phba)unsigned int temp_idx;int i;int j =0 ; -unsigned long rem_nsec, iflags; -bool log_verbose = false; -struct lpfc_vport *port_iterator; - -/* Don't dump messages if we explicitly set log_verbose for the -* physical port or any vport. -*/ -if (phba->cfg_log_verbose) -return ; - -spin_lock_irqsave (&phba->port_list_lock, iflags); -list_for_each_entry (port_iterator, &phba->port_list, listentry) { -if (port_iterator->load_flag &FC_UNLOADING ) -continue ; -if (scsi_host_get (lpfc_shost_from_vport (port_iterator))) { -if (port_iterator->cfg_log_verbose) - log_verbose = true; - -scsi_host_put (lpfc_shost_from_vport (port_iterator)); - -if (log_verbose) { -spin_unlock_irqrestore (&phba->port_list_lock, - iflags); -return ; - } - } - } -spin_unlock_irqrestore (&phba->port_list_lock, iflags); +unsigned long rem_nsec;if (atomic_cmpxchg (&phba->dbg_log_dmping,0 ,1 ) !=0 )return ;
drivers/scsi/lpfc/lpfc_logmsg.h +3 -3
@@ -73,7 +73,7 @@ do { \ #define lpfc_printf_vlog(vport, level, mask, fmt, arg...) \ do { \ { if (((mask) & (vport)->cfg_log_verbose) || (level[1] <= '3')) { \ - if ((mask) & LOG_TRACE_EVENT) \ + if ((mask) & LOG_TRACE_EVENT && !(vport)->cfg_log_verbose) \ lpfc_dmp_dbg((vport)->phba); \ dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \ fmt, (vport)->phba->brd_no, vport->vpi, ##arg); \
@@ -89,11 +89,11 @@ do { \ (phba)->pport->cfg_log_verbose : \ (phba)->cfg_log_verbose; \if (((mask) & log_verbose) || (level[1 ] <='3' )) { \ -if ((mask) &LOG_TRACE_EVENT ) \ +if ((mask) &LOG_TRACE_EVENT && !log_verbose) \lpfc_dmp_dbg (phba); \ dev_printk(level, &((phba)->pcidev)->dev, "%d:" \ fmt, phba->brd_no, ##arg); \ - } else if (!(phba)->cfg_log_verbose)\ + } else if (!log_verbose)\ lpfc_dbg_print(phba, "%d:" fmt, phba->brd_no, ##arg); \ } \ } while (0)
Signature · 1 line
2.26.2
PATCH 3/26 lpfc: Fix diagnostic fw logging after a function reset
In reply to James Smartlpfc_sli4_ras_setup routine is only called from lpfc_pci_probe_one_s4 routine, which means diagnostic fw logging initialization only occurs during probing.
Thus, any path involving a reset of the HBA that restarts the state of the SLI port does not reinitialize diagnostic fw logging.
Move lpfc_sli4_ras_setup into lpfc_sli4_hba_setup so that the LOWLEVEL_SET_DIAG_LOG_OPTIONS mailbox command can be sent after a function reset.
--- drivers/scsi/lpfc/lpfc_init.c | 3 --- drivers/scsi/lpfc/lpfc_sli.c | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +0 -3
@@ -14832,9 +14832,6 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)/* Check if there are static vports to be created. */ lpfc_create_static_vport (phba); -/* Enable RAS FW log support */ -lpfc_sli4_ras_setup (phba); -timer_setup (&phba->cpuhp_poll_timer, lpfc_sli4_poll_hbtimer,0 );cpuhp_state_add_instance_nocalls (lpfc_cpuhp_state, &phba->cpuhp);
drivers/scsi/lpfc/lpfc_sli.c +3 -0
@@ -8864,6 +8864,9 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) }mempool_free (mboxq, phba->mbox_mem_pool); +/* Enable RAS FW log support */ +lpfc_sli4_ras_setup (phba); + phba->hba_flag |=HBA_SETUP ;return rc;
Signature · 1 line
2.26.2
PATCH 4/26 lpfc: Zero SLI4 fcp_cmnd buffer's fcpCntl0 field
In reply to James SmartIt's possible that the fcpCntl0 reserved field is allocated non-zero.
For certain target storage arrays this could cause problems expecting reserved fields to be all zero.
SLI3 path already allocates fcp_cmnd buffer with dma_pool_zalloc in lpfc_new_scsi_buf_s3. The fcpCntl0 field itself is never proactively set throughout the SCSI I/O path. Thus, we only change the SLI4 fcp_cmnd buffer allocation to dma_pool_zalloc.
--- drivers/scsi/lpfc/lpfc_sli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_sli.c +1 -1
@@ -22117,7 +22117,7 @@ lpfc_get_cmd_rsp_buf_per_hdwq(struct lpfc_hba *phba,return NULL ; } - tmp->fcp_cmnd =dma_pool_alloc (phba->lpfc_cmd_rsp_buf_pool, + tmp->fcp_cmnd =dma_pool_zalloc (phba->lpfc_cmd_rsp_buf_pool,GFP_ATOMIC , &tmp->fcp_cmd_rsp_dma_handle);
Signature · 1 line
2.26.2
PATCH 5/26 lpfc: Requeue SCSI I/O to upper layer when fw reports link down
In reply to James SmartDuring heavy I/O stress tests with 100+ vports and cable pulls, it may take a while before the vport logs back into the fabric to resume I/O.
Currently, the driver immediately fails the I/O with DID_ERROR.
Change behavior to return DID_REQUEUE, and rely on SCSI layer's max retry of 5 before erroring out the I/O.
--- drivers/scsi/lpfc/lpfc_scsi.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/lpfc/lpfc_scsi.c +1 -0
@@ -4276,6 +4276,7 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn,break ; } if (lpfc_cmd->result == IOERR_INVALID_RPI || + lpfc_cmd->result == IOERR_LINK_DOWN || lpfc_cmd->result == IOERR_NO_RESOURCES || lpfc_cmd->result == IOERR_ABORT_REQUESTED || lpfc_cmd->result == IOERR_RPI_SUSPENDED ||
Signature · 1 line
2.26.2
PATCH 6/26 lpfc: Fix SCSI I/O completion and abort handler deadlock
In reply to James SmartDuring stress I/O tests with 500+ vports, hard LOCKUP call traces are observed.
CPU A:
native_queued_spin_lock_slowpath+0x192
_raw_spin_lock_irqsave+0x32
lpfc_handle_fcp_err+0x4c6
lpfc_fcp_io_cmd_wqe_cmpl+0x964
lpfc_sli4_fp_handle_cqe+0x266
__lpfc_sli4_process_cq+0x105
__lpfc_sli4_hba_process_cq+0x3c
lpfc_cq_poll_hdler+0x16
irq_poll_softirq+0x76
__softirqentry_text_start+0xe4
irq_exit+0xf7
do_IRQ+0x7f
CPU B:
native_queued_spin_lock_slowpath+0x5b
_raw_spin_lock+0x1c
lpfc_abort_handler+0x13e
scmd_eh_abort_handler+0x85
process_one_work+0x1a7
worker_thread+0x30
kthread+0x112
ret_from_fork+0x1f
Diagram of lockup:
CPUA CPUB
---- ----lpfc_cmd->buf_lock
phba->hbalock
lpfc_cmd->buf_lockphba->hbalock
Fix by reordering the taking of the lpfc_cmd->buf_lock and phba->hbalock in lpfc_abort_handler routine so that it tries to take the lpfc_cmd->buf_lock first before phba->hbalock.
--- drivers/scsi/lpfc/lpfc_scsi.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-)
drivers/scsi/lpfc/lpfc_scsi.c +15 -18
@@ -5865,25 +5865,25 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)if (!lpfc_cmd)return ret; -spin_lock_irqsave (&phba->hbalock, flags); +/* Guard against IO completion being called at same time */ +spin_lock_irqsave (&lpfc_cmd->buf_lock, flags); + +spin_lock (&phba->hbalock);/* driver queued commands are in process of being flushed */ if (phba->hba_flag &HBA_IOQ_FLUSH ) {lpfc_printf_vlog (vport,KERN_WARNING ,LOG_FCP ,"3168 SCSI Layer abort requested I/O has been " "flushed by LLD.\n" ); ret =FAILED ; - goto out_unlock; + goto out_unlock_hba; } -/* Guard against IO completion being called at same time */ -spin_lock (&lpfc_cmd->buf_lock); -if (!lpfc_cmd->pCmd) {lpfc_printf_vlog (vport,KERN_WARNING ,LOG_FCP ,"2873 SCSI Layer I/O Abort Request IO CMPL Status " "x%x ID %d LUN %llu\n" ,SUCCESS , cmnd->device->id, cmnd->device->lun); - goto out_unlock_buf; + goto out_unlock_hba; } iocb = &lpfc_cmd->cur_iocbq;
@@ -5891,7 +5891,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) pring_s4 = phba->sli4_hba.hdwq[iocb->hba_wqidx].io_wq->pring;if (!pring_s4) { ret =FAILED ; - goto out_unlock_buf; + goto out_unlock_hba; }spin_lock (&pring_s4->ring_lock); }
@@ -5924,8 +5924,8 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) "3389 SCSI Layer I/O Abort Request is pending\n");if (phba->sli_rev ==LPFC_SLI_REV4 )spin_unlock (&pring_s4->ring_lock); -spin_unlock (&lpfc_cmd->buf_lock); -spin_unlock_irqrestore (&phba->hbalock, flags); +spin_unlock (&phba->hbalock); +spin_unlock_irqrestore (&lpfc_cmd->buf_lock, flags); goto wait_for_cmpl; }
@@ -5946,15 +5946,13 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)if (ret_val !=IOCB_SUCCESS ) {/* Indicate the IO is not being aborted by the driver. */ lpfc_cmd->waitq =NULL ; -spin_unlock (&lpfc_cmd->buf_lock); -spin_unlock_irqrestore (&phba->hbalock, flags); ret =FAILED ; - goto out; + goto out_unlock_hba; }/* no longer need the lock after this point */ -spin_unlock (&lpfc_cmd->buf_lock); -spin_unlock_irqrestore (&phba->hbalock, flags); +spin_unlock (&phba->hbalock); +spin_unlock_irqrestore (&lpfc_cmd->buf_lock, flags);if (phba->cfg_poll &DISABLE_FCP_RING_INT ) lpfc_sli_handle_fast_ring_event(phba,
@@ -5989,10 +5987,9 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) out_unlock_ring:if (phba->sli_rev ==LPFC_SLI_REV4 )spin_unlock (&pring_s4->ring_lock); -out_unlock_buf: -spin_unlock (&lpfc_cmd->buf_lock); -out_unlock: -spin_unlock_irqrestore (&phba->hbalock, flags); +out_unlock_hba: +spin_unlock (&phba->hbalock); +spin_unlock_irqrestore (&lpfc_cmd->buf_lock, flags); out:lpfc_printf_vlog (vport,KERN_WARNING ,LOG_FCP , "0749 SCSI Layer I/O Abort Request Status x%x ID %d "
Signature · 1 line
2.26.2
PATCH 7/26 lpfc: Clear fabric topology flag before initiating a new FLOGI
In reply to James SmartPrevious topologies may no longer be in fabric mode, so clear FC_FABRIC in fc_flag for every new FLOGI.
--- drivers/scsi/lpfc/lpfc_els.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/lpfc/lpfc_els.c +2 -0
@@ -1530,6 +1530,8 @@ lpfc_initial_flogi(struct lpfc_vport *vport)lpfc_enqueue_node (vport, ndlp); } +/* Reset the Fabric flag, topology change may have happened */ + vport->fc_flag &= ~FC_FABRIC ;if (lpfc_issue_els_flogi (vport, ndlp,0 )) {/* This decrement of reference count to node shall kick off * the release of the node.
Signature · 1 line
2.26.2
PATCH 8/26 lpfc: Fix null pointer dereference after failing to issue FLOGI and PLOGI
In reply to James SmartIf lpfc_issue_els_flogi() fails and returns non-zero status, the node reference count is decremented to trigger the release of the nodelist structure. However, if there is a prior registration or dev-loss-evt work pending, the node may be released prematurely. When dev-loss-evt completes, the released node is referenced causing a use-after-free null pointer dereference.
Similarly, when processing non-zero ELS PLOGI completion status in lpfc_cmpl_els_plogi(), the ndlp flags are checked for a transport registration before triggering node removal. If dev-loss-evt work is pending, the node may be released prematurely and a subsequent call to lpfc_dev_loss_tmo_handler() results in a use after free ndlp dereference.
Add test for pending dev-loss before decrementing the node reference count for FLOGI, PLOGI, PRLI, and ADISC handling.
--- drivers/scsi/lpfc/lpfc_els.c | 51 +++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 16 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +35 -16
@@ -1533,10 +1533,13 @@ lpfc_initial_flogi(struct lpfc_vport *vport)/* Reset the Fabric flag, topology change may have happened */ vport->fc_flag &= ~FC_FABRIC ;if (lpfc_issue_els_flogi (vport, ndlp,0 )) { -/* This decrement of reference count to node shall kick off -* the release of the node. +/* A node reference should be retained while registered with a +* transport or dev-loss-evt work is pending. +* Otherwise, decrement node reference to trigger release. */ -lpfc_nlp_put (ndlp); +if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD |NVME_XPT_REGD )) && + !(ndlp->nlp_flag &NLP_IN_DEV_LOSS )) +lpfc_nlp_put (ndlp);return 0 ; }return 1 ;
@@ -1579,10 +1582,13 @@ lpfc_initial_fdisc(struct lpfc_vport *vport) }if (lpfc_issue_els_fdisc (vport, ndlp,0 )) { -/* decrement node reference count to trigger the release of -* the node. +/* A node reference should be retained while registered with a +* transport or dev-loss-evt work is pending. +* Otherwise, decrement node reference to trigger release. */ -lpfc_nlp_put (ndlp); +if (!(ndlp->fc4_xpt_flags & (SCSI_XPT_REGD |NVME_XPT_REGD )) && + !(ndlp->nlp_flag &NLP_IN_DEV_LOSS )) +lpfc_nlp_put (ndlp);return 0 ; }return 1 ;
@@ -1984,6 +1990,7 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,int disc;struct serv_parm *sp =NULL ;u32 ulp_status, ulp_word4, did, iotag; +bool release_node = false;/* we pass cmdiocb to state machine which needs rspiocb as well */ cmdiocb->context_un.rsp_iocb = rspiocb;
@@ -2072,19 +2079,21 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,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); ndlp->nlp_flag &= ~NLP_NPR_2B_DISC ; -spin_unlock_irq (&ndlp->lock); +if (!(ndlp->nlp_flag &NLP_IN_DEV_LOSS )) + release_node = true; + } +spin_unlock_irq (&ndlp->lock); + +if (release_node)lpfc_disc_state_machine (vport, ndlp, cmdiocb,NLP_EVT_DEVICE_RM ); - } }else {/* Good status, call state machine */ prsp = list_entry(((struct lpfc_dmabuf *)
@@ -2295,6 +2304,7 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,u32 loglevel;u32 ulp_status;u32 ulp_word4; +bool release_node = false;/* we pass cmdiocb to state machine which needs rspiocb as well */ cmdiocb->context_un.rsp_iocb = rspiocb;
@@ -2371,14 +2381,18 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,* it is no longer an active node. Otherwise devloss * handles the final cleanup. */ +spin_lock_irq (&ndlp->lock);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); +if (!(ndlp->nlp_flag &NLP_IN_DEV_LOSS )) + release_node = true; + } +spin_unlock_irq (&ndlp->lock); + +if (release_node)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
@@ -2750,6 +2764,7 @@ lpfc_cmpl_els_adisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,struct lpfc_nodelist *ndlp;int disc;u32 ulp_status, ulp_word4, tmo; +bool release_node = false;/* we pass cmdiocb to state machine which needs rspiocb as well */ cmdiocb->context_un.rsp_iocb = rspiocb;
@@ -2816,13 +2831,17 @@ lpfc_cmpl_els_adisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,* transport, it is no longer an active node. Otherwise * devloss handles the final cleanup. */ +spin_lock_irq (&ndlp->lock);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); +if (!(ndlp->nlp_flag &NLP_IN_DEV_LOSS )) + release_node = true; + } +spin_unlock_irq (&ndlp->lock); + +if (release_node)lpfc_disc_state_machine (vport, ndlp, cmdiocb,NLP_EVT_DEVICE_RM ); - } }else /* Good status, call state machine */ lpfc_disc_state_machine(vport, ndlp, cmdiocb,
Signature · 1 line
2.26.2
PATCH 9/26 lpfc: Protect memory leak for NPIV ports sending PLOGI_RJT
In reply to James SmartThere is a potential memory leak in lpfc_ignore_els_cmpl and lpfc_els_rsp_reject that was allocated from NPIV PLOGI_RJT (lpfc_rcv_plogi's login_mbox).
Check if cmdiocb->context_un.mbox was allocated in lpfc_ignore_els_cmpl, and then free it back to phba->mbox_mem_pool along with mbox->ctx_buf for service parameters.
For lpfc_els_rsp_reject failure, free both the ctx_buf for service parameters and the login_mbox.
--- drivers/scsi/lpfc/lpfc_nportdisc.c | 10 ++++++++-- drivers/scsi/lpfc/lpfc_sli.c | 17 +++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_nportdisc.c +8 -2
@@ -614,9 +614,15 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, stat.un.b.lsRjtRsnCode =LSRJT_INVALID_CMD ; stat.un.b.lsRjtRsnCodeExp =LSEXP_NOTHING_MORE ; rc =lpfc_els_rsp_reject (vport, stat.un.lsRjtError, cmdiocb, - ndlp, login_mbox); -if (rc) + ndlp, login_mbox); +if (rc) { + mp = (struct lpfc_dmabuf *)login_mbox->ctx_buf; +if (mp) { +lpfc_mbuf_free (phba, mp->virt, mp->phys); +kfree (mp); + }mempool_free (login_mbox, phba->mbox_mem_pool); + }return 1 ; }
drivers/scsi/lpfc/lpfc_sli.c +17 -0
@@ -12069,6 +12069,8 @@ lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, {struct lpfc_nodelist *ndlp =NULL ;IOCB_t *irsp; +LPFC_MBOXQ_t *mbox; +struct lpfc_dmabuf *mp;u32 ulp_command, ulp_status, ulp_word4, iotag; ulp_command =get_job_cmnd (phba, cmdiocb);
@@ -12080,6 +12082,21 @@ lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, }else { irsp = &rspiocb->iocb; iotag = irsp->ulpIoTag; + +/* It is possible a PLOGI_RJT for NPIV ports to get aborted. +* The MBX_REG_LOGIN64 mbox command is freed back to the +* mbox_mem_pool here. +*/ +if (cmdiocb->context_un.mbox) { + mbox = cmdiocb->context_un.mbox; + mp = (struct lpfc_dmabuf *)mbox->ctx_buf; +if (mp) { +lpfc_mbuf_free (phba, mp->virt, mp->phys); +kfree (mp); + } +mempool_free (mbox, phba->mbox_mem_pool); + cmdiocb->context_un.mbox =NULL ; + } }/* ELS cmd tag <ulpIoTag> completes */
Signature · 1 line
2.26.2
PATCH 10/26 lpfc: Update fc_prli_sent outstanding only after guaranteed IOCB submit
In reply to James SmartIf lpfc_sli_issue_iocb fails, then the fc_prli_sent is never decremented.
Move the fc_prli_sent++ to after a guaranteed IOCB submit.
--- drivers/scsi/lpfc/lpfc_els.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +11 -18
@@ -2570,16 +2570,6 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, phba->fc_stat.elsXmitPRLI++; elsiocb->cmd_cmpl = lpfc_cmpl_els_prli; -spin_lock_irq (&ndlp->lock); - ndlp->nlp_flag |=NLP_PRLI_SND ; - -/* The vport counters are used for lpfc_scan_finished, but -* the ndlp is used to track outstanding PRLIs for different -* FC4 types. -*/ - vport->fc_prli_sent++; - ndlp->fc4_prli_sent++; -spin_unlock_irq (&ndlp->lock); lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, "Issue PRLI: did:x%x refcnt %d",
@@ -2587,16 +2577,25 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, elsiocb->context1 =lpfc_nlp_get (ndlp);if (!elsiocb->context1) {lpfc_els_free_iocb (phba, elsiocb); - goto err; +return 1 ; } rc =lpfc_sli_issue_iocb (phba,LPFC_ELS_RING , elsiocb,0 );if (rc ==IOCB_ERROR ) {lpfc_els_free_iocb (phba, elsiocb);lpfc_nlp_put (ndlp); - goto err; +return 1 ; } +/* The vport counters are used for lpfc_scan_finished, but +* the ndlp is used to track outstanding PRLIs for different +* FC4 types. +*/ +spin_lock_irq (&ndlp->lock); + ndlp->nlp_flag |=NLP_PRLI_SND ; + vport->fc_prli_sent++; + ndlp->fc4_prli_sent++; +spin_unlock_irq (&ndlp->lock);/* The driver supports 2 FC4 types. Make sure * a PRLI is issued for all types before exiting.
@@ -2606,12 +2605,6 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, goto send_next_prli; else return 0; - -err: -spin_lock_irq (&ndlp->lock); - ndlp->nlp_flag &= ~NLP_PRLI_SND ; -spin_unlock_irq (&ndlp->lock); -return 1 ; }/**
Signature · 1 line
2.26.2
PATCH 11/26 lpfc: Transition to NPR state upon LOGO cmpl if link down or aborted
In reply to James SmartIn P2P topology, a target controller reboot sometimes results in not reestablishing a login because the ndlp is stuck in LOGO state.
Fix by transitioning to NPR state if we get link down before LOGO completes.
--- drivers/scsi/lpfc/lpfc_els.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/scsi/lpfc/lpfc_els.c +3 -0
@@ -3006,7 +3006,10 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ndlp->nlp_DID, ulp_status, ulp_word4); +/* Call NLP_EVT_DEVICE_RM if link is down or LOGO is aborted */ if (lpfc_error_lost_link (ulp_status, ulp_word4)) { +lpfc_disc_state_machine (vport, ndlp, cmdiocb, +NLP_EVT_DEVICE_RM ); skip_recovery =1 ; goto out; }
Signature · 1 line
2.26.2
PATCH 12/26 lpfc: Remove unnecessary NULL pointer assignment for ELS_RDF path
In reply to James SmartThe command IOCB ndlp pointer is overwritten in lpfc_issue_els_rdf, and the original ndlp pointer is stored ahead of time.
This null ptr assignment can be safely removed.
--- drivers/scsi/lpfc/lpfc_els.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/lpfc/lpfc_els.c +0 -1
@@ -3387,7 +3387,6 @@ lpfc_cmpl_els_disc_cmd(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,lpfc_issue_els_edc (vport, cmdiocb->retry);break ;case ELS_CMD_RDF : - cmdiocb->context1 =NULL ;/* save ndlp refcnt */ lpfc_issue_els_rdf (vport, cmdiocb->retry);break ; }
Signature · 1 line
2.26.2
PATCH 13/26 lpfc: Move MI module parameter check to handle dynamic disable
In reply to James Smartlpfc_refresh_params can be called for an async event handler.
This could potentially override the value initialized by lpfc_cmf_setup
Move module parameter check to lpfc_refresh_params.
--- drivers/scsi/lpfc/lpfc_init.c | 8 +++++++- drivers/scsi/lpfc/lpfc_sli.c | 4 ---- 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +7 -1
@@ -686,8 +686,14 @@ lpfc_sli4_refresh_params(struct lpfc_hba *phba)return rc; } mbx_sli4_parameters = &mqe->un.get_sli4_parameters.sli4_parameters; - phba->sli4_hba.pc_sli4_params.mi_ver = + +/* Are we forcing MI off via module parameter? */ +if (phba->cfg_enable_mi) + phba->sli4_hba.pc_sli4_params.mi_ver =bf_get (cfg_mi_ver, mbx_sli4_parameters); +else + phba->sli4_hba.pc_sli4_params.mi_ver =0 ; + phba->sli4_hba.pc_sli4_params.cmf =bf_get (cfg_cmf, mbx_sli4_parameters); phba->sli4_hba.pc_sli4_params.pls =
drivers/scsi/lpfc/lpfc_sli.c +0 -4
@@ -7994,10 +7994,6 @@ lpfc_cmf_setup(struct lpfc_hba *phba) sli4_params = &phba->sli4_hba.pc_sli4_params; -/* Are we forcing MI off via module parameter? */ -if (!phba->cfg_enable_mi) - sli4_params->mi_ver =0 ; -/* Always try to enable MI feature if we can */ if (sli4_params->mi_ver) {lpfc_set_features (phba, mboxq,LPFC_SET_ENABLE_MI );
Signature · 1 line
2.26.2
PATCH 14/26 lpfc: Correct CRC32 calculation for congestion stats
In reply to James Smartlpfc_cgn_calc_crc32 is returning 32 bits, and lpfc_cgn_update_stat was using u16 to store the crc32 value. Correct by redeclaring the local variable to u32.
--- drivers/scsi/lpfc/lpfc_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_init.c +1 -1
@@ -5539,7 +5539,7 @@ lpfc_cgn_update_stat(struct lpfc_hba *phba, uint32_t dtag)struct tm broken;struct timespec64 cur_time;u32 cnt; -u16 value; +u32 value;/* Make sure we have a congestion info buffer */ if (!phba->cgn_i)
Signature · 1 line
2.26.2
PATCH 15/26 lpfc: Fix call trace observed during I/O with CMF enabled
In reply to James SmartThe following was seen with CMF enabled:
BUG: using smp_processor_id() in preemptible
code: systemd-udevd/31711
kernel: caller is lpfc_update_cmf_cmd+0x214/0x420 [lpfc]
kernel: CPU: 12 PID: 31711 Comm: systemd-udevd
kernel: Call Trace:
kernel: <TASK>
kernel: dump_stack_lvl+0x44/0x57
kernel: check_preemption_disabled+0xbf/0xe0
kernel: lpfc_update_cmf_cmd+0x214/0x420 [lpfc]
kernel: lpfc_nvme_fcp_io_submit+0x23b4/0x4df0 [lpfc]
this_cpu_ptr() calls smp_processor_id() in a preemptible context.
Fix by using per_cpu_ptr() with raw_smp_processor_id() instead.
--- drivers/scsi/lpfc/lpfc_scsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_scsi.c +2 -2
@@ -3835,7 +3835,7 @@ lpfc_update_cmf_cmpl(struct lpfc_hba *phba,else time =div_u64 (time +500 ,1000 );/* round it */ - cgs =this_cpu_ptr (phba->cmf_stat); + cgs =per_cpu_ptr (phba->cmf_stat,raw_smp_processor_id ());atomic64_add (size, &cgs->rcv_bytes);atomic64_add (time, &cgs->rx_latency);atomic_inc (&cgs->rx_io_cnt);
@@ -3879,7 +3879,7 @@ lpfc_update_cmf_cmd(struct lpfc_hba *phba, uint32_t size)atomic_set (&phba->rx_max_read_cnt, size); } - cgs =this_cpu_ptr (phba->cmf_stat); + cgs =per_cpu_ptr (phba->cmf_stat,raw_smp_processor_id ());atomic64_add (size, &cgs->total_bytes);return 0 ; }
Signature · 1 line
2.26.2
PATCH 16/26 lpfc: Revise FDMI reporting of supported port speed for trunk groups
In reply to James SmartTrunk port FDMI supported port speed shows single port supported speed rather than the trunked port speed.
Modify supported port speed logic calculation during registration.
--- drivers/scsi/lpfc/lpfc_ct.c | 68 ++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 20 deletions(-)
drivers/scsi/lpfc/lpfc_ct.c +48 -20
@@ -2830,31 +2830,59 @@ lpfc_fdmi_port_attr_support_speed(struct lpfc_vport *vport,struct lpfc_hba *phba = vport->phba;struct lpfc_fdmi_attr_entry *ae;uint32_t size; +u32 tcfg; +u8 i, cnt; ae = &ad->AttrValue; ae->un.AttrInt =0 ;if (!(phba->hba_flag &HBA_FCOE_MODE )) { -if (phba->lmt & LMT_256Gb) - ae->un.AttrInt |=HBA_PORTSPEED_256GFC ; -if (phba->lmt & LMT_128Gb) - ae->un.AttrInt |=HBA_PORTSPEED_128GFC ; -if (phba->lmt & LMT_64Gb) - ae->un.AttrInt |=HBA_PORTSPEED_64GFC ; -if (phba->lmt & LMT_32Gb) - ae->un.AttrInt |=HBA_PORTSPEED_32GFC ; -if (phba->lmt & LMT_16Gb) - ae->un.AttrInt |=HBA_PORTSPEED_16GFC ; -if (phba->lmt & LMT_10Gb) - ae->un.AttrInt |=HBA_PORTSPEED_10GFC ; -if (phba->lmt & LMT_8Gb) - ae->un.AttrInt |=HBA_PORTSPEED_8GFC ; -if (phba->lmt & LMT_4Gb) - ae->un.AttrInt |=HBA_PORTSPEED_4GFC ; -if (phba->lmt & LMT_2Gb) - ae->un.AttrInt |=HBA_PORTSPEED_2GFC ; -if (phba->lmt & LMT_1Gb) - ae->un.AttrInt |=HBA_PORTSPEED_1GFC ; + cnt =0 ; +if (phba->sli_rev ==LPFC_SLI_REV4 ) { + tcfg = phba->sli4_hba.conf_trunk; +for (i =0 ; i <4 ; i++, tcfg >>=1 ) +if (tcfg &1 ) + cnt++; + } + +if (cnt >2 ) {/* 4 lane trunk group */ +if (phba->lmt & LMT_64Gb) + ae->un.AttrInt |=HBA_PORTSPEED_256GFC ; +if (phba->lmt & LMT_32Gb) + ae->un.AttrInt |=HBA_PORTSPEED_128GFC ; +if (phba->lmt & LMT_16Gb) + ae->un.AttrInt |=HBA_PORTSPEED_64GFC ; + }else if (cnt) {/* 2 lane trunk group */ +if (phba->lmt & LMT_128Gb) + ae->un.AttrInt |=HBA_PORTSPEED_256GFC ; +if (phba->lmt & LMT_64Gb) + ae->un.AttrInt |=HBA_PORTSPEED_128GFC ; +if (phba->lmt & LMT_32Gb) + ae->un.AttrInt |=HBA_PORTSPEED_64GFC ; +if (phba->lmt & LMT_16Gb) + ae->un.AttrInt |=HBA_PORTSPEED_32GFC ; + }else { +if (phba->lmt & LMT_256Gb) + ae->un.AttrInt |=HBA_PORTSPEED_256GFC ; +if (phba->lmt & LMT_128Gb) + ae->un.AttrInt |=HBA_PORTSPEED_128GFC ; +if (phba->lmt & LMT_64Gb) + ae->un.AttrInt |=HBA_PORTSPEED_64GFC ; +if (phba->lmt & LMT_32Gb) + ae->un.AttrInt |=HBA_PORTSPEED_32GFC ; +if (phba->lmt & LMT_16Gb) + ae->un.AttrInt |=HBA_PORTSPEED_16GFC ; +if (phba->lmt & LMT_10Gb) + ae->un.AttrInt |=HBA_PORTSPEED_10GFC ; +if (phba->lmt & LMT_8Gb) + ae->un.AttrInt |=HBA_PORTSPEED_8GFC ; +if (phba->lmt & LMT_4Gb) + ae->un.AttrInt |=HBA_PORTSPEED_4GFC ; +if (phba->lmt & LMT_2Gb) + ae->un.AttrInt |=HBA_PORTSPEED_2GFC ; +if (phba->lmt & LMT_1Gb) + ae->un.AttrInt |=HBA_PORTSPEED_1GFC ; + } }else {/* FCoE links support only one speed */ switch (phba->fc_linkspeed) {
Signature · 1 line
2.26.2
PATCH 17/26 lpfc: Remove false FDMI NVME FC-4 support for NPIV ports
In reply to James SmartFDMI FC-4 Active Type for vports mistakenly shows NVME support.
Fix by adding a check to only set the NVME support bit for the physical port.
--- drivers/scsi/lpfc/lpfc_ct.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_ct.c +3 -1
@@ -3153,6 +3153,7 @@ static int lpfc_fdmi_port_attr_active_fc4type(struct lpfc_vport *vport, struct lpfc_fdmi_attr_def *ad) { + struct lpfc_hba *phba = vport->phba;struct lpfc_fdmi_attr_entry *ae;uint32_t size;
@@ -3163,7 +3164,8 @@ lpfc_fdmi_port_attr_active_fc4type(struct lpfc_vport *vport, ae->un.AttrTypes[7 ] =0x01 ;/* Type 0x20 - CT */ /* Check to see if NVME is configured or not */ -if (vport->phba->cfg_enable_fc4_type &LPFC_ENABLE_NVME ) +if (vport == phba->pport && + phba->cfg_enable_fc4_type &LPFC_ENABLE_NVME ) ae->un.AttrTypes[6 ] =0x1 ;/* Type 0x28 - NVME */ size =FOURBYTES +32 ;
Signature · 1 line
2.26.2
PATCH 18/26 lpfc: Register for Application Services FC-4 type in Fabric topology
In reply to James SmartAdd new FC-4 type 0x60 Application Services for fabric registration when VMID is enabled.
Modified rft struture to indicate __be format. Removed redundant ipReg variable as it was not used.
--- drivers/scsi/lpfc/lpfc_ct.c | 26 ++++++++++++++------------ drivers/scsi/lpfc/lpfc_hw.h | 36 ++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 30 deletions(-)
drivers/scsi/lpfc/lpfc_ct.c +14 -12
@@ -2018,28 +2018,30 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode, vport->ct_flags &= ~FC_CT_RFT_ID ; CtReq->CommandResponse.bits.CmdRsp =cpu_to_be16 (SLI_CTNS_RFT_ID ); - CtReq->un.rft.PortId =cpu_to_be32 (vport->fc_myDID); + CtReq->un.rft.port_id =cpu_to_be32 (vport->fc_myDID); + +/* Register Application Services type if vmid enabled. */ +if (phba->cfg_vmid_app_header) + CtReq->un.rft.app_serv_reg = +cpu_to_be32 (RFT_APP_SERV_REG );/* Register FC4 FCP type if enabled. */ if (vport->cfg_enable_fc4_type ==LPFC_ENABLE_BOTH || vport->cfg_enable_fc4_type ==LPFC_ENABLE_FCP ) - CtReq->un.rft.fcpReg =1 ; + CtReq->un.rft.fcp_reg =cpu_to_be32 (RFT_FCP_REG ); -/* Register NVME type if enabled. Defined LE and swapped. -* rsvd[0] is used as word1 because of the hard-coded -* word0 usage in the ct_request data structure. -*/ +/* Register NVME type if enabled. */ if (vport->cfg_enable_fc4_type ==LPFC_ENABLE_BOTH || vport->cfg_enable_fc4_type ==LPFC_ENABLE_NVME ) - CtReq->un.rft.rsvd[0 ] = -cpu_to_be32 (LPFC_FC4_TYPE_BITMASK ); + CtReq->un.rft.nvme_reg =cpu_to_be32 (RFT_NVME_REG ); ptr = (uint32_t *)CtReq;lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY , -"6433 Issue RFT (%s %s): %08x %08x %08x %08x " -"%08x %08x %08x %08x\n" , - CtReq->un.rft.fcpReg ?"FCP" :" " , - CtReq->un.rft.rsvd[0 ] ?"NVME" :" " , +"6433 Issue RFT (%s %s %s): %08x %08x %08x " +"%08x %08x %08x %08x %08x\n" , + CtReq->un.rft.fcp_reg ?"FCP" :" " , + CtReq->un.rft.nvme_reg ?"NVME" :" " , + CtReq->un.rft.app_serv_reg ?"APPS" :" " , *ptr, *(ptr +1 ), *(ptr +2 ), *(ptr +3 ), *(ptr +4 ), *(ptr +5 ), *(ptr +6 ), *(ptr +7 ));
drivers/scsi/lpfc/lpfc_hw.h +18 -18
@@ -97,6 +97,18 @@ union CtCommandResponse {#define FC4_FEATURE_INIT 0x2#define FC4_FEATURE_NVME_DISC 0x4 +enum rft_word0 { +RFT_FCP_REG = (0x1 <<8 ), +}; + +enum rft_word1 { +RFT_NVME_REG = (0x1 <<8 ), +}; + +enum rft_word3 { +RFT_APP_SERV_REG = (0x1 <<0 ), +}; +struct lpfc_sli_ct_request {/* Structure is in Big Endian format */ union CtRevisionId RevisionId;
@@ -131,25 +143,13 @@ struct lpfc_sli_ct_request {uint8_t Fc4Type; } gid_ff;struct rft { -uint32_t PortId;/* For RFT_ID requests */ - -#ifdef __BIG_ENDIAN_BITFIELD -uint32_t rsvd0:16 ; -uint32_t rsvd1:7 ; -uint32_t fcpReg:1 ;/* Type 8 */ -uint32_t rsvd2:2 ; -uint32_t ipReg:1 ;/* Type 5 */ -uint32_t rsvd3:5 ; -#else /* __LITTLE_ENDIAN_BITFIELD */ -uint32_t rsvd0:16 ; -uint32_t fcpReg:1 ;/* Type 8 */ -uint32_t rsvd1:7 ; -uint32_t rsvd3:5 ; -uint32_t ipReg:1 ;/* Type 5 */ -uint32_t rsvd2:2 ; -#endif +__be32 port_id;/* For RFT_ID requests */ -uint32_t rsvd[7 ]; +__be32 fcp_reg;/* rsvd 31:9, fcp_reg 8, rsvd 7:0 */ +__be32 nvme_reg;/* rsvd 31:9, nvme_reg 8, rsvd 7:0 */ +__be32 word2; +__be32 app_serv_reg;/* rsvd 31:1, app_serv_reg 0 */ +__be32 word[4 ]; } rft;struct rnn {uint32_t PortId;/* For RNN_ID requests */
Signature · 1 line
2.26.2
PATCH 19/26 lpfc: Introduce FC_RSCN_MEMENTO flag for tracking post RSCN completion
In reply to James SmartDuring an NVME target reboot, the target may initialize itself as FCP only during the first RSCN and shortly after trigger a second RSCN claiming NVME support. The timing of these RSCNs occur before FCP-PRLI for the first RSCN completes leading discovery issues over NVME.
Change RSCN and NVME-PRLI send logic based on a new FC_RSCN_MEMENTO flag that signals when lpfc_end_rscn is completed and serves as a memento that discovery was started from RSCN.
--- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_els.c | 8 ++++++-- drivers/scsi/lpfc/lpfc_hbadisc.c | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc.h +1 -0
@@ -603,6 +603,7 @@ struct lpfc_vport {#define FC_VFI_REGISTERED 0x800000/* VFI is registered */ #define FC_FDISC_COMPLETED 0x1000000/* FDISC completed */ #define FC_DISC_DELAYED 0x2000000/* Delay NPort discovery */ +#define FC_RSCN_MEMENTO 0x4000000/* RSCN cmd processed */ uint32_t ct_flags;#define FC_CT_RFF_ID 0x1/* RFF_ID accepted by switch */
drivers/scsi/lpfc/lpfc_els.c +6 -2
@@ -1895,6 +1895,7 @@ lpfc_end_rscn(struct lpfc_vport *vport)else {spin_lock_irq (shost->host_lock); vport->fc_flag &= ~FC_RSCN_MODE ; + vport->fc_flag |=FC_RSCN_MEMENTO ;spin_unlock_irq (shost->host_lock); } }
@@ -2443,13 +2444,14 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,u32 local_nlp_type, elscmd;/* -* If we are in RSCN mode, the FC4 types supported from a +* If discovery was kicked off from RSCN mode, +* the FC4 types supported from a * previous GFT_ID command may not be accurate. So, if we * are a NVME Initiator, always look for the possibility of * the remote NPort beng a NVME Target. */ if (phba->sli_rev ==LPFC_SLI_REV4 && - vport->fc_flag &FC_RSCN_MODE && + vport->fc_flag & (FC_RSCN_MODE |FC_RSCN_MEMENTO ) && vport->nvmei_support) ndlp->nlp_fc4_type |=NLP_FC4_NVME ; local_nlp_type = ndlp->nlp_fc4_type;
@@ -7970,6 +7972,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,if ((rscn_cnt <FC_MAX_HOLD_RSCN ) && !(vport->fc_flag &FC_RSCN_DISCOVERY )) { vport->fc_flag |=FC_RSCN_MODE ; + vport->fc_flag &= ~FC_RSCN_MEMENTO ;spin_unlock_irq (shost->host_lock);if (rscn_cnt) { cmd = vport->fc_rscn_id_list[rscn_cnt-1 ]->virt;
@@ -8019,6 +8022,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,spin_lock_irq (shost->host_lock); vport->fc_flag |=FC_RSCN_MODE ; + vport->fc_flag &= ~FC_RSCN_MEMENTO ;spin_unlock_irq (shost->host_lock); vport->fc_rscn_id_list[vport->fc_rscn_id_cnt++] = pcmd;/* Indicate we are done walking fc_rscn_id_list on this vport */
drivers/scsi/lpfc/lpfc_hbadisc.c +2 -1
@@ -1343,7 +1343,8 @@ lpfc_linkup_port(struct lpfc_vport *vport)spin_lock_irq (shost->host_lock); vport->fc_flag &= ~(FC_PT2PT |FC_PT2PT_PLOGI |FC_ABORT_DISCOVERY | -FC_RSCN_MODE |FC_NLP_MORE |FC_RSCN_DISCOVERY ); +FC_RSCN_MEMENTO |FC_RSCN_MODE | +FC_NLP_MORE |FC_RSCN_DISCOVERY ); vport->fc_flag |=FC_NDISC_ACTIVE ; vport->fc_ns_retry =0 ;spin_unlock_irq (shost->host_lock);
Signature · 1 line
2.26.2
PATCH 20/26 lpfc: Fix field overload in lpfc_iocbq data structure
In reply to James SmartThe lpfc_iocbq data structure has void * pointers that are overloaded to be as many as 8 different data types and the driver translates the void * by casting. This patch removes the void * pointers by declaring the specific types needed by the driver. It also expands the context_un to include more seldom used pointer types to save structure bytes. It also groups the u8 types together to pack the 8 bytes needed. This work allows the lpfc_iocbq data structure to be more strongly types and keeps it allocated from the 512 byte slab.
--- drivers/scsi/lpfc/lpfc_bsg.c | 79 +++-- drivers/scsi/lpfc/lpfc_ct.c | 148 +++++----- drivers/scsi/lpfc/lpfc_els.c | 443 ++++++++++++++--------------- drivers/scsi/lpfc/lpfc_hbadisc.c | 8 +- drivers/scsi/lpfc/lpfc_init.c | 12 +- drivers/scsi/lpfc/lpfc_nportdisc.c | 32 +-- drivers/scsi/lpfc/lpfc_nvme.c | 31 +- drivers/scsi/lpfc/lpfc_nvmet.c | 73 ++--- drivers/scsi/lpfc/lpfc_scsi.c | 17 +- drivers/scsi/lpfc/lpfc_sli.c | 120 ++++---- drivers/scsi/lpfc/lpfc_sli.h | 28 +- 11 files changed, 490 insertions(+), 501 deletions(-)
drivers/scsi/lpfc/lpfc_bsg.c +38 -41
@@ -310,7 +310,7 @@ lpfc_bsg_send_mgmt_cmd_cmp(struct lpfc_hba *phba,int rc =0 ;u32 ulp_status, ulp_word4, total_data_placed; - dd_data = cmdiocbq->context1; + dd_data = cmdiocbq->context_un.dd_data;/* Determine if job has been aborted */ spin_lock_irqsave (&phba->ct_ev_lock, flags);
@@ -328,10 +328,10 @@ lpfc_bsg_send_mgmt_cmd_cmp(struct lpfc_hba *phba,spin_unlock_irqrestore (&phba->hbalock, flags); iocb = &dd_data->context_un.iocb; - ndlp = iocb->cmdiocbq->context_un.ndlp; + ndlp = iocb->cmdiocbq->ndlp; rmp = iocb->rmp; - cmp = cmdiocbq->context2; - bmp = cmdiocbq->context3; + cmp = cmdiocbq->cmd_dmabuf; + bmp = cmdiocbq->bpl_dmabuf; ulp_status =get_job_ulpstatus (phba, rspiocbq); ulp_word4 =get_job_word4 (phba, rspiocbq); total_data_placed =get_job_data_placed (phba, rspiocbq);
@@ -470,14 +470,12 @@ lpfc_bsg_send_mgmt_cmd(struct bsg_job *job) cmdiocbq->num_bdes = num_entry; cmdiocbq->vport = phba->pport; - cmdiocbq->context2 = cmp; - cmdiocbq->context3 = bmp; + cmdiocbq->cmd_dmabuf = cmp; + cmdiocbq->bpl_dmabuf = bmp; cmdiocbq->cmd_flag |=LPFC_IO_LIBDFC ; cmdiocbq->cmd_cmpl = lpfc_bsg_send_mgmt_cmd_cmp; - cmdiocbq->context1 = dd_data; - cmdiocbq->context2 = cmp; - cmdiocbq->context3 = bmp; + cmdiocbq->context_un.dd_data = dd_data; dd_data->type =TYPE_IOCB ; dd_data->set_job = job;
@@ -495,8 +493,8 @@ lpfc_bsg_send_mgmt_cmd(struct bsg_job *job)readl (phba->HCregaddr);/* flush */ } - cmdiocbq->context_un.ndlp =lpfc_nlp_get (ndlp); -if (!cmdiocbq->context_un.ndlp) { + cmdiocbq->ndlp =lpfc_nlp_get (ndlp); +if (!cmdiocbq->ndlp) { rc = -ENODEV ; goto free_rmp; }
@@ -573,9 +571,9 @@ lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba,int rc =0 ;u32 ulp_status, ulp_word4, total_data_placed; - dd_data = cmdiocbq->context1; + dd_data = cmdiocbq->context_un.dd_data; ndlp = dd_data->context_un.iocb.ndlp; - cmdiocbq->context1 = ndlp; + cmdiocbq->ndlp = ndlp;/* Determine if job has been aborted */ spin_lock_irqsave (&phba->ct_ev_lock, flags);
@@ -595,7 +593,7 @@ lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba, ulp_status =get_job_ulpstatus (phba, rspiocbq); ulp_word4 =get_job_word4 (phba, rspiocbq); total_data_placed =get_job_data_placed (phba, rspiocbq); - pcmd = (struct lpfc_dmabuf *)cmdiocbq->context2; + pcmd = cmdiocbq->cmd_dmabuf; prsp = (struct lpfc_dmabuf *)pcmd->list.next;/* Copy the completed job data or determine the job status if job is
@@ -711,8 +709,8 @@ lpfc_bsg_rport_els(struct bsg_job *job)/* 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, - job->request_payload.payload_len); + cmdiocbq->cmd_dmabuf->virt, + cmdsize); rpi = ndlp->nlp_rpi;
@@ -722,8 +720,8 @@ lpfc_bsg_rport_els(struct bsg_job *job)else cmdiocbq->iocb.ulpContext = rpi; cmdiocbq->cmd_flag |=LPFC_IO_LIBDFC ; - cmdiocbq->context1 = dd_data; - cmdiocbq->context_un.ndlp = ndlp; + cmdiocbq->context_un.dd_data = dd_data; + cmdiocbq->ndlp = ndlp; cmdiocbq->cmd_cmpl = lpfc_bsg_rport_els_cmp; dd_data->type =TYPE_IOCB ; dd_data->set_job = job;
@@ -742,8 +740,8 @@ lpfc_bsg_rport_els(struct bsg_job *job)readl (phba->HCregaddr);/* flush */ } - cmdiocbq->context1 =lpfc_nlp_get (ndlp); -if (!cmdiocbq->context1) { + cmdiocbq->ndlp =lpfc_nlp_get (ndlp); +if (!cmdiocbq->ndlp) { rc = -EIO ; goto linkdown_err; }
@@ -917,8 +915,8 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,struct ulp_bde64 *bde;dma_addr_t dma_addr;int i; -struct lpfc_dmabuf *bdeBuf1 = piocbq->context2; -struct lpfc_dmabuf *bdeBuf2 = piocbq->context3; +struct lpfc_dmabuf *bdeBuf1 = piocbq->cmd_dmabuf; +struct lpfc_dmabuf *bdeBuf2 = piocbq->bpl_dmabuf;struct lpfc_sli_ct_request *ct_req;struct bsg_job *job =NULL ;struct fc_bsg_reply *bsg_reply;
@@ -985,9 +983,8 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,list_for_each_entry (iocbq, &head, list) { size =0 ;if (phba->sli3_options &LPFC_SLI3_HBQ_ENABLED ) { - bdeBuf1 = iocbq->context2; - bdeBuf2 = iocbq->context3; - + bdeBuf1 = iocbq->cmd_dmabuf; + bdeBuf2 = iocbq->bpl_dmabuf; }if (phba->sli_rev ==LPFC_SLI_REV4 ) bde_count = iocbq->wcqe_cmpl.word3;
@@ -1384,7 +1381,7 @@ lpfc_issue_ct_rsp_cmp(struct lpfc_hba *phba,int rc =0 ;u32 ulp_status, ulp_word4; - dd_data = cmdiocbq->context1; + dd_data = cmdiocbq->context_un.dd_data;/* Determine if job has been aborted */ spin_lock_irqsave (&phba->ct_ev_lock, flags);
@@ -1401,8 +1398,8 @@ lpfc_issue_ct_rsp_cmp(struct lpfc_hba *phba,spin_unlock_irqrestore (&phba->hbalock, flags); ndlp = dd_data->context_un.iocb.ndlp; - cmp = cmdiocbq->context2; - bmp = cmdiocbq->context3; + cmp = cmdiocbq->cmd_dmabuf; + bmp = cmdiocbq->bpl_dmabuf; ulp_status =get_job_ulpstatus (phba, rspiocbq); ulp_word4 =get_job_word4 (phba, rspiocbq);
@@ -1529,10 +1526,10 @@ lpfc_issue_ct_rsp(struct lpfc_hba *phba, struct bsg_job *job, uint32_t tag, ctiocb->cmd_flag |=LPFC_IO_LIBDFC ; ctiocb->vport = phba->pport; - ctiocb->context1 = dd_data; - ctiocb->context2 = cmp; - ctiocb->context3 = bmp; - ctiocb->context_un.ndlp = ndlp; + ctiocb->context_un.dd_data = dd_data; + ctiocb->cmd_dmabuf = cmp; + ctiocb->bpl_dmabuf = bmp; + ctiocb->ndlp = ndlp; ctiocb->cmd_cmpl = lpfc_issue_ct_rsp_cmp; dd_data->type =TYPE_IOCB ;
@@ -2671,7 +2668,7 @@ static int lpfcdiag_loop_get_xri(struct lpfc_hba *phba, uint16_t rpi, ctreq->CommandResponse.bits.CmdRsp =ELX_LOOPBACK_XRI_SETUP ; ctreq->CommandResponse.bits.Size =0 ; - cmdiocbq->context3 = dmabuf; + cmdiocbq->bpl_dmabuf = dmabuf; cmdiocbq->cmd_flag |=LPFC_IO_LIBDFC ; cmdiocbq->vport = phba->pport; cmdiocbq->cmd_cmpl =NULL ;
@@ -3231,7 +3228,7 @@ lpfc_bsg_diag_loopback_run(struct bsg_job *job) cmdiocbq->cmd_flag |=LPFC_IO_LOOPBACK ; cmdiocbq->vport = phba->pport; cmdiocbq->cmd_cmpl =NULL ; - cmdiocbq->context3 = txbmp; + cmdiocbq->bpl_dmabuf = txbmp;if (phba->sli_rev <LPFC_SLI_REV4 ) { lpfc_sli_prep_xmit_seq64(phba, cmdiocbq, txbmp, 0, txxri,
@@ -3384,7 +3381,7 @@ lpfc_bsg_get_dfc_rev(struct bsg_job *job)* This is completion handler function for mailbox commands issued from * lpfc_bsg_issue_mbox function. This function is called by the * mailbox event handler function with no lock held. This function -* will wake up thread waiting on the wait queue pointed by context1 +* will wake up thread waiting on the wait queue pointed by dd_data * of the mailbox. **/ static void
@@ -5034,9 +5031,9 @@ lpfc_bsg_menlo_cmd_cmp(struct lpfc_hba *phba,unsigned int rsp_size;int rc =0 ; - dd_data = cmdiocbq->context1; - cmp = cmdiocbq->context2; - bmp = cmdiocbq->context3; + dd_data = cmdiocbq->context_un.dd_data; + cmp = cmdiocbq->cmd_dmabuf; + bmp = cmdiocbq->bpl_dmabuf; menlo = &dd_data->context_un.menlo; rmp = menlo->rmp; rsp = &rspiocbq->iocb;
@@ -5233,9 +5230,9 @@ lpfc_menlo_cmd(struct bsg_job *job)/* We want the firmware to timeout before we do */ cmd->ulpTimeout =MENLO_TIMEOUT -5 ; cmdiocbq->cmd_cmpl = lpfc_bsg_menlo_cmd_cmp; - cmdiocbq->context1 = dd_data; - cmdiocbq->context2 = cmp; - cmdiocbq->context3 = bmp; + cmdiocbq->context_un.dd_data = dd_data; + cmdiocbq->cmd_dmabuf = cmp; + cmdiocbq->bpl_dmabuf = bmp;if (menlo_cmd->cmd ==LPFC_BSG_VENDOR_MENLO_CMD ) { cmd->ulpCommand =CMD_GEN_REQUEST64_CR ; cmd->ulpPU =MENLO_PU ;/* 3 */
drivers/scsi/lpfc/lpfc_ct.c +73 -75
349 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_els.c +220 -223
1,349 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_hbadisc.c +4 -4
@@ -5156,7 +5156,7 @@ lpfc_check_sli_ndlp(struct lpfc_hba *phba,if (pring->ringno ==LPFC_ELS_RING ) {switch (ulp_command) {case CMD_GEN_REQUEST64_CR : -if (iocb->context_un.ndlp == ndlp) +if (iocb->ndlp == ndlp)return 1 ; fallthrough;case CMD_ELS_REQUEST64_CR :
@@ -5164,7 +5164,7 @@ lpfc_check_sli_ndlp(struct lpfc_hba *phba,return 1 ; fallthrough;case CMD_XMIT_ELS_RSP64_CX : -if (iocb->context1 == (uint8_t *) ndlp) +if (iocb->ndlp == ndlp)return 1 ; } }else if (pring->ringno ==LPFC_FCP_RING ) {
@@ -6099,7 +6099,7 @@ lpfc_free_tx(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)*/ spin_lock_irq (&phba->hbalock);list_for_each_entry_safe (iocb, next_iocb, &pring->txq, list) { -if (iocb->context1 != ndlp) +if (iocb->ndlp != ndlp)continue ; ulp_command =get_job_cmnd (phba, iocb);
@@ -6113,7 +6113,7 @@ lpfc_free_tx(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)/* Next check the txcmplq */ list_for_each_entry_safe (iocb, next_iocb, &pring->txcmplq, list) { -if (iocb->context1 != ndlp) +if (iocb->ndlp != ndlp)continue ; ulp_command =get_job_cmnd (phba, iocb);
drivers/scsi/lpfc/lpfc_init.c +7 -5
@@ -4323,9 +4323,10 @@ lpfc_sli4_io_sgl_update(struct lpfc_hba *phba)lpfc_printf_log (phba,KERN_INFO ,LOG_SLI ,"6074 Current allocated XRI sgl count:%d, " -"maximum XRI count:%d\n" , +"maximum XRI count:%d els_xri_cnt:%d\n\n" , phba->sli4_hba.io_xri_cnt, - phba->sli4_hba.io_xri_max); + phba->sli4_hba.io_xri_max, + els_xri_cnt); cnt =lpfc_io_buf_flush (phba, &io_sgl_list);
@@ -4464,12 +4465,11 @@ lpfc_new_io_buf(struct lpfc_hba *phba, int num_to_alloc) } pwqeq->sli4_lxritag = lxri; pwqeq->sli4_xritag = phba->sli4_hba.xri_ids[lxri]; - pwqeq->context1 = lpfc_ncmd;/* Initialize local short-hand pointers. */ lpfc_ncmd->dma_sgl = lpfc_ncmd->data; lpfc_ncmd->dma_phys_sgl = lpfc_ncmd->dma_handle; - lpfc_ncmd->cur_iocbq.context1 = lpfc_ncmd; + lpfc_ncmd->cur_iocbq.io_buf = lpfc_ncmd;spin_lock_init (&lpfc_ncmd->buf_lock);/* add the nvme buffer to a post list */
@@ -4478,7 +4478,9 @@ lpfc_new_io_buf(struct lpfc_hba *phba, int num_to_alloc) }lpfc_printf_log (phba,KERN_INFO ,LOG_NVME ,"6114 Allocate %d out of %d requested new NVME " -"buffers\n" , bcnt, num_to_alloc); +"buffers of size x%lx bytes\n" , bcnt, num_to_alloc, +sizeof (*lpfc_ncmd)); +/* post the list of nvme buffer sgls to port if available */ if (!list_empty (&post_nblist))
drivers/scsi/lpfc/lpfc_nportdisc.c +16 -16
@@ -173,9 +173,9 @@ lpfc_check_elscmpl_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,void *ptr =NULL ;u32 ulp_status =get_job_ulpstatus (phba, rspiocb); - pcmd = (struct lpfc_dmabuf *) cmdiocb->context2; + pcmd = cmdiocb->cmd_dmabuf; -/* For lpfc_els_abort, context2 could be zero'ed to delay +/* For lpfc_els_abort, cmd_dmabuf could be zero'ed to delay * freeing associated memory till after ABTS completes. */ if (pcmd) {
@@ -343,7 +343,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,u32 remote_did;memset (&stat,0 ,sizeof (struct ls_rjt )); - pcmd = (struct lpfc_dmabuf *) cmdiocb->context2; + pcmd = cmdiocb->cmd_dmabuf; lp = (uint32_t *) pcmd->virt; sp = (struct serv_parm *) ((uint8_t *) lp +sizeof (uint32_t ));if (wwn_to_u64 (sp->portName.u.wwn) ==0 ) {
@@ -716,7 +716,7 @@ lpfc_rcv_padisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,uint32_t *lp;uint32_t cmd; - pcmd = (struct lpfc_dmabuf *) cmdiocb->context2; + pcmd = cmdiocb->cmd_dmabuf; lp = (uint32_t *) pcmd->virt; cmd = *lp++;
@@ -924,7 +924,7 @@ lpfc_rcv_prli_support_check(struct lpfc_vport *vport,uint32_t *payload;uint32_t cmd; - payload = ((struct lpfc_dmabuf *)cmdiocb->context2)->virt; + payload = cmdiocb->cmd_dmabuf->virt; cmd = *payload;if (vport->phba->nvmet_support) {/* Must be a NVME PRLI */
@@ -961,9 +961,9 @@ lpfc_rcv_prli(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,struct fc_rport *rport = ndlp->rport;u32 roles; - pcmd = (struct lpfc_dmabuf *) cmdiocb->context2; - lp = (uint32_t *) pcmd->virt; - npr = (PRLI *) ((uint8_t *) lp +sizeof (uint32_t )); + pcmd = cmdiocb->cmd_dmabuf; + lp = (uint32_t *)pcmd->virt; + npr = (PRLI *)((uint8_t *)lp +sizeof (uint32_t ));if ((npr->prliType ==PRLI_FCP_TYPE ) || (npr->prliType ==PRLI_NVME_TYPE )) {
@@ -1224,7 +1224,7 @@ lpfc_rcv_plogi_plogi_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,struct Scsi_Host *shost =lpfc_shost_from_vport (vport);struct lpfc_hba *phba = vport->phba;struct lpfc_iocbq *cmdiocb = arg; -struct lpfc_dmabuf *pcmd = (struct lpfc_dmabuf *) cmdiocb->context2; +struct lpfc_dmabuf *pcmd = cmdiocb->cmd_dmabuf;uint32_t *lp = (uint32_t *) pcmd->virt;struct serv_parm *sp = (struct serv_parm *) (lp +1 );struct ls_rjt stat;
@@ -1345,7 +1345,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,u32 did; cmdiocb = (struct lpfc_iocbq *) arg; - rspiocb = cmdiocb->context_un.rsp_iocb; + rspiocb = cmdiocb->rsp_iocb; ulp_status =get_job_ulpstatus (phba, rspiocb);
@@ -1357,7 +1357,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,if (ulp_status) goto out; - pcmd = (struct lpfc_dmabuf *) cmdiocb->context2; + pcmd = cmdiocb->cmd_dmabuf; prsp = list_get_first(&pcmd->list, struct lpfc_dmabuf, list);if (!prsp)
@@ -1703,7 +1703,7 @@ lpfc_cmpl_adisc_adisc_issue(struct lpfc_vport *vport,u32 ulp_status; cmdiocb = (struct lpfc_iocbq *) arg; - rspiocb = cmdiocb->context_un.rsp_iocb; + rspiocb = cmdiocb->rsp_iocb; ulp_status =get_job_ulpstatus (phba, rspiocb);
@@ -2157,7 +2157,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,u32 ulp_status; cmdiocb = (struct lpfc_iocbq *) arg; - rspiocb = cmdiocb->context_un.rsp_iocb; + rspiocb = cmdiocb->rsp_iocb; ulp_status =get_job_ulpstatus (phba, rspiocb);
@@ -2777,7 +2777,7 @@ lpfc_cmpl_plogi_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,u32 ulp_status; cmdiocb = (struct lpfc_iocbq *) arg; - rspiocb = cmdiocb->context_un.rsp_iocb; + rspiocb = cmdiocb->rsp_iocb; ulp_status =get_job_ulpstatus (phba, rspiocb);
@@ -2796,7 +2796,7 @@ lpfc_cmpl_prli_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,u32 ulp_status; cmdiocb = (struct lpfc_iocbq *) arg; - rspiocb = cmdiocb->context_un.rsp_iocb; + rspiocb = cmdiocb->rsp_iocb; ulp_status =get_job_ulpstatus (phba, rspiocb);
@@ -2832,7 +2832,7 @@ lpfc_cmpl_adisc_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,u32 ulp_status; cmdiocb = (struct lpfc_iocbq *) arg; - rspiocb = cmdiocb->context_un.rsp_iocb; + rspiocb = cmdiocb->rsp_iocb; ulp_status =get_job_ulpstatus (phba, rspiocb);
drivers/scsi/lpfc/lpfc_nvme.c +16 -15
@@ -319,8 +319,10 @@ __lpfc_nvme_ls_req_cmp(struct lpfc_hba *phba, struct lpfc_vport *vport,struct lpfc_nodelist *ndlp;uint32_t status; - pnvme_lsreq = (struct nvmefc_ls_req *)cmdwqe->context2; - ndlp = (struct lpfc_nodelist *)cmdwqe->context1; + pnvme_lsreq = cmdwqe->context_un.nvme_lsreq; + ndlp = cmdwqe->ndlp; + buf_ptr = cmdwqe->bpl_dmabuf; + status =bf_get (lpfc_wcqe_c_status, wcqe) &LPFC_IOCB_STATUS_MASK ; lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME_DISC,
@@ -330,16 +332,16 @@ __lpfc_nvme_ls_req_cmp(struct lpfc_hba *phba, struct lpfc_vport *vport, pnvme_lsreq, ndlp ? ndlp->nlp_DID :0 , cmdwqe->sli4_xritag, status, (wcqe->parameter &0xffff ), - cmdwqe, pnvme_lsreq, cmdwqe->context3, ndlp); + cmdwqe, pnvme_lsreq, cmdwqe->bpl_dmabuf, + ndlp);lpfc_nvmeio_data (phba,"NVMEx LS CMPL: xri x%x stat x%x parm x%x\n" , cmdwqe->sli4_xritag, status, wcqe->parameter); -if (cmdwqe->context3) { - buf_ptr = (struct lpfc_dmabuf *)cmdwqe->context3; +if (buf_ptr) {lpfc_mbuf_free (phba, buf_ptr->virt, buf_ptr->phys);kfree (buf_ptr); - cmdwqe->context3 =NULL ; + cmdwqe->bpl_dmabuf =NULL ; }if (pnvme_lsreq->done) pnvme_lsreq->done (pnvme_lsreq, status);
@@ -351,7 +353,7 @@ __lpfc_nvme_ls_req_cmp(struct lpfc_hba *phba, struct lpfc_vport *vport, cmdwqe->sli4_xritag, status);if (ndlp) {lpfc_nlp_put (ndlp); - cmdwqe->context1 =NULL ; + cmdwqe->ndlp =NULL ; }lpfc_sli_release_iocbq (phba, cmdwqe); }
@@ -407,19 +409,19 @@ lpfc_nvme_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp,/* Initialize only 64 bytes */ memset (wqe,0 ,sizeof (union lpfc_wqe )); - genwqe->context3 = (uint8_t *)bmp; + genwqe->bpl_dmabuf = bmp; genwqe->cmd_flag |=LPFC_IO_NVME_LS ;/* Save for completion so we can release these resources */ - genwqe->context1 =lpfc_nlp_get (ndlp); -if (!genwqe->context1) { + genwqe->ndlp =lpfc_nlp_get (ndlp); +if (!genwqe->ndlp) {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; + genwqe->context_un.nvme_lsreq = pnvme_lsreq;/* Fill in payload, bp points to frame payload */ if (!tmo)
@@ -730,7 +732,7 @@ __lpfc_nvme_ls_abort(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,spin_lock_irq (&phba->hbalock);spin_lock (&pring->ring_lock);list_for_each_entry_safe (wqe, next_wqe, &pring->txcmplq, list) { -if (wqe->context2 == pnvme_lsreq) { +if (wqe->context_un.nvme_lsreq == pnvme_lsreq) { wqe->cmd_flag |=LPFC_DRIVER_ABORTED ; foundit = true;break ;
@@ -929,8 +931,7 @@ static void lpfc_nvme_io_cmd_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, struct lpfc_iocbq *pwqeOut) { - struct lpfc_io_buf *lpfc_ncmd = - (struct lpfc_io_buf *)pwqeIn->context1; + struct lpfc_io_buf *lpfc_ncmd = pwqeIn->io_buf;struct lpfc_wcqe_complete *wcqe = &pwqeOut->wcqe_cmpl;struct lpfc_vport *vport = pwqeIn->vport;struct nvmefc_fcp_req *nCmd;
@@ -2717,7 +2718,7 @@ lpfc_nvme_cancel_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn,struct lpfc_wcqe_complete wcqe;struct lpfc_wcqe_complete *wcqep = &wcqe; - lpfc_ncmd = (struct lpfc_io_buf *)pwqeIn->context1; + lpfc_ncmd = pwqeIn->io_buf;if (!lpfc_ncmd) {lpfc_sli_release_iocbq (phba, pwqeIn);return ;
drivers/scsi/lpfc/lpfc_nvmet.c +37 -36
218 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_scsi.c +7 -10
@@ -433,7 +433,7 @@ lpfc_new_scsi_buf_s3(struct lpfc_vport *vport, int num_to_alloc) iocb->ulpClass =CLASS3 ; psb->status =IOSTAT_SUCCESS ;/* Put it back into the SCSI buffer list */ - psb->cur_iocbq.context1 = psb; + psb->cur_iocbq.io_buf = psb;spin_lock_init (&psb->buf_lock);lpfc_release_scsi_buf_s3 (phba, psb);
@@ -4082,8 +4082,7 @@ static void lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, struct lpfc_iocbq *pwqeOut) { - struct lpfc_io_buf *lpfc_cmd = - (struct lpfc_io_buf *)pwqeIn->context1; + struct lpfc_io_buf *lpfc_cmd = pwqeIn->io_buf;struct lpfc_wcqe_complete *wcqe = &pwqeOut->wcqe_cmpl;struct lpfc_vport *vport = pwqeIn->vport;struct lpfc_rport_data *rdata;
@@ -4421,7 +4420,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn, struct lpfc_iocbq *pIocbOut) {struct lpfc_io_buf *lpfc_cmd = - (struct lpfc_io_buf *) pIocbIn->context1; + (struct lpfc_io_buf *) pIocbIn->io_buf;struct lpfc_vport *vport = pIocbIn->vport;struct lpfc_rport_data *rdata = lpfc_cmd->rdata;struct lpfc_nodelist *pnode = rdata->pnode;
@@ -4744,7 +4743,7 @@ static int lpfc_scsi_prep_cmnd_buf_s3(struct lpfc_vport *vport, piocbq->iocb.ulpFCP2Rcvy =0 ; piocbq->iocb.ulpClass = (pnode->nlp_fcp_info &0x0f ); - piocbq->context1 = lpfc_cmd; + piocbq->io_buf = lpfc_cmd;if (!piocbq->cmd_cmpl) piocbq->cmd_cmpl = lpfc_scsi_cmd_iocb_cmpl; piocbq->iocb.ulpTimeout = tmo;
@@ -4856,8 +4855,7 @@ static int lpfc_scsi_prep_cmnd_buf_s4(struct lpfc_vport *vport,bf_set (wqe_reqtag, &wqe->generic.wqe_com, pwqeq->iotag); pwqeq->vport = vport; - pwqeq->vport = vport; - pwqeq->context1 = lpfc_cmd; + pwqeq->io_buf = lpfc_cmd; pwqeq->hba_wqidx = lpfc_cmd->hdwq_no; pwqeq->cmd_cmpl = lpfc_fcp_io_cmd_wqe_cmpl;
@@ -5098,8 +5096,7 @@ lpfc_tskmgmt_def_cmpl(struct lpfc_hba *phba,struct lpfc_iocbq *cmdiocbq, struct lpfc_iocbq *rspiocbq) { - struct lpfc_io_buf *lpfc_cmd = - (struct lpfc_io_buf *) cmdiocbq->context1; + struct lpfc_io_buf *lpfc_cmd = cmdiocbq->io_buf;if (lpfc_cmd)lpfc_release_scsi_buf (phba, lpfc_cmd);return ;
@@ -5916,7 +5913,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) goto out_unlock_ring; } -BUG_ON (iocb->context1 != lpfc_cmd); +WARN_ON (iocb->io_buf != lpfc_cmd);/* abort issued in recovery is still in progress */ if (iocb->cmd_flag &LPFC_DRIVER_ABORTED ) {
drivers/scsi/lpfc/lpfc_sli.c +54 -66
341 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_sli.h +18 -10
@@ -77,11 +77,15 @@ struct lpfc_iocbq {u32 unsol_rcv_len;/* Receive len in usol path */ -uint8_t num_bdes; -uint8_t abort_bls;/* ABTS by initiator or responder */ -u8 abort_rctl;/* ACC or RJT flag */ -uint8_t priority;/* OAS priority */ -uint8_t retry;/* retry counter for IOCB cmd - if needed */ +/* Pack the u8's together and make them module-4. */ +u8 num_bdes;/* Number of BDEs */ +u8 abort_bls;/* ABTS by initiator or responder */ +u8 abort_rctl;/* ACC or RJT flag */ +u8 priority;/* OAS priority */ +u8 retry;/* retry counter for IOCB cmd - if needed */ +u8 rsvd1;/* Pad for u32 */ +u8 rsvd2;/* Pad for u32 */ +u8 rsvd3;/* Pad for u32 */ u32 cmd_flag;#define LPFC_IO_LIBDFC 1/* libdfc iocb */
@@ -116,18 +120,22 @@ struct lpfc_iocbq {uint32_t drvrTimeout;/* driver timeout in seconds */ struct lpfc_vport *vport;/* virtual port pointer */ -void *context1;/* caller context information */ -void *context2;/* caller context information */ -void *context3;/* caller context information */ +struct lpfc_dmabuf *cmd_dmabuf; +struct lpfc_dmabuf *rsp_dmabuf; +struct lpfc_dmabuf *bpl_dmabuf;uint32_t event_tag;/* LA Event tag */ union {wait_queue_head_t *wait_queue; -struct lpfc_iocbq *rsp_iocb;struct lpfcMboxq *mbox; -struct lpfc_nodelist *ndlp;struct lpfc_node_rrq *rrq; +struct nvmefc_ls_req *nvme_lsreq; +struct lpfc_async_xchg_ctx *axchg; +struct bsg_job_data *dd_data; } context_un; +struct lpfc_io_buf *io_buf; +struct lpfc_iocbq *rsp_iocb; +struct lpfc_nodelist *ndlp;union lpfc_vmid_tag vmid_tag;void (*fabric_cmd_cmpl)(struct lpfc_hba *phba,struct lpfc_iocbq *cmd,struct lpfc_iocbq *rsp);
Signature · 1 line
2.26.2
kernel test robot
build botRe: [PATCH 20/26] lpfc: Fix field overload in lpfc_iocbq data structure
I love your patch! Perhaps something to improve:
Hi James,
I love your patch! Perhaps something to improve:
[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on mkp-scsi/for-next v5.18-rc2 next-20220413] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/James-Smart/lpfc-Update-lpfc-to-revision-14-2-0-2/20220413-073746 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next config: mips-allmodconfig (https://download.01.org/0day-ci/archive/20220414/[email protected]/config) compiler: mips-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/536304e3919a95bf3d790d78a9a79b862e4ef29c
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review James-Smart/lpfc-Update-lpfc-to-revision-14-2-0-2/20220413-073746 git checkout 536304e3919a95bf3d790d78a9a79b862e4ef29c
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash drivers/scsi/
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
In file included from include/linux/device.h:15,
from include/linux/blk_types.h:11, from include/linux/blkdev.h:9, from drivers/scsi/lpfc/lpfc_init.c:24:
drivers/scsi/lpfc/lpfc_init.c: In function 'lpfc_new_io_buf':
>> drivers/scsi/lpfc/lpfc_logmsg.h:94:59: warning: format '%lx' expects argument of type 'long unsigned int', but argument 7 has type 'unsigned int' [-Wformat=]
94 | dev_printk(level, &((phba)->pcidev)->dev, "%d:" \
| ^~~~~
include/linux/dev_printk.h:129:41: note: in definition of macro 'dev_printk'
129 | _dev_printk(level, dev, fmt, ##__VA_ARGS__); \
| ^~~
drivers/scsi/lpfc/lpfc_init.c:4479:9: note: in expansion of macro 'lpfc_printf_log'
4479 | lpfc_printf_log(phba, KERN_INFO, LOG_NVME,
| ^~~~~~~~~~~~~~~vim +94 drivers/scsi/lpfc/lpfc_logmsg.h
e8b62011d88d6f James Smart 2007-08-02 85
dea3101e0a5c89 James Bottomley 2005-04-17 86 #define lpfc_printf_log(phba, level, mask, fmt, arg...) \
7f5f3d0d02aa2f James Smart 2008-02-08 87 do { \
f4b4c68f74dcd5 James Smart 2009-05-22 88 { uint32_t log_verbose = (phba)->pport ? \
f4b4c68f74dcd5 James Smart 2009-05-22 89 (phba)->pport->cfg_log_verbose : \
f4b4c68f74dcd5 James Smart 2009-05-22 90 (phba)->cfg_log_verbose; \
372c187b8a705c Dick Kennedy 2020-06-30 91 if (((mask) & log_verbose) || (level[1] <= '3')) { \
30d9d4d7f38739 James Smart 2022-04-12 92 if ((mask) & LOG_TRACE_EVENT && !log_verbose) \
372c187b8a705c Dick Kennedy 2020-06-30 93 lpfc_dmp_dbg(phba); \e8b62011d88d6f James Smart 2007-08-02 @94 dev_printk(level, &((phba)->pcidev)->dev, "%d:" \
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
Dan Carpenter
build botRe: [PATCH 20/26] lpfc: Fix field overload in lpfc_iocbq data structure
In reply to James SmartCC: kbuild-all(a)lists.01.org BCC: lkp(a)intel.com In-Reply-To: <[email protected]> References: <[email protected]> TO: James Smart…
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: James Smart <[email protected]>
TO: linux-scsi(a)vger.kernel.org
CC: James Smart <[email protected]>
CC: Justin Tee <[email protected]>
Hi James,
I love your patch! Perhaps something to improve:
[auto build test WARNING on jejb-scsi/for-next]
[also build test WARNING on mkp-scsi/for-next v5.18-rc3 next-20220414] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/intel-lab-lkp/linux/commits/James-Smart/lpfc-Update-lpfc-to-revision-14-2-0-2/20220413-073746 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
:::::: branch date: 6 days ago
:::::: commit date: 6 days ago
config: x86_64-randconfig-m001-20220418 (https://download.01.org/0day-ci/archive/20220419/202204190252.8068PeSp-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.2.0-19) 11.2.0
If you fix the issue, kindly add following tag as appropriate
smatch warnings:drivers/scsi/lpfc/lpfc_sli.c:22305 lpfc_sli_prep_wqe() error: we previously assumed 'ndlp' could be null (see line 22298)
vim +/ndlp +22305 drivers/scsi/lpfc/lpfc_sli.c
561341425bcc70 James Smart 2022-02-24 22228
561341425bcc70 James Smart 2022-02-24 22229 /**
561341425bcc70 James Smart 2022-02-24 22230 * lpfc_sli_prep_wqe - Prepare WQE for the command to be posted
561341425bcc70 James Smart 2022-02-24 22231 * @phba: phba object
561341425bcc70 James Smart 2022-02-24 22232 * @job: job entry of the command to be posted.
561341425bcc70 James Smart 2022-02-24 22233 *
561341425bcc70 James Smart 2022-02-24 22234 * Fill the common fields of the wqe for each of the command.
561341425bcc70 James Smart 2022-02-24 22235 *
561341425bcc70 James Smart 2022-02-24 22236 * Return codes:
561341425bcc70 James Smart 2022-02-24 22237 * None
561341425bcc70 James Smart 2022-02-24 22238 **/
561341425bcc70 James Smart 2022-02-24 22239 void
561341425bcc70 James Smart 2022-02-24 22240 lpfc_sli_prep_wqe(struct lpfc_hba *phba, struct lpfc_iocbq *job)
561341425bcc70 James Smart 2022-02-24 22241 {
561341425bcc70 James Smart 2022-02-24 22242 u8 cmnd;
561341425bcc70 James Smart 2022-02-24 22243 u32 *pcmd;
561341425bcc70 James Smart 2022-02-24 22244 u32 if_type = 0;
561341425bcc70 James Smart 2022-02-24 22245 u32 fip, abort_tag;
561341425bcc70 James Smart 2022-02-24 22246 struct lpfc_nodelist *ndlp = NULL;
561341425bcc70 James Smart 2022-02-24 22247 union lpfc_wqe128 *wqe = &job->wqe;
561341425bcc70 James Smart 2022-02-24 22248 u32 els_id = LPFC_ELS_ID_DEFAULT;
561341425bcc70 James Smart 2022-02-24 22249 u8 command_type = ELS_COMMAND_NON_FIP;
561341425bcc70 James Smart 2022-02-24 22250
561341425bcc70 James Smart 2022-02-24 22251 fip = phba->hba_flag & HBA_FIP_SUPPORT;
561341425bcc70 James Smart 2022-02-24 22252 /* The fcp commands will set command type */
561341425bcc70 James Smart 2022-02-24 22253 if (job->cmd_flag & LPFC_IO_FCP)
561341425bcc70 James Smart 2022-02-24 22254 command_type = FCP_COMMAND;
561341425bcc70 James Smart 2022-02-24 22255 else if (fip && (job->cmd_flag & LPFC_FIP_ELS_ID_MASK))
561341425bcc70 James Smart 2022-02-24 22256 command_type = ELS_COMMAND_FIP;
561341425bcc70 James Smart 2022-02-24 22257 else
561341425bcc70 James Smart 2022-02-24 22258 command_type = ELS_COMMAND_NON_FIP;
561341425bcc70 James Smart 2022-02-24 22259
561341425bcc70 James Smart 2022-02-24 22260 abort_tag = job->iotag;
561341425bcc70 James Smart 2022-02-24 22261 cmnd = bf_get(wqe_cmnd, &wqe->els_req.wqe_com);
561341425bcc70 James Smart 2022-02-24 22262
561341425bcc70 James Smart 2022-02-24 22263 switch (cmnd) {
561341425bcc70 James Smart 2022-02-24 22264 case CMD_ELS_REQUEST64_WQE:
536304e3919a95 James Smart 2022-04-12 22265 ndlp = job->ndlp;
561341425bcc70 James Smart 2022-02-24 22266
561341425bcc70 James Smart 2022-02-24 22267 /* CCP CCPE PV PRI in word10 were set in the memcpy */
561341425bcc70 James Smart 2022-02-24 22268 if (command_type == ELS_COMMAND_FIP)
561341425bcc70 James Smart 2022-02-24 22269 els_id = ((job->cmd_flag & LPFC_FIP_ELS_ID_MASK)
561341425bcc70 James Smart 2022-02-24 22270 >> LPFC_FIP_ELS_ID_SHIFT);
561341425bcc70 James Smart 2022-02-24 22271
561341425bcc70 James Smart 2022-02-24 22272 if_type = bf_get(lpfc_sli_intf_if_type,
561341425bcc70 James Smart 2022-02-24 22273 &phba->sli4_hba.sli_intf);
561341425bcc70 James Smart 2022-02-24 22274 if (if_type >= LPFC_SLI_INTF_IF_TYPE_2) {
536304e3919a95 James Smart 2022-04-12 22275 pcmd = (u32 *)job->cmd_dmabuf->virt;
561341425bcc70 James Smart 2022-02-24 22276 if (pcmd && (*pcmd == ELS_CMD_FLOGI ||
561341425bcc70 James Smart 2022-02-24 22277 *pcmd == ELS_CMD_SCR ||
561341425bcc70 James Smart 2022-02-24 22278 *pcmd == ELS_CMD_RDF ||
561341425bcc70 James Smart 2022-02-24 22279 *pcmd == ELS_CMD_EDC ||
561341425bcc70 James Smart 2022-02-24 22280 *pcmd == ELS_CMD_RSCN_XMT ||
561341425bcc70 James Smart 2022-02-24 22281 *pcmd == ELS_CMD_FDISC ||
561341425bcc70 James Smart 2022-02-24 22282 *pcmd == ELS_CMD_LOGO ||
561341425bcc70 James Smart 2022-02-24 22283 *pcmd == ELS_CMD_QFPA ||
561341425bcc70 James Smart 2022-02-24 22284 *pcmd == ELS_CMD_UVEM ||
561341425bcc70 James Smart 2022-02-24 22285 *pcmd == ELS_CMD_PLOGI)) {
561341425bcc70 James Smart 2022-02-24 22286 bf_set(els_req64_sp, &wqe->els_req, 1);
561341425bcc70 James Smart 2022-02-24 22287 bf_set(els_req64_sid, &wqe->els_req,
561341425bcc70 James Smart 2022-02-24 22288 job->vport->fc_myDID);
561341425bcc70 James Smart 2022-02-24 22289
561341425bcc70 James Smart 2022-02-24 22290 if ((*pcmd == ELS_CMD_FLOGI) &&
561341425bcc70 James Smart 2022-02-24 22291 !(phba->fc_topology ==
561341425bcc70 James Smart 2022-02-24 22292 LPFC_TOPOLOGY_LOOP))
561341425bcc70 James Smart 2022-02-24 22293 bf_set(els_req64_sid, &wqe->els_req, 0);
561341425bcc70 James Smart 2022-02-24 22294
561341425bcc70 James Smart 2022-02-24 22295 bf_set(wqe_ct, &wqe->els_req.wqe_com, 1);
561341425bcc70 James Smart 2022-02-24 22296 bf_set(wqe_ctxt_tag, &wqe->els_req.wqe_com,
561341425bcc70 James Smart 2022-02-24 22297 phba->vpi_ids[job->vport->vpi]);
536304e3919a95 James Smart 2022-04-12 @22298 } else if (pcmd && ndlp) {
561341425bcc70 James Smart 2022-02-24 22299 bf_set(wqe_ct, &wqe->els_req.wqe_com, 0);
561341425bcc70 James Smart 2022-02-24 22300 bf_set(wqe_ctxt_tag, &wqe->els_req.wqe_com,
561341425bcc70 James Smart 2022-02-24 22301 phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]);
561341425bcc70 James Smart 2022-02-24 22302 }
561341425bcc70 James Smart 2022-02-24 22303 }561341425bcc70 James Smart 2022-02-24 22304561341425bcc70 James Smart 2022-02-24 @22305 bf_set(wqe_temp_rpi, &wqe->els_req.wqe_com,
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
PATCH 21/26 lpfc: Refactor cleanup of mailbox commands
In reply to James SmartThe intention of this patch is to refactor mailbox memory allocation and cleanup steps in one routine respectively to prevent memory leaks or memory errors related to mailbox commands. There are trivial localized fixes as well.
Provide lpfc_mbox_rsrc_prep - this routine allocates the dmabuf and the mbuf associated with it. It also catches allocation errors and returns status.
Provide lpfc_mbox_rsrc_cleanup - this routine verifies a dmabuf exists and if so releases the associated mbuf and the dmabuf memory. It then sets the ctx_buf to NULL and releases the mailbox memory to the mailbox pool.
--- drivers/scsi/lpfc/lpfc_crtn.h | 4 +- drivers/scsi/lpfc/lpfc_els.c | 105 ++++----------- drivers/scsi/lpfc/lpfc_hbadisc.c | 124 +++++------------- drivers/scsi/lpfc/lpfc_init.c | 83 ++++-------- drivers/scsi/lpfc/lpfc_mbox.c | 201 +++++++++++++++++------------ drivers/scsi/lpfc/lpfc_nportdisc.c | 36 ++---- drivers/scsi/lpfc/lpfc_sli.c | 55 ++------ drivers/scsi/lpfc/lpfc_sli.h | 6 + drivers/scsi/lpfc/lpfc_vport.c | 29 ++--- 9 files changed, 248 insertions(+), 395 deletions(-)
drivers/scsi/lpfc/lpfc_crtn.h +3 -1
@@ -32,7 +32,9 @@ int lpfc_dump_static_vport(struct lpfc_hba *, LPFC_MBOXQ_t *, uint16_t);int lpfc_sli4_dump_cfg_rg23 (struct lpfc_hba *,struct lpfcMboxq *);void lpfc_read_nv (struct lpfc_hba *,LPFC_MBOXQ_t *);void lpfc_config_async (struct lpfc_hba *,LPFC_MBOXQ_t *,uint32_t ); - +int lpfc_mbox_rsrc_prep (struct lpfc_hba *phba,LPFC_MBOXQ_t *mbox); +void lpfc_mbox_rsrc_cleanup (struct lpfc_hba *phba,LPFC_MBOXQ_t *mbox, +enum lpfc_mbox_ctx locked);void lpfc_heart_beat (struct lpfc_hba *,LPFC_MBOXQ_t *);int lpfc_read_topology (struct lpfc_hba *,LPFC_MBOXQ_t *,struct lpfc_dmabuf *);void lpfc_clear_la (struct lpfc_hba *,LPFC_MBOXQ_t *);
drivers/scsi/lpfc/lpfc_els.c +28 -77
241 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_hbadisc.c +33 -91
294 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_init.c +26 -57
182 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_mbox.c +119 -82
340 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_nportdisc.c +8 -28
@@ -327,7 +327,6 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, {struct lpfc_hba *phba = vport->phba;struct lpfc_dmabuf *pcmd; -struct lpfc_dmabuf *mp;uint64_t nlp_portwwn =0 ;uint32_t *lp;union lpfc_wqe128 *wqe;
@@ -592,12 +591,8 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,* a default RPI. */ if (phba->sli_rev ==LPFC_SLI_REV4 ) { - mp = (struct lpfc_dmabuf *)login_mbox->ctx_buf; -if (mp) { -lpfc_mbuf_free (phba, mp->virt, mp->phys); -kfree (mp); - } -mempool_free (login_mbox, phba->mbox_mem_pool); +lpfc_mbox_rsrc_cleanup (phba, login_mbox, +MBOX_THD_UNLOCKED ); login_mbox =NULL ; }else {/* In order to preserve RPIs, we want to cleanup
@@ -615,14 +610,9 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, stat.un.b.lsRjtRsnCodeExp =LSEXP_NOTHING_MORE ; rc =lpfc_els_rsp_reject (vport, stat.un.lsRjtError, cmdiocb, ndlp, login_mbox); -if (rc) { - mp = (struct lpfc_dmabuf *)login_mbox->ctx_buf; -if (mp) { -lpfc_mbuf_free (phba, mp->virt, mp->phys); -kfree (mp); - } -mempool_free (login_mbox, phba->mbox_mem_pool); - } +if (rc && login_mbox) +lpfc_mbox_rsrc_cleanup (phba, login_mbox, +MBOX_THD_UNLOCKED );return 1 ; }
@@ -1334,7 +1324,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport, {struct lpfc_hba *phba = vport->phba;struct lpfc_iocbq *cmdiocb, *rspiocb; -struct lpfc_dmabuf *pcmd, *prsp, *mp; +struct lpfc_dmabuf *pcmd, *prsp;uint32_t *lp;uint32_t vid, flag;struct serv_parm *sp;
@@ -1501,11 +1491,7 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,* command */ lpfc_nlp_put (ndlp); - mp = (struct lpfc_dmabuf *)mbox->ctx_buf; -lpfc_mbuf_free (phba, mp->virt, mp->phys); -kfree (mp); -mempool_free (mbox, phba->mbox_mem_pool); - +lpfc_mbox_rsrc_cleanup (phba, mbox,MBOX_THD_UNLOCKED ); lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, "0134 PLOGI: cannot issue reg_login " "Data: x%x x%x x%x x%x\n",
@@ -1856,7 +1842,6 @@ lpfc_rcv_logo_reglogin_issue(struct lpfc_vport *vport,struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg;LPFC_MBOXQ_t *mb;LPFC_MBOXQ_t *nextmb; -struct lpfc_dmabuf *mp;struct lpfc_nodelist *ns_ndlp; cmdiocb = (struct lpfc_iocbq *) arg;
@@ -1876,16 +1861,11 @@ lpfc_rcv_logo_reglogin_issue(struct lpfc_vport *vport,list_for_each_entry_safe (mb, nextmb, &phba->sli.mboxq, list) {if ((mb->u.mb.mbxCommand ==MBX_REG_LOGIN64 ) && (ndlp == (struct lpfc_nodelist *)mb->ctx_ndlp)) { - mp = (struct lpfc_dmabuf *)(mb->ctx_buf); -if (mp) { -__lpfc_mbuf_free (phba, mp->virt, mp->phys); -kfree (mp); - } ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND ;lpfc_nlp_put (ndlp);list_del (&mb->list); phba->sli.mboxq_cnt--; -mempool_free (mb, phba->mbox_mem_pool); +lpfc_mbox_rsrc_cleanup (phba, mb,MBOX_THD_LOCKED ); } }spin_unlock_irq (&phba->hbalock);
drivers/scsi/lpfc/lpfc_sli.c +12 -43
159 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_sli.h +6 -0
@@ -35,6 +35,12 @@ typedef enum _lpfc_ctx_cmd {LPFC_CTX_HOST } lpfc_ctx_cmd; +/* Enumeration to describe the thread lock context. */ +enum lpfc_mbox_ctx { +MBOX_THD_UNLOCKED , +MBOX_THD_LOCKED +}; +union lpfc_vmid_tag {uint32_t app_id;uint8_t cs_ctl_vmid;
drivers/scsi/lpfc/lpfc_vport.c +13 -16
@@ -135,12 +135,14 @@ lpfc_vport_sparm(struct lpfc_hba *phba, struct lpfc_vport *vport) }/* -* Grab buffer pointer and clear context1 so we can use -* lpfc_sli_issue_box_wait +* Wait for the read_sparams mailbox to complete. Driver needs +* this per vport to start the FDISC. If the mailbox fails, +* just cleanup and return an error unless the failure is a +* mailbox timeout. For MBX_TIMEOUT, allow the default +* mbox completion handler to take care of the cleanup. This +* is safe as the mailbox command isn't one that triggers +* another mailbox. */ - mp = (struct lpfc_dmabuf *)pmb->ctx_buf; - pmb->ctx_buf =NULL ; - pmb->vport = vport; rc =lpfc_sli_issue_mbox_wait (phba, pmb, phba->fc_ratov *2 );if (rc !=MBX_SUCCESS ) {
@@ -148,34 +150,29 @@ lpfc_vport_sparm(struct lpfc_hba *phba, struct lpfc_vport *vport)lpfc_printf_vlog (vport,KERN_ERR ,LOG_TRACE_EVENT ,"1830 Signal aborted mbxCmd x%x\n" , mb->mbxCommand); -lpfc_mbuf_free (phba, mp->virt, mp->phys); -kfree (mp);if (rc !=MBX_TIMEOUT ) -mempool_free (pmb, phba->mbox_mem_pool); +lpfc_mbox_rsrc_cleanup (phba, pmb, +MBOX_THD_UNLOCKED );return -EINTR ; }else {lpfc_printf_vlog (vport,KERN_ERR ,LOG_TRACE_EVENT ,"1818 VPort failed init, mbxCmd x%x " "READ_SPARM mbxStatus x%x, rc = x%x\n" , mb->mbxCommand, mb->mbxStatus, rc); -lpfc_mbuf_free (phba, mp->virt, mp->phys); -kfree (mp);if (rc !=MBX_TIMEOUT ) -mempool_free (pmb, phba->mbox_mem_pool); +lpfc_mbox_rsrc_cleanup (phba, pmb, +MBOX_THD_UNLOCKED );return -EIO ; } } + mp = (struct lpfc_dmabuf *)pmb->ctx_buf;memcpy (&vport->fc_sparam, mp->virt,sizeof (struct serv_parm ));memcpy (&vport->fc_nodename, &vport->fc_sparam.nodeName,sizeof (struct lpfc_name ));memcpy (&vport->fc_portname, &vport->fc_sparam.portName,sizeof (struct lpfc_name )); - -lpfc_mbuf_free (phba, mp->virt, mp->phys); -kfree (mp); -mempool_free (pmb, phba->mbox_mem_pool); - +lpfc_mbox_rsrc_cleanup (phba, pmb,MBOX_THD_UNLOCKED );return 0 ; }
Signature · 1 line
2.26.2
PATCH 22/26 lpfc: Change FA-PWWN detection methodology
In reply to James SmartDo not rely on vendor version field of the CSPs to determine if we are in a FA-PWWN environment. Instead, use the following procedure:
First, during HBA initialization, driver does a READ_CONFIG to determine if FA-PWWN is configured on the HBA. A LPFC_FAWWPN_CONFIG hba_flag is set accordingly.
Next, when the link comes up before the driver gets a link up event, the firmware logs into the fabric with FA-PWWN. If the fabric port does not support FA-PWWN, the driver will get a Misconfigured FA-WWN async event before the link up. A LPFC_FAWWPN_FABRIC hba_flag will be set accordingly.
Finally, if the fabric supports FA-PWWN, the firmware will replace its CSPs WWN with the Fabric Assigned ones. Then after link up, the driver will retrieve the Fabric Assigned WWN when it does a READ_SPARAM mbox command.
--- drivers/scsi/lpfc/lpfc.h | 5 +-- drivers/scsi/lpfc/lpfc_attr.c | 18 ++++++-- drivers/scsi/lpfc/lpfc_hbadisc.c | 8 ++++ drivers/scsi/lpfc/lpfc_hw.h | 2 - drivers/scsi/lpfc/lpfc_hw4.h | 3 ++ drivers/scsi/lpfc/lpfc_init.c | 72 ++++++++++++++++++++++++-------- drivers/scsi/lpfc/lpfc_sli.c | 1 + drivers/scsi/lpfc/lpfc_sli4.h | 3 ++ 8 files changed, 86 insertions(+), 26 deletions(-)
drivers/scsi/lpfc/lpfc.h +2 -3
@@ -738,9 +738,8 @@ struct lpfc_vport {struct list_head rcv_buffer_list;unsigned long rcv_buffer_time_stamp;uint32_t vport_flag; -#define STATIC_VPORT 1 -#define FAWWPN_SET 2 -#define FAWWPN_PARAM_CHG 4 +#define STATIC_VPORT 0x1 +#define FAWWPN_PARAM_CHG 0x2uint16_t fdmi_num_disc;uint32_t fdmi_hba_mask;
drivers/scsi/lpfc/lpfc_attr.c +14 -4
@@ -1120,12 +1120,22 @@ lpfc_link_state_show(struct device *dev, struct device_attribute *attr, len +=scnprintf (buf + len,PAGE_SIZE -len," Private Loop\n" ); }else { -if (vport->fc_flag &FC_FABRIC ) - len +=scnprintf (buf + len,PAGE_SIZE -len, -" Fabric\n" ); -else +if (vport->fc_flag &FC_FABRIC ) { +if (phba->sli_rev ==LPFC_SLI_REV4 && + vport->port_type ==LPFC_PHYSICAL_PORT && + phba->sli4_hba.fawwpn_flag & +LPFC_FAWWPN_FABRIC ) + len +=scnprintf (buf + len, +PAGE_SIZE - len, +" Fabric FA-PWWN\n" ); +else + len +=scnprintf (buf + len, +PAGE_SIZE - len, +" Fabric\n" ); + }else { len +=scnprintf (buf + len,PAGE_SIZE -len," Point-2-Point\n" ); + } } }
drivers/scsi/lpfc/lpfc_hbadisc.c +8 -0
@@ -1183,6 +1183,7 @@ lpfc_port_link_failure(struct lpfc_vport *vport)void lpfc_linkdown_port (struct lpfc_vport *vport) { +struct lpfc_hba *phba = vport->phba;struct Scsi_Host *shost =lpfc_shost_from_vport (vport);if (vport->cfg_enable_fc4_type !=LPFC_ENABLE_NVME )
@@ -1200,6 +1201,13 @@ lpfc_linkdown_port(struct lpfc_vport *vport) vport->fc_flag &= ~FC_DISC_DELAYED ;spin_unlock_irq (shost->host_lock);del_timer_sync (&vport->delayed_disc_tmo); + +if (phba->sli_rev ==LPFC_SLI_REV4 && + vport->port_type ==LPFC_PHYSICAL_PORT && + phba->sli4_hba.fawwpn_flag &LPFC_FAWWPN_CONFIG ) { +/* Assume success on link up */ + phba->sli4_hba.fawwpn_flag |=LPFC_FAWWPN_FABRIC ; + } }int
drivers/scsi/lpfc/lpfc_hw.h +0 -2
@@ -511,8 +511,6 @@ struct class_parms {uint8_t word3Reserved2;/* Fc Word 3, bit 0: 7 */ }; -#define FAPWWN_KEY_VENDOR 0x42524344/*valid vendor version fawwpn key*/ -struct serv_parm {/* Structure is in Big Endian format */ struct csp cmn;struct lpfc_name portName;
drivers/scsi/lpfc/lpfc_hw4.h +3 -0
@@ -2893,6 +2893,9 @@ struct lpfc_mbx_read_config {#define lpfc_mbx_rd_conf_extnts_inuse_SHIFT 31#define lpfc_mbx_rd_conf_extnts_inuse_MASK 0x00000001#define lpfc_mbx_rd_conf_extnts_inuse_WORD word1 +#define lpfc_mbx_rd_conf_fawwpn_SHIFT 30 +#define lpfc_mbx_rd_conf_fawwpn_MASK 0x00000001 +#define lpfc_mbx_rd_conf_fawwpn_WORD word1#define lpfc_mbx_rd_conf_wcs_SHIFT 28/* warning signaling */ #define lpfc_mbx_rd_conf_wcs_MASK 0x00000001#define lpfc_mbx_rd_conf_wcs_WORD word1
drivers/scsi/lpfc/lpfc_init.c +55 -17
119 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_sli.c +1 -0
@@ -5265,6 +5265,7 @@ lpfc_sli_brdrestart_s4(struct lpfc_hba *phba) phba->pport->stopped =0 ; phba->link_state =LPFC_INIT_START ; phba->hba_flag =0 ; + phba->sli4_hba.fawwpn_flag =0 ;spin_unlock_irq (&phba->hbalock);memset (&psli->lnk_stat_offsets,0 ,sizeof (psli->lnk_stat_offsets));
drivers/scsi/lpfc/lpfc_sli4.h +3 -0
@@ -981,6 +981,9 @@ struct lpfc_sli4_hba {#define lpfc_conf_trunk_port3_nd_MASK 0x1uint8_t flash_id;uint8_t asic_rev; +uint16_t fawwpn_flag;/* FA-WWPN support state */ +#define LPFC_FAWWPN_CONFIG 0x1/* FA-PWWN is configured */ +#define LPFC_FAWWPN_FABRIC 0x2/* FA-PWWN success with Fabric */ };enum lpfc_sge_type {
Signature · 1 line
2.26.2
PATCH 23/26 lpfc: Update stat accounting for READ_STATUS mbox command
In reply to James SmartREAD_STATUS tx/rx byte count fields are now expanded to 64 bit wide counters. This patch updates logic for the READ_STATUS mbox command when displaying tx_word and rx_word statistics in sysfs.
--- drivers/scsi/lpfc/lpfc_attr.c | 35 ++++++++++++++++++++++++--------- drivers/scsi/lpfc/lpfc_hw.h | 37 ++++++++++++++++++++++++----------- 2 files changed, 52 insertions(+), 20 deletions(-)
drivers/scsi/lpfc/lpfc_attr.c +26 -9
@@ -6885,17 +6885,34 @@ lpfc_get_stats(struct Scsi_Host *shost)memset (hs,0 ,sizeof (struct fc_host_statistics )); hs->tx_frames = pmb->un.varRdStatus.xmitFrameCnt; + hs->rx_frames = pmb->un.varRdStatus.rcvFrameCnt; +/* -* The MBX_READ_STATUS returns tx_k_bytes which has to -* converted to words +* The MBX_READ_STATUS returns tx_k_bytes which has to be +* converted to words. +* +* Check if extended byte flag is set, to know when to collect upper +* bits of 64 bit wide statistics counter. */ - hs->tx_words = (uint64_t ) - ((uint64_t )pmb->un.varRdStatus.xmitByteCnt - * (uint64_t )256 ); - hs->rx_frames = pmb->un.varRdStatus.rcvFrameCnt; - hs->rx_words = (uint64_t ) - ((uint64_t )pmb->un.varRdStatus.rcvByteCnt - * (uint64_t )256 ); +if (pmb->un.varRdStatus.xkb &RD_ST_XKB ) { + hs->tx_words = (u64) + ((((u64)(pmb->un.varRdStatus.xmit_xkb & +RD_ST_XMIT_XKB_MASK ) <<32 ) | + (u64 )pmb->un.varRdStatus.xmitByteCnt) * + (u64 )256 ); + hs->rx_words = (u64) + ((((u64)(pmb->un.varRdStatus.rcv_xkb & +RD_ST_RCV_XKB_MASK ) <<32 ) | + (u64 )pmb->un.varRdStatus.rcvByteCnt) * + (u64 )256 ); + }else { + hs->tx_words = (uint64_t ) + ((uint64_t )pmb->un.varRdStatus.xmitByteCnt + * (uint64_t )256 ); + hs->rx_words = (uint64_t ) + ((uint64_t )pmb->un.varRdStatus.rcvByteCnt + * (uint64_t )256 ); + }memset (pmboxq,0 ,sizeof (LPFC_MBOXQ_t)); pmb->mbxCommand =MBX_READ_LNK_STAT ;
drivers/scsi/lpfc/lpfc_hw.h +26 -11
@@ -2648,19 +2648,26 @@ typedef struct { }READ_SPARM_VAR ;/* Structure for MB Command READ_STATUS (14) */ +enum read_status_word1 { +RD_ST_CC =0x01 , +RD_ST_XKB =0x80 , +}; + +enum read_status_word17 { +RD_ST_XMIT_XKB_MASK =0x3fffff , +}; + +enum read_status_word18 { +RD_ST_RCV_XKB_MASK =0x3fffff , +}; typedef struct { -#ifdef __BIG_ENDIAN_BITFIELD - uint32_t rsvd1:31; - uint32_t clrCounters:1; - uint16_t activeXriCnt; - uint16_t activeRpiCnt; -#else /* __LITTLE_ENDIAN_BITFIELD */ - uint32_t clrCounters:1; - uint32_t rsvd1:31; - uint16_t activeRpiCnt; - uint16_t activeXriCnt; -#endif + u8 clear_counters; /* rsvd 7:1, cc 0 */ + u8 rsvd5; + u8 rsvd6; + u8 xkb; /* xkb 7, rsvd 6:0 */ + + u32 rsvd8; uint32_t xmitByteCnt; uint32_t rcvByteCnt;
@@ -2672,6 +2679,14 @@ typedef struct {uint32_t totalRespExchanges;uint32_t rcvPbsyCnt;uint32_t rcvFbsyCnt; + +u32 drop_frame_no_rq; +u32 empty_rq; +u32 drop_frame_no_xri; +u32 empty_xri; + +u32 xmit_xkb;/* rsvd 31:22, xmit_xkb 21:0 */ +u32 rcv_xkb;/* rsvd 31:22, rcv_xkb 21:0 */ }READ_STATUS_VAR ;/* Structure for MB Command READ_RPI (15) */
Signature · 1 line
2.26.2
PATCH 24/26 lpfc: Expand setting ELS_ID field in ELS_REQUEST64_WQE
In reply to James SmartELS_ID field for ELS_REQUEST64_WQE is not filled out when FIP is not supported by the HBA.
Move setting ELS_ID logic into __lpfc_sli_prep_els_req_rsp_s4, and remove ELS_ID FIP dependency logic from lpfc_sli_prep_wqe.
Introduce PLOGI ELS_ID and as a result update wqe_els_id_MASK because PLOGI ELS_ID = 0x4 occupies up to 3 bits.
While in __lpfc_sli_prep_els_req_rsp_s4 routine, remove SLI3-isms.
--- drivers/scsi/lpfc/lpfc_hw4.h | 14 ++++++++----- drivers/scsi/lpfc/lpfc_sli.c | 38 ++++++++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 15 deletions(-)
drivers/scsi/lpfc/lpfc_hw4.h +9 -5
@@ -4476,12 +4476,8 @@ struct wqe_common {#define wqe_cmd_type_MASK 0x0000000f#define wqe_cmd_type_WORD word11#define wqe_els_id_SHIFT 4 -#define wqe_els_id_MASK 0x00000003 +#define wqe_els_id_MASK 0x00000007#define wqe_els_id_WORD word11 -#define LPFC_ELS_ID_FLOGI 3 -#define LPFC_ELS_ID_FDISC 2 -#define LPFC_ELS_ID_LOGO 1 -#define LPFC_ELS_ID_DEFAULT 0#define wqe_irsp_SHIFT 4#define wqe_irsp_MASK 0x00000001#define wqe_irsp_WORD word11
@@ -4528,6 +4524,14 @@ struct lpfc_wqe_generic{uint32_t payload[4 ]; }; +enum els_request64_wqe_word11 { +LPFC_ELS_ID_DEFAULT , +LPFC_ELS_ID_LOGO , +LPFC_ELS_ID_FDISC , +LPFC_ELS_ID_FLOGI , +LPFC_ELS_ID_PLOGI , +}; +struct els_request64_wqe {struct ulp_bde64 bde;uint32_t payload_len;
drivers/scsi/lpfc/lpfc_sli.c +28 -10
@@ -10583,6 +10583,7 @@ __lpfc_sli_prep_els_req_rsp_s4(struct lpfc_iocbq *cmdiocbq,struct lpfc_hba *phba = vport->phba;union lpfc_wqe128 *wqe;struct ulp_bde64_le *bde; +u8 els_id; wqe = &cmdiocbq->wqe;memset (wqe,0 ,sizeof (*wqe));
@@ -10595,7 +10596,7 @@ __lpfc_sli_prep_els_req_rsp_s4(struct lpfc_iocbq *cmdiocbq, bde->type_size |=cpu_to_le32 (ULP_BDE64_TYPE_BDE_64 );if (expect_rsp) { -bf_set (wqe_cmnd, &wqe->els_req.wqe_com,CMD_ELS_REQUEST64_CR ); +bf_set (wqe_cmnd, &wqe->els_req.wqe_com,CMD_ELS_REQUEST64_WQE );/* Transfer length */ wqe->els_req.payload_len = cmd_size;
@@ -10603,6 +10604,30 @@ __lpfc_sli_prep_els_req_rsp_s4(struct lpfc_iocbq *cmdiocbq,/* DID */ bf_set (wqe_els_did, &wqe->els_req.wqe_dest, did); + +/* Word 11 - ELS_ID */ +switch (elscmd) { +case ELS_CMD_PLOGI : + els_id =LPFC_ELS_ID_PLOGI ; +break ; +case ELS_CMD_FLOGI : + els_id =LPFC_ELS_ID_FLOGI ; +break ; +case ELS_CMD_LOGO : + els_id =LPFC_ELS_ID_LOGO ; +break ; +case ELS_CMD_FDISC : +if (!vport->fc_myDID) { + els_id =LPFC_ELS_ID_FDISC ; +break ; + } + fallthrough; +default : + els_id =LPFC_ELS_ID_DEFAULT ; +break ; + } + +bf_set (wqe_els_id, &wqe->els_req.wqe_com, els_id); }else {/* DID */ bf_set (wqe_els_did, &wqe->xmit_els_rsp.wqe_dest, did);
@@ -10611,7 +10636,7 @@ __lpfc_sli_prep_els_req_rsp_s4(struct lpfc_iocbq *cmdiocbq, wqe->xmit_els_rsp.response_payload_len = cmd_size;bf_set (wqe_cmnd, &wqe->xmit_els_rsp.wqe_com, -CMD_XMIT_ELS_RSP64_CX ); +CMD_XMIT_ELS_RSP64_WQE ); }bf_set (wqe_tmo, &wqe->generic.wqe_com, tmo);
@@ -10627,7 +10652,7 @@ __lpfc_sli_prep_els_req_rsp_s4(struct lpfc_iocbq *cmdiocbq,if (expect_rsp) {bf_set (els_req64_sid, &wqe->els_req, vport->fc_myDID); -/* For ELS_REQUEST64_CR, use the VPI by default */ +/* For ELS_REQUEST64_WQE, use the VPI by default */ bf_set (wqe_ctxt_tag, &wqe->els_req.wqe_com, phba->vpi_ids[vport->vpi]); }
@@ -22215,7 +22240,6 @@ lpfc_sli_prep_wqe(struct lpfc_hba *phba, struct lpfc_iocbq *job)u32 fip, abort_tag;struct lpfc_nodelist *ndlp =NULL ;union lpfc_wqe128 *wqe = &job->wqe; -u32 els_id =LPFC_ELS_ID_DEFAULT ;u8 command_type =ELS_COMMAND_NON_FIP ; fip = phba->hba_flag &HBA_FIP_SUPPORT ;
@@ -22234,11 +22258,6 @@ lpfc_sli_prep_wqe(struct lpfc_hba *phba, struct lpfc_iocbq *job)case CMD_ELS_REQUEST64_WQE : ndlp = job->ndlp; -/* CCP CCPE PV PRI in word10 were set in the memcpy */ -if (command_type ==ELS_COMMAND_FIP ) - els_id = ((job->cmd_flag &LPFC_FIP_ELS_ID_MASK ) - >>LPFC_FIP_ELS_ID_SHIFT ); - if_type =bf_get (lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf);if (if_type >=LPFC_SLI_INTF_IF_TYPE_2 ) {
@@ -22275,7 +22294,6 @@ lpfc_sli_prep_wqe(struct lpfc_hba *phba, struct lpfc_iocbq *job)bf_set (wqe_temp_rpi, &wqe->els_req.wqe_com, phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]); -bf_set (wqe_els_id, &wqe->els_req.wqe_com, els_id);bf_set (wqe_dbde, &wqe->els_req.wqe_com,1 );bf_set (wqe_iod, &wqe->els_req.wqe_com,LPFC_WQE_IOD_READ );bf_set (wqe_qosd, &wqe->els_req.wqe_com,1 );
Signature · 1 line
2.26.2
PATCH 25/26 lpfc: Update lpfc version to 14.2.0.2
In reply to James SmartUpdate lpfc version to 14.2.0.2
--- 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.2.0.1" +#define LPFC_DRIVER_VERSION "14.2.0.2"#define LPFC_DRIVER_NAME "lpfc"/* Used for SLI 2/3 */
Signature · 1 line
2.26.2
PATCH 26/26 lpfc: Copyright updates for 14.2.0.2 patches
In reply to James SmartUpdate copyrights to 2022 for files modified in the 14.2.0.2 patch set.
--- drivers/scsi/lpfc/lpfc_attr.c | 2 +- drivers/scsi/lpfc/lpfc_logmsg.h | 2 +- drivers/scsi/lpfc/lpfc_mbox.c | 2 +- drivers/scsi/lpfc/lpfc_vport.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/lpfc/lpfc_attr.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-2021 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2022 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_logmsg.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-2021 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2022 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * * Copyright (C) 2004-2009 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex. *
drivers/scsi/lpfc/lpfc_mbox.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-2021 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2022 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-2021 Broadcom. All Rights Reserved. The term * +* Copyright (C) 2017-2022 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 5 lines
Update lpfc to revision 14.2.0.2
This patch set a bunch of small fixes, several discovery fixes, a few logging enhancements, and a rework patch to get rid of overloaded structure fields.
Applied to 5.19/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 9 lines · James Smart
Update lpfc to revision 14.2.0.2
This patch set a bunch of small fixes, several discovery fixes, a few logging enhancements, and a rework patch to get rid of overloaded structure fields.
The patches were cut against Martin's 5.18/scsi-queue tree
[...]
Applied to 5.19/scsi-queue, thanks!
[01/26] lpfc: Tweak message log categories for ELS/FDMI/NVME Rescan
https://git.kernel.org/mkp/scsi/c/b83a8c21f3fe [02/26] lpfc: Move cfg_log_verbose check before calling lpfc_dmp_dbg https://git.kernel.org/mkp/scsi/c/e294647b1aed [03/26] lpfc: Fix diagnostic fw logging after a function reset https://git.kernel.org/mkp/scsi/c/a6de9a2fa0d6 [04/26] lpfc: Zero SLI4 fcp_cmnd buffer's fcpCntl0 field https://git.kernel.org/mkp/scsi/c/787d0580ca18 [05/26] lpfc: Requeue SCSI I/O to upper layer when fw reports link down https://git.kernel.org/mkp/scsi/c/b6474465e962 [06/26] lpfc: Fix SCSI I/O completion and abort handler deadlock https://git.kernel.org/mkp/scsi/c/03cbbd7c2f5e [07/26] lpfc: Clear fabric topology flag before initiating a new FLOGI https://git.kernel.org/mkp/scsi/c/3483a44bdfb4 [08/26] lpfc: Fix null pointer dereference after failing to issue FLOGI and PLOGI https://git.kernel.org/mkp/scsi/c/577a942df3de [09/26] lpfc: Protect memory leak for NPIV ports sending PLOGI_RJT https://git.kernel.org/mkp/scsi/c/672d1cb40551 [10/26] lpfc: Update fc_prli_sent outstanding only after guaranteed IOCB submit https://git.kernel.org/mkp/scsi/c/31e887864eb2 [11/26] lpfc: Transition to NPR state upon LOGO cmpl if link down or aborted https://git.kernel.org/mkp/scsi/c/76395c88d0af [12/26] lpfc: Remove unnecessary NULL pointer assignment for ELS_RDF path https://git.kernel.org/mkp/scsi/c/d531d9874da8 [13/26] lpfc: Move MI module parameter check to handle dynamic disable https://git.kernel.org/mkp/scsi/c/39a1a86b9da2 [14/26] lpfc: Correct CRC32 calculation for congestion stats https://git.kernel.org/mkp/scsi/c/5295d19d4f97 [15/26] lpfc: Fix call trace observed during I/O with CMF enabled https://git.kernel.org/mkp/scsi/c/d6d45f67a111 [16/26] lpfc: Revise FDMI reporting of supported port speed for trunk groups https://git.kernel.org/mkp/scsi/c/c364c453d30a [17/26] lpfc: Remove false FDMI NVME FC-4 support for NPIV ports https://git.kernel.org/mkp/scsi/c/6c8a3ce64b2c [18/26] lpfc: Register for Application Services FC-4 type in Fabric topology https://git.kernel.org/mkp/scsi/c/6c983d327b9e [19/26] lpfc: Introduce FC_RSCN_MEMENTO flag for tracking post RSCN completion https://git.kernel.org/mkp/scsi/c/1045592fc968 [20/26] lpfc: Fix field overload in lpfc_iocbq data structure https://git.kernel.org/mkp/scsi/c/d51cf5bd926c [21/26] lpfc: Refactor cleanup of mailbox commands https://git.kernel.org/mkp/scsi/c/ef47575fd982 [22/26] lpfc: Change FA-PWWN detection methodology https://git.kernel.org/mkp/scsi/c/1b6f71f7fcb6 [23/26] lpfc: Update stat accounting for READ_STATUS mbox command https://git.kernel.org/mkp/scsi/c/f4fbf4acaa50 [24/26] lpfc: Expand setting ELS_ID field in ELS_REQUEST64_WQE https://git.kernel.org/mkp/scsi/c/fd4a0c6da5c1 [25/26] lpfc: Update lpfc version to 14.2.0.2 https://git.kernel.org/mkp/scsi/c/4af4d0e2ea94 [26/26] lpfc: Copyright updates for 14.2.0.2 patches https://git.kernel.org/mkp/scsi/c/66c20a97367a
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering