Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tcp: move tcp_v6_early_demux() to net/ipv6/ip6_input.c

tcp_v6_early_demux() has a single caller : ip6_rcv_finish_core().

Move it to net/ipv6/ip6_input.c and mark it static, for possible
compiler/linker optimizations.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260304022706.1062459-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
46cb1fcd 54f5a89d

+40 -39
-1
include/net/tcp.h
··· 1142 1142 extern const struct inet_connection_sock_af_ops ipv6_specific; 1143 1143 1144 1144 INDIRECT_CALLABLE_DECLARE(int tcp_v6_rcv(struct sk_buff *skb)); 1145 - void tcp_v6_early_demux(struct sk_buff *skb); 1146 1145 1147 1146 #endif 1148 1147
+40
net/ipv6/ip6_input.c
··· 44 44 #include <net/xfrm.h> 45 45 #include <net/inet_ecn.h> 46 46 #include <net/dst_metadata.h> 47 + #include <net/inet6_hashtables.h> 48 + 49 + static void tcp_v6_early_demux(struct sk_buff *skb) 50 + { 51 + struct net *net = dev_net_rcu(skb->dev); 52 + const struct ipv6hdr *hdr; 53 + const struct tcphdr *th; 54 + struct sock *sk; 55 + 56 + if (skb->pkt_type != PACKET_HOST) 57 + return; 58 + 59 + if (!pskb_may_pull(skb, skb_transport_offset(skb) + 60 + sizeof(struct tcphdr))) 61 + return; 62 + 63 + hdr = ipv6_hdr(skb); 64 + th = tcp_hdr(skb); 65 + 66 + if (th->doff < sizeof(struct tcphdr) / 4) 67 + return; 68 + 69 + /* Note : We use inet6_iif() here, not tcp_v6_iif() */ 70 + sk = __inet6_lookup_established(net, &hdr->saddr, th->source, 71 + &hdr->daddr, ntohs(th->dest), 72 + inet6_iif(skb), inet6_sdif(skb)); 73 + if (sk) { 74 + skb->sk = sk; 75 + skb->destructor = sock_edemux; 76 + if (sk_fullsock(sk)) { 77 + struct dst_entry *dst = rcu_dereference(sk->sk_rx_dst); 78 + 79 + if (dst) 80 + dst = dst_check(dst, sk->sk_rx_dst_cookie); 81 + if (dst && 82 + sk->sk_rx_dst_ifindex == skb->skb_iif) 83 + skb_dst_set_noref(skb, dst); 84 + } 85 + } 86 + } 47 87 48 88 static void ip6_rcv_finish_core(struct net *net, struct sock *sk, 49 89 struct sk_buff *skb)
-38
net/ipv6/tcp_ipv6.c
··· 1972 1972 goto discard_it; 1973 1973 } 1974 1974 1975 - void tcp_v6_early_demux(struct sk_buff *skb) 1976 - { 1977 - struct net *net = dev_net_rcu(skb->dev); 1978 - const struct ipv6hdr *hdr; 1979 - const struct tcphdr *th; 1980 - struct sock *sk; 1981 - 1982 - if (skb->pkt_type != PACKET_HOST) 1983 - return; 1984 - 1985 - if (!pskb_may_pull(skb, skb_transport_offset(skb) + sizeof(struct tcphdr))) 1986 - return; 1987 - 1988 - hdr = ipv6_hdr(skb); 1989 - th = tcp_hdr(skb); 1990 - 1991 - if (th->doff < sizeof(struct tcphdr) / 4) 1992 - return; 1993 - 1994 - /* Note : We use inet6_iif() here, not tcp_v6_iif() */ 1995 - sk = __inet6_lookup_established(net, &hdr->saddr, th->source, 1996 - &hdr->daddr, ntohs(th->dest), 1997 - inet6_iif(skb), inet6_sdif(skb)); 1998 - if (sk) { 1999 - skb->sk = sk; 2000 - skb->destructor = sock_edemux; 2001 - if (sk_fullsock(sk)) { 2002 - struct dst_entry *dst = rcu_dereference(sk->sk_rx_dst); 2003 - 2004 - if (dst) 2005 - dst = dst_check(dst, sk->sk_rx_dst_cookie); 2006 - if (dst && 2007 - sk->sk_rx_dst_ifindex == skb->skb_iif) 2008 - skb_dst_set_noref(skb, dst); 2009 - } 2010 - } 2011 - } 2012 - 2013 1975 static struct timewait_sock_ops tcp6_timewait_sock_ops = { 2014 1976 .twsk_obj_size = sizeof(struct tcp6_timewait_sock), 2015 1977 };