From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 43C89A00C4; Wed, 27 Jul 2022 10:14:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5403441147; Wed, 27 Jul 2022 10:14:31 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 4752B40DDD for ; Wed, 27 Jul 2022 10:14:30 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6777B23A; Wed, 27 Jul 2022 01:14:30 -0700 (PDT) Received: from net-arm-n1amp-02.shanghai.arm.com (net-arm-n1amp-02.shanghai.arm.com [10.169.210.108]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 704123F70D; Wed, 27 Jul 2022 01:14:26 -0700 (PDT) From: Ruifeng Wang To: roy.fan.zhang@intel.com, pablo.de.lara.guarch@intel.com, yipeng1.wang@intel.com, sameh.gobriel@intel.com, bruce.richardson@intel.com, vladimir.medvedkin@intel.com, gakhil@marvell.com Cc: dev@dpdk.org, honnappa.nagarahalli@arm.com, nd@arm.com, Ruifeng Wang Subject: [PATCH 2/2] crypto/ipsec_mb: enable IPsec on Arm platform Date: Wed, 27 Jul 2022 16:13:52 +0800 Message-Id: <20220727081352.1333695-3-ruifeng.wang@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220727081352.1333695-1-ruifeng.wang@arm.com> References: <20220727081352.1333695-1-ruifeng.wang@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Arm port of ipsec_mb library [1] has different header file name than the Intel ipsec_mb library. Proper header name is picked according to the architecture to get the code compile when ipsec_mb is installed on Arm platform. And the Arm port currently supports ZUC and SNOW3g. Call to other algorithms will be blocked. [1] https://gitlab.arm.com/arm-reference-solutions/ipsec-mb/-/tree/main Signed-off-by: Ruifeng Wang --- app/test/test_cryptodev_hash_test_vectors.h | 4 ++++ doc/guides/cryptodevs/snow3g.rst | 14 ++++++++++---- doc/guides/cryptodevs/zuc.rst | 14 ++++++++++---- drivers/common/qat/meson.build | 6 +++++- drivers/crypto/ipsec_mb/ipsec_mb_private.c | 6 ++++++ drivers/crypto/ipsec_mb/ipsec_mb_private.h | 4 ++++ drivers/crypto/ipsec_mb/meson.build | 6 +++++- drivers/crypto/qat/qat_sym_session.c | 4 ++++ 8 files changed, 48 insertions(+), 10 deletions(-) diff --git a/app/test/test_cryptodev_hash_test_vectors.h b/app/test/test_cryptodev_hash_test_vectors.h index f7a0981636..5bd7858de4 100644 --- a/app/test/test_cryptodev_hash_test_vectors.h +++ b/app/test/test_cryptodev_hash_test_vectors.h @@ -6,8 +6,12 @@ #define TEST_CRYPTODEV_HASH_TEST_VECTORS_H_ #ifdef RTE_CRYPTO_AESNI_MB +#if defined(RTE_ARCH_ARM) +#include +#else #include #endif +#endif static const uint8_t plaintext_hash[] = { "What a lousy earth! He wondered how many people " diff --git a/doc/guides/cryptodevs/snow3g.rst b/doc/guides/cryptodevs/snow3g.rst index ad97f7d913..02e857c0d2 100644 --- a/doc/guides/cryptodevs/snow3g.rst +++ b/doc/guides/cryptodevs/snow3g.rst @@ -33,11 +33,17 @@ Installation ------------ To build DPDK with the SNOW3G_PMD the user is required to download the multi-buffer -library from `here `_ -and compile it on their user system before building DPDK. +library and compile it on their user system before building DPDK. + +For x86 system, the multi-buffer library is available +`here `_. The latest version of the library supported by this PMD is v1.2, which can be downloaded from ``_. +For Arm system, ARM64 port of the multi-buffer library can be downloaded from +``_. The +latest version of the library supported by this PMD is tagged as SECLIB-IPSEC-2022.05.25. + After downloading the library, the user needs to unpack and compile it on their system before building DPDK: @@ -46,8 +52,8 @@ on their system before building DPDK: make make install -The library requires NASM to be built. Depending on the library version, it might -require a minimum NASM version (e.g. v0.54 requires at least NASM 2.14). +The library requires NASM to be built on x86. Depending on the library version, +it might require a minimum NASM version (e.g. v0.54 requires at least NASM 2.14). NASM is packaged for different OS. However, on some OS the version is too old, so a manual installation is required. In that case, NASM can be downloaded from diff --git a/doc/guides/cryptodevs/zuc.rst b/doc/guides/cryptodevs/zuc.rst index ea930ae152..10d44b7393 100644 --- a/doc/guides/cryptodevs/zuc.rst +++ b/doc/guides/cryptodevs/zuc.rst @@ -33,11 +33,17 @@ Installation ------------ To build DPDK with the ZUC_PMD the user is required to download the multi-buffer -library from `here `_ -and compile it on their user system before building DPDK. +library and compile it on their user system before building DPDK. + +For x86 system, the multi-buffer library is available +`here `_. The latest version of the library supported by this PMD is v1.2, which can be downloaded from ``_. +For Arm system, ARM64 port of the multi-buffer library can be downloaded from +``_. The +latest version of the library supported by this PMD is tagged as SECLIB-IPSEC-2022.05.25. + After downloading the library, the user needs to unpack and compile it on their system before building DPDK: @@ -46,8 +52,8 @@ on their system before building DPDK: make make install -The library requires NASM to be built. Depending on the library version, it might -require a minimum NASM version (e.g. v0.54 requires at least NASM 2.14). +The library requires NASM to be built on x86. Depending on the library version, +it might require a minimum NASM version (e.g. v0.54 requires at least NASM 2.14). NASM is packaged for different OS. However, on some OS the version is too old, so a manual installation is required. In that case, NASM can be downloaded from diff --git a/drivers/common/qat/meson.build b/drivers/common/qat/meson.build index 245c0fbe61..8e5116acb5 100644 --- a/drivers/common/qat/meson.build +++ b/drivers/common/qat/meson.build @@ -36,11 +36,15 @@ if qat_crypto and not libcrypto.found() endif IMB_required_ver = '1.2.0' +IMB_header = '#include' +if arch_subdir == 'arm' + IMB_header = '#include' +endif libipsecmb = cc.find_library('IPSec_MB', required: false) if libipsecmb.found() # version comes with quotes, so we split based on " and take the middle imb_ver = cc.get_define('IMB_VERSION_STR', - prefix : '#include').split('"')[1] + prefix : IMB_header).split('"')[1] if (imb_ver.version_compare('>=' + IMB_required_ver)) ext_deps += libipsecmb diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.c b/drivers/crypto/ipsec_mb/ipsec_mb_private.c index b555a28a0b..1bc9744f09 100644 --- a/drivers/crypto/ipsec_mb/ipsec_mb_private.c +++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.c @@ -53,6 +53,12 @@ ipsec_mb_create(struct rte_vdev_device *vdev, const char *name, *args; int retval; +#if defined(RTE_ARCH_ARM) + if ((pmd_type != IPSEC_MB_PMD_TYPE_SNOW3G) && + (pmd_type != IPSEC_MB_PMD_TYPE_ZUC)) + return -ENOTSUP; +#endif + #if defined(RTE_ARCH_ARM64) vector_mode = IPSEC_MB_ARM64; #elif defined(RTE_ARCH_X86_64) diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h index d0a1bcc360..d074b33133 100644 --- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h +++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h @@ -5,7 +5,11 @@ #ifndef _IPSEC_MB_PRIVATE_H_ #define _IPSEC_MB_PRIVATE_H_ +#if defined(RTE_ARCH_ARM) +#include +#else #include +#endif #include #include diff --git a/drivers/crypto/ipsec_mb/meson.build b/drivers/crypto/ipsec_mb/meson.build index a89b29d6c3..64fc22611d 100644 --- a/drivers/crypto/ipsec_mb/meson.build +++ b/drivers/crypto/ipsec_mb/meson.build @@ -8,6 +8,10 @@ if is_windows endif IMB_required_ver = '1.0.0' +IMB_header = '#include' +if arch_subdir == 'arm' + IMB_header = '#include' +endif lib = cc.find_library('IPSec_MB', required: false) if not lib.found() build = false @@ -17,7 +21,7 @@ else # version comes with quotes, so we split based on " and take the middle imb_ver = cc.get_define('IMB_VERSION_STR', - prefix : '#include').split('"')[1] + prefix : IMB_header).split('"')[1] if (imb_ver == '') or (imb_ver.version_compare('<' + IMB_required_ver)) reason = 'IPSec_MB version >= @0@ is required, found version @1@'.format( diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index b30396487e..59922cb824 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -10,8 +10,12 @@ #include /* Needed for bpi runt block processing */ #ifdef RTE_QAT_LIBIPSECMB +#if defined(RTE_ARCH_ARM) +#include +#else #include #endif +#endif #include #include -- 2.25.1