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 5F090A057B; Thu, 2 Apr 2020 00:24:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AB66E1C11F; Thu, 2 Apr 2020 00:24:55 +0200 (CEST) Received: from mail-pj1-f67.google.com (mail-pj1-f67.google.com [209.85.216.67]) by dpdk.org (Postfix) with ESMTP id 6895C1C11E for ; Thu, 2 Apr 2020 00:24:53 +0200 (CEST) Received: by mail-pj1-f67.google.com with SMTP id q16so2616673pje.1 for ; Wed, 01 Apr 2020 15:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1u0CW1344Ts7e+bz095s5BN+SlMeHWDOT9gRkypWQ68=; b=ScQ5Y7b9rMqG8u/+50y86yl62725raUUnXlpQhla8Sxb6g+UdWIipU+oT9lu65Fj37 doJpZTp39pmhbcGoT5zsXZ3fzeRXpESHzjYW2/EeVD5Hyk/IIiSnAJTc/U/TG532L3aX P3xRVvbhmyqy/Kox/kj/uEvY0XKe/83DC96qNJmNcTaQ44E1ZVCG5BeRp5f1qcli3Hun gBgG9rT2CqLdt1DWoOhp8Ge+7w36MhpiVH2D8DAK2kp1s8hyqh1FZr2DdWqRwixifId3 UDcweQNOHhEB5DjqfHgpfLjlFicMFn53+c/xt4MuvHVi4/er2oHN1Ap19pVXgcUtQlLu y+4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1u0CW1344Ts7e+bz095s5BN+SlMeHWDOT9gRkypWQ68=; b=ixoKB+19MA2vcjChCKUKk13bLHRnKecg4P/O4zAetbr6QSH4/nlVXFCAowokvMeTS3 MmseDumGQvduT8ZPOEqIVxCoJLWtUNI4bmKUmAC4AAOuqs35hu2FMcPflFac8Xey0Qqm C+TDM0/T9L63+t4id0PnGEeZCSFfKa9/0M4wu41B7v6KGhI7UEycHfOxXCPFlaELmCDv jTRJ3QlkUSUldwnxqIZ37bUDrzL03VBIMA70QLaOpPK8djAcoN26Wxj5/aeAVVBlgGVW paKsmHp18iFL+4tieYqdz7XCrymTUCLetAHKUTzByw482kC2iNT9PQRMkg5nTojpPxPg S5HA== X-Gm-Message-State: AGi0PuZdpkSxIIo+PUZOkUV/xAda/Xxs9FQs798V26EUnwHR6HQSlGxh uzTZmqJ/IYnjRPI/ZwjpNGAawA== X-Google-Smtp-Source: APiQypIOJNuyPgV0QE2pCDZ7g9jVc7N1HTBCKQO+wt9zrhHU32sT/qo7J4P/WaZAVZ90E5uHuPKCKw== X-Received: by 2002:a17:90a:a889:: with SMTP id h9mr256255pjq.40.1585779892261; Wed, 01 Apr 2020 15:24:52 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id f5sm2288654pfq.63.2020.04.01.15.24.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2020 15:24:51 -0700 (PDT) Date: Wed, 1 Apr 2020 15:24:43 -0700 From: Stephen Hemminger To: Thomas Monjalon Cc: dev@dpdk.org, ferruh.yigit@intel.com, arybchenko@solarflare.com Message-ID: <20200401152443.7fb1cc6b@hermes.lan> In-Reply-To: <3879228.8TcEBkooeH@xps> References: <20200312172047.19973-1-stephen@networkplumber.org> <20200316160923.5335-1-stephen@networkplumber.org> <20200316160923.5335-2-stephen@networkplumber.org> <3879228.8TcEBkooeH@xps> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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" 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. 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.