summaryrefslogtreecommitdiff
path: root/lib/librte_distributor
diff options
context:
space:
mode:
authorDavid Marchand <david.marchand@6wind.com>2015-03-04 22:50:08 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2015-03-10 12:06:08 +0100
commita2348166ea186506d45b61d5073d16ad974e79bb (patch)
tree0a16ff4f5549041e81c9cf128ad8cdca73fe3741 /lib/librte_distributor
parent873a61c7526be06f45d8d709a7c56d10cc06ab34 (diff)
downloaddpdk-next-eventdev-a2348166ea186506d45b61d5073d16ad974e79bb.zip
dpdk-next-eventdev-a2348166ea186506d45b61d5073d16ad974e79bb.tar.gz
dpdk-next-eventdev-a2348166ea186506d45b61d5073d16ad974e79bb.tar.xz
tailq: move to dynamic tailq
Use dynamic tailq rather than static entries. Signed-off-by: David Marchand <david.marchand@6wind.com> Acked-by: Neil Horman <nhorman@tuxdriver.com>
Diffstat (limited to 'lib/librte_distributor')
-rw-r--r--lib/librte_distributor/rte_distributor.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c
index 84e78bb..f3f778c 100644
--- a/lib/librte_distributor/rte_distributor.c
+++ b/lib/librte_distributor/rte_distributor.c
@@ -115,6 +115,11 @@ struct rte_distributor {
TAILQ_HEAD(rte_distributor_list, rte_distributor);
+static struct rte_tailq_elem rte_distributor_tailq = {
+ .name = "RTE_DISTRIBUTOR",
+};
+EAL_REGISTER_TAILQ(rte_distributor_tailq)
+
/**** APIs called by workers ****/
void
@@ -460,14 +465,6 @@ rte_distributor_create(const char *name,
return NULL;
}
- /* check that we have an initialised tail queue */
- distributor_list = RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_DISTRIBUTOR,
- rte_distributor_list);
- if (distributor_list == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
-
snprintf(mz_name, sizeof(mz_name), RTE_DISTRIB_PREFIX"%s", name);
mz = rte_memzone_reserve(mz_name, sizeof(*d), socket_id, NO_FLAGS);
if (mz == NULL) {
@@ -479,6 +476,9 @@ rte_distributor_create(const char *name,
snprintf(d->name, sizeof(d->name), "%s", name);
d->num_workers = num_workers;
+ distributor_list = RTE_TAILQ_CAST(rte_distributor_tailq.head,
+ rte_distributor_list);
+
rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);
TAILQ_INSERT_TAIL(distributor_list, d, next);
rte_rwlock_write_unlock(RTE_EAL_TAILQ_RWLOCK);