DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
To: <dev@dpdk.org>
Cc: <anoobj@marvell.com>, Chengwen Feng <fengchengwen@huawei.com>,
	"Vamsi Attunuru" <vattunuru@marvell.com>,
	Amit Prakash Shukla <amitprakashs@marvell.com>,
	Vidya Sagar Velumuri <vvelumuri@marvell.com>,
	Kevin Laatz <kevin.laatz@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Subject: [PATCH v8 2/3] test/dma: test multiple vchan
Date: Thu, 16 Nov 2023 23:15:26 +0530	[thread overview]
Message-ID: <d7313bcdffb3d117512eef5cfacbaca1874b7182.1700156485.git.gmuthukrishn@marvell.com> (raw)
In-Reply-To: <cover.1700156485.git.gmuthukrishn@marvell.com>

Support API with multiple vchan test.

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 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


  parent reply	other threads:[~2023-11-16 17:46 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10 11:59 [PATCH] test/dma: add test skip status Gowrishankar Muthukrishnan
2023-08-10 12:36 ` [PATCH v2 0/3] test/dma: add vchan reconfig and SG tests Gowrishankar Muthukrishnan
2023-08-10 12:36   ` [PATCH v2 1/3] test/dma: add test skip status Gowrishankar Muthukrishnan
2023-08-10 12:36   ` [PATCH v2 2/3] test/dma: test vchan reconfiguration Gowrishankar Muthukrishnan
2023-08-10 12:36   ` [PATCH v2 3/3] test/dma: add SG copy tests Gowrishankar Muthukrishnan
2023-11-03 15:38   ` [PATCH v3 0/3] test/dma: add vchan reconfig and SG tests Gowrishankar Muthukrishnan
2023-11-03 15:38     ` [PATCH v3 1/3] test/dma: use unit test framework Gowrishankar Muthukrishnan
2023-11-06  3:47       ` fengchengwen
2023-11-13  9:28         ` [EXT] " Gowrishankar Muthukrishnan
2023-11-03 15:38     ` [PATCH v3 2/3] test/dma: test vchan reconfiguration Gowrishankar Muthukrishnan
2023-11-06  4:06       ` fengchengwen
2023-11-03 15:38     ` [PATCH v3 3/3] test/dma: add SG copy tests Gowrishankar Muthukrishnan
2023-11-06  6:43       ` fengchengwen
2023-11-13  9:27         ` [EXT] " Gowrishankar Muthukrishnan
2023-11-13 12:53     ` [PATCH v4 0/3] test/dma: add vchan reconfig and SG tests Gowrishankar Muthukrishnan
2023-11-13 12:53       ` [PATCH v4 1/3] test/dma: use unit test framework Gowrishankar Muthukrishnan
2023-11-13 12:53       ` [PATCH v4 2/3] test/dma: test multiple vchan Gowrishankar Muthukrishnan
2023-11-13 12:53       ` [PATCH v4 3/3] test/dma: add SG copy tests Gowrishankar Muthukrishnan
2023-11-16  7:16       ` [PATCH v4 0/3] test/dma: add vchan reconfig and SG tests fengchengwen
2023-11-16 10:40       ` [PATCH v5 " Gowrishankar Muthukrishnan
2023-11-16 10:40         ` [PATCH v5 1/3] test/dma: use unit test framework Gowrishankar Muthukrishnan
2023-11-16 10:40         ` [PATCH v5 2/3] test/dma: test multiple vchan Gowrishankar Muthukrishnan
2023-11-16 10:40         ` [PATCH v5 3/3] test/dma: add SG copy tests Gowrishankar Muthukrishnan
2023-11-16 10:59         ` [PATCH v6 0/3] test/dma: add vchan reconfig and SG tests Gowrishankar Muthukrishnan
2023-11-16 10:59           ` [PATCH v6 1/3] test/dma: use unit test framework Gowrishankar Muthukrishnan
2023-11-16 10:59           ` [PATCH v6 2/3] test/dma: test multiple vchan Gowrishankar Muthukrishnan
2023-11-16 10:59           ` [PATCH v6 3/3] test/dma: add SG copy tests Gowrishankar Muthukrishnan
2023-11-16 13:27           ` [PATCH v7 0/3] test/dma: add vchan reconfig and SG tests Gowrishankar Muthukrishnan
2023-11-16 13:27             ` [PATCH v7 1/3] test/dma: use unit test framework Gowrishankar Muthukrishnan
2023-11-16 13:27             ` [PATCH v7 2/3] test/dma: test multiple vchan Gowrishankar Muthukrishnan
2023-11-16 13:27             ` [PATCH v7 3/3] test/dma: add SG copy tests Gowrishankar Muthukrishnan
2023-11-16 17:45             ` [PATCH v8 0/3] test/dma: add vchan reconfig and SG tests Gowrishankar Muthukrishnan
2023-11-16 17:45               ` [PATCH v8 1/3] test/dma: use unit test framework Gowrishankar Muthukrishnan
2023-11-16 17:45               ` Gowrishankar Muthukrishnan [this message]
2023-11-16 17:45               ` [PATCH v8 3/3] test/dma: add SG copy tests Gowrishankar Muthukrishnan
2023-12-07 10:10               ` [PATCH v8 0/3] test/dma: add vchan reconfig and SG tests Gowrishankar Muthukrishnan
2024-02-05 10:34                 ` Gowrishankar Muthukrishnan
2024-03-06 19:45               ` Thomas Monjalon
2023-10-08  1:51 ` [PATCH] test/dma: add test skip status fengchengwen

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=d7313bcdffb3d117512eef5cfacbaca1874b7182.1700156485.git.gmuthukrishn@marvell.com \
    --to=gmuthukrishn@marvell.com \
    --cc=amitprakashs@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=kevin.laatz@intel.com \
    --cc=vattunuru@marvell.com \
    --cc=vvelumuri@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).