netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] net: add EXPORT_IPV6_MOD()
@ 2025-02-10  8:28 Eric Dumazet
  2025-02-10  8:28 ` [PATCH net-next 1/4] net: introduce EXPORT_IPV6_MOD() and EXPORT_IPV6_MOD_GPL() Eric Dumazet
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Eric Dumazet @ 2025-02-10  8:28 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, Willem de Bruijn, Simon Horman, eric.dumazet,
	Eric Dumazet

In this series I am adding EXPORT_IPV6_MOD and EXPORT_IPV6_MOD_GPL()
so that we can replace some EXPORT_SYMBOL() when IPV6 is
not modular.

This is making all the selected symbols internal to core
linux networking.

Eric Dumazet (4):
  net: introduce EXPORT_IPV6_MOD() and EXPORT_IPV6_MOD_GPL()
  inetpeer: use EXPORT_IPV6_MOD[_GPL]()
  tcp: use EXPORT_IPV6_MOD[_GPL]()
  udp: use EXPORT_IPV6_MOD[_GPL]()

 include/net/ip.h         |  8 ++++++
 net/core/secure_seq.c    |  4 +--
 net/ipv4/inetpeer.c      |  8 +++---
 net/ipv4/syncookies.c    |  8 +++---
 net/ipv4/tcp.c           | 48 ++++++++++++++++-----------------
 net/ipv4/tcp_fastopen.c  |  2 +-
 net/ipv4/tcp_input.c     | 14 +++++-----
 net/ipv4/tcp_ipv4.c      | 47 ++++++++++++++++-----------------
 net/ipv4/tcp_minisocks.c | 11 ++++----
 net/ipv4/tcp_output.c    | 12 ++++-----
 net/ipv4/tcp_timer.c     |  4 +--
 net/ipv4/udp.c           | 57 ++++++++++++++++++++--------------------
 12 files changed, 114 insertions(+), 109 deletions(-)

-- 
2.48.1.502.g6dc24dfdaf-goog


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

* [PATCH net-next 1/4] net: introduce EXPORT_IPV6_MOD() and EXPORT_IPV6_MOD_GPL()
  2025-02-10  8:28 [PATCH net-next 0/4] net: add EXPORT_IPV6_MOD() Eric Dumazet
@ 2025-02-10  8:28 ` Eric Dumazet
  2025-02-10  8:28 ` [PATCH net-next 2/4] inetpeer: use EXPORT_IPV6_MOD[_GPL]() Eric Dumazet
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 19+ messages in thread
From: Eric Dumazet @ 2025-02-10  8:28 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, Willem de Bruijn, Simon Horman, eric.dumazet,
	Eric Dumazet

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
-- 
2.48.1.502.g6dc24dfdaf-goog


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

* [PATCH net-next 2/4] inetpeer: use EXPORT_IPV6_MOD[_GPL]()
  2025-02-10  8:28 [PATCH net-next 0/4] net: add EXPORT_IPV6_MOD() Eric Dumazet
  2025-02-10  8:28 ` [PATCH net-next 1/4] net: introduce EXPORT_IPV6_MOD() and EXPORT_IPV6_MOD_GPL() Eric Dumazet
@ 2025-02-10  8:28 ` Eric Dumazet
  2025-02-10  8:28 ` [PATCH net-next 3/4] tcp: " Eric Dumazet
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 19+ messages in thread
From: Eric Dumazet @ 2025-02-10  8:28 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, Willem de Bruijn, Simon Horman, eric.dumazet,
	Eric Dumazet

Use EXPORT_IPV6_MOD[_GPL]() for symbols that do not need to
to be exported unless CONFIG_IPV6=m

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv4/inetpeer.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index b8b23a77ceb4f0f1a3d3adaacea2a7c59a7da3c9..7b1e0a2d6906673316ec4bef777e359ac175dbf8 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -60,7 +60,7 @@ void inet_peer_base_init(struct inet_peer_base *bp)
 	seqlock_init(&bp->lock);
 	bp->total = 0;
 }
-EXPORT_SYMBOL_GPL(inet_peer_base_init);
+EXPORT_IPV6_MOD_GPL(inet_peer_base_init);
 
 #define PEER_MAX_GC 32
 
@@ -218,7 +218,7 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base,
 
 	return p;
 }
-EXPORT_SYMBOL_GPL(inet_getpeer);
+EXPORT_IPV6_MOD_GPL(inet_getpeer);
 
 void inet_putpeer(struct inet_peer *p)
 {
@@ -269,7 +269,7 @@ bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout)
 		WRITE_ONCE(peer->rate_tokens, token);
 	return rc;
 }
-EXPORT_SYMBOL(inet_peer_xrlim_allow);
+EXPORT_IPV6_MOD(inet_peer_xrlim_allow);
 
 void inetpeer_invalidate_tree(struct inet_peer_base *base)
 {
@@ -286,4 +286,4 @@ void inetpeer_invalidate_tree(struct inet_peer_base *base)
 
 	base->total = 0;
 }
-EXPORT_SYMBOL(inetpeer_invalidate_tree);
+EXPORT_IPV6_MOD(inetpeer_invalidate_tree);
-- 
2.48.1.502.g6dc24dfdaf-goog


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

* [PATCH net-next 3/4] tcp: use EXPORT_IPV6_MOD[_GPL]()
  2025-02-10  8:28 [PATCH net-next 0/4] net: add EXPORT_IPV6_MOD() Eric Dumazet
  2025-02-10  8:28 ` [PATCH net-next 1/4] net: introduce EXPORT_IPV6_MOD() and EXPORT_IPV6_MOD_GPL() Eric Dumazet
  2025-02-10  8:28 ` [PATCH net-next 2/4] inetpeer: use EXPORT_IPV6_MOD[_GPL]() Eric Dumazet
