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 2CC41A034F; Mon, 6 Dec 2021 09:00:14 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 35ABF40A4B; Mon, 6 Dec 2021 09:00:02 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id D685A41171 for ; Mon, 6 Dec 2021 08:59:59 +0100 (CET) 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 1B5MiLcn005836; Sun, 5 Dec 2021 23:59:59 -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=SkeL8WYiGzIIGoIEIp47bWOg0Uk4DgLl+yGkkGTK/8k=; b=jchamOhSImNQFLWRvKm+172fsmRnpZKd3wPf16XEliyRPrMuZpN60TVswvez/nUO4GGt L4Fuqfts5DnEjyxCkHBBZqQF7vccmzdwpGquK2cyUOyxB7Rg3KdQtYgSxX74mtxDkvdp +Hi8Gr0wJlR1RPxlV5ZUulLx4PRWFc+j9XT/a3q8VREgnUU8zQlgSEV2otT6520pT6E7 +pLjhRp6Y2XM4WByjnh71qtcTuRCjx/ui5jRam9koTNhzKwe2y7KeuVj7MKOxPc+g13H uRNJmPcRCN3N4wrN1v5BKOQeCNGOwJrveHksF+hxoj3uxSQsgEmIWsaOaWsK43n8242r vw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3cs0qn2746-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 05 Dec 2021 23:59:58 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 5 Dec 2021 23:59:57 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 5 Dec 2021 23:59:57 -0800 Received: from HY-LT1002.marvell.com (HY-LT1002.marvell.com [10.28.176.218]) by maili.marvell.com (Postfix) with ESMTP id C4FFE3F704A; Sun, 5 Dec 2021 23:59:53 -0800 (PST) From: Anoob Joseph To: Akhil Goyal , Declan Doherty , Fan Zhang , "Pablo de Lara" CC: Ankur Dwivedi , Jerin Jacob , Archana Muniganti , Tejasree Kondoj , Hemant Agrawal , "Radu Nicolau" , Ciara Power , Gagandeep Singh , Subject: [PATCH 08/13] test/crypto: add security stats cases Date: Mon, 6 Dec 2021 13:28:43 +0530 Message-ID: <1638777528-553-9-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1638777528-553-1-git-send-email-anoobj@marvell.com> References: <1638777528-553-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: WxIM6PhgTwImpfDaQ_M_sb7bMq_IJjuh X-Proofpoint-ORIG-GUID: WxIM6PhgTwImpfDaQ_M_sb7bMq_IJjuh X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2021-12-06_03,2021-12-06_01,2021-12-02_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 From: Ankur Dwivedi Adds security stats test cases in IPSEC protocol testsuite. Signed-off-by: Ankur Dwivedi --- app/test/test_cryptodev.c | 21 +++++++++++++++++++++ app/test/test_cryptodev_security_ipsec.c | 29 +++++++++++++++++++++++++++++ app/test/test_cryptodev_security_ipsec.h | 6 ++++++ 3 files changed, 56 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index f8f2660..34bc3e0 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -9332,6 +9332,11 @@ test_ipsec_proto_process(const struct ipsec_test_data td[], if (ret != TEST_SUCCESS) goto crypto_op_free; + ret = test_ipsec_stats_verify(ctx, ut_params->sec_session, + flags, dir); + if (ret != TEST_SUCCESS) + goto crypto_op_free; + rte_crypto_op_free(ut_params->op); ut_params->op = NULL; @@ -9653,6 +9658,18 @@ test_ipsec_proto_transport_v4(const void *data __rte_unused) } static int +test_ipsec_proto_stats(const void *data __rte_unused) +{ + struct ipsec_test_flags flags; + + memset(&flags, 0, sizeof(flags)); + + flags.stats_success = true; + + return test_ipsec_proto_all(&flags); +} + +static int test_PDCP_PROTO_all(void) { struct crypto_testsuite_params *ts_params = &testsuite_params; @@ -14656,6 +14673,10 @@ static struct unit_test_suite ipsec_proto_testsuite = { "Transport IPv4", ut_setup_security, ut_teardown, test_ipsec_proto_transport_v4), + TEST_CASE_NAMED_ST( + "Statistics: success", + ut_setup_security, ut_teardown, + test_ipsec_proto_stats), TEST_CASES_END() /**< NULL terminate unit test array */ } }; diff --git a/app/test/test_cryptodev_security_ipsec.c b/app/test/test_cryptodev_security_ipsec.c index 029fdd3..6fa1d3d 100644 --- a/app/test/test_cryptodev_security_ipsec.c +++ b/app/test/test_cryptodev_security_ipsec.c @@ -415,6 +415,8 @@ test_ipsec_td_prepare(const struct crypto_param *param1, RTE_SECURITY_IPSEC_TUNNEL_IPV4; } + if (flags->stats_success) + td->ipsec_xform.options.stats = 1; } } @@ -871,3 +873,30 @@ test_ipsec_status_check(struct rte_crypto_op *op, return ret; } + +int +test_ipsec_stats_verify(struct rte_security_ctx *ctx, + struct rte_security_session *sess, + const struct ipsec_test_flags *flags, + enum rte_security_ipsec_sa_direction dir) +{ + struct rte_security_stats stats = {0}; + int ret = TEST_SUCCESS; + + if (flags->stats_success) { + if (rte_security_session_stats_get(ctx, sess, &stats) < 0) + return TEST_FAILED; + + if (dir == RTE_SECURITY_IPSEC_SA_DIR_EGRESS) { + if (stats.ipsec.opackets != 1 || + stats.ipsec.oerrors != 0) + ret = TEST_FAILED; + } else { + if (stats.ipsec.ipackets != 1 || + stats.ipsec.ierrors != 0) + ret = TEST_FAILED; + } + } + + return ret; +} diff --git a/app/test/test_cryptodev_security_ipsec.h b/app/test/test_cryptodev_security_ipsec.h index 07d2453..3565a8c 100644 --- a/app/test/test_cryptodev_security_ipsec.h +++ b/app/test/test_cryptodev_security_ipsec.h @@ -65,6 +65,7 @@ struct ipsec_test_flags { bool tunnel_ipv6; bool transport; bool fragment; + bool stats_success; }; struct crypto_param { @@ -188,4 +189,9 @@ int test_ipsec_status_check(struct rte_crypto_op *op, enum rte_security_ipsec_sa_direction dir, int pkt_num); +int test_ipsec_stats_verify(struct rte_security_ctx *ctx, + struct rte_security_session *sess, + const struct ipsec_test_flags *flags, + enum rte_security_ipsec_sa_direction dir); + #endif -- 2.7.4