]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tcp: add indirect call wrapper in tcp_conn_request()
authorEric Dumazet <edumazet@google.com>
Fri, 10 Apr 2026 17:49:50 +0000 (17:49 +0000)
committerJakub Kicinski <kuba@kernel.org>
Sun, 12 Apr 2026 16:17:03 +0000 (09:17 -0700)
Small improvement in SYN processing, to directly call
tcp_v6_init_seq_and_ts_off() or tcp_v4_init_seq_and_ts_off().

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

index fce4b653c23ec790f561d577fcd6160d3d92e3c0..23ce0329b2304e6bf1866bc495a9e057ae040b8d 100644 (file)
@@ -3084,4 +3084,10 @@ static inline int tcp_recv_should_stop(struct sock *sk)
               signal_pending(current);
 }
 
+INDIRECT_CALLABLE_DECLARE(union tcp_seq_and_ts_off
+                         tcp_v4_init_seq_and_ts_off(const struct net *net,
+                                                    const struct sk_buff *skb));
+INDIRECT_CALLABLE_DECLARE(union tcp_seq_and_ts_off
+                         tcp_v6_init_seq_and_ts_off(const struct net *net,
+                                                    const struct sk_buff *skb));
 #endif /* _TCP_H */
index 7171442c3ed7ae62ec45c093cc58ad5a5c978ed9..021f745747c59d8b9e200c5954af7807a4d08866 100644 (file)
@@ -7658,7 +7658,10 @@ int tcp_conn_request(struct request_sock_ops *rsk_ops,
                goto drop_and_free;
 
        if (tmp_opt.tstamp_ok || (!want_cookie && !isn))
-               st = af_ops->init_seq_and_ts_off(net, skb);
+               st = INDIRECT_CALL_INET(af_ops->init_seq_and_ts_off,
+                                       tcp_v6_init_seq_and_ts_off,
+                                       tcp_v4_init_seq_and_ts_off,
+                                       net, skb);
 
        if (tmp_opt.tstamp_ok) {
                tcp_rsk(req)->req_usec_ts = dst_tcp_usec_ts(dst);
index c9bbbf32364827d341b4c1fd77617031b0739c50..6813b03515a2ef256b0d3c167de7e435e2651111 100644 (file)
@@ -105,7 +105,7 @@ static DEFINE_PER_CPU(struct sock_bh_locked, ipv4_tcp_sk) = {
 
 static DEFINE_MUTEX(tcp_exit_batch_mutex);
 
-static union tcp_seq_and_ts_off
+INDIRECT_CALLABLE_SCOPE union tcp_seq_and_ts_off
 tcp_v4_init_seq_and_ts_off(const struct net *net, const struct sk_buff *skb)
 {
        return secure_tcp_seq_and_ts_off(net,
index 1d37826e8480f203846e963418cfe2085131adfa..0cfde020d1f023ad0e3fe8d8eecd235b05a35871 100644 (file)
@@ -105,7 +105,7 @@ static void inet6_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb)
        }
 }
 
-static union tcp_seq_and_ts_off
+INDIRECT_CALLABLE_SCOPE union tcp_seq_and_ts_off
 tcp_v6_init_seq_and_ts_off(const struct net *net, const struct sk_buff *skb)
 {
        return secure_tcpv6_seq_and_ts_off(net,