@ 2025-02-10  8:28 ` Eric Dumazet
  2025-02-10  8:41   ` Mateusz Polchlopek
                     ` (2 more replies)
  2025-02-10  8:28 ` [PATCH net-next 4/4] udp: " Eric Dumazet
                   ` (2 subsequent siblings)
  5 siblings, 3 replies; 19+ messages in thread
From: Eric Dumazet @ 2025-02-10  8:28 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, Willem de Bruijn, Simon Horman, eric.dumazet,
	Eric Dumazet

Use EXPORT_IPV6_MOD[_GPL]() for symbols that don't need
to be exported unless CONFIG_IPV6=m

tcp_hashinfo is no longer used from any module anyway.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/core/secure_seq.c    |  4 ++--
 net/ipv4/syncookies.c    |  8 +++----
 net/ipv4/tcp.c           | 48 ++++++++++++++++++++--------------------
 net/ipv4/tcp_fastopen.c  |  2 +-
 net/ipv4/tcp_input.c     | 14 ++++++------
 net/ipv4/tcp_ipv4.c      | 47 +++++++++++++++++++--------------------
 net/ipv4/tcp_minisocks.c | 11 +++++----
 net/ipv4/tcp_output.c    | 12 +++++-----
 net/ipv4/tcp_timer.c     |  4 ++--
 9 files changed, 74 insertions(+), 76 deletions(-)

diff --git a/net/core/secure_seq.c b/net/core/secure_seq.c
index b0ff6153be6232c5df27a64ac6e271a546cfe6ce..64e18dd4febd03df5d97f8ef646665cb0c146597 100644
--- a/net/core/secure_seq.c
+++ b/net/core/secure_seq.c
@@ -71,7 +71,7 @@ u32 secure_tcpv6_ts_off(const struct net *net,
 	return siphash(&combined, offsetofend(typeof(combined), daddr),
 		       &ts_secret);
 }
-EXPORT_SYMBOL(secure_tcpv6_ts_off);
+EXPORT_IPV6_MOD(secure_tcpv6_ts_off);
 
 u32 secure_tcpv6_seq(const __be32 *saddr, const __be32 *daddr,
 		     __be16 sport, __be16 dport)
@@ -94,7 +94,7 @@ u32 secure_tcpv6_seq(const __be32 *saddr, const __be32 *daddr,
 		       &net_secret);
 	return seq_scale(hash);
 }
-EXPORT_SYMBOL(secure_tcpv6_seq);
+EXPORT_IPV6_MOD(secure_tcpv6_seq);
 
 u64 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
 			       __be16 dport)
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 1948d15f1f281b0c9dc6ee237ff805bc288766e1..26816b876dd8b37626a3220da71fd697b997e147 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -222,7 +222,7 @@ struct sock *tcp_get_cookie_sock(struct sock *sk, struct sk_buff *skb,
 
 	return NULL;
 }
-EXPORT_SYMBOL(tcp_get_cookie_sock);
+EXPORT_IPV6_MOD(tcp_get_cookie_sock);
 
 /*
  * when syncookies are in effect and tcp timestamps are enabled we stored
@@ -259,7 +259,7 @@ bool cookie_timestamp_decode(const struct net *net,
 
 	return READ_ONCE(net->ipv4.sysctl_tcp_window_scaling) != 0;
 }
-EXPORT_SYMBOL(cookie_timestamp_decode);
+EXPORT_IPV6_MOD(cookie_timestamp_decode);
 
 static int cookie_tcp_reqsk_init(struct sock *sk, struct sk_buff *skb,
 				 struct request_sock *req)
@@ -310,7 +310,7 @@ struct request_sock *cookie_bpf_check(struct sock *sk, struct sk_buff *skb)
 
 	return req;
 }
-EXPORT_SYMBOL_GPL(cookie_bpf_check);
+EXPORT_IPV6_MOD_GPL(cookie_bpf_check);
 #endif
 
 struct request_sock *cookie_tcp_reqsk_alloc(const struct request_sock_ops *ops,
@@ -351,7 +351,7 @@ struct request_sock *cookie_tcp_reqsk_alloc(const struct request_sock_ops *ops,
 
 	return req;
 }
-EXPORT_SYMBOL_GPL(cookie_tcp_reqsk_alloc);
+EXPORT_IPV6_MOD_GPL(cookie_tcp_reqsk_alloc);
 
 static struct request_sock *cookie_tcp_check(struct net *net, struct sock *sk,
 					     struct sk_buff *skb)
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 2021f2709ec32fc3a439540f288d181a6dab274a..af85a9f0c14562d677aa51fe00f0314b75cd74eb 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -300,10 +300,10 @@ DEFINE_PER_CPU(u32, tcp_tw_isn);
 EXPORT_PER_CPU_SYMBOL_GPL(tcp_tw_isn);
 
 long sysctl_tcp_mem[3] __read_mostly;
-EXPORT_SYMBOL(sysctl_tcp_mem);
+EXPORT_IPV6_MOD(sysctl_tcp_mem);
 
 atomic_long_t tcp_memory_allocated ____cacheline_aligned_in_smp;	/* Current allocated memory. */
-EXPORT_SYMBOL(tcp_memory_allocated);
+EXPORT_IPV6_MOD(tcp_memory_allocated);
 DEFINE_PER_CPU(int, tcp_memory_per_cpu_fw_alloc);
 EXPORT_PER_CPU_SYMBOL_GPL(tcp_memory_per_cpu_fw_alloc);
 
@@ -316,7 +316,7 @@ EXPORT_SYMBOL(tcp_have_smc);
  * Current number of TCP sockets.
  */
 struct percpu_counter tcp_sockets_allocated ____cacheline_aligned_in_smp;
-EXPORT_SYMBOL(tcp_sockets_allocated);
+EXPORT_IPV6_MOD(tcp_sockets_allocated);
 
 /*
  * TCP splice context
@@ -334,7 +334,7 @@ struct tcp_splice_state {
  * is strict, actions are advisory and have some latency.
  */
 unsigned long tcp_memory_pressure __read_mostly;
-EXPORT_SYMBOL_GPL(tcp_memory_pressure);
+EXPORT_IPV6_MOD_GPL(tcp_memory_pressure);
 
 void tcp_enter_memory_pressure(struct sock *sk)
 {
@@ -349,7 +349,7 @@ void tcp_enter_memory_pressure(struct sock *sk)
 	if (!cmpxchg(&tcp_memory_pressure, 0, val))
 		NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMEMORYPRESSURES);
 }
-EXPORT_SYMBOL_GPL(tcp_enter_memory_pressure);
+EXPORT_IPV6_MOD_GPL(tcp_enter_memory_pressure);
 
 void tcp_leave_memory_pressure(struct sock *sk)
 {
@@ -362,7 +362,7 @@ void tcp_leave_memory_pressure(struct sock *sk)
 		NET_ADD_STATS(sock_net(sk), LINUX_MIB_TCPMEMORYPRESSURESCHRONO,
 			      jiffies_to_msecs(jiffies - val));
 }
-EXPORT_SYMBOL_GPL(tcp_leave_memory_pressure);
+EXPORT_IPV6_MOD_GPL(tcp_leave_memory_pressure);
 
 /* Convert seconds to retransmits based on initial and max timeout */
 static u8 secs_to_retrans(int seconds, int timeout, int rto_max)
@@ -475,7 +475,7 @@ void tcp_init_sock(struct sock *sk)
 	sk_sockets_allocated_inc(sk);
 	xa_init_flags(&sk->sk_user_frags, XA_FLAGS_ALLOC1);
 }
-EXPORT_SYMBOL(tcp_init_sock);
+EXPORT_IPV6_MOD(tcp_init_sock);
 
 static void tcp_tx_timestamp(struct sock *sk, struct sockcm_cookie *sockc)
 {
@@ -613,7 +613,7 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
 
 	return mask;
 }
-EXPORT_SYMBOL(tcp_poll);
+EXPORT_IPV6_MOD(tcp_poll);
 
 int tcp_ioctl(struct sock *sk, int cmd, int *karg)
 {
@@ -660,7 +660,7 @@ int tcp_ioctl(struct sock *sk, int cmd, int *karg)
 	*karg = answ;
 	return 0;
 }
-EXPORT_SYMBOL(tcp_ioctl);
+EXPORT_IPV6_MOD(tcp_ioctl);
 
 void tcp_mark_push(struct tcp_sock *tp, struct sk_buff *skb)
 {
@@ -876,7 +876,7 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
 
 	return ret;
 }
-EXPORT_SYMBOL(tcp_splice_read);
+EXPORT_IPV6_MOD(tcp_splice_read);
 
 struct sk_buff *tcp_stream_alloc_skb(struct sock *sk, gfp_t gfp,
 				     bool force_schedule)
@@ -1376,7 +1376,7 @@ void tcp_splice_eof(struct socket *sock)
 	tcp_push(sk, 0, mss_now, tp->nonagle, size_goal);
 	release_sock(sk);
 }
-EXPORT_SYMBOL_GPL(tcp_splice_eof);
+EXPORT_IPV6_MOD_GPL(tcp_splice_eof);
 
 /*
  *	Handle reading urgent data. BSD has very simple semantics for
@@ -1667,7 +1667,7 @@ int tcp_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
 	}
 	return copied;
 }
-EXPORT_SYMBOL(tcp_read_skb);
+EXPORT_IPV6_MOD(tcp_read_skb);
 
 void tcp_read_done(struct sock *sk, size_t len)
 {
@@ -1712,7 +1712,7 @@ int tcp_peek_len(struct socket *sock)
 {
 	return tcp_inq(sock->sk);
 }
-EXPORT_SYMBOL(tcp_peek_len);
+EXPORT_IPV6_MOD(tcp_peek_len);
 
 /* Make sure sk_rcvbuf is big enough to satisfy SO_RCVLOWAT hint */
 int tcp_set_rcvlowat(struct sock *sk, int val)
@@ -1739,7 +1739,7 @@ int tcp_set_rcvlowat(struct sock *sk, int val)
 	}
 	return 0;
 }
-EXPORT_SYMBOL(tcp_set_rcvlowat);
+EXPORT_IPV6_MOD(tcp_set_rcvlowat);
 
 void tcp_update_recv_tstamps(struct sk_buff *skb,
 			     struct scm_timestamping_internal *tss)
@@ -1772,7 +1772,7 @@ int tcp_mmap(struct file *file, struct socket *sock,
 	vma->vm_ops = &tcp_vm_ops;
 	return 0;
 }
-EXPORT_SYMBOL(tcp_mmap);
+EXPORT_IPV6_MOD(tcp_mmap);
 
 static skb_frag_t *skb_advance_to_frag(struct sk_buff *skb, u32 offset_skb,
 				       u32 *offset_frag)
@@ -2869,7 +2869,7 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int flags,
 	}
 	return ret;
 }
-EXPORT_SYMBOL(tcp_recvmsg);
+EXPORT_IPV6_MOD(tcp_recvmsg);
 
 void tcp_set_state(struct sock *sk, int state)
 {
@@ -2999,7 +2999,7 @@ void tcp_shutdown(struct sock *sk, int how)
 			tcp_send_fin(sk);
 	}
 }
-EXPORT_SYMBOL(tcp_shutdown);
+EXPORT_IPV6_MOD(tcp_shutdown);
 
 int tcp_orphan_count_sum(void)
 {
@@ -3498,7 +3498,7 @@ static int tcp_repair_options_est(struct sock *sk, sockptr_t optbuf,
 }
 
 DEFINE_STATIC_KEY_FALSE(tcp_tx_delay_enabled);
-EXPORT_SYMBOL(tcp_tx_delay_enabled);
+EXPORT_IPV6_MOD(tcp_tx_delay_enabled);
 
 static void tcp_enable_tx_delay(void)
 {
@@ -4036,7 +4036,7 @@ int tcp_setsockopt(struct sock *sk, int level, int optname, sockptr_t optval,
 								optval, optlen);
 	return do_tcp_setsockopt(sk, level, optname, optval, optlen);
 }
-EXPORT_SYMBOL(tcp_setsockopt);
+EXPORT_IPV6_MOD(tcp_setsockopt);
 
 static void tcp_get_info_chrono_stats(const struct tcp_sock *tp,
 				      struct tcp_info *info)
@@ -4664,7 +4664,7 @@ bool tcp_bpf_bypass_getsockopt(int level, int optname)
 
 	return false;
 }
-EXPORT_SYMBOL(tcp_bpf_bypass_getsockopt);
+EXPORT_IPV6_MOD(tcp_bpf_bypass_getsockopt);
 
 int tcp_getsockopt(struct sock *sk, int level, int optname, char __user *optval,
 		   int __user *optlen)
@@ -4678,11 +4678,11 @@ int tcp_getsockopt(struct sock *sk, int level, int optname, char __user *optval,
 	return do_tcp_getsockopt(sk, level, optname, USER_SOCKPTR(optval),
 				 USER_SOCKPTR(optlen));
 }
-EXPORT_SYMBOL(tcp_getsockopt);
+EXPORT_IPV6_MOD(tcp_getsockopt);
 
 #ifdef CONFIG_TCP_MD5SIG
 int tcp_md5_sigpool_id = -1;
-EXPORT_SYMBOL_GPL(tcp_md5_sigpool_id);
+EXPORT_IPV6_MOD_GPL(tcp_md5_sigpool_id);
 
 int tcp_md5_alloc_sigpool(void)
 {
@@ -4728,7 +4728,7 @@ int tcp_md5_hash_key(struct tcp_sigpool *hp,
 	 */
 	return data_race(crypto_ahash_update(hp->req));
 }
-EXPORT_SYMBOL(tcp_md5_hash_key);
+EXPORT_IPV6_MOD(tcp_md5_hash_key);
 
 /* Called with rcu_read_lock() */
 static enum skb_drop_reason
@@ -4848,7 +4848,7 @@ tcp_inbound_hash(struct sock *sk, const struct request_sock *req,
 	return tcp_inbound_md5_hash(sk, skb, saddr, daddr, family,
 				    l3index, md5_location);
 }
-EXPORT_SYMBOL_GPL(tcp_inbound_hash);
+EXPORT_IPV6_MOD_GPL(tcp_inbound_hash);
 
 void tcp_done(struct sock *sk)
 {
diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
index 0f523cbfe329efeaee2ef206b0779e9911ef22cd..8e6717df54c1449251425aa0a2015c0240bb06c8 100644
--- a/net/ipv4/tcp_fastopen.c
+++ b/net/ipv4/tcp_fastopen.c
@@ -468,7 +468,7 @@ bool tcp_fastopen_defer_connect(struct sock *sk, int *err)
 	}
 	return false;
 }
-EXPORT_SYMBOL(tcp_fastopen_defer_connect);
+EXPORT_IPV6_MOD(tcp_fastopen_defer_connect);
 
 /*
  * The following code block is to deal with middle box issues with TFO:
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 286f15e4994a96ceae9386e76c127e76caf79220..5c5799b31653d783519adb9eea9db1160640dea8 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -630,7 +630,7 @@ void tcp_initialize_rcv_mss(struct sock *sk)
 
 	inet_csk(sk)->icsk_ack.rcv_mss = hint;
 }
-EXPORT_SYMBOL(tcp_initialize_rcv_mss);
+EXPORT_IPV6_MOD(tcp_initialize_rcv_mss);
 
 /* Receiver "autotuning" code.
  *
@@ -2892,7 +2892,7 @@ void tcp_simple_retransmit(struct sock *sk)
 	 */
 	tcp_non_congestion_loss_retransmit(sk);
 }
-EXPORT_SYMBOL(tcp_simple_retransmit);
+EXPORT_IPV6_MOD(tcp_simple_retransmit);
 
 void tcp_enter_recovery(struct sock *sk, bool ece_ack)
 {
@@ -4523,7 +4523,7 @@ void tcp_done_with_error(struct sock *sk, int err)
 	if (!sock_flag(sk, SOCK_DEAD))
 		sk_error_report(sk);
 }
-EXPORT_SYMBOL(tcp_done_with_error);
+EXPORT_IPV6_MOD(tcp_done_with_error);
 
 /* When we get a reset we do this. */
 void tcp_reset(struct sock *sk, struct sk_buff *skb)
@@ -6293,7 +6293,7 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb)
 discard:
 	tcp_drop_reason(sk, skb, reason);
 }
-EXPORT_SYMBOL(tcp_rcv_established);
+EXPORT_IPV6_MOD(tcp_rcv_established);
 
 void tcp_init_transfer(struct sock *sk, int bpf_op, struct sk_buff *skb)
 {
@@ -7007,7 +7007,7 @@ tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb)
 	__kfree_skb(skb);
 	return 0;
 }
-EXPORT_SYMBOL(tcp_rcv_state_process);
+EXPORT_IPV6_MOD(tcp_rcv_state_process);
 
 static inline void pr_drop_req(struct request_sock *req, __u16 port, int family)
 {
@@ -7189,7 +7189,7 @@ u16 tcp_get_syncookie_mss(struct request_sock_ops *rsk_ops,
 
 	return mss;
 }
-EXPORT_SYMBOL_GPL(tcp_get_syncookie_mss);
+EXPORT_IPV6_MOD_GPL(tcp_get_syncookie_mss);
 
 int tcp_conn_request(struct request_sock_ops *rsk_ops,
 		     const struct tcp_request_sock_ops *af_ops,
@@ -7370,4 +7370,4 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
 	tcp_listendrop(sk);
 	return 0;
 }
-EXPORT_SYMBOL(tcp_conn_request);
+EXPORT_IPV6_MOD(tcp_conn_request);
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index cc2b5194a18d2e64595f474f62c6f2fd3eff319f..2f5a342a4a493d236220b37614f59ca00101a112 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -92,7 +92,6 @@ static int tcp_v4_md5_hash_hdr(char *md5_hash, const struct tcp_md5sig_key *key,
 #endif
 
 struct inet_hashinfo tcp_hashinfo;
-EXPORT_SYMBOL(tcp_hashinfo);
 
 static DEFINE_PER_CPU(struct sock_bh_locked, ipv4_tcp_sk) = {
 	.bh_lock = INIT_LOCAL_LOCK(bh_lock),
@@ -199,7 +198,7 @@ int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(tcp_twsk_unique);
+EXPORT_IPV6_MOD_GPL(tcp_twsk_unique);
 
 static int tcp_v4_pre_connect(struct sock *sk, struct sockaddr *uaddr,
 			      int addr_len)
@@ -359,7 +358,7 @@ int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 	inet->inet_dport = 0;
 	return err;
 }
-EXPORT_SYMBOL(tcp_v4_connect);
+EXPORT_IPV6_MOD(tcp_v4_connect);
 
 /*
  * This routine reacts to ICMP_FRAG_NEEDED mtu indications as defined in RFC1191.
@@ -400,7 +399,7 @@ void tcp_v4_mtu_reduced(struct sock *sk)
 		tcp_simple_retransmit(sk);
 	} /* else let the usual retransmit timer handle it */
 }
-EXPORT_SYMBOL(tcp_v4_mtu_reduced);
+EXPORT_IPV6_MOD(tcp_v4_mtu_reduced);
 
 static void do_redirect(struct sk_buff *skb, struct sock *sk)
 {
@@ -434,7 +433,7 @@ void tcp_req_err(struct sock *sk, u32 seq, bool abort)
 	}
 	reqsk_put(req);
 }
-EXPORT_SYMBOL(tcp_req_err);
+EXPORT_IPV6_MOD(tcp_req_err);
 
 /* TCP-LD (RFC 6069) logic */
 void tcp_ld_RTO_revert(struct sock *sk, u32 seq)
@@ -474,7 +473,7 @@ void tcp_ld_RTO_revert(struct sock *sk, u32 seq)
 		tcp_retransmit_timer(sk);
 	}
 }
-EXPORT_SYMBOL(tcp_ld_RTO_revert);
+EXPORT_IPV6_MOD(tcp_ld_RTO_revert);
 
 /*
  * This routine is called by the ICMP module when it gets some
@@ -676,7 +675,7 @@ void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb)
 
 	__tcp_v4_send_check(skb, inet->inet_saddr, inet->inet_daddr);
 }
-EXPORT_SYMBOL(tcp_v4_send_check);
+EXPORT_IPV6_MOD(tcp_v4_send_check);
 
 #define REPLY_OPTIONS_LEN      (MAX_TCP_OPTION_SPACE / sizeof(__be32))
 
@@ -1231,7 +1230,7 @@ static void tcp_v4_reqsk_destructor(struct request_sock *req)
  */
 
 DEFINE_STATIC_KEY_DEFERRED_FALSE(tcp_md5_needed, HZ);
-EXPORT_SYMBOL(tcp_md5_needed);
+EXPORT_IPV6_MOD(tcp_md5_needed);
 
 static bool better_md5_match(struct tcp_md5sig_key *old, struct tcp_md5sig_key *new)
 {
@@ -1290,7 +1289,7 @@ struct tcp_md5sig_key *__tcp_md5_do_lookup(const struct sock *sk, int l3index,
 	}
 	return best_match;
 }
-EXPORT_SYMBOL(__tcp_md5_do_lookup);
+EXPORT_IPV6_MOD(__tcp_md5_do_lookup);
 
 static struct tcp_md5sig_key *tcp_md5_do_lookup_exact(const struct sock *sk,
 						      const union tcp_md5_addr *addr,
@@ -1337,7 +1336,7 @@ struct tcp_md5sig_key *tcp_v4_md5_lookup(const struct sock *sk,
 	addr = (const union tcp_md5_addr *)&addr_sk->sk_daddr;
 	return tcp_md5_do_lookup(sk, l3index, addr, AF_INET);
 }
-EXPORT_SYMBOL(tcp_v4_md5_lookup);
+EXPORT_IPV6_MOD(tcp_v4_md5_lookup);
 
 static int tcp_md5sig_info_add(struct sock *sk, gfp_t gfp)
 {
@@ -1433,7 +1432,7 @@ int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
 	return __tcp_md5_do_add(sk, addr, family, prefixlen, l3index, flags,
 				newkey, newkeylen, GFP_KERNEL);
 }
-EXPORT_SYMBOL(tcp_md5_do_add);
+EXPORT_IPV6_MOD(tcp_md5_do_add);
 
 int tcp_md5_key_copy(struct sock *sk, const union tcp_md5_addr *addr,
 		     int family, u8 prefixlen, int l3index,
@@ -1465,7 +1464,7 @@ int tcp_md5_key_copy(struct sock *sk, const union tcp_md5_addr *addr,
 				key->flags, key->key, key->keylen,
 				sk_gfp_mask(sk, GFP_ATOMIC));
 }
-EXPORT_SYMBOL(tcp_md5_key_copy);
+EXPORT_IPV6_MOD(tcp_md5_key_copy);
 
 int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr, int family,
 		   u8 prefixlen, int l3index, u8 flags)
@@ -1480,7 +1479,7 @@ int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr, int family,
 	kfree_rcu(key, rcu);
 	return 0;
 }
-EXPORT_SYMBOL(tcp_md5_do_del);
+EXPORT_IPV6_MOD(tcp_md5_do_del);
 
 void tcp_clear_md5_list(struct sock *sk)
 {
@@ -1659,7 +1658,7 @@ int tcp_v4_md5_hash_skb(char *md5_hash, const struct tcp_md5sig_key *key,
 	memset(md5_hash, 0, 16);
 	return 1;
 }
-EXPORT_SYMBOL(tcp_v4_md5_hash_skb);
+EXPORT_IPV6_MOD(tcp_v4_md5_hash_skb);
 
 #endif
 
@@ -1732,7 +1731,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
 	tcp_listendrop(sk);
 	return 0;
 }
-EXPORT_SYMBOL(tcp_v4_conn_request);
+EXPORT_IPV6_MOD(tcp_v4_conn_request);
 
 
 /*
@@ -1856,7 +1855,7 @@ struct sock *tcp_v4_syn_recv_sock(const struct sock *sk, struct sk_buff *skb,
 	tcp_done(newsk);
 	goto exit;
 }
-EXPORT_SYMBOL(tcp_v4_syn_recv_sock);
+EXPORT_IPV6_MOD(tcp_v4_syn_recv_sock);
 
 static struct sock *tcp_v4_cookie_check(struct sock *sk, struct sk_buff *skb)
 {
@@ -2135,7 +2134,7 @@ bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb,
 	}
 	return false;
 }
-EXPORT_SYMBOL(tcp_add_backlog);
+EXPORT_IPV6_MOD(tcp_add_backlog);
 
 int tcp_filter(struct sock *sk, struct sk_buff *skb)
 {
@@ -2143,7 +2142,7 @@ int tcp_filter(struct sock *sk, struct sk_buff *skb)
 
 	return sk_filter_trim_cap(sk, skb, th->doff * 4);
 }
-EXPORT_SYMBOL(tcp_filter);
+EXPORT_IPV6_MOD(tcp_filter);
 
 static void tcp_v4_restore_cb(struct sk_buff *skb)
 {
@@ -2452,7 +2451,7 @@ void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb)
 		sk->sk_rx_dst_ifindex = skb->skb_iif;
 	}
 }
-EXPORT_SYMBOL(inet_sk_rx_dst_set);
+EXPORT_IPV6_MOD(inet_sk_rx_dst_set);
 
 const struct inet_connection_sock_af_ops ipv4_specific = {
 	.queue_xmit	   = ip_queue_xmit,
@@ -2468,7 +2467,7 @@ const struct inet_connection_sock_af_ops ipv4_specific = {
 	.sockaddr_len	   = sizeof(struct sockaddr_in),
 	.mtu_reduced	   = tcp_v4_mtu_reduced,
 };
-EXPORT_SYMBOL(ipv4_specific);
+EXPORT_IPV6_MOD(ipv4_specific);
 
 #if defined(CONFIG_TCP_MD5SIG) || defined(CONFIG_TCP_AO)
 static const struct tcp_sock_af_ops tcp_sock_ipv4_specific = {
@@ -2578,7 +2577,7 @@ void tcp_v4_destroy_sock(struct sock *sk)
 
 	sk_sockets_allocated_dec(sk);
 }
-EXPORT_SYMBOL(tcp_v4_destroy_sock);
+EXPORT_IPV6_MOD(tcp_v4_destroy_sock);
 
 #ifdef CONFIG_PROC_FS
 /* Proc filesystem TCP sock list dumping. */
@@ -2814,7 +2813,7 @@ void *tcp_seq_start(struct seq_file *seq, loff_t *pos)
 	st->last_pos = *pos;
 	return rc;
 }
-EXPORT_SYMBOL(tcp_seq_start);
+EXPORT_IPV6_MOD(tcp_seq_start);
 
 void *tcp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 {
@@ -2845,7 +2844,7 @@ void *tcp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 	st->last_pos = *pos;
 	return rc;
 }
-EXPORT_SYMBOL(tcp_seq_next);
+EXPORT_IPV6_MOD(tcp_seq_next);
 
 void tcp_seq_stop(struct seq_file *seq, void *v)
 {
@@ -2863,7 +2862,7 @@ void tcp_seq_stop(struct seq_file *seq, void *v)
 		break;
 	}
 }
-EXPORT_SYMBOL(tcp_seq_stop);
+EXPORT_IPV6_MOD(tcp_seq_stop);
 
 static void get_openreq4(const struct request_sock *req,
 			 struct seq_file *f, int i)
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 0deb2ac85acf7a9e8377e97915087afec6f8a835..1eccc518b957eb9b81cab8b288cb6a5bca931e5a 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -264,7 +264,7 @@ tcp_timewait_state_process(struct inet_timewait_sock *tw, struct sk_buff *skb,
 	inet_twsk_put(tw);
 	return TCP_TW_SUCCESS;
 }
-EXPORT_SYMBOL(tcp_timewait_state_process);
+EXPORT_IPV6_MOD(tcp_timewait_state_process);
 
 static void tcp_time_wait_init(struct sock *sk, struct tcp_timewait_sock *tcptw)
 {
@@ -398,7 +398,7 @@ void tcp_twsk_destructor(struct sock *sk)
 #endif
 	tcp_ao_destroy_sock(sk, true);
 }
-EXPORT_SYMBOL_GPL(tcp_twsk_destructor);
+EXPORT_IPV6_MOD_GPL(tcp_twsk_destructor);
 
 void tcp_twsk_purge(struct list_head *net_exit_list)
 {
@@ -457,7 +457,6 @@ void tcp_openreq_init_rwin(struct request_sock *req,
 		rcv_wnd);
 	ireq->rcv_wscale = rcv_wscale;
 }
-EXPORT_SYMBOL(tcp_openreq_init_rwin);
 
 static void tcp_ecn_openreq_child(struct tcp_sock *tp,
 				  const struct request_sock *req)
@@ -492,7 +491,7 @@ void tcp_ca_openreq_child(struct sock *sk, const struct dst_entry *dst)
 
 	tcp_set_ca_state(sk, TCP_CA_Open);
 }
-EXPORT_SYMBOL_GPL(tcp_ca_openreq_child);
+EXPORT_IPV6_MOD_GPL(tcp_ca_openreq_child);
 
 static void smc_check_reset_syn_req(const struct tcp_sock *oldtp,
 				    struct request_sock *req,
@@ -909,7 +908,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
 	}
 	return NULL;
 }
-EXPORT_SYMBOL(tcp_check_req);
+EXPORT_IPV6_MOD(tcp_check_req);
 
 /*
  * Queue segment on the new socket if the new socket is active,
@@ -951,4 +950,4 @@ enum skb_drop_reason tcp_child_process(struct sock *parent, struct sock *child,
 	sock_put(child);
 	return reason;
 }
-EXPORT_SYMBOL(tcp_child_process);
+EXPORT_IPV6_MOD(tcp_child_process);
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index ef9f6172680f5f3a9384132962d6e34cfbf83f14..0a6b1508dad45fa6a136325e86499eb8918a9210 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -250,7 +250,7 @@ void tcp_select_initial_window(const struct sock *sk, int __space, __u32 mss,
 	WRITE_ONCE(*__window_clamp,
 		   min_t(__u32, U16_MAX << (*rcv_wscale), window_clamp));
 }
-EXPORT_SYMBOL(tcp_select_initial_window);
+EXPORT_IPV6_MOD(tcp_select_initial_window);
 
 /* Chose a new window to advertise, update state in tcp_sock for the
  * socket, and return result with RFC1323 scaling applied.  The return
@@ -1171,7 +1171,7 @@ void tcp_release_cb(struct sock *sk)
 	if ((flags & TCPF_ACK_DEFERRED) && inet_csk_ack_scheduled(sk))
 		tcp_send_ack(sk);
 }
-EXPORT_SYMBOL(tcp_release_cb);
+EXPORT_IPV6_MOD(tcp_release_cb);
 
 void __init tcp_tasklet_init(void)
 {
@@ -1783,7 +1783,7 @@ int tcp_mtu_to_mss(struct sock *sk, int pmtu)
 	return __tcp_mtu_to_mss(sk, pmtu) -
 	       (tcp_sk(sk)->tcp_header_len - sizeof(struct tcphdr));
 }
-EXPORT_SYMBOL(tcp_mtu_to_mss);
+EXPORT_IPV6_MOD(tcp_mtu_to_mss);
 
 /* Inverse of above */
 int tcp_mss_to_mtu(struct sock *sk, int mss)
@@ -1856,7 +1856,7 @@ unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu)
 
 	return mss_now;
 }
-EXPORT_SYMBOL(tcp_sync_mss);
+EXPORT_IPV6_MOD(tcp_sync_mss);
 
 /* Compute the current effective MSS, taking SACKs and IP options,
  * and even PMTU discovery events into account.
@@ -3852,7 +3852,7 @@ struct sk_buff *tcp_make_synack(const struct sock *sk, struct dst_entry *dst,
 
 	return skb;
 }
-EXPORT_SYMBOL(tcp_make_synack);
+EXPORT_IPV6_MOD(tcp_make_synack);
 
 static void tcp_ca_dst_init(struct sock *sk, const struct dst_entry *dst)
 {
@@ -4429,4 +4429,4 @@ int tcp_rtx_synack(const struct sock *sk, struct request_sock *req)
 	}
 	return res;
 }
-EXPORT_SYMBOL(tcp_rtx_synack);
+EXPORT_IPV6_MOD(tcp_rtx_synack);
diff --git a/net/ipv4/tcp_timer.c b/net/ipv4/tcp_timer.c
index cfb6f4c4e4c9fc3eb6963dcb659b2c6489193dd9..8d035aecf58e6bacd047aa4a5fb7ff8f5e2ce068 100644
--- a/net/ipv4/tcp_timer.c
+++ b/net/ipv4/tcp_timer.c
@@ -749,7 +749,7 @@ void tcp_syn_ack_timeout(const struct request_sock *req)
 
 	__NET_INC_STATS(net, LINUX_MIB_TCPTIMEOUTS);
 }
-EXPORT_SYMBOL(tcp_syn_ack_timeout);
+EXPORT_IPV6_MOD(tcp_syn_ack_timeout);
 
 void tcp_reset_keepalive_timer(struct sock *sk, unsigned long len)
 {
@@ -771,7 +771,7 @@ void tcp_set_keepalive(struct sock *sk, int val)
 	else if (!val)
 		tcp_delete_keepalive_timer(sk);
 }
-EXPORT_SYMBOL_GPL(tcp_set_keepalive);
+EXPORT_IPV6_MOD_GPL(tcp_set_keepalive);
 
 static void tcp_keepalive_timer(struct timer_list *t)
 {
-- 
2.48.1.502.g6dc24dfdaf-goog


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

* [PATCH net-next 4/4] udp: use EXPORT_IPV6_MOD[_GPL]()
  2025-02-10  8:28 [PATCH net-next 0/4] net: add EXPORT_IPV6_MOD() Eric Dumazet
                   ` (2 preceding siblings ...)
  2025-02-10  8:28 ` [PATCH net-next 3/4] tcp: " Eric Dumazet
@ 2025-02-10  8:28 ` Eric Dumazet
  2025-02-11  2:56   ` Willem de Bruijn
  2025-02-10  9:25 ` [PATCH net-next 0/4] net: add EXPORT_IPV6_MOD() Mateusz Polchlopek
  2025-02-10 18:33 ` Willem de Bruijn
  5 siblings, 1 reply; 19+ messages in thread
From: Eric Dumazet @ 2025-02-10  8:28 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, Willem de Bruijn, Simon Horman, eric.dumazet,
	Eric Dumazet

Use EXPORT_IPV6_MOD[_GPL]() for symbols that don't need
to be exported unless CONFIG_IPV6=m

udp_table is no longer used from any modules, and does not
need to be exported anyway.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv4/udp.c | 57 +++++++++++++++++++++++++-------------------------
 1 file changed, 28 insertions(+), 29 deletions(-)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index a9bb9ce5438eaa9f9ceede1e4ac080dc6ab74588..73ac614beb109146c5635aeeb10c2e9f77a6ee1c 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -121,13 +121,12 @@
 #endif
 
 struct udp_table udp_table __read_mostly;
-EXPORT_SYMBOL(udp_table);
 
 long sysctl_udp_mem[3] __read_mostly;
-EXPORT_SYMBOL(sysctl_udp_mem);
+EXPORT_IPV6_MOD(sysctl_udp_mem);
 
 atomic_long_t udp_memory_allocated ____cacheline_aligned_in_smp;
-EXPORT_SYMBOL(udp_memory_allocated);
+EXPORT_IPV6_MOD(udp_memory_allocated);
 DEFINE_PER_CPU(int, udp_memory_per_cpu_fw_alloc);
 EXPORT_PER_CPU_SYMBOL_GPL(udp_memory_per_cpu_fw_alloc);
 
@@ -352,7 +351,7 @@ int udp_lib_get_port(struct sock *sk, unsigned short snum,
 fail:
 	return error;
 }
-EXPORT_SYMBOL(udp_lib_get_port);
+EXPORT_IPV6_MOD(udp_lib_get_port);
 
 int udp_v4_get_port(struct sock *sk, unsigned short snum)
 {
@@ -418,7 +417,7 @@ u32 udp_ehashfn(const struct net *net, const __be32 laddr, const __u16 lport,
 	return __inet_ehashfn(laddr, lport, faddr, fport,
 			      udp_ehash_secret + net_hash_mix(net));
 }
-EXPORT_SYMBOL(udp_ehashfn);
+EXPORT_IPV6_MOD(udp_ehashfn);
 
 /**
  * udp4_lib_lookup1() - Simplified lookup using primary hash (destination port)
@@ -653,7 +652,7 @@ void udp_lib_hash4(struct sock *sk, u16 hash)
 
 	spin_unlock_bh(&hslot->lock);
 }
-EXPORT_SYMBOL(udp_lib_hash4);
+EXPORT_IPV6_MOD(udp_lib_hash4);
 
 /* call with sock lock */
 void udp4_hash4(struct sock *sk)
@@ -669,7 +668,7 @@ void udp4_hash4(struct sock *sk)
 
 	udp_lib_hash4(sk, hash);
 }
-EXPORT_SYMBOL(udp4_hash4);
+EXPORT_IPV6_MOD(udp4_hash4);
 #endif /* CONFIG_BASE_SMALL */
 
 /* UDP is nearly always wildcards out the wazoo, it makes no sense to try
@@ -1041,7 +1040,7 @@ void udp_flush_pending_frames(struct sock *sk)
 		ip_flush_pending_frames(sk);
 	}
 }
-EXPORT_SYMBOL(udp_flush_pending_frames);
+EXPORT_IPV6_MOD(udp_flush_pending_frames);
 
 /**
  * 	udp4_hwcsum  -  handle outgoing HW checksumming
@@ -1229,7 +1228,7 @@ int udp_push_pending_frames(struct sock *sk)
 	WRITE_ONCE(up->pending, 0);
 	return err;
 }
-EXPORT_SYMBOL(udp_push_pending_frames);
+EXPORT_IPV6_MOD(udp_push_pending_frames);
 
 static int __udp_cmsg_send(struct cmsghdr *cmsg, u16 *gso_size)
 {
@@ -1266,7 +1265,7 @@ int udp_cmsg_send(struct sock *sk, struct msghdr *msg, u16 *gso_size)
 
 	return need_ip;
 }
-EXPORT_SYMBOL_GPL(udp_cmsg_send);
+EXPORT_IPV6_MOD_GPL(udp_cmsg_send);
 
 int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
 {
@@ -1561,7 +1560,7 @@ void udp_splice_eof(struct socket *sock)
 		udp_push_pending_frames(sk);
 	release_sock(sk);
 }
-EXPORT_SYMBOL_GPL(udp_splice_eof);
+EXPORT_IPV6_MOD_GPL(udp_splice_eof);
 
 #define UDP_SKB_IS_STATELESS 0x80000000
 
@@ -1678,7 +1677,7 @@ void udp_skb_destructor(struct sock *sk, struct sk_buff *skb)
 	prefetch(&skb->data);
 	udp_rmem_release(sk, udp_skb_truesize(skb), 1, false);
 }
-EXPORT_SYMBOL(udp_skb_destructor);
+EXPORT_IPV6_MOD(udp_skb_destructor);
 
 /* as above, but the caller held the rx queue lock, too */
 static void udp_skb_dtor_locked(struct sock *sk, struct sk_buff *skb)
@@ -1785,7 +1784,7 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb)
 	busylock_release(busy);
 	return err;
 }
-EXPORT_SYMBOL_GPL(__udp_enqueue_schedule_skb);
+EXPORT_IPV6_MOD_GPL(__udp_enqueue_schedule_skb);
 
 void udp_destruct_common(struct sock *sk)
 {
@@ -1801,7 +1800,7 @@ void udp_destruct_common(struct sock *sk)
 	}
 	udp_rmem_release(sk, total, 0, true);
 }
-EXPORT_SYMBOL_GPL(udp_destruct_common);
+EXPORT_IPV6_MOD_GPL(udp_destruct_common);
 
 static void udp_destruct_sock(struct sock *sk)
 {
@@ -1832,7 +1831,7 @@ void skb_consume_udp(struct sock *sk, struct sk_buff *skb, int len)
 		skb_release_head_state(skb);
 	__consume_stateless_skb(skb);
 }
-EXPORT_SYMBOL_GPL(skb_consume_udp);
+EXPORT_IPV6_MOD_GPL(skb_consume_udp);
 
 static struct sk_buff *__first_packet_length(struct sock *sk,
 					     struct sk_buff_head *rcvq,
@@ -1914,7 +1913,7 @@ int udp_ioctl(struct sock *sk, int cmd, int *karg)
 
 	return 0;
 }
-EXPORT_SYMBOL(udp_ioctl);
+EXPORT_IPV6_MOD(udp_ioctl);
 
 struct sk_buff *__skb_recv_udp(struct sock *sk, unsigned int flags,
 			       int *off, int *err)
@@ -2010,7 +2009,7 @@ int udp_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
 	WARN_ON_ONCE(!skb_set_owner_sk_safe(skb, sk));
 	return recv_actor(sk, skb);
 }
-EXPORT_SYMBOL(udp_read_skb);
+EXPORT_IPV6_MOD(udp_read_skb);
 
 /*
  * 	This should be easy, if there is something there we
@@ -2137,7 +2136,7 @@ int udp_pre_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 
 	return BPF_CGROUP_RUN_PROG_INET4_CONNECT_LOCK(sk, uaddr, &addr_len);
 }
-EXPORT_SYMBOL(udp_pre_connect);
+EXPORT_IPV6_MOD(udp_pre_connect);
 
 static int udp_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
 {
@@ -2216,7 +2215,7 @@ void udp_lib_unhash(struct sock *sk)
 		spin_unlock_bh(&hslot->lock);
 	}
 }
-EXPORT_SYMBOL(udp_lib_unhash);
+EXPORT_IPV6_MOD(udp_lib_unhash);
 
 /*
  * inet_rcv_saddr was changed, we must rehash secondary hash
@@ -2280,7 +2279,7 @@ void udp_lib_rehash(struct sock *sk, u16 newhash, u16 newhash4)
 		}
 	}
 }
-EXPORT_SYMBOL(udp_lib_rehash);
+EXPORT_IPV6_MOD(udp_lib_rehash);
 
 void udp_v4_rehash(struct sock *sk)
 {
@@ -2485,7 +2484,7 @@ bool udp_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst)
 	}
 	return false;
 }
-EXPORT_SYMBOL(udp_sk_rx_dst_set);
+EXPORT_IPV6_MOD(udp_sk_rx_dst_set);
 
 /*
  *	Multicasts and broadcasts go to each listener.
@@ -3041,7 +3040,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
 
 	return err;
 }
-EXPORT_SYMBOL(udp_lib_setsockopt);
+EXPORT_IPV6_MOD(udp_lib_setsockopt);
 
 int udp_setsockopt(struct sock *sk, int level, int optname, sockptr_t optval,
 		   unsigned int optlen)
@@ -3112,7 +3111,7 @@ int udp_lib_getsockopt(struct sock *sk, int level, int optname,
 		return -EFAULT;
 	return 0;
 }
-EXPORT_SYMBOL(udp_lib_getsockopt);
+EXPORT_IPV6_MOD(udp_lib_getsockopt);
 
 int udp_getsockopt(struct sock *sk, int level, int optname,
 		   char __user *optval, int __user *optlen)
@@ -3154,7 +3153,7 @@ __poll_t udp_poll(struct file *file, struct socket *sock, poll_table *wait)
 	return mask;
 
 }
-EXPORT_SYMBOL(udp_poll);
+EXPORT_IPV6_MOD(udp_poll);
 
 int udp_abort(struct sock *sk, int err)
 {
@@ -3177,7 +3176,7 @@ int udp_abort(struct sock *sk, int err)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(udp_abort);
+EXPORT_IPV6_MOD_GPL(udp_abort);
 
 struct proto udp_prot = {
 	.name			= "UDP",
@@ -3311,7 +3310,7 @@ void *udp_seq_start(struct seq_file *seq, loff_t *pos)
 
 	return *pos ? udp_get_idx(seq, *pos-1) : SEQ_START_TOKEN;
 }
-EXPORT_SYMBOL(udp_seq_start);
+EXPORT_IPV6_MOD(udp_seq_start);
 
 void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 {
@@ -3325,7 +3324,7 @@ void *udp_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 	++*pos;
 	return sk;
 }
-EXPORT_SYMBOL(udp_seq_next);
+EXPORT_IPV6_MOD(udp_seq_next);
 
 void udp_seq_stop(struct seq_file *seq, void *v)
 {
@@ -3337,7 +3336,7 @@ void udp_seq_stop(struct seq_file *seq, void *v)
 	if (state->bucket <= udptable->mask)
 		spin_unlock_bh(&udptable->hash[state->bucket].lock);
 }
-EXPORT_SYMBOL(udp_seq_stop);
+EXPORT_IPV6_MOD(udp_seq_stop);
 
 /* ------------------------------------------------------------------------ */
 static void udp4_format_sock(struct sock *sp, struct seq_file *f,
@@ -3616,7 +3615,7 @@ const struct seq_operations udp_seq_ops = {
 	.stop		= udp_seq_stop,
 	.show		= udp4_seq_show,
 };
-EXPORT_SYMBOL(udp_seq_ops);
+EXPORT_IPV6_MOD(udp_seq_ops);
 
 static struct udp_seq_afinfo udp4_seq_afinfo = {
 	.family		= AF_INET,
-- 
2.48.1.502.g6dc24dfdaf-goog


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

* Re: [PATCH net-next 3/4] tcp: use EXPORT_IPV6_MOD[_GPL]()
  2025-02-10  8:28 ` [PATCH net-next 3/4] tcp: " Eric Dumazet
