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 A5A97432B4; Mon, 6 Nov 2023 05:06:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 291C0402B5; Mon, 6 Nov 2023 05:06:13 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 958304027F for ; Mon, 6 Nov 2023 05:06:09 +0100 (CET) Received: from dggpeml100024.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4SNyN675DdzPnw2; Mon, 6 Nov 2023 12:01:58 +0800 (CST) Received: from [10.67.121.161] (10.67.121.161) by dggpeml100024.china.huawei.com (7.185.36.115) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 6 Nov 2023 12:06:06 +0800 Subject: Re: [PATCH v3 2/3] test/dma: test vchan reconfiguration To: Gowrishankar Muthukrishnan , CC: , Vamsi Attunuru , Amit Prakash Shukla , Vidya Sagar Velumuri , Kevin Laatz , Bruce Richardson References: <2c7f6c7b3bec94325c6b96afbd8e9388a1c14a9d.1699025423.git.gmuthukrishn@marvell.com> From: fengchengwen Message-ID: Date: Mon, 6 Nov 2023 12:06:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <2c7f6c7b3bec94325c6b96afbd8e9388a1c14a9d.1699025423.git.gmuthukrishn@marvell.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.121.161] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml100024.china.huawei.com (7.185.36.115) X-CFilter-Loop: Reflected 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 Hi Gowrishankar, On 2023/11/3 23:38, Gowrishankar Muthukrishnan wrote: > Reconfigure vchan count and validate if new count is effective. I think it mainly due to multi-vchan, should point it out, suggest be: support API with multiple vchan test Thanks Chengwen > > 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 da8fddb3ca..aa07d2b359 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), >