From patchwork Wed Apr 10 17:15:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 52610 X-Patchwork-Delegate: thomas@monjalon.net 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 3FE2F1B20D; Wed, 10 Apr 2019 19:16:13 +0200 (CEST) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 0808C1B142 for ; Wed, 10 Apr 2019 19:16:09 +0200 (CEST) Received: by mail-pg1-f195.google.com with SMTP id z9so1926559pgu.10 for ; Wed, 10 Apr 2019 10:16:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mp6C4lmKHxRwWTazVhkNgq2X1wcsA6ywl91M4N1beSc=; b=Y8JEBg9PQFVkjHYPUkoE4ig8Zaw17KUl1Eg7NgYlE2VZ7eMhcYmSwZcZnZ8LTdSYHa prpdXJPs/8kRw3imA+qZD0GHfoAfFfPUAuY66UnfohlosyKGZKRn6SJOEpftfmc1LbkY nCYVCeiLUrdOJGo5r0PXNb205PBKSxwEBiq3CcqXr8TR76Z55Q0kM3Khqmqijk9X9lH9 9Gs9A06pechSvIIrX5tzBLPOUV8bYpvtF1Abuc7Vx7W2nx7I456V4kjK/IBb9tsuzcIf kwyLDvOv6LCB1RRXqK8zVYjL8oop/8BMWIreVU+/rCWAQp0HAghQrf/cJyxLEbkA8vwu zPgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=mp6C4lmKHxRwWTazVhkNgq2X1wcsA6ywl91M4N1beSc=; b=IeHg76AciVEXsPtn9eWGVcnP3i0dbMCzRev46NkYzuBs4bHuVl8zWwxOvL2SgVyMo/ huFs7LhhC7RXoOh4onWJ3gyMIS/+u3ceu7Qya5zh4vFwAyj21JsH8+ptn4K45pyDgvb8 HimctzKxX/FfjHYzQmb1VeJldKF7OFB9YuCGQoYjmp3Wj0tlHCU9R4vxaYCJFOMEKQ00 UMJD75gQeJtIKbWtNmIq/1xYJx40cfQNNLkOU9dykJgGW/NGdsazU3WbEm/WeOC9DaTI nWyT/rTfNwoPJJVBVcp1U/3nAKhvFzLM5tKAOjmlP9jKB7aSmetGCEoRABxmIeBQswqz yGLQ== X-Gm-Message-State: APjAAAWozLlTDDVNRDYSQS6lIp+IIg47wuO6HxxppsWTX15IjTQBoy4O lHB2hrhJjY4IfZbJ1KMJkQcpFwvyGZo= X-Google-Smtp-Source: APXvYqxZVFVhlWZm1SE5Risev5we8ig48yZ6YA7SUk3wA3GILYIXldZI/37naUL4YKIPSobOsXR32Q== X-Received: by 2002:a65:5286:: with SMTP id y6mr41613790pgp.79.1554916567774; Wed, 10 Apr 2019 10:16:07 -0700 (PDT) Received: from shemminger-XPS-13-9360.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id d25sm48995244pfn.154.2019.04.10.10.16.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 10:16:06 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 10 Apr 2019 10:15:59 -0700 Message-Id: <20190410171603.8979-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190410171603.8979-1-stephen@networkplumber.org> References: <20190408182510.16078-1-stephen@networkplumber.org> <20190410171603.8979-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v2 1/5] eal: use unsigned int in rte_lcore.h functions 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" Purely cosmetic change, use unsigned int instead of unsigned alone. Signed-off-by: Stephen Hemminger Reviewed-by: David Marchand --- lib/librte_eal/common/include/rte_lcore.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h index dea17f500065..959ef9ece4b2 100644 --- a/lib/librte_eal/common/include/rte_lcore.h +++ b/lib/librte_eal/common/include/rte_lcore.h @@ -137,7 +137,7 @@ rte_lcore_index(int lcore_id) * @return * the ID of current lcoreid's physical socket */ -unsigned rte_socket_id(void); +unsigned int rte_socket_id(void); /** * Return number of physical sockets detected on the system. @@ -177,8 +177,8 @@ rte_socket_id_by_idx(unsigned int idx); * @return * the ID of lcoreid's physical socket */ -static inline unsigned -rte_lcore_to_socket_id(unsigned lcore_id) +static inline unsigned int +rte_lcore_to_socket_id(unsigned int lcore_id) { return lcore_config[lcore_id].socket_id; } @@ -193,7 +193,7 @@ rte_lcore_to_socket_id(unsigned lcore_id) * True if the given lcore is enabled; false otherwise. */ static inline int -rte_lcore_is_enabled(unsigned lcore_id) +rte_lcore_is_enabled(unsigned int lcore_id) { struct rte_config *cfg = rte_eal_get_configuration(); if (lcore_id >= RTE_MAX_LCORE) @@ -214,8 +214,8 @@ rte_lcore_is_enabled(unsigned lcore_id) * @return * The next lcore_id or RTE_MAX_LCORE if not found. */ -static inline unsigned -rte_get_next_lcore(unsigned i, int skip_master, int wrap) +static inline unsigned int +rte_get_next_lcore(unsigned int i, int skip_master, int wrap) { i++; if (wrap) From patchwork Wed Apr 10 17:16:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 52611 X-Patchwork-Delegate: thomas@monjalon.net 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 425AA1B273; Wed, 10 Apr 2019 19:16:17 +0200 (CEST) Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by dpdk.org (Postfix) with ESMTP id E70501B1EB for ; Wed, 10 Apr 2019 19:16:10 +0200 (CEST) Received: by mail-pf1-f169.google.com with SMTP id c207so1864229pfc.7 for ; Wed, 10 Apr 2019 10:16:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=a8uXyu9PL+of0FN4+Hrv0EduEbX9asmVh/GVzdm8SWM=; b=MYgRcGIM0qLeJmEaEhE9HXAkBc+MpyqPe8VH60MBGOGW4+nCoMYxiRt5dlcaeENr7Z IEce1R9seqO+txvNdgyNu46uNghtwCvakXkQwfM/0pxSxhMUMd9MI+kbvf58ITysGyG1 pK1PwvPQvmvGetnjcryYPnQcz1rhEksid2qm3Y7IasJM5NByNsdM9uhqmypkvIKWgTMW cspCGX3rhE3RvZoLXZazYgVlfJf2sGR03+oJBB9fHQW3JjlYvF3zG0pluY3KNWFb42os w2ugp32OHlyYI6XKMjSBlMsuOHgjhbBOn3D/tm3D9e+oTOPgtCWVFJslgiLSiDkeBPx0 k+dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=a8uXyu9PL+of0FN4+Hrv0EduEbX9asmVh/GVzdm8SWM=; b=ljK63eXzrhbwe/jPbMhhmuxR4UgKxVbW6pzHYK4MEfe3effwrKxx4pi8111+rEZwoy onim4h6fQ4v4UNnWH2K/86wLJbNkCOYjZtT2v/9liSWWvc6PN24+9vVBAfUHU13WNSu2 YayQ87JJWtIAqfTGjUTw10TSCs2n/bfv9pOm+vMXUFbgkm2BPolR59C/OGzmAHv0EQ2/ CjDiGAvELhOOlAXtf7xk8R7rMRLm4mu198oo/E2mPZT1+BMq92VDt9tEjPUmILmeaqUf M1J+bCygZg7D5i4u5aK3uYv/rLPVYSE5utVdaz/FyRe8r+K04lcOQ6yHyBF8rqvSeTY+ 5R6w== X-Gm-Message-State: APjAAAVbNRIa0lLzM3YgeIVnPXL2NYTX0uJ56ApNqhCnTq0pd/6Nbgf4 2Y8ZgdNeSkpK0QpwjQFPPAJATW/W7LE= X-Google-Smtp-Source: APXvYqwckjIGtiNExdh8gYJjJ3ZvZTFyxvb6+QoSMAVKgYMF2Zna+EUqo7BqwJlZsq0iNQ0XsHI6fA== X-Received: by 2002:a63:4847:: with SMTP id x7mr42538677pgk.233.1554916569576; Wed, 10 Apr 2019 10:16:09 -0700 (PDT) Received: from shemminger-XPS-13-9360.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id d25sm48995244pfn.154.2019.04.10.10.16.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 10:16:08 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 10 Apr 2019 10:16:00 -0700 Message-Id: <20190410171603.8979-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190410171603.8979-1-stephen@networkplumber.org> References: <20190408182510.16078-1-stephen@networkplumber.org> <20190410171603.8979-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v2 2/5] eal: add accessor functions for lcore_config 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" The fields of the internal EAL core configuration are currently laid bare as part of the API. This is not good practice and limits fixing issues with layout and sizes. Make new accessor functions for the fields used by current drivers and examples. Mark return code functions as experimental since this value might change in the future and probably shouldn't have been used by non EAL code anyway. Signed-off-by: Stephen Hemminger Reviewed-by: David Marchand Reviewed-by: David Marchand --- doc/guides/rel_notes/release_19_05.rst | 6 +++ lib/librte_eal/common/eal_common_lcore.c | 39 ++++++++++++++++++ lib/librte_eal/common/include/rte_lcore.h | 50 ++++++++++++++++------- lib/librte_eal/rte_eal_version.map | 11 +++++ 4 files changed, 92 insertions(+), 14 deletions(-) diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst index dbdf07a0c05b..32aae5d3bcfa 100644 --- a/doc/guides/rel_notes/release_19_05.rst +++ b/doc/guides/rel_notes/release_19_05.rst @@ -222,6 +222,12 @@ ABI Changes alignment for ``rte_crypto_asym_op`` to restore expected ``rte_crypto_op`` layout and alignment. +* eal: the lcore config structure ``struct lcore_config`` will be made + internal to the EAL in a future release. This will allow the structure to + change without impacting API or ABI. All accesses to fields of this + structure should be done by the corresponding accessor functions. + For example, instead of using ``lcore_config[lcore_id].socket_id`` + the function ``rte_lcore_socket_id(lcore_id)`` should be used instead. Shared Library Versions ----------------------- diff --git a/lib/librte_eal/common/eal_common_lcore.c b/lib/librte_eal/common/eal_common_lcore.c index 1cbac42286ba..6cf4d7abb0bd 100644 --- a/lib/librte_eal/common/eal_common_lcore.c +++ b/lib/librte_eal/common/eal_common_lcore.c @@ -16,6 +16,45 @@ #include "eal_private.h" #include "eal_thread.h" +int rte_lcore_index(int lcore_id) +{ + if (unlikely(lcore_id >= RTE_MAX_LCORE)) + return -1; + + if (lcore_id < 0) + lcore_id = (int)rte_lcore_id(); + + return lcore_config[lcore_id].core_index; +} + +int rte_lcore_to_cpu_id(int lcore_id) +{ + if (unlikely(lcore_id >= RTE_MAX_LCORE)) + return -1; + + if (lcore_id < 0) + lcore_id = (int)rte_lcore_id(); + + return lcore_config[lcore_id].core_id; +} + +rte_cpuset_t rte_lcore_cpuset(unsigned int lcore_id) +{ + return lcore_config[lcore_id].cpuset; +} + +unsigned int +rte_lcore_to_socket_id(unsigned int lcore_id) +{ + return lcore_config[lcore_id].socket_id; +} + +int +rte_lcore_return_code(unsigned int lcore_id) +{ + return lcore_config[lcore_id].ret; +} + static int socket_id_cmp(const void *a, const void *b) { diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h index 959ef9ece4b2..dc9f3dc0843d 100644 --- a/lib/librte_eal/common/include/rte_lcore.h +++ b/lib/librte_eal/common/include/rte_lcore.h @@ -121,15 +121,8 @@ rte_lcore_count(void) * @return * The relative index, or -1 if not enabled. */ -static inline int -rte_lcore_index(int lcore_id) -{ - if (lcore_id >= RTE_MAX_LCORE) - return -1; - if (lcore_id < 0) - lcore_id = (int)rte_lcore_id(); - return lcore_config[lcore_id].core_index; -} +int __rte_experimental +rte_lcore_index(int lcore_id); /** * Return the ID of the physical socket of the logical core we are @@ -177,11 +170,40 @@ rte_socket_id_by_idx(unsigned int idx); * @return * the ID of lcoreid's physical socket */ -static inline unsigned int -rte_lcore_to_socket_id(unsigned int lcore_id) -{ - return lcore_config[lcore_id].socket_id; -} +unsigned int +rte_lcore_to_socket_id(unsigned int lcore_id); + +/** + * Return the id of the lcore on a socket starting from zero. + * + * @param lcore_id + * The targeted lcore, or -1 for the current one. + * @return + * The relative index, or -1 if not enabled. + */ +int +rte_lcore_to_cpu_id(int lcore_id); + +/** + * Return the cpuset for a given lcore. + * @param lcore_id + * the targeted lcore, which MUST be between 0 and RTE_MAX_LCORE-1. + * @return + * The cpuset of that lcore + */ +rte_cpuset_t +rte_lcore_cpuset(unsigned int lcore_id); + +/** + * Get the return code from a lcore thread. + * @param lcore_id + * the targeted lcore, which MUST be between 0 and RTE_MAX_LCORE-1 + * and finished + * @return + * the return code from the lcore thread + */ +int __rte_experimental +rte_lcore_return_code(unsigned int lcore_id); /** * Test if an lcore is enabled. diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index d6e375135ad1..f6688327cad3 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -268,6 +268,16 @@ DPDK_18.11 { } DPDK_18.08; +DPDK_19.05 { + global: + + rte_lcore_cpuset; + rte_lcore_index; + rte_lcore_to_cpu_id; + rte_lcore_to_socket_id; + +} DPDK_18.08; + EXPERIMENTAL { global: @@ -329,6 +339,7 @@ EXPERIMENTAL { rte_fbarray_set_free; rte_fbarray_set_used; rte_intr_callback_unregister_pending; + rte_lcore_return_code; rte_log_register_type_and_pick_level; rte_malloc_dump_heaps; rte_malloc_heap_create; From patchwork Wed Apr 10 17:16:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 52612 X-Patchwork-Delegate: thomas@monjalon.net 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 2E6FA1B296; Wed, 10 Apr 2019 19:16:21 +0200 (CEST) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by dpdk.org (Postfix) with ESMTP id 8F3781B204 for ; Wed, 10 Apr 2019 19:16:12 +0200 (CEST) Received: by mail-pf1-f195.google.com with SMTP id c207so1864273pfc.7 for ; Wed, 10 Apr 2019 10:16:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=y7bNq0DV23fPxTb/9SFokp9NiKGie8S4xtcH1e+yZRk=; b=GE4OVfGcIKAYz4Hrat8SH2pZNDGZ1qcRpL+0S2wa8acNbkoNQD8b1/lPp8VxSK3a7i ajL4KZ85yjRI0BgTfuntVtQCkK0eYvGVZ2CMQbEkUjlwCzZPk6iCln2wgvevVG/qOKUK 36b8N0aIp/GyiV1SWkRzQ7L0WBePwWdAegZ0nYRQsDK+mN5BKM/8nreV2Aj6lh+NKqAK V/TXYccR9FpjvmHWwr0F+TWbSxtEf34f4WnqaI8VE3gfh4nbGHU/7kgUzuJgi2+s8Azu W3/T06xp1NqIEX3MaZ5vnn/bT9JudheNE3MeKgYoPt+n1z9hjjldVAyeoJm09kSWH3Mz Xuxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=y7bNq0DV23fPxTb/9SFokp9NiKGie8S4xtcH1e+yZRk=; b=XSzs/mqUqdFcJYI9iEK30Yb2hY2qG7ljKv1NRlWU7+sH/Z3ancLWyYjd2LpTKKN6oS OIILM18wYAXz2o2dNq+QgHEcBiu/w/W/0/p7uekGQAjky3bNQXJU+ZHJ8GpjMdbPHWIQ o5VSgU3/+AnYqPJnS8lPHcgpgGcwRgqwqM7b3RdRFtQFlJ1vt7Nj55FgPJ1BmwWM/FTP bOuCbat0LFWqxQJyFh/fUNEL5FZ+Xa5g6pBVEmDenxcaaSk39EfBY1oHfDSPd220qK49 gJr3gZkDf0ByTn3ex/5nHTOMuzabIpsC2GyKX88QjD340qpUNKP8Q45Q4plDRFYDGHjG K5Mg== X-Gm-Message-State: APjAAAWjQz5dyYkEFB+VAKF4odqkYAUNBUQX79yW9EeK+s6ixSYit0aZ FP8DRYambip/7/7jzmw8g+KelGo4qS4= X-Google-Smtp-Source: APXvYqyrgFdRz4ClWq+PICfEoi83ncApVlS63GW9WvnSmvSMGQXiokIiGzrPdiSy7W9+YGkidVN5Kw== X-Received: by 2002:a63:1548:: with SMTP id 8mr39348689pgv.277.1554916571503; Wed, 10 Apr 2019 10:16:11 -0700 (PDT) Received: from shemminger-XPS-13-9360.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id d25sm48995244pfn.154.2019.04.10.10.16.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 10:16:09 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 10 Apr 2019 10:16:01 -0700 Message-Id: <20190410171603.8979-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190410171603.8979-1-stephen@networkplumber.org> References: <20190408182510.16078-1-stephen@networkplumber.org> <20190410171603.8979-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v2 3/5] bus: use lcore accessor functions 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" The lcore_config structure will be hidden in future release. Signed-off-by: Stephen Hemminger Reviewed-by: David Marchand --- drivers/bus/dpaa/dpaa_bus.c | 6 ++++-- drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index ac20eccd53c1..08c822781d9d 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -254,6 +254,7 @@ int rte_dpaa_portal_init(void *arg) unsigned int cpu, lcore = rte_lcore_id(); int ret; struct dpaa_portal *dpaa_io_portal; + rte_cpuset_t cpuset; BUS_INIT_FUNC_TRACE(); @@ -263,12 +264,13 @@ int rte_dpaa_portal_init(void *arg) if (lcore >= RTE_MAX_LCORE) return -1; - cpu = lcore_config[lcore].core_id; + cpu = rte_lcore_to_cpu_id(lcore); /* Set CPU affinity for this thread.*/ id = pthread_self(); + cpuset = rte_lcore_cpuset(lcore); ret = pthread_setaffinity_np(id, sizeof(cpu_set_t), - &lcore_config[lcore].cpuset); + &cpuset); if (ret) { DPAA_BUS_LOG(ERR, "pthread_setaffinity_np failed on core :%u" " (lcore=%u) with ret: %d", cpu, lcore, ret); diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c index 7bcbde840e63..8efb24af5c6a 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c @@ -366,7 +366,9 @@ dpaa2_check_lcore_cpuset(void) for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) { for (i = 0; i < RTE_MAX_LCORE; i++) { - if (CPU_ISSET(i, &lcore_config[lcore_id].cpuset)) { + rte_cpuset_t cpuset = rte_lcore_cpuset(lcore_id); + + if (CPU_ISSET(i, &cpuset)) { RTE_LOG(DEBUG, EAL, "lcore id = %u cpu=%u\n", lcore_id, i); if (dpaa2_cpu[lcore_id] != 0xffffffff) { From patchwork Wed Apr 10 17:16:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 52613 X-Patchwork-Delegate: thomas@monjalon.net 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 C81CF1B399; Wed, 10 Apr 2019 19:16:23 +0200 (CEST) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id F06681B216 for ; Wed, 10 Apr 2019 19:16:13 +0200 (CEST) Received: by mail-pg1-f196.google.com with SMTP id y3so1920210pgk.12 for ; Wed, 10 Apr 2019 10:16:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TkYkcALPk4MakSkI3b+Pt2ndeQC2ArGo5b1XNL5Kw08=; b=1yj/n7mpKqlr83fWClF+ZT+WOjgVNCArUj1z2fS5BxkSN6P26bUR6oVw/X2ZejPLtj 876CoVM49FDWMO7XLECaS8zMzEckfBsFt6oChh14oqbyL01FJ8+PFexKZ+SEpunHtSGM G9WhA/wSndpwfpCBOv7vkGP8U91klql8OiOKrGbLxZNGY8R0z8QhUxTo9V+4TlhZFpGj emMmNzj3VqDGTxrKYtIaaSjaZ52PVjg2OOq/te024VQK82bYqU0BnBvXf1NUx8uoJoKv vwEmNhKu9sZGMpULJqggNxMLxPgYcjbSYPlUarP83exvUWKnqUFhyeueBQiVq9OvG1xL swjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TkYkcALPk4MakSkI3b+Pt2ndeQC2ArGo5b1XNL5Kw08=; b=kcjnAy1vAn4E/TOKQ1EnCvRYl7jVtX+2D9jO+lsacAqLK5KSPuSTNqZpSjLrpSX9ZR 2RA9iB+Ii8c1tG6Vz1sOZj47Uz9/4tBqEu2MaPtbZPgemu92bMsM9a2uGNUoE6lKb0R0 lf5sU27IZ9nFyoXAEVRVTN39WcsK2mcvBKH+Rqu2h2PRhkSCltVyExg0Jg5h9GWTklf0 dPjDlQr/YXAZuyE7l+erf4cNWKM61krkoyVcY/jVE2PcVg1Ro3SKqMRhJ/zdiLOVgLpE 9/4V7E8fxSEbwVpMX5emj3B6n1n8CTknow8KjzzRsXmfKeW7/sC9ZNqvG3xVXkTLFJUE /wiQ== X-Gm-Message-State: APjAAAWGrOLI0B+1spI/InPz2E7dXv3RlUYgukwpkvfj1K+SqnjYIrgS CqRVk4QfkKGcWp+54AdiTezQyQwQ5MA= X-Google-Smtp-Source: APXvYqxdS7zwFZpci50rw31Xs/t9lH+S5F8nHO9pmrdNiXtv54ZRjI5ZBX85E0rDpsmFx/l5+DUmHw== X-Received: by 2002:a65:420b:: with SMTP id c11mr42342644pgq.24.1554916572925; Wed, 10 Apr 2019 10:16:12 -0700 (PDT) Received: from shemminger-XPS-13-9360.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id d25sm48995244pfn.154.2019.04.10.10.16.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 10:16:11 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 10 Apr 2019 10:16:02 -0700 Message-Id: <20190410171603.8979-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190410171603.8979-1-stephen@networkplumber.org> References: <20190408182510.16078-1-stephen@networkplumber.org> <20190410171603.8979-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v2 4/5] examples/bond: use lcore accessor 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" Referring to lcore_config directly is no longer recommended. Signed-off-by: Stephen Hemminger --- examples/bond/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/bond/main.c b/examples/bond/main.c index ef86194fff4a..b047ab23f01d 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -526,8 +526,9 @@ static void cmd_start_parsed(__attribute__((unused)) void *parsed_result, int slave_core_id = rte_lcore_id(); rte_spinlock_trylock(&global_flag_stru_p->lock); - if (global_flag_stru_p->LcoreMainIsRunning == 0) { - if (lcore_config[global_flag_stru_p->LcoreMainCore].state != WAIT) { + if (global_flag_stru_p->LcoreMainIsRunning == 0) { + if (rte_eal_get_lcore_state(global_flag_stru_p->LcoreMainCore) + != WAIT) { rte_spinlock_unlock(&global_flag_stru_p->lock); return; } From patchwork Wed Apr 10 17:16:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 52614 X-Patchwork-Delegate: thomas@monjalon.net 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 9190F1B39D; Wed, 10 Apr 2019 19:16:26 +0200 (CEST) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id AFD691B21A for ; Wed, 10 Apr 2019 19:16:15 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id 8so1875607pfr.4 for ; Wed, 10 Apr 2019 10:16:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DFK4nzbv3V/eCutdXyaPdGzuXJCEj/DVBU8FHaA+nho=; b=wiqKEiadb6TTJqI7hwhpK/XqEAJoOQxvQNwUrUPy1h/tW9pqa0VlD/Qw8g5f/7sITd W6oqTc8V0Z8oW+Z3B/1lpmAgTS0VOfYHAKUMfgnKJ3uSbZR+ilziFQacFwItKJ+cGksk vfPb3pjCZiOhzxIIjulb0TnYegGBTmBZ4yiBqoO/903FsGU9GDqFBsLFKcoOA2wFovrv /VljBuaCnx7NRw9NZJVcXBJV+s4RR1VsvJe/ctSK8WT6P/SzbgKsuSM3SPq3itFtr9pe semhH18wC7Loc442NgPQ3GQ9jrMQMfhlCZRPVAfVzH2/x5q8MdVoCuMsOCpIJ7zvLwbo FLxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DFK4nzbv3V/eCutdXyaPdGzuXJCEj/DVBU8FHaA+nho=; b=B60OLjLwGLWo0KWeqrB/DldPrXsfK/5iKhBTgbOmMtPzY4oTrC0zlNNu8o7rflYRyd JfXq4Q9LqUR77vGGA4oPniAcI75Es9rXR+RG4Jy7CS4QLr6rSOwd2ktFEPYm4UwLSE9i rcHKwDIbLZ1PZSuyU5lUCRGzeIlojAqAymkHJ3qINyz9IEC4LJK3d6PV/TJ42IvqBLI5 2G/wYJWTjemklg5KxpwqNgQOoesRACackgLsGxUp9jGVd3/XMAf3a5fl+VqUOg1gg4gD /yelBMJ8vOXEkTTzUiBXgNJJ5ckinJ00MG/fsXjBayXaXtDx5Nahcg9N9LhmPwtIM0RD yBQw== X-Gm-Message-State: APjAAAWBkGbNM99WKDI2UrZUXAiFvFH/8Q9J1+40ssjpklJTR04/J/4p jbBo/asNw3YmQEKETwPmNkkzO8WQzdk= X-Google-Smtp-Source: APXvYqw7KSWgOCrO8wMbhiRsZyXFcIP9dXJfyXZYVDzHZU4WGmsiBjCGiyQQRkjKNi38KtqlL8tPmA== X-Received: by 2002:a63:2aca:: with SMTP id q193mr41847983pgq.269.1554916574563; Wed, 10 Apr 2019 10:16:14 -0700 (PDT) Received: from shemminger-XPS-13-9360.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id d25sm48995244pfn.154.2019.04.10.10.16.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Apr 2019 10:16:13 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 10 Apr 2019 10:16:03 -0700 Message-Id: <20190410171603.8979-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190410171603.8979-1-stephen@networkplumber.org> References: <20190408182510.16078-1-stephen@networkplumber.org> <20190410171603.8979-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v2 5/5] app/test: use lcore accessor functions 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" Don't refer to lcore_config directly. Signed-off-by: Stephen Hemminger Reviewed-by: David Marchand --- app/test/test_cryptodev.c | 2 +- app/test/test_hash_readwrite_lf.c | 14 +++++++------- app/test/test_ring_perf.c | 22 ++++++++++++---------- app/test/test_stack_perf.c | 20 ++++++++++---------- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 9f31aaa7e6b2..eca6d3db16a5 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -378,7 +378,7 @@ testsuite_setup(void) strcpy(temp_str, vdev_args); strlcat(temp_str, ";", sizeof(temp_str)); slave_core_count++; - socket_id = lcore_config[i].socket_id; + socket_id = rte_lcore_to_socket_id(i); } if (slave_core_count != 2) { RTE_LOG(ERR, USER1, diff --git a/app/test/test_hash_readwrite_lf.c b/app/test/test_hash_readwrite_lf.c index 4ab4c8ee64cf..1361a8aa4c9c 100644 --- a/app/test/test_hash_readwrite_lf.c +++ b/app/test/test_hash_readwrite_lf.c @@ -741,7 +741,7 @@ test_hash_add_no_ks_lookup_hit(struct rwc_perf *rwc_perf_results, int rwc_lf, rte_eal_mp_wait_lcore(); for (i = 1; i <= rwc_core_cnt[n]; i++) - if (lcore_config[i].ret < 0) + if (rte_lcore_return_code(i) < 0) goto err; unsigned long long cycles_per_lookup = @@ -813,7 +813,7 @@ test_hash_add_no_ks_lookup_miss(struct rwc_perf *rwc_perf_results, int rwc_lf, if (ret < 0) goto err; for (i = 1; i <= rwc_core_cnt[n]; i++) - if (lcore_config[i].ret < 0) + if (rte_lcore_return_code(i) < 0) goto err; unsigned long long cycles_per_lookup = @@ -889,7 +889,7 @@ test_hash_add_ks_lookup_hit_non_sp(struct rwc_perf *rwc_perf_results, if (ret < 0) goto err; for (i = 1; i <= rwc_core_cnt[n]; i++) - if (lcore_config[i].ret < 0) + if (rte_lcore_return_code(i) < 0) goto err; unsigned long long cycles_per_lookup = @@ -965,7 +965,7 @@ test_hash_add_ks_lookup_hit_sp(struct rwc_perf *rwc_perf_results, int rwc_lf, if (ret < 0) goto err; for (i = 1; i <= rwc_core_cnt[n]; i++) - if (lcore_config[i].ret < 0) + if (rte_lcore_return_code(i) < 0) goto err; unsigned long long cycles_per_lookup = @@ -1040,7 +1040,7 @@ test_hash_add_ks_lookup_miss(struct rwc_perf *rwc_perf_results, int rwc_lf, int if (ret < 0) goto err; for (i = 1; i <= rwc_core_cnt[n]; i++) - if (lcore_config[i].ret < 0) + if (rte_lcore_return_code(i) < 0) goto err; unsigned long long cycles_per_lookup = @@ -1141,7 +1141,7 @@ test_hash_multi_add_lookup(struct rwc_perf *rwc_perf_results, int rwc_lf, rte_eal_mp_wait_lcore(); for (i = 1; i <= rwc_core_cnt[n]; i++) - if (lcore_config[i].ret < 0) + if (rte_lcore_return_code(i) < 0) goto err; unsigned long long cycles_per_lookup = @@ -1225,7 +1225,7 @@ test_hash_add_ks_lookup_hit_extbkt(struct rwc_perf *rwc_perf_results, rte_eal_mp_wait_lcore(); for (i = 1; i <= rwc_core_cnt[n]; i++) - if (lcore_config[i].ret < 0) + if (rte_lcore_return_code(i) < 0) goto err; unsigned long long cycles_per_lookup = diff --git a/app/test/test_ring_perf.c b/app/test/test_ring_perf.c index ebb3939f51d0..6eccccfe93b4 100644 --- a/app/test/test_ring_perf.c +++ b/app/test/test_ring_perf.c @@ -52,10 +52,11 @@ get_two_hyperthreads(struct lcore_pair *lcp) RTE_LCORE_FOREACH(id2) { if (id1 == id2) continue; - c1 = lcore_config[id1].core_id; - c2 = lcore_config[id2].core_id; - s1 = lcore_config[id1].socket_id; - s2 = lcore_config[id2].socket_id; + + c1 = rte_lcore_to_cpu_id(id1); + c2 = rte_lcore_to_cpu_id(id2); + s1 = rte_lcore_to_socket_id(id1); + s2 = rte_lcore_to_socket_id(id2); if ((c1 == c2) && (s1 == s2)){ lcp->c1 = id1; lcp->c2 = id2; @@ -75,10 +76,11 @@ get_two_cores(struct lcore_pair *lcp) RTE_LCORE_FOREACH(id2) { if (id1 == id2) continue; - c1 = lcore_config[id1].core_id; - c2 = lcore_config[id2].core_id; - s1 = lcore_config[id1].socket_id; - s2 = lcore_config[id2].socket_id; + + c1 = rte_lcore_to_cpu_id(id1); + c2 = rte_lcore_to_cpu_id(id2); + s1 = rte_lcore_to_socket_id(id1); + s2 = rte_lcore_to_socket_id(id2); if ((c1 != c2) && (s1 == s2)){ lcp->c1 = id1; lcp->c2 = id2; @@ -98,8 +100,8 @@ get_two_sockets(struct lcore_pair *lcp) RTE_LCORE_FOREACH(id2) { if (id1 == id2) continue; - s1 = lcore_config[id1].socket_id; - s2 = lcore_config[id2].socket_id; + s1 = rte_lcore_to_socket_id(id1); + s2 = rte_lcore_to_socket_id(id2); if (s1 != s2){ lcp->c1 = id1; lcp->c2 = id2; diff --git a/app/test/test_stack_perf.c b/app/test/test_stack_perf.c index ba27fbf7076d..70561fecda0d 100644 --- a/app/test/test_stack_perf.c +++ b/app/test/test_stack_perf.c @@ -44,10 +44,10 @@ get_two_hyperthreads(struct lcore_pair *lcp) RTE_LCORE_FOREACH(id[1]) { if (id[0] == id[1]) continue; - core[0] = lcore_config[id[0]].core_id; - core[1] = lcore_config[id[1]].core_id; - socket[0] = lcore_config[id[0]].socket_id; - socket[1] = lcore_config[id[1]].socket_id; + core[0] = rte_lcore_to_cpu_id(id[0]); + core[1] = rte_lcore_to_cpu_id(id[1]); + socket[0] = rte_lcore_to_socket_id(id[0]); + socket[1] = rte_lcore_to_socket_id(id[1]); if ((core[0] == core[1]) && (socket[0] == socket[1])) { lcp->c1 = id[0]; lcp->c2 = id[1]; @@ -70,10 +70,10 @@ get_two_cores(struct lcore_pair *lcp) RTE_LCORE_FOREACH(id[1]) { if (id[0] == id[1]) continue; - core[0] = lcore_config[id[0]].core_id; - core[1] = lcore_config[id[1]].core_id; - socket[0] = lcore_config[id[0]].socket_id; - socket[1] = lcore_config[id[1]].socket_id; + core[0] = rte_lcore_to_cpu_id(id[0]); + core[1] = rte_lcore_to_cpu_id(id[1]); + socket[0] = rte_lcore_to_socket_id(id[0]); + socket[1] = rte_lcore_to_socket_id(id[1]); if ((core[0] != core[1]) && (socket[0] == socket[1])) { lcp->c1 = id[0]; lcp->c2 = id[1]; @@ -95,8 +95,8 @@ get_two_sockets(struct lcore_pair *lcp) RTE_LCORE_FOREACH(id[1]) { if (id[0] == id[1]) continue; - socket[0] = lcore_config[id[0]].socket_id; - socket[1] = lcore_config[id[1]].socket_id; + socket[0] = rte_lcore_to_socket_id(id[0]); + socket[1] = rte_lcore_to_socket_id(id[1]); if (socket[0] != socket[1]) { lcp->c1 = id[0]; lcp->c2 = id[1];