All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Marchand <david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [PATCH 06/10] tailq: remove unused RTE_EAL_TAILQ_* macros
Date: Wed,  4 Mar 2015 22:50:06 +0100	[thread overview]
Message-ID: <1425505810-9269-7-git-send-email-david.marchand@6wind.com> (raw)
In-Reply-To: <1425505810-9269-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>

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 <david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
---
 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

  parent reply	other threads:[~2015-03-04 21:50 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-04 21:50 [PATCH 00/10] eal: rte_tailq api cleanup David Marchand
     [not found] ` <1425505810-9269-1-git-send-email-david.marchand-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2015-03-04 21:50   ` [PATCH 01/10] eal: remove yet another remaining reference to pm David Marchand
2015-03-04 21:50   ` [PATCH 02/10] pci: use lookup tailq api David Marchand
2015-03-04 21:50   ` [PATCH 03/10] tailq: remove unneeded inclusion of rte_tailq.h David Marchand
2015-03-04 21:50   ` [PATCH 04/10] tailq: use a single cast macro David Marchand
2015-03-04 21:50   ` [PATCH 05/10] tailq: get rid of broken "reserve" api David Marchand
2015-03-04 21:50   ` David Marchand [this message]
2015-03-04 21:50   ` [PATCH 07/10] tailq: introduce dynamic register system David Marchand
2015-03-04 21:50   ` [PATCH 08/10] tailq: move to dynamic tailq David Marchand
2015-03-04 21:50   ` [PATCH 09/10] tailq: remove static slots David Marchand
2015-03-04 21:50   ` [PATCH 10/10] eal: no need for E_RTE_NO_TAILQ anymore David Marchand
2015-03-04 22:55   ` [PATCH 00/10] eal: rte_tailq api cleanup Thomas Monjalon
2015-03-06  0:26   ` Neil Horman
     [not found]     ` <20150306002636.GA6785-0o1r3XBGOEbbgkc5XkKeNuvMHUBZFtU3YPYVAmT7z5s@public.gmane.org>
2015-03-10 11:20       ` Thomas Monjalon
2015-03-11  7:44         ` Tetsuya Mukawa
     [not found]           ` <54FFF261.9030407-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org>
2015-03-11  8:47             ` David Marchand
     [not found]               ` <CALwxeUsVUXU2MW1_DvvQzZ_4H9MSJxUWAq50u_vSRBci5O4sjQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-11 17:28                 ` David Marchand
     [not found]                   ` <CALwxeUu+vJCuuPxMDQuCk6KWQhBA8bemLNbVuOT1BY5KL_Z+9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-11 20:24                     ` Mcnamara, John
     [not found]                       ` <B27915DBBA3421428155699D51E4CFE2ECD890-kPTMFJFq+rELt2AQoY/u9bfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-11 21:29                         ` David Marchand
     [not found]                           ` <CALwxeUuDQqLwqFH-4Y9W0fZPxY1_39kgwmxtnn9yxL7AnNfCzg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-11 22:25                             ` Mcnamara, John
     [not found]                               ` <B27915DBBA3421428155699D51E4CFE2ECD92D-kPTMFJFq+rELt2AQoY/u9bfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-03-12  2:05                                 ` Tetsuya Mukawa
     [not found]                                   ` <5500F46F.8020107-AlSX/UN32fvPDbFq/vQRIQ@public.gmane.org>
2015-03-12  2:12                                     ` Tetsuya Mukawa
2015-03-12  5:44                                     ` David Marchand
     [not found]                                       ` <CALwxeUsoD3HZ2g4DfWD6A+ccVbpLEcvNaa7w8EewUmK=VDuxHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-12  8:38                                         ` Liu, Yong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1425505810-9269-7-git-send-email-david.marchand@6wind.com \
    --to=david.marchand-pdr9zngts4eavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.