From patchwork Tue Sep 8 09:19:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ankur Dwivedi X-Patchwork-Id: 76903 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 8092AA04AA; Tue, 8 Sep 2020 11:19:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6727F1BE0C; Tue, 8 Sep 2020 11:19:47 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id C98572BAB for ; Tue, 8 Sep 2020 11:19:46 +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 0889Ax9w007252; Tue, 8 Sep 2020 02:19:46 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=VNItExFdjcHQLb7cUvwSk2YrzwnBBYvla3tlJp9FExM=; b=k3okrXzo14smbfO/mT4Uq6nimlLUQHzK70yek8jwqpPPsLg3LGgi5zzXhUunbv6lXLa9 Pi21qOnxr+X6MpH0pucsZ4mdhmbkAhUoSNKlUH6XRiIJ/I/Lrw2pE4MRAXiaJcGQsPhT gcXv3eTbf8M4YeTDPa5SsXKNZAc9iEjE6sCHNt7l6rDLpHbtkTOt0e6ee6L3Ud0U6B2J KCTgyVbDAaCwrGplB7QrzaIqLdOm4GmTuOk2fvxWvGvTQNFV0LxUzPkYYxW74DENPwfd jB3Wv892LwbgdtXhd2oJcc7o8quxLuBin9rIt1UIYKSUfRZ/kjDOVPRqvDCZS5ec1bIL nw== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 33ccvr1qpk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 08 Sep 2020 02:19:46 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 8 Sep 2020 02:19:44 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 8 Sep 2020 02:19:44 -0700 Received: from hyd1349.t110.caveonetworks.com (unknown [10.29.45.13]) by maili.marvell.com (Postfix) with ESMTP id E8EF33F704B; Tue, 8 Sep 2020 02:19:42 -0700 (PDT) From: Ankur Dwivedi To: CC: , , , Ankur Dwivedi Date: Tue, 8 Sep 2020 14:49:30 +0530 Message-ID: <20200908091930.24422-1-adwivedi@marvell.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-09-08_04:2020-09-08, 2020-09-08 signatures=0 Subject: [dpdk-dev] [PATCH] 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 Acked-by: Anoob Joseph --- drivers/crypto/octeontx2/otx2_cryptodev_ops.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/octeontx2/otx2_cryptodev_ops.c b/drivers/crypto/octeontx2/otx2_cryptodev_ops.c index 9d51b17dd..ccf566d5f 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, @@ -894,6 +894,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); + memset(cop->sym->session, 0, + rte_cryptodev_sym_get_existing_header_session_size( + cop->sym->session)); rte_mempool_put(qp->sess_mp, cop->sym->session); cop->sym->session = NULL; }