Skip to content

Commit

Permalink
ipv4: Use 32-bit loads for ID and length in GRO
Browse files Browse the repository at this point in the history
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: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Herbert Xu authored and David S. Miller committed May 27, 2009
1 parent a5b1cf2 commit 1075f3f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/ipv4/af_inet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1248,9 +1248,9 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head,
struct iphdr *iph;
unsigned int hlen;
unsigned int off;
unsigned int id;
int flush = 1;
int proto;
int id;

off = skb_gro_offset(skb);
hlen = off + sizeof(*iph);
Expand All @@ -1274,9 +1274,9 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head,
if (unlikely(ip_fast_csum((u8 *)iph, iph->ihl)))
goto out_unlock;

flush = ntohs(iph->tot_len) != skb_gro_len(skb) ||
iph->frag_off != htons(IP_DF);
id = ntohs(iph->id);
id = ntohl(*(u32 *)&iph->id);
flush = (u16)((ntohl(*(u32 *)iph) ^ skb_gro_len(skb)) | (id ^ IP_DF));
id >>= 16;

for (p = *head; p; p = p->next) {
struct iphdr *iph2;
Expand Down

0 comments on commit 1075f3f

Please sign in to comment.