From patchwork Thu Apr 26 13:42:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatoly Burakov X-Patchwork-Id: 39039 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 68FFA7EEF; Thu, 26 Apr 2018 15:42:40 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 8B0277CEA for ; Thu, 26 Apr 2018 15:42:36 +0200 (CEST) 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; 26 Apr 2018 06:42:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,330,1520924400"; d="scan'208";a="36628833" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga008.jf.intel.com with ESMTP; 26 Apr 2018 06:42:33 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id w3QDgWOA010626; Thu, 26 Apr 2018 14:42:32 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w3QDgWuI030202; Thu, 26 Apr 2018 14:42:32 +0100 Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w3QDgVqj030193; Thu, 26 Apr 2018 14:42:31 +0100 From: Anatoly Burakov To: dev@dpdk.org Cc: Neil Horman , John McNamara , Marko Kovacevic , Robert Sanford , thomas@monjalon.net, erik.g.carrillo@intel.com, olivier.matz@6wind.com Date: Thu, 26 Apr 2018 14:42:31 +0100 Message-Id: X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] lcore: make semantics of lcore role function more intuitive 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" rte_lcore_has_role() returns 0 if role of lcore matches requested role. The return value of the API is confusing, and this is a known problem with a deprecation notice announcing the change to more intuitive semantics: Commit 064518f68d48 ("doc: announce EAL API change to lcore role function") Cc: erik.g.carrillo@intel.com Implement changes announced in the deprecation notice, and remove it. Also, fix usages of this API to reflect the change. Control thread patches expected new behavior and were broken before, now they are fixed as well. Fixes: d651ee4919cd ("eal: set affinity for control threads") Cc: olivier.matz@6wind.com Signed-off-by: Anatoly Burakov --- doc/guides/rel_notes/deprecation.rst | 5 ----- lib/librte_eal/common/eal_common_thread.c | 5 +---- lib/librte_timer/rte_timer.c | 2 +- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 72ab33c..3353519 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -28,11 +28,6 @@ Deprecation Notices - ``eal_parse_pci_DomBDF`` replaced by ``rte_pci_addr_parse`` - ``rte_eal_compare_pci_addr`` replaced by ``rte_pci_addr_cmp`` -* eal: The semantics of the return value for the ``rte_lcore_has_role`` function - are planned to change in v18.05. The function currently returns 0 and <0 for - success and failure, respectively. This will change to 1 and 0 for true and - false, respectively, to make use of the function more intuitive. - * eal: a new set of mbuf mempool ops name APIs for user, platform and best mempool names have been defined in ``rte_mbuf`` in v18.02. The uses of ``rte_eal_mbuf_default_mempool_ops`` shall be replaced by diff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c index 4e75cb8..fcf00cd 100644 --- a/lib/librte_eal/common/eal_common_thread.c +++ b/lib/librte_eal/common/eal_common_thread.c @@ -34,10 +34,7 @@ rte_lcore_has_role(unsigned int lcore_id, enum rte_lcore_role_t role) if (lcore_id >= RTE_MAX_LCORE) return -EINVAL; - if (cfg->lcore_role[lcore_id] == role) - return 0; - - return -EINVAL; + return cfg->lcore_role[lcore_id] == role; } int eal_cpuset_socket_id(rte_cpuset_t *cpusetp) diff --git a/lib/librte_timer/rte_timer.c b/lib/librte_timer/rte_timer.c index 4bbcd06..590488c 100644 --- a/lib/librte_timer/rte_timer.c +++ b/lib/librte_timer/rte_timer.c @@ -403,7 +403,7 @@ rte_timer_reset(struct rte_timer *tim, uint64_t ticks, if (unlikely((tim_lcore != (unsigned)LCORE_ID_ANY) && !(rte_lcore_is_enabled(tim_lcore) || - rte_lcore_has_role(tim_lcore, ROLE_SERVICE) == 0))) + rte_lcore_has_role(tim_lcore, ROLE_SERVICE)))) return -1; if (type == PERIODICAL)