netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next v1] bpf: Remove the unnecessary insn buffer comparison
@ 2023-01-08 15:12 Haiyue Wang
  2023-01-09 17:39 ` sdf
  2023-01-10 22:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Haiyue Wang @ 2023-01-08 15:12 UTC (permalink / raw)
  To: bpf
  Cc: Haiyue Wang, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	open list:BPF [NETWORKING] (tc BPF, sock_addr),
	open list

The variable 'insn' is initialized to 'insn_buf' without being changed,
only some helper macros are defined, so the insn buffer comparison is
unnecessary, just remove it.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
---
 net/core/filter.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/net/core/filter.c b/net/core/filter.c
index ab811293ae5d..d9befa6ba04e 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -6847,9 +6847,6 @@ u32 bpf_tcp_sock_convert_ctx_access(enum bpf_access_type type,
 					FIELD));			\
 	} while (0)
 
-	if (insn > insn_buf)
-		return insn - insn_buf;
-
 	switch (si->off) {
 	case offsetof(struct bpf_tcp_sock, rtt_min):
 		BUILD_BUG_ON(sizeof_field(struct tcp_sock, rtt_min) !=
@@ -10147,9 +10144,6 @@ static u32 sock_ops_convert_ctx_access(enum bpf_access_type type,
 			SOCK_OPS_GET_FIELD(BPF_FIELD, OBJ_FIELD, OBJ);	      \
 	} while (0)
 
-	if (insn > insn_buf)
-		return insn - insn_buf;
-
 	switch (si->off) {
 	case offsetof(struct bpf_sock_ops, op):
 		*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct bpf_sock_ops_kern,
-- 
2.39.0


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

* Re: [PATCH bpf-next v1] bpf: Remove the unnecessary insn buffer comparison
  2023-01-08 15:12 [PATCH bpf-next v1] bpf: Remove the unnecessary insn buffer comparison Haiyue Wang
@ 2023-01-09 17:39 ` sdf
  2023-01-09 23:52   ` Wang, Haiyue
  2023-01-10 22:20 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: sdf @ 2023-01-09 17:39 UTC (permalink / raw)
  To: Haiyue Wang
  Cc: bpf, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Hao Luo, Jiri Olsa, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

On 01/08, Haiyue Wang wrote:
> The variable 'insn' is initialized to 'insn_buf' without being changed,
> only some helper macros are defined, so the insn buffer comparison is
> unnecessary, just remove it.

> Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>

Acked-by: Stanislav Fomichev <sdf@google.com>

Looks like these should have been removed as part of commit 2377b81de527
("bpf: split shared bpf_tcp_sock and bpf_sock_ops implementation").

> ---
>   net/core/filter.c | 6 ------
>   1 file changed, 6 deletions(-)

> diff --git a/net/core/filter.c b/net/core/filter.c
> index ab811293ae5d..d9befa6ba04e 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -6847,9 +6847,6 @@ u32 bpf_tcp_sock_convert_ctx_access(enum  
> bpf_access_type type,
>   					FIELD));			\
>   	} while (0)

> -	if (insn > insn_buf)
> -		return insn - insn_buf;
> -
>   	switch (si->off) {
>   	case offsetof(struct bpf_tcp_sock, rtt_min):
>   		BUILD_BUG_ON(sizeof_field(struct tcp_sock, rtt_min) !=
> @@ -10147,9 +10144,6 @@ static u32 sock_ops_convert_ctx_access(enum  
> bpf_access_type type,
>   			SOCK_OPS_GET_FIELD(BPF_FIELD, OBJ_FIELD, OBJ);	      \
>   	} while (0)

> -	if (insn > insn_buf)
> -		return insn - insn_buf;
> -
>   	switch (si->off) {
>   	case offsetof(struct bpf_sock_ops, op):
>   		*insn++ = BPF_LDX_MEM(BPF_FIELD_SIZEOF(struct bpf_sock_ops_kern,
> --
> 2.39.0


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

* RE: [PATCH bpf-next v1] bpf: Remove the unnecessary insn buffer comparison
  2023-01-09 17:39 ` sdf
@ 2023-01-09 23:52   ` Wang, Haiyue
  0 siblings, 0 replies; 4+ messages in thread
From: Wang, Haiyue @ 2023-01-09 23:52 UTC (permalink / raw)
  To: sdf
  Cc: bpf, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, Hao Luo, Jiri Olsa, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, linux-kernel

> -----Original Message-----
> From: sdf@google.com <sdf@google.com>
> Sent: Tuesday, January 10, 2023 01:39
> To: Wang, Haiyue <haiyue.wang@intel.com>
> Cc: bpf@vger.kernel.org; Alexei Starovoitov <ast@kernel.org>; Daniel Borkmann <daniel@iogearbox.net>;
> Andrii Nakryiko <andrii@kernel.org>; Martin KaFai Lau <martin.lau@linux.dev>; Song Liu
> <song@kernel.org>; Yonghong Song <yhs@fb.com>; John Fastabend <john.fastabend@gmail.com>; KP Singh
> <kpsingh@kernel.org>; Hao Luo <haoluo@google.com>; Jiri Olsa <jolsa@kernel.org>; David S. Miller
> <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo
> Abeni <pabeni@redhat.com>; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH bpf-next v1] bpf: Remove the unnecessary insn buffer comparison
> 
> On 01/08, Haiyue Wang wrote:
> > The variable 'insn' is initialized to 'insn_buf' without being changed,
> > only some helper macros are defined, so the insn buffer comparison is
> > unnecessary, just remove it.
> 
> > Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
> 
> Acked-by: Stanislav Fomichev <sdf@google.com>
> 
> Looks like these should have been removed as part of commit 2377b81de527
> ("bpf: split shared bpf_tcp_sock and bpf_sock_ops implementation").
> 

Thanks for the information, yes, it was missed. ;-)

> > ---
> >   net/core/filter.c | 6 ------
> >   1 file changed, 6 deletions(-)
> 


> > --
> > 2.39.0


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

* Re: [PATCH bpf-next v1] bpf: Remove the unnecessary insn buffer comparison
  2023-01-08 15:12 [PATCH bpf-next v1] bpf: Remove the unnecessary insn buffer comparison Haiyue Wang
  2023-01-09 17:39 ` sdf
@ 2023-01-10 22:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-01-10 22:20 UTC (permalink / raw)
  To: Wang, Haiyue
  Cc: bpf, ast, daniel, andrii, martin.lau, song, yhs, john.fastabend,
	kpsingh, sdf, haoluo, jolsa, davem, edumazet, kuba, pabeni,
	netdev, linux-kernel

Hello:

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

On Sun,  8 Jan 2023 23:12:57 +0800 you wrote:
> The variable 'insn' is initialized to 'insn_buf' without being changed,
> only some helper macros are defined, so the insn buffer comparison is
> unnecessary, just remove it.
> 
> Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
> ---
>  net/core/filter.c | 6 ------
>  1 file changed, 6 deletions(-)

Here is the summary with links:
  - [bpf-next,v1] bpf: Remove the unnecessary insn buffer comparison
    https://git.kernel.org/bpf/bpf-next/c/66cf99b55e58

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:[~2023-01-10 22:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-08 15:12 [PATCH bpf-next v1] bpf: Remove the unnecessary insn buffer comparison Haiyue Wang
2023-01-09 17:39 ` sdf
2023-01-09 23:52   ` Wang, Haiyue
2023-01-10 22:20 ` patchwork-bot+netdevbpf

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