Re: [PATCH 11/12] lpfc: Use sg_dma_address and sg_dma_len macros for NVMe I/O

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2022-05-05 at 20:55 -0700, James Smart wrote:
> 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@xxxxxxxxx>
> Signed-off-by: James Smart <jsmart2021@xxxxxxxxx>

Tested-by: Jerry Snitselaar <jsnitsel@xxxxxxxxxx>
Reviewed-by: Jerry Snitselaar <jsnitsel@xxxxxxxxxx>

> ---
>  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(





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux