From patchwork Wed Feb 20 22:10:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 50401 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 AEED02BBE; Wed, 20 Feb 2019 23:11:18 +0100 (CET) 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) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 458CA2FF0; Wed, 20 Feb 2019 17:11:13 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 20 Feb 2019 17:11:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=mesmtp; bh=JRyOe0bfOC eXZg3DM+J45rO9x1FpXWLRUhhCiMy/UVM=; b=QTQ9/pfOJRoiUVnmuD/Zvz1kJl nQQ8w8jteJVTJho/1Xc72j6nxaCo6i6vpiQovWrE/sbmazqB6lF1JVM05MxPCFtj 3GIrFMosilUPNcr4dB7KfFYHru30yAWoFGpTt5HxIUsTv+cViZGxjHG2bEjOp9Fi NqUwgPQYP2MnInuNk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=JRyOe0bfOCeXZg3DM+J45rO9x1FpXWLRUhhCiMy/UVM=; b=5KETk9oN msQMx1ECG/vMKXroNwZtadna9304t5w1FUWa83+WQ8aat8m933vDN3GrQBsMAzZ+ kGFrKUKlhU2/ZqhkRG82DmzGvb4kGwO/caFMRJy/LJQqFe9tV46AL98q31ZCQH0L vy8ffw00tA5xhnwGw2VA4N5MBoXAElUVG0QK0k0ea+o9UhyMI5g5v7VLHu0+uHhi livou03i8Vvs/clzJZyomGmhf3sD6uoMJ4Hb54i7lfZq0s/yRyt+L+az+TyxMpAa rhRc0mLFFeQUujMEiZDqzUAsKjcCbLQS7ya8fCuRz90QqJ6612CZhnEf7qn+8eGF hJUFbJVn9vEEcQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrtdeigdduheekucdltddurdegtdelrddttd dmucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhht necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc fkphepjeejrddufeegrddvtdefrddukeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpeht hhhomhgrshesmhhonhhjrghlohhnrdhnvghtnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id F3AA610328; Wed, 20 Feb 2019 17:11:11 -0500 (EST) From: Thomas Monjalon To: Wenzhuo Lu , Jingjing Wu , Bernard Iremonger Cc: dev@dpdk.org Date: Wed, 20 Feb 2019 23:10:51 +0100 Message-Id: <20190220221051.7928-5-thomas@monjalon.net> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190220221051.7928-1-thomas@monjalon.net> References: <20181130002716.27325-1-thomas@monjalon.net> <20190220221051.7928-1-thomas@monjalon.net> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 4/4] app/testpmd: use port sibling iterator in device 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" 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) {