[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <77df78bb-8bcf-42e8-b307-cc8bbe97254c@nvidia.com>
Date: Wed, 23 Apr 2025 14:20:56 +0300
From: Mark Bloch <mbloch@...dia.com>
To: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
Cc: "David S . Miller" <davem@...emloft.net>, Jakub Kicinski
<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Eric Dumazet <edumazet@...gle.com>, Andrew Lunn <andrew+netdev@...n.ch>,
Saeed Mahameed <saeedm@...dia.com>, Tariq Toukan <tariqt@...dia.com>,
Leon Romanovsky <leon@...nel.org>, netdev@...r.kernel.org,
linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org,
Maor Gottlieb <maorg@...dia.com>
Subject: Re: [PATCH net 2/5] net/mlx5: E-Switch, Initialize MAC Address for
Default GID
On 23/04/2025 13:31, Michal Swiatkowski wrote:
> On Wed, Apr 23, 2025 at 11:36:08AM +0300, Mark Bloch wrote:
>> From: Maor Gottlieb <maorg@...dia.com>
>>
>> Initialize the source MAC address when creating the default GID entry.
>> Since this entry is used only for loopback traffic, it only needs to
>> be a unicast address. A zeroed-out MAC address is sufficient for this
>> purpose.
>> Without this fix, random bits would be assigned as the source address.
>> If these bits formed a multicast address, the firmware would return an
>> error, preventing the user from switching to switchdev mode:
>>
>> Error: mlx5_core: Failed setting eswitch to offloads.
>> kernel answers: Invalid argument
>>
>> Fixes: 80f09dfc237f ("net/mlx5: Eswitch, enable RoCE loopback traffic")
>> Signed-off-by: Maor Gottlieb <maorg@...dia.com>
>> Signed-off-by: Mark Bloch <mbloch@...dia.com>
>> ---
>> drivers/net/ethernet/mellanox/mlx5/core/rdma.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/rdma.c b/drivers/net/ethernet/mellanox/mlx5/core/rdma.c
>> index a42f6cd99b74..f585ef5a3424 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/rdma.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/rdma.c
>> @@ -118,8 +118,8 @@ static void mlx5_rdma_make_default_gid(struct mlx5_core_dev *dev, union ib_gid *
>>
>> static int mlx5_rdma_add_roce_addr(struct mlx5_core_dev *dev)
>> {
>> + u8 mac[ETH_ALEN] = {};
>
> Won't it be helpful to add comment that it needs to be unicast and 0 is
> a valid MAC?
That's why the commit message has: "it only needs to
be a unicast address. A zeroed-out MAC address is sufficient for this
purpose."
I feel this is good enough.
>
> Anyway,
> Reviewed-by: Michal Swiatkowski <michal.swiatkowski@...ux.intel.com>
Thanks!
>
> hw_id in mlx5_rdma_make_default_gid() is also used without assigining.
> Is it fine to have random bits there?
We pass hw_id to mlx5_query_mac_address() which fills it.
However, there's a separate issue where mlx5_query_mac_address()
might fail, this is unlikely, but still possible.
We'll address that in a follow-up patch.
Thanks for the review!
Mark
>
> Thanks
>
>> union ib_gid gid;
>> - u8 mac[ETH_ALEN];
>>
>> mlx5_rdma_make_default_gid(dev, &gid);
>> return mlx5_core_roce_gid_set(dev, 0,
>> --
>> 2.34.1
Powered by blists - more mailing lists