DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Wenzhuo Lu <wenzhuo.lu@intel.com>, Jingjing Wu <jingjing.wu@intel.com>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>,
	Zhiyong Yang <zhiyong.yang@intel.com>,
	Bernard Iremonger <bernard.iremonger@intel.com>,
	Thomas Monjalon <thomas@monjalon.net>
Subject: [dpdk-dev] [PATCH] app/testpmd: fix failsafe PMD failure on exit
Date: Tue, 22 May 2018 19:35:08 +0100	[thread overview]
Message-ID: <20180522183509.66644-1-ferruh.yigit@intel.com> (raw)

vdevs detach on testpmd exit implemented as workaround to fix
a virtio-user issue. The issue was virtio-user cleanup is not
called and existing socket file not cleaned up which will fail
next run.

The vdev cleanup causing problems in failsafe PMD.

Reduce the cleanup to only virtio-user and add a comment that this
workaround should be converted to a proper cleanup, not something
specific to virtio-user, and not something specific to vdev and
testpmd.

Fixes: fe890955114d ("app/testpmd: fix exit for vdevs")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: Zhiyong Yang <zhiyong.yang@intel.com>
Cc: Bernard Iremonger <bernard.iremonger@intel.com>
Cc: Thomas Monjalon <thomas@monjalon.net>
---
 app/test-pmd/testpmd.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index cfa6da60c..c3990d693 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -2014,7 +2014,6 @@ 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;
@@ -2025,13 +2024,21 @@ 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"))
+
+			/*
+			 * This is a workaround to fix a virtio-user issue that
+			 * requires to call clean-up routine to remove existing
+			 * socket.
+			 * This workaround valid only for testpmd, needs a fix
+			 * valid for all applications.
+			 * TODO: Implement proper resource cleanup
+			 */
+			device = rte_eth_devices[pt_id].device;
+			if (device && !strcmp(device->driver->name, "net_virtio_user"))
 				detach_port(pt_id);
 		}
 	}
-- 
2.14.3

             reply	other threads:[~2018-05-22 18:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-22 18:35 Ferruh Yigit [this message]
2018-05-22 19:47 ` Thomas Monjalon
2018-05-22 20:49   ` Ferruh Yigit
2018-05-22 20:50     ` Ferruh Yigit
2018-05-27  4:06 ` Yuanhan Liu
2018-05-27 12:37   ` Thomas Monjalon
2018-06-02  5:01     ` Yuanhan Liu

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=20180522183509.66644-1-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=thomas@monjalon.net \
    --cc=wenzhuo.lu@intel.com \
    --cc=zhiyong.yang@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 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).