From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 2/9] rte_tailq: change rte_dummy to rte_tailq_entry, add data pointer
Date: Tue, 17 Jun 2014 16:36:00 +0100 [thread overview]
Message-ID: <d4b40a47d61c37a6390df0173ce35661fdbb0af6.1403018971.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <cover.1402672392.git.anatoly.burakov@intel.com>
In-Reply-To: <cover.1403018971.git.anatoly.burakov@intel.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
app/test/test_tailq.c | 33 ++++++++++++++++---------------
lib/librte_eal/common/eal_common_tailqs.c | 2 +-
lib/librte_eal/common/include/rte_tailq.h | 9 +++++----
3 files changed, 23 insertions(+), 21 deletions(-)
diff --git a/app/test/test_tailq.c b/app/test/test_tailq.c
index 67da009..c9b53ee 100644
--- a/app/test/test_tailq.c
+++ b/app/test/test_tailq.c
@@ -52,16 +52,16 @@
#define DEFAULT_TAILQ (RTE_TAILQ_NUM)
-static struct rte_dummy d_elem;
+static struct rte_tailq_entry d_elem;
static int
test_tailq_create(void)
{
- struct rte_dummy_head *d_head;
+ struct rte_tailq_entry_head *d_head;
unsigned i;
/* create a first tailq and check its non-null */
- d_head = RTE_TAILQ_RESERVE_BY_IDX(DEFAULT_TAILQ, rte_dummy_head);
+ d_head = RTE_TAILQ_RESERVE_BY_IDX(DEFAULT_TAILQ, rte_tailq_entry_head);
if (d_head == NULL)
do_return("Error allocating dummy_q0\n");
@@ -70,13 +70,14 @@ test_tailq_create(void)
TAILQ_INSERT_TAIL(d_head, &d_elem, next);
/* try allocating dummy_q0 again, and check for failure */
- if (RTE_TAILQ_RESERVE_BY_IDX(DEFAULT_TAILQ, rte_dummy_head) == NULL)
+ if (RTE_TAILQ_RESERVE_BY_IDX(DEFAULT_TAILQ, rte_tailq_entry_head) == NULL)
do_return("Error, non-null result returned when attemption to "
"re-allocate a tailq\n");
/* now fill up the tailq slots available and check we get an error */
for (i = RTE_TAILQ_NUM; i < RTE_MAX_TAILQ; i++){
- if ((d_head = RTE_TAILQ_RESERVE_BY_IDX(i, rte_dummy_head)) == NULL)
+ if ((d_head = RTE_TAILQ_RESERVE_BY_IDX(i,
+ rte_tailq_entry_head)) == NULL)
break;
}
@@ -91,10 +92,10 @@ static int
test_tailq_lookup(void)
{
/* run successful test - check result is found */
- struct rte_dummy_head *d_head;
- struct rte_dummy *d_ptr;
+ struct rte_tailq_entry_head *d_head;
+ struct rte_tailq_entry *d_ptr;
- d_head = RTE_TAILQ_LOOKUP_BY_IDX(DEFAULT_TAILQ, rte_dummy_head);
+ d_head = RTE_TAILQ_LOOKUP_BY_IDX(DEFAULT_TAILQ, rte_tailq_entry_head);
if (d_head == NULL)
do_return("Error with tailq lookup\n");
@@ -104,7 +105,7 @@ test_tailq_lookup(void)
"expected element not found\n");
/* now try a bad/error lookup */
- d_head = RTE_TAILQ_LOOKUP_BY_IDX(RTE_MAX_TAILQ, rte_dummy_head);
+ d_head = RTE_TAILQ_LOOKUP_BY_IDX(RTE_MAX_TAILQ, rte_tailq_entry_head);
if (d_head != NULL)
do_return("Error, lookup does not return NULL for bad tailq name\n");
@@ -115,7 +116,7 @@ test_tailq_lookup(void)
static int
test_tailq_deprecated(void)
{
- struct rte_dummy_head *d_head;
+ struct rte_tailq_entry_head *d_head;
/* since TAILQ_RESERVE is not able to create new tailqs,
* we should find an existing one (IOW, RTE_TAILQ_RESERVE behaves identical
@@ -123,29 +124,29 @@ test_tailq_deprecated(void)
*
* PCI_RESOURCE_LIST tailq is guaranteed to
* be present in any DPDK app. */
- d_head = RTE_TAILQ_RESERVE("PCI_RESOURCE_LIST", rte_dummy_head);
+ d_head = RTE_TAILQ_RESERVE("PCI_RESOURCE_LIST", rte_tailq_entry_head);
if (d_head == NULL)
do_return("Error finding PCI_RESOURCE_LIST\n");
- d_head = RTE_TAILQ_LOOKUP("PCI_RESOURCE_LIST", rte_dummy_head);
+ d_head = RTE_TAILQ_LOOKUP("PCI_RESOURCE_LIST", rte_tailq_entry_head);
if (d_head == NULL)
do_return("Error finding PCI_RESOURCE_LIST\n");
/* try doing that with non-existent names */
- d_head = RTE_TAILQ_RESERVE("random name", rte_dummy_head);
+ d_head = RTE_TAILQ_RESERVE("random name", rte_tailq_entry_head);
if (d_head != NULL)
do_return("Non-existent tailq found!\n");
- d_head = RTE_TAILQ_LOOKUP("random name", rte_dummy_head);
+ d_head = RTE_TAILQ_LOOKUP("random name", rte_tailq_entry_head);
if (d_head != NULL)
do_return("Non-existent tailq found!\n");
/* try doing the same with NULL names */
- d_head = RTE_TAILQ_RESERVE(NULL, rte_dummy_head);
+ d_head = RTE_TAILQ_RESERVE(NULL, rte_tailq_entry_head);
if (d_head != NULL)
do_return("NULL tailq found!\n");
- d_head = RTE_TAILQ_LOOKUP(NULL, rte_dummy_head);
+ d_head = RTE_TAILQ_LOOKUP(NULL, rte_tailq_entry_head);
if (d_head != NULL)
do_return("NULL tailq found!\n");
diff --git a/lib/librte_eal/common/eal_common_tailqs.c b/lib/librte_eal/common/eal_common_tailqs.c
index f294a58..db9a185 100644
--- a/lib/librte_eal/common/eal_common_tailqs.c
+++ b/lib/librte_eal/common/eal_common_tailqs.c
@@ -118,7 +118,7 @@ rte_dump_tailq(FILE *f)
rte_rwlock_read_lock(&mcfg->qlock);
for (i=0; i < RTE_MAX_TAILQ; i++) {
const struct rte_tailq_head *tailq = &mcfg->tailq_head[i];
- const struct rte_dummy_head *head = &tailq->tailq_head;
+ const struct rte_tailq_entry_head *head = &tailq->tailq_head;
fprintf(f, "Tailq %u: qname:<%s>, tqh_first:%p, tqh_last:%p\n", i,
(rte_tailq_names[i] != NULL ? rte_tailq_names[i]:"nil"),
diff --git a/lib/librte_eal/common/include/rte_tailq.h b/lib/librte_eal/common/include/rte_tailq.h
index d084d9a..b34e5ed 100644
--- a/lib/librte_eal/common/include/rte_tailq.h
+++ b/lib/librte_eal/common/include/rte_tailq.h
@@ -48,11 +48,12 @@ extern "C" {
#include <stdio.h>
/** dummy structure type used by the rte_tailq APIs */
-struct rte_dummy {
- TAILQ_ENTRY(rte_dummy) next; /**< Pointer entries for a tailq list */
+struct rte_tailq_entry {
+ TAILQ_ENTRY(rte_tailq_entry) next; /**< Pointer entries for a tailq list */
+ void *data; /**< Pointer to the data referenced by this tailq entry */
};
/** dummy */
-TAILQ_HEAD(rte_dummy_head, rte_dummy);
+TAILQ_HEAD(rte_tailq_entry_head, rte_tailq_entry);
#define RTE_TAILQ_NAMESIZE 32
@@ -65,7 +66,7 @@ TAILQ_HEAD(rte_dummy_head, rte_dummy);
* a multi-process app to find already-created elements in shared memory.
*/
struct rte_tailq_head {
- struct rte_dummy_head tailq_head; /**< NOTE: must be first element */
+ struct rte_tailq_entry_head tailq_head; /**< NOTE: must be first element */
};
/**
--
1.8.1.4
next prev parent reply other threads:[~2014-06-17 15:36 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-13 15:29 [dpdk-dev] [PATCH 0/7] Make DPDK tailqs fully local Anatoly Burakov
2014-06-13 15:29 ` [dpdk-dev] [PATCH 1/7] rte_tailq: change rte_dummy to rte_tailq_entry, add data pointer Anatoly Burakov
2014-06-13 15:29 ` [dpdk-dev] [PATCH 2/7] rte_ring: make ring tailq completely local Anatoly Burakov
2014-06-13 15:29 ` [dpdk-dev] [PATCH 3/7] rte_hash: make rte_hash tailq fully local Anatoly Burakov
2014-06-13 15:29 ` [dpdk-dev] [PATCH 4/7] rte_fbk_hash: make rte_fbk_hash " Anatoly Burakov
2014-06-13 15:29 ` [dpdk-dev] [PATCH 5/7] rte_mempool: make mempool " Anatoly Burakov
2014-06-13 15:29 ` [dpdk-dev] [PATCH 6/7] rte_lpm: make lpm " Anatoly Burakov
2014-06-13 15:29 ` [dpdk-dev] [PATCH 7/7] rte_lpm6: make lpm6 " Anatoly Burakov
2014-06-17 9:57 ` [dpdk-dev] [PATCH 0/7] Make DPDK tailqs " Burakov, Anatoly
2014-06-17 15:35 ` [dpdk-dev] [PATCH 0/9] " Anatoly Burakov
2014-06-17 15:35 ` [dpdk-dev] [PATCH 1/9] eal: map shared config into exact same address as primary process Anatoly Burakov
2014-06-17 16:29 ` Ananyev, Konstantin
2014-06-18 9:25 ` Burakov, Anatoly
2014-06-17 15:36 ` Anatoly Burakov [this message]
2014-06-17 15:36 ` [dpdk-dev] [PATCH 3/9] rte_ring: make ring tailq fully local Anatoly Burakov
2014-06-17 15:36 ` [dpdk-dev] [PATCH 4/9] rte_hash: make rte_hash " Anatoly Burakov
2014-06-17 15:36 ` [dpdk-dev] [PATCH 5/9] rte_fbk_hash: make rte_fbk_hash " Anatoly Burakov
2014-06-17 15:36 ` [dpdk-dev] [PATCH 6/9] rte_mempool: make mempool " Anatoly Burakov
2014-06-17 15:36 ` [dpdk-dev] [PATCH 7/9] rte_lpm: make lpm " Anatoly Burakov
2014-06-17 15:36 ` [dpdk-dev] [PATCH 8/9] rte_lpm6: make lpm6 " Anatoly Burakov
2014-06-17 15:36 ` [dpdk-dev] [PATCH 9/9] rte_acl: make acl " Anatoly Burakov
2014-06-18 11:27 ` [dpdk-dev] [PATCH v3 0/9] Make DPDK tailqs " Anatoly Burakov
2014-06-18 11:27 ` [dpdk-dev] [PATCH v3 1/9] eal: map shared config into exact same address as primary process Anatoly Burakov
2014-06-18 11:27 ` [dpdk-dev] [PATCH v3 2/9] rte_tailq: change rte_dummy to rte_tailq_entry, add data pointer Anatoly Burakov
2014-06-18 11:27 ` [dpdk-dev] [PATCH v3 3/9] rte_ring: make ring tailq fully local Anatoly Burakov
2014-06-18 11:27 ` [dpdk-dev] [PATCH v3 4/9] rte_hash: make rte_hash " Anatoly Burakov
2014-06-18 11:27 ` [dpdk-dev] [PATCH v3 5/9] rte_fbk_hash: make rte_fbk_hash " Anatoly Burakov
2014-06-18 11:27 ` [dpdk-dev] [PATCH v3 6/9] rte_mempool: make mempool " Anatoly Burakov
2014-06-18 11:27 ` [dpdk-dev] [PATCH v3 7/9] rte_lpm: make lpm " Anatoly Burakov
2014-06-18 11:27 ` [dpdk-dev] [PATCH v3 8/9] rte_lpm6: make lpm6 " Anatoly Burakov
2014-06-18 11:27 ` [dpdk-dev] [PATCH v3 9/9] rte_acl: make acl " Anatoly Burakov
2014-06-18 14:21 ` [dpdk-dev] [PATCH v3 0/9] Make DPDK tailqs " Ananyev, Konstantin
2014-06-20 15:42 ` [dpdk-dev] [PATCH 00/10] " Anatoly Burakov
2014-06-20 15:42 ` [dpdk-dev] [PATCH 01/10] eal: map shared config into exact same address as primary process Anatoly Burakov
2014-06-20 15:42 ` [dpdk-dev] [PATCH 02/10] eal: use --base-virtaddr for mapping rte_config as well Anatoly Burakov
2014-06-20 15:42 ` [dpdk-dev] [PATCH 03/10] rte_tailq: change rte_dummy to rte_tailq_entry, add data pointer Anatoly Burakov
2014-06-20 15:42 ` [dpdk-dev] [PATCH 04/10] rte_ring: make ring tailq fully local Anatoly Burakov
2014-06-20 15:42 ` [dpdk-dev] [PATCH 05/10] rte_hash: make rte_hash " Anatoly Burakov
2014-06-20 15:42 ` [dpdk-dev] [PATCH 06/10] rte_fbk_hash: make rte_fbk_hash " Anatoly Burakov
2014-06-20 15:42 ` [dpdk-dev] [PATCH 07/10] rte_mempool: make mempool " Anatoly Burakov
2014-06-20 15:42 ` [dpdk-dev] [PATCH 08/10] rte_lpm: make lpm " Anatoly Burakov
2014-06-20 15:42 ` [dpdk-dev] [PATCH 09/10] rte_lpm6: make lpm6 " Anatoly Burakov
2014-06-20 15:42 ` [dpdk-dev] [PATCH 10/10] rte_acl: make acl " Anatoly Burakov
2014-07-22 22:12 ` [dpdk-dev] [PATCH 00/10] Make DPDK tailqs " Thomas Monjalon
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=d4b40a47d61c37a6390df0173ce35661fdbb0af6.1403018971.git.anatoly.burakov@intel.com \
--to=anatoly.burakov@intel.com \
--cc=dev@dpdk.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).