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 353D343026; Thu, 10 Aug 2023 14:36:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4D74543254; Thu, 10 Aug 2023 14:36:49 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 0583F43258 for ; Thu, 10 Aug 2023 14:36:47 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37A8YNXN021056; Thu, 10 Aug 2023 05:36:47 -0700 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=aYc3ukxnUfzPb9xCKXIKSUb5JPUSBesyXW+zdQLOGiY=; b=kwMVR9mR5R16nS6WQtYDXjQI0kZ7Cnh8pkJyrcAX98/ac13bt1TLNfQ4G59yNzSa9k4H JdWQfENEK1Gutfwv3nFow/kUYez+97jG2zj/QGMXU805RdgdPd+kZ9GrPvOTzHuWT6JD 7zIoYz5tUjDehgiRifio7o7SCv23api8jXDj15VU+TKMl/YoIrnThGP3zaREeJWVvDEp ioW1Ye/j7Gr+jWJXbCcQkGyRl6wv6T/kSZeJC0KWxctTo2iGtnyvSgZKwqq8JeTkTdE7 +pPtxrBe9xBogK5sGoJ927+aaBs8ERgTnXiI3nXK8vDp1j0rGh9rWFyjhz8Op19YAklt UA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3scj5man46-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 10 Aug 2023 05:36:47 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 10 Aug 2023 05:36:45 -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; Thu, 10 Aug 2023 05:36:45 -0700 Received: from BG-LT91401.marvell.com (BG-LT91401.marvell.com [10.28.168.34]) by maili.marvell.com (Postfix) with ESMTP id 2C0653F70AB; Thu, 10 Aug 2023 05:36:42 -0700 (PDT) From: Gowrishankar Muthukrishnan To: CC: , Chengwen Feng , "Vamsi Attunuru" , Vidya Sagar Velumuri , Gowrishankar Muthukrishnan Subject: [PATCH v2 2/3] test/dma: test vchan reconfiguration Date: Thu, 10 Aug 2023 18:06:32 +0530 Message-ID: <20230810123633.2455-3-gmuthukrishn@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20230810123633.2455-1-gmuthukrishn@marvell.com> References: <20230810115933.2164-1-gmuthukrishn@marvell.com> <20230810123633.2455-1-gmuthukrishn@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: 1YuzNLvL7vF2zq-ZbyUAzZ1HP0TU_uGL X-Proofpoint-GUID: 1YuzNLvL7vF2zq-ZbyUAzZ1HP0TU_uGL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-08-10_10,2023-08-10_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 Reconfigure vchan count and validate if new count is effective. Signed-off-by: Gowrishankar Muthukrishnan --- app/test/test_dmadev_api.c | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/app/test/test_dmadev_api.c b/app/test/test_dmadev_api.c index a1646472b0..5cdd87e162 100644 --- a/app/test/test_dmadev_api.c +++ b/app/test/test_dmadev_api.c @@ -355,6 +355,56 @@ test_dma_start_stop(void) return TEST_SUCCESS; } +static int +test_dma_reconfigure(void) +{ + struct rte_dma_vchan_conf vchan_conf = { 0 }; + 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_one_vchan(); + 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 = 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); + + 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) { @@ -567,6 +617,7 @@ test_dma_api(uint16_t dev_id) DMA_TEST_API_RUN(test_dma_configure); DMA_TEST_API_RUN(test_dma_vchan_setup); DMA_TEST_API_RUN(test_dma_start_stop); + DMA_TEST_API_RUN(test_dma_reconfigure); DMA_TEST_API_RUN(test_dma_stats); DMA_TEST_API_RUN(test_dma_dump); DMA_TEST_API_RUN(test_dma_completed); -- 2.25.1