Re: [PATCHv2 for-next 1/4] RDMA/irdma: Split MEM handler into irdma_reg_user_mr_type_mem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



January 15, 2023 7:20 PM, "Leon Romanovsky" <leon@xxxxxxxxxx> wrote:

> On Wed, Jan 11, 2023 at 07:06:14PM -0500, Zhu Yanjun wrote:
> 
>> From: Zhu Yanjun <yanjun.zhu@xxxxxxxxx>
>> 
>> 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@xxxxxxxxx>
>> ---
>> 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




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux