When Geneve was originally backported, it wasn't available as part
of a released kernel version but it is now, so we can take advantage
of the native implementation.

Note that Geneve was actually first available as part of the 3.18
kernel release but some drivers erroreously try to offload it as
if it were VXLAN, which was fixed in the 4.0 release. Since our
UDP tunnel compat layer already takes care of this, we continue
using the OVS Geneve implementation until 4.0.

Reported-by: Alex Wang <al...@nicira.com>
Signed-off-by: Jesse Gross <je...@nicira.com>
---
 datapath/linux/compat/geneve.c             | 5 +++++
 datapath/linux/compat/include/net/geneve.h | 8 ++++++++
 2 files changed, 13 insertions(+)

diff --git a/datapath/linux/compat/geneve.c b/datapath/linux/compat/geneve.c
index 48a306e..ff96087 100644
--- a/datapath/linux/compat/geneve.c
+++ b/datapath/linux/compat/geneve.c
@@ -11,6 +11,9 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,0,0)
+
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/module.h>
@@ -242,3 +245,5 @@ void geneve_sock_release(struct geneve_sock *gs)
        call_rcu(&gs->rcu, rcu_free_gs);
 }
 EXPORT_SYMBOL_GPL(geneve_sock_release);
+
+#endif /* kernel < 4.0 */
diff --git a/datapath/linux/compat/include/net/geneve.h 
b/datapath/linux/compat/include/net/geneve.h
index 402ef38..824b6bb 100644
--- a/datapath/linux/compat/include/net/geneve.h
+++ b/datapath/linux/compat/include/net/geneve.h
@@ -1,6 +1,12 @@
 #ifndef __NET_GENEVE_WRAPPER_H
 #define __NET_GENEVE_WRAPPER_H  1
 
+#include <linux/version.h>
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
+#include_next <net/geneve.h>
+#else
+
 #ifdef CONFIG_INET
 #include <net/udp_tunnel.h>
 #endif
@@ -90,4 +96,6 @@ int geneve_xmit_skb(struct geneve_sock *gs, struct rtable *rt,
                    bool csum, bool xnet);
 #endif /*ifdef CONFIG_INET */
 
+#endif /* kernel < 4.0 */
+
 #endif /*ifdef__NET_GENEVE_WRAPPER_H */
-- 
1.9.1

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

Reply via email to