From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH v4 3/7] ethdev: add port ownership Date: Sun, 21 Jan 2018 20:46:21 +0000 Message-ID: <7b82a2b5-88e7-02b5-6cee-eb39e16ba114@intel.com> References: <1516293317-30748-1-git-send-email-matan@mellanox.com> <1516483468-9048-1-git-send-email-matan@mellanox.com> <1516483468-9048-4-git-send-email-matan@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org, Neil Horman , Bruce Richardson , Konstantin Ananyev To: Matan Azrad , Thomas Monjalon , Gaetan Rivet , Jingjing Wu Return-path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 70CF02BF3 for ; Sun, 21 Jan 2018 21:46:25 +0100 (CET) In-Reply-To: <1516483468-9048-4-git-send-email-matan@mellanox.com> Content-Language: en-US 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 1/20/2018 9:24 PM, Matan Azrad wrote: > 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 synchronized ownership mechanism to DPDK Ethernet devices to > 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 > Acked-by: Thomas Monjalon > Acked-by: Konstantin Ananyev <...> > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Unset Ethernet device owner to make the device ownerless. > + * > + * @param port_id > + * The identifier of port to make ownerless. > + * @param owner > + * The owner identifier. Causing doc build warning: s/owner/owner_id > + * @return > + * 0 on success, negative errno value on error. > + */ > +int rte_eth_dev_owner_unset(const uint16_t port_id, const uint64_t owner_id); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Remove owner from all Ethernet devices owned by a specific owner. > + * > + * @param owner Causing doc build warning: s/owner/owner_id > + * The owner identifier. > + */ > +void rte_eth_dev_owner_delete(const uint64_t owner_id); > + > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Get the owner of an Ethernet device. > + * > + * @param port_id > + * The port identifier. > + * @param owner > + * The owner structure pointer to fill. > + * @return > + * 0 on success, negative errno value on error.. > + */ > +int rte_eth_dev_owner_get(const uint16_t port_id, > + struct rte_eth_dev_owner *owner);