@ 2025-02-10  8:41   ` Mateusz Polchlopek
  2025-02-10  9:08     ` Eric Dumazet
  2025-02-10  9:30   ` Sabrina Dubroca
  2025-02-10 12:21   ` kernel test robot
  2 siblings, 1 reply; 19+ messages in thread
From: Mateusz Polchlopek @ 2025-02-10  8:41 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, Willem de Bruijn, Simon Horman, eric.dumazet



On 2/10/2025 9:28 AM, Eric Dumazet wrote:
> Use EXPORT_IPV6_MOD[_GPL]() for symbols that don't need
> to be exported unless CONFIG_IPV6=m
> 
> tcp_hashinfo is no longer used from any module anyway.

You also removed EXPORT for tcp_openreq_init_rwin function. Quick
grep shows that it is also not used anymore by any module, so probably
you forgot to add this info to commit message? Do you think it is worth
to add?

> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---

[...]

> @@ -457,7 +457,6 @@ void tcp_openreq_init_rwin(struct request_sock *req,
>   		rcv_wnd);
>   	ireq->rcv_wscale = rcv_wscale;
>   }
> -EXPORT_SYMBOL(tcp_openreq_init_rwin);

Exactly here


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

* Re: [PATCH net-next 3/4] tcp: use EXPORT_IPV6_MOD[_GPL]()
  2025-02-10  8:41   ` Mateusz Polchlopek
@ 2025-02-10  9:08     ` Eric Dumazet
  2025-02-10  9:23       ` Mateusz Polchlopek
  0 siblings, 1 reply; 19+ messages in thread
From: Eric Dumazet @ 2025-02-10  9:08 UTC (permalink / raw)
  To: Mateusz Polchlopek
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, netdev,
	Willem de Bruijn, Simon Horman, eric.dumazet

On Mon, Feb 10, 2025 at 9:41 AM Mateusz Polchlopek
<mateusz.polchlopek@intel.com> wrote:
>
>
>
> On 2/10/2025 9:28 AM, Eric Dumazet wrote:
> > Use EXPORT_IPV6_MOD[_GPL]() for symbols that don't need
> > to be exported unless CONFIG_IPV6=m
> >
> > tcp_hashinfo is no longer used from any module anyway.
>
> You also removed EXPORT for tcp_openreq_init_rwin function. Quick
> grep shows that it is also not used anymore by any module, so probably
> you forgot to add this info to commit message? Do you think it is worth
> to add?

I forgot to add this in the commit message.

Not sure if this worth a v2, because IPv6 no longer calls this
function after this old commit

commit 1fb6f159fd21c640a28eb65fbd62ce8c9f6a777e
Author: Octavian Purdila <octavian.purdila@intel.com>
Date:   Wed Jun 25 17:10:02 2014 +0300

    tcp: add tcp_conn_request


>
> >
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
> > ---
>
> [...]
>
> > @@ -457,7 +457,6 @@ void tcp_openreq_init_rwin(struct request_sock *req,
> >               rcv_wnd);
> >       ireq->rcv_wscale = rcv_wscale;
> >   }
> > -EXPORT_SYMBOL(tcp_openreq_init_rwin);
>
> Exactly here

Yes, thanks.

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

* Re: [PATCH net-next 3/4] tcp: use EXPORT_IPV6_MOD[_GPL]()
  2025-02-10  9:08     ` Eric Dumazet
