From patchwork Thu Nov 19 12:35:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Pai G, Sunil" X-Patchwork-Id: 1402994 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CcK0p57q6z9sRR for ; Thu, 19 Nov 2020 23:36:10 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id AAFE686E03; Thu, 19 Nov 2020 12:36:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GU88a3+cxGOH; Thu, 19 Nov 2020 12:36:05 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 3999D86DB1; Thu, 19 Nov 2020 12:36:05 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2870BC1825; Thu, 19 Nov 2020 12:36:05 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9FB87C0891 for ; Thu, 19 Nov 2020 12:36:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 7DE39230E6 for ; Thu, 19 Nov 2020 12:36:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LuyqpDzRSbKt for ; Thu, 19 Nov 2020 12:36:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by silver.osuosl.org (Postfix) with ESMTPS id 970FE204E6 for ; Thu, 19 Nov 2020 12:36:00 +0000 (UTC) IronPort-SDR: 2R4yjZPRkPDlS3D6E7kGZ6XrsW1Gmtj+YcRhguuqu1oSUXpr2duvqhFnsJb4k/ApeNwrwEDPBu ZnkoPDCqQmCw== X-IronPort-AV: E=McAfee;i="6000,8403,9809"; a="235429993" X-IronPort-AV: E=Sophos;i="5.77,490,1596524400"; d="scan'208";a="235429993" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Nov 2020 04:35:59 -0800 IronPort-SDR: Xvt2a5Mmry2VldQIXuUIEFNZKIfKFDPxKdzK62MUIeZOJJVupjNIw8T4inoTrYB3EL/iPSGSUO lLRb4DXcfOJA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,490,1596524400"; d="scan'208";a="359969331" Received: from silpixa00399415.ir.intel.com ([10.237.213.140]) by fmsmga004.fm.intel.com with ESMTP; 19 Nov 2020 04:35:57 -0800 From: Sunil Pai G To: dev@openvswitch.org Date: Thu, 19 Nov 2020 12:35:54 +0000 Message-Id: <20201119123554.44684-1-sunil.pai.g@intel.com> X-Mailer: git-send-email 2.17.1 Cc: david.marchand@redhat.com, i.maximets@ovn.org Subject: [ovs-dev] [PATCH dpdk-latest v2] build: Remove DPDK make build references. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Building DPDK using Make is removed since DPDK 20.08. Hence, remove its references in OVS as well. Fixes: 540e70fba6d5 ("build: Add support for DPDK meson build.") Tested-at: https://travis-ci.org/github/Sunil-Pai-G/ovs/builds/742699277 Signed-off-by: Sunil Pai G --- v1->v2: - replace python script for pkg-config output parsing with native linux tools. --- .travis/linux-build.sh | 4 +- Documentation/intro/install/afxdp.rst | 2 +- Documentation/intro/install/dpdk.rst | 75 ++++++---------------- acinclude.m4 | 89 +++++++++------------------ python/automake.mk | 3 +- python/build/pkgcfg.py | 30 --------- 6 files changed, 52 insertions(+), 151 deletions(-) delete mode 100644 python/build/pkgcfg.py diff --git a/.travis/linux-build.sh b/.travis/linux-build.sh index 917bbf962..e085780e9 100755 --- a/.travis/linux-build.sh +++ b/.travis/linux-build.sh @@ -145,12 +145,12 @@ function install_dpdk() CC=gcc meson $DPDK_OPTS build ninja -C build - sudo ninja -C build install + ninja -C build install # Update the library paths. sudo ldconfig - echo "Installed DPDK source" + echo "Installed DPDK source in $(pwd)" popd echo "${DPDK_VER}" > ${VERSION_FILE} } diff --git a/Documentation/intro/install/afxdp.rst b/Documentation/intro/install/afxdp.rst index 327f2b3df..aad0aeebe 100644 --- a/Documentation/intro/install/afxdp.rst +++ b/Documentation/intro/install/afxdp.rst @@ -396,7 +396,7 @@ PVP using vhostuser device -------------------------- First, build OVS with DPDK and AFXDP:: - ./configure --enable-afxdp --with-dpdk=shared|static| + ./configure --enable-afxdp --with-dpdk=shared|static make -j4 && make install Create a vhost-user port from OVS:: diff --git a/Documentation/intro/install/dpdk.rst b/Documentation/intro/install/dpdk.rst index 7a1852bc5..46419d9f9 100644 --- a/Documentation/intro/install/dpdk.rst +++ b/Documentation/intro/install/dpdk.rst @@ -80,62 +80,37 @@ Install DPDK #. Configure and install DPDK using Meson - Meson is the preferred tool to build recent DPDK releases - as Make support is deprecated and will be removed from DPDK 20.11. - OVS supports DPDK Meson builds from DPDK 19.11 onwards. - Build and install the DPDK library:: - $ export DPDK_TARGET=x86_64-native-linuxapp-gcc - $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET - $ meson $DPDK_TARGET - $ ninja -C $DPDK_TARGET - $ sudo ninja -C $DPDK_TARGET install + $ export DPDK_BUILD=$DPDK_DIR/build + $ meson build + $ ninja -C build + $ sudo ninja -C build install $ sudo ldconfig Detailed information can be found at `DPDK documentation`_. -#. (Optional) Configure DPDK as a shared library +#. (Optional) Configure and export the DPDK shared library location + + Since DPDK is built both as static and shared library by default, no extra + configuration is required for the build. - When using Meson, DPDK is built both as static and shared library. - So no extra configuration is required in this case. + Exporting the path to library is not necessary if the DPDK libraries are + system installed. For libraries installed using a prefix + (assuming $DPDK_INSTALL in the below case), export the path to this + library and also update the $PKG_CONFIG_PATH for use before building OVS:: - In case of Make, DPDK can be built as either a static library or a shared - library. By default, it is configured for the former. If you wish to use - the latter, set - ``CONFIG_RTE_BUILD_SHARED_LIB=y`` in ``$DPDK_DIR/config/common_base``. + $ export LD_LIBRARY_PATH=$DPDK_INSTALL/lib/x86_64-linux-gnu/ + $ export PKG_CONFIG_PATH=$DPDK_INSTALL/lib/x86_64-linux-gnu/pkgconfig/ .. note:: Minor performance loss is expected when using OVS with a shared DPDK library compared to a static DPDK library. -#. Configure and install DPDK using Make - - Build and install the DPDK library:: - - $ export DPDK_TARGET=x86_64-native-linuxapp-gcc - $ export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET - $ make install T=$DPDK_TARGET DESTDIR=install - -#. (Optional) Export the DPDK shared library location - - If DPDK was built as a shared library using Make, export the path to this - library for use when building OVS:: - - $ export LD_LIBRARY_PATH=$DPDK_DIR/x86_64-native-linuxapp-gcc/lib - - In case of Meson, exporting the path to library is not necessary if - the DPDK libraries are system installed. For libraries installed using - a prefix(assuming $DPDK_INSTALL in the below case), export the path to this - library and also update the $PKG_CONFIG_PATH for use before building OVS:: - - $ export $DPDK_LIB=$DPDK_INSTALL/lib/x86_64-linux-gnu - $ export LD_LIBRARY_PATH=$DPDK_LIB/:$LD_LIBRARY_PATH - $ export PKG_CONFIG_PATH=$DPDK_LIB/pkgconfig/:$PKG_CONFIG_PATH - .. _DPDK sources: http://dpdk.org/rel -.. _DPDK documentation: https://doc.dpdk.org/guides/linux_gsg/build_dpdk.html +.. _DPDK documentation: + https://doc.dpdk.org/guides-20.08/linux_gsg/build_dpdk.html Install OVS ~~~~~~~~~~~ @@ -156,24 +131,14 @@ has to be configured to build against the DPDK library (``--with-dpdk``). #. Configure the package using the ``--with-dpdk`` flag: - Depending on the tool used to build DPDK and the type of - DPDK library to use, one can configure OVS as follows: - - When DPDK is built using Meson, and OVS must consume DPDK shared libraries - (also equivalent to leaving --with-dpdk option empty):: - - $ ./configure --with-dpdk=shared - - When DPDK is built using Meson, and OVS must consume DPDK static libraries:: + If OVS must consume DPDK static libraries + (also equivalent to ``--with-dpdk=yes`` ):: $ ./configure --with-dpdk=static - When DPDK is built using Make(for shared or static):: + If OVS must consume DPDK shared libraries:: - $ ./configure --with-dpdk=$DPDK_BUILD - - where ``DPDK_BUILD`` is the path to the built DPDK library. This can be - skipped if DPDK library is installed in its default location. + $ ./configure --with-dpdk=shared .. note:: While ``--with-dpdk`` is required, you can pass any other configuration diff --git a/acinclude.m4 b/acinclude.m4 index 061afda4e..c9a4dcfce 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -334,10 +334,9 @@ dnl dnl Configure DPDK source tree AC_DEFUN([OVS_CHECK_DPDK], [ AC_ARG_WITH([dpdk], - [AC_HELP_STRING([--with-dpdk=static|shared|/path/to/dpdk], + [AC_HELP_STRING([--with-dpdk=static|shared|yes], [Specify "static" or "shared" depending on the - DPDK libraries to use only if built using Meson - OR the DPDK build directory in case of Make])], + DPDK libraries to use])], [have_dpdk=true]) AC_MSG_CHECKING([whether dpdk is enabled]) @@ -347,46 +346,25 @@ AC_DEFUN([OVS_CHECK_DPDK], [ else AC_MSG_RESULT([yes]) case "$with_dpdk" in - "shared" | "static" | "yes") - DPDK_AUTO_DISCOVER="true" - case "$with_dpdk" in - "shared" | "yes") - PKG_CHECK_MODULES([DPDK], [libdpdk], [ - DPDK_INCLUDE="$DPDK_CFLAGS" - DPDK_LIB="$DPDK_LIBS"], [ - DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" - DPDK_LIB="-ldpdk"]) - ;; - "static") - PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk], [ - DPDK_INCLUDE="$DPDK_CFLAGS" - DPDK_LIB="$DPDK_LIBS"], [ - DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" - DPDK_LIB="-ldpdk"]) - ;; - esac - ;; - *) - DPDK_AUTO_DISCOVER="false" - DPDK_INCLUDE_PATH="$with_dpdk/include" - # If 'with_dpdk' is passed install directory, point to headers - # installed in $DESTDIR/$prefix/include/dpdk - if test -e "$DPDK_INCLUDE_PATH/rte_config.h"; then - DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH" - elif test -e "$DPDK_INCLUDE_PATH/dpdk/rte_config.h"; then - DPDK_INCLUDE="-I$DPDK_INCLUDE_PATH/dpdk" - fi - DPDK_LIB_DIR="$with_dpdk/lib" - DPDK_LIB="-ldpdk" - ;; + "shared") + PKG_CHECK_MODULES([DPDK], [libdpdk], [ + DPDK_INCLUDE="$DPDK_CFLAGS" + DPDK_LIB="$DPDK_LIBS"], [ + DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" + DPDK_LIB="-ldpdk"]) + ;; + "static" | "yes") + PKG_CHECK_MODULES_STATIC([DPDK], [libdpdk], [ + DPDK_INCLUDE="$DPDK_CFLAGS" + DPDK_LIB="$DPDK_LIBS"], [ + DPDK_INCLUDE="-I/usr/local/include/dpdk -I/usr/include/dpdk" + DPDK_LIB="-ldpdk"]) + ;; esac ovs_save_CFLAGS="$CFLAGS" ovs_save_LDFLAGS="$LDFLAGS" CFLAGS="$CFLAGS $DPDK_INCLUDE" - if test "$DPDK_AUTO_DISCOVER" = "false"; then - LDFLAGS="$LDFLAGS -L${DPDK_LIB_DIR}" - fi AC_CHECK_HEADERS([rte_config.h], [], [ AC_MSG_ERROR([unable to find rte_config.h in $with_dpdk]) @@ -435,21 +413,14 @@ AC_DEFUN([OVS_CHECK_DPDK], [ [AC_MSG_RESULT([yes]) DPDKLIB_FOUND=true], [AC_MSG_RESULT([no]) - if test "$DPDK_AUTO_DISCOVER" = "true"; then - AC_MSG_ERROR(m4_normalize([ - Could not find DPDK library in default search path, update - PKG_CONFIG_PATH for pkg-config to find the .pc file in - non-standard location])) - else - AC_MSG_ERROR([Could not find DPDK libraries in $DPDK_LIB_DIR]) - fi + AC_MSG_ERROR(m4_normalize([ + Could not find DPDK library in default search path, update + PKG_CONFIG_PATH for pkg-config to find the .pc file in + non-standard location])) ]) CFLAGS="$ovs_save_CFLAGS" LDFLAGS="$ovs_save_LDFLAGS" - if test "$DPDK_AUTO_DISCOVER" = "false"; then - OVS_LDFLAGS="$OVS_LDFLAGS -L$DPDK_LIB_DIR" - fi OVS_CFLAGS="$OVS_CFLAGS $DPDK_INCLUDE" OVS_ENABLE_OPTION([-mssse3]) @@ -458,18 +429,14 @@ AC_DEFUN([OVS_CHECK_DPDK], [ # This happens because the rest of the DPDK code doesn't use any symbol in # the pmd driver objects, and the drivers register themselves using an # __attribute__((constructor)) function. - # - # These options are specified inside a single -Wl directive to prevent - # autotools from reordering them. - # - # OTOH newer versions of dpdk pkg-config (generated with Meson) - # will already have flagged just the right set of libs with - # --whole-archive - in those cases do not wrap it once more. - if [[ "$pkg_failed" != "no" ]];then - DPDK_vswitchd_LDFLAGS=-Wl,--whole-archive,$DPDK_LIB,--no-whole-archive - else - DPDK_vswitchd_LDFLAGS=`python3 ${srcdir}/python/build/pkgcfg.py $DPDK_LIB` - fi + + # Wrap the DPDK libraries inside a single -Wl directive + # after comma separation to prevent autotools from reordering them. + DPDK_vswitchd_LDFLAGS=$(echo "$DPDK_LIB"| tr -s ' ' ',' | \ + sed 's/-Wl,//g' | sed 's/,/ -Wl,/') + # Replace -pthread with -lpthread for LD and remove the last extra comma. + DPDK_vswitchd_LDFLAGS=$(echo "$DPDK_vswitchd_LDFLAGS"| sed 's/,$//' | \ + sed 's/-pthread/-lpthread/g') AC_SUBST([DPDK_vswitchd_LDFLAGS]) AC_DEFINE([DPDK_NETDEV], [1], [System uses the DPDK module.]) diff --git a/python/automake.mk b/python/automake.mk index 69d9800f9..2f08c7701 100644 --- a/python/automake.mk +++ b/python/automake.mk @@ -47,8 +47,7 @@ ovs_pyfiles = \ EXTRA_DIST += \ python/build/__init__.py \ python/build/nroff.py \ - python/build/soutil.py \ - python/build/pkgcfg.py + python/build/soutil.py # PyPI support. EXTRA_DIST += \ diff --git a/python/build/pkgcfg.py b/python/build/pkgcfg.py deleted file mode 100644 index 7cee3cb03..000000000 --- a/python/build/pkgcfg.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2020 Intel, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License") -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at: -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# Distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# Limitations under the License. - -# The purpose of this script is to parse the libraries -# From pkg-config in case of DPDK Meson builds. - -import sys -def parse_pkg_cfg_libs(arg): - linker_prefix = "-Wl," - # Libtool expects libraries to be comma separated - # And -Wl must appear only once. - final_string = ','.join(map(str.strip,arg[1:])).replace('-Wl,','') - final_string = arg[0]+" "+linker_prefix+final_string - # Ld only understands -lpthread. - final_string = final_string.replace('-pthread','-lpthread') - return final_string - -if __name__ == "__main__": - print(parse_pkg_cfg_libs(sys.argv[1:]))