lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <20230807175642.20834-8-saeed@kernel.org> Date: Mon, 7 Aug 2023 10:56:34 -0700 From: Saeed Mahameed <saeed@...nel.org> To: "David S. Miller" <davem@...emloft.net>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Eric Dumazet <edumazet@...gle.com> Cc: Saeed Mahameed <saeedm@...dia.com>, netdev@...r.kernel.org, Tariq Toukan <tariqt@...dia.com>, Maher Sanalla <msanalla@...dia.com>, Shay Drory <shayd@...dia.com>, Moshe Shemesh <moshe@...dia.com> Subject: [net-next 07/15] net/mlx5: Introduce mlx5_cpumask_default_spread From: Maher Sanalla <msanalla@...dia.com> For better code readability in the completion IRQ request code, define the cpu lookup per completion vector logic in a separate function. The new method mlx5_cpumask_default_spread() given a vector index 'n' will return the 'nth' cpu. This new method will be used also in the next patch. Signed-off-by: Maher Sanalla <msanalla@...dia.com> Reviewed-by: Shay Drory <shayd@...dia.com> Reviewed-by: Moshe Shemesh <moshe@...dia.com> Signed-off-by: Saeed Mahameed <saeedm@...dia.com> --- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index 41fa15757101..ad654d460d0c 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c @@ -826,20 +826,18 @@ static void comp_irq_release_pci(struct mlx5_core_dev *dev, u16 vecidx) mlx5_irq_release_vector(irq); } -static int comp_irq_request_pci(struct mlx5_core_dev *dev, u16 vecidx) +static int mlx5_cpumask_default_spread(int numa_node, int index) { - struct mlx5_eq_table *table = dev->priv.eq_table; const struct cpumask *prev = cpu_none_mask; const struct cpumask *mask; - struct mlx5_irq *irq; int found_cpu = 0; int i = 0; int cpu; rcu_read_lock(); - for_each_numa_hop_mask(mask, dev->priv.numa_node) { + for_each_numa_hop_mask(mask, numa_node) { for_each_cpu_andnot(cpu, mask, prev) { - if (i++ == vecidx) { + if (i++ == index) { found_cpu = cpu; goto spread_done; } @@ -849,7 +847,17 @@ static int comp_irq_request_pci(struct mlx5_core_dev *dev, u16 vecidx) spread_done: rcu_read_unlock(); - irq = mlx5_irq_request_vector(dev, found_cpu, vecidx, &table->rmap); + return found_cpu; +} + +static int comp_irq_request_pci(struct mlx5_core_dev *dev, u16 vecidx) +{ + struct mlx5_eq_table *table = dev->priv.eq_table; + struct mlx5_irq *irq; + int cpu; + + cpu = mlx5_cpumask_default_spread(dev->priv.numa_node, vecidx); + irq = mlx5_irq_request_vector(dev, cpu, vecidx, &table->rmap); if (IS_ERR(irq)) return PTR_ERR(irq); -- 2.41.0
Powered by blists - more mailing lists