Commit bd56a29c authored by Eric Dumazet's avatar Eric Dumazet Committed by Paolo Abeni

net: gro: change skb_gro_network_header()

Change skb_gro_network_header() to accept a const sk_buff
and to no longer check if frag0 is NULL or not.

This allows to remove skb_gro_frag0_invalidate()
which is seen in profiles when header-split is enabled.

sk_buff parameter is constified for skb_gro_header_fast(),
inet_gro_compute_pseudo() and ip6_gro_compute_pseudo().
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 93e16ea0
......@@ -139,7 +139,7 @@ static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len)
NAPI_GRO_CB(skb)->data_offset += len;
}
static inline void *skb_gro_header_fast(struct sk_buff *skb,
static inline void *skb_gro_header_fast(const struct sk_buff *skb,
unsigned int offset)
{
return NAPI_GRO_CB(skb)->frag0 + offset;
......@@ -151,24 +151,17 @@ static inline bool skb_gro_may_pull(const struct sk_buff *skb,
return hlen <= NAPI_GRO_CB(skb)->frag0_len;
}
static inline void skb_gro_frag0_invalidate(struct sk_buff *skb)
{
NAPI_GRO_CB(skb)->frag0 = NULL;
NAPI_GRO_CB(skb)->frag0_len = 0;
}
static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen,
unsigned int offset)
{
if (!pskb_may_pull(skb, hlen))
return NULL;
skb_gro_frag0_invalidate(skb);
return skb->data + offset;
}
static inline void *skb_gro_header(struct sk_buff *skb,
unsigned int hlen, unsigned int offset)
static inline void *skb_gro_header(struct sk_buff *skb, unsigned int hlen,
unsigned int offset)
{
void *ptr;
......@@ -178,13 +171,16 @@ static inline void *skb_gro_header(struct sk_buff *skb,
return ptr;
}
static inline void *skb_gro_network_header(struct sk_buff *skb)
static inline void *skb_gro_network_header(const struct sk_buff *skb)
{
return (NAPI_GRO_CB(skb)->frag0 ?: skb->data) +
skb_network_offset(skb);
if (skb_gro_may_pull(skb, skb_gro_offset(skb)))
return skb_gro_header_fast(skb, skb_network_offset(skb));
return skb_network_header(skb);
}
static inline __wsum inet_gro_compute_pseudo(struct sk_buff *skb, int proto)
static inline __wsum inet_gro_compute_pseudo(const struct sk_buff *skb,
int proto)
{
const struct iphdr *iph = skb_gro_network_header(skb);
......@@ -422,7 +418,8 @@ static inline struct udphdr *udp_gro_udphdr(struct sk_buff *skb)
return uh;
}
static inline __wsum ip6_gro_compute_pseudo(struct sk_buff *skb, int proto)
static inline __wsum ip6_gro_compute_pseudo(const struct sk_buff *skb,
int proto)
{
const struct ipv6hdr *iph = skb_gro_network_header(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment