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 47146454AB; Thu, 20 Jun 2024 16:51:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3760842E84; Thu, 20 Jun 2024 16:51:55 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id D39F742E7D for ; Thu, 20 Jun 2024 16:51:21 +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 45KCTgvG011177; Thu, 20 Jun 2024 07:51:21 -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=k TK0v0lAP5QBOva2PJdg3mK9kmijptzyhns8hg93jhg=; b=hxOqJdv6TKLZwLUbI YubEyUPEKuGDl7snAuSXRdYSZhSBhprNPSOiVkW+twD84H4WFyjzMWv04WrDl9oy /faquhys1oHFJkb/ZgPCgr2SxHmqBAwk4p19qCPohNmg7+wUYpZQUFACynQi7TWC lOOmHwaWlCdP41gMPF9KveKuaACkF/AXqb1UuHUtv1jyQic7eA1pJzhH9J15mZpJ 27vi4E1o0g11cISoGWk/20XoS3yxpg988swguKWdweoD6a/QmeNhyZvYeccNbauI 7bGwM0oyaYIOflInG+Aey6sIxLxp2gktIdNYIDb3NWZeiHIiH4XN0schWAYu0EgL 4D3xg== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3yvbdyajxx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 20 Jun 2024 07:51:20 -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; Thu, 20 Jun 2024 07:51:20 -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; Thu, 20 Jun 2024 07:51:20 -0700 Received: from localhost.localdomain (unknown [10.28.36.177]) by maili.marvell.com (Postfix) with ESMTP id C1DE23F7043; Thu, 20 Jun 2024 07:51:17 -0700 (PDT) From: Aakash Sasidharan To: Akhil Goyal , Fan Zhang CC: , , , , Subject: [PATCH v2 7/7] test/security: use single session in data walkthrough test Date: Thu, 20 Jun 2024 20:20:56 +0530 Message-ID: <20240620145056.3456650-8-asasidharan@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240620145056.3456650-1-asasidharan@marvell.com> References: <20240617055841.2359729-1-asasidharan@marvell.com> <20240620145056.3456650-1-asasidharan@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: mFAyOnX8yb24TVZMjyjvcBRX28vEvFIz X-Proofpoint-GUID: mFAyOnX8yb24TVZMjyjvcBRX28vEvFIz 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-20_07,2024-06-20_04,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 e6ef5a13e0..75f98b6744 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; @@ -12430,6 +12467,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); @@ -12804,6 +12842,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