Commit 1075f3f6 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

ipv4: Use 32-bit loads for ID and length in GRO

This patch optimises the IPv4 GRO code by using 32-bit loads
(instead of 16-bit ones) on the ID and length checks in the receive
function.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a5b1cf28
...@@ -1248,9 +1248,9 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head, ...@@ -1248,9 +1248,9 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head,
struct iphdr *iph; struct iphdr *iph;
unsigned int hlen; unsigned int hlen;
unsigned int off; unsigned int off;
unsigned int id;
int flush = 1; int flush = 1;
int proto; int proto;
int id;
off = skb_gro_offset(skb); off = skb_gro_offset(skb);
hlen = off + sizeof(*iph); hlen = off + sizeof(*iph);
...@@ -1274,9 +1274,9 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head, ...@@ -1274,9 +1274,9 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head,
if (unlikely(ip_fast_csum((u8 *)iph, iph->ihl))) if (unlikely(ip_fast_csum((u8 *)iph, iph->ihl)))
goto out_unlock; goto out_unlock;
flush = ntohs(iph->tot_len) != skb_gro_len(skb) || id = ntohl(*(u32 *)&iph->id);
iph->frag_off != htons(IP_DF); flush = (u16)((ntohl(*(u32 *)iph) ^ skb_gro_len(skb)) | (id ^ IP_DF));
id = ntohs(iph->id); id >>= 16;
for (p = *head; p; p = p->next) { for (p = *head; p; p = p->next) {
struct iphdr *iph2; struct iphdr *iph2;
......
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