[v6,2/2] examples/vhost: unconfigure DMA vchannel
Checks
Commit Message
From: Xuan Ding <xuan.ding@intel.com>
This patch applies rte_vhost_async_dma_unconfigure() to manually free
DMA vchannels. Before unconfiguration, make sure the specified DMA
device is no longer used by any vhost ports.
Signed-off-by: Xuan Ding <xuan.ding@intel.com>
---
examples/vhost/main.c | 8 ++++++++
1 file changed, 8 insertions(+)
Comments
> -----Original Message-----
> From: xuan.ding@intel.com <xuan.ding@intel.com>
> Sent: Tuesday, October 18, 2022 11:22 PM
> To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; Hu, Jiayu <jiayu.hu@intel.com>; He, Xingguang
> <xingguang.he@intel.com>; Yang, YvonneX <yvonnex.yang@intel.com>; Jiang,
> Cheng1 <cheng1.jiang@intel.com>; Wang, YuanX <yuanx.wang@intel.com>;
> Ma, WenwuX <wenwux.ma@intel.com>; Ding, Xuan <xuan.ding@intel.com>
> Subject: [PATCH v6 2/2] examples/vhost: unconfigure DMA vchannel
>
> From: Xuan Ding <xuan.ding@intel.com>
>
> This patch applies rte_vhost_async_dma_unconfigure() to manually free DMA
> vchannels. Before unconfiguration, make sure the specified DMA device 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>
@@ -2066,6 +2066,14 @@ 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 %d in vhost.\n", dmas_id[i]);
+ rte_exit(EXIT_FAILURE, "Cannot use given DMA device\n");
+ }
+ }
+
/* clean up the EAL */
rte_eal_cleanup();