From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 716844CAF for ; Mon, 1 Apr 2019 04:27:32 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 1D7FA21AC2; Sun, 31 Mar 2019 22:27:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sun, 31 Mar 2019 22:27:32 -0400 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=v1l3X7isGG NuEN/UFjRga+merC5xmwF5P55qowPRckk=; b=EMxpnswsmqk1v9Y+W2WP5v17CK MWN0r7FR33wI7dfJHcuU1wfMPg3f/JkEXiBk59Tc1whkHooFIWrzgK1YysqwdHJy UZ9+tq3whLFGOGs/AvH/VeYj879qdq26VnCQ2bGi5HvGAlNnkE242a69025QNYG7 Q3AZG9Nc06a761t7E= 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=v1l3X7isGGNuEN/UFjRga+merC5xmwF5P55qowPRckk=; b=B4LyFRZO pRo7ns7VcXPWYBOo46jJRbK3KtpTriWKmEMKwMhm+KM6v8U4P96/OPVmb3KZJhfT boFDB7wei2mTMNSNy03EEOWU0hYkn709vErexZfINkPR+Mb0Hc2wD4NDERh369jf s7ChAuz0lur2kC8dIDp8fEvoLZfa5b7t/UI7l1Lq+gjcWbvl4NV492IkK4e76zOk zoDFrtHS2KBARYK4F0+xO9N85/pgowtTRx8FcC2HFEdF4YQqAWuFJe9mCxb3VbnJ GU65uGh9kZMyE8MSjUZmyzzoLDeFnS2d/jUHxfYv1cbjnmauJqAaqAGX03bM2hh+ SndN7dU/VUUzmA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrleefgdehlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhho mhgrshesmhhonhhjrghlohhnrdhnvghtnecuvehluhhsthgvrhfuihiivgepge 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 05B3010392; Sun, 31 Mar 2019 22:27:30 -0400 (EDT) From: Thomas Monjalon To: gaetan.rivet@6wind.com, Wenzhuo Lu , Jingjing Wu , Bernard Iremonger Cc: dev@dpdk.org Date: Mon, 1 Apr 2019 04:27:00 +0200 Message-Id: <20190401022700.1570-5-thomas@monjalon.net> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190401022700.1570-1-thomas@monjalon.net> References: <20181130002716.27325-1-thomas@monjalon.net> <20190401022700.1570-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 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: , X-List-Received-Date: Mon, 01 Apr 2019 02:27:32 -0000 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 40c873b97..aeaa74c98 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2370,9 +2370,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.21.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 3E636A00B9 for ; Mon, 1 Apr 2019 04:27:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AEFE04CC3; Mon, 1 Apr 2019 04:27:34 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 716844CAF for ; Mon, 1 Apr 2019 04:27:32 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 1D7FA21AC2; Sun, 31 Mar 2019 22:27:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sun, 31 Mar 2019 22:27:32 -0400 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=v1l3X7isGG NuEN/UFjRga+merC5xmwF5P55qowPRckk=; b=EMxpnswsmqk1v9Y+W2WP5v17CK MWN0r7FR33wI7dfJHcuU1wfMPg3f/JkEXiBk59Tc1whkHooFIWrzgK1YysqwdHJy UZ9+tq3whLFGOGs/AvH/VeYj879qdq26VnCQ2bGi5HvGAlNnkE242a69025QNYG7 Q3AZG9Nc06a761t7E= 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=v1l3X7isGGNuEN/UFjRga+merC5xmwF5P55qowPRckk=; b=B4LyFRZO pRo7ns7VcXPWYBOo46jJRbK3KtpTriWKmEMKwMhm+KM6v8U4P96/OPVmb3KZJhfT boFDB7wei2mTMNSNy03EEOWU0hYkn709vErexZfINkPR+Mb0Hc2wD4NDERh369jf s7ChAuz0lur2kC8dIDp8fEvoLZfa5b7t/UI7l1Lq+gjcWbvl4NV492IkK4e76zOk zoDFrtHS2KBARYK4F0+xO9N85/pgowtTRx8FcC2HFEdF4YQqAWuFJe9mCxb3VbnJ GU65uGh9kZMyE8MSjUZmyzzoLDeFnS2d/jUHxfYv1cbjnmauJqAaqAGX03bM2hh+ SndN7dU/VUUzmA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrleefgdehlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhho mhgrshesmhhonhhjrghlohhnrdhnvghtnecuvehluhhsthgvrhfuihiivgepge 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 05B3010392; Sun, 31 Mar 2019 22:27:30 -0400 (EDT) From: Thomas Monjalon To: gaetan.rivet@6wind.com, Wenzhuo Lu , Jingjing Wu , Bernard Iremonger Cc: dev@dpdk.org Date: Mon, 1 Apr 2019 04:27:00 +0200 Message-Id: <20190401022700.1570-5-thomas@monjalon.net> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190401022700.1570-1-thomas@monjalon.net> References: <20181130002716.27325-1-thomas@monjalon.net> <20190401022700.1570-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190401022700.0i2ckWC62qTA8x2f1kfz-alYtL8_LksfD-onpZQ9GIw@z> 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 40c873b97..aeaa74c98 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2370,9 +2370,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.21.0