examples/vhost: unconfigure DMA vChannel

This patch applies rte_vhost_async_dma_unconfigure() to manually free
DMA vChannels. Before unconfiguration, make sure the specified DMA
vChannel is no longer used by any vhost ports.

Signed-off-by: Xuan Ding <xuan.ding@intel.com>
Tested-by: Wei Ling <weix.ling@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
This commit is contained in:
Xuan Ding 2022-10-25 08:25:40 +00:00 committed by Chenbo Xia
parent e8c3d496ca
commit f8fcdc5944

View File

@ -2066,6 +2066,14 @@ main(int argc, char *argv[])
RTE_LCORE_FOREACH_WORKER(lcore_id) RTE_LCORE_FOREACH_WORKER(lcore_id)
rte_eal_wait_lcore(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 %d in vhost.\n", dmas_id[i]);
rte_exit(EXIT_FAILURE, "Cannot use given DMA device\n");
}
}
/* clean up the EAL */ /* clean up the EAL */
rte_eal_cleanup(); rte_eal_cleanup();