aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vxlan.c
diff options
context:
space:
mode:
authorPravin B Shelar <pshelar@nicira.com>2013-03-25 10:49:53 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-26 12:27:18 -0400
commit206aaafcd279e2cb836d772282517540c6cb3814 (patch)
tree4be36d721575eaab1b5500ff955f9408753135e1 /drivers/net/vxlan.c
parente817104525577413301b3cb709a6472e0cf44a6a (diff)
VXLAN: Use IP Tunnels tunnel ENC encap API
Use common ecn_encap functions from ip_tunnel module. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxlan.c')
-rw-r--r--drivers/net/vxlan.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index e532b2ab5b0f..7624ab1f7b03 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -864,28 +864,6 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
864 return false; 864 return false;
865} 865}
866 866
867/* Extract dsfield from inner protocol */
868static inline u8 vxlan_get_dsfield(const struct iphdr *iph,
869 const struct sk_buff *skb)
870{
871 if (skb->protocol == htons(ETH_P_IP))
872 return iph->tos;
873 else if (skb->protocol == htons(ETH_P_IPV6))
874 return ipv6_get_dsfield((const struct ipv6hdr *)iph);
875 else
876 return 0;
877}
878
879/* Propogate ECN bits out */
880static inline u8 vxlan_ecn_encap(u8 tos,
881 const struct iphdr *iph,
882 const struct sk_buff *skb)
883{
884 u8 inner = vxlan_get_dsfield(iph, skb);
885
886 return INET_ECN_encapsulate(tos, inner);
887}
888
889static void vxlan_sock_free(struct sk_buff *skb) 867static void vxlan_sock_free(struct sk_buff *skb)
890{ 868{
891 sock_put(skb->sk); 869 sock_put(skb->sk);
@@ -996,7 +974,7 @@ static netdev_tx_t vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
996 974
997 tos = vxlan->tos; 975 tos = vxlan->tos;
998 if (tos == 1) 976 if (tos == 1)
999 tos = vxlan_get_dsfield(old_iph, skb); 977 tos = ip_tunnel_get_dsfield(old_iph, skb);
1000 978
1001 src_port = vxlan_src_port(vxlan, skb); 979 src_port = vxlan_src_port(vxlan, skb);
1002 980
@@ -1047,7 +1025,7 @@ static netdev_tx_t vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
1047 iph->ihl = sizeof(struct iphdr) >> 2; 1025 iph->ihl = sizeof(struct iphdr) >> 2;
1048 iph->frag_off = df; 1026 iph->frag_off = df;
1049 iph->protocol = IPPROTO_UDP; 1027 iph->protocol = IPPROTO_UDP;
1050 iph->tos = vxlan_ecn_encap(tos, old_iph, skb); 1028 iph->tos = ip_tunnel_ecn_encap(tos, old_iph, skb);
1051 iph->daddr = dst; 1029 iph->daddr = dst;
1052 iph->saddr = fl4.saddr; 1030 iph->saddr = fl4.saddr;
1053 iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); 1031 iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst);