Skip to content

Commit

Permalink
net: mlx5: switch comp_irqs_request() to using for_each_numa_cpu
Browse files Browse the repository at this point in the history
for_each_numa_online_cpu() is a more straightforward alternative to
for_each_numa_hop_mask() + for_each_cpu_andnot().

Signed-off-by: Yury Norov <yury.norov@gmail.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
  • Loading branch information
Yury Norov committed Jul 18, 2023
1 parent 6cc0359 commit a4be5fa
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions drivers/net/ethernet/mellanox/mlx5/core/eq.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,12 +813,10 @@ static void comp_irqs_release_pci(struct mlx5_core_dev *dev)
static int comp_irqs_request_pci(struct mlx5_core_dev *dev)
{
struct mlx5_eq_table *table = dev->priv.eq_table;
const struct cpumask *prev = cpu_none_mask;
const struct cpumask *mask;
int ncomp_eqs;
u16 *cpus;
int ret;
int cpu;
int cpu, hop;
int i;

ncomp_eqs = table->num_comp_eqs;
Expand All @@ -828,15 +826,11 @@ static int comp_irqs_request_pci(struct mlx5_core_dev *dev)

i = 0;
rcu_read_lock();
for_each_numa_hop_mask(mask, dev->priv.numa_node) {
for_each_cpu_andnot(cpu, mask, prev) {
cpus[i] = cpu;
if (++i == ncomp_eqs)
goto spread_done;
}
prev = mask;
for_each_numa_online_cpu(cpu, hop, dev->priv.numa_node) {
cpus[i] = cpu;
if (++i == ncomp_eqs)
break;
}
spread_done:
rcu_read_unlock();
ret = mlx5_irqs_request_vectors(dev, cpus, ncomp_eqs, table->comp_irqs, &table->rmap);
kfree(cpus);
Expand Down

0 comments on commit a4be5fa

Please sign in to comment.