]> git.droids-corp.org - dpdk.git/commitdiff
test/dma: check index when no DMA completed
authorChengwen Feng <fengchengwen@huawei.com>
Fri, 27 May 2022 03:40:53 +0000 (11:40 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 7 Jun 2022 10:38:13 +0000 (12:38 +0200)
If no DMA request is completed, the ring_idx of the last completed
operation need returned by last_idx parameter. This patch adds
testcase for it.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Tested-by: Kevin Laatz <kevin.laatz@intel.com>
app/test/test_dmadev.c

index 2b097e0f47571b41a5ae9338faaf247f36f9e99e..a7651a486f4adcabdef6cee1ab66b8094fd7eafb 100644 (file)
@@ -177,6 +177,7 @@ do_multi_copies(int16_t dev_id, uint16_t vchan,
 static int
 test_enqueue_copies(int16_t dev_id, uint16_t vchan)
 {
+       enum rte_dma_status_code status;
        unsigned int i;
        uint16_t id;
 
@@ -215,6 +216,20 @@ test_enqueue_copies(int16_t dev_id, uint16_t vchan)
                        ERR_RETURN("Error:incorrect job id received, %u [expected %u]\n",
                                        id, id_count);
 
+               /* check for completed and id when no job done */
+               if (rte_dma_completed(dev_id, vchan, 1, &id, NULL) != 0)
+                       ERR_RETURN("Error with rte_dma_completed when no job done\n");
+               if (id != id_count)
+                       ERR_RETURN("Error:incorrect job id received when no job done, %u [expected %u]\n",
+                                       id, id_count);
+
+               /* check for completed_status and id when no job done */
+               if (rte_dma_completed_status(dev_id, vchan, 1, &id, &status) != 0)
+                       ERR_RETURN("Error with rte_dma_completed_status when no job done\n");
+               if (id != id_count)
+                       ERR_RETURN("Error:incorrect job id received when no job done, %u [expected %u]\n",
+                                       id, id_count);
+
                rte_pktmbuf_free(src);
                rte_pktmbuf_free(dst);