From patchwork Wed Mar 4 21:50:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 3858 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id E915E9AA2; Wed, 4 Mar 2015 22:50:31 +0100 (CET) Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by dpdk.org (Postfix) with ESMTP id E02EF9A9B for ; Wed, 4 Mar 2015 22:50:30 +0100 (CET) Received: by wesq59 with SMTP id q59so12201697wes.3 for ; Wed, 04 Mar 2015 13:50:30 -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=EGSUSInqJGig1Jm12UYWsh4AwhvF03IFI/WQK6QKWPI=; b=e6nprZOqRn8ksHnmT9UCTnsXdVmm8kFm6bUNL/qcti5Y3u4OVMzJwaZhD7RpTA86GO OQ69PzRmOvmsrorz3eFobKVyYlbQB+/rR+CAOZz85UcxYMbDksdmLR9w5fPy3LODST0X 3kHdVcX4Ww2ezlQTbLpnD0L+bWOOoAPSIGSUh4tvqXce3HSQz/pMmTHtmozVK0UZryhR k48x447TXUnkAAA51KBxDUew+THwoisS2XdVy/8M7c5xVJ74kSOSpWzF/rkYlGb1C4DG 9fMSdvKxIUXoS2q3ZaLcPWL7CTbkvOsCBvdq0DtlXW3vN+mI0L7F7tiyXL+MIw/uyL9V SWcw== X-Gm-Message-State: ALoCoQkC1gh9oNbG3BE3SrQcSI8gtiKtV8+40FyIN7ik9cjXvxgT5IMazzPMhUAu/SZhQcBle9TE X-Received: by 10.180.198.101 with SMTP id jb5mr58090207wic.92.1425505830814; Wed, 04 Mar 2015 13:50:30 -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.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Mar 2015 13:50:28 -0800 (PST) From: David Marchand To: dev@dpdk.org Date: Wed, 4 Mar 2015 22:50:09 +0100 Message-Id: <1425505810-9269-10-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 09/10] tailq: remove static slots 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" No static entry remaining, the rte_tailq api is for "internal use" only, get rid of the static slots. Signed-off-by: David Marchand --- 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 -}; - 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 -}; - -/** * 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 - * }; - * - * const char* rte_tailq_names[RTE_MAX_TAILQ] = { - * #define rte_tailq_elem(idx, name) name, - * #include - * }; - * @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;