- h->entry_sz = entry_size;
- h->direct_key = !!(flags & MLX5_HLIST_DIRECT_KEY);
- h->write_most = !!(flags & MLX5_HLIST_WRITE_MOST);
- h->cb_create = cb_create ? cb_create : mlx5_hlist_default_create_cb;
- h->cb_match = cb_match;
- h->cb_remove = cb_remove ? cb_remove : mlx5_hlist_default_remove_cb;
- for (i = 0; i < act_size; i++)
- rte_rwlock_init(&h->buckets[i].lock);
- DRV_LOG(DEBUG, "Hash list with %s size 0x%" PRIX32 " is created.",
- h->name, act_size);
- return h;
-}
-
-static struct mlx5_hlist_entry *
-__hlist_lookup(struct mlx5_hlist *h, uint64_t key, uint32_t idx,
- void *ctx, bool reuse)
-{
- struct mlx5_hlist_head *first;
- struct mlx5_hlist_entry *node;
-
- MLX5_ASSERT(h);
- first = &h->buckets[idx].head;
- LIST_FOREACH(node, first, next) {
- if (!h->cb_match(h, node, key, ctx)) {
- if (reuse) {
- __atomic_add_fetch(&node->ref_cnt, 1,
- __ATOMIC_RELAXED);
- DRV_LOG(DEBUG, "Hash list %s entry %p "
- "reuse: %u.",
- h->name, (void *)node, node->ref_cnt);
- }
- break;
+ h->direct_key = direct_key;
+ gc = (struct mlx5_list_cache *)&h->buckets[act_size];
+ for (i = 0; i < act_size; i++) {
+ if (mlx5_list_init(&h->buckets[i].l, &h->l_const,
+ lcores_share ? &gc[i] : NULL) != 0) {
+ mlx5_free(h);
+ return NULL;