diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2009-05-26 22:50:28 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-27 14:26:01 +0400 |
commit | a5b1cf288d4200506ab62fbb86cc81ace948a306 (patch) | |
tree | c95339866f4d67220d111811a92e5c6b79de6ab4 /net/ipv4/af_inet.c | |
parent | 7489594cb249aeb178287c9a43a9e4f366044259 (diff) | |
download | linux-a5b1cf288d4200506ab62fbb86cc81ace948a306.tar.xz |
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>
Diffstat (limited to 'net/ipv4/af_inet.c')
-rw-r--r-- | net/ipv4/af_inet.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 170689681aa2..644cc5535319 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1246,13 +1246,20 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head, struct sk_buff **pp = NULL; struct sk_buff *p; struct iphdr *iph; + unsigned int hlen; + unsigned int off; int flush = 1; int proto; int id; - 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; + } proto = iph->protocol & (MAX_INET_PROTOS - 1); |