From: fengchengwen <fengchengwen@huawei.com>
To: Tejasree Kondoj <ktejasree@marvell.com>,
Akhil Goyal <gakhil@marvell.com>,
Kevin Laatz <kevin.laatz@intel.com>,
Bruce Richardson <bruce.richardson@intel.com>
Cc: Vidya Sagar Velumuri <vvelumuri@marvell.com>,
Anoob Joseph <anoobj@marvell.com>, <dev@dpdk.org>
Subject: Re: [PATCH v2 1/2] test/dma: update the sg test to verify wrap around case
Date: Wed, 24 Jun 2026 08:29:07 +0800 [thread overview]
Message-ID: <ad18b9c7-9eb8-4caf-9e1d-eef19c85e8be@huawei.com> (raw)
In-Reply-To: <20260622135208.87697-2-ktejasree@marvell.com>
On 6/22/2026 9:52 PM, Tejasree Kondoj wrote:
> Run the sg test in a loop to verify wrap around case.
> Total number commands submitted to be more than the number descriptors
> allocated to verify the scenario.
>
> Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
> Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
> ---
> app/test/test_dmadev.c | 45 ++++++++++++++++++++++++--------------
> app/test/test_dmadev_api.c | 1 -
> app/test/test_dmadev_api.h | 2 ++
> 3 files changed, 31 insertions(+), 17 deletions(-)
>
> diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
> index 5488a1af33..b30f2214e5 100644
> --- a/app/test/test_dmadev.c
> +++ b/app/test/test_dmadev.c
> @@ -393,36 +393,28 @@ test_stop_start(int16_t dev_id, uint16_t vchan)
> }
>
> static int
> -test_enqueue_sg_copies(int16_t dev_id, uint16_t vchan)
> +test_enqueue_sg(int16_t dev_id, uint16_t vchan, unsigned int n_sge, unsigned int test_len)
> {
> - unsigned int src_len, dst_len, n_sge, len, i, j, k;
> char orig_src[COPY_LEN], orig_dst[COPY_LEN];
> - struct rte_dma_info info = { 0 };
> + unsigned int src_len, dst_len, i, j, k;
> enum rte_dma_status_code status;
> uint16_t id, n_src, n_dst;
>
> - if (rte_dma_info_get(dev_id, &info) < 0)
> - ERR_RETURN("Failed to get dev info");
> -
> - if (info.max_sges < 2)
> - ERR_RETURN("Test needs minimum 2 SG pointers");
> -
> - n_sge = info.max_sges;
> -
> for (n_src = 1; n_src <= n_sge; n_src++) {
> for (n_dst = 1; n_dst <= n_sge; n_dst++) {
> /* Normalize SG buffer lengths */
> - len = COPY_LEN;
> - len -= (len % (n_src * n_dst));
> - dst_len = len / n_dst;
> - src_len = len / n_src;
> -
> struct rte_dma_sge *sg_src = alloca(sizeof(struct rte_dma_sge) * n_sge);
> struct rte_dma_sge *sg_dst = alloca(sizeof(struct rte_dma_sge) * n_sge);
> struct rte_mbuf **src = alloca(sizeof(struct rte_mbuf *) * n_sge);
> struct rte_mbuf **dst = alloca(sizeof(struct rte_mbuf *) * n_sge);
> char **src_data = alloca(sizeof(char *) * n_sge);
> char **dst_data = alloca(sizeof(char *) * n_sge);
> + unsigned int len = test_len - (test_len % (n_src * n_dst));
> +
> + dst_len = len / n_dst;
> + src_len = len / n_src;
> + if (dst_len == 0 || src_len == 0)
> + continue;
>
> for (i = 0 ; i < len; i++)
> orig_src[i] = rte_rand() & 0xFF;
> @@ -514,6 +506,27 @@ test_enqueue_sg_copies(int16_t dev_id, uint16_t vchan)
> return 0;
> }
>
> +static int
> +test_enqueue_sg_copies(int16_t dev_id, uint16_t vchan)
> +{
> + struct rte_dma_info info = { 0 };
> + unsigned int n_sge, len;
> + int loop_count = 0;
> +
> + if (rte_dma_info_get(dev_id, &info) < 0)
> + ERR_RETURN("Failed to get dev info");
> +
> + n_sge = RTE_MIN(info.max_sges, TEST_SG_MAX);
test_enqueue_sg() has protection:
+ if (dst_len == 0 || src_len == 0)
+ continue;
So no need RTE_MIN, just info.max_sges, in this way we will test the device's capability.
> + len = COPY_LEN;
> +
> + do {
> + test_enqueue_sg(dev_id, vchan, n_sge, len);
We need check the retcode of test_enqueue_sg, else this case will return OK even the
copy failed.
> + loop_count++;
> + } while (loop_count * n_sge * n_sge < TEST_RINGSIZE * 3);
> +
> + return 0;
> +}
> +
> static int
> test_single_sva_copy(int16_t dev_id, uint16_t vchan, const char *mem_src,
> char *src, char *dst, uint32_t len)
> diff --git a/app/test/test_dmadev_api.c b/app/test/test_dmadev_api.c
> index 1ba053696b..4bb8f9e820 100644
> --- a/app/test/test_dmadev_api.c
> +++ b/app/test/test_dmadev_api.c
> @@ -16,7 +16,6 @@ extern int test_dma_api(uint16_t dev_id);
>
> #define TEST_MEMCPY_SIZE 1024
> #define TEST_WAIT_US_VAL 50000
> -#define TEST_SG_MAX 64
>
> static int16_t test_dev_id;
> static int16_t invalid_dev_id;
> diff --git a/app/test/test_dmadev_api.h b/app/test/test_dmadev_api.h
> index 33fbc5bd41..a03f7acd4f 100644
> --- a/app/test/test_dmadev_api.h
> +++ b/app/test/test_dmadev_api.h
> @@ -2,4 +2,6 @@
> * Copyright(c) 2021 HiSilicon Limited
> */
>
> +#define TEST_SG_MAX 64
No need public this macro.
> +
> int test_dma_api(uint16_t dev_id);
next prev parent reply other threads:[~2026-06-24 0:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 13:52 [PATCH v2 0/2] improve dmadev tests Tejasree Kondoj
2026-06-22 13:52 ` [PATCH v2 1/2] test/dma: update the sg test to verify wrap around case Tejasree Kondoj
2026-06-24 0:29 ` fengchengwen [this message]
2026-06-22 13:52 ` [PATCH v2 2/2] test/dma: add functions to verify zero and one fill Tejasree Kondoj
2026-06-22 13:58 ` Bruce Richardson
-- strict thread matches above, loose matches on Subject: below --
2024-04-16 12:37 [PATCH v1 1/2] test/dma: update the sg test to verify wrap around case Vidya Sagar Velumuri
2024-04-19 9:07 ` [PATCH v2 " Vidya Sagar Velumuri
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=ad18b9c7-9eb8-4caf-9e1d-eef19c85e8be@huawei.com \
--to=fengchengwen@huawei.com \
--cc=anoobj@marvell.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=kevin.laatz@intel.com \
--cc=ktejasree@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