From patchwork Thu Dec 7 13:02:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anoob Joseph X-Patchwork-Id: 134915 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 BAB2243699; Thu, 7 Dec 2023 14:02:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3C57542F01; Thu, 7 Dec 2023 14:02:34 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 89E3442EF9 for ; Thu, 7 Dec 2023 14:02:33 +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 3B79PGlY032068; Thu, 7 Dec 2023 05:02:33 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=52v5upLckfw4zt114makwr30nXDC5nm94Zen5ja3mCk=; b=Z1L8v7ROJeIA5N3AQcJ9LzN5oW3WntlJe22TZP2GALFuqPEh3AMKW8BlVSDC5/+HbEMW V3DZYCNINMK8LAXkBEB+nLkOqLeYrJSLxmZOMrI5TRYog/Y88Xy9hUFvQsLxPbwze2Q1 xr8NNZRUADY+1cckM2AlGyyMpJDOXOodA1sXOFkbodIytOGoXq2CABdKAXUkOWzOIjrN HIVQA90+YZIlXD2vMwTOoJ/Lxz9ZWtvUh0QgXppD7jGnhsCxCs6T5YWlfj00fMNKm+2+ MOKLKzItHdPoQmTfLMf3xIjRaAPe1jR/jjOn8iVhXKjmT2mMrsfqC/c7xcYkDD1f7xJG nA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3uubdd8n4q-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Dec 2023 05:02:32 -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.48; Thu, 7 Dec 2023 05:02:29 -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.48 via Frontend Transport; Thu, 7 Dec 2023 05:02:29 -0800 Received: from BG-LT92004.corp.innovium.com (unknown [10.28.163.189]) by maili.marvell.com (Postfix) with ESMTP id C9A153F7051; Thu, 7 Dec 2023 05:02:26 -0800 (PST) From: Anoob Joseph To: Akhil Goyal , Jerin Jacob CC: Harry van Haaren , Hemant Agrawal , Konstantin Ananyev , , Vidya Sagar Velumuri Subject: [PATCH 03/14] test/crypto: move algorithm display routines to common Date: Thu, 7 Dec 2023 18:32:05 +0530 Message-ID: <20231207130216.140-4-anoobj@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231207130216.140-1-anoobj@marvell.com> References: <20231207130216.140-1-anoobj@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: BgCBLV1RriMTyiMDV_7Hv66RL-ibnCrJ X-Proofpoint-GUID: BgCBLV1RriMTyiMDV_7Hv66RL-ibnCrJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-07_10,2023-12-07_01,2023-05-22_02 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 The functions that are used for printing algorithms in case of IPsec can be moved to the common header, test_security_proto.h. The same could be used for other security protocol testing. Signed-off-by: Anoob Joseph Signed-off-by: Vidya Sagar Velumuri --- app/test-security-perf/test_security_perf.c | 3 +-- app/test/test_cryptodev.c | 6 ++--- app/test/test_cryptodev_security_ipsec.c | 26 --------------------- app/test/test_cryptodev_security_ipsec.h | 3 --- app/test/test_security_inline_proto.c | 9 +++---- app/test/test_security_proto.c | 25 ++++++++++++++++++++ app/test/test_security_proto.h | 2 ++ 7 files changed, 33 insertions(+), 41 deletions(-) diff --git a/app/test-security-perf/test_security_perf.c b/app/test-security-perf/test_security_perf.c index c64f20e76c..84726de7b0 100644 --- a/app/test-security-perf/test_security_perf.c +++ b/app/test-security-perf/test_security_perf.c @@ -532,8 +532,7 @@ main(int argc, char **argv) for (ctx.td_idx = 0; ctx.td_idx < RTE_DIM(alg_list); ctx.td_idx++) { printf("\n\n Algorithm combination:"); - test_ipsec_display_alg(alg_list[ctx.td_idx].param1, - alg_list[ctx.td_idx].param2); + test_sec_alg_display(alg_list[ctx.td_idx].param1, alg_list[ctx.td_idx].param2); printf(" ----------------------"); printf("\n%20s%20s%20s%20s%20s%20s\n\n", diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 9644566acc..218761f0a9 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -10540,8 +10540,7 @@ test_ipsec_proto_all(const struct ipsec_test_flags *flags) return TEST_FAILED; if (flags->display_alg) - test_ipsec_display_alg(alg_list[i].param1, - alg_list[i].param2); + test_sec_alg_display(alg_list[i].param1, alg_list[i].param2); pass_cnt++; } @@ -10586,8 +10585,7 @@ test_ipsec_ah_proto_all(const struct ipsec_test_flags *flags) return TEST_FAILED; if (flags->display_alg) - test_ipsec_display_alg(ah_alg_list[i].param1, - ah_alg_list[i].param2); + test_sec_alg_display(ah_alg_list[i].param1, ah_alg_list[i].param2); pass_cnt++; } diff --git a/app/test/test_cryptodev_security_ipsec.c b/app/test/test_cryptodev_security_ipsec.c index 01e0a45ffd..dafe3244e8 100644 --- a/app/test/test_cryptodev_security_ipsec.c +++ b/app/test/test_cryptodev_security_ipsec.c @@ -549,32 +549,6 @@ test_ipsec_td_update(struct ipsec_test_data td_inb[], } } -void -test_ipsec_display_alg(const struct crypto_param *param1, - const struct crypto_param *param2) -{ - if (param1->type == RTE_CRYPTO_SYM_XFORM_AEAD) { - printf("\t%s [%d]", - rte_cryptodev_get_aead_algo_string(param1->alg.aead), - param1->key_length * 8); - } else if (param1->type == RTE_CRYPTO_SYM_XFORM_AUTH) { - printf("\t%s", - rte_cryptodev_get_auth_algo_string(param1->alg.auth)); - if (param1->alg.auth != RTE_CRYPTO_AUTH_NULL) - printf(" [%dB ICV]", param1->digest_length); - } else { - printf("\t%s", - rte_cryptodev_get_cipher_algo_string(param1->alg.cipher)); - if (param1->alg.cipher != RTE_CRYPTO_CIPHER_NULL) - printf(" [%d]", param1->key_length * 8); - printf(" %s", - rte_cryptodev_get_auth_algo_string(param2->alg.auth)); - if (param2->alg.auth != RTE_CRYPTO_AUTH_NULL) - printf(" [%dB ICV]", param2->digest_length); - } - printf("\n"); -} - static int test_ipsec_tunnel_hdr_len_get(const struct ipsec_test_data *td) { diff --git a/app/test/test_cryptodev_security_ipsec.h b/app/test/test_cryptodev_security_ipsec.h index 77cb5fa7f9..41aa865a0f 100644 --- a/app/test/test_cryptodev_security_ipsec.h +++ b/app/test/test_cryptodev_security_ipsec.h @@ -155,9 +155,6 @@ void test_ipsec_td_update(struct ipsec_test_data td_inb[], int nb_td, const struct ipsec_test_flags *flags); -void test_ipsec_display_alg(const struct crypto_param *param1, - const struct crypto_param *param2); - int test_ipsec_post_process(const struct rte_mbuf *m, const struct ipsec_test_data *td, struct ipsec_test_data *res_d, bool silent, diff --git a/app/test/test_security_inline_proto.c b/app/test/test_security_inline_proto.c index 9644a3c39c..6cda9fe7aa 100644 --- a/app/test/test_security_inline_proto.c +++ b/app/test/test_security_inline_proto.c @@ -1345,8 +1345,7 @@ test_ipsec_inline_proto_all(const struct ipsec_test_flags *flags) if (ret == TEST_FAILED) { printf("\n TEST FAILED"); - test_ipsec_display_alg(alg_list[i].param1, - alg_list[i].param2); + test_sec_alg_display(alg_list[i].param1, alg_list[i].param2); fail_cnt++; continue; } @@ -1360,15 +1359,13 @@ test_ipsec_inline_proto_all(const struct ipsec_test_flags *flags) if (ret == TEST_FAILED) { printf("\n TEST FAILED"); - test_ipsec_display_alg(alg_list[i].param1, - alg_list[i].param2); + test_sec_alg_display(alg_list[i].param1, alg_list[i].param2); fail_cnt++; continue; } if (flags->display_alg) - test_ipsec_display_alg(alg_list[i].param1, - alg_list[i].param2); + test_sec_alg_display(alg_list[i].param1, alg_list[i].param2); pass_cnt++; } diff --git a/app/test/test_security_proto.c b/app/test/test_security_proto.c index bc4c5e11d2..d62302a8dd 100644 --- a/app/test/test_security_proto.c +++ b/app/test/test_security_proto.c @@ -81,3 +81,28 @@ test_sec_crypto_caps_auth_verify(const struct rte_security_capability *sec_cap, return -ENOTSUP; } + +void +test_sec_alg_display(const struct crypto_param *param1, const struct crypto_param *param2) +{ + if (param1->type == RTE_CRYPTO_SYM_XFORM_AEAD) { + printf("\t%s [%d]", + rte_cryptodev_get_aead_algo_string(param1->alg.aead), + param1->key_length * 8); + } else if (param1->type == RTE_CRYPTO_SYM_XFORM_AUTH) { + printf("\t%s", + rte_cryptodev_get_auth_algo_string(param1->alg.auth)); + if (param1->alg.auth != RTE_CRYPTO_AUTH_NULL) + printf(" [%dB ICV]", param1->digest_length); + } else { + printf("\t%s", + rte_cryptodev_get_cipher_algo_string(param1->alg.cipher)); + if (param1->alg.cipher != RTE_CRYPTO_CIPHER_NULL) + printf(" [%d]", param1->key_length * 8); + printf(" %s", + rte_cryptodev_get_auth_algo_string(param2->alg.auth)); + if (param2->alg.auth != RTE_CRYPTO_AUTH_NULL) + printf(" [%dB ICV]", param2->digest_length); + } + printf("\n"); +} diff --git a/app/test/test_security_proto.h b/app/test/test_security_proto.h index e8d6193530..596402fff9 100644 --- a/app/test/test_security_proto.h +++ b/app/test/test_security_proto.h @@ -141,4 +141,6 @@ int test_sec_crypto_caps_cipher_verify(const struct rte_security_capability *sec int test_sec_crypto_caps_auth_verify(const struct rte_security_capability *sec_cap, struct rte_crypto_sym_xform *auth); +void test_sec_alg_display(const struct crypto_param *param1, const struct crypto_param *param2); + #endif