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 84831455AD for ; Mon, 15 Jul 2024 17:28:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7D5A1402DD; Mon, 15 Jul 2024 17:28:18 +0200 (CEST) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by mails.dpdk.org (Postfix) with ESMTP id C4C63402B0 for ; Mon, 15 Jul 2024 17:28:16 +0200 (CEST) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-42797bcfc77so30915035e9.2 for ; Mon, 15 Jul 2024 08:28:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721057296; x=1721662096; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/hJafEtS3Xhr8uHqzkwE5Poy2CD5ESO6GHMw7N7piDM=; b=VqVgz/oq8sU+yuIMgCp+adN9rUnN8cZBrn4RHe742BszxqQpBDmyIQYIfA3pzZKjn/ uGF6b/6wcNPYKZ4xGB+RIAKCivlLztI/U5zoH1SXSfdwWJ1J1EwojpebH5aLfe4Inzvv rriObCIK9zYroQvIknREGtN7PKXNFyDuqVg6i77xTEHBhhCu2jRl/Mie89db9k2KpFrC umZitBTv5a2qDitxzODTnO6NDIyD3nmMa3/hh5B40VNblcspaN081zvxjB+YAvIC1LuT /KhuBdOcOMCzHZz4eYuEcASXNVuwHCdU0w7e8N/P3sHGRwAKRol/NM800xJRmiHfsbd9 Qf9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721057296; x=1721662096; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/hJafEtS3Xhr8uHqzkwE5Poy2CD5ESO6GHMw7N7piDM=; b=JXR+OHrq2Rj7BHry/VKh6Wr2ti5UwNOBMzT8wCtf5S6BDhr2lcKnnpo2L7cYpSHy8L 2liGVSqGp1zGmagqw3Nz89I/fhsojTixRzbuN83Lh6on5CySSiXU00TErYi5SRVwU9jK tDNQduCimKEcw0LA1Xn809J7nSNkmuHROZ16pUy0QsupnvB0sSjjBabQg+zNmev5PgiI 2Ev08t8tKBuaaX0rThz+5EKEiD+va3AqxO23kmYuaGbhcgFPJpP4Qte129fq3UDVI7St NRqbD4/3icv99RzCf8dDRpupdxfZhJ8qDU+CLgTD8m6oqf4uHMLnKX18oXtjVz9azIIo wNFA== X-Forwarded-Encrypted: i=1; AJvYcCUS6utX4TFwAhOh0XrIAkzScegI4jRh8G6SmgWsgbM8tDNak+HTbNsB2V4LsHLIciJcWRZVAdOVDXYlGRnR5EI= X-Gm-Message-State: AOJu0Yw46XF5bYJOV5IGRiLF9E5IdHlYBvB4MQAifXAszQOJkKkHd285 FgQpWy+Blp6CAAU+EvodRv62oMRGw/W6BKNJDlEHF3hMGbQGo5d2 X-Google-Smtp-Source: AGHT+IFuD0KBjrRcaGH4bcDYxBXDZFDfCvDTB5EQPDZ1412bjTf4M1wxzMYnP4SeGfJUA9/a7AC0cw== X-Received: by 2002:a05:600c:201:b0:427:9dad:17df with SMTP id 5b1f17b1804b1-4279dad1e64mr71517555e9.12.1721057296317; Mon, 15 Jul 2024 08:28:16 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:7aef:1aaa:3dff:d546]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3680dafbe6fsm6734785f8f.66.2024.07.15.08.28.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jul 2024 08:28:15 -0700 (PDT) From: luca.boccassi@gmail.com To: Jack Bond-Preston Cc: Kai Ji , Wathsala Vithanage , dpdk stable Subject: patch 'crypto/openssl: set cipher padding once' has been queued to stable release 22.11.6 Date: Mon, 15 Jul 2024 16:25:59 +0100 Message-Id: <20240715152704.2229503-21-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240715152704.2229503-1-luca.boccassi@gmail.com> References: <20240624235907.885628-81-luca.boccassi@gmail.com> <20240715152704.2229503-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 22.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/17/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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/d0aee3876f98d0da3fb7f35eea208fc91c7a5cf2 Thanks. Luca Boccassi --- >From d0aee3876f98d0da3fb7f35eea208fc91c7a5cf2 Mon Sep 17 00:00:00 2001 From: Jack Bond-Preston Date: Wed, 3 Jul 2024 13:45:51 +0000 Subject: [PATCH] crypto/openssl: set cipher padding once [ upstream commit d2bf59017315dc18eb6c9f2d7acd10dfb8d7758e ] Setting the cipher padding has a noticeable performance footprint, and it doesn't need to be done for every call to process_openssl_cipher_{en,de}crypt(). Setting it causes OpenSSL to set it on every future context re-init. Thus, for every buffer after the first one, the padding is being set twice. Instead, just set the cipher padding once - when configuring the session parameters - avoiding the unnecessary double setting behaviour. This is skipped for AEAD ciphers, where disabling padding is not necessary. Throughput performance uplift measurements for AES-CBC-128 encrypt on Ampere Altra Max platform: 1 worker lcore | buffer sz (B) | prev (Gbps) | optimised (Gbps) | uplift | |-----------------+---------------+--------------------+----------| | 64 | 2.97 | 3.72 | 25.2% | | 256 | 8.10 | 9.42 | 16.3% | | 1024 | 14.22 | 15.18 | 6.8% | | 2048 | 16.28 | 16.93 | 4.0% | | 4096 | 17.58 | 17.97 | 2.2% | 8 worker lcores | buffer sz (B) | prev (Gbps) | optimised (Gbps) | uplift | |-----------------+---------------+--------------------+----------| | 64 | 21.27 | 29.85 | 40.3% | | 256 | 60.05 | 75.53 | 25.8% | | 1024 | 110.11 | 121.56 | 10.4% | | 2048 | 128.05 | 135.40 | 5.7% | | 4096 | 139.45 | 143.76 | 3.1% | Signed-off-by: Jack Bond-Preston Acked-by: Kai Ji Reviewed-by: Wathsala Vithanage --- drivers/crypto/openssl/rte_openssl_pmd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c index 72db0fd40f..9fc8194366 100644 --- a/drivers/crypto/openssl/rte_openssl_pmd.c +++ b/drivers/crypto/openssl/rte_openssl_pmd.c @@ -618,6 +618,8 @@ openssl_set_session_cipher_parameters(struct openssl_session *sess, return -ENOTSUP; } + EVP_CIPHER_CTX_set_padding(sess->cipher.ctx, 0); + return 0; } @@ -1123,8 +1125,6 @@ process_openssl_cipher_encrypt(struct rte_mbuf *mbuf_src, uint8_t *dst, if (EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv) <= 0) goto process_cipher_encrypt_err; - EVP_CIPHER_CTX_set_padding(ctx, 0); - if (process_openssl_encryption_update(mbuf_src, offset, &dst, srclen, ctx, inplace)) goto process_cipher_encrypt_err; @@ -1173,8 +1173,6 @@ process_openssl_cipher_decrypt(struct rte_mbuf *mbuf_src, uint8_t *dst, if (EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv) <= 0) goto process_cipher_decrypt_err; - EVP_CIPHER_CTX_set_padding(ctx, 0); - if (process_openssl_decryption_update(mbuf_src, offset, &dst, srclen, ctx, inplace)) goto process_cipher_decrypt_err; -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-07-15 16:19:35.836107340 +0100 +++ 0021-crypto-openssl-set-cipher-padding-once.patch 2024-07-15 16:19:34.492204841 +0100 @@ -1 +1 @@ -From d2bf59017315dc18eb6c9f2d7acd10dfb8d7758e Mon Sep 17 00:00:00 2001 +From d0aee3876f98d0da3fb7f35eea208fc91c7a5cf2 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit d2bf59017315dc18eb6c9f2d7acd10dfb8d7758e ] + @@ -36,2 +37,0 @@ -Cc: stable@dpdk.org - @@ -46 +46 @@ -index 7e2e505222..101111e85b 100644 +index 72db0fd40f..9fc8194366 100644 @@ -49 +49 @@ -@@ -619,6 +619,8 @@ openssl_set_session_cipher_parameters(struct openssl_session *sess, +@@ -618,6 +618,8 @@ openssl_set_session_cipher_parameters(struct openssl_session *sess, @@ -58 +58 @@ -@@ -1124,8 +1126,6 @@ process_openssl_cipher_encrypt(struct rte_mbuf *mbuf_src, uint8_t *dst, +@@ -1123,8 +1125,6 @@ process_openssl_cipher_encrypt(struct rte_mbuf *mbuf_src, uint8_t *dst, @@ -67 +67 @@ -@@ -1174,8 +1174,6 @@ process_openssl_cipher_decrypt(struct rte_mbuf *mbuf_src, uint8_t *dst, +@@ -1173,8 +1173,6 @@ process_openssl_cipher_decrypt(struct rte_mbuf *mbuf_src, uint8_t *dst,