From patchwork Thu Aug 17 06:00:04 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: 110299 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1752534qge; Wed, 16 Aug 2017 23:05:32 -0700 (PDT) X-Received: by 10.55.22.169 with SMTP id 41mr5664167qkw.131.1502949932703; Wed, 16 Aug 2017 23:05:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502949932; cv=none; d=google.com; s=arc-20160816; b=h8hSQte/CtAFmK3JwJshzIavMorZQ2LazSR+nXIQlaT42764Sf7Dgak0+ZXBdqTSvq WnaKrCmxZH5uK0SzdayxNH6oZgWFAHQEhMx+kNBGHeVsk3/YOBKPAjvpnIJyOoP8BWvH zmYThxg5ojwR7/Hem1XTGiM0AYY+htnIIg11oooVwnAsuqu36aqqj6+SAKFtrXkqlJ7w XmdtrqkFRg8p0jMSW2pLB1uk/T4GFalHSYnoY49rBMLhReBTWuoO7T9hLg60OcfDKYME NCUMfpoJ9oYU7HkIQv7IwhM6tduX5uHkCb+rL85YnJ0STK7HcrxFMqNC0uP25m6Oqait gU+Q== 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=MbzhZgPr1gUc1Q4z5e8KDBrWJVT3wZzEtTmQqeNtsdo=; b=U9uoH3pNkBSQZKrDyleFv+60BLF5wuxJ0YPXxUNY48XJ8Sq7WCUMEyMDwbMKWyT3n1 jKMOqh2PzBCc25Yx/r54cdSHZfBvIPi+IWpv3A3bH0Q+JMTTcQGcnOcAzL6jn/0/n+BG 9NCryHqkAZJAQKeLKinnyAOpDPrUX1qgV2N7egVX7mJB9JP3q+hCeR9roSSsSw/4suv5 p18uW20SZaVPMqLdx8fpj1ZodxU7fxj7nDsHqh1ldP7mVIqRxQDyTWrQyCijtXZnHQZJ pZ9Wsf/L719yFM6iRaomesyxR8L9Nj3Yhs0YvGWSkkYCVc6o6L4ec0qySRHC2+gkpJ6d BMwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id u40si2480436qtc.128.2017.08.16.23.05.32; Wed, 16 Aug 2017 23:05:32 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 627B2644B1; Thu, 17 Aug 2017 06:05:32 +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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, 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 1929D65BCC; Thu, 17 Aug 2017 06:01:27 +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 3FD6860D2C; Thu, 17 Aug 2017 06:00:49 +0000 (UTC) Received: from forward104o.mail.yandex.net (forward104o.mail.yandex.net [37.140.190.179]) by lists.linaro.org (Postfix) with ESMTPS id 15C6760D78 for ; Thu, 17 Aug 2017 06:00:37 +0000 (UTC) Received: from mxback5o.mail.yandex.net (mxback5o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1f]) by forward104o.mail.yandex.net (Yandex) with ESMTP id 4DC222C845D8 for ; Thu, 17 Aug 2017 09:00:34 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback5o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id jyCEjZVOLW-0YAidNQw; Thu, 17 Aug 2017 09:00:34 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 3ZgkfM7k2j-0XAmlPNm; Thu, 17 Aug 2017 09:00:33 +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, 17 Aug 2017 09:00:04 +0300 Message-Id: <1502949606-11291-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502949606-11291-1-git-send-email-odpbot@yandex.ru> References: <1502949606-11291-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 128 Subject: [lng-odp] [PATCH CLOUD-DEV v11 1/3] configure: Enable linux-dpdk 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: Balakrishna Garapati Signed-off-by: Balakrishna Garapati --- /** Email created from pull request 128 (GBalakrishna:linux-dpdk-cloud) ** https://github.com/Linaro/odp/pull/128 ** Patch: https://github.com/Linaro/odp/pull/128.patch ** Base sha: 4e11ef454d383b9637541c53ad4eeda65751742b ** Merge commit sha: c8d95371d8b2c91052a43ca28a3dc3678ec82c0e **/ configure.ac | 41 ++++++++++++++----------- example/Makefile.inc | 2 +- helper/test/Makefile.am | 2 +- platform/Makefile.inc | 1 - platform/linux-dpdk/Makefile.am | 45 +++++++++++++++++++++++----- platform/linux-generic/Makefile.am | 2 ++ test/Makefile.inc | 2 +- test/common_plat/validation/Makefile.inc | 2 +- test/common_plat/validation/api/Makefile.inc | 2 +- 9 files changed, 69 insertions(+), 30 deletions(-) diff --git a/configure.ac b/configure.ac index d9e4a34f..77506dce 100644 --- a/configure.ac +++ b/configure.ac @@ -111,6 +111,7 @@ AS_CASE([$host], [ARCH_DIR=undefined] ) AC_SUBST([ARCH_DIR]) +AM_CONDITIONAL([ARCH_X86], [test "x${ARCH_DIR}" = "xx86"]) ########################################################################## # Warn on the defaults if arch is undefined @@ -161,22 +162,6 @@ AC_SUBST([with_platform]) AC_SUBST([platform_with_platform], ["platform/${with_platform}"]) ########################################################################## -# Run platform specific checks and settings -########################################################################## -IMPLEMENTATION_NAME="" -if test "${with_platform}" = "linux-generic"; -then - m4_include([./platform/linux-generic/m4/configure.m4]) - m4_include([./test/linux-generic/m4/configure.m4]) - IMPLEMENTATION_NAME="odp-linux" -else - echo "UNSUPPORTED PLATFORM: ${with_platform}" - exit 1 -fi - -ODP_CFLAGS="$ODP_CFLAGS -DIMPLEMENTATION_NAME=$IMPLEMENTATION_NAME" - -########################################################################## # Include m4 files ########################################################################## m4_include([./doc/m4/configure.m4]) @@ -195,6 +180,27 @@ AC_HELP_STRING([--with-sdk-install-path=DIR path to external libs and headers], AC_SUBST(SDK_INSTALL_PATH) ########################################################################## +# Run platform specific checks and settings +########################################################################## +IMPLEMENTATION_NAME="" +AS_IF([test "${with_platform}" == "linux-generic"], + [m4_include([./platform/linux-generic/m4/configure.m4])] + [m4_include([./test/linux-generic/m4/configure.m4])] + [IMPLEMENTATION_NAME="linux-generic"] + [ODP_CFLAGS="$ODP_CFLAGS -std=c99"] + [ODP_LIB_STR="odp-linux"], + [test "${with_platform}" == "linux-dpdk"], + [m4_include([./platform/linux-dpdk/m4/configure.m4])] + [m4_include([./test/linux-dpdk/m4/configure.m4])] + [IMPLEMENTATION_NAME="linux-dpdk"] + [ODP_CFLAGS="$ODP_CFLAGS -std=gnu99"] + [ODP_LIB_STR="odp-dpdk"], + [echo "UNSUPPORTED PLATFORM: ${with_platform}"]) + +ODP_CFLAGS="$ODP_CFLAGS -DIMPLEMENTATION_NAME=$IMPLEMENTATION_NAME" +AC_SUBST(ODP_LIB_STR) + +########################################################################## # Set the install directory for test binaries/scripts ########################################################################## AC_ARG_WITH([testdir], @@ -210,6 +216,7 @@ AC_SUBST([testdir]) # Set conditionals as computed within platform specific files ########################################################################## AM_CONDITIONAL([SDK_INSTALL_PATH_], [test "x${SDK_INSTALL_PATH_}" = "x1"]) +AM_CONDITIONAL([DPDK_DEFAULT_DIR], [test "x${DPDK_DEFAULT_DIR}" = "x1"]) AM_CONDITIONAL([test_installdir], [test "$testdir" != ""]) AM_CONDITIONAL([cunit_support], [test x$cunit_support = xyes ]) AM_CONDITIONAL([test_vald], [test x$test_vald = xyes ]) @@ -314,7 +321,6 @@ ODP_CFLAGS="$ODP_CFLAGS -W -Wall -Werror -Wstrict-prototypes -Wmissing-prototype ODP_CFLAGS="$ODP_CFLAGS -Wmissing-declarations -Wold-style-definition -Wpointer-arith" ODP_CFLAGS="$ODP_CFLAGS -Wcast-align -Wnested-externs -Wcast-qual -Wformat-nonliteral" ODP_CFLAGS="$ODP_CFLAGS -Wformat-security -Wundef -Wwrite-strings" -ODP_CFLAGS="$ODP_CFLAGS -std=c99" dnl Use -Werror in the checks below since Clang emits a warning instead of dnl an error when it encounters an unknown warning option. @@ -359,6 +365,7 @@ AM_CXXFLAGS="-std=c++11" AC_CONFIG_FILES([Makefile pkgconfig/libodp-linux.pc + pkgconfig/libodp-dpdk.pc pkgconfig/libodphelper.pc ]) diff --git a/example/Makefile.inc b/example/Makefile.inc index c6d7ff5f..88d34d33 100644 --- a/example/Makefile.inc +++ b/example/Makefile.inc @@ -1,6 +1,6 @@ include $(top_srcdir)/platform/@with_platform@/Makefile.inc LIB = $(top_builddir)/lib -LDADD = $(LIB)/libodp-linux.la $(LIB)/libodphelper.la $(DPDK_PMDS) +LDADD = $(LIB)/lib$(ODP_LIB_STR).la $(LIB)/libodphelper.la $(DPDK_PMDS) AM_CFLAGS += \ -I$(srcdir) \ -I$(top_srcdir)/example \ diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am index beef9191..d772ae14 100644 --- a/helper/test/Makefile.am +++ b/helper/test/Makefile.am @@ -5,7 +5,7 @@ LIB = $(top_builddir)/lib #in the following line, the libs using the symbols should come before #the libs containing them! The includer is given a chance to add things #before libodp by setting PRE_LDADD before the inclusion. -LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/libodp-linux.la +LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/lib$(ODP_LIB_STR).la INCFLAGS = \ -I$(top_builddir)/platform/@with_platform@/include \ diff --git a/platform/Makefile.inc b/platform/Makefile.inc index b35b5760..1621d980 100644 --- a/platform/Makefile.inc +++ b/platform/Makefile.inc @@ -6,7 +6,6 @@ pkgconfig_DATA = $(top_builddir)/pkgconfig/libodp-linux.pc .PHONY: pkgconfig/libodp-linux.pc VPATH = $(srcdir) $(builddir) -lib_LTLIBRARIES = $(LIB)/libodp-linux.la AM_LDFLAGS += -version-number '$(ODP_LIBSO_VERSION)' diff --git a/platform/linux-dpdk/Makefile.am b/platform/linux-dpdk/Makefile.am index c1497f0f..e56dc165 100644 --- a/platform/linux-dpdk/Makefile.am +++ b/platform/linux-dpdk/Makefile.am @@ -1,6 +1,8 @@ include $(top_srcdir)/platform/Makefile.inc include $(top_srcdir)/platform/@with_platform@/Makefile.inc +lib_LTLIBRARIES = $(LIB)/libodp-dpdk.la + PLAT_CFLAGS = if ARCH_X86 PLAT_CFLAGS += -msse4.2 @@ -72,8 +74,20 @@ odpapiinclude_HEADERS = \ $(srcdir)/include/odp/api/time.h \ $(srcdir)/include/odp/api/timer.h \ $(srcdir)/include/odp/api/traffic_mngr.h \ - $(srcdir)/include/odp/api/version.h \ - $(srcdir)/arch/@ARCH_DIR@/odp/api/cpu_arch.h + $(srcdir)/include/odp/api/version.h + +if ARCH_IS_ARM +odpapiinclude_HEADERS += $(srcdir)/arch/arm/odp/api/cpu_arch.h +endif +if ARCH_IS_MIPS64 +odpapiinclude_HEADERS += $(srcdir)/arch/mips64/odp/api/cpu_arch.h +endif +if ARCH_IS_POWERPC +odpapiinclude_HEADERS += $(srcdir)/arch/powerpc/odp/api/cpu_arch.h +endif +if ARCH_IS_X86 +odpapiinclude_HEADERS += $(srcdir)/arch/x86/odp/api/cpu_arch.h +endif odpapiplatincludedir= $(includedir)/odp/api/plat odpapiplatinclude_HEADERS = \ @@ -215,15 +229,32 @@ __LIB__libodp_dpdk_la_SOURCES = \ ../linux-generic/odp_traffic_mngr.c \ ../linux-generic/odp_version.c \ ../linux-generic/odp_weak.c \ - arch/@ARCH_DIR@/odp_cpu_arch.c \ - arch/@ARCH_DIR@/odp_sysinfo_parse.c - -__LIB__libodp_dpdk_la_LIBADD = $(ATOMIC_LIBS) + ../linux-generic/drv_atomic.c \ + ../linux-generic/drv_barrier.c \ + ../linux-generic/drv_driver.c \ + ../linux-generic/drv_shm.c \ + ../linux-generic/drv_spinlock.c +if ARCH_IS_ARM +__LIB__libodp_dpdk_la_SOURCES += arch/arm/odp_cpu_arch.c \ + arch/arm/odp_sysinfo_parse.c +endif +if ARCH_IS_MIPS64 +__LIB__libodp_dpdk_la_SOURCES += arch/mips64/odp_cpu_arch.c \ + arch/mips64/odp_sysinfo_parse.c +endif +if ARCH_IS_POWERPC +__LIB__libodp_dpdk_la_SOURCES += arch/powerpc/odp_cpu_arch.c \ + arch/powerpc/odp_sysinfo_parse.c +endif if ARCH_IS_X86 -__LIB__libodp_dpdk_la_SOURCES += arch/@ARCH_DIR@/cpu_flags.c +__LIB__libodp_dpdk_la_SOURCES += arch/x86/cpu_flags.c \ + arch/x86/odp_cpu_arch.c \ + arch/x86/odp_sysinfo_parse.c endif +__LIB__libodp_dpdk_la_LIBADD = $(ATOMIC_LIBS) + # Create symlink for ABI header files. Application does not need to use the arch # specific include path for installed files. install-data-hook: diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 1d703cea..be7674a5 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -4,6 +4,8 @@ include $(top_srcdir)/platform/Makefile.inc include $(top_srcdir)/platform/@with_platform@/Makefile.inc +lib_LTLIBRARIES = $(LIB)/libodp-linux.la + AM_CFLAGS += -I$(srcdir)/include AM_CFLAGS += -I$(top_srcdir)/include AM_CFLAGS += -I$(top_srcdir)/frameworks/modular diff --git a/test/Makefile.inc b/test/Makefile.inc index 839bd033..c22bdd61 100644 --- a/test/Makefile.inc +++ b/test/Makefile.inc @@ -4,7 +4,7 @@ LIB = $(top_builddir)/lib #in the following line, the libs using the symbols should come before #the libs containing them! The includer is given a chance to add things #before libodp by setting PRE_LDADD before the inclusion. -LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/libodp-linux.la $(DPDK_PMDS) +LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/lib$(ODP_LIB_STR).la $(DPDK_PMDS) INCFLAGS = \ -I$(top_builddir)/platform/@with_platform@/include \ diff --git a/test/common_plat/validation/Makefile.inc b/test/common_plat/validation/Makefile.inc index dda18adc..5512cc0e 100644 --- a/test/common_plat/validation/Makefile.inc +++ b/test/common_plat/validation/Makefile.inc @@ -13,4 +13,4 @@ AM_LDFLAGS += -static LIBCUNIT_COMMON = $(COMMON_DIR)/libcunit_common.la LIBCPUMASK_COMMON = $(COMMON_DIR)/libcpumask_common.la LIBTHRMASK_COMMON = $(COMMON_DIR)/libthrmask_common.la -LIBODP = $(LIB)/libodphelper.la $(LIB)/libodp-linux.la +LIBODP = $(LIB)/libodphelper.la $(LIB)/lib$(ODP_LIB_STR).la diff --git a/test/common_plat/validation/api/Makefile.inc b/test/common_plat/validation/api/Makefile.inc index 177d2ac3..1c5d316a 100644 --- a/test/common_plat/validation/api/Makefile.inc +++ b/test/common_plat/validation/api/Makefile.inc @@ -16,4 +16,4 @@ AM_CPPFLAGS += $(CUNIT_CPPFLAGS) LIBCUNIT_COMMON = $(COMMON_DIR)/libcunit_common.la LIBCPUMASK_COMMON = $(COMMON_DIR)/libcpumask_common.la LIBTHRMASK_COMMON = $(COMMON_DIR)/libthrmask_common.la -LIBODP = $(LIB)/libodphelper.la $(LIB)/libodp-linux.la +LIBODP = $(LIB)/libodphelper.la $(LIB)/lib$(ODP_LIB_STR).la From patchwork Thu Aug 17 06:00:05 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: 110297 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1748874qge; Wed, 16 Aug 2017 23:01:59 -0700 (PDT) X-Received: by 10.55.189.132 with SMTP id n126mr5691335qkf.89.1502949719099; Wed, 16 Aug 2017 23:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502949719; cv=none; d=google.com; s=arc-20160816; b=bDUWu6UPO+yqCp/TBb0vUpjXDAvfVa/zK+5fhC/hUEkwnNHrdXh11h8lHGv/smX5Yj 3bmUZga+BHrNaGyKMSvx3lIWeJ+nM1PO3y6wzivG9z50hMZyRfZTec/0cI6M0gk2Kx2o LHincR32YNwNEyRihgCDr4rSmZDiT3hACqgQcnuCF7rEYMTgVj+kOcuqvyZrO/+4zJHW jnbCDM19X8sqa6u/PbwNukwQ4b8Bk0Hsu29GNPEe9/D/QMv2ow00EtIlFfa6mwpzZxSk F4CYsmtsqLPBSRbICk6ErNaSo3YwJixzz1JazgpczKT8cgmXtm0dGiiR+ZeJ5mBfyuEA oUuA== 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=DxsKqu6CUud+guC6IbsI0L7wBQ836ADSMw0AZgpukP0=; b=jtMkCKxslewl8ZXzxA2f6WOHzeGIp5bcy9S71+vBaoE1WQbQiZj0p8c6e7PbBcF+MH 81MmbT4/o9ou+A8EWtpO1/rIbxN48ZPDxydkTMovL1pIpSBSGAGm0NhxCMb4GP37GWUq Hxlqy+Ru5hXVr4BMBgeyPhzoCmjEl0OiPJtWqixeAo81zfvRW6zn/Z66ENLBs+6poPKU DZHMGlPfRmWcuzAPxWRpbv6HZilc7Uap/d8bEeHMcW89Lc1sY0J7ZTEJ1YG7sFZbE+pW 8llmgZO7q9wIL0FXFRvuRsA0f9Hkz8uT5BTTND1UY22GVpjd0TGu04E+h6g39C5/mjPY 2sQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id g74si2450522qkh.256.2017.08.16.23.01.58; Wed, 16 Aug 2017 23:01:59 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 B780765BD1; Thu, 17 Aug 2017 06:01:58 +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=-0.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, URIBL_BLOCKED, URIBL_SBL, URIBL_SBL_A 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 0CCB261C9E; Thu, 17 Aug 2017 06:01:09 +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 7D2E862C62; Thu, 17 Aug 2017 06:00:46 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id E2FD960D2C for ; Thu, 17 Aug 2017 06:00:36 +0000 (UTC) Received: from mxback5g.mail.yandex.net (mxback5g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:166]) by forward100j.mail.yandex.net (Yandex) with ESMTP id 62BFC5D84F0A for ; Thu, 17 Aug 2017 09:00:35 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback5g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id p1o7vaTIC7-0Zoaiad7; Thu, 17 Aug 2017 09:00:35 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 3ZgkfM7k2j-0YAexcc6; Thu, 17 Aug 2017 09:00:34 +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, 17 Aug 2017 09:00:05 +0300 Message-Id: <1502949606-11291-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502949606-11291-1-git-send-email-odpbot@yandex.ru> References: <1502949606-11291-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 128 Subject: [lng-odp] [PATCH CLOUD-DEV v11 2/3] linux-dpdk: Sync with cloud-dev/api-next updates 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: Balakrishna Garapati Signed-off-by: Balakrishna Garapati --- /** Email created from pull request 128 (GBalakrishna:linux-dpdk-cloud) ** https://github.com/Linaro/odp/pull/128 ** Patch: https://github.com/Linaro/odp/pull/128.patch ** Base sha: 4e11ef454d383b9637541c53ad4eeda65751742b ** Merge commit sha: c8d95371d8b2c91052a43ca28a3dc3678ec82c0e **/ configure.ac | 7 +- example/Makefile.inc | 2 +- example/ddf_app/Makefile.am | 2 +- helper/test/Makefile.am | 2 +- pkgconfig/libodp-dpdk.pc.in | 7 +- platform/linux-dpdk/Makefile.am | 58 ++- platform/linux-dpdk/include/odp/api/feature.h | 1 + platform/linux-dpdk/include/odp/api/ipsec.h | 1 + .../linux-dpdk/include/odp/api/plat/event_types.h | 7 + .../linux-dpdk/include/odp/api/plat/ipsec_types.h | 1 + .../linux-dpdk/include/odp/api/plat/timer_types.h | 1 - platform/linux-dpdk/include/odp/api/support.h | 1 + platform/linux-dpdk/include/odp_buffer_inlines.h | 10 + platform/linux-dpdk/include/odp_buffer_internal.h | 4 +- platform/linux-dpdk/include/odp_config_internal.h | 6 + platform/linux-dpdk/include/odp_packet_internal.h | 29 +- .../linux-dpdk/include/odp_packet_io_internal.h | 4 +- platform/linux-dpdk/m4/configure.m4 | 31 +- platform/linux-dpdk/m4/odp_modules.m4 | 1 + platform/linux-dpdk/m4/odp_schedule.m4 | 1 + platform/linux-dpdk/m4/odp_timer.m4 | 1 + platform/linux-dpdk/odp_crypto.c | 450 +++++++++++++-------- platform/linux-dpdk/odp_init.c | 141 ++++++- platform/linux-dpdk/odp_packet.c | 20 +- platform/linux-dpdk/odp_packet_dpdk.c | 2 +- platform/linux-dpdk/odp_pool.c | 1 + test/linux-dpdk/Makefile.inc | 2 + 27 files changed, 549 insertions(+), 244 deletions(-) create mode 120000 platform/linux-dpdk/include/odp/api/feature.h create mode 120000 platform/linux-dpdk/include/odp/api/ipsec.h create mode 120000 platform/linux-dpdk/include/odp/api/plat/ipsec_types.h create mode 120000 platform/linux-dpdk/include/odp/api/support.h create mode 120000 platform/linux-dpdk/m4/odp_modules.m4 create mode 120000 platform/linux-dpdk/m4/odp_schedule.m4 create mode 120000 platform/linux-dpdk/m4/odp_timer.m4 diff --git a/configure.ac b/configure.ac index 77506dce..bf2c2a25 100644 --- a/configure.ac +++ b/configure.ac @@ -111,7 +111,7 @@ AS_CASE([$host], [ARCH_DIR=undefined] ) AC_SUBST([ARCH_DIR]) -AM_CONDITIONAL([ARCH_X86], [test "x${ARCH_DIR}" = "xx86"]) +AM_CONDITIONAL([ARCH_IS_X86], [test "x${ARCH_DIR}" = "xx86"]) ########################################################################## # Warn on the defaults if arch is undefined @@ -183,13 +183,13 @@ AC_SUBST(SDK_INSTALL_PATH) # Run platform specific checks and settings ########################################################################## IMPLEMENTATION_NAME="" -AS_IF([test "${with_platform}" == "linux-generic"], +AS_IF([test "${with_platform}" = "linux-generic"], [m4_include([./platform/linux-generic/m4/configure.m4])] [m4_include([./test/linux-generic/m4/configure.m4])] [IMPLEMENTATION_NAME="linux-generic"] [ODP_CFLAGS="$ODP_CFLAGS -std=c99"] [ODP_LIB_STR="odp-linux"], - [test "${with_platform}" == "linux-dpdk"], + [test "${with_platform}" = "linux-dpdk"], [m4_include([./platform/linux-dpdk/m4/configure.m4])] [m4_include([./test/linux-dpdk/m4/configure.m4])] [IMPLEMENTATION_NAME="linux-dpdk"] @@ -232,7 +232,6 @@ AM_CONDITIONAL([helper_linux], [test x$helper_linux = xyes ]) AM_CONDITIONAL([ARCH_IS_ARM], [test "x${ARCH_DIR}" = "xarm"]) AM_CONDITIONAL([ARCH_IS_MIPS64], [test "x${ARCH_DIR}" = "xmips64"]) AM_CONDITIONAL([ARCH_IS_POWERPC], [test "x${ARCH_DIR}" = "xpowerpc"]) -AM_CONDITIONAL([ARCH_IS_X86], [test "x${ARCH_DIR}" = "xx86"]) ########################################################################## # Setup doxygen documentation diff --git a/example/Makefile.inc b/example/Makefile.inc index 88d34d33..55950918 100644 --- a/example/Makefile.inc +++ b/example/Makefile.inc @@ -1,6 +1,6 @@ include $(top_srcdir)/platform/@with_platform@/Makefile.inc LIB = $(top_builddir)/lib -LDADD = $(LIB)/lib$(ODP_LIB_STR).la $(LIB)/libodphelper.la $(DPDK_PMDS) +LDADD = $(LIB)/lib$(ODP_LIB_STR).la $(LIB)/libodphelper.la $(DPDK_PMDS) $(OPENSSL_LIBS) AM_CFLAGS += \ -I$(srcdir) \ -I$(top_srcdir)/example \ diff --git a/example/ddf_app/Makefile.am b/example/ddf_app/Makefile.am index 49f0170f..9b865ce0 100644 --- a/example/ddf_app/Makefile.am +++ b/example/ddf_app/Makefile.am @@ -1,7 +1,7 @@ include $(top_srcdir)/example/Makefile.inc bin_PROGRAMS = odp_ddf_app$(EXEEXT) -odp_ddf_app_LDFLAGS = $(AM_LDFLAGS) -static -Wl,--export-dynamic +odp_ddf_app_LDFLAGS = $(AM_LDFLAGS) $(DPDK_LIBS) -static -Wl,--export-dynamic odp_ddf_app_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example noinst_HEADERS = \ diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am index d772ae14..a679e197 100644 --- a/helper/test/Makefile.am +++ b/helper/test/Makefile.am @@ -5,7 +5,7 @@ LIB = $(top_builddir)/lib #in the following line, the libs using the symbols should come before #the libs containing them! The includer is given a chance to add things #before libodp by setting PRE_LDADD before the inclusion. -LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/lib$(ODP_LIB_STR).la +LDADD = $(PRE_LDADD) $(LIB)/libodphelper.la $(LIB)/lib$(ODP_LIB_STR).la $(DPDK_PMDS) INCFLAGS = \ -I$(top_builddir)/platform/@with_platform@/include \ diff --git a/pkgconfig/libodp-dpdk.pc.in b/pkgconfig/libodp-dpdk.pc.in index d3164a61..f22e832c 100644 --- a/pkgconfig/libodp-dpdk.pc.in +++ b/pkgconfig/libodp-dpdk.pc.in @@ -6,11 +6,6 @@ includedir=@includedir@ Name: libodp-dpdk Description: The ODP packet processing engine Version: @PKGCONFIG_VERSION@ -<<<<<<< HEAD:pkgconfig/libodp-linux.pc.in -Libs: -L${libdir} -lodp-linux @DPDK_LIBS@ +Libs: -L${libdir} -lodp-dpdk @DPDK_LIBS@ Libs.private: @OPENSSL_STATIC_LIBS@ @DPDK_PMDS@ @DPDK_LIBS@ @PCAP_LIBS@ @PTHREAD_LIBS@ @TIMER_LIBS@ -lpthread @ATOMIC_LIBS@ @LIBCONFIG_LIBS@ -======= -Libs: -L${libdir} -lodp-dpdk -Libs.private: @ATOMIC_LIBS@ ->>>>>>> odpdpdk/master:pkgconfig/libodp-dpdk.pc.in Cflags: -I${includedir} diff --git a/platform/linux-dpdk/Makefile.am b/platform/linux-dpdk/Makefile.am index e56dc165..3789da3d 100644 --- a/platform/linux-dpdk/Makefile.am +++ b/platform/linux-dpdk/Makefile.am @@ -4,7 +4,7 @@ include $(top_srcdir)/platform/@with_platform@/Makefile.inc lib_LTLIBRARIES = $(LIB)/libodp-dpdk.la PLAT_CFLAGS = -if ARCH_X86 +if ARCH_IS_X86 PLAT_CFLAGS += -msse4.2 endif @@ -21,10 +21,16 @@ AM_CFLAGS += -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ AM_CFLAGS += -I$(top_srcdir)/include AM_CFLAGS += -I$(top_builddir)/include AM_CFLAGS += -Iinclude +AM_CFLAGS += -DSYSCONFDIR=\"@sysconfdir@\" +AM_CFLAGS += -D_ODP_PKTIO_IPC + +AM_CPPFLAGS += $(OPENSSL_CPPFLAGS) +AM_CPPFLAGS += $(LIBCONFIG_CFLAGS) include_HEADERS = \ $(top_srcdir)/include/odp.h \ - $(top_srcdir)/include/odp_api.h + $(top_srcdir)/include/odp_api.h \ + $(top_srcdir)/include/odp_drv.h odpincludedir= $(includedir)/odp odpinclude_HEADERS = \ @@ -47,9 +53,11 @@ odpapiinclude_HEADERS = \ $(srcdir)/include/odp/api/deprecated.h \ $(srcdir)/include/odp/api/errno.h \ $(srcdir)/include/odp/api/event.h \ + $(srcdir)/include/odp/api/feature.h \ $(srcdir)/include/odp/api/hash.h \ $(srcdir)/include/odp/api/hints.h \ $(srcdir)/include/odp/api/init.h \ + $(srcdir)/include/odp/api/ipsec.h \ $(srcdir)/include/odp/api/packet_flags.h \ $(srcdir)/include/odp/api/packet.h \ $(srcdir)/include/odp/api/packet_io.h \ @@ -66,6 +74,7 @@ odpapiinclude_HEADERS = \ $(srcdir)/include/odp/api/spinlock_recursive.h \ $(srcdir)/include/odp/api/std_clib.h \ $(srcdir)/include/odp/api/std_types.h \ + $(srcdir)/include/odp/api/support.h \ $(srcdir)/include/odp/api/sync.h \ $(srcdir)/include/odp/api/system_info.h \ $(srcdir)/include/odp/api/thread.h \ @@ -103,6 +112,7 @@ odpapiplatinclude_HEADERS = \ $(srcdir)/include/odp/api/plat/crypto_types.h \ $(srcdir)/include/odp/api/plat/event_types.h \ $(srcdir)/include/odp/api/plat/init_types.h \ + $(srcdir)/include/odp/api/plat/ipsec_types.h \ $(srcdir)/include/odp/api/plat/packet_flag_inlines.h \ $(srcdir)/include/odp/api/plat/packet_flag_inlines_api.h \ $(srcdir)/include/odp/api/plat/packet_inlines.h \ @@ -132,12 +142,36 @@ odpapiplatinclude_HEADERS = \ odpdrvincludedir = $(includedir)/odp/drv odpdrvinclude_HEADERS = \ - $(srcdir)/include/odp/drv/compiler.h + $(srcdir)/include/odp/drv/align.h \ + $(srcdir)/include/odp/drv/atomic.h \ + $(srcdir)/include/odp/drv/barrier.h \ + $(srcdir)/include/odp/drv/byteorder.h \ + $(srcdir)/include/odp/drv/compiler.h \ + $(srcdir)/include/odp/drv/driver.h \ + $(srcdir)/include/odp/drv/hints.h \ + $(srcdir)/include/odp/drv/shm.h \ + $(srcdir)/include/odp/drv/spinlock.h \ + $(srcdir)/include/odp/drv/std_types.h \ + $(srcdir)/include/odp/drv/sync.h + +odpdrvplatincludedir = $(includedir)/odp/drv/plat +odpdrvplatinclude_HEADERS = \ + $(srcdir)/include/odp/drv/plat/atomic_types.h \ + $(srcdir)/include/odp/drv/plat/barrier_types.h \ + $(srcdir)/include/odp/drv/plat/byteorder_types.h \ + $(srcdir)/include/odp/drv/compiler.h \ + $(srcdir)/include/odp/drv/plat/driver_types.h \ + $(srcdir)/include/odp/drv/plat/shm_types.h \ + $(srcdir)/include/odp/drv/plat/spinlock_types.h \ + $(srcdir)/include/odp/drv/plat/strong_types.h + noinst_HEADERS = \ ${top_srcdir}/platform/linux-generic/include/_fdserver_internal.h \ ${top_srcdir}/platform/linux-generic/include/_ishm_internal.h \ ${top_srcdir}/platform/linux-generic/include/_ishmphy_internal.h \ + ${top_srcdir}/platform/linux-generic/include/_ishmpool_internal.h \ + ${top_srcdir}/platform/linux-generic/include/drv_driver_internal.h\ ${top_srcdir}/platform/linux-generic/include/odp_align_internal.h \ ${top_srcdir}/platform/linux-generic/include/odp_atomic_internal.h \ ${srcdir}/include/odp_buffer_inlines.h \ @@ -158,13 +192,13 @@ noinst_HEADERS = \ ${srcdir}/include/odp_packet_io_internal.h \ ${srcdir}/include/odp_errno_define.h \ ${top_srcdir}/platform/linux-generic/include/odp_packet_io_ipc_internal.h \ - ${top_srcdir}/platform/linux-generic/include/odp_packet_io_queue.h \ ${top_srcdir}/platform/linux-generic/include/odp_packet_io_ring_internal.h \ ${top_srcdir}/platform/linux-generic/include/odp_packet_socket.h \ ${top_srcdir}/platform/linux-generic/include/odp_pkt_queue_internal.h \ ${srcdir}/include/odp_pool_internal.h \ ${srcdir}/include/odp_posix_extensions.h \ ${top_srcdir}/platform/linux-generic/include/odp_queue_internal.h \ + ${top_srcdir}/platform/linux-generic/include/odp_queue_if.h \ ${top_srcdir}/platform/linux-generic/include/odp_ring_internal.h \ ${top_srcdir}/platform/linux-generic/include/odp_schedule_if.h \ ${top_srcdir}/platform/linux-generic/include/odp_sorted_list_internal.h \ @@ -184,6 +218,8 @@ __LIB__libodp_dpdk_la_SOURCES = \ ../linux-generic/_fdserver.c \ ../linux-generic/_ishm.c \ ../linux-generic/_ishmphy.c \ + ../linux-generic/_ishmpool.c \ + ../linux-generic/_modules.c \ ../linux-generic/odp_atomic.c \ ../linux-generic/odp_barrier.c \ ../linux-generic/odp_bitmap.c \ @@ -199,6 +235,7 @@ __LIB__libodp_dpdk_la_SOURCES = \ ../linux-generic/odp_hash.c \ odp_init.c \ ../linux-generic/odp_impl.c \ + ../linux-generic/odp_ipsec.c \ ../linux-generic/odp_name_table.c \ odp_packet.c \ odp_packet_dpdk.c \ @@ -208,6 +245,7 @@ __LIB__libodp_dpdk_la_SOURCES = \ ../linux-generic/odp_pkt_queue.c \ odp_pool.c \ ../linux-generic/odp_queue.c \ + ../linux-generic/odp_queue_if.c \ ../linux-generic/odp_rwlock.c \ ../linux-generic/odp_rwlock_recursive.c \ ../linux-generic/odp_schedule.c \ @@ -253,7 +291,19 @@ __LIB__libodp_dpdk_la_SOURCES += arch/x86/cpu_flags.c \ arch/x86/odp_sysinfo_parse.c endif +# Build modular framework into odp-linux library +modularframeworkdir = $(top_srcdir)/frameworks/modular +noinst_HEADERS += $(modularframeworkdir)/list.h \ + $(modularframeworkdir)/odp_module.h + +__LIB__libodp_dpdk_la_SOURCES += ../../frameworks/modular/odp_module.c + __LIB__libodp_dpdk_la_LIBADD = $(ATOMIC_LIBS) +__LIB__libodp_dpdk_la_LIBADD += $(DPDK_LIBS) +__LIB__libodp_dpdk_la_LIBADD += $(OPENSSL_LIBS) +__LIB__libodp_dpdk_la_LIBADD += $(PTHREAD_LIBS) +__LIB__libodp_dpdk_la_LIBADD += $(TIMER_LIBS) +__LIB__libodp_dpdk_la_LIBADD += $(LIBCONFIG_LIBS) # Create symlink for ABI header files. Application does not need to use the arch # specific include path for installed files. diff --git a/platform/linux-dpdk/include/odp/api/feature.h b/platform/linux-dpdk/include/odp/api/feature.h new file mode 120000 index 00000000..aa1c547f --- /dev/null +++ b/platform/linux-dpdk/include/odp/api/feature.h @@ -0,0 +1 @@ +../../../../linux-generic/include/odp/api/feature.h \ No newline at end of file diff --git a/platform/linux-dpdk/include/odp/api/ipsec.h b/platform/linux-dpdk/include/odp/api/ipsec.h new file mode 120000 index 00000000..eaf507cf --- /dev/null +++ b/platform/linux-dpdk/include/odp/api/ipsec.h @@ -0,0 +1 @@ +../../../../linux-generic/include/odp/api/ipsec.h \ No newline at end of file diff --git a/platform/linux-dpdk/include/odp/api/plat/event_types.h b/platform/linux-dpdk/include/odp/api/plat/event_types.h index 086e83d5..e0f68e34 100644 --- a/platform/linux-dpdk/include/odp/api/plat/event_types.h +++ b/platform/linux-dpdk/include/odp/api/plat/event_types.h @@ -44,6 +44,13 @@ typedef enum odp_event_type_t { ODP_EVENT_CRYPTO_COMPL = 4, } odp_event_type_t; +typedef enum odp_event_subtype_t { + ODP_EVENT_NO_SUBTYPE = 0, + ODP_EVENT_PACKET_BASIC = 1, + ODP_EVENT_PACKET_CRYPTO = 2, + ODP_EVENT_PACKET_IPSEC = 3 +} + /** * @} */ diff --git a/platform/linux-dpdk/include/odp/api/plat/ipsec_types.h b/platform/linux-dpdk/include/odp/api/plat/ipsec_types.h new file mode 120000 index 00000000..86fdb184 --- /dev/null +++ b/platform/linux-dpdk/include/odp/api/plat/ipsec_types.h @@ -0,0 +1 @@ +../../../../../linux-generic/include/odp/api/plat/ipsec_types.h \ No newline at end of file diff --git a/platform/linux-dpdk/include/odp/api/plat/timer_types.h b/platform/linux-dpdk/include/odp/api/plat/timer_types.h index 8821bed6..c81d7be7 100644 --- a/platform/linux-dpdk/include/odp/api/plat/timer_types.h +++ b/platform/linux-dpdk/include/odp/api/plat/timer_types.h @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - /** * @file * diff --git a/platform/linux-dpdk/include/odp/api/support.h b/platform/linux-dpdk/include/odp/api/support.h new file mode 120000 index 00000000..e6196271 --- /dev/null +++ b/platform/linux-dpdk/include/odp/api/support.h @@ -0,0 +1 @@ +../../../../linux-generic/include/odp/api/support.h \ No newline at end of file diff --git a/platform/linux-dpdk/include/odp_buffer_inlines.h b/platform/linux-dpdk/include/odp_buffer_inlines.h index c481390b..a2fa502f 100644 --- a/platform/linux-dpdk/include/odp_buffer_inlines.h +++ b/platform/linux-dpdk/include/odp_buffer_inlines.h @@ -39,6 +39,16 @@ static inline void _odp_buffer_event_type_set(odp_buffer_t buf, int ev) buf_hdl_to_hdr(buf)->event_type = ev; } +static inline odp_event_subtype_t _odp_buffer_event_subtype(odp_buffer_t buf) +{ + return buf_hdl_to_hdr(buf)->event_subtype; +} + +static inline void _odp_buffer_event_subtype_set(odp_buffer_t buf, int ev) +{ + buf_hdl_to_hdr(buf)->event_subtype = ev; +} + #ifdef __cplusplus } #endif diff --git a/platform/linux-dpdk/include/odp_buffer_internal.h b/platform/linux-dpdk/include/odp_buffer_internal.h index b33a30da..fcb300ab 100644 --- a/platform/linux-dpdk/include/odp_buffer_internal.h +++ b/platform/linux-dpdk/include/odp_buffer_internal.h @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - /** * @file * @@ -75,6 +74,9 @@ struct odp_buffer_hdr_t { /* Event type. Maybe different than pool type (crypto compl event) */ odp_event_type_t event_type; + /* Event subtype. Should be ODP_EVENT_NO_SUBTYPE except packets. */ + odp_event_type_t event_subtype; + /* Burst table */ struct odp_buffer_hdr_t *burst[BUFFER_BURST_SIZE]; diff --git a/platform/linux-dpdk/include/odp_config_internal.h b/platform/linux-dpdk/include/odp_config_internal.h index 21db09b8..ea469ee4 100644 --- a/platform/linux-dpdk/include/odp_config_internal.h +++ b/platform/linux-dpdk/include/odp_config_internal.h @@ -132,6 +132,12 @@ extern "C" { */ #define ODP_CONFIG_ISHM_VA_PREALLOC_SZ (536870912L) +/* Maximum number of shared memory blocks available on the driver interface. + * + * This the the number of separate SHM areas that can be reserved concurrently + */ +#define ODPDRV_CONFIG_SHM_BLOCKS 48 + #ifdef __cplusplus } #endif diff --git a/platform/linux-dpdk/include/odp_packet_internal.h b/platform/linux-dpdk/include/odp_packet_internal.h index 481e4afb..fc1f9e5f 100644 --- a/platform/linux-dpdk/include/odp_packet_internal.h +++ b/platform/linux-dpdk/include/odp_packet_internal.h @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - /** * @file * @@ -30,6 +29,7 @@ extern "C" { #include #include #include +#include #include @@ -126,10 +126,10 @@ typedef struct { odp_time_t timestamp; /* Classifier destination queue */ - odp_queue_t dst_queue; + queue_t dst_queue; - /* Result for crypto */ - odp_crypto_generic_op_result_t op_result; + /* Result for crypto packet op */ + odp_crypto_packet_result_t crypto_op_result; } odp_packet_hdr_t __rte_cache_aligned; /** @@ -145,6 +145,21 @@ static inline struct rte_mbuf *pkt_to_mbuf(odp_packet_hdr_t *pkt_hdr) return &pkt_hdr->buf_hdr.mb; } +static inline odp_buffer_hdr_t *packet_to_buf_hdr(odp_packet_t pkt) +{ + return &odp_packet_hdr(pkt)->buf_hdr; +} + +static inline odp_packet_t packet_from_buf_hdr(odp_buffer_hdr_t *buf_hdr) +{ + return (odp_packet_t)(odp_packet_hdr_t *)buf_hdr; +} + +static inline odp_buffer_t packet_to_buffer(odp_packet_t pkt) +{ + return (odp_buffer_t)pkt; +} + static inline void copy_packet_parser_metadata(odp_packet_hdr_t *src_hdr, odp_packet_hdr_t *dst_hdr) { @@ -157,7 +172,6 @@ static inline void copy_packet_cls_metadata(odp_packet_hdr_t *src_hdr, dst_hdr->p = src_hdr->p; dst_hdr->dst_queue = src_hdr->dst_queue; dst_hdr->timestamp = src_hdr->timestamp; - dst_hdr->op_result = src_hdr->op_result; } static inline uint32_t packet_len(odp_packet_hdr_t *pkt_hdr) @@ -189,11 +203,8 @@ static inline void packet_parse_reset(odp_packet_hdr_t *pkt_hdr) pkt_hdr->p.l4_offset = ODP_PACKET_OFFSET_INVALID; } -/* Convert a packet handle to a buffer handle */ -odp_buffer_t _odp_packet_to_buffer(odp_packet_t pkt); - /* Convert a buffer handle to a packet handle */ -odp_packet_t _odp_packet_from_buffer(odp_buffer_t buf); +odp_packet_t _odp_packet_from_buf_hdr(odp_buffer_hdr_t *buf_hdr); static inline int packet_hdr_has_l2(odp_packet_hdr_t *pkt_hdr) { diff --git a/platform/linux-dpdk/include/odp_packet_io_internal.h b/platform/linux-dpdk/include/odp_packet_io_internal.h index 9dc420c4..8e158dc9 100644 --- a/platform/linux-dpdk/include/odp_packet_io_internal.h +++ b/platform/linux-dpdk/include/odp_packet_io_internal.h @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ - /** * @file * @@ -23,6 +22,7 @@ extern "C" { #include #include #include +#include #include #include @@ -106,6 +106,7 @@ struct pktio_entry { struct { odp_queue_t queue; + queue_t queue_int; odp_pktin_queue_t pktin; } in_queue[PKTIO_MAX_QUEUES]; @@ -193,7 +194,6 @@ static inline void pktio_cls_enabled_set(pktio_entry_t *entry, int ena) /* * Dummy single queue implementations of multi-queue API */ -int single_capability(odp_pktio_capability_t *capa); int single_input_queues_config(pktio_entry_t *entry, const odp_pktin_queue_param_t *param); int single_output_queues_config(pktio_entry_t *entry, diff --git a/platform/linux-dpdk/m4/configure.m4 b/platform/linux-dpdk/m4/configure.m4 index 230ef6ef..428ecc82 100644 --- a/platform/linux-dpdk/m4/configure.m4 +++ b/platform/linux-dpdk/m4/configure.m4 @@ -28,6 +28,9 @@ AC_LINK_IFELSE( echo "Use newer version. For gcc > 4.7.0" exit -1) +dnl Check for libconfig (required) +PKG_CHECK_MODULES([LIBCONFIG], [libconfig >= 1.3.2]) + dnl Check whether -latomic is needed use_libatomic=no @@ -76,8 +79,13 @@ AC_SUBST([ATOMIC_LIBS]) # linux-generic PCAP support is not relevant as the code doesn't use # linux-generic pktio at all. And DPDK has its own PCAP support anyway AM_CONDITIONAL([HAVE_PCAP], [false]) +AM_CONDITIONAL([netmap_support], [false]) +AM_CONDITIONAL([PKTIO_DPDK], [false]) m4_include([platform/linux-dpdk/m4/odp_pthread.m4]) +m4_include([platform/linux-dpdk/m4/odp_timer.m4]) m4_include([platform/linux-dpdk/m4/odp_openssl.m4]) +m4_include([platform/linux-dpdk/m4/odp_modules.m4]) +m4_include([platform/linux-dpdk/m4/odp_schedule.m4]) ########################################################################## # DPDK build variables @@ -98,7 +106,6 @@ AC_ARG_ENABLE([shared-dpdk], [if test "x$enableval" = "xyes"; then shared_dpdk=true fi]) -AM_CONDITIONAL([SHARED_DPDK], [test x$shared_dpdk = xtrue]) ########################################################################## # Save and set temporary compilation flags @@ -106,7 +113,7 @@ AM_CONDITIONAL([SHARED_DPDK], [test x$shared_dpdk = xtrue]) OLD_LDFLAGS=$LDFLAGS OLD_CPPFLAGS=$CPPFLAGS LDFLAGS="$AM_LDFLAGS $LDFLAGS" -CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS" +CPPFLAGS="$AM_CPPFLAGS $CPPFLAGS -pthread" ########################################################################## # Check for DPDK availability @@ -125,21 +132,23 @@ AC_SEARCH_LIBS([rte_eal_init], [dpdk], [], if test "x$shared_dpdk" = "xtrue"; then LIBS="$LIBS -Wl,--no-as-needed,-ldpdk,-as-needed -ldl -lm -lpcap" else - DPDK_PMD=--whole-archive, - for filename in $DPDK_DRIVER_DIR/*.a; do - cur_driver=`echo $(basename "$filename" .a) | \ - sed -n 's/^\(librte_pmd_\)/-lrte_pmd_/p' | sed -n 's/$/,/p'` + + AS_VAR_SET([DPDK_PMDS], [-Wl,--whole-archive,]) + for filename in $DPDK_DRIVER_DIR/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" = "-lrte_pmd_nfp,"; then + if test "$cur_driver" = "rte_pmd_nfp"; then echo "skip linking rte_pmd_nfp" else - DPDK_PMD+=$cur_driver + AS_VAR_APPEND([DPDK_PMDS], [-l$cur_driver,]) fi done - DPDK_PMD+=--no-whole-archive + AS_VAR_APPEND([DPDK_PMDS], [--no-whole-archive]) - LIBS="$LIBS -ldpdk -ldl -lm -lpcap" - AM_LDFLAGS="$AM_LDFLAGS -Wl,$DPDK_PMD" + DPDK_LIBS="-L$DPDK_DRIVER_DIR -ldpdk -lpthread -ldl -lm -lpcap" + AC_SUBST([DPDK_CPPFLAGS]) + AC_SUBST([DPDK_LIBS]) + AC_SUBST([DPDK_PMDS]) fi ########################################################################## diff --git a/platform/linux-dpdk/m4/odp_modules.m4 b/platform/linux-dpdk/m4/odp_modules.m4 new file mode 120000 index 00000000..3f60e2bd --- /dev/null +++ b/platform/linux-dpdk/m4/odp_modules.m4 @@ -0,0 +1 @@ +../../linux-generic/m4/odp_modules.m4 \ No newline at end of file diff --git a/platform/linux-dpdk/m4/odp_schedule.m4 b/platform/linux-dpdk/m4/odp_schedule.m4 new file mode 120000 index 00000000..7b211bd8 --- /dev/null +++ b/platform/linux-dpdk/m4/odp_schedule.m4 @@ -0,0 +1 @@ +../../linux-generic/m4/odp_schedule.m4 \ No newline at end of file diff --git a/platform/linux-dpdk/m4/odp_timer.m4 b/platform/linux-dpdk/m4/odp_timer.m4 new file mode 120000 index 00000000..2a909824 --- /dev/null +++ b/platform/linux-dpdk/m4/odp_timer.m4 @@ -0,0 +1 @@ +../../linux-generic/m4/odp_timer.m4 \ No newline at end of file diff --git a/platform/linux-dpdk/odp_crypto.c b/platform/linux-dpdk/odp_crypto.c index d95b1578..8235e1bd 100644 --- a/platform/linux-dpdk/odp_crypto.c +++ b/platform/linux-dpdk/odp_crypto.c @@ -32,6 +32,7 @@ typedef struct crypto_session_entry_s crypto_session_entry_t; struct crypto_session_entry_s { struct crypto_session_entry_s *next; + odp_crypto_session_param_t p; uint64_t rte_session; odp_bool_t do_cipher_first; struct rte_crypto_sym_xform cipher_xform; @@ -40,9 +41,6 @@ struct crypto_session_entry_s { uint8_t *data; uint16_t length; } iv; - odp_queue_t compl_queue; /**< Async mode completion - event queue */ - odp_pool_t output_pool; /**< Output buffer pool */ }; struct crypto_global_s { @@ -59,11 +57,6 @@ typedef struct crypto_global_s crypto_global_t; static crypto_global_t *global; static odp_shm_t crypto_global_shm; -static odp_crypto_generic_op_result_t *get_op_result_from_event(odp_event_t ev) -{ - return &(odp_packet_hdr(odp_packet_from_event(ev))->op_result); -} - static inline int is_valid_size(uint16_t length, uint16_t min, uint16_t max, uint16_t increment) { @@ -807,6 +800,9 @@ int odp_crypto_session_create(odp_crypto_session_param_t *param, return -1; } + /* Copy parameters */ + entry->p = *param; + /* Default to successful result */ *status = ODP_CRYPTO_SES_CREATE_ERR_NONE; @@ -911,8 +907,6 @@ int odp_crypto_session_create(odp_crypto_session_param_t *param, entry->auth_xform = auth_xform; entry->iv.length = param->iv.length; entry->iv.data = param->iv.data; - entry->output_pool = param->output_pool; - entry->compl_queue = param->compl_queue; /* We're happy */ *session_out = (intptr_t)entry; @@ -948,18 +942,226 @@ int odp_crypto_operation(odp_crypto_op_param_t *param, odp_bool_t *posted, odp_crypto_op_result_t *result) { + odp_crypto_packet_op_param_t packet_param; + odp_packet_t out_pkt = param->out_pkt; + odp_crypto_packet_result_t packet_result; + odp_crypto_op_result_t local_result; + int rc; + + packet_param.session = param->session; + packet_param.override_iv_ptr = param->override_iv_ptr; + packet_param.hash_result_offset = param->hash_result_offset; + packet_param.aad.ptr = param->aad.ptr; + packet_param.aad.length = param->aad.length; + packet_param.cipher_range = param->cipher_range; + packet_param.auth_range = param->auth_range; + + rc = odp_crypto_op(¶m->pkt, &out_pkt, &packet_param, 1); + if (rc < 0) + return rc; + + rc = odp_crypto_result(&packet_result, out_pkt); + if (rc < 0) + return rc; + + /* Indicate to caller operation was sync */ + *posted = 0; + + _odp_buffer_event_subtype_set(packet_to_buffer(out_pkt), + ODP_EVENT_PACKET_BASIC); + + /* Fill in result */ + local_result.ctx = param->ctx; + local_result.pkt = out_pkt; + local_result.cipher_status = packet_result.cipher_status; + local_result.auth_status = packet_result.auth_status; + local_result.ok = packet_result.ok; + + /* + * Be bug-to-bug compatible. Return output packet also through params. + */ + param->out_pkt = out_pkt; + + *result = local_result; + + return 0; +} + +int odp_crypto_term_global(void) +{ + int rc = 0; + int ret; + int count = 0; + crypto_session_entry_t *session; + + odp_spinlock_init(&global->lock); + odp_spinlock_lock(&global->lock); + for (session = global->free; session != NULL; session = session->next) + count++; + if (count != MAX_SESSIONS) { + ODP_ERR("crypto sessions still active\n"); + rc = -1; + } + + if (global->crypto_op_pool != NULL) + rte_mempool_free(global->crypto_op_pool); + + odp_spinlock_unlock(&global->lock); + + ret = odp_shm_free(crypto_global_shm); + if (ret < 0) { + ODP_ERR("shm free failed for crypto_pool\n"); + rc = -1; + } + + return rc; +} + +odp_random_kind_t odp_random_max_kind(void) +{ + return ODP_RANDOM_CRYPTO; +} + +int32_t odp_random_data(uint8_t *buf, uint32_t len, odp_random_kind_t kind) +{ + int rc; + + switch (kind) { + case ODP_RANDOM_BASIC: + RAND_pseudo_bytes(buf, len); + return len; + + case ODP_RANDOM_CRYPTO: + rc = RAND_bytes(buf, len); + return (1 == rc) ? (int)len /*success*/: -1 /*failure*/; + + case ODP_RANDOM_TRUE: + default: + return -1; + } +} + +int32_t odp_random_test_data(uint8_t *buf, uint32_t len, uint64_t *seed) +{ + union { + uint32_t rand_word; + uint8_t rand_byte[4]; + } u; + uint32_t i = 0, j; + uint32_t seed32 = (*seed) & 0xffffffff; + + while (i < len) { + u.rand_word = rand_r(&seed32); + + for (j = 0; j < 4 && i < len; j++, i++) + *buf++ = u.rand_byte[j]; + } + + *seed = seed32; + return len; +} + +odp_crypto_compl_t odp_crypto_compl_from_event(odp_event_t ev) +{ + /* This check not mandated by the API specification */ + if (odp_event_type(ev) != ODP_EVENT_CRYPTO_COMPL) + ODP_ABORT("Event not a crypto completion"); + return (odp_crypto_compl_t)ev; +} + +odp_event_t odp_crypto_compl_to_event(odp_crypto_compl_t completion_event) +{ + return (odp_event_t)completion_event; +} + +void odp_crypto_compl_result(odp_crypto_compl_t completion_event, + odp_crypto_op_result_t *result) +{ + (void)completion_event; + (void)result; + + /* We won't get such events anyway, so there can be no result */ + ODP_ASSERT(0); +} + +void odp_crypto_compl_free(odp_crypto_compl_t completion_event) +{ + odp_event_t ev = odp_crypto_compl_to_event(completion_event); + + odp_buffer_free(odp_buffer_from_event(ev)); +} + +void odp_crypto_session_param_init(odp_crypto_session_param_t *param) +{ + memset(param, 0, sizeof(odp_crypto_session_param_t)); +} + +uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl) +{ + return (uint64_t)hdl; +} + +uint64_t odp_crypto_compl_to_u64(odp_crypto_compl_t hdl) +{ + return _odp_pri(hdl); +} + +odp_packet_t odp_crypto_packet_from_event(odp_event_t ev) +{ + /* This check not mandated by the API specification */ + ODP_ASSERT(odp_event_type(ev) == ODP_EVENT_PACKET); + ODP_ASSERT(odp_event_subtype(ev) == ODP_EVENT_PACKET_CRYPTO); + + return odp_packet_from_event(ev); +} + +odp_event_t odp_crypto_packet_to_event(odp_packet_t pkt) +{ + return odp_packet_to_event(pkt); +} + +static +odp_crypto_packet_result_t *get_op_result_from_packet(odp_packet_t pkt) +{ + odp_packet_hdr_t *hdr = odp_packet_hdr(pkt); + + return &hdr->crypto_op_result; +} + +int odp_crypto_result(odp_crypto_packet_result_t *result, + odp_packet_t packet) +{ + odp_crypto_packet_result_t *op_result; + + ODP_ASSERT(odp_event_subtype(odp_packet_to_event(packet)) == + ODP_EVENT_PACKET_CRYPTO); + + op_result = get_op_result_from_packet(packet); + + memcpy(result, op_result, sizeof(*result)); + + return 0; +} + +static +int odp_crypto_int(odp_packet_t pkt_in, + odp_packet_t *pkt_out, + const odp_crypto_packet_op_param_t *param) +{ + crypto_session_entry_t *entry; + odp_crypto_packet_result_t local_result; odp_crypto_alg_err_t rc_cipher = ODP_CRYPTO_ALG_ERR_NONE; odp_crypto_alg_err_t rc_auth = ODP_CRYPTO_ALG_ERR_NONE; struct rte_crypto_sym_xform cipher_xform; struct rte_crypto_sym_xform auth_xform; struct rte_cryptodev_sym_session *rte_session = NULL; - odp_crypto_op_result_t local_result; - crypto_session_entry_t *entry; uint8_t *data_addr, *aad_head; struct rte_crypto_op *op; - uint16_t rc; uint32_t aad_len; odp_bool_t allocated = false; + odp_packet_t out_pkt = *pkt_out; + odp_crypto_packet_result_t *op_result; + uint16_t rc; entry = (crypto_session_entry_t *)(intptr_t)param->session; if (entry == NULL) @@ -976,32 +1178,32 @@ int odp_crypto_operation(odp_crypto_op_param_t *param, auth_xform = entry->auth_xform; /* Resolve output buffer */ - if (ODP_PACKET_INVALID == param->out_pkt && - ODP_POOL_INVALID != entry->output_pool) { - param->out_pkt = odp_packet_alloc(entry->output_pool, - odp_packet_len(param->pkt)); + if (ODP_PACKET_INVALID == out_pkt && + ODP_POOL_INVALID != entry->p.output_pool) { + out_pkt = odp_packet_alloc(entry->p.output_pool, + odp_packet_len(pkt_in)); allocated = true; } - if (param->pkt != param->out_pkt) { - if (odp_unlikely(ODP_PACKET_INVALID == param->out_pkt)) + if (pkt_in != out_pkt) { + if (odp_unlikely(ODP_PACKET_INVALID == out_pkt)) ODP_ABORT(); int ret; - ret = odp_packet_copy_from_pkt(param->out_pkt, + ret = odp_packet_copy_from_pkt(out_pkt, 0, - param->pkt, + pkt_in, 0, - odp_packet_len(param->pkt)); + odp_packet_len(pkt_in)); if (odp_unlikely(ret < 0)) goto err; - _odp_packet_copy_md_to_packet(param->pkt, param->out_pkt); - odp_packet_free(param->pkt); - param->pkt = ODP_PACKET_INVALID; + _odp_packet_copy_md_to_packet(pkt_in, out_pkt); + odp_packet_free(pkt_in); + pkt_in = ODP_PACKET_INVALID; } - data_addr = odp_packet_data(param->out_pkt); + data_addr = odp_packet_data(out_pkt); odp_spinlock_init(&global->lock); odp_spinlock_lock(&global->lock); @@ -1018,8 +1220,8 @@ int odp_crypto_operation(odp_crypto_op_param_t *param, rte_crypto_op_attach_sym_session(op, rte_session); op->sym->auth.digest.data = data_addr + param->hash_result_offset; op->sym->auth.digest.phys_addr = - rte_pktmbuf_mtophys_offset((struct rte_mbuf *)param->out_pkt, - odp_packet_len(param->out_pkt) - + rte_pktmbuf_mtophys_offset((struct rte_mbuf *)out_pkt, + odp_packet_len(out_pkt) - auth_xform.auth.digest_length); op->sym->auth.digest.length = auth_xform.auth.digest_length; @@ -1092,7 +1294,7 @@ int odp_crypto_operation(odp_crypto_op_param_t *param, rc_auth == ODP_CRYPTO_ALG_ERR_NONE) { int queue_pair = odp_cpu_id(); - op->sym->m_src = (struct rte_mbuf *)param->out_pkt; + op->sym->m_src = (struct rte_mbuf *)out_pkt; rc = rte_cryptodev_enqueue_burst(rte_session->dev_id, queue_pair, &op, 1); if (rc == 0) { @@ -1110,12 +1312,10 @@ int odp_crypto_operation(odp_crypto_op_param_t *param, goto err; } - param->out_pkt = (odp_packet_t)op->sym->m_src; + out_pkt = (odp_packet_t)op->sym->m_src; } /* Fill in result */ - local_result.ctx = param->ctx; - local_result.pkt = param->out_pkt; local_result.cipher_status.alg_err = rc_cipher; local_result.cipher_status.hw_err = ODP_CRYPTO_HW_ERR_NONE; local_result.auth_status.alg_err = rc_auth; @@ -1124,167 +1324,73 @@ int odp_crypto_operation(odp_crypto_op_param_t *param, (rc_cipher == ODP_CRYPTO_ALG_ERR_NONE) && (rc_auth == ODP_CRYPTO_ALG_ERR_NONE); + _odp_buffer_event_subtype_set(packet_to_buffer(out_pkt), + ODP_EVENT_PACKET_BASIC); + op_result = get_op_result_from_packet(out_pkt); + *op_result = local_result; + rte_crypto_op_free(op); - /* If specified during creation post event to completion queue */ - if (ODP_QUEUE_INVALID != entry->compl_queue) { - odp_event_t completion_event; - odp_crypto_generic_op_result_t *op_result; - - completion_event = odp_packet_to_event(param->out_pkt); - _odp_buffer_event_type_set( - odp_buffer_from_event(completion_event), - ODP_EVENT_CRYPTO_COMPL); - /* Asynchronous, build result (no HW so no errors) and send it*/ - op_result = get_op_result_from_event(completion_event); - op_result->magic = OP_RESULT_MAGIC; - op_result->result = local_result; - if (odp_queue_enq(entry->compl_queue, completion_event)) { - odp_event_free(completion_event); - goto err; - } + /* Synchronous, simply return results */ + *pkt_out = out_pkt; - /* Indicate to caller operation was async */ - *posted = 1; - } else { - /* Synchronous, simply return results */ - if (!result) - goto err; - *result = local_result; - - /* Indicate to caller operation was sync */ - *posted = 0; - } return 0; err: if (allocated) { - odp_packet_free(param->out_pkt); - param->out_pkt = ODP_PACKET_INVALID; + odp_packet_free(out_pkt); + out_pkt = ODP_PACKET_INVALID; } return -1; } -int odp_crypto_term_global(void) +int odp_crypto_op(const odp_packet_t pkt_in[], + odp_packet_t pkt_out[], + const odp_crypto_packet_op_param_t param[], + int num_pkt) { - int rc = 0; - int ret; - int count = 0; - crypto_session_entry_t *session; - - odp_spinlock_init(&global->lock); - odp_spinlock_lock(&global->lock); - for (session = global->free; session != NULL; session = session->next) - count++; - if (count != MAX_SESSIONS) { - ODP_ERR("crypto sessions still active\n"); - rc = -1; - } - - if (global->crypto_op_pool != NULL) - rte_mempool_free(global->crypto_op_pool); + crypto_session_entry_t *entry; + int i, rc; - odp_spinlock_unlock(&global->lock); + entry = (crypto_session_entry_t *)(intptr_t)param->session; + ODP_ASSERT(ODP_CRYPTO_SYNC == entry->p.op_mode); - ret = odp_shm_free(crypto_global_shm); - if (ret < 0) { - ODP_ERR("shm free failed for crypto_pool\n"); - rc = -1; + for (i = 0; i < num_pkt; i++) { + rc = odp_crypto_int(pkt_in[i], &pkt_out[i], ¶m[i]); + if (rc < 0) + break; } - return rc; + return i; } -odp_random_kind_t odp_random_max_kind(void) -{ - return ODP_RANDOM_CRYPTO; -} - -int32_t odp_random_data(uint8_t *buf, uint32_t len, odp_random_kind_t kind) +int odp_crypto_op_enq(const odp_packet_t pkt_in[], + const odp_packet_t pkt_out[], + const odp_crypto_packet_op_param_t param[], + int num_pkt) { - int rc; - - switch (kind) { - case ODP_RANDOM_BASIC: - RAND_pseudo_bytes(buf, len); - return len; - - case ODP_RANDOM_CRYPTO: - rc = RAND_bytes(buf, len); - return (1 == rc) ? (int)len /*success*/: -1 /*failure*/; - - case ODP_RANDOM_TRUE: - default: - return -1; - } -} - -int32_t odp_random_test_data(uint8_t *buf, uint32_t len, uint64_t *seed) -{ - union { - uint32_t rand_word; - uint8_t rand_byte[4]; - } u; - uint32_t i = 0, j; - uint32_t seed32 = (*seed) & 0xffffffff; - - while (i < len) { - u.rand_word = rand_r(&seed32); + odp_packet_t pkt; + odp_event_t event; + crypto_session_entry_t *entry; + int i, rc; - for (j = 0; j < 4 && i < len; j++, i++) - *buf++ = u.rand_byte[j]; + entry = (crypto_session_entry_t *)(intptr_t)param->session; + ODP_ASSERT(ODP_CRYPTO_ASYNC == entry->p.op_mode); + ODP_ASSERT(ODP_QUEUE_INVALID != entry->p.compl_queue); + + for (i = 0; i < num_pkt; i++) { + pkt = pkt_out[i]; + rc = odp_crypto_int(pkt_in[i], &pkt, ¶m[i]); + if (rc < 0) + break; + + event = odp_packet_to_event(pkt); + if (odp_queue_enq(entry->p.compl_queue, event)) { + odp_event_free(event); + break; + } } - *seed = seed32; - return len; -} - -odp_crypto_compl_t odp_crypto_compl_from_event(odp_event_t ev) -{ - /* This check not mandated by the API specification */ - if (odp_event_type(ev) != ODP_EVENT_CRYPTO_COMPL) - ODP_ABORT("Event not a crypto completion"); - return (odp_crypto_compl_t)ev; -} - -odp_event_t odp_crypto_compl_to_event(odp_crypto_compl_t completion_event) -{ - return (odp_event_t)completion_event; -} - -void odp_crypto_compl_result(odp_crypto_compl_t completion_event, - odp_crypto_op_result_t *result) -{ - odp_event_t ev = odp_crypto_compl_to_event(completion_event); - odp_crypto_generic_op_result_t *op_result; - - op_result = get_op_result_from_event(ev); - - if (OP_RESULT_MAGIC != op_result->magic) - ODP_ABORT(); - - memcpy(result, &op_result->result, sizeof(*result)); -} - -void odp_crypto_compl_free(odp_crypto_compl_t completion_event) -{ - _odp_buffer_event_type_set( - odp_buffer_from_event((odp_event_t)completion_event), - ODP_EVENT_PACKET); -} - -void odp_crypto_session_param_init(odp_crypto_session_param_t *param) -{ - memset(param, 0, sizeof(odp_crypto_session_param_t)); -} - -uint64_t odp_crypto_session_to_u64(odp_crypto_session_t hdl) -{ - return (uint64_t)hdl; -} - -uint64_t odp_crypto_compl_to_u64(odp_crypto_compl_t hdl) -{ - return _odp_pri(hdl); + return i; } diff --git a/platform/linux-dpdk/odp_init.c b/platform/linux-dpdk/odp_init.c index 6cea393b..96c535ba 100644 --- a/platform/linux-dpdk/odp_init.c +++ b/platform/linux-dpdk/odp_init.c @@ -12,6 +12,8 @@ #include #include #include +#include +#include #include #include #include @@ -23,6 +25,15 @@ #define _ODP_FILES_FMT "odp-%d-" #define _ODP_TMPDIR "/tmp" +/* the name of the ODP configuration file: */ +#define CONFIGURATION_FILE_ENV_NONE "none" +#define CONFIGURATION_FILE "odp.conf" +#define CONFIGURATION_FILE_USR ("." CONFIGURATION_FILE) +#define CONFIGURATION_FILE_SYS (SYSCONFDIR "/" CONFIGURATION_FILE) + +/* the ODP configuration file name can also be oveerwritten by env. variable: */ +#define ODP_SYSCONFIG_FILE_ENV "ODP_SYSCONFIG_FILE" + #define MEMPOOL_OPS(hdl) extern void mp_hdlr_init_##hdl(void); MEMPOOL_OPS(ops_mp_mc) MEMPOOL_OPS(ops_sp_sc) @@ -189,6 +200,82 @@ static int cleanup_files(const char *dirpath, int odp_pid) return 0; } +/* read the odp configuration file + * + * the configuration file is read from: + * 1) Wherever env variable ODP_SYSCONFIG_FILE says (or "none") + * 2) ./odp.conf + * 3) the @sysconfig@/odp.conf + * (checked in reverse order overwriting each-other) + * So the environment variable setting supperseeds any other file. + * If the environment variable exists and set to the string "none" + * the configuration file reading is inibited (used to prevent + * test which do not need a file to read the user or system files) + */ +static int read_configfile(void) +{ + config_t *cf; + const char *config_filename; + char user_config_filename[PATH_MAX]; + char *env_config_filename; + + /* initialize and read the configuration file if any: */ + cf = &odp_global_data.configuration; + config_init(cf); + config_filename = NULL; + /* check if the system config file can be reached :*/ + if (access(CONFIGURATION_FILE_SYS, R_OK) != -1) + config_filename = CONFIGURATION_FILE_SYS; + /* check if the user config file can be reached (overwrite if so) :*/ + strncpy(user_config_filename, getenv("HOME"), PATH_MAX); + if (user_config_filename[0]) { + strncat(user_config_filename, "/", PATH_MAX); + strncat(user_config_filename, CONFIGURATION_FILE_USR, PATH_MAX); + if ((access(user_config_filename, R_OK) != -1)) + config_filename = user_config_filename; + } + /* check if other config file is specified via env (overwrite if so):*/ + env_config_filename = getenv(ODP_SYSCONFIG_FILE_ENV); + if (env_config_filename) { + /* none means "read no file": */ + if (!strcmp(env_config_filename, CONFIGURATION_FILE_ENV_NONE)) + return 0; + if (access(env_config_filename, R_OK) != -1) { + config_filename = env_config_filename; + } else { + ODP_ERR("Cannot read ODP configurattion file %s " + "(set by env variable " + ODP_SYSCONFIG_FILE_ENV ")\n", + env_config_filename); + config_filename = NULL; + return -1; + } + } + if (config_filename) { + ODP_DBG("Reading configuration file: %s\n", config_filename); + if (!config_read_file(cf, config_filename)) { +#if defined(LIBCONFIG_VER_MAJOR) && LIBCONFIG_VER_MAJOR >= 1 && \ + LIBCONFIG_VER_MINOR >= 4 + ODP_ERR("%s:%d - %s\n", + config_error_file(cf), + config_error_line(cf), + config_error_text(cf)); +#else + ODP_ERR("config_read_file\n"); +#endif + config_destroy(cf); + return -1; + } + } + + return 0; +} + +void odp_init_param_init(odp_init_t *param) +{ + memset(param, 0, sizeof(odp_init_t)); +} + int odp_init_global(odp_instance_t *instance, const odp_init_t *params, const odp_platform_init_t *platform_params) @@ -211,6 +298,9 @@ int odp_init_global(odp_instance_t *instance, cleanup_files(_ODP_TMPDIR, odp_global_data.main_pid); + if (read_configfile()) + goto init_failed; + if (odp_cpumask_init_global(params)) { ODP_ERR("ODP cpumask init failed.\n"); goto init_failed; @@ -238,18 +328,18 @@ int odp_init_global(odp_instance_t *instance, cleanup_files(hpdir, odp_global_data.main_pid); stage = SYSINFO_INIT; - if (_odp_fdserver_init_global()) { - ODP_ERR("ODP fdserver init failed.\n"); - goto init_failed; - } - stage = FDSERVER_INIT; - if (_odp_ishm_init_global()) { ODP_ERR("ODP ishm init failed.\n"); goto init_failed; } stage = ISHM_INIT; + if (_odp_fdserver_init_global()) { + ODP_ERR("ODP fdserver init failed.\n"); + goto init_failed; + } + stage = FDSERVER_INIT; + if (odp_thread_init_global()) { ODP_ERR("ODP thread init failed.\n"); goto init_failed; @@ -262,7 +352,7 @@ int odp_init_global(odp_instance_t *instance, } stage = POOL_INIT; - if (odp_queue_init_global()) { + if (queue_fn->init_global()) { ODP_ERR("ODP queue init failed.\n"); goto init_failed; } @@ -280,7 +370,7 @@ int odp_init_global(odp_instance_t *instance, } stage = PKTIO_INIT; - if (odp_timer_init_global()) { + if (odp_timer_init_global(params)) { ODP_ERR("ODP timer init failed.\n"); goto init_failed; } @@ -308,6 +398,19 @@ int odp_init_global(odp_instance_t *instance, ODP_ERR("ODP name table init failed\n"); goto init_failed; } + stage = NAME_TABLE_INIT; + + if (_odpdrv_driver_init_global()) { + ODP_ERR("ODP drivers init failed\n"); + goto init_failed; + } + stage = DRIVER_INIT; + + if (_odp_modules_init_global()) { + ODP_ERR("ODP modules init failed\n"); + goto init_failed; + } + /* stage = DRIVER_INIT; */ /* Dummy support for single instance */ *instance = (odp_instance_t)odp_global_data.main_pid; @@ -334,6 +437,14 @@ int _odp_term_global(enum init_stage stage) switch (stage) { case ALL_INIT: + case MODULES_INIT: + case DRIVER_INIT: + if (_odpdrv_driver_term_global()) { + ODP_ERR("driver term failed.\n"); + rc = -1; + } + /* Fall through */ + case NAME_TABLE_INIT: if (_odp_int_name_tbl_term_global()) { ODP_ERR("Name table term failed.\n"); @@ -384,7 +495,7 @@ int _odp_term_global(enum init_stage stage) /* Fall through */ case QUEUE_INIT: - if (odp_queue_term_global()) { + if (queue_fn->term_global()) { ODP_ERR("ODP queue term failed.\n"); rc = -1; } @@ -404,16 +515,16 @@ int _odp_term_global(enum init_stage stage) } /* Fall through */ - case ISHM_INIT: - if (_odp_ishm_term_global()) { - ODP_ERR("ODP ishm term failed.\n"); + case FDSERVER_INIT: + if (_odp_fdserver_term_global()) { + ODP_ERR("ODP fdserver term failed.\n"); rc = -1; } /* Fall through */ - case FDSERVER_INIT: - if (_odp_fdserver_term_global()) { - ODP_ERR("ODP fdserver term failed.\n"); + case ISHM_INIT: + if (_odp_ishm_term_global()) { + ODP_ERR("ODP ishm term failed.\n"); rc = -1; } /* Fall through */ diff --git a/platform/linux-dpdk/odp_packet.c b/platform/linux-dpdk/odp_packet.c index 0d05e23f..af4f8259 100644 --- a/platform/linux-dpdk/odp_packet.c +++ b/platform/linux-dpdk/odp_packet.c @@ -191,6 +191,7 @@ int odp_packet_reset(odp_packet_t pkt, uint32_t len) pkt_hdr->buf_hdr.next = NULL; pkt_hdr->input = ODP_PKTIO_INVALID; + pkt_hdr->buf_hdr.event_subtype = ODP_EVENT_PACKET_BASIC; mb->port = 0xff; mb->pkt_len = len; @@ -217,20 +218,9 @@ int odp_packet_reset(odp_packet_t pkt, uint32_t len) return 0; } -odp_packet_t _odp_packet_from_buffer(odp_buffer_t buf) +odp_packet_t _odp_packet_from_buf_hdr(odp_buffer_hdr_t *buf_hdr) { - if (odp_unlikely(buf == ODP_BUFFER_INVALID)) - return ODP_PACKET_INVALID; - - return (odp_packet_t)buf_to_packet_hdr(buf); -} - -odp_buffer_t _odp_packet_to_buffer(odp_packet_t pkt) -{ - if (odp_unlikely(pkt == ODP_PACKET_INVALID)) - return ODP_BUFFER_INVALID; - - return buffer_handle(odp_packet_hdr(pkt)); + return (odp_packet_t)buf_hdr; } odp_packet_t odp_packet_from_event(odp_event_t ev) @@ -1007,7 +997,7 @@ void odp_packet_print(odp_packet_t pkt) int len = 0; int n = max_len - 1; odp_packet_hdr_t *hdr = odp_packet_hdr(pkt); - odp_buffer_t buf = _odp_packet_to_buffer(pkt); + odp_buffer_t buf = packet_to_buffer(pkt); len += snprintf(&str[len], n - len, "Packet "); len += odp_buffer_snprint(&str[len], n - len, buf); @@ -1062,7 +1052,7 @@ void odp_packet_print(odp_packet_t pkt) int odp_packet_is_valid(odp_packet_t pkt) { - odp_buffer_t buf = _odp_packet_to_buffer(pkt); + odp_buffer_t buf = packet_to_buffer(pkt); return odp_buffer_is_valid(buf); } diff --git a/platform/linux-dpdk/odp_packet_dpdk.c b/platform/linux-dpdk/odp_packet_dpdk.c index d056a824..649fbf4b 100644 --- a/platform/linux-dpdk/odp_packet_dpdk.c +++ b/platform/linux-dpdk/odp_packet_dpdk.c @@ -42,7 +42,7 @@ const pktio_if_ops_t * const pktio_if_ops[] = { NULL }; -extern pktio_table_t *pktio_tbl; +pktio_table_t *pktio_tbl; static uint32_t mtu_get_pkt_dpdk(pktio_entry_t *pktio_entry); diff --git a/platform/linux-dpdk/odp_pool.c b/platform/linux-dpdk/odp_pool.c index 0821cdca..b67c2aa8 100644 --- a/platform/linux-dpdk/odp_pool.c +++ b/platform/linux-dpdk/odp_pool.c @@ -226,6 +226,7 @@ odp_dpdk_mbuf_ctor(struct rte_mempool *mp, buf_hdr->pool_hdl = mbp_ctor_arg->pool_hdl; buf_hdr->type = mb_ctor_arg->type; buf_hdr->event_type = mb_ctor_arg->type; + buf_hdr->event_subtype = ODP_EVENT_NO_SUBTYPE; } #define CHECK_U16_OVERFLOW(X) do { \ diff --git a/test/linux-dpdk/Makefile.inc b/test/linux-dpdk/Makefile.inc index a24b9362..25493d86 100644 --- a/test/linux-dpdk/Makefile.inc +++ b/test/linux-dpdk/Makefile.inc @@ -4,6 +4,8 @@ AM_LDFLAGS += -static +AM_CPPFLAGS += $(CUNIT_CPPFLAGS) + LIBCUNIT_COMMON = $(top_builddir)/test/common_plat/common/libcunit_common.la LIB = $(top_builddir)/lib LIBODP = $(LIB)/libodphelper.la $(LIB)/libodp-dpdk.la From patchwork Thu Aug 17 06:00:06 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: 110298 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1751749qge; Wed, 16 Aug 2017 23:04:48 -0700 (PDT) X-Received: by 10.237.37.70 with SMTP id w6mr6196642qtc.215.1502949888537; Wed, 16 Aug 2017 23:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502949888; cv=none; d=google.com; s=arc-20160816; b=TthgbZDdrHdC1Rfaav7TzQ+Wpz7UbsSkfi4kUJWJtPlfMmOJbv/OPrN0FJlMq/jJou vY8cVd00OucBhwgDvooWhdjYcrQTJ9XPdJs5bbluIQlHHteVgre4UfvPeG+wb6Bco8kA tfgT610YeHLZWdUNKIaNsjPeqcKbIDWJwN5pGCs4DXuLXoIil5ZtVfyMi83Z3fqxJx+E CpenoVh7GSi0zEUO+zECubWL4eg2crKloVTzKyhZN/Wt+lXv8jtPro0rsslKYsAN7vFn 7Q9/1wKVRyDu/NsmxWd25slRSdXWaHpkmIDkZTj3LpDjcdB5zwY5yL6uGklMw0qI81YK 0+/w== 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=Ou/aHN7lOXditzuiNX9WyXr+M34GY56LO8qq4J/7rnY=; b=CucSzhZGPNfe0jMeR6+7gZiTCWGaiNv7mkaewUln9JtiPksvG9agH2uvIuwggw6F3Y wSddaAiZaZzDY0Xa+Rx5BqT9WHi/hz/+4cXvngfGZL5GFqMd3JDz4kk9RP3Shw3U5dif 32Sd9MTDcrgdbCJO1Y35R4eQIksY9GOPr1BUs/PNDgLLBepGyaWkqOczwoEllpQ98PdX Ib9dMlWzFAk+y5S622zizLgg8SbOVhSdQj9wsaSBFGzW+tVxBpIvfWeH51LRDAxHrafn TMJSZ8xNS+rxbGJM1q51cpiRIqjXCKHE2QnVfhBVydVuzEcLDsVfR1fJcoWvpv/+o2pq g1CQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f7si2484129qte.231.2017.08.16.23.04.48; Wed, 16 Aug 2017 23:04:48 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 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 2BCF8644C4; Thu, 17 Aug 2017 06:04:48 +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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, 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 9B9A56083D; Thu, 17 Aug 2017 06:01:18 +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 DAC7360D2C; Thu, 17 Aug 2017 06:00:47 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id C916B60D83 for ; Thu, 17 Aug 2017 06:00:39 +0000 (UTC) Received: from mxback10o.mail.yandex.net (mxback10o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::24]) by forward104p.mail.yandex.net (Yandex) with ESMTP id F04E218282A for ; Thu, 17 Aug 2017 09:00:35 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback10o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 0H3GHV318e-0ZpGsWuY; Thu, 17 Aug 2017 09:00:35 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 3ZgkfM7k2j-0ZASIXYJ; Thu, 17 Aug 2017 09:00:35 +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, 17 Aug 2017 09:00:06 +0300 Message-Id: <1502949606-11291-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1502949606-11291-1-git-send-email-odpbot@yandex.ru> References: <1502949606-11291-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 128 Subject: [lng-odp] [PATCH CLOUD-DEV v11 3/3] travis: enable linux-dpdk in travis 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: Balakrishna Garapati Signed-off-by: Balakrishna Garapati --- /** Email created from pull request 128 (GBalakrishna:linux-dpdk-cloud) ** https://github.com/Linaro/odp/pull/128 ** Patch: https://github.com/Linaro/odp/pull/128.patch ** Base sha: 4e11ef454d383b9637541c53ad4eeda65751742b ** Merge commit sha: c8d95371d8b2c91052a43ca28a3dc3678ec82c0e **/ .travis.yml | 10 +++++++++- test/linux-dpdk/wrapper-script.sh | 4 ++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0d24cdc5..52339b53 100644 --- a/.travis.yml +++ b/.travis.yml @@ -133,6 +133,7 @@ install: make config T=${TARGET} O=${TARGET} pushd ${TARGET} sed -ri 's,(CONFIG_RTE_LIBRTE_PMD_PCAP=).*,\1y,' .config + sed -ri 's,(CONFIG_RTE_LIBRTE_PMD_OPENSSL=).*,\1y,' .config popd make install T=${TARGET} EXTRA_CFLAGS="-fPIC" rm -r ./doc ./${TARGET}/app ./${TARGET}/build @@ -256,7 +257,14 @@ jobs: - ODP_PATCHES=`echo ${TRAVIS_COMMIT_RANGE} | sed 's/\.//'`; - if [ -z "${ODP_PATCHES}" ]; then env; exit 1; fi; - ./scripts/ci-checkpatches.sh ${ODP_PATCHES}; - + - stage: test + env: TEST=linux-dpdk + compiler: gcc + script: + - ./bootstrap + - ./configure --with-platform=linux-dpdk --enable-test-cpp --enable-test-vald --enable-test-helper --enable-test-perf --enable-user-guides --enable-test-perf-proc --enable-test-example --with-sdk-install-path=`pwd`/dpdk/${TARGET} --with-cunit-path=$HOME/cunit-install/$CROSS_ARCH $CONF + - make -j $(nproc) + - sudo LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" make check after_failure: - cat config.log - find . -name 'test-suite.log' -execdir grep -il "FAILED" {} \; -exec echo {} \; -exec cat {} \; diff --git a/test/linux-dpdk/wrapper-script.sh b/test/linux-dpdk/wrapper-script.sh index 0dc2d23c..1fbb16f7 100755 --- a/test/linux-dpdk/wrapper-script.sh +++ b/test/linux-dpdk/wrapper-script.sh @@ -62,11 +62,11 @@ fi echo "running $1!" if [ ${1: -3} == ".sh" ] then - sudo TEST_DIR=${TEST_DIR} \ + TEST_DIR=${TEST_DIR} \ ODP_PLATFORM_PARAMS="$ODP_PLATFORM_PARAMS" \ ODP_GDB=$ODP_GDB $1 else - sudo TEST_DIR=${TEST_DIR} ODP_PLATFORM_PARAMS="$ODP_PLATFORM_PARAMS" \ + TEST_DIR=${TEST_DIR} ODP_PLATFORM_PARAMS="$ODP_PLATFORM_PARAMS" \ $ODP_GDB $1 fi res=$?