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 77DF2A0542; Tue, 6 Sep 2022 07:22:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2716B427F3; Tue, 6 Sep 2022 07:22:13 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 5D5BB427F2 for ; Tue, 6 Sep 2022 07:22:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662441731; x=1693977731; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=5RRyQit9hcH7RH0YvJUM9W3CF6YmY6LH0Z1FGx6ysDU=; b=OmADJYlOYxQrHSMaectiqL8VmCUS8NhCgTvo8VEqRnT2Uih/eQQYcd50 SGJBjF3sWC0aY9hFS0OKvQd54cA/KxzMNJlDVa8jfuKdFiQtrctyxrxXa dP54pu+7QnQTC+ypbX2xoGD6tUolG72pgDbBUSxU78VZ6jjCkDfBlnX9c 0a1bxyOGaa4eI+C6j2s38boHba5SxiQ8zSpH7hKhjgXFz07xY9T82Shab bUwgs1MbSwlHWjNjsruFG2lYpyOdH/p3j1itjaFQeB7IPEk2rK18s0hke 6TUVuzOkDZvLOnP723zKeDxM65Td2kmz+UPvztKVauROkS0qG+lgmXAg4 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10461"; a="297817986" X-IronPort-AV: E=Sophos;i="5.93,293,1654585200"; d="scan'208";a="297817986" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Sep 2022 22:22:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,293,1654585200"; d="scan'208";a="682267065" Received: from npg-dpdk-xuan-cbdma.sh.intel.com ([10.67.111.163]) by fmsmga004.fm.intel.com with ESMTP; 05 Sep 2022 22:22:08 -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 v2 2/2] examples/vhost: unconfigure DMA vchannel Date: Tue, 6 Sep 2022 05:21:49 +0000 Message-Id: <20220906052149.21033-3-xuan.ding@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220906052149.21033-1-xuan.ding@intel.com> References: <20220814140442.82525-1-xuan.ding@intel.com> <20220906052149.21033-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() API to manually free 'dma_copy_track' array instead of waiting until the program ends to be released. Signed-off-by: Xuan Ding --- examples/vhost/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 7e1666f42a..1754d9ee27 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -1624,6 +1624,13 @@ destroy_device(int vid) dma_bind[vid].dmas[VIRTIO_TXQ].async_enabled = false; } + 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 in vhost.\n"); + rte_exit(EXIT_FAILURE, "Cannot use given DMA device\n"); + } + } + rte_free(vdev); } -- 2.17.1