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

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>

authored by

Eric Dumazet and committed by
Jakub Kicinski
6d650ae9 eca8b8fc

+27 -28
+27
include/net/gro.h
··· 593 593 struct packet_offload *gro_find_receive_by_type(__be16 type); 594 594 struct packet_offload *gro_find_complete_by_type(__be16 type); 595 595 596 + static inline struct tcphdr *tcp_gro_pull_header(struct sk_buff *skb) 597 + { 598 + unsigned int thlen, hlen, off; 599 + struct tcphdr *th; 600 + 601 + off = skb_gro_offset(skb); 602 + hlen = off + sizeof(*th); 603 + th = skb_gro_header(skb, hlen, off); 604 + if (unlikely(!th)) 605 + return NULL; 606 + 607 + thlen = th->doff * 4; 608 + if (unlikely(thlen < sizeof(*th))) 609 + return NULL; 610 + 611 + hlen = off + thlen; 612 + if (!skb_gro_may_pull(skb, hlen)) { 613 + th = skb_gro_header_slow(skb, hlen, off); 614 + if (unlikely(!th)) 615 + return NULL; 616 + } 617 + 618 + skb_gro_pull(skb, thlen); 619 + 620 + return th; 621 + } 622 + 596 623 #endif /* _NET_GRO_H */
-1
include/net/tcp.h
··· 2313 2313 2314 2314 struct sk_buff *tcp_gso_segment(struct sk_buff *skb, 2315 2315 netdev_features_t features); 2316 - struct tcphdr *tcp_gro_pull_header(struct sk_buff *skb); 2317 2316 struct sk_buff *tcp_gro_lookup(struct list_head *head, struct tcphdr *th); 2318 2317 struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb, 2319 2318 struct tcphdr *th);
-27
net/ipv4/tcp_offload.c
··· 282 282 return NULL; 283 283 } 284 284 285 - struct tcphdr *tcp_gro_pull_header(struct sk_buff *skb) 286 - { 287 - unsigned int thlen, hlen, off; 288 - struct tcphdr *th; 289 - 290 - off = skb_gro_offset(skb); 291 - hlen = off + sizeof(*th); 292 - th = skb_gro_header(skb, hlen, off); 293 - if (unlikely(!th)) 294 - return NULL; 295 - 296 - thlen = th->doff * 4; 297 - if (thlen < sizeof(*th)) 298 - return NULL; 299 - 300 - hlen = off + thlen; 301 - if (!skb_gro_may_pull(skb, hlen)) { 302 - th = skb_gro_header_slow(skb, hlen, off); 303 - if (unlikely(!th)) 304 - return NULL; 305 - } 306 - 307 - skb_gro_pull(skb, thlen); 308 - 309 - return th; 310 - } 311 - 312 285 struct sk_buff *tcp_gro_receive(struct list_head *head, struct sk_buff *skb, 313 286 struct tcphdr *th) 314 287 {