gro: Avoid unnecessary comparison after skb_gro_header
For the overwhelming majority of cases, skb_gro_header's return value cannot be NULL. Yet we must check it because of its current form. This patch splits it up into multiple functions in order to avoid this. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
7489594cb2
commit
a5b1cf288d
@@ -817,13 +817,20 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,
|
||||
struct sk_buff *p;
|
||||
struct ipv6hdr *iph;
|
||||
unsigned int nlen;
|
||||
unsigned int hlen;
|
||||
unsigned int off;
|
||||
int flush = 1;
|
||||
int proto;
|
||||
__wsum csum;
|
||||
|
||||
iph = skb_gro_header(skb, sizeof(*iph));
|
||||
if (unlikely(!iph))
|
||||
goto out;
|
||||
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;
|
||||
}
|
||||
|
||||
skb_gro_pull(skb, sizeof(*iph));
|
||||
skb_set_transport_header(skb, skb_gro_offset(skb));
|
||||
|
Reference in New Issue
Block a user