lpfc: Update lpfc to revision 14.2.0.3
Subsystems (2)
cover lpfc: Update lpfc to revision 14.2.0.3
Update lpfc to revision 14.2.0.3
This patch set contains fixes in several different areas including ref counting areas, oops, I/O length failures, etc.
The patches were cut against Martin's 5.19/scsi-queue tree
James Smart (12):
lpfc: Fix element offset in __lpfc_sli_release_iocbq_s4()
lpfc: Fill in missing ndlp kref puts in error paths
lpfc: Fix ndlp put following a LOGO completion
lpfc: Inhibit aborts if external loopback plug is inserted
lpfc: Fix dmabuf ptr assignment in lpfc_ct_reject_event
lpfc: Use list_for_each_entry_safe on fc_nodes list in
rscn_recovery_check
lpfc: Decrement outstanding gidft_inp counter if lpfc_err_lost_link
lpfc: Change VMID registration to be based on fabric parameters
lpfc: Rework FDMI initialization after link up
lpfc: Alter FPIN stat accounting logic
lpfc: Use sg_dma_address and sg_dma_len macros for NVMe I/O
lpfc: Update lpfc version to 14.2.0.3
drivers/scsi/lpfc/lpfc.h | 4 + drivers/scsi/lpfc/lpfc_crtn.h | 1 + drivers/scsi/lpfc/lpfc_ct.c | 114 ++++++++++++++++++++++++++--- drivers/scsi/lpfc/lpfc_els.c | 79 +++++++++----------- drivers/scsi/lpfc/lpfc_hbadisc.c | 21 ++++-- drivers/scsi/lpfc/lpfc_init.c | 65 ++++++++-------- drivers/scsi/lpfc/lpfc_nportdisc.c | 15 +++- drivers/scsi/lpfc/lpfc_nvme.c | 9 ++- drivers/scsi/lpfc/lpfc_scsi.c | 17 +++-- drivers/scsi/lpfc/lpfc_sli.c | 35 ++++----- drivers/scsi/lpfc/lpfc_version.h | 2 +- 11 files changed, 242 insertions(+), 120 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/12 lpfc: Fix element offset in __lpfc_sli_release_iocbq_s4()
The prior patch that moved from iocb elements to explicit wqe elements missed a name change.
Correct __lpfc_sli_release_iocbq_s4() to reference wqe rather than iocb
--- drivers/scsi/lpfc/lpfc_sli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_sli.c +1 -1
@@ -1373,7 +1373,7 @@ static void __lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) { struct lpfc_sglq *sglq; -size_t start_clean = offsetof(struct lpfc_iocbq , iocb); +size_t start_clean = offsetof(struct lpfc_iocbq , wqe);unsigned long iflag =0 ;struct lpfc_sli_ring *pring;
Signature · 1 line
2.26.2
PATCH 2/12 lpfc: Fill in missing ndlp kref puts in error paths
In reply to James SmartCode review, following every lpfc_nlp_get call vs calls during error handling, discovered cases of missing put calls.
Correct by adding ndlp kref puts in the respective error paths.
Also added comments to several of the error paths to record relationships to reference counts.
--- drivers/scsi/lpfc/lpfc_els.c | 11 +++++------ drivers/scsi/lpfc/lpfc_nportdisc.c | 15 +++++++++++++-- drivers/scsi/lpfc/lpfc_nvme.c | 5 +++++ drivers/scsi/lpfc/lpfc_sli.c | 6 +++++- 4 files changed, 28 insertions(+), 9 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +5 -6
@@ -8725,19 +8725,18 @@ lpfc_issue_els_rrq(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, elsiocb->cmd_cmpl = lpfc_cmpl_els_rrq; elsiocb->ndlp =lpfc_nlp_get (ndlp); -if (!elsiocb->ndlp) { -lpfc_els_free_iocb (phba, elsiocb); -return 1 ; - } +if (!elsiocb->ndlp) + goto io_err; ret =lpfc_sli_issue_iocb (phba,LPFC_ELS_RING , elsiocb,0 ); -if (ret ==IOCB_ERROR ) +if (ret ==IOCB_ERROR ) { +lpfc_nlp_put (ndlp); goto io_err; + }return 0 ; io_err:lpfc_els_free_iocb (phba, elsiocb); -lpfc_nlp_put (ndlp);return 1 ; }
drivers/scsi/lpfc/lpfc_nportdisc.c +13 -2
@@ -513,6 +513,10 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,lpfc_config_link (phba, link_mbox); link_mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl; link_mbox->vport = vport; + +/* The default completion handling for CONFIG_LINK +* does not require the ndlp so no reference is needed. +*/ link_mbox->ctx_ndlp = ndlp; rc =lpfc_sli_issue_mbox (phba, link_mbox,MBX_NOWAIT );
@@ -633,6 +637,9 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,*/ login_mbox->mbox_cmpl = lpfc_defer_plogi_acc; login_mbox->ctx_ndlp =lpfc_nlp_get (ndlp); +if (!login_mbox->ctx_ndlp) + goto out; + login_mbox->context3 = save_iocb;/* For PLOGI ACC */ spin_lock_irq (&ndlp->lock);
@@ -641,8 +648,10 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,/* Start the ball rolling by issuing REG_LOGIN here */ rc =lpfc_sli_issue_mbox (phba, login_mbox,MBX_NOWAIT ); -if (rc ==MBX_NOT_FINISHED ) +if (rc ==MBX_NOT_FINISHED ) { +lpfc_nlp_put (ndlp); goto out; + }lpfc_nlp_set_state (vport, ndlp,NLP_STE_REG_LOGIN_ISSUE );return 1 ;
@@ -1099,8 +1108,10 @@ lpfc_release_rpi(struct lpfc_hba *phba, struct lpfc_vport *vport, ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag); rc =lpfc_sli_issue_mbox (phba, pmb,MBX_NOWAIT ); -if (rc ==MBX_NOT_FINISHED ) +if (rc ==MBX_NOT_FINISHED ) { +lpfc_nlp_put (ndlp);mempool_free (pmb, phba->mbox_mem_pool); + } } }
drivers/scsi/lpfc/lpfc_nvme.c +5 -0
@@ -2357,6 +2357,11 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) rpinfo.dev_loss_tmo = vport->cfg_devloss_tmo;spin_lock_irq (&ndlp->lock); + +/* If an oldrport exists, so does the ndlp reference. If not +* a new reference is needed because either the node has never +* been registered or it's been unregistered and getting deleted. +*/ oldrport =lpfc_ndlp_get_nrport (ndlp);if (oldrport) { prev_ndlp = oldrport->ndlp;
drivers/scsi/lpfc/lpfc_sli.c +5 -1
@@ -20684,8 +20684,12 @@ lpfc_cleanup_pending_mbox(struct lpfc_vport *vport) mb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;if (mb->u.mb.mbxCommand ==MBX_REG_LOGIN64 ) { act_mbx_ndlp = (struct lpfc_nodelist *)mb->ctx_ndlp; -/* Put reference count for delayed processing */ + +/* This reference is local to this routine. The +* reference is removed at routine exit. +*/ act_mbx_ndlp =lpfc_nlp_get (act_mbx_ndlp); +/* Unregister the RPI when mailbox complete */ mb->mbox_flag |=LPFC_MBX_IMED_UNREG ; }
Signature · 1 line
2.26.2
PATCH 3/12 lpfc: Fix ndlp put following a LOGO completion
In reply to James SmartDuring testing with repeated asynchronous resets of the target, and issue was found when the driver issues a LOGO to disconnect it's login and recover all exchanges. The LOGO command take a node reference but neglects to remove it, keeping the node reference count artifically high.
Add a call to lpfc_nlp_put to lpfc_nlp_logo_unreg and move the mempool free call to the routine exit along with the needed put. This is always safe as this will not be the last reference removed as lpfc_unreg_rpi ensures there is an additional reference on the ndlp.
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +7 -1
@@ -5235,7 +5235,6 @@ lpfc_nlp_logo_unreg(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)if (!ndlp)return ;lpfc_issue_els_logo (vport, ndlp,0 ); -mempool_free (pmb, phba->mbox_mem_pool);/* Check to see if there are any deferred events to process */ if ((ndlp->nlp_flag & NLP_UNREG_INP) &&
@@ -5262,6 +5261,13 @@ lpfc_nlp_logo_unreg(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) ndlp->nlp_flag &= ~NLP_UNREG_INP ;spin_unlock_irq (&ndlp->lock); } + +/* The node has an outstanding reference for the unreg. Now +* that the LOGO action and cleanup are finished, release +* resources. +*/ +lpfc_nlp_put (ndlp); +mempool_free (pmb, phba->mbox_mem_pool); }/*
Signature · 1 line
2.26.2
PATCH 4/12 lpfc: Inhibit aborts if external loopback plug is inserted
In reply to James SmartAfter running a short external loopback test, when the external loopback is removed and a normal cable inserted that is directly connected to a target device, the system oops in the llpfc_set_rrq_active routine.
When the loopback was inserted an FLOGI was transmit. As we're looped back, we receive the FLOGI request. The FLOGI is ABTS'd as we recognize the same wppn thus understand it's a loopback. However, as the ABTS sends address information the port is not set to (fffffe), the ABTS is dropped on the wire. A short 1 frame loopback test is run and completes before the ABTS times out. The looback is unplugged and the new cable plugged in, and the an FLOGI to the new device occurs and completes. Due to a mixup in ref counting the completion of the new FLOGI releases the fabric ndlp. Then the original ABTS completes and references the released ndlp generating the oops.
Correct by no-op'ing the ABTS when in loopback mode (it will be dropped anyway). Added a flag to track the mode to recognize when it should be no-op'd.
--- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_els.c | 12 ++++++++++++ drivers/scsi/lpfc/lpfc_hbadisc.c | 3 +++ drivers/scsi/lpfc/lpfc_sli.c | 8 +++++--- 4 files changed, 21 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc.h +1 -0
@@ -1025,6 +1025,7 @@ struct lpfc_hba {#define LS_MDS_LINK_DOWN 0x8/* MDS Diagnostics Link Down */ #define LS_MDS_LOOPBACK 0x10/* MDS Diagnostics Link Up (Loopback) */ #define LS_CT_VEN_RPA 0x20/* Vendor RPA sent to switch */ +#define LS_EXTERNAL_LOOPBACK 0x40/* External loopback plug inserted */ uint32_t hba_flag;/* hba generic flags */ #define HBA_ERATT_HANDLED 0x1/* This flag is set when eratt handled */
drivers/scsi/lpfc/lpfc_els.c +12 -0
@@ -1373,6 +1373,9 @@ lpfc_issue_els_flogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, phba->hba_flag |= (HBA_FLOGI_ISSUED |HBA_FLOGI_OUTSTANDING ); +/* Clear external loopback plug detected flag */ + phba->link_flag &= ~LS_EXTERNAL_LOOPBACK ; +/* Check for a deferred FLOGI ACC condition */ if (phba->defer_flogi_acc_flag) {/* lookup ndlp for received FLOGI */
@@ -8128,6 +8131,9 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,uint32_t fc_flag =0 ;uint32_t port_state =0 ; +/* Clear external loopback plug detected flag */ + phba->link_flag &= ~LS_EXTERNAL_LOOPBACK ; + cmd = *lp++; sp = (struct serv_parm *) lp;
@@ -8179,6 +8185,12 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,return 1 ; } +/* External loopback plug insertion detected */ + phba->link_flag |=LS_EXTERNAL_LOOPBACK ; + +lpfc_printf_vlog (vport,KERN_INFO ,LOG_ELS |LOG_LIBDFC , +"1119 External Loopback plug detected\n" ); +/* abort the flogi coming back to ourselves * due to external loopback on the port. */
drivers/scsi/lpfc/lpfc_hbadisc.c +3 -0
@@ -1229,6 +1229,9 @@ lpfc_linkdown(struct lpfc_hba *phba) phba->defer_flogi_acc_flag = false; +/* Clear external loopback plug detected flag */ + phba->link_flag &= ~LS_EXTERNAL_LOOPBACK ; +spin_lock_irq (&phba->hbalock); phba->fcf.fcf_flag &= ~(FCF_AVAILABLE |FCF_SCAN_DONE );spin_unlock_irq (&phba->hbalock);
drivers/scsi/lpfc/lpfc_sli.c +5 -3
@@ -12201,7 +12201,8 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,if (phba->link_state <LPFC_LINK_UP || (phba->sli_rev ==LPFC_SLI_REV4 && - phba->sli4_hba.link_state.status ==LPFC_FC_LA_TYPE_LINK_DOWN )) + phba->sli4_hba.link_state.status ==LPFC_FC_LA_TYPE_LINK_DOWN ) || + (phba->link_flag &LS_EXTERNAL_LOOPBACK )) ia = true;else ia = false;
@@ -12660,7 +12661,8 @@ lpfc_sli_abort_taskmgmt(struct lpfc_vport *vport, struct lpfc_sli_ring *pring, ndlp = lpfc_cmd->rdata->pnode;if (lpfc_is_link_up (phba) && - (ndlp && ndlp->nlp_state ==NLP_STE_MAPPED_NODE )) + (ndlp && ndlp->nlp_state ==NLP_STE_MAPPED_NODE ) && + !(phba->link_flag &LS_EXTERNAL_LOOPBACK )) ia = false;else ia = true;
@@ -21112,7 +21114,7 @@ lpfc_sli4_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, abtswqe = &abtsiocb->wqe;memset (abtswqe,0 ,sizeof (*abtswqe)); -if (!lpfc_is_link_up (phba)) +if (!lpfc_is_link_up (phba) || (phba->link_flag &LS_EXTERNAL_LOOPBACK ))bf_set (abort_cmd_ia, &abtswqe->abort_cmd,1 );bf_set (abort_cmd_criteria, &abtswqe->abort_cmd,T_XRI_TAG ); abtswqe->abort_cmd.rsrvd5 =0 ;
Signature · 1 line
2.26.2
PATCH 5/12 lpfc: Fix dmabuf ptr assignment in lpfc_ct_reject_event
In reply to James SmartUpon driver receipt of a CT cmd for type = 0xFA (Management Server) and subtype = 0x11 (Fabric Device Management Interface), the driver is responding with garbage CT cmd data when it should send a properly formed RJT.
The __lpfc_prep_xmit_seq64_s4() routine was using the wrong buffer for the reject.
Fix by converting the routine to use the buffer specified in the bde within the wqe rather than the ill-set bmp element.
--- drivers/scsi/lpfc/lpfc_sli.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +3 -12
@@ -10808,24 +10808,15 @@ __lpfc_sli_prep_xmit_seq64_s4(struct lpfc_iocbq *cmdiocbq, {union lpfc_wqe128 *wqe;struct ulp_bde64 *bpl; -struct ulp_bde64_le *bde; wqe = &cmdiocbq->wqe;memset (wqe,0 ,sizeof (*wqe));/* Words 0 - 2 */ bpl = (struct ulp_bde64 *)bmp->virt; -if (cmdiocbq->cmd_flag & (LPFC_IO_LIBDFC |LPFC_IO_LOOPBACK )) { - wqe->xmit_sequence.bde.addrHigh = bpl->addrHigh; - wqe->xmit_sequence.bde.addrLow = bpl->addrLow; - wqe->xmit_sequence.bde.tus.w = bpl->tus.w; - }else { - bde = (struct ulp_bde64_le *)&wqe->xmit_sequence.bde; - bde->addr_low =cpu_to_le32 (putPaddrLow (bmp->phys)); - bde->addr_high =cpu_to_le32 (putPaddrHigh (bmp->phys)); - bde->type_size =cpu_to_le32 (bpl->tus.f.bdeSize); - bde->type_size |=cpu_to_le32 (ULP_BDE64_TYPE_BDE_64 ); - } + wqe->xmit_sequence.bde.addrHigh = bpl->addrHigh; + wqe->xmit_sequence.bde.addrLow = bpl->addrLow; + wqe->xmit_sequence.bde.tus.w = bpl->tus.w;/* Word 5 */ bf_set (wqe_ls, &wqe->xmit_sequence.wge_ctl, last_seq);
Signature · 1 line
2.26.2
PATCH 6/12 lpfc: Use list_for_each_entry_safe on fc_nodes list in rscn_recovery_check
In reply to James SmartIn GID_PT mode with lpfc_ns_query=1, a race condition between iterating the vport->fc_nodes list in lpfc_rscn_recovery_check and cleanup of an ndlp can trigger a crash while processing the RSCN of another initiator from the same zone.
During iteration of the vport->fc_nodes list, an ndlp is cleaned up and released. lpfc_dequeue_node is called from lpfc_cleanup_node leading to a bad ndlp dereference in lpfc_rscn_recovery_check.
Change list_for_each_entry to list_for_each_entry_safe in lpfc_rscn_recovery_check to protect against removal of an initiator ndlp, while walking the vport->fc_nodes list.
--- drivers/scsi/lpfc/lpfc_els.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +2 -2
@@ -7708,10 +7708,10 @@ lpfc_rscn_payload_check(struct lpfc_vport *vport, uint32_t did)static int lpfc_rscn_recovery_check (struct lpfc_vport *vport) { -struct lpfc_nodelist *ndlp =NULL ; +struct lpfc_nodelist *ndlp =NULL , *n;/* Move all affected nodes by pending RSCNs to NPR state. */ -list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) { +list_for_each_entry_safe (ndlp, n, &vport->fc_nodes, nlp_listp) {if ((ndlp->nlp_state ==NLP_STE_UNUSED_NODE ) || !lpfc_rscn_payload_check (vport, ndlp->nlp_DID))continue ;
Signature · 1 line
2.26.2
PATCH 7/12 lpfc: Decrement outstanding gidft_inp counter if lpfc_err_lost_link
In reply to James SmartDuring large NPIV port testing, it was sometimes seen that not all vports would log back in to the target device.
There are instances when the fabric is slow to respond to a spam of GID_PT requests and as a result the SLI PORT may abort the GID_PT request because the fabric takes so long. lpfc_cmpl_ct_cmd_gid_pt would enter the lpfc_err_lost_link logic and attempt to lpfc_els_flush_rscn, which is fine, but forgets to decrement the gidft_inp counter. This results in a vport->gidft_inp never reaching 0 and never restarting discovery again.
Decrement vport->gidft_inp if lpfc_err_lost_link is true for both lpfc_cmpl_ct_cmd_gid_pt and lpfc_cmpl_ct_cmd_gid_ft.
Increase logging info during RSCN timeout and lpfc_err_lost_link events.
--- drivers/scsi/lpfc/lpfc_ct.c | 16 ++++++++++++++-- drivers/scsi/lpfc/lpfc_hbadisc.c | 5 +++-- 2 files changed, 17 insertions(+), 4 deletions(-)
drivers/scsi/lpfc/lpfc_ct.c +14 -2
@@ -960,9 +960,15 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, }if (lpfc_error_lost_link (ulp_status, ulp_word4)) {lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY , -"0226 NS query failed due to link event\n" ); +"0226 NS query failed due to link event: " +"ulp_status x%x ulp_word4 x%x fc_flag x%x " +"port_state x%x gidft_inp x%x\n" , + ulp_status, ulp_word4, vport->fc_flag, + vport->port_state, vport->gidft_inp);if (vport->fc_flag &FC_RSCN_MODE )lpfc_els_flush_rscn (vport); +if (vport->gidft_inp) + vport->gidft_inp--; goto out; }
@@ -1177,9 +1183,15 @@ lpfc_cmpl_ct_cmd_gid_pt(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, }if (lpfc_error_lost_link (ulp_status, ulp_word4)) {lpfc_printf_vlog (vport,KERN_INFO ,LOG_DISCOVERY , -"4166 NS query failed due to link event\n" ); +"4166 NS query failed due to link event: " +"ulp_status x%x ulp_word4 x%x fc_flag x%x " +"port_state x%x gidft_inp x%x\n" , + ulp_status, ulp_word4, vport->fc_flag, + vport->port_state, vport->gidft_inp);if (vport->fc_flag &FC_RSCN_MODE )lpfc_els_flush_rscn (vport); +if (vport->gidft_inp) + vport->gidft_inp--; goto out; }
drivers/scsi/lpfc/lpfc_hbadisc.c +3 -2
@@ -6355,8 +6355,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)lpfc_printf_vlog (vport,KERN_ERR ,LOG_TRACE_EVENT ,"0231 RSCN timeout Data: x%x " -"x%x\n" , - vport->fc_ns_retry,LPFC_MAX_NS_RETRY ); +"x%x x%x x%x\n" , + vport->fc_ns_retry,LPFC_MAX_NS_RETRY , + vport->port_state, vport->gidft_inp);/* Cleanup any outstanding ELS commands */ lpfc_els_flush_cmd (vport);
Signature · 1 line
2.26.2
PATCH 8/12 lpfc: Change VMID registration to be based on fabric parameters
In reply to James SmartCurrently, VMID registration is configured via module parameters. This could lead to VMID compatibility issues if two ports are connected to different brands of switches, as the two brands implement VMID differently.
Make logical changes so that VMID registration is based on common service parameters from FLOGI_ACC with fabric rather than module parameters.
--- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_els.c | 3 ++- drivers/scsi/lpfc/lpfc_scsi.c | 17 +++++++++-------- drivers/scsi/lpfc/lpfc_sli.c | 4 ++-- 4 files changed, 14 insertions(+), 11 deletions(-)
drivers/scsi/lpfc/lpfc.h +1 -0
@@ -714,6 +714,7 @@ struct lpfc_vport {#define LPFC_VMID_QFPA_CMPL 0x4#define LPFC_VMID_QOS_ENABLED 0x8#define LPFC_VMID_TIMER_ENBLD 0x10 +#define LPFC_VMID_TYPE_PRIO 0x20struct fc_qfpa_res *qfpa_res;struct fc_vport *fc_vport;
drivers/scsi/lpfc/lpfc_els.c +2 -1
@@ -1105,7 +1105,8 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, sp->cmn.priority_tagging, kref_read(&ndlp->kref));if (sp->cmn.priority_tagging) - vport->vmid_flag |=LPFC_VMID_ISSUE_QFPA ; + vport->phba->pport->vmid_flag |= (LPFC_VMID_ISSUE_QFPA | +LPFC_VMID_TYPE_PRIO );if (vport->port_state ==LPFC_FLOGI ) {/*
drivers/scsi/lpfc/lpfc_scsi.c +9 -8
@@ -5344,9 +5344,9 @@ static void lpfc_vmid_update_entry(struct lpfc_vport *vport, struct scsi_cmnd {u64 *lta; -if (vport->vmid_priority_tagging) +if (vport->phba->pport->vmid_flag &LPFC_VMID_TYPE_PRIO ) tag->cs_ctl_vmid = vmp->un.cs_ctl_vmid; -else +else if (vport->phba->cfg_vmid_app_header) tag->app_id = vmp->un.app_id;if (cmd->sc_data_direction ==DMA_TO_DEVICE )
@@ -5391,11 +5391,12 @@ static int lpfc_vmid_get_appid(struct lpfc_vport *vport, char *uuid, struct scsi_cmnd * cmd, union lpfc_vmid_io_tag *tag) { struct lpfc_vmid *vmp = NULL; -int hash, len, rc, i; +int hash, len, rc = -EPERM , i;/* check if QFPA is complete */ -if (lpfc_vmid_is_type_priority_tag (vport) && !(vport->vmid_flag & -LPFC_VMID_QFPA_CMPL )) { +if (lpfc_vmid_is_type_priority_tag (vport) && + !(vport->vmid_flag &LPFC_VMID_QFPA_CMPL ) && + (vport->vmid_flag &LPFC_VMID_ISSUE_QFPA )) { vport->work_port_events |=WORKER_CHECK_VMID_ISSUE_QFPA ;return -EAGAIN ; }
@@ -5469,7 +5470,7 @@ static int lpfc_vmid_get_appid(struct lpfc_vport *vport, char *uuid, struct vport->vmid_inactivity_timeout ?1 :0 ;/* if type priority tag, get next available VMID */ -if (lpfc_vmid_is_type_priority_tag (vport)) +if (vport->phba->pport->vmid_flag &LPFC_VMID_TYPE_PRIO )lpfc_vmid_assign_cs_ctl (vport, vmp);/* allocate the per cpu variable for holding */
@@ -5488,9 +5489,9 @@ static int lpfc_vmid_get_appid(struct lpfc_vport *vport, char *uuid, structwrite_unlock (&vport->vmid_lock);/* complete transaction with switch */ -if (lpfc_vmid_is_type_priority_tag (vport)) +if (vport->phba->pport->vmid_flag &LPFC_VMID_TYPE_PRIO ) rc =lpfc_vmid_uvem (vport, vmp, true); -else +else if (vport->phba->cfg_vmid_app_header) rc =lpfc_vmid_cmd (vport,SLI_CTAS_RAPP_IDENT , vmp);if (!rc) {write_lock (&vport->vmid_lock);
drivers/scsi/lpfc/lpfc_sli.c +2 -2
@@ -10377,11 +10377,11 @@ lpfc_prep_embed_io(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd)/* add the VMID tags as per switch response */ if (unlikely (piocb->cmd_flag &LPFC_IO_VMID )) { -if (phba->pport->vmid_priority_tagging) { +if (phba->pport->vmid_flag &LPFC_VMID_TYPE_PRIO ) {bf_set (wqe_ccpe, &wqe->fcp_iwrite.wqe_com,1 );bf_set (wqe_ccp, &wqe->fcp_iwrite.wqe_com, (piocb->vmid_tag.cs_ctl_vmid)); - }else { + }else if (phba->cfg_vmid_app_header) {bf_set (wqe_appid, &wqe->fcp_iwrite.wqe_com,1 );bf_set (wqe_wqes, &wqe->fcp_iwrite.wqe_com,1 ); wqe->words[31 ] = piocb->vmid_tag.app_id;
Signature · 1 line
2.26.2
PATCH 9/12 lpfc: Rework FDMI initialization after link up
In reply to James SmartAfter a link up, it's possible for the switch to change FDMI support (e.g. FDMI1 vs FDMI2 vs SmartSAN). If the switch reverts to FDMI1, then the revert is currently not detected.
Additionally, when NPIV is configured, it's possible the physical port's RHBA is unprocessed by the switch before reciept of an NPIV port issued RPRT. This causes some switches vendors to reject the NPIV's RPRT.
Fix by reinitializing base FDMI mode on link up, and defer FDMI vport RPRT submission until after confirming physical port's RHBA is completed.
--- drivers/scsi/lpfc/lpfc.h | 2 + drivers/scsi/lpfc/lpfc_crtn.h | 1 + drivers/scsi/lpfc/lpfc_ct.c | 98 +++++++++++++++++++++++++++++--- drivers/scsi/lpfc/lpfc_hbadisc.c | 5 +- drivers/scsi/lpfc/lpfc_init.c | 43 ++++++++++---- 5 files changed, 129 insertions(+), 20 deletions(-)
drivers/scsi/lpfc/lpfc.h +2 -0
@@ -612,6 +612,7 @@ struct lpfc_vport {#define FC_CT_RSNN_NN 0x4/* RSNN_NN accepted by switch */ #define FC_CT_RSPN_ID 0x8/* RSPN_ID accepted by switch */ #define FC_CT_RFT_ID 0x10/* RFT_ID accepted by switch */ +#define FC_CT_RPRT_DEFER 0x20/* Defer issuing FDMI RPRT */ struct list_head fc_nodes;
@@ -1059,6 +1060,7 @@ struct lpfc_hba {#define HBA_HBEAT_INP 0x4000000/* mbox HBEAT is in progress */ #define HBA_HBEAT_TMO 0x8000000/* HBEAT initiated after timeout */ #define HBA_FLOGI_OUTSTANDING 0x10000000/* FLOGI is outstanding */ +#define HBA_RHBA_CMPL 0x20000000/* RHBA FDMI command is successful */ struct completion *fw_dump_cmpl;/* cmpl event tracker for fw_dump */ uint32_t fcp_ring_in_use;/* When polling test if intr-hndlr active*/
drivers/scsi/lpfc/lpfc_crtn.h +1 -0
@@ -434,6 +434,7 @@ void lpfc_nvmet_buf_free(struct lpfc_hba *phba, void *virtp, dma_addr_t dma);void lpfc_in_buf_free (struct lpfc_hba *,struct lpfc_dmabuf *);void lpfc_rq_buf_free (struct lpfc_hba *phba,struct lpfc_dmabuf *mp); +void lpfc_setup_fdmi_mask (struct lpfc_vport *vport);int lpfc_link_reset (struct lpfc_vport *vport);/* Function prototypes. */
drivers/scsi/lpfc/lpfc_ct.c +91 -7
166 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_hbadisc.c +3 -2
@@ -1359,6 +1359,7 @@ lpfc_linkup_port(struct lpfc_vport *vport) vport->fc_flag |=FC_NDISC_ACTIVE ; vport->fc_ns_retry =0 ;spin_unlock_irq (shost->host_lock); +lpfc_setup_fdmi_mask (vport);lpfc_linkup_cleanup_nodes (vport); }
@@ -1390,8 +1391,8 @@ lpfc_linkup(struct lpfc_hba *phba) phba->pport->rcv_flogi_cnt =0 ;spin_unlock_irq (shost->host_lock); -/* reinitialize initial FLOGI flag */ - phba->hba_flag &= ~(HBA_FLOGI_ISSUED ); +/* reinitialize initial HBA flag */ + phba->hba_flag &= ~(HBA_FLOGI_ISSUED |HBA_RHBA_CMPL ); phba->defer_flogi_acc_flag = false;return 0 ;
drivers/scsi/lpfc/lpfc_init.c +32 -11
59 lines not on this page · raw message
Signature · 1 line
2.26.2
PATCH 10/12 lpfc: Alter FPIN stat accounting logic
In reply to James SmartWhen configuring CMF management based on signals instead of FPINs, FPIN alarm and warning statistics are not tracked.
Change the behavior so that FPIN alarms and warnings are always tracked regardless of the configured mode.
Similar changes are made in the CMF signal stat accounting logic. Upon receipt of a signal, only track signaled alarms and warnings. FPIN stats should not be incremented upon receipt of a signal.
--- drivers/scsi/lpfc/lpfc_els.c | 49 +++++++++++------------------------ drivers/scsi/lpfc/lpfc_init.c | 22 ++-------------- 2 files changed, 17 insertions(+), 54 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +15 -34
@@ -3854,9 +3854,6 @@ lpfc_least_capable_settings(struct lpfc_hba *phba, {u32 rsp_sig_cap =0 , drv_sig_cap =0 ;u32 rsp_sig_freq_cyc =0 , rsp_sig_freq_scale =0 ; -struct lpfc_cgn_info *cp; -u32 crc; -u16 sig_freq;/* Get rsp signal and frequency capabilities. */ rsp_sig_cap =be32_to_cpu (pcgd->xmt_signal_capability);
@@ -3912,25 +3909,7 @@ lpfc_least_capable_settings(struct lpfc_hba *phba, } } -if (!phba->cgn_i) -return ; - -/* Update signal frequency in congestion info buffer */ - cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; - -/* Frequency (in ms) Signal Warning/Signal Congestion Notifications -* are received by the HBA -*/ - sig_freq = phba->cgn_sig_freq; - -if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ONLY ) - cp->cgn_warn_freq =cpu_to_le16 (sig_freq); -if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ALARM ) { - cp->cgn_alarm_freq =cpu_to_le16 (sig_freq); - cp->cgn_warn_freq =cpu_to_le16 (sig_freq); - } - crc =lpfc_cgn_calc_crc32 (cp,LPFC_CGN_INFO_SZ ,LPFC_CGN_CRC32_SEED ); - cp->cgn_info_crc =cpu_to_le32 (crc); +/* We are NOT recording signal frequency in congestion info buffer */ return ; out_no_support:
@@ -9919,11 +9898,14 @@ lpfc_els_rcv_fpin_cgn(struct lpfc_hba *phba, struct fc_tlv_desc *tlv)/* Take action here for an Alarm event */ if (phba->cmf_active_mode !=LPFC_CFG_OFF ) {if (phba->cgn_reg_fpin &LPFC_CGN_FPIN_ALARM ) { -/* Track of alarm cnt for cgn_info */ -atomic_inc (&phba->cgn_fabric_alarm_cnt);/* Track of alarm cnt for SYNC_WQE */ atomic_inc (&phba->cgn_sync_alarm_cnt); } +/* Track alarm cnt for cgn_info regardless +* of whether CMF is configured for Signals +* or FPINs. +*/ +atomic_inc (&phba->cgn_fabric_alarm_cnt); goto cleanup; }break ;
@@ -9931,11 +9913,14 @@ lpfc_els_rcv_fpin_cgn(struct lpfc_hba *phba, struct fc_tlv_desc *tlv)/* Take action here for a Warning event */ if (phba->cmf_active_mode !=LPFC_CFG_OFF ) {if (phba->cgn_reg_fpin &LPFC_CGN_FPIN_WARN ) { -/* Track of warning cnt for cgn_info */ -atomic_inc (&phba->cgn_fabric_warn_cnt);/* Track of warning cnt for SYNC_WQE */ atomic_inc (&phba->cgn_sync_warn_cnt); } +/* Track warning cnt and freq for cgn_info +* regardless of whether CMF is configured for +* Signals or FPINs. +*/ +atomic_inc (&phba->cgn_fabric_warn_cnt); cleanup:/* Save frequency in ms */ phba->cgn_fpin_frequency =
@@ -9944,14 +9929,10 @@ lpfc_els_rcv_fpin_cgn(struct lpfc_hba *phba, struct fc_tlv_desc *tlv)if (phba->cgn_i) { cp = (struct lpfc_cgn_info *) phba->cgn_i->virt; -if (phba->cgn_reg_fpin & -LPFC_CGN_FPIN_ALARM ) - cp->cgn_alarm_freq = -cpu_to_le16 (value); -if (phba->cgn_reg_fpin & -LPFC_CGN_FPIN_WARN ) - cp->cgn_warn_freq = -cpu_to_le16 (value); + cp->cgn_alarm_freq = +cpu_to_le16 (value); + cp->cgn_warn_freq = +cpu_to_le16 (value); crc = lpfc_cgn_calc_crc32 (cp, LPFC_CGN_INFO_SZ,
drivers/scsi/lpfc/lpfc_init.c +2 -20
@@ -5864,21 +5864,8 @@ lpfc_cgn_save_evt_cnt(struct lpfc_hba *phba)/* Use the frequency found in the last rcv'ed FPIN */ value = phba->cgn_fpin_frequency; -if (phba->cgn_reg_fpin &LPFC_CGN_FPIN_WARN ) - cp->cgn_warn_freq =cpu_to_le16 (value); -if (phba->cgn_reg_fpin &LPFC_CGN_FPIN_ALARM ) - cp->cgn_alarm_freq =cpu_to_le16 (value); - -/* Frequency (in ms) Signal Warning/Signal Congestion Notifications -* are received by the HBA -*/ - value = phba->cgn_sig_freq; - -if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ONLY || - phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ALARM ) - cp->cgn_warn_freq =cpu_to_le16 (value); -if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ALARM ) - cp->cgn_alarm_freq =cpu_to_le16 (value); + cp->cgn_warn_freq =cpu_to_le16 (value); + cp->cgn_alarm_freq =cpu_to_le16 (value); lvalue =lpfc_cgn_calc_crc32 (cp,LPFC_CGN_INFO_SZ ,LPFC_CGN_CRC32_SEED );
@@ -6585,9 +6572,6 @@ lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli)/* Alarm overrides warning, so check that first */ if (cgn_signal->alarm_cnt) {if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ALARM ) { -/* Keep track of alarm cnt for cgn_info */ -atomic_add (cgn_signal->alarm_cnt, - &phba->cgn_fabric_alarm_cnt);/* Keep track of alarm cnt for CMF_SYNC_WQE */ atomic_add (cgn_signal->alarm_cnt, &phba->cgn_sync_alarm_cnt);
@@ -6596,8 +6580,6 @@ lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli)/* signal action needs to be taken */ if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ONLY || phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ALARM ) { -/* Keep track of warning cnt for cgn_info */ -atomic_add (cnt, &phba->cgn_fabric_warn_cnt);/* Keep track of warning cnt for CMF_SYNC_WQE */ atomic_add (cnt, &phba->cgn_sync_warn_cnt); }
Signature · 1 line
2.26.2
PATCH 11/12 lpfc: Use sg_dma_address and sg_dma_len macros for NVMe I/O
In reply to James SmartNVME I/O problems may be seen on IOMMU enabled platforms. Adapter I/O's failing with transfer length mismatches.
The sg list processing routine for nvme I/O is accessing the sg entry directly for the length and address fields. On some iommu platforms, contigous mappings are compressed to the first sg entry with the sum of the lengths set to the sg entry dma_length field. The length fields are left for later use by the unmap call. As such, the driver didn't see the actual dma_length value, just the first entries length value. Drivers are to use the sg_dma_length and sg_dma_address macros to reference the sg entry. The macros select the proper length field (dma_length or length) to reference.
Fix the offending code to use the sg_dma_xxx macros.
--- drivers/scsi/lpfc/lpfc_nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_nvme.c +2 -2
@@ -1401,8 +1401,8 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport,if ((nseg -1 ) == i)bf_set (lpfc_sli4_sge_last, sgl,1 ); - physaddr = data_sg->dma_address; - dma_len = data_sg->length; + physaddr =sg_dma_address (data_sg); + dma_len =sg_dma_len (data_sg); sgl->addr_lo =cpu_to_le32 (putPaddrLow (physaddr)); sgl->addr_hi = cpu_to_le32(
Signature · 1 line
2.26.2
Re: [PATCH 11/12] lpfc: Use sg_dma_address and sg_dma_len macros for NVMe I/O
Quoted 16 lines · James Smart
NVME I/O problems may be seen on IOMMU enabled platforms. Adapter I/O's
failing with transfer length mismatches.The sg list processing routine for nvme I/O is accessing the sg entry directly for the length and address fields. On some iommu platforms, contigous mappings are compressed to the first sg entry with the sum of the lengths set to the sg entry
dma_lengthfield. The length fields
are left for later use by the unmap call. As such, the driver didn't see
the actualdma_lengthvalue, just the first entries length value. Drivers are to use thesg_dma_lengthandsg_dma_addressmacros to reference the sg entry. The macros select the proper length field (dma_lengthor length) to reference.
Quoted 4 lines
Fix the offending code to use the
sg_dma_xxxmacros.Signed-off-by Nigel Kirkland <[email protected]>Signed-off-by James Smart <[email protected]>
Quoted 22 lines
---
drivers/scsi/lpfc/lpfc_nvme.c | 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/scsi/lpfc/lpfc_nvme.c +0
-0@@ -1401,8 +1401,8 @@ lpfc_nvme_prep_io_dma(struct lpfc_vport *vport, if ((nseg - 1) == i) bf_set(lpfc_sli4_sge_last, sgl,1 );
- physaddr =data_sg->dma_address; - dma_len =data_sg->length; + physaddr =sg_dma_address(data_sg); + dma_len =sg_dma_len(data_sg);sgl->addr_lo= cpu_to_le32(
putPaddrLow(physaddr));
sgl->addr_hi = cpu_to_le32(
PATCH 12/12 lpfc: Update lpfc version to 14.2.0.3
In reply to James SmartUpdate lpfc version to 14.2.0.3
--- 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.2" +#define LPFC_DRIVER_VERSION "14.2.0.3"#define LPFC_DRIVER_NAME "lpfc"/* Used for SLI 2/3 */
Signature · 1 line
2.26.2
Martin K. Petersen
AppliedJames,
Quoted 1 line
Update lpfc to revision 14.2.0.3
Applied to 5.19/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 8 lines · James Smart
Update lpfc to revision 14.2.0.3
This patch set contains fixes in several different areas including ref counting areas, oops, I/O length failures, etc.
The patches were cut against Martin's 5.19/scsi-queue tree
[...]
Applied to 5.19/scsi-queue, thanks!
[01/12] lpfc: Fix element offset in __lpfc_sli_release_iocbq_s4()
https://git.kernel.org/mkp/scsi/c/84c6f99e3907 [02/12] lpfc: Fill in missing ndlp kref puts in error paths https://git.kernel.org/mkp/scsi/c/ba3d58a1df46 [03/12] lpfc: Fix ndlp put following a LOGO completion https://git.kernel.org/mkp/scsi/c/b7e952cbc63c [04/12] lpfc: Inhibit aborts if external loopback plug is inserted https://git.kernel.org/mkp/scsi/c/ead76d4c09b8 [05/12] lpfc: Fix dmabuf ptr assignment in lpfc_ct_reject_event https://git.kernel.org/mkp/scsi/c/596fc8adb171 [06/12] lpfc: Use list_for_each_entry_safe on fc_nodes list in rscn_recovery_check https://git.kernel.org/mkp/scsi/c/4a0f4aff3ce5 [07/12] lpfc: Decrement outstanding gidft_inp counter if lpfc_err_lost_link https://git.kernel.org/mkp/scsi/c/dc8a71bd414f [08/12] lpfc: Change VMID registration to be based on fabric parameters https://git.kernel.org/mkp/scsi/c/5099478e436f [09/12] lpfc: Rework FDMI initialization after link up https://git.kernel.org/mkp/scsi/c/de3ec318fee3 [10/12] lpfc: Alter FPIN stat accounting logic https://git.kernel.org/mkp/scsi/c/e6f510414502 [11/12] lpfc: Use sg_dma_address and sg_dma_len macros for NVMe I/O https://git.kernel.org/mkp/scsi/c/a14396b6d139 [12/12] lpfc: Update lpfc version to 14.2.0.3 https://git.kernel.org/mkp/scsi/c/fcb9e738667c
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering