From 2542f94967b8a2e612c5fd274b6eb9527d269dd0 Mon Sep 17 00:00:00 2001 From: Timothy Redaelli Date: Thu, 18 May 2017 12:57:32 +0200 Subject: [PATCH] Link statically with DPDK 16.11.1 and add python3-six as BuildRequires - Link statically is needed since DPDK package in Fedora is moving faster than what is supported by Open vSwitch. - Using python3-six as BuildRequires is needed to launch the python3 tests Resolves: #1451476 --- .gitignore | 1 + openvswitch.spec | 143 +++++++++++++++++++++++++++++++++++++++++++++-- sources | 1 + 3 files changed, 139 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 75434c0..df05da5 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ /openvswitch-2.6.0.tar.gz /openvswitch-2.6.1.tar.gz /openvswitch-2.7.0.tar.gz +/dpdk-16.11.1.tar.gz diff --git a/openvswitch.spec b/openvswitch.spec index 301ccc3..563afd3 100644 --- a/openvswitch.spec +++ b/openvswitch.spec @@ -23,9 +23,13 @@ # Enable PIE, bz#955181 %global _hardened_build 1 +%define dpdkver 16.11.1 +%define dpdkdir dpdk-stable +%define dpdksver %(echo %{dpdkver} | cut -d. -f-2) + Name: openvswitch Version: 2.7.0 -Release: 0%{?snapshot}%{?dist} +Release: 1%{?snapshot}%{?dist} Summary: Open vSwitch daemon/database/utilities # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the @@ -34,10 +38,37 @@ Summary: Open vSwitch daemon/database/utilities License: ASL 2.0 and LGPLv2+ and SISSL URL: http://openvswitch.org Source0: http://openvswitch.org/releases/%{name}-%{version}%{?snap_gitsha}.tar.gz -Source1: ovs-snapshot.sh +Source1: http://fast.dpdk.org/rel/dpdk-%{dpdkver}.tar.gz +Source2: ovs-snapshot.sh %if %{with dpdk} ExclusiveArch: x86_64 i686 aarch64 ppc64le + +# machine_arch maps between rpm and dpdk arch name, often same as _target_cpu +# machine_tmpl is the config template machine name, often "native" +# machine is the actual machine name used in the dpdk make system +%ifarch x86_64 +%define machine_arch x86_64 +%define machine_tmpl native +%define machine default +%endif +%ifarch i686 +%define machine_arch i686 +%define machine_tmpl native +%define machine atm +%endif +%ifarch aarch64 +%define machine_arch arm64 +%define machine_tmpl armv8a +%define machine armv8a +%endif +%ifarch ppc64le +%define machine_arch ppc_64 +%define machine_tmpl power8 +%define machine power8 +%endif + +%define dpdktarget %{machine_arch}-%{machine_tmpl}-linuxapp-gcc %else ExcludeArch: ppc %endif @@ -45,7 +76,7 @@ ExcludeArch: ppc BuildRequires: autoconf automake libtool BuildRequires: systemd-units openssl openssl-devel BuildRequires: python2-devel python2-six -BuildRequires: python3-devel +BuildRequires: python3-devel python3-six BuildRequires: desktop-file-utils BuildRequires: groff graphviz # make check dependencies @@ -56,7 +87,6 @@ BuildRequires: procps-ng %if %{with dpdk} # DPDK driver dependencies BuildRequires: libpcap-devel numactl-devel -BuildRequires: dpdk-devel >= 16.11 %endif Requires: openssl iproute module-init-tools @@ -160,9 +190,106 @@ Requires: openvswitch openvswitch-ovn-common python2-openvswitch Docker network plugins for OVN. %prep -%setup -q -n %{name}-%{version}%{?snap_gitsha} +%setup -q -n %{name}-%{version}%{?snap_gitsha} -a 1 %build +%if %{with dpdk} +# Lets build DPDK first +cd %{dpdkdir}-%{dpdkver} +function setconf() +{ + cf=%{dpdktarget}/.config + if grep -q $1 $cf; then + sed -i "s:^$1=.*$:$1=$2:g" $cf + else + echo $1=$2 >> $cf + fi +} + +# In case dpdk-devel is installed +unset RTE_SDK RTE_INCLUDE RTE_TARGET + +# Avoid appending second -Wall to everything, it breaks upstream warning +# disablers in makefiles. Strip explicit -march= from optflags since they +# will only guarantee build failures, DPDK is picky with that. +export EXTRA_CFLAGS="$(echo %{optflags} | sed -e 's:-Wall::g' -e 's:-march=[[:alnum:]]* ::g') -Wformat -fPIC" + +# DPDK defaults to using builder-specific compiler flags. However, +# the config has been changed by specifying CONFIG_RTE_MACHINE=default +# in order to build for a more generic host. NOTE: It is possible that +# the compiler flags used still won't work for all Fedora-supported +# machines, but runtime checks in DPDK will catch those situations. + +make V=1 O=%{dpdktarget} T=%{dpdktarget} %{?_smp_mflags} config + +# DPDK defaults to optimizing for the builder host we need generic binaries +setconf CONFIG_RTE_MACHINE '"%{machine}"' + +# Disable DPDK libraries not needed by OVS +setconf CONFIG_RTE_LIBRTE_TIMER n +setconf CONFIG_RTE_LIBRTE_CFGFILE n +setconf CONFIG_RTE_LIBRTE_JOBSTATS n +setconf CONFIG_RTE_LIBRTE_LPM n +setconf CONFIG_RTE_LIBRTE_ACL n +setconf CONFIG_RTE_LIBRTE_POWER n +setconf CONFIG_RTE_LIBRTE_DISTRIBUTOR n +setconf CONFIG_RTE_LIBRTE_REORDER n +setconf CONFIG_RTE_LIBRTE_PORT n +setconf CONFIG_RTE_LIBRTE_TABLE n +setconf CONFIG_RTE_LIBRTE_PIPELINE n +setconf CONFIG_RTE_LIBRTE_KNI n +setconf CONFIG_RTE_LIBRTE_CRYPTODEV n + +# Disable DPDK applications not needed by OVS +setconf CONFIG_RTE_APP_TEST n +setconf CONFIG_RTE_APP_CRYPTO_PERF n + +# Enable DPDK libraries needed by OVS +setconf CONFIG_RTE_LIBRTE_VHOST_NUMA y +setconf CONFIG_RTE_LIBRTE_PMD_PCAP y + +# Disable PMDs that are either not needed or not stable +setconf CONFIG_RTE_LIBRTE_PMD_VHOST n +setconf CONFIG_RTE_LIBRTE_PMD_NULL_CRYPTO n +# BNX2X driver is not stable +setconf CONFIG_RTE_LIBRTE_BNX2X_PMD n + +# Disable virtio user as not used by OVS +setconf CONFIG_RTE_VIRTIO_USER n + +# Disable kernel modules +setconf CONFIG_RTE_EAL_IGB_UIO n +setconf CONFIG_RTE_KNI_KMOD n + +# Disable experimental stuff +setconf CONFIG_RTE_NEXT_ABI n + +# Disable some PMDs on fdProd +setconf CONFIG_RTE_LIBRTE_BNXT_PMD n +setconf CONFIG_RTE_LIBRTE_ENA_PMD n +setconf CONFIG_RTE_LIBRTE_QEDE_PMD n + +make V=1 O=%{dpdktarget} %{?_smp_mflags} + +# Generate a list of supported drivers, its hard to tell otherwise. +cat << EOF > README.DPDK-PMDS +DPDK drivers included in this package: + +EOF + +for f in $(ls %{machine_arch}-%{machine_tmpl}-linuxapp-gcc/lib/lib*_pmd_*); do + basename ${f} | cut -c12- | cut -d. -f1 | tr [:lower:] [:upper:] +done >> README.DPDK-PMDS + +cat << EOF >> README.DPDK-PMDS + +For further information about the drivers, see +http://dpdk.org/doc/guides-%{dpdksver}/nics/index.html +EOF + +cd - +%endif + %if 0%{?snap_gitsha:1} # fix the snapshot unreleased version to be the released one. sed -i.old -e "s/^AC_INIT(openvswitch,.*,/AC_INIT(openvswitch, %{version},/" configure.ac @@ -172,7 +299,7 @@ sed -i.old -e "s/^AC_INIT(openvswitch,.*,/AC_INIT(openvswitch, %{version},/" con %configure \ --enable-ssl \ %if %{with dpdk} - --with-dpdk=$(dirname %{_datadir}/dpdk/*/.config) \ + --with-dpdk=$(pwd)/%{dpdkdir}-%{dpdkver}/%{dpdktarget} \ %endif --with-pkidir=%{_sharedstatedir}/openvswitch/pki @@ -501,6 +628,10 @@ rm -rf $RPM_BUILD_ROOT %{_unitdir}/ovn-controller-vtep.service %changelog +* Thu May 18 2017 Timothy Redaelli - 2.7.0-1 +- Link statically with DPDK 16.11.1 (#1451476) +- Added python3-six to BuildRequires in order to launch python3 tests too + * Fri Feb 24 2017 Timothy Redaelli - 2.7.0-0 - Updated to Open vSwitch 2.7.0 (#1426596) - Enable DPDK support diff --git a/sources b/sources index b3c2d58..6376993 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ +SHA512 (dpdk-16.11.1.tar.gz) = c31bd5430c0c268d202985ebc6a7757c4b4ce76d3e3acef84d9d56a69c88ede9f8551773e50cc1f6153c2b1fd1bb75c204ff69c6c2783960d45165b8282b6097 SHA512 (openvswitch-2.7.0.tar.gz) = d0c61fa149f5279182de561ed82125e7ddd4ecd4278eba3c5e6a7221840c8cbb70581269afdf4ff2508b8e5baeb8783b1a196d6e6f747e3a21aacdf778d6d190