From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id A6B28235 for ; Tue, 22 May 2018 20:35:33 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 May 2018 11:35:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,430,1520924400"; d="scan'208";a="43067846" Received: from silpixa00399777.ir.intel.com (HELO silpixa00399777.ger.corp.intel.com) ([10.237.222.236]) by orsmga007.jf.intel.com with ESMTP; 22 May 2018 11:35:30 -0700 From: Ferruh Yigit To: Wenzhuo Lu , Jingjing Wu Cc: dev@dpdk.org, Ferruh Yigit , Zhiyong Yang , Bernard Iremonger , Thomas Monjalon Date: Tue, 22 May 2018 19:35:08 +0100 Message-Id: <20180522183509.66644-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.14.3 Subject: [dpdk-dev] [PATCH] app/testpmd: fix failsafe PMD failure on exit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 May 2018 18:35:34 -0000 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 --- Cc: Zhiyong Yang Cc: Bernard Iremonger Cc: Thomas Monjalon --- 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