[dpdk-stable] [ PATCH 17.11 2/2] app/pdump: remove created vdevs

Reshma Pattan reshma.pattan at intel.com
Fri Mar 1 12:53:23 CET 2019


Virtual devices added in pdump application
should be removed explicitly while exiting the pdump application,
otherwise the subsequent run of the pdump application can cause
undefined behaviour due to stale devices still exist in
rte_eth_dev_data[].

Fixes: caa7028276 ("app/pdump: add tool for packet capturing")
Signed-off-by: Reshma Pattan <reshma.pattan at intel.com>
---
 app/pdump/main.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index 8e42b3647..c6950da75 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -548,6 +548,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++) {
@@ -564,6 +565,17 @@ 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(s) created */
+		if (pt->dir & RTE_PDUMP_FLAG_RX)
+			rte_eth_dev_detach(pt->rx_vdev_id, name);
+
+		if (pt->single_pdump_dev)
+			continue;
+
+		if (pt->dir & RTE_PDUMP_FLAG_TX)
+			rte_eth_dev_detach(pt->tx_vdev_id, name);
+
 	}
 	cleanup_rings();
 }
-- 
2.17.1



More information about the stable mailing list