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

net/mlx5: Rename mlx5_irq_info to mlx5_irq

struct mlx5_irq_info is an active object and not just info.
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 256cf690
...@@ -12,14 +12,14 @@ ...@@ -12,14 +12,14 @@
#define MLX5_MAX_IRQ_NAME (32) #define MLX5_MAX_IRQ_NAME (32)
struct mlx5_irq_info { struct mlx5_irq {
struct atomic_notifier_head nh; struct atomic_notifier_head nh;
cpumask_var_t mask; cpumask_var_t mask;
char name[MLX5_MAX_IRQ_NAME]; char name[MLX5_MAX_IRQ_NAME];
}; };
struct mlx5_irq_table { struct mlx5_irq_table {
struct mlx5_irq_info *irq_info; struct mlx5_irq *irq;
int nvec; int nvec;
#ifdef CONFIG_RFS_ACCEL #ifdef CONFIG_RFS_ACCEL
struct cpu_rmap *rmap; struct cpu_rmap *rmap;
...@@ -48,29 +48,29 @@ int mlx5_irq_get_num_comp(struct mlx5_irq_table *table) ...@@ -48,29 +48,29 @@ int mlx5_irq_get_num_comp(struct mlx5_irq_table *table)
return table->nvec - MLX5_EQ_VEC_COMP_BASE; return table->nvec - MLX5_EQ_VEC_COMP_BASE;
} }
static struct mlx5_irq_info *mlx5_irq_get(struct mlx5_core_dev *dev, int vecidx) static struct mlx5_irq *mlx5_irq_get(struct mlx5_core_dev *dev, int vecidx)
{ {
struct mlx5_irq_table *irq_table = dev->priv.irq_table; struct mlx5_irq_table *irq_table = dev->priv.irq_table;
return &irq_table->irq_info[vecidx]; return &irq_table->irq[vecidx];
} }
int mlx5_irq_attach_nb(struct mlx5_irq_table *irq_table, int vecidx, int mlx5_irq_attach_nb(struct mlx5_irq_table *irq_table, int vecidx,
struct notifier_block *nb) struct notifier_block *nb)
{ {
struct mlx5_irq_info *irq_info; struct mlx5_irq *irq;
irq_info = &irq_table->irq_info[vecidx]; irq = &irq_table->irq[vecidx];
return atomic_notifier_chain_register(&irq_info->nh, nb); return atomic_notifier_chain_register(&irq->nh, nb);
} }
int mlx5_irq_detach_nb(struct mlx5_irq_table *irq_table, int vecidx, int mlx5_irq_detach_nb(struct mlx5_irq_table *irq_table, int vecidx,
struct notifier_block *nb) struct notifier_block *nb)
{ {
struct mlx5_irq_info *irq_info; struct mlx5_irq *irq;
irq_info = &irq_table->irq_info[vecidx]; irq = &irq_table->irq[vecidx];
return atomic_notifier_chain_unregister(&irq_info->nh, nb); return atomic_notifier_chain_unregister(&irq->nh, nb);
} }
static irqreturn_t mlx5_irq_int_handler(int irq, void *nh) static irqreturn_t mlx5_irq_int_handler(int irq, void *nh)
...@@ -108,15 +108,15 @@ static int request_irqs(struct mlx5_core_dev *dev, int nvec) ...@@ -108,15 +108,15 @@ static int request_irqs(struct mlx5_core_dev *dev, int nvec)
int i; int i;
for (i = 0; i < nvec; i++) { for (i = 0; i < nvec; i++) {
struct mlx5_irq_info *irq_info = mlx5_irq_get(dev, i); struct mlx5_irq *irq = mlx5_irq_get(dev, i);
int irqn = pci_irq_vector(dev->pdev, i); int irqn = pci_irq_vector(dev->pdev, i);
irq_set_name(name, i); irq_set_name(name, i);
ATOMIC_INIT_NOTIFIER_HEAD(&irq_info->nh); ATOMIC_INIT_NOTIFIER_HEAD(&irq->nh);
snprintf(irq_info->name, MLX5_MAX_IRQ_NAME, snprintf(irq->name, MLX5_MAX_IRQ_NAME,
"%s@pci:%s", name, pci_name(dev->pdev)); "%s@pci:%s", name, pci_name(dev->pdev));
err = request_irq(irqn, mlx5_irq_int_handler, 0, irq_info->name, err = request_irq(irqn, mlx5_irq_int_handler, 0, irq->name,
&irq_info->nh); &irq->nh);
if (err) { if (err) {
mlx5_core_err(dev, "Failed to request irq\n"); mlx5_core_err(dev, "Failed to request irq\n");
goto err_request_irq; goto err_request_irq;
...@@ -126,10 +126,10 @@ static int request_irqs(struct mlx5_core_dev *dev, int nvec) ...@@ -126,10 +126,10 @@ static int request_irqs(struct mlx5_core_dev *dev, int nvec)
err_request_irq: err_request_irq:
for (; i >= 0; i--) { for (; i >= 0; i--) {
struct mlx5_irq_info *irq_info = mlx5_irq_get(dev, i); struct mlx5_irq *irq = mlx5_irq_get(dev, i);
int irqn = pci_irq_vector(dev->pdev, i); int irqn = pci_irq_vector(dev->pdev, i);
free_irq(irqn, &irq_info->nh); free_irq(irqn, &irq->nh);
} }
return err; return err;
} }
...@@ -183,23 +183,22 @@ static int irq_set_rmap(struct mlx5_core_dev *mdev) ...@@ -183,23 +183,22 @@ static int irq_set_rmap(struct mlx5_core_dev *mdev)
static int set_comp_irq_affinity_hint(struct mlx5_core_dev *mdev, int i) static int set_comp_irq_affinity_hint(struct mlx5_core_dev *mdev, int i)
{ {
int vecidx = MLX5_EQ_VEC_COMP_BASE + i; int vecidx = MLX5_EQ_VEC_COMP_BASE + i;
struct mlx5_irq_info *irq_info; struct mlx5_irq *irq;
int irq; int irqn;
irq_info = mlx5_irq_get(mdev, vecidx); irq = mlx5_irq_get(mdev, vecidx);
irq = pci_irq_vector(mdev->pdev, vecidx); irqn = pci_irq_vector(mdev->pdev, vecidx);
if (!zalloc_cpumask_var(&irq_info->mask, GFP_KERNEL)) { if (!zalloc_cpumask_var(&irq->mask, GFP_KERNEL)) {
mlx5_core_warn(mdev, "zalloc_cpumask_var failed"); mlx5_core_warn(mdev, "zalloc_cpumask_var failed");
return -ENOMEM; return -ENOMEM;
} }
cpumask_set_cpu(cpumask_local_spread(i, mdev->priv.numa_node), cpumask_set_cpu(cpumask_local_spread(i, mdev->priv.numa_node),
irq_info->mask); irq->mask);
if (IS_ENABLED(CONFIG_SMP) && if (IS_ENABLED(CONFIG_SMP) &&
irq_set_affinity_hint(irq, irq_info->mask)) irq_set_affinity_hint(irqn, irq->mask))
mlx5_core_warn(mdev, "irq_set_affinity_hint failed, irq 0x%.4x", mlx5_core_warn(mdev, "irq_set_affinity_hint failed, irq 0x%.4x",
irq); irqn);
return 0; return 0;
} }
...@@ -207,13 +206,13 @@ static int set_comp_irq_affinity_hint(struct mlx5_core_dev *mdev, int i) ...@@ -207,13 +206,13 @@ static int set_comp_irq_affinity_hint(struct mlx5_core_dev *mdev, int i)
static void clear_comp_irq_affinity_hint(struct mlx5_core_dev *mdev, int i) static void clear_comp_irq_affinity_hint(struct mlx5_core_dev *mdev, int i)
{ {
int vecidx = MLX5_EQ_VEC_COMP_BASE + i; int vecidx = MLX5_EQ_VEC_COMP_BASE + i;
struct mlx5_irq_info *irq_info; struct mlx5_irq *irq;
int irq; int irqn;
irq_info = mlx5_irq_get(mdev, vecidx); irq = mlx5_irq_get(mdev, vecidx);
irq = pci_irq_vector(mdev->pdev, vecidx); irqn = pci_irq_vector(mdev->pdev, vecidx);
irq_set_affinity_hint(irq, NULL); irq_set_affinity_hint(irqn, NULL);
free_cpumask_var(irq_info->mask); free_cpumask_var(irq->mask);
} }
static int set_comp_irq_affinity_hints(struct mlx5_core_dev *mdev) static int set_comp_irq_affinity_hints(struct mlx5_core_dev *mdev)
...@@ -249,7 +248,7 @@ static void clear_comp_irqs_affinity_hints(struct mlx5_core_dev *mdev) ...@@ -249,7 +248,7 @@ static void clear_comp_irqs_affinity_hints(struct mlx5_core_dev *mdev)
struct cpumask * struct cpumask *
mlx5_irq_get_affinity_mask(struct mlx5_irq_table *irq_table, int vecidx) mlx5_irq_get_affinity_mask(struct mlx5_irq_table *irq_table, int vecidx)
{ {
return irq_table->irq_info[vecidx].mask; return irq_table->irq[vecidx].mask;
} }
#ifdef CONFIG_RFS_ACCEL #ifdef CONFIG_RFS_ACCEL
...@@ -285,15 +284,15 @@ int mlx5_irq_table_create(struct mlx5_core_dev *dev) ...@@ -285,15 +284,15 @@ int mlx5_irq_table_create(struct mlx5_core_dev *dev)
if (nvec <= MLX5_EQ_VEC_COMP_BASE) if (nvec <= MLX5_EQ_VEC_COMP_BASE)
return -ENOMEM; return -ENOMEM;
table->irq_info = kcalloc(nvec, sizeof(*table->irq_info), GFP_KERNEL); table->irq = kcalloc(nvec, sizeof(*table->irq), GFP_KERNEL);
if (!table->irq_info) if (!table->irq)
return -ENOMEM; return -ENOMEM;
nvec = pci_alloc_irq_vectors(dev->pdev, MLX5_EQ_VEC_COMP_BASE + 1, nvec = pci_alloc_irq_vectors(dev->pdev, MLX5_EQ_VEC_COMP_BASE + 1,
nvec, PCI_IRQ_MSIX); nvec, PCI_IRQ_MSIX);
if (nvec < 0) { if (nvec < 0) {
err = nvec; err = nvec;
goto err_free_irq_info; goto err_free_irq;
} }
table->nvec = nvec; table->nvec = nvec;
...@@ -320,8 +319,8 @@ int mlx5_irq_table_create(struct mlx5_core_dev *dev) ...@@ -320,8 +319,8 @@ int mlx5_irq_table_create(struct mlx5_core_dev *dev)
irq_clear_rmap(dev); irq_clear_rmap(dev);
err_set_rmap: err_set_rmap:
pci_free_irq_vectors(dev->pdev); pci_free_irq_vectors(dev->pdev);
err_free_irq_info: err_free_irq:
kfree(table->irq_info); kfree(table->irq);
return err; return err;
} }
...@@ -340,6 +339,6 @@ void mlx5_irq_table_destroy(struct mlx5_core_dev *dev) ...@@ -340,6 +339,6 @@ void mlx5_irq_table_destroy(struct mlx5_core_dev *dev)
free_irq(pci_irq_vector(dev->pdev, i), free_irq(pci_irq_vector(dev->pdev, i),
&mlx5_irq_get(dev, i)->nh); &mlx5_irq_get(dev, i)->nh);
pci_free_irq_vectors(dev->pdev); pci_free_irq_vectors(dev->pdev);
kfree(table->irq_info); kfree(table->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