From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 89987A0560; Tue, 18 Oct 2022 17:25:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4C1C841147; Tue, 18 Oct 2022 17:25:23 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id EEFE74021D for ; Tue, 18 Oct 2022 17:25:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666106722; x=1697642722; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=HYnGNBEfLpaFNjAv72GAkIslYko9BKcbdAD0nagL21I=; b=A1HDS9hXWhmNocwnplLO6DLQOJ/c0mPUDl70qN7M8hirv6NME7+FUYpV fK8erUEdm+qW32TiEU+RJ8GcCq7Re2wEsgRjR5kgCjYuvfsUGUUzWycAe 4snxjrgP3wCjn6DWpXujhif7kRblDsdxW3gxUzz2xs7DZQykBJFWcCFBn Z0GyX5oURCOYW7VUqs5ODQTweQVPBzLGELU2UsJ8INLL98W2kpbarijzK ZSgECgzXYaE9xzGT6mYFn3UQwNqpGAUin2SyC4Uq85dsHMFCadp0v0TQU 9ol7A9Tr1fa096lGcmMb9omNefM9CNy4Sjwyd1zSBu0IXYobVk5FGjp+V Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="392444820" X-IronPort-AV: E=Sophos;i="5.95,193,1661842800"; d="scan'208";a="392444820" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2022 08:25:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10504"; a="733686076" X-IronPort-AV: E=Sophos;i="5.95,193,1661842800"; d="scan'208";a="733686076" Received: from npg-dpdk-xuan-cbdma.sh.intel.com ([10.67.111.102]) by fmsmga002.fm.intel.com with ESMTP; 18 Oct 2022 08:25:18 -0700 From: xuan.ding@intel.com To: maxime.coquelin@redhat.com, chenbo.xia@intel.com Cc: dev@dpdk.org, jiayu.hu@intel.com, xingguang.he@intel.com, yvonnex.yang@intel.com, cheng1.jiang@intel.com, yuanx.wang@intel.com, wenwux.ma@intel.com, Xuan Ding Subject: [PATCH v6 2/2] examples/vhost: unconfigure DMA vchannel Date: Tue, 18 Oct 2022 15:22:21 +0000 Message-Id: <20221018152221.86341-3-xuan.ding@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221018152221.86341-1-xuan.ding@intel.com> References: <20220814140442.82525-1-xuan.ding@intel.com> <20221018152221.86341-1-xuan.ding@intel.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Xuan Ding 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 --- 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