From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 9AFF51B2A1 for ; Thu, 18 Jan 2018 22:12:22 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id E9BAF20C89; Thu, 18 Jan 2018 16:12:21 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Thu, 18 Jan 2018 16:12:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=vR6iJpp04RNyyCX/q207myLC6e tLWnItWOVnEBEGVy0=; b=sve9FQt/o5d679yYapqzY5VRbAHL+sNYVTL/n57yWB BYU/xng49I9b7ww8FYrQpMiMkcgBTNS0Xdii2P8wZtBzj0FtBGEHg4wOyQdgeaNu ATZZ4I3sPVXdIeD/tveQsATRJ6ADuKxR0jcoT006WDeuOqIx2YHC2Kb6JR+OQgPc M= 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-sender:x-me-sender:x-sasl-enc; s=fm1; bh=vR6iJp p04RNyyCX/q207myLC6etLWnItWOVnEBEGVy0=; b=S9BBeo8PDEgYXFTilRR5nf TIRsJSbfP4rjM/7KuSuZlqn+ho/pQK/BNlBX2Mf1sBx1Rmlakc48n1ArTHcKD+3J UHl+DQ8uG/ZK95rZghvS+3G50xTcPVzI3ZvObFYAG6wmFACZN/8pXROkxWNrIXle HDHmChdTywAQwhxEsTjV1q6PzPXmu4H0JSwFqdY+QS+NJbHnhiDDe82qtWHVAxMy UTvWgRO6ysI7KbZekPLwgAlFHrWKK01l+b9ibXJJugRPI9/UT8IHDz0ZzjxXLGm9 XGY72n3WnBFunZ16ReR8MEeychCYYg0AZKyGbQZNL6KdblibgCNrcVmMjNeeDXvg == X-ME-Sender: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 7560E240DE; Thu, 18 Jan 2018 16:12:21 -0500 (EST) From: Thomas Monjalon To: Matan Azrad Cc: Gaetan Rivet , Jingjing Wu , dev@dpdk.org, Neil Horman , Bruce Richardson , Konstantin Ananyev Date: Thu, 18 Jan 2018 22:11:47 +0100 Message-ID: <2995980.5xSJzJLsOV@xps> In-Reply-To: <1516293317-30748-4-git-send-email-matan@mellanox.com> References: <1515318351-4756-1-git-send-email-matan@mellanox.com> <1516293317-30748-1-git-send-email-matan@mellanox.com> <1516293317-30748-4-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v3 3/7] ethdev: add 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: , X-List-Received-Date: Thu, 18 Jan 2018 21:12:22 -0000 18/01/2018 17:35, Matan Azrad: > The ownership of a port is implicit in DPDK. > Making it explicit is better from the next reasons: > 1. It will define well who is in charge of the port usage synchronization. > 2. A library could work on top of a port. > 3. A port can work on top of another port. > > Also in the fail-safe case, an issue has been met in testpmd. > We need to check that the application is not trying to use a port which > is already managed by fail-safe. > > A port owner is built from owner id(number) and owner name(string) while > the owner id must be unique to distinguish between two identical entity > instances and the owner name can be any name. > The name helps to logically recognize the owner by different DPDK > entities and allows easy debug. > Each DPDK entity can allocate an owner unique identifier and can use it > and its preferred name to owns valid ethdev ports. > Each DPDK entity can get any port owner status to decide if it can > manage the port or not. > > The mechanism is synchronized for both the primary process threads and > the secondary processes threads to allow secondary process entity to be > a port owner. > > Add a sinchronized ownership mechanism to DPDK Ethernet devices to s/sinchronized/synchronized/ > avoid multiple management of a device by different DPDK entities. > > The current ethdev internal port management is not affected by this > feature. > > Signed-off-by: Matan Azrad I think it is a good compromise between application and ethdev responsibilities. The application is still responsible of thread safety per port, and it is consistent with the checkless Rx/Tx design (for performance). Except the wording (see below), Acked-by: Thomas Monjalon > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > +/* Shared memory between primary and secondary processes. */ > +static struct { > + uint64_t next_owner_id; > + rte_spinlock_t ownership_lock; > + struct rte_eth_dev_data data[RTE_MAX_ETHPORTS]; > +} *rte_eth_dev_share_data; Should be rte_eth_dev_shared_data. > -rte_eth_dev_data_alloc(void) > +rte_eth_dev_share_data_alloc(void) rte_eth_dev_shared_data_alloc