]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mlxsw: spectrum: Prevent force of 56G
authorAmit Cohen <amitc@mellanox.com>
Wed, 29 May 2019 07:59:45 +0000 (10:59 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 May 2019 19:30:47 +0000 (12:30 -0700)
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 <amitc@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c

index dbb425717f5ed4971ecdfc4b01f3bdfef555aac6..dfe6b44baf635701e155809b5b9304e55c63faae 100644 (file)
@@ -3128,6 +3128,10 @@ mlxsw_sp_port_set_link_ksettings(struct net_device *dev,
        ops->reg_ptys_eth_unpack(mlxsw_sp, 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 ?
                ops->to_ptys_advert_link(mlxsw_sp, cmd) :
                ops->to_ptys_speed(mlxsw_sp, cmd->base.speed);