Skip to content

Commit 32d2724

Browse files
shayshyiPaolo Abeni
authored andcommitted
net/mlx5: Fix incorrect IRQ pool usage when releasing IRQs
mlx5_irq_pool_get() is a getter for completion IRQ pool only. However, after the cited commit, mlx5_irq_pool_get() is called during ctrl IRQ release flow to retrieve the pool, resulting in the use of an incorrect IRQ pool. Hence, use the newly introduced mlx5_irq_get_pool() getter to retrieve the correct IRQ pool based on the IRQ itself. While at it, rename mlx5_irq_pool_get() to mlx5_irq_table_get_comp_irq_pool() which accurately reflects its purpose and improves code readability. Fixes: 0477d51 ("net/mlx5: Expose SFs IRQs") Signed-off-by: Shay Drory <[email protected]> Reviewed-by: Maher Sanalla <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Reviewed-by: Michal Swiatkowski <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 5219923 commit 32d2724

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,8 +871,8 @@ static void comp_irq_release_sf(struct mlx5_core_dev *dev, u16 vecidx)
871871

872872
static int comp_irq_request_sf(struct mlx5_core_dev *dev, u16 vecidx)
873873
{
874+
struct mlx5_irq_pool *pool = mlx5_irq_table_get_comp_irq_pool(dev);
874875
struct mlx5_eq_table *table = dev->priv.eq_table;
875-
struct mlx5_irq_pool *pool = mlx5_irq_pool_get(dev);
876876
struct irq_affinity_desc af_desc = {};
877877
struct mlx5_irq *irq;
878878

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ mlx5_irq_affinity_request(struct mlx5_core_dev *dev, struct mlx5_irq_pool *pool,
175175

176176
void mlx5_irq_affinity_irq_release(struct mlx5_core_dev *dev, struct mlx5_irq *irq)
177177
{
178-
struct mlx5_irq_pool *pool = mlx5_irq_pool_get(dev);
178+
struct mlx5_irq_pool *pool = mlx5_irq_get_pool(irq);
179179
int cpu;
180180

181181
cpu = cpumask_first(mlx5_irq_get_affinity_mask(irq));

drivers/net/ethernet/mellanox/mlx5/core/mlx5_irq.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010

1111
struct mlx5_irq;
1212
struct cpu_rmap;
13+
struct mlx5_irq_pool;
1314

1415
int mlx5_irq_table_init(struct mlx5_core_dev *dev);
1516
void mlx5_irq_table_cleanup(struct mlx5_core_dev *dev);
1617
int mlx5_irq_table_create(struct mlx5_core_dev *dev);
1718
void mlx5_irq_table_destroy(struct mlx5_core_dev *dev);
1819
void mlx5_irq_table_free_irqs(struct mlx5_core_dev *dev);
20+
struct mlx5_irq_pool *
21+
mlx5_irq_table_get_comp_irq_pool(struct mlx5_core_dev *dev);
1922
int mlx5_irq_table_get_num_comp(struct mlx5_irq_table *table);
2023
int mlx5_irq_table_get_sfs_vec(struct mlx5_irq_table *table);
2124
struct mlx5_irq_table *mlx5_irq_table_get(struct mlx5_core_dev *dev);
@@ -38,7 +41,6 @@ struct cpumask *mlx5_irq_get_affinity_mask(struct mlx5_irq *irq);
3841
int mlx5_irq_get_index(struct mlx5_irq *irq);
3942
int mlx5_irq_get_irq(const struct mlx5_irq *irq);
4043

41-
struct mlx5_irq_pool;
4244
#ifdef CONFIG_MLX5_SF
4345
struct mlx5_irq *mlx5_irq_affinity_irq_request_auto(struct mlx5_core_dev *dev,
4446
struct cpumask *used_cpus, u16 vecidx);

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,11 @@ int mlx5_irq_get_index(struct mlx5_irq *irq)
378378
return irq->map.index;
379379
}
380380

381+
struct mlx5_irq_pool *mlx5_irq_get_pool(struct mlx5_irq *irq)
382+
{
383+
return irq->pool;
384+
}
385+
381386
/* irq_pool API */
382387

383388
/* requesting an irq from a given pool according to given index */
@@ -405,18 +410,20 @@ static struct mlx5_irq_pool *sf_ctrl_irq_pool_get(struct mlx5_irq_table *irq_tab
405410
return irq_table->sf_ctrl_pool;
406411
}
407412

408-
static struct mlx5_irq_pool *sf_irq_pool_get(struct mlx5_irq_table *irq_table)
413+
static struct mlx5_irq_pool *
414+
sf_comp_irq_pool_get(struct mlx5_irq_table *irq_table)
409415
{
410416
return irq_table->sf_comp_pool;
411417
}
412418

413-
struct mlx5_irq_pool *mlx5_irq_pool_get(struct mlx5_core_dev *dev)
419+
struct mlx5_irq_pool *
420+
mlx5_irq_table_get_comp_irq_pool(struct mlx5_core_dev *dev)
414421
{
415422
struct mlx5_irq_table *irq_table = mlx5_irq_table_get(dev);
416423
struct mlx5_irq_pool *pool = NULL;
417424

418425
if (mlx5_core_is_sf(dev))
419-
pool = sf_irq_pool_get(irq_table);
426+
pool = sf_comp_irq_pool_get(irq_table);
420427

421428
/* In some configs, there won't be a pool of SFs IRQs. Hence, returning
422429
* the PF IRQs pool in case the SF pool doesn't exist.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ struct mlx5_irq_pool {
2828
struct mlx5_core_dev *dev;
2929
};
3030

31-
struct mlx5_irq_pool *mlx5_irq_pool_get(struct mlx5_core_dev *dev);
3231
static inline bool mlx5_irq_pool_is_sf_pool(struct mlx5_irq_pool *pool)
3332
{
3433
return !strncmp("mlx5_sf", pool->name, strlen("mlx5_sf"));
@@ -40,5 +39,6 @@ struct mlx5_irq *mlx5_irq_alloc(struct mlx5_irq_pool *pool, int i,
4039
int mlx5_irq_get_locked(struct mlx5_irq *irq);
4140
int mlx5_irq_read_locked(struct mlx5_irq *irq);
4241
int mlx5_irq_put(struct mlx5_irq *irq);
42+
struct mlx5_irq_pool *mlx5_irq_get_pool(struct mlx5_irq *irq);
4343

4444
#endif /* __PCI_IRQ_H__ */

0 commit comments

Comments
 (0)