All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: xdp: Directly use ida_alloc()/free()
@ 2022-05-27  6:46 keliu
  2022-05-27 17:08 ` Maciej Fijalkowski
  2022-05-30 19:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: keliu @ 2022-05-27  6:46 UTC (permalink / raw)
  To: bjorn, magnus.karlsson, maciej.fijalkowski, jonathan.lemon,
	davem, edumazet, kuba, pabeni, ast, daniel, hawk, john.fastabend,
	netdev, bpf, linux-kernel
  Cc: keliu

Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .

Signed-off-by: keliu <liuke94@huawei.com>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: xdp: Directly use ida_alloc()/free()
  2022-05-27  6:46 [PATCH] net: xdp: Directly use ida_alloc()/free() keliu
@ 2022-05-27 17:08 ` Maciej Fijalkowski
  2022-05-27 17:38   ` Jesper Dangaard Brouer
  2022-05-30 19:20 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Maciej Fijalkowski @ 2022-05-27 17:08 UTC (permalink / raw)
  To: keliu
  Cc: bjorn, magnus.karlsson, jonathan.lemon, davem, edumazet, kuba,
	pabeni, ast, daniel, hawk, john.fastabend, netdev, bpf,
	linux-kernel

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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: xdp: Directly use ida_alloc()/free()
  2022-05-27 17:08 ` Maciej Fijalkowski
@ 2022-05-27 17:38   ` Jesper Dangaard Brouer
  0 siblings, 0 replies; 4+ messages in thread
From: Jesper Dangaard Brouer @ 2022-05-27 17:38 UTC (permalink / raw)
  To: Maciej Fijalkowski, keliu
  Cc: brouer, bjorn, magnus.karlsson, jonathan.lemon, davem, edumazet,
	kuba, pabeni, ast, daniel, hawk, john.fastabend, netdev, bpf,
	linux-kernel



On 27/05/2022 19.08, Maciej Fijalkowski wrote:
> 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>

Could you use your full name with capital letters?

> 
> 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).

I agree.

Could you also take care of net/core/xdp.c ?

Patch LGTM

Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>


>> ---
>>   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
>>
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: xdp: Directly use ida_alloc()/free()
  2022-05-27  6:46 [PATCH] net: xdp: Directly use ida_alloc()/free() keliu
  2022-05-27 17:08 ` Maciej Fijalkowski
@ 2022-05-30 19:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-05-30 19:20 UTC (permalink / raw)
  To: Ke Liu
  Cc: bjorn, magnus.karlsson, maciej.fijalkowski, jonathan.lemon,
	davem, edumazet, kuba, pabeni, ast, daniel, hawk, john.fastabend,
	netdev, bpf, linux-kernel

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Fri, 27 May 2022 06:46:09 +0000 you wrote:
> Use ida_alloc()/ida_free() instead of deprecated
> ida_simple_get()/ida_simple_remove() .
> 
> Signed-off-by: keliu <liuke94@huawei.com>
> ---
>  net/xdp/xdp_umem.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Here is the summary with links:
  - net: xdp: Directly use ida_alloc()/free()
    https://git.kernel.org/bpf/bpf-next/c/1626f57f061c

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-30 19:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-27  6:46 [PATCH] net: xdp: Directly use ida_alloc()/free() keliu
2022-05-27 17:08 ` Maciej Fijalkowski
2022-05-27 17:38   ` Jesper Dangaard Brouer
2022-05-30 19:20 ` patchwork-bot+netdevbpf

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.