From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id EBBF927D for ; Sun, 21 Jan 2018 21:43:37 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jan 2018 12:43:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,393,1511856000"; d="scan'208";a="11891414" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.252.26.249]) ([10.252.26.249]) by orsmga008.jf.intel.com with ESMTP; 21 Jan 2018 12:43:34 -0800 To: Matan Azrad , Thomas Monjalon , Gaetan Rivet , Jingjing Wu Cc: dev@dpdk.org, Neil Horman , Bruce Richardson , Konstantin Ananyev 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> From: Ferruh Yigit Message-ID: <955823ca-28b1-6702-4ac0-c07e17a11249@intel.com> Date: Sun, 21 Jan 2018 20:43:33 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <1516483468-9048-4-git-send-email-matan@mellanox.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v4 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: Sun, 21 Jan 2018 20:43:38 -0000 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 <...> > @@ -273,6 +289,144 @@ struct rte_eth_dev * > return 1; > } > > +static int > +rte_eth_is_valid_owner_id(uint64_t owner_id) > +{ > + if (owner_id == RTE_ETH_DEV_NO_OWNER || > + rte_eth_dev_shared_data->next_owner_id <= owner_id) { > + RTE_LOG(ERR, EAL, "Invalid owner_id=%016lX.\n", owner_id); This break build [1], also why using EAL log type here? There are a few sample of this, and there are a few using PMD log type, please fix log types. [1] ...dpdk/lib/librte_ether/rte_ethdev.c:372:59: error: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘uint64_t {aka long long unsigned int}’ [-Werror=format=] RTE_LOG(ERR, EAL, "Invalid owner_id=%016lX.\n", owner_id); ^ ...dpdk/i686-native-linuxapp-gcc/include/rte_log.h:288:25: note: in definition of macro ‘RTE_LOG’ RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) ^ ...dpdk/lib/librte_ether/rte_ethdev.c: In function ‘_rte_eth_dev_owner_set’: ...dpdk/lib/librte_ether/rte_ethdev.c:421:18: error: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument 6 has type ‘uint64_t {aka long long unsigned int}’ [-Werror=format=] port_owner->id); ~~~~~~~~~~~~~ ^ ...dpdk/i686-native-linuxapp-gcc/include/rte_log.h:288:25: note: in definition of macro ‘RTE_LOG’ RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) ^ cc1: all warnings being treated as errors