Skip to contentSkip to conversation

add test suite for DMA drivers

RFC PATCH Superseded Bruce Richardson 10 participants 130 messages Aug 26, 2021 – Oct 21, 2021 Page 2 of 2

Subsystems (2)
lore
Share & tools
lore
#124 lore raw

PATCH v7 11/13 app/test: test dmadev instance failure handling

In reply to Bruce Richardson

Add a series of tests to inject bad copy operations into a dmadev to test the error handling and reporting capabilities. Various combinations of errors in various positions in a burst are tested, as are errors in bursts with fence flag set, and multiple errors in a single burst.

---
 app/test/test_dmadev.c | 361 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 361 insertions(+)
app/test/test_dmadev.c +361 -0
index 98b20f75ef..8e61216f04 100644
@@ -278,6 +278,354 @@ test_enqueue_copies(int16_t dev_id, uint16_t vchan)
 			|| do_multi_copies(dev_id, vchan, 0, 0, 1);
 }
 
+/* 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)
+
+static int
+test_failure_in_full_burst(int16_t dev_id, uint16_t vchan, bool fence,
+		struct rte_mbuf **srcs, struct rte_mbuf **dsts, unsigned int fail_idx)
+{
+	/* Test single full batch statuses with failures */
+	enum rte_dma_status_code status[COMP_BURST_SZ];
+	struct rte_dma_stats baseline, stats;
+	uint16_t invalid_addr_id = 0;
+	uint16_t idx;
+	uint16_t count, status_count;
+	unsigned int i;
+	bool error = false;
+	int err_count = 0;
+
+	rte_dma_stats_get(dev_id, vchan, &baseline); /* get a baseline set of stats */
+	for (i = 0; i < COMP_BURST_SZ; i++) {
+		int id = rte_dma_copy(dev_id, vchan,
+				(i == fail_idx ? 0 : (srcs[i]->buf_iova + srcs[i]->data_off)),
+				dsts[i]->buf_iova + dsts[i]->data_off,
+				COPY_LEN, OPT_FENCE(i));
+		if (id < 0)
+			ERR_RETURN("Error with rte_dma_copy for buffer %u\n", i);
+		if (i == fail_idx)
+			invalid_addr_id = id;
+	}
+	rte_dma_submit(dev_id, vchan);
+	rte_dma_stats_get(dev_id, vchan, &stats);
+	if (stats.submitted != baseline.submitted + COMP_BURST_SZ)
+		ERR_RETURN("Submitted stats value not as expected, %"PRIu64" not %"PRIu64"\n",
+				stats.submitted, baseline.submitted + COMP_BURST_SZ);
+
+	await_hw(dev_id, vchan);
+
+	count = rte_dma_completed(dev_id, vchan, COMP_BURST_SZ, &idx, &error);
+	if (count != fail_idx)
+		ERR_RETURN("Error with rte_dma_completed for failure test. Got returned %u not %u.\n",
+				count, fail_idx);
+	if (!error)
+		ERR_RETURN("Error, missing expected failed copy, %u. has_error is not set\n",
+				fail_idx);
+	if (idx != invalid_addr_id - 1)
+		ERR_RETURN("Error, missing expected failed copy, %u. Got last idx %u, not %u\n",
+				fail_idx, idx, invalid_addr_id - 1);
+
+	/* all checks ok, now verify calling completed() again always returns 0 */
+	for (i = 0; i < 10; i++)
+		if (rte_dma_completed(dev_id, vchan, COMP_BURST_SZ, &idx, &error) != 0
+				|| error == false || idx != (invalid_addr_id - 1))
+			ERR_RETURN("Error with follow-up completed calls for fail idx %u\n",
+					fail_idx);
+
+	status_count = rte_dma_completed_status(dev_id, vchan, COMP_BURST_SZ,
+			&idx, status);
+	/* some HW may stop on error and be restarted after getting error status for single value
+	 * To handle this case, if we get just one error back, wait for more completions and get
+	 * status for rest of the burst
+	 */
+	if (status_count == 1) {
+		await_hw(dev_id, vchan);
+		status_count += rte_dma_completed_status(dev_id, vchan, COMP_BURST_SZ - 1,
+					&idx, &status[1]);
+	}
+	/* check that at this point we have all status values */
+	if (status_count != COMP_BURST_SZ - count)
+		ERR_RETURN("Error with completed_status calls for fail idx %u. Got %u not %u\n",
+				fail_idx, status_count, COMP_BURST_SZ - count);
+	/* now verify just one failure followed by multiple successful or skipped entries */
+	if (status[0] == RTE_DMA_STATUS_SUCCESSFUL)
+		ERR_RETURN("Error with status returned for fail idx %u. First status was not failure\n",
+				fail_idx);
+	for (i = 1; i < status_count; i++)
+		/* after a failure in a burst, depending on ordering/fencing,
+		 * operations may be successful or skipped because of previous error.
+		 */
+		if (status[i] != RTE_DMA_STATUS_SUCCESSFUL
+				&& status[i] != RTE_DMA_STATUS_NOT_ATTEMPTED)
+			ERR_RETURN("Error with status calls for fail idx %u. Status for job %u (of %u) is not successful\n",
+					fail_idx, count + i, COMP_BURST_SZ);
+
+	/* check the completed + errors stats are as expected */
+	rte_dma_stats_get(dev_id, vchan, &stats);
+	if (stats.completed != baseline.completed + COMP_BURST_SZ)
+		ERR_RETURN("Completed stats value not as expected, %"PRIu64" not %"PRIu64"\n",
+				stats.completed, baseline.completed + COMP_BURST_SZ);
+	for (i = 0; i < status_count; i++)
+		err_count += (status[i] != RTE_DMA_STATUS_SUCCESSFUL);
+	if (stats.errors != baseline.errors + err_count)
+		ERR_RETURN("'Errors' stats value not as expected, %"PRIu64" not %"PRIu64"\n",
+				stats.errors, baseline.errors + err_count);
+
+	return 0;
+}
+
+static int
+test_individual_status_query_with_failure(int16_t dev_id, uint16_t vchan, bool fence,
+		struct rte_mbuf **srcs, struct rte_mbuf **dsts, unsigned int fail_idx)
+{
+	/* Test gathering batch statuses one at a time */
+	enum rte_dma_status_code status[COMP_BURST_SZ];
+	uint16_t invalid_addr_id = 0;
+	uint16_t idx;
+	uint16_t count = 0, status_count = 0;
+	unsigned int j;
+	bool error = false;
+
+	for (j = 0; j < COMP_BURST_SZ; j++) {
+		int id = rte_dma_copy(dev_id, vchan,
+				(j == fail_idx ? 0 : (srcs[j]->buf_iova + srcs[j]->data_off)),
+				dsts[j]->buf_iova + dsts[j]->data_off,
+				COPY_LEN, OPT_FENCE(j));
+		if (id < 0)
+			ERR_RETURN("Error with rte_dma_copy for buffer %u\n", j);
+		if (j == fail_idx)
+			invalid_addr_id = id;
+	}
+	rte_dma_submit(dev_id, vchan);
+	await_hw(dev_id, vchan);
+
+	/* use regular "completed" until we hit error */
+	while (!error) {
+		uint16_t n = rte_dma_completed(dev_id, vchan, 1, &idx, &error);
+		count += n;
+		if (n > 1 || count >= COMP_BURST_SZ)
+			ERR_RETURN("Error - too many completions got\n");
+		if (n == 0 && !error)
+			ERR_RETURN("Error, unexpectedly got zero completions after %u completed\n",
+					count);
+	}
+	if (idx != invalid_addr_id - 1)
+		ERR_RETURN("Error, last successful index not as expected, got %u, expected %u\n",
+				idx, invalid_addr_id - 1);
+
+	/* use completed_status until we hit end of burst */
+	while (count + status_count < COMP_BURST_SZ) {
+		uint16_t n = rte_dma_completed_status(dev_id, vchan, 1, &idx,
+				&status[status_count]);
+		await_hw(dev_id, vchan); /* allow delay to ensure jobs are completed */
+		status_count += n;
+		if (n != 1)
+			ERR_RETURN("Error: unexpected number of completions received, %u, not 1\n",
+					n);
+	}
+
+	/* check for single failure */
+	if (status[0] == RTE_DMA_STATUS_SUCCESSFUL)
+		ERR_RETURN("Error, unexpected successful DMA transaction\n");
+	for (j = 1; j < status_count; j++)
+		if (status[j] != RTE_DMA_STATUS_SUCCESSFUL
+				&& status[j] != RTE_DMA_STATUS_NOT_ATTEMPTED)
+			ERR_RETURN("Error, unexpected DMA error reported\n");
+
+	return 0;
+}
+
+static int
+test_single_item_status_query_with_failure(int16_t dev_id, uint16_t vchan,
+		struct rte_mbuf **srcs, struct rte_mbuf **dsts, unsigned int fail_idx)
+{
+	/* When error occurs just collect a single error using "completed_status()"
+	 * before going to back to completed() calls
+	 */
+	enum rte_dma_status_code status;
+	uint16_t invalid_addr_id = 0;
+	uint16_t idx;
+	uint16_t count, status_count, count2;
+	unsigned int j;
+	bool error = false;
+
+	for (j = 0; j < COMP_BURST_SZ; j++) {
+		int id = rte_dma_copy(dev_id, vchan,
+				(j == fail_idx ? 0 : (srcs[j]->buf_iova + srcs[j]->data_off)),
+				dsts[j]->buf_iova + dsts[j]->data_off,
+				COPY_LEN, 0);
+		if (id < 0)
+			ERR_RETURN("Error with rte_dma_copy for buffer %u\n", j);
+		if (j == fail_idx)
+			invalid_addr_id = id;
+	}
+	rte_dma_submit(dev_id, vchan);
+	await_hw(dev_id, vchan);
+
+	/* get up to the error point */
+	count = rte_dma_completed(dev_id, vchan, COMP_BURST_SZ, &idx, &error);
+	if (count != fail_idx)
+		ERR_RETURN("Error with rte_dma_completed for failure test. Got returned %u not %u.\n",
+				count, fail_idx);
+	if (!error)
+		ERR_RETURN("Error, missing expected failed copy, %u. has_error is not set\n",
+				fail_idx);
+	if (idx != invalid_addr_id - 1)
+		ERR_RETURN("Error, missing expected failed copy, %u. Got last idx %u, not %u\n",
+				fail_idx, idx, invalid_addr_id - 1);
+
+	/* get the error code */
+	status_count = rte_dma_completed_status(dev_id, vchan, 1, &idx, &status);
+	if (status_count != 1)
+		ERR_RETURN("Error with completed_status calls for fail idx %u. Got %u not %u\n",
+				fail_idx, status_count, COMP_BURST_SZ - count);
+	if (status == RTE_DMA_STATUS_SUCCESSFUL)
+		ERR_RETURN("Error with status returned for fail idx %u. First status was not failure\n",
+				fail_idx);
+
+	/* delay in case time needed after err handled to complete other jobs */
+	await_hw(dev_id, vchan);
+
+	/* get the rest of the completions without status */
+	count2 = rte_dma_completed(dev_id, vchan, COMP_BURST_SZ, &idx, &error);
+	if (error == true)
+		ERR_RETURN("Error, got further errors post completed_status() call, for failure case %u.\n",
+				fail_idx);
+	if (count + status_count + count2 != COMP_BURST_SZ)
+		ERR_RETURN("Error, incorrect number of completions received, got %u not %u\n",
+				count + status_count + count2, COMP_BURST_SZ);
+
+	return 0;
+}
+
+static int
+test_multi_failure(int16_t dev_id, uint16_t vchan, struct rte_mbuf **srcs, struct rte_mbuf **dsts,
+		const unsigned int *fail, size_t num_fail)
+{
+	/* test having multiple errors in one go */
+	enum rte_dma_status_code status[COMP_BURST_SZ];
+	unsigned int i, j;
+	uint16_t count, err_count = 0;
+	bool error = false;
+
+	/* enqueue and gather completions in one go */
+	for (j = 0; j < COMP_BURST_SZ; j++) {
+		uintptr_t src = srcs[j]->buf_iova + srcs[j]->data_off;
+		/* set up for failure if the current index is anywhere is the fails array */
+		for (i = 0; i < num_fail; i++)
+			if (j == fail[i])
+				src = 0;
+
+		int id = rte_dma_copy(dev_id, vchan,
+				src, dsts[j]->buf_iova + dsts[j]->data_off,
+				COPY_LEN, 0);
+		if (id < 0)
+			ERR_RETURN("Error with rte_dma_copy for buffer %u\n", j);
+	}
+	rte_dma_submit(dev_id, vchan);
+	await_hw(dev_id, vchan);
+
+	count = rte_dma_completed_status(dev_id, vchan, COMP_BURST_SZ, NULL, status);
+	while (count < COMP_BURST_SZ) {
+		await_hw(dev_id, vchan);
+
+		uint16_t ret = rte_dma_completed_status(dev_id, vchan, COMP_BURST_SZ - count,
+				NULL, &status[count]);
+		if (ret == 0)
+			ERR_RETURN("Error getting all completions for jobs. Got %u of %u\n",
+					count, COMP_BURST_SZ);
+		count += ret;
+	}
+	for (i = 0; i < count; i++)
+		if (status[i] != RTE_DMA_STATUS_SUCCESSFUL)
+			err_count++;
+
+	if (err_count != num_fail)
+		ERR_RETURN("Error: Invalid number of failed completions returned, %u; expected %zu\n",
+			err_count, num_fail);
+
+	/* enqueue and gather completions in bursts, but getting errors one at a time */
+	for (j = 0; j < COMP_BURST_SZ; j++) {
+		uintptr_t src = srcs[j]->buf_iova + srcs[j]->data_off;
+		/* set up for failure if the current index is anywhere is the fails array */
+		for (i = 0; i < num_fail; i++)
+			if (j == fail[i])
+				src = 0;
+
+		int id = rte_dma_copy(dev_id, vchan,
+				src, dsts[j]->buf_iova + dsts[j]->data_off,
+				COPY_LEN, 0);
+		if (id < 0)
+			ERR_RETURN("Error with rte_dma_copy for buffer %u\n", j);
+	}
+	rte_dma_submit(dev_id, vchan);
+	await_hw(dev_id, vchan);
+
+	count = 0;
+	err_count = 0;
+	while (count + err_count < COMP_BURST_SZ) {
+		count += rte_dma_completed(dev_id, vchan, COMP_BURST_SZ, NULL, &error);
+		if (error) {
+			uint16_t ret = rte_dma_completed_status(dev_id, vchan, 1,
+					NULL, status);
+			if (ret != 1)
+				ERR_RETURN("Error getting error-status for completions\n");
+			err_count += ret;
+			await_hw(dev_id, vchan);
+		}
+	}
+	if (err_count != num_fail)
+		ERR_RETURN("Error: Incorrect number of failed completions received, got %u not %zu\n",
+				err_count, num_fail);
+
+	return 0;
+}
+
+static int
+test_completion_status(int16_t dev_id, uint16_t vchan, bool fence)
+{
+	const unsigned int fail[] = {0, 7, 14, 15};
+	struct rte_mbuf *srcs[COMP_BURST_SZ], *dsts[COMP_BURST_SZ];
+	unsigned int i;
+
+	for (i = 0; i < COMP_BURST_SZ; i++) {
+		srcs[i] = rte_pktmbuf_alloc(pool);
+		dsts[i] = rte_pktmbuf_alloc(pool);
+	}
+
+	for (i = 0; i < RTE_DIM(fail); i++) {
+		if (test_failure_in_full_burst(dev_id, vchan, fence, srcs, dsts, fail[i]) < 0)
+			return -1;
+
+		if (test_individual_status_query_with_failure(dev_id, vchan, fence,
+				srcs, dsts, fail[i]) < 0)
+			return -1;
+
+		/* test is run the same fenced, or unfenced, but no harm in running it twice */
+		if (test_single_item_status_query_with_failure(dev_id, vchan,
+				srcs, dsts, fail[i]) < 0)
+			return -1;
+	}
+
+	if (test_multi_failure(dev_id, vchan, srcs, dsts, fail, RTE_DIM(fail)) < 0)
+		return -1;
+
+	for (i = 0; i < COMP_BURST_SZ; i++) {
+		rte_pktmbuf_free(srcs[i]);
+		rte_pktmbuf_free(dsts[i]);
+	}
+	return 0;
+}
+
+static int
+test_completion_handling(int16_t dev_id, uint16_t vchan)
+{
+	return test_completion_status(dev_id, vchan, false)              /* without fences */
+			|| test_completion_status(dev_id, vchan, true);  /* with fences */
+
+}
+
 static int
 test_dmadev_instance(int16_t dev_id)
 {
@@ -335,6 +683,19 @@ test_dmadev_instance(int16_t dev_id)
 	if (runtest("copy", test_enqueue_copies, 640, dev_id, vchan, CHECK_ERRS) < 0)
 		goto err;
 
+	/* to test error handling we can provide null pointers for source or dest in copies. This
+	 * requires VA mode in DPDK, since NULL(0) is a valid physical address.
+	 * We also need hardware that can report errors back.
+	 */
+	if (rte_eal_iova_mode() != RTE_IOVA_VA)
+		printf("DMA Dev %u: DPDK not in VA mode, skipping error handling tests\n", dev_id);
+	else if ((info.dev_capa & RTE_DMA_CAPA_HANDLES_ERRORS) == 0)
+		printf("DMA Dev %u: device does not report errors, skipping error handling tests\n",
+				dev_id);
+	else if (runtest("error handling", test_completion_handling, 1,
+			dev_id, vchan, !CHECK_ERRS) < 0)
+		goto err;
+
 	rte_mempool_free(pool);
 	rte_dma_stop(dev_id);
 	rte_dma_stats_reset(dev_id, vchan);
Signature · 1 line
2.30.2
#125 lore raw

PATCH v7 12/13 app/test: add dmadev fill tests

In reply to Bruce Richardson

From: Kevin Laatz <[email protected]>

For dma devices which support the fill operation, run unit tests to verify fill behaviour is correct.

---
 app/test/test_dmadev.c | 49 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
app/test/test_dmadev.c +49 -0
index 8e61216f04..27d2e7a5c4 100644
@@ -623,7 +623,51 @@ test_completion_handling(int16_t dev_id, uint16_t vchan)
 {
 	return test_completion_status(dev_id, vchan, false)              /* without fences */
 			|| test_completion_status(dev_id, vchan, true);  /* with fences */
+}
+
+static int
+test_enqueue_fill(int16_t dev_id, uint16_t vchan)
+{
+	const unsigned int lengths[] = {8, 64, 1024, 50, 100, 89};
+	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));
+
+		/* 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)[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);
+		}
+		/* 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);
+	return 0;
 }
 
 static int
@@ -696,6 +740,11 @@ test_dmadev_instance(int16_t dev_id)
 			dev_id, vchan, !CHECK_ERRS) < 0)
 		goto err;
 
+	if ((info.dev_capa & RTE_DMA_CAPA_OPS_FILL) == 0)
+		printf("DMA Dev %u: No device fill support, skipping fill tests\n", dev_id);
+	else if (runtest("fill", test_enqueue_fill, 1, dev_id, vchan, CHECK_ERRS) < 0)
+		goto err;
+
 	rte_mempool_free(pool);
 	rte_dma_stop(dev_id);
 	rte_dma_stats_reset(dev_id, vchan);
Signature · 1 line
2.30.2
#126 lore raw

PATCH v7 13/13 app/test: add dmadev burst capacity API test

In reply to Bruce Richardson

From: Kevin Laatz <[email protected]>

Add a test case to validate the functionality of drivers' burst capacity API implementations.

---
 app/test/test_dmadev.c | 67 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)
app/test/test_dmadev.c +67 -0
index 27d2e7a5c4..1e327bd45f 100644
@@ -670,6 +670,69 @@ test_enqueue_fill(int16_t dev_id, uint16_t vchan)
 	return 0;
 }
 
+static int
+test_burst_capacity(int16_t dev_id, uint16_t vchan)
+{
+#define CAP_TEST_BURST_SIZE	64
+	const int ring_space = rte_dma_burst_capacity(dev_id, vchan);
+	struct rte_mbuf *src, *dst;
+	int i, j, iter;
+	int cap, ret;
+	bool dma_err;
+
+	src = rte_pktmbuf_alloc(pool);
+	dst = rte_pktmbuf_alloc(pool);
+
+	/* to test capacity, we enqueue elements and check capacity is reduced
+	 * by one each time - rebaselining the expected value after each burst
+	 * as the capacity is only for a burst. We enqueue multiple bursts to
+	 * fill up half the ring, before emptying it again. We do this twice to
+	 * ensure that we get to test scenarios where we get ring wrap-around
+	 */
+	for (iter = 0; iter < 2; iter++) {
+		for (i = 0; i < (ring_space / (2 * CAP_TEST_BURST_SIZE)) + 1; i++) {
+			cap = rte_dma_burst_capacity(dev_id, vchan);
+
+			for (j = 0; j < CAP_TEST_BURST_SIZE; j++) {
+				ret = rte_dma_copy(dev_id, vchan, rte_pktmbuf_iova(src),
+						rte_pktmbuf_iova(dst), COPY_LEN, 0);
+				if (ret < 0)
+					ERR_RETURN("Error with rte_dmadev_copy\n");
+
+				if (rte_dma_burst_capacity(dev_id, vchan) != cap - (j + 1))
+					ERR_RETURN("Error, ring capacity did not change as expected\n");
+			}
+			if (rte_dma_submit(dev_id, vchan) < 0)
+				ERR_RETURN("Error, failed to submit burst\n");
+
+			if (cap < rte_dma_burst_capacity(dev_id, vchan))
+				ERR_RETURN("Error, avail ring capacity has gone up, not down\n");
+		}
+		await_hw(dev_id, vchan);
+
+		for (i = 0; i < (ring_space / (2 * CAP_TEST_BURST_SIZE)) + 1; i++) {
+			ret = rte_dma_completed(dev_id, vchan,
+					CAP_TEST_BURST_SIZE, NULL, &dma_err);
+			if (ret != CAP_TEST_BURST_SIZE || dma_err) {
+				enum rte_dma_status_code status;
+
+				rte_dma_completed_status(dev_id, vchan, 1, NULL, &status);
+				ERR_RETURN("Error with rte_dmadev_completed, %u [expected: %u], dma_err = %d, i = %u, iter = %u, status = %u\n",
+						ret, CAP_TEST_BURST_SIZE, dma_err, i, iter, status);
+			}
+		}
+		cap = rte_dma_burst_capacity(dev_id, vchan);
+		if (cap != ring_space)
+			ERR_RETURN("Error, ring capacity has not reset to original value, got %u, expected %u\n",
+					cap, ring_space);
+	}
+
+	rte_pktmbuf_free(src);
+	rte_pktmbuf_free(dst);
+
+	return 0;
+}
+
 static int
 test_dmadev_instance(int16_t dev_id)
 {
@@ -727,6 +790,10 @@ test_dmadev_instance(int16_t dev_id)
 	if (runtest("copy", test_enqueue_copies, 640, dev_id, vchan, CHECK_ERRS) < 0)
 		goto err;
 
+	/* run some burst capacity tests */
+	if (runtest("burst capacity", test_burst_capacity, 1, dev_id, vchan, CHECK_ERRS) < 0)
+		goto err;
+
 	/* to test error handling we can provide null pointers for source or dest in copies. This
 	 * requires VA mode in DPDK, since NULL(0) is a valid physical address.
 	 * We also need hardware that can report errors back.
Signature · 1 line
2.30.2
#127 lore raw
In reply to Bruce Richardson

13/10/2021 17:17, Bruce Richardson:

Quoted 12 lines

Bruce Richardson (10):
dmadev: add channel status check for testing use dma/skeleton: add channel status function dma/skeleton: add burst capacity function
dmadev: add device iterator
app/test: add basic dmadev instance tests app/test: add basic dmadev copy tests app/test: run test suite on skeleton driver app/test: add more comprehensive dmadev copy tests
dmadev: add flag for error handling support app/test: test dmadev instance failure handling

Quoted 4 lines

Kevin Laatz (3):
dmadev: add burst capacity API
app/test: add dmadev fill tests
app/test: add dmadev burst capacity API test

Applied, thanks.

#128 lore raw

Hi Bruce,

I observed a large number of checkpatch errors [1] when synchronizing to our inner CI, almost all of them are over 80 lines, and many are not LONG LOG.

The DPDK coding style recommends to be not more than 80 characters unless rarest situations (which LONG LOG belongs to this one I think).

I don't know which to follow: just ignore or should fix it ?

[1]:
lib/dmadev/rte_dmadev.c:56: WARNING:LONG_LINE: line length of 95 exceeds 80 columns lib/dmadev/rte_dmadev.c:696: WARNING:LONG_LINE: line length of 87 exceeds 80 columns lib/dmadev/rte_dmadev.c:704: WARNING:LONG_LINE: line length of 85 exceeds 80 columns lib/dmadev/rte_dmadev.h:267: WARNING:LONG_LINE_COMMENT: line length of 84 exceeds 80 columns lib/dmadev/rte_dmadev.h:269: WARNING:LONG_LINE_COMMENT: line length of 84 exceeds 80 columns lib/dmadev/rte_dmadev.h:677: WARNING:LONG_LINE_COMMENT: line length of 91 exceeds 80 columns lib/dmadev/rte_dmadev.h:683: WARNING:LONG_LINE_COMMENT: line length of 95 exceeds 80 columns lib/dmadev/rte_dmadev.h:691: WARNING:LONG_LINE_COMMENT: line length of 90 exceeds 80 columns lib/dmadev/rte_dmadev.h:692: WARNING:LONG_LINE_COMMENT: line length of 82 exceeds 80 columns lib/dmadev/rte_dmadev.h:706: WARNING:LONG_LINE: line length of 88 exceeds 80 columns lib/dmadev/rte_dmadev_core.h:51: WARNING:LONG_LINE: line length of 86 exceeds 80 columns lib/dmadev/rte_dmadev_pmd.h:58: WARNING:LONG_LINE: line length of 84 exceeds 80 columns
total: 1 errors, 12 warnings, 235 lines checked

app/test/test_dmadev.c:19: WARNING:LONG_LINE: line length of 95 exceeds 80 columns app/test/test_dmadev.c:19: WARNING:MACRO_WITH_FLOW_CONTROL: Macros with flow control statements should be avoided app/test/test_dmadev.c:39: WARNING:LONG_LINE: line length of 94 exceeds 80 columns app/test/test_dmadev.c:72: WARNING:LONG_LINE_COMMENT: line length of 90 exceeds 80 columns app/test/test_dmadev.c:77: WARNING:LONG_LINE_COMMENT: line length of 96 exceeds 80 columns app/test/test_dmadev.c:79: WARNING:LONG_LINE: line length of 83 exceeds 80 columns app/test/test_dmadev.c:85: WARNING:LONG_LINE_COMMENT: line length of 95 exceeds 80 columns app/test/test_dmadev.c:90: WARNING:LONG_LINE_COMMENT: line length of 90 exceeds 80 columns app/test/test_dmadev.c:113: WARNING:LONG_LINE: line length of 86 exceeds 80 columns app/test/test_dmadev.c:114: WARNING:LONG_LINE: line length of 98 exceeds 80 columns app/test/test_dmadev.c:115: WARNING:LONG_LINE: line length of 81 exceeds 80 columns app/test/test_dmadev.c:124: WARNING:LONG_LINE: line length of 85 exceeds 80 columns app/test/test_dmadev.c:129: WARNING:LONG_LINE: line length of 81 exceeds 80 columns app/test/test_dmadev.c:138: WARNING:LONG_LINE: line length of 96 exceeds 80 columns app/test/test_dmadev.c:143: WARNING:LONG_LINE: line length of 97 exceeds 80 columns app/test/test_dmadev.c:157: WARNING:LONG_LINE: line length of 90 exceeds 80 columns app/test/test_dmadev.c:158: WARNING:LONG_LINE: line length of 88 exceeds 80 columns app/test/test_dmadev.c:169: WARNING:LONG_LINE: line length of 92 exceeds 80 columns app/test/test_dmadev.c:196: WARNING:LONG_LINE: line length of 94 exceeds 80 columns app/test/test_dmadev.c:207: WARNING:LONG_LINE: line length of 95 exceeds 80 columns app/test/test_dmadev.c:249: WARNING:LONG_LINE: line length of 88 exceeds 80 columns app/test/test_dmadev.c:254: WARNING:LONG_LINE: line length of 81 exceeds 80 columns app/test/test_dmadev.c:272: WARNING:LONG_LINE_COMMENT: line length of 99 exceeds 80 columns app/test/test_dmadev.c:277: WARNING:LONG_LINE_COMMENT: line length of 91 exceeds 80 columns app/test/test_dmadev.c:287: WARNING:LONG_LINE: line length of 86 exceeds 80 columns app/test/test_dmadev.c:299: WARNING:LONG_LINE_COMMENT: line length of 86 exceeds 80 columns app/test/test_dmadev.c:302: WARNING:LONG_LINE: line length of 94 exceeds 80 columns app/test/test_dmadev.c:306: WARNING:LONG_LINE: line length of 81 exceeds 80 columns app/test/test_dmadev.c:313: WARNING:LONG_LINE: line length of 94 exceeds 80 columns app/test/test_dmadev.c:314: WARNING:LONG_LINE: line length of 85 exceeds 80 columns app/test/test_dmadev.c:329: WARNING:LONG_LINE_COMMENT: line length of 82 exceeds 80 columns app/test/test_dmadev.c:331: WARNING:LONG_LINE: line length of 86 exceeds 80 columns app/test/test_dmadev.c:332: WARNING:LONG_LINE: line length of 82 exceeds 80 columns app/test/test_dmadev.c:338: WARNING:LONG_LINE_COMMENT: line length of 97 exceeds 80 columns app/test/test_dmadev.c:339: WARNING:LONG_LINE_COMMENT: line length of 96 exceeds 80 columns app/test/test_dmadev.c:344: WARNING:LONG_LINE: line length of 90 exceeds 80 columns app/test/test_dmadev.c:351: WARNING:LONG_LINE_COMMENT: line length of 92 exceeds 80 columns app/test/test_dmadev.c:357: WARNING:LONG_LINE_COMMENT: line length of 85 exceeds 80 columns app/test/test_dmadev.c:367: WARNING:LONG_LINE: line length of 94 exceeds 80 columns app/test/test_dmadev.c:368: WARNING:LONG_LINE: line length of 85 exceeds 80 columns app/test/test_dmadev.c:372: WARNING:LONG_LINE: line length of 93 exceeds 80 columns app/test/test_dmadev.c:379: WARNING:LONG_LINE: line length of 85 exceeds 80 columns app/test/test_dmadev.c:380: WARNING:LONG_LINE: line length of 86 exceeds 80 columns app/test/test_dmadev.c:392: WARNING:LONG_LINE: line length of 94 exceeds 80 columns app/test/test_dmadev.c:396: WARNING:LONG_LINE: line length of 81 exceeds 80 columns app/test/test_dmadev.c:421: WARNING:LONG_LINE_COMMENT: line length of 87 exceeds 80 columns app/test/test_dmadev.c:441: WARNING:LONG_LINE: line length of 86 exceeds 80 columns app/test/test_dmadev.c:443: WARNING:LONG_LINE_COMMENT: line length of 83 exceeds 80 columns app/test/test_dmadev.c:455: WARNING:LONG_LINE: line length of 94 exceeds 80 columns app/test/test_dmadev.c:459: WARNING:LONG_LINE: line length of 81 exceeds 80 columns app/test/test_dmadev.c:479: WARNING:LONG_LINE: line length of 81 exceeds 80 columns app/test/test_dmadev.c:503: WARNING:LONG_LINE: line length of 98 exceeds 80 columns app/test/test_dmadev.c:515: WARNING:LONG_LINE_COMMENT: line length of 92 exceeds 80 columns app/test/test_dmadev.c:524: WARNING:LONG_LINE: line length of 81 exceeds 80 columns app/test/test_dmadev.c:529: WARNING:LONG_LINE: line length of 85 exceeds 80 columns app/test/test_dmadev.c:533: WARNING:LONG_LINE: line length of 93 exceeds 80 columns app/test/test_dmadev.c:548: WARNING:LONG_LINE_COMMENT: line length of 88 exceeds 80 columns app/test/test_dmadev.c:551: WARNING:LONG_LINE_COMMENT: line length of 92 exceeds 80 columns app/test/test_dmadev.c:560: WARNING:LONG_LINE: line length of 81 exceeds 80 columns app/test/test_dmadev.c:568: WARNING:LONG_LINE: line length of 87 exceeds 80 columns app/test/test_dmadev.c:570: WARNING:LONG_LINE: line length of 81 exceeds 80 columns app/test/test_dmadev.c:598: WARNING:LONG_LINE: line length of 94 exceeds 80 columns app/test/test_dmadev.c:601: WARNING:LONG_LINE: line length of 83 exceeds 80 columns app/test/test_dmadev.c:605: WARNING:LONG_LINE_COMMENT: line length of 95 exceeds 80 columns app/test/test_dmadev.c:611: WARNING:LONG_LINE: line length of 83 exceeds 80 columns app/test/test_dmadev.c:624: WARNING:LONG_LINE_COMMENT: line length of 93 exceeds 80 columns app/test/test_dmadev.c:625: WARNING:LONG_LINE_COMMENT: line length of 90 exceeds 80 columns app/test/test_dmadev.c:648: WARNING:LONG_LINE: line length of 91 exceeds 80 columns app/test/test_dmadev.c:654: WARNING:LONG_LINE: line length of 94 exceeds 80 columns app/test/test_dmadev.c:660: WARNING:LONG_LINE: line length of 83 exceeds 80 columns app/test/test_dmadev.c:662: WARNING:LONG_LINE_COMMENT: line length of 85 exceeds 80 columns app/test/test_dmadev.c:693: WARNING:LONG_LINE: line length of 84 exceeds 80 columns app/test/test_dmadev.c:697: WARNING:LONG_LINE: line length of 88 exceeds 80 columns app/test/test_dmadev.c:698: WARNING:LONG_LINE: line length of 84 exceeds 80 columns app/test/test_dmadev.c:702: WARNING:LONG_LINE: line length of 91 exceeds 80 columns app/test/test_dmadev.c:713: WARNING:LONG_LINE: line length of 84 exceeds 80 columns app/test/test_dmadev.c:719: WARNING:LONG_LINE: line length of 90 exceeds 80 columns app/test/test_dmadev.c:721: WARNING:LONG_LINE: line length of 100 exceeds 80 columns app/test/test_dmadev.c:755: WARNING:LONG_LINE: line length of 85 exceeds 80 columns app/test/test_dmadev.c:765: WARNING:LONG_LINE: line length of 93 exceeds 80 columns app/test/test_dmadev.c:774: WARNING:LONG_LINE: line length of 89 exceeds 80 columns app/test/test_dmadev.c:789: WARNING:LONG_LINE_COMMENT: line length of 88 exceeds 80 columns app/test/test_dmadev.c:790: WARNING:LONG_LINE: line length of 85 exceeds 80 columns app/test/test_dmadev.c:794: WARNING:LONG_LINE: line length of 93 exceeds 80 columns app/test/test_dmadev.c:797: WARNING:LONG_LINE_COMMENT: line length of 97 exceeds 80 columns app/test/test_dmadev.c:802: WARNING:LONG_LINE: line length of 99 exceeds 80 columns app/test/test_dmadev.c:811: WARNING:LONG_LINE: line length of 92 exceeds 80 columns app/test/test_dmadev.c:812: WARNING:LONG_LINE: line length of 86 exceeds 80 columns app/test/test_dmadev.c:833: WARNING:LONG_LINE_COMMENT: line length of 98 exceeds 80 columns
total: 0 errors, 89 warnings, 861 lines checked

Quoted 25 lines · Thomas Monjalon

13/10/2021 17:17, Bruce Richardson:

Quoted 12 lines

Bruce Richardson (10):
dmadev: add channel status check for testing use dma/skeleton: add channel status function dma/skeleton: add burst capacity function
dmadev: add device iterator
app/test: add basic dmadev instance tests app/test: add basic dmadev copy tests app/test: run test suite on skeleton driver app/test: add more comprehensive dmadev copy tests
dmadev: add flag for error handling support app/test: test dmadev instance failure handling

Quoted 4 lines

Kevin Laatz (3):
dmadev: add burst capacity API
app/test: add dmadev fill tests
app/test: add dmadev burst capacity API test

Applied, thanks.

.

#129 lore raw
Quoted 9 lines · fengchengwen

Hi Bruce,

I observed a large number of checkpatch errors [1] when synchronizing to our inner CI, almost all of them are over 80 lines, and many are not LONG LOG.

The DPDK coding style recommends to be not more than 80 characters unless rarest situations (which LONG LOG belongs to this one I think).

I don't know which to follow: just ignore or should fix it ?

I'd rather not change these as the code is more readable unwrapped. Although the docs do indeed recommend 80 characters, in practice we allow up to 100 characters and the CI's run using that limit for checkpatch. I've actually submitted a patchset to try and update our doc and usertools to match the in-practice policy.

/Bruce

[1] http://patches.dpdk.org/project/dpdk/patch/[email protected]/