aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vxlan.c
diff options
context:
space:
mode:
authorPravin B Shelar <pshelar@nicira.com>2013-08-19 14:23:29 -0400
committerDavid S. Miller <davem@davemloft.net>2013-08-20 03:15:44 -0400
commit1eaa81785a70082213d40de14ec13520b5c6fff2 (patch)
treed4f9ad4fe59dcbca3cb874632aa354e3b266dae3 /drivers/net/vxlan.c
parent649c5b8bdd8d5c8c9c50882e3a789030fb99b75c (diff)
vxlan: Add tx-vlan offload support.
Following patch allows transmit side vlan offload for vxlan devices. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxlan.c')
-rw-r--r--drivers/net/vxlan.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 73e255788fae..b9401b53b699 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -27,6 +27,7 @@
27#include <linux/igmp.h> 27#include <linux/igmp.h>
28#include <linux/etherdevice.h> 28#include <linux/etherdevice.h>
29#include <linux/if_ether.h> 29#include <linux/if_ether.h>
30#include <linux/if_vlan.h>
30#include <linux/hash.h> 31#include <linux/hash.h>
31#include <linux/ethtool.h> 32#include <linux/ethtool.h>
32#include <net/arp.h> 33#include <net/arp.h>
@@ -1139,13 +1140,23 @@ int vxlan_xmit_skb(struct net *net, struct vxlan_sock *vs,
1139 } 1140 }
1140 1141
1141 min_headroom = LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len 1142 min_headroom = LL_RESERVED_SPACE(rt->dst.dev) + rt->dst.header_len
1142 + VXLAN_HLEN + sizeof(struct iphdr); 1143 + VXLAN_HLEN + sizeof(struct iphdr)
1144 + (vlan_tx_tag_present(skb) ? VLAN_HLEN : 0);
1143 1145
1144 /* Need space for new headers (invalidates iph ptr) */ 1146 /* Need space for new headers (invalidates iph ptr) */
1145 err = skb_cow_head(skb, min_headroom); 1147 err = skb_cow_head(skb, min_headroom);
1146 if (unlikely(err)) 1148 if (unlikely(err))
1147 return err; 1149 return err;
1148 1150
1151 if (vlan_tx_tag_present(skb)) {
1152 if (WARN_ON(!__vlan_put_tag(skb,
1153 skb->vlan_proto,
1154 vlan_tx_tag_get(skb))))
1155 return -ENOMEM;
1156
1157 skb->vlan_tci = 0;
1158 }
1159
1149 vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh)); 1160 vxh = (struct vxlanhdr *) __skb_push(skb, sizeof(*vxh));
1150 vxh->vx_flags = htonl(VXLAN_FLAGS); 1161 vxh->vx_flags = htonl(VXLAN_FLAGS);
1151 vxh->vx_vni = vni; 1162 vxh->vx_vni = vni;
@@ -1560,8 +1571,11 @@ static void vxlan_setup(struct net_device *dev)
1560 dev->features |= NETIF_F_RXCSUM; 1571 dev->features |= NETIF_F_RXCSUM;
1561 dev->features |= NETIF_F_GSO_SOFTWARE; 1572 dev->features |= NETIF_F_GSO_SOFTWARE;
1562 1573
1574 dev->vlan_features = dev->features;
1575 dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
1563 dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM; 1576 dev->hw_features |= NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
1564 dev->hw_features |= NETIF_F_GSO_SOFTWARE; 1577 dev->hw_features |= NETIF_F_GSO_SOFTWARE;
1578 dev->hw_features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
1565 dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; 1579 dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
1566 dev->priv_flags |= IFF_LIVE_ADDR_CHANGE; 1580 dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
1567 1581