[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <83aad5ca-21e5-41a2-89c9-e3c8e9006e6a@gmail.com>
Date: Sun, 26 Oct 2025 14:50:58 +0200
From: Tariq Toukan <ttoukan.linux@...il.com>
To: Simon Horman <horms@...nel.org>, Tariq Toukan <tariqt@...dia.com>
Cc: Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>, Saeed Mahameed <saeedm@...dia.com>,
Leon Romanovsky <leon@...nel.org>, Mark Bloch <mbloch@...dia.com>,
netdev@...r.kernel.org, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org, Gal Pressman <gal@...dia.com>,
Carolina Jubran <cjubran@...dia.com>, Dragos Tatulea <dtatulea@...dia.com>
Subject: Re: [PATCH net-next 2/7] net/mlx5e: Use TIR API in
mlx5e_modify_tirs_lb()
On 23/10/2025 16:31, Simon Horman wrote:
> On Thu, Oct 23, 2025 at 09:43:35AM +0300, Tariq Toukan wrote:
>
> ...
>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_common.c b/drivers/net/ethernet/mellanox/mlx5/core/en_common.c
>> index 376a018b2db1..fad6b761f622 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_common.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_common.c
>> @@ -250,43 +250,30 @@ void mlx5e_destroy_mdev_resources(struct mlx5_core_dev *mdev)
>> int mlx5e_modify_tirs_lb(struct mlx5_core_dev *mdev, bool enable_uc_lb,
>> bool enable_mc_lb)
>
> ...
>
>> list_for_each_entry(tir, &mdev->mlx5e_res.hw_objs.td.tirs_list, list) {
>> - tirn = tir->tirn;
>> - err = mlx5_core_modify_tir(mdev, tirn, in);
>> + err = mlx5e_tir_modify(tir, builder);
>> if (err)
>> break;
>> }
>> mutex_unlock(&mdev->mlx5e_res.hw_objs.td.list_lock);
>>
>> - kvfree(in);
>> + mlx5e_tir_builder_free(builder);
>> if (err)
>> mlx5_core_err(mdev,
>> "modify tir(0x%x) enable_lb uc(%d) mc(%d) failed, %d\n",
>> - tirn,
>> + mlx5e_tir_get_tirn(tir),
>
> Sorry, for not noticing this before sending my previous email.
>
> Coccinelle complains about the line above like this:
>
> .../en_common.c:276:28-31: ERROR: invalid reference to the index variable of the iterator on line 265
>
> I think this is a false positive because the problem only occurs if
> the list iteration runs to completion. But err guards against
> tir being used in that case.
>
Exactly.
> But, perhaps, to be on the safe side, it would be good practice
> to stash tir somewhere?
>
I tried to keep the error print out of the critical lock section.
It's not time-sensitive so optimization is not really needed.
I can simply move the print inside where it belongs.
>> enable_uc_lb, enable_mc_lb, err);
>>
>> return err;
>> --
>> 2.31.1
>>
>>
>
Powered by blists - more mailing lists