Use dynamic tailq rather than static entries.
Signed-off-by: David Marchand <david.marchand@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
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.
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) {
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);
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) {
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) {
* 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 *
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
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) {
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);
static struct uio_res_list *uio_res_list = NULL;
+static struct rte_tailq_elem rte_pci_tailq = {
+ .name = "PCI_RESOURCE_LIST",
+};
+EAL_REGISTER_TAILQ(rte_pci_tailq)
+
/* unbind kernel driver for this device */
static int
pci_unbind_kernel_driver(struct rte_pci_device *dev __rte_unused)
{
TAILQ_INIT(&pci_driver_list);
TAILQ_INIT(&pci_device_list);
- uio_res_list = RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_PCI, uio_res_list);
+ uio_res_list = RTE_TAILQ_CAST(rte_pci_tailq.head, uio_res_list);
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
#define rte_tailq_end(idx)
#endif /* rte_tailq_end */
-rte_tailq_elem(RTE_TAILQ_PCI, "PCI_RESOURCE_LIST")
-
-rte_tailq_elem(RTE_TAILQ_MEMPOOL, "RTE_MEMPOOL")
-
-rte_tailq_elem(RTE_TAILQ_RING, "RTE_RING")
-
-rte_tailq_elem(RTE_TAILQ_HASH, "RTE_HASH")
-
-rte_tailq_elem(RTE_TAILQ_FBK_HASH, "RTE_FBK_HASH")
-
-rte_tailq_elem(RTE_TAILQ_LPM, "RTE_LPM")
-
-rte_tailq_elem(RTE_TAILQ_LPM6, "RTE_LPM6")
-
-rte_tailq_elem(RTE_TAILQ_ACL, "RTE_ACL")
-
-rte_tailq_elem(RTE_TAILQ_DISTRIBUTOR, "RTE_DISTRIBUTOR")
-
-rte_tailq_elem(RTE_TAILQ_REORDER, "RTE_REORDER")
-
rte_tailq_end(RTE_TAILQ_NUM)
#undef rte_tailq_elem
#include <rte_malloc.h>
#include <rte_common.h>
#include <rte_ivshmem.h>
-#include <rte_tailq_elem.h>
#include "eal_internal_cfg.h"
#include "eal_private.h"
return 0;
/* check that we have an initialised ring tail queue */
- if ((ring_list =
- RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_RING, rte_ring_list)) == NULL) {
+ ring_list = RTE_TAILQ_LOOKUP(RTE_TAILQ_RING_NAME, rte_ring_list);
+ if (ring_list == NULL) {
RTE_LOG(ERR, EAL, "No rte_ring tailq found!\n");
return -1;
}
struct mapped_pci_res_list *pci_res_list = NULL;
+static struct rte_tailq_elem rte_pci_tailq = {
+ .name = "PCI_RESOURCE_LIST",
+};
+EAL_REGISTER_TAILQ(rte_pci_tailq)
+
/* unbind kernel driver for this device */
static int
pci_unbind_kernel_driver(struct rte_pci_device *dev)
{
TAILQ_INIT(&pci_driver_list);
TAILQ_INIT(&pci_device_list);
- pci_res_list = RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_PCI,
- mapped_pci_res_list);
+ pci_res_list = RTE_TAILQ_CAST(rte_pci_tailq.head, mapped_pci_res_list);
/* for debug purposes, PCI can be disabled */
if (internal_config.no_pci)
TAILQ_HEAD(rte_fbk_hash_list, rte_tailq_entry);
+static struct rte_tailq_elem rte_fbk_hash_tailq = {
+ .name = "RTE_FBK_HASH",
+};
+EAL_REGISTER_TAILQ(rte_fbk_hash_tailq)
+
/**
* Performs a lookup for an existing hash table, and returns a pointer to
* the table if found.
struct rte_tailq_entry *te;
struct rte_fbk_hash_list *fbk_hash_list;
- /* check that we have an initialised tail queue */
- if ((fbk_hash_list =
- RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_FBK_HASH,
- rte_fbk_hash_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
+ fbk_hash_list = RTE_TAILQ_CAST(rte_fbk_hash_tailq.head,
+ rte_fbk_hash_list);
rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK);
TAILQ_FOREACH(te, fbk_hash_list, next) {
uint32_t i;
struct rte_fbk_hash_list *fbk_hash_list;
- /* check that we have an initialised tail queue */
- if ((fbk_hash_list =
- RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_FBK_HASH,
- rte_fbk_hash_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
+ fbk_hash_list = RTE_TAILQ_CAST(rte_fbk_hash_tailq.head,
+ rte_fbk_hash_list);
/* Error checking of parameters. */
if ((!rte_is_power_of_2(params->entries)) ||
if (ht == NULL)
return;
- /* check that we have an initialised tail queue */
- if ((fbk_hash_list =
- RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_FBK_HASH,
- rte_fbk_hash_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return;
- }
+ fbk_hash_list = RTE_TAILQ_CAST(rte_fbk_hash_tailq.head,
+ rte_fbk_hash_list);
rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);
* Possible rte_errno error values include:
* - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
* - E_RTE_SECONDARY - function was called from a secondary process instance
- * - E_RTE_NO_TAILQ - no tailq list could be got for the fbk hash table list
* - EINVAL - invalid parameter value passed to function
* - ENOSPC - the maximum number of memzones has already been allocated
* - EEXIST - a memzone with the same name already exists
#include "rte_hash.h"
-
TAILQ_HEAD(rte_hash_list, rte_tailq_entry);
+static struct rte_tailq_elem rte_hash_tailq = {
+ .name = "RTE_HASH",
+};
+EAL_REGISTER_TAILQ(rte_hash_tailq)
+
/* Macro to enable/disable run-time checking of function parameters */
#if defined(RTE_LIBRTE_HASH_DEBUG)
#define RETURN_IF_TRUE(cond, retval) do { \
struct rte_tailq_entry *te;
struct rte_hash_list *hash_list;
- /* check that we have an initialised tail queue */
- if ((hash_list =
- RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_HASH, rte_hash_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
+ hash_list = RTE_TAILQ_CAST(rte_hash_tailq.head, rte_hash_list);
rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK);
TAILQ_FOREACH(te, hash_list, next) {
char hash_name[RTE_HASH_NAMESIZE];
struct rte_hash_list *hash_list;
- /* check that we have an initialised tail queue */
- if ((hash_list =
- RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_HASH, rte_hash_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
+ hash_list = RTE_TAILQ_CAST(rte_hash_tailq.head, rte_hash_list);
/* Check for valid parameters */
if ((params == NULL) ||
if (h == NULL)
return;
- /* check that we have an initialised tail queue */
- if ((hash_list =
- RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_HASH, rte_hash_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return;
- }
+ hash_list = RTE_TAILQ_CAST(rte_hash_tailq.head, rte_hash_list);
rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);
* Possible rte_errno errors include:
* - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
* - E_RTE_SECONDARY - function was called from a secondary process instance
- * - E_RTE_NO_TAILQ - no tailq list could be got for the hash table list
* - ENOENT - missing entry
* - EINVAL - invalid parameter passed to function
* - ENOSPC - the maximum number of memzones has already been allocated
TAILQ_HEAD(rte_lpm_list, rte_tailq_entry);
+static struct rte_tailq_elem rte_lpm_tailq = {
+ .name = "RTE_LPM",
+};
+EAL_REGISTER_TAILQ(rte_lpm_tailq)
+
#define MAX_DEPTH_TBL24 24
enum valid_flag {
struct rte_tailq_entry *te;
struct rte_lpm_list *lpm_list;
- /* check that we have an initialised tail queue */
- if ((lpm_list = RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_LPM,
- rte_lpm_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
+ lpm_list = RTE_TAILQ_CAST(rte_lpm_tailq.head, rte_lpm_list);
rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK);
TAILQ_FOREACH(te, lpm_list, next) {
uint32_t mem_size;
struct rte_lpm_list *lpm_list;
- /* check that we have an initialised tail queue */
- if ((lpm_list = RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_LPM,
- rte_lpm_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
+ lpm_list = RTE_TAILQ_CAST(rte_lpm_tailq.head, rte_lpm_list);
RTE_BUILD_BUG_ON(sizeof(struct rte_lpm_tbl24_entry) != 2);
RTE_BUILD_BUG_ON(sizeof(struct rte_lpm_tbl8_entry) != 2);
if (lpm == NULL)
return;
- /* check that we have an initialised tail queue */
- if ((lpm_list =
- RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_LPM, rte_lpm_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return;
- }
+ lpm_list = RTE_TAILQ_CAST(rte_lpm_tailq.head, rte_lpm_list);
rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);
return (rule_index);
}
- /* If rule is not found return -E_RTE_NO_TAILQ. */
- return -E_RTE_NO_TAILQ;
+ /* If rule is not found return -EINVAL. */
+ return -EINVAL;
}
/*
/*
* Check if rule_to_delete_index was found. If no rule was found the
- * function rule_find returns -E_RTE_NO_TAILQ.
+ * function rule_find returns -EINVAL.
*/
if (rule_to_delete_index < 0)
- return -E_RTE_NO_TAILQ;
+ return -EINVAL;
/* Delete the rule from the rule table. */
rule_delete(lpm, rule_to_delete_index, depth);
* to an appropriate values. Possible rte_errno values include:
* - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
* - E_RTE_SECONDARY - function was called from a secondary process instance
- * - E_RTE_NO_TAILQ - no tailq list could be got for the lpm object list
* - EINVAL - invalid parameter passed to function
* - ENOSPC - the maximum number of memzones has already been allocated
* - EEXIST - a memzone with the same name already exists
TAILQ_HEAD(rte_lpm6_list, rte_tailq_entry);
+static struct rte_tailq_elem rte_lpm6_tailq = {
+ .name = "RTE_LPM6",
+};
+EAL_REGISTER_TAILQ(rte_lpm6_tailq)
+
/** Tbl entry structure. It is the same for both tbl24 and tbl8 */
struct rte_lpm6_tbl_entry {
uint32_t next_hop: 21; /**< Next hop / next table to be checked. */
uint64_t mem_size, rules_size;
struct rte_lpm6_list *lpm_list;
- /* Check that we have an initialised tail queue */
- if ((lpm_list =
- RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_LPM6, rte_lpm6_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
+ lpm_list = RTE_TAILQ_CAST(rte_lpm6_tailq.head, rte_lpm6_list);
RTE_BUILD_BUG_ON(sizeof(struct rte_lpm6_tbl_entry) != sizeof(uint32_t));
struct rte_tailq_entry *te;
struct rte_lpm6_list *lpm_list;
- /* Check that we have an initialised tail queue */
- if ((lpm_list = RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_LPM6,
- rte_lpm6_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
+ lpm_list = RTE_TAILQ_CAST(rte_lpm6_tailq.head, rte_lpm6_list);
rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK);
TAILQ_FOREACH(te, lpm_list, next) {
if (lpm == NULL)
return;
- /* check that we have an initialised tail queue */
- if ((lpm_list =
- RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_LPM, rte_lpm6_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return;
- }
+ lpm_list = RTE_TAILQ_CAST(rte_lpm6_tailq.head, rte_lpm6_list);
rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);
* to an appropriate values. Possible rte_errno values include:
* - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
* - E_RTE_SECONDARY - function was called from a secondary process instance
- * - E_RTE_NO_TAILQ - no tailq list could be got for the lpm object list
* - EINVAL - invalid parameter passed to function
* - ENOSPC - the maximum number of memzones has already been allocated
* - EEXIST - a memzone with the same name already exists
TAILQ_HEAD(rte_mempool_list, rte_tailq_entry);
+static struct rte_tailq_elem rte_mempool_tailq = {
+ .name = "RTE_MEMPOOL",
+};
+EAL_REGISTER_TAILQ(rte_mempool_tailq)
+
#define CACHE_FLUSHTHRESH_MULTIPLIER 1.5
/*
RTE_CACHE_LINE_MASK) != 0);
#endif
- /* check that we have an initialised tail queue */
- mempool_list = RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_MEMPOOL,
- rte_mempool_list);
- if (mempool_list == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
+ mempool_list = RTE_TAILQ_CAST(rte_mempool_tailq.head, rte_mempool_list);
/* asked cache too big */
if (cache_size > RTE_MEMPOOL_CACHE_MAX_SIZE) {
struct rte_tailq_entry *te;
struct rte_mempool_list *mempool_list;
- if ((mempool_list =
- RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_MEMPOOL, rte_mempool_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return;
- }
+ mempool_list = RTE_TAILQ_CAST(rte_mempool_tailq.head, rte_mempool_list);
rte_rwlock_read_lock(RTE_EAL_MEMPOOL_RWLOCK);
struct rte_tailq_entry *te;
struct rte_mempool_list *mempool_list;
- if ((mempool_list =
- RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_MEMPOOL, rte_mempool_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
+ mempool_list = RTE_TAILQ_CAST(rte_mempool_tailq.head, rte_mempool_list);
rte_rwlock_read_lock(RTE_EAL_MEMPOOL_RWLOCK);
struct rte_tailq_entry *te = NULL;
struct rte_mempool_list *mempool_list;
- if ((mempool_list =
- RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_MEMPOOL, rte_mempool_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return;
- }
+ mempool_list = RTE_TAILQ_CAST(rte_mempool_tailq.head, rte_mempool_list);
rte_rwlock_read_lock(RTE_EAL_MEMPOOL_RWLOCK);
* with rte_errno set appropriately. Possible rte_errno values include:
* - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
* - E_RTE_SECONDARY - function was called from a secondary process instance
- * - E_RTE_NO_TAILQ - no tailq list could be got for the ring or mempool list
* - EINVAL - cache size provided is too large
* - ENOSPC - the maximum number of memzones has already been allocated
* - EEXIST - a memzone with the same name already exists
* with rte_errno set appropriately. Possible rte_errno values include:
* - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
* - E_RTE_SECONDARY - function was called from a secondary process instance
- * - E_RTE_NO_TAILQ - no tailq list could be got for the ring or mempool list
* - EINVAL - cache size provided is too large
* - ENOSPC - the maximum number of memzones has already been allocated
* - EEXIST - a memzone with the same name already exists
* with rte_errno set appropriately. Possible rte_errno values include:
* - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
* - E_RTE_SECONDARY - function was called from a secondary process instance
- * - E_RTE_NO_TAILQ - no tailq list could be got for the ring or mempool list
* - EINVAL - cache size provided is too large
* - ENOSPC - the maximum number of memzones has already been allocated
* - EEXIST - a memzone with the same name already exists
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
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)) {
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);
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) {
* 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 *
TAILQ_HEAD(rte_ring_list, rte_tailq_entry);
+static struct rte_tailq_elem rte_ring_tailq = {
+ .name = RTE_TAILQ_RING_NAME,
+};
+EAL_REGISTER_TAILQ(rte_ring_tailq)
+
/* true if x is a power of 2 */
#define POWEROF2(x) ((((x)-1) & (x)) == 0)
int mz_flags = 0;
struct rte_ring_list* ring_list = NULL;
- /* check that we have an initialised tail queue */
- if ((ring_list =
- RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_RING, rte_ring_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
+ ring_list = RTE_TAILQ_CAST(rte_ring_tailq.head, rte_ring_list);
ring_size = rte_ring_get_memsize(count);
if (ring_size < 0) {
const struct rte_tailq_entry *te;
struct rte_ring_list *ring_list;
- /* check that we have an initialised tail queue */
- if ((ring_list =
- RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_RING, rte_ring_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return;
- }
+ ring_list = RTE_TAILQ_CAST(rte_ring_tailq.head, rte_ring_list);
rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK);
struct rte_ring *r = NULL;
struct rte_ring_list *ring_list;
- /* check that we have an initialized tail queue */
- if ((ring_list =
- RTE_TAILQ_LOOKUP_BY_IDX(RTE_TAILQ_RING, rte_ring_list)) == NULL) {
- rte_errno = E_RTE_NO_TAILQ;
- return NULL;
- }
+ ring_list = RTE_TAILQ_CAST(rte_ring_tailq.head, rte_ring_list);
rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK);
#include <rte_atomic.h>
#include <rte_branch_prediction.h>
+#define RTE_TAILQ_RING_NAME "RTE_RING"
+
enum rte_ring_queue_behavior {
RTE_RING_QUEUE_FIXED = 0, /* Enq/Deq a fixed number of items from a ring */
RTE_RING_QUEUE_VARIABLE /* Enq/Deq as many items a possible from ring */
* rte_errno set appropriately. Possible errno values include:
* - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure
* - E_RTE_SECONDARY - function was called from a secondary process instance
- * - E_RTE_NO_TAILQ - no tailq list could be got for the ring list
* - EINVAL - count provided is not a power of 2
* - ENOSPC - the maximum number of memzones has already been allocated
* - EEXIST - a memzone with the same name already exists