From: Xuan Ding <[email protected]> This patch applies rte_vhost_async_dma_unconfigure() API to manually free 'dma_copy_track' array instead of waiting until the program ends to be released.
Signed-off-by: Xuan Ding <[email protected]> --- examples/vhost/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 7e1666f42a..1754d9ee27 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -1624,6 +1624,13 @@ destroy_device(int vid) dma_bind[vid].dmas[VIRTIO_TXQ].async_enabled = false; } + 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"); + } + } + rte_free(vdev); } -- 2.17.1

