Browse Source

Merge pull request #2202 from jbemmel/openvswitch_2.5.0

Upgrade OpenVSwitch to version 2.5.0 to support kernels up to 4.3
lilik-openwrt-22.03
Hannu Nyman 9 years ago
parent
commit
e0944f2b1d
9 changed files with 18 additions and 237 deletions
  1. +7
    -4
      net/openvswitch/Makefile
  2. +0
    -35
      net/openvswitch/patches/0003-datapath-do-not-add-vlan_hwaccel_push_inside-for-ker.patch
  3. +0
    -34
      net/openvswitch/patches/0005-datapath-Add-net-ip6_checksum.h-to-stt.c.patch
  4. +0
    -17
      net/openvswitch/patches/0006-force-kernel-4-1.patch
  5. +0
    -93
      net/openvswitch/patches/0007-add-netns-compat.patch
  6. +11
    -0
      net/openvswitch/patches/0009-fix-test-ovn.patch
  7. +0
    -20
      net/openvswitch/patches/0010-patch-nf_ip_hook-4.1.patch
  8. +0
    -18
      net/openvswitch/patches/0011-fix-vxlan-xmit-skb-4.1.patch
  9. +0
    -16
      net/openvswitch/patches/0012-fix-vport-lisp-4.1.patch

+ 7
- 4
net/openvswitch/Makefile View File

@ -12,7 +12,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=openvswitch
PKG_RELEASE:=3
PKG_VERSION:=2.4.0
PKG_VERSION:=2.5.0
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_LICENSE:=Apache-2.0
PKG_LICENSE_FILES:=COPYING
@ -21,14 +21,17 @@ 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:=b979c282ef040a20d09b8d6885648b09352f05db
PKG_SOURCE_VERSION:=98b94d1e7002063ce2ea3c3221fe9234cac4e124
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_PARALLEL:=1
PKG_FIXUP:=autoreconf
PKG_INSTALL:=1
SUPPORTED_KERNELS:=LINUX_3_8||LINUX_3_10||LINUX_3_13||LINUX_3_14||LINUX_3_18||LINUX_4_0||LINUX_4_1
# Upstream package supports kernels between 2.6.32 and 4.3
# see https://github.com/openvswitch/ovs/blob/master/FAQ.md
# This list is pruned to only those kernels used in OpenWRT
SUPPORTED_KERNELS:=LINUX_3_18||LINUX_4_1||LINUX_4_3
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/kernel.mk
@ -98,7 +101,7 @@ define KernelPackage/openvswitch
SUBMENU:=Network Support
TITLE:=Open vSwitch Kernel Package
KCONFIG:=CONFIG_BRIDGE
DEPENDS:=+kmod-stp @IPV6 +kmod-gre +kmod-lib-crc32c +kmod-vxlan @($(SUPPORTED_KERNELS))
DEPENDS:=+kmod-stp @IPV6 +kmod-gre +kmod-lib-crc32c +kmod-vxlan +kmod-nf-conntrack +kmod-nf-conntrack6 @($(SUPPORTED_KERNELS))
FILES:= \
$(PKG_BUILD_DIR)/datapath/linux/openvswitch.$(LINUX_KMOD_SUFFIX)
AUTOLOAD:=$(call AutoLoad,21,openvswitch)


+ 0
- 35
net/openvswitch/patches/0003-datapath-do-not-add-vlan_hwaccel_push_inside-for-ker.patch View File

@ -1,35 +0,0 @@
From 5919cb26c631b1dd77a745a3c546f9d117ed34b3 Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sat, 23 May 2015 18:12:09 +0200
Subject: [PATCH] datapath: do not add vlan_hwaccel_push_inside() for kernel >=
3.18.13
The vlan_hwaccel_push_inside() function was backported in this commit
to kernel 3.18.13:
commit a67e2e88342accd49587d9bad72f6dabd7673f7c
Author: Jiri Pirko <jiri@resnulli.us>
Date: Wed Nov 19 14:04:59 2014 +0100
vlan: introduce *vlan_hwaccel_push_inside helpers
[ Upstream commit 5968250c868ceee680aa77395b24e6ddcae17d36 ]
Without this patch compilation breaks on kernel >= 3.18.13
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
datapath/linux/compat/include/linux/if_vlan.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/datapath/linux/compat/include/linux/if_vlan.h
+++ b/datapath/linux/compat/include/linux/if_vlan.h
@@ -52,7 +52,7 @@ static inline struct sk_buff *rpl_vlan_i
}
#endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,18,13)
/*
* __vlan_hwaccel_push_inside - pushes vlan tag to the payload
* @skb: skbuff to tag

+ 0
- 34
net/openvswitch/patches/0005-datapath-Add-net-ip6_checksum.h-to-stt.c.patch View File

@ -1,34 +0,0 @@
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
- 17
net/openvswitch/patches/0006-force-kernel-4-1.patch View File

@ -1,17 +0,0 @@
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
- 93
net/openvswitch/patches/0007-add-netns-compat.patch View File

@ -1,93 +0,0 @@
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 */

+ 11
- 0
net/openvswitch/patches/0009-fix-test-ovn.patch View File

@ -0,0 +1,11 @@
--- a/tests/test-ovn.c
+++ b/tests/test-ovn.c
@@ -1043,7 +1043,7 @@ wait_pid(pid_t *pids, int *n)
int status;
pid_t pid;
- pid = waitpid(WAIT_ANY, &status, 0);
+ pid = waitpid(-1, &status, 0);
if (pid < 0) {
ovs_fatal(errno, "waitpid failed");
} else if (WIFEXITED(status)) {

+ 0
- 20
net/openvswitch/patches/0010-patch-nf_ip_hook-4.1.patch View File

@ -1,20 +0,0 @@
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
- 18
net/openvswitch/patches/0011-fix-vxlan-xmit-skb-4.1.patch View File

@ -1,18 +0,0 @@
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
- 16
net/openvswitch/patches/0012-fix-vport-lisp-4.1.patch View File

@ -1,16 +0,0 @@
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);

Loading…
Cancel
Save