#
CONFIG_RTE_LIBRTE_HASH=y
CONFIG_RTE_LIBRTE_HASH_DEBUG=n
-CONFIG_RTE_LIBRTE_HASH_USE_MEMZONE=n
#
# Compile librte_lpm
#
CONFIG_RTE_LIBRTE_HASH=y
CONFIG_RTE_LIBRTE_HASH_DEBUG=n
-CONFIG_RTE_LIBRTE_HASH_USE_MEMZONE=n
#
# Compile librte_lpm
#
CONFIG_RTE_LIBRTE_HASH=y
CONFIG_RTE_LIBRTE_HASH_DEBUG=n
-CONFIG_RTE_LIBRTE_HASH_USE_MEMZONE=n
#
# Compile librte_lpm
#
CONFIG_RTE_LIBRTE_HASH=y
CONFIG_RTE_LIBRTE_HASH_DEBUG=n
-CONFIG_RTE_LIBRTE_HASH_USE_MEMZONE=n
#
# Compile librte_lpm
return NULL;
/* Allocate memory for table. */
-#if defined(RTE_LIBRTE_HASH_USE_MEMZONE)
- const struct rte_memzone *mz;
- mz = rte_memzone_reserve(hash_name, mem_size, params->socket_id, 0);
- if (mz == NULL)
- return NULL;
- ht = (struct rte_fbk_hash_table *)mz->addr;
-#else
ht = (struct rte_fbk_hash_table *)rte_malloc(hash_name, mem_size, 0);
if (ht == NULL)
return NULL;
-#endif
memset(ht, 0, mem_size);
/* Set up hash table context. */
if (ht == NULL)
return;
- /* No way to deallocate memzones - but can de-allocate from malloc */
-#if !defined(RTE_LIBRTE_HASH_USE_MEMZONE)
RTE_EAL_TAILQ_REMOVE(RTE_TAILQ_FBK_HASH, rte_fbk_hash_list, ht);
rte_free(ht);
-#endif
- RTE_SET_USED(ht);
- return;
}
CACHE_LINE_SIZE);
key_tbl_size = align_size(num_buckets * key_size *
params->bucket_entries, CACHE_LINE_SIZE);
-
+
/* Total memory required for hash context */
mem_size = hash_tbl_size + sig_tbl_size + key_tbl_size;
if (h != NULL)
return NULL;
- /* Allocate as a memzone, or in normal memory space */
-#if defined(RTE_LIBRTE_HASH_USE_MEMZONE)
- const struct rte_memzone *mz;
- mz = rte_memzone_reserve(hash_name, mem_size, params->socket_id, 0);
- if (mz == NULL) {
- RTE_LOG(ERR, HASH, "memzone reservation failed\n");
- return NULL;
- }
- memset(mz->addr, 0, mem_size);
- h = (struct rte_hash *)mz->addr;
-#else
h = (struct rte_hash *)rte_zmalloc(hash_name, mem_size,
CACHE_LINE_SIZE);
if (h == NULL) {
RTE_LOG(ERR, HASH, "memory allocation failed\n");
return NULL;
}
-#endif
/* Setup hash context */
rte_snprintf(h->name, sizeof(h->name), "%s", params->name);
if (h == NULL)
return;
-#if !defined(RTE_LIBRTE_HASH_USE_MEMZONE)
RTE_EAL_TAILQ_REMOVE(RTE_TAILQ_HASH, rte_hash_list, h);
rte_free(h);
-#endif
- /* No way to deallocate memzones */
- return;
}
int32_t
};
/**
- * Create a new hash table. If RTE_LIBRTE_HASH_USE_MEMZONE is defined, then
- * the hash table is allocated in a memzone on a specific NUMA socket ID,
- * otherwise it is allocated in the heap.
+ * Create a new hash table.
*
* @param params
* Parameters used to create and initialise the hash table.
rte_hash_find_existing(const char *name);
/**
- * De-allocate all memory used by hash table. If RTE_LIBRTE_HASH_USE_MEMZONE
- * is defined, then this has no effect.
+ * De-allocate all memory used by hash table.
* @param h
* Hash table to free
*/