From: Leon Romanovsky <leon@kernel.org>
To: Zhu Yanjun <yanjun.zhu@intel.com>
Cc: mustafa.ismail@intel.com, shiraz.saleem@intel.com, jgg@ziepe.ca,
linux-rdma@vger.kernel.org, Zhu Yanjun <yanjun.zhu@linux.dev>
Subject: Re: [PATCHv2 for-next 1/4] RDMA/irdma: Split MEM handler into irdma_reg_user_mr_type_mem
Date: Sun, 15 Jan 2023 13:20:03 +0200 [thread overview]
Message-ID: <Y8PhY1RAcTmnPdPJ@unreal> (raw)
In-Reply-To: <20230112000617.1659337-2-yanjun.zhu@intel.com>
On Wed, Jan 11, 2023 at 07:06:14PM -0500, Zhu Yanjun wrote:
> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>
> The source codes related with IRDMA_MEMREG_TYPE_MEM are split
> into a new function irdma_reg_user_mr_type_mem.
>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> ---
> drivers/infiniband/hw/irdma/verbs.c | 81 +++++++++++++++++------------
> 1 file changed, 49 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
> index f4674ecf9c8c..b67c14aac0f2 100644
> --- a/drivers/infiniband/hw/irdma/verbs.c
> +++ b/drivers/infiniband/hw/irdma/verbs.c
> @@ -2745,6 +2745,53 @@ static int irdma_hwreg_mr(struct irdma_device *iwdev, struct irdma_mr *iwmr,
> return ret;
> }
>
> +static int irdma_reg_user_mr_type_mem(struct irdma_mr *iwmr, int access)
> +{
> + struct irdma_device *iwdev = to_iwdev(iwmr->ibmr.device);
> + int err;
> + bool use_pbles;
> + u32 stag;
> + struct irdma_pbl *iwpbl = &iwmr->iwpbl;
> +
> + use_pbles = (iwmr->page_cnt != 1);
> +
> + err = irdma_setup_pbles(iwdev->rf, iwmr, use_pbles, false);
> + if (err)
> + return err;
> +
> + if (use_pbles) {
> + err = irdma_check_mr_contiguous(&iwpbl->pble_alloc,
> + iwmr->page_size);
> + if (err) {
> + irdma_free_pble(iwdev->rf->pble_rsrc, &iwpbl->pble_alloc);
> + iwpbl->pbl_allocated = false;
> + }
> + }
> +
> + stag = irdma_create_stag(iwdev);
> + if (!stag) {
> + err = -ENOMEM;
> + goto free_pble;
> + }
> +
> + iwmr->stag = stag;
> + iwmr->ibmr.rkey = stag;
> + iwmr->ibmr.lkey = stag;
> + err = irdma_hwreg_mr(iwdev, iwmr, access);
> + if (err) {
> + irdma_free_stag(iwdev, stag);
> + goto free_pble;
Please add new goto label and put irdma_free_stag() there.
Thanks
next prev parent reply other threads:[~2023-01-15 11:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 0:06 [PATCHv2 for-next 0/4] RDMA/irdma: Refactor irdma_reg_user_mr function Zhu Yanjun
2023-01-12 0:06 ` [PATCHv2 for-next 1/4] RDMA/irdma: Split MEM handler into irdma_reg_user_mr_type_mem Zhu Yanjun
2023-01-15 11:20 ` Leon Romanovsky [this message]
2023-01-16 2:56 ` yanjun.zhu
2023-01-12 0:06 ` [PATCHv2 for-next 2/4] RDMA/irdma: Split mr alloc and free into new functions Zhu Yanjun
2023-01-12 0:06 ` [PATCHv2 for-next 3/4] RDMA/irdma: Split QP handler into irdma_reg_user_mr_type_qp Zhu Yanjun
2023-01-15 11:23 ` Leon Romanovsky
2023-01-16 2:58 ` yanjun.zhu
2023-01-12 0:06 ` [PATCHv2 for-next 4/4] RDMA/irdma: Split CQ handler into irdma_reg_user_mr_type_cq Zhu Yanjun
2023-01-15 11:28 ` Leon Romanovsky
2023-01-16 3:03 ` yanjun.zhu
2023-01-12 16:42 ` [PATCHv2 for-next 0/4] RDMA/irdma: Refactor irdma_reg_user_mr function Saleem, Shiraz
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=Y8PhY1RAcTmnPdPJ@unreal \
--to=leon@kernel.org \
--cc=jgg@ziepe.ca \
--cc=linux-rdma@vger.kernel.org \
--cc=mustafa.ismail@intel.com \
--cc=shiraz.saleem@intel.com \
--cc=yanjun.zhu@intel.com \
--cc=yanjun.zhu@linux.dev \
/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.