All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Gurtovoy <mgurtovoy@nvidia.com>
To: Christoph Hellwig <hch@infradead.org>, Sagi Grimberg <sagi@grimberg.me>
Cc: "Walker, Benjamin" <benjamin.walker@intel.com>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	"Israel Rukshin" <israelr@nvidia.com>
Subject: Re: [bug report] nvme sends invalid command capsule over rdma transport for 5KiB write when target supports MSDBD > 1
Date: Wed, 26 May 2021 17:49:41 +0300	[thread overview]
Message-ID: <3c944010-a9e7-cab2-07ad-78d50c8bd82f@nvidia.com> (raw)
In-Reply-To: <YK5W7F5DD4grBZLB@infradead.org>


On 5/26/2021 5:10 PM, Christoph Hellwig wrote:
> On Wed, May 26, 2021 at 02:12:08AM -0700, Sagi Grimberg wrote:
>>   {
>> -       struct nvme_sgl_desc *sg = &c->common.dptr.sgl;
>> -       struct scatterlist *sgl = req->data_sgl.sg_table.sgl;
>> +       struct nvme_sgl_desc *sgl = &c->common.dptr.sgl;
>> +       struct scatterlist *sg, *scat = req->data_sgl.sg_table.sgl;
>>          struct ib_sge *sge = &req->sge[1];
>>          u32 len = 0;
>>          int i;
>>
>> -       for (i = 0; i < count; i++, sgl++, sge++) {
>> -               sge->addr = sg_dma_address(sgl);
>> -               sge->length = sg_dma_len(sgl);
>> +       for_each_sg(scat, sg, count, i) {
>> +               sge->addr = sg_dma_address(sg);
>> +               sge->length = sg_dma_len(sg);
>>                  sge->lkey = queue->device->pd->local_dma_lkey;
>>                  len += sge->length;
>>          }
> We do need for_each_sg here indeed, but you also need to keep
> incrementing sge for each loop iteration.  I think we can also
> drop the scat local variable with just a single users and all the
> renaming while we're at it.

Is the above fixing the issue ?

Seems like code refactoring to me, right ?



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

  reply	other threads:[~2021-05-26 16:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-24 17:19 [bug report] nvme sends invalid command capsule over rdma transport for 5KiB write when target supports MSDBD > 1 Walker, Benjamin
2021-05-26  9:12 ` Sagi Grimberg
2021-05-26 14:10   ` Christoph Hellwig
2021-05-26 14:49     ` Max Gurtovoy [this message]
2021-05-26 16:00       ` Christoph Hellwig
2021-05-26 19:29         ` Walker, Benjamin
2021-05-26 21:57         ` Max Gurtovoy
2021-05-27 17:43           ` Walker, Benjamin
2021-05-27 17:48             ` Max Gurtovoy

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=3c944010-a9e7-cab2-07ad-78d50c8bd82f@nvidia.com \
    --to=mgurtovoy@nvidia.com \
    --cc=benjamin.walker@intel.com \
    --cc=hch@infradead.org \
    --cc=israelr@nvidia.com \
    --cc=linux-nvme@lists.infradead.org \
    --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.