diff options
author | Richard Gobert <richardbgobert@gmail.com> | 2022-08-23 09:10:49 +0200 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2022-08-25 10:33:21 +0200 |
commit | 35ffb66547295c72650978f9c28e670e014d0957 (patch) | |
tree | 3574eb3f37289369144d96eaf0efb2eae226e989 /net/ipv6 | |
parent | 77a70f9c5b8678218a51cf2ae39a52cb4b6bc16c (diff) | |
download | linux-35ffb66547295c72650978f9c28e670e014d0957.tar.gz linux-35ffb66547295c72650978f9c28e670e014d0957.tar.bz2 linux-35ffb66547295c72650978f9c28e670e014d0957.zip |
net: gro: skb_gro_header helper function
Introduce a simple helper function to replace a common pattern.
When accessing the GRO header, we fetch the pointer from frag0,
then test its validity and fetch it from the skb when necessary.
This leads to the pattern
skb_gro_header_fast -> skb_gro_header_hard -> skb_gro_header_slow
recurring many times throughout GRO code.
This patch replaces these patterns with a single inlined function
call, improving code readability.
Signed-off-by: Richard Gobert <richardbgobert@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://lore.kernel.org/r/20220823071034.GA56142@debian
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/ip6_offload.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index d12dba2dd535..d37a8c97e6de 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c @@ -219,12 +219,9 @@ INDIRECT_CALLABLE_SCOPE struct sk_buff *ipv6_gro_receive(struct list_head *head, off = skb_gro_offset(skb); hlen = off + sizeof(*iph); - iph = skb_gro_header_fast(skb, off); - if (skb_gro_header_hard(skb, hlen)) { - iph = skb_gro_header_slow(skb, hlen, off); - if (unlikely(!iph)) - goto out; - } + iph = skb_gro_header_slow(skb, hlen, off); + if (unlikely(!iph)) + goto out; skb_set_network_header(skb, off); skb_gro_pull(skb, sizeof(*iph)); |