From patchwork Thu Dec 7 14:00:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 120976 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp8392034qgn; Thu, 7 Dec 2017 06:01:44 -0800 (PST) X-Google-Smtp-Source: AGs4zMZqi59GAlUJpmz5oPrcVDd/vlE5Yk4aOt9iToyuvNPXKsVX2LStI99XJZcYa86i35IlHPq9 X-Received: by 10.237.56.197 with SMTP id k63mr9373788qte.308.1512655303775; Thu, 07 Dec 2017 06:01:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512655303; cv=none; d=google.com; s=arc-20160816; b=n0ESKAlDbuIt6Lz5dn/d80v3SMo48e2SY1cL40qlJHwQU4x7MQjBoYdcuamdxicH/+ sx0vr2U5IZ3HwRUBzs+fyw71Enx8cAxI7XfnN1FyHLX9ARuWePLyUoOMP3EcyejxAX7C CIRuPGY3HHMWfZh/ngzwYFSlGWnfx50jSeuAPMsZHI1Tj5MII0+jpTUEZyiBd4SBdzdW Ampq4sY/y7tJeX6iCU6Sz3X054WUXlQAKKEcXm6d3qhcWulUDPzmnCY7mU3Etrz5/Fnr QKWOkeIEitRBHyJt2W0TLITa8LSyrU97Llmqwez5h/9nZqAD4roRMEl5tpBMpVXW9pZg hPhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=nzesBCtkiGqjhlkWmkZXGqhKCQdGUOe0ZNPfap2j1RI=; b=aPQa2D+LFbdthC4cifrSKWEUO23mgNdwkJS8nqmVfAc5ROS+k/kKR3aUsZVXTyxXol BN42CfRVXtQDxeB4yoyfIoe0rODb/YM+GLtC28cIc5diMWILSnmBZUKnUIOAE90oGHzh 3cee2BF6Qdaai6BSBFqehdFcQCuH37ftYcLXWgWL6LQsqztRfWLIb8SyyWxrMbNJqAJY IIVKtZZBng7IFMFbLDgoxb/fKnC9vmxJsm4yStaxWn6+wXPOC8xHnm+FmMqW9SG0+d3x 6zh+eBGu4qX43Tq756dzGQyO31fssyxaC/bJjCiEZCWnv4qVRHKmHjGxYLSYxwXpi1j7 CYzg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id n86si3461qkl.82.2017.12.07.06.01.42; Thu, 07 Dec 2017 06:01:43 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id A9CCC609A1; Thu, 7 Dec 2017 14:01:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id D219D6091D; Thu, 7 Dec 2017 14:00:36 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 24E2F60927; Thu, 7 Dec 2017 14:00:23 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id E1DC56064A for ; Thu, 7 Dec 2017 14:00:15 +0000 (UTC) Received: from mxback1g.mail.yandex.net (mxback1g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:162]) by forward106p.mail.yandex.net (Yandex) with ESMTP id E659D2D82A1C for ; Thu, 7 Dec 2017 17:00:13 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback1g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id DmKMGqVJ7x-0Ds8oDm5; Thu, 07 Dec 2017 17:00:13 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id N0uwl7gRuJ-0DhCGvQ9; Thu, 07 Dec 2017 17:00:13 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Thu, 7 Dec 2017 17:00:07 +0300 Message-Id: <1512655212-29682-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1512655212-29682-1-git-send-email-odpbot@yandex.ru> References: <1512655212-29682-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 321 Subject: [lng-odp] [PATCH v3 1/6] configure: separate common DPDK check to odp_dpdk.m4 X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Dmitry Eremin-Solenikov Separate DPDK macros to top-level file so that they can be reused by other implementations (like ODP-DPDK). Signed-off-by: Dmitry Eremin-Solenikov --- /** Email created from pull request 321 (lumag:dpdk-system-master) ** https://github.com/Linaro/odp/pull/321 ** Patch: https://github.com/Linaro/odp/pull/321.patch ** Base sha: 811281a22b6274b7f41b926a9cfbe09e48a366bd ** Merge commit sha: 7aed25e962c1322b020ff261d9e5ee0ab3dda1a1 **/ m4/odp_dpdk.m4 | 49 +++++++++++++++++++++++++++++++++++ platform/linux-generic/m4/odp_dpdk.m4 | 35 +++++-------------------- 2 files changed, 56 insertions(+), 28 deletions(-) create mode 100644 m4/odp_dpdk.m4 diff --git a/m4/odp_dpdk.m4 b/m4/odp_dpdk.m4 new file mode 100644 index 000000000..636170a7f --- /dev/null +++ b/m4/odp_dpdk.m4 @@ -0,0 +1,49 @@ +# ODP_DPDK_PMDS(DPDK_DRIVER_PATH) +# ------------------------------- +# Build a list of DPDK PMD drivers in DPDK_PMDS variable +AC_DEFUN([ODP_DPDK_PMDS], [dnl +AS_VAR_SET([DPDK_PMDS], [-Wl,--whole-archive,]) +for filename in "$1"/librte_pmd_*.a; do +cur_driver=`basename "$filename" .a | sed -e 's/^lib//'` +# rte_pmd_nfp has external dependencies which break linking +if test "$cur_driver" = "rte_pmd_nfp"; then + echo "skip linking rte_pmd_nfp" +else + AS_VAR_APPEND([DPDK_PMDS], [-l$cur_driver,]) +fi +done +AS_VAR_APPEND([DPDK_PMDS], [--no-whole-archive]) +AC_SUBST([DPDK_PMDS]) +]) + +# ODP_DPDK_CHECK(CPPFLAGS, LDFLAGS, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) +# ----------------------------------------------------------------------- +# Check for DPDK availability +AC_DEFUN([ODP_DPDK_CHECK], [dnl +########################################################################## +# Save and set temporary compilation flags +########################################################################## +OLD_LDFLAGS=$LDFLAGS +OLD_LIBS=$LIBS +OLD_CPPFLAGS=$CPPFLAGS +LDFLAGS="$2 $LDFLAGS" +CPPFLAGS="$1 $CPPFLAGS" + +dpdk_check_ok=yes + +AC_CHECK_HEADERS([rte_config.h], [], + [dpdk_check_ok=no]) + +AC_CHECK_LIB([dpdk], [rte_eal_init], [], + [dpdk_check_ok=no], [-ldl -lpthread -lnuma]) +AS_IF([test "x$dpdk_check_ok" != "xno"], + [m4_default([$3], [:])], + [m4_default([$4], [:])]) + +########################################################################## +# Restore old saved variables +########################################################################## +LDFLAGS=$OLD_LDFLAGS +LIBS=$OLD_LIBS +CPPFLAGS=$OLD_CPPFLAGS +]) diff --git a/platform/linux-generic/m4/odp_dpdk.m4 b/platform/linux-generic/m4/odp_dpdk.m4 index 1e8fa2de9..ba0fdc935 100644 --- a/platform/linux-generic/m4/odp_dpdk.m4 +++ b/platform/linux-generic/m4/odp_dpdk.m4 @@ -3,9 +3,10 @@ ########################################################################## pktio_dpdk_support=no AC_ARG_WITH([dpdk-path], -AS_HELP_STRING([--with-dpdk-path=DIR path to dpdk build directory]), +[AS_HELP_STRING([--with-dpdk-path=DIR], [path to dpdk build directory])], [DPDK_PATH="$withval" DPDK_CPPFLAGS="-msse4.2 -isystem $DPDK_PATH/include" + DPDK_LDFLAGS="-L$DPDK_PATH/lib" pktio_dpdk_support=yes],[]) ########################################################################## @@ -13,17 +14,11 @@ AS_HELP_STRING([--with-dpdk-path=DIR path to dpdk build directory]), ########################################################################## zero_copy=0 AC_ARG_ENABLE([dpdk-zero-copy], - [ --enable-dpdk-zero-copy enable experimental zero-copy DPDK pktio mode], + [AS_HELP_STRING([--enable-dpdk-zero-copy], [enable experimental zero-copy DPDK pktio mode])], [if test x$enableval = xyes; then zero_copy=1 fi]) -########################################################################## -# Save and set temporary compilation flags -########################################################################## -OLD_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$DPDK_CPPFLAGS $CPPFLAGS" - ########################################################################## # Check for DPDK availability # @@ -32,37 +27,21 @@ CPPFLAGS="$DPDK_CPPFLAGS $CPPFLAGS" ########################################################################## if test x$pktio_dpdk_support = xyes then - AC_CHECK_HEADERS([rte_config.h], [], - [AC_MSG_FAILURE(["can't find DPDK header"])]) + ODP_DPDK_CHECK([$DPDK_CPPFLAGS], [$DPDK_LDFLAGS], [], + [AC_MSG_FAILURE([can't find DPDK])]) - AS_VAR_SET([DPDK_PMDS], [-Wl,--whole-archive,]) - for filename in "$DPDK_PATH"/lib/librte_pmd_*.a; do - cur_driver=`basename "$filename" .a | sed -e 's/^lib//'` - # rte_pmd_nfp has external dependencies which break linking - if test "$cur_driver" = "rte_pmd_nfp"; then - echo "skip linking rte_pmd_nfp" - else - AS_VAR_APPEND([DPDK_PMDS], [-l$cur_driver,]) - fi - done - AS_VAR_APPEND([DPDK_PMDS], [--no-whole-archive]) + ODP_DPDK_PMDS([$DPDK_PATH/lib]) AC_DEFINE([ODP_PKTIO_DPDK], [1], [Define to 1 to enable DPDK packet I/O support]) AC_DEFINE_UNQUOTED([ODP_DPDK_ZERO_COPY], [$zero_copy], [Define to 1 to enable DPDK zero copy support]) - DPDK_LIBS="-L$DPDK_PATH/lib -ldpdk -lpthread -ldl -lpcap -lm -lnuma" + DPDK_LIBS="$DPDK_LDFLAGS -ldpdk -lpthread -ldl -lpcap -lm -lnuma" AC_SUBST([DPDK_CPPFLAGS]) AC_SUBST([DPDK_LIBS]) - AC_SUBST([DPDK_PMDS]) else pktio_dpdk_support=no fi -########################################################################## -# Restore old saved variables -########################################################################## -CPPFLAGS=$OLD_CPPFLAGS - AM_CONDITIONAL([PKTIO_DPDK], [test x$pktio_dpdk_support = xyes ])