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 9D7B443347; Thu, 16 Nov 2023 18:46:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 09B98406BA; Thu, 16 Nov 2023 18:45:53 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id A1F9E4068E for ; Thu, 16 Nov 2023 18:45:48 +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 3AGFZ8Ad027217; Thu, 16 Nov 2023 09:45:47 -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=T+FL4MqI4bCO9CrdHpxrvey5r6aar3UqVva9jJcZf0c=; b=ALXn56ij6D1LbjjXk+PpihZL/deYfVao2RB2KZBLonxbDfRUHrSX9Pr3/mpy8wdA80gW hCKOXDYcNZLNNz5liu6PhpGakiBxa80X5NXi4fgdV6b6HwBoTA0NnV36H5YVZNsIYBrW hmMNQ1hiOO863fxfe4lOAfOz8fx9dnqfUK4YwOyV/+HrSEMnm2BdKuahyGIzKKpRwNNG QBFiaOpygHjWss0t3ZSSy2yFO3xSdbu+xca+/sN5OZH0T1TF08e8/x1IAkOHNmiAUphF huDoB6iFkwGyWuYeEOH+iUxK6Rj1nkP6pczdZLcIgo8Q8FEYPqnCIeVCvgNX6uHeSfrO Lw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3udgkahq26-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 16 Nov 2023 09:45:47 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 16 Nov 2023 09:45:40 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 16 Nov 2023 09:45:40 -0800 Received: from BG-LT91401.marvell.com (BG-LT91401.marvell.com [10.28.168.34]) by maili.marvell.com (Postfix) with ESMTP id A00AB3F7085; Thu, 16 Nov 2023 09:45:37 -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 v8 2/3] test/dma: test multiple vchan Date: Thu, 16 Nov 2023 23:15:26 +0530 Message-ID: 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-ORIG-GUID: erFT-a1ayMnqrUzJ1xfyvjZ_alNwKEkU X-Proofpoint-GUID: erFT-a1ayMnqrUzJ1xfyvjZ_alNwKEkU 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-16_19,2023-11-16_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 Acked-by: Chengwen Feng --- 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