From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 04716A045E for ; Wed, 29 May 2019 18:33:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F13651B9DD; Wed, 29 May 2019 18:31:46 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 311A01B9BE for ; Wed, 29 May 2019 18:31:39 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 May 2019 09:31:38 -0700 X-ExtLoop1: 1 Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.223.125]) by orsmga005.jf.intel.com with ESMTP; 29 May 2019 09:31:36 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Yipeng Wang , Sameh Gobriel , Bruce Richardson , Pablo de Lara , Ferruh Yigit , stephen@networkplumber.org, thomas@monjalon.net, david.marchand@redhat.com Date: Wed, 29 May 2019 17:31:00 +0100 Message-Id: <77b02a2256d992f23a74514796d6c8bb655bd174.1559147228.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 14/25] hash: use new tailq locking 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" Replace usages of direct access to shared memory config with calls to the new API. Signed-off-by: Anatoly Burakov --- lib/librte_hash/rte_cuckoo_hash.c | 16 ++++++++-------- lib/librte_hash/rte_fbk_hash.c | 14 +++++++------- lib/librte_kni/rte_kni.c | 16 ++++++++-------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/librte_hash/rte_cuckoo_hash.c b/lib/librte_hash/rte_cuckoo_hash.c index 2dc423fba..ffe649411 100644 --- a/lib/librte_hash/rte_cuckoo_hash.c +++ b/lib/librte_hash/rte_cuckoo_hash.c @@ -52,13 +52,13 @@ rte_hash_find_existing(const char *name) hash_list = RTE_TAILQ_CAST(rte_hash_tailq.head, rte_hash_list); - rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_read_lock(); TAILQ_FOREACH(te, hash_list, next) { h = (struct rte_hash *) te->data; if (strncmp(name, h->name, RTE_HASH_NAMESIZE) == 0) break; } - rte_rwlock_read_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_read_unlock(); if (te == NULL) { rte_errno = ENOENT; @@ -239,7 +239,7 @@ rte_hash_create(const struct rte_hash_parameters *params) snprintf(hash_name, sizeof(hash_name), "HT_%s", params->name); - rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_lock(); /* guarantee there's no existing: this is normally already checked * by ring creation above */ @@ -437,11 +437,11 @@ rte_hash_create(const struct rte_hash_parameters *params) te->data = (void *) h; TAILQ_INSERT_TAIL(hash_list, te, next); - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); return h; err_unlock: - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); err: rte_ring_free(r); rte_ring_free(r_ext); @@ -466,7 +466,7 @@ rte_hash_free(struct rte_hash *h) hash_list = RTE_TAILQ_CAST(rte_hash_tailq.head, rte_hash_list); - rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_lock(); /* find out tailq entry */ TAILQ_FOREACH(te, hash_list, next) { @@ -475,13 +475,13 @@ rte_hash_free(struct rte_hash *h) } if (te == NULL) { - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); return; } TAILQ_REMOVE(hash_list, te, next); - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); if (h->use_local_cache) rte_free(h->local_free_slots); diff --git a/lib/librte_hash/rte_fbk_hash.c b/lib/librte_hash/rte_fbk_hash.c index 9360f7981..54a8596ab 100644 --- a/lib/librte_hash/rte_fbk_hash.c +++ b/lib/librte_hash/rte_fbk_hash.c @@ -50,13 +50,13 @@ rte_fbk_hash_find_existing(const char *name) fbk_hash_list = RTE_TAILQ_CAST(rte_fbk_hash_tailq.head, rte_fbk_hash_list); - rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_read_lock(); TAILQ_FOREACH(te, fbk_hash_list, next) { h = (struct rte_fbk_hash_table *) te->data; if (strncmp(name, h->name, RTE_FBK_HASH_NAMESIZE) == 0) break; } - rte_rwlock_read_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_read_unlock(); if (te == NULL) { rte_errno = ENOENT; return NULL; @@ -103,7 +103,7 @@ rte_fbk_hash_create(const struct rte_fbk_hash_params *params) snprintf(hash_name, sizeof(hash_name), "FBK_%s", params->name); - rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_lock(); /* guarantee there's no existing */ TAILQ_FOREACH(te, fbk_hash_list, next) { @@ -165,7 +165,7 @@ rte_fbk_hash_create(const struct rte_fbk_hash_params *params) TAILQ_INSERT_TAIL(fbk_hash_list, te, next); exit: - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); return ht; } @@ -188,7 +188,7 @@ rte_fbk_hash_free(struct rte_fbk_hash_table *ht) fbk_hash_list = RTE_TAILQ_CAST(rte_fbk_hash_tailq.head, rte_fbk_hash_list); - rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_lock(); /* find out tailq entry */ TAILQ_FOREACH(te, fbk_hash_list, next) { @@ -197,13 +197,13 @@ rte_fbk_hash_free(struct rte_fbk_hash_table *ht) } if (te == NULL) { - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); return; } TAILQ_REMOVE(fbk_hash_list, te, next); - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); rte_free(ht); rte_free(te); diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index e6507b07d..d0884aeb9 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -214,7 +214,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool, return NULL; } - rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_lock(); kni = __rte_kni_get(conf->name); if (kni != NULL) { @@ -313,7 +313,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool, kni_list = RTE_TAILQ_CAST(rte_kni_tailq.head, rte_kni_list); TAILQ_INSERT_TAIL(kni_list, te, next); - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); /* Allocate mbufs and then put them into alloc_q */ kni_allocate_mbufs(kni); @@ -327,7 +327,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool, kni_fail: rte_free(te); unlock: - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); return NULL; } @@ -390,7 +390,7 @@ rte_kni_release(struct rte_kni *kni) kni_list = RTE_TAILQ_CAST(rte_kni_tailq.head, rte_kni_list); - rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_lock(); TAILQ_FOREACH(te, kni_list, next) { if (te->data == kni) @@ -408,7 +408,7 @@ rte_kni_release(struct rte_kni *kni) TAILQ_REMOVE(kni_list, te, next); - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); /* mbufs in all fifo should be released, except request/response */ @@ -432,7 +432,7 @@ rte_kni_release(struct rte_kni *kni) return 0; unlock: - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); return -1; } @@ -649,11 +649,11 @@ rte_kni_get(const char *name) if (name == NULL || name[0] == '\0') return NULL; - rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_read_lock(); kni = __rte_kni_get(name); - rte_rwlock_read_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_read_unlock(); return kni; } -- 2.17.1