public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: jsmart2021@gmail.com
To: linux-scsi@vger.kernel.org, linux-nvme@lists.infradead.org,
	sagi@grimberg.me, martin.petersen@oracle.com
Cc: James Smart <jsmart2021@gmail.com>,
	Dick Kennedy <dick.kennedy@broadcom.com>,
	James Smart <james.smart@broadcom.com>
Subject: [PATCH-v1 15/22] Fix driver load issues when MRQ=8
Date: Wed, 19 Apr 2017 21:46:34 -0700	[thread overview]
Message-ID: <20170420044641.10657-16-jsmart2021@gmail.com> (raw)
In-Reply-To: <20170420044641.10657-1-jsmart2021@gmail.com>

From: James Smart <jsmart2021@gmail.com>

The symptom is that the driver will fail to login to the fabric.
The reason is because it is out of iocb resources.

There is a one to one relationship between MRQs
(receive buffers for NVMET-FC) and iocbs and the default number of
IOCBs was not accounting for the number of MRQs that were being created.

This fix aligns the number of MRQ resources with the total resources so
that it can handle fabric events when needed.

Also the initialization of ctxlock to be on FCP commands, NOT LS commands.
And modified log messages so that the log output can be correlated with
the analyzer trace.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <james.smart@broadcom.com>
---
 drivers/scsi/lpfc/lpfc_init.c  | 12 ++++++++----
 drivers/scsi/lpfc/lpfc_nvme.c  | 23 ++++++++++++-----------
 drivers/scsi/lpfc/lpfc_nvmet.c |  6 +++---
 3 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index cca7f81..88977b8 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -11061,7 +11061,7 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
 	struct lpfc_hba   *phba;
 	struct lpfc_vport *vport = NULL;
 	struct Scsi_Host  *shost = NULL;
-	int error;
+	int error, cnt;
 	uint32_t cfg_mode, intr_mode;
 
 	/* Allocate memory for HBA structure */
@@ -11095,11 +11095,15 @@ lpfc_pci_probe_one_s4(struct pci_dev *pdev, const struct pci_device_id *pid)
 		goto out_unset_pci_mem_s4;
 	}
 
+	cnt = phba->cfg_iocb_cnt * 1024;
+	if (phba->nvmet_support)
+		cnt += (phba->cfg_nvmet_mrq_post * phba->cfg_nvmet_mrq);
+
 	/* Initialize and populate the iocb list per host */
 	lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
-			"2821 initialize iocb list %d.\n",
-			phba->cfg_iocb_cnt*1024);
-	error = lpfc_init_iocb_list(phba, phba->cfg_iocb_cnt*1024);
+			"2821 initialize iocb list %d total %d\n",
+			phba->cfg_iocb_cnt, cnt);
+	error = lpfc_init_iocb_list(phba, cnt);
 
 	if (error) {
 		lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c
index f23496b..efe1242 100644
--- a/drivers/scsi/lpfc/lpfc_nvme.c
+++ b/drivers/scsi/lpfc/lpfc_nvme.c
@@ -1494,6 +1494,7 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_lport,
 				 "io buffer.  Skipping abort req.\n");
 		return;
 	}
+	nvmereq_wqe = &lpfc_nbuf->cur_iocbq;
 
 	/*
 	 * The lpfc_nbuf and the mapped nvme_fcreq in the driver's
@@ -1507,20 +1508,19 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_lport,
 		lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME,
 				 "6143 NVME req mismatch: "
 				 "lpfc_nbuf %p nvmeCmd %p, "
-				 "pnvme_fcreq %p.  Skipping Abort\n",
+				 "pnvme_fcreq %p.  Skipping Abort xri x%x\n",
 				 lpfc_nbuf, lpfc_nbuf->nvmeCmd,
-				 pnvme_fcreq);
+				 pnvme_fcreq, nvmereq_wqe->sli4_xritag);
 		return;
 	}
 
 	/* Don't abort IOs no longer on the pending queue. */
-	nvmereq_wqe = &lpfc_nbuf->cur_iocbq;
 	if (!(nvmereq_wqe->iocb_flag & LPFC_IO_ON_TXCMPLQ)) {
 		spin_unlock_irqrestore(&phba->hbalock, flags);
 		lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME,
 				 "6142 NVME IO req %p not queued - skipping "
-				 "abort req\n",
-				 pnvme_fcreq);
+				 "abort req xri x%x\n",
+				 pnvme_fcreq, nvmereq_wqe->sli4_xritag);
 		return;
 	}
 
@@ -1534,8 +1534,9 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_lport,
 		lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME,
 				 "6144 Outstanding NVME I/O Abort Request "
 				 "still pending on nvme_fcreq %p, "
-				 "lpfc_ncmd %p\n",
-				 pnvme_fcreq, lpfc_nbuf);
+				 "lpfc_ncmd %p xri x%x\n",
+				 pnvme_fcreq, lpfc_nbuf,
+				 nvmereq_wqe->sli4_xritag);
 		return;
 	}
 
@@ -1544,8 +1545,8 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_lport,
 		spin_unlock_irqrestore(&phba->hbalock, flags);
 		lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME,
 				 "6136 No available abort wqes. Skipping "
-				 "Abts req for nvme_fcreq %p.\n",
-				 pnvme_fcreq);
+				 "Abts req for nvme_fcreq %p xri x%x\n",
+				 pnvme_fcreq, nvmereq_wqe->sli4_xritag);
 		return;
 	}
 
