From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B2008454FF; Wed, 26 Jun 2024 10:49:01 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B404742E8F; Wed, 26 Jun 2024 10:48:33 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id BB65E40611 for ; Wed, 26 Jun 2024 10:48:17 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45Q5RfPD005327; Wed, 26 Jun 2024 01:48:17 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=9 kl4wXRED6O49UDjIRevUi+AcQ1s5W+lewWa6nO0d00=; b=gPwbJMq+aOHzPf1JM h+Eu2rll1ooTKxSmYFE6Y+4E+MmUBKPffs/auaHQ8ozNLgijh5CqaRPUCjasKicZ peU5bI9hdyH2mCVqHlaaiPhMPLCGtaSGWrryJQPy3+rxjSCo4PgdcMSalik+pf35 rqYZN6u6zTC3X4PS2D59DE5snraUy9xjJS5g6FlrZNGjphfjDc+M5IUTmZs0B/df QZ9D0z5HOpmwJC/Dw6C1AR1OeJCBaftAGPNQIQo9tBg0zQ/XHX3ml9oecivZ8kVt EZiAYRQ5K9bxKJ6S2GaNSObHEzLT5Q6v+573dhoPr6tk+dGKkIExM6IjRo0FGQ6S DU3eA== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 400cur8jgp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 26 Jun 2024 01:48:17 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Wed, 26 Jun 2024 01:48:15 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Wed, 26 Jun 2024 01:48:15 -0700 Received: from BG-LT91401.marvell.com (BG-LT91401.marvell.com [10.28.168.34]) by maili.marvell.com (Postfix) with ESMTP id E66D33F707B; Wed, 26 Jun 2024 01:48:13 -0700 (PDT) From: Gowrishankar Muthukrishnan To: , Ciara Power CC: Anoob Joseph , Akhil Goyal , Gowrishankar Muthukrishnan Subject: [PATCH v2 4/6] app/crypto-perf: add function to check asymmetric operation Date: Wed, 26 Jun 2024 14:17:43 +0530 Message-ID: <20240626084747.1595-5-gmuthukrishn@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20240626084747.1595-1-gmuthukrishn@marvell.com> References: <20240615115309.2678-1-gmuthukrishn@marvell.com> <20240626084747.1595-1-gmuthukrishn@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: EFUwXi4VQBwIoKNHWkcvs-V5kWOwAQj5 X-Proofpoint-GUID: EFUwXi4VQBwIoKNHWkcvs-V5kWOwAQj5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-26_03,2024-06-25_01,2024-05-17_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 Replace checking input option for every asymmetric test case by a function. Signed-off-by: Gowrishankar Muthukrishnan --- v2: - cperf_is_asym_test is fixed to check only modex in this patch. --- app/test-crypto-perf/cperf_test_common.c | 11 ++++++++++- app/test-crypto-perf/cperf_test_common.h | 2 ++ app/test-crypto-perf/cperf_test_latency.c | 7 ++++--- app/test-crypto-perf/cperf_test_throughput.c | 2 +- app/test-crypto-perf/cperf_test_verify.c | 2 +- app/test-crypto-perf/main.c | 8 ++++---- 6 files changed, 22 insertions(+), 10 deletions(-) diff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto-perf/cperf_test_common.c index 6b8ab65731..0f1f0b72c1 100644 --- a/app/test-crypto-perf/cperf_test_common.c +++ b/app/test-crypto-perf/cperf_test_common.c @@ -152,7 +152,7 @@ cperf_alloc_common_memory(const struct cperf_options *options, uint16_t crypto_op_size = sizeof(struct rte_crypto_op); uint16_t crypto_op_private_size; - if (options->op_type == CPERF_ASYM_MODEX) { + if (cperf_is_asym_test(options)) { crypto_op_size += sizeof(struct rte_crypto_asym_op); snprintf(pool_name, RTE_MEMPOOL_NAMESIZE, "perf_asym_op_pool%u", rte_socket_id()); @@ -301,3 +301,12 @@ cperf_mbuf_set(struct rte_mbuf *mbuf, mbuf = mbuf->next; } } + +bool +cperf_is_asym_test(const struct cperf_options *options) +{ + if (options->op_type == CPERF_ASYM_MODEX) + return true; + + return false; +} diff --git a/app/test-crypto-perf/cperf_test_common.h b/app/test-crypto-perf/cperf_test_common.h index a603a607d5..2d1f69aaa2 100644 --- a/app/test-crypto-perf/cperf_test_common.h +++ b/app/test-crypto-perf/cperf_test_common.h @@ -26,4 +26,6 @@ cperf_mbuf_set(struct rte_mbuf *mbuf, const struct cperf_options *options, const struct cperf_test_vector *test_vector); +bool +cperf_is_asym_test(const struct cperf_options *options); #endif /* _CPERF_TEST_COMMON_H_ */ diff --git a/app/test-crypto-perf/cperf_test_latency.c b/app/test-crypto-perf/cperf_test_latency.c index 376847e761..201815b469 100644 --- a/app/test-crypto-perf/cperf_test_latency.c +++ b/app/test-crypto-perf/cperf_test_latency.c @@ -47,7 +47,7 @@ cperf_latency_test_free(struct cperf_latency_ctx *ctx) return; if (ctx->sess != NULL) { - if (ctx->options->op_type == CPERF_ASYM_MODEX) + if (cperf_is_asym_test(ctx->options)) rte_cryptodev_asym_session_free(ctx->dev_id, ctx->sess); #ifdef RTE_LIB_SECURITY else if (ctx->options->op_type == CPERF_PDCP || @@ -217,8 +217,9 @@ cperf_latency_test_runner(void *arg) &imix_idx, &tsc_start); /* Populate the mbuf with the test vector */ - for (i = 0; i < burst_size; i++) - cperf_mbuf_set(ops[i]->sym->m_src, + if (!cperf_is_asym_test(ctx->options)) + for (i = 0; i < burst_size; i++) + cperf_mbuf_set(ops[i]->sym->m_src, ctx->options, ctx->test_vector); diff --git a/app/test-crypto-perf/cperf_test_throughput.c b/app/test-crypto-perf/cperf_test_throughput.c index c0891e7c99..7112b95529 100644 --- a/app/test-crypto-perf/cperf_test_throughput.c +++ b/app/test-crypto-perf/cperf_test_throughput.c @@ -37,7 +37,7 @@ cperf_throughput_test_free(struct cperf_throughput_ctx *ctx) if (!ctx) return; if (ctx->sess) { - if (ctx->options->op_type == CPERF_ASYM_MODEX) + if (cperf_is_asym_test(ctx->options)) rte_cryptodev_asym_session_free(ctx->dev_id, (void *)ctx->sess); #ifdef RTE_LIB_SECURITY diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c index 222c7a1cd8..91429841ca 100644 --- a/app/test-crypto-perf/cperf_test_verify.c +++ b/app/test-crypto-perf/cperf_test_verify.c @@ -42,7 +42,7 @@ cperf_verify_test_free(struct cperf_verify_ctx *ctx) return; if (ctx->sess != NULL) { - if (ctx->options->op_type == CPERF_ASYM_MODEX) + if (cperf_is_asym_test(ctx->options)) rte_cryptodev_asym_session_free(ctx->dev_id, ctx->sess); #ifdef RTE_LIB_SECURITY else if (ctx->options->op_type == CPERF_PDCP || diff --git a/app/test-crypto-perf/main.c b/app/test-crypto-perf/main.c index 40c0b4b54f..780f22f399 100644 --- a/app/test-crypto-perf/main.c +++ b/app/test-crypto-perf/main.c @@ -18,6 +18,7 @@ #include "cperf.h" #include "cperf_options.h" #include "cperf_test_vector_parsing.h" +#include "cperf_test_common.h" #include "cperf_test_throughput.h" #include "cperf_test_latency.h" #include "cperf_test_verify.h" @@ -203,7 +204,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs) rte_cryptodev_info_get(cdev_id, &cdev_info); - if (opts->op_type == CPERF_ASYM_MODEX) { + if (cperf_is_asym_test(opts)) { if ((cdev_info.feature_flags & RTE_CRYPTODEV_FF_ASYMMETRIC_CRYPTO) == 0) continue; @@ -289,7 +290,7 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs) return -ENOTSUP; } - if (opts->op_type == CPERF_ASYM_MODEX) + if (cperf_is_asym_test(opts)) ret = create_asym_op_pool_socket(socket_id, sessions_needed); else @@ -300,9 +301,8 @@ cperf_initialize_cryptodev(struct cperf_options *opts, uint8_t *enabled_cdevs) qp_conf.mp_session = session_pool_socket[socket_id].sess_mp; - if (opts->op_type == CPERF_ASYM_MODEX) { + if (cperf_is_asym_test(opts)) qp_conf.mp_session = NULL; - } ret = rte_cryptodev_configure(cdev_id, &conf); if (ret < 0) { -- 2.25.1