Commit 30c6afa7 authored by Shay Drory's avatar Shay Drory Committed by Saeed Mahameed

net/mlx5: Move affinity assignment into irq_request

Move affinity binding of the IRQ to irq_request function in order to
bind the IRQ before inserting it to the xarray.

After this change, the IRQ is ready for use when inserted to the xarray.
Signed-off-by: default avatarShay Drory <shayd@nvidia.com>
Reviewed-by: default avatarMoshe Shemesh <moshe@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 5256a46b
...@@ -215,7 +215,8 @@ static bool irq_pool_is_sf_pool(struct mlx5_irq_pool *pool) ...@@ -215,7 +215,8 @@ static bool irq_pool_is_sf_pool(struct mlx5_irq_pool *pool)
return !strncmp("mlx5_sf", pool->name, strlen("mlx5_sf")); return !strncmp("mlx5_sf", pool->name, strlen("mlx5_sf"));
} }
static struct mlx5_irq *irq_request(struct mlx5_irq_pool *pool, int i) static struct mlx5_irq *irq_request(struct mlx5_irq_pool *pool, int i,
struct cpumask *affinity)
{ {
struct mlx5_core_dev *dev = pool->dev; struct mlx5_core_dev *dev = pool->dev;
char name[MLX5_MAX_IRQ_NAME]; char name[MLX5_MAX_IRQ_NAME];
...@@ -244,6 +245,10 @@ static struct mlx5_irq *irq_request(struct mlx5_irq_pool *pool, int i) ...@@ -244,6 +245,10 @@ static struct mlx5_irq *irq_request(struct mlx5_irq_pool *pool, int i)
err = -ENOMEM; err = -ENOMEM;
goto err_cpumask; goto err_cpumask;
} }
if (affinity) {
cpumask_copy(irq->mask, affinity);
irq_set_affinity_hint(irq->irqn, irq->mask);
}
irq->pool = pool; irq->pool = pool;
irq->refcount = 1; irq->refcount = 1;
irq->index = i; irq->index = i;
...@@ -255,6 +260,7 @@ static struct mlx5_irq *irq_request(struct mlx5_irq_pool *pool, int i) ...@@ -255,6 +260,7 @@ static struct mlx5_irq *irq_request(struct mlx5_irq_pool *pool, int i)
} }
return irq; return irq;
err_xa: err_xa:
irq_set_affinity_hint(irq->irqn, NULL);
free_cpumask_var(irq->mask); free_cpumask_var(irq->mask);
err_cpumask: err_cpumask:
free_irq(irq->irqn, &irq->nh); free_irq(irq->irqn, &irq->nh);
...@@ -304,7 +310,6 @@ int mlx5_irq_get_index(struct mlx5_irq *irq) ...@@ -304,7 +310,6 @@ int mlx5_irq_get_index(struct mlx5_irq *irq)
static struct mlx5_irq *irq_pool_create_irq(struct mlx5_irq_pool *pool, static struct mlx5_irq *irq_pool_create_irq(struct mlx5_irq_pool *pool,
struct cpumask *affinity) struct cpumask *affinity)
{ {
struct mlx5_irq *irq;
u32 irq_index; u32 irq_index;
int err; int err;
...@@ -312,12 +317,7 @@ static struct mlx5_irq *irq_pool_create_irq(struct mlx5_irq_pool *pool, ...@@ -312,12 +317,7 @@ static struct mlx5_irq *irq_pool_create_irq(struct mlx5_irq_pool *pool,
GFP_KERNEL); GFP_KERNEL);
if (err) if (err)
return ERR_PTR(err); return ERR_PTR(err);
irq = irq_request(pool, irq_index); return irq_request(pool, irq_index, affinity);
if (IS_ERR(irq))
return irq;
cpumask_copy(irq->mask, affinity);
irq_set_affinity_hint(irq->irqn, irq->mask);
return irq;
} }
/* looking for the irq with the smallest refcount and the same affinity */ /* looking for the irq with the smallest refcount and the same affinity */
...@@ -392,11 +392,7 @@ irq_pool_request_vector(struct mlx5_irq_pool *pool, int vecidx, ...@@ -392,11 +392,7 @@ irq_pool_request_vector(struct mlx5_irq_pool *pool, int vecidx,
irq_get_locked(irq); irq_get_locked(irq);
goto unlock; goto unlock;
} }
irq = irq_request(pool, vecidx); irq = irq_request(pool, vecidx, affinity);
if (IS_ERR(irq) || !affinity)
goto unlock;
cpumask_copy(irq->mask, affinity);
irq_set_affinity_hint(irq->irqn, irq->mask);
unlock: unlock:
mutex_unlock(&pool->lock); mutex_unlock(&pool->lock);
return irq; return irq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment