[dpdk-dev] [PATCH 09/10] tailq: remove static slots

David Marchand david.marchand at 6wind.com
Wed Mar 4 22:50:09 CET 2015


No static entry remaining, the rte_tailq api is for "internal use" only, get rid
of the static slots.

Signed-off-by: David Marchand <david.marchand at 6wind.com>
---
 lib/librte_eal/bsdapp/eal/rte_eal_version.map     |    1 -
 lib/librte_eal/common/Makefile                    |    2 +-
 lib/librte_eal/common/eal_common_tailqs.c         |   47 +-------------
 lib/librte_eal/common/include/rte_eal_memconfig.h |    9 ---
 lib/librte_eal/common/include/rte_tailq.h         |   34 ----------
 lib/librte_eal/common/include/rte_tailq_elem.h    |   70 ---------------------
 lib/librte_eal/linuxapp/eal/rte_eal_version.map   |    1 -
 7 files changed, 3 insertions(+), 161 deletions(-)
 delete mode 100644 lib/librte_eal/common/include/rte_tailq_elem.h

diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index e42ea74..67b6a6c 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -44,7 +44,6 @@ DPDK_2.0 {
 	rte_eal_process_type;
 	rte_eal_remote_launch;
 	rte_eal_tailq_lookup;
-	rte_eal_tailq_lookup_by_idx;
 	rte_eal_tailq_register;
 	rte_eal_wait_lcore;
 	rte_exit;
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index 52c1a5f..cf961a7 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -36,7 +36,7 @@ INC += rte_debug.h rte_eal.h rte_errno.h rte_launch.h rte_lcore.h
 INC += rte_log.h rte_memory.h rte_memzone.h rte_pci.h
 INC += rte_pci_dev_ids.h rte_per_lcore.h rte_random.h
 INC += rte_rwlock.h rte_tailq.h rte_interrupts.h rte_alarm.h
-INC += rte_string_fns.h rte_version.h rte_tailq_elem.h
+INC += rte_string_fns.h rte_version.h
 INC += rte_eal_memconfig.h rte_malloc_heap.h
 INC += rte_hexdump.h rte_devargs.h rte_dev.h
 INC += rte_common_vect.h
diff --git a/lib/librte_eal/common/eal_common_tailqs.c b/lib/librte_eal/common/eal_common_tailqs.c
index 3c4e70d..d9551cd 100644
--- a/lib/librte_eal/common/eal_common_tailqs.c
+++ b/lib/librte_eal/common/eal_common_tailqs.c
@@ -55,14 +55,6 @@
 
 #include "eal_private.h"
 
-/**
- * Name of tailq_head
- */
-const char* rte_tailq_names[RTE_MAX_TAILQ] = {
-#define rte_tailq_elem(idx, name)     name,
-#include <rte_tailq_elem.h>
-};
-
 TAILQ_HEAD(rte_tailq_elem_head, rte_tailq_elem);
 /* local tailq list */
 static struct rte_tailq_elem_head rte_tailq_elem_head =
@@ -81,11 +73,6 @@ rte_eal_tailq_lookup(const char *name)
 		return NULL;
 
 	for (i = 0; i < RTE_MAX_TAILQ; i++) {
-		if (i < RTE_TAILQ_NUM &&
-		    !strncmp(name, rte_tailq_names[i], RTE_TAILQ_NAMESIZE-1))
-			return &mcfg->tailq_head[i];
-
-		/* if past static entries, look at shared mem for names */
 		if (!strncmp(name, mcfg->tailq_head[i].name,
 			     RTE_TAILQ_NAMESIZE-1))
 			return &mcfg->tailq_head[i];
@@ -94,19 +81,6 @@ rte_eal_tailq_lookup(const char *name)
 	return NULL;
 }
 
-inline struct rte_tailq_head *
-rte_eal_tailq_lookup_by_idx(const unsigned tailq_idx)
-{
-	struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config;
-
-	if (tailq_idx >= RTE_MAX_TAILQ) {
-		RTE_LOG(ERR, EAL, "%s(): No more room in config\n", __func__);
-		return NULL;
-	}
-
-	return &mcfg->tailq_head[tailq_idx];
-}
-
 void
 rte_dump_tailq(FILE *f)
 {
@@ -119,15 +93,9 @@ rte_dump_tailq(FILE *f)
 	for (i = 0; i < RTE_MAX_TAILQ; i++) {
 		const struct rte_tailq_head *tailq = &mcfg->tailq_head[i];
 		const struct rte_tailq_entry_head *head = &tailq->tailq_head;
-		const char *name = "nil";
-
-		if (rte_tailq_names[i])
-			name = rte_tailq_names[i];
-		else if (tailq->name)
-			name = tailq->name;
 
 		fprintf(f, "Tailq %u: qname:<%s>, tqh_first:%p, tqh_last:%p\n",
-			i, name, head->tqh_first, head->tqh_last);
+			i, tailq->name, head->tqh_first, head->tqh_last);
 	}
 	rte_rwlock_read_unlock(&mcfg->qlock);
 }
