All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Leng <lengchao@huawei.com>
To: Sagi Grimberg <sagi@grimberg.me>,
	<linux-nvme@lists.infradead.org>, Christoph Hellwig <hch@lst.de>,
	Keith Busch <kbusch@kernel.org>
Cc: Max Gurtovoy <maxg@mellanox.com>
Subject: Re: [PATCH] nvme-rdma: fix in-casule data send for chained sgls
Date: Fri, 28 May 2021 09:08:13 +0800	[thread overview]
Message-ID: <48f23b84-8a1e-e298-be91-0627c1112fd8@huawei.com> (raw)
In-Reply-To: <20210527204016.379365-1-sagi@grimberg.me>



On 2021/5/28 4:40, Sagi Grimberg wrote:
> We have only 2 inline sg entries and we allow 4 sg entries for the send
> wr sge. Larger sgls entries will be chained. However when we build
> in-capsule send wr sge, we iterate without taking into account that the
> sgl may be chained and still fit in-capsule (which can happen if the sgl
> is bigger than 2, but lower-equal to 4).
> 
> Fix in-capsule data mapping to correctly iterate chained sgls.
> 
> Reported-by: Walker, Benjamin <benjamin.walker@intel.com>
> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
> ---
>   drivers/nvme/host/rdma.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
> index 8d107b201f16..ed1bf214c544 100644
> --- a/drivers/nvme/host/rdma.c
> +++ b/drivers/nvme/host/rdma.c
> @@ -1320,16 +1320,16 @@ static int nvme_rdma_map_sg_inline(struct nvme_rdma_queue *queue,
>   		int count)
>   {
>   	struct nvme_sgl_desc *sg = &c->common.dptr.sgl;
> -	struct scatterlist *sgl = req->data_sgl.sg_table.sgl;
sgl need to be defined.
>   	struct ib_sge *sge = &req->sge[1];
>   	u32 len = 0;
>   	int i;
>   
> -	for (i = 0; i < count; i++, sgl++, sge++) {
> +	for_each_sg(req->data_sgl.sg_table.sgl, sgl, count, i) {
>   		sge->addr = sg_dma_address(sgl);
>   		sge->length = sg_dma_len(sgl);
>   		sge->lkey = queue->device->pd->local_dma_lkey;
>   		len += sge->length;
> +		sge++;
>   	}
>   
>   	sg->addr = cpu_to_le64(queue->ctrl->ctrl.icdoff);
> 

_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2021-05-28  1:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27 20:40 [PATCH] nvme-rdma: fix in-casule data send for chained sgls Sagi Grimberg
2021-05-28  1:08 ` Chao Leng [this message]
2021-05-28  1:16   ` Sagi Grimberg

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=48f23b84-8a1e-e298-be91-0627c1112fd8@huawei.com \
    --to=lengchao@huawei.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=maxg@mellanox.com \
    --cc=sagi@grimberg.me \
    /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.