Blame SOURCES/0184-netdrv-net-mlx5-Expose-port-speed-when-possible.patch

d8f823
From b5743d69b40d3913a3d825221929275be67c0110 Mon Sep 17 00:00:00 2001
d8f823
From: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Date: Tue, 12 May 2020 10:54:56 -0400
d8f823
Subject: [PATCH 184/312] [netdrv] net/mlx5: Expose port speed when possible
d8f823
d8f823
Message-id: <20200512105530.4207-91-ahleihel@redhat.com>
d8f823
Patchwork-id: 306962
d8f823
Patchwork-instance: patchwork
d8f823
O-Subject: [RHEL8.3 BZ 1789382 090/124] net/mlx5: Expose port speed when possible
d8f823
Bugzilla: 1831133 1789382
d8f823
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
d8f823
RH-Acked-by: Kamal Heib <kheib@redhat.com>
d8f823
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
d8f823
d8f823
Bugzilla: http://bugzilla.redhat.com/1789382
d8f823
Bugzilla: http://bugzilla.redhat.com/1831133
d8f823
Upstream: v5.7-rc1
d8f823
d8f823
commit c268ca6087f553bfc0e16ffec412b983ffe32fd4
d8f823
Author: Mark Bloch <markb@mellanox.com>
d8f823
Date:   Tue Feb 25 18:04:40 2020 +0000
d8f823
d8f823
    net/mlx5: Expose port speed when possible
d8f823
d8f823
    When port speed can't be reported based on ext_eth_proto_capability
d8f823
    or eth_proto_capability instead of reporting speed as unknown check
d8f823
    if the port's speed can be inferred based on the data_rate_oper field.
d8f823
d8f823
    Signed-off-by: Mark Bloch <markb@mellanox.com>
d8f823
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
d8f823
d8f823
Signed-off-by: Alaa Hleihel <ahleihel@redhat.com>
d8f823
Signed-off-by: Frantisek Hrbata <fhrbata@redhat.com>
d8f823
---
d8f823
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 10 ++++++++--
d8f823
 1 file changed, 8 insertions(+), 2 deletions(-)
d8f823
d8f823
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
d8f823
index 915f1d74afad..3b5f4a2c9f4e 100644
d8f823
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
d8f823
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
d8f823
@@ -768,6 +768,7 @@ static void ptys2ethtool_supported_advertised_port(struct ethtool_link_ksettings
d8f823
 
d8f823
 static void get_speed_duplex(struct net_device *netdev,
d8f823
 			     u32 eth_proto_oper, bool force_legacy,
d8f823
+			     u16 data_rate_oper,
d8f823
 			     struct ethtool_link_ksettings *link_ksettings)
d8f823
 {
d8f823
 	struct mlx5e_priv *priv = netdev_priv(netdev);
d8f823
@@ -779,7 +780,10 @@ static void get_speed_duplex(struct net_device *netdev,
d8f823
 
d8f823
 	speed = mlx5e_port_ptys2speed(priv->mdev, eth_proto_oper, force_legacy);
d8f823
 	if (!speed) {
d8f823
-		speed = SPEED_UNKNOWN;
d8f823
+		if (data_rate_oper)
d8f823
+			speed = 100 * data_rate_oper;
d8f823
+		else
d8f823
+			speed = SPEED_UNKNOWN;
d8f823
 		goto out;
d8f823
 	}
d8f823
 
d8f823
@@ -869,6 +873,7 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
d8f823
 {
d8f823
 	struct mlx5_core_dev *mdev = priv->mdev;
d8f823
 	u32 out[MLX5_ST_SZ_DW(ptys_reg)] = {0};
d8f823
+	u16 data_rate_oper;
d8f823
 	u32 rx_pause = 0;
d8f823
 	u32 tx_pause = 0;
d8f823
 	u32 eth_proto_cap;
d8f823
@@ -912,6 +917,7 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
d8f823
 	an_disable_admin    = MLX5_GET(ptys_reg, out, an_disable_admin);
d8f823
 	an_status	    = MLX5_GET(ptys_reg, out, an_status);
d8f823
 	connector_type	    = MLX5_GET(ptys_reg, out, connector_type);
d8f823
+	data_rate_oper	    = MLX5_GET(ptys_reg, out, data_rate_oper);
d8f823
 
d8f823
 	mlx5_query_port_pause(mdev, &rx_pause, &tx_pause);
d8f823
 
d8f823
@@ -922,7 +928,7 @@ int mlx5e_ethtool_get_link_ksettings(struct mlx5e_priv *priv,
d8f823
 	get_advertising(eth_proto_admin, tx_pause, rx_pause, link_ksettings,
d8f823
 			admin_ext);
d8f823
 	get_speed_duplex(priv->netdev, eth_proto_oper, !admin_ext,
d8f823
-			 link_ksettings);
d8f823
+			 data_rate_oper, link_ksettings);
d8f823
 
d8f823
 	eth_proto_oper = eth_proto_oper ? eth_proto_oper : eth_proto_cap;
d8f823
 
d8f823
-- 
d8f823
2.13.6
d8f823