Lines Matching defs:pool

33 	struct mlx5_irq_pool *pool;
72 * has some available in the pool. This will allow the user to increase
155 struct mlx5_irq_pool *pool = irq->pool;
166 rmap = mlx5_eq_table_get_rmap(pool->dev);
172 if (irq->map.index && pci_msix_can_alloc_dyn(pool->dev->pdev))
173 pci_msix_free_irq(pool->dev->pdev, irq->map);
178 struct mlx5_irq_pool *pool = irq->pool;
180 xa_erase(&pool->irqs, irq->pool_index);
188 struct mlx5_irq_pool *pool = irq->pool;
191 mutex_lock(&pool->lock);
197 mutex_unlock(&pool->lock);
203 lockdep_assert_held(&irq->pool->lock);
209 lockdep_assert_held(&irq->pool->lock);
220 mutex_lock(&irq->pool->lock);
222 mutex_unlock(&irq->pool->lock);
232 static void irq_sf_set_name(struct mlx5_irq_pool *pool, char *name, int vecidx)
234 snprintf(name, MLX5_MAX_IRQ_NAME, "%s%d", pool->name, vecidx);
237 static void irq_set_name(struct mlx5_irq_pool *pool, char *name, int vecidx)
239 if (!pool->xa_num_irqs.max) {
254 struct mlx5_irq *mlx5_irq_alloc(struct mlx5_irq_pool *pool, int i,
258 struct mlx5_core_dev *dev = pool->dev;
292 if (!mlx5_irq_pool_is_sf_pool(pool))
293 irq_set_name(pool, name, i);
295 irq_sf_set_name(pool, name, i);
310 irq->pool = pool;
313 err = xa_err(xa_store(&pool->irqs, irq->pool_index, irq, GFP_KERNEL));
377 /* requesting an irq from a given pool according to given index */
379 irq_pool_request_vector(struct mlx5_irq_pool *pool, int vecidx,
385 mutex_lock(&pool->lock);
386 irq = xa_load(&pool->irqs, vecidx);
391 irq = mlx5_irq_alloc(pool, vecidx, af_desc, rmap);
393 mutex_unlock(&pool->lock);
410 struct mlx5_irq_pool *pool = NULL;
413 pool = sf_irq_pool_get(irq_table);
415 /* In some configs, there won't be a pool of SFs IRQs. Hence, returning
416 * the PF IRQs pool in case the SF pool doesn't exist.
418 return pool ? pool : irq_table->pcif_pool;
424 struct mlx5_irq_pool *pool = NULL;
427 pool = sf_ctrl_irq_pool_get(irq_table);
429 /* In some configs, there won't be a pool of SFs IRQs. Hence, returning
430 * the PF IRQs pool in case the SF pool doesn't exist.
432 return pool ? pool : irq_table->pcif_pool;
458 struct mlx5_irq_pool *pool = ctrl_irq_pool_get(dev);
464 if (!mlx5_irq_pool_is_sf_pool(pool)) {
465 /* In case we are allocating a control IRQ from a pci device's pool.
466 * This can happen also for a SF if the SFs pool is empty.
468 if (!pool->xa_num_irqs.max) {
474 irq = irq_pool_request_vector(pool, 0, &af_desc, NULL);
476 irq = mlx5_irq_affinity_request(pool, &af_desc);
497 struct mlx5_irq_pool *pool;
500 pool = irq_table->pcif_pool;
501 irq = irq_pool_request_vector(pool, vecidx, af_desc, rmap);
536 struct mlx5_irq_pool *pool = table->pcif_pool;
540 if (!pool->xa_num_irqs.max)
553 struct mlx5_irq_pool *pool = kvzalloc(sizeof(*pool), GFP_KERNEL);
555 if (!pool)
557 pool->dev = dev;
558 mutex_init(&pool->lock);
559 xa_init_flags(&pool->irqs, XA_FLAGS_ALLOC);
560 pool->xa_num_irqs.min = start;
561 pool->xa_num_irqs.max = start + size - 1;
563 snprintf(pool->name, MLX5_MAX_IRQ_NAME - MLX5_MAX_IRQ_IDX_CHARS,
565 pool->min_threshold = min_threshold * MLX5_EQ_REFS_PER_IRQ;
566 pool->max_threshold = max_threshold * MLX5_EQ_REFS_PER_IRQ;
567 mlx5_core_dbg(dev, "pool->name = %s, pool->size = %d, pool->start = %d",
569 return pool;
572 static void irq_pool_free(struct mlx5_irq_pool *pool)
581 xa_for_each(&pool->irqs, index, irq)
583 xa_destroy(&pool->irqs);
584 mutex_destroy(&pool->lock);
585 kfree(pool->irqs_per_cpu);
586 kvfree(pool);
660 static void mlx5_irq_pool_free_irqs(struct mlx5_irq_pool *pool)
665 xa_for_each(&pool->irqs, index, irq)