@ 2025-02-10  9:23       ` Mateusz Polchlopek
  0 siblings, 0 replies; 19+ messages in thread
From: Mateusz Polchlopek @ 2025-02-10  9:23 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, netdev,
	Willem de Bruijn, Simon Horman, eric.dumazet



On 2/10/2025 10:08 AM, Eric Dumazet wrote:
> On Mon, Feb 10, 2025 at 9:41 AM Mateusz Polchlopek
> <mateusz.polchlopek@intel.com> wrote:
>>
>>
>>
>> On 2/10/2025 9:28 AM, Eric Dumazet wrote:
>>> Use EXPORT_IPV6_MOD[_GPL]() for symbols that don't need
>>> to be exported unless CONFIG_IPV6=m
>>>
>>> tcp_hashinfo is no longer used from any module anyway.
>>
>> You also removed EXPORT for tcp_openreq_init_rwin function. Quick
>> grep shows that it is also not used anymore by any module, so probably
>> you forgot to add this info to commit message? Do you think it is worth
>> to add?
> 
> I forgot to add this in the commit message.
> 
> Not sure if this worth a v2, because IPv6 no longer calls this
> function after this old commit

Oh, you are right! It is not used in IPv6. I guess it is not needed to
resend the series, thanks for clarifying

> 
> commit 1fb6f159fd21c640a28eb65fbd62ce8c9f6a777e
> Author: Octavian Purdila <octavian.purdila@intel.com>
> Date:   Wed Jun 25 17:10:02 2014 +0300
> 
>      tcp: add tcp_conn_request
> 
> 
>>
>>>
>>> Signed-off-by: Eric Dumazet <edumazet@google.com>
>>> ---
>>
>> [...]
>>
>>> @@ -457,7 +457,6 @@ void tcp_openreq_init_rwin(struct request_sock *req,
>>>                rcv_wnd);
>>>        ireq->rcv_wscale = rcv_wscale;
>>>    }
>>> -EXPORT_SYMBOL(tcp_openreq_init_rwin);
>>
>> Exactly here
> 
> Yes, thanks.

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

* Re: [PATCH net-next 0/4] net: add EXPORT_IPV6_MOD()
  2025-02-10  8:28 [PATCH net-next 0/4] net: add EXPORT_IPV6_MOD() Eric Dumazet
                   ` (3 preceding siblings ...)
  2025-02-10  8:28 ` [PATCH net-next 4/4] udp: " Eric Dumazet
@ 2025-02-10  9:25 ` Mateusz Polchlopek
  2025-02-10 18:33 ` Willem de Bruijn
  5 siblings, 0 replies; 19+ messages in thread
From: Mateusz Polchlopek @ 2025-02-10  9:25 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, Willem de Bruijn, Simon Horman, eric.dumazet



On 2/10/2025 9:28 AM, Eric Dumazet wrote:
> In this series I am adding EXPORT_IPV6_MOD and EXPORT_IPV6_MOD_GPL()
> so that we can replace some EXPORT_SYMBOL() when IPV6 is
> not modular.
> 
> This is making all the selected symbols internal to core
> linux networking.
> 
> Eric Dumazet (4):
>    net: introduce EXPORT_IPV6_MOD() and EXPORT_IPV6_MOD_GPL()
>    inetpeer: use EXPORT_IPV6_MOD[_GPL]()
>    tcp: use EXPORT_IPV6_MOD[_GPL]()
>    udp: use EXPORT_IPV6_MOD[_GPL]()
> 
>   include/net/ip.h         |  8 ++++++
>   net/core/secure_seq.c    |  4 +--
>   net/ipv4/inetpeer.c      |  8 +++---
>   net/ipv4/syncookies.c    |  8 +++---
>   net/ipv4/tcp.c           | 48 ++++++++++++++++-----------------
>   net/ipv4/tcp_fastopen.c  |  2 +-
>   net/ipv4/tcp_input.c     | 14 +++++-----
>   net/ipv4/tcp_ipv4.c      | 47 ++++++++++++++++-----------------
>   net/ipv4/tcp_minisocks.c | 11 ++++----
>   net/ipv4/tcp_output.c    | 12 ++++-----
>   net/ipv4/tcp_timer.c     |  4 +--
>   net/ipv4/udp.c           | 57 ++++++++++++++++++++--------------------
>   12 files changed, 114 insertions(+), 109 deletions(-)
> 

The overall looks fine for me, the question from patch3 was a small
nitpick but not important.

For the series please add my RB tag.

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

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

* Re: [PATCH net-next 3/4] tcp: use EXPORT_IPV6_MOD[_GPL]()
  2025-02-10  8:28 ` [PATCH net-next 3/4] tcp: " Eric Dumazet
  2025-02-10  8:41   ` Mateusz Polchlopek
@ 2025-02-10  9:30   ` Sabrina Dubroca
  2025-02-10  9:44     ` Eric Dumazet
  2025-02-10 12:21   ` kernel test robot
  2 siblings, 1 reply; 19+ messages in thread
