The previous version was an unreleased one from the OVS trunk. This one is the released version, described here: http://openvswitch.org/pipermail/announce/2015-August/000078.html Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>lilik-openwrt-22.03
@ -1,14 +0,0 @@ | |||
diff --git a/tests/test-ovn.c b/tests/test-ovn.c | |||
index 60b87de..4ad3697 100644 | |||
--- a/tests/test-ovn.c | |||
+++ b/tests/test-ovn.c | |||
@@ -974,6 +974,9 @@ test_tree_shape_exhaustively(struct expr *expr, struct shash *symtab, | |||
} | |||
#ifndef _WIN32 | |||
+#ifndef WAIT_ANY | |||
+#define WAIT_ANY (-1) | |||
+#endif | |||
static void | |||
wait_pid(pid_t *pids, int *n) | |||
{ |
@ -0,0 +1,34 @@ | |||
From 554daf066bf4a8eb7bbc8edc1a877a3afc0de38d Mon Sep 17 00:00:00 2001 | |||
From: =?UTF-8?q?Jason=20K=C3=B6lker?= <jason@koelker.net> | |||
Date: Wed, 2 Sep 2015 22:40:24 +0000 | |||
Subject: [PATCH] datapath: Add net/ip6_checksum.h to stt.c | |||
MIME-Version: 1.0 | |||
Content-Type: text/plain; charset=UTF-8 | |||
Content-Transfer-Encoding: 8bit | |||
`csum_ipv6_magic` is an asm inline on most platforms. However if it is | |||
not defined (like on ppc64le) including <net/ip6_checksum.h> will fall | |||
back to the c implementation by wrapping it in an | |||
`#ifndef _HAVE_ARCH_IPV6_CSUM`. | |||
Signed-off-by: Jason Kölker <jason@koelker.net> | |||
Signed-off-by: Jesse Gross <jesse@nicira.com> | |||
--- | |||
datapath/linux/compat/stt.c | 1 + | |||
1 file changed, 1 insertion(+) | |||
diff --git a/datapath/linux/compat/stt.c b/datapath/linux/compat/stt.c | |||
index b44f470..dd21753 100644 | |||
--- a/datapath/linux/compat/stt.c | |||
+++ b/datapath/linux/compat/stt.c | |||
@@ -30,6 +30,7 @@ | |||
#include <net/icmp.h> | |||
#include <net/inet_ecn.h> | |||
#include <net/ip.h> | |||
+#include <net/ip6_checksum.h> | |||
#include <net/net_namespace.h> | |||
#include <net/netns/generic.h> | |||
#include <net/sock.h> | |||
-- | |||
2.1.4 | |||
@ -0,0 +1,17 @@ | |||
diff --git a/acinclude.m4 b/acinclude.m4 | |||
index 45cfaf6..42866de 100644 | |||
--- a/acinclude.m4 | |||
+++ b/acinclude.m4 | |||
@@ -134,10 +134,10 @@ AC_DEFUN([OVS_CHECK_LINUX], [ | |||
AC_MSG_RESULT([$kversion]) | |||
if test "$version" -ge 4; then | |||
- if test "$version" = 4 && test "$patchlevel" -le 0; then | |||
+ if test "$version" = 4 && test "$patchlevel" -le 1; then | |||
: # Linux 4.x | |||
else | |||
- AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 4.0.x is not supported (please refer to the FAQ for advice)]) | |||
+ AC_ERROR([Linux kernel in $KBUILD is version $kversion, but version newer than 4.1.x is not supported (please refer to the FAQ for advice)]) | |||
fi | |||
elif test "$version" = 3; then | |||
: # Linux 3.x |
@ -0,0 +1,93 @@ | |||
diff --git a/datapath/datapath.h b/datapath/datapath.h | |||
index fdf35f0..02be8be 100644 | |||
--- a/datapath/datapath.h | |||
+++ b/datapath/datapath.h | |||
@@ -86,10 +86,8 @@ struct datapath { | |||
/* Stats. */ | |||
struct dp_stats_percpu __percpu *stats_percpu; | |||
-#ifdef CONFIG_NET_NS | |||
/* Network namespace ref. */ | |||
- struct net *net; | |||
-#endif | |||
+ possible_net_t net; | |||
u32 user_features; | |||
}; | |||
@@ -154,12 +152,12 @@ int lockdep_ovsl_is_held(void); | |||
static inline struct net *ovs_dp_get_net(const struct datapath *dp) | |||
{ | |||
- return read_pnet(&dp->net); | |||
+ return ovs_compat_read_pnet(&dp->net); | |||
} | |||
static inline void ovs_dp_set_net(struct datapath *dp, struct net *net) | |||
{ | |||
- write_pnet(&dp->net, net); | |||
+ ovs_compat_write_pnet(&dp->net, net); | |||
} | |||
struct vport *ovs_lookup_vport(const struct datapath *dp, u16 port_no); | |||
diff --git a/datapath/linux/compat/include/net/net_namespace.h b/datapath/linux/compat/include/net/net_namespace.h | |||
index b7dbfe3..7763584 100644 | |||
--- a/datapath/linux/compat/include/net/net_namespace.h | |||
+++ b/datapath/linux/compat/include/net/net_namespace.h | |||
@@ -51,4 +51,57 @@ static void rpl_unregister_pernet_gen_##TYPE(struct rpl_pernet_operations *rpl_p | |||
#define DEFINE_COMPAT_PNET_REG_FUNC(TYPE) | |||
#endif /* 2.6.33 */ | |||
+/* In recent kernel versions (4.1) this type is defined ; for older versions we have to define it */ | |||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) | |||
+#define ovs_compat_read_pnet read_pnet | |||
+#define ovs_compat_write_pnet write_pnet | |||
+ | |||
+#if defined(CONFIG_NET_NS) && defined(NETNS_REFCNT_DEBUG) | |||
+static inline struct net *hold_net(struct net *net) | |||
+{ | |||
+ if (net) | |||
+ atomic_inc(&net->use_count); | |||
+ return net; | |||
+} | |||
+ | |||
+static inline void release_net(struct net *net) | |||
+{ | |||
+ if (net) | |||
+ atomic_dec(&net->use_count); | |||
+} | |||
+#else | |||
+static inline struct net *hold_net(struct net *net) | |||
+{ | |||
+ return net; | |||
+} | |||
+ | |||
+static inline void release_net(struct net *net) | |||
+{ | |||
+} | |||
+#endif | |||
+ | |||
+#else /* lower than 4.1 */ | |||
+typedef struct { | |||
+#ifdef CONFIG_NET_NS | |||
+ struct net *net; | |||
+#endif | |||
+} possible_net_t; | |||
+ | |||
+static inline void ovs_compat_write_pnet(possible_net_t *pnet, struct net *net) | |||
+{ | |||
+#ifdef CONFIG_NET_NS | |||
+ pnet->net = net; | |||
+#endif | |||
+} | |||
+ | |||
+static inline struct net *ovs_compat_read_pnet(const possible_net_t *pnet) | |||
+{ | |||
+#ifdef CONFIG_NET_NS | |||
+ return pnet->net; | |||
+#else | |||
+ return &init_net; | |||
+#endif | |||
+} | |||
+#endif /* 4.1.0 */ | |||
+ | |||
#endif /* net/net_namespace.h wrapper */ |
@ -0,0 +1,19 @@ | |||
diff --git a/datapath/flow.c b/datapath/flow.c | |||
index a7a2063..8db8041 100644 | |||
--- a/datapath/flow.c | |||
+++ b/datapath/flow.c | |||
@@ -51,6 +51,14 @@ | |||
#include "vlan.h" | |||
+#ifndef GFP_THISNODE | |||
+#ifdef CONFIG_NUMA | |||
+#define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) | |||
+#else | |||
+#define GFP_THISNODE ((__force gfp_t)0) | |||
+#endif | |||
+#endif | |||
+ | |||
u64 ovs_flow_used_time(unsigned long flow_jiffies) | |||
{ | |||
struct timespec cur_ts; |
@ -0,0 +1,20 @@ | |||
diff --git a/datapath/linux/compat/stt.c b/datapath/linux/compat/stt.c | |||
index b44f470..f95416e 100644 | |||
--- a/datapath/linux/compat/stt.c | |||
+++ b/datapath/linux/compat/stt.c | |||
@@ -1326,9 +1326,14 @@ static void clean_percpu(struct work_struct *work) | |||
static unsigned int nf_ip_hook(FIRST_PARAM | |||
struct sk_buff *skb, | |||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) | |||
+ const struct nf_hook_state *state | |||
+#else | |||
const struct net_device *in, | |||
const struct net_device *out, | |||
- int (*okfn)(struct sk_buff *)) | |||
+ int (*okfn)(struct sk_buff *) | |||
+#endif | |||
+ ) | |||
{ | |||
struct stt_sock *stt_sock; | |||
int ip_hdr_len; |
@ -0,0 +1,18 @@ | |||
diff --git a/datapath/linux/compat/include/net/vxlan.h b/datapath/linux/compat/include/net/vxlan.h | |||
index 0d60c18..db4dfb6 100644 | |||
--- a/datapath/linux/compat/include/net/vxlan.h | |||
+++ b/datapath/linux/compat/include/net/vxlan.h | |||
@@ -99,8 +99,13 @@ static inline int rpl_vxlan_xmit_skb(struct vxlan_sock *vs, | |||
return -ENOSYS; | |||
} | |||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) | |||
+ return vxlan_xmit_skb(rt, vs->sock->sk, skb, src, dst, tos, ttl, df, | |||
+ src_port, dst_port, md, xnet, vxflags); | |||
+#else | |||
return vxlan_xmit_skb(rt, skb, src, dst, tos, ttl, df, | |||
src_port, dst_port, md, xnet, vxflags); | |||
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */ | |||
} | |||
#define vxlan_xmit_skb rpl_vxlan_xmit_skb |
@ -0,0 +1,16 @@ | |||
diff --git a/datapath/vport-lisp.c b/datapath/vport-lisp.c | |||
index 0024eb4..ce1c3a8 100644 | |||
--- a/datapath/vport-lisp.c | |||
+++ b/datapath/vport-lisp.c | |||
@@ -455,7 +455,11 @@ static int lisp_send(struct vport *vport, struct sk_buff *skb) | |||
ovs_skb_set_inner_protocol(skb, skb->protocol); | |||
df = tun_key->tun_flags & TUNNEL_DONT_FRAGMENT ? htons(IP_DF) : 0; | |||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) | |||
+ sent_len = udp_tunnel_xmit_skb(rt, lisp_port->lisp_rcv_socket->sk, skb, saddr, tun_key->ipv4_dst, | |||
+#else | |||
sent_len = udp_tunnel_xmit_skb(rt, skb, saddr, tun_key->ipv4_dst, | |||
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,1,0) */ | |||
tun_key->ipv4_tos, tun_key->ipv4_ttl, | |||
df, src_port, dst_port, false, true); | |||