]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tcp: move tcp_v6_send_check() to tcp_output.c
authorEric Dumazet <edumazet@google.com>
Mon, 23 Feb 2026 10:07:28 +0000 (10:07 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 25 Feb 2026 01:16:09 +0000 (17:16 -0800)
Move tcp_v6_send_check() so that __tcp_transmit_skb() can inline it.

$ scripts/bloat-o-meter -t vmlinux.1 vmlinux.2
add/remove: 0/0 grow/shrink: 1/0 up/down: 105/0 (105)
Function                                     old     new   delta
__tcp_transmit_skb                          3321    3426    +105
Total: Before=25143091, After=25143196, chg +0.00%

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20260223100729.3761597-3-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/tcp.h
net/ipv4/tcp_output.c
net/ipv6/tcp_ipv6.c

index 3c84433f3d57b1bb29b10f41a5d9981145134237..feaddce9d80523a9e7bd9db4c691736859c48c91 100644 (file)
@@ -1132,7 +1132,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);
 
index 29056d6fc787ec4ad4e3126634e5d52dacf6d700..fdddb16630a5108607496bfdc4d603baa43de621 100644 (file)
@@ -1506,6 +1506,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.
@@ -1667,9 +1677,12 @@ 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
+#endif
+               tcp_v4_send_check(sk, skb);
 
        if (likely(tcb->tcp_flags & TCPHDR_ACK))
                tcp_event_ack_sent(sk, rcv_nxt);
index d10487b4e5bff87d4ff2a7b912a826964101a163..306ca0585b4a60fcaafcbc9656a5fe36ad21d1b2 100644 (file)
@@ -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,