From: Sabrina Dubroca @ 2025-02-10  9:30 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, netdev,
	Willem de Bruijn, Simon Horman, eric.dumazet

2025-02-10, 08:28:04 +0000, Eric Dumazet wrote:
> @@ -613,7 +613,7 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
>  
>  	return mask;
>  }
> -EXPORT_SYMBOL(tcp_poll);
> +EXPORT_IPV6_MOD(tcp_poll);

ktls uses it directly (net/tls/tls_main.c):

static __poll_t tls_sk_poll(struct file *file, struct socket *sock,
			    struct poll_table_struct *wait)
{
	struct tls_sw_context_rx *ctx;
	struct tls_context *tls_ctx;
	struct sock *sk = sock->sk;
	struct sk_psock *psock;
	__poll_t mask = 0;
	u8 shutdown;
	int state;

	mask = tcp_poll(file, sock, wait);
[...]
}

If you want to un-export tcp_poll, I guess we'll need to add the same
thing as for ->sk_data_ready (save the old ->poll to tls_context).

-- 
Sabrina

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

* Re: [PATCH net-next 3/4] tcp: use EXPORT_IPV6_MOD[_GPL]()
  2025-02-10  9:30   ` Sabrina Dubroca
@ 2025-02-10  9:44     ` Eric Dumazet
  2025-02-10  9:56       ` Eric Dumazet
  0 siblings, 1 reply; 19+ messages in thread
From: Eric Dumazet @ 2025-02-10  9:44 UTC (permalink / raw)
  To: Sabrina Dubroca
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, netdev,
	Willem de Bruijn, Simon Horman, eric.dumazet

On Mon, Feb 10, 2025 at 10:30 AM Sabrina Dubroca <sd@queasysnail.net> wrote:
>
> 2025-02-10, 08:28:04 +0000, Eric Dumazet wrote:
> > @@ -613,7 +613,7 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
> >
> >       return mask;
> >  }
> > -EXPORT_SYMBOL(tcp_poll);
> > +EXPORT_IPV6_MOD(tcp_poll);
>
> ktls uses it directly (net/tls/tls_main.c):


Oh, right.

>
> static __poll_t tls_sk_poll(struct file *file, struct socket *sock,
>                             struct poll_table_struct *wait)
> {
>         struct tls_sw_context_rx *ctx;
>         struct tls_context *tls_ctx;
>         struct sock *sk = sock->sk;
>         struct sk_psock *psock;
>         __poll_t mask = 0;
>         u8 shutdown;
>         int state;
>
>         mask = tcp_poll(file, sock, wait);
> [...]
> }
>
> If you want to un-export tcp_poll, I guess we'll need to add the same
> thing as for ->sk_data_ready (save the old ->poll to tls_context).

No need, I simply missed tls was using tcp_poll() can could be a
module, I will fix in V2

Thanks !

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

* Re: [PATCH net-next 3/4] tcp: use EXPORT_IPV6_MOD[_GPL]()
  2025-02-10  9:44     ` Eric Dumazet
