summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorTim Rozet <trozet@redhat.com>2017-05-28 13:05:21 -0400
committerTim Rozet <trozet@redhat.com>2017-08-02 15:09:19 -0400
commit48cbae08f2df3cde9a35c539a75a0655f6f64872 (patch)
tree725bb08e63a0c3e99a69ba67f08860f053c31bfe /build
parent98339f98d955bb046e9651f8c0c4f17eb2b0f79f (diff)
Builds and installs ovs 2.6.1 with NSH support
Change-Id: I369b9d24880ebdb0836e42740ebf27082be9de99 Signed-off-by: Tim Rozet <trozet@redhat.com>
Diffstat (limited to 'build')
-rwxr-xr-xbuild/build_ovs_nsh.sh25
-rwxr-xr-xbuild/overcloud-full.sh23
-rw-r--r--build/patches/ovs-fix-build-on-RHEL-7.3.patch190
3 files changed, 238 insertions, 0 deletions
diff --git a/build/build_ovs_nsh.sh b/build/build_ovs_nsh.sh
new file mode 100755
index 00000000..52d4701f
--- /dev/null
+++ b/build/build_ovs_nsh.sh
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+##############################################################################
+# Copyright (c) 2016 Tim Rozet (Red Hat) and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+set -e
+
+yum -y install rpm-build autoconf automake libtool systemd-units openssl openssl-devel python python-twisted-core python-zope-interface python-six desktop-file-utils groff graphviz procps-ng libcap-ng libcap-ng-devel PyQt4 selinux-policy-devel kernel-devel kernel-headers kernel-tools
+./boot.sh
+libtoolize --force
+aclocal
+autoheader
+automake --force-missing --add-missing
+autoconf
+./configure
+yum -y install rpmdevtools
+# hack due to build pulling in kernel vxlan header
+kernel_vxlan="/usr/src/kernels/$(rpm -q kernel-headers | grep -Eo '[0-9].*x86_64')/include/net/vxlan.h"
+sed -i '/struct vxlan_metadata {/a\ u32 gpe;' $kernel_vxlan
+make rpm-fedora RPMBUILD_OPT="\"-D kversion `rpm -q kernel | rpmdev-sort | tail -n -1 | sed 's/^kernel-//'`\" --without check"
+make rpm-fedora-kmod RPMBUILD_OPT="\"-D kversion `rpm -q kernel | rpmdev-sort | tail -n -1 | sed 's/^kernel-//'`\""
diff --git a/build/overcloud-full.sh b/build/overcloud-full.sh
index 7b008890..02455402 100755
--- a/build/overcloud-full.sh
+++ b/build/overcloud-full.sh
@@ -152,5 +152,28 @@ if [ "$(uname -i)" == 'x86_64' ]; then
barometer_pkgs overcloud-full_build.qcow2
fi
+# Build OVS with NSH
+rm -rf ovs_nsh_patches
+rm -rf ovs
+git clone https://github.com/yyang13/ovs_nsh_patches.git
+git clone https://github.com/openvswitch/ovs.git
+pushd ovs > /dev/null
+git checkout v2.6.1
+cp ../ovs_nsh_patches/v2.6.1/*.patch ./
+cp ${BUILD_ROOT}/patches/ovs-fix-build-on-RHEL-7.3.patch ./
+# Hack for build servers that have no git config
+git config user.email "apex@opnfv.com"
+git config user.name "apex"
+git am *.patch
+popd > /dev/null
+tar czf ovs.tar.gz ovs
+
+LIBGUESTFS_BACKEND=direct virt-customize \
+ --upload ${BUILD_ROOT}/build_ovs_nsh.sh:/root/ \
+ --upload ovs.tar.gz:/root/ \
+ --run-command "cd /root/ && tar xzf ovs.tar.gz" \
+ --run-command "cd /root/ovs && /root/build_ovs_nsh.sh" \
+ -a overcloud-full_build.qcow2
+
mv -f overcloud-full_build.qcow2 overcloud-full.qcow2
popd > /dev/null
diff --git a/build/patches/ovs-fix-build-on-RHEL-7.3.patch b/build/patches/ovs-fix-build-on-RHEL-7.3.patch
new file mode 100644
index 00000000..05f19bde
--- /dev/null
+++ b/build/patches/ovs-fix-build-on-RHEL-7.3.patch
@@ -0,0 +1,190 @@
+From 6ccf21ca77ec092aa63b3daff66dc9f0d0e1be93 Mon Sep 17 00:00:00 2001
+From: Yi-Hung Wei <yihung.wei@gmail.com>
+Date: Thu, 8 Dec 2016 18:34:05 -0800
+Subject: [PATCH] datapath: compat: Fix build on RHEL 7.3
+
+RHEL 7.3 provides upstream tunnel but it does not support name_assign_type
+attribute in net-device. This patch fixes the build problem by backporting
+functions with name_assign_type, and using proper flags in acinclude.m4 to
+invoke backport functions.
+
+Tested on RHEL 7.3 with kernel 3.10.0-514.el7.x86_64
+
+Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
+Signed-off-by: Joe Stringer <joe@ovn.org>
+---
+ acinclude.m4 | 7 +++++++
+ datapath/linux/compat/include/linux/netdevice.h | 3 ++-
+ datapath/linux/compat/include/net/geneve.h | 10 ++++++++++
+ datapath/linux/compat/include/net/gre.h | 10 ++++++++++
+ datapath/linux/compat/include/net/inet_frag.h | 9 ++++++---
+ datapath/linux/compat/include/net/vxlan.h | 11 +++++++++++
+ datapath/vport-internal_dev.c | 4 ++++
+ 7 files changed, 50 insertions(+), 4 deletions(-)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index bea49d2..e8b64b5 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -458,6 +458,11 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
+ OVS_FIND_FIELD_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frag_queue],
+ [list_evictor])
+ OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [inet_frag_lru_move])
++ OVS_FIND_PARAM_IFELSE([$KSRC/include/net/inet_frag.h],
++ [sub_frag_mem_limit], [struct.netns_frags],
++ [OVS_DEFINE([HAVE_SUB_FRAG_MEM_LIMIT_ARG_STRUCT_NETNS_FRAGS])])
++ OVS_GREP_IFELSE([$KSRC/include/net/inet_frag.h], [void.*inet_frags_init],
++ [OVS_DEFINE([HAVE_VOID_INET_FRAGS_INIT])])
+ OVS_GREP_IFELSE([$KSRC/include/net/inetpeer.h], [vif],
+ [OVS_DEFINE([HAVE_INETPEER_VIF_SUPPORT])])
+
+@@ -500,6 +505,8 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
+ [OVS_DEFINE([HAVE_UDP_OFFLOAD_ARG_UOFF])])
+ OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [gro_remcsum])
+ OVS_GREP_IFELSE([$KSRC/include/linux/netdevice.h], [IFF_PHONY_HEADROOM])
++ OVS_FIND_FIELD_IFELSE([$KSRC/include/linux/netdevice.h], [net_device_ops],
++ [extended])
+ OVS_FIND_PARAM_IFELSE([$KSRC/include/linux/netdevice.h],
+ [netdev_master_upper_dev_link], [upper_priv],
+ [OVS_DEFINE([HAVE_NETDEV_MASTER_UPPER_DEV_LINK_PRIV])])
+diff --git a/datapath/linux/compat/include/linux/netdevice.h b/datapath/linux/compat/include/linux/netdevice.h
+index dd028f6..9982fd7 100644
+--- a/datapath/linux/compat/include/linux/netdevice.h
++++ b/datapath/linux/compat/include/linux/netdevice.h
+@@ -122,10 +122,11 @@ int rpl_dev_queue_xmit(struct sk_buff *skb);
+ #endif
+
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,11,0)
+-static inline struct net_device *netdev_notifier_info_to_dev(void *info)
++static inline struct net_device *rpl_netdev_notifier_info_to_dev(void *info)
+ {
+ return info;
+ }
++#define netdev_notifier_info_to_dev rpl_netdev_notifier_info_to_dev
+ #endif
+
+ #ifndef HAVE_PCPU_SW_NETSTATS
+diff --git a/datapath/linux/compat/include/net/geneve.h b/datapath/linux/compat/include/net/geneve.h
+index 857c6d7..d9c9f0b 100644
+--- a/datapath/linux/compat/include/net/geneve.h
++++ b/datapath/linux/compat/include/net/geneve.h
+@@ -18,6 +18,16 @@ static inline void rpl_geneve_cleanup_module(void)
+
+ #define geneve_xmit dev_queue_xmit
+
++#ifdef CONFIG_INET
++#ifndef HAVE_NAME_ASSIGN_TYPE
++static inline struct net_device *rpl_geneve_dev_create_fb(
++ struct net *net, const char *name, u8 name_assign_type, u16 dst_port) {
++ return geneve_dev_create_fb(net, name, dst_port);
++}
++#define geneve_dev_create_fb rpl_geneve_dev_create_fb
++#endif
++#endif
++
+ #else
+ /* Geneve Header:
+ * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+diff --git a/datapath/linux/compat/include/net/gre.h b/datapath/linux/compat/include/net/gre.h
+index 4a78fe8..764b9f1 100644
+--- a/datapath/linux/compat/include/net/gre.h
++++ b/datapath/linux/compat/include/net/gre.h
+@@ -17,6 +17,16 @@ static inline void rpl_ipgre_fini(void)
+
+ #define gre_fb_xmit dev_queue_xmit
+
++#ifdef CONFIG_INET
++#ifndef HAVE_NAME_ASSIGN_TYPE
++static inline struct net_device *rpl_gretap_fb_dev_create(
++ struct net *net, const char *name, u8 name_assign_type) {
++ return gretap_fb_dev_create(net, name);
++}
++#define gretap_fb_dev_create rpl_gretap_fb_dev_create
++#endif
++#endif
++
+ #else
+
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37) || \
+diff --git a/datapath/linux/compat/include/net/inet_frag.h b/datapath/linux/compat/include/net/inet_frag.h
+index c37bc84..01d79ad 100644
+--- a/datapath/linux/compat/include/net/inet_frag.h
++++ b/datapath/linux/compat/include/net/inet_frag.h
+@@ -29,7 +29,7 @@ static inline bool inet_frag_evicting(struct inet_frag_queue *q)
+ #define inet_frag_lru_move(q)
+ #endif
+
+-#ifndef HAVE_CORRECT_MRU_HANDLING
++#ifndef HAVE_SUB_FRAG_MEM_LIMIT_ARG_STRUCT_NETNS_FRAGS
+ static inline void rpl_sub_frag_mem_limit(struct netns_frags *nf, int i)
+ {
+ __percpu_counter_add(&nf->mem, -i, frag_percpu_counter_batch);
+@@ -41,14 +41,18 @@ static inline void rpl_add_frag_mem_limit(struct netns_frags *nf, int i)
+ __percpu_counter_add(&nf->mem, i, frag_percpu_counter_batch);
+ }
+ #define add_frag_mem_limit rpl_add_frag_mem_limit
++#endif
+
++#ifdef HAVE_VOID_INET_FRAGS_INIT
+ static inline int rpl_inet_frags_init(struct inet_frags *frags)
+ {
+ inet_frags_init(frags);
+ return 0;
+ }
+ #define inet_frags_init rpl_inet_frags_init
++#endif
+
++#ifndef HAVE_CORRECT_MRU_HANDLING
+ /* We reuse the upstream inet_fragment.c common code for managing fragment
+ * stores, However we actually store the fragments within our own 'inet_frags'
+ * structures (in {ip_fragment,nf_conntrack_reasm}.c). When unloading the OVS
+@@ -64,7 +68,6 @@ static inline int rpl_inet_frags_init(struct inet_frags *frags)
+ */
+ void rpl_inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f);
+ #define inet_frags_exit_net rpl_inet_frags_exit_net
+-
+-#endif /* !HAVE_CORRECT_MRU_HANDLING */
++#endif
+
+ #endif /* inet_frag.h */
+diff --git a/datapath/linux/compat/include/net/vxlan.h b/datapath/linux/compat/include/net/vxlan.h
+index 5bc8969..460fbf2 100644
+--- a/datapath/linux/compat/include/net/vxlan.h
++++ b/datapath/linux/compat/include/net/vxlan.h
+@@ -17,6 +17,17 @@ static inline void rpl_vxlan_cleanup_module(void)
+
+ #define vxlan_xmit dev_queue_xmit
+
++#ifdef CONFIG_INET
++#ifndef HAVE_NAME_ASSIGN_TYPE
++static inline struct net_device *rpl_vxlan_dev_create(
++ struct net *net, const char *name, u8 name_assign_type,
++ struct vxlan_config *conf) {
++ return vxlan_dev_create(net, name, conf);
++}
++#define vxlan_dev_create rpl_vxlan_dev_create
++#endif
++#endif
++
+ #else /* USE_UPSTREAM_TUNNEL */
+
+ #include <linux/ip.h>
+diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c
+index 482af37..cc01c9c 100644
+--- a/datapath/vport-internal_dev.c
++++ b/datapath/vport-internal_dev.c
+@@ -153,7 +153,11 @@ static const struct net_device_ops internal_dev_netdev_ops = {
+ .ndo_change_mtu = internal_dev_change_mtu,
+ .ndo_get_stats64 = internal_get_stats,
+ #ifdef HAVE_IFF_PHONY_HEADROOM
++#ifndef HAVE_NET_DEVICE_OPS_WITH_EXTENDED
+ .ndo_set_rx_headroom = internal_set_rx_headroom,
++#else
++ .extended.ndo_set_rx_headroom = internal_set_rx_headroom,
++#endif
+ #endif
+ };
+
+--
+2.1.0
+