From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: [PATCH v2 4/4] app/testpmd: use port sibling iterator in device cleanup Date: Wed, 20 Feb 2019 23:10:51 +0100 Message-ID: <20190220221051.7928-5-thomas@monjalon.net> References: <20181130002716.27325-1-thomas@monjalon.net> <20190220221051.7928-1-thomas@monjalon.net> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Cc: dev@dpdk.org To: Wenzhuo Lu , Jingjing Wu , Bernard Iremonger Return-path: Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by dpdk.org (Postfix) with ESMTP id 6AC8025B3 for ; Wed, 20 Feb 2019 23:11:14 +0100 (CET) In-Reply-To: <20190220221051.7928-1-thomas@monjalon.net> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When removing a rte_device on a port-based request, all the sibling ports must be marked as closed. The iterator loop can be simplified by using the dedicated macro. Signed-off-by: Thomas Monjalon --- app/test-pmd/testpmd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 98c1baa8b1..fcc479aa39 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2361,9 +2361,7 @@ detach_port_device(portid_t port_id) return; } - for (sibling = 0; sibling < RTE_MAX_ETHPORTS; sibling++) { - if (rte_eth_devices[sibling].device != dev) - continue; + RTE_ETH_FOREACH_DEV_SIBLING(sibling, port_id) { /* reset mapping between old ports and removed device */ rte_eth_devices[sibling].device = NULL; if (ports[sibling].port_status != RTE_PORT_CLOSED) { -- 2.20.1