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 AAF55A057B; Wed, 1 Apr 2020 23:42:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0D1361C1B0; Wed, 1 Apr 2020 23:42:50 +0200 (CEST) Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) by dpdk.org (Postfix) with ESMTP id 9E52F1C1AE for ; Wed, 1 Apr 2020 23:42:48 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.west.internal (Postfix) with ESMTP id 7E3416DF; Wed, 1 Apr 2020 17:42:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Wed, 01 Apr 2020 17:42:47 -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=DsUPobOS5V0sh0v4cJ6z92OFTSVjqH3hW6tmoR/pMEw=; b=Ujeqr6yUI8qc wZ0J8rKKKRDWvxU6QEPTY8547f/AmwvRKvN19HV0yVOCDKaXHfTf5C42C0Js0gf1 uirLtymPbjeYVxnr2TMP1SxAI+FxoqomH7cDd8WoSq1iwG3vysjoNAE533bVH2IZ 8oKUEX6gP9lKg0P33bosXy9Ld+mqKW8= 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=DsUPobOS5V0sh0v4cJ6z92OFTSVjqH3hW6tmoR/pM Ew=; b=4Dtfer7EE/EVtcNUU/0MPD7hu1oj7YWwh7yrEr14Zd+Hsve+MG1pxwrSz uPuvviyDzACebj5u7fo4YoUbC2bmElGhp+C84I7m01iaVQHoJMSix4fLhQnM1CDL r9PQuCQKCZtzE6j78lqsRCAtKsIDu6cZJ/aGa6ZjervCGtYGbMHWwvM/byomQZzc T7PAj7IohEJviqkGl7idINXWQO/lqO4SaXlk+EM5AcGoHCTEx2aRvdGwwzUc1Ydp YwFQMfXXBQF9kUvttWBxyHKtGKm/UeSobAr+xL/wERXuVJRMyLmsb9D6Y/nHEfdV kyBrVZDZs2fCCJW643dGmLSa1V0eQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrtdefgddtvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucfkph epjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonhdrnhgvth 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 6140C3280063; Wed, 1 Apr 2020 17:42:46 -0400 (EDT) From: Thomas Monjalon To: Stephen Hemminger Cc: dev@dpdk.org, ferruh.yigit@intel.com, arybchenko@solarflare.com Date: Wed, 01 Apr 2020 23:42:44 +0200 Message-ID: <3879228.8TcEBkooeH@xps> In-Reply-To: <20200316160923.5335-2-stephen@networkplumber.org> References: <20200312172047.19973-1-stephen@networkplumber.org> <20200316160923.5335-1-stephen@networkplumber.org> <20200316160923.5335-2-stephen@networkplumber.org> 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" 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) [...] > +int > +rte_eth_dev_is_owned(uint16_t port_id) > +{ > + struct rte_eth_dev_owner owner; > + int ret; > + > + ret = rte_eth_dev_owner_get(port_id, &owner); > + if (ret == 0) > + ret = (owner.id != RTE_ETH_DEV_NO_OWNER); > + return ret; > +}