From patchwork Wed Nov 15 16:05:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dooley, Brian" X-Patchwork-Id: 134401 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 BB0D44333A; Wed, 15 Nov 2023 17:06:22 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3D242402B7; Wed, 15 Nov 2023 17:06:22 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 89E2F402B0; Wed, 15 Nov 2023 17:06:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700064380; x=1731600380; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=vsAz5VXQWzx+9HGHiaCraw2oTJ7FXqz37FYU4JPu+hQ=; b=Y13eZgSZpjNbzGerPAbipX5O6ayhGwnps7XQqArXfEWkE4TEDiF3Ypgr X9GlwSV+E3wREQGdyjMuzpYPeNelQ3P7VSw3cYWrZaKaFlTsZtZaxAhlz 1TKUob01bvVmgIANJzsxhUPVhCgKpmdbZQ0BdPqSz7j/wh9ilNNqq/G9I nL+iOlhECTmq9GpMDWmBvrKbT93ZzVAh6/ByW5Gu/AnNlLGJ32yYTaXLl ckocDWiwa9RnZ2i7EFi4ABZsPy362AlfjCvbvO+g1NCT7tk7CTK4mBSY+ ekKBdZWtlCDgb3dJbru5atBirKcDNWNb+pToT1+KtV4lIwYs15lHclhkY g==; X-IronPort-AV: E=McAfee;i="6600,9927,10895"; a="370247810" X-IronPort-AV: E=Sophos;i="6.03,305,1694761200"; d="scan'208";a="370247810" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2023 08:06:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10895"; a="855683052" X-IronPort-AV: E=Sophos;i="6.03,305,1694761200"; d="scan'208";a="855683052" Received: from silpixa00400355.ir.intel.com (HELO silpixa00400355.ger.corp.intel.com) ([10.237.222.80]) by FMSMGA003.fm.intel.com with ESMTP; 15 Nov 2023 08:05:57 -0800 From: Brian Dooley To: dev@dpdk.org Cc: arkadiuszx.kusztal@intel.com, Ciara Power , stable@dpdk.org, Kai Ji Subject: [PATCH] crypto/qat: fix gen3 legacy capabilities Date: Wed, 15 Nov 2023 16:05:54 +0000 Message-Id: <20231115160554.2451510-1-brian.dooley@intel.com> X-Mailer: git-send-email 2.25.1 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 When the legacy capability flag was enabled for QAT GEN3, in the case of the last legacy capability in the list being SM3 or SM4, when no slice is on the device, the loop continues instead of checking if the end of the legacy capbilities list has been met. To fix this, the check for the end of the legacy capabilities list is moved to the top of the loop, so it is detected when the last legacy element is SM and no SM slice exists. Fixes: cffb726b7797 ("crypto/qat: enable insecure algorithms") Cc: stable@dpdk.org Signed-off-by: Ciara Power --- drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c b/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c index 0a939161f9..150f77ab0c 100644 --- a/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c +++ b/drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c @@ -232,6 +232,13 @@ qat_sym_crypto_cap_get_gen3(struct qat_cryptodev_private *internals, } for (i = 0; i < capa_num; i++, iter++) { + if (unlikely(qat_legacy_capa) && (i == legacy_capa_num)) { + capabilities = qat_sym_crypto_caps_gen3; + addr += curr_capa; + curr_capa = 0; + iter = 0; + } + if (slice_map & ICP_ACCEL_MASK_SM4_SLICE && ( check_cipher_capa(&capabilities[iter], RTE_CRYPTO_CIPHER_SM4_ECB) || @@ -249,13 +256,6 @@ qat_sym_crypto_cap_get_gen3(struct qat_cryptodev_private *internals, memcpy(addr + curr_capa, capabilities + iter, sizeof(struct rte_cryptodev_capabilities)); curr_capa++; - - if (unlikely(qat_legacy_capa) && (i == legacy_capa_num-1)) { - capabilities = qat_sym_crypto_caps_gen3; - addr += curr_capa; - curr_capa = 0; - iter = -1; - } } internals->qat_dev_capabilities = internals->capa_mz->addr;