summaryrefslogtreecommitdiff
path: root/lib/librte_acl
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_acl
parent873a61c7526be06f45d8d709a7c56d10cc06ab34 (diff)
downloaddpdk-a2348166ea186506d45b61d5073d16ad974e79bb.zip
dpdk-a2348166ea186506d45b61d5073d16ad974e79bb.tar.gz
dpdk-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_acl')
-rw-r--r--lib/librte_acl/rte_acl.c33
-rw-r--r--lib/librte_acl/rte_acl.h1
2 files changed, 9 insertions, 25 deletions
diff --git a/lib/librte_acl/rte_acl.c b/lib/librte_acl/rte_acl.c
index 7d10301..b6ddeeb 100644
--- a/lib/librte_acl/rte_acl.c
+++ b/lib/librte_acl/rte_acl.c
@@ -38,6 +38,11 @@
TAILQ_HEAD(rte_acl_list, rte_tailq_entry);
+static struct rte_tailq_elem rte_acl_tailq = {
+ .name = "RTE_ACL",
+};
+EAL_REGISTER_TAILQ(rte_acl_tailq)
+
/*
* If the compiler doesn't support AVX2 instructions,
* then the dummy one would be used instead for AVX2 classify method.
@@ -129,12 +134,7 @@ rte_acl_find_existing(const char *name)
struct rte_acl_list *acl_list;
struct rte_tailq_entry *te;
- /* check that we have an initialised tail queue */
- acl_list = RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_ACL, rte_acl_list);
- if (acl_list == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
+ acl_list = RTE_TAILQ_CAST(rte_acl_tailq.head, rte_acl_list);
rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK);
TAILQ_FOREACH(te, acl_list, next) {
@@ -160,12 +160,7 @@ rte_acl_free(struct rte_acl_ctx *ctx)
if (ctx == NULL)
return;
- /* check that we have an initialised tail queue */
- acl_list = RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_ACL, rte_acl_list);
- if (acl_list == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return;
- }
+ acl_list = RTE_TAILQ_CAST(rte_acl_tailq.head, rte_acl_list);
rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);
@@ -197,12 +192,7 @@ rte_acl_create(const struct rte_acl_param *param)
struct rte_tailq_entry *te;
char name[sizeof(ctx->name)];
- /* check that we have an initialised tail queue */
- acl_list = RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_ACL, rte_acl_list);
- if (acl_list == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
+ acl_list = RTE_TAILQ_CAST(rte_acl_tailq.head, rte_acl_list);
/* check that input parameters are valid. */
if (param == NULL || param->name == NULL) {
@@ -365,12 +355,7 @@ rte_acl_list_dump(void)
struct rte_acl_list *acl_list;
struct rte_tailq_entry *te;
- /* check that we have an initialised tail queue */
- acl_list = RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_ACL, rte_acl_list);
- if (acl_list == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return;
- }
+ acl_list = RTE_TAILQ_CAST(rte_acl_tailq.head, rte_acl_list);
rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK);
TAILQ_FOREACH(te, acl_list, next) {
diff --git a/lib/librte_acl/rte_acl.h b/lib/librte_acl/rte_acl.h
index 30aea03..3a93730 100644
--- a/lib/librte_acl/rte_acl.h
+++ b/lib/librte_acl/rte_acl.h
@@ -170,7 +170,6 @@ struct rte_acl_param {
* Pointer to ACL context structure that is used in future ACL
* operations, or NULL on error, with error code set in rte_errno.
* Possible rte_errno errors include:
- * - E_RTE_NO_TAILQ - no tailq list could be got for the ACL context list
* - EINVAL - invalid parameter passed to function
*/
struct rte_acl_ctx *