Skip to content

Commit 8764bd0

Browse files
niklas88Saeed Mahameed
authored andcommitted
net/mlx5: Fix setting of irq->map.index for static IRQ case
When dynamic IRQ allocation is not supported all IRQs are allocated up front in mlx5_irq_table_create() instead of dynamically as part of mlx5_irq_alloc(). In the latter dynamic case irq->map.index is set via the mapping returned by pci_msix_alloc_irq_at(). In the static case and prior to commit 1da438c ("net/mlx5: Fix indexing of mlx5_irq") irq->map.index was set in mlx5_irq_alloc() twice once initially to 0 and then to the requested index before storing in the xarray. After this commit it is only set to 0 which breaks all other IRQ mappings. Fix this by setting irq->map.index to the requested index together with irq->map.virq and improve the related comment to make it clearer which cases it deals with. Cc: Chuck Lever III <chuck.lever@oracle.com> Tested-by: Mark Brown <broonie@kernel.org> Reviewed-by: Mark Brown <broonie@kernel.org> Reviewed-by: Simon Horman <simon.horman@corigine.com> Reviewed-by: Eli Cohen <elic@nvidia.com> Fixes: 1da438c ("net/mlx5: Fix indexing of mlx5_irq") Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com> Tested-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
1 parent 1c4c769 commit 8764bd0

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • drivers/net/ethernet/mellanox/mlx5/core

drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,13 @@ struct mlx5_irq *mlx5_irq_alloc(struct mlx5_irq_pool *pool, int i,
232232
if (!irq)
233233
return ERR_PTR(-ENOMEM);
234234
if (!i || !pci_msix_can_alloc_dyn(dev->pdev)) {
235-
/* The vector at index 0 was already allocated.
236-
* Just get the irq number. If dynamic irq is not supported
237-
* vectors have also been allocated.
235+
/* The vector at index 0 is always statically allocated. If
236+
* dynamic irq is not supported all vectors are statically
237+
* allocated. In both cases just get the irq number and set
238+
* the index.
238239
*/
239240
irq->map.virq = pci_irq_vector(dev->pdev, i);
240-
irq->map.index = 0;
241+
irq->map.index = i;
241242
} else {
242243
irq->map = pci_msix_alloc_irq_at(dev->pdev, MSI_ANY_INDEX, af_desc);
243244
if (!irq->map.virq) {

0 commit comments

Comments
 (0)