Commit 206aaafc authored by Pravin B Shelar's avatar Pravin B Shelar Committed by David S. Miller

VXLAN: Use IP Tunnels tunnel ENC encap API

Use common ecn_encap functions from ip_tunnel module.
Signed-off-by: default avatarPravin B Shelar <pshelar@nicira.com>
Acked-by: default avatarStephen Hemminger <stephen@networkplumber.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e8171045
...@@ -864,28 +864,6 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb) ...@@ -864,28 +864,6 @@ static bool route_shortcircuit(struct net_device *dev, struct sk_buff *skb)
return false; return false;
} }
/* Extract dsfield from inner protocol */
static inline u8 vxlan_get_dsfield(const struct iphdr *iph,
const struct sk_buff *skb)
{
if (skb->protocol == htons(ETH_P_IP))
return iph->tos;
else if (skb->protocol == htons(ETH_P_IPV6))
return ipv6_get_dsfield((const struct ipv6hdr *)iph);
else
return 0;
}
/* Propogate ECN bits out */
static inline u8 vxlan_ecn_encap(u8 tos,
const struct iphdr *iph,
const struct sk_buff *skb)
{
u8 inner = vxlan_get_dsfield(iph, skb);
return INET_ECN_encapsulate(tos, inner);
}
static void vxlan_sock_free(struct sk_buff *skb) static void vxlan_sock_free(struct sk_buff *skb)
{ {
sock_put(skb->sk); sock_put(skb->sk);
...@@ -996,7 +974,7 @@ static netdev_tx_t vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, ...@@ -996,7 +974,7 @@ static netdev_tx_t vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
tos = vxlan->tos; tos = vxlan->tos;
if (tos == 1) if (tos == 1)
tos = vxlan_get_dsfield(old_iph, skb); tos = ip_tunnel_get_dsfield(old_iph, skb);
src_port = vxlan_src_port(vxlan, skb); src_port = vxlan_src_port(vxlan, skb);
...@@ -1047,7 +1025,7 @@ static netdev_tx_t vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev, ...@@ -1047,7 +1025,7 @@ static netdev_tx_t vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
iph->ihl = sizeof(struct iphdr) >> 2; iph->ihl = sizeof(struct iphdr) >> 2;
iph->frag_off = df; iph->frag_off = df;
iph->protocol = IPPROTO_UDP; iph->protocol = IPPROTO_UDP;
iph->tos = vxlan_ecn_encap(tos, old_iph, skb); iph->tos = ip_tunnel_ecn_encap(tos, old_iph, skb);
iph->daddr = dst; iph->daddr = dst;
iph->saddr = fl4.saddr; iph->saddr = fl4.saddr;
iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst); iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment