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

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 8faaeb8..983a239 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -638,6 +638,21 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct 
net_device *dev)
        __u8 tos, ttl;
        int err;
 
+       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;
+       }
+
        dst = vxlan_find_dst(vxlan, skb);
        if (!dst)
                goto drop;
@@ -869,6 +884,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)
 {
@@ -888,6 +908,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.10

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

Reply via email to