From patchwork Fri Sep 18 13:45:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Dwivedi X-Patchwork-Id: 78105 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 21F2FA04C8; Fri, 18 Sep 2020 15:46:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7A1711C135; Fri, 18 Sep 2020 15:46:55 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 7336C1C127 for ; Fri, 18 Sep 2020 15:46:54 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 08IDjsVV001625; Fri, 18 Sep 2020 06:46:53 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=7p7fjnc6Sn8HtzttY4f0dmBsS7RNNWTpdUnUYW2JH3Y=; b=SkevoNydkFXIm3KlutXWy3gH6P6w1dcadJPC1qE5uTb6LAGBy2/6dhMuekvOVSaL/msh g+ogMQUecNx74JcEvKY9GHykjk9zZLloliRWlULrRpLHK8V23n1kHr8hNWNtQ1OcBBPO 1hQ/czv7SqCnRMz0sBjIiBHvpZ7U4h9e2F9t6dVeFQKifJU0m1KBM/k8hLr+SFuaVWzW 5qdkjnzhQ5AHidS9hcAvrrmPuuilFIXkEdAAICK7dCPVYkP/CrGbCF638reLPqRRkr3k RFyzv4p/0yc2BiXa3BKT/GJlsy5FpV21FT1ZpbI4ES3YjPml+gNImVZ/wpEzchaezZzd /Q== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 33m73p4hj1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 18 Sep 2020 06:46:53 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 18 Sep 2020 06:46:52 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 18 Sep 2020 06:46:51 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 18 Sep 2020 06:46:51 -0700 Received: from hyd1349.t110.caveonetworks.com (unknown [10.29.45.13]) by maili.marvell.com (Postfix) with ESMTP id 5F0833F703F; Fri, 18 Sep 2020 06:46:49 -0700 (PDT) From: Ankur Dwivedi To: CC: , , , Ankur Dwivedi Date: Fri, 18 Sep 2020 19:15:45 +0530 Message-ID: <20200918134545.26983-1-adwivedi@marvell.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908091930.24422-1-adwivedi@marvell.com> References: <20200908091930.24422-1-adwivedi@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-18_14:2020-09-16, 2020-09-18 signatures=0 Subject: [dpdk-dev] [PATCH v2] crypto/octeontx2: fix sessionless code X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" A temporary session is created for sessionless crypto operations. rte_cryptodev_sym_session_create() should be used for creating the temporary session as it initializes the session structure in the correct way. Also the session should be set to 0 before freeing it. Fixes: 17ac2a72191b ("crypto/octeontx2: add enqueue/dequeue ops") Signed-off-by: Ankur Dwivedi --- v2: * Use local variable to hold session size drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c index 9d51b17dd..707f92562 100644 --- a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c +++ b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c @@ -648,8 +648,8 @@ otx2_cpt_enqueue_sym_sessless(struct otx2_cpt_qp *qp, struct rte_crypto_op *op, int ret; /* Create temporary session */ - - if (rte_mempool_get(qp->sess_mp, (void **)&sess)) + sess = rte_cryptodev_sym_session_create(qp->sess_mp); + if (sess == NULL) return -ENOMEM; ret = sym_session_configure(driver_id, sym_op->xform, sess, @@ -866,6 +866,8 @@ static inline void otx2_cpt_dequeue_post_process(struct otx2_cpt_qp *qp, struct rte_crypto_op *cop, uintptr_t *rsp, uint8_t cc) { + unsigned int sz; + if (cop->type == RTE_CRYPTO_OP_TYPE_SYMMETRIC) { if (cop->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) { if (likely(cc == OTX2_IPSEC_PO_CC_SUCCESS)) { @@ -894,6 +896,9 @@ otx2_cpt_dequeue_post_process(struct otx2_cpt_qp *qp, struct rte_crypto_op *cop, if (unlikely(cop->sess_type == RTE_CRYPTO_OP_SESSIONLESS)) { sym_session_clear(otx2_cryptodev_driver_id, cop->sym->session); + sz = rte_cryptodev_sym_get_existing_header_session_size( + cop->sym->session); + memset(cop->sym->session, 0, sz); rte_mempool_put(qp->sess_mp, cop->sym->session); cop->sym->session = NULL; }