From patchwork Fri Apr 12 15:48:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Slava Ovsiienko X-Patchwork-Id: 52724 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C380C1B1F5; Fri, 12 Apr 2019 17:48:18 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 61A9A1B1EB for ; Fri, 12 Apr 2019 17:48:17 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from viacheslavo@mellanox.com) with ESMTPS (AES256-SHA encrypted); 12 Apr 2019 18:48:14 +0300 Received: from pegasus12.mtr.labs.mlnx. (pegasus12.mtr.labs.mlnx [10.210.17.40]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x3CFmE1O018382; Fri, 12 Apr 2019 18:48:14 +0300 From: Viacheslav Ovsiienko To: dev@dpdk.org Cc: ferruh.yigit@intel.com Date: Fri, 12 Apr 2019 15:48:11 +0000 Message-Id: <1555084091-24641-1-git-send-email-viacheslavo@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH 1/1] app/testpmd: fix port detach cleanup 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" At port detach routine after calling the rte_dev_remove() testpmd performs some cleanup, checking the statuses of remaining ports and closes the appropriate ones. The port scanning is based on the new sibling iterator which uses the invalid (already closed) port for reference. This patch replaces the foreach iterator and uses the device object for reference. It is worth to note this cleanup is not needed for some drivers (at least for mlx5 and probably for others) and is preserved due to possible compatibility issues. Fixes: 13302cd5bd63 ("app/testpmd: use port sibling iterator in device cleanup") Signed-off-by: Viacheslav Ovsiienko Acked-by: Yongseok Koh Acked-by: Thomas Monjalon --- app/test-pmd/testpmd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index aeaa74c..739f96e 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2369,8 +2369,7 @@ struct extmem_param { TESTPMD_LOG(ERR, "Failed to detach device %s\n", dev->name); return; } - - RTE_ETH_FOREACH_DEV_SIBLING(sibling, port_id) { + RTE_ETH_FOREACH_DEV_OF(sibling, dev) { /* reset mapping between old ports and removed device */ rte_eth_devices[sibling].device = NULL; if (ports[sibling].port_status != RTE_PORT_CLOSED) {