From 4da84af9534157c2667fe421311400cb20601f0e Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Wed, 9 Sep 2015 18:05:04 +0300 Subject: [PATCH] openvswitch: use released version 2.4.0 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 --- net/openvswitch/Makefile | 4 +- ...0005-add-wait-any-define-in-test-ovn.patch | 14 --- ...path-Add-net-ip6_checksum.h-to-stt.c.patch | 34 +++++++ .../patches/0006-force-kernel-4-1.patch | 17 ++++ .../patches/0007-add-netns-compat.patch | 93 +++++++++++++++++++ ...08-add-back-old-gfp-this-node-define.patch | 19 ++++ .../patches/0010-patch-nf_ip_hook-4.1.patch | 20 ++++ .../patches/0011-fix-vxlan-xmit-skb-4.1.patch | 18 ++++ .../patches/0012-fix-vport-lisp-4.1.patch | 16 ++++ 9 files changed, 219 insertions(+), 16 deletions(-) delete mode 100644 net/openvswitch/patches/0005-add-wait-any-define-in-test-ovn.patch create mode 100644 net/openvswitch/patches/0005-datapath-Add-net-ip6_checksum.h-to-stt.c.patch create mode 100644 net/openvswitch/patches/0006-force-kernel-4-1.patch create mode 100644 net/openvswitch/patches/0007-add-netns-compat.patch create mode 100644 net/openvswitch/patches/0008-add-back-old-gfp-this-node-define.patch create mode 100644 net/openvswitch/patches/0010-patch-nf_ip_hook-4.1.patch create mode 100644 net/openvswitch/patches/0011-fix-vxlan-xmit-skb-4.1.patch create mode 100644 net/openvswitch/patches/0012-fix-vport-lisp-4.1.patch diff --git a/net/openvswitch/Makefile b/net/openvswitch/Makefile index 86e6c52af..9b59d59c2 100644 --- a/net/openvswitch/Makefile +++ b/net/openvswitch/Makefile @@ -11,7 +11,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=openvswitch -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_VERSION:=2.4.0 PKG_RELEASE=$(PKG_SOURCE_VERSION) PKG_LICENSE:=Apache-2.0 @@ -21,7 +21,7 @@ PKG_USE_MIPS16:=0 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=https://github.com/openvswitch/ovs PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=1b05a9d3298f92525d1c2d91bec11abf0766fdf1 +PKG_SOURCE_VERSION:=b979c282ef040a20d09b8d6885648b09352f05db PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz PKG_BUILD_PARALLEL:=1 diff --git a/net/openvswitch/patches/0005-add-wait-any-define-in-test-ovn.patch b/net/openvswitch/patches/0005-add-wait-any-define-in-test-ovn.patch deleted file mode 100644 index d6dd6a1d5..000000000 --- a/net/openvswitch/patches/0005-add-wait-any-define-in-test-ovn.patch +++ /dev/null @@ -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) - { diff --git a/net/openvswitch/patches/0005-datapath-Add-net-ip6_checksum.h-to-stt.c.patch b/net/openvswitch/patches/0005-datapath-Add-net-ip6_checksum.h-to-stt.c.patch new file mode 100644 index 000000000..61504d27a --- /dev/null +++ b/net/openvswitch/patches/0005-datapath-Add-net-ip6_checksum.h-to-stt.c.patch @@ -0,0 +1,34 @@ +From 554daf066bf4a8eb7bbc8edc1a877a3afc0de38d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jason=20K=C3=B6lker?= +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 will fall +back to the c implementation by wrapping it in an +`#ifndef _HAVE_ARCH_IPV6_CSUM`. + +Signed-off-by: Jason Kölker +Signed-off-by: Jesse Gross +--- + 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 + #include + #include ++#include + #include + #include + #include +-- +2.1.4 + diff --git a/net/openvswitch/patches/0006-force-kernel-4-1.patch b/net/openvswitch/patches/0006-force-kernel-4-1.patch new file mode 100644 index 000000000..d87fd9061 --- /dev/null +++ b/net/openvswitch/patches/0006-force-kernel-4-1.patch @@ -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 diff --git a/net/openvswitch/patches/0007-add-netns-compat.patch b/net/openvswitch/patches/0007-add-netns-compat.patch new file mode 100644 index 000000000..b6592c826 --- /dev/null +++ b/net/openvswitch/patches/0007-add-netns-compat.patch @@ -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 */ diff --git a/net/openvswitch/patches/0008-add-back-old-gfp-this-node-define.patch b/net/openvswitch/patches/0008-add-back-old-gfp-this-node-define.patch new file mode 100644 index 000000000..ec7d32517 --- /dev/null +++ b/net/openvswitch/patches/0008-add-back-old-gfp-this-node-define.patch @@ -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; diff --git a/net/openvswitch/patches/0010-patch-nf_ip_hook-4.1.patch b/net/openvswitch/patches/0010-patch-nf_ip_hook-4.1.patch new file mode 100644 index 000000000..46c3432f2 --- /dev/null +++ b/net/openvswitch/patches/0010-patch-nf_ip_hook-4.1.patch @@ -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; diff --git a/net/openvswitch/patches/0011-fix-vxlan-xmit-skb-4.1.patch b/net/openvswitch/patches/0011-fix-vxlan-xmit-skb-4.1.patch new file mode 100644 index 000000000..1aecdab87 --- /dev/null +++ b/net/openvswitch/patches/0011-fix-vxlan-xmit-skb-4.1.patch @@ -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 diff --git a/net/openvswitch/patches/0012-fix-vport-lisp-4.1.patch b/net/openvswitch/patches/0012-fix-vport-lisp-4.1.patch new file mode 100644 index 000000000..47bbfb4d4 --- /dev/null +++ b/net/openvswitch/patches/0012-fix-vport-lisp-4.1.patch @@ -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); +