public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
	Neal Cardwell <ncardwell@google.com>,
	 Kuniyuki Iwashima <kuniyu@google.com>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com,
	 Eric Dumazet <edumazet@google.com>
Subject: [PATCH net-next 2/3] tcp: move tcp_v6_send_check() to tcp_output.c
Date: Tue,  3 Feb 2026 14:40:52 +0000	[thread overview]
Message-ID: <20260203144053.83193-3-edumazet@google.com> (raw)
In-Reply-To: <20260203144053.83193-1-edumazet@google.com>

Move tcp_v6_send_check() so that __tcp_transmit_skb() can inline it.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/net/tcp.h     |  3 ++-
 net/ipv4/tcp_output.c | 20 +++++++++++++++++---
 net/ipv6/tcp_ipv6.c   |  5 -----
 3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 80f84564cb3d2b100e46f85fd9ee33d2c6ffe3c2..b9bebf5df4aa6ecf6f421400fb93cefb4104e5aa 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1124,7 +1124,8 @@ static inline int tcp_v6_sdif(const struct sk_buff *skb)
 
 extern const struct inet_connection_sock_af_ops ipv6_specific;
 
-INDIRECT_CALLABLE_DECLARE(void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb));
+void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb);
+
 INDIRECT_CALLABLE_DECLARE(int tcp_v6_rcv(struct sk_buff *skb));
 void tcp_v6_early_demux(struct sk_buff *skb);
 
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index cc398b7fdcba9ffddf2e43179b89fc5d14be51d7..8c1731b544f42cfa1e7629dde128e969b60d2343 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1487,6 +1487,16 @@ void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb)
 }
 EXPORT_IPV6_MOD(tcp_v4_send_check);
 
+#if IS_ENABLED(CONFIG_IPV6)
+#include <net/ip6_checksum.h>
+
+void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)
+{
+	__tcp_v6_send_check(skb, &sk->sk_v6_rcv_saddr, &sk->sk_v6_daddr);
+}
+EXPORT_IPV6_MOD(tcp_v6_send_check);
+#endif
+
 /* This routine actually transmits TCP packets queued in by
  * tcp_do_sendmsg().  This is used by both the initial
  * transmission and possible later retransmissions.
@@ -1648,9 +1658,13 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb,
 	/* BPF prog is the last one writing header option */
 	bpf_skops_write_hdr_opt(sk, skb, NULL, NULL, 0, &opts);
 
-	INDIRECT_CALL_INET(icsk->icsk_af_ops->send_check,
-			   tcp_v6_send_check, tcp_v4_send_check,
-			   sk, skb);
+#if IS_ENABLED(CONFIG_IPV6)
+	if (likely(icsk->icsk_af_ops->send_check == tcp_v6_send_check))
+		tcp_v6_send_check(sk, skb);
+	else
+#else
+		tcp_v4_send_check(sk, skb);
+#endif
 
 	if (likely(tcb->tcp_flags & TCPHDR_ACK))
 		tcp_event_ack_sent(sk, rcv_nxt);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index c65a5bfd322a1db5dc3fbc406e577f0ccb044c23..ca01b11c0ac959e4ee18dd388c3d17e8a4c88761 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -2015,11 +2015,6 @@ static struct timewait_sock_ops tcp6_timewait_sock_ops = {
 	.twsk_obj_size	= sizeof(struct tcp6_timewait_sock),
 };
 
-INDIRECT_CALLABLE_SCOPE void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)
-{
-	__tcp_v6_send_check(skb, &sk->sk_v6_rcv_saddr, &sk->sk_v6_daddr);
-}
-
 const struct inet_connection_sock_af_ops ipv6_specific = {
 	.queue_xmit	   = inet6_csk_xmit,
 	.send_check	   = tcp_v6_send_check,
-- 
2.53.0.rc1.225.gd81095ad13-goog


  parent reply	other threads:[~2026-02-03 14:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-03 14:40 [PATCH net-next 0/3] tcp: rework tcp_v{4,6}_send_check() Eric Dumazet
2026-02-03 14:40 ` [PATCH net-next 1/3] tcp: inline __tcp_v4_send_check() Eric Dumazet
2026-02-03 14:40 ` Eric Dumazet [this message]
2026-02-09  5:10   ` [PATCH net-next 2/3] tcp: move tcp_v6_send_check() to tcp_output.c kernel test robot
2026-02-03 14:40 ` [PATCH net-next 3/3] tcp: make tcp_v{4,6}_send_check() static Eric Dumazet
2026-02-03 17:26   ` Jakub Kicinski
2026-02-03 18:18     ` Eric Dumazet
2026-02-10 14:09       ` Eric Dumazet
2026-02-03 19:55   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260203144053.83193-3-edumazet@google.com \
    --to=edumazet@google.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox