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 DBA7D427E7; Wed, 5 Apr 2023 09:41:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 75CA441151; Wed, 5 Apr 2023 09:41:26 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 241A640FDF for ; Wed, 5 Apr 2023 09:41:24 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3357ONH2007265; Wed, 5 Apr 2023 00:41:24 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=COxaYRit2n6zba61JyKZOTaxFfCSBI8C4aHtrtdDd1E=; b=FcYKnoaiYkhx3L4T9le9bNCobNHWc1WDG8dfqzrKpxjOKMiiNGap7XJYOfkaVrQ90vuQ Tg22XMv8WcoiZc+yBB3L9O4XgZSJ2XMDHQhowuSpWwwkQClaF2jOhaKczAECq4BijXy3 3bvx2IJgZHy3iK1G08OhY+6zcFqIcLuUdAXQxXPiB5DbHG+Ybe7/smK5VeTw3mGOUNAf 9XDe4LxL/ftLYYLxDF3SuCsiOjI1bQy5QrgKwlC72SUtq9pKAWo+5NG9wD3drQ3unKTg ALj1gQlDOeOGlQEv/NXQOel1jjRTQMimeoFM1/1Wbv0TMVs6hlC/zr9zIU494T0xuvHB Iw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3ps4jpg2b0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 05 Apr 2023 00:41:24 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 5 Apr 2023 00:41:22 -0700 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.48 via Frontend Transport; Wed, 5 Apr 2023 00:41:22 -0700 Received: from localhost.localdomain (unknown [10.28.36.177]) by maili.marvell.com (Postfix) with ESMTP id 4CE1B3F70AD; Wed, 5 Apr 2023 00:41:18 -0700 (PDT) From: Aakash Sasidharan To: Akhil Goyal , Fan Zhang CC: , , , Subject: [PATCH] test/crypto: add cryptodev reconfig test Date: Wed, 5 Apr 2023 13:11:17 +0530 Message-ID: <20230405074117.2212923-1-asasidharan@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: p4IhmcMiYG1TYOADsdGZU6VEh-PsLtGD X-Proofpoint-ORIG-GUID: p4IhmcMiYG1TYOADsdGZU6VEh-PsLtGD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-05_04,2023-04-04_05,2023-02-09_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 Add cryptodev tests to verify that the device supports reconfiguration any number of times via rte_cryptodev_configure API. Signed-off-by: Aakash Sasidharan --- app/test/test_cryptodev.c | 81 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 9c670e9a35..3376ed91a3 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -12368,6 +12368,85 @@ test_stats(void) return TEST_SUCCESS; } +static int +test_device_reconfigure(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + uint16_t orig_nb_qps = ts_params->conf.nb_queue_pairs; + struct rte_cryptodev_qp_conf qp_conf = { + .nb_descriptors = MAX_NUM_OPS_INFLIGHT, + .mp_session = ts_params->session_mpool + }; + uint16_t qp_id, dev_id, num_devs = 0; + + TEST_ASSERT((num_devs = rte_cryptodev_count()) >= 1, + "Need at least %d devices for test", 1); + + dev_id = ts_params->valid_devs[0]; + + /* Stop the device in case it's started so it can be configured */ + rte_cryptodev_stop(dev_id); + + TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, &ts_params->conf), + "Failed test for rte_cryptodev_configure: " + "dev_num %u", dev_id); + + /* Reconfigure with same configure params */ + TEST_ASSERT_SUCCESS(rte_cryptodev_configure(dev_id, &ts_params->conf), + "Failed test for rte_cryptodev_configure: " + "dev_num %u", dev_id); + + /* Reconfigure with just one queue pair */ + ts_params->conf.nb_queue_pairs = 1; + + TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0], + &ts_params->conf), + "Failed to configure cryptodev: dev_id %u, qp_id %u", + ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs); + + for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) { + TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( + ts_params->valid_devs[0], qp_id, &qp_conf, + rte_cryptodev_socket_id( + ts_params->valid_devs[0])), + "Failed test for " + "rte_cryptodev_queue_pair_setup: num_inflights " + "%u on qp %u on cryptodev %u", + qp_conf.nb_descriptors, qp_id, + ts_params->valid_devs[0]); + } + + /* Reconfigure with max number of queue pairs */ + ts_params->conf.nb_queue_pairs = orig_nb_qps; + + TEST_ASSERT_SUCCESS(rte_cryptodev_configure(ts_params->valid_devs[0], + &ts_params->conf), + "Failed to configure cryptodev: dev_id %u, qp_id %u", + ts_params->valid_devs[0], ts_params->conf.nb_queue_pairs); + + qp_conf.mp_session = ts_params->session_mpool; + + for (qp_id = 0; qp_id < ts_params->conf.nb_queue_pairs; qp_id++) { + TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup( + ts_params->valid_devs[0], qp_id, &qp_conf, + rte_cryptodev_socket_id( + ts_params->valid_devs[0])), + "Failed test for " + "rte_cryptodev_queue_pair_setup: num_inflights " + "%u on qp %u on cryptodev %u", + qp_conf.nb_descriptors, qp_id, + ts_params->valid_devs[0]); + } + + /* Start the device */ + TEST_ASSERT_SUCCESS(rte_cryptodev_start(ts_params->valid_devs[0]), + "Failed to start cryptodev %u", + ts_params->valid_devs[0]); + + /* Test expected values */ + return test_AES_CBC_HMAC_SHA1_encrypt_digest(); +} + static int MD5_HMAC_create_session(struct crypto_testsuite_params *ts_params, struct crypto_unittest_params *ut_params, enum rte_crypto_auth_operation op, @@ -16022,6 +16101,8 @@ static struct unit_test_suite cryptodev_gen_testsuite = { .suite_name = "Crypto General Unit Test Suite", .setup = crypto_gen_testsuite_setup, .unit_test_cases = { + TEST_CASE_ST(ut_setup, ut_teardown, + test_device_reconfigure), TEST_CASE_ST(ut_setup, ut_teardown, test_device_configure_invalid_dev_id), TEST_CASE_ST(ut_setup, ut_teardown, -- 2.25.1