To make indexed pool to be used as ID generator, this patch allows entry
size to be zero.
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
struct mlx5_indexed_pool *pool;
uint32_t i;
- if (!cfg || !cfg->size || (!cfg->malloc ^ !cfg->free) ||
+ if (!cfg || (!cfg->malloc ^ !cfg->free) ||
(cfg->trunk_size && ((cfg->trunk_size & (cfg->trunk_size - 1)) ||
((__builtin_ffs(cfg->trunk_size) + TRUNK_IDX_BITS) > 32))))
return NULL;
{
void *entry = mlx5_ipool_malloc(pool, idx);
- if (entry)
+ if (entry && pool->cfg.size)
memset(entry, 0, pool->cfg.size);
return entry;
}