All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhiyong.yang@intel.com
To: dev@dpdk.org
Cc: maxime.coquelin@redhat.com, ferruh.yigit@intel.com,
	tiwei.bie@intel.com, lei.a.yao@intel.com,
	bernard.iremonger@intel.com, stable@dpdk.org,
	Zhiyong Yang <zhiyong.yang@intel.com>
Subject: [PATCH v2] app/testpmd: fix pmd_test_exit function for vdevs
Date: Fri, 18 May 2018 17:59:37 +0800	[thread overview]
Message-ID: <20180518095937.28710-1-zhiyong.yang@intel.com> (raw)

For vdev, just calling rte_eth_dev_close() isn't enough to free all
the resources allocated during device probe, e.g. for virtio-user,
virtio_user_pmd_remove(), i.e. the remove() method of a vdev driver,
needs to be called to unlink the socket file created during device
probe. So this patch calls the rte_eth_dev_detach() for vdev when
quitting testpmd.

Cc: maxime.coquelin@redhat.com
Cc: ferruh.yigit@intel.com
Cc: tiwei.bie@intel.com
Cc: lei.a.yao@intel.com
Cc: bernard.iremonger@intel.com
Cc: stable@dpdk.org

Fixes: af75078fece3 ("first public release")
Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")

Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---

changes in V2:
1. change the pache title and add a fixes line.

 app/test-pmd/testpmd.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 134401603..1d308f056 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2011,6 +2011,8 @@ detach_port(portid_t port_id)
 void
 pmd_test_exit(void)
 {
+	const struct rte_bus *bus;
+	struct rte_device *device;
 	portid_t pt_id;
 	int ret;
 
@@ -2020,10 +2022,14 @@ pmd_test_exit(void)
 	if (ports != NULL) {
 		no_link_check = 1;
 		RTE_ETH_FOREACH_DEV(pt_id) {
+			device = rte_eth_devices[pt_id].device;
+			bus = rte_bus_find_by_device(device);
 			printf("\nShutting down port %d...\n", pt_id);
 			fflush(stdout);
 			stop_port(pt_id);
 			close_port(pt_id);
+			if (bus && !strcmp(bus->name, "vdev"))
+				detach_port(pt_id);
 		}
 	}
 
-- 
2.14.3

             reply	other threads:[~2018-05-18  9:59 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18  9:59 zhiyong.yang [this message]
2018-05-18  4:52 ` [PATCH v2] app/testpmd: fix pmd_test_exit function for vdevs Yao, Lei A
2018-05-18 10:18   ` Iremonger, Bernard
2018-05-18 10:21     ` Ferruh Yigit
2018-05-18 10:48     ` Ferruh Yigit
2018-05-18 15:55       ` Matan Azrad
2018-05-18 16:29         ` Ferruh Yigit
2018-05-19 14:19           ` Thomas Monjalon
2018-05-21 10:54             ` Thomas Monjalon
2018-05-21 16:32               ` Ferruh Yigit
2018-05-21 16:38                 ` Thomas Monjalon
2018-05-22 13:12                   ` Thomas Monjalon
2018-05-22 18:38                     ` Ferruh Yigit
2018-05-22 19:48                       ` Thomas Monjalon
2018-05-23  1:52                         ` Yang, Zhiyong
2018-05-23 11:37                           ` Yang, Zhiyong
2018-05-23 11:58                             ` Thomas Monjalon
2018-05-21 16:37             ` Ferruh Yigit
2018-05-21 16:40               ` Thomas Monjalon
2018-05-21 16:44                 ` Ferruh Yigit
2018-05-21 19:12                   ` Thomas Monjalon

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=20180518095937.28710-1-zhiyong.yang@intel.com \
    --to=zhiyong.yang@intel.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=lei.a.yao@intel.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=tiwei.bie@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.