mlxsw: spectrum: Prevent force of 56G [Linux 4.14.129]

mlxsw: spectrum: Prevent force of 56G [Linux 4.14.129]

This Linux kernel change "mlxsw: spectrum: Prevent force of 56G" is included in the Linux 4.14.129 release. This change is authored by Amit Cohen <amitc [at] mellanox.com> on Wed May 29 10:59:45 2019 +0300. The commit for this change in Linux stable tree is 3b7bb93 (patch) which is from upstream commit 275e928. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 275e928.

mlxsw: spectrum: Prevent force of 56G

[ Upstream commit 275e928f19117d22f6d26dee94548baf4041b773 ]

Force of 56G is not supported by hardware in Ethernet devices. This
configuration fails with a bad parameter error from firmware.

Add check of this case. Instead of trying to set 56G with autoneg off,
return a meaningful error.

Fixes: 56ade8fe3fe1 ("mlxsw: spectrum: Add initial support for Spectrum ASIC")
Signed-off-by: Amit Cohen <[email protected]>
Acked-by: Jiri Pirko <[email protected]>
Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>

There are 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index ab09f9e..5c74787 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -2505,6 +2505,10 @@ static int mlxsw_sp_port_get_link_ksettings(struct net_device *dev,
    mlxsw_reg_ptys_eth_unpack(ptys_pl, &eth_proto_cap, NULL, NULL);

    autoneg = cmd->base.autoneg == AUTONEG_ENABLE;
+   if (!autoneg && cmd->base.speed == SPEED_56000) {
+       netdev_err(dev, "56G not supported with autoneg off\n");
+       return -EINVAL;
+   }
    eth_proto_new = autoneg ?
        mlxsw_sp_to_ptys_advert_link(cmd) :
        mlxsw_sp_to_ptys_speed(cmd->base.speed);

Leave a Reply

Your email address will not be published. Required fields are marked *