@ 2025-02-10  9:56       ` Eric Dumazet
  2025-02-10 11:35         ` Sabrina Dubroca
  0 siblings, 1 reply; 19+ messages in thread
From: Eric Dumazet @ 2025-02-10  9:56 UTC (permalink / raw)
  To: Sabrina Dubroca
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, netdev,
	Willem de Bruijn, Simon Horman, eric.dumazet

On Mon, Feb 10, 2025 at 10:44 AM Eric Dumazet <edumazet@google.com> wrote:
>
> On Mon, Feb 10, 2025 at 10:30 AM Sabrina Dubroca <sd@queasysnail.net> wrote:
> >
> > 2025-02-10, 08:28:04 +0000, Eric Dumazet wrote:
> > > @@ -613,7 +613,7 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
> > >
> > >       return mask;
> > >  }
> > > -EXPORT_SYMBOL(tcp_poll);
> > > +EXPORT_IPV6_MOD(tcp_poll);
> >
> > ktls uses it directly (net/tls/tls_main.c):
>
>
> Oh, right.
>
> >
> > static __poll_t tls_sk_poll(struct file *file, struct socket *sock,
> >                             struct poll_table_struct *wait)
> > {
> >         struct tls_sw_context_rx *ctx;
> >         struct tls_context *tls_ctx;
> >         struct sock *sk = sock->sk;
> >         struct sk_psock *psock;
> >         __poll_t mask = 0;
> >         u8 shutdown;
> >         int state;
> >
> >         mask = tcp_poll(file, sock, wait);
> > [...]
> > }
> >
> > If you want to un-export tcp_poll, I guess we'll need to add the same
> > thing as for ->sk_data_ready (save the old ->poll to tls_context).
>
> No need, I simply missed tls was using tcp_poll() can could be a
> module, I will fix in V2
>

