Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Pravin B Shelar and committed by
David S. Miller
206aaafc e8171045

+2 -24
+2 -24
drivers/net/vxlan.c
··· 864 864 return false; 865 865 } 866 866 867 - /* Extract dsfield from inner protocol */ 868 - static 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 */ 880 - static 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 - 889 867 static void vxlan_sock_free(struct sk_buff *skb) 890 868 { 891 869 sock_put(skb->sk); ··· 974 996 975 997 tos = vxlan->tos; 976 998 if (tos == 1) 977 - tos = vxlan_get_dsfield(old_iph, skb); 999 + tos = ip_tunnel_get_dsfield(old_iph, skb); 978 1000 979 1001 src_port = vxlan_src_port(vxlan, skb); 980 1002 ··· 1025 1047 iph->ihl = sizeof(struct iphdr) >> 2; 1026 1048 iph->frag_off = df; 1027 1049 iph->protocol = IPPROTO_UDP; 1028 - iph->tos = vxlan_ecn_encap(tos, old_iph, skb); 1050 + iph->tos = ip_tunnel_ecn_encap(tos, old_iph, skb); 1029 1051 iph->daddr = dst; 1030 1052 iph->saddr = fl4.saddr; 1031 1053 iph->ttl = ttl ? : ip4_dst_hoplimit(&rt->dst);