All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: James Smart <james.smart@broadcom.com>
Cc: Dick Kennedy <dick.kennedy@broadcom.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Christoph Hellwig <hch@lst.de>,
	James Bottomley <james.bottomley@hansenpartnership.com>,
	linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.de>,
	Hannes Reinecke <hare@suse.com>
Subject: [PATCH 3/3] lpfc: access nvme nodelist through nvme rport structure
Date: Fri, 18 Oct 2019 09:50:10 +0200	[thread overview]
Message-ID: <20191018075010.55653-4-hare@suse.de> (raw)
In-Reply-To: <20191018075010.55653-1-hare@suse.de>

Instead of referencing the nodelist directly via a point in the
I/O buffer we should be storing the nvme rport pointer in the
protocol-specific section and access the nodelist through that.
With this we reduce the size of the I/O buffer, eliminate a possible
race and align the protoco-specific sections.

Signed-off-by: Hannes Reinecke <hare@suse.com>
---
 drivers/scsi/lpfc/lpfc_nvme.c | 14 ++++++++------
 drivers/scsi/lpfc/lpfc_sli.h  |  2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c
index defb19cdc7fe..80a58003b6aa 100644
--- a/drivers/scsi/lpfc/lpfc_nvme.c
+++ b/drivers/scsi/lpfc/lpfc_nvme.c
@@ -1056,7 +1056,7 @@ lpfc_nvme_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn,
 	 * Catch race where our node has transitioned, but the
 	 * transport is still transitioning.
 	 */
-	ndlp = lpfc_ncmd->ndlp;
+	ndlp = lpfc_ncmd->nvme.rport->ndlp;
 	if (!ndlp || !NLP_CHK_NODE_ACT(ndlp)) {
 		lpfc_printf_vlog(vport, KERN_ERR, LOG_NVME_IOERR,
 				 "6062 Ignoring NVME cmpl.  No ndlp\n");
@@ -1695,7 +1695,7 @@ lpfc_nvme_fcp_io_submit(struct nvme_fc_local_port *pnvme_lport,
 	 */
 	freqpriv->nvme_buf = lpfc_ncmd;
 	lpfc_ncmd->nvme.nvmeCmd = pnvme_fcreq;
-	lpfc_ncmd->ndlp = ndlp;
+	lpfc_ncmd->nvme.rport = rport;
 	lpfc_ncmd->nvme.qidx = lpfc_queue_info->qidx;
 
 	/*
@@ -2085,11 +2085,13 @@ lpfc_release_nvme_buf(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_ncmd)
 {
 	struct lpfc_sli4_hdw_queue *qp;
 	unsigned long iflag = 0;
+	struct lpfc_nodelist *ndlp =
+	    lpfc_ncmd->nvme.rport ? lpfc_ncmd->nvme.rport->ndlp : NULL;
 
-	if ((lpfc_ncmd->flags & LPFC_SBUF_BUMP_QDEPTH) && lpfc_ncmd->ndlp)
-		atomic_dec(&lpfc_ncmd->ndlp->cmd_pending);
+	if ((lpfc_ncmd->flags & LPFC_SBUF_BUMP_QDEPTH) && ndlp)
+		atomic_dec(&ndlp->cmd_pending);
 
-	lpfc_ncmd->ndlp = NULL;
+	lpfc_ncmd->nvme.rport = NULL;
 	lpfc_ncmd->flags &= ~LPFC_SBUF_BUMP_QDEPTH;
 
 	qp = lpfc_ncmd->hdwq;
@@ -2646,7 +2648,7 @@ lpfc_sli4_nvme_xri_aborted(struct lpfc_hba *phba,
 {
 	uint16_t xri = bf_get(lpfc_wcqe_xa_xri, axri);
 	struct nvmefc_fcp_req *nvme_cmd = NULL;
-	struct lpfc_nodelist *ndlp = lpfc_ncmd->ndlp;
+	struct lpfc_nodelist *ndlp = lpfc_ncmd->nvme.rport->ndlp;
 
 
 	if (ndlp)
diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h
index f0c51288b10a..bb499904bdb6 100644
--- a/drivers/scsi/lpfc/lpfc_sli.h
+++ b/drivers/scsi/lpfc/lpfc_sli.h
@@ -382,7 +382,6 @@ struct lpfc_io_buf {
 	uint16_t hdwq_no;
 	uint16_t cpu;
 
-	struct lpfc_nodelist *ndlp;
 	uint32_t timeout;
 	uint16_t flags;  /* TBD convert exch_busy to flags */
 #define LPFC_SBUF_XBUSY		0x1	/* SLI4 hba reported XB on WCQE cmpl */
@@ -439,6 +438,7 @@ struct lpfc_io_buf {
 		/* NVME specific fields */
 		struct {
 			struct nvmefc_fcp_req *nvmeCmd;
+			struct lpfc_nvme_rport *rport;
 			uint16_t qidx;
 		} nvme;
 	};
-- 
2.16.4


  parent reply	other threads:[~2019-10-18  7:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-18  7:50 [RFC PATCH 0/3] lpfc: nodelist pointer cleanup Hannes Reinecke
2019-10-18  7:50 ` [PATCH 1/3] lpfc: use named structure for combined I/O buffer Hannes Reinecke
2019-10-18  7:50 ` [PATCH 2/3] lpfc: access nodelist through scsi-specific rdata pointer Hannes Reinecke
2019-10-18  7:50 ` Hannes Reinecke [this message]
2019-10-18 21:45 ` [RFC PATCH 0/3] lpfc: nodelist pointer cleanup James Smart
2019-10-19 15:55   ` Hannes Reinecke

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=20191018075010.55653-4-hare@suse.de \
    --to=hare@suse.de \
    --cc=dick.kennedy@broadcom.com \
    --cc=hare@suse.com \
    --cc=hch@lst.de \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=james.smart@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.