From: Anoob Joseph <anoobj@marvell.com>
To: Ciara Power <ciara.power@intel.com>, Akhil Goyal <gakhil@marvell.com>
Cc: Gagandeep Singh <g.singh@nxp.com>,
Hemant Agrawal <hemant.agrawal@nxp.com>,
Jerin Jacob <jerinj@marvell.com>,
Tejasree Kondoj <ktejasree@marvell.com>, <dev@dpdk.org>
Subject: [PATCH 1/3] app/crypto-perf: use right API to free session
Date: Mon, 2 Jan 2023 17:16:53 +0530 [thread overview]
Message-ID: <20230102114655.300-1-anoobj@marvell.com> (raw)
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 <anoobj@marvell.com>
---
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 *
--
2.25.1
next reply other threads:[~2023-01-02 11:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-02 11:46 Anoob Joseph [this message]
2023-01-02 11:46 ` [PATCH 2/3] app/crypto-perf: fix invalid SPI Anoob Joseph
2023-01-02 11:46 ` [PATCH 3/3] app/crypto-perf: fix IPsec direction Anoob Joseph
2023-01-04 12:08 ` Akhil Goyal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230102114655.300-1-anoobj@marvell.com \
--to=anoobj@marvell.com \
--cc=ciara.power@intel.com \
--cc=dev@dpdk.org \
--cc=g.singh@nxp.com \
--cc=gakhil@marvell.com \
--cc=hemant.agrawal@nxp.com \
--cc=jerinj@marvell.com \
--cc=ktejasree@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).