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 0C7E5A034C; Wed, 27 Apr 2022 17:11:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B7CAB42805; Wed, 27 Apr 2022 17:11:16 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 49BD940691 for ; Wed, 27 Apr 2022 17:11:15 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 23R8vUbg029540; Wed, 27 Apr 2022 08:11:14 -0700 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=p3+zihi6q/w49yoLmJJeV7USOhC1CTvaflL+7OyUONQ=; b=Y7c4KL8j9fSItAMfE8PxZ81PDJgUvBQMp+aWF3BpraJ1N/EKHdrqCXKtR0PkAUS6EO2P WT5tM7xc2EqNTYEQFXyEx0GWCp70dR/ZWhrsmR3MKnHfnWTTGSmce8cIEoL4KSBOLY2d Zrvcj9uoN0cBpxrYJbZZiu8AKRh/kHZphWu+quwGlHdbSouGioD6GIfssK5iG6l4s9/8 WsI0xthowswg6MLLEbPpU3gtXvF0PptHVd+n4G+nS7IfeTJvm0Xs2TdXjV3/nK58AN1T 7RZfO1lg3e6wpi1RSvPqWF2IBA9M8BCj1wj0QRgX5HgegyU8YPVAMra5hXNH6EwJ/Jee Sw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3fprsqub6k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 27 Apr 2022 08:11:14 -0700 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.2; Wed, 27 Apr 2022 08:11:12 -0700 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.18 via Frontend Transport; Wed, 27 Apr 2022 08:11:12 -0700 Received: from localhost.localdomain (unknown [10.28.48.55]) by maili.marvell.com (Postfix) with ESMTP id 680275B694F; Wed, 27 Apr 2022 08:11:09 -0700 (PDT) From: Akhil Goyal To: CC: , , , , , , , , , , Akhil Goyal Subject: [PATCH v5 3/7] test/security: add combined mode inline IPsec cases Date: Wed, 27 Apr 2022 20:40:50 +0530 Message-ID: <20220427151054.2536675-4-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220427151054.2536675-1-gakhil@marvell.com> References: <20220416192530.173895-1-gakhil@marvell.com> <20220427151054.2536675-1-gakhil@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: OX6VAtz-ljH4MaJxCgvenEIrFKJGthrc X-Proofpoint-GUID: OX6VAtz-ljH4MaJxCgvenEIrFKJGthrc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-04-27_04,2022-04-27_01,2022-02-23_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 Added combined encap and decap test cases for various algorithm combinations Signed-off-by: Akhil Goyal --- app/test/test_security_inline_proto.c | 102 ++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/app/test/test_security_inline_proto.c b/app/test/test_security_inline_proto.c index 7dd9ba7aff..ea36d1188c 100644 --- a/app/test/test_security_inline_proto.c +++ b/app/test/test_security_inline_proto.c @@ -660,6 +660,92 @@ test_ipsec_inline_proto_process(struct ipsec_test_data *td, return ret; } +static int +test_ipsec_inline_proto_all(const struct ipsec_test_flags *flags) +{ + struct ipsec_test_data td_outb; + struct ipsec_test_data td_inb; + unsigned int i, nb_pkts = 1, pass_cnt = 0, fail_cnt = 0; + int ret; + + if (flags->iv_gen || flags->sa_expiry_pkts_soft || + flags->sa_expiry_pkts_hard) + nb_pkts = IPSEC_TEST_PACKETS_MAX; + + for (i = 0; i < RTE_DIM(alg_list); i++) { + test_ipsec_td_prepare(alg_list[i].param1, + alg_list[i].param2, + flags, &td_outb, 1); + + if (!td_outb.aead) { + enum rte_crypto_cipher_algorithm cipher_alg; + enum rte_crypto_auth_algorithm auth_alg; + + cipher_alg = td_outb.xform.chain.cipher.cipher.algo; + auth_alg = td_outb.xform.chain.auth.auth.algo; + + if (td_outb.aes_gmac && cipher_alg != RTE_CRYPTO_CIPHER_NULL) + continue; + + /* ICV is not applicable for NULL auth */ + if (flags->icv_corrupt && + auth_alg == RTE_CRYPTO_AUTH_NULL) + continue; + + /* IV is not applicable for NULL cipher */ + if (flags->iv_gen && + cipher_alg == RTE_CRYPTO_CIPHER_NULL) + continue; + } + + if (flags->udp_encap) + td_outb.ipsec_xform.options.udp_encap = 1; + + ret = test_ipsec_inline_proto_process(&td_outb, &td_inb, nb_pkts, + false, flags); + if (ret == TEST_SKIPPED) + continue; + + if (ret == TEST_FAILED) { + printf("\n TEST FAILED"); + test_ipsec_display_alg(alg_list[i].param1, + alg_list[i].param2); + fail_cnt++; + continue; + } + + test_ipsec_td_update(&td_inb, &td_outb, 1, flags); + + ret = test_ipsec_inline_proto_process(&td_inb, NULL, nb_pkts, + false, flags); + if (ret == TEST_SKIPPED) + continue; + + if (ret == TEST_FAILED) { + printf("\n TEST FAILED"); + test_ipsec_display_alg(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); + + pass_cnt++; + } + + printf("Tests passed: %d, failed: %d", pass_cnt, fail_cnt); + if (fail_cnt > 0) + return TEST_FAILED; + if (pass_cnt > 0) + return TEST_SUCCESS; + else + return TEST_SKIPPED; +} + + static int ut_setup_inline_ipsec(void) { @@ -836,6 +922,17 @@ test_ipsec_inline_proto_known_vec_inb(const void *test_data) return test_ipsec_inline_proto_process(&td_inb, NULL, 1, false, &flags); } +static int +test_ipsec_inline_proto_display_list(const void *data __rte_unused) +{ + struct ipsec_test_flags flags; + + memset(&flags, 0, sizeof(flags)); + + flags.display_alg = true; + + return test_ipsec_inline_proto_all(&flags); +} static struct unit_test_suite inline_ipsec_testsuite = { .suite_name = "Inline IPsec Ethernet Device Unit Test Suite", @@ -929,6 +1026,11 @@ static struct unit_test_suite inline_ipsec_testsuite = { test_ipsec_inline_proto_known_vec_inb, &pkt_null_aes_xcbc), + TEST_CASE_NAMED_ST( + "Combined test alg list", + ut_setup_inline_ipsec, ut_teardown_inline_ipsec, + test_ipsec_inline_proto_display_list), + TEST_CASES_END() /**< NULL terminate unit test array */ -- 2.25.1