[PATCH v8 2/2] examples/vhost: unconfigure DMA vchannel

Xia, Chenbo chenbo.xia at intel.com
Wed Oct 26 11:03:29 CEST 2022


> -----Original Message-----
> From: Ding, Xuan <xuan.ding at intel.com>
> Sent: Tuesday, October 25, 2022 4:26 PM
> To: maxime.coquelin at redhat.com; Xia, Chenbo <chenbo.xia at intel.com>
> Cc: dev at dpdk.org; Hu, Jiayu <jiayu.hu at intel.com>; He, Xingguang
> <xingguang.he at intel.com>; Ling, WeiX <weix.ling at intel.com>; Jiang, Cheng1
> <cheng1.jiang at intel.com>; Wang, YuanX <yuanx.wang at intel.com>; Ma, WenwuX
> <wenwux.ma at intel.com>; Ding, Xuan <xuan.ding at intel.com>
> Subject: [PATCH v8 2/2] examples/vhost: unconfigure DMA vchannel
> 
> From: Xuan Ding <xuan.ding at intel.com>
> 
> 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 at intel.com>
> ---
>  examples/vhost/main.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/examples/vhost/main.c b/examples/vhost/main.c
> index ac78704d79..42e53a0f9a 100644
> --- a/examples/vhost/main.c
> +++ b/examples/vhost/main.c
> @@ -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();
> 
> --
> 2.17.1

Reviewed-by: Chenbo Xia <chenbo.xia at intel.com>


More information about the dev mailing list