[2/3] test/dma: reset last-idx before invoke DMA completed ops

Message ID 20220608085007.10679-3-fengchengwen@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series bugfix and feature for skeleton DMA |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

fengchengwen June 8, 2022, 8:50 a.m. UTC
  Some DMA PMD may not update last-idx when no DMA completed, the
previous patch [1] cannot detect this problem actually.

This patch resets last-idx before invoking DMA completed ops to fix it.

[1] test/dma: check index when no DMA completed

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
 app/test/test_dmadev.c | 3 +++
 1 file changed, 3 insertions(+)
  

Patch

diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
index a7651a486f..9e8e101f40 100644
--- a/app/test/test_dmadev.c
+++ b/app/test/test_dmadev.c
@@ -209,6 +209,7 @@  test_enqueue_copies(int16_t dev_id, uint16_t vchan)
 						dst_data[i], src_data[i]);
 
 		/* now check completion works */
+		id = ~id;
 		if (rte_dma_completed(dev_id, vchan, 1, &id, NULL) != 1)
 			ERR_RETURN("Error with rte_dma_completed\n");
 
@@ -217,6 +218,7 @@  test_enqueue_copies(int16_t dev_id, uint16_t vchan)
 					id, id_count);
 
 		/* check for completed and id when no job done */
+		id = ~id;
 		if (rte_dma_completed(dev_id, vchan, 1, &id, NULL) != 0)
 			ERR_RETURN("Error with rte_dma_completed when no job done\n");
 		if (id != id_count)
@@ -224,6 +226,7 @@  test_enqueue_copies(int16_t dev_id, uint16_t vchan)
 					id, id_count);
 
 		/* check for completed_status and id when no job done */
+		id = ~id;
 		if (rte_dma_completed_status(dev_id, vchan, 1, &id, &status) != 0)
 			ERR_RETURN("Error with rte_dma_completed_status when no job done\n");
 		if (id != id_count)