From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id D334E1BC1D for ; Thu, 18 Apr 2019 19:38:28 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 5DB6930368; Thu, 18 Apr 2019 13:38:28 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 18 Apr 2019 13:38:28 -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:content-type; s=mesmtp; bh=y21j6sF6S/OqbLXcTKUGoDMmRxQIAElGzwBTT5id7Ak=; b=ayCtnDXACr0a O1/uLQqhXWcATRpoZ4AwAqwJauDiCBcYoM3bxZ+kGAWMxTXqeGCnyWmWG5jmsd8/ bgunyRISvDLmwlgxNwj2ew+bjwFN71r/1AoyPqd0HKrKiSXuVCBunHdKU4otoUNp BM6cifI3awA8zE9ankrHjYdUHEozO04= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :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=y21j6sF6S/OqbLXcTKUGoDMmRxQIAElGzwBTT5id7 Ak=; b=BWX72V9qDK7Vd+05fxUwb3XZJAeVi7mctpn5oD4iHrBllGiGl/D/8S0sy dC+JEdksIS+D9Udx9DRp1aqors+CT4XiPotb4qS9fjUUfnPY7CYI4eA4AiZggMOn ZtOwd3nEhgqd3kE9hFnbUuVuvB1kMxbOzcKtWl85kM1YOOCGeUoQJVNf7Je0GcPr 8WSMPeZ0gXSfhCDZGESxU1TsHQPV5XZUQvbLqPd1cM3Z7CpK9U756OlDiH02LICc q5dqoRqbveZbWmdKLJIPSyz+kpvdXgQmT2PyTefbIQW550UF5y7M9fGYBf3T8S+K lMAvDI10tfM5wbiaiYGGa/g80wkRw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrfeehgdehvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhho mhgrshesmhhonhhjrghlohhnrdhnvghtnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id ABFE9E4448; Thu, 18 Apr 2019 13:38:26 -0400 (EDT) From: Thomas Monjalon To: Ferruh Yigit Cc: dev@dpdk.org, Shahaf Shuler , Yongseok Koh , Andrew Rybchenko Date: Thu, 18 Apr 2019 19:38:25 +0200 Message-ID: <2681438.eLSQ0opes9@xps> In-Reply-To: <3775228.0GTJhU53Hy@xps> References: <20190417225928.8962-1-thomas@monjalon.net> <3775228.0GTJhU53Hy@xps> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH 1/2] ethdev: avoid explicit check of valid port state 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: Thu, 18 Apr 2019 17:38:29 -0000 18/04/2019 14:47, Thomas Monjalon: > 18/04/2019 13:50, Ferruh Yigit: > > On 4/17/2019 11:59 PM, Thomas Monjalon wrote: > > > Some port iterations are manually checking against RTE_ETH_DEV_UNUSED > > > instead of using the iterators based on rte_eth_find_next(). > > > > > > A new macro RTE_ETH_FOREACH_VALID_DEV() is introduced, but kept private > > > because there should be no need of iterating over all devices in the API. > > > The public iterators have additional filters for ownership, parent device > > > or sibling ports. > > > > > > Signed-off-by: Thomas Monjalon > > > --- > > > +#define RTE_ETH_FOREACH_VALID_DEV(port_id) \ > > > + for (port_id = rte_eth_find_next(0); \ > > > + port_id < RTE_MAX_ETHPORTS; \ > > > + port_id = rte_eth_find_next(port_id + 1)) > > > + > > > > What do you think adding some documentation to the new macro, specially I think > > documenting the difference between "RTE_ETH_FOREACH_DEV" and this one can be > > good otherwise it may confuse people that "RTE_ETH_FOREACH_DEV" iterates on > > invalid devices too? > > This one is not part of the API. > I am not sure what I can document more than "iterating all valid ports"? > About RTE_ETH_FOREACH_DEV, it is already documented: > "Macro to iterate over all enabled and ownerless ethdev ports." OK, let's add a comment to explain the difference: /* * Macro to iterate over all valid ports for internal usage. * Note: RTE_ETH_FOREACH_DEV is different because filtering owned ports. */ 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 E4DE3A00E6 for ; Thu, 18 Apr 2019 19:38:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9D4A31BC1E; Thu, 18 Apr 2019 19:38:29 +0200 (CEST) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id D334E1BC1D for ; Thu, 18 Apr 2019 19:38:28 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 5DB6930368; Thu, 18 Apr 2019 13:38:28 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 18 Apr 2019 13:38:28 -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:content-type; s=mesmtp; bh=y21j6sF6S/OqbLXcTKUGoDMmRxQIAElGzwBTT5id7Ak=; b=ayCtnDXACr0a O1/uLQqhXWcATRpoZ4AwAqwJauDiCBcYoM3bxZ+kGAWMxTXqeGCnyWmWG5jmsd8/ bgunyRISvDLmwlgxNwj2ew+bjwFN71r/1AoyPqd0HKrKiSXuVCBunHdKU4otoUNp BM6cifI3awA8zE9ankrHjYdUHEozO04= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :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=y21j6sF6S/OqbLXcTKUGoDMmRxQIAElGzwBTT5id7 Ak=; b=BWX72V9qDK7Vd+05fxUwb3XZJAeVi7mctpn5oD4iHrBllGiGl/D/8S0sy dC+JEdksIS+D9Udx9DRp1aqors+CT4XiPotb4qS9fjUUfnPY7CYI4eA4AiZggMOn ZtOwd3nEhgqd3kE9hFnbUuVuvB1kMxbOzcKtWl85kM1YOOCGeUoQJVNf7Je0GcPr 8WSMPeZ0gXSfhCDZGESxU1TsHQPV5XZUQvbLqPd1cM3Z7CpK9U756OlDiH02LICc q5dqoRqbveZbWmdKLJIPSyz+kpvdXgQmT2PyTefbIQW550UF5y7M9fGYBf3T8S+K lMAvDI10tfM5wbiaiYGGa/g80wkRw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrfeehgdehvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhho mhgrshesmhhonhhjrghlohhnrdhnvghtnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id ABFE9E4448; Thu, 18 Apr 2019 13:38:26 -0400 (EDT) From: Thomas Monjalon To: Ferruh Yigit Cc: dev@dpdk.org, Shahaf Shuler , Yongseok Koh , Andrew Rybchenko Date: Thu, 18 Apr 2019 19:38:25 +0200 Message-ID: <2681438.eLSQ0opes9@xps> In-Reply-To: <3775228.0GTJhU53Hy@xps> References: <20190417225928.8962-1-thomas@monjalon.net> <3775228.0GTJhU53Hy@xps> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH 1/2] ethdev: avoid explicit check of valid port state 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" Message-ID: <20190418173825.hhK-CYm9YKr05ae-JPHqXcpSy21_Kg-J-aByemlXTpA@z> 18/04/2019 14:47, Thomas Monjalon: > 18/04/2019 13:50, Ferruh Yigit: > > On 4/17/2019 11:59 PM, Thomas Monjalon wrote: > > > Some port iterations are manually checking against RTE_ETH_DEV_UNUSED > > > instead of using the iterators based on rte_eth_find_next(). > > > > > > A new macro RTE_ETH_FOREACH_VALID_DEV() is introduced, but kept private > > > because there should be no need of iterating over all devices in the API. > > > The public iterators have additional filters for ownership, parent device > > > or sibling ports. > > > > > > Signed-off-by: Thomas Monjalon > > > --- > > > +#define RTE_ETH_FOREACH_VALID_DEV(port_id) \ > > > + for (port_id = rte_eth_find_next(0); \ > > > + port_id < RTE_MAX_ETHPORTS; \ > > > + port_id = rte_eth_find_next(port_id + 1)) > > > + > > > > What do you think adding some documentation to the new macro, specially I think > > documenting the difference between "RTE_ETH_FOREACH_DEV" and this one can be > > good otherwise it may confuse people that "RTE_ETH_FOREACH_DEV" iterates on > > invalid devices too? > > This one is not part of the API. > I am not sure what I can document more than "iterating all valid ports"? > About RTE_ETH_FOREACH_DEV, it is already documented: > "Macro to iterate over all enabled and ownerless ethdev ports." OK, let's add a comment to explain the difference: /* * Macro to iterate over all valid ports for internal usage. * Note: RTE_ETH_FOREACH_DEV is different because filtering owned ports. */