From: Bart Van Assche <bart.vanassche@sandisk.com>
To: Sagi Grimberg <sagig@mellanox.com>, <linux-rdma@vger.kernel.org>
Cc: <linux-nfs@vger.kernel.org>,
"Nicholas A. Bellinger" <nab@linux-iscsi.org>
Subject: Re: [PATCH v2 15/26] IB/srp: Split srp_map_sg
Date: Fri, 25 Sep 2015 09:15:28 -0700 [thread overview]
Message-ID: <56057320.4010905@sandisk.com> (raw)
In-Reply-To: <1443116118-10730-16-git-send-email-sagig@mellanox.com>
On 09/24/2015 10:35 AM, Sagi Grimberg wrote:
> This is a perparation patch for the new registration API
^ preparation ?
> conversion. It splits srp_map_sg per registration strategy
> (srp_map_sg[fmr|fr|dma]. On its own it adds some code duplication,
> but it makes the API switch easier to comprehend.
>
> Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
> ---
> drivers/infiniband/ulp/srp/ib_srp.c | 156 ++++++++++++++++++++++++------------
> 1 file changed, 105 insertions(+), 51 deletions(-)
>
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index f8b9c18da03d..74748d1075fc 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -1286,6 +1286,17 @@ static int srp_map_finish_fmr(struct srp_map_state *state,
> if (WARN_ON_ONCE(state->fmr.next >= state->fmr.end))
> return -ENOMEM;
>
> + WARN_ON_ONCE(!dev->use_fmr);
> +
> + if (state->npages == 0)
> + return 0;
> +
> + if (state->npages == 1 && target->global_mr) {
> + srp_map_desc(state, state->base_dma_addr, state->dma_len,
> + target->global_mr->rkey);
> + return 0;
> + }
> +
The above is not correct. The npages and dma_len variables have to be
reset before returning. How about changing the "return 0" statement into
"goto reset_state" and adding a "reset_state" label ?
> fmr = ib_fmr_pool_map_phys(ch->fmr_pool, state->pages,
> state->npages, io_addr);
> if (IS_ERR(fmr))
> @@ -1297,6 +1308,9 @@ static int srp_map_finish_fmr(struct srp_map_state *state,
> srp_map_desc(state, state->base_dma_addr & ~dev->mr_page_mask,
> state->dma_len, fmr->fmr->rkey);
>
> + state->npages = 0;
> + state->dma_len = 0;
> +
> return 0;
> }
>
> @@ -1309,10 +1323,23 @@ static int srp_map_finish_fr(struct srp_map_state *state,
> struct ib_fast_reg_wr wr;
> struct srp_fr_desc *desc;
> u32 rkey;
> + int err;
> +
>
> if (WARN_ON_ONCE(state->fr.next >= state->fr.end))
> return -ENOMEM;
>
> + WARN_ON_ONCE(!dev->use_fast_reg);
> +
> + if (state->npages == 0)
> + return 0;
> +
> + if (state->npages == 1 && target->global_mr) {
> + srp_map_desc(state, state->base_dma_addr, state->dma_len,
> + target->global_mr->rkey);
> + return 0;
> + }
> +
Same comment here. npages and dma_len have to be reset before returning.
Bart.
next prev parent reply other threads:[~2015-09-25 16:29 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-24 17:34 [PATCH v2 00/26] New fast registration API Sagi Grimberg
2015-09-24 17:34 ` [PATCH v2 01/26] IB/core: Introduce new " Sagi Grimberg
2015-09-24 17:34 ` [PATCH v2 02/26] IB/mlx5: Remove dead fmr code Sagi Grimberg
2015-09-24 17:34 ` [PATCH v2 03/26] IB/mlx5: Support the new memory registration API Sagi Grimberg
2015-09-24 17:34 ` [PATCH v2 04/26] IB/mlx4: " Sagi Grimberg
2015-09-24 17:34 ` [PATCH v2 05/26] RDMA/ocrdma: " Sagi Grimberg
2015-09-24 17:34 ` [PATCH v2 06/26] RDMA/cxgb3: " Sagi Grimberg
2015-09-24 17:34 ` [PATCH v2 07/26] iw_cxgb4: " Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 08/26] IB/qib: " Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 09/26] RDMA/nes: " Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 10/26] IB/iser: Port to new fast " Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 11/26] iser-target: Port to new memory " Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 12/26] xprtrdma: " Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 13/26] svcrdma: " Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 14/26] RDS/IW: Convert " Sagi Grimberg
2015-09-24 17:43 ` santosh.shilimkar
2015-09-24 17:35 ` [PATCH v2 15/26] IB/srp: Split srp_map_sg Sagi Grimberg
2015-09-25 16:15 ` Bart Van Assche [this message]
2015-09-27 7:03 ` Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 16/26] IB/srp: Convert to new registration API Sagi Grimberg
2015-09-25 16:34 ` Bart Van Assche
2015-09-27 7:04 ` Sagi Grimberg
2015-10-01 18:10 ` Bart Van Assche
2015-09-24 17:35 ` [PATCH v2 17/26] IB/srp: Dont allocate a page vector when using fast_reg Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 18/26] IB/mlx5: Remove old FRWR API support Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 19/26] IB/mlx4: " Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 20/26] RDMA/ocrdma: Remove old FRWR API Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 21/26] RDMA/cxgb3: " Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 22/26] iw_cxgb4: " Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 23/26] IB/qib: " Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 24/26] RDMA/nes: " Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 25/26] IB/hfi1: Remove Old fast registraion API support Sagi Grimberg
2015-09-24 17:35 ` [PATCH v2 26/26] IB/core: Remove old fast registration API Sagi Grimberg
2015-09-28 19:32 ` [PATCH v2 00/26] New " Steve Wise
2015-10-08 6:03 ` Selvin Xavier
[not found] <1443116094-7969-1-git-send-email-sagig@mellanox.com>
2015-09-24 17:34 ` [PATCH v2 15/26] IB/srp: Split srp_map_sg 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=56057320.4010905@sandisk.com \
--to=bart.vanassche@sandisk.com \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=nab@linux-iscsi.org \
--cc=sagig@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;
as well as URLs for NNTP newsgroup(s).