Commit e1706e62 authored by Yuval Avnery's avatar Yuval Avnery Committed by Saeed Mahameed

net/mlx5: Separate IRQ table creation from EQ table creation

IRQ allocation should be part of the IRQ table life-cycle.
Signed-off-by: default avatarYuval Avnery <yuvalav@mellanox.com>
Reviewed-by: default avatarParav Pandit <parav@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 90426cc0
...@@ -1056,18 +1056,10 @@ struct mlx5_eq_comp *mlx5_eqn2comp_eq(struct mlx5_core_dev *dev, int eqn) ...@@ -1056,18 +1056,10 @@ struct mlx5_eq_comp *mlx5_eqn2comp_eq(struct mlx5_core_dev *dev, int eqn)
void mlx5_core_eq_free_irqs(struct mlx5_core_dev *dev) void mlx5_core_eq_free_irqs(struct mlx5_core_dev *dev)
{ {
struct mlx5_eq_table *table = dev->priv.eq_table; struct mlx5_eq_table *table = dev->priv.eq_table;
int i, max_eqs;
clear_comp_irqs_affinity_hints(dev);
irq_clear_rmap(dev);
mutex_lock(&table->lock); /* sync with create/destroy_async_eq */ mutex_lock(&table->lock); /* sync with create/destroy_async_eq */
max_eqs = table->num_comp_eqs + MLX5_EQ_VEC_COMP_BASE; mlx5_irq_table_destroy(dev);
for (i = max_eqs - 1; i >= 0; i--) {
free_irq(pci_irq_vector(dev->pdev, i),
&mlx5_irq_get(dev, i)->nh);
}
mutex_unlock(&table->lock); mutex_unlock(&table->lock);
pci_free_irq_vectors(dev->pdev);
} }
static void unrequest_irqs(struct mlx5_core_dev *dev) static void unrequest_irqs(struct mlx5_core_dev *dev)
...@@ -1080,7 +1072,7 @@ static void unrequest_irqs(struct mlx5_core_dev *dev) ...@@ -1080,7 +1072,7 @@ static void unrequest_irqs(struct mlx5_core_dev *dev)
&mlx5_irq_get(dev, i)->nh); &mlx5_irq_get(dev, i)->nh);
} }
static int alloc_irq_vectors(struct mlx5_core_dev *dev) int mlx5_irq_table_create(struct mlx5_core_dev *dev)
{ {
struct mlx5_priv *priv = &dev->priv; struct mlx5_priv *priv = &dev->priv;
struct mlx5_irq_table *table = priv->irq_table; struct mlx5_irq_table *table = priv->irq_table;
...@@ -1134,7 +1126,7 @@ static int alloc_irq_vectors(struct mlx5_core_dev *dev) ...@@ -1134,7 +1126,7 @@ static int alloc_irq_vectors(struct mlx5_core_dev *dev)
return err; return err;
} }
static void free_irq_vectors(struct mlx5_core_dev *dev) void mlx5_irq_table_destroy(struct mlx5_core_dev *dev)
{ {
struct mlx5_irq_table *table = dev->priv.irq_table; struct mlx5_irq_table *table = dev->priv.irq_table;
int i; int i;
...@@ -1157,12 +1149,6 @@ int mlx5_eq_table_create(struct mlx5_core_dev *dev) ...@@ -1157,12 +1149,6 @@ int mlx5_eq_table_create(struct mlx5_core_dev *dev)
struct mlx5_eq_table *eq_table = dev->priv.eq_table; struct mlx5_eq_table *eq_table = dev->priv.eq_table;
int err; int err;
err = alloc_irq_vectors(dev);
if (err) {
mlx5_core_err(dev, "Failed to create IRQ vectors\n");
return err;
}
eq_table->num_comp_eqs = eq_table->num_comp_eqs =
mlx5_irq_get_num_comp(eq_table->irq_table); mlx5_irq_get_num_comp(eq_table->irq_table);
...@@ -1182,7 +1168,6 @@ int mlx5_eq_table_create(struct mlx5_core_dev *dev) ...@@ -1182,7 +1168,6 @@ int mlx5_eq_table_create(struct mlx5_core_dev *dev)
err_comp_eqs: err_comp_eqs:
destroy_async_eqs(dev); destroy_async_eqs(dev);
err_async_eqs: err_async_eqs:
free_irq_vectors(dev);
return err; return err;
} }
...@@ -1190,7 +1175,6 @@ void mlx5_eq_table_destroy(struct mlx5_core_dev *dev) ...@@ -1190,7 +1175,6 @@ void mlx5_eq_table_destroy(struct mlx5_core_dev *dev)
{ {
destroy_comp_eqs(dev); destroy_comp_eqs(dev);
destroy_async_eqs(dev); destroy_async_eqs(dev);
free_irq_vectors(dev);
} }
int mlx5_eq_notifier_register(struct mlx5_core_dev *dev, struct mlx5_nb *nb) int mlx5_eq_notifier_register(struct mlx5_core_dev *dev, struct mlx5_nb *nb)
......
...@@ -1047,6 +1047,12 @@ static int mlx5_load(struct mlx5_core_dev *dev) ...@@ -1047,6 +1047,12 @@ static int mlx5_load(struct mlx5_core_dev *dev)
mlx5_events_start(dev); mlx5_events_start(dev);
mlx5_pagealloc_start(dev); mlx5_pagealloc_start(dev);
err = mlx5_irq_table_create(dev);
if (err) {
mlx5_core_err(dev, "Failed to alloc IRQs\n");
goto err_irq_table;
}
err = mlx5_eq_table_create(dev); err = mlx5_eq_table_create(dev);
if (err) { if (err) {
mlx5_core_err(dev, "Failed to create EQs\n"); mlx5_core_err(dev, "Failed to create EQs\n");
...@@ -1118,6 +1124,8 @@ static int mlx5_load(struct mlx5_core_dev *dev) ...@@ -1118,6 +1124,8 @@ static int mlx5_load(struct mlx5_core_dev *dev)
err_fw_tracer: err_fw_tracer:
mlx5_eq_table_destroy(dev); mlx5_eq_table_destroy(dev);
err_eq_table: err_eq_table:
mlx5_irq_table_destroy(dev);
err_irq_table:
mlx5_pagealloc_stop(dev); mlx5_pagealloc_stop(dev);
mlx5_events_stop(dev); mlx5_events_stop(dev);
mlx5_put_uars_page(dev, dev->priv.uar); mlx5_put_uars_page(dev, dev->priv.uar);
...@@ -1134,6 +1142,7 @@ static void mlx5_unload(struct mlx5_core_dev *dev) ...@@ -1134,6 +1142,7 @@ static void mlx5_unload(struct mlx5_core_dev *dev)
mlx5_fpga_device_stop(dev); mlx5_fpga_device_stop(dev);
mlx5_fw_tracer_cleanup(dev->tracer); mlx5_fw_tracer_cleanup(dev->tracer);
mlx5_eq_table_destroy(dev); mlx5_eq_table_destroy(dev);
mlx5_irq_table_destroy(dev);
mlx5_pagealloc_stop(dev); mlx5_pagealloc_stop(dev);
mlx5_events_stop(dev); mlx5_events_stop(dev);
mlx5_put_uars_page(dev, dev->priv.uar); mlx5_put_uars_page(dev, dev->priv.uar);
......
...@@ -155,6 +155,8 @@ void mlx5_lag_remove(struct mlx5_core_dev *dev); ...@@ -155,6 +155,8 @@ void mlx5_lag_remove(struct mlx5_core_dev *dev);
int mlx5_irq_table_init(struct mlx5_core_dev *dev); int mlx5_irq_table_init(struct mlx5_core_dev *dev);
void mlx5_irq_table_cleanup(struct mlx5_core_dev *dev); void mlx5_irq_table_cleanup(struct mlx5_core_dev *dev);
int mlx5_irq_table_create(struct mlx5_core_dev *dev);
void mlx5_irq_table_destroy(struct mlx5_core_dev *dev);
int mlx5_events_init(struct mlx5_core_dev *dev); int mlx5_events_init(struct mlx5_core_dev *dev);
void mlx5_events_cleanup(struct mlx5_core_dev *dev); void mlx5_events_cleanup(struct mlx5_core_dev *dev);
......
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