Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Cheng Xu <chengyou@linux.alibaba.com>
To: Thomas Fourier <fourier.thomas@gmail.com>
Cc: Kai Shen <kaishen@linux.alibaba.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fix dma_unmap_sg() nents value
Date: Wed, 2 Jul 2025 17:24:41 +0800	[thread overview]
Message-ID: <0d4684ef-eb54-2977-dc38-b21c0779fee4@linux.alibaba.com> (raw)
In-Reply-To: <20250630092346.81017-2-fourier.thomas@gmail.com>



On 6/30/25 5:23 PM, Thomas Fourier wrote:
> The dma_unmap_sg() functions should be called with the same nents as the
> dma_map_sg(), not the value the map function returned.
> 
> Fixes: ed10435d3583 ("RDMA/erdma: Implement hierarchical MTT")
> Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
> ---
>  drivers/infiniband/hw/erdma/erdma_verbs.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 

Hi Thomas,

This patch is already accepted by Leon, and a late thanks to you.

Cheng Xu


> diff --git a/drivers/infiniband/hw/erdma/erdma_verbs.c b/drivers/infiniband/hw/erdma/erdma_verbs.c
> index af36a8d2df22..ec0ad4086066 100644
> --- a/drivers/infiniband/hw/erdma/erdma_verbs.c
> +++ b/drivers/infiniband/hw/erdma/erdma_verbs.c
> @@ -629,7 +629,8 @@ static struct erdma_mtt *erdma_create_cont_mtt(struct erdma_dev *dev,
>  static void erdma_destroy_mtt_buf_sg(struct erdma_dev *dev,
>  				     struct erdma_mtt *mtt)
>  {
> -	dma_unmap_sg(&dev->pdev->dev, mtt->sglist, mtt->nsg, DMA_TO_DEVICE);
> +	dma_unmap_sg(&dev->pdev->dev, mtt->sglist,
> +		     DIV_ROUND_UP(mtt->size, PAGE_SIZE), DMA_TO_DEVICE);
>  	vfree(mtt->sglist);
>  }
>  

      parent reply	other threads:[~2025-07-02  9:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30  9:23 [PATCH] Fix dma_unmap_sg() nents value Thomas Fourier
2025-07-01 10:48 ` Leon Romanovsky
2025-07-02  9:24 ` Cheng Xu [this message]

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=0d4684ef-eb54-2977-dc38-b21c0779fee4@linux.alibaba.com \
    --to=chengyou@linux.alibaba.com \
    --cc=fourier.thomas@gmail.com \
    --cc=jgg@ziepe.ca \
    --cc=kaishen@linux.alibaba.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    /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