From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 1F39D239 for ; Fri, 1 Mar 2019 12:53:41 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Mar 2019 03:53:41 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,427,1544515200"; d="scan'208";a="303556583" Received: from silpixa00398672.ir.intel.com (HELO silpixa00398672.ger.corp.intel.com) ([10.237.222.112]) by orsmga005.jf.intel.com with ESMTP; 01 Mar 2019 03:53:40 -0800 From: Reshma Pattan To: stable@dpdk.org Cc: Reshma Pattan Date: Fri, 1 Mar 2019 11:53:23 +0000 Message-Id: <20190301115323.32420-2-reshma.pattan@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190301115323.32420-1-reshma.pattan@intel.com> References: <20190301115323.32420-1-reshma.pattan@intel.com> Subject: [dpdk-stable] [ PATCH 17.11 2/2] app/pdump: remove created vdevs X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Mar 2019 11:53:42 -0000 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 --- 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