From patchwork Thu Jan 23 15:15:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 65088 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 468EEA053A; Thu, 23 Jan 2020 16:15:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 048D72B98; Thu, 23 Jan 2020 16:15:15 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 3459D27D; Thu, 23 Jan 2020 16:15:12 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jan 2020 07:15:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,354,1574150400"; d="scan'208";a="288567952" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.180]) by fmsmga001.fm.intel.com with ESMTP; 23 Jan 2020 07:15:10 -0800 From: Ferruh Yigit To: Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , Matan Azrad Cc: dev@dpdk.org, stable@dpdk.org Date: Thu, 23 Jan 2020 15:15:08 +0000 Message-Id: <20200123151509.3207419-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH] app/testpmd: fix hotplug 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The 'port_id_is_invalid()' check in the 'detach_port_device()' is breaking the hotplug support, since at that stage port will be closed and validity check always fail [1] and removing the device is not really completed. But this cause the vfio request interrupt keep triggered continuously and makes the application unusable, since port is closed but device is not removed, the remove path keep generating error log: EAL: can not get port by device 0000:00:05.0! EAL: can not get port by device 0000:00:05.0! EAL: can not get port by device 0000:00:05.0! EAL: can not get port by device 0000:00:05.0! EAL: can not get port by device 0000:00:05.0! EAL: can not get port by device 0000:00:05.0! Fixed by removing 'port_id_is_invalid()' check from 'detach_port_device()', anyway it shouldn't be required. Without this check device remove works as expected. Only "Invalid port_id=0" logs seen a few times, which is because the actual removal not done synchronously but an alarm set for it, until the alarm fired application may receive many interrupts, expect the first ones cause the error. So this patch also removes the logging from checking the invalid port in 'rmv_port_callback()' to reduce the noise. [1] rmv_port_callback() stop_port(port_id); close_port(port_id); detach_port_device(port_id); Fixes: 43d0e304980a ("app/testpmd: fix invalid port detaching") Cc: stable@dpdk.org Signed-off-by: Ferruh Yigit Acked-by: Bernard Iremonger --- app/test-pmd/testpmd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index f9f4cd1d3..3323013bb 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2641,9 +2641,6 @@ detach_port_device(portid_t port_id) printf("Removing a device...\n"); - if (port_id_is_invalid(port_id, ENABLED_WARN)) - return; - dev = rte_eth_devices[port_id].device; if (dev == NULL) { printf("Device already removed\n"); @@ -2875,7 +2872,8 @@ rmv_port_callback(void *arg) int org_no_link_check = no_link_check; portid_t port_id = (intptr_t)arg; - RTE_ETH_VALID_PORTID_OR_RET(port_id); + if (!rte_eth_dev_is_valid_port(port_id)) + return; if (!test_done && port_is_forwarding(port_id)) { need_to_start = 1;