From: yanjun.zhu@linux.dev
To: "Leon Romanovsky" <leon@kernel.org>, "Zhu Yanjun" <yanjun.zhu@intel.com>
Cc: mustafa.ismail@intel.com, shiraz.saleem@intel.com, jgg@ziepe.ca,
linux-rdma@vger.kernel.org
Subject: Re: [PATCHv2 for-next 1/4] RDMA/irdma: Split MEM handler into irdma_reg_user_mr_type_mem
Date: Mon, 16 Jan 2023 02:56:52 +0000 [thread overview]
Message-ID: <d1982dba14b26e7ea048cbc89eb18dfa@linux.dev> (raw)
In-Reply-To: <Y8PhY1RAcTmnPdPJ@unreal>
January 15, 2023 7:20 PM, "Leon Romanovsky" <leon@kernel.org> wrote:
> 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.
Got it.
Zhu Yanjun
>
> Thanks
next prev parent reply other threads:[~2023-01-16 2:56 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
2023-01-16 2:56 ` yanjun.zhu [this message]
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=d1982dba14b26e7ea048cbc89eb18dfa@linux.dev \
--to=yanjun.zhu@linux.dev \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mustafa.ismail@intel.com \
--cc=shiraz.saleem@intel.com \
--cc=yanjun.zhu@intel.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).