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 19C2CA04FF for ; Mon, 21 Mar 2022 16:35:48 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E4BA54161A; Mon, 21 Mar 2022 16:35:47 +0100 (CET) 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 0AA0B4161A for ; Mon, 21 Mar 2022 16:35:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647876946; 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; bh=DoalgF2vryp+mgAzaXjcw+oIiZ5xdO0loN4ewntTIjA=; b=IHiJOpfSoQ0OYlQAjEv615+nGMO+kRt0D41s2nUR5uHXTrxyIIs0GVZ8bnBGGxwh6d99dA dVkMVhLxo6hoFs2AECu2X0ig8wydLO9wE+B1qvBFw8+GrWVIu9k3p9CuiRsfxLXmKwj2Xj NixsbpF/Cw8GNZxONWB1MzYr1q6q/W4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-145-6zBqW_KyNQqxoDm3zTfRWg-1; Mon, 21 Mar 2022 11:35:42 -0400 X-MC-Unique: 6zBqW_KyNQqxoDm3zTfRWg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 35901185A7BA; Mon, 21 Mar 2022 15:35:40 +0000 (UTC) Received: from rh.Home (unknown [10.39.195.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C26D40CF8FA; Mon, 21 Mar 2022 15:35:38 +0000 (UTC) From: Kevin Traynor To: stable@dpdk.org Cc: Kevin Traynor , pablo.de.lara.guarch@intel.com Subject: [PATCH 21.11] Revert "crypto/ipsec_mb: fix length and offset settings" Date: Mon, 21 Mar 2022 15:35:27 +0000 Message-Id: <20220321153527.67663-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" 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 This reverts commit daf06c45e8576d8a2a86455e33e2bc4574f8f8b4. As noted [0] reverting this commit because it is reported to introduce a regression [1] and there seems to be some issues [2] with the fix. [0] http://inbox.dpdk.org/stable/3a9ab8af-0a11-248d-24e3-37c7bde7b850@redhat.com/ [1] http://inbox.dpdk.org/stable/DM8PR11MB559167EBA31F8DFEEDE9B51584099@DM8PR11MB5591.namprd11.prod.outlook.com/ [2] http://inbox.dpdk.org/stable/f9030407a47a8554b2c09426c5bc40049647db2d.camel@debian.org/ Fixes: daf06c45e857 ("crypto/ipsec_mb: fix length and offset settings") Cc: pablo.de.lara.guarch@intel.com Signed-off-by: Kevin Traynor --- drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 93 ++++++++++---------------- 1 file changed, 36 insertions(+), 57 deletions(-) diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c index 748382320b..a308d42ffa 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c @@ -919,7 +919,5 @@ aesni_mb_set_docsis_sec_session_parameters( static inline uint64_t auth_start_offset(struct rte_crypto_op *op, struct aesni_mb_session *session, - uint32_t oop, const uint32_t auth_offset, - const uint32_t cipher_offset, const uint32_t auth_length, - const uint32_t cipher_length) + uint32_t oop) { struct rte_mbuf *m_src, *m_dst; @@ -930,5 +928,5 @@ auth_start_offset(struct rte_crypto_op *op, struct aesni_mb_session *session, /* Only cipher then hash needs special calculation. */ if (!oop || session->chain_order != IMB_ORDER_CIPHER_HASH) - return auth_offset; + return op->sym->auth.data.offset; m_src = op->sym->m_src; @@ -938,5 +936,5 @@ auth_start_offset(struct rte_crypto_op *op, struct aesni_mb_session *session, p_dst = rte_pktmbuf_mtod(m_dst, uint8_t *); u_src = (uintptr_t)p_src; - u_dst = (uintptr_t)p_dst + auth_offset; + u_dst = (uintptr_t)p_dst + op->sym->auth.data.offset; /** @@ -944,9 +942,9 @@ auth_start_offset(struct rte_crypto_op *op, struct aesni_mb_session *session, * correct digest. */ - if (cipher_offset > auth_offset) - memcpy(p_dst + auth_offset, - p_src + auth_offset, - cipher_offset - - auth_offset); + if (op->sym->cipher.data.offset > op->sym->auth.data.offset) + memcpy(p_dst + op->sym->auth.data.offset, + p_src + op->sym->auth.data.offset, + op->sym->cipher.data.offset - + op->sym->auth.data.offset); /** @@ -954,6 +952,6 @@ auth_start_offset(struct rte_crypto_op *op, struct aesni_mb_session *session, * length) for generating correct digest */ - cipher_end = cipher_offset + cipher_length; - auth_end = auth_offset + auth_length; + cipher_end = op->sym->cipher.data.offset + op->sym->cipher.data.length; + auth_end = op->sym->auth.data.offset + op->sym->auth.data.length; if (cipher_end < auth_end) memcpy(p_dst + cipher_end, p_src + cipher_end, @@ -1102,8 +1100,4 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, struct aesni_mb_session *session; uint32_t m_offset, oop; - uint32_t auth_off_in_bytes; - uint32_t ciph_off_in_bytes; - uint32_t auth_len_in_bytes; - uint32_t ciph_len_in_bytes; session = ipsec_mb_get_session_private(qp, op); @@ -1214,5 +1208,4 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, job->enc_keys = session->cipher.zuc_cipher_key; job->dec_keys = session->cipher.zuc_cipher_key; - m_offset >>= 3; } else if (job->cipher_mode == IMB_CIPHER_SNOW3G_UEA2_BITLEN) { job->enc_keys = &session->cipher.pKeySched_snow3g_cipher; @@ -1272,4 +1265,7 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, switch (job->hash_alg) { case IMB_AUTH_AES_CCM: + job->cipher_start_src_offset_in_bytes = + op->sym->aead.data.offset; + job->msg_len_to_cipher_in_bytes = op->sym->aead.data.length; job->hash_start_src_offset_in_bytes = op->sym->aead.data.offset; job->msg_len_to_hash_in_bytes = op->sym->aead.data.length; @@ -1281,9 +1277,17 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, case IMB_AUTH_AES_GMAC: if (session->cipher.mode == IMB_CIPHER_GCM) { + job->cipher_start_src_offset_in_bytes = + op->sym->aead.data.offset; job->hash_start_src_offset_in_bytes = op->sym->aead.data.offset; + job->msg_len_to_cipher_in_bytes = + op->sym->aead.data.length; job->msg_len_to_hash_in_bytes = op->sym->aead.data.length; } else { + job->cipher_start_src_offset_in_bytes = + op->sym->auth.data.offset; + job->hash_start_src_offset_in_bytes = + op->sym->auth.data.offset; job->msg_len_to_cipher_in_bytes = 0; job->msg_len_to_hash_in_bytes = 0; @@ -1295,6 +1299,10 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, case IMB_AUTH_CHACHA20_POLY1305: + job->cipher_start_src_offset_in_bytes = + op->sym->aead.data.offset; job->hash_start_src_offset_in_bytes = op->sym->aead.data.offset; + job->msg_len_to_cipher_in_bytes = + op->sym->aead.data.length; job->msg_len_to_hash_in_bytes = op->sym->aead.data.length; @@ -1303,46 +1311,12 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, session->iv.offset); break; - /* ZUC and SNOW3G require length in bits and offset in bytes */ - case IMB_AUTH_ZUC_EIA3_BITLEN: - case IMB_AUTH_ZUC256_EIA3_BITLEN: - case IMB_AUTH_SNOW3G_UIA2_BITLEN: - auth_off_in_bytes = op->sym->auth.data.offset >> 3; - ciph_off_in_bytes = op->sym->cipher.data.offset >> 3; - auth_len_in_bytes = op->sym->auth.data.length >> 3; - ciph_len_in_bytes = op->sym->cipher.data.length >> 3; - - job->hash_start_src_offset_in_bytes = auth_start_offset(op, - session, oop, auth_off_in_bytes, - ciph_off_in_bytes, auth_len_in_bytes, - ciph_len_in_bytes); - job->msg_len_to_hash_in_bits = op->sym->auth.data.length; - - job->iv = rte_crypto_op_ctod_offset(op, uint8_t *, - session->iv.offset); - break; - - /* KASUMI requires lengths and offset in bytes */ - case IMB_AUTH_KASUMI_UIA1: - auth_off_in_bytes = op->sym->auth.data.offset >> 3; - ciph_off_in_bytes = op->sym->cipher.data.offset >> 3; - auth_len_in_bytes = op->sym->auth.data.length >> 3; - ciph_len_in_bytes = op->sym->cipher.data.length >> 3; - - job->hash_start_src_offset_in_bytes = auth_start_offset(op, - session, oop, auth_off_in_bytes, - ciph_off_in_bytes, auth_len_in_bytes, - ciph_len_in_bytes); - job->msg_len_to_hash_in_bytes = auth_len_in_bytes; - - job->iv = rte_crypto_op_ctod_offset(op, uint8_t *, - session->iv.offset); - break; - default: + /* For SNOW3G, length and offsets are already in bits */ + job->cipher_start_src_offset_in_bytes = + op->sym->cipher.data.offset; + job->msg_len_to_cipher_in_bytes = op->sym->cipher.data.length; + job->hash_start_src_offset_in_bytes = auth_start_offset(op, - session, oop, op->sym->auth.data.offset, - op->sym->cipher.data.offset, - op->sym->auth.data.length, - op->sym->cipher.data.length); + session, oop); job->msg_len_to_hash_in_bytes = op->sym->auth.data.length; @@ -1351,4 +1325,9 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, } + if (job->cipher_mode == IMB_CIPHER_ZUC_EEA3) + job->msg_len_to_cipher_in_bytes >>= 3; + else if (job->hash_alg == IMB_AUTH_KASUMI_UIA1) + job->msg_len_to_hash_in_bytes >>= 3; + /* Set user data to be crypto operation data struct */ job->user_data = op; -- 2.34.1