Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19998C43463 for ; Fri, 18 Sep 2020 13:46:57 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 6E16C206D9 for ; Fri, 18 Sep 2020 13:46:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="SkevoNyd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6E16C206D9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=marvell.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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; } -- 2.28.0