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 B8C904547C; Mon, 17 Jun 2024 08:00:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 512504066C; Mon, 17 Jun 2024 07:59:50 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id BDAED4021E for ; Mon, 17 Jun 2024 07:59:06 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45GMudQI023431; Sun, 16 Jun 2024 22:59:06 -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=A QT/CrxhPXf/R6gWScNtCrlUxWx6O4GQohjAqJeczPQ=; b=Bvf+NHdOgmcBwNZiW UfY1b8YRt4OPzIvYOEjf93yncEwZlxg/iledHOTYMkX0Bp89RU7w8uGVPjNZWnwL 2QOCx5TMy9qrcPIsIZvXpiPfqlRGfc3v7odGeVxIc4qFpvnlnuhd/rgE/PK6PMLu IQyEWs9ATmyjkd3nD1lC7oPS1tXKx/ZAYMevmCl8yqEf5MMXRBqnIqXaY/R4xv0h c4KwsYKx8vVW/uejf66Idn1KYXdixZrR9vqWCmnVAS0+ZsRRNxtM7pt6AcRnMtIU MGNxoKfO/Z1OnYEUqT284nD4cLbGem06OsyDemMbVfBuUly5IAIgJ4C9oBT9WYe6 808VA== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3ys8ajv2rd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 16 Jun 2024 22:59:05 -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; Sun, 16 Jun 2024 22:59:04 -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; Sun, 16 Jun 2024 22:59:04 -0700 Received: from localhost.localdomain (unknown [10.28.36.177]) by maili.marvell.com (Postfix) with ESMTP id 1D46F3F706B; Sun, 16 Jun 2024 22:59:01 -0700 (PDT) From: Aakash Sasidharan To: Akhil Goyal , Fan Zhang CC: , , , , Subject: [PATCH 7/7] test/security: use single session in data walkthrough test Date: Mon, 17 Jun 2024 11:28:41 +0530 Message-ID: <20240617055841.2359729-8-asasidharan@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240617055841.2359729-1-asasidharan@marvell.com> References: <20240617055841.2359729-1-asasidharan@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: VnTku7ObelosXGIj5ZagyaXHA-o3h_Jv X-Proofpoint-ORIG-GUID: VnTku7ObelosXGIj5ZagyaXHA-o3h_Jv 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-17_04,2024-06-14_03,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 Existing data walkthrough test creates a new session per each test packet size. Enhance the test to use single session instead. Signed-off-by: Aakash Sasidharan --- app/test/test_cryptodev.c | 49 +++++++++++++++++-- app/test/test_cryptodev_security_tls_record.h | 1 + 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 0afc13a7b6..068f0b0aa1 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -11968,9 +11968,12 @@ test_tls_record_proto_process(const struct tls_record_test_data td[], } } - /* Create security session */ - ut_params->sec_session = rte_security_session_create(ctx, &sess_conf, - ts_params->session_mpool); + if (ut_params->sec_session == NULL) { + /* Create security session */ + ut_params->sec_session = rte_security_session_create(ctx, &sess_conf, + ts_params->session_mpool); + } + if (ut_params->sec_session == NULL) return TEST_SKIPPED; @@ -12075,9 +12078,10 @@ test_tls_record_proto_process(const struct tls_record_test_data td[], rte_pktmbuf_free(ut_params->ibuf); ut_params->ibuf = NULL; - if (ut_params->sec_session) + if (ut_params->sec_session != NULL && !flags->skip_sess_destroy) { rte_security_session_destroy(ctx, ut_params->sec_session); - ut_params->sec_session = NULL; + ut_params->sec_session = NULL; + } RTE_SET_USED(flags); @@ -12121,8 +12125,11 @@ static int test_tls_record_proto_all(const struct tls_record_test_flags *flags) { unsigned int i, nb_pkts = 1, pass_cnt = 0, payload_len, max_payload_len; + struct crypto_unittest_params *ut_params = &unittest_params; struct tls_record_test_data td_outb[TEST_SEC_PKTS_MAX]; struct tls_record_test_data td_inb[TEST_SEC_PKTS_MAX]; + void *sec_session_outb = NULL; + void *sec_session_inb = NULL; int ret; switch (flags->tls_version) { @@ -12152,10 +12159,16 @@ test_tls_record_proto_all(const struct tls_record_test_flags *flags) if (ret == TEST_SKIPPED) continue; + if (flags->skip_sess_destroy) + ut_params->sec_session = sec_session_outb; + ret = test_tls_record_proto_process(td_outb, td_inb, nb_pkts, true, flags); if (ret == TEST_SKIPPED) continue; + if (flags->skip_sess_destroy && sec_session_outb == NULL) + sec_session_outb = ut_params->sec_session; + if (flags->zero_len && ((flags->content_type == TLS_RECORD_TEST_CONTENT_TYPE_HANDSHAKE) || (flags->content_type == TLS_RECORD_TEST_CONTENT_TYPE_HANDSHAKE) || @@ -12169,10 +12182,16 @@ test_tls_record_proto_all(const struct tls_record_test_flags *flags) test_tls_record_td_update(td_inb, td_outb, nb_pkts, flags); + if (flags->skip_sess_destroy) + ut_params->sec_session = sec_session_inb; + ret = test_tls_record_proto_process(td_inb, NULL, nb_pkts, true, flags); if (ret == TEST_SKIPPED) continue; + if (flags->skip_sess_destroy && sec_session_inb == NULL) + sec_session_inb = ut_params->sec_session; + if (flags->pkt_corruption || flags->padding_corruption) { if (ret == TEST_SUCCESS) return TEST_FAILED; @@ -12188,6 +12207,22 @@ test_tls_record_proto_all(const struct tls_record_test_flags *flags) if (flags->display_alg) test_sec_alg_display(sec_alg_list[i].param1, sec_alg_list[i].param2); + if (flags->skip_sess_destroy) { + uint8_t dev_id = testsuite_params.valid_devs[0]; + struct rte_security_ctx *ctx; + + ctx = rte_cryptodev_get_sec_ctx(dev_id); + if (sec_session_inb != NULL) { + rte_security_session_destroy(ctx, sec_session_inb); + sec_session_inb = NULL; + } + if (sec_session_outb != NULL) { + rte_security_session_destroy(ctx, sec_session_outb); + sec_session_outb = NULL; + } + ut_params->sec_session = NULL; + } + pass_cnt++; } @@ -12205,6 +12240,7 @@ test_tls_1_2_record_proto_data_walkthrough(void) memset(&flags, 0, sizeof(flags)); flags.data_walkthrough = true; + flags.skip_sess_destroy = true; flags.tls_version = RTE_SECURITY_VERSION_TLS_1_2; return test_tls_record_proto_all(&flags); @@ -12254,6 +12290,7 @@ test_tls_record_proto_sgl_data_walkthrough(enum rte_security_tls_version tls_ver struct tls_record_test_flags flags = { .nb_segs_in_mbuf = 5, .tls_version = tls_version, + .skip_sess_destroy = true, .data_walkthrough = true }; struct crypto_testsuite_params *ts_params = &testsuite_params; @@ -12434,6 +12471,7 @@ test_dtls_1_2_record_proto_data_walkthrough(void) memset(&flags, 0, sizeof(flags)); flags.data_walkthrough = true; + flags.skip_sess_destroy = true; flags.tls_version = RTE_SECURITY_VERSION_DTLS_1_2; return test_tls_record_proto_all(&flags); @@ -12812,6 +12850,7 @@ test_tls_1_3_record_proto_data_walkthrough(void) memset(&flags, 0, sizeof(flags)); flags.data_walkthrough = true; + flags.skip_sess_destroy = true; flags.tls_version = RTE_SECURITY_VERSION_TLS_1_3; return test_tls_record_proto_all(&flags); diff --git a/app/test/test_cryptodev_security_tls_record.h b/app/test/test_cryptodev_security_tls_record.h index acb7f15f1c..e4a291c153 100644 --- a/app/test/test_cryptodev_security_tls_record.h +++ b/app/test/test_cryptodev_security_tls_record.h @@ -100,6 +100,7 @@ struct tls_record_test_flags { bool zero_len; bool padding_corruption; bool out_of_place; + bool skip_sess_destroy; uint8_t nb_segs_in_mbuf; uint8_t opt_padding; enum rte_security_tls_version tls_version; -- 2.25.1