From patchwork Mon Jan 2 11:46:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anoob Joseph X-Patchwork-Id: 121502 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 0E2D4A00C2; Mon, 2 Jan 2023 12:47:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A6B2040693; Mon, 2 Jan 2023 12:47:05 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id B55FB40689 for ; Mon, 2 Jan 2023 12:47:03 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3022wXmr005542; Mon, 2 Jan 2023 03:47:03 -0800 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=byPAoXBjMp7XnhdP4oHaPTUQ+yZc1+05DDvlUbN/buA=; b=huj5VE927L3cz3oK2nHXWt19zFmn4/+bIjmwY4hrYeBj0NoxOELXbFFHcBaoZzWuL+T0 nL5g63dmL4bTbBGbn8SSvmqsatEKxqCulp+XPM0TogunoSjexf0c1vIypxaaz+Z2/nFS mPA8daxFnX8hJUWbkRcffHXG/1EV2LZdcIk4Te5twE0B1ZTIrA++EaG6xbL3c+jCwMyX AtDE5nHr0uK0CQ2AL8RUBhyT325KRCa3fhysuab32uWk/kvw21Y40coaxRyAraRZGa76 0O4aqOSUF5C7+D7tjVdgWzrvHDhAlodYDl05s9ux3tDWAFvnOZ5JiMFQacsxlOsvmfNb gQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3mtnftbuwk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 02 Jan 2023 03:47:02 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 2 Jan 2023 03:47:00 -0800 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.42 via Frontend Transport; Mon, 2 Jan 2023 03:47:00 -0800 Received: from BG-LT92004.corp.innovium.com (unknown [10.193.74.65]) by maili.marvell.com (Postfix) with ESMTP id 95ECE3F7082; Mon, 2 Jan 2023 03:46:56 -0800 (PST) From: Anoob Joseph To: Ciara Power , Akhil Goyal CC: Gagandeep Singh , Hemant Agrawal , Jerin Jacob , Tejasree Kondoj , Subject: [PATCH 1/3] app/crypto-perf: use right API to free session Date: Mon, 2 Jan 2023 17:16:53 +0530 Message-ID: <20230102114655.300-1-anoobj@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-GUID: 0Heh_H8mF6ffK3nFx1h_DkyilytSwuJa X-Proofpoint-ORIG-GUID: 0Heh_H8mF6ffK3nFx1h_DkyilytSwuJa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-02_06,2022-12-30_01,2022-06-22_01 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 Use the right API for session freeing. Sessions can be asymmetric, symmetric or security. Fixes: 28dde5da503e ("app/crypto-perf: support lookaside IPsec") Fixes: a538d1d2d01e ("test/crypto-perf: extend asymmetric crypto throughput test") Signed-off-by: Anoob Joseph --- app/test-crypto-perf/cperf_test_latency.c | 27 +++++++++++++++++------ app/test-crypto-perf/cperf_test_verify.c | 25 ++++++++++++++++----- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c index 49bf421c01..406e082e4e 100644 --- a/app/test-crypto-perf/cperf_test_latency.c +++ b/app/test-crypto-perf/cperf_test_latency.c @@ -43,15 +43,28 @@ struct priv_op_data { static void cperf_latency_test_free(struct cperf_latency_ctx *ctx) { - if (ctx) { - if (ctx->sess) - rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess); - - rte_mempool_free(ctx->pool); + if (ctx == NULL) + return; - rte_free(ctx->res); - rte_free(ctx); + if (ctx->sess != NULL) { + if (ctx->options->op_type == CPERF_ASYM_MODEX) + rte_cryptodev_asym_session_free(ctx->dev_id, ctx->sess); +#ifdef RTE_LIB_SECURITY + else if (ctx->options->op_type == CPERF_PDCP || + ctx->options->op_type == CPERF_DOCSIS || + ctx->options->op_type == CPERF_IPSEC) { + struct rte_security_ctx *sec_ctx = + rte_cryptodev_get_sec_ctx(ctx->dev_id); + rte_security_session_destroy(sec_ctx, ctx->sess); + } +#endif + else + rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess); } + + rte_mempool_free(ctx->pool); + rte_free(ctx->res); + rte_free(ctx); } void * diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c index c03e1d5ba5..8042c94e04 100644 --- a/app/test-crypto-perf/cperf_test_verify.c +++ b/app/test-crypto-perf/cperf_test_verify.c @@ -38,14 +38,27 @@ struct cperf_op_result { static void cperf_verify_test_free(struct cperf_verify_ctx *ctx) { - if (ctx) { - if (ctx->sess) - rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess); - - rte_mempool_free(ctx->pool); + if (ctx == NULL) + return; - rte_free(ctx); + if (ctx->sess != NULL) { + if (ctx->options->op_type == CPERF_ASYM_MODEX) + rte_cryptodev_asym_session_free(ctx->dev_id, ctx->sess); +#ifdef RTE_LIB_SECURITY + else if (ctx->options->op_type == CPERF_PDCP || + ctx->options->op_type == CPERF_DOCSIS || + ctx->options->op_type == CPERF_IPSEC) { + struct rte_security_ctx *sec_ctx = + rte_cryptodev_get_sec_ctx(ctx->dev_id); + rte_security_session_destroy(sec_ctx, ctx->sess); + } +#endif + else + rte_cryptodev_sym_session_free(ctx->dev_id, ctx->sess); } + + rte_mempool_free(ctx->pool); + rte_free(ctx); } void *