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 4CC9EA09D3; Thu, 20 Oct 2022 11:14:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B77C842CF2; Thu, 20 Oct 2022 11:14:19 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 8506142CF2 for ; Thu, 20 Oct 2022 11:14:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666257258; x=1697793258; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=HYnGNBEfLpaFNjAv72GAkIslYko9BKcbdAD0nagL21I=; b=i9RhFMd/wUMbEpr+oXr0fyqeDdUw/mWqWN5KybEaooFjrQU8vMlGaf1f NkwElaFoezzusTEODPQQpJsIMbzHQEbv1ZNeoxTR97pma2iWN5VStUXoC z4g33SvYZmBY+DiH+fMCjwmOyjdFqGoT/mo7duOhK8HTup+NwHuqqLe0G YPqc/pGPYUTpLmWR/Rkvxnt8rdfw1x5P6HUxxc/3qlplq43NxQlPRfExb duZVTdOsT5WqDm2hWzRyhNLPYYvauj3HvtCVQB4Bs5Xzp7vKcmhFhM9RU uZRu91i3OT0UQoc5cgTZEkXhw1Sr5QtRCOeRkL56r70aboHOJP5dYHUcJ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="289967885" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="289967885" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2022 02:14:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10505"; a="804759882" X-IronPort-AV: E=Sophos;i="5.95,198,1661842800"; d="scan'208";a="804759882" Received: from npg-dpdk-xuan-cbdma.sh.intel.com ([10.67.111.102]) by orsmga005.jf.intel.com with ESMTP; 20 Oct 2022 02:14:15 -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 v7 2/2] examples/vhost: unconfigure DMA vchannel Date: Thu, 20 Oct 2022 09:11:03 +0000 Message-Id: <20221020091103.43422-3-xuan.ding@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221020091103.43422-1-xuan.ding@intel.com> References: <20220814140442.82525-1-xuan.ding@intel.com> <20221020091103.43422-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