From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 92FEBA0561; Sun, 19 Apr 2020 21:36:54 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5410C1C43E; Sun, 19 Apr 2020 21:36:53 +0200 (CEST) Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by dpdk.org (Postfix) with ESMTP id A47BC1C439 for ; Sun, 19 Apr 2020 21:36:51 +0200 (CEST) X-Originating-IP: 86.246.31.132 Received: from u256.net (lfbn-idf2-1-566-132.w86-246.abo.wanadoo.fr [86.246.31.132]) (Authenticated sender: grive@u256.net) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 563A21BF207; Sun, 19 Apr 2020 19:36:49 +0000 (UTC) Date: Sun, 19 Apr 2020 21:36:35 +0200 From: =?utf-8?Q?Ga=C3=ABtan?= Rivet To: Stephen Hemminger Cc: dev@dpdk.org, Chas Williams , Liron Himi , Andrew Rybchenko , Thomas Monjalon Message-ID: <20200419193635.tpltb5qldsmxngh7@u256.net> References: <20200417134435.53da1af8@hermes.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200417134435.53da1af8@hermes.lan> Subject: Re: [dpdk-dev] [PATCH v1] ethdev: add rte_device to port_id function 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" On 17/04/20 13:44 -0700, Stephen Hemminger wrote: > On Fri, 17 Apr 2020 18:48:37 +0200 > Gaetan Rivet wrote: > > > +/** > > + * Find the owned ethdev port id of an `rte_device`. > > + * > > + * @param dev > > + * An `rte_device`. > > + * @param owner > > + * An owner id. Use `RTE_ETH_DEV_NO_OWNER` for ownerless ports. > > + * > > + * @return > > + * The port id of an `rte_device` if it is owned by `owner`. > > + * `RTE_MAX_ETHPORTS` otherwise. > > + */ > > +__rte_experimental > > +uint16_t rte_eth_port_from_dev_owned_by(const struct rte_device *dev, > > + const uint64_t owner); > > + > > Ok, but why introduce API with no users? > Also a device could in theory be owned multiple times by the same owner. > For example if two NIC's from same vendor were used in bonding. I'm not sure what you mean by a device being owned multiple times by the same owner. However if that's what you are referencing, the issue here is of course the multiple ports spawning from a single device. I forgot about this edge-case, so this API is incorrect. This also means that my "fix" for bonding is incorrect. The current API, RTE_ETH_FOREACH_DEV_OF(), does not offer an owner-aware version. If the ownership model is bound to continue as it is, it should probably offer a variant. The problem is that port iterators in ethdev are already too many, I don't know how a user could make sense of it. Thanks for the comment Stephen, this patch should be dropped. -- Gaëtan