[PATCH v1 2/2] example/vhost: unconfigure DMA vchannel

xuan.ding at intel.com xuan.ding at intel.com
Sun Aug 14 16:04:42 CEST 2022


From: Xuan Ding <xuan.ding at intel.com>

This patch uses rte_vhost_async_dma_unconfigure() API
to manually free 'dma_coy_track' array rather than wait for
the program to finish before being freed.

Signed-off-by: Xuan Ding <xuan.ding at intel.com>
---
 examples/vhost/main.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 7e1666f42a..1dba9724c2 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -2060,6 +2060,13 @@ main(int argc, char *argv[])
 	RTE_LCORE_FOREACH_WORKER(lcore_id)
 		rte_eal_wait_lcore(lcore_id);
 
+	for (i = 0; i < dma_count; i++) {
+		if (rte_vhost_async_dma_unconfigure(dmas_id[i], 0) < 0) {
+			RTE_LOG(ERR, VHOST_PORT, "Failed to unconfigure DMA in vhost.\n");
+			rte_exit(EXIT_FAILURE, "Cannot use given DMA device\n");
+		}
+	}
+
 	/* clean up the EAL */
 	rte_eal_cleanup();
 
-- 
2.17.1



More information about the dev mailing list