-static int
-mlx5_hlist_default_match_cb(struct mlx5_hlist *h __rte_unused,
- struct mlx5_hlist_entry *entry,
- uint64_t key, void *ctx __rte_unused)
-{
- return entry->key != key;
-}
-
-struct mlx5_hlist *
-mlx5_hlist_create(const char *name, uint32_t size, uint32_t entry_size,
- uint32_t flags, mlx5_hlist_create_cb cb_create,
- mlx5_hlist_match_cb cb_match, mlx5_hlist_remove_cb cb_remove)
-{
- struct mlx5_hlist *h;
- uint32_t act_size;
- uint32_t alloc_size;
-
- if (!size || (!cb_create ^ !cb_remove))
- return NULL;
- /* Align to the next power of 2, 32bits integer is enough now. */
- if (!rte_is_power_of_2(size)) {
- act_size = rte_align32pow2(size);
- DRV_LOG(WARNING, "Size 0x%" PRIX32 " is not power of 2, will "
- "be aligned to 0x%" PRIX32 ".", size, act_size);
- } else {
- act_size = size;
- }
- alloc_size = sizeof(struct mlx5_hlist) +
- sizeof(struct mlx5_hlist_head) * act_size;
- /* Using zmalloc, then no need to initialize the heads. */
- h = mlx5_malloc(MLX5_MEM_ZERO, alloc_size, RTE_CACHE_LINE_SIZE,
- SOCKET_ID_ANY);
- if (!h) {
- DRV_LOG(ERR, "No memory for hash list %s creation",
- name ? name : "None");
- return NULL;
- }
+int
+mlx5_cache_list_init(struct mlx5_cache_list *list, const char *name,
+ uint32_t entry_size, void *ctx,
+ mlx5_cache_create_cb cb_create,
+ mlx5_cache_match_cb cb_match,
+ mlx5_cache_remove_cb cb_remove)
+{
+ MLX5_ASSERT(list);
+ if (!cb_match || (!cb_create ^ !cb_remove))
+ return -1;