linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: keliu <liuke94@huawei.com>
Cc: bjorn@kernel.org, magnus.karlsson@intel.com,
	jonathan.lemon@gmail.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	ast@kernel.org, daniel@iogearbox.net, hawk@kernel.org,
	john.fastabend@gmail.com, netdev@vger.kernel.org,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: xdp: Directly use ida_alloc()/free()
Date: Fri, 27 May 2022 19:08:53 +0200	[thread overview]
Message-ID: <YpEFpVkxRRFi+Cs8@boxer> (raw)
In-Reply-To: <20220527064609.2358482-1-liuke94@huawei.com>

On Fri, May 27, 2022 at 06:46:09AM +0000, keliu wrote:
> Use ida_alloc()/ida_free() instead of deprecated
> ida_simple_get()/ida_simple_remove() .
> 
> Signed-off-by: keliu <liuke94@huawei.com>

Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>

For future AF_XDP related patches please specify the bpf-next tree in the
patch subject (or bpf if it's a fix).

Thanks!

> ---
>  net/xdp/xdp_umem.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/net/xdp/xdp_umem.c b/net/xdp/xdp_umem.c
> index f01ef6bda390..869b9b9b9fad 100644
> --- a/net/xdp/xdp_umem.c
> +++ b/net/xdp/xdp_umem.c
> @@ -57,7 +57,7 @@ static int xdp_umem_addr_map(struct xdp_umem *umem, struct page **pages,
>  static void xdp_umem_release(struct xdp_umem *umem)
>  {
>  	umem->zc = false;
> -	ida_simple_remove(&umem_ida, umem->id);
> +	ida_free(&umem_ida, umem->id);
>  
>  	xdp_umem_addr_unmap(umem);
>  	xdp_umem_unpin_pages(umem);
> @@ -242,7 +242,7 @@ struct xdp_umem *xdp_umem_create(struct xdp_umem_reg *mr)
>  	if (!umem)
>  		return ERR_PTR(-ENOMEM);
>  
> -	err = ida_simple_get(&umem_ida, 0, 0, GFP_KERNEL);
> +	err = ida_alloc(&umem_ida, GFP_KERNEL);
>  	if (err < 0) {
>  		kfree(umem);
>  		return ERR_PTR(err);
> @@ -251,7 +251,7 @@ struct xdp_umem *xdp_umem_create(struct xdp_umem_reg *mr)
>  
>  	err = xdp_umem_reg(umem, mr);
>  	if (err) {
> -		ida_simple_remove(&umem_ida, umem->id);
> +		ida_free(&umem_ida, umem->id);
>  		kfree(umem);
>  		return ERR_PTR(err);
>  	}
> -- 
> 2.25.1
> 

  reply	other threads:[~2022-05-27 17:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27  6:46 [PATCH] net: xdp: Directly use ida_alloc()/free() keliu
2022-05-27 17:08 ` Maciej Fijalkowski [this message]
2022-05-27 17:38   ` Jesper Dangaard Brouer
2022-05-30 19:20 ` patchwork-bot+netdevbpf

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=YpEFpVkxRRFi+Cs8@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=ast@kernel.org \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=jonathan.lemon@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuke94@huawei.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).