From: fengchengwen <fengchengwen@huawei.com>
To: Vidya Sagar Velumuri <vvelumuri@marvell.com>,
Kevin Laatz <kevin.laatz@intel.com>,
Bruce Richardson <bruce.richardson@intel.com>
Cc: <gakhil@marvell.com>, <jerinj@marvell.com>, <anoobj@marvell.com>,
<asasidharan@marvell.com>, <dev@dpdk.org>,
Amit Prakash Shukla <amitprakashs@marvell.com>
Subject: Re: [PATCH v4 2/2] test/dma: add functions to verify zero and one fill
Date: Tue, 10 Jun 2025 14:48:53 +0800 [thread overview]
Message-ID: <3051d7ed-ccc8-45c3-8e2e-d76efa1146c5@huawei.com> (raw)
In-Reply-To: <20250609030314.4098409-2-vvelumuri@marvell.com>
Hi Vidya,
How about add a wrap function and keep this function (could modify it's name).
static int
test_enqueue_fill() {
uint64_t pattern[3] = {0x0, 0xfedcba9876543210, 0xffffffffffffffff};
int i;
for (i = 0; i < RTE_DIM(pattern); i++) {
ret = test_enqueue_fill_patter(dev_id, vchan, pattern[i]);
if (ret)
return ret;
}
return 0;
}
On 2025/6/9 11:03, Vidya Sagar Velumuri wrote:
> Add test cases to verify zero fill and one fill
>
> Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
> Acked-by: Amit Prakash Shukla <amitprakashs@marvell.com>
>
> diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
> index 88c3d02fd6..0c67aaceb2 100644
> --- a/app/test/test_dmadev.c
> +++ b/app/test/test_dmadev.c
> @@ -872,42 +872,51 @@ test_completion_handling(int16_t dev_id, uint16_t vchan)
> static int
> test_enqueue_fill(int16_t dev_id, uint16_t vchan)
> {
> + uint64_t pattern[3] = {0x0, 0xfedcba9876543210, 0xffffffffffffffff};
> const unsigned int lengths[] = {8, 64, 1024, 50, 100, 89};
> + unsigned int i, j, k;
> struct rte_mbuf *dst;
> char *dst_data;
> - uint64_t pattern = 0xfedcba9876543210;
> - unsigned int i, j;
>
> dst = rte_pktmbuf_alloc(pool);
> if (dst == NULL)
> ERR_RETURN("Failed to allocate mbuf\n");
> dst_data = rte_pktmbuf_mtod(dst, char *);
>
> - for (i = 0; i < RTE_DIM(lengths); i++) {
> - /* reset dst_data */
> - memset(dst_data, 0, rte_pktmbuf_data_len(dst));
> + for (k = 0; k < RTE_DIM(pattern); k++) {
> + for (i = 0; i < RTE_DIM(lengths); i++) {
> + /* reset dst_data */
> + memset(dst_data, 0, rte_pktmbuf_data_len(dst));
> +
> + /* perform the fill operation */
> + int id = rte_dma_fill(dev_id, vchan, pattern[k],
> + rte_pktmbuf_iova(dst), lengths[i], RTE_DMA_OP_FLAG_SUBMIT);
> + if (id < 0) {
> + if (id == -ENOTSUP) {
> + rte_pktmbuf_free(dst);
> + break;
> + }
> + ERR_RETURN("Error with rte_dma_fill\n");
> + }
> + await_hw(dev_id, vchan);
>
> - /* perform the fill operation */
> - int id = rte_dma_fill(dev_id, vchan, pattern,
> - rte_pktmbuf_iova(dst), lengths[i], RTE_DMA_OP_FLAG_SUBMIT);
> - if (id < 0)
> - ERR_RETURN("Error with rte_dma_fill\n");
> - await_hw(dev_id, vchan);
> + if (rte_dma_completed(dev_id, vchan, 1, NULL, NULL) != 1)
> + ERR_RETURN("Error: fill operation failed (length: %u)\n",
> + lengths[i]);
> + /* check the data from the fill operation is correct */
> + for (j = 0; j < lengths[i]; j++) {
> + char pat_byte = ((char *)&pattern[k])[j % 8];
>
> - if (rte_dma_completed(dev_id, vchan, 1, NULL, NULL) != 1)
> - ERR_RETURN("Error: fill operation failed (length: %u)\n", lengths[i]);
> - /* check the data from the fill operation is correct */
> - for (j = 0; j < lengths[i]; j++) {
> - char pat_byte = ((char *)&pattern)[j % 8];
> - if (dst_data[j] != pat_byte)
> - ERR_RETURN("Error with fill operation (lengths = %u): got (%x), not (%x)\n",
> - lengths[i], dst_data[j], pat_byte);
> + if (dst_data[j] != pat_byte)
> + ERR_RETURN("Error with fill operation (lengths = %u): got (%x), not (%x)\n",
> + lengths[i], dst_data[j], pat_byte);
> + }
> + /* check that the data after the fill operation was not written to */
> + for (; j < rte_pktmbuf_data_len(dst); j++)
> + if (dst_data[j] != 0)
> + ERR_RETURN("Error, fill operation wrote too far (lengths = %u): got (%x), not (%x)\n",
> + lengths[i], dst_data[j], 0);
> }
> - /* check that the data after the fill operation was not written to */
> - for (; j < rte_pktmbuf_data_len(dst); j++)
> - if (dst_data[j] != 0)
> - ERR_RETURN("Error, fill operation wrote too far (lengths = %u): got (%x), not (%x)\n",
> - lengths[i], dst_data[j], 0);
> }
>
> rte_pktmbuf_free(dst);
next prev parent reply other threads:[~2025-06-10 6:49 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
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-16 12:37 ` [PATCH v1 2/2] test/dma: add functions to verify zero and one fill Vidya Sagar Velumuri
2024-04-19 9:07 ` [PATCH v2 1/2] test/dma: update the sg test to verify wrap around case Vidya Sagar Velumuri
2024-04-19 9:07 ` [PATCH v2 2/2] test/dma: add functions to verify zero and one fill Vidya Sagar Velumuri
2024-10-04 11:05 ` [EXTERNAL] " Amit Prakash Shukla
2024-10-04 11:48 ` Amit Prakash Shukla
2024-11-19 17:11 ` Thomas Monjalon
2024-10-04 11:04 ` [EXTERNAL] [PATCH v2 1/2] test/dma: update the sg test to verify wrap around case Amit Prakash Shukla
2024-10-04 11:49 ` Amit Prakash Shukla
2025-06-06 9:40 ` [PATCH v3 " Vidya Sagar Velumuri
2025-06-06 9:40 ` [PATCH v3 2/2] test/dma: add functions to verify zero and one fill Vidya Sagar Velumuri
2025-06-09 3:03 ` [PATCH v4 1/2] test/dma: update the sg test to verify wrap around case Vidya Sagar Velumuri
2025-06-09 3:03 ` [PATCH v4 2/2] test/dma: add functions to verify zero and one fill Vidya Sagar Velumuri
2025-06-10 6:48 ` fengchengwen [this message]
2025-06-10 6:41 ` [PATCH v4 1/2] test/dma: update the sg test to verify wrap around case 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=3051d7ed-ccc8-45c3-8e2e-d76efa1146c5@huawei.com \
--to=fengchengwen@huawei.com \
--cc=amitprakashs@marvell.com \
--cc=anoobj@marvell.com \
--cc=asasidharan@marvell.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=jerinj@marvell.com \
--cc=kevin.laatz@intel.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).