diff mbox series

[v2,net-next,1/4] net: introduce EXPORT_IPV6_MOD() and EXPORT_IPV6_MOD_GPL()

Message ID 20250212132418.1524422-2-edumazet@google.com (mailing list archive)
State Accepted
Commit 54568a84c95bdea20227cf48d41f198d083e78dd
Delegated to: Netdev Maintainers
Headers show
Series net: add EXPORT_IPV6_MOD() | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 12 this patch: 12
netdev/build_tools success Errors and warnings before: 26 (+1) this patch: 26 (+1)
netdev/cc_maintainers warning 1 maintainers not CCed: dsahern@kernel.org
netdev/build_clang success Errors and warnings before: 2115 this patch: 2115
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
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: 1743 this patch: 1743
netdev/checkpatch warning WARNING: Argument 'X' is not used in function-like macro
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-02-13--12-00 (tests: 889)

Commit Message

Eric Dumazet Feb. 12, 2025, 1:24 p.m. UTC
We have many EXPORT_SYMBOL(x) in networking tree because IPv6
can be built as a module.

CONFIG_IPV6=y is becoming the norm.

Define a EXPORT_IPV6_MOD(x) which only exports x
for modular IPv6.

Same principle applies to EXPORT_IPV6_MOD_GPL()

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/net/ip.h | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Kuniyuki Iwashima Feb. 13, 2025, 3:51 a.m. UTC | #1
From: Eric Dumazet <edumazet@google.com>
Date: Wed, 12 Feb 2025 13:24:15 +0000
> We have many EXPORT_SYMBOL(x) in networking tree because IPv6
> can be built as a module.
> 
> CONFIG_IPV6=y is becoming the norm.
> 
> Define a EXPORT_IPV6_MOD(x) which only exports x
> for modular IPv6.
> 
> Same principle applies to EXPORT_IPV6_MOD_GPL()
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Mateusz Polchlopek Feb. 13, 2025, 7:26 a.m. UTC | #2
On 2/12/2025 2:24 PM, Eric Dumazet wrote:
> We have many EXPORT_SYMBOL(x) in networking tree because IPv6
> can be built as a module.
> 
> CONFIG_IPV6=y is becoming the norm.
> 
> Define a EXPORT_IPV6_MOD(x) which only exports x
> for modular IPv6.
> 
> Same principle applies to EXPORT_IPV6_MOD_GPL()
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
>   include/net/ip.h | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/include/net/ip.h b/include/net/ip.h
> index 9f5e33e371fcdd8ea88c54584b8d4b6c50e7d0c9..1e40c5ac53a74e1c20157709e49edf2271e44fe3 100644
> --- a/include/net/ip.h
> +++ b/include/net/ip.h
> @@ -666,6 +666,14 @@ static inline void ip_ipgre_mc_map(__be32 naddr, const unsigned char *broadcast,
>   		memcpy(buf, &naddr, sizeof(naddr));
>   }
>   
> +#if IS_MODULE(CONFIG_IPV6)
> +#define EXPORT_IPV6_MOD(X) EXPORT_SYMBOL(X)
> +#define EXPORT_IPV6_MOD_GPL(X) EXPORT_SYMBOL_GPL(X)
> +#else
> +#define EXPORT_IPV6_MOD(X)
> +#define EXPORT_IPV6_MOD_GPL(X)
> +#endif
> +
>   #if IS_ENABLED(CONFIG_IPV6)
>   #include <linux/ipv6.h>
>   #endif

Reviewed-by: Mateusz Polchlopek <mateusz.polchlopek@intel.com>
diff mbox series

Patch

diff --git a/include/net/ip.h b/include/net/ip.h
index 9f5e33e371fcdd8ea88c54584b8d4b6c50e7d0c9..1e40c5ac53a74e1c20157709e49edf2271e44fe3 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -666,6 +666,14 @@  static inline void ip_ipgre_mc_map(__be32 naddr, const unsigned char *broadcast,
 		memcpy(buf, &naddr, sizeof(naddr));
 }
 
+#if IS_MODULE(CONFIG_IPV6)
+#define EXPORT_IPV6_MOD(X) EXPORT_SYMBOL(X)
+#define EXPORT_IPV6_MOD_GPL(X) EXPORT_SYMBOL_GPL(X)
+#else
+#define EXPORT_IPV6_MOD(X)
+#define EXPORT_IPV6_MOD_GPL(X)
+#endif
+
 #if IS_ENABLED(CONFIG_IPV6)
 #include <linux/ipv6.h>
 #endif