From patchwork Mon Feb 25 17:14:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eads, Gage" X-Patchwork-Id: 50502 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 929F82A6A; Mon, 25 Feb 2019 18:14:15 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 49A5729C6; Mon, 25 Feb 2019 18:14:13 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Feb 2019 09:14:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,411,1544515200"; d="scan'208";a="127126242" Received: from txasoft-yocto.an.intel.com ([10.123.72.192]) by fmsmga008.fm.intel.com with ESMTP; 25 Feb 2019 09:14:12 -0800 From: Gage Eads To: dev@dpdk.org Cc: ferruh.yigit@intel.com, reshma.pattan@intel.com, stable@dpdk.org Date: Mon, 25 Feb 2019 11:14:18 -0600 Message-Id: <20190225171418.10306-1-gage.eads@intel.com> X-Mailer: git-send-email 2.13.6 Subject: [dpdk-dev] [PATCH] pdump: only remove created vdevs X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This commit fixes a bug in which pdump -- particularly when used in a unidirectional manner -- could attempt to remove devices it didn't create. Fixes: 35cb223ab7be ("pdump: fix vdev cleanup") Cc: stable@dpdk.org Signed-off-by: Gage Eads Acked-by: Reshma Pattan --- app/pdump/main.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/pdump/main.c b/app/pdump/main.c index 5e183ea90..ccf2a1d2f 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -512,12 +512,19 @@ cleanup_pdump_resources(void) if (pt->dir & RTE_PDUMP_FLAG_TX) free_ring_data(pt->tx_ring, pt->tx_vdev_id, &pt->stats); - /* Remove the vdev created */ - rte_eth_dev_get_name_by_port(pt->rx_vdev_id, name); - rte_eal_hotplug_remove("vdev", name); + /* Remove the vdev(s) created */ + if (pt->dir & RTE_PDUMP_FLAG_RX) { + rte_eth_dev_get_name_by_port(pt->rx_vdev_id, name); + rte_eal_hotplug_remove("vdev", name); + } + + if (pt->single_pdump_dev) + continue; - rte_eth_dev_get_name_by_port(pt->tx_vdev_id, name); - rte_eal_hotplug_remove("vdev", name); + if (pt->dir & RTE_PDUMP_FLAG_TX) { + rte_eth_dev_get_name_by_port(pt->tx_vdev_id, name); + rte_eal_hotplug_remove("vdev", name); + } } cleanup_rings();