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 C0C76A0543; Tue, 25 Oct 2022 10:29:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AC0E342BD0; Tue, 25 Oct 2022 10:29:32 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 5F6C542BC8 for ; Tue, 25 Oct 2022 10:29:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666686570; x=1698222570; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=oR0Ba99HU4ZtbSLvytXvaQnw9aj5eJukT4ZwUkPlyQ4=; b=RKINXrLZnKFOBJLnabYZi0yjfMCSLHaebZ3ClmzXytS7gcVZrJxeRnaK 73IOayulO+CPhE8uvp+0pea5eVQ2wDqrwdFe3nLnjs3QGsgVOvCzKGk46 rQbQRET8NVl3XoeYLt2OrFej/0uqRgKac8uQu0tPhpQy0nBk2ZUfToGuG kRcTJRLeCkgYepqgrz7mClk5h/eX2MtYYDp8AC8gcQHkjX/3MtP16pW0M dpErfpeVtIZMa8fntbWFy1keU5mXEX6Qkx84f5wNzEad5sOWfsG9EIIFB +wjNkHmno6BNEpaKSNZ31UV8/jBPDRDCJLplC8WCU20ubyEzba7ck18KG w==; X-IronPort-AV: E=McAfee;i="6500,9779,10510"; a="305234261" X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="305234261" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2022 01:29:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10510"; a="664833394" X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="664833394" Received: from npg-dpdk-xuan-cbdma.sh.intel.com ([10.67.111.102]) by orsmga001.jf.intel.com with ESMTP; 25 Oct 2022 01:29:27 -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, weix.ling@intel.com, cheng1.jiang@intel.com, yuanx.wang@intel.com, wenwux.ma@intel.com, Xuan Ding Subject: [PATCH v8 2/2] examples/vhost: unconfigure DMA vchannel Date: Tue, 25 Oct 2022 08:25:40 +0000 Message-Id: <20221025082540.100618-3-xuan.ding@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221025082540.100618-1-xuan.ding@intel.com> References: <20220814140442.82525-1-xuan.ding@intel.com> <20221025082540.100618-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 vChannel 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