[PATCH net-next v3] net/mlx5: Simplify cpumask operations in comp_irq_request_sf()

Fushuai Wang posted 1 patch 2 days, 19 hours ago
drivers/net/ethernet/mellanox/mlx5/core/eq.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH net-next v3] net/mlx5: Simplify cpumask operations in comp_irq_request_sf()
Posted by Fushuai Wang 2 days, 19 hours ago
From: Fushuai Wang <wangfushuai@baidu.com>

Combine cpumask_copy() and cpumask_andnot() into a single
cpumask_andnot() since the function can take cpu_online_mask
directly as the source.

Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
---
v2->v3: Separate the patchset to two patches, no changes on this patch
v1->v2: No changes on this patch

previous discussion:
https://lore.kernel.org/all/20260603072657.10868-1-fushuai.wang@linux.dev/T/#u
https://lore.kernel.org/all/20260604125705.21241-1-fushuai.wang@linux.dev/T/#u

 drivers/net/ethernet/mellanox/mlx5/core/eq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
index 22a637111aa2..d11ec263d53c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
@@ -886,8 +886,7 @@ static int comp_irq_request_sf(struct mlx5_core_dev *dev, u16 vecidx)
 		return -ENOMEM;
 
 	af_desc->is_managed = false;
-	cpumask_copy(&af_desc->mask, cpu_online_mask);
-	cpumask_andnot(&af_desc->mask, &af_desc->mask, &table->used_cpus);
+	cpumask_andnot(&af_desc->mask, cpu_online_mask, &table->used_cpus);
 	irq = mlx5_irq_affinity_request(dev, pool, af_desc);
 	if (IS_ERR(irq)) {
 		kvfree(af_desc);
-- 
2.36.1
Re: [PATCH net-next v3] net/mlx5: Simplify cpumask operations in comp_irq_request_sf()
Posted by Tariq Toukan 18 hours ago

On 05/06/2026 13:17, Fushuai Wang wrote:
> From: Fushuai Wang <wangfushuai@baidu.com>
> 
> Combine cpumask_copy() and cpumask_andnot() into a single
> cpumask_andnot() since the function can take cpu_online_mask
> directly as the source.
> 
> Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
> Reviewed-by: Shay Drory <shayd@nvidia.com>
> ---
> v2->v3: Separate the patchset to two patches, no changes on this patch
> v1->v2: No changes on this patch
> 
> previous discussion:
> https://lore.kernel.org/all/20260603072657.10868-1-fushuai.wang@linux.dev/T/#u
> https://lore.kernel.org/all/20260604125705.21241-1-fushuai.wang@linux.dev/T/#u
> 
>   drivers/net/ethernet/mellanox/mlx5/core/eq.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> index 22a637111aa2..d11ec263d53c 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> @@ -886,8 +886,7 @@ static int comp_irq_request_sf(struct mlx5_core_dev *dev, u16 vecidx)
>   		return -ENOMEM;
>   
>   	af_desc->is_managed = false;
> -	cpumask_copy(&af_desc->mask, cpu_online_mask);
> -	cpumask_andnot(&af_desc->mask, &af_desc->mask, &table->used_cpus);
> +	cpumask_andnot(&af_desc->mask, cpu_online_mask, &table->used_cpus);
>   	irq = mlx5_irq_affinity_request(dev, pool, af_desc);
>   	if (IS_ERR(irq)) {
>   		kvfree(af_desc);

Reviewed-by: Tariq Toukan <tariqt@nvidia.com>

Thanks for your patch.