diff mbox series

[bpf-next] net: netfilter: Remove ifdefs for code shared by BPF and ctnetlink

Message ID 20220725085130.11553-1-memxor@gmail.com (mailing list archive)
State Accepted
Commit 6e116280b41b0cbfd90dfe9fa66e07ff348d50d5
Delegated to: BPF
Headers show
Series [bpf-next] net: netfilter: Remove ifdefs for code shared by BPF and ctnetlink | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
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: 46 this patch: 46
netdev/cc_maintainers warning 7 maintainers not CCed: pabeni@redhat.com kuba@kernel.org fw@strlen.de kadlec@netfilter.org edumazet@google.com davem@davemloft.net coreteam@netfilter.org
netdev/build_clang success Errors and warnings before: 5 this patch: 5
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: 46 this patch: 46
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 29 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-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-16
bpf/vmtest-bpf-next-VM_Test-3 success Logs for Kernel LATEST on z15 with gcc

Commit Message

Kumar Kartikeya Dwivedi July 25, 2022, 8:51 a.m. UTC
The current ifdefry for code shared by the BPF and ctnetlink side looks
ugly. As per Pablo's request, simplify this by unconditionally compiling
in the code. This can be revisited when the shared code between the two
grows further.

Suggested-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
---
 include/net/netfilter/nf_conntrack_core.h | 6 ------
 net/netfilter/nf_conntrack_core.c         | 6 ------
 2 files changed, 12 deletions(-)

--
2.34.1

Comments

Kumar Kartikeya Dwivedi Aug. 5, 2022, 10:55 p.m. UTC | #1
On Mon, 25 Jul 2022 at 10:51, Kumar Kartikeya Dwivedi <memxor@gmail.com> wrote:
>
> The current ifdefry for code shared by the BPF and ctnetlink side looks
> ugly. As per Pablo's request, simplify this by unconditionally compiling
> in the code. This can be revisited when the shared code between the two
> grows further.
>
> Suggested-by: Pablo Neira Ayuso <pablo@netfilter.org>
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
> ---

Pablo, presumably this needs your ack before it can be applied, as it
is marked Needs Ack in patchwork.

>  include/net/netfilter/nf_conntrack_core.h | 6 ------
>  net/netfilter/nf_conntrack_core.c         | 6 ------
>  2 files changed, 12 deletions(-)
>
> diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
> index 3cd3a6e631aa..b2b9de70d9f4 100644
> --- a/include/net/netfilter/nf_conntrack_core.h
> +++ b/include/net/netfilter/nf_conntrack_core.h
> @@ -86,10 +86,6 @@ extern spinlock_t nf_conntrack_expect_lock;
>
>  /* ctnetlink code shared by both ctnetlink and nf_conntrack_bpf */
>
> -#if (IS_BUILTIN(CONFIG_NF_CONNTRACK) && IS_ENABLED(CONFIG_DEBUG_INFO_BTF)) || \
> -    (IS_MODULE(CONFIG_NF_CONNTRACK) && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES) || \
> -    IS_ENABLED(CONFIG_NF_CT_NETLINK))
> -
>  static inline void __nf_ct_set_timeout(struct nf_conn *ct, u64 timeout)
>  {
>         if (timeout > INT_MAX)
> @@ -101,6 +97,4 @@ int __nf_ct_change_timeout(struct nf_conn *ct, u64 cta_timeout);
>  void __nf_ct_change_status(struct nf_conn *ct, unsigned long on, unsigned long off);
>  int nf_ct_change_status_common(struct nf_conn *ct, unsigned int status);
>
> -#endif
> -
>  #endif /* _NF_CONNTRACK_CORE_H */
> diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
> index 66a0aa8dbc3b..afe02772c010 100644
> --- a/net/netfilter/nf_conntrack_core.c
> +++ b/net/netfilter/nf_conntrack_core.c
> @@ -2787,10 +2787,6 @@ int nf_conntrack_init_net(struct net *net)
>         return ret;
>  }
>
> -#if (IS_BUILTIN(CONFIG_NF_CONNTRACK) && IS_ENABLED(CONFIG_DEBUG_INFO_BTF)) || \
> -    (IS_MODULE(CONFIG_NF_CONNTRACK) && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES) || \
> -    IS_ENABLED(CONFIG_NF_CT_NETLINK))
> -
>  /* ctnetlink code shared by both ctnetlink and nf_conntrack_bpf */
>
>  int __nf_ct_change_timeout(struct nf_conn *ct, u64 timeout)
> @@ -2846,5 +2842,3 @@ int nf_ct_change_status_common(struct nf_conn *ct, unsigned int status)
>         return 0;
>  }
>  EXPORT_SYMBOL_GPL(nf_ct_change_status_common);
> -
> -#endif
> --
> 2.34.1
>
patchwork-bot+netdevbpf@kernel.org Aug. 9, 2022, 4:50 p.m. UTC | #2
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Mon, 25 Jul 2022 10:51:30 +0200 you wrote:
> The current ifdefry for code shared by the BPF and ctnetlink side looks
> ugly. As per Pablo's request, simplify this by unconditionally compiling
> in the code. This can be revisited when the shared code between the two
> grows further.
> 
> Suggested-by: Pablo Neira Ayuso <pablo@netfilter.org>
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
> 
> [...]

Here is the summary with links:
  - [bpf-next] net: netfilter: Remove ifdefs for code shared by BPF and ctnetlink
    https://git.kernel.org/bpf/bpf-next/c/6e116280b41b

You are awesome, thank you!
diff mbox series

Patch

diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 3cd3a6e631aa..b2b9de70d9f4 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -86,10 +86,6 @@  extern spinlock_t nf_conntrack_expect_lock;

 /* ctnetlink code shared by both ctnetlink and nf_conntrack_bpf */

-#if (IS_BUILTIN(CONFIG_NF_CONNTRACK) && IS_ENABLED(CONFIG_DEBUG_INFO_BTF)) || \
-    (IS_MODULE(CONFIG_NF_CONNTRACK) && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES) || \
-    IS_ENABLED(CONFIG_NF_CT_NETLINK))
-
 static inline void __nf_ct_set_timeout(struct nf_conn *ct, u64 timeout)
 {
 	if (timeout > INT_MAX)
@@ -101,6 +97,4 @@  int __nf_ct_change_timeout(struct nf_conn *ct, u64 cta_timeout);
 void __nf_ct_change_status(struct nf_conn *ct, unsigned long on, unsigned long off);
 int nf_ct_change_status_common(struct nf_conn *ct, unsigned int status);

-#endif
-
 #endif /* _NF_CONNTRACK_CORE_H */
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 66a0aa8dbc3b..afe02772c010 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -2787,10 +2787,6 @@  int nf_conntrack_init_net(struct net *net)
 	return ret;
 }

-#if (IS_BUILTIN(CONFIG_NF_CONNTRACK) && IS_ENABLED(CONFIG_DEBUG_INFO_BTF)) || \
-    (IS_MODULE(CONFIG_NF_CONNTRACK) && IS_ENABLED(CONFIG_DEBUG_INFO_BTF_MODULES) || \
-    IS_ENABLED(CONFIG_NF_CT_NETLINK))
-
 /* ctnetlink code shared by both ctnetlink and nf_conntrack_bpf */

 int __nf_ct_change_timeout(struct nf_conn *ct, u64 timeout)
@@ -2846,5 +2842,3 @@  int nf_ct_change_status_common(struct nf_conn *ct, unsigned int status)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(nf_ct_change_status_common);
-
-#endif