From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 22F93A00E6
	for <public@inbox.dpdk.org>; Sun,  7 Jul 2019 18:47:32 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 301ED324D;
	Sun,  7 Jul 2019 18:47:31 +0200 (CEST)
Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com
 [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id E83C93237
 for <dev@dpdk.org>; Sun,  7 Jul 2019 18:47:28 +0200 (CEST)
Received: by mail-pg1-f196.google.com with SMTP id q4so6436539pgj.8
 for <dev@dpdk.org>; Sun, 07 Jul 2019 09:47:28 -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=/gpWuwyGoJPEFNItR5qvgbU7ivcWM0tMLEIfYrI8FQs=;
 b=b1LnsVURI+WA6ADS3/oAsFUXfs3zaZPt74ifpoz46CdknV2sq0epkoCOuERzODxDAa
 goU04bl+IuBOxsMiNYRgCOMAkJsjUWv+woDA6b0xfha/xTxXZQ1TuSi3V7h4IBjhr9gw
 y91HmnuPnNvsulP8d7JzmLm4EEP+WuokO8bCMuPvsqjsOmWme06rL2hRJO3qPbtAvZhg
 ylWdpUV6QxRoMhVAWW0fPBcYdcAUfQcsaHagiSPkqFicsbT7sEqGdaqJ05UekDITIKZE
 1JdMy9VvkPiLfpzEaOztsWrlxfe9/P/oLPMck5mmULdEG/kvbmU5Tp2WRmJaLZYhLVvw
 t8gQ==
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=/gpWuwyGoJPEFNItR5qvgbU7ivcWM0tMLEIfYrI8FQs=;
 b=euw4d9AVginL48/rCd2wW5KEnrSiTPK073wzUYpEOQQWPNcjEP967v+2QmDVZ6MNzE
 s62c+iIkrSTvqthWqAlw7T2L1Lyolv+7zuknmfyZc7Ip8hugfSoIFC+O7iyD86gFiJhG
 ZliRa7LvBYCBbCva2FQWeVO0EjpjmA9VqGjhDca55n1tnFwYOxP9VNX7XJ6f/a74lP6a
 kKX9boFQz9kFK+1xOTBOhdJXCBB1JfyrRF/gvW6sL6qw1UVahuTHJEeSs672lxld5MXn
 Cfg8Os7Y62ATGQMYMPc7u3ChiMqsA1e9+LIB4/VE86IQNIm43aFeszXUmafV6+K38GTo
 mLqg==
X-Gm-Message-State: APjAAAUL8Y8aHFXs6g7MV380AwerAa6zCK3H1oFee589Yme8DahpKJy6
 k4hv+JFwgwIE73o4eezpbv5GPg==
X-Google-Smtp-Source: APXvYqxPafpvxRkuhEGqYiJGxpnDf62liGaMluG/utUtZL5urMUco0DXR6WUuvAUuo2RshTmy21TlA==
X-Received: by 2002:a17:90a:bd8c:: with SMTP id
 z12mr19399743pjr.60.1562518047922; 
 Sun, 07 Jul 2019 09:47:27 -0700 (PDT)
Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127])
 by smtp.gmail.com with ESMTPSA id s5sm14066440pgj.60.2019.07.07.09.47.27
 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256);
 Sun, 07 Jul 2019 09:47:27 -0700 (PDT)
Date: Sun, 7 Jul 2019 09:47:21 -0700
From: Stephen Hemminger <stephen@networkplumber.org>
To: Matan Azrad <matan@mellanox.com>
Cc: "anatoly.burakov@intel.com" <anatoly.burakov@intel.com>, "dev@dpdk.org"
 <dev@dpdk.org>, Stephen Hemminger <sthemmin@microsoft.com>
Message-ID: <20190707094721.28096618@hermes.lan>
In-Reply-To: <AM0PR0502MB401923965ECE7C6C6F16237CD2F70@AM0PR0502MB4019.eurprd05.prod.outlook.com>
References: <20190529224321.20760-1-stephen@networkplumber.org>
 <20190603222835.27909-1-stephen@networkplumber.org>
 <AM0PR0502MB401923965ECE7C6C6F16237CD2F70@AM0PR0502MB4019.eurprd05.prod.outlook.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH v2] examples/client_server_mp: check port
 ownership
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Sun, 7 Jul 2019 05:44:55 +0000
Matan Azrad <matan@mellanox.com> wrote:

> > +	for (count = 0; pm != 0; pm >>= 1, ++count) {
> > +		struct rte_eth_dev_owner owner;
> > +
> > +		if ((pm & 0x1) == 0)
> > +			continue;
> > +
> > +		if (count >= max_ports) {
> > +			printf("WARNING: requested port %u not present -
> > ignoring\n",
> > +				count);
> > +			continue;
> > +		}
> > +		if (rte_eth_dev_owner_get(count, &owner) < 0) {
> > +			printf("ERROR: can not find port %u owner\n",
> > count);  
> 
> What if some entity will take ownership later?
> If you want the app will be ownership aware:
> 	if you sure that you want this port to be owned by this application you need to take ownership on it.
> else:
> the port is hidden by RTE_ETH_FOREACH_DEV if it is owned by some entity. 
> see how it was done in testpmd function: port_id_is_invalid().

There are no mysterious entities in DPDK.
The only thing that can happen later is hotplug, and that will not change state
of existing port.

This model is used for all applications.  The application does not
take ownership, only device drivers do.

The whole portmask as command-line parameter is a bad user experience
now, but that is a different problem.