From patchwork Wed Feb 9 10:38:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wu, WenxuanX" X-Patchwork-Id: 107122 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 D95A2A04A9; Wed, 9 Feb 2022 11:58:03 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A0CC741144; Wed, 9 Feb 2022 11:58:03 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id D05D941143 for ; Wed, 9 Feb 2022 11:58:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644404282; x=1675940282; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=07P0/rbQKaWlVg0T/EF+JQxJ/4bZXNhrplah0gPbg1I=; b=H4MlTZREw5uXagMXKElQZHqlm6sgdxa5cvcQqXuEyO+aQKw7D4NIIaKq ewFWKK1OUEQ7BXBU5eMV7c/ho/7ud3VqEawnI4zPAklJ0YfbpEdGNNcIY BLCp4RktJcXHarw5TcDGrlsWvlkailqPmpV/MAEKvtMiHH+Cxqae1KbvZ 9QD+z7oBtJOodb8YYi7rk+iPSpEIlD6FJRJGwCxJ0Wizd/j8GVcUOLO7P ibPEKBn+h/KtNWrrLGOghZtxn2aMiHnGDDDWwXCFRW3uCdWW+M+xZ78wG 3H2LmAyNd7DuZyVeVZt/204GSwpHh6WnJh9UFb2jycDywFLzQnmDz9D72 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10252"; a="248011989" X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="248011989" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 02:58:00 -0800 X-IronPort-AV: E=Sophos;i="5.88,355,1635231600"; d="scan'208";a="541044515" Received: from unknown (HELO localhost.localdomain) ([10.239.251.3]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 02:57:58 -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:38:13 +0800 Message-Id: <20220209103813.116121-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 starup 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; }