Skip to content

Commit

Permalink
net: gre: Implement LCO for GRE over IPv4
Browse files Browse the repository at this point in the history
Signed-off-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Edward Cree authored and David S. Miller committed Feb 12, 2016
1 parent 06f6229 commit 5393610
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,17 @@ static int gre_rcv(struct sk_buff *skb)
return 0;
}

static __sum16 gre_checksum(struct sk_buff *skb)
{
__wsum csum;

if (skb->ip_summed == CHECKSUM_PARTIAL)
csum = lco_csum(skb);
else
csum = skb_checksum(skb, 0, skb->len, 0);
return csum_fold(csum);
}

static void build_header(struct sk_buff *skb, int hdr_len, __be16 flags,
__be16 proto, __be32 key, __be32 seq)
{
Expand Down Expand Up @@ -467,8 +478,7 @@ static void build_header(struct sk_buff *skb, int hdr_len, __be16 flags,
!(skb_shinfo(skb)->gso_type &
(SKB_GSO_GRE | SKB_GSO_GRE_CSUM))) {
*ptr = 0;
*(__sum16 *)ptr = csum_fold(skb_checksum(skb, 0,
skb->len, 0));
*(__sum16 *)ptr = gre_checksum(skb);
}
}
}
Expand All @@ -493,7 +503,7 @@ static void __gre_xmit(struct sk_buff *skb, struct net_device *dev,
static struct sk_buff *gre_handle_offloads(struct sk_buff *skb,
bool csum)
{
return iptunnel_handle_offloads(skb, csum,
return iptunnel_handle_offloads(skb, false,
csum ? SKB_GSO_GRE_CSUM : SKB_GSO_GRE);
}

Expand Down

0 comments on commit 5393610

Please sign in to comment.