Commit 6277d46b authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller

mlxsw: spectrum: Force link training according to admin state

When setting a new speed we need to disable and enable the port for the
changes to take effect. We currently only do that if the operational
state of the port is up. However, setting a new speed following link
training failure will require us to explicitly set the port down and then
up.

Instead, disable and enable the port based on its administrative state.

Fixes: 56ade8fe ("mlxsw: spectrum: Add initial support for Spectrum ASIC")
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dd79cf7d
...@@ -171,23 +171,6 @@ static int mlxsw_sp_port_admin_status_set(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -171,23 +171,6 @@ static int mlxsw_sp_port_admin_status_set(struct mlxsw_sp_port *mlxsw_sp_port,
return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(paos), paos_pl); return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(paos), paos_pl);
} }
static int mlxsw_sp_port_oper_status_get(struct mlxsw_sp_port *mlxsw_sp_port,
bool *p_is_up)
{
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
char paos_pl[MLXSW_REG_PAOS_LEN];
u8 oper_status;
int err;
mlxsw_reg_paos_pack(paos_pl, mlxsw_sp_port->local_port, 0);
err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(paos), paos_pl);
if (err)
return err;
oper_status = mlxsw_reg_paos_oper_status_get(paos_pl);
*p_is_up = oper_status == MLXSW_PORT_ADMIN_STATUS_UP ? true : false;
return 0;
}
static int mlxsw_sp_port_dev_addr_set(struct mlxsw_sp_port *mlxsw_sp_port, static int mlxsw_sp_port_dev_addr_set(struct mlxsw_sp_port *mlxsw_sp_port,
unsigned char *addr) unsigned char *addr)
{ {
...@@ -1493,7 +1476,6 @@ static int mlxsw_sp_port_set_settings(struct net_device *dev, ...@@ -1493,7 +1476,6 @@ static int mlxsw_sp_port_set_settings(struct net_device *dev,
u32 eth_proto_new; u32 eth_proto_new;
u32 eth_proto_cap; u32 eth_proto_cap;
u32 eth_proto_admin; u32 eth_proto_admin;
bool is_up;
int err; int err;
speed = ethtool_cmd_speed(cmd); speed = ethtool_cmd_speed(cmd);
...@@ -1525,12 +1507,7 @@ static int mlxsw_sp_port_set_settings(struct net_device *dev, ...@@ -1525,12 +1507,7 @@ static int mlxsw_sp_port_set_settings(struct net_device *dev,
return err; return err;
} }
err = mlxsw_sp_port_oper_status_get(mlxsw_sp_port, &is_up); if (!netif_running(dev))
if (err) {
netdev_err(dev, "Failed to get oper status");
return err;
}
if (!is_up)
return 0; return 0;
err = mlxsw_sp_port_admin_status_set(mlxsw_sp_port, false); err = mlxsw_sp_port_admin_status_set(mlxsw_sp_port, false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment