From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
To: <dev@dpdk.org>
Cc: <anoobj@marvell.com>, Chengwen Feng <fengchengwen@huawei.com>,
"Vamsi Attunuru" <vattunuru@marvell.com>,
Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Subject: [PATCH] test/dma: test vchan reconfiguration
Date: Thu, 10 Aug 2023 17:30:25 +0530 [thread overview]
Message-ID: <20230810120025.2212-1-gmuthukrishn@marvell.com> (raw)
Reconfigure vchan count and validate if new count is effective.
Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
---
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
reply other threads:[~2023-08-10 12:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230810120025.2212-1-gmuthukrishn@marvell.com \
--to=gmuthukrishn@marvell.com \
--cc=anoobj@marvell.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=vattunuru@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).