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 A87AAA050A; Sat, 16 Apr 2022 21:26:04 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C97C140E25; Sat, 16 Apr 2022 21:25:57 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id A168340685 for ; Sat, 16 Apr 2022 21:25:55 +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 23GIhiNw024978; Sat, 16 Apr 2022 12:25:54 -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=bGxaY8C8a7BceNZVjVwq/cPTkhW9BzVGZyJYGEDmoWg=; b=bs8kUzh0gVgoYXFKHpASjInRk8xcX5jvXYWdnYyhAEBpL/AoeohitQlsblCdSWa1t9Fn 4g77ikUymlF8+cdUdrFqVuXDtN2Z0fNSNtP6rtouO+y8mEq6gFfSPtUmZYgjCEGSa77M ZUWtnk8dL7eJxX9PelQSs3EpB8qLU511dVbdLe3RT8Rle63bStLrNnWTPLp1KDEoDRJC xqTzQN8tXXW0smBCDxNHveBitm1JYSLFi6QBnOq/iB6omHCs30gbIYoP0Mf9uqzbGNxV aoW/n1ODa67dYREmpgNYriDJvO5s/lo/CRpLv4VqcrMjK4cYKwMbih84Y7ZRRiU2Q5mK ng== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3ffu5p90yb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 16 Apr 2022 12:25:54 -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; Sat, 16 Apr 2022 12:25:53 -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; Sat, 16 Apr 2022 12:25:53 -0700 Received: from localhost.localdomain (unknown [10.28.48.55]) by maili.marvell.com (Postfix) with ESMTP id A70183F707A; Sat, 16 Apr 2022 12:25:49 -0700 (PDT) From: Akhil Goyal To: CC: , , , , , , , , , , Akhil Goyal Subject: [PATCH v4 03/10] test/security: add combined mode inline IPsec cases Date: Sun, 17 Apr 2022 00:55:23 +0530 Message-ID: <20220416192530.173895-4-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220416192530.173895-1-gakhil@marvell.com> References: <20220217172341.607360-1-gakhil@marvell.com> <20220416192530.173895-1-gakhil@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: MZQ9HndjKIlIQf8-jJbLSkFViuJwfAwG X-Proofpoint-ORIG-GUID: MZQ9HndjKIlIQf8-jJbLSkFViuJwfAwG 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-16_08,2022-04-15_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 fc0525479c..890bc10115 100644 --- a/app/test/test_security_inline_proto.c +++ b/app/test/test_security_inline_proto.c @@ -661,6 +661,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) { @@ -835,6 +921,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", @@ -928,6 +1025,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