[PATCH net] net/mlx5: report duplex full when speed is known

Li Tian posted 1 patch 2 weeks, 5 days ago
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH net] net/mlx5: report duplex full when speed is known
Posted by Li Tian 2 weeks, 5 days ago
Prior commit in Fixes, duplex is always reported full as long
as the speed is known. Restore this behavior. Besides, modern
Mellanox doesn't seem to care about half duplex. This change
mitigates duplex unknown issue on Azure Mellanox 5.

Fixes: c268ca6087f55 ("net/mlx5: Expose port speed when possible")
Signed-off-by: Li Tian <litian@redhat.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
index d507366d773e..9f35d3b491e0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
@@ -1118,9 +1118,11 @@ static void get_link_properties(struct net_device *netdev,
 	if (info) {
 		speed = info->speed;
 		lanes = info->lanes;
-		duplex = DUPLEX_FULL;
 	} else if (data_rate_oper)
 		speed = 100 * data_rate_oper;
+	if (!speed)
+		goto out;
+	duplex = DUPLEX_FULL;
 
 out:
 	link_ksettings->base.duplex = duplex;
-- 
2.50.0
Re: [PATCH net] net/mlx5: report duplex full when speed is known
Posted by Andrew Lunn 2 weeks, 5 days ago
On Sat, Sep 13, 2025 at 02:28:10PM +0800, Li Tian wrote:
> Prior commit in Fixes, duplex is always reported full as long
> as the speed is known. Restore this behavior. Besides, modern
> Mellanox doesn't seem to care about half duplex. This change
> mitigates duplex unknown issue on Azure Mellanox 5.
> 
> Fixes: c268ca6087f55 ("net/mlx5: Expose port speed when possible")

I'm confused with your commit message. You say DUPLEX used to be
reported as Full if the speed is known. How does c268ca6087f55 change
this? You don't say in the commit message. Why is Half duplex
important to this fix? I don't see Half anywhere in the code.

Also, what sort of problems do you see with duplex unknown? When
somebody has a problem and is looking to find a patch which might fix
it, seeing a description of the problem fixed in the commit message is
useful.

	Andrew
Re: [PATCH net] net/mlx5: report duplex full when speed is known
Posted by Li Tian 2 weeks, 4 days ago
On Sat, Sep 13, 2025 at 10:12 PM Andrew Lunn <andrew@lunn.ch> wrote:

> I'm confused with your commit message. You say DUPLEX used to be
> reported as Full if the speed is known. How does c268ca6087f55 change
> this?

Because in some circumstances like Azure, mlx5e_port_ptys2speed (now
mlx5_port_ptys2info) does not return a speed. And thus it relies on
data_rate_oper. It reads to me as long as there's no issue acquiring
the speed duplex should be set to full.

> You don't say in the commit message. Why is Half duplex
> important to this fix? I don't see Half anywhere in the code.

It does not return half duplex at all. It would be unknown. I'm just
saying that half duplex shouldn't exist in modern Mellanox 5.

> Also, what sort of problems do you see with duplex unknown?

There were reports of RHEL seeing duplex unknown in ethtool
on Azure Mellanox 5. The intention is to fix this.

Thanks for reviewing.

Li Tian
Re: [PATCH net] net/mlx5: report duplex full when speed is known
Posted by Andrew Lunn 2 weeks, 4 days ago
On Sun, Sep 14, 2025 at 10:22:35AM +0800, Li Tian wrote:
> On Sat, Sep 13, 2025 at 10:12 PM Andrew Lunn <andrew@lunn.ch> wrote:
> 
> > I'm confused with your commit message. You say DUPLEX used to be
> > reported as Full if the speed is known. How does c268ca6087f55 change
> > this?
> 
> Because in some circumstances like Azure, mlx5e_port_ptys2speed (now
> mlx5_port_ptys2info) does not return a speed.

So it can have link up without a speed? Speed is returned unknown? But
Azure is virtual? So both speed and duplex are both meaningless? There
is no physical communication medium. So unknown is reasonable.

> It does not return half duplex at all. It would be unknown. I'm just
> saying that half duplex shouldn't exist in modern Mellanox 5.

And that is relevant because?

> > Also, what sort of problems do you see with duplex unknown?
> 
> There were reports of RHEL seeing duplex unknown in ethtool
> on Azure Mellanox 5. The intention is to fix this.

Just reports of ethtool returning unknown? But nothing actually
broken?

	Andrew