lpfc: Update lpfc to revision 11.2.0.10
Subsystems (3)
cover lpfc: Update lpfc to revision 11.2.0.10
From: James Smart <[email protected]>
This set of patches are mainly cleanups and fixes to the large nvme post that was recently integrated. It includes a patch to break the mandate for both NVME and SCSI subystems.
James Smart (20):
scsi: lpfc: remove redundant assignment of sgel
scsi: lpfc: sanity check hrq is null before dereferencing it
scsi: lpfc: don't dereference dma_buf->iocbq before null check
scsi: lpfc: fix missing spin_unlock on sql_list_lock
lpfc: Fix crash during Hardware error recovery on SLI3 adapters
lpfc: Fix RCTL value on NVME LS request and response
lpfc: Fix NVME CMD IU byte swapped word 1 problem
lpfc: Fix IO submission if WQ is full
lpfc: Fix nvme allocation bug on failed nvme_fc_register_localport
lpfc: add NVME exchange aborts
lpfc: Fix eh_deadline setting for sli3 adapters.
lpfc: add transport eh_timed_out reference
lpfc: Rework lpfc Kconfig for NVME options
lpfc: Rename LPFC_MAX_EQ_DELAY to LPFC_MAX_EQ_DELAY_EQID_CNT
lpfc: correct double print
lpfc: remove dead sli3 nvme code
lpfc: correct rdp diag portnames
lpfc: code cleanups in NVME initiator base
lpfc: code cleanups in NVME initiator discovery
lpfc: revise version number to 11.2.0.10
drivers/scsi/Kconfig | 19 +++++-- drivers/scsi/lpfc/lpfc.h | 4 +- drivers/scsi/lpfc/lpfc_attr.c | 9 +++- drivers/scsi/lpfc/lpfc_crtn.h | 4 +- drivers/scsi/lpfc/lpfc_ct.c | 2 +- drivers/scsi/lpfc/lpfc_debugfs.c | 22 -------- drivers/scsi/lpfc/lpfc_els.c | 22 +++++--- drivers/scsi/lpfc/lpfc_hbadisc.c | 19 ++++--- drivers/scsi/lpfc/lpfc_hw4.h | 4 +- drivers/scsi/lpfc/lpfc_init.c | 80 ++++++++++++++++++++++++----- drivers/scsi/lpfc/lpfc_mem.c | 2 +- drivers/scsi/lpfc/lpfc_nvme.c | 107 ++++++++++++++++++++++++++++++--------- drivers/scsi/lpfc/lpfc_nvme.h | 1 + drivers/scsi/lpfc/lpfc_nvmet.c | 43 +++++++++++++--- drivers/scsi/lpfc/lpfc_scsi.c | 4 +- drivers/scsi/lpfc/lpfc_sli.c | 68 +++++++++++++++++++++---- drivers/scsi/lpfc/lpfc_sli4.h | 6 +++ drivers/scsi/lpfc/lpfc_version.h | 2 +- 18 files changed, 312 insertions(+), 106 deletions(-)
Signature · 1 line
2.5.0
PATCH 1/20 scsi: lpfc: remove redundant assignment of sgel
From: James Smart <[email protected]>
From: Colin Ian King <[email protected]>
In the NVMET_FCOP_RSP case, sgel is assigned but never used and hence is redundant and can be removed.
Detected by CoverityScan, CID#1411658 ("Unused value")
--- drivers/scsi/lpfc/lpfc_nvmet.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/lpfc/lpfc_nvmet.c +0 -1
@@ -1445,7 +1445,6 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba,case NVMET_FCOP_RSP :/* Words 0 - 2 */ - sgel = &rsp->sg[0 ]; physaddr = rsp->rspdma; wqe->fcp_trsp.bde.tus.f.bdeFlags =BUFF_TYPE_BDE_64 ; wqe->fcp_trsp.bde.tus.f.bdeSize = rsp->rsplen;
Signature · 1 line
2.5.0
PATCH 2/20 scsi: lpfc: sanity check hrq is null before dereferencing it
In reply to [email protected]From: James Smart <[email protected]>
From: Colin Ian King <[email protected]>
The sanity check for hrq should be moved to before the deference of hrq to ensure we don't perform a null pointer deference.
Detected by CoverityScan, CID#1411650 ("Dereference before null check")
--- drivers/scsi/lpfc/lpfc_sli.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_sli.c +5 -5
@@ -15185,17 +15185,17 @@ lpfc_mrq_create(struct lpfc_hba *phba, struct lpfc_queue **hrqp, drq = drqp[idx]; cq = cqp[idx]; -if (hrq->entry_count != drq->entry_count) { - status = -EINVAL ; - goto out; - } -/* sanity check on queue memory */ if (!hrq || !drq || !cq) { status = -ENODEV ; goto out; } +if (hrq->entry_count != drq->entry_count) { + status = -EINVAL ; + goto out; + } +if (idx ==0 ) { bf_set(lpfc_mbx_rq_create_num_pages, &rq_create->u.request,
Signature · 1 line
2.5.0
PATCH 3/20 scsi: lpfc: don't dereference dma_buf->iocbq before null check
In reply to [email protected]From: James Smart <[email protected]>
From: Colin Ian King <[email protected]>
dma_buf->iocbq is being dereferenced immediately before it is being null checked, so we have a potential null pointer dereference bug. Fix this by only dereferencing it only once we have passed a null check on the pointer.
Detected by CoverityScan, CID#1411652 ("Dereference before null check")
--- drivers/scsi/lpfc/lpfc_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_mem.c +1 -1
@@ -646,7 +646,6 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba) } dma_buf->iocbq =lpfc_sli_get_iocbq (phba); - dma_buf->iocbq->iocb_flag =LPFC_IO_NVMET ;if (!dma_buf->iocbq) {kfree (dma_buf->context); pci_pool_free(phba->lpfc_drb_pool, dma_buf->dbuf.virt,
@@ -658,6 +657,7 @@ lpfc_sli4_nvmet_alloc(struct lpfc_hba *phba) "2621 Ran out of nvmet iocb/WQEs\n");return NULL ; } + dma_buf->iocbq->iocb_flag =LPFC_IO_NVMET ; nvmewqe = dma_buf->iocbq; wqe = (union lpfc_wqe128 *)&nvmewqe->wqe;/* Initialize WQE */
Signature · 1 line
2.5.0
PATCH 4/20 scsi: lpfc: fix missing spin_unlock on sql_list_lock
In reply to [email protected]From: James Smart <[email protected]>
From: Colin Ian King <[email protected]>
In the case where sglq is null, the current code just returns without unlocking the spinlock sql_list_lock. Fix this by breaking out of the while loop and the exit path will then unlock and return NULL as was the original intention.
Detected by CoverityScan, CID#1411635 ("Missing unlock")
--- drivers/scsi/lpfc/lpfc_sli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_sli.c +1 -1
@@ -952,7 +952,7 @@ __lpfc_sli_get_els_sglq(struct lpfc_hba *phba, struct lpfc_iocbq *piocbq) start_sglq = sglq;while (!found) {if (!sglq) -return NULL ; +break ;if (ndlp && ndlp->active_rrqs_xri_bitmap &&test_bit (sglq->sli4_lxritag, ndlp->active_rrqs_xri_bitmap)) {
Signature · 1 line
2.5.0
PATCH 5/20 lpfc: Fix crash during Hardware error recovery on SLI3 adapters
In reply to [email protected]From: James Smart <[email protected]>
if REG_VPI fails, the driver was incorrectly issuing INIT_VFI (a SLI4 command) on a SLI3 adapter.
--- drivers/scsi/lpfc/lpfc_els.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +10 -4
@@ -8371,11 +8371,17 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)spin_lock_irq (shost->host_lock); vport->fc_flag |=FC_VPORT_NEEDS_REG_VPI ;spin_unlock_irq (shost->host_lock); -if (vport->port_type ==LPFC_PHYSICAL_PORT - && !(vport->fc_flag &FC_LOGO_RCVD_DID_CHNG )) -lpfc_issue_init_vfi (vport); -else +if (mb->mbxStatus ==MBX_NOT_FINISHED ) +break ; +if ((vport->port_type ==LPFC_PHYSICAL_PORT ) && + !(vport->fc_flag &FC_LOGO_RCVD_DID_CHNG )) { +if (phba->sli_rev ==LPFC_SLI_REV4 ) +lpfc_issue_init_vfi (vport); +else +lpfc_initial_flogi (vport); + }else {lpfc_initial_fdisc (vport); + }break ; } }else {
Signature · 1 line
2.5.0
PATCH 6/20 lpfc: Fix RCTL value on NVME LS request and response
In reply to [email protected]From: James Smart <[email protected]>
NVME LS requests and responses had wrong R_CTL values. Use the FC4 ELS Request and Response defines (defines badly named, they are FC4 LS's) instead of the base ELS values.
--- drivers/scsi/lpfc/lpfc_nvme.c | 2 +- drivers/scsi/lpfc/lpfc_nvmet.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_nvme.c +1 -1
@@ -316,7 +316,7 @@ lpfc_nvme_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp,bf_set (wqe_dfctl, &wqe->gen_req.wge_ctl,0 );bf_set (wqe_si, &wqe->gen_req.wge_ctl,1 );bf_set (wqe_la, &wqe->gen_req.wge_ctl,1 ); -bf_set (wqe_rctl, &wqe->gen_req.wge_ctl,FC_RCTL_DD_UNSOL_CTL ); +bf_set (wqe_rctl, &wqe->gen_req.wge_ctl,FC_RCTL_ELS4_REQ );bf_set (wqe_type, &wqe->gen_req.wge_ctl,FC_TYPE_NVME );/* Word 6 */
drivers/scsi/lpfc/lpfc_nvmet.c +1 -1
@@ -1114,7 +1114,7 @@ lpfc_nvmet_prep_ls_wqe(struct lpfc_hba *phba,bf_set (wqe_dfctl, &wqe->xmit_sequence.wge_ctl,0 );bf_set (wqe_ls, &wqe->xmit_sequence.wge_ctl,1 );bf_set (wqe_la, &wqe->xmit_sequence.wge_ctl,0 ); -bf_set (wqe_rctl, &wqe->xmit_sequence.wge_ctl,FC_RCTL_DD_SOL_CTL ); +bf_set (wqe_rctl, &wqe->xmit_sequence.wge_ctl,FC_RCTL_ELS4_REP );bf_set (wqe_type, &wqe->xmit_sequence.wge_ctl,FC_TYPE_NVME );/* Word 6 */
Signature · 1 line
2.5.0
PATCH 7/20 lpfc: Fix NVME CMD IU byte swapped word 1 problem
In reply to [email protected]From: James Smart <[email protected]>
Word 1 in NVME CMD IU appears byte swapped from value placed in WQE Should be Big Endian value in WQE word 16
--- drivers/scsi/lpfc/lpfc_nvme.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/scsi/lpfc/lpfc_nvme.c +4 -13
@@ -620,15 +620,15 @@ lpfc_nvme_adj_fcp_sgls(struct lpfc_vport *vport,* Embed the payload in the last half of the WQE * WQE words 16-30 get the NVME CMD IU payload * -* WQE Word 16 is already setup with flags -* WQE words 17-19 get payload Words 2-4 +* WQE words 16-19 get payload Words 1-4 * WQE words 20-21 get payload Words 6-7 * WQE words 22-29 get payload Words 16-23 */ - wptr = &wqe->words[17 ];/* WQE ptr */ + wptr = &wqe->words[16 ];/* WQE ptr */ dptr = (uint32_t *)nCmd->cmdaddr;/* payload ptr */ - dptr +=2 ;/* Skip Words 0-1 in payload */ + dptr++;/* Skip Word 0 in payload */ + *wptr++ = *dptr++;/* Word 1 */ *wptr++ = *dptr++;/* Word 2 */ *wptr++ = *dptr++;/* Word 3 */ *wptr++ = *dptr++;/* Word 4 */
@@ -978,9 +978,6 @@ lpfc_nvme_prep_io_cmd(struct lpfc_vport *vport,bf_set (wqe_cmd_type, &wqe->generic.wqe_com,NVME_WRITE_CMD ); -/* Word 16 */ - wqe->words[16 ] =LPFC_NVME_EMBED_WRITE ; - phba->fc4NvmeOutputRequests++; }else {/* Word 7 */
@@ -1002,9 +999,6 @@ lpfc_nvme_prep_io_cmd(struct lpfc_vport *vport,bf_set (wqe_cmd_type, &wqe->generic.wqe_com,NVME_READ_CMD ); -/* Word 16 */ - wqe->words[16 ] =LPFC_NVME_EMBED_READ ; - phba->fc4NvmeInputRequests++; } }else {
@@ -1026,9 +1020,6 @@ lpfc_nvme_prep_io_cmd(struct lpfc_vport *vport,/* Word 11 */ bf_set (wqe_cmd_type, &wqe->generic.wqe_com,NVME_READ_CMD ); -/* Word 16 */ - wqe->words[16 ] =LPFC_NVME_EMBED_CMD ; - phba->fc4NvmeControlRequests++; }/*
Signature · 1 line
2.5.0
PATCH 8/20 lpfc: Fix IO submission if WQ is full
In reply to [email protected]From: James Smart <[email protected]>
For both initiator and target: if WQ is full, return -EBUSY.
--- drivers/scsi/lpfc/lpfc_nvme.c | 2 +- drivers/scsi/lpfc/lpfc_nvmet.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_nvme.c +1 -1
@@ -1310,7 +1310,7 @@ lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport,"sid: x%x did: x%x oxid: x%x\n" , ret, vport->fc_myDID, ndlp->nlp_DID, lpfc_ncmd->cur_iocbq.sli4_xritag); - ret = -EINVAL ; + ret = -EBUSY ; goto out_free_nvme_buf; }
drivers/scsi/lpfc/lpfc_nvmet.c +4 -1
@@ -571,6 +571,7 @@ lpfc_nvmet_xmt_fcp_op(struct nvmet_fc_target_port *tgtport,lpfc_printf_log (phba,KERN_ERR ,LOG_NVME_IOERR ,"6102 Bad state IO x%x aborted\n" , ctxp->oxid); + rc = -ENXIO ; goto aerr; }
@@ -580,6 +581,7 @@ lpfc_nvmet_xmt_fcp_op(struct nvmet_fc_target_port *tgtport,lpfc_printf_log (phba,KERN_ERR ,LOG_NVME_IOERR ,"6152 FCP Drop IO x%x: Prep\n" , ctxp->oxid); + rc = -ENXIO ; goto aerr; }
@@ -618,8 +620,9 @@ lpfc_nvmet_xmt_fcp_op(struct nvmet_fc_target_port *tgtport, ctxp->wqeq->hba_wqidx =0 ; nvmewqeq->context2 =NULL ; nvmewqeq->context3 =NULL ; + rc = -EBUSY ; aerr: -return -ENXIO ; +return rc; } static void
Signature · 1 line
2.5.0
PATCH 9/20 lpfc: Fix nvme allocation bug on failed nvme_fc_register_localport
In reply to [email protected]From: James Smart <[email protected]>
nvme bufs get allocated even when the registration fails. Move allocation into the rsgistration success path.
--- drivers/scsi/lpfc/lpfc_nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_nvme.c +2 -2
@@ -2164,10 +2164,10 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport) lport->vport = vport;INIT_LIST_HEAD (&lport->rport_list); vport->nvmei_support =1 ; + len =lpfc_new_nvme_buf (vport, phba->sli4_hba.nvme_xri_max); + vport->phba->total_nvme_bufs += len; } - len =lpfc_new_nvme_buf (vport, phba->sli4_hba.nvme_xri_max); - vport->phba->total_nvme_bufs += len;return ret; }
Signature · 1 line
2.5.0
PATCH 10/20 lpfc: add NVME exchange aborts
In reply to [email protected]From: James Smart <[email protected]>
previous code did little more than log a message.
This patch adds abort path support, modeled after the SCSI code paths. Currently addresses only the initiator path. Target path under development, but stubbed out.
--- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_hbadisc.c | 2 ++ drivers/scsi/lpfc/lpfc_init.c | 7 +++++ drivers/scsi/lpfc/lpfc_nvme.c | 64 ++++++++++++++++++++++++++++++++++++---- drivers/scsi/lpfc/lpfc_nvme.h | 1 + drivers/scsi/lpfc/lpfc_nvmet.c | 21 +++++++++++-- drivers/scsi/lpfc/lpfc_sli.c | 51 ++++++++++++++++++++++++++++++-- drivers/scsi/lpfc/lpfc_sli4.h | 6 ++++ 8 files changed, 143 insertions(+), 10 deletions(-)
drivers/scsi/lpfc/lpfc.h +1 -0
@@ -692,6 +692,7 @@ struct lpfc_hba {* capability */ #define HBA_NVME_IOQ_FLUSH 0x80000/* NVME IO queues flushed. */ +#define NVME_XRI_ABORT_EVENT 0x100000uint32_t fcp_ring_in_use;/* When polling test if intr-hndlr active*/ struct lpfc_dmabuf slim2p;
drivers/scsi/lpfc/lpfc_hbadisc.c +2 -0
@@ -641,6 +641,8 @@ lpfc_work_done(struct lpfc_hba *phba)lpfc_handle_rrq_active (phba);if (phba->hba_flag &FCP_XRI_ABORT_EVENT )lpfc_sli4_fcp_xri_abort_event_proc (phba); +if (phba->hba_flag &NVME_XRI_ABORT_EVENT ) +lpfc_sli4_nvme_xri_abort_event_proc (phba);if (phba->hba_flag &ELS_XRI_ABORT_EVENT )lpfc_sli4_els_xri_abort_event_proc (phba);if (phba->hba_flag &ASYNC_EVENT )
drivers/scsi/lpfc/lpfc_init.c +7 -0
@@ -5736,6 +5736,8 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)/* Initialize the Abort nvme buffer list used by driver */ spin_lock_init (&phba->sli4_hba.abts_nvme_buf_list_lock);INIT_LIST_HEAD (&phba->sli4_hba.lpfc_abts_nvme_buf_list); +/* Fast-path XRI aborted CQ Event work queue list */ +INIT_LIST_HEAD (&phba->sli4_hba.sp_nvme_xri_aborted_work_queue); }/* This abort list used by worker thread */
@@ -8973,6 +8975,11 @@ lpfc_sli4_cq_event_release_all(struct lpfc_hba *phba)/* Pending ELS XRI abort events */ list_splice_init (&phba->sli4_hba.sp_els_xri_aborted_work_queue, &cqelist); +if (phba->cfg_enable_fc4_type &LPFC_ENABLE_NVME ) { +/* Pending NVME XRI abort events */ +list_splice_init (&phba->sli4_hba.sp_nvme_xri_aborted_work_queue, + &cqelist); + }/* Pending asynnc events */ list_splice_init (&phba->sli4_hba.sp_asynce_work_queue, &cqelist);
drivers/scsi/lpfc/lpfc_nvme.c +59 -5
95 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_nvme.h +1 -0
@@ -57,6 +57,7 @@ struct lpfc_nvme_buf {struct list_head list;struct nvmefc_fcp_req *nvmeCmd;struct lpfc_nvme_rport *nrport; +struct lpfc_nodelist *ndlp;uint32_t timeout;
drivers/scsi/lpfc/lpfc_nvmet.c +18 -3
@@ -734,6 +734,21 @@ lpfc_nvmet_update_targetport(struct lpfc_hba *phba)return 0 ; } +/** +* lpfc_sli4_nvmet_xri_aborted - Fast-path process of nvmet xri abort +* @phba: pointer to lpfc hba data structure. +* @axri: pointer to the nvmet xri abort wcqe structure. +* +* This routine is invoked by the worker thread to process a SLI4 fast-path +* NVMET aborted xri. +**/ +void +lpfc_sli4_nvmet_xri_aborted (struct lpfc_hba *phba, +struct sli4_wcqe_xri_aborted *axri) +{ +/* TODO: work in progress */ +} +void lpfc_nvmet_destroy_targetport (struct lpfc_hba *phba) {
@@ -958,7 +973,7 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba,atomic_inc (&tgtp->rcv_fcp_cmd_drop);lpfc_printf_log (phba,KERN_ERR ,LOG_NVME_IOERR , -"6159 FCP Drop IO x%x: nvmet_fc_rcv_fcp_req x%x\n" , +"6159 FCP Drop IO x%x: err x%x\n" , ctxp->oxid, rc); dropit: lpfc_nvmeio_data(phba, "NVMET FCP DROP: xri x%x sz %d from %06x\n",
@@ -1683,8 +1698,8 @@ lpfc_nvmet_unsol_issue_abort(struct lpfc_hba *phba,struct lpfc_nodelist *ndlp;lpfc_printf_log (phba,KERN_INFO ,LOG_NVME_ABTS , -"6067 %s: Entrypoint: sid %x xri %x\n" , __func__, - sid, xri); +"6067 Abort: sid %x xri x%x/x%x\n" , + sid, xri, ctxp->wqeq->sli4_xritag); tgtp = (struct lpfc_nvmet_tgtport *)phba->targetport->private;
drivers/scsi/lpfc/lpfc_sli.c +49 -2
65 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_sli4.h +6 -0
@@ -642,6 +642,7 @@ struct lpfc_sli4_hba {struct list_head sp_asynce_work_queue;struct list_head sp_fcp_xri_aborted_work_queue;struct list_head sp_els_xri_aborted_work_queue; +struct list_head sp_nvme_xri_aborted_work_queue;struct list_head sp_unsol_work_queue;struct lpfc_sli4_link link_state;struct lpfc_sli4_lnk_info lnk_info;
@@ -794,9 +795,14 @@ void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba *);int lpfc_sli4_resume_rpi (struct lpfc_nodelist *,void (*)(struct lpfc_hba *,LPFC_MBOXQ_t *),void *);void lpfc_sli4_fcp_xri_abort_event_proc (struct lpfc_hba *); +void lpfc_sli4_nvme_xri_abort_event_proc (struct lpfc_hba *phba);void lpfc_sli4_els_xri_abort_event_proc (struct lpfc_hba *);void lpfc_sli4_fcp_xri_aborted (struct lpfc_hba *,struct sli4_wcqe_xri_aborted *); +void lpfc_sli4_nvme_xri_aborted (struct lpfc_hba *phba, +struct sli4_wcqe_xri_aborted *axri); +void lpfc_sli4_nvmet_xri_aborted (struct lpfc_hba *phba, +struct sli4_wcqe_xri_aborted *axri);void lpfc_sli4_els_xri_aborted (struct lpfc_hba *,struct sli4_wcqe_xri_aborted *);void lpfc_sli4_vport_delete_els_xri_aborted (struct lpfc_vport *);
Signature · 1 line
2.5.0
PATCH 11/20 lpfc: Fix eh_deadline setting for sli3 adapters.
In reply to [email protected]From: James Smart <[email protected]>
A previous change unilaterally removed the hba reset entry point from the sli3 host template. This was done to allow tape devices being used for back up from being removed. Why was this done ? When there was non-responding device on the fabric, the error escalation policy would escalate to the reset handler. When the reset handler was called, it would reset the adapter, dropping link, thus logging out and terminating all i/o's - on any target. If there was a tape device on the same adapter that wasn't in error, it would kill the tape i/o's, effectively killing the tape device state. With the reset point removed, the adapter reset avoided the fabric logout, allowing the other devices to continue to operate unaffected. A hack - yes. Hint: we really need a transport I_T nexus reset callback added to the eh process (in between the SCSI target reset and hba reset points), so a fc logout could occur to the one bad target only and stop the error escalation process.
This patch commonizes the approach so it can be used for sli3 and sli4 adapters, but mandates the admin, via module parameter, specifically identify which adapters the resets are to be removed for. Additionally, bus_reset, which sends Target Reset TMFs to all targets, is also removed from the template as it too has the same effect as the adapter reset.
--- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_attr.c | 6 +++++ drivers/scsi/lpfc/lpfc_crtn.h | 4 ++- drivers/scsi/lpfc/lpfc_init.c | 61 ++++++++++++++++++++++++++++++++++++++++--- drivers/scsi/lpfc/lpfc_scsi.c | 3 +-- 5 files changed, 69 insertions(+), 6 deletions(-)
drivers/scsi/lpfc/lpfc.h +1 -0
@@ -99,6 +99,7 @@ struct lpfc_sli2_slim;#define FC_MAX_ADPTMSG 64#define MAX_HBAEVT 32 +#define MAX_HBAS_NO_RESET 16/* Number of MSI-X vectors the driver uses */ #define LPFC_MSIX_VECTORS 2
drivers/scsi/lpfc/lpfc_attr.c +6 -0
@@ -3010,6 +3010,12 @@ MODULE_PARM_DESC(lpfc_poll, "FCP ring polling mode control:" static DEVICE_ATTR(lpfc_poll, S_IRUGO | S_IWUSR, lpfc_poll_show, lpfc_poll_store); +int lpfc_no_hba_reset_cnt; +unsigned long lpfc_no_hba_reset[MAX_HBAS_NO_RESET ] = { +0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 }; +module_param_array (lpfc_no_hba_reset, ulong, &lpfc_no_hba_reset_cnt,0444 ); +MODULE_PARM_DESC (lpfc_no_hba_reset,"WWPN of HBAs that should not be reset" ); +LPFC_ATTR (sli_mode,0 ,0 ,3 ,"SLI mode selector:" " 0 - auto (SLI-3 if supported),"
drivers/scsi/lpfc/lpfc_crtn.h +3 -1
@@ -384,7 +384,7 @@ void lpfc_free_sysfs_attr(struct lpfc_vport *);extern struct device_attribute *lpfc_hba_attrs[];extern struct device_attribute *lpfc_vport_attrs[];extern struct scsi_host_template lpfc_template; -extern struct scsi_host_template lpfc_template_s3; +extern struct scsi_host_template lpfc_template_no_hr;extern struct scsi_host_template lpfc_template_nvme;extern struct scsi_host_template lpfc_vport_template;extern struct fc_function_template lpfc_transport_functions;
@@ -554,3 +554,5 @@ void lpfc_nvme_abort_fcreq_cmpl(struct lpfc_hba *phba, struct lpfc_wcqe_complete *abts_cmpl);extern int lpfc_enable_nvmet_cnt;extern unsigned long long lpfc_enable_nvmet[]; +extern int lpfc_no_hba_reset_cnt; +extern unsigned long lpfc_no_hba_reset[];
drivers/scsi/lpfc/lpfc_init.c +58 -3
94 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_scsi.c +1 -2
@@ -5953,7 +5953,7 @@ struct scsi_host_template lpfc_template_nvme = { .track_queue_depth = 0, }; -struct scsi_host_template lpfc_template_s3 = { +struct scsi_host_template lpfc_template_no_hr = { .module =THIS_MODULE , .name =LPFC_DRIVER_NAME , .proc_name =LPFC_DRIVER_NAME ,
@@ -6015,7 +6015,6 @@ struct scsi_host_template lpfc_vport_template = { .eh_abort_handler = lpfc_abort_handler, .eh_device_reset_handler = lpfc_device_reset_handler, .eh_target_reset_handler = lpfc_target_reset_handler, - .eh_bus_reset_handler = lpfc_bus_reset_handler, .slave_alloc = lpfc_slave_alloc, .slave_configure = lpfc_slave_configure, .slave_destroy = lpfc_slave_destroy,
Signature · 1 line
2.5.0
PATCH 11/20 lpfc: Fix eh_deadline setting for sli3 adapters.
----- Original Message -----
Quoted 218 lines
From: jsmart2021 at gmail.com
To: linux-scsi at vger.kernel.org, linux-nvme at lists.infradead.org
Cc: "James Smart" <jsmart2021 at gmail.com>, "Dick Kennedy" <dick.kennedy at broadcom.com>, "James Smart" <james.smart at broadcom.com>
Sent: Saturday, March 4, 2017 12:30:31 PM
Subject: [PATCH 11/20] lpfc: Fixeh_deadlinesetting for sli3 adapters.From: James Smart <jsmart2021 at gmail.com>
A previous change unilaterally removed the hba reset entry point from the sli3 host template. This was done to allow tape devices being used for back up from being removed. Why was this done ? When there was non-responding device on the fabric, the error escalation policy would escalate to the reset handler. When the reset handler was called, it would reset the adapter, dropping link, thus logging out and terminating all i/o's - on any target. If there was a tape device on the same adapter that wasn't in error, it would kill the tape i/o's, effectively killing the tape device state. With the reset point removed, the adapter reset avoided the fabric logout, allowing the other devices to continue to operate unaffected. A hack - yes. Hint: we really need a transport
I_Tnexus reset callback added to the eh process (in between the SCSI target reset and hba reset points), so a fc logout could occur to the one bad target only and stop the error escalation process.This patch commonizes the approach so it can be used for sli3 and sli4 adapters, but mandates the admin, via module parameter, specifically identify which adapters the resets are to be removed for. Additionally,
bus_reset, which sends Target Reset TMFs to all targets, is also removed from the template as it too has the same effect as the adapter reset.Signed-off-by Dick Kennedy <dick.kennedy at broadcom.com>Signed-off-by James Smart <james.smart at broadcom.com>--- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_attr.c | 6 +++++ drivers/scsi/lpfc/lpfc_crtn.h | 4 ++- drivers/scsi/lpfc/lpfc_init.c | 61 ++++++++++++++++++++++++++++++++++++++++--- drivers/scsi/lpfc/lpfc_scsi.c | 3 +-- 5 files changed, 69 insertions(+), 6 deletions(-)drivers/scsi/lpfc/lpfc.h +1
-0@@ -99,6 +99,7 @@ struct lpfc_sli2_slim;#define FC_MAX_ADPTMSG 64#define MAX_HBAEVT 32 +#define MAX_HBAS_NO_RESET 16/* Number of MSI-X vectors the driver uses */ #define LPFC_MSIX_VECTORS 2drivers/scsi/lpfc/lpfc_attr.c +0
-0@@ -3010,6 +3010,12 @@ MODULE_PARM_DESC(lpfc_poll, "FCP ring polling modecontrol:"
static DEVICE_ATTR(lpfc_poll,S_IRUGO|S_IWUSR,drivers/scsi/lpfc/lpfc_attr.c +5
-0lpfc_poll_show, lpfc_poll_store); +int lpfc_no_hba_reset_cnt; +unsigned long lpfc_no_hba_reset[MAX_HBAS_NO_RESET ] = { +0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 }; +module_param_array (lpfc_no_hba_reset, ulong, &lpfc_no_hba_reset_cnt,0444 ); +MODULE_PARM_DESC(lpfc_no_hba_reset, "WWPN of HBAs that should not bereset");
drivers/scsi/lpfc/lpfc_attr.c +1
-0+LPFC_ATTR (sli_mode,0 ,0 ,3 ,"SLI mode selector:" " 0 - auto (SLI-3 if supported),"drivers/scsi/lpfc/lpfc_crtn.h +3
-1@@ -384,7 +384,7 @@ void lpfc_free_sysfs_attr(struct lpfc_vport *);extern struct device_attribute *lpfc_hba_attrs[];extern struct device_attribute *lpfc_vport_attrs[];extern struct scsi_host_template lpfc_template; -extern struct scsi_host_template lpfc_template_s3; +extern struct scsi_host_template lpfc_template_no_hr;extern struct scsi_host_template lpfc_template_nvme;extern struct scsi_host_template lpfc_vport_template;extern struct fc_function_template lpfc_transport_functions;@@ -554,3 +554,5 @@ void lpfc_nvme_abort_fcreq_cmpl(struct lpfc_hba *phba, struct lpfc_wcqe_complete *abts_cmpl);extern int lpfc_enable_nvmet_cnt;extern unsigned long long lpfc_enable_nvmet[]; +extern int lpfc_no_hba_reset_cnt; +extern unsigned long lpfc_no_hba_reset[];drivers/scsi/lpfc/lpfc_init.c +55
-2@@ -3555,6 +3555,44 @@ lpfc_sli4_scsi_sgl_update(struct lpfc_hba *phba)return rc; } +static uint64_t +lpfc_get_wwpn (struct lpfc_hba *phba) +{ +uint64_t wwn; +int rc; +LPFC_MBOXQ_t *mboxq; +MAILBOX_t *mb; + + + mboxq = (LPFC_MBOXQ_t *)mempool_alloc (phba->mbox_mem_pool, +GFP_KERNEL ); +if (!mboxq) +return (uint64_t )-1 ; + +/* First get WWN of HBA instance */ +lpfc_read_nv (phba, mboxq); + rc =lpfc_sli_issue_mbox (phba, mboxq,MBX_POLL ); +if (rc !=MBX_SUCCESS ) { +lpfc_printf_log (phba,KERN_ERR ,LOG_SLI , +"6019 Mailbox failed , mbxCmd x%x " +"READ_NV, mbxStatus x%x\n" , +bf_get (lpfc_mqe_command, &mboxq->u.mqe), +bf_get (lpfc_mqe_status, &mboxq->u.mqe)); +mempool_free (mboxq, phba->mbox_mem_pool); +return (uint64_t )-1 ; + } + mb = &mboxq->u.mb; +memcpy (&wwn, (char *)mb->un.varRDnvp.portname,sizeof (uint64_t )); +/* wwn is WWPN of HBA instance */ +mempool_free (mboxq, phba->mbox_mem_pool); +if (phba->sli_rev ==LPFC_SLI_REV4 ) +return be64_to_cpu (wwn); +else +return (((wwn &0xffffffff00000000 ) >>32 ) | + ((wwn &0x00000000ffffffff ) <<32 )); + +} +/** * lpfc_sli4_nvme_sgl_update - update xri-sgl sizing and mapping * @phba: pointer to lpfc hba data structure. @@ -3676,17 +3714,32 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)struct lpfc_vport *vport;struct Scsi_Host *shost =NULL ;int error =0 ; +int i; +uint64_t wwn; +bool use_no_reset_hba = false; + + wwn =lpfc_get_wwpn (phba); + +for (i =0 ; i < lpfc_no_hba_reset_cnt; i++) { +if (wwn == lpfc_no_hba_reset[i]) { +lpfc_printf_log (phba,KERN_ERR ,LOG_SLI , +"6020 Setting use_no_reset port=%llx\n" , + wwn); + use_no_reset_hba = true; +break ; + } + }if (phba->cfg_enable_fc4_type &LPFC_ENABLE_FCP ) {if (dev != &phba->pcidev->dev) { shost =scsi_host_alloc (&lpfc_vport_template,sizeof (struct lpfc_vport )); }else { -if (phba->sli_rev ==LPFC_SLI_REV4 ) +if (!use_no_reset_hba) shost =scsi_host_alloc (&lpfc_template,sizeof (struct lpfc_vport ));else - shost =scsi_host_alloc (&lpfc_template_s3, + shost =scsi_host_alloc (&lpfc_template_no_hr,sizeof (struct lpfc_vport )); }drivers/scsi/lpfc/lpfc_init.c +3
-1}else if (phba->cfg_enable_fc4_type &LPFC_ENABLE_NVME ) {@@ -5482,7 +5535,8 @@ lpfc_sli_driver_resource_setup(struct lpfc_hba *phba)/* Initialize the host templates the configured values. */ lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt; - lpfc_template_s3.sg_tablesize = phba->cfg_sg_seg_cnt; + lpfc_template_no_hr.sg_tablesize = phba->cfg_sg_seg_cnt; + lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt;/* There are going to be 2 reserved BDEs: 1 FCP cmnd + 1 FCP rsp */ if (phba->cfg_enable_bg) {@@ -5706,6 +5760,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)/* Initialize the host templates with the updated values. */ lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt; lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt; + lpfc_template_no_hr.sg_tablesize = phba->cfg_sg_seg_cnt;if (phba->cfg_sg_dma_buf_size <=LPFC_MIN_SG_SLI4_BUF_SZ ) phba->cfg_sg_dma_buf_size =LPFC_MIN_SG_SLI4_BUF_SZ ;drivers/scsi/lpfc/lpfc_scsi.c +1
-3@@ -5953,7 +5953,7 @@ struct scsi_host_template lpfc_template_nvme = { .track_queue_depth = 0, }; -struct scsi_host_template lpfc_template_s3 = { +struct scsi_host_template lpfc_template_no_hr = { .module =THIS_MODULE , .name =LPFC_DRIVER_NAME , .proc_name =LPFC_DRIVER_NAME ,@@ -6015,7 +6015,6 @@ struct scsi_host_template lpfc_vport_template = { .eh_abort_handler = lpfc_abort_handler, .eh_device_reset_handler = lpfc_device_reset_handler, .eh_target_reset_handler = lpfc_target_reset_handler, - .eh_bus_reset_handler = lpfc_bus_reset_handler, .slave_alloc = lpfc_slave_alloc, .slave_configure = lpfc_slave_configure, .slave_destroy = lpfc_slave_destroy, --
Quoted 3 lines
2.5.0
This patch was implemented and tested in the Red Hat lab and validated for a customer requiring eh_deadline.
PATCH 12/20 lpfc: add transport eh_timed_out reference
In reply to [email protected]From: James Smart <[email protected]>
Christoph's prior patch missed the template for the sli3 adapters, which is now the "no host reset" template. Add the transport eh_timed_out handler to the no host reset template
--- drivers/scsi/lpfc/lpfc_scsi.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/lpfc/lpfc_scsi.c +1 -0
@@ -5959,6 +5959,7 @@ struct scsi_host_template lpfc_template_no_hr = { .proc_name = LPFC_DRIVER_NAME, .info = lpfc_info, .queuecommand = lpfc_queuecommand, + .eh_timed_out = fc_eh_timed_out, .eh_abort_handler = lpfc_abort_handler, .eh_device_reset_handler = lpfc_device_reset_handler, .eh_target_reset_handler = lpfc_target_reset_handler,
Signature · 1 line
2.5.0
PATCH 13/20 lpfc: Rework lpfc Kconfig for NVME options
In reply to [email protected]From: James Smart <[email protected]>
Reworked Kconfig so that lfpc only requires the scsi stack. NVME Initiator and NVME Target support can be enabled if the other NVMe subsystems have been enabled.
--- drivers/scsi/Kconfig | 19 ++++++++++++++++--- drivers/scsi/lpfc/lpfc_nvme.c | 18 +++++++++++++++--- drivers/scsi/lpfc/lpfc_nvmet.c | 10 ++++++++++ 3 files changed, 41 insertions(+), 6 deletions(-)
drivers/scsi/Kconfig +16 -3
@@ -1241,19 +1241,32 @@ config SCSI_LPFC tristate "Emulex LightPulse Fibre Channel Support" depends on PCI && SCSI depends on SCSI_FC_ATTRS - depends on NVME_FC && NVME_TARGET_FC select CRC_T10DIF - help + ---help--- This lpfc driver supports the Emulex LightPulse Family of Fibre Channel PCI host adapters. config SCSI_LPFC_DEBUG_FS bool "Emulex LightPulse Fibre Channel debugfs Support" depends on SCSI_LPFC && DEBUG_FS - help + ---help--- This makes debugging information from the lpfc driver available via the debugfs filesystem. +config LPFC_NVME_INITIATOR + bool "Emulex LightPulse Fibre Channel NVME Initiator Support" + depends on SCSI_LPFC && NVME_FC + ---help--- + This enables NVME Initiator support in the Emulex lpfc driver. + +config LPFC_NVME_TARGET + bool "Emulex LightPulse Fibre Channel NVME Initiator Support" + depends on SCSI_LPFC && NVME_TARGET_FC + ---help--- + This enables NVME Target support in the Emulex lpfc driver. + Target enablement must still be enabled on a per adapter + basis by module parameters. + config SCSI_SIM710 tristate "Simple 53c710 SCSI support (Compaq, NCR machines)" depends on (EISA || MCA) && SCSI
drivers/scsi/lpfc/lpfc_nvme.c +15 -3
@@ -2127,11 +2127,12 @@ lpfc_release_nvme_buf(struct lpfc_hba *phba, struct lpfc_nvme_buf *lpfc_ncmd)int lpfc_nvme_create_localport (struct lpfc_vport *vport) { +int ret =0 ;struct lpfc_hba *phba = vport->phba;struct nvme_fc_port_info nfcp_info;struct nvme_fc_local_port *localport;struct lpfc_nvme_lport *lport; -int len, ret =0 ; +int len;/* Initialize this localport instance. The vport wwn usage ensures * that NPIV is accounted for.
@@ -2148,8 +2149,12 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport)/* localport is allocated from the stack, but the registration * call allocates heap memory as well as the private area. */ +#ifdef CONFIG_LPFC_NVME_INITIATOR ret =nvme_fc_register_localport (&nfcp_info, &lpfc_nvme_template, &vport->phba->pcidev->dev, &localport); +#else + ret = -ENOMEM ; +#endif if (!ret) {lpfc_printf_vlog (vport,KERN_INFO ,LOG_NVME |LOG_NVME_DISC , "6005 Successfully registered local "
@@ -2185,6 +2190,7 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport)void lpfc_nvme_destroy_localport (struct lpfc_vport *vport) { +#ifdef CONFIG_LPFC_NVME_INITIATOR struct nvme_fc_local_port *localport;struct lpfc_nvme_lport *lport;struct lpfc_nvme_rport *rport =NULL , *rport_next =NULL ;
@@ -2200,7 +2206,6 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport)lpfc_printf_vlog (vport,KERN_INFO ,LOG_NVME ,"6011 Destroying NVME localport %p\n" , localport); -list_for_each_entry_safe (rport, rport_next, &lport->rport_list, list) {/* The last node ref has to get released now before the rport * private memory area is released by the transport.
@@ -2214,6 +2219,7 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport) "6008 rport fail destroy %x\n", ret);wait_for_completion_timeout (&rport->rport_unreg_done,5 ); } +/* lport's rport list is clear. Unregister * lport and release resources. */
@@ -2237,6 +2243,7 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport)"Failed, status x%x\n" , ret); } +#endif }void
@@ -2267,6 +2274,7 @@ lpfc_nvme_update_localport(struct lpfc_vport *vport)int lpfc_nvme_register_port (struct lpfc_vport *vport,struct lpfc_nodelist *ndlp) { +#ifdef CONFIG_LPFC_NVME_INITIATOR int ret =0 ;struct nvme_fc_local_port *localport;struct lpfc_nvme_lport *lport;
@@ -2340,7 +2348,6 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) rpinfo.port_role |=FC_PORT_ROLE_NVME_INITIATOR ; rpinfo.port_name =wwn_to_u64 (ndlp->nlp_portname.u.wwn); rpinfo.node_name =wwn_to_u64 (ndlp->nlp_nodename.u.wwn); - ret =nvme_fc_register_remoteport (localport, &rpinfo, &remote_port);if (!ret) {
@@ -2376,6 +2383,9 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) ndlp->nlp_type, ndlp->nlp_DID, ndlp); }return ret; +#else +return 0 ; +#endif }/* lpfc_nvme_unregister_port - unbind the DID and port_role from this rport.
@@ -2393,6 +2403,7 @@ lpfc_nvme_register_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)void lpfc_nvme_unregister_port (struct lpfc_vport *vport,struct lpfc_nodelist *ndlp) { +#ifdef CONFIG_LPFC_NVME_INITIATOR int ret;struct nvme_fc_local_port *localport;struct lpfc_nvme_lport *lport;
@@ -2450,6 +2461,7 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)return ; input_err: +#endif lpfc_printf_vlog (vport,KERN_ERR ,LOG_NVME_DISC ,"6168: State error: lport %p, rport%p FCID x%06x\n" , vport->localport, ndlp->rport, ndlp->nlp_DID);
drivers/scsi/lpfc/lpfc_nvmet.c +10 -0
@@ -671,9 +671,13 @@ lpfc_nvmet_create_targetport(struct lpfc_hba *phba) lpfc_tgttemplate.target_features =NVMET_FCTGTFEAT_READDATA_RSP |NVMET_FCTGTFEAT_NEEDS_CMD_CPUSCHED ; +#ifdef CONFIG_LPFC_NVME_TARGET error =nvmet_fc_register_targetport (&pinfo, &lpfc_tgttemplate, &phba->pcidev->dev, &phba->targetport); +#else + error = -ENOMEM ; +#endif if (error) {lpfc_printf_log (phba,KERN_ERR ,LOG_NVME_DISC , "6025 Cannot register NVME targetport "
@@ -752,6 +756,7 @@ lpfc_sli4_nvmet_xri_aborted(struct lpfc_hba *phba,void lpfc_nvmet_destroy_targetport (struct lpfc_hba *phba) { +#ifdef CONFIG_LPFC_NVME_TARGET struct lpfc_nvmet_tgtport *tgtp;if (phba->nvmet_support ==0 )
@@ -763,6 +768,7 @@ lpfc_nvmet_destroy_targetport(struct lpfc_hba *phba) wait_for_completion_timeout(&tgtp->tport_unreg_done, 5); } phba->targetport =NULL ; +#endif }/**
@@ -782,6 +788,7 @@ static void lpfc_nvmet_unsol_ls_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, struct hbq_dmabuf *nvmebuf) { +#ifdef CONFIG_LPFC_NVME_TARGET struct lpfc_nvmet_tgtport *tgtp;struct fc_frame_header *fc_hdr;struct lpfc_nvmet_rcv_ctx *ctxp;
@@ -862,6 +869,7 @@ lpfc_nvmet_unsol_ls_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,atomic_inc (&tgtp->xmt_ls_abort);lpfc_nvmet_unsol_ls_issue_abort (phba, ctxp, sid, oxid); +#endif }/**
@@ -883,6 +891,7 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba, struct rqb_dmabuf *nvmebuf, uint64_t isr_timestamp) { +#ifdef CONFIG_LPFC_NVME_TARGET struct lpfc_nvmet_rcv_ctx *ctxp;struct lpfc_nvmet_tgtport *tgtp;struct fc_frame_header *fc_hdr;
@@ -988,6 +997,7 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba,/* We assume a rcv'ed cmd ALWAYs fits into 1 buffer */ lpfc_nvmet_rq_post(phba, NULL, &nvmebuf->hbuf); } +#endif }/**
Signature · 1 line
2.5.0
PATCH 14/20 lpfc: Rename LPFC_MAX_EQ_DELAY to LPFC_MAX_EQ_DELAY_EQID_CNT
In reply to [email protected]From: James Smart <[email protected]>
Without apriori understanding of what the define is, the name gives a very different impression of what it is (a max delay value for an EQ). Rename the define so it reflects what it is: the number of EQ IDs that can be set in one instance of the MODIFY_EQ_DELAY mbx command.
--- drivers/scsi/lpfc/lpfc_attr.c | 3 ++- drivers/scsi/lpfc/lpfc_hw4.h | 4 ++-- drivers/scsi/lpfc/lpfc_init.c | 7 ++----- drivers/scsi/lpfc/lpfc_sli.c | 5 ++++- 4 files changed, 10 insertions(+), 9 deletions(-)
drivers/scsi/lpfc/lpfc_attr.c +2 -1
@@ -4457,7 +4457,8 @@ lpfc_fcp_imax_store(struct device *dev, struct device_attribute *attr,return -EINVAL ; phba->cfg_fcp_imax = (uint32_t )val; -for (i =0 ; i < phba->io_channel_irqs; i++) + +for (i =0 ; i < phba->io_channel_irqs; i +=LPFC_MAX_EQ_DELAY_EQID_CNT )lpfc_modify_hba_eq_delay (phba, i);return strlen (buf);
drivers/scsi/lpfc/lpfc_hw4.h +2 -2
@@ -1001,7 +1001,7 @@ struct eq_delay_info {uint32_t phase;uint32_t delay_multi; }; -#define LPFC_MAX_EQ_DELAY 8 +#define LPFC_MAX_EQ_DELAY_EQID_CNT 8struct sgl_page_pairs {uint32_t sgl_pg0_addr_lo;
@@ -1070,7 +1070,7 @@ struct lpfc_mbx_modify_eq_delay {union {struct {uint32_t num_eq; -struct eq_delay_info eq[LPFC_MAX_EQ_DELAY ]; +struct eq_delay_info eq[LPFC_MAX_EQ_DELAY_EQID_CNT ]; } request;struct {uint32_t word0;
drivers/scsi/lpfc/lpfc_init.c +2 -5
@@ -8769,12 +8769,9 @@ lpfc_sli4_queue_setup(struct lpfc_hba *phba) } } -/* -* Configure EQ delay multipier for interrupt coalescing using -* MODIFY_EQ_DELAY for all EQs created, LPFC_MAX_EQ_DELAY at a time. -*/ -for (qidx =0 ; qidx < io_channel; qidx +=LPFC_MAX_EQ_DELAY ) +for (qidx =0 ; qidx < io_channel; qidx +=LPFC_MAX_EQ_DELAY_EQID_CNT )lpfc_modify_hba_eq_delay (phba, qidx); +return 0 ; out_destroy:
drivers/scsi/lpfc/lpfc_sli.c +4 -1
@@ -1,3 +1,4 @@ +/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. *
@@ -13874,6 +13875,8 @@ lpfc_dual_chute_pci_bar_map(struct lpfc_hba *phba, uint16_t pci_barset)* @startq: The starting FCP EQ to modify * * This function sends an MODIFY_EQ_DELAY mailbox command to the HBA. +* The command allows up to LPFC_MAX_EQ_DELAY_EQID_CNT EQ ID's to be +* updated in one mailbox command. * * The @phba struct is used to send mailbox command to HBA. The @startq * is used to get the starting FCP EQ to change.
@@ -13926,7 +13929,7 @@ lpfc_modify_hba_eq_delay(struct lpfc_hba *phba, uint32_t startq) eq_delay->u.request.eq[cnt].phase =0 ; eq_delay->u.request.eq[cnt].delay_multi = dmult; cnt++; -if (cnt >=LPFC_MAX_EQ_DELAY ) +if (cnt >=LPFC_MAX_EQ_DELAY_EQID_CNT )break ; } eq_delay->u.request.num_eq = cnt;
Signature · 1 line
2.5.0
PATCH 15/20 lpfc: correct double print
In reply to [email protected]From: James Smart <[email protected]>
Correct a merge error that had debug data printed twice for the same element
--- drivers/scsi/lpfc/lpfc_debugfs.c | 22 ---------------------- 1 file changed, 22 deletions(-)
drivers/scsi/lpfc/lpfc_debugfs.c +0 -22
@@ -3653,17 +3653,6 @@ lpfc_idiag_queacc_write(struct file *file, const char __user *buf, idiag.ptr_private = phba->sli4_hba.nvmels_cq; goto pass_check; } -/* NVME LS complete queue */ -if (phba->sli4_hba.nvmels_cq && - phba->sli4_hba.nvmels_cq->queue_id == queid) { -/* Sanity check */ - rc =lpfc_idiag_que_param_check ( - phba->sli4_hba.nvmels_cq, index, count); -if (rc) - goto error_out; - idiag.ptr_private = phba->sli4_hba.nvmels_cq; - goto pass_check; - }/* FCP complete queue */ if (phba->sli4_hba.fcp_cq) { for (qidx = 0; qidx < phba->cfg_fcp_io_channel;
@@ -3738,17 +3727,6 @@ lpfc_idiag_queacc_write(struct file *file, const char __user *buf, idiag.ptr_private = phba->sli4_hba.nvmels_wq; goto pass_check; } -/* NVME LS work queue */ -if (phba->sli4_hba.nvmels_wq && - phba->sli4_hba.nvmels_wq->queue_id == queid) { -/* Sanity check */ - rc =lpfc_idiag_que_param_check ( - phba->sli4_hba.nvmels_wq, index, count); -if (rc) - goto error_out; - idiag.ptr_private = phba->sli4_hba.nvmels_wq; - goto pass_check; - }/* FCP work queue */ if (phba->sli4_hba.fcp_wq) { for (qidx = 0; qidx < phba->cfg_fcp_io_channel;
Signature · 1 line
2.5.0
PATCH 16/20 lpfc: remove dead sli3 nvme code
In reply to [email protected]From: James Smart <[email protected]>
Remove nvme teardown calls that should not be there on sli3 devices
--- drivers/scsi/lpfc/lpfc_init.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +0 -5
@@ -10459,12 +10459,7 @@ lpfc_pci_remove_one_s3(struct pci_dev *pdev)fc_remove_host (shost);scsi_remove_host (shost); -/* Perform ndlp cleanup on the physical port. The nvme and nvmet -* localports are destroyed after to cleanup all transport memory. -*/ lpfc_cleanup (vport); -lpfc_nvmet_destroy_targetport (phba); -lpfc_nvme_destroy_localport (vport);/* * Bring down the SLI Layer. This step disable all interrupts,
Signature · 1 line
2.5.0
PATCH 17/20 lpfc: correct rdp diag portnames
In reply to [email protected]From: James Smart <[email protected]>
NVME merge reverted diag port names to the physical port. They should be the vport.
--- drivers/scsi/lpfc/lpfc_els.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +4 -4
@@ -5177,15 +5177,15 @@ lpfc_rdp_res_speed(struct fc_rdp_port_speed_desc *desc, struct lpfc_hba *phba)static uint32_t lpfc_rdp_res_diag_port_names (struct fc_rdp_port_name_desc *desc, -struct lpfc_hba *phba) +struct lpfc_vport *vport) { desc->tag =cpu_to_be32 (RDP_PORT_NAMES_DESC_TAG ); -memcpy (desc->port_names.wwnn, phba->wwnn, +memcpy (desc->port_names.wwnn, &vport->fc_nodename,sizeof (desc->port_names.wwnn)); -memcpy (desc->port_names.wwpn, phba->wwpn, +memcpy (desc->port_names.wwpn, &vport->fc_portname,sizeof (desc->port_names.wwpn)); desc->length =cpu_to_be32 (sizeof (desc->port_names));
@@ -5279,7 +5279,7 @@ lpfc_els_rdp_cmpl(struct lpfc_hba *phba, struct lpfc_rdp_context *rdp_context, len +=lpfc_rdp_res_link_error ((struct fc_rdp_link_error_status_desc *) (len + pcmd), &rdp_context->link_stat); len +=lpfc_rdp_res_diag_port_names ((struct fc_rdp_port_name_desc *) - (len + pcmd), phba); + (len + pcmd), vport); len +=lpfc_rdp_res_attach_port_names ((struct fc_rdp_port_name_desc *) (len + pcmd), vport, ndlp); len += lpfc_rdp_res_fec_desc((struct fc_fec_rdp_desc *)(len + pcmd),
Signature · 1 line
2.5.0
PATCH 18/20 lpfc: code cleanups in NVME initiator base
In reply to [email protected]From: James Smart <[email protected]>
This patch addresses the smatch issues identified by Dan Carpenter in http://www.spinics.net/lists/linux-scsi/msg105663.html
The issues are:
drivers/scsi/lpfc/lpfc_hbadisc.c:316 lpfc_dev_loss_tmo_handler()
warn: we tested 'vport->load_flag & 2' before and it was 'false'
Action: removed item from test
drivers/scsi/lpfc/lpfc_hbadisc.c:701 lpfc_work_done()
warn: test_bit() takes a bit number
Action: changed definition so bit number
drivers/scsi/lpfc/lpfc_hbadisc.c:2206 lpfc_mbx_cmpl_fcf_scan_read_fcf_rec()
error: uninitialized symbol 'vlan_id'. drivers/scsi/lpfc/lpfc_hbadisc.c:2582 lpfc_mbx_cmpl_fcf_rr_read_fcf_rec()
error: uninitialized symbol 'vlan_id'. drivers/scsi/lpfc/lpfc_hbadisc.c:2683 lpfc_mbx_cmpl_read_fcf_rec() error:
uninitialized symbol 'vlan_id'.
Action: initilized value
drivers/scsi/lpfc/lpfc_hbadisc.c:4025 lpfc_register_remote_port()
error: we previously assumed 'rdata' could be null (see line 4023)
Action: refactored check block
drivers/scsi/lpfc/lpfc_hbadisc.c:4613 lpfc_sli4_dequeue_nport_iocbs()
error: double unlock 'irq:'
Action: removed inner irq reference
--- drivers/scsi/lpfc/lpfc.h | 2 +- drivers/scsi/lpfc/lpfc_hbadisc.c | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-)
drivers/scsi/lpfc/lpfc.h +1 -1
@@ -105,7 +105,7 @@ struct lpfc_sli2_slim;#define LPFC_MSIX_VECTORS 2/* lpfc wait event data ready flag */ -#define LPFC_DATA_READY (1<<0) +#define LPFC_DATA_READY 0/* bit 0 */ /* queue dump line buffer size */ #define LPFC_LBUF_SZ 128
drivers/scsi/lpfc/lpfc_hbadisc.c +9 -8
@@ -313,8 +313,7 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp) ndlp->nlp_state, ndlp->nlp_rpi); } - if (!(vport->load_flag & FC_UNLOADING) && - !(ndlp->nlp_flag & NLP_DELAY_TMO) && + if (!(ndlp->nlp_flag & NLP_DELAY_TMO) && !(ndlp->nlp_flag & NLP_NPR_2B_DISC) && (ndlp->nlp_state != NLP_STE_UNMAPPED_NODE) && (ndlp->nlp_state != NLP_STE_REG_LOGIN_ISSUE) &&
@@ -2175,7 +2174,7 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)uint32_t boot_flag, addr_mode;uint16_t fcf_index, next_fcf_index;struct lpfc_fcf_rec *fcf_rec =NULL ; -uint16_t vlan_id; +uint16_t vlan_id =LPFC_FCOE_NULL_VID ;bool select_new_fcf;int rc;
@@ -4022,9 +4021,11 @@ lpfc_register_remote_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp) rdata = rport->dd_data;/* break the link before dropping the ref */ ndlp->rport =NULL ; -if (rdata && rdata->pnode == ndlp) -lpfc_nlp_put (ndlp); - rdata->pnode =NULL ; +if (rdata) { +if (rdata->pnode == ndlp) +lpfc_nlp_put (ndlp); + rdata->pnode =NULL ; + }/* drop reference for earlier registeration */ put_device (&rport->dev); }
@@ -4608,9 +4609,9 @@ lpfc_sli4_dequeue_nport_iocbs(struct lpfc_hba *phba, pring = qp->pring;if (!pring)continue ; -spin_lock_irq (&pring->ring_lock); +spin_lock (&pring->ring_lock);__lpfc_dequeue_nport_iocbs (phba, ndlp, pring, dequeue_list); -spin_unlock_irq (&pring->ring_lock); +spin_unlock (&pring->ring_lock); }spin_unlock_irq (&phba->hbalock); }
Signature · 1 line
2.5.0
PATCH 19/20 lpfc: code cleanups in NVME initiator discovery
In reply to [email protected]From: James Smart <[email protected]>
This patch addresses the smatch issues identified by Dan Carpenter in http://www.spinics.net/lists/linux-scsi/msg105665.html
The issues are:
drivers/scsi/lpfc/lpfc_ct.c:943 lpfc_cmpl_ct_cmd_gft_id()
error: we previously assumed 'ndlp' could be null (see line 928)
Action: moved under if check
drivers/scsi/lpfc/lpfc_nvmet.c:1694 lpfc_nvmet_unsol_issue_abort()
error: we previously assumed 'ndlp' could be null (see line 1690)
Action: conditionalized arg in printf stmt
drivers/scsi/lpfc/lpfc_nvmet.c:1792 lpfc_nvmet_sol_fcp_issue_abort()
error: we previously assumed 'ndlp' could be null (see line 1788)
Action: conditionalized arg in printf stmt
--- drivers/scsi/lpfc/lpfc_ct.c | 2 +- drivers/scsi/lpfc/lpfc_nvmet.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc_ct.c +1 -1
@@ -939,8 +939,8 @@ lpfc_cmpl_ct_cmd_gft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,"FC4 x%08x, Data: x%08x x%08x\n" , ndlp, did, ndlp->nlp_fc4_type, FC_TYPE_FCP, FC_TYPE_NVME); + ndlp->nlp_prev_state =NLP_STE_REG_LOGIN_ISSUE ; } - ndlp->nlp_prev_state =NLP_STE_REG_LOGIN_ISSUE ;lpfc_nlp_set_state (vport, ndlp,NLP_STE_PRLI_ISSUE );lpfc_issue_els_prli (vport, ndlp,0 ); }else
drivers/scsi/lpfc/lpfc_nvmet.c +2 -2
@@ -1720,7 +1720,7 @@ lpfc_nvmet_unsol_issue_abort(struct lpfc_hba *phba,atomic_inc (&tgtp->xmt_abort_rsp_error);lpfc_printf_log (phba,KERN_WARNING ,LOG_NVME_ABTS ,"6134 Drop ABTS - wrong NDLP state x%x.\n" , - ndlp->nlp_state); + (ndlp) ? ndlp->nlp_state :NLP_STE_MAX_STATE );/* No failure to an ABTS request. */ return 0 ;
@@ -1818,7 +1818,7 @@ lpfc_nvmet_sol_fcp_issue_abort(struct lpfc_hba *phba,atomic_inc (&tgtp->xmt_abort_rsp_error);lpfc_printf_log (phba,KERN_WARNING ,LOG_NVME_ABTS ,"6160 Drop ABTS - wrong NDLP state x%x.\n" , - ndlp->nlp_state); + (ndlp) ? ndlp->nlp_state :NLP_STE_MAX_STATE );/* No failure to an ABTS request. */ return 0 ;
Signature · 1 line
2.5.0
PATCH 20/20 lpfc: revise version number to 11.2.0.10
In reply to [email protected]From: James Smart <[email protected]>
Revise lpfc version number to 11.2.0.10
--- drivers/scsi/lpfc/lpfc_version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_version.h +1 -1
@@ -20,7 +20,7 @@* included with this package. * *******************************************************************/ -#define LPFC_DRIVER_VERSION "11.2.0.7" +#define LPFC_DRIVER_VERSION "11.2.0.10"#define LPFC_DRIVER_NAME "lpfc"/* Used for SLI 2/3 */
Signature · 1 line
2.5.0
Martin K. Petersen
Appliedcover lpfc: Update lpfc to revision 11.2.0.10
In reply to [email protected]Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"James" == jsmart2021 <jsmart2021 at gmail.com> writes:
James,
James> This set of patches are mainly cleanups and fixes to the large James> nvme post that was recently integrated. It includes a patch to James> break the mandate for both NVME and SCSI subystems.
A couple of the patches in this series felt quite a bit bigger than "a fix". I let them in because I acknowledge that it was a pretty big chunk of code that just got merged and that some fallout was inevitable.
Applied to 4.11/scsi-fixes.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering