From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: conor.walsh@intel.com, kevin.laatz@intel.com,
Chengwen Feng <fengchengwen@huawei.com>,
jerinj@marvell.com, Bruce Richardson <bruce.richardson@intel.com>
Subject: [dpdk-dev] [RFC PATCH 5/7] app/test: add more comprehensive dmadev copy tests
Date: Thu, 26 Aug 2021 19:32:59 +0100 [thread overview]
Message-ID: <20210826183301.333442-6-bruce.richardson@intel.com> (raw)
In-Reply-To: <20210826183301.333442-1-bruce.richardson@intel.com>
Add unit tests for various combinations of use for dmadev, copying
bursts of packets in various formats, e.g.
1. enqueuing two smaller bursts and completing them as one burst
2. enqueuing one burst and gathering completions in smaller bursts
3. using completed_status() function to gather completions rather than
just completed()
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
app/test/test_dmadev.c | 123 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 122 insertions(+), 1 deletion(-)
diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
index a9f7d34a94..f3ebac2812 100644
--- a/app/test/test_dmadev.c
+++ b/app/test/test_dmadev.c
@@ -37,6 +37,120 @@ print_err(const char *func, int lineno, const char *format, ...)
return ret;
}
+/* run a series of copy tests just using some different options for enqueues and completions */
+static int
+do_multi_copies(int dev_id, uint16_t vchan,
+ int split_batches, /* submit 2 x 16 or 1 x 32 burst */
+ int split_completions, /* gather 2 x 16 or 1 x 32 completions */
+ int use_completed_status) /* use completed or completed_status function */
+{
+ struct rte_mbuf *srcs[32], *dsts[32];
+ enum rte_dma_status_code sc[32];
+ unsigned int i, j;
+ bool dma_err = false;
+
+ /* Enqueue burst of copies and hit doorbell. 8< */
+ for (i = 0; i < RTE_DIM(srcs); i++) {
+ uint64_t *src_data;
+
+ if (split_batches && i == RTE_DIM(srcs) / 2)
+ rte_dmadev_submit(dev_id, vchan);
+
+ srcs[i] = rte_pktmbuf_alloc(pool);
+ dsts[i] = rte_pktmbuf_alloc(pool);
+ src_data = rte_pktmbuf_mtod(srcs[i], uint64_t *);
+ if (srcs[i] == NULL || dsts[i] == NULL) {
+ PRINT_ERR("Error allocating buffers\n");
+ return -1;
+ }
+
+ for (j = 0; j < COPY_LEN/sizeof(uint64_t); j++)
+ src_data[j] = rte_rand();
+
+ if (rte_dmadev_copy(dev_id, vchan, srcs[i]->buf_iova + srcs[i]->data_off,
+ dsts[i]->buf_iova + dsts[i]->data_off, COPY_LEN, 0) != id_count++) {
+ PRINT_ERR("Error with rte_dmadev_copy for buffer %u\n", i);
+ return -1;
+ }
+ }
+ rte_dmadev_submit(dev_id, vchan);
+ /* >8 End of enqueue burst of copies and hit doorbell. */
+ usleep(20);
+
+ if (split_completions) {
+ /* gather completions in two halves */
+ uint16_t half_len = RTE_DIM(srcs) / 2;
+ int ret = rte_dmadev_completed(dev_id, vchan, half_len, NULL, &dma_err);
+ if (ret != half_len || dma_err) {
+ PRINT_ERR("Error with rte_dmadev_completed - first half. ret = %d, expected ret = %u, dma_err = %d\n",
+ ret, half_len, dma_err);
+ rte_dmadev_dump(dev_id, stdout);
+ return -1;
+ }
+ ret = rte_dmadev_completed(dev_id, vchan, half_len, NULL, &dma_err);
+ if (ret != half_len || dma_err) {
+ PRINT_ERR("Error with rte_dmadev_completed - second half. ret = %d, expected ret = %u, dma_err = %d\n",
+ ret, half_len, dma_err);
+ rte_dmadev_dump(dev_id, stdout);
+ return -1;
+ }
+ } else {
+ /* gather all completions in one go, using either
+ * completed or completed_status fns
+ */
+ if (!use_completed_status) {
+ int n = rte_dmadev_completed(dev_id, vchan, RTE_DIM(srcs), NULL, &dma_err);
+ if (n != RTE_DIM(srcs) || dma_err) {
+ PRINT_ERR("Error with rte_dmadev_completed, %u [expected: %zu], dma_err = %d\n",
+ n, RTE_DIM(srcs), dma_err);
+ rte_dmadev_dump(dev_id, stdout);
+ return -1;
+ }
+ } else {
+ int n = rte_dmadev_completed_status(dev_id, vchan, RTE_DIM(srcs), NULL, sc);
+ if (n != RTE_DIM(srcs)) {
+ PRINT_ERR("Error with rte_dmadev_completed_status, %u [expected: %zu]\n",
+ n, RTE_DIM(srcs));
+ rte_dmadev_dump(dev_id, stdout);
+ return -1;
+ }
+ for (j = 0; j < (uint16_t)n; j++) {
+ if (sc[j] != RTE_DMA_STATUS_SUCCESSFUL) {
+ PRINT_ERR("Error with rte_dmadev_completed_status, job %u reports failure [code %u]\n",
+ j, sc[j]);
+ rte_dmadev_dump(dev_id, stdout);
+ return -1;
+ }
+ }
+ }
+ }
+
+ /* check for empty */
+ int ret = use_completed_status ?
+ rte_dmadev_completed_status(dev_id, vchan, RTE_DIM(srcs), NULL, sc) :
+ rte_dmadev_completed(dev_id, vchan, RTE_DIM(srcs), NULL, &dma_err);
+ if (ret != 0) {
+ PRINT_ERR("Error with completion check - ops unexpectedly returned\n");
+ rte_dmadev_dump(dev_id, stdout);
+ return -1;
+ }
+
+ for (i = 0; i < RTE_DIM(srcs); i++) {
+ char *src_data, *dst_data;
+
+ src_data = rte_pktmbuf_mtod(srcs[i], char *);
+ dst_data = rte_pktmbuf_mtod(dsts[i], char *);
+ for (j = 0; j < COPY_LEN; j++)
+ if (src_data[j] != dst_data[j]) {
+ PRINT_ERR("Error with copy of packet %u, byte %u\n", i, j);
+ return -1;
+ }
+ rte_pktmbuf_free(srcs[i]);
+ rte_pktmbuf_free(dsts[i]);
+ }
+ return 0;
+}
+
static int
test_enqueue_copies(int dev_id, uint16_t vchan)
{
@@ -144,7 +258,14 @@ test_enqueue_copies(int dev_id, uint16_t vchan)
rte_pktmbuf_free(dst);
} while (0);
- return 0;
+ /* test doing multiple copies */
+ return do_multi_copies(dev_id, vchan, 0, 0, 0) /* enqueue and complete 1 batch at a time */
+ /* enqueue 2 batches and then complete both */
+ || do_multi_copies(dev_id, vchan, 1, 0, 0)
+ /* enqueue 1 batch, then complete in two halves */
+ || do_multi_copies(dev_id, vchan, 0, 1, 0)
+ /* test using completed_status in place of regular completed API */
+ || do_multi_copies(dev_id, vchan, 0, 0, 1);
}
static int
--
2.30.2
next prev parent reply other threads:[~2021-08-26 18:33 UTC|newest]
Thread overview: 130+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-26 18:32 [dpdk-dev] [RFC PATCH 0/7] add test suite for DMA drivers Bruce Richardson
2021-08-26 18:32 ` [dpdk-dev] [RFC PATCH 1/7] app/test: take API tests from skeleton dmadev Bruce Richardson
2021-08-26 18:32 ` [dpdk-dev] [RFC PATCH 2/7] dmadev: remove selftest support Bruce Richardson
2021-08-26 18:32 ` [dpdk-dev] [RFC PATCH 3/7] app/test: add basic dmadev instance tests Bruce Richardson
2021-08-26 18:32 ` [dpdk-dev] [RFC PATCH 4/7] app/test: add basic dmadev copy tests Bruce Richardson
2021-08-27 7:14 ` Jerin Jacob
2021-08-27 10:41 ` Bruce Richardson
2021-08-26 18:32 ` Bruce Richardson [this message]
2021-08-26 18:33 ` [dpdk-dev] [RFC PATCH 6/7] app/test: test dmadev instance failure handling Bruce Richardson
2021-08-26 18:33 ` [dpdk-dev] [RFC PATCH 7/7] app/test: add dmadev fill tests Bruce Richardson
2021-09-01 16:32 ` [dpdk-dev] [PATCH v2 0/6] add test suite for DMA drivers Bruce Richardson
2021-09-01 16:32 ` [dpdk-dev] [PATCH v2 1/6] dmadev: add device idle check for testing use Bruce Richardson
2021-09-02 12:54 ` fengchengwen
2021-09-02 14:21 ` Bruce Richardson
2021-09-01 16:32 ` [dpdk-dev] [PATCH v2 2/6] app/test: add basic dmadev instance tests Bruce Richardson
2021-09-01 19:24 ` Mattias Rönnblom
2021-09-02 10:30 ` Bruce Richardson
2021-09-03 16:07 ` Conor Walsh
2021-09-01 16:32 ` [dpdk-dev] [PATCH v2 3/6] app/test: add basic dmadev copy tests Bruce Richardson
2021-09-02 7:44 ` Jerin Jacob
2021-09-02 8:06 ` Bruce Richardson
2021-09-02 10:54 ` Jerin Jacob
2021-09-02 11:43 ` Bruce Richardson
2021-09-02 13:05 ` Jerin Jacob
2021-09-02 14:21 ` Bruce Richardson
2021-09-03 16:05 ` Kevin Laatz
2021-09-03 16:07 ` Conor Walsh
2021-09-01 16:32 ` [dpdk-dev] [PATCH v2 4/6] app/test: add more comprehensive " Bruce Richardson
2021-09-03 16:08 ` Conor Walsh
2021-09-03 16:11 ` Kevin Laatz
2021-09-01 16:32 ` [dpdk-dev] [PATCH v2 5/6] app/test: test dmadev instance failure handling Bruce Richardson
2021-09-01 19:53 ` Mattias Rönnblom
2021-09-03 16:08 ` Conor Walsh
2021-09-03 16:21 ` Kevin Laatz
2021-09-01 16:32 ` [dpdk-dev] [PATCH v2 6/6] app/test: add dmadev fill tests Bruce Richardson
2021-09-03 16:09 ` Conor Walsh
2021-09-03 16:17 ` Conor Walsh
2021-09-03 16:33 ` Bruce Richardson
2021-09-07 16:49 ` [dpdk-dev] [PATCH v3 0/8] add test suite for DMA drivers Bruce Richardson
2021-09-07 16:49 ` [dpdk-dev] [PATCH v3 1/8] dmadev: add channel status check for testing use Bruce Richardson
2021-09-08 10:50 ` Walsh, Conor
2021-09-08 13:20 ` Kevin Laatz
2021-09-07 16:49 ` [dpdk-dev] [PATCH v3 2/8] dmadev: add burst capacity API Bruce Richardson
2021-09-08 10:53 ` Walsh, Conor
2021-09-08 18:17 ` Jerin Jacob
2021-09-09 8:16 ` Bruce Richardson
2021-09-17 13:54 ` Jerin Jacob
2021-09-17 14:37 ` Pai G, Sunil
2021-09-18 12:18 ` Jerin Jacob
2021-09-18 1:06 ` Hu, Jiayu
2021-09-18 12:12 ` Jerin Jacob
2021-09-21 13:57 ` Pai G, Sunil
2021-09-21 14:56 ` Jerin Jacob
2021-09-21 15:34 ` Pai G, Sunil
2021-09-21 16:58 ` Jerin Jacob
2021-09-21 17:12 ` Pai G, Sunil
2021-09-21 18:11 ` Jerin Jacob
2021-09-22 1:51 ` fengchengwen
2021-09-22 7:56 ` Bruce Richardson
2021-09-22 16:35 ` Bruce Richardson
2021-09-22 17:29 ` Jerin Jacob
2021-09-23 13:24 ` fengchengwen
2021-09-07 16:49 ` [dpdk-dev] [PATCH v3 3/8] app/test: add basic dmadev instance tests Bruce Richardson
2021-09-08 13:21 ` Kevin Laatz
2021-09-07 16:49 ` [dpdk-dev] [PATCH v3 4/8] app/test: add basic dmadev copy tests Bruce Richardson
2021-09-07 16:49 ` [dpdk-dev] [PATCH v3 5/8] app/test: add more comprehensive " Bruce Richardson
2021-09-07 16:49 ` [dpdk-dev] [PATCH v3 6/8] app/test: test dmadev instance failure handling Bruce Richardson
2021-09-07 16:49 ` [dpdk-dev] [PATCH v3 7/8] app/test: add dmadev fill tests Bruce Richardson
2021-09-07 16:49 ` [dpdk-dev] [PATCH v3 8/8] app/test: add dmadev burst capacity API test Bruce Richardson
2021-09-08 11:03 ` Walsh, Conor
2021-09-17 13:30 ` [dpdk-dev] [PATCH v4 0/9] add test suite for DMA drivers Bruce Richardson
2021-09-17 13:30 ` [dpdk-dev] [PATCH v4 1/9] dmadev: add channel status check for testing use Bruce Richardson
2021-09-17 13:30 ` [dpdk-dev] [PATCH v4 2/9] dmadev: add burst capacity API Bruce Richardson
2021-09-17 13:30 ` [dpdk-dev] [PATCH v4 3/9] dmadev: add device iterator Bruce Richardson
2021-09-17 13:30 ` [dpdk-dev] [PATCH v4 4/9] app/test: add basic dmadev instance tests Bruce Richardson
2021-09-17 13:30 ` [dpdk-dev] [PATCH v4 5/9] app/test: add basic dmadev copy tests Bruce Richardson
2021-09-17 13:30 ` [dpdk-dev] [PATCH v4 6/9] app/test: add more comprehensive " Bruce Richardson
2021-09-17 13:30 ` [dpdk-dev] [PATCH v4 7/9] app/test: test dmadev instance failure handling Bruce Richardson
2021-09-17 13:30 ` [dpdk-dev] [PATCH v4 8/9] app/test: add dmadev fill tests Bruce Richardson
2021-09-17 13:30 ` [dpdk-dev] [PATCH v4 9/9] app/test: add dmadev burst capacity API test Bruce Richardson
2021-09-17 13:54 ` [dpdk-dev] [PATCH v5 0/9] add test suite for DMA drivers Bruce Richardson
2021-09-17 13:54 ` [dpdk-dev] [PATCH v5 1/9] dmadev: add channel status check for testing use Bruce Richardson
2021-09-22 8:25 ` fengchengwen
2021-09-22 8:31 ` Bruce Richardson
2021-09-17 13:54 ` [dpdk-dev] [PATCH v5 2/9] dmadev: add burst capacity API Bruce Richardson
2021-09-17 13:54 ` [dpdk-dev] [PATCH v5 3/9] dmadev: add device iterator Bruce Richardson
2021-09-22 8:46 ` fengchengwen
2021-09-17 13:54 ` [dpdk-dev] [PATCH v5 4/9] app/test: add basic dmadev instance tests Bruce Richardson
2021-09-17 13:54 ` [dpdk-dev] [PATCH v5 5/9] app/test: add basic dmadev copy tests Bruce Richardson
2021-09-17 13:54 ` [dpdk-dev] [PATCH v5 6/9] app/test: add more comprehensive " Bruce Richardson
2021-09-17 13:54 ` [dpdk-dev] [PATCH v5 7/9] app/test: test dmadev instance failure handling Bruce Richardson
2021-09-17 13:54 ` [dpdk-dev] [PATCH v5 8/9] app/test: add dmadev fill tests Bruce Richardson
2021-09-17 13:54 ` [dpdk-dev] [PATCH v5 9/9] app/test: add dmadev burst capacity API test Bruce Richardson
2021-09-24 10:29 ` [dpdk-dev] [PATCH v6 00/13] add test suite for DMA drivers Bruce Richardson
2021-09-24 10:29 ` [dpdk-dev] [PATCH v6 01/13] dmadev: add channel status check for testing use Bruce Richardson
2021-09-24 10:29 ` [dpdk-dev] [PATCH v6 02/13] dma/skeleton: add channel status function Bruce Richardson
2021-09-24 10:29 ` [dpdk-dev] [PATCH v6 03/13] dmadev: add burst capacity API Bruce Richardson
2021-09-24 10:29 ` [dpdk-dev] [PATCH v6 04/13] dma/skeleton: add burst capacity function Bruce Richardson
2021-09-24 14:51 ` Conor Walsh
2021-09-24 10:29 ` [dpdk-dev] [PATCH v6 05/13] dmadev: add device iterator Bruce Richardson
2021-09-24 14:52 ` Conor Walsh
2021-09-24 15:58 ` Kevin Laatz
2021-09-24 10:29 ` [dpdk-dev] [PATCH v6 06/13] app/test: add basic dmadev instance tests Bruce Richardson
2021-09-24 10:29 ` [dpdk-dev] [PATCH v6 07/13] app/test: add basic dmadev copy tests Bruce Richardson
2021-09-24 10:29 ` [dpdk-dev] [PATCH v6 08/13] app/test: run test suite on skeleton driver Bruce Richardson
2021-09-24 15:58 ` Kevin Laatz
2021-09-24 10:29 ` [dpdk-dev] [PATCH v6 09/13] app/test: add more comprehensive dmadev copy tests Bruce Richardson
2021-09-24 10:31 ` [dpdk-dev] [PATCH v6 10/13] dmadev: add flag for error handling support Bruce Richardson
2021-09-24 14:52 ` Conor Walsh
2021-09-24 15:58 ` Kevin Laatz
2021-09-24 10:31 ` [dpdk-dev] [PATCH v6 11/13] app/test: test dmadev instance failure handling Bruce Richardson
2021-09-24 10:31 ` [dpdk-dev] [PATCH v6 12/13] app/test: add dmadev fill tests Bruce Richardson
2021-09-24 10:31 ` [dpdk-dev] [PATCH v6 13/13] app/test: add dmadev burst capacity API test Bruce Richardson
2021-10-13 15:17 ` [dpdk-dev] [PATCH v7 00/13] add test suite for DMA drivers Bruce Richardson
2021-10-13 15:17 ` [dpdk-dev] [PATCH v7 01/13] dmadev: add channel status check for testing use Bruce Richardson
2021-10-13 15:17 ` [dpdk-dev] [PATCH v7 02/13] dma/skeleton: add channel status function Bruce Richardson
2021-10-13 15:17 ` [dpdk-dev] [PATCH v7 03/13] dmadev: add burst capacity API Bruce Richardson
2021-10-13 15:17 ` [dpdk-dev] [PATCH v7 04/13] dma/skeleton: add burst capacity function Bruce Richardson
2021-10-13 15:17 ` [dpdk-dev] [PATCH v7 05/13] dmadev: add device iterator Bruce Richardson
2021-10-13 15:17 ` [dpdk-dev] [PATCH v7 06/13] app/test: add basic dmadev instance tests Bruce Richardson
2021-10-13 15:17 ` [dpdk-dev] [PATCH v7 07/13] app/test: add basic dmadev copy tests Bruce Richardson
2021-10-13 15:17 ` [dpdk-dev] [PATCH v7 08/13] app/test: run test suite on skeleton driver Bruce Richardson
2021-10-13 15:17 ` [dpdk-dev] [PATCH v7 09/13] app/test: add more comprehensive dmadev copy tests Bruce Richardson
2021-10-13 15:17 ` [dpdk-dev] [PATCH v7 10/13] dmadev: add flag for error handling support Bruce Richardson
2021-10-13 15:17 ` [dpdk-dev] [PATCH v7 11/13] app/test: test dmadev instance failure handling Bruce Richardson
2021-10-13 15:17 ` [dpdk-dev] [PATCH v7 12/13] app/test: add dmadev fill tests Bruce Richardson
2021-10-13 15:17 ` [dpdk-dev] [PATCH v7 13/13] app/test: add dmadev burst capacity API test Bruce Richardson
2021-10-18 9:20 ` [dpdk-dev] [PATCH v7 00/13] add test suite for DMA drivers Thomas Monjalon
2021-10-21 12:06 ` fengchengwen
2021-10-21 14:55 ` 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=20210826183301.333442-6-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=conor.walsh@intel.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=jerinj@marvell.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).