]> Pileus Git - ~andy/linux/blobdiff - drivers/net/vxlan.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[~andy/linux] / drivers / net / vxlan.c
index 7cee7a3068ec11ae9a7f91efa612748dfdd0463e..db0df07c18dcdbad79f066df3dd50c9c6f5feb23 100644 (file)
@@ -820,6 +820,20 @@ static u16 vxlan_src_port(const struct vxlan_dev *vxlan, struct sk_buff *skb)
        return (((u64) hash * range) >> 32) + vxlan->port_min;
 }
 
+static int handle_offloads(struct sk_buff *skb)
+{
+       if (skb_is_gso(skb)) {
+               int err = skb_unclone(skb, GFP_ATOMIC);
+               if (unlikely(err))
+                       return err;
+
+               skb_shinfo(skb)->gso_type |= (SKB_GSO_UDP_TUNNEL | SKB_GSO_UDP);
+       } else if (skb->ip_summed != CHECKSUM_PARTIAL)
+               skb->ip_summed = CHECKSUM_NONE;
+
+       return 0;
+}
+
 /* Transmit local packets over Vxlan
  *
  * Outer IP header inherits ECN and DF from inner header.
@@ -841,7 +855,6 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
        __u16 src_port;
        __be16 df = 0;
        __u8 tos, ttl;
-       int err;
        bool did_rsc = false;
        const struct vxlan_fdb *f;
 
@@ -965,22 +978,10 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 
        vxlan_set_owner(dev, skb);
 
-       /* See iptunnel_xmit() */
-       if (skb->ip_summed != CHECKSUM_PARTIAL)
-               skb->ip_summed = CHECKSUM_NONE;
-
-       err = ip_local_out(skb);
-       if (likely(net_xmit_eval(err) == 0)) {
-               struct vxlan_stats *stats = this_cpu_ptr(vxlan->stats);
+       if (handle_offloads(skb))
+               goto drop;
 
-               u64_stats_update_begin(&stats->syncp);
-               stats->tx_packets++;
-               stats->tx_bytes += pkt_len;
-               u64_stats_update_end(&stats->syncp);
-       } else {
-               dev->stats.tx_errors++;
-               dev->stats.tx_aborted_errors++;
-       }
+       iptunnel_xmit(skb, dev);
        return NETDEV_TX_OK;
 
 drop:
@@ -1189,8 +1190,10 @@ static void vxlan_setup(struct net_device *dev)
        dev->features   |= NETIF_F_NETNS_LOCAL;
        dev->features   |= NETIF_F_SG | NETIF_F_HW_CSUM;
        dev->features   |= NETIF_F_RXCSUM;
+       dev->features   |= NETIF_F_GSO_SOFTWARE;
 
        dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
+       dev->hw_features |= NETIF_F_GSO_SOFTWARE;
        dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
        dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;