From patchwork Wed Feb 9 10:42:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, WenxuanX" X-Patchwork-Id: 107123 X-Patchwork-Delegate: ferruh.yigit@amd.com 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 188A3A04A9; Wed, 9 Feb 2022 12:02:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A2ED241144; Wed, 9 Feb 2022 12:02:31 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 6A25941143 for ; Wed, 9 Feb 2022 12:02:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644404549; x=1675940549; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=WrCDFRKcpbUG8H5Q8uheVI7iX1JvXDBgJ9TMvsUkX2k=; b=Lc3PRZzobzf8BdaSpqsUHepPEEofc2ntKYBz7fTCvM2xwhAC0ndEulix mP0qmWQ2ULLKgLwk8CvZrB8UnrNGZPDaClSNk9CFn3yrm71ErMTQO6LFu lIJMjcj7zQwjaBk9G1QBKY/0Y7asKN4ZeZl4F86nCicjGHg9fKTpUL2rl 7/MbWlpHQW+EOnkWYbjETa/avPrQ6nmFSx20V34EPG5JkZWOrv1cxr8lE 3RrdB+wG6BgK/QZymlt5ulDEmPtLC7RigRIPgkz/s8o9FMO+QvczK98+J kBgu8wB/bJ92aBsvaHpm5srJPG0CE7nSBFUazeMyzeSaAqG0v+xagf2oW Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10252"; a="229828411" X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="229828411" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 03:02:28 -0800 X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="678506521" Received: from unknown (HELO localhost.localdomain) ([10.239.251.3]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 03:02:26 -0800 From: wenxuanx.wu@intel.com To: xiaoyun.li@intel.com, aman.deep.singh@intel.com Cc: dev@dpdk.org, junfeng.guo@intel.com, qiming.yang@intel.com Subject: [PATCH] app/testpmd : fix testpmd quit error Date: Wed, 9 Feb 2022 18:42:43 +0800 Message-Id: <20220209104243.117334-1-wenxuanx.wu@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 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 From: Wenxuan Wu when testpmd startup with pf and vfs, it is ok when running, while exiting, it will result in heap-free-after-use which means pf is released but vf is still accessing. Change the logic of func port_is_bonding_slave ,this func eth_dev_info_get_print_err while pf is released would result in this error. Fixes: 0a0821bcf312 ("app/testpmd: remove most uses of internal ethdev array") Cc: stable@dpdk.org Signed-off-by: Wenxuan Wu --- app/test-pmd/testpmd.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index e1da961311..7fa1944d78 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -3824,19 +3824,10 @@ void clear_port_slave_flag(portid_t slave_pid) uint8_t port_is_bonding_slave(portid_t slave_pid) { struct rte_port *port; - struct rte_eth_dev_info dev_info; - int ret; port = &ports[slave_pid]; - ret = eth_dev_info_get_print_err(slave_pid, &dev_info); - if (ret != 0) { - TESTPMD_LOG(ERR, - "Failed to get device info for port id %d," - "cannot determine if the port is a bonded slave", - slave_pid); - return 0; - } - if ((*dev_info.dev_flags & RTE_ETH_DEV_BONDED_SLAVE) || (port->slave_flag == 1)) + + if (port->slave_flag == 1) return 1; return 0; }