diff mbox series

[bpf-next,8/8] selftests/bpf: Drop duplicate bpf_map_lookup_elem in test_sockmap

Message ID ea8458462b876ee445173e3effb535fd126137ed.1716446893.git.tanggeliang@kylinos.cn
State New
Headers show
Series fixes for test_sockmap | expand

Commit Message

Geliang Tang May 23, 2024, 6:50 a.m. UTC
From: Geliang Tang <tanggeliang@kylinos.cn>

bpf_map_lookup_elem is invoked in bpf_prog3() already, no need to invoke
it again. This patch drops it.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
---
 tools/testing/selftests/bpf/progs/test_sockmap_kern.h | 3 ---
 1 file changed, 3 deletions(-)

Comments

John Fastabend May 27, 2024, 5:06 p.m. UTC | #1
Geliang Tang wrote:
> From: Geliang Tang <tanggeliang@kylinos.cn>
> 
> bpf_map_lookup_elem is invoked in bpf_prog3() already, no need to invoke
> it again. This patch drops it.
> 
> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
> ---
>  tools/testing/selftests/bpf/progs/test_sockmap_kern.h | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/progs/test_sockmap_kern.h b/tools/testing/selftests/bpf/progs/test_sockmap_kern.h
> index 99d2ea9fb658..2399958991e7 100644
> --- a/tools/testing/selftests/bpf/progs/test_sockmap_kern.h
> +++ b/tools/testing/selftests/bpf/progs/test_sockmap_kern.h
> @@ -177,9 +177,6 @@ int bpf_prog3(struct __sk_buff *skb)
>  		return bpf_sk_redirect_hash(skb, &tls_sock_map, &ret, flags);
>  #endif
>  	}
> -	f = bpf_map_lookup_elem(&sock_skb_opts, &one);
> -	if (f && *f)
> -		ret = SK_DROP;
>  	err = bpf_skb_adjust_room(skb, 4, 0, 0);
>  	if (err)
>  		return SK_DROP;
> -- 
> 2.43.0
> 

Acked-by: John Fastabend <john.fastabend@gmail.com>
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/progs/test_sockmap_kern.h b/tools/testing/selftests/bpf/progs/test_sockmap_kern.h
index 99d2ea9fb658..2399958991e7 100644
--- a/tools/testing/selftests/bpf/progs/test_sockmap_kern.h
+++ b/tools/testing/selftests/bpf/progs/test_sockmap_kern.h
@@ -177,9 +177,6 @@  int bpf_prog3(struct __sk_buff *skb)
 		return bpf_sk_redirect_hash(skb, &tls_sock_map, &ret, flags);
 #endif
 	}
-	f = bpf_map_lookup_elem(&sock_skb_opts, &one);
-	if (f && *f)
-		ret = SK_DROP;
 	err = bpf_skb_adjust_room(skb, 4, 0, 0);
 	if (err)
 		return SK_DROP;