From patchwork Fri May 3 17:25: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: 53263 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 42A291B10D; Fri, 3 May 2019 19:25:20 +0200 (CEST) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by dpdk.org (Postfix) with ESMTP id A11B94C77 for ; Fri, 3 May 2019 19:25:17 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id x15so2994556pln.9 for ; Fri, 03 May 2019 10:25:17 -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 :mime-version:content-transfer-encoding; bh=Nx17vRmNuik8ALLa9BMVsahPMcMDaaRmxLi8wsm1p6k=; b=o1WB9bmOLywhxoC8IeLyeTzdUid5ZyxYdDU7IrMZzUGKtkWfRbLCmiERj6UmFJTR7Y hlbk7X84DkypuCBMbf7WbOBvu76j6Mvvwd+Drt9k1PPjSERE8i+au5gsHvHQ+6jbsCJ0 DpoSOvAvgcvy6Kcz4DRgvaKEh/pr5hGKojOPWYt4AiFNR/+G7gqCLhUNmfewlV7YMRru 0flyf6P5+6Wffba0ZFw2BqerrwtJ4af3isLgSQoQKQFZPmVSkODgGA9zR/F6rxm3eY9f KTJ0j5Vu3Pbp7NPkJ1G8Th+0M2p3ZEYg6N1O9JLSOPeM80aXJJS3QsRe5gaAzmWS3in0 F+FA== 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:mime-version:content-transfer-encoding; bh=Nx17vRmNuik8ALLa9BMVsahPMcMDaaRmxLi8wsm1p6k=; b=g37AKJHobTaV+jcPo4eamvwyjmQBsXMr2s7GN1OOcemREfRE2+sm1Cro61GoLAOn7W jwWcSL8nrl1GpmV/sm2V+RxCTw0Ynlt80qx/NXlyVr7NnZ6QPPjEHjv1VGOmhvI7pNVN flnypjrhPyYg7LWDwvMebj3VK7dFA1xzH30aDXDW8rDJxM51TjI88NsxlM+pjFuWBENm 43HPpxDWJZTig5EchsgiuLxqBovGpXsjcovItz/zNa5J6SZu1OMUln86b1DED/ZKJHc5 +7uFr1GAIVLLKdPbVJ0TuGqcEUdAbNAqWnoIkLKK1Jxn/8TnEA6a7czY8cEXv9tZUR4J jEJQ== X-Gm-Message-State: APjAAAV1C3ox8vkGEcDO5YEeMx267GESxLHy1o8khAqlpoYWox6YBt+J SHNUvAeozOWnFj0ZSNrawbUQAq0UsFs= X-Google-Smtp-Source: APXvYqzTiXE0jSB9naeb4W211UPtrhGybNmhfTwLx3y4rV2k/l+z7huMtfpHL95gzNoAQvt6H4d6Bw== X-Received: by 2002:a17:902:e402:: with SMTP id ci2mr12191359plb.154.1556904316489; Fri, 03 May 2019 10:25:16 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id t13sm3109578pgj.49.2019.05.03.10.25.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 May 2019 10:25:15 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , David Marchand Date: Fri, 3 May 2019 10:25:03 -0700 Message-Id: <20190503172507.5272-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190503172507.5272-1-stephen@networkplumber.org> References: <20190410171603.8979-1-stephen@networkplumber.org> <20190503172507.5272-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 be757a32e085..705594acbb5e 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 Fri May 3 17:25:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 53264 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 6B29F1B11A; Fri, 3 May 2019 19:25:22 +0200 (CEST) Received: from mail-pg1-f181.google.com (mail-pg1-f181.google.com [209.85.215.181]) by dpdk.org (Postfix) with ESMTP id 16DAC1B107 for ; Fri, 3 May 2019 19:25:19 +0200 (CEST) Received: by mail-pg1-f181.google.com with SMTP id j26so3032445pgl.5 for ; Fri, 03 May 2019 10:25:19 -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 :mime-version:content-transfer-encoding; bh=gsT8g95CdCyxJl6epoAfw3UyifKXpWKn2cCa/f9AIzQ=; b=Hl73ZHp6o8zVVOVW26LhVLgo9DHbZc+f8AFaerpLltycSb18EF5X8Zfu4XuRP61dfr I1vsDxKKB9z1RDb3cGs+etEy3TlvB3cjmjGfXbkaJGQ8JboA/6EsorA1DwSUNACp5HCG A+p73nVEWDJ4XQzUKbIgfLT+DhAx9uU+ZzxhYfOFoIXAKNxntl0KHADzIP5oArGqa1QT 3dpspj8IdUQ1OGUnf+zJ61j1Xi9SJaceih26XZG6b45f4Bz9VOamyUlK/EttHDM4gy+7 JinQc3/AI0llC8JB4J1B8L+R6Kbd970eDfVFBFMdk8GngQ1wUJTGrUUP60CdkeHqTg9I Qf1A== 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:mime-version:content-transfer-encoding; bh=gsT8g95CdCyxJl6epoAfw3UyifKXpWKn2cCa/f9AIzQ=; b=rS1rMGk+MVAAjeiR2xhkzxTKHz34FU4Y90bB+02PcMcPBfY+0AvlUqOVoV5rdCCUd5 zhz6zKdhbOKC2jGRluOO4n6ksrSLrkIl6NGtwj1pC4S6RRrC9AQK8fHIstUuh6cwnDU0 rLb1QuJHN3iYmVoOTHLfI8z7Cq2k9hL8MUIyMNF6Ps6Yl68BYVE8ALHTRm5pRlaBuXhn 4uYBHrye4bE41P5taxedkEKLPLWcMbNwm7Zb2/E2W5dZbwVzpN8rh3h0h3pYCj5MoPgB C7gau3vd2eZ3O94aqP9yIBVsLphGWasczo+BWllM9hLsF0IUfwgJFuEBH5yA/QX95a39 kHEg== X-Gm-Message-State: APjAAAXmq33b1fqtRNSaZqDRY/2xcgKwWzS1FdLpPWVc1kdsN+CrGoXU P7F900aKqJduEENEQ+/xlsZtZ72oS4k= X-Google-Smtp-Source: APXvYqydQ8QQAW+bqVCvDtM2h/NESHN3FXruqG4vYpxqPQVZ21teAsiPuXz1LQC9vYZ5SfxuguZQkw== X-Received: by 2002:a63:d408:: with SMTP id a8mr11646702pgh.184.1556904318062; Fri, 03 May 2019 10:25:18 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id t13sm3109578pgj.49.2019.05.03.10.25.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 May 2019 10:25:16 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , David Marchand Date: Fri, 3 May 2019 10:25:04 -0700 Message-Id: <20190503172507.5272-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190503172507.5272-1-stephen@networkplumber.org> References: <20190410171603.8979-1-stephen@networkplumber.org> <20190503172507.5272-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 --- 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 | 49 ++++++++++++++++------- lib/librte_eal/rte_eal_version.map | 11 +++++ 4 files changed, 91 insertions(+), 14 deletions(-) diff --git a/doc/guides/rel_notes/release_19_05.rst b/doc/guides/rel_notes/release_19_05.rst index 468e325395c7..35c0c9081958 100644 --- a/doc/guides/rel_notes/release_19_05.rst +++ b/doc/guides/rel_notes/release_19_05.rst @@ -275,6 +275,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 8c2744fabcbf..ae59c98ca43a 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 705594acbb5e..d0006a077fae 100644 --- a/lib/librte_eal/common/include/rte_lcore.h +++ b/lib/librte_eal/common/include/rte_lcore.h @@ -121,15 +121,7 @@ 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_lcore_index(int lcore_id); /** * Return the ID of the physical socket of the logical core we are @@ -177,11 +169,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 245493461c36..b4aec1667122 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -287,6 +287,16 @@ DPDK_19.05 { } DPDK_18.11; +DPDK_19.05 { + global: + + rte_lcore_cpuset; + rte_lcore_index; + rte_lcore_to_cpu_id; + rte_lcore_to_socket_id; + +} DPDK_18.11; + EXPERIMENTAL { global: @@ -337,6 +347,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 Fri May 3 17:25:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 53265 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 4B5121B122; Fri, 3 May 2019 19:25:24 +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 82F3D4C77 for ; Fri, 3 May 2019 19:25:21 +0200 (CEST) Received: by mail-pf1-f195.google.com with SMTP id 13so2892701pfw.9 for ; Fri, 03 May 2019 10:25:21 -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 :mime-version:content-transfer-encoding; bh=Tk+THDTtwwPo1XgpH2f5PsOUp7bFrD3PI8G0F2fMdg0=; b=g5kDJNoNiOHRQtxnpRjZdzUgXvmCIqaxkUpdGX5LEdcFCxuIzwwB4S/KyTNRnFo3fq ytA16sjM1te+mZHT/bH6nA1CeJCjxPDScUv+qJOUaQSaPkjxLrawSSFrL8XgnMJGbp+G X2+QlBeQsG96XROMRea2SkPJC1GIsDrp1IN93J7gnn6V4QoVirJKgMo6bIOsxhYNmgA/ WhYt4qUZogP01zwVkQfVjLGLWfpapNbVXjJtHqB1O8QdWCK2oVvtxcDHRBwXrq6CE0pB y9toAdvyvDHGcr576mr3SxkiaxJg5G8XwQ9VT3/cXyvmcbIcZU8M/WaLOmAZbS5MBLDP li+g== 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:mime-version:content-transfer-encoding; bh=Tk+THDTtwwPo1XgpH2f5PsOUp7bFrD3PI8G0F2fMdg0=; b=k2sdRrTM2Uks7x/ZkSWodsK851Xfj0j9vJUhXmUqbENRs6hzLEK7wLmD9kEPOLvNe/ uGS5ieew1qwHNLRUtCXHcXjMaSQZhfEakv1/aw6b0NsJZJmIBd500wkznNu98fDjM15q i/uugj+jZAWlKjVCD69wHDCp22b+Vn+SgPynKjdJVRtHDvaBecipbszBh9uGYh5oG3e6 9EPiQjUjZ51Vt923k7trGHFfJB2pUJz4bBrays2WpUfJ1tBVpcol8vQI6E3GBp4+g197 r5nK1MSIALJXIj+EQiGc8jR1kIIXEyrQMrESnJt8gvNWfrnL+ELviTaN2ML1PuyRFxxW oCOg== X-Gm-Message-State: APjAAAUNab6qv+V/ov4Cn0ilNeucQtgkAVsQHAOk4S0ASWbrZddV4bjt F2OmvZhHREmjZVsuihYvR8qxhp8aFvE= X-Google-Smtp-Source: APXvYqyeawqYL1hc/2m0JNx+na4vIzQbJbK5L/MGxiqj4ffIpWnE/OOqM5hbC2Kw9JNr86JHOiUJ5A== X-Received: by 2002:aa7:8190:: with SMTP id g16mr12562413pfi.92.1556904320017; Fri, 03 May 2019 10:25:20 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id t13sm3109578pgj.49.2019.05.03.10.25.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 May 2019 10:25:18 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , David Marchand Date: Fri, 3 May 2019 10:25:05 -0700 Message-Id: <20190503172507.5272-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190503172507.5272-1-stephen@networkplumber.org> References: <20190410171603.8979-1-stephen@networkplumber.org> <20190503172507.5272-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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 Fri May 3 17:25:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 53266 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 94EE01B131; Fri, 3 May 2019 19:25:26 +0200 (CEST) Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by dpdk.org (Postfix) with ESMTP id 9C1011B11F for ; Fri, 3 May 2019 19:25:22 +0200 (CEST) Received: by mail-pl1-f193.google.com with SMTP id a59so3000885pla.5 for ; Fri, 03 May 2019 10:25:22 -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 :mime-version:content-transfer-encoding; bh=zNltVzlxvH9rabMCydlhPZChw/XgxYYGtV0k1rmfLOw=; b=Oz98T+v3l2X4wqtNc1Ek13o1MWY41BGHYNvxZm6Z56TWiA4Rt1dDYqZpgwPqc+9yu5 HwMQSjVxuvkUcc8CDDmWsPovRUcXca8yMRXt7xHJTOSquFt37r7DUrA431YXoLh6iEVQ aFmRDxduwxozU6Bah4bm/xW4tYX95k2z7ACLf5VKo323mo9Ru/kQg5YdNS7qj8/rxSF8 dhl6sjQqHLqBedx0T5cWp87iCBBtMAhwq/JtpD1DLkDDEwK6h57NEx0ndXYMSbDmN/vk uf5Xucns1uk/nnWZeaW96wyg0GnqVsoS4PempqwVmfIjgYmmmhJZNdzsffD4XuahJ+UZ Oa/w== 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:mime-version:content-transfer-encoding; bh=zNltVzlxvH9rabMCydlhPZChw/XgxYYGtV0k1rmfLOw=; b=Z0kjM0nR8Zu1NWUOeh24YwshnBmH2bnSuMDl7N41u8gE2IEnhvI4y5SgibCv0S09U7 Ilh1ErAImfFSt7W4Wj33doZLoOUIRtwfl/yvmqPzTAp1L0Yu23vldUYOYBtEpzUWmzZ/ fVB0bwelpxDRh+qAQEjFYVgeSCwdeHInxRCk2aPyhaZ15V4eXB6uKeDnySYZKLdtCiCm arUqhxIAmFTrGZTmBhX0NBNy+hpicgaqYjcjBwFG5kfnhF07/cPixacQK7IMQ9LwvNrZ EGEJVPHYOsfWALGus99MY/uN0TYtyzBY8L61mPRk+8/zSwRGzKY8VqV8uVYHwPJdlJGv HLCg== X-Gm-Message-State: APjAAAVzZdeHX+2YrPCKsjy9m9GJVoZ14ex3XrcGdRv3Si4xZ9FEPFlL COS8Zk6lZyFAdlqnWWJPFVTSNEoW4tA= X-Google-Smtp-Source: APXvYqxhyJWEbZuN228cOUgzYlwHbZGbpaTYJR0atTWqh8a9AqAXr7MnTiqAVrTHPJxkJ0AQ2zTBbQ== X-Received: by 2002:a17:902:4681:: with SMTP id p1mr12006964pld.139.1556904321584; Fri, 03 May 2019 10:25:21 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id t13sm3109578pgj.49.2019.05.03.10.25.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 May 2019 10:25:20 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 3 May 2019 10:25:06 -0700 Message-Id: <20190503172507.5272-5-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190503172507.5272-1-stephen@networkplumber.org> References: <20190410171603.8979-1-stephen@networkplumber.org> <20190503172507.5272-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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. Also remove unnecessary assignment of slave_core_id. Signed-off-by: Stephen Hemminger --- examples/bond/main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/bond/main.c b/examples/bond/main.c index ef86194fff4a..1b35d53c8efa 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; } @@ -760,7 +761,7 @@ static void prompt(__attribute__((unused)) void *arg1) int main(int argc, char *argv[]) { - int ret; + int ret, slave_core_id; uint16_t nb_ports, i; /* init EAL */ @@ -792,13 +793,13 @@ main(int argc, char *argv[]) bond_port_init(mbuf_pool); rte_spinlock_init(&global_flag_stru_p->lock); - int slave_core_id = rte_lcore_id(); /* check state of lcores */ RTE_LCORE_FOREACH_SLAVE(slave_core_id) { - if (lcore_config[slave_core_id].state != WAIT) - return -EBUSY; + if (rte_eal_get_lcore_state(slave_core_id) != WAIT) + return -EBUSY; } + /* start lcore main on core != master_core - ARP response thread */ slave_core_id = rte_get_next_lcore(rte_lcore_id(), 1, 0); if ((slave_core_id >= RTE_MAX_LCORE) || (slave_core_id == 0)) From patchwork Fri May 3 17:25:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 53267 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 6005C1B13B; Fri, 3 May 2019 19:25:28 +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 43BC01B115 for ; Fri, 3 May 2019 19:25:24 +0200 (CEST) Received: by mail-pf1-f194.google.com with SMTP id b3so3214408pfd.1 for ; Fri, 03 May 2019 10:25:24 -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 :mime-version:content-transfer-encoding; bh=qhaOm1HVc21fLEYvuYBUQssEMFmEDoOXFXzY6/OqSK4=; b=A0Ei0Z0uJ6J54F72pe0ZyLbaL504lAvFv/UHyJKFOqsOlsncuNnEMfSRgWuyyWglGF ux2RIccUN+O8mEEshoFLXKxytwOYOFoPI8uUW+465arDy5ZUPgF/zPKTbuYjo/t7NYfM AxksEULuvipvZRbchHKG/42iYy/3B80A+t3MXPhPFqUdrGkffz7RMgpNEcCCedqc/9R/ P5x4ucmE6kNG5Girw88R+QmGLvX4sVanXgnrNBYNEr035jFOxDb47giXQ0mb89WD/Nci hZE3eDlk0LScMMTmE3IdbS4Iz9Pv+WPrVSn7ECO8+mZJTq4I+jF932OMIswiw9D4DzxC 1UqA== 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:mime-version:content-transfer-encoding; bh=qhaOm1HVc21fLEYvuYBUQssEMFmEDoOXFXzY6/OqSK4=; b=QPis+Ovp5unc0XeAw5E/BOKrHq9PnCV6xp4p64vGtPxeoF6zNB+MocAaR2x0XoUMyr pL86yD7JU45/whM/sF/zD7Y2HSF8mZ9F1VLmtYK4NX3hQHGYNB52UDweVc0ol2qnJpYt BpYp9XxzIOTlxxd8LBeH/ekjD2KDxU/vdd+Kx/N5fs8BAJGT38FzmVYcfeqYnih9TMjQ cTZiN21Zo975nGEGgUisy8qCS831vmBq/BYbW9KswNfncWBeXZnHEFz8YGrMRyN2sEQX bdY1Xna3+Q8s+iiHEhkApgNN6DUkj8TPRAUE/xp5LPCg2bN93mZBD3qFxCF5b8I0/sL8 KfnA== X-Gm-Message-State: APjAAAUh/cbhWhV3oQ573skC1UoQEvx9X7yNxelMfxTSQMFUqJbx2zIv AMj7jD6fCvNrEMxr2c8CvVeKeW7kVeU= X-Google-Smtp-Source: APXvYqxxQ7lb1tvkJM7vkc2Sm6blUb2Y+3XfVOHnWDCQV9DMpL/4/d9Dnaqxy1Cy+fB3stBqNEeQIA== X-Received: by 2002:aa7:800e:: with SMTP id j14mr12312008pfi.157.1556904323163; Fri, 03 May 2019 10:25:23 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id t13sm3109578pgj.49.2019.05.03.10.25.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 May 2019 10:25:22 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , David Marchand Date: Fri, 3 May 2019 10:25:07 -0700 Message-Id: <20190503172507.5272-6-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190503172507.5272-1-stephen@networkplumber.org> References: <20190410171603.8979-1-stephen@networkplumber.org> <20190503172507.5272-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 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];