From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4792DC606BD for ; Mon, 8 Jul 2019 14:49:17 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id C7C6420665 for ; Mon, 8 Jul 2019 14:49:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20150623.gappssmtp.com header.i=@networkplumber-org.20150623.gappssmtp.com header.b="zPUKwMuE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C7C6420665 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=networkplumber.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9C0234C8D; Mon, 8 Jul 2019 16:49:15 +0200 (CEST) Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by dpdk.org (Postfix) with ESMTP id A33B33256 for ; Mon, 8 Jul 2019 16:49:14 +0200 (CEST) Received: by mail-pl1-f193.google.com with SMTP id i2so8413854plt.1 for ; Mon, 08 Jul 2019 07:49:14 -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=iKXI36N6c20eYVZoshMFuGF+v9fGTUawMCMrBS+sM4c=; b=zPUKwMuEtiAMP+p7IxlXAMh+d3UncXx5gk3DfKXhIqLa+lGiMNesmahg+ILN8MyMm2 V/i0sRU2evRLNXWU/Zn6lh3JS14KeYgPbnSoNyjkMw8g9cgJEdDnqd7SK2Ds+E4LYNWO 3JqUDXS5RscKIb425+lMtMAUJ651RaCx16Y4MC9wPwjWipMAnL7OBTwq24RJJU5egFfQ 8VgUWQ21WpY5mS/8fwP2u+t1hbiQHwtipCkX6QI440yH5RLqYMqAqDB/Z+MwJfexTmh1 uqxVeA1dIPiCbns6FvC9+Pm+SfPtRrddF+l9Q3tE3+u+PPcamAYuMsuBcSOGdLG7b4ND m3qA== 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=iKXI36N6c20eYVZoshMFuGF+v9fGTUawMCMrBS+sM4c=; b=CFh4n+g4WIbAjRtVyE9Xx14WDmUXb8Ppvg4C8fLJ75XFs7ZpV2KOavnRKVZgMjAsXn u5rmNjaXfYVqkOpwqmXqw0J2z70miwt2PWc0MFIau4I4tC8Y6S2pNMHlJ6UOgyHXaFTZ A14CsFOyWNS6o4pRNtuDoaYQJTrdu9UIh07PF4yg+D57Mz5tSPoNzfhY1N5f+BSvKQLD +oNITRV/Z590/cXIoRJVx/FNQCGCJomMMRDNYGApoIB/oPEdnUG6ZjOIHcykxEygKtVc OAh7E+mCKGcrk9sDE7jrQcE/QL9cWlKhfyxiDuVNJfGQBqKeC5QrDKMEt4hIHT21kFtK LC+A== X-Gm-Message-State: APjAAAV0idg6PQpA4dNLS3yUsCqo8h6wmEVmeuWreirpZndQFOfgmKNc hMQYMIQgs8bqQb69YhmDBZHyJQ== X-Google-Smtp-Source: APXvYqzXjwp6GIJTR1xm2VEwsLeU9XQ8dbD9L9iV8M53tjrVGjWNAaqqvhJmurD+N+AUyz0E6feEKg== X-Received: by 2002:a17:902:2baa:: with SMTP id l39mr25787678plb.280.1562597353702; Mon, 08 Jul 2019 07:49:13 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id 34sm6161156pgl.15.2019.07.08.07.49.13 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 08 Jul 2019 07:49:13 -0700 (PDT) Date: Mon, 8 Jul 2019 07:49:06 -0700 From: Stephen Hemminger To: Matan Azrad Cc: "anatoly.burakov@intel.com" , "dev@dpdk.org" , Stephen Hemminger Message-ID: <20190708074906.301917f7@hermes.lan> In-Reply-To: References: <20190529224321.20760-1-stephen@networkplumber.org> <20190603222835.27909-1-stephen@networkplumber.org> <20190707094721.28096618@hermes.lan> 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Mon, 8 Jul 2019 06:37:14 +0000 Matan Azrad wrote: > Hi Stephen > > From: Stephen Hemminger > > Sent: Sunday, July 7, 2019 7:47 PM > > To: Matan Azrad > > Cc: anatoly.burakov@intel.com; dev@dpdk.org; Stephen Hemminger > > > > Subject: Re: [dpdk-dev] [PATCH v2] examples/client_server_mp: check port > > ownership > > > > On Sun, 7 Jul 2019 05:44:55 +0000 > > Matan Azrad 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. > > A long discussions were done on it. > There is an application model to take ownership as I wrote you above. > You chose in the second option - not to be ownership aware. > > From docs: > "10.4.2. Port Ownership > The Ethernet devices ports can be owned by a single DPDK entity (application, library, PMD, process, etc). The ownership mechanism is controlled by ethdev APIs and allows to set/remove/get a port owner by DPDK entities. Allowing this should prevent any multiple management of Ethernet port by different entities. > > Note > > It is the DPDK entity responsibility to set the port owner before using it and to manage the port usage synchronization between different threads or processes." > > > The whole portmask as command-line parameter is a bad user experience > > now, but that is a different problem. > > I think, this is the problem you should solve here. No other application is doing this: testpmd, l3fwd, ... why do you think this application is different. Plus you would be putting a new requirement on all the user applications. That would be a user hostile change.