DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/3] app/crypto-perf: use right API to free session
@ 2023-01-02 11:46 Anoob Joseph
  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
  0 siblings, 2 replies; 4+ messages in thread
From: Anoob Joseph @ 2023-01-02 11:46 UTC (permalink / raw)
  To: Ciara Power, Akhil Goyal
  Cc: Gagandeep Singh, Hemant Agrawal, Jerin Jacob, Tejasree Kondoj, dev

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-04 12:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-02 11:46 [PATCH 1/3] app/crypto-perf: use right API to free session Anoob Joseph
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

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).