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 98906A00C3 for ; Wed, 23 Feb 2022 17:02:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 86C2C4271A; Wed, 23 Feb 2022 17:02:57 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 0DA89411B2; Wed, 23 Feb 2022 17:02:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645632175; x=1677168175; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EvJ41HASOG00fe/pQeYPIrYSbihg9Bx0GmmbmHUgIuo=; b=lGGbliX8GPMaFD0jRd/qMWfyJ2pTEVZ8OHTdJMpZcaXYcPz10DuuWo1o xpIlES+iLiB+LBFFLFGUnx6CD2hxE860rYI++/dm/VkPnpn3JF5Z4b7Xm eg8Y73j/eDKBqKNGugn2k+uK4SgIkQOAgCHhG6pfzmEeeicNedpDEIJ0h 5xCsIzDoGr27CAfZU3ITeb/g6l1UOJcVMk+CxlnbJde0gBOSOjvOLfKtg PJcoqIbGjUpawB4K1437grMGWq9EDf7CDMf1B82YrmCTeW/ToWmEapF3K lQBPP2LxZBkx3DFE5ObyUUTVlKUd0czrqgIk46kkIfF3rG4e4ymd8AzL4 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10267"; a="276616866" X-IronPort-AV: E=Sophos;i="5.88,391,1635231600"; d="scan'208";a="276616866" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2022 08:02:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,391,1635231600"; d="scan'208";a="508485827" Received: from silpixa00400636.ir.intel.com ([10.237.213.19]) by orsmga006.jf.intel.com with ESMTP; 23 Feb 2022 08:02:25 -0800 From: Pablo de Lara To: roy.fan.zhang@intel.com, gakhil@marvell.com Cc: dev@dpdk.org, Pablo de Lara , stable@dpdk.org Subject: [PATCH v2 3/4] crypto/ipsec_mb: fix crypto operation overwrite Date: Wed, 23 Feb 2022 16:01:15 +0000 Message-Id: <20220223160116.736804-4-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220223160116.736804-1-pablo.de.lara.guarch@intel.com> References: <20220218163443.3520756-1-pablo.de.lara.guarch@intel.com> <20220223160116.736804-1-pablo.de.lara.guarch@intel.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 ZUC PMD batches crypto operations depending on their type (encryption + tag generation, tag verification + decryption, etc), to allow parallelization. The array used to store the pointers to these operations was always the same array provided by dequeue_burst() function, and it was looping around the same positions (from 0 to ZUC_MAX_BURST - 1). A new internal array is used to avoid overwriting the pointers of the array provided by dequeue_burst() function. Fixes: cf7685d68f00 ("crypto/zuc: add driver for ZUC library") Cc: pablo.de.lara.guarch@intel.com Cc: stable@dpdk.org Signed-off-by: Pablo de Lara --- drivers/crypto/ipsec_mb/pmd_zuc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/ipsec_mb/pmd_zuc.c b/drivers/crypto/ipsec_mb/pmd_zuc.c index 07cf1462d2..e36c7092d6 100644 --- a/drivers/crypto/ipsec_mb/pmd_zuc.c +++ b/drivers/crypto/ipsec_mb/pmd_zuc.c @@ -259,6 +259,7 @@ zuc_pmd_dequeue_burst(void *queue_pair, struct zuc_session *curr_sess; struct zuc_session *sessions[ZUC_MAX_BURST]; + struct rte_crypto_op *int_c_ops[ZUC_MAX_BURST]; enum ipsec_mb_operation prev_zuc_op = IPSEC_MB_OP_NOT_SUPPORTED; enum ipsec_mb_operation curr_zuc_op; struct ipsec_mb_qp *qp = queue_pair; @@ -290,11 +291,11 @@ zuc_pmd_dequeue_burst(void *queue_pair, */ if (burst_size == 0) { prev_zuc_op = curr_zuc_op; - c_ops[0] = curr_c_op; + int_c_ops[0] = curr_c_op; sessions[0] = curr_sess; burst_size++; } else if (curr_zuc_op == prev_zuc_op) { - c_ops[burst_size] = curr_c_op; + int_c_ops[burst_size] = curr_c_op; sessions[burst_size] = curr_sess; burst_size++; /* @@ -302,7 +303,7 @@ zuc_pmd_dequeue_burst(void *queue_pair, * process them, and start a new batch. */ if (burst_size == ZUC_MAX_BURST) { - processed_ops = process_ops(c_ops, curr_zuc_op, + processed_ops = process_ops(int_c_ops, curr_zuc_op, sessions, qp, burst_size); if (processed_ops < burst_size) { burst_size = 0; @@ -316,7 +317,7 @@ zuc_pmd_dequeue_burst(void *queue_pair, * Different operation type, process the ops * of the previous type. */ - processed_ops = process_ops(c_ops, prev_zuc_op, + processed_ops = process_ops(int_c_ops, prev_zuc_op, sessions, qp, burst_size); if (processed_ops < burst_size) { burst_size = 0; @@ -326,7 +327,7 @@ zuc_pmd_dequeue_burst(void *queue_pair, burst_size = 0; prev_zuc_op = curr_zuc_op; - c_ops[0] = curr_c_op; + int_c_ops[0] = curr_c_op; sessions[0] = curr_sess; burst_size++; } @@ -334,7 +335,7 @@ zuc_pmd_dequeue_burst(void *queue_pair, if (burst_size != 0) { /* Process the crypto ops of the last operation type. */ - processed_ops = process_ops(c_ops, prev_zuc_op, + processed_ops = process_ops(int_c_ops, prev_zuc_op, sessions, qp, burst_size); } -- 2.25.1