From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) by dpdk.org (Postfix) with ESMTP id 22ADE5A8A for ; Wed, 4 Mar 2015 22:50:25 +0100 (CET) Received: by wevm14 with SMTP id m14so49131837wev.13 for ; Wed, 04 Mar 2015 13:50:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=BqD6ZE1AvW44wlUwXlEWObvGjyUTVTs4hDRkwU4X9R0=; b=NdEeu0d7/Mo/MBFVy7y9Y26hvmqrg3dzhHKR5/Z5mGQIt2MF+WtPU3ikA8SkCEH5lJ bVpgAsvm+jV0XSm4wq80LTBAUwydSd/twekmO3o8CoV4r8M4hYFSAtcd5LzSbnsjOrFg lcB4kq+QEcudn8tYZ+Nd1R/DIAxDhhadVHxd2fY2l/DcEYqpaHo2ZMdGpCL2hRnuGt5P J+dBgUSMdn24czOSz+pjQ7yW2s/dkGYA2spn6QQt6hBZw4U0Z/aWQrHS7vNgH+89EUEl FYaTZRSWErmg9tnkRmfaNLzxzC79oF+hNN5UBjOYhxu/OHIMnANXCr98hAxfvtSQIF8L HmDA== X-Gm-Message-State: ALoCoQlcAWMRV40NNAjCj8Sv6YzaVN4VX+Is8hDv7hhDCTUFUlYpz5VIqrP1OvMVx6hTKa9N2l5h X-Received: by 10.180.189.37 with SMTP id gf5mr60207334wic.86.1425505825041; Wed, 04 Mar 2015 13:50:25 -0800 (PST) Received: from alcyon.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id bf8sm6037947wjb.37.2015.03.04.13.50.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Mar 2015 13:50:24 -0800 (PST) From: David Marchand To: dev@dpdk.org Date: Wed, 4 Mar 2015 22:50:06 +0100 Message-Id: <1425505810-9269-7-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1425505810-9269-1-git-send-email-david.marchand@6wind.com> References: <1425505810-9269-1-git-send-email-david.marchand@6wind.com> Subject: [dpdk-dev] [PATCH 06/10] tailq: remove unused RTE_EAL_TAILQ_* macros X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Mar 2015 21:50:25 -0000 A lot of places just protect against concurrent access and I can not see the gain of having those macros. Signed-off-by: David Marchand --- lib/librte_eal/common/include/rte_eal.h | 58 ------------------------------- lib/librte_mempool/rte_mempool.c | 10 ++++-- 2 files changed, 7 insertions(+), 61 deletions(-) diff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h index b72606b..1385a73 100644 --- a/lib/librte_eal/common/include/rte_eal.h +++ b/lib/librte_eal/common/include/rte_eal.h @@ -195,64 +195,6 @@ rte_set_application_usage_hook( rte_usage_hook_t usage_func ); */ #define RTE_EAL_MEMPOOL_RWLOCK (&rte_eal_get_configuration()->mem_config->mplock) - -/** - * Utility macro to do a thread-safe tailq 'INSERT' of rte_mem_config - * - * @param idx - * a kind of tailq define in enum rte_tailq_t - * - * @param type - * type of list(tailq head) - * - * @param elm - * The element will be added into the list - * - */ -#define RTE_EAL_TAILQ_INSERT_TAIL(idx, type, elm) do { \ - struct type *list; \ - list = RTE_TAILQ_LOOKUP_BY_IDX(idx, type); \ - rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); \ - TAILQ_INSERT_TAIL(list, elm, next); \ - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); \ -} while (0) - -/** - * Utility macro to do a thread-safe tailq 'REMOVE' of rte_mem_config - * - * @param idx - * a kind of tailq define in enum rte_tailq_t - * - * @param type - * type of list(tailq head) - * - * @param elm - * The element will be remove from the list - * - */ -#define RTE_EAL_TAILQ_REMOVE(idx, type, elm) do { \ - struct type *list; \ - list = RTE_TAILQ_LOOKUP_BY_IDX(idx, type); \ - rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); \ - TAILQ_REMOVE(list, elm, next); \ - rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); \ -} while (0) \ - - -/** - * macro to check TAILQ exist - * - * @param idx - * a kind of tailq define in enum rte_tailq_t - * - */ -#define RTE_EAL_TAILQ_EXIST_CHECK(idx) do { \ - if (RTE_TAILQ_LOOKUP_BY_IDX(idx, rte_tailq_head) == NULL){ \ - rte_errno = E_RTE_NO_TAILQ; \ - return NULL; \ - } \ -} while(0) - /** * Whether EAL is using huge pages (disabled by --no-huge option). * The no-huge mode cannot be used with UIO poll-mode drivers like igb/ixgbe. diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index bb40523..3301e97 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -403,6 +403,7 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size, { char mz_name[RTE_MEMZONE_NAMESIZE]; char rg_name[RTE_RING_NAMESIZE]; + struct rte_mempool_list *mempool_list; struct rte_mempool *mp = NULL; struct rte_tailq_entry *te; struct rte_ring *r; @@ -432,8 +433,9 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size, #endif /* check that we have an initialised tail queue */ - if (RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_MEMPOOL, - rte_mempool_list) == NULL) { + mempool_list = RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_MEMPOOL, + rte_mempool_list); + if (mempool_list == NULL) { rte_errno = E_RTE_NO_TAILQ; return NULL; } @@ -599,7 +601,9 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size, te->data = (void *) mp; - RTE_EAL_TAILQ_INSERT_TAIL(RTE_TAILQ_MEMPOOL, rte_mempool_list, te); + rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); + TAILQ_INSERT_TAIL(mempool_list, te, next); + rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK); exit: rte_rwlock_write_unlock(RTE_EAL_MEMPOOL_RWLOCK); -- 1.7.10.4