Skip to content

Commit 1ef903b

Browse files
Daniel JurgensSaeed Mahameed
authored andcommitted
net/mlx5: Free IRQs in shutdown path
Some platforms require IRQs to be free'd in the shutdown path. Otherwise they will fail to be reallocated after a kexec. Fixes: 8812c24 ("net/mlx5: Add fast unload support in shutdown flow") Signed-off-by: Daniel Jurgens <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent ca3943c commit 1ef903b

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
#include <linux/module.h>
3535
#include <linux/mlx5/driver.h>
3636
#include <linux/mlx5/cmd.h>
37+
#ifdef CONFIG_RFS_ACCEL
38+
#include <linux/cpu_rmap.h>
39+
#endif
3740
#include "mlx5_core.h"
3841
#include "fpga/core.h"
3942
#include "eswitch.h"
@@ -923,3 +926,28 @@ int mlx5_core_eq_query(struct mlx5_core_dev *dev, struct mlx5_eq *eq,
923926
MLX5_SET(query_eq_in, in, eq_number, eq->eqn);
924927
return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen);
925928
}
929+
930+
/* This function should only be called after mlx5_cmd_force_teardown_hca */
931+
void mlx5_core_eq_free_irqs(struct mlx5_core_dev *dev)
932+
{
933+
struct mlx5_eq_table *table = &dev->priv.eq_table;
934+
struct mlx5_eq *eq;
935+
936+
#ifdef CONFIG_RFS_ACCEL
937+
if (dev->rmap) {
938+
free_irq_cpu_rmap(dev->rmap);
939+
dev->rmap = NULL;
940+
}
941+
#endif
942+
list_for_each_entry(eq, &table->comp_eqs_list, list)
943+
free_irq(eq->irqn, eq);
944+
945+
free_irq(table->pages_eq.irqn, &table->pages_eq);
946+
free_irq(table->async_eq.irqn, &table->async_eq);
947+
free_irq(table->cmd_eq.irqn, &table->cmd_eq);
948+
#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING
949+
if (MLX5_CAP_GEN(dev, pg))
950+
free_irq(table->pfault_eq.irqn, &table->pfault_eq);
951+
#endif
952+
pci_free_irq_vectors(dev->pdev);
953+
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,6 +1587,14 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev *dev)
15871587

15881588
mlx5_enter_error_state(dev, true);
15891589

1590+
/* Some platforms requiring freeing the IRQ's in the shutdown
1591+
* flow. If they aren't freed they can't be allocated after
1592+
* kexec. There is no need to cleanup the mlx5_core software
1593+
* contexts.
1594+
*/
1595+
mlx5_irq_clear_affinity_hints(dev);
1596+
mlx5_core_eq_free_irqs(dev);
1597+
15901598
return 0;
15911599
}
15921600

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ int mlx5_core_eq_query(struct mlx5_core_dev *dev, struct mlx5_eq *eq,
128128
u32 *out, int outlen);
129129
int mlx5_start_eqs(struct mlx5_core_dev *dev);
130130
void mlx5_stop_eqs(struct mlx5_core_dev *dev);
131+
/* This function should only be called after mlx5_cmd_force_teardown_hca */
132+
void mlx5_core_eq_free_irqs(struct mlx5_core_dev *dev);
131133
struct mlx5_eq *mlx5_eqn2eq(struct mlx5_core_dev *dev, int eqn);
132134
u32 mlx5_eq_poll_irq_disabled(struct mlx5_eq *eq);
133135
void mlx5_cq_tasklet_cb(unsigned long data);

0 commit comments

Comments
 (0)