From a7afa4308ce6b2c15b40bc0ed89615db4fea790c Mon Sep 17 00:00:00 2001 From: Joseph Gasparakis Date: Fri, 7 Dec 2012 14:14:18 +0000 Subject: [PATCH] --- yaml --- r: 342051 b: refs/heads/master c: 0afb1666fe4ed8e51083af544f00d31bc8753352 h: refs/heads/master i: 342049: aecdab787a84e4db4f7ef5c0fbef7f09e8c63562 342047: 644a3c9beacda690858889fb5146c524687b3836 v: v3 --- [refs] | 2 +- trunk/drivers/net/vxlan.c | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 06d240eb4009..ca3a9430ff68 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d6727fe3850de741b9a64e4a7069b536e380e2c6 +refs/heads/master: 0afb1666fe4ed8e51083af544f00d31bc8753352 diff --git a/trunk/drivers/net/vxlan.c b/trunk/drivers/net/vxlan.c index 88b31f2453dd..3b3fdf648ea7 100644 --- a/trunk/drivers/net/vxlan.c +++ b/trunk/drivers/net/vxlan.c @@ -607,7 +607,17 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb) __skb_tunnel_rx(skb, vxlan->dev); skb_reset_network_header(skb); - skb->ip_summed = CHECKSUM_NONE; + + /* If the NIC driver gave us an encapsulated packet with + * CHECKSUM_UNNECESSARY and Rx checksum feature is enabled, + * leave the CHECKSUM_UNNECESSARY, the device checksummed it + * for us. Otherwise force the upper layers to verify it. + */ + if (skb->ip_summed != CHECKSUM_UNNECESSARY || !skb->encapsulation || + !(vxlan->dev->features & NETIF_F_RXCSUM)) + skb->ip_summed = CHECKSUM_NONE; + + skb->encapsulation = 0; err = IP_ECN_decapsulate(oip, skb); if (unlikely(err)) { @@ -1175,7 +1185,9 @@ static void vxlan_setup(struct net_device *dev) dev->features |= NETIF_F_LLTX; dev->features |= NETIF_F_NETNS_LOCAL; dev->features |= NETIF_F_SG | NETIF_F_HW_CSUM; - dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM; + dev->features |= NETIF_F_RXCSUM; + + dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM; dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; spin_lock_init(&vxlan->hash_lock);