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 8BA57A00B9 for ; Mon, 1 Apr 2019 04:27:26 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6E26D4C8D; Mon, 1 Apr 2019 04:27:26 +0200 (CEST) Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 3DF9737A8 for ; Mon, 1 Apr 2019 04:27:24 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id E15D4213D0; Sun, 31 Mar 2019 22:27:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sun, 31 Mar 2019 22:27:23 -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=Y/jXyaPywd jCZAu/XY/EK4nK6mBsGnucbxHRmo+67ME=; b=BYOWvfKUPp3R0K0sMvddurV3qQ J3gUDeQxTwHSedUZU1F8d5Dvu5roV8uj5tjC70tN4hm9G/PPFAyX68FmqMGneNx7 qr511MyTQkISilA1v9Z717oNQcOpvtZnppI+z1a+3N3fwrkY/sean7hpu+W0cTwq 0pkFAylt8pyQNoE98= 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=Y/jXyaPywdjCZAu/XY/EK4nK6mBsGnucbxHRmo+67ME=; b=YspyAwsB b3JIQl84mxhksISFfSiiSFxMeEH2imqZZhSPZqqDq5RnBMdq7p18SZinsaqHoxGa Sq+5UxwAu2Knl/T01mz4QSpF3Ve9l+Ok6auN83dj2+mjWBO/XB3cKBYd6SgT+CuW dg9dLqI61vUFowHzXBnoAvud6UwDOQHMgUSGPV+iTJJ+oHbr4bFamphpmUWONFvT elhdSR3tmQwxh9thEHfmmxxU6j8Py84ycRSCTRLYGt4suhGmcaA5gBkKZ/DEVprb S3GtYsVZfhwZjad5patTS29irJO50OrGqrkj26KbYE2INaoAR9XXfUrQWoPUzYLL UAgAp3QSNQ5vJQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrleefgdehlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhho mhgrshesmhhonhhjrghlohhnrdhnvghtnecuvehluhhsthgvrhfuihiivgepud 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 9B4D410392; Sun, 31 Mar 2019 22:27:22 -0400 (EDT) From: Thomas Monjalon To: gaetan.rivet@6wind.com, Ferruh Yigit , Andrew Rybchenko Cc: dev@dpdk.org Date: Mon, 1 Apr 2019 04:26:57 +0200 Message-Id: <20190401022700.1570-2-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 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190401022657.65Ct8QABQPRJIFKkptcidYz2BA1zpl20xovCeqC663Q@z> 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 Reviewed-by: Andrew Rybchenko --- 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 10bdfb37e..33cffc498 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -330,8 +330,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) @@ -567,8 +566,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.21.0