diff mbox series

net: xdp: Directly use ida_alloc()/free()

Message ID 20220527064609.2358482-1-liuke94@huawei.com (mailing list archive)
State Accepted
Commit 1626f57f061cb2a8c04798193ca63f11336aacde
Delegated to: BPF
Headers show
Series net: xdp: Directly use ida_alloc()/free() | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 2 this patch: 2
netdev/cc_maintainers warning 5 maintainers not CCed: songliubraving@fb.com yhs@fb.com kafai@fb.com andrii@kernel.org kpsingh@kernel.org
netdev/build_clang success Errors and warnings before: 7 this patch: 7
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 2 this patch: 2
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-VM_Test-3 success Logs for Kernel LATEST on z15 with gcc
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next-VM_Test-1 success Logs for Kernel LATEST on ubuntu-latest with gcc
bpf/vmtest-bpf-next-VM_Test-2 success Logs for Kernel LATEST on ubuntu-latest with llvm-15
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Ke Liu May 27, 2022, 6:46 a.m. UTC
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(-)

Comments

Maciej Fijalkowski May 27, 2022, 5:08 p.m. UTC | #1
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
>
Jesper Dangaard Brouer May 27, 2022, 5:38 p.m. UTC | #2
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
>>
>
patchwork-bot+netdevbpf@kernel.org May 30, 2022, 7:20 p.m. UTC | #3
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!
diff mbox series

Patch

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);
 	}