Skip to content

Commit

Permalink
gre: Add support for checksum unnecessary conversions
Browse files Browse the repository at this point in the history
Call skb_checksum_try_convert and skb_gro_checksum_try_convert
after checksum is found present and validated in the GRE header
for normal and GRO paths respectively.

In GRO path, call skb_gro_checksum_try_convert

Signed-off-by: Tom Herbert <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Tom Herbert authored and davem330 committed Sep 2, 2014
1 parent 2abb7cd commit 884d338
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions net/ipv4/gre_demux.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ static int parse_gre_header(struct sk_buff *skb, struct tnl_ptk_info *tpi,
*csum_err = true;
return -EINVAL;
}

skb_checksum_try_convert(skb, IPPROTO_GRE, 0,
null_compute_pseudo);

options++;
}

Expand Down
8 changes: 6 additions & 2 deletions net/ipv4/gre_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,14 @@ static struct sk_buff **gre_gro_receive(struct sk_buff **head,
}

/* Don't bother verifying checksum if we're going to flush anyway. */
if ((greh->flags & GRE_CSUM) && !NAPI_GRO_CB(skb)->flush &&
skb_gro_checksum_simple_validate(skb))
if ((greh->flags & GRE_CSUM) && !NAPI_GRO_CB(skb)->flush) {
if (skb_gro_checksum_simple_validate(skb))
goto out_unlock;

skb_gro_checksum_try_convert(skb, IPPROTO_GRE, 0,
null_compute_pseudo);
}

flush = 0;

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

0 comments on commit 884d338

Please sign in to comment.