From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 11FBD8E5D; Fri, 18 May 2018 04:24:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 May 2018 19:24:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,413,1520924400"; d="scan'208";a="40283867" Received: from dpdk9.bj.intel.com ([172.16.182.183]) by fmsmga007.fm.intel.com with ESMTP; 17 May 2018 19:24:13 -0700 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 Date: Fri, 18 May 2018 17:59:37 +0800 Message-Id: <20180518095937.28710-1-zhiyong.yang@intel.com> X-Mailer: git-send-email 2.14.3 Subject: [dpdk-dev] [PATCH v2] app/testpmd: fix pmd_test_exit function for vdevs 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: Fri, 18 May 2018 02:24:18 -0000 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 --- 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