tcp: gro: inline tcp_gro_pull_header()

tcp_gro_pull_header() is used in GRO fast path, inline it.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20251113140358.58242-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Eric Dumazet 2025-11-13 14:03:57 +00:00 committed by Jakub Kicinski
parent eca8b8fc74
commit 6d650ae928
3 changed files with 27 additions and 28 deletions

View File

@ -593,4 +593,31 @@ static inline void inet6_get_iif_sdif(const struct sk_buff *skb, int *iif, int *
struct packet_offload *gro_find_receive_by_type(__be16 type);
struct packet_offload *gro_find_complete_by_type(__be16 type);
static inline struct tcphdr *tcp_gro_pull_header(struct sk_buff *skb)
{
unsigned int thlen, hlen, off;
struct tcphdr *th;
off = skb_gro_offset(skb);
hlen = off + sizeof(*th);
th = skb_gro_header(skb, hlen, off);
if (unlikely(!th))
return NULL;
thlen = th->doff * 4;
if (unlikely(thlen < sizeof(*th)))
return NULL;
hlen = off + thlen;
if (!skb_gro_may_pull(skb, hlen)) {
th = skb_gro_header_slow(skb, hlen, off);
if (unlikely(!th))
return NULL;
}
skb_gro_pull(skb, thlen);
return th;
}
#endif /* _NET_GRO_H */

View File

@ -2313,7 +2313,6 @@ void tcp_v4_destroy_sock(struct sock *sk);
struct sk_buff *tcp_gso_segment(struct sk_buff *skb,
netdev_features_t features);
struct tcphdr *tcp_gro_pull_header(struct sk_buff *skb);
struct sk_buff *tcp_gro_lookup(struct list_head *head, struct tcphdr *th);
struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb,
struct tcphdr *th);

View File

@ -282,33 +282,6 @@ struct sk_buff *tcp_gro_lookup(struct list_head *head, struct tcphdr *th)
return NULL;
}
struct tcphdr *tcp_gro_pull_header(struct sk_buff *skb)
{
unsigned int thlen, hlen, off;
struct tcphdr *th;
off = skb_gro_offset(skb);
hlen = off + sizeof(*th);
th = skb_gro_header(skb, hlen, off);
if (unlikely(!th))
return NULL;
thlen = th->doff * 4;
if (thlen < sizeof(*th))
return NULL;
hlen = off + thlen;
if (!skb_gro_may_pull(skb, hlen)) {
th = skb_gro_header_slow(skb, hlen, off);
if (unlikely(!th))
return NULL;
}
skb_gro_pull(skb, thlen);
return th;
}
struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb,
struct tcphdr *th)
{