From patchwork Tue Mar 12 13:50:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Dooley X-Patchwork-Id: 138212 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 857F643C92; Tue, 12 Mar 2024 14:50:32 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0CF4140689; Tue, 12 Mar 2024 14:50:32 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by mails.dpdk.org (Postfix) with ESMTP id EDE2A40282 for ; Tue, 12 Mar 2024 14:50:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710251430; x=1741787430; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Dr22EuaKnwte5xvQKPzK5Ba+g91EJtNeGf0jUWJeKuk=; b=DHhGpSdfDjyXtMZfC4l7NKM3IMy5kcFC0E5rv5BTqLOV0x7Ljyfvntfs fljEf9bkJ+bLHHGcl3l6qegAofkjxMvtqeY+FSePI0yB8Rb5Stxs1uDv+ r42JPhBDAV6lPO8+Fw2BZ6yK1IX0HSckHMr6TfVEuhJPWneIZT5KTUfch A3m3dA9zD6Y5cvC3ZxlbPPVx6/7sX7hIw/s5/CQW5f5z6ips9dTDC6laS 6qtaQhJAqr7eRdOw9VJvMK6fCHus74hPL1dQcyqbNd1QogiEzVV3FXw1y rhiq7ZlrOoR9aYHN55p0a1rg6qjTEJgzc2JA4IkEcG56hsBt1xaJ391RG Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="5081141" X-IronPort-AV: E=Sophos;i="6.07,119,1708416000"; d="scan'208";a="5081141" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2024 06:50:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,119,1708416000"; d="scan'208";a="11466537" Received: from unknown (HELO silpixa00400886.ir.intel.com) ([10.243.23.150]) by fmviesa009.fm.intel.com with ESMTP; 12 Mar 2024 06:50:24 -0700 From: Brian Dooley To: Aaron Conole , Michael Santana Cc: dev@dpdk.org, gakhil@marvell.com, pablo.de.lara.guarch@intel.com, probb@iol.unh.edu, wathsala.vithanage@arm.com, Ciara Power Subject: [PATCH v6 1/5] ci: replace IPsec-mb package install Date: Tue, 12 Mar 2024 13:50:15 +0000 Message-Id: <20240312135020.2969533-1-brian.dooley@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231212153640.1561504-1-brian.dooley@intel.com> References: <20231212153640.1561504-1-brian.dooley@intel.com> MIME-Version: 1.0 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 From: Ciara Power The IPsec-mb version that is available through current package managers is 1.2. This release moves the minimum required IPsec-mb version for IPsec-mb based SW PMDs to 1.4. To compile these PMDs, a manual step is added to install IPsec-mb v1.4 using dpkg. Signed-off-by: Ciara Power --- .github/workflows/build.yml | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 776fbf6f30..ed44b1f730 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -106,9 +106,15 @@ jobs: run: sudo apt update || true - name: Install packages run: sudo apt install -y ccache libarchive-dev libbsd-dev libbpf-dev - libfdt-dev libibverbs-dev libipsec-mb-dev libisal-dev libjansson-dev + libfdt-dev libibverbs-dev libisal-dev libjansson-dev libnuma-dev libpcap-dev libssl-dev ninja-build pkg-config python3-pip python3-pyelftools python3-setuptools python3-wheel zlib1g-dev + - name: Install ipsec-mb library + run: | + wget "https://launchpad.net/ubuntu/+archive/primary/+files/libipsec-mb-dev_1.4-3_amd64.deb" + wget "https://launchpad.net/ubuntu/+archive/primary/+files/libipsec-mb1_1.4-3_amd64.deb" + sudo dpkg -i libipsec-mb1_1.4-3_amd64.deb + sudo dpkg -i libipsec-mb-dev_1.4-3_amd64.deb - name: Install libabigail build dependencies if no cache is available if: env.ABI_CHECKS == 'true' && steps.libabigail-cache.outputs.cache-hit != 'true' run: sudo apt install -y autoconf automake libdw-dev libtool libxml2-dev @@ -187,11 +193,18 @@ jobs: run: docker exec -i dpdk dnf update -y - name: Install packages if: steps.image_cache.outputs.cache-hit != 'true' - run: docker exec -i dpdk dnf install -y ccache intel-ipsec-mb-devel + run: docker exec -i dpdk dnf install -y ccache isa-l-devel jansson-devel libarchive-devel libatomic libbsd-devel libbpf-devel libfdt-devel libpcap-devel libxdp-devel ninja-build numactl-devel openssl-devel python3-pip python3-pyelftools python3-setuptools python3-wheel rdma-core-devel zlib-devel + - name: Install ipsec-mb library + if: steps.image_cache.outputs.cache-hit != 'true' + run: | + wget "https://launchpad.net/ubuntu/+archive/primary/+files/libipsec-mb-dev_1.4-3_amd64.deb" + wget "https://launchpad.net/ubuntu/+archive/primary/+files/libipsec-mb1_1.4-3_amd64.deb" + sudo dpkg -i libipsec-mb1_1.4-3_amd64.deb + sudo dpkg -i libipsec-mb-dev_1.4-3_amd64.deb - name: Save image in cache if: steps.image_cache.outputs.cache-hit != 'true' run: | @@ -262,12 +275,18 @@ jobs: - name: Update run: docker exec -i dpdk dnf update -y || true - name: Install packages - run: docker exec -i dpdk dnf install -y ccache intel-ipsec-mb-devel + run: docker exec -i dpdk dnf install -y ccache isa-l-devel jansson-devel libarchive-devel libatomic libbsd-devel libbpf-devel libfdt-devel libpcap-devel libxdp-devel ninja-build numactl-devel openssl-devel python3-pip python3-pyelftools python3-setuptools python3-wheel rdma-core-devel zlib-devel ${{ matrix.config.compiler }} + - name: Install ipsec-mb library + run: | + wget "https://launchpad.net/ubuntu/+archive/primary/+files/libipsec-mb-dev_1.4-3_amd64.deb" + wget "https://launchpad.net/ubuntu/+archive/primary/+files/libipsec-mb1_1.4-3_amd64.deb" + sudo dpkg -i libipsec-mb1_1.4-3_amd64.deb + sudo dpkg -i libipsec-mb-dev_1.4-3_amd64.deb - name: Run setup run: docker exec -i dpdk .ci/linux-setup.sh - name: Build From patchwork Tue Mar 12 13:50:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Dooley X-Patchwork-Id: 138213 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 06ABC43C92; Tue, 12 Mar 2024 14:50:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3456B40EF0; Tue, 12 Mar 2024 14:50:33 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by mails.dpdk.org (Postfix) with ESMTP id 9D21E402D8 for ; Tue, 12 Mar 2024 14:50:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710251431; x=1741787431; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Y6g6Cqby1zP7U913HHJDEF3qxS2d6SQ/gCX8z6bNtVs=; b=EdKr/Oyzjp1tmkE4RC1wJy+PYvdVjBmssC1cgzLMmS1N91UgYw9pdFvn JY+URqV+9y/MD0Rtq1lO79JP944WcKjFRl+Q15v3nAm9diQCd3XIgJfrc teYl/zBG8VUfW9xHIAxfZLcSJuw6ae9f5uy65Ise2XWmKfSY+dc/anYo6 wz9KsMlnLvzbSIvpIGZ7ayCmo+a23SpVfebCeUdd8XfEMbZvFm5vP12gZ ntCYaAEGRSckpONR6/KJ8np3dRfx+OqR9V6tHhqr5LYrPYPrbwBgrM9fE eql+qM7sFo+739wZWiucQOki0MdYvdZDqYm62NdaEzBU0utQroYH6/649 g==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="5081148" X-IronPort-AV: E=Sophos;i="6.07,119,1708416000"; d="scan'208";a="5081148" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2024 06:50:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,119,1708416000"; d="scan'208";a="11466544" Received: from unknown (HELO silpixa00400886.ir.intel.com) ([10.243.23.150]) by fmviesa009.fm.intel.com with ESMTP; 12 Mar 2024 06:50:27 -0700 From: Brian Dooley To: Kai Ji , Pablo de Lara Cc: dev@dpdk.org, gakhil@marvell.com, aconole@redhat.com, probb@iol.unh.edu, wathsala.vithanage@arm.com, Sivaramakrishnan Venkat , Ciara Power Subject: [PATCH v6 2/5] crypto/ipsec_mb: bump minimum IPsec Multi-buffer version Date: Tue, 12 Mar 2024 13:50:16 +0000 Message-Id: <20240312135020.2969533-2-brian.dooley@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240312135020.2969533-1-brian.dooley@intel.com> References: <20231212153640.1561504-1-brian.dooley@intel.com> <20240312135020.2969533-1-brian.dooley@intel.com> MIME-Version: 1.0 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 From: Sivaramakrishnan Venkat SW PMDs increment IPsec Multi-buffer version to 1.4. A minimum IPsec Multi-buffer version of 1.4 or greater is now required. Signed-off-by: Sivaramakrishnan Venkat Acked-by: Ciara Power Acked-by: Pablo de Lara Acked-by: Wathsala Vithanage --- v5: - Rebased and added to patchset v4: - 24.03 release notes updated to bump minimum IPSec Multi-buffer version to 1.4 for SW PMDs. v2: - Removed unused macro in ipsec_mb_ops.c - set_gcm_job() modified correctly to keep multi_sgl_job line - Updated SW PMDs documentation for minimum IPSec Multi-buffer version - Updated commit message, and patch title. --- doc/guides/cryptodevs/aesni_gcm.rst | 3 +- doc/guides/cryptodevs/aesni_mb.rst | 3 +- doc/guides/cryptodevs/chacha20_poly1305.rst | 3 +- doc/guides/cryptodevs/kasumi.rst | 3 +- doc/guides/cryptodevs/snow3g.rst | 3 +- doc/guides/cryptodevs/zuc.rst | 3 +- doc/guides/rel_notes/release_24_03.rst | 4 + drivers/crypto/ipsec_mb/ipsec_mb_ops.c | 23 --- drivers/crypto/ipsec_mb/meson.build | 2 +- drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 165 -------------------- drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h | 9 -- 11 files changed, 17 insertions(+), 204 deletions(-) diff --git a/doc/guides/cryptodevs/aesni_gcm.rst b/doc/guides/cryptodevs/aesni_gcm.rst index f5773426ee..dc665e536c 100644 --- a/doc/guides/cryptodevs/aesni_gcm.rst +++ b/doc/guides/cryptodevs/aesni_gcm.rst @@ -85,7 +85,8 @@ and the external crypto libraries supported by them: 18.05 - 19.02 Multi-buffer library 0.49 - 0.52 19.05 - 20.08 Multi-buffer library 0.52 - 0.55 20.11 - 21.08 Multi-buffer library 0.53 - 1.3* - 21.11+ Multi-buffer library 1.0 - 1.5* + 21.11 - 23.11 Multi-buffer library 1.0 - 1.5* + 24.03+ Multi-buffer library 1.4 - 1.5* ============= ================================ \* Multi-buffer library 1.0 or newer only works for Meson but not Make build system. diff --git a/doc/guides/cryptodevs/aesni_mb.rst b/doc/guides/cryptodevs/aesni_mb.rst index b2e74ba417..5d670ee237 100644 --- a/doc/guides/cryptodevs/aesni_mb.rst +++ b/doc/guides/cryptodevs/aesni_mb.rst @@ -146,7 +146,8 @@ and the Multi-Buffer library version supported by them: 19.05 - 19.08 0.52 19.11 - 20.08 0.52 - 0.55 20.11 - 21.08 0.53 - 1.3* - 21.11+ 1.0 - 1.5* + 21.11 - 23.11 1.0 - 1.5* + 24.03+ 1.4 - 1.5* ============== ============================ \* Multi-buffer library 1.0 or newer only works for Meson but not Make build system. diff --git a/doc/guides/cryptodevs/chacha20_poly1305.rst b/doc/guides/cryptodevs/chacha20_poly1305.rst index 9d4bf86cf1..c32866b301 100644 --- a/doc/guides/cryptodevs/chacha20_poly1305.rst +++ b/doc/guides/cryptodevs/chacha20_poly1305.rst @@ -72,7 +72,8 @@ and the external crypto libraries supported by them: ============= ================================ DPDK version Crypto library version ============= ================================ - 21.11+ Multi-buffer library 1.0-1.5* + 21.11 - 23.11 Multi-buffer library 1.0-1.5* + 24.03+ Multi-buffer library 1.4-1.5* ============= ================================ \* Multi-buffer library 1.0 or newer only works for Meson but not Make build system. diff --git a/doc/guides/cryptodevs/kasumi.rst b/doc/guides/cryptodevs/kasumi.rst index 0989054875..a8f4e6b204 100644 --- a/doc/guides/cryptodevs/kasumi.rst +++ b/doc/guides/cryptodevs/kasumi.rst @@ -87,7 +87,8 @@ and the external crypto libraries supported by them: ============= ================================ 16.11 - 19.11 LibSSO KASUMI 20.02 - 21.08 Multi-buffer library 0.53 - 1.3* - 21.11+ Multi-buffer library 1.0 - 1.5* + 21.11 - 23.11 Multi-buffer library 1.0 - 1.5* + 24.03+ Multi-buffer library 1.4 - 1.5* ============= ================================ \* Multi-buffer library 1.0 or newer only works for Meson but not Make build system. diff --git a/doc/guides/cryptodevs/snow3g.rst b/doc/guides/cryptodevs/snow3g.rst index 3392932653..46863462e5 100644 --- a/doc/guides/cryptodevs/snow3g.rst +++ b/doc/guides/cryptodevs/snow3g.rst @@ -96,7 +96,8 @@ and the external crypto libraries supported by them: ============= ================================ 16.04 - 19.11 LibSSO SNOW3G 20.02 - 21.08 Multi-buffer library 0.53 - 1.3* - 21.11+ Multi-buffer library 1.0 - 1.5* + 21.11 - 23.11 Multi-buffer library 1.0 - 1.5* + 24.03+ Multi-buffer library 1.4 - 1.5* ============= ================================ \* Multi-buffer library 1.0 or newer only works for Meson but not Make build system. diff --git a/doc/guides/cryptodevs/zuc.rst b/doc/guides/cryptodevs/zuc.rst index a414b5ad2c..51867e1a16 100644 --- a/doc/guides/cryptodevs/zuc.rst +++ b/doc/guides/cryptodevs/zuc.rst @@ -95,7 +95,8 @@ and the external crypto libraries supported by them: ============= ================================ 16.11 - 19.11 LibSSO ZUC 20.02 - 21.08 Multi-buffer library 0.53 - 1.3* - 21.11+ Multi-buffer library 1.0 - 1.5* + 21.11 - 23.11 Multi-buffer library 1.0 - 1.5* + 24.03+ Multi-buffer library 1.4 - 1.5* ============= ================================ \* Multi-buffer library 1.0 or newer only works for Meson but not Make build system. diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst index 78590c047b..8fa8cf1dd6 100644 --- a/doc/guides/rel_notes/release_24_03.rst +++ b/doc/guides/rel_notes/release_24_03.rst @@ -144,6 +144,10 @@ New Features * Added support for GEN LCE (1454) device, for AES-GCM only. * Enabled support for virtual QAT - vQAT (0da5) devices in QAT crypto driver. +* **Updated ipsec_mb crypto driver.** + + * Bump minimum IPSec Multi-buffer version to 1.4 for SW PMDs. + * **Updated Marvell cnxk crypto driver.** * Added support for Rx inject in crypto_cn10k. diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c index f21f9cc5a0..d25c671d7d 100644 --- a/drivers/crypto/ipsec_mb/ipsec_mb_ops.c +++ b/drivers/crypto/ipsec_mb/ipsec_mb_ops.c @@ -11,7 +11,6 @@ #include "ipsec_mb_private.h" -#define IMB_MP_REQ_VER_STR "1.1.0" /** Configure device */ int @@ -147,15 +146,10 @@ ipsec_mb_qp_release(struct rte_cryptodev *dev, uint16_t qp_id) if (rte_eal_process_type() == RTE_PROC_PRIMARY) { rte_ring_free(rte_ring_lookup(qp->name)); -#if IMB_VERSION(1, 1, 0) > IMB_VERSION_NUM - if (qp->mb_mgr) - free_mb_mgr(qp->mb_mgr); -#else if (qp->mb_mgr_mz) { rte_memzone_free(qp->mb_mgr_mz); qp->mb_mgr = NULL; } -#endif rte_free(qp); dev->data->queue_pairs[qp_id] = NULL; } else { /* secondary process */ @@ -211,7 +205,6 @@ static struct rte_ring RING_F_SP_ENQ | RING_F_SC_DEQ); } -#if IMB_VERSION(1, 1, 0) <= IMB_VERSION_NUM static IMB_MGR * ipsec_mb_alloc_mgr_from_memzone(const struct rte_memzone **mb_mgr_mz, const char *mb_mgr_mz_name) @@ -244,7 +237,6 @@ ipsec_mb_alloc_mgr_from_memzone(const struct rte_memzone **mb_mgr_mz, } return mb_mgr; } -#endif /** Setup a queue pair */ int @@ -260,12 +252,6 @@ ipsec_mb_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, int ret; if (rte_eal_process_type() == RTE_PROC_SECONDARY) { -#if IMB_VERSION(1, 1, 0) > IMB_VERSION_NUM - IPSEC_MB_LOG(ERR, "The intel-ipsec-mb version (%s) does not support multiprocess," - "the minimum version required for this feature is %s.", - IMB_VERSION_STR, IMB_MP_REQ_VER_STR); - return -EINVAL; -#endif qp = dev->data->queue_pairs[qp_id]; if (qp == NULL) { IPSEC_MB_LOG(DEBUG, "Secondary process setting up device qp."); @@ -285,15 +271,11 @@ ipsec_mb_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, return -ENOMEM; } -#if IMB_VERSION(1, 1, 0) > IMB_VERSION_NUM - qp->mb_mgr = alloc_init_mb_mgr(); -#else char mz_name[IPSEC_MB_MAX_MZ_NAME]; snprintf(mz_name, sizeof(mz_name), "IMB_MGR_DEV_%d_QP_%d", dev->data->dev_id, qp_id); qp->mb_mgr = ipsec_mb_alloc_mgr_from_memzone(&(qp->mb_mgr_mz), mz_name); -#endif if (qp->mb_mgr == NULL) { ret = -ENOMEM; goto qp_setup_cleanup; @@ -330,15 +312,10 @@ ipsec_mb_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, return 0; qp_setup_cleanup: -#if IMB_VERSION(1, 1, 0) > IMB_VERSION_NUM - if (qp->mb_mgr) - free_mb_mgr(qp->mb_mgr); -#else if (rte_eal_process_type() == RTE_PROC_SECONDARY) return ret; if (qp->mb_mgr_mz) rte_memzone_free(qp->mb_mgr_mz); -#endif rte_free(qp); return ret; } diff --git a/drivers/crypto/ipsec_mb/meson.build b/drivers/crypto/ipsec_mb/meson.build index 87bf965554..0c988d7411 100644 --- a/drivers/crypto/ipsec_mb/meson.build +++ b/drivers/crypto/ipsec_mb/meson.build @@ -7,7 +7,7 @@ if is_windows subdir_done() endif -IMB_required_ver = '1.0.0' +IMB_required_ver = '1.4.0' IMB_header = '#include' if arch_subdir == 'arm' IMB_header = '#include' diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c index 4de4866cf3..b93267f1c3 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c @@ -210,13 +210,9 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, } } else if (xform->auth.key.length == 32) { sess->template_job.hash_alg = IMB_AUTH_ZUC256_EIA3_BITLEN; -#if IMB_VERSION(1, 2, 0) < IMB_VERSION_NUM if (sess->auth.req_digest_len != 4 && sess->auth.req_digest_len != 8 && sess->auth.req_digest_len != 16) { -#else - if (sess->auth.req_digest_len != 4) { -#endif IPSEC_MB_LOG(ERR, "Invalid digest size\n"); return -EINVAL; } @@ -845,11 +841,9 @@ aesni_mb_session_configure(IMB_MGR *mb_mgr, } } -#if IMB_VERSION(1, 3, 0) < IMB_VERSION_NUM sess->session_id = imb_set_session(mb_mgr, &sess->template_job); sess->pid = getpid(); RTE_PER_LCORE(pid) = sess->pid; -#endif return 0; } @@ -982,9 +976,7 @@ aesni_mb_set_docsis_sec_session_parameters( goto error_exit; } -#if IMB_VERSION(1, 3, 0) < IMB_VERSION_NUM ipsec_sess->session_id = imb_set_session(mb_mgr, &ipsec_sess->template_job); -#endif error_exit: free_mb_mgr(mb_mgr); @@ -1239,7 +1231,6 @@ imb_lib_support_sgl_algo(IMB_CIPHER_MODE alg) return 0; } -#if IMB_VERSION(1, 2, 0) < IMB_VERSION_NUM static inline int single_sgl_job(IMB_JOB *job, struct rte_crypto_op *op, int oop, uint32_t offset, struct rte_mbuf *m_src, @@ -1324,7 +1315,6 @@ single_sgl_job(IMB_JOB *job, struct rte_crypto_op *op, job->sgl_io_segs = sgl_segs; return 0; } -#endif static inline int multi_sgl_job(IMB_JOB *job, struct rte_crypto_op *op, @@ -1394,9 +1384,7 @@ set_gcm_job(IMB_MGR *mb_mgr, IMB_JOB *job, const uint8_t sgl, job->msg_len_to_hash_in_bytes = 0; job->msg_len_to_cipher_in_bytes = 0; job->cipher_start_src_offset_in_bytes = 0; -#if IMB_VERSION(1, 3, 0) < IMB_VERSION_NUM imb_set_session(mb_mgr, job); -#endif } else { job->hash_start_src_offset_in_bytes = op->sym->aead.data.offset; @@ -1424,13 +1412,11 @@ set_gcm_job(IMB_MGR *mb_mgr, IMB_JOB *job, const uint8_t sgl, job->src = NULL; job->dst = NULL; -#if IMB_VERSION(1, 2, 0) < IMB_VERSION_NUM if (m_src->nb_segs <= MAX_NUM_SEGS) return single_sgl_job(job, op, oop, m_offset, m_src, m_dst, qp_data->sgl_segs); else -#endif return multi_sgl_job(job, op, oop, m_offset, m_src, m_dst, mb_mgr); } else { @@ -1520,10 +1506,6 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, uint8_t sgl = 0; uint8_t lb_sgl = 0; -#if IMB_VERSION(1, 3, 0) >= IMB_VERSION_NUM - (void) pid; -#endif - session = ipsec_mb_get_session_private(qp, op); if (session == NULL) { op->status = RTE_CRYPTO_OP_STATUS_INVALID_SESSION; @@ -1533,12 +1515,10 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, const IMB_CIPHER_MODE cipher_mode = session->template_job.cipher_mode; -#if IMB_VERSION(1, 3, 0) < IMB_VERSION_NUM if (session->pid != pid) { memcpy(job, &session->template_job, sizeof(IMB_JOB)); imb_set_session(mb_mgr, job); } else if (job->session_id != session->session_id) -#endif memcpy(job, &session->template_job, sizeof(IMB_JOB)); if (!op->sym->m_dst) { @@ -1579,9 +1559,7 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, job->u.GCM.ctx = &qp_data->gcm_sgl_ctx; job->cipher_mode = IMB_CIPHER_GCM_SGL; job->hash_alg = IMB_AUTH_GCM_SGL; -#if IMB_VERSION(1, 3, 0) < IMB_VERSION_NUM imb_set_session(mb_mgr, job); -#endif } break; case IMB_AUTH_AES_GMAC_128: @@ -1606,9 +1584,7 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, job->u.CHACHA20_POLY1305.ctx = &qp_data->chacha_sgl_ctx; job->cipher_mode = IMB_CIPHER_CHACHA20_POLY1305_SGL; job->hash_alg = IMB_AUTH_CHACHA20_POLY1305_SGL; -#if IMB_VERSION(1, 3, 0) < IMB_VERSION_NUM imb_set_session(mb_mgr, job); -#endif } break; default: @@ -1804,13 +1780,11 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, if (lb_sgl) return handle_sgl_linear(job, op, m_offset, session); -#if IMB_VERSION(1, 2, 0) < IMB_VERSION_NUM if (m_src->nb_segs <= MAX_NUM_SEGS) return single_sgl_job(job, op, oop, m_offset, m_src, m_dst, qp_data->sgl_segs); else -#endif return multi_sgl_job(job, op, oop, m_offset, m_src, m_dst, mb_mgr); } @@ -2130,7 +2104,6 @@ set_job_null_op(IMB_JOB *job, struct rte_crypto_op *op) return job; } -#if IMB_VERSION(1, 2, 0) < IMB_VERSION_NUM static uint16_t aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, uint16_t nb_ops) @@ -2263,144 +2236,6 @@ aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, return processed_jobs; } -#else - -/** - * Process a completed IMB_JOB job and keep processing jobs until - * get_completed_job return NULL - * - * @param qp Queue Pair to process - * @param mb_mgr IMB_MGR to use - * @param job IMB_JOB job - * @param ops crypto ops to fill - * @param nb_ops number of crypto ops - * - * @return - * - Number of processed jobs - */ -static unsigned -handle_completed_jobs(struct ipsec_mb_qp *qp, IMB_MGR *mb_mgr, - IMB_JOB *job, struct rte_crypto_op **ops, - uint16_t nb_ops) -{ - struct rte_crypto_op *op = NULL; - uint16_t processed_jobs = 0; - - while (job != NULL) { - op = post_process_mb_job(qp, job); - - if (op) { - ops[processed_jobs++] = op; - qp->stats.dequeued_count++; - } else { - qp->stats.dequeue_err_count++; - break; - } - if (processed_jobs == nb_ops) - break; - - job = IMB_GET_COMPLETED_JOB(mb_mgr); - } - - return processed_jobs; -} - -static inline uint16_t -flush_mb_mgr(struct ipsec_mb_qp *qp, IMB_MGR *mb_mgr, - struct rte_crypto_op **ops, uint16_t nb_ops) -{ - int processed_ops = 0; - - /* Flush the remaining jobs */ - IMB_JOB *job = IMB_FLUSH_JOB(mb_mgr); - - if (job) - processed_ops += handle_completed_jobs(qp, mb_mgr, job, - &ops[processed_ops], nb_ops - processed_ops); - - return processed_ops; -} - -static uint16_t -aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, - uint16_t nb_ops) -{ - struct ipsec_mb_qp *qp = queue_pair; - IMB_MGR *mb_mgr = qp->mb_mgr; - struct rte_crypto_op *op; - IMB_JOB *job; - int retval, processed_jobs = 0; - pid_t pid = 0; - - if (unlikely(nb_ops == 0 || mb_mgr == NULL)) - return 0; - - uint8_t digest_idx = qp->digest_idx; - - do { - /* Get next free mb job struct from mb manager */ - job = IMB_GET_NEXT_JOB(mb_mgr); - if (unlikely(job == NULL)) { - /* if no free mb job structs we need to flush mb_mgr */ - processed_jobs += flush_mb_mgr(qp, mb_mgr, - &ops[processed_jobs], - nb_ops - processed_jobs); - - if (nb_ops == processed_jobs) - break; - - job = IMB_GET_NEXT_JOB(mb_mgr); - } - - /* - * Get next operation to process from ingress queue. - * There is no need to return the job to the IMB_MGR - * if there are no more operations to process, since the IMB_MGR - * can use that pointer again in next get_next calls. - */ - retval = rte_ring_dequeue(qp->ingress_queue, (void **)&op); - if (retval < 0) - break; - - if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) - retval = set_sec_mb_job_params(job, qp, op, - &digest_idx); - else - retval = set_mb_job_params(job, qp, op, - &digest_idx, mb_mgr, pid); - - if (unlikely(retval != 0)) { - qp->stats.dequeue_err_count++; - set_job_null_op(job, op); - } - - /* Submit job to multi-buffer for processing */ -#ifdef RTE_LIBRTE_PMD_AESNI_MB_DEBUG - job = IMB_SUBMIT_JOB(mb_mgr); -#else - job = IMB_SUBMIT_JOB_NOCHECK(mb_mgr); -#endif - /* - * If submit returns a processed job then handle it, - * before submitting subsequent jobs - */ - if (job) - processed_jobs += handle_completed_jobs(qp, mb_mgr, - job, &ops[processed_jobs], - nb_ops - processed_jobs); - - } while (processed_jobs < nb_ops); - - qp->digest_idx = digest_idx; - - if (processed_jobs < 1) - processed_jobs += flush_mb_mgr(qp, mb_mgr, - &ops[processed_jobs], - nb_ops - processed_jobs); - - return processed_jobs; -} -#endif static inline int check_crypto_sgl(union rte_crypto_sym_ofs so, const struct rte_crypto_sgl *sgl) { diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h index 85994fe5a1..51cfd7e2aa 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h @@ -17,9 +17,7 @@ #define HMAC_IPAD_VALUE (0x36) #define HMAC_OPAD_VALUE (0x5C) -#if IMB_VERSION(1, 2, 0) < IMB_VERSION_NUM #define MAX_NUM_SEGS 16 -#endif static const struct rte_cryptodev_capabilities aesni_mb_capabilities[] = { { /* MD5 HMAC */ @@ -567,13 +565,8 @@ static const struct rte_cryptodev_capabilities aesni_mb_capabilities[] = { }, .digest_size = { .min = 4, -#if IMB_VERSION(1, 2, 0) < IMB_VERSION_NUM .max = 16, .increment = 4 -#else - .max = 4, - .increment = 0 -#endif }, .iv_size = { .min = 16, @@ -730,9 +723,7 @@ struct aesni_mb_qp_data { * by the driver when verifying a digest provided * by the user (using authentication verify operation) */ -#if IMB_VERSION(1, 2, 0) < IMB_VERSION_NUM struct IMB_SGL_IOV sgl_segs[MAX_NUM_SEGS]; -#endif union { struct gcm_context_data gcm_sgl_ctx; struct chacha20_poly1305_context_data chacha_sgl_ctx; From patchwork Tue Mar 12 13:50:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Dooley X-Patchwork-Id: 138214 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D6B9643C92; Tue, 12 Mar 2024 14:50:44 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 697D341101; Tue, 12 Mar 2024 14:50:34 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by mails.dpdk.org (Postfix) with ESMTP id 0EF8E40282 for ; Tue, 12 Mar 2024 14:50:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710251432; x=1741787432; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=i3feDa+M4BkSSbyR9lNnPCEOvaHYJTDQ6KbdrjVQvKQ=; b=RZaxUPWrtHfxvxJjFM73G07aEGZ6HOe40lJriOHoR0EAHZUZF6ncShlA HsEz1zils33vYCg0qkQJcic8XrTrR0B/8y1lI6fyT1x6ZgtnJaqYg34ms MhIHau+e7CRMyN0YbKs5VHShTnNm4Xif/EkVATfH0//3SSTsHI+3/HvWf evCmyH/51Y6MYriyjuD+u7R1m5ZUN83z1xybV7CjZBrOBg2z0Zr/zaAuG 03r05MDK870JE5CPeXpwhMoCAtgVezgUbh4F6R72QTRKsx5N7u50qSV7p Js7mKoOUO8MHAuakNnnIwP3RQUZK5Dykcqi+r4pKqCxXbNycsSAXF5ntE g==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="5081155" X-IronPort-AV: E=Sophos;i="6.07,119,1708416000"; d="scan'208";a="5081155" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2024 06:50:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,119,1708416000"; d="scan'208";a="11466550" Received: from unknown (HELO silpixa00400886.ir.intel.com) ([10.243.23.150]) by fmviesa009.fm.intel.com with ESMTP; 12 Mar 2024 06:50:29 -0700 From: Brian Dooley To: Kai Ji , Pablo de Lara Cc: dev@dpdk.org, gakhil@marvell.com, aconole@redhat.com, probb@iol.unh.edu, wathsala.vithanage@arm.com, Sivaramakrishnan Venkat Subject: [PATCH v6 3/5] doc: remove outdated version details Date: Tue, 12 Mar 2024 13:50:17 +0000 Message-Id: <20240312135020.2969533-3-brian.dooley@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240312135020.2969533-1-brian.dooley@intel.com> References: <20231212153640.1561504-1-brian.dooley@intel.com> <20240312135020.2969533-1-brian.dooley@intel.com> MIME-Version: 1.0 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 From: Sivaramakrishnan Venkat SW PMDs documentation is updated to remove details of unsupported IPsec Multi-buffer versions.DPDK older than 20.11 is end of life. So, older DPDK versions are removed from the Crypto library version table. Signed-off-by: Sivaramakrishnan Venkat Acked-by: Pablo de Lara Acked-by: Wathsala Vithanage --- v5: - Rebased and added to patchset v3: - added second patch for outdated documentation updates. --- doc/guides/cryptodevs/aesni_gcm.rst | 19 +++--------------- doc/guides/cryptodevs/aesni_mb.rst | 22 +++------------------ doc/guides/cryptodevs/chacha20_poly1305.rst | 12 ++--------- doc/guides/cryptodevs/kasumi.rst | 14 +++---------- doc/guides/cryptodevs/snow3g.rst | 15 +++----------- doc/guides/cryptodevs/zuc.rst | 15 +++----------- 6 files changed, 17 insertions(+), 80 deletions(-) diff --git a/doc/guides/cryptodevs/aesni_gcm.rst b/doc/guides/cryptodevs/aesni_gcm.rst index dc665e536c..e38a03b78f 100644 --- a/doc/guides/cryptodevs/aesni_gcm.rst +++ b/doc/guides/cryptodevs/aesni_gcm.rst @@ -62,12 +62,6 @@ Once it is downloaded, extract it and follow these steps: make make install -.. note:: - - Compilation of the Multi-Buffer library is broken when GCC < 5.0, if library <= v0.53. - If a lower GCC version than 5.0, the workaround proposed by the following link - should be used: ``_. - As a reference, the following table shows a mapping between the past DPDK versions and the external crypto libraries supported by them: @@ -79,18 +73,11 @@ and the external crypto libraries supported by them: ============= ================================ DPDK version Crypto library version ============= ================================ - 16.04 - 16.11 Multi-buffer library 0.43 - 0.44 - 17.02 - 17.05 ISA-L Crypto v2.18 - 17.08 - 18.02 Multi-buffer library 0.46 - 0.48 - 18.05 - 19.02 Multi-buffer library 0.49 - 0.52 - 19.05 - 20.08 Multi-buffer library 0.52 - 0.55 - 20.11 - 21.08 Multi-buffer library 0.53 - 1.3* - 21.11 - 23.11 Multi-buffer library 1.0 - 1.5* - 24.03+ Multi-buffer library 1.4 - 1.5* + 20.11 - 21.08 Multi-buffer library 0.53 - 1.3 + 21.11 - 23.11 Multi-buffer library 1.0 - 1.5 + 24.03+ Multi-buffer library 1.4 - 1.5 ============= ================================ -\* Multi-buffer library 1.0 or newer only works for Meson but not Make build system. - Initialization -------------- diff --git a/doc/guides/cryptodevs/aesni_mb.rst b/doc/guides/cryptodevs/aesni_mb.rst index 5d670ee237..bd7c8de07f 100644 --- a/doc/guides/cryptodevs/aesni_mb.rst +++ b/doc/guides/cryptodevs/aesni_mb.rst @@ -121,12 +121,6 @@ Once it is downloaded, extract it and follow these steps: make make install -.. note:: - - Compilation of the Multi-Buffer library is broken when GCC < 5.0, if library <= v0.53. - If a lower GCC version than 5.0, the workaround proposed by the following link - should be used: ``_. - As a reference, the following table shows a mapping between the past DPDK versions and the Multi-Buffer library version supported by them: @@ -137,21 +131,11 @@ and the Multi-Buffer library version supported by them: ============== ============================ DPDK version Multi-buffer library version ============== ============================ - 2.2 - 16.11 0.43 - 0.44 - 17.02 0.44 - 17.05 - 17.08 0.45 - 0.48 - 17.11 0.47 - 0.48 - 18.02 0.48 - 18.05 - 19.02 0.49 - 0.52 - 19.05 - 19.08 0.52 - 19.11 - 20.08 0.52 - 0.55 - 20.11 - 21.08 0.53 - 1.3* - 21.11 - 23.11 1.0 - 1.5* - 24.03+ 1.4 - 1.5* + 20.11 - 21.08 0.53 - 1.3 + 21.11 - 23.11 1.0 - 1.5 + 24.03+ 1.4 - 1.5 ============== ============================ -\* Multi-buffer library 1.0 or newer only works for Meson but not Make build system. - Initialization -------------- diff --git a/doc/guides/cryptodevs/chacha20_poly1305.rst b/doc/guides/cryptodevs/chacha20_poly1305.rst index c32866b301..8e0ee4f835 100644 --- a/doc/guides/cryptodevs/chacha20_poly1305.rst +++ b/doc/guides/cryptodevs/chacha20_poly1305.rst @@ -56,12 +56,6 @@ Once it is downloaded, extract it and follow these steps: make make install -.. note:: - - Compilation of the Multi-Buffer library is broken when GCC < 5.0, if library <= v0.53. - If a lower GCC version than 5.0, the workaround proposed by the following link - should be used: ``_. - As a reference, the following table shows a mapping between the past DPDK versions and the external crypto libraries supported by them: @@ -72,12 +66,10 @@ and the external crypto libraries supported by them: ============= ================================ DPDK version Crypto library version ============= ================================ - 21.11 - 23.11 Multi-buffer library 1.0-1.5* - 24.03+ Multi-buffer library 1.4-1.5* + 21.11 - 23.11 Multi-buffer library 1.0-1.5 + 24.03+ Multi-buffer library 1.4-1.5 ============= ================================ -\* Multi-buffer library 1.0 or newer only works for Meson but not Make build system. - Initialization -------------- diff --git a/doc/guides/cryptodevs/kasumi.rst b/doc/guides/cryptodevs/kasumi.rst index a8f4e6b204..28ac452524 100644 --- a/doc/guides/cryptodevs/kasumi.rst +++ b/doc/guides/cryptodevs/kasumi.rst @@ -69,12 +69,6 @@ Once it is downloaded, extract it and follow these steps: make make install -.. note:: - - Compilation of the Multi-Buffer library is broken when GCC < 5.0, if library <= v0.53. - If a lower GCC version than 5.0, the workaround proposed by the following link - should be used: ``_. - As a reference, the following table shows a mapping between the past DPDK versions and the external crypto libraries supported by them: @@ -86,13 +80,11 @@ and the external crypto libraries supported by them: DPDK version Crypto library version ============= ================================ 16.11 - 19.11 LibSSO KASUMI - 20.02 - 21.08 Multi-buffer library 0.53 - 1.3* - 21.11 - 23.11 Multi-buffer library 1.0 - 1.5* - 24.03+ Multi-buffer library 1.4 - 1.5* + 20.11 - 21.08 Multi-buffer library 0.53 - 1.3 + 21.11 - 23.11 Multi-buffer library 1.0 - 1.5 + 24.03+ Multi-buffer library 1.4 - 1.5 ============= ================================ -\* Multi-buffer library 1.0 or newer only works for Meson but not Make build system. - Initialization -------------- diff --git a/doc/guides/cryptodevs/snow3g.rst b/doc/guides/cryptodevs/snow3g.rst index 46863462e5..0141f62976 100644 --- a/doc/guides/cryptodevs/snow3g.rst +++ b/doc/guides/cryptodevs/snow3g.rst @@ -78,12 +78,6 @@ Once it is downloaded, extract it and follow these steps: make make install -.. note:: - - Compilation of the Multi-Buffer library is broken when GCC < 5.0, if library <= v0.53. - If a lower GCC version than 5.0, the workaround proposed by the following link - should be used: ``_. - As a reference, the following table shows a mapping between the past DPDK versions and the external crypto libraries supported by them: @@ -94,14 +88,11 @@ and the external crypto libraries supported by them: ============= ================================ DPDK version Crypto library version ============= ================================ - 16.04 - 19.11 LibSSO SNOW3G - 20.02 - 21.08 Multi-buffer library 0.53 - 1.3* - 21.11 - 23.11 Multi-buffer library 1.0 - 1.5* - 24.03+ Multi-buffer library 1.4 - 1.5* + 20.11 - 21.08 Multi-buffer library 0.53 - 1.3 + 21.11 - 23.11 Multi-buffer library 1.0 - 1.5 + 24.03+ Multi-buffer library 1.4 - 1.5 ============= ================================ -\* Multi-buffer library 1.0 or newer only works for Meson but not Make build system. - Initialization -------------- diff --git a/doc/guides/cryptodevs/zuc.rst b/doc/guides/cryptodevs/zuc.rst index 51867e1a16..97c14c8c77 100644 --- a/doc/guides/cryptodevs/zuc.rst +++ b/doc/guides/cryptodevs/zuc.rst @@ -77,12 +77,6 @@ Once it is downloaded, extract it and follow these steps: make make install -.. note:: - - Compilation of the Multi-Buffer library is broken when GCC < 5.0, if library <= v0.53. - If a lower GCC version than 5.0, the workaround proposed by the following link - should be used: ``_. - As a reference, the following table shows a mapping between the past DPDK versions and the external crypto libraries supported by them: @@ -93,14 +87,11 @@ and the external crypto libraries supported by them: ============= ================================ DPDK version Crypto library version ============= ================================ - 16.11 - 19.11 LibSSO ZUC - 20.02 - 21.08 Multi-buffer library 0.53 - 1.3* - 21.11 - 23.11 Multi-buffer library 1.0 - 1.5* - 24.03+ Multi-buffer library 1.4 - 1.5* + 20.11 - 21.08 Multi-buffer library 0.53 - 1.3 + 21.11 - 23.11 Multi-buffer library 1.0 - 1.5 + 24.03+ Multi-buffer library 1.4 - 1.5 ============= ================================ -\* Multi-buffer library 1.0 or newer only works for Meson but not Make build system. - Initialization -------------- From patchwork Tue Mar 12 13:50:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Dooley X-Patchwork-Id: 138215 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E238143C92; Tue, 12 Mar 2024 14:50:53 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2DFC641151; Tue, 12 Mar 2024 14:50:37 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by mails.dpdk.org (Postfix) with ESMTP id 4D978410F9 for ; Tue, 12 Mar 2024 14:50:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710251434; x=1741787434; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9AstMcFi1xZdeP7zFepg0LBeduBOp/sZ5kx+CUGD8Zo=; b=dHImzfnGp8OzyKbja0aT6oyrYaQrun/qf9K1h3T5yZcOp3QRUiDlTGlW K2kpa33bjxRBj/SheErS9PLcJY9j+a2NaV+Pi7i7MJsBf5hzCokyuWR5R WyjQU3sJ9VcxHsTA7/VTNs/OWN4u9fTC/YMzs2/sxAhnFcSyLQeAAF500 wJ+5RUnNUhoILMB82nkbUs25kyA1RFrvUzq3M7XvirKkcLCOrgE4oQmSx Hp6Rj5uBD7r/deIfF+TGhL8jMsBMwdQOe2rHeoSAuXB8G1CxPrdbQ0g4Z WV6dBDMsPyPIrld673lt6y1E8v5lo5SZ62U75mAsX2AoSTPxThZOdBV20 A==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="5081162" X-IronPort-AV: E=Sophos;i="6.07,119,1708416000"; d="scan'208";a="5081162" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2024 06:50:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,119,1708416000"; d="scan'208";a="11466556" Received: from unknown (HELO silpixa00400886.ir.intel.com) ([10.243.23.150]) by fmviesa009.fm.intel.com with ESMTP; 12 Mar 2024 06:50:31 -0700 From: Brian Dooley To: Kai Ji , Pablo de Lara Cc: dev@dpdk.org, gakhil@marvell.com, aconole@redhat.com, probb@iol.unh.edu, wathsala.vithanage@arm.com, Brian Dooley , Ciara Power Subject: [PATCH v6 4/5] crypto/ipsec_mb: use new ipad/opad calculation API Date: Tue, 12 Mar 2024 13:50:18 +0000 Message-Id: <20240312135020.2969533-4-brian.dooley@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240312135020.2969533-1-brian.dooley@intel.com> References: <20231212153640.1561504-1-brian.dooley@intel.com> <20240312135020.2969533-1-brian.dooley@intel.com> MIME-Version: 1.0 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 IPSec Multi-buffer library v1.4 added a new API to calculate inner/outer padding for HMAC-SHAx/MD5. Signed-off-by: Pablo de Lara Signed-off-by: Brian Dooley Acked-by: Ciara Power Acked-by: Wathsala Vithanage --- v5: - Rebased and added to patchset v2: - Remove ipsec mb version checks --- drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 75 ++------------------------ 1 file changed, 5 insertions(+), 70 deletions(-) diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c index b93267f1c3..80ced1e4fe 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c @@ -13,49 +13,6 @@ struct aesni_mb_op_buf_data { uint32_t offset; }; -/** - * Calculate the authentication pre-computes - * - * @param one_block_hash Function pointer - * to calculate digest on ipad/opad - * @param ipad Inner pad output byte array - * @param opad Outer pad output byte array - * @param hkey Authentication key - * @param hkey_len Authentication key length - * @param blocksize Block size of selected hash algo - */ -static void -calculate_auth_precomputes(hash_one_block_t one_block_hash, - uint8_t *ipad, uint8_t *opad, - const uint8_t *hkey, uint16_t hkey_len, - uint16_t blocksize) -{ - uint32_t i, length; - - uint8_t ipad_buf[blocksize] __rte_aligned(16); - uint8_t opad_buf[blocksize] __rte_aligned(16); - - /* Setup inner and outer pads */ - memset(ipad_buf, HMAC_IPAD_VALUE, blocksize); - memset(opad_buf, HMAC_OPAD_VALUE, blocksize); - - /* XOR hash key with inner and outer pads */ - length = hkey_len > blocksize ? blocksize : hkey_len; - - for (i = 0; i < length; i++) { - ipad_buf[i] ^= hkey[i]; - opad_buf[i] ^= hkey[i]; - } - - /* Compute partial hashes */ - (*one_block_hash)(ipad_buf, ipad); - (*one_block_hash)(opad_buf, opad); - - /* Clean up stack */ - memset(ipad_buf, 0, blocksize); - memset(opad_buf, 0, blocksize); -} - static inline int is_aead_algo(IMB_HASH_ALG hash_alg, IMB_CIPHER_MODE cipher_mode) { @@ -66,12 +23,10 @@ is_aead_algo(IMB_HASH_ALG hash_alg, IMB_CIPHER_MODE cipher_mode) /** Set session authentication parameters */ static int -aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, +aesni_mb_set_session_auth_parameters(IMB_MGR *mb_mgr, struct aesni_mb_session *sess, const struct rte_crypto_sym_xform *xform) { - hash_one_block_t hash_oneblock_fn = NULL; - unsigned int key_larger_block_size = 0; uint8_t hashed_key[HMAC_MAX_BLOCK_SIZE] = { 0 }; uint32_t auth_precompute = 1; @@ -263,18 +218,15 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, switch (xform->auth.algo) { case RTE_CRYPTO_AUTH_MD5_HMAC: sess->template_job.hash_alg = IMB_AUTH_MD5; - hash_oneblock_fn = mb_mgr->md5_one_block; break; case RTE_CRYPTO_AUTH_SHA1_HMAC: sess->template_job.hash_alg = IMB_AUTH_HMAC_SHA_1; - hash_oneblock_fn = mb_mgr->sha1_one_block; if (xform->auth.key.length > get_auth_algo_blocksize( IMB_AUTH_HMAC_SHA_1)) { IMB_SHA1(mb_mgr, xform->auth.key.data, xform->auth.key.length, hashed_key); - key_larger_block_size = 1; } break; case RTE_CRYPTO_AUTH_SHA1: @@ -283,14 +235,12 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, break; case RTE_CRYPTO_AUTH_SHA224_HMAC: sess->template_job.hash_alg = IMB_AUTH_HMAC_SHA_224; - hash_oneblock_fn = mb_mgr->sha224_one_block; if (xform->auth.key.length > get_auth_algo_blocksize( IMB_AUTH_HMAC_SHA_224)) { IMB_SHA224(mb_mgr, xform->auth.key.data, xform->auth.key.length, hashed_key); - key_larger_block_size = 1; } break; case RTE_CRYPTO_AUTH_SHA224: @@ -299,14 +249,12 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, break; case RTE_CRYPTO_AUTH_SHA256_HMAC: sess->template_job.hash_alg = IMB_AUTH_HMAC_SHA_256; - hash_oneblock_fn = mb_mgr->sha256_one_block; if (xform->auth.key.length > get_auth_algo_blocksize( IMB_AUTH_HMAC_SHA_256)) { IMB_SHA256(mb_mgr, xform->auth.key.data, xform->auth.key.length, hashed_key); - key_larger_block_size = 1; } break; case RTE_CRYPTO_AUTH_SHA256: @@ -315,14 +263,12 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, break; case RTE_CRYPTO_AUTH_SHA384_HMAC: sess->template_job.hash_alg = IMB_AUTH_HMAC_SHA_384; - hash_oneblock_fn = mb_mgr->sha384_one_block; if (xform->auth.key.length > get_auth_algo_blocksize( IMB_AUTH_HMAC_SHA_384)) { IMB_SHA384(mb_mgr, xform->auth.key.data, xform->auth.key.length, hashed_key); - key_larger_block_size = 1; } break; case RTE_CRYPTO_AUTH_SHA384: @@ -331,14 +277,12 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, break; case RTE_CRYPTO_AUTH_SHA512_HMAC: sess->template_job.hash_alg = IMB_AUTH_HMAC_SHA_512; - hash_oneblock_fn = mb_mgr->sha512_one_block; if (xform->auth.key.length > get_auth_algo_blocksize( IMB_AUTH_HMAC_SHA_512)) { IMB_SHA512(mb_mgr, xform->auth.key.data, xform->auth.key.length, hashed_key); - key_larger_block_size = 1; } break; case RTE_CRYPTO_AUTH_SHA512: @@ -372,19 +316,10 @@ aesni_mb_set_session_auth_parameters(const IMB_MGR *mb_mgr, return 0; /* Calculate Authentication precomputes */ - if (key_larger_block_size) { - calculate_auth_precomputes(hash_oneblock_fn, - sess->auth.pads.inner, sess->auth.pads.outer, - hashed_key, - xform->auth.key.length, - get_auth_algo_blocksize(sess->template_job.hash_alg)); - } else { - calculate_auth_precomputes(hash_oneblock_fn, - sess->auth.pads.inner, sess->auth.pads.outer, - xform->auth.key.data, - xform->auth.key.length, - get_auth_algo_blocksize(sess->template_job.hash_alg)); - } + imb_hmac_ipad_opad(mb_mgr, sess->template_job.hash_alg, + xform->auth.key.data, xform->auth.key.length, + sess->auth.pads.inner, sess->auth.pads.outer); + sess->template_job.u.HMAC._hashed_auth_key_xor_ipad = sess->auth.pads.inner; sess->template_job.u.HMAC._hashed_auth_key_xor_opad = From patchwork Tue Mar 12 13:50:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Dooley X-Patchwork-Id: 138216 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A236643C92; Tue, 12 Mar 2024 14:51:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6C2F34113C; Tue, 12 Mar 2024 14:50:39 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by mails.dpdk.org (Postfix) with ESMTP id AD85B41156 for ; Tue, 12 Mar 2024 14:50:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710251438; x=1741787438; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hd8ER6SRSa3iTQkvw465eSdIIdfqs5c/dOuhz/KQ4VA=; b=e79nd5o3+u5HSPF8XL+PfVbMm8+jJrSZEihOvsKNsfYu9p6z9QecMGX9 rcYeRkOHxLa2JUZuRvmuOMM2kzPhX3sohKJeTvveHJBdZSE6kFal/2H4z tul+nPsPr0OXJ0pXh+oche8JNxzzGi2HsZeI5xRz8zkJlX3EpE9mhH1XD svz7KRGP5zYnLb/51e3N2qUNPDz0biwTjcp7Pd2fQL5ws2sDwAlA3+4En DowgDnZzghoxKOGIlU2gWk69NQs5fArJtUQdj0dhXfhWxEDzZXtQozFfe XC/p3taGHnBetEsqA39LObh09U5qH0v1WUeWjNY3gcWbgZIxPRtmKSCNG Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11010"; a="5081171" X-IronPort-AV: E=Sophos;i="6.07,119,1708416000"; d="scan'208";a="5081171" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2024 06:50:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,119,1708416000"; d="scan'208";a="11466567" Received: from unknown (HELO silpixa00400886.ir.intel.com) ([10.243.23.150]) by fmviesa009.fm.intel.com with ESMTP; 12 Mar 2024 06:50:33 -0700 From: Brian Dooley To: Kai Ji , Pablo de Lara Cc: dev@dpdk.org, gakhil@marvell.com, aconole@redhat.com, probb@iol.unh.edu, wathsala.vithanage@arm.com, Brian Dooley , Ciara Power Subject: [PATCH v6 5/5] crypto/ipsec_mb: unify some IPsec MB PMDs Date: Tue, 12 Mar 2024 13:50:19 +0000 Message-Id: <20240312135020.2969533-5-brian.dooley@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240312135020.2969533-1-brian.dooley@intel.com> References: <20231212153640.1561504-1-brian.dooley@intel.com> <20240312135020.2969533-1-brian.dooley@intel.com> MIME-Version: 1.0 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 Currently IPsec MB provides both the JOB API and direct API. AESNI_MB PMD is using the JOB API codepath while KASUMI and CHACHA20_POLY1305 are using the direct API. Instead of using the direct API for these PMDs, they should now make use of the JOB API codepath. This would remove all use of the IPsec MB direct API for these PMDs. Signed-off-by: Brian Dooley Acked-by: Ciara Power Acked-by: Wathsala Vithanage --- v6: - Reintroduce SNOW3G and ZUC PMDs v5: - Rebased and added patchset v4: - Keep AES GCM PMD and fix extern issue v3: - Remove session configure pointer for each PMD v2: - Fix compilation failure --- doc/guides/rel_notes/release_24_03.rst | 2 + drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 9 +- drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h | 15 +- drivers/crypto/ipsec_mb/pmd_chacha_poly.c | 338 +-------------- .../crypto/ipsec_mb/pmd_chacha_poly_priv.h | 28 -- drivers/crypto/ipsec_mb/pmd_kasumi.c | 410 +----------------- drivers/crypto/ipsec_mb/pmd_kasumi_priv.h | 20 - 7 files changed, 32 insertions(+), 790 deletions(-) diff --git a/doc/guides/rel_notes/release_24_03.rst b/doc/guides/rel_notes/release_24_03.rst index 8fa8cf1dd6..c9ddd120de 100644 --- a/doc/guides/rel_notes/release_24_03.rst +++ b/doc/guides/rel_notes/release_24_03.rst @@ -147,6 +147,8 @@ New Features * **Updated ipsec_mb crypto driver.** * Bump minimum IPSec Multi-buffer version to 1.4 for SW PMDs. + * Kasumi and ChaChaPoly PMDs now share the job API codepath + with AESNI_MB PMD. * **Updated Marvell cnxk crypto driver.** diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c index 80ced1e4fe..35bd7eaa51 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c @@ -8,6 +8,8 @@ RTE_DEFINE_PER_LCORE(pid_t, pid); +uint8_t pmd_driver_id_aesni_mb; + struct aesni_mb_op_buf_data { struct rte_mbuf *m; uint32_t offset; @@ -692,7 +694,7 @@ aesni_mb_set_session_aead_parameters(const IMB_MGR *mb_mgr, } /** Configure a aesni multi-buffer session from a crypto xform chain */ -static int +int aesni_mb_session_configure(IMB_MGR *mb_mgr, void *priv_sess, const struct rte_crypto_sym_xform *xform) @@ -2039,7 +2041,7 @@ set_job_null_op(IMB_JOB *job, struct rte_crypto_op *op) return job; } -static uint16_t +uint16_t aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, uint16_t nb_ops) { @@ -2171,6 +2173,7 @@ aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, return processed_jobs; } + static inline int check_crypto_sgl(union rte_crypto_sym_ofs so, const struct rte_crypto_sgl *sgl) { @@ -2226,7 +2229,7 @@ verify_sync_dgst(struct rte_crypto_sym_vec *vec, return k; } -static uint32_t +uint32_t aesni_mb_process_bulk(struct rte_cryptodev *dev __rte_unused, struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs sofs, struct rte_crypto_sym_vec *vec) diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h index 51cfd7e2aa..4805627679 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h @@ -19,6 +19,19 @@ #define MAX_NUM_SEGS 16 +int +aesni_mb_session_configure(IMB_MGR * m __rte_unused, void *priv_sess, + const struct rte_crypto_sym_xform *xform); + +uint16_t +aesni_mb_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, + uint16_t nb_ops); + +uint32_t +aesni_mb_process_bulk(struct rte_cryptodev *dev __rte_unused, + struct rte_cryptodev_sym_session *sess, union rte_crypto_sym_ofs sofs, + struct rte_crypto_sym_vec *vec); + static const struct rte_cryptodev_capabilities aesni_mb_capabilities[] = { { /* MD5 HMAC */ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, @@ -715,8 +728,6 @@ static const struct rte_cryptodev_capabilities aesni_mb_capabilities[] = { RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() }; -uint8_t pmd_driver_id_aesni_mb; - struct aesni_mb_qp_data { uint8_t temp_digests[IMB_MAX_JOBS][DIGEST_LENGTH_MAX]; /* *< Buffers used to store the digest generated diff --git a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c index 97e7cef233..7436353fc2 100644 --- a/drivers/crypto/ipsec_mb/pmd_chacha_poly.c +++ b/drivers/crypto/ipsec_mb/pmd_chacha_poly.c @@ -3,334 +3,7 @@ */ #include "pmd_chacha_poly_priv.h" - -/** Parse crypto xform chain and set private session parameters. */ -static int -chacha20_poly1305_session_configure(IMB_MGR * mb_mgr __rte_unused, - void *priv_sess, const struct rte_crypto_sym_xform *xform) -{ - struct chacha20_poly1305_session *sess = priv_sess; - const struct rte_crypto_sym_xform *auth_xform; - const struct rte_crypto_sym_xform *cipher_xform; - const struct rte_crypto_sym_xform *aead_xform; - - uint8_t key_length; - const uint8_t *key; - enum ipsec_mb_operation mode; - int ret = 0; - - ret = ipsec_mb_parse_xform(xform, &mode, &auth_xform, - &cipher_xform, &aead_xform); - if (ret) - return ret; - - sess->op = mode; - - switch (sess->op) { - case IPSEC_MB_OP_AEAD_AUTHENTICATED_ENCRYPT: - case IPSEC_MB_OP_AEAD_AUTHENTICATED_DECRYPT: - if (aead_xform->aead.algo != - RTE_CRYPTO_AEAD_CHACHA20_POLY1305) { - IPSEC_MB_LOG(ERR, - "The only combined operation supported is CHACHA20 POLY1305"); - ret = -ENOTSUP; - goto error_exit; - } - /* Set IV parameters */ - sess->iv.offset = aead_xform->aead.iv.offset; - sess->iv.length = aead_xform->aead.iv.length; - key_length = aead_xform->aead.key.length; - key = aead_xform->aead.key.data; - sess->aad_length = aead_xform->aead.aad_length; - sess->req_digest_length = aead_xform->aead.digest_length; - break; - default: - IPSEC_MB_LOG( - ERR, "Wrong xform type, has to be AEAD or authentication"); - ret = -ENOTSUP; - goto error_exit; - } - - /* IV check */ - if (sess->iv.length != CHACHA20_POLY1305_IV_LENGTH && - sess->iv.length != 0) { - IPSEC_MB_LOG(ERR, "Wrong IV length"); - ret = -EINVAL; - goto error_exit; - } - - /* Check key length */ - if (key_length != CHACHA20_POLY1305_KEY_SIZE) { - IPSEC_MB_LOG(ERR, "Invalid key length"); - ret = -EINVAL; - goto error_exit; - } else { - memcpy(sess->key, key, CHACHA20_POLY1305_KEY_SIZE); - } - - /* Digest check */ - if (sess->req_digest_length != CHACHA20_POLY1305_DIGEST_LENGTH) { - IPSEC_MB_LOG(ERR, "Invalid digest length"); - ret = -EINVAL; - goto error_exit; - } else { - sess->gen_digest_length = CHACHA20_POLY1305_DIGEST_LENGTH; - } - -error_exit: - return ret; -} - -/** - * Process a crypto operation, calling - * the direct chacha poly API from the multi buffer library. - * - * @param qp queue pair - * @param op symmetric crypto operation - * @param session chacha poly session - * - * @return - * - Return 0 if success - */ -static int -chacha20_poly1305_crypto_op(struct ipsec_mb_qp *qp, struct rte_crypto_op *op, - struct chacha20_poly1305_session *session) -{ - struct chacha20_poly1305_qp_data *qp_data = - ipsec_mb_get_qp_private_data(qp); - uint8_t *src, *dst; - uint8_t *iv_ptr; - struct rte_crypto_sym_op *sym_op = op->sym; - struct rte_mbuf *m_src = sym_op->m_src; - uint32_t offset, data_offset, data_length; - uint32_t part_len, data_len; - int total_len; - uint8_t *tag; - unsigned int oop = 0; - - offset = sym_op->aead.data.offset; - data_offset = offset; - data_length = sym_op->aead.data.length; - RTE_ASSERT(m_src != NULL); - - while (offset >= m_src->data_len && data_length != 0) { - offset -= m_src->data_len; - m_src = m_src->next; - - RTE_ASSERT(m_src != NULL); - } - - src = rte_pktmbuf_mtod_offset(m_src, uint8_t *, offset); - - data_len = m_src->data_len - offset; - part_len = (data_len < data_length) ? data_len : - data_length; - - /* In-place */ - if (sym_op->m_dst == NULL || (sym_op->m_dst == sym_op->m_src)) - dst = src; - /* Out-of-place */ - else { - oop = 1; - /* Segmented destination buffer is not supported - * if operation is Out-of-place - */ - RTE_ASSERT(rte_pktmbuf_is_contiguous(sym_op->m_dst)); - dst = rte_pktmbuf_mtod_offset(sym_op->m_dst, uint8_t *, - data_offset); - } - - iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *, - session->iv.offset); - - IMB_CHACHA20_POLY1305_INIT(qp->mb_mgr, session->key, - &qp_data->chacha20_poly1305_ctx_data, - iv_ptr, sym_op->aead.aad.data, - (uint64_t)session->aad_length); - - if (session->op == IPSEC_MB_OP_AEAD_AUTHENTICATED_ENCRYPT) { - IMB_CHACHA20_POLY1305_ENC_UPDATE(qp->mb_mgr, - session->key, - &qp_data->chacha20_poly1305_ctx_data, - dst, src, (uint64_t)part_len); - total_len = data_length - part_len; - - while (total_len) { - m_src = m_src->next; - RTE_ASSERT(m_src != NULL); - - src = rte_pktmbuf_mtod(m_src, uint8_t *); - if (oop) - dst += part_len; - else - dst = src; - part_len = (m_src->data_len < total_len) ? - m_src->data_len : total_len; - - if (dst == NULL || src == NULL) { - IPSEC_MB_LOG(ERR, "Invalid src or dst input"); - return -EINVAL; - } - IMB_CHACHA20_POLY1305_ENC_UPDATE(qp->mb_mgr, - session->key, - &qp_data->chacha20_poly1305_ctx_data, - dst, src, (uint64_t)part_len); - total_len -= part_len; - if (total_len < 0) { - IPSEC_MB_LOG(ERR, "Invalid part len"); - return -EINVAL; - } - } - - tag = sym_op->aead.digest.data; - IMB_CHACHA20_POLY1305_ENC_FINALIZE(qp->mb_mgr, - &qp_data->chacha20_poly1305_ctx_data, - tag, session->gen_digest_length); - - } else { - IMB_CHACHA20_POLY1305_DEC_UPDATE(qp->mb_mgr, - session->key, - &qp_data->chacha20_poly1305_ctx_data, - dst, src, (uint64_t)part_len); - - total_len = data_length - part_len; - - while (total_len) { - m_src = m_src->next; - - RTE_ASSERT(m_src != NULL); - - src = rte_pktmbuf_mtod(m_src, uint8_t *); - if (oop) - dst += part_len; - else - dst = src; - part_len = (m_src->data_len < total_len) ? - m_src->data_len : total_len; - - if (dst == NULL || src == NULL) { - IPSEC_MB_LOG(ERR, "Invalid src or dst input"); - return -EINVAL; - } - IMB_CHACHA20_POLY1305_DEC_UPDATE(qp->mb_mgr, - session->key, - &qp_data->chacha20_poly1305_ctx_data, - dst, src, (uint64_t)part_len); - total_len -= part_len; - if (total_len < 0) { - IPSEC_MB_LOG(ERR, "Invalid part len"); - return -EINVAL; - } - } - - tag = qp_data->temp_digest; - IMB_CHACHA20_POLY1305_DEC_FINALIZE(qp->mb_mgr, - &qp_data->chacha20_poly1305_ctx_data, - tag, session->gen_digest_length); - } - - return 0; -} - -/** - * Process a completed chacha poly op - * - * @param qp Queue Pair to process - * @param op Crypto operation - * @param sess Crypto session - * - * @return - * - void - */ -static void -post_process_chacha20_poly1305_crypto_op(struct ipsec_mb_qp *qp, - struct rte_crypto_op *op, - struct chacha20_poly1305_session *session) -{ - struct chacha20_poly1305_qp_data *qp_data = - ipsec_mb_get_qp_private_data(qp); - - op->status = RTE_CRYPTO_OP_STATUS_SUCCESS; - /* Verify digest if required */ - if (session->op == IPSEC_MB_OP_AEAD_AUTHENTICATED_DECRYPT || - session->op == IPSEC_MB_OP_HASH_VERIFY_ONLY) { - uint8_t *digest = op->sym->aead.digest.data; - uint8_t *tag = qp_data->temp_digest; - -#ifdef RTE_LIBRTE_PMD_CHACHA20_POLY1305_DEBUG - rte_hexdump(stdout, "auth tag (orig):", - digest, session->req_digest_length); - rte_hexdump(stdout, "auth tag (calc):", - tag, session->req_digest_length); -#endif - if (memcmp(tag, digest, session->req_digest_length) != 0) - op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED; - - } - -} - -/** - * Process a completed Chacha20_poly1305 request - * - * @param qp Queue Pair to process - * @param op Crypto operation - * @param sess Crypto session - * - * @return - * - void - */ -static void -handle_completed_chacha20_poly1305_crypto_op(struct ipsec_mb_qp *qp, - struct rte_crypto_op *op, - struct chacha20_poly1305_session *sess) -{ - post_process_chacha20_poly1305_crypto_op(qp, op, sess); - - /* Free session if a session-less crypto op */ - if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { - memset(sess, 0, sizeof(struct chacha20_poly1305_session)); - rte_mempool_put(qp->sess_mp, op->sym->session); - op->sym->session = NULL; - } -} - -static uint16_t -chacha20_poly1305_pmd_dequeue_burst(void *queue_pair, - struct rte_crypto_op **ops, uint16_t nb_ops) -{ - struct chacha20_poly1305_session *sess; - struct ipsec_mb_qp *qp = queue_pair; - - int retval = 0; - unsigned int i = 0, nb_dequeued; - - nb_dequeued = rte_ring_dequeue_burst(qp->ingress_queue, - (void **)ops, nb_ops, NULL); - - for (i = 0; i < nb_dequeued; i++) { - - sess = ipsec_mb_get_session_private(qp, ops[i]); - if (unlikely(sess == NULL)) { - ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS; - qp->stats.dequeue_err_count++; - break; - } - - retval = chacha20_poly1305_crypto_op(qp, ops[i], sess); - if (retval < 0) { - ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS; - qp->stats.dequeue_err_count++; - break; - } - - handle_completed_chacha20_poly1305_crypto_op(qp, ops[i], sess); - } - - qp->stats.dequeued_count += i; - - return i; -} +#include "pmd_aesni_mb_priv.h" struct rte_cryptodev_ops chacha20_poly1305_pmd_ops = { .dev_configure = ipsec_mb_config, @@ -384,7 +57,7 @@ RTE_INIT(ipsec_mb_register_chacha20_poly1305) = &ipsec_mb_pmds[IPSEC_MB_PMD_TYPE_CHACHA20_POLY1305]; chacha_poly_data->caps = chacha20_poly1305_capabilities; - chacha_poly_data->dequeue_burst = chacha20_poly1305_pmd_dequeue_burst; + chacha_poly_data->dequeue_burst = aesni_mb_dequeue_burst; chacha_poly_data->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | @@ -395,10 +68,9 @@ RTE_INIT(ipsec_mb_register_chacha20_poly1305) RTE_CRYPTODEV_FF_SYM_SESSIONLESS; chacha_poly_data->internals_priv_size = 0; chacha_poly_data->ops = &chacha20_poly1305_pmd_ops; - chacha_poly_data->qp_priv_size = - sizeof(struct chacha20_poly1305_qp_data); + chacha_poly_data->qp_priv_size = sizeof(struct aesni_mb_qp_data); chacha_poly_data->session_configure = - chacha20_poly1305_session_configure; + aesni_mb_session_configure; chacha_poly_data->session_priv_size = - sizeof(struct chacha20_poly1305_session); + sizeof(struct aesni_mb_session); } diff --git a/drivers/crypto/ipsec_mb/pmd_chacha_poly_priv.h b/drivers/crypto/ipsec_mb/pmd_chacha_poly_priv.h index 842f62f5d1..e668bfe07f 100644 --- a/drivers/crypto/ipsec_mb/pmd_chacha_poly_priv.h +++ b/drivers/crypto/ipsec_mb/pmd_chacha_poly_priv.h @@ -7,9 +7,7 @@ #include "ipsec_mb_private.h" -#define CHACHA20_POLY1305_IV_LENGTH 12 #define CHACHA20_POLY1305_DIGEST_LENGTH 16 -#define CHACHA20_POLY1305_KEY_SIZE 32 static const struct rte_cryptodev_capabilities chacha20_poly1305_capabilities[] = { @@ -45,30 +43,4 @@ struct rte_cryptodev_capabilities chacha20_poly1305_capabilities[] = { uint8_t pmd_driver_id_chacha20_poly1305; -/** CHACHA20 POLY1305 private session structure */ -struct chacha20_poly1305_session { - struct { - uint16_t length; - uint16_t offset; - } iv; - /**< IV parameters */ - uint16_t aad_length; - /**< AAD length */ - uint16_t req_digest_length; - /**< Requested digest length */ - uint16_t gen_digest_length; - /**< Generated digest length */ - uint8_t key[CHACHA20_POLY1305_KEY_SIZE]; - enum ipsec_mb_operation op; -} __rte_cache_aligned; - -struct chacha20_poly1305_qp_data { - struct chacha20_poly1305_context_data chacha20_poly1305_ctx_data; - uint8_t temp_digest[CHACHA20_POLY1305_DIGEST_LENGTH]; - /**< Buffer used to store the digest generated - * by the driver when verifying a digest provided - * by the user (using authentication verify operation) - */ -}; - #endif /* _PMD_CHACHA_POLY_PRIV_H_ */ diff --git a/drivers/crypto/ipsec_mb/pmd_kasumi.c b/drivers/crypto/ipsec_mb/pmd_kasumi.c index 70536ec3dc..c3571ec81b 100644 --- a/drivers/crypto/ipsec_mb/pmd_kasumi.c +++ b/drivers/crypto/ipsec_mb/pmd_kasumi.c @@ -10,406 +10,7 @@ #include #include "pmd_kasumi_priv.h" - -/** Parse crypto xform chain and set private session parameters. */ -static int -kasumi_session_configure(IMB_MGR *mgr, void *priv_sess, - const struct rte_crypto_sym_xform *xform) -{ - const struct rte_crypto_sym_xform *auth_xform = NULL; - const struct rte_crypto_sym_xform *cipher_xform = NULL; - enum ipsec_mb_operation mode; - struct kasumi_session *sess = (struct kasumi_session *)priv_sess; - /* Select Crypto operation - hash then cipher / cipher then hash */ - int ret = ipsec_mb_parse_xform(xform, &mode, &auth_xform, - &cipher_xform, NULL); - - if (ret) - return ret; - - if (cipher_xform) { - /* Only KASUMI F8 supported */ - if (cipher_xform->cipher.algo != RTE_CRYPTO_CIPHER_KASUMI_F8) { - IPSEC_MB_LOG(ERR, "Unsupported cipher algorithm "); - return -ENOTSUP; - } - - sess->cipher_iv_offset = cipher_xform->cipher.iv.offset; - if (cipher_xform->cipher.iv.length != KASUMI_IV_LENGTH) { - IPSEC_MB_LOG(ERR, "Wrong IV length"); - return -EINVAL; - } - - /* Initialize key */ - IMB_KASUMI_INIT_F8_KEY_SCHED(mgr, - cipher_xform->cipher.key.data, - &sess->pKeySched_cipher); - } - - if (auth_xform) { - /* Only KASUMI F9 supported */ - if (auth_xform->auth.algo != RTE_CRYPTO_AUTH_KASUMI_F9) { - IPSEC_MB_LOG(ERR, "Unsupported authentication"); - return -ENOTSUP; - } - - if (auth_xform->auth.digest_length != KASUMI_DIGEST_LENGTH) { - IPSEC_MB_LOG(ERR, "Wrong digest length"); - return -EINVAL; - } - - sess->auth_op = auth_xform->auth.op; - - /* Initialize key */ - IMB_KASUMI_INIT_F9_KEY_SCHED(mgr, auth_xform->auth.key.data, - &sess->pKeySched_hash); - } - - sess->op = mode; - return ret; -} - -/** Encrypt/decrypt mbufs with same cipher key. */ -static uint8_t -process_kasumi_cipher_op(struct ipsec_mb_qp *qp, struct rte_crypto_op **ops, - struct kasumi_session *session, uint8_t num_ops) -{ - unsigned int i; - uint8_t processed_ops = 0; - const void *src[num_ops]; - void *dst[num_ops]; - uint8_t *iv_ptr; - uint64_t iv[num_ops]; - uint32_t num_bytes[num_ops]; - - for (i = 0; i < num_ops; i++) { - src[i] = rte_pktmbuf_mtod_offset(ops[i]->sym->m_src, - uint8_t *, - (ops[i]->sym->cipher.data.offset >> 3)); - dst[i] = ops[i]->sym->m_dst - ? rte_pktmbuf_mtod_offset(ops[i]->sym->m_dst, - uint8_t *, - (ops[i]->sym->cipher.data.offset >> 3)) - : rte_pktmbuf_mtod_offset(ops[i]->sym->m_src, - uint8_t *, - (ops[i]->sym->cipher.data.offset >> 3)); - iv_ptr = rte_crypto_op_ctod_offset(ops[i], uint8_t *, - session->cipher_iv_offset); - iv[i] = *((uint64_t *)(iv_ptr)); - num_bytes[i] = ops[i]->sym->cipher.data.length >> 3; - - processed_ops++; - } - - if (processed_ops != 0) - IMB_KASUMI_F8_N_BUFFER(qp->mb_mgr, &session->pKeySched_cipher, - iv, src, dst, num_bytes, - processed_ops); - - return processed_ops; -} - -/** Encrypt/decrypt mbuf (bit level function). */ -static uint8_t -process_kasumi_cipher_op_bit(struct ipsec_mb_qp *qp, struct rte_crypto_op *op, - struct kasumi_session *session) -{ - uint8_t *src, *dst; - uint8_t *iv_ptr; - uint64_t iv; - uint32_t length_in_bits, offset_in_bits; - - offset_in_bits = op->sym->cipher.data.offset; - src = rte_pktmbuf_mtod(op->sym->m_src, uint8_t *); - if (op->sym->m_dst == NULL) - dst = src; - else - dst = rte_pktmbuf_mtod(op->sym->m_dst, uint8_t *); - iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *, - session->cipher_iv_offset); - iv = *((uint64_t *)(iv_ptr)); - length_in_bits = op->sym->cipher.data.length; - - IMB_KASUMI_F8_1_BUFFER_BIT(qp->mb_mgr, &session->pKeySched_cipher, iv, - src, dst, length_in_bits, offset_in_bits); - - return 1; -} - -/** Generate/verify hash from mbufs with same hash key. */ -static int -process_kasumi_hash_op(struct ipsec_mb_qp *qp, struct rte_crypto_op **ops, - struct kasumi_session *session, uint8_t num_ops) -{ - unsigned int i; - uint8_t processed_ops = 0; - uint8_t *src, *dst; - uint32_t length_in_bits; - uint32_t num_bytes; - struct kasumi_qp_data *qp_data = ipsec_mb_get_qp_private_data(qp); - - for (i = 0; i < num_ops; i++) { - /* Data must be byte aligned */ - if ((ops[i]->sym->auth.data.offset % BYTE_LEN) != 0) { - ops[i]->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS; - IPSEC_MB_LOG(ERR, "Invalid Offset"); - break; - } - - length_in_bits = ops[i]->sym->auth.data.length; - - src = rte_pktmbuf_mtod_offset(ops[i]->sym->m_src, uint8_t *, - (ops[i]->sym->auth.data.offset >> 3)); - /* Direction from next bit after end of message */ - num_bytes = length_in_bits >> 3; - - if (session->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY) { - dst = qp_data->temp_digest; - IMB_KASUMI_F9_1_BUFFER(qp->mb_mgr, - &session->pKeySched_hash, src, - num_bytes, dst); - - /* Verify digest. */ - if (memcmp(dst, ops[i]->sym->auth.digest.data, - KASUMI_DIGEST_LENGTH) - != 0) - ops[i]->status - = RTE_CRYPTO_OP_STATUS_AUTH_FAILED; - } else { - dst = ops[i]->sym->auth.digest.data; - - IMB_KASUMI_F9_1_BUFFER(qp->mb_mgr, - &session->pKeySched_hash, src, - num_bytes, dst); - } - processed_ops++; - } - - return processed_ops; -} - -/** Process a batch of crypto ops which shares the same session. */ -static int -process_ops(struct rte_crypto_op **ops, struct kasumi_session *session, - struct ipsec_mb_qp *qp, uint8_t num_ops) -{ - unsigned int i; - unsigned int processed_ops; - - switch (session->op) { - case IPSEC_MB_OP_ENCRYPT_ONLY: - case IPSEC_MB_OP_DECRYPT_ONLY: - processed_ops - = process_kasumi_cipher_op(qp, ops, session, num_ops); - break; - case IPSEC_MB_OP_HASH_GEN_ONLY: - case IPSEC_MB_OP_HASH_VERIFY_ONLY: - processed_ops - = process_kasumi_hash_op(qp, ops, session, num_ops); - break; - case IPSEC_MB_OP_ENCRYPT_THEN_HASH_GEN: - case IPSEC_MB_OP_DECRYPT_THEN_HASH_VERIFY: - processed_ops - = process_kasumi_cipher_op(qp, ops, session, num_ops); - process_kasumi_hash_op(qp, ops, session, processed_ops); - break; - case IPSEC_MB_OP_HASH_VERIFY_THEN_DECRYPT: - case IPSEC_MB_OP_HASH_GEN_THEN_ENCRYPT: - processed_ops - = process_kasumi_hash_op(qp, ops, session, num_ops); - process_kasumi_cipher_op(qp, ops, session, processed_ops); - break; - default: - /* Operation not supported. */ - processed_ops = 0; - } - - for (i = 0; i < num_ops; i++) { - /* - * If there was no error/authentication failure, - * change status to successful. - */ - if (ops[i]->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED) - ops[i]->status = RTE_CRYPTO_OP_STATUS_SUCCESS; - /* Free session if a session-less crypto op. */ - if (ops[i]->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { - memset(session, 0, sizeof(struct kasumi_session)); - rte_mempool_put(qp->sess_mp, ops[i]->sym->session); - ops[i]->sym->session = NULL; - } - } - return processed_ops; -} - -/** Process a crypto op with length/offset in bits. */ -static int -process_op_bit(struct rte_crypto_op *op, struct kasumi_session *session, - struct ipsec_mb_qp *qp) -{ - unsigned int processed_op; - - switch (session->op) { - /* case KASUMI_OP_ONLY_CIPHER: */ - case IPSEC_MB_OP_ENCRYPT_ONLY: - case IPSEC_MB_OP_DECRYPT_ONLY: - processed_op = process_kasumi_cipher_op_bit(qp, op, session); - break; - /* case KASUMI_OP_ONLY_AUTH: */ - case IPSEC_MB_OP_HASH_GEN_ONLY: - case IPSEC_MB_OP_HASH_VERIFY_ONLY: - processed_op = process_kasumi_hash_op(qp, &op, session, 1); - break; - /* case KASUMI_OP_CIPHER_AUTH: */ - case IPSEC_MB_OP_ENCRYPT_THEN_HASH_GEN: - processed_op = process_kasumi_cipher_op_bit(qp, op, session); - if (processed_op == 1) - process_kasumi_hash_op(qp, &op, session, 1); - break; - /* case KASUMI_OP_AUTH_CIPHER: */ - case IPSEC_MB_OP_HASH_VERIFY_THEN_DECRYPT: - processed_op = process_kasumi_hash_op(qp, &op, session, 1); - if (processed_op == 1) - process_kasumi_cipher_op_bit(qp, op, session); - break; - default: - /* Operation not supported. */ - processed_op = 0; - } - - /* - * If there was no error/authentication failure, - * change status to successful. - */ - if (op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED) - op->status = RTE_CRYPTO_OP_STATUS_SUCCESS; - - /* Free session if a session-less crypto op. */ - if (op->sess_type == RTE_CRYPTO_OP_SESSIONLESS) { - memset(CRYPTODEV_GET_SYM_SESS_PRIV(op->sym->session), 0, - sizeof(struct kasumi_session)); - rte_mempool_put(qp->sess_mp, (void *)op->sym->session); - op->sym->session = NULL; - } - return processed_op; -} - -static uint16_t -kasumi_pmd_dequeue_burst(void *queue_pair, struct rte_crypto_op **ops, - uint16_t nb_ops) -{ - struct rte_crypto_op *c_ops[nb_ops]; - struct rte_crypto_op *curr_c_op = NULL; - - struct kasumi_session *prev_sess = NULL, *curr_sess = NULL; - struct ipsec_mb_qp *qp = queue_pair; - unsigned int i; - uint8_t burst_size = 0; - uint8_t processed_ops; - unsigned int nb_dequeued; - - nb_dequeued = rte_ring_dequeue_burst(qp->ingress_queue, - (void **)ops, nb_ops, NULL); - for (i = 0; i < nb_dequeued; i++) { - curr_c_op = ops[i]; - -#ifdef RTE_LIBRTE_PMD_KASUMI_DEBUG - if (!rte_pktmbuf_is_contiguous(curr_c_op->sym->m_src) - || (curr_c_op->sym->m_dst != NULL - && !rte_pktmbuf_is_contiguous( - curr_c_op->sym->m_dst))) { - IPSEC_MB_LOG(ERR, - "PMD supports only contiguous mbufs, op (%p) provides noncontiguous mbuf as source/destination buffer.", - curr_c_op); - curr_c_op->status = RTE_CRYPTO_OP_STATUS_INVALID_ARGS; - break; - } -#endif - - /* Set status as enqueued (not processed yet) by default. */ - curr_c_op->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED; - - curr_sess = (struct kasumi_session *) - ipsec_mb_get_session_private(qp, curr_c_op); - if (unlikely(curr_sess == NULL - || curr_sess->op == IPSEC_MB_OP_NOT_SUPPORTED)) { - curr_c_op->status - = RTE_CRYPTO_OP_STATUS_INVALID_SESSION; - break; - } - - /* If length/offset is at bit-level, process this buffer alone. - */ - if (((curr_c_op->sym->cipher.data.length % BYTE_LEN) != 0) - || ((ops[i]->sym->cipher.data.offset % BYTE_LEN) != 0)) { - /* Process the ops of the previous session. */ - if (prev_sess != NULL) { - processed_ops = process_ops(c_ops, prev_sess, - qp, burst_size); - if (processed_ops < burst_size) { - burst_size = 0; - break; - } - - burst_size = 0; - prev_sess = NULL; - } - - processed_ops = process_op_bit(curr_c_op, - curr_sess, qp); - if (processed_ops != 1) - break; - - continue; - } - - /* Batch ops that share the same session. */ - if (prev_sess == NULL) { - prev_sess = curr_sess; - c_ops[burst_size++] = curr_c_op; - } else if (curr_sess == prev_sess) { - c_ops[burst_size++] = curr_c_op; - /* - * When there are enough ops to process in a batch, - * process them, and start a new batch. - */ - if (burst_size == KASUMI_MAX_BURST) { - processed_ops = process_ops(c_ops, prev_sess, - qp, burst_size); - if (processed_ops < burst_size) { - burst_size = 0; - break; - } - - burst_size = 0; - prev_sess = NULL; - } - } else { - /* - * Different session, process the ops - * of the previous session. - */ - processed_ops = process_ops(c_ops, prev_sess, qp, - burst_size); - if (processed_ops < burst_size) { - burst_size = 0; - break; - } - - burst_size = 0; - prev_sess = curr_sess; - - c_ops[burst_size++] = curr_c_op; - } - } - - if (burst_size != 0) { - /* Process the crypto ops of the last session. */ - processed_ops = process_ops(c_ops, prev_sess, qp, burst_size); - } - - qp->stats.dequeued_count += i; - return i; -} +#include "pmd_aesni_mb_priv.h" struct rte_cryptodev_ops kasumi_pmd_ops = { .dev_configure = ipsec_mb_config, @@ -460,7 +61,7 @@ RTE_INIT(ipsec_mb_register_kasumi) = &ipsec_mb_pmds[IPSEC_MB_PMD_TYPE_KASUMI]; kasumi_data->caps = kasumi_capabilities; - kasumi_data->dequeue_burst = kasumi_pmd_dequeue_burst; + kasumi_data->dequeue_burst = aesni_mb_dequeue_burst; kasumi_data->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO | RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING | RTE_CRYPTODEV_FF_NON_BYTE_ALIGNED_DATA @@ -469,7 +70,8 @@ RTE_INIT(ipsec_mb_register_kasumi) | RTE_CRYPTODEV_FF_OOP_LB_IN_LB_OUT; kasumi_data->internals_priv_size = 0; kasumi_data->ops = &kasumi_pmd_ops; - kasumi_data->qp_priv_size = sizeof(struct kasumi_qp_data); - kasumi_data->session_configure = kasumi_session_configure; - kasumi_data->session_priv_size = sizeof(struct kasumi_session); + kasumi_data->qp_priv_size = sizeof(struct aesni_mb_qp_data); + kasumi_data->session_configure = aesni_mb_session_configure; + kasumi_data->session_priv_size = + sizeof(struct aesni_mb_session); } diff --git a/drivers/crypto/ipsec_mb/pmd_kasumi_priv.h b/drivers/crypto/ipsec_mb/pmd_kasumi_priv.h index 8db1d1cc5b..3223cf1a14 100644 --- a/drivers/crypto/ipsec_mb/pmd_kasumi_priv.h +++ b/drivers/crypto/ipsec_mb/pmd_kasumi_priv.h @@ -9,8 +9,6 @@ #define KASUMI_KEY_LENGTH 16 #define KASUMI_IV_LENGTH 8 -#define KASUMI_MAX_BURST 4 -#define BYTE_LEN 8 #define KASUMI_DIGEST_LENGTH 4 uint8_t pmd_driver_id_kasumi; @@ -60,22 +58,4 @@ static const struct rte_cryptodev_capabilities kasumi_capabilities[] = { RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST() }; -/** KASUMI private session structure */ -struct kasumi_session { - /* Keys have to be 16-byte aligned */ - kasumi_key_sched_t pKeySched_cipher; - kasumi_key_sched_t pKeySched_hash; - enum ipsec_mb_operation op; - enum rte_crypto_auth_operation auth_op; - uint16_t cipher_iv_offset; -} __rte_cache_aligned; - -struct kasumi_qp_data { - uint8_t temp_digest[KASUMI_DIGEST_LENGTH]; - /* *< Buffers used to store the digest generated - * by the driver when verifying a digest provided - * by the user (using authentication verify operation) - */ -}; - #endif /* _PMD_KASUMI_PRIV_H_ */