From patchwork Thu Jun 27 11:38:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Burakov, Anatoly" X-Patchwork-Id: 55489 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 BA1F25905; Thu, 27 Jun 2019 13:39:24 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 8ABA83237 for ; Thu, 27 Jun 2019 13:39:18 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jun 2019 04:39:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,423,1557212400"; d="scan'208";a="245785813" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.223.125]) by orsmga001.jf.intel.com with ESMTP; 27 Jun 2019 04:39:16 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: david.marchand@redhat.com, thomas@monjalon.net, stephen@networkplumber.org Date: Thu, 27 Jun 2019 12:38:59 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3 04/14] eal: add EAL tailq list lock/unlock API 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" Currently, locking/unlocking the TAILQ list requires direct access to the shared memory config. Add an API to do the same. Signed-off-by: Anatoly Burakov --- lib/librte_eal/common/eal_common_mcfg.c | 28 +++++++++++++++++++ .../common/include/rte_eal_memconfig.h | 24 ++++++++++++++++ lib/librte_eal/rte_eal_version.map | 4 +++ 3 files changed, 56 insertions(+) diff --git a/lib/librte_eal/common/eal_common_mcfg.c b/lib/librte_eal/common/eal_common_mcfg.c index 985d36cc2..05167e4dc 100644 --- a/lib/librte_eal/common/eal_common_mcfg.c +++ b/lib/librte_eal/common/eal_common_mcfg.c @@ -32,3 +32,31 @@ rte_mcfg_mem_write_unlock(void) struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; rte_rwlock_write_unlock(&mcfg->memory_hotplug_lock); } + +void +rte_mcfg_tailq_read_lock(void) +{ + struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; + rte_rwlock_read_lock(&mcfg->qlock); +} + +void +rte_mcfg_tailq_read_unlock(void) +{ + struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; + rte_rwlock_read_unlock(&mcfg->qlock); +} + +void +rte_mcfg_tailq_write_lock(void) +{ + struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; + rte_rwlock_write_lock(&mcfg->qlock); +} + +void +rte_mcfg_tailq_write_unlock(void) +{ + struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; + rte_rwlock_write_unlock(&mcfg->qlock); +} diff --git a/lib/librte_eal/common/include/rte_eal_memconfig.h b/lib/librte_eal/common/include/rte_eal_memconfig.h index a554518ef..240fa150b 100644 --- a/lib/librte_eal/common/include/rte_eal_memconfig.h +++ b/lib/librte_eal/common/include/rte_eal_memconfig.h @@ -124,6 +124,30 @@ rte_mcfg_mem_write_lock(void); void rte_mcfg_mem_write_unlock(void); +/** + * Lock the internal EAL TAILQ list for shared access. + */ +void +rte_mcfg_tailq_read_lock(void); + +/** + * Unlock the internal EAL TAILQ list for shared access. + */ +void +rte_mcfg_tailq_read_unlock(void); + +/** + * Lock the internal EAL TAILQ list for exclusive access. + */ +void +rte_mcfg_tailq_write_lock(void); + +/** + * Unlock the internal EAL TAILQ list for exclusive access. + */ +void +rte_mcfg_tailq_write_unlock(void); + #ifdef __cplusplus } #endif diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index faad879db..ebdcdf269 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -296,6 +296,10 @@ DPDK_19.08 { rte_mcfg_mem_read_unlock; rte_mcfg_mem_write_lock; rte_mcfg_mem_write_unlock; + rte_mcfg_tailq_read_lock; + rte_mcfg_tailq_read_unlock; + rte_mcfg_tailq_write_lock; + rte_mcfg_tailq_write_unlock; } DPDK_19.05;