From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by dpdk.org (Postfix) with ESMTP id C701B1E34 for ; Wed, 20 Feb 2019 23:11:11 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id AC7DB2FF0; Wed, 20 Feb 2019 17:11:10 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 20 Feb 2019 17:11:11 -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=g4CkDtIqkM BWsModce2uVuQLyE8IL25kpw0P6odjEsc=; b=C8hx4ItGxwuOHqPKbq4iqBh3lC FfwFoTZNa6Rq0ABQzCv9Hum0a3vIwWdKfoIh371fgbM+NpQ5jn+D9lvWXdD7rIB4 +0RInbARWNqUADemhCYLOlapsXqaiHTszOKZbJt6beY+OxVb4Xf5l1qrhs9ImunT EgKtu4uVUoPmvHeds= 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=g4CkDtIqkMBWsModce2uVuQLyE8IL25kpw0P6odjEsc=; b=r7BNwhYL I29C0NCfxe7qZYtakI8bvOpxBlsgvoefNeKCRCRi8odPTIuixZiaqc9/EofFLDJ6 X9kK22Bwws8L/ljTLG5kQWeqqg/h0V17NSelj1suo/uJlsQp2Ovw9W1vbheMCQp/ 5Grga+3Bl/mY4/gSTXl6dJplryWhcpCxwsRue6tM3YHHtJQJpFoI837cCfAfdjQs FlfTw5PvLTW5jD5PxDF4MUQP91+5xm38Df+N4zZbVTkK/4AoWedDicigacOkmwWG RQr7sk/yE0Ihw55FxXyxI2Sv61G2XVZEh2e/vUGj9gQQYLzSpqx2z7Oh4xC9p88h emz09kcrvs2hyg== 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 1133A10319; Wed, 20 Feb 2019 17:11:08 -0500 (EST) From: Thomas Monjalon To: Ferruh Yigit , Andrew Rybchenko Cc: dev@dpdk.org Date: Wed, 20 Feb 2019 23:10:48 +0100 Message-Id: <20190220221051.7928-2-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 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 1/4] ethdev: simplify port state comparisons 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: Wed, 20 Feb 2019 22:11:12 -0000 There are three states for an ethdev port. Checking that the port is unused looks simpler than checking it is neither attached nor removed. Signed-off-by: Thomas Monjalon --- lib/librte_ethdev/rte_ethdev.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 0d192a24b2..b3b2fb1dba 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -331,8 +331,7 @@ uint16_t rte_eth_find_next(uint16_t port_id) { while (port_id < RTE_MAX_ETHPORTS && - rte_eth_devices[port_id].state != RTE_ETH_DEV_ATTACHED && - rte_eth_devices[port_id].state != RTE_ETH_DEV_REMOVED) + rte_eth_devices[port_id].state == RTE_ETH_DEV_UNUSED) port_id++; if (port_id >= RTE_MAX_ETHPORTS) @@ -558,8 +557,7 @@ uint64_t rte_eth_find_next_owned_by(uint16_t port_id, const uint64_t owner_id) { while (port_id < RTE_MAX_ETHPORTS && - ((rte_eth_devices[port_id].state != RTE_ETH_DEV_ATTACHED && - rte_eth_devices[port_id].state != RTE_ETH_DEV_REMOVED) || + (rte_eth_devices[port_id].state == RTE_ETH_DEV_UNUSED || rte_eth_devices[port_id].data->owner.id != owner_id)) port_id++; -- 2.20.1