patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Reshma Pattan <reshma.pattan@intel.com>
To: stable@dpdk.org
Cc: Reshma Pattan <reshma.pattan@intel.com>
Subject: [dpdk-stable] [ PATCH 17.11 2/2] app/pdump: remove created vdevs
Date: Fri,  1 Mar 2019 11:53:23 +0000	[thread overview]
Message-ID: <20190301115323.32420-2-reshma.pattan@intel.com> (raw)
In-Reply-To: <20190301115323.32420-1-reshma.pattan@intel.com>

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@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

  reply	other threads:[~2019-03-01 11:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-01 11:53 [dpdk-stable] [ PATCH 17.11 1/2] ethdev: clear ethdev data upon detach Reshma Pattan
2019-03-01 11:53 ` Reshma Pattan [this message]
2019-03-04 19:57 ` Yongseok Koh
2019-03-12  9:31   ` Pattan, Reshma
2019-03-12 21:53     ` Yongseok Koh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190301115323.32420-2-reshma.pattan@intel.com \
    --to=reshma.pattan@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).