From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <reshma.pattan@intel.com>
Received: from mga05.intel.com (mga05.intel.com [192.55.52.43])
 by dpdk.org (Postfix) with ESMTP id 546485424;
 Tue, 15 Jan 2019 14:45:09 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga002.jf.intel.com ([10.7.209.21])
 by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 15 Jan 2019 05:45:08 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.56,481,1539673200"; d="scan'208";a="126215109"
Received: from silpixa00398672.ir.intel.com (HELO
 silpixa00398672.ger.corp.intel.com) ([10.237.222.112])
 by orsmga002.jf.intel.com with ESMTP; 15 Jan 2019 05:45:06 -0800
From: Reshma Pattan <reshma.pattan@intel.com>
To: dev@dpdk.org
Cc: Reshma Pattan <reshma.pattan@intel.com>, stable@dpdk.org,
 ferruh.yigit@intel.com
Date: Tue, 15 Jan 2019 13:45:04 +0000
Message-Id: <20190115134504.4019-1-reshma.pattan@intel.com>
X-Mailer: git-send-email 2.17.1
In-Reply-To: <20190111175134.40273-1-reshma.pattan@intel.com>
References: <20190111175134.40273-1-reshma.pattan@intel.com>
Subject: [dpdk-stable] [PATCH v4] pdump: fix vdev cleanup
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 15 Jan 2019 13:45:09 -0000

Virtual devices added in pdump application
using rte_eal_hotplug_add should be removed explicitly
while exiting the pdump application, otherwise the
subsequent run of the pdump application will fail with the reason
that virtual devices with the same name already exists in primary.

Fixes: 6362f362a2 ("app/pdump: use EAL hotplug instead of ethdev attach")
CC: stable@dpdk.org
CC: ferruh.yigit@intel.com

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
v4: fix typo in commit message
v3: fix author
v2: fix typo in commit message
---
---
 app/pdump/main.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index 9e86bf623..5e183ea90 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -494,6 +494,7 @@ cleanup_pdump_resources(void)
 {
 	int i;
 	struct pdump_tuples *pt;
+	char name[RTE_ETH_NAME_MAX_LEN];
 
 	/* disable pdump and free the pdump_tuple resources */
 	for (i = 0; i < num_tuples; i++) {
@@ -510,6 +511,14 @@ cleanup_pdump_resources(void)
 			free_ring_data(pt->rx_ring, pt->rx_vdev_id, &pt->stats);
 		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);
+
+		rte_eth_dev_get_name_by_port(pt->tx_vdev_id, name);
+		rte_eal_hotplug_remove("vdev", name);
+
 	}
 	cleanup_rings();
 }
-- 
2.17.1