pdump: only remove created vdevs

Message ID 20190225171418.10306-1-gage.eads@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series pdump: only remove created vdevs |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS

Commit Message

Eads, Gage Feb. 25, 2019, 5:14 p.m. UTC
  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 <gage.eads@intel.com>
---
 app/pdump/main.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
  

Comments

Pattan, Reshma Feb. 26, 2019, 2:14 p.m. UTC | #1
> -----Original Message-----
> From: Eads, Gage
> Sent: Monday, February 25, 2019 5:14 PM
> To: dev@dpdk.org
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; Pattan, Reshma
> <reshma.pattan@intel.com>; stable@dpdk.org
> Subject: [PATCH] pdump: only remove created vdevs
> 
> This commit fixes a bug in which pdump -- particularly when used in a
> unidirectional manner -- could attempt to remove devices it didn't create.
> 

Small nit,  You can remove "--" in commit message . Other than that

Acked-by: Reshma Pattan <reshma.pattan@intel.com>
  
Eads, Gage Feb. 26, 2019, 3:12 p.m. UTC | #2
> -----Original Message-----
> From: Pattan, Reshma
> Sent: Tuesday, February 26, 2019 8:15 AM
> To: Eads, Gage <gage.eads@intel.com>; dev@dpdk.org
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; stable@dpdk.org
> Subject: RE: [PATCH] pdump: only remove created vdevs
> 
> 
> 
> > -----Original Message-----
> > From: Eads, Gage
> > Sent: Monday, February 25, 2019 5:14 PM
> > To: dev@dpdk.org
> > Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; Pattan, Reshma
> > <reshma.pattan@intel.com>; stable@dpdk.org
> > Subject: [PATCH] pdump: only remove created vdevs
> >
> > This commit fixes a bug in which pdump -- particularly when used in a
> > unidirectional manner -- could attempt to remove devices it didn't create.
> >
> 
> Small nit,  You can remove "--" in commit message . Other than that
> 
> Acked-by: Reshma Pattan <reshma.pattan@intel.com>
> 

Sure thing. I'll fix the title and the Fixes commit name as well (both should be "app/pdump", not "pdump").

Thanks,
Gage
  

Patch

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();