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 65378457A1 for ; Mon, 12 Aug 2024 14:53:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 851A7402C3; Mon, 12 Aug 2024 14:53:43 +0200 (CEST) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2087.outbound.protection.outlook.com [40.107.243.87]) by mails.dpdk.org (Postfix) with ESMTP id EAFFD4029C for ; Mon, 12 Aug 2024 14:53:41 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ipnDpj72gi6+KNG231T47OWU1EvalPE0gJUSTAs+9oOGG7qBjXOlG3JqN5k13N9ifbq5pFfkDQ8aTjJbINiSWBThU5tllEuBneiI6vCIskXgx4BKUjuE+ZwUWqeVyDq1RDm98M7USP/yrgGjs8UeWKBx+VuOXaM3uXw8JH58l6uCOQWMoRnxt+8J8BLhtAFDh1SW0nwDM3mmrKVfN76UqTQdySg/OnnTgIolWpGY6FlLdqnAxnVUzbZ4Lkh38NijQV1XE5nB5Yi5QCoEKugUPUlFjf8J4JNIy0jkjalT+vdu4J+SiegonBoai3a+shFPiDbEPE72ww0FMcpglJaFrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qIv4DuJlOz/JncugXOm07MRrDa7hZ22o+L8prS/pGZg=; b=j13xpR2ZFiCuMzGpUOtfnKB72TGgpigrLAr2mJLsapLO1VQHioBCPy7CksxZkI9WpanNagtvn3SFFNmOrFUQ9/9dil+YkZNJRtSrEBd5bAkWXb7QIUV6qxw4+H4RarEb3/5QeQRB7GgNMWE1h0CTWmavX3IrwzkrV6wKA8VXYi8F15Hi8miUBkVX0MZt+kMFQzVuaKW1knq2aTF+/V0NQ9Jz+aaWjArcg3q7Zhi2Fa7egR78kwbnTyWLzCy4cRu/MHr+2v7B1MIRHvT3iIbReN1b0Y7sVRP6/SvuTiWbksaHmDuifC40S4Aru4cEuhca/HOgOJJ+njfCnGbX+se6kw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=foss.arm.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qIv4DuJlOz/JncugXOm07MRrDa7hZ22o+L8prS/pGZg=; b=BfbnnhfimNp1VSEqBQsXCeO/w6r8Jy40KFsLo/MQ0RnMruflXgP13riPmlrr2gAki9htKqfOmfFm2apqb5pa2/N7unSROziDs0e8aZq2fHsLTLnh0SwLs+yntHo4l3Rb3R2tAzEie3wwCrGcf38jBFuyNaerVKlprf54xaLVGlMJE5hV9IeJAwWE48CEYIJ9N22zjTlz+MoxUocESKhvHivvigPm3yLEcsjrNJQbUG7GE3S8X4xtdb9qqNMH8Voikli+D5qmJSl8MFuGmGT4+NXR+0G4ArGZ/zkx6tFaHubs1lSV2kcAPcejzdmWKALzMLi3w3ntYwDq3YmpWOs5iw== Received: from SA9PR13CA0180.namprd13.prod.outlook.com (2603:10b6:806:28::35) by DM4PR12MB5793.namprd12.prod.outlook.com (2603:10b6:8:60::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.14; Mon, 12 Aug 2024 12:53:36 +0000 Received: from SA2PEPF00003F67.namprd04.prod.outlook.com (2603:10b6:806:28:cafe::cf) by SA9PR13CA0180.outlook.office365.com (2603:10b6:806:28::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22 via Frontend Transport; Mon, 12 Aug 2024 12:53:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by SA2PEPF00003F67.mail.protection.outlook.com (10.167.248.42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.8 via Frontend Transport; Mon, 12 Aug 2024 12:53:35 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 12 Aug 2024 05:53:23 -0700 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 12 Aug 2024 05:53:21 -0700 From: Xueming Li To: Jack Bond-Preston CC: , Kai Ji , Wathsala Vithanage , dpdk stable Subject: patch 'crypto/openssl: optimize 3DES-CTR context init' has been queued to stable release 23.11.2 Date: Mon, 12 Aug 2024 20:48:23 +0800 Message-ID: <20240812125035.389667-27-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240812125035.389667-1-xuemingl@nvidia.com> References: <20240712110153.309690-23-xuemingl@nvidia.com> <20240812125035.389667-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SA2PEPF00003F67:EE_|DM4PR12MB5793:EE_ X-MS-Office365-Filtering-Correlation-Id: 6104b917-803b-46b0-314f-08dcbacdc774 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?/Fcw8GCseNT19+YC4+Z3MC1c8DHP+dSrsGH11uDoG/muK12V43FDMWv74NfT?= =?us-ascii?Q?gSnTW5X7eReZ5s25geXyqYZl2Aa0dYxaVg/1vAsiguHDsscg5QrSfgFDkeIs?= =?us-ascii?Q?VehIYSZvhZHltfpGaD9uP57W336t0jYzSyt81mp7GUTnNt6huila0Y33qocU?= =?us-ascii?Q?afVGBQrEdJdjllGCcpULyG2n/xzqu+1fjXdLkWeFn+Qq9izefT9yP8mV+m0j?= =?us-ascii?Q?soZcqENWISu4pmr6UTH8s8WGBNTS9ruYvg8d/ANAS9s/z7hj2EJWCJtsMKZK?= =?us-ascii?Q?gKDlo9Kocpw1xZxmxhj5/xYuFbKvZVPu1hxtq6C6tlm8vSFAr0xEs1FhQAkZ?= =?us-ascii?Q?Oh9RT2WHbN1IcmOHmQ+sje4MkEHUtcTk5aGAte3C5//Mw+0HDdEDFFxLna2y?= =?us-ascii?Q?SwET6jOsiETtllx2B+eTMwm84jU9FgyvhT3JHx+7fKmmq0tv0tlpYUp7jPlm?= =?us-ascii?Q?x+U2vWOXFvFf/9hLMssEPVrQhya/FKZzcj3L8OnbbtkpPD8LMUxLZT+lbxTn?= =?us-ascii?Q?njHs0Au2VwL/rSs6tzcZz9EQz54znqpD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am-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230040)(36860700013)(1800799024)(376014)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Aug 2024 12:53:35.5704 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6104b917-803b-46b0-314f-08dcbacdc774 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SA2PEPF00003F67.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5793 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 23.11.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 08/14/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=ee88b9496c9bcbdfc332962d5e10bddd2a9ffed7 Thanks. Xueming Li --- >From ee88b9496c9bcbdfc332962d5e10bddd2a9ffed7 Mon Sep 17 00:00:00 2001 From: Jack Bond-Preston Date: Wed, 3 Jul 2024 13:45:48 +0000 Subject: [PATCH] crypto/openssl: optimize 3DES-CTR context init Cc: Xueming Li [ upstream commit 08917edd8b110f9819301ee4f9b152de7c79ddd4 ] Currently the 3DES-CTR cipher context is initialised for every buffer, setting the cipher implementation and key - even though for every buffer in the session these values will be the same. Change to initialising the cipher context once, before any buffers are processed, instead. Throughput performance uplift measurements for 3DES-CTR encrypt on Ampere Altra Max platform: 1 worker lcore | buffer sz (B) | prev (Gbps) | optimised (Gbps) | uplift | |-----------------+---------------+--------------------+----------| | 64 | 0.16 | 0.21 | 35.3% | | 256 | 0.20 | 0.22 | 9.4% | | 1024 | 0.22 | 0.23 | 2.3% | | 2048 | 0.22 | 0.23 | 0.9% | | 4096 | 0.22 | 0.23 | 0.9% | 8 worker lcores | buffer sz (B) | prev (Gbps) | optimised (Gbps) | uplift | |-----------------+---------------+--------------------+----------| | 64 | 1.01 | 1.34 | 32.9% | | 256 | 1.51 | 1.66 | 9.9% | | 1024 | 1.72 | 1.77 | 2.6% | | 2048 | 1.76 | 1.78 | 1.1% | | 4096 | 1.79 | 1.80 | 0.6% | Signed-off-by: Jack Bond-Preston Acked-by: Kai Ji Reviewed-by: Wathsala Vithanage --- drivers/crypto/openssl/rte_openssl_pmd.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index 3e547c2039..bd09d58d88 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -553,6 +553,15 @@ openssl_set_session_cipher_parameters(struct openssl_session *sess, sess->cipher.key.length, sess->cipher.key.data) != 0) return -EINVAL; + + + /* We use 3DES encryption also for decryption. + * IV is not important for 3DES ECB. + */ + if (EVP_EncryptInit_ex(sess->cipher.ctx, EVP_des_ede3_ecb(), + NULL, sess->cipher.key.data, NULL) != 1) + return -EINVAL; + break; case RTE_CRYPTO_CIPHER_DES_CBC: @@ -1172,8 +1181,7 @@ process_cipher_decrypt_err: /** Process cipher des 3 ctr encryption, decryption algorithm */ static int process_openssl_cipher_des3ctr(struct rte_mbuf *mbuf_src, uint8_t *dst, - int offset, uint8_t *iv, uint8_t *key, int srclen, - EVP_CIPHER_CTX *ctx) + int offset, uint8_t *iv, int srclen, EVP_CIPHER_CTX *ctx) { uint8_t ebuf[8], ctr[8]; int unused, n; @@ -1191,12 +1199,6 @@ process_openssl_cipher_des3ctr(struct rte_mbuf *mbuf_src, uint8_t *dst, src = rte_pktmbuf_mtod_offset(m, uint8_t *, offset); l = rte_pktmbuf_data_len(m) - offset; - /* We use 3DES encryption also for decryption. - * IV is not important for 3DES ecb - */ - if (EVP_EncryptInit_ex(ctx, EVP_des_ede3_ecb(), NULL, key, NULL) <= 0) - goto process_cipher_des3ctr_err; - memcpy(ctr, iv, 8); for (n = 0; n < srclen; n++) { @@ -1740,8 +1742,7 @@ process_openssl_cipher_op srclen, ctx_copy, inplace); else status = process_openssl_cipher_des3ctr(mbuf_src, dst, - op->sym->cipher.data.offset, iv, - sess->cipher.key.data, srclen, + op->sym->cipher.data.offset, iv, srclen, ctx_copy); EVP_CIPHER_CTX_free(ctx_copy); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-08-12 20:44:03.419627527 +0800 +++ 0026-crypto-openssl-optimize-3DES-CTR-context-init.patch 2024-08-12 20:44:01.965069269 +0800 @@ -1 +1 @@ -From 08917edd8b110f9819301ee4f9b152de7c79ddd4 Mon Sep 17 00:00:00 2001 +From ee88b9496c9bcbdfc332962d5e10bddd2a9ffed7 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 08917edd8b110f9819301ee4f9b152de7c79ddd4 ] @@ -32,2 +34,0 @@ - -Cc: stable@dpdk.org