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 8BA12A045E for ; Wed, 29 May 2019 18:34:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B499D1B9E2; Wed, 29 May 2019 18:31:48 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 7D42E1B9C9 for ; Wed, 29 May 2019 18:31:41 +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:41 -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:38 -0700 From: Anatoly Burakov To: dev@dpdk.org Cc: Bruce Richardson , Vladimir Medvedkin , stephen@networkplumber.org, thomas@monjalon.net, david.marchand@redhat.com Date: Wed, 29 May 2019 17:31:01 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH 15/25] lpm: 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_lpm/rte_lpm.c | 24 ++++++++++++------------ lib/librte_lpm/rte_lpm6.c | 14 +++++++------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c index 6b7b28a2e..bb1c5b197 100644 --- a/lib/librte_lpm/rte_lpm.c +++ b/lib/librte_lpm/rte_lpm.c @@ -97,13 +97,13 @@ rte_lpm_find_existing_v20(const char *name) lpm_list = RTE_TAILQ_CAST(rte_lpm_tailq.head, rte_lpm_list); - rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_read_lock(); TAILQ_FOREACH(te, lpm_list, next) { l = te->data; if (strncmp(name, l->name, RTE_LPM_NAMESIZE) == 0) break; } - rte_rwlock_read_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_read_unlock(); if (te == NULL) { rte_errno = ENOENT; @@ -123,13 +123,13 @@ rte_lpm_find_existing_v1604(const char *name) lpm_list = RTE_TAILQ_CAST(rte_lpm_tailq.head, rte_lpm_list); - rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_read_lock(); TAILQ_FOREACH(te, lpm_list, next) { l = te->data; if (strncmp(name, l->name, RTE_LPM_NAMESIZE) == 0) break; } - rte_rwlock_read_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_read_unlock(); if (te == NULL) { rte_errno = ENOENT; @@ -170,7 +170,7 @@ rte_lpm_create_v20(const char *name, int socket_id, int max_rules, /* Determine the amount of memory to allocate. */ mem_size = sizeof(*lpm) + (sizeof(lpm->rules_tbl[0]) * max_rules); - rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_lock(); /* guarantee there's no existing */ TAILQ_FOREACH(te, lpm_list, next) { @@ -212,7 +212,7 @@ rte_lpm_create_v20(const char *name, int socket_id, int max_rules, TAILQ_INSERT_TAIL(lpm_list, te, next); exit: - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); return lpm; } @@ -247,7 +247,7 @@ rte_lpm_create_v1604(const char *name, int socket_id, tbl8s_size = (sizeof(struct rte_lpm_tbl_entry) * RTE_LPM_TBL8_GROUP_NUM_ENTRIES * config->number_tbl8s); - rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_lock(); /* guarantee there's no existing */ TAILQ_FOREACH(te, lpm_list, next) { @@ -315,7 +315,7 @@ rte_lpm_create_v1604(const char *name, int socket_id, TAILQ_INSERT_TAIL(lpm_list, te, next); exit: - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); return lpm; } @@ -339,7 +339,7 @@ rte_lpm_free_v20(struct rte_lpm_v20 *lpm) lpm_list = RTE_TAILQ_CAST(rte_lpm_tailq.head, rte_lpm_list); - rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_lock(); /* find our tailq entry */ TAILQ_FOREACH(te, lpm_list, next) { @@ -349,7 +349,7 @@ rte_lpm_free_v20(struct rte_lpm_v20 *lpm) if (te != NULL) TAILQ_REMOVE(lpm_list, te, next); - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); rte_free(lpm); rte_free(te); @@ -368,7 +368,7 @@ rte_lpm_free_v1604(struct rte_lpm *lpm) lpm_list = RTE_TAILQ_CAST(rte_lpm_tailq.head, rte_lpm_list); - rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_lock(); /* find our tailq entry */ TAILQ_FOREACH(te, lpm_list, next) { @@ -378,7 +378,7 @@ rte_lpm_free_v1604(struct rte_lpm *lpm) if (te != NULL) TAILQ_REMOVE(lpm_list, te, next); - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); rte_free(lpm->tbl8); rte_free(lpm->rules_tbl); diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c index a91803113..5fabfa3d4 100644 --- a/lib/librte_lpm/rte_lpm6.c +++ b/lib/librte_lpm/rte_lpm6.c @@ -316,7 +316,7 @@ rte_lpm6_create(const char *name, int socket_id, mem_size = sizeof(*lpm) + (sizeof(lpm->tbl8[0]) * RTE_LPM6_TBL8_GROUP_NUM_ENTRIES * config->number_tbl8s); - rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_lock(); /* Guarantee there's no existing */ TAILQ_FOREACH(te, lpm_list, next) { @@ -363,11 +363,11 @@ rte_lpm6_create(const char *name, int socket_id, te->data = (void *) lpm; TAILQ_INSERT_TAIL(lpm_list, te, next); - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); return lpm; fail: - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); fail_wo_unlock: rte_free(tbl8_hdrs); @@ -389,13 +389,13 @@ rte_lpm6_find_existing(const char *name) lpm_list = RTE_TAILQ_CAST(rte_lpm6_tailq.head, rte_lpm6_list); - rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_read_lock(); TAILQ_FOREACH(te, lpm_list, next) { l = (struct rte_lpm6 *) te->data; if (strncmp(name, l->name, RTE_LPM6_NAMESIZE) == 0) break; } - rte_rwlock_read_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_read_unlock(); if (te == NULL) { rte_errno = ENOENT; @@ -420,7 +420,7 @@ rte_lpm6_free(struct rte_lpm6 *lpm) lpm_list = RTE_TAILQ_CAST(rte_lpm6_tailq.head, rte_lpm6_list); - rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_lock(); /* find our tailq entry */ TAILQ_FOREACH(te, lpm_list, next) { @@ -431,7 +431,7 @@ rte_lpm6_free(struct rte_lpm6 *lpm) if (te != NULL) TAILQ_REMOVE(lpm_list, te, next); - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); + rte_eal_mcfg_tailq_write_unlock(); rte_free(lpm->tbl8_hdrs); rte_free(lpm->tbl8_pool); -- 2.17.1