gre: Call gso_make_checksum
Call gso_make_checksum. This should have the benefit of using a checksum that may have been previously computed for the packet. This also adds NETIF_F_GSO_GRE_CSUM to differentiate devices that offload GRE GSO with and without the GRE checksum offloaed. Signed-off-by: Tom Herbert <therbert@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
0f4f4ffa7b
commit
4749c09c37
@@ -42,6 +42,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
|
||||
SKB_GSO_DODGY |
|
||||
SKB_GSO_TCP_ECN |
|
||||
SKB_GSO_GRE |
|
||||
SKB_GSO_GRE_CSUM |
|
||||
SKB_GSO_IPIP)))
|
||||
goto out;
|
||||
|
||||
@@ -55,6 +56,8 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
|
||||
goto out;
|
||||
|
||||
csum = !!(greh->flags & GRE_CSUM);
|
||||
if (csum)
|
||||
skb->encap_hdr_csum = 1;
|
||||
|
||||
if (unlikely(!pskb_may_pull(skb, ghl)))
|
||||
goto out;
|
||||
@@ -94,10 +97,13 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
|
||||
}
|
||||
}
|
||||
|
||||
greh = (struct gre_base_hdr *)(skb->data);
|
||||
skb_reset_transport_header(skb);
|
||||
|
||||
greh = (struct gre_base_hdr *)
|
||||
skb_transport_header(skb);
|
||||
pcsum = (__be32 *)(greh + 1);
|
||||
*pcsum = 0;
|
||||
*(__sum16 *)pcsum = csum_fold(skb_checksum(skb, 0, skb->len, 0));
|
||||
*(__sum16 *)pcsum = gso_make_checksum(skb, 0);
|
||||
}
|
||||
__skb_push(skb, tnl_hlen - ghl);
|
||||
|
||||
|
Reference in New Issue
Block a user