summaryrefslogtreecommitdiff
path: root/lib/librte_reorder
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_reorder
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_reorder')
-rw-r--r--lib/librte_reorder/rte_reorder.c26
-rw-r--r--lib/librte_reorder/rte_reorder.h1
2 files changed, 8 insertions, 19 deletions
diff --git a/lib/librte_reorder/rte_reorder.c b/lib/librte_reorder/rte_reorder.c
index c5ce794..dc0e806 100644
--- a/lib/librte_reorder/rte_reorder.c
+++ b/lib/librte_reorder/rte_reorder.c
@@ -45,6 +45,11 @@
TAILQ_HEAD(rte_reorder_list, rte_tailq_entry);
+static struct rte_tailq_elem rte_reorder_tailq = {
+ .name = "RTE_REORDER",
+};
+EAL_REGISTER_TAILQ(rte_reorder_tailq)
+
#define NO_FLAGS 0
#define RTE_REORDER_PREFIX "RO_"
#define RTE_REORDER_NAMESIZE 32
@@ -126,12 +131,7 @@ rte_reorder_create(const char *name, unsigned socket_id, unsigned int size)
const unsigned int bufsize = sizeof(struct rte_reorder_buffer) +
(2 * size * sizeof(struct rte_mbuf *));
- /* check that we have an initialised tail queue */
- reorder_list = RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_REORDER, rte_reorder_list);
- if (!reorder_list) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
+ reorder_list = RTE_TAILQ_CAST(rte_reorder_tailq.head, rte_reorder_list);
/* Check user arguments. */
if (!rte_is_power_of_2(size)) {
@@ -219,12 +219,7 @@ rte_reorder_free(struct rte_reorder_buffer *b)
if (b == NULL)
return;
- /* check that we have an initialised tail queue */
- reorder_list = RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_REORDER, rte_reorder_list);
- if (!reorder_list) {
- rte_errno = E_RTE_NO_TAILQ;
- return;
- }
+ reorder_list = RTE_TAILQ_CAST(rte_reorder_tailq.head, rte_reorder_list);
rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);
@@ -255,12 +250,7 @@ rte_reorder_find_existing(const char *name)
struct rte_tailq_entry *te;
struct rte_reorder_list *reorder_list;
- /* check that we have an initialised tail queue */
- reorder_list = RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_REORDER, rte_reorder_list);
- if (!reorder_list) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
+ reorder_list = RTE_TAILQ_CAST(rte_reorder_tailq.head, rte_reorder_list);
rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK);
TAILQ_FOREACH(te, reorder_list, next) {
diff --git a/lib/librte_reorder/rte_reorder.h b/lib/librte_reorder/rte_reorder.h
index 8300bf0..c7a2934 100644
--- a/lib/librte_reorder/rte_reorder.h
+++ b/lib/librte_reorder/rte_reorder.h
@@ -102,7 +102,6 @@ rte_reorder_init(struct rte_reorder_buffer *b, unsigned int bufsize,
* Pointer to reorder buffer instance or NULL if object not found with rte_errno
* set appropriately. Possible rte_errno values include:
* - ENOENT - required entry not available to return.
- * - E_RTE_NO_TAILQ - no tailq list could be got for the
* reorder instance list
*/
struct rte_reorder_buffer *