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 4EABB432D3; Mon, 13 Nov 2023 13:54:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE6724067C; Mon, 13 Nov 2023 13:54:08 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id F052E40693 for ; Mon, 13 Nov 2023 13:54:06 +0100 (CET) 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 3AD9Z44i010634; Mon, 13 Nov 2023 04:54:06 -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=geaRWK8GMShjFLx3xbpxcov3Z1vX18LZJL78P2Pzx8A=; b=XIg4g+fbEJFR1nBroRmQ52PyECOKhofA3/iI6wuypf6uMQuGJ8vpt7DMSFe3NPEdVFvr wn/I0SXsgBrsnXRTfaw99AL79irrb//j5Txz5dII4kbRGtdBT0lXGJH0lw5HltrLl1fA KNvgs0QWVplKBcw2NWJhDRVLW0yltRofqSMRc6d21eYXc5yoY1KhwndTdgdVMI1BfowH 2L3/ZbC01uh7uJMYFFz2AUjXuYtYoElAZFu0YXBRAA+wfsJ0KUDrJ2G38t8QHJmBjFsB 3REowuHiGBWmdvG7+z7N+O8CC9I4zCwwUM920MF/BES+Y8Iio2vPytcp0lnl0rAo2+Aq MA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3ua7uun338-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 13 Nov 2023 04:54:06 -0800 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; Mon, 13 Nov 2023 04:54:04 -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.48 via Frontend Transport; Mon, 13 Nov 2023 04:54:04 -0800 Received: from BG-LT91401.marvell.com (BG-LT91401.marvell.com [10.28.168.34]) by maili.marvell.com (Postfix) with ESMTP id C004D5B693E; Mon, 13 Nov 2023 04:54:00 -0800 (PST) From: Gowrishankar Muthukrishnan To: CC: , Chengwen Feng , "Vamsi Attunuru" , Amit Prakash Shukla , Vidya Sagar Velumuri , Kevin Laatz , Bruce Richardson , Gowrishankar Muthukrishnan Subject: [PATCH v4 2/3] test/dma: test multiple vchan Date: Mon, 13 Nov 2023 18:23:48 +0530 Message-ID: <577c677a1177efeb6ae0ddb8e36c027bb86c60c1.1699879558.git.gmuthukrishn@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: Qjgmz75zSbZCtZfc9nmOT8_lar8t1V2_ X-Proofpoint-ORIG-GUID: Qjgmz75zSbZCtZfc9nmOT8_lar8t1V2_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-13_03,2023-11-09_01,2023-05-22_02 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 Support API with multiple vchan test. Signed-off-by: Gowrishankar Muthukrishnan --- app/test/test_dmadev_api.c | 63 +++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 8 deletions(-) diff --git a/app/test/test_dmadev_api.c b/app/test/test_dmadev_api.c index 73d4db825a..2b8a4eda62 100644 --- a/app/test/test_dmadev_api.c +++ b/app/test/test_dmadev_api.c @@ -260,7 +260,7 @@ test_dma_vchan_setup(void) } static int -setup_one_vchan(void) +setup_vchan(int nb_vchans) { struct rte_dma_vchan_conf vchan_conf = { 0 }; struct rte_dma_info dev_info = { 0 }; @@ -269,13 +269,15 @@ setup_one_vchan(void) ret = rte_dma_info_get(test_dev_id, &dev_info); RTE_TEST_ASSERT_SUCCESS(ret, "Failed to obtain device info, %d", ret); - dev_conf.nb_vchans = 1; + dev_conf.nb_vchans = nb_vchans; ret = rte_dma_configure(test_dev_id, &dev_conf); RTE_TEST_ASSERT_SUCCESS(ret, "Failed to configure, %d", ret); vchan_conf.direction = RTE_DMA_DIR_MEM_TO_MEM; vchan_conf.nb_desc = dev_info.min_desc; - ret = rte_dma_vchan_setup(test_dev_id, 0, &vchan_conf); - RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup vchan, %d", ret); + for (int i = 0; i < nb_vchans; i++) { + ret = rte_dma_vchan_setup(test_dev_id, i, &vchan_conf); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup vchan %d, %d", i, ret); + } return TEST_SUCCESS; } @@ -294,7 +296,7 @@ test_dma_start_stop(void) RTE_TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret); /* Setup one vchan for later test */ - ret = setup_one_vchan(); + ret = setup_vchan(1); RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup one vchan, %d", ret); ret = rte_dma_start(test_dev_id); @@ -312,6 +314,50 @@ test_dma_start_stop(void) return TEST_SUCCESS; } +static int +test_dma_reconfigure(void) +{ + struct rte_dma_conf dev_conf = { 0 }; + struct rte_dma_info dev_info = { 0 }; + uint16_t cfg_vchans; + int ret; + + ret = rte_dma_info_get(test_dev_id, &dev_info); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to obtain device info, %d", ret); + + /* At least two vchans required for the test */ + if (dev_info.max_vchans < 2) + return TEST_SKIPPED; + + /* Setup one vchan for later test */ + ret = setup_vchan(1); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup one vchan, %d", ret); + + ret = rte_dma_start(test_dev_id); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to start, %d", ret); + + ret = rte_dma_stop(test_dev_id); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to stop, %d", ret); + + /* Check reconfigure and vchan setup after device stopped */ + cfg_vchans = dev_conf.nb_vchans = (dev_info.max_vchans - 1); + + ret = setup_vchan(cfg_vchans); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup one vchan, %d", ret); + + ret = rte_dma_start(test_dev_id); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to start, %d", ret); + + ret = rte_dma_info_get(test_dev_id, &dev_info); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to obtain device info, %d", ret); + RTE_TEST_ASSERT_EQUAL(dev_info.nb_vchans, cfg_vchans, "incorrect reconfiguration"); + + ret = rte_dma_stop(test_dev_id); + RTE_TEST_ASSERT_SUCCESS(ret, "Failed to stop, %d", ret); + + return TEST_SUCCESS; +} + static int test_dma_stats(void) { @@ -328,7 +374,7 @@ test_dma_stats(void) RTE_TEST_ASSERT(ret == -EINVAL, "Expected -EINVAL, %d", ret); /* Setup one vchan for later test */ - ret = setup_one_vchan(); + ret = setup_vchan(1); RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup one vchan, %d", ret); /* Check for invalid vchan */ @@ -400,7 +446,7 @@ test_dma_completed(void) int ret; /* Setup one vchan for later test */ - ret = setup_one_vchan(); + ret = setup_vchan(1); RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup one vchan, %d", ret); ret = rte_dma_start(test_dev_id); @@ -459,7 +505,7 @@ test_dma_completed_status(void) int ret; /* Setup one vchan for later test */ - ret = setup_one_vchan(); + ret = setup_vchan(1); RTE_TEST_ASSERT_SUCCESS(ret, "Failed to setup one vchan, %d", ret); ret = rte_dma_start(test_dev_id); @@ -517,6 +563,7 @@ static struct unit_test_suite dma_api_testsuite = { TEST_CASE(test_dma_configure), TEST_CASE(test_dma_vchan_setup), TEST_CASE(test_dma_start_stop), + TEST_CASE(test_dma_reconfigure), TEST_CASE(test_dma_stats), TEST_CASE(test_dma_dump), TEST_CASE(test_dma_completed), -- 2.25.1