From patchwork Wed Jul 28 13:48:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulis Gributs X-Patchwork-Id: 96353 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0065EA0C43; Wed, 28 Jul 2021 15:48:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7516C40E64; Wed, 28 Jul 2021 15:48:56 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 8549740142 for ; Wed, 28 Jul 2021 15:48:55 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10058"; a="212698591" X-IronPort-AV: E=Sophos;i="5.84,276,1620716400"; d="scan'208";a="212698591" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2021 06:48:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,276,1620716400"; d="scan'208";a="437775315" Received: from silpixa00400902.ir.intel.com ([10.243.23.84]) by fmsmga007.fm.intel.com with ESMTP; 28 Jul 2021 06:48:52 -0700 From: Paulis Gributs To: xiaoyun.li@intel.com, ferruh.yigit@intel.com Cc: dev@dpdk.org, thomas@monjalon.net, Paulis Gributs Date: Wed, 28 Jul 2021 13:48:48 +0000 Message-Id: <20210728134848.353258-1-paulis.gributs@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Organization: Intel Corporation.... Subject: [dpdk-dev] [PATCH] app/testpmd: fix vm_hotplug after removal of rte_eth_devices X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" After removing rte_eth_devices from testpmd the vm_hotplug no longer recovered after removal of a device, this patch fixes this issue. Fixes: 0a0821bcf312 ("app/testpmd: remove most uses of internal ethdev array") Signed-off-by: Paulis Gributs Acked-by: Xiaoyun Li --- app/test-pmd/testpmd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 63da63eb3c..6cbe9ba3c8 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -3197,14 +3197,16 @@ rmv_port_callback(void *arg) stop_port(port_id); no_link_check = org_no_link_check; - close_port(port_id); ret = eth_dev_info_get_print_err(port_id, &dev_info); if (ret != 0) TESTPMD_LOG(ERR, "Failed to get device info for port %d, not detaching\n", port_id); - else - detach_device(dev_info.device); /* might be already removed or have more ports */ + else { + struct rte_device *device = dev_info.device; + close_port(port_id); + detach_device(device); /* might be already removed or have more ports */ + } if (need_to_start) start_packet_forwarding(0); }