Update setup_udp_tunnel_sock() to handle ipv6 sockets.

Signed-off-by: Pravin B Shelar <pshe...@ovn.org>
---
 acinclude.m4                                   |  2 ++
 datapath/linux/compat/include/net/udp_tunnel.h | 15 ++++++++++++++-
 datapath/linux/compat/udp_tunnel.c             |  4 ++++
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/acinclude.m4 b/acinclude.m4
index a8ea2b7..573cdd6 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -566,6 +566,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
   OVS_GREP_IFELSE([$KSRC/include/net/udp.h], [udp_v4_check])
   OVS_GREP_IFELSE([$KSRC/include/net/udp.h], [udp_set_csum])
   OVS_GREP_IFELSE([$KSRC/include/net/udp_tunnel.h], [udp_tunnel_gro_complete])
+  OVS_FIND_FIELD_IFELSE([$KSRC/include/net/udp_tunnel.h], 
[udp_tunnel_sock_cfg],
+                        [gro_receive])
 
   OVS_GREP_IFELSE([$KSRC/include/linux/skbuff.h], [ignore_df],
                   [OVS_DEFINE([HAVE_IGNORE_DF_RENAME])])
diff --git a/datapath/linux/compat/include/net/udp_tunnel.h 
b/datapath/linux/compat/include/net/udp_tunnel.h
index 0f38c26..3f02c79 100644
--- a/datapath/linux/compat/include/net/udp_tunnel.h
+++ b/datapath/linux/compat/include/net/udp_tunnel.h
@@ -99,7 +99,20 @@ int rpl_udp_tunnel_xmit_skb(struct rtable *rt,
 #define udp_tunnel_sock_release rpl_udp_tunnel_sock_release
 void rpl_udp_tunnel_sock_release(struct socket *sock);
 
-#define udp_tunnel_encap_enable(sock) udp_encap_enable()
+#define udp_tunnel_encap_enable rpl_udp_tunnel_encap_enable
+static inline void udp_tunnel_encap_enable(struct socket *sock)
+{
+#if IS_ENABLED(CONFIG_IPV6)
+       if (sock->sk->sk_family == PF_INET6)
+#ifdef HAVE_IPV6_STUB
+               ipv6_stub->udpv6_encap_enable();
+#else
+               udpv6_encap_enable();
+#endif
+       else
+#endif
+               udp_encap_enable();
+}
 
 #if IS_ENABLED(CONFIG_IPV6)
 #define udp_tunnel6_xmit_skb rpl_udp_tunnel6_xmit_skb
diff --git a/datapath/linux/compat/udp_tunnel.c 
b/datapath/linux/compat/udp_tunnel.c
index 4e2c64d..d5dbad1 100644
--- a/datapath/linux/compat/udp_tunnel.c
+++ b/datapath/linux/compat/udp_tunnel.c
@@ -132,6 +132,10 @@ void rpl_setup_udp_tunnel_sock(struct net *net, struct 
socket *sock,
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)
        udp_sk(sk)->encap_destroy = cfg->encap_destroy;
 #endif
+#ifdef HAVE_UDP_TUNNEL_SOCK_CFG_GRO_RECEIVE
+       udp_sk(sk)->gro_receive = cfg->gro_receive;
+       udp_sk(sk)->gro_complete = cfg->gro_complete;
+#endif
 
        udp_tunnel_encap_enable(sock);
 }
-- 
2.5.5

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to