TLS also calls tcp_under_memory_pressure() via tcp_epollin_ready(),
so tcp_memory_pressure needs to be exported as well.

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

* Re: [PATCH net-next 3/4] tcp: use EXPORT_IPV6_MOD[_GPL]()
  2025-02-10  9:56       ` Eric Dumazet
@ 2025-02-10 11:35         ` Sabrina Dubroca
  2025-02-10 12:26           ` Eric Dumazet
  0 siblings, 1 reply; 19+ messages in thread
From: Sabrina Dubroca @ 2025-02-10 11:35 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, netdev,
	Willem de Bruijn, Simon Horman, eric.dumazet

2025-02-10, 10:56:22 +0100, Eric Dumazet wrote:
> On Mon, Feb 10, 2025 at 10:44 AM Eric Dumazet <edumazet@google.com> wrote:
> >
> > On Mon, Feb 10, 2025 at 10:30 AM Sabrina Dubroca <sd@queasysnail.net> wrote:
> > >
> > > 2025-02-10, 08:28:04 +0000, Eric Dumazet wrote:
> > > > @@ -613,7 +613,7 @@ __poll_t tcp_poll(struct file *file, struct socket *sock, poll_table *wait)
> > > >
> > > >       return mask;
> > > >  }
> > > > -EXPORT_SYMBOL(tcp_poll);
> > > > +EXPORT_IPV6_MOD(tcp_poll);
> > >
> > > ktls uses it directly (net/tls/tls_main.c):
> >
> >
> > Oh, right.
> >
> > >
> > > static __poll_t tls_sk_poll(struct file *file, struct socket *sock,
> > >                             struct poll_table_struct *wait)
> > > {
> > >         struct tls_sw_context_rx *ctx;
> > >         struct tls_context *tls_ctx;
> > >         struct sock *sk = sock->sk;
> > >         struct sk_psock *psock;
> > >         __poll_t mask = 0;
> > >         u8 shutdown;
> > >         int state;
> > >
> > >         mask = tcp_poll(file, sock, wait);
> > > [...]
> > > }
> > >
> > > If you want to un-export tcp_poll, I guess we'll need to add the same
> > > thing as for ->sk_data_ready (save the old ->poll to tls_context).
> >
> > No need, I simply missed tls was using tcp_poll() can could be a
> > module, I will fix in V2
> >
> 
> TLS also calls tcp_under_memory_pressure() via tcp_epollin_ready(),
> so tcp_memory_pressure needs to be exported as well.

Ah, yes, didn't think about inline helpers.

I ran a quick build since I was concerned about what the Chelsio TOE
driver might be using, but spotted this instead:

ERROR: modpost: "secure_tcpv6_seq" [drivers/infiniband/hw/irdma/irdma.ko] undefined!

-- 
Sabrina

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

* Re: [PATCH net-next 3/4] tcp: use EXPORT_IPV6_MOD[_GPL]()
  2025-02-10  8:28 ` [PATCH net-next 3/4] tcp: " Eric Dumazet
  2025-02-10  8:41   ` Mateusz Polchlopek
  2025-02-10  9:30   ` Sabrina Dubroca
