* [PATCH net-next] tcp: move tcp_v4_early_demux() to net/ipv4/ip_input.c
@ 2026-03-06 13:11 Eric Dumazet
2026-03-06 16:16 ` David Ahern
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Eric Dumazet @ 2026-03-06 13:11 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, Neal Cardwell, Kuniyuki Iwashima, David Ahern,
netdev, eric.dumazet, Eric Dumazet
tcp_v4_early_demux() has a single caller : ip_rcv_finish_core().
Move it to net/ipv4/ip_input.c and mark it static, for possible
compiler/linker optimizations.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
include/net/tcp.h | 1 -
net/ipv4/ip_input.c | 39 +++++++++++++++++++++++++++++++++++++++
net/ipv4/tcp_ipv4.c | 38 --------------------------------------
3 files changed, 39 insertions(+), 39 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index a6464142380696e4948a836145ac7aca4ca3ec15..f07aef7faa65f8bfcdf93c9fe943f9b4d4a0dddb 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -363,7 +363,6 @@ int tcp_v4_err(struct sk_buff *skb, u32);
void tcp_shutdown(struct sock *sk, int how);
-int tcp_v4_early_demux(struct sk_buff *skb);
int tcp_v4_rcv(struct sk_buff *skb);
void tcp_remove_empty_skb(struct sock *sk);
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 19d3141dad1f8b031981aea40c311509583e9256..9860178752b8ccd70fd97d2a713b7c1a981fcc71 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -319,6 +319,45 @@ static bool ip_can_use_hint(const struct sk_buff *skb, const struct iphdr *iph,
ip_hdr(hint)->tos == iph->tos;
}
+static int tcp_v4_early_demux(struct sk_buff *skb)
+{
+ struct net *net = dev_net_rcu(skb->dev);
+ const struct iphdr *iph;
+ const struct tcphdr *th;
+ struct sock *sk;
+
+ if (skb->pkt_type != PACKET_HOST)
+ return 0;
+
+ if (!pskb_may_pull(skb, skb_transport_offset(skb) +
+ sizeof(struct tcphdr)))
+ return 0;
+
+ iph = ip_hdr(skb);
+ th = tcp_hdr(skb);
+
+ if (th->doff < sizeof(struct tcphdr) / 4)
+ return 0;
+
+ sk = __inet_lookup_established(net, iph->saddr, th->source,
+ iph->daddr, ntohs(th->dest),
+ skb->skb_iif, inet_sdif(skb));
+ if (sk) {
+ skb->sk = sk;
+ skb->destructor = sock_edemux;
+ if (sk_fullsock(sk)) {
+ struct dst_entry *dst = rcu_dereference(sk->sk_rx_dst);
+
+ if (dst)
+ dst = dst_check(dst, 0);
+ if (dst &&
+ sk->sk_rx_dst_ifindex == skb->skb_iif)
+ skb_dst_set_noref(skb, dst);
+ }
+ }
+ return 0;
+}
+
static int ip_rcv_finish_core(struct net *net,
struct sk_buff *skb, struct net_device *dev,
const struct sk_buff *hint)
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 190e8a238876d966822531c74f17b896181e359f..f27995a6456198866ec2f9860b18d911e8dc1bcd 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1914,44 +1914,6 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
}
EXPORT_SYMBOL(tcp_v4_do_rcv);
-int tcp_v4_early_demux(struct sk_buff *skb)
-{
- struct net *net = dev_net_rcu(skb->dev);
- const struct iphdr *iph;
- const struct tcphdr *th;
- struct sock *sk;
-
- if (skb->pkt_type != PACKET_HOST)
- return 0;
-
- if (!pskb_may_pull(skb, skb_transport_offset(skb) + sizeof(struct tcphdr)))
- return 0;
-
- iph = ip_hdr(skb);
- th = tcp_hdr(skb);
-
- if (th->doff < sizeof(struct tcphdr) / 4)
- return 0;
-
- sk = __inet_lookup_established(net, iph->saddr, th->source,
- iph->daddr, ntohs(th->dest),
- skb->skb_iif, inet_sdif(skb));
- if (sk) {
- skb->sk = sk;
- skb->destructor = sock_edemux;
- if (sk_fullsock(sk)) {
- struct dst_entry *dst = rcu_dereference(sk->sk_rx_dst);
-
- if (dst)
- dst = dst_check(dst, 0);
- if (dst &&
- sk->sk_rx_dst_ifindex == skb->skb_iif)
- skb_dst_set_noref(skb, dst);
- }
- }
- return 0;
-}
-
bool tcp_add_backlog(struct sock *sk, struct sk_buff *skb,
enum skb_drop_reason *reason)
{
--
2.53.0.473.g4a7958ca14-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] tcp: move tcp_v4_early_demux() to net/ipv4/ip_input.c
2026-03-06 13:11 [PATCH net-next] tcp: move tcp_v4_early_demux() to net/ipv4/ip_input.c Eric Dumazet
@ 2026-03-06 16:16 ` David Ahern
2026-03-08 3:09 ` Kuniyuki Iwashima
2026-03-10 2:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2026-03-06 16:16 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, Neal Cardwell, Kuniyuki Iwashima, netdev,
eric.dumazet
On 3/6/26 6:11 AM, Eric Dumazet wrote:
> tcp_v4_early_demux() has a single caller : ip_rcv_finish_core().
>
> Move it to net/ipv4/ip_input.c and mark it static, for possible
> compiler/linker optimizations.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> include/net/tcp.h | 1 -
> net/ipv4/ip_input.c | 39 +++++++++++++++++++++++++++++++++++++++
> net/ipv4/tcp_ipv4.c | 38 --------------------------------------
> 3 files changed, 39 insertions(+), 39 deletions(-)
>
Reviewed-by: David Ahern <dsahern@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] tcp: move tcp_v4_early_demux() to net/ipv4/ip_input.c
2026-03-06 13:11 [PATCH net-next] tcp: move tcp_v4_early_demux() to net/ipv4/ip_input.c Eric Dumazet
2026-03-06 16:16 ` David Ahern
@ 2026-03-08 3:09 ` Kuniyuki Iwashima
2026-03-10 2:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Kuniyuki Iwashima @ 2026-03-08 3:09 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Simon Horman,
Neal Cardwell, David Ahern, netdev, eric.dumazet
On Fri, Mar 6, 2026 at 5:11 AM Eric Dumazet <edumazet@google.com> wrote:
>
> tcp_v4_early_demux() has a single caller : ip_rcv_finish_core().
>
> Move it to net/ipv4/ip_input.c and mark it static, for possible
> compiler/linker optimizations.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] tcp: move tcp_v4_early_demux() to net/ipv4/ip_input.c
2026-03-06 13:11 [PATCH net-next] tcp: move tcp_v4_early_demux() to net/ipv4/ip_input.c Eric Dumazet
2026-03-06 16:16 ` David Ahern
2026-03-08 3:09 ` Kuniyuki Iwashima
@ 2026-03-10 2:00 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-03-10 2:00 UTC (permalink / raw)
To: Eric Dumazet
Cc: davem, kuba, pabeni, horms, ncardwell, kuniyu, dsahern, netdev,
eric.dumazet
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Fri, 6 Mar 2026 13:11:30 +0000 you wrote:
> tcp_v4_early_demux() has a single caller : ip_rcv_finish_core().
>
> Move it to net/ipv4/ip_input.c and mark it static, for possible
> compiler/linker optimizations.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
>
> [...]
Here is the summary with links:
- [net-next] tcp: move tcp_v4_early_demux() to net/ipv4/ip_input.c
https://git.kernel.org/netdev/net-next/c/50636e5ff886
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-10 2:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-06 13:11 [PATCH net-next] tcp: move tcp_v4_early_demux() to net/ipv4/ip_input.c Eric Dumazet
2026-03-06 16:16 ` David Ahern
2026-03-08 3:09 ` Kuniyuki Iwashima
2026-03-10 2:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox