* [PATCH v1 1/2] test/dma: update the sg test to verify wrap around case
@ 2024-04-16 12:37 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
0 siblings, 2 replies; 16+ messages in thread
From: Vidya Sagar Velumuri @ 2024-04-16 12:37 UTC (permalink / raw)
To: Chengwen Feng, Kevin Laatz, Bruce Richardson
Cc: jerinj, anoobj, vvelumuri, asasidharan, ktejasree, gmuthukrishn,
dev
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>
diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
index 143e1bcd68..7462e90831 100644
--- a/app/test/test_dmadev.c
+++ b/app/test/test_dmadev.c
@@ -393,34 +393,26 @@ 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;
-
+ unsigned int len = test_len - (test_len % (n_src * n_dst));
struct rte_dma_sge sg_src[n_sge], sg_dst[n_sge];
struct rte_mbuf *src[n_sge], *dst[n_sge];
char *src_data[n_sge], *dst_data[n_sge];
+ 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;
@@ -511,6 +503,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);
+ len = COPY_LEN;
+
+ do {
+ test_enqueue_sg(dev_id, vchan, n_sge, len);
+ loop_count++;
+ } while (loop_count * n_sge * n_sge < TEST_RINGSIZE * 3);
+
+ return 0;
+}
+
/* Failure handling test cases - global macros and variables for those tests*/
#define COMP_BURST_SZ 16
#define OPT_FENCE(idx) ((fence && idx == 8) ? RTE_DMA_OP_FLAG_FENCE : 0)
diff --git a/app/test/test_dmadev_api.c b/app/test/test_dmadev_api.c
index d40c05cfbf..6a07ed593b 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
+
int test_dma_api(uint16_t dev_id);
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v1 2/2] test/dma: add functions to verify zero and one fill
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 ` 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
1 sibling, 0 replies; 16+ messages in thread
From: Vidya Sagar Velumuri @ 2024-04-16 12:37 UTC (permalink / raw)
To: Chengwen Feng, Kevin Laatz, Bruce Richardson
Cc: jerinj, anoobj, vvelumuri, asasidharan, ktejasree, gmuthukrishn,
dev
Add test cases to verify zero fill and one fill
Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
diff --git a/app/test/test.h b/app/test/test.h
index 15e23d297f..0ca6519f6e 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -27,6 +27,10 @@
#include <rte_test.h>
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
#define TEST_ASSERT RTE_TEST_ASSERT
#define TEST_ASSERT_EQUAL RTE_TEST_ASSERT_EQUAL
diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
index 7462e90831..b21994d592 100644
--- a/app/test/test_dmadev.c
+++ b/app/test/test_dmadev.c
@@ -869,42 +869,52 @@ 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 < ARRAY_SIZE(pattern); k++) {
+ printf("Test fill pattern: 0x%016lx\n", 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);
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 1/2] test/dma: update the sg test to verify wrap around case
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 ` 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
` (3 more replies)
1 sibling, 4 replies; 16+ messages in thread
From: Vidya Sagar Velumuri @ 2024-04-19 9:07 UTC (permalink / raw)
To: fengchengwen, kevin.laatz, bruce.richardson
Cc: jerinj, anoobj, vvelumuri, asasidharan, ktejasree, gmuthukrishn,
dev
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>
diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
index 143e1bcd68..7462e90831 100644
--- a/app/test/test_dmadev.c
+++ b/app/test/test_dmadev.c
@@ -393,34 +393,26 @@ 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;
-
+ unsigned int len = test_len - (test_len % (n_src * n_dst));
struct rte_dma_sge sg_src[n_sge], sg_dst[n_sge];
struct rte_mbuf *src[n_sge], *dst[n_sge];
char *src_data[n_sge], *dst_data[n_sge];
+ 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;
@@ -511,6 +503,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);
+ len = COPY_LEN;
+
+ do {
+ test_enqueue_sg(dev_id, vchan, n_sge, len);
+ loop_count++;
+ } while (loop_count * n_sge * n_sge < TEST_RINGSIZE * 3);
+
+ return 0;
+}
+
/* Failure handling test cases - global macros and variables for those tests*/
#define COMP_BURST_SZ 16
#define OPT_FENCE(idx) ((fence && idx == 8) ? RTE_DMA_OP_FLAG_FENCE : 0)
diff --git a/app/test/test_dmadev_api.c b/app/test/test_dmadev_api.c
index d40c05cfbf..6a07ed593b 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
+
int test_dma_api(uint16_t dev_id);
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v2 2/2] test/dma: add functions to verify zero and one fill
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 ` Vidya Sagar Velumuri
2024-10-04 11:05 ` [EXTERNAL] " Amit Prakash Shukla
` (2 more replies)
2024-10-04 11:04 ` [EXTERNAL] [PATCH v2 1/2] test/dma: update the sg test to verify wrap around case Amit Prakash Shukla
` (2 subsequent siblings)
3 siblings, 3 replies; 16+ messages in thread
From: Vidya Sagar Velumuri @ 2024-04-19 9:07 UTC (permalink / raw)
To: fengchengwen, kevin.laatz, bruce.richardson
Cc: jerinj, anoobj, vvelumuri, asasidharan, ktejasree, gmuthukrishn,
dev
Add test cases to verify zero fill and one fill
Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
diff --git a/app/test/test.h b/app/test/test.h
index 15e23d297f..0ca6519f6e 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -27,6 +27,10 @@
#include <rte_test.h>
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
#define TEST_ASSERT RTE_TEST_ASSERT
#define TEST_ASSERT_EQUAL RTE_TEST_ASSERT_EQUAL
diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
index 7462e90831..ec896a4905 100644
--- a/app/test/test_dmadev.c
+++ b/app/test/test_dmadev.c
@@ -869,42 +869,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 < ARRAY_SIZE(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);
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [EXTERNAL] [PATCH v2 1/2] test/dma: update the sg test to verify wrap around case
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:04 ` Amit Prakash Shukla
2024-10-04 11:49 ` Amit Prakash Shukla
2025-06-06 9:40 ` [PATCH v3 " Vidya Sagar Velumuri
3 siblings, 0 replies; 16+ messages in thread
From: Amit Prakash Shukla @ 2024-10-04 11:04 UTC (permalink / raw)
To: Vidya Sagar Velumuri, fengchengwen@huawei.com,
kevin.laatz@intel.com, bruce.richardson@intel.com
Cc: Jerin Jacob, Anoob Joseph, Aakash Sasidharan, Tejasree Kondoj,
Gowrishankar Muthukrishnan, dev@dpdk.org
[-- Attachment #1: Type: text/plain, Size: 4695 bytes --]
________________________________
From: Vidya Sagar Velumuri <vvelumuri@marvell.com>
Sent: Friday, April 19, 2024 2:37 PM
To: fengchengwen@huawei.com <fengchengwen@huawei.com>; kevin.laatz@intel.com <kevin.laatz@intel.com>; bruce.richardson@intel.com <bruce.richardson@intel.com>
Cc: Jerin Jacob <jerinj@marvell.com>; Anoob Joseph <anoobj@marvell.com>; Vidya Sagar Velumuri <vvelumuri@marvell.com>; Aakash Sasidharan <asasidharan@marvell.com>; Tejasree Kondoj <ktejasree@marvell.com>; Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>; dev@dpdk.org <dev@dpdk.org>
Subject: [EXTERNAL] [PATCH v2 1/2] test/dma: update the sg test to verify wrap around case
Prioritize security for external emails: Confirm sender and content safety before clicking links or opening attachments
----------------------------------------------------------------------
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>
diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
index 143e1bcd68..7462e90831 100644
--- a/app/test/test_dmadev.c
+++ b/app/test/test_dmadev.c
@@ -393,34 +393,26 @@ 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;
-
+ unsigned int len = test_len - (test_len % (n_src * n_dst));
struct rte_dma_sge sg_src[n_sge], sg_dst[n_sge];
struct rte_mbuf *src[n_sge], *dst[n_sge];
char *src_data[n_sge], *dst_data[n_sge];
+ 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;
@@ -511,6 +503,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);
+ len = COPY_LEN;
+
+ do {
+ test_enqueue_sg(dev_id, vchan, n_sge, len);
+ loop_count++;
+ } while (loop_count * n_sge * n_sge < TEST_RINGSIZE * 3);
+
+ return 0;
+}
+
/* Failure handling test cases - global macros and variables for those tests*/
#define COMP_BURST_SZ 16
#define OPT_FENCE(idx) ((fence && idx == 8) ? RTE_DMA_OP_FLAG_FENCE : 0)
diff --git a/app/test/test_dmadev_api.c b/app/test/test_dmadev_api.c
index d40c05cfbf..6a07ed593b 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
+
int test_dma_api(uint16_t dev_id);
--
2.25.1
Acked-by: Amit Prakash Shukla <amitprakashs@marvell.com>
Thanks
[-- Attachment #2: Type: text/html, Size: 9423 bytes --]
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [EXTERNAL] [PATCH v2 2/2] test/dma: add functions to verify zero and one fill
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 ` Amit Prakash Shukla
2024-10-04 11:48 ` Amit Prakash Shukla
2024-11-19 17:11 ` Thomas Monjalon
2 siblings, 0 replies; 16+ messages in thread
From: Amit Prakash Shukla @ 2024-10-04 11:05 UTC (permalink / raw)
To: Vidya Sagar Velumuri, fengchengwen@huawei.com,
kevin.laatz@intel.com, bruce.richardson@intel.com
Cc: Jerin Jacob, Anoob Joseph, Aakash Sasidharan, Tejasree Kondoj,
Gowrishankar Muthukrishnan, dev@dpdk.org
[-- Attachment #1: Type: text/plain, Size: 5826 bytes --]
________________________________
From: Vidya Sagar Velumuri <vvelumuri@marvell.com>
Sent: Friday, April 19, 2024 2:37 PM
To: fengchengwen@huawei.com <fengchengwen@huawei.com>; kevin.laatz@intel.com <kevin.laatz@intel.com>; bruce.richardson@intel.com <bruce.richardson@intel.com>
Cc: Jerin Jacob <jerinj@marvell.com>; Anoob Joseph <anoobj@marvell.com>; Vidya Sagar Velumuri <vvelumuri@marvell.com>; Aakash Sasidharan <asasidharan@marvell.com>; Tejasree Kondoj <ktejasree@marvell.com>; Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>; dev@dpdk.org <dev@dpdk.org>
Subject: [EXTERNAL] [PATCH v2 2/2] test/dma: add functions to verify zero and one fill
Prioritize security for external emails: Confirm sender and content safety before clicking links or opening attachments
----------------------------------------------------------------------
Add test cases to verify zero fill and one fill
Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
diff --git a/app/test/test.h b/app/test/test.h
index 15e23d297f..0ca6519f6e 100644
--- a/app/test/test.h
+++ b/app/test/test.h
@@ -27,6 +27,10 @@
#include <rte_test.h>
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
#define TEST_ASSERT RTE_TEST_ASSERT
#define TEST_ASSERT_EQUAL RTE_TEST_ASSERT_EQUAL
diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
index 7462e90831..ec896a4905 100644
--- a/app/test/test_dmadev.c
+++ b/app/test/test_dmadev.c
@@ -869,42 +869,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 < ARRAY_SIZE(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);
--
2.25.1
Acked-by: Amit Prakash Shukla <amitprakashs@marvell.com>
Thanks
[-- Attachment #2: Type: text/html, Size: 14694 bytes --]
^ permalink raw reply related [flat|nested] 16+ messages in thread
* RE: [EXTERNAL] [PATCH v2 2/2] test/dma: add functions to verify zero and one fill
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
2 siblings, 0 replies; 16+ messages in thread
From: Amit Prakash Shukla @ 2024-10-04 11:48 UTC (permalink / raw)
To: Vidya Sagar Velumuri, fengchengwen@huawei.com,
kevin.laatz@intel.com, bruce.richardson@intel.com
Cc: Jerin Jacob, Anoob Joseph, Vidya Sagar Velumuri,
Aakash Sasidharan, Tejasree Kondoj, Gowrishankar Muthukrishnan,
dev@dpdk.org
> -----Original Message-----
> From: Vidya Sagar Velumuri <vvelumuri@marvell.com>
> Sent: Friday, April 19, 2024 2:38 PM
> To: fengchengwen@huawei.com; kevin.laatz@intel.com;
> bruce.richardson@intel.com
> Cc: Jerin Jacob <jerinj@marvell.com>; Anoob Joseph
> <anoobj@marvell.com>; Vidya Sagar Velumuri <vvelumuri@marvell.com>;
> Aakash Sasidharan <asasidharan@marvell.com>; Tejasree Kondoj
> <ktejasree@marvell.com>; Gowrishankar Muthukrishnan
> <gmuthukrishn@marvell.com>; dev@dpdk.org
> Subject: [EXTERNAL] [PATCH v2 2/2] test/dma: add functions to verify zero
> and one fill
>
> Prioritize security for external emails: Confirm sender and content safety
> before clicking links or opening attachments
>
> ----------------------------------------------------------------------
> Add test cases to verify zero fill and one fill
>
> Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com> diff --git
> a/app/test/test.h b/app/test/test.h index 15e23d297f..0ca6519f6e 100644
> --- a/app/test/test.h
> +++ b/app/test/test.h
> @@ -27,6 +27,10 @@
>
> #include <rte_test.h>
>
> +#ifndef ARRAY_SIZE
> +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #endif
> +
> #define TEST_ASSERT RTE_TEST_ASSERT
>
> #define TEST_ASSERT_EQUAL RTE_TEST_ASSERT_EQUAL diff --git
> a/app/test/test_dmadev.c b/app/test/test_dmadev.c index
> 7462e90831..ec896a4905 100644
> --- a/app/test/test_dmadev.c
> +++ b/app/test/test_dmadev.c
> @@ -869,42 +869,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 < ARRAY_SIZE(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);
> --
> 2.25.1
Acked-by: Amit Prakash Shukla <amitprakashs@marvell.com>
Thanks
^ permalink raw reply [flat|nested] 16+ messages in thread
* RE: [EXTERNAL] [PATCH v2 1/2] test/dma: update the sg test to verify wrap around case
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: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
3 siblings, 0 replies; 16+ messages in thread
From: Amit Prakash Shukla @ 2024-10-04 11:49 UTC (permalink / raw)
To: Vidya Sagar Velumuri, fengchengwen@huawei.com,
kevin.laatz@intel.com, bruce.richardson@intel.com
Cc: Jerin Jacob, Anoob Joseph, Vidya Sagar Velumuri,
Aakash Sasidharan, Tejasree Kondoj, Gowrishankar Muthukrishnan,
dev@dpdk.org
> -----Original Message-----
> From: Vidya Sagar Velumuri <vvelumuri@marvell.com>
> Sent: Friday, April 19, 2024 2:38 PM
> To: fengchengwen@huawei.com; kevin.laatz@intel.com;
> bruce.richardson@intel.com
> Cc: Jerin Jacob <jerinj@marvell.com>; Anoob Joseph
> <anoobj@marvell.com>; Vidya Sagar Velumuri <vvelumuri@marvell.com>;
> Aakash Sasidharan <asasidharan@marvell.com>; Tejasree Kondoj
> <ktejasree@marvell.com>; Gowrishankar Muthukrishnan
> <gmuthukrishn@marvell.com>; dev@dpdk.org
> Subject: [EXTERNAL] [PATCH v2 1/2] test/dma: update the sg test to verify
> wrap around case
>
> Prioritize security for external emails: Confirm sender and content safety
> before clicking links or opening attachments
>
> ----------------------------------------------------------------------
> 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> diff --git
> a/app/test/test_dmadev.c b/app/test/test_dmadev.c index
> 143e1bcd68..7462e90831 100644
> --- a/app/test/test_dmadev.c
> +++ b/app/test/test_dmadev.c
> @@ -393,34 +393,26 @@ 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;
> -
> + unsigned int len = test_len - (test_len % (n_src *
> n_dst));
> struct rte_dma_sge sg_src[n_sge], sg_dst[n_sge];
> struct rte_mbuf *src[n_sge], *dst[n_sge];
> char *src_data[n_sge], *dst_data[n_sge];
>
> + 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;
>
> @@ -511,6 +503,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);
> + len = COPY_LEN;
> +
> + do {
> + test_enqueue_sg(dev_id, vchan, n_sge, len);
> + loop_count++;
> + } while (loop_count * n_sge * n_sge < TEST_RINGSIZE * 3);
> +
> + return 0;
> +}
> +
> /* Failure handling test cases - global macros and variables for those tests*/
> #define COMP_BURST_SZ 16
> #define OPT_FENCE(idx) ((fence && idx == 8) ? RTE_DMA_OP_FLAG_FENCE :
> 0) diff --git a/app/test/test_dmadev_api.c b/app/test/test_dmadev_api.c
> index d40c05cfbf..6a07ed593b 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
> +
> int test_dma_api(uint16_t dev_id);
> --
> 2.25.1
Acked-by: Amit Prakash Shukla <amitprakashs@marvell.com>
Thanks
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v2 2/2] test/dma: add functions to verify zero and one fill
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
2 siblings, 0 replies; 16+ messages in thread
From: Thomas Monjalon @ 2024-11-19 17:11 UTC (permalink / raw)
To: fengchengwen, kevin.laatz, bruce.richardson, Vidya Sagar Velumuri
Cc: dev, jerinj, anoobj, vvelumuri, asasidharan, ktejasree,
gmuthukrishn, dev
19/04/2024 11:07, Vidya Sagar Velumuri:
> Add test cases to verify zero fill and one fill
>
> Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
Waiting for review from DMA maintainers.
> diff --git a/app/test/test.h b/app/test/test.h
> index 15e23d297f..0ca6519f6e 100644
> --- a/app/test/test.h
> +++ b/app/test/test.h
> @@ -27,6 +27,10 @@
>
> #include <rte_test.h>
>
> +#ifndef ARRAY_SIZE
> +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
> +#endif
Just one comment about this one: please use RTE_DIM.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v3 1/2] test/dma: update the sg test to verify wrap around case
2024-04-19 9:07 ` [PATCH v2 1/2] test/dma: update the sg test to verify wrap around case Vidya Sagar Velumuri
` (2 preceding siblings ...)
2024-10-04 11:49 ` Amit Prakash Shukla
@ 2025-06-06 9:40 ` 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
3 siblings, 2 replies; 16+ messages in thread
From: Vidya Sagar Velumuri @ 2025-06-06 9:40 UTC (permalink / raw)
To: Chengwen Feng, Kevin Laatz, Bruce Richardson
Cc: gakhil, jerinj, anoobj, vvelumuri, asasidharan, dev,
Amit Prakash Shukla
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>
Acked-by: Amit Prakash Shukla <amitprakashs@marvell.com>
diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
index 9cbb9a6552..88c3d02fd6 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);
+ len = COPY_LEN;
+
+ do {
+ test_enqueue_sg(dev_id, vchan, n_sge, len);
+ loop_count++;
+ } while (loop_count * n_sge * n_sge < TEST_RINGSIZE * 3);
+
+ return 0;
+}
+
/* Failure handling test cases - global macros and variables for those tests*/
#define COMP_BURST_SZ 16
#define OPT_FENCE(idx) ((fence && idx == 8) ? RTE_DMA_OP_FLAG_FENCE : 0)
diff --git a/app/test/test_dmadev_api.c b/app/test/test_dmadev_api.c
index fb49fcb56b..c38c4c1f49 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
+
int test_dma_api(uint16_t dev_id);
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v3 2/2] test/dma: add functions to verify zero and one fill
2025-06-06 9:40 ` [PATCH v3 " Vidya Sagar Velumuri
@ 2025-06-06 9:40 ` 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
1 sibling, 0 replies; 16+ messages in thread
From: Vidya Sagar Velumuri @ 2025-06-06 9:40 UTC (permalink / raw)
To: Chengwen Feng, Kevin Laatz, Bruce Richardson
Cc: gakhil, jerinj, anoobj, vvelumuri, asasidharan, dev,
Amit Prakash Shukla
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..82f8e82783 100644
--- a/app/test/test_dmadev.c
+++ b/app/test/test_dmadev.c
@@ -872,42 +872,52 @@ 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++) {
+ printf("Test fill pattern: 0x%016lx\n", 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);
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 1/2] test/dma: update the sg test to verify wrap around case
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 ` 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:41 ` [PATCH v4 1/2] test/dma: update the sg test to verify wrap around case fengchengwen
1 sibling, 2 replies; 16+ messages in thread
From: Vidya Sagar Velumuri @ 2025-06-09 3:03 UTC (permalink / raw)
To: Chengwen Feng, Kevin Laatz, Bruce Richardson
Cc: gakhil, jerinj, anoobj, vvelumuri, asasidharan, dev,
Amit Prakash Shukla
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>
Acked-by: Amit Prakash Shukla <amitprakashs@marvell.com>
diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
index 9cbb9a6552..88c3d02fd6 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);
+ len = COPY_LEN;
+
+ do {
+ test_enqueue_sg(dev_id, vchan, n_sge, len);
+ loop_count++;
+ } while (loop_count * n_sge * n_sge < TEST_RINGSIZE * 3);
+
+ return 0;
+}
+
/* Failure handling test cases - global macros and variables for those tests*/
#define COMP_BURST_SZ 16
#define OPT_FENCE(idx) ((fence && idx == 8) ? RTE_DMA_OP_FLAG_FENCE : 0)
diff --git a/app/test/test_dmadev_api.c b/app/test/test_dmadev_api.c
index fb49fcb56b..c38c4c1f49 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
+
int test_dma_api(uint16_t dev_id);
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH v4 2/2] test/dma: add functions to verify zero and one fill
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 ` Vidya Sagar Velumuri
2025-06-10 6:48 ` fengchengwen
2025-06-10 6:41 ` [PATCH v4 1/2] test/dma: update the sg test to verify wrap around case fengchengwen
1 sibling, 1 reply; 16+ messages in thread
From: Vidya Sagar Velumuri @ 2025-06-09 3:03 UTC (permalink / raw)
To: Chengwen Feng, Kevin Laatz, Bruce Richardson
Cc: gakhil, jerinj, anoobj, vvelumuri, asasidharan, dev,
Amit Prakash Shukla
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);
--
2.25.1
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v4 1/2] test/dma: update the sg test to verify wrap around case
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:41 ` fengchengwen
1 sibling, 0 replies; 16+ messages in thread
From: fengchengwen @ 2025-06-10 6:41 UTC (permalink / raw)
To: Vidya Sagar Velumuri, Kevin Laatz, Bruce Richardson
Cc: gakhil, jerinj, anoobj, asasidharan, dev, Amit Prakash Shukla
Hi Vidya,
On 2025/6/9 11:03, Vidya Sagar Velumuri 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>
> Acked-by: Amit Prakash Shukla <amitprakashs@marvell.com>
>
> diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
> index 9cbb9a6552..88c3d02fd6 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));
Please keep this line.
> - 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);
> + len = COPY_LEN;
> +
> + do {
> + test_enqueue_sg(dev_id, vchan, n_sge, len);
Need check the function return, return retcode if this function failed.
> + loop_count++;
> + } while (loop_count * n_sge * n_sge < TEST_RINGSIZE * 3);
> +
> + return 0;
> +}
> +
> /* Failure handling test cases - global macros and variables for those tests*/
> #define COMP_BURST_SZ 16
> #define OPT_FENCE(idx) ((fence && idx == 8) ? RTE_DMA_OP_FLAG_FENCE : 0)
> diff --git a/app/test/test_dmadev_api.c b/app/test/test_dmadev_api.c
> index fb49fcb56b..c38c4c1f49 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
No need to public this macro, because test_enqueue_sg already use alloca to hold the dynamic size of sglist.
>
> 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
> +
> int test_dma_api(uint16_t dev_id);
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 2/2] test/dma: add functions to verify zero and one fill
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
2025-11-05 14:53 ` Thomas Monjalon
0 siblings, 1 reply; 16+ messages in thread
From: fengchengwen @ 2025-06-10 6:48 UTC (permalink / raw)
To: Vidya Sagar Velumuri, Kevin Laatz, Bruce Richardson
Cc: gakhil, jerinj, anoobj, asasidharan, dev, Amit Prakash Shukla
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);
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH v4 2/2] test/dma: add functions to verify zero and one fill
2025-06-10 6:48 ` fengchengwen
@ 2025-11-05 14:53 ` Thomas Monjalon
0 siblings, 0 replies; 16+ messages in thread
From: Thomas Monjalon @ 2025-11-05 14:53 UTC (permalink / raw)
To: Vidya Sagar Velumuri, Amit Prakash Shukla
Cc: Kevin Laatz, Bruce Richardson, dev, gakhil, jerinj, anoobj,
asasidharan, dev, fengchengwen
Any news?
10/06/2025 08:48, fengchengwen:
> 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;
> }
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2025-11-05 14:53 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2025-11-05 14:53 ` Thomas Monjalon
2025-06-10 6:41 ` [PATCH v4 1/2] test/dma: update the sg test to verify wrap around case fengchengwen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.