@ 2025-02-10 12:21   ` kernel test robot
  2 siblings, 0 replies; 19+ messages in thread
From: kernel test robot @ 2025-02-10 12:21 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: oe-kbuild-all, netdev, Willem de Bruijn, Simon Horman,
	eric.dumazet, Eric Dumazet

Hi Eric,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Eric-Dumazet/net-introduce-EXPORT_IPV6_MOD-and-EXPORT_IPV6_MOD_GPL/20250210-163000
base:   net-next/main
patch link:    https://lore.kernel.org/r/20250210082805.465241-4-edumazet%40google.com
patch subject: [PATCH net-next 3/4] tcp: use EXPORT_IPV6_MOD[_GPL]()
config: i386-buildonly-randconfig-002-20250210 (https://download.01.org/0day-ci/archive/20250210/202502102052.AL2TIjxx-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250210/202502102052.AL2TIjxx-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502102052.AL2TIjxx-lkp@intel.com/

All errors (new ones prefixed by >>, old ones prefixed by <<):

WARNING: modpost: missing MODULE_DESCRIPTION() in fs/exportfs/exportfs.o
>> ERROR: modpost: "tcp_memory_pressure" [net/tls/tls.ko] undefined!
>> ERROR: modpost: "tcp_poll" [net/tls/tls.ko] undefined!

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH net-next 3/4] tcp: use EXPORT_IPV6_MOD[_GPL]()
  2025-02-10 11:35         ` Sabrina Dubroca
@ 2025-02-10 12:26           ` Eric Dumazet
  0 siblings, 0 replies; 19+ messages in thread
From: Eric Dumazet @ 2025-02-10 12:26 UTC (permalink / raw)
  To: Sabrina Dubroca
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, netdev,
	Willem de Bruijn, Simon Horman, eric.dumazet

On Mon, Feb 10, 2025 at 12:35 PM Sabrina Dubroca <sd@queasysnail.net> wrote:
>

> I ran a quick build since I was concerned about what the Chelsio TOE
> driver might be using, but spotted this instead:
>
> ERROR: modpost: "secure_tcpv6_seq" [drivers/infiniband/hw/irdma/irdma.ko] undefined!

Indeed, I had the same error.

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

* Re: [PATCH net-next 0/4] net: add EXPORT_IPV6_MOD()
  2025-02-10  8:28 [PATCH net-next 0/4] net: add EXPORT_IPV6_MOD() Eric Dumazet
                   ` (4 preceding siblings ...)
  2025-02-10  9:25 ` [PATCH net-next 0/4] net: add EXPORT_IPV6_MOD() Mateusz Polchlopek
@ 2025-02-10 18:33 ` Willem de Bruijn
  2025-02-10 18:46   ` Eric Dumazet
  5 siblings, 1 reply; 19+ messages in thread
From: Willem de Bruijn @ 2025-02-10 18:33 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, Willem de Bruijn, Simon Horman, eric.dumazet,
	Eric Dumazet

Eric Dumazet wrote:
> In this series I am adding EXPORT_IPV6_MOD and EXPORT_IPV6_MOD_GPL()
> so that we can replace some EXPORT_SYMBOL() when IPV6 is
> not modular.
> 
> This is making all the selected symbols internal to core
> linux networking.

Is the goal to avoid use by external code, similar to the recent
addition of namespacified internal network exports with
EXPORT_SYMBOL_NS_GPL( , "NETDEV_INTERNAL")?
 

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

* Re: [PATCH net-next 0/4] net: add EXPORT_IPV6_MOD()
  2025-02-10 18:33 ` Willem de Bruijn
@ 2025-02-10 18:46   ` Eric Dumazet
  0 siblings, 0 replies; 19+ messages in thread
From: Eric Dumazet @ 2025-02-10 18:46 UTC (permalink / raw)
  To: Willem de Bruijn
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, netdev,
	Willem de Bruijn, Simon Horman, eric.dumazet

On Mon, Feb 10, 2025 at 7:33 PM Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
>
> Eric Dumazet wrote:
> > In this series I am adding EXPORT_IPV6_MOD and EXPORT_IPV6_MOD_GPL()
> > so that we can replace some EXPORT_SYMBOL() when IPV6 is
> > not modular.
> >
> > This is making all the selected symbols internal to core
> > linux networking.
>
> Is the goal to avoid use by external code, similar to the recent
> addition of namespacified internal network exports with
> EXPORT_SYMBOL_NS_GPL( , "NETDEV_INTERNAL")?

Goals are :

1) Documentation purpose :
     This symbol is privately exported, and might not be exported
under some conditions.
      Effectively this makes these symbols unavailable to modules.

      I thought of using _GPL even for EXPORT_IPV6_MOD() indeed.

2) Remove three lines in /proc/kallsyms per symbol, eg :

ffffffff8b94433c r __ksymtab_tcp_sockets_allocated
ffffffff8b96fa75 r __kstrtabns_tcp_sockets_allocated
ffffffff8b99adf0 r __kstrtab_tcp_sockets_allocated

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

* Re: [PATCH net-next 4/4] udp: use EXPORT_IPV6_MOD[_GPL]()
  2025-02-10  8:28 ` [PATCH net-next 4/4] udp: " Eric Dumazet
@ 2025-02-11  2:56   ` Willem de Bruijn
  2025-02-11  8:08     ` Eric Dumazet
  0 siblings, 1 reply; 19+ messages in thread
From: Willem de Bruijn @ 2025-02-11  2:56 UTC (permalink / raw)
  To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: netdev, Willem de Bruijn, Simon Horman, eric.dumazet,
	Eric Dumazet

Eric Dumazet wrote:
> Use EXPORT_IPV6_MOD[_GPL]() for symbols that don't need
> to be exported unless CONFIG_IPV6=m
> 
> udp_table is no longer used from any modules, and does not
> need to be exported anyway.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Should udp_disconnect be included?

And perhaps udp_encap_needed_key. The only real user is static inline
udp_unexpected_gso, itself only used in core udp code. But not sure if
it would cause build errors.

With those minor asides

Acked-by: Willem de Bruijn <willemb@google.com>

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

* Re: [PATCH net-next 4/4] udp: use EXPORT_IPV6_MOD[_GPL]()
  2025-02-11  2:56   ` Willem de Bruijn
@ 2025-02-11  8:08     ` Eric Dumazet
  0 siblings, 0 replies; 19+ messages in thread
From: Eric Dumazet @ 2025-02-11  8:08 UTC (permalink / raw)
  To: Willem de Bruijn
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, netdev,
	Willem de Bruijn, Simon Horman, eric.dumazet

On Tue, Feb 11, 2025 at 3:56 AM Willem de Bruijn
<willemdebruijn.kernel@gmail.com> wrote:
>
> Eric Dumazet wrote:
> > Use EXPORT_IPV6_MOD[_GPL]() for symbols that don't need
> > to be exported unless CONFIG_IPV6=m
> >
> > udp_table is no longer used from any modules, and does not
> > need to be exported anyway.
> >
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
>
> Should udp_disconnect be included?

Yes, it can.

>
> And perhaps udp_encap_needed_key. The only real user is static inline
> udp_unexpected_gso, itself only used in core udp code. But not sure if
> it would cause build errors.
>

udp_encap_needed_key and udpv6_encap_needed_key can both get the new
macro, thanks

> With those minor asides
>
> Acked-by: Willem de Bruijn <willemb@google.com>

I will squash the following in v2, thanks !

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 73ac614beb109146c5635aeeb10c2e9f77a6ee1c..3485989cd4bdec96e8cb7ecb28b68a25c3444a96
100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -808,11 +808,11 @@ static inline bool __udp_is_mcast_sock(struct
net *net, const struct sock *sk,
 }

 DEFINE_STATIC_KEY_FALSE(udp_encap_needed_key);
-EXPORT_SYMBOL(udp_encap_needed_key);
+EXPORT_IPV6_MOD(udp_encap_needed_key);

 #if IS_ENABLED(CONFIG_IPV6)
 DEFINE_STATIC_KEY_FALSE(udpv6_encap_needed_key);
-EXPORT_SYMBOL(udpv6_encap_needed_key);
+EXPORT_IPV6_MOD(udpv6_encap_needed_key);
 #endif

 void udp_encap_enable(void)
@@ -2185,7 +2185,7 @@ int udp_disconnect(struct sock *sk, int flags)
        release_sock(sk);
        return 0;
 }
-EXPORT_SYMBOL(udp_disconnect);
+EXPORT_IPV6_MOD(udp_disconnect);

 void udp_lib_unhash(struct sock *sk)
 {

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

end of thread, other threads:[~2025-02-11  8:09 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-10  8:28 [PATCH net-next 0/4] net: add EXPORT_IPV6_MOD() Eric Dumazet
2025-02-10  8:28 ` [PATCH net-next 1/4] net: introduce EXPORT_IPV6_MOD() and EXPORT_IPV6_MOD_GPL() Eric Dumazet
2025-02-10  8:28 ` [PATCH net-next 2/4] inetpeer: use EXPORT_IPV6_MOD[_GPL]() Eric Dumazet
2025-02-10  8:28 ` [PATCH net-next 3/4] tcp: " Eric Dumazet
2025-02-10  8:41   ` Mateusz Polchlopek
2025-02-10  9:08     ` Eric Dumazet
2025-02-10  9:23       ` Mateusz Polchlopek
2025-02-10  9:30   ` Sabrina Dubroca
2025-02-10  9:44     ` Eric Dumazet
2025-02-10  9:56       ` Eric Dumazet
2025-02-10 11:35         ` Sabrina Dubroca
2025-02-10 12:26           ` Eric Dumazet
2025-02-10 12:21   ` kernel test robot
2025-02-10  8:28 ` [PATCH net-next 4/4] udp: " Eric Dumazet
2025-02-11  2:56   ` Willem de Bruijn
2025-02-11  8:08     ` Eric Dumazet
2025-02-10  9:25 ` [PATCH net-next 0/4] net: add EXPORT_IPV6_MOD() Mateusz Polchlopek
2025-02-10 18:33 ` Willem de Bruijn
2025-02-10 18:46   ` Eric Dumazet

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