Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Cheng Xu <chengyou@linux.alibaba.com>
Cc: jgg@ziepe.ca, linux-rdma@vger.kernel.org, KaiShen@linux.alibaba.com
Subject: Re: [PATCH for-next v2 3/4] RDMA/erdma: Unify userspace and kernel queue buffer management
Date: Thu, 3 Sep 2026 12:12:46 +0300	[thread overview]
Message-ID: <20260903091246.GZ24140@unreal> (raw)
In-Reply-To: <20260827082523.36294-4-chengyou@linux.alibaba.com>

On Thu, Aug 27, 2026 at 04:25:22PM +0800, Cheng Xu wrote:
> Userspace and kernel space queue buffers use separate helpers despite
> sharing MTT metadata and lifetime rules. Manage both through
> erdma_mem_init() and erdma_mem_uninit(), while keeping backing allocation
> and release type-specific.
> 
> Signed-off-by: Cheng Xu <chengyou@linux.alibaba.com>
> ---
>  drivers/infiniband/hw/erdma/erdma_verbs.c | 281 ++++++++++++++--------
>  drivers/infiniband/hw/erdma/erdma_verbs.h |  17 +-
>  2 files changed, 191 insertions(+), 107 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/erdma/erdma_verbs.c b/drivers/infiniband/hw/erdma/erdma_verbs.c
> index b0a47c82cbdf..aaef2b3621b0 100644
> --- a/drivers/infiniband/hw/erdma/erdma_verbs.c
> +++ b/drivers/infiniband/hw/erdma/erdma_verbs.c
> @@ -19,9 +19,9 @@
>  #include "erdma_cm.h"
>  #include "erdma_verbs.h"

<...>

> -static int get_mtt_entries(struct erdma_dev *dev, struct erdma_mem *mem,
> -			   u64 start, u64 len, int access, u64 virt,
> -			   unsigned long req_page_size, bool force_continuous)
> +static void erdma_mem_free(struct erdma_dev *dev, struct erdma_mem *mem)
>  {
> -	int ret = 0;
> +	switch (mem->type) {
> +	case ERDMA_UMEM:
> +		if (mem->umem) {

I expect that if you call to this function, mem->umem is already valid.

> +			ib_umem_release(mem->umem);
> +			mem->umem = NULL;
> +		}
> +		break;
> +	case ERDMA_KMEM:
> +		erdma_kmem_free(dev, mem);
> +		break;
> +	default:
> +		break;
> +	}
> +}
>  

Thanks

  reply	other threads:[~2026-09-03  9:12 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-27  8:25 [PATCH for-next v2 0/4] RDMA/erdma: Support non-contiguous kernel queue buffers Cheng Xu
2026-08-27  8:25 ` [PATCH for-next v2 1/4] RDMA/erdma: Support non-contiguous kernel QP buffers Cheng Xu
2026-09-03  9:10   ` Leon Romanovsky
2026-09-03 12:38     ` Cheng Xu
2026-08-27  8:25 ` [PATCH for-next v2 2/4] RDMA/erdma: Support non-contiguous kernel CQ buffers Cheng Xu
2026-08-27  8:25 ` [PATCH for-next v2 3/4] RDMA/erdma: Unify userspace and kernel queue buffer management Cheng Xu
2026-09-03  9:12   ` Leon Romanovsky [this message]
2026-09-03 12:40     ` Cheng Xu
2026-08-27  8:25 ` [PATCH for-next v2 4/4] RDMA/erdma: Move kernel QP helpers after memory helpers Cheng Xu

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=20260903091246.GZ24140@unreal \
    --to=leon@kernel.org \
    --cc=KaiShen@linux.alibaba.com \
    --cc=chengyou@linux.alibaba.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox