mlxsw: spectrum: Prevent force of 56G
[platform/kernel/linux-starfive.git] / drivers / net / ethernet / mellanox / mlxsw / spectrum.c
index dbb4257..dfe6b44 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);