From: Christoph Hellwig <hch@infradead.org>
To: Sagi Grimberg <sagi@grimberg.me>
Cc: "Walker, Benjamin" <benjamin.walker@intel.com>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
Max Gurtovoy <mgurtovoy@nvidia.com>,
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 15:10:52 +0100 [thread overview]
Message-ID: <YK5W7F5DD4grBZLB@infradead.org> (raw)
In-Reply-To: <dc96c3cf-e895-77c0-3d1a-1bc7e96cfd40@grimberg.me>
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.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
next prev parent reply other threads:[~2021-05-26 15:20 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 [this message]
2021-05-26 14:49 ` Max Gurtovoy
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=YK5W7F5DD4grBZLB@infradead.org \
--to=hch@infradead.org \
--cc=benjamin.walker@intel.com \
--cc=israelr@nvidia.com \
--cc=linux-nvme@lists.infradead.org \
--cc=mgurtovoy@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox