Commit 1da438c0 authored by Shay Drory's avatar Shay Drory Committed by Saeed Mahameed

net/mlx5: Fix indexing of mlx5_irq

After the cited patch, mlx5_irq xarray index can be different then
mlx5_irq MSIX table index.
Fix it by storing both mlx5_irq xarray index and MSIX table index.

Fixes: 3354822c ("net/mlx5: Use dynamic msix vectors allocation")
Signed-off-by: default avatarShay Drory <shayd@nvidia.com>
Reviewed-by: default avatarEli Cohen <elic@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent ef8c063c
...@@ -32,6 +32,7 @@ struct mlx5_irq { ...@@ -32,6 +32,7 @@ struct mlx5_irq {
struct mlx5_irq_pool *pool; struct mlx5_irq_pool *pool;
int refcount; int refcount;
struct msi_map map; struct msi_map map;
u32 pool_index;
}; };
struct mlx5_irq_table { struct mlx5_irq_table {
...@@ -132,7 +133,7 @@ static void irq_release(struct mlx5_irq *irq) ...@@ -132,7 +133,7 @@ static void irq_release(struct mlx5_irq *irq)
struct cpu_rmap *rmap; struct cpu_rmap *rmap;
#endif #endif
xa_erase(&pool->irqs, irq->map.index); xa_erase(&pool->irqs, irq->pool_index);
/* free_irq requires that affinity_hint and rmap will be cleared before /* free_irq requires that affinity_hint and rmap will be cleared before
* calling it. To satisfy this requirement, we call * calling it. To satisfy this requirement, we call
* irq_cpu_rmap_remove() to remove the notifier * irq_cpu_rmap_remove() to remove the notifier
...@@ -276,11 +277,11 @@ struct mlx5_irq *mlx5_irq_alloc(struct mlx5_irq_pool *pool, int i, ...@@ -276,11 +277,11 @@ struct mlx5_irq *mlx5_irq_alloc(struct mlx5_irq_pool *pool, int i,
} }
irq->pool = pool; irq->pool = pool;
irq->refcount = 1; irq->refcount = 1;
irq->map.index = i; irq->pool_index = i;
err = xa_err(xa_store(&pool->irqs, irq->map.index, irq, GFP_KERNEL)); err = xa_err(xa_store(&pool->irqs, irq->pool_index, irq, GFP_KERNEL));
if (err) { if (err) {
mlx5_core_err(dev, "Failed to alloc xa entry for irq(%u). err = %d\n", mlx5_core_err(dev, "Failed to alloc xa entry for irq(%u). err = %d\n",
irq->map.index, err); irq->pool_index, err);
goto err_xa; goto err_xa;
} }
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