@@ -209,20 +177,9 @@ error:
 int
 rte_eal_tailqs_init(void)
 {
-	unsigned i;
-	struct rte_mem_config *mcfg = NULL;
 	struct rte_tailq_elem *t;
 
-	RTE_BUILD_BUG_ON(RTE_MAX_TAILQ < RTE_TAILQ_NUM);
-
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
-		mcfg = rte_eal_get_configuration()->mem_config;
-		for (i = 0; i < RTE_TAILQ_NUM; i++)
-			TAILQ_INIT(&mcfg->tailq_head[i].tailq_head);
-	}
-
-	/* mark those static entries as already taken */
-	rte_tailqs_count = RTE_TAILQ_NUM;
+	rte_tailqs_count = 0;
 
 	TAILQ_FOREACH(t, &rte_tailq_elem_head, next) {
 		/* second part of register job for "early" tailqs, see
diff --git a/lib/librte_eal/common/include/rte_eal_memconfig.h b/lib/librte_eal/common/include/rte_eal_memconfig.h
index d6359e5..34f5abc 100644
--- a/lib/librte_eal/common/include/rte_eal_memconfig.h
+++ b/lib/librte_eal/common/include/rte_eal_memconfig.h
@@ -45,15 +45,6 @@ extern "C" {
 #endif
 
 /**
- * Index type of tailq_head
- */
-enum rte_tailq_t {
-#define rte_tailq_elem(idx, name)     idx,
-#define rte_tailq_end(idx)            idx
-#include <rte_tailq_elem.h>
-};
-
-/**
  * the structure for the memory configuration for the RTE.
  * Used by the rte_config structure. It is separated out, as for multi-process
  * support, the memory details should be shared across instances
diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h
index df11183..4a686e6 100644
--- a/lib/librte_eal/common/include/rte_tailq.h
+++ b/lib/librte_eal/common/include/rte_tailq.h
@@ -107,25 +107,6 @@ struct rte_tailq_elem {
 	RTE_TAILQ_CAST(rte_eal_tailq_lookup(name), struct_name)
 
 /**
- * Utility macro to make looking up a tailqueue for a particular struct easier.
- *
- * @param idx
- *   The tailq idx defined in rte_tail_t to be given to the tail queue.
- *
- * @param struct_name
- *   The name of the list type we are using. (Generally this is the same as the
- *   first parameter passed to TAILQ_HEAD macro)
- *
- * @return
- *   The return value from rte_eal_tailq_lookup, typecast to the appropriate
- *   structure pointer type.
- *   NULL on error, since the tailq_head is the first
- *   element in the rte_tailq_head structure.
- */
-#define RTE_TAILQ_LOOKUP_BY_IDX(idx, struct_name) \
-	RTE_TAILQ_CAST(rte_eal_tailq_lookup_by_idx(idx), struct_name)
-
-/**
  * Dump tail queues to the console.
  *
  * @param f
@@ -149,21 +130,6 @@ void rte_dump_tailq(FILE *f);
 struct rte_tailq_head *rte_eal_tailq_lookup(const char *name);
 
 /**
- * Lookup for a tail queue.
- *
- * Get a pointer to a tail queue header of a tail
- * queue identified by the name given as an argument.
- * Note: this function is not multi-thread safe, and should only be called from
- * a single thread at a time
- *
- * @param idx
- *   The tailq idx defined in rte_tail_t to be given to the tail queue.
- * @return
- *   A pointer to the tail queue head structure.
- */
-struct rte_tailq_head *rte_eal_tailq_lookup_by_idx(const unsigned idx);
-
-/**
  * Register a tail queue.
  *
  * Register a tail queue from shared memory.
diff --git a/lib/librte_eal/common/include/rte_tailq_elem.h b/lib/librte_eal/common/include/rte_tailq_elem.h
deleted file mode 100644
index e88211c..0000000
--- a/lib/librte_eal/common/include/rte_tailq_elem.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @file
- *
- * This file contains the type of the tailq elem recognised by DPDK, which
- * can be used to fill out an array of structures describing the tailq.
- *
- * In order to populate an array, the user of this file must define this macro:
- * rte_tailq_elem(idx, name). For example:
- *
- * @code
- * enum rte_tailq_t {
- * #define rte_tailq_elem(idx, name)     idx,
- * #define rte_tailq_end(idx)            idx
- * #include <rte_tailq_elem.h>
- * };
- *
- * const char* rte_tailq_names[RTE_MAX_TAILQ] = {
- * #define rte_tailq_elem(idx, name)     name,
- * #include <rte_tailq_elem.h>
- * };
- * @endcode
- *
- * Note that this file can be included multiple times within the same file.
- */
-
-#ifndef rte_tailq_elem
-#define rte_tailq_elem(idx, name)
-#endif /* rte_tailq_elem */
-
-#ifndef rte_tailq_end
-#define rte_tailq_end(idx)
-#endif /* rte_tailq_end */
-
-rte_tailq_end(RTE_TAILQ_NUM)
-
-#undef rte_tailq_elem
-#undef rte_tailq_end
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 3db5856..7e850a9 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -48,7 +48,6 @@ DPDK_2.0 {
 	rte_eal_process_type;
 	rte_eal_remote_launch;
 	rte_eal_tailq_lookup;
-	rte_eal_tailq_lookup_by_idx;
 	rte_eal_tailq_register;
 	rte_eal_vdev_init;
 	rte_eal_vdev_uninit;
-- 
1.7.10.4



More information about the dev mailing list