All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Smart <jsmart2021@gmail.com>
To: linux-scsi@vger.kernel.org
Cc: James Smart <jsmart2021@gmail.com>,
	Nigel Kirkland <nkirkland2304@gmail.com>
Subject: [PATCH 11/12] lpfc: Use sg_dma_address and sg_dma_len macros for NVMe I/O
Date: Thu,  5 May 2022 20:55:18 -0700	[thread overview]
Message-ID: <20220506035519.50908-12-jsmart2021@gmail.com> (raw)
In-Reply-To: <20220506035519.50908-1-jsmart2021@gmail.com>

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_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.

Signed-off-by: Nigel Kirkland <nkirkland2304@gmail.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
---
 drivers/scsi/lpfc/lpfc_nvme.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c
index 3aebd01e07fd..5385f4de5523 100644
--- a/drivers/scsi/lpfc/lpfc_nvme.c
+++ b/drivers/scsi/lpfc/lpfc_nvme.c
@@ -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(
-- 
2.26.2


  parent reply	other threads:[~2022-05-06  3:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06  3:55 [PATCH 00/12] lpfc: Update lpfc to revision 14.2.0.3 James Smart
2022-05-06  3:55 ` [PATCH 01/12] lpfc: Fix element offset in __lpfc_sli_release_iocbq_s4() James Smart
2022-05-06  3:55 ` [PATCH 02/12] lpfc: Fill in missing ndlp kref puts in error paths James Smart
2022-05-06  3:55 ` [PATCH 03/12] lpfc: Fix ndlp put following a LOGO completion James Smart
2022-05-06  3:55 ` [PATCH 04/12] lpfc: Inhibit aborts if external loopback plug is inserted James Smart
2022-05-06  3:55 ` [PATCH 05/12] lpfc: Fix dmabuf ptr assignment in lpfc_ct_reject_event James Smart
2022-05-06  3:55 ` [PATCH 06/12] lpfc: Use list_for_each_entry_safe on fc_nodes list in rscn_recovery_check James Smart
2022-05-06  3:55 ` [PATCH 07/12] lpfc: Decrement outstanding gidft_inp counter if lpfc_err_lost_link James Smart
2022-05-06  3:55 ` [PATCH 08/12] lpfc: Change VMID registration to be based on fabric parameters James Smart
2022-05-06  3:55 ` [PATCH 09/12] lpfc: Rework FDMI initialization after link up James Smart
2022-05-06  3:55 ` [PATCH 10/12] lpfc: Alter FPIN stat accounting logic James Smart
2022-05-06  3:55 ` James Smart [this message]
2022-05-06 16:41   ` [PATCH 11/12] lpfc: Use sg_dma_address and sg_dma_len macros for NVMe I/O Jerry Snitselaar
2022-05-06  3:55 ` [PATCH 12/12] lpfc: Update lpfc version to 14.2.0.3 James Smart
2022-05-11  2:11 ` [PATCH 00/12] lpfc: Update lpfc to revision 14.2.0.3 Martin K. Petersen
2022-05-17  2:16 ` Martin K. Petersen

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=20220506035519.50908-12-jsmart2021@gmail.com \
    --to=jsmart2021@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nkirkland2304@gmail.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.