unsigned i;
/* create a first tailq and check its non-null */
- d_head = RTE_TAILQ_RESERVE_BY_IDX(DEFAULT_TAILQ, rte_tailq_entry_head);
+ d_head = RTE_TAILQ_LOOKUP_BY_IDX(DEFAULT_TAILQ, rte_tailq_entry_head);
if (d_head == NULL)
do_return("Error allocating dummy_q0\n");
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_tailq_entry_head) == NULL)
+ if (RTE_TAILQ_LOOKUP_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,
+ if ((d_head = RTE_TAILQ_LOOKUP_BY_IDX(i,
rte_tailq_entry_head)) == NULL)
break;
}
return 0;
}
-/* test for deprecated functions - mainly for coverage */
-static int
-test_tailq_deprecated(void)
-{
- 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
- * to RTE_TAILQ_LOOKUP).
- *
- * PCI_RESOURCE_LIST tailq is guaranteed to
- * be present in any DPDK app. */
- 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_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_tailq_entry_head);
- if (d_head != NULL)
- do_return("Non-existent tailq found!\n");
-
- 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_tailq_entry_head);
- if (d_head != NULL)
- do_return("NULL tailq found!\n");
-
- d_head = RTE_TAILQ_LOOKUP(NULL, rte_tailq_entry_head);
- if (d_head != NULL)
- do_return("NULL tailq found!\n");
-
- return 0;
-}
-
static int
test_tailq(void)
{
int ret = 0;
ret |= test_tailq_create();
ret |= test_tailq_lookup();
- ret |= test_tailq_deprecated();
return ret;
}
#define RTE_TAILQ_CAST(tailq_entry, struct_name) \
(struct struct_name *)&(tailq_entry)->tailq_head
-/**
- * Utility macro to make reserving a tailqueue for a particular struct easier.
- *
- * @param name
- * The name to be given to the tailq - used by lookup to find it later
- *
- * @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_reserve, 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_RESERVE(name, struct_name) \
- RTE_TAILQ_CAST(rte_eal_tailq_reserve(name), struct_name)
-
-/**
- * Utility macro to make reserving a tailqueue for a particular struct easier.
- *
- * @param idx
- * The tailq idx defined in rte_tail_t to be given to the tail queue.
- * - used by lookup to find it later
- *
- * @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_reserve, 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_RESERVE_BY_IDX(idx, struct_name) \
- RTE_TAILQ_CAST(rte_eal_tailq_reserve_by_idx(idx), struct_name)
-
/**
* Utility macro to make looking up a tailqueue for a particular struct easier.
*
#define RTE_TAILQ_LOOKUP_BY_IDX(idx, struct_name) \
RTE_TAILQ_CAST(rte_eal_tailq_lookup_by_idx(idx), struct_name)
-/**
- * Reserve a slot in the tailq list for a particular tailq header
- * Note: this function, along with rte_tailq_lookup, is not multi-thread safe,
- * and both these functions should only be called from a single thread at a time
- *
- * @param name
- * The name to be given to the tail queue.
- * @return
- * A pointer to the newly reserved tailq entry
- */
-struct rte_tailq_head *rte_eal_tailq_reserve(const char *name);
-
-/**
- * Reserve a slot in the tailq list for a particular tailq header
- * Note: this function, along with rte_tailq_lookup, is not multi-thread safe,
- * and both these functions 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 newly reserved tailq entry
- */
-struct rte_tailq_head *rte_eal_tailq_reserve_by_idx(const unsigned idx);
-
/**
* Dump tail queues to the console.
*
/**
* Lookup for a tail queue.
*
- * Get a pointer to a tail queue header of an already reserved tail
+ * Get a pointer to a tail queue header of a tail
* queue identified by the name given as an argument.
- * Note: this function, along with rte_tailq_reserve, is not multi-thread safe,
- * and both these functions should only be called from a single thread at a time
+ * Note: this function is not multi-thread safe, and should only be called from
+ * a single thread at a time
*
* @param name
* The name of the queue.
/**
* Lookup for a tail queue.
*
- * Get a pointer to a tail queue header of an already reserved tail
+ * Get a pointer to a tail queue header of a tail
* queue identified by the name given as an argument.
- * Note: this function, along with rte_tailq_reserve, is not multi-thread safe,
- * and both these functions should only be called from a single thread at a time
+ * 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.