From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
Chengwen Feng <fengchengwen@huawei.com>,
Kevin Laatz <kevin.laatz@intel.com>
Subject: [PATCH 4/5] test/dmadev: create separate function for single copy test
Date: Mon, 16 Jan 2023 15:37:13 +0000 [thread overview]
Message-ID: <20230116153714.554470-5-bruce.richardson@intel.com> (raw)
In-Reply-To: <20230116153714.554470-1-bruce.richardson@intel.com>
The copy tests for dmadev had separate blocks in the test function for
single copy and burst copies. Separate out the single-copy block to its
own function so that it can be re-used if necessary.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
app/test/test_dmadev.c | 120 ++++++++++++++++++++++-------------------
1 file changed, 64 insertions(+), 56 deletions(-)
diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
index 4e1dbcaa19..de787c14e2 100644
--- a/app/test/test_dmadev.c
+++ b/app/test/test_dmadev.c
@@ -175,77 +175,85 @@ do_multi_copies(int16_t dev_id, uint16_t vchan,
}
static int
-test_enqueue_copies(int16_t dev_id, uint16_t vchan)
+test_single_copy(int16_t dev_id, uint16_t vchan)
{
- enum rte_dma_status_code status;
- unsigned int i;
+ uint16_t i;
uint16_t id;
+ enum rte_dma_status_code status;
+ struct rte_mbuf *src, *dst;
+ char *src_data, *dst_data;
- /* test doing a single copy */
- do {
- struct rte_mbuf *src, *dst;
- char *src_data, *dst_data;
+ src = rte_pktmbuf_alloc(pool);
+ dst = rte_pktmbuf_alloc(pool);
+ src_data = rte_pktmbuf_mtod(src, char *);
+ dst_data = rte_pktmbuf_mtod(dst, char *);
- src = rte_pktmbuf_alloc(pool);
- dst = rte_pktmbuf_alloc(pool);
- src_data = rte_pktmbuf_mtod(src, char *);
- dst_data = rte_pktmbuf_mtod(dst, char *);
+ for (i = 0; i < COPY_LEN; i++)
+ src_data[i] = rte_rand() & 0xFF;
- for (i = 0; i < COPY_LEN; i++)
- src_data[i] = rte_rand() & 0xFF;
+ id = rte_dma_copy(dev_id, vchan, rte_pktmbuf_iova(src), rte_pktmbuf_iova(dst),
+ COPY_LEN, RTE_DMA_OP_FLAG_SUBMIT);
+ if (id != id_count)
+ ERR_RETURN("Error with rte_dma_copy, got %u, expected %u\n",
+ id, id_count);
- id = rte_dma_copy(dev_id, vchan, rte_pktmbuf_iova(src), rte_pktmbuf_iova(dst),
- COPY_LEN, RTE_DMA_OP_FLAG_SUBMIT);
- if (id != id_count)
- ERR_RETURN("Error with rte_dma_copy, got %u, expected %u\n",
- id, id_count);
+ /* give time for copy to finish, then check it was done */
+ await_hw(dev_id, vchan);
- /* give time for copy to finish, then check it was done */
- await_hw(dev_id, vchan);
+ for (i = 0; i < COPY_LEN; i++)
+ if (dst_data[i] != src_data[i])
+ ERR_RETURN("Data mismatch at char %u [Got %02x not %02x]\n", i,
+ dst_data[i], src_data[i]);
+
+ /* now check completion works */
+ id = ~id;
+ if (rte_dma_completed(dev_id, vchan, 1, &id, NULL) != 1)
+ ERR_RETURN("Error with rte_dma_completed\n");
+
+ if (id != id_count)
+ ERR_RETURN("Error:incorrect job id received, %u [expected %u]\n",
+ id, id_count);
+
+ /* check for completed and id when no job done */
+ id = ~id;
+ if (rte_dma_completed(dev_id, vchan, 1, &id, NULL) != 0)
+ ERR_RETURN("Error with rte_dma_completed when no job done\n");
+ if (id != id_count)
+ ERR_RETURN("Error:incorrect job id received when no job done, %u [expected %u]\n",
+ id, id_count);
+
+ /* check for completed_status and id when no job done */
+ id = ~id;
+ if (rte_dma_completed_status(dev_id, vchan, 1, &id, &status) != 0)
+ ERR_RETURN("Error with rte_dma_completed_status when no job done\n");
+ if (id != id_count)
+ ERR_RETURN("Error:incorrect job id received when no job done, %u [expected %u]\n",
+ id, id_count);
- for (i = 0; i < COPY_LEN; i++)
- if (dst_data[i] != src_data[i])
- ERR_RETURN("Data mismatch at char %u [Got %02x not %02x]\n", i,
- dst_data[i], src_data[i]);
-
- /* now check completion works */
- id = ~id;
- if (rte_dma_completed(dev_id, vchan, 1, &id, NULL) != 1)
- ERR_RETURN("Error with rte_dma_completed\n");
-
- if (id != id_count)
- ERR_RETURN("Error:incorrect job id received, %u [expected %u]\n",
- id, id_count);
-
- /* check for completed and id when no job done */
- id = ~id;
- if (rte_dma_completed(dev_id, vchan, 1, &id, NULL) != 0)
- ERR_RETURN("Error with rte_dma_completed when no job done\n");
- if (id != id_count)
- ERR_RETURN("Error:incorrect job id received when no job done, %u [expected %u]\n",
- id, id_count);
-
- /* check for completed_status and id when no job done */
- id = ~id;
- if (rte_dma_completed_status(dev_id, vchan, 1, &id, &status) != 0)
- ERR_RETURN("Error with rte_dma_completed_status when no job done\n");
- if (id != id_count)
- ERR_RETURN("Error:incorrect job id received when no job done, %u [expected %u]\n",
- id, id_count);
+ rte_pktmbuf_free(src);
+ rte_pktmbuf_free(dst);
- rte_pktmbuf_free(src);
- rte_pktmbuf_free(dst);
+ /* now check completion returns nothing more */
+ if (rte_dma_completed(dev_id, 0, 1, NULL, NULL) != 0)
+ ERR_RETURN("Error with rte_dma_completed in empty check\n");
+
+ id_count++;
- /* now check completion returns nothing more */
- if (rte_dma_completed(dev_id, 0, 1, NULL, NULL) != 0)
- ERR_RETURN("Error with rte_dma_completed in empty check\n");
+ return 0;
+}
- id_count++;
+static int
+test_enqueue_copies(int16_t dev_id, uint16_t vchan)
+{
+ unsigned int i;
- } while (0);
+ /* test doing a single copy */
+ if (test_single_copy(dev_id, vchan) < 0)
+ return -1;
/* test doing a multiple single copies */
do {
+ uint16_t id;
const uint16_t max_ops = 4;
struct rte_mbuf *src, *dst;
char *src_data, *dst_data;
--
2.37.2
next prev parent reply other threads:[~2023-01-16 15:38 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-16 15:37 [PATCH 0/5] dma/ioat: fix issues with stopping and restarting device Bruce Richardson
2023-01-16 15:37 ` [PATCH 1/5] dma/ioat: fix device stop if no copies done Bruce Richardson
2023-01-16 15:37 ` [PATCH 2/5] dma/ioat: fix incorrectly set indexes after restart Bruce Richardson
2023-01-16 15:37 ` [PATCH 3/5] test/dmadev: check result for device stop Bruce Richardson
2023-01-16 15:37 ` Bruce Richardson [this message]
2023-01-16 15:37 ` [PATCH 5/5] test/dmadev: add tests for stopping and restarting dev Bruce Richardson
2023-01-16 16:09 ` [PATCH 0/5] dma/ioat: fix issues with stopping and restarting device Walsh, Conor
2023-01-16 16:38 ` Bruce Richardson
2023-01-16 17:37 ` [PATCH v2 0/6] " Bruce Richardson
2023-01-16 17:37 ` [PATCH v2 1/6] dma/ioat: fix device stop if no copies done Bruce Richardson
2023-01-18 10:47 ` Walsh, Conor
2023-02-14 16:04 ` Kevin Laatz
2023-01-16 17:37 ` [PATCH v2 2/6] dma/ioat: fix incorrectly set indexes after restart Bruce Richardson
2023-01-18 10:47 ` Walsh, Conor
2023-02-14 16:04 ` Kevin Laatz
2023-01-16 17:37 ` [PATCH v2 3/6] dma/ioat: fix incorrect error reporting on restart Bruce Richardson
2023-01-18 10:47 ` Walsh, Conor
2023-02-14 16:04 ` Kevin Laatz
2023-01-16 17:37 ` [PATCH v2 4/6] test/dmadev: check result for device stop Bruce Richardson
2023-01-18 10:47 ` Walsh, Conor
2023-02-02 11:12 ` David Marchand
2023-02-14 16:04 ` Kevin Laatz
2023-02-15 1:26 ` fengchengwen
2023-02-15 11:58 ` Bruce Richardson
2023-01-16 17:37 ` [PATCH v2 5/6] test/dmadev: create separate function for single copy test Bruce Richardson
2023-02-14 16:04 ` Kevin Laatz
2023-02-15 1:28 ` fengchengwen
2023-01-16 17:37 ` [PATCH v2 6/6] test/dmadev: add tests for stopping and restarting dev Bruce Richardson
2023-02-14 16:04 ` Kevin Laatz
2023-02-15 1:59 ` fengchengwen
2023-02-15 11:57 ` Bruce Richardson
2023-02-16 1:24 ` fengchengwen
2023-02-16 9:24 ` Bruce Richardson
2023-02-16 11:09 ` [PATCH v3 0/6] dma/ioat: fix issues with stopping and restarting device Bruce Richardson
2023-02-16 11:09 ` [PATCH v3 1/6] dma/ioat: fix device stop if no copies done Bruce Richardson
2023-02-16 11:09 ` [PATCH v3 2/6] dma/ioat: fix incorrectly set indexes after restart Bruce Richardson
2023-02-16 11:09 ` [PATCH v3 3/6] dma/ioat: fix incorrect error reporting on restart Bruce Richardson
2023-02-16 11:09 ` [PATCH v3 4/6] test/dmadev: check result for device stop Bruce Richardson
2023-02-16 11:41 ` fengchengwen
2023-02-16 11:09 ` [PATCH v3 5/6] test/dmadev: create separate function for single copy test Bruce Richardson
2023-02-16 11:09 ` [PATCH v3 6/6] test/dmadev: add tests for stopping and restarting dev Bruce Richardson
2023-02-16 11:42 ` fengchengwen
2023-02-19 23:11 ` [PATCH v3 0/6] dma/ioat: fix issues with stopping and restarting device Thomas Monjalon
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=20230116153714.554470-5-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=kevin.laatz@intel.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).