Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Max Gurtovoy <maxg@mellanox.com>
Cc: jgg@mellanox.com, linux-rdma@vger.kernel.org,
	israelr@mellanox.com, logang@deltatee.com
Subject: Re: [PATCH v2 1/2] RDMA/rw: fix error flow during RDMA context initialization
Date: Thu, 20 Feb 2020 12:31:37 +0200	[thread overview]
Message-ID: <20200220103137.GB209126@unreal> (raw)
In-Reply-To: <20200220100819.41860-1-maxg@mellanox.com>

On Thu, Feb 20, 2020 at 12:08:18PM +0200, Max Gurtovoy wrote:
> In case the SGL was mapped for P2P DMA operation, we must unmap it using
> pci_p2pdma_unmap_sg.
>
> Fixes: 7f73eac3a713 ("PCI/P2PDMA: Introduce pci_p2pdma_unmap_sg()")
> Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
> ---
>  drivers/infiniband/core/rw.c | 32 +++++++++++++++++++++-----------
>  1 file changed, 21 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/infiniband/core/rw.c b/drivers/infiniband/core/rw.c
> index 4fad732f9b3c..69513b484507 100644
> --- a/drivers/infiniband/core/rw.c
> +++ b/drivers/infiniband/core/rw.c
> @@ -273,6 +273,24 @@ static int rdma_rw_init_single_wr(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
>  	return 1;
>  }
>
> +static void rdma_rw_unmap_sg(struct ib_device *dev, struct scatterlist *sg,
> +		u32 sg_cnt, enum dma_data_direction dir)
> +{
> +	if (is_pci_p2pdma_page(sg_page(sg)))
> +		pci_p2pdma_unmap_sg(dev->dma_device, sg, sg_cnt, dir);
> +	else
> +		ib_dma_unmap_sg(dev, sg, sg_cnt, dir);
> +}
> +
> +static int rdma_rw_map_sg(struct ib_device *dev, struct scatterlist *sg,
> +		u32 sg_cnt, enum dma_data_direction dir)
> +{
> +	if (is_pci_p2pdma_page(sg_page(sg)))
> +		return pci_p2pdma_map_sg(dev->dma_device, sg, sg_cnt, dir);
> +	else

This "else" is not needed.

> +		return ib_dma_map_sg(dev, sg, sg_cnt, dir);
> +}> +
>  /**

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

  parent reply	other threads:[~2020-02-20 10:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20 10:08 [PATCH v2 1/2] RDMA/rw: fix error flow during RDMA context initialization Max Gurtovoy
2020-02-20 10:08 ` [PATCH v2 2/2] RDMA/rw: map P2P memory correctly for signature operations Max Gurtovoy
2020-02-20 16:51   ` Logan Gunthorpe
2020-02-20 16:57     ` Max Gurtovoy
2020-03-10 16:02   ` Jason Gunthorpe
2020-02-20 10:31 ` Leon Romanovsky [this message]
2020-02-20 16:50 ` [PATCH v2 1/2] RDMA/rw: fix error flow during RDMA context initialization Logan Gunthorpe
2020-02-20 17:21 ` Jason Gunthorpe

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=20200220103137.GB209126@unreal \
    --to=leon@kernel.org \
    --cc=israelr@mellanox.com \
    --cc=jgg@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=logang@deltatee.com \
    --cc=maxg@mellanox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox