summaryrefslogtreecommitdiff
path: root/datapath
diff options
context:
space:
mode:
authorPravin B Shelar <pshelar@ovn.org>2016-07-11 13:06:10 -0700
committerPravin B Shelar <pshelar@ovn.org>2016-07-11 13:06:10 -0700
commite776e1682dabb51e92440f6d52ccbc6234b0f803 (patch)
tree72b5602c0d17a3f5b98f77abe1fddd96e5ade9d8 /datapath
parentc2403bef6fac471f41945f615abe6c0244add5c6 (diff)
downloadopenvswitch-e776e1682dabb51e92440f6d52ccbc6234b0f803.tar.gz
datapath: Fix ip tunnel compilation for newer kernel.
compat iptunnel_xmit is used in backported tunnel code. but it was only defined for kernel older than 3.18, This patch fixes it by compiling it for all kernel which needs to use backported tunnel implementation. Reported-by: Justin Pettit <jpettit@ovn.org> Reported-by: Joe Stringer <joe@ovn.org> Signed-off-by: Pravin B Shelar <pshelar@ovn.org> Acked-by: Jesse Gross <jesse@kernel.org>
Diffstat (limited to 'datapath')
-rw-r--r--datapath/linux/compat/include/net/ip_tunnels.h13
-rw-r--r--datapath/linux/compat/include/net/udp_tunnel.h32
-rw-r--r--datapath/linux/compat/ip_tunnels_core.c7
3 files changed, 18 insertions, 34 deletions
diff --git a/datapath/linux/compat/include/net/ip_tunnels.h b/datapath/linux/compat/include/net/ip_tunnels.h
index e3f9b60f3..7c5c9b584 100644
--- a/datapath/linux/compat/include/net/ip_tunnels.h
+++ b/datapath/linux/compat/include/net/ip_tunnels.h
@@ -8,7 +8,7 @@
* Only function that do not depend on ip_tunnel structure can
* be used. Those needs to be explicitly defined in this header file. */
#include_next <net/ip_tunnels.h>
-#endif
+#else
#include <linux/if_tunnel.h>
#include <linux/types.h>
@@ -19,7 +19,6 @@
#include <net/ip.h>
#include <net/rtnetlink.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
#define __iptunnel_pull_header rpl___iptunnel_pull_header
int rpl___iptunnel_pull_header(struct sk_buff *skb, int hdr_len,
__be16 inner_proto, bool raw_proto, bool xnet);
@@ -30,9 +29,7 @@ static inline int rpl_iptunnel_pull_header(struct sk_buff *skb, int hdr_len,
{
return rpl___iptunnel_pull_header(skb, hdr_len, inner_proto, false, xnet);
}
-#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
int ovs_iptunnel_handle_offloads(struct sk_buff *skb,
bool csum_help, int gso_type_mask,
void (*fix_segment)(struct sk_buff *));
@@ -46,11 +43,6 @@ int ovs_iptunnel_handle_offloads(struct sk_buff *skb,
struct sk_buff *rpl_iptunnel_handle_offloads(struct sk_buff *skb,
bool csum_help,
int gso_type_mask);
-#else
-
-#define ovs_iptunnel_handle_offloads(skb, csum_help, gso_type_mask, fix_segment) \
- iptunnel_handle_offloads(skb, gso_type_mask)
-#endif
#define iptunnel_xmit rpl_iptunnel_xmit
void rpl_iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
@@ -102,7 +94,6 @@ struct tnl_ptk_info {
#define skb_is_encapsulated ovs_skb_is_encapsulated
bool ovs_skb_is_encapsulated(struct sk_buff *skb);
-#ifndef USE_UPSTREAM_TUNNEL
/* Used to memset ip_tunnel padding. */
#define IP_TUNNEL_KEY_SIZE offsetofend(struct ip_tunnel_key, tp_dst)
@@ -334,7 +325,6 @@ int rpl_ip_tunnel_get_iflink(const struct net_device *dev);
#define ip_tunnel_get_link_net rpl_ip_tunnel_get_link_net
struct net *rpl_ip_tunnel_get_link_net(const struct net_device *dev);
-#endif /* USE_UPSTREAM_TUNNEL */
#ifndef HAVE___IP_TUNNEL_CHANGE_MTU
#define __ip_tunnel_change_mtu rpl___ip_tunnel_change_mtu
@@ -356,4 +346,5 @@ static inline int iptunnel_pull_offloads(struct sk_buff *skb)
skb->encapsulation = 0;
return 0;
}
+#endif /* USE_UPSTREAM_TUNNEL */
#endif /* __NET_IP_TUNNELS_H */
diff --git a/datapath/linux/compat/include/net/udp_tunnel.h b/datapath/linux/compat/include/net/udp_tunnel.h
index e15419785..f1e88535f 100644
--- a/datapath/linux/compat/include/net/udp_tunnel.h
+++ b/datapath/linux/compat/include/net/udp_tunnel.h
@@ -11,6 +11,19 @@
#ifdef USE_UPSTREAM_TUNNEL
#include_next <net/udp_tunnel.h>
+/* this is to handle the return type change in handle-offload
+ * functions.
+ */
+static inline int
+rpl_udp_tunnel_handle_offloads(struct sk_buff *skb, bool udp_csum,
+ bool is_vxlan)
+{
+ if (skb_is_gso(skb) && skb_is_encapsulated(skb)) {
+ return -ENOSYS;
+ }
+ return udp_tunnel_handle_offloads(skb, udp_csum);
+}
+
#else
#include <net/addrconf.h>
@@ -143,23 +156,7 @@ static inline void udp_tunnel_gro_complete(struct sk_buff *skb, int nhoff)
skb_shinfo(skb)->gso_type |= uh->check ?
SKB_GSO_UDP_TUNNEL_CSUM : SKB_GSO_UDP_TUNNEL;
}
-#endif
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,7,0)
-/* this is to handle the return type change in handle-offload
- * functions.
- */
-static inline int
-rpl_udp_tunnel_handle_offloads(struct sk_buff *skb, bool udp_csum,
- bool is_vxlan)
-{
- if (skb_is_gso(skb) && skb_is_encapsulated(skb)) {
- return -ENOSYS;
- }
- return udp_tunnel_handle_offloads(skb, udp_csum);
-}
-#else
void ovs_udp_gso(struct sk_buff *skb);
void ovs_udp_csum_gso(struct sk_buff *skb);
@@ -188,10 +185,9 @@ static inline int rpl_udp_tunnel_handle_offloads(struct sk_buff *skb,
return ovs_iptunnel_handle_offloads(skb, udp_csum, type, fix_segment);
}
-#endif
+#endif /* USE_UPSTREAM_TUNNEL */
#define udp_tunnel_handle_offloads rpl_udp_tunnel_handle_offloads
-
static inline void ovs_udp_tun_rx_dst(struct ip_tunnel_info *info,
struct sk_buff *skb,
unsigned short family,
diff --git a/datapath/linux/compat/ip_tunnels_core.c b/datapath/linux/compat/ip_tunnels_core.c
index c22f5dd3a..65b5aea64 100644
--- a/datapath/linux/compat/ip_tunnels_core.c
+++ b/datapath/linux/compat/ip_tunnels_core.c
@@ -37,7 +37,7 @@
#include "gso.h"
#include "vport-netdev.h"
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,0)
+#ifndef USE_UPSTREAM_TUNNEL
void rpl_iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
__be32 src, __be32 dst, __u8 proto, __u8 tos, __u8 ttl,
__be16 df, bool xnet)
@@ -87,9 +87,7 @@ void rpl_iptunnel_xmit(struct sock *sk, struct rtable *rt, struct sk_buff *skb,
iptunnel_xmit_stats(dev, pkt_len);
}
EXPORT_SYMBOL_GPL(rpl_iptunnel_xmit);
-#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4,7,0)
int ovs_iptunnel_handle_offloads(struct sk_buff *skb,
bool csum_help, int gso_type_mask,
void (*fix_segment)(struct sk_buff *))
@@ -175,8 +173,7 @@ int rpl___iptunnel_pull_header(struct sk_buff *skb, int hdr_len,
return iptunnel_pull_offloads(skb);
}
EXPORT_SYMBOL_GPL(rpl___iptunnel_pull_header);
-
-#endif
+#endif /* USE_UPSTREAM_TUNNEL */
bool ovs_skb_is_encapsulated(struct sk_buff *skb)
{