From: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
To: Bart Van Assche <bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
Cc: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>,
dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org,
sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org,
linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
target-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 08/12] IB/core: generic RDMA READ/WRITE API
Date: Wed, 13 Apr 2016 15:50:42 +0200 [thread overview]
Message-ID: <20160413135042.GA14648@lst.de> (raw)
In-Reply-To: <570D8A42.9040107-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
On Tue, Apr 12, 2016 at 04:52:34PM -0700, Bart Van Assche wrote:
> Please clarify the comment above this function. The way that comment is
> written seems to contradict the code for iWARP writes.
Thanks, fixed.
>> + count++;
>> + } else {
>> + reg->inv_wr.next = NULL;
>> + }
>> +
>> + ret = ib_map_mr_sg(reg->mr, sg, nents, offset, PAGE_SIZE);
>> + if (ret < nents) {
>> + ib_mr_pool_put(qp, &qp->rdma_mrs, reg->mr);
>> + return -EINVAL;
>> + }
>
> The above code assumes that the length of each sg list element is lower
> than or equal to mr->page_size. I think this is something that should be
> documented since the block layer has to be configured explicitly to ensure
> this.
It shouldn't assume that - ib_map_mr_sg just uses PAGE_SIZE as
the MR granularuty. Note that the block layer isn't involved for any of
the users of this function - it's used on the target sides of iSER, SRP,
and (out of tree for a few more weeks) NVMe over fabrics. All of them
only provide 4k segments so while I think this code should handle larger
segments, there is no way to verify that until we have consumers that
provide larger segments. I think SCST had some allocator that could
use larger pages, and Pure Storage mention they had LIO changes to
use large pages as well, so if this comes up I think we should be
able to support it without too much effort.
>
>> + u32 pages_per_mr = rdma_rw_fr_page_list_len(qp->pd->device);
>> + int i, j, ret = 0, count = 0;
>> +
>> + ctx->nr_ops = (sg_cnt + pages_per_mr - 1) / pages_per_mr;
>> + ctx->reg = kcalloc(ctx->nr_ops, sizeof(*ctx->reg), GFP_KERNEL);
>> + if (!ctx->reg) {
>> + ret = -ENOMEM;
>> + goto out;
>> + }
>> +
>> + for (i = 0; i < ctx->nr_ops; i++) {
>> + struct rdma_rw_reg_ctx *prev = i ? &ctx->reg[i - 1] : NULL;
>> + struct rdma_rw_reg_ctx *reg = &ctx->reg[i];
>> + u32 nents = min(sg_cnt, pages_per_mr);
>
> The same min(sg_cnt, pages_per_mr) computation occurs here and in
> rdma_rw_init_one_mr(). Is there a way to avoid that duplication?
It's just a single min statement, so coming up with an inline function
to wrap seems a little too much overhead to me. If you have a better
suggestion I'd be happy to look into it.
>> +#define RDMA_RW_SINGLE_WR 0
>> +#define RDMA_RW_MULTI_WR 1
>> +#define RDMA_RW_MR 2
>
> The above constants are only used in the rw.c source file. Do we need these
> constants in the header file or can these be moved into source file rw.c?
I have moved them, and converted the constants to an enum while I was at
it.
Thanks for the review!
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-04-13 13:50 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-11 21:32 generic RDMA READ/WRITE API V6 Christoph Hellwig
[not found] ` <1460410360-13104-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-04-11 21:32 ` [PATCH 01/12] IB/mlx5: Expose correct max_sge_rd limit Christoph Hellwig
[not found] ` <1460410360-13104-2-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-04-17 13:53 ` Leon Romanovsky
[not found] ` <20160417135341.GC6349-2ukJVAZIZ/Y@public.gmane.org>
2016-04-17 18:06 ` Christoph Hellwig
2016-04-11 21:32 ` [PATCH 06/12] IB/core: add a simple MR pool Christoph Hellwig
2016-04-17 20:01 ` Sagi Grimberg
2016-04-19 3:19 ` Ira Weiny
2016-04-11 21:32 ` [PATCH 09/12] target: enhance and export target_alloc_sgl/target_free_sgl Christoph Hellwig
2016-04-11 21:32 ` [PATCH 02/12] IB/cma: pass the port number to ib_create_qp Christoph Hellwig
[not found] ` <1460410360-13104-3-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-04-15 17:55 ` Sagi Grimberg
2016-04-19 3:14 ` Ira Weiny
2016-04-19 17:30 ` Jason Gunthorpe
2016-04-19 18:38 ` Christoph Hellwig
[not found] ` <20160419183830.GB1211-jcswGhMUV9g@public.gmane.org>
2016-04-28 21:05 ` Doug Ledford
[not found] ` <20160419173032.GD20844-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-04-19 18:49 ` Sagi Grimberg
2016-04-19 19:24 ` Jason Gunthorpe
[not found] ` <20160419192430.GB27028-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-04-19 19:41 ` Steve Wise
2016-04-19 20:05 ` 'Christoph Hellwig'
2016-04-19 20:21 ` Jason Gunthorpe
[not found] ` <20160419200555.GA2561-jcswGhMUV9g@public.gmane.org>
2016-04-19 20:26 ` Steve Wise
2016-04-21 3:11 ` ira.weiny
2016-04-28 19:43 ` Hefty, Sean
2016-04-28 20:07 ` Jason Gunthorpe
2016-04-28 21:53 ` Hefty, Sean
2016-04-28 22:09 ` Jason Gunthorpe
2016-04-28 23:23 ` Hefty, Sean
2016-04-28 23:49 ` Jason Gunthorpe
2016-04-28 23:25 ` Weiny, Ira
[not found] ` <2807E5FD2F6FDA4886F6618EAC48510E22EC858F-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-04-29 0:01 ` Jason Gunthorpe
2016-04-11 21:32 ` [PATCH 03/12] IB/core: allow passing mapping an offset into the SG in ib_map_mr_sg Christoph Hellwig
[not found] ` <1460410360-13104-4-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-04-15 17:56 ` Sagi Grimberg
2016-04-11 21:32 ` [PATCH 04/12] IB/core: add a helper to check for READ WITH INVALIDATE support Christoph Hellwig
[not found] ` <1460410360-13104-5-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-04-15 17:56 ` Sagi Grimberg
2016-04-19 3:15 ` Ira Weiny
2016-04-11 21:32 ` [PATCH 05/12] IB/core: refactor ib_create_qp Christoph Hellwig
2016-04-17 20:00 ` Sagi Grimberg
[not found] ` <1460410360-13104-6-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-04-19 3:08 ` Ira Weiny
2016-04-11 21:32 ` [PATCH 07/12] IB/core: add a need_inval flag to struct ib_mr Christoph Hellwig
[not found] ` <1460410360-13104-8-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-04-17 20:01 ` Sagi Grimberg
2016-04-19 3:20 ` Ira Weiny
2016-04-11 21:32 ` [PATCH 08/12] IB/core: generic RDMA READ/WRITE API Christoph Hellwig
[not found] ` <1460410360-13104-9-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-04-12 23:52 ` Bart Van Assche
[not found] ` <570D8A42.9040107-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-13 13:50 ` Christoph Hellwig [this message]
2016-04-11 21:32 ` [PATCH 10/12] IB/srpt: convert to the " Christoph Hellwig
2016-04-13 18:57 ` Bart Van Assche
2016-04-14 13:32 ` Christoph Hellwig
2016-04-28 21:02 ` Doug Ledford
[not found] ` <57227A6D.4000802-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-04-29 6:34 ` Christoph Hellwig
[not found] ` <20160429063443.GA18893-jcswGhMUV9g@public.gmane.org>
2016-04-29 14:44 ` Doug Ledford
2016-04-11 21:32 ` [PATCH 11/12] IB/core: add RW API support for signature MRs Christoph Hellwig
[not found] ` <1460410360-13104-12-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-04-22 21:53 ` Bart Van Assche
2016-04-11 21:32 ` [PATCH 12/12] IB/isert: convert to the generic RDMA READ/WRITE API Christoph Hellwig
[not found] ` <1460410360-13104-13-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2016-04-28 21:04 ` Doug Ledford
2016-04-29 11:46 ` Sagi Grimberg
[not found] ` <572349AA.2070407-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2016-04-29 14:45 ` Doug Ledford
[not found] ` <e7959da7-79ca-0422-fbc9-9b3814516e1b-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-04-29 16:42 ` Leon Romanovsky
2016-04-12 18:31 ` generic RDMA READ/WRITE API V6 Steve Wise
2016-04-22 22:29 ` Bart Van Assche
[not found] ` <571AA5C8.4080502-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-02 15:15 ` Christoph Hellwig
[not found] ` <20160502151535.GA520-jcswGhMUV9g@public.gmane.org>
2016-05-02 19:08 ` Bart Van Assche
2016-05-02 22:14 ` Bart Van Assche
2016-05-03 8:40 ` Christoph Hellwig
2016-05-03 16:10 ` Bart Van Assche
[not found] ` <5727A5C7.1090009-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-03 14:31 ` Christoph Hellwig
[not found] ` <20160503143104.GA30342-jcswGhMUV9g@public.gmane.org>
2016-05-03 21:23 ` Bart Van Assche
-- strict thread matches above, loose matches on Subject: below --
2016-04-18 20:14 generic RDMA READ/WRITE API V7 Christoph Hellwig
2016-04-18 20:14 ` [PATCH 08/12] IB/core: generic RDMA READ/WRITE API Christoph Hellwig
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=20160413135042.GA14648@lst.de \
--to=hch-jcswghmuv9g@public.gmane.org \
--cc=bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org \
--cc=swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org \
--cc=target-devel-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 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.