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 E24ED45804 for ; Fri, 23 Aug 2024 18:22:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DCDDC43384; Fri, 23 Aug 2024 18:22:00 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 2AD3A402BE for ; Fri, 23 Aug 2024 18:21:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724430118; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XvrE1MGf4tFPHgOFS+vXDpQJOzOhZt/PuokJHFKNHmQ=; b=ZrIX6IaAWfw9u8VpjWiI4WMurRq81wAO4Ot3wPREPwjkRlqDQxuDlwC2HMCjwpuZo9j/f8 B8d9t7iUf8X2ojAVHji56uLJlnmt93byP+wlhnN54DK3Jx8Jt4SY6l07muQ79uHWQqNkpy wHQrO8+XK4Bn9VCYlPcaGEmwdnkVXGQ= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-619-30cfxuwIOni1yQCq47FEzA-1; Fri, 23 Aug 2024 12:21:57 -0400 X-MC-Unique: 30cfxuwIOni1yQCq47FEzA-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5701C1955D45; Fri, 23 Aug 2024 16:21:56 +0000 (UTC) Received: from rh.redhat.com (unknown [10.39.193.224]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 6E1641956053; Fri, 23 Aug 2024 16:21:54 +0000 (UTC) From: Kevin Traynor 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 21.11.8 Date: Fri, 23 Aug 2024 17:18:12 +0100 Message-ID: <20240823161929.1004778-64-ktraynor@redhat.com> In-Reply-To: <20240823161929.1004778-1-ktraynor@redhat.com> References: <20240823161929.1004778-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 21.11.8 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/28/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://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/3e1ff62d6d58e74dfb47a5283de10d2cd8730d17 Thanks. Kevin --- >From 3e1ff62d6d58e74dfb47a5283de10d2cd8730d17 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 [ 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 514e93229f..a321258980 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -466,4 +466,13 @@ openssl_set_session_cipher_parameters(struct openssl_session *sess, 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; @@ -1002,6 +1011,5 @@ process_cipher_decrypt_err: 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]; @@ -1021,10 +1029,4 @@ process_openssl_cipher_des3ctr(struct rte_mbuf *mbuf_src, uint8_t *dst, 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); @@ -1461,6 +1463,5 @@ process_openssl_cipher_op 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); -- 2.46.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-08-23 17:18:11.750636699 +0100 +++ 0064-crypto-openssl-optimize-3DES-CTR-context-init.patch 2024-08-23 17:18:09.737430165 +0100 @@ -1 +1 @@ -From 08917edd8b110f9819301ee4f9b152de7c79ddd4 Mon Sep 17 00:00:00 2001 +From 3e1ff62d6d58e74dfb47a5283de10d2cd8730d17 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 08917edd8b110f9819301ee4f9b152de7c79ddd4 ] + @@ -33,2 +34,0 @@ -Cc: stable@dpdk.org - @@ -43 +43 @@ -index 3e547c2039..bd09d58d88 100644 +index 514e93229f..a321258980 100644 @@ -46 +46 @@ -@@ -554,4 +554,13 @@ openssl_set_session_cipher_parameters(struct openssl_session *sess, +@@ -466,4 +466,13 @@ openssl_set_session_cipher_parameters(struct openssl_session *sess, @@ -60 +60 @@ -@@ -1173,6 +1182,5 @@ process_cipher_decrypt_err: +@@ -1002,6 +1011,5 @@ process_cipher_decrypt_err: @@ -68 +68 @@ -@@ -1192,10 +1200,4 @@ process_openssl_cipher_des3ctr(struct rte_mbuf *mbuf_src, uint8_t *dst, +@@ -1021,10 +1029,4 @@ process_openssl_cipher_des3ctr(struct rte_mbuf *mbuf_src, uint8_t *dst, @@ -79 +79 @@ -@@ -1741,6 +1743,5 @@ process_openssl_cipher_op +@@ -1461,6 +1463,5 @@ process_openssl_cipher_op