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

Message ID 20221025082540.100618-3-xuan.ding@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series vhost: introduce DMA vchannel unconfiguration |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS

Commit Message

Ding, Xuan Oct. 25, 2022, 8:25 a.m. UTC
  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
vChannel 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

Ling, WeiX Oct. 25, 2022, 9:56 a.m. UTC | #1
> -----Original Message-----
> From: Ding, Xuan <xuan.ding@intel.com>
> Sent: Tuesday, October 25, 2022 4:26 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>; Ling, WeiX <weix.ling@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 v8 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
> 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>
  
Maxime Coquelin Oct. 26, 2022, 5:14 a.m. UTC | #2
On 10/25/22 10:25, xuan.ding@intel.com wrote:
> 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
> vChannel 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(+)
> 
> 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();
>   

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  
Chenbo Xia Oct. 26, 2022, 9:03 a.m. UTC | #3
> -----Original Message-----
> From: Ding, Xuan <xuan.ding@intel.com>
> Sent: Tuesday, October 25, 2022 4:26 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>; Ling, WeiX <weix.ling@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 v8 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
> vChannel 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(+)
> 
> 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@intel.com>
  

Patch

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();