DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chengwen Feng <fengchengwen@huawei.com>
To: <thomas@monjalon.net>
Cc: <dev@dpdk.org>, <bruce.richardson@intel.com>, <kevin.laatz@intel.com>
Subject: [PATCH 2/2] test/dma: support auto adapt ringsize
Date: Wed, 27 Aug 2025 09:28:29 +0800	[thread overview]
Message-ID: <20250827012829.40752-3-fengchengwen@huawei.com> (raw)
In-Reply-To: <20250827012829.40752-1-fengchengwen@huawei.com>

The default ringsize is 512, some DMA devices may not support, this
commit support auto adapt ringsize.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
 app/test/test_dmadev.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
index 482d564f7a..e1a919cd81 100644
--- a/app/test/test_dmadev.c
+++ b/app/test/test_dmadev.c
@@ -1135,7 +1135,7 @@ test_dmadev_setup(void)
 	int16_t dev_id = test_dev_id;
 	struct rte_dma_stats stats;
 	const struct rte_dma_conf conf = { .nb_vchans = 1};
-	const struct rte_dma_vchan_conf qconf = {
+	struct rte_dma_vchan_conf qconf = {
 			.direction = RTE_DMA_DIR_MEM_TO_MEM,
 			.nb_desc = TEST_RINGSIZE,
 	};
@@ -1151,6 +1151,10 @@ test_dmadev_setup(void)
 	if (rte_dma_configure(dev_id, &conf) != 0)
 		ERR_RETURN("Error with rte_dma_configure()\n");
 
+	if (qconf.nb_desc < info.min_desc)
+		qconf.nb_desc = info.min_desc;
+	if (qconf.nb_desc > info.max_desc)
+		qconf.nb_desc = info.max_desc;
 	if (rte_dma_vchan_setup(dev_id, vchan, &qconf) < 0)
 		ERR_RETURN("Error with queue configuration\n");
 
-- 
2.17.1


  parent reply	other threads:[~2025-08-27  1:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27  1:28 [PATCH 0/2] bugfix and enhance for DMA test Chengwen Feng
2025-08-27  1:28 ` [PATCH 1/2] test/dma: fix some testcase never fail Chengwen Feng
2025-08-27  1:28 ` Chengwen Feng [this message]
2025-08-27  7:36   ` [PATCH 2/2] test/dma: support auto adapt ringsize Bruce Richardson

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=20250827012829.40752-3-fengchengwen@huawei.com \
    --to=fengchengwen@huawei.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=kevin.laatz@intel.com \
    --cc=thomas@monjalon.net \
    /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).