@@ -1603,7 +1604,7 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_lport,
 	}
 
 	lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME,
-			 "6138 Transport Abort NVME Request Issued for\n"
+			 "6138 Transport Abort NVME Request Issued for "
 			 "ox_id x%x on reqtag x%x\n",
 			 nvmereq_wqe->sli4_xritag,
 			 abts_buf->iotag);
@@ -2490,7 +2491,7 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
  input_err:
 #endif
 	lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_DISC,
-			 "6168: State error: lport %p, rport%p FCID x%06x\n",
+			 "6168 State error: lport %p, rport%p FCID x%06x\n",
 			 vport->localport, ndlp->rport, ndlp->nlp_DID);
 }
 
diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c
index 5a994a8..8348bb5 100644
--- a/drivers/scsi/lpfc/lpfc_nvmet.c
+++ b/drivers/scsi/lpfc/lpfc_nvmet.c
@@ -872,7 +872,6 @@ dropit:
 	ctxp->wqeq = NULL;
 	ctxp->state = LPFC_NVMET_STE_RCV;
 	ctxp->rqb_buffer = (void *)nvmebuf;
-	spin_lock_init(&ctxp->ctxlock);
 
 	lpfc_nvmeio_data(phba, "NVMET LS   RCV: xri x%x sz %d from %06x\n",
 			 oxid, size, sid);
@@ -981,6 +980,7 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba,
 	ctxp->rqb_buffer = nvmebuf;
 	ctxp->entry_cnt = 1;
 	ctxp->flag = 0;
+	spin_lock_init(&ctxp->ctxlock);
 
 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS
 	if (phba->ktime_on) {
@@ -1003,8 +1003,8 @@ lpfc_nvmet_unsol_fcp_buffer(struct lpfc_hba *phba,
 	}
 #endif
 
-	lpfc_nvmeio_data(phba, "NVMET FCP  RCV: xri x%x sz %d from %06x\n",
-			 oxid, size, sid);
+	lpfc_nvmeio_data(phba, "NVMET FCP  RCV: xri x%x sz %d CPU %02x\n",
+			 oxid, size, smp_processor_id());
 
 	atomic_inc(&tgtp->rcv_fcp_cmd_in);
 	/*
-- 
2.1.0

  parent reply	other threads:[~2017-04-20  4:47 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20  4:46 [PATCH-v1 00/22] lpfc updates for 11.2.0.12 jsmart2021
2017-04-20  4:46 ` [PATCH-v1 01/22] Standardize nvme SGL segment count jsmart2021
2017-04-20  7:15   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 02/22] Fix nvme unregister port timeout jsmart2021
2017-04-20  7:15   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 03/22] Fix rejected nvme LS Req jsmart2021
2017-04-20  7:29   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 04/22] Fix log message in completion path jsmart2021
2017-04-20  7:32   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 05/22] Add debug messages for nvme/fcp resource allocation jsmart2021
2017-04-20  7:33   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 06/22] Fix spelling in comments jsmart2021
2017-04-20  7:34   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 07/22] Remove unused defines for NVME PostBuf jsmart2021
2017-04-20  7:34   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 08/22] Remove NULL ptr check before kfree jsmart2021
2017-04-20  7:34   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 09/22] Fix extra line print in rqpair debug print jsmart2021
2017-04-20  7:35   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 10/22] Fix PRLI ACC rsp for NVME jsmart2021
2017-04-20  7:35   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 11/22] Fix driver unload/reload operation jsmart2021
2017-04-20  7:37   ` Johannes Thumshirn
2017-04-20  9:08     ` Junichi Nomura
2017-04-20  4:46 ` [PATCH-v1 12/22] Fix driver usage of 128B WQEs when WQ_CREATE is V1 jsmart2021
2017-04-20  7:37   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 13/22] Fix nvme initiator handling when not enabled jsmart2021
2017-04-20  7:38   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 14/22] Remove hba lock from NVMET issue WQE jsmart2021
2017-04-20  7:40   ` Johannes Thumshirn
2017-04-20  4:46 ` jsmart2021 [this message]
2017-04-20  7:42   ` [PATCH-v1 15/22] Fix driver load issues when MRQ=8 Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 16/22] Fix crash after issuing lip reset jsmart2021
2017-04-20  7:42   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 17/22] Fix max_sgl_segments settings for NVME / NVMET jsmart2021
2017-04-20  4:46 ` [PATCH-v1 18/22] Add Fabric assigned WWN support jsmart2021
2017-04-20  7:49   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 19/22] Fix implicit logo and RSCN handling for NVMET jsmart2021
2017-04-20  7:53   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 20/22] Update ABORT processing " jsmart2021
2017-04-20  8:10   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 21/22] Fix Express lane queue creation jsmart2021
2017-04-20  8:11   ` Johannes Thumshirn
2017-04-20  4:46 ` [PATCH-v1 22/22] lpfc revison 11.2.0.12 jsmart2021
2017-04-20  8:11   ` Johannes Thumshirn
2017-04-20 18:30 ` [PATCH-v1 00/22] lpfc updates for 11.2.0.12 Jens Axboe
2017-04-20 18:54   ` James Smart
2017-04-21  7:00   ` Johannes Thumshirn
2017-04-21 11:24     ` Martin K. Petersen
2017-04-21 16:41       ` James Smart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170420044641.10657-16-jsmart2021@gmail.com \
    --to=jsmart2021@gmail.com \
    --cc=dick.kennedy@broadcom.com \
    --cc=james.smart@broadcom.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox