mutex_lock(&pool->lock);
        ret = pool->p_get_chunk(pool, chunk);
+       if (ret == 0)
+               pool->available_elems -= 1 << chunk->order;
        mutex_unlock(&pool->lock);
 
        return ret;
 {
        mutex_lock(&pool->lock);
        pool->p_put_chunk(pool, chunk);
+       pool->available_elems += 1 << chunk->order;
        mutex_unlock(&pool->lock);
 }
 
                res_db_type = MLX5HWS_POOL_DB_TYPE_BITMAP;
 
        pool->alloc_log_sz = pool_attr->alloc_log_sz;
+       pool->available_elems = 1 << pool_attr->alloc_log_sz;
 
        if (hws_pool_db_init(pool, res_db_type))
                goto free_pool;
 {
        mutex_destroy(&pool->lock);
 
+       if (pool->available_elems != 1 << pool->alloc_log_sz)
+               mlx5hws_err(pool->ctx, "Attempting to destroy non-empty pool\n");
+
        if (pool->resource)
                hws_pool_resource_free(pool);
 
 
        enum mlx5hws_pool_flags flags;
        struct mutex lock; /* protect the pool */
        size_t alloc_log_sz;
+       size_t available_elems;
        enum mlx5hws_table_type tbl_type;
        enum mlx5hws_pool_optimize opt_type;
        struct mlx5hws_pool_resource *resource;
 {
        return pool->mirror_resource->base_id;
 }
+
+static inline bool
+mlx5hws_pool_empty(struct mlx5hws_pool *pool)
+{
+       bool ret;
+
+       mutex_lock(&pool->lock);
+       ret = pool->available_elems == 0;
+       mutex_unlock(&pool->lock);
+
+       return ret;
+}
+
+static inline bool
+mlx5hws_pool_full(struct mlx5hws_pool *pool)
+{
+       bool ret;
+
+       mutex_lock(&pool->lock);
+       ret = pool->available_elems == (1 << pool->alloc_log_sz);
+       mutex_unlock(&pool->lock);
+
+       return ret;
+}
 #endif /* MLX5HWS_POOL_H_ */