[ovs-dev] [PATCH 1/6] datapath: Fix missing symbols when required to use own VXLAN stack

Thomas Graf tgraf at noironetworks.com
Wed Feb 4 15:45:06 UTC 2015


Fixes an insufficient ifdef in compat/vxlan.c which caused required
symbols not to be included in the build. The declarations were properly
enabled so the build would succeed but the module would spit missing
symbols when being inserted.

The fix uses a new define USE_UPSTREAM_VXLAN which is set in the compat
header <net/vxlan.h> as required. This centralizes the decision when to
include VXLAN compat code to a single place which eases further changes.

Reported-by: Pravin Shelar <pshelar at nicira.com>
Signed-off-by: Thomas Graf <tgraf at noironetworks.com>
---
 datapath/linux/compat/gso.c               | 7 ++++---
 datapath/linux/compat/gso.h               | 5 +++--
 datapath/linux/compat/include/net/vxlan.h | 2 ++
 datapath/linux/compat/vxlan.c             | 7 +++++--
 4 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/datapath/linux/compat/gso.c b/datapath/linux/compat/gso.c
index 13e8f4e..b20ad8a 100644
--- a/datapath/linux/compat/gso.c
+++ b/datapath/linux/compat/gso.c
@@ -17,7 +17,6 @@
  */
 
 #include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
 
 #include <linux/module.h>
 #include <linux/if.h>
@@ -53,6 +52,7 @@ MODULE_PARM_DESC(vlan_tso, "Enable TSO for VLAN packets");
 #define vlan_tso true
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
 static bool dev_supports_vlan_tx(struct net_device *dev)
 {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)
@@ -295,7 +295,8 @@ int rpl_ip_local_out(struct sk_buff *skb)
 }
 #endif /* 3.16 */
 
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0) || \
+	!defined USE_UPSTREAM_VXLAN
 struct sk_buff *ovs_iptunnel_handle_offloads(struct sk_buff *skb,
                                              bool csum_help,
 					     void (*fix_segment)(struct sk_buff *))
@@ -344,4 +345,4 @@ error:
 	kfree_skb(skb);
 	return ERR_PTR(err);
 }
-#endif /* 3.12 */
+#endif /* 3.12 || !USE_UPSTREAM_VXLAN */
diff --git a/datapath/linux/compat/gso.h b/datapath/linux/compat/gso.h
index 1009892..023d6d3 100644
--- a/datapath/linux/compat/gso.h
+++ b/datapath/linux/compat/gso.h
@@ -2,7 +2,8 @@
 #define __LINUX_GSO_WRAPPER_H
 
 #include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0) || \
+	!defined USE_UPSTREAM_VXLAN
 
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
@@ -71,7 +72,7 @@ struct sk_buff *ovs_iptunnel_handle_offloads(struct sk_buff *skb,
 					     gso_fix_segment_t fix_segment);
 
 
-#endif /* 3.12 */
+#endif /* 3.12 || !USE_UPSTREAM_VXLAN */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
 #define ip_local_out rpl_ip_local_out
diff --git a/datapath/linux/compat/include/net/vxlan.h b/datapath/linux/compat/include/net/vxlan.h
index 643f837..478d49d 100644
--- a/datapath/linux/compat/include/net/vxlan.h
+++ b/datapath/linux/compat/include/net/vxlan.h
@@ -78,6 +78,8 @@ struct vxlanhdr_gbp {
 #endif
 
 #ifdef HAVE_VXLAN_METADATA
+#define USE_UPSTREAM_VXLAN
+
 static inline int rpl_vxlan_xmit_skb(struct vxlan_sock *vs,
                    struct rtable *rt, struct sk_buff *skb,
                    __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df,
diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c
index dbccd3c..9342a40 100644
--- a/datapath/linux/compat/vxlan.c
+++ b/datapath/linux/compat/vxlan.c
@@ -18,6 +18,8 @@
  * This code is derived from kernel vxlan module.
  */
 
+#ifndef USE_UPSTREAM_VXLAN
+
 #include <linux/version.h>
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -58,13 +60,14 @@
 #include "datapath.h"
 #include "gso.h"
 #include "vlan.h"
-#ifndef USE_KERNEL_TUNNEL_API
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
 /* VXLAN protocol header */
 struct vxlanhdr {
 	__be32 vx_flags;
 	__be32 vx_vni;
 };
+#endif
 
 /* Callback from net/ipv4/udp.c to receive packets */
 static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
@@ -369,4 +372,4 @@ void vxlan_sock_release(struct vxlan_sock *vs)
 	queue_work(system_wq, &vs->del_work);
 }
 
-#endif /* 3.12 */
+#endif /* !USE_UPSTREAM_VXLAN */
-- 
1.9.3




More information about the dev mailing list