tailq: remove static slots

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@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
This commit is contained in:
David Marchand 2015-03-04 22:50:09 +01:00 committed by Thomas Monjalon
parent a2348166ea
commit 95b6a46fa6
7 changed files with 3 additions and 161 deletions

View File

@ -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;

View File

@ -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

View File

@ -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 @@ rte_eal_tailq_register(struct rte_tailq_elem *t)
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

View File

@ -44,15 +44,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

View File

@ -106,25 +106,6 @@ struct rte_tailq_elem {
#define RTE_TAILQ_LOOKUP(name, struct_name) \
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.
*
@ -148,21 +129,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.
*

View File

@ -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

View File

@ -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;