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 88D07A058A; Thu, 2 Apr 2020 10:04:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A12B11BE0C; Thu, 2 Apr 2020 10:04:38 +0200 (CEST) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 8A0822B8B for ; Thu, 2 Apr 2020 10:04:37 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id EBEA45C019E; Thu, 2 Apr 2020 04:04:33 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Thu, 02 Apr 2020 04:04:33 -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=EXZb8GVsQcQMS6mxMtzjHV0T9dmhn1K/YCwdVbn67p4=; b=Q7zXXp+M+GTF T73AS9yb9sCg1nuwuJbqOGXBJ6tz7RDScK/0sfc7vBnt5qChnbN/t68xDEDeQtGi 96oRedxLX/6KpigHP07VYC+YOZrNyIMYtZpHM7xOzAilSsoxIAcVYjwBws4mucLv iHlXWaFHQ6gDNcSiF9v4BpP8N7oEzC0= 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=EXZb8GVsQcQMS6mxMtzjHV0T9dmhn1K/YCwdVbn67 p4=; b=mgln7rkmr2YLD9K3yt5/XW7w5Pfwwd72lA+i/iz8KP3qDv8M3fdwN+GC0 /eUn0vLxTVvgAkJs+7bIPB4Fl1UP7qk/vn6IJV3lm4saLEQCwosAwfVuIYzB5M+I llraVJIYw1CaLy4jzNbaCHWTdO2EOotnOLKZ/pKiIiuwML5HeukJSwWUkpRikOIV qfsQBomXm259nwbSGfYPxHOYIVBmbSMWWsD0S+lDJf2vu0WDP3xruE/olHYhrYCG FD6cepUhuxSPtGtQ4QB4ItUeJiwHkavfgXieFmgGEwhVNbqUFfoiQ0TyeQm2hOuk mD3JeCxNr82ypPDlCbcqr14POJKew== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrtdegucetufdoteggodetrfdotffvucfrrh hofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurh ephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgrshcuofho nhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecukfhppeejje drudefgedrvddtfedrudekgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght 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 C96FB306CDD4; Thu, 2 Apr 2020 04:04:32 -0400 (EDT) From: Thomas Monjalon To: Stephen Hemminger Cc: dev@dpdk.org, ferruh.yigit@intel.com, arybchenko@solarflare.com Date: Thu, 02 Apr 2020 10:04:31 +0200 Message-ID: <1615261.UtaOMtURT2@xps> In-Reply-To: <20200401152443.7fb1cc6b@hermes.lan> References: <20200312172047.19973-1-stephen@networkplumber.org> <3879228.8TcEBkooeH@xps> <20200401152443.7fb1cc6b@hermes.lan> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v2 1/6] rte_ethdev: add function to check if device is owned 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" 02/04/2020 00:24, Stephen Hemminger: > On Wed, 01 Apr 2020 23:42:44 +0200 > Thomas Monjalon wrote: > > > 16/03/2020 17:09, Stephen Hemminger: > > > This is a simple helper function to check if device is owned > > > (being used as a sub-device). > > > > I would suggest not restricting ownership to sub-device case. > > > > > It is more convienent than having > > > applications call rte_eth_dev_owner_get and check the result. > > > > Yes it is more convenient but I don't like adding such simple wrapper. > > > > I propose to extend rte_eth_dev_owner_get() behaviour: > > if the owner pointer is NULL, the function returns 0 only > > if an owner (not RTE_ETH_DEV_NO_OWNER) is found. > > > > So instead of using your wrapper: > > if (rte_eth_dev_is_owned(port_id)) > > you can use: > > if (rte_eth_dev_owner_get(port_id, NULL) == 0) > > That is not how rte_eth_dev_owner_get works now. > Passing NULL to it would crash. Indeed this is why I am proposing to extend it and fill this case. > And if devices is not owned rte_eth_dev_owner_get() returns 0 > and owner is set to a magic value. We could change the ABI for this > since it is marked experimental. But that seems more risky. This is not an ABI change. Just manage a case which was crashing previously.