From: Pravin Shelar <[email protected]>

Signed-off-by: Pravin B Shelar <[email protected]>
---
 drivers/net/vxlan.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 1977da5..8effb54 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -779,6 +779,21 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct 
net_device *dev)
        bool did_rsc = false;
        const struct vxlan_fdb *f;
 
+       if (skb->ip_summed == CHECKSUM_PARTIAL) {
+               /* Pages aren't locked and could change at any time.
+                * If this happens after we compute the checksum, the
+                * checksum will be wrong.  We linearize now to avoid
+                * this problem.
+                */
+               err = __skb_linearize(skb);
+               if (unlikely(err))
+                       goto drop;
+
+               err = skb_checksum_help(skb);
+               if (unlikely(err))
+                       goto drop;
+       }
+
        skb_reset_mac_header(skb);
        eth = eth_hdr(skb);
 
@@ -1047,6 +1062,11 @@ static void vxlan_free(struct net_device *dev)
        free_netdev(dev);
 }
 
+#define VXLAN_FEATURES (NETIF_F_SG |           \
+                     NETIF_F_FRAGLIST |        \
+                     NETIF_F_HIGHDMA |         \
+                     NETIF_F_HW_CSUM)
+
 /* Initialize the device structure. */
 static void vxlan_setup(struct net_device *dev)
 {
@@ -1066,6 +1086,8 @@ static void vxlan_setup(struct net_device *dev)
        dev->features   |= NETIF_F_LLTX;
        dev->features   |= NETIF_F_NETNS_LOCAL;
        dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
+       dev->features           |= VXLAN_FEATURES;
+       dev->hw_features        |= VXLAN_FEATURES;
 
        spin_lock_init(&vxlan->hash_lock);
 
-- 
1.7.1

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to